@nsshunt/stsutils 1.15.24 → 1.15.26

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