@ericbutera/kaleido 0.1.7 → 0.1.12
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/components/admin/adminLayoutConfig.d.ts +9 -0
- package/dist/components/common/GenericList.d.ts +1 -1
- package/dist/components/featureFlags/FeatureFlagStatus.d.ts +9 -0
- package/dist/featureFlags/defaults.d.ts +3 -0
- package/dist/featureFlags/index.d.ts +2 -0
- package/dist/featureFlags/useFeatureFlag.d.ts +86 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1423 -1213
- package/dist/pages/admin/FeatureFlags.d.ts +1 -0
- package/dist/pages/index.d.ts +1 -0
- package/package.json +72 -72
- package/dist/auth/lib/featureFlags.d.ts +0 -21
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
|
|
1
|
+
import D, { createContext as vr, useContext as zt, useEffect as Me, useState as se, useRef as yr, useMemo as xr } from "react";
|
|
2
|
+
import ct from "react-hot-toast";
|
|
3
|
+
import { faEnvelope as _r, faRightToBracket as br, faStore as wr, faSort as jr, faSortUp as Nr, faSortDown as kr } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import { FontAwesomeIcon as je } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { useLocation as dt, Link as ne, useNavigate as Ne, useSearchParams as ut } from "react-router-dom";
|
|
6
|
+
import { useForm as Fe } from "react-hook-form";
|
|
7
|
+
var De = { exports: {} }, Ae = {};
|
|
8
|
+
var vt;
|
|
9
|
+
function Er() {
|
|
10
|
+
if (vt) return Ae;
|
|
11
|
+
vt = 1;
|
|
12
12
|
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
13
13
|
function t(s, n, a) {
|
|
14
14
|
var d = null;
|
|
@@ -25,12 +25,12 @@ function vr() {
|
|
|
25
25
|
props: a
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return Ae.Fragment = e, Ae.jsx = t, Ae.jsxs = t, Ae;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
function
|
|
33
|
-
return
|
|
30
|
+
var Re = {};
|
|
31
|
+
var yt;
|
|
32
|
+
function Cr() {
|
|
33
|
+
return yt || (yt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
34
34
|
function r(m) {
|
|
35
35
|
if (m == null) return null;
|
|
36
36
|
if (typeof m == "function")
|
|
@@ -39,7 +39,7 @@ function _r() {
|
|
|
39
39
|
switch (m) {
|
|
40
40
|
case x:
|
|
41
41
|
return "Fragment";
|
|
42
|
-
case
|
|
42
|
+
case A:
|
|
43
43
|
return "Profiler";
|
|
44
44
|
case M:
|
|
45
45
|
return "StrictMode";
|
|
@@ -47,7 +47,7 @@ function _r() {
|
|
|
47
47
|
return "Suspense";
|
|
48
48
|
case B:
|
|
49
49
|
return "SuspenseList";
|
|
50
|
-
case
|
|
50
|
+
case de:
|
|
51
51
|
return "Activity";
|
|
52
52
|
}
|
|
53
53
|
if (typeof m == "object")
|
|
@@ -58,14 +58,14 @@ function _r() {
|
|
|
58
58
|
return "Portal";
|
|
59
59
|
case I:
|
|
60
60
|
return m.displayName || "Context";
|
|
61
|
-
case
|
|
61
|
+
case j:
|
|
62
62
|
return (m._context.displayName || "Context") + ".Consumer";
|
|
63
63
|
case L:
|
|
64
64
|
var E = m.render;
|
|
65
65
|
return m = m.displayName, m || (m = E.displayName || E.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m;
|
|
66
66
|
case W:
|
|
67
67
|
return E = m.displayName || null, E !== null ? E : r(m.type) || "Memo";
|
|
68
|
-
case
|
|
68
|
+
case H:
|
|
69
69
|
E = m._payload, m = m._init;
|
|
70
70
|
try {
|
|
71
71
|
return r(m(E));
|
|
@@ -86,17 +86,17 @@ function _r() {
|
|
|
86
86
|
}
|
|
87
87
|
if (E) {
|
|
88
88
|
E = console;
|
|
89
|
-
var $ = E.error,
|
|
89
|
+
var $ = E.error, Z = typeof Symbol == "function" && Symbol.toStringTag && m[Symbol.toStringTag] || m.constructor.name || "Object";
|
|
90
90
|
return $.call(
|
|
91
91
|
E,
|
|
92
92
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
93
|
-
|
|
93
|
+
Z
|
|
94
94
|
), e(m);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
function s(m) {
|
|
98
98
|
if (m === x) return "<>";
|
|
99
|
-
if (typeof m == "object" && m !== null && m.$$typeof ===
|
|
99
|
+
if (typeof m == "object" && m !== null && m.$$typeof === H)
|
|
100
100
|
return "<...>";
|
|
101
101
|
try {
|
|
102
102
|
var E = r(m);
|
|
@@ -133,18 +133,18 @@ function _r() {
|
|
|
133
133
|
}
|
|
134
134
|
function i() {
|
|
135
135
|
var m = r(this.type);
|
|
136
|
-
return
|
|
136
|
+
return te[m] || (te[m] = !0, console.error(
|
|
137
137
|
"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."
|
|
138
138
|
)), m = this.props.ref, m !== void 0 ? m : null;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function l(m, E, $, Z, Ze, He) {
|
|
141
141
|
var V = $.ref;
|
|
142
142
|
return m = {
|
|
143
|
-
$$typeof:
|
|
143
|
+
$$typeof: v,
|
|
144
144
|
type: m,
|
|
145
145
|
key: E,
|
|
146
146
|
props: $,
|
|
147
|
-
_owner:
|
|
147
|
+
_owner: Z
|
|
148
148
|
}, (V !== void 0 ? V : null) !== null ? Object.defineProperty(m, "ref", {
|
|
149
149
|
enumerable: !1,
|
|
150
150
|
get: i
|
|
@@ -162,7 +162,7 @@ function _r() {
|
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
165
|
+
value: Ze
|
|
166
166
|
}), Object.defineProperty(m, "_debugTask", {
|
|
167
167
|
configurable: !1,
|
|
168
168
|
enumerable: !1,
|
|
@@ -170,13 +170,13 @@ function _r() {
|
|
|
170
170
|
value: He
|
|
171
171
|
}), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function c(m, E, $, Z, Ze, He) {
|
|
174
174
|
var V = E.children;
|
|
175
175
|
if (V !== void 0)
|
|
176
|
-
if (
|
|
177
|
-
if (
|
|
178
|
-
for (
|
|
179
|
-
f(V[
|
|
176
|
+
if (Z)
|
|
177
|
+
if (G(V)) {
|
|
178
|
+
for (Z = 0; Z < V.length; Z++)
|
|
179
|
+
f(V[Z]);
|
|
180
180
|
Object.freeze && Object.freeze(V);
|
|
181
181
|
} else
|
|
182
182
|
console.error(
|
|
@@ -185,46 +185,46 @@ function _r() {
|
|
|
185
185
|
else f(V);
|
|
186
186
|
if (Y.call(E, "key")) {
|
|
187
187
|
V = r(m);
|
|
188
|
-
var
|
|
189
|
-
return
|
|
188
|
+
var pe = Object.keys(E).filter(function(gr) {
|
|
189
|
+
return gr !== "key";
|
|
190
190
|
});
|
|
191
|
-
|
|
191
|
+
Z = 0 < pe.length ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}", Se[V + Z] || (pe = 0 < pe.length ? "{" + pe.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
192
192
|
`A props object containing a "key" prop is being spread into JSX:
|
|
193
193
|
let props = %s;
|
|
194
194
|
<%s {...props} />
|
|
195
195
|
React keys must be passed directly to JSX without using spread:
|
|
196
196
|
let props = %s;
|
|
197
197
|
<%s key={someKey} {...props} />`,
|
|
198
|
-
|
|
198
|
+
Z,
|
|
199
199
|
V,
|
|
200
|
-
|
|
200
|
+
pe,
|
|
201
201
|
V
|
|
202
|
-
),
|
|
202
|
+
), Se[V + Z] = !0);
|
|
203
203
|
}
|
|
204
204
|
if (V = null, $ !== void 0 && (t($), V = "" + $), d(E) && (t(E.key), V = "" + E.key), "key" in E) {
|
|
205
205
|
$ = {};
|
|
206
|
-
for (var
|
|
207
|
-
|
|
206
|
+
for (var Je in E)
|
|
207
|
+
Je !== "key" && ($[Je] = E[Je]);
|
|
208
208
|
} else $ = E;
|
|
209
209
|
return V && u(
|
|
210
210
|
$,
|
|
211
211
|
typeof m == "function" ? m.displayName || m.name || "Unknown" : m
|
|
212
|
-
),
|
|
212
|
+
), l(
|
|
213
213
|
m,
|
|
214
214
|
V,
|
|
215
215
|
$,
|
|
216
216
|
n(),
|
|
217
|
-
|
|
217
|
+
Ze,
|
|
218
218
|
He
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
function f(m) {
|
|
222
|
-
h(m) ? m._store && (m._store.validated = 1) : typeof m == "object" && m !== null && m.$$typeof ===
|
|
222
|
+
h(m) ? m._store && (m._store.validated = 1) : typeof m == "object" && m !== null && m.$$typeof === H && (m._payload.status === "fulfilled" ? h(m._payload.value) && m._payload.value._store && (m._payload.value._store.validated = 1) : m._store && (m._store.validated = 1));
|
|
223
223
|
}
|
|
224
224
|
function h(m) {
|
|
225
|
-
return typeof m == "object" && m !== null && m.$$typeof ===
|
|
225
|
+
return typeof m == "object" && m !== null && m.$$typeof === v;
|
|
226
226
|
}
|
|
227
|
-
var p =
|
|
227
|
+
var p = D, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), M = /* @__PURE__ */ Symbol.for("react.strict_mode"), A = /* @__PURE__ */ Symbol.for("react.profiler"), j = /* @__PURE__ */ Symbol.for("react.consumer"), I = /* @__PURE__ */ Symbol.for("react.context"), L = /* @__PURE__ */ Symbol.for("react.forward_ref"), O = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), W = /* @__PURE__ */ Symbol.for("react.memo"), H = /* @__PURE__ */ Symbol.for("react.lazy"), de = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), P = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, G = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
228
228
|
return null;
|
|
229
229
|
};
|
|
230
230
|
p = {
|
|
@@ -232,40 +232,40 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
return m();
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
|
-
var ke,
|
|
235
|
+
var ke, te = {}, Ee = p.react_stack_bottom_frame.bind(
|
|
236
236
|
p,
|
|
237
237
|
a
|
|
238
|
-
)(),
|
|
239
|
-
|
|
240
|
-
var
|
|
241
|
-
return
|
|
238
|
+
)(), Ce = U(s(a)), Se = {};
|
|
239
|
+
Re.Fragment = x, Re.jsx = function(m, E, $) {
|
|
240
|
+
var Z = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
241
|
+
return c(
|
|
242
242
|
m,
|
|
243
243
|
E,
|
|
244
244
|
$,
|
|
245
245
|
!1,
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
Z ? Error("react-stack-top-frame") : Ee,
|
|
247
|
+
Z ? U(s(m)) : Ce
|
|
248
248
|
);
|
|
249
|
-
},
|
|
250
|
-
var
|
|
251
|
-
return
|
|
249
|
+
}, Re.jsxs = function(m, E, $) {
|
|
250
|
+
var Z = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
251
|
+
return c(
|
|
252
252
|
m,
|
|
253
253
|
E,
|
|
254
254
|
$,
|
|
255
255
|
!0,
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
Z ? Error("react-stack-top-frame") : Ee,
|
|
257
|
+
Z ? U(s(m)) : Ce
|
|
258
258
|
);
|
|
259
259
|
};
|
|
260
|
-
})()),
|
|
260
|
+
})()), Re;
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
function
|
|
264
|
-
return
|
|
262
|
+
var xt;
|
|
263
|
+
function Sr() {
|
|
264
|
+
return xt || (xt = 1, process.env.NODE_ENV === "production" ? De.exports = Er() : De.exports = Cr()), De.exports;
|
|
265
265
|
}
|
|
266
|
-
var
|
|
267
|
-
const
|
|
268
|
-
function
|
|
266
|
+
var o = Sr();
|
|
267
|
+
const ft = vr(null);
|
|
268
|
+
function Ar({
|
|
269
269
|
client: r,
|
|
270
270
|
config: e = {},
|
|
271
271
|
children: t
|
|
@@ -275,25 +275,25 @@ function br({
|
|
|
275
275
|
registrationEnabled: !0,
|
|
276
276
|
OAuthButton: void 0
|
|
277
277
|
}, ...e };
|
|
278
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ o.jsx(ft.Provider, { value: { client: r, config: n }, children: t });
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
const r =
|
|
280
|
+
function le() {
|
|
281
|
+
const r = zt(ft);
|
|
282
282
|
if (!r)
|
|
283
283
|
throw new Error(
|
|
284
284
|
"useAuthApi must be used within AuthProvider. Wrap your app with <AuthProvider client={yourApiClient}>"
|
|
285
285
|
);
|
|
286
286
|
return r.client;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
const r =
|
|
288
|
+
function Ut() {
|
|
289
|
+
const r = zt(ft);
|
|
290
290
|
if (!r)
|
|
291
291
|
throw new Error(
|
|
292
292
|
"useAuthConfig must be used within AuthProvider. Wrap your app with <AuthProvider client={yourApiClient}>"
|
|
293
293
|
);
|
|
294
294
|
return r.config;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function ht(r, e, t = "An error occurred", s = !0) {
|
|
297
297
|
const n = r;
|
|
298
298
|
if (n?.errors && Object.entries(n.errors).forEach(([a, d]) => {
|
|
299
299
|
e(a, {
|
|
@@ -302,66 +302,84 @@ function lt(r, e, t = "An error occurred", s = !0) {
|
|
|
302
302
|
});
|
|
303
303
|
}), s) {
|
|
304
304
|
const a = n?.message || t;
|
|
305
|
-
|
|
305
|
+
ct.error(a);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function Vt(r, e, t = "/") {
|
|
309
309
|
const s = new URLSearchParams(e.search), n = s.get("origin") || s.get("redirect");
|
|
310
310
|
r(n || t, { replace: !0 });
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return /* @__PURE__ */
|
|
312
|
+
function ce({ children: r }) {
|
|
313
|
+
return /* @__PURE__ */ o.jsx("div", { className: "min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/10 to-secondary/10", children: /* @__PURE__ */ o.jsx("div", { className: "card bg-base-100 shadow-soft hover:shadow-medium transition-shadow border border-base-300 w-full max-w-md mx-4", children: /* @__PURE__ */ o.jsx("div", { className: "card-body p-8", children: r }) }) });
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
315
|
+
function Rr() {
|
|
316
|
+
const e = dt().state.email;
|
|
317
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
318
|
+
/* @__PURE__ */ o.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
319
|
+
/* @__PURE__ */ o.jsx(je, { icon: _r }),
|
|
320
|
+
"Check Your Email"
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ o.jsxs("div", { className: "mt-4 text-sm text-center", children: [
|
|
323
|
+
/* @__PURE__ */ o.jsxs("p", { children: [
|
|
324
|
+
"We've sent a confirmation link to ",
|
|
325
|
+
/* @__PURE__ */ o.jsx("strong", { children: e }),
|
|
326
|
+
"."
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ o.jsx("p", { className: "mt-2", children: "Click the link in the email to activate your account." })
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ o.jsx("div", { className: "divider" }),
|
|
331
|
+
/* @__PURE__ */ o.jsxs("div", { className: "join w-full justify-center", children: [
|
|
332
|
+
/* @__PURE__ */ o.jsx(
|
|
333
|
+
ne,
|
|
334
|
+
{
|
|
335
|
+
to: "/resend-confirmation",
|
|
336
|
+
state: { email: e },
|
|
337
|
+
className: "btn join-item",
|
|
338
|
+
title: "Didn't receive the email?",
|
|
339
|
+
children: "Resend Confirmation"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ o.jsx(ne, { to: "/", className: "btn join-item", children: "Home" })
|
|
343
|
+
] })
|
|
326
344
|
] });
|
|
327
345
|
}
|
|
328
|
-
function
|
|
329
|
-
const { register: r, handleSubmit: e } =
|
|
346
|
+
function Tr() {
|
|
347
|
+
const { register: r, handleSubmit: e } = Fe({
|
|
330
348
|
defaultValues: { email: "" }
|
|
331
|
-
}), { useForgotPassword: t } =
|
|
349
|
+
}), { useForgotPassword: t } = le(), s = t(), n = async (a) => {
|
|
332
350
|
try {
|
|
333
351
|
await s.mutateAsync(a.email);
|
|
334
352
|
} catch {
|
|
335
353
|
}
|
|
336
354
|
};
|
|
337
|
-
return /* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
356
|
+
/* @__PURE__ */ o.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Forgot Password" }),
|
|
357
|
+
/* @__PURE__ */ o.jsxs("form", { onSubmit: e(n), children: [
|
|
358
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", children: "Email" }),
|
|
359
|
+
/* @__PURE__ */ o.jsx(
|
|
342
360
|
"input",
|
|
343
361
|
{
|
|
344
362
|
className: "input input-bordered w-full",
|
|
345
363
|
...r("email", { required: !0 })
|
|
346
364
|
}
|
|
347
365
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ o.jsx("button", { className: "btn btn-primary mt-4", children: "Send Reset" })
|
|
349
367
|
] })
|
|
350
368
|
] });
|
|
351
369
|
}
|
|
352
|
-
function
|
|
370
|
+
function Or() {
|
|
353
371
|
const {
|
|
354
372
|
register: r,
|
|
355
373
|
handleSubmit: e,
|
|
356
374
|
setError: t,
|
|
357
375
|
formState: { errors: s, isSubmitting: n }
|
|
358
|
-
} =
|
|
376
|
+
} = Fe({
|
|
359
377
|
defaultValues: { email: "", password: "" }
|
|
360
|
-
}), a =
|
|
361
|
-
|
|
362
|
-
p &&
|
|
378
|
+
}), a = Ne(), d = dt(), { useLoginUser: u, useCurrentUser: i } = le(), { oauthEnabled: l, registrationEnabled: c, OAuthButton: f } = Ut(), h = u(), { user: p } = i();
|
|
379
|
+
Me(() => {
|
|
380
|
+
p && Vt(a, d);
|
|
363
381
|
}, [p, a, d]);
|
|
364
|
-
const
|
|
382
|
+
const v = async (w) => {
|
|
365
383
|
try {
|
|
366
384
|
await h.mutateAsync(w, t), a("/");
|
|
367
385
|
} catch (x) {
|
|
@@ -372,30 +390,30 @@ function jr() {
|
|
|
372
390
|
message: "Invalid email or password"
|
|
373
391
|
});
|
|
374
392
|
else if (M == 422) {
|
|
375
|
-
const
|
|
376
|
-
t("root", { type: "server", message:
|
|
393
|
+
const A = x?.response?.data, j = A && (A.error || A.message) || "Too many login attempts. Please try again later.";
|
|
394
|
+
t("root", { type: "server", message: j });
|
|
377
395
|
} else {
|
|
378
|
-
const
|
|
379
|
-
|
|
396
|
+
const A = x?.response?.data ?? x;
|
|
397
|
+
ht(A, t, "Failed to sign in");
|
|
380
398
|
}
|
|
381
399
|
}
|
|
382
400
|
};
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
401
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
402
|
+
/* @__PURE__ */ o.jsxs("div", { className: "text-center mb-6", children: [
|
|
403
|
+
/* @__PURE__ */ o.jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 bg-primary/10 rounded-full mb-4", children: /* @__PURE__ */ o.jsx(
|
|
404
|
+
je,
|
|
387
405
|
{
|
|
388
|
-
icon:
|
|
406
|
+
icon: br,
|
|
389
407
|
className: "text-3xl text-primary"
|
|
390
408
|
}
|
|
391
409
|
) }),
|
|
392
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ o.jsx("h2", { className: "text-3xl font-bold mb-2", children: "Welcome Back" })
|
|
393
411
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
s.root && /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ o.jsxs("form", { onSubmit: e(v), children: [
|
|
413
|
+
s.root && /* @__PURE__ */ o.jsx("div", { className: "alert alert-error alert-soft mb-4", children: /* @__PURE__ */ o.jsx("span", { children: s.root.message }) }),
|
|
414
|
+
/* @__PURE__ */ o.jsxs("fieldset", { className: "fieldset", children: [
|
|
415
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", htmlFor: "login-email", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Email" }) }),
|
|
416
|
+
/* @__PURE__ */ o.jsx(
|
|
399
417
|
"input",
|
|
400
418
|
{
|
|
401
419
|
id: "login-email",
|
|
@@ -405,9 +423,9 @@ function jr() {
|
|
|
405
423
|
...r("email", { required: "Email is required" })
|
|
406
424
|
}
|
|
407
425
|
),
|
|
408
|
-
s.email && /* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
/* @__PURE__ */
|
|
426
|
+
s.email && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: s.email.message }),
|
|
427
|
+
/* @__PURE__ */ o.jsx("label", { className: "label mt-4", htmlFor: "login-password", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Password" }) }),
|
|
428
|
+
/* @__PURE__ */ o.jsx(
|
|
411
429
|
"input",
|
|
412
430
|
{
|
|
413
431
|
id: "login-password",
|
|
@@ -418,8 +436,8 @@ function jr() {
|
|
|
418
436
|
...r("password", { required: "Password is required" })
|
|
419
437
|
}
|
|
420
438
|
),
|
|
421
|
-
s.password && /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
439
|
+
s.password && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: s.password.message }),
|
|
440
|
+
/* @__PURE__ */ o.jsx(
|
|
423
441
|
"button",
|
|
424
442
|
{
|
|
425
443
|
type: "submit",
|
|
@@ -430,64 +448,65 @@ function jr() {
|
|
|
430
448
|
)
|
|
431
449
|
] })
|
|
432
450
|
] }),
|
|
433
|
-
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
|
|
451
|
+
l && f && /* @__PURE__ */ o.jsx(f, { text: "Sign in with Google" }),
|
|
452
|
+
/* @__PURE__ */ o.jsx("div", { className: "divider" }),
|
|
453
|
+
/* @__PURE__ */ o.jsxs("div", { className: "join w-full justify-center", children: [
|
|
454
|
+
/* @__PURE__ */ o.jsx(ne, { className: "btn join-item", to: "/", children: "Home" }),
|
|
455
|
+
/* @__PURE__ */ o.jsx(
|
|
456
|
+
ne,
|
|
439
457
|
{
|
|
440
458
|
className: "btn join-item",
|
|
441
459
|
to: "/signup",
|
|
442
|
-
hidden: !
|
|
460
|
+
hidden: !c,
|
|
443
461
|
children: "Create Account"
|
|
444
462
|
}
|
|
445
463
|
),
|
|
446
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ o.jsx(ne, { className: "btn join-item", to: "/forgot-password", children: "Forgot password" })
|
|
447
465
|
] })
|
|
448
466
|
] });
|
|
449
467
|
}
|
|
450
|
-
function
|
|
451
|
-
const r =
|
|
452
|
-
return
|
|
468
|
+
function Pr() {
|
|
469
|
+
const r = Ne(), { useTokenRefresh: e } = le(), t = e?.();
|
|
470
|
+
return Me(() => {
|
|
453
471
|
t?.mutateAsync?.().finally(() => r("/"));
|
|
454
|
-
}, [r, t]), /* @__PURE__ */
|
|
472
|
+
}, [r, t]), /* @__PURE__ */ o.jsx("div", { children: "Processing OAuth callback..." });
|
|
455
473
|
}
|
|
456
|
-
function
|
|
457
|
-
const { register:
|
|
458
|
-
defaultValues: { email: "" }
|
|
459
|
-
}), { useResendConfirmationEmail:
|
|
474
|
+
function Ir() {
|
|
475
|
+
const e = dt().state?.email, { register: t, handleSubmit: s } = Fe({
|
|
476
|
+
defaultValues: { email: e ?? "" }
|
|
477
|
+
}), { useResendConfirmationEmail: n } = le(), a = n(), d = Ne(), u = async (i) => {
|
|
460
478
|
try {
|
|
461
|
-
await
|
|
479
|
+
await a.mutateAsync(i), d("/confirm-email", { state: { email: i.email } });
|
|
462
480
|
} catch {
|
|
463
481
|
}
|
|
464
482
|
};
|
|
465
|
-
return /* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
/* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
484
|
+
/* @__PURE__ */ o.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Resend Confirmation" }),
|
|
485
|
+
/* @__PURE__ */ o.jsxs("form", { onSubmit: s(u), children: [
|
|
486
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", children: "Email" }),
|
|
487
|
+
/* @__PURE__ */ o.jsx(
|
|
470
488
|
"input",
|
|
471
489
|
{
|
|
490
|
+
type: "email",
|
|
472
491
|
className: "input input-bordered w-full",
|
|
473
|
-
...
|
|
492
|
+
...t("email", { required: !0 })
|
|
474
493
|
}
|
|
475
494
|
),
|
|
476
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ o.jsx("button", { className: "btn btn-primary mt-4", children: "Resend" })
|
|
477
496
|
] })
|
|
478
497
|
] });
|
|
479
498
|
}
|
|
480
|
-
function
|
|
481
|
-
const { register: r, handleSubmit: e } =
|
|
499
|
+
function Mr() {
|
|
500
|
+
const { register: r, handleSubmit: e } = Fe({ defaultValues: { token: "", password: "" } }), { useResetPassword: t } = le(), s = t(), n = Ne(), [a] = ut(), d = a.get("token") || void 0, u = async (i) => {
|
|
482
501
|
try {
|
|
483
502
|
await s.mutateAsync(i), n("/");
|
|
484
503
|
} catch {
|
|
485
504
|
}
|
|
486
505
|
};
|
|
487
|
-
return /* @__PURE__ */
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
507
|
+
/* @__PURE__ */ o.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Reset Password" }),
|
|
508
|
+
/* @__PURE__ */ o.jsxs("form", { onSubmit: e(u), children: [
|
|
509
|
+
/* @__PURE__ */ o.jsx(
|
|
491
510
|
"input",
|
|
492
511
|
{
|
|
493
512
|
type: "hidden",
|
|
@@ -495,29 +514,94 @@ function Cr() {
|
|
|
495
514
|
defaultValue: d
|
|
496
515
|
}
|
|
497
516
|
),
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", children: "New password" }),
|
|
518
|
+
/* @__PURE__ */ o.jsx(
|
|
500
519
|
"input",
|
|
501
520
|
{
|
|
502
521
|
className: "input input-bordered w-full",
|
|
503
522
|
...r("password", { required: !0 })
|
|
504
523
|
}
|
|
505
524
|
),
|
|
506
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ o.jsx("button", { className: "btn btn-primary mt-4", children: "Reset" })
|
|
507
526
|
] })
|
|
508
527
|
] });
|
|
509
528
|
}
|
|
510
|
-
|
|
529
|
+
var Lr = {
|
|
530
|
+
prefix: "fab",
|
|
531
|
+
iconName: "google",
|
|
532
|
+
icon: [512, 512, [], "f1a0", "M500 261.8C500 403.3 403.1 504 260 504 122.8 504 12 393.2 12 256S122.8 8 260 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9c-88.3-85.2-252.5-21.2-252.5 118.2 0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9l-140.8 0 0-85.3 236.1 0c2.3 12.7 3.9 24.9 3.9 41.4z"]
|
|
533
|
+
};
|
|
534
|
+
function $r({
|
|
535
|
+
redirectUrl: r = "",
|
|
536
|
+
text: e = "Continue with Google",
|
|
537
|
+
className: t = "",
|
|
538
|
+
disabled: s = !1
|
|
539
|
+
}) {
|
|
540
|
+
const n = () => {
|
|
541
|
+
s || (window.location.href = `${r}/oauth/google`);
|
|
542
|
+
};
|
|
543
|
+
return /* @__PURE__ */ o.jsxs(
|
|
544
|
+
"button",
|
|
545
|
+
{
|
|
546
|
+
onClick: n,
|
|
547
|
+
className: `btn btn-outline w-full gap-2 ${s ? "opacity-50 cursor-not-allowed" : ""} ${t}`,
|
|
548
|
+
type: "button",
|
|
549
|
+
disabled: s,
|
|
550
|
+
children: [
|
|
551
|
+
/* @__PURE__ */ o.jsx(je, { icon: Lr, className: "text-lg" }),
|
|
552
|
+
e
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
const Bt = "registration", Wt = "oauth", Fr = "api_clients";
|
|
558
|
+
let Le = null;
|
|
559
|
+
function Zr(r) {
|
|
560
|
+
Le = r;
|
|
561
|
+
}
|
|
562
|
+
function mt(r) {
|
|
563
|
+
if (!Le)
|
|
564
|
+
throw new Error(
|
|
565
|
+
"Feature flags not configured. Call configureFeatureFlags() in your app setup."
|
|
566
|
+
);
|
|
567
|
+
return Le.useFeatureFlags(r);
|
|
568
|
+
}
|
|
569
|
+
function et(r) {
|
|
570
|
+
const { data: e = [] } = mt();
|
|
571
|
+
return e.find((t) => t.feature_key === r)?.enabled ?? !1;
|
|
572
|
+
}
|
|
573
|
+
function qt() {
|
|
574
|
+
if (!Le)
|
|
575
|
+
throw new Error(
|
|
576
|
+
"Feature flags not configured. Call configureFeatureFlags() in your app setup."
|
|
577
|
+
);
|
|
578
|
+
return Le.useUpdateFeatureFlag();
|
|
579
|
+
}
|
|
580
|
+
const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
581
|
+
__proto__: null,
|
|
582
|
+
FLAG_API_CLIENTS: Fr,
|
|
583
|
+
FLAG_OAUTH: Wt,
|
|
584
|
+
FLAG_REGISTRATION: Bt,
|
|
585
|
+
configureFeatureFlags: Zr,
|
|
586
|
+
useFeatureFlag: et,
|
|
587
|
+
useFeatureFlags: mt,
|
|
588
|
+
useUpdateFeatureFlag: qt
|
|
589
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
590
|
+
function Dr({ redirectUrl: r = "" }) {
|
|
511
591
|
const {
|
|
512
592
|
register: e,
|
|
513
593
|
handleSubmit: t,
|
|
514
594
|
setError: s,
|
|
515
595
|
watch: n,
|
|
516
596
|
formState: { errors: a, isSubmitting: d }
|
|
517
|
-
} =
|
|
597
|
+
} = Fe({
|
|
518
598
|
defaultValues: { name: "", email: "", password: "", confirmPassword: "" }
|
|
519
|
-
}), u =
|
|
520
|
-
if (
|
|
599
|
+
}), u = Ne(), i = et(Bt), l = et(Wt), { useRegisterUser: c } = le(), f = c(), [h, p] = se(null), v = async (w) => {
|
|
600
|
+
if (p(null), !i) {
|
|
601
|
+
p("Registrations are temporarily disabled");
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (w.password !== w.confirmPassword) {
|
|
521
605
|
s("confirmPassword", {
|
|
522
606
|
type: "manual",
|
|
523
607
|
message: "Passwords do not match"
|
|
@@ -525,21 +609,21 @@ function Sr({ redirectUrl: r = "" }) {
|
|
|
525
609
|
return;
|
|
526
610
|
}
|
|
527
611
|
try {
|
|
528
|
-
await
|
|
529
|
-
} catch (
|
|
530
|
-
|
|
612
|
+
await f.mutateAsync(w, s), u("/confirm-email", { state: { email: w.email } });
|
|
613
|
+
} catch (x) {
|
|
614
|
+
ht(x, s, "Failed to register account", !1);
|
|
531
615
|
}
|
|
532
616
|
};
|
|
533
|
-
return /* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
618
|
+
/* @__PURE__ */ o.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
619
|
+
/* @__PURE__ */ o.jsx(je, { icon: wr, className: "text-primary mr-2" }),
|
|
536
620
|
"Sign Up"
|
|
537
621
|
] }),
|
|
538
|
-
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
622
|
+
h && /* @__PURE__ */ o.jsx("div", { role: "alert", className: "alert alert-warning alert-soft mb-4", children: /* @__PURE__ */ o.jsx("span", { children: h }) }),
|
|
623
|
+
/* @__PURE__ */ o.jsx("form", { onSubmit: t(v), children: /* @__PURE__ */ o.jsxs("fieldset", { className: "fieldset", children: [
|
|
624
|
+
/* @__PURE__ */ o.jsx("legend", { className: "fieldset-legend", children: "Account Details" }),
|
|
625
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", htmlFor: "signup-name", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Name" }) }),
|
|
626
|
+
/* @__PURE__ */ o.jsx(
|
|
543
627
|
"input",
|
|
544
628
|
{
|
|
545
629
|
id: "signup-name",
|
|
@@ -555,9 +639,9 @@ function Sr({ redirectUrl: r = "" }) {
|
|
|
555
639
|
})
|
|
556
640
|
}
|
|
557
641
|
),
|
|
558
|
-
a.name && /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
642
|
+
a.name && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: a.name.message }),
|
|
643
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", htmlFor: "signup-email", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Email" }) }),
|
|
644
|
+
/* @__PURE__ */ o.jsx(
|
|
561
645
|
"input",
|
|
562
646
|
{
|
|
563
647
|
id: "signup-email",
|
|
@@ -573,9 +657,9 @@ function Sr({ redirectUrl: r = "" }) {
|
|
|
573
657
|
})
|
|
574
658
|
}
|
|
575
659
|
),
|
|
576
|
-
a.email && /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
660
|
+
a.email && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: a.email.message }),
|
|
661
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", htmlFor: "signup-password", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Password" }) }),
|
|
662
|
+
/* @__PURE__ */ o.jsx(
|
|
579
663
|
"input",
|
|
580
664
|
{
|
|
581
665
|
id: "signup-password",
|
|
@@ -591,9 +675,9 @@ function Sr({ redirectUrl: r = "" }) {
|
|
|
591
675
|
})
|
|
592
676
|
}
|
|
593
677
|
),
|
|
594
|
-
a.password && /* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
678
|
+
a.password && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: a.password.message }),
|
|
679
|
+
/* @__PURE__ */ o.jsx("label", { className: "label", htmlFor: "signup-confirm", children: /* @__PURE__ */ o.jsx("span", { className: "label-text", children: "Confirm Password" }) }),
|
|
680
|
+
/* @__PURE__ */ o.jsx(
|
|
597
681
|
"input",
|
|
598
682
|
{
|
|
599
683
|
id: "signup-confirm",
|
|
@@ -602,79 +686,144 @@ function Sr({ redirectUrl: r = "" }) {
|
|
|
602
686
|
className: `input input-bordered w-full ${a.confirmPassword ? "input-error" : ""}`,
|
|
603
687
|
...e("confirmPassword", {
|
|
604
688
|
required: "Please confirm password",
|
|
605
|
-
validate: (
|
|
689
|
+
validate: (w) => w === n("password") || "Passwords do not match"
|
|
606
690
|
})
|
|
607
691
|
}
|
|
608
692
|
),
|
|
609
|
-
a.confirmPassword && /* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
693
|
+
a.confirmPassword && /* @__PURE__ */ o.jsx("span", { className: "text-error text-sm", children: a.confirmPassword.message }),
|
|
694
|
+
/* @__PURE__ */ o.jsx(
|
|
611
695
|
"button",
|
|
612
696
|
{
|
|
613
697
|
type: "submit",
|
|
614
698
|
className: "btn btn-primary w-full mt-4",
|
|
615
|
-
disabled: d || !
|
|
699
|
+
disabled: d || !i,
|
|
616
700
|
children: d ? "Creating Account…" : "Sign Up"
|
|
617
701
|
}
|
|
618
702
|
)
|
|
619
703
|
] }) }),
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
704
|
+
l && /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ o.jsx("div", { className: "divider", children: "OR" }),
|
|
706
|
+
/* @__PURE__ */ o.jsx(
|
|
707
|
+
$r,
|
|
708
|
+
{
|
|
709
|
+
redirectUrl: r,
|
|
710
|
+
text: "Sign up with Google"
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
] }),
|
|
714
|
+
!i && /* @__PURE__ */ o.jsx("div", { className: "mt-4 text-center text-sm text-neutral-content-500", children: "Registrations are currently disabled. If you need an account, please contact an administrator." }),
|
|
715
|
+
/* @__PURE__ */ o.jsx("div", { className: "divider" }),
|
|
716
|
+
/* @__PURE__ */ o.jsxs("div", { className: "join w-full justify-center", children: [
|
|
717
|
+
/* @__PURE__ */ o.jsx(ne, { className: "btn join-item", to: "/", children: "Home" }),
|
|
718
|
+
/* @__PURE__ */ o.jsx(ne, { to: "/login", className: "btn join-item", children: "Login" }),
|
|
719
|
+
/* @__PURE__ */ o.jsx(ne, { to: "/forgot-password", className: "btn join-item", children: "Forgot Password" })
|
|
627
720
|
] })
|
|
628
721
|
] });
|
|
629
722
|
}
|
|
630
|
-
function
|
|
631
|
-
const r =
|
|
723
|
+
function zr() {
|
|
724
|
+
const r = Ne(), [e] = ut(), [t, s] = se(!1), [n, a] = se(null), [d, u] = se(!1), { useVerifyEmail: i } = le(), l = i(), c = e.get("token"), f = async () => {
|
|
725
|
+
if (!c) {
|
|
726
|
+
a("No token provided.");
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
s(!0);
|
|
632
730
|
try {
|
|
633
|
-
|
|
634
|
-
} catch {
|
|
731
|
+
await l.mutateAsync(c), ct.success("Email verified! You can now log in."), r("/login");
|
|
732
|
+
} catch (h) {
|
|
733
|
+
const p = h?.response?.data, v = p?.error || p?.message || h?.message || "Verification failed.", w = String(v).toLowerCase();
|
|
734
|
+
(w.includes("invalid") || w.includes("expired")) && u(!0), a(String(v));
|
|
735
|
+
} finally {
|
|
736
|
+
s(!1);
|
|
635
737
|
}
|
|
636
738
|
};
|
|
637
|
-
return
|
|
638
|
-
|
|
639
|
-
|
|
739
|
+
return Me(() => {
|
|
740
|
+
c && f();
|
|
741
|
+
}, [c]), /* @__PURE__ */ o.jsxs(ce, { children: [
|
|
742
|
+
/* @__PURE__ */ o.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Verify Email" }),
|
|
743
|
+
/* @__PURE__ */ o.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
744
|
+
/* @__PURE__ */ o.jsx(
|
|
745
|
+
"button",
|
|
746
|
+
{
|
|
747
|
+
className: "btn btn-primary",
|
|
748
|
+
onClick: f,
|
|
749
|
+
disabled: t || d,
|
|
750
|
+
children: t ? "Verifying…" : "Verify"
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
n && /* @__PURE__ */ o.jsx("div", { className: "text-sm text-center text-error mt-2", children: n }),
|
|
754
|
+
d && /* @__PURE__ */ o.jsxs("div", { className: "mt-2 flex flex-col items-center gap-2", children: [
|
|
755
|
+
/* @__PURE__ */ o.jsx("p", { className: "text-sm mb-2", children: "Token is invalid or expired. Request a new confirmation email." }),
|
|
756
|
+
/* @__PURE__ */ o.jsx(
|
|
757
|
+
"button",
|
|
758
|
+
{
|
|
759
|
+
className: "btn btn-secondary",
|
|
760
|
+
onClick: () => r("/resend-confirmation"),
|
|
761
|
+
children: "Resend Confirmation"
|
|
762
|
+
}
|
|
763
|
+
)
|
|
764
|
+
] })
|
|
765
|
+
] })
|
|
640
766
|
] });
|
|
641
767
|
}
|
|
642
|
-
const
|
|
768
|
+
const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
643
769
|
__proto__: null,
|
|
644
|
-
AuthLayout:
|
|
645
|
-
AuthProvider:
|
|
646
|
-
ConfirmEmail:
|
|
647
|
-
ForgotPassword:
|
|
648
|
-
Login:
|
|
649
|
-
OAuthCallback:
|
|
650
|
-
ResendConfirmation:
|
|
651
|
-
Reset:
|
|
652
|
-
SignUp:
|
|
653
|
-
Verify:
|
|
654
|
-
handleFormError:
|
|
655
|
-
redirectToOrigin:
|
|
656
|
-
useAuthApi:
|
|
657
|
-
useAuthConfig:
|
|
770
|
+
AuthLayout: ce,
|
|
771
|
+
AuthProvider: Ar,
|
|
772
|
+
ConfirmEmail: Rr,
|
|
773
|
+
ForgotPassword: Tr,
|
|
774
|
+
Login: Or,
|
|
775
|
+
OAuthCallback: Pr,
|
|
776
|
+
ResendConfirmation: Ir,
|
|
777
|
+
Reset: Mr,
|
|
778
|
+
SignUp: Dr,
|
|
779
|
+
Verify: zr,
|
|
780
|
+
handleFormError: ht,
|
|
781
|
+
redirectToOrigin: Vt,
|
|
782
|
+
useAuthApi: le,
|
|
783
|
+
useAuthConfig: Ut
|
|
658
784
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
659
|
-
|
|
785
|
+
let Ue = {};
|
|
786
|
+
function yn(r) {
|
|
787
|
+
Ue = { ...Ue, ...r };
|
|
788
|
+
}
|
|
789
|
+
function Ur() {
|
|
790
|
+
return /* @__PURE__ */ o.jsx("header", { className: "bg-base-300 p-4", children: /* @__PURE__ */ o.jsx("div", { className: "container mx-auto font-semibold", children: "Kaleido" }) });
|
|
791
|
+
}
|
|
792
|
+
function Vr() {
|
|
793
|
+
return /* @__PURE__ */ o.jsx("div", { className: "text-sm text-muted", children: "No admin navigation provided." });
|
|
794
|
+
}
|
|
795
|
+
function Br() {
|
|
796
|
+
return Ue.SiteNavigation ?? Ur;
|
|
797
|
+
}
|
|
798
|
+
function Wr() {
|
|
799
|
+
return Ue.AdminNav ?? Vr;
|
|
800
|
+
}
|
|
801
|
+
function pt({
|
|
660
802
|
title: r,
|
|
661
803
|
children: e
|
|
662
804
|
}) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
/* @__PURE__ */
|
|
805
|
+
const t = Br(), s = Wr();
|
|
806
|
+
return /* @__PURE__ */ o.jsxs("div", { className: "min-h-screen bg-base-200", children: [
|
|
807
|
+
/* @__PURE__ */ o.jsx(t, {}),
|
|
808
|
+
/* @__PURE__ */ o.jsxs("div", { className: "container mx-auto p-6", children: [
|
|
809
|
+
r && /* @__PURE__ */ o.jsx("div", { className: "mb-4", children: /* @__PURE__ */ o.jsx("h1", { className: "text-2xl font-bold", children: r }) }),
|
|
810
|
+
/* @__PURE__ */ o.jsxs("div", { className: "grid grid-cols-12 gap-6", children: [
|
|
811
|
+
/* @__PURE__ */ o.jsx("aside", { className: "col-span-12 md:col-span-3", children: /* @__PURE__ */ o.jsx("div", { className: "card bg-base-100 p-4", children: /* @__PURE__ */ o.jsx(s, {}) }) }),
|
|
812
|
+
/* @__PURE__ */ o.jsx("main", { className: "col-span-12 md:col-span-9", children: e })
|
|
813
|
+
] })
|
|
814
|
+
] })
|
|
666
815
|
] });
|
|
667
816
|
}
|
|
668
|
-
function
|
|
817
|
+
function qr({
|
|
669
818
|
icon: r,
|
|
670
819
|
title: e,
|
|
671
820
|
message: t,
|
|
672
821
|
action: s
|
|
673
822
|
}) {
|
|
674
|
-
return /* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
r && /* @__PURE__ */
|
|
677
|
-
|
|
823
|
+
return /* @__PURE__ */ o.jsx("div", { className: "min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/10 to-secondary/10", children: /* @__PURE__ */ o.jsx("div", { className: "card bg-base-100 shadow-soft hover:shadow-medium transition-shadow border border-base-300 w-full max-w-md mx-4", children: /* @__PURE__ */ o.jsxs("div", { className: "card-body p-8", children: [
|
|
824
|
+
/* @__PURE__ */ o.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
825
|
+
r && /* @__PURE__ */ o.jsx(
|
|
826
|
+
je,
|
|
678
827
|
{
|
|
679
828
|
icon: r,
|
|
680
829
|
className: "text-neutral-content-300 mb-4"
|
|
@@ -682,11 +831,11 @@ function Ar({
|
|
|
682
831
|
),
|
|
683
832
|
e
|
|
684
833
|
] }),
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
s && /* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ o.jsx("div", { className: "mt-4 text-sm text-center", children: t }),
|
|
835
|
+
s && /* @__PURE__ */ o.jsx("div", { children: s })
|
|
687
836
|
] }) }) });
|
|
688
837
|
}
|
|
689
|
-
function
|
|
838
|
+
function Yr({
|
|
690
839
|
isOpen: r,
|
|
691
840
|
title: e,
|
|
692
841
|
handleSubmit: t,
|
|
@@ -696,34 +845,34 @@ function Tr({
|
|
|
696
845
|
onSave: d,
|
|
697
846
|
onClose: u,
|
|
698
847
|
onCancel: i,
|
|
699
|
-
children:
|
|
700
|
-
maxWidth:
|
|
848
|
+
children: l,
|
|
849
|
+
maxWidth: c = "2xl",
|
|
701
850
|
submitLabel: f = "Save",
|
|
702
851
|
cancelLabel: h = "Cancel"
|
|
703
852
|
}) {
|
|
704
853
|
if (!r) return null;
|
|
705
|
-
const p = s || n,
|
|
854
|
+
const p = s || n, v = () => {
|
|
706
855
|
p || (i && i(), u());
|
|
707
|
-
}, w = `max-w-${
|
|
708
|
-
return /* @__PURE__ */
|
|
856
|
+
}, w = `max-w-${c}`;
|
|
857
|
+
return /* @__PURE__ */ o.jsx("div", { className: "modal modal-open", onClick: v, children: /* @__PURE__ */ o.jsxs(
|
|
709
858
|
"div",
|
|
710
859
|
{
|
|
711
860
|
className: `modal-box ${w}`,
|
|
712
861
|
onClick: (x) => x.stopPropagation(),
|
|
713
862
|
children: [
|
|
714
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ o.jsxs("h3", { className: "font-bold text-lg mb-4", children: [
|
|
715
864
|
e,
|
|
716
|
-
p && /* @__PURE__ */
|
|
865
|
+
p && /* @__PURE__ */ o.jsx("span", { className: "loading loading-spinner loading-xs ml-2" })
|
|
717
866
|
] }),
|
|
718
|
-
a !== void 0 && a > 0 && a < 100 && /* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
867
|
+
a !== void 0 && a > 0 && a < 100 && /* @__PURE__ */ o.jsxs("div", { className: "mb-4", children: [
|
|
868
|
+
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
869
|
+
/* @__PURE__ */ o.jsx("span", { className: "text-sm", children: "Uploading..." }),
|
|
870
|
+
/* @__PURE__ */ o.jsxs("span", { className: "text-sm font-semibold", children: [
|
|
722
871
|
a,
|
|
723
872
|
"%"
|
|
724
873
|
] })
|
|
725
874
|
] }),
|
|
726
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ o.jsx(
|
|
727
876
|
"progress",
|
|
728
877
|
{
|
|
729
878
|
className: "progress progress-primary w-full",
|
|
@@ -732,27 +881,27 @@ function Tr({
|
|
|
732
881
|
}
|
|
733
882
|
)
|
|
734
883
|
] }),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ o.jsxs("form", { onSubmit: t((x) => d(x, { onClose: u })), children: [
|
|
885
|
+
l,
|
|
886
|
+
/* @__PURE__ */ o.jsxs("div", { className: "modal-action", children: [
|
|
887
|
+
/* @__PURE__ */ o.jsx(
|
|
739
888
|
"button",
|
|
740
889
|
{
|
|
741
890
|
type: "button",
|
|
742
891
|
className: "btn btn-ghost",
|
|
743
|
-
onClick:
|
|
892
|
+
onClick: v,
|
|
744
893
|
disabled: p,
|
|
745
894
|
children: h
|
|
746
895
|
}
|
|
747
896
|
),
|
|
748
|
-
/* @__PURE__ */
|
|
897
|
+
/* @__PURE__ */ o.jsxs(
|
|
749
898
|
"button",
|
|
750
899
|
{
|
|
751
900
|
type: "submit",
|
|
752
901
|
className: "btn btn-primary",
|
|
753
902
|
disabled: p,
|
|
754
903
|
children: [
|
|
755
|
-
p && /* @__PURE__ */
|
|
904
|
+
p && /* @__PURE__ */ o.jsx("span", { className: "loading loading-spinner loading-xs" }),
|
|
756
905
|
f
|
|
757
906
|
]
|
|
758
907
|
}
|
|
@@ -763,182 +912,182 @@ function Tr({
|
|
|
763
912
|
}
|
|
764
913
|
) });
|
|
765
914
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
total: t,
|
|
770
|
-
onPageChange: s,
|
|
771
|
-
className: n = "",
|
|
772
|
-
visiblePages: a = 5
|
|
773
|
-
}) {
|
|
774
|
-
const d = Math.max(1, Math.ceil(t / e));
|
|
775
|
-
if (d <= 1) return null;
|
|
776
|
-
const u = (p) => {
|
|
777
|
-
p !== r && p >= 1 && p <= d && s(p);
|
|
778
|
-
}, i = (p) => /* @__PURE__ */ c.jsx(
|
|
779
|
-
"button",
|
|
780
|
-
{
|
|
781
|
-
className: `join-item btn ${p === r ? "btn-active" : ""}`,
|
|
782
|
-
onClick: () => u(p),
|
|
783
|
-
children: p
|
|
784
|
-
},
|
|
785
|
-
p
|
|
786
|
-
), o = Math.max(1, Math.min(a, d));
|
|
787
|
-
let l = r - Math.floor(o / 2);
|
|
788
|
-
l < 1 && (l = 1);
|
|
789
|
-
let f = l + o - 1;
|
|
790
|
-
f > d && (f = d, l = Math.max(1, f - o + 1));
|
|
791
|
-
const h = [];
|
|
792
|
-
for (let p = l; p <= f; p++) h.push(p);
|
|
793
|
-
return /* @__PURE__ */ c.jsx("div", { className: `flex justify-center ${n}`, children: /* @__PURE__ */ c.jsxs("div", { className: "join", children: [
|
|
794
|
-
/* @__PURE__ */ c.jsx(
|
|
795
|
-
"button",
|
|
796
|
-
{
|
|
797
|
-
className: "join-item btn",
|
|
798
|
-
disabled: r === 1,
|
|
799
|
-
onClick: () => u(r - 1),
|
|
800
|
-
children: "«"
|
|
801
|
-
}
|
|
802
|
-
),
|
|
803
|
-
h.map((p) => i(p)),
|
|
804
|
-
/* @__PURE__ */ c.jsx(
|
|
805
|
-
"button",
|
|
806
|
-
{
|
|
807
|
-
className: "join-item btn",
|
|
808
|
-
disabled: r === d,
|
|
809
|
-
onClick: () => u(r + 1),
|
|
810
|
-
children: "»"
|
|
811
|
-
}
|
|
812
|
-
)
|
|
813
|
-
] }) });
|
|
814
|
-
}
|
|
815
|
-
function Ks(r, e) {
|
|
816
|
-
const t = e?.defaultPage ?? 1, s = e?.defaultPerPage ?? 25, n = {};
|
|
817
|
-
r.page !== void 0 && r.page !== null && r.page !== t && (n.page = Number(r.page)), r.per_page !== void 0 && r.per_page !== null && r.per_page !== s && (n.per_page = Number(r.per_page));
|
|
818
|
-
const a = {};
|
|
819
|
-
r.sort_by && (a.sort_by = String(r.sort_by)), r.sort_order && (a.sort_order = String(r.sort_order));
|
|
820
|
-
const d = r.q ?? r.q, u = {};
|
|
821
|
-
return Object.keys(n).length && (u.pagination = n), d != null && String(d) !== "" && (u.q = d), Object.keys(a).length && (u.sort = a), u;
|
|
822
|
-
}
|
|
823
|
-
function ht(r, e) {
|
|
824
|
-
const t = {};
|
|
825
|
-
for (const [s, n] of r.entries())
|
|
826
|
-
t[s] = n;
|
|
827
|
-
return t;
|
|
828
|
-
}
|
|
829
|
-
function $e(r) {
|
|
830
|
-
const e = new URLSearchParams();
|
|
831
|
-
return Object.entries(r || {}).forEach(([t, s]) => {
|
|
832
|
-
s != null && e.set(t, String(s));
|
|
833
|
-
}), e;
|
|
834
|
-
}
|
|
835
|
-
var Or = typeof global == "object" && global && global.Object === Object && global, Pr = typeof self == "object" && self && self.Object === Object && self, Dt = Or || Pr || Function("return this")(), De = Dt.Symbol, Ft = Object.prototype, Ir = Ft.hasOwnProperty, Mr = Ft.toString, Re = De ? De.toStringTag : void 0;
|
|
836
|
-
function Lr(r) {
|
|
837
|
-
var e = Ir.call(r, Re), t = r[Re];
|
|
915
|
+
var Gr = typeof global == "object" && global && global.Object === Object && global, Qr = typeof self == "object" && self && self.Object === Object && self, Yt = Gr || Qr || Function("return this")(), Ve = Yt.Symbol, Gt = Object.prototype, Hr = Gt.hasOwnProperty, Jr = Gt.toString, Te = Ve ? Ve.toStringTag : void 0;
|
|
916
|
+
function Xr(r) {
|
|
917
|
+
var e = Hr.call(r, Te), t = r[Te];
|
|
838
918
|
try {
|
|
839
|
-
r[
|
|
919
|
+
r[Te] = void 0;
|
|
840
920
|
var s = !0;
|
|
841
921
|
} catch {
|
|
842
922
|
}
|
|
843
|
-
var n =
|
|
844
|
-
return s && (e ? r[
|
|
923
|
+
var n = Jr.call(r);
|
|
924
|
+
return s && (e ? r[Te] = t : delete r[Te]), n;
|
|
845
925
|
}
|
|
846
|
-
var
|
|
847
|
-
function
|
|
848
|
-
return
|
|
926
|
+
var Kr = Object.prototype, es = Kr.toString;
|
|
927
|
+
function ts(r) {
|
|
928
|
+
return es.call(r);
|
|
849
929
|
}
|
|
850
|
-
var
|
|
851
|
-
function
|
|
852
|
-
return r == null ? r === void 0 ?
|
|
930
|
+
var rs = "[object Null]", ss = "[object Undefined]", _t = Ve ? Ve.toStringTag : void 0;
|
|
931
|
+
function ns(r) {
|
|
932
|
+
return r == null ? r === void 0 ? ss : rs : _t && _t in Object(r) ? Xr(r) : ts(r);
|
|
853
933
|
}
|
|
854
|
-
function
|
|
934
|
+
function as(r) {
|
|
855
935
|
return r != null && typeof r == "object";
|
|
856
936
|
}
|
|
857
|
-
var
|
|
858
|
-
function
|
|
859
|
-
return typeof r == "symbol" ||
|
|
937
|
+
var is = "[object Symbol]";
|
|
938
|
+
function os(r) {
|
|
939
|
+
return typeof r == "symbol" || as(r) && ns(r) == is;
|
|
860
940
|
}
|
|
861
|
-
var
|
|
862
|
-
function
|
|
863
|
-
for (var e = r.length; e-- &&
|
|
941
|
+
var ls = /\s/;
|
|
942
|
+
function cs(r) {
|
|
943
|
+
for (var e = r.length; e-- && ls.test(r.charAt(e)); )
|
|
864
944
|
;
|
|
865
945
|
return e;
|
|
866
946
|
}
|
|
867
|
-
var
|
|
868
|
-
function
|
|
869
|
-
return r && r.slice(0,
|
|
947
|
+
var ds = /^\s+/;
|
|
948
|
+
function us(r) {
|
|
949
|
+
return r && r.slice(0, cs(r) + 1).replace(ds, "");
|
|
870
950
|
}
|
|
871
|
-
function
|
|
951
|
+
function tt(r) {
|
|
872
952
|
var e = typeof r;
|
|
873
953
|
return r != null && (e == "object" || e == "function");
|
|
874
954
|
}
|
|
875
|
-
var
|
|
876
|
-
function
|
|
955
|
+
var bt = NaN, fs = /^[-+]0x[0-9a-f]+$/i, hs = /^0b[01]+$/i, ms = /^0o[0-7]+$/i, ps = parseInt;
|
|
956
|
+
function wt(r) {
|
|
877
957
|
if (typeof r == "number")
|
|
878
958
|
return r;
|
|
879
|
-
if (
|
|
880
|
-
return
|
|
881
|
-
if (
|
|
959
|
+
if (os(r))
|
|
960
|
+
return bt;
|
|
961
|
+
if (tt(r)) {
|
|
882
962
|
var e = typeof r.valueOf == "function" ? r.valueOf() : r;
|
|
883
|
-
r =
|
|
963
|
+
r = tt(e) ? e + "" : e;
|
|
884
964
|
}
|
|
885
965
|
if (typeof r != "string")
|
|
886
966
|
return r === 0 ? r : +r;
|
|
887
|
-
r =
|
|
888
|
-
var t =
|
|
889
|
-
return t ||
|
|
967
|
+
r = us(r);
|
|
968
|
+
var t = hs.test(r);
|
|
969
|
+
return t || ms.test(r) ? ps(r.slice(2), t ? 2 : 8) : fs.test(r) ? bt : +r;
|
|
890
970
|
}
|
|
891
|
-
var
|
|
892
|
-
return
|
|
893
|
-
},
|
|
894
|
-
function
|
|
895
|
-
var s, n, a, d, u, i,
|
|
971
|
+
var Xe = function() {
|
|
972
|
+
return Yt.Date.now();
|
|
973
|
+
}, gs = "Expected a function", vs = Math.max, ys = Math.min;
|
|
974
|
+
function xs(r, e, t) {
|
|
975
|
+
var s, n, a, d, u, i, l = 0, c = !1, f = !1, h = !0;
|
|
896
976
|
if (typeof r != "function")
|
|
897
|
-
throw new TypeError(
|
|
898
|
-
e =
|
|
977
|
+
throw new TypeError(gs);
|
|
978
|
+
e = wt(e) || 0, tt(t) && (c = !!t.leading, f = "maxWait" in t, a = f ? vs(wt(t.maxWait) || 0, e) : a, h = "trailing" in t ? !!t.trailing : h);
|
|
899
979
|
function p(O) {
|
|
900
980
|
var B = s, W = n;
|
|
901
|
-
return s = n = void 0,
|
|
981
|
+
return s = n = void 0, l = O, d = r.apply(W, B), d;
|
|
902
982
|
}
|
|
903
|
-
function
|
|
904
|
-
return
|
|
983
|
+
function v(O) {
|
|
984
|
+
return l = O, u = setTimeout(M, e), c ? p(O) : d;
|
|
905
985
|
}
|
|
906
986
|
function w(O) {
|
|
907
|
-
var B = O - i, W = O -
|
|
908
|
-
return f ?
|
|
987
|
+
var B = O - i, W = O - l, H = e - B;
|
|
988
|
+
return f ? ys(H, a - W) : H;
|
|
909
989
|
}
|
|
910
990
|
function x(O) {
|
|
911
|
-
var B = O - i, W = O -
|
|
991
|
+
var B = O - i, W = O - l;
|
|
912
992
|
return i === void 0 || B >= e || B < 0 || f && W >= a;
|
|
913
993
|
}
|
|
914
994
|
function M() {
|
|
915
|
-
var O =
|
|
995
|
+
var O = Xe();
|
|
916
996
|
if (x(O))
|
|
917
|
-
return
|
|
997
|
+
return A(O);
|
|
918
998
|
u = setTimeout(M, w(O));
|
|
919
999
|
}
|
|
920
|
-
function
|
|
1000
|
+
function A(O) {
|
|
921
1001
|
return u = void 0, h && s ? p(O) : (s = n = void 0, d);
|
|
922
1002
|
}
|
|
923
|
-
function
|
|
924
|
-
u !== void 0 && clearTimeout(u),
|
|
1003
|
+
function j() {
|
|
1004
|
+
u !== void 0 && clearTimeout(u), l = 0, s = i = n = u = void 0;
|
|
925
1005
|
}
|
|
926
1006
|
function I() {
|
|
927
|
-
return u === void 0 ? d :
|
|
1007
|
+
return u === void 0 ? d : A(Xe());
|
|
928
1008
|
}
|
|
929
1009
|
function L() {
|
|
930
|
-
var O =
|
|
1010
|
+
var O = Xe(), B = x(O);
|
|
931
1011
|
if (s = arguments, n = this, i = O, B) {
|
|
932
1012
|
if (u === void 0)
|
|
933
|
-
return
|
|
1013
|
+
return v(i);
|
|
934
1014
|
if (f)
|
|
935
1015
|
return clearTimeout(u), u = setTimeout(M, e), p(i);
|
|
936
1016
|
}
|
|
937
1017
|
return u === void 0 && (u = setTimeout(M, e)), d;
|
|
938
1018
|
}
|
|
939
|
-
return L.cancel =
|
|
1019
|
+
return L.cancel = j, L.flush = I, L;
|
|
1020
|
+
}
|
|
1021
|
+
function xn(r, e) {
|
|
1022
|
+
const t = e?.defaultPage ?? 1, s = e?.defaultPerPage ?? 25, n = {};
|
|
1023
|
+
r.page !== void 0 && r.page !== null && r.page !== t && (n.page = Number(r.page)), r.per_page !== void 0 && r.per_page !== null && r.per_page !== s && (n.per_page = Number(r.per_page));
|
|
1024
|
+
const a = {};
|
|
1025
|
+
r.sort_by && (a.sort_by = String(r.sort_by)), r.sort_order && (a.sort_order = String(r.sort_order));
|
|
1026
|
+
const d = r.q ?? r.q, u = {};
|
|
1027
|
+
return Object.keys(n).length && (u.pagination = n), d != null && String(d) !== "" && (u.q = d), Object.keys(a).length && (u.sort = a), u;
|
|
1028
|
+
}
|
|
1029
|
+
function jt(r, e) {
|
|
1030
|
+
const t = {};
|
|
1031
|
+
for (const [s, n] of r.entries())
|
|
1032
|
+
t[s] = n;
|
|
1033
|
+
return t;
|
|
1034
|
+
}
|
|
1035
|
+
function ze(r) {
|
|
1036
|
+
const e = new URLSearchParams();
|
|
1037
|
+
return Object.entries(r || {}).forEach(([t, s]) => {
|
|
1038
|
+
s != null && e.set(t, String(s));
|
|
1039
|
+
}), e;
|
|
1040
|
+
}
|
|
1041
|
+
function Qt({
|
|
1042
|
+
page: r,
|
|
1043
|
+
perPage: e,
|
|
1044
|
+
total: t,
|
|
1045
|
+
onPageChange: s,
|
|
1046
|
+
className: n = "",
|
|
1047
|
+
visiblePages: a = 5
|
|
1048
|
+
}) {
|
|
1049
|
+
const d = Math.max(1, Math.ceil(t / e));
|
|
1050
|
+
if (d <= 1) return null;
|
|
1051
|
+
const u = (p) => {
|
|
1052
|
+
p !== r && p >= 1 && p <= d && s(p);
|
|
1053
|
+
}, i = (p) => /* @__PURE__ */ o.jsx(
|
|
1054
|
+
"button",
|
|
1055
|
+
{
|
|
1056
|
+
className: `join-item btn ${p === r ? "btn-active" : ""}`,
|
|
1057
|
+
onClick: () => u(p),
|
|
1058
|
+
children: p
|
|
1059
|
+
},
|
|
1060
|
+
p
|
|
1061
|
+
), l = Math.max(1, Math.min(a, d));
|
|
1062
|
+
let c = r - Math.floor(l / 2);
|
|
1063
|
+
c < 1 && (c = 1);
|
|
1064
|
+
let f = c + l - 1;
|
|
1065
|
+
f > d && (f = d, c = Math.max(1, f - l + 1));
|
|
1066
|
+
const h = [];
|
|
1067
|
+
for (let p = c; p <= f; p++) h.push(p);
|
|
1068
|
+
return /* @__PURE__ */ o.jsx("div", { className: `flex justify-center ${n}`, children: /* @__PURE__ */ o.jsxs("div", { className: "join", children: [
|
|
1069
|
+
/* @__PURE__ */ o.jsx(
|
|
1070
|
+
"button",
|
|
1071
|
+
{
|
|
1072
|
+
className: "join-item btn",
|
|
1073
|
+
disabled: r === 1,
|
|
1074
|
+
onClick: () => u(r - 1),
|
|
1075
|
+
children: "«"
|
|
1076
|
+
}
|
|
1077
|
+
),
|
|
1078
|
+
h.map((p) => i(p)),
|
|
1079
|
+
/* @__PURE__ */ o.jsx(
|
|
1080
|
+
"button",
|
|
1081
|
+
{
|
|
1082
|
+
className: "join-item btn",
|
|
1083
|
+
disabled: r === d,
|
|
1084
|
+
onClick: () => u(r + 1),
|
|
1085
|
+
children: "»"
|
|
1086
|
+
}
|
|
1087
|
+
)
|
|
1088
|
+
] }) });
|
|
940
1089
|
}
|
|
941
|
-
function
|
|
1090
|
+
function Ht({
|
|
942
1091
|
title: r,
|
|
943
1092
|
actions: e,
|
|
944
1093
|
paramsSchema: t,
|
|
@@ -949,52 +1098,52 @@ function zt({
|
|
|
949
1098
|
onRowClick: u,
|
|
950
1099
|
paginationType: i = "pages"
|
|
951
1100
|
}) {
|
|
952
|
-
const [
|
|
953
|
-
|
|
954
|
-
JSON.stringify(f) !== JSON.stringify(I.current) && (
|
|
1101
|
+
const [l, c] = ut(), f = jt(l), { data: h, isLoading: p, raw: v } = s(f), w = v?.metadata?.total ?? 0, x = f.page ?? 1, M = f.per_page ?? 20, [A, j] = se(f), I = yr(f);
|
|
1102
|
+
Me(() => {
|
|
1103
|
+
JSON.stringify(f) !== JSON.stringify(I.current) && (j(f), I.current = f);
|
|
955
1104
|
}, [f]);
|
|
956
|
-
const L =
|
|
957
|
-
() =>
|
|
958
|
-
|
|
1105
|
+
const L = xr(
|
|
1106
|
+
() => xs((P) => {
|
|
1107
|
+
c(ze(P));
|
|
959
1108
|
}, 300),
|
|
960
|
-
[
|
|
1109
|
+
[c]
|
|
961
1110
|
);
|
|
962
|
-
|
|
1111
|
+
Me(() => () => L.cancel(), [L]);
|
|
963
1112
|
const O = (P, Y) => {
|
|
964
|
-
const
|
|
965
|
-
...
|
|
1113
|
+
const G = {
|
|
1114
|
+
...A,
|
|
966
1115
|
[P]: Y === "" ? void 0 : Y,
|
|
967
1116
|
// Reset to page 1 when filters change
|
|
968
1117
|
page: 1
|
|
969
1118
|
};
|
|
970
|
-
|
|
1119
|
+
j(G), L(G);
|
|
971
1120
|
}, B = (P) => {
|
|
972
1121
|
const Y = {
|
|
973
|
-
...
|
|
1122
|
+
...A,
|
|
974
1123
|
...P,
|
|
975
1124
|
// Reset to page 1 when filters change
|
|
976
1125
|
page: 1
|
|
977
1126
|
};
|
|
978
|
-
|
|
1127
|
+
j(Y), L(Y);
|
|
979
1128
|
}, W = () => {
|
|
980
|
-
L.cancel(),
|
|
981
|
-
},
|
|
982
|
-
const P =
|
|
983
|
-
|
|
984
|
-
},
|
|
1129
|
+
L.cancel(), c(ze(A));
|
|
1130
|
+
}, H = () => {
|
|
1131
|
+
const P = jt(new URLSearchParams());
|
|
1132
|
+
j(P), L.cancel(), c(ze(P));
|
|
1133
|
+
}, de = (P) => {
|
|
985
1134
|
const Y = { ...f, page: P };
|
|
986
|
-
|
|
1135
|
+
c(ze(Y));
|
|
987
1136
|
}, q = r || e || n;
|
|
988
|
-
return /* @__PURE__ */
|
|
989
|
-
q && /* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
r && /* @__PURE__ */
|
|
992
|
-
e && /* @__PURE__ */
|
|
1137
|
+
return /* @__PURE__ */ o.jsx("div", { className: "card bg-base-100 shadow-xl", children: /* @__PURE__ */ o.jsxs("div", { className: "card-body", children: [
|
|
1138
|
+
q && /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [
|
|
1139
|
+
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1140
|
+
r && /* @__PURE__ */ o.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ o.jsx("h2", { className: "card-title m-0 text-2xl font-bold", children: r }) }),
|
|
1141
|
+
e && /* @__PURE__ */ o.jsx("div", { className: "flex items-center gap-3", children: e })
|
|
993
1142
|
] }),
|
|
994
|
-
n && /* @__PURE__ */
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
1143
|
+
n && /* @__PURE__ */ o.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 bg-base-200/50 p-2 rounded-lg w-full", children: [
|
|
1144
|
+
/* @__PURE__ */ o.jsx("div", { className: "flex flex-wrap gap-2 justify-end flex-1", children: n(A, O) }),
|
|
1145
|
+
/* @__PURE__ */ o.jsxs("div", { className: "join", children: [
|
|
1146
|
+
/* @__PURE__ */ o.jsx(
|
|
998
1147
|
"button",
|
|
999
1148
|
{
|
|
1000
1149
|
className: "join-item btn btn-sm btn-neutral",
|
|
@@ -1002,73 +1151,73 @@ function zt({
|
|
|
1002
1151
|
children: "Search"
|
|
1003
1152
|
}
|
|
1004
1153
|
),
|
|
1005
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ o.jsx(
|
|
1006
1155
|
"button",
|
|
1007
1156
|
{
|
|
1008
1157
|
className: "join-item btn btn-sm btn-ghost border-base-300",
|
|
1009
|
-
onClick:
|
|
1158
|
+
onClick: H,
|
|
1010
1159
|
children: "Clear"
|
|
1011
1160
|
}
|
|
1012
1161
|
)
|
|
1013
1162
|
] })
|
|
1014
1163
|
] })
|
|
1015
1164
|
] }),
|
|
1016
|
-
p ? /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
const
|
|
1020
|
-
return /* @__PURE__ */
|
|
1165
|
+
p ? /* @__PURE__ */ o.jsx("div", { className: "flex justify-center items-center py-10", children: /* @__PURE__ */ o.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : h.length === 0 ? /* @__PURE__ */ o.jsx("div", { className: "text-center py-8", children: d }) : /* @__PURE__ */ o.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ o.jsxs("table", { className: "table table-zebra w-full", children: [
|
|
1166
|
+
/* @__PURE__ */ o.jsx("thead", { children: /* @__PURE__ */ o.jsx("tr", { children: a.map((P) => /* @__PURE__ */ o.jsx("th", { className: P.className, children: typeof P.header == "function" ? P.header(f, O, B) : P.header }, P.key)) }) }),
|
|
1167
|
+
/* @__PURE__ */ o.jsx("tbody", { children: h.map((P, Y) => {
|
|
1168
|
+
const G = P.id !== void 0 ? String(P.id) : `row-${Y}`;
|
|
1169
|
+
return /* @__PURE__ */ o.jsx(
|
|
1021
1170
|
"tr",
|
|
1022
1171
|
{
|
|
1023
1172
|
className: u ? "cursor-pointer hover:bg-base-200" : "",
|
|
1024
1173
|
onClick: () => u?.(P),
|
|
1025
|
-
children: a.map((U) => /* @__PURE__ */
|
|
1174
|
+
children: a.map((U) => /* @__PURE__ */ o.jsx(
|
|
1026
1175
|
"td",
|
|
1027
1176
|
{
|
|
1028
1177
|
className: U.className,
|
|
1029
1178
|
children: U.render ? U.render(P) : P[U.key]
|
|
1030
1179
|
},
|
|
1031
|
-
`${
|
|
1180
|
+
`${G}-${U.key}`
|
|
1032
1181
|
))
|
|
1033
1182
|
},
|
|
1034
|
-
|
|
1183
|
+
G
|
|
1035
1184
|
);
|
|
1036
1185
|
}) })
|
|
1037
1186
|
] }) }),
|
|
1038
|
-
i !== "none" && /* @__PURE__ */
|
|
1039
|
-
|
|
1187
|
+
i !== "none" && /* @__PURE__ */ o.jsx("div", { className: "mt-4", children: /* @__PURE__ */ o.jsx(
|
|
1188
|
+
Qt,
|
|
1040
1189
|
{
|
|
1041
1190
|
page: x,
|
|
1042
1191
|
perPage: M,
|
|
1043
1192
|
total: w,
|
|
1044
|
-
onPageChange:
|
|
1193
|
+
onPageChange: de
|
|
1045
1194
|
}
|
|
1046
1195
|
) })
|
|
1047
1196
|
] }) });
|
|
1048
1197
|
}
|
|
1049
|
-
function
|
|
1198
|
+
function _s({
|
|
1050
1199
|
errors: r,
|
|
1051
1200
|
className: e = ""
|
|
1052
1201
|
}) {
|
|
1053
|
-
return !Array.isArray(r) || r.length === 0 ? null : /* @__PURE__ */
|
|
1202
|
+
return !Array.isArray(r) || r.length === 0 ? null : /* @__PURE__ */ o.jsx("div", { className: `alert alert-error mb-4 ${e}`.trim(), children: /* @__PURE__ */ o.jsx("ul", { className: "list-disc list-inside", children: r.map((t, s) => /* @__PURE__ */ o.jsx("li", { children: t }, s)) }) });
|
|
1054
1203
|
}
|
|
1055
|
-
var
|
|
1204
|
+
var bs = Object.defineProperty, Be = Object.getOwnPropertySymbols, Jt = Object.prototype.hasOwnProperty, Xt = Object.prototype.propertyIsEnumerable, Nt = (r, e, t) => e in r ? bs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, rt = (r, e) => {
|
|
1056
1205
|
for (var t in e || (e = {}))
|
|
1057
|
-
|
|
1058
|
-
if (
|
|
1059
|
-
for (var t of
|
|
1060
|
-
|
|
1206
|
+
Jt.call(e, t) && Nt(r, t, e[t]);
|
|
1207
|
+
if (Be)
|
|
1208
|
+
for (var t of Be(e))
|
|
1209
|
+
Xt.call(e, t) && Nt(r, t, e[t]);
|
|
1061
1210
|
return r;
|
|
1062
|
-
},
|
|
1211
|
+
}, st = (r, e) => {
|
|
1063
1212
|
var t = {};
|
|
1064
1213
|
for (var s in r)
|
|
1065
|
-
|
|
1066
|
-
if (r != null &&
|
|
1067
|
-
for (var s of
|
|
1068
|
-
e.indexOf(s) < 0 &&
|
|
1214
|
+
Jt.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
|
|
1215
|
+
if (r != null && Be)
|
|
1216
|
+
for (var s of Be(r))
|
|
1217
|
+
e.indexOf(s) < 0 && Xt.call(r, s) && (t[s] = r[s]);
|
|
1069
1218
|
return t;
|
|
1070
1219
|
};
|
|
1071
|
-
var
|
|
1220
|
+
var ue;
|
|
1072
1221
|
((r) => {
|
|
1073
1222
|
const e = class S {
|
|
1074
1223
|
/*-- Constructor (low level) and fields --*/
|
|
@@ -1076,25 +1225,25 @@ var ce;
|
|
|
1076
1225
|
// error correction level, data codeword bytes, and mask number.
|
|
1077
1226
|
// This is a low-level API that most users should not use directly.
|
|
1078
1227
|
// A mid-level API is the encodeSegments() function.
|
|
1079
|
-
constructor(i,
|
|
1080
|
-
if (this.version = i, this.errorCorrectionLevel =
|
|
1228
|
+
constructor(i, l, c, f) {
|
|
1229
|
+
if (this.version = i, this.errorCorrectionLevel = l, this.modules = [], this.isFunction = [], i < S.MIN_VERSION || i > S.MAX_VERSION)
|
|
1081
1230
|
throw new RangeError("Version value out of range");
|
|
1082
1231
|
if (f < -1 || f > 7)
|
|
1083
1232
|
throw new RangeError("Mask value out of range");
|
|
1084
1233
|
this.size = i * 4 + 17;
|
|
1085
1234
|
let h = [];
|
|
1086
|
-
for (let
|
|
1235
|
+
for (let v = 0; v < this.size; v++)
|
|
1087
1236
|
h.push(!1);
|
|
1088
|
-
for (let
|
|
1237
|
+
for (let v = 0; v < this.size; v++)
|
|
1089
1238
|
this.modules.push(h.slice()), this.isFunction.push(h.slice());
|
|
1090
1239
|
this.drawFunctionPatterns();
|
|
1091
|
-
const p = this.addEccAndInterleave(
|
|
1240
|
+
const p = this.addEccAndInterleave(c);
|
|
1092
1241
|
if (this.drawCodewords(p), f == -1) {
|
|
1093
|
-
let
|
|
1242
|
+
let v = 1e9;
|
|
1094
1243
|
for (let w = 0; w < 8; w++) {
|
|
1095
1244
|
this.applyMask(w), this.drawFormatBits(w);
|
|
1096
1245
|
const x = this.getPenaltyScore();
|
|
1097
|
-
x <
|
|
1246
|
+
x < v && (f = w, v = x), this.applyMask(w);
|
|
1098
1247
|
}
|
|
1099
1248
|
}
|
|
1100
1249
|
n(0 <= f && f <= 7), this.mask = f, this.applyMask(f), this.drawFormatBits(f), this.isFunction = [];
|
|
@@ -1105,17 +1254,17 @@ var ce;
|
|
|
1105
1254
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
1106
1255
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
1107
1256
|
// ecl argument if it can be done without increasing the version.
|
|
1108
|
-
static encodeText(i,
|
|
1109
|
-
const
|
|
1110
|
-
return S.encodeSegments(
|
|
1257
|
+
static encodeText(i, l) {
|
|
1258
|
+
const c = r.QrSegment.makeSegments(i);
|
|
1259
|
+
return S.encodeSegments(c, l);
|
|
1111
1260
|
}
|
|
1112
1261
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
1113
1262
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
1114
1263
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
1115
1264
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
1116
|
-
static encodeBinary(i,
|
|
1117
|
-
const
|
|
1118
|
-
return S.encodeSegments([
|
|
1265
|
+
static encodeBinary(i, l) {
|
|
1266
|
+
const c = r.QrSegment.makeBytes(i);
|
|
1267
|
+
return S.encodeSegments([c], l);
|
|
1119
1268
|
}
|
|
1120
1269
|
/*-- Static factory functions (mid level) --*/
|
|
1121
1270
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -1127,43 +1276,43 @@ var ce;
|
|
|
1127
1276
|
// This function allows the user to create a custom sequence of segments that switches
|
|
1128
1277
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
1129
1278
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
1130
|
-
static encodeSegments(i,
|
|
1131
|
-
if (!(S.MIN_VERSION <=
|
|
1279
|
+
static encodeSegments(i, l, c = 1, f = 40, h = -1, p = !0) {
|
|
1280
|
+
if (!(S.MIN_VERSION <= c && c <= f && f <= S.MAX_VERSION) || h < -1 || h > 7)
|
|
1132
1281
|
throw new RangeError("Invalid value");
|
|
1133
|
-
let
|
|
1134
|
-
for (
|
|
1135
|
-
const
|
|
1136
|
-
if (I <=
|
|
1282
|
+
let v, w;
|
|
1283
|
+
for (v = c; ; v++) {
|
|
1284
|
+
const j = S.getNumDataCodewords(v, l) * 8, I = d.getTotalBits(i, v);
|
|
1285
|
+
if (I <= j) {
|
|
1137
1286
|
w = I;
|
|
1138
1287
|
break;
|
|
1139
1288
|
}
|
|
1140
|
-
if (
|
|
1289
|
+
if (v >= f)
|
|
1141
1290
|
throw new RangeError("Data too long");
|
|
1142
1291
|
}
|
|
1143
|
-
for (const
|
|
1144
|
-
p && w <= S.getNumDataCodewords(
|
|
1292
|
+
for (const j of [S.Ecc.MEDIUM, S.Ecc.QUARTILE, S.Ecc.HIGH])
|
|
1293
|
+
p && w <= S.getNumDataCodewords(v, j) * 8 && (l = j);
|
|
1145
1294
|
let x = [];
|
|
1146
|
-
for (const
|
|
1147
|
-
t(
|
|
1148
|
-
for (const I of
|
|
1295
|
+
for (const j of i) {
|
|
1296
|
+
t(j.mode.modeBits, 4, x), t(j.numChars, j.mode.numCharCountBits(v), x);
|
|
1297
|
+
for (const I of j.getData())
|
|
1149
1298
|
x.push(I);
|
|
1150
1299
|
}
|
|
1151
1300
|
n(x.length == w);
|
|
1152
|
-
const M = S.getNumDataCodewords(
|
|
1301
|
+
const M = S.getNumDataCodewords(v, l) * 8;
|
|
1153
1302
|
n(x.length <= M), t(0, Math.min(4, M - x.length), x), t(0, (8 - x.length % 8) % 8, x), n(x.length % 8 == 0);
|
|
1154
|
-
for (let
|
|
1155
|
-
t(
|
|
1156
|
-
let
|
|
1157
|
-
for (;
|
|
1158
|
-
|
|
1159
|
-
return x.forEach((
|
|
1303
|
+
for (let j = 236; x.length < M; j ^= 253)
|
|
1304
|
+
t(j, 8, x);
|
|
1305
|
+
let A = [];
|
|
1306
|
+
for (; A.length * 8 < x.length; )
|
|
1307
|
+
A.push(0);
|
|
1308
|
+
return x.forEach((j, I) => A[I >>> 3] |= j << 7 - (I & 7)), new S(v, l, A, h);
|
|
1160
1309
|
}
|
|
1161
1310
|
/*-- Accessor methods --*/
|
|
1162
1311
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
1163
1312
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
|
1164
1313
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
|
1165
|
-
getModule(i,
|
|
1166
|
-
return 0 <= i && i < this.size && 0 <=
|
|
1314
|
+
getModule(i, l) {
|
|
1315
|
+
return 0 <= i && i < this.size && 0 <= l && l < this.size && this.modules[l][i];
|
|
1167
1316
|
}
|
|
1168
1317
|
// Modified to expose modules for easy access
|
|
1169
1318
|
getModules() {
|
|
@@ -1172,23 +1321,23 @@ var ce;
|
|
|
1172
1321
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
|
1173
1322
|
// Reads this object's version field, and draws and marks all function modules.
|
|
1174
1323
|
drawFunctionPatterns() {
|
|
1175
|
-
for (let
|
|
1176
|
-
this.setFunctionModule(6,
|
|
1324
|
+
for (let c = 0; c < this.size; c++)
|
|
1325
|
+
this.setFunctionModule(6, c, c % 2 == 0), this.setFunctionModule(c, 6, c % 2 == 0);
|
|
1177
1326
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
1178
|
-
const i = this.getAlignmentPatternPositions(),
|
|
1179
|
-
for (let
|
|
1180
|
-
for (let f = 0; f <
|
|
1181
|
-
|
|
1327
|
+
const i = this.getAlignmentPatternPositions(), l = i.length;
|
|
1328
|
+
for (let c = 0; c < l; c++)
|
|
1329
|
+
for (let f = 0; f < l; f++)
|
|
1330
|
+
c == 0 && f == 0 || c == 0 && f == l - 1 || c == l - 1 && f == 0 || this.drawAlignmentPattern(i[c], i[f]);
|
|
1182
1331
|
this.drawFormatBits(0), this.drawVersion();
|
|
1183
1332
|
}
|
|
1184
1333
|
// Draws two copies of the format bits (with its own error correction code)
|
|
1185
1334
|
// based on the given mask and this object's error correction level field.
|
|
1186
1335
|
drawFormatBits(i) {
|
|
1187
|
-
const
|
|
1188
|
-
let
|
|
1336
|
+
const l = this.errorCorrectionLevel.formatBits << 3 | i;
|
|
1337
|
+
let c = l;
|
|
1189
1338
|
for (let h = 0; h < 10; h++)
|
|
1190
|
-
|
|
1191
|
-
const f = (
|
|
1339
|
+
c = c << 1 ^ (c >>> 9) * 1335;
|
|
1340
|
+
const f = (l << 10 | c) ^ 21522;
|
|
1192
1341
|
n(f >>> 15 == 0);
|
|
1193
1342
|
for (let h = 0; h <= 5; h++)
|
|
1194
1343
|
this.setFunctionModule(8, h, s(f, h));
|
|
@@ -1207,74 +1356,74 @@ var ce;
|
|
|
1207
1356
|
if (this.version < 7)
|
|
1208
1357
|
return;
|
|
1209
1358
|
let i = this.version;
|
|
1210
|
-
for (let
|
|
1359
|
+
for (let c = 0; c < 12; c++)
|
|
1211
1360
|
i = i << 1 ^ (i >>> 11) * 7973;
|
|
1212
|
-
const
|
|
1213
|
-
n(
|
|
1214
|
-
for (let
|
|
1215
|
-
const f = s(
|
|
1361
|
+
const l = this.version << 12 | i;
|
|
1362
|
+
n(l >>> 18 == 0);
|
|
1363
|
+
for (let c = 0; c < 18; c++) {
|
|
1364
|
+
const f = s(l, c), h = this.size - 11 + c % 3, p = Math.floor(c / 3);
|
|
1216
1365
|
this.setFunctionModule(h, p, f), this.setFunctionModule(p, h, f);
|
|
1217
1366
|
}
|
|
1218
1367
|
}
|
|
1219
1368
|
// Draws a 9*9 finder pattern including the border separator,
|
|
1220
1369
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
1221
|
-
drawFinderPattern(i,
|
|
1222
|
-
for (let
|
|
1370
|
+
drawFinderPattern(i, l) {
|
|
1371
|
+
for (let c = -4; c <= 4; c++)
|
|
1223
1372
|
for (let f = -4; f <= 4; f++) {
|
|
1224
|
-
const h = Math.max(Math.abs(f), Math.abs(
|
|
1225
|
-
0 <= p && p < this.size && 0 <=
|
|
1373
|
+
const h = Math.max(Math.abs(f), Math.abs(c)), p = i + f, v = l + c;
|
|
1374
|
+
0 <= p && p < this.size && 0 <= v && v < this.size && this.setFunctionModule(p, v, h != 2 && h != 4);
|
|
1226
1375
|
}
|
|
1227
1376
|
}
|
|
1228
1377
|
// Draws a 5*5 alignment pattern, with the center module
|
|
1229
1378
|
// at (x, y). All modules must be in bounds.
|
|
1230
|
-
drawAlignmentPattern(i,
|
|
1231
|
-
for (let
|
|
1379
|
+
drawAlignmentPattern(i, l) {
|
|
1380
|
+
for (let c = -2; c <= 2; c++)
|
|
1232
1381
|
for (let f = -2; f <= 2; f++)
|
|
1233
|
-
this.setFunctionModule(i + f,
|
|
1382
|
+
this.setFunctionModule(i + f, l + c, Math.max(Math.abs(f), Math.abs(c)) != 1);
|
|
1234
1383
|
}
|
|
1235
1384
|
// Sets the color of a module and marks it as a function module.
|
|
1236
1385
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
1237
|
-
setFunctionModule(i,
|
|
1238
|
-
this.modules[
|
|
1386
|
+
setFunctionModule(i, l, c) {
|
|
1387
|
+
this.modules[l][i] = c, this.isFunction[l][i] = !0;
|
|
1239
1388
|
}
|
|
1240
1389
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
1241
1390
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
1242
1391
|
// codewords appended to it, based on this object's version and error correction level.
|
|
1243
1392
|
addEccAndInterleave(i) {
|
|
1244
|
-
const
|
|
1245
|
-
if (i.length != S.getNumDataCodewords(
|
|
1393
|
+
const l = this.version, c = this.errorCorrectionLevel;
|
|
1394
|
+
if (i.length != S.getNumDataCodewords(l, c))
|
|
1246
1395
|
throw new RangeError("Invalid argument");
|
|
1247
|
-
const f = S.NUM_ERROR_CORRECTION_BLOCKS[
|
|
1396
|
+
const f = S.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l], h = S.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l], p = Math.floor(S.getNumRawDataModules(l) / 8), v = f - p % f, w = Math.floor(p / f);
|
|
1248
1397
|
let x = [];
|
|
1249
1398
|
const M = S.reedSolomonComputeDivisor(h);
|
|
1250
|
-
for (let
|
|
1251
|
-
let L = i.slice(I, I + w - h + (
|
|
1399
|
+
for (let j = 0, I = 0; j < f; j++) {
|
|
1400
|
+
let L = i.slice(I, I + w - h + (j < v ? 0 : 1));
|
|
1252
1401
|
I += L.length;
|
|
1253
1402
|
const O = S.reedSolomonComputeRemainder(L, M);
|
|
1254
|
-
|
|
1403
|
+
j < v && L.push(0), x.push(L.concat(O));
|
|
1255
1404
|
}
|
|
1256
|
-
let
|
|
1257
|
-
for (let
|
|
1405
|
+
let A = [];
|
|
1406
|
+
for (let j = 0; j < x[0].length; j++)
|
|
1258
1407
|
x.forEach((I, L) => {
|
|
1259
|
-
(
|
|
1408
|
+
(j != w - h || L >= v) && A.push(I[j]);
|
|
1260
1409
|
});
|
|
1261
|
-
return n(
|
|
1410
|
+
return n(A.length == p), A;
|
|
1262
1411
|
}
|
|
1263
1412
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
1264
1413
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
1265
1414
|
drawCodewords(i) {
|
|
1266
1415
|
if (i.length != Math.floor(S.getNumRawDataModules(this.version) / 8))
|
|
1267
1416
|
throw new RangeError("Invalid argument");
|
|
1268
|
-
let
|
|
1269
|
-
for (let
|
|
1270
|
-
|
|
1417
|
+
let l = 0;
|
|
1418
|
+
for (let c = this.size - 1; c >= 1; c -= 2) {
|
|
1419
|
+
c == 6 && (c = 5);
|
|
1271
1420
|
for (let f = 0; f < this.size; f++)
|
|
1272
1421
|
for (let h = 0; h < 2; h++) {
|
|
1273
|
-
const p =
|
|
1274
|
-
!this.isFunction[w][p] &&
|
|
1422
|
+
const p = c - h, w = (c + 1 & 2) == 0 ? this.size - 1 - f : f;
|
|
1423
|
+
!this.isFunction[w][p] && l < i.length * 8 && (this.modules[w][p] = s(i[l >>> 3], 7 - (l & 7)), l++);
|
|
1275
1424
|
}
|
|
1276
1425
|
}
|
|
1277
|
-
n(
|
|
1426
|
+
n(l == i.length * 8);
|
|
1278
1427
|
}
|
|
1279
1428
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
1280
1429
|
// The function modules must be marked and the codeword bits must be drawn
|
|
@@ -1284,38 +1433,38 @@ var ce;
|
|
|
1284
1433
|
applyMask(i) {
|
|
1285
1434
|
if (i < 0 || i > 7)
|
|
1286
1435
|
throw new RangeError("Mask value out of range");
|
|
1287
|
-
for (let
|
|
1288
|
-
for (let
|
|
1436
|
+
for (let l = 0; l < this.size; l++)
|
|
1437
|
+
for (let c = 0; c < this.size; c++) {
|
|
1289
1438
|
let f;
|
|
1290
1439
|
switch (i) {
|
|
1291
1440
|
case 0:
|
|
1292
|
-
f = (
|
|
1441
|
+
f = (c + l) % 2 == 0;
|
|
1293
1442
|
break;
|
|
1294
1443
|
case 1:
|
|
1295
|
-
f =
|
|
1444
|
+
f = l % 2 == 0;
|
|
1296
1445
|
break;
|
|
1297
1446
|
case 2:
|
|
1298
|
-
f =
|
|
1447
|
+
f = c % 3 == 0;
|
|
1299
1448
|
break;
|
|
1300
1449
|
case 3:
|
|
1301
|
-
f = (
|
|
1450
|
+
f = (c + l) % 3 == 0;
|
|
1302
1451
|
break;
|
|
1303
1452
|
case 4:
|
|
1304
|
-
f = (Math.floor(
|
|
1453
|
+
f = (Math.floor(c / 3) + Math.floor(l / 2)) % 2 == 0;
|
|
1305
1454
|
break;
|
|
1306
1455
|
case 5:
|
|
1307
|
-
f =
|
|
1456
|
+
f = c * l % 2 + c * l % 3 == 0;
|
|
1308
1457
|
break;
|
|
1309
1458
|
case 6:
|
|
1310
|
-
f = (
|
|
1459
|
+
f = (c * l % 2 + c * l % 3) % 2 == 0;
|
|
1311
1460
|
break;
|
|
1312
1461
|
case 7:
|
|
1313
|
-
f = ((
|
|
1462
|
+
f = ((c + l) % 2 + c * l % 3) % 2 == 0;
|
|
1314
1463
|
break;
|
|
1315
1464
|
default:
|
|
1316
1465
|
throw new Error("Unreachable");
|
|
1317
1466
|
}
|
|
1318
|
-
!this.isFunction[
|
|
1467
|
+
!this.isFunction[l][c] && f && (this.modules[l][c] = !this.modules[l][c]);
|
|
1319
1468
|
}
|
|
1320
1469
|
}
|
|
1321
1470
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
@@ -1323,26 +1472,26 @@ var ce;
|
|
|
1323
1472
|
getPenaltyScore() {
|
|
1324
1473
|
let i = 0;
|
|
1325
1474
|
for (let h = 0; h < this.size; h++) {
|
|
1326
|
-
let p = !1,
|
|
1475
|
+
let p = !1, v = 0, w = [0, 0, 0, 0, 0, 0, 0];
|
|
1327
1476
|
for (let x = 0; x < this.size; x++)
|
|
1328
|
-
this.modules[h][x] == p ? (
|
|
1329
|
-
i += this.finderPenaltyTerminateAndCount(p,
|
|
1477
|
+
this.modules[h][x] == p ? (v++, v == 5 ? i += S.PENALTY_N1 : v > 5 && i++) : (this.finderPenaltyAddHistory(v, w), p || (i += this.finderPenaltyCountPatterns(w) * S.PENALTY_N3), p = this.modules[h][x], v = 1);
|
|
1478
|
+
i += this.finderPenaltyTerminateAndCount(p, v, w) * S.PENALTY_N3;
|
|
1330
1479
|
}
|
|
1331
1480
|
for (let h = 0; h < this.size; h++) {
|
|
1332
|
-
let p = !1,
|
|
1481
|
+
let p = !1, v = 0, w = [0, 0, 0, 0, 0, 0, 0];
|
|
1333
1482
|
for (let x = 0; x < this.size; x++)
|
|
1334
|
-
this.modules[x][h] == p ? (
|
|
1335
|
-
i += this.finderPenaltyTerminateAndCount(p,
|
|
1483
|
+
this.modules[x][h] == p ? (v++, v == 5 ? i += S.PENALTY_N1 : v > 5 && i++) : (this.finderPenaltyAddHistory(v, w), p || (i += this.finderPenaltyCountPatterns(w) * S.PENALTY_N3), p = this.modules[x][h], v = 1);
|
|
1484
|
+
i += this.finderPenaltyTerminateAndCount(p, v, w) * S.PENALTY_N3;
|
|
1336
1485
|
}
|
|
1337
1486
|
for (let h = 0; h < this.size - 1; h++)
|
|
1338
1487
|
for (let p = 0; p < this.size - 1; p++) {
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1488
|
+
const v = this.modules[h][p];
|
|
1489
|
+
v == this.modules[h][p + 1] && v == this.modules[h + 1][p] && v == this.modules[h + 1][p + 1] && (i += S.PENALTY_N2);
|
|
1341
1490
|
}
|
|
1342
|
-
let
|
|
1491
|
+
let l = 0;
|
|
1343
1492
|
for (const h of this.modules)
|
|
1344
|
-
|
|
1345
|
-
const
|
|
1493
|
+
l = h.reduce((p, v) => p + (v ? 1 : 0), l);
|
|
1494
|
+
const c = this.size * this.size, f = Math.ceil(Math.abs(l * 20 - c * 10) / c) - 1;
|
|
1346
1495
|
return n(0 <= f && f <= 9), i += f * S.PENALTY_N4, n(0 <= i && i <= 2568888), i;
|
|
1347
1496
|
}
|
|
1348
1497
|
/*-- Private helper functions --*/
|
|
@@ -1353,11 +1502,11 @@ var ce;
|
|
|
1353
1502
|
if (this.version == 1)
|
|
1354
1503
|
return [];
|
|
1355
1504
|
{
|
|
1356
|
-
const i = Math.floor(this.version / 7) + 2,
|
|
1357
|
-
let
|
|
1358
|
-
for (let f = this.size - 7;
|
|
1359
|
-
|
|
1360
|
-
return
|
|
1505
|
+
const i = Math.floor(this.version / 7) + 2, l = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (i * 2 - 2)) * 2;
|
|
1506
|
+
let c = [6];
|
|
1507
|
+
for (let f = this.size - 7; c.length < i; f -= l)
|
|
1508
|
+
c.splice(1, 0, f);
|
|
1509
|
+
return c;
|
|
1361
1510
|
}
|
|
1362
1511
|
}
|
|
1363
1512
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
@@ -1366,70 +1515,70 @@ var ce;
|
|
|
1366
1515
|
static getNumRawDataModules(i) {
|
|
1367
1516
|
if (i < S.MIN_VERSION || i > S.MAX_VERSION)
|
|
1368
1517
|
throw new RangeError("Version number out of range");
|
|
1369
|
-
let
|
|
1518
|
+
let l = (16 * i + 128) * i + 64;
|
|
1370
1519
|
if (i >= 2) {
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1520
|
+
const c = Math.floor(i / 7) + 2;
|
|
1521
|
+
l -= (25 * c - 10) * c - 55, i >= 7 && (l -= 36);
|
|
1373
1522
|
}
|
|
1374
|
-
return n(208 <=
|
|
1523
|
+
return n(208 <= l && l <= 29648), l;
|
|
1375
1524
|
}
|
|
1376
1525
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
1377
1526
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
1378
1527
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
1379
|
-
static getNumDataCodewords(i,
|
|
1380
|
-
return Math.floor(S.getNumRawDataModules(i) / 8) - S.ECC_CODEWORDS_PER_BLOCK[
|
|
1528
|
+
static getNumDataCodewords(i, l) {
|
|
1529
|
+
return Math.floor(S.getNumRawDataModules(i) / 8) - S.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i] * S.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i];
|
|
1381
1530
|
}
|
|
1382
1531
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
1383
1532
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
1384
1533
|
static reedSolomonComputeDivisor(i) {
|
|
1385
1534
|
if (i < 1 || i > 255)
|
|
1386
1535
|
throw new RangeError("Degree out of range");
|
|
1387
|
-
let
|
|
1536
|
+
let l = [];
|
|
1388
1537
|
for (let f = 0; f < i - 1; f++)
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
let
|
|
1538
|
+
l.push(0);
|
|
1539
|
+
l.push(1);
|
|
1540
|
+
let c = 1;
|
|
1392
1541
|
for (let f = 0; f < i; f++) {
|
|
1393
|
-
for (let h = 0; h <
|
|
1394
|
-
|
|
1395
|
-
|
|
1542
|
+
for (let h = 0; h < l.length; h++)
|
|
1543
|
+
l[h] = S.reedSolomonMultiply(l[h], c), h + 1 < l.length && (l[h] ^= l[h + 1]);
|
|
1544
|
+
c = S.reedSolomonMultiply(c, 2);
|
|
1396
1545
|
}
|
|
1397
|
-
return
|
|
1546
|
+
return l;
|
|
1398
1547
|
}
|
|
1399
1548
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
1400
|
-
static reedSolomonComputeRemainder(i,
|
|
1401
|
-
let
|
|
1549
|
+
static reedSolomonComputeRemainder(i, l) {
|
|
1550
|
+
let c = l.map((f) => 0);
|
|
1402
1551
|
for (const f of i) {
|
|
1403
|
-
const h = f ^
|
|
1404
|
-
|
|
1552
|
+
const h = f ^ c.shift();
|
|
1553
|
+
c.push(0), l.forEach((p, v) => c[v] ^= S.reedSolomonMultiply(p, h));
|
|
1405
1554
|
}
|
|
1406
|
-
return
|
|
1555
|
+
return c;
|
|
1407
1556
|
}
|
|
1408
1557
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
1409
1558
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
1410
|
-
static reedSolomonMultiply(i,
|
|
1411
|
-
if (i >>> 8 ||
|
|
1559
|
+
static reedSolomonMultiply(i, l) {
|
|
1560
|
+
if (i >>> 8 || l >>> 8)
|
|
1412
1561
|
throw new RangeError("Byte out of range");
|
|
1413
|
-
let
|
|
1562
|
+
let c = 0;
|
|
1414
1563
|
for (let f = 7; f >= 0; f--)
|
|
1415
|
-
|
|
1416
|
-
return n(
|
|
1564
|
+
c = c << 1 ^ (c >>> 7) * 285, c ^= (l >>> f & 1) * i;
|
|
1565
|
+
return n(c >>> 8 == 0), c;
|
|
1417
1566
|
}
|
|
1418
1567
|
// Can only be called immediately after a light run is added, and
|
|
1419
1568
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
1420
1569
|
finderPenaltyCountPatterns(i) {
|
|
1421
|
-
const
|
|
1422
|
-
n(
|
|
1423
|
-
const
|
|
1424
|
-
return (
|
|
1570
|
+
const l = i[1];
|
|
1571
|
+
n(l <= this.size * 3);
|
|
1572
|
+
const c = l > 0 && i[2] == l && i[3] == l * 3 && i[4] == l && i[5] == l;
|
|
1573
|
+
return (c && i[0] >= l * 4 && i[6] >= l ? 1 : 0) + (c && i[6] >= l * 4 && i[0] >= l ? 1 : 0);
|
|
1425
1574
|
}
|
|
1426
1575
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
1427
|
-
finderPenaltyTerminateAndCount(i,
|
|
1428
|
-
return i && (this.finderPenaltyAddHistory(
|
|
1576
|
+
finderPenaltyTerminateAndCount(i, l, c) {
|
|
1577
|
+
return i && (this.finderPenaltyAddHistory(l, c), l = 0), l += this.size, this.finderPenaltyAddHistory(l, c), this.finderPenaltyCountPatterns(c);
|
|
1429
1578
|
}
|
|
1430
1579
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
1431
|
-
finderPenaltyAddHistory(i,
|
|
1432
|
-
|
|
1580
|
+
finderPenaltyAddHistory(i, l) {
|
|
1581
|
+
l[0] == 0 && (i += this.size), l.pop(), l.unshift(i);
|
|
1433
1582
|
}
|
|
1434
1583
|
};
|
|
1435
1584
|
e.MIN_VERSION = 1, e.MAX_VERSION = 40, e.PENALTY_N1 = 3, e.PENALTY_N2 = 3, e.PENALTY_N3 = 40, e.PENALTY_N4 = 10, e.ECC_CODEWORDS_PER_BLOCK = [
|
|
@@ -1455,11 +1604,11 @@ var ce;
|
|
|
1455
1604
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
1456
1605
|
// High
|
|
1457
1606
|
], r.QrCode = e;
|
|
1458
|
-
function t(u, i,
|
|
1607
|
+
function t(u, i, l) {
|
|
1459
1608
|
if (i < 0 || i > 31 || u >>> i)
|
|
1460
1609
|
throw new RangeError("Value out of range");
|
|
1461
|
-
for (let
|
|
1462
|
-
|
|
1610
|
+
for (let c = i - 1; c >= 0; c--)
|
|
1611
|
+
l.push(u >>> c & 1);
|
|
1463
1612
|
}
|
|
1464
1613
|
function s(u, i) {
|
|
1465
1614
|
return (u >>> i & 1) != 0;
|
|
@@ -1468,81 +1617,81 @@ var ce;
|
|
|
1468
1617
|
if (!u)
|
|
1469
1618
|
throw new Error("Assertion error");
|
|
1470
1619
|
}
|
|
1471
|
-
const a = class
|
|
1620
|
+
const a = class F {
|
|
1472
1621
|
/*-- Constructor (low level) and fields --*/
|
|
1473
1622
|
// Creates a new QR Code segment with the given attributes and data.
|
|
1474
1623
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
1475
1624
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
1476
|
-
constructor(i,
|
|
1477
|
-
if (this.mode = i, this.numChars =
|
|
1625
|
+
constructor(i, l, c) {
|
|
1626
|
+
if (this.mode = i, this.numChars = l, this.bitData = c, l < 0)
|
|
1478
1627
|
throw new RangeError("Invalid argument");
|
|
1479
|
-
this.bitData =
|
|
1628
|
+
this.bitData = c.slice();
|
|
1480
1629
|
}
|
|
1481
1630
|
/*-- Static factory functions (mid level) --*/
|
|
1482
1631
|
// Returns a segment representing the given binary data encoded in
|
|
1483
1632
|
// byte mode. All input byte arrays are acceptable. Any text string
|
|
1484
1633
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
1485
1634
|
static makeBytes(i) {
|
|
1486
|
-
let
|
|
1487
|
-
for (const
|
|
1488
|
-
t(
|
|
1489
|
-
return new
|
|
1635
|
+
let l = [];
|
|
1636
|
+
for (const c of i)
|
|
1637
|
+
t(c, 8, l);
|
|
1638
|
+
return new F(F.Mode.BYTE, i.length, l);
|
|
1490
1639
|
}
|
|
1491
1640
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
1492
1641
|
static makeNumeric(i) {
|
|
1493
|
-
if (!
|
|
1642
|
+
if (!F.isNumeric(i))
|
|
1494
1643
|
throw new RangeError("String contains non-numeric characters");
|
|
1495
|
-
let
|
|
1496
|
-
for (let
|
|
1497
|
-
const f = Math.min(i.length -
|
|
1498
|
-
t(parseInt(i.substring(
|
|
1644
|
+
let l = [];
|
|
1645
|
+
for (let c = 0; c < i.length; ) {
|
|
1646
|
+
const f = Math.min(i.length - c, 3);
|
|
1647
|
+
t(parseInt(i.substring(c, c + f), 10), f * 3 + 1, l), c += f;
|
|
1499
1648
|
}
|
|
1500
|
-
return new
|
|
1649
|
+
return new F(F.Mode.NUMERIC, i.length, l);
|
|
1501
1650
|
}
|
|
1502
1651
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
1503
1652
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
1504
1653
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
1505
1654
|
static makeAlphanumeric(i) {
|
|
1506
|
-
if (!
|
|
1655
|
+
if (!F.isAlphanumeric(i))
|
|
1507
1656
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
1508
|
-
let
|
|
1509
|
-
for (
|
|
1510
|
-
let f =
|
|
1511
|
-
f +=
|
|
1657
|
+
let l = [], c;
|
|
1658
|
+
for (c = 0; c + 2 <= i.length; c += 2) {
|
|
1659
|
+
let f = F.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)) * 45;
|
|
1660
|
+
f += F.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c + 1)), t(f, 11, l);
|
|
1512
1661
|
}
|
|
1513
|
-
return
|
|
1662
|
+
return c < i.length && t(F.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)), 6, l), new F(F.Mode.ALPHANUMERIC, i.length, l);
|
|
1514
1663
|
}
|
|
1515
1664
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
1516
1665
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
1517
1666
|
static makeSegments(i) {
|
|
1518
|
-
return i == "" ? [] :
|
|
1667
|
+
return i == "" ? [] : F.isNumeric(i) ? [F.makeNumeric(i)] : F.isAlphanumeric(i) ? [F.makeAlphanumeric(i)] : [F.makeBytes(F.toUtf8ByteArray(i))];
|
|
1519
1668
|
}
|
|
1520
1669
|
// Returns a segment representing an Extended Channel Interpretation
|
|
1521
1670
|
// (ECI) designator with the given assignment value.
|
|
1522
1671
|
static makeEci(i) {
|
|
1523
|
-
let
|
|
1672
|
+
let l = [];
|
|
1524
1673
|
if (i < 0)
|
|
1525
1674
|
throw new RangeError("ECI assignment value out of range");
|
|
1526
1675
|
if (i < 128)
|
|
1527
|
-
t(i, 8,
|
|
1676
|
+
t(i, 8, l);
|
|
1528
1677
|
else if (i < 16384)
|
|
1529
|
-
t(2, 2,
|
|
1678
|
+
t(2, 2, l), t(i, 14, l);
|
|
1530
1679
|
else if (i < 1e6)
|
|
1531
|
-
t(6, 3,
|
|
1680
|
+
t(6, 3, l), t(i, 21, l);
|
|
1532
1681
|
else
|
|
1533
1682
|
throw new RangeError("ECI assignment value out of range");
|
|
1534
|
-
return new
|
|
1683
|
+
return new F(F.Mode.ECI, 0, l);
|
|
1535
1684
|
}
|
|
1536
1685
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
1537
1686
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
1538
1687
|
static isNumeric(i) {
|
|
1539
|
-
return
|
|
1688
|
+
return F.NUMERIC_REGEX.test(i);
|
|
1540
1689
|
}
|
|
1541
1690
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
1542
1691
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
1543
1692
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
1544
1693
|
static isAlphanumeric(i) {
|
|
1545
|
-
return
|
|
1694
|
+
return F.ALPHANUMERIC_REGEX.test(i);
|
|
1546
1695
|
}
|
|
1547
1696
|
/*-- Methods --*/
|
|
1548
1697
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -1551,29 +1700,29 @@ var ce;
|
|
|
1551
1700
|
}
|
|
1552
1701
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
1553
1702
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
1554
|
-
static getTotalBits(i,
|
|
1555
|
-
let
|
|
1703
|
+
static getTotalBits(i, l) {
|
|
1704
|
+
let c = 0;
|
|
1556
1705
|
for (const f of i) {
|
|
1557
|
-
const h = f.mode.numCharCountBits(
|
|
1706
|
+
const h = f.mode.numCharCountBits(l);
|
|
1558
1707
|
if (f.numChars >= 1 << h)
|
|
1559
1708
|
return 1 / 0;
|
|
1560
|
-
|
|
1709
|
+
c += 4 + h + f.bitData.length;
|
|
1561
1710
|
}
|
|
1562
|
-
return
|
|
1711
|
+
return c;
|
|
1563
1712
|
}
|
|
1564
1713
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
1565
1714
|
static toUtf8ByteArray(i) {
|
|
1566
1715
|
i = encodeURI(i);
|
|
1567
|
-
let
|
|
1568
|
-
for (let
|
|
1569
|
-
i.charAt(
|
|
1570
|
-
return
|
|
1716
|
+
let l = [];
|
|
1717
|
+
for (let c = 0; c < i.length; c++)
|
|
1718
|
+
i.charAt(c) != "%" ? l.push(i.charCodeAt(c)) : (l.push(parseInt(i.substring(c + 1, c + 3), 16)), c += 2);
|
|
1719
|
+
return l;
|
|
1571
1720
|
}
|
|
1572
1721
|
};
|
|
1573
1722
|
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
1574
1723
|
let d = a;
|
|
1575
1724
|
r.QrSegment = a;
|
|
1576
|
-
})(
|
|
1725
|
+
})(ue || (ue = {}));
|
|
1577
1726
|
((r) => {
|
|
1578
1727
|
((e) => {
|
|
1579
1728
|
const t = class {
|
|
@@ -1585,7 +1734,7 @@ var ce;
|
|
|
1585
1734
|
};
|
|
1586
1735
|
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), e.Ecc = t;
|
|
1587
1736
|
})(r.QrCode || (r.QrCode = {}));
|
|
1588
|
-
})(
|
|
1737
|
+
})(ue || (ue = {}));
|
|
1589
1738
|
((r) => {
|
|
1590
1739
|
((e) => {
|
|
1591
1740
|
const t = class {
|
|
@@ -1602,15 +1751,15 @@ var ce;
|
|
|
1602
1751
|
};
|
|
1603
1752
|
t.NUMERIC = new t(1, [10, 12, 14]), t.ALPHANUMERIC = new t(2, [9, 11, 13]), t.BYTE = new t(4, [8, 16, 16]), t.KANJI = new t(8, [8, 10, 12]), t.ECI = new t(7, [0, 0, 0]), e.Mode = t;
|
|
1604
1753
|
})(r.QrSegment || (r.QrSegment = {}));
|
|
1605
|
-
})(
|
|
1606
|
-
var
|
|
1607
|
-
var
|
|
1608
|
-
L:
|
|
1609
|
-
M:
|
|
1610
|
-
Q:
|
|
1611
|
-
H:
|
|
1612
|
-
},
|
|
1613
|
-
function
|
|
1754
|
+
})(ue || (ue = {}));
|
|
1755
|
+
var ve = ue;
|
|
1756
|
+
var ws = {
|
|
1757
|
+
L: ve.QrCode.Ecc.LOW,
|
|
1758
|
+
M: ve.QrCode.Ecc.MEDIUM,
|
|
1759
|
+
Q: ve.QrCode.Ecc.QUARTILE,
|
|
1760
|
+
H: ve.QrCode.Ecc.HIGH
|
|
1761
|
+
}, Kt = 128, er = "L", tr = "#FFFFFF", rr = "#000000", sr = !1, nr = 1, js = 4, Ns = 0, ks = 0.1;
|
|
1762
|
+
function ar(r, e = 0) {
|
|
1614
1763
|
const t = [];
|
|
1615
1764
|
return r.forEach(function(s, n) {
|
|
1616
1765
|
let a = null;
|
|
@@ -1633,25 +1782,25 @@ function Gt(r, e = 0) {
|
|
|
1633
1782
|
});
|
|
1634
1783
|
}), t.join("");
|
|
1635
1784
|
}
|
|
1636
|
-
function
|
|
1785
|
+
function ir(r, e) {
|
|
1637
1786
|
return r.slice().map((t, s) => s < e.y || s >= e.y + e.h ? t : t.map((n, a) => a < e.x || a >= e.x + e.w ? n : !1));
|
|
1638
1787
|
}
|
|
1639
|
-
function
|
|
1788
|
+
function Es(r, e, t, s) {
|
|
1640
1789
|
if (s == null)
|
|
1641
1790
|
return null;
|
|
1642
|
-
const n = r.length + t * 2, a = Math.floor(e *
|
|
1791
|
+
const n = r.length + t * 2, a = Math.floor(e * ks), d = n / e, u = (s.width || a) * d, i = (s.height || a) * d, l = s.x == null ? r.length / 2 - u / 2 : s.x * d, c = s.y == null ? r.length / 2 - i / 2 : s.y * d, f = s.opacity == null ? 1 : s.opacity;
|
|
1643
1792
|
let h = null;
|
|
1644
1793
|
if (s.excavate) {
|
|
1645
|
-
let
|
|
1646
|
-
h = { x:
|
|
1794
|
+
let v = Math.floor(l), w = Math.floor(c), x = Math.ceil(u + l - v), M = Math.ceil(i + c - w);
|
|
1795
|
+
h = { x: v, y: w, w: x, h: M };
|
|
1647
1796
|
}
|
|
1648
1797
|
const p = s.crossOrigin;
|
|
1649
|
-
return { x:
|
|
1798
|
+
return { x: l, y: c, h: i, w: u, excavation: h, opacity: f, crossOrigin: p };
|
|
1650
1799
|
}
|
|
1651
|
-
function
|
|
1652
|
-
return e != null ? Math.max(Math.floor(e), 0) : r ?
|
|
1800
|
+
function Cs(r, e) {
|
|
1801
|
+
return e != null ? Math.max(Math.floor(e), 0) : r ? js : Ns;
|
|
1653
1802
|
}
|
|
1654
|
-
function
|
|
1803
|
+
function or({
|
|
1655
1804
|
value: r,
|
|
1656
1805
|
level: e,
|
|
1657
1806
|
minVersion: t,
|
|
@@ -1661,61 +1810,61 @@ function Xt({
|
|
|
1661
1810
|
size: d,
|
|
1662
1811
|
boostLevel: u
|
|
1663
1812
|
}) {
|
|
1664
|
-
let i =
|
|
1665
|
-
const
|
|
1666
|
-
return
|
|
1667
|
-
|
|
1668
|
-
|
|
1813
|
+
let i = D.useMemo(() => {
|
|
1814
|
+
const v = (Array.isArray(r) ? r : [r]).reduce((w, x) => (w.push(...ve.QrSegment.makeSegments(x)), w), []);
|
|
1815
|
+
return ve.QrCode.encodeSegments(
|
|
1816
|
+
v,
|
|
1817
|
+
ws[e],
|
|
1669
1818
|
t,
|
|
1670
1819
|
void 0,
|
|
1671
1820
|
void 0,
|
|
1672
1821
|
u
|
|
1673
1822
|
);
|
|
1674
1823
|
}, [r, e, t, u]);
|
|
1675
|
-
const { cells:
|
|
1824
|
+
const { cells: l, margin: c, numCells: f, calculatedImageSettings: h } = D.useMemo(() => {
|
|
1676
1825
|
let p = i.getModules();
|
|
1677
|
-
const
|
|
1826
|
+
const v = Cs(s, n), w = p.length + v * 2, x = Es(
|
|
1678
1827
|
p,
|
|
1679
1828
|
d,
|
|
1680
|
-
|
|
1829
|
+
v,
|
|
1681
1830
|
a
|
|
1682
1831
|
);
|
|
1683
1832
|
return {
|
|
1684
1833
|
cells: p,
|
|
1685
|
-
margin:
|
|
1834
|
+
margin: v,
|
|
1686
1835
|
numCells: w,
|
|
1687
1836
|
calculatedImageSettings: x
|
|
1688
1837
|
};
|
|
1689
1838
|
}, [i, d, a, s, n]);
|
|
1690
1839
|
return {
|
|
1691
1840
|
qrcode: i,
|
|
1692
|
-
margin:
|
|
1693
|
-
cells:
|
|
1841
|
+
margin: c,
|
|
1842
|
+
cells: l,
|
|
1694
1843
|
numCells: f,
|
|
1695
1844
|
calculatedImageSettings: h
|
|
1696
1845
|
};
|
|
1697
1846
|
}
|
|
1698
|
-
var
|
|
1847
|
+
var Ss = (function() {
|
|
1699
1848
|
try {
|
|
1700
1849
|
new Path2D().addPath(new Path2D());
|
|
1701
1850
|
} catch {
|
|
1702
1851
|
return !1;
|
|
1703
1852
|
}
|
|
1704
1853
|
return !0;
|
|
1705
|
-
})(),
|
|
1854
|
+
})(), As = D.forwardRef(
|
|
1706
1855
|
function(e, t) {
|
|
1707
1856
|
const s = e, {
|
|
1708
1857
|
value: n,
|
|
1709
|
-
size: a =
|
|
1710
|
-
level: d =
|
|
1711
|
-
bgColor: u =
|
|
1712
|
-
fgColor: i =
|
|
1713
|
-
includeMargin:
|
|
1714
|
-
minVersion:
|
|
1858
|
+
size: a = Kt,
|
|
1859
|
+
level: d = er,
|
|
1860
|
+
bgColor: u = tr,
|
|
1861
|
+
fgColor: i = rr,
|
|
1862
|
+
includeMargin: l = sr,
|
|
1863
|
+
minVersion: c = nr,
|
|
1715
1864
|
boostLevel: f,
|
|
1716
1865
|
marginSize: h,
|
|
1717
1866
|
imageSettings: p
|
|
1718
|
-
} = s, w =
|
|
1867
|
+
} = s, w = st(s, [
|
|
1719
1868
|
"value",
|
|
1720
1869
|
"size",
|
|
1721
1870
|
"level",
|
|
@@ -1726,57 +1875,57 @@ var fs = (function() {
|
|
|
1726
1875
|
"boostLevel",
|
|
1727
1876
|
"marginSize",
|
|
1728
1877
|
"imageSettings"
|
|
1729
|
-
]), { style: x } = w, M =
|
|
1730
|
-
(
|
|
1731
|
-
|
|
1878
|
+
]), { style: x } = w, M = st(w, ["style"]), A = p?.src, j = D.useRef(null), I = D.useRef(null), L = D.useCallback(
|
|
1879
|
+
(G) => {
|
|
1880
|
+
j.current = G, typeof t == "function" ? t(G) : t && (t.current = G);
|
|
1732
1881
|
},
|
|
1733
1882
|
[t]
|
|
1734
|
-
), [O, B] =
|
|
1883
|
+
), [O, B] = D.useState(!1), { margin: W, cells: H, numCells: de, calculatedImageSettings: q } = or({
|
|
1735
1884
|
value: n,
|
|
1736
1885
|
level: d,
|
|
1737
|
-
minVersion:
|
|
1886
|
+
minVersion: c,
|
|
1738
1887
|
boostLevel: f,
|
|
1739
|
-
includeMargin:
|
|
1888
|
+
includeMargin: l,
|
|
1740
1889
|
marginSize: h,
|
|
1741
1890
|
imageSettings: p,
|
|
1742
1891
|
size: a
|
|
1743
1892
|
});
|
|
1744
|
-
|
|
1745
|
-
if (
|
|
1746
|
-
const
|
|
1893
|
+
D.useEffect(() => {
|
|
1894
|
+
if (j.current != null) {
|
|
1895
|
+
const G = j.current, U = G.getContext("2d");
|
|
1747
1896
|
if (!U)
|
|
1748
1897
|
return;
|
|
1749
|
-
let ke =
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1752
|
-
|
|
1898
|
+
let ke = H;
|
|
1899
|
+
const te = I.current, Ee = q != null && te !== null && te.complete && te.naturalHeight !== 0 && te.naturalWidth !== 0;
|
|
1900
|
+
Ee && q.excavation != null && (ke = ir(
|
|
1901
|
+
H,
|
|
1753
1902
|
q.excavation
|
|
1754
1903
|
));
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1758
|
-
U.scale(
|
|
1759
|
-
m.forEach(function($,
|
|
1760
|
-
$ && U.fillRect(
|
|
1904
|
+
const Ce = window.devicePixelRatio || 1;
|
|
1905
|
+
G.height = G.width = a * Ce;
|
|
1906
|
+
const Se = a / de * Ce;
|
|
1907
|
+
U.scale(Se, Se), U.fillStyle = u, U.fillRect(0, 0, de, de), U.fillStyle = i, Ss ? U.fill(new Path2D(ar(ke, W))) : H.forEach(function(m, E) {
|
|
1908
|
+
m.forEach(function($, Z) {
|
|
1909
|
+
$ && U.fillRect(Z + W, E + W, 1, 1);
|
|
1761
1910
|
});
|
|
1762
|
-
}), q && (U.globalAlpha = q.opacity),
|
|
1763
|
-
|
|
1911
|
+
}), q && (U.globalAlpha = q.opacity), Ee && U.drawImage(
|
|
1912
|
+
te,
|
|
1764
1913
|
q.x + W,
|
|
1765
1914
|
q.y + W,
|
|
1766
1915
|
q.w,
|
|
1767
1916
|
q.h
|
|
1768
1917
|
);
|
|
1769
1918
|
}
|
|
1770
|
-
}),
|
|
1919
|
+
}), D.useEffect(() => {
|
|
1771
1920
|
B(!1);
|
|
1772
|
-
}, [
|
|
1773
|
-
const P =
|
|
1921
|
+
}, [A]);
|
|
1922
|
+
const P = rt({ height: a, width: a }, x);
|
|
1774
1923
|
let Y = null;
|
|
1775
|
-
return
|
|
1924
|
+
return A != null && (Y = /* @__PURE__ */ D.createElement(
|
|
1776
1925
|
"img",
|
|
1777
1926
|
{
|
|
1778
|
-
src:
|
|
1779
|
-
key:
|
|
1927
|
+
src: A,
|
|
1928
|
+
key: A,
|
|
1780
1929
|
style: { display: "none" },
|
|
1781
1930
|
onLoad: () => {
|
|
1782
1931
|
B(!0);
|
|
@@ -1784,9 +1933,9 @@ var fs = (function() {
|
|
|
1784
1933
|
ref: I,
|
|
1785
1934
|
crossOrigin: q?.crossOrigin
|
|
1786
1935
|
}
|
|
1787
|
-
)), /* @__PURE__ */
|
|
1936
|
+
)), /* @__PURE__ */ D.createElement(D.Fragment, null, /* @__PURE__ */ D.createElement(
|
|
1788
1937
|
"canvas",
|
|
1789
|
-
|
|
1938
|
+
rt({
|
|
1790
1939
|
style: P,
|
|
1791
1940
|
height: a,
|
|
1792
1941
|
width: a,
|
|
@@ -1796,22 +1945,22 @@ var fs = (function() {
|
|
|
1796
1945
|
), Y);
|
|
1797
1946
|
}
|
|
1798
1947
|
);
|
|
1799
|
-
|
|
1800
|
-
var
|
|
1948
|
+
As.displayName = "QRCodeCanvas";
|
|
1949
|
+
var lr = D.forwardRef(
|
|
1801
1950
|
function(e, t) {
|
|
1802
1951
|
const s = e, {
|
|
1803
1952
|
value: n,
|
|
1804
|
-
size: a =
|
|
1805
|
-
level: d =
|
|
1806
|
-
bgColor: u =
|
|
1807
|
-
fgColor: i =
|
|
1808
|
-
includeMargin:
|
|
1809
|
-
minVersion:
|
|
1953
|
+
size: a = Kt,
|
|
1954
|
+
level: d = er,
|
|
1955
|
+
bgColor: u = tr,
|
|
1956
|
+
fgColor: i = rr,
|
|
1957
|
+
includeMargin: l = sr,
|
|
1958
|
+
minVersion: c = nr,
|
|
1810
1959
|
boostLevel: f,
|
|
1811
1960
|
title: h,
|
|
1812
1961
|
marginSize: p,
|
|
1813
|
-
imageSettings:
|
|
1814
|
-
} = s, w =
|
|
1962
|
+
imageSettings: v
|
|
1963
|
+
} = s, w = st(s, [
|
|
1815
1964
|
"value",
|
|
1816
1965
|
"size",
|
|
1817
1966
|
"level",
|
|
@@ -1823,59 +1972,59 @@ var Kt = F.forwardRef(
|
|
|
1823
1972
|
"title",
|
|
1824
1973
|
"marginSize",
|
|
1825
1974
|
"imageSettings"
|
|
1826
|
-
]), { margin: x, cells: M, numCells:
|
|
1975
|
+
]), { margin: x, cells: M, numCells: A, calculatedImageSettings: j } = or({
|
|
1827
1976
|
value: n,
|
|
1828
1977
|
level: d,
|
|
1829
|
-
minVersion:
|
|
1978
|
+
minVersion: c,
|
|
1830
1979
|
boostLevel: f,
|
|
1831
|
-
includeMargin:
|
|
1980
|
+
includeMargin: l,
|
|
1832
1981
|
marginSize: p,
|
|
1833
|
-
imageSettings:
|
|
1982
|
+
imageSettings: v,
|
|
1834
1983
|
size: a
|
|
1835
1984
|
});
|
|
1836
1985
|
let I = M, L = null;
|
|
1837
|
-
|
|
1986
|
+
v != null && j != null && (j.excavation != null && (I = ir(
|
|
1838
1987
|
M,
|
|
1839
|
-
|
|
1840
|
-
)), L = /* @__PURE__ */
|
|
1988
|
+
j.excavation
|
|
1989
|
+
)), L = /* @__PURE__ */ D.createElement(
|
|
1841
1990
|
"image",
|
|
1842
1991
|
{
|
|
1843
|
-
href:
|
|
1844
|
-
height:
|
|
1845
|
-
width:
|
|
1846
|
-
x:
|
|
1847
|
-
y:
|
|
1992
|
+
href: v.src,
|
|
1993
|
+
height: j.h,
|
|
1994
|
+
width: j.w,
|
|
1995
|
+
x: j.x + x,
|
|
1996
|
+
y: j.y + x,
|
|
1848
1997
|
preserveAspectRatio: "none",
|
|
1849
|
-
opacity:
|
|
1850
|
-
crossOrigin:
|
|
1998
|
+
opacity: j.opacity,
|
|
1999
|
+
crossOrigin: j.crossOrigin
|
|
1851
2000
|
}
|
|
1852
2001
|
));
|
|
1853
|
-
const O =
|
|
1854
|
-
return /* @__PURE__ */
|
|
2002
|
+
const O = ar(I, x);
|
|
2003
|
+
return /* @__PURE__ */ D.createElement(
|
|
1855
2004
|
"svg",
|
|
1856
|
-
|
|
2005
|
+
rt({
|
|
1857
2006
|
height: a,
|
|
1858
2007
|
width: a,
|
|
1859
|
-
viewBox: `0 0 ${
|
|
2008
|
+
viewBox: `0 0 ${A} ${A}`,
|
|
1860
2009
|
ref: t,
|
|
1861
2010
|
role: "img"
|
|
1862
2011
|
}, w),
|
|
1863
|
-
!!h && /* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
2012
|
+
!!h && /* @__PURE__ */ D.createElement("title", null, h),
|
|
2013
|
+
/* @__PURE__ */ D.createElement(
|
|
1865
2014
|
"path",
|
|
1866
2015
|
{
|
|
1867
2016
|
fill: u,
|
|
1868
|
-
d: `M0,0 h${
|
|
2017
|
+
d: `M0,0 h${A}v${A}H0z`,
|
|
1869
2018
|
shapeRendering: "crispEdges"
|
|
1870
2019
|
}
|
|
1871
2020
|
),
|
|
1872
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ D.createElement("path", { fill: i, d: O, shapeRendering: "crispEdges" }),
|
|
1873
2022
|
L
|
|
1874
2023
|
);
|
|
1875
2024
|
}
|
|
1876
2025
|
);
|
|
1877
|
-
|
|
1878
|
-
const
|
|
2026
|
+
lr.displayName = "QRCodeSVG";
|
|
2027
|
+
const Rs = (r, e = "qr-code", t = 4) => {
|
|
1879
2028
|
const s = document.getElementById(r);
|
|
1880
2029
|
if (!s) return;
|
|
1881
2030
|
let n = new XMLSerializer().serializeToString(s);
|
|
@@ -1888,16 +2037,16 @@ const ms = (r, e = "qr-code", t = 4) => {
|
|
|
1888
2037
|
/<svg(\s+)/,
|
|
1889
2038
|
`<svg viewBox="0 0 ${a} ${d}" `
|
|
1890
2039
|
)), /width="[^"]*"/.test(n) ? n = n.replace(/width="[^"]*"/, `width="${u}"`) : n = n.replace(/<svg(\s+)/, `<svg width="${u}" `), /height="[^"]*"/.test(n) ? n = n.replace(/height="[^"]*"/, `height="${i}"`) : n = n.replace(/<svg(\s+)/, `<svg height="${i}" `);
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
const
|
|
2040
|
+
const l = document.createElement("canvas");
|
|
2041
|
+
l.width = u, l.height = i;
|
|
2042
|
+
const c = l.getContext("2d"), f = new Image();
|
|
1894
2043
|
f.onload = () => {
|
|
1895
|
-
|
|
1896
|
-
const h =
|
|
2044
|
+
c?.drawImage(f, 0, 0, l.width, l.height);
|
|
2045
|
+
const h = l.toDataURL("image/png"), p = document.createElement("a");
|
|
1897
2046
|
p.download = `${e}.png`, p.href = h, p.click();
|
|
1898
2047
|
}, f.src = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(n)));
|
|
1899
2048
|
};
|
|
1900
|
-
function
|
|
2049
|
+
function Ts({
|
|
1901
2050
|
id: r = "qr-code",
|
|
1902
2051
|
value: e,
|
|
1903
2052
|
size: t = 200,
|
|
@@ -1906,15 +2055,15 @@ function ps({
|
|
|
1906
2055
|
showDownloads: a = !0
|
|
1907
2056
|
}) {
|
|
1908
2057
|
const d = n || e.replace(/[^a-z0-9_-]/gi, "-").slice(0, 40) || "qr-code";
|
|
1909
|
-
return /* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
a && /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col items-start ", children: [
|
|
2059
|
+
/* @__PURE__ */ o.jsx("div", { className: "bg-base-100 p-4 rounded-lg", children: /* @__PURE__ */ o.jsx(lr, { id: r, value: e, size: t, level: s }) }),
|
|
2060
|
+
a && /* @__PURE__ */ o.jsx("div", { className: "join justify-center self-center", children: /* @__PURE__ */ o.jsx(Os, { id: r, fileBase: d }) })
|
|
1912
2061
|
] });
|
|
1913
2062
|
}
|
|
1914
|
-
function
|
|
1915
|
-
const [t, s] =
|
|
1916
|
-
return /* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
2063
|
+
function Os({ id: r, fileBase: e }) {
|
|
2064
|
+
const [t, s] = se(8), n = (a) => a === 8 ? "large" : a === 4 ? "medium" : "small";
|
|
2065
|
+
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
2066
|
+
/* @__PURE__ */ o.jsxs(
|
|
1918
2067
|
"select",
|
|
1919
2068
|
{
|
|
1920
2069
|
className: "select join-item",
|
|
@@ -1922,24 +2071,24 @@ function gs({ id: r, fileBase: e }) {
|
|
|
1922
2071
|
onChange: (a) => s(Number(a.target.value)),
|
|
1923
2072
|
"aria-label": "Download scale",
|
|
1924
2073
|
children: [
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
2074
|
+
/* @__PURE__ */ o.jsx("option", { value: 8, children: "Large" }),
|
|
2075
|
+
/* @__PURE__ */ o.jsx("option", { value: 4, children: "Medium" }),
|
|
2076
|
+
/* @__PURE__ */ o.jsx("option", { value: 2, children: "Small" })
|
|
1928
2077
|
]
|
|
1929
2078
|
}
|
|
1930
2079
|
),
|
|
1931
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ o.jsx(
|
|
1932
2081
|
"button",
|
|
1933
2082
|
{
|
|
1934
2083
|
className: "btn btn-secondary join-item",
|
|
1935
|
-
onClick: () =>
|
|
2084
|
+
onClick: () => Rs(r, `${e}-${n(t)}`, t),
|
|
1936
2085
|
title: `Download ${t}x`,
|
|
1937
2086
|
children: "Download"
|
|
1938
2087
|
}
|
|
1939
2088
|
)
|
|
1940
2089
|
] });
|
|
1941
2090
|
}
|
|
1942
|
-
function
|
|
2091
|
+
function Pe(r) {
|
|
1943
2092
|
if (!r) return "";
|
|
1944
2093
|
try {
|
|
1945
2094
|
return new Date(r).toLocaleString();
|
|
@@ -1984,14 +2133,14 @@ var T;
|
|
|
1984
2133
|
}
|
|
1985
2134
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
1986
2135
|
})(T || (T = {}));
|
|
1987
|
-
var
|
|
2136
|
+
var kt;
|
|
1988
2137
|
(function(r) {
|
|
1989
2138
|
r.mergeShapes = (e, t) => ({
|
|
1990
2139
|
...e,
|
|
1991
2140
|
...t
|
|
1992
2141
|
// second overwrites first
|
|
1993
2142
|
});
|
|
1994
|
-
})(
|
|
2143
|
+
})(kt || (kt = {}));
|
|
1995
2144
|
const _ = T.arrayToEnum([
|
|
1996
2145
|
"string",
|
|
1997
2146
|
"nan",
|
|
@@ -2013,7 +2162,7 @@ const _ = T.arrayToEnum([
|
|
|
2013
2162
|
"never",
|
|
2014
2163
|
"map",
|
|
2015
2164
|
"set"
|
|
2016
|
-
]),
|
|
2165
|
+
]), re = (r) => {
|
|
2017
2166
|
switch (typeof r) {
|
|
2018
2167
|
case "undefined":
|
|
2019
2168
|
return _.undefined;
|
|
@@ -2081,8 +2230,8 @@ class ee extends Error {
|
|
|
2081
2230
|
else {
|
|
2082
2231
|
let u = s, i = 0;
|
|
2083
2232
|
for (; i < d.path.length; ) {
|
|
2084
|
-
const
|
|
2085
|
-
i === d.path.length - 1 ? (u[
|
|
2233
|
+
const l = d.path[i];
|
|
2234
|
+
i === d.path.length - 1 ? (u[l] = u[l] || { _errors: [] }, u[l]._errors.push(t(d))) : u[l] = u[l] || { _errors: [] }, u = u[l], i++;
|
|
2086
2235
|
}
|
|
2087
2236
|
}
|
|
2088
2237
|
};
|
|
@@ -2116,7 +2265,7 @@ class ee extends Error {
|
|
|
2116
2265
|
}
|
|
2117
2266
|
}
|
|
2118
2267
|
ee.create = (r) => new ee(r);
|
|
2119
|
-
const
|
|
2268
|
+
const nt = (r, e) => {
|
|
2120
2269
|
let t;
|
|
2121
2270
|
switch (r.code) {
|
|
2122
2271
|
case g.invalid_type:
|
|
@@ -2172,11 +2321,11 @@ const rt = (r, e) => {
|
|
|
2172
2321
|
}
|
|
2173
2322
|
return { message: t };
|
|
2174
2323
|
};
|
|
2175
|
-
let
|
|
2176
|
-
function
|
|
2177
|
-
return
|
|
2324
|
+
let Ps = nt;
|
|
2325
|
+
function Is() {
|
|
2326
|
+
return Ps;
|
|
2178
2327
|
}
|
|
2179
|
-
const
|
|
2328
|
+
const Ms = (r) => {
|
|
2180
2329
|
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], d = {
|
|
2181
2330
|
...n,
|
|
2182
2331
|
path: a
|
|
@@ -2188,17 +2337,17 @@ const _s = (r) => {
|
|
|
2188
2337
|
message: n.message
|
|
2189
2338
|
};
|
|
2190
2339
|
let u = "";
|
|
2191
|
-
const i = s.filter((
|
|
2192
|
-
for (const
|
|
2193
|
-
u =
|
|
2340
|
+
const i = s.filter((l) => !!l).slice().reverse();
|
|
2341
|
+
for (const l of i)
|
|
2342
|
+
u = l(d, { data: e, defaultError: u }).message;
|
|
2194
2343
|
return {
|
|
2195
2344
|
...n,
|
|
2196
2345
|
path: a,
|
|
2197
2346
|
message: u
|
|
2198
2347
|
};
|
|
2199
2348
|
};
|
|
2200
|
-
function
|
|
2201
|
-
const t =
|
|
2349
|
+
function y(r, e) {
|
|
2350
|
+
const t = Is(), s = Ms({
|
|
2202
2351
|
issueData: e,
|
|
2203
2352
|
data: r.data,
|
|
2204
2353
|
path: r.path,
|
|
@@ -2209,13 +2358,13 @@ function v(r, e) {
|
|
|
2209
2358
|
// then schema-bound map if available
|
|
2210
2359
|
t,
|
|
2211
2360
|
// then global override map
|
|
2212
|
-
t ===
|
|
2361
|
+
t === nt ? void 0 : nt
|
|
2213
2362
|
// then global default map
|
|
2214
2363
|
].filter((n) => !!n)
|
|
2215
2364
|
});
|
|
2216
2365
|
r.common.issues.push(s);
|
|
2217
2366
|
}
|
|
2218
|
-
class
|
|
2367
|
+
class Q {
|
|
2219
2368
|
constructor() {
|
|
2220
2369
|
this.value = "valid";
|
|
2221
2370
|
}
|
|
@@ -2229,7 +2378,7 @@ class H {
|
|
|
2229
2378
|
const s = [];
|
|
2230
2379
|
for (const n of t) {
|
|
2231
2380
|
if (n.status === "aborted")
|
|
2232
|
-
return
|
|
2381
|
+
return N;
|
|
2233
2382
|
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
2234
2383
|
}
|
|
2235
2384
|
return { status: e.value, value: s };
|
|
@@ -2243,27 +2392,27 @@ class H {
|
|
|
2243
2392
|
value: d
|
|
2244
2393
|
});
|
|
2245
2394
|
}
|
|
2246
|
-
return
|
|
2395
|
+
return Q.mergeObjectSync(e, s);
|
|
2247
2396
|
}
|
|
2248
2397
|
static mergeObjectSync(e, t) {
|
|
2249
2398
|
const s = {};
|
|
2250
2399
|
for (const n of t) {
|
|
2251
2400
|
const { key: a, value: d } = n;
|
|
2252
2401
|
if (a.status === "aborted" || d.status === "aborted")
|
|
2253
|
-
return
|
|
2402
|
+
return N;
|
|
2254
2403
|
a.status === "dirty" && e.dirty(), d.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof d.value < "u" || n.alwaysSet) && (s[a.value] = d.value);
|
|
2255
2404
|
}
|
|
2256
2405
|
return { status: e.value, value: s };
|
|
2257
2406
|
}
|
|
2258
2407
|
}
|
|
2259
|
-
const
|
|
2408
|
+
const N = Object.freeze({
|
|
2260
2409
|
status: "aborted"
|
|
2261
|
-
}),
|
|
2410
|
+
}), Ie = (r) => ({ status: "dirty", value: r }), J = (r) => ({ status: "valid", value: r }), Et = (r) => r.status === "aborted", Ct = (r) => r.status === "dirty", ye = (r) => r.status === "valid", We = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
2262
2411
|
var b;
|
|
2263
2412
|
(function(r) {
|
|
2264
2413
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
2265
2414
|
})(b || (b = {}));
|
|
2266
|
-
class
|
|
2415
|
+
class ie {
|
|
2267
2416
|
constructor(e, t, s, n) {
|
|
2268
2417
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
2269
2418
|
}
|
|
@@ -2271,7 +2420,7 @@ class ae {
|
|
|
2271
2420
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
2272
2421
|
}
|
|
2273
2422
|
}
|
|
2274
|
-
const
|
|
2423
|
+
const St = (r, e) => {
|
|
2275
2424
|
if (ye(e))
|
|
2276
2425
|
return { success: !0, data: e.value };
|
|
2277
2426
|
if (!r.common.issues.length)
|
|
@@ -2297,18 +2446,18 @@ function C(r) {
|
|
|
2297
2446
|
return d.code === "invalid_enum_value" ? { message: i ?? u.defaultError } : typeof u.data > "u" ? { message: i ?? s ?? u.defaultError } : d.code !== "invalid_type" ? { message: u.defaultError } : { message: i ?? t ?? u.defaultError };
|
|
2298
2447
|
}, description: n };
|
|
2299
2448
|
}
|
|
2300
|
-
class
|
|
2449
|
+
class R {
|
|
2301
2450
|
get description() {
|
|
2302
2451
|
return this._def.description;
|
|
2303
2452
|
}
|
|
2304
2453
|
_getType(e) {
|
|
2305
|
-
return
|
|
2454
|
+
return re(e.data);
|
|
2306
2455
|
}
|
|
2307
2456
|
_getOrReturnCtx(e, t) {
|
|
2308
2457
|
return t || {
|
|
2309
2458
|
common: e.parent.common,
|
|
2310
2459
|
data: e.data,
|
|
2311
|
-
parsedType:
|
|
2460
|
+
parsedType: re(e.data),
|
|
2312
2461
|
schemaErrorMap: this._def.errorMap,
|
|
2313
2462
|
path: e.path,
|
|
2314
2463
|
parent: e.parent
|
|
@@ -2316,11 +2465,11 @@ class A {
|
|
|
2316
2465
|
}
|
|
2317
2466
|
_processInputParams(e) {
|
|
2318
2467
|
return {
|
|
2319
|
-
status: new
|
|
2468
|
+
status: new Q(),
|
|
2320
2469
|
ctx: {
|
|
2321
2470
|
common: e.parent.common,
|
|
2322
2471
|
data: e.data,
|
|
2323
|
-
parsedType:
|
|
2472
|
+
parsedType: re(e.data),
|
|
2324
2473
|
schemaErrorMap: this._def.errorMap,
|
|
2325
2474
|
path: e.path,
|
|
2326
2475
|
parent: e.parent
|
|
@@ -2329,7 +2478,7 @@ class A {
|
|
|
2329
2478
|
}
|
|
2330
2479
|
_parseSync(e) {
|
|
2331
2480
|
const t = this._parse(e);
|
|
2332
|
-
if (
|
|
2481
|
+
if (We(t))
|
|
2333
2482
|
throw new Error("Synchronous parse encountered promise.");
|
|
2334
2483
|
return t;
|
|
2335
2484
|
}
|
|
@@ -2354,9 +2503,9 @@ class A {
|
|
|
2354
2503
|
schemaErrorMap: this._def.errorMap,
|
|
2355
2504
|
parent: null,
|
|
2356
2505
|
data: e,
|
|
2357
|
-
parsedType:
|
|
2506
|
+
parsedType: re(e)
|
|
2358
2507
|
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
2359
|
-
return
|
|
2508
|
+
return St(s, n);
|
|
2360
2509
|
}
|
|
2361
2510
|
"~validate"(e) {
|
|
2362
2511
|
const t = {
|
|
@@ -2368,7 +2517,7 @@ class A {
|
|
|
2368
2517
|
schemaErrorMap: this._def.errorMap,
|
|
2369
2518
|
parent: null,
|
|
2370
2519
|
data: e,
|
|
2371
|
-
parsedType:
|
|
2520
|
+
parsedType: re(e)
|
|
2372
2521
|
};
|
|
2373
2522
|
if (!this["~standard"].async)
|
|
2374
2523
|
try {
|
|
@@ -2407,9 +2556,9 @@ class A {
|
|
|
2407
2556
|
schemaErrorMap: this._def.errorMap,
|
|
2408
2557
|
parent: null,
|
|
2409
2558
|
data: e,
|
|
2410
|
-
parsedType:
|
|
2411
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (
|
|
2412
|
-
return
|
|
2559
|
+
parsedType: re(e)
|
|
2560
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (We(n) ? n : Promise.resolve(n));
|
|
2561
|
+
return St(s, a);
|
|
2413
2562
|
}
|
|
2414
2563
|
refine(e, t) {
|
|
2415
2564
|
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
@@ -2425,9 +2574,9 @@ class A {
|
|
|
2425
2574
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
2426
2575
|
}
|
|
2427
2576
|
_refinement(e) {
|
|
2428
|
-
return new
|
|
2577
|
+
return new be({
|
|
2429
2578
|
schema: this,
|
|
2430
|
-
typeName:
|
|
2579
|
+
typeName: k.ZodEffects,
|
|
2431
2580
|
effect: { type: "refinement", refinement: e }
|
|
2432
2581
|
});
|
|
2433
2582
|
}
|
|
@@ -2442,10 +2591,10 @@ class A {
|
|
|
2442
2591
|
};
|
|
2443
2592
|
}
|
|
2444
2593
|
optional() {
|
|
2445
|
-
return
|
|
2594
|
+
return ae.create(this, this._def);
|
|
2446
2595
|
}
|
|
2447
2596
|
nullable() {
|
|
2448
|
-
return
|
|
2597
|
+
return we.create(this, this._def);
|
|
2449
2598
|
}
|
|
2450
2599
|
nullish() {
|
|
2451
2600
|
return this.nullable().optional();
|
|
@@ -2454,45 +2603,45 @@ class A {
|
|
|
2454
2603
|
return X.create(this);
|
|
2455
2604
|
}
|
|
2456
2605
|
promise() {
|
|
2457
|
-
return
|
|
2606
|
+
return Qe.create(this, this._def);
|
|
2458
2607
|
}
|
|
2459
2608
|
or(e) {
|
|
2460
|
-
return
|
|
2609
|
+
return Ye.create([this, e], this._def);
|
|
2461
2610
|
}
|
|
2462
2611
|
and(e) {
|
|
2463
|
-
return
|
|
2612
|
+
return Ge.create(this, e, this._def);
|
|
2464
2613
|
}
|
|
2465
2614
|
transform(e) {
|
|
2466
|
-
return new
|
|
2615
|
+
return new be({
|
|
2467
2616
|
...C(this._def),
|
|
2468
2617
|
schema: this,
|
|
2469
|
-
typeName:
|
|
2618
|
+
typeName: k.ZodEffects,
|
|
2470
2619
|
effect: { type: "transform", transform: e }
|
|
2471
2620
|
});
|
|
2472
2621
|
}
|
|
2473
2622
|
default(e) {
|
|
2474
2623
|
const t = typeof e == "function" ? e : () => e;
|
|
2475
|
-
return new
|
|
2624
|
+
return new it({
|
|
2476
2625
|
...C(this._def),
|
|
2477
2626
|
innerType: this,
|
|
2478
2627
|
defaultValue: t,
|
|
2479
|
-
typeName:
|
|
2628
|
+
typeName: k.ZodDefault
|
|
2480
2629
|
});
|
|
2481
2630
|
}
|
|
2482
2631
|
brand() {
|
|
2483
|
-
return new
|
|
2484
|
-
typeName:
|
|
2632
|
+
return new nn({
|
|
2633
|
+
typeName: k.ZodBranded,
|
|
2485
2634
|
type: this,
|
|
2486
2635
|
...C(this._def)
|
|
2487
2636
|
});
|
|
2488
2637
|
}
|
|
2489
2638
|
catch(e) {
|
|
2490
2639
|
const t = typeof e == "function" ? e : () => e;
|
|
2491
|
-
return new
|
|
2640
|
+
return new ot({
|
|
2492
2641
|
...C(this._def),
|
|
2493
2642
|
innerType: this,
|
|
2494
2643
|
catchValue: t,
|
|
2495
|
-
typeName:
|
|
2644
|
+
typeName: k.ZodCatch
|
|
2496
2645
|
});
|
|
2497
2646
|
}
|
|
2498
2647
|
describe(e) {
|
|
@@ -2503,10 +2652,10 @@ class A {
|
|
|
2503
2652
|
});
|
|
2504
2653
|
}
|
|
2505
2654
|
pipe(e) {
|
|
2506
|
-
return
|
|
2655
|
+
return gt.create(this, e);
|
|
2507
2656
|
}
|
|
2508
2657
|
readonly() {
|
|
2509
|
-
return
|
|
2658
|
+
return lt.create(this);
|
|
2510
2659
|
}
|
|
2511
2660
|
isOptional() {
|
|
2512
2661
|
return this.safeParse(void 0).success;
|
|
@@ -2515,28 +2664,28 @@ class A {
|
|
|
2515
2664
|
return this.safeParse(null).success;
|
|
2516
2665
|
}
|
|
2517
2666
|
}
|
|
2518
|
-
const
|
|
2519
|
-
let
|
|
2520
|
-
const
|
|
2521
|
-
function
|
|
2667
|
+
const Ls = /^c[^\s-]{8,}$/i, $s = /^[0-9a-z]+$/, Fs = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Zs = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ds = /^[a-z0-9_-]{21}$/i, zs = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Us = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Vs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Bs = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2668
|
+
let Ke;
|
|
2669
|
+
const Ws = /^(?:(?: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])$/, qs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ys = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Gs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Qs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Hs = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, cr = "((\\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])))", Js = new RegExp(`^${cr}$`);
|
|
2670
|
+
function dr(r) {
|
|
2522
2671
|
let e = "[0-5]\\d";
|
|
2523
2672
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
2524
2673
|
const t = r.precision ? "+" : "?";
|
|
2525
2674
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
2526
2675
|
}
|
|
2527
|
-
function
|
|
2528
|
-
return new RegExp(`^${
|
|
2676
|
+
function Xs(r) {
|
|
2677
|
+
return new RegExp(`^${dr(r)}$`);
|
|
2529
2678
|
}
|
|
2530
|
-
function
|
|
2531
|
-
let e = `${
|
|
2679
|
+
function Ks(r) {
|
|
2680
|
+
let e = `${cr}T${dr(r)}`;
|
|
2532
2681
|
const t = [];
|
|
2533
2682
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
2534
2683
|
}
|
|
2535
|
-
function
|
|
2536
|
-
return !!((e === "v4" || !e) &&
|
|
2684
|
+
function en(r, e) {
|
|
2685
|
+
return !!((e === "v4" || !e) && Ws.test(r) || (e === "v6" || !e) && Ys.test(r));
|
|
2537
2686
|
}
|
|
2538
|
-
function
|
|
2539
|
-
if (!
|
|
2687
|
+
function tn(r, e) {
|
|
2688
|
+
if (!zs.test(r))
|
|
2540
2689
|
return !1;
|
|
2541
2690
|
try {
|
|
2542
2691
|
const [t] = r.split(".");
|
|
@@ -2548,24 +2697,24 @@ function Ds(r, e) {
|
|
|
2548
2697
|
return !1;
|
|
2549
2698
|
}
|
|
2550
2699
|
}
|
|
2551
|
-
function
|
|
2552
|
-
return !!((e === "v4" || !e) &&
|
|
2700
|
+
function rn(r, e) {
|
|
2701
|
+
return !!((e === "v4" || !e) && qs.test(r) || (e === "v6" || !e) && Gs.test(r));
|
|
2553
2702
|
}
|
|
2554
|
-
class K extends
|
|
2703
|
+
class K extends R {
|
|
2555
2704
|
_parse(e) {
|
|
2556
2705
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== _.string) {
|
|
2557
2706
|
const a = this._getOrReturnCtx(e);
|
|
2558
|
-
return
|
|
2707
|
+
return y(a, {
|
|
2559
2708
|
code: g.invalid_type,
|
|
2560
2709
|
expected: _.string,
|
|
2561
2710
|
received: a.parsedType
|
|
2562
|
-
}),
|
|
2711
|
+
}), N;
|
|
2563
2712
|
}
|
|
2564
|
-
const s = new
|
|
2713
|
+
const s = new Q();
|
|
2565
2714
|
let n;
|
|
2566
2715
|
for (const a of this._def.checks)
|
|
2567
2716
|
if (a.kind === "min")
|
|
2568
|
-
e.data.length < a.value && (n = this._getOrReturnCtx(e, n),
|
|
2717
|
+
e.data.length < a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2569
2718
|
code: g.too_small,
|
|
2570
2719
|
minimum: a.value,
|
|
2571
2720
|
type: "string",
|
|
@@ -2574,7 +2723,7 @@ class K extends A {
|
|
|
2574
2723
|
message: a.message
|
|
2575
2724
|
}), s.dirty());
|
|
2576
2725
|
else if (a.kind === "max")
|
|
2577
|
-
e.data.length > a.value && (n = this._getOrReturnCtx(e, n),
|
|
2726
|
+
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2578
2727
|
code: g.too_big,
|
|
2579
2728
|
maximum: a.value,
|
|
2580
2729
|
type: "string",
|
|
@@ -2584,14 +2733,14 @@ class K extends A {
|
|
|
2584
2733
|
}), s.dirty());
|
|
2585
2734
|
else if (a.kind === "length") {
|
|
2586
2735
|
const d = e.data.length > a.value, u = e.data.length < a.value;
|
|
2587
|
-
(d || u) && (n = this._getOrReturnCtx(e, n), d ?
|
|
2736
|
+
(d || u) && (n = this._getOrReturnCtx(e, n), d ? y(n, {
|
|
2588
2737
|
code: g.too_big,
|
|
2589
2738
|
maximum: a.value,
|
|
2590
2739
|
type: "string",
|
|
2591
2740
|
inclusive: !0,
|
|
2592
2741
|
exact: !0,
|
|
2593
2742
|
message: a.message
|
|
2594
|
-
}) : u &&
|
|
2743
|
+
}) : u && y(n, {
|
|
2595
2744
|
code: g.too_small,
|
|
2596
2745
|
minimum: a.value,
|
|
2597
2746
|
type: "string",
|
|
@@ -2600,43 +2749,43 @@ class K extends A {
|
|
|
2600
2749
|
message: a.message
|
|
2601
2750
|
}), s.dirty());
|
|
2602
2751
|
} else if (a.kind === "email")
|
|
2603
|
-
|
|
2752
|
+
Vs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2604
2753
|
validation: "email",
|
|
2605
2754
|
code: g.invalid_string,
|
|
2606
2755
|
message: a.message
|
|
2607
2756
|
}), s.dirty());
|
|
2608
2757
|
else if (a.kind === "emoji")
|
|
2609
|
-
|
|
2758
|
+
Ke || (Ke = new RegExp(Bs, "u")), Ke.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2610
2759
|
validation: "emoji",
|
|
2611
2760
|
code: g.invalid_string,
|
|
2612
2761
|
message: a.message
|
|
2613
2762
|
}), s.dirty());
|
|
2614
2763
|
else if (a.kind === "uuid")
|
|
2615
|
-
|
|
2764
|
+
Zs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2616
2765
|
validation: "uuid",
|
|
2617
2766
|
code: g.invalid_string,
|
|
2618
2767
|
message: a.message
|
|
2619
2768
|
}), s.dirty());
|
|
2620
2769
|
else if (a.kind === "nanoid")
|
|
2621
|
-
|
|
2770
|
+
Ds.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2622
2771
|
validation: "nanoid",
|
|
2623
2772
|
code: g.invalid_string,
|
|
2624
2773
|
message: a.message
|
|
2625
2774
|
}), s.dirty());
|
|
2626
2775
|
else if (a.kind === "cuid")
|
|
2627
|
-
|
|
2776
|
+
Ls.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2628
2777
|
validation: "cuid",
|
|
2629
2778
|
code: g.invalid_string,
|
|
2630
2779
|
message: a.message
|
|
2631
2780
|
}), s.dirty());
|
|
2632
2781
|
else if (a.kind === "cuid2")
|
|
2633
|
-
|
|
2782
|
+
$s.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2634
2783
|
validation: "cuid2",
|
|
2635
2784
|
code: g.invalid_string,
|
|
2636
2785
|
message: a.message
|
|
2637
2786
|
}), s.dirty());
|
|
2638
2787
|
else if (a.kind === "ulid")
|
|
2639
|
-
|
|
2788
|
+
Fs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2640
2789
|
validation: "ulid",
|
|
2641
2790
|
code: g.invalid_string,
|
|
2642
2791
|
message: a.message
|
|
@@ -2645,61 +2794,61 @@ class K extends A {
|
|
|
2645
2794
|
try {
|
|
2646
2795
|
new URL(e.data);
|
|
2647
2796
|
} catch {
|
|
2648
|
-
n = this._getOrReturnCtx(e, n),
|
|
2797
|
+
n = this._getOrReturnCtx(e, n), y(n, {
|
|
2649
2798
|
validation: "url",
|
|
2650
2799
|
code: g.invalid_string,
|
|
2651
2800
|
message: a.message
|
|
2652
2801
|
}), s.dirty();
|
|
2653
2802
|
}
|
|
2654
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
2803
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2655
2804
|
validation: "regex",
|
|
2656
2805
|
code: g.invalid_string,
|
|
2657
2806
|
message: a.message
|
|
2658
|
-
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n),
|
|
2807
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2659
2808
|
code: g.invalid_string,
|
|
2660
2809
|
validation: { includes: a.value, position: a.position },
|
|
2661
2810
|
message: a.message
|
|
2662
|
-
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n),
|
|
2811
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2663
2812
|
code: g.invalid_string,
|
|
2664
2813
|
validation: { startsWith: a.value },
|
|
2665
2814
|
message: a.message
|
|
2666
|
-
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n),
|
|
2815
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2667
2816
|
code: g.invalid_string,
|
|
2668
2817
|
validation: { endsWith: a.value },
|
|
2669
2818
|
message: a.message
|
|
2670
|
-
}), s.dirty()) : a.kind === "datetime" ?
|
|
2819
|
+
}), s.dirty()) : a.kind === "datetime" ? Ks(a).test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2671
2820
|
code: g.invalid_string,
|
|
2672
2821
|
validation: "datetime",
|
|
2673
2822
|
message: a.message
|
|
2674
|
-
}), s.dirty()) : a.kind === "date" ?
|
|
2823
|
+
}), s.dirty()) : a.kind === "date" ? Js.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2675
2824
|
code: g.invalid_string,
|
|
2676
2825
|
validation: "date",
|
|
2677
2826
|
message: a.message
|
|
2678
|
-
}), s.dirty()) : a.kind === "time" ?
|
|
2827
|
+
}), s.dirty()) : a.kind === "time" ? Xs(a).test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2679
2828
|
code: g.invalid_string,
|
|
2680
2829
|
validation: "time",
|
|
2681
2830
|
message: a.message
|
|
2682
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
2831
|
+
}), s.dirty()) : a.kind === "duration" ? Us.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2683
2832
|
validation: "duration",
|
|
2684
2833
|
code: g.invalid_string,
|
|
2685
2834
|
message: a.message
|
|
2686
|
-
}), s.dirty()) : a.kind === "ip" ?
|
|
2835
|
+
}), s.dirty()) : a.kind === "ip" ? en(e.data, a.version) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2687
2836
|
validation: "ip",
|
|
2688
2837
|
code: g.invalid_string,
|
|
2689
2838
|
message: a.message
|
|
2690
|
-
}), s.dirty()) : a.kind === "jwt" ?
|
|
2839
|
+
}), s.dirty()) : a.kind === "jwt" ? tn(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2691
2840
|
validation: "jwt",
|
|
2692
2841
|
code: g.invalid_string,
|
|
2693
2842
|
message: a.message
|
|
2694
|
-
}), s.dirty()) : a.kind === "cidr" ?
|
|
2843
|
+
}), s.dirty()) : a.kind === "cidr" ? rn(e.data, a.version) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2695
2844
|
validation: "cidr",
|
|
2696
2845
|
code: g.invalid_string,
|
|
2697
2846
|
message: a.message
|
|
2698
|
-
}), s.dirty()) : a.kind === "base64" ?
|
|
2847
|
+
}), s.dirty()) : a.kind === "base64" ? Qs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2699
2848
|
validation: "base64",
|
|
2700
2849
|
code: g.invalid_string,
|
|
2701
2850
|
message: a.message
|
|
2702
|
-
}), s.dirty()) : a.kind === "base64url" ?
|
|
2851
|
+
}), s.dirty()) : a.kind === "base64url" ? Hs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2703
2852
|
validation: "base64url",
|
|
2704
2853
|
code: g.invalid_string,
|
|
2705
2854
|
message: a.message
|
|
@@ -2930,54 +3079,54 @@ class K extends A {
|
|
|
2930
3079
|
}
|
|
2931
3080
|
K.create = (r) => new K({
|
|
2932
3081
|
checks: [],
|
|
2933
|
-
typeName:
|
|
3082
|
+
typeName: k.ZodString,
|
|
2934
3083
|
coerce: r?.coerce ?? !1,
|
|
2935
3084
|
...C(r)
|
|
2936
3085
|
});
|
|
2937
|
-
function
|
|
3086
|
+
function sn(r, e) {
|
|
2938
3087
|
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = Number.parseInt(r.toFixed(n).replace(".", "")), d = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
2939
3088
|
return a % d / 10 ** n;
|
|
2940
3089
|
}
|
|
2941
|
-
class
|
|
3090
|
+
class fe extends R {
|
|
2942
3091
|
constructor() {
|
|
2943
3092
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
2944
3093
|
}
|
|
2945
3094
|
_parse(e) {
|
|
2946
3095
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== _.number) {
|
|
2947
3096
|
const a = this._getOrReturnCtx(e);
|
|
2948
|
-
return
|
|
3097
|
+
return y(a, {
|
|
2949
3098
|
code: g.invalid_type,
|
|
2950
3099
|
expected: _.number,
|
|
2951
3100
|
received: a.parsedType
|
|
2952
|
-
}),
|
|
3101
|
+
}), N;
|
|
2953
3102
|
}
|
|
2954
3103
|
let s;
|
|
2955
|
-
const n = new
|
|
3104
|
+
const n = new Q();
|
|
2956
3105
|
for (const a of this._def.checks)
|
|
2957
|
-
a.kind === "int" ? T.isInteger(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
3106
|
+
a.kind === "int" ? T.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2958
3107
|
code: g.invalid_type,
|
|
2959
3108
|
expected: "integer",
|
|
2960
3109
|
received: "float",
|
|
2961
3110
|
message: a.message
|
|
2962
|
-
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3111
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2963
3112
|
code: g.too_small,
|
|
2964
3113
|
minimum: a.value,
|
|
2965
3114
|
type: "number",
|
|
2966
3115
|
inclusive: a.inclusive,
|
|
2967
3116
|
exact: !1,
|
|
2968
3117
|
message: a.message
|
|
2969
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3118
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2970
3119
|
code: g.too_big,
|
|
2971
3120
|
maximum: a.value,
|
|
2972
3121
|
type: "number",
|
|
2973
3122
|
inclusive: a.inclusive,
|
|
2974
3123
|
exact: !1,
|
|
2975
3124
|
message: a.message
|
|
2976
|
-
}), n.dirty()) : a.kind === "multipleOf" ?
|
|
3125
|
+
}), n.dirty()) : a.kind === "multipleOf" ? sn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2977
3126
|
code: g.not_multiple_of,
|
|
2978
3127
|
multipleOf: a.value,
|
|
2979
3128
|
message: a.message
|
|
2980
|
-
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
3129
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2981
3130
|
code: g.not_finite,
|
|
2982
3131
|
message: a.message
|
|
2983
3132
|
}), n.dirty()) : T.assertNever(a);
|
|
@@ -2996,7 +3145,7 @@ class de extends A {
|
|
|
2996
3145
|
return this.setLimit("max", e, !1, b.toString(t));
|
|
2997
3146
|
}
|
|
2998
3147
|
setLimit(e, t, s, n) {
|
|
2999
|
-
return new
|
|
3148
|
+
return new fe({
|
|
3000
3149
|
...this._def,
|
|
3001
3150
|
checks: [
|
|
3002
3151
|
...this._def.checks,
|
|
@@ -3010,7 +3159,7 @@ class de extends A {
|
|
|
3010
3159
|
});
|
|
3011
3160
|
}
|
|
3012
3161
|
_addCheck(e) {
|
|
3013
|
-
return new
|
|
3162
|
+
return new fe({
|
|
3014
3163
|
...this._def,
|
|
3015
3164
|
checks: [...this._def.checks, e]
|
|
3016
3165
|
});
|
|
@@ -3104,13 +3253,13 @@ class de extends A {
|
|
|
3104
3253
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
3105
3254
|
}
|
|
3106
3255
|
}
|
|
3107
|
-
|
|
3256
|
+
fe.create = (r) => new fe({
|
|
3108
3257
|
checks: [],
|
|
3109
|
-
typeName:
|
|
3258
|
+
typeName: k.ZodNumber,
|
|
3110
3259
|
coerce: r?.coerce || !1,
|
|
3111
3260
|
...C(r)
|
|
3112
3261
|
});
|
|
3113
|
-
class
|
|
3262
|
+
class he extends R {
|
|
3114
3263
|
constructor() {
|
|
3115
3264
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
3116
3265
|
}
|
|
@@ -3124,21 +3273,21 @@ class ue extends A {
|
|
|
3124
3273
|
if (this._getType(e) !== _.bigint)
|
|
3125
3274
|
return this._getInvalidInput(e);
|
|
3126
3275
|
let s;
|
|
3127
|
-
const n = new
|
|
3276
|
+
const n = new Q();
|
|
3128
3277
|
for (const a of this._def.checks)
|
|
3129
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3278
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3130
3279
|
code: g.too_small,
|
|
3131
3280
|
type: "bigint",
|
|
3132
3281
|
minimum: a.value,
|
|
3133
3282
|
inclusive: a.inclusive,
|
|
3134
3283
|
message: a.message
|
|
3135
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3284
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3136
3285
|
code: g.too_big,
|
|
3137
3286
|
type: "bigint",
|
|
3138
3287
|
maximum: a.value,
|
|
3139
3288
|
inclusive: a.inclusive,
|
|
3140
3289
|
message: a.message
|
|
3141
|
-
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s),
|
|
3290
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3142
3291
|
code: g.not_multiple_of,
|
|
3143
3292
|
multipleOf: a.value,
|
|
3144
3293
|
message: a.message
|
|
@@ -3147,11 +3296,11 @@ class ue extends A {
|
|
|
3147
3296
|
}
|
|
3148
3297
|
_getInvalidInput(e) {
|
|
3149
3298
|
const t = this._getOrReturnCtx(e);
|
|
3150
|
-
return
|
|
3299
|
+
return y(t, {
|
|
3151
3300
|
code: g.invalid_type,
|
|
3152
3301
|
expected: _.bigint,
|
|
3153
3302
|
received: t.parsedType
|
|
3154
|
-
}),
|
|
3303
|
+
}), N;
|
|
3155
3304
|
}
|
|
3156
3305
|
gte(e, t) {
|
|
3157
3306
|
return this.setLimit("min", e, !0, b.toString(t));
|
|
@@ -3166,7 +3315,7 @@ class ue extends A {
|
|
|
3166
3315
|
return this.setLimit("max", e, !1, b.toString(t));
|
|
3167
3316
|
}
|
|
3168
3317
|
setLimit(e, t, s, n) {
|
|
3169
|
-
return new
|
|
3318
|
+
return new he({
|
|
3170
3319
|
...this._def,
|
|
3171
3320
|
checks: [
|
|
3172
3321
|
...this._def.checks,
|
|
@@ -3180,7 +3329,7 @@ class ue extends A {
|
|
|
3180
3329
|
});
|
|
3181
3330
|
}
|
|
3182
3331
|
_addCheck(e) {
|
|
3183
|
-
return new
|
|
3332
|
+
return new he({
|
|
3184
3333
|
...this._def,
|
|
3185
3334
|
checks: [...this._def.checks, e]
|
|
3186
3335
|
});
|
|
@@ -3237,57 +3386,57 @@ class ue extends A {
|
|
|
3237
3386
|
return e;
|
|
3238
3387
|
}
|
|
3239
3388
|
}
|
|
3240
|
-
|
|
3389
|
+
he.create = (r) => new he({
|
|
3241
3390
|
checks: [],
|
|
3242
|
-
typeName:
|
|
3391
|
+
typeName: k.ZodBigInt,
|
|
3243
3392
|
coerce: r?.coerce ?? !1,
|
|
3244
3393
|
...C(r)
|
|
3245
3394
|
});
|
|
3246
|
-
class
|
|
3395
|
+
class qe extends R {
|
|
3247
3396
|
_parse(e) {
|
|
3248
3397
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== _.boolean) {
|
|
3249
3398
|
const s = this._getOrReturnCtx(e);
|
|
3250
|
-
return
|
|
3399
|
+
return y(s, {
|
|
3251
3400
|
code: g.invalid_type,
|
|
3252
3401
|
expected: _.boolean,
|
|
3253
3402
|
received: s.parsedType
|
|
3254
|
-
}),
|
|
3403
|
+
}), N;
|
|
3255
3404
|
}
|
|
3256
3405
|
return J(e.data);
|
|
3257
3406
|
}
|
|
3258
3407
|
}
|
|
3259
|
-
|
|
3260
|
-
typeName:
|
|
3408
|
+
qe.create = (r) => new qe({
|
|
3409
|
+
typeName: k.ZodBoolean,
|
|
3261
3410
|
coerce: r?.coerce || !1,
|
|
3262
3411
|
...C(r)
|
|
3263
3412
|
});
|
|
3264
|
-
class
|
|
3413
|
+
class xe extends R {
|
|
3265
3414
|
_parse(e) {
|
|
3266
3415
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== _.date) {
|
|
3267
3416
|
const a = this._getOrReturnCtx(e);
|
|
3268
|
-
return
|
|
3417
|
+
return y(a, {
|
|
3269
3418
|
code: g.invalid_type,
|
|
3270
3419
|
expected: _.date,
|
|
3271
3420
|
received: a.parsedType
|
|
3272
|
-
}),
|
|
3421
|
+
}), N;
|
|
3273
3422
|
}
|
|
3274
3423
|
if (Number.isNaN(e.data.getTime())) {
|
|
3275
3424
|
const a = this._getOrReturnCtx(e);
|
|
3276
|
-
return
|
|
3425
|
+
return y(a, {
|
|
3277
3426
|
code: g.invalid_date
|
|
3278
|
-
}),
|
|
3427
|
+
}), N;
|
|
3279
3428
|
}
|
|
3280
|
-
const s = new
|
|
3429
|
+
const s = new Q();
|
|
3281
3430
|
let n;
|
|
3282
3431
|
for (const a of this._def.checks)
|
|
3283
|
-
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n),
|
|
3432
|
+
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
3284
3433
|
code: g.too_small,
|
|
3285
3434
|
message: a.message,
|
|
3286
3435
|
inclusive: !0,
|
|
3287
3436
|
exact: !1,
|
|
3288
3437
|
minimum: a.value,
|
|
3289
3438
|
type: "date"
|
|
3290
|
-
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n),
|
|
3439
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
3291
3440
|
code: g.too_big,
|
|
3292
3441
|
message: a.message,
|
|
3293
3442
|
inclusive: !0,
|
|
@@ -3301,7 +3450,7 @@ class ve extends A {
|
|
|
3301
3450
|
};
|
|
3302
3451
|
}
|
|
3303
3452
|
_addCheck(e) {
|
|
3304
|
-
return new
|
|
3453
|
+
return new xe({
|
|
3305
3454
|
...this._def,
|
|
3306
3455
|
checks: [...this._def.checks, e]
|
|
3307
3456
|
});
|
|
@@ -3333,64 +3482,64 @@ class ve extends A {
|
|
|
3333
3482
|
return e != null ? new Date(e) : null;
|
|
3334
3483
|
}
|
|
3335
3484
|
}
|
|
3336
|
-
|
|
3485
|
+
xe.create = (r) => new xe({
|
|
3337
3486
|
checks: [],
|
|
3338
3487
|
coerce: r?.coerce || !1,
|
|
3339
|
-
typeName:
|
|
3488
|
+
typeName: k.ZodDate,
|
|
3340
3489
|
...C(r)
|
|
3341
3490
|
});
|
|
3342
|
-
class
|
|
3491
|
+
class At extends R {
|
|
3343
3492
|
_parse(e) {
|
|
3344
3493
|
if (this._getType(e) !== _.symbol) {
|
|
3345
3494
|
const s = this._getOrReturnCtx(e);
|
|
3346
|
-
return
|
|
3495
|
+
return y(s, {
|
|
3347
3496
|
code: g.invalid_type,
|
|
3348
3497
|
expected: _.symbol,
|
|
3349
3498
|
received: s.parsedType
|
|
3350
|
-
}),
|
|
3499
|
+
}), N;
|
|
3351
3500
|
}
|
|
3352
3501
|
return J(e.data);
|
|
3353
3502
|
}
|
|
3354
3503
|
}
|
|
3355
|
-
|
|
3356
|
-
typeName:
|
|
3504
|
+
At.create = (r) => new At({
|
|
3505
|
+
typeName: k.ZodSymbol,
|
|
3357
3506
|
...C(r)
|
|
3358
3507
|
});
|
|
3359
|
-
class
|
|
3508
|
+
class Rt extends R {
|
|
3360
3509
|
_parse(e) {
|
|
3361
3510
|
if (this._getType(e) !== _.undefined) {
|
|
3362
3511
|
const s = this._getOrReturnCtx(e);
|
|
3363
|
-
return
|
|
3512
|
+
return y(s, {
|
|
3364
3513
|
code: g.invalid_type,
|
|
3365
3514
|
expected: _.undefined,
|
|
3366
3515
|
received: s.parsedType
|
|
3367
|
-
}),
|
|
3516
|
+
}), N;
|
|
3368
3517
|
}
|
|
3369
3518
|
return J(e.data);
|
|
3370
3519
|
}
|
|
3371
3520
|
}
|
|
3372
|
-
|
|
3373
|
-
typeName:
|
|
3521
|
+
Rt.create = (r) => new Rt({
|
|
3522
|
+
typeName: k.ZodUndefined,
|
|
3374
3523
|
...C(r)
|
|
3375
3524
|
});
|
|
3376
|
-
class
|
|
3525
|
+
class Tt extends R {
|
|
3377
3526
|
_parse(e) {
|
|
3378
3527
|
if (this._getType(e) !== _.null) {
|
|
3379
3528
|
const s = this._getOrReturnCtx(e);
|
|
3380
|
-
return
|
|
3529
|
+
return y(s, {
|
|
3381
3530
|
code: g.invalid_type,
|
|
3382
3531
|
expected: _.null,
|
|
3383
3532
|
received: s.parsedType
|
|
3384
|
-
}),
|
|
3533
|
+
}), N;
|
|
3385
3534
|
}
|
|
3386
3535
|
return J(e.data);
|
|
3387
3536
|
}
|
|
3388
3537
|
}
|
|
3389
|
-
|
|
3390
|
-
typeName:
|
|
3538
|
+
Tt.create = (r) => new Tt({
|
|
3539
|
+
typeName: k.ZodNull,
|
|
3391
3540
|
...C(r)
|
|
3392
3541
|
});
|
|
3393
|
-
class
|
|
3542
|
+
class Ot extends R {
|
|
3394
3543
|
constructor() {
|
|
3395
3544
|
super(...arguments), this._any = !0;
|
|
3396
3545
|
}
|
|
@@ -3398,11 +3547,11 @@ class Nt extends A {
|
|
|
3398
3547
|
return J(e.data);
|
|
3399
3548
|
}
|
|
3400
3549
|
}
|
|
3401
|
-
|
|
3402
|
-
typeName:
|
|
3550
|
+
Ot.create = (r) => new Ot({
|
|
3551
|
+
typeName: k.ZodAny,
|
|
3403
3552
|
...C(r)
|
|
3404
3553
|
});
|
|
3405
|
-
class
|
|
3554
|
+
class Pt extends R {
|
|
3406
3555
|
constructor() {
|
|
3407
3556
|
super(...arguments), this._unknown = !0;
|
|
3408
3557
|
}
|
|
@@ -3410,53 +3559,53 @@ class Et extends A {
|
|
|
3410
3559
|
return J(e.data);
|
|
3411
3560
|
}
|
|
3412
3561
|
}
|
|
3413
|
-
|
|
3414
|
-
typeName:
|
|
3562
|
+
Pt.create = (r) => new Pt({
|
|
3563
|
+
typeName: k.ZodUnknown,
|
|
3415
3564
|
...C(r)
|
|
3416
3565
|
});
|
|
3417
|
-
class
|
|
3566
|
+
class oe extends R {
|
|
3418
3567
|
_parse(e) {
|
|
3419
3568
|
const t = this._getOrReturnCtx(e);
|
|
3420
|
-
return
|
|
3569
|
+
return y(t, {
|
|
3421
3570
|
code: g.invalid_type,
|
|
3422
3571
|
expected: _.never,
|
|
3423
3572
|
received: t.parsedType
|
|
3424
|
-
}),
|
|
3573
|
+
}), N;
|
|
3425
3574
|
}
|
|
3426
3575
|
}
|
|
3427
|
-
|
|
3428
|
-
typeName:
|
|
3576
|
+
oe.create = (r) => new oe({
|
|
3577
|
+
typeName: k.ZodNever,
|
|
3429
3578
|
...C(r)
|
|
3430
3579
|
});
|
|
3431
|
-
class
|
|
3580
|
+
class It extends R {
|
|
3432
3581
|
_parse(e) {
|
|
3433
3582
|
if (this._getType(e) !== _.undefined) {
|
|
3434
3583
|
const s = this._getOrReturnCtx(e);
|
|
3435
|
-
return
|
|
3584
|
+
return y(s, {
|
|
3436
3585
|
code: g.invalid_type,
|
|
3437
3586
|
expected: _.void,
|
|
3438
3587
|
received: s.parsedType
|
|
3439
|
-
}),
|
|
3588
|
+
}), N;
|
|
3440
3589
|
}
|
|
3441
3590
|
return J(e.data);
|
|
3442
3591
|
}
|
|
3443
3592
|
}
|
|
3444
|
-
|
|
3445
|
-
typeName:
|
|
3593
|
+
It.create = (r) => new It({
|
|
3594
|
+
typeName: k.ZodVoid,
|
|
3446
3595
|
...C(r)
|
|
3447
3596
|
});
|
|
3448
|
-
class X extends
|
|
3597
|
+
class X extends R {
|
|
3449
3598
|
_parse(e) {
|
|
3450
3599
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
3451
3600
|
if (t.parsedType !== _.array)
|
|
3452
|
-
return
|
|
3601
|
+
return y(t, {
|
|
3453
3602
|
code: g.invalid_type,
|
|
3454
3603
|
expected: _.array,
|
|
3455
3604
|
received: t.parsedType
|
|
3456
|
-
}),
|
|
3605
|
+
}), N;
|
|
3457
3606
|
if (n.exactLength !== null) {
|
|
3458
3607
|
const d = t.data.length > n.exactLength.value, u = t.data.length < n.exactLength.value;
|
|
3459
|
-
(d || u) && (
|
|
3608
|
+
(d || u) && (y(t, {
|
|
3460
3609
|
code: d ? g.too_big : g.too_small,
|
|
3461
3610
|
minimum: u ? n.exactLength.value : void 0,
|
|
3462
3611
|
maximum: d ? n.exactLength.value : void 0,
|
|
@@ -3466,14 +3615,14 @@ class X extends A {
|
|
|
3466
3615
|
message: n.exactLength.message
|
|
3467
3616
|
}), s.dirty());
|
|
3468
3617
|
}
|
|
3469
|
-
if (n.minLength !== null && t.data.length < n.minLength.value && (
|
|
3618
|
+
if (n.minLength !== null && t.data.length < n.minLength.value && (y(t, {
|
|
3470
3619
|
code: g.too_small,
|
|
3471
3620
|
minimum: n.minLength.value,
|
|
3472
3621
|
type: "array",
|
|
3473
3622
|
inclusive: !0,
|
|
3474
3623
|
exact: !1,
|
|
3475
3624
|
message: n.minLength.message
|
|
3476
|
-
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (
|
|
3625
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (y(t, {
|
|
3477
3626
|
code: g.too_big,
|
|
3478
3627
|
maximum: n.maxLength.value,
|
|
3479
3628
|
type: "array",
|
|
@@ -3481,9 +3630,9 @@ class X extends A {
|
|
|
3481
3630
|
exact: !1,
|
|
3482
3631
|
message: n.maxLength.message
|
|
3483
3632
|
}), s.dirty()), t.common.async)
|
|
3484
|
-
return Promise.all([...t.data].map((d, u) => n.type._parseAsync(new
|
|
3485
|
-
const a = [...t.data].map((d, u) => n.type._parseSync(new
|
|
3486
|
-
return
|
|
3633
|
+
return Promise.all([...t.data].map((d, u) => n.type._parseAsync(new ie(t, d, t.path, u)))).then((d) => Q.mergeArray(s, d));
|
|
3634
|
+
const a = [...t.data].map((d, u) => n.type._parseSync(new ie(t, d, t.path, u)));
|
|
3635
|
+
return Q.mergeArray(s, a);
|
|
3487
3636
|
}
|
|
3488
3637
|
get element() {
|
|
3489
3638
|
return this._def.type;
|
|
@@ -3515,15 +3664,15 @@ X.create = (r, e) => new X({
|
|
|
3515
3664
|
minLength: null,
|
|
3516
3665
|
maxLength: null,
|
|
3517
3666
|
exactLength: null,
|
|
3518
|
-
typeName:
|
|
3667
|
+
typeName: k.ZodArray,
|
|
3519
3668
|
...C(e)
|
|
3520
3669
|
});
|
|
3521
|
-
function
|
|
3670
|
+
function ge(r) {
|
|
3522
3671
|
if (r instanceof z) {
|
|
3523
3672
|
const e = {};
|
|
3524
3673
|
for (const t in r.shape) {
|
|
3525
3674
|
const s = r.shape[t];
|
|
3526
|
-
e[t] =
|
|
3675
|
+
e[t] = ae.create(ge(s));
|
|
3527
3676
|
}
|
|
3528
3677
|
return new z({
|
|
3529
3678
|
...r._def,
|
|
@@ -3531,10 +3680,10 @@ function me(r) {
|
|
|
3531
3680
|
});
|
|
3532
3681
|
} else return r instanceof X ? new X({
|
|
3533
3682
|
...r._def,
|
|
3534
|
-
type:
|
|
3535
|
-
}) : r instanceof
|
|
3683
|
+
type: ge(r.element)
|
|
3684
|
+
}) : r instanceof ae ? ae.create(ge(r.unwrap())) : r instanceof we ? we.create(ge(r.unwrap())) : r instanceof me ? me.create(r.items.map((e) => ge(e))) : r;
|
|
3536
3685
|
}
|
|
3537
|
-
class z extends
|
|
3686
|
+
class z extends R {
|
|
3538
3687
|
constructor() {
|
|
3539
3688
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
3540
3689
|
}
|
|
@@ -3546,66 +3695,66 @@ class z extends A {
|
|
|
3546
3695
|
}
|
|
3547
3696
|
_parse(e) {
|
|
3548
3697
|
if (this._getType(e) !== _.object) {
|
|
3549
|
-
const
|
|
3550
|
-
return
|
|
3698
|
+
const l = this._getOrReturnCtx(e);
|
|
3699
|
+
return y(l, {
|
|
3551
3700
|
code: g.invalid_type,
|
|
3552
3701
|
expected: _.object,
|
|
3553
|
-
received:
|
|
3554
|
-
}),
|
|
3702
|
+
received: l.parsedType
|
|
3703
|
+
}), N;
|
|
3555
3704
|
}
|
|
3556
3705
|
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: d } = this._getCached(), u = [];
|
|
3557
|
-
if (!(this._def.catchall instanceof
|
|
3558
|
-
for (const
|
|
3559
|
-
d.includes(
|
|
3706
|
+
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
3707
|
+
for (const l in n.data)
|
|
3708
|
+
d.includes(l) || u.push(l);
|
|
3560
3709
|
const i = [];
|
|
3561
|
-
for (const
|
|
3562
|
-
const
|
|
3710
|
+
for (const l of d) {
|
|
3711
|
+
const c = a[l], f = n.data[l];
|
|
3563
3712
|
i.push({
|
|
3564
|
-
key: { status: "valid", value:
|
|
3565
|
-
value:
|
|
3566
|
-
alwaysSet:
|
|
3713
|
+
key: { status: "valid", value: l },
|
|
3714
|
+
value: c._parse(new ie(n, f, n.path, l)),
|
|
3715
|
+
alwaysSet: l in n.data
|
|
3567
3716
|
});
|
|
3568
3717
|
}
|
|
3569
|
-
if (this._def.catchall instanceof
|
|
3570
|
-
const
|
|
3571
|
-
if (
|
|
3572
|
-
for (const
|
|
3718
|
+
if (this._def.catchall instanceof oe) {
|
|
3719
|
+
const l = this._def.unknownKeys;
|
|
3720
|
+
if (l === "passthrough")
|
|
3721
|
+
for (const c of u)
|
|
3573
3722
|
i.push({
|
|
3574
|
-
key: { status: "valid", value:
|
|
3575
|
-
value: { status: "valid", value: n.data[
|
|
3723
|
+
key: { status: "valid", value: c },
|
|
3724
|
+
value: { status: "valid", value: n.data[c] }
|
|
3576
3725
|
});
|
|
3577
|
-
else if (
|
|
3578
|
-
u.length > 0 && (
|
|
3726
|
+
else if (l === "strict")
|
|
3727
|
+
u.length > 0 && (y(n, {
|
|
3579
3728
|
code: g.unrecognized_keys,
|
|
3580
3729
|
keys: u
|
|
3581
3730
|
}), s.dirty());
|
|
3582
|
-
else if (
|
|
3731
|
+
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
3583
3732
|
} else {
|
|
3584
|
-
const
|
|
3585
|
-
for (const
|
|
3586
|
-
const f = n.data[
|
|
3733
|
+
const l = this._def.catchall;
|
|
3734
|
+
for (const c of u) {
|
|
3735
|
+
const f = n.data[c];
|
|
3587
3736
|
i.push({
|
|
3588
|
-
key: { status: "valid", value:
|
|
3589
|
-
value:
|
|
3590
|
-
new
|
|
3737
|
+
key: { status: "valid", value: c },
|
|
3738
|
+
value: l._parse(
|
|
3739
|
+
new ie(n, f, n.path, c)
|
|
3591
3740
|
//, ctx.child(key), value, getParsedType(value)
|
|
3592
3741
|
),
|
|
3593
|
-
alwaysSet:
|
|
3742
|
+
alwaysSet: c in n.data
|
|
3594
3743
|
});
|
|
3595
3744
|
}
|
|
3596
3745
|
}
|
|
3597
3746
|
return n.common.async ? Promise.resolve().then(async () => {
|
|
3598
|
-
const
|
|
3599
|
-
for (const
|
|
3600
|
-
const f = await
|
|
3601
|
-
|
|
3747
|
+
const l = [];
|
|
3748
|
+
for (const c of i) {
|
|
3749
|
+
const f = await c.key, h = await c.value;
|
|
3750
|
+
l.push({
|
|
3602
3751
|
key: f,
|
|
3603
3752
|
value: h,
|
|
3604
|
-
alwaysSet:
|
|
3753
|
+
alwaysSet: c.alwaysSet
|
|
3605
3754
|
});
|
|
3606
3755
|
}
|
|
3607
|
-
return
|
|
3608
|
-
}).then((
|
|
3756
|
+
return l;
|
|
3757
|
+
}).then((l) => Q.mergeObjectSync(s, l)) : Q.mergeObjectSync(s, i);
|
|
3609
3758
|
}
|
|
3610
3759
|
get shape() {
|
|
3611
3760
|
return this._def.shape();
|
|
@@ -3677,7 +3826,7 @@ class z extends A {
|
|
|
3677
3826
|
...this._def.shape(),
|
|
3678
3827
|
...e._def.shape()
|
|
3679
3828
|
}),
|
|
3680
|
-
typeName:
|
|
3829
|
+
typeName: k.ZodObject
|
|
3681
3830
|
});
|
|
3682
3831
|
}
|
|
3683
3832
|
// merge<
|
|
@@ -3767,7 +3916,7 @@ class z extends A {
|
|
|
3767
3916
|
* @deprecated
|
|
3768
3917
|
*/
|
|
3769
3918
|
deepPartial() {
|
|
3770
|
-
return
|
|
3919
|
+
return ge(this);
|
|
3771
3920
|
}
|
|
3772
3921
|
partial(e) {
|
|
3773
3922
|
const t = {};
|
|
@@ -3787,7 +3936,7 @@ class z extends A {
|
|
|
3787
3936
|
t[s] = this.shape[s];
|
|
3788
3937
|
else {
|
|
3789
3938
|
let a = this.shape[s];
|
|
3790
|
-
for (; a instanceof
|
|
3939
|
+
for (; a instanceof ae; )
|
|
3791
3940
|
a = a._def.innerType;
|
|
3792
3941
|
t[s] = a;
|
|
3793
3942
|
}
|
|
@@ -3797,31 +3946,31 @@ class z extends A {
|
|
|
3797
3946
|
});
|
|
3798
3947
|
}
|
|
3799
3948
|
keyof() {
|
|
3800
|
-
return
|
|
3949
|
+
return ur(T.objectKeys(this.shape));
|
|
3801
3950
|
}
|
|
3802
3951
|
}
|
|
3803
3952
|
z.create = (r, e) => new z({
|
|
3804
3953
|
shape: () => r,
|
|
3805
3954
|
unknownKeys: "strip",
|
|
3806
|
-
catchall:
|
|
3807
|
-
typeName:
|
|
3955
|
+
catchall: oe.create(),
|
|
3956
|
+
typeName: k.ZodObject,
|
|
3808
3957
|
...C(e)
|
|
3809
3958
|
});
|
|
3810
3959
|
z.strictCreate = (r, e) => new z({
|
|
3811
3960
|
shape: () => r,
|
|
3812
3961
|
unknownKeys: "strict",
|
|
3813
|
-
catchall:
|
|
3814
|
-
typeName:
|
|
3962
|
+
catchall: oe.create(),
|
|
3963
|
+
typeName: k.ZodObject,
|
|
3815
3964
|
...C(e)
|
|
3816
3965
|
});
|
|
3817
3966
|
z.lazycreate = (r, e) => new z({
|
|
3818
3967
|
shape: r,
|
|
3819
3968
|
unknownKeys: "strip",
|
|
3820
|
-
catchall:
|
|
3821
|
-
typeName:
|
|
3969
|
+
catchall: oe.create(),
|
|
3970
|
+
typeName: k.ZodObject,
|
|
3822
3971
|
...C(e)
|
|
3823
3972
|
});
|
|
3824
|
-
class
|
|
3973
|
+
class Ye extends R {
|
|
3825
3974
|
_parse(e) {
|
|
3826
3975
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
3827
3976
|
function n(a) {
|
|
@@ -3832,10 +3981,10 @@ class Ve extends A {
|
|
|
3832
3981
|
if (u.result.status === "dirty")
|
|
3833
3982
|
return t.common.issues.push(...u.ctx.common.issues), u.result;
|
|
3834
3983
|
const d = a.map((u) => new ee(u.ctx.common.issues));
|
|
3835
|
-
return
|
|
3984
|
+
return y(t, {
|
|
3836
3985
|
code: g.invalid_union,
|
|
3837
3986
|
unionErrors: d
|
|
3838
|
-
}),
|
|
3987
|
+
}), N;
|
|
3839
3988
|
}
|
|
3840
3989
|
if (t.common.async)
|
|
3841
3990
|
return Promise.all(s.map(async (a) => {
|
|
@@ -3860,48 +4009,48 @@ class Ve extends A {
|
|
|
3860
4009
|
let a;
|
|
3861
4010
|
const d = [];
|
|
3862
4011
|
for (const i of s) {
|
|
3863
|
-
const
|
|
4012
|
+
const l = {
|
|
3864
4013
|
...t,
|
|
3865
4014
|
common: {
|
|
3866
4015
|
...t.common,
|
|
3867
4016
|
issues: []
|
|
3868
4017
|
},
|
|
3869
4018
|
parent: null
|
|
3870
|
-
},
|
|
4019
|
+
}, c = i._parseSync({
|
|
3871
4020
|
data: t.data,
|
|
3872
4021
|
path: t.path,
|
|
3873
|
-
parent:
|
|
4022
|
+
parent: l
|
|
3874
4023
|
});
|
|
3875
|
-
if (
|
|
3876
|
-
return
|
|
3877
|
-
|
|
4024
|
+
if (c.status === "valid")
|
|
4025
|
+
return c;
|
|
4026
|
+
c.status === "dirty" && !a && (a = { result: c, ctx: l }), l.common.issues.length && d.push(l.common.issues);
|
|
3878
4027
|
}
|
|
3879
4028
|
if (a)
|
|
3880
4029
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
3881
4030
|
const u = d.map((i) => new ee(i));
|
|
3882
|
-
return
|
|
4031
|
+
return y(t, {
|
|
3883
4032
|
code: g.invalid_union,
|
|
3884
4033
|
unionErrors: u
|
|
3885
|
-
}),
|
|
4034
|
+
}), N;
|
|
3886
4035
|
}
|
|
3887
4036
|
}
|
|
3888
4037
|
get options() {
|
|
3889
4038
|
return this._def.options;
|
|
3890
4039
|
}
|
|
3891
4040
|
}
|
|
3892
|
-
|
|
4041
|
+
Ye.create = (r, e) => new Ye({
|
|
3893
4042
|
options: r,
|
|
3894
|
-
typeName:
|
|
4043
|
+
typeName: k.ZodUnion,
|
|
3895
4044
|
...C(e)
|
|
3896
4045
|
});
|
|
3897
|
-
function
|
|
3898
|
-
const t =
|
|
4046
|
+
function at(r, e) {
|
|
4047
|
+
const t = re(r), s = re(e);
|
|
3899
4048
|
if (r === e)
|
|
3900
4049
|
return { valid: !0, data: r };
|
|
3901
4050
|
if (t === _.object && s === _.object) {
|
|
3902
4051
|
const n = T.objectKeys(e), a = T.objectKeys(r).filter((u) => n.indexOf(u) !== -1), d = { ...r, ...e };
|
|
3903
4052
|
for (const u of a) {
|
|
3904
|
-
const i =
|
|
4053
|
+
const i = at(r[u], e[u]);
|
|
3905
4054
|
if (!i.valid)
|
|
3906
4055
|
return { valid: !1 };
|
|
3907
4056
|
d[u] = i.data;
|
|
@@ -3912,7 +4061,7 @@ function st(r, e) {
|
|
|
3912
4061
|
return { valid: !1 };
|
|
3913
4062
|
const n = [];
|
|
3914
4063
|
for (let a = 0; a < r.length; a++) {
|
|
3915
|
-
const d = r[a], u = e[a], i =
|
|
4064
|
+
const d = r[a], u = e[a], i = at(d, u);
|
|
3916
4065
|
if (!i.valid)
|
|
3917
4066
|
return { valid: !1 };
|
|
3918
4067
|
n.push(i.data);
|
|
@@ -3920,15 +4069,15 @@ function st(r, e) {
|
|
|
3920
4069
|
return { valid: !0, data: n };
|
|
3921
4070
|
} else return t === _.date && s === _.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
3922
4071
|
}
|
|
3923
|
-
class
|
|
4072
|
+
class Ge extends R {
|
|
3924
4073
|
_parse(e) {
|
|
3925
4074
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, d) => {
|
|
3926
|
-
if (
|
|
3927
|
-
return
|
|
3928
|
-
const u =
|
|
3929
|
-
return u.valid ? ((
|
|
4075
|
+
if (Et(a) || Et(d))
|
|
4076
|
+
return N;
|
|
4077
|
+
const u = at(a.value, d.value);
|
|
4078
|
+
return u.valid ? ((Ct(a) || Ct(d)) && t.dirty(), { status: t.value, value: u.data }) : (y(s, {
|
|
3930
4079
|
code: g.invalid_intersection_types
|
|
3931
|
-
}),
|
|
4080
|
+
}), N);
|
|
3932
4081
|
};
|
|
3933
4082
|
return s.common.async ? Promise.all([
|
|
3934
4083
|
this._def.left._parseAsync({
|
|
@@ -3952,30 +4101,30 @@ class Be extends A {
|
|
|
3952
4101
|
}));
|
|
3953
4102
|
}
|
|
3954
4103
|
}
|
|
3955
|
-
|
|
4104
|
+
Ge.create = (r, e, t) => new Ge({
|
|
3956
4105
|
left: r,
|
|
3957
4106
|
right: e,
|
|
3958
|
-
typeName:
|
|
4107
|
+
typeName: k.ZodIntersection,
|
|
3959
4108
|
...C(t)
|
|
3960
4109
|
});
|
|
3961
|
-
class
|
|
4110
|
+
class me extends R {
|
|
3962
4111
|
_parse(e) {
|
|
3963
4112
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3964
4113
|
if (s.parsedType !== _.array)
|
|
3965
|
-
return
|
|
4114
|
+
return y(s, {
|
|
3966
4115
|
code: g.invalid_type,
|
|
3967
4116
|
expected: _.array,
|
|
3968
4117
|
received: s.parsedType
|
|
3969
|
-
}),
|
|
4118
|
+
}), N;
|
|
3970
4119
|
if (s.data.length < this._def.items.length)
|
|
3971
|
-
return
|
|
4120
|
+
return y(s, {
|
|
3972
4121
|
code: g.too_small,
|
|
3973
4122
|
minimum: this._def.items.length,
|
|
3974
4123
|
inclusive: !0,
|
|
3975
4124
|
exact: !1,
|
|
3976
4125
|
type: "array"
|
|
3977
|
-
}),
|
|
3978
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
4126
|
+
}), N;
|
|
4127
|
+
!this._def.rest && s.data.length > this._def.items.length && (y(s, {
|
|
3979
4128
|
code: g.too_big,
|
|
3980
4129
|
maximum: this._def.items.length,
|
|
3981
4130
|
inclusive: !0,
|
|
@@ -3984,31 +4133,31 @@ class fe extends A {
|
|
|
3984
4133
|
}), t.dirty());
|
|
3985
4134
|
const a = [...s.data].map((d, u) => {
|
|
3986
4135
|
const i = this._def.items[u] || this._def.rest;
|
|
3987
|
-
return i ? i._parse(new
|
|
4136
|
+
return i ? i._parse(new ie(s, d, s.path, u)) : null;
|
|
3988
4137
|
}).filter((d) => !!d);
|
|
3989
|
-
return s.common.async ? Promise.all(a).then((d) =>
|
|
4138
|
+
return s.common.async ? Promise.all(a).then((d) => Q.mergeArray(t, d)) : Q.mergeArray(t, a);
|
|
3990
4139
|
}
|
|
3991
4140
|
get items() {
|
|
3992
4141
|
return this._def.items;
|
|
3993
4142
|
}
|
|
3994
4143
|
rest(e) {
|
|
3995
|
-
return new
|
|
4144
|
+
return new me({
|
|
3996
4145
|
...this._def,
|
|
3997
4146
|
rest: e
|
|
3998
4147
|
});
|
|
3999
4148
|
}
|
|
4000
4149
|
}
|
|
4001
|
-
|
|
4150
|
+
me.create = (r, e) => {
|
|
4002
4151
|
if (!Array.isArray(r))
|
|
4003
4152
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
4004
|
-
return new
|
|
4153
|
+
return new me({
|
|
4005
4154
|
items: r,
|
|
4006
|
-
typeName:
|
|
4155
|
+
typeName: k.ZodTuple,
|
|
4007
4156
|
rest: null,
|
|
4008
4157
|
...C(e)
|
|
4009
4158
|
});
|
|
4010
4159
|
};
|
|
4011
|
-
class
|
|
4160
|
+
class Mt extends R {
|
|
4012
4161
|
get keySchema() {
|
|
4013
4162
|
return this._def.keyType;
|
|
4014
4163
|
}
|
|
@@ -4018,62 +4167,62 @@ class St extends A {
|
|
|
4018
4167
|
_parse(e) {
|
|
4019
4168
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
4020
4169
|
if (s.parsedType !== _.map)
|
|
4021
|
-
return
|
|
4170
|
+
return y(s, {
|
|
4022
4171
|
code: g.invalid_type,
|
|
4023
4172
|
expected: _.map,
|
|
4024
4173
|
received: s.parsedType
|
|
4025
|
-
}),
|
|
4026
|
-
const n = this._def.keyType, a = this._def.valueType, d = [...s.data.entries()].map(([u, i],
|
|
4027
|
-
key: n._parse(new
|
|
4028
|
-
value: a._parse(new
|
|
4174
|
+
}), N;
|
|
4175
|
+
const n = this._def.keyType, a = this._def.valueType, d = [...s.data.entries()].map(([u, i], l) => ({
|
|
4176
|
+
key: n._parse(new ie(s, u, s.path, [l, "key"])),
|
|
4177
|
+
value: a._parse(new ie(s, i, s.path, [l, "value"]))
|
|
4029
4178
|
}));
|
|
4030
4179
|
if (s.common.async) {
|
|
4031
4180
|
const u = /* @__PURE__ */ new Map();
|
|
4032
4181
|
return Promise.resolve().then(async () => {
|
|
4033
4182
|
for (const i of d) {
|
|
4034
|
-
const
|
|
4035
|
-
if (
|
|
4036
|
-
return
|
|
4037
|
-
(
|
|
4183
|
+
const l = await i.key, c = await i.value;
|
|
4184
|
+
if (l.status === "aborted" || c.status === "aborted")
|
|
4185
|
+
return N;
|
|
4186
|
+
(l.status === "dirty" || c.status === "dirty") && t.dirty(), u.set(l.value, c.value);
|
|
4038
4187
|
}
|
|
4039
4188
|
return { status: t.value, value: u };
|
|
4040
4189
|
});
|
|
4041
4190
|
} else {
|
|
4042
4191
|
const u = /* @__PURE__ */ new Map();
|
|
4043
4192
|
for (const i of d) {
|
|
4044
|
-
const
|
|
4045
|
-
if (
|
|
4046
|
-
return
|
|
4047
|
-
(
|
|
4193
|
+
const l = i.key, c = i.value;
|
|
4194
|
+
if (l.status === "aborted" || c.status === "aborted")
|
|
4195
|
+
return N;
|
|
4196
|
+
(l.status === "dirty" || c.status === "dirty") && t.dirty(), u.set(l.value, c.value);
|
|
4048
4197
|
}
|
|
4049
4198
|
return { status: t.value, value: u };
|
|
4050
4199
|
}
|
|
4051
4200
|
}
|
|
4052
4201
|
}
|
|
4053
|
-
|
|
4202
|
+
Mt.create = (r, e, t) => new Mt({
|
|
4054
4203
|
valueType: e,
|
|
4055
4204
|
keyType: r,
|
|
4056
|
-
typeName:
|
|
4205
|
+
typeName: k.ZodMap,
|
|
4057
4206
|
...C(t)
|
|
4058
4207
|
});
|
|
4059
|
-
class
|
|
4208
|
+
class $e extends R {
|
|
4060
4209
|
_parse(e) {
|
|
4061
4210
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
4062
4211
|
if (s.parsedType !== _.set)
|
|
4063
|
-
return
|
|
4212
|
+
return y(s, {
|
|
4064
4213
|
code: g.invalid_type,
|
|
4065
4214
|
expected: _.set,
|
|
4066
4215
|
received: s.parsedType
|
|
4067
|
-
}),
|
|
4216
|
+
}), N;
|
|
4068
4217
|
const n = this._def;
|
|
4069
|
-
n.minSize !== null && s.data.size < n.minSize.value && (
|
|
4218
|
+
n.minSize !== null && s.data.size < n.minSize.value && (y(s, {
|
|
4070
4219
|
code: g.too_small,
|
|
4071
4220
|
minimum: n.minSize.value,
|
|
4072
4221
|
type: "set",
|
|
4073
4222
|
inclusive: !0,
|
|
4074
4223
|
exact: !1,
|
|
4075
4224
|
message: n.minSize.message
|
|
4076
|
-
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (
|
|
4225
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (y(s, {
|
|
4077
4226
|
code: g.too_big,
|
|
4078
4227
|
maximum: n.maxSize.value,
|
|
4079
4228
|
type: "set",
|
|
@@ -4083,25 +4232,25 @@ class Pe extends A {
|
|
|
4083
4232
|
}), t.dirty());
|
|
4084
4233
|
const a = this._def.valueType;
|
|
4085
4234
|
function d(i) {
|
|
4086
|
-
const
|
|
4087
|
-
for (const
|
|
4088
|
-
if (
|
|
4089
|
-
return
|
|
4090
|
-
|
|
4235
|
+
const l = /* @__PURE__ */ new Set();
|
|
4236
|
+
for (const c of i) {
|
|
4237
|
+
if (c.status === "aborted")
|
|
4238
|
+
return N;
|
|
4239
|
+
c.status === "dirty" && t.dirty(), l.add(c.value);
|
|
4091
4240
|
}
|
|
4092
|
-
return { status: t.value, value:
|
|
4241
|
+
return { status: t.value, value: l };
|
|
4093
4242
|
}
|
|
4094
|
-
const u = [...s.data.values()].map((i,
|
|
4243
|
+
const u = [...s.data.values()].map((i, l) => a._parse(new ie(s, i, s.path, l)));
|
|
4095
4244
|
return s.common.async ? Promise.all(u).then((i) => d(i)) : d(u);
|
|
4096
4245
|
}
|
|
4097
4246
|
min(e, t) {
|
|
4098
|
-
return new
|
|
4247
|
+
return new $e({
|
|
4099
4248
|
...this._def,
|
|
4100
4249
|
minSize: { value: e, message: b.toString(t) }
|
|
4101
4250
|
});
|
|
4102
4251
|
}
|
|
4103
4252
|
max(e, t) {
|
|
4104
|
-
return new
|
|
4253
|
+
return new $e({
|
|
4105
4254
|
...this._def,
|
|
4106
4255
|
maxSize: { value: e, message: b.toString(t) }
|
|
4107
4256
|
});
|
|
@@ -4113,14 +4262,14 @@ class Pe extends A {
|
|
|
4113
4262
|
return this.min(1, e);
|
|
4114
4263
|
}
|
|
4115
4264
|
}
|
|
4116
|
-
|
|
4265
|
+
$e.create = (r, e) => new $e({
|
|
4117
4266
|
valueType: r,
|
|
4118
4267
|
minSize: null,
|
|
4119
4268
|
maxSize: null,
|
|
4120
|
-
typeName:
|
|
4269
|
+
typeName: k.ZodSet,
|
|
4121
4270
|
...C(e)
|
|
4122
4271
|
});
|
|
4123
|
-
class
|
|
4272
|
+
class Lt extends R {
|
|
4124
4273
|
get schema() {
|
|
4125
4274
|
return this._def.getter();
|
|
4126
4275
|
}
|
|
@@ -4129,20 +4278,20 @@ class Rt extends A {
|
|
|
4129
4278
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
4130
4279
|
}
|
|
4131
4280
|
}
|
|
4132
|
-
|
|
4281
|
+
Lt.create = (r, e) => new Lt({
|
|
4133
4282
|
getter: r,
|
|
4134
|
-
typeName:
|
|
4283
|
+
typeName: k.ZodLazy,
|
|
4135
4284
|
...C(e)
|
|
4136
4285
|
});
|
|
4137
|
-
class
|
|
4286
|
+
class $t extends R {
|
|
4138
4287
|
_parse(e) {
|
|
4139
4288
|
if (e.data !== this._def.value) {
|
|
4140
4289
|
const t = this._getOrReturnCtx(e);
|
|
4141
|
-
return
|
|
4290
|
+
return y(t, {
|
|
4142
4291
|
received: t.data,
|
|
4143
4292
|
code: g.invalid_literal,
|
|
4144
4293
|
expected: this._def.value
|
|
4145
|
-
}),
|
|
4294
|
+
}), N;
|
|
4146
4295
|
}
|
|
4147
4296
|
return { status: "valid", value: e.data };
|
|
4148
4297
|
}
|
|
@@ -4150,35 +4299,35 @@ class At extends A {
|
|
|
4150
4299
|
return this._def.value;
|
|
4151
4300
|
}
|
|
4152
4301
|
}
|
|
4153
|
-
|
|
4302
|
+
$t.create = (r, e) => new $t({
|
|
4154
4303
|
value: r,
|
|
4155
|
-
typeName:
|
|
4304
|
+
typeName: k.ZodLiteral,
|
|
4156
4305
|
...C(e)
|
|
4157
4306
|
});
|
|
4158
|
-
function
|
|
4307
|
+
function ur(r, e) {
|
|
4159
4308
|
return new _e({
|
|
4160
4309
|
values: r,
|
|
4161
|
-
typeName:
|
|
4310
|
+
typeName: k.ZodEnum,
|
|
4162
4311
|
...C(e)
|
|
4163
4312
|
});
|
|
4164
4313
|
}
|
|
4165
|
-
class _e extends
|
|
4314
|
+
class _e extends R {
|
|
4166
4315
|
_parse(e) {
|
|
4167
4316
|
if (typeof e.data != "string") {
|
|
4168
4317
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
4169
|
-
return
|
|
4318
|
+
return y(t, {
|
|
4170
4319
|
expected: T.joinValues(s),
|
|
4171
4320
|
received: t.parsedType,
|
|
4172
4321
|
code: g.invalid_type
|
|
4173
|
-
}),
|
|
4322
|
+
}), N;
|
|
4174
4323
|
}
|
|
4175
4324
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
4176
4325
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
4177
|
-
return
|
|
4326
|
+
return y(t, {
|
|
4178
4327
|
received: t.data,
|
|
4179
4328
|
code: g.invalid_enum_value,
|
|
4180
4329
|
options: s
|
|
4181
|
-
}),
|
|
4330
|
+
}), N;
|
|
4182
4331
|
}
|
|
4183
4332
|
return J(e.data);
|
|
4184
4333
|
}
|
|
@@ -4216,25 +4365,25 @@ class _e extends A {
|
|
|
4216
4365
|
});
|
|
4217
4366
|
}
|
|
4218
4367
|
}
|
|
4219
|
-
_e.create =
|
|
4220
|
-
class
|
|
4368
|
+
_e.create = ur;
|
|
4369
|
+
class Ft extends R {
|
|
4221
4370
|
_parse(e) {
|
|
4222
4371
|
const t = T.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
4223
4372
|
if (s.parsedType !== _.string && s.parsedType !== _.number) {
|
|
4224
4373
|
const n = T.objectValues(t);
|
|
4225
|
-
return
|
|
4374
|
+
return y(s, {
|
|
4226
4375
|
expected: T.joinValues(n),
|
|
4227
4376
|
received: s.parsedType,
|
|
4228
4377
|
code: g.invalid_type
|
|
4229
|
-
}),
|
|
4378
|
+
}), N;
|
|
4230
4379
|
}
|
|
4231
4380
|
if (this._cache || (this._cache = new Set(T.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
4232
4381
|
const n = T.objectValues(t);
|
|
4233
|
-
return
|
|
4382
|
+
return y(s, {
|
|
4234
4383
|
received: s.data,
|
|
4235
4384
|
code: g.invalid_enum_value,
|
|
4236
4385
|
options: n
|
|
4237
|
-
}),
|
|
4386
|
+
}), N;
|
|
4238
4387
|
}
|
|
4239
4388
|
return J(e.data);
|
|
4240
4389
|
}
|
|
@@ -4242,23 +4391,23 @@ class Tt extends A {
|
|
|
4242
4391
|
return this._def.values;
|
|
4243
4392
|
}
|
|
4244
4393
|
}
|
|
4245
|
-
|
|
4394
|
+
Ft.create = (r, e) => new Ft({
|
|
4246
4395
|
values: r,
|
|
4247
|
-
typeName:
|
|
4396
|
+
typeName: k.ZodNativeEnum,
|
|
4248
4397
|
...C(e)
|
|
4249
4398
|
});
|
|
4250
|
-
class
|
|
4399
|
+
class Qe extends R {
|
|
4251
4400
|
unwrap() {
|
|
4252
4401
|
return this._def.type;
|
|
4253
4402
|
}
|
|
4254
4403
|
_parse(e) {
|
|
4255
4404
|
const { ctx: t } = this._processInputParams(e);
|
|
4256
4405
|
if (t.parsedType !== _.promise && t.common.async === !1)
|
|
4257
|
-
return
|
|
4406
|
+
return y(t, {
|
|
4258
4407
|
code: g.invalid_type,
|
|
4259
4408
|
expected: _.promise,
|
|
4260
4409
|
received: t.parsedType
|
|
4261
|
-
}),
|
|
4410
|
+
}), N;
|
|
4262
4411
|
const s = t.parsedType === _.promise ? t.data : Promise.resolve(t.data);
|
|
4263
4412
|
return J(s.then((n) => this._def.type.parseAsync(n, {
|
|
4264
4413
|
path: t.path,
|
|
@@ -4266,22 +4415,22 @@ class We extends A {
|
|
|
4266
4415
|
})));
|
|
4267
4416
|
}
|
|
4268
4417
|
}
|
|
4269
|
-
|
|
4418
|
+
Qe.create = (r, e) => new Qe({
|
|
4270
4419
|
type: r,
|
|
4271
|
-
typeName:
|
|
4420
|
+
typeName: k.ZodPromise,
|
|
4272
4421
|
...C(e)
|
|
4273
4422
|
});
|
|
4274
|
-
class
|
|
4423
|
+
class be extends R {
|
|
4275
4424
|
innerType() {
|
|
4276
4425
|
return this._def.schema;
|
|
4277
4426
|
}
|
|
4278
4427
|
sourceType() {
|
|
4279
|
-
return this._def.schema._def.typeName ===
|
|
4428
|
+
return this._def.schema._def.typeName === k.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
4280
4429
|
}
|
|
4281
4430
|
_parse(e) {
|
|
4282
4431
|
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
4283
4432
|
addIssue: (d) => {
|
|
4284
|
-
|
|
4433
|
+
y(s, d), d.fatal ? t.abort() : t.dirty();
|
|
4285
4434
|
},
|
|
4286
4435
|
get path() {
|
|
4287
4436
|
return s.path;
|
|
@@ -4292,23 +4441,23 @@ class xe extends A {
|
|
|
4292
4441
|
if (s.common.async)
|
|
4293
4442
|
return Promise.resolve(d).then(async (u) => {
|
|
4294
4443
|
if (t.value === "aborted")
|
|
4295
|
-
return
|
|
4444
|
+
return N;
|
|
4296
4445
|
const i = await this._def.schema._parseAsync({
|
|
4297
4446
|
data: u,
|
|
4298
4447
|
path: s.path,
|
|
4299
4448
|
parent: s
|
|
4300
4449
|
});
|
|
4301
|
-
return i.status === "aborted" ?
|
|
4450
|
+
return i.status === "aborted" ? N : i.status === "dirty" || t.value === "dirty" ? Ie(i.value) : i;
|
|
4302
4451
|
});
|
|
4303
4452
|
{
|
|
4304
4453
|
if (t.value === "aborted")
|
|
4305
|
-
return
|
|
4454
|
+
return N;
|
|
4306
4455
|
const u = this._def.schema._parseSync({
|
|
4307
4456
|
data: d,
|
|
4308
4457
|
path: s.path,
|
|
4309
4458
|
parent: s
|
|
4310
4459
|
});
|
|
4311
|
-
return u.status === "aborted" ?
|
|
4460
|
+
return u.status === "aborted" ? N : u.status === "dirty" || t.value === "dirty" ? Ie(u.value) : u;
|
|
4312
4461
|
}
|
|
4313
4462
|
}
|
|
4314
4463
|
if (n.type === "refinement") {
|
|
@@ -4326,9 +4475,9 @@ class xe extends A {
|
|
|
4326
4475
|
path: s.path,
|
|
4327
4476
|
parent: s
|
|
4328
4477
|
});
|
|
4329
|
-
return u.status === "aborted" ?
|
|
4478
|
+
return u.status === "aborted" ? N : (u.status === "dirty" && t.dirty(), d(u.value), { status: t.value, value: u.value });
|
|
4330
4479
|
} else
|
|
4331
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((u) => u.status === "aborted" ?
|
|
4480
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((u) => u.status === "aborted" ? N : (u.status === "dirty" && t.dirty(), d(u.value).then(() => ({ status: t.value, value: u.value }))));
|
|
4332
4481
|
}
|
|
4333
4482
|
if (n.type === "transform")
|
|
4334
4483
|
if (s.common.async === !1) {
|
|
@@ -4338,7 +4487,7 @@ class xe extends A {
|
|
|
4338
4487
|
parent: s
|
|
4339
4488
|
});
|
|
4340
4489
|
if (!ye(d))
|
|
4341
|
-
return
|
|
4490
|
+
return N;
|
|
4342
4491
|
const u = n.transform(d.value, a);
|
|
4343
4492
|
if (u instanceof Promise)
|
|
4344
4493
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
@@ -4347,23 +4496,23 @@ class xe extends A {
|
|
|
4347
4496
|
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => ye(d) ? Promise.resolve(n.transform(d.value, a)).then((u) => ({
|
|
4348
4497
|
status: t.value,
|
|
4349
4498
|
value: u
|
|
4350
|
-
})) :
|
|
4499
|
+
})) : N);
|
|
4351
4500
|
T.assertNever(n);
|
|
4352
4501
|
}
|
|
4353
4502
|
}
|
|
4354
|
-
|
|
4503
|
+
be.create = (r, e, t) => new be({
|
|
4355
4504
|
schema: r,
|
|
4356
|
-
typeName:
|
|
4505
|
+
typeName: k.ZodEffects,
|
|
4357
4506
|
effect: e,
|
|
4358
4507
|
...C(t)
|
|
4359
4508
|
});
|
|
4360
|
-
|
|
4509
|
+
be.createWithPreprocess = (r, e, t) => new be({
|
|
4361
4510
|
schema: e,
|
|
4362
4511
|
effect: { type: "preprocess", transform: r },
|
|
4363
|
-
typeName:
|
|
4512
|
+
typeName: k.ZodEffects,
|
|
4364
4513
|
...C(t)
|
|
4365
4514
|
});
|
|
4366
|
-
class
|
|
4515
|
+
class ae extends R {
|
|
4367
4516
|
_parse(e) {
|
|
4368
4517
|
return this._getType(e) === _.undefined ? J(void 0) : this._def.innerType._parse(e);
|
|
4369
4518
|
}
|
|
@@ -4371,12 +4520,12 @@ class ne extends A {
|
|
|
4371
4520
|
return this._def.innerType;
|
|
4372
4521
|
}
|
|
4373
4522
|
}
|
|
4374
|
-
|
|
4523
|
+
ae.create = (r, e) => new ae({
|
|
4375
4524
|
innerType: r,
|
|
4376
|
-
typeName:
|
|
4525
|
+
typeName: k.ZodOptional,
|
|
4377
4526
|
...C(e)
|
|
4378
4527
|
});
|
|
4379
|
-
class
|
|
4528
|
+
class we extends R {
|
|
4380
4529
|
_parse(e) {
|
|
4381
4530
|
return this._getType(e) === _.null ? J(null) : this._def.innerType._parse(e);
|
|
4382
4531
|
}
|
|
@@ -4384,12 +4533,12 @@ class be extends A {
|
|
|
4384
4533
|
return this._def.innerType;
|
|
4385
4534
|
}
|
|
4386
4535
|
}
|
|
4387
|
-
|
|
4536
|
+
we.create = (r, e) => new we({
|
|
4388
4537
|
innerType: r,
|
|
4389
|
-
typeName:
|
|
4538
|
+
typeName: k.ZodNullable,
|
|
4390
4539
|
...C(e)
|
|
4391
4540
|
});
|
|
4392
|
-
class
|
|
4541
|
+
class it extends R {
|
|
4393
4542
|
_parse(e) {
|
|
4394
4543
|
const { ctx: t } = this._processInputParams(e);
|
|
4395
4544
|
let s = t.data;
|
|
@@ -4403,13 +4552,13 @@ class nt extends A {
|
|
|
4403
4552
|
return this._def.innerType;
|
|
4404
4553
|
}
|
|
4405
4554
|
}
|
|
4406
|
-
|
|
4555
|
+
it.create = (r, e) => new it({
|
|
4407
4556
|
innerType: r,
|
|
4408
|
-
typeName:
|
|
4557
|
+
typeName: k.ZodDefault,
|
|
4409
4558
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
4410
4559
|
...C(e)
|
|
4411
4560
|
});
|
|
4412
|
-
class
|
|
4561
|
+
class ot extends R {
|
|
4413
4562
|
_parse(e) {
|
|
4414
4563
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
4415
4564
|
...t,
|
|
@@ -4424,7 +4573,7 @@ class at extends A {
|
|
|
4424
4573
|
...s
|
|
4425
4574
|
}
|
|
4426
4575
|
});
|
|
4427
|
-
return
|
|
4576
|
+
return We(n) ? n.then((a) => ({
|
|
4428
4577
|
status: "valid",
|
|
4429
4578
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
4430
4579
|
get error() {
|
|
@@ -4446,30 +4595,30 @@ class at extends A {
|
|
|
4446
4595
|
return this._def.innerType;
|
|
4447
4596
|
}
|
|
4448
4597
|
}
|
|
4449
|
-
|
|
4598
|
+
ot.create = (r, e) => new ot({
|
|
4450
4599
|
innerType: r,
|
|
4451
|
-
typeName:
|
|
4600
|
+
typeName: k.ZodCatch,
|
|
4452
4601
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
4453
4602
|
...C(e)
|
|
4454
4603
|
});
|
|
4455
|
-
class
|
|
4604
|
+
class Zt extends R {
|
|
4456
4605
|
_parse(e) {
|
|
4457
4606
|
if (this._getType(e) !== _.nan) {
|
|
4458
4607
|
const s = this._getOrReturnCtx(e);
|
|
4459
|
-
return
|
|
4608
|
+
return y(s, {
|
|
4460
4609
|
code: g.invalid_type,
|
|
4461
4610
|
expected: _.nan,
|
|
4462
4611
|
received: s.parsedType
|
|
4463
|
-
}),
|
|
4612
|
+
}), N;
|
|
4464
4613
|
}
|
|
4465
4614
|
return { status: "valid", value: e.data };
|
|
4466
4615
|
}
|
|
4467
4616
|
}
|
|
4468
|
-
|
|
4469
|
-
typeName:
|
|
4617
|
+
Zt.create = (r) => new Zt({
|
|
4618
|
+
typeName: k.ZodNaN,
|
|
4470
4619
|
...C(r)
|
|
4471
4620
|
});
|
|
4472
|
-
class
|
|
4621
|
+
class nn extends R {
|
|
4473
4622
|
_parse(e) {
|
|
4474
4623
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
4475
4624
|
return this._def.type._parse({
|
|
@@ -4482,7 +4631,7 @@ class Us extends A {
|
|
|
4482
4631
|
return this._def.type;
|
|
4483
4632
|
}
|
|
4484
4633
|
}
|
|
4485
|
-
class
|
|
4634
|
+
class gt extends R {
|
|
4486
4635
|
_parse(e) {
|
|
4487
4636
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
4488
4637
|
if (s.common.async)
|
|
@@ -4492,7 +4641,7 @@ class ct extends A {
|
|
|
4492
4641
|
path: s.path,
|
|
4493
4642
|
parent: s
|
|
4494
4643
|
});
|
|
4495
|
-
return a.status === "aborted" ?
|
|
4644
|
+
return a.status === "aborted" ? N : a.status === "dirty" ? (t.dirty(), Ie(a.value)) : this._def.out._parseAsync({
|
|
4496
4645
|
data: a.value,
|
|
4497
4646
|
path: s.path,
|
|
4498
4647
|
parent: s
|
|
@@ -4504,7 +4653,7 @@ class ct extends A {
|
|
|
4504
4653
|
path: s.path,
|
|
4505
4654
|
parent: s
|
|
4506
4655
|
});
|
|
4507
|
-
return n.status === "aborted" ?
|
|
4656
|
+
return n.status === "aborted" ? N : n.status === "dirty" ? (t.dirty(), {
|
|
4508
4657
|
status: "dirty",
|
|
4509
4658
|
value: n.value
|
|
4510
4659
|
}) : this._def.out._parseSync({
|
|
@@ -4515,73 +4664,73 @@ class ct extends A {
|
|
|
4515
4664
|
}
|
|
4516
4665
|
}
|
|
4517
4666
|
static create(e, t) {
|
|
4518
|
-
return new
|
|
4667
|
+
return new gt({
|
|
4519
4668
|
in: e,
|
|
4520
4669
|
out: t,
|
|
4521
|
-
typeName:
|
|
4670
|
+
typeName: k.ZodPipeline
|
|
4522
4671
|
});
|
|
4523
4672
|
}
|
|
4524
4673
|
}
|
|
4525
|
-
class
|
|
4674
|
+
class lt extends R {
|
|
4526
4675
|
_parse(e) {
|
|
4527
4676
|
const t = this._def.innerType._parse(e), s = (n) => (ye(n) && (n.value = Object.freeze(n.value)), n);
|
|
4528
|
-
return
|
|
4677
|
+
return We(t) ? t.then((n) => s(n)) : s(t);
|
|
4529
4678
|
}
|
|
4530
4679
|
unwrap() {
|
|
4531
4680
|
return this._def.innerType;
|
|
4532
4681
|
}
|
|
4533
4682
|
}
|
|
4534
|
-
|
|
4683
|
+
lt.create = (r, e) => new lt({
|
|
4535
4684
|
innerType: r,
|
|
4536
|
-
typeName:
|
|
4685
|
+
typeName: k.ZodReadonly,
|
|
4537
4686
|
...C(e)
|
|
4538
4687
|
});
|
|
4539
|
-
var
|
|
4688
|
+
var k;
|
|
4540
4689
|
(function(r) {
|
|
4541
4690
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
4542
|
-
})(
|
|
4543
|
-
const
|
|
4544
|
-
de.create;
|
|
4545
|
-
ue.create;
|
|
4546
|
-
Ue.create;
|
|
4547
|
-
ve.create;
|
|
4548
|
-
ie.create;
|
|
4549
|
-
X.create;
|
|
4550
|
-
const Vs = z.create;
|
|
4551
|
-
Ve.create;
|
|
4552
|
-
Be.create;
|
|
4691
|
+
})(k || (k = {}));
|
|
4692
|
+
const Oe = K.create;
|
|
4553
4693
|
fe.create;
|
|
4694
|
+
he.create;
|
|
4695
|
+
qe.create;
|
|
4696
|
+
xe.create;
|
|
4697
|
+
oe.create;
|
|
4698
|
+
X.create;
|
|
4699
|
+
const an = z.create;
|
|
4700
|
+
Ye.create;
|
|
4701
|
+
Ge.create;
|
|
4702
|
+
me.create;
|
|
4554
4703
|
_e.create;
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
const
|
|
4704
|
+
Qe.create;
|
|
4705
|
+
ae.create;
|
|
4706
|
+
we.create;
|
|
4707
|
+
const Dt = {
|
|
4559
4708
|
string: ((r) => K.create({ ...r, coerce: !0 })),
|
|
4560
|
-
number: ((r) =>
|
|
4561
|
-
boolean: ((r) =>
|
|
4709
|
+
number: ((r) => fe.create({ ...r, coerce: !0 })),
|
|
4710
|
+
boolean: ((r) => qe.create({
|
|
4562
4711
|
...r,
|
|
4563
4712
|
coerce: !0
|
|
4564
4713
|
})),
|
|
4565
|
-
bigint: ((r) =>
|
|
4566
|
-
date: ((r) =>
|
|
4567
|
-
},
|
|
4568
|
-
q:
|
|
4569
|
-
task_type:
|
|
4570
|
-
status:
|
|
4571
|
-
from_date:
|
|
4572
|
-
to_date:
|
|
4573
|
-
page:
|
|
4574
|
-
per_page:
|
|
4714
|
+
bigint: ((r) => he.create({ ...r, coerce: !0 })),
|
|
4715
|
+
date: ((r) => xe.create({ ...r, coerce: !0 }))
|
|
4716
|
+
}, on = an({
|
|
4717
|
+
q: Oe().optional(),
|
|
4718
|
+
task_type: Oe().optional(),
|
|
4719
|
+
status: Oe().optional(),
|
|
4720
|
+
from_date: Oe().optional(),
|
|
4721
|
+
to_date: Oe().optional(),
|
|
4722
|
+
page: Dt.number().int().positive().default(1),
|
|
4723
|
+
per_page: Dt.number().int().positive().default(20)
|
|
4575
4724
|
});
|
|
4576
|
-
function
|
|
4725
|
+
function fr(r) {
|
|
4577
4726
|
return { data: [], isLoading: !1, raw: { metadata: { total: 0 } } };
|
|
4578
4727
|
}
|
|
4579
|
-
function
|
|
4728
|
+
function hr(r) {
|
|
4580
4729
|
return { data: null, isLoading: !1 };
|
|
4581
4730
|
}
|
|
4582
|
-
function
|
|
4731
|
+
function mr({ setSelectedTask: r }) {
|
|
4583
4732
|
const e = (s) => {
|
|
4584
|
-
const { data: n, raw: a, isLoading: d } =
|
|
4733
|
+
const { data: n, raw: a, isLoading: d } = fr();
|
|
4585
4734
|
return {
|
|
4586
4735
|
data: n ?? [],
|
|
4587
4736
|
isLoading: d,
|
|
@@ -4594,7 +4743,7 @@ function ar({ setSelectedTask: r }) {
|
|
|
4594
4743
|
{
|
|
4595
4744
|
key: "attempts",
|
|
4596
4745
|
header: "Attempts",
|
|
4597
|
-
render: (s) => /* @__PURE__ */
|
|
4746
|
+
render: (s) => /* @__PURE__ */ o.jsxs("span", { children: [
|
|
4598
4747
|
s.attempts,
|
|
4599
4748
|
"/",
|
|
4600
4749
|
s.max_attempts
|
|
@@ -4604,24 +4753,24 @@ function ar({ setSelectedTask: r }) {
|
|
|
4604
4753
|
key: "error",
|
|
4605
4754
|
header: "Error",
|
|
4606
4755
|
className: "max-w-xs truncate",
|
|
4607
|
-
render: (s) => /* @__PURE__ */
|
|
4756
|
+
render: (s) => /* @__PURE__ */ o.jsx("span", { title: s.error || "", children: s.error })
|
|
4608
4757
|
},
|
|
4609
4758
|
{
|
|
4610
4759
|
key: "created_at",
|
|
4611
4760
|
header: "Created",
|
|
4612
|
-
render: (s) =>
|
|
4761
|
+
render: (s) => Pe(s.created_at)
|
|
4613
4762
|
}
|
|
4614
4763
|
];
|
|
4615
|
-
return /* @__PURE__ */
|
|
4616
|
-
|
|
4764
|
+
return /* @__PURE__ */ o.jsx(
|
|
4765
|
+
Ht,
|
|
4617
4766
|
{
|
|
4618
4767
|
title: "Background Tasks",
|
|
4619
|
-
paramsSchema:
|
|
4768
|
+
paramsSchema: on,
|
|
4620
4769
|
useQuery: e,
|
|
4621
4770
|
columns: t,
|
|
4622
4771
|
onRowClick: r,
|
|
4623
|
-
renderFilters: (s, n) => /* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4772
|
+
renderFilters: (s, n) => /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
4773
|
+
/* @__PURE__ */ o.jsx(
|
|
4625
4774
|
"input",
|
|
4626
4775
|
{
|
|
4627
4776
|
type: "search",
|
|
@@ -4631,38 +4780,38 @@ function ar({ setSelectedTask: r }) {
|
|
|
4631
4780
|
onChange: (a) => n("q", a.target.value)
|
|
4632
4781
|
}
|
|
4633
4782
|
),
|
|
4634
|
-
/* @__PURE__ */
|
|
4783
|
+
/* @__PURE__ */ o.jsxs(
|
|
4635
4784
|
"select",
|
|
4636
4785
|
{
|
|
4637
4786
|
className: "select select-sm select-bordered w-40",
|
|
4638
4787
|
value: s.task_type || "",
|
|
4639
4788
|
onChange: (a) => n("task_type", a.target.value),
|
|
4640
4789
|
children: [
|
|
4641
|
-
/* @__PURE__ */
|
|
4642
|
-
/* @__PURE__ */
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
/* @__PURE__ */
|
|
4646
|
-
/* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ o.jsx("option", { value: "", children: "All Types" }),
|
|
4791
|
+
/* @__PURE__ */ o.jsx("option", { value: "email_registration", children: "Email Registration" }),
|
|
4792
|
+
/* @__PURE__ */ o.jsx("option", { value: "email_password_reset", children: "Email Password Reset" }),
|
|
4793
|
+
/* @__PURE__ */ o.jsx("option", { value: "email_notification", children: "Email Notification" }),
|
|
4794
|
+
/* @__PURE__ */ o.jsx("option", { value: "resize_image", children: "Resize Image" }),
|
|
4795
|
+
/* @__PURE__ */ o.jsx("option", { value: "zip_import", children: "Zip Import" })
|
|
4647
4796
|
]
|
|
4648
4797
|
}
|
|
4649
4798
|
),
|
|
4650
|
-
/* @__PURE__ */
|
|
4799
|
+
/* @__PURE__ */ o.jsxs(
|
|
4651
4800
|
"select",
|
|
4652
4801
|
{
|
|
4653
4802
|
className: "select select-sm select-bordered w-40",
|
|
4654
4803
|
value: s.status || "",
|
|
4655
4804
|
onChange: (a) => n("status", a.target.value),
|
|
4656
4805
|
children: [
|
|
4657
|
-
/* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4806
|
+
/* @__PURE__ */ o.jsx("option", { value: "", children: "All Statuses" }),
|
|
4807
|
+
/* @__PURE__ */ o.jsx("option", { value: "pending", children: "Pending" }),
|
|
4808
|
+
/* @__PURE__ */ o.jsx("option", { value: "running", children: "Running" }),
|
|
4809
|
+
/* @__PURE__ */ o.jsx("option", { value: "completed", children: "Completed" }),
|
|
4810
|
+
/* @__PURE__ */ o.jsx("option", { value: "failed", children: "Failed" })
|
|
4662
4811
|
]
|
|
4663
4812
|
}
|
|
4664
4813
|
),
|
|
4665
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ o.jsx(
|
|
4666
4815
|
"input",
|
|
4667
4816
|
{
|
|
4668
4817
|
type: "date",
|
|
@@ -4675,7 +4824,7 @@ function ar({ setSelectedTask: r }) {
|
|
|
4675
4824
|
}
|
|
4676
4825
|
}
|
|
4677
4826
|
),
|
|
4678
|
-
/* @__PURE__ */
|
|
4827
|
+
/* @__PURE__ */ o.jsx(
|
|
4679
4828
|
"input",
|
|
4680
4829
|
{
|
|
4681
4830
|
type: "date",
|
|
@@ -4693,68 +4842,68 @@ function ar({ setSelectedTask: r }) {
|
|
|
4693
4842
|
}
|
|
4694
4843
|
);
|
|
4695
4844
|
}
|
|
4696
|
-
function
|
|
4697
|
-
const s =
|
|
4845
|
+
function pr({ selectedTask: r, setSelectedTask: e }) {
|
|
4846
|
+
const s = hr(r?.id).data ?? null;
|
|
4698
4847
|
if (!r) return null;
|
|
4699
4848
|
const n = s?.payload ?? r.payload ?? null;
|
|
4700
|
-
return /* @__PURE__ */
|
|
4849
|
+
return /* @__PURE__ */ o.jsx(
|
|
4701
4850
|
"div",
|
|
4702
4851
|
{
|
|
4703
4852
|
className: "modal modal-open",
|
|
4704
4853
|
role: "dialog",
|
|
4705
4854
|
onClick: () => e(null),
|
|
4706
|
-
children: /* @__PURE__ */
|
|
4707
|
-
/* @__PURE__ */
|
|
4855
|
+
children: /* @__PURE__ */ o.jsxs("div", { className: "modal-box max-w-3xl", onClick: (a) => a.stopPropagation(), children: [
|
|
4856
|
+
/* @__PURE__ */ o.jsxs("h3", { className: "font-bold text-lg", children: [
|
|
4708
4857
|
"Task #",
|
|
4709
4858
|
r.id,
|
|
4710
4859
|
" — ",
|
|
4711
4860
|
r.task_type
|
|
4712
4861
|
] }),
|
|
4713
|
-
/* @__PURE__ */
|
|
4714
|
-
/* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4862
|
+
/* @__PURE__ */ o.jsxs("div", { className: "mt-4 grid grid-cols-2 gap-4 text-sm", children: [
|
|
4863
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4864
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Status:" }),
|
|
4716
4865
|
" ",
|
|
4717
4866
|
r.status
|
|
4718
4867
|
] }),
|
|
4719
|
-
/* @__PURE__ */
|
|
4720
|
-
/* @__PURE__ */
|
|
4868
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4869
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Attempts:" }),
|
|
4721
4870
|
" ",
|
|
4722
4871
|
r.attempts,
|
|
4723
4872
|
"/",
|
|
4724
4873
|
r.max_attempts
|
|
4725
4874
|
] }),
|
|
4726
|
-
/* @__PURE__ */
|
|
4727
|
-
/* @__PURE__ */
|
|
4875
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4876
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Scheduled:" }),
|
|
4728
4877
|
" ",
|
|
4729
4878
|
r.scheduled_for ?? "—"
|
|
4730
4879
|
] }),
|
|
4731
|
-
/* @__PURE__ */
|
|
4732
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4881
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Started:" }),
|
|
4733
4882
|
" ",
|
|
4734
|
-
|
|
4883
|
+
Pe(r.started_at)
|
|
4735
4884
|
] }),
|
|
4736
|
-
/* @__PURE__ */
|
|
4737
|
-
/* @__PURE__ */
|
|
4885
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4886
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Completed:" }),
|
|
4738
4887
|
" ",
|
|
4739
|
-
|
|
4888
|
+
Pe(r.completed_at)
|
|
4740
4889
|
] }),
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4891
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Created:" }),
|
|
4743
4892
|
" ",
|
|
4744
|
-
|
|
4893
|
+
Pe(r.created_at)
|
|
4745
4894
|
] }),
|
|
4746
|
-
/* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
4895
|
+
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
4896
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Updated:" }),
|
|
4748
4897
|
" ",
|
|
4749
|
-
|
|
4898
|
+
Pe(r.updated_at)
|
|
4750
4899
|
] }),
|
|
4751
|
-
/* @__PURE__ */
|
|
4752
|
-
/* @__PURE__ */
|
|
4753
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ o.jsxs("div", { className: "col-span-2", children: [
|
|
4901
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Error:" }),
|
|
4902
|
+
/* @__PURE__ */ o.jsx("div", { className: "whitespace-pre-wrap", children: r.error ?? "—" })
|
|
4754
4903
|
] }),
|
|
4755
|
-
/* @__PURE__ */
|
|
4756
|
-
/* @__PURE__ */
|
|
4757
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ o.jsxs("div", { className: "col-span-2", children: [
|
|
4905
|
+
/* @__PURE__ */ o.jsx("strong", { children: "Payload:" }),
|
|
4906
|
+
/* @__PURE__ */ o.jsx("pre", { className: "bg-base-200 p-2 rounded max-h-48 overflow-auto text-xs", children: (() => {
|
|
4758
4907
|
const a = n;
|
|
4759
4908
|
if (a == null) return "—";
|
|
4760
4909
|
try {
|
|
@@ -4766,35 +4915,94 @@ function ir({ selectedTask: r, setSelectedTask: e }) {
|
|
|
4766
4915
|
})() })
|
|
4767
4916
|
] })
|
|
4768
4917
|
] }),
|
|
4769
|
-
/* @__PURE__ */
|
|
4918
|
+
/* @__PURE__ */ o.jsx("div", { className: "modal-action", children: /* @__PURE__ */ o.jsx("button", { className: "btn", onClick: () => e(null), children: "Close" }) })
|
|
4770
4919
|
] })
|
|
4771
4920
|
}
|
|
4772
4921
|
);
|
|
4773
4922
|
}
|
|
4774
|
-
const
|
|
4923
|
+
const wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4775
4924
|
__proto__: null,
|
|
4776
|
-
AdminLayout:
|
|
4777
|
-
AlertCard:
|
|
4778
|
-
GenericFormModal:
|
|
4779
|
-
GenericList:
|
|
4780
|
-
ModalErrors:
|
|
4781
|
-
Pagination:
|
|
4782
|
-
QRCodeGenerator:
|
|
4783
|
-
TasksList:
|
|
4784
|
-
TasksModal:
|
|
4925
|
+
AdminLayout: pt,
|
|
4926
|
+
AlertCard: qr,
|
|
4927
|
+
GenericFormModal: Yr,
|
|
4928
|
+
GenericList: Ht,
|
|
4929
|
+
ModalErrors: _s,
|
|
4930
|
+
Pagination: Qt,
|
|
4931
|
+
QRCodeGenerator: Ts,
|
|
4932
|
+
TasksList: mr,
|
|
4933
|
+
TasksModal: pr
|
|
4785
4934
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4786
|
-
function
|
|
4787
|
-
const [
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4935
|
+
function ln() {
|
|
4936
|
+
const { data: r = [], isLoading: e, refetch: t } = mt(), s = qt(), [n, a] = se({}), d = async (u) => {
|
|
4937
|
+
const i = r.find((c) => c.feature_key === u);
|
|
4938
|
+
if (!i) return;
|
|
4939
|
+
const l = !i.enabled;
|
|
4940
|
+
a((c) => ({ ...c, [u]: !0 }));
|
|
4941
|
+
try {
|
|
4942
|
+
await s.mutateAsync({ key: u, enabled: l }), t && await t();
|
|
4943
|
+
} catch (c) {
|
|
4944
|
+
console.error("Failed to update feature flag", c), ct.error("Failed to update feature flag");
|
|
4945
|
+
} finally {
|
|
4946
|
+
a((c) => {
|
|
4947
|
+
const f = { ...c };
|
|
4948
|
+
return delete f[u], f;
|
|
4949
|
+
});
|
|
4950
|
+
}
|
|
4951
|
+
};
|
|
4952
|
+
return e ? /* @__PURE__ */ o.jsx("div", { className: "p-6", children: "Loading..." }) : /* @__PURE__ */ o.jsxs(pt, { title: "Feature Flags", children: [
|
|
4953
|
+
/* @__PURE__ */ o.jsx("div", { className: "flex items-center justify-between mb-6", children: /* @__PURE__ */ o.jsxs("div", { children: [
|
|
4954
|
+
/* @__PURE__ */ o.jsx("h1", { className: "text-2xl font-bold", children: "Feature Flags" }),
|
|
4955
|
+
/* @__PURE__ */ o.jsx("p", { className: "text-sm text-base-content/60 mt-1", children: "Configure which features are enabled in the application" })
|
|
4956
|
+
] }) }),
|
|
4957
|
+
/* @__PURE__ */ o.jsx("div", { className: "bg-base-100 rounded-lg shadow", children: /* @__PURE__ */ o.jsx("div", { className: "divide-y", children: r.map((u) => {
|
|
4958
|
+
const i = u.enabled, l = !!n[u.feature_key];
|
|
4959
|
+
return /* @__PURE__ */ o.jsxs(
|
|
4960
|
+
"div",
|
|
4961
|
+
{
|
|
4962
|
+
className: `p-4 flex items-center justify-between ${l ? "bg-warning/10" : ""}`,
|
|
4963
|
+
children: [
|
|
4964
|
+
/* @__PURE__ */ o.jsx("div", { className: "flex-1", children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4965
|
+
/* @__PURE__ */ o.jsx("h3", { className: "font-semibold text-lg", children: u.feature_key }),
|
|
4966
|
+
l && /* @__PURE__ */ o.jsx("span", { className: "badge badge-warning badge-sm", children: "saving" })
|
|
4967
|
+
] }) }),
|
|
4968
|
+
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
4969
|
+
/* @__PURE__ */ o.jsx(
|
|
4970
|
+
"span",
|
|
4971
|
+
{
|
|
4972
|
+
className: `text-sm font-medium ${i ? "text-success" : "text-base-content/50"}`,
|
|
4973
|
+
children: i ? "Enabled" : "Disabled"
|
|
4974
|
+
}
|
|
4975
|
+
),
|
|
4976
|
+
/* @__PURE__ */ o.jsx(
|
|
4977
|
+
"input",
|
|
4978
|
+
{
|
|
4979
|
+
type: "checkbox",
|
|
4980
|
+
className: "toggle toggle-success",
|
|
4981
|
+
checked: i,
|
|
4982
|
+
onChange: () => d(u.feature_key)
|
|
4983
|
+
}
|
|
4984
|
+
)
|
|
4985
|
+
] })
|
|
4986
|
+
]
|
|
4987
|
+
},
|
|
4988
|
+
u.feature_key
|
|
4989
|
+
);
|
|
4990
|
+
}) }) })
|
|
4991
|
+
] });
|
|
4992
|
+
}
|
|
4993
|
+
function cn() {
|
|
4994
|
+
const [r, e] = se(null);
|
|
4995
|
+
return /* @__PURE__ */ o.jsxs(pt, { title: "Tasks", children: [
|
|
4996
|
+
/* @__PURE__ */ o.jsx(mr, { setSelectedTask: e }),
|
|
4997
|
+
/* @__PURE__ */ o.jsx(pr, { selectedTask: r, setSelectedTask: e })
|
|
4791
4998
|
] });
|
|
4792
4999
|
}
|
|
4793
|
-
const
|
|
5000
|
+
const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4794
5001
|
__proto__: null,
|
|
4795
|
-
|
|
5002
|
+
AdminFeatureFlags: ln,
|
|
5003
|
+
AdminTasks: cn
|
|
4796
5004
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4797
|
-
function
|
|
5005
|
+
function Nn({
|
|
4798
5006
|
label: r,
|
|
4799
5007
|
field: e,
|
|
4800
5008
|
params: t,
|
|
@@ -4802,24 +5010,24 @@ function nn({
|
|
|
4802
5010
|
setFilters: n,
|
|
4803
5011
|
className: a = ""
|
|
4804
5012
|
}) {
|
|
4805
|
-
const d = t.sort_by, u = t.sort_order, i = d === e,
|
|
5013
|
+
const d = t.sort_by, u = t.sort_order, i = d === e, l = i ? u === "asc" ? Nr : kr : jr, c = () => {
|
|
4806
5014
|
let f = "asc";
|
|
4807
5015
|
i && u === "asc" && (f = "desc"), n ? n({
|
|
4808
5016
|
sort_by: e,
|
|
4809
5017
|
sort_order: f
|
|
4810
5018
|
}) : (s("sort_by", e), s("sort_order", f));
|
|
4811
5019
|
};
|
|
4812
|
-
return /* @__PURE__ */
|
|
5020
|
+
return /* @__PURE__ */ o.jsxs(
|
|
4813
5021
|
"div",
|
|
4814
5022
|
{
|
|
4815
5023
|
className: `cursor-pointer hover:bg-base-200 transition-colors flex items-center gap-2 select-none ${a}`,
|
|
4816
|
-
onClick:
|
|
5024
|
+
onClick: c,
|
|
4817
5025
|
children: [
|
|
4818
5026
|
r,
|
|
4819
|
-
/* @__PURE__ */
|
|
4820
|
-
|
|
5027
|
+
/* @__PURE__ */ o.jsx(
|
|
5028
|
+
je,
|
|
4821
5029
|
{
|
|
4822
|
-
icon:
|
|
5030
|
+
icon: l,
|
|
4823
5031
|
className: i ? "text-primary" : "text-base-content/30"
|
|
4824
5032
|
}
|
|
4825
5033
|
)
|
|
@@ -4827,13 +5035,13 @@ function nn({
|
|
|
4827
5035
|
}
|
|
4828
5036
|
);
|
|
4829
5037
|
}
|
|
4830
|
-
function
|
|
5038
|
+
function kn() {
|
|
4831
5039
|
return {
|
|
4832
|
-
useList: (r) =>
|
|
4833
|
-
useGet: (r) =>
|
|
5040
|
+
useList: (r) => fr(),
|
|
5041
|
+
useGet: (r) => hr()
|
|
4834
5042
|
};
|
|
4835
5043
|
}
|
|
4836
|
-
function
|
|
5044
|
+
function En(r, e) {
|
|
4837
5045
|
const t = {};
|
|
4838
5046
|
e.defaults && Object.assign(t, e.defaults);
|
|
4839
5047
|
for (const [s, n] of Object.entries(r || {}))
|
|
@@ -4852,19 +5060,21 @@ function on(r, e) {
|
|
|
4852
5060
|
return t;
|
|
4853
5061
|
}
|
|
4854
5062
|
export {
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
5063
|
+
pt as AdminLayout,
|
|
5064
|
+
Ar as AuthProvider,
|
|
5065
|
+
Ht as GenericList,
|
|
5066
|
+
Qt as Pagination,
|
|
5067
|
+
Nn as SortHeader,
|
|
5068
|
+
vn as auth,
|
|
5069
|
+
xn as buildApiQuery,
|
|
5070
|
+
wn as components,
|
|
5071
|
+
yn as configureAdminLayout,
|
|
5072
|
+
gn as featureFlags,
|
|
5073
|
+
jn as pages,
|
|
5074
|
+
jt as parseParams,
|
|
5075
|
+
ze as toSearchParams,
|
|
5076
|
+
le as useAuthApi,
|
|
5077
|
+
Ut as useAuthConfig,
|
|
5078
|
+
kn as useTasksApi,
|
|
5079
|
+
En as validateParams
|
|
4870
5080
|
};
|