@abduljebar/text-editor 1.1.1 → 1.1.3
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/App.d.ts +0 -1
- package/dist/App.d.ts.map +1 -1
- package/dist/components/TextEditor.d.ts +2 -2
- package/dist/components/TextEditor.d.ts.map +1 -1
- package/dist/components/Toolbar.d.ts +2 -3
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1611 -1208
- package/dist/index.umd.cjs +57 -23
- package/dist/store/editor.store.d.ts +52 -0
- package/dist/store/editor.store.d.ts.map +1 -0
- package/dist/types/editor.d.ts +4 -1
- package/dist/types/editor.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Save as
|
|
3
|
-
var
|
|
1
|
+
import Q, { useEffect as Ie, useRef as vt, useState as bt, useCallback as F } from "react";
|
|
2
|
+
import { Save as Jt, FileDown as Gt, Trash2 as qt, Bold as Xt, Italic as Kt, Underline as Qt, Strikethrough as en, List as tn, ListOrdered as nn, Heading1 as rn, Heading2 as on, Type as sn, AlignLeft as cn, AlignCenter as an, AlignRight as un, Link as ln } from "lucide-react";
|
|
3
|
+
var oe = { exports: {} }, X = {};
|
|
4
4
|
/**
|
|
5
5
|
* @license React
|
|
6
6
|
* react-jsx-runtime.production.js
|
|
@@ -10,29 +10,29 @@ var K = { exports: {} }, Y = {};
|
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
|
|
13
|
+
var We;
|
|
14
|
+
function dn() {
|
|
15
|
+
if (We) return X;
|
|
16
|
+
We = 1;
|
|
17
17
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
18
18
|
function n(r, o, i) {
|
|
19
|
-
var
|
|
20
|
-
if (i !== void 0 && (
|
|
19
|
+
var s = null;
|
|
20
|
+
if (i !== void 0 && (s = "" + i), o.key !== void 0 && (s = "" + o.key), "key" in o) {
|
|
21
21
|
i = {};
|
|
22
|
-
for (var
|
|
23
|
-
|
|
22
|
+
for (var c in o)
|
|
23
|
+
c !== "key" && (i[c] = o[c]);
|
|
24
24
|
} else i = o;
|
|
25
25
|
return o = i.ref, {
|
|
26
26
|
$$typeof: e,
|
|
27
27
|
type: r,
|
|
28
|
-
key:
|
|
28
|
+
key: s,
|
|
29
29
|
ref: o !== void 0 ? o : null,
|
|
30
30
|
props: i
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return X.Fragment = t, X.jsx = n, X.jsxs = n, X;
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var K = {};
|
|
36
36
|
/**
|
|
37
37
|
* @license React
|
|
38
38
|
* react-jsx-runtime.development.js
|
|
@@ -42,47 +42,47 @@ var J = {};
|
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
44
|
*/
|
|
45
|
-
var
|
|
46
|
-
function
|
|
47
|
-
return
|
|
45
|
+
var Be;
|
|
46
|
+
function fn() {
|
|
47
|
+
return Be || (Be = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
48
|
function e(u) {
|
|
49
49
|
if (u == null) return null;
|
|
50
50
|
if (typeof u == "function")
|
|
51
|
-
return u.$$typeof ===
|
|
51
|
+
return u.$$typeof === D ? null : u.displayName || u.name || null;
|
|
52
52
|
if (typeof u == "string") return u;
|
|
53
53
|
switch (u) {
|
|
54
|
-
case
|
|
54
|
+
case C:
|
|
55
55
|
return "Fragment";
|
|
56
|
-
case
|
|
56
|
+
case k:
|
|
57
57
|
return "Profiler";
|
|
58
|
-
case
|
|
58
|
+
case N:
|
|
59
59
|
return "StrictMode";
|
|
60
|
-
case
|
|
60
|
+
case _e:
|
|
61
61
|
return "Suspense";
|
|
62
|
-
case
|
|
62
|
+
case ve:
|
|
63
63
|
return "SuspenseList";
|
|
64
|
-
case
|
|
64
|
+
case E:
|
|
65
65
|
return "Activity";
|
|
66
66
|
}
|
|
67
67
|
if (typeof u == "object")
|
|
68
68
|
switch (typeof u.tag == "number" && console.error(
|
|
69
69
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
70
|
), u.$$typeof) {
|
|
71
|
-
case
|
|
71
|
+
case b:
|
|
72
72
|
return "Portal";
|
|
73
|
-
case
|
|
73
|
+
case z:
|
|
74
74
|
return u.displayName || "Context";
|
|
75
|
-
case
|
|
75
|
+
case $:
|
|
76
76
|
return (u._context.displayName || "Context") + ".Consumer";
|
|
77
|
-
case
|
|
78
|
-
var
|
|
79
|
-
return u = u.displayName, u || (u =
|
|
80
|
-
case
|
|
81
|
-
return
|
|
82
|
-
case
|
|
83
|
-
|
|
77
|
+
case P:
|
|
78
|
+
var v = u.render;
|
|
79
|
+
return u = u.displayName, u || (u = v.displayName || v.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
|
|
80
|
+
case be:
|
|
81
|
+
return v = u.displayName || null, v !== null ? v : e(u.type) || "Memo";
|
|
82
|
+
case q:
|
|
83
|
+
v = u._payload, u = u._init;
|
|
84
84
|
try {
|
|
85
|
-
return e(u(
|
|
85
|
+
return e(u(v));
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -94,74 +94,74 @@ function sn() {
|
|
|
94
94
|
function n(u) {
|
|
95
95
|
try {
|
|
96
96
|
t(u);
|
|
97
|
-
var
|
|
97
|
+
var v = !1;
|
|
98
98
|
} catch {
|
|
99
|
-
|
|
99
|
+
v = !0;
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
return
|
|
105
|
-
|
|
101
|
+
if (v) {
|
|
102
|
+
v = console;
|
|
103
|
+
var x = v.error, j = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
|
|
104
|
+
return x.call(
|
|
105
|
+
v,
|
|
106
106
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
-
|
|
107
|
+
j
|
|
108
108
|
), t(u);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function r(u) {
|
|
112
|
-
if (u ===
|
|
113
|
-
if (typeof u == "object" && u !== null && u.$$typeof ===
|
|
112
|
+
if (u === C) return "<>";
|
|
113
|
+
if (typeof u == "object" && u !== null && u.$$typeof === q)
|
|
114
114
|
return "<...>";
|
|
115
115
|
try {
|
|
116
|
-
var
|
|
117
|
-
return
|
|
116
|
+
var v = e(u);
|
|
117
|
+
return v ? "<" + v + ">" : "<...>";
|
|
118
118
|
} catch {
|
|
119
119
|
return "<...>";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
function o() {
|
|
123
|
-
var u =
|
|
123
|
+
var u = Y.A;
|
|
124
124
|
return u === null ? null : u.getOwner();
|
|
125
125
|
}
|
|
126
126
|
function i() {
|
|
127
127
|
return Error("react-stack-top-frame");
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
var
|
|
132
|
-
if (
|
|
129
|
+
function s(u) {
|
|
130
|
+
if (U.call(u, "key")) {
|
|
131
|
+
var v = Object.getOwnPropertyDescriptor(u, "key").get;
|
|
132
|
+
if (v && v.isReactWarning) return !1;
|
|
133
133
|
}
|
|
134
134
|
return u.key !== void 0;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
function
|
|
138
|
-
|
|
136
|
+
function c(u, v) {
|
|
137
|
+
function x() {
|
|
138
|
+
Ue || (Ue = !0, console.error(
|
|
139
139
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
-
|
|
140
|
+
v
|
|
141
141
|
));
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
get:
|
|
143
|
+
x.isReactWarning = !0, Object.defineProperty(u, "key", {
|
|
144
|
+
get: x,
|
|
145
145
|
configurable: !0
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function d() {
|
|
149
149
|
var u = e(this.type);
|
|
150
|
-
return
|
|
150
|
+
return Fe[u] || (Fe[u] = !0, console.error(
|
|
151
151
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
152
|
)), u = this.props.ref, u !== void 0 ? u : null;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
154
|
+
function l(u, v, x, j, re, ke) {
|
|
155
|
+
var A = x.ref;
|
|
156
156
|
return u = {
|
|
157
|
-
$$typeof:
|
|
157
|
+
$$typeof: T,
|
|
158
158
|
type: u,
|
|
159
|
-
key:
|
|
160
|
-
props:
|
|
161
|
-
_owner:
|
|
162
|
-
}, (
|
|
159
|
+
key: v,
|
|
160
|
+
props: x,
|
|
161
|
+
_owner: j
|
|
162
|
+
}, (A !== void 0 ? A : null) !== null ? Object.defineProperty(u, "ref", {
|
|
163
163
|
enumerable: !1,
|
|
164
|
-
get:
|
|
164
|
+
get: d
|
|
165
165
|
}) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
@@ -176,277 +176,315 @@ function sn() {
|
|
|
176
176
|
configurable: !1,
|
|
177
177
|
enumerable: !1,
|
|
178
178
|
writable: !0,
|
|
179
|
-
value:
|
|
179
|
+
value: re
|
|
180
180
|
}), Object.defineProperty(u, "_debugTask", {
|
|
181
181
|
configurable: !1,
|
|
182
182
|
enumerable: !1,
|
|
183
183
|
writable: !0,
|
|
184
|
-
value:
|
|
184
|
+
value: ke
|
|
185
185
|
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
for (
|
|
193
|
-
|
|
194
|
-
Object.freeze && Object.freeze(
|
|
187
|
+
function f(u, v, x, j, re, ke) {
|
|
188
|
+
var A = v.children;
|
|
189
|
+
if (A !== void 0)
|
|
190
|
+
if (j)
|
|
191
|
+
if (Yt(A)) {
|
|
192
|
+
for (j = 0; j < A.length; j++)
|
|
193
|
+
h(A[j]);
|
|
194
|
+
Object.freeze && Object.freeze(A);
|
|
195
195
|
} else
|
|
196
196
|
console.error(
|
|
197
197
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
198
|
);
|
|
199
|
-
else
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
var
|
|
203
|
-
return
|
|
199
|
+
else h(A);
|
|
200
|
+
if (U.call(v, "key")) {
|
|
201
|
+
A = e(u);
|
|
202
|
+
var H = Object.keys(v).filter(function(Ht) {
|
|
203
|
+
return Ht !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
j = 0 < H.length ? "{key: someKey, " + H.join(": ..., ") + ": ...}" : "{key: someKey}", Ve[A + j] || (H = 0 < H.length ? "{" + H.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
206
|
`A props object containing a "key" prop is being spread into JSX:
|
|
207
207
|
let props = %s;
|
|
208
208
|
<%s {...props} />
|
|
209
209
|
React keys must be passed directly to JSX without using spread:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s key={someKey} {...props} />`,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
),
|
|
212
|
+
j,
|
|
213
|
+
A,
|
|
214
|
+
H,
|
|
215
|
+
A
|
|
216
|
+
), Ve[A + j] = !0);
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
for (var
|
|
221
|
-
|
|
222
|
-
} else
|
|
223
|
-
return
|
|
224
|
-
|
|
218
|
+
if (A = null, x !== void 0 && (n(x), A = "" + x), s(v) && (n(v.key), A = "" + v.key), "key" in v) {
|
|
219
|
+
x = {};
|
|
220
|
+
for (var ze in v)
|
|
221
|
+
ze !== "key" && (x[ze] = v[ze]);
|
|
222
|
+
} else x = v;
|
|
223
|
+
return A && c(
|
|
224
|
+
x,
|
|
225
225
|
typeof u == "function" ? u.displayName || u.name || "Unknown" : u
|
|
226
|
-
),
|
|
226
|
+
), l(
|
|
227
227
|
u,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
A,
|
|
229
|
+
x,
|
|
230
230
|
o(),
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
re,
|
|
232
|
+
ke
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
p(u) ? u._store && (u._store.validated = 1) : typeof u == "object" && u !== null && u.$$typeof ===
|
|
235
|
+
function h(u) {
|
|
236
|
+
p(u) ? u._store && (u._store.validated = 1) : typeof u == "object" && u !== null && u.$$typeof === q && (u._payload.status === "fulfilled" ? p(u._payload.value) && u._payload.value._store && (u._payload.value._store.validated = 1) : u._store && (u._store.validated = 1));
|
|
237
237
|
}
|
|
238
238
|
function p(u) {
|
|
239
|
-
return typeof u == "object" && u !== null && u.$$typeof ===
|
|
239
|
+
return typeof u == "object" && u !== null && u.$$typeof === T;
|
|
240
240
|
}
|
|
241
|
-
var
|
|
241
|
+
var g = Q, T = Symbol.for("react.transitional.element"), b = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), z = Symbol.for("react.context"), P = Symbol.for("react.forward_ref"), _e = Symbol.for("react.suspense"), ve = Symbol.for("react.suspense_list"), be = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), E = Symbol.for("react.activity"), D = Symbol.for("react.client.reference"), Y = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, Yt = Array.isArray, we = console.createTask ? console.createTask : function() {
|
|
242
242
|
return null;
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
g = {
|
|
245
245
|
react_stack_bottom_frame: function(u) {
|
|
246
246
|
return u();
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
var
|
|
250
|
-
|
|
249
|
+
var Ue, Fe = {}, Le = g.react_stack_bottom_frame.bind(
|
|
250
|
+
g,
|
|
251
251
|
i
|
|
252
|
-
)(),
|
|
253
|
-
|
|
254
|
-
var
|
|
255
|
-
return
|
|
252
|
+
)(), Me = we(r(i)), Ve = {};
|
|
253
|
+
K.Fragment = C, K.jsx = function(u, v, x) {
|
|
254
|
+
var j = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return f(
|
|
256
256
|
u,
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
v,
|
|
258
|
+
x,
|
|
259
259
|
!1,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
j ? Error("react-stack-top-frame") : Le,
|
|
261
|
+
j ? we(r(u)) : Me
|
|
262
262
|
);
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
return
|
|
263
|
+
}, K.jsxs = function(u, v, x) {
|
|
264
|
+
var j = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return f(
|
|
266
266
|
u,
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
v,
|
|
268
|
+
x,
|
|
269
269
|
!0,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
j ? Error("react-stack-top-frame") : Le,
|
|
271
|
+
j ? we(r(u)) : Me
|
|
272
272
|
);
|
|
273
273
|
};
|
|
274
|
-
})()),
|
|
275
|
-
}
|
|
276
|
-
var
|
|
277
|
-
function
|
|
278
|
-
return
|
|
279
|
-
}
|
|
280
|
-
var
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}) =>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
274
|
+
})()), K;
|
|
275
|
+
}
|
|
276
|
+
var Ye;
|
|
277
|
+
function hn() {
|
|
278
|
+
return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? oe.exports = dn() : oe.exports = fn()), oe.exports;
|
|
279
|
+
}
|
|
280
|
+
var _ = hn();
|
|
281
|
+
const He = (e) => {
|
|
282
|
+
let t;
|
|
283
|
+
const n = /* @__PURE__ */ new Set(), r = (l, f) => {
|
|
284
|
+
const h = typeof l == "function" ? l(t) : l;
|
|
285
|
+
if (!Object.is(h, t)) {
|
|
286
|
+
const p = t;
|
|
287
|
+
t = f ?? (typeof h != "object" || h === null) ? h : Object.assign({}, t, h), n.forEach((g) => g(t, p));
|
|
288
|
+
}
|
|
289
|
+
}, o = () => t, c = { setState: r, getState: o, getInitialState: () => d, subscribe: (l) => (n.add(l), () => n.delete(l)) }, d = t = e(r, o, c);
|
|
290
|
+
return c;
|
|
291
|
+
}, mn = ((e) => e ? He(e) : He), pn = (e) => e;
|
|
292
|
+
function gn(e, t = pn) {
|
|
293
|
+
const n = Q.useSyncExternalStore(
|
|
294
|
+
e.subscribe,
|
|
295
|
+
Q.useCallback(() => t(e.getState()), [e, t]),
|
|
296
|
+
Q.useCallback(() => t(e.getInitialState()), [e, t])
|
|
297
|
+
);
|
|
298
|
+
return Q.useDebugValue(n), n;
|
|
299
|
+
}
|
|
300
|
+
const _n = (e) => {
|
|
301
|
+
const t = mn(e), n = (r) => gn(t, r);
|
|
302
|
+
return Object.assign(n, t), n;
|
|
303
|
+
}, vn = ((e) => _n);
|
|
304
|
+
function bn(e, t) {
|
|
305
|
+
let n;
|
|
306
|
+
try {
|
|
307
|
+
n = e();
|
|
308
|
+
} catch {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
getItem: (o) => {
|
|
313
|
+
var i;
|
|
314
|
+
const s = (d) => d === null ? null : JSON.parse(d, void 0), c = (i = n.getItem(o)) != null ? i : null;
|
|
315
|
+
return c instanceof Promise ? c.then(s) : s(c);
|
|
316
|
+
},
|
|
317
|
+
setItem: (o, i) => n.setItem(o, JSON.stringify(i, void 0)),
|
|
318
|
+
removeItem: (o) => n.removeItem(o)
|
|
301
319
|
};
|
|
302
|
-
|
|
320
|
+
}
|
|
321
|
+
const Ze = (e) => (t) => {
|
|
322
|
+
try {
|
|
323
|
+
const n = e(t);
|
|
324
|
+
return n instanceof Promise ? n : {
|
|
325
|
+
then(r) {
|
|
326
|
+
return Ze(r)(n);
|
|
327
|
+
},
|
|
328
|
+
catch(r) {
|
|
329
|
+
return this;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
} catch (n) {
|
|
333
|
+
return {
|
|
334
|
+
then(r) {
|
|
335
|
+
return this;
|
|
336
|
+
},
|
|
337
|
+
catch(r) {
|
|
338
|
+
return Ze(r)(n);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}, wn = (e, t) => (n, r, o) => {
|
|
343
|
+
let i = {
|
|
344
|
+
storage: bn(() => localStorage),
|
|
345
|
+
partialize: (b) => b,
|
|
346
|
+
version: 0,
|
|
347
|
+
merge: (b, C) => ({
|
|
348
|
+
...C,
|
|
349
|
+
...b
|
|
350
|
+
}),
|
|
351
|
+
...t
|
|
352
|
+
}, s = !1;
|
|
353
|
+
const c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
354
|
+
let l = i.storage;
|
|
355
|
+
if (!l)
|
|
356
|
+
return e(
|
|
357
|
+
(...b) => {
|
|
358
|
+
console.warn(
|
|
359
|
+
`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`
|
|
360
|
+
), n(...b);
|
|
361
|
+
},
|
|
362
|
+
r,
|
|
363
|
+
o
|
|
364
|
+
);
|
|
303
365
|
const f = () => {
|
|
304
|
-
const
|
|
305
|
-
l
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
] });
|
|
383
|
-
}, ln = ({
|
|
384
|
-
wordCount: e,
|
|
385
|
-
characterCount: t,
|
|
386
|
-
hasUnsavedChanges: n
|
|
387
|
-
}) => /* @__PURE__ */ m.jsx("div", { className: "flex justify-between items-center px-5 py-3 bg-gray-50 border-t border-gray-200 text-sm text-gray-600", children: /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
388
|
-
/* @__PURE__ */ m.jsxs("div", { children: [
|
|
389
|
-
"Words: ",
|
|
390
|
-
/* @__PURE__ */ m.jsx("strong", { className: "text-gray-800", children: e })
|
|
391
|
-
] }),
|
|
392
|
-
/* @__PURE__ */ m.jsxs("div", { children: [
|
|
393
|
-
"Characters: ",
|
|
394
|
-
/* @__PURE__ */ m.jsx("strong", { className: "text-gray-800", children: t })
|
|
395
|
-
] }),
|
|
396
|
-
/* @__PURE__ */ m.jsxs("div", { children: [
|
|
397
|
-
"Status: ",
|
|
398
|
-
/* @__PURE__ */ m.jsx("strong", { className: n ? "text-orange-600" : "text-green-600", children: n ? "Unsaved Changes" : "Saved" })
|
|
399
|
-
] })
|
|
400
|
-
] }) });
|
|
401
|
-
function s(e, t, n) {
|
|
402
|
-
function r(a, f) {
|
|
403
|
-
var d;
|
|
404
|
-
Object.defineProperty(a, "_zod", {
|
|
405
|
-
value: a._zod ?? {},
|
|
366
|
+
const b = i.partialize({ ...r() });
|
|
367
|
+
return l.setItem(i.name, {
|
|
368
|
+
state: b,
|
|
369
|
+
version: i.version
|
|
370
|
+
});
|
|
371
|
+
}, h = o.setState;
|
|
372
|
+
o.setState = (b, C) => (h(b, C), f());
|
|
373
|
+
const p = e(
|
|
374
|
+
(...b) => (n(...b), f()),
|
|
375
|
+
r,
|
|
376
|
+
o
|
|
377
|
+
);
|
|
378
|
+
o.getInitialState = () => p;
|
|
379
|
+
let g;
|
|
380
|
+
const T = () => {
|
|
381
|
+
var b, C;
|
|
382
|
+
if (!l) return;
|
|
383
|
+
s = !1, c.forEach((k) => {
|
|
384
|
+
var $;
|
|
385
|
+
return k(($ = r()) != null ? $ : p);
|
|
386
|
+
});
|
|
387
|
+
const N = ((C = i.onRehydrateStorage) == null ? void 0 : C.call(i, (b = r()) != null ? b : p)) || void 0;
|
|
388
|
+
return Ze(l.getItem.bind(l))(i.name).then((k) => {
|
|
389
|
+
if (k)
|
|
390
|
+
if (typeof k.version == "number" && k.version !== i.version) {
|
|
391
|
+
if (i.migrate) {
|
|
392
|
+
const $ = i.migrate(
|
|
393
|
+
k.state,
|
|
394
|
+
k.version
|
|
395
|
+
);
|
|
396
|
+
return $ instanceof Promise ? $.then((z) => [!0, z]) : [!0, $];
|
|
397
|
+
}
|
|
398
|
+
console.error(
|
|
399
|
+
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
400
|
+
);
|
|
401
|
+
} else
|
|
402
|
+
return [!1, k.state];
|
|
403
|
+
return [!1, void 0];
|
|
404
|
+
}).then((k) => {
|
|
405
|
+
var $;
|
|
406
|
+
const [z, P] = k;
|
|
407
|
+
if (g = i.merge(
|
|
408
|
+
P,
|
|
409
|
+
($ = r()) != null ? $ : p
|
|
410
|
+
), n(g, !0), z)
|
|
411
|
+
return f();
|
|
412
|
+
}).then(() => {
|
|
413
|
+
N?.(g, void 0), g = r(), s = !0, d.forEach((k) => k(g));
|
|
414
|
+
}).catch((k) => {
|
|
415
|
+
N?.(void 0, k);
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
return o.persist = {
|
|
419
|
+
setOptions: (b) => {
|
|
420
|
+
i = {
|
|
421
|
+
...i,
|
|
422
|
+
...b
|
|
423
|
+
}, b.storage && (l = b.storage);
|
|
424
|
+
},
|
|
425
|
+
clearStorage: () => {
|
|
426
|
+
l?.removeItem(i.name);
|
|
427
|
+
},
|
|
428
|
+
getOptions: () => i,
|
|
429
|
+
rehydrate: () => T(),
|
|
430
|
+
hasHydrated: () => s,
|
|
431
|
+
onHydrate: (b) => (c.add(b), () => {
|
|
432
|
+
c.delete(b);
|
|
433
|
+
}),
|
|
434
|
+
onFinishHydration: (b) => (d.add(b), () => {
|
|
435
|
+
d.delete(b);
|
|
436
|
+
})
|
|
437
|
+
}, i.skipHydration || T(), g || p;
|
|
438
|
+
}, kn = wn;
|
|
439
|
+
function a(e, t, n) {
|
|
440
|
+
function r(c, d) {
|
|
441
|
+
var l;
|
|
442
|
+
Object.defineProperty(c, "_zod", {
|
|
443
|
+
value: c._zod ?? {},
|
|
406
444
|
enumerable: !1
|
|
407
|
-
}), (
|
|
408
|
-
for (const
|
|
409
|
-
|
|
410
|
-
|
|
445
|
+
}), (l = c._zod).traits ?? (l.traits = /* @__PURE__ */ new Set()), c._zod.traits.add(e), t(c, d);
|
|
446
|
+
for (const f in s.prototype)
|
|
447
|
+
f in c || Object.defineProperty(c, f, { value: s.prototype[f].bind(c) });
|
|
448
|
+
c._zod.constr = s, c._zod.def = d;
|
|
411
449
|
}
|
|
412
450
|
const o = n?.Parent ?? Object;
|
|
413
451
|
class i extends o {
|
|
414
452
|
}
|
|
415
453
|
Object.defineProperty(i, "name", { value: e });
|
|
416
|
-
function c
|
|
417
|
-
var
|
|
418
|
-
const
|
|
419
|
-
r(
|
|
420
|
-
for (const
|
|
421
|
-
|
|
422
|
-
return
|
|
454
|
+
function s(c) {
|
|
455
|
+
var d;
|
|
456
|
+
const l = n?.Parent ? new i() : this;
|
|
457
|
+
r(l, c), (d = l._zod).deferred ?? (d.deferred = []);
|
|
458
|
+
for (const f of l._zod.deferred)
|
|
459
|
+
f();
|
|
460
|
+
return l;
|
|
423
461
|
}
|
|
424
|
-
return Object.defineProperty(
|
|
425
|
-
value: (
|
|
426
|
-
}), Object.defineProperty(
|
|
462
|
+
return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
463
|
+
value: (c) => n?.Parent && c instanceof n.Parent ? !0 : c?._zod?.traits?.has(e)
|
|
464
|
+
}), Object.defineProperty(s, "name", { value: e }), s;
|
|
427
465
|
}
|
|
428
|
-
class
|
|
466
|
+
class G extends Error {
|
|
429
467
|
constructor() {
|
|
430
468
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
431
469
|
}
|
|
432
470
|
}
|
|
433
|
-
class
|
|
471
|
+
class wt extends Error {
|
|
434
472
|
constructor(t) {
|
|
435
473
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
436
474
|
}
|
|
437
475
|
}
|
|
438
|
-
const
|
|
439
|
-
function
|
|
440
|
-
return
|
|
476
|
+
const kt = {};
|
|
477
|
+
function M(e) {
|
|
478
|
+
return kt;
|
|
441
479
|
}
|
|
442
|
-
function
|
|
480
|
+
function zn(e) {
|
|
443
481
|
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
444
482
|
return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
|
|
445
483
|
}
|
|
446
|
-
function
|
|
484
|
+
function Ee(e, t) {
|
|
447
485
|
return typeof t == "bigint" ? t.toString() : t;
|
|
448
486
|
}
|
|
449
|
-
function
|
|
487
|
+
function je(e) {
|
|
450
488
|
return {
|
|
451
489
|
get value() {
|
|
452
490
|
{
|
|
@@ -456,30 +494,30 @@ function ye(e) {
|
|
|
456
494
|
}
|
|
457
495
|
};
|
|
458
496
|
}
|
|
459
|
-
function
|
|
497
|
+
function Ae(e) {
|
|
460
498
|
return e == null;
|
|
461
499
|
}
|
|
462
|
-
function
|
|
500
|
+
function Ce(e) {
|
|
463
501
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
464
502
|
return e.slice(t, n);
|
|
465
503
|
}
|
|
466
|
-
function
|
|
504
|
+
function yn(e, t) {
|
|
467
505
|
const n = (e.toString().split(".")[1] || "").length, r = t.toString();
|
|
468
506
|
let o = (r.split(".")[1] || "").length;
|
|
469
507
|
if (o === 0 && /\d?e-\d?/.test(r)) {
|
|
470
|
-
const
|
|
471
|
-
|
|
508
|
+
const d = r.match(/\d?e-(\d?)/);
|
|
509
|
+
d?.[1] && (o = Number.parseInt(d[1]));
|
|
472
510
|
}
|
|
473
|
-
const i = n > o ? n : o,
|
|
474
|
-
return
|
|
511
|
+
const i = n > o ? n : o, s = Number.parseInt(e.toFixed(i).replace(".", "")), c = Number.parseInt(t.toFixed(i).replace(".", ""));
|
|
512
|
+
return s % c / 10 ** i;
|
|
475
513
|
}
|
|
476
|
-
const
|
|
477
|
-
function
|
|
514
|
+
const Je = Symbol("evaluating");
|
|
515
|
+
function w(e, t, n) {
|
|
478
516
|
let r;
|
|
479
517
|
Object.defineProperty(e, t, {
|
|
480
518
|
get() {
|
|
481
|
-
if (r !==
|
|
482
|
-
return r === void 0 && (r =
|
|
519
|
+
if (r !== Je)
|
|
520
|
+
return r === void 0 && (r = Je, r = n()), r;
|
|
483
521
|
},
|
|
484
522
|
set(o) {
|
|
485
523
|
Object.defineProperty(e, t, {
|
|
@@ -490,7 +528,7 @@ function b(e, t, n) {
|
|
|
490
528
|
configurable: !0
|
|
491
529
|
});
|
|
492
530
|
}
|
|
493
|
-
function
|
|
531
|
+
function W(e, t, n) {
|
|
494
532
|
Object.defineProperty(e, t, {
|
|
495
533
|
value: n,
|
|
496
534
|
writable: !0,
|
|
@@ -498,7 +536,7 @@ function U(e, t, n) {
|
|
|
498
536
|
configurable: !0
|
|
499
537
|
});
|
|
500
538
|
}
|
|
501
|
-
function
|
|
539
|
+
function B(...e) {
|
|
502
540
|
const t = {};
|
|
503
541
|
for (const n of e) {
|
|
504
542
|
const r = Object.getOwnPropertyDescriptors(n);
|
|
@@ -506,15 +544,15 @@ function F(...e) {
|
|
|
506
544
|
}
|
|
507
545
|
return Object.defineProperties({}, t);
|
|
508
546
|
}
|
|
509
|
-
function
|
|
547
|
+
function Ge(e) {
|
|
510
548
|
return JSON.stringify(e);
|
|
511
549
|
}
|
|
512
|
-
const
|
|
550
|
+
const zt = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
513
551
|
};
|
|
514
|
-
function
|
|
552
|
+
function le(e) {
|
|
515
553
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
516
554
|
}
|
|
517
|
-
const
|
|
555
|
+
const $n = je(() => {
|
|
518
556
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
519
557
|
return !1;
|
|
520
558
|
try {
|
|
@@ -524,27 +562,27 @@ const hn = ye(() => {
|
|
|
524
562
|
return !1;
|
|
525
563
|
}
|
|
526
564
|
});
|
|
527
|
-
function
|
|
528
|
-
if (
|
|
565
|
+
function ee(e) {
|
|
566
|
+
if (le(e) === !1)
|
|
529
567
|
return !1;
|
|
530
568
|
const t = e.constructor;
|
|
531
569
|
if (t === void 0)
|
|
532
570
|
return !0;
|
|
533
571
|
const n = t.prototype;
|
|
534
|
-
return !(
|
|
572
|
+
return !(le(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
535
573
|
}
|
|
536
|
-
function
|
|
537
|
-
return
|
|
574
|
+
function yt(e) {
|
|
575
|
+
return ee(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
538
576
|
}
|
|
539
|
-
const
|
|
540
|
-
function
|
|
577
|
+
const Zn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
578
|
+
function he(e) {
|
|
541
579
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
542
580
|
}
|
|
543
|
-
function
|
|
581
|
+
function L(e, t, n) {
|
|
544
582
|
const r = new e._zod.constr(t ?? e._zod.def);
|
|
545
583
|
return (!t || n?.parent) && (r._zod.parent = e), r;
|
|
546
584
|
}
|
|
547
|
-
function
|
|
585
|
+
function m(e) {
|
|
548
586
|
const t = e;
|
|
549
587
|
if (!t)
|
|
550
588
|
return {};
|
|
@@ -557,18 +595,18 @@ function h(e) {
|
|
|
557
595
|
}
|
|
558
596
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
559
597
|
}
|
|
560
|
-
function
|
|
598
|
+
function En(e) {
|
|
561
599
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
562
600
|
}
|
|
563
|
-
const
|
|
601
|
+
const xn = {
|
|
564
602
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
565
603
|
int32: [-2147483648, 2147483647],
|
|
566
604
|
uint32: [0, 4294967295],
|
|
567
605
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
568
606
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
569
607
|
};
|
|
570
|
-
function
|
|
571
|
-
const n = e._zod.def, r =
|
|
608
|
+
function Tn(e, t) {
|
|
609
|
+
const n = e._zod.def, r = B(e._zod.def, {
|
|
572
610
|
get shape() {
|
|
573
611
|
const o = {};
|
|
574
612
|
for (const i in t) {
|
|
@@ -576,14 +614,14 @@ function gn(e, t) {
|
|
|
576
614
|
throw new Error(`Unrecognized key: "${i}"`);
|
|
577
615
|
t[i] && (o[i] = n.shape[i]);
|
|
578
616
|
}
|
|
579
|
-
return
|
|
617
|
+
return W(this, "shape", o), o;
|
|
580
618
|
},
|
|
581
619
|
checks: []
|
|
582
620
|
});
|
|
583
|
-
return
|
|
621
|
+
return L(e, r);
|
|
584
622
|
}
|
|
585
|
-
function
|
|
586
|
-
const n = e._zod.def, r =
|
|
623
|
+
function Sn(e, t) {
|
|
624
|
+
const n = e._zod.def, r = B(e._zod.def, {
|
|
587
625
|
get shape() {
|
|
588
626
|
const o = { ...e._zod.def.shape };
|
|
589
627
|
for (const i in t) {
|
|
@@ -591,45 +629,45 @@ function vn(e, t) {
|
|
|
591
629
|
throw new Error(`Unrecognized key: "${i}"`);
|
|
592
630
|
t[i] && delete o[i];
|
|
593
631
|
}
|
|
594
|
-
return
|
|
632
|
+
return W(this, "shape", o), o;
|
|
595
633
|
},
|
|
596
634
|
checks: []
|
|
597
635
|
});
|
|
598
|
-
return
|
|
636
|
+
return L(e, r);
|
|
599
637
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
638
|
+
function In(e, t) {
|
|
639
|
+
if (!ee(t))
|
|
602
640
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
603
641
|
const n = e._zod.def.checks;
|
|
604
642
|
if (n && n.length > 0)
|
|
605
643
|
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
606
|
-
const o =
|
|
644
|
+
const o = B(e._zod.def, {
|
|
607
645
|
get shape() {
|
|
608
646
|
const i = { ...e._zod.def.shape, ...t };
|
|
609
|
-
return
|
|
647
|
+
return W(this, "shape", i), i;
|
|
610
648
|
},
|
|
611
649
|
checks: []
|
|
612
650
|
});
|
|
613
|
-
return
|
|
651
|
+
return L(e, o);
|
|
614
652
|
}
|
|
615
|
-
function
|
|
616
|
-
if (!
|
|
653
|
+
function jn(e, t) {
|
|
654
|
+
if (!ee(t))
|
|
617
655
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
618
656
|
const n = {
|
|
619
657
|
...e._zod.def,
|
|
620
658
|
get shape() {
|
|
621
659
|
const r = { ...e._zod.def.shape, ...t };
|
|
622
|
-
return
|
|
660
|
+
return W(this, "shape", r), r;
|
|
623
661
|
},
|
|
624
662
|
checks: e._zod.def.checks
|
|
625
663
|
};
|
|
626
|
-
return
|
|
664
|
+
return L(e, n);
|
|
627
665
|
}
|
|
628
|
-
function
|
|
629
|
-
const n =
|
|
666
|
+
function An(e, t) {
|
|
667
|
+
const n = B(e._zod.def, {
|
|
630
668
|
get shape() {
|
|
631
669
|
const r = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
632
|
-
return
|
|
670
|
+
return W(this, "shape", r), r;
|
|
633
671
|
},
|
|
634
672
|
get catchall() {
|
|
635
673
|
return t._zod.def.catchall;
|
|
@@ -637,59 +675,59 @@ function kn(e, t) {
|
|
|
637
675
|
checks: []
|
|
638
676
|
// delete existing checks
|
|
639
677
|
});
|
|
640
|
-
return
|
|
678
|
+
return L(e, n);
|
|
641
679
|
}
|
|
642
|
-
function
|
|
643
|
-
const r =
|
|
680
|
+
function Cn(e, t, n) {
|
|
681
|
+
const r = B(t._zod.def, {
|
|
644
682
|
get shape() {
|
|
645
683
|
const o = t._zod.def.shape, i = { ...o };
|
|
646
684
|
if (n)
|
|
647
|
-
for (const
|
|
648
|
-
if (!(
|
|
649
|
-
throw new Error(`Unrecognized key: "${
|
|
650
|
-
n[
|
|
685
|
+
for (const s in n) {
|
|
686
|
+
if (!(s in o))
|
|
687
|
+
throw new Error(`Unrecognized key: "${s}"`);
|
|
688
|
+
n[s] && (i[s] = e ? new e({
|
|
651
689
|
type: "optional",
|
|
652
|
-
innerType: o[
|
|
653
|
-
}) : o[
|
|
690
|
+
innerType: o[s]
|
|
691
|
+
}) : o[s]);
|
|
654
692
|
}
|
|
655
693
|
else
|
|
656
|
-
for (const
|
|
657
|
-
i[
|
|
694
|
+
for (const s in o)
|
|
695
|
+
i[s] = e ? new e({
|
|
658
696
|
type: "optional",
|
|
659
|
-
innerType: o[
|
|
660
|
-
}) : o[
|
|
661
|
-
return
|
|
697
|
+
innerType: o[s]
|
|
698
|
+
}) : o[s];
|
|
699
|
+
return W(this, "shape", i), i;
|
|
662
700
|
},
|
|
663
701
|
checks: []
|
|
664
702
|
});
|
|
665
|
-
return
|
|
703
|
+
return L(t, r);
|
|
666
704
|
}
|
|
667
|
-
function
|
|
668
|
-
const r =
|
|
705
|
+
function On(e, t, n) {
|
|
706
|
+
const r = B(t._zod.def, {
|
|
669
707
|
get shape() {
|
|
670
708
|
const o = t._zod.def.shape, i = { ...o };
|
|
671
709
|
if (n)
|
|
672
|
-
for (const
|
|
673
|
-
if (!(
|
|
674
|
-
throw new Error(`Unrecognized key: "${
|
|
675
|
-
n[
|
|
710
|
+
for (const s in n) {
|
|
711
|
+
if (!(s in i))
|
|
712
|
+
throw new Error(`Unrecognized key: "${s}"`);
|
|
713
|
+
n[s] && (i[s] = new e({
|
|
676
714
|
type: "nonoptional",
|
|
677
|
-
innerType: o[
|
|
715
|
+
innerType: o[s]
|
|
678
716
|
}));
|
|
679
717
|
}
|
|
680
718
|
else
|
|
681
|
-
for (const
|
|
682
|
-
i[
|
|
719
|
+
for (const s in o)
|
|
720
|
+
i[s] = new e({
|
|
683
721
|
type: "nonoptional",
|
|
684
|
-
innerType: o[
|
|
722
|
+
innerType: o[s]
|
|
685
723
|
});
|
|
686
|
-
return
|
|
724
|
+
return W(this, "shape", i), i;
|
|
687
725
|
},
|
|
688
726
|
checks: []
|
|
689
727
|
});
|
|
690
|
-
return
|
|
728
|
+
return L(t, r);
|
|
691
729
|
}
|
|
692
|
-
function
|
|
730
|
+
function J(e, t = 0) {
|
|
693
731
|
if (e.aborted === !0)
|
|
694
732
|
return !0;
|
|
695
733
|
for (let n = t; n < e.issues.length; n++)
|
|
@@ -697,27 +735,27 @@ function W(e, t = 0) {
|
|
|
697
735
|
return !0;
|
|
698
736
|
return !1;
|
|
699
737
|
}
|
|
700
|
-
function
|
|
738
|
+
function $t(e, t) {
|
|
701
739
|
return t.map((n) => {
|
|
702
740
|
var r;
|
|
703
741
|
return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
|
|
704
742
|
});
|
|
705
743
|
}
|
|
706
|
-
function
|
|
744
|
+
function ie(e) {
|
|
707
745
|
return typeof e == "string" ? e : e?.message;
|
|
708
746
|
}
|
|
709
|
-
function
|
|
747
|
+
function V(e, t, n) {
|
|
710
748
|
const r = { ...e, path: e.path ?? [] };
|
|
711
749
|
if (!e.message) {
|
|
712
|
-
const o =
|
|
750
|
+
const o = ie(e.inst?._zod.def?.error?.(e)) ?? ie(t?.error?.(e)) ?? ie(n.customError?.(e)) ?? ie(n.localeError?.(e)) ?? "Invalid input";
|
|
713
751
|
r.message = o;
|
|
714
752
|
}
|
|
715
753
|
return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
|
|
716
754
|
}
|
|
717
|
-
function
|
|
755
|
+
function Oe(e) {
|
|
718
756
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
719
757
|
}
|
|
720
|
-
function
|
|
758
|
+
function te(...e) {
|
|
721
759
|
const [t, n, r] = e;
|
|
722
760
|
return typeof t == "string" ? {
|
|
723
761
|
message: t,
|
|
@@ -726,122 +764,122 @@ function q(...e) {
|
|
|
726
764
|
inst: r
|
|
727
765
|
} : { ...t };
|
|
728
766
|
}
|
|
729
|
-
const
|
|
767
|
+
const Zt = (e, t) => {
|
|
730
768
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
731
769
|
value: e._zod,
|
|
732
770
|
enumerable: !1
|
|
733
771
|
}), Object.defineProperty(e, "issues", {
|
|
734
772
|
value: t,
|
|
735
773
|
enumerable: !1
|
|
736
|
-
}), e.message = JSON.stringify(t,
|
|
774
|
+
}), e.message = JSON.stringify(t, Ee, 2), Object.defineProperty(e, "toString", {
|
|
737
775
|
value: () => e.message,
|
|
738
776
|
enumerable: !1
|
|
739
777
|
});
|
|
740
|
-
},
|
|
741
|
-
function
|
|
778
|
+
}, Et = a("$ZodError", Zt), xt = a("$ZodError", Zt, { Parent: Error });
|
|
779
|
+
function Rn(e, t = (n) => n.message) {
|
|
742
780
|
const n = {}, r = [];
|
|
743
781
|
for (const o of e.issues)
|
|
744
782
|
o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
745
783
|
return { formErrors: r, fieldErrors: n };
|
|
746
784
|
}
|
|
747
|
-
function
|
|
785
|
+
function Pn(e, t) {
|
|
748
786
|
const n = t || function(i) {
|
|
749
787
|
return i.message;
|
|
750
788
|
}, r = { _errors: [] }, o = (i) => {
|
|
751
|
-
for (const
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
else if (
|
|
755
|
-
o({ issues:
|
|
756
|
-
else if (
|
|
757
|
-
o({ issues:
|
|
758
|
-
else if (
|
|
759
|
-
r._errors.push(n(
|
|
789
|
+
for (const s of i.issues)
|
|
790
|
+
if (s.code === "invalid_union" && s.errors.length)
|
|
791
|
+
s.errors.map((c) => o({ issues: c }));
|
|
792
|
+
else if (s.code === "invalid_key")
|
|
793
|
+
o({ issues: s.issues });
|
|
794
|
+
else if (s.code === "invalid_element")
|
|
795
|
+
o({ issues: s.issues });
|
|
796
|
+
else if (s.path.length === 0)
|
|
797
|
+
r._errors.push(n(s));
|
|
760
798
|
else {
|
|
761
|
-
let
|
|
762
|
-
for (;
|
|
763
|
-
const
|
|
764
|
-
|
|
799
|
+
let c = r, d = 0;
|
|
800
|
+
for (; d < s.path.length; ) {
|
|
801
|
+
const l = s.path[d];
|
|
802
|
+
d === s.path.length - 1 ? (c[l] = c[l] || { _errors: [] }, c[l]._errors.push(n(s))) : c[l] = c[l] || { _errors: [] }, c = c[l], d++;
|
|
765
803
|
}
|
|
766
804
|
}
|
|
767
805
|
};
|
|
768
806
|
return o(e), r;
|
|
769
807
|
}
|
|
770
|
-
const
|
|
771
|
-
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 },
|
|
772
|
-
if (
|
|
773
|
-
throw new
|
|
774
|
-
if (
|
|
775
|
-
const
|
|
776
|
-
throw
|
|
808
|
+
const Re = (e) => (t, n, r, o) => {
|
|
809
|
+
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
|
|
810
|
+
if (s instanceof Promise)
|
|
811
|
+
throw new G();
|
|
812
|
+
if (s.issues.length) {
|
|
813
|
+
const c = new (o?.Err ?? e)(s.issues.map((d) => V(d, i, M())));
|
|
814
|
+
throw zt(c, o?.callee), c;
|
|
777
815
|
}
|
|
778
|
-
return
|
|
779
|
-
},
|
|
816
|
+
return s.value;
|
|
817
|
+
}, Pe = (e) => async (t, n, r, o) => {
|
|
780
818
|
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
781
|
-
let
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
throw
|
|
819
|
+
let s = t._zod.run({ value: n, issues: [] }, i);
|
|
820
|
+
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
821
|
+
const c = new (o?.Err ?? e)(s.issues.map((d) => V(d, i, M())));
|
|
822
|
+
throw zt(c, o?.callee), c;
|
|
785
823
|
}
|
|
786
|
-
return
|
|
787
|
-
},
|
|
824
|
+
return s.value;
|
|
825
|
+
}, me = (e) => (t, n, r) => {
|
|
788
826
|
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
789
827
|
if (i instanceof Promise)
|
|
790
|
-
throw new
|
|
828
|
+
throw new G();
|
|
791
829
|
return i.issues.length ? {
|
|
792
830
|
success: !1,
|
|
793
|
-
error: new (e ??
|
|
831
|
+
error: new (e ?? Et)(i.issues.map((s) => V(s, o, M())))
|
|
794
832
|
} : { success: !0, data: i.value };
|
|
795
|
-
},
|
|
833
|
+
}, Nn = /* @__PURE__ */ me(xt), pe = (e) => async (t, n, r) => {
|
|
796
834
|
const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
797
835
|
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
798
836
|
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
799
837
|
success: !1,
|
|
800
|
-
error: new e(i.issues.map((
|
|
838
|
+
error: new e(i.issues.map((s) => V(s, o, M())))
|
|
801
839
|
} : { success: !0, data: i.value };
|
|
802
|
-
},
|
|
840
|
+
}, Dn = /* @__PURE__ */ pe(xt), Un = (e) => (t, n, r) => {
|
|
803
841
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
804
|
-
return
|
|
805
|
-
},
|
|
842
|
+
return Re(e)(t, n, o);
|
|
843
|
+
}, Fn = (e) => (t, n, r) => Re(e)(t, n, r), Ln = (e) => async (t, n, r) => {
|
|
806
844
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
807
|
-
return
|
|
808
|
-
},
|
|
845
|
+
return Pe(e)(t, n, o);
|
|
846
|
+
}, Mn = (e) => async (t, n, r) => Pe(e)(t, n, r), Vn = (e) => (t, n, r) => {
|
|
809
847
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
810
|
-
return
|
|
811
|
-
},
|
|
848
|
+
return me(e)(t, n, o);
|
|
849
|
+
}, Wn = (e) => (t, n, r) => me(e)(t, n, r), Bn = (e) => async (t, n, r) => {
|
|
812
850
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
813
|
-
return
|
|
814
|
-
},
|
|
815
|
-
function
|
|
816
|
-
return new RegExp(
|
|
851
|
+
return pe(e)(t, n, o);
|
|
852
|
+
}, Yn = (e) => async (t, n, r) => pe(e)(t, n, r), Hn = /^[cC][^\s-]{8,}$/, Jn = /^[0-9a-z]+$/, Gn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, qn = /^[0-9a-vA-V]{20}$/, Xn = /^[A-Za-z0-9]{27}$/, Kn = /^[a-zA-Z0-9_-]{21}$/, Qn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, er = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, qe = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, tr = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, nr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
853
|
+
function rr() {
|
|
854
|
+
return new RegExp(nr, "u");
|
|
817
855
|
}
|
|
818
|
-
const
|
|
819
|
-
function
|
|
856
|
+
const or = /^(?:(?: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])$/, ir = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, sr = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, cr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, ar = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Tt = /^[A-Za-z0-9_-]*$/, ur = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, lr = /^\+(?:[0-9]){6,14}[0-9]$/, St = "(?:(?:\\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])))", dr = /* @__PURE__ */ new RegExp(`^${St}$`);
|
|
857
|
+
function It(e) {
|
|
820
858
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
821
859
|
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
822
860
|
}
|
|
823
|
-
function
|
|
824
|
-
return new RegExp(`^${
|
|
861
|
+
function fr(e) {
|
|
862
|
+
return new RegExp(`^${It(e)}$`);
|
|
825
863
|
}
|
|
826
|
-
function
|
|
827
|
-
const t =
|
|
864
|
+
function hr(e) {
|
|
865
|
+
const t = It({ precision: e.precision }), n = ["Z"];
|
|
828
866
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
829
867
|
const r = `${t}(?:${n.join("|")})`;
|
|
830
|
-
return new RegExp(`^${
|
|
868
|
+
return new RegExp(`^${St}T(?:${r})$`);
|
|
831
869
|
}
|
|
832
|
-
const
|
|
870
|
+
const mr = (e) => {
|
|
833
871
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
834
872
|
return new RegExp(`^${t}$`);
|
|
835
|
-
},
|
|
873
|
+
}, pr = /^-?\d+$/, gr = /^-?\d+(?:\.\d+)?/, _r = /^(?:true|false)$/i, vr = /^[^A-Z]*$/, br = /^[^a-z]*$/, O = /* @__PURE__ */ a("$ZodCheck", (e, t) => {
|
|
836
874
|
var n;
|
|
837
875
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
838
|
-
}),
|
|
876
|
+
}), jt = {
|
|
839
877
|
number: "number",
|
|
840
878
|
bigint: "bigint",
|
|
841
879
|
object: "date"
|
|
842
|
-
},
|
|
843
|
-
|
|
844
|
-
const n =
|
|
880
|
+
}, At = /* @__PURE__ */ a("$ZodCheckLessThan", (e, t) => {
|
|
881
|
+
O.init(e, t);
|
|
882
|
+
const n = jt[typeof t.value];
|
|
845
883
|
e._zod.onattach.push((r) => {
|
|
846
884
|
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
847
885
|
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
@@ -856,9 +894,9 @@ const rr = (e) => {
|
|
|
856
894
|
continue: !t.abort
|
|
857
895
|
});
|
|
858
896
|
};
|
|
859
|
-
}),
|
|
860
|
-
|
|
861
|
-
const n =
|
|
897
|
+
}), Ct = /* @__PURE__ */ a("$ZodCheckGreaterThan", (e, t) => {
|
|
898
|
+
O.init(e, t);
|
|
899
|
+
const n = jt[typeof t.value];
|
|
862
900
|
e._zod.onattach.push((r) => {
|
|
863
901
|
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
864
902
|
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
@@ -873,14 +911,14 @@ const rr = (e) => {
|
|
|
873
911
|
continue: !t.abort
|
|
874
912
|
});
|
|
875
913
|
};
|
|
876
|
-
}),
|
|
877
|
-
|
|
914
|
+
}), wr = /* @__PURE__ */ a("$ZodCheckMultipleOf", (e, t) => {
|
|
915
|
+
O.init(e, t), e._zod.onattach.push((n) => {
|
|
878
916
|
var r;
|
|
879
917
|
(r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
|
|
880
918
|
}), e._zod.check = (n) => {
|
|
881
919
|
if (typeof n.value != typeof t.value)
|
|
882
920
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
883
|
-
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) :
|
|
921
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : yn(n.value, t.value) === 0) || n.issues.push({
|
|
884
922
|
origin: typeof n.value,
|
|
885
923
|
code: "not_multiple_of",
|
|
886
924
|
divisor: t.value,
|
|
@@ -889,37 +927,37 @@ const rr = (e) => {
|
|
|
889
927
|
continue: !t.abort
|
|
890
928
|
});
|
|
891
929
|
};
|
|
892
|
-
}),
|
|
893
|
-
|
|
894
|
-
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] =
|
|
895
|
-
e._zod.onattach.push((
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
}), e._zod.check = (
|
|
899
|
-
const
|
|
930
|
+
}), kr = /* @__PURE__ */ a("$ZodCheckNumberFormat", (e, t) => {
|
|
931
|
+
O.init(e, t), t.format = t.format || "float64";
|
|
932
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = xn[t.format];
|
|
933
|
+
e._zod.onattach.push((s) => {
|
|
934
|
+
const c = s._zod.bag;
|
|
935
|
+
c.format = t.format, c.minimum = o, c.maximum = i, n && (c.pattern = pr);
|
|
936
|
+
}), e._zod.check = (s) => {
|
|
937
|
+
const c = s.value;
|
|
900
938
|
if (n) {
|
|
901
|
-
if (!Number.isInteger(
|
|
902
|
-
|
|
939
|
+
if (!Number.isInteger(c)) {
|
|
940
|
+
s.issues.push({
|
|
903
941
|
expected: r,
|
|
904
942
|
format: t.format,
|
|
905
943
|
code: "invalid_type",
|
|
906
944
|
continue: !1,
|
|
907
|
-
input:
|
|
945
|
+
input: c,
|
|
908
946
|
inst: e
|
|
909
947
|
});
|
|
910
948
|
return;
|
|
911
949
|
}
|
|
912
|
-
if (!Number.isSafeInteger(
|
|
913
|
-
|
|
914
|
-
input:
|
|
950
|
+
if (!Number.isSafeInteger(c)) {
|
|
951
|
+
c > 0 ? s.issues.push({
|
|
952
|
+
input: c,
|
|
915
953
|
code: "too_big",
|
|
916
954
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
917
955
|
note: "Integers must be within the safe integer range.",
|
|
918
956
|
inst: e,
|
|
919
957
|
origin: r,
|
|
920
958
|
continue: !t.abort
|
|
921
|
-
}) :
|
|
922
|
-
input:
|
|
959
|
+
}) : s.issues.push({
|
|
960
|
+
input: c,
|
|
923
961
|
code: "too_small",
|
|
924
962
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
925
963
|
note: "Integers must be within the safe integer range.",
|
|
@@ -930,27 +968,27 @@ const rr = (e) => {
|
|
|
930
968
|
return;
|
|
931
969
|
}
|
|
932
970
|
}
|
|
933
|
-
|
|
971
|
+
c < o && s.issues.push({
|
|
934
972
|
origin: "number",
|
|
935
|
-
input:
|
|
973
|
+
input: c,
|
|
936
974
|
code: "too_small",
|
|
937
975
|
minimum: o,
|
|
938
976
|
inclusive: !0,
|
|
939
977
|
inst: e,
|
|
940
978
|
continue: !t.abort
|
|
941
|
-
}),
|
|
979
|
+
}), c > i && s.issues.push({
|
|
942
980
|
origin: "number",
|
|
943
|
-
input:
|
|
981
|
+
input: c,
|
|
944
982
|
code: "too_big",
|
|
945
983
|
maximum: i,
|
|
946
984
|
inst: e
|
|
947
985
|
});
|
|
948
986
|
};
|
|
949
|
-
}),
|
|
987
|
+
}), zr = /* @__PURE__ */ a("$ZodCheckMaxLength", (e, t) => {
|
|
950
988
|
var n;
|
|
951
|
-
|
|
989
|
+
O.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
952
990
|
const o = r.value;
|
|
953
|
-
return
|
|
991
|
+
return !Ae(o) && o.length !== void 0;
|
|
954
992
|
}), e._zod.onattach.push((r) => {
|
|
955
993
|
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
956
994
|
t.maximum < o && (r._zod.bag.maximum = t.maximum);
|
|
@@ -958,9 +996,9 @@ const rr = (e) => {
|
|
|
958
996
|
const o = r.value;
|
|
959
997
|
if (o.length <= t.maximum)
|
|
960
998
|
return;
|
|
961
|
-
const
|
|
999
|
+
const s = Oe(o);
|
|
962
1000
|
r.issues.push({
|
|
963
|
-
origin:
|
|
1001
|
+
origin: s,
|
|
964
1002
|
code: "too_big",
|
|
965
1003
|
maximum: t.maximum,
|
|
966
1004
|
inclusive: !0,
|
|
@@ -969,11 +1007,11 @@ const rr = (e) => {
|
|
|
969
1007
|
continue: !t.abort
|
|
970
1008
|
});
|
|
971
1009
|
};
|
|
972
|
-
}),
|
|
1010
|
+
}), yr = /* @__PURE__ */ a("$ZodCheckMinLength", (e, t) => {
|
|
973
1011
|
var n;
|
|
974
|
-
|
|
1012
|
+
O.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
975
1013
|
const o = r.value;
|
|
976
|
-
return
|
|
1014
|
+
return !Ae(o) && o.length !== void 0;
|
|
977
1015
|
}), e._zod.onattach.push((r) => {
|
|
978
1016
|
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
979
1017
|
t.minimum > o && (r._zod.bag.minimum = t.minimum);
|
|
@@ -981,9 +1019,9 @@ const rr = (e) => {
|
|
|
981
1019
|
const o = r.value;
|
|
982
1020
|
if (o.length >= t.minimum)
|
|
983
1021
|
return;
|
|
984
|
-
const
|
|
1022
|
+
const s = Oe(o);
|
|
985
1023
|
r.issues.push({
|
|
986
|
-
origin:
|
|
1024
|
+
origin: s,
|
|
987
1025
|
code: "too_small",
|
|
988
1026
|
minimum: t.minimum,
|
|
989
1027
|
inclusive: !0,
|
|
@@ -992,11 +1030,11 @@ const rr = (e) => {
|
|
|
992
1030
|
continue: !t.abort
|
|
993
1031
|
});
|
|
994
1032
|
};
|
|
995
|
-
}),
|
|
1033
|
+
}), $r = /* @__PURE__ */ a("$ZodCheckLengthEquals", (e, t) => {
|
|
996
1034
|
var n;
|
|
997
|
-
|
|
1035
|
+
O.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
998
1036
|
const o = r.value;
|
|
999
|
-
return
|
|
1037
|
+
return !Ae(o) && o.length !== void 0;
|
|
1000
1038
|
}), e._zod.onattach.push((r) => {
|
|
1001
1039
|
const o = r._zod.bag;
|
|
1002
1040
|
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
@@ -1004,10 +1042,10 @@ const rr = (e) => {
|
|
|
1004
1042
|
const o = r.value, i = o.length;
|
|
1005
1043
|
if (i === t.length)
|
|
1006
1044
|
return;
|
|
1007
|
-
const
|
|
1045
|
+
const s = Oe(o), c = i > t.length;
|
|
1008
1046
|
r.issues.push({
|
|
1009
|
-
origin:
|
|
1010
|
-
...
|
|
1047
|
+
origin: s,
|
|
1048
|
+
...c ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
1011
1049
|
inclusive: !0,
|
|
1012
1050
|
exact: !0,
|
|
1013
1051
|
input: r.value,
|
|
@@ -1015,9 +1053,9 @@ const rr = (e) => {
|
|
|
1015
1053
|
continue: !t.abort
|
|
1016
1054
|
});
|
|
1017
1055
|
};
|
|
1018
|
-
}),
|
|
1056
|
+
}), ge = /* @__PURE__ */ a("$ZodCheckStringFormat", (e, t) => {
|
|
1019
1057
|
var n, r;
|
|
1020
|
-
|
|
1058
|
+
O.init(e, t), e._zod.onattach.push((o) => {
|
|
1021
1059
|
const i = o._zod.bag;
|
|
1022
1060
|
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
1023
1061
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
@@ -1032,8 +1070,8 @@ const rr = (e) => {
|
|
|
1032
1070
|
});
|
|
1033
1071
|
}) : (r = e._zod).check ?? (r.check = () => {
|
|
1034
1072
|
});
|
|
1035
|
-
}),
|
|
1036
|
-
|
|
1073
|
+
}), Zr = /* @__PURE__ */ a("$ZodCheckRegex", (e, t) => {
|
|
1074
|
+
ge.init(e, t), e._zod.check = (n) => {
|
|
1037
1075
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1038
1076
|
origin: "string",
|
|
1039
1077
|
code: "invalid_format",
|
|
@@ -1044,13 +1082,13 @@ const rr = (e) => {
|
|
|
1044
1082
|
continue: !t.abort
|
|
1045
1083
|
});
|
|
1046
1084
|
};
|
|
1047
|
-
}),
|
|
1048
|
-
t.pattern ?? (t.pattern =
|
|
1049
|
-
}),
|
|
1050
|
-
t.pattern ?? (t.pattern =
|
|
1051
|
-
}),
|
|
1052
|
-
|
|
1053
|
-
const n =
|
|
1085
|
+
}), Er = /* @__PURE__ */ a("$ZodCheckLowerCase", (e, t) => {
|
|
1086
|
+
t.pattern ?? (t.pattern = vr), ge.init(e, t);
|
|
1087
|
+
}), xr = /* @__PURE__ */ a("$ZodCheckUpperCase", (e, t) => {
|
|
1088
|
+
t.pattern ?? (t.pattern = br), ge.init(e, t);
|
|
1089
|
+
}), Tr = /* @__PURE__ */ a("$ZodCheckIncludes", (e, t) => {
|
|
1090
|
+
O.init(e, t);
|
|
1091
|
+
const n = he(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1054
1092
|
t.pattern = r, e._zod.onattach.push((o) => {
|
|
1055
1093
|
const i = o._zod.bag;
|
|
1056
1094
|
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
@@ -1065,9 +1103,9 @@ const rr = (e) => {
|
|
|
1065
1103
|
continue: !t.abort
|
|
1066
1104
|
});
|
|
1067
1105
|
};
|
|
1068
|
-
}),
|
|
1069
|
-
|
|
1070
|
-
const n = new RegExp(`^${
|
|
1106
|
+
}), Sr = /* @__PURE__ */ a("$ZodCheckStartsWith", (e, t) => {
|
|
1107
|
+
O.init(e, t);
|
|
1108
|
+
const n = new RegExp(`^${he(t.prefix)}.*`);
|
|
1071
1109
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1072
1110
|
const o = r._zod.bag;
|
|
1073
1111
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1082,9 +1120,9 @@ const rr = (e) => {
|
|
|
1082
1120
|
continue: !t.abort
|
|
1083
1121
|
});
|
|
1084
1122
|
};
|
|
1085
|
-
}),
|
|
1086
|
-
|
|
1087
|
-
const n = new RegExp(`.*${
|
|
1123
|
+
}), Ir = /* @__PURE__ */ a("$ZodCheckEndsWith", (e, t) => {
|
|
1124
|
+
O.init(e, t);
|
|
1125
|
+
const n = new RegExp(`.*${he(t.suffix)}$`);
|
|
1088
1126
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1089
1127
|
const o = r._zod.bag;
|
|
1090
1128
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1099,12 +1137,12 @@ const rr = (e) => {
|
|
|
1099
1137
|
continue: !t.abort
|
|
1100
1138
|
});
|
|
1101
1139
|
};
|
|
1102
|
-
}),
|
|
1103
|
-
|
|
1140
|
+
}), jr = /* @__PURE__ */ a("$ZodCheckOverwrite", (e, t) => {
|
|
1141
|
+
O.init(e, t), e._zod.check = (n) => {
|
|
1104
1142
|
n.value = t.tx(n.value);
|
|
1105
1143
|
};
|
|
1106
1144
|
});
|
|
1107
|
-
class
|
|
1145
|
+
class Ar {
|
|
1108
1146
|
constructor(t = []) {
|
|
1109
1147
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1110
1148
|
}
|
|
@@ -1117,9 +1155,9 @@ class kr {
|
|
|
1117
1155
|
return;
|
|
1118
1156
|
}
|
|
1119
1157
|
const r = t.split(`
|
|
1120
|
-
`).filter((
|
|
1121
|
-
for (const
|
|
1122
|
-
this.content.push(
|
|
1158
|
+
`).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
|
|
1159
|
+
for (const s of i)
|
|
1160
|
+
this.content.push(s);
|
|
1123
1161
|
}
|
|
1124
1162
|
compile() {
|
|
1125
1163
|
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
|
|
@@ -1127,13 +1165,13 @@ class kr {
|
|
|
1127
1165
|
`));
|
|
1128
1166
|
}
|
|
1129
1167
|
}
|
|
1130
|
-
const
|
|
1168
|
+
const Cr = {
|
|
1131
1169
|
major: 4,
|
|
1132
1170
|
minor: 1,
|
|
1133
1171
|
patch: 11
|
|
1134
|
-
},
|
|
1172
|
+
}, S = /* @__PURE__ */ a("$ZodType", (e, t) => {
|
|
1135
1173
|
var n;
|
|
1136
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
1174
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Cr;
|
|
1137
1175
|
const r = [...e._zod.def.checks ?? []];
|
|
1138
1176
|
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
1139
1177
|
for (const o of r)
|
|
@@ -1144,69 +1182,69 @@ const zr = {
|
|
|
1144
1182
|
e._zod.run = e._zod.parse;
|
|
1145
1183
|
});
|
|
1146
1184
|
else {
|
|
1147
|
-
const o = (
|
|
1148
|
-
let
|
|
1149
|
-
for (const
|
|
1150
|
-
if (
|
|
1151
|
-
if (!
|
|
1185
|
+
const o = (s, c, d) => {
|
|
1186
|
+
let l = J(s), f;
|
|
1187
|
+
for (const h of c) {
|
|
1188
|
+
if (h._zod.def.when) {
|
|
1189
|
+
if (!h._zod.def.when(s))
|
|
1152
1190
|
continue;
|
|
1153
|
-
} else if (
|
|
1191
|
+
} else if (l)
|
|
1154
1192
|
continue;
|
|
1155
|
-
const p =
|
|
1156
|
-
if (
|
|
1157
|
-
throw new
|
|
1158
|
-
if (
|
|
1159
|
-
|
|
1160
|
-
await
|
|
1193
|
+
const p = s.issues.length, g = h._zod.check(s);
|
|
1194
|
+
if (g instanceof Promise && d?.async === !1)
|
|
1195
|
+
throw new G();
|
|
1196
|
+
if (f || g instanceof Promise)
|
|
1197
|
+
f = (f ?? Promise.resolve()).then(async () => {
|
|
1198
|
+
await g, s.issues.length !== p && (l || (l = J(s, p)));
|
|
1161
1199
|
});
|
|
1162
1200
|
else {
|
|
1163
|
-
if (
|
|
1201
|
+
if (s.issues.length === p)
|
|
1164
1202
|
continue;
|
|
1165
|
-
|
|
1203
|
+
l || (l = J(s, p));
|
|
1166
1204
|
}
|
|
1167
1205
|
}
|
|
1168
|
-
return
|
|
1169
|
-
}, i = (
|
|
1170
|
-
if (
|
|
1171
|
-
return
|
|
1172
|
-
const
|
|
1173
|
-
if (
|
|
1174
|
-
if (
|
|
1175
|
-
throw new
|
|
1176
|
-
return
|
|
1206
|
+
return f ? f.then(() => s) : s;
|
|
1207
|
+
}, i = (s, c, d) => {
|
|
1208
|
+
if (J(s))
|
|
1209
|
+
return s.aborted = !0, s;
|
|
1210
|
+
const l = o(c, r, d);
|
|
1211
|
+
if (l instanceof Promise) {
|
|
1212
|
+
if (d.async === !1)
|
|
1213
|
+
throw new G();
|
|
1214
|
+
return l.then((f) => e._zod.parse(f, d));
|
|
1177
1215
|
}
|
|
1178
|
-
return e._zod.parse(
|
|
1216
|
+
return e._zod.parse(l, d);
|
|
1179
1217
|
};
|
|
1180
|
-
e._zod.run = (
|
|
1181
|
-
if (
|
|
1182
|
-
return e._zod.parse(
|
|
1183
|
-
if (
|
|
1184
|
-
const
|
|
1185
|
-
return
|
|
1218
|
+
e._zod.run = (s, c) => {
|
|
1219
|
+
if (c.skipChecks)
|
|
1220
|
+
return e._zod.parse(s, c);
|
|
1221
|
+
if (c.direction === "backward") {
|
|
1222
|
+
const l = e._zod.parse({ value: s.value, issues: [] }, { ...c, skipChecks: !0 });
|
|
1223
|
+
return l instanceof Promise ? l.then((f) => i(f, s, c)) : i(l, s, c);
|
|
1186
1224
|
}
|
|
1187
|
-
const
|
|
1188
|
-
if (
|
|
1189
|
-
if (
|
|
1190
|
-
throw new
|
|
1191
|
-
return
|
|
1225
|
+
const d = e._zod.parse(s, c);
|
|
1226
|
+
if (d instanceof Promise) {
|
|
1227
|
+
if (c.async === !1)
|
|
1228
|
+
throw new G();
|
|
1229
|
+
return d.then((l) => o(l, r, c));
|
|
1192
1230
|
}
|
|
1193
|
-
return o(
|
|
1231
|
+
return o(d, r, c);
|
|
1194
1232
|
};
|
|
1195
1233
|
}
|
|
1196
1234
|
e["~standard"] = {
|
|
1197
1235
|
validate: (o) => {
|
|
1198
1236
|
try {
|
|
1199
|
-
const i =
|
|
1237
|
+
const i = Nn(e, o);
|
|
1200
1238
|
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
1201
1239
|
} catch {
|
|
1202
|
-
return
|
|
1240
|
+
return Dn(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
1203
1241
|
}
|
|
1204
1242
|
},
|
|
1205
1243
|
vendor: "zod",
|
|
1206
1244
|
version: 1
|
|
1207
1245
|
};
|
|
1208
|
-
}),
|
|
1209
|
-
|
|
1246
|
+
}), Ne = /* @__PURE__ */ a("$ZodString", (e, t) => {
|
|
1247
|
+
S.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? mr(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1210
1248
|
if (t.coerce)
|
|
1211
1249
|
try {
|
|
1212
1250
|
n.value = String(n.value);
|
|
@@ -1219,11 +1257,11 @@ const zr = {
|
|
|
1219
1257
|
inst: e
|
|
1220
1258
|
}), n;
|
|
1221
1259
|
};
|
|
1222
|
-
}),
|
|
1223
|
-
|
|
1224
|
-
}),
|
|
1225
|
-
t.pattern ?? (t.pattern =
|
|
1226
|
-
}),
|
|
1260
|
+
}), y = /* @__PURE__ */ a("$ZodStringFormat", (e, t) => {
|
|
1261
|
+
ge.init(e, t), Ne.init(e, t);
|
|
1262
|
+
}), Or = /* @__PURE__ */ a("$ZodGUID", (e, t) => {
|
|
1263
|
+
t.pattern ?? (t.pattern = er), y.init(e, t);
|
|
1264
|
+
}), Rr = /* @__PURE__ */ a("$ZodUUID", (e, t) => {
|
|
1227
1265
|
if (t.version) {
|
|
1228
1266
|
const r = {
|
|
1229
1267
|
v1: 1,
|
|
@@ -1237,21 +1275,21 @@ const zr = {
|
|
|
1237
1275
|
}[t.version];
|
|
1238
1276
|
if (r === void 0)
|
|
1239
1277
|
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1240
|
-
t.pattern ?? (t.pattern =
|
|
1278
|
+
t.pattern ?? (t.pattern = qe(r));
|
|
1241
1279
|
} else
|
|
1242
|
-
t.pattern ?? (t.pattern =
|
|
1243
|
-
|
|
1244
|
-
}),
|
|
1245
|
-
t.pattern ?? (t.pattern =
|
|
1246
|
-
}),
|
|
1247
|
-
|
|
1280
|
+
t.pattern ?? (t.pattern = qe());
|
|
1281
|
+
y.init(e, t);
|
|
1282
|
+
}), Pr = /* @__PURE__ */ a("$ZodEmail", (e, t) => {
|
|
1283
|
+
t.pattern ?? (t.pattern = tr), y.init(e, t);
|
|
1284
|
+
}), Nr = /* @__PURE__ */ a("$ZodURL", (e, t) => {
|
|
1285
|
+
y.init(e, t), e._zod.check = (n) => {
|
|
1248
1286
|
try {
|
|
1249
1287
|
const r = n.value.trim(), o = new URL(r);
|
|
1250
1288
|
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
|
|
1251
1289
|
code: "invalid_format",
|
|
1252
1290
|
format: "url",
|
|
1253
1291
|
note: "Invalid hostname",
|
|
1254
|
-
pattern:
|
|
1292
|
+
pattern: ur.source,
|
|
1255
1293
|
input: n.value,
|
|
1256
1294
|
inst: e,
|
|
1257
1295
|
continue: !t.abort
|
|
@@ -1275,35 +1313,35 @@ const zr = {
|
|
|
1275
1313
|
});
|
|
1276
1314
|
}
|
|
1277
1315
|
};
|
|
1278
|
-
}),
|
|
1279
|
-
t.pattern ?? (t.pattern =
|
|
1280
|
-
}),
|
|
1281
|
-
t.pattern ?? (t.pattern =
|
|
1282
|
-
}),
|
|
1283
|
-
t.pattern ?? (t.pattern =
|
|
1284
|
-
}),
|
|
1285
|
-
t.pattern ?? (t.pattern =
|
|
1286
|
-
}),
|
|
1287
|
-
t.pattern ?? (t.pattern =
|
|
1288
|
-
}),
|
|
1289
|
-
t.pattern ?? (t.pattern =
|
|
1290
|
-
}),
|
|
1291
|
-
t.pattern ?? (t.pattern =
|
|
1292
|
-
}),
|
|
1293
|
-
t.pattern ?? (t.pattern =
|
|
1294
|
-
}),
|
|
1295
|
-
t.pattern ?? (t.pattern =
|
|
1296
|
-
}),
|
|
1297
|
-
t.pattern ?? (t.pattern =
|
|
1298
|
-
}),
|
|
1299
|
-
t.pattern ?? (t.pattern =
|
|
1300
|
-
}),
|
|
1301
|
-
t.pattern ?? (t.pattern =
|
|
1316
|
+
}), Dr = /* @__PURE__ */ a("$ZodEmoji", (e, t) => {
|
|
1317
|
+
t.pattern ?? (t.pattern = rr()), y.init(e, t);
|
|
1318
|
+
}), Ur = /* @__PURE__ */ a("$ZodNanoID", (e, t) => {
|
|
1319
|
+
t.pattern ?? (t.pattern = Kn), y.init(e, t);
|
|
1320
|
+
}), Fr = /* @__PURE__ */ a("$ZodCUID", (e, t) => {
|
|
1321
|
+
t.pattern ?? (t.pattern = Hn), y.init(e, t);
|
|
1322
|
+
}), Lr = /* @__PURE__ */ a("$ZodCUID2", (e, t) => {
|
|
1323
|
+
t.pattern ?? (t.pattern = Jn), y.init(e, t);
|
|
1324
|
+
}), Mr = /* @__PURE__ */ a("$ZodULID", (e, t) => {
|
|
1325
|
+
t.pattern ?? (t.pattern = Gn), y.init(e, t);
|
|
1326
|
+
}), Vr = /* @__PURE__ */ a("$ZodXID", (e, t) => {
|
|
1327
|
+
t.pattern ?? (t.pattern = qn), y.init(e, t);
|
|
1328
|
+
}), Wr = /* @__PURE__ */ a("$ZodKSUID", (e, t) => {
|
|
1329
|
+
t.pattern ?? (t.pattern = Xn), y.init(e, t);
|
|
1330
|
+
}), Br = /* @__PURE__ */ a("$ZodISODateTime", (e, t) => {
|
|
1331
|
+
t.pattern ?? (t.pattern = hr(t)), y.init(e, t);
|
|
1332
|
+
}), Yr = /* @__PURE__ */ a("$ZodISODate", (e, t) => {
|
|
1333
|
+
t.pattern ?? (t.pattern = dr), y.init(e, t);
|
|
1334
|
+
}), Hr = /* @__PURE__ */ a("$ZodISOTime", (e, t) => {
|
|
1335
|
+
t.pattern ?? (t.pattern = fr(t)), y.init(e, t);
|
|
1336
|
+
}), Jr = /* @__PURE__ */ a("$ZodISODuration", (e, t) => {
|
|
1337
|
+
t.pattern ?? (t.pattern = Qn), y.init(e, t);
|
|
1338
|
+
}), Gr = /* @__PURE__ */ a("$ZodIPv4", (e, t) => {
|
|
1339
|
+
t.pattern ?? (t.pattern = or), y.init(e, t), e._zod.onattach.push((n) => {
|
|
1302
1340
|
const r = n._zod.bag;
|
|
1303
1341
|
r.format = "ipv4";
|
|
1304
1342
|
});
|
|
1305
|
-
}),
|
|
1306
|
-
t.pattern ?? (t.pattern =
|
|
1343
|
+
}), qr = /* @__PURE__ */ a("$ZodIPv6", (e, t) => {
|
|
1344
|
+
t.pattern ?? (t.pattern = ir), y.init(e, t), e._zod.onattach.push((n) => {
|
|
1307
1345
|
const r = n._zod.bag;
|
|
1308
1346
|
r.format = "ipv6";
|
|
1309
1347
|
}), e._zod.check = (n) => {
|
|
@@ -1319,10 +1357,10 @@ const zr = {
|
|
|
1319
1357
|
});
|
|
1320
1358
|
}
|
|
1321
1359
|
};
|
|
1322
|
-
}),
|
|
1323
|
-
t.pattern ?? (t.pattern =
|
|
1324
|
-
}),
|
|
1325
|
-
t.pattern ?? (t.pattern =
|
|
1360
|
+
}), Xr = /* @__PURE__ */ a("$ZodCIDRv4", (e, t) => {
|
|
1361
|
+
t.pattern ?? (t.pattern = sr), y.init(e, t);
|
|
1362
|
+
}), Kr = /* @__PURE__ */ a("$ZodCIDRv6", (e, t) => {
|
|
1363
|
+
t.pattern ?? (t.pattern = cr), y.init(e, t), e._zod.check = (n) => {
|
|
1326
1364
|
const r = n.value.split("/");
|
|
1327
1365
|
try {
|
|
1328
1366
|
if (r.length !== 2)
|
|
@@ -1330,10 +1368,10 @@ const zr = {
|
|
|
1330
1368
|
const [o, i] = r;
|
|
1331
1369
|
if (!i)
|
|
1332
1370
|
throw new Error();
|
|
1333
|
-
const
|
|
1334
|
-
if (`${
|
|
1371
|
+
const s = Number(i);
|
|
1372
|
+
if (`${s}` !== i)
|
|
1335
1373
|
throw new Error();
|
|
1336
|
-
if (
|
|
1374
|
+
if (s < 0 || s > 128)
|
|
1337
1375
|
throw new Error();
|
|
1338
1376
|
new URL(`http://[${o}]`);
|
|
1339
1377
|
} catch {
|
|
@@ -1347,7 +1385,7 @@ const zr = {
|
|
|
1347
1385
|
}
|
|
1348
1386
|
};
|
|
1349
1387
|
});
|
|
1350
|
-
function
|
|
1388
|
+
function Ot(e) {
|
|
1351
1389
|
if (e === "")
|
|
1352
1390
|
return !0;
|
|
1353
1391
|
if (e.length % 4 !== 0)
|
|
@@ -1358,11 +1396,11 @@ function $t(e) {
|
|
|
1358
1396
|
return !1;
|
|
1359
1397
|
}
|
|
1360
1398
|
}
|
|
1361
|
-
const
|
|
1362
|
-
t.pattern ?? (t.pattern =
|
|
1399
|
+
const Qr = /* @__PURE__ */ a("$ZodBase64", (e, t) => {
|
|
1400
|
+
t.pattern ?? (t.pattern = ar), y.init(e, t), e._zod.onattach.push((n) => {
|
|
1363
1401
|
n._zod.bag.contentEncoding = "base64";
|
|
1364
1402
|
}), e._zod.check = (n) => {
|
|
1365
|
-
|
|
1403
|
+
Ot(n.value) || n.issues.push({
|
|
1366
1404
|
code: "invalid_format",
|
|
1367
1405
|
format: "base64",
|
|
1368
1406
|
input: n.value,
|
|
@@ -1371,17 +1409,17 @@ const Mr = /* @__PURE__ */ s("$ZodBase64", (e, t) => {
|
|
|
1371
1409
|
});
|
|
1372
1410
|
};
|
|
1373
1411
|
});
|
|
1374
|
-
function
|
|
1375
|
-
if (!
|
|
1412
|
+
function eo(e) {
|
|
1413
|
+
if (!Tt.test(e))
|
|
1376
1414
|
return !1;
|
|
1377
1415
|
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1378
|
-
return
|
|
1416
|
+
return Ot(n);
|
|
1379
1417
|
}
|
|
1380
|
-
const
|
|
1381
|
-
t.pattern ?? (t.pattern =
|
|
1418
|
+
const to = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => {
|
|
1419
|
+
t.pattern ?? (t.pattern = Tt), y.init(e, t), e._zod.onattach.push((n) => {
|
|
1382
1420
|
n._zod.bag.contentEncoding = "base64url";
|
|
1383
1421
|
}), e._zod.check = (n) => {
|
|
1384
|
-
|
|
1422
|
+
eo(n.value) || n.issues.push({
|
|
1385
1423
|
code: "invalid_format",
|
|
1386
1424
|
format: "base64url",
|
|
1387
1425
|
input: n.value,
|
|
@@ -1389,10 +1427,10 @@ const Wr = /* @__PURE__ */ s("$ZodBase64URL", (e, t) => {
|
|
|
1389
1427
|
continue: !t.abort
|
|
1390
1428
|
});
|
|
1391
1429
|
};
|
|
1392
|
-
}),
|
|
1393
|
-
t.pattern ?? (t.pattern =
|
|
1430
|
+
}), no = /* @__PURE__ */ a("$ZodE164", (e, t) => {
|
|
1431
|
+
t.pattern ?? (t.pattern = lr), y.init(e, t);
|
|
1394
1432
|
});
|
|
1395
|
-
function
|
|
1433
|
+
function ro(e, t = null) {
|
|
1396
1434
|
try {
|
|
1397
1435
|
const n = e.split(".");
|
|
1398
1436
|
if (n.length !== 3)
|
|
@@ -1406,9 +1444,9 @@ function Yr(e, t = null) {
|
|
|
1406
1444
|
return !1;
|
|
1407
1445
|
}
|
|
1408
1446
|
}
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
|
|
1447
|
+
const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
1448
|
+
y.init(e, t), e._zod.check = (n) => {
|
|
1449
|
+
ro(n.value, t.alg) || n.issues.push({
|
|
1412
1450
|
code: "invalid_format",
|
|
1413
1451
|
format: "jwt",
|
|
1414
1452
|
input: n.value,
|
|
@@ -1416,8 +1454,8 @@ const Jr = /* @__PURE__ */ s("$ZodJWT", (e, t) => {
|
|
|
1416
1454
|
continue: !t.abort
|
|
1417
1455
|
});
|
|
1418
1456
|
};
|
|
1419
|
-
}),
|
|
1420
|
-
|
|
1457
|
+
}), Rt = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1458
|
+
S.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? gr, e._zod.parse = (n, r) => {
|
|
1421
1459
|
if (t.coerce)
|
|
1422
1460
|
try {
|
|
1423
1461
|
n.value = Number(n.value);
|
|
@@ -1435,10 +1473,10 @@ const Jr = /* @__PURE__ */ s("$ZodJWT", (e, t) => {
|
|
|
1435
1473
|
...i ? { received: i } : {}
|
|
1436
1474
|
}), n;
|
|
1437
1475
|
};
|
|
1438
|
-
}),
|
|
1439
|
-
|
|
1440
|
-
}),
|
|
1441
|
-
|
|
1476
|
+
}), io = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1477
|
+
kr.init(e, t), Rt.init(e, t);
|
|
1478
|
+
}), so = /* @__PURE__ */ a("$ZodBoolean", (e, t) => {
|
|
1479
|
+
S.init(e, t), e._zod.pattern = _r, e._zod.parse = (n, r) => {
|
|
1442
1480
|
if (t.coerce)
|
|
1443
1481
|
try {
|
|
1444
1482
|
n.value = !!n.value;
|
|
@@ -1452,21 +1490,21 @@ const Jr = /* @__PURE__ */ s("$ZodJWT", (e, t) => {
|
|
|
1452
1490
|
inst: e
|
|
1453
1491
|
}), n;
|
|
1454
1492
|
};
|
|
1455
|
-
}),
|
|
1456
|
-
|
|
1457
|
-
}),
|
|
1458
|
-
|
|
1493
|
+
}), co = /* @__PURE__ */ a("$ZodUnknown", (e, t) => {
|
|
1494
|
+
S.init(e, t), e._zod.parse = (n) => n;
|
|
1495
|
+
}), ao = /* @__PURE__ */ a("$ZodNever", (e, t) => {
|
|
1496
|
+
S.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
|
|
1459
1497
|
expected: "never",
|
|
1460
1498
|
code: "invalid_type",
|
|
1461
1499
|
input: n.value,
|
|
1462
1500
|
inst: e
|
|
1463
1501
|
}), n);
|
|
1464
1502
|
});
|
|
1465
|
-
function
|
|
1466
|
-
e.issues.length && t.issues.push(
|
|
1503
|
+
function Xe(e, t, n) {
|
|
1504
|
+
e.issues.length && t.issues.push(...$t(n, e.issues)), t.value[n] = e.value;
|
|
1467
1505
|
}
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1506
|
+
const uo = /* @__PURE__ */ a("$ZodArray", (e, t) => {
|
|
1507
|
+
S.init(e, t), e._zod.parse = (n, r) => {
|
|
1470
1508
|
const o = n.value;
|
|
1471
1509
|
if (!Array.isArray(o))
|
|
1472
1510
|
return n.issues.push({
|
|
@@ -1477,25 +1515,25 @@ const Kr = /* @__PURE__ */ s("$ZodArray", (e, t) => {
|
|
|
1477
1515
|
}), n;
|
|
1478
1516
|
n.value = Array(o.length);
|
|
1479
1517
|
const i = [];
|
|
1480
|
-
for (let
|
|
1481
|
-
const
|
|
1482
|
-
value:
|
|
1518
|
+
for (let s = 0; s < o.length; s++) {
|
|
1519
|
+
const c = o[s], d = t.element._zod.run({
|
|
1520
|
+
value: c,
|
|
1483
1521
|
issues: []
|
|
1484
1522
|
}, r);
|
|
1485
|
-
|
|
1523
|
+
d instanceof Promise ? i.push(d.then((l) => Xe(l, n, s))) : Xe(d, n, s);
|
|
1486
1524
|
}
|
|
1487
1525
|
return i.length ? Promise.all(i).then(() => n) : n;
|
|
1488
1526
|
};
|
|
1489
1527
|
});
|
|
1490
|
-
function
|
|
1491
|
-
e.issues.length && t.issues.push(
|
|
1528
|
+
function de(e, t, n, r) {
|
|
1529
|
+
e.issues.length && t.issues.push(...$t(n, e.issues)), e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1492
1530
|
}
|
|
1493
|
-
function
|
|
1531
|
+
function Pt(e) {
|
|
1494
1532
|
const t = Object.keys(e.shape);
|
|
1495
1533
|
for (const r of t)
|
|
1496
1534
|
if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
1497
1535
|
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
1498
|
-
const n =
|
|
1536
|
+
const n = En(e.shape);
|
|
1499
1537
|
return {
|
|
1500
1538
|
...e,
|
|
1501
1539
|
keys: t,
|
|
@@ -1504,186 +1542,186 @@ function Et(e) {
|
|
|
1504
1542
|
optionalKeys: new Set(n)
|
|
1505
1543
|
};
|
|
1506
1544
|
}
|
|
1507
|
-
function
|
|
1508
|
-
const
|
|
1509
|
-
for (const
|
|
1510
|
-
if (
|
|
1545
|
+
function Nt(e, t, n, r, o, i) {
|
|
1546
|
+
const s = [], c = o.keySet, d = o.catchall._zod, l = d.def.type;
|
|
1547
|
+
for (const f of Object.keys(t)) {
|
|
1548
|
+
if (c.has(f))
|
|
1511
1549
|
continue;
|
|
1512
|
-
if (
|
|
1513
|
-
|
|
1550
|
+
if (l === "never") {
|
|
1551
|
+
s.push(f);
|
|
1514
1552
|
continue;
|
|
1515
1553
|
}
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1554
|
+
const h = d.run({ value: t[f], issues: [] }, r);
|
|
1555
|
+
h instanceof Promise ? e.push(h.then((p) => de(p, n, f, t))) : de(h, n, f, t);
|
|
1518
1556
|
}
|
|
1519
|
-
return
|
|
1557
|
+
return s.length && n.issues.push({
|
|
1520
1558
|
code: "unrecognized_keys",
|
|
1521
|
-
keys:
|
|
1559
|
+
keys: s,
|
|
1522
1560
|
input: t,
|
|
1523
1561
|
inst: i
|
|
1524
1562
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1525
1563
|
}
|
|
1526
|
-
const
|
|
1527
|
-
if (
|
|
1528
|
-
const
|
|
1564
|
+
const lo = /* @__PURE__ */ a("$ZodObject", (e, t) => {
|
|
1565
|
+
if (S.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1566
|
+
const c = t.shape;
|
|
1529
1567
|
Object.defineProperty(t, "shape", {
|
|
1530
1568
|
get: () => {
|
|
1531
|
-
const
|
|
1569
|
+
const d = { ...c };
|
|
1532
1570
|
return Object.defineProperty(t, "shape", {
|
|
1533
|
-
value:
|
|
1534
|
-
}),
|
|
1571
|
+
value: d
|
|
1572
|
+
}), d;
|
|
1535
1573
|
}
|
|
1536
1574
|
});
|
|
1537
1575
|
}
|
|
1538
|
-
const r =
|
|
1539
|
-
|
|
1540
|
-
const
|
|
1541
|
-
for (const
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1545
|
-
for (const
|
|
1546
|
-
|
|
1576
|
+
const r = je(() => Pt(t));
|
|
1577
|
+
w(e._zod, "propValues", () => {
|
|
1578
|
+
const c = t.shape, d = {};
|
|
1579
|
+
for (const l in c) {
|
|
1580
|
+
const f = c[l]._zod;
|
|
1581
|
+
if (f.values) {
|
|
1582
|
+
d[l] ?? (d[l] = /* @__PURE__ */ new Set());
|
|
1583
|
+
for (const h of f.values)
|
|
1584
|
+
d[l].add(h);
|
|
1547
1585
|
}
|
|
1548
1586
|
}
|
|
1549
|
-
return
|
|
1550
|
-
});
|
|
1551
|
-
const o =
|
|
1552
|
-
let
|
|
1553
|
-
e._zod.parse = (
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1556
|
-
if (!o(
|
|
1557
|
-
return
|
|
1587
|
+
return d;
|
|
1588
|
+
});
|
|
1589
|
+
const o = le, i = t.catchall;
|
|
1590
|
+
let s;
|
|
1591
|
+
e._zod.parse = (c, d) => {
|
|
1592
|
+
s ?? (s = r.value);
|
|
1593
|
+
const l = c.value;
|
|
1594
|
+
if (!o(l))
|
|
1595
|
+
return c.issues.push({
|
|
1558
1596
|
expected: "object",
|
|
1559
1597
|
code: "invalid_type",
|
|
1560
|
-
input:
|
|
1598
|
+
input: l,
|
|
1561
1599
|
inst: e
|
|
1562
|
-
}),
|
|
1563
|
-
|
|
1564
|
-
const
|
|
1565
|
-
for (const p of
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1600
|
+
}), c;
|
|
1601
|
+
c.value = {};
|
|
1602
|
+
const f = [], h = s.shape;
|
|
1603
|
+
for (const p of s.keys) {
|
|
1604
|
+
const T = h[p]._zod.run({ value: l[p], issues: [] }, d);
|
|
1605
|
+
T instanceof Promise ? f.push(T.then((b) => de(b, c, p, l))) : de(T, c, p, l);
|
|
1568
1606
|
}
|
|
1569
|
-
return i ?
|
|
1607
|
+
return i ? Nt(f, l, c, d, r.value, e) : f.length ? Promise.all(f).then(() => c) : c;
|
|
1570
1608
|
};
|
|
1571
|
-
}),
|
|
1572
|
-
|
|
1573
|
-
const n = e._zod.parse, r =
|
|
1574
|
-
const
|
|
1575
|
-
const
|
|
1576
|
-
return `shape[${
|
|
1609
|
+
}), fo = /* @__PURE__ */ a("$ZodObjectJIT", (e, t) => {
|
|
1610
|
+
lo.init(e, t);
|
|
1611
|
+
const n = e._zod.parse, r = je(() => Pt(t)), o = (p) => {
|
|
1612
|
+
const g = new Ar(["shape", "payload", "ctx"]), T = r.value, b = ($) => {
|
|
1613
|
+
const z = Ge($);
|
|
1614
|
+
return `shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`;
|
|
1577
1615
|
};
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
let
|
|
1581
|
-
for (const
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
for (const
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1587
|
-
if (${
|
|
1588
|
-
payload.issues = payload.issues.concat(${
|
|
1616
|
+
g.write("const input = payload.value;");
|
|
1617
|
+
const C = /* @__PURE__ */ Object.create(null);
|
|
1618
|
+
let N = 0;
|
|
1619
|
+
for (const $ of T.keys)
|
|
1620
|
+
C[$] = `key_${N++}`;
|
|
1621
|
+
g.write("const newResult = {};");
|
|
1622
|
+
for (const $ of T.keys) {
|
|
1623
|
+
const z = C[$], P = Ge($);
|
|
1624
|
+
g.write(`const ${z} = ${b($)};`), g.write(`
|
|
1625
|
+
if (${z}.issues.length) {
|
|
1626
|
+
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
1589
1627
|
...iss,
|
|
1590
|
-
path: iss.path ? [${
|
|
1628
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
1591
1629
|
})));
|
|
1592
1630
|
}
|
|
1593
1631
|
|
|
1594
1632
|
|
|
1595
|
-
if (${
|
|
1596
|
-
if (${
|
|
1597
|
-
newResult[${
|
|
1633
|
+
if (${z}.value === undefined) {
|
|
1634
|
+
if (${P} in input) {
|
|
1635
|
+
newResult[${P}] = undefined;
|
|
1598
1636
|
}
|
|
1599
1637
|
} else {
|
|
1600
|
-
newResult[${
|
|
1638
|
+
newResult[${P}] = ${z}.value;
|
|
1601
1639
|
}
|
|
1602
1640
|
|
|
1603
1641
|
`);
|
|
1604
1642
|
}
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1607
|
-
return (
|
|
1643
|
+
g.write("payload.value = newResult;"), g.write("return payload;");
|
|
1644
|
+
const k = g.compile();
|
|
1645
|
+
return ($, z) => k(p, $, z);
|
|
1608
1646
|
};
|
|
1609
1647
|
let i;
|
|
1610
|
-
const
|
|
1611
|
-
let
|
|
1612
|
-
e._zod.parse = (p,
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1615
|
-
return
|
|
1648
|
+
const s = le, c = !kt.jitless, l = c && $n.value, f = t.catchall;
|
|
1649
|
+
let h;
|
|
1650
|
+
e._zod.parse = (p, g) => {
|
|
1651
|
+
h ?? (h = r.value);
|
|
1652
|
+
const T = p.value;
|
|
1653
|
+
return s(T) ? c && l && g?.async === !1 && g.jitless !== !0 ? (i || (i = o(t.shape)), p = i(p, g), f ? Nt([], T, p, g, h, e) : p) : n(p, g) : (p.issues.push({
|
|
1616
1654
|
expected: "object",
|
|
1617
1655
|
code: "invalid_type",
|
|
1618
|
-
input:
|
|
1656
|
+
input: T,
|
|
1619
1657
|
inst: e
|
|
1620
1658
|
}), p);
|
|
1621
1659
|
};
|
|
1622
1660
|
});
|
|
1623
|
-
function
|
|
1661
|
+
function Ke(e, t, n, r) {
|
|
1624
1662
|
for (const i of e)
|
|
1625
1663
|
if (i.issues.length === 0)
|
|
1626
1664
|
return t.value = i.value, t;
|
|
1627
|
-
const o = e.filter((i) => !
|
|
1665
|
+
const o = e.filter((i) => !J(i));
|
|
1628
1666
|
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
1629
1667
|
code: "invalid_union",
|
|
1630
1668
|
input: t.value,
|
|
1631
1669
|
inst: n,
|
|
1632
|
-
errors: e.map((i) => i.issues.map((
|
|
1670
|
+
errors: e.map((i) => i.issues.map((s) => V(s, r, M())))
|
|
1633
1671
|
}), t);
|
|
1634
1672
|
}
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1673
|
+
const ho = /* @__PURE__ */ a("$ZodUnion", (e, t) => {
|
|
1674
|
+
S.init(e, t), w(e._zod, "optin", () => t.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), w(e._zod, "optout", () => t.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), w(e._zod, "values", () => {
|
|
1637
1675
|
if (t.options.every((o) => o._zod.values))
|
|
1638
1676
|
return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
|
|
1639
|
-
}),
|
|
1677
|
+
}), w(e._zod, "pattern", () => {
|
|
1640
1678
|
if (t.options.every((o) => o._zod.pattern)) {
|
|
1641
1679
|
const o = t.options.map((i) => i._zod.pattern);
|
|
1642
|
-
return new RegExp(`^(${o.map((i) =>
|
|
1680
|
+
return new RegExp(`^(${o.map((i) => Ce(i.source)).join("|")})$`);
|
|
1643
1681
|
}
|
|
1644
1682
|
});
|
|
1645
1683
|
const n = t.options.length === 1, r = t.options[0]._zod.run;
|
|
1646
1684
|
e._zod.parse = (o, i) => {
|
|
1647
1685
|
if (n)
|
|
1648
1686
|
return r(o, i);
|
|
1649
|
-
let
|
|
1650
|
-
const
|
|
1651
|
-
for (const
|
|
1652
|
-
const
|
|
1687
|
+
let s = !1;
|
|
1688
|
+
const c = [];
|
|
1689
|
+
for (const d of t.options) {
|
|
1690
|
+
const l = d._zod.run({
|
|
1653
1691
|
value: o.value,
|
|
1654
1692
|
issues: []
|
|
1655
1693
|
}, i);
|
|
1656
|
-
if (
|
|
1657
|
-
|
|
1694
|
+
if (l instanceof Promise)
|
|
1695
|
+
c.push(l), s = !0;
|
|
1658
1696
|
else {
|
|
1659
|
-
if (
|
|
1660
|
-
return
|
|
1661
|
-
|
|
1697
|
+
if (l.issues.length === 0)
|
|
1698
|
+
return l;
|
|
1699
|
+
c.push(l);
|
|
1662
1700
|
}
|
|
1663
1701
|
}
|
|
1664
|
-
return
|
|
1702
|
+
return s ? Promise.all(c).then((d) => Ke(d, o, e, i)) : Ke(c, o, e, i);
|
|
1665
1703
|
};
|
|
1666
|
-
}),
|
|
1667
|
-
|
|
1668
|
-
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r),
|
|
1669
|
-
return i instanceof Promise ||
|
|
1704
|
+
}), mo = /* @__PURE__ */ a("$ZodIntersection", (e, t) => {
|
|
1705
|
+
S.init(e, t), e._zod.parse = (n, r) => {
|
|
1706
|
+
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), s = t.right._zod.run({ value: o, issues: [] }, r);
|
|
1707
|
+
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([d, l]) => Qe(n, d, l)) : Qe(n, i, s);
|
|
1670
1708
|
};
|
|
1671
1709
|
});
|
|
1672
|
-
function
|
|
1710
|
+
function xe(e, t) {
|
|
1673
1711
|
if (e === t)
|
|
1674
1712
|
return { valid: !0, data: e };
|
|
1675
1713
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
1676
1714
|
return { valid: !0, data: e };
|
|
1677
|
-
if (
|
|
1715
|
+
if (ee(e) && ee(t)) {
|
|
1678
1716
|
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
|
|
1679
1717
|
for (const i of r) {
|
|
1680
|
-
const
|
|
1681
|
-
if (!
|
|
1718
|
+
const s = xe(e[i], t[i]);
|
|
1719
|
+
if (!s.valid)
|
|
1682
1720
|
return {
|
|
1683
1721
|
valid: !1,
|
|
1684
|
-
mergeErrorPath: [i, ...
|
|
1722
|
+
mergeErrorPath: [i, ...s.mergeErrorPath]
|
|
1685
1723
|
};
|
|
1686
|
-
o[i] =
|
|
1724
|
+
o[i] = s.data;
|
|
1687
1725
|
}
|
|
1688
1726
|
return { valid: !0, data: o };
|
|
1689
1727
|
}
|
|
@@ -1692,94 +1730,94 @@ function be(e, t) {
|
|
|
1692
1730
|
return { valid: !1, mergeErrorPath: [] };
|
|
1693
1731
|
const n = [];
|
|
1694
1732
|
for (let r = 0; r < e.length; r++) {
|
|
1695
|
-
const o = e[r], i = t[r],
|
|
1696
|
-
if (!
|
|
1733
|
+
const o = e[r], i = t[r], s = xe(o, i);
|
|
1734
|
+
if (!s.valid)
|
|
1697
1735
|
return {
|
|
1698
1736
|
valid: !1,
|
|
1699
|
-
mergeErrorPath: [r, ...
|
|
1737
|
+
mergeErrorPath: [r, ...s.mergeErrorPath]
|
|
1700
1738
|
};
|
|
1701
|
-
n.push(
|
|
1739
|
+
n.push(s.data);
|
|
1702
1740
|
}
|
|
1703
1741
|
return { valid: !0, data: n };
|
|
1704
1742
|
}
|
|
1705
1743
|
return { valid: !1, mergeErrorPath: [] };
|
|
1706
1744
|
}
|
|
1707
|
-
function
|
|
1708
|
-
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues),
|
|
1745
|
+
function Qe(e, t, n) {
|
|
1746
|
+
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), J(e))
|
|
1709
1747
|
return e;
|
|
1710
|
-
const r =
|
|
1748
|
+
const r = xe(t.value, n.value);
|
|
1711
1749
|
if (!r.valid)
|
|
1712
1750
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
1713
1751
|
return e.value = r.data, e;
|
|
1714
1752
|
}
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
const n =
|
|
1718
|
-
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) =>
|
|
1719
|
-
const
|
|
1720
|
-
return r.has(
|
|
1753
|
+
const po = /* @__PURE__ */ a("$ZodEnum", (e, t) => {
|
|
1754
|
+
S.init(e, t);
|
|
1755
|
+
const n = zn(t.entries), r = new Set(n);
|
|
1756
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Zn.has(typeof o)).map((o) => typeof o == "string" ? he(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
1757
|
+
const s = o.value;
|
|
1758
|
+
return r.has(s) || o.issues.push({
|
|
1721
1759
|
code: "invalid_value",
|
|
1722
1760
|
values: n,
|
|
1723
|
-
input:
|
|
1761
|
+
input: s,
|
|
1724
1762
|
inst: e
|
|
1725
1763
|
}), o;
|
|
1726
1764
|
};
|
|
1727
|
-
}),
|
|
1728
|
-
|
|
1765
|
+
}), go = /* @__PURE__ */ a("$ZodTransform", (e, t) => {
|
|
1766
|
+
S.init(e, t), e._zod.parse = (n, r) => {
|
|
1729
1767
|
if (r.direction === "backward")
|
|
1730
|
-
throw new
|
|
1768
|
+
throw new wt(e.constructor.name);
|
|
1731
1769
|
const o = t.transform(n.value, n);
|
|
1732
1770
|
if (r.async)
|
|
1733
|
-
return (o instanceof Promise ? o : Promise.resolve(o)).then((
|
|
1771
|
+
return (o instanceof Promise ? o : Promise.resolve(o)).then((s) => (n.value = s, n));
|
|
1734
1772
|
if (o instanceof Promise)
|
|
1735
|
-
throw new
|
|
1773
|
+
throw new G();
|
|
1736
1774
|
return n.value = o, n;
|
|
1737
1775
|
};
|
|
1738
1776
|
});
|
|
1739
|
-
function
|
|
1777
|
+
function et(e, t) {
|
|
1740
1778
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
1741
1779
|
}
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1780
|
+
const _o = /* @__PURE__ */ a("$ZodOptional", (e, t) => {
|
|
1781
|
+
S.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", w(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), w(e._zod, "pattern", () => {
|
|
1744
1782
|
const n = t.innerType._zod.pattern;
|
|
1745
|
-
return n ? new RegExp(`^(${
|
|
1783
|
+
return n ? new RegExp(`^(${Ce(n.source)})?$`) : void 0;
|
|
1746
1784
|
}), e._zod.parse = (n, r) => {
|
|
1747
1785
|
if (t.innerType._zod.optin === "optional") {
|
|
1748
1786
|
const o = t.innerType._zod.run(n, r);
|
|
1749
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1787
|
+
return o instanceof Promise ? o.then((i) => et(i, n.value)) : et(o, n.value);
|
|
1750
1788
|
}
|
|
1751
1789
|
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
1752
1790
|
};
|
|
1753
|
-
}),
|
|
1754
|
-
|
|
1791
|
+
}), vo = /* @__PURE__ */ a("$ZodNullable", (e, t) => {
|
|
1792
|
+
S.init(e, t), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), w(e._zod, "pattern", () => {
|
|
1755
1793
|
const n = t.innerType._zod.pattern;
|
|
1756
|
-
return n ? new RegExp(`^(${
|
|
1757
|
-
}),
|
|
1758
|
-
}),
|
|
1759
|
-
|
|
1794
|
+
return n ? new RegExp(`^(${Ce(n.source)}|null)$`) : void 0;
|
|
1795
|
+
}), w(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, r) => n.value === null ? n : t.innerType._zod.run(n, r);
|
|
1796
|
+
}), bo = /* @__PURE__ */ a("$ZodDefault", (e, t) => {
|
|
1797
|
+
S.init(e, t), e._zod.optin = "optional", w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
1760
1798
|
if (r.direction === "backward")
|
|
1761
1799
|
return t.innerType._zod.run(n, r);
|
|
1762
1800
|
if (n.value === void 0)
|
|
1763
1801
|
return n.value = t.defaultValue, n;
|
|
1764
1802
|
const o = t.innerType._zod.run(n, r);
|
|
1765
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1803
|
+
return o instanceof Promise ? o.then((i) => tt(i, t)) : tt(o, t);
|
|
1766
1804
|
};
|
|
1767
1805
|
});
|
|
1768
|
-
function
|
|
1806
|
+
function tt(e, t) {
|
|
1769
1807
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
1770
1808
|
}
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
-
}),
|
|
1774
|
-
|
|
1809
|
+
const wo = /* @__PURE__ */ a("$ZodPrefault", (e, t) => {
|
|
1810
|
+
S.init(e, t), e._zod.optin = "optional", w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => (r.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, r));
|
|
1811
|
+
}), ko = /* @__PURE__ */ a("$ZodNonOptional", (e, t) => {
|
|
1812
|
+
S.init(e, t), w(e._zod, "values", () => {
|
|
1775
1813
|
const n = t.innerType._zod.values;
|
|
1776
1814
|
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
1777
1815
|
}), e._zod.parse = (n, r) => {
|
|
1778
1816
|
const o = t.innerType._zod.run(n, r);
|
|
1779
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1817
|
+
return o instanceof Promise ? o.then((i) => nt(i, e)) : nt(o, e);
|
|
1780
1818
|
};
|
|
1781
1819
|
});
|
|
1782
|
-
function
|
|
1820
|
+
function nt(e, t) {
|
|
1783
1821
|
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
1784
1822
|
code: "invalid_type",
|
|
1785
1823
|
expected: "nonoptional",
|
|
@@ -1787,58 +1825,58 @@ function Ge(e, t) {
|
|
|
1787
1825
|
inst: t
|
|
1788
1826
|
}), e;
|
|
1789
1827
|
}
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1828
|
+
const zo = /* @__PURE__ */ a("$ZodCatch", (e, t) => {
|
|
1829
|
+
S.init(e, t), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
1792
1830
|
if (r.direction === "backward")
|
|
1793
1831
|
return t.innerType._zod.run(n, r);
|
|
1794
1832
|
const o = t.innerType._zod.run(n, r);
|
|
1795
1833
|
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
1796
1834
|
...n,
|
|
1797
1835
|
error: {
|
|
1798
|
-
issues: i.issues.map((
|
|
1836
|
+
issues: i.issues.map((s) => V(s, r, M()))
|
|
1799
1837
|
},
|
|
1800
1838
|
input: n.value
|
|
1801
1839
|
}), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
1802
1840
|
...n,
|
|
1803
1841
|
error: {
|
|
1804
|
-
issues: o.issues.map((i) =>
|
|
1842
|
+
issues: o.issues.map((i) => V(i, r, M()))
|
|
1805
1843
|
},
|
|
1806
1844
|
input: n.value
|
|
1807
1845
|
}), n.issues = []), n);
|
|
1808
1846
|
};
|
|
1809
|
-
}),
|
|
1810
|
-
|
|
1847
|
+
}), yo = /* @__PURE__ */ a("$ZodPipe", (e, t) => {
|
|
1848
|
+
S.init(e, t), w(e._zod, "values", () => t.in._zod.values), w(e._zod, "optin", () => t.in._zod.optin), w(e._zod, "optout", () => t.out._zod.optout), w(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
|
|
1811
1849
|
if (r.direction === "backward") {
|
|
1812
1850
|
const i = t.out._zod.run(n, r);
|
|
1813
|
-
return i instanceof Promise ? i.then((
|
|
1851
|
+
return i instanceof Promise ? i.then((s) => se(s, t.in, r)) : se(i, t.in, r);
|
|
1814
1852
|
}
|
|
1815
1853
|
const o = t.in._zod.run(n, r);
|
|
1816
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1854
|
+
return o instanceof Promise ? o.then((i) => se(i, t.out, r)) : se(o, t.out, r);
|
|
1817
1855
|
};
|
|
1818
1856
|
});
|
|
1819
|
-
function
|
|
1857
|
+
function se(e, t, n) {
|
|
1820
1858
|
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
1821
1859
|
}
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1860
|
+
const $o = /* @__PURE__ */ a("$ZodReadonly", (e, t) => {
|
|
1861
|
+
S.init(e, t), w(e._zod, "propValues", () => t.innerType._zod.propValues), w(e._zod, "values", () => t.innerType._zod.values), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, r) => {
|
|
1824
1862
|
if (r.direction === "backward")
|
|
1825
1863
|
return t.innerType._zod.run(n, r);
|
|
1826
1864
|
const o = t.innerType._zod.run(n, r);
|
|
1827
|
-
return o instanceof Promise ? o.then(
|
|
1865
|
+
return o instanceof Promise ? o.then(rt) : rt(o);
|
|
1828
1866
|
};
|
|
1829
1867
|
});
|
|
1830
|
-
function
|
|
1868
|
+
function rt(e) {
|
|
1831
1869
|
return e.value = Object.freeze(e.value), e;
|
|
1832
1870
|
}
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1871
|
+
const Zo = /* @__PURE__ */ a("$ZodCustom", (e, t) => {
|
|
1872
|
+
O.init(e, t), S.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
1835
1873
|
const r = n.value, o = t.fn(r);
|
|
1836
1874
|
if (o instanceof Promise)
|
|
1837
|
-
return o.then((i) =>
|
|
1838
|
-
|
|
1875
|
+
return o.then((i) => ot(i, n, r, e));
|
|
1876
|
+
ot(o, n, r, e);
|
|
1839
1877
|
};
|
|
1840
1878
|
});
|
|
1841
|
-
function
|
|
1879
|
+
function ot(e, t, n, r) {
|
|
1842
1880
|
if (!e) {
|
|
1843
1881
|
const o = {
|
|
1844
1882
|
code: "custom",
|
|
@@ -1850,10 +1888,10 @@ function He(e, t, n, r) {
|
|
|
1850
1888
|
continue: !r._zod.def.abort
|
|
1851
1889
|
// params: inst._zod.def.params,
|
|
1852
1890
|
};
|
|
1853
|
-
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(
|
|
1891
|
+
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(te(o));
|
|
1854
1892
|
}
|
|
1855
1893
|
}
|
|
1856
|
-
class
|
|
1894
|
+
class Eo {
|
|
1857
1895
|
constructor() {
|
|
1858
1896
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
1859
1897
|
}
|
|
@@ -1887,218 +1925,218 @@ class mo {
|
|
|
1887
1925
|
return this._map.has(t);
|
|
1888
1926
|
}
|
|
1889
1927
|
}
|
|
1890
|
-
function
|
|
1891
|
-
return new
|
|
1928
|
+
function xo() {
|
|
1929
|
+
return new Eo();
|
|
1892
1930
|
}
|
|
1893
|
-
const
|
|
1894
|
-
function
|
|
1931
|
+
const ce = /* @__PURE__ */ xo();
|
|
1932
|
+
function To(e, t) {
|
|
1895
1933
|
return new e({
|
|
1896
1934
|
type: "string",
|
|
1897
|
-
...
|
|
1935
|
+
...m(t)
|
|
1898
1936
|
});
|
|
1899
1937
|
}
|
|
1900
|
-
function
|
|
1938
|
+
function So(e, t) {
|
|
1901
1939
|
return new e({
|
|
1902
1940
|
type: "string",
|
|
1903
1941
|
format: "email",
|
|
1904
1942
|
check: "string_format",
|
|
1905
1943
|
abort: !1,
|
|
1906
|
-
...
|
|
1944
|
+
...m(t)
|
|
1907
1945
|
});
|
|
1908
1946
|
}
|
|
1909
|
-
function
|
|
1947
|
+
function it(e, t) {
|
|
1910
1948
|
return new e({
|
|
1911
1949
|
type: "string",
|
|
1912
1950
|
format: "guid",
|
|
1913
1951
|
check: "string_format",
|
|
1914
1952
|
abort: !1,
|
|
1915
|
-
...
|
|
1953
|
+
...m(t)
|
|
1916
1954
|
});
|
|
1917
1955
|
}
|
|
1918
|
-
function
|
|
1956
|
+
function Io(e, t) {
|
|
1919
1957
|
return new e({
|
|
1920
1958
|
type: "string",
|
|
1921
1959
|
format: "uuid",
|
|
1922
1960
|
check: "string_format",
|
|
1923
1961
|
abort: !1,
|
|
1924
|
-
...
|
|
1962
|
+
...m(t)
|
|
1925
1963
|
});
|
|
1926
1964
|
}
|
|
1927
|
-
function
|
|
1965
|
+
function jo(e, t) {
|
|
1928
1966
|
return new e({
|
|
1929
1967
|
type: "string",
|
|
1930
1968
|
format: "uuid",
|
|
1931
1969
|
check: "string_format",
|
|
1932
1970
|
abort: !1,
|
|
1933
1971
|
version: "v4",
|
|
1934
|
-
...
|
|
1972
|
+
...m(t)
|
|
1935
1973
|
});
|
|
1936
1974
|
}
|
|
1937
|
-
function
|
|
1975
|
+
function Ao(e, t) {
|
|
1938
1976
|
return new e({
|
|
1939
1977
|
type: "string",
|
|
1940
1978
|
format: "uuid",
|
|
1941
1979
|
check: "string_format",
|
|
1942
1980
|
abort: !1,
|
|
1943
1981
|
version: "v6",
|
|
1944
|
-
...
|
|
1982
|
+
...m(t)
|
|
1945
1983
|
});
|
|
1946
1984
|
}
|
|
1947
|
-
function
|
|
1985
|
+
function Co(e, t) {
|
|
1948
1986
|
return new e({
|
|
1949
1987
|
type: "string",
|
|
1950
1988
|
format: "uuid",
|
|
1951
1989
|
check: "string_format",
|
|
1952
1990
|
abort: !1,
|
|
1953
1991
|
version: "v7",
|
|
1954
|
-
...
|
|
1992
|
+
...m(t)
|
|
1955
1993
|
});
|
|
1956
1994
|
}
|
|
1957
|
-
function
|
|
1995
|
+
function Oo(e, t) {
|
|
1958
1996
|
return new e({
|
|
1959
1997
|
type: "string",
|
|
1960
1998
|
format: "url",
|
|
1961
1999
|
check: "string_format",
|
|
1962
2000
|
abort: !1,
|
|
1963
|
-
...
|
|
2001
|
+
...m(t)
|
|
1964
2002
|
});
|
|
1965
2003
|
}
|
|
1966
|
-
function
|
|
2004
|
+
function Ro(e, t) {
|
|
1967
2005
|
return new e({
|
|
1968
2006
|
type: "string",
|
|
1969
2007
|
format: "emoji",
|
|
1970
2008
|
check: "string_format",
|
|
1971
2009
|
abort: !1,
|
|
1972
|
-
...
|
|
2010
|
+
...m(t)
|
|
1973
2011
|
});
|
|
1974
2012
|
}
|
|
1975
|
-
function
|
|
2013
|
+
function Po(e, t) {
|
|
1976
2014
|
return new e({
|
|
1977
2015
|
type: "string",
|
|
1978
2016
|
format: "nanoid",
|
|
1979
2017
|
check: "string_format",
|
|
1980
2018
|
abort: !1,
|
|
1981
|
-
...
|
|
2019
|
+
...m(t)
|
|
1982
2020
|
});
|
|
1983
2021
|
}
|
|
1984
|
-
function
|
|
2022
|
+
function No(e, t) {
|
|
1985
2023
|
return new e({
|
|
1986
2024
|
type: "string",
|
|
1987
2025
|
format: "cuid",
|
|
1988
2026
|
check: "string_format",
|
|
1989
2027
|
abort: !1,
|
|
1990
|
-
...
|
|
2028
|
+
...m(t)
|
|
1991
2029
|
});
|
|
1992
2030
|
}
|
|
1993
|
-
function
|
|
2031
|
+
function Do(e, t) {
|
|
1994
2032
|
return new e({
|
|
1995
2033
|
type: "string",
|
|
1996
2034
|
format: "cuid2",
|
|
1997
2035
|
check: "string_format",
|
|
1998
2036
|
abort: !1,
|
|
1999
|
-
...
|
|
2037
|
+
...m(t)
|
|
2000
2038
|
});
|
|
2001
2039
|
}
|
|
2002
|
-
function
|
|
2040
|
+
function Uo(e, t) {
|
|
2003
2041
|
return new e({
|
|
2004
2042
|
type: "string",
|
|
2005
2043
|
format: "ulid",
|
|
2006
2044
|
check: "string_format",
|
|
2007
2045
|
abort: !1,
|
|
2008
|
-
...
|
|
2046
|
+
...m(t)
|
|
2009
2047
|
});
|
|
2010
2048
|
}
|
|
2011
|
-
function
|
|
2049
|
+
function Fo(e, t) {
|
|
2012
2050
|
return new e({
|
|
2013
2051
|
type: "string",
|
|
2014
2052
|
format: "xid",
|
|
2015
2053
|
check: "string_format",
|
|
2016
2054
|
abort: !1,
|
|
2017
|
-
...
|
|
2055
|
+
...m(t)
|
|
2018
2056
|
});
|
|
2019
2057
|
}
|
|
2020
|
-
function
|
|
2058
|
+
function Lo(e, t) {
|
|
2021
2059
|
return new e({
|
|
2022
2060
|
type: "string",
|
|
2023
2061
|
format: "ksuid",
|
|
2024
2062
|
check: "string_format",
|
|
2025
2063
|
abort: !1,
|
|
2026
|
-
...
|
|
2064
|
+
...m(t)
|
|
2027
2065
|
});
|
|
2028
2066
|
}
|
|
2029
|
-
function
|
|
2067
|
+
function Mo(e, t) {
|
|
2030
2068
|
return new e({
|
|
2031
2069
|
type: "string",
|
|
2032
2070
|
format: "ipv4",
|
|
2033
2071
|
check: "string_format",
|
|
2034
2072
|
abort: !1,
|
|
2035
|
-
...
|
|
2073
|
+
...m(t)
|
|
2036
2074
|
});
|
|
2037
2075
|
}
|
|
2038
|
-
function
|
|
2076
|
+
function Vo(e, t) {
|
|
2039
2077
|
return new e({
|
|
2040
2078
|
type: "string",
|
|
2041
2079
|
format: "ipv6",
|
|
2042
2080
|
check: "string_format",
|
|
2043
2081
|
abort: !1,
|
|
2044
|
-
...
|
|
2082
|
+
...m(t)
|
|
2045
2083
|
});
|
|
2046
2084
|
}
|
|
2047
|
-
function
|
|
2085
|
+
function Wo(e, t) {
|
|
2048
2086
|
return new e({
|
|
2049
2087
|
type: "string",
|
|
2050
2088
|
format: "cidrv4",
|
|
2051
2089
|
check: "string_format",
|
|
2052
2090
|
abort: !1,
|
|
2053
|
-
...
|
|
2091
|
+
...m(t)
|
|
2054
2092
|
});
|
|
2055
2093
|
}
|
|
2056
|
-
function
|
|
2094
|
+
function Bo(e, t) {
|
|
2057
2095
|
return new e({
|
|
2058
2096
|
type: "string",
|
|
2059
2097
|
format: "cidrv6",
|
|
2060
2098
|
check: "string_format",
|
|
2061
2099
|
abort: !1,
|
|
2062
|
-
...
|
|
2100
|
+
...m(t)
|
|
2063
2101
|
});
|
|
2064
2102
|
}
|
|
2065
|
-
function
|
|
2103
|
+
function Yo(e, t) {
|
|
2066
2104
|
return new e({
|
|
2067
2105
|
type: "string",
|
|
2068
2106
|
format: "base64",
|
|
2069
2107
|
check: "string_format",
|
|
2070
2108
|
abort: !1,
|
|
2071
|
-
...
|
|
2109
|
+
...m(t)
|
|
2072
2110
|
});
|
|
2073
2111
|
}
|
|
2074
|
-
function
|
|
2112
|
+
function Ho(e, t) {
|
|
2075
2113
|
return new e({
|
|
2076
2114
|
type: "string",
|
|
2077
2115
|
format: "base64url",
|
|
2078
2116
|
check: "string_format",
|
|
2079
2117
|
abort: !1,
|
|
2080
|
-
...
|
|
2118
|
+
...m(t)
|
|
2081
2119
|
});
|
|
2082
2120
|
}
|
|
2083
|
-
function
|
|
2121
|
+
function Jo(e, t) {
|
|
2084
2122
|
return new e({
|
|
2085
2123
|
type: "string",
|
|
2086
2124
|
format: "e164",
|
|
2087
2125
|
check: "string_format",
|
|
2088
2126
|
abort: !1,
|
|
2089
|
-
...
|
|
2127
|
+
...m(t)
|
|
2090
2128
|
});
|
|
2091
2129
|
}
|
|
2092
|
-
function
|
|
2130
|
+
function Go(e, t) {
|
|
2093
2131
|
return new e({
|
|
2094
2132
|
type: "string",
|
|
2095
2133
|
format: "jwt",
|
|
2096
2134
|
check: "string_format",
|
|
2097
2135
|
abort: !1,
|
|
2098
|
-
...
|
|
2136
|
+
...m(t)
|
|
2099
2137
|
});
|
|
2100
2138
|
}
|
|
2101
|
-
function
|
|
2139
|
+
function qo(e, t) {
|
|
2102
2140
|
return new e({
|
|
2103
2141
|
type: "string",
|
|
2104
2142
|
format: "datetime",
|
|
@@ -2106,270 +2144,270 @@ function Uo(e, t) {
|
|
|
2106
2144
|
offset: !1,
|
|
2107
2145
|
local: !1,
|
|
2108
2146
|
precision: null,
|
|
2109
|
-
...
|
|
2147
|
+
...m(t)
|
|
2110
2148
|
});
|
|
2111
2149
|
}
|
|
2112
|
-
function
|
|
2150
|
+
function Xo(e, t) {
|
|
2113
2151
|
return new e({
|
|
2114
2152
|
type: "string",
|
|
2115
2153
|
format: "date",
|
|
2116
2154
|
check: "string_format",
|
|
2117
|
-
...
|
|
2155
|
+
...m(t)
|
|
2118
2156
|
});
|
|
2119
2157
|
}
|
|
2120
|
-
function
|
|
2158
|
+
function Ko(e, t) {
|
|
2121
2159
|
return new e({
|
|
2122
2160
|
type: "string",
|
|
2123
2161
|
format: "time",
|
|
2124
2162
|
check: "string_format",
|
|
2125
2163
|
precision: null,
|
|
2126
|
-
...
|
|
2164
|
+
...m(t)
|
|
2127
2165
|
});
|
|
2128
2166
|
}
|
|
2129
|
-
function
|
|
2167
|
+
function Qo(e, t) {
|
|
2130
2168
|
return new e({
|
|
2131
2169
|
type: "string",
|
|
2132
2170
|
format: "duration",
|
|
2133
2171
|
check: "string_format",
|
|
2134
|
-
...
|
|
2172
|
+
...m(t)
|
|
2135
2173
|
});
|
|
2136
2174
|
}
|
|
2137
|
-
function
|
|
2175
|
+
function ei(e, t) {
|
|
2138
2176
|
return new e({
|
|
2139
2177
|
type: "number",
|
|
2140
2178
|
checks: [],
|
|
2141
|
-
...
|
|
2179
|
+
...m(t)
|
|
2142
2180
|
});
|
|
2143
2181
|
}
|
|
2144
|
-
function
|
|
2182
|
+
function ti(e, t) {
|
|
2145
2183
|
return new e({
|
|
2146
2184
|
type: "number",
|
|
2147
2185
|
check: "number_format",
|
|
2148
2186
|
abort: !1,
|
|
2149
2187
|
format: "safeint",
|
|
2150
|
-
...
|
|
2188
|
+
...m(t)
|
|
2151
2189
|
});
|
|
2152
2190
|
}
|
|
2153
|
-
function
|
|
2191
|
+
function ni(e, t) {
|
|
2154
2192
|
return new e({
|
|
2155
2193
|
type: "boolean",
|
|
2156
|
-
...
|
|
2194
|
+
...m(t)
|
|
2157
2195
|
});
|
|
2158
2196
|
}
|
|
2159
|
-
function
|
|
2197
|
+
function ri(e) {
|
|
2160
2198
|
return new e({
|
|
2161
2199
|
type: "unknown"
|
|
2162
2200
|
});
|
|
2163
2201
|
}
|
|
2164
|
-
function
|
|
2202
|
+
function oi(e, t) {
|
|
2165
2203
|
return new e({
|
|
2166
2204
|
type: "never",
|
|
2167
|
-
...
|
|
2205
|
+
...m(t)
|
|
2168
2206
|
});
|
|
2169
2207
|
}
|
|
2170
|
-
function
|
|
2171
|
-
return new
|
|
2208
|
+
function st(e, t) {
|
|
2209
|
+
return new At({
|
|
2172
2210
|
check: "less_than",
|
|
2173
|
-
...
|
|
2211
|
+
...m(t),
|
|
2174
2212
|
value: e,
|
|
2175
2213
|
inclusive: !1
|
|
2176
2214
|
});
|
|
2177
2215
|
}
|
|
2178
|
-
function
|
|
2179
|
-
return new
|
|
2216
|
+
function ye(e, t) {
|
|
2217
|
+
return new At({
|
|
2180
2218
|
check: "less_than",
|
|
2181
|
-
...
|
|
2219
|
+
...m(t),
|
|
2182
2220
|
value: e,
|
|
2183
2221
|
inclusive: !0
|
|
2184
2222
|
});
|
|
2185
2223
|
}
|
|
2186
|
-
function
|
|
2187
|
-
return new
|
|
2224
|
+
function ct(e, t) {
|
|
2225
|
+
return new Ct({
|
|
2188
2226
|
check: "greater_than",
|
|
2189
|
-
...
|
|
2227
|
+
...m(t),
|
|
2190
2228
|
value: e,
|
|
2191
2229
|
inclusive: !1
|
|
2192
2230
|
});
|
|
2193
2231
|
}
|
|
2194
|
-
function
|
|
2195
|
-
return new
|
|
2232
|
+
function $e(e, t) {
|
|
2233
|
+
return new Ct({
|
|
2196
2234
|
check: "greater_than",
|
|
2197
|
-
...
|
|
2235
|
+
...m(t),
|
|
2198
2236
|
value: e,
|
|
2199
2237
|
inclusive: !0
|
|
2200
2238
|
});
|
|
2201
2239
|
}
|
|
2202
|
-
function
|
|
2203
|
-
return new
|
|
2240
|
+
function at(e, t) {
|
|
2241
|
+
return new wr({
|
|
2204
2242
|
check: "multiple_of",
|
|
2205
|
-
...
|
|
2243
|
+
...m(t),
|
|
2206
2244
|
value: e
|
|
2207
2245
|
});
|
|
2208
2246
|
}
|
|
2209
|
-
function
|
|
2210
|
-
return new
|
|
2247
|
+
function Dt(e, t) {
|
|
2248
|
+
return new zr({
|
|
2211
2249
|
check: "max_length",
|
|
2212
|
-
...
|
|
2250
|
+
...m(t),
|
|
2213
2251
|
maximum: e
|
|
2214
2252
|
});
|
|
2215
2253
|
}
|
|
2216
|
-
function
|
|
2217
|
-
return new
|
|
2254
|
+
function fe(e, t) {
|
|
2255
|
+
return new yr({
|
|
2218
2256
|
check: "min_length",
|
|
2219
|
-
...
|
|
2257
|
+
...m(t),
|
|
2220
2258
|
minimum: e
|
|
2221
2259
|
});
|
|
2222
2260
|
}
|
|
2223
|
-
function
|
|
2224
|
-
return new
|
|
2261
|
+
function Ut(e, t) {
|
|
2262
|
+
return new $r({
|
|
2225
2263
|
check: "length_equals",
|
|
2226
|
-
...
|
|
2264
|
+
...m(t),
|
|
2227
2265
|
length: e
|
|
2228
2266
|
});
|
|
2229
2267
|
}
|
|
2230
|
-
function
|
|
2231
|
-
return new
|
|
2268
|
+
function ii(e, t) {
|
|
2269
|
+
return new Zr({
|
|
2232
2270
|
check: "string_format",
|
|
2233
2271
|
format: "regex",
|
|
2234
|
-
...
|
|
2272
|
+
...m(t),
|
|
2235
2273
|
pattern: e
|
|
2236
2274
|
});
|
|
2237
2275
|
}
|
|
2238
|
-
function
|
|
2239
|
-
return new
|
|
2276
|
+
function si(e) {
|
|
2277
|
+
return new Er({
|
|
2240
2278
|
check: "string_format",
|
|
2241
2279
|
format: "lowercase",
|
|
2242
|
-
...
|
|
2280
|
+
...m(e)
|
|
2243
2281
|
});
|
|
2244
2282
|
}
|
|
2245
|
-
function
|
|
2246
|
-
return new
|
|
2283
|
+
function ci(e) {
|
|
2284
|
+
return new xr({
|
|
2247
2285
|
check: "string_format",
|
|
2248
2286
|
format: "uppercase",
|
|
2249
|
-
...
|
|
2287
|
+
...m(e)
|
|
2250
2288
|
});
|
|
2251
2289
|
}
|
|
2252
|
-
function
|
|
2253
|
-
return new
|
|
2290
|
+
function ai(e, t) {
|
|
2291
|
+
return new Tr({
|
|
2254
2292
|
check: "string_format",
|
|
2255
2293
|
format: "includes",
|
|
2256
|
-
...
|
|
2294
|
+
...m(t),
|
|
2257
2295
|
includes: e
|
|
2258
2296
|
});
|
|
2259
2297
|
}
|
|
2260
|
-
function
|
|
2261
|
-
return new
|
|
2298
|
+
function ui(e, t) {
|
|
2299
|
+
return new Sr({
|
|
2262
2300
|
check: "string_format",
|
|
2263
2301
|
format: "starts_with",
|
|
2264
|
-
...
|
|
2302
|
+
...m(t),
|
|
2265
2303
|
prefix: e
|
|
2266
2304
|
});
|
|
2267
2305
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return new
|
|
2306
|
+
function li(e, t) {
|
|
2307
|
+
return new Ir({
|
|
2270
2308
|
check: "string_format",
|
|
2271
2309
|
format: "ends_with",
|
|
2272
|
-
...
|
|
2310
|
+
...m(t),
|
|
2273
2311
|
suffix: e
|
|
2274
2312
|
});
|
|
2275
2313
|
}
|
|
2276
|
-
function
|
|
2277
|
-
return new
|
|
2314
|
+
function ne(e) {
|
|
2315
|
+
return new jr({
|
|
2278
2316
|
check: "overwrite",
|
|
2279
2317
|
tx: e
|
|
2280
2318
|
});
|
|
2281
2319
|
}
|
|
2282
|
-
function
|
|
2283
|
-
return
|
|
2320
|
+
function di(e) {
|
|
2321
|
+
return ne((t) => t.normalize(e));
|
|
2284
2322
|
}
|
|
2285
|
-
function
|
|
2286
|
-
return
|
|
2323
|
+
function fi() {
|
|
2324
|
+
return ne((e) => e.trim());
|
|
2287
2325
|
}
|
|
2288
|
-
function
|
|
2289
|
-
return
|
|
2326
|
+
function hi() {
|
|
2327
|
+
return ne((e) => e.toLowerCase());
|
|
2290
2328
|
}
|
|
2291
|
-
function
|
|
2292
|
-
return
|
|
2329
|
+
function mi() {
|
|
2330
|
+
return ne((e) => e.toUpperCase());
|
|
2293
2331
|
}
|
|
2294
|
-
function
|
|
2332
|
+
function pi(e, t, n) {
|
|
2295
2333
|
return new e({
|
|
2296
2334
|
type: "array",
|
|
2297
2335
|
element: t,
|
|
2298
2336
|
// get element() {
|
|
2299
2337
|
// return element;
|
|
2300
2338
|
// },
|
|
2301
|
-
...
|
|
2339
|
+
...m(n)
|
|
2302
2340
|
});
|
|
2303
2341
|
}
|
|
2304
|
-
function
|
|
2342
|
+
function gi(e, t, n) {
|
|
2305
2343
|
return new e({
|
|
2306
2344
|
type: "custom",
|
|
2307
2345
|
check: "custom",
|
|
2308
2346
|
fn: t,
|
|
2309
|
-
...
|
|
2347
|
+
...m(n)
|
|
2310
2348
|
});
|
|
2311
2349
|
}
|
|
2312
|
-
function
|
|
2313
|
-
const t =
|
|
2350
|
+
function _i(e) {
|
|
2351
|
+
const t = vi((n) => (n.addIssue = (r) => {
|
|
2314
2352
|
if (typeof r == "string")
|
|
2315
|
-
n.issues.push(
|
|
2353
|
+
n.issues.push(te(r, n.value, t._zod.def));
|
|
2316
2354
|
else {
|
|
2317
2355
|
const o = r;
|
|
2318
|
-
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(
|
|
2356
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(te(o));
|
|
2319
2357
|
}
|
|
2320
2358
|
}, e(n.value, n)));
|
|
2321
2359
|
return t;
|
|
2322
2360
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const n = new
|
|
2361
|
+
function vi(e, t) {
|
|
2362
|
+
const n = new O({
|
|
2325
2363
|
check: "custom",
|
|
2326
|
-
...
|
|
2364
|
+
...m(t)
|
|
2327
2365
|
});
|
|
2328
2366
|
return n._zod.check = e, n;
|
|
2329
2367
|
}
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2368
|
+
const bi = /* @__PURE__ */ a("ZodISODateTime", (e, t) => {
|
|
2369
|
+
Br.init(e, t), Z.init(e, t);
|
|
2332
2370
|
});
|
|
2333
|
-
function
|
|
2334
|
-
return
|
|
2371
|
+
function wi(e) {
|
|
2372
|
+
return qo(bi, e);
|
|
2335
2373
|
}
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2374
|
+
const ki = /* @__PURE__ */ a("ZodISODate", (e, t) => {
|
|
2375
|
+
Yr.init(e, t), Z.init(e, t);
|
|
2338
2376
|
});
|
|
2339
|
-
function
|
|
2340
|
-
return
|
|
2377
|
+
function zi(e) {
|
|
2378
|
+
return Xo(ki, e);
|
|
2341
2379
|
}
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2380
|
+
const yi = /* @__PURE__ */ a("ZodISOTime", (e, t) => {
|
|
2381
|
+
Hr.init(e, t), Z.init(e, t);
|
|
2344
2382
|
});
|
|
2345
|
-
function
|
|
2346
|
-
return
|
|
2383
|
+
function $i(e) {
|
|
2384
|
+
return Ko(yi, e);
|
|
2347
2385
|
}
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2386
|
+
const Zi = /* @__PURE__ */ a("ZodISODuration", (e, t) => {
|
|
2387
|
+
Jr.init(e, t), Z.init(e, t);
|
|
2350
2388
|
});
|
|
2351
|
-
function
|
|
2352
|
-
return
|
|
2389
|
+
function Ei(e) {
|
|
2390
|
+
return Qo(Zi, e);
|
|
2353
2391
|
}
|
|
2354
|
-
const
|
|
2355
|
-
|
|
2392
|
+
const xi = (e, t) => {
|
|
2393
|
+
Et.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2356
2394
|
format: {
|
|
2357
|
-
value: (n) =>
|
|
2395
|
+
value: (n) => Pn(e, n)
|
|
2358
2396
|
// enumerable: false,
|
|
2359
2397
|
},
|
|
2360
2398
|
flatten: {
|
|
2361
|
-
value: (n) =>
|
|
2399
|
+
value: (n) => Rn(e, n)
|
|
2362
2400
|
// enumerable: false,
|
|
2363
2401
|
},
|
|
2364
2402
|
addIssue: {
|
|
2365
2403
|
value: (n) => {
|
|
2366
|
-
e.issues.push(n), e.message = JSON.stringify(e.issues,
|
|
2404
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, Ee, 2);
|
|
2367
2405
|
}
|
|
2368
2406
|
// enumerable: false,
|
|
2369
2407
|
},
|
|
2370
2408
|
addIssues: {
|
|
2371
2409
|
value: (n) => {
|
|
2372
|
-
e.issues.push(...n), e.message = JSON.stringify(e.issues,
|
|
2410
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, Ee, 2);
|
|
2373
2411
|
}
|
|
2374
2412
|
// enumerable: false,
|
|
2375
2413
|
},
|
|
@@ -2380,349 +2418,788 @@ const _i = (e, t) => {
|
|
|
2380
2418
|
// enumerable: false,
|
|
2381
2419
|
}
|
|
2382
2420
|
});
|
|
2383
|
-
},
|
|
2421
|
+
}, R = a("ZodError", xi, {
|
|
2384
2422
|
Parent: Error
|
|
2385
|
-
}),
|
|
2423
|
+
}), Ti = /* @__PURE__ */ Re(R), Si = /* @__PURE__ */ Pe(R), Ii = /* @__PURE__ */ me(R), ji = /* @__PURE__ */ pe(R), Ai = /* @__PURE__ */ Un(R), Ci = /* @__PURE__ */ Fn(R), Oi = /* @__PURE__ */ Ln(R), Ri = /* @__PURE__ */ Mn(R), Pi = /* @__PURE__ */ Vn(R), Ni = /* @__PURE__ */ Wn(R), Di = /* @__PURE__ */ Bn(R), Ui = /* @__PURE__ */ Yn(R), I = /* @__PURE__ */ a("ZodType", (e, t) => (S.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
|
|
2386
2424
|
checks: [
|
|
2387
2425
|
...t.checks ?? [],
|
|
2388
2426
|
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
2389
2427
|
]
|
|
2390
|
-
})), e.clone = (n, r) =>
|
|
2428
|
+
})), e.clone = (n, r) => L(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.parse = (n, r) => Ti(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => Ii(e, n, r), e.parseAsync = async (n, r) => Si(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => ji(e, n, r), e.spa = e.safeParseAsync, e.encode = (n, r) => Ai(e, n, r), e.decode = (n, r) => Ci(e, n, r), e.encodeAsync = async (n, r) => Oi(e, n, r), e.decodeAsync = async (n, r) => Ri(e, n, r), e.safeEncode = (n, r) => Pi(e, n, r), e.safeDecode = (n, r) => Ni(e, n, r), e.safeEncodeAsync = async (n, r) => Di(e, n, r), e.safeDecodeAsync = async (n, r) => Ui(e, n, r), e.refine = (n, r) => e.check(Is(n, r)), e.superRefine = (n) => e.check(js(n)), e.overwrite = (n) => e.check(ne(n)), e.optional = () => mt(e), e.nullable = () => pt(e), e.nullish = () => mt(pt(e)), e.nonoptional = (n) => ys(e, n), e.array = () => ls(e), e.or = (n) => hs([e, n]), e.and = (n) => ps(e, n), e.transform = (n) => gt(e, _s(n)), e.default = (n) => ws(e, n), e.prefault = (n) => zs(e, n), e.catch = (n) => Zs(e, n), e.pipe = (n) => gt(e, n), e.readonly = () => Ts(e), e.describe = (n) => {
|
|
2391
2429
|
const r = e.clone();
|
|
2392
|
-
return
|
|
2430
|
+
return ce.add(r, { description: n }), r;
|
|
2393
2431
|
}, Object.defineProperty(e, "description", {
|
|
2394
2432
|
get() {
|
|
2395
|
-
return
|
|
2433
|
+
return ce.get(e)?.description;
|
|
2396
2434
|
},
|
|
2397
2435
|
configurable: !0
|
|
2398
2436
|
}), e.meta = (...n) => {
|
|
2399
2437
|
if (n.length === 0)
|
|
2400
|
-
return
|
|
2438
|
+
return ce.get(e);
|
|
2401
2439
|
const r = e.clone();
|
|
2402
|
-
return
|
|
2403
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2404
|
-
|
|
2440
|
+
return ce.add(r, n[0]), r;
|
|
2441
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Ft = /* @__PURE__ */ a("_ZodString", (e, t) => {
|
|
2442
|
+
Ne.init(e, t), I.init(e, t);
|
|
2405
2443
|
const n = e._zod.bag;
|
|
2406
|
-
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(
|
|
2407
|
-
}),
|
|
2408
|
-
|
|
2444
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(ii(...r)), e.includes = (...r) => e.check(ai(...r)), e.startsWith = (...r) => e.check(ui(...r)), e.endsWith = (...r) => e.check(li(...r)), e.min = (...r) => e.check(fe(...r)), e.max = (...r) => e.check(Dt(...r)), e.length = (...r) => e.check(Ut(...r)), e.nonempty = (...r) => e.check(fe(1, ...r)), e.lowercase = (r) => e.check(si(r)), e.uppercase = (r) => e.check(ci(r)), e.trim = () => e.check(fi()), e.normalize = (...r) => e.check(di(...r)), e.toLowerCase = () => e.check(hi()), e.toUpperCase = () => e.check(mi());
|
|
2445
|
+
}), Fi = /* @__PURE__ */ a("ZodString", (e, t) => {
|
|
2446
|
+
Ne.init(e, t), Ft.init(e, t), e.email = (n) => e.check(So(Li, n)), e.url = (n) => e.check(Oo(Mi, n)), e.jwt = (n) => e.check(Go(rs, n)), e.emoji = (n) => e.check(Ro(Vi, n)), e.guid = (n) => e.check(it(ut, n)), e.uuid = (n) => e.check(Io(ue, n)), e.uuidv4 = (n) => e.check(jo(ue, n)), e.uuidv6 = (n) => e.check(Ao(ue, n)), e.uuidv7 = (n) => e.check(Co(ue, n)), e.nanoid = (n) => e.check(Po(Wi, n)), e.guid = (n) => e.check(it(ut, n)), e.cuid = (n) => e.check(No(Bi, n)), e.cuid2 = (n) => e.check(Do(Yi, n)), e.ulid = (n) => e.check(Uo(Hi, n)), e.base64 = (n) => e.check(Yo(es, n)), e.base64url = (n) => e.check(Ho(ts, n)), e.xid = (n) => e.check(Fo(Ji, n)), e.ksuid = (n) => e.check(Lo(Gi, n)), e.ipv4 = (n) => e.check(Mo(qi, n)), e.ipv6 = (n) => e.check(Vo(Xi, n)), e.cidrv4 = (n) => e.check(Wo(Ki, n)), e.cidrv6 = (n) => e.check(Bo(Qi, n)), e.e164 = (n) => e.check(Jo(ns, n)), e.datetime = (n) => e.check(wi(n)), e.date = (n) => e.check(zi(n)), e.time = (n) => e.check($i(n)), e.duration = (n) => e.check(Ei(n));
|
|
2409
2447
|
});
|
|
2410
|
-
function
|
|
2411
|
-
return
|
|
2412
|
-
}
|
|
2413
|
-
const
|
|
2414
|
-
|
|
2415
|
-
}),
|
|
2416
|
-
|
|
2417
|
-
}),
|
|
2418
|
-
|
|
2419
|
-
}),
|
|
2420
|
-
|
|
2421
|
-
}),
|
|
2422
|
-
|
|
2423
|
-
}),
|
|
2424
|
-
|
|
2425
|
-
}),
|
|
2426
|
-
|
|
2427
|
-
}),
|
|
2428
|
-
|
|
2429
|
-
}),
|
|
2430
|
-
|
|
2431
|
-
}),
|
|
2432
|
-
|
|
2433
|
-
}),
|
|
2434
|
-
|
|
2435
|
-
}),
|
|
2436
|
-
|
|
2437
|
-
}),
|
|
2438
|
-
|
|
2439
|
-
}),
|
|
2440
|
-
|
|
2441
|
-
}),
|
|
2442
|
-
|
|
2443
|
-
}),
|
|
2444
|
-
|
|
2445
|
-
}),
|
|
2446
|
-
|
|
2447
|
-
}),
|
|
2448
|
-
|
|
2449
|
-
}),
|
|
2450
|
-
|
|
2451
|
-
}),
|
|
2452
|
-
|
|
2453
|
-
}),
|
|
2454
|
-
|
|
2448
|
+
function ae(e) {
|
|
2449
|
+
return To(Fi, e);
|
|
2450
|
+
}
|
|
2451
|
+
const Z = /* @__PURE__ */ a("ZodStringFormat", (e, t) => {
|
|
2452
|
+
y.init(e, t), Ft.init(e, t);
|
|
2453
|
+
}), Li = /* @__PURE__ */ a("ZodEmail", (e, t) => {
|
|
2454
|
+
Pr.init(e, t), Z.init(e, t);
|
|
2455
|
+
}), ut = /* @__PURE__ */ a("ZodGUID", (e, t) => {
|
|
2456
|
+
Or.init(e, t), Z.init(e, t);
|
|
2457
|
+
}), ue = /* @__PURE__ */ a("ZodUUID", (e, t) => {
|
|
2458
|
+
Rr.init(e, t), Z.init(e, t);
|
|
2459
|
+
}), Mi = /* @__PURE__ */ a("ZodURL", (e, t) => {
|
|
2460
|
+
Nr.init(e, t), Z.init(e, t);
|
|
2461
|
+
}), Vi = /* @__PURE__ */ a("ZodEmoji", (e, t) => {
|
|
2462
|
+
Dr.init(e, t), Z.init(e, t);
|
|
2463
|
+
}), Wi = /* @__PURE__ */ a("ZodNanoID", (e, t) => {
|
|
2464
|
+
Ur.init(e, t), Z.init(e, t);
|
|
2465
|
+
}), Bi = /* @__PURE__ */ a("ZodCUID", (e, t) => {
|
|
2466
|
+
Fr.init(e, t), Z.init(e, t);
|
|
2467
|
+
}), Yi = /* @__PURE__ */ a("ZodCUID2", (e, t) => {
|
|
2468
|
+
Lr.init(e, t), Z.init(e, t);
|
|
2469
|
+
}), Hi = /* @__PURE__ */ a("ZodULID", (e, t) => {
|
|
2470
|
+
Mr.init(e, t), Z.init(e, t);
|
|
2471
|
+
}), Ji = /* @__PURE__ */ a("ZodXID", (e, t) => {
|
|
2472
|
+
Vr.init(e, t), Z.init(e, t);
|
|
2473
|
+
}), Gi = /* @__PURE__ */ a("ZodKSUID", (e, t) => {
|
|
2474
|
+
Wr.init(e, t), Z.init(e, t);
|
|
2475
|
+
}), qi = /* @__PURE__ */ a("ZodIPv4", (e, t) => {
|
|
2476
|
+
Gr.init(e, t), Z.init(e, t);
|
|
2477
|
+
}), Xi = /* @__PURE__ */ a("ZodIPv6", (e, t) => {
|
|
2478
|
+
qr.init(e, t), Z.init(e, t);
|
|
2479
|
+
}), Ki = /* @__PURE__ */ a("ZodCIDRv4", (e, t) => {
|
|
2480
|
+
Xr.init(e, t), Z.init(e, t);
|
|
2481
|
+
}), Qi = /* @__PURE__ */ a("ZodCIDRv6", (e, t) => {
|
|
2482
|
+
Kr.init(e, t), Z.init(e, t);
|
|
2483
|
+
}), es = /* @__PURE__ */ a("ZodBase64", (e, t) => {
|
|
2484
|
+
Qr.init(e, t), Z.init(e, t);
|
|
2485
|
+
}), ts = /* @__PURE__ */ a("ZodBase64URL", (e, t) => {
|
|
2486
|
+
to.init(e, t), Z.init(e, t);
|
|
2487
|
+
}), ns = /* @__PURE__ */ a("ZodE164", (e, t) => {
|
|
2488
|
+
no.init(e, t), Z.init(e, t);
|
|
2489
|
+
}), rs = /* @__PURE__ */ a("ZodJWT", (e, t) => {
|
|
2490
|
+
oo.init(e, t), Z.init(e, t);
|
|
2491
|
+
}), Lt = /* @__PURE__ */ a("ZodNumber", (e, t) => {
|
|
2492
|
+
Rt.init(e, t), I.init(e, t), e.gt = (r, o) => e.check(ct(r, o)), e.gte = (r, o) => e.check($e(r, o)), e.min = (r, o) => e.check($e(r, o)), e.lt = (r, o) => e.check(st(r, o)), e.lte = (r, o) => e.check(ye(r, o)), e.max = (r, o) => e.check(ye(r, o)), e.int = (r) => e.check(dt(r)), e.safe = (r) => e.check(dt(r)), e.positive = (r) => e.check(ct(0, r)), e.nonnegative = (r) => e.check($e(0, r)), e.negative = (r) => e.check(st(0, r)), e.nonpositive = (r) => e.check(ye(0, r)), e.multipleOf = (r, o) => e.check(at(r, o)), e.step = (r, o) => e.check(at(r, o)), e.finite = () => e;
|
|
2455
2493
|
const n = e._zod.bag;
|
|
2456
2494
|
e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
|
|
2457
2495
|
});
|
|
2458
|
-
function
|
|
2459
|
-
return
|
|
2496
|
+
function lt(e) {
|
|
2497
|
+
return ei(Lt, e);
|
|
2460
2498
|
}
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2499
|
+
const os = /* @__PURE__ */ a("ZodNumberFormat", (e, t) => {
|
|
2500
|
+
io.init(e, t), Lt.init(e, t);
|
|
2463
2501
|
});
|
|
2464
|
-
function
|
|
2465
|
-
return
|
|
2502
|
+
function dt(e) {
|
|
2503
|
+
return ti(os, e);
|
|
2466
2504
|
}
|
|
2467
|
-
const
|
|
2468
|
-
|
|
2505
|
+
const is = /* @__PURE__ */ a("ZodBoolean", (e, t) => {
|
|
2506
|
+
so.init(e, t), I.init(e, t);
|
|
2469
2507
|
});
|
|
2470
|
-
function
|
|
2471
|
-
return
|
|
2508
|
+
function ft(e) {
|
|
2509
|
+
return ni(is, e);
|
|
2472
2510
|
}
|
|
2473
|
-
const
|
|
2474
|
-
|
|
2511
|
+
const ss = /* @__PURE__ */ a("ZodUnknown", (e, t) => {
|
|
2512
|
+
co.init(e, t), I.init(e, t);
|
|
2475
2513
|
});
|
|
2476
|
-
function
|
|
2477
|
-
return
|
|
2514
|
+
function ht() {
|
|
2515
|
+
return ri(ss);
|
|
2478
2516
|
}
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2517
|
+
const cs = /* @__PURE__ */ a("ZodNever", (e, t) => {
|
|
2518
|
+
ao.init(e, t), I.init(e, t);
|
|
2481
2519
|
});
|
|
2482
|
-
function
|
|
2483
|
-
return
|
|
2520
|
+
function as(e) {
|
|
2521
|
+
return oi(cs, e);
|
|
2484
2522
|
}
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2523
|
+
const us = /* @__PURE__ */ a("ZodArray", (e, t) => {
|
|
2524
|
+
uo.init(e, t), I.init(e, t), e.element = t.element, e.min = (n, r) => e.check(fe(n, r)), e.nonempty = (n) => e.check(fe(1, n)), e.max = (n, r) => e.check(Dt(n, r)), e.length = (n, r) => e.check(Ut(n, r)), e.unwrap = () => e.element;
|
|
2487
2525
|
});
|
|
2488
|
-
function
|
|
2489
|
-
return
|
|
2526
|
+
function ls(e, t) {
|
|
2527
|
+
return pi(us, e, t);
|
|
2490
2528
|
}
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2529
|
+
const ds = /* @__PURE__ */ a("ZodObject", (e, t) => {
|
|
2530
|
+
fo.init(e, t), I.init(e, t), w(e, "shape", () => t.shape), e.keyof = () => De(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ht() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ht() }), e.strict = () => e.clone({ ...e._zod.def, catchall: as() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => In(e, n), e.safeExtend = (n) => jn(e, n), e.merge = (n) => An(e, n), e.pick = (n) => Tn(e, n), e.omit = (n) => Sn(e, n), e.partial = (...n) => Cn(Mt, e, n[0]), e.required = (...n) => On(Vt, e, n[0]);
|
|
2493
2531
|
});
|
|
2494
|
-
function
|
|
2532
|
+
function Te(e, t) {
|
|
2495
2533
|
const n = {
|
|
2496
2534
|
type: "object",
|
|
2497
2535
|
shape: e ?? {},
|
|
2498
|
-
...
|
|
2536
|
+
...m(t)
|
|
2499
2537
|
};
|
|
2500
|
-
return new
|
|
2538
|
+
return new ds(n);
|
|
2501
2539
|
}
|
|
2502
|
-
const
|
|
2503
|
-
|
|
2540
|
+
const fs = /* @__PURE__ */ a("ZodUnion", (e, t) => {
|
|
2541
|
+
ho.init(e, t), I.init(e, t), e.options = t.options;
|
|
2504
2542
|
});
|
|
2505
|
-
function
|
|
2506
|
-
return new
|
|
2543
|
+
function hs(e, t) {
|
|
2544
|
+
return new fs({
|
|
2507
2545
|
type: "union",
|
|
2508
2546
|
options: e,
|
|
2509
|
-
...
|
|
2547
|
+
...m(t)
|
|
2510
2548
|
});
|
|
2511
2549
|
}
|
|
2512
|
-
const
|
|
2513
|
-
|
|
2550
|
+
const ms = /* @__PURE__ */ a("ZodIntersection", (e, t) => {
|
|
2551
|
+
mo.init(e, t), I.init(e, t);
|
|
2514
2552
|
});
|
|
2515
|
-
function
|
|
2516
|
-
return new
|
|
2553
|
+
function ps(e, t) {
|
|
2554
|
+
return new ms({
|
|
2517
2555
|
type: "intersection",
|
|
2518
2556
|
left: e,
|
|
2519
2557
|
right: t
|
|
2520
2558
|
});
|
|
2521
2559
|
}
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2560
|
+
const Se = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
2561
|
+
po.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
2524
2562
|
const n = new Set(Object.keys(t.entries));
|
|
2525
2563
|
e.extract = (r, o) => {
|
|
2526
2564
|
const i = {};
|
|
2527
|
-
for (const
|
|
2528
|
-
if (n.has(
|
|
2529
|
-
i[
|
|
2565
|
+
for (const s of r)
|
|
2566
|
+
if (n.has(s))
|
|
2567
|
+
i[s] = t.entries[s];
|
|
2530
2568
|
else
|
|
2531
|
-
throw new Error(`Key ${
|
|
2532
|
-
return new
|
|
2569
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
2570
|
+
return new Se({
|
|
2533
2571
|
...t,
|
|
2534
2572
|
checks: [],
|
|
2535
|
-
...
|
|
2573
|
+
...m(o),
|
|
2536
2574
|
entries: i
|
|
2537
2575
|
});
|
|
2538
2576
|
}, e.exclude = (r, o) => {
|
|
2539
2577
|
const i = { ...t.entries };
|
|
2540
|
-
for (const
|
|
2541
|
-
if (n.has(
|
|
2542
|
-
delete i[
|
|
2578
|
+
for (const s of r)
|
|
2579
|
+
if (n.has(s))
|
|
2580
|
+
delete i[s];
|
|
2543
2581
|
else
|
|
2544
|
-
throw new Error(`Key ${
|
|
2545
|
-
return new
|
|
2582
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
2583
|
+
return new Se({
|
|
2546
2584
|
...t,
|
|
2547
2585
|
checks: [],
|
|
2548
|
-
...
|
|
2586
|
+
...m(o),
|
|
2549
2587
|
entries: i
|
|
2550
2588
|
});
|
|
2551
2589
|
};
|
|
2552
2590
|
});
|
|
2553
|
-
function
|
|
2591
|
+
function De(e, t) {
|
|
2554
2592
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
|
|
2555
|
-
return new
|
|
2593
|
+
return new Se({
|
|
2556
2594
|
type: "enum",
|
|
2557
2595
|
entries: n,
|
|
2558
|
-
...
|
|
2596
|
+
...m(t)
|
|
2559
2597
|
});
|
|
2560
2598
|
}
|
|
2561
|
-
const
|
|
2562
|
-
|
|
2599
|
+
const gs = /* @__PURE__ */ a("ZodTransform", (e, t) => {
|
|
2600
|
+
go.init(e, t), I.init(e, t), e._zod.parse = (n, r) => {
|
|
2563
2601
|
if (r.direction === "backward")
|
|
2564
|
-
throw new
|
|
2602
|
+
throw new wt(e.constructor.name);
|
|
2565
2603
|
n.addIssue = (i) => {
|
|
2566
2604
|
if (typeof i == "string")
|
|
2567
|
-
n.issues.push(
|
|
2605
|
+
n.issues.push(te(i, n.value, t));
|
|
2568
2606
|
else {
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2607
|
+
const s = i;
|
|
2608
|
+
s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(te(s));
|
|
2571
2609
|
}
|
|
2572
2610
|
};
|
|
2573
2611
|
const o = t.transform(n.value, n);
|
|
2574
2612
|
return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
|
|
2575
2613
|
};
|
|
2576
2614
|
});
|
|
2577
|
-
function
|
|
2578
|
-
return new
|
|
2615
|
+
function _s(e) {
|
|
2616
|
+
return new gs({
|
|
2579
2617
|
type: "transform",
|
|
2580
2618
|
transform: e
|
|
2581
2619
|
});
|
|
2582
2620
|
}
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2621
|
+
const Mt = /* @__PURE__ */ a("ZodOptional", (e, t) => {
|
|
2622
|
+
_o.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2585
2623
|
});
|
|
2586
|
-
function
|
|
2587
|
-
return new
|
|
2624
|
+
function mt(e) {
|
|
2625
|
+
return new Mt({
|
|
2588
2626
|
type: "optional",
|
|
2589
2627
|
innerType: e
|
|
2590
2628
|
});
|
|
2591
2629
|
}
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2630
|
+
const vs = /* @__PURE__ */ a("ZodNullable", (e, t) => {
|
|
2631
|
+
vo.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2594
2632
|
});
|
|
2595
|
-
function
|
|
2596
|
-
return new
|
|
2633
|
+
function pt(e) {
|
|
2634
|
+
return new vs({
|
|
2597
2635
|
type: "nullable",
|
|
2598
2636
|
innerType: e
|
|
2599
2637
|
});
|
|
2600
2638
|
}
|
|
2601
|
-
const
|
|
2602
|
-
|
|
2639
|
+
const bs = /* @__PURE__ */ a("ZodDefault", (e, t) => {
|
|
2640
|
+
bo.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
2603
2641
|
});
|
|
2604
|
-
function
|
|
2605
|
-
return new
|
|
2642
|
+
function ws(e, t) {
|
|
2643
|
+
return new bs({
|
|
2606
2644
|
type: "default",
|
|
2607
2645
|
innerType: e,
|
|
2608
2646
|
get defaultValue() {
|
|
2609
|
-
return typeof t == "function" ? t() :
|
|
2647
|
+
return typeof t == "function" ? t() : yt(t);
|
|
2610
2648
|
}
|
|
2611
2649
|
});
|
|
2612
2650
|
}
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2651
|
+
const ks = /* @__PURE__ */ a("ZodPrefault", (e, t) => {
|
|
2652
|
+
wo.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2615
2653
|
});
|
|
2616
|
-
function
|
|
2617
|
-
return new
|
|
2654
|
+
function zs(e, t) {
|
|
2655
|
+
return new ks({
|
|
2618
2656
|
type: "prefault",
|
|
2619
2657
|
innerType: e,
|
|
2620
2658
|
get defaultValue() {
|
|
2621
|
-
return typeof t == "function" ? t() :
|
|
2659
|
+
return typeof t == "function" ? t() : yt(t);
|
|
2622
2660
|
}
|
|
2623
2661
|
});
|
|
2624
2662
|
}
|
|
2625
|
-
const
|
|
2626
|
-
|
|
2663
|
+
const Vt = /* @__PURE__ */ a("ZodNonOptional", (e, t) => {
|
|
2664
|
+
ko.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2627
2665
|
});
|
|
2628
|
-
function
|
|
2629
|
-
return new
|
|
2666
|
+
function ys(e, t) {
|
|
2667
|
+
return new Vt({
|
|
2630
2668
|
type: "nonoptional",
|
|
2631
2669
|
innerType: e,
|
|
2632
|
-
...
|
|
2670
|
+
...m(t)
|
|
2633
2671
|
});
|
|
2634
2672
|
}
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2673
|
+
const $s = /* @__PURE__ */ a("ZodCatch", (e, t) => {
|
|
2674
|
+
zo.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
2637
2675
|
});
|
|
2638
|
-
function
|
|
2639
|
-
return new
|
|
2676
|
+
function Zs(e, t) {
|
|
2677
|
+
return new $s({
|
|
2640
2678
|
type: "catch",
|
|
2641
2679
|
innerType: e,
|
|
2642
2680
|
catchValue: typeof t == "function" ? t : () => t
|
|
2643
2681
|
});
|
|
2644
2682
|
}
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2683
|
+
const Es = /* @__PURE__ */ a("ZodPipe", (e, t) => {
|
|
2684
|
+
yo.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
|
|
2647
2685
|
});
|
|
2648
|
-
function
|
|
2649
|
-
return new
|
|
2686
|
+
function gt(e, t) {
|
|
2687
|
+
return new Es({
|
|
2650
2688
|
type: "pipe",
|
|
2651
2689
|
in: e,
|
|
2652
2690
|
out: t
|
|
2653
2691
|
// ...util.normalizeParams(params),
|
|
2654
2692
|
});
|
|
2655
2693
|
}
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2694
|
+
const xs = /* @__PURE__ */ a("ZodReadonly", (e, t) => {
|
|
2695
|
+
$o.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2658
2696
|
});
|
|
2659
|
-
function
|
|
2660
|
-
return new
|
|
2697
|
+
function Ts(e) {
|
|
2698
|
+
return new xs({
|
|
2661
2699
|
type: "readonly",
|
|
2662
2700
|
innerType: e
|
|
2663
2701
|
});
|
|
2664
2702
|
}
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2703
|
+
const Ss = /* @__PURE__ */ a("ZodCustom", (e, t) => {
|
|
2704
|
+
Zo.init(e, t), I.init(e, t);
|
|
2667
2705
|
});
|
|
2668
|
-
function
|
|
2669
|
-
return
|
|
2670
|
-
}
|
|
2671
|
-
function
|
|
2672
|
-
return
|
|
2673
|
-
}
|
|
2674
|
-
const
|
|
2675
|
-
title:
|
|
2676
|
-
content:
|
|
2677
|
-
format:
|
|
2678
|
-
metadata:
|
|
2679
|
-
createdAt:
|
|
2680
|
-
updatedAt:
|
|
2681
|
-
wordCount:
|
|
2682
|
-
characterCount:
|
|
2706
|
+
function Is(e, t = {}) {
|
|
2707
|
+
return gi(Ss, e, t);
|
|
2708
|
+
}
|
|
2709
|
+
function js(e) {
|
|
2710
|
+
return _i(e);
|
|
2711
|
+
}
|
|
2712
|
+
const Wt = Te({
|
|
2713
|
+
title: ae().min(1, "Title is required").max(200, "Title too long"),
|
|
2714
|
+
content: ae().min(1, "Content is required"),
|
|
2715
|
+
format: De(["html", "markdown"]).default("html"),
|
|
2716
|
+
metadata: Te({
|
|
2717
|
+
createdAt: ae().datetime(),
|
|
2718
|
+
updatedAt: ae().datetime(),
|
|
2719
|
+
wordCount: lt().min(0),
|
|
2720
|
+
characterCount: lt().min(0)
|
|
2683
2721
|
}).optional()
|
|
2684
2722
|
});
|
|
2685
|
-
|
|
2686
|
-
includeStyles:
|
|
2687
|
-
includeMeta:
|
|
2688
|
-
format:
|
|
2723
|
+
Te({
|
|
2724
|
+
includeStyles: ft().default(!0),
|
|
2725
|
+
includeMeta: ft().default(!0),
|
|
2726
|
+
format: De(["html", "txt"]).default("html")
|
|
2689
2727
|
});
|
|
2690
|
-
const
|
|
2691
|
-
|
|
2728
|
+
const _t = {
|
|
2729
|
+
content: "",
|
|
2730
|
+
title: "Untitled Document",
|
|
2731
|
+
wordCount: 0,
|
|
2732
|
+
characterCount: 0,
|
|
2733
|
+
hasUnsavedChanges: !1,
|
|
2734
|
+
activeFormats: []
|
|
2735
|
+
}, As = (e) => ({
|
|
2736
|
+
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
2737
|
+
characterCount: e.length
|
|
2738
|
+
}), Bt = vn()(
|
|
2739
|
+
kn(
|
|
2740
|
+
(e, t) => ({
|
|
2741
|
+
..._t,
|
|
2742
|
+
updateContent: (n) => {
|
|
2743
|
+
const r = As(n);
|
|
2744
|
+
e({
|
|
2745
|
+
content: n,
|
|
2746
|
+
...r,
|
|
2747
|
+
hasUnsavedChanges: !0
|
|
2748
|
+
});
|
|
2749
|
+
},
|
|
2750
|
+
updateTitle: (n) => {
|
|
2751
|
+
e({
|
|
2752
|
+
title: n,
|
|
2753
|
+
hasUnsavedChanges: !0
|
|
2754
|
+
});
|
|
2755
|
+
},
|
|
2756
|
+
setActiveFormats: (n) => {
|
|
2757
|
+
e({ activeFormats: n });
|
|
2758
|
+
},
|
|
2759
|
+
clearEditor: () => {
|
|
2760
|
+
e({
|
|
2761
|
+
..._t,
|
|
2762
|
+
content: "",
|
|
2763
|
+
title: "Untitled Document"
|
|
2764
|
+
});
|
|
2765
|
+
},
|
|
2766
|
+
setHasUnsavedChanges: (n) => {
|
|
2767
|
+
e({ hasUnsavedChanges: n });
|
|
2768
|
+
},
|
|
2769
|
+
executeCommand: (n, r) => {
|
|
2770
|
+
document.execCommand(n, !1, r);
|
|
2771
|
+
const o = document.querySelector('[contenteditable="true"]');
|
|
2772
|
+
o && o.focus(), setTimeout(() => {
|
|
2773
|
+
t().updateActiveFormats();
|
|
2774
|
+
}, 10);
|
|
2775
|
+
},
|
|
2776
|
+
updateActiveFormats: () => {
|
|
2777
|
+
const n = [
|
|
2778
|
+
"bold",
|
|
2779
|
+
"italic",
|
|
2780
|
+
"underline",
|
|
2781
|
+
"strikeThrough",
|
|
2782
|
+
"justifyLeft",
|
|
2783
|
+
"justifyCenter",
|
|
2784
|
+
"justifyRight"
|
|
2785
|
+
], r = [];
|
|
2786
|
+
n.forEach((o) => {
|
|
2787
|
+
document.queryCommandState(o) && r.push(o);
|
|
2788
|
+
}), e({ activeFormats: r });
|
|
2789
|
+
},
|
|
2790
|
+
getValidationResult: () => {
|
|
2791
|
+
const n = t();
|
|
2792
|
+
try {
|
|
2793
|
+
return { success: !0, data: Wt.parse({
|
|
2794
|
+
title: n.title,
|
|
2795
|
+
content: n.content,
|
|
2796
|
+
metadata: {
|
|
2797
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2798
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2799
|
+
wordCount: n.wordCount,
|
|
2800
|
+
characterCount: n.characterCount
|
|
2801
|
+
}
|
|
2802
|
+
}) };
|
|
2803
|
+
} catch (r) {
|
|
2804
|
+
return { success: !1, error: r instanceof Error ? r.message : "Validation failed" };
|
|
2805
|
+
}
|
|
2806
|
+
},
|
|
2807
|
+
exportToHTML: (n = { includeStyles: !0, includeMeta: !0 }) => {
|
|
2808
|
+
const o = t().getValidationResult();
|
|
2809
|
+
if (!o.success)
|
|
2810
|
+
throw new Error(o.error);
|
|
2811
|
+
const { data: i } = o;
|
|
2812
|
+
let s = `<!DOCTYPE html>
|
|
2813
|
+
<html>
|
|
2814
|
+
<head>
|
|
2815
|
+
<meta charset="UTF-8">
|
|
2816
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2817
|
+
<title>${i?.title}</title>`;
|
|
2818
|
+
return n.includeStyles && (s += `
|
|
2819
|
+
<style>
|
|
2820
|
+
body {
|
|
2821
|
+
font-family: Arial, sans-serif;
|
|
2822
|
+
line-height: 1.6;
|
|
2823
|
+
margin: 40px;
|
|
2824
|
+
max-width: 800px;
|
|
2825
|
+
}
|
|
2826
|
+
.editor-content {
|
|
2827
|
+
border: 1px solid #ddd;
|
|
2828
|
+
padding: 20px;
|
|
2829
|
+
border-radius: 8px;
|
|
2830
|
+
background: white;
|
|
2831
|
+
}
|
|
2832
|
+
</style>`), s += `
|
|
2833
|
+
</head>
|
|
2834
|
+
<body>`, n.includeMeta && (s += `
|
|
2835
|
+
<div class="document-meta">
|
|
2836
|
+
<h1>${i?.title}</h1>
|
|
2837
|
+
<p><small>Created: ${new Date(i?.metadata.createdAt ?? "").toLocaleString()} |
|
|
2838
|
+
Words: ${i?.metadata.wordCount} |
|
|
2839
|
+
Characters: ${i?.metadata.characterCount}</small></p>
|
|
2840
|
+
<hr>
|
|
2841
|
+
</div>`), s += `
|
|
2842
|
+
<div class="editor-content">
|
|
2843
|
+
${i?.content}
|
|
2844
|
+
</div>
|
|
2845
|
+
</body>
|
|
2846
|
+
</html>`, s;
|
|
2847
|
+
}
|
|
2848
|
+
}),
|
|
2849
|
+
{
|
|
2850
|
+
name: "editor-storage",
|
|
2851
|
+
partialize: (e) => ({
|
|
2852
|
+
content: e.content,
|
|
2853
|
+
title: e.title,
|
|
2854
|
+
wordCount: e.wordCount,
|
|
2855
|
+
characterCount: e.characterCount
|
|
2856
|
+
})
|
|
2857
|
+
}
|
|
2858
|
+
)
|
|
2859
|
+
), Cs = ({
|
|
2860
|
+
onSave: e,
|
|
2861
|
+
onExport: t,
|
|
2862
|
+
onClear: n,
|
|
2863
|
+
showButtons: r = !1
|
|
2864
|
+
}) => {
|
|
2865
|
+
const {
|
|
2866
|
+
activeFormats: o,
|
|
2867
|
+
hasUnsavedChanges: i,
|
|
2868
|
+
executeCommand: s,
|
|
2869
|
+
updateActiveFormats: c
|
|
2870
|
+
} = Bt();
|
|
2871
|
+
Ie(() => {
|
|
2872
|
+
const h = () => {
|
|
2873
|
+
c();
|
|
2874
|
+
};
|
|
2875
|
+
return document.addEventListener("selectionchange", h), () => document.removeEventListener("selectionchange", h);
|
|
2876
|
+
}, [c]);
|
|
2877
|
+
const d = () => {
|
|
2878
|
+
const h = prompt("Enter URL:");
|
|
2879
|
+
h && s("createLink", h);
|
|
2880
|
+
}, l = (h) => {
|
|
2881
|
+
s("formatBlock", h);
|
|
2882
|
+
}, f = [
|
|
2883
|
+
{
|
|
2884
|
+
id: "bold",
|
|
2885
|
+
command: "bold",
|
|
2886
|
+
icon: /* @__PURE__ */ _.jsx(Xt, { size: 18 }),
|
|
2887
|
+
title: "Bold",
|
|
2888
|
+
onClick: () => s("bold")
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
id: "italic",
|
|
2892
|
+
command: "italic",
|
|
2893
|
+
icon: /* @__PURE__ */ _.jsx(Kt, { size: 18 }),
|
|
2894
|
+
title: "Italic",
|
|
2895
|
+
onClick: () => s("italic")
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
id: "underline",
|
|
2899
|
+
command: "underline",
|
|
2900
|
+
icon: /* @__PURE__ */ _.jsx(Qt, { size: 18 }),
|
|
2901
|
+
title: "Underline",
|
|
2902
|
+
onClick: () => s("underline")
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
id: "strikeThrough",
|
|
2906
|
+
command: "strikeThrough",
|
|
2907
|
+
icon: /* @__PURE__ */ _.jsx(en, { size: 18 }),
|
|
2908
|
+
title: "Strikethrough",
|
|
2909
|
+
onClick: () => s("strikeThrough")
|
|
2910
|
+
},
|
|
2911
|
+
{ id: "separator-1", separator: !0 },
|
|
2912
|
+
{
|
|
2913
|
+
id: "unordered-list",
|
|
2914
|
+
command: "insertUnorderedList",
|
|
2915
|
+
icon: /* @__PURE__ */ _.jsx(tn, { size: 18 }),
|
|
2916
|
+
title: "Bullet List",
|
|
2917
|
+
onClick: () => s("insertUnorderedList")
|
|
2918
|
+
},
|
|
2919
|
+
{
|
|
2920
|
+
id: "ordered-list",
|
|
2921
|
+
command: "insertOrderedList",
|
|
2922
|
+
icon: /* @__PURE__ */ _.jsx(nn, { size: 18 }),
|
|
2923
|
+
title: "Numbered List",
|
|
2924
|
+
onClick: () => s("insertOrderedList")
|
|
2925
|
+
},
|
|
2926
|
+
{ id: "separator-2", separator: !0 },
|
|
2927
|
+
{
|
|
2928
|
+
id: "heading-1",
|
|
2929
|
+
command: "formatBlock",
|
|
2930
|
+
value: "h1",
|
|
2931
|
+
icon: /* @__PURE__ */ _.jsx(rn, { size: 18 }),
|
|
2932
|
+
title: "Heading 1",
|
|
2933
|
+
onClick: () => l("<h1>")
|
|
2934
|
+
},
|
|
2935
|
+
{
|
|
2936
|
+
id: "heading-2",
|
|
2937
|
+
command: "formatBlock",
|
|
2938
|
+
value: "h2",
|
|
2939
|
+
icon: /* @__PURE__ */ _.jsx(on, { size: 18 }),
|
|
2940
|
+
title: "Heading 2",
|
|
2941
|
+
onClick: () => l("<h2>")
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
id: "paragraph",
|
|
2945
|
+
command: "formatBlock",
|
|
2946
|
+
value: "p",
|
|
2947
|
+
icon: /* @__PURE__ */ _.jsx(sn, { size: 18 }),
|
|
2948
|
+
title: "Paragraph",
|
|
2949
|
+
onClick: () => l("<p>")
|
|
2950
|
+
},
|
|
2951
|
+
{ id: "separator-3", separator: !0 },
|
|
2952
|
+
{
|
|
2953
|
+
id: "align-left",
|
|
2954
|
+
command: "justifyLeft",
|
|
2955
|
+
icon: /* @__PURE__ */ _.jsx(cn, { size: 18 }),
|
|
2956
|
+
title: "Align Left",
|
|
2957
|
+
onClick: () => s("justifyLeft")
|
|
2958
|
+
},
|
|
2959
|
+
{
|
|
2960
|
+
id: "align-center",
|
|
2961
|
+
command: "justifyCenter",
|
|
2962
|
+
icon: /* @__PURE__ */ _.jsx(an, { size: 18 }),
|
|
2963
|
+
title: "Center",
|
|
2964
|
+
onClick: () => s("justifyCenter")
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
id: "align-right",
|
|
2968
|
+
command: "justifyRight",
|
|
2969
|
+
icon: /* @__PURE__ */ _.jsx(un, { size: 18 }),
|
|
2970
|
+
title: "Align Right",
|
|
2971
|
+
onClick: () => s("justifyRight")
|
|
2972
|
+
},
|
|
2973
|
+
{ id: "separator-4", separator: !0 },
|
|
2974
|
+
{
|
|
2975
|
+
id: "link",
|
|
2976
|
+
command: "createLink",
|
|
2977
|
+
icon: /* @__PURE__ */ _.jsx(ln, { size: 18 }),
|
|
2978
|
+
title: "Insert Link",
|
|
2979
|
+
onClick: d
|
|
2980
|
+
}
|
|
2981
|
+
];
|
|
2982
|
+
return /* @__PURE__ */ _.jsxs("div", { className: "flex flex-wrap justify-between items-center p-3 bg-gray-50 border-b border-gray-200", children: [
|
|
2983
|
+
/* @__PURE__ */ _.jsx("div", { className: "flex flex-wrap items-center gap-1", children: f.map((h) => {
|
|
2984
|
+
if ("separator" in h)
|
|
2985
|
+
return /* @__PURE__ */ _.jsx("div", { className: "w-px h-6 bg-gray-300 mx-2" }, h.id);
|
|
2986
|
+
const p = o.includes(h.command);
|
|
2987
|
+
return /* @__PURE__ */ _.jsx(
|
|
2988
|
+
"button",
|
|
2989
|
+
{
|
|
2990
|
+
onClick: h.onClick,
|
|
2991
|
+
title: h.title,
|
|
2992
|
+
type: "button",
|
|
2993
|
+
className: `w-9 h-9 flex items-center justify-center rounded-md border transition-colors duration-200
|
|
2994
|
+
${p ? "bg-blue-100 text-blue-600 border-blue-300 hover:bg-blue-200" : "bg-white border-gray-300 text-gray-700 hover:bg-gray-100"}`,
|
|
2995
|
+
children: h.icon
|
|
2996
|
+
},
|
|
2997
|
+
h.id
|
|
2998
|
+
);
|
|
2999
|
+
}) }),
|
|
3000
|
+
r && /* @__PURE__ */ _.jsxs("div", { className: "flex items-center gap-2 mt-2 sm:mt-0", children: [
|
|
3001
|
+
/* @__PURE__ */ _.jsxs(
|
|
3002
|
+
"button",
|
|
3003
|
+
{
|
|
3004
|
+
onClick: e,
|
|
3005
|
+
disabled: !i,
|
|
3006
|
+
title: "Save Document",
|
|
3007
|
+
className: "flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:bg-blue-300 disabled:cursor-not-allowed transition-colors duration-200",
|
|
3008
|
+
children: [
|
|
3009
|
+
/* @__PURE__ */ _.jsx(Jt, { size: 16 }),
|
|
3010
|
+
/* @__PURE__ */ _.jsx("span", { children: "Save" })
|
|
3011
|
+
]
|
|
3012
|
+
}
|
|
3013
|
+
),
|
|
3014
|
+
/* @__PURE__ */ _.jsxs(
|
|
3015
|
+
"button",
|
|
3016
|
+
{
|
|
3017
|
+
onClick: t,
|
|
3018
|
+
title: "Export as HTML",
|
|
3019
|
+
className: "flex items-center gap-2 px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 transition-colors duration-200",
|
|
3020
|
+
children: [
|
|
3021
|
+
/* @__PURE__ */ _.jsx(Gt, { size: 16 }),
|
|
3022
|
+
/* @__PURE__ */ _.jsx("span", { children: "Export" })
|
|
3023
|
+
]
|
|
3024
|
+
}
|
|
3025
|
+
),
|
|
3026
|
+
/* @__PURE__ */ _.jsxs(
|
|
3027
|
+
"button",
|
|
3028
|
+
{
|
|
3029
|
+
onClick: n,
|
|
3030
|
+
title: "Clear Editor",
|
|
3031
|
+
className: "flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-md hover:bg-red-700 transition-colors duration-200",
|
|
3032
|
+
children: [
|
|
3033
|
+
/* @__PURE__ */ _.jsx(qt, { size: 16 }),
|
|
3034
|
+
/* @__PURE__ */ _.jsx("span", { children: "Clear" })
|
|
3035
|
+
]
|
|
3036
|
+
}
|
|
3037
|
+
)
|
|
3038
|
+
] })
|
|
3039
|
+
] });
|
|
3040
|
+
}, Os = ({
|
|
3041
|
+
wordCount: e,
|
|
3042
|
+
characterCount: t,
|
|
3043
|
+
hasUnsavedChanges: n
|
|
3044
|
+
}) => /* @__PURE__ */ _.jsx("div", { className: "flex justify-between items-center px-5 py-3 bg-gray-50 border-t border-gray-200 text-sm text-gray-600", children: /* @__PURE__ */ _.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
3045
|
+
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3046
|
+
"Words: ",
|
|
3047
|
+
/* @__PURE__ */ _.jsx("strong", { className: "text-gray-800", children: e })
|
|
3048
|
+
] }),
|
|
3049
|
+
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3050
|
+
"Characters: ",
|
|
3051
|
+
/* @__PURE__ */ _.jsx("strong", { className: "text-gray-800", children: t })
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3054
|
+
"Status: ",
|
|
3055
|
+
/* @__PURE__ */ _.jsx("strong", { className: n ? "text-orange-600" : "text-green-600", children: n ? "Unsaved Changes" : "Saved" })
|
|
3056
|
+
] })
|
|
3057
|
+
] }) }), Ns = ({
|
|
3058
|
+
initialContent: e = "",
|
|
3059
|
+
onSave: t,
|
|
3060
|
+
onExport: n,
|
|
3061
|
+
onChange: r,
|
|
3062
|
+
// Add onChange prop
|
|
3063
|
+
showButtons: o = !1,
|
|
3064
|
+
// Add option to hide toolbar
|
|
3065
|
+
showSaveTitle: i = !1,
|
|
3066
|
+
// Add option to hide title section
|
|
3067
|
+
showStatusBar: s = !1
|
|
3068
|
+
// Add option to hide status bar
|
|
3069
|
+
}) => {
|
|
3070
|
+
const c = vt(null), [d, l] = bt(!1), {
|
|
3071
|
+
content: f,
|
|
3072
|
+
title: h,
|
|
3073
|
+
wordCount: p,
|
|
3074
|
+
characterCount: g,
|
|
3075
|
+
hasUnsavedChanges: T,
|
|
3076
|
+
updateContent: b,
|
|
3077
|
+
updateTitle: C,
|
|
3078
|
+
getValidationResult: N,
|
|
3079
|
+
exportToHTML: k,
|
|
3080
|
+
clearEditor: $,
|
|
3081
|
+
setHasUnsavedChanges: z
|
|
3082
|
+
} = Bt();
|
|
3083
|
+
Ie(() => {
|
|
3084
|
+
c.current && e && e !== f && (c.current.innerHTML = e, b(e), z(!1));
|
|
3085
|
+
}, [e, f, b, z]);
|
|
3086
|
+
const P = F(
|
|
3087
|
+
(E) => {
|
|
3088
|
+
if (b(E), z(!0), r) {
|
|
3089
|
+
const D = k();
|
|
3090
|
+
r(E, D);
|
|
3091
|
+
}
|
|
3092
|
+
},
|
|
3093
|
+
[b, z, r, k]
|
|
3094
|
+
), _e = F(
|
|
3095
|
+
(E) => {
|
|
3096
|
+
if (C(E), z(!0), r) {
|
|
3097
|
+
const D = k();
|
|
3098
|
+
r(f, D, E);
|
|
3099
|
+
}
|
|
3100
|
+
},
|
|
3101
|
+
[C, z, r, k, f]
|
|
3102
|
+
), ve = () => {
|
|
3103
|
+
if (N().success) {
|
|
3104
|
+
const D = k();
|
|
3105
|
+
t?.(f, D), z(!1);
|
|
3106
|
+
} else
|
|
3107
|
+
l(!0), setTimeout(() => l(!1), 3e3);
|
|
3108
|
+
}, be = () => {
|
|
3109
|
+
try {
|
|
3110
|
+
const E = k();
|
|
3111
|
+
n?.(E);
|
|
3112
|
+
const D = new Blob([E], { type: "text/html" }), Y = URL.createObjectURL(D), U = document.createElement("a");
|
|
3113
|
+
U.href = Y, U.download = `${h.replace(/\s+/g, "_")}.html`, document.body.appendChild(U), U.click(), document.body.removeChild(U), URL.revokeObjectURL(Y);
|
|
3114
|
+
} catch (E) {
|
|
3115
|
+
alert(
|
|
3116
|
+
"Export failed: " + (E instanceof Error ? E.message : "Unknown error")
|
|
3117
|
+
);
|
|
3118
|
+
}
|
|
3119
|
+
}, q = () => {
|
|
3120
|
+
confirm(
|
|
3121
|
+
"Are you sure you want to clear the editor? All unsaved changes will be lost."
|
|
3122
|
+
) && ($(), c.current && (c.current.innerHTML = ""), r && r("", ""));
|
|
3123
|
+
};
|
|
3124
|
+
return /* @__PURE__ */ _.jsxs("div", { className: "w-full max-w-6xl mx-auto bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden", children: [
|
|
3125
|
+
i && /* @__PURE__ */ _.jsxs("div", { className: "p-6 border-b border-gray-200 bg-gray-50 rounded-t-xl", children: [
|
|
3126
|
+
/* @__PURE__ */ _.jsx(
|
|
3127
|
+
"input",
|
|
3128
|
+
{
|
|
3129
|
+
type: "text",
|
|
3130
|
+
className: "w-full bg-transparent text-2xl font-bold text-gray-800 placeholder-gray-500 outline-none border-none focus:ring-0",
|
|
3131
|
+
value: h,
|
|
3132
|
+
onChange: (E) => _e(E.target.value),
|
|
3133
|
+
placeholder: "Document Title"
|
|
3134
|
+
}
|
|
3135
|
+
),
|
|
3136
|
+
d && /* @__PURE__ */ _.jsx("div", { className: "mt-2 px-3 py-2 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm animate-pulse", children: "Please add content before saving" })
|
|
3137
|
+
] }),
|
|
3138
|
+
/* @__PURE__ */ _.jsx(
|
|
3139
|
+
Cs,
|
|
3140
|
+
{
|
|
3141
|
+
onSave: ve,
|
|
3142
|
+
onExport: be,
|
|
3143
|
+
onClear: q,
|
|
3144
|
+
showButtons: o
|
|
3145
|
+
}
|
|
3146
|
+
),
|
|
3147
|
+
/* @__PURE__ */ _.jsx(
|
|
3148
|
+
"div",
|
|
3149
|
+
{
|
|
3150
|
+
ref: c,
|
|
3151
|
+
className: `min-h-[500px] p-8 prose max-w-none border-none outline-none resize-none text-gray-700 leading-relaxed bg-white focus:bg-gray-50 transition-colors duration-200 ${i ? "rounded-t-xl" : ""} ${o ? "border-t-0" : ""}`,
|
|
3152
|
+
contentEditable: !0,
|
|
3153
|
+
onInput: (E) => P(E.currentTarget.innerHTML),
|
|
3154
|
+
onFocus: (E) => E.currentTarget.classList.add("bg-gray-50"),
|
|
3155
|
+
onBlur: (E) => E.currentTarget.classList.remove("bg-gray-50")
|
|
3156
|
+
}
|
|
3157
|
+
),
|
|
3158
|
+
s && /* @__PURE__ */ _.jsx(
|
|
3159
|
+
Os,
|
|
3160
|
+
{
|
|
3161
|
+
wordCount: p,
|
|
3162
|
+
characterCount: g,
|
|
3163
|
+
hasUnsavedChanges: T
|
|
3164
|
+
}
|
|
3165
|
+
)
|
|
3166
|
+
] });
|
|
3167
|
+
}, Ds = (e = "") => {
|
|
3168
|
+
const [t, n] = bt({
|
|
2692
3169
|
content: e,
|
|
2693
3170
|
title: "Untitled Document",
|
|
2694
3171
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
2695
3172
|
characterCount: e.length,
|
|
2696
3173
|
hasUnsavedChanges: !1
|
|
2697
|
-
}), r =
|
|
2698
|
-
|
|
2699
|
-
r.current && e !== t.content && (r.current.innerHTML = e, n((
|
|
2700
|
-
...
|
|
3174
|
+
}), r = vt(null);
|
|
3175
|
+
Ie(() => {
|
|
3176
|
+
r.current && e !== t.content && (r.current.innerHTML = e, n((f) => ({
|
|
3177
|
+
...f,
|
|
2701
3178
|
content: e,
|
|
2702
3179
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
2703
3180
|
characterCount: e.length
|
|
2704
3181
|
})));
|
|
2705
3182
|
}, [e]);
|
|
2706
|
-
const o =
|
|
2707
|
-
const
|
|
2708
|
-
n((
|
|
2709
|
-
...
|
|
2710
|
-
content:
|
|
2711
|
-
wordCount:
|
|
3183
|
+
const o = F((f) => {
|
|
3184
|
+
const h = f.trim() ? f.trim().split(/\s+/).length : 0, p = f.length;
|
|
3185
|
+
n((g) => ({
|
|
3186
|
+
...g,
|
|
3187
|
+
content: f,
|
|
3188
|
+
wordCount: h,
|
|
2712
3189
|
characterCount: p,
|
|
2713
3190
|
hasUnsavedChanges: !0
|
|
2714
3191
|
}));
|
|
2715
|
-
}, []), i =
|
|
2716
|
-
n((
|
|
2717
|
-
...
|
|
2718
|
-
title:
|
|
3192
|
+
}, []), i = F((f) => {
|
|
3193
|
+
n((h) => ({
|
|
3194
|
+
...h,
|
|
3195
|
+
title: f,
|
|
2719
3196
|
hasUnsavedChanges: !0
|
|
2720
3197
|
}));
|
|
2721
|
-
}, []),
|
|
2722
|
-
document.execCommand(
|
|
2723
|
-
}, []),
|
|
3198
|
+
}, []), s = F((f, h) => {
|
|
3199
|
+
document.execCommand(f, !1, h), r.current?.focus();
|
|
3200
|
+
}, []), c = F(() => {
|
|
2724
3201
|
try {
|
|
2725
|
-
return { success: !0, data:
|
|
3202
|
+
return { success: !0, data: Wt.parse({
|
|
2726
3203
|
title: t.title,
|
|
2727
3204
|
content: t.content,
|
|
2728
3205
|
metadata: {
|
|
@@ -2732,22 +3209,22 @@ const zc = (e = "") => {
|
|
|
2732
3209
|
characterCount: t.characterCount
|
|
2733
3210
|
}
|
|
2734
3211
|
}) };
|
|
2735
|
-
} catch (
|
|
2736
|
-
return { success: !1, error:
|
|
3212
|
+
} catch (f) {
|
|
3213
|
+
return { success: !1, error: f instanceof Error ? f.message : "Validation failed" };
|
|
2737
3214
|
}
|
|
2738
|
-
}, [t]),
|
|
2739
|
-
(
|
|
2740
|
-
const
|
|
2741
|
-
if (!
|
|
2742
|
-
throw new Error(
|
|
2743
|
-
const { data: p } =
|
|
2744
|
-
let
|
|
3215
|
+
}, [t]), d = F(
|
|
3216
|
+
(f = { includeStyles: !0, includeMeta: !0 }) => {
|
|
3217
|
+
const h = c();
|
|
3218
|
+
if (!h.success)
|
|
3219
|
+
throw new Error(h.error);
|
|
3220
|
+
const { data: p } = h;
|
|
3221
|
+
let g = `<!DOCTYPE html>
|
|
2745
3222
|
<html>
|
|
2746
3223
|
<head>
|
|
2747
3224
|
<meta charset="UTF-8">
|
|
2748
3225
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2749
3226
|
<title>${p?.title}</title>`;
|
|
2750
|
-
return
|
|
3227
|
+
return f.includeStyles && (g += `
|
|
2751
3228
|
<style>
|
|
2752
3229
|
body {
|
|
2753
3230
|
font-family: Arial, sans-serif;
|
|
@@ -2761,24 +3238,24 @@ const zc = (e = "") => {
|
|
|
2761
3238
|
border-radius: 8px;
|
|
2762
3239
|
background: white;
|
|
2763
3240
|
}
|
|
2764
|
-
</style>`),
|
|
3241
|
+
</style>`), g += `
|
|
2765
3242
|
</head>
|
|
2766
|
-
<body>`,
|
|
3243
|
+
<body>`, f.includeMeta && (g += `
|
|
2767
3244
|
<div class="document-meta">
|
|
2768
3245
|
<h1>${p?.title}</h1>
|
|
2769
3246
|
<p><small>Created: ${new Date(p?.metadata.createdAt ?? "").toLocaleString()} |
|
|
2770
3247
|
Words: ${p?.metadata.wordCount} |
|
|
2771
3248
|
Characters: ${p?.metadata.characterCount}</small></p>
|
|
2772
3249
|
<hr>
|
|
2773
|
-
</div>`),
|
|
3250
|
+
</div>`), g += `
|
|
2774
3251
|
<div class="editor-content">
|
|
2775
3252
|
${p?.content}
|
|
2776
3253
|
</div>
|
|
2777
3254
|
</body>
|
|
2778
|
-
</html>`,
|
|
3255
|
+
</html>`, g;
|
|
2779
3256
|
},
|
|
2780
|
-
[
|
|
2781
|
-
),
|
|
3257
|
+
[c]
|
|
3258
|
+
), l = F(() => {
|
|
2782
3259
|
n({
|
|
2783
3260
|
content: "",
|
|
2784
3261
|
title: "Untitled Document",
|
|
@@ -2792,87 +3269,13 @@ const zc = (e = "") => {
|
|
|
2792
3269
|
editorRef: r,
|
|
2793
3270
|
updateContent: o,
|
|
2794
3271
|
updateTitle: i,
|
|
2795
|
-
executeCommand:
|
|
2796
|
-
getValidationResult:
|
|
2797
|
-
exportToHTML: f,
|
|
2798
|
-
clearEditor: d
|
|
2799
|
-
};
|
|
2800
|
-
}, Zc = ({
|
|
2801
|
-
initialContent: e = "",
|
|
2802
|
-
onSave: t,
|
|
2803
|
-
onExport: n
|
|
2804
|
-
}) => {
|
|
2805
|
-
const {
|
|
2806
|
-
editorState: r,
|
|
2807
|
-
editorRef: o,
|
|
2808
|
-
updateContent: i,
|
|
2809
|
-
updateTitle: c,
|
|
2810
|
-
executeCommand: a,
|
|
2811
|
-
getValidationResult: f,
|
|
3272
|
+
executeCommand: s,
|
|
3273
|
+
getValidationResult: c,
|
|
2812
3274
|
exportToHTML: d,
|
|
2813
3275
|
clearEditor: l
|
|
2814
|
-
} = zc(e), [g, p] = ze(!1), v = () => {
|
|
2815
|
-
if (f().success) {
|
|
2816
|
-
const P = d();
|
|
2817
|
-
t?.(r.content, P);
|
|
2818
|
-
} else
|
|
2819
|
-
p(!0), setTimeout(() => p(!1), 3e3);
|
|
2820
|
-
}, x = () => {
|
|
2821
|
-
try {
|
|
2822
|
-
const T = d();
|
|
2823
|
-
n?.(T);
|
|
2824
|
-
const P = new Blob([T], { type: "text/html" }), L = URL.createObjectURL(P), A = document.createElement("a");
|
|
2825
|
-
A.href = L, A.download = `${r.title.replace(/\s+/g, "_")}.html`, document.body.appendChild(A), A.click(), document.body.removeChild(A), URL.revokeObjectURL(L);
|
|
2826
|
-
} catch (T) {
|
|
2827
|
-
alert("Export failed: " + (T instanceof Error ? T.message : "Unknown error"));
|
|
2828
|
-
}
|
|
2829
|
-
}, R = () => {
|
|
2830
|
-
confirm("Are you sure you want to clear the editor? All unsaved changes will be lost.") && l();
|
|
2831
3276
|
};
|
|
2832
|
-
return /* @__PURE__ */ m.jsxs("div", { className: "w-full max-w-6xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden", children: [
|
|
2833
|
-
/* @__PURE__ */ m.jsxs("div", { className: "p-6 border-b border-gray-200 bg-gray-50", children: [
|
|
2834
|
-
/* @__PURE__ */ m.jsx(
|
|
2835
|
-
"input",
|
|
2836
|
-
{
|
|
2837
|
-
type: "text",
|
|
2838
|
-
className: "w-full bg-transparent text-2xl font-bold text-gray-800 outline-none placeholder-gray-400",
|
|
2839
|
-
value: r.title,
|
|
2840
|
-
onChange: (T) => c(T.target.value),
|
|
2841
|
-
placeholder: "Document Title"
|
|
2842
|
-
}
|
|
2843
|
-
),
|
|
2844
|
-
g && /* @__PURE__ */ m.jsx("div", { className: "text-red-600 text-sm mt-2 animate-fadeIn", children: "Please add content before saving" })
|
|
2845
|
-
] }),
|
|
2846
|
-
/* @__PURE__ */ m.jsx(
|
|
2847
|
-
un,
|
|
2848
|
-
{
|
|
2849
|
-
onCommand: a,
|
|
2850
|
-
onSave: v,
|
|
2851
|
-
onExport: x,
|
|
2852
|
-
onClear: R,
|
|
2853
|
-
hasUnsavedChanges: r.hasUnsavedChanges
|
|
2854
|
-
}
|
|
2855
|
-
),
|
|
2856
|
-
/* @__PURE__ */ m.jsx(
|
|
2857
|
-
"div",
|
|
2858
|
-
{
|
|
2859
|
-
ref: o,
|
|
2860
|
-
className: "editor-content min-h-[500px] p-8 border-none outline-none resize-none text-gray-700 leading-relaxed prose max-w-none",
|
|
2861
|
-
contentEditable: !0,
|
|
2862
|
-
onInput: (T) => i(T.currentTarget.innerHTML)
|
|
2863
|
-
}
|
|
2864
|
-
),
|
|
2865
|
-
/* @__PURE__ */ m.jsx(
|
|
2866
|
-
ln,
|
|
2867
|
-
{
|
|
2868
|
-
wordCount: r.wordCount,
|
|
2869
|
-
characterCount: r.characterCount,
|
|
2870
|
-
hasUnsavedChanges: r.hasUnsavedChanges
|
|
2871
|
-
}
|
|
2872
|
-
)
|
|
2873
|
-
] });
|
|
2874
3277
|
};
|
|
2875
3278
|
export {
|
|
2876
|
-
|
|
2877
|
-
|
|
3279
|
+
Ns as TextEditor,
|
|
3280
|
+
Ds as useTextEditor
|
|
2878
3281
|
};
|