@etaio/core-types 1.0.7 → 1.1.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.
@@ -55,6 +55,26 @@ export interface TextGenerationRequest {
55
55
  user?: string;
56
56
  metadata?: Record<string, any>;
57
57
  }
58
+ export type MediaType = 'image' | 'video' | 'audio' | 'document' | 'file';
59
+ export interface MediaAttachment {
60
+ id: string;
61
+ type: MediaType;
62
+ url: string;
63
+ name?: string;
64
+ size?: number;
65
+ mimeType?: string;
66
+ duration?: number;
67
+ dimensions?: {
68
+ width: number;
69
+ height: number;
70
+ };
71
+ thumbnail?: string;
72
+ description?: string;
73
+ transcription?: string;
74
+ extractedText?: string;
75
+ processingStatus?: 'pending' | 'processing' | 'completed' | 'failed';
76
+ processingError?: string;
77
+ }
58
78
  export interface ChatMessage {
59
79
  role: 'system' | 'user' | 'assistant' | 'function';
60
80
  content: string;
@@ -63,6 +83,21 @@ export interface ChatMessage {
63
83
  name: string;
64
84
  arguments: string;
65
85
  };
86
+ id?: string;
87
+ timestamp?: Date;
88
+ attachments?: MediaAttachment[];
89
+ metadata?: {
90
+ source?: 'chat' | 'project' | 'inspiration' | 'upload';
91
+ type?: 'text' | 'media' | 'mixed' | 'reference';
92
+ projectId?: string;
93
+ inspirationItem?: any;
94
+ aiContext?: string;
95
+ isProcessing?: boolean;
96
+ };
97
+ sending?: boolean;
98
+ error?: string;
99
+ edited?: boolean;
100
+ editedAt?: Date;
66
101
  }
67
102
  export interface FunctionDefinition {
68
103
  name: string;
@@ -283,5 +318,17 @@ export type GenAIResponse<T> = {
283
318
  success: false;
284
319
  error: GenAIError;
285
320
  };
321
+ /**
322
+ * Creates AI context from a chat message, including media descriptions
323
+ */
324
+ export declare function createAIContext(message: ChatMessage): string;
325
+ /**
326
+ * Checks if a chat message has media attachments
327
+ */
328
+ export declare function hasMedia(message: ChatMessage): boolean;
329
+ /**
330
+ * Gets the count of media attachments by type
331
+ */
332
+ export declare function getMediaCount(message: ChatMessage, type?: MediaType): number;
286
333
  export * from './index';
287
334
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/genai/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,OAAO,GACP,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,aAAa,GACb,WAAW,GACX,YAAY,GACZ,UAAU,CAAC;AAEf,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;IACzD,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,YAAY,GACZ,WAAW,GACX,kBAAkB,GAClB,QAAQ,GACR,MAAM,GACN,WAAW,CAAC;AAEhB,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,C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AE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,UAAU,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,IAAI,CAAC;KACb,CAAC;IACF,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAMD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT,GAAG;IACF,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAMF;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAwB5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAI5E;AAMD,cAAc,SAAS,CAAC"}
package/dist/index.es.js CHANGED
@@ -8,14 +8,14 @@ function Er(r) {
8
8
  function Ir(r) {
9
9
  return Object.values(M).includes(r);
10
10
  }
11
- function De(r) {
11
+ function $e(r) {
12
12
  return typeof r == "object" && r !== null && typeof r.projectId == "string";
13
13
  }
14
14
  function Rr(r) {
15
- return De(r) && "pagination" in r;
15
+ return $e(r) && "pagination" in r;
16
16
  }
17
17
  function Sr(r) {
18
- return De(r) && ("filters" in r || "sort" in r);
18
+ return $e(r) && ("filters" in r || "sort" in r);
19
19
  }
20
20
  function Cr(r, e) {
21
21
  return {
@@ -56,10 +56,10 @@ function Or(r, e, t, n) {
56
56
  function Xe(r) {
57
57
  return r.success === !0 && "data" in r;
58
58
  }
59
- function Nr(r) {
59
+ function jr(r) {
60
60
  return r.success === !1 && "error" in r;
61
61
  }
62
- function jr(r) {
62
+ function Nr(r) {
63
63
  return Xe(r) && "pagination" in r;
64
64
  }
65
65
  function Pr(r) {
@@ -69,10 +69,10 @@ function Mr(r) {
69
69
  return r && typeof r == "object" && typeof r.provider == "string" && typeof r.model == "string" && typeof r.userId == "string";
70
70
  }
71
71
  var Ke = /* @__PURE__ */ ((r) => (r.PROCESSING = "processing", r.READY = "ready", r.FAILED = "failed", r.QUEUED = "queued", r.DELETED = "deleted", r.ARCHIVED = "archived", r))(Ke || {});
72
- function Dr(r) {
72
+ function $r(r) {
73
73
  return typeof r == "object" && r !== null && "provider" in r && typeof r.provider == "string";
74
74
  }
75
- function $r(r) {
75
+ function Dr(r) {
76
76
  return r.generationMetadata !== void 0;
77
77
  }
78
78
  function Vr(r) {
@@ -516,6 +516,29 @@ class Wr extends Error {
516
516
  super(t), this.code = e, this.provider = n, this.statusCode = s, this.details = i, this.name = "GenAIException";
517
517
  }
518
518
  }
519
+ function Gr(r) {
520
+ let e = r.content;
521
+ if (r.attachments && r.attachments.length > 0) {
522
+ const t = r.attachments.map((n) => {
523
+ let s = `[${n.type.toUpperCase()}: ${n.name || "Untitled"}]`;
524
+ return n.description && (s += ` - ${n.description}`), n.transcription && (s += `
525
+ Transcription: ${n.transcription}`), n.extractedText && (s += `
526
+ Extracted text: ${n.extractedText}`), s;
527
+ }).join(`
528
+ `);
529
+ e = `${e}
530
+
531
+ Attachments:
532
+ ${t}`;
533
+ }
534
+ return e;
535
+ }
536
+ function Yr(r) {
537
+ return !!(r.attachments && r.attachments.length > 0);
538
+ }
539
+ function Hr(r, e) {
540
+ return r.attachments ? e ? r.attachments.filter((t) => t.type === e).length : r.attachments.length : 0;
541
+ }
519
542
  var x;
520
543
  (function(r) {
521
544
  r.assertEqual = (s) => s;
@@ -581,7 +604,7 @@ const p = x.arrayToEnum([
581
604
  "never",
582
605
  "map",
583
606
  "set"
584
- ]), j = (r) => {
607
+ ]), N = (r) => {
585
608
  switch (typeof r) {
586
609
  case "undefined":
587
610
  return p.undefined;
@@ -736,12 +759,12 @@ const J = (r, e) => {
736
759
  }
737
760
  return { message: t };
738
761
  };
739
- let $e = J;
762
+ let De = J;
740
763
  function rt(r) {
741
- $e = r;
764
+ De = r;
742
765
  }
743
766
  function ve() {
744
- return $e;
767
+ return De;
745
768
  }
746
769
  const _e = (r) => {
747
770
  const { data: e, path: t, errorMaps: n, issueData: s } = r, i = [...t, ...s.path || []], o = {
@@ -847,7 +870,7 @@ class Z {
847
870
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
848
871
  }
849
872
  }
850
- const je = (r, e) => {
873
+ const Ne = (r, e) => {
851
874
  if (B(e))
852
875
  return { success: !0, data: e.value };
853
876
  if (!r.common.issues.length)
@@ -879,13 +902,13 @@ class _ {
879
902
  return this._def.description;
880
903
  }
881
904
  _getType(e) {
882
- return j(e.data);
905
+ return N(e.data);
883
906
  }
884
907
  _getOrReturnCtx(e, t) {
885
908
  return t || {
886
909
  common: e.parent.common,
887
910
  data: e.data,
888
- parsedType: j(e.data),
911
+ parsedType: N(e.data),
889
912
  schemaErrorMap: this._def.errorMap,
890
913
  path: e.path,
891
914
  parent: e.parent
@@ -897,7 +920,7 @@ class _ {
897
920
  ctx: {
898
921
  common: e.parent.common,
899
922
  data: e.data,
900
- parsedType: j(e.data),
923
+ parsedType: N(e.data),
901
924
  schemaErrorMap: this._def.errorMap,
902
925
  path: e.path,
903
926
  parent: e.parent
@@ -932,9 +955,9 @@ class _ {
932
955
  schemaErrorMap: this._def.errorMap,
933
956
  parent: null,
934
957
  data: e,
935
- parsedType: j(e)
958
+ parsedType: N(e)
936
959
  }, i = this._parseSync({ data: e, path: s.path, parent: s });
937
- return je(s, i);
960
+ return Ne(s, i);
938
961
  }
939
962
  "~validate"(e) {
940
963
  var t, n;
@@ -947,7 +970,7 @@ class _ {
947
970
  schemaErrorMap: this._def.errorMap,
948
971
  parent: null,
949
972
  data: e,
950
- parsedType: j(e)
973
+ parsedType: N(e)
951
974
  };
952
975
  if (!this["~standard"].async)
953
976
  try {
@@ -986,9 +1009,9 @@ class _ {
986
1009
  schemaErrorMap: this._def.errorMap,
987
1010
  parent: null,
988
1011
  data: e,
989
- parsedType: j(e)
1012
+ parsedType: N(e)
990
1013
  }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (re(s) ? s : Promise.resolve(s));
991
- return je(n, i);
1014
+ return Ne(n, i);
992
1015
  }
993
1016
  refine(e, t) {
994
1017
  const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
@@ -1516,7 +1539,7 @@ function Tt(r, e) {
1516
1539
  const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, i = parseInt(r.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
1517
1540
  return i % o / Math.pow(10, s);
1518
1541
  }
1519
- class D extends _ {
1542
+ class $ extends _ {
1520
1543
  constructor() {
1521
1544
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1522
1545
  }
@@ -1574,7 +1597,7 @@ class D extends _ {
1574
1597
  return this.setLimit("max", e, !1, h.toString(t));
1575
1598
  }
1576
1599
  setLimit(e, t, n, s) {
1577
- return new D({
1600
+ return new $({
1578
1601
  ...this._def,
1579
1602
  checks: [
1580
1603
  ...this._def.checks,
@@ -1588,7 +1611,7 @@ class D extends _ {
1588
1611
  });
1589
1612
  }
1590
1613
  _addCheck(e) {
1591
- return new D({
1614
+ return new $({
1592
1615
  ...this._def,
1593
1616
  checks: [...this._def.checks, e]
1594
1617
  });
@@ -1682,13 +1705,13 @@ class D extends _ {
1682
1705
  return Number.isFinite(t) && Number.isFinite(e);
1683
1706
  }
1684
1707
  }
1685
- D.create = (r) => new D({
1708
+ $.create = (r) => new $({
1686
1709
  checks: [],
1687
1710
  typeName: g.ZodNumber,
1688
1711
  coerce: (r == null ? void 0 : r.coerce) || !1,
1689
1712
  ...v(r)
1690
1713
  });
1691
- class $ extends _ {
1714
+ class D extends _ {
1692
1715
  constructor() {
1693
1716
  super(...arguments), this.min = this.gte, this.max = this.lte;
1694
1717
  }
@@ -1744,7 +1767,7 @@ class $ extends _ {
1744
1767
  return this.setLimit("max", e, !1, h.toString(t));
1745
1768
  }
1746
1769
  setLimit(e, t, n, s) {
1747
- return new $({
1770
+ return new D({
1748
1771
  ...this._def,
1749
1772
  checks: [
1750
1773
  ...this._def.checks,
@@ -1758,7 +1781,7 @@ class $ extends _ {
1758
1781
  });
1759
1782
  }
1760
1783
  _addCheck(e) {
1761
- return new $({
1784
+ return new D({
1762
1785
  ...this._def,
1763
1786
  checks: [...this._def.checks, e]
1764
1787
  });
@@ -1815,9 +1838,9 @@ class $ extends _ {
1815
1838
  return e;
1816
1839
  }
1817
1840
  }
1818
- $.create = (r) => {
1841
+ D.create = (r) => {
1819
1842
  var e;
1820
- return new $({
1843
+ return new D({
1821
1844
  checks: [],
1822
1845
  typeName: g.ZodBigInt,
1823
1846
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
@@ -2475,7 +2498,7 @@ ae.create = (r, e) => new ae({
2475
2498
  typeName: g.ZodUnion,
2476
2499
  ...v(e)
2477
2500
  });
2478
- const N = (r) => r instanceof ce ? N(r.schema) : r instanceof S ? N(r.innerType()) : r instanceof ue ? [r.value] : r instanceof V ? r.options : r instanceof le ? x.objectValues(r.enum) : r instanceof fe ? N(r._def.innerType) : r instanceof se ? [void 0] : r instanceof ie ? [null] : r instanceof C ? [void 0, ...N(r.unwrap())] : r instanceof z ? [null, ...N(r.unwrap())] : r instanceof Ze || r instanceof he ? N(r.unwrap()) : r instanceof pe ? N(r._def.innerType) : [];
2501
+ const j = (r) => r instanceof ce ? j(r.schema) : r instanceof S ? j(r.innerType()) : r instanceof ue ? [r.value] : r instanceof V ? r.options : r instanceof le ? x.objectValues(r.enum) : r instanceof fe ? j(r._def.innerType) : r instanceof se ? [void 0] : r instanceof ie ? [null] : r instanceof C ? [void 0, ...j(r.unwrap())] : r instanceof z ? [null, ...j(r.unwrap())] : r instanceof Ze || r instanceof he ? j(r.unwrap()) : r instanceof pe ? j(r._def.innerType) : [];
2479
2502
  class Ae extends _ {
2480
2503
  _parse(e) {
2481
2504
  const { ctx: t } = this._processInputParams(e);
@@ -2520,7 +2543,7 @@ class Ae extends _ {
2520
2543
  static create(e, t, n) {
2521
2544
  const s = /* @__PURE__ */ new Map();
2522
2545
  for (const i of t) {
2523
- const o = N(i.shape[e]);
2546
+ const o = j(i.shape[e]);
2524
2547
  if (!o.length)
2525
2548
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2526
2549
  for (const d of o) {
@@ -2539,7 +2562,7 @@ class Ae extends _ {
2539
2562
  }
2540
2563
  }
2541
2564
  function Ce(r, e) {
2542
- const t = j(r), n = j(e);
2565
+ const t = N(r), n = N(e);
2543
2566
  if (r === e)
2544
2567
  return { valid: !0, data: r };
2545
2568
  if (t === p.object && n === p.object) {
@@ -3359,14 +3382,14 @@ var g;
3359
3382
  })(g || (g = {}));
3360
3383
  const It = (r, e = {
3361
3384
  message: `Input not instance of ${r.name}`
3362
- }) => qe((t) => t instanceof r, e), Fe = I.create, We = D.create, Rt = Te.create, St = $.create, Ge = ne.create, Ct = q.create, Zt = be.create, Ot = se.create, Nt = ie.create, jt = X.create, Pt = L.create, Mt = P.create, Dt = ke.create, $t = R.create, Vt = b.create, zt = b.strictCreate, Lt = ae.create, Ut = Ae.create, Bt = oe.create, qt = O.create, Ft = de.create, Wt = we.create, Gt = F.create, Yt = H.create, Ht = ce.create, Jt = ue.create, Xt = V.create, Kt = le.create, Qt = K.create, Me = S.create, er = C.create, tr = z.create, rr = S.createWithPreprocess, nr = me.create, sr = () => Fe().optional(), ir = () => We().optional(), ar = () => Ge().optional(), or = {
3385
+ }) => qe((t) => t instanceof r, e), Fe = I.create, We = $.create, Rt = Te.create, St = D.create, Ge = ne.create, Ct = q.create, Zt = be.create, Ot = se.create, jt = ie.create, Nt = X.create, Pt = L.create, Mt = P.create, $t = ke.create, Dt = R.create, Vt = b.create, zt = b.strictCreate, Lt = ae.create, Ut = Ae.create, Bt = oe.create, qt = O.create, Ft = de.create, Wt = we.create, Gt = F.create, Yt = H.create, Ht = ce.create, Jt = ue.create, Xt = V.create, Kt = le.create, Qt = K.create, Me = S.create, er = C.create, tr = z.create, rr = S.createWithPreprocess, nr = me.create, sr = () => Fe().optional(), ir = () => We().optional(), ar = () => Ge().optional(), or = {
3363
3386
  string: (r) => I.create({ ...r, coerce: !0 }),
3364
- number: (r) => D.create({ ...r, coerce: !0 }),
3387
+ number: (r) => $.create({ ...r, coerce: !0 }),
3365
3388
  boolean: (r) => ne.create({
3366
3389
  ...r,
3367
3390
  coerce: !0
3368
3391
  }),
3369
- bigint: (r) => $.create({ ...r, coerce: !0 }),
3392
+ bigint: (r) => D.create({ ...r, coerce: !0 }),
3370
3393
  date: (r) => q.create({ ...r, coerce: !0 })
3371
3394
  }, dr = y;
3372
3395
  var a = /* @__PURE__ */ Object.freeze({
@@ -3392,12 +3415,12 @@ var a = /* @__PURE__ */ Object.freeze({
3392
3415
  return Ie;
3393
3416
  },
3394
3417
  ZodParsedType: p,
3395
- getParsedType: j,
3418
+ getParsedType: N,
3396
3419
  ZodType: _,
3397
3420
  datetimeRegex: Ue,
3398
3421
  ZodString: I,
3399
- ZodNumber: D,
3400
- ZodBigInt: $,
3422
+ ZodNumber: $,
3423
+ ZodBigInt: D,
3401
3424
  ZodBoolean: ne,
3402
3425
  ZodDate: q,
3403
3426
  ZodSymbol: be,
@@ -3441,8 +3464,8 @@ var a = /* @__PURE__ */ Object.freeze({
3441
3464
  return g;
3442
3465
  },
3443
3466
  coerce: or,
3444
- any: jt,
3445
- array: $t,
3467
+ any: Nt,
3468
+ array: Dt,
3446
3469
  bigint: St,
3447
3470
  boolean: Ge,
3448
3471
  date: Ct,
@@ -3458,7 +3481,7 @@ var a = /* @__PURE__ */ Object.freeze({
3458
3481
  nan: Rt,
3459
3482
  nativeEnum: Kt,
3460
3483
  never: Mt,
3461
- null: Nt,
3484
+ null: jt,
3462
3485
  nullable: tr,
3463
3486
  number: We,
3464
3487
  object: Vt,
@@ -3479,7 +3502,7 @@ var a = /* @__PURE__ */ Object.freeze({
3479
3502
  undefined: Ot,
3480
3503
  union: Lt,
3481
3504
  unknown: Pt,
3482
- void: Dt,
3505
+ void: $t,
3483
3506
  NEVER: dr,
3484
3507
  ZodIssueCode: c,
3485
3508
  quotelessJson: tt,
@@ -3518,7 +3541,7 @@ const Oe = a.object({
3518
3541
  height: a.number().int().positive()
3519
3542
  }).optional(),
3520
3543
  duration: a.number().positive().optional()
3521
- }), Ne = Oe.extend({
3544
+ }), je = Oe.extend({
3522
3545
  name: a.string().optional(),
3523
3546
  sceneId: a.string().optional(),
3524
3547
  provider: a.string().min(1, "Provider is required"),
@@ -3554,22 +3577,22 @@ const Oe = a.object({
3554
3577
  owner: a.string().optional()
3555
3578
  }).optional()
3556
3579
  });
3557
- function Gr(r) {
3580
+ function Jr(r) {
3558
3581
  return Oe.parse(r);
3559
3582
  }
3560
- function Yr(r) {
3583
+ function Xr(r) {
3561
3584
  return Oe.safeParse(r);
3562
3585
  }
3563
- function Hr(r) {
3564
- return Ne.parse(r);
3586
+ function Kr(r) {
3587
+ return je.parse(r);
3565
3588
  }
3566
- function Jr(r) {
3567
- return Ne.safeParse(r);
3589
+ function Qr(r) {
3590
+ return je.safeParse(r);
3568
3591
  }
3569
- const lr = Ne.partial().required({
3592
+ const lr = je.partial().required({
3570
3593
  id: !0
3571
3594
  });
3572
- function Xr(r) {
3595
+ function en(r) {
3573
3596
  return lr.parse(r);
3574
3597
  }
3575
3598
  const fr = a.object({
@@ -3586,7 +3609,7 @@ const fr = a.object({
3586
3609
  page: a.number().int().min(1).optional(),
3587
3610
  limit: a.number().int().min(1).max(100).optional(),
3588
3611
  cursor: a.string().optional()
3589
- }), Kr = W.extend({
3612
+ }), tn = W.extend({
3590
3613
  pagination: pr.optional()
3591
3614
  }), hr = a.object({
3592
3615
  type: a.union([a.string(), a.array(a.string())]).optional(),
@@ -3598,7 +3621,7 @@ const fr = a.object({
3598
3621
  }).passthrough(), mr = a.object({
3599
3622
  field: a.string().min(1, "Sort field is required"),
3600
3623
  order: a.enum(["asc", "desc"])
3601
- }), Qr = W.extend({
3624
+ }), rn = W.extend({
3602
3625
  filters: hr.optional(),
3603
3626
  sort: mr.optional()
3604
3627
  }), gr = W.extend({
@@ -3638,22 +3661,22 @@ const fr = a.object({
3638
3661
  (r) => r.text || r.prompt,
3639
3662
  { message: "Either text or prompt is required" }
3640
3663
  );
3641
- function en(r) {
3664
+ function nn(r) {
3642
3665
  return W.parse(r);
3643
3666
  }
3644
- function tn(r) {
3667
+ function sn(r) {
3645
3668
  return W.safeParse(r);
3646
3669
  }
3647
- function rn(r) {
3670
+ function an(r) {
3648
3671
  return gr.parse(r);
3649
3672
  }
3650
- function nn(r) {
3673
+ function on(r) {
3651
3674
  return yr.parse(r);
3652
3675
  }
3653
- function sn(r) {
3676
+ function dn(r) {
3654
3677
  return vr.parse(r);
3655
3678
  }
3656
- function an(r) {
3679
+ function cn(r) {
3657
3680
  return (e) => r.parse(e);
3658
3681
  }
3659
3682
  const Ye = a.object({
@@ -3707,27 +3730,27 @@ const Ye = a.object({
3707
3730
  processingTime: a.number().min(0).optional(),
3708
3731
  cost: a.number().min(0).optional()
3709
3732
  });
3710
- function on(r) {
3733
+ function un(r) {
3711
3734
  return ge.parse(r);
3712
3735
  }
3713
- function dn(r) {
3736
+ function ln(r) {
3714
3737
  return ge.safeParse(r);
3715
3738
  }
3716
- function cn(r) {
3739
+ function fn(r) {
3717
3740
  return br.parse(r);
3718
3741
  }
3719
- function un(r) {
3742
+ function pn(r) {
3720
3743
  return wr.parse(r);
3721
3744
  }
3722
- function ln(r) {
3745
+ function hn(r) {
3723
3746
  return Tr.parse(r);
3724
3747
  }
3725
- function fn(r) {
3748
+ function mn(r) {
3726
3749
  return (e) => r.parse(e);
3727
3750
  }
3728
- const pn = "1.0.7", hn = "@etaio/core-types";
3751
+ const gn = "1.0.7", yn = "@etaio/core-types";
3729
3752
  export {
3730
- Ne as ApiAssetSchema,
3753
+ je as ApiAssetSchema,
3731
3754
  zr as AssetAdapter,
3732
3755
  Ke as AssetStatus,
3733
3756
  M as AssetType,
@@ -3740,13 +3763,13 @@ export {
3740
3763
  kr as BatchResultSchema,
3741
3764
  Ye as ErrorResponseSchema,
3742
3765
  hr as FilterParamsSchema,
3743
- Qr as FilteredRequestSchema,
3766
+ rn as FilteredRequestSchema,
3744
3767
  Wr as GenAIException,
3745
3768
  cr as GenerationMetadataSchema,
3746
3769
  Tr as GenerationResponseSchema,
3747
3770
  gr as ImageGenerationRequestSchema,
3748
- hn as PACKAGE_NAME,
3749
- Kr as PaginatedRequestSchema,
3771
+ yn as PACKAGE_NAME,
3772
+ tn as PaginatedRequestSchema,
3750
3773
  br as PaginatedResponseSchema,
3751
3774
  xr as PaginationInfoSchema,
3752
3775
  pr as PaginationParamsSchema,
@@ -3762,39 +3785,42 @@ export {
3762
3785
  _r as ResponseMetadataSchema,
3763
3786
  mr as SortParamsSchema,
3764
3787
  ur as UploadMetadataSchema,
3765
- pn as VERSION,
3788
+ gn as VERSION,
3766
3789
  yr as VideoGenerationRequestSchema,
3767
- an as createRequestValidator,
3768
- fn as createResponseValidator,
3790
+ Gr as createAIContext,
3791
+ cn as createRequestValidator,
3792
+ mn as createResponseValidator,
3769
3793
  Zr as errorResponse,
3770
- $r as hasGenerationMetadata,
3794
+ Hr as getMediaCount,
3795
+ Dr as hasGenerationMetadata,
3796
+ Yr as hasMedia,
3771
3797
  Vr as hasUploadMetadata,
3772
- Dr as isApiAsset,
3798
+ $r as isApiAsset,
3773
3799
  Ir as isAssetType,
3774
3800
  Er as isBaseAsset,
3775
- De as isBaseRequest,
3776
- Nr as isErrorResponse,
3801
+ $e as isBaseRequest,
3802
+ jr as isErrorResponse,
3777
3803
  Sr as isFilteredRequest,
3778
3804
  Pr as isGenerativeAsset,
3779
3805
  Mr as isGenerativeMetadata,
3780
3806
  Rr as isPaginatedRequest,
3781
- jr as isPaginatedResponse,
3807
+ Nr as isPaginatedResponse,
3782
3808
  Xe as isSuccessResponse,
3783
3809
  Or as paginatedResponse,
3784
- Jr as safeValidateApiAsset,
3785
- Yr as safeValidateBaseAsset,
3786
- tn as safeValidateBaseRequest,
3787
- dn as safeValidateBaseResponse,
3810
+ Qr as safeValidateApiAsset,
3811
+ Xr as safeValidateBaseAsset,
3812
+ sn as safeValidateBaseRequest,
3813
+ ln as safeValidateBaseResponse,
3788
3814
  Cr as successResponse,
3789
- Hr as validateApiAsset,
3790
- sn as validateAudioGenerationRequest,
3791
- Gr as validateBaseAsset,
3792
- en as validateBaseRequest,
3793
- on as validateBaseResponse,
3794
- un as validateBatchResponse,
3795
- ln as validateGenerationResponse,
3796
- rn as validateImageGenerationRequest,
3797
- cn as validatePaginatedResponse,
3798
- Xr as validatePartialAssetUpdate,
3799
- nn as validateVideoGenerationRequest
3815
+ Kr as validateApiAsset,
3816
+ dn as validateAudioGenerationRequest,
3817
+ Jr as validateBaseAsset,
3818
+ nn as validateBaseRequest,
3819
+ un as validateBaseResponse,
3820
+ pn as validateBatchResponse,
3821
+ hn as validateGenerationResponse,
3822
+ an as validateImageGenerationRequest,
3823
+ fn as validatePaginatedResponse,
3824
+ en as validatePartialAssetUpdate,
3825
+ on as validateVideoGenerationRequest
3800
3826
  };
package/dist/index.umd.js CHANGED
@@ -1 +1,7 @@
1
- (function(l,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(l=typeof globalThis<"u"?globalThis:l||self,w(l.etaioCoreTypes={}))})(this,function(l){"use strict";var dn=Object.defineProperty;var cn=(l,w,Y)=>w in l?dn(l,w,{enumerable:!0,configurable:!0,writable:!0,value:Y}):l[w]=Y;var Ie=(l,w,Y)=>cn(l,typeof w!="symbol"?w+"":w,Y);var w=(r=>(r.IMAGE="image",r.VIDEO="video",r.AUDIO="audio",r.TEXT="text",r.GRAPHICS="graphics",r))(w||{});function Y(r){return typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.type=="string"&&typeof r.url=="string"&&typeof r.projectId=="string"&&r.createdAt instanceof Date}function vt(r){return Object.values(w).includes(r)}function Ce(r){return typeof r=="object"&&r!==null&&typeof r.projectId=="string"}function yt(r){return Ce(r)&&"pagination"in r}function _t(r){return Ce(r)&&("filters"in r||"sort"in r)}function bt(r,e){return{success:!0,data:r,metadata:{timestamp:new Date,...e}}}function xt(r,e,t){return{success:!1,error:{code:r,message:e,details:t,timestamp:new Date().toISOString()}}}function kt(r,e,t,n){const s=Math.ceil(n/t);return{success:!0,data:r,pagination:{page:e,limit:t,total:n,totalPages:s,hasNext:e<s,hasPrevious:e>1}}}function De(r){return r.success===!0&&"data"in r}function wt(r){return r.success===!1&&"error"in r}function Tt(r){return De(r)&&"pagination"in r}function At(r){return r&&typeof r=="object"&&r.metadata&&typeof r.metadata.provider=="string"&&typeof r.metadata.model=="string"&&typeof r.sourceType=="string"}function Rt(r){return r&&typeof r=="object"&&typeof r.provider=="string"&&typeof r.model=="string"&&typeof r.userId=="string"}var $e=(r=>(r.PROCESSING="processing",r.READY="ready",r.FAILED="failed",r.QUEUED="queued",r.DELETED="deleted",r.ARCHIVED="archived",r))($e||{});function St(r){return typeof r=="object"&&r!==null&&"provider"in r&&typeof r.provider=="string"}function Et(r){return r.generationMetadata!==void 0}function It(r){return r.uploadMetadata!==void 0}class Ct{static toBaseAsset(e){return this.isOnlyBaseAsset(e)?e:{id:e.id,type:this.normalizeAssetType(e.type),url:this.extractUrl(e),projectId:e.projectId,createdAt:e.createdAt instanceof Date?e.createdAt:new Date(e.createdAt),updatedAt:e.updatedAt?new Date(e.updatedAt):void 0}}static toApiAsset(e,t){return{...e,provider:(t==null?void 0:t.provider)||"unknown",name:t==null?void 0:t.name,sceneId:t==null?void 0:t.sceneId,uploadMetadata:t==null?void 0:t.uploadMetadata,generationMetadata:t==null?void 0:t.generationMetadata,processingMetadata:t==null?void 0:t.processingMetadata,dimensions:t==null?void 0:t.dimensions,duration:t==null?void 0:t.duration,size:t==null?void 0:t.size,contentType:t==null?void 0:t.contentType,tags:t==null?void 0:t.tags,rights:t==null?void 0:t.rights}}static fromTrackItem(e){return{...this.toBaseAsset(e),name:e.name,provider:"timeline",duration:e.duration,dimensions:this.extractDimensions(e),contentType:this.inferContentType(e.type)}}static toTrackItem(e,t,n){var o,d,f,u;const s=this.mapToTrackItemType(e.type),a={id:e.id,name:e.name||`${e.type} ${e.id}`,type:s,preview:e.url,display:t||{from:0,to:100},duration:e.duration,metadata:{sourceAssetId:e.id,provider:e.provider,...e.generationMetadata},...n};switch(s){case"image":return{...a,type:"image",details:{src:e.url,width:((o=e.dimensions)==null?void 0:o.width)||1920,height:((d=e.dimensions)==null?void 0:d.height)||1080,opacity:1,transform:"",border:"",borderRadius:0,top:"0",left:"0",transformOrigin:"center",blur:0,brightness:100,flipX:!1,flipY:!1,rotate:"0deg",visibility:"visible"}};case"video":return{...a,type:"video",details:{src:e.url,width:((f=e.dimensions)==null?void 0:f.width)||1920,height:((u=e.dimensions)==null?void 0:u.height)||1080,volume:1,blur:0,brightness:100,flipX:!1,flipY:!1,rotate:"0deg",visibility:"visible"}};case"audio":return{...a,type:"audio",details:{src:e.url,volume:1}};case"text":return{...a,type:"text",details:{text:"",fontSize:32,fontFamily:"Arial",fontUrl:"",color:"#000000",lineHeight:"1.2",letterSpacing:"0",fontWeight:400,fontStyle:"normal",textDecoration:"none",textAlign:"center",wordSpacing:"0",textShadow:"",backgroundColor:"transparent",opacity:1,width:500,height:100,top:"50%",left:"50%",transform:"translate(-50%, -50%)",border:"",wordWrap:"normal",wordBreak:"normal",WebkitTextStrokeColor:"",WebkitTextStrokeWidth:"0",borderWidth:0,borderColor:"",boxShadow:{color:"",x:0,y:0,blur:0},borderRadius:0,skewX:0,skewY:0,textTransform:"none"}};default:return a}}static normalizeAssetType(e){switch(e.toLowerCase()){case"image":case"img":case"photo":return w.IMAGE;case"video":case"vid":case"movie":return w.VIDEO;case"audio":case"sound":case"music":return w.AUDIO;case"text":case"txt":case"caption":return w.TEXT;case"graphics":case"svg":case"vector":return w.GRAPHICS;default:return w.IMAGE}}static mapToTrackItemType(e){switch(e){case"image":case"graphics":return"image";case"video":return"video";case"audio":return"audio";case"text":return"text";default:return"image"}}static extractUrl(e){var t;return e.url?e.url:(t=e.details)!=null&&t.src?e.details.src:e.preview?e.preview:""}static extractDimensions(e){if("details"in e&&e.details){const t=e.details;if(t.width&&t.height)return{width:t.width,height:t.height}}}static inferContentType(e){switch(e){case"image":return"image/jpeg";case"video":return"video/mp4";case"audio":return"audio/mpeg";case"text":return"text/plain";default:return"application/octet-stream"}}static isOnlyBaseAsset(e){const t=["id","type","url","projectId","createdAt","updatedAt"];return Object.keys(e).every(s=>t.includes(s))}static isTrackItem(e){return typeof e=="object"&&e!==null&&"display"in e&&"details"in e&&"name"in e}static isApiAsset(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class D extends Error{constructor(e,t,n,s=!1,a){super(e),this.code=t,this.provider=n,this.retryable=s,this.details=a,this.name="ProviderError"}}class Zt extends D{constructor(e,t){super(`Provider quota exceeded for ${e}`,"QUOTA_EXCEEDED",e,!1,t),this.name="ProviderQuotaError"}}class Be extends D{constructor(e,t){super(`Rate limit exceeded for ${e}`,"RATE_LIMITED",e,!0,{retryAfter:t}),this.name="ProviderRateLimitError"}}class qe extends D{constructor(e,t){super(`Authentication failed for ${e}`,"AUTH_FAILED",e,!1,t),this.name="ProviderAuthError"}}class Ot extends D{constructor(e,t){super(`Request timeout for ${e} after ${t}ms`,"TIMEOUT",e,!0,{timeout:t}),this.name="ProviderTimeoutError"}}class Nt extends D{constructor(e,t){super(`Validation failed for ${e}: ${t.join(", ")}`,"VALIDATION_FAILED",e,!1,{errors:t}),this.name="ProviderValidationError"}}class jt{constructor(e){Ie(this,"config");Ie(this,"retryCount",0);this.config=e}async executeWithRetry(e,t){var d,f,u,g;const n=((d=this.config.retry)==null?void 0:d.maxAttempts)||3,s=((f=this.config.retry)==null?void 0:f.backoffMultiplier)||2,a=((u=this.config.retry)==null?void 0:u.maxDelay)||3e4;let o;for(let T=0;T<n;T++)try{return this.retryCount=T,await e()}catch(E){if(o=E,E instanceof D&&!E.retryable)throw E;if(T<n-1){const ye=Math.min(Math.pow(s,T)*1e3,a);E instanceof Be&&((g=E.details)!=null&&g.retryAfter)?await this.delay(E.details.retryAfter*1e3):await this.delay(ye)}}throw o||new D(`Failed after ${n} attempts`,"MAX_RETRIES",t,!1)}delay(e){return new Promise(t=>setTimeout(t,e))}validateCredentials(){if(!this.config.apiKey&&!this.config.endpoint)throw new qe("unknown",{message:"No API key or endpoint configured"})}}class Pt{constructor(){Ie(this,"providers",new Map)}register(e,t){this.providers.set(e,t)}get(e){return this.providers.get(e)}list(){return Array.from(this.providers.keys())}has(e){return this.providers.has(e)}remove(e){return this.providers.delete(e)}getByType(e){return Array.from(this.providers.values()).filter(t=>t.type===e)}}class Mt extends Error{constructor(e,t,n,s,a){super(t),this.code=e,this.provider=n,this.statusCode=s,this.details=a,this.name="GenAIException"}}var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(d=>typeof s[s[d]]!="number"),o={};for(const d of a)o[d]=s[d];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},r.find=(s,a)=>{for(const o of s)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ze||(Ze={}));const p=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},c=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Vt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class S extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let d=n,f=0;for(;f<o.path.length;){const u=o.path[f];f===o.path.length-1?(d[u]=d[u]||{_errors:[]},d[u]._errors.push(t(o))):d[u]=d[u]||{_errors:[]},d=d[u],f++}}};return s(this),n}static assert(e){if(!(e instanceof S))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=r=>new S(r);const H=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Le=H;function Dt(r){Le=r}function _e(){return Le}const be=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let d="";const f=n.filter(u=>!!u).slice().reverse();for(const u of f)d=u(o,{data:e,defaultError:d}).message;return{...s,path:a,message:d}},$t=[];function h(r,e){const t=_e(),n=be({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(s=>!!s)});r.common.issues.push(n)}class A{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,o=await s.value;n.push({key:a,value:o})}return A.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return y;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),J=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),Oe=r=>r.status==="aborted",Ne=r=>r.status==="dirty",U=r=>r.status==="valid",re=r=>typeof Promise<"u"&&r instanceof Promise;function xe(r,e,t,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function ze(r,e,t,n,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var ne,se;class O{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ue=(r,e)=>{if(U(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new S(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,d)=>{var f,u;const{message:g}=r;return o.code==="invalid_enum_value"?{message:g??d.defaultError}:typeof d.data>"u"?{message:(f=g??n)!==null&&f!==void 0?f:d.defaultError}:o.code!=="invalid_type"?{message:d.defaultError}:{message:(u=g??t)!==null&&u!==void 0?u:d.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new A,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ue(s,a)}"~validate"(e){var t,n;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return U(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>U(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(re(s)?s:Promise.resolve(s));return Ue(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const o=e(s),d=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(d(),!1)):o?!0:(d(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Z({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return ee.create(this,this._def)}or(e){return de.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new Z({..._(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pe({..._(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new Me({typeName:v.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new me({..._(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bt=/^c[^\s-]{8,}$/i,qt=/^[0-9a-z]+$/,Lt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zt=/^[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,Ut=/^[a-z0-9_-]{21}$/i,Ft=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gt=/^[-+]?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)?)??$/,Wt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let je;const Ht=/^(?:(?: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])$/,Jt=/^(?:(?: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]|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){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])$/,Qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,er=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fe="((\\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])))",tr=new RegExp(`^${Fe}$`);function Ge(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function rr(r){return new RegExp(`^${Ge(r)}$`)}function We(r){let e=`${Fe}T${Ge(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function nr(r,e){return!!((e==="v4"||!e)&&Ht.test(r)||(e==="v6"||!e)&&Xt.test(r))}function sr(r,e){if(!Ft.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function ar(r,e){return!!((e==="v4"||!e)&&Jt.test(r)||(e==="v6"||!e)&&Kt.test(r))}class I extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),y}const n=new A;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,d=e.data.length<a.value;(o||d)&&(s=this._getOrReturnCtx(e,s),o?h(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&h(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Wt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")je||(je=new RegExp(Yt,"u")),je.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")zt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ut.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Bt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")qt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Lt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?We(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?tr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?rr(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Gt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?nr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?sr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ar(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Qt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?er.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...m.errToObj(n)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...m.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...m.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...m.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}I.create=r=>{var e;return new I({checks:[],typeName:v.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function ir(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return a%o/Math.pow(10,s)}class $ extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),y}let n;const s=new A;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?ir(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}$.create=r=>new $({checks:[],typeName:v.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class B extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let n;const s=new A;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:c.invalid_type,expected:p.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}B.create=r=>{var e;return new B({checks:[],typeName:v.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};class ae extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.boolean,received:n.parsedType}),y}return R(e.data)}}ae.create=r=>new ae({typeName:v.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class F extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_date}),y}const n=new A;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}F.create=r=>new F({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:v.ZodDate,..._(r)});class ke extends b{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.symbol,received:n.parsedType}),y}return R(e.data)}}ke.create=r=>new ke({typeName:v.ZodSymbol,..._(r)});class ie extends b{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.undefined,received:n.parsedType}),y}return R(e.data)}}ie.create=r=>new ie({typeName:v.ZodUndefined,..._(r)});class oe extends b{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.null,received:n.parsedType}),y}return R(e.data)}}oe.create=r=>new oe({typeName:v.ZodNull,..._(r)});class X extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}X.create=r=>new X({typeName:v.ZodAny,..._(r)});class G extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}G.create=r=>new G({typeName:v.ZodUnknown,..._(r)});class M extends b{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:c.invalid_type,expected:p.never,received:t.parsedType}),y}}M.create=r=>new M({typeName:v.ZodNever,..._(r)});class we extends b{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.void,received:n.parsedType}),y}return R(e.data)}}we.create=r=>new we({typeName:v.ZodVoid,..._(r)});class C extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return h(t,{code:c.invalid_type,expected:p.array,received:t.parsedType}),y;if(s.exactLength!==null){const o=t.data.length>s.exactLength.value,d=t.data.length<s.exactLength.value;(o||d)&&(h(t,{code:o?c.too_big:c.too_small,minimum:d?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(h(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(h(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,d)=>s.type._parseAsync(new O(t,o,t.path,d)))).then(o=>A.mergeArray(n,o));const a=[...t.data].map((o,d)=>s.type._parseSync(new O(t,o,t.path,d)));return A.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(r,e)=>new C({type:r,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,..._(e)});function K(r){if(r instanceof k){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=j.create(K(n))}return new k({...r._def,shape:()=>e})}else return r instanceof C?new C({...r._def,type:K(r.element)}):r instanceof j?j.create(K(r.unwrap())):r instanceof L?L.create(K(r.unwrap())):r instanceof N?N.create(r.items.map(e=>K(e))):r}class k extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const u=this._getOrReturnCtx(e);return h(u,{code:c.invalid_type,expected:p.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),d=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||d.push(u);const f=[];for(const u of o){const g=a[u],T=s.data[u];f.push({key:{status:"valid",value:u},value:g._parse(new O(s,T,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof M){const u=this._def.unknownKeys;if(u==="passthrough")for(const g of d)f.push({key:{status:"valid",value:g},value:{status:"valid",value:s.data[g]}});else if(u==="strict")d.length>0&&(h(s,{code:c.unrecognized_keys,keys:d}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const g of d){const T=s.data[g];f.push({key:{status:"valid",value:g},value:u._parse(new O(s,T,s.path,g)),alwaysSet:g in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const g of f){const T=await g.key,E=await g.value;u.push({key:T,value:E,alwaysSet:g.alwaysSet})}return u}).then(u=>A.mergeObjectSync(n,u)):A.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,o,d;const f=(o=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(d=m.errToObj(e).message)!==null&&d!==void 0?d:f}:{message:f}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return K(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}}),new k({...this._def,shape:()=>t})}keyof(){return Ye(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,..._(e)}),k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:v.ZodObject,..._(e)}),k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,..._(e)});class de extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const d of a)if(d.result.status==="valid")return d.result;for(const d of a)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const o=a.map(d=>new S(d.ctx.common.issues));return h(t,{code:c.invalid_union,unionErrors:o}),y}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const f of n){const u={...t,common:{...t.common,issues:[]},parent:null},g=f._parseSync({data:t.data,path:t.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const d=o.map(f=>new S(f));return h(t,{code:c.invalid_union,unionErrors:d}),y}}get options(){return this._def.options}}de.create=(r,e)=>new de({options:r,typeName:v.ZodUnion,..._(e)});const V=r=>r instanceof le?V(r.schema):r instanceof Z?V(r.innerType()):r instanceof fe?[r.value]:r instanceof q?r.options:r instanceof he?x.objectValues(r.enum):r instanceof pe?V(r._def.innerType):r instanceof ie?[void 0]:r instanceof oe?[null]:r instanceof j?[void 0,...V(r.unwrap())]:r instanceof L?[null,...V(r.unwrap())]:r instanceof Me||r instanceof ve?V(r.unwrap()):r instanceof me?V(r._def.innerType):[];class Te extends b{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return h(t,{code:c.invalid_type,expected:p.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const d of o){if(s.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);s.set(d,a)}}return new Te({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function Pe(r,e){const t=P(r),n=P(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&n===p.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(d=>s.indexOf(d)!==-1),o={...r,...e};for(const d of a){const f=Pe(r[d],e[d]);if(!f.valid)return{valid:!1};o[d]=f.data}return{valid:!0,data:o}}else if(t===p.array&&n===p.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const o=r[a],d=e[a],f=Pe(o,d);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===p.date&&n===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ce extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,o)=>{if(Oe(a)||Oe(o))return y;const d=Pe(a.value,o.value);return d.valid?((Ne(a)||Ne(o))&&t.dirty(),{status:t.value,value:d.data}):(h(n,{code:c.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ce.create=(r,e,t)=>new ce({left:r,right:e,typeName:v.ZodIntersection,..._(t)});class N extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return h(n,{code:c.invalid_type,expected:p.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return h(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,d)=>{const f=this._def.items[d]||this._def.rest;return f?f._parse(new O(n,o,n.path,d)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>A.mergeArray(t,o)):A.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new N({...this._def,rest:e})}}N.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:r,typeName:v.ZodTuple,rest:null,..._(e)})};class ue extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return h(n,{code:c.invalid_type,expected:p.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,o=this._def.valueType;for(const d in n.data)s.push({key:a._parse(new O(n,d,n.path,d)),value:o._parse(new O(n,n.data[d],n.path,d)),alwaysSet:d in n.data});return n.common.async?A.mergeObjectAsync(t,s):A.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new ue({keyType:e,valueType:t,typeName:v.ZodRecord,..._(n)}):new ue({keyType:I.create(),valueType:e,typeName:v.ZodRecord,..._(t)})}}class Ae extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return h(n,{code:c.invalid_type,expected:p.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([d,f],u)=>({key:s._parse(new O(n,d,n.path,[u,"key"])),value:a._parse(new O(n,f,n.path,[u,"value"]))}));if(n.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of o){const u=await f.key,g=await f.value;if(u.status==="aborted"||g.status==="aborted")return y;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),d.set(u.value,g.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const f of o){const u=f.key,g=f.value;if(u.status==="aborted"||g.status==="aborted")return y;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),d.set(u.value,g.value)}return{status:t.value,value:d}}}}Ae.create=(r,e,t)=>new Ae({valueType:e,keyType:r,typeName:v.ZodMap,..._(t)});class W extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return h(n,{code:c.invalid_type,expected:p.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function o(f){const u=new Set;for(const g of f){if(g.status==="aborted")return y;g.status==="dirty"&&t.dirty(),u.add(g.value)}return{status:t.value,value:u}}const d=[...n.data.values()].map((f,u)=>a._parse(new O(n,f,n.path,u)));return n.common.async?Promise.all(d).then(f=>o(f)):o(d)}min(e,t){return new W({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new W({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}W.create=(r,e)=>new W({valueType:r,minSize:null,maxSize:null,typeName:v.ZodSet,..._(e)});class Q extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return h(t,{code:c.invalid_type,expected:p.function,received:t.parsedType}),y;function n(d,f){return be({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:f}})}function s(d,f){return be({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:f}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ee){const d=this;return R(async function(...f){const u=new S([]),g=await d._def.args.parseAsync(f,a).catch(ye=>{throw u.addIssue(n(f,ye)),u}),T=await Reflect.apply(o,this,g);return await d._def.returns._def.type.parseAsync(T,a).catch(ye=>{throw u.addIssue(s(T,ye)),u})})}else{const d=this;return R(function(...f){const u=d._def.args.safeParse(f,a);if(!u.success)throw new S([n(f,u.error)]);const g=Reflect.apply(o,this,u.data),T=d._def.returns.safeParse(g,a);if(!T.success)throw new S([s(g,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Q({...this._def,args:N.create(e).rest(G.create())})}returns(e){return new Q({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Q({args:e||N.create([]).rest(G.create()),returns:t||G.create(),typeName:v.ZodFunction,..._(n)})}}class le extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}le.create=(r,e)=>new le({getter:r,typeName:v.ZodLazy,..._(e)});class fe extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}fe.create=(r,e)=>new fe({value:r,typeName:v.ZodLiteral,..._(e)});function Ye(r,e){return new q({values:r,typeName:v.ZodEnum,..._(e)})}class q extends b{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(xe(this,ne)||ze(this,ne,new Set(this._def.values)),!xe(this,ne).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return R(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return q.create(e,{...this._def,...t})}exclude(e,t=this._def){return q.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ne=new WeakMap,q.create=Ye;class he extends b{constructor(){super(...arguments),se.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(xe(this,se)||ze(this,se,new Set(x.getValidEnumValues(this._def.values))),!xe(this,se).has(e.data)){const s=x.objectValues(t);return h(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return R(e.data)}get enum(){return this._def.values}}se=new WeakMap,he.create=(r,e)=>new he({values:r,typeName:v.ZodNativeEnum,..._(e)});class ee extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return h(t,{code:c.invalid_type,expected:p.promise,received:t.parsedType}),y;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return R(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ee.create=(r,e)=>new ee({type:r,typeName:v.ZodPromise,..._(e)});class Z extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{h(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async d=>{if(t.value==="aborted")return y;const f=await this._def.schema._parseAsync({data:d,path:n.path,parent:n});return f.status==="aborted"?y:f.status==="dirty"||t.value==="dirty"?J(f.value):f});{if(t.value==="aborted")return y;const d=this._def.schema._parseSync({data:o,path:n.path,parent:n});return d.status==="aborted"?y:d.status==="dirty"||t.value==="dirty"?J(d.value):d}}if(s.type==="refinement"){const o=d=>{const f=s.refinement(d,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(n.common.async===!1){const d=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return d.status==="aborted"?y:(d.status==="dirty"&&t.dirty(),o(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(d=>d.status==="aborted"?y:(d.status==="dirty"&&t.dirty(),o(d.value).then(()=>({status:t.value,value:d.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!U(o))return o;const d=s.transform(o.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>U(o)?Promise.resolve(s.transform(o.value,a)).then(d=>({status:t.value,value:d})):o);x.assertNever(s)}}Z.create=(r,e,t)=>new Z({schema:r,typeName:v.ZodEffects,effect:e,..._(t)}),Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:v.ZodEffects,..._(t)});class j extends b{_parse(e){return this._getType(e)===p.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(r,e)=>new j({innerType:r,typeName:v.ZodOptional,..._(e)});class L extends b{_parse(e){return this._getType(e)===p.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(r,e)=>new L({innerType:r,typeName:v.ZodNullable,..._(e)});class pe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pe.create=(r,e)=>new pe({innerType:r,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class me extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}me.create=(r,e)=>new me({innerType:r,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Re extends b{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Re.create=r=>new Re({typeName:v.ZodNaN,..._(r)});const or=Symbol("zod_brand");class Me extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),J(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new ge({in:e,out:t,typeName:v.ZodPipeline})}}class ve extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}ve.create=(r,e)=>new ve({innerType:r,typeName:v.ZodReadonly,..._(e)});function He(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Je(r,e={},t){return r?X.create().superRefine((n,s)=>{var a,o;const d=r(n);if(d instanceof Promise)return d.then(f=>{var u,g;if(!f){const T=He(e,n),E=(g=(u=T.fatal)!==null&&u!==void 0?u:t)!==null&&g!==void 0?g:!0;s.addIssue({code:"custom",...T,fatal:E})}});if(!d){const f=He(e,n),u=(o=(a=f.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0;s.addIssue({code:"custom",...f,fatal:u})}}):X.create()}const dr={object:k.lazycreate};var v;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(v||(v={}));const cr=(r,e={message:`Input not instance of ${r.name}`})=>Je(t=>t instanceof r,e),Xe=I.create,Ke=$.create,ur=Re.create,lr=B.create,Qe=ae.create,fr=F.create,hr=ke.create,pr=ie.create,mr=oe.create,gr=X.create,vr=G.create,yr=M.create,_r=we.create,br=C.create,xr=k.create,kr=k.strictCreate,wr=de.create,Tr=Te.create,Ar=ce.create,Rr=N.create,Sr=ue.create,Er=Ae.create,Ir=W.create,Cr=Q.create,Zr=le.create,Or=fe.create,Nr=q.create,jr=he.create,Pr=ee.create,et=Z.create,Mr=j.create,Vr=L.create,Dr=Z.createWithPreprocess,$r=ge.create;var i=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:Dt,getErrorMap:_e,makeIssue:be,EMPTY_PATH:$t,addIssueToContext:h,ParseStatus:A,INVALID:y,DIRTY:J,OK:R,isAborted:Oe,isDirty:Ne,isValid:U,isAsync:re,get util(){return x},get objectUtil(){return Ze},ZodParsedType:p,getParsedType:P,ZodType:b,datetimeRegex:We,ZodString:I,ZodNumber:$,ZodBigInt:B,ZodBoolean:ae,ZodDate:F,ZodSymbol:ke,ZodUndefined:ie,ZodNull:oe,ZodAny:X,ZodUnknown:G,ZodNever:M,ZodVoid:we,ZodArray:C,ZodObject:k,ZodUnion:de,ZodDiscriminatedUnion:Te,ZodIntersection:ce,ZodTuple:N,ZodRecord:ue,ZodMap:Ae,ZodSet:W,ZodFunction:Q,ZodLazy:le,ZodLiteral:fe,ZodEnum:q,ZodNativeEnum:he,ZodPromise:ee,ZodEffects:Z,ZodTransformer:Z,ZodOptional:j,ZodNullable:L,ZodDefault:pe,ZodCatch:me,ZodNaN:Re,BRAND:or,ZodBranded:Me,ZodPipeline:ge,ZodReadonly:ve,custom:Je,Schema:b,ZodSchema:b,late:dr,get ZodFirstPartyTypeKind(){return v},coerce:{string:r=>I.create({...r,coerce:!0}),number:r=>$.create({...r,coerce:!0}),boolean:r=>ae.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>F.create({...r,coerce:!0})},any:gr,array:br,bigint:lr,boolean:Qe,date:fr,discriminatedUnion:Tr,effect:et,enum:Nr,function:Cr,instanceof:cr,intersection:Ar,lazy:Zr,literal:Or,map:Er,nan:ur,nativeEnum:jr,never:yr,null:mr,nullable:Vr,number:Ke,object:xr,oboolean:()=>Qe().optional(),onumber:()=>Ke().optional(),optional:Mr,ostring:()=>Xe().optional(),pipeline:$r,preprocess:Dr,promise:Pr,record:Sr,set:Ir,strictObject:kr,string:Xe,symbol:hr,transformer:et,tuple:Rr,undefined:pr,union:wr,unknown:vr,void:_r,NEVER:y,ZodIssueCode:c,quotelessJson:Vt,ZodError:S});const Se=i.object({id:i.string().min(1,"Asset ID is required"),type:i.enum(["image","video","audio","text","graphics"]),url:i.string().url("Invalid URL format"),projectId:i.string().min(1,"Project ID is required"),createdAt:i.date().or(i.string().transform(r=>new Date(r))),updatedAt:i.date().or(i.string().transform(r=>new Date(r))).optional()}),tt=i.object({prompt:i.string().optional(),negativePrompt:i.string().optional(),model:i.string().optional(),modelVersion:i.string().optional(),settings:i.record(i.any()).optional(),cost:i.number().min(0).optional(),processingTime:i.number().min(0).optional(),attempts:i.number().int().min(1).optional(),jobId:i.string().optional()}),rt=i.object({userId:i.string(),projectId:i.string().optional(),uploadedAt:i.string().optional(),source:i.enum(["direct","url","presigned"]),originalName:i.string().optional(),originalUrl:i.string().url().optional(),uploadedUrl:i.string().url().optional(),contentType:i.string(),size:i.number().min(0).optional(),folder:i.string().optional(),dimensions:i.object({width:i.number().int().positive(),height:i.number().int().positive()}).optional(),duration:i.number().positive().optional()}),Ee=Se.extend({name:i.string().optional(),sceneId:i.string().optional(),provider:i.string().min(1,"Provider is required"),uploadMetadata:rt.optional(),generationMetadata:tt.optional(),processingMetadata:i.object({sourceAssetId:i.string().optional(),transformations:i.array(i.object({type:i.string(),parameters:i.record(i.any())})).optional(),compression:i.object({quality:i.number().min(0).max(100).optional(),format:i.string().optional(),bitrate:i.number().positive().optional()}).optional(),processedAt:i.date().optional(),processingTime:i.number().min(0).optional()}).optional(),dimensions:i.object({width:i.number().int().positive(),height:i.number().int().positive()}).optional(),duration:i.number().positive().optional(),size:i.number().min(0).optional(),contentType:i.string().optional(),tags:i.array(i.string()).optional(),rights:i.object({license:i.enum(["creative-commons","royalty-free","rights-managed","custom"]).optional(),attribution:i.string().optional(),restrictions:i.array(i.string()).optional(),expiresAt:i.date().optional(),owner:i.string().optional()}).optional()});function Br(r){return Se.parse(r)}function qr(r){return Se.safeParse(r)}function Lr(r){return Ee.parse(r)}function zr(r){return Ee.safeParse(r)}const nt=Ee.partial().required({id:!0});function Ur(r){return nt.parse(r)}const st=i.object({requestId:i.string().optional(),clientId:i.string().optional(),version:i.string().optional(),timestamp:i.date().or(i.string().transform(r=>new Date(r))).optional(),source:i.enum(["web","mobile","api","internal"]).optional()}).passthrough(),z=i.object({projectId:i.string().min(1,"Project ID is required"),userId:i.string().optional(),metadata:st.optional()}),at=i.object({page:i.number().int().min(1).optional(),limit:i.number().int().min(1).max(100).optional(),cursor:i.string().optional()}),Fr=z.extend({pagination:at.optional()}),it=i.object({type:i.union([i.string(),i.array(i.string())]).optional(),status:i.union([i.string(),i.array(i.string())]).optional(),dateRange:i.object({from:i.date().or(i.string().transform(r=>new Date(r))),to:i.date().or(i.string().transform(r=>new Date(r)))}).optional()}).passthrough(),ot=i.object({field:i.string().min(1,"Sort field is required"),order:i.enum(["asc","desc"])}),Gr=z.extend({filters:it.optional(),sort:ot.optional()}),dt=z.extend({assetType:i.literal("image"),prompt:i.string().min(1,"Prompt is required"),negativePrompt:i.string().optional(),style:i.string().optional(),quality:i.enum(["standard","hd"]).optional(),dimensions:i.object({width:i.number().int().min(64).max(4096),height:i.number().int().min(64).max(4096)}).optional(),numberOfImages:i.number().int().min(1).max(10).optional(),provider:i.string().optional(),sceneId:i.string().optional()}),ct=z.extend({assetType:i.literal("video"),prompt:i.string().min(1,"Prompt is required"),duration:i.number().min(1).max(120),style:i.string().optional(),quality:i.string().optional(),fps:i.number().int().min(1).max(120).optional(),provider:i.string().optional(),sceneId:i.string().optional()}),ut=z.extend({assetType:i.literal("audio"),text:i.string().optional(),prompt:i.string().optional(),voiceId:i.string().optional(),duration:i.number().min(.5).max(300).optional(),settings:i.record(i.any()).optional(),provider:i.string().optional(),sceneId:i.string().optional()}).refine(r=>r.text||r.prompt,{message:"Either text or prompt is required"});function Wr(r){return z.parse(r)}function Yr(r){return z.safeParse(r)}function Hr(r){return dt.parse(r)}function Jr(r){return ct.parse(r)}function Xr(r){return ut.parse(r)}function Kr(r){return e=>r.parse(e)}const Ve=i.object({code:i.string().min(1,"Error code is required"),message:i.string().min(1,"Error message is required"),details:i.record(i.any()).optional(),stack:i.string().optional(),timestamp:i.string().datetime()}),lt=i.object({requestId:i.string().optional(),processingTime:i.number().min(0).optional(),version:i.string().optional(),timestamp:i.date().or(i.string().transform(r=>new Date(r))).optional(),rateLimit:i.object({limit:i.number().int().positive(),remaining:i.number().int().min(0),reset:i.date().or(i.string().transform(r=>new Date(r)))}).optional()}).passthrough(),te=i.object({success:i.boolean(),data:i.any().optional(),error:Ve.optional(),metadata:lt.optional()}),ft=i.object({page:i.number().int().min(1),limit:i.number().int().min(1),total:i.number().int().min(0),totalPages:i.number().int().min(0),hasNext:i.boolean(),hasPrevious:i.boolean(),nextCursor:i.string().optional(),previousCursor:i.string().optional()}),ht=te.extend({data:i.array(i.any()),pagination:ft.optional()}),pt=i.object({index:i.number().int().min(0),success:i.boolean(),data:i.any().optional(),error:Ve.optional()}),mt=te.omit({data:!0}).extend({results:i.array(pt),summary:i.object({total:i.number().int().min(0),succeeded:i.number().int().min(0),failed:i.number().int().min(0),skipped:i.number().int().min(0)})}),gt=te.extend({provider:i.string().min(1,"Provider is required"),processingTime:i.number().min(0).optional(),cost:i.number().min(0).optional()});function Qr(r){return te.parse(r)}function en(r){return te.safeParse(r)}function tn(r){return ht.parse(r)}function rn(r){return mt.parse(r)}function nn(r){return gt.parse(r)}function sn(r){return e=>r.parse(e)}const an="1.0.7",on="@etaio/core-types";l.ApiAssetSchema=Ee,l.AssetAdapter=Ct,l.AssetStatus=$e,l.AssetType=w,l.AudioGenerationRequestSchema=ut,l.BaseAssetSchema=Se,l.BaseProviderManager=jt,l.BaseRequestSchema=z,l.BaseResponseSchema=te,l.BatchResponseSchema=mt,l.BatchResultSchema=pt,l.ErrorResponseSchema=Ve,l.FilterParamsSchema=it,l.FilteredRequestSchema=Gr,l.GenAIException=Mt,l.GenerationMetadataSchema=tt,l.GenerationResponseSchema=gt,l.ImageGenerationRequestSchema=dt,l.PACKAGE_NAME=on,l.PaginatedRequestSchema=Fr,l.PaginatedResponseSchema=ht,l.PaginationInfoSchema=ft,l.PaginationParamsSchema=at,l.PartialAssetUpdateSchema=nt,l.ProviderAuthError=qe,l.ProviderError=D,l.ProviderQuotaError=Zt,l.ProviderRateLimitError=Be,l.ProviderRegistry=Pt,l.ProviderTimeoutError=Ot,l.ProviderValidationError=Nt,l.RequestMetadataSchema=st,l.ResponseMetadataSchema=lt,l.SortParamsSchema=ot,l.UploadMetadataSchema=rt,l.VERSION=an,l.VideoGenerationRequestSchema=ct,l.createRequestValidator=Kr,l.createResponseValidator=sn,l.errorResponse=xt,l.hasGenerationMetadata=Et,l.hasUploadMetadata=It,l.isApiAsset=St,l.isAssetType=vt,l.isBaseAsset=Y,l.isBaseRequest=Ce,l.isErrorResponse=wt,l.isFilteredRequest=_t,l.isGenerativeAsset=At,l.isGenerativeMetadata=Rt,l.isPaginatedRequest=yt,l.isPaginatedResponse=Tt,l.isSuccessResponse=De,l.paginatedResponse=kt,l.safeValidateApiAsset=zr,l.safeValidateBaseAsset=qr,l.safeValidateBaseRequest=Yr,l.safeValidateBaseResponse=en,l.successResponse=bt,l.validateApiAsset=Lr,l.validateAudioGenerationRequest=Xr,l.validateBaseAsset=Br,l.validateBaseRequest=Wr,l.validateBaseResponse=Qr,l.validateBatchResponse=rn,l.validateGenerationResponse=nn,l.validateImageGenerationRequest=Hr,l.validatePaginatedResponse=tn,l.validatePartialAssetUpdate=Ur,l.validateVideoGenerationRequest=Jr,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(u=typeof globalThis<"u"?globalThis:u||self,w(u.etaioCoreTypes={}))})(this,function(u){"use strict";var ln=Object.defineProperty;var fn=(u,w,Y)=>w in u?ln(u,w,{enumerable:!0,configurable:!0,writable:!0,value:Y}):u[w]=Y;var Ie=(u,w,Y)=>fn(u,typeof w!="symbol"?w+"":w,Y);var w=(r=>(r.IMAGE="image",r.VIDEO="video",r.AUDIO="audio",r.TEXT="text",r.GRAPHICS="graphics",r))(w||{});function Y(r){return typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.type=="string"&&typeof r.url=="string"&&typeof r.projectId=="string"&&r.createdAt instanceof Date}function vt(r){return Object.values(w).includes(r)}function Ce(r){return typeof r=="object"&&r!==null&&typeof r.projectId=="string"}function yt(r){return Ce(r)&&"pagination"in r}function _t(r){return Ce(r)&&("filters"in r||"sort"in r)}function bt(r,e){return{success:!0,data:r,metadata:{timestamp:new Date,...e}}}function xt(r,e,t){return{success:!1,error:{code:r,message:e,details:t,timestamp:new Date().toISOString()}}}function kt(r,e,t,n){const s=Math.ceil(n/t);return{success:!0,data:r,pagination:{page:e,limit:t,total:n,totalPages:s,hasNext:e<s,hasPrevious:e>1}}}function $e(r){return r.success===!0&&"data"in r}function wt(r){return r.success===!1&&"error"in r}function Tt(r){return $e(r)&&"pagination"in r}function At(r){return r&&typeof r=="object"&&r.metadata&&typeof r.metadata.provider=="string"&&typeof r.metadata.model=="string"&&typeof r.sourceType=="string"}function Rt(r){return r&&typeof r=="object"&&typeof r.provider=="string"&&typeof r.model=="string"&&typeof r.userId=="string"}var De=(r=>(r.PROCESSING="processing",r.READY="ready",r.FAILED="failed",r.QUEUED="queued",r.DELETED="deleted",r.ARCHIVED="archived",r))(De||{});function St(r){return typeof r=="object"&&r!==null&&"provider"in r&&typeof r.provider=="string"}function Et(r){return r.generationMetadata!==void 0}function It(r){return r.uploadMetadata!==void 0}class Ct{static toBaseAsset(e){return this.isOnlyBaseAsset(e)?e:{id:e.id,type:this.normalizeAssetType(e.type),url:this.extractUrl(e),projectId:e.projectId,createdAt:e.createdAt instanceof Date?e.createdAt:new Date(e.createdAt),updatedAt:e.updatedAt?new Date(e.updatedAt):void 0}}static toApiAsset(e,t){return{...e,provider:(t==null?void 0:t.provider)||"unknown",name:t==null?void 0:t.name,sceneId:t==null?void 0:t.sceneId,uploadMetadata:t==null?void 0:t.uploadMetadata,generationMetadata:t==null?void 0:t.generationMetadata,processingMetadata:t==null?void 0:t.processingMetadata,dimensions:t==null?void 0:t.dimensions,duration:t==null?void 0:t.duration,size:t==null?void 0:t.size,contentType:t==null?void 0:t.contentType,tags:t==null?void 0:t.tags,rights:t==null?void 0:t.rights}}static fromTrackItem(e){return{...this.toBaseAsset(e),name:e.name,provider:"timeline",duration:e.duration,dimensions:this.extractDimensions(e),contentType:this.inferContentType(e.type)}}static toTrackItem(e,t,n){var o,d,f,l;const s=this.mapToTrackItemType(e.type),a={id:e.id,name:e.name||`${e.type} ${e.id}`,type:s,preview:e.url,display:t||{from:0,to:100},duration:e.duration,metadata:{sourceAssetId:e.id,provider:e.provider,...e.generationMetadata},...n};switch(s){case"image":return{...a,type:"image",details:{src:e.url,width:((o=e.dimensions)==null?void 0:o.width)||1920,height:((d=e.dimensions)==null?void 0:d.height)||1080,opacity:1,transform:"",border:"",borderRadius:0,top:"0",left:"0",transformOrigin:"center",blur:0,brightness:100,flipX:!1,flipY:!1,rotate:"0deg",visibility:"visible"}};case"video":return{...a,type:"video",details:{src:e.url,width:((f=e.dimensions)==null?void 0:f.width)||1920,height:((l=e.dimensions)==null?void 0:l.height)||1080,volume:1,blur:0,brightness:100,flipX:!1,flipY:!1,rotate:"0deg",visibility:"visible"}};case"audio":return{...a,type:"audio",details:{src:e.url,volume:1}};case"text":return{...a,type:"text",details:{text:"",fontSize:32,fontFamily:"Arial",fontUrl:"",color:"#000000",lineHeight:"1.2",letterSpacing:"0",fontWeight:400,fontStyle:"normal",textDecoration:"none",textAlign:"center",wordSpacing:"0",textShadow:"",backgroundColor:"transparent",opacity:1,width:500,height:100,top:"50%",left:"50%",transform:"translate(-50%, -50%)",border:"",wordWrap:"normal",wordBreak:"normal",WebkitTextStrokeColor:"",WebkitTextStrokeWidth:"0",borderWidth:0,borderColor:"",boxShadow:{color:"",x:0,y:0,blur:0},borderRadius:0,skewX:0,skewY:0,textTransform:"none"}};default:return a}}static normalizeAssetType(e){switch(e.toLowerCase()){case"image":case"img":case"photo":return w.IMAGE;case"video":case"vid":case"movie":return w.VIDEO;case"audio":case"sound":case"music":return w.AUDIO;case"text":case"txt":case"caption":return w.TEXT;case"graphics":case"svg":case"vector":return w.GRAPHICS;default:return w.IMAGE}}static mapToTrackItemType(e){switch(e){case"image":case"graphics":return"image";case"video":return"video";case"audio":return"audio";case"text":return"text";default:return"image"}}static extractUrl(e){var t;return e.url?e.url:(t=e.details)!=null&&t.src?e.details.src:e.preview?e.preview:""}static extractDimensions(e){if("details"in e&&e.details){const t=e.details;if(t.width&&t.height)return{width:t.width,height:t.height}}}static inferContentType(e){switch(e){case"image":return"image/jpeg";case"video":return"video/mp4";case"audio":return"audio/mpeg";case"text":return"text/plain";default:return"application/octet-stream"}}static isOnlyBaseAsset(e){const t=["id","type","url","projectId","createdAt","updatedAt"];return Object.keys(e).every(s=>t.includes(s))}static isTrackItem(e){return typeof e=="object"&&e!==null&&"display"in e&&"details"in e&&"name"in e}static isApiAsset(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class $ extends Error{constructor(e,t,n,s=!1,a){super(e),this.code=t,this.provider=n,this.retryable=s,this.details=a,this.name="ProviderError"}}class Zt extends ${constructor(e,t){super(`Provider quota exceeded for ${e}`,"QUOTA_EXCEEDED",e,!1,t),this.name="ProviderQuotaError"}}class Be extends ${constructor(e,t){super(`Rate limit exceeded for ${e}`,"RATE_LIMITED",e,!0,{retryAfter:t}),this.name="ProviderRateLimitError"}}class qe extends ${constructor(e,t){super(`Authentication failed for ${e}`,"AUTH_FAILED",e,!1,t),this.name="ProviderAuthError"}}class Ot extends ${constructor(e,t){super(`Request timeout for ${e} after ${t}ms`,"TIMEOUT",e,!0,{timeout:t}),this.name="ProviderTimeoutError"}}class Nt extends ${constructor(e,t){super(`Validation failed for ${e}: ${t.join(", ")}`,"VALIDATION_FAILED",e,!1,{errors:t}),this.name="ProviderValidationError"}}class jt{constructor(e){Ie(this,"config");Ie(this,"retryCount",0);this.config=e}async executeWithRetry(e,t){var d,f,l,g;const n=((d=this.config.retry)==null?void 0:d.maxAttempts)||3,s=((f=this.config.retry)==null?void 0:f.backoffMultiplier)||2,a=((l=this.config.retry)==null?void 0:l.maxDelay)||3e4;let o;for(let T=0;T<n;T++)try{return this.retryCount=T,await e()}catch(E){if(o=E,E instanceof $&&!E.retryable)throw E;if(T<n-1){const ye=Math.min(Math.pow(s,T)*1e3,a);E instanceof Be&&((g=E.details)!=null&&g.retryAfter)?await this.delay(E.details.retryAfter*1e3):await this.delay(ye)}}throw o||new $(`Failed after ${n} attempts`,"MAX_RETRIES",t,!1)}delay(e){return new Promise(t=>setTimeout(t,e))}validateCredentials(){if(!this.config.apiKey&&!this.config.endpoint)throw new qe("unknown",{message:"No API key or endpoint configured"})}}class Pt{constructor(){Ie(this,"providers",new Map)}register(e,t){this.providers.set(e,t)}get(e){return this.providers.get(e)}list(){return Array.from(this.providers.keys())}has(e){return this.providers.has(e)}remove(e){return this.providers.delete(e)}getByType(e){return Array.from(this.providers.values()).filter(t=>t.type===e)}}class Mt extends Error{constructor(e,t,n,s,a){super(t),this.code=e,this.provider=n,this.statusCode=s,this.details=a,this.name="GenAIException"}}function Vt(r){let e=r.content;if(r.attachments&&r.attachments.length>0){const t=r.attachments.map(n=>{let s=`[${n.type.toUpperCase()}: ${n.name||"Untitled"}]`;return n.description&&(s+=` - ${n.description}`),n.transcription&&(s+=`
2
+ Transcription: ${n.transcription}`),n.extractedText&&(s+=`
3
+ Extracted text: ${n.extractedText}`),s}).join(`
4
+ `);e=`${e}
5
+
6
+ Attachments:
7
+ ${t}`}return e}function $t(r){return!!(r.attachments&&r.attachments.length>0)}function Dt(r,e){return r.attachments?e?r.attachments.filter(t=>t.type===e).length:r.attachments.length:0}var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(d=>typeof s[s[d]]!="number"),o={};for(const d of a)o[d]=s[d];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},r.find=(s,a)=>{for(const o of s)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ze||(Ze={}));const p=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},c=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Bt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class S extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let d=n,f=0;for(;f<o.path.length;){const l=o.path[f];f===o.path.length-1?(d[l]=d[l]||{_errors:[]},d[l]._errors.push(t(o))):d[l]=d[l]||{_errors:[]},d=d[l],f++}}};return s(this),n}static assert(e){if(!(e instanceof S))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=r=>new S(r);const H=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Le=H;function qt(r){Le=r}function _e(){return Le}const be=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let d="";const f=n.filter(l=>!!l).slice().reverse();for(const l of f)d=l(o,{data:e,defaultError:d}).message;return{...s,path:a,message:d}},Lt=[];function h(r,e){const t=_e(),n=be({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(s=>!!s)});r.common.issues.push(n)}class A{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,o=await s.value;n.push({key:a,value:o})}return A.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return y;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),J=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),Oe=r=>r.status==="aborted",Ne=r=>r.status==="dirty",U=r=>r.status==="valid",re=r=>typeof Promise<"u"&&r instanceof Promise;function xe(r,e,t,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function ze(r,e,t,n,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var ne,se;class O{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ue=(r,e)=>{if(U(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new S(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,d)=>{var f,l;const{message:g}=r;return o.code==="invalid_enum_value"?{message:g??d.defaultError}:typeof d.data>"u"?{message:(f=g??n)!==null&&f!==void 0?f:d.defaultError}:o.code!=="invalid_type"?{message:d.defaultError}:{message:(l=g??t)!==null&&l!==void 0?l:d.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new A,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ue(s,a)}"~validate"(e){var t,n;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return U(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>U(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(re(s)?s:Promise.resolve(s));return Ue(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const o=e(s),d=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(d(),!1)):o?!0:(d(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Z({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return ee.create(this,this._def)}or(e){return de.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new Z({..._(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pe({..._(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new Me({typeName:v.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new me({..._(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,Ut=/^[0-9a-z]+$/,Ft=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}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[0-9])$/,rr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fe="((\\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])))",sr=new RegExp(`^${Fe}$`);function Ge(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ar(r){return new RegExp(`^${Ge(r)}$`)}function We(r){let e=`${Fe}T${Ge(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ir(r,e){return!!((e==="v4"||!e)&&Kt.test(r)||(e==="v6"||!e)&&er.test(r))}function or(r,e){if(!Yt.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function dr(r,e){return!!((e==="v4"||!e)&&Qt.test(r)||(e==="v6"||!e)&&tr.test(r))}class I extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),y}const n=new A;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,d=e.data.length<a.value;(o||d)&&(s=this._getOrReturnCtx(e,s),o?h(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&h(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Jt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")je||(je=new RegExp(Xt,"u")),je.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Gt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Wt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")zt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Ut.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Ft.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?We(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?sr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ar(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ht.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ir(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?or(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?dr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?rr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?nr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...m.errToObj(n)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...m.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...m.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...m.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}I.create=r=>{var e;return new I({checks:[],typeName:v.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function cr(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return a%o/Math.pow(10,s)}class D extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),y}let n;const s=new A;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?cr(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new D({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}D.create=r=>new D({checks:[],typeName:v.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class B extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let n;const s=new A;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:c.invalid_type,expected:p.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}B.create=r=>{var e;return new B({checks:[],typeName:v.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};class ae extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.boolean,received:n.parsedType}),y}return R(e.data)}}ae.create=r=>new ae({typeName:v.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class F extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:c.invalid_date}),y}const n=new A;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}F.create=r=>new F({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:v.ZodDate,..._(r)});class ke extends b{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.symbol,received:n.parsedType}),y}return R(e.data)}}ke.create=r=>new ke({typeName:v.ZodSymbol,..._(r)});class ie extends b{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.undefined,received:n.parsedType}),y}return R(e.data)}}ie.create=r=>new ie({typeName:v.ZodUndefined,..._(r)});class oe extends b{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.null,received:n.parsedType}),y}return R(e.data)}}oe.create=r=>new oe({typeName:v.ZodNull,..._(r)});class X extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}X.create=r=>new X({typeName:v.ZodAny,..._(r)});class G extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}G.create=r=>new G({typeName:v.ZodUnknown,..._(r)});class M extends b{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:c.invalid_type,expected:p.never,received:t.parsedType}),y}}M.create=r=>new M({typeName:v.ZodNever,..._(r)});class we extends b{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.void,received:n.parsedType}),y}return R(e.data)}}we.create=r=>new we({typeName:v.ZodVoid,..._(r)});class C extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return h(t,{code:c.invalid_type,expected:p.array,received:t.parsedType}),y;if(s.exactLength!==null){const o=t.data.length>s.exactLength.value,d=t.data.length<s.exactLength.value;(o||d)&&(h(t,{code:o?c.too_big:c.too_small,minimum:d?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(h(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(h(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,d)=>s.type._parseAsync(new O(t,o,t.path,d)))).then(o=>A.mergeArray(n,o));const a=[...t.data].map((o,d)=>s.type._parseSync(new O(t,o,t.path,d)));return A.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(r,e)=>new C({type:r,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,..._(e)});function K(r){if(r instanceof k){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=j.create(K(n))}return new k({...r._def,shape:()=>e})}else return r instanceof C?new C({...r._def,type:K(r.element)}):r instanceof j?j.create(K(r.unwrap())):r instanceof L?L.create(K(r.unwrap())):r instanceof N?N.create(r.items.map(e=>K(e))):r}class k extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const l=this._getOrReturnCtx(e);return h(l,{code:c.invalid_type,expected:p.object,received:l.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),d=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||d.push(l);const f=[];for(const l of o){const g=a[l],T=s.data[l];f.push({key:{status:"valid",value:l},value:g._parse(new O(s,T,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof M){const l=this._def.unknownKeys;if(l==="passthrough")for(const g of d)f.push({key:{status:"valid",value:g},value:{status:"valid",value:s.data[g]}});else if(l==="strict")d.length>0&&(h(s,{code:c.unrecognized_keys,keys:d}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const g of d){const T=s.data[g];f.push({key:{status:"valid",value:g},value:l._parse(new O(s,T,s.path,g)),alwaysSet:g in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const g of f){const T=await g.key,E=await g.value;l.push({key:T,value:E,alwaysSet:g.alwaysSet})}return l}).then(l=>A.mergeObjectSync(n,l)):A.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,o,d;const f=(o=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(d=m.errToObj(e).message)!==null&&d!==void 0?d:f}:{message:f}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return K(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}}),new k({...this._def,shape:()=>t})}keyof(){return Ye(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,..._(e)}),k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:v.ZodObject,..._(e)}),k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,..._(e)});class de extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const d of a)if(d.result.status==="valid")return d.result;for(const d of a)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const o=a.map(d=>new S(d.ctx.common.issues));return h(t,{code:c.invalid_union,unionErrors:o}),y}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const f of n){const l={...t,common:{...t.common,issues:[]},parent:null},g=f._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const d=o.map(f=>new S(f));return h(t,{code:c.invalid_union,unionErrors:d}),y}}get options(){return this._def.options}}de.create=(r,e)=>new de({options:r,typeName:v.ZodUnion,..._(e)});const V=r=>r instanceof le?V(r.schema):r instanceof Z?V(r.innerType()):r instanceof fe?[r.value]:r instanceof q?r.options:r instanceof he?x.objectValues(r.enum):r instanceof pe?V(r._def.innerType):r instanceof ie?[void 0]:r instanceof oe?[null]:r instanceof j?[void 0,...V(r.unwrap())]:r instanceof L?[null,...V(r.unwrap())]:r instanceof Me||r instanceof ve?V(r.unwrap()):r instanceof me?V(r._def.innerType):[];class Te extends b{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return h(t,{code:c.invalid_type,expected:p.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const d of o){if(s.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);s.set(d,a)}}return new Te({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function Pe(r,e){const t=P(r),n=P(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&n===p.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(d=>s.indexOf(d)!==-1),o={...r,...e};for(const d of a){const f=Pe(r[d],e[d]);if(!f.valid)return{valid:!1};o[d]=f.data}return{valid:!0,data:o}}else if(t===p.array&&n===p.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const o=r[a],d=e[a],f=Pe(o,d);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===p.date&&n===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ce extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,o)=>{if(Oe(a)||Oe(o))return y;const d=Pe(a.value,o.value);return d.valid?((Ne(a)||Ne(o))&&t.dirty(),{status:t.value,value:d.data}):(h(n,{code:c.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ce.create=(r,e,t)=>new ce({left:r,right:e,typeName:v.ZodIntersection,..._(t)});class N extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return h(n,{code:c.invalid_type,expected:p.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return h(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,d)=>{const f=this._def.items[d]||this._def.rest;return f?f._parse(new O(n,o,n.path,d)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>A.mergeArray(t,o)):A.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new N({...this._def,rest:e})}}N.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:r,typeName:v.ZodTuple,rest:null,..._(e)})};class ue extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return h(n,{code:c.invalid_type,expected:p.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,o=this._def.valueType;for(const d in n.data)s.push({key:a._parse(new O(n,d,n.path,d)),value:o._parse(new O(n,n.data[d],n.path,d)),alwaysSet:d in n.data});return n.common.async?A.mergeObjectAsync(t,s):A.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new ue({keyType:e,valueType:t,typeName:v.ZodRecord,..._(n)}):new ue({keyType:I.create(),valueType:e,typeName:v.ZodRecord,..._(t)})}}class Ae extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return h(n,{code:c.invalid_type,expected:p.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([d,f],l)=>({key:s._parse(new O(n,d,n.path,[l,"key"])),value:a._parse(new O(n,f,n.path,[l,"value"]))}));if(n.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of o){const l=await f.key,g=await f.value;if(l.status==="aborted"||g.status==="aborted")return y;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),d.set(l.value,g.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const f of o){const l=f.key,g=f.value;if(l.status==="aborted"||g.status==="aborted")return y;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),d.set(l.value,g.value)}return{status:t.value,value:d}}}}Ae.create=(r,e,t)=>new Ae({valueType:e,keyType:r,typeName:v.ZodMap,..._(t)});class W extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return h(n,{code:c.invalid_type,expected:p.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function o(f){const l=new Set;for(const g of f){if(g.status==="aborted")return y;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}const d=[...n.data.values()].map((f,l)=>a._parse(new O(n,f,n.path,l)));return n.common.async?Promise.all(d).then(f=>o(f)):o(d)}min(e,t){return new W({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new W({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}W.create=(r,e)=>new W({valueType:r,minSize:null,maxSize:null,typeName:v.ZodSet,..._(e)});class Q extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return h(t,{code:c.invalid_type,expected:p.function,received:t.parsedType}),y;function n(d,f){return be({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:f}})}function s(d,f){return be({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:f}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ee){const d=this;return R(async function(...f){const l=new S([]),g=await d._def.args.parseAsync(f,a).catch(ye=>{throw l.addIssue(n(f,ye)),l}),T=await Reflect.apply(o,this,g);return await d._def.returns._def.type.parseAsync(T,a).catch(ye=>{throw l.addIssue(s(T,ye)),l})})}else{const d=this;return R(function(...f){const l=d._def.args.safeParse(f,a);if(!l.success)throw new S([n(f,l.error)]);const g=Reflect.apply(o,this,l.data),T=d._def.returns.safeParse(g,a);if(!T.success)throw new S([s(g,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Q({...this._def,args:N.create(e).rest(G.create())})}returns(e){return new Q({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Q({args:e||N.create([]).rest(G.create()),returns:t||G.create(),typeName:v.ZodFunction,..._(n)})}}class le extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}le.create=(r,e)=>new le({getter:r,typeName:v.ZodLazy,..._(e)});class fe extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}fe.create=(r,e)=>new fe({value:r,typeName:v.ZodLiteral,..._(e)});function Ye(r,e){return new q({values:r,typeName:v.ZodEnum,..._(e)})}class q extends b{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(xe(this,ne)||ze(this,ne,new Set(this._def.values)),!xe(this,ne).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return R(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return q.create(e,{...this._def,...t})}exclude(e,t=this._def){return q.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ne=new WeakMap,q.create=Ye;class he extends b{constructor(){super(...arguments),se.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(xe(this,se)||ze(this,se,new Set(x.getValidEnumValues(this._def.values))),!xe(this,se).has(e.data)){const s=x.objectValues(t);return h(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return R(e.data)}get enum(){return this._def.values}}se=new WeakMap,he.create=(r,e)=>new he({values:r,typeName:v.ZodNativeEnum,..._(e)});class ee extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return h(t,{code:c.invalid_type,expected:p.promise,received:t.parsedType}),y;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return R(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ee.create=(r,e)=>new ee({type:r,typeName:v.ZodPromise,..._(e)});class Z extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{h(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async d=>{if(t.value==="aborted")return y;const f=await this._def.schema._parseAsync({data:d,path:n.path,parent:n});return f.status==="aborted"?y:f.status==="dirty"||t.value==="dirty"?J(f.value):f});{if(t.value==="aborted")return y;const d=this._def.schema._parseSync({data:o,path:n.path,parent:n});return d.status==="aborted"?y:d.status==="dirty"||t.value==="dirty"?J(d.value):d}}if(s.type==="refinement"){const o=d=>{const f=s.refinement(d,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(n.common.async===!1){const d=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return d.status==="aborted"?y:(d.status==="dirty"&&t.dirty(),o(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(d=>d.status==="aborted"?y:(d.status==="dirty"&&t.dirty(),o(d.value).then(()=>({status:t.value,value:d.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!U(o))return o;const d=s.transform(o.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>U(o)?Promise.resolve(s.transform(o.value,a)).then(d=>({status:t.value,value:d})):o);x.assertNever(s)}}Z.create=(r,e,t)=>new Z({schema:r,typeName:v.ZodEffects,effect:e,..._(t)}),Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:v.ZodEffects,..._(t)});class j extends b{_parse(e){return this._getType(e)===p.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(r,e)=>new j({innerType:r,typeName:v.ZodOptional,..._(e)});class L extends b{_parse(e){return this._getType(e)===p.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(r,e)=>new L({innerType:r,typeName:v.ZodNullable,..._(e)});class pe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pe.create=(r,e)=>new pe({innerType:r,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class me extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}me.create=(r,e)=>new me({innerType:r,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Re extends b{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return h(n,{code:c.invalid_type,expected:p.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Re.create=r=>new Re({typeName:v.ZodNaN,..._(r)});const ur=Symbol("zod_brand");class Me extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),J(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new ge({in:e,out:t,typeName:v.ZodPipeline})}}class ve extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}ve.create=(r,e)=>new ve({innerType:r,typeName:v.ZodReadonly,..._(e)});function He(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Je(r,e={},t){return r?X.create().superRefine((n,s)=>{var a,o;const d=r(n);if(d instanceof Promise)return d.then(f=>{var l,g;if(!f){const T=He(e,n),E=(g=(l=T.fatal)!==null&&l!==void 0?l:t)!==null&&g!==void 0?g:!0;s.addIssue({code:"custom",...T,fatal:E})}});if(!d){const f=He(e,n),l=(o=(a=f.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0;s.addIssue({code:"custom",...f,fatal:l})}}):X.create()}const lr={object:k.lazycreate};var v;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(v||(v={}));const fr=(r,e={message:`Input not instance of ${r.name}`})=>Je(t=>t instanceof r,e),Xe=I.create,Ke=D.create,hr=Re.create,pr=B.create,Qe=ae.create,mr=F.create,gr=ke.create,vr=ie.create,yr=oe.create,_r=X.create,br=G.create,xr=M.create,kr=we.create,wr=C.create,Tr=k.create,Ar=k.strictCreate,Rr=de.create,Sr=Te.create,Er=ce.create,Ir=N.create,Cr=ue.create,Zr=Ae.create,Or=W.create,Nr=Q.create,jr=le.create,Pr=fe.create,Mr=q.create,Vr=he.create,$r=ee.create,et=Z.create,Dr=j.create,Br=L.create,qr=Z.createWithPreprocess,Lr=ge.create;var i=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:qt,getErrorMap:_e,makeIssue:be,EMPTY_PATH:Lt,addIssueToContext:h,ParseStatus:A,INVALID:y,DIRTY:J,OK:R,isAborted:Oe,isDirty:Ne,isValid:U,isAsync:re,get util(){return x},get objectUtil(){return Ze},ZodParsedType:p,getParsedType:P,ZodType:b,datetimeRegex:We,ZodString:I,ZodNumber:D,ZodBigInt:B,ZodBoolean:ae,ZodDate:F,ZodSymbol:ke,ZodUndefined:ie,ZodNull:oe,ZodAny:X,ZodUnknown:G,ZodNever:M,ZodVoid:we,ZodArray:C,ZodObject:k,ZodUnion:de,ZodDiscriminatedUnion:Te,ZodIntersection:ce,ZodTuple:N,ZodRecord:ue,ZodMap:Ae,ZodSet:W,ZodFunction:Q,ZodLazy:le,ZodLiteral:fe,ZodEnum:q,ZodNativeEnum:he,ZodPromise:ee,ZodEffects:Z,ZodTransformer:Z,ZodOptional:j,ZodNullable:L,ZodDefault:pe,ZodCatch:me,ZodNaN:Re,BRAND:ur,ZodBranded:Me,ZodPipeline:ge,ZodReadonly:ve,custom:Je,Schema:b,ZodSchema:b,late:lr,get ZodFirstPartyTypeKind(){return v},coerce:{string:r=>I.create({...r,coerce:!0}),number:r=>D.create({...r,coerce:!0}),boolean:r=>ae.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>F.create({...r,coerce:!0})},any:_r,array:wr,bigint:pr,boolean:Qe,date:mr,discriminatedUnion:Sr,effect:et,enum:Mr,function:Nr,instanceof:fr,intersection:Er,lazy:jr,literal:Pr,map:Zr,nan:hr,nativeEnum:Vr,never:xr,null:yr,nullable:Br,number:Ke,object:Tr,oboolean:()=>Qe().optional(),onumber:()=>Ke().optional(),optional:Dr,ostring:()=>Xe().optional(),pipeline:Lr,preprocess:qr,promise:$r,record:Cr,set:Or,strictObject:Ar,string:Xe,symbol:gr,transformer:et,tuple:Ir,undefined:vr,union:Rr,unknown:br,void:kr,NEVER:y,ZodIssueCode:c,quotelessJson:Bt,ZodError:S});const Se=i.object({id:i.string().min(1,"Asset ID is required"),type:i.enum(["image","video","audio","text","graphics"]),url:i.string().url("Invalid URL format"),projectId:i.string().min(1,"Project ID is required"),createdAt:i.date().or(i.string().transform(r=>new Date(r))),updatedAt:i.date().or(i.string().transform(r=>new Date(r))).optional()}),tt=i.object({prompt:i.string().optional(),negativePrompt:i.string().optional(),model:i.string().optional(),modelVersion:i.string().optional(),settings:i.record(i.any()).optional(),cost:i.number().min(0).optional(),processingTime:i.number().min(0).optional(),attempts:i.number().int().min(1).optional(),jobId:i.string().optional()}),rt=i.object({userId:i.string(),projectId:i.string().optional(),uploadedAt:i.string().optional(),source:i.enum(["direct","url","presigned"]),originalName:i.string().optional(),originalUrl:i.string().url().optional(),uploadedUrl:i.string().url().optional(),contentType:i.string(),size:i.number().min(0).optional(),folder:i.string().optional(),dimensions:i.object({width:i.number().int().positive(),height:i.number().int().positive()}).optional(),duration:i.number().positive().optional()}),Ee=Se.extend({name:i.string().optional(),sceneId:i.string().optional(),provider:i.string().min(1,"Provider is required"),uploadMetadata:rt.optional(),generationMetadata:tt.optional(),processingMetadata:i.object({sourceAssetId:i.string().optional(),transformations:i.array(i.object({type:i.string(),parameters:i.record(i.any())})).optional(),compression:i.object({quality:i.number().min(0).max(100).optional(),format:i.string().optional(),bitrate:i.number().positive().optional()}).optional(),processedAt:i.date().optional(),processingTime:i.number().min(0).optional()}).optional(),dimensions:i.object({width:i.number().int().positive(),height:i.number().int().positive()}).optional(),duration:i.number().positive().optional(),size:i.number().min(0).optional(),contentType:i.string().optional(),tags:i.array(i.string()).optional(),rights:i.object({license:i.enum(["creative-commons","royalty-free","rights-managed","custom"]).optional(),attribution:i.string().optional(),restrictions:i.array(i.string()).optional(),expiresAt:i.date().optional(),owner:i.string().optional()}).optional()});function zr(r){return Se.parse(r)}function Ur(r){return Se.safeParse(r)}function Fr(r){return Ee.parse(r)}function Gr(r){return Ee.safeParse(r)}const nt=Ee.partial().required({id:!0});function Wr(r){return nt.parse(r)}const st=i.object({requestId:i.string().optional(),clientId:i.string().optional(),version:i.string().optional(),timestamp:i.date().or(i.string().transform(r=>new Date(r))).optional(),source:i.enum(["web","mobile","api","internal"]).optional()}).passthrough(),z=i.object({projectId:i.string().min(1,"Project ID is required"),userId:i.string().optional(),metadata:st.optional()}),at=i.object({page:i.number().int().min(1).optional(),limit:i.number().int().min(1).max(100).optional(),cursor:i.string().optional()}),Yr=z.extend({pagination:at.optional()}),it=i.object({type:i.union([i.string(),i.array(i.string())]).optional(),status:i.union([i.string(),i.array(i.string())]).optional(),dateRange:i.object({from:i.date().or(i.string().transform(r=>new Date(r))),to:i.date().or(i.string().transform(r=>new Date(r)))}).optional()}).passthrough(),ot=i.object({field:i.string().min(1,"Sort field is required"),order:i.enum(["asc","desc"])}),Hr=z.extend({filters:it.optional(),sort:ot.optional()}),dt=z.extend({assetType:i.literal("image"),prompt:i.string().min(1,"Prompt is required"),negativePrompt:i.string().optional(),style:i.string().optional(),quality:i.enum(["standard","hd"]).optional(),dimensions:i.object({width:i.number().int().min(64).max(4096),height:i.number().int().min(64).max(4096)}).optional(),numberOfImages:i.number().int().min(1).max(10).optional(),provider:i.string().optional(),sceneId:i.string().optional()}),ct=z.extend({assetType:i.literal("video"),prompt:i.string().min(1,"Prompt is required"),duration:i.number().min(1).max(120),style:i.string().optional(),quality:i.string().optional(),fps:i.number().int().min(1).max(120).optional(),provider:i.string().optional(),sceneId:i.string().optional()}),ut=z.extend({assetType:i.literal("audio"),text:i.string().optional(),prompt:i.string().optional(),voiceId:i.string().optional(),duration:i.number().min(.5).max(300).optional(),settings:i.record(i.any()).optional(),provider:i.string().optional(),sceneId:i.string().optional()}).refine(r=>r.text||r.prompt,{message:"Either text or prompt is required"});function Jr(r){return z.parse(r)}function Xr(r){return z.safeParse(r)}function Kr(r){return dt.parse(r)}function Qr(r){return ct.parse(r)}function en(r){return ut.parse(r)}function tn(r){return e=>r.parse(e)}const Ve=i.object({code:i.string().min(1,"Error code is required"),message:i.string().min(1,"Error message is required"),details:i.record(i.any()).optional(),stack:i.string().optional(),timestamp:i.string().datetime()}),lt=i.object({requestId:i.string().optional(),processingTime:i.number().min(0).optional(),version:i.string().optional(),timestamp:i.date().or(i.string().transform(r=>new Date(r))).optional(),rateLimit:i.object({limit:i.number().int().positive(),remaining:i.number().int().min(0),reset:i.date().or(i.string().transform(r=>new Date(r)))}).optional()}).passthrough(),te=i.object({success:i.boolean(),data:i.any().optional(),error:Ve.optional(),metadata:lt.optional()}),ft=i.object({page:i.number().int().min(1),limit:i.number().int().min(1),total:i.number().int().min(0),totalPages:i.number().int().min(0),hasNext:i.boolean(),hasPrevious:i.boolean(),nextCursor:i.string().optional(),previousCursor:i.string().optional()}),ht=te.extend({data:i.array(i.any()),pagination:ft.optional()}),pt=i.object({index:i.number().int().min(0),success:i.boolean(),data:i.any().optional(),error:Ve.optional()}),mt=te.omit({data:!0}).extend({results:i.array(pt),summary:i.object({total:i.number().int().min(0),succeeded:i.number().int().min(0),failed:i.number().int().min(0),skipped:i.number().int().min(0)})}),gt=te.extend({provider:i.string().min(1,"Provider is required"),processingTime:i.number().min(0).optional(),cost:i.number().min(0).optional()});function rn(r){return te.parse(r)}function nn(r){return te.safeParse(r)}function sn(r){return ht.parse(r)}function an(r){return mt.parse(r)}function on(r){return gt.parse(r)}function dn(r){return e=>r.parse(e)}const cn="1.0.7",un="@etaio/core-types";u.ApiAssetSchema=Ee,u.AssetAdapter=Ct,u.AssetStatus=De,u.AssetType=w,u.AudioGenerationRequestSchema=ut,u.BaseAssetSchema=Se,u.BaseProviderManager=jt,u.BaseRequestSchema=z,u.BaseResponseSchema=te,u.BatchResponseSchema=mt,u.BatchResultSchema=pt,u.ErrorResponseSchema=Ve,u.FilterParamsSchema=it,u.FilteredRequestSchema=Hr,u.GenAIException=Mt,u.GenerationMetadataSchema=tt,u.GenerationResponseSchema=gt,u.ImageGenerationRequestSchema=dt,u.PACKAGE_NAME=un,u.PaginatedRequestSchema=Yr,u.PaginatedResponseSchema=ht,u.PaginationInfoSchema=ft,u.PaginationParamsSchema=at,u.PartialAssetUpdateSchema=nt,u.ProviderAuthError=qe,u.ProviderError=$,u.ProviderQuotaError=Zt,u.ProviderRateLimitError=Be,u.ProviderRegistry=Pt,u.ProviderTimeoutError=Ot,u.ProviderValidationError=Nt,u.RequestMetadataSchema=st,u.ResponseMetadataSchema=lt,u.SortParamsSchema=ot,u.UploadMetadataSchema=rt,u.VERSION=cn,u.VideoGenerationRequestSchema=ct,u.createAIContext=Vt,u.createRequestValidator=tn,u.createResponseValidator=dn,u.errorResponse=xt,u.getMediaCount=Dt,u.hasGenerationMetadata=Et,u.hasMedia=$t,u.hasUploadMetadata=It,u.isApiAsset=St,u.isAssetType=vt,u.isBaseAsset=Y,u.isBaseRequest=Ce,u.isErrorResponse=wt,u.isFilteredRequest=_t,u.isGenerativeAsset=At,u.isGenerativeMetadata=Rt,u.isPaginatedRequest=yt,u.isPaginatedResponse=Tt,u.isSuccessResponse=$e,u.paginatedResponse=kt,u.safeValidateApiAsset=Gr,u.safeValidateBaseAsset=Ur,u.safeValidateBaseRequest=Xr,u.safeValidateBaseResponse=nn,u.successResponse=bt,u.validateApiAsset=Fr,u.validateAudioGenerationRequest=en,u.validateBaseAsset=zr,u.validateBaseRequest=Jr,u.validateBaseResponse=rn,u.validateBatchResponse=an,u.validateGenerationResponse=on,u.validateImageGenerationRequest=Kr,u.validatePaginatedResponse=sn,u.validatePartialAssetUpdate=Wr,u.validateVideoGenerationRequest=Qr,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etaio/core-types",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "Core TypeScript type definitions for the Etaio generative AI ecosystem",
5
5
  "author": "Etaio",
6
6
  "license": "MIT",