@marimo-team/islands 0.14.11-dev2 → 0.14.11-dev21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-Dl7Gx8nj.js → ConnectedDataExplorerComponent-B98UAJGl.js} +4 -4
- package/dist/{ImageComparisonComponent-IsA0pccG.js → ImageComparisonComponent-3rx-X1eA.js} +1 -1
- package/dist/{VegaLite-C3jfIIJl.js → VegaLite-bssctYsi.js} +6961 -7180
- package/dist/{_baseUniq-DXGCzwrs.js → _baseUniq-n5nuGCm-.js} +36 -36
- package/dist/{any-language-editor-BbtP_crK.js → any-language-editor-CTuUQiXP.js} +1 -1
- package/dist/{architectureDiagram-IEHRJDOE-B5UTatfK.js → architectureDiagram-NQ2NVSRB-Ghs-gTjF.js} +897 -894
- package/dist/assets/{worker-BcyuOSTi.js → save-worker-fI5ofStJ.js} +1076 -1649
- package/dist/assets/{save-worker-BIDtxCd1.js → worker-Bfk1FrzG.js} +1627 -1747
- package/dist/assets/worker-BldghCZh.js +3752 -0
- package/dist/{blockDiagram-JOT3LUYC-BsdaPVqe.js → blockDiagram-PHRCVELO-BJrdpvE8.js} +534 -522
- package/dist/{c4Diagram-VJAJSXHY-mAt84R4z.js → c4Diagram-6F6E4RAY-C3mvzJPu.js} +4 -4
- package/dist/{channel-BQIWHLpc.js → channel-Dv_KwBSx.js} +1 -1
- package/dist/{chunk-4BMEZGHF-CKIxJWxP.js → chunk-353BL4L5-DE1uUKLI.js} +1 -1
- package/dist/{chunk-D6G4REZN-CgGV16Ao.js → chunk-67H74DCK-BSe-uUSS.js} +1 -1
- package/dist/chunk-6OLS64BW-lmSfyWue.js +1383 -0
- package/dist/{chunk-XZIHB7SX-Bwue5JjE.js → chunk-AACKK3MU-DAmuROVD.js} +1 -1
- package/dist/chunk-BFAMUDN2-D9C6R9UM.js +8 -0
- package/dist/chunk-E2GYISFI-BzFDmP6o.js +19 -0
- package/dist/{chunk-A2AXSNBT-wMvlVMnZ.js → chunk-QEP2MXWD-BILXx23p.js} +30 -27
- package/dist/chunk-SKB7J2MH-CxMkQppY.js +20 -0
- package/dist/{classDiagram-GIVACNV2-DOmcKRwM.js → classDiagram-BGRH5UQR-BbYr5aD9.js} +2 -2
- package/dist/{classDiagram-v2-COTLJTTW-DOmcKRwM.js → classDiagram-v2-O24JOBDK-BbYr5aD9.js} +2 -2
- package/dist/{clone-PHSHUhb-.js → clone-DuBujAk0.js} +1 -1
- package/dist/{dagre-OKDRZEBW-D5HNBllU.js → dagre-FFZHY6LT-DO5nLpLx.js} +8 -8
- package/dist/{data-editor-Coz_zrsX.js → data-editor-C8yM5wyh.js} +213 -201
- package/dist/diagram-3EMPZRKU-B1rYMJMS.js +313 -0
- package/dist/diagram-5UYTHUR4-BUu8PsmE.js +137 -0
- package/dist/{diagram-SSKATNLV-BsO89QJN.js → diagram-ZTM2IBQH-lz_uZrYh.js} +3 -3
- package/dist/{erDiagram-Q7BY3M3F-DWIMKTfS.js → erDiagram-R3QVA2FD-D_A2jrJV.js} +6 -5
- package/dist/{flowDiagram-4HSFHLVR-CnO0wmaL.js → flowDiagram-PKI6S5ZS-Bv6D_bIf.js} +283 -278
- package/dist/{ganttDiagram-APWFNJXF-otclLFL4.js → ganttDiagram-EK5VF46D-CbkaARm4.js} +453 -439
- package/dist/{gitGraphDiagram-7IBYFJ6S-C7F3RAja.js → gitGraphDiagram-GW3U2K7C-B8ZGoOT-.js} +35 -35
- package/dist/{graph-Btsdly6D.js → graph-txVVq_De.js} +3 -3
- package/dist/{index-BreCkhLm.js → index-BI6tloBb.js} +3 -3
- package/dist/{index-CcRF-HlA.js → index-CFJazcU-.js} +4 -4
- package/dist/{index-BGmzdYRo.js → index-OiR0LgXX.js} +6 -3
- package/dist/{index-z8OyYHEh.js → index-fJDj-gSp.js} +1 -1
- package/dist/index-pBmAzQJl.js +235 -0
- package/dist/{infoDiagram-PH2N3AL5-BwcXDzwE.js → infoDiagram-RLU2ROGC-DJw6nWp0.js} +5 -3
- package/dist/journeyDiagram-EWQZEKCU-1oCDdLcB.js +836 -0
- package/dist/{kanban-definition-NDS4AKOZ-3NJYjnpz.js → kanban-definition-ILFWEQ3N-nKJ02Ox0.js} +41 -39
- package/dist/{layout-qfivsCI_.js → layout-CbUwX9d6.js} +49 -49
- package/dist/{linear-D_Kojy5s.js → linear-sn9_bxtB.js} +22 -22
- package/dist/{main-DLuap1gp.js → main-D9-48wlP.js} +45053 -45130
- package/dist/main.js +1 -1
- package/dist/{mermaid-DCIbF0Rd.js → mermaid-CRRCnedu.js} +4925 -4853
- package/dist/min-CYaGuxZ4.js +80 -0
- package/dist/{mindmap-definition-ALO5MXBD-BtSBR7-c.js → mindmap-definition-CZNETY7S-CV62GMPJ.js} +3 -3
- package/dist/{pieDiagram-IB7DONF6-TiB_3g9z.js → pieDiagram-NIOCPIFQ-Bcs4p6kX.js} +3 -3
- package/dist/{quadrantDiagram-7GDLP6J5-B0DPjp7Z.js → quadrantDiagram-2OG54O6I-BlY5yea6.js} +2 -2
- package/dist/{react-plotly-BXWB3UQ5.js → react-plotly-B1SKP2B-.js} +1 -1
- package/dist/{requirementDiagram-KVF5MWMF-D_IlbRr_.js → requirementDiagram-SO3GGRV7-rmiJc5mh.js} +5 -4
- package/dist/{sankeyDiagram-QLVOVGJD-BHm9uvp_.js → sankeyDiagram-4UZDY2LN-TVzOLFCA.js} +11 -11
- package/dist/{sequenceDiagram-X6HHIX6F-3wcWWNtl.js → sequenceDiagram-ZIKVLSP4-POBNIgPB.js} +151 -149
- package/dist/{slides-component-JEGZbKgL.js → slides-component-5Y9DQzeV.js} +969 -962
- package/dist/stateDiagram-XX37X6EN-lR-7TG5f.js +264 -0
- package/dist/{stateDiagram-v2-YXO3MK2T-DTdt4vFc.js → stateDiagram-v2-GD6S3NHB-CYV2YCSY.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{time-DyZM4tB4.js → time-BytuUgXk.js} +2 -2
- package/dist/{timeline-definition-BDJGKUSR-Of4cvbYH.js → timeline-definition-RI47OAVP-DOrNrVHk.js} +99 -102
- package/dist/{radar-MK3ICKWK-BMSp8zaN.js → treemap-FKARHQ26-BOli4yXg.js} +2469 -2330
- package/dist/{vega-component-Dwc_9OTG.js → vega-component-KZ-3GH6H.js} +21 -21
- package/dist/{xychartDiagram-VJFVF3MP-5Jc993Va.js → xychartDiagram-H2YORKM3-CUOFDcIy.js} +409 -375
- package/package.json +37 -37
- package/dist/assets/worker-Dz6PPEGc.js +0 -4115
- package/dist/chunk-AEK57VVT-BAi7QtEw.js +0 -1416
- package/dist/chunk-RZ5BOZE2-D7Ag0UF8.js +0 -24
- package/dist/diagram-VNBRO52H-CA8VTm7L.js +0 -126
- package/dist/journeyDiagram-U35MCT3I-Co4hTdu9.js +0 -809
- package/dist/min-CQBZldos.js +0 -80
- package/dist/stateDiagram-DGXRK772-DbH3Rdz4.js +0 -271
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
var Yt = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
2
|
+
var tn = Yt((sn, Ue) => {
|
|
3
|
+
const Xt = 1e10, Gt = 1e3;
|
|
4
|
+
function me(t, e) {
|
|
5
5
|
const r = t.map((n) => `"${n}"`).join(", ");
|
|
6
6
|
return new Error(`This RPC instance cannot ${e} because the transport did not provide one or more of these methods: ${r}`);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Kt(t = {}) {
|
|
9
9
|
let e = {};
|
|
10
|
-
function r(
|
|
11
|
-
e =
|
|
10
|
+
function r(m) {
|
|
11
|
+
e = m;
|
|
12
12
|
}
|
|
13
13
|
let n = {};
|
|
14
|
-
function s(
|
|
15
|
-
n.unregisterHandler && n.unregisterHandler(), n =
|
|
14
|
+
function s(m) {
|
|
15
|
+
n.unregisterHandler && n.unregisterHandler(), n = m, n.registerHandler?.(Jt);
|
|
16
16
|
}
|
|
17
17
|
let a;
|
|
18
|
-
function i(
|
|
19
|
-
if (typeof
|
|
20
|
-
a =
|
|
18
|
+
function i(m) {
|
|
19
|
+
if (typeof m == "function") {
|
|
20
|
+
a = m;
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
a = (
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
throw new Error(`The requested method has no handler: ${
|
|
30
|
-
return
|
|
23
|
+
a = (x, E) => {
|
|
24
|
+
const T = m[x];
|
|
25
|
+
if (T)
|
|
26
|
+
return T(E);
|
|
27
|
+
const I = m._;
|
|
28
|
+
if (!I)
|
|
29
|
+
throw new Error(`The requested method has no handler: ${x}`);
|
|
30
|
+
return I(x, E);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const { maxRequestTime: o =
|
|
33
|
+
const { maxRequestTime: o = Gt } = t;
|
|
34
34
|
t.transport && s(t.transport), t.requestHandler && i(t.requestHandler), t._debugHooks && r(t._debugHooks);
|
|
35
|
-
let
|
|
36
|
-
function
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
41
|
-
const E =
|
|
42
|
-
return new Promise((
|
|
35
|
+
let d = 0;
|
|
36
|
+
function u() {
|
|
37
|
+
return d <= Xt ? ++d : d = 0;
|
|
38
|
+
}
|
|
39
|
+
const h = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
|
|
40
|
+
function S(m, ...x) {
|
|
41
|
+
const E = x[0];
|
|
42
|
+
return new Promise((T, I) => {
|
|
43
43
|
if (!n.send)
|
|
44
|
-
throw
|
|
45
|
-
const
|
|
44
|
+
throw me(["send"], "make requests");
|
|
45
|
+
const Z = u(), Xe = {
|
|
46
46
|
type: "request",
|
|
47
|
-
id:
|
|
48
|
-
method:
|
|
47
|
+
id: Z,
|
|
48
|
+
method: m,
|
|
49
49
|
params: E
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, o)), e.onSend?.(
|
|
51
|
+
h.set(Z, { resolve: T, reject: I }), o !== 1 / 0 && b.set(Z, setTimeout(() => {
|
|
52
|
+
b.delete(Z), I(new Error("RPC request timed out."));
|
|
53
|
+
}, o)), e.onSend?.(Xe), n.send(Xe);
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
get: (
|
|
58
|
-
}),
|
|
59
|
-
function
|
|
60
|
-
const E =
|
|
56
|
+
const A = new Proxy(S, {
|
|
57
|
+
get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => S(x, T)
|
|
58
|
+
}), $ = A;
|
|
59
|
+
function pe(m, ...x) {
|
|
60
|
+
const E = x[0];
|
|
61
61
|
if (!n.send)
|
|
62
|
-
throw
|
|
63
|
-
const
|
|
62
|
+
throw me(["send"], "send messages");
|
|
63
|
+
const T = {
|
|
64
64
|
type: "message",
|
|
65
|
-
id:
|
|
65
|
+
id: m,
|
|
66
66
|
payload: E
|
|
67
67
|
};
|
|
68
|
-
e.onSend?.(
|
|
68
|
+
e.onSend?.(T), n.send(T);
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
get: (
|
|
72
|
-
}),
|
|
73
|
-
function
|
|
70
|
+
const Je = new Proxy(pe, {
|
|
71
|
+
get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => pe(x, T)
|
|
72
|
+
}), Ye = Je, H = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Set();
|
|
73
|
+
function Bt(m, x) {
|
|
74
74
|
if (!n.registerHandler)
|
|
75
|
-
throw
|
|
76
|
-
if (
|
|
77
|
-
|
|
75
|
+
throw me(["registerHandler"], "register message listeners");
|
|
76
|
+
if (m === "*") {
|
|
77
|
+
Te.add(x);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
H.has(m) || H.set(m, /* @__PURE__ */ new Set()), H.get(m)?.add(x);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
84
|
-
|
|
82
|
+
function Wt(m, x) {
|
|
83
|
+
if (m === "*") {
|
|
84
|
+
Te.delete(x);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
H.get(m)?.delete(x), H.get(m)?.size === 0 && H.delete(m);
|
|
88
88
|
}
|
|
89
|
-
async function
|
|
90
|
-
if (e.onReceive?.(
|
|
89
|
+
async function Jt(m) {
|
|
90
|
+
if (e.onReceive?.(m), !("type" in m))
|
|
91
91
|
throw new Error("Message does not contain a type.");
|
|
92
|
-
if (
|
|
92
|
+
if (m.type === "request") {
|
|
93
93
|
if (!n.send || !a)
|
|
94
|
-
throw
|
|
95
|
-
const { id:
|
|
96
|
-
let
|
|
94
|
+
throw me(["send", "requestHandler"], "handle requests");
|
|
95
|
+
const { id: x, method: E, params: T } = m;
|
|
96
|
+
let I;
|
|
97
97
|
try {
|
|
98
|
-
|
|
98
|
+
I = {
|
|
99
99
|
type: "response",
|
|
100
|
-
id:
|
|
100
|
+
id: x,
|
|
101
101
|
success: !0,
|
|
102
|
-
payload: await a(E,
|
|
102
|
+
payload: await a(E, T)
|
|
103
103
|
};
|
|
104
|
-
} catch (
|
|
105
|
-
if (!(
|
|
106
|
-
throw
|
|
107
|
-
|
|
104
|
+
} catch (Z) {
|
|
105
|
+
if (!(Z instanceof Error))
|
|
106
|
+
throw Z;
|
|
107
|
+
I = {
|
|
108
108
|
type: "response",
|
|
109
|
-
id:
|
|
109
|
+
id: x,
|
|
110
110
|
success: !1,
|
|
111
|
-
error:
|
|
111
|
+
error: Z.message
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
e.onSend?.(
|
|
114
|
+
e.onSend?.(I), n.send(I);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const { resolve: E, reject:
|
|
121
|
-
|
|
117
|
+
if (m.type === "response") {
|
|
118
|
+
const x = b.get(m.id);
|
|
119
|
+
x != null && clearTimeout(x);
|
|
120
|
+
const { resolve: E, reject: T } = h.get(m.id) ?? {};
|
|
121
|
+
m.success ? E?.(m.payload) : T?.(new Error(m.error));
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (
|
|
125
|
-
for (const E of
|
|
126
|
-
E(
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
124
|
+
if (m.type === "message") {
|
|
125
|
+
for (const E of Te)
|
|
126
|
+
E(m.id, m.payload);
|
|
127
|
+
const x = H.get(m.id);
|
|
128
|
+
if (!x)
|
|
129
129
|
return;
|
|
130
|
-
for (const E of
|
|
131
|
-
E(
|
|
130
|
+
for (const E of x)
|
|
131
|
+
E(m.payload);
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
throw new Error(`Unexpected RPC message type: ${
|
|
134
|
+
throw new Error(`Unexpected RPC message type: ${m.type}`);
|
|
135
135
|
}
|
|
136
136
|
return {
|
|
137
137
|
setTransport: s,
|
|
138
138
|
setRequestHandler: i,
|
|
139
|
-
request:
|
|
140
|
-
requestProxy:
|
|
141
|
-
send:
|
|
142
|
-
sendProxy:
|
|
143
|
-
addMessageListener:
|
|
144
|
-
removeMessageListener:
|
|
145
|
-
proxy: { send:
|
|
139
|
+
request: A,
|
|
140
|
+
requestProxy: $,
|
|
141
|
+
send: Je,
|
|
142
|
+
sendProxy: Ye,
|
|
143
|
+
addMessageListener: Bt,
|
|
144
|
+
removeMessageListener: Wt,
|
|
145
|
+
proxy: { send: Ye, request: $ },
|
|
146
146
|
_setDebugHooks: r
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
149
|
+
function Qt(t) {
|
|
150
|
+
return Kt(t);
|
|
151
151
|
}
|
|
152
|
-
const
|
|
153
|
-
function
|
|
152
|
+
const mt = "[transport-id]";
|
|
153
|
+
function er(t, e) {
|
|
154
154
|
const { transportId: r } = e;
|
|
155
|
-
return r != null ? { [
|
|
155
|
+
return r != null ? { [mt]: r, data: t } : t;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function tr(t, e) {
|
|
158
158
|
const { transportId: r, filter: n } = e, s = n?.();
|
|
159
159
|
if (r != null && s != null)
|
|
160
160
|
throw new Error("Cannot use both `transportId` and `filter` at the same time");
|
|
161
161
|
let a = t;
|
|
162
162
|
if (r) {
|
|
163
|
-
if (t[
|
|
163
|
+
if (t[mt] !== r)
|
|
164
164
|
return [!0];
|
|
165
165
|
a = t.data;
|
|
166
166
|
}
|
|
167
167
|
return s === !1 ? [!0] : [!1, a];
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function rr(t, e = {}) {
|
|
170
170
|
const { transportId: r, filter: n, remotePort: s } = e, a = t, i = s ?? t;
|
|
171
171
|
let o;
|
|
172
172
|
return {
|
|
173
|
-
send(
|
|
174
|
-
i.postMessage(
|
|
173
|
+
send(d) {
|
|
174
|
+
i.postMessage(er(d, { transportId: r }));
|
|
175
175
|
},
|
|
176
|
-
registerHandler(
|
|
177
|
-
o = (
|
|
178
|
-
const
|
|
176
|
+
registerHandler(d) {
|
|
177
|
+
o = (u) => {
|
|
178
|
+
const h = u.data, [b, S] = tr(h, {
|
|
179
179
|
transportId: r,
|
|
180
|
-
filter: () => n?.(
|
|
180
|
+
filter: () => n?.(u)
|
|
181
181
|
});
|
|
182
|
-
|
|
182
|
+
b || d(S);
|
|
183
183
|
}, a.addEventListener("message", o);
|
|
184
184
|
},
|
|
185
185
|
unregisterHandler() {
|
|
@@ -187,19 +187,13 @@ var ls = _r((ps, mt) => {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
192
|
-
}
|
|
193
|
-
function Nr(t) {
|
|
194
|
-
let e, r = !1;
|
|
195
|
-
return function(...n) {
|
|
196
|
-
return r || (r = !0, e = t.apply(this, n)), e;
|
|
197
|
-
};
|
|
190
|
+
function nr(t) {
|
|
191
|
+
return rr(self, t);
|
|
198
192
|
}
|
|
199
|
-
const
|
|
193
|
+
const ae = {
|
|
200
194
|
NOOP: () => {
|
|
201
195
|
}
|
|
202
|
-
},
|
|
196
|
+
}, yt = (t, e) => {
|
|
203
197
|
const r = `[${t}]`;
|
|
204
198
|
return {
|
|
205
199
|
debug: (...n) => e.debug(r, ...n),
|
|
@@ -207,10 +201,10 @@ var ls = _r((ps, mt) => {
|
|
|
207
201
|
warn: (...n) => e.warn(r, ...n),
|
|
208
202
|
error: (...n) => e.error(r, ...n),
|
|
209
203
|
trace: (...n) => e.trace(r, ...n),
|
|
210
|
-
get: (n) =>
|
|
211
|
-
disabled: (n = !0) => n ?
|
|
204
|
+
get: (n) => yt(`${t}.${n}`, e),
|
|
205
|
+
disabled: (n = !0) => n ? _e : e
|
|
212
206
|
};
|
|
213
|
-
},
|
|
207
|
+
}, ve = {
|
|
214
208
|
debug: (...t) => {
|
|
215
209
|
console.debug(...t);
|
|
216
210
|
},
|
|
@@ -226,39 +220,25 @@ var ls = _r((ps, mt) => {
|
|
|
226
220
|
trace: (...t) => {
|
|
227
221
|
console.trace(...t);
|
|
228
222
|
},
|
|
229
|
-
get: (t) =>
|
|
230
|
-
disabled: (t = !0) => t ?
|
|
231
|
-
},
|
|
232
|
-
debug: () =>
|
|
233
|
-
log: () =>
|
|
234
|
-
warn: () =>
|
|
235
|
-
error: () =>
|
|
236
|
-
trace: () =>
|
|
237
|
-
get: () =>
|
|
238
|
-
disabled: () =>
|
|
223
|
+
get: (t) => yt(t, ve),
|
|
224
|
+
disabled: (t = !0) => t ? _e : ve
|
|
225
|
+
}, _e = {
|
|
226
|
+
debug: () => ae.NOOP,
|
|
227
|
+
log: () => ae.NOOP,
|
|
228
|
+
warn: () => ae.NOOP,
|
|
229
|
+
error: () => ae.NOOP,
|
|
230
|
+
trace: () => ae.NOOP,
|
|
231
|
+
get: () => _e,
|
|
232
|
+
disabled: () => _e
|
|
239
233
|
};
|
|
240
|
-
function
|
|
241
|
-
return typeof window < "u" && window.Logger ||
|
|
234
|
+
function sr() {
|
|
235
|
+
return typeof window < "u" && window.Logger || ve;
|
|
242
236
|
}
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
promise;
|
|
246
|
-
resolve;
|
|
247
|
-
reject;
|
|
248
|
-
status = "pending";
|
|
249
|
-
constructor() {
|
|
250
|
-
this.promise = new Promise((e, r) => {
|
|
251
|
-
this.reject = (n) => {
|
|
252
|
-
this.status = "rejected", r(n);
|
|
253
|
-
}, this.resolve = (n) => {
|
|
254
|
-
this.status = "resolved", e(n);
|
|
255
|
-
};
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
var k;
|
|
237
|
+
const de = sr(), Ae = (t) => new TextDecoder().decode(t);
|
|
238
|
+
var w;
|
|
260
239
|
(function(t) {
|
|
261
|
-
t.assertEqual = (s) =>
|
|
240
|
+
t.assertEqual = (s) => {
|
|
241
|
+
};
|
|
262
242
|
function e(s) {
|
|
263
243
|
}
|
|
264
244
|
t.assertIs = e;
|
|
@@ -286,21 +266,21 @@ var ls = _r((ps, mt) => {
|
|
|
286
266
|
for (const i of s)
|
|
287
267
|
if (a(i))
|
|
288
268
|
return i;
|
|
289
|
-
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
269
|
+
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
|
|
290
270
|
function n(s, a = " | ") {
|
|
291
271
|
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
292
272
|
}
|
|
293
273
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
294
|
-
})(
|
|
295
|
-
var
|
|
274
|
+
})(w || (w = {}));
|
|
275
|
+
var Ge;
|
|
296
276
|
(function(t) {
|
|
297
277
|
t.mergeShapes = (e, r) => ({
|
|
298
278
|
...e,
|
|
299
279
|
...r
|
|
300
280
|
// second overwrites first
|
|
301
281
|
});
|
|
302
|
-
})(
|
|
303
|
-
const
|
|
282
|
+
})(Ge || (Ge = {}));
|
|
283
|
+
const f = w.arrayToEnum([
|
|
304
284
|
"string",
|
|
305
285
|
"nan",
|
|
306
286
|
"number",
|
|
@@ -321,28 +301,28 @@ var ls = _r((ps, mt) => {
|
|
|
321
301
|
"never",
|
|
322
302
|
"map",
|
|
323
303
|
"set"
|
|
324
|
-
]),
|
|
304
|
+
]), L = (t) => {
|
|
325
305
|
switch (typeof t) {
|
|
326
306
|
case "undefined":
|
|
327
|
-
return
|
|
307
|
+
return f.undefined;
|
|
328
308
|
case "string":
|
|
329
|
-
return
|
|
309
|
+
return f.string;
|
|
330
310
|
case "number":
|
|
331
|
-
return isNaN(t) ?
|
|
311
|
+
return Number.isNaN(t) ? f.nan : f.number;
|
|
332
312
|
case "boolean":
|
|
333
|
-
return
|
|
313
|
+
return f.boolean;
|
|
334
314
|
case "function":
|
|
335
|
-
return
|
|
315
|
+
return f.function;
|
|
336
316
|
case "bigint":
|
|
337
|
-
return
|
|
317
|
+
return f.bigint;
|
|
338
318
|
case "symbol":
|
|
339
|
-
return
|
|
319
|
+
return f.symbol;
|
|
340
320
|
case "object":
|
|
341
|
-
return Array.isArray(t) ?
|
|
321
|
+
return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
|
|
342
322
|
default:
|
|
343
|
-
return
|
|
323
|
+
return f.unknown;
|
|
344
324
|
}
|
|
345
|
-
},
|
|
325
|
+
}, c = w.arrayToEnum([
|
|
346
326
|
"invalid_type",
|
|
347
327
|
"invalid_literal",
|
|
348
328
|
"custom",
|
|
@@ -359,8 +339,8 @@ var ls = _r((ps, mt) => {
|
|
|
359
339
|
"invalid_intersection_types",
|
|
360
340
|
"not_multiple_of",
|
|
361
341
|
"not_finite"
|
|
362
|
-
])
|
|
363
|
-
class
|
|
342
|
+
]);
|
|
343
|
+
class F extends Error {
|
|
364
344
|
get errors() {
|
|
365
345
|
return this.issues;
|
|
366
346
|
}
|
|
@@ -387,24 +367,24 @@ var ls = _r((ps, mt) => {
|
|
|
387
367
|
else if (i.path.length === 0)
|
|
388
368
|
n._errors.push(r(i));
|
|
389
369
|
else {
|
|
390
|
-
let o = n,
|
|
391
|
-
for (;
|
|
392
|
-
const
|
|
393
|
-
|
|
370
|
+
let o = n, d = 0;
|
|
371
|
+
for (; d < i.path.length; ) {
|
|
372
|
+
const u = i.path[d];
|
|
373
|
+
d === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(r(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], d++;
|
|
394
374
|
}
|
|
395
375
|
}
|
|
396
376
|
};
|
|
397
377
|
return s(this), n;
|
|
398
378
|
}
|
|
399
379
|
static assert(e) {
|
|
400
|
-
if (!(e instanceof
|
|
380
|
+
if (!(e instanceof F))
|
|
401
381
|
throw new Error(`Not a ZodError: ${e}`);
|
|
402
382
|
}
|
|
403
383
|
toString() {
|
|
404
384
|
return this.message;
|
|
405
385
|
}
|
|
406
386
|
get message() {
|
|
407
|
-
return JSON.stringify(this.issues,
|
|
387
|
+
return JSON.stringify(this.issues, w.jsonStringifyReplacer, 2);
|
|
408
388
|
}
|
|
409
389
|
get isEmpty() {
|
|
410
390
|
return this.issues.length === 0;
|
|
@@ -412,78 +392,79 @@ var ls = _r((ps, mt) => {
|
|
|
412
392
|
flatten(e = (r) => r.message) {
|
|
413
393
|
const r = {}, n = [];
|
|
414
394
|
for (const s of this.issues)
|
|
415
|
-
s.path.length > 0
|
|
395
|
+
if (s.path.length > 0) {
|
|
396
|
+
const a = s.path[0];
|
|
397
|
+
r[a] = r[a] || [], r[a].push(e(s));
|
|
398
|
+
} else
|
|
399
|
+
n.push(e(s));
|
|
416
400
|
return { formErrors: n, fieldErrors: r };
|
|
417
401
|
}
|
|
418
402
|
get formErrors() {
|
|
419
403
|
return this.flatten();
|
|
420
404
|
}
|
|
421
405
|
}
|
|
422
|
-
|
|
423
|
-
const
|
|
406
|
+
F.create = (t) => new F(t);
|
|
407
|
+
const Ie = (t, e) => {
|
|
424
408
|
let r;
|
|
425
409
|
switch (t.code) {
|
|
426
|
-
case
|
|
427
|
-
t.received ===
|
|
410
|
+
case c.invalid_type:
|
|
411
|
+
t.received === f.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
428
412
|
break;
|
|
429
|
-
case
|
|
430
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
413
|
+
case c.invalid_literal:
|
|
414
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, w.jsonStringifyReplacer)}`;
|
|
431
415
|
break;
|
|
432
|
-
case
|
|
433
|
-
r = `Unrecognized key(s) in object: ${
|
|
416
|
+
case c.unrecognized_keys:
|
|
417
|
+
r = `Unrecognized key(s) in object: ${w.joinValues(t.keys, ", ")}`;
|
|
434
418
|
break;
|
|
435
|
-
case
|
|
419
|
+
case c.invalid_union:
|
|
436
420
|
r = "Invalid input";
|
|
437
421
|
break;
|
|
438
|
-
case
|
|
439
|
-
r = `Invalid discriminator value. Expected ${
|
|
422
|
+
case c.invalid_union_discriminator:
|
|
423
|
+
r = `Invalid discriminator value. Expected ${w.joinValues(t.options)}`;
|
|
440
424
|
break;
|
|
441
|
-
case
|
|
442
|
-
r = `Invalid enum value. Expected ${
|
|
425
|
+
case c.invalid_enum_value:
|
|
426
|
+
r = `Invalid enum value. Expected ${w.joinValues(t.options)}, received '${t.received}'`;
|
|
443
427
|
break;
|
|
444
|
-
case
|
|
428
|
+
case c.invalid_arguments:
|
|
445
429
|
r = "Invalid function arguments";
|
|
446
430
|
break;
|
|
447
|
-
case
|
|
431
|
+
case c.invalid_return_type:
|
|
448
432
|
r = "Invalid function return type";
|
|
449
433
|
break;
|
|
450
|
-
case
|
|
434
|
+
case c.invalid_date:
|
|
451
435
|
r = "Invalid date";
|
|
452
436
|
break;
|
|
453
|
-
case
|
|
454
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
437
|
+
case c.invalid_string:
|
|
438
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : w.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
|
|
455
439
|
break;
|
|
456
|
-
case
|
|
457
|
-
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
440
|
+
case c.too_small:
|
|
441
|
+
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
458
442
|
break;
|
|
459
|
-
case
|
|
443
|
+
case c.too_big:
|
|
460
444
|
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
|
|
461
445
|
break;
|
|
462
|
-
case
|
|
446
|
+
case c.custom:
|
|
463
447
|
r = "Invalid input";
|
|
464
448
|
break;
|
|
465
|
-
case
|
|
449
|
+
case c.invalid_intersection_types:
|
|
466
450
|
r = "Intersection results could not be merged";
|
|
467
451
|
break;
|
|
468
|
-
case
|
|
452
|
+
case c.not_multiple_of:
|
|
469
453
|
r = `Number must be a multiple of ${t.multipleOf}`;
|
|
470
454
|
break;
|
|
471
|
-
case
|
|
455
|
+
case c.not_finite:
|
|
472
456
|
r = "Number must be finite";
|
|
473
457
|
break;
|
|
474
458
|
default:
|
|
475
|
-
r = e.defaultError,
|
|
459
|
+
r = e.defaultError, w.assertNever(t);
|
|
476
460
|
}
|
|
477
461
|
return { message: r };
|
|
478
462
|
};
|
|
479
|
-
let
|
|
480
|
-
function
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
function Be() {
|
|
484
|
-
return It;
|
|
463
|
+
let ar = Ie;
|
|
464
|
+
function ir() {
|
|
465
|
+
return ar;
|
|
485
466
|
}
|
|
486
|
-
const
|
|
467
|
+
const or = (t) => {
|
|
487
468
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
488
469
|
...s,
|
|
489
470
|
path: a
|
|
@@ -495,17 +476,17 @@ var ls = _r((ps, mt) => {
|
|
|
495
476
|
message: s.message
|
|
496
477
|
};
|
|
497
478
|
let o = "";
|
|
498
|
-
const
|
|
499
|
-
for (const
|
|
500
|
-
o =
|
|
479
|
+
const d = n.filter((u) => !!u).slice().reverse();
|
|
480
|
+
for (const u of d)
|
|
481
|
+
o = u(i, { data: e, defaultError: o }).message;
|
|
501
482
|
return {
|
|
502
483
|
...s,
|
|
503
484
|
path: a,
|
|
504
485
|
message: o
|
|
505
486
|
};
|
|
506
|
-
}
|
|
507
|
-
function
|
|
508
|
-
const r =
|
|
487
|
+
};
|
|
488
|
+
function l(t, e) {
|
|
489
|
+
const r = ir(), n = or({
|
|
509
490
|
issueData: e,
|
|
510
491
|
data: t.data,
|
|
511
492
|
path: t.path,
|
|
@@ -516,13 +497,13 @@ var ls = _r((ps, mt) => {
|
|
|
516
497
|
// then schema-bound map if available
|
|
517
498
|
r,
|
|
518
499
|
// then global override map
|
|
519
|
-
r ===
|
|
500
|
+
r === Ie ? void 0 : Ie
|
|
520
501
|
// then global default map
|
|
521
502
|
].filter((s) => !!s)
|
|
522
503
|
});
|
|
523
504
|
t.common.issues.push(n);
|
|
524
505
|
}
|
|
525
|
-
class
|
|
506
|
+
class R {
|
|
526
507
|
constructor() {
|
|
527
508
|
this.value = "valid";
|
|
528
509
|
}
|
|
@@ -550,7 +531,7 @@ var ls = _r((ps, mt) => {
|
|
|
550
531
|
value: i
|
|
551
532
|
});
|
|
552
533
|
}
|
|
553
|
-
return
|
|
534
|
+
return R.mergeObjectSync(e, n);
|
|
554
535
|
}
|
|
555
536
|
static mergeObjectSync(e, r) {
|
|
556
537
|
const n = {};
|
|
@@ -565,30 +546,21 @@ var ls = _r((ps, mt) => {
|
|
|
565
546
|
}
|
|
566
547
|
const y = Object.freeze({
|
|
567
548
|
status: "aborted"
|
|
568
|
-
}),
|
|
569
|
-
|
|
570
|
-
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
571
|
-
return e.get(t);
|
|
572
|
-
}
|
|
573
|
-
function jt(t, e, r, n, s) {
|
|
574
|
-
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
575
|
-
return e.set(t, r), r;
|
|
576
|
-
}
|
|
577
|
-
var h;
|
|
549
|
+
}), ce = (t) => ({ status: "dirty", value: t }), C = (t) => ({ status: "valid", value: t }), Ke = (t) => t.status === "aborted", Qe = (t) => t.status === "dirty", te = (t) => t.status === "valid", ke = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
550
|
+
var p;
|
|
578
551
|
(function(t) {
|
|
579
552
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
580
|
-
})(
|
|
581
|
-
|
|
582
|
-
class D {
|
|
553
|
+
})(p || (p = {}));
|
|
554
|
+
class q {
|
|
583
555
|
constructor(e, r, n, s) {
|
|
584
556
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
585
557
|
}
|
|
586
558
|
get path() {
|
|
587
|
-
return this._cachedPath.length || (this._key
|
|
559
|
+
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
588
560
|
}
|
|
589
561
|
}
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
562
|
+
const et = (t, e) => {
|
|
563
|
+
if (te(e))
|
|
592
564
|
return { success: !0, data: e.value };
|
|
593
565
|
if (!t.common.issues.length)
|
|
594
566
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -597,7 +569,7 @@ var ls = _r((ps, mt) => {
|
|
|
597
569
|
get error() {
|
|
598
570
|
if (this._error)
|
|
599
571
|
return this._error;
|
|
600
|
-
const r = new
|
|
572
|
+
const r = new F(t.common.issues);
|
|
601
573
|
return this._error = r, this._error;
|
|
602
574
|
}
|
|
603
575
|
};
|
|
@@ -609,23 +581,22 @@ var ls = _r((ps, mt) => {
|
|
|
609
581
|
if (e && (r || n))
|
|
610
582
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
611
583
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: (c = u ?? n) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = u ?? r) !== null && d !== void 0 ? d : o.defaultError };
|
|
584
|
+
const { message: d } = t;
|
|
585
|
+
return i.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? r ?? o.defaultError };
|
|
615
586
|
}, description: s };
|
|
616
587
|
}
|
|
617
|
-
class
|
|
588
|
+
class k {
|
|
618
589
|
get description() {
|
|
619
590
|
return this._def.description;
|
|
620
591
|
}
|
|
621
592
|
_getType(e) {
|
|
622
|
-
return
|
|
593
|
+
return L(e.data);
|
|
623
594
|
}
|
|
624
595
|
_getOrReturnCtx(e, r) {
|
|
625
596
|
return r || {
|
|
626
597
|
common: e.parent.common,
|
|
627
598
|
data: e.data,
|
|
628
|
-
parsedType:
|
|
599
|
+
parsedType: L(e.data),
|
|
629
600
|
schemaErrorMap: this._def.errorMap,
|
|
630
601
|
path: e.path,
|
|
631
602
|
parent: e.parent
|
|
@@ -633,11 +604,11 @@ var ls = _r((ps, mt) => {
|
|
|
633
604
|
}
|
|
634
605
|
_processInputParams(e) {
|
|
635
606
|
return {
|
|
636
|
-
status: new
|
|
607
|
+
status: new R(),
|
|
637
608
|
ctx: {
|
|
638
609
|
common: e.parent.common,
|
|
639
610
|
data: e.data,
|
|
640
|
-
parsedType:
|
|
611
|
+
parsedType: L(e.data),
|
|
641
612
|
schemaErrorMap: this._def.errorMap,
|
|
642
613
|
path: e.path,
|
|
643
614
|
parent: e.parent
|
|
@@ -646,7 +617,7 @@ var ls = _r((ps, mt) => {
|
|
|
646
617
|
}
|
|
647
618
|
_parseSync(e) {
|
|
648
619
|
const r = this._parse(e);
|
|
649
|
-
if (
|
|
620
|
+
if (ke(r))
|
|
650
621
|
throw new Error("Synchronous parse encountered promise.");
|
|
651
622
|
return r;
|
|
652
623
|
}
|
|
@@ -661,24 +632,22 @@ var ls = _r((ps, mt) => {
|
|
|
661
632
|
throw n.error;
|
|
662
633
|
}
|
|
663
634
|
safeParse(e, r) {
|
|
664
|
-
|
|
665
|
-
const s = {
|
|
635
|
+
const n = {
|
|
666
636
|
common: {
|
|
667
637
|
issues: [],
|
|
668
|
-
async:
|
|
638
|
+
async: r?.async ?? !1,
|
|
669
639
|
contextualErrorMap: r?.errorMap
|
|
670
640
|
},
|
|
671
641
|
path: r?.path || [],
|
|
672
642
|
schemaErrorMap: this._def.errorMap,
|
|
673
643
|
parent: null,
|
|
674
644
|
data: e,
|
|
675
|
-
parsedType:
|
|
676
|
-
},
|
|
677
|
-
return
|
|
645
|
+
parsedType: L(e)
|
|
646
|
+
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
647
|
+
return et(n, s);
|
|
678
648
|
}
|
|
679
649
|
"~validate"(e) {
|
|
680
|
-
|
|
681
|
-
const s = {
|
|
650
|
+
const r = {
|
|
682
651
|
common: {
|
|
683
652
|
issues: [],
|
|
684
653
|
async: !!this["~standard"].async
|
|
@@ -687,26 +656,26 @@ var ls = _r((ps, mt) => {
|
|
|
687
656
|
schemaErrorMap: this._def.errorMap,
|
|
688
657
|
parent: null,
|
|
689
658
|
data: e,
|
|
690
|
-
parsedType:
|
|
659
|
+
parsedType: L(e)
|
|
691
660
|
};
|
|
692
661
|
if (!this["~standard"].async)
|
|
693
662
|
try {
|
|
694
|
-
const
|
|
695
|
-
return
|
|
696
|
-
value:
|
|
663
|
+
const n = this._parseSync({ data: e, path: [], parent: r });
|
|
664
|
+
return te(n) ? {
|
|
665
|
+
value: n.value
|
|
697
666
|
} : {
|
|
698
|
-
issues:
|
|
667
|
+
issues: r.common.issues
|
|
699
668
|
};
|
|
700
|
-
} catch (
|
|
701
|
-
|
|
669
|
+
} catch (n) {
|
|
670
|
+
n?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), r.common = {
|
|
702
671
|
issues: [],
|
|
703
672
|
async: !0
|
|
704
673
|
};
|
|
705
674
|
}
|
|
706
|
-
return this._parseAsync({ data: e, path: [], parent:
|
|
707
|
-
value:
|
|
675
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((n) => te(n) ? {
|
|
676
|
+
value: n.value
|
|
708
677
|
} : {
|
|
709
|
-
issues:
|
|
678
|
+
issues: r.common.issues
|
|
710
679
|
});
|
|
711
680
|
}
|
|
712
681
|
async parseAsync(e, r) {
|
|
@@ -726,27 +695,27 @@ var ls = _r((ps, mt) => {
|
|
|
726
695
|
schemaErrorMap: this._def.errorMap,
|
|
727
696
|
parent: null,
|
|
728
697
|
data: e,
|
|
729
|
-
parsedType:
|
|
730
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
731
|
-
return
|
|
698
|
+
parsedType: L(e)
|
|
699
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ke(s) ? s : Promise.resolve(s));
|
|
700
|
+
return et(n, a);
|
|
732
701
|
}
|
|
733
702
|
refine(e, r) {
|
|
734
703
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
735
704
|
return this._refinement((s, a) => {
|
|
736
705
|
const i = e(s), o = () => a.addIssue({
|
|
737
|
-
code:
|
|
706
|
+
code: c.custom,
|
|
738
707
|
...n(s)
|
|
739
708
|
});
|
|
740
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
709
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
741
710
|
});
|
|
742
711
|
}
|
|
743
712
|
refinement(e, r) {
|
|
744
713
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
745
714
|
}
|
|
746
715
|
_refinement(e) {
|
|
747
|
-
return new
|
|
716
|
+
return new ne({
|
|
748
717
|
schema: this,
|
|
749
|
-
typeName:
|
|
718
|
+
typeName: g.ZodEffects,
|
|
750
719
|
effect: { type: "refinement", refinement: e }
|
|
751
720
|
});
|
|
752
721
|
}
|
|
@@ -761,46 +730,46 @@ var ls = _r((ps, mt) => {
|
|
|
761
730
|
};
|
|
762
731
|
}
|
|
763
732
|
optional() {
|
|
764
|
-
return
|
|
733
|
+
return V.create(this, this._def);
|
|
765
734
|
}
|
|
766
735
|
nullable() {
|
|
767
|
-
return
|
|
736
|
+
return se.create(this, this._def);
|
|
768
737
|
}
|
|
769
738
|
nullish() {
|
|
770
739
|
return this.nullable().optional();
|
|
771
740
|
}
|
|
772
741
|
array() {
|
|
773
|
-
return
|
|
742
|
+
return P.create(this);
|
|
774
743
|
}
|
|
775
744
|
promise() {
|
|
776
|
-
return
|
|
745
|
+
return Se.create(this, this._def);
|
|
777
746
|
}
|
|
778
747
|
or(e) {
|
|
779
|
-
return
|
|
748
|
+
return xe.create([this, e], this._def);
|
|
780
749
|
}
|
|
781
750
|
and(e) {
|
|
782
|
-
return
|
|
751
|
+
return be.create(this, e, this._def);
|
|
783
752
|
}
|
|
784
753
|
transform(e) {
|
|
785
|
-
return new
|
|
754
|
+
return new ne({
|
|
786
755
|
...v(this._def),
|
|
787
756
|
schema: this,
|
|
788
|
-
typeName:
|
|
757
|
+
typeName: g.ZodEffects,
|
|
789
758
|
effect: { type: "transform", transform: e }
|
|
790
759
|
});
|
|
791
760
|
}
|
|
792
761
|
default(e) {
|
|
793
762
|
const r = typeof e == "function" ? e : () => e;
|
|
794
|
-
return new
|
|
763
|
+
return new je({
|
|
795
764
|
...v(this._def),
|
|
796
765
|
innerType: this,
|
|
797
766
|
defaultValue: r,
|
|
798
|
-
typeName:
|
|
767
|
+
typeName: g.ZodDefault
|
|
799
768
|
});
|
|
800
769
|
}
|
|
801
770
|
brand() {
|
|
802
|
-
return new
|
|
803
|
-
typeName:
|
|
771
|
+
return new Cr({
|
|
772
|
+
typeName: g.ZodBranded,
|
|
804
773
|
type: this,
|
|
805
774
|
...v(this._def)
|
|
806
775
|
});
|
|
@@ -811,7 +780,7 @@ var ls = _r((ps, mt) => {
|
|
|
811
780
|
...v(this._def),
|
|
812
781
|
innerType: this,
|
|
813
782
|
catchValue: r,
|
|
814
|
-
typeName:
|
|
783
|
+
typeName: g.ZodCatch
|
|
815
784
|
});
|
|
816
785
|
}
|
|
817
786
|
describe(e) {
|
|
@@ -822,7 +791,7 @@ var ls = _r((ps, mt) => {
|
|
|
822
791
|
});
|
|
823
792
|
}
|
|
824
793
|
pipe(e) {
|
|
825
|
-
return
|
|
794
|
+
return ze.create(this, e);
|
|
826
795
|
}
|
|
827
796
|
readonly() {
|
|
828
797
|
return Fe.create(this);
|
|
@@ -834,53 +803,58 @@ var ls = _r((ps, mt) => {
|
|
|
834
803
|
return this.safeParse(null).success;
|
|
835
804
|
}
|
|
836
805
|
}
|
|
837
|
-
const
|
|
838
|
-
let
|
|
839
|
-
const
|
|
840
|
-
function
|
|
841
|
-
let e = "
|
|
842
|
-
|
|
806
|
+
const dr = /^c[^\s-]{8,}$/i, cr = /^[0-9a-z]+$/, ur = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lr = /^[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, fr = /^[a-z0-9_-]{21}$/i, hr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pr = /^[-+]?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)?)??$/, mr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
807
|
+
let Ne;
|
|
808
|
+
const gr = /^(?:(?: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])$/, vr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, _r = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, kr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, gt = "((\\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])))", br = new RegExp(`^${gt}$`);
|
|
809
|
+
function vt(t) {
|
|
810
|
+
let e = "[0-5]\\d";
|
|
811
|
+
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
812
|
+
const r = t.precision ? "+" : "?";
|
|
813
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
843
814
|
}
|
|
844
|
-
function
|
|
845
|
-
return new RegExp(`^${
|
|
815
|
+
function Sr(t) {
|
|
816
|
+
return new RegExp(`^${vt(t)}$`);
|
|
846
817
|
}
|
|
847
|
-
function
|
|
848
|
-
let e = `${
|
|
818
|
+
function Or(t) {
|
|
819
|
+
let e = `${gt}T${vt(t)}`;
|
|
849
820
|
const r = [];
|
|
850
821
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
851
822
|
}
|
|
852
|
-
function
|
|
853
|
-
return !!((e === "v4" || !e) &&
|
|
823
|
+
function Er(t, e) {
|
|
824
|
+
return !!((e === "v4" || !e) && gr.test(t) || (e === "v6" || !e) && _r.test(t));
|
|
854
825
|
}
|
|
855
|
-
function
|
|
856
|
-
if (!
|
|
826
|
+
function Tr(t, e) {
|
|
827
|
+
if (!hr.test(t))
|
|
857
828
|
return !1;
|
|
858
829
|
try {
|
|
859
|
-
const [r] = t.split(".")
|
|
860
|
-
|
|
830
|
+
const [r] = t.split(".");
|
|
831
|
+
if (!r)
|
|
832
|
+
return !1;
|
|
833
|
+
const n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
834
|
+
return !(typeof s != "object" || s === null || "typ" in s && s?.typ !== "JWT" || !s.alg || e && s.alg !== e);
|
|
861
835
|
} catch {
|
|
862
836
|
return !1;
|
|
863
837
|
}
|
|
864
838
|
}
|
|
865
|
-
function
|
|
866
|
-
return !!((e === "v4" || !e) &&
|
|
839
|
+
function Nr(t, e) {
|
|
840
|
+
return !!((e === "v4" || !e) && vr.test(t) || (e === "v6" || !e) && kr.test(t));
|
|
867
841
|
}
|
|
868
|
-
class
|
|
842
|
+
class D extends k {
|
|
869
843
|
_parse(e) {
|
|
870
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
844
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
871
845
|
const a = this._getOrReturnCtx(e);
|
|
872
|
-
return
|
|
873
|
-
code:
|
|
874
|
-
expected:
|
|
846
|
+
return l(a, {
|
|
847
|
+
code: c.invalid_type,
|
|
848
|
+
expected: f.string,
|
|
875
849
|
received: a.parsedType
|
|
876
850
|
}), y;
|
|
877
851
|
}
|
|
878
|
-
const n = new
|
|
852
|
+
const n = new R();
|
|
879
853
|
let s;
|
|
880
854
|
for (const a of this._def.checks)
|
|
881
855
|
if (a.kind === "min")
|
|
882
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
883
|
-
code:
|
|
856
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
857
|
+
code: c.too_small,
|
|
884
858
|
minimum: a.value,
|
|
885
859
|
type: "string",
|
|
886
860
|
inclusive: !0,
|
|
@@ -888,8 +862,8 @@ var ls = _r((ps, mt) => {
|
|
|
888
862
|
message: a.message
|
|
889
863
|
}), n.dirty());
|
|
890
864
|
else if (a.kind === "max")
|
|
891
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
892
|
-
code:
|
|
865
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
866
|
+
code: c.too_big,
|
|
893
867
|
maximum: a.value,
|
|
894
868
|
type: "string",
|
|
895
869
|
inclusive: !0,
|
|
@@ -898,15 +872,15 @@ var ls = _r((ps, mt) => {
|
|
|
898
872
|
}), n.dirty());
|
|
899
873
|
else if (a.kind === "length") {
|
|
900
874
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
901
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
902
|
-
code:
|
|
875
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
876
|
+
code: c.too_big,
|
|
903
877
|
maximum: a.value,
|
|
904
878
|
type: "string",
|
|
905
879
|
inclusive: !0,
|
|
906
880
|
exact: !0,
|
|
907
881
|
message: a.message
|
|
908
|
-
}) : o &&
|
|
909
|
-
code:
|
|
882
|
+
}) : o && l(s, {
|
|
883
|
+
code: c.too_small,
|
|
910
884
|
minimum: a.value,
|
|
911
885
|
type: "string",
|
|
912
886
|
inclusive: !0,
|
|
@@ -914,169 +888,168 @@ var ls = _r((ps, mt) => {
|
|
|
914
888
|
message: a.message
|
|
915
889
|
}), n.dirty());
|
|
916
890
|
} else if (a.kind === "email")
|
|
917
|
-
|
|
891
|
+
mr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
918
892
|
validation: "email",
|
|
919
|
-
code:
|
|
893
|
+
code: c.invalid_string,
|
|
920
894
|
message: a.message
|
|
921
895
|
}), n.dirty());
|
|
922
896
|
else if (a.kind === "emoji")
|
|
923
|
-
|
|
897
|
+
Ne || (Ne = new RegExp(yr, "u")), Ne.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
924
898
|
validation: "emoji",
|
|
925
|
-
code:
|
|
899
|
+
code: c.invalid_string,
|
|
926
900
|
message: a.message
|
|
927
901
|
}), n.dirty());
|
|
928
902
|
else if (a.kind === "uuid")
|
|
929
|
-
|
|
903
|
+
lr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
930
904
|
validation: "uuid",
|
|
931
|
-
code:
|
|
905
|
+
code: c.invalid_string,
|
|
932
906
|
message: a.message
|
|
933
907
|
}), n.dirty());
|
|
934
908
|
else if (a.kind === "nanoid")
|
|
935
|
-
|
|
909
|
+
fr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
936
910
|
validation: "nanoid",
|
|
937
|
-
code:
|
|
911
|
+
code: c.invalid_string,
|
|
938
912
|
message: a.message
|
|
939
913
|
}), n.dirty());
|
|
940
914
|
else if (a.kind === "cuid")
|
|
941
|
-
|
|
915
|
+
dr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
942
916
|
validation: "cuid",
|
|
943
|
-
code:
|
|
917
|
+
code: c.invalid_string,
|
|
944
918
|
message: a.message
|
|
945
919
|
}), n.dirty());
|
|
946
920
|
else if (a.kind === "cuid2")
|
|
947
|
-
|
|
921
|
+
cr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
948
922
|
validation: "cuid2",
|
|
949
|
-
code:
|
|
923
|
+
code: c.invalid_string,
|
|
950
924
|
message: a.message
|
|
951
925
|
}), n.dirty());
|
|
952
926
|
else if (a.kind === "ulid")
|
|
953
|
-
|
|
927
|
+
ur.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
954
928
|
validation: "ulid",
|
|
955
|
-
code:
|
|
929
|
+
code: c.invalid_string,
|
|
956
930
|
message: a.message
|
|
957
931
|
}), n.dirty());
|
|
958
932
|
else if (a.kind === "url")
|
|
959
933
|
try {
|
|
960
934
|
new URL(e.data);
|
|
961
935
|
} catch {
|
|
962
|
-
s = this._getOrReturnCtx(e, s),
|
|
936
|
+
s = this._getOrReturnCtx(e, s), l(s, {
|
|
963
937
|
validation: "url",
|
|
964
|
-
code:
|
|
938
|
+
code: c.invalid_string,
|
|
965
939
|
message: a.message
|
|
966
940
|
}), n.dirty();
|
|
967
941
|
}
|
|
968
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
942
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
969
943
|
validation: "regex",
|
|
970
|
-
code:
|
|
944
|
+
code: c.invalid_string,
|
|
971
945
|
message: a.message
|
|
972
|
-
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s),
|
|
973
|
-
code:
|
|
946
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
947
|
+
code: c.invalid_string,
|
|
974
948
|
validation: { includes: a.value, position: a.position },
|
|
975
949
|
message: a.message
|
|
976
|
-
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
977
|
-
code:
|
|
950
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
951
|
+
code: c.invalid_string,
|
|
978
952
|
validation: { startsWith: a.value },
|
|
979
953
|
message: a.message
|
|
980
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
981
|
-
code:
|
|
954
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
955
|
+
code: c.invalid_string,
|
|
982
956
|
validation: { endsWith: a.value },
|
|
983
957
|
message: a.message
|
|
984
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
985
|
-
code:
|
|
958
|
+
}), n.dirty()) : a.kind === "datetime" ? Or(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
959
|
+
code: c.invalid_string,
|
|
986
960
|
validation: "datetime",
|
|
987
961
|
message: a.message
|
|
988
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
989
|
-
code:
|
|
962
|
+
}), n.dirty()) : a.kind === "date" ? br.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
963
|
+
code: c.invalid_string,
|
|
990
964
|
validation: "date",
|
|
991
965
|
message: a.message
|
|
992
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
993
|
-
code:
|
|
966
|
+
}), n.dirty()) : a.kind === "time" ? Sr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
967
|
+
code: c.invalid_string,
|
|
994
968
|
validation: "time",
|
|
995
969
|
message: a.message
|
|
996
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
970
|
+
}), n.dirty()) : a.kind === "duration" ? pr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
997
971
|
validation: "duration",
|
|
998
|
-
code:
|
|
972
|
+
code: c.invalid_string,
|
|
999
973
|
message: a.message
|
|
1000
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
974
|
+
}), n.dirty()) : a.kind === "ip" ? Er(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1001
975
|
validation: "ip",
|
|
1002
|
-
code:
|
|
976
|
+
code: c.invalid_string,
|
|
1003
977
|
message: a.message
|
|
1004
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
978
|
+
}), n.dirty()) : a.kind === "jwt" ? Tr(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1005
979
|
validation: "jwt",
|
|
1006
|
-
code:
|
|
980
|
+
code: c.invalid_string,
|
|
1007
981
|
message: a.message
|
|
1008
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
982
|
+
}), n.dirty()) : a.kind === "cidr" ? Nr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1009
983
|
validation: "cidr",
|
|
1010
|
-
code:
|
|
984
|
+
code: c.invalid_string,
|
|
1011
985
|
message: a.message
|
|
1012
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
986
|
+
}), n.dirty()) : a.kind === "base64" ? wr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1013
987
|
validation: "base64",
|
|
1014
|
-
code:
|
|
988
|
+
code: c.invalid_string,
|
|
1015
989
|
message: a.message
|
|
1016
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
990
|
+
}), n.dirty()) : a.kind === "base64url" ? xr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1017
991
|
validation: "base64url",
|
|
1018
|
-
code:
|
|
992
|
+
code: c.invalid_string,
|
|
1019
993
|
message: a.message
|
|
1020
|
-
}), n.dirty()) :
|
|
994
|
+
}), n.dirty()) : w.assertNever(a);
|
|
1021
995
|
return { status: n.value, value: e.data };
|
|
1022
996
|
}
|
|
1023
997
|
_regex(e, r, n) {
|
|
1024
998
|
return this.refinement((s) => e.test(s), {
|
|
1025
999
|
validation: r,
|
|
1026
|
-
code:
|
|
1027
|
-
...
|
|
1000
|
+
code: c.invalid_string,
|
|
1001
|
+
...p.errToObj(n)
|
|
1028
1002
|
});
|
|
1029
1003
|
}
|
|
1030
1004
|
_addCheck(e) {
|
|
1031
|
-
return new
|
|
1005
|
+
return new D({
|
|
1032
1006
|
...this._def,
|
|
1033
1007
|
checks: [...this._def.checks, e]
|
|
1034
1008
|
});
|
|
1035
1009
|
}
|
|
1036
1010
|
email(e) {
|
|
1037
|
-
return this._addCheck({ kind: "email", ...
|
|
1011
|
+
return this._addCheck({ kind: "email", ...p.errToObj(e) });
|
|
1038
1012
|
}
|
|
1039
1013
|
url(e) {
|
|
1040
|
-
return this._addCheck({ kind: "url", ...
|
|
1014
|
+
return this._addCheck({ kind: "url", ...p.errToObj(e) });
|
|
1041
1015
|
}
|
|
1042
1016
|
emoji(e) {
|
|
1043
|
-
return this._addCheck({ kind: "emoji", ...
|
|
1017
|
+
return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
|
|
1044
1018
|
}
|
|
1045
1019
|
uuid(e) {
|
|
1046
|
-
return this._addCheck({ kind: "uuid", ...
|
|
1020
|
+
return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
|
|
1047
1021
|
}
|
|
1048
1022
|
nanoid(e) {
|
|
1049
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
1023
|
+
return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
|
|
1050
1024
|
}
|
|
1051
1025
|
cuid(e) {
|
|
1052
|
-
return this._addCheck({ kind: "cuid", ...
|
|
1026
|
+
return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
|
|
1053
1027
|
}
|
|
1054
1028
|
cuid2(e) {
|
|
1055
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
1029
|
+
return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
|
|
1056
1030
|
}
|
|
1057
1031
|
ulid(e) {
|
|
1058
|
-
return this._addCheck({ kind: "ulid", ...
|
|
1032
|
+
return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
|
|
1059
1033
|
}
|
|
1060
1034
|
base64(e) {
|
|
1061
|
-
return this._addCheck({ kind: "base64", ...
|
|
1035
|
+
return this._addCheck({ kind: "base64", ...p.errToObj(e) });
|
|
1062
1036
|
}
|
|
1063
1037
|
base64url(e) {
|
|
1064
1038
|
return this._addCheck({
|
|
1065
1039
|
kind: "base64url",
|
|
1066
|
-
...
|
|
1040
|
+
...p.errToObj(e)
|
|
1067
1041
|
});
|
|
1068
1042
|
}
|
|
1069
1043
|
jwt(e) {
|
|
1070
|
-
return this._addCheck({ kind: "jwt", ...
|
|
1044
|
+
return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
|
|
1071
1045
|
}
|
|
1072
1046
|
ip(e) {
|
|
1073
|
-
return this._addCheck({ kind: "ip", ...
|
|
1047
|
+
return this._addCheck({ kind: "ip", ...p.errToObj(e) });
|
|
1074
1048
|
}
|
|
1075
1049
|
cidr(e) {
|
|
1076
|
-
return this._addCheck({ kind: "cidr", ...
|
|
1050
|
+
return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
|
|
1077
1051
|
}
|
|
1078
1052
|
datetime(e) {
|
|
1079
|
-
var r, n;
|
|
1080
1053
|
return typeof e == "string" ? this._addCheck({
|
|
1081
1054
|
kind: "datetime",
|
|
1082
1055
|
precision: null,
|
|
@@ -1086,9 +1059,9 @@ var ls = _r((ps, mt) => {
|
|
|
1086
1059
|
}) : this._addCheck({
|
|
1087
1060
|
kind: "datetime",
|
|
1088
1061
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
1089
|
-
offset:
|
|
1090
|
-
local:
|
|
1091
|
-
...
|
|
1062
|
+
offset: e?.offset ?? !1,
|
|
1063
|
+
local: e?.local ?? !1,
|
|
1064
|
+
...p.errToObj(e?.message)
|
|
1092
1065
|
});
|
|
1093
1066
|
}
|
|
1094
1067
|
date(e) {
|
|
@@ -1102,17 +1075,17 @@ var ls = _r((ps, mt) => {
|
|
|
1102
1075
|
}) : this._addCheck({
|
|
1103
1076
|
kind: "time",
|
|
1104
1077
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
1105
|
-
...
|
|
1078
|
+
...p.errToObj(e?.message)
|
|
1106
1079
|
});
|
|
1107
1080
|
}
|
|
1108
1081
|
duration(e) {
|
|
1109
|
-
return this._addCheck({ kind: "duration", ...
|
|
1082
|
+
return this._addCheck({ kind: "duration", ...p.errToObj(e) });
|
|
1110
1083
|
}
|
|
1111
1084
|
regex(e, r) {
|
|
1112
1085
|
return this._addCheck({
|
|
1113
1086
|
kind: "regex",
|
|
1114
1087
|
regex: e,
|
|
1115
|
-
...
|
|
1088
|
+
...p.errToObj(r)
|
|
1116
1089
|
});
|
|
1117
1090
|
}
|
|
1118
1091
|
includes(e, r) {
|
|
@@ -1120,64 +1093,64 @@ var ls = _r((ps, mt) => {
|
|
|
1120
1093
|
kind: "includes",
|
|
1121
1094
|
value: e,
|
|
1122
1095
|
position: r?.position,
|
|
1123
|
-
...
|
|
1096
|
+
...p.errToObj(r?.message)
|
|
1124
1097
|
});
|
|
1125
1098
|
}
|
|
1126
1099
|
startsWith(e, r) {
|
|
1127
1100
|
return this._addCheck({
|
|
1128
1101
|
kind: "startsWith",
|
|
1129
1102
|
value: e,
|
|
1130
|
-
...
|
|
1103
|
+
...p.errToObj(r)
|
|
1131
1104
|
});
|
|
1132
1105
|
}
|
|
1133
1106
|
endsWith(e, r) {
|
|
1134
1107
|
return this._addCheck({
|
|
1135
1108
|
kind: "endsWith",
|
|
1136
1109
|
value: e,
|
|
1137
|
-
...
|
|
1110
|
+
...p.errToObj(r)
|
|
1138
1111
|
});
|
|
1139
1112
|
}
|
|
1140
1113
|
min(e, r) {
|
|
1141
1114
|
return this._addCheck({
|
|
1142
1115
|
kind: "min",
|
|
1143
1116
|
value: e,
|
|
1144
|
-
...
|
|
1117
|
+
...p.errToObj(r)
|
|
1145
1118
|
});
|
|
1146
1119
|
}
|
|
1147
1120
|
max(e, r) {
|
|
1148
1121
|
return this._addCheck({
|
|
1149
1122
|
kind: "max",
|
|
1150
1123
|
value: e,
|
|
1151
|
-
...
|
|
1124
|
+
...p.errToObj(r)
|
|
1152
1125
|
});
|
|
1153
1126
|
}
|
|
1154
1127
|
length(e, r) {
|
|
1155
1128
|
return this._addCheck({
|
|
1156
1129
|
kind: "length",
|
|
1157
1130
|
value: e,
|
|
1158
|
-
...
|
|
1131
|
+
...p.errToObj(r)
|
|
1159
1132
|
});
|
|
1160
1133
|
}
|
|
1161
1134
|
/**
|
|
1162
1135
|
* Equivalent to `.min(1)`
|
|
1163
1136
|
*/
|
|
1164
1137
|
nonempty(e) {
|
|
1165
|
-
return this.min(1,
|
|
1138
|
+
return this.min(1, p.errToObj(e));
|
|
1166
1139
|
}
|
|
1167
1140
|
trim() {
|
|
1168
|
-
return new
|
|
1141
|
+
return new D({
|
|
1169
1142
|
...this._def,
|
|
1170
1143
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1171
1144
|
});
|
|
1172
1145
|
}
|
|
1173
1146
|
toLowerCase() {
|
|
1174
|
-
return new
|
|
1147
|
+
return new D({
|
|
1175
1148
|
...this._def,
|
|
1176
1149
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1177
1150
|
});
|
|
1178
1151
|
}
|
|
1179
1152
|
toUpperCase() {
|
|
1180
|
-
return new
|
|
1153
|
+
return new D({
|
|
1181
1154
|
...this._def,
|
|
1182
1155
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1183
1156
|
});
|
|
@@ -1243,78 +1216,75 @@ var ls = _r((ps, mt) => {
|
|
|
1243
1216
|
return e;
|
|
1244
1217
|
}
|
|
1245
1218
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
function en(t, e) {
|
|
1256
|
-
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1257
|
-
return a % i / Math.pow(10, s);
|
|
1219
|
+
D.create = (t) => new D({
|
|
1220
|
+
checks: [],
|
|
1221
|
+
typeName: g.ZodString,
|
|
1222
|
+
coerce: t?.coerce ?? !1,
|
|
1223
|
+
...v(t)
|
|
1224
|
+
});
|
|
1225
|
+
function Rr(t, e) {
|
|
1226
|
+
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = Number.parseInt(t.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1227
|
+
return a % i / 10 ** s;
|
|
1258
1228
|
}
|
|
1259
|
-
class
|
|
1229
|
+
class le extends k {
|
|
1260
1230
|
constructor() {
|
|
1261
1231
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1262
1232
|
}
|
|
1263
1233
|
_parse(e) {
|
|
1264
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1234
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1265
1235
|
const a = this._getOrReturnCtx(e);
|
|
1266
|
-
return
|
|
1267
|
-
code:
|
|
1268
|
-
expected:
|
|
1236
|
+
return l(a, {
|
|
1237
|
+
code: c.invalid_type,
|
|
1238
|
+
expected: f.number,
|
|
1269
1239
|
received: a.parsedType
|
|
1270
1240
|
}), y;
|
|
1271
1241
|
}
|
|
1272
1242
|
let n;
|
|
1273
|
-
const s = new
|
|
1243
|
+
const s = new R();
|
|
1274
1244
|
for (const a of this._def.checks)
|
|
1275
|
-
a.kind === "int" ?
|
|
1276
|
-
code:
|
|
1245
|
+
a.kind === "int" ? w.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1246
|
+
code: c.invalid_type,
|
|
1277
1247
|
expected: "integer",
|
|
1278
1248
|
received: "float",
|
|
1279
1249
|
message: a.message
|
|
1280
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1281
|
-
code:
|
|
1250
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1251
|
+
code: c.too_small,
|
|
1282
1252
|
minimum: a.value,
|
|
1283
1253
|
type: "number",
|
|
1284
1254
|
inclusive: a.inclusive,
|
|
1285
1255
|
exact: !1,
|
|
1286
1256
|
message: a.message
|
|
1287
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1288
|
-
code:
|
|
1257
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1258
|
+
code: c.too_big,
|
|
1289
1259
|
maximum: a.value,
|
|
1290
1260
|
type: "number",
|
|
1291
1261
|
inclusive: a.inclusive,
|
|
1292
1262
|
exact: !1,
|
|
1293
1263
|
message: a.message
|
|
1294
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1295
|
-
code:
|
|
1264
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Rr(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1265
|
+
code: c.not_multiple_of,
|
|
1296
1266
|
multipleOf: a.value,
|
|
1297
1267
|
message: a.message
|
|
1298
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1299
|
-
code:
|
|
1268
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1269
|
+
code: c.not_finite,
|
|
1300
1270
|
message: a.message
|
|
1301
|
-
}), s.dirty()) :
|
|
1271
|
+
}), s.dirty()) : w.assertNever(a);
|
|
1302
1272
|
return { status: s.value, value: e.data };
|
|
1303
1273
|
}
|
|
1304
1274
|
gte(e, r) {
|
|
1305
|
-
return this.setLimit("min", e, !0,
|
|
1275
|
+
return this.setLimit("min", e, !0, p.toString(r));
|
|
1306
1276
|
}
|
|
1307
1277
|
gt(e, r) {
|
|
1308
|
-
return this.setLimit("min", e, !1,
|
|
1278
|
+
return this.setLimit("min", e, !1, p.toString(r));
|
|
1309
1279
|
}
|
|
1310
1280
|
lte(e, r) {
|
|
1311
|
-
return this.setLimit("max", e, !0,
|
|
1281
|
+
return this.setLimit("max", e, !0, p.toString(r));
|
|
1312
1282
|
}
|
|
1313
1283
|
lt(e, r) {
|
|
1314
|
-
return this.setLimit("max", e, !1,
|
|
1284
|
+
return this.setLimit("max", e, !1, p.toString(r));
|
|
1315
1285
|
}
|
|
1316
1286
|
setLimit(e, r, n, s) {
|
|
1317
|
-
return new
|
|
1287
|
+
return new le({
|
|
1318
1288
|
...this._def,
|
|
1319
1289
|
checks: [
|
|
1320
1290
|
...this._def.checks,
|
|
@@ -1322,13 +1292,13 @@ var ls = _r((ps, mt) => {
|
|
|
1322
1292
|
kind: e,
|
|
1323
1293
|
value: r,
|
|
1324
1294
|
inclusive: n,
|
|
1325
|
-
message:
|
|
1295
|
+
message: p.toString(s)
|
|
1326
1296
|
}
|
|
1327
1297
|
]
|
|
1328
1298
|
});
|
|
1329
1299
|
}
|
|
1330
1300
|
_addCheck(e) {
|
|
1331
|
-
return new
|
|
1301
|
+
return new le({
|
|
1332
1302
|
...this._def,
|
|
1333
1303
|
checks: [...this._def.checks, e]
|
|
1334
1304
|
});
|
|
@@ -1336,7 +1306,7 @@ var ls = _r((ps, mt) => {
|
|
|
1336
1306
|
int(e) {
|
|
1337
1307
|
return this._addCheck({
|
|
1338
1308
|
kind: "int",
|
|
1339
|
-
message:
|
|
1309
|
+
message: p.toString(e)
|
|
1340
1310
|
});
|
|
1341
1311
|
}
|
|
1342
1312
|
positive(e) {
|
|
@@ -1344,7 +1314,7 @@ var ls = _r((ps, mt) => {
|
|
|
1344
1314
|
kind: "min",
|
|
1345
1315
|
value: 0,
|
|
1346
1316
|
inclusive: !1,
|
|
1347
|
-
message:
|
|
1317
|
+
message: p.toString(e)
|
|
1348
1318
|
});
|
|
1349
1319
|
}
|
|
1350
1320
|
negative(e) {
|
|
@@ -1352,7 +1322,7 @@ var ls = _r((ps, mt) => {
|
|
|
1352
1322
|
kind: "max",
|
|
1353
1323
|
value: 0,
|
|
1354
1324
|
inclusive: !1,
|
|
1355
|
-
message:
|
|
1325
|
+
message: p.toString(e)
|
|
1356
1326
|
});
|
|
1357
1327
|
}
|
|
1358
1328
|
nonpositive(e) {
|
|
@@ -1360,7 +1330,7 @@ var ls = _r((ps, mt) => {
|
|
|
1360
1330
|
kind: "max",
|
|
1361
1331
|
value: 0,
|
|
1362
1332
|
inclusive: !0,
|
|
1363
|
-
message:
|
|
1333
|
+
message: p.toString(e)
|
|
1364
1334
|
});
|
|
1365
1335
|
}
|
|
1366
1336
|
nonnegative(e) {
|
|
@@ -1368,20 +1338,20 @@ var ls = _r((ps, mt) => {
|
|
|
1368
1338
|
kind: "min",
|
|
1369
1339
|
value: 0,
|
|
1370
1340
|
inclusive: !0,
|
|
1371
|
-
message:
|
|
1341
|
+
message: p.toString(e)
|
|
1372
1342
|
});
|
|
1373
1343
|
}
|
|
1374
1344
|
multipleOf(e, r) {
|
|
1375
1345
|
return this._addCheck({
|
|
1376
1346
|
kind: "multipleOf",
|
|
1377
1347
|
value: e,
|
|
1378
|
-
message:
|
|
1348
|
+
message: p.toString(r)
|
|
1379
1349
|
});
|
|
1380
1350
|
}
|
|
1381
1351
|
finite(e) {
|
|
1382
1352
|
return this._addCheck({
|
|
1383
1353
|
kind: "finite",
|
|
1384
|
-
message:
|
|
1354
|
+
message: p.toString(e)
|
|
1385
1355
|
});
|
|
1386
1356
|
}
|
|
1387
1357
|
safe(e) {
|
|
@@ -1389,12 +1359,12 @@ var ls = _r((ps, mt) => {
|
|
|
1389
1359
|
kind: "min",
|
|
1390
1360
|
inclusive: !0,
|
|
1391
1361
|
value: Number.MIN_SAFE_INTEGER,
|
|
1392
|
-
message:
|
|
1362
|
+
message: p.toString(e)
|
|
1393
1363
|
})._addCheck({
|
|
1394
1364
|
kind: "max",
|
|
1395
1365
|
inclusive: !0,
|
|
1396
1366
|
value: Number.MAX_SAFE_INTEGER,
|
|
1397
|
-
message:
|
|
1367
|
+
message: p.toString(e)
|
|
1398
1368
|
});
|
|
1399
1369
|
}
|
|
1400
1370
|
get minValue() {
|
|
@@ -1410,7 +1380,7 @@ var ls = _r((ps, mt) => {
|
|
|
1410
1380
|
return e;
|
|
1411
1381
|
}
|
|
1412
1382
|
get isInt() {
|
|
1413
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1383
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && w.isInteger(e.value));
|
|
1414
1384
|
}
|
|
1415
1385
|
get isFinite() {
|
|
1416
1386
|
let e = null, r = null;
|
|
@@ -1422,13 +1392,13 @@ var ls = _r((ps, mt) => {
|
|
|
1422
1392
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1423
1393
|
}
|
|
1424
1394
|
}
|
|
1425
|
-
|
|
1395
|
+
le.create = (t) => new le({
|
|
1426
1396
|
checks: [],
|
|
1427
|
-
typeName:
|
|
1397
|
+
typeName: g.ZodNumber,
|
|
1428
1398
|
coerce: t?.coerce || !1,
|
|
1429
1399
|
...v(t)
|
|
1430
1400
|
});
|
|
1431
|
-
class
|
|
1401
|
+
class fe extends k {
|
|
1432
1402
|
constructor() {
|
|
1433
1403
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1434
1404
|
}
|
|
@@ -1439,52 +1409,52 @@ var ls = _r((ps, mt) => {
|
|
|
1439
1409
|
} catch {
|
|
1440
1410
|
return this._getInvalidInput(e);
|
|
1441
1411
|
}
|
|
1442
|
-
if (this._getType(e) !==
|
|
1412
|
+
if (this._getType(e) !== f.bigint)
|
|
1443
1413
|
return this._getInvalidInput(e);
|
|
1444
1414
|
let n;
|
|
1445
|
-
const s = new
|
|
1415
|
+
const s = new R();
|
|
1446
1416
|
for (const a of this._def.checks)
|
|
1447
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1448
|
-
code:
|
|
1417
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1418
|
+
code: c.too_small,
|
|
1449
1419
|
type: "bigint",
|
|
1450
1420
|
minimum: a.value,
|
|
1451
1421
|
inclusive: a.inclusive,
|
|
1452
1422
|
message: a.message
|
|
1453
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1454
|
-
code:
|
|
1423
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1424
|
+
code: c.too_big,
|
|
1455
1425
|
type: "bigint",
|
|
1456
1426
|
maximum: a.value,
|
|
1457
1427
|
inclusive: a.inclusive,
|
|
1458
1428
|
message: a.message
|
|
1459
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1460
|
-
code:
|
|
1429
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1430
|
+
code: c.not_multiple_of,
|
|
1461
1431
|
multipleOf: a.value,
|
|
1462
1432
|
message: a.message
|
|
1463
|
-
}), s.dirty()) :
|
|
1433
|
+
}), s.dirty()) : w.assertNever(a);
|
|
1464
1434
|
return { status: s.value, value: e.data };
|
|
1465
1435
|
}
|
|
1466
1436
|
_getInvalidInput(e) {
|
|
1467
1437
|
const r = this._getOrReturnCtx(e);
|
|
1468
|
-
return
|
|
1469
|
-
code:
|
|
1470
|
-
expected:
|
|
1438
|
+
return l(r, {
|
|
1439
|
+
code: c.invalid_type,
|
|
1440
|
+
expected: f.bigint,
|
|
1471
1441
|
received: r.parsedType
|
|
1472
1442
|
}), y;
|
|
1473
1443
|
}
|
|
1474
1444
|
gte(e, r) {
|
|
1475
|
-
return this.setLimit("min", e, !0,
|
|
1445
|
+
return this.setLimit("min", e, !0, p.toString(r));
|
|
1476
1446
|
}
|
|
1477
1447
|
gt(e, r) {
|
|
1478
|
-
return this.setLimit("min", e, !1,
|
|
1448
|
+
return this.setLimit("min", e, !1, p.toString(r));
|
|
1479
1449
|
}
|
|
1480
1450
|
lte(e, r) {
|
|
1481
|
-
return this.setLimit("max", e, !0,
|
|
1451
|
+
return this.setLimit("max", e, !0, p.toString(r));
|
|
1482
1452
|
}
|
|
1483
1453
|
lt(e, r) {
|
|
1484
|
-
return this.setLimit("max", e, !1,
|
|
1454
|
+
return this.setLimit("max", e, !1, p.toString(r));
|
|
1485
1455
|
}
|
|
1486
1456
|
setLimit(e, r, n, s) {
|
|
1487
|
-
return new
|
|
1457
|
+
return new fe({
|
|
1488
1458
|
...this._def,
|
|
1489
1459
|
checks: [
|
|
1490
1460
|
...this._def.checks,
|
|
@@ -1492,13 +1462,13 @@ var ls = _r((ps, mt) => {
|
|
|
1492
1462
|
kind: e,
|
|
1493
1463
|
value: r,
|
|
1494
1464
|
inclusive: n,
|
|
1495
|
-
message:
|
|
1465
|
+
message: p.toString(s)
|
|
1496
1466
|
}
|
|
1497
1467
|
]
|
|
1498
1468
|
});
|
|
1499
1469
|
}
|
|
1500
1470
|
_addCheck(e) {
|
|
1501
|
-
return new
|
|
1471
|
+
return new fe({
|
|
1502
1472
|
...this._def,
|
|
1503
1473
|
checks: [...this._def.checks, e]
|
|
1504
1474
|
});
|
|
@@ -1508,7 +1478,7 @@ var ls = _r((ps, mt) => {
|
|
|
1508
1478
|
kind: "min",
|
|
1509
1479
|
value: BigInt(0),
|
|
1510
1480
|
inclusive: !1,
|
|
1511
|
-
message:
|
|
1481
|
+
message: p.toString(e)
|
|
1512
1482
|
});
|
|
1513
1483
|
}
|
|
1514
1484
|
negative(e) {
|
|
@@ -1516,7 +1486,7 @@ var ls = _r((ps, mt) => {
|
|
|
1516
1486
|
kind: "max",
|
|
1517
1487
|
value: BigInt(0),
|
|
1518
1488
|
inclusive: !1,
|
|
1519
|
-
message:
|
|
1489
|
+
message: p.toString(e)
|
|
1520
1490
|
});
|
|
1521
1491
|
}
|
|
1522
1492
|
nonpositive(e) {
|
|
@@ -1524,7 +1494,7 @@ var ls = _r((ps, mt) => {
|
|
|
1524
1494
|
kind: "max",
|
|
1525
1495
|
value: BigInt(0),
|
|
1526
1496
|
inclusive: !0,
|
|
1527
|
-
message:
|
|
1497
|
+
message: p.toString(e)
|
|
1528
1498
|
});
|
|
1529
1499
|
}
|
|
1530
1500
|
nonnegative(e) {
|
|
@@ -1532,14 +1502,14 @@ var ls = _r((ps, mt) => {
|
|
|
1532
1502
|
kind: "min",
|
|
1533
1503
|
value: BigInt(0),
|
|
1534
1504
|
inclusive: !0,
|
|
1535
|
-
message:
|
|
1505
|
+
message: p.toString(e)
|
|
1536
1506
|
});
|
|
1537
1507
|
}
|
|
1538
1508
|
multipleOf(e, r) {
|
|
1539
1509
|
return this._addCheck({
|
|
1540
1510
|
kind: "multipleOf",
|
|
1541
1511
|
value: e,
|
|
1542
|
-
message:
|
|
1512
|
+
message: p.toString(r)
|
|
1543
1513
|
});
|
|
1544
1514
|
}
|
|
1545
1515
|
get minValue() {
|
|
@@ -1555,74 +1525,71 @@ var ls = _r((ps, mt) => {
|
|
|
1555
1525
|
return e;
|
|
1556
1526
|
}
|
|
1557
1527
|
}
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
});
|
|
1566
|
-
};
|
|
1567
|
-
class Ee extends _ {
|
|
1528
|
+
fe.create = (t) => new fe({
|
|
1529
|
+
checks: [],
|
|
1530
|
+
typeName: g.ZodBigInt,
|
|
1531
|
+
coerce: t?.coerce ?? !1,
|
|
1532
|
+
...v(t)
|
|
1533
|
+
});
|
|
1534
|
+
class tt extends k {
|
|
1568
1535
|
_parse(e) {
|
|
1569
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1536
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1570
1537
|
const n = this._getOrReturnCtx(e);
|
|
1571
|
-
return
|
|
1572
|
-
code:
|
|
1573
|
-
expected:
|
|
1538
|
+
return l(n, {
|
|
1539
|
+
code: c.invalid_type,
|
|
1540
|
+
expected: f.boolean,
|
|
1574
1541
|
received: n.parsedType
|
|
1575
1542
|
}), y;
|
|
1576
1543
|
}
|
|
1577
|
-
return
|
|
1544
|
+
return C(e.data);
|
|
1578
1545
|
}
|
|
1579
1546
|
}
|
|
1580
|
-
|
|
1581
|
-
typeName:
|
|
1547
|
+
tt.create = (t) => new tt({
|
|
1548
|
+
typeName: g.ZodBoolean,
|
|
1582
1549
|
coerce: t?.coerce || !1,
|
|
1583
1550
|
...v(t)
|
|
1584
1551
|
});
|
|
1585
|
-
class
|
|
1552
|
+
class we extends k {
|
|
1586
1553
|
_parse(e) {
|
|
1587
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1554
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1588
1555
|
const a = this._getOrReturnCtx(e);
|
|
1589
|
-
return
|
|
1590
|
-
code:
|
|
1591
|
-
expected:
|
|
1556
|
+
return l(a, {
|
|
1557
|
+
code: c.invalid_type,
|
|
1558
|
+
expected: f.date,
|
|
1592
1559
|
received: a.parsedType
|
|
1593
1560
|
}), y;
|
|
1594
1561
|
}
|
|
1595
|
-
if (isNaN(e.data.getTime())) {
|
|
1562
|
+
if (Number.isNaN(e.data.getTime())) {
|
|
1596
1563
|
const a = this._getOrReturnCtx(e);
|
|
1597
|
-
return
|
|
1598
|
-
code:
|
|
1564
|
+
return l(a, {
|
|
1565
|
+
code: c.invalid_date
|
|
1599
1566
|
}), y;
|
|
1600
1567
|
}
|
|
1601
|
-
const n = new
|
|
1568
|
+
const n = new R();
|
|
1602
1569
|
let s;
|
|
1603
1570
|
for (const a of this._def.checks)
|
|
1604
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1605
|
-
code:
|
|
1571
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1572
|
+
code: c.too_small,
|
|
1606
1573
|
message: a.message,
|
|
1607
1574
|
inclusive: !0,
|
|
1608
1575
|
exact: !1,
|
|
1609
1576
|
minimum: a.value,
|
|
1610
1577
|
type: "date"
|
|
1611
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1612
|
-
code:
|
|
1578
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1579
|
+
code: c.too_big,
|
|
1613
1580
|
message: a.message,
|
|
1614
1581
|
inclusive: !0,
|
|
1615
1582
|
exact: !1,
|
|
1616
1583
|
maximum: a.value,
|
|
1617
1584
|
type: "date"
|
|
1618
|
-
}), n.dirty()) :
|
|
1585
|
+
}), n.dirty()) : w.assertNever(a);
|
|
1619
1586
|
return {
|
|
1620
1587
|
status: n.value,
|
|
1621
1588
|
value: new Date(e.data.getTime())
|
|
1622
1589
|
};
|
|
1623
1590
|
}
|
|
1624
1591
|
_addCheck(e) {
|
|
1625
|
-
return new
|
|
1592
|
+
return new we({
|
|
1626
1593
|
...this._def,
|
|
1627
1594
|
checks: [...this._def.checks, e]
|
|
1628
1595
|
});
|
|
@@ -1631,14 +1598,14 @@ var ls = _r((ps, mt) => {
|
|
|
1631
1598
|
return this._addCheck({
|
|
1632
1599
|
kind: "min",
|
|
1633
1600
|
value: e.getTime(),
|
|
1634
|
-
message:
|
|
1601
|
+
message: p.toString(r)
|
|
1635
1602
|
});
|
|
1636
1603
|
}
|
|
1637
1604
|
max(e, r) {
|
|
1638
1605
|
return this._addCheck({
|
|
1639
1606
|
kind: "max",
|
|
1640
1607
|
value: e.getTime(),
|
|
1641
|
-
message:
|
|
1608
|
+
message: p.toString(r)
|
|
1642
1609
|
});
|
|
1643
1610
|
}
|
|
1644
1611
|
get minDate() {
|
|
@@ -1654,131 +1621,131 @@ var ls = _r((ps, mt) => {
|
|
|
1654
1621
|
return e != null ? new Date(e) : null;
|
|
1655
1622
|
}
|
|
1656
1623
|
}
|
|
1657
|
-
|
|
1624
|
+
we.create = (t) => new we({
|
|
1658
1625
|
checks: [],
|
|
1659
1626
|
coerce: t?.coerce || !1,
|
|
1660
|
-
typeName:
|
|
1627
|
+
typeName: g.ZodDate,
|
|
1661
1628
|
...v(t)
|
|
1662
1629
|
});
|
|
1663
|
-
class
|
|
1630
|
+
class rt extends k {
|
|
1664
1631
|
_parse(e) {
|
|
1665
|
-
if (this._getType(e) !==
|
|
1632
|
+
if (this._getType(e) !== f.symbol) {
|
|
1666
1633
|
const n = this._getOrReturnCtx(e);
|
|
1667
|
-
return
|
|
1668
|
-
code:
|
|
1669
|
-
expected:
|
|
1634
|
+
return l(n, {
|
|
1635
|
+
code: c.invalid_type,
|
|
1636
|
+
expected: f.symbol,
|
|
1670
1637
|
received: n.parsedType
|
|
1671
1638
|
}), y;
|
|
1672
1639
|
}
|
|
1673
|
-
return
|
|
1640
|
+
return C(e.data);
|
|
1674
1641
|
}
|
|
1675
1642
|
}
|
|
1676
|
-
|
|
1677
|
-
typeName:
|
|
1643
|
+
rt.create = (t) => new rt({
|
|
1644
|
+
typeName: g.ZodSymbol,
|
|
1678
1645
|
...v(t)
|
|
1679
1646
|
});
|
|
1680
|
-
class
|
|
1647
|
+
class nt extends k {
|
|
1681
1648
|
_parse(e) {
|
|
1682
|
-
if (this._getType(e) !==
|
|
1649
|
+
if (this._getType(e) !== f.undefined) {
|
|
1683
1650
|
const n = this._getOrReturnCtx(e);
|
|
1684
|
-
return
|
|
1685
|
-
code:
|
|
1686
|
-
expected:
|
|
1651
|
+
return l(n, {
|
|
1652
|
+
code: c.invalid_type,
|
|
1653
|
+
expected: f.undefined,
|
|
1687
1654
|
received: n.parsedType
|
|
1688
1655
|
}), y;
|
|
1689
1656
|
}
|
|
1690
|
-
return
|
|
1657
|
+
return C(e.data);
|
|
1691
1658
|
}
|
|
1692
1659
|
}
|
|
1693
|
-
|
|
1694
|
-
typeName:
|
|
1660
|
+
nt.create = (t) => new nt({
|
|
1661
|
+
typeName: g.ZodUndefined,
|
|
1695
1662
|
...v(t)
|
|
1696
1663
|
});
|
|
1697
|
-
class
|
|
1664
|
+
class st extends k {
|
|
1698
1665
|
_parse(e) {
|
|
1699
|
-
if (this._getType(e) !==
|
|
1666
|
+
if (this._getType(e) !== f.null) {
|
|
1700
1667
|
const n = this._getOrReturnCtx(e);
|
|
1701
|
-
return
|
|
1702
|
-
code:
|
|
1703
|
-
expected:
|
|
1668
|
+
return l(n, {
|
|
1669
|
+
code: c.invalid_type,
|
|
1670
|
+
expected: f.null,
|
|
1704
1671
|
received: n.parsedType
|
|
1705
1672
|
}), y;
|
|
1706
1673
|
}
|
|
1707
|
-
return
|
|
1674
|
+
return C(e.data);
|
|
1708
1675
|
}
|
|
1709
1676
|
}
|
|
1710
|
-
|
|
1711
|
-
typeName:
|
|
1677
|
+
st.create = (t) => new st({
|
|
1678
|
+
typeName: g.ZodNull,
|
|
1712
1679
|
...v(t)
|
|
1713
1680
|
});
|
|
1714
|
-
class
|
|
1681
|
+
class at extends k {
|
|
1715
1682
|
constructor() {
|
|
1716
1683
|
super(...arguments), this._any = !0;
|
|
1717
1684
|
}
|
|
1718
1685
|
_parse(e) {
|
|
1719
|
-
return
|
|
1686
|
+
return C(e.data);
|
|
1720
1687
|
}
|
|
1721
1688
|
}
|
|
1722
|
-
|
|
1723
|
-
typeName:
|
|
1689
|
+
at.create = (t) => new at({
|
|
1690
|
+
typeName: g.ZodAny,
|
|
1724
1691
|
...v(t)
|
|
1725
1692
|
});
|
|
1726
|
-
class
|
|
1693
|
+
class it extends k {
|
|
1727
1694
|
constructor() {
|
|
1728
1695
|
super(...arguments), this._unknown = !0;
|
|
1729
1696
|
}
|
|
1730
1697
|
_parse(e) {
|
|
1731
|
-
return
|
|
1698
|
+
return C(e.data);
|
|
1732
1699
|
}
|
|
1733
1700
|
}
|
|
1734
|
-
|
|
1735
|
-
typeName:
|
|
1701
|
+
it.create = (t) => new it({
|
|
1702
|
+
typeName: g.ZodUnknown,
|
|
1736
1703
|
...v(t)
|
|
1737
1704
|
});
|
|
1738
|
-
class
|
|
1705
|
+
class U extends k {
|
|
1739
1706
|
_parse(e) {
|
|
1740
1707
|
const r = this._getOrReturnCtx(e);
|
|
1741
|
-
return
|
|
1742
|
-
code:
|
|
1743
|
-
expected:
|
|
1708
|
+
return l(r, {
|
|
1709
|
+
code: c.invalid_type,
|
|
1710
|
+
expected: f.never,
|
|
1744
1711
|
received: r.parsedType
|
|
1745
1712
|
}), y;
|
|
1746
1713
|
}
|
|
1747
1714
|
}
|
|
1748
|
-
|
|
1749
|
-
typeName:
|
|
1715
|
+
U.create = (t) => new U({
|
|
1716
|
+
typeName: g.ZodNever,
|
|
1750
1717
|
...v(t)
|
|
1751
1718
|
});
|
|
1752
|
-
class
|
|
1719
|
+
class ot extends k {
|
|
1753
1720
|
_parse(e) {
|
|
1754
|
-
if (this._getType(e) !==
|
|
1721
|
+
if (this._getType(e) !== f.undefined) {
|
|
1755
1722
|
const n = this._getOrReturnCtx(e);
|
|
1756
|
-
return
|
|
1757
|
-
code:
|
|
1758
|
-
expected:
|
|
1723
|
+
return l(n, {
|
|
1724
|
+
code: c.invalid_type,
|
|
1725
|
+
expected: f.void,
|
|
1759
1726
|
received: n.parsedType
|
|
1760
1727
|
}), y;
|
|
1761
1728
|
}
|
|
1762
|
-
return
|
|
1729
|
+
return C(e.data);
|
|
1763
1730
|
}
|
|
1764
1731
|
}
|
|
1765
|
-
|
|
1766
|
-
typeName:
|
|
1732
|
+
ot.create = (t) => new ot({
|
|
1733
|
+
typeName: g.ZodVoid,
|
|
1767
1734
|
...v(t)
|
|
1768
1735
|
});
|
|
1769
|
-
class
|
|
1736
|
+
class P extends k {
|
|
1770
1737
|
_parse(e) {
|
|
1771
1738
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
1772
|
-
if (r.parsedType !==
|
|
1773
|
-
return
|
|
1774
|
-
code:
|
|
1775
|
-
expected:
|
|
1739
|
+
if (r.parsedType !== f.array)
|
|
1740
|
+
return l(r, {
|
|
1741
|
+
code: c.invalid_type,
|
|
1742
|
+
expected: f.array,
|
|
1776
1743
|
received: r.parsedType
|
|
1777
1744
|
}), y;
|
|
1778
1745
|
if (s.exactLength !== null) {
|
|
1779
1746
|
const i = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
|
|
1780
|
-
(i || o) && (
|
|
1781
|
-
code: i ?
|
|
1747
|
+
(i || o) && (l(r, {
|
|
1748
|
+
code: i ? c.too_big : c.too_small,
|
|
1782
1749
|
minimum: o ? s.exactLength.value : void 0,
|
|
1783
1750
|
maximum: i ? s.exactLength.value : void 0,
|
|
1784
1751
|
type: "array",
|
|
@@ -1787,175 +1754,174 @@ var ls = _r((ps, mt) => {
|
|
|
1787
1754
|
message: s.exactLength.message
|
|
1788
1755
|
}), n.dirty());
|
|
1789
1756
|
}
|
|
1790
|
-
if (s.minLength !== null && r.data.length < s.minLength.value && (
|
|
1791
|
-
code:
|
|
1757
|
+
if (s.minLength !== null && r.data.length < s.minLength.value && (l(r, {
|
|
1758
|
+
code: c.too_small,
|
|
1792
1759
|
minimum: s.minLength.value,
|
|
1793
1760
|
type: "array",
|
|
1794
1761
|
inclusive: !0,
|
|
1795
1762
|
exact: !1,
|
|
1796
1763
|
message: s.minLength.message
|
|
1797
|
-
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (
|
|
1798
|
-
code:
|
|
1764
|
+
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (l(r, {
|
|
1765
|
+
code: c.too_big,
|
|
1799
1766
|
maximum: s.maxLength.value,
|
|
1800
1767
|
type: "array",
|
|
1801
1768
|
inclusive: !0,
|
|
1802
1769
|
exact: !1,
|
|
1803
1770
|
message: s.maxLength.message
|
|
1804
1771
|
}), n.dirty()), r.common.async)
|
|
1805
|
-
return Promise.all([...r.data].map((i, o) => s.type._parseAsync(new
|
|
1806
|
-
const a = [...r.data].map((i, o) => s.type._parseSync(new
|
|
1807
|
-
return
|
|
1772
|
+
return Promise.all([...r.data].map((i, o) => s.type._parseAsync(new q(r, i, r.path, o)))).then((i) => R.mergeArray(n, i));
|
|
1773
|
+
const a = [...r.data].map((i, o) => s.type._parseSync(new q(r, i, r.path, o)));
|
|
1774
|
+
return R.mergeArray(n, a);
|
|
1808
1775
|
}
|
|
1809
1776
|
get element() {
|
|
1810
1777
|
return this._def.type;
|
|
1811
1778
|
}
|
|
1812
1779
|
min(e, r) {
|
|
1813
|
-
return new
|
|
1780
|
+
return new P({
|
|
1814
1781
|
...this._def,
|
|
1815
|
-
minLength: { value: e, message:
|
|
1782
|
+
minLength: { value: e, message: p.toString(r) }
|
|
1816
1783
|
});
|
|
1817
1784
|
}
|
|
1818
1785
|
max(e, r) {
|
|
1819
|
-
return new
|
|
1786
|
+
return new P({
|
|
1820
1787
|
...this._def,
|
|
1821
|
-
maxLength: { value: e, message:
|
|
1788
|
+
maxLength: { value: e, message: p.toString(r) }
|
|
1822
1789
|
});
|
|
1823
1790
|
}
|
|
1824
1791
|
length(e, r) {
|
|
1825
|
-
return new
|
|
1792
|
+
return new P({
|
|
1826
1793
|
...this._def,
|
|
1827
|
-
exactLength: { value: e, message:
|
|
1794
|
+
exactLength: { value: e, message: p.toString(r) }
|
|
1828
1795
|
});
|
|
1829
1796
|
}
|
|
1830
1797
|
nonempty(e) {
|
|
1831
1798
|
return this.min(1, e);
|
|
1832
1799
|
}
|
|
1833
1800
|
}
|
|
1834
|
-
|
|
1801
|
+
P.create = (t, e) => new P({
|
|
1835
1802
|
type: t,
|
|
1836
1803
|
minLength: null,
|
|
1837
1804
|
maxLength: null,
|
|
1838
1805
|
exactLength: null,
|
|
1839
|
-
typeName:
|
|
1806
|
+
typeName: g.ZodArray,
|
|
1840
1807
|
...v(e)
|
|
1841
1808
|
});
|
|
1842
|
-
function
|
|
1843
|
-
if (t instanceof
|
|
1809
|
+
function X(t) {
|
|
1810
|
+
if (t instanceof O) {
|
|
1844
1811
|
const e = {};
|
|
1845
1812
|
for (const r in t.shape) {
|
|
1846
1813
|
const n = t.shape[r];
|
|
1847
|
-
e[r] =
|
|
1814
|
+
e[r] = V.create(X(n));
|
|
1848
1815
|
}
|
|
1849
|
-
return new
|
|
1816
|
+
return new O({
|
|
1850
1817
|
...t._def,
|
|
1851
1818
|
shape: () => e
|
|
1852
1819
|
});
|
|
1853
|
-
} else return t instanceof
|
|
1820
|
+
} else return t instanceof P ? new P({
|
|
1854
1821
|
...t._def,
|
|
1855
|
-
type:
|
|
1856
|
-
}) : t instanceof
|
|
1822
|
+
type: X(t.element)
|
|
1823
|
+
}) : t instanceof V ? V.create(X(t.unwrap())) : t instanceof se ? se.create(X(t.unwrap())) : t instanceof Y ? Y.create(t.items.map((e) => X(e))) : t;
|
|
1857
1824
|
}
|
|
1858
|
-
class
|
|
1825
|
+
class O extends k {
|
|
1859
1826
|
constructor() {
|
|
1860
1827
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1861
1828
|
}
|
|
1862
1829
|
_getCached() {
|
|
1863
1830
|
if (this._cached !== null)
|
|
1864
1831
|
return this._cached;
|
|
1865
|
-
const e = this._def.shape(), r =
|
|
1866
|
-
return this._cached = { shape: e, keys: r };
|
|
1832
|
+
const e = this._def.shape(), r = w.objectKeys(e);
|
|
1833
|
+
return this._cached = { shape: e, keys: r }, this._cached;
|
|
1867
1834
|
}
|
|
1868
1835
|
_parse(e) {
|
|
1869
|
-
if (this._getType(e) !==
|
|
1870
|
-
const
|
|
1871
|
-
return
|
|
1872
|
-
code:
|
|
1873
|
-
expected:
|
|
1874
|
-
received:
|
|
1836
|
+
if (this._getType(e) !== f.object) {
|
|
1837
|
+
const u = this._getOrReturnCtx(e);
|
|
1838
|
+
return l(u, {
|
|
1839
|
+
code: c.invalid_type,
|
|
1840
|
+
expected: f.object,
|
|
1841
|
+
received: u.parsedType
|
|
1875
1842
|
}), y;
|
|
1876
1843
|
}
|
|
1877
1844
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1878
|
-
if (!(this._def.catchall instanceof
|
|
1879
|
-
for (const
|
|
1880
|
-
i.includes(
|
|
1881
|
-
const
|
|
1882
|
-
for (const
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1885
|
-
key: { status: "valid", value:
|
|
1886
|
-
value:
|
|
1887
|
-
alwaysSet:
|
|
1845
|
+
if (!(this._def.catchall instanceof U && this._def.unknownKeys === "strip"))
|
|
1846
|
+
for (const u in s.data)
|
|
1847
|
+
i.includes(u) || o.push(u);
|
|
1848
|
+
const d = [];
|
|
1849
|
+
for (const u of i) {
|
|
1850
|
+
const h = a[u], b = s.data[u];
|
|
1851
|
+
d.push({
|
|
1852
|
+
key: { status: "valid", value: u },
|
|
1853
|
+
value: h._parse(new q(s, b, s.path, u)),
|
|
1854
|
+
alwaysSet: u in s.data
|
|
1888
1855
|
});
|
|
1889
1856
|
}
|
|
1890
|
-
if (this._def.catchall instanceof
|
|
1891
|
-
const
|
|
1892
|
-
if (
|
|
1893
|
-
for (const
|
|
1894
|
-
|
|
1895
|
-
key: { status: "valid", value:
|
|
1896
|
-
value: { status: "valid", value: s.data[
|
|
1857
|
+
if (this._def.catchall instanceof U) {
|
|
1858
|
+
const u = this._def.unknownKeys;
|
|
1859
|
+
if (u === "passthrough")
|
|
1860
|
+
for (const h of o)
|
|
1861
|
+
d.push({
|
|
1862
|
+
key: { status: "valid", value: h },
|
|
1863
|
+
value: { status: "valid", value: s.data[h] }
|
|
1897
1864
|
});
|
|
1898
|
-
else if (
|
|
1899
|
-
o.length > 0 && (
|
|
1900
|
-
code:
|
|
1865
|
+
else if (u === "strict")
|
|
1866
|
+
o.length > 0 && (l(s, {
|
|
1867
|
+
code: c.unrecognized_keys,
|
|
1901
1868
|
keys: o
|
|
1902
1869
|
}), n.dirty());
|
|
1903
|
-
else if (
|
|
1870
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1904
1871
|
} else {
|
|
1905
|
-
const
|
|
1906
|
-
for (const
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
-
key: { status: "valid", value:
|
|
1910
|
-
value:
|
|
1911
|
-
new
|
|
1872
|
+
const u = this._def.catchall;
|
|
1873
|
+
for (const h of o) {
|
|
1874
|
+
const b = s.data[h];
|
|
1875
|
+
d.push({
|
|
1876
|
+
key: { status: "valid", value: h },
|
|
1877
|
+
value: u._parse(
|
|
1878
|
+
new q(s, b, s.path, h)
|
|
1912
1879
|
//, ctx.child(key), value, getParsedType(value)
|
|
1913
1880
|
),
|
|
1914
|
-
alwaysSet:
|
|
1881
|
+
alwaysSet: h in s.data
|
|
1915
1882
|
});
|
|
1916
1883
|
}
|
|
1917
1884
|
}
|
|
1918
1885
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1919
|
-
const
|
|
1920
|
-
for (const
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
key:
|
|
1924
|
-
value:
|
|
1925
|
-
alwaysSet:
|
|
1886
|
+
const u = [];
|
|
1887
|
+
for (const h of d) {
|
|
1888
|
+
const b = await h.key, S = await h.value;
|
|
1889
|
+
u.push({
|
|
1890
|
+
key: b,
|
|
1891
|
+
value: S,
|
|
1892
|
+
alwaysSet: h.alwaysSet
|
|
1926
1893
|
});
|
|
1927
1894
|
}
|
|
1928
|
-
return
|
|
1929
|
-
}).then((
|
|
1895
|
+
return u;
|
|
1896
|
+
}).then((u) => R.mergeObjectSync(n, u)) : R.mergeObjectSync(n, d);
|
|
1930
1897
|
}
|
|
1931
1898
|
get shape() {
|
|
1932
1899
|
return this._def.shape();
|
|
1933
1900
|
}
|
|
1934
1901
|
strict(e) {
|
|
1935
|
-
return
|
|
1902
|
+
return p.errToObj, new O({
|
|
1936
1903
|
...this._def,
|
|
1937
1904
|
unknownKeys: "strict",
|
|
1938
1905
|
...e !== void 0 ? {
|
|
1939
1906
|
errorMap: (r, n) => {
|
|
1940
|
-
|
|
1941
|
-
const c = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, r, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1907
|
+
const s = this._def.errorMap?.(r, n).message ?? n.defaultError;
|
|
1942
1908
|
return r.code === "unrecognized_keys" ? {
|
|
1943
|
-
message:
|
|
1909
|
+
message: p.errToObj(e).message ?? s
|
|
1944
1910
|
} : {
|
|
1945
|
-
message:
|
|
1911
|
+
message: s
|
|
1946
1912
|
};
|
|
1947
1913
|
}
|
|
1948
1914
|
} : {}
|
|
1949
1915
|
});
|
|
1950
1916
|
}
|
|
1951
1917
|
strip() {
|
|
1952
|
-
return new
|
|
1918
|
+
return new O({
|
|
1953
1919
|
...this._def,
|
|
1954
1920
|
unknownKeys: "strip"
|
|
1955
1921
|
});
|
|
1956
1922
|
}
|
|
1957
1923
|
passthrough() {
|
|
1958
|
-
return new
|
|
1924
|
+
return new O({
|
|
1959
1925
|
...this._def,
|
|
1960
1926
|
unknownKeys: "passthrough"
|
|
1961
1927
|
});
|
|
@@ -1978,7 +1944,7 @@ var ls = _r((ps, mt) => {
|
|
|
1978
1944
|
// }) as any;
|
|
1979
1945
|
// };
|
|
1980
1946
|
extend(e) {
|
|
1981
|
-
return new
|
|
1947
|
+
return new O({
|
|
1982
1948
|
...this._def,
|
|
1983
1949
|
shape: () => ({
|
|
1984
1950
|
...this._def.shape(),
|
|
@@ -1992,14 +1958,14 @@ var ls = _r((ps, mt) => {
|
|
|
1992
1958
|
* upgrade if you are experiencing issues.
|
|
1993
1959
|
*/
|
|
1994
1960
|
merge(e) {
|
|
1995
|
-
return new
|
|
1961
|
+
return new O({
|
|
1996
1962
|
unknownKeys: e._def.unknownKeys,
|
|
1997
1963
|
catchall: e._def.catchall,
|
|
1998
1964
|
shape: () => ({
|
|
1999
1965
|
...this._def.shape(),
|
|
2000
1966
|
...e._def.shape()
|
|
2001
1967
|
}),
|
|
2002
|
-
typeName:
|
|
1968
|
+
typeName: g.ZodObject
|
|
2003
1969
|
});
|
|
2004
1970
|
}
|
|
2005
1971
|
// merge<
|
|
@@ -2062,25 +2028,25 @@ var ls = _r((ps, mt) => {
|
|
|
2062
2028
|
// return merged;
|
|
2063
2029
|
// }
|
|
2064
2030
|
catchall(e) {
|
|
2065
|
-
return new
|
|
2031
|
+
return new O({
|
|
2066
2032
|
...this._def,
|
|
2067
2033
|
catchall: e
|
|
2068
2034
|
});
|
|
2069
2035
|
}
|
|
2070
2036
|
pick(e) {
|
|
2071
2037
|
const r = {};
|
|
2072
|
-
|
|
2038
|
+
for (const n of w.objectKeys(e))
|
|
2073
2039
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
2074
|
-
|
|
2040
|
+
return new O({
|
|
2075
2041
|
...this._def,
|
|
2076
2042
|
shape: () => r
|
|
2077
2043
|
});
|
|
2078
2044
|
}
|
|
2079
2045
|
omit(e) {
|
|
2080
2046
|
const r = {};
|
|
2081
|
-
|
|
2047
|
+
for (const n of w.objectKeys(this.shape))
|
|
2082
2048
|
e[n] || (r[n] = this.shape[n]);
|
|
2083
|
-
|
|
2049
|
+
return new O({
|
|
2084
2050
|
...this._def,
|
|
2085
2051
|
shape: () => r
|
|
2086
2052
|
});
|
|
@@ -2089,60 +2055,61 @@ var ls = _r((ps, mt) => {
|
|
|
2089
2055
|
* @deprecated
|
|
2090
2056
|
*/
|
|
2091
2057
|
deepPartial() {
|
|
2092
|
-
return
|
|
2058
|
+
return X(this);
|
|
2093
2059
|
}
|
|
2094
2060
|
partial(e) {
|
|
2095
2061
|
const r = {};
|
|
2096
|
-
|
|
2062
|
+
for (const n of w.objectKeys(this.shape)) {
|
|
2097
2063
|
const s = this.shape[n];
|
|
2098
2064
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
2099
|
-
}
|
|
2065
|
+
}
|
|
2066
|
+
return new O({
|
|
2100
2067
|
...this._def,
|
|
2101
2068
|
shape: () => r
|
|
2102
2069
|
});
|
|
2103
2070
|
}
|
|
2104
2071
|
required(e) {
|
|
2105
2072
|
const r = {};
|
|
2106
|
-
|
|
2073
|
+
for (const n of w.objectKeys(this.shape))
|
|
2107
2074
|
if (e && !e[n])
|
|
2108
2075
|
r[n] = this.shape[n];
|
|
2109
2076
|
else {
|
|
2110
2077
|
let a = this.shape[n];
|
|
2111
|
-
for (; a instanceof
|
|
2078
|
+
for (; a instanceof V; )
|
|
2112
2079
|
a = a._def.innerType;
|
|
2113
2080
|
r[n] = a;
|
|
2114
2081
|
}
|
|
2115
|
-
|
|
2082
|
+
return new O({
|
|
2116
2083
|
...this._def,
|
|
2117
2084
|
shape: () => r
|
|
2118
2085
|
});
|
|
2119
2086
|
}
|
|
2120
2087
|
keyof() {
|
|
2121
|
-
return
|
|
2088
|
+
return _t(w.objectKeys(this.shape));
|
|
2122
2089
|
}
|
|
2123
2090
|
}
|
|
2124
|
-
|
|
2091
|
+
O.create = (t, e) => new O({
|
|
2125
2092
|
shape: () => t,
|
|
2126
2093
|
unknownKeys: "strip",
|
|
2127
|
-
catchall:
|
|
2128
|
-
typeName:
|
|
2094
|
+
catchall: U.create(),
|
|
2095
|
+
typeName: g.ZodObject,
|
|
2129
2096
|
...v(e)
|
|
2130
2097
|
});
|
|
2131
|
-
|
|
2098
|
+
O.strictCreate = (t, e) => new O({
|
|
2132
2099
|
shape: () => t,
|
|
2133
2100
|
unknownKeys: "strict",
|
|
2134
|
-
catchall:
|
|
2135
|
-
typeName:
|
|
2101
|
+
catchall: U.create(),
|
|
2102
|
+
typeName: g.ZodObject,
|
|
2136
2103
|
...v(e)
|
|
2137
2104
|
});
|
|
2138
|
-
|
|
2105
|
+
O.lazycreate = (t, e) => new O({
|
|
2139
2106
|
shape: t,
|
|
2140
2107
|
unknownKeys: "strip",
|
|
2141
|
-
catchall:
|
|
2142
|
-
typeName:
|
|
2108
|
+
catchall: U.create(),
|
|
2109
|
+
typeName: g.ZodObject,
|
|
2143
2110
|
...v(e)
|
|
2144
2111
|
});
|
|
2145
|
-
class
|
|
2112
|
+
class xe extends k {
|
|
2146
2113
|
_parse(e) {
|
|
2147
2114
|
const { ctx: r } = this._processInputParams(e), n = this._def.options;
|
|
2148
2115
|
function s(a) {
|
|
@@ -2152,9 +2119,9 @@ var ls = _r((ps, mt) => {
|
|
|
2152
2119
|
for (const o of a)
|
|
2153
2120
|
if (o.result.status === "dirty")
|
|
2154
2121
|
return r.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2155
|
-
const i = a.map((o) => new
|
|
2156
|
-
return
|
|
2157
|
-
code:
|
|
2122
|
+
const i = a.map((o) => new F(o.ctx.common.issues));
|
|
2123
|
+
return l(r, {
|
|
2124
|
+
code: c.invalid_union,
|
|
2158
2125
|
unionErrors: i
|
|
2159
2126
|
}), y;
|
|
2160
2127
|
}
|
|
@@ -2180,28 +2147,28 @@ var ls = _r((ps, mt) => {
|
|
|
2180
2147
|
{
|
|
2181
2148
|
let a;
|
|
2182
2149
|
const i = [];
|
|
2183
|
-
for (const
|
|
2184
|
-
const
|
|
2150
|
+
for (const d of n) {
|
|
2151
|
+
const u = {
|
|
2185
2152
|
...r,
|
|
2186
2153
|
common: {
|
|
2187
2154
|
...r.common,
|
|
2188
2155
|
issues: []
|
|
2189
2156
|
},
|
|
2190
2157
|
parent: null
|
|
2191
|
-
},
|
|
2158
|
+
}, h = d._parseSync({
|
|
2192
2159
|
data: r.data,
|
|
2193
2160
|
path: r.path,
|
|
2194
|
-
parent:
|
|
2161
|
+
parent: u
|
|
2195
2162
|
});
|
|
2196
|
-
if (
|
|
2197
|
-
return
|
|
2198
|
-
|
|
2163
|
+
if (h.status === "valid")
|
|
2164
|
+
return h;
|
|
2165
|
+
h.status === "dirty" && !a && (a = { result: h, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
2199
2166
|
}
|
|
2200
2167
|
if (a)
|
|
2201
2168
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2202
|
-
const o = i.map((
|
|
2203
|
-
return
|
|
2204
|
-
code:
|
|
2169
|
+
const o = i.map((d) => new F(d));
|
|
2170
|
+
return l(r, {
|
|
2171
|
+
code: c.invalid_union,
|
|
2205
2172
|
unionErrors: o
|
|
2206
2173
|
}), y;
|
|
2207
2174
|
}
|
|
@@ -2210,108 +2177,45 @@ var ls = _r((ps, mt) => {
|
|
|
2210
2177
|
return this._def.options;
|
|
2211
2178
|
}
|
|
2212
2179
|
}
|
|
2213
|
-
|
|
2180
|
+
xe.create = (t, e) => new xe({
|
|
2214
2181
|
options: t,
|
|
2215
|
-
typeName:
|
|
2182
|
+
typeName: g.ZodUnion,
|
|
2216
2183
|
...v(e)
|
|
2217
2184
|
});
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
_parse(e) {
|
|
2221
|
-
const { ctx: r } = this._processInputParams(e);
|
|
2222
|
-
if (r.parsedType !== p.object)
|
|
2223
|
-
return f(r, {
|
|
2224
|
-
code: l.invalid_type,
|
|
2225
|
-
expected: p.object,
|
|
2226
|
-
received: r.parsedType
|
|
2227
|
-
}), y;
|
|
2228
|
-
const n = this.discriminator, s = r.data[n], a = this.optionsMap.get(s);
|
|
2229
|
-
return a ? r.common.async ? a._parseAsync({
|
|
2230
|
-
data: r.data,
|
|
2231
|
-
path: r.path,
|
|
2232
|
-
parent: r
|
|
2233
|
-
}) : a._parseSync({
|
|
2234
|
-
data: r.data,
|
|
2235
|
-
path: r.path,
|
|
2236
|
-
parent: r
|
|
2237
|
-
}) : (f(r, {
|
|
2238
|
-
code: l.invalid_union_discriminator,
|
|
2239
|
-
options: Array.from(this.optionsMap.keys()),
|
|
2240
|
-
path: [n]
|
|
2241
|
-
}), y);
|
|
2242
|
-
}
|
|
2243
|
-
get discriminator() {
|
|
2244
|
-
return this._def.discriminator;
|
|
2245
|
-
}
|
|
2246
|
-
get options() {
|
|
2247
|
-
return this._def.options;
|
|
2248
|
-
}
|
|
2249
|
-
get optionsMap() {
|
|
2250
|
-
return this._def.optionsMap;
|
|
2251
|
-
}
|
|
2252
|
-
/**
|
|
2253
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2254
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2255
|
-
* have a different value for each object in the union.
|
|
2256
|
-
* @param discriminator the name of the discriminator property
|
|
2257
|
-
* @param types an array of object schemas
|
|
2258
|
-
* @param params
|
|
2259
|
-
*/
|
|
2260
|
-
static create(e, r, n) {
|
|
2261
|
-
const s = /* @__PURE__ */ new Map();
|
|
2262
|
-
for (const a of r) {
|
|
2263
|
-
const i = U(a.shape[e]);
|
|
2264
|
-
if (!i.length)
|
|
2265
|
-
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2266
|
-
for (const o of i) {
|
|
2267
|
-
if (s.has(o))
|
|
2268
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2269
|
-
s.set(o, a);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
return new et({
|
|
2273
|
-
typeName: m.ZodDiscriminatedUnion,
|
|
2274
|
-
discriminator: e,
|
|
2275
|
-
options: r,
|
|
2276
|
-
optionsMap: s,
|
|
2277
|
-
...v(n)
|
|
2278
|
-
});
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
function dt(t, e) {
|
|
2282
|
-
const r = B(t), n = B(e);
|
|
2185
|
+
function Pe(t, e) {
|
|
2186
|
+
const r = L(t), n = L(e);
|
|
2283
2187
|
if (t === e)
|
|
2284
2188
|
return { valid: !0, data: t };
|
|
2285
|
-
if (r ===
|
|
2286
|
-
const s =
|
|
2189
|
+
if (r === f.object && n === f.object) {
|
|
2190
|
+
const s = w.objectKeys(e), a = w.objectKeys(t).filter((o) => s.indexOf(o) !== -1), i = { ...t, ...e };
|
|
2287
2191
|
for (const o of a) {
|
|
2288
|
-
const
|
|
2289
|
-
if (!
|
|
2192
|
+
const d = Pe(t[o], e[o]);
|
|
2193
|
+
if (!d.valid)
|
|
2290
2194
|
return { valid: !1 };
|
|
2291
|
-
i[o] =
|
|
2195
|
+
i[o] = d.data;
|
|
2292
2196
|
}
|
|
2293
2197
|
return { valid: !0, data: i };
|
|
2294
|
-
} else if (r ===
|
|
2198
|
+
} else if (r === f.array && n === f.array) {
|
|
2295
2199
|
if (t.length !== e.length)
|
|
2296
2200
|
return { valid: !1 };
|
|
2297
2201
|
const s = [];
|
|
2298
2202
|
for (let a = 0; a < t.length; a++) {
|
|
2299
|
-
const i = t[a], o = e[a],
|
|
2300
|
-
if (!
|
|
2203
|
+
const i = t[a], o = e[a], d = Pe(i, o);
|
|
2204
|
+
if (!d.valid)
|
|
2301
2205
|
return { valid: !1 };
|
|
2302
|
-
s.push(
|
|
2206
|
+
s.push(d.data);
|
|
2303
2207
|
}
|
|
2304
2208
|
return { valid: !0, data: s };
|
|
2305
|
-
} else return r ===
|
|
2209
|
+
} else return r === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2306
2210
|
}
|
|
2307
|
-
class
|
|
2211
|
+
class be extends k {
|
|
2308
2212
|
_parse(e) {
|
|
2309
2213
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2310
|
-
if (
|
|
2214
|
+
if (Ke(a) || Ke(i))
|
|
2311
2215
|
return y;
|
|
2312
|
-
const o =
|
|
2313
|
-
return o.valid ? ((
|
|
2314
|
-
code:
|
|
2216
|
+
const o = Pe(a.value, i.value);
|
|
2217
|
+
return o.valid ? ((Qe(a) || Qe(i)) && r.dirty(), { status: r.value, value: o.data }) : (l(n, {
|
|
2218
|
+
code: c.invalid_intersection_types
|
|
2315
2219
|
}), y);
|
|
2316
2220
|
};
|
|
2317
2221
|
return n.common.async ? Promise.all([
|
|
@@ -2336,104 +2240,63 @@ var ls = _r((ps, mt) => {
|
|
|
2336
2240
|
}));
|
|
2337
2241
|
}
|
|
2338
2242
|
}
|
|
2339
|
-
|
|
2243
|
+
be.create = (t, e, r) => new be({
|
|
2340
2244
|
left: t,
|
|
2341
2245
|
right: e,
|
|
2342
|
-
typeName:
|
|
2246
|
+
typeName: g.ZodIntersection,
|
|
2343
2247
|
...v(r)
|
|
2344
2248
|
});
|
|
2345
|
-
class
|
|
2249
|
+
class Y extends k {
|
|
2346
2250
|
_parse(e) {
|
|
2347
2251
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2348
|
-
if (n.parsedType !==
|
|
2349
|
-
return
|
|
2350
|
-
code:
|
|
2351
|
-
expected:
|
|
2252
|
+
if (n.parsedType !== f.array)
|
|
2253
|
+
return l(n, {
|
|
2254
|
+
code: c.invalid_type,
|
|
2255
|
+
expected: f.array,
|
|
2352
2256
|
received: n.parsedType
|
|
2353
2257
|
}), y;
|
|
2354
2258
|
if (n.data.length < this._def.items.length)
|
|
2355
|
-
return
|
|
2356
|
-
code:
|
|
2259
|
+
return l(n, {
|
|
2260
|
+
code: c.too_small,
|
|
2357
2261
|
minimum: this._def.items.length,
|
|
2358
2262
|
inclusive: !0,
|
|
2359
2263
|
exact: !1,
|
|
2360
2264
|
type: "array"
|
|
2361
2265
|
}), y;
|
|
2362
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2363
|
-
code:
|
|
2266
|
+
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2267
|
+
code: c.too_big,
|
|
2364
2268
|
maximum: this._def.items.length,
|
|
2365
2269
|
inclusive: !0,
|
|
2366
2270
|
exact: !1,
|
|
2367
2271
|
type: "array"
|
|
2368
2272
|
}), r.dirty());
|
|
2369
2273
|
const a = [...n.data].map((i, o) => {
|
|
2370
|
-
const
|
|
2371
|
-
return
|
|
2274
|
+
const d = this._def.items[o] || this._def.rest;
|
|
2275
|
+
return d ? d._parse(new q(n, i, n.path, o)) : null;
|
|
2372
2276
|
}).filter((i) => !!i);
|
|
2373
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
2277
|
+
return n.common.async ? Promise.all(a).then((i) => R.mergeArray(r, i)) : R.mergeArray(r, a);
|
|
2374
2278
|
}
|
|
2375
2279
|
get items() {
|
|
2376
2280
|
return this._def.items;
|
|
2377
2281
|
}
|
|
2378
2282
|
rest(e) {
|
|
2379
|
-
return new
|
|
2283
|
+
return new Y({
|
|
2380
2284
|
...this._def,
|
|
2381
2285
|
rest: e
|
|
2382
2286
|
});
|
|
2383
2287
|
}
|
|
2384
2288
|
}
|
|
2385
|
-
|
|
2289
|
+
Y.create = (t, e) => {
|
|
2386
2290
|
if (!Array.isArray(t))
|
|
2387
2291
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2388
|
-
return new
|
|
2292
|
+
return new Y({
|
|
2389
2293
|
items: t,
|
|
2390
|
-
typeName:
|
|
2294
|
+
typeName: g.ZodTuple,
|
|
2391
2295
|
rest: null,
|
|
2392
2296
|
...v(e)
|
|
2393
2297
|
});
|
|
2394
2298
|
};
|
|
2395
|
-
class
|
|
2396
|
-
get keySchema() {
|
|
2397
|
-
return this._def.keyType;
|
|
2398
|
-
}
|
|
2399
|
-
get valueSchema() {
|
|
2400
|
-
return this._def.valueType;
|
|
2401
|
-
}
|
|
2402
|
-
_parse(e) {
|
|
2403
|
-
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2404
|
-
if (n.parsedType !== p.object)
|
|
2405
|
-
return f(n, {
|
|
2406
|
-
code: l.invalid_type,
|
|
2407
|
-
expected: p.object,
|
|
2408
|
-
received: n.parsedType
|
|
2409
|
-
}), y;
|
|
2410
|
-
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2411
|
-
for (const o in n.data)
|
|
2412
|
-
s.push({
|
|
2413
|
-
key: a._parse(new D(n, o, n.path, o)),
|
|
2414
|
-
value: i._parse(new D(n, n.data[o], n.path, o)),
|
|
2415
|
-
alwaysSet: o in n.data
|
|
2416
|
-
});
|
|
2417
|
-
return n.common.async ? O.mergeObjectAsync(r, s) : O.mergeObjectSync(r, s);
|
|
2418
|
-
}
|
|
2419
|
-
get element() {
|
|
2420
|
-
return this._def.valueType;
|
|
2421
|
-
}
|
|
2422
|
-
static create(e, r, n) {
|
|
2423
|
-
return r instanceof _ ? new Pe({
|
|
2424
|
-
keyType: e,
|
|
2425
|
-
valueType: r,
|
|
2426
|
-
typeName: m.ZodRecord,
|
|
2427
|
-
...v(n)
|
|
2428
|
-
}) : new Pe({
|
|
2429
|
-
keyType: j.create(),
|
|
2430
|
-
valueType: e,
|
|
2431
|
-
typeName: m.ZodRecord,
|
|
2432
|
-
...v(r)
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
class Ke extends _ {
|
|
2299
|
+
class dt extends k {
|
|
2437
2300
|
get keySchema() {
|
|
2438
2301
|
return this._def.keyType;
|
|
2439
2302
|
}
|
|
@@ -2442,64 +2305,64 @@ var ls = _r((ps, mt) => {
|
|
|
2442
2305
|
}
|
|
2443
2306
|
_parse(e) {
|
|
2444
2307
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2445
|
-
if (n.parsedType !==
|
|
2446
|
-
return
|
|
2447
|
-
code:
|
|
2448
|
-
expected:
|
|
2308
|
+
if (n.parsedType !== f.map)
|
|
2309
|
+
return l(n, {
|
|
2310
|
+
code: c.invalid_type,
|
|
2311
|
+
expected: f.map,
|
|
2449
2312
|
received: n.parsedType
|
|
2450
2313
|
}), y;
|
|
2451
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2452
|
-
key: s._parse(new
|
|
2453
|
-
value: a._parse(new
|
|
2314
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d], u) => ({
|
|
2315
|
+
key: s._parse(new q(n, o, n.path, [u, "key"])),
|
|
2316
|
+
value: a._parse(new q(n, d, n.path, [u, "value"]))
|
|
2454
2317
|
}));
|
|
2455
2318
|
if (n.common.async) {
|
|
2456
2319
|
const o = /* @__PURE__ */ new Map();
|
|
2457
2320
|
return Promise.resolve().then(async () => {
|
|
2458
|
-
for (const
|
|
2459
|
-
const
|
|
2460
|
-
if (
|
|
2321
|
+
for (const d of i) {
|
|
2322
|
+
const u = await d.key, h = await d.value;
|
|
2323
|
+
if (u.status === "aborted" || h.status === "aborted")
|
|
2461
2324
|
return y;
|
|
2462
|
-
(
|
|
2325
|
+
(u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
|
|
2463
2326
|
}
|
|
2464
2327
|
return { status: r.value, value: o };
|
|
2465
2328
|
});
|
|
2466
2329
|
} else {
|
|
2467
2330
|
const o = /* @__PURE__ */ new Map();
|
|
2468
|
-
for (const
|
|
2469
|
-
const
|
|
2470
|
-
if (
|
|
2331
|
+
for (const d of i) {
|
|
2332
|
+
const u = d.key, h = d.value;
|
|
2333
|
+
if (u.status === "aborted" || h.status === "aborted")
|
|
2471
2334
|
return y;
|
|
2472
|
-
(
|
|
2335
|
+
(u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
|
|
2473
2336
|
}
|
|
2474
2337
|
return { status: r.value, value: o };
|
|
2475
2338
|
}
|
|
2476
2339
|
}
|
|
2477
2340
|
}
|
|
2478
|
-
|
|
2341
|
+
dt.create = (t, e, r) => new dt({
|
|
2479
2342
|
valueType: e,
|
|
2480
2343
|
keyType: t,
|
|
2481
|
-
typeName:
|
|
2344
|
+
typeName: g.ZodMap,
|
|
2482
2345
|
...v(r)
|
|
2483
2346
|
});
|
|
2484
|
-
class
|
|
2347
|
+
class he extends k {
|
|
2485
2348
|
_parse(e) {
|
|
2486
2349
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2487
|
-
if (n.parsedType !==
|
|
2488
|
-
return
|
|
2489
|
-
code:
|
|
2490
|
-
expected:
|
|
2350
|
+
if (n.parsedType !== f.set)
|
|
2351
|
+
return l(n, {
|
|
2352
|
+
code: c.invalid_type,
|
|
2353
|
+
expected: f.set,
|
|
2491
2354
|
received: n.parsedType
|
|
2492
2355
|
}), y;
|
|
2493
2356
|
const s = this._def;
|
|
2494
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2495
|
-
code:
|
|
2357
|
+
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2358
|
+
code: c.too_small,
|
|
2496
2359
|
minimum: s.minSize.value,
|
|
2497
2360
|
type: "set",
|
|
2498
2361
|
inclusive: !0,
|
|
2499
2362
|
exact: !1,
|
|
2500
2363
|
message: s.minSize.message
|
|
2501
|
-
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2502
|
-
code:
|
|
2364
|
+
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2365
|
+
code: c.too_big,
|
|
2503
2366
|
maximum: s.maxSize.value,
|
|
2504
2367
|
type: "set",
|
|
2505
2368
|
inclusive: !0,
|
|
@@ -2507,28 +2370,28 @@ var ls = _r((ps, mt) => {
|
|
|
2507
2370
|
message: s.maxSize.message
|
|
2508
2371
|
}), r.dirty());
|
|
2509
2372
|
const a = this._def.valueType;
|
|
2510
|
-
function i(
|
|
2511
|
-
const
|
|
2512
|
-
for (const
|
|
2513
|
-
if (
|
|
2373
|
+
function i(d) {
|
|
2374
|
+
const u = /* @__PURE__ */ new Set();
|
|
2375
|
+
for (const h of d) {
|
|
2376
|
+
if (h.status === "aborted")
|
|
2514
2377
|
return y;
|
|
2515
|
-
|
|
2378
|
+
h.status === "dirty" && r.dirty(), u.add(h.value);
|
|
2516
2379
|
}
|
|
2517
|
-
return { status: r.value, value:
|
|
2380
|
+
return { status: r.value, value: u };
|
|
2518
2381
|
}
|
|
2519
|
-
const o = [...n.data.values()].map((
|
|
2520
|
-
return n.common.async ? Promise.all(o).then((
|
|
2382
|
+
const o = [...n.data.values()].map((d, u) => a._parse(new q(n, d, n.path, u)));
|
|
2383
|
+
return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2521
2384
|
}
|
|
2522
2385
|
min(e, r) {
|
|
2523
|
-
return new
|
|
2386
|
+
return new he({
|
|
2524
2387
|
...this._def,
|
|
2525
|
-
minSize: { value: e, message:
|
|
2388
|
+
minSize: { value: e, message: p.toString(r) }
|
|
2526
2389
|
});
|
|
2527
2390
|
}
|
|
2528
2391
|
max(e, r) {
|
|
2529
|
-
return new
|
|
2392
|
+
return new he({
|
|
2530
2393
|
...this._def,
|
|
2531
|
-
maxSize: { value: e, message:
|
|
2394
|
+
maxSize: { value: e, message: p.toString(r) }
|
|
2532
2395
|
});
|
|
2533
2396
|
}
|
|
2534
2397
|
size(e, r) {
|
|
@@ -2538,115 +2401,14 @@ var ls = _r((ps, mt) => {
|
|
|
2538
2401
|
return this.min(1, e);
|
|
2539
2402
|
}
|
|
2540
2403
|
}
|
|
2541
|
-
|
|
2404
|
+
he.create = (t, e) => new he({
|
|
2542
2405
|
valueType: t,
|
|
2543
2406
|
minSize: null,
|
|
2544
2407
|
maxSize: null,
|
|
2545
|
-
typeName:
|
|
2408
|
+
typeName: g.ZodSet,
|
|
2546
2409
|
...v(e)
|
|
2547
2410
|
});
|
|
2548
|
-
class
|
|
2549
|
-
constructor() {
|
|
2550
|
-
super(...arguments), this.validate = this.implement;
|
|
2551
|
-
}
|
|
2552
|
-
_parse(e) {
|
|
2553
|
-
const { ctx: r } = this._processInputParams(e);
|
|
2554
|
-
if (r.parsedType !== p.function)
|
|
2555
|
-
return f(r, {
|
|
2556
|
-
code: l.invalid_type,
|
|
2557
|
-
expected: p.function,
|
|
2558
|
-
received: r.parsedType
|
|
2559
|
-
}), y;
|
|
2560
|
-
function n(o, c) {
|
|
2561
|
-
return He({
|
|
2562
|
-
data: o,
|
|
2563
|
-
path: r.path,
|
|
2564
|
-
errorMaps: [
|
|
2565
|
-
r.common.contextualErrorMap,
|
|
2566
|
-
r.schemaErrorMap,
|
|
2567
|
-
Be(),
|
|
2568
|
-
ye
|
|
2569
|
-
].filter((d) => !!d),
|
|
2570
|
-
issueData: {
|
|
2571
|
-
code: l.invalid_arguments,
|
|
2572
|
-
argumentsError: c
|
|
2573
|
-
}
|
|
2574
|
-
});
|
|
2575
|
-
}
|
|
2576
|
-
function s(o, c) {
|
|
2577
|
-
return He({
|
|
2578
|
-
data: o,
|
|
2579
|
-
path: r.path,
|
|
2580
|
-
errorMaps: [
|
|
2581
|
-
r.common.contextualErrorMap,
|
|
2582
|
-
r.schemaErrorMap,
|
|
2583
|
-
Be(),
|
|
2584
|
-
ye
|
|
2585
|
-
].filter((d) => !!d),
|
|
2586
|
-
issueData: {
|
|
2587
|
-
code: l.invalid_return_type,
|
|
2588
|
-
returnTypeError: c
|
|
2589
|
-
}
|
|
2590
|
-
});
|
|
2591
|
-
}
|
|
2592
|
-
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
2593
|
-
if (this._def.returns instanceof ve) {
|
|
2594
|
-
const o = this;
|
|
2595
|
-
return A(async function(...c) {
|
|
2596
|
-
const d = new C([]), u = await o._def.args.parseAsync(c, a).catch((P) => {
|
|
2597
|
-
throw d.addIssue(n(c, P)), d;
|
|
2598
|
-
}), w = await Reflect.apply(i, this, u);
|
|
2599
|
-
return await o._def.returns._def.type.parseAsync(w, a).catch((P) => {
|
|
2600
|
-
throw d.addIssue(s(w, P)), d;
|
|
2601
|
-
});
|
|
2602
|
-
});
|
|
2603
|
-
} else {
|
|
2604
|
-
const o = this;
|
|
2605
|
-
return A(function(...c) {
|
|
2606
|
-
const d = o._def.args.safeParse(c, a);
|
|
2607
|
-
if (!d.success)
|
|
2608
|
-
throw new C([n(c, d.error)]);
|
|
2609
|
-
const u = Reflect.apply(i, this, d.data), w = o._def.returns.safeParse(u, a);
|
|
2610
|
-
if (!w.success)
|
|
2611
|
-
throw new C([s(u, w.error)]);
|
|
2612
|
-
return w.data;
|
|
2613
|
-
});
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
parameters() {
|
|
2617
|
-
return this._def.args;
|
|
2618
|
-
}
|
|
2619
|
-
returnType() {
|
|
2620
|
-
return this._def.returns;
|
|
2621
|
-
}
|
|
2622
|
-
args(...e) {
|
|
2623
|
-
return new me({
|
|
2624
|
-
...this._def,
|
|
2625
|
-
args: V.create(e).rest(ie.create())
|
|
2626
|
-
});
|
|
2627
|
-
}
|
|
2628
|
-
returns(e) {
|
|
2629
|
-
return new me({
|
|
2630
|
-
...this._def,
|
|
2631
|
-
returns: e
|
|
2632
|
-
});
|
|
2633
|
-
}
|
|
2634
|
-
implement(e) {
|
|
2635
|
-
return this.parse(e);
|
|
2636
|
-
}
|
|
2637
|
-
strictImplement(e) {
|
|
2638
|
-
return this.parse(e);
|
|
2639
|
-
}
|
|
2640
|
-
static create(e, r, n) {
|
|
2641
|
-
return new me({
|
|
2642
|
-
args: e || V.create([]).rest(ie.create()),
|
|
2643
|
-
returns: r || ie.create(),
|
|
2644
|
-
typeName: m.ZodFunction,
|
|
2645
|
-
...v(n)
|
|
2646
|
-
});
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
class Ce extends _ {
|
|
2411
|
+
class ct extends k {
|
|
2650
2412
|
get schema() {
|
|
2651
2413
|
return this._def.getter();
|
|
2652
2414
|
}
|
|
@@ -2655,18 +2417,18 @@ var ls = _r((ps, mt) => {
|
|
|
2655
2417
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2656
2418
|
}
|
|
2657
2419
|
}
|
|
2658
|
-
|
|
2420
|
+
ct.create = (t, e) => new ct({
|
|
2659
2421
|
getter: t,
|
|
2660
|
-
typeName:
|
|
2422
|
+
typeName: g.ZodLazy,
|
|
2661
2423
|
...v(e)
|
|
2662
2424
|
});
|
|
2663
|
-
class
|
|
2425
|
+
class ut extends k {
|
|
2664
2426
|
_parse(e) {
|
|
2665
2427
|
if (e.data !== this._def.value) {
|
|
2666
2428
|
const r = this._getOrReturnCtx(e);
|
|
2667
|
-
return
|
|
2429
|
+
return l(r, {
|
|
2668
2430
|
received: r.data,
|
|
2669
|
-
code:
|
|
2431
|
+
code: c.invalid_literal,
|
|
2670
2432
|
expected: this._def.value
|
|
2671
2433
|
}), y;
|
|
2672
2434
|
}
|
|
@@ -2676,40 +2438,37 @@ var ls = _r((ps, mt) => {
|
|
|
2676
2438
|
return this._def.value;
|
|
2677
2439
|
}
|
|
2678
2440
|
}
|
|
2679
|
-
|
|
2441
|
+
ut.create = (t, e) => new ut({
|
|
2680
2442
|
value: t,
|
|
2681
|
-
typeName:
|
|
2443
|
+
typeName: g.ZodLiteral,
|
|
2682
2444
|
...v(e)
|
|
2683
2445
|
});
|
|
2684
|
-
function
|
|
2685
|
-
return new
|
|
2446
|
+
function _t(t, e) {
|
|
2447
|
+
return new re({
|
|
2686
2448
|
values: t,
|
|
2687
|
-
typeName:
|
|
2449
|
+
typeName: g.ZodEnum,
|
|
2688
2450
|
...v(e)
|
|
2689
2451
|
});
|
|
2690
2452
|
}
|
|
2691
|
-
class
|
|
2692
|
-
constructor() {
|
|
2693
|
-
super(...arguments), be.set(this, void 0);
|
|
2694
|
-
}
|
|
2453
|
+
class re extends k {
|
|
2695
2454
|
_parse(e) {
|
|
2696
2455
|
if (typeof e.data != "string") {
|
|
2697
2456
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2698
|
-
return
|
|
2699
|
-
expected:
|
|
2457
|
+
return l(r, {
|
|
2458
|
+
expected: w.joinValues(n),
|
|
2700
2459
|
received: r.parsedType,
|
|
2701
|
-
code:
|
|
2460
|
+
code: c.invalid_type
|
|
2702
2461
|
}), y;
|
|
2703
2462
|
}
|
|
2704
|
-
if (
|
|
2463
|
+
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2705
2464
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2706
|
-
return
|
|
2465
|
+
return l(r, {
|
|
2707
2466
|
received: r.data,
|
|
2708
|
-
code:
|
|
2467
|
+
code: c.invalid_enum_value,
|
|
2709
2468
|
options: n
|
|
2710
2469
|
}), y;
|
|
2711
2470
|
}
|
|
2712
|
-
return
|
|
2471
|
+
return C(e.data);
|
|
2713
2472
|
}
|
|
2714
2473
|
get options() {
|
|
2715
2474
|
return this._def.values;
|
|
@@ -2733,89 +2492,84 @@ var ls = _r((ps, mt) => {
|
|
|
2733
2492
|
return e;
|
|
2734
2493
|
}
|
|
2735
2494
|
extract(e, r = this._def) {
|
|
2736
|
-
return
|
|
2495
|
+
return re.create(e, {
|
|
2737
2496
|
...this._def,
|
|
2738
2497
|
...r
|
|
2739
2498
|
});
|
|
2740
2499
|
}
|
|
2741
2500
|
exclude(e, r = this._def) {
|
|
2742
|
-
return
|
|
2501
|
+
return re.create(this.options.filter((n) => !e.includes(n)), {
|
|
2743
2502
|
...this._def,
|
|
2744
2503
|
...r
|
|
2745
2504
|
});
|
|
2746
2505
|
}
|
|
2747
2506
|
}
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
class je extends _ {
|
|
2751
|
-
constructor() {
|
|
2752
|
-
super(...arguments), xe.set(this, void 0);
|
|
2753
|
-
}
|
|
2507
|
+
re.create = _t;
|
|
2508
|
+
class lt extends k {
|
|
2754
2509
|
_parse(e) {
|
|
2755
|
-
const r =
|
|
2756
|
-
if (n.parsedType !==
|
|
2757
|
-
const s =
|
|
2758
|
-
return
|
|
2759
|
-
expected:
|
|
2510
|
+
const r = w.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2511
|
+
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2512
|
+
const s = w.objectValues(r);
|
|
2513
|
+
return l(n, {
|
|
2514
|
+
expected: w.joinValues(s),
|
|
2760
2515
|
received: n.parsedType,
|
|
2761
|
-
code:
|
|
2516
|
+
code: c.invalid_type
|
|
2762
2517
|
}), y;
|
|
2763
2518
|
}
|
|
2764
|
-
if (
|
|
2765
|
-
const s =
|
|
2766
|
-
return
|
|
2519
|
+
if (this._cache || (this._cache = new Set(w.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2520
|
+
const s = w.objectValues(r);
|
|
2521
|
+
return l(n, {
|
|
2767
2522
|
received: n.data,
|
|
2768
|
-
code:
|
|
2523
|
+
code: c.invalid_enum_value,
|
|
2769
2524
|
options: s
|
|
2770
2525
|
}), y;
|
|
2771
2526
|
}
|
|
2772
|
-
return
|
|
2527
|
+
return C(e.data);
|
|
2773
2528
|
}
|
|
2774
2529
|
get enum() {
|
|
2775
2530
|
return this._def.values;
|
|
2776
2531
|
}
|
|
2777
2532
|
}
|
|
2778
|
-
|
|
2779
|
-
je.create = (t, e) => new je({
|
|
2533
|
+
lt.create = (t, e) => new lt({
|
|
2780
2534
|
values: t,
|
|
2781
|
-
typeName:
|
|
2535
|
+
typeName: g.ZodNativeEnum,
|
|
2782
2536
|
...v(e)
|
|
2783
2537
|
});
|
|
2784
|
-
class
|
|
2538
|
+
class Se extends k {
|
|
2785
2539
|
unwrap() {
|
|
2786
2540
|
return this._def.type;
|
|
2787
2541
|
}
|
|
2788
2542
|
_parse(e) {
|
|
2789
2543
|
const { ctx: r } = this._processInputParams(e);
|
|
2790
|
-
if (r.parsedType !==
|
|
2791
|
-
return
|
|
2792
|
-
code:
|
|
2793
|
-
expected:
|
|
2544
|
+
if (r.parsedType !== f.promise && r.common.async === !1)
|
|
2545
|
+
return l(r, {
|
|
2546
|
+
code: c.invalid_type,
|
|
2547
|
+
expected: f.promise,
|
|
2794
2548
|
received: r.parsedType
|
|
2795
2549
|
}), y;
|
|
2796
|
-
const n = r.parsedType ===
|
|
2797
|
-
return
|
|
2550
|
+
const n = r.parsedType === f.promise ? r.data : Promise.resolve(r.data);
|
|
2551
|
+
return C(n.then((s) => this._def.type.parseAsync(s, {
|
|
2798
2552
|
path: r.path,
|
|
2799
2553
|
errorMap: r.common.contextualErrorMap
|
|
2800
2554
|
})));
|
|
2801
2555
|
}
|
|
2802
2556
|
}
|
|
2803
|
-
|
|
2557
|
+
Se.create = (t, e) => new Se({
|
|
2804
2558
|
type: t,
|
|
2805
|
-
typeName:
|
|
2559
|
+
typeName: g.ZodPromise,
|
|
2806
2560
|
...v(e)
|
|
2807
2561
|
});
|
|
2808
|
-
class
|
|
2562
|
+
class ne extends k {
|
|
2809
2563
|
innerType() {
|
|
2810
2564
|
return this._def.schema;
|
|
2811
2565
|
}
|
|
2812
2566
|
sourceType() {
|
|
2813
|
-
return this._def.schema._def.typeName ===
|
|
2567
|
+
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2814
2568
|
}
|
|
2815
2569
|
_parse(e) {
|
|
2816
2570
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2817
2571
|
addIssue: (i) => {
|
|
2818
|
-
|
|
2572
|
+
l(n, i), i.fatal ? r.abort() : r.dirty();
|
|
2819
2573
|
},
|
|
2820
2574
|
get path() {
|
|
2821
2575
|
return n.path;
|
|
@@ -2827,12 +2581,12 @@ var ls = _r((ps, mt) => {
|
|
|
2827
2581
|
return Promise.resolve(i).then(async (o) => {
|
|
2828
2582
|
if (r.value === "aborted")
|
|
2829
2583
|
return y;
|
|
2830
|
-
const
|
|
2584
|
+
const d = await this._def.schema._parseAsync({
|
|
2831
2585
|
data: o,
|
|
2832
2586
|
path: n.path,
|
|
2833
2587
|
parent: n
|
|
2834
2588
|
});
|
|
2835
|
-
return
|
|
2589
|
+
return d.status === "aborted" ? y : d.status === "dirty" || r.value === "dirty" ? ce(d.value) : d;
|
|
2836
2590
|
});
|
|
2837
2591
|
{
|
|
2838
2592
|
if (r.value === "aborted")
|
|
@@ -2842,15 +2596,15 @@ var ls = _r((ps, mt) => {
|
|
|
2842
2596
|
path: n.path,
|
|
2843
2597
|
parent: n
|
|
2844
2598
|
});
|
|
2845
|
-
return o.status === "aborted" ? y : o.status === "dirty" || r.value === "dirty" ?
|
|
2599
|
+
return o.status === "aborted" ? y : o.status === "dirty" || r.value === "dirty" ? ce(o.value) : o;
|
|
2846
2600
|
}
|
|
2847
2601
|
}
|
|
2848
2602
|
if (s.type === "refinement") {
|
|
2849
2603
|
const i = (o) => {
|
|
2850
|
-
const
|
|
2604
|
+
const d = s.refinement(o, a);
|
|
2851
2605
|
if (n.common.async)
|
|
2852
|
-
return Promise.resolve(
|
|
2853
|
-
if (
|
|
2606
|
+
return Promise.resolve(d);
|
|
2607
|
+
if (d instanceof Promise)
|
|
2854
2608
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2855
2609
|
return o;
|
|
2856
2610
|
};
|
|
@@ -2871,60 +2625,63 @@ var ls = _r((ps, mt) => {
|
|
|
2871
2625
|
path: n.path,
|
|
2872
2626
|
parent: n
|
|
2873
2627
|
});
|
|
2874
|
-
if (!
|
|
2875
|
-
return
|
|
2628
|
+
if (!te(i))
|
|
2629
|
+
return y;
|
|
2876
2630
|
const o = s.transform(i.value, a);
|
|
2877
2631
|
if (o instanceof Promise)
|
|
2878
2632
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2879
2633
|
return { status: r.value, value: o };
|
|
2880
2634
|
} else
|
|
2881
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2882
|
-
|
|
2635
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => te(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({
|
|
2636
|
+
status: r.value,
|
|
2637
|
+
value: o
|
|
2638
|
+
})) : y);
|
|
2639
|
+
w.assertNever(s);
|
|
2883
2640
|
}
|
|
2884
2641
|
}
|
|
2885
|
-
|
|
2642
|
+
ne.create = (t, e, r) => new ne({
|
|
2886
2643
|
schema: t,
|
|
2887
|
-
typeName:
|
|
2644
|
+
typeName: g.ZodEffects,
|
|
2888
2645
|
effect: e,
|
|
2889
2646
|
...v(r)
|
|
2890
2647
|
});
|
|
2891
|
-
|
|
2648
|
+
ne.createWithPreprocess = (t, e, r) => new ne({
|
|
2892
2649
|
schema: e,
|
|
2893
2650
|
effect: { type: "preprocess", transform: t },
|
|
2894
|
-
typeName:
|
|
2651
|
+
typeName: g.ZodEffects,
|
|
2895
2652
|
...v(r)
|
|
2896
2653
|
});
|
|
2897
|
-
class
|
|
2654
|
+
class V extends k {
|
|
2898
2655
|
_parse(e) {
|
|
2899
|
-
return this._getType(e) ===
|
|
2656
|
+
return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(e);
|
|
2900
2657
|
}
|
|
2901
2658
|
unwrap() {
|
|
2902
2659
|
return this._def.innerType;
|
|
2903
2660
|
}
|
|
2904
2661
|
}
|
|
2905
|
-
|
|
2662
|
+
V.create = (t, e) => new V({
|
|
2906
2663
|
innerType: t,
|
|
2907
|
-
typeName:
|
|
2664
|
+
typeName: g.ZodOptional,
|
|
2908
2665
|
...v(e)
|
|
2909
2666
|
});
|
|
2910
|
-
class
|
|
2667
|
+
class se extends k {
|
|
2911
2668
|
_parse(e) {
|
|
2912
|
-
return this._getType(e) ===
|
|
2669
|
+
return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
|
|
2913
2670
|
}
|
|
2914
2671
|
unwrap() {
|
|
2915
2672
|
return this._def.innerType;
|
|
2916
2673
|
}
|
|
2917
2674
|
}
|
|
2918
|
-
|
|
2675
|
+
se.create = (t, e) => new se({
|
|
2919
2676
|
innerType: t,
|
|
2920
|
-
typeName:
|
|
2677
|
+
typeName: g.ZodNullable,
|
|
2921
2678
|
...v(e)
|
|
2922
2679
|
});
|
|
2923
|
-
class
|
|
2680
|
+
class je extends k {
|
|
2924
2681
|
_parse(e) {
|
|
2925
2682
|
const { ctx: r } = this._processInputParams(e);
|
|
2926
2683
|
let n = r.data;
|
|
2927
|
-
return r.parsedType ===
|
|
2684
|
+
return r.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2928
2685
|
data: n,
|
|
2929
2686
|
path: r.path,
|
|
2930
2687
|
parent: r
|
|
@@ -2934,13 +2691,13 @@ var ls = _r((ps, mt) => {
|
|
|
2934
2691
|
return this._def.innerType;
|
|
2935
2692
|
}
|
|
2936
2693
|
}
|
|
2937
|
-
|
|
2694
|
+
je.create = (t, e) => new je({
|
|
2938
2695
|
innerType: t,
|
|
2939
|
-
typeName:
|
|
2696
|
+
typeName: g.ZodDefault,
|
|
2940
2697
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2941
2698
|
...v(e)
|
|
2942
2699
|
});
|
|
2943
|
-
class $e extends
|
|
2700
|
+
class $e extends k {
|
|
2944
2701
|
_parse(e) {
|
|
2945
2702
|
const { ctx: r } = this._processInputParams(e), n = {
|
|
2946
2703
|
...r,
|
|
@@ -2955,11 +2712,11 @@ var ls = _r((ps, mt) => {
|
|
|
2955
2712
|
...n
|
|
2956
2713
|
}
|
|
2957
2714
|
});
|
|
2958
|
-
return
|
|
2715
|
+
return ke(s) ? s.then((a) => ({
|
|
2959
2716
|
status: "valid",
|
|
2960
2717
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2961
2718
|
get error() {
|
|
2962
|
-
return new
|
|
2719
|
+
return new F(n.common.issues);
|
|
2963
2720
|
},
|
|
2964
2721
|
input: n.data
|
|
2965
2722
|
})
|
|
@@ -2967,7 +2724,7 @@ var ls = _r((ps, mt) => {
|
|
|
2967
2724
|
status: "valid",
|
|
2968
2725
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2969
2726
|
get error() {
|
|
2970
|
-
return new
|
|
2727
|
+
return new F(n.common.issues);
|
|
2971
2728
|
},
|
|
2972
2729
|
input: n.data
|
|
2973
2730
|
})
|
|
@@ -2979,29 +2736,28 @@ var ls = _r((ps, mt) => {
|
|
|
2979
2736
|
}
|
|
2980
2737
|
$e.create = (t, e) => new $e({
|
|
2981
2738
|
innerType: t,
|
|
2982
|
-
typeName:
|
|
2739
|
+
typeName: g.ZodCatch,
|
|
2983
2740
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2984
2741
|
...v(e)
|
|
2985
2742
|
});
|
|
2986
|
-
class
|
|
2743
|
+
class ft extends k {
|
|
2987
2744
|
_parse(e) {
|
|
2988
|
-
if (this._getType(e) !==
|
|
2745
|
+
if (this._getType(e) !== f.nan) {
|
|
2989
2746
|
const n = this._getOrReturnCtx(e);
|
|
2990
|
-
return
|
|
2991
|
-
code:
|
|
2992
|
-
expected:
|
|
2747
|
+
return l(n, {
|
|
2748
|
+
code: c.invalid_type,
|
|
2749
|
+
expected: f.nan,
|
|
2993
2750
|
received: n.parsedType
|
|
2994
2751
|
}), y;
|
|
2995
2752
|
}
|
|
2996
2753
|
return { status: "valid", value: e.data };
|
|
2997
2754
|
}
|
|
2998
2755
|
}
|
|
2999
|
-
|
|
3000
|
-
typeName:
|
|
2756
|
+
ft.create = (t) => new ft({
|
|
2757
|
+
typeName: g.ZodNaN,
|
|
3001
2758
|
...v(t)
|
|
3002
2759
|
});
|
|
3003
|
-
|
|
3004
|
-
class yt extends _ {
|
|
2760
|
+
class Cr extends k {
|
|
3005
2761
|
_parse(e) {
|
|
3006
2762
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
3007
2763
|
return this._def.type._parse({
|
|
@@ -3014,7 +2770,7 @@ var ls = _r((ps, mt) => {
|
|
|
3014
2770
|
return this._def.type;
|
|
3015
2771
|
}
|
|
3016
2772
|
}
|
|
3017
|
-
class
|
|
2773
|
+
class ze extends k {
|
|
3018
2774
|
_parse(e) {
|
|
3019
2775
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3020
2776
|
if (n.common.async)
|
|
@@ -3024,7 +2780,7 @@ var ls = _r((ps, mt) => {
|
|
|
3024
2780
|
path: n.path,
|
|
3025
2781
|
parent: n
|
|
3026
2782
|
});
|
|
3027
|
-
return a.status === "aborted" ? y : a.status === "dirty" ? (r.dirty(),
|
|
2783
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (r.dirty(), ce(a.value)) : this._def.out._parseAsync({
|
|
3028
2784
|
data: a.value,
|
|
3029
2785
|
path: n.path,
|
|
3030
2786
|
parent: n
|
|
@@ -3047,17 +2803,17 @@ var ls = _r((ps, mt) => {
|
|
|
3047
2803
|
}
|
|
3048
2804
|
}
|
|
3049
2805
|
static create(e, r) {
|
|
3050
|
-
return new
|
|
2806
|
+
return new ze({
|
|
3051
2807
|
in: e,
|
|
3052
2808
|
out: r,
|
|
3053
|
-
typeName:
|
|
2809
|
+
typeName: g.ZodPipeline
|
|
3054
2810
|
});
|
|
3055
2811
|
}
|
|
3056
2812
|
}
|
|
3057
|
-
class Fe extends
|
|
2813
|
+
class Fe extends k {
|
|
3058
2814
|
_parse(e) {
|
|
3059
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
3060
|
-
return
|
|
2815
|
+
const r = this._def.innerType._parse(e), n = (s) => (te(s) && (s.value = Object.freeze(s.value)), s);
|
|
2816
|
+
return ke(r) ? r.then((s) => n(s)) : n(r);
|
|
3061
2817
|
}
|
|
3062
2818
|
unwrap() {
|
|
3063
2819
|
return this._def.innerType;
|
|
@@ -3065,183 +2821,41 @@ var ls = _r((ps, mt) => {
|
|
|
3065
2821
|
}
|
|
3066
2822
|
Fe.create = (t, e) => new Fe({
|
|
3067
2823
|
innerType: t,
|
|
3068
|
-
typeName:
|
|
2824
|
+
typeName: g.ZodReadonly,
|
|
3069
2825
|
...v(e)
|
|
3070
2826
|
});
|
|
3071
|
-
|
|
3072
|
-
const r = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
3073
|
-
return typeof r == "string" ? { message: r } : r;
|
|
3074
|
-
}
|
|
3075
|
-
function Lt(t, e = {}, r) {
|
|
3076
|
-
return t ? ge.create().superRefine((n, s) => {
|
|
3077
|
-
var a, i;
|
|
3078
|
-
const o = t(n);
|
|
3079
|
-
if (o instanceof Promise)
|
|
3080
|
-
return o.then((c) => {
|
|
3081
|
-
var d, u;
|
|
3082
|
-
if (!c) {
|
|
3083
|
-
const w = St(e, n), x = (u = (d = w.fatal) !== null && d !== void 0 ? d : r) !== null && u !== void 0 ? u : !0;
|
|
3084
|
-
s.addIssue({ code: "custom", ...w, fatal: x });
|
|
3085
|
-
}
|
|
3086
|
-
});
|
|
3087
|
-
if (!o) {
|
|
3088
|
-
const c = St(e, n), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : r) !== null && i !== void 0 ? i : !0;
|
|
3089
|
-
s.addIssue({ code: "custom", ...c, fatal: d });
|
|
3090
|
-
}
|
|
3091
|
-
}) : ge.create();
|
|
3092
|
-
}
|
|
3093
|
-
const rn = {
|
|
3094
|
-
object: T.lazycreate
|
|
3095
|
-
};
|
|
3096
|
-
var m;
|
|
2827
|
+
var g;
|
|
3097
2828
|
(function(t) {
|
|
3098
2829
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3099
|
-
})(
|
|
3100
|
-
const
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
setErrorMap: Cr,
|
|
3116
|
-
getErrorMap: Be,
|
|
3117
|
-
makeIssue: He,
|
|
3118
|
-
EMPTY_PATH: Ir,
|
|
3119
|
-
addIssueToContext: f,
|
|
3120
|
-
ParseStatus: O,
|
|
3121
|
-
INVALID: y,
|
|
3122
|
-
DIRTY: he,
|
|
3123
|
-
OK: A,
|
|
3124
|
-
isAborted: ot,
|
|
3125
|
-
isDirty: ct,
|
|
3126
|
-
isValid: oe,
|
|
3127
|
-
isAsync: Te,
|
|
3128
|
-
get util() {
|
|
3129
|
-
return k;
|
|
3130
|
-
},
|
|
3131
|
-
get objectUtil() {
|
|
3132
|
-
return it;
|
|
3133
|
-
},
|
|
3134
|
-
ZodParsedType: p,
|
|
3135
|
-
getParsedType: B,
|
|
3136
|
-
ZodType: _,
|
|
3137
|
-
datetimeRegex: Ft,
|
|
3138
|
-
ZodString: j,
|
|
3139
|
-
ZodNumber: K,
|
|
3140
|
-
ZodBigInt: G,
|
|
3141
|
-
ZodBoolean: Ee,
|
|
3142
|
-
ZodDate: ce,
|
|
3143
|
-
ZodSymbol: Je,
|
|
3144
|
-
ZodUndefined: Oe,
|
|
3145
|
-
ZodNull: Ne,
|
|
3146
|
-
ZodAny: ge,
|
|
3147
|
-
ZodUnknown: ie,
|
|
3148
|
-
ZodNever: W,
|
|
3149
|
-
ZodVoid: Ye,
|
|
3150
|
-
ZodArray: Z,
|
|
3151
|
-
ZodObject: T,
|
|
3152
|
-
ZodUnion: Re,
|
|
3153
|
-
ZodDiscriminatedUnion: et,
|
|
3154
|
-
ZodIntersection: Ae,
|
|
3155
|
-
ZodTuple: V,
|
|
3156
|
-
ZodRecord: Pe,
|
|
3157
|
-
ZodMap: Ke,
|
|
3158
|
-
ZodSet: de,
|
|
3159
|
-
ZodFunction: me,
|
|
3160
|
-
ZodLazy: Ce,
|
|
3161
|
-
ZodLiteral: Ie,
|
|
3162
|
-
ZodEnum: X,
|
|
3163
|
-
ZodNativeEnum: je,
|
|
3164
|
-
ZodPromise: ve,
|
|
3165
|
-
ZodEffects: $,
|
|
3166
|
-
ZodTransformer: $,
|
|
3167
|
-
ZodOptional: L,
|
|
3168
|
-
ZodNullable: Q,
|
|
3169
|
-
ZodDefault: Ze,
|
|
3170
|
-
ZodCatch: $e,
|
|
3171
|
-
ZodNaN: Ge,
|
|
3172
|
-
BRAND: tn,
|
|
3173
|
-
ZodBranded: yt,
|
|
3174
|
-
ZodPipeline: Me,
|
|
3175
|
-
ZodReadonly: Fe,
|
|
3176
|
-
custom: Lt,
|
|
3177
|
-
Schema: _,
|
|
3178
|
-
ZodSchema: _,
|
|
3179
|
-
late: rn,
|
|
3180
|
-
get ZodFirstPartyTypeKind() {
|
|
3181
|
-
return m;
|
|
3182
|
-
},
|
|
3183
|
-
coerce: Mn,
|
|
3184
|
-
any: un,
|
|
3185
|
-
array: mn,
|
|
3186
|
-
bigint: an,
|
|
3187
|
-
boolean: zt,
|
|
3188
|
-
date: on,
|
|
3189
|
-
discriminatedUnion: _n,
|
|
3190
|
-
effect: Tt,
|
|
3191
|
-
enum: Nn,
|
|
3192
|
-
function: Tn,
|
|
3193
|
-
instanceof: nn,
|
|
3194
|
-
intersection: wn,
|
|
3195
|
-
lazy: En,
|
|
3196
|
-
literal: On,
|
|
3197
|
-
map: xn,
|
|
3198
|
-
nan: sn,
|
|
3199
|
-
nativeEnum: Rn,
|
|
3200
|
-
never: pn,
|
|
3201
|
-
null: ln,
|
|
3202
|
-
nullable: Cn,
|
|
3203
|
-
number: Vt,
|
|
3204
|
-
object: yn,
|
|
3205
|
-
oboolean: Fn,
|
|
3206
|
-
onumber: $n,
|
|
3207
|
-
optional: Pn,
|
|
3208
|
-
ostring: Zn,
|
|
3209
|
-
pipeline: jn,
|
|
3210
|
-
preprocess: In,
|
|
3211
|
-
promise: An,
|
|
3212
|
-
record: bn,
|
|
3213
|
-
set: Sn,
|
|
3214
|
-
strictObject: gn,
|
|
3215
|
-
string: Dt,
|
|
3216
|
-
symbol: cn,
|
|
3217
|
-
transformer: Tt,
|
|
3218
|
-
tuple: kn,
|
|
3219
|
-
undefined: dn,
|
|
3220
|
-
union: vn,
|
|
3221
|
-
unknown: fn,
|
|
3222
|
-
void: hn,
|
|
3223
|
-
NEVER: Ln,
|
|
3224
|
-
ZodIssueCode: l,
|
|
3225
|
-
quotelessJson: Pr,
|
|
3226
|
-
ZodError: C
|
|
2830
|
+
})(g || (g = {}));
|
|
2831
|
+
const kt = D.create;
|
|
2832
|
+
U.create;
|
|
2833
|
+
P.create;
|
|
2834
|
+
const wt = O.create;
|
|
2835
|
+
xe.create;
|
|
2836
|
+
be.create;
|
|
2837
|
+
Y.create;
|
|
2838
|
+
re.create;
|
|
2839
|
+
Se.create;
|
|
2840
|
+
V.create;
|
|
2841
|
+
se.create;
|
|
2842
|
+
const Ze = wt({
|
|
2843
|
+
detail: kt()
|
|
2844
|
+
}), xt = wt({
|
|
2845
|
+
error: kt()
|
|
3227
2846
|
});
|
|
3228
|
-
|
|
3229
|
-
detail: Xe.string()
|
|
3230
|
-
}), qt = Xe.object({
|
|
3231
|
-
error: Xe.string()
|
|
3232
|
-
});
|
|
3233
|
-
function Ut(t) {
|
|
2847
|
+
function Ar(t) {
|
|
3234
2848
|
if (!t)
|
|
3235
2849
|
return "Unknown error";
|
|
3236
2850
|
if (t instanceof Error) {
|
|
3237
|
-
const e =
|
|
3238
|
-
return e.success ? e.data.detail :
|
|
2851
|
+
const e = Ze.safeParse(t.cause);
|
|
2852
|
+
return e.success ? e.data.detail : Ir(t.message);
|
|
3239
2853
|
}
|
|
3240
2854
|
if (typeof t == "object") {
|
|
3241
|
-
const e =
|
|
2855
|
+
const e = Ze.safeParse(t);
|
|
3242
2856
|
if (e.success)
|
|
3243
2857
|
return e.data.detail;
|
|
3244
|
-
const r =
|
|
2858
|
+
const r = xt.safeParse(t);
|
|
3245
2859
|
if (r.success)
|
|
3246
2860
|
return r.data.error;
|
|
3247
2861
|
}
|
|
@@ -3251,64 +2865,60 @@ var ls = _r((ps, mt) => {
|
|
|
3251
2865
|
return String(t);
|
|
3252
2866
|
}
|
|
3253
2867
|
}
|
|
3254
|
-
function
|
|
3255
|
-
const e =
|
|
2868
|
+
function Ir(t) {
|
|
2869
|
+
const e = Pr(t);
|
|
3256
2870
|
if (!e)
|
|
3257
2871
|
return t;
|
|
3258
|
-
const r =
|
|
2872
|
+
const r = Ze.safeParse(e);
|
|
3259
2873
|
if (r.success)
|
|
3260
2874
|
return r.data.detail;
|
|
3261
|
-
const n =
|
|
2875
|
+
const n = xt.safeParse(e);
|
|
3262
2876
|
return n.success ? n.data.error : t;
|
|
3263
2877
|
}
|
|
3264
|
-
function
|
|
2878
|
+
function Pr(t) {
|
|
3265
2879
|
try {
|
|
3266
2880
|
return JSON.parse(t);
|
|
3267
2881
|
} catch {
|
|
3268
2882
|
return t;
|
|
3269
2883
|
}
|
|
3270
2884
|
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
throw new Error(e);
|
|
3274
|
-
}
|
|
3275
|
-
const zn = "marimo-transport";
|
|
3276
|
-
function Se(t) {
|
|
2885
|
+
const jr = "marimo-transport";
|
|
2886
|
+
function ue(t) {
|
|
3277
2887
|
return t.FS;
|
|
3278
2888
|
}
|
|
3279
|
-
const
|
|
3280
|
-
NOTEBOOK_FILENAME:
|
|
3281
|
-
HOME_DIR:
|
|
2889
|
+
const ie = "notebook.py", oe = "/marimo", M = {
|
|
2890
|
+
NOTEBOOK_FILENAME: ie,
|
|
2891
|
+
HOME_DIR: oe,
|
|
3282
2892
|
createHomeDir: (t) => {
|
|
3283
|
-
const e =
|
|
2893
|
+
const e = ue(t);
|
|
3284
2894
|
try {
|
|
3285
|
-
e.mkdirTree(
|
|
2895
|
+
e.mkdirTree(oe);
|
|
3286
2896
|
} catch {
|
|
3287
2897
|
}
|
|
3288
|
-
e.chdir(
|
|
2898
|
+
e.chdir(oe);
|
|
3289
2899
|
},
|
|
3290
2900
|
mountFS: (t) => {
|
|
3291
|
-
|
|
2901
|
+
ue(t).mount(t.FS.filesystems.IDBFS, { root: "." }, oe);
|
|
3292
2902
|
},
|
|
3293
2903
|
populateFilesToMemory: async (t) => {
|
|
3294
|
-
await
|
|
2904
|
+
await ht(t, !0);
|
|
3295
2905
|
},
|
|
3296
2906
|
persistFilesToRemote: async (t) => {
|
|
3297
|
-
await
|
|
2907
|
+
await ht(t, !1);
|
|
3298
2908
|
},
|
|
3299
2909
|
readNotebook: (t) => {
|
|
3300
|
-
const e =
|
|
3301
|
-
return
|
|
2910
|
+
const e = ue(t), r = `${oe}/${ie}`;
|
|
2911
|
+
return Ae(e.readFile(r));
|
|
3302
2912
|
},
|
|
3303
2913
|
initNotebookCode: (t) => {
|
|
3304
|
-
const { pyodide: e, filename: r, code: n } = t, s =
|
|
2914
|
+
const { pyodide: e, filename: r, code: n } = t, s = ue(e), a = (i) => {
|
|
3305
2915
|
try {
|
|
3306
|
-
return
|
|
2916
|
+
return Ae(s.readFile(i));
|
|
3307
2917
|
} catch {
|
|
3308
2918
|
return null;
|
|
3309
2919
|
}
|
|
3310
2920
|
};
|
|
3311
|
-
if (r && r !==
|
|
2921
|
+
if (r && r !== ie) {
|
|
3312
2922
|
const i = a(r);
|
|
3313
2923
|
if (i)
|
|
3314
2924
|
return {
|
|
@@ -3316,15 +2926,15 @@ var ls = _r((ps, mt) => {
|
|
|
3316
2926
|
filename: r
|
|
3317
2927
|
};
|
|
3318
2928
|
}
|
|
3319
|
-
return s.writeFile(
|
|
2929
|
+
return s.writeFile(ie, n), {
|
|
3320
2930
|
code: n,
|
|
3321
|
-
filename:
|
|
2931
|
+
filename: ie
|
|
3322
2932
|
};
|
|
3323
2933
|
}
|
|
3324
2934
|
};
|
|
3325
|
-
function
|
|
2935
|
+
function ht(t, e) {
|
|
3326
2936
|
return new Promise((r, n) => {
|
|
3327
|
-
|
|
2937
|
+
ue(t).syncfs(e, (s) => {
|
|
3328
2938
|
if (s instanceof Error) {
|
|
3329
2939
|
n(s);
|
|
3330
2940
|
return;
|
|
@@ -3333,30 +2943,30 @@ var ls = _r((ps, mt) => {
|
|
|
3333
2943
|
});
|
|
3334
2944
|
});
|
|
3335
2945
|
}
|
|
3336
|
-
var
|
|
2946
|
+
var $r = Object.defineProperty, _ = (t, e) => $r(t, "name", { value: e, configurable: !0 }), bt = ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, { get: (e, r) => (typeof require < "u" ? require : e)[r] }) : t)(function(t) {
|
|
3337
2947
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
3338
2948
|
throw new Error('Dynamic require of "' + t + '" is not supported');
|
|
3339
2949
|
});
|
|
3340
|
-
function
|
|
2950
|
+
function St(t) {
|
|
3341
2951
|
return !isNaN(parseFloat(t)) && isFinite(t);
|
|
3342
2952
|
}
|
|
3343
|
-
|
|
3344
|
-
function
|
|
2953
|
+
_(St, "_isNumber");
|
|
2954
|
+
function z(t) {
|
|
3345
2955
|
return t.charAt(0).toUpperCase() + t.substring(1);
|
|
3346
2956
|
}
|
|
3347
|
-
|
|
3348
|
-
function
|
|
2957
|
+
_(z, "_capitalize");
|
|
2958
|
+
function Ee(t) {
|
|
3349
2959
|
return function() {
|
|
3350
2960
|
return this[t];
|
|
3351
2961
|
};
|
|
3352
2962
|
}
|
|
3353
|
-
|
|
3354
|
-
var
|
|
3355
|
-
function
|
|
3356
|
-
if (t) for (var e = 0; e <
|
|
2963
|
+
_(Ee, "_getter");
|
|
2964
|
+
var G = ["isConstructor", "isEval", "isNative", "isToplevel"], K = ["columnNumber", "lineNumber"], Q = ["fileName", "functionName", "source"], Fr = ["args"], Zr = ["evalOrigin"], ye = G.concat(K, Q, Fr, Zr);
|
|
2965
|
+
function N(t) {
|
|
2966
|
+
if (t) for (var e = 0; e < ye.length; e++) t[ye[e]] !== void 0 && this["set" + z(ye[e])](t[ye[e]]);
|
|
3357
2967
|
}
|
|
3358
|
-
|
|
3359
|
-
|
|
2968
|
+
_(N, "StackFrame");
|
|
2969
|
+
N.prototype = { getArgs: function() {
|
|
3360
2970
|
return this.args;
|
|
3361
2971
|
}, setArgs: function(t) {
|
|
3362
2972
|
if (Object.prototype.toString.call(t) !== "[object Array]") throw new TypeError("Args must be an Array");
|
|
@@ -3364,48 +2974,48 @@ var ls = _r((ps, mt) => {
|
|
|
3364
2974
|
}, getEvalOrigin: function() {
|
|
3365
2975
|
return this.evalOrigin;
|
|
3366
2976
|
}, setEvalOrigin: function(t) {
|
|
3367
|
-
if (t instanceof
|
|
3368
|
-
else if (t instanceof Object) this.evalOrigin = new
|
|
2977
|
+
if (t instanceof N) this.evalOrigin = t;
|
|
2978
|
+
else if (t instanceof Object) this.evalOrigin = new N(t);
|
|
3369
2979
|
else throw new TypeError("Eval Origin must be an Object or StackFrame");
|
|
3370
2980
|
}, toString: function() {
|
|
3371
2981
|
var t = this.getFileName() || "", e = this.getLineNumber() || "", r = this.getColumnNumber() || "", n = this.getFunctionName() || "";
|
|
3372
2982
|
return this.getIsEval() ? t ? "[eval] (" + t + ":" + e + ":" + r + ")" : "[eval]:" + e + ":" + r : n ? n + " (" + t + ":" + e + ":" + r + ")" : t + ":" + e + ":" + r;
|
|
3373
2983
|
} };
|
|
3374
|
-
|
|
2984
|
+
N.fromString = _(function(t) {
|
|
3375
2985
|
var e = t.indexOf("("), r = t.lastIndexOf(")"), n = t.substring(0, e), s = t.substring(e + 1, r).split(","), a = t.substring(r + 1);
|
|
3376
|
-
if (a.indexOf("@") === 0) var i = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a, ""), o = i[1],
|
|
3377
|
-
return new
|
|
2986
|
+
if (a.indexOf("@") === 0) var i = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a, ""), o = i[1], d = i[2], u = i[3];
|
|
2987
|
+
return new N({ functionName: n, args: s || void 0, fileName: o, lineNumber: d || void 0, columnNumber: u || void 0 });
|
|
3378
2988
|
}, "StackFrame$$fromString");
|
|
3379
|
-
for (
|
|
2989
|
+
for (B = 0; B < G.length; B++) N.prototype["get" + z(G[B])] = Ee(G[B]), N.prototype["set" + z(G[B])] = /* @__PURE__ */ function(t) {
|
|
3380
2990
|
return function(e) {
|
|
3381
2991
|
this[t] = !!e;
|
|
3382
2992
|
};
|
|
3383
|
-
}(
|
|
3384
|
-
var
|
|
3385
|
-
for (
|
|
2993
|
+
}(G[B]);
|
|
2994
|
+
var B;
|
|
2995
|
+
for (W = 0; W < K.length; W++) N.prototype["get" + z(K[W])] = Ee(K[W]), N.prototype["set" + z(K[W])] = /* @__PURE__ */ function(t) {
|
|
3386
2996
|
return function(e) {
|
|
3387
|
-
if (!
|
|
2997
|
+
if (!St(e)) throw new TypeError(t + " must be a Number");
|
|
3388
2998
|
this[t] = Number(e);
|
|
3389
2999
|
};
|
|
3390
|
-
}(
|
|
3391
|
-
var
|
|
3392
|
-
for (
|
|
3000
|
+
}(K[W]);
|
|
3001
|
+
var W;
|
|
3002
|
+
for (J = 0; J < Q.length; J++) N.prototype["get" + z(Q[J])] = Ee(Q[J]), N.prototype["set" + z(Q[J])] = /* @__PURE__ */ function(t) {
|
|
3393
3003
|
return function(e) {
|
|
3394
3004
|
this[t] = String(e);
|
|
3395
3005
|
};
|
|
3396
|
-
}(
|
|
3397
|
-
var
|
|
3398
|
-
function
|
|
3006
|
+
}(Q[J]);
|
|
3007
|
+
var J, Re = N;
|
|
3008
|
+
function Ot() {
|
|
3399
3009
|
var t = /^\s*at .*(\S+:\d+|\(native\))/m, e = /^(eval@)?(\[native code])?$/;
|
|
3400
|
-
return { parse:
|
|
3010
|
+
return { parse: _(function(r) {
|
|
3401
3011
|
if (r.stack && r.stack.match(t)) return this.parseV8OrIE(r);
|
|
3402
3012
|
if (r.stack) return this.parseFFOrSafari(r);
|
|
3403
3013
|
throw new Error("Cannot parse given Error object");
|
|
3404
|
-
}, "ErrorStackParser$$parse"), extractLocation:
|
|
3014
|
+
}, "ErrorStackParser$$parse"), extractLocation: _(function(r) {
|
|
3405
3015
|
if (r.indexOf(":") === -1) return [r];
|
|
3406
3016
|
var n = /(.+?)(?::(\d+))?(?::(\d+))?$/, s = n.exec(r.replace(/[()]/g, ""));
|
|
3407
3017
|
return [s[1], s[2] || void 0, s[3] || void 0];
|
|
3408
|
-
}, "ErrorStackParser$$extractLocation"), parseV8OrIE:
|
|
3018
|
+
}, "ErrorStackParser$$extractLocation"), parseV8OrIE: _(function(r) {
|
|
3409
3019
|
var n = r.stack.split(`
|
|
3410
3020
|
`).filter(function(s) {
|
|
3411
3021
|
return !!s.match(t);
|
|
@@ -3414,67 +3024,67 @@ var ls = _r((ps, mt) => {
|
|
|
3414
3024
|
s.indexOf("(eval ") > -1 && (s = s.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
|
|
3415
3025
|
var a = s.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), i = a.match(/ (\(.+\)$)/);
|
|
3416
3026
|
a = i ? a.replace(i[0], "") : a;
|
|
3417
|
-
var o = this.extractLocation(i ? i[1] : a),
|
|
3418
|
-
return new
|
|
3027
|
+
var o = this.extractLocation(i ? i[1] : a), d = i && a || void 0, u = ["eval", "<anonymous>"].indexOf(o[0]) > -1 ? void 0 : o[0];
|
|
3028
|
+
return new Re({ functionName: d, fileName: u, lineNumber: o[1], columnNumber: o[2], source: s });
|
|
3419
3029
|
}, this);
|
|
3420
|
-
}, "ErrorStackParser$$parseV8OrIE"), parseFFOrSafari:
|
|
3030
|
+
}, "ErrorStackParser$$parseV8OrIE"), parseFFOrSafari: _(function(r) {
|
|
3421
3031
|
var n = r.stack.split(`
|
|
3422
3032
|
`).filter(function(s) {
|
|
3423
3033
|
return !s.match(e);
|
|
3424
3034
|
}, this);
|
|
3425
3035
|
return n.map(function(s) {
|
|
3426
|
-
if (s.indexOf(" > eval") > -1 && (s = s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), s.indexOf("@") === -1 && s.indexOf(":") === -1) return new
|
|
3427
|
-
var a = /((.*".+"[^@]*)?[^@]*)(?:@)/, i = s.match(a), o = i && i[1] ? i[1] : void 0,
|
|
3428
|
-
return new
|
|
3036
|
+
if (s.indexOf(" > eval") > -1 && (s = s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), s.indexOf("@") === -1 && s.indexOf(":") === -1) return new Re({ functionName: s });
|
|
3037
|
+
var a = /((.*".+"[^@]*)?[^@]*)(?:@)/, i = s.match(a), o = i && i[1] ? i[1] : void 0, d = this.extractLocation(s.replace(a, ""));
|
|
3038
|
+
return new Re({ functionName: o, fileName: d[0], lineNumber: d[1], columnNumber: d[2], source: s });
|
|
3429
3039
|
}, this);
|
|
3430
3040
|
}, "ErrorStackParser$$parseFFOrSafari") };
|
|
3431
3041
|
}
|
|
3432
|
-
|
|
3433
|
-
var
|
|
3042
|
+
_(Ot, "ErrorStackParser");
|
|
3043
|
+
var Lr = new Ot(), Mr = Lr, j = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && !process.browser, Et = j && typeof Ue < "u" && typeof Ue.exports < "u" && typeof bt < "u" && typeof __dirname < "u", Dr = j && !Et, Vr = typeof Deno < "u", Tt = !j && !Vr, qr = Tt && typeof window == "object" && typeof document == "object" && typeof document.createElement == "function" && "sessionStorage" in window && typeof importScripts != "function", Ur = Tt && typeof importScripts == "function" && typeof self == "object";
|
|
3434
3044
|
typeof navigator == "object" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Chrome") == -1 && navigator.userAgent.indexOf("Safari") > -1;
|
|
3435
|
-
var
|
|
3436
|
-
async function
|
|
3437
|
-
if (!
|
|
3438
|
-
let t =
|
|
3045
|
+
var Nt, Le, Rt, pt, He;
|
|
3046
|
+
async function Be() {
|
|
3047
|
+
if (!j || (Nt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, pt = await import("./__vite-browser-external-CPvbk0mb.js"), He = await import("./__vite-browser-external-CPvbk0mb.js"), Rt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, Le = await import("./__vite-browser-external-CPvbk0mb.js"), We = Le.sep, typeof bt < "u")) return;
|
|
3048
|
+
let t = pt, e = await import("./__vite-browser-external-CPvbk0mb.js"), r = await import("./__vite-browser-external-CPvbk0mb.js"), n = await import("./__vite-browser-external-CPvbk0mb.js"), s = { fs: t, crypto: e, ws: r, child_process: n };
|
|
3439
3049
|
globalThis.require = function(a) {
|
|
3440
3050
|
return s[a];
|
|
3441
3051
|
};
|
|
3442
3052
|
}
|
|
3443
|
-
|
|
3444
|
-
function
|
|
3445
|
-
return
|
|
3053
|
+
_(Be, "initNodeModules");
|
|
3054
|
+
function Ct(t, e) {
|
|
3055
|
+
return Le.resolve(e || ".", t);
|
|
3446
3056
|
}
|
|
3447
|
-
|
|
3448
|
-
function
|
|
3057
|
+
_(Ct, "node_resolvePath");
|
|
3058
|
+
function At(t, e) {
|
|
3449
3059
|
return e === void 0 && (e = location), new URL(t, e).toString();
|
|
3450
3060
|
}
|
|
3451
|
-
|
|
3452
|
-
var
|
|
3453
|
-
|
|
3454
|
-
var
|
|
3455
|
-
|
|
3456
|
-
function
|
|
3457
|
-
return t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? { response: fetch(t) } : { binary:
|
|
3061
|
+
_(At, "browser_resolvePath");
|
|
3062
|
+
var Me;
|
|
3063
|
+
j ? Me = Ct : Me = At;
|
|
3064
|
+
var We;
|
|
3065
|
+
j || (We = "/");
|
|
3066
|
+
function It(t, e) {
|
|
3067
|
+
return t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? { response: fetch(t) } : { binary: He.readFile(t).then((r) => new Uint8Array(r.buffer, r.byteOffset, r.byteLength)) };
|
|
3458
3068
|
}
|
|
3459
|
-
|
|
3460
|
-
function
|
|
3069
|
+
_(It, "node_getBinaryResponse");
|
|
3070
|
+
function Pt(t, e) {
|
|
3461
3071
|
let r = new URL(t, location);
|
|
3462
3072
|
return { response: fetch(r, e ? { integrity: e } : {}) };
|
|
3463
3073
|
}
|
|
3464
|
-
|
|
3465
|
-
var
|
|
3466
|
-
|
|
3467
|
-
async function
|
|
3468
|
-
let { response: r, binary: n } =
|
|
3074
|
+
_(Pt, "browser_getBinaryResponse");
|
|
3075
|
+
var Oe;
|
|
3076
|
+
j ? Oe = It : Oe = Pt;
|
|
3077
|
+
async function jt(t, e) {
|
|
3078
|
+
let { response: r, binary: n } = Oe(t, e);
|
|
3469
3079
|
if (n) return n;
|
|
3470
3080
|
let s = await r;
|
|
3471
3081
|
if (!s.ok) throw new Error(`Failed to load '${t}': request failed.`);
|
|
3472
3082
|
return new Uint8Array(await s.arrayBuffer());
|
|
3473
3083
|
}
|
|
3474
|
-
|
|
3475
|
-
var
|
|
3476
|
-
if (
|
|
3477
|
-
else if (
|
|
3084
|
+
_(jt, "loadBinaryFile");
|
|
3085
|
+
var ge;
|
|
3086
|
+
if (qr) ge = _(async (t) => await import(t), "loadScript");
|
|
3087
|
+
else if (Ur) ge = _(async (t) => {
|
|
3478
3088
|
try {
|
|
3479
3089
|
globalThis.importScripts(t);
|
|
3480
3090
|
} catch (e) {
|
|
@@ -3482,68 +3092,68 @@ var ls = _r((ps, mt) => {
|
|
|
3482
3092
|
else throw e;
|
|
3483
3093
|
}
|
|
3484
3094
|
}, "loadScript");
|
|
3485
|
-
else if (
|
|
3095
|
+
else if (j) ge = $t;
|
|
3486
3096
|
else throw new Error("Cannot determine runtime environment");
|
|
3487
|
-
async function
|
|
3488
|
-
t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ?
|
|
3489
|
-
}
|
|
3490
|
-
|
|
3491
|
-
async function
|
|
3492
|
-
if (
|
|
3493
|
-
await
|
|
3494
|
-
let e = await
|
|
3097
|
+
async function $t(t) {
|
|
3098
|
+
t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? Rt.runInThisContext(await (await fetch(t)).text()) : await import(Nt.pathToFileURL(t).href);
|
|
3099
|
+
}
|
|
3100
|
+
_($t, "nodeLoadScript");
|
|
3101
|
+
async function Ft(t) {
|
|
3102
|
+
if (j) {
|
|
3103
|
+
await Be();
|
|
3104
|
+
let e = await He.readFile(t, { encoding: "utf8" });
|
|
3495
3105
|
return JSON.parse(e);
|
|
3496
3106
|
} else return await (await fetch(t)).json();
|
|
3497
3107
|
}
|
|
3498
|
-
|
|
3499
|
-
async function
|
|
3500
|
-
if (
|
|
3108
|
+
_(Ft, "loadLockFile");
|
|
3109
|
+
async function Zt() {
|
|
3110
|
+
if (Et) return __dirname;
|
|
3501
3111
|
let t;
|
|
3502
3112
|
try {
|
|
3503
3113
|
throw new Error();
|
|
3504
3114
|
} catch (n) {
|
|
3505
3115
|
t = n;
|
|
3506
3116
|
}
|
|
3507
|
-
let e =
|
|
3508
|
-
if (
|
|
3117
|
+
let e = Mr.parse(t)[0].fileName;
|
|
3118
|
+
if (j && !e.startsWith("file://") && (e = `file://${e}`), Dr) {
|
|
3509
3119
|
let n = await import("./__vite-browser-external-CPvbk0mb.js");
|
|
3510
3120
|
return (await import("./__vite-browser-external-CPvbk0mb.js")).fileURLToPath(n.dirname(e));
|
|
3511
3121
|
}
|
|
3512
|
-
let r = e.lastIndexOf(
|
|
3122
|
+
let r = e.lastIndexOf(We);
|
|
3513
3123
|
if (r === -1) throw new Error("Could not extract indexURL path from pyodide module location");
|
|
3514
3124
|
return e.slice(0, r);
|
|
3515
3125
|
}
|
|
3516
|
-
|
|
3517
|
-
function
|
|
3126
|
+
_(Zt, "calculateDirname");
|
|
3127
|
+
function Lt(t) {
|
|
3518
3128
|
let e = t.FS, r = t.FS.filesystems.MEMFS, n = t.PATH, s = { DIR_MODE: 16895, FILE_MODE: 33279, mount: function(a) {
|
|
3519
3129
|
if (!a.opts.fileSystemHandle) throw new Error("opts.fileSystemHandle is required");
|
|
3520
3130
|
return r.mount.apply(null, arguments);
|
|
3521
3131
|
}, syncfs: async (a, i, o) => {
|
|
3522
3132
|
try {
|
|
3523
|
-
let
|
|
3524
|
-
await s.reconcile(a,
|
|
3525
|
-
} catch (
|
|
3526
|
-
o(
|
|
3133
|
+
let d = s.getLocalSet(a), u = await s.getRemoteSet(a), h = i ? u : d, b = i ? d : u;
|
|
3134
|
+
await s.reconcile(a, h, b), o(null);
|
|
3135
|
+
} catch (d) {
|
|
3136
|
+
o(d);
|
|
3527
3137
|
}
|
|
3528
3138
|
}, getLocalSet: (a) => {
|
|
3529
3139
|
let i = /* @__PURE__ */ Object.create(null);
|
|
3530
|
-
function o(
|
|
3531
|
-
return
|
|
3140
|
+
function o(h) {
|
|
3141
|
+
return h !== "." && h !== "..";
|
|
3532
3142
|
}
|
|
3533
|
-
|
|
3534
|
-
function
|
|
3535
|
-
return (
|
|
3143
|
+
_(o, "isRealDir");
|
|
3144
|
+
function d(h) {
|
|
3145
|
+
return (b) => n.join2(h, b);
|
|
3536
3146
|
}
|
|
3537
|
-
|
|
3538
|
-
let
|
|
3539
|
-
for (;
|
|
3540
|
-
let
|
|
3541
|
-
e.isDir(
|
|
3147
|
+
_(d, "toAbsolute");
|
|
3148
|
+
let u = e.readdir(a.mountpoint).filter(o).map(d(a.mountpoint));
|
|
3149
|
+
for (; u.length; ) {
|
|
3150
|
+
let h = u.pop(), b = e.stat(h);
|
|
3151
|
+
e.isDir(b.mode) && u.push.apply(u, e.readdir(h).filter(o).map(d(h))), i[h] = { timestamp: b.mtime, mode: b.mode };
|
|
3542
3152
|
}
|
|
3543
3153
|
return { type: "local", entries: i };
|
|
3544
3154
|
}, getRemoteSet: async (a) => {
|
|
3545
|
-
let i = /* @__PURE__ */ Object.create(null), o = await
|
|
3546
|
-
for (let [
|
|
3155
|
+
let i = /* @__PURE__ */ Object.create(null), o = await zr(a.opts.fileSystemHandle);
|
|
3156
|
+
for (let [d, u] of o) d !== "." && (i[n.join2(a.mountpoint, d)] = { timestamp: u.kind === "file" ? new Date((await u.getFile()).lastModified) : /* @__PURE__ */ new Date(), mode: u.kind === "file" ? s.FILE_MODE : s.DIR_MODE });
|
|
3547
3157
|
return { type: "remote", entries: i, handles: o };
|
|
3548
3158
|
}, loadLocalEntry: (a) => {
|
|
3549
3159
|
let i = e.lookupPath(a).node, o = e.stat(a);
|
|
@@ -3567,50 +3177,50 @@ var ls = _r((ps, mt) => {
|
|
|
3567
3177
|
throw new Error("unknown kind: " + a.kind);
|
|
3568
3178
|
}
|
|
3569
3179
|
}, storeRemoteEntry: async (a, i, o) => {
|
|
3570
|
-
let
|
|
3571
|
-
if (
|
|
3572
|
-
let
|
|
3573
|
-
await
|
|
3180
|
+
let d = a.get(n.dirname(i)), u = e.isFile(o.mode) ? await d.getFileHandle(n.basename(i), { create: !0 }) : await d.getDirectoryHandle(n.basename(i), { create: !0 });
|
|
3181
|
+
if (u.kind === "file") {
|
|
3182
|
+
let h = await u.createWritable();
|
|
3183
|
+
await h.write(o.contents), await h.close();
|
|
3574
3184
|
}
|
|
3575
|
-
a.set(i,
|
|
3185
|
+
a.set(i, u);
|
|
3576
3186
|
}, removeRemoteEntry: async (a, i) => {
|
|
3577
3187
|
await a.get(n.dirname(i)).removeEntry(n.basename(i)), a.delete(i);
|
|
3578
3188
|
}, reconcile: async (a, i, o) => {
|
|
3579
|
-
let
|
|
3580
|
-
Object.keys(i.entries).forEach(function(
|
|
3581
|
-
let
|
|
3582
|
-
(
|
|
3583
|
-
}),
|
|
3584
|
-
let
|
|
3585
|
-
if (Object.keys(o.entries).forEach(function(
|
|
3586
|
-
i.entries[
|
|
3587
|
-
}),
|
|
3588
|
-
let
|
|
3589
|
-
for (let
|
|
3590
|
-
let
|
|
3189
|
+
let d = 0, u = [];
|
|
3190
|
+
Object.keys(i.entries).forEach(function(S) {
|
|
3191
|
+
let A = i.entries[S], $ = o.entries[S];
|
|
3192
|
+
(!$ || e.isFile(A.mode) && A.timestamp.getTime() > $.timestamp.getTime()) && (u.push(S), d++);
|
|
3193
|
+
}), u.sort();
|
|
3194
|
+
let h = [];
|
|
3195
|
+
if (Object.keys(o.entries).forEach(function(S) {
|
|
3196
|
+
i.entries[S] || (h.push(S), d++);
|
|
3197
|
+
}), h.sort().reverse(), !d) return;
|
|
3198
|
+
let b = i.type === "remote" ? i.handles : o.handles;
|
|
3199
|
+
for (let S of u) {
|
|
3200
|
+
let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
|
|
3591
3201
|
if (o.type === "local") {
|
|
3592
|
-
let
|
|
3593
|
-
s.storeLocalEntry(
|
|
3202
|
+
let $ = b.get(A), pe = await s.loadRemoteEntry($);
|
|
3203
|
+
s.storeLocalEntry(S, pe);
|
|
3594
3204
|
} else {
|
|
3595
|
-
let
|
|
3596
|
-
await s.storeRemoteEntry(
|
|
3205
|
+
let $ = s.loadLocalEntry(S);
|
|
3206
|
+
await s.storeRemoteEntry(b, A, $);
|
|
3597
3207
|
}
|
|
3598
3208
|
}
|
|
3599
|
-
for (let
|
|
3209
|
+
for (let S of h) if (o.type === "local") s.removeLocalEntry(S);
|
|
3600
3210
|
else {
|
|
3601
|
-
let
|
|
3602
|
-
await s.removeRemoteEntry(
|
|
3211
|
+
let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
|
|
3212
|
+
await s.removeRemoteEntry(b, A);
|
|
3603
3213
|
}
|
|
3604
3214
|
} };
|
|
3605
3215
|
t.FS.filesystems.NATIVEFS_ASYNC = s;
|
|
3606
3216
|
}
|
|
3607
|
-
|
|
3608
|
-
var
|
|
3217
|
+
_(Lt, "initializeNativeFS");
|
|
3218
|
+
var zr = _(async (t) => {
|
|
3609
3219
|
let e = [];
|
|
3610
3220
|
async function r(s) {
|
|
3611
3221
|
for await (let a of s.values()) e.push(a), a.kind === "directory" && await r(a);
|
|
3612
3222
|
}
|
|
3613
|
-
|
|
3223
|
+
_(r, "collect"), await r(t);
|
|
3614
3224
|
let n = /* @__PURE__ */ new Map();
|
|
3615
3225
|
n.set(".", t);
|
|
3616
3226
|
for (let s of e) {
|
|
@@ -3619,14 +3229,14 @@ var ls = _r((ps, mt) => {
|
|
|
3619
3229
|
}
|
|
3620
3230
|
return n;
|
|
3621
3231
|
}, "getFsHandles");
|
|
3622
|
-
function
|
|
3623
|
-
let e = { noImageDecoding: !0, noAudioDecoding: !0, noWasmDecoding: !1, preRun:
|
|
3232
|
+
function Mt(t) {
|
|
3233
|
+
let e = { noImageDecoding: !0, noAudioDecoding: !0, noWasmDecoding: !1, preRun: zt(t), quit(r, n) {
|
|
3624
3234
|
throw e.exited = { status: r, toThrow: n }, n;
|
|
3625
|
-
}, print: t.stdout, printErr: t.stderr, thisProgram: t._sysExecutable, arguments: t.args, API: { config: t }, locateFile: (r) => t.indexURL + r, instantiateWasm:
|
|
3235
|
+
}, print: t.stdout, printErr: t.stderr, thisProgram: t._sysExecutable, arguments: t.args, API: { config: t }, locateFile: (r) => t.indexURL + r, instantiateWasm: Ht(t.indexURL) };
|
|
3626
3236
|
return e;
|
|
3627
3237
|
}
|
|
3628
|
-
|
|
3629
|
-
function
|
|
3238
|
+
_(Mt, "createSettings");
|
|
3239
|
+
function Dt(t) {
|
|
3630
3240
|
return function(e) {
|
|
3631
3241
|
let r = "/";
|
|
3632
3242
|
try {
|
|
@@ -3637,14 +3247,14 @@ var ls = _r((ps, mt) => {
|
|
|
3637
3247
|
e.FS.chdir(t);
|
|
3638
3248
|
};
|
|
3639
3249
|
}
|
|
3640
|
-
|
|
3641
|
-
function
|
|
3250
|
+
_(Dt, "createHomeDirectory");
|
|
3251
|
+
function Vt(t) {
|
|
3642
3252
|
return function(e) {
|
|
3643
3253
|
Object.assign(e.ENV, t);
|
|
3644
3254
|
};
|
|
3645
3255
|
}
|
|
3646
|
-
|
|
3647
|
-
function
|
|
3256
|
+
_(Vt, "setEnvironment");
|
|
3257
|
+
function qt(t) {
|
|
3648
3258
|
return t ? [async (e) => {
|
|
3649
3259
|
e.addRunDependency("fsInitHook");
|
|
3650
3260
|
try {
|
|
@@ -3654,9 +3264,9 @@ var ls = _r((ps, mt) => {
|
|
|
3654
3264
|
}
|
|
3655
3265
|
}] : [];
|
|
3656
3266
|
}
|
|
3657
|
-
|
|
3658
|
-
function
|
|
3659
|
-
let e =
|
|
3267
|
+
_(qt, "callFsInitHook");
|
|
3268
|
+
function Ut(t) {
|
|
3269
|
+
let e = jt(t);
|
|
3660
3270
|
return async (r) => {
|
|
3661
3271
|
let n = r._py_version_major(), s = r._py_version_minor();
|
|
3662
3272
|
r.FS.mkdirTree("/lib"), r.API.sitePackages = `/lib/python${n}.${s}/site-packages`, r.FS.mkdirTree(r.API.sitePackages), r.addRunDependency("install-stdlib");
|
|
@@ -3670,15 +3280,15 @@ var ls = _r((ps, mt) => {
|
|
|
3670
3280
|
}
|
|
3671
3281
|
};
|
|
3672
3282
|
}
|
|
3673
|
-
|
|
3674
|
-
function
|
|
3283
|
+
_(Ut, "installStdlib");
|
|
3284
|
+
function zt(t) {
|
|
3675
3285
|
let e;
|
|
3676
|
-
return t.stdLibURL != null ? e = t.stdLibURL : e = t.indexURL + "python_stdlib.zip", [...
|
|
3286
|
+
return t.stdLibURL != null ? e = t.stdLibURL : e = t.indexURL + "python_stdlib.zip", [...qt(t.fsInit), Ut(e), Dt(t.env.HOME), Vt(t.env), Lt];
|
|
3677
3287
|
}
|
|
3678
|
-
|
|
3679
|
-
function
|
|
3288
|
+
_(zt, "getFileSystemInitializationFuncs");
|
|
3289
|
+
function Ht(t) {
|
|
3680
3290
|
if (typeof WasmOffsetConverter < "u") return;
|
|
3681
|
-
let { binary: e, response: r } =
|
|
3291
|
+
let { binary: e, response: r } = Oe(t + "pyodide.asm.wasm");
|
|
3682
3292
|
return function(n, s) {
|
|
3683
3293
|
return async function() {
|
|
3684
3294
|
try {
|
|
@@ -3692,38 +3302,42 @@ var ls = _r((ps, mt) => {
|
|
|
3692
3302
|
}(), {};
|
|
3693
3303
|
};
|
|
3694
3304
|
}
|
|
3695
|
-
|
|
3696
|
-
var
|
|
3697
|
-
async function
|
|
3305
|
+
_(Ht, "getInstantiateWasmFunc");
|
|
3306
|
+
var De = "0.27.7";
|
|
3307
|
+
async function Ve(t = {}) {
|
|
3698
3308
|
var e, r;
|
|
3699
|
-
await
|
|
3700
|
-
let n = t.indexURL || await
|
|
3701
|
-
n =
|
|
3702
|
-
let s = { fullStdLib: !1, jsglobals: globalThis, stdin: globalThis.prompt ? globalThis.prompt : void 0, lockFileURL: n + "pyodide-lock.json", args: [], env: {}, packageCacheDir: n, packages: [], enableRunUntilComplete: !
|
|
3309
|
+
await Be();
|
|
3310
|
+
let n = t.indexURL || await Zt();
|
|
3311
|
+
n = Me(n), n.endsWith("/") || (n += "/"), t.indexURL = n;
|
|
3312
|
+
let s = { fullStdLib: !1, jsglobals: globalThis, stdin: globalThis.prompt ? globalThis.prompt : void 0, lockFileURL: n + "pyodide-lock.json", args: [], env: {}, packageCacheDir: n, packages: [], enableRunUntilComplete: !0, checkAPIVersion: !0, BUILD_ID: "e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b" }, a = Object.assign(s, t);
|
|
3703
3313
|
(e = a.env).HOME ?? (e.HOME = "/home/pyodide"), (r = a.env).PYTHONINSPECT ?? (r.PYTHONINSPECT = "1");
|
|
3704
|
-
let i =
|
|
3705
|
-
if (o.lockFilePromise =
|
|
3706
|
-
let
|
|
3707
|
-
await
|
|
3314
|
+
let i = Mt(a), o = i.API;
|
|
3315
|
+
if (o.lockFilePromise = Ft(a.lockFileURL), typeof _createPyodideModule != "function") {
|
|
3316
|
+
let S = `${a.indexURL}pyodide.asm.js`;
|
|
3317
|
+
await ge(S);
|
|
3708
3318
|
}
|
|
3709
|
-
let
|
|
3319
|
+
let d;
|
|
3710
3320
|
if (t._loadSnapshot) {
|
|
3711
|
-
let
|
|
3712
|
-
ArrayBuffer.isView(
|
|
3321
|
+
let S = await t._loadSnapshot;
|
|
3322
|
+
ArrayBuffer.isView(S) ? d = S : d = new Uint8Array(S), i.noInitialRun = !0, i.INITIAL_MEMORY = d.length;
|
|
3713
3323
|
}
|
|
3714
|
-
let
|
|
3324
|
+
let u = await _createPyodideModule(i);
|
|
3715
3325
|
if (i.exited) throw i.exited.toThrow;
|
|
3716
|
-
if (t.pyproxyToStringRepr && o.setPyProxyToStringMethod(!0), o.version !==
|
|
3717
|
-
|
|
3326
|
+
if (t.pyproxyToStringRepr && o.setPyProxyToStringMethod(!0), o.version !== De && a.checkAPIVersion) throw new Error(`Pyodide version does not match: '${De}' <==> '${o.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);
|
|
3327
|
+
u.locateFile = (S) => {
|
|
3718
3328
|
throw new Error("Didn't expect to load any more file_packager files!");
|
|
3719
3329
|
};
|
|
3720
|
-
let
|
|
3721
|
-
|
|
3722
|
-
let
|
|
3723
|
-
return o.sys.path.insert(0,
|
|
3330
|
+
let h;
|
|
3331
|
+
d && (h = o.restoreSnapshot(d));
|
|
3332
|
+
let b = o.finalizeBootstrap(h, t._snapshotDeserializer);
|
|
3333
|
+
return o.sys.path.insert(0, ""), b.version.includes("dev") || o.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${b.version}/full/`), o._pyodide.set_excepthook(), await o.packageIndexReady, o.initializeStreams(a.stdin, a.stdout, a.stderr), b;
|
|
3334
|
+
}
|
|
3335
|
+
_(Ve, "loadPyodide");
|
|
3336
|
+
function Hr(t, e) {
|
|
3337
|
+
if (!t)
|
|
3338
|
+
throw new Error(e);
|
|
3724
3339
|
}
|
|
3725
|
-
|
|
3726
|
-
class Qn {
|
|
3340
|
+
class Br {
|
|
3727
3341
|
spans = [];
|
|
3728
3342
|
startSpan(e, r = {}) {
|
|
3729
3343
|
const n = {
|
|
@@ -3763,23 +3377,23 @@ var ls = _r((ps, mt) => {
|
|
|
3763
3377
|
logSpans() {
|
|
3764
3378
|
}
|
|
3765
3379
|
}
|
|
3766
|
-
const
|
|
3767
|
-
globalThis.t =
|
|
3768
|
-
const
|
|
3769
|
-
class
|
|
3380
|
+
const ee = new Br();
|
|
3381
|
+
globalThis.t = ee;
|
|
3382
|
+
const Wr = !1;
|
|
3383
|
+
class Jr {
|
|
3770
3384
|
pyodide = null;
|
|
3771
3385
|
get requirePyodide() {
|
|
3772
|
-
return
|
|
3386
|
+
return Hr(this.pyodide, "Pyodide not loaded"), this.pyodide;
|
|
3773
3387
|
}
|
|
3774
3388
|
async bootstrap(e) {
|
|
3775
3389
|
return await this.loadPyodideAndPackages(e);
|
|
3776
3390
|
}
|
|
3777
3391
|
async loadPyodideAndPackages(e) {
|
|
3778
|
-
if (!
|
|
3392
|
+
if (!Ve)
|
|
3779
3393
|
throw new Error("loadPyodide is not defined");
|
|
3780
|
-
const r =
|
|
3394
|
+
const r = ee.startSpan("loadPyodide");
|
|
3781
3395
|
try {
|
|
3782
|
-
const n = await
|
|
3396
|
+
const n = await Ve({
|
|
3783
3397
|
// Perf: These get loaded while pyodide is being bootstrapped
|
|
3784
3398
|
packages: [
|
|
3785
3399
|
"micropip",
|
|
@@ -3789,7 +3403,7 @@ var ls = _r((ps, mt) => {
|
|
|
3789
3403
|
"narwhals",
|
|
3790
3404
|
"packaging"
|
|
3791
3405
|
],
|
|
3792
|
-
_makeSnapshot:
|
|
3406
|
+
_makeSnapshot: Wr,
|
|
3793
3407
|
lockFileURL: `https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,
|
|
3794
3408
|
// Without this, this fails in Firefox with
|
|
3795
3409
|
// `Could not extract indexURL path from pyodide module`
|
|
@@ -3798,12 +3412,12 @@ var ls = _r((ps, mt) => {
|
|
|
3798
3412
|
});
|
|
3799
3413
|
return this.pyodide = n, r.end("ok"), n;
|
|
3800
3414
|
} catch (n) {
|
|
3801
|
-
throw
|
|
3415
|
+
throw de.error("Failed to load Pyodide", n), n;
|
|
3802
3416
|
}
|
|
3803
3417
|
}
|
|
3804
3418
|
async mountFilesystem(e) {
|
|
3805
|
-
const r =
|
|
3806
|
-
return
|
|
3419
|
+
const r = ee.startSpan("mountFilesystem");
|
|
3420
|
+
return M.createHomeDir(this.requirePyodide), M.mountFS(this.requirePyodide), await M.populateFilesToMemory(this.requirePyodide), r.end("ok"), M.initNotebookCode({
|
|
3807
3421
|
pyodide: this.requirePyodide,
|
|
3808
3422
|
code: e.code,
|
|
3809
3423
|
filename: e.filename
|
|
@@ -3814,7 +3428,7 @@ var ls = _r((ps, mt) => {
|
|
|
3814
3428
|
self.messenger = {
|
|
3815
3429
|
callback: s
|
|
3816
3430
|
}, self.query_params = a, self.user_config = i;
|
|
3817
|
-
const o =
|
|
3431
|
+
const o = ee.startSpan("startSession.runPython"), d = n || M.NOTEBOOK_FILENAME, [u, h, b] = this.requirePyodide.runPython(
|
|
3818
3432
|
`
|
|
3819
3433
|
print("[py] Starting marimo...")
|
|
3820
3434
|
import asyncio
|
|
@@ -3825,7 +3439,7 @@ var ls = _r((ps, mt) => {
|
|
|
3825
3439
|
assert js.query_params, "query_params is not defined"
|
|
3826
3440
|
|
|
3827
3441
|
session, bridge = create_session(
|
|
3828
|
-
filename="${
|
|
3442
|
+
filename="${d}",
|
|
3829
3443
|
query_params=js.query_params.to_py(),
|
|
3830
3444
|
message_callback=js.messenger.callback,
|
|
3831
3445
|
user_config=js.user_config.to_py(),
|
|
@@ -3836,14 +3450,14 @@ var ls = _r((ps, mt) => {
|
|
|
3836
3450
|
asyncio.create_task(session.start())
|
|
3837
3451
|
|
|
3838
3452
|
# Find the packages to install
|
|
3839
|
-
with open("${
|
|
3453
|
+
with open("${d}", "r") as f:
|
|
3840
3454
|
packages = session.find_packages(f.read())
|
|
3841
3455
|
|
|
3842
3456
|
bridge, init, packages`
|
|
3843
3457
|
);
|
|
3844
3458
|
o.end();
|
|
3845
|
-
const
|
|
3846
|
-
return this.loadNotebookDeps(r,
|
|
3459
|
+
const S = new Set(b.toJs());
|
|
3460
|
+
return this.loadNotebookDeps(r, S).then(() => h(i.runtime.auto_instantiate)), u;
|
|
3847
3461
|
}
|
|
3848
3462
|
async loadNotebookDeps(e, r) {
|
|
3849
3463
|
const n = this.requirePyodide;
|
|
@@ -3857,11 +3471,11 @@ ${e}`, e = `import jedi
|
|
|
3857
3471
|
${e}`, e = `import pyodide_http
|
|
3858
3472
|
${e}`;
|
|
3859
3473
|
const s = [...r];
|
|
3860
|
-
let a =
|
|
3474
|
+
let a = ee.startSpan("pyodide.loadPackage");
|
|
3861
3475
|
await n.loadPackagesFromImports(e, {
|
|
3862
|
-
errorCallback:
|
|
3863
|
-
messageCallback:
|
|
3864
|
-
}), a.end(), a =
|
|
3476
|
+
errorCallback: de.error,
|
|
3477
|
+
messageCallback: de.log
|
|
3478
|
+
}), a.end(), a = ee.startSpan("micropip.install");
|
|
3865
3479
|
const i = s.filter(
|
|
3866
3480
|
(o) => !n.loadedPackages[o]
|
|
3867
3481
|
);
|
|
@@ -3874,244 +3488,57 @@ ${e}`;
|
|
|
3874
3488
|
print("Loading from micropip:", missing)
|
|
3875
3489
|
await micropip.install(missing)
|
|
3876
3490
|
`).catch((o) => {
|
|
3877
|
-
|
|
3491
|
+
de.error("Failed to load packages from micropip", o);
|
|
3878
3492
|
}), a.end();
|
|
3879
3493
|
}
|
|
3880
3494
|
}
|
|
3881
|
-
async function
|
|
3495
|
+
async function Yr(t) {
|
|
3882
3496
|
try {
|
|
3883
3497
|
return await import(
|
|
3884
3498
|
/* @vite-ignore */
|
|
3885
3499
|
`/wasm/controller.js?version=${t}`
|
|
3886
3500
|
);
|
|
3887
3501
|
} catch {
|
|
3888
|
-
return new
|
|
3502
|
+
return new Jr();
|
|
3889
3503
|
}
|
|
3890
3504
|
}
|
|
3891
|
-
const
|
|
3892
|
-
function
|
|
3893
|
-
return t.includes("dev") &&
|
|
3894
|
-
}
|
|
3895
|
-
class as {
|
|
3896
|
-
constructor(e) {
|
|
3897
|
-
this.onMessage = e, this.buffer = [];
|
|
3898
|
-
}
|
|
3899
|
-
buffer;
|
|
3900
|
-
started = !1;
|
|
3901
|
-
push = (e) => {
|
|
3902
|
-
this.started ? this.onMessage(e) : this.buffer.push(e);
|
|
3903
|
-
};
|
|
3904
|
-
/**
|
|
3905
|
-
* Start processing messages
|
|
3906
|
-
*/
|
|
3907
|
-
start = () => {
|
|
3908
|
-
this.started = !0, this.buffer.forEach((e) => this.onMessage(e)), this.buffer = [];
|
|
3909
|
-
};
|
|
3505
|
+
const Xr = !1;
|
|
3506
|
+
function Gr(t) {
|
|
3507
|
+
return t.includes("dev") && Xr ? "dev" : `v${De}`;
|
|
3910
3508
|
}
|
|
3911
|
-
|
|
3912
|
-
async function is() {
|
|
3509
|
+
async function Kr() {
|
|
3913
3510
|
try {
|
|
3914
|
-
const t =
|
|
3915
|
-
self.controller = r,
|
|
3916
|
-
message: "Loading marimo..."
|
|
3917
|
-
}), self.pyodide = await R.wrapAsync(r.bootstrap.bind(r))({
|
|
3511
|
+
const t = en(), e = Gr(t), r = await Yr(t);
|
|
3512
|
+
self.controller = r, self.pyodide = await r.bootstrap({
|
|
3918
3513
|
version: t,
|
|
3919
3514
|
pyodideVersion: e
|
|
3920
|
-
})
|
|
3515
|
+
}), await r.mountFilesystem?.({
|
|
3516
|
+
code: "",
|
|
3517
|
+
filename: null
|
|
3518
|
+
}), qe.send.initialized({});
|
|
3921
3519
|
} catch (t) {
|
|
3922
|
-
|
|
3923
|
-
error: Ut(t)
|
|
3924
|
-
});
|
|
3520
|
+
de.error("Error bootstrapping", t), qe.send.initializedError({ error: Ar(t) });
|
|
3925
3521
|
}
|
|
3926
3522
|
}
|
|
3927
|
-
const
|
|
3928
|
-
(t) =>
|
|
3929
|
-
|
|
3930
|
-
}
|
|
3931
|
-
), Rt = new Ar();
|
|
3932
|
-
let At = !1;
|
|
3933
|
-
const os = {
|
|
3934
|
-
/**
|
|
3935
|
-
* Start the session
|
|
3936
|
-
*/
|
|
3937
|
-
startSession: async (t) => {
|
|
3938
|
-
if (await M, At) {
|
|
3939
|
-
Y.warn("Session already started");
|
|
3940
|
-
return;
|
|
3941
|
-
}
|
|
3942
|
-
At = !0;
|
|
3943
|
-
try {
|
|
3944
|
-
Bt(self.controller, "Controller not loaded"), await self.controller.mountFilesystem?.({
|
|
3945
|
-
code: t.code,
|
|
3946
|
-
filename: t.filename
|
|
3947
|
-
});
|
|
3948
|
-
const e = R.wrapAsync(
|
|
3949
|
-
self.controller.startSession.bind(self.controller)
|
|
3950
|
-
), r = Nr(() => {
|
|
3951
|
-
H.send.initializingMessage({
|
|
3952
|
-
message: "Initializing notebook..."
|
|
3953
|
-
}), H.send.initialized({});
|
|
3954
|
-
});
|
|
3955
|
-
H.send.initializingMessage({
|
|
3956
|
-
message: "Loading notebook and dependencies..."
|
|
3957
|
-
});
|
|
3958
|
-
const n = await e({
|
|
3959
|
-
code: t.code,
|
|
3960
|
-
filename: t.filename,
|
|
3961
|
-
queryParameters: t.queryParameters,
|
|
3962
|
-
userConfig: t.userConfig,
|
|
3963
|
-
onMessage: (s) => {
|
|
3964
|
-
r(), mr.push(s);
|
|
3965
|
-
}
|
|
3966
|
-
});
|
|
3967
|
-
Rt.resolve(n), Nt.end("ok");
|
|
3968
|
-
} catch (e) {
|
|
3969
|
-
H.send.initializedError({
|
|
3970
|
-
error: Ut(e)
|
|
3971
|
-
}), Nt.end("error");
|
|
3972
|
-
}
|
|
3973
|
-
},
|
|
3974
|
-
/**
|
|
3975
|
-
* Load packages
|
|
3976
|
-
*/
|
|
3977
|
-
loadPackages: async (t) => {
|
|
3978
|
-
const e = R.startSpan("loadPackages");
|
|
3979
|
-
await M, t.includes("mo.sql") && (t = `import pandas
|
|
3980
|
-
${t}`, t = `import duckdb
|
|
3981
|
-
${t}`, t = `import sqlglot
|
|
3982
|
-
${t}`, t.includes("polars") && (t = `import pyarrow
|
|
3983
|
-
${t}`)), await self.pyodide.loadPackagesFromImports(t, {
|
|
3984
|
-
messageCallback: Y.log,
|
|
3985
|
-
errorCallback: Y.error
|
|
3986
|
-
}), e.end();
|
|
3987
|
-
},
|
|
3988
|
-
/**
|
|
3989
|
-
* Read a file
|
|
3990
|
-
*/
|
|
3991
|
-
readFile: async (t) => {
|
|
3992
|
-
const e = R.startSpan("readFile");
|
|
3993
|
-
await M;
|
|
3994
|
-
const r = at(self.pyodide.FS.readFile(t));
|
|
3995
|
-
return e.end(), r;
|
|
3996
|
-
},
|
|
3997
|
-
/**
|
|
3998
|
-
* Set the interrupt buffer
|
|
3999
|
-
*/
|
|
4000
|
-
setInterruptBuffer: async (t) => {
|
|
4001
|
-
await M, self.pyodide.setInterruptBuffer(t);
|
|
4002
|
-
},
|
|
4003
|
-
addPackage: async (t) => {
|
|
4004
|
-
await M;
|
|
4005
|
-
const { package: e } = t, r = e.split(" ").map((s) => s.trim()), n = await self.pyodide.runPythonAsync(`
|
|
4006
|
-
import micropip
|
|
4007
|
-
import json
|
|
4008
|
-
response = None
|
|
4009
|
-
try:
|
|
4010
|
-
await micropip.install(${JSON.stringify(r)})
|
|
4011
|
-
response = {"success": True}
|
|
4012
|
-
except Exception as e:
|
|
4013
|
-
response = {"success": False, "error": str(e)}
|
|
4014
|
-
json.dumps(response)
|
|
4015
|
-
`);
|
|
4016
|
-
return JSON.parse(n);
|
|
4017
|
-
},
|
|
4018
|
-
removePackage: async (t) => {
|
|
4019
|
-
await M;
|
|
4020
|
-
const { package: e } = t, r = await self.pyodide.runPythonAsync(`
|
|
4021
|
-
import micropip
|
|
4022
|
-
import json
|
|
4023
|
-
response = None
|
|
4024
|
-
try:
|
|
4025
|
-
micropip.uninstall("${e}")
|
|
4026
|
-
response = {"success": True}
|
|
4027
|
-
except Exception as e:
|
|
4028
|
-
response = {"success": False, "error": str(e)}
|
|
4029
|
-
json.dumps(response)
|
|
4030
|
-
`);
|
|
4031
|
-
return JSON.parse(r);
|
|
4032
|
-
},
|
|
4033
|
-
listPackages: async () => {
|
|
4034
|
-
const t = R.startSpan("listPackages");
|
|
4035
|
-
await M;
|
|
4036
|
-
const e = await self.pyodide.runPythonAsync(`
|
|
4037
|
-
import json
|
|
4038
|
-
import micropip
|
|
4039
|
-
|
|
4040
|
-
packages = micropip.list()
|
|
4041
|
-
packages = [
|
|
4042
|
-
{"name": p.name, "version": p.version}
|
|
4043
|
-
for p in packages.values()
|
|
4044
|
-
]
|
|
4045
|
-
json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))
|
|
4046
|
-
`);
|
|
4047
|
-
return t.end(), {
|
|
4048
|
-
packages: JSON.parse(e)
|
|
4049
|
-
};
|
|
4050
|
-
},
|
|
4051
|
-
/**
|
|
4052
|
-
* Save the notebook
|
|
4053
|
-
*/
|
|
3523
|
+
const Ce = Kr(), Qr = {
|
|
3524
|
+
readFile: async (t) => (await Ce, Ae(self.pyodide.FS.readFile(t))),
|
|
3525
|
+
readNotebook: async () => (await Ce, M.readNotebook(self.pyodide)),
|
|
4054
3526
|
saveNotebook: async (t) => {
|
|
4055
|
-
await
|
|
3527
|
+
await Ce, await self.pyodide.runPython(`
|
|
4056
3528
|
from marimo._pyodide.bootstrap import save_file
|
|
4057
|
-
save_file
|
|
4058
|
-
`)(JSON.stringify(t), ae.NOTEBOOK_FILENAME);
|
|
4059
|
-
},
|
|
4060
|
-
/**
|
|
4061
|
-
* Call a function on the bridge
|
|
4062
|
-
*/
|
|
4063
|
-
bridge: async (t) => {
|
|
4064
|
-
const e = R.startSpan("bridge", {
|
|
4065
|
-
functionName: t.functionName
|
|
4066
|
-
});
|
|
4067
|
-
await M;
|
|
4068
|
-
const { functionName: r, payload: n } = t;
|
|
4069
|
-
r === "format" && await self.pyodide.runPythonAsync(`
|
|
4070
|
-
import micropip
|
|
4071
3529
|
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
except ModuleNotFoundError:
|
|
4075
|
-
await micropip.install("black")
|
|
4076
|
-
`), r === "export_markdown" && await self.pyodide.runPythonAsync(`
|
|
4077
|
-
import micropip
|
|
4078
|
-
|
|
4079
|
-
try:
|
|
4080
|
-
import yaml
|
|
4081
|
-
except ModuleNotFoundError:
|
|
4082
|
-
await micropip.install("pyyaml")
|
|
4083
|
-
`);
|
|
4084
|
-
const s = await Rt.promise, a = n == null ? null : typeof n == "string" ? n : JSON.stringify(n), i = a == null ? (
|
|
4085
|
-
// @ts-expect-error ehh TypeScript
|
|
4086
|
-
await s[r]()
|
|
4087
|
-
) : (
|
|
4088
|
-
// @ts-expect-error ehh TypeScript
|
|
4089
|
-
await s[r](a)
|
|
4090
|
-
);
|
|
4091
|
-
return cs.has(r) && ae.persistFilesToRemote(self.pyodide), e.end(), typeof i == "string" ? JSON.parse(i) : i;
|
|
3530
|
+
save_file
|
|
3531
|
+
`)(JSON.stringify(t), M.NOTEBOOK_FILENAME), await M.persistFilesToRemote(self.pyodide);
|
|
4092
3532
|
}
|
|
4093
|
-
},
|
|
4094
|
-
transport:
|
|
4095
|
-
transportId:
|
|
3533
|
+
}, qe = Qt({
|
|
3534
|
+
transport: nr({
|
|
3535
|
+
transportId: jr
|
|
4096
3536
|
}),
|
|
4097
|
-
requestHandler:
|
|
3537
|
+
requestHandler: Qr
|
|
4098
3538
|
});
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
await M, mr.start();
|
|
4102
|
-
});
|
|
4103
|
-
const cs = /* @__PURE__ */ new Set([
|
|
4104
|
-
"save",
|
|
4105
|
-
"save_app_config",
|
|
4106
|
-
"rename_file",
|
|
4107
|
-
"create_file_or_directory",
|
|
4108
|
-
"delete_file_or_directory",
|
|
4109
|
-
"move_file_or_directory",
|
|
4110
|
-
"update_file"
|
|
4111
|
-
]);
|
|
4112
|
-
function ds() {
|
|
3539
|
+
qe.send("ready", {});
|
|
3540
|
+
function en() {
|
|
4113
3541
|
return self.name;
|
|
4114
3542
|
}
|
|
4115
|
-
const M = R.wrapAsync(is)();
|
|
4116
3543
|
});
|
|
4117
|
-
export default
|
|
3544
|
+
export default tn();
|