biketag-admin
Version:
<h1 align=center>BikeTag-Admin</h1> <div align="center"> <img alt="biketag-admin logo" src="https://raw.githubusercontent.com/keneucker/biketag-website/production/public/img/Tag-Logo-Stacked-V2-medium.png" height="auto" width="200" style="border-radius:25
1,443 lines • 435 kB
JavaScript
var Ji = Object.defineProperty;
var Yi = (r, e, t) => e in r ? Ji(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
var xr = (r, e, t) => (Yi(r, typeof e != "symbol" ? e + "" : e, t), t);
import Qi from "biketag";
import { reactive as Zi, openBlock as Kt, createElementBlock as Vt, createTextVNode as ec, Fragment as Jo, renderList as rc, normalizeStyle as tc, createElementVNode as xt, toDisplayString as Bn, unref as nc, createCommentVNode as ac } from "vue";
import { defineStore as Bt } from "pinia";
const _x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null
}, Symbol.toStringTag, { value: "Module" })), Ce = {
appId: "com.app.biketag",
accessToken: "8b4e2b86a724bf3f39d6766de6e67212",
admingEmail: "biketag@biketag.org",
gameName: "",
host: "biketag.org",
hostKey: "ItsABikeTagGame",
tagSource: "imgur",
gameSource: "sanity",
store: "biketag-admin",
/// TODO: THIS IS BAD
sanityImagesCDNUrl: "https://cdn.sanity.io/images/",
sanityBaseCDNUrl: "https://cdn.sanity.io/images/x37ikhvs/production/",
sanityPlayerRoleID: "rol_pcbQ68Q9L0yn1o3O",
sanityAmbassadorRoleID: "rol_iET51vzIn8z6Utz0"
}, Ex = {
APP_ID: process.env.APP_ID ?? Ce.appId,
ACCESS_TOKEN: process.env.ACCESS_TOKEN ?? Ce.accessToken,
CONTEXT: process.env.CONTEXT ?? null,
ADMIN_EMAIL: process.env.ADMIN_EMAIL ?? Ce.admingEmail,
AMBASSADOR_ROLE: process.env.AMBASSADOR_ROLE ?? Ce.sanityAmbassadorRoleID,
PLAYER_ROLE: process.env.PLAYER_ROLE ?? Ce.sanityPlayerRoleID,
/* Auth0 Configuration */
A_AUDIENCE: process.env.A_AUDIENCE ?? null,
A_CID: process.env.A_CID ?? null,
A_DOMAIN: process.env.A_DOMAIN ?? null,
A_M_CS: process.env.A_M_CS ?? null,
A_M_CID: process.env.A_M_CID ?? null,
/* Bugs Configuration */
B_AKEY: process.env.B_AKEY ?? null,
/* BikeTag Configuration */
GAME_NAME: process.env.GAME_NAME ?? null,
GAME_SOURCE: process.env.GAME_SOURCE ?? null,
HOST: process.env.HOST ?? Ce.host,
HOST_KEY: process.env.HOST_KEY ?? Ce.hostKey,
BIKETAG_AUTHED: process.env.B_AUTHED ?? process.env.BIKETAG_AUTHED ?? null,
/* Google Configuration */
G_AKEY: process.env.G_AKEY ?? process.env.GOOGLE_ACCESS_TOKEN ?? process.env.GOOGLE_API_KEY ?? null,
G_CID: process.env.G_CID ?? process.env.GOOGLE_CLIENT_ID ?? null,
G_CSECRET: process.env.G_CSECRET ?? process.env.GOOGLE_CLIENT_SECRET ?? null,
G_EMAIL: process.env.G_EMAIL ?? process.env.GOOGLE_EMAIL_ADDRESS ?? null,
G_PASS: process.env.G_PASS ?? process.env.GOOGLE_PASSWORD ?? null,
G_RTOKEN: process.env.G_RTOKEN ?? process.env.GOOGLE_REFRESH_TOKEN ?? null,
/* Imgur Admin Configuration */
IA_CID: process.env.IA_CID ?? process.env.IMGUR_ADMIN_CLIENT_ID ?? null,
IA_CSECRET: process.env.IA_CSECRET ?? process.env.IMGUR_ADMIN_CLIENT_SECRET ?? null,
IA_RTOKEN: process.env.IA_RTOKEN ?? process.env.IMGUR_ADMIN_REFRESH_TOKEN ?? null,
IA_TOKEN: process.env.IA_TOKEN ?? process.env.IMGUR_ADMIN_ACCESS_TOKEN ?? null,
/* Imgur Configuration */
I_CID: process.env.I_CID ?? process.env.IMGUR_CLIENT_ID ?? null,
I_CSECRET: process.env.I_CSECRET ?? process.env.IMGUR_CLIENT_SECRET ?? null,
I_RTOKEN: process.env.I_RTOKEN ?? process.env.IMGUR_REFRESH_TOKEN ?? null,
I_TOKEN: process.env.I_TOKEN ?? process.env.IMGUR_ACCESS_TOKEN ?? null,
/* Sanity Admin Configuration */
SA_CDN_URL: process.env.SA_CDN_URL ?? Ce.sanityImagesCDNUrl,
SA_DSET: process.env.SA_DSET ?? process.env.SANITY_ADMIN_DATASET ?? null,
SA_PID: process.env.SA_PID ?? process.env.SANITY_ADMIN_PROJECT_ID ?? null,
SA_TOKEN: process.env.SA_TOKEN ?? process.env.SANITY_ADMIN_ACCESS_TOKEN ?? null,
/* Sanity Configuration */
S_CURL: process.env.S_CURL ?? Ce.sanityImagesCDNUrl,
S_DSET: process.env.S_DSET ?? process.env.SANITY_DATASET ?? null,
S_PID: process.env.S_PID ?? process.env.SANITY_PROJECT_ID ?? null,
S_TOKEN: process.env.S_TOKEN ?? process.env.SANITY_ACCESS_TOKEN ?? null
};
var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function pn(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
function oc(r) {
if (r.__esModule)
return r;
var e = r.default;
if (typeof e == "function") {
var t = function n() {
return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
};
t.prototype = e.prototype;
} else
t = {};
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(n) {
var a = Object.getOwnPropertyDescriptor(r, n);
Object.defineProperty(t, n, a.get ? a : {
enumerable: !0,
get: function() {
return r[n];
}
});
}), t;
}
var Ma = { exports: {} }, Rs = {}, rr = {}, tt = {}, Ft = {}, se = {}, Dt = {};
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.regexpCode = r.getEsmExportName = r.getProperty = r.safeStringify = r.stringify = r.strConcat = r.addCodeArg = r.str = r._ = r.nil = r._Code = r.Name = r.IDENTIFIER = r._CodeOrName = void 0;
class e {
}
r._CodeOrName = e, r.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
class t extends e {
constructor(l) {
if (super(), !r.IDENTIFIER.test(l))
throw new Error("CodeGen: name must be a valid identifier");
this.str = l;
}
toString() {
return this.str;
}
emptyStr() {
return !1;
}
get names() {
return { [this.str]: 1 };
}
}
r.Name = t;
class n extends e {
constructor(l) {
super(), this._items = typeof l == "string" ? [l] : l;
}
toString() {
return this.str;
}
emptyStr() {
if (this._items.length > 1)
return !1;
const l = this._items[0];
return l === "" || l === '""';
}
get str() {
var l;
return (l = this._str) !== null && l !== void 0 ? l : this._str = this._items.reduce((_, A) => `${_}${A}`, "");
}
get names() {
var l;
return (l = this._names) !== null && l !== void 0 ? l : this._names = this._items.reduce((_, A) => (A instanceof t && (_[A.str] = (_[A.str] || 0) + 1), _), {});
}
}
r._Code = n, r.nil = new n("");
function a(d, ...l) {
const _ = [d[0]];
let A = 0;
for (; A < l.length; )
c(_, l[A]), _.push(d[++A]);
return new n(_);
}
r._ = a;
const s = new n("+");
function p(d, ...l) {
const _ = [h(d[0])];
let A = 0;
for (; A < l.length; )
_.push(s), c(_, l[A]), _.push(s, h(d[++A]));
return x(_), new n(_);
}
r.str = p;
function c(d, l) {
l instanceof n ? d.push(...l._items) : l instanceof t ? d.push(l) : d.push(f(l));
}
r.addCodeArg = c;
function x(d) {
let l = 1;
for (; l < d.length - 1; ) {
if (d[l] === s) {
const _ = o(d[l - 1], d[l + 1]);
if (_ !== void 0) {
d.splice(l - 1, 3, _);
continue;
}
d[l++] = "+";
}
l++;
}
}
function o(d, l) {
if (l === '""')
return d;
if (d === '""')
return l;
if (typeof d == "string")
return l instanceof t || d[d.length - 1] !== '"' ? void 0 : typeof l != "string" ? `${d.slice(0, -1)}${l}"` : l[0] === '"' ? d.slice(0, -1) + l.slice(1) : void 0;
if (typeof l == "string" && l[0] === '"' && !(d instanceof t))
return `"${d}${l.slice(1)}`;
}
function i(d, l) {
return l.emptyStr() ? d : d.emptyStr() ? l : p`${d}${l}`;
}
r.strConcat = i;
function f(d) {
return typeof d == "number" || typeof d == "boolean" || d === null ? d : h(Array.isArray(d) ? d.join(",") : d);
}
function u(d) {
return new n(h(d));
}
r.stringify = u;
function h(d) {
return JSON.stringify(d).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
}
r.safeStringify = h;
function g(d) {
return typeof d == "string" && r.IDENTIFIER.test(d) ? new n(`.${d}`) : a`[${d}]`;
}
r.getProperty = g;
function y(d) {
if (typeof d == "string" && r.IDENTIFIER.test(d))
return new n(`${d}`);
throw new Error(`CodeGen: invalid export name: ${d}, use explicit $id name mapping`);
}
r.getEsmExportName = y;
function v(d) {
return new n(d.toString());
}
r.regexpCode = v;
})(Dt);
var Ua = {};
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.ValueScope = r.ValueScopeName = r.Scope = r.varKinds = r.UsedValueState = void 0;
const e = Dt;
class t extends Error {
constructor(o) {
super(`CodeGen: "code" for ${o} not defined`), this.value = o.value;
}
}
var n;
(function(x) {
x[x.Started = 0] = "Started", x[x.Completed = 1] = "Completed";
})(n = r.UsedValueState || (r.UsedValueState = {})), r.varKinds = {
const: new e.Name("const"),
let: new e.Name("let"),
var: new e.Name("var")
};
class a {
constructor({ prefixes: o, parent: i } = {}) {
this._names = {}, this._prefixes = o, this._parent = i;
}
toName(o) {
return o instanceof e.Name ? o : this.name(o);
}
name(o) {
return new e.Name(this._newName(o));
}
_newName(o) {
const i = this._names[o] || this._nameGroup(o);
return `${o}${i.index++}`;
}
_nameGroup(o) {
var i, f;
if (!((f = (i = this._parent) === null || i === void 0 ? void 0 : i._prefixes) === null || f === void 0) && f.has(o) || this._prefixes && !this._prefixes.has(o))
throw new Error(`CodeGen: prefix "${o}" is not allowed in this scope`);
return this._names[o] = { prefix: o, index: 0 };
}
}
r.Scope = a;
class s extends e.Name {
constructor(o, i) {
super(i), this.prefix = o;
}
setValue(o, { property: i, itemIndex: f }) {
this.value = o, this.scopePath = (0, e._)`.${new e.Name(i)}[${f}]`;
}
}
r.ValueScopeName = s;
const p = (0, e._)`\n`;
class c extends a {
constructor(o) {
super(o), this._values = {}, this._scope = o.scope, this.opts = { ...o, _n: o.lines ? p : e.nil };
}
get() {
return this._scope;
}
name(o) {
return new s(o, this._newName(o));
}
value(o, i) {
var f;
if (i.ref === void 0)
throw new Error("CodeGen: ref must be passed in value");
const u = this.toName(o), { prefix: h } = u, g = (f = i.key) !== null && f !== void 0 ? f : i.ref;
let y = this._values[h];
if (y) {
const l = y.get(g);
if (l)
return l;
} else
y = this._values[h] = /* @__PURE__ */ new Map();
y.set(g, u);
const v = this._scope[h] || (this._scope[h] = []), d = v.length;
return v[d] = i.ref, u.setValue(i, { property: h, itemIndex: d }), u;
}
getValue(o, i) {
const f = this._values[o];
if (f)
return f.get(i);
}
scopeRefs(o, i = this._values) {
return this._reduceValues(i, (f) => {
if (f.scopePath === void 0)
throw new Error(`CodeGen: name "${f}" has no value`);
return (0, e._)`${o}${f.scopePath}`;
});
}
scopeCode(o = this._values, i, f) {
return this._reduceValues(o, (u) => {
if (u.value === void 0)
throw new Error(`CodeGen: name "${u}" has no value`);
return u.value.code;
}, i, f);
}
_reduceValues(o, i, f = {}, u) {
let h = e.nil;
for (const g in o) {
const y = o[g];
if (!y)
continue;
const v = f[g] = f[g] || /* @__PURE__ */ new Map();
y.forEach((d) => {
if (v.has(d))
return;
v.set(d, n.Started);
let l = i(d);
if (l) {
const _ = this.opts.es5 ? r.varKinds.var : r.varKinds.const;
h = (0, e._)`${h}${_} ${d} = ${l};${this.opts._n}`;
} else if (l = u == null ? void 0 : u(d))
h = (0, e._)`${h}${l}${this.opts._n}`;
else
throw new t(d);
v.set(d, n.Completed);
});
}
return h;
}
}
r.ValueScope = c;
})(Ua);
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.or = r.and = r.not = r.CodeGen = r.operators = r.varKinds = r.ValueScopeName = r.ValueScope = r.Scope = r.Name = r.regexpCode = r.stringify = r.getProperty = r.nil = r.strConcat = r.str = r._ = void 0;
const e = Dt, t = Ua;
var n = Dt;
Object.defineProperty(r, "_", { enumerable: !0, get: function() {
return n._;
} }), Object.defineProperty(r, "str", { enumerable: !0, get: function() {
return n.str;
} }), Object.defineProperty(r, "strConcat", { enumerable: !0, get: function() {
return n.strConcat;
} }), Object.defineProperty(r, "nil", { enumerable: !0, get: function() {
return n.nil;
} }), Object.defineProperty(r, "getProperty", { enumerable: !0, get: function() {
return n.getProperty;
} }), Object.defineProperty(r, "stringify", { enumerable: !0, get: function() {
return n.stringify;
} }), Object.defineProperty(r, "regexpCode", { enumerable: !0, get: function() {
return n.regexpCode;
} }), Object.defineProperty(r, "Name", { enumerable: !0, get: function() {
return n.Name;
} });
var a = Ua;
Object.defineProperty(r, "Scope", { enumerable: !0, get: function() {
return a.Scope;
} }), Object.defineProperty(r, "ValueScope", { enumerable: !0, get: function() {
return a.ValueScope;
} }), Object.defineProperty(r, "ValueScopeName", { enumerable: !0, get: function() {
return a.ValueScopeName;
} }), Object.defineProperty(r, "varKinds", { enumerable: !0, get: function() {
return a.varKinds;
} }), r.operators = {
GT: new e._Code(">"),
GTE: new e._Code(">="),
LT: new e._Code("<"),
LTE: new e._Code("<="),
EQ: new e._Code("==="),
NEQ: new e._Code("!=="),
NOT: new e._Code("!"),
OR: new e._Code("||"),
AND: new e._Code("&&"),
ADD: new e._Code("+")
};
class s {
optimizeNodes() {
return this;
}
optimizeNames(m, P) {
return this;
}
}
class p extends s {
constructor(m, P, I) {
super(), this.varKind = m, this.name = P, this.rhs = I;
}
render({ es5: m, _n: P }) {
const I = m ? t.varKinds.var : this.varKind, z = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
return `${I} ${this.name}${z};` + P;
}
optimizeNames(m, P) {
if (m[this.name.str])
return this.rhs && (this.rhs = K(this.rhs, m, P)), this;
}
get names() {
return this.rhs instanceof e._CodeOrName ? this.rhs.names : {};
}
}
class c extends s {
constructor(m, P, I) {
super(), this.lhs = m, this.rhs = P, this.sideEffects = I;
}
render({ _n: m }) {
return `${this.lhs} = ${this.rhs};` + m;
}
optimizeNames(m, P) {
if (!(this.lhs instanceof e.Name && !m[this.lhs.str] && !this.sideEffects))
return this.rhs = K(this.rhs, m, P), this;
}
get names() {
const m = this.lhs instanceof e.Name ? {} : { ...this.lhs.names };
return L(m, this.rhs);
}
}
class x extends c {
constructor(m, P, I, z) {
super(m, I, z), this.op = P;
}
render({ _n: m }) {
return `${this.lhs} ${this.op}= ${this.rhs};` + m;
}
}
class o extends s {
constructor(m) {
super(), this.label = m, this.names = {};
}
render({ _n: m }) {
return `${this.label}:` + m;
}
}
class i extends s {
constructor(m) {
super(), this.label = m, this.names = {};
}
render({ _n: m }) {
return `break${this.label ? ` ${this.label}` : ""};` + m;
}
}
class f extends s {
constructor(m) {
super(), this.error = m;
}
render({ _n: m }) {
return `throw ${this.error};` + m;
}
get names() {
return this.error.names;
}
}
class u extends s {
constructor(m) {
super(), this.code = m;
}
render({ _n: m }) {
return `${this.code};` + m;
}
optimizeNodes() {
return `${this.code}` ? this : void 0;
}
optimizeNames(m, P) {
return this.code = K(this.code, m, P), this;
}
get names() {
return this.code instanceof e._CodeOrName ? this.code.names : {};
}
}
class h extends s {
constructor(m = []) {
super(), this.nodes = m;
}
render(m) {
return this.nodes.reduce((P, I) => P + I.render(m), "");
}
optimizeNodes() {
const { nodes: m } = this;
let P = m.length;
for (; P--; ) {
const I = m[P].optimizeNodes();
Array.isArray(I) ? m.splice(P, 1, ...I) : I ? m[P] = I : m.splice(P, 1);
}
return m.length > 0 ? this : void 0;
}
optimizeNames(m, P) {
const { nodes: I } = this;
let z = I.length;
for (; z--; ) {
const N = I[z];
N.optimizeNames(m, P) || (W(m, N.names), I.splice(z, 1));
}
return I.length > 0 ? this : void 0;
}
get names() {
return this.nodes.reduce((m, P) => j(m, P.names), {});
}
}
class g extends h {
render(m) {
return "{" + m._n + super.render(m) + "}" + m._n;
}
}
class y extends h {
}
class v extends g {
}
v.kind = "else";
class d extends g {
constructor(m, P) {
super(P), this.condition = m;
}
render(m) {
let P = `if(${this.condition})` + super.render(m);
return this.else && (P += "else " + this.else.render(m)), P;
}
optimizeNodes() {
super.optimizeNodes();
const m = this.condition;
if (m === !0)
return this.nodes;
let P = this.else;
if (P) {
const I = P.optimizeNodes();
P = this.else = Array.isArray(I) ? new v(I) : I;
}
if (P)
return m === !1 ? P instanceof d ? P : P.nodes : this.nodes.length ? this : new d(Q(m), P instanceof d ? [P] : P.nodes);
if (!(m === !1 || !this.nodes.length))
return this;
}
optimizeNames(m, P) {
var I;
if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(m, P), !!(super.optimizeNames(m, P) || this.else))
return this.condition = K(this.condition, m, P), this;
}
get names() {
const m = super.names;
return L(m, this.condition), this.else && j(m, this.else.names), m;
}
}
d.kind = "if";
class l extends g {
}
l.kind = "for";
class _ extends l {
constructor(m) {
super(), this.iteration = m;
}
render(m) {
return `for(${this.iteration})` + super.render(m);
}
optimizeNames(m, P) {
if (super.optimizeNames(m, P))
return this.iteration = K(this.iteration, m, P), this;
}
get names() {
return j(super.names, this.iteration.names);
}
}
class A extends l {
constructor(m, P, I, z) {
super(), this.varKind = m, this.name = P, this.from = I, this.to = z;
}
render(m) {
const P = m.es5 ? t.varKinds.var : this.varKind, { name: I, from: z, to: N } = this;
return `for(${P} ${I}=${z}; ${I}<${N}; ${I}++)` + super.render(m);
}
get names() {
const m = L(super.names, this.from);
return L(m, this.to);
}
}
class F extends l {
constructor(m, P, I, z) {
super(), this.loop = m, this.varKind = P, this.name = I, this.iterable = z;
}
render(m) {
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(m);
}
optimizeNames(m, P) {
if (super.optimizeNames(m, P))
return this.iterable = K(this.iterable, m, P), this;
}
get names() {
return j(super.names, this.iterable.names);
}
}
class C extends g {
constructor(m, P, I) {
super(), this.name = m, this.args = P, this.async = I;
}
render(m) {
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(m);
}
}
C.kind = "func";
class E extends h {
render(m) {
return "return " + super.render(m);
}
}
E.kind = "return";
class b extends g {
render(m) {
let P = "try" + super.render(m);
return this.catch && (P += this.catch.render(m)), this.finally && (P += this.finally.render(m)), P;
}
optimizeNodes() {
var m, P;
return super.optimizeNodes(), (m = this.catch) === null || m === void 0 || m.optimizeNodes(), (P = this.finally) === null || P === void 0 || P.optimizeNodes(), this;
}
optimizeNames(m, P) {
var I, z;
return super.optimizeNames(m, P), (I = this.catch) === null || I === void 0 || I.optimizeNames(m, P), (z = this.finally) === null || z === void 0 || z.optimizeNames(m, P), this;
}
get names() {
const m = super.names;
return this.catch && j(m, this.catch.names), this.finally && j(m, this.finally.names), m;
}
}
class D extends g {
constructor(m) {
super(), this.error = m;
}
render(m) {
return `catch(${this.error})` + super.render(m);
}
}
D.kind = "catch";
class $ extends g {
render(m) {
return "finally" + super.render(m);
}
}
$.kind = "finally";
class T {
constructor(m, P = {}) {
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...P, _n: P.lines ? `
` : "" }, this._extScope = m, this._scope = new t.Scope({ parent: m }), this._nodes = [new y()];
}
toString() {
return this._root.render(this.opts);
}
// returns unique name in the internal scope
name(m) {
return this._scope.name(m);
}
// reserves unique name in the external scope
scopeName(m) {
return this._extScope.name(m);
}
// reserves unique name in the external scope and assigns value to it
scopeValue(m, P) {
const I = this._extScope.value(m, P);
return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I;
}
getScopeValue(m, P) {
return this._extScope.getValue(m, P);
}
// return code that assigns values in the external scope to the names that are used internally
// (same names that were returned by gen.scopeName or gen.scopeValue)
scopeRefs(m) {
return this._extScope.scopeRefs(m, this._values);
}
scopeCode() {
return this._extScope.scopeCode(this._values);
}
_def(m, P, I, z) {
const N = this._scope.toName(P);
return I !== void 0 && z && (this._constants[N.str] = I), this._leafNode(new p(m, N, I)), N;
}
// `const` declaration (`var` in es5 mode)
const(m, P, I) {
return this._def(t.varKinds.const, m, P, I);
}
// `let` declaration with optional assignment (`var` in es5 mode)
let(m, P, I) {
return this._def(t.varKinds.let, m, P, I);
}
// `var` declaration with optional assignment
var(m, P, I) {
return this._def(t.varKinds.var, m, P, I);
}
// assignment code
assign(m, P, I) {
return this._leafNode(new c(m, P, I));
}
// `+=` code
add(m, P) {
return this._leafNode(new x(m, r.operators.ADD, P));
}
// appends passed SafeExpr to code or executes Block
code(m) {
return typeof m == "function" ? m() : m !== e.nil && this._leafNode(new u(m)), this;
}
// returns code for object literal for the passed argument list of key-value pairs
object(...m) {
const P = ["{"];
for (const [I, z] of m)
P.length > 1 && P.push(","), P.push(I), (I !== z || this.opts.es5) && (P.push(":"), (0, e.addCodeArg)(P, z));
return P.push("}"), new e._Code(P);
}
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
if(m, P, I) {
if (this._blockNode(new d(m)), P && I)
this.code(P).else().code(I).endIf();
else if (P)
this.code(P).endIf();
else if (I)
throw new Error('CodeGen: "else" body without "then" body');
return this;
}
// `else if` clause - invalid without `if` or after `else` clauses
elseIf(m) {
return this._elseNode(new d(m));
}
// `else` clause - only valid after `if` or `else if` clauses
else() {
return this._elseNode(new v());
}
// end `if` statement (needed if gen.if was used only with condition)
endIf() {
return this._endBlockNode(d, v);
}
_for(m, P) {
return this._blockNode(m), P && this.code(P).endFor(), this;
}
// a generic `for` clause (or statement if `forBody` is passed)
for(m, P) {
return this._for(new _(m), P);
}
// `for` statement for a range of values
forRange(m, P, I, z, N = this.opts.es5 ? t.varKinds.var : t.varKinds.let) {
const q = this._scope.toName(m);
return this._for(new A(N, q, P, I), () => z(q));
}
// `for-of` statement (in es5 mode replace with a normal for loop)
forOf(m, P, I, z = t.varKinds.const) {
const N = this._scope.toName(m);
if (this.opts.es5) {
const q = P instanceof e.Name ? P : this.var("_arr", P);
return this.forRange("_i", 0, (0, e._)`${q}.length`, (V) => {
this.var(N, (0, e._)`${q}[${V}]`), I(N);
});
}
return this._for(new F("of", z, N, P), () => I(N));
}
// `for-in` statement.
// With option `ownProperties` replaced with a `for-of` loop for object keys
forIn(m, P, I, z = this.opts.es5 ? t.varKinds.var : t.varKinds.const) {
if (this.opts.ownProperties)
return this.forOf(m, (0, e._)`Object.keys(${P})`, I);
const N = this._scope.toName(m);
return this._for(new F("in", z, N, P), () => I(N));
}
// end `for` loop
endFor() {
return this._endBlockNode(l);
}
// `label` statement
label(m) {
return this._leafNode(new o(m));
}
// `break` statement
break(m) {
return this._leafNode(new i(m));
}
// `return` statement
return(m) {
const P = new E();
if (this._blockNode(P), this.code(m), P.nodes.length !== 1)
throw new Error('CodeGen: "return" should have one node');
return this._endBlockNode(E);
}
// `try` statement
try(m, P, I) {
if (!P && !I)
throw new Error('CodeGen: "try" without "catch" and "finally"');
const z = new b();
if (this._blockNode(z), this.code(m), P) {
const N = this.name("e");
this._currNode = z.catch = new D(N), P(N);
}
return I && (this._currNode = z.finally = new $(), this.code(I)), this._endBlockNode(D, $);
}
// `throw` statement
throw(m) {
return this._leafNode(new f(m));
}
// start self-balancing block
block(m, P) {
return this._blockStarts.push(this._nodes.length), m && this.code(m).endBlock(P), this;
}
// end the current self-balancing block
endBlock(m) {
const P = this._blockStarts.pop();
if (P === void 0)
throw new Error("CodeGen: not in self-balancing block");
const I = this._nodes.length - P;
if (I < 0 || m !== void 0 && I !== m)
throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${m} expected`);
return this._nodes.length = P, this;
}
// `function` heading (or definition if funcBody is passed)
func(m, P = e.nil, I, z) {
return this._blockNode(new C(m, P, I)), z && this.code(z).endFunc(), this;
}
// end function definition
endFunc() {
return this._endBlockNode(C);
}
optimize(m = 1) {
for (; m-- > 0; )
this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants);
}
_leafNode(m) {
return this._currNode.nodes.push(m), this;
}
_blockNode(m) {
this._currNode.nodes.push(m), this._nodes.push(m);
}
_endBlockNode(m, P) {
const I = this._currNode;
if (I instanceof m || P && I instanceof P)
return this._nodes.pop(), this;
throw new Error(`CodeGen: not in block "${P ? `${m.kind}/${P.kind}` : m.kind}"`);
}
_elseNode(m) {
const P = this._currNode;
if (!(P instanceof d))
throw new Error('CodeGen: "else" without "if"');
return this._currNode = P.else = m, this;
}
get _root() {
return this._nodes[0];
}
get _currNode() {
const m = this._nodes;
return m[m.length - 1];
}
set _currNode(m) {
const P = this._nodes;
P[P.length - 1] = m;
}
}
r.CodeGen = T;
function j(B, m) {
for (const P in m)
B[P] = (B[P] || 0) + (m[P] || 0);
return B;
}
function L(B, m) {
return m instanceof e._CodeOrName ? j(B, m.names) : B;
}
function K(B, m, P) {
if (B instanceof e.Name)
return I(B);
if (!z(B))
return B;
return new e._Code(B._items.reduce((N, q) => (q instanceof e.Name && (q = I(q)), q instanceof e._Code ? N.push(...q._items) : N.push(q), N), []));
function I(N) {
const q = P[N.str];
return q === void 0 || m[N.str] !== 1 ? N : (delete m[N.str], q);
}
function z(N) {
return N instanceof e._Code && N._items.some((q) => q instanceof e.Name && m[q.str] === 1 && P[q.str] !== void 0);
}
}
function W(B, m) {
for (const P in m)
B[P] = (B[P] || 0) - (m[P] || 0);
}
function Q(B) {
return typeof B == "boolean" || typeof B == "number" || B === null ? !B : (0, e._)`!${k(B)}`;
}
r.not = Q;
const ie = S(r.operators.AND);
function ne(...B) {
return B.reduce(ie);
}
r.and = ne;
const ae = S(r.operators.OR);
function H(...B) {
return B.reduce(ae);
}
r.or = H;
function S(B) {
return (m, P) => m === e.nil ? P : P === e.nil ? m : (0, e._)`${k(m)} ${B} ${k(P)}`;
}
function k(B) {
return B instanceof e.Name ? B : (0, e._)`(${B})`;
}
})(se);
var pe = {};
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.checkStrictMode = r.getErrorPath = r.Type = r.useFunc = r.setEvaluated = r.evaluatedPropsToName = r.mergeEvaluated = r.eachItem = r.unescapeJsonPointer = r.escapeJsonPointer = r.escapeFragment = r.unescapeFragment = r.schemaRefOrVal = r.schemaHasRulesButRef = r.schemaHasRules = r.checkUnknownRules = r.alwaysValidSchema = r.toHash = void 0;
const e = se, t = Dt;
function n(C) {
const E = {};
for (const b of C)
E[b] = !0;
return E;
}
r.toHash = n;
function a(C, E) {
return typeof E == "boolean" ? E : Object.keys(E).length === 0 ? !0 : (s(C, E), !p(E, C.self.RULES.all));
}
r.alwaysValidSchema = a;
function s(C, E = C.schema) {
const { opts: b, self: D } = C;
if (!b.strictSchema || typeof E == "boolean")
return;
const $ = D.RULES.keywords;
for (const T in E)
$[T] || F(C, `unknown keyword: "${T}"`);
}
r.checkUnknownRules = s;
function p(C, E) {
if (typeof C == "boolean")
return !C;
for (const b in C)
if (E[b])
return !0;
return !1;
}
r.schemaHasRules = p;
function c(C, E) {
if (typeof C == "boolean")
return !C;
for (const b in C)
if (b !== "$ref" && E.all[b])
return !0;
return !1;
}
r.schemaHasRulesButRef = c;
function x({ topSchemaRef: C, schemaPath: E }, b, D, $) {
if (!$) {
if (typeof b == "number" || typeof b == "boolean")
return b;
if (typeof b == "string")
return (0, e._)`${b}`;
}
return (0, e._)`${C}${E}${(0, e.getProperty)(D)}`;
}
r.schemaRefOrVal = x;
function o(C) {
return u(decodeURIComponent(C));
}
r.unescapeFragment = o;
function i(C) {
return encodeURIComponent(f(C));
}
r.escapeFragment = i;
function f(C) {
return typeof C == "number" ? `${C}` : C.replace(/~/g, "~0").replace(/\//g, "~1");
}
r.escapeJsonPointer = f;
function u(C) {
return C.replace(/~1/g, "/").replace(/~0/g, "~");
}
r.unescapeJsonPointer = u;
function h(C, E) {
if (Array.isArray(C))
for (const b of C)
E(b);
else
E(C);
}
r.eachItem = h;
function g({ mergeNames: C, mergeToName: E, mergeValues: b, resultToName: D }) {
return ($, T, j, L) => {
const K = j === void 0 ? T : j instanceof e.Name ? (T instanceof e.Name ? C($, T, j) : E($, T, j), j) : T instanceof e.Name ? (E($, j, T), T) : b(T, j);
return L === e.Name && !(K instanceof e.Name) ? D($, K) : K;
};
}
r.mergeEvaluated = {
props: g({
mergeNames: (C, E, b) => C.if((0, e._)`${b} !== true && ${E} !== undefined`, () => {
C.if((0, e._)`${E} === true`, () => C.assign(b, !0), () => C.assign(b, (0, e._)`${b} || {}`).code((0, e._)`Object.assign(${b}, ${E})`));
}),
mergeToName: (C, E, b) => C.if((0, e._)`${b} !== true`, () => {
E === !0 ? C.assign(b, !0) : (C.assign(b, (0, e._)`${b} || {}`), v(C, b, E));
}),
mergeValues: (C, E) => C === !0 ? !0 : { ...C, ...E },
resultToName: y
}),
items: g({
mergeNames: (C, E, b) => C.if((0, e._)`${b} !== true && ${E} !== undefined`, () => C.assign(b, (0, e._)`${E} === true ? true : ${b} > ${E} ? ${b} : ${E}`)),
mergeToName: (C, E, b) => C.if((0, e._)`${b} !== true`, () => C.assign(b, E === !0 ? !0 : (0, e._)`${b} > ${E} ? ${b} : ${E}`)),
mergeValues: (C, E) => C === !0 ? !0 : Math.max(C, E),
resultToName: (C, E) => C.var("items", E)
})
};
function y(C, E) {
if (E === !0)
return C.var("props", !0);
const b = C.var("props", (0, e._)`{}`);
return E !== void 0 && v(C, b, E), b;
}
r.evaluatedPropsToName = y;
function v(C, E, b) {
Object.keys(b).forEach((D) => C.assign((0, e._)`${E}${(0, e.getProperty)(D)}`, !0));
}
r.setEvaluated = v;
const d = {};
function l(C, E) {
return C.scopeValue("func", {
ref: E,
code: d[E.code] || (d[E.code] = new t._Code(E.code))
});
}
r.useFunc = l;
var _;
(function(C) {
C[C.Num = 0] = "Num", C[C.Str = 1] = "Str";
})(_ = r.Type || (r.Type = {}));
function A(C, E, b) {
if (C instanceof e.Name) {
const D = E === _.Num;
return b ? D ? (0, e._)`"[" + ${C} + "]"` : (0, e._)`"['" + ${C} + "']"` : D ? (0, e._)`"/" + ${C}` : (0, e._)`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
}
return b ? (0, e.getProperty)(C).toString() : "/" + f(C);
}
r.getErrorPath = A;
function F(C, E, b = C.opts.strictSchema) {
if (b) {
if (E = `strict mode: ${E}`, b === !0)
throw new Error(E);
C.self.logger.warn(E);
}
}
r.checkStrictMode = F;
})(pe);
var dr = {};
Object.defineProperty(dr, "__esModule", { value: !0 });
const Re = se, sc = {
// validation function arguments
data: new Re.Name("data"),
// args passed from referencing schema
valCxt: new Re.Name("valCxt"),
instancePath: new Re.Name("instancePath"),
parentData: new Re.Name("parentData"),
parentDataProperty: new Re.Name("parentDataProperty"),
rootData: new Re.Name("rootData"),
dynamicAnchors: new Re.Name("dynamicAnchors"),
// function scoped variables
vErrors: new Re.Name("vErrors"),
errors: new Re.Name("errors"),
this: new Re.Name("this"),
// "globals"
self: new Re.Name("self"),
scope: new Re.Name("scope"),
// JTD serialize/parse name for JSON string and position
json: new Re.Name("json"),
jsonPos: new Re.Name("jsonPos"),
jsonLen: new Re.Name("jsonLen"),
jsonPart: new Re.Name("jsonPart")
};
dr.default = sc;
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.extendErrors = r.resetErrorsCount = r.reportExtraError = r.reportError = r.keyword$DataError = r.keywordError = void 0;
const e = se, t = pe, n = dr;
r.keywordError = {
message: ({ keyword: v }) => (0, e.str)`must pass "${v}" keyword validation`
}, r.keyword$DataError = {
message: ({ keyword: v, schemaType: d }) => d ? (0, e.str)`"${v}" keyword must be ${d} ($data)` : (0, e.str)`"${v}" keyword is invalid ($data)`
};
function a(v, d = r.keywordError, l, _) {
const { it: A } = v, { gen: F, compositeRule: C, allErrors: E } = A, b = f(v, d, l);
_ ?? (C || E) ? x(F, b) : o(A, (0, e._)`[${b}]`);
}
r.reportError = a;
function s(v, d = r.keywordError, l) {
const { it: _ } = v, { gen: A, compositeRule: F, allErrors: C } = _, E = f(v, d, l);
x(A, E), F || C || o(_, n.default.vErrors);
}
r.reportExtraError = s;
function p(v, d) {
v.assign(n.default.errors, d), v.if((0, e._)`${n.default.vErrors} !== null`, () => v.if(d, () => v.assign((0, e._)`${n.default.vErrors}.length`, d), () => v.assign(n.default.vErrors, null)));
}
r.resetErrorsCount = p;
function c({ gen: v, keyword: d, schemaValue: l, data: _, errsCount: A, it: F }) {
if (A === void 0)
throw new Error("ajv implementation error");
const C = v.name("err");
v.forRange("i", A, n.default.errors, (E) => {
v.const(C, (0, e._)`${n.default.vErrors}[${E}]`), v.if((0, e._)`${C}.instancePath === undefined`, () => v.assign((0, e._)`${C}.instancePath`, (0, e.strConcat)(n.default.instancePath, F.errorPath))), v.assign((0, e._)`${C}.schemaPath`, (0, e.str)`${F.errSchemaPath}/${d}`), F.opts.verbose && (v.assign((0, e._)`${C}.schema`, l), v.assign((0, e._)`${C}.data`, _));
});
}
r.extendErrors = c;
function x(v, d) {
const l = v.const("err", d);
v.if((0, e._)`${n.default.vErrors} === null`, () => v.assign(n.default.vErrors, (0, e._)`[${l}]`), (0, e._)`${n.default.vErrors}.push(${l})`), v.code((0, e._)`${n.default.errors}++`);
}
function o(v, d) {
const { gen: l, validateName: _, schemaEnv: A } = v;
A.$async ? l.throw((0, e._)`new ${v.ValidationError}(${d})`) : (l.assign((0, e._)`${_}.errors`, d), l.return(!1));
}
const i = {
keyword: new e.Name("keyword"),
schemaPath: new e.Name("schemaPath"),
params: new e.Name("params"),
propertyName: new e.Name("propertyName"),
message: new e.Name("message"),
schema: new e.Name("schema"),
parentSchema: new e.Name("parentSchema")
};
function f(v, d, l) {
const { createErrors: _ } = v.it;
return _ === !1 ? (0, e._)`{}` : u(v, d, l);
}
function u(v, d, l = {}) {
const { gen: _, it: A } = v, F = [
h(A, l),
g(v, l)
];
return y(v, d, F), _.object(...F);
}
function h({ errorPath: v }, { instancePath: d }) {
const l = d ? (0, e.str)`${v}${(0, t.getErrorPath)(d, t.Type.Str)}` : v;
return [n.default.instancePath, (0, e.strConcat)(n.default.instancePath, l)];
}
function g({ keyword: v, it: { errSchemaPath: d } }, { schemaPath: l, parentSchema: _ }) {
let A = _ ? d : (0, e.str)`${d}/${v}`;
return l && (A = (0, e.str)`${A}${(0, t.getErrorPath)(l, t.Type.Str)}`), [i.schemaPath, A];
}
function y(v, { params: d, message: l }, _) {
const { keyword: A, data: F, schemaValue: C, it: E } = v, { opts: b, propertyName: D, topSchemaRef: $, schemaPath: T } = E;
_.push([i.keyword, A], [i.params, typeof d == "function" ? d(v) : d || (0, e._)`{}`]), b.messages && _.push([i.message, typeof l == "function" ? l(v) : l]), b.verbose && _.push([i.schema, C], [i.parentSchema, (0, e._)`${$}${T}`], [n.default.data, F]), D && _.push([i.propertyName, D]);
}
})(Ft);
Object.defineProperty(tt, "__esModule", { value: !0 });
tt.boolOrEmptySchema = tt.topBoolOrEmptySchema = void 0;
const ic = Ft, cc = se, uc = dr, fc = {
message: "boolean schema is false"
};
function lc(r) {
const { gen: e, schema: t, validateName: n } = r;
t === !1 ? Ts(r, !1) : typeof t == "object" && t.$async === !0 ? e.return(uc.default.data) : (e.assign((0, cc._)`${n}.errors`, null), e.return(!0));
}
tt.topBoolOrEmptySchema = lc;
function dc(r, e) {
const { gen: t, schema: n } = r;
n === !1 ? (t.var(e, !1), Ts(r)) : t.var(e, !0);
}
tt.boolOrEmptySchema = dc;
function Ts(r, e) {
const { gen: t, data: n } = r, a = {
gen: t,
keyword: "false schema",
data: n,
schema: !1,
schemaCode: !1,
schemaValue: !1,
params: {},
it: r
};
(0, ic.reportError)(a, fc, void 0, e);
}
var Pt = {}, jr = {};
Object.defineProperty(jr, "__esModule", { value: !0 });
jr.getRules = jr.isJSONType = void 0;
const hc = ["string", "number", "integer", "boolean", "null", "object", "array"], pc = new Set(hc);
function xc(r) {
return typeof r == "string" && pc.has(r);
}
jr.isJSONType = xc;
function vc() {
const r = {
number: { type: "number", rules: [] },
string: { type: "string", rules: [] },
array: { type: "array", rules: [] },
object: { type: "object", rules: [] }
};
return {
types: { ...r, integer: !0, boolean: !0, null: !0 },
rules: [{ rules: [] }, r.number, r.string, r.array, r.object],
post: { rules: [] },
all: {},
keywords: {}
};
}
jr.getRules = vc;
var vr = {};
Object.defineProperty(vr, "__esModule", { value: !0 });
vr.shouldUseRule = vr.shouldUseGroup = vr.schemaHasRulesForType = void 0;
function mc({ schema: r, self: e }, t) {
const n = e.RULES.types[t];
return n && n !== !0 && Is(r, n);
}
vr.schemaHasRulesForType = mc;
function Is(r, e) {
return e.rules.some((t) => Ns(r, t));
}
vr.shouldUseGroup = Is;
function Ns(r, e) {
var t;
return r[e.keyword] !== void 0 || ((t = e.definition.implements) === null || t === void 0 ? void 0 : t.some((n) => r[n] !== void 0));
}
vr.shouldUseRule = Ns;
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.reportTypeError = r.checkDataTypes = r.checkDataType = r.coerceAndCheckDataType = r.getJSONTypes = r.getSchemaTypes = r.DataType = void 0;
const e = jr, t = vr, n = Ft, a = se, s = pe;
var p;
(function(_) {
_[_.Correct = 0] = "Correct", _[_.Wrong = 1] = "Wrong";
})(p = r.DataType || (r.DataType = {}));
function c(_) {
const A = x(_.type);
if (A.includes("null")) {
if (_.nullable === !1)
throw new Error("type: null contradicts nullable: false");
} else {
if (!A.length && _.nullable !== void 0)
throw new Error('"nullable" cannot be used without "type"');
_.nullable === !0 && A.push("null");
}
return A;
}
r.getSchemaTypes = c;
function x(_) {
const A = Array.isArray(_) ? _ : _ ? [_] : [];
if (A.every(e.isJSONType))
return A;
throw new Error("type must be JSONType or JSONType[]: " + A.join(","));
}
r.getJSONTypes = x;
function o(_, A) {
const { gen: F, data: C, opts: E } = _, b = f(A, E.coerceTypes), D = A.length > 0 && !(b.length === 0 && A.length === 1 && (0, t.schemaHasRulesForType)(_, A[0]));
if (D) {
const $ = y(A, C, E.strictNumbers, p.Wrong);
F.if($, () => {
b.length ? u(_, A, b) : d(_);
});
}
return D;
}
r.coerceAndCheckDataType = o;
const i = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
function f(_, A) {
return A ? _.filter((F) => i.has(F) || A === "array" && F === "array") : [];
}
function u(_, A, F) {
const { gen: C, data: E, opts: b } = _, D = C.let("dataType", (0, a._)`typeof ${E}`), $ = C.let("coerced", (0, a._)`undefined`);
b.coerceTypes === "array" && C.if((0, a._)`${D} == 'object' && Array.isArray(${E}) && ${E}.length == 1`, () => C.assign(E, (0, a._)`${E}[0]`).assign(D, (0, a._)`typeof ${E}`).if(y(A, E, b.strictNumbers), () => C.assign($, E))), C.if((0, a._)`${$} !== undefined`);
for (const j of F)
(i.has(j) || j === "array" && b.coerceTypes === "array") && T(j);
C.else(), d(_), C.endIf(), C.if((0, a._)`${$} !== undefined`, () => {
C.assign(E, $), h(_, $);
});
function T(j) {
switch (j) {
case "string":
C.elseIf((0, a._)`${D} == "number" || ${D} == "boolean"`).assign($, (0, a._)`"" + ${E}`).elseIf((0, a._)`${E} === null`).assign($, (0, a._)`""`);
return;
case "number":
C.elseIf((0, a._)`${D} == "boolean" || ${E} === null
|| (${D} == "string" && ${E} && ${E} == +${E})`).assign($, (0, a._)`+${E}`);
return;
case "integer":
C.elseIf((0, a._)`${D} === "boolean" || ${E} === null
|| (${D} === "string" && ${E} && ${E} == +${E} && !(${E} % 1))`).assign($, (0, a._)`+${E}`);
return;
case "boolean":
C.elseIf((0, a._)`${E} === "false" || ${E} === 0 || ${E} === null`).assign($, !1).elseIf((0, a._)`${E} === "true" || ${E} === 1`).assign($, !0);
return;
case "null":
C.elseIf((0, a._)`${E} === "" || ${E} === 0 || ${E} === false`), C.assign($, null);
return;
case "array":
C.elseIf((0, a._)`${D} === "string" || ${D} === "number"
|| ${D} === "boolean" || ${E} === null`).assign($, (0, a._)`[${E}]`);
}
}
}
function h({ gen: _, parentData: A, parentDataProperty: F }, C) {
_.if((0, a._)`${A} !== undefined`, () => _.assign((0, a._)`${A}[${F}]`, C));
}
function g(_, A, F, C = p.Correct) {
const E = C === p.Correct ? a.operators.EQ : a.operators.NEQ;
let b;
switch (_) {
case "null":
return (0, a._)`${A} ${E} null`;
case "array":
b = (0, a._)`Array.isArray(${A})`;
break;
case "object":
b = (0, a._)`${A} && typeof ${A} == "object" && !Array.isArray(${A})`;
break;
case "integer":
b = D((0, a._)`!(${A} % 1) && !isNaN(${A})`);
break;
case "number":
b = D();
break;
default:
return (0, a._)`typeof ${A} ${E} ${_}`;
}
return C === p.Correct ? b : (0, a.not)(b);
function D($ = a.nil) {
return (0, a.and)((0, a._)`typeof ${A} == "number"`, $, F ? (0, a._)`isFinite(${A})` : a.nil);
}
}
r.checkDataType = g;
function y(_, A, F, C) {
if (_.length === 1)
return g(_[0], A, F, C);
let E;
const b = (0, s.toHash)(_);
if (b.array && b.object) {
const D = (0, a._)`typeof ${A} != "object"`;
E = b.null ? D : (0, a._)`!${A} || ${D}`, delete b.null, delete b.array, delete b.object;
} else
E = a.nil;
b.number && delete b.integer;
for (const D in b)
E = (0, a.and)(E, g(D, A, F, C));
return E;
}
r.checkDataTypes = y;
const v = {
message: ({ schema: _ }) => `must be ${_}`,
params: ({ schema: _, schemaValue: A }) => typeof _ == "string" ? (0, a._)`{type: ${_}}` : (0, a._)`{type: ${A}}`
};
function d(_) {
const A = l(_);
(0, n.reportError)(A, v);
}
r.reportTypeError = d;
function l(_) {
const { gen: A, data: F, schema: C } = _, E = (0, s.schemaRefOrVal)(_, C, "type");
return {
gen: A,
keyword: "type",
data: F,
schema: C.type,
schemaCode: E,
schemaValue: E,
parentSchema: C,
params: {},
it: _
};
}
})(Pt);
var xn = {};
Object.defineProperty(xn, "__esModule", { value: !0 });
xn.assignDefaults = void 0;
const Vr = se, yc = pe;
function gc(r, e) {
const { properties: t, items: n } = r.schema;
if (e === "object" && t)
for (const a in t)
Yo(r, a, t[a].default);
else
e === "array" && Array.isArray(n) && n.forEach((a, s) => Yo(r, s, a.default));
}
xn.assignDefaults = gc;
function Yo(r, e, t) {
const { gen: n, compositeRule: a, data: s, opts: p } = r;
if (t === void 0)
return;
const c = (0, Vr._)`${s}${(0, Vr.getProperty)(e)}`;
if (a) {
(0, yc.checkStrictMode)(r, `default is ignored for: ${c}`);
return;
}
let x = (0, Vr._)`${c} === undefined`;
p.useDefaults === "empty" && (x = (0, Vr._)`${x} || ${c} === null || ${c} === ""`), n.if(x, (0, Vr._)`${c} = ${(0, Vr.stringify)(t)}`);
}
var lr = {}, oe = {};
Object.defineProperty(oe, "__esModule", { value: !0 });
oe.validateUnion = oe.validateArray = oe.usePattern = oe.callValidateCode = oe.schemaProperties = oe.allSchemaProperties = oe.noPropertyInData = oe.propertyInData = oe.isOwnProperty = oe.hasPropFunc = oe.reportMissingProp = oe.checkMissingProp = oe.checkReportMissingProp = void 0;
const ye = se, Qa = pe, Ar = dr, _c = pe;
function Ec(r, e) {
const { gen: t, data: n, it: a } = r;
t.if(eo(t, n, e, a.opts.ownProperties), () => {
r.setParams({ missingProperty: (0, ye._)`${e}` }, !0), r.error();
});
}
oe.checkReportMissingProp = Ec;
function Ac({ gen: r, data: e, it: { opts: t } }, n, a) {
return (0, ye.or)(...n.map((s) => (0, ye.and)(eo(r, e, s, t.ownProperties), (0, ye._)`${a} = ${s}`)));
}
oe.checkMissingProp = Ac;
function Cc(r, e) {
r.setParams({ missingProperty: e }, !0), r.error();
}
oe.reportMissingProp = Cc;
function js(r) {
return r.scopeValue("func", {
// eslint-disable-next-line @typescript-eslint/unbound-method
ref: Object.prototype.hasOwnProperty,
code: (0, ye._)`Object.prototype.hasOwnProperty`
});
}
oe.hasPropFunc = js;
function Za(r, e, t) {
return (0, ye._)`${js(r)}.call(${e}, ${t})`;
}
oe.isOwnProperty = Za;
function bc(r, e, t, n) {
const a = (0, ye._)`${e}${(0, ye.getProperty)(t)} !== undefined`;
return n ? (0, ye._)`${a} && ${Za(r, e, t)}` : a;
}
oe.propertyInData = bc;
function eo(r, e, t, n) {
const a = (0, ye._)`${e}${(0, ye.getProperty)(t)} === undefined`;
return n ? (0, ye.or)(a, (0, ye.not)(Za(r, e, t))) : a;
}
oe.noPropertyInData = eo;
function Ms(r) {
return r ? Object.keys(r).filter((e) => e !== "__proto__") : [];
}
oe.allSchemaProperties = Ms;
function $c(r, e) {
return Ms(e).filter((t) => !(0, Qa.alwaysValidSchema)(r, e[t]));
}
oe.schemaProperties = $c;
function Sc({ schemaCode: r, data: e, it: { gen: t, topSchemaRef: n, schemaPath: a, errorPath: s }, it: p }, c, x, o) {
const i = o ? (0, ye._)`${r}, ${e}, ${n}${a}` : e, f = [
[Ar.default.instancePath, (0, ye.strConcat)(Ar.default.instancePath, s)],
[Ar.default.parentData, p.parentData],
[Ar.default.parentDataProperty, p.parentDataProperty],
[Ar.default.rootData, Ar.default.rootData]
];
p.opts.dynamicRef && f.push([Ar.default.dynamicAnchors, Ar.default.dynamicAnchors]);
const u = (0, ye._)`${i}, ${t.object(...f)}`;
return x !== ye.nil ? (0, ye._)`${c}.call(${x}, ${u})` : (0, ye._)`${c}(${u})`;
}
oe.callValidateCode = Sc;
const wc = (0, ye._)`new RegExp`;
function Dc({ gen: r, it: { opts: e } }, t) {
const n = e.unicodeRegExp ? "u" : "", { regExp: a } = e.code, s = a(t, n);
return r.scopeValue("pattern", {
key: s.toString(),
ref: s,
code: (0, ye._)`${a.code === "new RegExp" ? wc : (0, _c.useF