@recursica/adapter-tester 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -78
- package/dist/adapter-tester.schema.json.d.ts +116 -0
- package/dist/cli.cjs +39 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4923 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-B0Eop8Az.cjs.map +1 -1
- package/dist/{config-CKgyDyNF.js → config-CDxTeSAY.js} +2 -4
- package/dist/{config-CKgyDyNF.js.map → config-CDxTeSAY.js.map} +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/devServer.d.ts +8 -0
- package/dist/devServer.d.ts.map +1 -0
- package/dist/fileConfig.d.ts +60 -0
- package/dist/fileConfig.d.ts.map +1 -0
- package/dist/harness/mantineSourceOfTruth.d.ts.map +1 -1
- package/dist/index.cjs +1 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.html +29 -24
- package/dist/index.js +6 -117
- package/dist/index.js.map +1 -1
- package/dist/mantineSourceOfTruth-BiSfXKff.js +121 -0
- package/dist/mantineSourceOfTruth-BiSfXKff.js.map +1 -0
- package/dist/mantineSourceOfTruth-DCoJ2dU-.cjs +54 -0
- package/dist/mantineSourceOfTruth-DCoJ2dU-.cjs.map +1 -0
- package/dist/testing/runVisualRegression.d.ts.map +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +85 -81
- package/dist/testing.js.map +1 -1
- package/dist/validateFileConfig.d.ts +7 -0
- package/dist/validateFileConfig.d.ts.map +1 -0
- package/package.json +17 -7
- package/public/index.html +466 -0
- package/report-header.txt +8 -0
- package/src/adapter-tester.schema.json +113 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,4923 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn as vn, spawnSync as qn } from "node:child_process";
|
|
3
|
+
import { readFileSync as pt, existsSync as _n, mkdirSync as Cn, writeFileSync as Jt } from "node:fs";
|
|
4
|
+
import { dirname as $n, join as de, resolve as Wt } from "node:path";
|
|
5
|
+
import { fileURLToPath as wn, pathToFileURL as Dn } from "node:url";
|
|
6
|
+
import An from "node:net";
|
|
7
|
+
import Mn from "express";
|
|
8
|
+
import { createProxyMiddleware as zn } from "http-proxy-middleware";
|
|
9
|
+
import { m as Vn } from "./mantineSourceOfTruth-BiSfXKff.js";
|
|
10
|
+
const Bt = $n(wn(import.meta.url));
|
|
11
|
+
function Mt(e) {
|
|
12
|
+
return new Promise((t) => {
|
|
13
|
+
const m = new An.Socket();
|
|
14
|
+
m.setTimeout(200), m.once("connect", () => {
|
|
15
|
+
m.destroy(), t(!0);
|
|
16
|
+
}), m.once("timeout", () => {
|
|
17
|
+
m.destroy(), t(!1);
|
|
18
|
+
}), m.once("error", () => {
|
|
19
|
+
m.destroy(), t(!1);
|
|
20
|
+
}), m.connect(e, "127.0.0.1");
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function Yt(e, t = 6e4) {
|
|
24
|
+
const m = Date.now();
|
|
25
|
+
for (; Date.now() - m < t; ) {
|
|
26
|
+
if (await Mt(e)) return !0;
|
|
27
|
+
await new Promise((c) => setTimeout(c, 500));
|
|
28
|
+
}
|
|
29
|
+
return !1;
|
|
30
|
+
}
|
|
31
|
+
function Zt(e) {
|
|
32
|
+
return Number(new URL(e).port);
|
|
33
|
+
}
|
|
34
|
+
function Qt(e, t) {
|
|
35
|
+
var c, b;
|
|
36
|
+
console.log(
|
|
37
|
+
`[Dev Launcher] Port ${t.port} is inactive. Launching Storybook for ${e}...`
|
|
38
|
+
);
|
|
39
|
+
const m = vn(t.command, {
|
|
40
|
+
cwd: t.cwd,
|
|
41
|
+
stdio: "pipe",
|
|
42
|
+
shell: !0
|
|
43
|
+
});
|
|
44
|
+
return (c = m.stdout) == null || c.on("data", (s) => {
|
|
45
|
+
for (const l of s.toString().split(`
|
|
46
|
+
`))
|
|
47
|
+
l.trim() && console.log(`[${e} SB] ${l.trim()}`);
|
|
48
|
+
}), (b = m.stderr) == null || b.on("data", (s) => {
|
|
49
|
+
for (const l of s.toString().split(`
|
|
50
|
+
`))
|
|
51
|
+
l.trim() && console.error(`[${e} SB ERROR] ${l.trim()}`);
|
|
52
|
+
}), m.on("error", (s) => {
|
|
53
|
+
console.error(`[${e} SB ERROR] Failed to start process:`, s);
|
|
54
|
+
}), m;
|
|
55
|
+
}
|
|
56
|
+
function Fn(e) {
|
|
57
|
+
const t = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
58
|
+
console.log(`[Dev Launcher] Auto-launching browser: ${e}`), vn(t, [e], { shell: process.platform === "win32" }).on(
|
|
59
|
+
"error",
|
|
60
|
+
(m) => {
|
|
61
|
+
console.error("[Dev Launcher] Failed to auto-launch browser:", m);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function Un(e, t, m = {}) {
|
|
66
|
+
const [c, b] = e.targets, [s, l] = t;
|
|
67
|
+
if (!(c != null && c.sourceOfTruth) || !b || b.sourceOfTruth || !s || !l)
|
|
68
|
+
throw new Error(
|
|
69
|
+
"adapter-tester dev mode requires exactly two targets: [sourceOfTruth, target] — check adapter-tester.config.json."
|
|
70
|
+
);
|
|
71
|
+
const u = m.port ?? 6010, h = Zt(c.url), $ = Zt(b.url), v = Mn(), P = de(Bt, "../public"), _ = de(Bt, "../report-header.txt");
|
|
72
|
+
v.get("/", (a, i, r) => {
|
|
73
|
+
if (a.query.path) {
|
|
74
|
+
r();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const o = pt(de(P, "index.html"), "utf8").replace(
|
|
78
|
+
"<head>",
|
|
79
|
+
`<head>
|
|
80
|
+
<script>window.__ADAPTER_TESTER__ = ${JSON.stringify({
|
|
81
|
+
sourceOfTruthName: c.name,
|
|
82
|
+
targetName: b.name,
|
|
83
|
+
targetPort: $
|
|
84
|
+
})};<\/script>`
|
|
85
|
+
);
|
|
86
|
+
i.send(o);
|
|
87
|
+
}), v.get("/report-header.txt", (a, i) => {
|
|
88
|
+
try {
|
|
89
|
+
i.type("text/plain").send(pt(_, "utf8"));
|
|
90
|
+
} catch {
|
|
91
|
+
i.status(500).send("Error loading report-header.txt");
|
|
92
|
+
}
|
|
93
|
+
}), v.use(
|
|
94
|
+
"/",
|
|
95
|
+
zn({
|
|
96
|
+
target: `http://localhost:${h}`,
|
|
97
|
+
changeOrigin: !0,
|
|
98
|
+
ws: !0
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
const y = [];
|
|
102
|
+
let g = !1;
|
|
103
|
+
const w = () => {
|
|
104
|
+
if (!g) {
|
|
105
|
+
g = !0, console.log(
|
|
106
|
+
`
|
|
107
|
+
[Dev Launcher] Shutting down Dev Mode server and spawned Storybooks...`
|
|
108
|
+
);
|
|
109
|
+
for (const a of y) a.kill("SIGINT");
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
process.on("SIGINT", w), process.on("SIGTERM", w), v.listen(u, async () => {
|
|
114
|
+
console.log(`
|
|
115
|
+
====================================================
|
|
116
|
+
🚀 Adapter Dev Mode proxy running at:
|
|
117
|
+
http://localhost:${u}
|
|
118
|
+
====================================================
|
|
119
|
+
`);
|
|
120
|
+
const [a, i] = await Promise.all([
|
|
121
|
+
Mt(h),
|
|
122
|
+
Mt($)
|
|
123
|
+
]);
|
|
124
|
+
a ? console.log(
|
|
125
|
+
`[Dev Launcher] ${c.name} is already running on port ${h}.`
|
|
126
|
+
) : y.push(Qt(c.name, s)), i ? console.log(
|
|
127
|
+
`[Dev Launcher] ${b.name} is already running on port ${$}.`
|
|
128
|
+
) : y.push(Qt(b.name, l));
|
|
129
|
+
const r = [];
|
|
130
|
+
a || r.push(Yt(h)), i || r.push(Yt($)), r.length > 0 ? (console.log("[Dev Launcher] Waiting for Storybooks to be responsive..."), (await Promise.all(r)).every(Boolean) ? console.log("[Dev Launcher] All Storybooks are active and responsive!") : console.warn(
|
|
131
|
+
"[Dev Launcher] Warning: some Storybooks timed out during startup, but proceeding..."
|
|
132
|
+
)) : console.log("[Dev Launcher] Both Storybooks already active."), Fn(`http://localhost:${u}`);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function Ln(e) {
|
|
136
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
137
|
+
}
|
|
138
|
+
var Te = { exports: {} }, Pt = {}, me = {}, $e = {}, kt = {}, Nt = {}, Rt = {}, Xt;
|
|
139
|
+
function yt() {
|
|
140
|
+
return Xt || (Xt = 1, (function(e) {
|
|
141
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
|
|
142
|
+
class t {
|
|
143
|
+
}
|
|
144
|
+
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
145
|
+
class m extends t {
|
|
146
|
+
constructor(r) {
|
|
147
|
+
if (super(), !e.IDENTIFIER.test(r))
|
|
148
|
+
throw new Error("CodeGen: name must be a valid identifier");
|
|
149
|
+
this.str = r;
|
|
150
|
+
}
|
|
151
|
+
toString() {
|
|
152
|
+
return this.str;
|
|
153
|
+
}
|
|
154
|
+
emptyStr() {
|
|
155
|
+
return !1;
|
|
156
|
+
}
|
|
157
|
+
get names() {
|
|
158
|
+
return { [this.str]: 1 };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
e.Name = m;
|
|
162
|
+
class c extends t {
|
|
163
|
+
constructor(r) {
|
|
164
|
+
super(), this._items = typeof r == "string" ? [r] : r;
|
|
165
|
+
}
|
|
166
|
+
toString() {
|
|
167
|
+
return this.str;
|
|
168
|
+
}
|
|
169
|
+
emptyStr() {
|
|
170
|
+
if (this._items.length > 1)
|
|
171
|
+
return !1;
|
|
172
|
+
const r = this._items[0];
|
|
173
|
+
return r === "" || r === '""';
|
|
174
|
+
}
|
|
175
|
+
get str() {
|
|
176
|
+
var r;
|
|
177
|
+
return (r = this._str) !== null && r !== void 0 ? r : this._str = this._items.reduce((o, p) => `${o}${p}`, "");
|
|
178
|
+
}
|
|
179
|
+
get names() {
|
|
180
|
+
var r;
|
|
181
|
+
return (r = this._names) !== null && r !== void 0 ? r : this._names = this._items.reduce((o, p) => (p instanceof m && (o[p.str] = (o[p.str] || 0) + 1), o), {});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
e._Code = c, e.nil = new c("");
|
|
185
|
+
function b(i, ...r) {
|
|
186
|
+
const o = [i[0]];
|
|
187
|
+
let p = 0;
|
|
188
|
+
for (; p < r.length; )
|
|
189
|
+
u(o, r[p]), o.push(i[++p]);
|
|
190
|
+
return new c(o);
|
|
191
|
+
}
|
|
192
|
+
e._ = b;
|
|
193
|
+
const s = new c("+");
|
|
194
|
+
function l(i, ...r) {
|
|
195
|
+
const o = [y(i[0])];
|
|
196
|
+
let p = 0;
|
|
197
|
+
for (; p < r.length; )
|
|
198
|
+
o.push(s), u(o, r[p]), o.push(s, y(i[++p]));
|
|
199
|
+
return h(o), new c(o);
|
|
200
|
+
}
|
|
201
|
+
e.str = l;
|
|
202
|
+
function u(i, r) {
|
|
203
|
+
r instanceof c ? i.push(...r._items) : r instanceof m ? i.push(r) : i.push(P(r));
|
|
204
|
+
}
|
|
205
|
+
e.addCodeArg = u;
|
|
206
|
+
function h(i) {
|
|
207
|
+
let r = 1;
|
|
208
|
+
for (; r < i.length - 1; ) {
|
|
209
|
+
if (i[r] === s) {
|
|
210
|
+
const o = $(i[r - 1], i[r + 1]);
|
|
211
|
+
if (o !== void 0) {
|
|
212
|
+
i.splice(r - 1, 3, o);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
i[r++] = "+";
|
|
216
|
+
}
|
|
217
|
+
r++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function $(i, r) {
|
|
221
|
+
if (r === '""')
|
|
222
|
+
return i;
|
|
223
|
+
if (i === '""')
|
|
224
|
+
return r;
|
|
225
|
+
if (typeof i == "string")
|
|
226
|
+
return r instanceof m || i[i.length - 1] !== '"' ? void 0 : typeof r != "string" ? `${i.slice(0, -1)}${r}"` : r[0] === '"' ? i.slice(0, -1) + r.slice(1) : void 0;
|
|
227
|
+
if (typeof r == "string" && r[0] === '"' && !(i instanceof m))
|
|
228
|
+
return `"${i}${r.slice(1)}`;
|
|
229
|
+
}
|
|
230
|
+
function v(i, r) {
|
|
231
|
+
return r.emptyStr() ? i : i.emptyStr() ? r : l`${i}${r}`;
|
|
232
|
+
}
|
|
233
|
+
e.strConcat = v;
|
|
234
|
+
function P(i) {
|
|
235
|
+
return typeof i == "number" || typeof i == "boolean" || i === null ? i : y(Array.isArray(i) ? i.join(",") : i);
|
|
236
|
+
}
|
|
237
|
+
function _(i) {
|
|
238
|
+
return new c(y(i));
|
|
239
|
+
}
|
|
240
|
+
e.stringify = _;
|
|
241
|
+
function y(i) {
|
|
242
|
+
return JSON.stringify(i).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
243
|
+
}
|
|
244
|
+
e.safeStringify = y;
|
|
245
|
+
function g(i) {
|
|
246
|
+
return typeof i == "string" && e.IDENTIFIER.test(i) ? new c(`.${i}`) : b`[${i}]`;
|
|
247
|
+
}
|
|
248
|
+
e.getProperty = g;
|
|
249
|
+
function w(i) {
|
|
250
|
+
if (typeof i == "string" && e.IDENTIFIER.test(i))
|
|
251
|
+
return new c(`${i}`);
|
|
252
|
+
throw new Error(`CodeGen: invalid export name: ${i}, use explicit $id name mapping`);
|
|
253
|
+
}
|
|
254
|
+
e.getEsmExportName = w;
|
|
255
|
+
function a(i) {
|
|
256
|
+
return new c(i.toString());
|
|
257
|
+
}
|
|
258
|
+
e.regexpCode = a;
|
|
259
|
+
})(Rt)), Rt;
|
|
260
|
+
}
|
|
261
|
+
var Ot = {}, xt;
|
|
262
|
+
function er() {
|
|
263
|
+
return xt || (xt = 1, (function(e) {
|
|
264
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
|
|
265
|
+
const t = /* @__PURE__ */ yt();
|
|
266
|
+
class m extends Error {
|
|
267
|
+
constructor($) {
|
|
268
|
+
super(`CodeGen: "code" for ${$} not defined`), this.value = $.value;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
var c;
|
|
272
|
+
(function(h) {
|
|
273
|
+
h[h.Started = 0] = "Started", h[h.Completed = 1] = "Completed";
|
|
274
|
+
})(c || (e.UsedValueState = c = {})), e.varKinds = {
|
|
275
|
+
const: new t.Name("const"),
|
|
276
|
+
let: new t.Name("let"),
|
|
277
|
+
var: new t.Name("var")
|
|
278
|
+
};
|
|
279
|
+
class b {
|
|
280
|
+
constructor({ prefixes: $, parent: v } = {}) {
|
|
281
|
+
this._names = {}, this._prefixes = $, this._parent = v;
|
|
282
|
+
}
|
|
283
|
+
toName($) {
|
|
284
|
+
return $ instanceof t.Name ? $ : this.name($);
|
|
285
|
+
}
|
|
286
|
+
name($) {
|
|
287
|
+
return new t.Name(this._newName($));
|
|
288
|
+
}
|
|
289
|
+
_newName($) {
|
|
290
|
+
const v = this._names[$] || this._nameGroup($);
|
|
291
|
+
return `${$}${v.index++}`;
|
|
292
|
+
}
|
|
293
|
+
_nameGroup($) {
|
|
294
|
+
var v, P;
|
|
295
|
+
if (!((P = (v = this._parent) === null || v === void 0 ? void 0 : v._prefixes) === null || P === void 0) && P.has($) || this._prefixes && !this._prefixes.has($))
|
|
296
|
+
throw new Error(`CodeGen: prefix "${$}" is not allowed in this scope`);
|
|
297
|
+
return this._names[$] = { prefix: $, index: 0 };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
e.Scope = b;
|
|
301
|
+
class s extends t.Name {
|
|
302
|
+
constructor($, v) {
|
|
303
|
+
super(v), this.prefix = $;
|
|
304
|
+
}
|
|
305
|
+
setValue($, { property: v, itemIndex: P }) {
|
|
306
|
+
this.value = $, this.scopePath = (0, t._)`.${new t.Name(v)}[${P}]`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
e.ValueScopeName = s;
|
|
310
|
+
const l = (0, t._)`\n`;
|
|
311
|
+
class u extends b {
|
|
312
|
+
constructor($) {
|
|
313
|
+
super($), this._values = {}, this._scope = $.scope, this.opts = { ...$, _n: $.lines ? l : t.nil };
|
|
314
|
+
}
|
|
315
|
+
get() {
|
|
316
|
+
return this._scope;
|
|
317
|
+
}
|
|
318
|
+
name($) {
|
|
319
|
+
return new s($, this._newName($));
|
|
320
|
+
}
|
|
321
|
+
value($, v) {
|
|
322
|
+
var P;
|
|
323
|
+
if (v.ref === void 0)
|
|
324
|
+
throw new Error("CodeGen: ref must be passed in value");
|
|
325
|
+
const _ = this.toName($), { prefix: y } = _, g = (P = v.key) !== null && P !== void 0 ? P : v.ref;
|
|
326
|
+
let w = this._values[y];
|
|
327
|
+
if (w) {
|
|
328
|
+
const r = w.get(g);
|
|
329
|
+
if (r)
|
|
330
|
+
return r;
|
|
331
|
+
} else
|
|
332
|
+
w = this._values[y] = /* @__PURE__ */ new Map();
|
|
333
|
+
w.set(g, _);
|
|
334
|
+
const a = this._scope[y] || (this._scope[y] = []), i = a.length;
|
|
335
|
+
return a[i] = v.ref, _.setValue(v, { property: y, itemIndex: i }), _;
|
|
336
|
+
}
|
|
337
|
+
getValue($, v) {
|
|
338
|
+
const P = this._values[$];
|
|
339
|
+
if (P)
|
|
340
|
+
return P.get(v);
|
|
341
|
+
}
|
|
342
|
+
scopeRefs($, v = this._values) {
|
|
343
|
+
return this._reduceValues(v, (P) => {
|
|
344
|
+
if (P.scopePath === void 0)
|
|
345
|
+
throw new Error(`CodeGen: name "${P}" has no value`);
|
|
346
|
+
return (0, t._)`${$}${P.scopePath}`;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
scopeCode($ = this._values, v, P) {
|
|
350
|
+
return this._reduceValues($, (_) => {
|
|
351
|
+
if (_.value === void 0)
|
|
352
|
+
throw new Error(`CodeGen: name "${_}" has no value`);
|
|
353
|
+
return _.value.code;
|
|
354
|
+
}, v, P);
|
|
355
|
+
}
|
|
356
|
+
_reduceValues($, v, P = {}, _) {
|
|
357
|
+
let y = t.nil;
|
|
358
|
+
for (const g in $) {
|
|
359
|
+
const w = $[g];
|
|
360
|
+
if (!w)
|
|
361
|
+
continue;
|
|
362
|
+
const a = P[g] = P[g] || /* @__PURE__ */ new Map();
|
|
363
|
+
w.forEach((i) => {
|
|
364
|
+
if (a.has(i))
|
|
365
|
+
return;
|
|
366
|
+
a.set(i, c.Started);
|
|
367
|
+
let r = v(i);
|
|
368
|
+
if (r) {
|
|
369
|
+
const o = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
370
|
+
y = (0, t._)`${y}${o} ${i} = ${r};${this.opts._n}`;
|
|
371
|
+
} else if (r = _ == null ? void 0 : _(i))
|
|
372
|
+
y = (0, t._)`${y}${r}${this.opts._n}`;
|
|
373
|
+
else
|
|
374
|
+
throw new m(i);
|
|
375
|
+
a.set(i, c.Completed);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
return y;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
e.ValueScope = u;
|
|
382
|
+
})(Ot)), Ot;
|
|
383
|
+
}
|
|
384
|
+
var tr;
|
|
385
|
+
function H() {
|
|
386
|
+
return tr || (tr = 1, (function(e) {
|
|
387
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0;
|
|
388
|
+
const t = /* @__PURE__ */ yt(), m = /* @__PURE__ */ er();
|
|
389
|
+
var c = /* @__PURE__ */ yt();
|
|
390
|
+
Object.defineProperty(e, "_", { enumerable: !0, get: function() {
|
|
391
|
+
return c._;
|
|
392
|
+
} }), Object.defineProperty(e, "str", { enumerable: !0, get: function() {
|
|
393
|
+
return c.str;
|
|
394
|
+
} }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() {
|
|
395
|
+
return c.strConcat;
|
|
396
|
+
} }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() {
|
|
397
|
+
return c.nil;
|
|
398
|
+
} }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() {
|
|
399
|
+
return c.getProperty;
|
|
400
|
+
} }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() {
|
|
401
|
+
return c.stringify;
|
|
402
|
+
} }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() {
|
|
403
|
+
return c.regexpCode;
|
|
404
|
+
} }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() {
|
|
405
|
+
return c.Name;
|
|
406
|
+
} });
|
|
407
|
+
var b = /* @__PURE__ */ er();
|
|
408
|
+
Object.defineProperty(e, "Scope", { enumerable: !0, get: function() {
|
|
409
|
+
return b.Scope;
|
|
410
|
+
} }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() {
|
|
411
|
+
return b.ValueScope;
|
|
412
|
+
} }), Object.defineProperty(e, "ValueScopeName", { enumerable: !0, get: function() {
|
|
413
|
+
return b.ValueScopeName;
|
|
414
|
+
} }), Object.defineProperty(e, "varKinds", { enumerable: !0, get: function() {
|
|
415
|
+
return b.varKinds;
|
|
416
|
+
} }), e.operators = {
|
|
417
|
+
GT: new t._Code(">"),
|
|
418
|
+
GTE: new t._Code(">="),
|
|
419
|
+
LT: new t._Code("<"),
|
|
420
|
+
LTE: new t._Code("<="),
|
|
421
|
+
EQ: new t._Code("==="),
|
|
422
|
+
NEQ: new t._Code("!=="),
|
|
423
|
+
NOT: new t._Code("!"),
|
|
424
|
+
OR: new t._Code("||"),
|
|
425
|
+
AND: new t._Code("&&"),
|
|
426
|
+
ADD: new t._Code("+")
|
|
427
|
+
};
|
|
428
|
+
class s {
|
|
429
|
+
optimizeNodes() {
|
|
430
|
+
return this;
|
|
431
|
+
}
|
|
432
|
+
optimizeNames(d, E) {
|
|
433
|
+
return this;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
class l extends s {
|
|
437
|
+
constructor(d, E, I) {
|
|
438
|
+
super(), this.varKind = d, this.name = E, this.rhs = I;
|
|
439
|
+
}
|
|
440
|
+
render({ es5: d, _n: E }) {
|
|
441
|
+
const I = d ? m.varKinds.var : this.varKind, F = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
442
|
+
return `${I} ${this.name}${F};` + E;
|
|
443
|
+
}
|
|
444
|
+
optimizeNames(d, E) {
|
|
445
|
+
if (d[this.name.str])
|
|
446
|
+
return this.rhs && (this.rhs = J(this.rhs, d, E)), this;
|
|
447
|
+
}
|
|
448
|
+
get names() {
|
|
449
|
+
return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
class u extends s {
|
|
453
|
+
constructor(d, E, I) {
|
|
454
|
+
super(), this.lhs = d, this.rhs = E, this.sideEffects = I;
|
|
455
|
+
}
|
|
456
|
+
render({ _n: d }) {
|
|
457
|
+
return `${this.lhs} = ${this.rhs};` + d;
|
|
458
|
+
}
|
|
459
|
+
optimizeNames(d, E) {
|
|
460
|
+
if (!(this.lhs instanceof t.Name && !d[this.lhs.str] && !this.sideEffects))
|
|
461
|
+
return this.rhs = J(this.rhs, d, E), this;
|
|
462
|
+
}
|
|
463
|
+
get names() {
|
|
464
|
+
const d = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
|
|
465
|
+
return U(d, this.rhs);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
class h extends u {
|
|
469
|
+
constructor(d, E, I, F) {
|
|
470
|
+
super(d, I, F), this.op = E;
|
|
471
|
+
}
|
|
472
|
+
render({ _n: d }) {
|
|
473
|
+
return `${this.lhs} ${this.op}= ${this.rhs};` + d;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
class $ extends s {
|
|
477
|
+
constructor(d) {
|
|
478
|
+
super(), this.label = d, this.names = {};
|
|
479
|
+
}
|
|
480
|
+
render({ _n: d }) {
|
|
481
|
+
return `${this.label}:` + d;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
class v extends s {
|
|
485
|
+
constructor(d) {
|
|
486
|
+
super(), this.label = d, this.names = {};
|
|
487
|
+
}
|
|
488
|
+
render({ _n: d }) {
|
|
489
|
+
return `break${this.label ? ` ${this.label}` : ""};` + d;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
class P extends s {
|
|
493
|
+
constructor(d) {
|
|
494
|
+
super(), this.error = d;
|
|
495
|
+
}
|
|
496
|
+
render({ _n: d }) {
|
|
497
|
+
return `throw ${this.error};` + d;
|
|
498
|
+
}
|
|
499
|
+
get names() {
|
|
500
|
+
return this.error.names;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
class _ extends s {
|
|
504
|
+
constructor(d) {
|
|
505
|
+
super(), this.code = d;
|
|
506
|
+
}
|
|
507
|
+
render({ _n: d }) {
|
|
508
|
+
return `${this.code};` + d;
|
|
509
|
+
}
|
|
510
|
+
optimizeNodes() {
|
|
511
|
+
return `${this.code}` ? this : void 0;
|
|
512
|
+
}
|
|
513
|
+
optimizeNames(d, E) {
|
|
514
|
+
return this.code = J(this.code, d, E), this;
|
|
515
|
+
}
|
|
516
|
+
get names() {
|
|
517
|
+
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
class y extends s {
|
|
521
|
+
constructor(d = []) {
|
|
522
|
+
super(), this.nodes = d;
|
|
523
|
+
}
|
|
524
|
+
render(d) {
|
|
525
|
+
return this.nodes.reduce((E, I) => E + I.render(d), "");
|
|
526
|
+
}
|
|
527
|
+
optimizeNodes() {
|
|
528
|
+
const { nodes: d } = this;
|
|
529
|
+
let E = d.length;
|
|
530
|
+
for (; E--; ) {
|
|
531
|
+
const I = d[E].optimizeNodes();
|
|
532
|
+
Array.isArray(I) ? d.splice(E, 1, ...I) : I ? d[E] = I : d.splice(E, 1);
|
|
533
|
+
}
|
|
534
|
+
return d.length > 0 ? this : void 0;
|
|
535
|
+
}
|
|
536
|
+
optimizeNames(d, E) {
|
|
537
|
+
const { nodes: I } = this;
|
|
538
|
+
let F = I.length;
|
|
539
|
+
for (; F--; ) {
|
|
540
|
+
const K = I[F];
|
|
541
|
+
K.optimizeNames(d, E) || (x(d, K.names), I.splice(F, 1));
|
|
542
|
+
}
|
|
543
|
+
return I.length > 0 ? this : void 0;
|
|
544
|
+
}
|
|
545
|
+
get names() {
|
|
546
|
+
return this.nodes.reduce((d, E) => V(d, E.names), {});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
class g extends y {
|
|
550
|
+
render(d) {
|
|
551
|
+
return "{" + d._n + super.render(d) + "}" + d._n;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
class w extends y {
|
|
555
|
+
}
|
|
556
|
+
class a extends g {
|
|
557
|
+
}
|
|
558
|
+
a.kind = "else";
|
|
559
|
+
class i extends g {
|
|
560
|
+
constructor(d, E) {
|
|
561
|
+
super(E), this.condition = d;
|
|
562
|
+
}
|
|
563
|
+
render(d) {
|
|
564
|
+
let E = `if(${this.condition})` + super.render(d);
|
|
565
|
+
return this.else && (E += "else " + this.else.render(d)), E;
|
|
566
|
+
}
|
|
567
|
+
optimizeNodes() {
|
|
568
|
+
super.optimizeNodes();
|
|
569
|
+
const d = this.condition;
|
|
570
|
+
if (d === !0)
|
|
571
|
+
return this.nodes;
|
|
572
|
+
let E = this.else;
|
|
573
|
+
if (E) {
|
|
574
|
+
const I = E.optimizeNodes();
|
|
575
|
+
E = this.else = Array.isArray(I) ? new a(I) : I;
|
|
576
|
+
}
|
|
577
|
+
if (E)
|
|
578
|
+
return d === !1 ? E instanceof i ? E : E.nodes : this.nodes.length ? this : new i(fe(d), E instanceof i ? [E] : E.nodes);
|
|
579
|
+
if (!(d === !1 || !this.nodes.length))
|
|
580
|
+
return this;
|
|
581
|
+
}
|
|
582
|
+
optimizeNames(d, E) {
|
|
583
|
+
var I;
|
|
584
|
+
if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(d, E), !!(super.optimizeNames(d, E) || this.else))
|
|
585
|
+
return this.condition = J(this.condition, d, E), this;
|
|
586
|
+
}
|
|
587
|
+
get names() {
|
|
588
|
+
const d = super.names;
|
|
589
|
+
return U(d, this.condition), this.else && V(d, this.else.names), d;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
i.kind = "if";
|
|
593
|
+
class r extends g {
|
|
594
|
+
}
|
|
595
|
+
r.kind = "for";
|
|
596
|
+
class o extends r {
|
|
597
|
+
constructor(d) {
|
|
598
|
+
super(), this.iteration = d;
|
|
599
|
+
}
|
|
600
|
+
render(d) {
|
|
601
|
+
return `for(${this.iteration})` + super.render(d);
|
|
602
|
+
}
|
|
603
|
+
optimizeNames(d, E) {
|
|
604
|
+
if (super.optimizeNames(d, E))
|
|
605
|
+
return this.iteration = J(this.iteration, d, E), this;
|
|
606
|
+
}
|
|
607
|
+
get names() {
|
|
608
|
+
return V(super.names, this.iteration.names);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
class p extends r {
|
|
612
|
+
constructor(d, E, I, F) {
|
|
613
|
+
super(), this.varKind = d, this.name = E, this.from = I, this.to = F;
|
|
614
|
+
}
|
|
615
|
+
render(d) {
|
|
616
|
+
const E = d.es5 ? m.varKinds.var : this.varKind, { name: I, from: F, to: K } = this;
|
|
617
|
+
return `for(${E} ${I}=${F}; ${I}<${K}; ${I}++)` + super.render(d);
|
|
618
|
+
}
|
|
619
|
+
get names() {
|
|
620
|
+
const d = U(super.names, this.from);
|
|
621
|
+
return U(d, this.to);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
class n extends r {
|
|
625
|
+
constructor(d, E, I, F) {
|
|
626
|
+
super(), this.loop = d, this.varKind = E, this.name = I, this.iterable = F;
|
|
627
|
+
}
|
|
628
|
+
render(d) {
|
|
629
|
+
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(d);
|
|
630
|
+
}
|
|
631
|
+
optimizeNames(d, E) {
|
|
632
|
+
if (super.optimizeNames(d, E))
|
|
633
|
+
return this.iterable = J(this.iterable, d, E), this;
|
|
634
|
+
}
|
|
635
|
+
get names() {
|
|
636
|
+
return V(super.names, this.iterable.names);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
class f extends g {
|
|
640
|
+
constructor(d, E, I) {
|
|
641
|
+
super(), this.name = d, this.args = E, this.async = I;
|
|
642
|
+
}
|
|
643
|
+
render(d) {
|
|
644
|
+
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(d);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
f.kind = "func";
|
|
648
|
+
class S extends y {
|
|
649
|
+
render(d) {
|
|
650
|
+
return "return " + super.render(d);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
S.kind = "return";
|
|
654
|
+
class T extends g {
|
|
655
|
+
render(d) {
|
|
656
|
+
let E = "try" + super.render(d);
|
|
657
|
+
return this.catch && (E += this.catch.render(d)), this.finally && (E += this.finally.render(d)), E;
|
|
658
|
+
}
|
|
659
|
+
optimizeNodes() {
|
|
660
|
+
var d, E;
|
|
661
|
+
return super.optimizeNodes(), (d = this.catch) === null || d === void 0 || d.optimizeNodes(), (E = this.finally) === null || E === void 0 || E.optimizeNodes(), this;
|
|
662
|
+
}
|
|
663
|
+
optimizeNames(d, E) {
|
|
664
|
+
var I, F;
|
|
665
|
+
return super.optimizeNames(d, E), (I = this.catch) === null || I === void 0 || I.optimizeNames(d, E), (F = this.finally) === null || F === void 0 || F.optimizeNames(d, E), this;
|
|
666
|
+
}
|
|
667
|
+
get names() {
|
|
668
|
+
const d = super.names;
|
|
669
|
+
return this.catch && V(d, this.catch.names), this.finally && V(d, this.finally.names), d;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
class j extends g {
|
|
673
|
+
constructor(d) {
|
|
674
|
+
super(), this.error = d;
|
|
675
|
+
}
|
|
676
|
+
render(d) {
|
|
677
|
+
return `catch(${this.error})` + super.render(d);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
j.kind = "catch";
|
|
681
|
+
class D extends g {
|
|
682
|
+
render(d) {
|
|
683
|
+
return "finally" + super.render(d);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
D.kind = "finally";
|
|
687
|
+
class z {
|
|
688
|
+
constructor(d, E = {}) {
|
|
689
|
+
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...E, _n: E.lines ? `
|
|
690
|
+
` : "" }, this._extScope = d, this._scope = new m.Scope({ parent: d }), this._nodes = [new w()];
|
|
691
|
+
}
|
|
692
|
+
toString() {
|
|
693
|
+
return this._root.render(this.opts);
|
|
694
|
+
}
|
|
695
|
+
// returns unique name in the internal scope
|
|
696
|
+
name(d) {
|
|
697
|
+
return this._scope.name(d);
|
|
698
|
+
}
|
|
699
|
+
// reserves unique name in the external scope
|
|
700
|
+
scopeName(d) {
|
|
701
|
+
return this._extScope.name(d);
|
|
702
|
+
}
|
|
703
|
+
// reserves unique name in the external scope and assigns value to it
|
|
704
|
+
scopeValue(d, E) {
|
|
705
|
+
const I = this._extScope.value(d, E);
|
|
706
|
+
return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I;
|
|
707
|
+
}
|
|
708
|
+
getScopeValue(d, E) {
|
|
709
|
+
return this._extScope.getValue(d, E);
|
|
710
|
+
}
|
|
711
|
+
// return code that assigns values in the external scope to the names that are used internally
|
|
712
|
+
// (same names that were returned by gen.scopeName or gen.scopeValue)
|
|
713
|
+
scopeRefs(d) {
|
|
714
|
+
return this._extScope.scopeRefs(d, this._values);
|
|
715
|
+
}
|
|
716
|
+
scopeCode() {
|
|
717
|
+
return this._extScope.scopeCode(this._values);
|
|
718
|
+
}
|
|
719
|
+
_def(d, E, I, F) {
|
|
720
|
+
const K = this._scope.toName(E);
|
|
721
|
+
return I !== void 0 && F && (this._constants[K.str] = I), this._leafNode(new l(d, K, I)), K;
|
|
722
|
+
}
|
|
723
|
+
// `const` declaration (`var` in es5 mode)
|
|
724
|
+
const(d, E, I) {
|
|
725
|
+
return this._def(m.varKinds.const, d, E, I);
|
|
726
|
+
}
|
|
727
|
+
// `let` declaration with optional assignment (`var` in es5 mode)
|
|
728
|
+
let(d, E, I) {
|
|
729
|
+
return this._def(m.varKinds.let, d, E, I);
|
|
730
|
+
}
|
|
731
|
+
// `var` declaration with optional assignment
|
|
732
|
+
var(d, E, I) {
|
|
733
|
+
return this._def(m.varKinds.var, d, E, I);
|
|
734
|
+
}
|
|
735
|
+
// assignment code
|
|
736
|
+
assign(d, E, I) {
|
|
737
|
+
return this._leafNode(new u(d, E, I));
|
|
738
|
+
}
|
|
739
|
+
// `+=` code
|
|
740
|
+
add(d, E) {
|
|
741
|
+
return this._leafNode(new h(d, e.operators.ADD, E));
|
|
742
|
+
}
|
|
743
|
+
// appends passed SafeExpr to code or executes Block
|
|
744
|
+
code(d) {
|
|
745
|
+
return typeof d == "function" ? d() : d !== t.nil && this._leafNode(new _(d)), this;
|
|
746
|
+
}
|
|
747
|
+
// returns code for object literal for the passed argument list of key-value pairs
|
|
748
|
+
object(...d) {
|
|
749
|
+
const E = ["{"];
|
|
750
|
+
for (const [I, F] of d)
|
|
751
|
+
E.length > 1 && E.push(","), E.push(I), (I !== F || this.opts.es5) && (E.push(":"), (0, t.addCodeArg)(E, F));
|
|
752
|
+
return E.push("}"), new t._Code(E);
|
|
753
|
+
}
|
|
754
|
+
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
755
|
+
if(d, E, I) {
|
|
756
|
+
if (this._blockNode(new i(d)), E && I)
|
|
757
|
+
this.code(E).else().code(I).endIf();
|
|
758
|
+
else if (E)
|
|
759
|
+
this.code(E).endIf();
|
|
760
|
+
else if (I)
|
|
761
|
+
throw new Error('CodeGen: "else" body without "then" body');
|
|
762
|
+
return this;
|
|
763
|
+
}
|
|
764
|
+
// `else if` clause - invalid without `if` or after `else` clauses
|
|
765
|
+
elseIf(d) {
|
|
766
|
+
return this._elseNode(new i(d));
|
|
767
|
+
}
|
|
768
|
+
// `else` clause - only valid after `if` or `else if` clauses
|
|
769
|
+
else() {
|
|
770
|
+
return this._elseNode(new a());
|
|
771
|
+
}
|
|
772
|
+
// end `if` statement (needed if gen.if was used only with condition)
|
|
773
|
+
endIf() {
|
|
774
|
+
return this._endBlockNode(i, a);
|
|
775
|
+
}
|
|
776
|
+
_for(d, E) {
|
|
777
|
+
return this._blockNode(d), E && this.code(E).endFor(), this;
|
|
778
|
+
}
|
|
779
|
+
// a generic `for` clause (or statement if `forBody` is passed)
|
|
780
|
+
for(d, E) {
|
|
781
|
+
return this._for(new o(d), E);
|
|
782
|
+
}
|
|
783
|
+
// `for` statement for a range of values
|
|
784
|
+
forRange(d, E, I, F, K = this.opts.es5 ? m.varKinds.var : m.varKinds.let) {
|
|
785
|
+
const Z = this._scope.toName(d);
|
|
786
|
+
return this._for(new p(K, Z, E, I), () => F(Z));
|
|
787
|
+
}
|
|
788
|
+
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
789
|
+
forOf(d, E, I, F = m.varKinds.const) {
|
|
790
|
+
const K = this._scope.toName(d);
|
|
791
|
+
if (this.opts.es5) {
|
|
792
|
+
const Z = E instanceof t.Name ? E : this.var("_arr", E);
|
|
793
|
+
return this.forRange("_i", 0, (0, t._)`${Z}.length`, (B) => {
|
|
794
|
+
this.var(K, (0, t._)`${Z}[${B}]`), I(K);
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
return this._for(new n("of", F, K, E), () => I(K));
|
|
798
|
+
}
|
|
799
|
+
// `for-in` statement.
|
|
800
|
+
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
801
|
+
forIn(d, E, I, F = this.opts.es5 ? m.varKinds.var : m.varKinds.const) {
|
|
802
|
+
if (this.opts.ownProperties)
|
|
803
|
+
return this.forOf(d, (0, t._)`Object.keys(${E})`, I);
|
|
804
|
+
const K = this._scope.toName(d);
|
|
805
|
+
return this._for(new n("in", F, K, E), () => I(K));
|
|
806
|
+
}
|
|
807
|
+
// end `for` loop
|
|
808
|
+
endFor() {
|
|
809
|
+
return this._endBlockNode(r);
|
|
810
|
+
}
|
|
811
|
+
// `label` statement
|
|
812
|
+
label(d) {
|
|
813
|
+
return this._leafNode(new $(d));
|
|
814
|
+
}
|
|
815
|
+
// `break` statement
|
|
816
|
+
break(d) {
|
|
817
|
+
return this._leafNode(new v(d));
|
|
818
|
+
}
|
|
819
|
+
// `return` statement
|
|
820
|
+
return(d) {
|
|
821
|
+
const E = new S();
|
|
822
|
+
if (this._blockNode(E), this.code(d), E.nodes.length !== 1)
|
|
823
|
+
throw new Error('CodeGen: "return" should have one node');
|
|
824
|
+
return this._endBlockNode(S);
|
|
825
|
+
}
|
|
826
|
+
// `try` statement
|
|
827
|
+
try(d, E, I) {
|
|
828
|
+
if (!E && !I)
|
|
829
|
+
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
830
|
+
const F = new T();
|
|
831
|
+
if (this._blockNode(F), this.code(d), E) {
|
|
832
|
+
const K = this.name("e");
|
|
833
|
+
this._currNode = F.catch = new j(K), E(K);
|
|
834
|
+
}
|
|
835
|
+
return I && (this._currNode = F.finally = new D(), this.code(I)), this._endBlockNode(j, D);
|
|
836
|
+
}
|
|
837
|
+
// `throw` statement
|
|
838
|
+
throw(d) {
|
|
839
|
+
return this._leafNode(new P(d));
|
|
840
|
+
}
|
|
841
|
+
// start self-balancing block
|
|
842
|
+
block(d, E) {
|
|
843
|
+
return this._blockStarts.push(this._nodes.length), d && this.code(d).endBlock(E), this;
|
|
844
|
+
}
|
|
845
|
+
// end the current self-balancing block
|
|
846
|
+
endBlock(d) {
|
|
847
|
+
const E = this._blockStarts.pop();
|
|
848
|
+
if (E === void 0)
|
|
849
|
+
throw new Error("CodeGen: not in self-balancing block");
|
|
850
|
+
const I = this._nodes.length - E;
|
|
851
|
+
if (I < 0 || d !== void 0 && I !== d)
|
|
852
|
+
throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${d} expected`);
|
|
853
|
+
return this._nodes.length = E, this;
|
|
854
|
+
}
|
|
855
|
+
// `function` heading (or definition if funcBody is passed)
|
|
856
|
+
func(d, E = t.nil, I, F) {
|
|
857
|
+
return this._blockNode(new f(d, E, I)), F && this.code(F).endFunc(), this;
|
|
858
|
+
}
|
|
859
|
+
// end function definition
|
|
860
|
+
endFunc() {
|
|
861
|
+
return this._endBlockNode(f);
|
|
862
|
+
}
|
|
863
|
+
optimize(d = 1) {
|
|
864
|
+
for (; d-- > 0; )
|
|
865
|
+
this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants);
|
|
866
|
+
}
|
|
867
|
+
_leafNode(d) {
|
|
868
|
+
return this._currNode.nodes.push(d), this;
|
|
869
|
+
}
|
|
870
|
+
_blockNode(d) {
|
|
871
|
+
this._currNode.nodes.push(d), this._nodes.push(d);
|
|
872
|
+
}
|
|
873
|
+
_endBlockNode(d, E) {
|
|
874
|
+
const I = this._currNode;
|
|
875
|
+
if (I instanceof d || E && I instanceof E)
|
|
876
|
+
return this._nodes.pop(), this;
|
|
877
|
+
throw new Error(`CodeGen: not in block "${E ? `${d.kind}/${E.kind}` : d.kind}"`);
|
|
878
|
+
}
|
|
879
|
+
_elseNode(d) {
|
|
880
|
+
const E = this._currNode;
|
|
881
|
+
if (!(E instanceof i))
|
|
882
|
+
throw new Error('CodeGen: "else" without "if"');
|
|
883
|
+
return this._currNode = E.else = d, this;
|
|
884
|
+
}
|
|
885
|
+
get _root() {
|
|
886
|
+
return this._nodes[0];
|
|
887
|
+
}
|
|
888
|
+
get _currNode() {
|
|
889
|
+
const d = this._nodes;
|
|
890
|
+
return d[d.length - 1];
|
|
891
|
+
}
|
|
892
|
+
set _currNode(d) {
|
|
893
|
+
const E = this._nodes;
|
|
894
|
+
E[E.length - 1] = d;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
e.CodeGen = z;
|
|
898
|
+
function V(O, d) {
|
|
899
|
+
for (const E in d)
|
|
900
|
+
O[E] = (O[E] || 0) + (d[E] || 0);
|
|
901
|
+
return O;
|
|
902
|
+
}
|
|
903
|
+
function U(O, d) {
|
|
904
|
+
return d instanceof t._CodeOrName ? V(O, d.names) : O;
|
|
905
|
+
}
|
|
906
|
+
function J(O, d, E) {
|
|
907
|
+
if (O instanceof t.Name)
|
|
908
|
+
return I(O);
|
|
909
|
+
if (!F(O))
|
|
910
|
+
return O;
|
|
911
|
+
return new t._Code(O._items.reduce((K, Z) => (Z instanceof t.Name && (Z = I(Z)), Z instanceof t._Code ? K.push(...Z._items) : K.push(Z), K), []));
|
|
912
|
+
function I(K) {
|
|
913
|
+
const Z = E[K.str];
|
|
914
|
+
return Z === void 0 || d[K.str] !== 1 ? K : (delete d[K.str], Z);
|
|
915
|
+
}
|
|
916
|
+
function F(K) {
|
|
917
|
+
return K instanceof t._Code && K._items.some((Z) => Z instanceof t.Name && d[Z.str] === 1 && E[Z.str] !== void 0);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function x(O, d) {
|
|
921
|
+
for (const E in d)
|
|
922
|
+
O[E] = (O[E] || 0) - (d[E] || 0);
|
|
923
|
+
}
|
|
924
|
+
function fe(O) {
|
|
925
|
+
return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${C(O)}`;
|
|
926
|
+
}
|
|
927
|
+
e.not = fe;
|
|
928
|
+
const he = N(e.operators.AND);
|
|
929
|
+
function X(...O) {
|
|
930
|
+
return O.reduce(he);
|
|
931
|
+
}
|
|
932
|
+
e.and = X;
|
|
933
|
+
const ge = N(e.operators.OR);
|
|
934
|
+
function A(...O) {
|
|
935
|
+
return O.reduce(ge);
|
|
936
|
+
}
|
|
937
|
+
e.or = A;
|
|
938
|
+
function N(O) {
|
|
939
|
+
return (d, E) => d === t.nil ? E : E === t.nil ? d : (0, t._)`${C(d)} ${O} ${C(E)}`;
|
|
940
|
+
}
|
|
941
|
+
function C(O) {
|
|
942
|
+
return O instanceof t.Name ? O : (0, t._)`(${O})`;
|
|
943
|
+
}
|
|
944
|
+
})(Nt)), Nt;
|
|
945
|
+
}
|
|
946
|
+
var G = {}, rr;
|
|
947
|
+
function Y() {
|
|
948
|
+
if (rr) return G;
|
|
949
|
+
rr = 1, Object.defineProperty(G, "__esModule", { value: !0 }), G.checkStrictMode = G.getErrorPath = G.Type = G.useFunc = G.setEvaluated = G.evaluatedPropsToName = G.mergeEvaluated = G.eachItem = G.unescapeJsonPointer = G.escapeJsonPointer = G.escapeFragment = G.unescapeFragment = G.schemaRefOrVal = G.schemaHasRulesButRef = G.schemaHasRules = G.checkUnknownRules = G.alwaysValidSchema = G.toHash = void 0;
|
|
950
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ yt();
|
|
951
|
+
function m(n) {
|
|
952
|
+
const f = {};
|
|
953
|
+
for (const S of n)
|
|
954
|
+
f[S] = !0;
|
|
955
|
+
return f;
|
|
956
|
+
}
|
|
957
|
+
G.toHash = m;
|
|
958
|
+
function c(n, f) {
|
|
959
|
+
return typeof f == "boolean" ? f : Object.keys(f).length === 0 ? !0 : (b(n, f), !s(f, n.self.RULES.all));
|
|
960
|
+
}
|
|
961
|
+
G.alwaysValidSchema = c;
|
|
962
|
+
function b(n, f = n.schema) {
|
|
963
|
+
const { opts: S, self: T } = n;
|
|
964
|
+
if (!S.strictSchema || typeof f == "boolean")
|
|
965
|
+
return;
|
|
966
|
+
const j = T.RULES.keywords;
|
|
967
|
+
for (const D in f)
|
|
968
|
+
j[D] || p(n, `unknown keyword: "${D}"`);
|
|
969
|
+
}
|
|
970
|
+
G.checkUnknownRules = b;
|
|
971
|
+
function s(n, f) {
|
|
972
|
+
if (typeof n == "boolean")
|
|
973
|
+
return !n;
|
|
974
|
+
for (const S in n)
|
|
975
|
+
if (f[S])
|
|
976
|
+
return !0;
|
|
977
|
+
return !1;
|
|
978
|
+
}
|
|
979
|
+
G.schemaHasRules = s;
|
|
980
|
+
function l(n, f) {
|
|
981
|
+
if (typeof n == "boolean")
|
|
982
|
+
return !n;
|
|
983
|
+
for (const S in n)
|
|
984
|
+
if (S !== "$ref" && f.all[S])
|
|
985
|
+
return !0;
|
|
986
|
+
return !1;
|
|
987
|
+
}
|
|
988
|
+
G.schemaHasRulesButRef = l;
|
|
989
|
+
function u({ topSchemaRef: n, schemaPath: f }, S, T, j) {
|
|
990
|
+
if (!j) {
|
|
991
|
+
if (typeof S == "number" || typeof S == "boolean")
|
|
992
|
+
return S;
|
|
993
|
+
if (typeof S == "string")
|
|
994
|
+
return (0, e._)`${S}`;
|
|
995
|
+
}
|
|
996
|
+
return (0, e._)`${n}${f}${(0, e.getProperty)(T)}`;
|
|
997
|
+
}
|
|
998
|
+
G.schemaRefOrVal = u;
|
|
999
|
+
function h(n) {
|
|
1000
|
+
return P(decodeURIComponent(n));
|
|
1001
|
+
}
|
|
1002
|
+
G.unescapeFragment = h;
|
|
1003
|
+
function $(n) {
|
|
1004
|
+
return encodeURIComponent(v(n));
|
|
1005
|
+
}
|
|
1006
|
+
G.escapeFragment = $;
|
|
1007
|
+
function v(n) {
|
|
1008
|
+
return typeof n == "number" ? `${n}` : n.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1009
|
+
}
|
|
1010
|
+
G.escapeJsonPointer = v;
|
|
1011
|
+
function P(n) {
|
|
1012
|
+
return n.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
1013
|
+
}
|
|
1014
|
+
G.unescapeJsonPointer = P;
|
|
1015
|
+
function _(n, f) {
|
|
1016
|
+
if (Array.isArray(n))
|
|
1017
|
+
for (const S of n)
|
|
1018
|
+
f(S);
|
|
1019
|
+
else
|
|
1020
|
+
f(n);
|
|
1021
|
+
}
|
|
1022
|
+
G.eachItem = _;
|
|
1023
|
+
function y({ mergeNames: n, mergeToName: f, mergeValues: S, resultToName: T }) {
|
|
1024
|
+
return (j, D, z, V) => {
|
|
1025
|
+
const U = z === void 0 ? D : z instanceof e.Name ? (D instanceof e.Name ? n(j, D, z) : f(j, D, z), z) : D instanceof e.Name ? (f(j, z, D), D) : S(D, z);
|
|
1026
|
+
return V === e.Name && !(U instanceof e.Name) ? T(j, U) : U;
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
G.mergeEvaluated = {
|
|
1030
|
+
props: y({
|
|
1031
|
+
mergeNames: (n, f, S) => n.if((0, e._)`${S} !== true && ${f} !== undefined`, () => {
|
|
1032
|
+
n.if((0, e._)`${f} === true`, () => n.assign(S, !0), () => n.assign(S, (0, e._)`${S} || {}`).code((0, e._)`Object.assign(${S}, ${f})`));
|
|
1033
|
+
}),
|
|
1034
|
+
mergeToName: (n, f, S) => n.if((0, e._)`${S} !== true`, () => {
|
|
1035
|
+
f === !0 ? n.assign(S, !0) : (n.assign(S, (0, e._)`${S} || {}`), w(n, S, f));
|
|
1036
|
+
}),
|
|
1037
|
+
mergeValues: (n, f) => n === !0 ? !0 : { ...n, ...f },
|
|
1038
|
+
resultToName: g
|
|
1039
|
+
}),
|
|
1040
|
+
items: y({
|
|
1041
|
+
mergeNames: (n, f, S) => n.if((0, e._)`${S} !== true && ${f} !== undefined`, () => n.assign(S, (0, e._)`${f} === true ? true : ${S} > ${f} ? ${S} : ${f}`)),
|
|
1042
|
+
mergeToName: (n, f, S) => n.if((0, e._)`${S} !== true`, () => n.assign(S, f === !0 ? !0 : (0, e._)`${S} > ${f} ? ${S} : ${f}`)),
|
|
1043
|
+
mergeValues: (n, f) => n === !0 ? !0 : Math.max(n, f),
|
|
1044
|
+
resultToName: (n, f) => n.var("items", f)
|
|
1045
|
+
})
|
|
1046
|
+
};
|
|
1047
|
+
function g(n, f) {
|
|
1048
|
+
if (f === !0)
|
|
1049
|
+
return n.var("props", !0);
|
|
1050
|
+
const S = n.var("props", (0, e._)`{}`);
|
|
1051
|
+
return f !== void 0 && w(n, S, f), S;
|
|
1052
|
+
}
|
|
1053
|
+
G.evaluatedPropsToName = g;
|
|
1054
|
+
function w(n, f, S) {
|
|
1055
|
+
Object.keys(S).forEach((T) => n.assign((0, e._)`${f}${(0, e.getProperty)(T)}`, !0));
|
|
1056
|
+
}
|
|
1057
|
+
G.setEvaluated = w;
|
|
1058
|
+
const a = {};
|
|
1059
|
+
function i(n, f) {
|
|
1060
|
+
return n.scopeValue("func", {
|
|
1061
|
+
ref: f,
|
|
1062
|
+
code: a[f.code] || (a[f.code] = new t._Code(f.code))
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
G.useFunc = i;
|
|
1066
|
+
var r;
|
|
1067
|
+
(function(n) {
|
|
1068
|
+
n[n.Num = 0] = "Num", n[n.Str = 1] = "Str";
|
|
1069
|
+
})(r || (G.Type = r = {}));
|
|
1070
|
+
function o(n, f, S) {
|
|
1071
|
+
if (n instanceof e.Name) {
|
|
1072
|
+
const T = f === r.Num;
|
|
1073
|
+
return S ? T ? (0, e._)`"[" + ${n} + "]"` : (0, e._)`"['" + ${n} + "']"` : T ? (0, e._)`"/" + ${n}` : (0, e._)`"/" + ${n}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
1074
|
+
}
|
|
1075
|
+
return S ? (0, e.getProperty)(n).toString() : "/" + v(n);
|
|
1076
|
+
}
|
|
1077
|
+
G.getErrorPath = o;
|
|
1078
|
+
function p(n, f, S = n.opts.strictSchema) {
|
|
1079
|
+
if (S) {
|
|
1080
|
+
if (f = `strict mode: ${f}`, S === !0)
|
|
1081
|
+
throw new Error(f);
|
|
1082
|
+
n.self.logger.warn(f);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return G.checkStrictMode = p, G;
|
|
1086
|
+
}
|
|
1087
|
+
var je = {}, nr;
|
|
1088
|
+
function _e() {
|
|
1089
|
+
if (nr) return je;
|
|
1090
|
+
nr = 1, Object.defineProperty(je, "__esModule", { value: !0 });
|
|
1091
|
+
const e = /* @__PURE__ */ H(), t = {
|
|
1092
|
+
// validation function arguments
|
|
1093
|
+
data: new e.Name("data"),
|
|
1094
|
+
// data passed to validation function
|
|
1095
|
+
// args passed from referencing schema
|
|
1096
|
+
valCxt: new e.Name("valCxt"),
|
|
1097
|
+
// validation/data context - should not be used directly, it is destructured to the names below
|
|
1098
|
+
instancePath: new e.Name("instancePath"),
|
|
1099
|
+
parentData: new e.Name("parentData"),
|
|
1100
|
+
parentDataProperty: new e.Name("parentDataProperty"),
|
|
1101
|
+
rootData: new e.Name("rootData"),
|
|
1102
|
+
// root data - same as the data passed to the first/top validation function
|
|
1103
|
+
dynamicAnchors: new e.Name("dynamicAnchors"),
|
|
1104
|
+
// used to support recursiveRef and dynamicRef
|
|
1105
|
+
// function scoped variables
|
|
1106
|
+
vErrors: new e.Name("vErrors"),
|
|
1107
|
+
// null or array of validation errors
|
|
1108
|
+
errors: new e.Name("errors"),
|
|
1109
|
+
// counter of validation errors
|
|
1110
|
+
this: new e.Name("this"),
|
|
1111
|
+
// "globals"
|
|
1112
|
+
self: new e.Name("self"),
|
|
1113
|
+
scope: new e.Name("scope"),
|
|
1114
|
+
// JTD serialize/parse name for JSON string and position
|
|
1115
|
+
json: new e.Name("json"),
|
|
1116
|
+
jsonPos: new e.Name("jsonPos"),
|
|
1117
|
+
jsonLen: new e.Name("jsonLen"),
|
|
1118
|
+
jsonPart: new e.Name("jsonPart")
|
|
1119
|
+
};
|
|
1120
|
+
return je.default = t, je;
|
|
1121
|
+
}
|
|
1122
|
+
var sr;
|
|
1123
|
+
function vt() {
|
|
1124
|
+
return sr || (sr = 1, (function(e) {
|
|
1125
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
1126
|
+
const t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ _e();
|
|
1127
|
+
e.keywordError = {
|
|
1128
|
+
message: ({ keyword: a }) => (0, t.str)`must pass "${a}" keyword validation`
|
|
1129
|
+
}, e.keyword$DataError = {
|
|
1130
|
+
message: ({ keyword: a, schemaType: i }) => i ? (0, t.str)`"${a}" keyword must be ${i} ($data)` : (0, t.str)`"${a}" keyword is invalid ($data)`
|
|
1131
|
+
};
|
|
1132
|
+
function b(a, i = e.keywordError, r, o) {
|
|
1133
|
+
const { it: p } = a, { gen: n, compositeRule: f, allErrors: S } = p, T = P(a, i, r);
|
|
1134
|
+
o ?? (f || S) ? h(n, T) : $(p, (0, t._)`[${T}]`);
|
|
1135
|
+
}
|
|
1136
|
+
e.reportError = b;
|
|
1137
|
+
function s(a, i = e.keywordError, r) {
|
|
1138
|
+
const { it: o } = a, { gen: p, compositeRule: n, allErrors: f } = o, S = P(a, i, r);
|
|
1139
|
+
h(p, S), n || f || $(o, c.default.vErrors);
|
|
1140
|
+
}
|
|
1141
|
+
e.reportExtraError = s;
|
|
1142
|
+
function l(a, i) {
|
|
1143
|
+
a.assign(c.default.errors, i), a.if((0, t._)`${c.default.vErrors} !== null`, () => a.if(i, () => a.assign((0, t._)`${c.default.vErrors}.length`, i), () => a.assign(c.default.vErrors, null)));
|
|
1144
|
+
}
|
|
1145
|
+
e.resetErrorsCount = l;
|
|
1146
|
+
function u({ gen: a, keyword: i, schemaValue: r, data: o, errsCount: p, it: n }) {
|
|
1147
|
+
if (p === void 0)
|
|
1148
|
+
throw new Error("ajv implementation error");
|
|
1149
|
+
const f = a.name("err");
|
|
1150
|
+
a.forRange("i", p, c.default.errors, (S) => {
|
|
1151
|
+
a.const(f, (0, t._)`${c.default.vErrors}[${S}]`), a.if((0, t._)`${f}.instancePath === undefined`, () => a.assign((0, t._)`${f}.instancePath`, (0, t.strConcat)(c.default.instancePath, n.errorPath))), a.assign((0, t._)`${f}.schemaPath`, (0, t.str)`${n.errSchemaPath}/${i}`), n.opts.verbose && (a.assign((0, t._)`${f}.schema`, r), a.assign((0, t._)`${f}.data`, o));
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
e.extendErrors = u;
|
|
1155
|
+
function h(a, i) {
|
|
1156
|
+
const r = a.const("err", i);
|
|
1157
|
+
a.if((0, t._)`${c.default.vErrors} === null`, () => a.assign(c.default.vErrors, (0, t._)`[${r}]`), (0, t._)`${c.default.vErrors}.push(${r})`), a.code((0, t._)`${c.default.errors}++`);
|
|
1158
|
+
}
|
|
1159
|
+
function $(a, i) {
|
|
1160
|
+
const { gen: r, validateName: o, schemaEnv: p } = a;
|
|
1161
|
+
p.$async ? r.throw((0, t._)`new ${a.ValidationError}(${i})`) : (r.assign((0, t._)`${o}.errors`, i), r.return(!1));
|
|
1162
|
+
}
|
|
1163
|
+
const v = {
|
|
1164
|
+
keyword: new t.Name("keyword"),
|
|
1165
|
+
schemaPath: new t.Name("schemaPath"),
|
|
1166
|
+
// also used in JTD errors
|
|
1167
|
+
params: new t.Name("params"),
|
|
1168
|
+
propertyName: new t.Name("propertyName"),
|
|
1169
|
+
message: new t.Name("message"),
|
|
1170
|
+
schema: new t.Name("schema"),
|
|
1171
|
+
parentSchema: new t.Name("parentSchema")
|
|
1172
|
+
};
|
|
1173
|
+
function P(a, i, r) {
|
|
1174
|
+
const { createErrors: o } = a.it;
|
|
1175
|
+
return o === !1 ? (0, t._)`{}` : _(a, i, r);
|
|
1176
|
+
}
|
|
1177
|
+
function _(a, i, r = {}) {
|
|
1178
|
+
const { gen: o, it: p } = a, n = [
|
|
1179
|
+
y(p, r),
|
|
1180
|
+
g(a, r)
|
|
1181
|
+
];
|
|
1182
|
+
return w(a, i, n), o.object(...n);
|
|
1183
|
+
}
|
|
1184
|
+
function y({ errorPath: a }, { instancePath: i }) {
|
|
1185
|
+
const r = i ? (0, t.str)`${a}${(0, m.getErrorPath)(i, m.Type.Str)}` : a;
|
|
1186
|
+
return [c.default.instancePath, (0, t.strConcat)(c.default.instancePath, r)];
|
|
1187
|
+
}
|
|
1188
|
+
function g({ keyword: a, it: { errSchemaPath: i } }, { schemaPath: r, parentSchema: o }) {
|
|
1189
|
+
let p = o ? i : (0, t.str)`${i}/${a}`;
|
|
1190
|
+
return r && (p = (0, t.str)`${p}${(0, m.getErrorPath)(r, m.Type.Str)}`), [v.schemaPath, p];
|
|
1191
|
+
}
|
|
1192
|
+
function w(a, { params: i, message: r }, o) {
|
|
1193
|
+
const { keyword: p, data: n, schemaValue: f, it: S } = a, { opts: T, propertyName: j, topSchemaRef: D, schemaPath: z } = S;
|
|
1194
|
+
o.push([v.keyword, p], [v.params, typeof i == "function" ? i(a) : i || (0, t._)`{}`]), T.messages && o.push([v.message, typeof r == "function" ? r(a) : r]), T.verbose && o.push([v.schema, f], [v.parentSchema, (0, t._)`${D}${z}`], [c.default.data, n]), j && o.push([v.propertyName, j]);
|
|
1195
|
+
}
|
|
1196
|
+
})(kt)), kt;
|
|
1197
|
+
}
|
|
1198
|
+
var ar;
|
|
1199
|
+
function Kn() {
|
|
1200
|
+
if (ar) return $e;
|
|
1201
|
+
ar = 1, Object.defineProperty($e, "__esModule", { value: !0 }), $e.boolOrEmptySchema = $e.topBoolOrEmptySchema = void 0;
|
|
1202
|
+
const e = /* @__PURE__ */ vt(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ _e(), c = {
|
|
1203
|
+
message: "boolean schema is false"
|
|
1204
|
+
};
|
|
1205
|
+
function b(u) {
|
|
1206
|
+
const { gen: h, schema: $, validateName: v } = u;
|
|
1207
|
+
$ === !1 ? l(u, !1) : typeof $ == "object" && $.$async === !0 ? h.return(m.default.data) : (h.assign((0, t._)`${v}.errors`, null), h.return(!0));
|
|
1208
|
+
}
|
|
1209
|
+
$e.topBoolOrEmptySchema = b;
|
|
1210
|
+
function s(u, h) {
|
|
1211
|
+
const { gen: $, schema: v } = u;
|
|
1212
|
+
v === !1 ? ($.var(h, !1), l(u)) : $.var(h, !0);
|
|
1213
|
+
}
|
|
1214
|
+
$e.boolOrEmptySchema = s;
|
|
1215
|
+
function l(u, h) {
|
|
1216
|
+
const { gen: $, data: v } = u, P = {
|
|
1217
|
+
gen: $,
|
|
1218
|
+
keyword: "false schema",
|
|
1219
|
+
data: v,
|
|
1220
|
+
schema: !1,
|
|
1221
|
+
schemaCode: !1,
|
|
1222
|
+
schemaValue: !1,
|
|
1223
|
+
params: {},
|
|
1224
|
+
it: u
|
|
1225
|
+
};
|
|
1226
|
+
(0, e.reportError)(P, c, void 0, h);
|
|
1227
|
+
}
|
|
1228
|
+
return $e;
|
|
1229
|
+
}
|
|
1230
|
+
var re = {}, we = {}, or;
|
|
1231
|
+
function bn() {
|
|
1232
|
+
if (or) return we;
|
|
1233
|
+
or = 1, Object.defineProperty(we, "__esModule", { value: !0 }), we.getRules = we.isJSONType = void 0;
|
|
1234
|
+
const e = ["string", "number", "integer", "boolean", "null", "object", "array"], t = new Set(e);
|
|
1235
|
+
function m(b) {
|
|
1236
|
+
return typeof b == "string" && t.has(b);
|
|
1237
|
+
}
|
|
1238
|
+
we.isJSONType = m;
|
|
1239
|
+
function c() {
|
|
1240
|
+
const b = {
|
|
1241
|
+
number: { type: "number", rules: [] },
|
|
1242
|
+
string: { type: "string", rules: [] },
|
|
1243
|
+
array: { type: "array", rules: [] },
|
|
1244
|
+
object: { type: "object", rules: [] }
|
|
1245
|
+
};
|
|
1246
|
+
return {
|
|
1247
|
+
types: { ...b, integer: !0, boolean: !0, null: !0 },
|
|
1248
|
+
rules: [{ rules: [] }, b.number, b.string, b.array, b.object],
|
|
1249
|
+
post: { rules: [] },
|
|
1250
|
+
all: {},
|
|
1251
|
+
keywords: {}
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
return we.getRules = c, we;
|
|
1255
|
+
}
|
|
1256
|
+
var pe = {}, ir;
|
|
1257
|
+
function Sn() {
|
|
1258
|
+
if (ir) return pe;
|
|
1259
|
+
ir = 1, Object.defineProperty(pe, "__esModule", { value: !0 }), pe.shouldUseRule = pe.shouldUseGroup = pe.schemaHasRulesForType = void 0;
|
|
1260
|
+
function e({ schema: c, self: b }, s) {
|
|
1261
|
+
const l = b.RULES.types[s];
|
|
1262
|
+
return l && l !== !0 && t(c, l);
|
|
1263
|
+
}
|
|
1264
|
+
pe.schemaHasRulesForType = e;
|
|
1265
|
+
function t(c, b) {
|
|
1266
|
+
return b.rules.some((s) => m(c, s));
|
|
1267
|
+
}
|
|
1268
|
+
pe.shouldUseGroup = t;
|
|
1269
|
+
function m(c, b) {
|
|
1270
|
+
var s;
|
|
1271
|
+
return c[b.keyword] !== void 0 || ((s = b.definition.implements) === null || s === void 0 ? void 0 : s.some((l) => c[l] !== void 0));
|
|
1272
|
+
}
|
|
1273
|
+
return pe.shouldUseRule = m, pe;
|
|
1274
|
+
}
|
|
1275
|
+
var ur;
|
|
1276
|
+
function gt() {
|
|
1277
|
+
if (ur) return re;
|
|
1278
|
+
ur = 1, Object.defineProperty(re, "__esModule", { value: !0 }), re.reportTypeError = re.checkDataTypes = re.checkDataType = re.coerceAndCheckDataType = re.getJSONTypes = re.getSchemaTypes = re.DataType = void 0;
|
|
1279
|
+
const e = /* @__PURE__ */ bn(), t = /* @__PURE__ */ Sn(), m = /* @__PURE__ */ vt(), c = /* @__PURE__ */ H(), b = /* @__PURE__ */ Y();
|
|
1280
|
+
var s;
|
|
1281
|
+
(function(r) {
|
|
1282
|
+
r[r.Correct = 0] = "Correct", r[r.Wrong = 1] = "Wrong";
|
|
1283
|
+
})(s || (re.DataType = s = {}));
|
|
1284
|
+
function l(r) {
|
|
1285
|
+
const o = u(r.type);
|
|
1286
|
+
if (o.includes("null")) {
|
|
1287
|
+
if (r.nullable === !1)
|
|
1288
|
+
throw new Error("type: null contradicts nullable: false");
|
|
1289
|
+
} else {
|
|
1290
|
+
if (!o.length && r.nullable !== void 0)
|
|
1291
|
+
throw new Error('"nullable" cannot be used without "type"');
|
|
1292
|
+
r.nullable === !0 && o.push("null");
|
|
1293
|
+
}
|
|
1294
|
+
return o;
|
|
1295
|
+
}
|
|
1296
|
+
re.getSchemaTypes = l;
|
|
1297
|
+
function u(r) {
|
|
1298
|
+
const o = Array.isArray(r) ? r : r ? [r] : [];
|
|
1299
|
+
if (o.every(e.isJSONType))
|
|
1300
|
+
return o;
|
|
1301
|
+
throw new Error("type must be JSONType or JSONType[]: " + o.join(","));
|
|
1302
|
+
}
|
|
1303
|
+
re.getJSONTypes = u;
|
|
1304
|
+
function h(r, o) {
|
|
1305
|
+
const { gen: p, data: n, opts: f } = r, S = v(o, f.coerceTypes), T = o.length > 0 && !(S.length === 0 && o.length === 1 && (0, t.schemaHasRulesForType)(r, o[0]));
|
|
1306
|
+
if (T) {
|
|
1307
|
+
const j = g(o, n, f.strictNumbers, s.Wrong);
|
|
1308
|
+
p.if(j, () => {
|
|
1309
|
+
S.length ? P(r, o, S) : a(r);
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
return T;
|
|
1313
|
+
}
|
|
1314
|
+
re.coerceAndCheckDataType = h;
|
|
1315
|
+
const $ = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
1316
|
+
function v(r, o) {
|
|
1317
|
+
return o ? r.filter((p) => $.has(p) || o === "array" && p === "array") : [];
|
|
1318
|
+
}
|
|
1319
|
+
function P(r, o, p) {
|
|
1320
|
+
const { gen: n, data: f, opts: S } = r, T = n.let("dataType", (0, c._)`typeof ${f}`), j = n.let("coerced", (0, c._)`undefined`);
|
|
1321
|
+
S.coerceTypes === "array" && n.if((0, c._)`${T} == 'object' && Array.isArray(${f}) && ${f}.length == 1`, () => n.assign(f, (0, c._)`${f}[0]`).assign(T, (0, c._)`typeof ${f}`).if(g(o, f, S.strictNumbers), () => n.assign(j, f))), n.if((0, c._)`${j} !== undefined`);
|
|
1322
|
+
for (const z of p)
|
|
1323
|
+
($.has(z) || z === "array" && S.coerceTypes === "array") && D(z);
|
|
1324
|
+
n.else(), a(r), n.endIf(), n.if((0, c._)`${j} !== undefined`, () => {
|
|
1325
|
+
n.assign(f, j), _(r, j);
|
|
1326
|
+
});
|
|
1327
|
+
function D(z) {
|
|
1328
|
+
switch (z) {
|
|
1329
|
+
case "string":
|
|
1330
|
+
n.elseIf((0, c._)`${T} == "number" || ${T} == "boolean"`).assign(j, (0, c._)`"" + ${f}`).elseIf((0, c._)`${f} === null`).assign(j, (0, c._)`""`);
|
|
1331
|
+
return;
|
|
1332
|
+
case "number":
|
|
1333
|
+
n.elseIf((0, c._)`${T} == "boolean" || ${f} === null
|
|
1334
|
+
|| (${T} == "string" && ${f} && ${f} == +${f})`).assign(j, (0, c._)`+${f}`);
|
|
1335
|
+
return;
|
|
1336
|
+
case "integer":
|
|
1337
|
+
n.elseIf((0, c._)`${T} === "boolean" || ${f} === null
|
|
1338
|
+
|| (${T} === "string" && ${f} && ${f} == +${f} && !(${f} % 1))`).assign(j, (0, c._)`+${f}`);
|
|
1339
|
+
return;
|
|
1340
|
+
case "boolean":
|
|
1341
|
+
n.elseIf((0, c._)`${f} === "false" || ${f} === 0 || ${f} === null`).assign(j, !1).elseIf((0, c._)`${f} === "true" || ${f} === 1`).assign(j, !0);
|
|
1342
|
+
return;
|
|
1343
|
+
case "null":
|
|
1344
|
+
n.elseIf((0, c._)`${f} === "" || ${f} === 0 || ${f} === false`), n.assign(j, null);
|
|
1345
|
+
return;
|
|
1346
|
+
case "array":
|
|
1347
|
+
n.elseIf((0, c._)`${T} === "string" || ${T} === "number"
|
|
1348
|
+
|| ${T} === "boolean" || ${f} === null`).assign(j, (0, c._)`[${f}]`);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
function _({ gen: r, parentData: o, parentDataProperty: p }, n) {
|
|
1353
|
+
r.if((0, c._)`${o} !== undefined`, () => r.assign((0, c._)`${o}[${p}]`, n));
|
|
1354
|
+
}
|
|
1355
|
+
function y(r, o, p, n = s.Correct) {
|
|
1356
|
+
const f = n === s.Correct ? c.operators.EQ : c.operators.NEQ;
|
|
1357
|
+
let S;
|
|
1358
|
+
switch (r) {
|
|
1359
|
+
case "null":
|
|
1360
|
+
return (0, c._)`${o} ${f} null`;
|
|
1361
|
+
case "array":
|
|
1362
|
+
S = (0, c._)`Array.isArray(${o})`;
|
|
1363
|
+
break;
|
|
1364
|
+
case "object":
|
|
1365
|
+
S = (0, c._)`${o} && typeof ${o} == "object" && !Array.isArray(${o})`;
|
|
1366
|
+
break;
|
|
1367
|
+
case "integer":
|
|
1368
|
+
S = T((0, c._)`!(${o} % 1) && !isNaN(${o})`);
|
|
1369
|
+
break;
|
|
1370
|
+
case "number":
|
|
1371
|
+
S = T();
|
|
1372
|
+
break;
|
|
1373
|
+
default:
|
|
1374
|
+
return (0, c._)`typeof ${o} ${f} ${r}`;
|
|
1375
|
+
}
|
|
1376
|
+
return n === s.Correct ? S : (0, c.not)(S);
|
|
1377
|
+
function T(j = c.nil) {
|
|
1378
|
+
return (0, c.and)((0, c._)`typeof ${o} == "number"`, j, p ? (0, c._)`isFinite(${o})` : c.nil);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
re.checkDataType = y;
|
|
1382
|
+
function g(r, o, p, n) {
|
|
1383
|
+
if (r.length === 1)
|
|
1384
|
+
return y(r[0], o, p, n);
|
|
1385
|
+
let f;
|
|
1386
|
+
const S = (0, b.toHash)(r);
|
|
1387
|
+
if (S.array && S.object) {
|
|
1388
|
+
const T = (0, c._)`typeof ${o} != "object"`;
|
|
1389
|
+
f = S.null ? T : (0, c._)`!${o} || ${T}`, delete S.null, delete S.array, delete S.object;
|
|
1390
|
+
} else
|
|
1391
|
+
f = c.nil;
|
|
1392
|
+
S.number && delete S.integer;
|
|
1393
|
+
for (const T in S)
|
|
1394
|
+
f = (0, c.and)(f, y(T, o, p, n));
|
|
1395
|
+
return f;
|
|
1396
|
+
}
|
|
1397
|
+
re.checkDataTypes = g;
|
|
1398
|
+
const w = {
|
|
1399
|
+
message: ({ schema: r }) => `must be ${r}`,
|
|
1400
|
+
params: ({ schema: r, schemaValue: o }) => typeof r == "string" ? (0, c._)`{type: ${r}}` : (0, c._)`{type: ${o}}`
|
|
1401
|
+
};
|
|
1402
|
+
function a(r) {
|
|
1403
|
+
const o = i(r);
|
|
1404
|
+
(0, m.reportError)(o, w);
|
|
1405
|
+
}
|
|
1406
|
+
re.reportTypeError = a;
|
|
1407
|
+
function i(r) {
|
|
1408
|
+
const { gen: o, data: p, schema: n } = r, f = (0, b.schemaRefOrVal)(r, n, "type");
|
|
1409
|
+
return {
|
|
1410
|
+
gen: o,
|
|
1411
|
+
keyword: "type",
|
|
1412
|
+
data: p,
|
|
1413
|
+
schema: n.type,
|
|
1414
|
+
schemaCode: f,
|
|
1415
|
+
schemaValue: f,
|
|
1416
|
+
parentSchema: n,
|
|
1417
|
+
params: {},
|
|
1418
|
+
it: r
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
return re;
|
|
1422
|
+
}
|
|
1423
|
+
var Ne = {}, cr;
|
|
1424
|
+
function Gn() {
|
|
1425
|
+
if (cr) return Ne;
|
|
1426
|
+
cr = 1, Object.defineProperty(Ne, "__esModule", { value: !0 }), Ne.assignDefaults = void 0;
|
|
1427
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y();
|
|
1428
|
+
function m(b, s) {
|
|
1429
|
+
const { properties: l, items: u } = b.schema;
|
|
1430
|
+
if (s === "object" && l)
|
|
1431
|
+
for (const h in l)
|
|
1432
|
+
c(b, h, l[h].default);
|
|
1433
|
+
else s === "array" && Array.isArray(u) && u.forEach((h, $) => c(b, $, h.default));
|
|
1434
|
+
}
|
|
1435
|
+
Ne.assignDefaults = m;
|
|
1436
|
+
function c(b, s, l) {
|
|
1437
|
+
const { gen: u, compositeRule: h, data: $, opts: v } = b;
|
|
1438
|
+
if (l === void 0)
|
|
1439
|
+
return;
|
|
1440
|
+
const P = (0, e._)`${$}${(0, e.getProperty)(s)}`;
|
|
1441
|
+
if (h) {
|
|
1442
|
+
(0, t.checkStrictMode)(b, `default is ignored for: ${P}`);
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
let _ = (0, e._)`${P} === undefined`;
|
|
1446
|
+
v.useDefaults === "empty" && (_ = (0, e._)`${_} || ${P} === null || ${P} === ""`), u.if(_, (0, e._)`${P} = ${(0, e.stringify)(l)}`);
|
|
1447
|
+
}
|
|
1448
|
+
return Ne;
|
|
1449
|
+
}
|
|
1450
|
+
var ce = {}, Q = {}, dr;
|
|
1451
|
+
function le() {
|
|
1452
|
+
if (dr) return Q;
|
|
1453
|
+
dr = 1, Object.defineProperty(Q, "__esModule", { value: !0 }), Q.validateUnion = Q.validateArray = Q.usePattern = Q.callValidateCode = Q.schemaProperties = Q.allSchemaProperties = Q.noPropertyInData = Q.propertyInData = Q.isOwnProperty = Q.hasPropFunc = Q.reportMissingProp = Q.checkMissingProp = Q.checkReportMissingProp = void 0;
|
|
1454
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ _e(), c = /* @__PURE__ */ Y();
|
|
1455
|
+
function b(r, o) {
|
|
1456
|
+
const { gen: p, data: n, it: f } = r;
|
|
1457
|
+
p.if(v(p, n, o, f.opts.ownProperties), () => {
|
|
1458
|
+
r.setParams({ missingProperty: (0, e._)`${o}` }, !0), r.error();
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
Q.checkReportMissingProp = b;
|
|
1462
|
+
function s({ gen: r, data: o, it: { opts: p } }, n, f) {
|
|
1463
|
+
return (0, e.or)(...n.map((S) => (0, e.and)(v(r, o, S, p.ownProperties), (0, e._)`${f} = ${S}`)));
|
|
1464
|
+
}
|
|
1465
|
+
Q.checkMissingProp = s;
|
|
1466
|
+
function l(r, o) {
|
|
1467
|
+
r.setParams({ missingProperty: o }, !0), r.error();
|
|
1468
|
+
}
|
|
1469
|
+
Q.reportMissingProp = l;
|
|
1470
|
+
function u(r) {
|
|
1471
|
+
return r.scopeValue("func", {
|
|
1472
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1473
|
+
ref: Object.prototype.hasOwnProperty,
|
|
1474
|
+
code: (0, e._)`Object.prototype.hasOwnProperty`
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
Q.hasPropFunc = u;
|
|
1478
|
+
function h(r, o, p) {
|
|
1479
|
+
return (0, e._)`${u(r)}.call(${o}, ${p})`;
|
|
1480
|
+
}
|
|
1481
|
+
Q.isOwnProperty = h;
|
|
1482
|
+
function $(r, o, p, n) {
|
|
1483
|
+
const f = (0, e._)`${o}${(0, e.getProperty)(p)} !== undefined`;
|
|
1484
|
+
return n ? (0, e._)`${f} && ${h(r, o, p)}` : f;
|
|
1485
|
+
}
|
|
1486
|
+
Q.propertyInData = $;
|
|
1487
|
+
function v(r, o, p, n) {
|
|
1488
|
+
const f = (0, e._)`${o}${(0, e.getProperty)(p)} === undefined`;
|
|
1489
|
+
return n ? (0, e.or)(f, (0, e.not)(h(r, o, p))) : f;
|
|
1490
|
+
}
|
|
1491
|
+
Q.noPropertyInData = v;
|
|
1492
|
+
function P(r) {
|
|
1493
|
+
return r ? Object.keys(r).filter((o) => o !== "__proto__") : [];
|
|
1494
|
+
}
|
|
1495
|
+
Q.allSchemaProperties = P;
|
|
1496
|
+
function _(r, o) {
|
|
1497
|
+
return P(o).filter((p) => !(0, t.alwaysValidSchema)(r, o[p]));
|
|
1498
|
+
}
|
|
1499
|
+
Q.schemaProperties = _;
|
|
1500
|
+
function y({ schemaCode: r, data: o, it: { gen: p, topSchemaRef: n, schemaPath: f, errorPath: S }, it: T }, j, D, z) {
|
|
1501
|
+
const V = z ? (0, e._)`${r}, ${o}, ${n}${f}` : o, U = [
|
|
1502
|
+
[m.default.instancePath, (0, e.strConcat)(m.default.instancePath, S)],
|
|
1503
|
+
[m.default.parentData, T.parentData],
|
|
1504
|
+
[m.default.parentDataProperty, T.parentDataProperty],
|
|
1505
|
+
[m.default.rootData, m.default.rootData]
|
|
1506
|
+
];
|
|
1507
|
+
T.opts.dynamicRef && U.push([m.default.dynamicAnchors, m.default.dynamicAnchors]);
|
|
1508
|
+
const J = (0, e._)`${V}, ${p.object(...U)}`;
|
|
1509
|
+
return D !== e.nil ? (0, e._)`${j}.call(${D}, ${J})` : (0, e._)`${j}(${J})`;
|
|
1510
|
+
}
|
|
1511
|
+
Q.callValidateCode = y;
|
|
1512
|
+
const g = (0, e._)`new RegExp`;
|
|
1513
|
+
function w({ gen: r, it: { opts: o } }, p) {
|
|
1514
|
+
const n = o.unicodeRegExp ? "u" : "", { regExp: f } = o.code, S = f(p, n);
|
|
1515
|
+
return r.scopeValue("pattern", {
|
|
1516
|
+
key: S.toString(),
|
|
1517
|
+
ref: S,
|
|
1518
|
+
code: (0, e._)`${f.code === "new RegExp" ? g : (0, c.useFunc)(r, f)}(${p}, ${n})`
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
Q.usePattern = w;
|
|
1522
|
+
function a(r) {
|
|
1523
|
+
const { gen: o, data: p, keyword: n, it: f } = r, S = o.name("valid");
|
|
1524
|
+
if (f.allErrors) {
|
|
1525
|
+
const j = o.let("valid", !0);
|
|
1526
|
+
return T(() => o.assign(j, !1)), j;
|
|
1527
|
+
}
|
|
1528
|
+
return o.var(S, !0), T(() => o.break()), S;
|
|
1529
|
+
function T(j) {
|
|
1530
|
+
const D = o.const("len", (0, e._)`${p}.length`);
|
|
1531
|
+
o.forRange("i", 0, D, (z) => {
|
|
1532
|
+
r.subschema({
|
|
1533
|
+
keyword: n,
|
|
1534
|
+
dataProp: z,
|
|
1535
|
+
dataPropType: t.Type.Num
|
|
1536
|
+
}, S), o.if((0, e.not)(S), j);
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
Q.validateArray = a;
|
|
1541
|
+
function i(r) {
|
|
1542
|
+
const { gen: o, schema: p, keyword: n, it: f } = r;
|
|
1543
|
+
if (!Array.isArray(p))
|
|
1544
|
+
throw new Error("ajv implementation error");
|
|
1545
|
+
if (p.some((D) => (0, t.alwaysValidSchema)(f, D)) && !f.opts.unevaluated)
|
|
1546
|
+
return;
|
|
1547
|
+
const T = o.let("valid", !1), j = o.name("_valid");
|
|
1548
|
+
o.block(() => p.forEach((D, z) => {
|
|
1549
|
+
const V = r.subschema({
|
|
1550
|
+
keyword: n,
|
|
1551
|
+
schemaProp: z,
|
|
1552
|
+
compositeRule: !0
|
|
1553
|
+
}, j);
|
|
1554
|
+
o.assign(T, (0, e._)`${T} || ${j}`), r.mergeValidEvaluated(V, j) || o.if((0, e.not)(T));
|
|
1555
|
+
})), r.result(T, () => r.reset(), () => r.error(!0));
|
|
1556
|
+
}
|
|
1557
|
+
return Q.validateUnion = i, Q;
|
|
1558
|
+
}
|
|
1559
|
+
var lr;
|
|
1560
|
+
function Hn() {
|
|
1561
|
+
if (lr) return ce;
|
|
1562
|
+
lr = 1, Object.defineProperty(ce, "__esModule", { value: !0 }), ce.validateKeywordUsage = ce.validSchemaType = ce.funcKeywordCode = ce.macroKeywordCode = void 0;
|
|
1563
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ _e(), m = /* @__PURE__ */ le(), c = /* @__PURE__ */ vt();
|
|
1564
|
+
function b(_, y) {
|
|
1565
|
+
const { gen: g, keyword: w, schema: a, parentSchema: i, it: r } = _, o = y.macro.call(r.self, a, i, r), p = $(g, w, o);
|
|
1566
|
+
r.opts.validateSchema !== !1 && r.self.validateSchema(o, !0);
|
|
1567
|
+
const n = g.name("valid");
|
|
1568
|
+
_.subschema({
|
|
1569
|
+
schema: o,
|
|
1570
|
+
schemaPath: e.nil,
|
|
1571
|
+
errSchemaPath: `${r.errSchemaPath}/${w}`,
|
|
1572
|
+
topSchemaRef: p,
|
|
1573
|
+
compositeRule: !0
|
|
1574
|
+
}, n), _.pass(n, () => _.error(!0));
|
|
1575
|
+
}
|
|
1576
|
+
ce.macroKeywordCode = b;
|
|
1577
|
+
function s(_, y) {
|
|
1578
|
+
var g;
|
|
1579
|
+
const { gen: w, keyword: a, schema: i, parentSchema: r, $data: o, it: p } = _;
|
|
1580
|
+
h(p, y);
|
|
1581
|
+
const n = !o && y.compile ? y.compile.call(p.self, i, r, p) : y.validate, f = $(w, a, n), S = w.let("valid");
|
|
1582
|
+
_.block$data(S, T), _.ok((g = y.valid) !== null && g !== void 0 ? g : S);
|
|
1583
|
+
function T() {
|
|
1584
|
+
if (y.errors === !1)
|
|
1585
|
+
z(), y.modifying && l(_), V(() => _.error());
|
|
1586
|
+
else {
|
|
1587
|
+
const U = y.async ? j() : D();
|
|
1588
|
+
y.modifying && l(_), V(() => u(_, U));
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
function j() {
|
|
1592
|
+
const U = w.let("ruleErrs", null);
|
|
1593
|
+
return w.try(() => z((0, e._)`await `), (J) => w.assign(S, !1).if((0, e._)`${J} instanceof ${p.ValidationError}`, () => w.assign(U, (0, e._)`${J}.errors`), () => w.throw(J))), U;
|
|
1594
|
+
}
|
|
1595
|
+
function D() {
|
|
1596
|
+
const U = (0, e._)`${f}.errors`;
|
|
1597
|
+
return w.assign(U, null), z(e.nil), U;
|
|
1598
|
+
}
|
|
1599
|
+
function z(U = y.async ? (0, e._)`await ` : e.nil) {
|
|
1600
|
+
const J = p.opts.passContext ? t.default.this : t.default.self, x = !("compile" in y && !o || y.schema === !1);
|
|
1601
|
+
w.assign(S, (0, e._)`${U}${(0, m.callValidateCode)(_, f, J, x)}`, y.modifying);
|
|
1602
|
+
}
|
|
1603
|
+
function V(U) {
|
|
1604
|
+
var J;
|
|
1605
|
+
w.if((0, e.not)((J = y.valid) !== null && J !== void 0 ? J : S), U);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
ce.funcKeywordCode = s;
|
|
1609
|
+
function l(_) {
|
|
1610
|
+
const { gen: y, data: g, it: w } = _;
|
|
1611
|
+
y.if(w.parentData, () => y.assign(g, (0, e._)`${w.parentData}[${w.parentDataProperty}]`));
|
|
1612
|
+
}
|
|
1613
|
+
function u(_, y) {
|
|
1614
|
+
const { gen: g } = _;
|
|
1615
|
+
g.if((0, e._)`Array.isArray(${y})`, () => {
|
|
1616
|
+
g.assign(t.default.vErrors, (0, e._)`${t.default.vErrors} === null ? ${y} : ${t.default.vErrors}.concat(${y})`).assign(t.default.errors, (0, e._)`${t.default.vErrors}.length`), (0, c.extendErrors)(_);
|
|
1617
|
+
}, () => _.error());
|
|
1618
|
+
}
|
|
1619
|
+
function h({ schemaEnv: _ }, y) {
|
|
1620
|
+
if (y.async && !_.$async)
|
|
1621
|
+
throw new Error("async keyword in sync schema");
|
|
1622
|
+
}
|
|
1623
|
+
function $(_, y, g) {
|
|
1624
|
+
if (g === void 0)
|
|
1625
|
+
throw new Error(`keyword "${y}" failed to compile`);
|
|
1626
|
+
return _.scopeValue("keyword", typeof g == "function" ? { ref: g } : { ref: g, code: (0, e.stringify)(g) });
|
|
1627
|
+
}
|
|
1628
|
+
function v(_, y, g = !1) {
|
|
1629
|
+
return !y.length || y.some((w) => w === "array" ? Array.isArray(_) : w === "object" ? _ && typeof _ == "object" && !Array.isArray(_) : typeof _ == w || g && typeof _ > "u");
|
|
1630
|
+
}
|
|
1631
|
+
ce.validSchemaType = v;
|
|
1632
|
+
function P({ schema: _, opts: y, self: g, errSchemaPath: w }, a, i) {
|
|
1633
|
+
if (Array.isArray(a.keyword) ? !a.keyword.includes(i) : a.keyword !== i)
|
|
1634
|
+
throw new Error("ajv implementation error");
|
|
1635
|
+
const r = a.dependencies;
|
|
1636
|
+
if (r != null && r.some((o) => !Object.prototype.hasOwnProperty.call(_, o)))
|
|
1637
|
+
throw new Error(`parent schema must have dependencies of ${i}: ${r.join(",")}`);
|
|
1638
|
+
if (a.validateSchema && !a.validateSchema(_[i])) {
|
|
1639
|
+
const p = `keyword "${i}" value is invalid at path "${w}": ` + g.errorsText(a.validateSchema.errors);
|
|
1640
|
+
if (y.validateSchema === "log")
|
|
1641
|
+
g.logger.error(p);
|
|
1642
|
+
else
|
|
1643
|
+
throw new Error(p);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return ce.validateKeywordUsage = P, ce;
|
|
1647
|
+
}
|
|
1648
|
+
var ye = {}, fr;
|
|
1649
|
+
function Jn() {
|
|
1650
|
+
if (fr) return ye;
|
|
1651
|
+
fr = 1, Object.defineProperty(ye, "__esModule", { value: !0 }), ye.extendSubschemaMode = ye.extendSubschemaData = ye.getSubschema = void 0;
|
|
1652
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y();
|
|
1653
|
+
function m(s, { keyword: l, schemaProp: u, schema: h, schemaPath: $, errSchemaPath: v, topSchemaRef: P }) {
|
|
1654
|
+
if (l !== void 0 && h !== void 0)
|
|
1655
|
+
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
1656
|
+
if (l !== void 0) {
|
|
1657
|
+
const _ = s.schema[l];
|
|
1658
|
+
return u === void 0 ? {
|
|
1659
|
+
schema: _,
|
|
1660
|
+
schemaPath: (0, e._)`${s.schemaPath}${(0, e.getProperty)(l)}`,
|
|
1661
|
+
errSchemaPath: `${s.errSchemaPath}/${l}`
|
|
1662
|
+
} : {
|
|
1663
|
+
schema: _[u],
|
|
1664
|
+
schemaPath: (0, e._)`${s.schemaPath}${(0, e.getProperty)(l)}${(0, e.getProperty)(u)}`,
|
|
1665
|
+
errSchemaPath: `${s.errSchemaPath}/${l}/${(0, t.escapeFragment)(u)}`
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
if (h !== void 0) {
|
|
1669
|
+
if ($ === void 0 || v === void 0 || P === void 0)
|
|
1670
|
+
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
1671
|
+
return {
|
|
1672
|
+
schema: h,
|
|
1673
|
+
schemaPath: $,
|
|
1674
|
+
topSchemaRef: P,
|
|
1675
|
+
errSchemaPath: v
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
throw new Error('either "keyword" or "schema" must be passed');
|
|
1679
|
+
}
|
|
1680
|
+
ye.getSubschema = m;
|
|
1681
|
+
function c(s, l, { dataProp: u, dataPropType: h, data: $, dataTypes: v, propertyName: P }) {
|
|
1682
|
+
if ($ !== void 0 && u !== void 0)
|
|
1683
|
+
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
1684
|
+
const { gen: _ } = l;
|
|
1685
|
+
if (u !== void 0) {
|
|
1686
|
+
const { errorPath: g, dataPathArr: w, opts: a } = l, i = _.let("data", (0, e._)`${l.data}${(0, e.getProperty)(u)}`, !0);
|
|
1687
|
+
y(i), s.errorPath = (0, e.str)`${g}${(0, t.getErrorPath)(u, h, a.jsPropertySyntax)}`, s.parentDataProperty = (0, e._)`${u}`, s.dataPathArr = [...w, s.parentDataProperty];
|
|
1688
|
+
}
|
|
1689
|
+
if ($ !== void 0) {
|
|
1690
|
+
const g = $ instanceof e.Name ? $ : _.let("data", $, !0);
|
|
1691
|
+
y(g), P !== void 0 && (s.propertyName = P);
|
|
1692
|
+
}
|
|
1693
|
+
v && (s.dataTypes = v);
|
|
1694
|
+
function y(g) {
|
|
1695
|
+
s.data = g, s.dataLevel = l.dataLevel + 1, s.dataTypes = [], l.definedProperties = /* @__PURE__ */ new Set(), s.parentData = l.data, s.dataNames = [...l.dataNames, g];
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
ye.extendSubschemaData = c;
|
|
1699
|
+
function b(s, { jtdDiscriminator: l, jtdMetadata: u, compositeRule: h, createErrors: $, allErrors: v }) {
|
|
1700
|
+
h !== void 0 && (s.compositeRule = h), $ !== void 0 && (s.createErrors = $), v !== void 0 && (s.allErrors = v), s.jtdDiscriminator = l, s.jtdMetadata = u;
|
|
1701
|
+
}
|
|
1702
|
+
return ye.extendSubschemaMode = b, ye;
|
|
1703
|
+
}
|
|
1704
|
+
var ne = {}, Tt, hr;
|
|
1705
|
+
function En() {
|
|
1706
|
+
return hr || (hr = 1, Tt = function e(t, m) {
|
|
1707
|
+
if (t === m) return !0;
|
|
1708
|
+
if (t && m && typeof t == "object" && typeof m == "object") {
|
|
1709
|
+
if (t.constructor !== m.constructor) return !1;
|
|
1710
|
+
var c, b, s;
|
|
1711
|
+
if (Array.isArray(t)) {
|
|
1712
|
+
if (c = t.length, c != m.length) return !1;
|
|
1713
|
+
for (b = c; b-- !== 0; )
|
|
1714
|
+
if (!e(t[b], m[b])) return !1;
|
|
1715
|
+
return !0;
|
|
1716
|
+
}
|
|
1717
|
+
if (t.constructor === RegExp) return t.source === m.source && t.flags === m.flags;
|
|
1718
|
+
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === m.valueOf();
|
|
1719
|
+
if (t.toString !== Object.prototype.toString) return t.toString() === m.toString();
|
|
1720
|
+
if (s = Object.keys(t), c = s.length, c !== Object.keys(m).length) return !1;
|
|
1721
|
+
for (b = c; b-- !== 0; )
|
|
1722
|
+
if (!Object.prototype.hasOwnProperty.call(m, s[b])) return !1;
|
|
1723
|
+
for (b = c; b-- !== 0; ) {
|
|
1724
|
+
var l = s[b];
|
|
1725
|
+
if (!e(t[l], m[l])) return !1;
|
|
1726
|
+
}
|
|
1727
|
+
return !0;
|
|
1728
|
+
}
|
|
1729
|
+
return t !== t && m !== m;
|
|
1730
|
+
}), Tt;
|
|
1731
|
+
}
|
|
1732
|
+
var jt = { exports: {} }, mr;
|
|
1733
|
+
function Wn() {
|
|
1734
|
+
if (mr) return jt.exports;
|
|
1735
|
+
mr = 1;
|
|
1736
|
+
var e = jt.exports = function(c, b, s) {
|
|
1737
|
+
typeof b == "function" && (s = b, b = {}), s = b.cb || s;
|
|
1738
|
+
var l = typeof s == "function" ? s : s.pre || function() {
|
|
1739
|
+
}, u = s.post || function() {
|
|
1740
|
+
};
|
|
1741
|
+
t(b, l, u, c, "", c);
|
|
1742
|
+
};
|
|
1743
|
+
e.keywords = {
|
|
1744
|
+
additionalItems: !0,
|
|
1745
|
+
items: !0,
|
|
1746
|
+
contains: !0,
|
|
1747
|
+
additionalProperties: !0,
|
|
1748
|
+
propertyNames: !0,
|
|
1749
|
+
not: !0,
|
|
1750
|
+
if: !0,
|
|
1751
|
+
then: !0,
|
|
1752
|
+
else: !0
|
|
1753
|
+
}, e.arrayKeywords = {
|
|
1754
|
+
items: !0,
|
|
1755
|
+
allOf: !0,
|
|
1756
|
+
anyOf: !0,
|
|
1757
|
+
oneOf: !0
|
|
1758
|
+
}, e.propsKeywords = {
|
|
1759
|
+
$defs: !0,
|
|
1760
|
+
definitions: !0,
|
|
1761
|
+
properties: !0,
|
|
1762
|
+
patternProperties: !0,
|
|
1763
|
+
dependencies: !0
|
|
1764
|
+
}, e.skipKeywords = {
|
|
1765
|
+
default: !0,
|
|
1766
|
+
enum: !0,
|
|
1767
|
+
const: !0,
|
|
1768
|
+
required: !0,
|
|
1769
|
+
maximum: !0,
|
|
1770
|
+
minimum: !0,
|
|
1771
|
+
exclusiveMaximum: !0,
|
|
1772
|
+
exclusiveMinimum: !0,
|
|
1773
|
+
multipleOf: !0,
|
|
1774
|
+
maxLength: !0,
|
|
1775
|
+
minLength: !0,
|
|
1776
|
+
pattern: !0,
|
|
1777
|
+
format: !0,
|
|
1778
|
+
maxItems: !0,
|
|
1779
|
+
minItems: !0,
|
|
1780
|
+
uniqueItems: !0,
|
|
1781
|
+
maxProperties: !0,
|
|
1782
|
+
minProperties: !0
|
|
1783
|
+
};
|
|
1784
|
+
function t(c, b, s, l, u, h, $, v, P, _) {
|
|
1785
|
+
if (l && typeof l == "object" && !Array.isArray(l)) {
|
|
1786
|
+
b(l, u, h, $, v, P, _);
|
|
1787
|
+
for (var y in l) {
|
|
1788
|
+
var g = l[y];
|
|
1789
|
+
if (Array.isArray(g)) {
|
|
1790
|
+
if (y in e.arrayKeywords)
|
|
1791
|
+
for (var w = 0; w < g.length; w++)
|
|
1792
|
+
t(c, b, s, g[w], u + "/" + y + "/" + w, h, u, y, l, w);
|
|
1793
|
+
} else if (y in e.propsKeywords) {
|
|
1794
|
+
if (g && typeof g == "object")
|
|
1795
|
+
for (var a in g)
|
|
1796
|
+
t(c, b, s, g[a], u + "/" + y + "/" + m(a), h, u, y, l, a);
|
|
1797
|
+
} else (y in e.keywords || c.allKeys && !(y in e.skipKeywords)) && t(c, b, s, g, u + "/" + y, h, u, y, l);
|
|
1798
|
+
}
|
|
1799
|
+
s(l, u, h, $, v, P, _);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
function m(c) {
|
|
1803
|
+
return c.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1804
|
+
}
|
|
1805
|
+
return jt.exports;
|
|
1806
|
+
}
|
|
1807
|
+
var pr;
|
|
1808
|
+
function _t() {
|
|
1809
|
+
if (pr) return ne;
|
|
1810
|
+
pr = 1, Object.defineProperty(ne, "__esModule", { value: !0 }), ne.getSchemaRefs = ne.resolveUrl = ne.normalizeId = ne._getFullPath = ne.getFullPath = ne.inlineRef = void 0;
|
|
1811
|
+
const e = /* @__PURE__ */ Y(), t = En(), m = Wn(), c = /* @__PURE__ */ new Set([
|
|
1812
|
+
"type",
|
|
1813
|
+
"format",
|
|
1814
|
+
"pattern",
|
|
1815
|
+
"maxLength",
|
|
1816
|
+
"minLength",
|
|
1817
|
+
"maxProperties",
|
|
1818
|
+
"minProperties",
|
|
1819
|
+
"maxItems",
|
|
1820
|
+
"minItems",
|
|
1821
|
+
"maximum",
|
|
1822
|
+
"minimum",
|
|
1823
|
+
"uniqueItems",
|
|
1824
|
+
"multipleOf",
|
|
1825
|
+
"required",
|
|
1826
|
+
"enum",
|
|
1827
|
+
"const"
|
|
1828
|
+
]);
|
|
1829
|
+
function b(w, a = !0) {
|
|
1830
|
+
return typeof w == "boolean" ? !0 : a === !0 ? !l(w) : a ? u(w) <= a : !1;
|
|
1831
|
+
}
|
|
1832
|
+
ne.inlineRef = b;
|
|
1833
|
+
const s = /* @__PURE__ */ new Set([
|
|
1834
|
+
"$ref",
|
|
1835
|
+
"$recursiveRef",
|
|
1836
|
+
"$recursiveAnchor",
|
|
1837
|
+
"$dynamicRef",
|
|
1838
|
+
"$dynamicAnchor"
|
|
1839
|
+
]);
|
|
1840
|
+
function l(w) {
|
|
1841
|
+
for (const a in w) {
|
|
1842
|
+
if (s.has(a))
|
|
1843
|
+
return !0;
|
|
1844
|
+
const i = w[a];
|
|
1845
|
+
if (Array.isArray(i) && i.some(l) || typeof i == "object" && l(i))
|
|
1846
|
+
return !0;
|
|
1847
|
+
}
|
|
1848
|
+
return !1;
|
|
1849
|
+
}
|
|
1850
|
+
function u(w) {
|
|
1851
|
+
let a = 0;
|
|
1852
|
+
for (const i in w) {
|
|
1853
|
+
if (i === "$ref")
|
|
1854
|
+
return 1 / 0;
|
|
1855
|
+
if (a++, !c.has(i) && (typeof w[i] == "object" && (0, e.eachItem)(w[i], (r) => a += u(r)), a === 1 / 0))
|
|
1856
|
+
return 1 / 0;
|
|
1857
|
+
}
|
|
1858
|
+
return a;
|
|
1859
|
+
}
|
|
1860
|
+
function h(w, a = "", i) {
|
|
1861
|
+
i !== !1 && (a = P(a));
|
|
1862
|
+
const r = w.parse(a);
|
|
1863
|
+
return $(w, r);
|
|
1864
|
+
}
|
|
1865
|
+
ne.getFullPath = h;
|
|
1866
|
+
function $(w, a) {
|
|
1867
|
+
return w.serialize(a).split("#")[0] + "#";
|
|
1868
|
+
}
|
|
1869
|
+
ne._getFullPath = $;
|
|
1870
|
+
const v = /#\/?$/;
|
|
1871
|
+
function P(w) {
|
|
1872
|
+
return w ? w.replace(v, "") : "";
|
|
1873
|
+
}
|
|
1874
|
+
ne.normalizeId = P;
|
|
1875
|
+
function _(w, a, i) {
|
|
1876
|
+
return i = P(i), w.resolve(a, i);
|
|
1877
|
+
}
|
|
1878
|
+
ne.resolveUrl = _;
|
|
1879
|
+
const y = /^[a-z_][-a-z0-9._]*$/i;
|
|
1880
|
+
function g(w, a) {
|
|
1881
|
+
if (typeof w == "boolean")
|
|
1882
|
+
return {};
|
|
1883
|
+
const { schemaId: i, uriResolver: r } = this.opts, o = P(w[i] || a), p = { "": o }, n = h(r, o, !1), f = {}, S = /* @__PURE__ */ new Set();
|
|
1884
|
+
return m(w, { allKeys: !0 }, (D, z, V, U) => {
|
|
1885
|
+
if (U === void 0)
|
|
1886
|
+
return;
|
|
1887
|
+
const J = n + z;
|
|
1888
|
+
let x = p[U];
|
|
1889
|
+
typeof D[i] == "string" && (x = fe.call(this, D[i])), he.call(this, D.$anchor), he.call(this, D.$dynamicAnchor), p[z] = x;
|
|
1890
|
+
function fe(X) {
|
|
1891
|
+
const ge = this.opts.uriResolver.resolve;
|
|
1892
|
+
if (X = P(x ? ge(x, X) : X), S.has(X))
|
|
1893
|
+
throw j(X);
|
|
1894
|
+
S.add(X);
|
|
1895
|
+
let A = this.refs[X];
|
|
1896
|
+
return typeof A == "string" && (A = this.refs[A]), typeof A == "object" ? T(D, A.schema, X) : X !== P(J) && (X[0] === "#" ? (T(D, f[X], X), f[X] = D) : this.refs[X] = J), X;
|
|
1897
|
+
}
|
|
1898
|
+
function he(X) {
|
|
1899
|
+
if (typeof X == "string") {
|
|
1900
|
+
if (!y.test(X))
|
|
1901
|
+
throw new Error(`invalid anchor "${X}"`);
|
|
1902
|
+
fe.call(this, `#${X}`);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}), f;
|
|
1906
|
+
function T(D, z, V) {
|
|
1907
|
+
if (z !== void 0 && !t(D, z))
|
|
1908
|
+
throw j(V);
|
|
1909
|
+
}
|
|
1910
|
+
function j(D) {
|
|
1911
|
+
return new Error(`reference "${D}" resolves to more than one schema`);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
return ne.getSchemaRefs = g, ne;
|
|
1915
|
+
}
|
|
1916
|
+
var yr;
|
|
1917
|
+
function $t() {
|
|
1918
|
+
if (yr) return me;
|
|
1919
|
+
yr = 1, Object.defineProperty(me, "__esModule", { value: !0 }), me.getData = me.KeywordCxt = me.validateFunctionCode = void 0;
|
|
1920
|
+
const e = /* @__PURE__ */ Kn(), t = /* @__PURE__ */ gt(), m = /* @__PURE__ */ Sn(), c = /* @__PURE__ */ gt(), b = /* @__PURE__ */ Gn(), s = /* @__PURE__ */ Hn(), l = /* @__PURE__ */ Jn(), u = /* @__PURE__ */ H(), h = /* @__PURE__ */ _e(), $ = /* @__PURE__ */ _t(), v = /* @__PURE__ */ Y(), P = /* @__PURE__ */ vt();
|
|
1921
|
+
function _(k) {
|
|
1922
|
+
if (n(k) && (S(k), p(k))) {
|
|
1923
|
+
a(k);
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1926
|
+
y(k, () => (0, e.topBoolOrEmptySchema)(k));
|
|
1927
|
+
}
|
|
1928
|
+
me.validateFunctionCode = _;
|
|
1929
|
+
function y({ gen: k, validateName: R, schema: q, schemaEnv: M, opts: L }, W) {
|
|
1930
|
+
L.code.es5 ? k.func(R, (0, u._)`${h.default.data}, ${h.default.valCxt}`, M.$async, () => {
|
|
1931
|
+
k.code((0, u._)`"use strict"; ${r(q, L)}`), w(k, L), k.code(W);
|
|
1932
|
+
}) : k.func(R, (0, u._)`${h.default.data}, ${g(L)}`, M.$async, () => k.code(r(q, L)).code(W));
|
|
1933
|
+
}
|
|
1934
|
+
function g(k) {
|
|
1935
|
+
return (0, u._)`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${k.dynamicRef ? (0, u._)`, ${h.default.dynamicAnchors}={}` : u.nil}}={}`;
|
|
1936
|
+
}
|
|
1937
|
+
function w(k, R) {
|
|
1938
|
+
k.if(h.default.valCxt, () => {
|
|
1939
|
+
k.var(h.default.instancePath, (0, u._)`${h.default.valCxt}.${h.default.instancePath}`), k.var(h.default.parentData, (0, u._)`${h.default.valCxt}.${h.default.parentData}`), k.var(h.default.parentDataProperty, (0, u._)`${h.default.valCxt}.${h.default.parentDataProperty}`), k.var(h.default.rootData, (0, u._)`${h.default.valCxt}.${h.default.rootData}`), R.dynamicRef && k.var(h.default.dynamicAnchors, (0, u._)`${h.default.valCxt}.${h.default.dynamicAnchors}`);
|
|
1940
|
+
}, () => {
|
|
1941
|
+
k.var(h.default.instancePath, (0, u._)`""`), k.var(h.default.parentData, (0, u._)`undefined`), k.var(h.default.parentDataProperty, (0, u._)`undefined`), k.var(h.default.rootData, h.default.data), R.dynamicRef && k.var(h.default.dynamicAnchors, (0, u._)`{}`);
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
function a(k) {
|
|
1945
|
+
const { schema: R, opts: q, gen: M } = k;
|
|
1946
|
+
y(k, () => {
|
|
1947
|
+
q.$comment && R.$comment && U(k), D(k), M.let(h.default.vErrors, null), M.let(h.default.errors, 0), q.unevaluated && i(k), T(k), J(k);
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
function i(k) {
|
|
1951
|
+
const { gen: R, validateName: q } = k;
|
|
1952
|
+
k.evaluated = R.const("evaluated", (0, u._)`${q}.evaluated`), R.if((0, u._)`${k.evaluated}.dynamicProps`, () => R.assign((0, u._)`${k.evaluated}.props`, (0, u._)`undefined`)), R.if((0, u._)`${k.evaluated}.dynamicItems`, () => R.assign((0, u._)`${k.evaluated}.items`, (0, u._)`undefined`));
|
|
1953
|
+
}
|
|
1954
|
+
function r(k, R) {
|
|
1955
|
+
const q = typeof k == "object" && k[R.schemaId];
|
|
1956
|
+
return q && (R.code.source || R.code.process) ? (0, u._)`/*# sourceURL=${q} */` : u.nil;
|
|
1957
|
+
}
|
|
1958
|
+
function o(k, R) {
|
|
1959
|
+
if (n(k) && (S(k), p(k))) {
|
|
1960
|
+
f(k, R);
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
(0, e.boolOrEmptySchema)(k, R);
|
|
1964
|
+
}
|
|
1965
|
+
function p({ schema: k, self: R }) {
|
|
1966
|
+
if (typeof k == "boolean")
|
|
1967
|
+
return !k;
|
|
1968
|
+
for (const q in k)
|
|
1969
|
+
if (R.RULES.all[q])
|
|
1970
|
+
return !0;
|
|
1971
|
+
return !1;
|
|
1972
|
+
}
|
|
1973
|
+
function n(k) {
|
|
1974
|
+
return typeof k.schema != "boolean";
|
|
1975
|
+
}
|
|
1976
|
+
function f(k, R) {
|
|
1977
|
+
const { schema: q, gen: M, opts: L } = k;
|
|
1978
|
+
L.$comment && q.$comment && U(k), z(k), V(k);
|
|
1979
|
+
const W = M.const("_errs", h.default.errors);
|
|
1980
|
+
T(k, W), M.var(R, (0, u._)`${W} === ${h.default.errors}`);
|
|
1981
|
+
}
|
|
1982
|
+
function S(k) {
|
|
1983
|
+
(0, v.checkUnknownRules)(k), j(k);
|
|
1984
|
+
}
|
|
1985
|
+
function T(k, R) {
|
|
1986
|
+
if (k.opts.jtd)
|
|
1987
|
+
return fe(k, [], !1, R);
|
|
1988
|
+
const q = (0, t.getSchemaTypes)(k.schema), M = (0, t.coerceAndCheckDataType)(k, q);
|
|
1989
|
+
fe(k, q, !M, R);
|
|
1990
|
+
}
|
|
1991
|
+
function j(k) {
|
|
1992
|
+
const { schema: R, errSchemaPath: q, opts: M, self: L } = k;
|
|
1993
|
+
R.$ref && M.ignoreKeywordsWithRef && (0, v.schemaHasRulesButRef)(R, L.RULES) && L.logger.warn(`$ref: keywords ignored in schema at path "${q}"`);
|
|
1994
|
+
}
|
|
1995
|
+
function D(k) {
|
|
1996
|
+
const { schema: R, opts: q } = k;
|
|
1997
|
+
R.default !== void 0 && q.useDefaults && q.strictSchema && (0, v.checkStrictMode)(k, "default is ignored in the schema root");
|
|
1998
|
+
}
|
|
1999
|
+
function z(k) {
|
|
2000
|
+
const R = k.schema[k.opts.schemaId];
|
|
2001
|
+
R && (k.baseId = (0, $.resolveUrl)(k.opts.uriResolver, k.baseId, R));
|
|
2002
|
+
}
|
|
2003
|
+
function V(k) {
|
|
2004
|
+
if (k.schema.$async && !k.schemaEnv.$async)
|
|
2005
|
+
throw new Error("async schema in sync schema");
|
|
2006
|
+
}
|
|
2007
|
+
function U({ gen: k, schemaEnv: R, schema: q, errSchemaPath: M, opts: L }) {
|
|
2008
|
+
const W = q.$comment;
|
|
2009
|
+
if (L.$comment === !0)
|
|
2010
|
+
k.code((0, u._)`${h.default.self}.logger.log(${W})`);
|
|
2011
|
+
else if (typeof L.$comment == "function") {
|
|
2012
|
+
const ee = (0, u.str)`${M}/$comment`, ue = k.scopeValue("root", { ref: R.root });
|
|
2013
|
+
k.code((0, u._)`${h.default.self}.opts.$comment(${W}, ${ee}, ${ue}.schema)`);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
function J(k) {
|
|
2017
|
+
const { gen: R, schemaEnv: q, validateName: M, ValidationError: L, opts: W } = k;
|
|
2018
|
+
q.$async ? R.if((0, u._)`${h.default.errors} === 0`, () => R.return(h.default.data), () => R.throw((0, u._)`new ${L}(${h.default.vErrors})`)) : (R.assign((0, u._)`${M}.errors`, h.default.vErrors), W.unevaluated && x(k), R.return((0, u._)`${h.default.errors} === 0`));
|
|
2019
|
+
}
|
|
2020
|
+
function x({ gen: k, evaluated: R, props: q, items: M }) {
|
|
2021
|
+
q instanceof u.Name && k.assign((0, u._)`${R}.props`, q), M instanceof u.Name && k.assign((0, u._)`${R}.items`, M);
|
|
2022
|
+
}
|
|
2023
|
+
function fe(k, R, q, M) {
|
|
2024
|
+
const { gen: L, schema: W, data: ee, allErrors: ue, opts: se, self: ae } = k, { RULES: te } = ae;
|
|
2025
|
+
if (W.$ref && (se.ignoreKeywordsWithRef || !(0, v.schemaHasRulesButRef)(W, te))) {
|
|
2026
|
+
L.block(() => F(k, "$ref", te.all.$ref.definition));
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
se.jtd || X(k, R), L.block(() => {
|
|
2030
|
+
for (const ie of te.rules)
|
|
2031
|
+
Se(ie);
|
|
2032
|
+
Se(te.post);
|
|
2033
|
+
});
|
|
2034
|
+
function Se(ie) {
|
|
2035
|
+
(0, m.shouldUseGroup)(W, ie) && (ie.type ? (L.if((0, c.checkDataType)(ie.type, ee, se.strictNumbers)), he(k, ie), R.length === 1 && R[0] === ie.type && q && (L.else(), (0, c.reportTypeError)(k)), L.endIf()) : he(k, ie), ue || L.if((0, u._)`${h.default.errors} === ${M || 0}`));
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
function he(k, R) {
|
|
2039
|
+
const { gen: q, schema: M, opts: { useDefaults: L } } = k;
|
|
2040
|
+
L && (0, b.assignDefaults)(k, R.type), q.block(() => {
|
|
2041
|
+
for (const W of R.rules)
|
|
2042
|
+
(0, m.shouldUseRule)(M, W) && F(k, W.keyword, W.definition, R.type);
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
function X(k, R) {
|
|
2046
|
+
k.schemaEnv.meta || !k.opts.strictTypes || (ge(k, R), k.opts.allowUnionTypes || A(k, R), N(k, k.dataTypes));
|
|
2047
|
+
}
|
|
2048
|
+
function ge(k, R) {
|
|
2049
|
+
if (R.length) {
|
|
2050
|
+
if (!k.dataTypes.length) {
|
|
2051
|
+
k.dataTypes = R;
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
R.forEach((q) => {
|
|
2055
|
+
O(k.dataTypes, q) || E(k, `type "${q}" not allowed by context "${k.dataTypes.join(",")}"`);
|
|
2056
|
+
}), d(k, R);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
function A(k, R) {
|
|
2060
|
+
R.length > 1 && !(R.length === 2 && R.includes("null")) && E(k, "use allowUnionTypes to allow union type keyword");
|
|
2061
|
+
}
|
|
2062
|
+
function N(k, R) {
|
|
2063
|
+
const q = k.self.RULES.all;
|
|
2064
|
+
for (const M in q) {
|
|
2065
|
+
const L = q[M];
|
|
2066
|
+
if (typeof L == "object" && (0, m.shouldUseRule)(k.schema, L)) {
|
|
2067
|
+
const { type: W } = L.definition;
|
|
2068
|
+
W.length && !W.some((ee) => C(R, ee)) && E(k, `missing type "${W.join(",")}" for keyword "${M}"`);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
function C(k, R) {
|
|
2073
|
+
return k.includes(R) || R === "number" && k.includes("integer");
|
|
2074
|
+
}
|
|
2075
|
+
function O(k, R) {
|
|
2076
|
+
return k.includes(R) || R === "integer" && k.includes("number");
|
|
2077
|
+
}
|
|
2078
|
+
function d(k, R) {
|
|
2079
|
+
const q = [];
|
|
2080
|
+
for (const M of k.dataTypes)
|
|
2081
|
+
O(R, M) ? q.push(M) : R.includes("integer") && M === "number" && q.push("integer");
|
|
2082
|
+
k.dataTypes = q;
|
|
2083
|
+
}
|
|
2084
|
+
function E(k, R) {
|
|
2085
|
+
const q = k.schemaEnv.baseId + k.errSchemaPath;
|
|
2086
|
+
R += ` at "${q}" (strictTypes)`, (0, v.checkStrictMode)(k, R, k.opts.strictTypes);
|
|
2087
|
+
}
|
|
2088
|
+
class I {
|
|
2089
|
+
constructor(R, q, M) {
|
|
2090
|
+
if ((0, s.validateKeywordUsage)(R, q, M), this.gen = R.gen, this.allErrors = R.allErrors, this.keyword = M, this.data = R.data, this.schema = R.schema[M], this.$data = q.$data && R.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, v.schemaRefOrVal)(R, this.schema, M, this.$data), this.schemaType = q.schemaType, this.parentSchema = R.schema, this.params = {}, this.it = R, this.def = q, this.$data)
|
|
2091
|
+
this.schemaCode = R.gen.const("vSchema", B(this.$data, R));
|
|
2092
|
+
else if (this.schemaCode = this.schemaValue, !(0, s.validSchemaType)(this.schema, q.schemaType, q.allowUndefined))
|
|
2093
|
+
throw new Error(`${M} value must be ${JSON.stringify(q.schemaType)}`);
|
|
2094
|
+
("code" in q ? q.trackErrors : q.errors !== !1) && (this.errsCount = R.gen.const("_errs", h.default.errors));
|
|
2095
|
+
}
|
|
2096
|
+
result(R, q, M) {
|
|
2097
|
+
this.failResult((0, u.not)(R), q, M);
|
|
2098
|
+
}
|
|
2099
|
+
failResult(R, q, M) {
|
|
2100
|
+
this.gen.if(R), M ? M() : this.error(), q ? (this.gen.else(), q(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else();
|
|
2101
|
+
}
|
|
2102
|
+
pass(R, q) {
|
|
2103
|
+
this.failResult((0, u.not)(R), void 0, q);
|
|
2104
|
+
}
|
|
2105
|
+
fail(R) {
|
|
2106
|
+
if (R === void 0) {
|
|
2107
|
+
this.error(), this.allErrors || this.gen.if(!1);
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
this.gen.if(R), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else();
|
|
2111
|
+
}
|
|
2112
|
+
fail$data(R) {
|
|
2113
|
+
if (!this.$data)
|
|
2114
|
+
return this.fail(R);
|
|
2115
|
+
const { schemaCode: q } = this;
|
|
2116
|
+
this.fail((0, u._)`${q} !== undefined && (${(0, u.or)(this.invalid$data(), R)})`);
|
|
2117
|
+
}
|
|
2118
|
+
error(R, q, M) {
|
|
2119
|
+
if (q) {
|
|
2120
|
+
this.setParams(q), this._error(R, M), this.setParams({});
|
|
2121
|
+
return;
|
|
2122
|
+
}
|
|
2123
|
+
this._error(R, M);
|
|
2124
|
+
}
|
|
2125
|
+
_error(R, q) {
|
|
2126
|
+
(R ? P.reportExtraError : P.reportError)(this, this.def.error, q);
|
|
2127
|
+
}
|
|
2128
|
+
$dataError() {
|
|
2129
|
+
(0, P.reportError)(this, this.def.$dataError || P.keyword$DataError);
|
|
2130
|
+
}
|
|
2131
|
+
reset() {
|
|
2132
|
+
if (this.errsCount === void 0)
|
|
2133
|
+
throw new Error('add "trackErrors" to keyword definition');
|
|
2134
|
+
(0, P.resetErrorsCount)(this.gen, this.errsCount);
|
|
2135
|
+
}
|
|
2136
|
+
ok(R) {
|
|
2137
|
+
this.allErrors || this.gen.if(R);
|
|
2138
|
+
}
|
|
2139
|
+
setParams(R, q) {
|
|
2140
|
+
q ? Object.assign(this.params, R) : this.params = R;
|
|
2141
|
+
}
|
|
2142
|
+
block$data(R, q, M = u.nil) {
|
|
2143
|
+
this.gen.block(() => {
|
|
2144
|
+
this.check$data(R, M), q();
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
check$data(R = u.nil, q = u.nil) {
|
|
2148
|
+
if (!this.$data)
|
|
2149
|
+
return;
|
|
2150
|
+
const { gen: M, schemaCode: L, schemaType: W, def: ee } = this;
|
|
2151
|
+
M.if((0, u.or)((0, u._)`${L} === undefined`, q)), R !== u.nil && M.assign(R, !0), (W.length || ee.validateSchema) && (M.elseIf(this.invalid$data()), this.$dataError(), R !== u.nil && M.assign(R, !1)), M.else();
|
|
2152
|
+
}
|
|
2153
|
+
invalid$data() {
|
|
2154
|
+
const { gen: R, schemaCode: q, schemaType: M, def: L, it: W } = this;
|
|
2155
|
+
return (0, u.or)(ee(), ue());
|
|
2156
|
+
function ee() {
|
|
2157
|
+
if (M.length) {
|
|
2158
|
+
if (!(q instanceof u.Name))
|
|
2159
|
+
throw new Error("ajv implementation error");
|
|
2160
|
+
const se = Array.isArray(M) ? M : [M];
|
|
2161
|
+
return (0, u._)`${(0, c.checkDataTypes)(se, q, W.opts.strictNumbers, c.DataType.Wrong)}`;
|
|
2162
|
+
}
|
|
2163
|
+
return u.nil;
|
|
2164
|
+
}
|
|
2165
|
+
function ue() {
|
|
2166
|
+
if (L.validateSchema) {
|
|
2167
|
+
const se = R.scopeValue("validate$data", { ref: L.validateSchema });
|
|
2168
|
+
return (0, u._)`!${se}(${q})`;
|
|
2169
|
+
}
|
|
2170
|
+
return u.nil;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
subschema(R, q) {
|
|
2174
|
+
const M = (0, l.getSubschema)(this.it, R);
|
|
2175
|
+
(0, l.extendSubschemaData)(M, this.it, R), (0, l.extendSubschemaMode)(M, R);
|
|
2176
|
+
const L = { ...this.it, ...M, items: void 0, props: void 0 };
|
|
2177
|
+
return o(L, q), L;
|
|
2178
|
+
}
|
|
2179
|
+
mergeEvaluated(R, q) {
|
|
2180
|
+
const { it: M, gen: L } = this;
|
|
2181
|
+
M.opts.unevaluated && (M.props !== !0 && R.props !== void 0 && (M.props = v.mergeEvaluated.props(L, R.props, M.props, q)), M.items !== !0 && R.items !== void 0 && (M.items = v.mergeEvaluated.items(L, R.items, M.items, q)));
|
|
2182
|
+
}
|
|
2183
|
+
mergeValidEvaluated(R, q) {
|
|
2184
|
+
const { it: M, gen: L } = this;
|
|
2185
|
+
if (M.opts.unevaluated && (M.props !== !0 || M.items !== !0))
|
|
2186
|
+
return L.if(q, () => this.mergeEvaluated(R, u.Name)), !0;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
me.KeywordCxt = I;
|
|
2190
|
+
function F(k, R, q, M) {
|
|
2191
|
+
const L = new I(k, q, R);
|
|
2192
|
+
"code" in q ? q.code(L, M) : L.$data && q.validate ? (0, s.funcKeywordCode)(L, q) : "macro" in q ? (0, s.macroKeywordCode)(L, q) : (q.compile || q.validate) && (0, s.funcKeywordCode)(L, q);
|
|
2193
|
+
}
|
|
2194
|
+
const K = /^\/(?:[^~]|~0|~1)*$/, Z = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2195
|
+
function B(k, { dataLevel: R, dataNames: q, dataPathArr: M }) {
|
|
2196
|
+
let L, W;
|
|
2197
|
+
if (k === "")
|
|
2198
|
+
return h.default.rootData;
|
|
2199
|
+
if (k[0] === "/") {
|
|
2200
|
+
if (!K.test(k))
|
|
2201
|
+
throw new Error(`Invalid JSON-pointer: ${k}`);
|
|
2202
|
+
L = k, W = h.default.rootData;
|
|
2203
|
+
} else {
|
|
2204
|
+
const ae = Z.exec(k);
|
|
2205
|
+
if (!ae)
|
|
2206
|
+
throw new Error(`Invalid JSON-pointer: ${k}`);
|
|
2207
|
+
const te = +ae[1];
|
|
2208
|
+
if (L = ae[2], L === "#") {
|
|
2209
|
+
if (te >= R)
|
|
2210
|
+
throw new Error(se("property/index", te));
|
|
2211
|
+
return M[R - te];
|
|
2212
|
+
}
|
|
2213
|
+
if (te > R)
|
|
2214
|
+
throw new Error(se("data", te));
|
|
2215
|
+
if (W = q[R - te], !L)
|
|
2216
|
+
return W;
|
|
2217
|
+
}
|
|
2218
|
+
let ee = W;
|
|
2219
|
+
const ue = L.split("/");
|
|
2220
|
+
for (const ae of ue)
|
|
2221
|
+
ae && (W = (0, u._)`${W}${(0, u.getProperty)((0, v.unescapeJsonPointer)(ae))}`, ee = (0, u._)`${ee} && ${W}`);
|
|
2222
|
+
return ee;
|
|
2223
|
+
function se(ae, te) {
|
|
2224
|
+
return `Cannot access ${ae} ${te} levels up, current level is ${R}`;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
return me.getData = B, me;
|
|
2228
|
+
}
|
|
2229
|
+
var Ie = {}, gr;
|
|
2230
|
+
function Ut() {
|
|
2231
|
+
if (gr) return Ie;
|
|
2232
|
+
gr = 1, Object.defineProperty(Ie, "__esModule", { value: !0 });
|
|
2233
|
+
class e extends Error {
|
|
2234
|
+
constructor(m) {
|
|
2235
|
+
super("validation failed"), this.errors = m, this.ajv = this.validation = !0;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
return Ie.default = e, Ie;
|
|
2239
|
+
}
|
|
2240
|
+
var qe = {}, vr;
|
|
2241
|
+
function wt() {
|
|
2242
|
+
if (vr) return qe;
|
|
2243
|
+
vr = 1, Object.defineProperty(qe, "__esModule", { value: !0 });
|
|
2244
|
+
const e = /* @__PURE__ */ _t();
|
|
2245
|
+
class t extends Error {
|
|
2246
|
+
constructor(c, b, s, l) {
|
|
2247
|
+
super(l || `can't resolve reference ${s} from id ${b}`), this.missingRef = (0, e.resolveUrl)(c, b, s), this.missingSchema = (0, e.normalizeId)((0, e.getFullPath)(c, this.missingRef));
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
return qe.default = t, qe;
|
|
2251
|
+
}
|
|
2252
|
+
var oe = {}, _r;
|
|
2253
|
+
function Lt() {
|
|
2254
|
+
if (_r) return oe;
|
|
2255
|
+
_r = 1, Object.defineProperty(oe, "__esModule", { value: !0 }), oe.resolveSchema = oe.getCompilingSchema = oe.resolveRef = oe.compileSchema = oe.SchemaEnv = void 0;
|
|
2256
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Ut(), m = /* @__PURE__ */ _e(), c = /* @__PURE__ */ _t(), b = /* @__PURE__ */ Y(), s = /* @__PURE__ */ $t();
|
|
2257
|
+
class l {
|
|
2258
|
+
constructor(i) {
|
|
2259
|
+
var r;
|
|
2260
|
+
this.refs = {}, this.dynamicAnchors = {};
|
|
2261
|
+
let o;
|
|
2262
|
+
typeof i.schema == "object" && (o = i.schema), this.schema = i.schema, this.schemaId = i.schemaId, this.root = i.root || this, this.baseId = (r = i.baseId) !== null && r !== void 0 ? r : (0, c.normalizeId)(o == null ? void 0 : o[i.schemaId || "$id"]), this.schemaPath = i.schemaPath, this.localRefs = i.localRefs, this.meta = i.meta, this.$async = o == null ? void 0 : o.$async, this.refs = {};
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
oe.SchemaEnv = l;
|
|
2266
|
+
function u(a) {
|
|
2267
|
+
const i = v.call(this, a);
|
|
2268
|
+
if (i)
|
|
2269
|
+
return i;
|
|
2270
|
+
const r = (0, c.getFullPath)(this.opts.uriResolver, a.root.baseId), { es5: o, lines: p } = this.opts.code, { ownProperties: n } = this.opts, f = new e.CodeGen(this.scope, { es5: o, lines: p, ownProperties: n });
|
|
2271
|
+
let S;
|
|
2272
|
+
a.$async && (S = f.scopeValue("Error", {
|
|
2273
|
+
ref: t.default,
|
|
2274
|
+
code: (0, e._)`require("ajv/dist/runtime/validation_error").default`
|
|
2275
|
+
}));
|
|
2276
|
+
const T = f.scopeName("validate");
|
|
2277
|
+
a.validateName = T;
|
|
2278
|
+
const j = {
|
|
2279
|
+
gen: f,
|
|
2280
|
+
allErrors: this.opts.allErrors,
|
|
2281
|
+
data: m.default.data,
|
|
2282
|
+
parentData: m.default.parentData,
|
|
2283
|
+
parentDataProperty: m.default.parentDataProperty,
|
|
2284
|
+
dataNames: [m.default.data],
|
|
2285
|
+
dataPathArr: [e.nil],
|
|
2286
|
+
// TODO can its length be used as dataLevel if nil is removed?
|
|
2287
|
+
dataLevel: 0,
|
|
2288
|
+
dataTypes: [],
|
|
2289
|
+
definedProperties: /* @__PURE__ */ new Set(),
|
|
2290
|
+
topSchemaRef: f.scopeValue("schema", this.opts.code.source === !0 ? { ref: a.schema, code: (0, e.stringify)(a.schema) } : { ref: a.schema }),
|
|
2291
|
+
validateName: T,
|
|
2292
|
+
ValidationError: S,
|
|
2293
|
+
schema: a.schema,
|
|
2294
|
+
schemaEnv: a,
|
|
2295
|
+
rootId: r,
|
|
2296
|
+
baseId: a.baseId || r,
|
|
2297
|
+
schemaPath: e.nil,
|
|
2298
|
+
errSchemaPath: a.schemaPath || (this.opts.jtd ? "" : "#"),
|
|
2299
|
+
errorPath: (0, e._)`""`,
|
|
2300
|
+
opts: this.opts,
|
|
2301
|
+
self: this
|
|
2302
|
+
};
|
|
2303
|
+
let D;
|
|
2304
|
+
try {
|
|
2305
|
+
this._compilations.add(a), (0, s.validateFunctionCode)(j), f.optimize(this.opts.code.optimize);
|
|
2306
|
+
const z = f.toString();
|
|
2307
|
+
D = `${f.scopeRefs(m.default.scope)}return ${z}`, this.opts.code.process && (D = this.opts.code.process(D, a));
|
|
2308
|
+
const U = new Function(`${m.default.self}`, `${m.default.scope}`, D)(this, this.scope.get());
|
|
2309
|
+
if (this.scope.value(T, { ref: U }), U.errors = null, U.schema = a.schema, U.schemaEnv = a, a.$async && (U.$async = !0), this.opts.code.source === !0 && (U.source = { validateName: T, validateCode: z, scopeValues: f._values }), this.opts.unevaluated) {
|
|
2310
|
+
const { props: J, items: x } = j;
|
|
2311
|
+
U.evaluated = {
|
|
2312
|
+
props: J instanceof e.Name ? void 0 : J,
|
|
2313
|
+
items: x instanceof e.Name ? void 0 : x,
|
|
2314
|
+
dynamicProps: J instanceof e.Name,
|
|
2315
|
+
dynamicItems: x instanceof e.Name
|
|
2316
|
+
}, U.source && (U.source.evaluated = (0, e.stringify)(U.evaluated));
|
|
2317
|
+
}
|
|
2318
|
+
return a.validate = U, a;
|
|
2319
|
+
} catch (z) {
|
|
2320
|
+
throw delete a.validate, delete a.validateName, D && this.logger.error("Error compiling schema, function code:", D), z;
|
|
2321
|
+
} finally {
|
|
2322
|
+
this._compilations.delete(a);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
oe.compileSchema = u;
|
|
2326
|
+
function h(a, i, r) {
|
|
2327
|
+
var o;
|
|
2328
|
+
r = (0, c.resolveUrl)(this.opts.uriResolver, i, r);
|
|
2329
|
+
const p = a.refs[r];
|
|
2330
|
+
if (p)
|
|
2331
|
+
return p;
|
|
2332
|
+
let n = _.call(this, a, r);
|
|
2333
|
+
if (n === void 0) {
|
|
2334
|
+
const f = (o = a.localRefs) === null || o === void 0 ? void 0 : o[r], { schemaId: S } = this.opts;
|
|
2335
|
+
f && (n = new l({ schema: f, schemaId: S, root: a, baseId: i }));
|
|
2336
|
+
}
|
|
2337
|
+
if (n !== void 0)
|
|
2338
|
+
return a.refs[r] = $.call(this, n);
|
|
2339
|
+
}
|
|
2340
|
+
oe.resolveRef = h;
|
|
2341
|
+
function $(a) {
|
|
2342
|
+
return (0, c.inlineRef)(a.schema, this.opts.inlineRefs) ? a.schema : a.validate ? a : u.call(this, a);
|
|
2343
|
+
}
|
|
2344
|
+
function v(a) {
|
|
2345
|
+
for (const i of this._compilations)
|
|
2346
|
+
if (P(i, a))
|
|
2347
|
+
return i;
|
|
2348
|
+
}
|
|
2349
|
+
oe.getCompilingSchema = v;
|
|
2350
|
+
function P(a, i) {
|
|
2351
|
+
return a.schema === i.schema && a.root === i.root && a.baseId === i.baseId;
|
|
2352
|
+
}
|
|
2353
|
+
function _(a, i) {
|
|
2354
|
+
let r;
|
|
2355
|
+
for (; typeof (r = this.refs[i]) == "string"; )
|
|
2356
|
+
i = r;
|
|
2357
|
+
return r || this.schemas[i] || y.call(this, a, i);
|
|
2358
|
+
}
|
|
2359
|
+
function y(a, i) {
|
|
2360
|
+
const r = this.opts.uriResolver.parse(i), o = (0, c._getFullPath)(this.opts.uriResolver, r);
|
|
2361
|
+
let p = (0, c.getFullPath)(this.opts.uriResolver, a.baseId, void 0);
|
|
2362
|
+
if (Object.keys(a.schema).length > 0 && o === p)
|
|
2363
|
+
return w.call(this, r, a);
|
|
2364
|
+
const n = (0, c.normalizeId)(o), f = this.refs[n] || this.schemas[n];
|
|
2365
|
+
if (typeof f == "string") {
|
|
2366
|
+
const S = y.call(this, a, f);
|
|
2367
|
+
return typeof (S == null ? void 0 : S.schema) != "object" ? void 0 : w.call(this, r, S);
|
|
2368
|
+
}
|
|
2369
|
+
if (typeof (f == null ? void 0 : f.schema) == "object") {
|
|
2370
|
+
if (f.validate || u.call(this, f), n === (0, c.normalizeId)(i)) {
|
|
2371
|
+
const { schema: S } = f, { schemaId: T } = this.opts, j = S[T];
|
|
2372
|
+
return j && (p = (0, c.resolveUrl)(this.opts.uriResolver, p, j)), new l({ schema: S, schemaId: T, root: a, baseId: p });
|
|
2373
|
+
}
|
|
2374
|
+
return w.call(this, r, f);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
oe.resolveSchema = y;
|
|
2378
|
+
const g = /* @__PURE__ */ new Set([
|
|
2379
|
+
"properties",
|
|
2380
|
+
"patternProperties",
|
|
2381
|
+
"enum",
|
|
2382
|
+
"dependencies",
|
|
2383
|
+
"definitions"
|
|
2384
|
+
]);
|
|
2385
|
+
function w(a, { baseId: i, schema: r, root: o }) {
|
|
2386
|
+
var p;
|
|
2387
|
+
if (((p = a.fragment) === null || p === void 0 ? void 0 : p[0]) !== "/")
|
|
2388
|
+
return;
|
|
2389
|
+
for (const S of a.fragment.slice(1).split("/")) {
|
|
2390
|
+
if (typeof r == "boolean")
|
|
2391
|
+
return;
|
|
2392
|
+
const T = r[(0, b.unescapeFragment)(S)];
|
|
2393
|
+
if (T === void 0)
|
|
2394
|
+
return;
|
|
2395
|
+
r = T;
|
|
2396
|
+
const j = typeof r == "object" && r[this.opts.schemaId];
|
|
2397
|
+
!g.has(S) && j && (i = (0, c.resolveUrl)(this.opts.uriResolver, i, j));
|
|
2398
|
+
}
|
|
2399
|
+
let n;
|
|
2400
|
+
if (typeof r != "boolean" && r.$ref && !(0, b.schemaHasRulesButRef)(r, this.RULES)) {
|
|
2401
|
+
const S = (0, c.resolveUrl)(this.opts.uriResolver, i, r.$ref);
|
|
2402
|
+
n = y.call(this, o, S);
|
|
2403
|
+
}
|
|
2404
|
+
const { schemaId: f } = this.opts;
|
|
2405
|
+
if (n = n || new l({ schema: r, schemaId: f, root: o, baseId: i }), n.schema !== n.root.schema)
|
|
2406
|
+
return n;
|
|
2407
|
+
}
|
|
2408
|
+
return oe;
|
|
2409
|
+
}
|
|
2410
|
+
const Bn = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", Yn = "Meta-schema for $data reference (JSON AnySchema extension proposal)", Zn = "object", Qn = ["$data"], Xn = { $data: { type: "string", anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }] } }, xn = !1, es = {
|
|
2411
|
+
$id: Bn,
|
|
2412
|
+
description: Yn,
|
|
2413
|
+
type: Zn,
|
|
2414
|
+
required: Qn,
|
|
2415
|
+
properties: Xn,
|
|
2416
|
+
additionalProperties: xn
|
|
2417
|
+
};
|
|
2418
|
+
var Ce = {}, Re = { exports: {} }, It, $r;
|
|
2419
|
+
function Pn() {
|
|
2420
|
+
if ($r) return It;
|
|
2421
|
+
$r = 1;
|
|
2422
|
+
const e = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu), t = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
2423
|
+
function m(_) {
|
|
2424
|
+
let y = "", g = 0, w = 0;
|
|
2425
|
+
for (w = 0; w < _.length; w++)
|
|
2426
|
+
if (g = _[w].charCodeAt(0), g !== 48) {
|
|
2427
|
+
if (!(g >= 48 && g <= 57 || g >= 65 && g <= 70 || g >= 97 && g <= 102))
|
|
2428
|
+
return "";
|
|
2429
|
+
y += _[w];
|
|
2430
|
+
break;
|
|
2431
|
+
}
|
|
2432
|
+
for (w += 1; w < _.length; w++) {
|
|
2433
|
+
if (g = _[w].charCodeAt(0), !(g >= 48 && g <= 57 || g >= 65 && g <= 70 || g >= 97 && g <= 102))
|
|
2434
|
+
return "";
|
|
2435
|
+
y += _[w];
|
|
2436
|
+
}
|
|
2437
|
+
return y;
|
|
2438
|
+
}
|
|
2439
|
+
const c = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
2440
|
+
function b(_) {
|
|
2441
|
+
return _.length = 0, !0;
|
|
2442
|
+
}
|
|
2443
|
+
function s(_, y, g) {
|
|
2444
|
+
if (_.length) {
|
|
2445
|
+
const w = m(_);
|
|
2446
|
+
if (w !== "")
|
|
2447
|
+
y.push(w);
|
|
2448
|
+
else
|
|
2449
|
+
return g.error = !0, !1;
|
|
2450
|
+
_.length = 0;
|
|
2451
|
+
}
|
|
2452
|
+
return !0;
|
|
2453
|
+
}
|
|
2454
|
+
function l(_) {
|
|
2455
|
+
let y = 0;
|
|
2456
|
+
const g = { error: !1, address: "", zone: "" }, w = [], a = [];
|
|
2457
|
+
let i = !1, r = !1, o = s;
|
|
2458
|
+
for (let p = 0; p < _.length; p++) {
|
|
2459
|
+
const n = _[p];
|
|
2460
|
+
if (!(n === "[" || n === "]"))
|
|
2461
|
+
if (n === ":") {
|
|
2462
|
+
if (i === !0 && (r = !0), !o(a, w, g))
|
|
2463
|
+
break;
|
|
2464
|
+
if (++y > 7) {
|
|
2465
|
+
g.error = !0;
|
|
2466
|
+
break;
|
|
2467
|
+
}
|
|
2468
|
+
p > 0 && _[p - 1] === ":" && (i = !0), w.push(":");
|
|
2469
|
+
continue;
|
|
2470
|
+
} else if (n === "%") {
|
|
2471
|
+
if (!o(a, w, g))
|
|
2472
|
+
break;
|
|
2473
|
+
o = b;
|
|
2474
|
+
} else {
|
|
2475
|
+
a.push(n);
|
|
2476
|
+
continue;
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
return a.length && (o === b ? g.zone = a.join("") : r ? w.push(a.join("")) : w.push(m(a))), g.address = w.join(""), g;
|
|
2480
|
+
}
|
|
2481
|
+
function u(_) {
|
|
2482
|
+
if (h(_, ":") < 2)
|
|
2483
|
+
return { host: _, isIPV6: !1 };
|
|
2484
|
+
const y = l(_);
|
|
2485
|
+
if (y.error)
|
|
2486
|
+
return { host: _, isIPV6: !1 };
|
|
2487
|
+
{
|
|
2488
|
+
let g = y.address, w = y.address;
|
|
2489
|
+
return y.zone && (g += "%" + y.zone, w += "%25" + y.zone), { host: g, isIPV6: !0, escapedHost: w };
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
function h(_, y) {
|
|
2493
|
+
let g = 0;
|
|
2494
|
+
for (let w = 0; w < _.length; w++)
|
|
2495
|
+
_[w] === y && g++;
|
|
2496
|
+
return g;
|
|
2497
|
+
}
|
|
2498
|
+
function $(_) {
|
|
2499
|
+
let y = _;
|
|
2500
|
+
const g = [];
|
|
2501
|
+
let w = -1, a = 0;
|
|
2502
|
+
for (; a = y.length; ) {
|
|
2503
|
+
if (a === 1) {
|
|
2504
|
+
if (y === ".")
|
|
2505
|
+
break;
|
|
2506
|
+
if (y === "/") {
|
|
2507
|
+
g.push("/");
|
|
2508
|
+
break;
|
|
2509
|
+
} else {
|
|
2510
|
+
g.push(y);
|
|
2511
|
+
break;
|
|
2512
|
+
}
|
|
2513
|
+
} else if (a === 2) {
|
|
2514
|
+
if (y[0] === ".") {
|
|
2515
|
+
if (y[1] === ".")
|
|
2516
|
+
break;
|
|
2517
|
+
if (y[1] === "/") {
|
|
2518
|
+
y = y.slice(2);
|
|
2519
|
+
continue;
|
|
2520
|
+
}
|
|
2521
|
+
} else if (y[0] === "/" && (y[1] === "." || y[1] === "/")) {
|
|
2522
|
+
g.push("/");
|
|
2523
|
+
break;
|
|
2524
|
+
}
|
|
2525
|
+
} else if (a === 3 && y === "/..") {
|
|
2526
|
+
g.length !== 0 && g.pop(), g.push("/");
|
|
2527
|
+
break;
|
|
2528
|
+
}
|
|
2529
|
+
if (y[0] === ".") {
|
|
2530
|
+
if (y[1] === ".") {
|
|
2531
|
+
if (y[2] === "/") {
|
|
2532
|
+
y = y.slice(3);
|
|
2533
|
+
continue;
|
|
2534
|
+
}
|
|
2535
|
+
} else if (y[1] === "/") {
|
|
2536
|
+
y = y.slice(2);
|
|
2537
|
+
continue;
|
|
2538
|
+
}
|
|
2539
|
+
} else if (y[0] === "/" && y[1] === ".") {
|
|
2540
|
+
if (y[2] === "/") {
|
|
2541
|
+
y = y.slice(2);
|
|
2542
|
+
continue;
|
|
2543
|
+
} else if (y[2] === "." && y[3] === "/") {
|
|
2544
|
+
y = y.slice(3), g.length !== 0 && g.pop();
|
|
2545
|
+
continue;
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
if ((w = y.indexOf("/", 1)) === -1) {
|
|
2549
|
+
g.push(y);
|
|
2550
|
+
break;
|
|
2551
|
+
} else
|
|
2552
|
+
g.push(y.slice(0, w)), y = y.slice(w);
|
|
2553
|
+
}
|
|
2554
|
+
return g.join("");
|
|
2555
|
+
}
|
|
2556
|
+
function v(_, y) {
|
|
2557
|
+
const g = y !== !0 ? escape : unescape;
|
|
2558
|
+
return _.scheme !== void 0 && (_.scheme = g(_.scheme)), _.userinfo !== void 0 && (_.userinfo = g(_.userinfo)), _.host !== void 0 && (_.host = g(_.host)), _.path !== void 0 && (_.path = g(_.path)), _.query !== void 0 && (_.query = g(_.query)), _.fragment !== void 0 && (_.fragment = g(_.fragment)), _;
|
|
2559
|
+
}
|
|
2560
|
+
function P(_) {
|
|
2561
|
+
const y = [];
|
|
2562
|
+
if (_.userinfo !== void 0 && (y.push(_.userinfo), y.push("@")), _.host !== void 0) {
|
|
2563
|
+
let g = unescape(_.host);
|
|
2564
|
+
if (!t(g)) {
|
|
2565
|
+
const w = u(g);
|
|
2566
|
+
w.isIPV6 === !0 ? g = `[${w.escapedHost}]` : g = _.host;
|
|
2567
|
+
}
|
|
2568
|
+
y.push(g);
|
|
2569
|
+
}
|
|
2570
|
+
return (typeof _.port == "number" || typeof _.port == "string") && (y.push(":"), y.push(String(_.port))), y.length ? y.join("") : void 0;
|
|
2571
|
+
}
|
|
2572
|
+
return It = {
|
|
2573
|
+
nonSimpleDomain: c,
|
|
2574
|
+
recomposeAuthority: P,
|
|
2575
|
+
normalizeComponentEncoding: v,
|
|
2576
|
+
removeDotSegments: $,
|
|
2577
|
+
isIPv4: t,
|
|
2578
|
+
isUUID: e,
|
|
2579
|
+
normalizeIPv6: u,
|
|
2580
|
+
stringArrayToHexStripped: m
|
|
2581
|
+
}, It;
|
|
2582
|
+
}
|
|
2583
|
+
var qt, wr;
|
|
2584
|
+
function ts() {
|
|
2585
|
+
if (wr) return qt;
|
|
2586
|
+
wr = 1;
|
|
2587
|
+
const { isUUID: e } = Pn(), t = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu, m = (
|
|
2588
|
+
/** @type {const} */
|
|
2589
|
+
[
|
|
2590
|
+
"http",
|
|
2591
|
+
"https",
|
|
2592
|
+
"ws",
|
|
2593
|
+
"wss",
|
|
2594
|
+
"urn",
|
|
2595
|
+
"urn:uuid"
|
|
2596
|
+
]
|
|
2597
|
+
);
|
|
2598
|
+
function c(n) {
|
|
2599
|
+
return m.indexOf(
|
|
2600
|
+
/** @type {*} */
|
|
2601
|
+
n
|
|
2602
|
+
) !== -1;
|
|
2603
|
+
}
|
|
2604
|
+
function b(n) {
|
|
2605
|
+
return n.secure === !0 ? !0 : n.secure === !1 ? !1 : n.scheme ? n.scheme.length === 3 && (n.scheme[0] === "w" || n.scheme[0] === "W") && (n.scheme[1] === "s" || n.scheme[1] === "S") && (n.scheme[2] === "s" || n.scheme[2] === "S") : !1;
|
|
2606
|
+
}
|
|
2607
|
+
function s(n) {
|
|
2608
|
+
return n.host || (n.error = n.error || "HTTP URIs must have a host."), n;
|
|
2609
|
+
}
|
|
2610
|
+
function l(n) {
|
|
2611
|
+
const f = String(n.scheme).toLowerCase() === "https";
|
|
2612
|
+
return (n.port === (f ? 443 : 80) || n.port === "") && (n.port = void 0), n.path || (n.path = "/"), n;
|
|
2613
|
+
}
|
|
2614
|
+
function u(n) {
|
|
2615
|
+
return n.secure = b(n), n.resourceName = (n.path || "/") + (n.query ? "?" + n.query : ""), n.path = void 0, n.query = void 0, n;
|
|
2616
|
+
}
|
|
2617
|
+
function h(n) {
|
|
2618
|
+
if ((n.port === (b(n) ? 443 : 80) || n.port === "") && (n.port = void 0), typeof n.secure == "boolean" && (n.scheme = n.secure ? "wss" : "ws", n.secure = void 0), n.resourceName) {
|
|
2619
|
+
const [f, S] = n.resourceName.split("?");
|
|
2620
|
+
n.path = f && f !== "/" ? f : void 0, n.query = S, n.resourceName = void 0;
|
|
2621
|
+
}
|
|
2622
|
+
return n.fragment = void 0, n;
|
|
2623
|
+
}
|
|
2624
|
+
function $(n, f) {
|
|
2625
|
+
if (!n.path)
|
|
2626
|
+
return n.error = "URN can not be parsed", n;
|
|
2627
|
+
const S = n.path.match(t);
|
|
2628
|
+
if (S) {
|
|
2629
|
+
const T = f.scheme || n.scheme || "urn";
|
|
2630
|
+
n.nid = S[1].toLowerCase(), n.nss = S[2];
|
|
2631
|
+
const j = `${T}:${f.nid || n.nid}`, D = p(j);
|
|
2632
|
+
n.path = void 0, D && (n = D.parse(n, f));
|
|
2633
|
+
} else
|
|
2634
|
+
n.error = n.error || "URN can not be parsed.";
|
|
2635
|
+
return n;
|
|
2636
|
+
}
|
|
2637
|
+
function v(n, f) {
|
|
2638
|
+
if (n.nid === void 0)
|
|
2639
|
+
throw new Error("URN without nid cannot be serialized");
|
|
2640
|
+
const S = f.scheme || n.scheme || "urn", T = n.nid.toLowerCase(), j = `${S}:${f.nid || T}`, D = p(j);
|
|
2641
|
+
D && (n = D.serialize(n, f));
|
|
2642
|
+
const z = n, V = n.nss;
|
|
2643
|
+
return z.path = `${T || f.nid}:${V}`, f.skipEscape = !0, z;
|
|
2644
|
+
}
|
|
2645
|
+
function P(n, f) {
|
|
2646
|
+
const S = n;
|
|
2647
|
+
return S.uuid = S.nss, S.nss = void 0, !f.tolerant && (!S.uuid || !e(S.uuid)) && (S.error = S.error || "UUID is not valid."), S;
|
|
2648
|
+
}
|
|
2649
|
+
function _(n) {
|
|
2650
|
+
const f = n;
|
|
2651
|
+
return f.nss = (n.uuid || "").toLowerCase(), f;
|
|
2652
|
+
}
|
|
2653
|
+
const y = (
|
|
2654
|
+
/** @type {SchemeHandler} */
|
|
2655
|
+
{
|
|
2656
|
+
scheme: "http",
|
|
2657
|
+
domainHost: !0,
|
|
2658
|
+
parse: s,
|
|
2659
|
+
serialize: l
|
|
2660
|
+
}
|
|
2661
|
+
), g = (
|
|
2662
|
+
/** @type {SchemeHandler} */
|
|
2663
|
+
{
|
|
2664
|
+
scheme: "https",
|
|
2665
|
+
domainHost: y.domainHost,
|
|
2666
|
+
parse: s,
|
|
2667
|
+
serialize: l
|
|
2668
|
+
}
|
|
2669
|
+
), w = (
|
|
2670
|
+
/** @type {SchemeHandler} */
|
|
2671
|
+
{
|
|
2672
|
+
scheme: "ws",
|
|
2673
|
+
domainHost: !0,
|
|
2674
|
+
parse: u,
|
|
2675
|
+
serialize: h
|
|
2676
|
+
}
|
|
2677
|
+
), a = (
|
|
2678
|
+
/** @type {SchemeHandler} */
|
|
2679
|
+
{
|
|
2680
|
+
scheme: "wss",
|
|
2681
|
+
domainHost: w.domainHost,
|
|
2682
|
+
parse: w.parse,
|
|
2683
|
+
serialize: w.serialize
|
|
2684
|
+
}
|
|
2685
|
+
), o = (
|
|
2686
|
+
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
2687
|
+
{
|
|
2688
|
+
http: y,
|
|
2689
|
+
https: g,
|
|
2690
|
+
ws: w,
|
|
2691
|
+
wss: a,
|
|
2692
|
+
urn: (
|
|
2693
|
+
/** @type {SchemeHandler} */
|
|
2694
|
+
{
|
|
2695
|
+
scheme: "urn",
|
|
2696
|
+
parse: $,
|
|
2697
|
+
serialize: v,
|
|
2698
|
+
skipNormalize: !0
|
|
2699
|
+
}
|
|
2700
|
+
),
|
|
2701
|
+
"urn:uuid": (
|
|
2702
|
+
/** @type {SchemeHandler} */
|
|
2703
|
+
{
|
|
2704
|
+
scheme: "urn:uuid",
|
|
2705
|
+
parse: P,
|
|
2706
|
+
serialize: _,
|
|
2707
|
+
skipNormalize: !0
|
|
2708
|
+
}
|
|
2709
|
+
)
|
|
2710
|
+
}
|
|
2711
|
+
);
|
|
2712
|
+
Object.setPrototypeOf(o, null);
|
|
2713
|
+
function p(n) {
|
|
2714
|
+
return n && (o[
|
|
2715
|
+
/** @type {SchemeName} */
|
|
2716
|
+
n
|
|
2717
|
+
] || o[
|
|
2718
|
+
/** @type {SchemeName} */
|
|
2719
|
+
n.toLowerCase()
|
|
2720
|
+
]) || void 0;
|
|
2721
|
+
}
|
|
2722
|
+
return qt = {
|
|
2723
|
+
wsIsSecure: b,
|
|
2724
|
+
SCHEMES: o,
|
|
2725
|
+
isValidSchemeName: c,
|
|
2726
|
+
getSchemeHandler: p
|
|
2727
|
+
}, qt;
|
|
2728
|
+
}
|
|
2729
|
+
var br;
|
|
2730
|
+
function rs() {
|
|
2731
|
+
if (br) return Re.exports;
|
|
2732
|
+
br = 1;
|
|
2733
|
+
const { normalizeIPv6: e, removeDotSegments: t, recomposeAuthority: m, normalizeComponentEncoding: c, isIPv4: b, nonSimpleDomain: s } = Pn(), { SCHEMES: l, getSchemeHandler: u } = ts();
|
|
2734
|
+
function h(a, i) {
|
|
2735
|
+
return typeof a == "string" ? a = /** @type {T} */
|
|
2736
|
+
_(g(a, i), i) : typeof a == "object" && (a = /** @type {T} */
|
|
2737
|
+
g(_(a, i), i)), a;
|
|
2738
|
+
}
|
|
2739
|
+
function $(a, i, r) {
|
|
2740
|
+
const o = r ? Object.assign({ scheme: "null" }, r) : { scheme: "null" }, p = v(g(a, o), g(i, o), o, !0);
|
|
2741
|
+
return o.skipEscape = !0, _(p, o);
|
|
2742
|
+
}
|
|
2743
|
+
function v(a, i, r, o) {
|
|
2744
|
+
const p = {};
|
|
2745
|
+
return o || (a = g(_(a, r), r), i = g(_(i, r), r)), r = r || {}, !r.tolerant && i.scheme ? (p.scheme = i.scheme, p.userinfo = i.userinfo, p.host = i.host, p.port = i.port, p.path = t(i.path || ""), p.query = i.query) : (i.userinfo !== void 0 || i.host !== void 0 || i.port !== void 0 ? (p.userinfo = i.userinfo, p.host = i.host, p.port = i.port, p.path = t(i.path || ""), p.query = i.query) : (i.path ? (i.path[0] === "/" ? p.path = t(i.path) : ((a.userinfo !== void 0 || a.host !== void 0 || a.port !== void 0) && !a.path ? p.path = "/" + i.path : a.path ? p.path = a.path.slice(0, a.path.lastIndexOf("/") + 1) + i.path : p.path = i.path, p.path = t(p.path)), p.query = i.query) : (p.path = a.path, i.query !== void 0 ? p.query = i.query : p.query = a.query), p.userinfo = a.userinfo, p.host = a.host, p.port = a.port), p.scheme = a.scheme), p.fragment = i.fragment, p;
|
|
2746
|
+
}
|
|
2747
|
+
function P(a, i, r) {
|
|
2748
|
+
return typeof a == "string" ? (a = unescape(a), a = _(c(g(a, r), !0), { ...r, skipEscape: !0 })) : typeof a == "object" && (a = _(c(a, !0), { ...r, skipEscape: !0 })), typeof i == "string" ? (i = unescape(i), i = _(c(g(i, r), !0), { ...r, skipEscape: !0 })) : typeof i == "object" && (i = _(c(i, !0), { ...r, skipEscape: !0 })), a.toLowerCase() === i.toLowerCase();
|
|
2749
|
+
}
|
|
2750
|
+
function _(a, i) {
|
|
2751
|
+
const r = {
|
|
2752
|
+
host: a.host,
|
|
2753
|
+
scheme: a.scheme,
|
|
2754
|
+
userinfo: a.userinfo,
|
|
2755
|
+
port: a.port,
|
|
2756
|
+
path: a.path,
|
|
2757
|
+
query: a.query,
|
|
2758
|
+
nid: a.nid,
|
|
2759
|
+
nss: a.nss,
|
|
2760
|
+
uuid: a.uuid,
|
|
2761
|
+
fragment: a.fragment,
|
|
2762
|
+
reference: a.reference,
|
|
2763
|
+
resourceName: a.resourceName,
|
|
2764
|
+
secure: a.secure,
|
|
2765
|
+
error: ""
|
|
2766
|
+
}, o = Object.assign({}, i), p = [], n = u(o.scheme || r.scheme);
|
|
2767
|
+
n && n.serialize && n.serialize(r, o), r.path !== void 0 && (o.skipEscape ? r.path = unescape(r.path) : (r.path = escape(r.path), r.scheme !== void 0 && (r.path = r.path.split("%3A").join(":")))), o.reference !== "suffix" && r.scheme && p.push(r.scheme, ":");
|
|
2768
|
+
const f = m(r);
|
|
2769
|
+
if (f !== void 0 && (o.reference !== "suffix" && p.push("//"), p.push(f), r.path && r.path[0] !== "/" && p.push("/")), r.path !== void 0) {
|
|
2770
|
+
let S = r.path;
|
|
2771
|
+
!o.absolutePath && (!n || !n.absolutePath) && (S = t(S)), f === void 0 && S[0] === "/" && S[1] === "/" && (S = "/%2F" + S.slice(2)), p.push(S);
|
|
2772
|
+
}
|
|
2773
|
+
return r.query !== void 0 && p.push("?", r.query), r.fragment !== void 0 && p.push("#", r.fragment), p.join("");
|
|
2774
|
+
}
|
|
2775
|
+
const y = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
2776
|
+
function g(a, i) {
|
|
2777
|
+
const r = Object.assign({}, i), o = {
|
|
2778
|
+
scheme: void 0,
|
|
2779
|
+
userinfo: void 0,
|
|
2780
|
+
host: "",
|
|
2781
|
+
port: void 0,
|
|
2782
|
+
path: "",
|
|
2783
|
+
query: void 0,
|
|
2784
|
+
fragment: void 0
|
|
2785
|
+
};
|
|
2786
|
+
let p = !1;
|
|
2787
|
+
r.reference === "suffix" && (r.scheme ? a = r.scheme + ":" + a : a = "//" + a);
|
|
2788
|
+
const n = a.match(y);
|
|
2789
|
+
if (n) {
|
|
2790
|
+
if (o.scheme = n[1], o.userinfo = n[3], o.host = n[4], o.port = parseInt(n[5], 10), o.path = n[6] || "", o.query = n[7], o.fragment = n[8], isNaN(o.port) && (o.port = n[5]), o.host)
|
|
2791
|
+
if (b(o.host) === !1) {
|
|
2792
|
+
const T = e(o.host);
|
|
2793
|
+
o.host = T.host.toLowerCase(), p = T.isIPV6;
|
|
2794
|
+
} else
|
|
2795
|
+
p = !0;
|
|
2796
|
+
o.scheme === void 0 && o.userinfo === void 0 && o.host === void 0 && o.port === void 0 && o.query === void 0 && !o.path ? o.reference = "same-document" : o.scheme === void 0 ? o.reference = "relative" : o.fragment === void 0 ? o.reference = "absolute" : o.reference = "uri", r.reference && r.reference !== "suffix" && r.reference !== o.reference && (o.error = o.error || "URI is not a " + r.reference + " reference.");
|
|
2797
|
+
const f = u(r.scheme || o.scheme);
|
|
2798
|
+
if (!r.unicodeSupport && (!f || !f.unicodeSupport) && o.host && (r.domainHost || f && f.domainHost) && p === !1 && s(o.host))
|
|
2799
|
+
try {
|
|
2800
|
+
o.host = URL.domainToASCII(o.host.toLowerCase());
|
|
2801
|
+
} catch (S) {
|
|
2802
|
+
o.error = o.error || "Host's domain name can not be converted to ASCII: " + S;
|
|
2803
|
+
}
|
|
2804
|
+
(!f || f && !f.skipNormalize) && (a.indexOf("%") !== -1 && (o.scheme !== void 0 && (o.scheme = unescape(o.scheme)), o.host !== void 0 && (o.host = unescape(o.host))), o.path && (o.path = escape(unescape(o.path))), o.fragment && (o.fragment = encodeURI(decodeURIComponent(o.fragment)))), f && f.parse && f.parse(o, r);
|
|
2805
|
+
} else
|
|
2806
|
+
o.error = o.error || "URI can not be parsed.";
|
|
2807
|
+
return o;
|
|
2808
|
+
}
|
|
2809
|
+
const w = {
|
|
2810
|
+
SCHEMES: l,
|
|
2811
|
+
normalize: h,
|
|
2812
|
+
resolve: $,
|
|
2813
|
+
resolveComponent: v,
|
|
2814
|
+
equal: P,
|
|
2815
|
+
serialize: _,
|
|
2816
|
+
parse: g
|
|
2817
|
+
};
|
|
2818
|
+
return Re.exports = w, Re.exports.default = w, Re.exports.fastUri = w, Re.exports;
|
|
2819
|
+
}
|
|
2820
|
+
var Sr;
|
|
2821
|
+
function ns() {
|
|
2822
|
+
if (Sr) return Ce;
|
|
2823
|
+
Sr = 1, Object.defineProperty(Ce, "__esModule", { value: !0 });
|
|
2824
|
+
const e = rs();
|
|
2825
|
+
return e.code = 'require("ajv/dist/runtime/uri").default', Ce.default = e, Ce;
|
|
2826
|
+
}
|
|
2827
|
+
var Er;
|
|
2828
|
+
function ss() {
|
|
2829
|
+
return Er || (Er = 1, (function(e) {
|
|
2830
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0;
|
|
2831
|
+
var t = /* @__PURE__ */ $t();
|
|
2832
|
+
Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() {
|
|
2833
|
+
return t.KeywordCxt;
|
|
2834
|
+
} });
|
|
2835
|
+
var m = /* @__PURE__ */ H();
|
|
2836
|
+
Object.defineProperty(e, "_", { enumerable: !0, get: function() {
|
|
2837
|
+
return m._;
|
|
2838
|
+
} }), Object.defineProperty(e, "str", { enumerable: !0, get: function() {
|
|
2839
|
+
return m.str;
|
|
2840
|
+
} }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() {
|
|
2841
|
+
return m.stringify;
|
|
2842
|
+
} }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() {
|
|
2843
|
+
return m.nil;
|
|
2844
|
+
} }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() {
|
|
2845
|
+
return m.Name;
|
|
2846
|
+
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
2847
|
+
return m.CodeGen;
|
|
2848
|
+
} });
|
|
2849
|
+
const c = /* @__PURE__ */ Ut(), b = /* @__PURE__ */ wt(), s = /* @__PURE__ */ bn(), l = /* @__PURE__ */ Lt(), u = /* @__PURE__ */ H(), h = /* @__PURE__ */ _t(), $ = /* @__PURE__ */ gt(), v = /* @__PURE__ */ Y(), P = es, _ = /* @__PURE__ */ ns(), y = (A, N) => new RegExp(A, N);
|
|
2850
|
+
y.code = "new RegExp";
|
|
2851
|
+
const g = ["removeAdditional", "useDefaults", "coerceTypes"], w = /* @__PURE__ */ new Set([
|
|
2852
|
+
"validate",
|
|
2853
|
+
"serialize",
|
|
2854
|
+
"parse",
|
|
2855
|
+
"wrapper",
|
|
2856
|
+
"root",
|
|
2857
|
+
"schema",
|
|
2858
|
+
"keyword",
|
|
2859
|
+
"pattern",
|
|
2860
|
+
"formats",
|
|
2861
|
+
"validate$data",
|
|
2862
|
+
"func",
|
|
2863
|
+
"obj",
|
|
2864
|
+
"Error"
|
|
2865
|
+
]), a = {
|
|
2866
|
+
errorDataPath: "",
|
|
2867
|
+
format: "`validateFormats: false` can be used instead.",
|
|
2868
|
+
nullable: '"nullable" keyword is supported by default.',
|
|
2869
|
+
jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
|
|
2870
|
+
extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
|
|
2871
|
+
missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
|
|
2872
|
+
processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
|
|
2873
|
+
sourceCode: "Use option `code: {source: true}`",
|
|
2874
|
+
strictDefaults: "It is default now, see option `strict`.",
|
|
2875
|
+
strictKeywords: "It is default now, see option `strict`.",
|
|
2876
|
+
uniqueItems: '"uniqueItems" keyword is always validated.',
|
|
2877
|
+
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
2878
|
+
cache: "Map is used as cache, schema object as key.",
|
|
2879
|
+
serialize: "Map is used as cache, schema object as key.",
|
|
2880
|
+
ajvErrors: "It is default now."
|
|
2881
|
+
}, i = {
|
|
2882
|
+
ignoreKeywordsWithRef: "",
|
|
2883
|
+
jsPropertySyntax: "",
|
|
2884
|
+
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
2885
|
+
}, r = 200;
|
|
2886
|
+
function o(A) {
|
|
2887
|
+
var N, C, O, d, E, I, F, K, Z, B, k, R, q, M, L, W, ee, ue, se, ae, te, Se, ie, bt, St;
|
|
2888
|
+
const ke = A.strict, Et = (N = A.code) === null || N === void 0 ? void 0 : N.optimize, Gt = Et === !0 || Et === void 0 ? 1 : Et || 0, Ht = (O = (C = A.code) === null || C === void 0 ? void 0 : C.regExp) !== null && O !== void 0 ? O : y, In = (d = A.uriResolver) !== null && d !== void 0 ? d : _.default;
|
|
2889
|
+
return {
|
|
2890
|
+
strictSchema: (I = (E = A.strictSchema) !== null && E !== void 0 ? E : ke) !== null && I !== void 0 ? I : !0,
|
|
2891
|
+
strictNumbers: (K = (F = A.strictNumbers) !== null && F !== void 0 ? F : ke) !== null && K !== void 0 ? K : !0,
|
|
2892
|
+
strictTypes: (B = (Z = A.strictTypes) !== null && Z !== void 0 ? Z : ke) !== null && B !== void 0 ? B : "log",
|
|
2893
|
+
strictTuples: (R = (k = A.strictTuples) !== null && k !== void 0 ? k : ke) !== null && R !== void 0 ? R : "log",
|
|
2894
|
+
strictRequired: (M = (q = A.strictRequired) !== null && q !== void 0 ? q : ke) !== null && M !== void 0 ? M : !1,
|
|
2895
|
+
code: A.code ? { ...A.code, optimize: Gt, regExp: Ht } : { optimize: Gt, regExp: Ht },
|
|
2896
|
+
loopRequired: (L = A.loopRequired) !== null && L !== void 0 ? L : r,
|
|
2897
|
+
loopEnum: (W = A.loopEnum) !== null && W !== void 0 ? W : r,
|
|
2898
|
+
meta: (ee = A.meta) !== null && ee !== void 0 ? ee : !0,
|
|
2899
|
+
messages: (ue = A.messages) !== null && ue !== void 0 ? ue : !0,
|
|
2900
|
+
inlineRefs: (se = A.inlineRefs) !== null && se !== void 0 ? se : !0,
|
|
2901
|
+
schemaId: (ae = A.schemaId) !== null && ae !== void 0 ? ae : "$id",
|
|
2902
|
+
addUsedSchema: (te = A.addUsedSchema) !== null && te !== void 0 ? te : !0,
|
|
2903
|
+
validateSchema: (Se = A.validateSchema) !== null && Se !== void 0 ? Se : !0,
|
|
2904
|
+
validateFormats: (ie = A.validateFormats) !== null && ie !== void 0 ? ie : !0,
|
|
2905
|
+
unicodeRegExp: (bt = A.unicodeRegExp) !== null && bt !== void 0 ? bt : !0,
|
|
2906
|
+
int32range: (St = A.int32range) !== null && St !== void 0 ? St : !0,
|
|
2907
|
+
uriResolver: In
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
class p {
|
|
2911
|
+
constructor(N = {}) {
|
|
2912
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), N = this.opts = { ...N, ...o(N) };
|
|
2913
|
+
const { es5: C, lines: O } = this.opts.code;
|
|
2914
|
+
this.scope = new u.ValueScope({ scope: {}, prefixes: w, es5: C, lines: O }), this.logger = V(N.logger);
|
|
2915
|
+
const d = N.validateFormats;
|
|
2916
|
+
N.validateFormats = !1, this.RULES = (0, s.getRules)(), n.call(this, a, N, "NOT SUPPORTED"), n.call(this, i, N, "DEPRECATED", "warn"), this._metaOpts = D.call(this), N.formats && T.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), N.keywords && j.call(this, N.keywords), typeof N.meta == "object" && this.addMetaSchema(N.meta), S.call(this), N.validateFormats = d;
|
|
2917
|
+
}
|
|
2918
|
+
_addVocabularies() {
|
|
2919
|
+
this.addKeyword("$async");
|
|
2920
|
+
}
|
|
2921
|
+
_addDefaultMetaSchema() {
|
|
2922
|
+
const { $data: N, meta: C, schemaId: O } = this.opts;
|
|
2923
|
+
let d = P;
|
|
2924
|
+
O === "id" && (d = { ...P }, d.id = d.$id, delete d.$id), C && N && this.addMetaSchema(d, d[O], !1);
|
|
2925
|
+
}
|
|
2926
|
+
defaultMeta() {
|
|
2927
|
+
const { meta: N, schemaId: C } = this.opts;
|
|
2928
|
+
return this.opts.defaultMeta = typeof N == "object" ? N[C] || N : void 0;
|
|
2929
|
+
}
|
|
2930
|
+
validate(N, C) {
|
|
2931
|
+
let O;
|
|
2932
|
+
if (typeof N == "string") {
|
|
2933
|
+
if (O = this.getSchema(N), !O)
|
|
2934
|
+
throw new Error(`no schema with key or ref "${N}"`);
|
|
2935
|
+
} else
|
|
2936
|
+
O = this.compile(N);
|
|
2937
|
+
const d = O(C);
|
|
2938
|
+
return "$async" in O || (this.errors = O.errors), d;
|
|
2939
|
+
}
|
|
2940
|
+
compile(N, C) {
|
|
2941
|
+
const O = this._addSchema(N, C);
|
|
2942
|
+
return O.validate || this._compileSchemaEnv(O);
|
|
2943
|
+
}
|
|
2944
|
+
compileAsync(N, C) {
|
|
2945
|
+
if (typeof this.opts.loadSchema != "function")
|
|
2946
|
+
throw new Error("options.loadSchema should be a function");
|
|
2947
|
+
const { loadSchema: O } = this.opts;
|
|
2948
|
+
return d.call(this, N, C);
|
|
2949
|
+
async function d(B, k) {
|
|
2950
|
+
await E.call(this, B.$schema);
|
|
2951
|
+
const R = this._addSchema(B, k);
|
|
2952
|
+
return R.validate || I.call(this, R);
|
|
2953
|
+
}
|
|
2954
|
+
async function E(B) {
|
|
2955
|
+
B && !this.getSchema(B) && await d.call(this, { $ref: B }, !0);
|
|
2956
|
+
}
|
|
2957
|
+
async function I(B) {
|
|
2958
|
+
try {
|
|
2959
|
+
return this._compileSchemaEnv(B);
|
|
2960
|
+
} catch (k) {
|
|
2961
|
+
if (!(k instanceof b.default))
|
|
2962
|
+
throw k;
|
|
2963
|
+
return F.call(this, k), await K.call(this, k.missingSchema), I.call(this, B);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
function F({ missingSchema: B, missingRef: k }) {
|
|
2967
|
+
if (this.refs[B])
|
|
2968
|
+
throw new Error(`AnySchema ${B} is loaded but ${k} cannot be resolved`);
|
|
2969
|
+
}
|
|
2970
|
+
async function K(B) {
|
|
2971
|
+
const k = await Z.call(this, B);
|
|
2972
|
+
this.refs[B] || await E.call(this, k.$schema), this.refs[B] || this.addSchema(k, B, C);
|
|
2973
|
+
}
|
|
2974
|
+
async function Z(B) {
|
|
2975
|
+
const k = this._loading[B];
|
|
2976
|
+
if (k)
|
|
2977
|
+
return k;
|
|
2978
|
+
try {
|
|
2979
|
+
return await (this._loading[B] = O(B));
|
|
2980
|
+
} finally {
|
|
2981
|
+
delete this._loading[B];
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
// Adds schema to the instance
|
|
2986
|
+
addSchema(N, C, O, d = this.opts.validateSchema) {
|
|
2987
|
+
if (Array.isArray(N)) {
|
|
2988
|
+
for (const I of N)
|
|
2989
|
+
this.addSchema(I, void 0, O, d);
|
|
2990
|
+
return this;
|
|
2991
|
+
}
|
|
2992
|
+
let E;
|
|
2993
|
+
if (typeof N == "object") {
|
|
2994
|
+
const { schemaId: I } = this.opts;
|
|
2995
|
+
if (E = N[I], E !== void 0 && typeof E != "string")
|
|
2996
|
+
throw new Error(`schema ${I} must be string`);
|
|
2997
|
+
}
|
|
2998
|
+
return C = (0, h.normalizeId)(C || E), this._checkUnique(C), this.schemas[C] = this._addSchema(N, O, C, d, !0), this;
|
|
2999
|
+
}
|
|
3000
|
+
// Add schema that will be used to validate other schemas
|
|
3001
|
+
// options in META_IGNORE_OPTIONS are alway set to false
|
|
3002
|
+
addMetaSchema(N, C, O = this.opts.validateSchema) {
|
|
3003
|
+
return this.addSchema(N, C, !0, O), this;
|
|
3004
|
+
}
|
|
3005
|
+
// Validate schema against its meta-schema
|
|
3006
|
+
validateSchema(N, C) {
|
|
3007
|
+
if (typeof N == "boolean")
|
|
3008
|
+
return !0;
|
|
3009
|
+
let O;
|
|
3010
|
+
if (O = N.$schema, O !== void 0 && typeof O != "string")
|
|
3011
|
+
throw new Error("$schema must be a string");
|
|
3012
|
+
if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O)
|
|
3013
|
+
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
3014
|
+
const d = this.validate(O, N);
|
|
3015
|
+
if (!d && C) {
|
|
3016
|
+
const E = "schema is invalid: " + this.errorsText();
|
|
3017
|
+
if (this.opts.validateSchema === "log")
|
|
3018
|
+
this.logger.error(E);
|
|
3019
|
+
else
|
|
3020
|
+
throw new Error(E);
|
|
3021
|
+
}
|
|
3022
|
+
return d;
|
|
3023
|
+
}
|
|
3024
|
+
// Get compiled schema by `key` or `ref`.
|
|
3025
|
+
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
3026
|
+
getSchema(N) {
|
|
3027
|
+
let C;
|
|
3028
|
+
for (; typeof (C = f.call(this, N)) == "string"; )
|
|
3029
|
+
N = C;
|
|
3030
|
+
if (C === void 0) {
|
|
3031
|
+
const { schemaId: O } = this.opts, d = new l.SchemaEnv({ schema: {}, schemaId: O });
|
|
3032
|
+
if (C = l.resolveSchema.call(this, d, N), !C)
|
|
3033
|
+
return;
|
|
3034
|
+
this.refs[N] = C;
|
|
3035
|
+
}
|
|
3036
|
+
return C.validate || this._compileSchemaEnv(C);
|
|
3037
|
+
}
|
|
3038
|
+
// Remove cached schema(s).
|
|
3039
|
+
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
3040
|
+
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
3041
|
+
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
3042
|
+
removeSchema(N) {
|
|
3043
|
+
if (N instanceof RegExp)
|
|
3044
|
+
return this._removeAllSchemas(this.schemas, N), this._removeAllSchemas(this.refs, N), this;
|
|
3045
|
+
switch (typeof N) {
|
|
3046
|
+
case "undefined":
|
|
3047
|
+
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
3048
|
+
case "string": {
|
|
3049
|
+
const C = f.call(this, N);
|
|
3050
|
+
return typeof C == "object" && this._cache.delete(C.schema), delete this.schemas[N], delete this.refs[N], this;
|
|
3051
|
+
}
|
|
3052
|
+
case "object": {
|
|
3053
|
+
const C = N;
|
|
3054
|
+
this._cache.delete(C);
|
|
3055
|
+
let O = N[this.opts.schemaId];
|
|
3056
|
+
return O && (O = (0, h.normalizeId)(O), delete this.schemas[O], delete this.refs[O]), this;
|
|
3057
|
+
}
|
|
3058
|
+
default:
|
|
3059
|
+
throw new Error("ajv.removeSchema: invalid parameter");
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
// add "vocabulary" - a collection of keywords
|
|
3063
|
+
addVocabulary(N) {
|
|
3064
|
+
for (const C of N)
|
|
3065
|
+
this.addKeyword(C);
|
|
3066
|
+
return this;
|
|
3067
|
+
}
|
|
3068
|
+
addKeyword(N, C) {
|
|
3069
|
+
let O;
|
|
3070
|
+
if (typeof N == "string")
|
|
3071
|
+
O = N, typeof C == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), C.keyword = O);
|
|
3072
|
+
else if (typeof N == "object" && C === void 0) {
|
|
3073
|
+
if (C = N, O = C.keyword, Array.isArray(O) && !O.length)
|
|
3074
|
+
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
3075
|
+
} else
|
|
3076
|
+
throw new Error("invalid addKeywords parameters");
|
|
3077
|
+
if (J.call(this, O, C), !C)
|
|
3078
|
+
return (0, v.eachItem)(O, (E) => x.call(this, E)), this;
|
|
3079
|
+
he.call(this, C);
|
|
3080
|
+
const d = {
|
|
3081
|
+
...C,
|
|
3082
|
+
type: (0, $.getJSONTypes)(C.type),
|
|
3083
|
+
schemaType: (0, $.getJSONTypes)(C.schemaType)
|
|
3084
|
+
};
|
|
3085
|
+
return (0, v.eachItem)(O, d.type.length === 0 ? (E) => x.call(this, E, d) : (E) => d.type.forEach((I) => x.call(this, E, d, I))), this;
|
|
3086
|
+
}
|
|
3087
|
+
getKeyword(N) {
|
|
3088
|
+
const C = this.RULES.all[N];
|
|
3089
|
+
return typeof C == "object" ? C.definition : !!C;
|
|
3090
|
+
}
|
|
3091
|
+
// Remove keyword
|
|
3092
|
+
removeKeyword(N) {
|
|
3093
|
+
const { RULES: C } = this;
|
|
3094
|
+
delete C.keywords[N], delete C.all[N];
|
|
3095
|
+
for (const O of C.rules) {
|
|
3096
|
+
const d = O.rules.findIndex((E) => E.keyword === N);
|
|
3097
|
+
d >= 0 && O.rules.splice(d, 1);
|
|
3098
|
+
}
|
|
3099
|
+
return this;
|
|
3100
|
+
}
|
|
3101
|
+
// Add format
|
|
3102
|
+
addFormat(N, C) {
|
|
3103
|
+
return typeof C == "string" && (C = new RegExp(C)), this.formats[N] = C, this;
|
|
3104
|
+
}
|
|
3105
|
+
errorsText(N = this.errors, { separator: C = ", ", dataVar: O = "data" } = {}) {
|
|
3106
|
+
return !N || N.length === 0 ? "No errors" : N.map((d) => `${O}${d.instancePath} ${d.message}`).reduce((d, E) => d + C + E);
|
|
3107
|
+
}
|
|
3108
|
+
$dataMetaSchema(N, C) {
|
|
3109
|
+
const O = this.RULES.all;
|
|
3110
|
+
N = JSON.parse(JSON.stringify(N));
|
|
3111
|
+
for (const d of C) {
|
|
3112
|
+
const E = d.split("/").slice(1);
|
|
3113
|
+
let I = N;
|
|
3114
|
+
for (const F of E)
|
|
3115
|
+
I = I[F];
|
|
3116
|
+
for (const F in O) {
|
|
3117
|
+
const K = O[F];
|
|
3118
|
+
if (typeof K != "object")
|
|
3119
|
+
continue;
|
|
3120
|
+
const { $data: Z } = K.definition, B = I[F];
|
|
3121
|
+
Z && B && (I[F] = ge(B));
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
return N;
|
|
3125
|
+
}
|
|
3126
|
+
_removeAllSchemas(N, C) {
|
|
3127
|
+
for (const O in N) {
|
|
3128
|
+
const d = N[O];
|
|
3129
|
+
(!C || C.test(O)) && (typeof d == "string" ? delete N[O] : d && !d.meta && (this._cache.delete(d.schema), delete N[O]));
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
_addSchema(N, C, O, d = this.opts.validateSchema, E = this.opts.addUsedSchema) {
|
|
3133
|
+
let I;
|
|
3134
|
+
const { schemaId: F } = this.opts;
|
|
3135
|
+
if (typeof N == "object")
|
|
3136
|
+
I = N[F];
|
|
3137
|
+
else {
|
|
3138
|
+
if (this.opts.jtd)
|
|
3139
|
+
throw new Error("schema must be object");
|
|
3140
|
+
if (typeof N != "boolean")
|
|
3141
|
+
throw new Error("schema must be object or boolean");
|
|
3142
|
+
}
|
|
3143
|
+
let K = this._cache.get(N);
|
|
3144
|
+
if (K !== void 0)
|
|
3145
|
+
return K;
|
|
3146
|
+
O = (0, h.normalizeId)(I || O);
|
|
3147
|
+
const Z = h.getSchemaRefs.call(this, N, O);
|
|
3148
|
+
return K = new l.SchemaEnv({ schema: N, schemaId: F, meta: C, baseId: O, localRefs: Z }), this._cache.set(K.schema, K), E && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = K), d && this.validateSchema(N, !0), K;
|
|
3149
|
+
}
|
|
3150
|
+
_checkUnique(N) {
|
|
3151
|
+
if (this.schemas[N] || this.refs[N])
|
|
3152
|
+
throw new Error(`schema with key or id "${N}" already exists`);
|
|
3153
|
+
}
|
|
3154
|
+
_compileSchemaEnv(N) {
|
|
3155
|
+
if (N.meta ? this._compileMetaSchema(N) : l.compileSchema.call(this, N), !N.validate)
|
|
3156
|
+
throw new Error("ajv implementation error");
|
|
3157
|
+
return N.validate;
|
|
3158
|
+
}
|
|
3159
|
+
_compileMetaSchema(N) {
|
|
3160
|
+
const C = this.opts;
|
|
3161
|
+
this.opts = this._metaOpts;
|
|
3162
|
+
try {
|
|
3163
|
+
l.compileSchema.call(this, N);
|
|
3164
|
+
} finally {
|
|
3165
|
+
this.opts = C;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
p.ValidationError = c.default, p.MissingRefError = b.default, e.default = p;
|
|
3170
|
+
function n(A, N, C, O = "error") {
|
|
3171
|
+
for (const d in A) {
|
|
3172
|
+
const E = d;
|
|
3173
|
+
E in N && this.logger[O](`${C}: option ${d}. ${A[E]}`);
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
function f(A) {
|
|
3177
|
+
return A = (0, h.normalizeId)(A), this.schemas[A] || this.refs[A];
|
|
3178
|
+
}
|
|
3179
|
+
function S() {
|
|
3180
|
+
const A = this.opts.schemas;
|
|
3181
|
+
if (A)
|
|
3182
|
+
if (Array.isArray(A))
|
|
3183
|
+
this.addSchema(A);
|
|
3184
|
+
else
|
|
3185
|
+
for (const N in A)
|
|
3186
|
+
this.addSchema(A[N], N);
|
|
3187
|
+
}
|
|
3188
|
+
function T() {
|
|
3189
|
+
for (const A in this.opts.formats) {
|
|
3190
|
+
const N = this.opts.formats[A];
|
|
3191
|
+
N && this.addFormat(A, N);
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
function j(A) {
|
|
3195
|
+
if (Array.isArray(A)) {
|
|
3196
|
+
this.addVocabulary(A);
|
|
3197
|
+
return;
|
|
3198
|
+
}
|
|
3199
|
+
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
3200
|
+
for (const N in A) {
|
|
3201
|
+
const C = A[N];
|
|
3202
|
+
C.keyword || (C.keyword = N), this.addKeyword(C);
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
function D() {
|
|
3206
|
+
const A = { ...this.opts };
|
|
3207
|
+
for (const N of g)
|
|
3208
|
+
delete A[N];
|
|
3209
|
+
return A;
|
|
3210
|
+
}
|
|
3211
|
+
const z = { log() {
|
|
3212
|
+
}, warn() {
|
|
3213
|
+
}, error() {
|
|
3214
|
+
} };
|
|
3215
|
+
function V(A) {
|
|
3216
|
+
if (A === !1)
|
|
3217
|
+
return z;
|
|
3218
|
+
if (A === void 0)
|
|
3219
|
+
return console;
|
|
3220
|
+
if (A.log && A.warn && A.error)
|
|
3221
|
+
return A;
|
|
3222
|
+
throw new Error("logger must implement log, warn and error methods");
|
|
3223
|
+
}
|
|
3224
|
+
const U = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
3225
|
+
function J(A, N) {
|
|
3226
|
+
const { RULES: C } = this;
|
|
3227
|
+
if ((0, v.eachItem)(A, (O) => {
|
|
3228
|
+
if (C.keywords[O])
|
|
3229
|
+
throw new Error(`Keyword ${O} is already defined`);
|
|
3230
|
+
if (!U.test(O))
|
|
3231
|
+
throw new Error(`Keyword ${O} has invalid name`);
|
|
3232
|
+
}), !!N && N.$data && !("code" in N || "validate" in N))
|
|
3233
|
+
throw new Error('$data keyword must have "code" or "validate" function');
|
|
3234
|
+
}
|
|
3235
|
+
function x(A, N, C) {
|
|
3236
|
+
var O;
|
|
3237
|
+
const d = N == null ? void 0 : N.post;
|
|
3238
|
+
if (C && d)
|
|
3239
|
+
throw new Error('keyword with "post" flag cannot have "type"');
|
|
3240
|
+
const { RULES: E } = this;
|
|
3241
|
+
let I = d ? E.post : E.rules.find(({ type: K }) => K === C);
|
|
3242
|
+
if (I || (I = { type: C, rules: [] }, E.rules.push(I)), E.keywords[A] = !0, !N)
|
|
3243
|
+
return;
|
|
3244
|
+
const F = {
|
|
3245
|
+
keyword: A,
|
|
3246
|
+
definition: {
|
|
3247
|
+
...N,
|
|
3248
|
+
type: (0, $.getJSONTypes)(N.type),
|
|
3249
|
+
schemaType: (0, $.getJSONTypes)(N.schemaType)
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
N.before ? fe.call(this, I, F, N.before) : I.rules.push(F), E.all[A] = F, (O = N.implements) === null || O === void 0 || O.forEach((K) => this.addKeyword(K));
|
|
3253
|
+
}
|
|
3254
|
+
function fe(A, N, C) {
|
|
3255
|
+
const O = A.rules.findIndex((d) => d.keyword === C);
|
|
3256
|
+
O >= 0 ? A.rules.splice(O, 0, N) : (A.rules.push(N), this.logger.warn(`rule ${C} is not defined`));
|
|
3257
|
+
}
|
|
3258
|
+
function he(A) {
|
|
3259
|
+
let { metaSchema: N } = A;
|
|
3260
|
+
N !== void 0 && (A.$data && this.opts.$data && (N = ge(N)), A.validateSchema = this.compile(N, !0));
|
|
3261
|
+
}
|
|
3262
|
+
const X = {
|
|
3263
|
+
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
3264
|
+
};
|
|
3265
|
+
function ge(A) {
|
|
3266
|
+
return { anyOf: [A, X] };
|
|
3267
|
+
}
|
|
3268
|
+
})(Pt)), Pt;
|
|
3269
|
+
}
|
|
3270
|
+
var De = {}, Ae = {}, Me = {}, Pr;
|
|
3271
|
+
function as() {
|
|
3272
|
+
if (Pr) return Me;
|
|
3273
|
+
Pr = 1, Object.defineProperty(Me, "__esModule", { value: !0 });
|
|
3274
|
+
const e = {
|
|
3275
|
+
keyword: "id",
|
|
3276
|
+
code() {
|
|
3277
|
+
throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
|
|
3278
|
+
}
|
|
3279
|
+
};
|
|
3280
|
+
return Me.default = e, Me;
|
|
3281
|
+
}
|
|
3282
|
+
var ve = {}, kr;
|
|
3283
|
+
function os() {
|
|
3284
|
+
if (kr) return ve;
|
|
3285
|
+
kr = 1, Object.defineProperty(ve, "__esModule", { value: !0 }), ve.callRef = ve.getValidate = void 0;
|
|
3286
|
+
const e = /* @__PURE__ */ wt(), t = /* @__PURE__ */ le(), m = /* @__PURE__ */ H(), c = /* @__PURE__ */ _e(), b = /* @__PURE__ */ Lt(), s = /* @__PURE__ */ Y(), l = {
|
|
3287
|
+
keyword: "$ref",
|
|
3288
|
+
schemaType: "string",
|
|
3289
|
+
code($) {
|
|
3290
|
+
const { gen: v, schema: P, it: _ } = $, { baseId: y, schemaEnv: g, validateName: w, opts: a, self: i } = _, { root: r } = g;
|
|
3291
|
+
if ((P === "#" || P === "#/") && y === r.baseId)
|
|
3292
|
+
return p();
|
|
3293
|
+
const o = b.resolveRef.call(i, r, y, P);
|
|
3294
|
+
if (o === void 0)
|
|
3295
|
+
throw new e.default(_.opts.uriResolver, y, P);
|
|
3296
|
+
if (o instanceof b.SchemaEnv)
|
|
3297
|
+
return n(o);
|
|
3298
|
+
return f(o);
|
|
3299
|
+
function p() {
|
|
3300
|
+
if (g === r)
|
|
3301
|
+
return h($, w, g, g.$async);
|
|
3302
|
+
const S = v.scopeValue("root", { ref: r });
|
|
3303
|
+
return h($, (0, m._)`${S}.validate`, r, r.$async);
|
|
3304
|
+
}
|
|
3305
|
+
function n(S) {
|
|
3306
|
+
const T = u($, S);
|
|
3307
|
+
h($, T, S, S.$async);
|
|
3308
|
+
}
|
|
3309
|
+
function f(S) {
|
|
3310
|
+
const T = v.scopeValue("schema", a.code.source === !0 ? { ref: S, code: (0, m.stringify)(S) } : { ref: S }), j = v.name("valid"), D = $.subschema({
|
|
3311
|
+
schema: S,
|
|
3312
|
+
dataTypes: [],
|
|
3313
|
+
schemaPath: m.nil,
|
|
3314
|
+
topSchemaRef: T,
|
|
3315
|
+
errSchemaPath: P
|
|
3316
|
+
}, j);
|
|
3317
|
+
$.mergeEvaluated(D), $.ok(j);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3321
|
+
function u($, v) {
|
|
3322
|
+
const { gen: P } = $;
|
|
3323
|
+
return v.validate ? P.scopeValue("validate", { ref: v.validate }) : (0, m._)`${P.scopeValue("wrapper", { ref: v })}.validate`;
|
|
3324
|
+
}
|
|
3325
|
+
ve.getValidate = u;
|
|
3326
|
+
function h($, v, P, _) {
|
|
3327
|
+
const { gen: y, it: g } = $, { allErrors: w, schemaEnv: a, opts: i } = g, r = i.passContext ? c.default.this : m.nil;
|
|
3328
|
+
_ ? o() : p();
|
|
3329
|
+
function o() {
|
|
3330
|
+
if (!a.$async)
|
|
3331
|
+
throw new Error("async schema referenced by sync schema");
|
|
3332
|
+
const S = y.let("valid");
|
|
3333
|
+
y.try(() => {
|
|
3334
|
+
y.code((0, m._)`await ${(0, t.callValidateCode)($, v, r)}`), f(v), w || y.assign(S, !0);
|
|
3335
|
+
}, (T) => {
|
|
3336
|
+
y.if((0, m._)`!(${T} instanceof ${g.ValidationError})`, () => y.throw(T)), n(T), w || y.assign(S, !1);
|
|
3337
|
+
}), $.ok(S);
|
|
3338
|
+
}
|
|
3339
|
+
function p() {
|
|
3340
|
+
$.result((0, t.callValidateCode)($, v, r), () => f(v), () => n(v));
|
|
3341
|
+
}
|
|
3342
|
+
function n(S) {
|
|
3343
|
+
const T = (0, m._)`${S}.errors`;
|
|
3344
|
+
y.assign(c.default.vErrors, (0, m._)`${c.default.vErrors} === null ? ${T} : ${c.default.vErrors}.concat(${T})`), y.assign(c.default.errors, (0, m._)`${c.default.vErrors}.length`);
|
|
3345
|
+
}
|
|
3346
|
+
function f(S) {
|
|
3347
|
+
var T;
|
|
3348
|
+
if (!g.opts.unevaluated)
|
|
3349
|
+
return;
|
|
3350
|
+
const j = (T = P == null ? void 0 : P.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
3351
|
+
if (g.props !== !0)
|
|
3352
|
+
if (j && !j.dynamicProps)
|
|
3353
|
+
j.props !== void 0 && (g.props = s.mergeEvaluated.props(y, j.props, g.props));
|
|
3354
|
+
else {
|
|
3355
|
+
const D = y.var("props", (0, m._)`${S}.evaluated.props`);
|
|
3356
|
+
g.props = s.mergeEvaluated.props(y, D, g.props, m.Name);
|
|
3357
|
+
}
|
|
3358
|
+
if (g.items !== !0)
|
|
3359
|
+
if (j && !j.dynamicItems)
|
|
3360
|
+
j.items !== void 0 && (g.items = s.mergeEvaluated.items(y, j.items, g.items));
|
|
3361
|
+
else {
|
|
3362
|
+
const D = y.var("items", (0, m._)`${S}.evaluated.items`);
|
|
3363
|
+
g.items = s.mergeEvaluated.items(y, D, g.items, m.Name);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
return ve.callRef = h, ve.default = l, ve;
|
|
3368
|
+
}
|
|
3369
|
+
var Nr;
|
|
3370
|
+
function is() {
|
|
3371
|
+
if (Nr) return Ae;
|
|
3372
|
+
Nr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 });
|
|
3373
|
+
const e = /* @__PURE__ */ as(), t = /* @__PURE__ */ os(), m = [
|
|
3374
|
+
"$schema",
|
|
3375
|
+
"$id",
|
|
3376
|
+
"$defs",
|
|
3377
|
+
"$vocabulary",
|
|
3378
|
+
{ keyword: "$comment" },
|
|
3379
|
+
"definitions",
|
|
3380
|
+
e.default,
|
|
3381
|
+
t.default
|
|
3382
|
+
];
|
|
3383
|
+
return Ae.default = m, Ae;
|
|
3384
|
+
}
|
|
3385
|
+
var ze = {}, Ve = {}, Rr;
|
|
3386
|
+
function us() {
|
|
3387
|
+
if (Rr) return Ve;
|
|
3388
|
+
Rr = 1, Object.defineProperty(Ve, "__esModule", { value: !0 });
|
|
3389
|
+
const e = /* @__PURE__ */ H(), t = e.operators, m = {
|
|
3390
|
+
maximum: { okStr: "<=", ok: t.LTE, fail: t.GT },
|
|
3391
|
+
minimum: { okStr: ">=", ok: t.GTE, fail: t.LT },
|
|
3392
|
+
exclusiveMaximum: { okStr: "<", ok: t.LT, fail: t.GTE },
|
|
3393
|
+
exclusiveMinimum: { okStr: ">", ok: t.GT, fail: t.LTE }
|
|
3394
|
+
}, c = {
|
|
3395
|
+
message: ({ keyword: s, schemaCode: l }) => (0, e.str)`must be ${m[s].okStr} ${l}`,
|
|
3396
|
+
params: ({ keyword: s, schemaCode: l }) => (0, e._)`{comparison: ${m[s].okStr}, limit: ${l}}`
|
|
3397
|
+
}, b = {
|
|
3398
|
+
keyword: Object.keys(m),
|
|
3399
|
+
type: "number",
|
|
3400
|
+
schemaType: "number",
|
|
3401
|
+
$data: !0,
|
|
3402
|
+
error: c,
|
|
3403
|
+
code(s) {
|
|
3404
|
+
const { keyword: l, data: u, schemaCode: h } = s;
|
|
3405
|
+
s.fail$data((0, e._)`${u} ${m[l].fail} ${h} || isNaN(${u})`);
|
|
3406
|
+
}
|
|
3407
|
+
};
|
|
3408
|
+
return Ve.default = b, Ve;
|
|
3409
|
+
}
|
|
3410
|
+
var Fe = {}, Or;
|
|
3411
|
+
function cs() {
|
|
3412
|
+
if (Or) return Fe;
|
|
3413
|
+
Or = 1, Object.defineProperty(Fe, "__esModule", { value: !0 });
|
|
3414
|
+
const e = /* @__PURE__ */ H(), m = {
|
|
3415
|
+
keyword: "multipleOf",
|
|
3416
|
+
type: "number",
|
|
3417
|
+
schemaType: "number",
|
|
3418
|
+
$data: !0,
|
|
3419
|
+
error: {
|
|
3420
|
+
message: ({ schemaCode: c }) => (0, e.str)`must be multiple of ${c}`,
|
|
3421
|
+
params: ({ schemaCode: c }) => (0, e._)`{multipleOf: ${c}}`
|
|
3422
|
+
},
|
|
3423
|
+
code(c) {
|
|
3424
|
+
const { gen: b, data: s, schemaCode: l, it: u } = c, h = u.opts.multipleOfPrecision, $ = b.let("res"), v = h ? (0, e._)`Math.abs(Math.round(${$}) - ${$}) > 1e-${h}` : (0, e._)`${$} !== parseInt(${$})`;
|
|
3425
|
+
c.fail$data((0, e._)`(${l} === 0 || (${$} = ${s}/${l}, ${v}))`);
|
|
3426
|
+
}
|
|
3427
|
+
};
|
|
3428
|
+
return Fe.default = m, Fe;
|
|
3429
|
+
}
|
|
3430
|
+
var Ue = {}, Le = {}, Tr;
|
|
3431
|
+
function ds() {
|
|
3432
|
+
if (Tr) return Le;
|
|
3433
|
+
Tr = 1, Object.defineProperty(Le, "__esModule", { value: !0 });
|
|
3434
|
+
function e(t) {
|
|
3435
|
+
const m = t.length;
|
|
3436
|
+
let c = 0, b = 0, s;
|
|
3437
|
+
for (; b < m; )
|
|
3438
|
+
c++, s = t.charCodeAt(b++), s >= 55296 && s <= 56319 && b < m && (s = t.charCodeAt(b), (s & 64512) === 56320 && b++);
|
|
3439
|
+
return c;
|
|
3440
|
+
}
|
|
3441
|
+
return Le.default = e, e.code = 'require("ajv/dist/runtime/ucs2length").default', Le;
|
|
3442
|
+
}
|
|
3443
|
+
var jr;
|
|
3444
|
+
function ls() {
|
|
3445
|
+
if (jr) return Ue;
|
|
3446
|
+
jr = 1, Object.defineProperty(Ue, "__esModule", { value: !0 });
|
|
3447
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ ds(), b = {
|
|
3448
|
+
keyword: ["maxLength", "minLength"],
|
|
3449
|
+
type: "string",
|
|
3450
|
+
schemaType: "number",
|
|
3451
|
+
$data: !0,
|
|
3452
|
+
error: {
|
|
3453
|
+
message({ keyword: s, schemaCode: l }) {
|
|
3454
|
+
const u = s === "maxLength" ? "more" : "fewer";
|
|
3455
|
+
return (0, e.str)`must NOT have ${u} than ${l} characters`;
|
|
3456
|
+
},
|
|
3457
|
+
params: ({ schemaCode: s }) => (0, e._)`{limit: ${s}}`
|
|
3458
|
+
},
|
|
3459
|
+
code(s) {
|
|
3460
|
+
const { keyword: l, data: u, schemaCode: h, it: $ } = s, v = l === "maxLength" ? e.operators.GT : e.operators.LT, P = $.opts.unicode === !1 ? (0, e._)`${u}.length` : (0, e._)`${(0, t.useFunc)(s.gen, m.default)}(${u})`;
|
|
3461
|
+
s.fail$data((0, e._)`${P} ${v} ${h}`);
|
|
3462
|
+
}
|
|
3463
|
+
};
|
|
3464
|
+
return Ue.default = b, Ue;
|
|
3465
|
+
}
|
|
3466
|
+
var Ke = {}, Ir;
|
|
3467
|
+
function fs() {
|
|
3468
|
+
if (Ir) return Ke;
|
|
3469
|
+
Ir = 1, Object.defineProperty(Ke, "__esModule", { value: !0 });
|
|
3470
|
+
const e = /* @__PURE__ */ le(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ H(), b = {
|
|
3471
|
+
keyword: "pattern",
|
|
3472
|
+
type: "string",
|
|
3473
|
+
schemaType: "string",
|
|
3474
|
+
$data: !0,
|
|
3475
|
+
error: {
|
|
3476
|
+
message: ({ schemaCode: s }) => (0, m.str)`must match pattern "${s}"`,
|
|
3477
|
+
params: ({ schemaCode: s }) => (0, m._)`{pattern: ${s}}`
|
|
3478
|
+
},
|
|
3479
|
+
code(s) {
|
|
3480
|
+
const { gen: l, data: u, $data: h, schema: $, schemaCode: v, it: P } = s, _ = P.opts.unicodeRegExp ? "u" : "";
|
|
3481
|
+
if (h) {
|
|
3482
|
+
const { regExp: y } = P.opts.code, g = y.code === "new RegExp" ? (0, m._)`new RegExp` : (0, t.useFunc)(l, y), w = l.let("valid");
|
|
3483
|
+
l.try(() => l.assign(w, (0, m._)`${g}(${v}, ${_}).test(${u})`), () => l.assign(w, !1)), s.fail$data((0, m._)`!${w}`);
|
|
3484
|
+
} else {
|
|
3485
|
+
const y = (0, e.usePattern)(s, $);
|
|
3486
|
+
s.fail$data((0, m._)`!${y}.test(${u})`);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
};
|
|
3490
|
+
return Ke.default = b, Ke;
|
|
3491
|
+
}
|
|
3492
|
+
var Ge = {}, qr;
|
|
3493
|
+
function hs() {
|
|
3494
|
+
if (qr) return Ge;
|
|
3495
|
+
qr = 1, Object.defineProperty(Ge, "__esModule", { value: !0 });
|
|
3496
|
+
const e = /* @__PURE__ */ H(), m = {
|
|
3497
|
+
keyword: ["maxProperties", "minProperties"],
|
|
3498
|
+
type: "object",
|
|
3499
|
+
schemaType: "number",
|
|
3500
|
+
$data: !0,
|
|
3501
|
+
error: {
|
|
3502
|
+
message({ keyword: c, schemaCode: b }) {
|
|
3503
|
+
const s = c === "maxProperties" ? "more" : "fewer";
|
|
3504
|
+
return (0, e.str)`must NOT have ${s} than ${b} properties`;
|
|
3505
|
+
},
|
|
3506
|
+
params: ({ schemaCode: c }) => (0, e._)`{limit: ${c}}`
|
|
3507
|
+
},
|
|
3508
|
+
code(c) {
|
|
3509
|
+
const { keyword: b, data: s, schemaCode: l } = c, u = b === "maxProperties" ? e.operators.GT : e.operators.LT;
|
|
3510
|
+
c.fail$data((0, e._)`Object.keys(${s}).length ${u} ${l}`);
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
return Ge.default = m, Ge;
|
|
3514
|
+
}
|
|
3515
|
+
var He = {}, Cr;
|
|
3516
|
+
function ms() {
|
|
3517
|
+
if (Cr) return He;
|
|
3518
|
+
Cr = 1, Object.defineProperty(He, "__esModule", { value: !0 });
|
|
3519
|
+
const e = /* @__PURE__ */ le(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), b = {
|
|
3520
|
+
keyword: "required",
|
|
3521
|
+
type: "object",
|
|
3522
|
+
schemaType: "array",
|
|
3523
|
+
$data: !0,
|
|
3524
|
+
error: {
|
|
3525
|
+
message: ({ params: { missingProperty: s } }) => (0, t.str)`must have required property '${s}'`,
|
|
3526
|
+
params: ({ params: { missingProperty: s } }) => (0, t._)`{missingProperty: ${s}}`
|
|
3527
|
+
},
|
|
3528
|
+
code(s) {
|
|
3529
|
+
const { gen: l, schema: u, schemaCode: h, data: $, $data: v, it: P } = s, { opts: _ } = P;
|
|
3530
|
+
if (!v && u.length === 0)
|
|
3531
|
+
return;
|
|
3532
|
+
const y = u.length >= _.loopRequired;
|
|
3533
|
+
if (P.allErrors ? g() : w(), _.strictRequired) {
|
|
3534
|
+
const r = s.parentSchema.properties, { definedProperties: o } = s.it;
|
|
3535
|
+
for (const p of u)
|
|
3536
|
+
if ((r == null ? void 0 : r[p]) === void 0 && !o.has(p)) {
|
|
3537
|
+
const n = P.schemaEnv.baseId + P.errSchemaPath, f = `required property "${p}" is not defined at "${n}" (strictRequired)`;
|
|
3538
|
+
(0, m.checkStrictMode)(P, f, P.opts.strictRequired);
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
function g() {
|
|
3542
|
+
if (y || v)
|
|
3543
|
+
s.block$data(t.nil, a);
|
|
3544
|
+
else
|
|
3545
|
+
for (const r of u)
|
|
3546
|
+
(0, e.checkReportMissingProp)(s, r);
|
|
3547
|
+
}
|
|
3548
|
+
function w() {
|
|
3549
|
+
const r = l.let("missing");
|
|
3550
|
+
if (y || v) {
|
|
3551
|
+
const o = l.let("valid", !0);
|
|
3552
|
+
s.block$data(o, () => i(r, o)), s.ok(o);
|
|
3553
|
+
} else
|
|
3554
|
+
l.if((0, e.checkMissingProp)(s, u, r)), (0, e.reportMissingProp)(s, r), l.else();
|
|
3555
|
+
}
|
|
3556
|
+
function a() {
|
|
3557
|
+
l.forOf("prop", h, (r) => {
|
|
3558
|
+
s.setParams({ missingProperty: r }), l.if((0, e.noPropertyInData)(l, $, r, _.ownProperties), () => s.error());
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
function i(r, o) {
|
|
3562
|
+
s.setParams({ missingProperty: r }), l.forOf(r, h, () => {
|
|
3563
|
+
l.assign(o, (0, e.propertyInData)(l, $, r, _.ownProperties)), l.if((0, t.not)(o), () => {
|
|
3564
|
+
s.error(), l.break();
|
|
3565
|
+
});
|
|
3566
|
+
}, t.nil);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
};
|
|
3570
|
+
return He.default = b, He;
|
|
3571
|
+
}
|
|
3572
|
+
var Je = {}, Dr;
|
|
3573
|
+
function ps() {
|
|
3574
|
+
if (Dr) return Je;
|
|
3575
|
+
Dr = 1, Object.defineProperty(Je, "__esModule", { value: !0 });
|
|
3576
|
+
const e = /* @__PURE__ */ H(), m = {
|
|
3577
|
+
keyword: ["maxItems", "minItems"],
|
|
3578
|
+
type: "array",
|
|
3579
|
+
schemaType: "number",
|
|
3580
|
+
$data: !0,
|
|
3581
|
+
error: {
|
|
3582
|
+
message({ keyword: c, schemaCode: b }) {
|
|
3583
|
+
const s = c === "maxItems" ? "more" : "fewer";
|
|
3584
|
+
return (0, e.str)`must NOT have ${s} than ${b} items`;
|
|
3585
|
+
},
|
|
3586
|
+
params: ({ schemaCode: c }) => (0, e._)`{limit: ${c}}`
|
|
3587
|
+
},
|
|
3588
|
+
code(c) {
|
|
3589
|
+
const { keyword: b, data: s, schemaCode: l } = c, u = b === "maxItems" ? e.operators.GT : e.operators.LT;
|
|
3590
|
+
c.fail$data((0, e._)`${s}.length ${u} ${l}`);
|
|
3591
|
+
}
|
|
3592
|
+
};
|
|
3593
|
+
return Je.default = m, Je;
|
|
3594
|
+
}
|
|
3595
|
+
var We = {}, Be = {}, Ar;
|
|
3596
|
+
function Kt() {
|
|
3597
|
+
if (Ar) return Be;
|
|
3598
|
+
Ar = 1, Object.defineProperty(Be, "__esModule", { value: !0 });
|
|
3599
|
+
const e = En();
|
|
3600
|
+
return e.code = 'require("ajv/dist/runtime/equal").default', Be.default = e, Be;
|
|
3601
|
+
}
|
|
3602
|
+
var Mr;
|
|
3603
|
+
function ys() {
|
|
3604
|
+
if (Mr) return We;
|
|
3605
|
+
Mr = 1, Object.defineProperty(We, "__esModule", { value: !0 });
|
|
3606
|
+
const e = /* @__PURE__ */ gt(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ Kt(), s = {
|
|
3607
|
+
keyword: "uniqueItems",
|
|
3608
|
+
type: "array",
|
|
3609
|
+
schemaType: "boolean",
|
|
3610
|
+
$data: !0,
|
|
3611
|
+
error: {
|
|
3612
|
+
message: ({ params: { i: l, j: u } }) => (0, t.str)`must NOT have duplicate items (items ## ${u} and ${l} are identical)`,
|
|
3613
|
+
params: ({ params: { i: l, j: u } }) => (0, t._)`{i: ${l}, j: ${u}}`
|
|
3614
|
+
},
|
|
3615
|
+
code(l) {
|
|
3616
|
+
const { gen: u, data: h, $data: $, schema: v, parentSchema: P, schemaCode: _, it: y } = l;
|
|
3617
|
+
if (!$ && !v)
|
|
3618
|
+
return;
|
|
3619
|
+
const g = u.let("valid"), w = P.items ? (0, e.getSchemaTypes)(P.items) : [];
|
|
3620
|
+
l.block$data(g, a, (0, t._)`${_} === false`), l.ok(g);
|
|
3621
|
+
function a() {
|
|
3622
|
+
const p = u.let("i", (0, t._)`${h}.length`), n = u.let("j");
|
|
3623
|
+
l.setParams({ i: p, j: n }), u.assign(g, !0), u.if((0, t._)`${p} > 1`, () => (i() ? r : o)(p, n));
|
|
3624
|
+
}
|
|
3625
|
+
function i() {
|
|
3626
|
+
return w.length > 0 && !w.some((p) => p === "object" || p === "array");
|
|
3627
|
+
}
|
|
3628
|
+
function r(p, n) {
|
|
3629
|
+
const f = u.name("item"), S = (0, e.checkDataTypes)(w, f, y.opts.strictNumbers, e.DataType.Wrong), T = u.const("indices", (0, t._)`{}`);
|
|
3630
|
+
u.for((0, t._)`;${p}--;`, () => {
|
|
3631
|
+
u.let(f, (0, t._)`${h}[${p}]`), u.if(S, (0, t._)`continue`), w.length > 1 && u.if((0, t._)`typeof ${f} == "string"`, (0, t._)`${f} += "_"`), u.if((0, t._)`typeof ${T}[${f}] == "number"`, () => {
|
|
3632
|
+
u.assign(n, (0, t._)`${T}[${f}]`), l.error(), u.assign(g, !1).break();
|
|
3633
|
+
}).code((0, t._)`${T}[${f}] = ${p}`);
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
function o(p, n) {
|
|
3637
|
+
const f = (0, m.useFunc)(u, c.default), S = u.name("outer");
|
|
3638
|
+
u.label(S).for((0, t._)`;${p}--;`, () => u.for((0, t._)`${n} = ${p}; ${n}--;`, () => u.if((0, t._)`${f}(${h}[${p}], ${h}[${n}])`, () => {
|
|
3639
|
+
l.error(), u.assign(g, !1).break(S);
|
|
3640
|
+
})));
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
};
|
|
3644
|
+
return We.default = s, We;
|
|
3645
|
+
}
|
|
3646
|
+
var Ye = {}, zr;
|
|
3647
|
+
function gs() {
|
|
3648
|
+
if (zr) return Ye;
|
|
3649
|
+
zr = 1, Object.defineProperty(Ye, "__esModule", { value: !0 });
|
|
3650
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ Kt(), b = {
|
|
3651
|
+
keyword: "const",
|
|
3652
|
+
$data: !0,
|
|
3653
|
+
error: {
|
|
3654
|
+
message: "must be equal to constant",
|
|
3655
|
+
params: ({ schemaCode: s }) => (0, e._)`{allowedValue: ${s}}`
|
|
3656
|
+
},
|
|
3657
|
+
code(s) {
|
|
3658
|
+
const { gen: l, data: u, $data: h, schemaCode: $, schema: v } = s;
|
|
3659
|
+
h || v && typeof v == "object" ? s.fail$data((0, e._)`!${(0, t.useFunc)(l, m.default)}(${u}, ${$})`) : s.fail((0, e._)`${v} !== ${u}`);
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
return Ye.default = b, Ye;
|
|
3663
|
+
}
|
|
3664
|
+
var Ze = {}, Vr;
|
|
3665
|
+
function vs() {
|
|
3666
|
+
if (Vr) return Ze;
|
|
3667
|
+
Vr = 1, Object.defineProperty(Ze, "__esModule", { value: !0 });
|
|
3668
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ Kt(), b = {
|
|
3669
|
+
keyword: "enum",
|
|
3670
|
+
schemaType: "array",
|
|
3671
|
+
$data: !0,
|
|
3672
|
+
error: {
|
|
3673
|
+
message: "must be equal to one of the allowed values",
|
|
3674
|
+
params: ({ schemaCode: s }) => (0, e._)`{allowedValues: ${s}}`
|
|
3675
|
+
},
|
|
3676
|
+
code(s) {
|
|
3677
|
+
const { gen: l, data: u, $data: h, schema: $, schemaCode: v, it: P } = s;
|
|
3678
|
+
if (!h && $.length === 0)
|
|
3679
|
+
throw new Error("enum must have non-empty array");
|
|
3680
|
+
const _ = $.length >= P.opts.loopEnum;
|
|
3681
|
+
let y;
|
|
3682
|
+
const g = () => y ?? (y = (0, t.useFunc)(l, m.default));
|
|
3683
|
+
let w;
|
|
3684
|
+
if (_ || h)
|
|
3685
|
+
w = l.let("valid"), s.block$data(w, a);
|
|
3686
|
+
else {
|
|
3687
|
+
if (!Array.isArray($))
|
|
3688
|
+
throw new Error("ajv implementation error");
|
|
3689
|
+
const r = l.const("vSchema", v);
|
|
3690
|
+
w = (0, e.or)(...$.map((o, p) => i(r, p)));
|
|
3691
|
+
}
|
|
3692
|
+
s.pass(w);
|
|
3693
|
+
function a() {
|
|
3694
|
+
l.assign(w, !1), l.forOf("v", v, (r) => l.if((0, e._)`${g()}(${u}, ${r})`, () => l.assign(w, !0).break()));
|
|
3695
|
+
}
|
|
3696
|
+
function i(r, o) {
|
|
3697
|
+
const p = $[o];
|
|
3698
|
+
return typeof p == "object" && p !== null ? (0, e._)`${g()}(${u}, ${r}[${o}])` : (0, e._)`${u} === ${p}`;
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
return Ze.default = b, Ze;
|
|
3703
|
+
}
|
|
3704
|
+
var Fr;
|
|
3705
|
+
function _s() {
|
|
3706
|
+
if (Fr) return ze;
|
|
3707
|
+
Fr = 1, Object.defineProperty(ze, "__esModule", { value: !0 });
|
|
3708
|
+
const e = /* @__PURE__ */ us(), t = /* @__PURE__ */ cs(), m = /* @__PURE__ */ ls(), c = /* @__PURE__ */ fs(), b = /* @__PURE__ */ hs(), s = /* @__PURE__ */ ms(), l = /* @__PURE__ */ ps(), u = /* @__PURE__ */ ys(), h = /* @__PURE__ */ gs(), $ = /* @__PURE__ */ vs(), v = [
|
|
3709
|
+
// number
|
|
3710
|
+
e.default,
|
|
3711
|
+
t.default,
|
|
3712
|
+
// string
|
|
3713
|
+
m.default,
|
|
3714
|
+
c.default,
|
|
3715
|
+
// object
|
|
3716
|
+
b.default,
|
|
3717
|
+
s.default,
|
|
3718
|
+
// array
|
|
3719
|
+
l.default,
|
|
3720
|
+
u.default,
|
|
3721
|
+
// any
|
|
3722
|
+
{ keyword: "type", schemaType: ["string", "array"] },
|
|
3723
|
+
{ keyword: "nullable", schemaType: "boolean" },
|
|
3724
|
+
h.default,
|
|
3725
|
+
$.default
|
|
3726
|
+
];
|
|
3727
|
+
return ze.default = v, ze;
|
|
3728
|
+
}
|
|
3729
|
+
var Qe = {}, Ee = {}, Ur;
|
|
3730
|
+
function kn() {
|
|
3731
|
+
if (Ur) return Ee;
|
|
3732
|
+
Ur = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.validateAdditionalItems = void 0;
|
|
3733
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
3734
|
+
keyword: "additionalItems",
|
|
3735
|
+
type: "array",
|
|
3736
|
+
schemaType: ["boolean", "object"],
|
|
3737
|
+
before: "uniqueItems",
|
|
3738
|
+
error: {
|
|
3739
|
+
message: ({ params: { len: s } }) => (0, e.str)`must NOT have more than ${s} items`,
|
|
3740
|
+
params: ({ params: { len: s } }) => (0, e._)`{limit: ${s}}`
|
|
3741
|
+
},
|
|
3742
|
+
code(s) {
|
|
3743
|
+
const { parentSchema: l, it: u } = s, { items: h } = l;
|
|
3744
|
+
if (!Array.isArray(h)) {
|
|
3745
|
+
(0, t.checkStrictMode)(u, '"additionalItems" is ignored when "items" is not an array of schemas');
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
3748
|
+
b(s, h);
|
|
3749
|
+
}
|
|
3750
|
+
};
|
|
3751
|
+
function b(s, l) {
|
|
3752
|
+
const { gen: u, schema: h, data: $, keyword: v, it: P } = s;
|
|
3753
|
+
P.items = !0;
|
|
3754
|
+
const _ = u.const("len", (0, e._)`${$}.length`);
|
|
3755
|
+
if (h === !1)
|
|
3756
|
+
s.setParams({ len: l.length }), s.pass((0, e._)`${_} <= ${l.length}`);
|
|
3757
|
+
else if (typeof h == "object" && !(0, t.alwaysValidSchema)(P, h)) {
|
|
3758
|
+
const g = u.var("valid", (0, e._)`${_} <= ${l.length}`);
|
|
3759
|
+
u.if((0, e.not)(g), () => y(g)), s.ok(g);
|
|
3760
|
+
}
|
|
3761
|
+
function y(g) {
|
|
3762
|
+
u.forRange("i", l.length, _, (w) => {
|
|
3763
|
+
s.subschema({ keyword: v, dataProp: w, dataPropType: t.Type.Num }, g), P.allErrors || u.if((0, e.not)(g), () => u.break());
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
return Ee.validateAdditionalItems = b, Ee.default = c, Ee;
|
|
3768
|
+
}
|
|
3769
|
+
var Xe = {}, Pe = {}, Lr;
|
|
3770
|
+
function Nn() {
|
|
3771
|
+
if (Lr) return Pe;
|
|
3772
|
+
Lr = 1, Object.defineProperty(Pe, "__esModule", { value: !0 }), Pe.validateTuple = void 0;
|
|
3773
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ le(), c = {
|
|
3774
|
+
keyword: "items",
|
|
3775
|
+
type: "array",
|
|
3776
|
+
schemaType: ["object", "array", "boolean"],
|
|
3777
|
+
before: "uniqueItems",
|
|
3778
|
+
code(s) {
|
|
3779
|
+
const { schema: l, it: u } = s;
|
|
3780
|
+
if (Array.isArray(l))
|
|
3781
|
+
return b(s, "additionalItems", l);
|
|
3782
|
+
u.items = !0, !(0, t.alwaysValidSchema)(u, l) && s.ok((0, m.validateArray)(s));
|
|
3783
|
+
}
|
|
3784
|
+
};
|
|
3785
|
+
function b(s, l, u = s.schema) {
|
|
3786
|
+
const { gen: h, parentSchema: $, data: v, keyword: P, it: _ } = s;
|
|
3787
|
+
w($), _.opts.unevaluated && u.length && _.items !== !0 && (_.items = t.mergeEvaluated.items(h, u.length, _.items));
|
|
3788
|
+
const y = h.name("valid"), g = h.const("len", (0, e._)`${v}.length`);
|
|
3789
|
+
u.forEach((a, i) => {
|
|
3790
|
+
(0, t.alwaysValidSchema)(_, a) || (h.if((0, e._)`${g} > ${i}`, () => s.subschema({
|
|
3791
|
+
keyword: P,
|
|
3792
|
+
schemaProp: i,
|
|
3793
|
+
dataProp: i
|
|
3794
|
+
}, y)), s.ok(y));
|
|
3795
|
+
});
|
|
3796
|
+
function w(a) {
|
|
3797
|
+
const { opts: i, errSchemaPath: r } = _, o = u.length, p = o === a.minItems && (o === a.maxItems || a[l] === !1);
|
|
3798
|
+
if (i.strictTuples && !p) {
|
|
3799
|
+
const n = `"${P}" is ${o}-tuple, but minItems or maxItems/${l} are not specified or different at path "${r}"`;
|
|
3800
|
+
(0, t.checkStrictMode)(_, n, i.strictTuples);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
return Pe.validateTuple = b, Pe.default = c, Pe;
|
|
3805
|
+
}
|
|
3806
|
+
var Kr;
|
|
3807
|
+
function $s() {
|
|
3808
|
+
if (Kr) return Xe;
|
|
3809
|
+
Kr = 1, Object.defineProperty(Xe, "__esModule", { value: !0 });
|
|
3810
|
+
const e = /* @__PURE__ */ Nn(), t = {
|
|
3811
|
+
keyword: "prefixItems",
|
|
3812
|
+
type: "array",
|
|
3813
|
+
schemaType: ["array"],
|
|
3814
|
+
before: "uniqueItems",
|
|
3815
|
+
code: (m) => (0, e.validateTuple)(m, "items")
|
|
3816
|
+
};
|
|
3817
|
+
return Xe.default = t, Xe;
|
|
3818
|
+
}
|
|
3819
|
+
var xe = {}, Gr;
|
|
3820
|
+
function ws() {
|
|
3821
|
+
if (Gr) return xe;
|
|
3822
|
+
Gr = 1, Object.defineProperty(xe, "__esModule", { value: !0 });
|
|
3823
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ le(), c = /* @__PURE__ */ kn(), s = {
|
|
3824
|
+
keyword: "items",
|
|
3825
|
+
type: "array",
|
|
3826
|
+
schemaType: ["object", "boolean"],
|
|
3827
|
+
before: "uniqueItems",
|
|
3828
|
+
error: {
|
|
3829
|
+
message: ({ params: { len: l } }) => (0, e.str)`must NOT have more than ${l} items`,
|
|
3830
|
+
params: ({ params: { len: l } }) => (0, e._)`{limit: ${l}}`
|
|
3831
|
+
},
|
|
3832
|
+
code(l) {
|
|
3833
|
+
const { schema: u, parentSchema: h, it: $ } = l, { prefixItems: v } = h;
|
|
3834
|
+
$.items = !0, !(0, t.alwaysValidSchema)($, u) && (v ? (0, c.validateAdditionalItems)(l, v) : l.ok((0, m.validateArray)(l)));
|
|
3835
|
+
}
|
|
3836
|
+
};
|
|
3837
|
+
return xe.default = s, xe;
|
|
3838
|
+
}
|
|
3839
|
+
var et = {}, Hr;
|
|
3840
|
+
function bs() {
|
|
3841
|
+
if (Hr) return et;
|
|
3842
|
+
Hr = 1, Object.defineProperty(et, "__esModule", { value: !0 });
|
|
3843
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
3844
|
+
keyword: "contains",
|
|
3845
|
+
type: "array",
|
|
3846
|
+
schemaType: ["object", "boolean"],
|
|
3847
|
+
before: "uniqueItems",
|
|
3848
|
+
trackErrors: !0,
|
|
3849
|
+
error: {
|
|
3850
|
+
message: ({ params: { min: b, max: s } }) => s === void 0 ? (0, e.str)`must contain at least ${b} valid item(s)` : (0, e.str)`must contain at least ${b} and no more than ${s} valid item(s)`,
|
|
3851
|
+
params: ({ params: { min: b, max: s } }) => s === void 0 ? (0, e._)`{minContains: ${b}}` : (0, e._)`{minContains: ${b}, maxContains: ${s}}`
|
|
3852
|
+
},
|
|
3853
|
+
code(b) {
|
|
3854
|
+
const { gen: s, schema: l, parentSchema: u, data: h, it: $ } = b;
|
|
3855
|
+
let v, P;
|
|
3856
|
+
const { minContains: _, maxContains: y } = u;
|
|
3857
|
+
$.opts.next ? (v = _ === void 0 ? 1 : _, P = y) : v = 1;
|
|
3858
|
+
const g = s.const("len", (0, e._)`${h}.length`);
|
|
3859
|
+
if (b.setParams({ min: v, max: P }), P === void 0 && v === 0) {
|
|
3860
|
+
(0, t.checkStrictMode)($, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
|
|
3861
|
+
return;
|
|
3862
|
+
}
|
|
3863
|
+
if (P !== void 0 && v > P) {
|
|
3864
|
+
(0, t.checkStrictMode)($, '"minContains" > "maxContains" is always invalid'), b.fail();
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
if ((0, t.alwaysValidSchema)($, l)) {
|
|
3868
|
+
let o = (0, e._)`${g} >= ${v}`;
|
|
3869
|
+
P !== void 0 && (o = (0, e._)`${o} && ${g} <= ${P}`), b.pass(o);
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
3872
|
+
$.items = !0;
|
|
3873
|
+
const w = s.name("valid");
|
|
3874
|
+
P === void 0 && v === 1 ? i(w, () => s.if(w, () => s.break())) : v === 0 ? (s.let(w, !0), P !== void 0 && s.if((0, e._)`${h}.length > 0`, a)) : (s.let(w, !1), a()), b.result(w, () => b.reset());
|
|
3875
|
+
function a() {
|
|
3876
|
+
const o = s.name("_valid"), p = s.let("count", 0);
|
|
3877
|
+
i(o, () => s.if(o, () => r(p)));
|
|
3878
|
+
}
|
|
3879
|
+
function i(o, p) {
|
|
3880
|
+
s.forRange("i", 0, g, (n) => {
|
|
3881
|
+
b.subschema({
|
|
3882
|
+
keyword: "contains",
|
|
3883
|
+
dataProp: n,
|
|
3884
|
+
dataPropType: t.Type.Num,
|
|
3885
|
+
compositeRule: !0
|
|
3886
|
+
}, o), p();
|
|
3887
|
+
});
|
|
3888
|
+
}
|
|
3889
|
+
function r(o) {
|
|
3890
|
+
s.code((0, e._)`${o}++`), P === void 0 ? s.if((0, e._)`${o} >= ${v}`, () => s.assign(w, !0).break()) : (s.if((0, e._)`${o} > ${P}`, () => s.assign(w, !1).break()), v === 1 ? s.assign(w, !0) : s.if((0, e._)`${o} >= ${v}`, () => s.assign(w, !0)));
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
};
|
|
3894
|
+
return et.default = c, et;
|
|
3895
|
+
}
|
|
3896
|
+
var Ct = {}, Jr;
|
|
3897
|
+
function Ss() {
|
|
3898
|
+
return Jr || (Jr = 1, (function(e) {
|
|
3899
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
|
|
3900
|
+
const t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ le();
|
|
3901
|
+
e.error = {
|
|
3902
|
+
message: ({ params: { property: h, depsCount: $, deps: v } }) => {
|
|
3903
|
+
const P = $ === 1 ? "property" : "properties";
|
|
3904
|
+
return (0, t.str)`must have ${P} ${v} when property ${h} is present`;
|
|
3905
|
+
},
|
|
3906
|
+
params: ({ params: { property: h, depsCount: $, deps: v, missingProperty: P } }) => (0, t._)`{property: ${h},
|
|
3907
|
+
missingProperty: ${P},
|
|
3908
|
+
depsCount: ${$},
|
|
3909
|
+
deps: ${v}}`
|
|
3910
|
+
// TODO change to reference
|
|
3911
|
+
};
|
|
3912
|
+
const b = {
|
|
3913
|
+
keyword: "dependencies",
|
|
3914
|
+
type: "object",
|
|
3915
|
+
schemaType: "object",
|
|
3916
|
+
error: e.error,
|
|
3917
|
+
code(h) {
|
|
3918
|
+
const [$, v] = s(h);
|
|
3919
|
+
l(h, $), u(h, v);
|
|
3920
|
+
}
|
|
3921
|
+
};
|
|
3922
|
+
function s({ schema: h }) {
|
|
3923
|
+
const $ = {}, v = {};
|
|
3924
|
+
for (const P in h) {
|
|
3925
|
+
if (P === "__proto__")
|
|
3926
|
+
continue;
|
|
3927
|
+
const _ = Array.isArray(h[P]) ? $ : v;
|
|
3928
|
+
_[P] = h[P];
|
|
3929
|
+
}
|
|
3930
|
+
return [$, v];
|
|
3931
|
+
}
|
|
3932
|
+
function l(h, $ = h.schema) {
|
|
3933
|
+
const { gen: v, data: P, it: _ } = h;
|
|
3934
|
+
if (Object.keys($).length === 0)
|
|
3935
|
+
return;
|
|
3936
|
+
const y = v.let("missing");
|
|
3937
|
+
for (const g in $) {
|
|
3938
|
+
const w = $[g];
|
|
3939
|
+
if (w.length === 0)
|
|
3940
|
+
continue;
|
|
3941
|
+
const a = (0, c.propertyInData)(v, P, g, _.opts.ownProperties);
|
|
3942
|
+
h.setParams({
|
|
3943
|
+
property: g,
|
|
3944
|
+
depsCount: w.length,
|
|
3945
|
+
deps: w.join(", ")
|
|
3946
|
+
}), _.allErrors ? v.if(a, () => {
|
|
3947
|
+
for (const i of w)
|
|
3948
|
+
(0, c.checkReportMissingProp)(h, i);
|
|
3949
|
+
}) : (v.if((0, t._)`${a} && (${(0, c.checkMissingProp)(h, w, y)})`), (0, c.reportMissingProp)(h, y), v.else());
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
e.validatePropertyDeps = l;
|
|
3953
|
+
function u(h, $ = h.schema) {
|
|
3954
|
+
const { gen: v, data: P, keyword: _, it: y } = h, g = v.name("valid");
|
|
3955
|
+
for (const w in $)
|
|
3956
|
+
(0, m.alwaysValidSchema)(y, $[w]) || (v.if(
|
|
3957
|
+
(0, c.propertyInData)(v, P, w, y.opts.ownProperties),
|
|
3958
|
+
() => {
|
|
3959
|
+
const a = h.subschema({ keyword: _, schemaProp: w }, g);
|
|
3960
|
+
h.mergeValidEvaluated(a, g);
|
|
3961
|
+
},
|
|
3962
|
+
() => v.var(g, !0)
|
|
3963
|
+
// TODO var
|
|
3964
|
+
), h.ok(g));
|
|
3965
|
+
}
|
|
3966
|
+
e.validateSchemaDeps = u, e.default = b;
|
|
3967
|
+
})(Ct)), Ct;
|
|
3968
|
+
}
|
|
3969
|
+
var tt = {}, Wr;
|
|
3970
|
+
function Es() {
|
|
3971
|
+
if (Wr) return tt;
|
|
3972
|
+
Wr = 1, Object.defineProperty(tt, "__esModule", { value: !0 });
|
|
3973
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
3974
|
+
keyword: "propertyNames",
|
|
3975
|
+
type: "object",
|
|
3976
|
+
schemaType: ["object", "boolean"],
|
|
3977
|
+
error: {
|
|
3978
|
+
message: "property name must be valid",
|
|
3979
|
+
params: ({ params: b }) => (0, e._)`{propertyName: ${b.propertyName}}`
|
|
3980
|
+
},
|
|
3981
|
+
code(b) {
|
|
3982
|
+
const { gen: s, schema: l, data: u, it: h } = b;
|
|
3983
|
+
if ((0, t.alwaysValidSchema)(h, l))
|
|
3984
|
+
return;
|
|
3985
|
+
const $ = s.name("valid");
|
|
3986
|
+
s.forIn("key", u, (v) => {
|
|
3987
|
+
b.setParams({ propertyName: v }), b.subschema({
|
|
3988
|
+
keyword: "propertyNames",
|
|
3989
|
+
data: v,
|
|
3990
|
+
dataTypes: ["string"],
|
|
3991
|
+
propertyName: v,
|
|
3992
|
+
compositeRule: !0
|
|
3993
|
+
}, $), s.if((0, e.not)($), () => {
|
|
3994
|
+
b.error(!0), h.allErrors || s.break();
|
|
3995
|
+
});
|
|
3996
|
+
}), b.ok($);
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
return tt.default = c, tt;
|
|
4000
|
+
}
|
|
4001
|
+
var rt = {}, Br;
|
|
4002
|
+
function Rn() {
|
|
4003
|
+
if (Br) return rt;
|
|
4004
|
+
Br = 1, Object.defineProperty(rt, "__esModule", { value: !0 });
|
|
4005
|
+
const e = /* @__PURE__ */ le(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ _e(), c = /* @__PURE__ */ Y(), s = {
|
|
4006
|
+
keyword: "additionalProperties",
|
|
4007
|
+
type: ["object"],
|
|
4008
|
+
schemaType: ["boolean", "object"],
|
|
4009
|
+
allowUndefined: !0,
|
|
4010
|
+
trackErrors: !0,
|
|
4011
|
+
error: {
|
|
4012
|
+
message: "must NOT have additional properties",
|
|
4013
|
+
params: ({ params: l }) => (0, t._)`{additionalProperty: ${l.additionalProperty}}`
|
|
4014
|
+
},
|
|
4015
|
+
code(l) {
|
|
4016
|
+
const { gen: u, schema: h, parentSchema: $, data: v, errsCount: P, it: _ } = l;
|
|
4017
|
+
if (!P)
|
|
4018
|
+
throw new Error("ajv implementation error");
|
|
4019
|
+
const { allErrors: y, opts: g } = _;
|
|
4020
|
+
if (_.props = !0, g.removeAdditional !== "all" && (0, c.alwaysValidSchema)(_, h))
|
|
4021
|
+
return;
|
|
4022
|
+
const w = (0, e.allSchemaProperties)($.properties), a = (0, e.allSchemaProperties)($.patternProperties);
|
|
4023
|
+
i(), l.ok((0, t._)`${P} === ${m.default.errors}`);
|
|
4024
|
+
function i() {
|
|
4025
|
+
u.forIn("key", v, (f) => {
|
|
4026
|
+
!w.length && !a.length ? p(f) : u.if(r(f), () => p(f));
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4029
|
+
function r(f) {
|
|
4030
|
+
let S;
|
|
4031
|
+
if (w.length > 8) {
|
|
4032
|
+
const T = (0, c.schemaRefOrVal)(_, $.properties, "properties");
|
|
4033
|
+
S = (0, e.isOwnProperty)(u, T, f);
|
|
4034
|
+
} else w.length ? S = (0, t.or)(...w.map((T) => (0, t._)`${f} === ${T}`)) : S = t.nil;
|
|
4035
|
+
return a.length && (S = (0, t.or)(S, ...a.map((T) => (0, t._)`${(0, e.usePattern)(l, T)}.test(${f})`))), (0, t.not)(S);
|
|
4036
|
+
}
|
|
4037
|
+
function o(f) {
|
|
4038
|
+
u.code((0, t._)`delete ${v}[${f}]`);
|
|
4039
|
+
}
|
|
4040
|
+
function p(f) {
|
|
4041
|
+
if (g.removeAdditional === "all" || g.removeAdditional && h === !1) {
|
|
4042
|
+
o(f);
|
|
4043
|
+
return;
|
|
4044
|
+
}
|
|
4045
|
+
if (h === !1) {
|
|
4046
|
+
l.setParams({ additionalProperty: f }), l.error(), y || u.break();
|
|
4047
|
+
return;
|
|
4048
|
+
}
|
|
4049
|
+
if (typeof h == "object" && !(0, c.alwaysValidSchema)(_, h)) {
|
|
4050
|
+
const S = u.name("valid");
|
|
4051
|
+
g.removeAdditional === "failing" ? (n(f, S, !1), u.if((0, t.not)(S), () => {
|
|
4052
|
+
l.reset(), o(f);
|
|
4053
|
+
})) : (n(f, S), y || u.if((0, t.not)(S), () => u.break()));
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
function n(f, S, T) {
|
|
4057
|
+
const j = {
|
|
4058
|
+
keyword: "additionalProperties",
|
|
4059
|
+
dataProp: f,
|
|
4060
|
+
dataPropType: c.Type.Str
|
|
4061
|
+
};
|
|
4062
|
+
T === !1 && Object.assign(j, {
|
|
4063
|
+
compositeRule: !0,
|
|
4064
|
+
createErrors: !1,
|
|
4065
|
+
allErrors: !1
|
|
4066
|
+
}), l.subschema(j, S);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
};
|
|
4070
|
+
return rt.default = s, rt;
|
|
4071
|
+
}
|
|
4072
|
+
var nt = {}, Yr;
|
|
4073
|
+
function Ps() {
|
|
4074
|
+
if (Yr) return nt;
|
|
4075
|
+
Yr = 1, Object.defineProperty(nt, "__esModule", { value: !0 });
|
|
4076
|
+
const e = /* @__PURE__ */ $t(), t = /* @__PURE__ */ le(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ Rn(), b = {
|
|
4077
|
+
keyword: "properties",
|
|
4078
|
+
type: "object",
|
|
4079
|
+
schemaType: "object",
|
|
4080
|
+
code(s) {
|
|
4081
|
+
const { gen: l, schema: u, parentSchema: h, data: $, it: v } = s;
|
|
4082
|
+
v.opts.removeAdditional === "all" && h.additionalProperties === void 0 && c.default.code(new e.KeywordCxt(v, c.default, "additionalProperties"));
|
|
4083
|
+
const P = (0, t.allSchemaProperties)(u);
|
|
4084
|
+
for (const a of P)
|
|
4085
|
+
v.definedProperties.add(a);
|
|
4086
|
+
v.opts.unevaluated && P.length && v.props !== !0 && (v.props = m.mergeEvaluated.props(l, (0, m.toHash)(P), v.props));
|
|
4087
|
+
const _ = P.filter((a) => !(0, m.alwaysValidSchema)(v, u[a]));
|
|
4088
|
+
if (_.length === 0)
|
|
4089
|
+
return;
|
|
4090
|
+
const y = l.name("valid");
|
|
4091
|
+
for (const a of _)
|
|
4092
|
+
g(a) ? w(a) : (l.if((0, t.propertyInData)(l, $, a, v.opts.ownProperties)), w(a), v.allErrors || l.else().var(y, !0), l.endIf()), s.it.definedProperties.add(a), s.ok(y);
|
|
4093
|
+
function g(a) {
|
|
4094
|
+
return v.opts.useDefaults && !v.compositeRule && u[a].default !== void 0;
|
|
4095
|
+
}
|
|
4096
|
+
function w(a) {
|
|
4097
|
+
s.subschema({
|
|
4098
|
+
keyword: "properties",
|
|
4099
|
+
schemaProp: a,
|
|
4100
|
+
dataProp: a
|
|
4101
|
+
}, y);
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
};
|
|
4105
|
+
return nt.default = b, nt;
|
|
4106
|
+
}
|
|
4107
|
+
var st = {}, Zr;
|
|
4108
|
+
function ks() {
|
|
4109
|
+
if (Zr) return st;
|
|
4110
|
+
Zr = 1, Object.defineProperty(st, "__esModule", { value: !0 });
|
|
4111
|
+
const e = /* @__PURE__ */ le(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ Y(), b = {
|
|
4112
|
+
keyword: "patternProperties",
|
|
4113
|
+
type: "object",
|
|
4114
|
+
schemaType: "object",
|
|
4115
|
+
code(s) {
|
|
4116
|
+
const { gen: l, schema: u, data: h, parentSchema: $, it: v } = s, { opts: P } = v, _ = (0, e.allSchemaProperties)(u), y = _.filter((p) => (0, m.alwaysValidSchema)(v, u[p]));
|
|
4117
|
+
if (_.length === 0 || y.length === _.length && (!v.opts.unevaluated || v.props === !0))
|
|
4118
|
+
return;
|
|
4119
|
+
const g = P.strictSchema && !P.allowMatchingProperties && $.properties, w = l.name("valid");
|
|
4120
|
+
v.props !== !0 && !(v.props instanceof t.Name) && (v.props = (0, c.evaluatedPropsToName)(l, v.props));
|
|
4121
|
+
const { props: a } = v;
|
|
4122
|
+
i();
|
|
4123
|
+
function i() {
|
|
4124
|
+
for (const p of _)
|
|
4125
|
+
g && r(p), v.allErrors ? o(p) : (l.var(w, !0), o(p), l.if(w));
|
|
4126
|
+
}
|
|
4127
|
+
function r(p) {
|
|
4128
|
+
for (const n in g)
|
|
4129
|
+
new RegExp(p).test(n) && (0, m.checkStrictMode)(v, `property ${n} matches pattern ${p} (use allowMatchingProperties)`);
|
|
4130
|
+
}
|
|
4131
|
+
function o(p) {
|
|
4132
|
+
l.forIn("key", h, (n) => {
|
|
4133
|
+
l.if((0, t._)`${(0, e.usePattern)(s, p)}.test(${n})`, () => {
|
|
4134
|
+
const f = y.includes(p);
|
|
4135
|
+
f || s.subschema({
|
|
4136
|
+
keyword: "patternProperties",
|
|
4137
|
+
schemaProp: p,
|
|
4138
|
+
dataProp: n,
|
|
4139
|
+
dataPropType: c.Type.Str
|
|
4140
|
+
}, w), v.opts.unevaluated && a !== !0 ? l.assign((0, t._)`${a}[${n}]`, !0) : !f && !v.allErrors && l.if((0, t.not)(w), () => l.break());
|
|
4141
|
+
});
|
|
4142
|
+
});
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
return st.default = b, st;
|
|
4147
|
+
}
|
|
4148
|
+
var at = {}, Qr;
|
|
4149
|
+
function Ns() {
|
|
4150
|
+
if (Qr) return at;
|
|
4151
|
+
Qr = 1, Object.defineProperty(at, "__esModule", { value: !0 });
|
|
4152
|
+
const e = /* @__PURE__ */ Y(), t = {
|
|
4153
|
+
keyword: "not",
|
|
4154
|
+
schemaType: ["object", "boolean"],
|
|
4155
|
+
trackErrors: !0,
|
|
4156
|
+
code(m) {
|
|
4157
|
+
const { gen: c, schema: b, it: s } = m;
|
|
4158
|
+
if ((0, e.alwaysValidSchema)(s, b)) {
|
|
4159
|
+
m.fail();
|
|
4160
|
+
return;
|
|
4161
|
+
}
|
|
4162
|
+
const l = c.name("valid");
|
|
4163
|
+
m.subschema({
|
|
4164
|
+
keyword: "not",
|
|
4165
|
+
compositeRule: !0,
|
|
4166
|
+
createErrors: !1,
|
|
4167
|
+
allErrors: !1
|
|
4168
|
+
}, l), m.failResult(l, () => m.reset(), () => m.error());
|
|
4169
|
+
},
|
|
4170
|
+
error: { message: "must NOT be valid" }
|
|
4171
|
+
};
|
|
4172
|
+
return at.default = t, at;
|
|
4173
|
+
}
|
|
4174
|
+
var ot = {}, Xr;
|
|
4175
|
+
function Rs() {
|
|
4176
|
+
if (Xr) return ot;
|
|
4177
|
+
Xr = 1, Object.defineProperty(ot, "__esModule", { value: !0 });
|
|
4178
|
+
const t = {
|
|
4179
|
+
keyword: "anyOf",
|
|
4180
|
+
schemaType: "array",
|
|
4181
|
+
trackErrors: !0,
|
|
4182
|
+
code: (/* @__PURE__ */ le()).validateUnion,
|
|
4183
|
+
error: { message: "must match a schema in anyOf" }
|
|
4184
|
+
};
|
|
4185
|
+
return ot.default = t, ot;
|
|
4186
|
+
}
|
|
4187
|
+
var it = {}, xr;
|
|
4188
|
+
function Os() {
|
|
4189
|
+
if (xr) return it;
|
|
4190
|
+
xr = 1, Object.defineProperty(it, "__esModule", { value: !0 });
|
|
4191
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
4192
|
+
keyword: "oneOf",
|
|
4193
|
+
schemaType: "array",
|
|
4194
|
+
trackErrors: !0,
|
|
4195
|
+
error: {
|
|
4196
|
+
message: "must match exactly one schema in oneOf",
|
|
4197
|
+
params: ({ params: b }) => (0, e._)`{passingSchemas: ${b.passing}}`
|
|
4198
|
+
},
|
|
4199
|
+
code(b) {
|
|
4200
|
+
const { gen: s, schema: l, parentSchema: u, it: h } = b;
|
|
4201
|
+
if (!Array.isArray(l))
|
|
4202
|
+
throw new Error("ajv implementation error");
|
|
4203
|
+
if (h.opts.discriminator && u.discriminator)
|
|
4204
|
+
return;
|
|
4205
|
+
const $ = l, v = s.let("valid", !1), P = s.let("passing", null), _ = s.name("_valid");
|
|
4206
|
+
b.setParams({ passing: P }), s.block(y), b.result(v, () => b.reset(), () => b.error(!0));
|
|
4207
|
+
function y() {
|
|
4208
|
+
$.forEach((g, w) => {
|
|
4209
|
+
let a;
|
|
4210
|
+
(0, t.alwaysValidSchema)(h, g) ? s.var(_, !0) : a = b.subschema({
|
|
4211
|
+
keyword: "oneOf",
|
|
4212
|
+
schemaProp: w,
|
|
4213
|
+
compositeRule: !0
|
|
4214
|
+
}, _), w > 0 && s.if((0, e._)`${_} && ${v}`).assign(v, !1).assign(P, (0, e._)`[${P}, ${w}]`).else(), s.if(_, () => {
|
|
4215
|
+
s.assign(v, !0), s.assign(P, w), a && b.mergeEvaluated(a, e.Name);
|
|
4216
|
+
});
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
};
|
|
4221
|
+
return it.default = c, it;
|
|
4222
|
+
}
|
|
4223
|
+
var ut = {}, en;
|
|
4224
|
+
function Ts() {
|
|
4225
|
+
if (en) return ut;
|
|
4226
|
+
en = 1, Object.defineProperty(ut, "__esModule", { value: !0 });
|
|
4227
|
+
const e = /* @__PURE__ */ Y(), t = {
|
|
4228
|
+
keyword: "allOf",
|
|
4229
|
+
schemaType: "array",
|
|
4230
|
+
code(m) {
|
|
4231
|
+
const { gen: c, schema: b, it: s } = m;
|
|
4232
|
+
if (!Array.isArray(b))
|
|
4233
|
+
throw new Error("ajv implementation error");
|
|
4234
|
+
const l = c.name("valid");
|
|
4235
|
+
b.forEach((u, h) => {
|
|
4236
|
+
if ((0, e.alwaysValidSchema)(s, u))
|
|
4237
|
+
return;
|
|
4238
|
+
const $ = m.subschema({ keyword: "allOf", schemaProp: h }, l);
|
|
4239
|
+
m.ok(l), m.mergeEvaluated($);
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
};
|
|
4243
|
+
return ut.default = t, ut;
|
|
4244
|
+
}
|
|
4245
|
+
var ct = {}, tn;
|
|
4246
|
+
function js() {
|
|
4247
|
+
if (tn) return ct;
|
|
4248
|
+
tn = 1, Object.defineProperty(ct, "__esModule", { value: !0 });
|
|
4249
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
4250
|
+
keyword: "if",
|
|
4251
|
+
schemaType: ["object", "boolean"],
|
|
4252
|
+
trackErrors: !0,
|
|
4253
|
+
error: {
|
|
4254
|
+
message: ({ params: s }) => (0, e.str)`must match "${s.ifClause}" schema`,
|
|
4255
|
+
params: ({ params: s }) => (0, e._)`{failingKeyword: ${s.ifClause}}`
|
|
4256
|
+
},
|
|
4257
|
+
code(s) {
|
|
4258
|
+
const { gen: l, parentSchema: u, it: h } = s;
|
|
4259
|
+
u.then === void 0 && u.else === void 0 && (0, t.checkStrictMode)(h, '"if" without "then" and "else" is ignored');
|
|
4260
|
+
const $ = b(h, "then"), v = b(h, "else");
|
|
4261
|
+
if (!$ && !v)
|
|
4262
|
+
return;
|
|
4263
|
+
const P = l.let("valid", !0), _ = l.name("_valid");
|
|
4264
|
+
if (y(), s.reset(), $ && v) {
|
|
4265
|
+
const w = l.let("ifClause");
|
|
4266
|
+
s.setParams({ ifClause: w }), l.if(_, g("then", w), g("else", w));
|
|
4267
|
+
} else $ ? l.if(_, g("then")) : l.if((0, e.not)(_), g("else"));
|
|
4268
|
+
s.pass(P, () => s.error(!0));
|
|
4269
|
+
function y() {
|
|
4270
|
+
const w = s.subschema({
|
|
4271
|
+
keyword: "if",
|
|
4272
|
+
compositeRule: !0,
|
|
4273
|
+
createErrors: !1,
|
|
4274
|
+
allErrors: !1
|
|
4275
|
+
}, _);
|
|
4276
|
+
s.mergeEvaluated(w);
|
|
4277
|
+
}
|
|
4278
|
+
function g(w, a) {
|
|
4279
|
+
return () => {
|
|
4280
|
+
const i = s.subschema({ keyword: w }, _);
|
|
4281
|
+
l.assign(P, _), s.mergeValidEvaluated(i, P), a ? l.assign(a, (0, e._)`${w}`) : s.setParams({ ifClause: w });
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
function b(s, l) {
|
|
4287
|
+
const u = s.schema[l];
|
|
4288
|
+
return u !== void 0 && !(0, t.alwaysValidSchema)(s, u);
|
|
4289
|
+
}
|
|
4290
|
+
return ct.default = c, ct;
|
|
4291
|
+
}
|
|
4292
|
+
var dt = {}, rn;
|
|
4293
|
+
function Is() {
|
|
4294
|
+
if (rn) return dt;
|
|
4295
|
+
rn = 1, Object.defineProperty(dt, "__esModule", { value: !0 });
|
|
4296
|
+
const e = /* @__PURE__ */ Y(), t = {
|
|
4297
|
+
keyword: ["then", "else"],
|
|
4298
|
+
schemaType: ["object", "boolean"],
|
|
4299
|
+
code({ keyword: m, parentSchema: c, it: b }) {
|
|
4300
|
+
c.if === void 0 && (0, e.checkStrictMode)(b, `"${m}" without "if" is ignored`);
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
return dt.default = t, dt;
|
|
4304
|
+
}
|
|
4305
|
+
var nn;
|
|
4306
|
+
function qs() {
|
|
4307
|
+
if (nn) return Qe;
|
|
4308
|
+
nn = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
|
|
4309
|
+
const e = /* @__PURE__ */ kn(), t = /* @__PURE__ */ $s(), m = /* @__PURE__ */ Nn(), c = /* @__PURE__ */ ws(), b = /* @__PURE__ */ bs(), s = /* @__PURE__ */ Ss(), l = /* @__PURE__ */ Es(), u = /* @__PURE__ */ Rn(), h = /* @__PURE__ */ Ps(), $ = /* @__PURE__ */ ks(), v = /* @__PURE__ */ Ns(), P = /* @__PURE__ */ Rs(), _ = /* @__PURE__ */ Os(), y = /* @__PURE__ */ Ts(), g = /* @__PURE__ */ js(), w = /* @__PURE__ */ Is();
|
|
4310
|
+
function a(i = !1) {
|
|
4311
|
+
const r = [
|
|
4312
|
+
// any
|
|
4313
|
+
v.default,
|
|
4314
|
+
P.default,
|
|
4315
|
+
_.default,
|
|
4316
|
+
y.default,
|
|
4317
|
+
g.default,
|
|
4318
|
+
w.default,
|
|
4319
|
+
// object
|
|
4320
|
+
l.default,
|
|
4321
|
+
u.default,
|
|
4322
|
+
s.default,
|
|
4323
|
+
h.default,
|
|
4324
|
+
$.default
|
|
4325
|
+
];
|
|
4326
|
+
return i ? r.push(t.default, c.default) : r.push(e.default, m.default), r.push(b.default), r;
|
|
4327
|
+
}
|
|
4328
|
+
return Qe.default = a, Qe;
|
|
4329
|
+
}
|
|
4330
|
+
var lt = {}, ft = {}, sn;
|
|
4331
|
+
function Cs() {
|
|
4332
|
+
if (sn) return ft;
|
|
4333
|
+
sn = 1, Object.defineProperty(ft, "__esModule", { value: !0 });
|
|
4334
|
+
const e = /* @__PURE__ */ H(), m = {
|
|
4335
|
+
keyword: "format",
|
|
4336
|
+
type: ["number", "string"],
|
|
4337
|
+
schemaType: "string",
|
|
4338
|
+
$data: !0,
|
|
4339
|
+
error: {
|
|
4340
|
+
message: ({ schemaCode: c }) => (0, e.str)`must match format "${c}"`,
|
|
4341
|
+
params: ({ schemaCode: c }) => (0, e._)`{format: ${c}}`
|
|
4342
|
+
},
|
|
4343
|
+
code(c, b) {
|
|
4344
|
+
const { gen: s, data: l, $data: u, schema: h, schemaCode: $, it: v } = c, { opts: P, errSchemaPath: _, schemaEnv: y, self: g } = v;
|
|
4345
|
+
if (!P.validateFormats)
|
|
4346
|
+
return;
|
|
4347
|
+
u ? w() : a();
|
|
4348
|
+
function w() {
|
|
4349
|
+
const i = s.scopeValue("formats", {
|
|
4350
|
+
ref: g.formats,
|
|
4351
|
+
code: P.code.formats
|
|
4352
|
+
}), r = s.const("fDef", (0, e._)`${i}[${$}]`), o = s.let("fType"), p = s.let("format");
|
|
4353
|
+
s.if((0, e._)`typeof ${r} == "object" && !(${r} instanceof RegExp)`, () => s.assign(o, (0, e._)`${r}.type || "string"`).assign(p, (0, e._)`${r}.validate`), () => s.assign(o, (0, e._)`"string"`).assign(p, r)), c.fail$data((0, e.or)(n(), f()));
|
|
4354
|
+
function n() {
|
|
4355
|
+
return P.strictSchema === !1 ? e.nil : (0, e._)`${$} && !${p}`;
|
|
4356
|
+
}
|
|
4357
|
+
function f() {
|
|
4358
|
+
const S = y.$async ? (0, e._)`(${r}.async ? await ${p}(${l}) : ${p}(${l}))` : (0, e._)`${p}(${l})`, T = (0, e._)`(typeof ${p} == "function" ? ${S} : ${p}.test(${l}))`;
|
|
4359
|
+
return (0, e._)`${p} && ${p} !== true && ${o} === ${b} && !${T}`;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
function a() {
|
|
4363
|
+
const i = g.formats[h];
|
|
4364
|
+
if (!i) {
|
|
4365
|
+
n();
|
|
4366
|
+
return;
|
|
4367
|
+
}
|
|
4368
|
+
if (i === !0)
|
|
4369
|
+
return;
|
|
4370
|
+
const [r, o, p] = f(i);
|
|
4371
|
+
r === b && c.pass(S());
|
|
4372
|
+
function n() {
|
|
4373
|
+
if (P.strictSchema === !1) {
|
|
4374
|
+
g.logger.warn(T());
|
|
4375
|
+
return;
|
|
4376
|
+
}
|
|
4377
|
+
throw new Error(T());
|
|
4378
|
+
function T() {
|
|
4379
|
+
return `unknown format "${h}" ignored in schema at path "${_}"`;
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
function f(T) {
|
|
4383
|
+
const j = T instanceof RegExp ? (0, e.regexpCode)(T) : P.code.formats ? (0, e._)`${P.code.formats}${(0, e.getProperty)(h)}` : void 0, D = s.scopeValue("formats", { key: h, ref: T, code: j });
|
|
4384
|
+
return typeof T == "object" && !(T instanceof RegExp) ? [T.type || "string", T.validate, (0, e._)`${D}.validate`] : ["string", T, D];
|
|
4385
|
+
}
|
|
4386
|
+
function S() {
|
|
4387
|
+
if (typeof i == "object" && !(i instanceof RegExp) && i.async) {
|
|
4388
|
+
if (!y.$async)
|
|
4389
|
+
throw new Error("async format in sync schema");
|
|
4390
|
+
return (0, e._)`await ${p}(${l})`;
|
|
4391
|
+
}
|
|
4392
|
+
return typeof o == "function" ? (0, e._)`${p}(${l})` : (0, e._)`${p}.test(${l})`;
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
};
|
|
4397
|
+
return ft.default = m, ft;
|
|
4398
|
+
}
|
|
4399
|
+
var an;
|
|
4400
|
+
function Ds() {
|
|
4401
|
+
if (an) return lt;
|
|
4402
|
+
an = 1, Object.defineProperty(lt, "__esModule", { value: !0 });
|
|
4403
|
+
const t = [(/* @__PURE__ */ Cs()).default];
|
|
4404
|
+
return lt.default = t, lt;
|
|
4405
|
+
}
|
|
4406
|
+
var be = {}, on;
|
|
4407
|
+
function As() {
|
|
4408
|
+
return on || (on = 1, Object.defineProperty(be, "__esModule", { value: !0 }), be.contentVocabulary = be.metadataVocabulary = void 0, be.metadataVocabulary = [
|
|
4409
|
+
"title",
|
|
4410
|
+
"description",
|
|
4411
|
+
"default",
|
|
4412
|
+
"deprecated",
|
|
4413
|
+
"readOnly",
|
|
4414
|
+
"writeOnly",
|
|
4415
|
+
"examples"
|
|
4416
|
+
], be.contentVocabulary = [
|
|
4417
|
+
"contentMediaType",
|
|
4418
|
+
"contentEncoding",
|
|
4419
|
+
"contentSchema"
|
|
4420
|
+
]), be;
|
|
4421
|
+
}
|
|
4422
|
+
var un;
|
|
4423
|
+
function Ms() {
|
|
4424
|
+
if (un) return De;
|
|
4425
|
+
un = 1, Object.defineProperty(De, "__esModule", { value: !0 });
|
|
4426
|
+
const e = /* @__PURE__ */ is(), t = /* @__PURE__ */ _s(), m = /* @__PURE__ */ qs(), c = /* @__PURE__ */ Ds(), b = /* @__PURE__ */ As(), s = [
|
|
4427
|
+
e.default,
|
|
4428
|
+
t.default,
|
|
4429
|
+
(0, m.default)(),
|
|
4430
|
+
c.default,
|
|
4431
|
+
b.metadataVocabulary,
|
|
4432
|
+
b.contentVocabulary
|
|
4433
|
+
];
|
|
4434
|
+
return De.default = s, De;
|
|
4435
|
+
}
|
|
4436
|
+
var ht = {}, Oe = {}, cn;
|
|
4437
|
+
function zs() {
|
|
4438
|
+
if (cn) return Oe;
|
|
4439
|
+
cn = 1, Object.defineProperty(Oe, "__esModule", { value: !0 }), Oe.DiscrError = void 0;
|
|
4440
|
+
var e;
|
|
4441
|
+
return (function(t) {
|
|
4442
|
+
t.Tag = "tag", t.Mapping = "mapping";
|
|
4443
|
+
})(e || (Oe.DiscrError = e = {})), Oe;
|
|
4444
|
+
}
|
|
4445
|
+
var dn;
|
|
4446
|
+
function Vs() {
|
|
4447
|
+
if (dn) return ht;
|
|
4448
|
+
dn = 1, Object.defineProperty(ht, "__esModule", { value: !0 });
|
|
4449
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ zs(), m = /* @__PURE__ */ Lt(), c = /* @__PURE__ */ wt(), b = /* @__PURE__ */ Y(), l = {
|
|
4450
|
+
keyword: "discriminator",
|
|
4451
|
+
type: "object",
|
|
4452
|
+
schemaType: "object",
|
|
4453
|
+
error: {
|
|
4454
|
+
message: ({ params: { discrError: u, tagName: h } }) => u === t.DiscrError.Tag ? `tag "${h}" must be string` : `value of tag "${h}" must be in oneOf`,
|
|
4455
|
+
params: ({ params: { discrError: u, tag: h, tagName: $ } }) => (0, e._)`{error: ${u}, tag: ${$}, tagValue: ${h}}`
|
|
4456
|
+
},
|
|
4457
|
+
code(u) {
|
|
4458
|
+
const { gen: h, data: $, schema: v, parentSchema: P, it: _ } = u, { oneOf: y } = P;
|
|
4459
|
+
if (!_.opts.discriminator)
|
|
4460
|
+
throw new Error("discriminator: requires discriminator option");
|
|
4461
|
+
const g = v.propertyName;
|
|
4462
|
+
if (typeof g != "string")
|
|
4463
|
+
throw new Error("discriminator: requires propertyName");
|
|
4464
|
+
if (v.mapping)
|
|
4465
|
+
throw new Error("discriminator: mapping is not supported");
|
|
4466
|
+
if (!y)
|
|
4467
|
+
throw new Error("discriminator: requires oneOf keyword");
|
|
4468
|
+
const w = h.let("valid", !1), a = h.const("tag", (0, e._)`${$}${(0, e.getProperty)(g)}`);
|
|
4469
|
+
h.if((0, e._)`typeof ${a} == "string"`, () => i(), () => u.error(!1, { discrError: t.DiscrError.Tag, tag: a, tagName: g })), u.ok(w);
|
|
4470
|
+
function i() {
|
|
4471
|
+
const p = o();
|
|
4472
|
+
h.if(!1);
|
|
4473
|
+
for (const n in p)
|
|
4474
|
+
h.elseIf((0, e._)`${a} === ${n}`), h.assign(w, r(p[n]));
|
|
4475
|
+
h.else(), u.error(!1, { discrError: t.DiscrError.Mapping, tag: a, tagName: g }), h.endIf();
|
|
4476
|
+
}
|
|
4477
|
+
function r(p) {
|
|
4478
|
+
const n = h.name("valid"), f = u.subschema({ keyword: "oneOf", schemaProp: p }, n);
|
|
4479
|
+
return u.mergeEvaluated(f, e.Name), n;
|
|
4480
|
+
}
|
|
4481
|
+
function o() {
|
|
4482
|
+
var p;
|
|
4483
|
+
const n = {}, f = T(P);
|
|
4484
|
+
let S = !0;
|
|
4485
|
+
for (let z = 0; z < y.length; z++) {
|
|
4486
|
+
let V = y[z];
|
|
4487
|
+
if (V != null && V.$ref && !(0, b.schemaHasRulesButRef)(V, _.self.RULES)) {
|
|
4488
|
+
const J = V.$ref;
|
|
4489
|
+
if (V = m.resolveRef.call(_.self, _.schemaEnv.root, _.baseId, J), V instanceof m.SchemaEnv && (V = V.schema), V === void 0)
|
|
4490
|
+
throw new c.default(_.opts.uriResolver, _.baseId, J);
|
|
4491
|
+
}
|
|
4492
|
+
const U = (p = V == null ? void 0 : V.properties) === null || p === void 0 ? void 0 : p[g];
|
|
4493
|
+
if (typeof U != "object")
|
|
4494
|
+
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);
|
|
4495
|
+
S = S && (f || T(V)), j(U, z);
|
|
4496
|
+
}
|
|
4497
|
+
if (!S)
|
|
4498
|
+
throw new Error(`discriminator: "${g}" must be required`);
|
|
4499
|
+
return n;
|
|
4500
|
+
function T({ required: z }) {
|
|
4501
|
+
return Array.isArray(z) && z.includes(g);
|
|
4502
|
+
}
|
|
4503
|
+
function j(z, V) {
|
|
4504
|
+
if (z.const)
|
|
4505
|
+
D(z.const, V);
|
|
4506
|
+
else if (z.enum)
|
|
4507
|
+
for (const U of z.enum)
|
|
4508
|
+
D(U, V);
|
|
4509
|
+
else
|
|
4510
|
+
throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`);
|
|
4511
|
+
}
|
|
4512
|
+
function D(z, V) {
|
|
4513
|
+
if (typeof z != "string" || z in n)
|
|
4514
|
+
throw new Error(`discriminator: "${g}" values must be unique strings`);
|
|
4515
|
+
n[z] = V;
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4519
|
+
};
|
|
4520
|
+
return ht.default = l, ht;
|
|
4521
|
+
}
|
|
4522
|
+
const Fs = "http://json-schema.org/draft-07/schema#", Us = "http://json-schema.org/draft-07/schema#", Ls = "Core schema meta-schema", Ks = { schemaArray: { type: "array", minItems: 1, items: { $ref: "#" } }, nonNegativeInteger: { type: "integer", minimum: 0 }, nonNegativeIntegerDefault0: { allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] }, simpleTypes: { enum: ["array", "boolean", "integer", "null", "number", "object", "string"] }, stringArray: { type: "array", items: { type: "string" }, uniqueItems: !0, default: [] } }, Gs = ["object", "boolean"], Hs = { $id: { type: "string", format: "uri-reference" }, $schema: { type: "string", format: "uri" }, $ref: { type: "string", format: "uri-reference" }, $comment: { type: "string" }, title: { type: "string" }, description: { type: "string" }, default: !0, readOnly: { type: "boolean", default: !1 }, examples: { type: "array", items: !0 }, multipleOf: { type: "number", exclusiveMinimum: 0 }, maximum: { type: "number" }, exclusiveMaximum: { type: "number" }, minimum: { type: "number" }, exclusiveMinimum: { type: "number" }, maxLength: { $ref: "#/definitions/nonNegativeInteger" }, minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, pattern: { type: "string", format: "regex" }, additionalItems: { $ref: "#" }, items: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }], default: !0 }, maxItems: { $ref: "#/definitions/nonNegativeInteger" }, minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, uniqueItems: { type: "boolean", default: !1 }, contains: { $ref: "#" }, maxProperties: { $ref: "#/definitions/nonNegativeInteger" }, minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, required: { $ref: "#/definitions/stringArray" }, additionalProperties: { $ref: "#" }, definitions: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, properties: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, patternProperties: { type: "object", additionalProperties: { $ref: "#" }, propertyNames: { format: "regex" }, default: {} }, dependencies: { type: "object", additionalProperties: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] } }, propertyNames: { $ref: "#" }, const: !0, enum: { type: "array", items: !0, minItems: 1, uniqueItems: !0 }, type: { anyOf: [{ $ref: "#/definitions/simpleTypes" }, { type: "array", items: { $ref: "#/definitions/simpleTypes" }, minItems: 1, uniqueItems: !0 }] }, format: { type: "string" }, contentMediaType: { type: "string" }, contentEncoding: { type: "string" }, if: { $ref: "#" }, then: { $ref: "#" }, else: { $ref: "#" }, allOf: { $ref: "#/definitions/schemaArray" }, anyOf: { $ref: "#/definitions/schemaArray" }, oneOf: { $ref: "#/definitions/schemaArray" }, not: { $ref: "#" } }, Js = {
|
|
4523
|
+
$schema: Fs,
|
|
4524
|
+
$id: Us,
|
|
4525
|
+
title: Ls,
|
|
4526
|
+
definitions: Ks,
|
|
4527
|
+
type: Gs,
|
|
4528
|
+
properties: Hs,
|
|
4529
|
+
default: !0
|
|
4530
|
+
};
|
|
4531
|
+
var ln;
|
|
4532
|
+
function On() {
|
|
4533
|
+
return ln || (ln = 1, (function(e, t) {
|
|
4534
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.MissingRefError = t.ValidationError = t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = t.Ajv = void 0;
|
|
4535
|
+
const m = /* @__PURE__ */ ss(), c = /* @__PURE__ */ Ms(), b = /* @__PURE__ */ Vs(), s = Js, l = ["/properties"], u = "http://json-schema.org/draft-07/schema";
|
|
4536
|
+
class h extends m.default {
|
|
4537
|
+
_addVocabularies() {
|
|
4538
|
+
super._addVocabularies(), c.default.forEach((g) => this.addVocabulary(g)), this.opts.discriminator && this.addKeyword(b.default);
|
|
4539
|
+
}
|
|
4540
|
+
_addDefaultMetaSchema() {
|
|
4541
|
+
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
4542
|
+
return;
|
|
4543
|
+
const g = this.opts.$data ? this.$dataMetaSchema(s, l) : s;
|
|
4544
|
+
this.addMetaSchema(g, u, !1), this.refs["http://json-schema.org/schema"] = u;
|
|
4545
|
+
}
|
|
4546
|
+
defaultMeta() {
|
|
4547
|
+
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(u) ? u : void 0);
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
t.Ajv = h, e.exports = t = h, e.exports.Ajv = h, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = h;
|
|
4551
|
+
var $ = /* @__PURE__ */ $t();
|
|
4552
|
+
Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() {
|
|
4553
|
+
return $.KeywordCxt;
|
|
4554
|
+
} });
|
|
4555
|
+
var v = /* @__PURE__ */ H();
|
|
4556
|
+
Object.defineProperty(t, "_", { enumerable: !0, get: function() {
|
|
4557
|
+
return v._;
|
|
4558
|
+
} }), Object.defineProperty(t, "str", { enumerable: !0, get: function() {
|
|
4559
|
+
return v.str;
|
|
4560
|
+
} }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() {
|
|
4561
|
+
return v.stringify;
|
|
4562
|
+
} }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() {
|
|
4563
|
+
return v.nil;
|
|
4564
|
+
} }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() {
|
|
4565
|
+
return v.Name;
|
|
4566
|
+
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
4567
|
+
return v.CodeGen;
|
|
4568
|
+
} });
|
|
4569
|
+
var P = /* @__PURE__ */ Ut();
|
|
4570
|
+
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
4571
|
+
return P.default;
|
|
4572
|
+
} });
|
|
4573
|
+
var _ = /* @__PURE__ */ wt();
|
|
4574
|
+
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
4575
|
+
return _.default;
|
|
4576
|
+
} });
|
|
4577
|
+
})(Te, Te.exports)), Te.exports;
|
|
4578
|
+
}
|
|
4579
|
+
var Ws = /* @__PURE__ */ On(), mt = { exports: {} }, Dt = {}, fn;
|
|
4580
|
+
function Bs() {
|
|
4581
|
+
return fn || (fn = 1, (function(e) {
|
|
4582
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.formatNames = e.fastFormats = e.fullFormats = void 0;
|
|
4583
|
+
function t(j, D) {
|
|
4584
|
+
return { validate: j, compare: D };
|
|
4585
|
+
}
|
|
4586
|
+
e.fullFormats = {
|
|
4587
|
+
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
4588
|
+
date: t(s, l),
|
|
4589
|
+
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
4590
|
+
time: t(h, $),
|
|
4591
|
+
"date-time": t(P, _),
|
|
4592
|
+
// duration: https://tools.ietf.org/html/rfc3339#appendix-A
|
|
4593
|
+
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
4594
|
+
uri: w,
|
|
4595
|
+
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
|
|
4596
|
+
// uri-template: https://tools.ietf.org/html/rfc6570
|
|
4597
|
+
"uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
|
|
4598
|
+
// For the source: https://gist.github.com/dperini/729294
|
|
4599
|
+
// For test cases: https://mathiasbynens.be/demo/url-regex
|
|
4600
|
+
url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
|
|
4601
|
+
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
4602
|
+
hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
|
|
4603
|
+
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
|
4604
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
|
4605
|
+
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
4606
|
+
regex: T,
|
|
4607
|
+
// uuid: http://tools.ietf.org/html/rfc4122
|
|
4608
|
+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
4609
|
+
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
4610
|
+
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
|
4611
|
+
"json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
|
|
4612
|
+
"json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
|
|
4613
|
+
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
|
4614
|
+
"relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
|
|
4615
|
+
// the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types
|
|
4616
|
+
// byte: https://github.com/miguelmota/is-base64
|
|
4617
|
+
byte: i,
|
|
4618
|
+
// signed 32 bit integer
|
|
4619
|
+
int32: { type: "number", validate: p },
|
|
4620
|
+
// signed 64 bit integer
|
|
4621
|
+
int64: { type: "number", validate: n },
|
|
4622
|
+
// C-type float
|
|
4623
|
+
float: { type: "number", validate: f },
|
|
4624
|
+
// C-type double
|
|
4625
|
+
double: { type: "number", validate: f },
|
|
4626
|
+
// hint to the UI to hide input strings
|
|
4627
|
+
password: !0,
|
|
4628
|
+
// unchecked string payload
|
|
4629
|
+
binary: !0
|
|
4630
|
+
}, e.fastFormats = {
|
|
4631
|
+
...e.fullFormats,
|
|
4632
|
+
date: t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, l),
|
|
4633
|
+
time: t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, $),
|
|
4634
|
+
"date-time": t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, _),
|
|
4635
|
+
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
|
4636
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
4637
|
+
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
4638
|
+
// email (sources from jsen validator):
|
|
4639
|
+
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
|
4640
|
+
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
|
|
4641
|
+
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
|
4642
|
+
}, e.formatNames = Object.keys(e.fullFormats);
|
|
4643
|
+
function m(j) {
|
|
4644
|
+
return j % 4 === 0 && (j % 100 !== 0 || j % 400 === 0);
|
|
4645
|
+
}
|
|
4646
|
+
const c = /^(\d\d\d\d)-(\d\d)-(\d\d)$/, b = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4647
|
+
function s(j) {
|
|
4648
|
+
const D = c.exec(j);
|
|
4649
|
+
if (!D)
|
|
4650
|
+
return !1;
|
|
4651
|
+
const z = +D[1], V = +D[2], U = +D[3];
|
|
4652
|
+
return V >= 1 && V <= 12 && U >= 1 && U <= (V === 2 && m(z) ? 29 : b[V]);
|
|
4653
|
+
}
|
|
4654
|
+
function l(j, D) {
|
|
4655
|
+
if (j && D)
|
|
4656
|
+
return j > D ? 1 : j < D ? -1 : 0;
|
|
4657
|
+
}
|
|
4658
|
+
const u = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
4659
|
+
function h(j, D) {
|
|
4660
|
+
const z = u.exec(j);
|
|
4661
|
+
if (!z)
|
|
4662
|
+
return !1;
|
|
4663
|
+
const V = +z[1], U = +z[2], J = +z[3], x = z[5];
|
|
4664
|
+
return (V <= 23 && U <= 59 && J <= 59 || V === 23 && U === 59 && J === 60) && (!D || x !== "");
|
|
4665
|
+
}
|
|
4666
|
+
function $(j, D) {
|
|
4667
|
+
if (!(j && D))
|
|
4668
|
+
return;
|
|
4669
|
+
const z = u.exec(j), V = u.exec(D);
|
|
4670
|
+
if (z && V)
|
|
4671
|
+
return j = z[1] + z[2] + z[3] + (z[4] || ""), D = V[1] + V[2] + V[3] + (V[4] || ""), j > D ? 1 : j < D ? -1 : 0;
|
|
4672
|
+
}
|
|
4673
|
+
const v = /t|\s/i;
|
|
4674
|
+
function P(j) {
|
|
4675
|
+
const D = j.split(v);
|
|
4676
|
+
return D.length === 2 && s(D[0]) && h(D[1], !0);
|
|
4677
|
+
}
|
|
4678
|
+
function _(j, D) {
|
|
4679
|
+
if (!(j && D))
|
|
4680
|
+
return;
|
|
4681
|
+
const [z, V] = j.split(v), [U, J] = D.split(v), x = l(z, U);
|
|
4682
|
+
if (x !== void 0)
|
|
4683
|
+
return x || $(V, J);
|
|
4684
|
+
}
|
|
4685
|
+
const y = /\/|:/, g = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
4686
|
+
function w(j) {
|
|
4687
|
+
return y.test(j) && g.test(j);
|
|
4688
|
+
}
|
|
4689
|
+
const a = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
4690
|
+
function i(j) {
|
|
4691
|
+
return a.lastIndex = 0, a.test(j);
|
|
4692
|
+
}
|
|
4693
|
+
const r = -2147483648, o = 2 ** 31 - 1;
|
|
4694
|
+
function p(j) {
|
|
4695
|
+
return Number.isInteger(j) && j <= o && j >= r;
|
|
4696
|
+
}
|
|
4697
|
+
function n(j) {
|
|
4698
|
+
return Number.isInteger(j);
|
|
4699
|
+
}
|
|
4700
|
+
function f() {
|
|
4701
|
+
return !0;
|
|
4702
|
+
}
|
|
4703
|
+
const S = /[^\\]\\Z/;
|
|
4704
|
+
function T(j) {
|
|
4705
|
+
if (S.test(j))
|
|
4706
|
+
return !1;
|
|
4707
|
+
try {
|
|
4708
|
+
return new RegExp(j), !0;
|
|
4709
|
+
} catch {
|
|
4710
|
+
return !1;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
})(Dt)), Dt;
|
|
4714
|
+
}
|
|
4715
|
+
var At = {}, hn;
|
|
4716
|
+
function Ys() {
|
|
4717
|
+
return hn || (hn = 1, (function(e) {
|
|
4718
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.formatLimitDefinition = void 0;
|
|
4719
|
+
const t = /* @__PURE__ */ On(), m = /* @__PURE__ */ H(), c = m.operators, b = {
|
|
4720
|
+
formatMaximum: { okStr: "<=", ok: c.LTE, fail: c.GT },
|
|
4721
|
+
formatMinimum: { okStr: ">=", ok: c.GTE, fail: c.LT },
|
|
4722
|
+
formatExclusiveMaximum: { okStr: "<", ok: c.LT, fail: c.GTE },
|
|
4723
|
+
formatExclusiveMinimum: { okStr: ">", ok: c.GT, fail: c.LTE }
|
|
4724
|
+
}, s = {
|
|
4725
|
+
message: ({ keyword: u, schemaCode: h }) => m.str`should be ${b[u].okStr} ${h}`,
|
|
4726
|
+
params: ({ keyword: u, schemaCode: h }) => m._`{comparison: ${b[u].okStr}, limit: ${h}}`
|
|
4727
|
+
};
|
|
4728
|
+
e.formatLimitDefinition = {
|
|
4729
|
+
keyword: Object.keys(b),
|
|
4730
|
+
type: "string",
|
|
4731
|
+
schemaType: "string",
|
|
4732
|
+
$data: !0,
|
|
4733
|
+
error: s,
|
|
4734
|
+
code(u) {
|
|
4735
|
+
const { gen: h, data: $, schemaCode: v, keyword: P, it: _ } = u, { opts: y, self: g } = _;
|
|
4736
|
+
if (!y.validateFormats)
|
|
4737
|
+
return;
|
|
4738
|
+
const w = new t.KeywordCxt(_, g.RULES.all.format.definition, "format");
|
|
4739
|
+
w.$data ? a() : i();
|
|
4740
|
+
function a() {
|
|
4741
|
+
const o = h.scopeValue("formats", {
|
|
4742
|
+
ref: g.formats,
|
|
4743
|
+
code: y.code.formats
|
|
4744
|
+
}), p = h.const("fmt", m._`${o}[${w.schemaCode}]`);
|
|
4745
|
+
u.fail$data(m.or(m._`typeof ${p} != "object"`, m._`${p} instanceof RegExp`, m._`typeof ${p}.compare != "function"`, r(p)));
|
|
4746
|
+
}
|
|
4747
|
+
function i() {
|
|
4748
|
+
const o = w.schema, p = g.formats[o];
|
|
4749
|
+
if (!p || p === !0)
|
|
4750
|
+
return;
|
|
4751
|
+
if (typeof p != "object" || p instanceof RegExp || typeof p.compare != "function")
|
|
4752
|
+
throw new Error(`"${P}": format "${o}" does not define "compare" function`);
|
|
4753
|
+
const n = h.scopeValue("formats", {
|
|
4754
|
+
key: o,
|
|
4755
|
+
ref: p,
|
|
4756
|
+
code: y.code.formats ? m._`${y.code.formats}${m.getProperty(o)}` : void 0
|
|
4757
|
+
});
|
|
4758
|
+
u.fail$data(r(n));
|
|
4759
|
+
}
|
|
4760
|
+
function r(o) {
|
|
4761
|
+
return m._`${o}.compare(${$}, ${v}) ${b[P].fail} 0`;
|
|
4762
|
+
}
|
|
4763
|
+
},
|
|
4764
|
+
dependencies: ["format"]
|
|
4765
|
+
};
|
|
4766
|
+
const l = (u) => (u.addKeyword(e.formatLimitDefinition), u);
|
|
4767
|
+
e.default = l;
|
|
4768
|
+
})(At)), At;
|
|
4769
|
+
}
|
|
4770
|
+
var mn;
|
|
4771
|
+
function Zs() {
|
|
4772
|
+
return mn || (mn = 1, (function(e, t) {
|
|
4773
|
+
Object.defineProperty(t, "__esModule", { value: !0 });
|
|
4774
|
+
const m = Bs(), c = Ys(), b = /* @__PURE__ */ H(), s = new b.Name("fullFormats"), l = new b.Name("fastFormats"), u = ($, v = { keywords: !0 }) => {
|
|
4775
|
+
if (Array.isArray(v))
|
|
4776
|
+
return h($, v, m.fullFormats, s), $;
|
|
4777
|
+
const [P, _] = v.mode === "fast" ? [m.fastFormats, l] : [m.fullFormats, s], y = v.formats || m.formatNames;
|
|
4778
|
+
return h($, y, P, _), v.keywords && c.default($), $;
|
|
4779
|
+
};
|
|
4780
|
+
u.get = ($, v = "full") => {
|
|
4781
|
+
const _ = (v === "fast" ? m.fastFormats : m.fullFormats)[$];
|
|
4782
|
+
if (!_)
|
|
4783
|
+
throw new Error(`Unknown format "${$}"`);
|
|
4784
|
+
return _;
|
|
4785
|
+
};
|
|
4786
|
+
function h($, v, P, _) {
|
|
4787
|
+
var y, g;
|
|
4788
|
+
(y = (g = $.opts.code).formats) !== null && y !== void 0 || (g.formats = b._`require("ajv-formats/dist/formats").${_}`);
|
|
4789
|
+
for (const w of v)
|
|
4790
|
+
$.addFormat(w, P[w]);
|
|
4791
|
+
}
|
|
4792
|
+
e.exports = t = u, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = u;
|
|
4793
|
+
})(mt, mt.exports)), mt.exports;
|
|
4794
|
+
}
|
|
4795
|
+
var Qs = Zs();
|
|
4796
|
+
const Xs = /* @__PURE__ */ Ln(Qs), xs = "http://json-schema.org/draft-07/schema#", ea = "https://github.com/borderux/recursica/tree/main/packages/adapter-tester/src/adapter-tester.schema.json", ta = "adapter-tester.config.json", ra = "Configuration for @recursica/adapter-tester. All fields are optional — an adapter repo with a normal `storybook` npm script needs no config file at all.", na = "object", sa = !1, aa = { $schema: { type: "string", description: 'Optional pointer to this schema for editor autocomplete, e.g. "./node_modules/@recursica/adapter-tester/src/adapter-tester.schema.json".' }, name: { type: "string", description: `Label for this project's own target. Defaults to the unscoped name in this project's package.json (e.g. "@recursica/mui-adapter" -> "mui-adapter").` }, storybook: { type: "object", additionalProperties: !1, description: "This project's own Storybook target.", properties: { port: { type: "integer", minimum: 1, maximum: 65535, description: "Port the target's Storybook is served on. Auto-detected from this project's own `scripts.storybook` (a `-p <port>`/`--port <port>` flag) when omitted, falling back to Storybook's own default of 6006." }, command: { type: "string", description: "Command that boots the target's Storybook. Defaults to `npm run storybook`." }, cwd: { type: "string", description: 'Directory the command runs in, relative to the config file. Defaults to ".".' } } }, sourceOfTruth: { description: 'The comparison target. Defaults to `{ "type": "mantine-harness" }`.', oneOf: [{ type: "object", additionalProperties: !1, description: "Default mode: boots a throwaway harness that installs the published @recursica/mantine-adapter from npm — no monorepo checkout required.", properties: { type: { const: "mantine-harness" }, port: { type: "integer", minimum: 1, maximum: 65535, description: "Port the throwaway harness's Storybook is served on. Defaults to 6011." }, mantineAdapterVersion: { type: "string", description: "npm version/tag of @recursica/mantine-adapter to install in the harness. Defaults to `latest`." }, storybookTemplateVersion: { type: "string", description: "npm version/tag of @recursica/storybook-template to install in the harness. Defaults to `latest`." } } }, { type: "object", additionalProperties: !1, description: "Non-standard mode: points at an already-addressable Storybook — e.g. a sibling workspace package's own Storybook inside this monorepo.", required: ["type", "port"], properties: { type: { const: "url" }, name: { type: "string", description: 'Label for the source-of-truth target. Defaults to "Mantine".' }, port: { type: "integer", minimum: 1, maximum: 65535, description: "Port the source-of-truth Storybook is served on." }, command: { type: "string", description: "Command that boots the source-of-truth Storybook. Defaults to `npm run storybook`." }, cwd: { type: "string", description: 'Directory the command runs in, relative to the config file. Defaults to ".".' } } }] }, diffThresholdPixels: { type: "number", minimum: 0, description: "Global visual diff threshold, in mismatched pixels, before a story is considered a failure. Defaults to 3500. AI agents must not modify this field — see AGENT.md." }, relaxedThresholdStoryIds: { type: "array", items: { type: "string" }, description: "Story id prefixes that use `relaxedThresholdPixels` instead of the global `diffThresholdPixels`." }, relaxedThresholdPixels: { type: "number", minimum: 0, description: "Diff threshold applied to stories matching `relaxedThresholdStoryIds`." }, excludeTitlePrefixes: { type: "array", items: { type: "string" }, description: "Storybook title prefixes to exclude from comparison, in addition to the built-in denylist (`Theme/*`, `Tokens/*`, `Introduction`)." } }, oa = {
|
|
4797
|
+
$schema: xs,
|
|
4798
|
+
$id: ea,
|
|
4799
|
+
title: ta,
|
|
4800
|
+
description: ra,
|
|
4801
|
+
type: na,
|
|
4802
|
+
additionalProperties: sa,
|
|
4803
|
+
properties: aa
|
|
4804
|
+
}, ia = Xs, Tn = new Ws.Ajv({ allErrors: !0, strict: !0 });
|
|
4805
|
+
ia(Tn);
|
|
4806
|
+
const pn = Tn.compile(oa);
|
|
4807
|
+
function ua(e, t) {
|
|
4808
|
+
if (pn(e)) return;
|
|
4809
|
+
const m = (pn.errors ?? []).map((c) => {
|
|
4810
|
+
var s;
|
|
4811
|
+
const b = (s = c.params) != null && s.additionalProperty ? ` '${c.params.additionalProperty}'` : "";
|
|
4812
|
+
return ` - ${c.instancePath || "root"} ${c.message}${b}`;
|
|
4813
|
+
}).join(`
|
|
4814
|
+
`);
|
|
4815
|
+
throw new Error(`Invalid ${t}:
|
|
4816
|
+
${m}`);
|
|
4817
|
+
}
|
|
4818
|
+
const ca = "adapter-tester.config.json", yn = "npm run storybook", da = 6006, la = 6011, gn = "Mantine", fa = 3500;
|
|
4819
|
+
function jn(e) {
|
|
4820
|
+
const t = de(e, "package.json");
|
|
4821
|
+
if (!_n(t))
|
|
4822
|
+
throw new Error(
|
|
4823
|
+
`No package.json found in ${e} — run adapter-tester from the root of the project being tested.`
|
|
4824
|
+
);
|
|
4825
|
+
return JSON.parse(pt(t, "utf8"));
|
|
4826
|
+
}
|
|
4827
|
+
function ha(e) {
|
|
4828
|
+
var b;
|
|
4829
|
+
const m = (b = jn(e).scripts) == null ? void 0 : b.storybook, c = m == null ? void 0 : m.match(/(?:-p|--port)[ =](\d+)/);
|
|
4830
|
+
return c ? Number(c[1]) : da;
|
|
4831
|
+
}
|
|
4832
|
+
function ma(e) {
|
|
4833
|
+
const m = jn(e).name;
|
|
4834
|
+
return m ? m.split("/").pop() : "Adapter";
|
|
4835
|
+
}
|
|
4836
|
+
function pa(e) {
|
|
4837
|
+
const t = de(e, ca);
|
|
4838
|
+
if (!_n(t))
|
|
4839
|
+
return {};
|
|
4840
|
+
const m = JSON.parse(pt(t, "utf8"));
|
|
4841
|
+
return ua(m, t), m;
|
|
4842
|
+
}
|
|
4843
|
+
function ya(e) {
|
|
4844
|
+
var _, y, g;
|
|
4845
|
+
const t = pa(e), m = t.name ?? ma(e), c = ((_ = t.storybook) == null ? void 0 : _.port) ?? ha(e), b = ((y = t.storybook) == null ? void 0 : y.command) ?? yn, s = Wt(e, ((g = t.storybook) == null ? void 0 : g.cwd) ?? "."), l = t.sourceOfTruth ?? {
|
|
4846
|
+
type: "mantine-harness"
|
|
4847
|
+
};
|
|
4848
|
+
let u, h, $;
|
|
4849
|
+
l.type === "url" ? (u = l.name ?? gn, h = l.port, $ = {
|
|
4850
|
+
command: l.command ?? yn,
|
|
4851
|
+
port: l.port,
|
|
4852
|
+
cwd: Wt(e, l.cwd ?? "."),
|
|
4853
|
+
reuseExistingServer: !process.env.CI,
|
|
4854
|
+
timeout: 120 * 1e3
|
|
4855
|
+
}) : (u = gn, h = l.port ?? la, $ = Vn({
|
|
4856
|
+
dir: de(e, ".adapter-tester/mantine-harness"),
|
|
4857
|
+
port: h,
|
|
4858
|
+
mantineAdapterVersion: l.mantineAdapterVersion,
|
|
4859
|
+
storybookTemplateVersion: l.storybookTemplateVersion
|
|
4860
|
+
}));
|
|
4861
|
+
const v = {
|
|
4862
|
+
targets: [
|
|
4863
|
+
{
|
|
4864
|
+
name: u,
|
|
4865
|
+
url: `http://localhost:${h}`,
|
|
4866
|
+
sourceOfTruth: !0
|
|
4867
|
+
},
|
|
4868
|
+
{ name: m, url: `http://localhost:${c}` }
|
|
4869
|
+
],
|
|
4870
|
+
diffThresholdPixels: t.diffThresholdPixels ?? fa,
|
|
4871
|
+
relaxedThresholdStoryIds: t.relaxedThresholdStoryIds,
|
|
4872
|
+
relaxedThresholdPixels: t.relaxedThresholdPixels,
|
|
4873
|
+
excludeTitlePrefixes: t.excludeTitlePrefixes
|
|
4874
|
+
}, P = [
|
|
4875
|
+
$,
|
|
4876
|
+
{
|
|
4877
|
+
command: b,
|
|
4878
|
+
port: c,
|
|
4879
|
+
cwd: s,
|
|
4880
|
+
reuseExistingServer: !process.env.CI,
|
|
4881
|
+
timeout: 120 * 1e3
|
|
4882
|
+
}
|
|
4883
|
+
];
|
|
4884
|
+
return { engineConfig: v, webServers: P };
|
|
4885
|
+
}
|
|
4886
|
+
const ga = $n(wn(import.meta.url)), va = Dn(de(ga, "testing.js")).href, zt = process.cwd(), { engineConfig: Vt, webServers: Ft } = ya(zt);
|
|
4887
|
+
process.argv.includes("--dry-run") && (console.log(JSON.stringify({ engineConfig: Vt, webServers: Ft }, null, 2)), process.exit(0));
|
|
4888
|
+
process.argv.includes("--serve") ? Un(Vt, Ft) : _a(Ft, Vt);
|
|
4889
|
+
function _a(e, t) {
|
|
4890
|
+
const m = de(zt, ".adapter-tester/run");
|
|
4891
|
+
Cn(m, { recursive: !0 }), Jt(
|
|
4892
|
+
de(m, "playwright.config.js"),
|
|
4893
|
+
`// Generated by \`adapter-tester\` — do not edit, regenerated on every run.
|
|
4894
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
4895
|
+
|
|
4896
|
+
export default defineConfig({
|
|
4897
|
+
testDir: ${JSON.stringify(m)},
|
|
4898
|
+
fullyParallel: true,
|
|
4899
|
+
forbidOnly: !!process.env.CI,
|
|
4900
|
+
retries: process.env.CI ? 2 : 0,
|
|
4901
|
+
workers: process.env.CI ? 1 : undefined,
|
|
4902
|
+
reporter: [["html", { open: "never" }], ["list"]],
|
|
4903
|
+
use: { trace: "on-first-retry" },
|
|
4904
|
+
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
|
|
4905
|
+
webServer: ${JSON.stringify(e, null, 2)},
|
|
4906
|
+
});
|
|
4907
|
+
`
|
|
4908
|
+
), Jt(
|
|
4909
|
+
de(m, "visual-regression.spec.js"),
|
|
4910
|
+
`// Generated by \`adapter-tester\` — do not edit, regenerated on every run.
|
|
4911
|
+
import { runVisualRegression } from ${JSON.stringify(va)};
|
|
4912
|
+
|
|
4913
|
+
await runVisualRegression(${JSON.stringify(t, null, 2)});
|
|
4914
|
+
`
|
|
4915
|
+
);
|
|
4916
|
+
const c = qn(
|
|
4917
|
+
"npx",
|
|
4918
|
+
["playwright", "test", "--config", de(m, "playwright.config.js")],
|
|
4919
|
+
{ stdio: "inherit", cwd: zt, shell: process.platform === "win32" }
|
|
4920
|
+
);
|
|
4921
|
+
process.exit(c.status ?? 1);
|
|
4922
|
+
}
|
|
4923
|
+
//# sourceMappingURL=cli.js.map
|