@feedmepos/mf-payment 0.0.0-beta.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js +39 -0
  2. package/dist/AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js +42 -0
  3. package/dist/AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js +40 -0
  4. package/dist/Modal-DB8M9o1T.js +13 -0
  5. package/dist/PayoutAccount-DZaKHWcy.js +612 -0
  6. package/dist/{PayoutAccount-CpatyqJa.js → PayoutAccount-Dc1CYQ0W.js} +38 -35
  7. package/dist/PayoutAccountSetting-BzmNuLFj.js +780 -0
  8. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  9. package/dist/Settlement-Bx3zAkIw.js +195 -0
  10. package/dist/Settlement-mwnO-iYH.js +150 -0
  11. package/dist/{SettlementTransactions-DT1A_tI5.js → SettlementTransactions-AaYyTH96.js} +99 -105
  12. package/dist/{SettlementTransactions-CkU0gCHb.js → SettlementTransactions-D_SVuKyR.js} +117 -130
  13. package/dist/Terminal-68OQnhM3.js +372 -0
  14. package/dist/TerminalSetting-DEFim0xg.js +379 -0
  15. package/dist/TerminalTransaction-CQjNdffr.js +426 -0
  16. package/dist/TerminalTransaction-ClihmWOJ.js +250 -0
  17. package/dist/Transaction-68L7JzIk.js +242 -0
  18. package/dist/Transaction-a1VfiCP_.js +405 -0
  19. package/dist/api/index.d.ts +14 -0
  20. package/dist/api/pagination.d.ts +20 -0
  21. package/dist/api/payment-gateway/index.d.ts +9 -0
  22. package/dist/api/settlement/index.d.ts +12 -13
  23. package/dist/api/terminal/index.d.ts +13 -1
  24. package/dist/api/terminal-transaction/index.d.ts +12 -1
  25. package/dist/api/transaction/index.d.ts +7 -2
  26. package/dist/app-C9FRsUfb.js +6343 -0
  27. package/dist/app.js +3 -198
  28. package/dist/assets-Bji7O2YD.js +45 -0
  29. package/dist/clipboard-4jh1WteU.js +10 -0
  30. package/dist/components/AsyncButton.vue.d.ts +21 -0
  31. package/dist/components/AutoCopyCell.vue.d.ts +6 -0
  32. package/dist/components/CursorTable/index.vue.d.ts +24 -5
  33. package/dist/components/RestaurantSelector.vue.d.ts +2 -0
  34. package/dist/components/RouteCell.vue.d.ts +8 -0
  35. package/dist/helpers/assets.d.ts +2 -0
  36. package/dist/index-Bt_OgDYn.js +56107 -0
  37. package/dist/index-CLYePgWW.js +47 -0
  38. package/dist/{index-CF56zGyu.js → index-DBfZnaV1.js} +1 -1
  39. package/dist/index-DSuZG0l6.js +52 -0
  40. package/dist/{index-Bmka-1lQ.js → index-DjDGwRX8.js} +1 -1
  41. package/dist/index-_0TroOJr.js +127 -0
  42. package/dist/index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js +167 -0
  43. package/dist/model/transaction.d.ts +2 -1
  44. package/dist/package.json +4 -4
  45. package/dist/payout-account-BWcq7OJy.js +1805 -0
  46. package/dist/stores/payoutAccount.d.ts +4 -4
  47. package/dist/transaction-DqrhM5jB.js +87 -0
  48. package/dist/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/validator-D5jtpt9A.js +2877 -0
  50. package/dist/views/admin/payout-account/tabs/Information.vue.d.ts +4 -4
  51. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  52. package/dist/views/admin/payout-account/tabs/PaymentStatus.vue.d.ts +4 -4
  53. package/dist/views/admin/payout-account/tabs/Settlement.vue.d.ts +4 -4
  54. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  55. package/dist/views/admin/payout-account/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  56. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  57. package/dist/views/admin/settlement/SettlementTable.vue.d.ts +12 -12
  58. package/dist/views/admin/terminal/TerminalDialog.vue.d.ts +83 -0
  59. package/dist/views/admin/terminal/TerminalSetting.vue.d.ts +12 -0
  60. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +80 -9
  61. package/dist/views/admin/terminal/tabs/FiuuGateway.vue.d.ts +94 -0
  62. package/dist/views/admin/terminal/tabs/GhlGateway.vue.d.ts +94 -0
  63. package/dist/views/admin/terminal/tabs/Information.vue.d.ts +85 -0
  64. package/dist/views/admin/terminal/tabs/TerminalGateway.vue.d.ts +94 -0
  65. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +7 -0
  66. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +6 -2
  67. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +7 -0
  68. package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +8 -8
  69. package/dist/views/settlement/SettlementTable.vue.d.ts +12 -12
  70. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  71. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  72. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  73. package/package.json +4 -4
  74. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +0 -42
  75. package/dist/PayoutAccount-C0xyoyTa.js +0 -3485
  76. package/dist/PayoutAccountSetting-CIeos0md.js +0 -425
  77. package/dist/Settlement-BVGACeme.js +0 -136
  78. package/dist/Settlement-Ce48KHrc.js +0 -132
  79. package/dist/Terminal-ByKV2Rof.js +0 -204
  80. package/dist/TerminalTransaction-ClhuAOOF.js +0 -240
  81. package/dist/Transaction-BYq9Ymp_.js +0 -242
  82. package/dist/Transaction-Doq11qIf.js +0 -241
  83. package/dist/api/auth/index.d.ts +0 -7
  84. package/dist/assets-Dg26uQOf.js +0 -1756
  85. package/dist/index-Coz5aeIO.js +0 -61
  86. package/dist/index-DCPNrUDq.js +0 -40075
  87. package/dist/index.vue_vue_type_script_setup_true_lang-CAR-bNaR.js +0 -150
  88. package/dist/mascot-side-D5UubCy7.js +0 -8
  89. package/dist/payout-account-D2Ftjrss.js +0 -3317
  90. package/dist/transaction-vRrBf3FN.js +0 -64
@@ -1,3485 +0,0 @@
1
- import { defineComponent as ie, ref as pe, reactive as gt, computed as ge, watch as Ye, resolveComponent as R, openBlock as C, createBlock as Z, withCtx as H, createElementVNode as x, createVNode as E, unref as A, createCommentVNode as Re, createElementBlock as Ge, normalizeClass as Qe, toDisplayString as vt, h as Ie, onMounted as _t, Fragment as bt } from "vue";
2
- import { p as qe } from "./index-CF56zGyu.js";
3
- import { _ as Ve, u as xt, e as nt } from "./index-DCPNrUDq.js";
4
- import { defineStore as kt } from "pinia";
5
- import { useCoreStore as wt } from "@feedmepos/mf-common";
6
- import { c as Tt, P as me } from "./payout-account-D2Ftjrss.js";
7
- import { useDialogChild as St, useDialog as Nt } from "@feedmepos/ui-library";
8
- import { P as rt } from "./PDFViewer-CjH_C1uT.js";
9
- import { _ as Ot } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
10
- import { m as Ct } from "./mascot-side-D5UubCy7.js";
11
- function At() {
12
- return {
13
- businessPayoutAccounts: []
14
- };
15
- }
16
- const Et = kt("payoutAccount", {
17
- state: () => At(),
18
- getters: {
19
- getBusinessPayoutAccounts: (n) => n.businessPayoutAccounts
20
- },
21
- actions: {
22
- async readBusinessPayoutAccounts() {
23
- this.businessPayoutAccounts = await qe.readBusinessPayoutAccounts();
24
- },
25
- async updateBusinessPayoutAccounts(n, e) {
26
- await qe.updateBusinessPayoutAccounts(n, e);
27
- },
28
- async createBusinessPayoutAccounts(n) {
29
- const e = await qe.createBusinessPayoutAccounts(n);
30
- this.businessPayoutAccounts.push(e);
31
- }
32
- }
33
- });
34
- var b;
35
- (function(n) {
36
- n.assertEqual = (s) => s;
37
- function e(s) {
38
- }
39
- n.assertIs = e;
40
- function t(s) {
41
- throw new Error();
42
- }
43
- n.assertNever = t, n.arrayToEnum = (s) => {
44
- const a = {};
45
- for (const o of s)
46
- a[o] = o;
47
- return a;
48
- }, n.getValidEnumValues = (s) => {
49
- const a = n.objectKeys(s).filter((i) => typeof s[s[i]] != "number"), o = {};
50
- for (const i of a)
51
- o[i] = s[i];
52
- return n.objectValues(o);
53
- }, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
54
- return s[a];
55
- }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
56
- const a = [];
57
- for (const o in s)
58
- Object.prototype.hasOwnProperty.call(s, o) && a.push(o);
59
- return a;
60
- }, n.find = (s, a) => {
61
- for (const o of s)
62
- if (a(o))
63
- return o;
64
- }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
65
- function r(s, a = " | ") {
66
- return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
67
- }
68
- n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
69
- })(b || (b = {}));
70
- var He;
71
- (function(n) {
72
- n.mergeShapes = (e, t) => ({
73
- ...e,
74
- ...t
75
- // second overwrites first
76
- });
77
- })(He || (He = {}));
78
- const f = b.arrayToEnum([
79
- "string",
80
- "nan",
81
- "number",
82
- "integer",
83
- "float",
84
- "boolean",
85
- "date",
86
- "bigint",
87
- "symbol",
88
- "function",
89
- "undefined",
90
- "null",
91
- "array",
92
- "object",
93
- "unknown",
94
- "promise",
95
- "void",
96
- "never",
97
- "map",
98
- "set"
99
- ]), G = (n) => {
100
- switch (typeof n) {
101
- case "undefined":
102
- return f.undefined;
103
- case "string":
104
- return f.string;
105
- case "number":
106
- return isNaN(n) ? f.nan : f.number;
107
- case "boolean":
108
- return f.boolean;
109
- case "function":
110
- return f.function;
111
- case "bigint":
112
- return f.bigint;
113
- case "symbol":
114
- return f.symbol;
115
- case "object":
116
- return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
117
- default:
118
- return f.unknown;
119
- }
120
- }, d = b.arrayToEnum([
121
- "invalid_type",
122
- "invalid_literal",
123
- "custom",
124
- "invalid_union",
125
- "invalid_union_discriminator",
126
- "invalid_enum_value",
127
- "unrecognized_keys",
128
- "invalid_arguments",
129
- "invalid_return_type",
130
- "invalid_date",
131
- "invalid_string",
132
- "too_small",
133
- "too_big",
134
- "invalid_intersection_types",
135
- "not_multiple_of",
136
- "not_finite"
137
- ]), Zt = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
138
- class V extends Error {
139
- constructor(e) {
140
- super(), this.issues = [], this.addIssue = (r) => {
141
- this.issues = [...this.issues, r];
142
- }, this.addIssues = (r = []) => {
143
- this.issues = [...this.issues, ...r];
144
- };
145
- const t = new.target.prototype;
146
- Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
147
- }
148
- get errors() {
149
- return this.issues;
150
- }
151
- format(e) {
152
- const t = e || function(a) {
153
- return a.message;
154
- }, r = { _errors: [] }, s = (a) => {
155
- for (const o of a.issues)
156
- if (o.code === "invalid_union")
157
- o.unionErrors.map(s);
158
- else if (o.code === "invalid_return_type")
159
- s(o.returnTypeError);
160
- else if (o.code === "invalid_arguments")
161
- s(o.argumentsError);
162
- else if (o.path.length === 0)
163
- r._errors.push(t(o));
164
- else {
165
- let i = r, u = 0;
166
- for (; u < o.path.length; ) {
167
- const l = o.path[u];
168
- u === o.path.length - 1 ? (i[l] = i[l] || { _errors: [] }, i[l]._errors.push(t(o))) : i[l] = i[l] || { _errors: [] }, i = i[l], u++;
169
- }
170
- }
171
- };
172
- return s(this), r;
173
- }
174
- static assert(e) {
175
- if (!(e instanceof V))
176
- throw new Error(`Not a ZodError: ${e}`);
177
- }
178
- toString() {
179
- return this.message;
180
- }
181
- get message() {
182
- return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
183
- }
184
- get isEmpty() {
185
- return this.issues.length === 0;
186
- }
187
- flatten(e = (t) => t.message) {
188
- const t = {}, r = [];
189
- for (const s of this.issues)
190
- s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s));
191
- return { formErrors: r, fieldErrors: t };
192
- }
193
- get formErrors() {
194
- return this.flatten();
195
- }
196
- }
197
- V.create = (n) => new V(n);
198
- const le = (n, e) => {
199
- let t;
200
- switch (n.code) {
201
- case d.invalid_type:
202
- n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
203
- break;
204
- case d.invalid_literal:
205
- t = `Invalid literal value, expected ${JSON.stringify(n.expected, b.jsonStringifyReplacer)}`;
206
- break;
207
- case d.unrecognized_keys:
208
- t = `Unrecognized key(s) in object: ${b.joinValues(n.keys, ", ")}`;
209
- break;
210
- case d.invalid_union:
211
- t = "Invalid input";
212
- break;
213
- case d.invalid_union_discriminator:
214
- t = `Invalid discriminator value. Expected ${b.joinValues(n.options)}`;
215
- break;
216
- case d.invalid_enum_value:
217
- t = `Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;
218
- break;
219
- case d.invalid_arguments:
220
- t = "Invalid function arguments";
221
- break;
222
- case d.invalid_return_type:
223
- t = "Invalid function return type";
224
- break;
225
- case d.invalid_date:
226
- t = "Invalid date";
227
- break;
228
- case d.invalid_string:
229
- typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : b.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
230
- break;
231
- case d.too_small:
232
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
233
- break;
234
- case d.too_big:
235
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
236
- break;
237
- case d.custom:
238
- t = "Invalid input";
239
- break;
240
- case d.invalid_intersection_types:
241
- t = "Intersection results could not be merged";
242
- break;
243
- case d.not_multiple_of:
244
- t = `Number must be a multiple of ${n.multipleOf}`;
245
- break;
246
- case d.not_finite:
247
- t = "Number must be finite";
248
- break;
249
- default:
250
- t = e.defaultError, b.assertNever(n);
251
- }
252
- return { message: t };
253
- };
254
- let it = le;
255
- function Pt(n) {
256
- it = n;
257
- }
258
- function je() {
259
- return it;
260
- }
261
- const Me = (n) => {
262
- const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], o = {
263
- ...s,
264
- path: a
265
- };
266
- if (s.message !== void 0)
267
- return {
268
- ...s,
269
- path: a,
270
- message: s.message
271
- };
272
- let i = "";
273
- const u = r.filter((l) => !!l).slice().reverse();
274
- for (const l of u)
275
- i = l(o, { data: e, defaultError: i }).message;
276
- return {
277
- ...s,
278
- path: a,
279
- message: i
280
- };
281
- }, Rt = [];
282
- function c(n, e) {
283
- const t = je(), r = Me({
284
- issueData: e,
285
- data: n.data,
286
- path: n.path,
287
- errorMaps: [
288
- n.common.contextualErrorMap,
289
- n.schemaErrorMap,
290
- t,
291
- t === le ? void 0 : le
292
- // then global default map
293
- ].filter((s) => !!s)
294
- });
295
- n.common.issues.push(r);
296
- }
297
- class P {
298
- constructor() {
299
- this.value = "valid";
300
- }
301
- dirty() {
302
- this.value === "valid" && (this.value = "dirty");
303
- }
304
- abort() {
305
- this.value !== "aborted" && (this.value = "aborted");
306
- }
307
- static mergeArray(e, t) {
308
- const r = [];
309
- for (const s of t) {
310
- if (s.status === "aborted")
311
- return g;
312
- s.status === "dirty" && e.dirty(), r.push(s.value);
313
- }
314
- return { status: e.value, value: r };
315
- }
316
- static async mergeObjectAsync(e, t) {
317
- const r = [];
318
- for (const s of t) {
319
- const a = await s.key, o = await s.value;
320
- r.push({
321
- key: a,
322
- value: o
323
- });
324
- }
325
- return P.mergeObjectSync(e, r);
326
- }
327
- static mergeObjectSync(e, t) {
328
- const r = {};
329
- for (const s of t) {
330
- const { key: a, value: o } = s;
331
- if (a.status === "aborted" || o.status === "aborted")
332
- return g;
333
- a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (r[a.value] = o.value);
334
- }
335
- return { status: e.value, value: r };
336
- }
337
- }
338
- const g = Object.freeze({
339
- status: "aborted"
340
- }), de = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), Ke = (n) => n.status === "aborted", Je = (n) => n.status === "dirty", ve = (n) => n.status === "valid", _e = (n) => typeof Promise < "u" && n instanceof Promise;
341
- function $e(n, e, t, r) {
342
- if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
343
- return e.get(n);
344
- }
345
- function ot(n, e, t, r, s) {
346
- if (typeof e == "function" ? n !== e || !s : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
347
- return e.set(n, t), t;
348
- }
349
- var p;
350
- (function(n) {
351
- n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
352
- })(p || (p = {}));
353
- var he, ye;
354
- class D {
355
- constructor(e, t, r, s) {
356
- this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
357
- }
358
- get path() {
359
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
360
- }
361
- }
362
- const st = (n, e) => {
363
- if (ve(e))
364
- return { success: !0, data: e.value };
365
- if (!n.common.issues.length)
366
- throw new Error("Validation failed but no issues detected.");
367
- return {
368
- success: !1,
369
- get error() {
370
- if (this._error)
371
- return this._error;
372
- const t = new V(n.common.issues);
373
- return this._error = t, this._error;
374
- }
375
- };
376
- };
377
- function v(n) {
378
- if (!n)
379
- return {};
380
- const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
381
- if (e && (t || r))
382
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
383
- return e ? { errorMap: e, description: s } : { errorMap: (o, i) => {
384
- var u, l;
385
- const { message: m } = n;
386
- return o.code === "invalid_enum_value" ? { message: m ?? i.defaultError } : typeof i.data > "u" ? { message: (u = m ?? r) !== null && u !== void 0 ? u : i.defaultError } : o.code !== "invalid_type" ? { message: i.defaultError } : { message: (l = m ?? t) !== null && l !== void 0 ? l : i.defaultError };
387
- }, description: s };
388
- }
389
- class _ {
390
- constructor(e) {
391
- 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);
392
- }
393
- get description() {
394
- return this._def.description;
395
- }
396
- _getType(e) {
397
- return G(e.data);
398
- }
399
- _getOrReturnCtx(e, t) {
400
- return t || {
401
- common: e.parent.common,
402
- data: e.data,
403
- parsedType: G(e.data),
404
- schemaErrorMap: this._def.errorMap,
405
- path: e.path,
406
- parent: e.parent
407
- };
408
- }
409
- _processInputParams(e) {
410
- return {
411
- status: new P(),
412
- ctx: {
413
- common: e.parent.common,
414
- data: e.data,
415
- parsedType: G(e.data),
416
- schemaErrorMap: this._def.errorMap,
417
- path: e.path,
418
- parent: e.parent
419
- }
420
- };
421
- }
422
- _parseSync(e) {
423
- const t = this._parse(e);
424
- if (_e(t))
425
- throw new Error("Synchronous parse encountered promise.");
426
- return t;
427
- }
428
- _parseAsync(e) {
429
- const t = this._parse(e);
430
- return Promise.resolve(t);
431
- }
432
- parse(e, t) {
433
- const r = this.safeParse(e, t);
434
- if (r.success)
435
- return r.data;
436
- throw r.error;
437
- }
438
- safeParse(e, t) {
439
- var r;
440
- const s = {
441
- common: {
442
- issues: [],
443
- async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
444
- contextualErrorMap: t == null ? void 0 : t.errorMap
445
- },
446
- path: (t == null ? void 0 : t.path) || [],
447
- schemaErrorMap: this._def.errorMap,
448
- parent: null,
449
- data: e,
450
- parsedType: G(e)
451
- }, a = this._parseSync({ data: e, path: s.path, parent: s });
452
- return st(s, a);
453
- }
454
- async parseAsync(e, t) {
455
- const r = await this.safeParseAsync(e, t);
456
- if (r.success)
457
- return r.data;
458
- throw r.error;
459
- }
460
- async safeParseAsync(e, t) {
461
- const r = {
462
- common: {
463
- issues: [],
464
- contextualErrorMap: t == null ? void 0 : t.errorMap,
465
- async: !0
466
- },
467
- path: (t == null ? void 0 : t.path) || [],
468
- schemaErrorMap: this._def.errorMap,
469
- parent: null,
470
- data: e,
471
- parsedType: G(e)
472
- }, s = this._parse({ data: e, path: r.path, parent: r }), a = await (_e(s) ? s : Promise.resolve(s));
473
- return st(r, a);
474
- }
475
- refine(e, t) {
476
- const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
477
- return this._refinement((s, a) => {
478
- const o = e(s), i = () => a.addIssue({
479
- code: d.custom,
480
- ...r(s)
481
- });
482
- return typeof Promise < "u" && o instanceof Promise ? o.then((u) => u ? !0 : (i(), !1)) : o ? !0 : (i(), !1);
483
- });
484
- }
485
- refinement(e, t) {
486
- return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
487
- }
488
- _refinement(e) {
489
- return new $({
490
- schema: this,
491
- typeName: h.ZodEffects,
492
- effect: { type: "refinement", refinement: e }
493
- });
494
- }
495
- superRefine(e) {
496
- return this._refinement(e);
497
- }
498
- optional() {
499
- return B.create(this, this._def);
500
- }
501
- nullable() {
502
- return Q.create(this, this._def);
503
- }
504
- nullish() {
505
- return this.nullable().optional();
506
- }
507
- array() {
508
- return M.create(this, this._def);
509
- }
510
- promise() {
511
- return fe.create(this, this._def);
512
- }
513
- or(e) {
514
- return we.create([this, e], this._def);
515
- }
516
- and(e) {
517
- return Te.create(this, e, this._def);
518
- }
519
- transform(e) {
520
- return new $({
521
- ...v(this._def),
522
- schema: this,
523
- typeName: h.ZodEffects,
524
- effect: { type: "transform", transform: e }
525
- });
526
- }
527
- default(e) {
528
- const t = typeof e == "function" ? e : () => e;
529
- return new Ae({
530
- ...v(this._def),
531
- innerType: this,
532
- defaultValue: t,
533
- typeName: h.ZodDefault
534
- });
535
- }
536
- brand() {
537
- return new et({
538
- typeName: h.ZodBranded,
539
- type: this,
540
- ...v(this._def)
541
- });
542
- }
543
- catch(e) {
544
- const t = typeof e == "function" ? e : () => e;
545
- return new Ee({
546
- ...v(this._def),
547
- innerType: this,
548
- catchValue: t,
549
- typeName: h.ZodCatch
550
- });
551
- }
552
- describe(e) {
553
- const t = this.constructor;
554
- return new t({
555
- ...this._def,
556
- description: e
557
- });
558
- }
559
- pipe(e) {
560
- return Pe.create(this, e);
561
- }
562
- readonly() {
563
- return Ze.create(this);
564
- }
565
- isOptional() {
566
- return this.safeParse(void 0).success;
567
- }
568
- isNullable() {
569
- return this.safeParse(null).success;
570
- }
571
- }
572
- const It = /^c[^\s-]{8,}$/i, Vt = /^[0-9a-z]+$/, jt = /^[0-9A-HJKMNP-TV-Z]{26}$/, Mt = /^[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, $t = /^[a-z0-9_-]{21}$/i, Bt = /^[-+]?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)?)??$/, Dt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ut = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
573
- let We;
574
- const Lt = /^(?:(?: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])$/, Ft = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, zt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, dt = "((\\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])))", qt = new RegExp(`^${dt}$`);
575
- function ut(n) {
576
- let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
577
- return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
578
- }
579
- function Wt(n) {
580
- return new RegExp(`^${ut(n)}$`);
581
- }
582
- function lt(n) {
583
- let e = `${dt}T${ut(n)}`;
584
- const t = [];
585
- return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
586
- }
587
- function Yt(n, e) {
588
- return !!((e === "v4" || !e) && Lt.test(n) || (e === "v6" || !e) && Ft.test(n));
589
- }
590
- class j extends _ {
591
- _parse(e) {
592
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
593
- const a = this._getOrReturnCtx(e);
594
- return c(a, {
595
- code: d.invalid_type,
596
- expected: f.string,
597
- received: a.parsedType
598
- }), g;
599
- }
600
- const r = new P();
601
- let s;
602
- for (const a of this._def.checks)
603
- if (a.kind === "min")
604
- e.data.length < a.value && (s = this._getOrReturnCtx(e, s), c(s, {
605
- code: d.too_small,
606
- minimum: a.value,
607
- type: "string",
608
- inclusive: !0,
609
- exact: !1,
610
- message: a.message
611
- }), r.dirty());
612
- else if (a.kind === "max")
613
- e.data.length > a.value && (s = this._getOrReturnCtx(e, s), c(s, {
614
- code: d.too_big,
615
- maximum: a.value,
616
- type: "string",
617
- inclusive: !0,
618
- exact: !1,
619
- message: a.message
620
- }), r.dirty());
621
- else if (a.kind === "length") {
622
- const o = e.data.length > a.value, i = e.data.length < a.value;
623
- (o || i) && (s = this._getOrReturnCtx(e, s), o ? c(s, {
624
- code: d.too_big,
625
- maximum: a.value,
626
- type: "string",
627
- inclusive: !0,
628
- exact: !0,
629
- message: a.message
630
- }) : i && c(s, {
631
- code: d.too_small,
632
- minimum: a.value,
633
- type: "string",
634
- inclusive: !0,
635
- exact: !0,
636
- message: a.message
637
- }), r.dirty());
638
- } else if (a.kind === "email")
639
- Dt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
640
- validation: "email",
641
- code: d.invalid_string,
642
- message: a.message
643
- }), r.dirty());
644
- else if (a.kind === "emoji")
645
- We || (We = new RegExp(Ut, "u")), We.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
646
- validation: "emoji",
647
- code: d.invalid_string,
648
- message: a.message
649
- }), r.dirty());
650
- else if (a.kind === "uuid")
651
- Mt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
652
- validation: "uuid",
653
- code: d.invalid_string,
654
- message: a.message
655
- }), r.dirty());
656
- else if (a.kind === "nanoid")
657
- $t.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
658
- validation: "nanoid",
659
- code: d.invalid_string,
660
- message: a.message
661
- }), r.dirty());
662
- else if (a.kind === "cuid")
663
- It.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
664
- validation: "cuid",
665
- code: d.invalid_string,
666
- message: a.message
667
- }), r.dirty());
668
- else if (a.kind === "cuid2")
669
- Vt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
670
- validation: "cuid2",
671
- code: d.invalid_string,
672
- message: a.message
673
- }), r.dirty());
674
- else if (a.kind === "ulid")
675
- jt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
676
- validation: "ulid",
677
- code: d.invalid_string,
678
- message: a.message
679
- }), r.dirty());
680
- else if (a.kind === "url")
681
- try {
682
- new URL(e.data);
683
- } catch {
684
- s = this._getOrReturnCtx(e, s), c(s, {
685
- validation: "url",
686
- code: d.invalid_string,
687
- message: a.message
688
- }), r.dirty();
689
- }
690
- else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
691
- validation: "regex",
692
- code: d.invalid_string,
693
- message: a.message
694
- }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), c(s, {
695
- code: d.invalid_string,
696
- validation: { includes: a.value, position: a.position },
697
- message: a.message
698
- }), r.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), c(s, {
699
- code: d.invalid_string,
700
- validation: { startsWith: a.value },
701
- message: a.message
702
- }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), c(s, {
703
- code: d.invalid_string,
704
- validation: { endsWith: a.value },
705
- message: a.message
706
- }), r.dirty()) : a.kind === "datetime" ? lt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
707
- code: d.invalid_string,
708
- validation: "datetime",
709
- message: a.message
710
- }), r.dirty()) : a.kind === "date" ? qt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
711
- code: d.invalid_string,
712
- validation: "date",
713
- message: a.message
714
- }), r.dirty()) : a.kind === "time" ? Wt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
715
- code: d.invalid_string,
716
- validation: "time",
717
- message: a.message
718
- }), r.dirty()) : a.kind === "duration" ? Bt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
719
- validation: "duration",
720
- code: d.invalid_string,
721
- message: a.message
722
- }), r.dirty()) : a.kind === "ip" ? Yt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), c(s, {
723
- validation: "ip",
724
- code: d.invalid_string,
725
- message: a.message
726
- }), r.dirty()) : a.kind === "base64" ? zt.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
727
- validation: "base64",
728
- code: d.invalid_string,
729
- message: a.message
730
- }), r.dirty()) : b.assertNever(a);
731
- return { status: r.value, value: e.data };
732
- }
733
- _regex(e, t, r) {
734
- return this.refinement((s) => e.test(s), {
735
- validation: t,
736
- code: d.invalid_string,
737
- ...p.errToObj(r)
738
- });
739
- }
740
- _addCheck(e) {
741
- return new j({
742
- ...this._def,
743
- checks: [...this._def.checks, e]
744
- });
745
- }
746
- email(e) {
747
- return this._addCheck({ kind: "email", ...p.errToObj(e) });
748
- }
749
- url(e) {
750
- return this._addCheck({ kind: "url", ...p.errToObj(e) });
751
- }
752
- emoji(e) {
753
- return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
754
- }
755
- uuid(e) {
756
- return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
757
- }
758
- nanoid(e) {
759
- return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
760
- }
761
- cuid(e) {
762
- return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
763
- }
764
- cuid2(e) {
765
- return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
766
- }
767
- ulid(e) {
768
- return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
769
- }
770
- base64(e) {
771
- return this._addCheck({ kind: "base64", ...p.errToObj(e) });
772
- }
773
- ip(e) {
774
- return this._addCheck({ kind: "ip", ...p.errToObj(e) });
775
- }
776
- datetime(e) {
777
- var t, r;
778
- return typeof e == "string" ? this._addCheck({
779
- kind: "datetime",
780
- precision: null,
781
- offset: !1,
782
- local: !1,
783
- message: e
784
- }) : this._addCheck({
785
- kind: "datetime",
786
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
787
- offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
788
- local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1,
789
- ...p.errToObj(e == null ? void 0 : e.message)
790
- });
791
- }
792
- date(e) {
793
- return this._addCheck({ kind: "date", message: e });
794
- }
795
- time(e) {
796
- return typeof e == "string" ? this._addCheck({
797
- kind: "time",
798
- precision: null,
799
- message: e
800
- }) : this._addCheck({
801
- kind: "time",
802
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
803
- ...p.errToObj(e == null ? void 0 : e.message)
804
- });
805
- }
806
- duration(e) {
807
- return this._addCheck({ kind: "duration", ...p.errToObj(e) });
808
- }
809
- regex(e, t) {
810
- return this._addCheck({
811
- kind: "regex",
812
- regex: e,
813
- ...p.errToObj(t)
814
- });
815
- }
816
- includes(e, t) {
817
- return this._addCheck({
818
- kind: "includes",
819
- value: e,
820
- position: t == null ? void 0 : t.position,
821
- ...p.errToObj(t == null ? void 0 : t.message)
822
- });
823
- }
824
- startsWith(e, t) {
825
- return this._addCheck({
826
- kind: "startsWith",
827
- value: e,
828
- ...p.errToObj(t)
829
- });
830
- }
831
- endsWith(e, t) {
832
- return this._addCheck({
833
- kind: "endsWith",
834
- value: e,
835
- ...p.errToObj(t)
836
- });
837
- }
838
- min(e, t) {
839
- return this._addCheck({
840
- kind: "min",
841
- value: e,
842
- ...p.errToObj(t)
843
- });
844
- }
845
- max(e, t) {
846
- return this._addCheck({
847
- kind: "max",
848
- value: e,
849
- ...p.errToObj(t)
850
- });
851
- }
852
- length(e, t) {
853
- return this._addCheck({
854
- kind: "length",
855
- value: e,
856
- ...p.errToObj(t)
857
- });
858
- }
859
- /**
860
- * @deprecated Use z.string().min(1) instead.
861
- * @see {@link ZodString.min}
862
- */
863
- nonempty(e) {
864
- return this.min(1, p.errToObj(e));
865
- }
866
- trim() {
867
- return new j({
868
- ...this._def,
869
- checks: [...this._def.checks, { kind: "trim" }]
870
- });
871
- }
872
- toLowerCase() {
873
- return new j({
874
- ...this._def,
875
- checks: [...this._def.checks, { kind: "toLowerCase" }]
876
- });
877
- }
878
- toUpperCase() {
879
- return new j({
880
- ...this._def,
881
- checks: [...this._def.checks, { kind: "toUpperCase" }]
882
- });
883
- }
884
- get isDatetime() {
885
- return !!this._def.checks.find((e) => e.kind === "datetime");
886
- }
887
- get isDate() {
888
- return !!this._def.checks.find((e) => e.kind === "date");
889
- }
890
- get isTime() {
891
- return !!this._def.checks.find((e) => e.kind === "time");
892
- }
893
- get isDuration() {
894
- return !!this._def.checks.find((e) => e.kind === "duration");
895
- }
896
- get isEmail() {
897
- return !!this._def.checks.find((e) => e.kind === "email");
898
- }
899
- get isURL() {
900
- return !!this._def.checks.find((e) => e.kind === "url");
901
- }
902
- get isEmoji() {
903
- return !!this._def.checks.find((e) => e.kind === "emoji");
904
- }
905
- get isUUID() {
906
- return !!this._def.checks.find((e) => e.kind === "uuid");
907
- }
908
- get isNANOID() {
909
- return !!this._def.checks.find((e) => e.kind === "nanoid");
910
- }
911
- get isCUID() {
912
- return !!this._def.checks.find((e) => e.kind === "cuid");
913
- }
914
- get isCUID2() {
915
- return !!this._def.checks.find((e) => e.kind === "cuid2");
916
- }
917
- get isULID() {
918
- return !!this._def.checks.find((e) => e.kind === "ulid");
919
- }
920
- get isIP() {
921
- return !!this._def.checks.find((e) => e.kind === "ip");
922
- }
923
- get isBase64() {
924
- return !!this._def.checks.find((e) => e.kind === "base64");
925
- }
926
- get minLength() {
927
- let e = null;
928
- for (const t of this._def.checks)
929
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
930
- return e;
931
- }
932
- get maxLength() {
933
- let e = null;
934
- for (const t of this._def.checks)
935
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
936
- return e;
937
- }
938
- }
939
- j.create = (n) => {
940
- var e;
941
- return new j({
942
- checks: [],
943
- typeName: h.ZodString,
944
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
945
- ...v(n)
946
- });
947
- };
948
- function Gt(n, e) {
949
- const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
950
- return a % o / Math.pow(10, s);
951
- }
952
- class K extends _ {
953
- constructor() {
954
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
955
- }
956
- _parse(e) {
957
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
958
- const a = this._getOrReturnCtx(e);
959
- return c(a, {
960
- code: d.invalid_type,
961
- expected: f.number,
962
- received: a.parsedType
963
- }), g;
964
- }
965
- let r;
966
- const s = new P();
967
- for (const a of this._def.checks)
968
- a.kind === "int" ? b.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
969
- code: d.invalid_type,
970
- expected: "integer",
971
- received: "float",
972
- message: a.message
973
- }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), c(r, {
974
- code: d.too_small,
975
- minimum: a.value,
976
- type: "number",
977
- inclusive: a.inclusive,
978
- exact: !1,
979
- message: a.message
980
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), c(r, {
981
- code: d.too_big,
982
- maximum: a.value,
983
- type: "number",
984
- inclusive: a.inclusive,
985
- exact: !1,
986
- message: a.message
987
- }), s.dirty()) : a.kind === "multipleOf" ? Gt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), c(r, {
988
- code: d.not_multiple_of,
989
- multipleOf: a.value,
990
- message: a.message
991
- }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
992
- code: d.not_finite,
993
- message: a.message
994
- }), s.dirty()) : b.assertNever(a);
995
- return { status: s.value, value: e.data };
996
- }
997
- gte(e, t) {
998
- return this.setLimit("min", e, !0, p.toString(t));
999
- }
1000
- gt(e, t) {
1001
- return this.setLimit("min", e, !1, p.toString(t));
1002
- }
1003
- lte(e, t) {
1004
- return this.setLimit("max", e, !0, p.toString(t));
1005
- }
1006
- lt(e, t) {
1007
- return this.setLimit("max", e, !1, p.toString(t));
1008
- }
1009
- setLimit(e, t, r, s) {
1010
- return new K({
1011
- ...this._def,
1012
- checks: [
1013
- ...this._def.checks,
1014
- {
1015
- kind: e,
1016
- value: t,
1017
- inclusive: r,
1018
- message: p.toString(s)
1019
- }
1020
- ]
1021
- });
1022
- }
1023
- _addCheck(e) {
1024
- return new K({
1025
- ...this._def,
1026
- checks: [...this._def.checks, e]
1027
- });
1028
- }
1029
- int(e) {
1030
- return this._addCheck({
1031
- kind: "int",
1032
- message: p.toString(e)
1033
- });
1034
- }
1035
- positive(e) {
1036
- return this._addCheck({
1037
- kind: "min",
1038
- value: 0,
1039
- inclusive: !1,
1040
- message: p.toString(e)
1041
- });
1042
- }
1043
- negative(e) {
1044
- return this._addCheck({
1045
- kind: "max",
1046
- value: 0,
1047
- inclusive: !1,
1048
- message: p.toString(e)
1049
- });
1050
- }
1051
- nonpositive(e) {
1052
- return this._addCheck({
1053
- kind: "max",
1054
- value: 0,
1055
- inclusive: !0,
1056
- message: p.toString(e)
1057
- });
1058
- }
1059
- nonnegative(e) {
1060
- return this._addCheck({
1061
- kind: "min",
1062
- value: 0,
1063
- inclusive: !0,
1064
- message: p.toString(e)
1065
- });
1066
- }
1067
- multipleOf(e, t) {
1068
- return this._addCheck({
1069
- kind: "multipleOf",
1070
- value: e,
1071
- message: p.toString(t)
1072
- });
1073
- }
1074
- finite(e) {
1075
- return this._addCheck({
1076
- kind: "finite",
1077
- message: p.toString(e)
1078
- });
1079
- }
1080
- safe(e) {
1081
- return this._addCheck({
1082
- kind: "min",
1083
- inclusive: !0,
1084
- value: Number.MIN_SAFE_INTEGER,
1085
- message: p.toString(e)
1086
- })._addCheck({
1087
- kind: "max",
1088
- inclusive: !0,
1089
- value: Number.MAX_SAFE_INTEGER,
1090
- message: p.toString(e)
1091
- });
1092
- }
1093
- get minValue() {
1094
- let e = null;
1095
- for (const t of this._def.checks)
1096
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1097
- return e;
1098
- }
1099
- get maxValue() {
1100
- let e = null;
1101
- for (const t of this._def.checks)
1102
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1103
- return e;
1104
- }
1105
- get isInt() {
1106
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1107
- }
1108
- get isFinite() {
1109
- let e = null, t = null;
1110
- for (const r of this._def.checks) {
1111
- if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1112
- return !0;
1113
- r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1114
- }
1115
- return Number.isFinite(t) && Number.isFinite(e);
1116
- }
1117
- }
1118
- K.create = (n) => new K({
1119
- checks: [],
1120
- typeName: h.ZodNumber,
1121
- coerce: (n == null ? void 0 : n.coerce) || !1,
1122
- ...v(n)
1123
- });
1124
- class J extends _ {
1125
- constructor() {
1126
- super(...arguments), this.min = this.gte, this.max = this.lte;
1127
- }
1128
- _parse(e) {
1129
- if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1130
- const a = this._getOrReturnCtx(e);
1131
- return c(a, {
1132
- code: d.invalid_type,
1133
- expected: f.bigint,
1134
- received: a.parsedType
1135
- }), g;
1136
- }
1137
- let r;
1138
- const s = new P();
1139
- for (const a of this._def.checks)
1140
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), c(r, {
1141
- code: d.too_small,
1142
- type: "bigint",
1143
- minimum: a.value,
1144
- inclusive: a.inclusive,
1145
- message: a.message
1146
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), c(r, {
1147
- code: d.too_big,
1148
- type: "bigint",
1149
- maximum: a.value,
1150
- inclusive: a.inclusive,
1151
- message: a.message
1152
- }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), c(r, {
1153
- code: d.not_multiple_of,
1154
- multipleOf: a.value,
1155
- message: a.message
1156
- }), s.dirty()) : b.assertNever(a);
1157
- return { status: s.value, value: e.data };
1158
- }
1159
- gte(e, t) {
1160
- return this.setLimit("min", e, !0, p.toString(t));
1161
- }
1162
- gt(e, t) {
1163
- return this.setLimit("min", e, !1, p.toString(t));
1164
- }
1165
- lte(e, t) {
1166
- return this.setLimit("max", e, !0, p.toString(t));
1167
- }
1168
- lt(e, t) {
1169
- return this.setLimit("max", e, !1, p.toString(t));
1170
- }
1171
- setLimit(e, t, r, s) {
1172
- return new J({
1173
- ...this._def,
1174
- checks: [
1175
- ...this._def.checks,
1176
- {
1177
- kind: e,
1178
- value: t,
1179
- inclusive: r,
1180
- message: p.toString(s)
1181
- }
1182
- ]
1183
- });
1184
- }
1185
- _addCheck(e) {
1186
- return new J({
1187
- ...this._def,
1188
- checks: [...this._def.checks, e]
1189
- });
1190
- }
1191
- positive(e) {
1192
- return this._addCheck({
1193
- kind: "min",
1194
- value: BigInt(0),
1195
- inclusive: !1,
1196
- message: p.toString(e)
1197
- });
1198
- }
1199
- negative(e) {
1200
- return this._addCheck({
1201
- kind: "max",
1202
- value: BigInt(0),
1203
- inclusive: !1,
1204
- message: p.toString(e)
1205
- });
1206
- }
1207
- nonpositive(e) {
1208
- return this._addCheck({
1209
- kind: "max",
1210
- value: BigInt(0),
1211
- inclusive: !0,
1212
- message: p.toString(e)
1213
- });
1214
- }
1215
- nonnegative(e) {
1216
- return this._addCheck({
1217
- kind: "min",
1218
- value: BigInt(0),
1219
- inclusive: !0,
1220
- message: p.toString(e)
1221
- });
1222
- }
1223
- multipleOf(e, t) {
1224
- return this._addCheck({
1225
- kind: "multipleOf",
1226
- value: e,
1227
- message: p.toString(t)
1228
- });
1229
- }
1230
- get minValue() {
1231
- let e = null;
1232
- for (const t of this._def.checks)
1233
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1234
- return e;
1235
- }
1236
- get maxValue() {
1237
- let e = null;
1238
- for (const t of this._def.checks)
1239
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1240
- return e;
1241
- }
1242
- }
1243
- J.create = (n) => {
1244
- var e;
1245
- return new J({
1246
- checks: [],
1247
- typeName: h.ZodBigInt,
1248
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1249
- ...v(n)
1250
- });
1251
- };
1252
- class be extends _ {
1253
- _parse(e) {
1254
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1255
- const r = this._getOrReturnCtx(e);
1256
- return c(r, {
1257
- code: d.invalid_type,
1258
- expected: f.boolean,
1259
- received: r.parsedType
1260
- }), g;
1261
- }
1262
- return I(e.data);
1263
- }
1264
- }
1265
- be.create = (n) => new be({
1266
- typeName: h.ZodBoolean,
1267
- coerce: (n == null ? void 0 : n.coerce) || !1,
1268
- ...v(n)
1269
- });
1270
- class se extends _ {
1271
- _parse(e) {
1272
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1273
- const a = this._getOrReturnCtx(e);
1274
- return c(a, {
1275
- code: d.invalid_type,
1276
- expected: f.date,
1277
- received: a.parsedType
1278
- }), g;
1279
- }
1280
- if (isNaN(e.data.getTime())) {
1281
- const a = this._getOrReturnCtx(e);
1282
- return c(a, {
1283
- code: d.invalid_date
1284
- }), g;
1285
- }
1286
- const r = new P();
1287
- let s;
1288
- for (const a of this._def.checks)
1289
- a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), c(s, {
1290
- code: d.too_small,
1291
- message: a.message,
1292
- inclusive: !0,
1293
- exact: !1,
1294
- minimum: a.value,
1295
- type: "date"
1296
- }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), c(s, {
1297
- code: d.too_big,
1298
- message: a.message,
1299
- inclusive: !0,
1300
- exact: !1,
1301
- maximum: a.value,
1302
- type: "date"
1303
- }), r.dirty()) : b.assertNever(a);
1304
- return {
1305
- status: r.value,
1306
- value: new Date(e.data.getTime())
1307
- };
1308
- }
1309
- _addCheck(e) {
1310
- return new se({
1311
- ...this._def,
1312
- checks: [...this._def.checks, e]
1313
- });
1314
- }
1315
- min(e, t) {
1316
- return this._addCheck({
1317
- kind: "min",
1318
- value: e.getTime(),
1319
- message: p.toString(t)
1320
- });
1321
- }
1322
- max(e, t) {
1323
- return this._addCheck({
1324
- kind: "max",
1325
- value: e.getTime(),
1326
- message: p.toString(t)
1327
- });
1328
- }
1329
- get minDate() {
1330
- let e = null;
1331
- for (const t of this._def.checks)
1332
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1333
- return e != null ? new Date(e) : null;
1334
- }
1335
- get maxDate() {
1336
- let e = null;
1337
- for (const t of this._def.checks)
1338
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1339
- return e != null ? new Date(e) : null;
1340
- }
1341
- }
1342
- se.create = (n) => new se({
1343
- checks: [],
1344
- coerce: (n == null ? void 0 : n.coerce) || !1,
1345
- typeName: h.ZodDate,
1346
- ...v(n)
1347
- });
1348
- class Be extends _ {
1349
- _parse(e) {
1350
- if (this._getType(e) !== f.symbol) {
1351
- const r = this._getOrReturnCtx(e);
1352
- return c(r, {
1353
- code: d.invalid_type,
1354
- expected: f.symbol,
1355
- received: r.parsedType
1356
- }), g;
1357
- }
1358
- return I(e.data);
1359
- }
1360
- }
1361
- Be.create = (n) => new Be({
1362
- typeName: h.ZodSymbol,
1363
- ...v(n)
1364
- });
1365
- class xe extends _ {
1366
- _parse(e) {
1367
- if (this._getType(e) !== f.undefined) {
1368
- const r = this._getOrReturnCtx(e);
1369
- return c(r, {
1370
- code: d.invalid_type,
1371
- expected: f.undefined,
1372
- received: r.parsedType
1373
- }), g;
1374
- }
1375
- return I(e.data);
1376
- }
1377
- }
1378
- xe.create = (n) => new xe({
1379
- typeName: h.ZodUndefined,
1380
- ...v(n)
1381
- });
1382
- class ke extends _ {
1383
- _parse(e) {
1384
- if (this._getType(e) !== f.null) {
1385
- const r = this._getOrReturnCtx(e);
1386
- return c(r, {
1387
- code: d.invalid_type,
1388
- expected: f.null,
1389
- received: r.parsedType
1390
- }), g;
1391
- }
1392
- return I(e.data);
1393
- }
1394
- }
1395
- ke.create = (n) => new ke({
1396
- typeName: h.ZodNull,
1397
- ...v(n)
1398
- });
1399
- class ce extends _ {
1400
- constructor() {
1401
- super(...arguments), this._any = !0;
1402
- }
1403
- _parse(e) {
1404
- return I(e.data);
1405
- }
1406
- }
1407
- ce.create = (n) => new ce({
1408
- typeName: h.ZodAny,
1409
- ...v(n)
1410
- });
1411
- class re extends _ {
1412
- constructor() {
1413
- super(...arguments), this._unknown = !0;
1414
- }
1415
- _parse(e) {
1416
- return I(e.data);
1417
- }
1418
- }
1419
- re.create = (n) => new re({
1420
- typeName: h.ZodUnknown,
1421
- ...v(n)
1422
- });
1423
- class z extends _ {
1424
- _parse(e) {
1425
- const t = this._getOrReturnCtx(e);
1426
- return c(t, {
1427
- code: d.invalid_type,
1428
- expected: f.never,
1429
- received: t.parsedType
1430
- }), g;
1431
- }
1432
- }
1433
- z.create = (n) => new z({
1434
- typeName: h.ZodNever,
1435
- ...v(n)
1436
- });
1437
- class De extends _ {
1438
- _parse(e) {
1439
- if (this._getType(e) !== f.undefined) {
1440
- const r = this._getOrReturnCtx(e);
1441
- return c(r, {
1442
- code: d.invalid_type,
1443
- expected: f.void,
1444
- received: r.parsedType
1445
- }), g;
1446
- }
1447
- return I(e.data);
1448
- }
1449
- }
1450
- De.create = (n) => new De({
1451
- typeName: h.ZodVoid,
1452
- ...v(n)
1453
- });
1454
- class M extends _ {
1455
- _parse(e) {
1456
- const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1457
- if (t.parsedType !== f.array)
1458
- return c(t, {
1459
- code: d.invalid_type,
1460
- expected: f.array,
1461
- received: t.parsedType
1462
- }), g;
1463
- if (s.exactLength !== null) {
1464
- const o = t.data.length > s.exactLength.value, i = t.data.length < s.exactLength.value;
1465
- (o || i) && (c(t, {
1466
- code: o ? d.too_big : d.too_small,
1467
- minimum: i ? s.exactLength.value : void 0,
1468
- maximum: o ? s.exactLength.value : void 0,
1469
- type: "array",
1470
- inclusive: !0,
1471
- exact: !0,
1472
- message: s.exactLength.message
1473
- }), r.dirty());
1474
- }
1475
- if (s.minLength !== null && t.data.length < s.minLength.value && (c(t, {
1476
- code: d.too_small,
1477
- minimum: s.minLength.value,
1478
- type: "array",
1479
- inclusive: !0,
1480
- exact: !1,
1481
- message: s.minLength.message
1482
- }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (c(t, {
1483
- code: d.too_big,
1484
- maximum: s.maxLength.value,
1485
- type: "array",
1486
- inclusive: !0,
1487
- exact: !1,
1488
- message: s.maxLength.message
1489
- }), r.dirty()), t.common.async)
1490
- return Promise.all([...t.data].map((o, i) => s.type._parseAsync(new D(t, o, t.path, i)))).then((o) => P.mergeArray(r, o));
1491
- const a = [...t.data].map((o, i) => s.type._parseSync(new D(t, o, t.path, i)));
1492
- return P.mergeArray(r, a);
1493
- }
1494
- get element() {
1495
- return this._def.type;
1496
- }
1497
- min(e, t) {
1498
- return new M({
1499
- ...this._def,
1500
- minLength: { value: e, message: p.toString(t) }
1501
- });
1502
- }
1503
- max(e, t) {
1504
- return new M({
1505
- ...this._def,
1506
- maxLength: { value: e, message: p.toString(t) }
1507
- });
1508
- }
1509
- length(e, t) {
1510
- return new M({
1511
- ...this._def,
1512
- exactLength: { value: e, message: p.toString(t) }
1513
- });
1514
- }
1515
- nonempty(e) {
1516
- return this.min(1, e);
1517
- }
1518
- }
1519
- M.create = (n, e) => new M({
1520
- type: n,
1521
- minLength: null,
1522
- maxLength: null,
1523
- exactLength: null,
1524
- typeName: h.ZodArray,
1525
- ...v(e)
1526
- });
1527
- function oe(n) {
1528
- if (n instanceof w) {
1529
- const e = {};
1530
- for (const t in n.shape) {
1531
- const r = n.shape[t];
1532
- e[t] = B.create(oe(r));
1533
- }
1534
- return new w({
1535
- ...n._def,
1536
- shape: () => e
1537
- });
1538
- } else return n instanceof M ? new M({
1539
- ...n._def,
1540
- type: oe(n.element)
1541
- }) : n instanceof B ? B.create(oe(n.unwrap())) : n instanceof Q ? Q.create(oe(n.unwrap())) : n instanceof U ? U.create(n.items.map((e) => oe(e))) : n;
1542
- }
1543
- class w extends _ {
1544
- constructor() {
1545
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1546
- }
1547
- _getCached() {
1548
- if (this._cached !== null)
1549
- return this._cached;
1550
- const e = this._def.shape(), t = b.objectKeys(e);
1551
- return this._cached = { shape: e, keys: t };
1552
- }
1553
- _parse(e) {
1554
- if (this._getType(e) !== f.object) {
1555
- const l = this._getOrReturnCtx(e);
1556
- return c(l, {
1557
- code: d.invalid_type,
1558
- expected: f.object,
1559
- received: l.parsedType
1560
- }), g;
1561
- }
1562
- const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), i = [];
1563
- if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
1564
- for (const l in s.data)
1565
- o.includes(l) || i.push(l);
1566
- const u = [];
1567
- for (const l of o) {
1568
- const m = a[l], O = s.data[l];
1569
- u.push({
1570
- key: { status: "valid", value: l },
1571
- value: m._parse(new D(s, O, s.path, l)),
1572
- alwaysSet: l in s.data
1573
- });
1574
- }
1575
- if (this._def.catchall instanceof z) {
1576
- const l = this._def.unknownKeys;
1577
- if (l === "passthrough")
1578
- for (const m of i)
1579
- u.push({
1580
- key: { status: "valid", value: m },
1581
- value: { status: "valid", value: s.data[m] }
1582
- });
1583
- else if (l === "strict")
1584
- i.length > 0 && (c(s, {
1585
- code: d.unrecognized_keys,
1586
- keys: i
1587
- }), r.dirty());
1588
- else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1589
- } else {
1590
- const l = this._def.catchall;
1591
- for (const m of i) {
1592
- const O = s.data[m];
1593
- u.push({
1594
- key: { status: "valid", value: m },
1595
- value: l._parse(
1596
- new D(s, O, s.path, m)
1597
- //, ctx.child(key), value, getParsedType(value)
1598
- ),
1599
- alwaysSet: m in s.data
1600
- });
1601
- }
1602
- }
1603
- return s.common.async ? Promise.resolve().then(async () => {
1604
- const l = [];
1605
- for (const m of u) {
1606
- const O = await m.key, S = await m.value;
1607
- l.push({
1608
- key: O,
1609
- value: S,
1610
- alwaysSet: m.alwaysSet
1611
- });
1612
- }
1613
- return l;
1614
- }).then((l) => P.mergeObjectSync(r, l)) : P.mergeObjectSync(r, u);
1615
- }
1616
- get shape() {
1617
- return this._def.shape();
1618
- }
1619
- strict(e) {
1620
- return p.errToObj, new w({
1621
- ...this._def,
1622
- unknownKeys: "strict",
1623
- ...e !== void 0 ? {
1624
- errorMap: (t, r) => {
1625
- var s, a, o, i;
1626
- const u = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && o !== void 0 ? o : r.defaultError;
1627
- return t.code === "unrecognized_keys" ? {
1628
- message: (i = p.errToObj(e).message) !== null && i !== void 0 ? i : u
1629
- } : {
1630
- message: u
1631
- };
1632
- }
1633
- } : {}
1634
- });
1635
- }
1636
- strip() {
1637
- return new w({
1638
- ...this._def,
1639
- unknownKeys: "strip"
1640
- });
1641
- }
1642
- passthrough() {
1643
- return new w({
1644
- ...this._def,
1645
- unknownKeys: "passthrough"
1646
- });
1647
- }
1648
- // const AugmentFactory =
1649
- // <Def extends ZodObjectDef>(def: Def) =>
1650
- // <Augmentation extends ZodRawShape>(
1651
- // augmentation: Augmentation
1652
- // ): ZodObject<
1653
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1654
- // Def["unknownKeys"],
1655
- // Def["catchall"]
1656
- // > => {
1657
- // return new ZodObject({
1658
- // ...def,
1659
- // shape: () => ({
1660
- // ...def.shape(),
1661
- // ...augmentation,
1662
- // }),
1663
- // }) as any;
1664
- // };
1665
- extend(e) {
1666
- return new w({
1667
- ...this._def,
1668
- shape: () => ({
1669
- ...this._def.shape(),
1670
- ...e
1671
- })
1672
- });
1673
- }
1674
- /**
1675
- * Prior to zod@1.0.12 there was a bug in the
1676
- * inferred type of merged objects. Please
1677
- * upgrade if you are experiencing issues.
1678
- */
1679
- merge(e) {
1680
- return new w({
1681
- unknownKeys: e._def.unknownKeys,
1682
- catchall: e._def.catchall,
1683
- shape: () => ({
1684
- ...this._def.shape(),
1685
- ...e._def.shape()
1686
- }),
1687
- typeName: h.ZodObject
1688
- });
1689
- }
1690
- // merge<
1691
- // Incoming extends AnyZodObject,
1692
- // Augmentation extends Incoming["shape"],
1693
- // NewOutput extends {
1694
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1695
- // ? Augmentation[k]["_output"]
1696
- // : k extends keyof Output
1697
- // ? Output[k]
1698
- // : never;
1699
- // },
1700
- // NewInput extends {
1701
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1702
- // ? Augmentation[k]["_input"]
1703
- // : k extends keyof Input
1704
- // ? Input[k]
1705
- // : never;
1706
- // }
1707
- // >(
1708
- // merging: Incoming
1709
- // ): ZodObject<
1710
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1711
- // Incoming["_def"]["unknownKeys"],
1712
- // Incoming["_def"]["catchall"],
1713
- // NewOutput,
1714
- // NewInput
1715
- // > {
1716
- // const merged: any = new ZodObject({
1717
- // unknownKeys: merging._def.unknownKeys,
1718
- // catchall: merging._def.catchall,
1719
- // shape: () =>
1720
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1721
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1722
- // }) as any;
1723
- // return merged;
1724
- // }
1725
- setKey(e, t) {
1726
- return this.augment({ [e]: t });
1727
- }
1728
- // merge<Incoming extends AnyZodObject>(
1729
- // merging: Incoming
1730
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1731
- // ZodObject<
1732
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1733
- // Incoming["_def"]["unknownKeys"],
1734
- // Incoming["_def"]["catchall"]
1735
- // > {
1736
- // // const mergedShape = objectUtil.mergeShapes(
1737
- // // this._def.shape(),
1738
- // // merging._def.shape()
1739
- // // );
1740
- // const merged: any = new ZodObject({
1741
- // unknownKeys: merging._def.unknownKeys,
1742
- // catchall: merging._def.catchall,
1743
- // shape: () =>
1744
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1745
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1746
- // }) as any;
1747
- // return merged;
1748
- // }
1749
- catchall(e) {
1750
- return new w({
1751
- ...this._def,
1752
- catchall: e
1753
- });
1754
- }
1755
- pick(e) {
1756
- const t = {};
1757
- return b.objectKeys(e).forEach((r) => {
1758
- e[r] && this.shape[r] && (t[r] = this.shape[r]);
1759
- }), new w({
1760
- ...this._def,
1761
- shape: () => t
1762
- });
1763
- }
1764
- omit(e) {
1765
- const t = {};
1766
- return b.objectKeys(this.shape).forEach((r) => {
1767
- e[r] || (t[r] = this.shape[r]);
1768
- }), new w({
1769
- ...this._def,
1770
- shape: () => t
1771
- });
1772
- }
1773
- /**
1774
- * @deprecated
1775
- */
1776
- deepPartial() {
1777
- return oe(this);
1778
- }
1779
- partial(e) {
1780
- const t = {};
1781
- return b.objectKeys(this.shape).forEach((r) => {
1782
- const s = this.shape[r];
1783
- e && !e[r] ? t[r] = s : t[r] = s.optional();
1784
- }), new w({
1785
- ...this._def,
1786
- shape: () => t
1787
- });
1788
- }
1789
- required(e) {
1790
- const t = {};
1791
- return b.objectKeys(this.shape).forEach((r) => {
1792
- if (e && !e[r])
1793
- t[r] = this.shape[r];
1794
- else {
1795
- let a = this.shape[r];
1796
- for (; a instanceof B; )
1797
- a = a._def.innerType;
1798
- t[r] = a;
1799
- }
1800
- }), new w({
1801
- ...this._def,
1802
- shape: () => t
1803
- });
1804
- }
1805
- keyof() {
1806
- return ct(b.objectKeys(this.shape));
1807
- }
1808
- }
1809
- w.create = (n, e) => new w({
1810
- shape: () => n,
1811
- unknownKeys: "strip",
1812
- catchall: z.create(),
1813
- typeName: h.ZodObject,
1814
- ...v(e)
1815
- });
1816
- w.strictCreate = (n, e) => new w({
1817
- shape: () => n,
1818
- unknownKeys: "strict",
1819
- catchall: z.create(),
1820
- typeName: h.ZodObject,
1821
- ...v(e)
1822
- });
1823
- w.lazycreate = (n, e) => new w({
1824
- shape: n,
1825
- unknownKeys: "strip",
1826
- catchall: z.create(),
1827
- typeName: h.ZodObject,
1828
- ...v(e)
1829
- });
1830
- class we extends _ {
1831
- _parse(e) {
1832
- const { ctx: t } = this._processInputParams(e), r = this._def.options;
1833
- function s(a) {
1834
- for (const i of a)
1835
- if (i.result.status === "valid")
1836
- return i.result;
1837
- for (const i of a)
1838
- if (i.result.status === "dirty")
1839
- return t.common.issues.push(...i.ctx.common.issues), i.result;
1840
- const o = a.map((i) => new V(i.ctx.common.issues));
1841
- return c(t, {
1842
- code: d.invalid_union,
1843
- unionErrors: o
1844
- }), g;
1845
- }
1846
- if (t.common.async)
1847
- return Promise.all(r.map(async (a) => {
1848
- const o = {
1849
- ...t,
1850
- common: {
1851
- ...t.common,
1852
- issues: []
1853
- },
1854
- parent: null
1855
- };
1856
- return {
1857
- result: await a._parseAsync({
1858
- data: t.data,
1859
- path: t.path,
1860
- parent: o
1861
- }),
1862
- ctx: o
1863
- };
1864
- })).then(s);
1865
- {
1866
- let a;
1867
- const o = [];
1868
- for (const u of r) {
1869
- const l = {
1870
- ...t,
1871
- common: {
1872
- ...t.common,
1873
- issues: []
1874
- },
1875
- parent: null
1876
- }, m = u._parseSync({
1877
- data: t.data,
1878
- path: t.path,
1879
- parent: l
1880
- });
1881
- if (m.status === "valid")
1882
- return m;
1883
- m.status === "dirty" && !a && (a = { result: m, ctx: l }), l.common.issues.length && o.push(l.common.issues);
1884
- }
1885
- if (a)
1886
- return t.common.issues.push(...a.ctx.common.issues), a.result;
1887
- const i = o.map((u) => new V(u));
1888
- return c(t, {
1889
- code: d.invalid_union,
1890
- unionErrors: i
1891
- }), g;
1892
- }
1893
- }
1894
- get options() {
1895
- return this._def.options;
1896
- }
1897
- }
1898
- we.create = (n, e) => new we({
1899
- options: n,
1900
- typeName: h.ZodUnion,
1901
- ...v(e)
1902
- });
1903
- const F = (n) => n instanceof Ne ? F(n.schema) : n instanceof $ ? F(n.innerType()) : n instanceof Oe ? [n.value] : n instanceof X ? n.options : n instanceof Ce ? b.objectValues(n.enum) : n instanceof Ae ? F(n._def.innerType) : n instanceof xe ? [void 0] : n instanceof ke ? [null] : n instanceof B ? [void 0, ...F(n.unwrap())] : n instanceof Q ? [null, ...F(n.unwrap())] : n instanceof et || n instanceof Ze ? F(n.unwrap()) : n instanceof Ee ? F(n._def.innerType) : [];
1904
- class Fe extends _ {
1905
- _parse(e) {
1906
- const { ctx: t } = this._processInputParams(e);
1907
- if (t.parsedType !== f.object)
1908
- return c(t, {
1909
- code: d.invalid_type,
1910
- expected: f.object,
1911
- received: t.parsedType
1912
- }), g;
1913
- const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
1914
- return a ? t.common.async ? a._parseAsync({
1915
- data: t.data,
1916
- path: t.path,
1917
- parent: t
1918
- }) : a._parseSync({
1919
- data: t.data,
1920
- path: t.path,
1921
- parent: t
1922
- }) : (c(t, {
1923
- code: d.invalid_union_discriminator,
1924
- options: Array.from(this.optionsMap.keys()),
1925
- path: [r]
1926
- }), g);
1927
- }
1928
- get discriminator() {
1929
- return this._def.discriminator;
1930
- }
1931
- get options() {
1932
- return this._def.options;
1933
- }
1934
- get optionsMap() {
1935
- return this._def.optionsMap;
1936
- }
1937
- /**
1938
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1939
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1940
- * have a different value for each object in the union.
1941
- * @param discriminator the name of the discriminator property
1942
- * @param types an array of object schemas
1943
- * @param params
1944
- */
1945
- static create(e, t, r) {
1946
- const s = /* @__PURE__ */ new Map();
1947
- for (const a of t) {
1948
- const o = F(a.shape[e]);
1949
- if (!o.length)
1950
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1951
- for (const i of o) {
1952
- if (s.has(i))
1953
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);
1954
- s.set(i, a);
1955
- }
1956
- }
1957
- return new Fe({
1958
- typeName: h.ZodDiscriminatedUnion,
1959
- discriminator: e,
1960
- options: t,
1961
- optionsMap: s,
1962
- ...v(r)
1963
- });
1964
- }
1965
- }
1966
- function Xe(n, e) {
1967
- const t = G(n), r = G(e);
1968
- if (n === e)
1969
- return { valid: !0, data: n };
1970
- if (t === f.object && r === f.object) {
1971
- const s = b.objectKeys(e), a = b.objectKeys(n).filter((i) => s.indexOf(i) !== -1), o = { ...n, ...e };
1972
- for (const i of a) {
1973
- const u = Xe(n[i], e[i]);
1974
- if (!u.valid)
1975
- return { valid: !1 };
1976
- o[i] = u.data;
1977
- }
1978
- return { valid: !0, data: o };
1979
- } else if (t === f.array && r === f.array) {
1980
- if (n.length !== e.length)
1981
- return { valid: !1 };
1982
- const s = [];
1983
- for (let a = 0; a < n.length; a++) {
1984
- const o = n[a], i = e[a], u = Xe(o, i);
1985
- if (!u.valid)
1986
- return { valid: !1 };
1987
- s.push(u.data);
1988
- }
1989
- return { valid: !0, data: s };
1990
- } else return t === f.date && r === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
1991
- }
1992
- class Te extends _ {
1993
- _parse(e) {
1994
- const { status: t, ctx: r } = this._processInputParams(e), s = (a, o) => {
1995
- if (Ke(a) || Ke(o))
1996
- return g;
1997
- const i = Xe(a.value, o.value);
1998
- return i.valid ? ((Je(a) || Je(o)) && t.dirty(), { status: t.value, value: i.data }) : (c(r, {
1999
- code: d.invalid_intersection_types
2000
- }), g);
2001
- };
2002
- return r.common.async ? Promise.all([
2003
- this._def.left._parseAsync({
2004
- data: r.data,
2005
- path: r.path,
2006
- parent: r
2007
- }),
2008
- this._def.right._parseAsync({
2009
- data: r.data,
2010
- path: r.path,
2011
- parent: r
2012
- })
2013
- ]).then(([a, o]) => s(a, o)) : s(this._def.left._parseSync({
2014
- data: r.data,
2015
- path: r.path,
2016
- parent: r
2017
- }), this._def.right._parseSync({
2018
- data: r.data,
2019
- path: r.path,
2020
- parent: r
2021
- }));
2022
- }
2023
- }
2024
- Te.create = (n, e, t) => new Te({
2025
- left: n,
2026
- right: e,
2027
- typeName: h.ZodIntersection,
2028
- ...v(t)
2029
- });
2030
- class U extends _ {
2031
- _parse(e) {
2032
- const { status: t, ctx: r } = this._processInputParams(e);
2033
- if (r.parsedType !== f.array)
2034
- return c(r, {
2035
- code: d.invalid_type,
2036
- expected: f.array,
2037
- received: r.parsedType
2038
- }), g;
2039
- if (r.data.length < this._def.items.length)
2040
- return c(r, {
2041
- code: d.too_small,
2042
- minimum: this._def.items.length,
2043
- inclusive: !0,
2044
- exact: !1,
2045
- type: "array"
2046
- }), g;
2047
- !this._def.rest && r.data.length > this._def.items.length && (c(r, {
2048
- code: d.too_big,
2049
- maximum: this._def.items.length,
2050
- inclusive: !0,
2051
- exact: !1,
2052
- type: "array"
2053
- }), t.dirty());
2054
- const a = [...r.data].map((o, i) => {
2055
- const u = this._def.items[i] || this._def.rest;
2056
- return u ? u._parse(new D(r, o, r.path, i)) : null;
2057
- }).filter((o) => !!o);
2058
- return r.common.async ? Promise.all(a).then((o) => P.mergeArray(t, o)) : P.mergeArray(t, a);
2059
- }
2060
- get items() {
2061
- return this._def.items;
2062
- }
2063
- rest(e) {
2064
- return new U({
2065
- ...this._def,
2066
- rest: e
2067
- });
2068
- }
2069
- }
2070
- U.create = (n, e) => {
2071
- if (!Array.isArray(n))
2072
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2073
- return new U({
2074
- items: n,
2075
- typeName: h.ZodTuple,
2076
- rest: null,
2077
- ...v(e)
2078
- });
2079
- };
2080
- class Se extends _ {
2081
- get keySchema() {
2082
- return this._def.keyType;
2083
- }
2084
- get valueSchema() {
2085
- return this._def.valueType;
2086
- }
2087
- _parse(e) {
2088
- const { status: t, ctx: r } = this._processInputParams(e);
2089
- if (r.parsedType !== f.object)
2090
- return c(r, {
2091
- code: d.invalid_type,
2092
- expected: f.object,
2093
- received: r.parsedType
2094
- }), g;
2095
- const s = [], a = this._def.keyType, o = this._def.valueType;
2096
- for (const i in r.data)
2097
- s.push({
2098
- key: a._parse(new D(r, i, r.path, i)),
2099
- value: o._parse(new D(r, r.data[i], r.path, i)),
2100
- alwaysSet: i in r.data
2101
- });
2102
- return r.common.async ? P.mergeObjectAsync(t, s) : P.mergeObjectSync(t, s);
2103
- }
2104
- get element() {
2105
- return this._def.valueType;
2106
- }
2107
- static create(e, t, r) {
2108
- return t instanceof _ ? new Se({
2109
- keyType: e,
2110
- valueType: t,
2111
- typeName: h.ZodRecord,
2112
- ...v(r)
2113
- }) : new Se({
2114
- keyType: j.create(),
2115
- valueType: e,
2116
- typeName: h.ZodRecord,
2117
- ...v(t)
2118
- });
2119
- }
2120
- }
2121
- class Ue extends _ {
2122
- get keySchema() {
2123
- return this._def.keyType;
2124
- }
2125
- get valueSchema() {
2126
- return this._def.valueType;
2127
- }
2128
- _parse(e) {
2129
- const { status: t, ctx: r } = this._processInputParams(e);
2130
- if (r.parsedType !== f.map)
2131
- return c(r, {
2132
- code: d.invalid_type,
2133
- expected: f.map,
2134
- received: r.parsedType
2135
- }), g;
2136
- const s = this._def.keyType, a = this._def.valueType, o = [...r.data.entries()].map(([i, u], l) => ({
2137
- key: s._parse(new D(r, i, r.path, [l, "key"])),
2138
- value: a._parse(new D(r, u, r.path, [l, "value"]))
2139
- }));
2140
- if (r.common.async) {
2141
- const i = /* @__PURE__ */ new Map();
2142
- return Promise.resolve().then(async () => {
2143
- for (const u of o) {
2144
- const l = await u.key, m = await u.value;
2145
- if (l.status === "aborted" || m.status === "aborted")
2146
- return g;
2147
- (l.status === "dirty" || m.status === "dirty") && t.dirty(), i.set(l.value, m.value);
2148
- }
2149
- return { status: t.value, value: i };
2150
- });
2151
- } else {
2152
- const i = /* @__PURE__ */ new Map();
2153
- for (const u of o) {
2154
- const l = u.key, m = u.value;
2155
- if (l.status === "aborted" || m.status === "aborted")
2156
- return g;
2157
- (l.status === "dirty" || m.status === "dirty") && t.dirty(), i.set(l.value, m.value);
2158
- }
2159
- return { status: t.value, value: i };
2160
- }
2161
- }
2162
- }
2163
- Ue.create = (n, e, t) => new Ue({
2164
- valueType: e,
2165
- keyType: n,
2166
- typeName: h.ZodMap,
2167
- ...v(t)
2168
- });
2169
- class ae extends _ {
2170
- _parse(e) {
2171
- const { status: t, ctx: r } = this._processInputParams(e);
2172
- if (r.parsedType !== f.set)
2173
- return c(r, {
2174
- code: d.invalid_type,
2175
- expected: f.set,
2176
- received: r.parsedType
2177
- }), g;
2178
- const s = this._def;
2179
- s.minSize !== null && r.data.size < s.minSize.value && (c(r, {
2180
- code: d.too_small,
2181
- minimum: s.minSize.value,
2182
- type: "set",
2183
- inclusive: !0,
2184
- exact: !1,
2185
- message: s.minSize.message
2186
- }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (c(r, {
2187
- code: d.too_big,
2188
- maximum: s.maxSize.value,
2189
- type: "set",
2190
- inclusive: !0,
2191
- exact: !1,
2192
- message: s.maxSize.message
2193
- }), t.dirty());
2194
- const a = this._def.valueType;
2195
- function o(u) {
2196
- const l = /* @__PURE__ */ new Set();
2197
- for (const m of u) {
2198
- if (m.status === "aborted")
2199
- return g;
2200
- m.status === "dirty" && t.dirty(), l.add(m.value);
2201
- }
2202
- return { status: t.value, value: l };
2203
- }
2204
- const i = [...r.data.values()].map((u, l) => a._parse(new D(r, u, r.path, l)));
2205
- return r.common.async ? Promise.all(i).then((u) => o(u)) : o(i);
2206
- }
2207
- min(e, t) {
2208
- return new ae({
2209
- ...this._def,
2210
- minSize: { value: e, message: p.toString(t) }
2211
- });
2212
- }
2213
- max(e, t) {
2214
- return new ae({
2215
- ...this._def,
2216
- maxSize: { value: e, message: p.toString(t) }
2217
- });
2218
- }
2219
- size(e, t) {
2220
- return this.min(e, t).max(e, t);
2221
- }
2222
- nonempty(e) {
2223
- return this.min(1, e);
2224
- }
2225
- }
2226
- ae.create = (n, e) => new ae({
2227
- valueType: n,
2228
- minSize: null,
2229
- maxSize: null,
2230
- typeName: h.ZodSet,
2231
- ...v(e)
2232
- });
2233
- class ue extends _ {
2234
- constructor() {
2235
- super(...arguments), this.validate = this.implement;
2236
- }
2237
- _parse(e) {
2238
- const { ctx: t } = this._processInputParams(e);
2239
- if (t.parsedType !== f.function)
2240
- return c(t, {
2241
- code: d.invalid_type,
2242
- expected: f.function,
2243
- received: t.parsedType
2244
- }), g;
2245
- function r(i, u) {
2246
- return Me({
2247
- data: i,
2248
- path: t.path,
2249
- errorMaps: [
2250
- t.common.contextualErrorMap,
2251
- t.schemaErrorMap,
2252
- je(),
2253
- le
2254
- ].filter((l) => !!l),
2255
- issueData: {
2256
- code: d.invalid_arguments,
2257
- argumentsError: u
2258
- }
2259
- });
2260
- }
2261
- function s(i, u) {
2262
- return Me({
2263
- data: i,
2264
- path: t.path,
2265
- errorMaps: [
2266
- t.common.contextualErrorMap,
2267
- t.schemaErrorMap,
2268
- je(),
2269
- le
2270
- ].filter((l) => !!l),
2271
- issueData: {
2272
- code: d.invalid_return_type,
2273
- returnTypeError: u
2274
- }
2275
- });
2276
- }
2277
- const a = { errorMap: t.common.contextualErrorMap }, o = t.data;
2278
- if (this._def.returns instanceof fe) {
2279
- const i = this;
2280
- return I(async function(...u) {
2281
- const l = new V([]), m = await i._def.args.parseAsync(u, a).catch((N) => {
2282
- throw l.addIssue(r(u, N)), l;
2283
- }), O = await Reflect.apply(o, this, m);
2284
- return await i._def.returns._def.type.parseAsync(O, a).catch((N) => {
2285
- throw l.addIssue(s(O, N)), l;
2286
- });
2287
- });
2288
- } else {
2289
- const i = this;
2290
- return I(function(...u) {
2291
- const l = i._def.args.safeParse(u, a);
2292
- if (!l.success)
2293
- throw new V([r(u, l.error)]);
2294
- const m = Reflect.apply(o, this, l.data), O = i._def.returns.safeParse(m, a);
2295
- if (!O.success)
2296
- throw new V([s(m, O.error)]);
2297
- return O.data;
2298
- });
2299
- }
2300
- }
2301
- parameters() {
2302
- return this._def.args;
2303
- }
2304
- returnType() {
2305
- return this._def.returns;
2306
- }
2307
- args(...e) {
2308
- return new ue({
2309
- ...this._def,
2310
- args: U.create(e).rest(re.create())
2311
- });
2312
- }
2313
- returns(e) {
2314
- return new ue({
2315
- ...this._def,
2316
- returns: e
2317
- });
2318
- }
2319
- implement(e) {
2320
- return this.parse(e);
2321
- }
2322
- strictImplement(e) {
2323
- return this.parse(e);
2324
- }
2325
- static create(e, t, r) {
2326
- return new ue({
2327
- args: e || U.create([]).rest(re.create()),
2328
- returns: t || re.create(),
2329
- typeName: h.ZodFunction,
2330
- ...v(r)
2331
- });
2332
- }
2333
- }
2334
- class Ne extends _ {
2335
- get schema() {
2336
- return this._def.getter();
2337
- }
2338
- _parse(e) {
2339
- const { ctx: t } = this._processInputParams(e);
2340
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2341
- }
2342
- }
2343
- Ne.create = (n, e) => new Ne({
2344
- getter: n,
2345
- typeName: h.ZodLazy,
2346
- ...v(e)
2347
- });
2348
- class Oe extends _ {
2349
- _parse(e) {
2350
- if (e.data !== this._def.value) {
2351
- const t = this._getOrReturnCtx(e);
2352
- return c(t, {
2353
- received: t.data,
2354
- code: d.invalid_literal,
2355
- expected: this._def.value
2356
- }), g;
2357
- }
2358
- return { status: "valid", value: e.data };
2359
- }
2360
- get value() {
2361
- return this._def.value;
2362
- }
2363
- }
2364
- Oe.create = (n, e) => new Oe({
2365
- value: n,
2366
- typeName: h.ZodLiteral,
2367
- ...v(e)
2368
- });
2369
- function ct(n, e) {
2370
- return new X({
2371
- values: n,
2372
- typeName: h.ZodEnum,
2373
- ...v(e)
2374
- });
2375
- }
2376
- class X extends _ {
2377
- constructor() {
2378
- super(...arguments), he.set(this, void 0);
2379
- }
2380
- _parse(e) {
2381
- if (typeof e.data != "string") {
2382
- const t = this._getOrReturnCtx(e), r = this._def.values;
2383
- return c(t, {
2384
- expected: b.joinValues(r),
2385
- received: t.parsedType,
2386
- code: d.invalid_type
2387
- }), g;
2388
- }
2389
- if ($e(this, he) || ot(this, he, new Set(this._def.values)), !$e(this, he).has(e.data)) {
2390
- const t = this._getOrReturnCtx(e), r = this._def.values;
2391
- return c(t, {
2392
- received: t.data,
2393
- code: d.invalid_enum_value,
2394
- options: r
2395
- }), g;
2396
- }
2397
- return I(e.data);
2398
- }
2399
- get options() {
2400
- return this._def.values;
2401
- }
2402
- get enum() {
2403
- const e = {};
2404
- for (const t of this._def.values)
2405
- e[t] = t;
2406
- return e;
2407
- }
2408
- get Values() {
2409
- const e = {};
2410
- for (const t of this._def.values)
2411
- e[t] = t;
2412
- return e;
2413
- }
2414
- get Enum() {
2415
- const e = {};
2416
- for (const t of this._def.values)
2417
- e[t] = t;
2418
- return e;
2419
- }
2420
- extract(e, t = this._def) {
2421
- return X.create(e, {
2422
- ...this._def,
2423
- ...t
2424
- });
2425
- }
2426
- exclude(e, t = this._def) {
2427
- return X.create(this.options.filter((r) => !e.includes(r)), {
2428
- ...this._def,
2429
- ...t
2430
- });
2431
- }
2432
- }
2433
- he = /* @__PURE__ */ new WeakMap();
2434
- X.create = ct;
2435
- class Ce extends _ {
2436
- constructor() {
2437
- super(...arguments), ye.set(this, void 0);
2438
- }
2439
- _parse(e) {
2440
- const t = b.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2441
- if (r.parsedType !== f.string && r.parsedType !== f.number) {
2442
- const s = b.objectValues(t);
2443
- return c(r, {
2444
- expected: b.joinValues(s),
2445
- received: r.parsedType,
2446
- code: d.invalid_type
2447
- }), g;
2448
- }
2449
- if ($e(this, ye) || ot(this, ye, new Set(b.getValidEnumValues(this._def.values))), !$e(this, ye).has(e.data)) {
2450
- const s = b.objectValues(t);
2451
- return c(r, {
2452
- received: r.data,
2453
- code: d.invalid_enum_value,
2454
- options: s
2455
- }), g;
2456
- }
2457
- return I(e.data);
2458
- }
2459
- get enum() {
2460
- return this._def.values;
2461
- }
2462
- }
2463
- ye = /* @__PURE__ */ new WeakMap();
2464
- Ce.create = (n, e) => new Ce({
2465
- values: n,
2466
- typeName: h.ZodNativeEnum,
2467
- ...v(e)
2468
- });
2469
- class fe extends _ {
2470
- unwrap() {
2471
- return this._def.type;
2472
- }
2473
- _parse(e) {
2474
- const { ctx: t } = this._processInputParams(e);
2475
- if (t.parsedType !== f.promise && t.common.async === !1)
2476
- return c(t, {
2477
- code: d.invalid_type,
2478
- expected: f.promise,
2479
- received: t.parsedType
2480
- }), g;
2481
- const r = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2482
- return I(r.then((s) => this._def.type.parseAsync(s, {
2483
- path: t.path,
2484
- errorMap: t.common.contextualErrorMap
2485
- })));
2486
- }
2487
- }
2488
- fe.create = (n, e) => new fe({
2489
- type: n,
2490
- typeName: h.ZodPromise,
2491
- ...v(e)
2492
- });
2493
- class $ extends _ {
2494
- innerType() {
2495
- return this._def.schema;
2496
- }
2497
- sourceType() {
2498
- return this._def.schema._def.typeName === h.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2499
- }
2500
- _parse(e) {
2501
- const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
2502
- addIssue: (o) => {
2503
- c(r, o), o.fatal ? t.abort() : t.dirty();
2504
- },
2505
- get path() {
2506
- return r.path;
2507
- }
2508
- };
2509
- if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2510
- const o = s.transform(r.data, a);
2511
- if (r.common.async)
2512
- return Promise.resolve(o).then(async (i) => {
2513
- if (t.value === "aborted")
2514
- return g;
2515
- const u = await this._def.schema._parseAsync({
2516
- data: i,
2517
- path: r.path,
2518
- parent: r
2519
- });
2520
- return u.status === "aborted" ? g : u.status === "dirty" || t.value === "dirty" ? de(u.value) : u;
2521
- });
2522
- {
2523
- if (t.value === "aborted")
2524
- return g;
2525
- const i = this._def.schema._parseSync({
2526
- data: o,
2527
- path: r.path,
2528
- parent: r
2529
- });
2530
- return i.status === "aborted" ? g : i.status === "dirty" || t.value === "dirty" ? de(i.value) : i;
2531
- }
2532
- }
2533
- if (s.type === "refinement") {
2534
- const o = (i) => {
2535
- const u = s.refinement(i, a);
2536
- if (r.common.async)
2537
- return Promise.resolve(u);
2538
- if (u instanceof Promise)
2539
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2540
- return i;
2541
- };
2542
- if (r.common.async === !1) {
2543
- const i = this._def.schema._parseSync({
2544
- data: r.data,
2545
- path: r.path,
2546
- parent: r
2547
- });
2548
- return i.status === "aborted" ? g : (i.status === "dirty" && t.dirty(), o(i.value), { status: t.value, value: i.value });
2549
- } else
2550
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => i.status === "aborted" ? g : (i.status === "dirty" && t.dirty(), o(i.value).then(() => ({ status: t.value, value: i.value }))));
2551
- }
2552
- if (s.type === "transform")
2553
- if (r.common.async === !1) {
2554
- const o = this._def.schema._parseSync({
2555
- data: r.data,
2556
- path: r.path,
2557
- parent: r
2558
- });
2559
- if (!ve(o))
2560
- return o;
2561
- const i = s.transform(o.value, a);
2562
- if (i instanceof Promise)
2563
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2564
- return { status: t.value, value: i };
2565
- } else
2566
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => ve(o) ? Promise.resolve(s.transform(o.value, a)).then((i) => ({ status: t.value, value: i })) : o);
2567
- b.assertNever(s);
2568
- }
2569
- }
2570
- $.create = (n, e, t) => new $({
2571
- schema: n,
2572
- typeName: h.ZodEffects,
2573
- effect: e,
2574
- ...v(t)
2575
- });
2576
- $.createWithPreprocess = (n, e, t) => new $({
2577
- schema: e,
2578
- effect: { type: "preprocess", transform: n },
2579
- typeName: h.ZodEffects,
2580
- ...v(t)
2581
- });
2582
- class B extends _ {
2583
- _parse(e) {
2584
- return this._getType(e) === f.undefined ? I(void 0) : this._def.innerType._parse(e);
2585
- }
2586
- unwrap() {
2587
- return this._def.innerType;
2588
- }
2589
- }
2590
- B.create = (n, e) => new B({
2591
- innerType: n,
2592
- typeName: h.ZodOptional,
2593
- ...v(e)
2594
- });
2595
- class Q extends _ {
2596
- _parse(e) {
2597
- return this._getType(e) === f.null ? I(null) : this._def.innerType._parse(e);
2598
- }
2599
- unwrap() {
2600
- return this._def.innerType;
2601
- }
2602
- }
2603
- Q.create = (n, e) => new Q({
2604
- innerType: n,
2605
- typeName: h.ZodNullable,
2606
- ...v(e)
2607
- });
2608
- class Ae extends _ {
2609
- _parse(e) {
2610
- const { ctx: t } = this._processInputParams(e);
2611
- let r = t.data;
2612
- return t.parsedType === f.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2613
- data: r,
2614
- path: t.path,
2615
- parent: t
2616
- });
2617
- }
2618
- removeDefault() {
2619
- return this._def.innerType;
2620
- }
2621
- }
2622
- Ae.create = (n, e) => new Ae({
2623
- innerType: n,
2624
- typeName: h.ZodDefault,
2625
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2626
- ...v(e)
2627
- });
2628
- class Ee extends _ {
2629
- _parse(e) {
2630
- const { ctx: t } = this._processInputParams(e), r = {
2631
- ...t,
2632
- common: {
2633
- ...t.common,
2634
- issues: []
2635
- }
2636
- }, s = this._def.innerType._parse({
2637
- data: r.data,
2638
- path: r.path,
2639
- parent: {
2640
- ...r
2641
- }
2642
- });
2643
- return _e(s) ? s.then((a) => ({
2644
- status: "valid",
2645
- value: a.status === "valid" ? a.value : this._def.catchValue({
2646
- get error() {
2647
- return new V(r.common.issues);
2648
- },
2649
- input: r.data
2650
- })
2651
- })) : {
2652
- status: "valid",
2653
- value: s.status === "valid" ? s.value : this._def.catchValue({
2654
- get error() {
2655
- return new V(r.common.issues);
2656
- },
2657
- input: r.data
2658
- })
2659
- };
2660
- }
2661
- removeCatch() {
2662
- return this._def.innerType;
2663
- }
2664
- }
2665
- Ee.create = (n, e) => new Ee({
2666
- innerType: n,
2667
- typeName: h.ZodCatch,
2668
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2669
- ...v(e)
2670
- });
2671
- class Le extends _ {
2672
- _parse(e) {
2673
- if (this._getType(e) !== f.nan) {
2674
- const r = this._getOrReturnCtx(e);
2675
- return c(r, {
2676
- code: d.invalid_type,
2677
- expected: f.nan,
2678
- received: r.parsedType
2679
- }), g;
2680
- }
2681
- return { status: "valid", value: e.data };
2682
- }
2683
- }
2684
- Le.create = (n) => new Le({
2685
- typeName: h.ZodNaN,
2686
- ...v(n)
2687
- });
2688
- const Ht = Symbol("zod_brand");
2689
- class et extends _ {
2690
- _parse(e) {
2691
- const { ctx: t } = this._processInputParams(e), r = t.data;
2692
- return this._def.type._parse({
2693
- data: r,
2694
- path: t.path,
2695
- parent: t
2696
- });
2697
- }
2698
- unwrap() {
2699
- return this._def.type;
2700
- }
2701
- }
2702
- class Pe extends _ {
2703
- _parse(e) {
2704
- const { status: t, ctx: r } = this._processInputParams(e);
2705
- if (r.common.async)
2706
- return (async () => {
2707
- const a = await this._def.in._parseAsync({
2708
- data: r.data,
2709
- path: r.path,
2710
- parent: r
2711
- });
2712
- return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), de(a.value)) : this._def.out._parseAsync({
2713
- data: a.value,
2714
- path: r.path,
2715
- parent: r
2716
- });
2717
- })();
2718
- {
2719
- const s = this._def.in._parseSync({
2720
- data: r.data,
2721
- path: r.path,
2722
- parent: r
2723
- });
2724
- return s.status === "aborted" ? g : s.status === "dirty" ? (t.dirty(), {
2725
- status: "dirty",
2726
- value: s.value
2727
- }) : this._def.out._parseSync({
2728
- data: s.value,
2729
- path: r.path,
2730
- parent: r
2731
- });
2732
- }
2733
- }
2734
- static create(e, t) {
2735
- return new Pe({
2736
- in: e,
2737
- out: t,
2738
- typeName: h.ZodPipeline
2739
- });
2740
- }
2741
- }
2742
- class Ze extends _ {
2743
- _parse(e) {
2744
- const t = this._def.innerType._parse(e), r = (s) => (ve(s) && (s.value = Object.freeze(s.value)), s);
2745
- return _e(t) ? t.then((s) => r(s)) : r(t);
2746
- }
2747
- unwrap() {
2748
- return this._def.innerType;
2749
- }
2750
- }
2751
- Ze.create = (n, e) => new Ze({
2752
- innerType: n,
2753
- typeName: h.ZodReadonly,
2754
- ...v(e)
2755
- });
2756
- function ft(n, e = {}, t) {
2757
- return n ? ce.create().superRefine((r, s) => {
2758
- var a, o;
2759
- if (!n(r)) {
2760
- const i = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e, u = (o = (a = i.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0, l = typeof i == "string" ? { message: i } : i;
2761
- s.addIssue({ code: "custom", ...l, fatal: u });
2762
- }
2763
- }) : ce.create();
2764
- }
2765
- const Kt = {
2766
- object: w.lazycreate
2767
- };
2768
- var h;
2769
- (function(n) {
2770
- n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2771
- })(h || (h = {}));
2772
- const Jt = (n, e = {
2773
- message: `Input not instance of ${n.name}`
2774
- }) => ft((t) => t instanceof n, e), mt = j.create, pt = K.create, Xt = Le.create, Qt = J.create, ht = be.create, en = se.create, tn = Be.create, nn = xe.create, rn = ke.create, sn = ce.create, an = re.create, on = z.create, dn = De.create, un = M.create, ln = w.create, cn = w.strictCreate, fn = we.create, mn = Fe.create, pn = Te.create, hn = U.create, yn = Se.create, gn = Ue.create, vn = ae.create, _n = ue.create, bn = Ne.create, xn = Oe.create, kn = X.create, wn = Ce.create, Tn = fe.create, at = $.create, Sn = B.create, Nn = Q.create, On = $.createWithPreprocess, Cn = Pe.create, An = () => mt().optional(), En = () => pt().optional(), Zn = () => ht().optional(), Pn = {
2775
- string: (n) => j.create({ ...n, coerce: !0 }),
2776
- number: (n) => K.create({ ...n, coerce: !0 }),
2777
- boolean: (n) => be.create({
2778
- ...n,
2779
- coerce: !0
2780
- }),
2781
- bigint: (n) => J.create({ ...n, coerce: !0 }),
2782
- date: (n) => se.create({ ...n, coerce: !0 })
2783
- }, Rn = g;
2784
- var te = /* @__PURE__ */ Object.freeze({
2785
- __proto__: null,
2786
- defaultErrorMap: le,
2787
- setErrorMap: Pt,
2788
- getErrorMap: je,
2789
- makeIssue: Me,
2790
- EMPTY_PATH: Rt,
2791
- addIssueToContext: c,
2792
- ParseStatus: P,
2793
- INVALID: g,
2794
- DIRTY: de,
2795
- OK: I,
2796
- isAborted: Ke,
2797
- isDirty: Je,
2798
- isValid: ve,
2799
- isAsync: _e,
2800
- get util() {
2801
- return b;
2802
- },
2803
- get objectUtil() {
2804
- return He;
2805
- },
2806
- ZodParsedType: f,
2807
- getParsedType: G,
2808
- ZodType: _,
2809
- datetimeRegex: lt,
2810
- ZodString: j,
2811
- ZodNumber: K,
2812
- ZodBigInt: J,
2813
- ZodBoolean: be,
2814
- ZodDate: se,
2815
- ZodSymbol: Be,
2816
- ZodUndefined: xe,
2817
- ZodNull: ke,
2818
- ZodAny: ce,
2819
- ZodUnknown: re,
2820
- ZodNever: z,
2821
- ZodVoid: De,
2822
- ZodArray: M,
2823
- ZodObject: w,
2824
- ZodUnion: we,
2825
- ZodDiscriminatedUnion: Fe,
2826
- ZodIntersection: Te,
2827
- ZodTuple: U,
2828
- ZodRecord: Se,
2829
- ZodMap: Ue,
2830
- ZodSet: ae,
2831
- ZodFunction: ue,
2832
- ZodLazy: Ne,
2833
- ZodLiteral: Oe,
2834
- ZodEnum: X,
2835
- ZodNativeEnum: Ce,
2836
- ZodPromise: fe,
2837
- ZodEffects: $,
2838
- ZodTransformer: $,
2839
- ZodOptional: B,
2840
- ZodNullable: Q,
2841
- ZodDefault: Ae,
2842
- ZodCatch: Ee,
2843
- ZodNaN: Le,
2844
- BRAND: Ht,
2845
- ZodBranded: et,
2846
- ZodPipeline: Pe,
2847
- ZodReadonly: Ze,
2848
- custom: ft,
2849
- Schema: _,
2850
- ZodSchema: _,
2851
- late: Kt,
2852
- get ZodFirstPartyTypeKind() {
2853
- return h;
2854
- },
2855
- coerce: Pn,
2856
- any: sn,
2857
- array: un,
2858
- bigint: Qt,
2859
- boolean: ht,
2860
- date: en,
2861
- discriminatedUnion: mn,
2862
- effect: at,
2863
- enum: kn,
2864
- function: _n,
2865
- instanceof: Jt,
2866
- intersection: pn,
2867
- lazy: bn,
2868
- literal: xn,
2869
- map: gn,
2870
- nan: Xt,
2871
- nativeEnum: wn,
2872
- never: on,
2873
- null: rn,
2874
- nullable: Nn,
2875
- number: pt,
2876
- object: ln,
2877
- oboolean: Zn,
2878
- onumber: En,
2879
- optional: Sn,
2880
- ostring: An,
2881
- pipeline: Cn,
2882
- preprocess: On,
2883
- promise: Tn,
2884
- record: yn,
2885
- set: vn,
2886
- strictObject: cn,
2887
- string: mt,
2888
- symbol: tn,
2889
- transformer: at,
2890
- tuple: hn,
2891
- undefined: nn,
2892
- union: fn,
2893
- unknown: an,
2894
- void: dn,
2895
- NEVER: Rn,
2896
- ZodIssueCode: d,
2897
- quotelessJson: Zt,
2898
- ZodError: V
2899
- });
2900
- function ne(...n) {
2901
- return n.map((e) => function(t) {
2902
- const { success: r, error: s } = e.safeParse(t);
2903
- return r ? !0 : s.flatten().formErrors[0];
2904
- });
2905
- }
2906
- const In = ["src"], Vn = {
2907
- key: 6,
2908
- class: "my-6"
2909
- }, jn = /* @__PURE__ */ ie({
2910
- __name: "PayoutAccountDialog",
2911
- props: {
2912
- initialValue: {
2913
- type: Object,
2914
- required: !0
2915
- },
2916
- isNewAccount: {
2917
- type: Boolean,
2918
- required: !0
2919
- },
2920
- bankNameOptions: {
2921
- type: Array,
2922
- required: !0
2923
- },
2924
- bankTypeOptions: {
2925
- type: Array,
2926
- required: !0
2927
- },
2928
- storeEventOptions: {
2929
- type: Array,
2930
- required: !0
2931
- },
2932
- businessOptions: {
2933
- type: Array,
2934
- required: !0
2935
- },
2936
- restaurantOptions: {
2937
- type: Array,
2938
- required: !0
2939
- }
2940
- },
2941
- setup(n) {
2942
- const e = n, t = St(), r = pe(), s = gt(Tt(e.initialValue)), a = pe([s.payoutSetting.store.ssm, s.payoutSetting.store.bankStatement, s.payoutSetting.store.exteriorPhoto].every((k) => k)), o = pe(s.payoutSetting.store.ssm), i = pe(s.payoutSetting.store.bankStatement), u = ge(() => s.newExteriorPhoto ? URL.createObjectURL(s.newExteriorPhoto) : s.payoutSetting.store.exteriorPhoto ? s.payoutSetting.store.exteriorPhoto : "");
2943
- function l(k) {
2944
- s.newExteriorPhoto = k, s.newExteriorPhoto || (s.payoutSetting.store.exteriorPhoto = "");
2945
- }
2946
- async function m(k) {
2947
- const y = new FileReader();
2948
- return new Promise((q) => {
2949
- y.onload = (W) => {
2950
- var ee;
2951
- q((ee = W.target) == null ? void 0 : ee.result);
2952
- }, y.readAsDataURL(k);
2953
- });
2954
- }
2955
- async function O(k) {
2956
- s.newBankStatement = k;
2957
- const y = k ? await m(k) : "";
2958
- i.value = y;
2959
- }
2960
- async function S(k) {
2961
- s.newSSM = k;
2962
- const y = k ? await m(k) : "";
2963
- o.value = y;
2964
- }
2965
- function N() {
2966
- t.emitData(s), t.emitAction("primary");
2967
- }
2968
- return Ye(() => s.payoutSetting.store.event, (k) => {
2969
- s.payoutSetting.notifyUrl = k === Ve.F_PAYOUT_FOR.Enum.MARKETING ? "http://marketing-api-service:3000/customer/callback/store" : "http://order-backend:3000/backend/payment";
2970
- }, { immediate: !0 }), Ye(() => [s.newSSM, s.newBankStatement, s.newExteriorPhoto], (k) => {
2971
- a.value = k.every((y) => y);
2972
- }), (k, y) => {
2973
- const q = R("FmSelect"), W = R("FmTextField"), ee = R("FmPhoneNumber"), L = R("FmDropField"), Y = R("FmButton"), ze = R("FmFormGroup"), yt = R("FmForm");
2974
- return C(), Z(yt, {
2975
- ref: r.value,
2976
- disabled: !n.isNewAccount,
2977
- class: "flex flex-col gap-16",
2978
- onValidationSuccess: N
2979
- }, {
2980
- default: H(() => {
2981
- var tt;
2982
- return [
2983
- y[14] || (y[14] = x("div", { class: "flex items-center my-8" }, [
2984
- x("hr", { class: "w-[80px] border-t border-gray-300" }),
2985
- x("span", { class: "text-left mx-6 text-gray-500" }, "Account"),
2986
- x("hr", { class: "flex-grow border-t border-gray-300" })
2987
- ], -1)),
2988
- E(q, {
2989
- modelValue: s.payoutSetting.store.event,
2990
- "onUpdate:modelValue": y[0] || (y[0] = (T) => s.payoutSetting.store.event = T),
2991
- label: "Type",
2992
- "label-mark": "required",
2993
- items: n.storeEventOptions
2994
- }, null, 8, ["modelValue", "items"]),
2995
- E(q, {
2996
- modelValue: s.payoutSetting.store.id,
2997
- "onUpdate:modelValue": y[1] || (y[1] = (T) => s.payoutSetting.store.id = T),
2998
- label: "For",
2999
- "label-mark": "required",
3000
- placeholder: "Select store",
3001
- items: s.payoutSetting.store.event === A(Ve.F_PAYOUT_FOR).Enum.ORDERING ? n.restaurantOptions : n.businessOptions,
3002
- rules: A(ne)(A(te).string().min(1))
3003
- }, null, 8, ["modelValue", "items", "rules"]),
3004
- y[15] || (y[15] = x("div", { class: "flex items-center my-8" }, [
3005
- x("hr", { class: "w-[80px] border-t border-gray-300" }),
3006
- x("span", { class: "text-left mx-6 text-gray-500" }, "Bank Info"),
3007
- x("hr", { class: "flex-grow border-t border-gray-300" })
3008
- ], -1)),
3009
- E(q, {
3010
- modelValue: s.payoutSetting.store.bank.name,
3011
- "onUpdate:modelValue": y[2] || (y[2] = (T) => s.payoutSetting.store.bank.name = T),
3012
- label: "Bank",
3013
- "label-mark": "required",
3014
- items: n.bankNameOptions,
3015
- rules: A(ne)(A(te).string().min(1))
3016
- }, null, 8, ["modelValue", "items", "rules"]),
3017
- E(q, {
3018
- "model-value": ((tt = s.payoutSetting.store.bank) == null ? void 0 : tt.type) ?? null,
3019
- label: "Type",
3020
- "label-mark": "required",
3021
- items: n.bankTypeOptions
3022
- }, null, 8, ["model-value", "items"]),
3023
- E(W, {
3024
- modelValue: s.payoutSetting.store.bank.accountNumber,
3025
- "onUpdate:modelValue": y[3] || (y[3] = (T) => s.payoutSetting.store.bank.accountNumber = T),
3026
- label: "Account Number",
3027
- "label-mark": "required",
3028
- rules: A(ne)(A(te).string().min(1))
3029
- }, null, 8, ["modelValue", "rules"]),
3030
- E(W, {
3031
- modelValue: s.payoutSetting.store.bank.holderName,
3032
- "onUpdate:modelValue": y[4] || (y[4] = (T) => s.payoutSetting.store.bank.holderName = T),
3033
- label: "Holder name",
3034
- "label-mark": "required",
3035
- rules: A(ne)(A(te).string().min(1))
3036
- }, null, 8, ["modelValue", "rules"]),
3037
- y[16] || (y[16] = x("div", { class: "flex items-center my-8" }, [
3038
- x("hr", { class: "w-[80px] border-t border-gray-300" }),
3039
- x("span", { class: "text-left mx-6 text-gray-500" }, "Key Person"),
3040
- x("hr", { class: "flex-grow border-t border-gray-300" })
3041
- ], -1)),
3042
- E(W, {
3043
- modelValue: s.payoutSetting.store.keyPerson.name,
3044
- "onUpdate:modelValue": y[5] || (y[5] = (T) => s.payoutSetting.store.keyPerson.name = T),
3045
- label: "Name",
3046
- "label-mark": "required",
3047
- rules: A(ne)(A(te).string().min(1))
3048
- }, null, 8, ["modelValue", "rules"]),
3049
- E(ee, {
3050
- modelValue: s.payoutSetting.store.keyPerson.phone,
3051
- "onUpdate:modelValue": y[6] || (y[6] = (T) => s.payoutSetting.store.keyPerson.phone = T),
3052
- "default-country": "MY",
3053
- label: "Phone No",
3054
- "label-mark": "required",
3055
- rules: A(ne)(A(te).string().min(7))
3056
- }, null, 8, ["modelValue", "rules"]),
3057
- E(W, {
3058
- modelValue: s.payoutSetting.store.keyPerson.email,
3059
- "onUpdate:modelValue": y[7] || (y[7] = (T) => s.payoutSetting.store.keyPerson.email = T),
3060
- label: "Email",
3061
- inputmode: "email",
3062
- "label-mark": "required",
3063
- rules: A(ne)(A(te).string().email())
3064
- }, null, 8, ["modelValue", "rules"]),
3065
- y[17] || (y[17] = x("div", { class: "flex items-center my-8" }, [
3066
- x("hr", { class: "w-[80px] border-t border-gray-300" }),
3067
- x("span", { class: "text-left mx-6 text-gray-500" }, "Legal Documents"),
3068
- x("hr", { class: "flex-grow border-t border-gray-300" })
3069
- ], -1)),
3070
- n.isNewAccount && u.value === "" ? (C(), Z(L, {
3071
- key: 0,
3072
- class: "h-[300px] w-full",
3073
- label: "Exterior Photo",
3074
- "label-mark": "required",
3075
- accept: ".png,.jpg,.jpeg,.webp",
3076
- disabled: !n.isNewAccount,
3077
- onFileUpload: l
3078
- }, null, 8, ["disabled"])) : (C(), Z(ze, {
3079
- key: 1,
3080
- modelValue: i.value,
3081
- "onUpdate:modelValue": y[9] || (y[9] = (T) => i.value = T),
3082
- label: "Exterior Photo"
3083
- }, {
3084
- default: H(() => [
3085
- x("img", {
3086
- class: "h-[300px] w-full",
3087
- src: u.value
3088
- }, null, 8, In),
3089
- n.isNewAccount ? (C(), Z(Y, {
3090
- key: 0,
3091
- variant: "tertiary",
3092
- label: "Remove",
3093
- size: "md",
3094
- "prepend-icon": "delete",
3095
- onClick: y[8] || (y[8] = () => l(void 0))
3096
- })) : Re("", !0)
3097
- ]),
3098
- _: 1
3099
- }, 8, ["modelValue"])),
3100
- n.isNewAccount && i.value === "" ? (C(), Z(L, {
3101
- key: 2,
3102
- class: "h-[300px] w-full",
3103
- label: "Bank Statement w/ Holder Name",
3104
- "label-mark": "required",
3105
- accept: ".pdf",
3106
- disabled: !n.isNewAccount,
3107
- onFileUpload: O
3108
- }, null, 8, ["disabled"])) : (C(), Z(ze, {
3109
- key: 3,
3110
- modelValue: i.value,
3111
- "onUpdate:modelValue": y[11] || (y[11] = (T) => i.value = T),
3112
- label: "Bank Statement w/ Holder Name"
3113
- }, {
3114
- default: H(() => [
3115
- E(rt, {
3116
- height: 300,
3117
- pdf: i.value,
3118
- "disable-text-layer": !0,
3119
- "disable-annotation-layer": !0
3120
- }, null, 8, ["pdf"]),
3121
- n.isNewAccount ? (C(), Z(Y, {
3122
- key: 0,
3123
- variant: "tertiary",
3124
- label: "Remove",
3125
- size: "md",
3126
- "prepend-icon": "delete",
3127
- onClick: y[10] || (y[10] = () => O(void 0))
3128
- })) : Re("", !0)
3129
- ]),
3130
- _: 1
3131
- }, 8, ["modelValue"])),
3132
- n.isNewAccount && o.value === "" ? (C(), Z(L, {
3133
- key: 4,
3134
- class: "w-full h-[300px]",
3135
- label: "SSM Certificate ( Form D )",
3136
- "label-mark": "required",
3137
- accept: ".pdf",
3138
- disabled: !n.isNewAccount,
3139
- onFileUpload: S
3140
- }, null, 8, ["disabled"])) : (C(), Z(ze, {
3141
- key: 5,
3142
- modelValue: o.value,
3143
- "onUpdate:modelValue": y[13] || (y[13] = (T) => o.value = T),
3144
- label: "SSM Certificate ( Form D )"
3145
- }, {
3146
- default: H(() => [
3147
- E(rt, {
3148
- height: 300,
3149
- pdf: o.value,
3150
- "disable-text-layer": !0,
3151
- "disable-annotation-layer": !0
3152
- }, null, 8, ["pdf"]),
3153
- n.isNewAccount ? (C(), Z(Y, {
3154
- key: 0,
3155
- variant: "tertiary",
3156
- label: "Remove",
3157
- size: "md",
3158
- "prepend-icon": "delete",
3159
- onClick: y[12] || (y[12] = () => S(void 0))
3160
- })) : Re("", !0)
3161
- ]),
3162
- _: 1
3163
- }, 8, ["modelValue"])),
3164
- n.isNewAccount ? (C(), Ge("div", Vn, [
3165
- E(Y, {
3166
- type: "submit",
3167
- disabled: !a.value,
3168
- variant: "primary",
3169
- label: "Submit",
3170
- class: "w-full"
3171
- }, null, 8, ["disabled"])
3172
- ])) : Re("", !0)
3173
- ];
3174
- }),
3175
- _: 1
3176
- }, 8, ["disabled"]);
3177
- };
3178
- }
3179
- }), Mn = /* @__PURE__ */ ie({
3180
- __name: "Status",
3181
- props: {
3182
- row: {},
3183
- data: {}
3184
- },
3185
- setup(n) {
3186
- const e = n;
3187
- function t() {
3188
- return e.data === "NEW" ? "!w-[16px] !h-[16px] bg-yellow-400" : e.data === "PENDING" ? "!w-[16px] !h-[16px] bg-red-400" : "!w-[16px] !h-[16px] bg-green-400";
3189
- }
3190
- return (r, s) => {
3191
- const a = R("FmBadge");
3192
- return C(), Z(a, {
3193
- inline: "",
3194
- class: Qe(t())
3195
- }, {
3196
- default: H(() => [
3197
- x("div", null, vt(r.data), 1)
3198
- ]),
3199
- _: 1
3200
- }, 8, ["class"]);
3201
- };
3202
- }
3203
- }), $n = /* @__PURE__ */ ie({
3204
- __name: "IsActive",
3205
- props: {
3206
- row: {},
3207
- data: {}
3208
- },
3209
- setup(n) {
3210
- const e = n;
3211
- function t() {
3212
- return e.data ? "#66BB6A" : "#EF5350";
3213
- }
3214
- function r() {
3215
- return e.data ? "check" : "close";
3216
- }
3217
- return (s, a) => {
3218
- const o = R("FmIcon");
3219
- return C(), Z(o, {
3220
- name: r(),
3221
- color: t(),
3222
- size: "lg"
3223
- }, null, 8, ["name", "color"]);
3224
- };
3225
- }
3226
- }), Bn = /* @__PURE__ */ ie({
3227
- __name: "Bank",
3228
- props: {
3229
- row: {},
3230
- data: {}
3231
- },
3232
- setup(n) {
3233
- function e(t) {
3234
- return t ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-red-400";
3235
- }
3236
- return (t, r) => {
3237
- const s = R("FmBadge"), a = R("FmListItem");
3238
- return C(), Z(a, {
3239
- label: t.row.original.holderName,
3240
- sublabel: t.row.original.bankName + " - " + t.row.original.bankNumber,
3241
- clickable: !1,
3242
- tag: "label"
3243
- }, {
3244
- append: H(() => [
3245
- E(s, {
3246
- inline: "",
3247
- class: Qe(e(t.row.original.bankReady))
3248
- }, null, 8, ["class"])
3249
- ]),
3250
- _: 1
3251
- }, 8, ["label", "sublabel"]);
3252
- };
3253
- }
3254
- }), Dn = /* @__PURE__ */ ie({
3255
- __name: "PersonInCharge",
3256
- props: {
3257
- row: {},
3258
- data: {}
3259
- },
3260
- setup(n) {
3261
- function e(t) {
3262
- return t ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-red-400";
3263
- }
3264
- return (t, r) => {
3265
- const s = R("FmBadge"), a = R("FmListItem");
3266
- return C(), Z(a, {
3267
- label: t.row.original.picName,
3268
- sublabel: t.row.original.picEmail + " - " + t.row.original.picPhone,
3269
- clickable: !1,
3270
- tag: "label"
3271
- }, {
3272
- append: H(() => [
3273
- E(s, {
3274
- inline: "",
3275
- class: Qe(e(t.row.original.picReady))
3276
- }, null, 8, ["class"])
3277
- ]),
3278
- _: 1
3279
- }, 8, ["label", "sublabel"]);
3280
- };
3281
- }
3282
- }), Un = /* @__PURE__ */ ie({
3283
- __name: "PayoutAccountTable",
3284
- props: {
3285
- data: {
3286
- type: Array,
3287
- required: !0
3288
- },
3289
- loading: {
3290
- type: Boolean,
3291
- required: !0
3292
- }
3293
- },
3294
- emits: ["row-click"],
3295
- setup(n, { emit: e }) {
3296
- const t = n, r = e, s = pe(""), a = [
3297
- {
3298
- header: () => "Type",
3299
- accessorKey: "event",
3300
- meta: {
3301
- maxWidth: "92px"
3302
- }
3303
- },
3304
- {
3305
- header: () => "Name",
3306
- accessorKey: "name"
3307
- },
3308
- {
3309
- header: () => "Status",
3310
- accessorKey: "status",
3311
- cell: ({ cell: i, row: u }) => Ie(Mn, { row: u, data: i.getValue() }),
3312
- meta: {
3313
- maxWidth: "108px"
3314
- }
3315
- },
3316
- {
3317
- header: () => "Active?",
3318
- accessorKey: "isActive",
3319
- meta: {
3320
- maxWidth: "64px"
3321
- },
3322
- cell: ({ cell: i, row: u }) => Ie($n, { row: u, data: i.getValue() })
3323
- },
3324
- {
3325
- header: () => "Bank Details",
3326
- accessorKey: "bank",
3327
- cell: ({ cell: i, row: u }) => Ie(Bn, { row: u, data: i.getValue() })
3328
- },
3329
- {
3330
- header: () => "Person In-Charge (PIC)",
3331
- accessorKey: "pic",
3332
- cell: ({ cell: i, row: u }) => Ie(Dn, { row: u, data: i.getValue() })
3333
- }
3334
- ], o = ge(() => t.data.map((i) => {
3335
- const u = {
3336
- bankReady: !1,
3337
- bankNumber: "",
3338
- bankName: "",
3339
- holderName: ""
3340
- };
3341
- i.store.bank && i.store.bank.accountNumber && Object.assign(u, {
3342
- bankReady: !0,
3343
- bankNumber: i.store.bank.accountNumber,
3344
- bankName: i.store.bank.name,
3345
- holderName: i.store.bank.holderName
3346
- });
3347
- const l = {
3348
- picReady: !1,
3349
- picName: "",
3350
- picPhone: "",
3351
- picEmail: ""
3352
- };
3353
- i.store.keyPerson && Object.assign(l, {
3354
- picReady: !0,
3355
- picName: i.store.keyPerson.name,
3356
- picPhone: i.store.keyPerson.phone,
3357
- picEmail: i.store.keyPerson.email
3358
- });
3359
- let m = i.ref.name;
3360
- return i.store.event === "ORDERING" && (m = i.ref.profile.name), {
3361
- _id: i._id,
3362
- event: i.store.event,
3363
- name: m,
3364
- status: i.status,
3365
- isActive: i.enable,
3366
- ...u,
3367
- ...l
3368
- };
3369
- }));
3370
- return (i, u) => {
3371
- const l = R("FmTable");
3372
- return C(), Z(l, {
3373
- modelValue: s.value,
3374
- "onUpdate:modelValue": u[0] || (u[0] = (m) => s.value = m),
3375
- "row-data": o.value,
3376
- "column-defs": a,
3377
- loading: t.loading,
3378
- onRowClick: u[1] || (u[1] = (m) => r("row-click", t.data.at(m.index)))
3379
- }, null, 8, ["modelValue", "row-data", "loading"]);
3380
- };
3381
- }
3382
- }), Ln = {
3383
- key: 0,
3384
- class: "flex items-center justify-center min-h-[80vh]"
3385
- }, Fn = { class: "hidden mr-6 lg:block lg:w-1/6" }, zn = ["src"], qn = { class: "w-full max-w-lg text-left" }, Wn = { class: "py-4" }, Yn = { class: "flex justify-end items-center mb-6" }, Gn = { class: "flex space-x-4 items-center" }, ar = /* @__PURE__ */ ie({
3386
- __name: "PayoutAccount",
3387
- setup(n) {
3388
- const { currentBusiness: e, restaurants: t } = wt(), { isLoading: r, startAsyncCall: s } = xt(!0), a = Nt(), o = Et(), i = ge(() => o.getBusinessPayoutAccounts), u = ge(() => t.value.map((S) => ({ label: S.profile.name, value: S._id }))), l = ge(() => {
3389
- var S, N;
3390
- return [{ label: (S = e.value) == null ? void 0 : S.name, value: (N = e.value) == null ? void 0 : N._id }];
3391
- });
3392
- async function m(S) {
3393
- var ee;
3394
- const N = (S == null ? void 0 : S.businessId) ?? ((ee = e.value) == null ? void 0 : ee._id);
3395
- if (!N) throw "Business id required";
3396
- const k = me.initPayoutAccount(N, S), y = !S || S.status === nt.F_PAYOUT_ACCOUNT_STATUS.Enum.NEW, q = a.open({
3397
- title: y ? "Apply Payout Account" : "View Payout Account",
3398
- closeButton: !0,
3399
- overlay: !0,
3400
- contentComponent: jn,
3401
- contentComponentProps: {
3402
- initialValue: {
3403
- payoutSetting: k
3404
- },
3405
- isNewAccount: y,
3406
- bankNameOptions: me.bankNameOptions,
3407
- bankTypeOptions: me.bankTypeOptions,
3408
- storeEventOptions: me.storeEventOptions,
3409
- restaurantOptions: u.value,
3410
- businessOptions: l.value
3411
- }
3412
- }), W = async function(L) {
3413
- s(async () => {
3414
- const Y = await me.mergeData({
3415
- businessId: L.payoutSetting.store.event === Ve.F_PAYOUT_FOR.Enum.MARKETING ? L.payoutSetting.store.id : void 0,
3416
- restaurantId: L.payoutSetting.store.event === Ve.F_PAYOUT_FOR.Enum.ORDERING ? L.payoutSetting.store.id : void 0
3417
- }, k, L);
3418
- S ? await o.updateBusinessPayoutAccounts(Y._id, Y) : await o.createBusinessPayoutAccounts({
3419
- ...Y,
3420
- methods: void 0,
3421
- status: nt.F_PAYOUT_ACCOUNT_STATUS.Enum.NEW
3422
- }), a.close(), await O();
3423
- });
3424
- };
3425
- q.onPrimary(W);
3426
- }
3427
- async function O() {
3428
- await s(async () => {
3429
- await o.readBusinessPayoutAccounts();
3430
- });
3431
- }
3432
- return _t(O), Ye(e, O), (S, N) => {
3433
- const k = R("FmButton");
3434
- return C(), Z(Ot, {
3435
- title: "Payout Accounts",
3436
- description: "A Payout Account is an account used to receive payments or disbursements, such as earnings or refunds, typically linked to a bank.",
3437
- loading: A(r)
3438
- }, {
3439
- default: H(() => [
3440
- i.value.length ? (C(), Ge(bt, { key: 1 }, [
3441
- x("div", Yn, [
3442
- x("div", Gn, [
3443
- E(k, {
3444
- "prepend-icon": "manage_accounts",
3445
- variant: "primary",
3446
- label: "Apply",
3447
- onClick: N[1] || (N[1] = () => m())
3448
- })
3449
- ])
3450
- ]),
3451
- E(Un, {
3452
- loading: A(r),
3453
- data: i.value,
3454
- onRowClick: m
3455
- }, null, 8, ["loading", "data"])
3456
- ], 64)) : (C(), Ge("div", Ln, [
3457
- x("div", Fn, [
3458
- x("img", {
3459
- src: A(Ct),
3460
- alt: "Mascot",
3461
- class: "w-full h-auto"
3462
- }, null, 8, zn)
3463
- ]),
3464
- x("div", qn, [
3465
- N[2] || (N[2] = x("h1", { class: "text-2xl font-bold mb-2" }, " Welcome! It looks like you haven't set up a payout account yet. ", -1)),
3466
- N[3] || (N[3] = x("p", { class: "mb-2 mt-1" }, " Let's get you started—apply now and enjoy seamless payouts! ", -1)),
3467
- x("div", Wn, [
3468
- E(k, {
3469
- "prepend-icon": "manage_accounts",
3470
- variant: "primary",
3471
- label: "Apply Now",
3472
- onClick: N[0] || (N[0] = () => m())
3473
- })
3474
- ])
3475
- ])
3476
- ]))
3477
- ]),
3478
- _: 1
3479
- }, 8, ["loading"]);
3480
- };
3481
- }
3482
- });
3483
- export {
3484
- ar as default
3485
- };