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