diff --git a/public/libs/zhi-publisher-sdk/index.js b/public/libs/zhi-publisher-sdk/index.js index 78bc84a9..26dd2ca3 100644 --- a/public/libs/zhi-publisher-sdk/index.js +++ b/public/libs/zhi-publisher-sdk/index.js @@ -1,12 +1,12 @@ var r = Object.defineProperty; -var g = (i, t, s) => t in i ? r(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s; -var n = (i, t, s) => (g(i, typeof t != "symbol" ? t + "" : t, s), s); -(function(i, t) { - !i || i.getElementById("livereloadscript") || (t = i.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35730/livereload.js?snipver=1", t.id = "livereloadscript", i.getElementsByTagName("head")[0].appendChild(t)); +var g = (n, t, s) => t in n ? r(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s; +var i = (n, t, s) => (g(n, typeof t != "symbol" ? t + "" : t, s), s); +(function(n, t) { + !n || n.getElementById("livereloadscript") || (t = n.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35729/livereload.js?snipver=1", t.id = "livereloadscript", n.getElementsByTagName("head")[0].appendChild(t)); })(self.document); class a { static init(t) { - this.Env = t.Env, this.BlogConstants = t.BlogConstants, this.BlogTypeEnum = t.BlogTypeEnum, this.SiyuanConstants = t.SiyuanConstants, this.SiyuanConfig = t.SiyuanConfig, this.SiYuanApiAdaptor = t.SiYuanApiAdaptor, this.BlogApi = t.BlogApi; + this.appInstance = t.appInstance, this.Env = t.Env, this.BlogConstants = t.BlogConstants, this.BlogTypeEnum = t.BlogTypeEnum, this.SiyuanConstants = t.SiyuanConstants, this.SiyuanConfig = t.SiyuanConfig, this.SiYuanApiAdaptor = t.SiYuanApiAdaptor, this.BlogApi = t.BlogApi; } /** * 获取 siyuan-kernel-api 实例 @@ -23,10 +23,10 @@ class a { break; default: { if (t instanceof this.Env) { - const p = t.getEnvOrDefault(this.SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806"), c = t.getStringEnv(this.SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY), l = new this.SiyuanConfig(p, c); - l.fixTitle = !0, e = new this.SiYuanApiAdaptor(l); + const c = t.getEnvOrDefault(this.SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806"), l = t.getStringEnv(this.SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY), p = new this.SiyuanConfig(c, l); + p.fixTitle = !0, e = new this.SiYuanApiAdaptor(p); } else - e = new this.SiYuanApiAdaptor(s); + e = new this.SiYuanApiAdaptor(s), e.init(this.appInstance); break; } } @@ -41,7 +41,7 @@ class a { * BlogApi * @private */ -n(a, "bApi"), n(a, "Env"), n(a, "BlogConstants"), n(a, "BlogTypeEnum"), n(a, "SiyuanConstants"), n(a, "SiyuanConfig"), n(a, "SiYuanApiAdaptor"), n(a, "BlogApi"); +i(a, "appInstance"), i(a, "bApi"), i(a, "Env"), i(a, "BlogConstants"), i(a, "BlogTypeEnum"), i(a, "SiyuanConstants"), i(a, "SiyuanConfig"), i(a, "SiYuanApiAdaptor"), i(a, "BlogApi"); export { a as PublishSdk }; diff --git a/public/libs/zhi-publisher-sdk/publish-sdk.d.ts b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts index a027dfe3..524653dd 100644 --- a/public/libs/zhi-publisher-sdk/publish-sdk.d.ts +++ b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts @@ -10,6 +10,7 @@ declare class PublishSdk { * BlogApi * @private */ + private static appInstance; private static bApi; private static Env; private static BlogConstants; @@ -19,6 +20,7 @@ declare class PublishSdk { private static SiYuanApiAdaptor; private static BlogApi; static init(options: { + appInstance: any; Env: any; BlogConstants: any; BlogTypeEnum: any; diff --git a/public/libs/zhi-siyuan-api/index.js b/public/libs/zhi-siyuan-api/index.js index 079c2d41..72d4eefb 100644 --- a/public/libs/zhi-siyuan-api/index.js +++ b/public/libs/zhi-siyuan-api/index.js @@ -1,37 +1,41 @@ -var Nu = Object.defineProperty; -var Lu = (e, t, a) => t in e ? Nu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a; -var Ke = (e, t, a) => (Lu(e, typeof t != "symbol" ? t + "" : t, a), a); -var Ru = Object.defineProperty, Iu = (e, t, a) => t in e ? Ru(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, ye = (e, t, a) => (Iu(e, typeof t != "symbol" ? t + "" : t, a), a), Lc = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(Lc || {}); -let Au = class { +var bs = Object.defineProperty; +var ys = (e, t, r) => t in e ? bs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; +var $e = (e, t, r) => (ys(e, typeof t != "symbol" ? t + "" : t, r), r); +(function(e, t) { + !e || e.getElementById("livereloadscript") || (t = e.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35729/livereload.js?snipver=1", t.id = "livereloadscript", e.getElementsByTagName("head")[0].appendChild(t)); +})(self.document); +var _s = Object.defineProperty, ws = (e, t, r) => t in e ? _s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, oe = (e, t, r) => (ws(e, typeof t != "symbol" ? t + "" : t, r), r), ao = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(ao || {}); +class vs { constructor() { - ye(this, "home"), ye(this, "apiUrl"), ye(this, "username"), ye(this, "passwordType"), ye(this, "password"), ye(this, "apiStatus"), ye(this, "blogName"), ye(this, "posidKey"), ye(this, "previewUrl"), ye(this, "pageType"), ye(this, "placeholder"), ye(this, "fixTitle"), this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1; + oe(this, "home"), oe(this, "apiUrl"), oe(this, "username"), oe(this, "passwordType"), oe(this, "password"), oe(this, "apiStatus"), oe(this, "blogName"), oe(this, "posidKey"), oe(this, "previewUrl"), oe(this, "pageType"), oe(this, "placeholder"), oe(this, "fixTitle"), this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1; } -}, Mu = class { +} +class ks { constructor() { - ye(this, "homePlaceholder"), ye(this, "apiUrlPlaceholder"), ye(this, "usernamePlaceholder"), ye(this, "passwordTypePlaceholder"), ye(this, "passwordPlaceholder"), ye(this, "apiStatusPlaceholder"), ye(this, "blogNamePlaceholder"), ye(this, "posidKeyPlaceholder"), ye(this, "previewUrlPlaceholder"), ye(this, "pageTypePlaceholder"), this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = ""; + oe(this, "homePlaceholder"), oe(this, "apiUrlPlaceholder"), oe(this, "usernamePlaceholder"), oe(this, "passwordTypePlaceholder"), oe(this, "passwordPlaceholder"), oe(this, "apiStatusPlaceholder"), oe(this, "blogNamePlaceholder"), oe(this, "posidKeyPlaceholder"), oe(this, "previewUrlPlaceholder"), oe(this, "pageTypePlaceholder"), this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = ""; } -}; -var Sn = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Sn || {}); -let gi = class { +} +var Br = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Br || {}); +class _n { constructor() { - ye(this, "postid"), ye(this, "title"), ye(this, "mt_keywords"), ye(this, "link"), ye(this, "permalink"), ye(this, "shortDesc"), ye(this, "description"), ye(this, "mt_excerpt"), ye(this, "wp_slug"), ye(this, "dateCreated"), ye(this, "categories"), ye(this, "mt_text_more"), ye(this, "post_status"), ye(this, "isPublished"), ye(this, "wp_password"), this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Sn.PostStatusEnum_Publish, this.wp_password = ""; + oe(this, "postid"), oe(this, "title"), oe(this, "mt_keywords"), oe(this, "link"), oe(this, "permalink"), oe(this, "shortDesc"), oe(this, "description"), oe(this, "mt_excerpt"), oe(this, "wp_slug"), oe(this, "dateCreated"), oe(this, "categories"), oe(this, "mt_text_more"), oe(this, "post_status"), oe(this, "isPublished"), oe(this, "wp_password"), this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Br.PostStatusEnum_Publish, this.wp_password = ""; } -}; -var Du = Object.defineProperty, zu = (e, t, a) => t in e ? Du(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Ye = (e, t, a) => (zu(e, typeof t != "symbol" ? t + "" : t, a), a), Rc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function Ic(e) { +} +var Es = Object.defineProperty, $s = (e, t, r) => t in e ? Es(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Te = (e, t, r) => ($s(e, typeof t != "symbol" ? t + "" : t, r), r), no = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function oo(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } -var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {}; +var la = { exports: {} }, so = {}, rt = {}, Ht = {}, br = {}, ie = {}, fr = {}; (function(e) { 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; class t { } e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; - class a extends t { - constructor(j) { - if (super(), !e.IDENTIFIER.test(j)) + class r extends t { + constructor(T) { + if (super(), !e.IDENTIFIER.test(T)) throw new Error("CodeGen: name must be a valid identifier"); - this.str = j; + this.str = T; } toString() { return this.str; @@ -43,10 +47,10 @@ var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {}; return { [this.str]: 1 }; } } - e.Name = a; - class n extends t { - constructor(j) { - super(), this._items = typeof j == "string" ? [j] : j; + e.Name = r; + class a extends t { + constructor(T) { + super(), this._items = typeof T == "string" ? [T] : T; } toString() { return this.str; @@ -54,114 +58,114 @@ var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {}; emptyStr() { if (this._items.length > 1) return !1; - const j = this._items[0]; - return j === "" || j === '""'; + const T = this._items[0]; + return T === "" || T === '""'; } get str() { - var j; - return (j = this._str) !== null && j !== void 0 ? j : this._str = this._items.reduce((I, r) => `${I}${r}`, ""); + var T; + return (T = this._str) !== null && T !== void 0 ? T : this._str = this._items.reduce((R, n) => `${R}${n}`, ""); } get names() { - var j; - return (j = this._names) !== null && j !== void 0 ? j : this._names = this._items.reduce((I, r) => (r instanceof a && (I[r.str] = (I[r.str] || 0) + 1), I), {}); + var T; + return (T = this._names) !== null && T !== void 0 ? T : this._names = this._items.reduce((R, n) => (n instanceof r && (R[n.str] = (R[n.str] || 0) + 1), R), {}); } } - e._Code = n, e.nil = new n(""); - function s(v, ...j) { - const I = [v[0]]; - let r = 0; - for (; r < j.length; ) - b(I, j[r]), I.push(v[++r]); - return new n(I); + e._Code = a, e.nil = new a(""); + function s(v, ...T) { + const R = [v[0]]; + let n = 0; + for (; n < T.length; ) + b(R, T[n]), R.push(v[++n]); + return new a(R); } e._ = s; - const c = new n("+"); - function p(v, ...j) { - const I = [A(v[0])]; - let r = 0; - for (; r < j.length; ) - I.push(c), b(I, j[r]), I.push(c, A(v[++r])); - return _(I), new n(I); - } - e.str = p; - function b(v, j) { - j instanceof n ? v.push(...j._items) : j instanceof a ? v.push(j) : v.push(S(j)); + const l = new a("+"); + function d(v, ...T) { + const R = [A(v[0])]; + let n = 0; + for (; n < T.length; ) + R.push(l), b(R, T[n]), R.push(l, A(v[++n])); + return _(R), new a(R); + } + e.str = d; + function b(v, T) { + T instanceof a ? v.push(...T._items) : T instanceof r ? v.push(T) : v.push(k(T)); } e.addCodeArg = b; function _(v) { - let j = 1; - for (; j < v.length - 1; ) { - if (v[j] === c) { - const I = y(v[j - 1], v[j + 1]); - if (I !== void 0) { - v.splice(j - 1, 3, I); + let T = 1; + for (; T < v.length - 1; ) { + if (v[T] === l) { + const R = y(v[T - 1], v[T + 1]); + if (R !== void 0) { + v.splice(T - 1, 3, R); continue; } - v[j++] = "+"; + v[T++] = "+"; } - j++; + T++; } } - function y(v, j) { - if (j === '""') + function y(v, T) { + if (T === '""') return v; if (v === '""') - return j; + return T; if (typeof v == "string") - return j instanceof a || v[v.length - 1] !== '"' ? void 0 : typeof j != "string" ? `${v.slice(0, -1)}${j}"` : j[0] === '"' ? v.slice(0, -1) + j.slice(1) : void 0; - if (typeof j == "string" && j[0] === '"' && !(v instanceof a)) - return `"${v}${j.slice(1)}`; + return T instanceof r || v[v.length - 1] !== '"' ? void 0 : typeof T != "string" ? `${v.slice(0, -1)}${T}"` : T[0] === '"' ? v.slice(0, -1) + T.slice(1) : void 0; + if (typeof T == "string" && T[0] === '"' && !(v instanceof r)) + return `"${v}${T.slice(1)}`; } - function g(v, j) { - return j.emptyStr() ? v : v.emptyStr() ? j : p`${v}${j}`; + function m(v, T) { + return T.emptyStr() ? v : v.emptyStr() ? T : d`${v}${T}`; } - e.strConcat = g; - function S(v) { + e.strConcat = m; + function k(v) { return typeof v == "number" || typeof v == "boolean" || v === null ? v : A(Array.isArray(v) ? v.join(",") : v); } - function L(v) { - return new n(A(v)); + function N(v) { + return new a(A(v)); } - e.stringify = L; + e.stringify = N; function A(v) { return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); } e.safeStringify = A; - function N(v) { - return typeof v == "string" && e.IDENTIFIER.test(v) ? new n(`.${v}`) : s`[${v}]`; + function j(v) { + return typeof v == "string" && e.IDENTIFIER.test(v) ? new a(`.${v}`) : s`[${v}]`; } - e.getProperty = N; + e.getProperty = j; function C(v) { if (typeof v == "string" && e.IDENTIFIER.test(v)) - return new n(`${v}`); + return new a(`${v}`); throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`); } e.getEsmExportName = C; - function T(v) { - return new n(v.toString()); + function x(v) { + return new a(v.toString()); } - e.regexpCode = T; -})(qa); -var $o = {}; + e.regexpCode = x; +})(fr); +var ca = {}; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0; - const t = qa; - class a extends Error { + const t = fr; + class r extends Error { constructor(y) { super(`CodeGen: "code" for ${y} not defined`), this.value = y.value; } } - var n; + var a; (function(_) { _[_.Started = 0] = "Started", _[_.Completed = 1] = "Completed"; - })(n = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { + })(a = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { const: new t.Name("const"), let: new t.Name("let"), var: new t.Name("var") }; class s { - constructor({ prefixes: y, parent: g } = {}) { - this._names = {}, this._prefixes = y, this._parent = g; + constructor({ prefixes: y, parent: m } = {}) { + this._names = {}, this._prefixes = y, this._parent = m; } toName(y) { return y instanceof t.Name ? y : this.name(y); @@ -170,121 +174,121 @@ var $o = {}; return new t.Name(this._newName(y)); } _newName(y) { - const g = this._names[y] || this._nameGroup(y); - return `${y}${g.index++}`; + const m = this._names[y] || this._nameGroup(y); + return `${y}${m.index++}`; } _nameGroup(y) { - var g, S; - if (!((S = (g = this._parent) === null || g === void 0 ? void 0 : g._prefixes) === null || S === void 0) && S.has(y) || this._prefixes && !this._prefixes.has(y)) + var m, k; + if (!((k = (m = this._parent) === null || m === void 0 ? void 0 : m._prefixes) === null || k === void 0) && k.has(y) || this._prefixes && !this._prefixes.has(y)) throw new Error(`CodeGen: prefix "${y}" is not allowed in this scope`); return this._names[y] = { prefix: y, index: 0 }; } } e.Scope = s; - class c extends t.Name { - constructor(y, g) { - super(g), this.prefix = y; + class l extends t.Name { + constructor(y, m) { + super(m), this.prefix = y; } - setValue(y, { property: g, itemIndex: S }) { - this.value = y, this.scopePath = (0, t._)`.${new t.Name(g)}[${S}]`; + setValue(y, { property: m, itemIndex: k }) { + this.value = y, this.scopePath = (0, t._)`.${new t.Name(m)}[${k}]`; } } - e.ValueScopeName = c; - const p = (0, t._)`\n`; + e.ValueScopeName = l; + const d = (0, t._)`\n`; class b extends s { constructor(y) { - super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? p : t.nil }; + super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? d : t.nil }; } get() { return this._scope; } name(y) { - return new c(y, this._newName(y)); + return new l(y, this._newName(y)); } - value(y, g) { - var S; - if (g.ref === void 0) + value(y, m) { + var k; + if (m.ref === void 0) throw new Error("CodeGen: ref must be passed in value"); - const L = this.toName(y), { prefix: A } = L, N = (S = g.key) !== null && S !== void 0 ? S : g.ref; + const N = this.toName(y), { prefix: A } = N, j = (k = m.key) !== null && k !== void 0 ? k : m.ref; let C = this._values[A]; if (C) { - const j = C.get(N); - if (j) - return j; + const T = C.get(j); + if (T) + return T; } else C = this._values[A] = /* @__PURE__ */ new Map(); - C.set(N, L); - const T = this._scope[A] || (this._scope[A] = []), v = T.length; - return T[v] = g.ref, L.setValue(g, { property: A, itemIndex: v }), L; - } - getValue(y, g) { - const S = this._values[y]; - if (S) - return S.get(g); - } - scopeRefs(y, g = this._values) { - return this._reduceValues(g, (S) => { - if (S.scopePath === void 0) - throw new Error(`CodeGen: name "${S}" has no value`); - return (0, t._)`${y}${S.scopePath}`; + C.set(j, N); + const x = this._scope[A] || (this._scope[A] = []), v = x.length; + return x[v] = m.ref, N.setValue(m, { property: A, itemIndex: v }), N; + } + getValue(y, m) { + const k = this._values[y]; + if (k) + return k.get(m); + } + scopeRefs(y, m = this._values) { + return this._reduceValues(m, (k) => { + if (k.scopePath === void 0) + throw new Error(`CodeGen: name "${k}" has no value`); + return (0, t._)`${y}${k.scopePath}`; }); } - scopeCode(y = this._values, g, S) { - return this._reduceValues(y, (L) => { - if (L.value === void 0) - throw new Error(`CodeGen: name "${L}" has no value`); - return L.value.code; - }, g, S); + scopeCode(y = this._values, m, k) { + return this._reduceValues(y, (N) => { + if (N.value === void 0) + throw new Error(`CodeGen: name "${N}" has no value`); + return N.value.code; + }, m, k); } - _reduceValues(y, g, S = {}, L) { + _reduceValues(y, m, k = {}, N) { let A = t.nil; - for (const N in y) { - const C = y[N]; + for (const j in y) { + const C = y[j]; if (!C) continue; - const T = S[N] = S[N] || /* @__PURE__ */ new Map(); + const x = k[j] = k[j] || /* @__PURE__ */ new Map(); C.forEach((v) => { - if (T.has(v)) + if (x.has(v)) return; - T.set(v, n.Started); - let j = g(v); - if (j) { - const I = this.opts.es5 ? e.varKinds.var : e.varKinds.const; - A = (0, t._)`${A}${I} ${v} = ${j};${this.opts._n}`; - } else if (j = L == null ? void 0 : L(v)) - A = (0, t._)`${A}${j}${this.opts._n}`; + x.set(v, a.Started); + let T = m(v); + if (T) { + const R = this.opts.es5 ? e.varKinds.var : e.varKinds.const; + A = (0, t._)`${A}${R} ${v} = ${T};${this.opts._n}`; + } else if (T = N == null ? void 0 : N(v)) + A = (0, t._)`${A}${T}${this.opts._n}`; else - throw new a(v); - T.set(v, n.Completed); + throw new r(v); + x.set(v, a.Completed); }); } return A; } } e.ValueScope = b; -})($o); +})(ca); (function(e) { 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; - const t = qa, a = $o; - var n = qa; + const t = fr, r = ca; + var a = fr; Object.defineProperty(e, "_", { enumerable: !0, get: function() { - return n._; + return a._; } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { - return n.str; + return a.str; } }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() { - return n.strConcat; + return a.strConcat; } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { - return n.nil; + return a.nil; } }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() { - return n.getProperty; + return a.getProperty; } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { - return n.stringify; + return a.stringify; } }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() { - return n.regexpCode; + return a.regexpCode; } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { - return n.Name; + return a.Name; } }); - var s = $o; + var s = ca; Object.defineProperty(e, "Scope", { enumerable: !0, get: function() { return s.Scope; } }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() { @@ -305,729 +309,729 @@ var $o = {}; AND: new t._Code("&&"), ADD: new t._Code("+") }; - class c { + class l { optimizeNodes() { return this; } - optimizeNames(d, k) { + optimizeNames(h, $) { return this; } } - class p extends c { - constructor(d, k, R) { - super(), this.varKind = d, this.name = k, this.rhs = R; + class d extends l { + constructor(h, $, I) { + super(), this.varKind = h, this.name = $, this.rhs = I; } - render({ es5: d, _n: k }) { - const R = d ? a.varKinds.var : this.varKind, G = this.rhs === void 0 ? "" : ` = ${this.rhs}`; - return `${R} ${this.name}${G};` + k; + render({ es5: h, _n: $ }) { + const I = h ? r.varKinds.var : this.varKind, H = this.rhs === void 0 ? "" : ` = ${this.rhs}`; + return `${I} ${this.name}${H};` + $; } - optimizeNames(d, k) { - if (d[this.name.str]) - return this.rhs && (this.rhs = z(this.rhs, d, k)), this; + optimizeNames(h, $) { + if (h[this.name.str]) + return this.rhs && (this.rhs = B(this.rhs, h, $)), this; } get names() { return this.rhs instanceof t._CodeOrName ? this.rhs.names : {}; } } - class b extends c { - constructor(d, k, R) { - super(), this.lhs = d, this.rhs = k, this.sideEffects = R; + class b extends l { + constructor(h, $, I) { + super(), this.lhs = h, this.rhs = $, this.sideEffects = I; } - render({ _n: d }) { - return `${this.lhs} = ${this.rhs};` + d; + render({ _n: h }) { + return `${this.lhs} = ${this.rhs};` + h; } - optimizeNames(d, k) { - if (!(this.lhs instanceof t.Name && !d[this.lhs.str] && !this.sideEffects)) - return this.rhs = z(this.rhs, d, k), this; + optimizeNames(h, $) { + if (!(this.lhs instanceof t.Name && !h[this.lhs.str] && !this.sideEffects)) + return this.rhs = B(this.rhs, h, $), this; } get names() { - const d = this.lhs instanceof t.Name ? {} : { ...this.lhs.names }; - return U(d, this.rhs); + const h = this.lhs instanceof t.Name ? {} : { ...this.lhs.names }; + return q(h, this.rhs); } } class _ extends b { - constructor(d, k, R, G) { - super(d, R, G), this.op = k; + constructor(h, $, I, H) { + super(h, I, H), this.op = $; } - render({ _n: d }) { - return `${this.lhs} ${this.op}= ${this.rhs};` + d; + render({ _n: h }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + h; } } - class y extends c { - constructor(d) { - super(), this.label = d, this.names = {}; + class y extends l { + constructor(h) { + super(), this.label = h, this.names = {}; } - render({ _n: d }) { - return `${this.label}:` + d; + render({ _n: h }) { + return `${this.label}:` + h; } } - class g extends c { - constructor(d) { - super(), this.label = d, this.names = {}; + class m extends l { + constructor(h) { + super(), this.label = h, this.names = {}; } - render({ _n: d }) { - return `break${this.label ? ` ${this.label}` : ""};` + d; + render({ _n: h }) { + return `break${this.label ? ` ${this.label}` : ""};` + h; } } - class S extends c { - constructor(d) { - super(), this.error = d; + class k extends l { + constructor(h) { + super(), this.error = h; } - render({ _n: d }) { - return `throw ${this.error};` + d; + render({ _n: h }) { + return `throw ${this.error};` + h; } get names() { return this.error.names; } } - class L extends c { - constructor(d) { - super(), this.code = d; + class N extends l { + constructor(h) { + super(), this.code = h; } - render({ _n: d }) { - return `${this.code};` + d; + render({ _n: h }) { + return `${this.code};` + h; } optimizeNodes() { return `${this.code}` ? this : void 0; } - optimizeNames(d, k) { - return this.code = z(this.code, d, k), this; + optimizeNames(h, $) { + return this.code = B(this.code, h, $), this; } get names() { return this.code instanceof t._CodeOrName ? this.code.names : {}; } } - class A extends c { - constructor(d = []) { - super(), this.nodes = d; + class A extends l { + constructor(h = []) { + super(), this.nodes = h; } - render(d) { - return this.nodes.reduce((k, R) => k + R.render(d), ""); + render(h) { + return this.nodes.reduce(($, I) => $ + I.render(h), ""); } optimizeNodes() { - const { nodes: d } = this; - let k = d.length; - for (; k--; ) { - const R = d[k].optimizeNodes(); - Array.isArray(R) ? d.splice(k, 1, ...R) : R ? d[k] = R : d.splice(k, 1); + const { nodes: h } = this; + let $ = h.length; + for (; $--; ) { + const I = h[$].optimizeNodes(); + Array.isArray(I) ? h.splice($, 1, ...I) : I ? h[$] = I : h.splice($, 1); } - return d.length > 0 ? this : void 0; - } - optimizeNames(d, k) { - const { nodes: R } = this; - let G = R.length; - for (; G--; ) { - const K = R[G]; - K.optimizeNames(d, k) || (H(d, K.names), R.splice(G, 1)); + return h.length > 0 ? this : void 0; + } + optimizeNames(h, $) { + const { nodes: I } = this; + let H = I.length; + for (; H--; ) { + const K = I[H]; + K.optimizeNames(h, $) || (G(h, K.names), I.splice(H, 1)); } - return R.length > 0 ? this : void 0; + return I.length > 0 ? this : void 0; } get names() { - return this.nodes.reduce((d, k) => B(d, k.names), {}); + return this.nodes.reduce((h, $) => z(h, $.names), {}); } } - class N extends A { - render(d) { - return "{" + d._n + super.render(d) + "}" + d._n; + class j extends A { + render(h) { + return "{" + h._n + super.render(h) + "}" + h._n; } } class C extends A { } - class T extends N { + class x extends j { } - T.kind = "else"; - class v extends N { - constructor(d, k) { - super(k), this.condition = d; + x.kind = "else"; + class v extends j { + constructor(h, $) { + super($), this.condition = h; } - render(d) { - let k = `if(${this.condition})` + super.render(d); - return this.else && (k += "else " + this.else.render(d)), k; + render(h) { + let $ = `if(${this.condition})` + super.render(h); + return this.else && ($ += "else " + this.else.render(h)), $; } optimizeNodes() { super.optimizeNodes(); - const d = this.condition; - if (d === !0) + const h = this.condition; + if (h === !0) return this.nodes; - let k = this.else; - if (k) { - const R = k.optimizeNodes(); - k = this.else = Array.isArray(R) ? new T(R) : R; + let $ = this.else; + if ($) { + const I = $.optimizeNodes(); + $ = this.else = Array.isArray(I) ? new x(I) : I; } - if (k) - return d === !1 ? k instanceof v ? k : k.nodes : this.nodes.length ? this : new v(w(d), k instanceof v ? [k] : k.nodes); - if (!(d === !1 || !this.nodes.length)) + if ($) + return h === !1 ? $ instanceof v ? $ : $.nodes : this.nodes.length ? this : new v(w(h), $ instanceof v ? [$] : $.nodes); + if (!(h === !1 || !this.nodes.length)) return this; } - optimizeNames(d, k) { - var R; - if (this.else = (R = this.else) === null || R === void 0 ? void 0 : R.optimizeNames(d, k), !!(super.optimizeNames(d, k) || this.else)) - return this.condition = z(this.condition, d, k), this; + optimizeNames(h, $) { + var I; + if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(h, $), !!(super.optimizeNames(h, $) || this.else)) + return this.condition = B(this.condition, h, $), this; } get names() { - const d = super.names; - return U(d, this.condition), this.else && B(d, this.else.names), d; + const h = super.names; + return q(h, this.condition), this.else && z(h, this.else.names), h; } } v.kind = "if"; - class j extends N { + class T extends j { } - j.kind = "for"; - class I extends j { - constructor(d) { - super(), this.iteration = d; + T.kind = "for"; + class R extends T { + constructor(h) { + super(), this.iteration = h; } - render(d) { - return `for(${this.iteration})` + super.render(d); + render(h) { + return `for(${this.iteration})` + super.render(h); } - optimizeNames(d, k) { - if (super.optimizeNames(d, k)) - return this.iteration = z(this.iteration, d, k), this; + optimizeNames(h, $) { + if (super.optimizeNames(h, $)) + return this.iteration = B(this.iteration, h, $), this; } get names() { - return B(super.names, this.iteration.names); + return z(super.names, this.iteration.names); } } - class r extends j { - constructor(d, k, R, G) { - super(), this.varKind = d, this.name = k, this.from = R, this.to = G; + class n extends T { + constructor(h, $, I, H) { + super(), this.varKind = h, this.name = $, this.from = I, this.to = H; } - render(d) { - const k = d.es5 ? a.varKinds.var : this.varKind, { name: R, from: G, to: K } = this; - return `for(${k} ${R}=${G}; ${R}<${K}; ${R}++)` + super.render(d); + render(h) { + const $ = h.es5 ? r.varKinds.var : this.varKind, { name: I, from: H, to: K } = this; + return `for(${$} ${I}=${H}; ${I}<${K}; ${I}++)` + super.render(h); } get names() { - const d = U(super.names, this.from); - return U(d, this.to); + const h = q(super.names, this.from); + return q(h, this.to); } } - class i extends j { - constructor(d, k, R, G) { - super(), this.loop = d, this.varKind = k, this.name = R, this.iterable = G; + class i extends T { + constructor(h, $, I, H) { + super(), this.loop = h, this.varKind = $, this.name = I, this.iterable = H; } - render(d) { - return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(d); + render(h) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(h); } - optimizeNames(d, k) { - if (super.optimizeNames(d, k)) - return this.iterable = z(this.iterable, d, k), this; + optimizeNames(h, $) { + if (super.optimizeNames(h, $)) + return this.iterable = B(this.iterable, h, $), this; } get names() { - return B(super.names, this.iterable.names); + return z(super.names, this.iterable.names); } } - class o extends N { - constructor(d, k, R) { - super(), this.name = d, this.args = k, this.async = R; + class o extends j { + constructor(h, $, I) { + super(), this.name = h, this.args = $, this.async = I; } - render(d) { - return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(d); + render(h) { + return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(h); } } o.kind = "func"; - class l extends A { - render(d) { - return "return " + super.render(d); + class c extends A { + render(h) { + return "return " + super.render(h); } } - l.kind = "return"; - class u extends N { - render(d) { - let k = "try" + super.render(d); - return this.catch && (k += this.catch.render(d)), this.finally && (k += this.finally.render(d)), k; + c.kind = "return"; + class u extends j { + render(h) { + let $ = "try" + super.render(h); + return this.catch && ($ += this.catch.render(h)), this.finally && ($ += this.finally.render(h)), $; } optimizeNodes() { - var d, k; - return super.optimizeNodes(), (d = this.catch) === null || d === void 0 || d.optimizeNodes(), (k = this.finally) === null || k === void 0 || k.optimizeNodes(), this; + var h, $; + return super.optimizeNodes(), (h = this.catch) === null || h === void 0 || h.optimizeNodes(), ($ = this.finally) === null || $ === void 0 || $.optimizeNodes(), this; } - optimizeNames(d, k) { - var R, G; - return super.optimizeNames(d, k), (R = this.catch) === null || R === void 0 || R.optimizeNames(d, k), (G = this.finally) === null || G === void 0 || G.optimizeNames(d, k), this; + optimizeNames(h, $) { + var I, H; + return super.optimizeNames(h, $), (I = this.catch) === null || I === void 0 || I.optimizeNames(h, $), (H = this.finally) === null || H === void 0 || H.optimizeNames(h, $), this; } get names() { - const d = super.names; - return this.catch && B(d, this.catch.names), this.finally && B(d, this.finally.names), d; + const h = super.names; + return this.catch && z(h, this.catch.names), this.finally && z(h, this.finally.names), h; } } - class m extends N { - constructor(d) { - super(), this.error = d; + class f extends j { + constructor(h) { + super(), this.error = h; } - render(d) { - return `catch(${this.error})` + super.render(d); + render(h) { + return `catch(${this.error})` + super.render(h); } } - m.kind = "catch"; - class f extends N { - render(d) { - return "finally" + super.render(d); + f.kind = "catch"; + class g extends j { + render(h) { + return "finally" + super.render(h); } } - f.kind = "finally"; - class x { - constructor(d, k = {}) { - this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...k, _n: k.lines ? ` -` : "" }, this._extScope = d, this._scope = new a.Scope({ parent: d }), this._nodes = [new C()]; + g.kind = "finally"; + class O { + constructor(h, $ = {}) { + this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...$, _n: $.lines ? ` +` : "" }, this._extScope = h, this._scope = new r.Scope({ parent: h }), this._nodes = [new C()]; } toString() { return this._root.render(this.opts); } // returns unique name in the internal scope - name(d) { - return this._scope.name(d); + name(h) { + return this._scope.name(h); } // reserves unique name in the external scope - scopeName(d) { - return this._extScope.name(d); + scopeName(h) { + return this._extScope.name(h); } // reserves unique name in the external scope and assigns value to it - scopeValue(d, k) { - const R = this._extScope.value(d, k); - return (this._values[R.prefix] || (this._values[R.prefix] = /* @__PURE__ */ new Set())).add(R), R; + scopeValue(h, $) { + const I = this._extScope.value(h, $); + return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I; } - getScopeValue(d, k) { - return this._extScope.getValue(d, k); + getScopeValue(h, $) { + return this._extScope.getValue(h, $); } // 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(d) { - return this._extScope.scopeRefs(d, this._values); + scopeRefs(h) { + return this._extScope.scopeRefs(h, this._values); } scopeCode() { return this._extScope.scopeCode(this._values); } - _def(d, k, R, G) { - const K = this._scope.toName(k); - return R !== void 0 && G && (this._constants[K.str] = R), this._leafNode(new p(d, K, R)), K; + _def(h, $, I, H) { + const K = this._scope.toName($); + return I !== void 0 && H && (this._constants[K.str] = I), this._leafNode(new d(h, K, I)), K; } // `const` declaration (`var` in es5 mode) - const(d, k, R) { - return this._def(a.varKinds.const, d, k, R); + const(h, $, I) { + return this._def(r.varKinds.const, h, $, I); } // `let` declaration with optional assignment (`var` in es5 mode) - let(d, k, R) { - return this._def(a.varKinds.let, d, k, R); + let(h, $, I) { + return this._def(r.varKinds.let, h, $, I); } // `var` declaration with optional assignment - var(d, k, R) { - return this._def(a.varKinds.var, d, k, R); + var(h, $, I) { + return this._def(r.varKinds.var, h, $, I); } // assignment code - assign(d, k, R) { - return this._leafNode(new b(d, k, R)); + assign(h, $, I) { + return this._leafNode(new b(h, $, I)); } // `+=` code - add(d, k) { - return this._leafNode(new _(d, e.operators.ADD, k)); + add(h, $) { + return this._leafNode(new _(h, e.operators.ADD, $)); } // appends passed SafeExpr to code or executes Block - code(d) { - return typeof d == "function" ? d() : d !== t.nil && this._leafNode(new L(d)), this; + code(h) { + return typeof h == "function" ? h() : h !== t.nil && this._leafNode(new N(h)), this; } // returns code for object literal for the passed argument list of key-value pairs - object(...d) { - const k = ["{"]; - for (const [R, G] of d) - k.length > 1 && k.push(","), k.push(R), (R !== G || this.opts.es5) && (k.push(":"), (0, t.addCodeArg)(k, G)); - return k.push("}"), new t._Code(k); + object(...h) { + const $ = ["{"]; + for (const [I, H] of h) + $.length > 1 && $.push(","), $.push(I), (I !== H || this.opts.es5) && ($.push(":"), (0, t.addCodeArg)($, H)); + return $.push("}"), new t._Code($); } // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) - if(d, k, R) { - if (this._blockNode(new v(d)), k && R) - this.code(k).else().code(R).endIf(); - else if (k) - this.code(k).endIf(); - else if (R) + if(h, $, I) { + if (this._blockNode(new v(h)), $ && I) + this.code($).else().code(I).endIf(); + else if ($) + this.code($).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(d) { - return this._elseNode(new v(d)); + elseIf(h) { + return this._elseNode(new v(h)); } // `else` clause - only valid after `if` or `else if` clauses else() { - return this._elseNode(new T()); + return this._elseNode(new x()); } // end `if` statement (needed if gen.if was used only with condition) endIf() { - return this._endBlockNode(v, T); + return this._endBlockNode(v, x); } - _for(d, k) { - return this._blockNode(d), k && this.code(k).endFor(), this; + _for(h, $) { + return this._blockNode(h), $ && this.code($).endFor(), this; } // a generic `for` clause (or statement if `forBody` is passed) - for(d, k) { - return this._for(new I(d), k); + for(h, $) { + return this._for(new R(h), $); } // `for` statement for a range of values - forRange(d, k, R, G, K = this.opts.es5 ? a.varKinds.var : a.varKinds.let) { - const X = this._scope.toName(d); - return this._for(new r(K, X, k, R), () => G(X)); + forRange(h, $, I, H, K = this.opts.es5 ? r.varKinds.var : r.varKinds.let) { + const te = this._scope.toName(h); + return this._for(new n(K, te, $, I), () => H(te)); } // `for-of` statement (in es5 mode replace with a normal for loop) - forOf(d, k, R, G = a.varKinds.const) { - const K = this._scope.toName(d); + forOf(h, $, I, H = r.varKinds.const) { + const K = this._scope.toName(h); if (this.opts.es5) { - const X = k instanceof t.Name ? k : this.var("_arr", k); - return this.forRange("_i", 0, (0, t._)`${X}.length`, (ee) => { - this.var(K, (0, t._)`${X}[${ee}]`), R(K); + const te = $ instanceof t.Name ? $ : this.var("_arr", $); + return this.forRange("_i", 0, (0, t._)`${te}.length`, (ne) => { + this.var(K, (0, t._)`${te}[${ne}]`), I(K); }); } - return this._for(new i("of", G, K, k), () => R(K)); + return this._for(new i("of", H, K, $), () => I(K)); } // `for-in` statement. // With option `ownProperties` replaced with a `for-of` loop for object keys - forIn(d, k, R, G = this.opts.es5 ? a.varKinds.var : a.varKinds.const) { + forIn(h, $, I, H = this.opts.es5 ? r.varKinds.var : r.varKinds.const) { if (this.opts.ownProperties) - return this.forOf(d, (0, t._)`Object.keys(${k})`, R); - const K = this._scope.toName(d); - return this._for(new i("in", G, K, k), () => R(K)); + return this.forOf(h, (0, t._)`Object.keys(${$})`, I); + const K = this._scope.toName(h); + return this._for(new i("in", H, K, $), () => I(K)); } // end `for` loop endFor() { - return this._endBlockNode(j); + return this._endBlockNode(T); } // `label` statement - label(d) { - return this._leafNode(new y(d)); + label(h) { + return this._leafNode(new y(h)); } // `break` statement - break(d) { - return this._leafNode(new g(d)); + break(h) { + return this._leafNode(new m(h)); } // `return` statement - return(d) { - const k = new l(); - if (this._blockNode(k), this.code(d), k.nodes.length !== 1) + return(h) { + const $ = new c(); + if (this._blockNode($), this.code(h), $.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node'); - return this._endBlockNode(l); + return this._endBlockNode(c); } // `try` statement - try(d, k, R) { - if (!k && !R) + try(h, $, I) { + if (!$ && !I) throw new Error('CodeGen: "try" without "catch" and "finally"'); - const G = new u(); - if (this._blockNode(G), this.code(d), k) { + const H = new u(); + if (this._blockNode(H), this.code(h), $) { const K = this.name("e"); - this._currNode = G.catch = new m(K), k(K); + this._currNode = H.catch = new f(K), $(K); } - return R && (this._currNode = G.finally = new f(), this.code(R)), this._endBlockNode(m, f); + return I && (this._currNode = H.finally = new g(), this.code(I)), this._endBlockNode(f, g); } // `throw` statement - throw(d) { - return this._leafNode(new S(d)); + throw(h) { + return this._leafNode(new k(h)); } // start self-balancing block - block(d, k) { - return this._blockStarts.push(this._nodes.length), d && this.code(d).endBlock(k), this; + block(h, $) { + return this._blockStarts.push(this._nodes.length), h && this.code(h).endBlock($), this; } // end the current self-balancing block - endBlock(d) { - const k = this._blockStarts.pop(); - if (k === void 0) + endBlock(h) { + const $ = this._blockStarts.pop(); + if ($ === void 0) throw new Error("CodeGen: not in self-balancing block"); - const R = this._nodes.length - k; - if (R < 0 || d !== void 0 && R !== d) - throw new Error(`CodeGen: wrong number of nodes: ${R} vs ${d} expected`); - return this._nodes.length = k, this; + const I = this._nodes.length - $; + if (I < 0 || h !== void 0 && I !== h) + throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${h} expected`); + return this._nodes.length = $, this; } // `function` heading (or definition if funcBody is passed) - func(d, k = t.nil, R, G) { - return this._blockNode(new o(d, k, R)), G && this.code(G).endFunc(), this; + func(h, $ = t.nil, I, H) { + return this._blockNode(new o(h, $, I)), H && this.code(H).endFunc(), this; } // end function definition endFunc() { return this._endBlockNode(o); } - optimize(d = 1) { - for (; d-- > 0; ) + optimize(h = 1) { + for (; h-- > 0; ) this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); } - _leafNode(d) { - return this._currNode.nodes.push(d), this; + _leafNode(h) { + return this._currNode.nodes.push(h), this; } - _blockNode(d) { - this._currNode.nodes.push(d), this._nodes.push(d); + _blockNode(h) { + this._currNode.nodes.push(h), this._nodes.push(h); } - _endBlockNode(d, k) { - const R = this._currNode; - if (R instanceof d || k && R instanceof k) + _endBlockNode(h, $) { + const I = this._currNode; + if (I instanceof h || $ && I instanceof $) return this._nodes.pop(), this; - throw new Error(`CodeGen: not in block "${k ? `${d.kind}/${k.kind}` : d.kind}"`); + throw new Error(`CodeGen: not in block "${$ ? `${h.kind}/${$.kind}` : h.kind}"`); } - _elseNode(d) { - const k = this._currNode; - if (!(k instanceof v)) + _elseNode(h) { + const $ = this._currNode; + if (!($ instanceof v)) throw new Error('CodeGen: "else" without "if"'); - return this._currNode = k.else = d, this; + return this._currNode = $.else = h, this; } get _root() { return this._nodes[0]; } get _currNode() { - const d = this._nodes; - return d[d.length - 1]; + const h = this._nodes; + return h[h.length - 1]; } - set _currNode(d) { - const k = this._nodes; - k[k.length - 1] = d; + set _currNode(h) { + const $ = this._nodes; + $[$.length - 1] = h; } } - e.CodeGen = x; - function B(O, d) { - for (const k in d) - O[k] = (O[k] || 0) + (d[k] || 0); - return O; + e.CodeGen = O; + function z(L, h) { + for (const $ in h) + L[$] = (L[$] || 0) + (h[$] || 0); + return L; } - function U(O, d) { - return d instanceof t._CodeOrName ? B(O, d.names) : O; + function q(L, h) { + return h instanceof t._CodeOrName ? z(L, h.names) : L; } - function z(O, d, k) { - if (O instanceof t.Name) - return R(O); - if (!G(O)) - return O; - return new t._Code(O._items.reduce((K, X) => (X instanceof t.Name && (X = R(X)), X instanceof t._Code ? K.push(...X._items) : K.push(X), K), [])); - function R(K) { - const X = k[K.str]; - return X === void 0 || d[K.str] !== 1 ? K : (delete d[K.str], X); + function B(L, h, $) { + if (L instanceof t.Name) + return I(L); + if (!H(L)) + return L; + return new t._Code(L._items.reduce((K, te) => (te instanceof t.Name && (te = I(te)), te instanceof t._Code ? K.push(...te._items) : K.push(te), K), [])); + function I(K) { + const te = $[K.str]; + return te === void 0 || h[K.str] !== 1 ? K : (delete h[K.str], te); } - function G(K) { - return K instanceof t._Code && K._items.some((X) => X instanceof t.Name && d[X.str] === 1 && k[X.str] !== void 0); + function H(K) { + return K instanceof t._Code && K._items.some((te) => te instanceof t.Name && h[te.str] === 1 && $[te.str] !== void 0); } } - function H(O, d) { - for (const k in d) - O[k] = (O[k] || 0) - (d[k] || 0); + function G(L, h) { + for (const $ in h) + L[$] = (L[$] || 0) - (h[$] || 0); } - function w(O) { - return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${F(O)}`; + function w(L) { + return typeof L == "boolean" || typeof L == "number" || L === null ? !L : (0, t._)`!${F(L)}`; } e.not = w; - const q = E(e.operators.AND); - function W(...O) { - return O.reduce(q); + const U = P(e.operators.AND); + function W(...L) { + return L.reduce(U); } e.and = W; - const J = E(e.operators.OR); - function V(...O) { - return O.reduce(J); + const J = P(e.operators.OR); + function V(...L) { + return L.reduce(J); } e.or = V; - function E(O) { - return (d, k) => d === t.nil ? k : k === t.nil ? d : (0, t._)`${F(d)} ${O} ${F(k)}`; + function P(L) { + return (h, $) => h === t.nil ? $ : $ === t.nil ? h : (0, t._)`${F(h)} ${L} ${F($)}`; } - function F(O) { - return O instanceof t.Name ? O : (0, t._)`(${O})`; + function F(L) { + return L instanceof t.Name ? L : (0, t._)`(${L})`; } -})(we); -var $e = {}; +})(ie); +var ce = {}; (function(e) { 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; - const t = we, a = qa; - function n(o) { - const l = {}; + const t = ie, r = fr; + function a(o) { + const c = {}; for (const u of o) - l[u] = !0; - return l; + c[u] = !0; + return c; } - e.toHash = n; - function s(o, l) { - return typeof l == "boolean" ? l : Object.keys(l).length === 0 ? !0 : (c(o, l), !p(l, o.self.RULES.all)); + e.toHash = a; + function s(o, c) { + return typeof c == "boolean" ? c : Object.keys(c).length === 0 ? !0 : (l(o, c), !d(c, o.self.RULES.all)); } e.alwaysValidSchema = s; - function c(o, l = o.schema) { - const { opts: u, self: m } = o; - if (!u.strictSchema || typeof l == "boolean") + function l(o, c = o.schema) { + const { opts: u, self: f } = o; + if (!u.strictSchema || typeof c == "boolean") return; - const f = m.RULES.keywords; - for (const x in l) - f[x] || i(o, `unknown keyword: "${x}"`); + const g = f.RULES.keywords; + for (const O in c) + g[O] || i(o, `unknown keyword: "${O}"`); } - e.checkUnknownRules = c; - function p(o, l) { + e.checkUnknownRules = l; + function d(o, c) { if (typeof o == "boolean") return !o; for (const u in o) - if (l[u]) + if (c[u]) return !0; return !1; } - e.schemaHasRules = p; - function b(o, l) { + e.schemaHasRules = d; + function b(o, c) { if (typeof o == "boolean") return !o; for (const u in o) - if (u !== "$ref" && l.all[u]) + if (u !== "$ref" && c.all[u]) return !0; return !1; } e.schemaHasRulesButRef = b; - function _({ topSchemaRef: o, schemaPath: l }, u, m, f) { - if (!f) { + function _({ topSchemaRef: o, schemaPath: c }, u, f, g) { + if (!g) { if (typeof u == "number" || typeof u == "boolean") return u; if (typeof u == "string") return (0, t._)`${u}`; } - return (0, t._)`${o}${l}${(0, t.getProperty)(m)}`; + return (0, t._)`${o}${c}${(0, t.getProperty)(f)}`; } e.schemaRefOrVal = _; function y(o) { - return L(decodeURIComponent(o)); + return N(decodeURIComponent(o)); } e.unescapeFragment = y; - function g(o) { - return encodeURIComponent(S(o)); + function m(o) { + return encodeURIComponent(k(o)); } - e.escapeFragment = g; - function S(o) { + e.escapeFragment = m; + function k(o) { return typeof o == "number" ? `${o}` : o.replace(/~/g, "~0").replace(/\//g, "~1"); } - e.escapeJsonPointer = S; - function L(o) { + e.escapeJsonPointer = k; + function N(o) { return o.replace(/~1/g, "/").replace(/~0/g, "~"); } - e.unescapeJsonPointer = L; - function A(o, l) { + e.unescapeJsonPointer = N; + function A(o, c) { if (Array.isArray(o)) for (const u of o) - l(u); + c(u); else - l(o); + c(o); } e.eachItem = A; - function N({ mergeNames: o, mergeToName: l, mergeValues: u, resultToName: m }) { - return (f, x, B, U) => { - const z = B === void 0 ? x : B instanceof t.Name ? (x instanceof t.Name ? o(f, x, B) : l(f, x, B), B) : x instanceof t.Name ? (l(f, B, x), x) : u(x, B); - return U === t.Name && !(z instanceof t.Name) ? m(f, z) : z; + function j({ mergeNames: o, mergeToName: c, mergeValues: u, resultToName: f }) { + return (g, O, z, q) => { + const B = z === void 0 ? O : z instanceof t.Name ? (O instanceof t.Name ? o(g, O, z) : c(g, O, z), z) : O instanceof t.Name ? (c(g, z, O), O) : u(O, z); + return q === t.Name && !(B instanceof t.Name) ? f(g, B) : B; }; } e.mergeEvaluated = { - props: N({ - mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => { - o.if((0, t._)`${l} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${l})`)); + props: j({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => { + o.if((0, t._)`${c} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${c})`)); }), - mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => { - l === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), T(o, u, l)); + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => { + c === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), x(o, u, c)); }), - mergeValues: (o, l) => o === !0 ? !0 : { ...o, ...l }, + mergeValues: (o, c) => o === !0 ? !0 : { ...o, ...c }, resultToName: C }), - items: N({ - mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => o.assign(u, (0, t._)`${l} === true ? true : ${u} > ${l} ? ${u} : ${l}`)), - mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, l === !0 ? !0 : (0, t._)`${u} > ${l} ? ${u} : ${l}`)), - mergeValues: (o, l) => o === !0 ? !0 : Math.max(o, l), - resultToName: (o, l) => o.var("items", l) + items: j({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => o.assign(u, (0, t._)`${c} === true ? true : ${u} > ${c} ? ${u} : ${c}`)), + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, c === !0 ? !0 : (0, t._)`${u} > ${c} ? ${u} : ${c}`)), + mergeValues: (o, c) => o === !0 ? !0 : Math.max(o, c), + resultToName: (o, c) => o.var("items", c) }) }; - function C(o, l) { - if (l === !0) + function C(o, c) { + if (c === !0) return o.var("props", !0); const u = o.var("props", (0, t._)`{}`); - return l !== void 0 && T(o, u, l), u; + return c !== void 0 && x(o, u, c), u; } e.evaluatedPropsToName = C; - function T(o, l, u) { - Object.keys(u).forEach((m) => o.assign((0, t._)`${l}${(0, t.getProperty)(m)}`, !0)); + function x(o, c, u) { + Object.keys(u).forEach((f) => o.assign((0, t._)`${c}${(0, t.getProperty)(f)}`, !0)); } - e.setEvaluated = T; + e.setEvaluated = x; const v = {}; - function j(o, l) { + function T(o, c) { return o.scopeValue("func", { - ref: l, - code: v[l.code] || (v[l.code] = new a._Code(l.code)) + ref: c, + code: v[c.code] || (v[c.code] = new r._Code(c.code)) }); } - e.useFunc = j; - var I; + e.useFunc = T; + var R; (function(o) { o[o.Num = 0] = "Num", o[o.Str = 1] = "Str"; - })(I = e.Type || (e.Type = {})); - function r(o, l, u) { + })(R = e.Type || (e.Type = {})); + function n(o, c, u) { if (o instanceof t.Name) { - const m = l === I.Num; - return u ? m ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : m ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + const f = c === R.Num; + return u ? f ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : f ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`; } - return u ? (0, t.getProperty)(o).toString() : "/" + S(o); + return u ? (0, t.getProperty)(o).toString() : "/" + k(o); } - e.getErrorPath = r; - function i(o, l, u = o.opts.strictSchema) { + e.getErrorPath = n; + function i(o, c, u = o.opts.strictSchema) { if (u) { - if (l = `strict mode: ${l}`, u === !0) - throw new Error(l); - o.self.logger.warn(l); + if (c = `strict mode: ${c}`, u === !0) + throw new Error(c); + o.self.logger.warn(c); } } e.checkStrictMode = i; -})($e); -var cr = {}; -Object.defineProperty(cr, "__esModule", { value: !0 }); -const at = we, Bu = { +})(ce); +var ct = {}; +Object.defineProperty(ct, "__esModule", { value: !0 }); +const Oe = ie, Ps = { // validation function arguments - data: new at.Name("data"), + data: new Oe.Name("data"), // args passed from referencing schema - valCxt: new at.Name("valCxt"), - instancePath: new at.Name("instancePath"), - parentData: new at.Name("parentData"), - parentDataProperty: new at.Name("parentDataProperty"), - rootData: new at.Name("rootData"), - dynamicAnchors: new at.Name("dynamicAnchors"), + valCxt: new Oe.Name("valCxt"), + instancePath: new Oe.Name("instancePath"), + parentData: new Oe.Name("parentData"), + parentDataProperty: new Oe.Name("parentDataProperty"), + rootData: new Oe.Name("rootData"), + dynamicAnchors: new Oe.Name("dynamicAnchors"), // function scoped variables - vErrors: new at.Name("vErrors"), - errors: new at.Name("errors"), - this: new at.Name("this"), + vErrors: new Oe.Name("vErrors"), + errors: new Oe.Name("errors"), + this: new Oe.Name("this"), // "globals" - self: new at.Name("self"), - scope: new at.Name("scope"), + self: new Oe.Name("self"), + scope: new Oe.Name("scope"), // JTD serialize/parse name for JSON string and position - json: new at.Name("json"), - jsonPos: new at.Name("jsonPos"), - jsonLen: new at.Name("jsonLen"), - jsonPart: new at.Name("jsonPart") + json: new Oe.Name("json"), + jsonPos: new Oe.Name("jsonPos"), + jsonLen: new Oe.Name("jsonLen"), + jsonPart: new Oe.Name("jsonPart") }; -cr.default = Bu; +ct.default = Ps; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0; - const t = we, a = $e, n = cr; + const t = ie, r = ce, a = ct; e.keywordError = { - message: ({ keyword: T }) => (0, t.str)`must pass "${T}" keyword validation` + message: ({ keyword: x }) => (0, t.str)`must pass "${x}" keyword validation` }, e.keyword$DataError = { - message: ({ keyword: T, schemaType: v }) => v ? (0, t.str)`"${T}" keyword must be ${v} ($data)` : (0, t.str)`"${T}" keyword is invalid ($data)` + message: ({ keyword: x, schemaType: v }) => v ? (0, t.str)`"${x}" keyword must be ${v} ($data)` : (0, t.str)`"${x}" keyword is invalid ($data)` }; - function s(T, v = e.keywordError, j, I) { - const { it: r } = T, { gen: i, compositeRule: o, allErrors: l } = r, u = S(T, v, j); - I ?? (o || l) ? _(i, u) : y(r, (0, t._)`[${u}]`); + function s(x, v = e.keywordError, T, R) { + const { it: n } = x, { gen: i, compositeRule: o, allErrors: c } = n, u = k(x, v, T); + R ?? (o || c) ? _(i, u) : y(n, (0, t._)`[${u}]`); } e.reportError = s; - function c(T, v = e.keywordError, j) { - const { it: I } = T, { gen: r, compositeRule: i, allErrors: o } = I, l = S(T, v, j); - _(r, l), i || o || y(I, n.default.vErrors); + function l(x, v = e.keywordError, T) { + const { it: R } = x, { gen: n, compositeRule: i, allErrors: o } = R, c = k(x, v, T); + _(n, c), i || o || y(R, a.default.vErrors); } - e.reportExtraError = c; - function p(T, v) { - T.assign(n.default.errors, v), T.if((0, t._)`${n.default.vErrors} !== null`, () => T.if(v, () => T.assign((0, t._)`${n.default.vErrors}.length`, v), () => T.assign(n.default.vErrors, null))); + e.reportExtraError = l; + function d(x, v) { + x.assign(a.default.errors, v), x.if((0, t._)`${a.default.vErrors} !== null`, () => x.if(v, () => x.assign((0, t._)`${a.default.vErrors}.length`, v), () => x.assign(a.default.vErrors, null))); } - e.resetErrorsCount = p; - function b({ gen: T, keyword: v, schemaValue: j, data: I, errsCount: r, it: i }) { - if (r === void 0) + e.resetErrorsCount = d; + function b({ gen: x, keyword: v, schemaValue: T, data: R, errsCount: n, it: i }) { + if (n === void 0) throw new Error("ajv implementation error"); - const o = T.name("err"); - T.forRange("i", r, n.default.errors, (l) => { - T.const(o, (0, t._)`${n.default.vErrors}[${l}]`), T.if((0, t._)`${o}.instancePath === undefined`, () => T.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(n.default.instancePath, i.errorPath))), T.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (T.assign((0, t._)`${o}.schema`, j), T.assign((0, t._)`${o}.data`, I)); + const o = x.name("err"); + x.forRange("i", n, a.default.errors, (c) => { + x.const(o, (0, t._)`${a.default.vErrors}[${c}]`), x.if((0, t._)`${o}.instancePath === undefined`, () => x.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(a.default.instancePath, i.errorPath))), x.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (x.assign((0, t._)`${o}.schema`, T), x.assign((0, t._)`${o}.data`, R)); }); } e.extendErrors = b; - function _(T, v) { - const j = T.const("err", v); - T.if((0, t._)`${n.default.vErrors} === null`, () => T.assign(n.default.vErrors, (0, t._)`[${j}]`), (0, t._)`${n.default.vErrors}.push(${j})`), T.code((0, t._)`${n.default.errors}++`); + function _(x, v) { + const T = x.const("err", v); + x.if((0, t._)`${a.default.vErrors} === null`, () => x.assign(a.default.vErrors, (0, t._)`[${T}]`), (0, t._)`${a.default.vErrors}.push(${T})`), x.code((0, t._)`${a.default.errors}++`); } - function y(T, v) { - const { gen: j, validateName: I, schemaEnv: r } = T; - r.$async ? j.throw((0, t._)`new ${T.ValidationError}(${v})`) : (j.assign((0, t._)`${I}.errors`, v), j.return(!1)); + function y(x, v) { + const { gen: T, validateName: R, schemaEnv: n } = x; + n.$async ? T.throw((0, t._)`new ${x.ValidationError}(${v})`) : (T.assign((0, t._)`${R}.errors`, v), T.return(!1)); } - const g = { + const m = { keyword: new t.Name("keyword"), schemaPath: new t.Name("schemaPath"), params: new t.Name("params"), @@ -1036,67 +1040,67 @@ cr.default = Bu; schema: new t.Name("schema"), parentSchema: new t.Name("parentSchema") }; - function S(T, v, j) { - const { createErrors: I } = T.it; - return I === !1 ? (0, t._)`{}` : L(T, v, j); - } - function L(T, v, j = {}) { - const { gen: I, it: r } = T, i = [ - A(r, j), - N(T, j) + function k(x, v, T) { + const { createErrors: R } = x.it; + return R === !1 ? (0, t._)`{}` : N(x, v, T); + } + function N(x, v, T = {}) { + const { gen: R, it: n } = x, i = [ + A(n, T), + j(x, T) ]; - return C(T, v, i), I.object(...i); + return C(x, v, i), R.object(...i); } - function A({ errorPath: T }, { instancePath: v }) { - const j = v ? (0, t.str)`${T}${(0, a.getErrorPath)(v, a.Type.Str)}` : T; - return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, j)]; + function A({ errorPath: x }, { instancePath: v }) { + const T = v ? (0, t.str)`${x}${(0, r.getErrorPath)(v, r.Type.Str)}` : x; + return [a.default.instancePath, (0, t.strConcat)(a.default.instancePath, T)]; } - function N({ keyword: T, it: { errSchemaPath: v } }, { schemaPath: j, parentSchema: I }) { - let r = I ? v : (0, t.str)`${v}/${T}`; - return j && (r = (0, t.str)`${r}${(0, a.getErrorPath)(j, a.Type.Str)}`), [g.schemaPath, r]; + function j({ keyword: x, it: { errSchemaPath: v } }, { schemaPath: T, parentSchema: R }) { + let n = R ? v : (0, t.str)`${v}/${x}`; + return T && (n = (0, t.str)`${n}${(0, r.getErrorPath)(T, r.Type.Str)}`), [m.schemaPath, n]; } - function C(T, { params: v, message: j }, I) { - const { keyword: r, data: i, schemaValue: o, it: l } = T, { opts: u, propertyName: m, topSchemaRef: f, schemaPath: x } = l; - I.push([g.keyword, r], [g.params, typeof v == "function" ? v(T) : v || (0, t._)`{}`]), u.messages && I.push([g.message, typeof j == "function" ? j(T) : j]), u.verbose && I.push([g.schema, o], [g.parentSchema, (0, t._)`${f}${x}`], [n.default.data, i]), m && I.push([g.propertyName, m]); + function C(x, { params: v, message: T }, R) { + const { keyword: n, data: i, schemaValue: o, it: c } = x, { opts: u, propertyName: f, topSchemaRef: g, schemaPath: O } = c; + R.push([m.keyword, n], [m.params, typeof v == "function" ? v(x) : v || (0, t._)`{}`]), u.messages && R.push([m.message, typeof T == "function" ? T(x) : T]), u.verbose && R.push([m.schema, o], [m.parentSchema, (0, t._)`${g}${O}`], [a.default.data, i]), f && R.push([m.propertyName, f]); } -})(Ka); -Object.defineProperty(sa, "__esModule", { value: !0 }); -sa.boolOrEmptySchema = sa.topBoolOrEmptySchema = void 0; -const Vu = Ka, Fu = we, Uu = cr, qu = { +})(br); +Object.defineProperty(Ht, "__esModule", { value: !0 }); +Ht.boolOrEmptySchema = Ht.topBoolOrEmptySchema = void 0; +const Ss = br, Ts = ie, Cs = ct, xs = { message: "boolean schema is false" }; -function Hu(e) { - const { gen: t, schema: a, validateName: n } = e; - a === !1 ? Mc(e, !1) : typeof a == "object" && a.$async === !0 ? t.return(Uu.default.data) : (t.assign((0, Fu._)`${n}.errors`, null), t.return(!0)); +function Os(e) { + const { gen: t, schema: r, validateName: a } = e; + r === !1 ? io(e, !1) : typeof r == "object" && r.$async === !0 ? t.return(Cs.default.data) : (t.assign((0, Ts._)`${a}.errors`, null), t.return(!0)); } -sa.topBoolOrEmptySchema = Hu; -function Gu(e, t) { - const { gen: a, schema: n } = e; - n === !1 ? (a.var(t, !1), Mc(e)) : a.var(t, !0); +Ht.topBoolOrEmptySchema = Os; +function Ns(e, t) { + const { gen: r, schema: a } = e; + a === !1 ? (r.var(t, !1), io(e)) : r.var(t, !0); } -sa.boolOrEmptySchema = Gu; -function Mc(e, t) { - const { gen: a, data: n } = e, s = { - gen: a, +Ht.boolOrEmptySchema = Ns; +function io(e, t) { + const { gen: r, data: a } = e, s = { + gen: r, keyword: "false schema", - data: n, + data: a, schema: !1, schemaCode: !1, schemaValue: !1, params: {}, it: e }; - (0, Vu.reportError)(s, qu, void 0, t); + (0, Ss.reportError)(s, xs, void 0, t); } -var Wa = {}, Fr = {}; -Object.defineProperty(Fr, "__esModule", { value: !0 }); -Fr.getRules = Fr.isJSONType = void 0; -const Ku = ["string", "number", "integer", "boolean", "null", "object", "array"], Wu = new Set(Ku); -function Ju(e) { - return typeof e == "string" && Wu.has(e); +var yr = {}, Nt = {}; +Object.defineProperty(Nt, "__esModule", { value: !0 }); +Nt.getRules = Nt.isJSONType = void 0; +const js = ["string", "number", "integer", "boolean", "null", "object", "array"], Ls = new Set(js); +function As(e) { + return typeof e == "string" && Ls.has(e); } -Fr.isJSONType = Ju; -function Zu() { +Nt.isJSONType = As; +function Rs() { const e = { number: { type: "number", rules: [] }, string: { type: "string", rules: [] }, @@ -1111,483 +1115,483 @@ function Zu() { keywords: {} }; } -Fr.getRules = Zu; -var mr = {}; -Object.defineProperty(mr, "__esModule", { value: !0 }); -mr.shouldUseRule = mr.shouldUseGroup = mr.schemaHasRulesForType = void 0; -function Yu({ schema: e, self: t }, a) { - const n = t.RULES.types[a]; - return n && n !== !0 && Dc(e, n); +Nt.getRules = Rs; +var pt = {}; +Object.defineProperty(pt, "__esModule", { value: !0 }); +pt.shouldUseRule = pt.shouldUseGroup = pt.schemaHasRulesForType = void 0; +function Is({ schema: e, self: t }, r) { + const a = t.RULES.types[r]; + return a && a !== !0 && lo(e, a); } -mr.schemaHasRulesForType = Yu; -function Dc(e, t) { - return t.rules.some((a) => zc(e, a)); +pt.schemaHasRulesForType = Is; +function lo(e, t) { + return t.rules.some((r) => co(e, r)); } -mr.shouldUseGroup = Dc; -function zc(e, t) { - var a; - return e[t.keyword] !== void 0 || ((a = t.definition.implements) === null || a === void 0 ? void 0 : a.some((n) => e[n] !== void 0)); +pt.shouldUseGroup = lo; +function co(e, t) { + var r; + return e[t.keyword] !== void 0 || ((r = t.definition.implements) === null || r === void 0 ? void 0 : r.some((a) => e[a] !== void 0)); } -mr.shouldUseRule = zc; +pt.shouldUseRule = co; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0; - const t = Fr, a = mr, n = Ka, s = we, c = $e; - var p; - (function(I) { - I[I.Correct = 0] = "Correct", I[I.Wrong = 1] = "Wrong"; - })(p = e.DataType || (e.DataType = {})); - function b(I) { - const r = _(I.type); - if (r.includes("null")) { - if (I.nullable === !1) + const t = Nt, r = pt, a = br, s = ie, l = ce; + var d; + (function(R) { + R[R.Correct = 0] = "Correct", R[R.Wrong = 1] = "Wrong"; + })(d = e.DataType || (e.DataType = {})); + function b(R) { + const n = _(R.type); + if (n.includes("null")) { + if (R.nullable === !1) throw new Error("type: null contradicts nullable: false"); } else { - if (!r.length && I.nullable !== void 0) + if (!n.length && R.nullable !== void 0) throw new Error('"nullable" cannot be used without "type"'); - I.nullable === !0 && r.push("null"); + R.nullable === !0 && n.push("null"); } - return r; + return n; } e.getSchemaTypes = b; - function _(I) { - const r = Array.isArray(I) ? I : I ? [I] : []; - if (r.every(t.isJSONType)) - return r; - throw new Error("type must be JSONType or JSONType[]: " + r.join(",")); + function _(R) { + const n = Array.isArray(R) ? R : R ? [R] : []; + if (n.every(t.isJSONType)) + return n; + throw new Error("type must be JSONType or JSONType[]: " + n.join(",")); } e.getJSONTypes = _; - function y(I, r) { - const { gen: i, data: o, opts: l } = I, u = S(r, l.coerceTypes), m = r.length > 0 && !(u.length === 0 && r.length === 1 && (0, a.schemaHasRulesForType)(I, r[0])); - if (m) { - const f = C(r, o, l.strictNumbers, p.Wrong); - i.if(f, () => { - u.length ? L(I, r, u) : v(I); + function y(R, n) { + const { gen: i, data: o, opts: c } = R, u = k(n, c.coerceTypes), f = n.length > 0 && !(u.length === 0 && n.length === 1 && (0, r.schemaHasRulesForType)(R, n[0])); + if (f) { + const g = C(n, o, c.strictNumbers, d.Wrong); + i.if(g, () => { + u.length ? N(R, n, u) : v(R); }); } - return m; + return f; } e.coerceAndCheckDataType = y; - const g = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); - function S(I, r) { - return r ? I.filter((i) => g.has(i) || r === "array" && i === "array") : []; - } - function L(I, r, i) { - const { gen: o, data: l, opts: u } = I, m = o.let("dataType", (0, s._)`typeof ${l}`), f = o.let("coerced", (0, s._)`undefined`); - u.coerceTypes === "array" && o.if((0, s._)`${m} == 'object' && Array.isArray(${l}) && ${l}.length == 1`, () => o.assign(l, (0, s._)`${l}[0]`).assign(m, (0, s._)`typeof ${l}`).if(C(r, l, u.strictNumbers), () => o.assign(f, l))), o.if((0, s._)`${f} !== undefined`); - for (const B of i) - (g.has(B) || B === "array" && u.coerceTypes === "array") && x(B); - o.else(), v(I), o.endIf(), o.if((0, s._)`${f} !== undefined`, () => { - o.assign(l, f), A(I, f); + const m = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function k(R, n) { + return n ? R.filter((i) => m.has(i) || n === "array" && i === "array") : []; + } + function N(R, n, i) { + const { gen: o, data: c, opts: u } = R, f = o.let("dataType", (0, s._)`typeof ${c}`), g = o.let("coerced", (0, s._)`undefined`); + u.coerceTypes === "array" && o.if((0, s._)`${f} == 'object' && Array.isArray(${c}) && ${c}.length == 1`, () => o.assign(c, (0, s._)`${c}[0]`).assign(f, (0, s._)`typeof ${c}`).if(C(n, c, u.strictNumbers), () => o.assign(g, c))), o.if((0, s._)`${g} !== undefined`); + for (const z of i) + (m.has(z) || z === "array" && u.coerceTypes === "array") && O(z); + o.else(), v(R), o.endIf(), o.if((0, s._)`${g} !== undefined`, () => { + o.assign(c, g), A(R, g); }); - function x(B) { - switch (B) { + function O(z) { + switch (z) { case "string": - o.elseIf((0, s._)`${m} == "number" || ${m} == "boolean"`).assign(f, (0, s._)`"" + ${l}`).elseIf((0, s._)`${l} === null`).assign(f, (0, s._)`""`); + o.elseIf((0, s._)`${f} == "number" || ${f} == "boolean"`).assign(g, (0, s._)`"" + ${c}`).elseIf((0, s._)`${c} === null`).assign(g, (0, s._)`""`); return; case "number": - o.elseIf((0, s._)`${m} == "boolean" || ${l} === null - || (${m} == "string" && ${l} && ${l} == +${l})`).assign(f, (0, s._)`+${l}`); + o.elseIf((0, s._)`${f} == "boolean" || ${c} === null + || (${f} == "string" && ${c} && ${c} == +${c})`).assign(g, (0, s._)`+${c}`); return; case "integer": - o.elseIf((0, s._)`${m} === "boolean" || ${l} === null - || (${m} === "string" && ${l} && ${l} == +${l} && !(${l} % 1))`).assign(f, (0, s._)`+${l}`); + o.elseIf((0, s._)`${f} === "boolean" || ${c} === null + || (${f} === "string" && ${c} && ${c} == +${c} && !(${c} % 1))`).assign(g, (0, s._)`+${c}`); return; case "boolean": - o.elseIf((0, s._)`${l} === "false" || ${l} === 0 || ${l} === null`).assign(f, !1).elseIf((0, s._)`${l} === "true" || ${l} === 1`).assign(f, !0); + o.elseIf((0, s._)`${c} === "false" || ${c} === 0 || ${c} === null`).assign(g, !1).elseIf((0, s._)`${c} === "true" || ${c} === 1`).assign(g, !0); return; case "null": - o.elseIf((0, s._)`${l} === "" || ${l} === 0 || ${l} === false`), o.assign(f, null); + o.elseIf((0, s._)`${c} === "" || ${c} === 0 || ${c} === false`), o.assign(g, null); return; case "array": - o.elseIf((0, s._)`${m} === "string" || ${m} === "number" - || ${m} === "boolean" || ${l} === null`).assign(f, (0, s._)`[${l}]`); + o.elseIf((0, s._)`${f} === "string" || ${f} === "number" + || ${f} === "boolean" || ${c} === null`).assign(g, (0, s._)`[${c}]`); } } } - function A({ gen: I, parentData: r, parentDataProperty: i }, o) { - I.if((0, s._)`${r} !== undefined`, () => I.assign((0, s._)`${r}[${i}]`, o)); + function A({ gen: R, parentData: n, parentDataProperty: i }, o) { + R.if((0, s._)`${n} !== undefined`, () => R.assign((0, s._)`${n}[${i}]`, o)); } - function N(I, r, i, o = p.Correct) { - const l = o === p.Correct ? s.operators.EQ : s.operators.NEQ; + function j(R, n, i, o = d.Correct) { + const c = o === d.Correct ? s.operators.EQ : s.operators.NEQ; let u; - switch (I) { + switch (R) { case "null": - return (0, s._)`${r} ${l} null`; + return (0, s._)`${n} ${c} null`; case "array": - u = (0, s._)`Array.isArray(${r})`; + u = (0, s._)`Array.isArray(${n})`; break; case "object": - u = (0, s._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`; + u = (0, s._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`; break; case "integer": - u = m((0, s._)`!(${r} % 1) && !isNaN(${r})`); + u = f((0, s._)`!(${n} % 1) && !isNaN(${n})`); break; case "number": - u = m(); + u = f(); break; default: - return (0, s._)`typeof ${r} ${l} ${I}`; + return (0, s._)`typeof ${n} ${c} ${R}`; } - return o === p.Correct ? u : (0, s.not)(u); - function m(f = s.nil) { - return (0, s.and)((0, s._)`typeof ${r} == "number"`, f, i ? (0, s._)`isFinite(${r})` : s.nil); + return o === d.Correct ? u : (0, s.not)(u); + function f(g = s.nil) { + return (0, s.and)((0, s._)`typeof ${n} == "number"`, g, i ? (0, s._)`isFinite(${n})` : s.nil); } } - e.checkDataType = N; - function C(I, r, i, o) { - if (I.length === 1) - return N(I[0], r, i, o); - let l; - const u = (0, c.toHash)(I); + e.checkDataType = j; + function C(R, n, i, o) { + if (R.length === 1) + return j(R[0], n, i, o); + let c; + const u = (0, l.toHash)(R); if (u.array && u.object) { - const m = (0, s._)`typeof ${r} != "object"`; - l = u.null ? m : (0, s._)`!${r} || ${m}`, delete u.null, delete u.array, delete u.object; + const f = (0, s._)`typeof ${n} != "object"`; + c = u.null ? f : (0, s._)`!${n} || ${f}`, delete u.null, delete u.array, delete u.object; } else - l = s.nil; + c = s.nil; u.number && delete u.integer; - for (const m in u) - l = (0, s.and)(l, N(m, r, i, o)); - return l; + for (const f in u) + c = (0, s.and)(c, j(f, n, i, o)); + return c; } e.checkDataTypes = C; - const T = { - message: ({ schema: I }) => `must be ${I}`, - params: ({ schema: I, schemaValue: r }) => typeof I == "string" ? (0, s._)`{type: ${I}}` : (0, s._)`{type: ${r}}` + const x = { + message: ({ schema: R }) => `must be ${R}`, + params: ({ schema: R, schemaValue: n }) => typeof R == "string" ? (0, s._)`{type: ${R}}` : (0, s._)`{type: ${n}}` }; - function v(I) { - const r = j(I); - (0, n.reportError)(r, T); + function v(R) { + const n = T(R); + (0, a.reportError)(n, x); } e.reportTypeError = v; - function j(I) { - const { gen: r, data: i, schema: o } = I, l = (0, c.schemaRefOrVal)(I, o, "type"); + function T(R) { + const { gen: n, data: i, schema: o } = R, c = (0, l.schemaRefOrVal)(R, o, "type"); return { - gen: r, + gen: n, keyword: "type", data: i, schema: o.type, - schemaCode: l, - schemaValue: l, + schemaCode: c, + schemaValue: c, parentSchema: o, params: {}, - it: I + it: R }; } -})(Wa); -var Fn = {}; -Object.defineProperty(Fn, "__esModule", { value: !0 }); -Fn.assignDefaults = void 0; -const Gr = we, Qu = $e; -function Xu(e, t) { - const { properties: a, items: n } = e.schema; - if (t === "object" && a) - for (const s in a) - yi(e, s, a[s].default); +})(yr); +var Zr = {}; +Object.defineProperty(Zr, "__esModule", { value: !0 }); +Zr.assignDefaults = void 0; +const Bt = ie, Ms = ce; +function Ds(e, t) { + const { properties: r, items: a } = e.schema; + if (t === "object" && r) + for (const s in r) + wn(e, s, r[s].default); else - t === "array" && Array.isArray(n) && n.forEach((s, c) => yi(e, c, s.default)); + t === "array" && Array.isArray(a) && a.forEach((s, l) => wn(e, l, s.default)); } -Fn.assignDefaults = Xu; -function yi(e, t, a) { - const { gen: n, compositeRule: s, data: c, opts: p } = e; - if (a === void 0) +Zr.assignDefaults = Ds; +function wn(e, t, r) { + const { gen: a, compositeRule: s, data: l, opts: d } = e; + if (r === void 0) return; - const b = (0, Gr._)`${c}${(0, Gr.getProperty)(t)}`; + const b = (0, Bt._)`${l}${(0, Bt.getProperty)(t)}`; if (s) { - (0, Qu.checkStrictMode)(e, `default is ignored for: ${b}`); + (0, Ms.checkStrictMode)(e, `default is ignored for: ${b}`); return; } - let _ = (0, Gr._)`${b} === undefined`; - p.useDefaults === "empty" && (_ = (0, Gr._)`${_} || ${b} === null || ${b} === ""`), n.if(_, (0, Gr._)`${b} = ${(0, Gr.stringify)(a)}`); -} -var sr = {}, be = {}; -Object.defineProperty(be, "__esModule", { value: !0 }); -be.validateUnion = be.validateArray = be.usePattern = be.callValidateCode = be.schemaProperties = be.allSchemaProperties = be.noPropertyInData = be.propertyInData = be.isOwnProperty = be.hasPropFunc = be.reportMissingProp = be.checkMissingProp = be.checkReportMissingProp = void 0; -const Ae = we, zo = $e, _r = cr, ed = $e; -function td(e, t) { - const { gen: a, data: n, it: s } = e; - a.if(Vo(a, n, t, s.opts.ownProperties), () => { - e.setParams({ missingProperty: (0, Ae._)`${t}` }, !0), e.error(); + let _ = (0, Bt._)`${b} === undefined`; + d.useDefaults === "empty" && (_ = (0, Bt._)`${_} || ${b} === null || ${b} === ""`), a.if(_, (0, Bt._)`${b} = ${(0, Bt.stringify)(r)}`); +} +var lt = {}, se = {}; +Object.defineProperty(se, "__esModule", { value: !0 }); +se.validateUnion = se.validateArray = se.usePattern = se.callValidateCode = se.schemaProperties = se.allSchemaProperties = se.noPropertyInData = se.propertyInData = se.isOwnProperty = se.hasPropFunc = se.reportMissingProp = se.checkMissingProp = se.checkReportMissingProp = void 0; +const _e = ie, ba = ce, mt = ct, Bs = ce; +function zs(e, t) { + const { gen: r, data: a, it: s } = e; + r.if(_a(r, a, t, s.opts.ownProperties), () => { + e.setParams({ missingProperty: (0, _e._)`${t}` }, !0), e.error(); }); } -be.checkReportMissingProp = td; -function rd({ gen: e, data: t, it: { opts: a } }, n, s) { - return (0, Ae.or)(...n.map((c) => (0, Ae.and)(Vo(e, t, c, a.ownProperties), (0, Ae._)`${s} = ${c}`))); +se.checkReportMissingProp = zs; +function Vs({ gen: e, data: t, it: { opts: r } }, a, s) { + return (0, _e.or)(...a.map((l) => (0, _e.and)(_a(e, t, l, r.ownProperties), (0, _e._)`${s} = ${l}`))); } -be.checkMissingProp = rd; -function ad(e, t) { +se.checkMissingProp = Vs; +function Fs(e, t) { e.setParams({ missingProperty: t }, !0), e.error(); } -be.reportMissingProp = ad; -function Bc(e) { +se.reportMissingProp = Fs; +function uo(e) { return e.scopeValue("func", { // eslint-disable-next-line @typescript-eslint/unbound-method ref: Object.prototype.hasOwnProperty, - code: (0, Ae._)`Object.prototype.hasOwnProperty` + code: (0, _e._)`Object.prototype.hasOwnProperty` }); } -be.hasPropFunc = Bc; -function Bo(e, t, a) { - return (0, Ae._)`${Bc(e)}.call(${t}, ${a})`; +se.hasPropFunc = uo; +function ya(e, t, r) { + return (0, _e._)`${uo(e)}.call(${t}, ${r})`; } -be.isOwnProperty = Bo; -function nd(e, t, a, n) { - const s = (0, Ae._)`${t}${(0, Ae.getProperty)(a)} !== undefined`; - return n ? (0, Ae._)`${s} && ${Bo(e, t, a)}` : s; +se.isOwnProperty = ya; +function qs(e, t, r, a) { + const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} !== undefined`; + return a ? (0, _e._)`${s} && ${ya(e, t, r)}` : s; } -be.propertyInData = nd; -function Vo(e, t, a, n) { - const s = (0, Ae._)`${t}${(0, Ae.getProperty)(a)} === undefined`; - return n ? (0, Ae.or)(s, (0, Ae.not)(Bo(e, t, a))) : s; +se.propertyInData = qs; +function _a(e, t, r, a) { + const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} === undefined`; + return a ? (0, _e.or)(s, (0, _e.not)(ya(e, t, r))) : s; } -be.noPropertyInData = Vo; -function Vc(e) { +se.noPropertyInData = _a; +function ho(e) { return e ? Object.keys(e).filter((t) => t !== "__proto__") : []; } -be.allSchemaProperties = Vc; -function od(e, t) { - return Vc(t).filter((a) => !(0, zo.alwaysValidSchema)(e, t[a])); -} -be.schemaProperties = od; -function sd({ schemaCode: e, data: t, it: { gen: a, topSchemaRef: n, schemaPath: s, errorPath: c }, it: p }, b, _, y) { - const g = y ? (0, Ae._)`${e}, ${t}, ${n}${s}` : t, S = [ - [_r.default.instancePath, (0, Ae.strConcat)(_r.default.instancePath, c)], - [_r.default.parentData, p.parentData], - [_r.default.parentDataProperty, p.parentDataProperty], - [_r.default.rootData, _r.default.rootData] +se.allSchemaProperties = ho; +function Us(e, t) { + return ho(t).filter((r) => !(0, ba.alwaysValidSchema)(e, t[r])); +} +se.schemaProperties = Us; +function Gs({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: a, schemaPath: s, errorPath: l }, it: d }, b, _, y) { + const m = y ? (0, _e._)`${e}, ${t}, ${a}${s}` : t, k = [ + [mt.default.instancePath, (0, _e.strConcat)(mt.default.instancePath, l)], + [mt.default.parentData, d.parentData], + [mt.default.parentDataProperty, d.parentDataProperty], + [mt.default.rootData, mt.default.rootData] ]; - p.opts.dynamicRef && S.push([_r.default.dynamicAnchors, _r.default.dynamicAnchors]); - const L = (0, Ae._)`${g}, ${a.object(...S)}`; - return _ !== Ae.nil ? (0, Ae._)`${b}.call(${_}, ${L})` : (0, Ae._)`${b}(${L})`; -} -be.callValidateCode = sd; -const id = (0, Ae._)`new RegExp`; -function cd({ gen: e, it: { opts: t } }, a) { - const n = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, c = s(a, n); + d.opts.dynamicRef && k.push([mt.default.dynamicAnchors, mt.default.dynamicAnchors]); + const N = (0, _e._)`${m}, ${r.object(...k)}`; + return _ !== _e.nil ? (0, _e._)`${b}.call(${_}, ${N})` : (0, _e._)`${b}(${N})`; +} +se.callValidateCode = Gs; +const Hs = (0, _e._)`new RegExp`; +function Ks({ gen: e, it: { opts: t } }, r) { + const a = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, l = s(r, a); return e.scopeValue("pattern", { - key: c.toString(), - ref: c, - code: (0, Ae._)`${s.code === "new RegExp" ? id : (0, ed.useFunc)(e, s)}(${a}, ${n})` + key: l.toString(), + ref: l, + code: (0, _e._)`${s.code === "new RegExp" ? Hs : (0, Bs.useFunc)(e, s)}(${r}, ${a})` }); } -be.usePattern = cd; -function ld(e) { - const { gen: t, data: a, keyword: n, it: s } = e, c = t.name("valid"); +se.usePattern = Ks; +function Ws(e) { + const { gen: t, data: r, keyword: a, it: s } = e, l = t.name("valid"); if (s.allErrors) { const b = t.let("valid", !0); - return p(() => t.assign(b, !1)), b; + return d(() => t.assign(b, !1)), b; } - return t.var(c, !0), p(() => t.break()), c; - function p(b) { - const _ = t.const("len", (0, Ae._)`${a}.length`); + return t.var(l, !0), d(() => t.break()), l; + function d(b) { + const _ = t.const("len", (0, _e._)`${r}.length`); t.forRange("i", 0, _, (y) => { e.subschema({ - keyword: n, + keyword: a, dataProp: y, - dataPropType: zo.Type.Num - }, c), t.if((0, Ae.not)(c), b); + dataPropType: ba.Type.Num + }, l), t.if((0, _e.not)(l), b); }); } } -be.validateArray = ld; -function ud(e) { - const { gen: t, schema: a, keyword: n, it: s } = e; - if (!Array.isArray(a)) +se.validateArray = Ws; +function Js(e) { + const { gen: t, schema: r, keyword: a, it: s } = e; + if (!Array.isArray(r)) throw new Error("ajv implementation error"); - if (a.some((b) => (0, zo.alwaysValidSchema)(s, b)) && !s.opts.unevaluated) + if (r.some((b) => (0, ba.alwaysValidSchema)(s, b)) && !s.opts.unevaluated) return; - const c = t.let("valid", !1), p = t.name("_valid"); - t.block(() => a.forEach((b, _) => { + const l = t.let("valid", !1), d = t.name("_valid"); + t.block(() => r.forEach((b, _) => { const y = e.subschema({ - keyword: n, + keyword: a, schemaProp: _, compositeRule: !0 - }, p); - t.assign(c, (0, Ae._)`${c} || ${p}`), e.mergeValidEvaluated(y, p) || t.if((0, Ae.not)(c)); - })), e.result(c, () => e.reset(), () => e.error(!0)); -} -be.validateUnion = ud; -Object.defineProperty(sr, "__esModule", { value: !0 }); -sr.validateKeywordUsage = sr.validSchemaType = sr.funcKeywordCode = sr.macroKeywordCode = void 0; -const ut = we, Ar = cr, dd = be, hd = Ka; -function pd(e, t) { - const { gen: a, keyword: n, schema: s, parentSchema: c, it: p } = e, b = t.macro.call(p.self, s, c, p), _ = Fc(a, n, b); - p.opts.validateSchema !== !1 && p.self.validateSchema(b, !0); - const y = a.name("valid"); + }, d); + t.assign(l, (0, _e._)`${l} || ${d}`), e.mergeValidEvaluated(y, d) || t.if((0, _e.not)(l)); + })), e.result(l, () => e.reset(), () => e.error(!0)); +} +se.validateUnion = Js; +Object.defineProperty(lt, "__esModule", { value: !0 }); +lt.validateKeywordUsage = lt.validSchemaType = lt.funcKeywordCode = lt.macroKeywordCode = void 0; +const Ne = ie, Ct = ct, Zs = se, Ys = br; +function Qs(e, t) { + const { gen: r, keyword: a, schema: s, parentSchema: l, it: d } = e, b = t.macro.call(d.self, s, l, d), _ = po(r, a, b); + d.opts.validateSchema !== !1 && d.self.validateSchema(b, !0); + const y = r.name("valid"); e.subschema({ schema: b, - schemaPath: ut.nil, - errSchemaPath: `${p.errSchemaPath}/${n}`, + schemaPath: Ne.nil, + errSchemaPath: `${d.errSchemaPath}/${a}`, topSchemaRef: _, compositeRule: !0 }, y), e.pass(y, () => e.error(!0)); } -sr.macroKeywordCode = pd; -function fd(e, t) { - var a; - const { gen: n, keyword: s, schema: c, parentSchema: p, $data: b, it: _ } = e; - gd(_, t); - const y = !b && t.compile ? t.compile.call(_.self, c, p, _) : t.validate, g = Fc(n, s, y), S = n.let("valid"); - e.block$data(S, L), e.ok((a = t.valid) !== null && a !== void 0 ? a : S); - function L() { +lt.macroKeywordCode = Qs; +function Xs(e, t) { + var r; + const { gen: a, keyword: s, schema: l, parentSchema: d, $data: b, it: _ } = e; + ti(_, t); + const y = !b && t.compile ? t.compile.call(_.self, l, d, _) : t.validate, m = po(a, s, y), k = a.let("valid"); + e.block$data(k, N), e.ok((r = t.valid) !== null && r !== void 0 ? r : k); + function N() { if (t.errors === !1) - C(), t.modifying && bi(e), T(() => e.error()); + C(), t.modifying && vn(e), x(() => e.error()); else { - const v = t.async ? A() : N(); - t.modifying && bi(e), T(() => md(e, v)); + const v = t.async ? A() : j(); + t.modifying && vn(e), x(() => ei(e, v)); } } function A() { - const v = n.let("ruleErrs", null); - return n.try(() => C((0, ut._)`await `), (j) => n.assign(S, !1).if((0, ut._)`${j} instanceof ${_.ValidationError}`, () => n.assign(v, (0, ut._)`${j}.errors`), () => n.throw(j))), v; + const v = a.let("ruleErrs", null); + return a.try(() => C((0, Ne._)`await `), (T) => a.assign(k, !1).if((0, Ne._)`${T} instanceof ${_.ValidationError}`, () => a.assign(v, (0, Ne._)`${T}.errors`), () => a.throw(T))), v; } - function N() { - const v = (0, ut._)`${g}.errors`; - return n.assign(v, null), C(ut.nil), v; + function j() { + const v = (0, Ne._)`${m}.errors`; + return a.assign(v, null), C(Ne.nil), v; } - function C(v = t.async ? (0, ut._)`await ` : ut.nil) { - const j = _.opts.passContext ? Ar.default.this : Ar.default.self, I = !("compile" in t && !b || t.schema === !1); - n.assign(S, (0, ut._)`${v}${(0, dd.callValidateCode)(e, g, j, I)}`, t.modifying); + function C(v = t.async ? (0, Ne._)`await ` : Ne.nil) { + const T = _.opts.passContext ? Ct.default.this : Ct.default.self, R = !("compile" in t && !b || t.schema === !1); + a.assign(k, (0, Ne._)`${v}${(0, Zs.callValidateCode)(e, m, T, R)}`, t.modifying); } - function T(v) { - var j; - n.if((0, ut.not)((j = t.valid) !== null && j !== void 0 ? j : S), v); + function x(v) { + var T; + a.if((0, Ne.not)((T = t.valid) !== null && T !== void 0 ? T : k), v); } } -sr.funcKeywordCode = fd; -function bi(e) { - const { gen: t, data: a, it: n } = e; - t.if(n.parentData, () => t.assign(a, (0, ut._)`${n.parentData}[${n.parentDataProperty}]`)); +lt.funcKeywordCode = Xs; +function vn(e) { + const { gen: t, data: r, it: a } = e; + t.if(a.parentData, () => t.assign(r, (0, Ne._)`${a.parentData}[${a.parentDataProperty}]`)); } -function md(e, t) { - const { gen: a } = e; - a.if((0, ut._)`Array.isArray(${t})`, () => { - a.assign(Ar.default.vErrors, (0, ut._)`${Ar.default.vErrors} === null ? ${t} : ${Ar.default.vErrors}.concat(${t})`).assign(Ar.default.errors, (0, ut._)`${Ar.default.vErrors}.length`), (0, hd.extendErrors)(e); +function ei(e, t) { + const { gen: r } = e; + r.if((0, Ne._)`Array.isArray(${t})`, () => { + r.assign(Ct.default.vErrors, (0, Ne._)`${Ct.default.vErrors} === null ? ${t} : ${Ct.default.vErrors}.concat(${t})`).assign(Ct.default.errors, (0, Ne._)`${Ct.default.vErrors}.length`), (0, Ys.extendErrors)(e); }, () => e.error()); } -function gd({ schemaEnv: e }, t) { +function ti({ schemaEnv: e }, t) { if (t.async && !e.$async) throw new Error("async keyword in sync schema"); } -function Fc(e, t, a) { - if (a === void 0) +function po(e, t, r) { + if (r === void 0) throw new Error(`keyword "${t}" failed to compile`); - return e.scopeValue("keyword", typeof a == "function" ? { ref: a } : { ref: a, code: (0, ut.stringify)(a) }); + return e.scopeValue("keyword", typeof r == "function" ? { ref: r } : { ref: r, code: (0, Ne.stringify)(r) }); } -function yd(e, t, a = !1) { - return !t.length || t.some((n) => n === "array" ? Array.isArray(e) : n === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == n || a && typeof e > "u"); +function ri(e, t, r = !1) { + return !t.length || t.some((a) => a === "array" ? Array.isArray(e) : a === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == a || r && typeof e > "u"); } -sr.validSchemaType = yd; -function bd({ schema: e, opts: t, self: a, errSchemaPath: n }, s, c) { - if (Array.isArray(s.keyword) ? !s.keyword.includes(c) : s.keyword !== c) +lt.validSchemaType = ri; +function ai({ schema: e, opts: t, self: r, errSchemaPath: a }, s, l) { + if (Array.isArray(s.keyword) ? !s.keyword.includes(l) : s.keyword !== l) throw new Error("ajv implementation error"); - const p = s.dependencies; - if (p != null && p.some((b) => !Object.prototype.hasOwnProperty.call(e, b))) - throw new Error(`parent schema must have dependencies of ${c}: ${p.join(",")}`); - if (s.validateSchema && !s.validateSchema(e[c])) { - const b = `keyword "${c}" value is invalid at path "${n}": ` + a.errorsText(s.validateSchema.errors); + const d = s.dependencies; + if (d != null && d.some((b) => !Object.prototype.hasOwnProperty.call(e, b))) + throw new Error(`parent schema must have dependencies of ${l}: ${d.join(",")}`); + if (s.validateSchema && !s.validateSchema(e[l])) { + const b = `keyword "${l}" value is invalid at path "${a}": ` + r.errorsText(s.validateSchema.errors); if (t.validateSchema === "log") - a.logger.error(b); + r.logger.error(b); else throw new Error(b); } } -sr.validateKeywordUsage = bd; -var Tr = {}; -Object.defineProperty(Tr, "__esModule", { value: !0 }); -Tr.extendSubschemaMode = Tr.extendSubschemaData = Tr.getSubschema = void 0; -const nr = we, Uc = $e; -function _d(e, { keyword: t, schemaProp: a, schema: n, schemaPath: s, errSchemaPath: c, topSchemaRef: p }) { - if (t !== void 0 && n !== void 0) +lt.validateKeywordUsage = ai; +var _t = {}; +Object.defineProperty(_t, "__esModule", { value: !0 }); +_t.extendSubschemaMode = _t.extendSubschemaData = _t.getSubschema = void 0; +const it = ie, fo = ce; +function ni(e, { keyword: t, schemaProp: r, schema: a, schemaPath: s, errSchemaPath: l, topSchemaRef: d }) { + if (t !== void 0 && a !== void 0) throw new Error('both "keyword" and "schema" passed, only one allowed'); if (t !== void 0) { const b = e.schema[t]; - return a === void 0 ? { + return r === void 0 ? { schema: b, - schemaPath: (0, nr._)`${e.schemaPath}${(0, nr.getProperty)(t)}`, + schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}`, errSchemaPath: `${e.errSchemaPath}/${t}` } : { - schema: b[a], - schemaPath: (0, nr._)`${e.schemaPath}${(0, nr.getProperty)(t)}${(0, nr.getProperty)(a)}`, - errSchemaPath: `${e.errSchemaPath}/${t}/${(0, Uc.escapeFragment)(a)}` + schema: b[r], + schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}${(0, it.getProperty)(r)}`, + errSchemaPath: `${e.errSchemaPath}/${t}/${(0, fo.escapeFragment)(r)}` }; } - if (n !== void 0) { - if (s === void 0 || c === void 0 || p === void 0) + if (a !== void 0) { + if (s === void 0 || l === void 0 || d === void 0) throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); return { - schema: n, + schema: a, schemaPath: s, - topSchemaRef: p, - errSchemaPath: c + topSchemaRef: d, + errSchemaPath: l }; } throw new Error('either "keyword" or "schema" must be passed'); } -Tr.getSubschema = _d; -function wd(e, t, { dataProp: a, dataPropType: n, data: s, dataTypes: c, propertyName: p }) { - if (s !== void 0 && a !== void 0) +_t.getSubschema = ni; +function oi(e, t, { dataProp: r, dataPropType: a, data: s, dataTypes: l, propertyName: d }) { + if (s !== void 0 && r !== void 0) throw new Error('both "data" and "dataProp" passed, only one allowed'); const { gen: b } = t; - if (a !== void 0) { - const { errorPath: y, dataPathArr: g, opts: S } = t, L = b.let("data", (0, nr._)`${t.data}${(0, nr.getProperty)(a)}`, !0); - _(L), e.errorPath = (0, nr.str)`${y}${(0, Uc.getErrorPath)(a, n, S.jsPropertySyntax)}`, e.parentDataProperty = (0, nr._)`${a}`, e.dataPathArr = [...g, e.parentDataProperty]; + if (r !== void 0) { + const { errorPath: y, dataPathArr: m, opts: k } = t, N = b.let("data", (0, it._)`${t.data}${(0, it.getProperty)(r)}`, !0); + _(N), e.errorPath = (0, it.str)`${y}${(0, fo.getErrorPath)(r, a, k.jsPropertySyntax)}`, e.parentDataProperty = (0, it._)`${r}`, e.dataPathArr = [...m, e.parentDataProperty]; } if (s !== void 0) { - const y = s instanceof nr.Name ? s : b.let("data", s, !0); - _(y), p !== void 0 && (e.propertyName = p); + const y = s instanceof it.Name ? s : b.let("data", s, !0); + _(y), d !== void 0 && (e.propertyName = d); } - c && (e.dataTypes = c); + l && (e.dataTypes = l); function _(y) { e.data = y, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, y]; } } -Tr.extendSubschemaData = wd; -function vd(e, { jtdDiscriminator: t, jtdMetadata: a, compositeRule: n, createErrors: s, allErrors: c }) { - n !== void 0 && (e.compositeRule = n), s !== void 0 && (e.createErrors = s), c !== void 0 && (e.allErrors = c), e.jtdDiscriminator = t, e.jtdMetadata = a; +_t.extendSubschemaData = oi; +function si(e, { jtdDiscriminator: t, jtdMetadata: r, compositeRule: a, createErrors: s, allErrors: l }) { + a !== void 0 && (e.compositeRule = a), s !== void 0 && (e.createErrors = s), l !== void 0 && (e.allErrors = l), e.jtdDiscriminator = t, e.jtdMetadata = r; } -Tr.extendSubschemaMode = vd; -var tt = {}, qc = function e(t, a) { - if (t === a) +_t.extendSubschemaMode = si; +var xe = {}, mo = function e(t, r) { + if (t === r) return !0; - if (t && a && typeof t == "object" && typeof a == "object") { - if (t.constructor !== a.constructor) + if (t && r && typeof t == "object" && typeof r == "object") { + if (t.constructor !== r.constructor) return !1; - var n, s, c; + var a, s, l; if (Array.isArray(t)) { - if (n = t.length, n != a.length) + if (a = t.length, a != r.length) return !1; - for (s = n; s-- !== 0; ) - if (!e(t[s], a[s])) + for (s = a; s-- !== 0; ) + if (!e(t[s], r[s])) return !1; return !0; } if (t.constructor === RegExp) - return t.source === a.source && t.flags === a.flags; + return t.source === r.source && t.flags === r.flags; if (t.valueOf !== Object.prototype.valueOf) - return t.valueOf() === a.valueOf(); + return t.valueOf() === r.valueOf(); if (t.toString !== Object.prototype.toString) - return t.toString() === a.toString(); - if (c = Object.keys(t), n = c.length, n !== Object.keys(a).length) + return t.toString() === r.toString(); + if (l = Object.keys(t), a = l.length, a !== Object.keys(r).length) return !1; - for (s = n; s-- !== 0; ) - if (!Object.prototype.hasOwnProperty.call(a, c[s])) + for (s = a; s-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(r, l[s])) return !1; - for (s = n; s-- !== 0; ) { - var p = c[s]; - if (!e(t[p], a[p])) + for (s = a; s-- !== 0; ) { + var d = l[s]; + if (!e(t[d], r[d])) return !1; } return !0; } - return t !== t && a !== a; -}, Hc = { exports: {} }, Sr = Hc.exports = function(e, t, a) { - typeof t == "function" && (a = t, t = {}), a = t.cb || a; - var n = typeof a == "function" ? a : a.pre || function() { - }, s = a.post || function() { + return t !== t && r !== r; +}, go = { exports: {} }, yt = go.exports = function(e, t, r) { + typeof t == "function" && (r = t, t = {}), r = t.cb || r; + var a = typeof r == "function" ? r : r.pre || function() { + }, s = r.post || function() { }; - yn(t, n, s, e, "", e); + Ar(t, a, s, e, "", e); }; -Sr.keywords = { +yt.keywords = { additionalItems: !0, items: !0, contains: !0, @@ -1598,20 +1602,20 @@ Sr.keywords = { then: !0, else: !0 }; -Sr.arrayKeywords = { +yt.arrayKeywords = { items: !0, allOf: !0, anyOf: !0, oneOf: !0 }; -Sr.propsKeywords = { +yt.propsKeywords = { $defs: !0, definitions: !0, properties: !0, patternProperties: !0, dependencies: !0 }; -Sr.skipKeywords = { +yt.skipKeywords = { default: !0, enum: !0, const: !0, @@ -1631,32 +1635,32 @@ Sr.skipKeywords = { maxProperties: !0, minProperties: !0 }; -function yn(e, t, a, n, s, c, p, b, _, y) { - if (n && typeof n == "object" && !Array.isArray(n)) { - t(n, s, c, p, b, _, y); - for (var g in n) { - var S = n[g]; - if (Array.isArray(S)) { - if (g in Sr.arrayKeywords) - for (var L = 0; L < S.length; L++) - yn(e, t, a, S[L], s + "/" + g + "/" + L, c, s, g, n, L); - } else if (g in Sr.propsKeywords) { - if (S && typeof S == "object") - for (var A in S) - yn(e, t, a, S[A], s + "/" + g + "/" + $d(A), c, s, g, n, A); +function Ar(e, t, r, a, s, l, d, b, _, y) { + if (a && typeof a == "object" && !Array.isArray(a)) { + t(a, s, l, d, b, _, y); + for (var m in a) { + var k = a[m]; + if (Array.isArray(k)) { + if (m in yt.arrayKeywords) + for (var N = 0; N < k.length; N++) + Ar(e, t, r, k[N], s + "/" + m + "/" + N, l, s, m, a, N); + } else if (m in yt.propsKeywords) { + if (k && typeof k == "object") + for (var A in k) + Ar(e, t, r, k[A], s + "/" + m + "/" + ii(A), l, s, m, a, A); } else - (g in Sr.keywords || e.allKeys && !(g in Sr.skipKeywords)) && yn(e, t, a, S, s + "/" + g, c, s, g, n); + (m in yt.keywords || e.allKeys && !(m in yt.skipKeywords)) && Ar(e, t, r, k, s + "/" + m, l, s, m, a); } - a(n, s, c, p, b, _, y); + r(a, s, l, d, b, _, y); } } -function $d(e) { +function ii(e) { return e.replace(/~/g, "~0").replace(/\//g, "~1"); } -var kd = Hc.exports; -Object.defineProperty(tt, "__esModule", { value: !0 }); -tt.getSchemaRefs = tt.resolveUrl = tt.normalizeId = tt._getFullPath = tt.getFullPath = tt.inlineRef = void 0; -const Ed = $e, Pd = qc, Sd = kd, xd = /* @__PURE__ */ new Set([ +var li = go.exports; +Object.defineProperty(xe, "__esModule", { value: !0 }); +xe.getSchemaRefs = xe.resolveUrl = xe.normalizeId = xe._getFullPath = xe.getFullPath = xe.inlineRef = void 0; +const ci = ce, ui = mo, di = li, hi = /* @__PURE__ */ new Set([ "type", "format", "pattern", @@ -1674,275 +1678,275 @@ const Ed = $e, Pd = qc, Sd = kd, xd = /* @__PURE__ */ new Set([ "enum", "const" ]); -function Td(e, t = !0) { - return typeof e == "boolean" ? !0 : t === !0 ? !ko(e) : t ? Gc(e) <= t : !1; +function pi(e, t = !0) { + return typeof e == "boolean" ? !0 : t === !0 ? !ua(e) : t ? bo(e) <= t : !1; } -tt.inlineRef = Td; -const jd = /* @__PURE__ */ new Set([ +xe.inlineRef = pi; +const fi = /* @__PURE__ */ new Set([ "$ref", "$recursiveRef", "$recursiveAnchor", "$dynamicRef", "$dynamicAnchor" ]); -function ko(e) { +function ua(e) { for (const t in e) { - if (jd.has(t)) + if (fi.has(t)) return !0; - const a = e[t]; - if (Array.isArray(a) && a.some(ko) || typeof a == "object" && ko(a)) + const r = e[t]; + if (Array.isArray(r) && r.some(ua) || typeof r == "object" && ua(r)) return !0; } return !1; } -function Gc(e) { +function bo(e) { let t = 0; - for (const a in e) - if (a === "$ref" || (t++, !xd.has(a) && (typeof e[a] == "object" && (0, Ed.eachItem)(e[a], (n) => t += Gc(n)), t === 1 / 0))) + for (const r in e) + if (r === "$ref" || (t++, !hi.has(r) && (typeof e[r] == "object" && (0, ci.eachItem)(e[r], (a) => t += bo(a)), t === 1 / 0))) return 1 / 0; return t; } -function Kc(e, t = "", a) { - a !== !1 && (t = ta(t)); - const n = e.parse(t); - return Wc(e, n); +function yo(e, t = "", r) { + r !== !1 && (t = qt(t)); + const a = e.parse(t); + return _o(e, a); } -tt.getFullPath = Kc; -function Wc(e, t) { +xe.getFullPath = yo; +function _o(e, t) { return e.serialize(t).split("#")[0] + "#"; } -tt._getFullPath = Wc; -const Cd = /#\/?$/; -function ta(e) { - return e ? e.replace(Cd, "") : ""; +xe._getFullPath = _o; +const mi = /#\/?$/; +function qt(e) { + return e ? e.replace(mi, "") : ""; } -tt.normalizeId = ta; -function Od(e, t, a) { - return a = ta(a), e.resolve(t, a); +xe.normalizeId = qt; +function gi(e, t, r) { + return r = qt(r), e.resolve(t, r); } -tt.resolveUrl = Od; -const Nd = /^[a-z_][-a-z0-9._]*$/i; -function Ld(e, t) { +xe.resolveUrl = gi; +const bi = /^[a-z_][-a-z0-9._]*$/i; +function yi(e, t) { if (typeof e == "boolean") return {}; - const { schemaId: a, uriResolver: n } = this.opts, s = ta(e[a] || t), c = { "": s }, p = Kc(n, s, !1), b = {}, _ = /* @__PURE__ */ new Set(); - return Sd(e, { allKeys: !0 }, (S, L, A, N) => { - if (N === void 0) + const { schemaId: r, uriResolver: a } = this.opts, s = qt(e[r] || t), l = { "": s }, d = yo(a, s, !1), b = {}, _ = /* @__PURE__ */ new Set(); + return di(e, { allKeys: !0 }, (k, N, A, j) => { + if (j === void 0) return; - const C = p + L; - let T = c[N]; - typeof S[a] == "string" && (T = v.call(this, S[a])), j.call(this, S.$anchor), j.call(this, S.$dynamicAnchor), c[L] = T; - function v(I) { - const r = this.opts.uriResolver.resolve; - if (I = ta(T ? r(T, I) : I), _.has(I)) - throw g(I); - _.add(I); - let i = this.refs[I]; - return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(S, i.schema, I) : I !== ta(C) && (I[0] === "#" ? (y(S, b[I], I), b[I] = S) : this.refs[I] = C), I; - } - function j(I) { - if (typeof I == "string") { - if (!Nd.test(I)) - throw new Error(`invalid anchor "${I}"`); - v.call(this, `#${I}`); + const C = d + N; + let x = l[j]; + typeof k[r] == "string" && (x = v.call(this, k[r])), T.call(this, k.$anchor), T.call(this, k.$dynamicAnchor), l[N] = x; + function v(R) { + const n = this.opts.uriResolver.resolve; + if (R = qt(x ? n(x, R) : R), _.has(R)) + throw m(R); + _.add(R); + let i = this.refs[R]; + return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(k, i.schema, R) : R !== qt(C) && (R[0] === "#" ? (y(k, b[R], R), b[R] = k) : this.refs[R] = C), R; + } + function T(R) { + if (typeof R == "string") { + if (!bi.test(R)) + throw new Error(`invalid anchor "${R}"`); + v.call(this, `#${R}`); } } }), b; - function y(S, L, A) { - if (L !== void 0 && !Pd(S, L)) - throw g(A); + function y(k, N, A) { + if (N !== void 0 && !ui(k, N)) + throw m(A); } - function g(S) { - return new Error(`reference "${S}" resolves to more than one schema`); + function m(k) { + return new Error(`reference "${k}" resolves to more than one schema`); } } -tt.getSchemaRefs = Ld; -Object.defineProperty(er, "__esModule", { value: !0 }); -er.getData = er.KeywordCxt = er.validateFunctionCode = void 0; -const Jc = sa, _i = Wa, Fo = mr, xn = Wa, Rd = Fn, La = sr, co = Tr, ae = we, le = cr, Id = tt, gr = $e, Pa = Ka; -function Ad(e) { - if (Qc(e) && (Xc(e), Yc(e))) { - zd(e); +xe.getSchemaRefs = yi; +Object.defineProperty(rt, "__esModule", { value: !0 }); +rt.getData = rt.KeywordCxt = rt.validateFunctionCode = void 0; +const wo = Ht, kn = yr, wa = pt, zr = yr, _i = Zr, cr = lt, ra = _t, Z = ie, X = ct, wi = xe, ft = ce, nr = br; +function vi(e) { + if (Eo(e) && ($o(e), ko(e))) { + $i(e); return; } - Zc(e, () => (0, Jc.topBoolOrEmptySchema)(e)); + vo(e, () => (0, wo.topBoolOrEmptySchema)(e)); } -er.validateFunctionCode = Ad; -function Zc({ gen: e, validateName: t, schema: a, schemaEnv: n, opts: s }, c) { - s.code.es5 ? e.func(t, (0, ae._)`${le.default.data}, ${le.default.valCxt}`, n.$async, () => { - e.code((0, ae._)`"use strict"; ${wi(a, s)}`), Dd(e, s), e.code(c); - }) : e.func(t, (0, ae._)`${le.default.data}, ${Md(s)}`, n.$async, () => e.code(wi(a, s)).code(c)); +rt.validateFunctionCode = vi; +function vo({ gen: e, validateName: t, schema: r, schemaEnv: a, opts: s }, l) { + s.code.es5 ? e.func(t, (0, Z._)`${X.default.data}, ${X.default.valCxt}`, a.$async, () => { + e.code((0, Z._)`"use strict"; ${En(r, s)}`), Ei(e, s), e.code(l); + }) : e.func(t, (0, Z._)`${X.default.data}, ${ki(s)}`, a.$async, () => e.code(En(r, s)).code(l)); } -function Md(e) { - return (0, ae._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${e.dynamicRef ? (0, ae._)`, ${le.default.dynamicAnchors}={}` : ae.nil}}={}`; +function ki(e) { + return (0, Z._)`{${X.default.instancePath}="", ${X.default.parentData}, ${X.default.parentDataProperty}, ${X.default.rootData}=${X.default.data}${e.dynamicRef ? (0, Z._)`, ${X.default.dynamicAnchors}={}` : Z.nil}}={}`; } -function Dd(e, t) { - e.if(le.default.valCxt, () => { - e.var(le.default.instancePath, (0, ae._)`${le.default.valCxt}.${le.default.instancePath}`), e.var(le.default.parentData, (0, ae._)`${le.default.valCxt}.${le.default.parentData}`), e.var(le.default.parentDataProperty, (0, ae._)`${le.default.valCxt}.${le.default.parentDataProperty}`), e.var(le.default.rootData, (0, ae._)`${le.default.valCxt}.${le.default.rootData}`), t.dynamicRef && e.var(le.default.dynamicAnchors, (0, ae._)`${le.default.valCxt}.${le.default.dynamicAnchors}`); +function Ei(e, t) { + e.if(X.default.valCxt, () => { + e.var(X.default.instancePath, (0, Z._)`${X.default.valCxt}.${X.default.instancePath}`), e.var(X.default.parentData, (0, Z._)`${X.default.valCxt}.${X.default.parentData}`), e.var(X.default.parentDataProperty, (0, Z._)`${X.default.valCxt}.${X.default.parentDataProperty}`), e.var(X.default.rootData, (0, Z._)`${X.default.valCxt}.${X.default.rootData}`), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`${X.default.valCxt}.${X.default.dynamicAnchors}`); }, () => { - e.var(le.default.instancePath, (0, ae._)`""`), e.var(le.default.parentData, (0, ae._)`undefined`), e.var(le.default.parentDataProperty, (0, ae._)`undefined`), e.var(le.default.rootData, le.default.data), t.dynamicRef && e.var(le.default.dynamicAnchors, (0, ae._)`{}`); + e.var(X.default.instancePath, (0, Z._)`""`), e.var(X.default.parentData, (0, Z._)`undefined`), e.var(X.default.parentDataProperty, (0, Z._)`undefined`), e.var(X.default.rootData, X.default.data), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`{}`); }); } -function zd(e) { - const { schema: t, opts: a, gen: n } = e; - Zc(e, () => { - a.$comment && t.$comment && tl(e), qd(e), n.let(le.default.vErrors, null), n.let(le.default.errors, 0), a.unevaluated && Bd(e), el(e), Kd(e); +function $i(e) { + const { schema: t, opts: r, gen: a } = e; + vo(e, () => { + r.$comment && t.$comment && So(e), xi(e), a.let(X.default.vErrors, null), a.let(X.default.errors, 0), r.unevaluated && Pi(e), Po(e), ji(e); }); } -function Bd(e) { - const { gen: t, validateName: a } = e; - e.evaluated = t.const("evaluated", (0, ae._)`${a}.evaluated`), t.if((0, ae._)`${e.evaluated}.dynamicProps`, () => t.assign((0, ae._)`${e.evaluated}.props`, (0, ae._)`undefined`)), t.if((0, ae._)`${e.evaluated}.dynamicItems`, () => t.assign((0, ae._)`${e.evaluated}.items`, (0, ae._)`undefined`)); +function Pi(e) { + const { gen: t, validateName: r } = e; + e.evaluated = t.const("evaluated", (0, Z._)`${r}.evaluated`), t.if((0, Z._)`${e.evaluated}.dynamicProps`, () => t.assign((0, Z._)`${e.evaluated}.props`, (0, Z._)`undefined`)), t.if((0, Z._)`${e.evaluated}.dynamicItems`, () => t.assign((0, Z._)`${e.evaluated}.items`, (0, Z._)`undefined`)); } -function wi(e, t) { - const a = typeof e == "object" && e[t.schemaId]; - return a && (t.code.source || t.code.process) ? (0, ae._)`/*# sourceURL=${a} */` : ae.nil; +function En(e, t) { + const r = typeof e == "object" && e[t.schemaId]; + return r && (t.code.source || t.code.process) ? (0, Z._)`/*# sourceURL=${r} */` : Z.nil; } -function Vd(e, t) { - if (Qc(e) && (Xc(e), Yc(e))) { - Fd(e, t); +function Si(e, t) { + if (Eo(e) && ($o(e), ko(e))) { + Ti(e, t); return; } - (0, Jc.boolOrEmptySchema)(e, t); + (0, wo.boolOrEmptySchema)(e, t); } -function Yc({ schema: e, self: t }) { +function ko({ schema: e, self: t }) { if (typeof e == "boolean") return !e; - for (const a in e) - if (t.RULES.all[a]) + for (const r in e) + if (t.RULES.all[r]) return !0; return !1; } -function Qc(e) { +function Eo(e) { return typeof e.schema != "boolean"; } -function Fd(e, t) { - const { schema: a, gen: n, opts: s } = e; - s.$comment && a.$comment && tl(e), Hd(e), Gd(e); - const c = n.const("_errs", le.default.errors); - el(e, c), n.var(t, (0, ae._)`${c} === ${le.default.errors}`); +function Ti(e, t) { + const { schema: r, gen: a, opts: s } = e; + s.$comment && r.$comment && So(e), Oi(e), Ni(e); + const l = a.const("_errs", X.default.errors); + Po(e, l), a.var(t, (0, Z._)`${l} === ${X.default.errors}`); } -function Xc(e) { - (0, gr.checkUnknownRules)(e), Ud(e); +function $o(e) { + (0, ft.checkUnknownRules)(e), Ci(e); } -function el(e, t) { +function Po(e, t) { if (e.opts.jtd) - return vi(e, [], !1, t); - const a = (0, _i.getSchemaTypes)(e.schema), n = (0, _i.coerceAndCheckDataType)(e, a); - vi(e, a, !n, t); + return $n(e, [], !1, t); + const r = (0, kn.getSchemaTypes)(e.schema), a = (0, kn.coerceAndCheckDataType)(e, r); + $n(e, r, !a, t); } -function Ud(e) { - const { schema: t, errSchemaPath: a, opts: n, self: s } = e; - t.$ref && n.ignoreKeywordsWithRef && (0, gr.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${a}"`); +function Ci(e) { + const { schema: t, errSchemaPath: r, opts: a, self: s } = e; + t.$ref && a.ignoreKeywordsWithRef && (0, ft.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`); } -function qd(e) { - const { schema: t, opts: a } = e; - t.default !== void 0 && a.useDefaults && a.strictSchema && (0, gr.checkStrictMode)(e, "default is ignored in the schema root"); +function xi(e) { + const { schema: t, opts: r } = e; + t.default !== void 0 && r.useDefaults && r.strictSchema && (0, ft.checkStrictMode)(e, "default is ignored in the schema root"); } -function Hd(e) { +function Oi(e) { const t = e.schema[e.opts.schemaId]; - t && (e.baseId = (0, Id.resolveUrl)(e.opts.uriResolver, e.baseId, t)); + t && (e.baseId = (0, wi.resolveUrl)(e.opts.uriResolver, e.baseId, t)); } -function Gd(e) { +function Ni(e) { if (e.schema.$async && !e.schemaEnv.$async) throw new Error("async schema in sync schema"); } -function tl({ gen: e, schemaEnv: t, schema: a, errSchemaPath: n, opts: s }) { - const c = a.$comment; +function So({ gen: e, schemaEnv: t, schema: r, errSchemaPath: a, opts: s }) { + const l = r.$comment; if (s.$comment === !0) - e.code((0, ae._)`${le.default.self}.logger.log(${c})`); + e.code((0, Z._)`${X.default.self}.logger.log(${l})`); else if (typeof s.$comment == "function") { - const p = (0, ae.str)`${n}/$comment`, b = e.scopeValue("root", { ref: t.root }); - e.code((0, ae._)`${le.default.self}.opts.$comment(${c}, ${p}, ${b}.schema)`); + const d = (0, Z.str)`${a}/$comment`, b = e.scopeValue("root", { ref: t.root }); + e.code((0, Z._)`${X.default.self}.opts.$comment(${l}, ${d}, ${b}.schema)`); } } -function Kd(e) { - const { gen: t, schemaEnv: a, validateName: n, ValidationError: s, opts: c } = e; - a.$async ? t.if((0, ae._)`${le.default.errors} === 0`, () => t.return(le.default.data), () => t.throw((0, ae._)`new ${s}(${le.default.vErrors})`)) : (t.assign((0, ae._)`${n}.errors`, le.default.vErrors), c.unevaluated && Wd(e), t.return((0, ae._)`${le.default.errors} === 0`)); +function ji(e) { + const { gen: t, schemaEnv: r, validateName: a, ValidationError: s, opts: l } = e; + r.$async ? t.if((0, Z._)`${X.default.errors} === 0`, () => t.return(X.default.data), () => t.throw((0, Z._)`new ${s}(${X.default.vErrors})`)) : (t.assign((0, Z._)`${a}.errors`, X.default.vErrors), l.unevaluated && Li(e), t.return((0, Z._)`${X.default.errors} === 0`)); } -function Wd({ gen: e, evaluated: t, props: a, items: n }) { - a instanceof ae.Name && e.assign((0, ae._)`${t}.props`, a), n instanceof ae.Name && e.assign((0, ae._)`${t}.items`, n); +function Li({ gen: e, evaluated: t, props: r, items: a }) { + r instanceof Z.Name && e.assign((0, Z._)`${t}.props`, r), a instanceof Z.Name && e.assign((0, Z._)`${t}.items`, a); } -function vi(e, t, a, n) { - const { gen: s, schema: c, data: p, allErrors: b, opts: _, self: y } = e, { RULES: g } = y; - if (c.$ref && (_.ignoreKeywordsWithRef || !(0, gr.schemaHasRulesButRef)(c, g))) { - s.block(() => nl(e, "$ref", g.all.$ref.definition)); +function $n(e, t, r, a) { + const { gen: s, schema: l, data: d, allErrors: b, opts: _, self: y } = e, { RULES: m } = y; + if (l.$ref && (_.ignoreKeywordsWithRef || !(0, ft.schemaHasRulesButRef)(l, m))) { + s.block(() => xo(e, "$ref", m.all.$ref.definition)); return; } - _.jtd || Jd(e, t), s.block(() => { - for (const L of g.rules) - S(L); - S(g.post); + _.jtd || Ai(e, t), s.block(() => { + for (const N of m.rules) + k(N); + k(m.post); }); - function S(L) { - (0, Fo.shouldUseGroup)(c, L) && (L.type ? (s.if((0, xn.checkDataType)(L.type, p, _.strictNumbers)), $i(e, L), t.length === 1 && t[0] === L.type && a && (s.else(), (0, xn.reportTypeError)(e)), s.endIf()) : $i(e, L), b || s.if((0, ae._)`${le.default.errors} === ${n || 0}`)); + function k(N) { + (0, wa.shouldUseGroup)(l, N) && (N.type ? (s.if((0, zr.checkDataType)(N.type, d, _.strictNumbers)), Pn(e, N), t.length === 1 && t[0] === N.type && r && (s.else(), (0, zr.reportTypeError)(e)), s.endIf()) : Pn(e, N), b || s.if((0, Z._)`${X.default.errors} === ${a || 0}`)); } } -function $i(e, t) { - const { gen: a, schema: n, opts: { useDefaults: s } } = e; - s && (0, Rd.assignDefaults)(e, t.type), a.block(() => { - for (const c of t.rules) - (0, Fo.shouldUseRule)(n, c) && nl(e, c.keyword, c.definition, t.type); +function Pn(e, t) { + const { gen: r, schema: a, opts: { useDefaults: s } } = e; + s && (0, _i.assignDefaults)(e, t.type), r.block(() => { + for (const l of t.rules) + (0, wa.shouldUseRule)(a, l) && xo(e, l.keyword, l.definition, t.type); }); } -function Jd(e, t) { - e.schemaEnv.meta || !e.opts.strictTypes || (Zd(e, t), e.opts.allowUnionTypes || Yd(e, t), Qd(e, e.dataTypes)); +function Ai(e, t) { + e.schemaEnv.meta || !e.opts.strictTypes || (Ri(e, t), e.opts.allowUnionTypes || Ii(e, t), Mi(e, e.dataTypes)); } -function Zd(e, t) { +function Ri(e, t) { if (t.length) { if (!e.dataTypes.length) { e.dataTypes = t; return; } - t.forEach((a) => { - rl(e.dataTypes, a) || Uo(e, `type "${a}" not allowed by context "${e.dataTypes.join(",")}"`); - }), eh(e, t); + t.forEach((r) => { + To(e.dataTypes, r) || va(e, `type "${r}" not allowed by context "${e.dataTypes.join(",")}"`); + }), Bi(e, t); } } -function Yd(e, t) { - t.length > 1 && !(t.length === 2 && t.includes("null")) && Uo(e, "use allowUnionTypes to allow union type keyword"); +function Ii(e, t) { + t.length > 1 && !(t.length === 2 && t.includes("null")) && va(e, "use allowUnionTypes to allow union type keyword"); } -function Qd(e, t) { - const a = e.self.RULES.all; - for (const n in a) { - const s = a[n]; - if (typeof s == "object" && (0, Fo.shouldUseRule)(e.schema, s)) { - const { type: c } = s.definition; - c.length && !c.some((p) => Xd(t, p)) && Uo(e, `missing type "${c.join(",")}" for keyword "${n}"`); +function Mi(e, t) { + const r = e.self.RULES.all; + for (const a in r) { + const s = r[a]; + if (typeof s == "object" && (0, wa.shouldUseRule)(e.schema, s)) { + const { type: l } = s.definition; + l.length && !l.some((d) => Di(t, d)) && va(e, `missing type "${l.join(",")}" for keyword "${a}"`); } } } -function Xd(e, t) { +function Di(e, t) { return e.includes(t) || t === "number" && e.includes("integer"); } -function rl(e, t) { +function To(e, t) { return e.includes(t) || t === "integer" && e.includes("number"); } -function eh(e, t) { - const a = []; - for (const n of e.dataTypes) - rl(t, n) ? a.push(n) : t.includes("integer") && n === "number" && a.push("integer"); - e.dataTypes = a; +function Bi(e, t) { + const r = []; + for (const a of e.dataTypes) + To(t, a) ? r.push(a) : t.includes("integer") && a === "number" && r.push("integer"); + e.dataTypes = r; } -function Uo(e, t) { - const a = e.schemaEnv.baseId + e.errSchemaPath; - t += ` at "${a}" (strictTypes)`, (0, gr.checkStrictMode)(e, t, e.opts.strictTypes); +function va(e, t) { + const r = e.schemaEnv.baseId + e.errSchemaPath; + t += ` at "${r}" (strictTypes)`, (0, ft.checkStrictMode)(e, t, e.opts.strictTypes); } -let al = class { - constructor(t, a, n) { - if ((0, La.validateKeywordUsage)(t, a, n), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = n, this.data = t.data, this.schema = t.schema[n], this.$data = a.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, gr.schemaRefOrVal)(t, this.schema, n, this.$data), this.schemaType = a.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = a, this.$data) - this.schemaCode = t.gen.const("vSchema", ol(this.$data, t)); - else if (this.schemaCode = this.schemaValue, !(0, La.validSchemaType)(this.schema, a.schemaType, a.allowUndefined)) - throw new Error(`${n} value must be ${JSON.stringify(a.schemaType)}`); - ("code" in a ? a.trackErrors : a.errors !== !1) && (this.errsCount = t.gen.const("_errs", le.default.errors)); +class Co { + constructor(t, r, a) { + if ((0, cr.validateKeywordUsage)(t, r, a), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = a, this.data = t.data, this.schema = t.schema[a], this.$data = r.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, ft.schemaRefOrVal)(t, this.schema, a, this.$data), this.schemaType = r.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = r, this.$data) + this.schemaCode = t.gen.const("vSchema", Oo(this.$data, t)); + else if (this.schemaCode = this.schemaValue, !(0, cr.validSchemaType)(this.schema, r.schemaType, r.allowUndefined)) + throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`); + ("code" in r ? r.trackErrors : r.errors !== !1) && (this.errsCount = t.gen.const("_errs", X.default.errors)); } - result(t, a, n) { - this.failResult((0, ae.not)(t), a, n); + result(t, r, a) { + this.failResult((0, Z.not)(t), r, a); } - failResult(t, a, n) { - this.gen.if(t), n ? n() : this.error(), a ? (this.gen.else(), a(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); + failResult(t, r, a) { + this.gen.if(t), a ? a() : this.error(), r ? (this.gen.else(), r(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); } - pass(t, a) { - this.failResult((0, ae.not)(t), void 0, a); + pass(t, r) { + this.failResult((0, Z.not)(t), void 0, r); } fail(t) { if (t === void 0) { @@ -1954,293 +1958,293 @@ let al = class { fail$data(t) { if (!this.$data) return this.fail(t); - const { schemaCode: a } = this; - this.fail((0, ae._)`${a} !== undefined && (${(0, ae.or)(this.invalid$data(), t)})`); + const { schemaCode: r } = this; + this.fail((0, Z._)`${r} !== undefined && (${(0, Z.or)(this.invalid$data(), t)})`); } - error(t, a, n) { - if (a) { - this.setParams(a), this._error(t, n), this.setParams({}); + error(t, r, a) { + if (r) { + this.setParams(r), this._error(t, a), this.setParams({}); return; } - this._error(t, n); + this._error(t, a); } - _error(t, a) { - (t ? Pa.reportExtraError : Pa.reportError)(this, this.def.error, a); + _error(t, r) { + (t ? nr.reportExtraError : nr.reportError)(this, this.def.error, r); } $dataError() { - (0, Pa.reportError)(this, this.def.$dataError || Pa.keyword$DataError); + (0, nr.reportError)(this, this.def.$dataError || nr.keyword$DataError); } reset() { if (this.errsCount === void 0) throw new Error('add "trackErrors" to keyword definition'); - (0, Pa.resetErrorsCount)(this.gen, this.errsCount); + (0, nr.resetErrorsCount)(this.gen, this.errsCount); } ok(t) { this.allErrors || this.gen.if(t); } - setParams(t, a) { - a ? Object.assign(this.params, t) : this.params = t; + setParams(t, r) { + r ? Object.assign(this.params, t) : this.params = t; } - block$data(t, a, n = ae.nil) { + block$data(t, r, a = Z.nil) { this.gen.block(() => { - this.check$data(t, n), a(); + this.check$data(t, a), r(); }); } - check$data(t = ae.nil, a = ae.nil) { + check$data(t = Z.nil, r = Z.nil) { if (!this.$data) return; - const { gen: n, schemaCode: s, schemaType: c, def: p } = this; - n.if((0, ae.or)((0, ae._)`${s} === undefined`, a)), t !== ae.nil && n.assign(t, !0), (c.length || p.validateSchema) && (n.elseIf(this.invalid$data()), this.$dataError(), t !== ae.nil && n.assign(t, !1)), n.else(); + const { gen: a, schemaCode: s, schemaType: l, def: d } = this; + a.if((0, Z.or)((0, Z._)`${s} === undefined`, r)), t !== Z.nil && a.assign(t, !0), (l.length || d.validateSchema) && (a.elseIf(this.invalid$data()), this.$dataError(), t !== Z.nil && a.assign(t, !1)), a.else(); } invalid$data() { - const { gen: t, schemaCode: a, schemaType: n, def: s, it: c } = this; - return (0, ae.or)(p(), b()); - function p() { - if (n.length) { - if (!(a instanceof ae.Name)) + const { gen: t, schemaCode: r, schemaType: a, def: s, it: l } = this; + return (0, Z.or)(d(), b()); + function d() { + if (a.length) { + if (!(r instanceof Z.Name)) throw new Error("ajv implementation error"); - const _ = Array.isArray(n) ? n : [n]; - return (0, ae._)`${(0, xn.checkDataTypes)(_, a, c.opts.strictNumbers, xn.DataType.Wrong)}`; + const _ = Array.isArray(a) ? a : [a]; + return (0, Z._)`${(0, zr.checkDataTypes)(_, r, l.opts.strictNumbers, zr.DataType.Wrong)}`; } - return ae.nil; + return Z.nil; } function b() { if (s.validateSchema) { const _ = t.scopeValue("validate$data", { ref: s.validateSchema }); - return (0, ae._)`!${_}(${a})`; + return (0, Z._)`!${_}(${r})`; } - return ae.nil; + return Z.nil; } } - subschema(t, a) { - const n = (0, co.getSubschema)(this.it, t); - (0, co.extendSubschemaData)(n, this.it, t), (0, co.extendSubschemaMode)(n, t); - const s = { ...this.it, ...n, items: void 0, props: void 0 }; - return Vd(s, a), s; + subschema(t, r) { + const a = (0, ra.getSubschema)(this.it, t); + (0, ra.extendSubschemaData)(a, this.it, t), (0, ra.extendSubschemaMode)(a, t); + const s = { ...this.it, ...a, items: void 0, props: void 0 }; + return Si(s, r), s; } - mergeEvaluated(t, a) { - const { it: n, gen: s } = this; - n.opts.unevaluated && (n.props !== !0 && t.props !== void 0 && (n.props = gr.mergeEvaluated.props(s, t.props, n.props, a)), n.items !== !0 && t.items !== void 0 && (n.items = gr.mergeEvaluated.items(s, t.items, n.items, a))); + mergeEvaluated(t, r) { + const { it: a, gen: s } = this; + a.opts.unevaluated && (a.props !== !0 && t.props !== void 0 && (a.props = ft.mergeEvaluated.props(s, t.props, a.props, r)), a.items !== !0 && t.items !== void 0 && (a.items = ft.mergeEvaluated.items(s, t.items, a.items, r))); } - mergeValidEvaluated(t, a) { - const { it: n, gen: s } = this; - if (n.opts.unevaluated && (n.props !== !0 || n.items !== !0)) - return s.if(a, () => this.mergeEvaluated(t, ae.Name)), !0; + mergeValidEvaluated(t, r) { + const { it: a, gen: s } = this; + if (a.opts.unevaluated && (a.props !== !0 || a.items !== !0)) + return s.if(r, () => this.mergeEvaluated(t, Z.Name)), !0; } -}; -er.KeywordCxt = al; -function nl(e, t, a, n) { - const s = new al(e, a, t); - "code" in a ? a.code(s, n) : s.$data && a.validate ? (0, La.funcKeywordCode)(s, a) : "macro" in a ? (0, La.macroKeywordCode)(s, a) : (a.compile || a.validate) && (0, La.funcKeywordCode)(s, a); } -const th = /^\/(?:[^~]|~0|~1)*$/, rh = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; -function ol(e, { dataLevel: t, dataNames: a, dataPathArr: n }) { - let s, c; +rt.KeywordCxt = Co; +function xo(e, t, r, a) { + const s = new Co(e, r, t); + "code" in r ? r.code(s, a) : s.$data && r.validate ? (0, cr.funcKeywordCode)(s, r) : "macro" in r ? (0, cr.macroKeywordCode)(s, r) : (r.compile || r.validate) && (0, cr.funcKeywordCode)(s, r); +} +const zi = /^\/(?:[^~]|~0|~1)*$/, Vi = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function Oo(e, { dataLevel: t, dataNames: r, dataPathArr: a }) { + let s, l; if (e === "") - return le.default.rootData; + return X.default.rootData; if (e[0] === "/") { - if (!th.test(e)) + if (!zi.test(e)) throw new Error(`Invalid JSON-pointer: ${e}`); - s = e, c = le.default.rootData; + s = e, l = X.default.rootData; } else { - const y = rh.exec(e); + const y = Vi.exec(e); if (!y) throw new Error(`Invalid JSON-pointer: ${e}`); - const g = +y[1]; + const m = +y[1]; if (s = y[2], s === "#") { - if (g >= t) - throw new Error(_("property/index", g)); - return n[t - g]; + if (m >= t) + throw new Error(_("property/index", m)); + return a[t - m]; } - if (g > t) - throw new Error(_("data", g)); - if (c = a[t - g], !s) - return c; + if (m > t) + throw new Error(_("data", m)); + if (l = r[t - m], !s) + return l; } - let p = c; + let d = l; const b = s.split("/"); for (const y of b) - y && (c = (0, ae._)`${c}${(0, ae.getProperty)((0, gr.unescapeJsonPointer)(y))}`, p = (0, ae._)`${p} && ${c}`); - return p; - function _(y, g) { - return `Cannot access ${y} ${g} levels up, current level is ${t}`; + y && (l = (0, Z._)`${l}${(0, Z.getProperty)((0, ft.unescapeJsonPointer)(y))}`, d = (0, Z._)`${d} && ${l}`); + return d; + function _(y, m) { + return `Cannot access ${y} ${m} levels up, current level is ${t}`; } } -er.getData = ol; -var Ja = {}; -Object.defineProperty(Ja, "__esModule", { value: !0 }); -let ah = class extends Error { +rt.getData = Oo; +var _r = {}; +Object.defineProperty(_r, "__esModule", { value: !0 }); +class Fi extends Error { constructor(t) { super("validation failed"), this.errors = t, this.ajv = this.validation = !0; } -}; -Ja.default = ah; -var Za = {}; -Object.defineProperty(Za, "__esModule", { value: !0 }); -const lo = tt; -let nh = class extends Error { - constructor(t, a, n, s) { - super(s || `can't resolve reference ${n} from id ${a}`), this.missingRef = (0, lo.resolveUrl)(t, a, n), this.missingSchema = (0, lo.normalizeId)((0, lo.getFullPath)(t, this.missingRef)); +} +_r.default = Fi; +var wr = {}; +Object.defineProperty(wr, "__esModule", { value: !0 }); +const aa = xe; +class qi extends Error { + constructor(t, r, a, s) { + super(s || `can't resolve reference ${a} from id ${r}`), this.missingRef = (0, aa.resolveUrl)(t, r, a), this.missingSchema = (0, aa.normalizeId)((0, aa.getFullPath)(t, this.missingRef)); } -}; -Za.default = nh; -var wt = {}; -Object.defineProperty(wt, "__esModule", { value: !0 }); -wt.resolveSchema = wt.getCompilingSchema = wt.resolveRef = wt.compileSchema = wt.SchemaEnv = void 0; -const qt = we, oh = Ja, Or = cr, Qt = tt, ki = $e, sh = er; -let Un = class { +} +wr.default = qi; +var Be = {}; +Object.defineProperty(Be, "__esModule", { value: !0 }); +Be.resolveSchema = Be.getCompilingSchema = Be.resolveRef = Be.compileSchema = Be.SchemaEnv = void 0; +const Ze = ie, Ui = _r, Pt = ct, tt = xe, Sn = ce, Gi = rt; +class Yr { constructor(t) { - var a; + var r; this.refs = {}, this.dynamicAnchors = {}; - let n; - typeof t.schema == "object" && (n = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (a = t.baseId) !== null && a !== void 0 ? a : (0, Qt.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 = {}; + let a; + typeof t.schema == "object" && (a = 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, tt.normalizeId)(a == null ? void 0 : a[t.schemaId || "$id"]), this.schemaPath = t.schemaPath, this.localRefs = t.localRefs, this.meta = t.meta, this.$async = a == null ? void 0 : a.$async, this.refs = {}; } -}; -wt.SchemaEnv = Un; -function qo(e) { - const t = sl.call(this, e); +} +Be.SchemaEnv = Yr; +function ka(e) { + const t = No.call(this, e); if (t) return t; - const a = (0, Qt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: n, lines: s } = this.opts.code, { ownProperties: c } = this.opts, p = new qt.CodeGen(this.scope, { es5: n, lines: s, ownProperties: c }); + const r = (0, tt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: a, lines: s } = this.opts.code, { ownProperties: l } = this.opts, d = new Ze.CodeGen(this.scope, { es5: a, lines: s, ownProperties: l }); let b; - e.$async && (b = p.scopeValue("Error", { - ref: oh.default, - code: (0, qt._)`require("ajv/dist/runtime/validation_error").default` + e.$async && (b = d.scopeValue("Error", { + ref: Ui.default, + code: (0, Ze._)`require("ajv/dist/runtime/validation_error").default` })); - const _ = p.scopeName("validate"); + const _ = d.scopeName("validate"); e.validateName = _; const y = { - gen: p, + gen: d, allErrors: this.opts.allErrors, - data: Or.default.data, - parentData: Or.default.parentData, - parentDataProperty: Or.default.parentDataProperty, - dataNames: [Or.default.data], - dataPathArr: [qt.nil], + data: Pt.default.data, + parentData: Pt.default.parentData, + parentDataProperty: Pt.default.parentDataProperty, + dataNames: [Pt.default.data], + dataPathArr: [Ze.nil], dataLevel: 0, dataTypes: [], definedProperties: /* @__PURE__ */ new Set(), - topSchemaRef: p.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, qt.stringify)(e.schema) } : { ref: e.schema }), + topSchemaRef: d.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Ze.stringify)(e.schema) } : { ref: e.schema }), validateName: _, ValidationError: b, schema: e.schema, schemaEnv: e, - rootId: a, - baseId: e.baseId || a, - schemaPath: qt.nil, + rootId: r, + baseId: e.baseId || r, + schemaPath: Ze.nil, errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"), - errorPath: (0, qt._)`""`, + errorPath: (0, Ze._)`""`, opts: this.opts, self: this }; - let g; + let m; try { - this._compilations.add(e), (0, sh.validateFunctionCode)(y), p.optimize(this.opts.code.optimize); - const S = p.toString(); - g = `${p.scopeRefs(Or.default.scope)}return ${S}`, this.opts.code.process && (g = this.opts.code.process(g, e)); - const L = new Function(`${Or.default.self}`, `${Or.default.scope}`, g)(this, this.scope.get()); - if (this.scope.value(_, { ref: L }), L.errors = null, L.schema = e.schema, L.schemaEnv = e, e.$async && (L.$async = !0), this.opts.code.source === !0 && (L.source = { validateName: _, validateCode: S, scopeValues: p._values }), this.opts.unevaluated) { - const { props: A, items: N } = y; - L.evaluated = { - props: A instanceof qt.Name ? void 0 : A, - items: N instanceof qt.Name ? void 0 : N, - dynamicProps: A instanceof qt.Name, - dynamicItems: N instanceof qt.Name - }, L.source && (L.source.evaluated = (0, qt.stringify)(L.evaluated)); - } - return e.validate = L, e; - } catch (S) { - throw delete e.validate, delete e.validateName, g && this.logger.error("Error compiling schema, function code:", g), S; + this._compilations.add(e), (0, Gi.validateFunctionCode)(y), d.optimize(this.opts.code.optimize); + const k = d.toString(); + m = `${d.scopeRefs(Pt.default.scope)}return ${k}`, this.opts.code.process && (m = this.opts.code.process(m, e)); + const N = new Function(`${Pt.default.self}`, `${Pt.default.scope}`, m)(this, this.scope.get()); + if (this.scope.value(_, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: _, validateCode: k, scopeValues: d._values }), this.opts.unevaluated) { + const { props: A, items: j } = y; + N.evaluated = { + props: A instanceof Ze.Name ? void 0 : A, + items: j instanceof Ze.Name ? void 0 : j, + dynamicProps: A instanceof Ze.Name, + dynamicItems: j instanceof Ze.Name + }, N.source && (N.source.evaluated = (0, Ze.stringify)(N.evaluated)); + } + return e.validate = N, e; + } catch (k) { + throw delete e.validate, delete e.validateName, m && this.logger.error("Error compiling schema, function code:", m), k; } finally { this._compilations.delete(e); } } -wt.compileSchema = qo; -function ih(e, t, a) { - var n; - a = (0, Qt.resolveUrl)(this.opts.uriResolver, t, a); - const s = e.refs[a]; +Be.compileSchema = ka; +function Hi(e, t, r) { + var a; + r = (0, tt.resolveUrl)(this.opts.uriResolver, t, r); + const s = e.refs[r]; if (s) return s; - let c = uh.call(this, e, a); - if (c === void 0) { - const p = (n = e.localRefs) === null || n === void 0 ? void 0 : n[a], { schemaId: b } = this.opts; - p && (c = new Un({ schema: p, schemaId: b, root: e, baseId: t })); + let l = Ji.call(this, e, r); + if (l === void 0) { + const d = (a = e.localRefs) === null || a === void 0 ? void 0 : a[r], { schemaId: b } = this.opts; + d && (l = new Yr({ schema: d, schemaId: b, root: e, baseId: t })); } - if (c !== void 0) - return e.refs[a] = ch.call(this, c); + if (l !== void 0) + return e.refs[r] = Ki.call(this, l); } -wt.resolveRef = ih; -function ch(e) { - return (0, Qt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : qo.call(this, e); +Be.resolveRef = Hi; +function Ki(e) { + return (0, tt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : ka.call(this, e); } -function sl(e) { +function No(e) { for (const t of this._compilations) - if (lh(t, e)) + if (Wi(t, e)) return t; } -wt.getCompilingSchema = sl; -function lh(e, t) { +Be.getCompilingSchema = No; +function Wi(e, t) { return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId; } -function uh(e, t) { - let a; - for (; typeof (a = this.refs[t]) == "string"; ) - t = a; - return a || this.schemas[t] || qn.call(this, e, t); +function Ji(e, t) { + let r; + for (; typeof (r = this.refs[t]) == "string"; ) + t = r; + return r || this.schemas[t] || Qr.call(this, e, t); } -function qn(e, t) { - const a = this.opts.uriResolver.parse(t), n = (0, Qt._getFullPath)(this.opts.uriResolver, a); - let s = (0, Qt.getFullPath)(this.opts.uriResolver, e.baseId, void 0); - if (Object.keys(e.schema).length > 0 && n === s) - return uo.call(this, a, e); - const c = (0, Qt.normalizeId)(n), p = this.refs[c] || this.schemas[c]; - if (typeof p == "string") { - const b = qn.call(this, e, p); - return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : uo.call(this, a, b); - } - if (typeof (p == null ? void 0 : p.schema) == "object") { - if (p.validate || qo.call(this, p), c === (0, Qt.normalizeId)(t)) { - const { schema: b } = p, { schemaId: _ } = this.opts, y = b[_]; - return y && (s = (0, Qt.resolveUrl)(this.opts.uriResolver, s, y)), new Un({ schema: b, schemaId: _, root: e, baseId: s }); - } - return uo.call(this, a, p); +function Qr(e, t) { + const r = this.opts.uriResolver.parse(t), a = (0, tt._getFullPath)(this.opts.uriResolver, r); + let s = (0, tt.getFullPath)(this.opts.uriResolver, e.baseId, void 0); + if (Object.keys(e.schema).length > 0 && a === s) + return na.call(this, r, e); + const l = (0, tt.normalizeId)(a), d = this.refs[l] || this.schemas[l]; + if (typeof d == "string") { + const b = Qr.call(this, e, d); + return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : na.call(this, r, b); + } + if (typeof (d == null ? void 0 : d.schema) == "object") { + if (d.validate || ka.call(this, d), l === (0, tt.normalizeId)(t)) { + const { schema: b } = d, { schemaId: _ } = this.opts, y = b[_]; + return y && (s = (0, tt.resolveUrl)(this.opts.uriResolver, s, y)), new Yr({ schema: b, schemaId: _, root: e, baseId: s }); + } + return na.call(this, r, d); } } -wt.resolveSchema = qn; -const dh = /* @__PURE__ */ new Set([ +Be.resolveSchema = Qr; +const Zi = /* @__PURE__ */ new Set([ "properties", "patternProperties", "enum", "dependencies", "definitions" ]); -function uo(e, { baseId: t, schema: a, root: n }) { +function na(e, { baseId: t, schema: r, root: a }) { var s; if (((s = e.fragment) === null || s === void 0 ? void 0 : s[0]) !== "/") return; for (const b of e.fragment.slice(1).split("/")) { - if (typeof a == "boolean") + if (typeof r == "boolean") return; - const _ = a[(0, ki.unescapeFragment)(b)]; + const _ = r[(0, Sn.unescapeFragment)(b)]; if (_ === void 0) return; - a = _; - const y = typeof a == "object" && a[this.opts.schemaId]; - !dh.has(b) && y && (t = (0, Qt.resolveUrl)(this.opts.uriResolver, t, y)); + r = _; + const y = typeof r == "object" && r[this.opts.schemaId]; + !Zi.has(b) && y && (t = (0, tt.resolveUrl)(this.opts.uriResolver, t, y)); } - let c; - if (typeof a != "boolean" && a.$ref && !(0, ki.schemaHasRulesButRef)(a, this.RULES)) { - const b = (0, Qt.resolveUrl)(this.opts.uriResolver, t, a.$ref); - c = qn.call(this, n, b); + let l; + if (typeof r != "boolean" && r.$ref && !(0, Sn.schemaHasRulesButRef)(r, this.RULES)) { + const b = (0, tt.resolveUrl)(this.opts.uriResolver, t, r.$ref); + l = Qr.call(this, a, b); } - const { schemaId: p } = this.opts; - if (c = c || new Un({ schema: a, schemaId: p, root: n, baseId: t }), c.schema !== c.root.schema) - return c; + const { schemaId: d } = this.opts; + if (l = l || new Yr({ schema: r, schemaId: d, root: a, baseId: t }), l.schema !== l.root.schema) + return l; } -const hh = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", ph = "Meta-schema for $data reference (JSON AnySchema extension proposal)", fh = "object", mh = [ +const Yi = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", Qi = "Meta-schema for $data reference (JSON AnySchema extension proposal)", Xi = "object", el = [ "$data" -], gh = { +], tl = { $data: { type: "string", anyOf: [ @@ -2252,257 +2256,257 @@ const hh = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/ } ] } -}, yh = !1, bh = { - $id: hh, - description: ph, - type: fh, - required: mh, - properties: gh, - additionalProperties: yh +}, rl = !1, al = { + $id: Yi, + description: Qi, + type: Xi, + required: el, + properties: tl, + additionalProperties: rl }; -var Ho = {}, Eo = { exports: {} }; +var Ea = {}, da = { exports: {} }; /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ (function(e, t) { - (function(a, n) { - n(t); - })(Rc, function(a) { - function n() { - for (var h = arguments.length, $ = Array(h), P = 0; P < h; P++) - $[P] = arguments[P]; - if ($.length > 1) { - $[0] = $[0].slice(0, -1); - for (var M = $.length - 1, D = 1; D < M; ++D) - $[D] = $[D].slice(1, -1); - return $[M] = $[M].slice(1), $.join(""); + (function(r, a) { + a(t); + })(no, function(r) { + function a() { + for (var p = arguments.length, E = Array(p), S = 0; S < p; S++) + E[S] = arguments[S]; + if (E.length > 1) { + E[0] = E[0].slice(0, -1); + for (var M = E.length - 1, D = 1; D < M; ++D) + E[D] = E[D].slice(1, -1); + return E[M] = E[M].slice(1), E.join(""); } else - return $[0]; - } - function s(h) { - return "(?:" + h + ")"; - } - function c(h) { - return h === void 0 ? "undefined" : h === null ? "null" : Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase(); - } - function p(h) { - return h.toUpperCase(); - } - function b(h) { - return h != null ? h instanceof Array ? h : typeof h.length != "number" || h.split || h.setInterval || h.call ? [h] : Array.prototype.slice.call(h) : []; - } - function _(h, $) { - var P = h; - if ($) - for (var M in $) - P[M] = $[M]; - return P; - } - function y(h) { - var $ = "[A-Za-z]", P = "[0-9]", M = n(P, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Y = "[\\:\\/\\?\\#\\[\\]\\@]", Z = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", re = n(Y, Z), he = h ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", oe = h ? "[\\uE000-\\uF8FF]" : "[]", te = n($, P, "[\\-\\.\\_\\~]", he); - s($ + n($, P, "[\\+\\-\\.]") + "*"), s(s(D + "|" + n(te, Z, "[\\:]")) + "*"); - var ce = s(s("25[0-5]") + "|" + s("2[0-4]" + P) + "|" + s("1" + P + P) + "|" + s("0?[1-9]" + P) + "|0?0?" + P), de = s(ce + "\\." + ce + "\\." + ce + "\\." + ce), Q = s(M + "{1,4}"), pe = s(s(Q + "\\:" + Q) + "|" + de), se = s(s(Q + "\\:") + "{6}" + pe), Re = s("\\:\\:" + s(Q + "\\:") + "{5}" + pe), xt = s(s(Q) + "?\\:\\:" + s(Q + "\\:") + "{4}" + pe), De = s(s(s(Q + "\\:") + "{0,1}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{3}" + pe), He = s(s(s(Q + "\\:") + "{0,2}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{2}" + pe), it = s(s(s(Q + "\\:") + "{0,3}" + Q) + "?\\:\\:" + Q + "\\:" + pe), ct = s(s(s(Q + "\\:") + "{0,4}" + Q) + "?\\:\\:" + pe), Ie = s(s(s(Q + "\\:") + "{0,5}" + Q) + "?\\:\\:" + Q), Ge = s(s(s(Q + "\\:") + "{0,6}" + Q) + "?\\:\\:"), lt = s([se, Re, xt, De, He, it, ct, Ie, Ge].join("|")), Ve = s(s(te + "|" + D) + "+"); - s("[vV]" + M + "+\\." + n(te, Z, "[\\:]") + "+"), s(s(D + "|" + n(te, Z)) + "*"); - var dr = s(D + "|" + n(te, Z, "[\\:\\@]")); - return s(s(D + "|" + n(te, Z, "[\\@]")) + "+"), s(s(dr + "|" + n("[\\/\\?]", oe)) + "*"), { - NOT_SCHEME: new RegExp(n("[^]", $, P, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(n("[^\\%\\:]", te, Z), "g"), - NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", te, Z), "g"), - NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", te, Z), "g"), - NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", te, Z), "g"), - NOT_QUERY: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]", oe), "g"), - NOT_FRAGMENT: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(n("[^]", te, Z), "g"), - UNRESERVED: new RegExp(te, "g"), - OTHER_CHARS: new RegExp(n("[^\\%]", te, re), "g"), + return E[0]; + } + function s(p) { + return "(?:" + p + ")"; + } + function l(p) { + return p === void 0 ? "undefined" : p === null ? "null" : Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase(); + } + function d(p) { + return p.toUpperCase(); + } + function b(p) { + return p != null ? p instanceof Array ? p : typeof p.length != "number" || p.split || p.setInterval || p.call ? [p] : Array.prototype.slice.call(p) : []; + } + function _(p, E) { + var S = p; + if (E) + for (var M in E) + S[M] = E[M]; + return S; + } + function y(p) { + var E = "[A-Za-z]", S = "[0-9]", M = a(S, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Q = "[\\:\\/\\?\\#\\[\\]\\@]", Y = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", ue = a(Q, Y), ke = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", pe = p ? "[\\uE000-\\uF8FF]" : "[]", le = a(E, S, "[\\-\\.\\_\\~]", ke); + s(E + a(E, S, "[\\+\\-\\.]") + "*"), s(s(D + "|" + a(le, Y, "[\\:]")) + "*"); + var ye = s(s("25[0-5]") + "|" + s("2[0-4]" + S) + "|" + s("1" + S + S) + "|" + s("0?[1-9]" + S) + "|0?0?" + S), we = s(ye + "\\." + ye + "\\." + ye + "\\." + ye), ee = s(M + "{1,4}"), Ee = s(s(ee + "\\:" + ee) + "|" + we), fe = s(s(ee + "\\:") + "{6}" + Ee), Fe = s("\\:\\:" + s(ee + "\\:") + "{5}" + Ee), Dt = s(s(ee) + "?\\:\\:" + s(ee + "\\:") + "{4}" + Ee), Je = s(s(s(ee + "\\:") + "{0,1}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{3}" + Ee), dt = s(s(s(ee + "\\:") + "{0,2}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{2}" + Ee), kt = s(s(s(ee + "\\:") + "{0,3}" + ee) + "?\\:\\:" + ee + "\\:" + Ee), Et = s(s(s(ee + "\\:") + "{0,4}" + ee) + "?\\:\\:" + Ee), qe = s(s(s(ee + "\\:") + "{0,5}" + ee) + "?\\:\\:" + ee), ht = s(s(s(ee + "\\:") + "{0,6}" + ee) + "?\\:\\:"), $t = s([fe, Fe, Dt, Je, dt, kt, Et, qe, ht].join("|")), ot = s(s(le + "|" + D) + "+"); + s("[vV]" + M + "+\\." + a(le, Y, "[\\:]") + "+"), s(s(D + "|" + a(le, Y)) + "*"); + var Er = s(D + "|" + a(le, Y, "[\\:\\@]")); + return s(s(D + "|" + a(le, Y, "[\\@]")) + "+"), s(s(Er + "|" + a("[\\/\\?]", pe)) + "*"), { + NOT_SCHEME: new RegExp(a("[^]", E, S, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(a("[^\\%\\:]", le, Y), "g"), + NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", le, Y), "g"), + NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", le, Y), "g"), + NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", le, Y), "g"), + NOT_QUERY: new RegExp(a("[^\\%]", le, Y, "[\\:\\@\\/\\?]", pe), "g"), + NOT_FRAGMENT: new RegExp(a("[^\\%]", le, Y, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(a("[^]", le, Y), "g"), + UNRESERVED: new RegExp(le, "g"), + OTHER_CHARS: new RegExp(a("[^\\%]", le, ue), "g"), PCT_ENCODED: new RegExp(D, "g"), - IPV4ADDRESS: new RegExp("^(" + de + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + lt + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + Ve + ")") + "?\\]?$") + IPV4ADDRESS: new RegExp("^(" + we + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + $t + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + ot + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules }; } - var g = y(!1), S = y(!0), L = function() { - function h($, P) { - var M = [], D = !0, Y = !1, Z = void 0; + var m = y(!1), k = y(!0), N = function() { + function p(E, S) { + var M = [], D = !0, Q = !1, Y = void 0; try { - for (var re = $[Symbol.iterator](), he; !(D = (he = re.next()).done) && (M.push(he.value), !(P && M.length === P)); D = !0) + for (var ue = E[Symbol.iterator](), ke; !(D = (ke = ue.next()).done) && (M.push(ke.value), !(S && M.length === S)); D = !0) ; - } catch (oe) { - Y = !0, Z = oe; + } catch (pe) { + Q = !0, Y = pe; } finally { try { - !D && re.return && re.return(); + !D && ue.return && ue.return(); } finally { - if (Y) - throw Z; + if (Q) + throw Y; } } return M; } - return function($, P) { - if (Array.isArray($)) - return $; - if (Symbol.iterator in Object($)) - return h($, P); + return function(E, S) { + if (Array.isArray(E)) + return E; + if (Symbol.iterator in Object(E)) + return p(E, S); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; - }(), A = function(h) { - if (Array.isArray(h)) { - for (var $ = 0, P = Array(h.length); $ < h.length; $++) - P[$] = h[$]; - return P; + }(), A = function(p) { + if (Array.isArray(p)) { + for (var E = 0, S = Array(p.length); E < p.length; E++) + S[E] = p[E]; + return S; } else - return Array.from(h); - }, N = 2147483647, C = 36, T = 1, v = 26, j = 38, I = 700, r = 72, i = 128, o = "-", l = /^xn--/, u = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, f = { + return Array.from(p); + }, j = 2147483647, C = 36, x = 1, v = 26, T = 38, R = 700, n = 72, i = 128, o = "-", c = /^xn--/, u = /[^\0-\x7E]/, f = /[\x2E\u3002\uFF0E\uFF61]/g, g = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" - }, x = C - T, B = Math.floor, U = String.fromCharCode; - function z(h) { - throw new RangeError(f[h]); - } - function H(h, $) { - for (var P = [], M = h.length; M--; ) - P[M] = $(h[M]); - return P; - } - function w(h, $) { - var P = h.split("@"), M = ""; - P.length > 1 && (M = P[0] + "@", h = P[1]), h = h.replace(m, "."); - var D = h.split("."), Y = H(D, $).join("."); - return M + Y; - } - function q(h) { - for (var $ = [], P = 0, M = h.length; P < M; ) { - var D = h.charCodeAt(P++); - if (D >= 55296 && D <= 56319 && P < M) { - var Y = h.charCodeAt(P++); - (Y & 64512) == 56320 ? $.push(((D & 1023) << 10) + (Y & 1023) + 65536) : ($.push(D), P--); + }, O = C - x, z = Math.floor, q = String.fromCharCode; + function B(p) { + throw new RangeError(g[p]); + } + function G(p, E) { + for (var S = [], M = p.length; M--; ) + S[M] = E(p[M]); + return S; + } + function w(p, E) { + var S = p.split("@"), M = ""; + S.length > 1 && (M = S[0] + "@", p = S[1]), p = p.replace(f, "."); + var D = p.split("."), Q = G(D, E).join("."); + return M + Q; + } + function U(p) { + for (var E = [], S = 0, M = p.length; S < M; ) { + var D = p.charCodeAt(S++); + if (D >= 55296 && D <= 56319 && S < M) { + var Q = p.charCodeAt(S++); + (Q & 64512) == 56320 ? E.push(((D & 1023) << 10) + (Q & 1023) + 65536) : (E.push(D), S--); } else - $.push(D); + E.push(D); } - return $; - } - var W = function(h) { - return String.fromCodePoint.apply(String, A(h)); - }, J = function(h) { - return h - 48 < 10 ? h - 22 : h - 65 < 26 ? h - 65 : h - 97 < 26 ? h - 97 : C; - }, V = function(h, $) { - return h + 22 + 75 * (h < 26) - (($ != 0) << 5); - }, E = function(h, $, P) { + return E; + } + var W = function(p) { + return String.fromCodePoint.apply(String, A(p)); + }, J = function(p) { + return p - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : C; + }, V = function(p, E) { + return p + 22 + 75 * (p < 26) - ((E != 0) << 5); + }, P = function(p, E, S) { var M = 0; for ( - h = P ? B(h / I) : h >> 1, h += B(h / $); + p = S ? z(p / R) : p >> 1, p += z(p / E); /* no initialization */ - h > x * v >> 1; + p > O * v >> 1; M += C ) - h = B(h / x); - return B(M + (x + 1) * h / (h + j)); - }, F = function(h) { - var $ = [], P = h.length, M = 0, D = i, Y = r, Z = h.lastIndexOf(o); - Z < 0 && (Z = 0); - for (var re = 0; re < Z; ++re) - h.charCodeAt(re) >= 128 && z("not-basic"), $.push(h.charCodeAt(re)); - for (var he = Z > 0 ? Z + 1 : 0; he < P; ) { + p = z(p / O); + return z(M + (O + 1) * p / (p + T)); + }, F = function(p) { + var E = [], S = p.length, M = 0, D = i, Q = n, Y = p.lastIndexOf(o); + Y < 0 && (Y = 0); + for (var ue = 0; ue < Y; ++ue) + p.charCodeAt(ue) >= 128 && B("not-basic"), E.push(p.charCodeAt(ue)); + for (var ke = Y > 0 ? Y + 1 : 0; ke < S; ) { for ( - var oe = M, te = 1, ce = C; + var pe = M, le = 1, ye = C; ; /* no condition */ - ce += C + ye += C ) { - he >= P && z("invalid-input"); - var de = J(h.charCodeAt(he++)); - (de >= C || de > B((N - M) / te)) && z("overflow"), M += de * te; - var Q = ce <= Y ? T : ce >= Y + v ? v : ce - Y; - if (de < Q) + ke >= S && B("invalid-input"); + var we = J(p.charCodeAt(ke++)); + (we >= C || we > z((j - M) / le)) && B("overflow"), M += we * le; + var ee = ye <= Q ? x : ye >= Q + v ? v : ye - Q; + if (we < ee) break; - var pe = C - Q; - te > B(N / pe) && z("overflow"), te *= pe; + var Ee = C - ee; + le > z(j / Ee) && B("overflow"), le *= Ee; } - var se = $.length + 1; - Y = E(M - oe, se, oe == 0), B(M / se) > N - D && z("overflow"), D += B(M / se), M %= se, $.splice(M++, 0, D); - } - return String.fromCodePoint.apply(String, $); - }, O = function(h) { - var $ = []; - h = q(h); - var P = h.length, M = i, D = 0, Y = r, Z = !0, re = !1, he = void 0; + var fe = E.length + 1; + Q = P(M - pe, fe, pe == 0), z(M / fe) > j - D && B("overflow"), D += z(M / fe), M %= fe, E.splice(M++, 0, D); + } + return String.fromCodePoint.apply(String, E); + }, L = function(p) { + var E = []; + p = U(p); + var S = p.length, M = i, D = 0, Q = n, Y = !0, ue = !1, ke = void 0; try { - for (var oe = h[Symbol.iterator](), te; !(Z = (te = oe.next()).done); Z = !0) { - var ce = te.value; - ce < 128 && $.push(U(ce)); + for (var pe = p[Symbol.iterator](), le; !(Y = (le = pe.next()).done); Y = !0) { + var ye = le.value; + ye < 128 && E.push(q(ye)); } - } catch (Ut) { - re = !0, he = Ut; + } catch (ar) { + ue = !0, ke = ar; } finally { try { - !Z && oe.return && oe.return(); + !Y && pe.return && pe.return(); } finally { - if (re) - throw he; + if (ue) + throw ke; } } - var de = $.length, Q = de; - for (de && $.push(o); Q < P; ) { - var pe = N, se = !0, Re = !1, xt = void 0; + var we = E.length, ee = we; + for (we && E.push(o); ee < S; ) { + var Ee = j, fe = !0, Fe = !1, Dt = void 0; try { - for (var De = h[Symbol.iterator](), He; !(se = (He = De.next()).done); se = !0) { - var it = He.value; - it >= M && it < pe && (pe = it); + for (var Je = p[Symbol.iterator](), dt; !(fe = (dt = Je.next()).done); fe = !0) { + var kt = dt.value; + kt >= M && kt < Ee && (Ee = kt); } - } catch (Ut) { - Re = !0, xt = Ut; + } catch (ar) { + Fe = !0, Dt = ar; } finally { try { - !se && De.return && De.return(); + !fe && Je.return && Je.return(); } finally { - if (Re) - throw xt; + if (Fe) + throw Dt; } } - var ct = Q + 1; - pe - M > B((N - D) / ct) && z("overflow"), D += (pe - M) * ct, M = pe; - var Ie = !0, Ge = !1, lt = void 0; + var Et = ee + 1; + Ee - M > z((j - D) / Et) && B("overflow"), D += (Ee - M) * Et, M = Ee; + var qe = !0, ht = !1, $t = void 0; try { - for (var Ve = h[Symbol.iterator](), dr; !(Ie = (dr = Ve.next()).done); Ie = !0) { - var $a = dr.value; - if ($a < M && ++D > N && z("overflow"), $a == M) { + for (var ot = p[Symbol.iterator](), Er; !(qe = (Er = ot.next()).done); qe = !0) { + var gn = Er.value; + if (gn < M && ++D > j && B("overflow"), gn == M) { for ( - var hr = D, pr = C; + var $r = D, Pr = C; ; /* no condition */ - pr += C + Pr += C ) { - var fr = pr <= Y ? T : pr >= Y + v ? v : pr - Y; - if (hr < fr) + var Sr = Pr <= Q ? x : Pr >= Q + v ? v : Pr - Q; + if ($r < Sr) break; - var ka = hr - fr, Ea = C - fr; - $.push(U(V(fr + ka % Ea, 0))), hr = B(ka / Ea); + var bn = $r - Sr, yn = C - Sr; + E.push(q(V(Sr + bn % yn, 0))), $r = z(bn / yn); } - $.push(U(V(hr, 0))), Y = E(D, ct, Q == de), D = 0, ++Q; + E.push(q(V($r, 0))), Q = P(D, Et, ee == we), D = 0, ++ee; } } - } catch (Ut) { - Ge = !0, lt = Ut; + } catch (ar) { + ht = !0, $t = ar; } finally { try { - !Ie && Ve.return && Ve.return(); + !qe && ot.return && ot.return(); } finally { - if (Ge) - throw lt; + if (ht) + throw $t; } } ++D, ++M; } - return $.join(""); - }, d = function(h) { - return w(h, function($) { - return l.test($) ? F($.slice(4).toLowerCase()) : $; + return E.join(""); + }, h = function(p) { + return w(p, function(E) { + return c.test(E) ? F(E.slice(4).toLowerCase()) : E; }); - }, k = function(h) { - return w(h, function($) { - return u.test($) ? "xn--" + O($) : $; + }, $ = function(p) { + return w(p, function(E) { + return u.test(E) ? "xn--" + L(E) : E; }); - }, R = { + }, I = { /** * A string representing the current Punycode.js version number. * @memberOf punycode @@ -2517,329 +2521,329 @@ var Ho = {}, Eo = { exports: {} }; * @type Object */ ucs2: { - decode: q, + decode: U, encode: W }, decode: F, - encode: O, - toASCII: k, - toUnicode: d - }, G = {}; - function K(h) { - var $ = h.charCodeAt(0), P = void 0; - return $ < 16 ? P = "%0" + $.toString(16).toUpperCase() : $ < 128 ? P = "%" + $.toString(16).toUpperCase() : $ < 2048 ? P = "%" + ($ >> 6 | 192).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase() : P = "%" + ($ >> 12 | 224).toString(16).toUpperCase() + "%" + ($ >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase(), P; - } - function X(h) { - for (var $ = "", P = 0, M = h.length; P < M; ) { - var D = parseInt(h.substr(P + 1, 2), 16); + encode: L, + toASCII: $, + toUnicode: h + }, H = {}; + function K(p) { + var E = p.charCodeAt(0), S = void 0; + return E < 16 ? S = "%0" + E.toString(16).toUpperCase() : E < 128 ? S = "%" + E.toString(16).toUpperCase() : E < 2048 ? S = "%" + (E >> 6 | 192).toString(16).toUpperCase() + "%" + (E & 63 | 128).toString(16).toUpperCase() : S = "%" + (E >> 12 | 224).toString(16).toUpperCase() + "%" + (E >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (E & 63 | 128).toString(16).toUpperCase(), S; + } + function te(p) { + for (var E = "", S = 0, M = p.length; S < M; ) { + var D = parseInt(p.substr(S + 1, 2), 16); if (D < 128) - $ += String.fromCharCode(D), P += 3; + E += String.fromCharCode(D), S += 3; else if (D >= 194 && D < 224) { - if (M - P >= 6) { - var Y = parseInt(h.substr(P + 4, 2), 16); - $ += String.fromCharCode((D & 31) << 6 | Y & 63); + if (M - S >= 6) { + var Q = parseInt(p.substr(S + 4, 2), 16); + E += String.fromCharCode((D & 31) << 6 | Q & 63); } else - $ += h.substr(P, 6); - P += 6; + E += p.substr(S, 6); + S += 6; } else if (D >= 224) { - if (M - P >= 9) { - var Z = parseInt(h.substr(P + 4, 2), 16), re = parseInt(h.substr(P + 7, 2), 16); - $ += String.fromCharCode((D & 15) << 12 | (Z & 63) << 6 | re & 63); + if (M - S >= 9) { + var Y = parseInt(p.substr(S + 4, 2), 16), ue = parseInt(p.substr(S + 7, 2), 16); + E += String.fromCharCode((D & 15) << 12 | (Y & 63) << 6 | ue & 63); } else - $ += h.substr(P, 9); - P += 9; + E += p.substr(S, 9); + S += 9; } else - $ += h.substr(P, 3), P += 3; + E += p.substr(S, 3), S += 3; } - return $; + return E; } - function ee(h, $) { - function P(M) { - var D = X(M); - return D.match($.UNRESERVED) ? D : M; + function ne(p, E) { + function S(M) { + var D = te(M); + return D.match(E.UNRESERVED) ? D : M; } - return h.scheme && (h.scheme = String(h.scheme).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_SCHEME, "")), h.userinfo !== void 0 && (h.userinfo = String(h.userinfo).replace($.PCT_ENCODED, P).replace($.NOT_USERINFO, K).replace($.PCT_ENCODED, p)), h.host !== void 0 && (h.host = String(h.host).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_HOST, K).replace($.PCT_ENCODED, p)), h.path !== void 0 && (h.path = String(h.path).replace($.PCT_ENCODED, P).replace(h.scheme ? $.NOT_PATH : $.NOT_PATH_NOSCHEME, K).replace($.PCT_ENCODED, p)), h.query !== void 0 && (h.query = String(h.query).replace($.PCT_ENCODED, P).replace($.NOT_QUERY, K).replace($.PCT_ENCODED, p)), h.fragment !== void 0 && (h.fragment = String(h.fragment).replace($.PCT_ENCODED, P).replace($.NOT_FRAGMENT, K).replace($.PCT_ENCODED, p)), h; + return p.scheme && (p.scheme = String(p.scheme).replace(E.PCT_ENCODED, S).toLowerCase().replace(E.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(E.PCT_ENCODED, S).replace(E.NOT_USERINFO, K).replace(E.PCT_ENCODED, d)), p.host !== void 0 && (p.host = String(p.host).replace(E.PCT_ENCODED, S).toLowerCase().replace(E.NOT_HOST, K).replace(E.PCT_ENCODED, d)), p.path !== void 0 && (p.path = String(p.path).replace(E.PCT_ENCODED, S).replace(p.scheme ? E.NOT_PATH : E.NOT_PATH_NOSCHEME, K).replace(E.PCT_ENCODED, d)), p.query !== void 0 && (p.query = String(p.query).replace(E.PCT_ENCODED, S).replace(E.NOT_QUERY, K).replace(E.PCT_ENCODED, d)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(E.PCT_ENCODED, S).replace(E.NOT_FRAGMENT, K).replace(E.PCT_ENCODED, d)), p; } - function ie(h) { - return h.replace(/^0*(.*)/, "$1") || "0"; + function be(p) { + return p.replace(/^0*(.*)/, "$1") || "0"; } - function xe(h, $) { - var P = h.match($.IPV4ADDRESS) || [], M = L(P, 2), D = M[1]; - return D ? D.split(".").map(ie).join(".") : h; + function Ae(p, E) { + var S = p.match(E.IPV4ADDRESS) || [], M = N(S, 2), D = M[1]; + return D ? D.split(".").map(be).join(".") : p; } - function qe(h, $) { - var P = h.match($.IPV6ADDRESS) || [], M = L(P, 3), D = M[1], Y = M[2]; + function ut(p, E) { + var S = p.match(E.IPV6ADDRESS) || [], M = N(S, 3), D = M[1], Q = M[2]; if (D) { - for (var Z = D.toLowerCase().split("::").reverse(), re = L(Z, 2), he = re[0], oe = re[1], te = oe ? oe.split(":").map(ie) : [], ce = he.split(":").map(ie), de = $.IPV4ADDRESS.test(ce[ce.length - 1]), Q = de ? 7 : 8, pe = ce.length - Q, se = Array(Q), Re = 0; Re < Q; ++Re) - se[Re] = te[Re] || ce[pe + Re] || ""; - de && (se[Q - 1] = xe(se[Q - 1], $)); - var xt = se.reduce(function(Ie, Ge, lt) { - if (!Ge || Ge === "0") { - var Ve = Ie[Ie.length - 1]; - Ve && Ve.index + Ve.length === lt ? Ve.length++ : Ie.push({ index: lt, length: 1 }); + for (var Y = D.toLowerCase().split("::").reverse(), ue = N(Y, 2), ke = ue[0], pe = ue[1], le = pe ? pe.split(":").map(be) : [], ye = ke.split(":").map(be), we = E.IPV4ADDRESS.test(ye[ye.length - 1]), ee = we ? 7 : 8, Ee = ye.length - ee, fe = Array(ee), Fe = 0; Fe < ee; ++Fe) + fe[Fe] = le[Fe] || ye[Ee + Fe] || ""; + we && (fe[ee - 1] = Ae(fe[ee - 1], E)); + var Dt = fe.reduce(function(qe, ht, $t) { + if (!ht || ht === "0") { + var ot = qe[qe.length - 1]; + ot && ot.index + ot.length === $t ? ot.length++ : qe.push({ index: $t, length: 1 }); } - return Ie; - }, []), De = xt.sort(function(Ie, Ge) { - return Ge.length - Ie.length; - })[0], He = void 0; - if (De && De.length > 1) { - var it = se.slice(0, De.index), ct = se.slice(De.index + De.length); - He = it.join(":") + "::" + ct.join(":"); + return qe; + }, []), Je = Dt.sort(function(qe, ht) { + return ht.length - qe.length; + })[0], dt = void 0; + if (Je && Je.length > 1) { + var kt = fe.slice(0, Je.index), Et = fe.slice(Je.index + Je.length); + dt = kt.join(":") + "::" + Et.join(":"); } else - He = se.join(":"); - return Y && (He += "%" + Y), He; + dt = fe.join(":"); + return Q && (dt += "%" + Q), dt; } else - return h; + return p; } - var At = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Mt = "".match(/(){0}/)[1] === void 0; - function je(h) { - var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = {}, M = $.iri !== !1 ? S : g; - $.reference === "suffix" && (h = ($.scheme ? $.scheme + ":" : "") + "//" + h); - var D = h.match(At); + var Zt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Yt = "".match(/(){0}/)[1] === void 0; + function ze(p) { + var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, S = {}, M = E.iri !== !1 ? k : m; + E.reference === "suffix" && (p = (E.scheme ? E.scheme + ":" : "") + "//" + p); + var D = p.match(Zt); if (D) { - Mt ? (P.scheme = D[1], P.userinfo = D[3], P.host = D[4], P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = D[7], P.fragment = D[8], isNaN(P.port) && (P.port = D[5])) : (P.scheme = D[1] || void 0, P.userinfo = h.indexOf("@") !== -1 ? D[3] : void 0, P.host = h.indexOf("//") !== -1 ? D[4] : void 0, P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = h.indexOf("?") !== -1 ? D[7] : void 0, P.fragment = h.indexOf("#") !== -1 ? D[8] : void 0, isNaN(P.port) && (P.port = h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), P.host && (P.host = qe(xe(P.host, M), M)), P.scheme === void 0 && P.userinfo === void 0 && P.host === void 0 && P.port === void 0 && !P.path && P.query === void 0 ? P.reference = "same-document" : P.scheme === void 0 ? P.reference = "relative" : P.fragment === void 0 ? P.reference = "absolute" : P.reference = "uri", $.reference && $.reference !== "suffix" && $.reference !== P.reference && (P.error = P.error || "URI is not a " + $.reference + " reference."); - var Y = G[($.scheme || P.scheme || "").toLowerCase()]; - if (!$.unicodeSupport && (!Y || !Y.unicodeSupport)) { - if (P.host && ($.domainHost || Y && Y.domainHost)) + Yt ? (S.scheme = D[1], S.userinfo = D[3], S.host = D[4], S.port = parseInt(D[5], 10), S.path = D[6] || "", S.query = D[7], S.fragment = D[8], isNaN(S.port) && (S.port = D[5])) : (S.scheme = D[1] || void 0, S.userinfo = p.indexOf("@") !== -1 ? D[3] : void 0, S.host = p.indexOf("//") !== -1 ? D[4] : void 0, S.port = parseInt(D[5], 10), S.path = D[6] || "", S.query = p.indexOf("?") !== -1 ? D[7] : void 0, S.fragment = p.indexOf("#") !== -1 ? D[8] : void 0, isNaN(S.port) && (S.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), S.host && (S.host = ut(Ae(S.host, M), M)), S.scheme === void 0 && S.userinfo === void 0 && S.host === void 0 && S.port === void 0 && !S.path && S.query === void 0 ? S.reference = "same-document" : S.scheme === void 0 ? S.reference = "relative" : S.fragment === void 0 ? S.reference = "absolute" : S.reference = "uri", E.reference && E.reference !== "suffix" && E.reference !== S.reference && (S.error = S.error || "URI is not a " + E.reference + " reference."); + var Q = H[(E.scheme || S.scheme || "").toLowerCase()]; + if (!E.unicodeSupport && (!Q || !Q.unicodeSupport)) { + if (S.host && (E.domainHost || Q && Q.domainHost)) try { - P.host = R.toASCII(P.host.replace(M.PCT_ENCODED, X).toLowerCase()); - } catch (Z) { - P.error = P.error || "Host's domain name can not be converted to ASCII via punycode: " + Z; + S.host = I.toASCII(S.host.replace(M.PCT_ENCODED, te).toLowerCase()); + } catch (Y) { + S.error = S.error || "Host's domain name can not be converted to ASCII via punycode: " + Y; } - ee(P, g); + ne(S, m); } else - ee(P, M); - Y && Y.parse && Y.parse(P, $); + ne(S, M); + Q && Q.parse && Q.parse(S, E); } else - P.error = P.error || "URI can not be parsed."; - return P; - } - function Dt(h, $) { - var P = $.iri !== !1 ? S : g, M = []; - return h.userinfo !== void 0 && (M.push(h.userinfo), M.push("@")), h.host !== void 0 && M.push(qe(xe(String(h.host), P), P).replace(P.IPV6ADDRESS, function(D, Y, Z) { - return "[" + Y + (Z ? "%25" + Z : "") + "]"; - })), (typeof h.port == "number" || typeof h.port == "string") && (M.push(":"), M.push(String(h.port))), M.length ? M.join("") : void 0; - } - var $t = /^\.\.?\//, kt = /^\/\.(\/|$)/, Et = /^\/\.\.(\/|$)/, zt = /^\/?(?:.|\n)*?(?=\/|$)/; - function ze(h) { - for (var $ = []; h.length; ) - if (h.match($t)) - h = h.replace($t, ""); - else if (h.match(kt)) - h = h.replace(kt, "/"); - else if (h.match(Et)) - h = h.replace(Et, "/"), $.pop(); - else if (h === "." || h === "..") - h = ""; + S.error = S.error || "URI can not be parsed."; + return S; + } + function Qt(p, E) { + var S = E.iri !== !1 ? k : m, M = []; + return p.userinfo !== void 0 && (M.push(p.userinfo), M.push("@")), p.host !== void 0 && M.push(ut(Ae(String(p.host), S), S).replace(S.IPV6ADDRESS, function(D, Q, Y) { + return "[" + Q + (Y ? "%25" + Y : "") + "]"; + })), (typeof p.port == "number" || typeof p.port == "string") && (M.push(":"), M.push(String(p.port))), M.length ? M.join("") : void 0; + } + var Lt = /^\.\.?\//, At = /^\/\.(\/|$)/, Rt = /^\/\.\.(\/|$)/, Xt = /^\/?(?:.|\n)*?(?=\/|$)/; + function at(p) { + for (var E = []; p.length; ) + if (p.match(Lt)) + p = p.replace(Lt, ""); + else if (p.match(At)) + p = p.replace(At, "/"); + else if (p.match(Rt)) + p = p.replace(Rt, "/"), E.pop(); + else if (p === "." || p === "..") + p = ""; else { - var P = h.match(zt); - if (P) { - var M = P[0]; - h = h.slice(M.length), $.push(M); + var S = p.match(Xt); + if (S) { + var M = S[0]; + p = p.slice(M.length), E.push(M); } else throw new Error("Unexpected dot segment condition"); } - return $.join(""); + return E.join(""); } - function Te(h) { - var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = $.iri ? S : g, M = [], D = G[($.scheme || h.scheme || "").toLowerCase()]; - if (D && D.serialize && D.serialize(h, $), h.host && !P.IPV6ADDRESS.test(h.host) && ($.domainHost || D && D.domainHost)) + function Re(p) { + var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, S = E.iri ? k : m, M = [], D = H[(E.scheme || p.scheme || "").toLowerCase()]; + if (D && D.serialize && D.serialize(p, E), p.host && !S.IPV6ADDRESS.test(p.host) && (E.domainHost || D && D.domainHost)) try { - h.host = $.iri ? R.toUnicode(h.host) : R.toASCII(h.host.replace(P.PCT_ENCODED, X).toLowerCase()); - } catch (re) { - h.error = h.error || "Host's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + re; + p.host = E.iri ? I.toUnicode(p.host) : I.toASCII(p.host.replace(S.PCT_ENCODED, te).toLowerCase()); + } catch (ue) { + p.error = p.error || "Host's domain name can not be converted to " + (E.iri ? "Unicode" : "ASCII") + " via punycode: " + ue; } - ee(h, P), $.reference !== "suffix" && h.scheme && (M.push(h.scheme), M.push(":")); - var Y = Dt(h, $); - if (Y !== void 0 && ($.reference !== "suffix" && M.push("//"), M.push(Y), h.path && h.path.charAt(0) !== "/" && M.push("/")), h.path !== void 0) { - var Z = h.path; - !$.absolutePath && (!D || !D.absolutePath) && (Z = ze(Z)), Y === void 0 && (Z = Z.replace(/^\/\//, "/%2F")), M.push(Z); + ne(p, S), E.reference !== "suffix" && p.scheme && (M.push(p.scheme), M.push(":")); + var Q = Qt(p, E); + if (Q !== void 0 && (E.reference !== "suffix" && M.push("//"), M.push(Q), p.path && p.path.charAt(0) !== "/" && M.push("/")), p.path !== void 0) { + var Y = p.path; + !E.absolutePath && (!D || !D.absolutePath) && (Y = at(Y)), Q === void 0 && (Y = Y.replace(/^\/\//, "/%2F")), M.push(Y); } - return h.query !== void 0 && (M.push("?"), M.push(h.query)), h.fragment !== void 0 && (M.push("#"), M.push(h.fragment)), M.join(""); + return p.query !== void 0 && (M.push("?"), M.push(p.query)), p.fragment !== void 0 && (M.push("#"), M.push(p.fragment)), M.join(""); } - function Pt(h, $) { - var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {}; - return M || (h = je(Te(h, P), P), $ = je(Te($, P), P)), P = P || {}, !P.tolerant && $.scheme ? (D.scheme = $.scheme, D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.userinfo !== void 0 || $.host !== void 0 || $.port !== void 0 ? (D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.path ? ($.path.charAt(0) === "/" ? D.path = ze($.path) : ((h.userinfo !== void 0 || h.host !== void 0 || h.port !== void 0) && !h.path ? D.path = "/" + $.path : h.path ? D.path = h.path.slice(0, h.path.lastIndexOf("/") + 1) + $.path : D.path = $.path, D.path = ze(D.path)), D.query = $.query) : (D.path = h.path, $.query !== void 0 ? D.query = $.query : D.query = h.query), D.userinfo = h.userinfo, D.host = h.host, D.port = h.port), D.scheme = h.scheme), D.fragment = $.fragment, D; + function It(p, E) { + var S = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {}; + return M || (p = ze(Re(p, S), S), E = ze(Re(E, S), S)), S = S || {}, !S.tolerant && E.scheme ? (D.scheme = E.scheme, D.userinfo = E.userinfo, D.host = E.host, D.port = E.port, D.path = at(E.path || ""), D.query = E.query) : (E.userinfo !== void 0 || E.host !== void 0 || E.port !== void 0 ? (D.userinfo = E.userinfo, D.host = E.host, D.port = E.port, D.path = at(E.path || ""), D.query = E.query) : (E.path ? (E.path.charAt(0) === "/" ? D.path = at(E.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? D.path = "/" + E.path : p.path ? D.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + E.path : D.path = E.path, D.path = at(D.path)), D.query = E.query) : (D.path = p.path, E.query !== void 0 ? D.query = E.query : D.query = p.query), D.userinfo = p.userinfo, D.host = p.host, D.port = p.port), D.scheme = p.scheme), D.fragment = E.fragment, D; } - function Bt(h, $, P) { - var M = _({ scheme: "null" }, P); - return Te(Pt(je(h, M), je($, M), M, !0), M); + function er(p, E, S) { + var M = _({ scheme: "null" }, S); + return Re(It(ze(p, M), ze(E, M), M, !0), M); } - function ot(h, $) { - return typeof h == "string" ? h = Te(je(h, $), $) : c(h) === "object" && (h = je(Te(h, $), $)), h; + function wt(p, E) { + return typeof p == "string" ? p = Re(ze(p, E), E) : l(p) === "object" && (p = ze(Re(p, E), E)), p; } - function Vt(h, $, P) { - return typeof h == "string" ? h = Te(je(h, P), P) : c(h) === "object" && (h = Te(h, P)), typeof $ == "string" ? $ = Te(je($, P), P) : c($) === "object" && ($ = Te($, P)), h === $; + function tr(p, E, S) { + return typeof p == "string" ? p = Re(ze(p, S), S) : l(p) === "object" && (p = Re(p, S)), typeof E == "string" ? E = Re(ze(E, S), S) : l(E) === "object" && (E = Re(E, S)), p === E; } - function ur(h, $) { - return h && h.toString().replace(!$ || !$.iri ? g.ESCAPE : S.ESCAPE, K); + function kr(p, E) { + return p && p.toString().replace(!E || !E.iri ? m.ESCAPE : k.ESCAPE, K); } - function Le(h, $) { - return h && h.toString().replace(!$ || !$.iri ? g.PCT_ENCODED : S.PCT_ENCODED, X); + function Ve(p, E) { + return p && p.toString().replace(!E || !E.iri ? m.PCT_ENCODED : k.PCT_ENCODED, te); } - var st = { + var vt = { scheme: "http", domainHost: !0, - parse: function(h, $) { - return h.host || (h.error = h.error || "HTTP URIs must have a host."), h; + parse: function(p, E) { + return p.host || (p.error = p.error || "HTTP URIs must have a host."), p; }, - serialize: function(h, $) { - var P = String(h.scheme).toLowerCase() === "https"; - return (h.port === (P ? 443 : 80) || h.port === "") && (h.port = void 0), h.path || (h.path = "/"), h; + serialize: function(p, E) { + var S = String(p.scheme).toLowerCase() === "https"; + return (p.port === (S ? 443 : 80) || p.port === "") && (p.port = void 0), p.path || (p.path = "/"), p; } - }, fa = { + }, ln = { scheme: "https", - domainHost: st.domainHost, - parse: st.parse, - serialize: st.serialize + domainHost: vt.domainHost, + parse: vt.parse, + serialize: vt.serialize }; - function ma(h) { - return typeof h.secure == "boolean" ? h.secure : String(h.scheme).toLowerCase() === "wss"; + function cn(p) { + return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss"; } - var Ft = { + var rr = { scheme: "ws", domainHost: !0, - parse: function(h, $) { - var P = h; - return P.secure = ma(P), P.resourceName = (P.path || "/") + (P.query ? "?" + P.query : ""), P.path = void 0, P.query = void 0, P; + parse: function(p, E) { + var S = p; + return S.secure = cn(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S; }, - serialize: function(h, $) { - if ((h.port === (ma(h) ? 443 : 80) || h.port === "") && (h.port = void 0), typeof h.secure == "boolean" && (h.scheme = h.secure ? "wss" : "ws", h.secure = void 0), h.resourceName) { - var P = h.resourceName.split("?"), M = L(P, 2), D = M[0], Y = M[1]; - h.path = D && D !== "/" ? D : void 0, h.query = Y, h.resourceName = void 0; + serialize: function(p, E) { + if ((p.port === (cn(p) ? 443 : 80) || p.port === "") && (p.port = void 0), typeof p.secure == "boolean" && (p.scheme = p.secure ? "wss" : "ws", p.secure = void 0), p.resourceName) { + var S = p.resourceName.split("?"), M = N(S, 2), D = M[0], Q = M[1]; + p.path = D && D !== "/" ? D : void 0, p.query = Q, p.resourceName = void 0; } - return h.fragment = void 0, h; + return p.fragment = void 0, p; } - }, ga = { + }, un = { scheme: "wss", - domainHost: Ft.domainHost, - parse: Ft.parse, - serialize: Ft.serialize - }, Yn = {}, ya = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", Be = "[0-9A-Fa-f]", Qn = s(s("%[EFef]" + Be + "%" + Be + Be + "%" + Be + Be) + "|" + s("%[89A-Fa-f]" + Be + "%" + Be + Be) + "|" + s("%" + Be + Be)), Xn = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", eo = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", to = n(eo, '[\\"\\\\]'), ro = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ao = new RegExp(ya, "g"), St = new RegExp(Qn, "g"), no = new RegExp(n("[^]", Xn, "[\\.]", '[\\"]', to), "g"), ba = new RegExp(n("[^]", ya, ro), "g"), oo = ba; - function Cr(h) { - var $ = X(h); - return $.match(ao) ? $ : h; - } - var _a = { + domainHost: rr.domainHost, + parse: rr.parse, + serialize: rr.serialize + }, ss = {}, dn = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", nt = "[0-9A-Fa-f]", is = s(s("%[EFef]" + nt + "%" + nt + nt + "%" + nt + nt) + "|" + s("%[89A-Fa-f]" + nt + "%" + nt + nt) + "|" + s("%" + nt + nt)), ls = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cs = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", us = a(cs, '[\\"\\\\]'), ds = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", hs = new RegExp(dn, "g"), Mt = new RegExp(is, "g"), ps = new RegExp(a("[^]", ls, "[\\.]", '[\\"]', us), "g"), hn = new RegExp(a("[^]", dn, ds), "g"), fs = hn; + function ta(p) { + var E = te(p); + return E.match(hs) ? E : p; + } + var pn = { scheme: "mailto", - parse: function(h, $) { - var P = h, M = P.to = P.path ? P.path.split(",") : []; - if (P.path = void 0, P.query) { - for (var D = !1, Y = {}, Z = P.query.split("&"), re = 0, he = Z.length; re < he; ++re) { - var oe = Z[re].split("="); - switch (oe[0]) { + parse: function(p, E) { + var S = p, M = S.to = S.path ? S.path.split(",") : []; + if (S.path = void 0, S.query) { + for (var D = !1, Q = {}, Y = S.query.split("&"), ue = 0, ke = Y.length; ue < ke; ++ue) { + var pe = Y[ue].split("="); + switch (pe[0]) { case "to": - for (var te = oe[1].split(","), ce = 0, de = te.length; ce < de; ++ce) - M.push(te[ce]); + for (var le = pe[1].split(","), ye = 0, we = le.length; ye < we; ++ye) + M.push(le[ye]); break; case "subject": - P.subject = Le(oe[1], $); + S.subject = Ve(pe[1], E); break; case "body": - P.body = Le(oe[1], $); + S.body = Ve(pe[1], E); break; default: - D = !0, Y[Le(oe[0], $)] = Le(oe[1], $); + D = !0, Q[Ve(pe[0], E)] = Ve(pe[1], E); break; } } - D && (P.headers = Y); + D && (S.headers = Q); } - P.query = void 0; - for (var Q = 0, pe = M.length; Q < pe; ++Q) { - var se = M[Q].split("@"); - if (se[0] = Le(se[0]), $.unicodeSupport) - se[1] = Le(se[1], $).toLowerCase(); + S.query = void 0; + for (var ee = 0, Ee = M.length; ee < Ee; ++ee) { + var fe = M[ee].split("@"); + if (fe[0] = Ve(fe[0]), E.unicodeSupport) + fe[1] = Ve(fe[1], E).toLowerCase(); else try { - se[1] = R.toASCII(Le(se[1], $).toLowerCase()); - } catch (Re) { - P.error = P.error || "Email address's domain name can not be converted to ASCII via punycode: " + Re; + fe[1] = I.toASCII(Ve(fe[1], E).toLowerCase()); + } catch (Fe) { + S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Fe; } - M[Q] = se.join("@"); + M[ee] = fe.join("@"); } - return P; + return S; }, - serialize: function(h, $) { - var P = h, M = b(h.to); + serialize: function(p, E) { + var S = p, M = b(p.to); if (M) { - for (var D = 0, Y = M.length; D < Y; ++D) { - var Z = String(M[D]), re = Z.lastIndexOf("@"), he = Z.slice(0, re).replace(St, Cr).replace(St, p).replace(no, K), oe = Z.slice(re + 1); + for (var D = 0, Q = M.length; D < Q; ++D) { + var Y = String(M[D]), ue = Y.lastIndexOf("@"), ke = Y.slice(0, ue).replace(Mt, ta).replace(Mt, d).replace(ps, K), pe = Y.slice(ue + 1); try { - oe = $.iri ? R.toUnicode(oe) : R.toASCII(Le(oe, $).toLowerCase()); - } catch (Q) { - P.error = P.error || "Email address's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + Q; + pe = E.iri ? I.toUnicode(pe) : I.toASCII(Ve(pe, E).toLowerCase()); + } catch (ee) { + S.error = S.error || "Email address's domain name can not be converted to " + (E.iri ? "Unicode" : "ASCII") + " via punycode: " + ee; } - M[D] = he + "@" + oe; + M[D] = ke + "@" + pe; } - P.path = M.join(","); + S.path = M.join(","); } - var te = h.headers = h.headers || {}; - h.subject && (te.subject = h.subject), h.body && (te.body = h.body); - var ce = []; - for (var de in te) - te[de] !== Yn[de] && ce.push(de.replace(St, Cr).replace(St, p).replace(ba, K) + "=" + te[de].replace(St, Cr).replace(St, p).replace(oo, K)); - return ce.length && (P.query = ce.join("&")), P; - } - }, so = /^([^\:]+)\:(.*)/, wa = { + var le = p.headers = p.headers || {}; + p.subject && (le.subject = p.subject), p.body && (le.body = p.body); + var ye = []; + for (var we in le) + le[we] !== ss[we] && ye.push(we.replace(Mt, ta).replace(Mt, d).replace(hn, K) + "=" + le[we].replace(Mt, ta).replace(Mt, d).replace(fs, K)); + return ye.length && (S.query = ye.join("&")), S; + } + }, ms = /^([^\:]+)\:(.*)/, fn = { scheme: "urn", - parse: function(h, $) { - var P = h.path && h.path.match(so), M = h; - if (P) { - var D = $.scheme || M.scheme || "urn", Y = P[1].toLowerCase(), Z = P[2], re = D + ":" + ($.nid || Y), he = G[re]; - M.nid = Y, M.nss = Z, M.path = void 0, he && (M = he.parse(M, $)); + parse: function(p, E) { + var S = p.path && p.path.match(ms), M = p; + if (S) { + var D = E.scheme || M.scheme || "urn", Q = S[1].toLowerCase(), Y = S[2], ue = D + ":" + (E.nid || Q), ke = H[ue]; + M.nid = Q, M.nss = Y, M.path = void 0, ke && (M = ke.parse(M, E)); } else M.error = M.error || "URN can not be parsed."; return M; }, - serialize: function(h, $) { - var P = $.scheme || h.scheme || "urn", M = h.nid, D = P + ":" + ($.nid || M), Y = G[D]; - Y && (h = Y.serialize(h, $)); - var Z = h, re = h.nss; - return Z.path = (M || $.nid) + ":" + re, Z; + serialize: function(p, E) { + var S = E.scheme || p.scheme || "urn", M = p.nid, D = S + ":" + (E.nid || M), Q = H[D]; + Q && (p = Q.serialize(p, E)); + var Y = p, ue = p.nss; + return Y.path = (M || E.nid) + ":" + ue, Y; } - }, io = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, va = { + }, gs = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, mn = { scheme: "urn:uuid", - parse: function(h, $) { - var P = h; - return P.uuid = P.nss, P.nss = void 0, !$.tolerant && (!P.uuid || !P.uuid.match(io)) && (P.error = P.error || "UUID is not valid."), P; + parse: function(p, E) { + var S = p; + return S.uuid = S.nss, S.nss = void 0, !E.tolerant && (!S.uuid || !S.uuid.match(gs)) && (S.error = S.error || "UUID is not valid."), S; }, - serialize: function(h, $) { - var P = h; - return P.nss = (h.uuid || "").toLowerCase(), P; + serialize: function(p, E) { + var S = p; + return S.nss = (p.uuid || "").toLowerCase(), S; } }; - G[st.scheme] = st, G[fa.scheme] = fa, G[Ft.scheme] = Ft, G[ga.scheme] = ga, G[_a.scheme] = _a, G[wa.scheme] = wa, G[va.scheme] = va, a.SCHEMES = G, a.pctEncChar = K, a.pctDecChars = X, a.parse = je, a.removeDotSegments = ze, a.serialize = Te, a.resolveComponents = Pt, a.resolve = Bt, a.normalize = ot, a.equal = Vt, a.escapeComponent = ur, a.unescapeComponent = Le, Object.defineProperty(a, "__esModule", { value: !0 }); + H[vt.scheme] = vt, H[ln.scheme] = ln, H[rr.scheme] = rr, H[un.scheme] = un, H[pn.scheme] = pn, H[fn.scheme] = fn, H[mn.scheme] = mn, r.SCHEMES = H, r.pctEncChar = K, r.pctDecChars = te, r.parse = ze, r.removeDotSegments = at, r.serialize = Re, r.resolveComponents = It, r.resolve = er, r.normalize = wt, r.equal = tr, r.escapeComponent = kr, r.unescapeComponent = Ve, Object.defineProperty(r, "__esModule", { value: !0 }); }); -})(Eo, Eo.exports); -var _h = Eo.exports; -Object.defineProperty(Ho, "__esModule", { value: !0 }); -const il = _h; -il.code = 'require("ajv/dist/runtime/uri").default'; -Ho.default = il; +})(da, da.exports); +var nl = da.exports; +Object.defineProperty(Ea, "__esModule", { value: !0 }); +const jo = nl; +jo.code = 'require("ajv/dist/runtime/uri").default'; +Ea.default = jo; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0; - var t = er; + var t = rt; Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() { return t.KeywordCxt; } }); - var a = we; + var r = ie; Object.defineProperty(e, "_", { enumerable: !0, get: function() { - return a._; + return r._; } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { - return a.str; + return r.str; } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { - return a.stringify; + return r.stringify; } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { - return a.nil; + return r.nil; } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { - return a.Name; + return r.Name; } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() { - return a.CodeGen; + return r.CodeGen; } }); - const n = Ja, s = Za, c = Fr, p = wt, b = we, _ = tt, y = Wa, g = $e, S = bh, L = Ho, A = (V, E) => new RegExp(V, E); + const a = _r, s = wr, l = Nt, d = Be, b = ie, _ = xe, y = yr, m = ce, k = al, N = Ea, A = (V, P) => new RegExp(V, P); A.code = "new RegExp"; - const N = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([ + const j = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([ "validate", "serialize", "parse", @@ -2853,7 +2857,7 @@ Ho.default = il; "func", "obj", "Error" - ]), T = { + ]), x = { errorDataPath: "", format: "`validateFormats: false` can be used instead.", nullable: '"nullable" keyword is supported by default.', @@ -2873,156 +2877,156 @@ Ho.default = il; ignoreKeywordsWithRef: "", jsPropertySyntax: "", unicode: '"minLength"/"maxLength" account for unicode characters by default.' - }, j = 200; - function I(V) { - var E, F, O, d, k, R, G, K, X, ee, ie, xe, qe, At, Mt, je, Dt, $t, kt, Et, zt, ze, Te, Pt, Bt; - const ot = V.strict, Vt = (E = V.code) === null || E === void 0 ? void 0 : E.optimize, ur = Vt === !0 || Vt === void 0 ? 1 : Vt || 0, Le = (O = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && O !== void 0 ? O : A, st = (d = V.uriResolver) !== null && d !== void 0 ? d : L.default; + }, T = 200; + function R(V) { + var P, F, L, h, $, I, H, K, te, ne, be, Ae, ut, Zt, Yt, ze, Qt, Lt, At, Rt, Xt, at, Re, It, er; + const wt = V.strict, tr = (P = V.code) === null || P === void 0 ? void 0 : P.optimize, kr = tr === !0 || tr === void 0 ? 1 : tr || 0, Ve = (L = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && L !== void 0 ? L : A, vt = (h = V.uriResolver) !== null && h !== void 0 ? h : N.default; return { - strictSchema: (R = (k = V.strictSchema) !== null && k !== void 0 ? k : ot) !== null && R !== void 0 ? R : !0, - strictNumbers: (K = (G = V.strictNumbers) !== null && G !== void 0 ? G : ot) !== null && K !== void 0 ? K : !0, - strictTypes: (ee = (X = V.strictTypes) !== null && X !== void 0 ? X : ot) !== null && ee !== void 0 ? ee : "log", - strictTuples: (xe = (ie = V.strictTuples) !== null && ie !== void 0 ? ie : ot) !== null && xe !== void 0 ? xe : "log", - strictRequired: (At = (qe = V.strictRequired) !== null && qe !== void 0 ? qe : ot) !== null && At !== void 0 ? At : !1, - code: V.code ? { ...V.code, optimize: ur, regExp: Le } : { optimize: ur, regExp: Le }, - loopRequired: (Mt = V.loopRequired) !== null && Mt !== void 0 ? Mt : j, - loopEnum: (je = V.loopEnum) !== null && je !== void 0 ? je : j, - meta: (Dt = V.meta) !== null && Dt !== void 0 ? Dt : !0, - messages: ($t = V.messages) !== null && $t !== void 0 ? $t : !0, - inlineRefs: (kt = V.inlineRefs) !== null && kt !== void 0 ? kt : !0, - schemaId: (Et = V.schemaId) !== null && Et !== void 0 ? Et : "$id", - addUsedSchema: (zt = V.addUsedSchema) !== null && zt !== void 0 ? zt : !0, - validateSchema: (ze = V.validateSchema) !== null && ze !== void 0 ? ze : !0, - validateFormats: (Te = V.validateFormats) !== null && Te !== void 0 ? Te : !0, - unicodeRegExp: (Pt = V.unicodeRegExp) !== null && Pt !== void 0 ? Pt : !0, - int32range: (Bt = V.int32range) !== null && Bt !== void 0 ? Bt : !0, - uriResolver: st + strictSchema: (I = ($ = V.strictSchema) !== null && $ !== void 0 ? $ : wt) !== null && I !== void 0 ? I : !0, + strictNumbers: (K = (H = V.strictNumbers) !== null && H !== void 0 ? H : wt) !== null && K !== void 0 ? K : !0, + strictTypes: (ne = (te = V.strictTypes) !== null && te !== void 0 ? te : wt) !== null && ne !== void 0 ? ne : "log", + strictTuples: (Ae = (be = V.strictTuples) !== null && be !== void 0 ? be : wt) !== null && Ae !== void 0 ? Ae : "log", + strictRequired: (Zt = (ut = V.strictRequired) !== null && ut !== void 0 ? ut : wt) !== null && Zt !== void 0 ? Zt : !1, + code: V.code ? { ...V.code, optimize: kr, regExp: Ve } : { optimize: kr, regExp: Ve }, + loopRequired: (Yt = V.loopRequired) !== null && Yt !== void 0 ? Yt : T, + loopEnum: (ze = V.loopEnum) !== null && ze !== void 0 ? ze : T, + meta: (Qt = V.meta) !== null && Qt !== void 0 ? Qt : !0, + messages: (Lt = V.messages) !== null && Lt !== void 0 ? Lt : !0, + inlineRefs: (At = V.inlineRefs) !== null && At !== void 0 ? At : !0, + schemaId: (Rt = V.schemaId) !== null && Rt !== void 0 ? Rt : "$id", + addUsedSchema: (Xt = V.addUsedSchema) !== null && Xt !== void 0 ? Xt : !0, + validateSchema: (at = V.validateSchema) !== null && at !== void 0 ? at : !0, + validateFormats: (Re = V.validateFormats) !== null && Re !== void 0 ? Re : !0, + unicodeRegExp: (It = V.unicodeRegExp) !== null && It !== void 0 ? It : !0, + int32range: (er = V.int32range) !== null && er !== void 0 ? er : !0, + uriResolver: vt }; } - class r { - constructor(E = {}) { - this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), E = this.opts = { ...E, ...I(E) }; - const { es5: F, lines: O } = this.opts.code; - this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: F, lines: O }), this.logger = B(E.logger); - const d = E.validateFormats; - E.validateFormats = !1, this.RULES = (0, c.getRules)(), i.call(this, T, E, "NOT SUPPORTED"), i.call(this, v, E, "DEPRECATED", "warn"), this._metaOpts = f.call(this), E.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), E.keywords && m.call(this, E.keywords), typeof E.meta == "object" && this.addMetaSchema(E.meta), l.call(this), E.validateFormats = d; + class n { + constructor(P = {}) { + this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), P = this.opts = { ...P, ...R(P) }; + const { es5: F, lines: L } = this.opts.code; + this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: F, lines: L }), this.logger = z(P.logger); + const h = P.validateFormats; + P.validateFormats = !1, this.RULES = (0, l.getRules)(), i.call(this, x, P, "NOT SUPPORTED"), i.call(this, v, P, "DEPRECATED", "warn"), this._metaOpts = g.call(this), P.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), P.keywords && f.call(this, P.keywords), typeof P.meta == "object" && this.addMetaSchema(P.meta), c.call(this), P.validateFormats = h; } _addVocabularies() { this.addKeyword("$async"); } _addDefaultMetaSchema() { - const { $data: E, meta: F, schemaId: O } = this.opts; - let d = S; - O === "id" && (d = { ...S }, d.id = d.$id, delete d.$id), F && E && this.addMetaSchema(d, d[O], !1); + const { $data: P, meta: F, schemaId: L } = this.opts; + let h = k; + L === "id" && (h = { ...k }, h.id = h.$id, delete h.$id), F && P && this.addMetaSchema(h, h[L], !1); } defaultMeta() { - const { meta: E, schemaId: F } = this.opts; - return this.opts.defaultMeta = typeof E == "object" ? E[F] || E : void 0; - } - validate(E, F) { - let O; - if (typeof E == "string") { - if (O = this.getSchema(E), !O) - throw new Error(`no schema with key or ref "${E}"`); + const { meta: P, schemaId: F } = this.opts; + return this.opts.defaultMeta = typeof P == "object" ? P[F] || P : void 0; + } + validate(P, F) { + let L; + if (typeof P == "string") { + if (L = this.getSchema(P), !L) + throw new Error(`no schema with key or ref "${P}"`); } else - O = this.compile(E); - const d = O(F); - return "$async" in O || (this.errors = O.errors), d; + L = this.compile(P); + const h = L(F); + return "$async" in L || (this.errors = L.errors), h; } - compile(E, F) { - const O = this._addSchema(E, F); - return O.validate || this._compileSchemaEnv(O); + compile(P, F) { + const L = this._addSchema(P, F); + return L.validate || this._compileSchemaEnv(L); } - compileAsync(E, F) { + compileAsync(P, F) { if (typeof this.opts.loadSchema != "function") throw new Error("options.loadSchema should be a function"); - const { loadSchema: O } = this.opts; - return d.call(this, E, F); - async function d(ee, ie) { - await k.call(this, ee.$schema); - const xe = this._addSchema(ee, ie); - return xe.validate || R.call(this, xe); + const { loadSchema: L } = this.opts; + return h.call(this, P, F); + async function h(ne, be) { + await $.call(this, ne.$schema); + const Ae = this._addSchema(ne, be); + return Ae.validate || I.call(this, Ae); } - async function k(ee) { - ee && !this.getSchema(ee) && await d.call(this, { $ref: ee }, !0); + async function $(ne) { + ne && !this.getSchema(ne) && await h.call(this, { $ref: ne }, !0); } - async function R(ee) { + async function I(ne) { try { - return this._compileSchemaEnv(ee); - } catch (ie) { - if (!(ie instanceof s.default)) - throw ie; - return G.call(this, ie), await K.call(this, ie.missingSchema), R.call(this, ee); + return this._compileSchemaEnv(ne); + } catch (be) { + if (!(be instanceof s.default)) + throw be; + return H.call(this, be), await K.call(this, be.missingSchema), I.call(this, ne); } } - function G({ missingSchema: ee, missingRef: ie }) { - if (this.refs[ee]) - throw new Error(`AnySchema ${ee} is loaded but ${ie} cannot be resolved`); + function H({ missingSchema: ne, missingRef: be }) { + if (this.refs[ne]) + throw new Error(`AnySchema ${ne} is loaded but ${be} cannot be resolved`); } - async function K(ee) { - const ie = await X.call(this, ee); - this.refs[ee] || await k.call(this, ie.$schema), this.refs[ee] || this.addSchema(ie, ee, F); + async function K(ne) { + const be = await te.call(this, ne); + this.refs[ne] || await $.call(this, be.$schema), this.refs[ne] || this.addSchema(be, ne, F); } - async function X(ee) { - const ie = this._loading[ee]; - if (ie) - return ie; + async function te(ne) { + const be = this._loading[ne]; + if (be) + return be; try { - return await (this._loading[ee] = O(ee)); + return await (this._loading[ne] = L(ne)); } finally { - delete this._loading[ee]; + delete this._loading[ne]; } } } // Adds schema to the instance - addSchema(E, F, O, d = this.opts.validateSchema) { - if (Array.isArray(E)) { - for (const R of E) - this.addSchema(R, void 0, O, d); + addSchema(P, F, L, h = this.opts.validateSchema) { + if (Array.isArray(P)) { + for (const I of P) + this.addSchema(I, void 0, L, h); return this; } - let k; - if (typeof E == "object") { - const { schemaId: R } = this.opts; - if (k = E[R], k !== void 0 && typeof k != "string") - throw new Error(`schema ${R} must be string`); + let $; + if (typeof P == "object") { + const { schemaId: I } = this.opts; + if ($ = P[I], $ !== void 0 && typeof $ != "string") + throw new Error(`schema ${I} must be string`); } - return F = (0, _.normalizeId)(F || k), this._checkUnique(F), this.schemas[F] = this._addSchema(E, O, F, d, !0), this; + return F = (0, _.normalizeId)(F || $), this._checkUnique(F), this.schemas[F] = this._addSchema(P, L, F, h, !0), this; } // Add schema that will be used to validate other schemas // options in META_IGNORE_OPTIONS are alway set to false - addMetaSchema(E, F, O = this.opts.validateSchema) { - return this.addSchema(E, F, !0, O), this; + addMetaSchema(P, F, L = this.opts.validateSchema) { + return this.addSchema(P, F, !0, L), this; } // Validate schema against its meta-schema - validateSchema(E, F) { - if (typeof E == "boolean") + validateSchema(P, F) { + if (typeof P == "boolean") return !0; - let O; - if (O = E.$schema, O !== void 0 && typeof O != "string") + let L; + if (L = P.$schema, L !== void 0 && typeof L != "string") throw new Error("$schema must be a string"); - if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O) + if (L = L || this.opts.defaultMeta || this.defaultMeta(), !L) return this.logger.warn("meta-schema not available"), this.errors = null, !0; - const d = this.validate(O, E); - if (!d && F) { - const k = "schema is invalid: " + this.errorsText(); + const h = this.validate(L, P); + if (!h && F) { + const $ = "schema is invalid: " + this.errorsText(); if (this.opts.validateSchema === "log") - this.logger.error(k); + this.logger.error($); else - throw new Error(k); + throw new Error($); } - return d; + return h; } // Get compiled schema by `key` or `ref`. // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) - getSchema(E) { + getSchema(P) { let F; - for (; typeof (F = o.call(this, E)) == "string"; ) - E = F; + for (; typeof (F = o.call(this, P)) == "string"; ) + P = F; if (F === void 0) { - const { schemaId: O } = this.opts, d = new p.SchemaEnv({ schema: {}, schemaId: O }); - if (F = p.resolveSchema.call(this, d, E), !F) + const { schemaId: L } = this.opts, h = new d.SchemaEnv({ schema: {}, schemaId: L }); + if (F = d.resolveSchema.call(this, h, P), !F) return; - this.refs[E] = F; + this.refs[P] = F; } return F.validate || this._compileSchemaEnv(F); } @@ -3030,225 +3034,225 @@ Ho.default = il; // If no parameter is passed all schemas but meta-schemas are removed. // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - removeSchema(E) { - if (E instanceof RegExp) - return this._removeAllSchemas(this.schemas, E), this._removeAllSchemas(this.refs, E), this; - switch (typeof E) { + removeSchema(P) { + if (P instanceof RegExp) + return this._removeAllSchemas(this.schemas, P), this._removeAllSchemas(this.refs, P), this; + switch (typeof P) { case "undefined": return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; case "string": { - const F = o.call(this, E); - return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[E], delete this.refs[E], this; + const F = o.call(this, P); + return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[P], delete this.refs[P], this; } case "object": { - const F = E; + const F = P; this._cache.delete(F); - let O = E[this.opts.schemaId]; - return O && (O = (0, _.normalizeId)(O), delete this.schemas[O], delete this.refs[O]), this; + let L = P[this.opts.schemaId]; + return L && (L = (0, _.normalizeId)(L), delete this.schemas[L], delete this.refs[L]), this; } default: throw new Error("ajv.removeSchema: invalid parameter"); } } // add "vocabulary" - a collection of keywords - addVocabulary(E) { - for (const F of E) + addVocabulary(P) { + for (const F of P) this.addKeyword(F); return this; } - addKeyword(E, F) { - let O; - if (typeof E == "string") - O = E, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = O); - else if (typeof E == "object" && F === void 0) { - if (F = E, O = F.keyword, Array.isArray(O) && !O.length) + addKeyword(P, F) { + let L; + if (typeof P == "string") + L = P, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = L); + else if (typeof P == "object" && F === void 0) { + if (F = P, L = F.keyword, Array.isArray(L) && !L.length) throw new Error("addKeywords: keyword must be string or non-empty array"); } else throw new Error("invalid addKeywords parameters"); - if (z.call(this, O, F), !F) - return (0, g.eachItem)(O, (k) => H.call(this, k)), this; - q.call(this, F); - const d = { + if (B.call(this, L, F), !F) + return (0, m.eachItem)(L, ($) => G.call(this, $)), this; + U.call(this, F); + const h = { ...F, type: (0, y.getJSONTypes)(F.type), schemaType: (0, y.getJSONTypes)(F.schemaType) }; - return (0, g.eachItem)(O, d.type.length === 0 ? (k) => H.call(this, k, d) : (k) => d.type.forEach((R) => H.call(this, k, d, R))), this; + return (0, m.eachItem)(L, h.type.length === 0 ? ($) => G.call(this, $, h) : ($) => h.type.forEach((I) => G.call(this, $, h, I))), this; } - getKeyword(E) { - const F = this.RULES.all[E]; + getKeyword(P) { + const F = this.RULES.all[P]; return typeof F == "object" ? F.definition : !!F; } // Remove keyword - removeKeyword(E) { + removeKeyword(P) { const { RULES: F } = this; - delete F.keywords[E], delete F.all[E]; - for (const O of F.rules) { - const d = O.rules.findIndex((k) => k.keyword === E); - d >= 0 && O.rules.splice(d, 1); + delete F.keywords[P], delete F.all[P]; + for (const L of F.rules) { + const h = L.rules.findIndex(($) => $.keyword === P); + h >= 0 && L.rules.splice(h, 1); } return this; } // Add format - addFormat(E, F) { - return typeof F == "string" && (F = new RegExp(F)), this.formats[E] = F, this; - } - errorsText(E = this.errors, { separator: F = ", ", dataVar: O = "data" } = {}) { - return !E || E.length === 0 ? "No errors" : E.map((d) => `${O}${d.instancePath} ${d.message}`).reduce((d, k) => d + F + k); - } - $dataMetaSchema(E, F) { - const O = this.RULES.all; - E = JSON.parse(JSON.stringify(E)); - for (const d of F) { - const k = d.split("/").slice(1); - let R = E; - for (const G of k) - R = R[G]; - for (const G in O) { - const K = O[G]; + addFormat(P, F) { + return typeof F == "string" && (F = new RegExp(F)), this.formats[P] = F, this; + } + errorsText(P = this.errors, { separator: F = ", ", dataVar: L = "data" } = {}) { + return !P || P.length === 0 ? "No errors" : P.map((h) => `${L}${h.instancePath} ${h.message}`).reduce((h, $) => h + F + $); + } + $dataMetaSchema(P, F) { + const L = this.RULES.all; + P = JSON.parse(JSON.stringify(P)); + for (const h of F) { + const $ = h.split("/").slice(1); + let I = P; + for (const H of $) + I = I[H]; + for (const H in L) { + const K = L[H]; if (typeof K != "object") continue; - const { $data: X } = K.definition, ee = R[G]; - X && ee && (R[G] = J(ee)); + const { $data: te } = K.definition, ne = I[H]; + te && ne && (I[H] = J(ne)); } } - return E; + return P; } - _removeAllSchemas(E, F) { - for (const O in E) { - const d = E[O]; - (!F || F.test(O)) && (typeof d == "string" ? delete E[O] : d && !d.meta && (this._cache.delete(d.schema), delete E[O])); + _removeAllSchemas(P, F) { + for (const L in P) { + const h = P[L]; + (!F || F.test(L)) && (typeof h == "string" ? delete P[L] : h && !h.meta && (this._cache.delete(h.schema), delete P[L])); } } - _addSchema(E, F, O, d = this.opts.validateSchema, k = this.opts.addUsedSchema) { - let R; - const { schemaId: G } = this.opts; - if (typeof E == "object") - R = E[G]; + _addSchema(P, F, L, h = this.opts.validateSchema, $ = this.opts.addUsedSchema) { + let I; + const { schemaId: H } = this.opts; + if (typeof P == "object") + I = P[H]; else { if (this.opts.jtd) throw new Error("schema must be object"); - if (typeof E != "boolean") + if (typeof P != "boolean") throw new Error("schema must be object or boolean"); } - let K = this._cache.get(E); + let K = this._cache.get(P); if (K !== void 0) return K; - O = (0, _.normalizeId)(R || O); - const X = _.getSchemaRefs.call(this, E, O); - return K = new p.SchemaEnv({ schema: E, schemaId: G, meta: F, baseId: O, localRefs: X }), this._cache.set(K.schema, K), k && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = K), d && this.validateSchema(E, !0), K; + L = (0, _.normalizeId)(I || L); + const te = _.getSchemaRefs.call(this, P, L); + return K = new d.SchemaEnv({ schema: P, schemaId: H, meta: F, baseId: L, localRefs: te }), this._cache.set(K.schema, K), $ && !L.startsWith("#") && (L && this._checkUnique(L), this.refs[L] = K), h && this.validateSchema(P, !0), K; } - _checkUnique(E) { - if (this.schemas[E] || this.refs[E]) - throw new Error(`schema with key or id "${E}" already exists`); + _checkUnique(P) { + if (this.schemas[P] || this.refs[P]) + throw new Error(`schema with key or id "${P}" already exists`); } - _compileSchemaEnv(E) { - if (E.meta ? this._compileMetaSchema(E) : p.compileSchema.call(this, E), !E.validate) + _compileSchemaEnv(P) { + if (P.meta ? this._compileMetaSchema(P) : d.compileSchema.call(this, P), !P.validate) throw new Error("ajv implementation error"); - return E.validate; + return P.validate; } - _compileMetaSchema(E) { + _compileMetaSchema(P) { const F = this.opts; this.opts = this._metaOpts; try { - p.compileSchema.call(this, E); + d.compileSchema.call(this, P); } finally { this.opts = F; } } } - e.default = r, r.ValidationError = n.default, r.MissingRefError = s.default; - function i(V, E, F, O = "error") { - for (const d in V) { - const k = d; - k in E && this.logger[O](`${F}: option ${d}. ${V[k]}`); + e.default = n, n.ValidationError = a.default, n.MissingRefError = s.default; + function i(V, P, F, L = "error") { + for (const h in V) { + const $ = h; + $ in P && this.logger[L](`${F}: option ${h}. ${V[$]}`); } } function o(V) { return V = (0, _.normalizeId)(V), this.schemas[V] || this.refs[V]; } - function l() { + function c() { const V = this.opts.schemas; if (V) if (Array.isArray(V)) this.addSchema(V); else - for (const E in V) - this.addSchema(V[E], E); + for (const P in V) + this.addSchema(V[P], P); } function u() { for (const V in this.opts.formats) { - const E = this.opts.formats[V]; - E && this.addFormat(V, E); + const P = this.opts.formats[V]; + P && this.addFormat(V, P); } } - function m(V) { + function f(V) { if (Array.isArray(V)) { this.addVocabulary(V); return; } this.logger.warn("keywords option as map is deprecated, pass array"); - for (const E in V) { - const F = V[E]; - F.keyword || (F.keyword = E), this.addKeyword(F); + for (const P in V) { + const F = V[P]; + F.keyword || (F.keyword = P), this.addKeyword(F); } } - function f() { + function g() { const V = { ...this.opts }; - for (const E of N) - delete V[E]; + for (const P of j) + delete V[P]; return V; } - const x = { log() { + const O = { log() { }, warn() { }, error() { } }; - function B(V) { + function z(V) { if (V === !1) - return x; + return O; if (V === void 0) return console; if (V.log && V.warn && V.error) return V; throw new Error("logger must implement log, warn and error methods"); } - const U = /^[a-z_$][a-z0-9_$:-]*$/i; - function z(V, E) { + const q = /^[a-z_$][a-z0-9_$:-]*$/i; + function B(V, P) { const { RULES: F } = this; - if ((0, g.eachItem)(V, (O) => { - if (F.keywords[O]) - throw new Error(`Keyword ${O} is already defined`); - if (!U.test(O)) - throw new Error(`Keyword ${O} has invalid name`); - }), !!E && E.$data && !("code" in E || "validate" in E)) + if ((0, m.eachItem)(V, (L) => { + if (F.keywords[L]) + throw new Error(`Keyword ${L} is already defined`); + if (!q.test(L)) + throw new Error(`Keyword ${L} has invalid name`); + }), !!P && P.$data && !("code" in P || "validate" in P)) throw new Error('$data keyword must have "code" or "validate" function'); } - function H(V, E, F) { - var O; - const d = E == null ? void 0 : E.post; - if (F && d) + function G(V, P, F) { + var L; + const h = P == null ? void 0 : P.post; + if (F && h) throw new Error('keyword with "post" flag cannot have "type"'); - const { RULES: k } = this; - let R = d ? k.post : k.rules.find(({ type: K }) => K === F); - if (R || (R = { type: F, rules: [] }, k.rules.push(R)), k.keywords[V] = !0, !E) + const { RULES: $ } = this; + let I = h ? $.post : $.rules.find(({ type: K }) => K === F); + if (I || (I = { type: F, rules: [] }, $.rules.push(I)), $.keywords[V] = !0, !P) return; - const G = { + const H = { keyword: V, definition: { - ...E, - type: (0, y.getJSONTypes)(E.type), - schemaType: (0, y.getJSONTypes)(E.schemaType) + ...P, + type: (0, y.getJSONTypes)(P.type), + schemaType: (0, y.getJSONTypes)(P.schemaType) } }; - E.before ? w.call(this, R, G, E.before) : R.rules.push(G), k.all[V] = G, (O = E.implements) === null || O === void 0 || O.forEach((K) => this.addKeyword(K)); + P.before ? w.call(this, I, H, P.before) : I.rules.push(H), $.all[V] = H, (L = P.implements) === null || L === void 0 || L.forEach((K) => this.addKeyword(K)); } - function w(V, E, F) { - const O = V.rules.findIndex((d) => d.keyword === F); - O >= 0 ? V.rules.splice(O, 0, E) : (V.rules.push(E), this.logger.warn(`rule ${F} is not defined`)); + function w(V, P, F) { + const L = V.rules.findIndex((h) => h.keyword === F); + L >= 0 ? V.rules.splice(L, 0, P) : (V.rules.push(P), this.logger.warn(`rule ${F} is not defined`)); } - function q(V) { - let { metaSchema: E } = V; - E !== void 0 && (V.$data && this.opts.$data && (E = J(E)), V.validateSchema = this.compile(E, !0)); + function U(V) { + let { metaSchema: P } = V; + P !== void 0 && (V.$data && this.opts.$data && (P = J(P)), V.validateSchema = this.compile(P, !0)); } const W = { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" @@ -3256,580 +3260,580 @@ Ho.default = il; function J(V) { return { anyOf: [V, W] }; } -})(Ac); -var Go = {}, Ko = {}, Wo = {}; -Object.defineProperty(Wo, "__esModule", { value: !0 }); -const wh = { +})(so); +var $a = {}, Pa = {}, Sa = {}; +Object.defineProperty(Sa, "__esModule", { value: !0 }); +const ol = { keyword: "id", code() { throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); } }; -Wo.default = wh; -var Ur = {}; -Object.defineProperty(Ur, "__esModule", { value: !0 }); -Ur.callRef = Ur.getValidate = void 0; -const vh = Za, Ei = be, bt = we, Kr = cr, Pi = wt, an = $e, $h = { +Sa.default = ol; +var jt = {}; +Object.defineProperty(jt, "__esModule", { value: !0 }); +jt.callRef = jt.getValidate = void 0; +const sl = wr, Tn = se, De = ie, zt = ct, Cn = Be, Tr = ce, il = { keyword: "$ref", schemaType: "string", code(e) { - const { gen: t, schema: a, it: n } = e, { baseId: s, schemaEnv: c, validateName: p, opts: b, self: _ } = n, { root: y } = c; - if ((a === "#" || a === "#/") && s === y.baseId) - return S(); - const g = Pi.resolveRef.call(_, y, s, a); - if (g === void 0) - throw new vh.default(n.opts.uriResolver, s, a); - if (g instanceof Pi.SchemaEnv) - return L(g); - return A(g); - function S() { - if (c === y) - return bn(e, p, c, c.$async); - const N = t.scopeValue("root", { ref: y }); - return bn(e, (0, bt._)`${N}.validate`, y, y.$async); - } - function L(N) { - const C = cl(e, N); - bn(e, C, N, N.$async); - } - function A(N) { - const C = t.scopeValue("schema", b.code.source === !0 ? { ref: N, code: (0, bt.stringify)(N) } : { ref: N }), T = t.name("valid"), v = e.subschema({ - schema: N, + const { gen: t, schema: r, it: a } = e, { baseId: s, schemaEnv: l, validateName: d, opts: b, self: _ } = a, { root: y } = l; + if ((r === "#" || r === "#/") && s === y.baseId) + return k(); + const m = Cn.resolveRef.call(_, y, s, r); + if (m === void 0) + throw new sl.default(a.opts.uriResolver, s, r); + if (m instanceof Cn.SchemaEnv) + return N(m); + return A(m); + function k() { + if (l === y) + return Rr(e, d, l, l.$async); + const j = t.scopeValue("root", { ref: y }); + return Rr(e, (0, De._)`${j}.validate`, y, y.$async); + } + function N(j) { + const C = Lo(e, j); + Rr(e, C, j, j.$async); + } + function A(j) { + const C = t.scopeValue("schema", b.code.source === !0 ? { ref: j, code: (0, De.stringify)(j) } : { ref: j }), x = t.name("valid"), v = e.subschema({ + schema: j, dataTypes: [], - schemaPath: bt.nil, + schemaPath: De.nil, topSchemaRef: C, - errSchemaPath: a - }, T); - e.mergeEvaluated(v), e.ok(T); + errSchemaPath: r + }, x); + e.mergeEvaluated(v), e.ok(x); } } }; -function cl(e, t) { - const { gen: a } = e; - return t.validate ? a.scopeValue("validate", { ref: t.validate }) : (0, bt._)`${a.scopeValue("wrapper", { ref: t })}.validate`; -} -Ur.getValidate = cl; -function bn(e, t, a, n) { - const { gen: s, it: c } = e, { allErrors: p, schemaEnv: b, opts: _ } = c, y = _.passContext ? Kr.default.this : bt.nil; - n ? g() : S(); - function g() { +function Lo(e, t) { + const { gen: r } = e; + return t.validate ? r.scopeValue("validate", { ref: t.validate }) : (0, De._)`${r.scopeValue("wrapper", { ref: t })}.validate`; +} +jt.getValidate = Lo; +function Rr(e, t, r, a) { + const { gen: s, it: l } = e, { allErrors: d, schemaEnv: b, opts: _ } = l, y = _.passContext ? zt.default.this : De.nil; + a ? m() : k(); + function m() { if (!b.$async) throw new Error("async schema referenced by sync schema"); - const N = s.let("valid"); + const j = s.let("valid"); s.try(() => { - s.code((0, bt._)`await ${(0, Ei.callValidateCode)(e, t, y)}`), A(t), p || s.assign(N, !0); + s.code((0, De._)`await ${(0, Tn.callValidateCode)(e, t, y)}`), A(t), d || s.assign(j, !0); }, (C) => { - s.if((0, bt._)`!(${C} instanceof ${c.ValidationError})`, () => s.throw(C)), L(C), p || s.assign(N, !1); - }), e.ok(N); + s.if((0, De._)`!(${C} instanceof ${l.ValidationError})`, () => s.throw(C)), N(C), d || s.assign(j, !1); + }), e.ok(j); } - function S() { - e.result((0, Ei.callValidateCode)(e, t, y), () => A(t), () => L(t)); + function k() { + e.result((0, Tn.callValidateCode)(e, t, y), () => A(t), () => N(t)); } - function L(N) { - const C = (0, bt._)`${N}.errors`; - s.assign(Kr.default.vErrors, (0, bt._)`${Kr.default.vErrors} === null ? ${C} : ${Kr.default.vErrors}.concat(${C})`), s.assign(Kr.default.errors, (0, bt._)`${Kr.default.vErrors}.length`); + function N(j) { + const C = (0, De._)`${j}.errors`; + s.assign(zt.default.vErrors, (0, De._)`${zt.default.vErrors} === null ? ${C} : ${zt.default.vErrors}.concat(${C})`), s.assign(zt.default.errors, (0, De._)`${zt.default.vErrors}.length`); } - function A(N) { + function A(j) { var C; - if (!c.opts.unevaluated) + if (!l.opts.unevaluated) return; - const T = (C = a == null ? void 0 : a.validate) === null || C === void 0 ? void 0 : C.evaluated; - if (c.props !== !0) - if (T && !T.dynamicProps) - T.props !== void 0 && (c.props = an.mergeEvaluated.props(s, T.props, c.props)); + const x = (C = r == null ? void 0 : r.validate) === null || C === void 0 ? void 0 : C.evaluated; + if (l.props !== !0) + if (x && !x.dynamicProps) + x.props !== void 0 && (l.props = Tr.mergeEvaluated.props(s, x.props, l.props)); else { - const v = s.var("props", (0, bt._)`${N}.evaluated.props`); - c.props = an.mergeEvaluated.props(s, v, c.props, bt.Name); + const v = s.var("props", (0, De._)`${j}.evaluated.props`); + l.props = Tr.mergeEvaluated.props(s, v, l.props, De.Name); } - if (c.items !== !0) - if (T && !T.dynamicItems) - T.items !== void 0 && (c.items = an.mergeEvaluated.items(s, T.items, c.items)); + if (l.items !== !0) + if (x && !x.dynamicItems) + x.items !== void 0 && (l.items = Tr.mergeEvaluated.items(s, x.items, l.items)); else { - const v = s.var("items", (0, bt._)`${N}.evaluated.items`); - c.items = an.mergeEvaluated.items(s, v, c.items, bt.Name); + const v = s.var("items", (0, De._)`${j}.evaluated.items`); + l.items = Tr.mergeEvaluated.items(s, v, l.items, De.Name); } } } -Ur.callRef = bn; -Ur.default = $h; -Object.defineProperty(Ko, "__esModule", { value: !0 }); -const kh = Wo, Eh = Ur, Ph = [ +jt.callRef = Rr; +jt.default = il; +Object.defineProperty(Pa, "__esModule", { value: !0 }); +const ll = Sa, cl = jt, ul = [ "$schema", "$id", "$defs", "$vocabulary", { keyword: "$comment" }, "definitions", - kh.default, - Eh.default + ll.default, + cl.default ]; -Ko.default = Ph; -var Jo = {}, Zo = {}; -Object.defineProperty(Zo, "__esModule", { value: !0 }); -const Tn = we, wr = Tn.operators, jn = { - maximum: { okStr: "<=", ok: wr.LTE, fail: wr.GT }, - minimum: { okStr: ">=", ok: wr.GTE, fail: wr.LT }, - exclusiveMaximum: { okStr: "<", ok: wr.LT, fail: wr.GTE }, - exclusiveMinimum: { okStr: ">", ok: wr.GT, fail: wr.LTE } -}, Sh = { - message: ({ keyword: e, schemaCode: t }) => (0, Tn.str)`must be ${jn[e].okStr} ${t}`, - params: ({ keyword: e, schemaCode: t }) => (0, Tn._)`{comparison: ${jn[e].okStr}, limit: ${t}}` -}, xh = { - keyword: Object.keys(jn), +Pa.default = ul; +var Ta = {}, Ca = {}; +Object.defineProperty(Ca, "__esModule", { value: !0 }); +const Vr = ie, gt = Vr.operators, Fr = { + maximum: { okStr: "<=", ok: gt.LTE, fail: gt.GT }, + minimum: { okStr: ">=", ok: gt.GTE, fail: gt.LT }, + exclusiveMaximum: { okStr: "<", ok: gt.LT, fail: gt.GTE }, + exclusiveMinimum: { okStr: ">", ok: gt.GT, fail: gt.LTE } +}, dl = { + message: ({ keyword: e, schemaCode: t }) => (0, Vr.str)`must be ${Fr[e].okStr} ${t}`, + params: ({ keyword: e, schemaCode: t }) => (0, Vr._)`{comparison: ${Fr[e].okStr}, limit: ${t}}` +}, hl = { + keyword: Object.keys(Fr), type: "number", schemaType: "number", $data: !0, - error: Sh, + error: dl, code(e) { - const { keyword: t, data: a, schemaCode: n } = e; - e.fail$data((0, Tn._)`${a} ${jn[t].fail} ${n} || isNaN(${a})`); + const { keyword: t, data: r, schemaCode: a } = e; + e.fail$data((0, Vr._)`${r} ${Fr[t].fail} ${a} || isNaN(${r})`); } }; -Zo.default = xh; -var Yo = {}; -Object.defineProperty(Yo, "__esModule", { value: !0 }); -const Ra = we, Th = { - message: ({ schemaCode: e }) => (0, Ra.str)`must be multiple of ${e}`, - params: ({ schemaCode: e }) => (0, Ra._)`{multipleOf: ${e}}` -}, jh = { +Ca.default = hl; +var xa = {}; +Object.defineProperty(xa, "__esModule", { value: !0 }); +const ur = ie, pl = { + message: ({ schemaCode: e }) => (0, ur.str)`must be multiple of ${e}`, + params: ({ schemaCode: e }) => (0, ur._)`{multipleOf: ${e}}` +}, fl = { keyword: "multipleOf", type: "number", schemaType: "number", $data: !0, - error: Th, + error: pl, code(e) { - const { gen: t, data: a, schemaCode: n, it: s } = e, c = s.opts.multipleOfPrecision, p = t.let("res"), b = c ? (0, Ra._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${c}` : (0, Ra._)`${p} !== parseInt(${p})`; - e.fail$data((0, Ra._)`(${n} === 0 || (${p} = ${a}/${n}, ${b}))`); + const { gen: t, data: r, schemaCode: a, it: s } = e, l = s.opts.multipleOfPrecision, d = t.let("res"), b = l ? (0, ur._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${l}` : (0, ur._)`${d} !== parseInt(${d})`; + e.fail$data((0, ur._)`(${a} === 0 || (${d} = ${r}/${a}, ${b}))`); } }; -Yo.default = jh; -var Qo = {}, Xo = {}; -Object.defineProperty(Xo, "__esModule", { value: !0 }); -function ll(e) { +xa.default = fl; +var Oa = {}, Na = {}; +Object.defineProperty(Na, "__esModule", { value: !0 }); +function Ao(e) { const t = e.length; - let a = 0, n = 0, s; - for (; n < t; ) - a++, s = e.charCodeAt(n++), s >= 55296 && s <= 56319 && n < t && (s = e.charCodeAt(n), (s & 64512) === 56320 && n++); - return a; -} -Xo.default = ll; -ll.code = 'require("ajv/dist/runtime/ucs2length").default'; -Object.defineProperty(Qo, "__esModule", { value: !0 }); -const Mr = we, Ch = $e, Oh = Xo, Nh = { + let r = 0, a = 0, s; + for (; a < t; ) + r++, s = e.charCodeAt(a++), s >= 55296 && s <= 56319 && a < t && (s = e.charCodeAt(a), (s & 64512) === 56320 && a++); + return r; +} +Na.default = Ao; +Ao.code = 'require("ajv/dist/runtime/ucs2length").default'; +Object.defineProperty(Oa, "__esModule", { value: !0 }); +const xt = ie, ml = ce, gl = Na, bl = { message({ keyword: e, schemaCode: t }) { - const a = e === "maxLength" ? "more" : "fewer"; - return (0, Mr.str)`must NOT have ${a} than ${t} characters`; + const r = e === "maxLength" ? "more" : "fewer"; + return (0, xt.str)`must NOT have ${r} than ${t} characters`; }, - params: ({ schemaCode: e }) => (0, Mr._)`{limit: ${e}}` -}, Lh = { + params: ({ schemaCode: e }) => (0, xt._)`{limit: ${e}}` +}, yl = { keyword: ["maxLength", "minLength"], type: "string", schemaType: "number", $data: !0, - error: Nh, + error: bl, code(e) { - const { keyword: t, data: a, schemaCode: n, it: s } = e, c = t === "maxLength" ? Mr.operators.GT : Mr.operators.LT, p = s.opts.unicode === !1 ? (0, Mr._)`${a}.length` : (0, Mr._)`${(0, Ch.useFunc)(e.gen, Oh.default)}(${a})`; - e.fail$data((0, Mr._)`${p} ${c} ${n}`); + const { keyword: t, data: r, schemaCode: a, it: s } = e, l = t === "maxLength" ? xt.operators.GT : xt.operators.LT, d = s.opts.unicode === !1 ? (0, xt._)`${r}.length` : (0, xt._)`${(0, ml.useFunc)(e.gen, gl.default)}(${r})`; + e.fail$data((0, xt._)`${d} ${l} ${a}`); } }; -Qo.default = Lh; -var es = {}; -Object.defineProperty(es, "__esModule", { value: !0 }); -const Rh = be, Cn = we, Ih = { - message: ({ schemaCode: e }) => (0, Cn.str)`must match pattern "${e}"`, - params: ({ schemaCode: e }) => (0, Cn._)`{pattern: ${e}}` -}, Ah = { +Oa.default = yl; +var ja = {}; +Object.defineProperty(ja, "__esModule", { value: !0 }); +const _l = se, qr = ie, wl = { + message: ({ schemaCode: e }) => (0, qr.str)`must match pattern "${e}"`, + params: ({ schemaCode: e }) => (0, qr._)`{pattern: ${e}}` +}, vl = { keyword: "pattern", type: "string", schemaType: "string", $data: !0, - error: Ih, + error: wl, code(e) { - const { data: t, $data: a, schema: n, schemaCode: s, it: c } = e, p = c.opts.unicodeRegExp ? "u" : "", b = a ? (0, Cn._)`(new RegExp(${s}, ${p}))` : (0, Rh.usePattern)(e, n); - e.fail$data((0, Cn._)`!${b}.test(${t})`); + const { data: t, $data: r, schema: a, schemaCode: s, it: l } = e, d = l.opts.unicodeRegExp ? "u" : "", b = r ? (0, qr._)`(new RegExp(${s}, ${d}))` : (0, _l.usePattern)(e, a); + e.fail$data((0, qr._)`!${b}.test(${t})`); } }; -es.default = Ah; -var ts = {}; -Object.defineProperty(ts, "__esModule", { value: !0 }); -const Ia = we, Mh = { +ja.default = vl; +var La = {}; +Object.defineProperty(La, "__esModule", { value: !0 }); +const dr = ie, kl = { message({ keyword: e, schemaCode: t }) { - const a = e === "maxProperties" ? "more" : "fewer"; - return (0, Ia.str)`must NOT have ${a} than ${t} properties`; + const r = e === "maxProperties" ? "more" : "fewer"; + return (0, dr.str)`must NOT have ${r} than ${t} properties`; }, - params: ({ schemaCode: e }) => (0, Ia._)`{limit: ${e}}` -}, Dh = { + params: ({ schemaCode: e }) => (0, dr._)`{limit: ${e}}` +}, El = { keyword: ["maxProperties", "minProperties"], type: "object", schemaType: "number", $data: !0, - error: Mh, + error: kl, code(e) { - const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxProperties" ? Ia.operators.GT : Ia.operators.LT; - e.fail$data((0, Ia._)`Object.keys(${a}).length ${s} ${n}`); + const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxProperties" ? dr.operators.GT : dr.operators.LT; + e.fail$data((0, dr._)`Object.keys(${r}).length ${s} ${a}`); } }; -ts.default = Dh; -var rs = {}; -Object.defineProperty(rs, "__esModule", { value: !0 }); -const Sa = be, Aa = we, zh = $e, Bh = { - message: ({ params: { missingProperty: e } }) => (0, Aa.str)`must have required property '${e}'`, - params: ({ params: { missingProperty: e } }) => (0, Aa._)`{missingProperty: ${e}}` -}, Vh = { +La.default = El; +var Aa = {}; +Object.defineProperty(Aa, "__esModule", { value: !0 }); +const or = se, hr = ie, $l = ce, Pl = { + message: ({ params: { missingProperty: e } }) => (0, hr.str)`must have required property '${e}'`, + params: ({ params: { missingProperty: e } }) => (0, hr._)`{missingProperty: ${e}}` +}, Sl = { keyword: "required", type: "object", schemaType: "array", $data: !0, - error: Bh, + error: Pl, code(e) { - const { gen: t, schema: a, schemaCode: n, data: s, $data: c, it: p } = e, { opts: b } = p; - if (!c && a.length === 0) + const { gen: t, schema: r, schemaCode: a, data: s, $data: l, it: d } = e, { opts: b } = d; + if (!l && r.length === 0) return; - const _ = a.length >= b.loopRequired; - if (p.allErrors ? y() : g(), b.strictRequired) { - const A = e.parentSchema.properties, { definedProperties: N } = e.it; - for (const C of a) - if ((A == null ? void 0 : A[C]) === void 0 && !N.has(C)) { - const T = p.schemaEnv.baseId + p.errSchemaPath, v = `required property "${C}" is not defined at "${T}" (strictRequired)`; - (0, zh.checkStrictMode)(p, v, p.opts.strictRequired); + const _ = r.length >= b.loopRequired; + if (d.allErrors ? y() : m(), b.strictRequired) { + const A = e.parentSchema.properties, { definedProperties: j } = e.it; + for (const C of r) + if ((A == null ? void 0 : A[C]) === void 0 && !j.has(C)) { + const x = d.schemaEnv.baseId + d.errSchemaPath, v = `required property "${C}" is not defined at "${x}" (strictRequired)`; + (0, $l.checkStrictMode)(d, v, d.opts.strictRequired); } } function y() { - if (_ || c) - e.block$data(Aa.nil, S); + if (_ || l) + e.block$data(hr.nil, k); else - for (const A of a) - (0, Sa.checkReportMissingProp)(e, A); + for (const A of r) + (0, or.checkReportMissingProp)(e, A); } - function g() { + function m() { const A = t.let("missing"); - if (_ || c) { - const N = t.let("valid", !0); - e.block$data(N, () => L(A, N)), e.ok(N); + if (_ || l) { + const j = t.let("valid", !0); + e.block$data(j, () => N(A, j)), e.ok(j); } else - t.if((0, Sa.checkMissingProp)(e, a, A)), (0, Sa.reportMissingProp)(e, A), t.else(); + t.if((0, or.checkMissingProp)(e, r, A)), (0, or.reportMissingProp)(e, A), t.else(); } - function S() { - t.forOf("prop", n, (A) => { - e.setParams({ missingProperty: A }), t.if((0, Sa.noPropertyInData)(t, s, A, b.ownProperties), () => e.error()); + function k() { + t.forOf("prop", a, (A) => { + e.setParams({ missingProperty: A }), t.if((0, or.noPropertyInData)(t, s, A, b.ownProperties), () => e.error()); }); } - function L(A, N) { - e.setParams({ missingProperty: A }), t.forOf(A, n, () => { - t.assign(N, (0, Sa.propertyInData)(t, s, A, b.ownProperties)), t.if((0, Aa.not)(N), () => { + function N(A, j) { + e.setParams({ missingProperty: A }), t.forOf(A, a, () => { + t.assign(j, (0, or.propertyInData)(t, s, A, b.ownProperties)), t.if((0, hr.not)(j), () => { e.error(), t.break(); }); - }, Aa.nil); + }, hr.nil); } } }; -rs.default = Vh; -var as = {}; -Object.defineProperty(as, "__esModule", { value: !0 }); -const Ma = we, Fh = { +Aa.default = Sl; +var Ra = {}; +Object.defineProperty(Ra, "__esModule", { value: !0 }); +const pr = ie, Tl = { message({ keyword: e, schemaCode: t }) { - const a = e === "maxItems" ? "more" : "fewer"; - return (0, Ma.str)`must NOT have ${a} than ${t} items`; + const r = e === "maxItems" ? "more" : "fewer"; + return (0, pr.str)`must NOT have ${r} than ${t} items`; }, - params: ({ schemaCode: e }) => (0, Ma._)`{limit: ${e}}` -}, Uh = { + params: ({ schemaCode: e }) => (0, pr._)`{limit: ${e}}` +}, Cl = { keyword: ["maxItems", "minItems"], type: "array", schemaType: "number", $data: !0, - error: Fh, + error: Tl, code(e) { - const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxItems" ? Ma.operators.GT : Ma.operators.LT; - e.fail$data((0, Ma._)`${a}.length ${s} ${n}`); + const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxItems" ? pr.operators.GT : pr.operators.LT; + e.fail$data((0, pr._)`${r}.length ${s} ${a}`); } }; -as.default = Uh; -var ns = {}, Ya = {}; -Object.defineProperty(Ya, "__esModule", { value: !0 }); -const ul = qc; -ul.code = 'require("ajv/dist/runtime/equal").default'; -Ya.default = ul; -Object.defineProperty(ns, "__esModule", { value: !0 }); -const ho = Wa, Xe = we, qh = $e, Hh = Ya, Gh = { - message: ({ params: { i: e, j: t } }) => (0, Xe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`, - params: ({ params: { i: e, j: t } }) => (0, Xe._)`{i: ${e}, j: ${t}}` -}, Kh = { +Ra.default = Cl; +var Ia = {}, vr = {}; +Object.defineProperty(vr, "__esModule", { value: !0 }); +const Ro = mo; +Ro.code = 'require("ajv/dist/runtime/equal").default'; +vr.default = Ro; +Object.defineProperty(Ia, "__esModule", { value: !0 }); +const oa = yr, Ce = ie, xl = ce, Ol = vr, Nl = { + message: ({ params: { i: e, j: t } }) => (0, Ce.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`, + params: ({ params: { i: e, j: t } }) => (0, Ce._)`{i: ${e}, j: ${t}}` +}, jl = { keyword: "uniqueItems", type: "array", schemaType: "boolean", $data: !0, - error: Gh, + error: Nl, code(e) { - const { gen: t, data: a, $data: n, schema: s, parentSchema: c, schemaCode: p, it: b } = e; - if (!n && !s) + const { gen: t, data: r, $data: a, schema: s, parentSchema: l, schemaCode: d, it: b } = e; + if (!a && !s) return; - const _ = t.let("valid"), y = c.items ? (0, ho.getSchemaTypes)(c.items) : []; - e.block$data(_, g, (0, Xe._)`${p} === false`), e.ok(_); - function g() { - const N = t.let("i", (0, Xe._)`${a}.length`), C = t.let("j"); - e.setParams({ i: N, j: C }), t.assign(_, !0), t.if((0, Xe._)`${N} > 1`, () => (S() ? L : A)(N, C)); - } - function S() { - return y.length > 0 && !y.some((N) => N === "object" || N === "array"); - } - function L(N, C) { - const T = t.name("item"), v = (0, ho.checkDataTypes)(y, T, b.opts.strictNumbers, ho.DataType.Wrong), j = t.const("indices", (0, Xe._)`{}`); - t.for((0, Xe._)`;${N}--;`, () => { - t.let(T, (0, Xe._)`${a}[${N}]`), t.if(v, (0, Xe._)`continue`), y.length > 1 && t.if((0, Xe._)`typeof ${T} == "string"`, (0, Xe._)`${T} += "_"`), t.if((0, Xe._)`typeof ${j}[${T}] == "number"`, () => { - t.assign(C, (0, Xe._)`${j}[${T}]`), e.error(), t.assign(_, !1).break(); - }).code((0, Xe._)`${j}[${T}] = ${N}`); + const _ = t.let("valid"), y = l.items ? (0, oa.getSchemaTypes)(l.items) : []; + e.block$data(_, m, (0, Ce._)`${d} === false`), e.ok(_); + function m() { + const j = t.let("i", (0, Ce._)`${r}.length`), C = t.let("j"); + e.setParams({ i: j, j: C }), t.assign(_, !0), t.if((0, Ce._)`${j} > 1`, () => (k() ? N : A)(j, C)); + } + function k() { + return y.length > 0 && !y.some((j) => j === "object" || j === "array"); + } + function N(j, C) { + const x = t.name("item"), v = (0, oa.checkDataTypes)(y, x, b.opts.strictNumbers, oa.DataType.Wrong), T = t.const("indices", (0, Ce._)`{}`); + t.for((0, Ce._)`;${j}--;`, () => { + t.let(x, (0, Ce._)`${r}[${j}]`), t.if(v, (0, Ce._)`continue`), y.length > 1 && t.if((0, Ce._)`typeof ${x} == "string"`, (0, Ce._)`${x} += "_"`), t.if((0, Ce._)`typeof ${T}[${x}] == "number"`, () => { + t.assign(C, (0, Ce._)`${T}[${x}]`), e.error(), t.assign(_, !1).break(); + }).code((0, Ce._)`${T}[${x}] = ${j}`); }); } - function A(N, C) { - const T = (0, qh.useFunc)(t, Hh.default), v = t.name("outer"); - t.label(v).for((0, Xe._)`;${N}--;`, () => t.for((0, Xe._)`${C} = ${N}; ${C}--;`, () => t.if((0, Xe._)`${T}(${a}[${N}], ${a}[${C}])`, () => { + function A(j, C) { + const x = (0, xl.useFunc)(t, Ol.default), v = t.name("outer"); + t.label(v).for((0, Ce._)`;${j}--;`, () => t.for((0, Ce._)`${C} = ${j}; ${C}--;`, () => t.if((0, Ce._)`${x}(${r}[${j}], ${r}[${C}])`, () => { e.error(), t.assign(_, !1).break(v); }))); } } }; -ns.default = Kh; -var os = {}; -Object.defineProperty(os, "__esModule", { value: !0 }); -const Po = we, Wh = $e, Jh = Ya, Zh = { +Ia.default = jl; +var Ma = {}; +Object.defineProperty(Ma, "__esModule", { value: !0 }); +const ha = ie, Ll = ce, Al = vr, Rl = { message: "must be equal to constant", - params: ({ schemaCode: e }) => (0, Po._)`{allowedValue: ${e}}` -}, Yh = { + params: ({ schemaCode: e }) => (0, ha._)`{allowedValue: ${e}}` +}, Il = { keyword: "const", $data: !0, - error: Zh, + error: Rl, code(e) { - const { gen: t, data: a, $data: n, schemaCode: s, schema: c } = e; - n || c && typeof c == "object" ? e.fail$data((0, Po._)`!${(0, Wh.useFunc)(t, Jh.default)}(${a}, ${s})`) : e.fail((0, Po._)`${c} !== ${a}`); + const { gen: t, data: r, $data: a, schemaCode: s, schema: l } = e; + a || l && typeof l == "object" ? e.fail$data((0, ha._)`!${(0, Ll.useFunc)(t, Al.default)}(${r}, ${s})`) : e.fail((0, ha._)`${l} !== ${r}`); } }; -os.default = Yh; -var ss = {}; -Object.defineProperty(ss, "__esModule", { value: !0 }); -const Oa = we, Qh = $e, Xh = Ya, ep = { +Ma.default = Il; +var Da = {}; +Object.defineProperty(Da, "__esModule", { value: !0 }); +const lr = ie, Ml = ce, Dl = vr, Bl = { message: "must be equal to one of the allowed values", - params: ({ schemaCode: e }) => (0, Oa._)`{allowedValues: ${e}}` -}, tp = { + params: ({ schemaCode: e }) => (0, lr._)`{allowedValues: ${e}}` +}, zl = { keyword: "enum", schemaType: "array", $data: !0, - error: ep, + error: Bl, code(e) { - const { gen: t, data: a, $data: n, schema: s, schemaCode: c, it: p } = e; - if (!n && s.length === 0) + const { gen: t, data: r, $data: a, schema: s, schemaCode: l, it: d } = e; + if (!a && s.length === 0) throw new Error("enum must have non-empty array"); - const b = s.length >= p.opts.loopEnum; + const b = s.length >= d.opts.loopEnum; let _; - const y = () => _ ?? (_ = (0, Qh.useFunc)(t, Xh.default)); - let g; - if (b || n) - g = t.let("valid"), e.block$data(g, S); + const y = () => _ ?? (_ = (0, Ml.useFunc)(t, Dl.default)); + let m; + if (b || a) + m = t.let("valid"), e.block$data(m, k); else { if (!Array.isArray(s)) throw new Error("ajv implementation error"); - const A = t.const("vSchema", c); - g = (0, Oa.or)(...s.map((N, C) => L(A, C))); + const A = t.const("vSchema", l); + m = (0, lr.or)(...s.map((j, C) => N(A, C))); } - e.pass(g); - function S() { - t.assign(g, !1), t.forOf("v", c, (A) => t.if((0, Oa._)`${y()}(${a}, ${A})`, () => t.assign(g, !0).break())); + e.pass(m); + function k() { + t.assign(m, !1), t.forOf("v", l, (A) => t.if((0, lr._)`${y()}(${r}, ${A})`, () => t.assign(m, !0).break())); } - function L(A, N) { - const C = s[N]; - return typeof C == "object" && C !== null ? (0, Oa._)`${y()}(${a}, ${A}[${N}])` : (0, Oa._)`${a} === ${C}`; + function N(A, j) { + const C = s[j]; + return typeof C == "object" && C !== null ? (0, lr._)`${y()}(${r}, ${A}[${j}])` : (0, lr._)`${r} === ${C}`; } } }; -ss.default = tp; -Object.defineProperty(Jo, "__esModule", { value: !0 }); -const rp = Zo, ap = Yo, np = Qo, op = es, sp = ts, ip = rs, cp = as, lp = ns, up = os, dp = ss, hp = [ +Da.default = zl; +Object.defineProperty(Ta, "__esModule", { value: !0 }); +const Vl = Ca, Fl = xa, ql = Oa, Ul = ja, Gl = La, Hl = Aa, Kl = Ra, Wl = Ia, Jl = Ma, Zl = Da, Yl = [ // number - rp.default, - ap.default, + Vl.default, + Fl.default, // string - np.default, - op.default, + ql.default, + Ul.default, // object - sp.default, - ip.default, + Gl.default, + Hl.default, // array - cp.default, - lp.default, + Kl.default, + Wl.default, // any { keyword: "type", schemaType: ["string", "array"] }, { keyword: "nullable", schemaType: "boolean" }, - up.default, - dp.default + Jl.default, + Zl.default ]; -Jo.default = hp; -var is = {}, ua = {}; -Object.defineProperty(ua, "__esModule", { value: !0 }); -ua.validateAdditionalItems = void 0; -const Dr = we, So = $e, pp = { - message: ({ params: { len: e } }) => (0, Dr.str)`must NOT have more than ${e} items`, - params: ({ params: { len: e } }) => (0, Dr._)`{limit: ${e}}` -}, fp = { +Ta.default = Yl; +var Ba = {}, Wt = {}; +Object.defineProperty(Wt, "__esModule", { value: !0 }); +Wt.validateAdditionalItems = void 0; +const Ot = ie, pa = ce, Ql = { + message: ({ params: { len: e } }) => (0, Ot.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, Ot._)`{limit: ${e}}` +}, Xl = { keyword: "additionalItems", type: "array", schemaType: ["boolean", "object"], before: "uniqueItems", - error: pp, + error: Ql, code(e) { - const { parentSchema: t, it: a } = e, { items: n } = t; - if (!Array.isArray(n)) { - (0, So.checkStrictMode)(a, '"additionalItems" is ignored when "items" is not an array of schemas'); + const { parentSchema: t, it: r } = e, { items: a } = t; + if (!Array.isArray(a)) { + (0, pa.checkStrictMode)(r, '"additionalItems" is ignored when "items" is not an array of schemas'); return; } - dl(e, n); + Io(e, a); } }; -function dl(e, t) { - const { gen: a, schema: n, data: s, keyword: c, it: p } = e; - p.items = !0; - const b = a.const("len", (0, Dr._)`${s}.length`); - if (n === !1) - e.setParams({ len: t.length }), e.pass((0, Dr._)`${b} <= ${t.length}`); - else if (typeof n == "object" && !(0, So.alwaysValidSchema)(p, n)) { - const y = a.var("valid", (0, Dr._)`${b} <= ${t.length}`); - a.if((0, Dr.not)(y), () => _(y)), e.ok(y); +function Io(e, t) { + const { gen: r, schema: a, data: s, keyword: l, it: d } = e; + d.items = !0; + const b = r.const("len", (0, Ot._)`${s}.length`); + if (a === !1) + e.setParams({ len: t.length }), e.pass((0, Ot._)`${b} <= ${t.length}`); + else if (typeof a == "object" && !(0, pa.alwaysValidSchema)(d, a)) { + const y = r.var("valid", (0, Ot._)`${b} <= ${t.length}`); + r.if((0, Ot.not)(y), () => _(y)), e.ok(y); } function _(y) { - a.forRange("i", t.length, b, (g) => { - e.subschema({ keyword: c, dataProp: g, dataPropType: So.Type.Num }, y), p.allErrors || a.if((0, Dr.not)(y), () => a.break()); + r.forRange("i", t.length, b, (m) => { + e.subschema({ keyword: l, dataProp: m, dataPropType: pa.Type.Num }, y), d.allErrors || r.if((0, Ot.not)(y), () => r.break()); }); } } -ua.validateAdditionalItems = dl; -ua.default = fp; -var cs = {}, da = {}; -Object.defineProperty(da, "__esModule", { value: !0 }); -da.validateTuple = void 0; -const Si = we, _n = $e, mp = be, gp = { +Wt.validateAdditionalItems = Io; +Wt.default = Xl; +var za = {}, Jt = {}; +Object.defineProperty(Jt, "__esModule", { value: !0 }); +Jt.validateTuple = void 0; +const xn = ie, Ir = ce, ec = se, tc = { keyword: "items", type: "array", schemaType: ["object", "array", "boolean"], before: "uniqueItems", code(e) { - const { schema: t, it: a } = e; + const { schema: t, it: r } = e; if (Array.isArray(t)) - return hl(e, "additionalItems", t); - a.items = !0, !(0, _n.alwaysValidSchema)(a, t) && e.ok((0, mp.validateArray)(e)); + return Mo(e, "additionalItems", t); + r.items = !0, !(0, Ir.alwaysValidSchema)(r, t) && e.ok((0, ec.validateArray)(e)); } }; -function hl(e, t, a = e.schema) { - const { gen: n, parentSchema: s, data: c, keyword: p, it: b } = e; - g(s), b.opts.unevaluated && a.length && b.items !== !0 && (b.items = _n.mergeEvaluated.items(n, a.length, b.items)); - const _ = n.name("valid"), y = n.const("len", (0, Si._)`${c}.length`); - a.forEach((S, L) => { - (0, _n.alwaysValidSchema)(b, S) || (n.if((0, Si._)`${y} > ${L}`, () => e.subschema({ - keyword: p, - schemaProp: L, - dataProp: L +function Mo(e, t, r = e.schema) { + const { gen: a, parentSchema: s, data: l, keyword: d, it: b } = e; + m(s), b.opts.unevaluated && r.length && b.items !== !0 && (b.items = Ir.mergeEvaluated.items(a, r.length, b.items)); + const _ = a.name("valid"), y = a.const("len", (0, xn._)`${l}.length`); + r.forEach((k, N) => { + (0, Ir.alwaysValidSchema)(b, k) || (a.if((0, xn._)`${y} > ${N}`, () => e.subschema({ + keyword: d, + schemaProp: N, + dataProp: N }, _)), e.ok(_)); }); - function g(S) { - const { opts: L, errSchemaPath: A } = b, N = a.length, C = N === S.minItems && (N === S.maxItems || S[t] === !1); - if (L.strictTuples && !C) { - const T = `"${p}" is ${N}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`; - (0, _n.checkStrictMode)(b, T, L.strictTuples); + function m(k) { + const { opts: N, errSchemaPath: A } = b, j = r.length, C = j === k.minItems && (j === k.maxItems || k[t] === !1); + if (N.strictTuples && !C) { + const x = `"${d}" is ${j}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`; + (0, Ir.checkStrictMode)(b, x, N.strictTuples); } } } -da.validateTuple = hl; -da.default = gp; -Object.defineProperty(cs, "__esModule", { value: !0 }); -const yp = da, bp = { +Jt.validateTuple = Mo; +Jt.default = tc; +Object.defineProperty(za, "__esModule", { value: !0 }); +const rc = Jt, ac = { keyword: "prefixItems", type: "array", schemaType: ["array"], before: "uniqueItems", - code: (e) => (0, yp.validateTuple)(e, "items") + code: (e) => (0, rc.validateTuple)(e, "items") }; -cs.default = bp; -var ls = {}; -Object.defineProperty(ls, "__esModule", { value: !0 }); -const xi = we, _p = $e, wp = be, vp = ua, $p = { - message: ({ params: { len: e } }) => (0, xi.str)`must NOT have more than ${e} items`, - params: ({ params: { len: e } }) => (0, xi._)`{limit: ${e}}` -}, kp = { +za.default = ac; +var Va = {}; +Object.defineProperty(Va, "__esModule", { value: !0 }); +const On = ie, nc = ce, oc = se, sc = Wt, ic = { + message: ({ params: { len: e } }) => (0, On.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, On._)`{limit: ${e}}` +}, lc = { keyword: "items", type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", - error: $p, + error: ic, code(e) { - const { schema: t, parentSchema: a, it: n } = e, { prefixItems: s } = a; - n.items = !0, !(0, _p.alwaysValidSchema)(n, t) && (s ? (0, vp.validateAdditionalItems)(e, s) : e.ok((0, wp.validateArray)(e))); + const { schema: t, parentSchema: r, it: a } = e, { prefixItems: s } = r; + a.items = !0, !(0, nc.alwaysValidSchema)(a, t) && (s ? (0, sc.validateAdditionalItems)(e, s) : e.ok((0, oc.validateArray)(e))); } }; -ls.default = kp; -var us = {}; -Object.defineProperty(us, "__esModule", { value: !0 }); -const Rt = we, nn = $e, Ep = { - message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Rt.str)`must contain at least ${e} valid item(s)` : (0, Rt.str)`must contain at least ${e} and no more than ${t} valid item(s)`, - params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Rt._)`{minContains: ${e}}` : (0, Rt._)`{minContains: ${e}, maxContains: ${t}}` -}, Pp = { +Va.default = lc; +var Fa = {}; +Object.defineProperty(Fa, "__esModule", { value: !0 }); +const We = ie, Cr = ce, cc = { + message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, We.str)`must contain at least ${e} valid item(s)` : (0, We.str)`must contain at least ${e} and no more than ${t} valid item(s)`, + params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, We._)`{minContains: ${e}}` : (0, We._)`{minContains: ${e}, maxContains: ${t}}` +}, uc = { keyword: "contains", type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", trackErrors: !0, - error: Ep, + error: cc, code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e; - let p, b; - const { minContains: _, maxContains: y } = n; - c.opts.next ? (p = _ === void 0 ? 1 : _, b = y) : p = 1; - const g = t.const("len", (0, Rt._)`${s}.length`); - if (e.setParams({ min: p, max: b }), b === void 0 && p === 0) { - (0, nn.checkStrictMode)(c, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); + const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e; + let d, b; + const { minContains: _, maxContains: y } = a; + l.opts.next ? (d = _ === void 0 ? 1 : _, b = y) : d = 1; + const m = t.const("len", (0, We._)`${s}.length`); + if (e.setParams({ min: d, max: b }), b === void 0 && d === 0) { + (0, Cr.checkStrictMode)(l, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); return; } - if (b !== void 0 && p > b) { - (0, nn.checkStrictMode)(c, '"minContains" > "maxContains" is always invalid'), e.fail(); + if (b !== void 0 && d > b) { + (0, Cr.checkStrictMode)(l, '"minContains" > "maxContains" is always invalid'), e.fail(); return; } - if ((0, nn.alwaysValidSchema)(c, a)) { - let C = (0, Rt._)`${g} >= ${p}`; - b !== void 0 && (C = (0, Rt._)`${C} && ${g} <= ${b}`), e.pass(C); + if ((0, Cr.alwaysValidSchema)(l, r)) { + let C = (0, We._)`${m} >= ${d}`; + b !== void 0 && (C = (0, We._)`${C} && ${m} <= ${b}`), e.pass(C); return; } - c.items = !0; - const S = t.name("valid"); - b === void 0 && p === 1 ? A(S, () => t.if(S, () => t.break())) : p === 0 ? (t.let(S, !0), b !== void 0 && t.if((0, Rt._)`${s}.length > 0`, L)) : (t.let(S, !1), L()), e.result(S, () => e.reset()); - function L() { - const C = t.name("_valid"), T = t.let("count", 0); - A(C, () => t.if(C, () => N(T))); + l.items = !0; + const k = t.name("valid"); + b === void 0 && d === 1 ? A(k, () => t.if(k, () => t.break())) : d === 0 ? (t.let(k, !0), b !== void 0 && t.if((0, We._)`${s}.length > 0`, N)) : (t.let(k, !1), N()), e.result(k, () => e.reset()); + function N() { + const C = t.name("_valid"), x = t.let("count", 0); + A(C, () => t.if(C, () => j(x))); } - function A(C, T) { - t.forRange("i", 0, g, (v) => { + function A(C, x) { + t.forRange("i", 0, m, (v) => { e.subschema({ keyword: "contains", dataProp: v, - dataPropType: nn.Type.Num, + dataPropType: Cr.Type.Num, compositeRule: !0 - }, C), T(); + }, C), x(); }); } - function N(C) { - t.code((0, Rt._)`${C}++`), b === void 0 ? t.if((0, Rt._)`${C} >= ${p}`, () => t.assign(S, !0).break()) : (t.if((0, Rt._)`${C} > ${b}`, () => t.assign(S, !1).break()), p === 1 ? t.assign(S, !0) : t.if((0, Rt._)`${C} >= ${p}`, () => t.assign(S, !0))); + function j(C) { + t.code((0, We._)`${C}++`), b === void 0 ? t.if((0, We._)`${C} >= ${d}`, () => t.assign(k, !0).break()) : (t.if((0, We._)`${C} > ${b}`, () => t.assign(k, !1).break()), d === 1 ? t.assign(k, !0) : t.if((0, We._)`${C} >= ${d}`, () => t.assign(k, !0))); } } }; -us.default = Pp; -var pl = {}; +Fa.default = uc; +var Do = {}; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0; - const t = we, a = $e, n = be; + const t = ie, r = ce, a = se; e.error = { - message: ({ params: { property: _, depsCount: y, deps: g } }) => { - const S = y === 1 ? "property" : "properties"; - return (0, t.str)`must have ${S} ${g} when property ${_} is present`; + message: ({ params: { property: _, depsCount: y, deps: m } }) => { + const k = y === 1 ? "property" : "properties"; + return (0, t.str)`must have ${k} ${m} when property ${_} is present`; }, - params: ({ params: { property: _, depsCount: y, deps: g, missingProperty: S } }) => (0, t._)`{property: ${_}, - missingProperty: ${S}, + params: ({ params: { property: _, depsCount: y, deps: m, missingProperty: k } }) => (0, t._)`{property: ${_}, + missingProperty: ${k}, depsCount: ${y}, - deps: ${g}}` + deps: ${m}}` // TODO change to reference }; const s = { @@ -3838,233 +3842,233 @@ var pl = {}; schemaType: "object", error: e.error, code(_) { - const [y, g] = c(_); - p(_, y), b(_, g); + const [y, m] = l(_); + d(_, y), b(_, m); } }; - function c({ schema: _ }) { - const y = {}, g = {}; - for (const S in _) { - if (S === "__proto__") + function l({ schema: _ }) { + const y = {}, m = {}; + for (const k in _) { + if (k === "__proto__") continue; - const L = Array.isArray(_[S]) ? y : g; - L[S] = _[S]; + const N = Array.isArray(_[k]) ? y : m; + N[k] = _[k]; } - return [y, g]; + return [y, m]; } - function p(_, y = _.schema) { - const { gen: g, data: S, it: L } = _; + function d(_, y = _.schema) { + const { gen: m, data: k, it: N } = _; if (Object.keys(y).length === 0) return; - const A = g.let("missing"); - for (const N in y) { - const C = y[N]; + const A = m.let("missing"); + for (const j in y) { + const C = y[j]; if (C.length === 0) continue; - const T = (0, n.propertyInData)(g, S, N, L.opts.ownProperties); + const x = (0, a.propertyInData)(m, k, j, N.opts.ownProperties); _.setParams({ - property: N, + property: j, depsCount: C.length, deps: C.join(", ") - }), L.allErrors ? g.if(T, () => { + }), N.allErrors ? m.if(x, () => { for (const v of C) - (0, n.checkReportMissingProp)(_, v); - }) : (g.if((0, t._)`${T} && (${(0, n.checkMissingProp)(_, C, A)})`), (0, n.reportMissingProp)(_, A), g.else()); + (0, a.checkReportMissingProp)(_, v); + }) : (m.if((0, t._)`${x} && (${(0, a.checkMissingProp)(_, C, A)})`), (0, a.reportMissingProp)(_, A), m.else()); } } - e.validatePropertyDeps = p; + e.validatePropertyDeps = d; function b(_, y = _.schema) { - const { gen: g, data: S, keyword: L, it: A } = _, N = g.name("valid"); + const { gen: m, data: k, keyword: N, it: A } = _, j = m.name("valid"); for (const C in y) - (0, a.alwaysValidSchema)(A, y[C]) || (g.if( - (0, n.propertyInData)(g, S, C, A.opts.ownProperties), + (0, r.alwaysValidSchema)(A, y[C]) || (m.if( + (0, a.propertyInData)(m, k, C, A.opts.ownProperties), () => { - const T = _.subschema({ keyword: L, schemaProp: C }, N); - _.mergeValidEvaluated(T, N); + const x = _.subschema({ keyword: N, schemaProp: C }, j); + _.mergeValidEvaluated(x, j); }, - () => g.var(N, !0) + () => m.var(j, !0) // TODO var - ), _.ok(N)); + ), _.ok(j)); } e.validateSchemaDeps = b, e.default = s; -})(pl); -var ds = {}; -Object.defineProperty(ds, "__esModule", { value: !0 }); -const fl = we, Sp = $e, xp = { +})(Do); +var qa = {}; +Object.defineProperty(qa, "__esModule", { value: !0 }); +const Bo = ie, dc = ce, hc = { message: "property name must be valid", - params: ({ params: e }) => (0, fl._)`{propertyName: ${e.propertyName}}` -}, Tp = { + params: ({ params: e }) => (0, Bo._)`{propertyName: ${e.propertyName}}` +}, pc = { keyword: "propertyNames", type: "object", schemaType: ["object", "boolean"], - error: xp, + error: hc, code(e) { - const { gen: t, schema: a, data: n, it: s } = e; - if ((0, Sp.alwaysValidSchema)(s, a)) + const { gen: t, schema: r, data: a, it: s } = e; + if ((0, dc.alwaysValidSchema)(s, r)) return; - const c = t.name("valid"); - t.forIn("key", n, (p) => { - e.setParams({ propertyName: p }), e.subschema({ + const l = t.name("valid"); + t.forIn("key", a, (d) => { + e.setParams({ propertyName: d }), e.subschema({ keyword: "propertyNames", - data: p, + data: d, dataTypes: ["string"], - propertyName: p, + propertyName: d, compositeRule: !0 - }, c), t.if((0, fl.not)(c), () => { + }, l), t.if((0, Bo.not)(l), () => { e.error(!0), s.allErrors || t.break(); }); - }), e.ok(c); + }), e.ok(l); } }; -ds.default = Tp; -var Hn = {}; -Object.defineProperty(Hn, "__esModule", { value: !0 }); -const on = be, Gt = we, jp = cr, sn = $e, Cp = { +qa.default = pc; +var Xr = {}; +Object.defineProperty(Xr, "__esModule", { value: !0 }); +const xr = se, Ye = ie, fc = ct, Or = ce, mc = { message: "must NOT have additional properties", - params: ({ params: e }) => (0, Gt._)`{additionalProperty: ${e.additionalProperty}}` -}, Op = { + params: ({ params: e }) => (0, Ye._)`{additionalProperty: ${e.additionalProperty}}` +}, gc = { keyword: "additionalProperties", type: ["object"], schemaType: ["boolean", "object"], allowUndefined: !0, trackErrors: !0, - error: Cp, + error: mc, code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, errsCount: c, it: p } = e; - if (!c) + const { gen: t, schema: r, parentSchema: a, data: s, errsCount: l, it: d } = e; + if (!l) throw new Error("ajv implementation error"); - const { allErrors: b, opts: _ } = p; - if (p.props = !0, _.removeAdditional !== "all" && (0, sn.alwaysValidSchema)(p, a)) + const { allErrors: b, opts: _ } = d; + if (d.props = !0, _.removeAdditional !== "all" && (0, Or.alwaysValidSchema)(d, r)) return; - const y = (0, on.allSchemaProperties)(n.properties), g = (0, on.allSchemaProperties)(n.patternProperties); - S(), e.ok((0, Gt._)`${c} === ${jp.default.errors}`); - function S() { - t.forIn("key", s, (T) => { - !y.length && !g.length ? N(T) : t.if(L(T), () => N(T)); + const y = (0, xr.allSchemaProperties)(a.properties), m = (0, xr.allSchemaProperties)(a.patternProperties); + k(), e.ok((0, Ye._)`${l} === ${fc.default.errors}`); + function k() { + t.forIn("key", s, (x) => { + !y.length && !m.length ? j(x) : t.if(N(x), () => j(x)); }); } - function L(T) { + function N(x) { let v; if (y.length > 8) { - const j = (0, sn.schemaRefOrVal)(p, n.properties, "properties"); - v = (0, on.isOwnProperty)(t, j, T); + const T = (0, Or.schemaRefOrVal)(d, a.properties, "properties"); + v = (0, xr.isOwnProperty)(t, T, x); } else - y.length ? v = (0, Gt.or)(...y.map((j) => (0, Gt._)`${T} === ${j}`)) : v = Gt.nil; - return g.length && (v = (0, Gt.or)(v, ...g.map((j) => (0, Gt._)`${(0, on.usePattern)(e, j)}.test(${T})`))), (0, Gt.not)(v); + y.length ? v = (0, Ye.or)(...y.map((T) => (0, Ye._)`${x} === ${T}`)) : v = Ye.nil; + return m.length && (v = (0, Ye.or)(v, ...m.map((T) => (0, Ye._)`${(0, xr.usePattern)(e, T)}.test(${x})`))), (0, Ye.not)(v); } - function A(T) { - t.code((0, Gt._)`delete ${s}[${T}]`); + function A(x) { + t.code((0, Ye._)`delete ${s}[${x}]`); } - function N(T) { - if (_.removeAdditional === "all" || _.removeAdditional && a === !1) { - A(T); + function j(x) { + if (_.removeAdditional === "all" || _.removeAdditional && r === !1) { + A(x); return; } - if (a === !1) { - e.setParams({ additionalProperty: T }), e.error(), b || t.break(); + if (r === !1) { + e.setParams({ additionalProperty: x }), e.error(), b || t.break(); return; } - if (typeof a == "object" && !(0, sn.alwaysValidSchema)(p, a)) { + if (typeof r == "object" && !(0, Or.alwaysValidSchema)(d, r)) { const v = t.name("valid"); - _.removeAdditional === "failing" ? (C(T, v, !1), t.if((0, Gt.not)(v), () => { - e.reset(), A(T); - })) : (C(T, v), b || t.if((0, Gt.not)(v), () => t.break())); + _.removeAdditional === "failing" ? (C(x, v, !1), t.if((0, Ye.not)(v), () => { + e.reset(), A(x); + })) : (C(x, v), b || t.if((0, Ye.not)(v), () => t.break())); } } - function C(T, v, j) { - const I = { + function C(x, v, T) { + const R = { keyword: "additionalProperties", - dataProp: T, - dataPropType: sn.Type.Str + dataProp: x, + dataPropType: Or.Type.Str }; - j === !1 && Object.assign(I, { + T === !1 && Object.assign(R, { compositeRule: !0, createErrors: !1, allErrors: !1 - }), e.subschema(I, v); + }), e.subschema(R, v); } } }; -Hn.default = Op; -var hs = {}; -Object.defineProperty(hs, "__esModule", { value: !0 }); -const Np = er, Ti = be, po = $e, ji = Hn, Lp = { +Xr.default = gc; +var Ua = {}; +Object.defineProperty(Ua, "__esModule", { value: !0 }); +const bc = rt, Nn = se, sa = ce, jn = Xr, yc = { keyword: "properties", type: "object", schemaType: "object", code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e; - c.opts.removeAdditional === "all" && n.additionalProperties === void 0 && ji.default.code(new Np.KeywordCxt(c, ji.default, "additionalProperties")); - const p = (0, Ti.allSchemaProperties)(a); - for (const S of p) - c.definedProperties.add(S); - c.opts.unevaluated && p.length && c.props !== !0 && (c.props = po.mergeEvaluated.props(t, (0, po.toHash)(p), c.props)); - const b = p.filter((S) => !(0, po.alwaysValidSchema)(c, a[S])); + const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e; + l.opts.removeAdditional === "all" && a.additionalProperties === void 0 && jn.default.code(new bc.KeywordCxt(l, jn.default, "additionalProperties")); + const d = (0, Nn.allSchemaProperties)(r); + for (const k of d) + l.definedProperties.add(k); + l.opts.unevaluated && d.length && l.props !== !0 && (l.props = sa.mergeEvaluated.props(t, (0, sa.toHash)(d), l.props)); + const b = d.filter((k) => !(0, sa.alwaysValidSchema)(l, r[k])); if (b.length === 0) return; const _ = t.name("valid"); - for (const S of b) - y(S) ? g(S) : (t.if((0, Ti.propertyInData)(t, s, S, c.opts.ownProperties)), g(S), c.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(S), e.ok(_); - function y(S) { - return c.opts.useDefaults && !c.compositeRule && a[S].default !== void 0; + for (const k of b) + y(k) ? m(k) : (t.if((0, Nn.propertyInData)(t, s, k, l.opts.ownProperties)), m(k), l.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(k), e.ok(_); + function y(k) { + return l.opts.useDefaults && !l.compositeRule && r[k].default !== void 0; } - function g(S) { + function m(k) { e.subschema({ keyword: "properties", - schemaProp: S, - dataProp: S + schemaProp: k, + dataProp: k }, _); } } }; -hs.default = Lp; -var ps = {}; -Object.defineProperty(ps, "__esModule", { value: !0 }); -const Ci = be, cn = we, Oi = $e, Ni = $e, Rp = { +Ua.default = yc; +var Ga = {}; +Object.defineProperty(Ga, "__esModule", { value: !0 }); +const Ln = se, Nr = ie, An = ce, Rn = ce, _c = { keyword: "patternProperties", type: "object", schemaType: "object", code(e) { - const { gen: t, schema: a, data: n, parentSchema: s, it: c } = e, { opts: p } = c, b = (0, Ci.allSchemaProperties)(a), _ = b.filter((C) => (0, Oi.alwaysValidSchema)(c, a[C])); - if (b.length === 0 || _.length === b.length && (!c.opts.unevaluated || c.props === !0)) + const { gen: t, schema: r, data: a, parentSchema: s, it: l } = e, { opts: d } = l, b = (0, Ln.allSchemaProperties)(r), _ = b.filter((C) => (0, An.alwaysValidSchema)(l, r[C])); + if (b.length === 0 || _.length === b.length && (!l.opts.unevaluated || l.props === !0)) return; - const y = p.strictSchema && !p.allowMatchingProperties && s.properties, g = t.name("valid"); - c.props !== !0 && !(c.props instanceof cn.Name) && (c.props = (0, Ni.evaluatedPropsToName)(t, c.props)); - const { props: S } = c; - L(); - function L() { + const y = d.strictSchema && !d.allowMatchingProperties && s.properties, m = t.name("valid"); + l.props !== !0 && !(l.props instanceof Nr.Name) && (l.props = (0, Rn.evaluatedPropsToName)(t, l.props)); + const { props: k } = l; + N(); + function N() { for (const C of b) - y && A(C), c.allErrors ? N(C) : (t.var(g, !0), N(C), t.if(g)); + y && A(C), l.allErrors ? j(C) : (t.var(m, !0), j(C), t.if(m)); } function A(C) { - for (const T in y) - new RegExp(C).test(T) && (0, Oi.checkStrictMode)(c, `property ${T} matches pattern ${C} (use allowMatchingProperties)`); + for (const x in y) + new RegExp(C).test(x) && (0, An.checkStrictMode)(l, `property ${x} matches pattern ${C} (use allowMatchingProperties)`); } - function N(C) { - t.forIn("key", n, (T) => { - t.if((0, cn._)`${(0, Ci.usePattern)(e, C)}.test(${T})`, () => { + function j(C) { + t.forIn("key", a, (x) => { + t.if((0, Nr._)`${(0, Ln.usePattern)(e, C)}.test(${x})`, () => { const v = _.includes(C); v || e.subschema({ keyword: "patternProperties", schemaProp: C, - dataProp: T, - dataPropType: Ni.Type.Str - }, g), c.opts.unevaluated && S !== !0 ? t.assign((0, cn._)`${S}[${T}]`, !0) : !v && !c.allErrors && t.if((0, cn.not)(g), () => t.break()); + dataProp: x, + dataPropType: Rn.Type.Str + }, m), l.opts.unevaluated && k !== !0 ? t.assign((0, Nr._)`${k}[${x}]`, !0) : !v && !l.allErrors && t.if((0, Nr.not)(m), () => t.break()); }); }); } } }; -ps.default = Rp; -var fs = {}; -Object.defineProperty(fs, "__esModule", { value: !0 }); -const Ip = $e, Ap = { +Ga.default = _c; +var Ha = {}; +Object.defineProperty(Ha, "__esModule", { value: !0 }); +const wc = ce, vc = { keyword: "not", schemaType: ["object", "boolean"], trackErrors: !0, code(e) { - const { gen: t, schema: a, it: n } = e; - if ((0, Ip.alwaysValidSchema)(n, a)) { + const { gen: t, schema: r, it: a } = e; + if ((0, wc.alwaysValidSchema)(a, r)) { e.fail(); return; } @@ -4078,218 +4082,218 @@ const Ip = $e, Ap = { }, error: { message: "must NOT be valid" } }; -fs.default = Ap; -var ms = {}; -Object.defineProperty(ms, "__esModule", { value: !0 }); -const Mp = be, Dp = { +Ha.default = vc; +var Ka = {}; +Object.defineProperty(Ka, "__esModule", { value: !0 }); +const kc = se, Ec = { keyword: "anyOf", schemaType: "array", trackErrors: !0, - code: Mp.validateUnion, + code: kc.validateUnion, error: { message: "must match a schema in anyOf" } }; -ms.default = Dp; -var gs = {}; -Object.defineProperty(gs, "__esModule", { value: !0 }); -const wn = we, zp = $e, Bp = { +Ka.default = Ec; +var Wa = {}; +Object.defineProperty(Wa, "__esModule", { value: !0 }); +const Mr = ie, $c = ce, Pc = { message: "must match exactly one schema in oneOf", - params: ({ params: e }) => (0, wn._)`{passingSchemas: ${e.passing}}` -}, Vp = { + params: ({ params: e }) => (0, Mr._)`{passingSchemas: ${e.passing}}` +}, Sc = { keyword: "oneOf", schemaType: "array", trackErrors: !0, - error: Bp, + error: Pc, code(e) { - const { gen: t, schema: a, parentSchema: n, it: s } = e; - if (!Array.isArray(a)) + const { gen: t, schema: r, parentSchema: a, it: s } = e; + if (!Array.isArray(r)) throw new Error("ajv implementation error"); - if (s.opts.discriminator && n.discriminator) + if (s.opts.discriminator && a.discriminator) return; - const c = a, p = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid"); - e.setParams({ passing: b }), t.block(y), e.result(p, () => e.reset(), () => e.error(!0)); + const l = r, d = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid"); + e.setParams({ passing: b }), t.block(y), e.result(d, () => e.reset(), () => e.error(!0)); function y() { - c.forEach((g, S) => { - let L; - (0, zp.alwaysValidSchema)(s, g) ? t.var(_, !0) : L = e.subschema({ + l.forEach((m, k) => { + let N; + (0, $c.alwaysValidSchema)(s, m) ? t.var(_, !0) : N = e.subschema({ keyword: "oneOf", - schemaProp: S, + schemaProp: k, compositeRule: !0 - }, _), S > 0 && t.if((0, wn._)`${_} && ${p}`).assign(p, !1).assign(b, (0, wn._)`[${b}, ${S}]`).else(), t.if(_, () => { - t.assign(p, !0), t.assign(b, S), L && e.mergeEvaluated(L, wn.Name); + }, _), k > 0 && t.if((0, Mr._)`${_} && ${d}`).assign(d, !1).assign(b, (0, Mr._)`[${b}, ${k}]`).else(), t.if(_, () => { + t.assign(d, !0), t.assign(b, k), N && e.mergeEvaluated(N, Mr.Name); }); }); } } }; -gs.default = Vp; -var ys = {}; -Object.defineProperty(ys, "__esModule", { value: !0 }); -const Fp = $e, Up = { +Wa.default = Sc; +var Ja = {}; +Object.defineProperty(Ja, "__esModule", { value: !0 }); +const Tc = ce, Cc = { keyword: "allOf", schemaType: "array", code(e) { - const { gen: t, schema: a, it: n } = e; - if (!Array.isArray(a)) + const { gen: t, schema: r, it: a } = e; + if (!Array.isArray(r)) throw new Error("ajv implementation error"); const s = t.name("valid"); - a.forEach((c, p) => { - if ((0, Fp.alwaysValidSchema)(n, c)) + r.forEach((l, d) => { + if ((0, Tc.alwaysValidSchema)(a, l)) return; - const b = e.subschema({ keyword: "allOf", schemaProp: p }, s); + const b = e.subschema({ keyword: "allOf", schemaProp: d }, s); e.ok(s), e.mergeEvaluated(b); }); } }; -ys.default = Up; -var bs = {}; -Object.defineProperty(bs, "__esModule", { value: !0 }); -const On = we, ml = $e, qp = { - message: ({ params: e }) => (0, On.str)`must match "${e.ifClause}" schema`, - params: ({ params: e }) => (0, On._)`{failingKeyword: ${e.ifClause}}` -}, Hp = { +Ja.default = Cc; +var Za = {}; +Object.defineProperty(Za, "__esModule", { value: !0 }); +const Ur = ie, zo = ce, xc = { + message: ({ params: e }) => (0, Ur.str)`must match "${e.ifClause}" schema`, + params: ({ params: e }) => (0, Ur._)`{failingKeyword: ${e.ifClause}}` +}, Oc = { keyword: "if", schemaType: ["object", "boolean"], trackErrors: !0, - error: qp, + error: xc, code(e) { - const { gen: t, parentSchema: a, it: n } = e; - a.then === void 0 && a.else === void 0 && (0, ml.checkStrictMode)(n, '"if" without "then" and "else" is ignored'); - const s = Li(n, "then"), c = Li(n, "else"); - if (!s && !c) + const { gen: t, parentSchema: r, it: a } = e; + r.then === void 0 && r.else === void 0 && (0, zo.checkStrictMode)(a, '"if" without "then" and "else" is ignored'); + const s = In(a, "then"), l = In(a, "else"); + if (!s && !l) return; - const p = t.let("valid", !0), b = t.name("_valid"); - if (_(), e.reset(), s && c) { - const g = t.let("ifClause"); - e.setParams({ ifClause: g }), t.if(b, y("then", g), y("else", g)); + const d = t.let("valid", !0), b = t.name("_valid"); + if (_(), e.reset(), s && l) { + const m = t.let("ifClause"); + e.setParams({ ifClause: m }), t.if(b, y("then", m), y("else", m)); } else - s ? t.if(b, y("then")) : t.if((0, On.not)(b), y("else")); - e.pass(p, () => e.error(!0)); + s ? t.if(b, y("then")) : t.if((0, Ur.not)(b), y("else")); + e.pass(d, () => e.error(!0)); function _() { - const g = e.subschema({ + const m = e.subschema({ keyword: "if", compositeRule: !0, createErrors: !1, allErrors: !1 }, b); - e.mergeEvaluated(g); + e.mergeEvaluated(m); } - function y(g, S) { + function y(m, k) { return () => { - const L = e.subschema({ keyword: g }, b); - t.assign(p, b), e.mergeValidEvaluated(L, p), S ? t.assign(S, (0, On._)`${g}`) : e.setParams({ ifClause: g }); + const N = e.subschema({ keyword: m }, b); + t.assign(d, b), e.mergeValidEvaluated(N, d), k ? t.assign(k, (0, Ur._)`${m}`) : e.setParams({ ifClause: m }); }; } } }; -function Li(e, t) { - const a = e.schema[t]; - return a !== void 0 && !(0, ml.alwaysValidSchema)(e, a); +function In(e, t) { + const r = e.schema[t]; + return r !== void 0 && !(0, zo.alwaysValidSchema)(e, r); } -bs.default = Hp; -var _s = {}; -Object.defineProperty(_s, "__esModule", { value: !0 }); -const Gp = $e, Kp = { +Za.default = Oc; +var Ya = {}; +Object.defineProperty(Ya, "__esModule", { value: !0 }); +const Nc = ce, jc = { keyword: ["then", "else"], schemaType: ["object", "boolean"], - code({ keyword: e, parentSchema: t, it: a }) { - t.if === void 0 && (0, Gp.checkStrictMode)(a, `"${e}" without "if" is ignored`); + code({ keyword: e, parentSchema: t, it: r }) { + t.if === void 0 && (0, Nc.checkStrictMode)(r, `"${e}" without "if" is ignored`); } }; -_s.default = Kp; -Object.defineProperty(is, "__esModule", { value: !0 }); -const Wp = ua, Jp = cs, Zp = da, Yp = ls, Qp = us, Xp = pl, ef = ds, tf = Hn, rf = hs, af = ps, nf = fs, of = ms, sf = gs, cf = ys, lf = bs, uf = _s; -function df(e = !1) { +Ya.default = jc; +Object.defineProperty(Ba, "__esModule", { value: !0 }); +const Lc = Wt, Ac = za, Rc = Jt, Ic = Va, Mc = Fa, Dc = Do, Bc = qa, zc = Xr, Vc = Ua, Fc = Ga, qc = Ha, Uc = Ka, Gc = Wa, Hc = Ja, Kc = Za, Wc = Ya; +function Jc(e = !1) { const t = [ // any - nf.default, - of.default, - sf.default, - cf.default, - lf.default, - uf.default, + qc.default, + Uc.default, + Gc.default, + Hc.default, + Kc.default, + Wc.default, // object - ef.default, - tf.default, - Xp.default, - rf.default, - af.default + Bc.default, + zc.default, + Dc.default, + Vc.default, + Fc.default ]; - return e ? t.push(Jp.default, Yp.default) : t.push(Wp.default, Zp.default), t.push(Qp.default), t; -} -is.default = df; -var ws = {}, vs = {}; -Object.defineProperty(vs, "__esModule", { value: !0 }); -const Fe = we, hf = { - message: ({ schemaCode: e }) => (0, Fe.str)`must match format "${e}"`, - params: ({ schemaCode: e }) => (0, Fe._)`{format: ${e}}` -}, pf = { + return e ? t.push(Ac.default, Ic.default) : t.push(Lc.default, Rc.default), t.push(Mc.default), t; +} +Ba.default = Jc; +var Qa = {}, Xa = {}; +Object.defineProperty(Xa, "__esModule", { value: !0 }); +const ve = ie, Zc = { + message: ({ schemaCode: e }) => (0, ve.str)`must match format "${e}"`, + params: ({ schemaCode: e }) => (0, ve._)`{format: ${e}}` +}, Yc = { keyword: "format", type: ["number", "string"], schemaType: "string", $data: !0, - error: hf, + error: Zc, code(e, t) { - const { gen: a, data: n, $data: s, schema: c, schemaCode: p, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: g, self: S } = b; + const { gen: r, data: a, $data: s, schema: l, schemaCode: d, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: m, self: k } = b; if (!_.validateFormats) return; - s ? L() : A(); - function L() { - const N = a.scopeValue("formats", { - ref: S.formats, + s ? N() : A(); + function N() { + const j = r.scopeValue("formats", { + ref: k.formats, code: _.code.formats - }), C = a.const("fDef", (0, Fe._)`${N}[${p}]`), T = a.let("fType"), v = a.let("format"); - a.if((0, Fe._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => a.assign(T, (0, Fe._)`${C}.type || "string"`).assign(v, (0, Fe._)`${C}.validate`), () => a.assign(T, (0, Fe._)`"string"`).assign(v, C)), e.fail$data((0, Fe.or)(j(), I())); - function j() { - return _.strictSchema === !1 ? Fe.nil : (0, Fe._)`${p} && !${v}`; + }), C = r.const("fDef", (0, ve._)`${j}[${d}]`), x = r.let("fType"), v = r.let("format"); + r.if((0, ve._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => r.assign(x, (0, ve._)`${C}.type || "string"`).assign(v, (0, ve._)`${C}.validate`), () => r.assign(x, (0, ve._)`"string"`).assign(v, C)), e.fail$data((0, ve.or)(T(), R())); + function T() { + return _.strictSchema === !1 ? ve.nil : (0, ve._)`${d} && !${v}`; } - function I() { - const r = g.$async ? (0, Fe._)`(${C}.async ? await ${v}(${n}) : ${v}(${n}))` : (0, Fe._)`${v}(${n})`, i = (0, Fe._)`(typeof ${v} == "function" ? ${r} : ${v}.test(${n}))`; - return (0, Fe._)`${v} && ${v} !== true && ${T} === ${t} && !${i}`; + function R() { + const n = m.$async ? (0, ve._)`(${C}.async ? await ${v}(${a}) : ${v}(${a}))` : (0, ve._)`${v}(${a})`, i = (0, ve._)`(typeof ${v} == "function" ? ${n} : ${v}.test(${a}))`; + return (0, ve._)`${v} && ${v} !== true && ${x} === ${t} && !${i}`; } } function A() { - const N = S.formats[c]; - if (!N) { - j(); + const j = k.formats[l]; + if (!j) { + T(); return; } - if (N === !0) + if (j === !0) return; - const [C, T, v] = I(N); - C === t && e.pass(r()); - function j() { + const [C, x, v] = R(j); + C === t && e.pass(n()); + function T() { if (_.strictSchema === !1) { - S.logger.warn(i()); + k.logger.warn(i()); return; } throw new Error(i()); function i() { - return `unknown format "${c}" ignored in schema at path "${y}"`; + return `unknown format "${l}" ignored in schema at path "${y}"`; } } - function I(i) { - const o = i instanceof RegExp ? (0, Fe.regexpCode)(i) : _.code.formats ? (0, Fe._)`${_.code.formats}${(0, Fe.getProperty)(c)}` : void 0, l = a.scopeValue("formats", { key: c, ref: i, code: o }); - return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, Fe._)`${l}.validate`] : ["string", i, l]; + function R(i) { + const o = i instanceof RegExp ? (0, ve.regexpCode)(i) : _.code.formats ? (0, ve._)`${_.code.formats}${(0, ve.getProperty)(l)}` : void 0, c = r.scopeValue("formats", { key: l, ref: i, code: o }); + return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, ve._)`${c}.validate`] : ["string", i, c]; } - function r() { - if (typeof N == "object" && !(N instanceof RegExp) && N.async) { - if (!g.$async) + function n() { + if (typeof j == "object" && !(j instanceof RegExp) && j.async) { + if (!m.$async) throw new Error("async format in sync schema"); - return (0, Fe._)`await ${v}(${n})`; + return (0, ve._)`await ${v}(${a})`; } - return typeof T == "function" ? (0, Fe._)`${v}(${n})` : (0, Fe._)`${v}.test(${n})`; + return typeof x == "function" ? (0, ve._)`${v}(${a})` : (0, ve._)`${v}.test(${a})`; } } } }; -vs.default = pf; -Object.defineProperty(ws, "__esModule", { value: !0 }); -const ff = vs, mf = [ff.default]; -ws.default = mf; -var ia = {}; -Object.defineProperty(ia, "__esModule", { value: !0 }); -ia.contentVocabulary = ia.metadataVocabulary = void 0; -ia.metadataVocabulary = [ +Xa.default = Yc; +Object.defineProperty(Qa, "__esModule", { value: !0 }); +const Qc = Xa, Xc = [Qc.default]; +Qa.default = Xc; +var Kt = {}; +Object.defineProperty(Kt, "__esModule", { value: !0 }); +Kt.contentVocabulary = Kt.metadataVocabulary = void 0; +Kt.metadataVocabulary = [ "title", "description", "default", @@ -4298,97 +4302,97 @@ ia.metadataVocabulary = [ "writeOnly", "examples" ]; -ia.contentVocabulary = [ +Kt.contentVocabulary = [ "contentMediaType", "contentEncoding", "contentSchema" ]; -Object.defineProperty(Go, "__esModule", { value: !0 }); -const gf = Ko, yf = Jo, bf = is, _f = ws, Ri = ia, wf = [ - gf.default, - yf.default, - (0, bf.default)(), - _f.default, - Ri.metadataVocabulary, - Ri.contentVocabulary +Object.defineProperty($a, "__esModule", { value: !0 }); +const eu = Pa, tu = Ta, ru = Ba, au = Qa, Mn = Kt, nu = [ + eu.default, + tu.default, + (0, ru.default)(), + au.default, + Mn.metadataVocabulary, + Mn.contentVocabulary ]; -Go.default = wf; -var $s = {}, gl = {}; +$a.default = nu; +var en = {}, Vo = {}; (function(e) { Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(t) { t.Tag = "tag", t.Mapping = "mapping"; }(e.DiscrError || (e.DiscrError = {})); -})(gl); -Object.defineProperty($s, "__esModule", { value: !0 }); -const Zr = we, xo = gl, Ii = wt, vf = $e, $f = { - message: ({ params: { discrError: e, tagName: t } }) => e === xo.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`, - params: ({ params: { discrError: e, tag: t, tagName: a } }) => (0, Zr._)`{error: ${e}, tag: ${a}, tagValue: ${t}}` -}, kf = { +})(Vo); +Object.defineProperty(en, "__esModule", { value: !0 }); +const Vt = ie, fa = Vo, Dn = Be, ou = ce, su = { + message: ({ params: { discrError: e, tagName: t } }) => e === fa.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`, + params: ({ params: { discrError: e, tag: t, tagName: r } }) => (0, Vt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}` +}, iu = { keyword: "discriminator", type: "object", schemaType: "object", - error: $f, + error: su, code(e) { - const { gen: t, data: a, schema: n, parentSchema: s, it: c } = e, { oneOf: p } = s; - if (!c.opts.discriminator) + const { gen: t, data: r, schema: a, parentSchema: s, it: l } = e, { oneOf: d } = s; + if (!l.opts.discriminator) throw new Error("discriminator: requires discriminator option"); - const b = n.propertyName; + const b = a.propertyName; if (typeof b != "string") throw new Error("discriminator: requires propertyName"); - if (n.mapping) + if (a.mapping) throw new Error("discriminator: mapping is not supported"); - if (!p) + if (!d) throw new Error("discriminator: requires oneOf keyword"); - const _ = t.let("valid", !1), y = t.const("tag", (0, Zr._)`${a}${(0, Zr.getProperty)(b)}`); - t.if((0, Zr._)`typeof ${y} == "string"`, () => g(), () => e.error(!1, { discrError: xo.DiscrError.Tag, tag: y, tagName: b })), e.ok(_); - function g() { - const A = L(); + const _ = t.let("valid", !1), y = t.const("tag", (0, Vt._)`${r}${(0, Vt.getProperty)(b)}`); + t.if((0, Vt._)`typeof ${y} == "string"`, () => m(), () => e.error(!1, { discrError: fa.DiscrError.Tag, tag: y, tagName: b })), e.ok(_); + function m() { + const A = N(); t.if(!1); - for (const N in A) - t.elseIf((0, Zr._)`${y} === ${N}`), t.assign(_, S(A[N])); - t.else(), e.error(!1, { discrError: xo.DiscrError.Mapping, tag: y, tagName: b }), t.endIf(); + for (const j in A) + t.elseIf((0, Vt._)`${y} === ${j}`), t.assign(_, k(A[j])); + t.else(), e.error(!1, { discrError: fa.DiscrError.Mapping, tag: y, tagName: b }), t.endIf(); } - function S(A) { - const N = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: A }, N); - return e.mergeEvaluated(C, Zr.Name), N; + function k(A) { + const j = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: A }, j); + return e.mergeEvaluated(C, Vt.Name), j; } - function L() { + function N() { var A; - const N = {}, C = v(s); - let T = !0; - for (let r = 0; r < p.length; r++) { - let i = p[r]; - i != null && i.$ref && !(0, vf.schemaHasRulesButRef)(i, c.self.RULES) && (i = Ii.resolveRef.call(c.self, c.schemaEnv.root, c.baseId, i == null ? void 0 : i.$ref), i instanceof Ii.SchemaEnv && (i = i.schema)); + const j = {}, C = v(s); + let x = !0; + for (let n = 0; n < d.length; n++) { + let i = d[n]; + i != null && i.$ref && !(0, ou.schemaHasRulesButRef)(i, l.self.RULES) && (i = Dn.resolveRef.call(l.self, l.schemaEnv.root, l.baseId, i == null ? void 0 : i.$ref), i instanceof Dn.SchemaEnv && (i = i.schema)); const o = (A = i == null ? void 0 : i.properties) === null || A === void 0 ? void 0 : A[b]; if (typeof o != "object") throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`); - T = T && (C || v(i)), j(o, r); + x = x && (C || v(i)), T(o, n); } - if (!T) + if (!x) throw new Error(`discriminator: "${b}" must be required`); - return N; - function v({ required: r }) { - return Array.isArray(r) && r.includes(b); - } - function j(r, i) { - if (r.const) - I(r.const, i); - else if (r.enum) - for (const o of r.enum) - I(o, i); + return j; + function v({ required: n }) { + return Array.isArray(n) && n.includes(b); + } + function T(n, i) { + if (n.const) + R(n.const, i); + else if (n.enum) + for (const o of n.enum) + R(o, i); else throw new Error(`discriminator: "properties/${b}" must have "const" or "enum"`); } - function I(r, i) { - if (typeof r != "string" || r in N) + function R(n, i) { + if (typeof n != "string" || n in j) throw new Error(`discriminator: "${b}" values must be unique strings`); - N[r] = i; + j[n] = i; } } } }; -$s.default = kf; -const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.org/draft-07/schema#", Sf = "Core schema meta-schema", xf = { +en.default = iu; +const lu = "http://json-schema.org/draft-07/schema#", cu = "http://json-schema.org/draft-07/schema#", uu = "Core schema meta-schema", du = { schemaArray: { type: "array", minItems: 1, @@ -4429,10 +4433,10 @@ const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.o uniqueItems: !0, default: [] } -}, Tf = [ +}, hu = [ "object", "boolean" -], jf = { +], pu = { $id: { type: "string", format: "uri-reference" @@ -4620,78 +4624,78 @@ const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.o not: { $ref: "#" } -}, Cf = { - $schema: Ef, - $id: Pf, - title: Sf, - definitions: xf, - type: Tf, - properties: jf, +}, fu = { + $schema: lu, + $id: cu, + title: uu, + definitions: du, + type: hu, + properties: pu, default: !0 }; (function(e, t) { 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; - const a = Ac, n = Go, s = $s, c = Cf, p = ["/properties"], b = "http://json-schema.org/draft-07/schema"; - class _ extends a.default { + const r = so, a = $a, s = en, l = fu, d = ["/properties"], b = "http://json-schema.org/draft-07/schema"; + class _ extends r.default { _addVocabularies() { - super._addVocabularies(), n.default.forEach((N) => this.addVocabulary(N)), this.opts.discriminator && this.addKeyword(s.default); + super._addVocabularies(), a.default.forEach((j) => this.addVocabulary(j)), this.opts.discriminator && this.addKeyword(s.default); } _addDefaultMetaSchema() { if (super._addDefaultMetaSchema(), !this.opts.meta) return; - const N = this.opts.$data ? this.$dataMetaSchema(c, p) : c; - this.addMetaSchema(N, b, !1), this.refs["http://json-schema.org/schema"] = b; + const j = this.opts.$data ? this.$dataMetaSchema(l, d) : l; + this.addMetaSchema(j, b, !1), this.refs["http://json-schema.org/schema"] = b; } defaultMeta() { return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(b) ? b : void 0); } } e.exports = t = _, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = _; - var y = er; + var y = rt; Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() { return y.KeywordCxt; } }); - var g = we; + var m = ie; Object.defineProperty(t, "_", { enumerable: !0, get: function() { - return g._; + return m._; } }), Object.defineProperty(t, "str", { enumerable: !0, get: function() { - return g.str; + return m.str; } }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() { - return g.stringify; + return m.stringify; } }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() { - return g.nil; + return m.nil; } }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() { - return g.Name; + return m.Name; } }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() { - return g.CodeGen; + return m.CodeGen; } }); - var S = Ja; + var k = _r; Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() { - return S.default; + return k.default; } }); - var L = Za; + var N = wr; Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() { - return L.default; + return N.default; } }); -})(vo, vo.exports); -var Of = vo.exports; -const Nf = /* @__PURE__ */ Ic(Of); -class Lf { +})(la, la.exports); +var mu = la.exports; +const gu = /* @__PURE__ */ oo(mu); +class bu { constructor() { - Ye(this, "ajv"), this.ajv = new Nf(); + Te(this, "ajv"), this.ajv = new gu(); } - validateJson(t, a) { - const n = this.ajv.validate(t, a); - return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() }; + validateJson(t, r) { + const a = this.ajv.validate(t, r); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; } - validateObjectSchema(t, a) { - const n = this.ajv.validate(t, a); - return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() }; + validateObjectSchema(t, r) { + const a = this.ajv.validate(t, r); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; } } -class Rf { +class yu { constructor() { - Ye(this, "TIME_SPLIT", " "); + Te(this, "TIME_SPLIT", " "); } /** * 给日期添加小时 @@ -4701,8 +4705,8 @@ class Rf { * @author terwer * @since 1.0.0 */ - addHoursToDate(t, a) { - return t.setTime(t.getTime() + a * 60 * 60 * 1e3), t; + addHoursToDate(t, r) { + return t.setTime(t.getTime() + r * 60 * 60 * 1e3), t; } /** * 转换ISO日期为中文日期的通用转换方法 @@ -4713,20 +4717,20 @@ class Rf { * @author terwer * @since 1.0.0 */ - formatIsoToZhDateFormat(t, a, n) { + formatIsoToZhDateFormat(t, r, a) { if (!t) return ""; let s = t; - const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, p = s.match(c); - if (p == null) + const l = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, d = s.match(l); + if (d == null) return t; - for (let b = 0; b < p.length; b++) { - const _ = p[b]; + for (let b = 0; b < d.length; b++) { + const _ = d[b]; let y = _; - a && (y = this.addHoursToDate(new Date(_), 8).toISOString()); - const g = y.split("T"), S = g[0], L = g[1].split(".")[0]; - let A = S + this.TIME_SPLIT + L; - n && (A = S), s = s.replace(_, A); + r && (y = this.addHoursToDate(new Date(_), 8).toISOString()); + const m = y.split("T"), k = m[0], N = m[1].split(".")[0]; + let A = k + this.TIME_SPLIT + N; + a && (A = k), s = s.replace(_, A); } return s; } @@ -4773,7 +4777,7 @@ class Rf { return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1]; } } -class If { +class _u { /** * 格式化字符串 * @@ -4782,13 +4786,13 @@ class If { * @author terwer * @since 0.0.1 */ - f(t, ...a) { - let n = t; - for (let s = 0; s < a.length; s++) { - const c = a[s]; - typeof c == "string" ? n = n.replace(`{${s}}`, c) : n = n.replace(`{${s}}`, c.toString()); + f(t, ...r) { + let a = t; + for (let s = 0; s < r.length; s++) { + const l = r[s]; + typeof l == "string" ? a = a.replace(`{${s}}`, l) : a = a.replace(`{${s}}`, l.toString()); } - return n; + return a; } /** * 字符串拼接 @@ -4804,13 +4808,13 @@ class If { * @param str - 字符串 * @param arr - 字符串数组 */ - includeInArray(t, a) { - let n = !1; - for (let s = 0; s < a.length; s++) { - const c = a[s]; - t.includes(c) && (n = !0); + includeInArray(t, r) { + let a = !1; + for (let s = 0; s < r.length; s++) { + const l = r[s]; + t.includes(l) && (a = !0); } - return n; + return a; } /** * 截取指定长度的字符串 @@ -4819,9 +4823,9 @@ class If { * @param length - 长度 * @param ignore - 不要结尾省略号 */ - getByLength(t, a, n) { + getByLength(t, r, a) { const s = t; - return s.length < a ? s : n ? s.substring(0, a) : s.substring(0, a) + "..."; + return s.length < r ? s : a ? s.substring(0, r) : s.substring(0, r) + "..."; } /** * 字符串空值检测 @@ -4837,10 +4841,10 @@ class If { * @param path1 - 路径1 * @param path2 - 路径2 */ - pathJoin(t, a) { - let n = t; + pathJoin(t, r) { + let a = t; const s = t.lastIndexOf("/"); - return s + 1 === t.length && (n = t.substring(0, s)), a.indexOf("/") > 0 ? n = n + "/" + a : n = n + a, n; + return s + 1 === t.length && (a = t.substring(0, s)), r.indexOf("/") > 0 ? a = a + "/" + r : a = a + r, a; } /** * 强转boolean @@ -4851,33 +4855,33 @@ class If { return t || (t = "false"), t.toString().toLowerCase() === "true"; } } -const fo = (e, t) => { - const a = Ai(e), n = Ai(t), s = a.pop(), c = n.pop(), p = zi(a, n); - return p !== 0 ? p : s && c ? zi(s.split("."), c.split(".")) : s || c ? s ? -1 : 1 : 0; -}, Af = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ai = (e) => { +const ia = (e, t) => { + const r = Bn(e), a = Bn(t), s = r.pop(), l = a.pop(), d = Fn(r, a); + return d !== 0 ? d : s && l ? Fn(s.split("."), l.split(".")) : s || l ? s ? -1 : 1 : 0; +}, wu = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Bn = (e) => { if (typeof e != "string") throw new TypeError("Invalid argument expected string"); - const t = e.match(Af); + const t = e.match(wu); if (!t) throw new Error(`Invalid argument not valid semver ('${e}' received)`); return t.shift(), t; -}, Mi = (e) => e === "*" || e === "x" || e === "X", Di = (e) => { +}, zn = (e) => e === "*" || e === "x" || e === "X", Vn = (e) => { const t = parseInt(e, 10); return isNaN(t) ? e : t; -}, Mf = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Df = (e, t) => { - if (Mi(e) || Mi(t)) +}, vu = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], ku = (e, t) => { + if (zn(e) || zn(t)) return 0; - const [a, n] = Mf(Di(e), Di(t)); - return a > n ? 1 : a < n ? -1 : 0; -}, zi = (e, t) => { - for (let a = 0; a < Math.max(e.length, t.length); a++) { - const n = Df(e[a] || "0", t[a] || "0"); - if (n !== 0) - return n; + const [r, a] = vu(Vn(e), Vn(t)); + return r > a ? 1 : r < a ? -1 : 0; +}, Fn = (e, t) => { + for (let r = 0; r < Math.max(e.length, t.length); r++) { + const a = ku(e[r] || "0", t[r] || "0"); + if (a !== 0) + return a; } return 0; }; -class zf { +class Eu { /** * Compare [semver](https://semver.org/) version strings * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. @@ -4886,8 +4890,8 @@ class zf { * @param v2 - Second version to compare * @returns boolean true if v1 is higher than v2 */ - greater(t, a) { - return fo(t, a) > 0; + greater(t, r) { + return ia(t, r) > 0; } /** * Compare [semver](https://semver.org/) version strings @@ -4897,8 +4901,8 @@ class zf { * @param v2 - Second version to compare * @returns boolean true if v1 is equal to v2 */ - equal(t, a) { - return fo(t, a) === 0; + equal(t, r) { + return ia(t, r) === 0; } /** * Compare [semver](https://semver.org/) version strings @@ -4908,27 +4912,27 @@ class zf { * @param v2 - Second version to compare * @returns boolean true if v1 is lesser than v2 */ - lesser(t, a) { - return fo(t, a) < 0; + lesser(t, r) { + return ia(t, r) < 0; } } -var Bf = Object.defineProperty, Vf = (e, t, a) => t in e ? Bf(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Yr = (e, t, a) => (Vf(e, typeof t != "symbol" ? t + "" : t, a), a); -let kr = class { +var $u = Object.defineProperty, Pu = (e, t, r) => t in e ? $u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ft = (e, t, r) => (Pu(e, typeof t != "symbol" ? t + "" : t, r), r); +let bt = class { }; -Yr(kr, "NODE_ENV_KEY", "NODE_ENV"), /** +Ft(bt, "NODE_ENV_KEY", "NODE_ENV"), /** * 开发环境 */ -Yr(kr, "NODE_ENV_DEVELOPMENT", "development"), /** +Ft(bt, "NODE_ENV_DEVELOPMENT", "development"), /** * 生产环境 */ -Yr(kr, "NODE_ENV_PRODUCTION", "production"), /** +Ft(bt, "NODE_ENV_PRODUCTION", "production"), /** * 测试环境 */ -Yr(kr, "NODE_ENV_TEST", "test"), /** +Ft(bt, "NODE_ENV_TEST", "test"), /** * 是否处于调试模式 */ -Yr(kr, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); -class Ff { +Ft(bt, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Su { /** * 环境初始化 * @@ -4936,31 +4940,31 @@ class Ff { * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} */ constructor(t) { - Yr(this, "envMeta"), this.envMeta = t; + Ft(this, "envMeta"), this.envMeta = t; } /** * 是否是开发阶段调试 */ isNodeDev() { - return this.getEnv(kr.NODE_ENV_KEY) === kr.NODE_ENV_DEVELOPMENT; + return this.getEnv(bt.NODE_ENV_KEY) === bt.NODE_ENV_DEVELOPMENT; } /** * 是否是调试阶段 */ isDev() { - return this.isNodeDev() || this.getBooleanEnv(kr.VITE_DEBUG_MODE_KEY); + return this.isNodeDev() || this.getBooleanEnv(bt.VITE_DEBUG_MODE_KEY); } /** * 获取环境变量,key不存在返回undefined * @param key - key */ getEnv(t) { - let a; + let r; try { - this.envMeta[t] && (a = this.envMeta[t]); + this.envMeta[t] && (r = this.envMeta[t]); } catch { } - return a; + return r; } /** * 获取String类型的环境变量,key不存在直接返回空值 @@ -4974,8 +4978,8 @@ class Ff { * @param key - key */ getBooleanEnv(t) { - let a = !1; - return this.getEnv(t) && (a = this.getStringEnv(t).toLowerCase() === "true"), a; + let r = !1; + return this.getEnv(t) && (r = this.getStringEnv(t).toLowerCase() === "true"), r; } /** * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 @@ -4985,34 +4989,34 @@ class Ff { * @since 0.1.0 * @author terwer */ - getEnvOrDefault(t, a) { - const n = this.getStringEnv(t); - return n.trim().length == 0 ? a : n; + getEnvOrDefault(t, r) { + const a = this.getStringEnv(t); + return a.trim().length == 0 ? r : a; } } -var Uf = Object.defineProperty, qf = (e, t, a) => t in e ? Uf(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, ra = (e, t, a) => (qf(e, typeof t != "symbol" ? t + "" : t, a), a); -let Nn = class { -}; -ra(Nn, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), ra(Nn, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); -var rr = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(rr || {}), yl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function ks(e) { +var Tu = Object.defineProperty, Cu = (e, t, r) => t in e ? Tu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ut = (e, t, r) => (Cu(e, typeof t != "symbol" ? t + "" : t, r), r); +class Gr { +} +Ut(Gr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Ut(Gr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var st = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(st || {}), Fo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function tn(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } -var bl = { exports: {} }; +var qo = { exports: {} }; (function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.log = a(); - })(yl, function() { + (function(t, r) { + e.exports ? e.exports = r() : t.log = r(); + })(Fo, function() { var t = function() { - }, a = "undefined", n = typeof window !== a && typeof window.navigator !== a && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ + }, r = "undefined", a = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ "trace", "debug", "info", "warn", "error" ]; - function c(C, T) { - var v = C[T]; + function l(C, x) { + var v = C[x]; if (typeof v.bind == "function") return v.bind(C); try { @@ -5023,196 +5027,196 @@ var bl = { exports: {} }; }; } } - function p() { + function d() { console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); } function b(C) { - return C === "debug" && (C = "log"), typeof console === a ? !1 : C === "trace" && n ? p : console[C] !== void 0 ? c(console, C) : console.log !== void 0 ? c(console, "log") : t; + return C === "debug" && (C = "log"), typeof console === r ? !1 : C === "trace" && a ? d : console[C] !== void 0 ? l(console, C) : console.log !== void 0 ? l(console, "log") : t; } - function _(C, T) { + function _(C, x) { for (var v = 0; v < s.length; v++) { - var j = s[v]; - this[j] = v < C ? t : this.methodFactory(j, C, T); + var T = s[v]; + this[T] = v < C ? t : this.methodFactory(T, C, x); } this.log = this.debug; } - function y(C, T, v) { + function y(C, x, v) { return function() { - typeof console !== a && (_.call(this, T, v), this[C].apply(this, arguments)); + typeof console !== r && (_.call(this, x, v), this[C].apply(this, arguments)); }; } - function g(C, T, v) { + function m(C, x, v) { return b(C) || y.apply(this, arguments); } - function S(C, T, v) { - var j = this, I; - T = T ?? "WARN"; - var r = "loglevel"; - typeof C == "string" ? r += ":" + C : typeof C == "symbol" && (r = void 0); - function i(m) { - var f = (s[m] || "silent").toUpperCase(); - if (!(typeof window === a || !r)) { + function k(C, x, v) { + var T = this, R; + x = x ?? "WARN"; + var n = "loglevel"; + typeof C == "string" ? n += ":" + C : typeof C == "symbol" && (n = void 0); + function i(f) { + var g = (s[f] || "silent").toUpperCase(); + if (!(typeof window === r || !n)) { try { - window.localStorage[r] = f; + window.localStorage[n] = g; return; } catch { } try { - window.document.cookie = encodeURIComponent(r) + "=" + f + ";"; + window.document.cookie = encodeURIComponent(n) + "=" + g + ";"; } catch { } } } function o() { - var m; - if (!(typeof window === a || !r)) { + var f; + if (!(typeof window === r || !n)) { try { - m = window.localStorage[r]; + f = window.localStorage[n]; } catch { } - if (typeof m === a) + if (typeof f === r) try { - var f = window.document.cookie, x = f.indexOf( - encodeURIComponent(r) + "=" + var g = window.document.cookie, O = g.indexOf( + encodeURIComponent(n) + "=" ); - x !== -1 && (m = /^([^;]+)/.exec(f.slice(x))[1]); + O !== -1 && (f = /^([^;]+)/.exec(g.slice(O))[1]); } catch { } - return j.levels[m] === void 0 && (m = void 0), m; + return T.levels[f] === void 0 && (f = void 0), f; } } - function l() { - if (!(typeof window === a || !r)) { + function c() { + if (!(typeof window === r || !n)) { try { - window.localStorage.removeItem(r); + window.localStorage.removeItem(n); return; } catch { } try { - window.document.cookie = encodeURIComponent(r) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + window.document.cookie = encodeURIComponent(n) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; } catch { } } } - j.name = C, j.levels = { + T.name = C, T.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 - }, j.methodFactory = v || g, j.getLevel = function() { - return I; - }, j.setLevel = function(m, f) { - if (typeof m == "string" && j.levels[m.toUpperCase()] !== void 0 && (m = j.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= j.levels.SILENT) { - if (I = m, f !== !1 && i(m), _.call(j, m, C), typeof console === a && m < j.levels.SILENT) + }, T.methodFactory = v || m, T.getLevel = function() { + return R; + }, T.setLevel = function(f, g) { + if (typeof f == "string" && T.levels[f.toUpperCase()] !== void 0 && (f = T.levels[f.toUpperCase()]), typeof f == "number" && f >= 0 && f <= T.levels.SILENT) { + if (R = f, g !== !1 && i(f), _.call(T, f, C), typeof console === r && f < T.levels.SILENT) return "No console available for logging"; } else - throw "log.setLevel() called with invalid level: " + m; - }, j.setDefaultLevel = function(m) { - T = m, o() || j.setLevel(m, !1); - }, j.resetLevel = function() { - j.setLevel(T, !1), l(); - }, j.enableAll = function(m) { - j.setLevel(j.levels.TRACE, m); - }, j.disableAll = function(m) { - j.setLevel(j.levels.SILENT, m); + throw "log.setLevel() called with invalid level: " + f; + }, T.setDefaultLevel = function(f) { + x = f, o() || T.setLevel(f, !1); + }, T.resetLevel = function() { + T.setLevel(x, !1), c(); + }, T.enableAll = function(f) { + T.setLevel(T.levels.TRACE, f); + }, T.disableAll = function(f) { + T.setLevel(T.levels.SILENT, f); }; var u = o(); - u == null && (u = T), j.setLevel(u, !1); + u == null && (u = x), T.setLevel(u, !1); } - var L = new S(), A = {}; - L.getLogger = function(C) { + var N = new k(), A = {}; + N.getLogger = function(C) { if (typeof C != "symbol" && typeof C != "string" || C === "") throw new TypeError("You must supply a name when creating a logger."); - var T = A[C]; - return T || (T = A[C] = new S( + var x = A[C]; + return x || (x = A[C] = new k( C, - L.getLevel(), - L.methodFactory - )), T; + N.getLevel(), + N.methodFactory + )), x; }; - var N = typeof window !== a ? window.log : void 0; - return L.noConflict = function() { - return typeof window !== a && window.log === L && (window.log = N), L; - }, L.getLoggers = function() { + var j = typeof window !== r ? window.log : void 0; + return N.noConflict = function() { + return typeof window !== r && window.log === N && (window.log = j), N; + }, N.getLoggers = function() { return A; - }, L.default = L, L; + }, N.default = N, N; }); -})(bl); -var Hf = bl.exports; -const ln = /* @__PURE__ */ ks(Hf); -var _l = { exports: {} }; +})(qo); +var xu = qo.exports; +const jr = /* @__PURE__ */ tn(xu); +var Uo = { exports: {} }; (function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.prefix = a(t); - })(yl, function(t) { - var a = function(g) { - for (var S = 1, L = arguments.length, A; S < L; S++) - for (A in arguments[S]) - Object.prototype.hasOwnProperty.call(arguments[S], A) && (g[A] = arguments[S][A]); - return g; - }, n = { + (function(t, r) { + e.exports ? e.exports = r() : t.prefix = r(t); + })(Fo, function(t) { + var r = function(m) { + for (var k = 1, N = arguments.length, A; k < N; k++) + for (A in arguments[k]) + Object.prototype.hasOwnProperty.call(arguments[k], A) && (m[A] = arguments[k][A]); + return m; + }, a = { template: "[%t] %l:", - levelFormatter: function(g) { - return g.toUpperCase(); + levelFormatter: function(m) { + return m.toUpperCase(); }, - nameFormatter: function(g) { - return g || "root"; + nameFormatter: function(m) { + return m || "root"; }, - timestampFormatter: function(g) { - return g.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + timestampFormatter: function(m) { + return m.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); }, format: void 0 - }, s, c = {}, p = function(g) { - if (!g || !g.getLogger) + }, s, l = {}, d = function(m) { + if (!m || !m.getLogger) throw new TypeError("Argument is not a root logger"); - s = g; - }, b = function(g, S) { - if (!g || !g.setLevel) + s = m; + }, b = function(m, k) { + if (!m || !m.setLevel) throw new TypeError("Argument is not a logger"); - var L = g.methodFactory, A = g.name || "", N = c[A] || c[""] || n; - function C(T, v, j) { - var I = L(T, v, j), r = c[j] || c[""], i = r.template.indexOf("%t") !== -1, o = r.template.indexOf("%l") !== -1, l = r.template.indexOf("%n") !== -1; + var N = m.methodFactory, A = m.name || "", j = l[A] || l[""] || a; + function C(x, v, T) { + var R = N(x, v, T), n = l[T] || l[""], i = n.template.indexOf("%t") !== -1, o = n.template.indexOf("%l") !== -1, c = n.template.indexOf("%n") !== -1; return function() { - for (var u = "", m = arguments.length, f = Array(m), x = 0; x < m; x++) - f[x] = arguments[x]; - if (A || !c[j]) { - var B = r.timestampFormatter(/* @__PURE__ */ new Date()), U = r.levelFormatter(T), z = r.nameFormatter(j); - r.format ? u += r.format(U, z, B) : (u += r.template, i && (u = u.replace(/%t/, B)), o && (u = u.replace(/%l/, U)), l && (u = u.replace(/%n/, z))), f.length && typeof f[0] == "string" ? f[0] = u + " " + f[0] : f.unshift(u); + for (var u = "", f = arguments.length, g = Array(f), O = 0; O < f; O++) + g[O] = arguments[O]; + if (A || !l[T]) { + var z = n.timestampFormatter(/* @__PURE__ */ new Date()), q = n.levelFormatter(x), B = n.nameFormatter(T); + n.format ? u += n.format(q, B, z) : (u += n.template, i && (u = u.replace(/%t/, z)), o && (u = u.replace(/%l/, q)), c && (u = u.replace(/%n/, B))), g.length && typeof g[0] == "string" ? g[0] = u + " " + g[0] : g.unshift(u); } - I.apply(void 0, f); + R.apply(void 0, g); }; } - return c[A] || (g.methodFactory = C), S = S || {}, S.template && (S.format = void 0), c[A] = a({}, N, S), g.setLevel(g.getLevel()), s || g.warn( + return l[A] || (m.methodFactory = C), k = k || {}, k.template && (k.format = void 0), l[A] = r({}, j, k), m.setLevel(m.getLevel()), s || m.warn( "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" - ), g; + ), m; }, _ = { - reg: p, + reg: d, apply: b }, y; return t && (y = t.prefix, _.noConflict = function() { return t.prefix === _ && (t.prefix = y), _; }), _; }); -})(_l); -var Gf = _l.exports; -const Bi = /* @__PURE__ */ ks(Gf); -function Kf() { +})(Uo); +var Ou = Uo.exports; +const qn = /* @__PURE__ */ tn(Ou); +function Nu() { const e = Error.prepareStackTrace; - Error.prepareStackTrace = (a, n) => n; + Error.prepareStackTrace = (r, a) => a; const t = new Error().stack.slice(1); return Error.prepareStackTrace = e, t; } -let Vi = class wl { +class Hr { /** * 解析日志级别为枚举 * * @param enumObj - 枚举对象 * @param value - 配置的值 */ - static stringToEnumValue(t, a) { - return t[Object.keys(t).filter((n) => t[n].toString() === a)[0]]; + static stringToEnumValue(t, r) { + return t[Object.keys(t).filter((a) => t[a].toString() === r)[0]]; } /** * 获取配置的日志级别 @@ -5220,22 +5224,22 @@ let Vi = class wl { static getEnvLevel(t) { if (!t) return; - const a = t.getEnvOrDefault(Nn.LOG_LEVEL_KEY, rr.LOG_LEVEL_INFO), n = wl.stringToEnumValue(rr, a.toUpperCase()); - return n || console.warn( + const r = t.getEnvOrDefault(Gr.LOG_LEVEL_KEY, st.LOG_LEVEL_INFO), a = Hr.stringToEnumValue(st, r.toUpperCase()); + return a || console.warn( "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" - ), n; + ), a; } /** * 获取默认日志 */ static getEnvLogger(t) { - return t ? t.getEnv(Nn.LOG_PREFIX_KEY) : void 0; + return t ? t.getEnv(Gr.LOG_PREFIX_KEY) : void 0; } -}; -var Es = { exports: {} }, Fi = { exports: {} }, Ui; -function Wf() { - return Ui || (Ui = 1, function(e) { - const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", a = typeof process < "u" && process.platform === "win32", n = typeof process < "u" && process.platform === "linux", s = { +} +var rn = { exports: {} }, Un = { exports: {} }, Gn; +function ju() { + return Gn || (Gn = 1, function(e) { + const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", s = { ballotDisabled: "☒", ballotOff: "☐", ballotOn: "☑", @@ -5262,7 +5266,7 @@ function Wf() { starsOff: "☆", starsOn: "★", upDownArrow: "↕" - }, c = Object.assign({}, s, { + }, l = Object.assign({}, s, { check: "√", cross: "×", ellipsisLarge: "...", @@ -5274,7 +5278,7 @@ function Wf() { radioOff: "( )", radioOn: "(*)", warning: "‼" - }), p = Object.assign({}, s, { + }), d = Object.assign({}, s, { ballotCross: "✘", check: "✔", cross: "✖", @@ -5283,169 +5287,169 @@ function Wf() { info: "ℹ", questionFull: "?", questionSmall: "﹖", - pointer: n ? "▸" : "❯", - pointerSmall: n ? "‣" : "›", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", radioOff: "◯", radioOn: "◉", warning: "⚠" }); - e.exports = a && !t ? c : p, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: c }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: p }); - }(Fi)), Fi.exports; + e.exports = r && !t ? l : d, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: d }); + }(Un)), Un.exports; } -const Jf = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Zf = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Yf = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, vl = () => { +const Lu = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Au = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Ru = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, Go = () => { const e = { - enabled: Yf(), + enabled: Ru(), visible: !0, styles: {}, keys: {} - }, t = (c) => { - let p = c.open = `\x1B[${c.codes[0]}m`, b = c.close = `\x1B[${c.codes[1]}m`, _ = c.regex = new RegExp(`\\u001b\\[${c.codes[1]}m`, "g"); - return c.wrap = (y, g) => { - y.includes(b) && (y = y.replace(_, b + p)); - let S = p + y + b; - return g ? S.replace(/\r*\n/g, `${b}$&${p}`) : S; - }, c; - }, a = (c, p, b) => typeof c == "function" ? c(p) : c.wrap(p, b), n = (c, p) => { - if (c === "" || c == null) + }, t = (l) => { + let d = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, _ = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g"); + return l.wrap = (y, m) => { + y.includes(b) && (y = y.replace(_, b + d)); + let k = d + y + b; + return m ? k.replace(/\r*\n/g, `${b}$&${d}`) : k; + }, l; + }, r = (l, d, b) => typeof l == "function" ? l(d) : l.wrap(d, b), a = (l, d) => { + if (l === "" || l == null) return ""; if (e.enabled === !1) - return c; + return l; if (e.visible === !1) return ""; - let b = "" + c, _ = b.includes(` -`), y = p.length; - for (y > 0 && p.includes("unstyle") && (p = [.../* @__PURE__ */ new Set(["unstyle", ...p])].reverse()); y-- > 0; ) - b = a(e.styles[p[y]], b, _); + let b = "" + l, _ = b.includes(` +`), y = d.length; + for (y > 0 && d.includes("unstyle") && (d = [.../* @__PURE__ */ new Set(["unstyle", ...d])].reverse()); y-- > 0; ) + b = r(e.styles[d[y]], b, _); return b; - }, s = (c, p, b) => { - e.styles[c] = t({ name: c, codes: p }), (e.keys[b] || (e.keys[b] = [])).push(c), Reflect.defineProperty(e, c, { + }, s = (l, d, b) => { + e.styles[l] = t({ name: l, codes: d }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, { configurable: !0, enumerable: !0, set(_) { - e.alias(c, _); + e.alias(l, _); }, get() { - let _ = (y) => n(y, _.stack); - return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(c) : [c], _; + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(l) : [l], _; } }); }; - return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Zf, e.hasColor = e.hasAnsi = (c) => (e.ansiRegex.lastIndex = 0, typeof c == "string" && c !== "" && e.ansiRegex.test(c)), e.alias = (c, p) => { - let b = typeof p == "string" ? e[p] : p; + return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Au, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, d) => { + let b = typeof d == "string" ? e[d] : d; if (typeof b != "function") throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); - b.stack || (Reflect.defineProperty(b, "name", { value: c }), e.styles[c] = b, b.stack = [c]), Reflect.defineProperty(e, c, { + b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, { configurable: !0, enumerable: !0, set(_) { - e.alias(c, _); + e.alias(l, _); }, get() { - let _ = (y) => n(y, _.stack); + let _ = (y) => a(y, _.stack); return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _; } }); - }, e.theme = (c) => { - if (!Jf(c)) + }, e.theme = (l) => { + if (!Lu(l)) throw new TypeError("Expected theme to be an object"); - for (let p of Object.keys(c)) - e.alias(p, c[p]); + for (let d of Object.keys(l)) + e.alias(d, l[d]); return e; - }, e.alias("unstyle", (c) => typeof c == "string" && c !== "" ? (e.ansiRegex.lastIndex = 0, c.replace(e.ansiRegex, "")) : ""), e.alias("noop", (c) => c), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = Wf(), e.define = s, e; + }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = ju(), e.define = s, e; }; -Es.exports = vl(); -Es.exports.create = vl; -var Qf = Es.exports; -const Tt = /* @__PURE__ */ ks(Qf); -let To, $l, kl, El, Pl = !0; -typeof process < "u" && ({ FORCE_COLOR: To, NODE_DISABLE_COLORS: $l, NO_COLOR: kl, TERM: El } = process.env || {}, Pl = process.stdout && process.stdout.isTTY); -const fe = { - enabled: !$l && kl == null && El !== "dumb" && (To != null && To !== "0" || Pl), +rn.exports = Go(); +rn.exports.create = Go; +var Iu = rn.exports; +const Ue = /* @__PURE__ */ tn(Iu); +let ma, Ho, Ko, Wo, Jo = !0; +typeof process < "u" && ({ FORCE_COLOR: ma, NODE_DISABLE_COLORS: Ho, NO_COLOR: Ko, TERM: Wo } = process.env || {}, Jo = process.stdout && process.stdout.isTTY); +const re = { + enabled: !Ho && Ko == null && Wo !== "dumb" && (ma != null && ma !== "0" || Jo), // modifiers - reset: Ce(0, 0), - bold: Ce(1, 22), - dim: Ce(2, 22), - italic: Ce(3, 23), - underline: Ce(4, 24), - inverse: Ce(7, 27), - hidden: Ce(8, 28), - strikethrough: Ce(9, 29), + reset: me(0, 0), + bold: me(1, 22), + dim: me(2, 22), + italic: me(3, 23), + underline: me(4, 24), + inverse: me(7, 27), + hidden: me(8, 28), + strikethrough: me(9, 29), // colors - black: Ce(30, 39), - red: Ce(31, 39), - green: Ce(32, 39), - yellow: Ce(33, 39), - blue: Ce(34, 39), - magenta: Ce(35, 39), - cyan: Ce(36, 39), - white: Ce(37, 39), - gray: Ce(90, 39), - grey: Ce(90, 39), + black: me(30, 39), + red: me(31, 39), + green: me(32, 39), + yellow: me(33, 39), + blue: me(34, 39), + magenta: me(35, 39), + cyan: me(36, 39), + white: me(37, 39), + gray: me(90, 39), + grey: me(90, 39), // background colors - bgBlack: Ce(40, 49), - bgRed: Ce(41, 49), - bgGreen: Ce(42, 49), - bgYellow: Ce(43, 49), - bgBlue: Ce(44, 49), - bgMagenta: Ce(45, 49), - bgCyan: Ce(46, 49), - bgWhite: Ce(47, 49) + bgBlack: me(40, 49), + bgRed: me(41, 49), + bgGreen: me(42, 49), + bgYellow: me(43, 49), + bgBlue: me(44, 49), + bgMagenta: me(45, 49), + bgCyan: me(46, 49), + bgWhite: me(47, 49) }; -function qi(e, t) { - let a = 0, n, s = "", c = ""; - for (; a < e.length; a++) - n = e[a], s += n.open, c += n.close, ~t.indexOf(n.close) && (t = t.replace(n.rgx, n.close + n.open)); - return s + t + c; -} -function Xf(e, t) { - let a = { has: e, keys: t }; - return a.reset = fe.reset.bind(a), a.bold = fe.bold.bind(a), a.dim = fe.dim.bind(a), a.italic = fe.italic.bind(a), a.underline = fe.underline.bind(a), a.inverse = fe.inverse.bind(a), a.hidden = fe.hidden.bind(a), a.strikethrough = fe.strikethrough.bind(a), a.black = fe.black.bind(a), a.red = fe.red.bind(a), a.green = fe.green.bind(a), a.yellow = fe.yellow.bind(a), a.blue = fe.blue.bind(a), a.magenta = fe.magenta.bind(a), a.cyan = fe.cyan.bind(a), a.white = fe.white.bind(a), a.gray = fe.gray.bind(a), a.grey = fe.grey.bind(a), a.bgBlack = fe.bgBlack.bind(a), a.bgRed = fe.bgRed.bind(a), a.bgGreen = fe.bgGreen.bind(a), a.bgYellow = fe.bgYellow.bind(a), a.bgBlue = fe.bgBlue.bind(a), a.bgMagenta = fe.bgMagenta.bind(a), a.bgCyan = fe.bgCyan.bind(a), a.bgWhite = fe.bgWhite.bind(a), a; -} -function Ce(e, t) { - let a = { +function Hn(e, t) { + let r = 0, a, s = "", l = ""; + for (; r < e.length; r++) + a = e[r], s += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open)); + return s + t + l; +} +function Mu(e, t) { + let r = { has: e, keys: t }; + return r.reset = re.reset.bind(r), r.bold = re.bold.bind(r), r.dim = re.dim.bind(r), r.italic = re.italic.bind(r), r.underline = re.underline.bind(r), r.inverse = re.inverse.bind(r), r.hidden = re.hidden.bind(r), r.strikethrough = re.strikethrough.bind(r), r.black = re.black.bind(r), r.red = re.red.bind(r), r.green = re.green.bind(r), r.yellow = re.yellow.bind(r), r.blue = re.blue.bind(r), r.magenta = re.magenta.bind(r), r.cyan = re.cyan.bind(r), r.white = re.white.bind(r), r.gray = re.gray.bind(r), r.grey = re.grey.bind(r), r.bgBlack = re.bgBlack.bind(r), r.bgRed = re.bgRed.bind(r), r.bgGreen = re.bgGreen.bind(r), r.bgYellow = re.bgYellow.bind(r), r.bgBlue = re.bgBlue.bind(r), r.bgMagenta = re.bgMagenta.bind(r), r.bgCyan = re.bgCyan.bind(r), r.bgWhite = re.bgWhite.bind(r), r; +} +function me(e, t) { + let r = { open: `\x1B[${e}m`, close: `\x1B[${t}m`, rgx: new RegExp(`\\x1b\\[${t}m`, "g") }; - return function(n) { - return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(a)), n === void 0 ? this : fe.enabled ? qi(this.keys, n + "") : n + "") : n === void 0 ? Xf([e], [a]) : fe.enabled ? qi([a], n + "") : n + ""; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(r)), a === void 0 ? this : re.enabled ? Hn(this.keys, a + "") : a + "") : a === void 0 ? Mu([e], [r]) : re.enabled ? Hn([r], a + "") : a + ""; }; } -var em = Object.defineProperty, tm = (e, t, a) => t in e ? em(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, We = (e, t, a) => (tm(e, typeof t != "symbol" ? t + "" : t, a), a); -const Wt = class { +var Du = Object.defineProperty, Bu = (e, t, r) => t in e ? Du(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Pe = (e, t, r) => (Bu(e, typeof t != "symbol" ? t + "" : t, r), r); +const Qe = class { /** * 检测是否运行在Chrome插件中 */ static isInChromeExtension() { - return Wt.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + return Qe.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; } }; -let Ee = Wt; -We(Ee, "isNode", typeof process < "u"), /** +let de = Qe; +Pe(de, "isNode", typeof process < "u"), /** * 是否在浏览器环境 */ -We(Ee, "isInBrowser", typeof window < "u"), /** +Pe(de, "isInBrowser", typeof window < "u"), /** * 浏览器路径分隔符 */ -We(Ee, "BrowserSeperator", "/"), /** +Pe(de, "BrowserSeperator", "/"), /** * 是否是Electron环境 */ -We(Ee, "isElectron", () => !Wt.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +Pe(de, "isElectron", () => !Qe.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** * 是否有Node环境,目前包括 Electron 和 Node */ -We(Ee, "hasNodeEnv", () => Wt.isElectron() || Wt.isNode), /** +Pe(de, "hasNodeEnv", () => Qe.isElectron() || Qe.isNode), /** * 获取url参数 * * @param sParam - 参数 */ -We(Ee, "getQueryString", (e) => { - if (!Wt.isInBrowser) +Pe(de, "getQueryString", (e) => { + if (!Qe.isInBrowser) return ""; const t = window.location.search.substring(1).split("&"); - for (let a = 0; a < t.length; a++) { - const n = t[a].split("="); - if (n[0] === e) - return n[1]; + for (let r = 0; r < t.length; r++) { + const a = t[r].split("="); + if (a[0] === e) + return a[1]; } return ""; }), /** @@ -5465,15 +5469,15 @@ We(Ee, "getQueryString", (e) => { * @param paramName - 参数名 * @param paramValue - 参数值 */ -We(Ee, "replaceUrlParam", (e, t, a) => { - a == null && (a = ""); - const n = new RegExp("\\b(" + t + "=).*?(&|#|$)"); - if (e.search(n) >= 0) - return e.replace(n, "$1" + a + "$2"); - const [s, c] = e.split("#"), [p, b] = s.split("?"), _ = new URLSearchParams(b); - _.set(t, a); - const y = _.toString(), g = p + (y ? "?" + y : ""); - return c ? g + "#" + c : g; +Pe(de, "replaceUrlParam", (e, t, r) => { + r == null && (r = ""); + const a = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + r + "$2"); + const [s, l] = e.split("#"), [d, b] = s.split("?"), _ = new URLSearchParams(b); + _.set(t, r); + const y = _.toString(), m = d + (y ? "?" + y : ""); + return l ? m + "#" + l : m; }), /** * 设置url参数 * @@ -5481,32 +5485,32 @@ We(Ee, "replaceUrlParam", (e, t, a) => { * @param key - key * @param value - value */ -We(Ee, "setUrlParameter", (e, t, a) => { +Pe(de, "setUrlParameter", (e, t, r) => { if (e.includes(t)) - return Wt.replaceUrlParam(e, t, a); - const n = e.split("#"); - let s = n[0]; - const c = n[1]; - return s.includes("?") ? s += `&${t}=${a}` : s += `?${t}=${a}`, c && (s += "#" + c), s; + return Qe.replaceUrlParam(e, t, r); + const a = e.split("#"); + let s = a[0]; + const l = a[1]; + return s.includes("?") ? s += `&${t}=${r}` : s += `?${t}=${r}`, l && (s += "#" + l), s; }), /** * 重新加载指定tab * * @param tabname - tabname * @param t - 延迟时间 */ -We(Ee, "reloadTabPage", (e, t = 200) => { +Pe(de, "reloadTabPage", (e, t = 200) => { setTimeout(function() { - if (Wt.isInBrowser) { - const a = window.location.href; - window.location.href = Wt.setUrlParameter(a, "tab", e); + if (Qe.isInBrowser) { + const r = window.location.href; + window.location.href = Qe.setUrlParameter(r, "tab", e); } }, t); }), /** * 刷新当前tab页面 */ -We(Ee, "reloadPage", () => { +Pe(de, "reloadPage", () => { setTimeout(function() { - Wt.isInBrowser && window.location.reload(); + Qe.isInBrowser && window.location.reload(); }, 200); }), /** * 刷新当前tab页面 @@ -5514,25 +5518,25 @@ We(Ee, "reloadPage", () => { * @param msg - 消息提示 * @param cb - 回调 */ -We(Ee, "reloadPageWithMessageCallback", (e, t) => { +Pe(de, "reloadPageWithMessageCallback", (e, t) => { t && t(e), setTimeout(function() { - Wt.isInBrowser && window.location.reload(); + Qe.isInBrowser && window.location.reload(); }, 200); }); -var dt = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(dt || {}); -const mt = class { +var je = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(je || {}); +const Ie = class { /** * 检测是否运行在思源打开的浏览器中 */ static isInSiyuanBrowser() { - return Ee.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + return de.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; } /** * 思源笔记 window 对象 */ static siyuanWindow() { - let t; - return this.isInSiyuanWidget() ? t = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? t = window : t = void 0, t; + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; } // ========================= // require end @@ -5546,29 +5550,29 @@ const mt = class { * @param jsPath - js相对路径全路径 * @param type - 类型 */ - static async importJs(t, a) { - let n = t; - switch (a) { - case dt.BasePathType_Appearance: - n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), t); + static async importJs(e, t) { + let r = e; + switch (t) { + case je.BasePathType_Appearance: + r = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); break; - case dt.BasePathType_Data: - n = this.browserJoinPath(this.siyuanDataRelativePath(), t); + case je.BasePathType_Data: + r = this.browserJoinPath(this.siyuanDataRelativePath(), e); break; - case dt.BasePathType_Themes: - n = this.browserJoinPath(this.siyuanThemeRelativePath(), t); + case je.BasePathType_Themes: + r = this.browserJoinPath(this.siyuanThemeRelativePath(), e); break; - case dt.BasePathType_ZhiTheme: - n = this.browserJoinPath(this.zhiThemeRelativePath(), t); + case je.BasePathType_ZhiTheme: + r = this.browserJoinPath(this.zhiThemeRelativePath(), e); break; default: throw new Error("type must be provided"); } - const { default: s } = await import( + const { default: a } = await import( /* @vite-ignore */ - n + r ); - return s; + return a; } /** * 引入json @@ -5635,8 +5639,8 @@ const mt = class { * * @param jsPath - 相对于 zhi 主题根路径的相对路径 */ - static async importZhiThemeJs(t) { - return await this.importJs(t, dt.BasePathType_ZhiTheme); + static async importZhiThemeJs(e) { + return await this.importJs(e, je.BasePathType_ZhiTheme); } // ========================= // import start @@ -5646,34 +5650,34 @@ const mt = class { * * @param paths - 路径数组 */ - static joinPath(...t) { - if (Ee.hasNodeEnv()) { - const a = this.requireLib("path"); - if (a) - return a.join(...t); + static joinPath(...e) { + if (de.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); } - return this.browserJoinPath(...t); + return this.browserJoinPath(...e); } - static browserJoinPath(...t) { - return t.join(Ee.BrowserSeperator); + static browserJoinPath(...e) { + return e.join(de.BrowserSeperator); } /** * 思源笔记 conf 目录 */ static siyuanConfPath() { - const t = this.siyuanWindow(); - if (!t) + const e = this.siyuanWindow(); + if (!e) throw new Error("Not in siyuan env"); - return t.siyuan.config.system.confDir; + return e.siyuan.config.system.confDir; } /** * 思源笔记 data 目录 */ static siyuanDataPath() { - const t = this.siyuanWindow(); - if (!t) + const e = this.siyuanWindow(); + if (!e) throw new Error("Not in siyuan env"); - return t.siyuan.config.system.dataDir; + return e.siyuan.config.system.dataDir; } /** * 思源笔记 data 目录-相对路径 @@ -5707,13 +5711,13 @@ const mt = class { * @since 0.1.0 */ static siyuanThemePath() { - if (Ee.hasNodeEnv()) + if (de.hasNodeEnv()) return this.joinPath(this.siyuanAppearancePath(), "themes"); { - const t = this.siyuanWindow(); - if (!t) + const e = this.siyuanWindow(); + if (!e) throw new Error("Not in siyuan env"); - return this.joinPath(t.location.origin, "appearance", "themes"); + return this.joinPath(e.location.origin, "appearance", "themes"); } } /** @@ -5737,8 +5741,8 @@ const mt = class { return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); } }; -let Nr = mt; -We(Nr, "isInSiyuanWidget", () => Ee.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +let St = Ie; +Pe(St, "isInSiyuanWidget", () => de.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** * 思源笔记新窗口 * * @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 @@ -5746,7 +5750,7 @@ We(Nr, "isInSiyuanWidget", () => Ee.isInBrowser ? window.frameElement != null && * @version 0.1.0 * @since 0.0.1 */ -We(Nr, "isInSiyuanNewWin", () => !Ee.isInBrowser || !Ee.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +Pe(St, "isInSiyuanNewWin", () => !de.isInBrowser || !de.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= // require start // ========================= /** @@ -5756,114 +5760,114 @@ We(Nr, "isInSiyuanNewWin", () => !Ee.isInBrowser || !Ee.isElectron() ? !1 : type * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 * @param type - 可选,以谁的基本路径为准 */ -We(Nr, "requireLib", (e, t = !0, a = dt.BasePathType_None) => { - if (!Ee.hasNodeEnv()) +Pe(St, "requireLib", (e, t = !0, r = je.BasePathType_None) => { + if (!de.hasNodeEnv()) throw new Error("require ony works on node env"); - let n = e; + let a = e; if (!t) - switch (a) { - case dt.BasePathType_Appearance: - n = mt.joinPath(mt.siyuanAppearancePath(), e); + switch (r) { + case je.BasePathType_Appearance: + a = Ie.joinPath(Ie.siyuanAppearancePath(), e); break; - case dt.BasePathType_Data: - n = mt.joinPath(mt.siyuanDataPath(), e); + case je.BasePathType_Data: + a = Ie.joinPath(Ie.siyuanDataPath(), e); break; - case dt.BasePathType_Themes: - n = mt.joinPath(mt.siyuanAppearancePath(), "themes", e); + case je.BasePathType_Themes: + a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", e); break; - case dt.BasePathType_ZhiTheme: - n = mt.joinPath(mt.siyuanAppearancePath(), "themes", "zhi", e); + case je.BasePathType_ZhiTheme: + a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", "zhi", e); break; default: throw new Error("type must be provided when not use absolute path"); } - const s = mt.siyuanWindow(); + const s = Ie.siyuanWindow(); if (!s) - return require(n); + return require(a); if (typeof s.require < "u") - return s.require(n); + return s.require(a); }), /** * 引入依赖,以 data 的基本路径为准 * * @param libpath - 相对于 appearance 的相对路径 */ -We(Nr, "requireAppearanceLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Appearance)), /** +Pe(St, "requireAppearanceLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Appearance)), /** * 引入依赖,以 data 的基本路径为准 * * @param libpath - 相对于 data 的相对路径 */ -We(Nr, "requireDataLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Data)), /** +Pe(St, "requireDataLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Data)), /** * 引入依赖,以 theme 的基本路径为准 * * @param libpath - 相对于 theme 的相对路径 */ -We(Nr, "requireThemesLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Themes)), /** +Pe(St, "requireThemesLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Themes)), /** * 引入依赖,以 ZhiTheme 的基本路径为准 * * @param libpath - 相对于 ZhiTheme 的相对路径 */ -We(Nr, "requireZhiThemeLib", (e) => mt.requireLib(e, !1, dt.BasePathType_ZhiTheme)); -const jt = { - white: (e) => Ee.isElectron() ? Tt.whiteBright(e) : fe.white(e), - gray: (e) => Ee.isElectron() ? Tt.gray(e) : fe.gray(e), - blue: (e) => Ee.isElectron() ? Tt.blue(e) : fe.blue(e), - green: (e) => Ee.isElectron() ? Tt.green(e) : fe.green(e), - yellow: (e) => Ee.isElectron() ? Tt.yellow(e) : fe.yellow(e), - red: (e) => Ee.isElectron() ? Tt.red(e) : fe.red(e), - bgWhite: (e) => Ee.isElectron() ? Tt.bgWhiteBright(e) : fe.bgWhite(e), - bgGrey: (e) => Ee.isElectron() ? Tt.bgCyanBright(e) : fe.bgCyan(e), - bgBlue: (e) => Ee.isElectron() ? Tt.bgBlueBright(e) : fe.bgBlue(e), - bgGreen: (e) => Ee.isElectron() ? Tt.bgGreenBright(e) : fe.bgGreen(e), - bgYellow: (e) => Ee.isElectron() ? Tt.bgYellowBright(e) : fe.bgYellow(e), - bgRed: (e) => Ee.isElectron() ? Tt.bgRedBright(e) : fe.bgRed(e) +Pe(St, "requireZhiThemeLib", (e) => Ie.requireLib(e, !1, je.BasePathType_ZhiTheme)); +const Ge = { + white: (e) => de.isElectron() ? Ue.whiteBright(e) : re.white(e), + gray: (e) => de.isElectron() ? Ue.gray(e) : re.gray(e), + blue: (e) => de.isElectron() ? Ue.blue(e) : re.blue(e), + green: (e) => de.isElectron() ? Ue.green(e) : re.green(e), + yellow: (e) => de.isElectron() ? Ue.yellow(e) : re.yellow(e), + red: (e) => de.isElectron() ? Ue.red(e) : re.red(e), + bgWhite: (e) => de.isElectron() ? Ue.bgWhiteBright(e) : re.bgWhite(e), + bgGrey: (e) => de.isElectron() ? Ue.bgCyanBright(e) : re.bgCyan(e), + bgBlue: (e) => de.isElectron() ? Ue.bgBlueBright(e) : re.bgBlue(e), + bgGreen: (e) => de.isElectron() ? Ue.bgGreenBright(e) : re.bgGreen(e), + bgYellow: (e) => de.isElectron() ? Ue.bgYellowBright(e) : re.bgYellow(e), + bgRed: (e) => de.isElectron() ? Ue.bgRedBright(e) : re.bgRed(e) }; -let rm = class { - constructor(t, a, n) { - ra(this, "consoleLogger", "console"), ra(this, "stackSize", 1), ra(this, "getLogger", (p) => { +class zu { + constructor(t, r, a) { + Ut(this, "consoleLogger", "console"), Ut(this, "stackSize", 1), Ut(this, "getLogger", (d) => { let b; - if (p) - b = p; + if (d) + b = d; else { - const _ = this.getCallStack(), y = [], g = []; - for (let S = 0; S < _.length; S++) { - const L = _[S], A = L.getFileName() ?? "none"; - if (S > this.stackSize - 1) + const _ = this.getCallStack(), y = [], m = []; + for (let k = 0; k < _.length; k++) { + const N = _[k], A = N.getFileName() ?? "none"; + if (k > this.stackSize - 1) break; - const N = A + "-" + L.getLineNumber() + ":" + L.getColumnNumber(); - y.push(N); + const j = A + "-" + N.getLineNumber() + ":" + N.getColumnNumber(); + y.push(j); } - g.length > 0 && (b = y.join(" -> ")); + m.length > 0 && (b = y.join(" -> ")); } - return (!b || b.trim().length === 0) && (b = this.consoleLogger), ln.getLogger(b); + return (!b || b.trim().length === 0) && (b = this.consoleLogger), jr.getLogger(b); }), this.stackSize = 1; let s; - t ? s = t : s = Vi.getEnvLevel(n), s = s ?? rr.LOG_LEVEL_INFO, ln.setLevel(s); - const c = (p, b, _, y) => { - const g = [], S = a ?? Vi.getEnvLogger(n) ?? "zhi"; - return g.push(jt.gray("[") + y(S) + jt.gray("]")), g.push(jt.gray("[") + jt.gray(_.toString()) + jt.gray("]")), g.push(y(p.toUpperCase().toString())), g.push(y(b)), g.push(jt.gray(":")), g; + t ? s = t : s = Hr.getEnvLevel(a), s = s ?? st.LOG_LEVEL_INFO, jr.setLevel(s); + const l = (d, b, _, y) => { + const m = [], k = r ?? Hr.getEnvLogger(a) ?? "zhi"; + return m.push(Ge.gray("[") + y(k) + Ge.gray("]")), m.push(Ge.gray("[") + Ge.gray(_.toString()) + Ge.gray("]")), m.push(y(d.toUpperCase().toString())), m.push(y(b)), m.push(Ge.gray(":")), m; }; - Bi.reg(ln), Bi.apply(ln, { - format(p, b, _) { + qn.reg(jr), qn.apply(jr, { + format(d, b, _) { let y = []; - const g = b ?? ""; - switch (p) { - case rr.LOG_LEVEL_TRACE: - y = c(p, g, _, jt.gray); + const m = b ?? ""; + switch (d) { + case st.LOG_LEVEL_TRACE: + y = l(d, m, _, Ge.gray); break; - case rr.LOG_LEVEL_DEBUG: - y = c(p, g, _, jt.blue); + case st.LOG_LEVEL_DEBUG: + y = l(d, m, _, Ge.blue); break; - case rr.LOG_LEVEL_INFO: - y = c(p, g, _, jt.green); + case st.LOG_LEVEL_INFO: + y = l(d, m, _, Ge.green); break; - case rr.LOG_LEVEL_WARN: - y = c(p, g, _, jt.yellow); + case st.LOG_LEVEL_WARN: + y = l(d, m, _, Ge.yellow); break; - case rr.LOG_LEVEL_ERROR: - y = c(p, g, _, jt.red); + case st.LOG_LEVEL_ERROR: + y = l(d, m, _, Ge.red); break; default: - y = c(rr.LOG_LEVEL_INFO, g, _, jt.green); + y = l(st.LOG_LEVEL_INFO, m, _, Ge.green); break; } return y.join(" "); @@ -5887,13 +5891,14 @@ let rm = class { getCallStack() { let t; try { - t = Kf(); + t = Nu(); } catch { t = []; } return t; } -}, am = class { +} +class Vu { /** * 默认日志级别 * @@ -5901,8 +5906,8 @@ let rm = class { * @param sign - 可选前缀,默认zhi * @param env - 可选环境变量实例 */ - constructor(t, a, n) { - ra(this, "logger"), this.logger = new rm(t, a, n); + constructor(t, r, a) { + Ut(this, "logger"), this.logger = new zu(t, r, a); } /** * 获取日志记录器 @@ -5911,12 +5916,13 @@ let rm = class { * @param stackSize - 打印栈的深度 * @protected */ - getLogger(t, a) { - return this.logger.setStackSize(a), this.logger.getLogger(t); + getLogger(t, r) { + return this.logger.setStackSize(r), this.logger.getLogger(t); } -}, Hi = class extends am { - constructor(t, a, n) { - super(t, a, n); +} +class Kn extends Vu { + constructor(t, r, a) { + super(t, r, a); } /** * 获取默认的日志记录器 @@ -5924,18 +5930,19 @@ let rm = class { * @param loggerName - 日志记录器名称 * @param stackSize - 打印栈的深度 */ - getLogger(t, a) { - return super.getLogger(t, a); + getLogger(t, r) { + return super.getLogger(t, r); } -}, nm = class Sl { +} +class an { /** * 默认日志记录器 * * @param stackSize - 栈的深度 * @param env - 环境变量实例 */ - static defaultLogger(t, a) { - return Sl.customLogFactory(void 0, void 0, t).getLogger(void 0, a); + static defaultLogger(t, r) { + return an.customLogFactory(void 0, void 0, t).getLogger(void 0, r); } /** * 自定义日志工厂 @@ -5944,8 +5951,8 @@ let rm = class { * @param sign - 标志 * @param env - 环境变量 */ - static customLogFactory(t, a, n) { - return new Hi(t, a, n); + static customLogFactory(t, r, a) { + return new Kn(t, r, a); } /** * 自定义日志工厂,自定义前缀 @@ -5953,12 +5960,12 @@ let rm = class { * @param sign - 标志 * @param env - 环境变量 */ - static customSignLogFactory(t, a) { - return new Hi(void 0, t, a); + static customSignLogFactory(t, r) { + return new Kn(void 0, t, r); } -}; -const om = "zhi"; -let vn = class { +} +const Fu = "zhi"; +class Dr { /** * 某些情况下,可能需要手动 init 之后才能用 */ @@ -5986,11 +5993,11 @@ let vn = class { * @param sign - 标志 * @param loggerName - 日志名称 */ - static zhiLogWithSign(t, a) { - if (this.loggerMap[a]) - return this.loggerMap[a].debug("Zhi-log use cache"), this.loggerMap[a]; - const n = this.env, s = nm.customSignLogFactory(t, n).getLogger(a); - return this.loggerMap[a] = s, s.debug("Zhi-log add new logger"), s; + static zhiLogWithSign(t, r) { + if (this.loggerMap[r]) + return this.loggerMap[r].debug("Zhi-log use cache"), this.loggerMap[r]; + const a = this.env, s = an.customSignLogFactory(t, a).getLogger(r); + return this.loggerMap[r] = s, s.debug("Zhi-log add new logger"), s; } /** * 获取 zhi-log 实例 @@ -5998,30 +6005,30 @@ let vn = class { * @param loggerName - 日志名称 */ static zhiLog(t) { - return this.zhiLogWithSign(om, t); + return this.zhiLogWithSign(Fu, t); } /** * 获取 zhi-common 实例 */ static zhiCommon() { - return this.common || (this.common = new um()), this.common; + return this.common || (this.common = new Ku()), this.common; } -}; -Ye(vn, "env"), /** +} +Te(Dr, "env"), /** * zhi-util 的日志器缓存 */ -Ye(vn, "loggerMap", {}), /** +Te(Dr, "loggerMap", {}), /** * zhi-util 的通用工具类 */ -Ye(vn, "common"); -class Ps extends vn { +Te(Dr, "common"); +class nn extends Dr { static zhiEnv() { - return this.env || (this.env = new Ff({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + return this.env || (this.env = new Su({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; } } -let Gi = class { +class Wn { constructor() { - Ye(this, "logger"), this.logger = Ps.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); + Te(this, "logger"), this.logger = nn.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); } isAvailable() { return typeof Lute < "u"; @@ -6033,8 +6040,8 @@ let Gi = class { * @private */ highlightWords(t) { - const a = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); - return t.replace(a, '$1'); + const r = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); + return t.replace(r, '$1'); } /** * 渲染Markdown @@ -6044,8 +6051,8 @@ let Gi = class { async renderMarkdownStr(t) { if (!this.isAvailable()) return this.logger.error("Lute is not available, will return original md"), t; - const a = Lute, n = a.New(), s = { - renderText: (c, p) => p ? [this.highlightWords(c.Text()), a.WalkContinue] : ["", a.WalkContinue] + const r = Lute, a = r.New(), s = { + renderText: (l, d) => d ? [this.highlightWords(l.Text()), r.WalkContinue] : ["", r.WalkContinue] // renderStrong: (node: any, entering: any) => { // return ["", luteObj.WalkContinue] // }, @@ -6053,17 +6060,17 @@ let Gi = class { // return ["", luteObj.WalkContinue] // } }; - return n.SetJSRenderers({ + return a.SetJSRenderers({ renderers: { Md2HTML: s } - }), this.logger.info("Lute is rendering md to HTML..."), n.MarkdownStr("", t); + }), this.logger.info("Lute is rendering md to HTML..."), a.MarkdownStr("", t); } -}; -var xl = { exports: {} }; +} +var Zo = { exports: {} }; (function(e) { (function() { - function t(r) { + function t(n) { var i = { omitExtraWLInCodeBlocks: { defaultValue: !1, @@ -6231,20 +6238,20 @@ var xl = { exports: {} }; type: "boolean" } }; - if (r === !1) + if (n === !1) return JSON.parse(JSON.stringify(i)); var o = {}; - for (var l in i) - i.hasOwnProperty(l) && (o[l] = i[l].defaultValue); + for (var c in i) + i.hasOwnProperty(c) && (o[c] = i[c].defaultValue); return o; } - function a() { - var r = t(!0), i = {}; - for (var o in r) - r.hasOwnProperty(o) && (i[o] = !0); + function r() { + var n = t(!0), i = {}; + for (var o in n) + n.hasOwnProperty(o) && (i[o] = !0); return i; } - var n = {}, s = {}, c = {}, p = t(!0), b = "vanilla", _ = { + var a = {}, s = {}, l = {}, d = t(!0), b = "vanilla", _ = { github: { omitExtraWLInCodeBlocks: !0, simplifiedAutoLink: !0, @@ -6286,209 +6293,209 @@ var xl = { exports: {} }; encodeEmails: !0 }, vanilla: t(!0), - allOn: a() + allOn: r() }; - n.helper = {}, n.extensions = {}, n.setOption = function(r, i) { - return p[r] = i, this; - }, n.getOption = function(r) { - return p[r]; - }, n.getOptions = function() { - return p; - }, n.resetOptions = function() { - p = t(!0); - }, n.setFlavor = function(r) { - if (!_.hasOwnProperty(r)) - throw Error(r + " flavor was not found"); - n.resetOptions(); - var i = _[r]; - b = r; + a.helper = {}, a.extensions = {}, a.setOption = function(n, i) { + return d[n] = i, this; + }, a.getOption = function(n) { + return d[n]; + }, a.getOptions = function() { + return d; + }, a.resetOptions = function() { + d = t(!0); + }, a.setFlavor = function(n) { + if (!_.hasOwnProperty(n)) + throw Error(n + " flavor was not found"); + a.resetOptions(); + var i = _[n]; + b = n; for (var o in i) - i.hasOwnProperty(o) && (p[o] = i[o]); - }, n.getFlavor = function() { + i.hasOwnProperty(o) && (d[o] = i[o]); + }, a.getFlavor = function() { return b; - }, n.getFlavorOptions = function(r) { - if (_.hasOwnProperty(r)) - return _[r]; - }, n.getDefaultOptions = function(r) { - return t(r); - }, n.subParser = function(r, i) { - if (n.helper.isString(r)) + }, a.getFlavorOptions = function(n) { + if (_.hasOwnProperty(n)) + return _[n]; + }, a.getDefaultOptions = function(n) { + return t(n); + }, a.subParser = function(n, i) { + if (a.helper.isString(n)) if (typeof i < "u") - s[r] = i; + s[n] = i; else { - if (s.hasOwnProperty(r)) - return s[r]; - throw Error("SubParser named " + r + " not registered!"); + if (s.hasOwnProperty(n)) + return s[n]; + throw Error("SubParser named " + n + " not registered!"); } - }, n.extension = function(r, i) { - if (!n.helper.isString(r)) + }, a.extension = function(n, i) { + if (!a.helper.isString(n)) throw Error("Extension 'name' must be a string"); - if (r = n.helper.stdExtName(r), n.helper.isUndefined(i)) { - if (!c.hasOwnProperty(r)) - throw Error("Extension named " + r + " is not registered!"); - return c[r]; + if (n = a.helper.stdExtName(n), a.helper.isUndefined(i)) { + if (!l.hasOwnProperty(n)) + throw Error("Extension named " + n + " is not registered!"); + return l[n]; } else { - typeof i == "function" && (i = i()), n.helper.isArray(i) || (i = [i]); - var o = y(i, r); + typeof i == "function" && (i = i()), a.helper.isArray(i) || (i = [i]); + var o = y(i, n); if (o.valid) - c[r] = i; + l[n] = i; else throw Error(o.error); } - }, n.getAllExtensions = function() { - return c; - }, n.removeExtension = function(r) { - delete c[r]; - }, n.resetExtensions = function() { - c = {}; + }, a.getAllExtensions = function() { + return l; + }, a.removeExtension = function(n) { + delete l[n]; + }, a.resetExtensions = function() { + l = {}; }; - function y(r, i) { - var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", l = { + function y(n, i) { + var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", c = { valid: !0, error: "" }; - n.helper.isArray(r) || (r = [r]); - for (var u = 0; u < r.length; ++u) { - var m = o + " sub-extension " + u + ": ", f = r[u]; - if (typeof f != "object") - return l.valid = !1, l.error = m + "must be an object, but " + typeof f + " given", l; - if (!n.helper.isString(f.type)) - return l.valid = !1, l.error = m + 'property "type" must be a string, but ' + typeof f.type + " given", l; - var x = f.type = f.type.toLowerCase(); - if (x === "language" && (x = f.type = "lang"), x === "html" && (x = f.type = "output"), x !== "lang" && x !== "output" && x !== "listener") - return l.valid = !1, l.error = m + "type " + x + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', l; - if (x === "listener") { - if (n.helper.isUndefined(f.listeners)) - return l.valid = !1, l.error = m + '. Extensions of type "listener" must have a property called "listeners"', l; - } else if (n.helper.isUndefined(f.filter) && n.helper.isUndefined(f.regex)) - return l.valid = !1, l.error = m + x + ' extensions must define either a "regex" property or a "filter" method', l; - if (f.listeners) { - if (typeof f.listeners != "object") - return l.valid = !1, l.error = m + '"listeners" property must be an object but ' + typeof f.listeners + " given", l; - for (var B in f.listeners) - if (f.listeners.hasOwnProperty(B) && typeof f.listeners[B] != "function") - return l.valid = !1, l.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + B + " must be a function but " + typeof f.listeners[B] + " given", l; + a.helper.isArray(n) || (n = [n]); + for (var u = 0; u < n.length; ++u) { + var f = o + " sub-extension " + u + ": ", g = n[u]; + if (typeof g != "object") + return c.valid = !1, c.error = f + "must be an object, but " + typeof g + " given", c; + if (!a.helper.isString(g.type)) + return c.valid = !1, c.error = f + 'property "type" must be a string, but ' + typeof g.type + " given", c; + var O = g.type = g.type.toLowerCase(); + if (O === "language" && (O = g.type = "lang"), O === "html" && (O = g.type = "output"), O !== "lang" && O !== "output" && O !== "listener") + return c.valid = !1, c.error = f + "type " + O + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', c; + if (O === "listener") { + if (a.helper.isUndefined(g.listeners)) + return c.valid = !1, c.error = f + '. Extensions of type "listener" must have a property called "listeners"', c; + } else if (a.helper.isUndefined(g.filter) && a.helper.isUndefined(g.regex)) + return c.valid = !1, c.error = f + O + ' extensions must define either a "regex" property or a "filter" method', c; + if (g.listeners) { + if (typeof g.listeners != "object") + return c.valid = !1, c.error = f + '"listeners" property must be an object but ' + typeof g.listeners + " given", c; + for (var z in g.listeners) + if (g.listeners.hasOwnProperty(z) && typeof g.listeners[z] != "function") + return c.valid = !1, c.error = f + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + z + " must be a function but " + typeof g.listeners[z] + " given", c; } - if (f.filter) { - if (typeof f.filter != "function") - return l.valid = !1, l.error = m + '"filter" must be a function, but ' + typeof f.filter + " given", l; - } else if (f.regex) { - if (n.helper.isString(f.regex) && (f.regex = new RegExp(f.regex, "g")), !(f.regex instanceof RegExp)) - return l.valid = !1, l.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof f.regex + " given", l; - if (n.helper.isUndefined(f.replace)) - return l.valid = !1, l.error = m + '"regex" extensions must implement a replace string or function', l; + if (g.filter) { + if (typeof g.filter != "function") + return c.valid = !1, c.error = f + '"filter" must be a function, but ' + typeof g.filter + " given", c; + } else if (g.regex) { + if (a.helper.isString(g.regex) && (g.regex = new RegExp(g.regex, "g")), !(g.regex instanceof RegExp)) + return c.valid = !1, c.error = f + '"regex" property must either be a string or a RegExp object, but ' + typeof g.regex + " given", c; + if (a.helper.isUndefined(g.replace)) + return c.valid = !1, c.error = f + '"regex" extensions must implement a replace string or function', c; } } - return l; + return c; } - n.validateExtension = function(r) { - var i = y(r, null); + a.validateExtension = function(n) { + var i = y(n, null); return i.valid ? !0 : (console.warn(i.error), !1); - }, n.hasOwnProperty("helper") || (n.helper = {}), n.helper.isString = function(r) { - return typeof r == "string" || r instanceof String; - }, n.helper.isFunction = function(r) { + }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function(n) { + return typeof n == "string" || n instanceof String; + }, a.helper.isFunction = function(n) { var i = {}; - return r && i.toString.call(r) === "[object Function]"; - }, n.helper.isArray = function(r) { - return Array.isArray(r); - }, n.helper.isUndefined = function(r) { - return typeof r > "u"; - }, n.helper.forEach = function(r, i) { - if (n.helper.isUndefined(r)) + return n && i.toString.call(n) === "[object Function]"; + }, a.helper.isArray = function(n) { + return Array.isArray(n); + }, a.helper.isUndefined = function(n) { + return typeof n > "u"; + }, a.helper.forEach = function(n, i) { + if (a.helper.isUndefined(n)) throw new Error("obj param is required"); - if (n.helper.isUndefined(i)) + if (a.helper.isUndefined(i)) throw new Error("callback param is required"); - if (!n.helper.isFunction(i)) + if (!a.helper.isFunction(i)) throw new Error("callback param must be a function/closure"); - if (typeof r.forEach == "function") - r.forEach(i); - else if (n.helper.isArray(r)) - for (var o = 0; o < r.length; o++) - i(r[o], o, r); - else if (typeof r == "object") - for (var l in r) - r.hasOwnProperty(l) && i(r[l], l, r); + if (typeof n.forEach == "function") + n.forEach(i); + else if (a.helper.isArray(n)) + for (var o = 0; o < n.length; o++) + i(n[o], o, n); + else if (typeof n == "object") + for (var c in n) + n.hasOwnProperty(c) && i(n[c], c, n); else throw new Error("obj does not seem to be an array or an iterable object"); - }, n.helper.stdExtName = function(r) { - return r.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); + }, a.helper.stdExtName = function(n) { + return n.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); }; - function g(r, i) { + function m(n, i) { var o = i.charCodeAt(0); return "¨E" + o + "E"; } - n.helper.escapeCharactersCallback = g, n.helper.escapeCharacters = function(r, i, o) { - var l = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])"; - o && (l = "\\\\" + l); - var u = new RegExp(l, "g"); - return r = r.replace(u, g), r; - }, n.helper.unescapeHTMLEntities = function(r) { - return r.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); + a.helper.escapeCharactersCallback = m, a.helper.escapeCharacters = function(n, i, o) { + var c = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])"; + o && (c = "\\\\" + c); + var u = new RegExp(c, "g"); + return n = n.replace(u, m), n; + }, a.helper.unescapeHTMLEntities = function(n) { + return n.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); }; - var S = function(r, i, o, l) { - var u = l || "", m = u.indexOf("g") > -1, f = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), x = new RegExp(i, u.replace(/g/g, "")), B = [], U, z, H, w, q; + var k = function(n, i, o, c) { + var u = c || "", f = u.indexOf("g") > -1, g = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), O = new RegExp(i, u.replace(/g/g, "")), z = [], q, B, G, w, U; do - for (U = 0; H = f.exec(r); ) - if (x.test(H[0])) - U++ || (z = f.lastIndex, w = z - H[0].length); - else if (U && !--U) { - q = H.index + H[0].length; + for (q = 0; G = g.exec(n); ) + if (O.test(G[0])) + q++ || (B = g.lastIndex, w = B - G[0].length); + else if (q && !--q) { + U = G.index + G[0].length; var W = { - left: { start: w, end: z }, - match: { start: z, end: H.index }, - right: { start: H.index, end: q }, - wholeMatch: { start: w, end: q } + left: { start: w, end: B }, + match: { start: B, end: G.index }, + right: { start: G.index, end: U }, + wholeMatch: { start: w, end: U } }; - if (B.push(W), !m) - return B; + if (z.push(W), !f) + return z; } - while (U && (f.lastIndex = z)); - return B; + while (q && (g.lastIndex = B)); + return z; }; - n.helper.matchRecursiveRegExp = function(r, i, o, l) { - for (var u = S(r, i, o, l), m = [], f = 0; f < u.length; ++f) - m.push([ - r.slice(u[f].wholeMatch.start, u[f].wholeMatch.end), - r.slice(u[f].match.start, u[f].match.end), - r.slice(u[f].left.start, u[f].left.end), - r.slice(u[f].right.start, u[f].right.end) + a.helper.matchRecursiveRegExp = function(n, i, o, c) { + for (var u = k(n, i, o, c), f = [], g = 0; g < u.length; ++g) + f.push([ + n.slice(u[g].wholeMatch.start, u[g].wholeMatch.end), + n.slice(u[g].match.start, u[g].match.end), + n.slice(u[g].left.start, u[g].left.end), + n.slice(u[g].right.start, u[g].right.end) ]); - return m; - }, n.helper.replaceRecursiveRegExp = function(r, i, o, l, u) { - if (!n.helper.isFunction(i)) { - var m = i; + return f; + }, a.helper.replaceRecursiveRegExp = function(n, i, o, c, u) { + if (!a.helper.isFunction(i)) { + var f = i; i = function() { - return m; + return f; }; } - var f = S(r, o, l, u), x = r, B = f.length; - if (B > 0) { - var U = []; - f[0].wholeMatch.start !== 0 && U.push(r.slice(0, f[0].wholeMatch.start)); - for (var z = 0; z < B; ++z) - U.push( + var g = k(n, o, c, u), O = n, z = g.length; + if (z > 0) { + var q = []; + g[0].wholeMatch.start !== 0 && q.push(n.slice(0, g[0].wholeMatch.start)); + for (var B = 0; B < z; ++B) + q.push( i( - r.slice(f[z].wholeMatch.start, f[z].wholeMatch.end), - r.slice(f[z].match.start, f[z].match.end), - r.slice(f[z].left.start, f[z].left.end), - r.slice(f[z].right.start, f[z].right.end) + n.slice(g[B].wholeMatch.start, g[B].wholeMatch.end), + n.slice(g[B].match.start, g[B].match.end), + n.slice(g[B].left.start, g[B].left.end), + n.slice(g[B].right.start, g[B].right.end) ) - ), z < B - 1 && U.push(r.slice(f[z].wholeMatch.end, f[z + 1].wholeMatch.start)); - f[B - 1].wholeMatch.end < r.length && U.push(r.slice(f[B - 1].wholeMatch.end)), x = U.join(""); + ), B < z - 1 && q.push(n.slice(g[B].wholeMatch.end, g[B + 1].wholeMatch.start)); + g[z - 1].wholeMatch.end < n.length && q.push(n.slice(g[z - 1].wholeMatch.end)), O = q.join(""); } - return x; - }, n.helper.regexIndexOf = function(r, i, o) { - if (!n.helper.isString(r)) + return O; + }, a.helper.regexIndexOf = function(n, i, o) { + if (!a.helper.isString(n)) throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; if (!(i instanceof RegExp)) throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; - var l = r.substring(o || 0).search(i); - return l >= 0 ? l + (o || 0) : l; - }, n.helper.splitAtIndex = function(r, i) { - if (!n.helper.isString(r)) + var c = n.substring(o || 0).search(i); + return c >= 0 ? c + (o || 0) : c; + }, a.helper.splitAtIndex = function(n, i) { + if (!a.helper.isString(n)) throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; - return [r.substring(0, i), r.substring(i)]; - }, n.helper.encodeEmailAddress = function(r) { + return [n.substring(0, i), n.substring(i)]; + }, a.helper.encodeEmailAddress = function(n) { var i = [ function(o) { return "&#" + o.charCodeAt(0) + ";"; @@ -6500,30 +6507,30 @@ var xl = { exports: {} }; return o; } ]; - return r = r.replace(/./g, function(o) { + return n = n.replace(/./g, function(o) { if (o === "@") o = i[Math.floor(Math.random() * 2)](o); else { - var l = Math.random(); - o = l > 0.9 ? i[2](o) : l > 0.45 ? i[1](o) : i[0](o); + var c = Math.random(); + o = c > 0.9 ? i[2](o) : c > 0.45 ? i[1](o) : i[0](o); } return o; - }), r; - }, n.helper.padEnd = function(r, i, o) { - return i = i >> 0, o = String(o || " "), r.length > i ? String(r) : (i = i - r.length, i > o.length && (o += o.repeat(i / o.length)), String(r) + o.slice(0, i)); + }), n; + }, a.helper.padEnd = function(n, i, o) { + return i = i >> 0, o = String(o || " "), n.length > i ? String(n) : (i = i - n.length, i > o.length && (o += o.repeat(i / o.length)), String(n) + o.slice(0, i)); }, typeof console > "u" && (console = { - warn: function(r) { - alert(r); + warn: function(n) { + alert(n); }, - log: function(r) { - alert(r); + log: function(n) { + alert(n); }, - error: function(r) { - throw r; + error: function(n) { + throw n; } - }), n.helper.regexes = { + }), a.helper.regexes = { asteriskDashAndColon: /([*_:~])/g - }, n.helper.emojis = { + }, a.helper.emojis = { "+1": "👍", "-1": "👎", 100: "💯", @@ -7700,35 +7707,35 @@ var xl = { exports: {} }; /* special emojis :P */ octocat: ':octocat:', showdown: `S` - }, n.Converter = function(r) { - var i = {}, o = [], l = [], u = {}, m = b, f = { + }, a.Converter = function(n) { + var i = {}, o = [], c = [], u = {}, f = b, g = { parsed: {}, raw: "", format: "" }; - x(); - function x() { - r = r || {}; - for (var w in p) - p.hasOwnProperty(w) && (i[w] = p[w]); - if (typeof r == "object") - for (var q in r) - r.hasOwnProperty(q) && (i[q] = r[q]); + O(); + function O() { + n = n || {}; + for (var w in d) + d.hasOwnProperty(w) && (i[w] = d[w]); + if (typeof n == "object") + for (var U in n) + n.hasOwnProperty(U) && (i[U] = n[U]); else - throw Error("Converter expects the passed parameter to be an object, but " + typeof r + " was passed instead."); - i.extensions && n.helper.forEach(i.extensions, B); + throw Error("Converter expects the passed parameter to be an object, but " + typeof n + " was passed instead."); + i.extensions && a.helper.forEach(i.extensions, z); } - function B(w, q) { - if (q = q || null, n.helper.isString(w)) - if (w = n.helper.stdExtName(w), q = w, n.extensions[w]) { - console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), U(n.extensions[w], w); + function z(w, U) { + if (U = U || null, a.helper.isString(w)) + if (w = a.helper.stdExtName(w), U = w, a.extensions[w]) { + console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), q(a.extensions[w], w); return; - } else if (!n.helper.isUndefined(c[w])) - w = c[w]; + } else if (!a.helper.isUndefined(l[w])) + w = l[w]; else throw Error('Extension "' + w + '" could not be loaded. It was either not found or is not a valid extension.'); - typeof w == "function" && (w = w()), n.helper.isArray(w) || (w = [w]); - var W = y(w, q); + typeof w == "function" && (w = w()), a.helper.isArray(w) || (w = [w]); + var W = y(w, U); if (!W.valid) throw Error(W.error); for (var J = 0; J < w.length; ++J) { @@ -7737,17 +7744,17 @@ var xl = { exports: {} }; o.push(w[J]); break; case "output": - l.push(w[J]); + c.push(w[J]); break; } if (w[J].hasOwnProperty("listeners")) for (var V in w[J].listeners) - w[J].listeners.hasOwnProperty(V) && z(V, w[J].listeners[V]); + w[J].listeners.hasOwnProperty(V) && B(V, w[J].listeners[V]); } } - function U(w, q) { - typeof w == "function" && (w = w(new n.Converter())), n.helper.isArray(w) || (w = [w]); - var W = y(w, q); + function q(w, U) { + typeof w == "function" && (w = w(new a.Converter())), a.helper.isArray(w) || (w = [w]); + var W = y(w, U); if (!W.valid) throw Error(W.error); for (var J = 0; J < w.length; ++J) @@ -7756,36 +7763,36 @@ var xl = { exports: {} }; o.push(w[J]); break; case "output": - l.push(w[J]); + c.push(w[J]); break; default: throw Error("Extension loader error: Type unrecognized!!!"); } } - function z(w, q) { - if (!n.helper.isString(w)) + function B(w, U) { + if (!a.helper.isString(w)) throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof w + " given"); - if (typeof q != "function") - throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof q + " given"); - u.hasOwnProperty(w) || (u[w] = []), u[w].push(q); + if (typeof U != "function") + throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof U + " given"); + u.hasOwnProperty(w) || (u[w] = []), u[w].push(U); } - function H(w) { - var q = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + q + "}", "gm"); + function G(w) { + var U = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + U + "}", "gm"); return w.replace(W, ""); } - this._dispatch = function(w, q, W, J) { + this._dispatch = function(w, U, W, J) { if (u.hasOwnProperty(w)) for (var V = 0; V < u[w].length; ++V) { - var E = u[w][V](w, q, this, W, J); - E && typeof E < "u" && (q = E); + var P = u[w][V](w, U, this, W, J); + P && typeof P < "u" && (U = P); } - return q; - }, this.listen = function(w, q) { - return z(w, q), this; + return U; + }, this.listen = function(w, U) { + return B(w, U), this; }, this.makeHtml = function(w) { if (!w) return w; - var q = { + var U = { gHtmlBlocks: [], gHtmlMdBlocks: [], gHtmlSpans: [], @@ -7795,7 +7802,7 @@ var xl = { exports: {} }; gListLevel: 0, hashLinkCounts: {}, langExtensions: o, - outputModifiers: l, + outputModifiers: c, converter: this, ghCodeBlocks: [], metadata: { @@ -7806,280 +7813,280 @@ var xl = { exports: {} }; }; return w = w.replace(/¨/g, "¨T"), w = w.replace(/\$/g, "¨D"), w = w.replace(/\r\n/g, ` `), w = w.replace(/\r/g, ` -`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = H(w)), w = ` +`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = G(w)), w = ` ` + w + ` -`, w = n.subParser("detab")(w, i, q), w = w.replace(/^[ \t]+$/mg, ""), n.helper.forEach(o, function(W) { - w = n.subParser("runExtension")(W, w, i, q); - }), w = n.subParser("metadata")(w, i, q), w = n.subParser("hashPreCodeTags")(w, i, q), w = n.subParser("githubCodeBlocks")(w, i, q), w = n.subParser("hashHTMLBlocks")(w, i, q), w = n.subParser("hashCodeTags")(w, i, q), w = n.subParser("stripLinkDefinitions")(w, i, q), w = n.subParser("blockGamut")(w, i, q), w = n.subParser("unhashHTMLSpans")(w, i, q), w = n.subParser("unescapeSpecialChars")(w, i, q), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = n.subParser("completeHTMLDocument")(w, i, q), n.helper.forEach(l, function(W) { - w = n.subParser("runExtension")(W, w, i, q); - }), f = q.metadata, w; - }, this.makeMarkdown = this.makeMd = function(w, q) { +`, w = a.subParser("detab")(w, i, U), w = w.replace(/^[ \t]+$/mg, ""), a.helper.forEach(o, function(W) { + w = a.subParser("runExtension")(W, w, i, U); + }), w = a.subParser("metadata")(w, i, U), w = a.subParser("hashPreCodeTags")(w, i, U), w = a.subParser("githubCodeBlocks")(w, i, U), w = a.subParser("hashHTMLBlocks")(w, i, U), w = a.subParser("hashCodeTags")(w, i, U), w = a.subParser("stripLinkDefinitions")(w, i, U), w = a.subParser("blockGamut")(w, i, U), w = a.subParser("unhashHTMLSpans")(w, i, U), w = a.subParser("unescapeSpecialChars")(w, i, U), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = a.subParser("completeHTMLDocument")(w, i, U), a.helper.forEach(c, function(W) { + w = a.subParser("runExtension")(W, w, i, U); + }), g = U.metadata, w; + }, this.makeMarkdown = this.makeMd = function(w, U) { if (w = w.replace(/\r\n/g, ` `), w = w.replace(/\r/g, ` -`), w = w.replace(/>[ \t]+¨NBSP;<"), !q) +`), w = w.replace(/>[ \t]+¨NBSP;<"), !U) if (window && window.document) - q = window.document; + U = window.document; else throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"); - var W = q.createElement("div"); + var W = U.createElement("div"); W.innerHTML = w; var J = { - preList: d(W) + preList: h(W) }; - O(W); - for (var V = W.childNodes, E = "", F = 0; F < V.length; F++) - E += n.subParser("makeMarkdown.node")(V[F], J); - function O(k) { - for (var R = 0; R < k.childNodes.length; ++R) { - var G = k.childNodes[R]; - G.nodeType === 3 ? !/\S/.test(G.nodeValue) && !/^[ ]+$/.test(G.nodeValue) ? (k.removeChild(G), --R) : (G.nodeValue = G.nodeValue.split(` -`).join(" "), G.nodeValue = G.nodeValue.replace(/(\s)+/g, "$1")) : G.nodeType === 1 && O(G); + L(W); + for (var V = W.childNodes, P = "", F = 0; F < V.length; F++) + P += a.subParser("makeMarkdown.node")(V[F], J); + function L($) { + for (var I = 0; I < $.childNodes.length; ++I) { + var H = $.childNodes[I]; + H.nodeType === 3 ? !/\S/.test(H.nodeValue) && !/^[ ]+$/.test(H.nodeValue) ? ($.removeChild(H), --I) : (H.nodeValue = H.nodeValue.split(` +`).join(" "), H.nodeValue = H.nodeValue.replace(/(\s)+/g, "$1")) : H.nodeType === 1 && L(H); } } - function d(k) { - for (var R = k.querySelectorAll("pre"), G = [], K = 0; K < R.length; ++K) - if (R[K].childElementCount === 1 && R[K].firstChild.tagName.toLowerCase() === "code") { - var X = R[K].firstChild.innerHTML.trim(), ee = R[K].firstChild.getAttribute("data-language") || ""; - if (ee === "") - for (var ie = R[K].firstChild.className.split(" "), xe = 0; xe < ie.length; ++xe) { - var qe = ie[xe].match(/^language-(.+)$/); - if (qe !== null) { - ee = qe[1]; + function h($) { + for (var I = $.querySelectorAll("pre"), H = [], K = 0; K < I.length; ++K) + if (I[K].childElementCount === 1 && I[K].firstChild.tagName.toLowerCase() === "code") { + var te = I[K].firstChild.innerHTML.trim(), ne = I[K].firstChild.getAttribute("data-language") || ""; + if (ne === "") + for (var be = I[K].firstChild.className.split(" "), Ae = 0; Ae < be.length; ++Ae) { + var ut = be[Ae].match(/^language-(.+)$/); + if (ut !== null) { + ne = ut[1]; break; } } - X = n.helper.unescapeHTMLEntities(X), G.push(X), R[K].outerHTML = ''; + te = a.helper.unescapeHTMLEntities(te), H.push(te), I[K].outerHTML = ''; } else - G.push(R[K].innerHTML), R[K].innerHTML = "", R[K].setAttribute("prenum", K.toString()); - return G; + H.push(I[K].innerHTML), I[K].innerHTML = "", I[K].setAttribute("prenum", K.toString()); + return H; } - return E; - }, this.setOption = function(w, q) { - i[w] = q; + return P; + }, this.setOption = function(w, U) { + i[w] = U; }, this.getOption = function(w) { return i[w]; }, this.getOptions = function() { return i; - }, this.addExtension = function(w, q) { - q = q || null, B(w, q); + }, this.addExtension = function(w, U) { + U = U || null, z(w, U); }, this.useExtension = function(w) { - B(w); + z(w); }, this.setFlavor = function(w) { if (!_.hasOwnProperty(w)) throw Error(w + " flavor was not found"); - var q = _[w]; - m = w; - for (var W in q) - q.hasOwnProperty(W) && (i[W] = q[W]); + var U = _[w]; + f = w; + for (var W in U) + U.hasOwnProperty(W) && (i[W] = U[W]); }, this.getFlavor = function() { - return m; + return f; }, this.removeExtension = function(w) { - n.helper.isArray(w) || (w = [w]); - for (var q = 0; q < w.length; ++q) { - for (var W = w[q], J = 0; J < o.length; ++J) + a.helper.isArray(w) || (w = [w]); + for (var U = 0; U < w.length; ++U) { + for (var W = w[U], J = 0; J < o.length; ++J) o[J] === W && o.splice(J, 1); - for (var V = 0; V < l.length; ++V) - l[V] === W && l.splice(V, 1); + for (var V = 0; V < c.length; ++V) + c[V] === W && c.splice(V, 1); } }, this.getAllExtensions = function() { return { language: o, - output: l + output: c }; }, this.getMetadata = function(w) { - return w ? f.raw : f.parsed; + return w ? g.raw : g.parsed; }, this.getMetadataFormat = function() { - return f.format; - }, this._setMetadataPair = function(w, q) { - f.parsed[w] = q; + return g.format; + }, this._setMetadataPair = function(w, U) { + g.parsed[w] = U; }, this._setMetadataFormat = function(w) { - f.format = w; + g.format = w; }, this._setMetadataRaw = function(w) { - f.raw = w; + g.raw = w; }; - }, n.subParser("anchors", function(r, i, o) { - r = o.converter._dispatch("anchors.before", r, i, o); - var l = function(u, m, f, x, B, U, z) { - if (n.helper.isUndefined(z) && (z = ""), f = f.toLowerCase(), u.search(/\(? ?(['"].*['"])?\)$/m) > -1) - x = ""; - else if (!x) - if (f || (f = m.toLowerCase().replace(/ ?\n/g, " ")), x = "#" + f, !n.helper.isUndefined(o.gUrls[f])) - x = o.gUrls[f], n.helper.isUndefined(o.gTitles[f]) || (z = o.gTitles[f]); + }, a.subParser("anchors", function(n, i, o) { + n = o.converter._dispatch("anchors.before", n, i, o); + var c = function(u, f, g, O, z, q, B) { + if (a.helper.isUndefined(B) && (B = ""), g = g.toLowerCase(), u.search(/\(? ?(['"].*['"])?\)$/m) > -1) + O = ""; + else if (!O) + if (g || (g = f.toLowerCase().replace(/ ?\n/g, " ")), O = "#" + g, !a.helper.isUndefined(o.gUrls[g])) + O = o.gUrls[g], a.helper.isUndefined(o.gTitles[g]) || (B = o.gTitles[g]); else return u; - x = x.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var H = '", H; + O = O.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var G = '", G; }; - return r = r.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, l), r = r.replace( + return n = n.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, c), n = n.replace( /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, - l - ), r = r.replace( + c + ), n = n.replace( /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, - l - ), r = r.replace(/\[([^\[\]]+)]()()()()()/g, l), i.ghMentions && (r = r.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(u, m, f, x, B) { - if (f === "\\") - return m + x; - if (!n.helper.isString(i.ghMentionsLink)) + c + ), n = n.replace(/\[([^\[\]]+)]()()()()()/g, c), i.ghMentions && (n = n.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(u, f, g, O, z) { + if (g === "\\") + return f + O; + if (!a.helper.isString(i.ghMentionsLink)) throw new Error("ghMentionsLink option must be a string"); - var U = i.ghMentionsLink.replace(/\{u}/g, B), z = ""; - return i.openLinksInNewWindow && (z = ' rel="noopener noreferrer" target="¨E95Eblank"'), m + '" + x + ""; - })), r = o.converter._dispatch("anchors.after", r, i, o), r; + var q = i.ghMentionsLink.replace(/\{u}/g, z), B = ""; + return i.openLinksInNewWindow && (B = ' rel="noopener noreferrer" target="¨E95Eblank"'), f + '" + O + ""; + })), n = o.converter._dispatch("anchors.after", n, i, o), n; }); - var L = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, A = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, N = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, C = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, T = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, v = function(r) { - return function(i, o, l, u, m, f, x) { - l = l.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var B = l, U = "", z = "", H = o || "", w = x || ""; - return /^www\./i.test(l) && (l = l.replace(/^www\./i, "http://www.")), r.excludeTrailingPunctuationFromURLs && f && (U = f), r.openLinksInNewWindow && (z = ' rel="noopener noreferrer" target="¨E95Eblank"'), H + '" + B + "" + U + w; + var N = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, A = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, j = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, C = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, x = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, v = function(n) { + return function(i, o, c, u, f, g, O) { + c = c.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var z = c, q = "", B = "", G = o || "", w = O || ""; + return /^www\./i.test(c) && (c = c.replace(/^www\./i, "http://www.")), n.excludeTrailingPunctuationFromURLs && g && (q = g), n.openLinksInNewWindow && (B = ' rel="noopener noreferrer" target="¨E95Eblank"'), G + '" + z + "" + q + w; }; - }, j = function(r, i) { - return function(o, l, u) { - var m = "mailto:"; - return l = l || "", u = n.subParser("unescapeSpecialChars")(u, r, i), r.encodeEmails ? (m = n.helper.encodeEmailAddress(m + u), u = n.helper.encodeEmailAddress(u)) : m = m + u, l + '' + u + ""; + }, T = function(n, i) { + return function(o, c, u) { + var f = "mailto:"; + return c = c || "", u = a.subParser("unescapeSpecialChars")(u, n, i), n.encodeEmails ? (f = a.helper.encodeEmailAddress(f + u), u = a.helper.encodeEmailAddress(u)) : f = f + u, c + '' + u + ""; }; }; - n.subParser("autoLinks", function(r, i, o) { - return r = o.converter._dispatch("autoLinks.before", r, i, o), r = r.replace(N, v(i)), r = r.replace(T, j(i, o)), r = o.converter._dispatch("autoLinks.after", r, i, o), r; - }), n.subParser("simplifiedAutoLinks", function(r, i, o) { - return i.simplifiedAutoLink && (r = o.converter._dispatch("simplifiedAutoLinks.before", r, i, o), i.excludeTrailingPunctuationFromURLs ? r = r.replace(A, v(i)) : r = r.replace(L, v(i)), r = r.replace(C, j(i, o)), r = o.converter._dispatch("simplifiedAutoLinks.after", r, i, o)), r; - }), n.subParser("blockGamut", function(r, i, o) { - return r = o.converter._dispatch("blockGamut.before", r, i, o), r = n.subParser("blockQuotes")(r, i, o), r = n.subParser("headers")(r, i, o), r = n.subParser("horizontalRule")(r, i, o), r = n.subParser("lists")(r, i, o), r = n.subParser("codeBlocks")(r, i, o), r = n.subParser("tables")(r, i, o), r = n.subParser("hashHTMLBlocks")(r, i, o), r = n.subParser("paragraphs")(r, i, o), r = o.converter._dispatch("blockGamut.after", r, i, o), r; - }), n.subParser("blockQuotes", function(r, i, o) { - r = o.converter._dispatch("blockQuotes.before", r, i, o), r = r + ` + a.subParser("autoLinks", function(n, i, o) { + return n = o.converter._dispatch("autoLinks.before", n, i, o), n = n.replace(j, v(i)), n = n.replace(x, T(i, o)), n = o.converter._dispatch("autoLinks.after", n, i, o), n; + }), a.subParser("simplifiedAutoLinks", function(n, i, o) { + return i.simplifiedAutoLink && (n = o.converter._dispatch("simplifiedAutoLinks.before", n, i, o), i.excludeTrailingPunctuationFromURLs ? n = n.replace(A, v(i)) : n = n.replace(N, v(i)), n = n.replace(C, T(i, o)), n = o.converter._dispatch("simplifiedAutoLinks.after", n, i, o)), n; + }), a.subParser("blockGamut", function(n, i, o) { + return n = o.converter._dispatch("blockGamut.before", n, i, o), n = a.subParser("blockQuotes")(n, i, o), n = a.subParser("headers")(n, i, o), n = a.subParser("horizontalRule")(n, i, o), n = a.subParser("lists")(n, i, o), n = a.subParser("codeBlocks")(n, i, o), n = a.subParser("tables")(n, i, o), n = a.subParser("hashHTMLBlocks")(n, i, o), n = a.subParser("paragraphs")(n, i, o), n = o.converter._dispatch("blockGamut.after", n, i, o), n; + }), a.subParser("blockQuotes", function(n, i, o) { + n = o.converter._dispatch("blockQuotes.before", n, i, o), n = n + ` `; - var l = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; - return i.splitAdjacentBlockquotes && (l = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), r = r.replace(l, function(u) { - return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = n.subParser("githubCodeBlocks")(u, i, o), u = n.subParser("blockGamut")(u, i, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(m, f) {
-          var x = f;
-          return x = x.replace(/^  /mg, "¨0"), x = x.replace(/¨0/g, ""), x;
-        }), n.subParser("hashBlock")(`
+ var c = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; + return i.splitAdjacentBlockquotes && (c = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), n = n.replace(c, function(u) { + return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = a.subParser("githubCodeBlocks")(u, i, o), u = a.subParser("blockGamut")(u, i, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(f, g) {
+          var O = g;
+          return O = O.replace(/^  /mg, "¨0"), O = O.replace(/¨0/g, ""), O;
+        }), a.subParser("hashBlock")(`
` + u + `
`, i, o); - }), r = o.converter._dispatch("blockQuotes.after", r, i, o), r; - }), n.subParser("codeBlocks", function(r, i, o) { - r = o.converter._dispatch("codeBlocks.before", r, i, o), r += "¨0"; - var l = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; - return r = r.replace(l, function(u, m, f) { - var x = m, B = f, U = ` + }), n = o.converter._dispatch("blockQuotes.after", n, i, o), n; + }), a.subParser("codeBlocks", function(n, i, o) { + n = o.converter._dispatch("codeBlocks.before", n, i, o), n += "¨0"; + var c = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; + return n = n.replace(c, function(u, f, g) { + var O = f, z = g, q = ` `; - return x = n.subParser("outdent")(x, i, o), x = n.subParser("encodeCode")(x, i, o), x = n.subParser("detab")(x, i, o), x = x.replace(/^\n+/g, ""), x = x.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (U = ""), x = "
" + x + U + "
", n.subParser("hashBlock")(x, i, o) + B; - }), r = r.replace(/¨0/, ""), r = o.converter._dispatch("codeBlocks.after", r, i, o), r; - }), n.subParser("codeSpans", function(r, i, o) { - return r = o.converter._dispatch("codeSpans.before", r, i, o), typeof r > "u" && (r = ""), r = r.replace( + return O = a.subParser("outdent")(O, i, o), O = a.subParser("encodeCode")(O, i, o), O = a.subParser("detab")(O, i, o), O = O.replace(/^\n+/g, ""), O = O.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (q = ""), O = "
" + O + q + "
", a.subParser("hashBlock")(O, i, o) + z; + }), n = n.replace(/¨0/, ""), n = o.converter._dispatch("codeBlocks.after", n, i, o), n; + }), a.subParser("codeSpans", function(n, i, o) { + return n = o.converter._dispatch("codeSpans.before", n, i, o), typeof n > "u" && (n = ""), n = n.replace( /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, - function(l, u, m, f) { - var x = f; - return x = x.replace(/^([ \t]*)/g, ""), x = x.replace(/[ \t]*$/g, ""), x = n.subParser("encodeCode")(x, i, o), x = u + "" + x + "", x = n.subParser("hashHTMLSpans")(x, i, o), x; + function(c, u, f, g) { + var O = g; + return O = O.replace(/^([ \t]*)/g, ""), O = O.replace(/[ \t]*$/g, ""), O = a.subParser("encodeCode")(O, i, o), O = u + "" + O + "", O = a.subParser("hashHTMLSpans")(O, i, o), O; } - ), r = o.converter._dispatch("codeSpans.after", r, i, o), r; - }), n.subParser("completeHTMLDocument", function(r, i, o) { + ), n = o.converter._dispatch("codeSpans.after", n, i, o), n; + }), a.subParser("completeHTMLDocument", function(n, i, o) { if (!i.completeHTMLDocument) - return r; - r = o.converter._dispatch("completeHTMLDocument.before", r, i, o); - var l = "html", u = ` -`, m = "", f = ` -`, x = "", B = ""; + return n; + n = o.converter._dispatch("completeHTMLDocument.before", n, i, o); + var c = "html", u = ` +`, f = "", g = ` +`, O = "", z = ""; typeof o.metadata.parsed.doctype < "u" && (u = " -`, l = o.metadata.parsed.doctype.toString().toLowerCase(), (l === "html" || l === "html5") && (f = '')); - for (var U in o.metadata.parsed) - if (o.metadata.parsed.hasOwnProperty(U)) - switch (U.toLowerCase()) { +`, c = o.metadata.parsed.doctype.toString().toLowerCase(), (c === "html" || c === "html5") && (g = '')); + for (var q in o.metadata.parsed) + if (o.metadata.parsed.hasOwnProperty(q)) + switch (q.toLowerCase()) { case "doctype": break; case "title": - m = "" + o.metadata.parsed.title + ` + f = "" + o.metadata.parsed.title + ` `; break; case "charset": - l === "html" || l === "html5" ? f = ' -` : f = ' + c === "html" || c === "html5" ? g = ' +` : g = ' `; break; case "language": case "lang": - x = ' lang="' + o.metadata.parsed[U] + '"', B += ' + O = ' lang="' + o.metadata.parsed[q] + '"', z += ' `; break; default: - B += ' + z += ' `; } - return r = u + " + return n = u + " -` + m + f + B + ` +` + f + g + z + ` -` + r.trim() + ` +` + n.trim() + ` -`, r = o.converter._dispatch("completeHTMLDocument.after", r, i, o), r; - }), n.subParser("detab", function(r, i, o) { - return r = o.converter._dispatch("detab.before", r, i, o), r = r.replace(/\t(?=\t)/g, " "), r = r.replace(/\t/g, "¨A¨B"), r = r.replace(/¨B(.+?)¨A/g, function(l, u) { - for (var m = u, f = 4 - m.length % 4, x = 0; x < f; x++) - m += " "; - return m; - }), r = r.replace(/¨A/g, " "), r = r.replace(/¨B/g, ""), r = o.converter._dispatch("detab.after", r, i, o), r; - }), n.subParser("ellipsis", function(r, i, o) { - return i.ellipsis && (r = o.converter._dispatch("ellipsis.before", r, i, o), r = r.replace(/\.\.\./g, "…"), r = o.converter._dispatch("ellipsis.after", r, i, o)), r; - }), n.subParser("emoji", function(r, i, o) { +`, n = o.converter._dispatch("completeHTMLDocument.after", n, i, o), n; + }), a.subParser("detab", function(n, i, o) { + return n = o.converter._dispatch("detab.before", n, i, o), n = n.replace(/\t(?=\t)/g, " "), n = n.replace(/\t/g, "¨A¨B"), n = n.replace(/¨B(.+?)¨A/g, function(c, u) { + for (var f = u, g = 4 - f.length % 4, O = 0; O < g; O++) + f += " "; + return f; + }), n = n.replace(/¨A/g, " "), n = n.replace(/¨B/g, ""), n = o.converter._dispatch("detab.after", n, i, o), n; + }), a.subParser("ellipsis", function(n, i, o) { + return i.ellipsis && (n = o.converter._dispatch("ellipsis.before", n, i, o), n = n.replace(/\.\.\./g, "…"), n = o.converter._dispatch("ellipsis.after", n, i, o)), n; + }), a.subParser("emoji", function(n, i, o) { if (!i.emoji) - return r; - r = o.converter._dispatch("emoji.before", r, i, o); - var l = /:([\S]+?):/g; - return r = r.replace(l, function(u, m) { - return n.helper.emojis.hasOwnProperty(m) ? n.helper.emojis[m] : u; - }), r = o.converter._dispatch("emoji.after", r, i, o), r; - }), n.subParser("encodeAmpsAndAngles", function(r, i, o) { - return r = o.converter._dispatch("encodeAmpsAndAngles.before", r, i, o), r = r.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), r = r.replace(/<(?![a-z\/?$!])/gi, "<"), r = r.replace(//g, ">"), r = o.converter._dispatch("encodeAmpsAndAngles.after", r, i, o), r; - }), n.subParser("encodeBackslashEscapes", function(r, i, o) { - return r = o.converter._dispatch("encodeBackslashEscapes.before", r, i, o), r = r.replace(/\\(\\)/g, n.helper.escapeCharactersCallback), r = r.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeBackslashEscapes.after", r, i, o), r; - }), n.subParser("encodeCode", function(r, i, o) { - return r = o.converter._dispatch("encodeCode.before", r, i, o), r = r.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeCode.after", r, i, o), r; - }), n.subParser("escapeSpecialCharsWithinTagAttributes", function(r, i, o) { - r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", r, i, o); - var l = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, u = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; - return r = r.replace(l, function(m) { - return m.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, n.helper.escapeCharactersCallback); - }), r = r.replace(u, function(m) { - return m.replace(/([\\`*_~=|])/g, n.helper.escapeCharactersCallback); - }), r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", r, i, o), r; - }), n.subParser("githubCodeBlocks", function(r, i, o) { - return i.ghCodeBlocks ? (r = o.converter._dispatch("githubCodeBlocks.before", r, i, o), r += "¨0", r = r.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(l, u, m, f) { - var x = i.omitExtraWLInCodeBlocks ? "" : ` + return n; + n = o.converter._dispatch("emoji.before", n, i, o); + var c = /:([\S]+?):/g; + return n = n.replace(c, function(u, f) { + return a.helper.emojis.hasOwnProperty(f) ? a.helper.emojis[f] : u; + }), n = o.converter._dispatch("emoji.after", n, i, o), n; + }), a.subParser("encodeAmpsAndAngles", function(n, i, o) { + return n = o.converter._dispatch("encodeAmpsAndAngles.before", n, i, o), n = n.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), n = n.replace(/<(?![a-z\/?$!])/gi, "<"), n = n.replace(//g, ">"), n = o.converter._dispatch("encodeAmpsAndAngles.after", n, i, o), n; + }), a.subParser("encodeBackslashEscapes", function(n, i, o) { + return n = o.converter._dispatch("encodeBackslashEscapes.before", n, i, o), n = n.replace(/\\(\\)/g, a.helper.escapeCharactersCallback), n = n.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("encodeBackslashEscapes.after", n, i, o), n; + }), a.subParser("encodeCode", function(n, i, o) { + return n = o.converter._dispatch("encodeCode.before", n, i, o), n = n.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("encodeCode.after", n, i, o), n; + }), a.subParser("escapeSpecialCharsWithinTagAttributes", function(n, i, o) { + n = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", n, i, o); + var c = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, u = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; + return n = n.replace(c, function(f) { + return f.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), n = n.replace(u, function(f) { + return f.replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), n = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", n, i, o), n; + }), a.subParser("githubCodeBlocks", function(n, i, o) { + return i.ghCodeBlocks ? (n = o.converter._dispatch("githubCodeBlocks.before", n, i, o), n += "¨0", n = n.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(c, u, f, g) { + var O = i.omitExtraWLInCodeBlocks ? "" : ` `; - return f = n.subParser("encodeCode")(f, i, o), f = n.subParser("detab")(f, i, o), f = f.replace(/^\n+/g, ""), f = f.replace(/\n+$/g, ""), f = "
" + f + x + "
", f = n.subParser("hashBlock")(f, i, o), ` + return g = a.subParser("encodeCode")(g, i, o), g = a.subParser("detab")(g, i, o), g = g.replace(/^\n+/g, ""), g = g.replace(/\n+$/g, ""), g = "
" + g + O + "
", g = a.subParser("hashBlock")(g, i, o), ` -¨G` + (o.ghCodeBlocks.push({ text: l, codeblock: f }) - 1) + `G +¨G` + (o.ghCodeBlocks.push({ text: c, codeblock: g }) - 1) + `G `; - }), r = r.replace(/¨0/, ""), o.converter._dispatch("githubCodeBlocks.after", r, i, o)) : r; - }), n.subParser("hashBlock", function(r, i, o) { - return r = o.converter._dispatch("hashBlock.before", r, i, o), r = r.replace(/(^\n+|\n+$)/g, ""), r = ` + }), n = n.replace(/¨0/, ""), o.converter._dispatch("githubCodeBlocks.after", n, i, o)) : n; + }), a.subParser("hashBlock", function(n, i, o) { + return n = o.converter._dispatch("hashBlock.before", n, i, o), n = n.replace(/(^\n+|\n+$)/g, ""), n = ` -¨K` + (o.gHtmlBlocks.push(r) - 1) + `K +¨K` + (o.gHtmlBlocks.push(n) - 1) + `K -`, r = o.converter._dispatch("hashBlock.after", r, i, o), r; - }), n.subParser("hashCodeTags", function(r, i, o) { - r = o.converter._dispatch("hashCodeTags.before", r, i, o); - var l = function(u, m, f, x) { - var B = f + n.subParser("encodeCode")(m, i, o) + x; - return "¨C" + (o.gHtmlSpans.push(B) - 1) + "C"; +`, n = o.converter._dispatch("hashBlock.after", n, i, o), n; + }), a.subParser("hashCodeTags", function(n, i, o) { + n = o.converter._dispatch("hashCodeTags.before", n, i, o); + var c = function(u, f, g, O) { + var z = g + a.subParser("encodeCode")(f, i, o) + O; + return "¨C" + (o.gHtmlSpans.push(z) - 1) + "C"; }; - return r = n.helper.replaceRecursiveRegExp(r, l, "]*>", "", "gim"), r = o.converter._dispatch("hashCodeTags.after", r, i, o), r; - }), n.subParser("hashElement", function(r, i, o) { - return function(l, u) { - var m = u; - return m = m.replace(/\n\n/g, ` -`), m = m.replace(/^\n/, ""), m = m.replace(/\n+$/g, ""), m = ` + return n = a.helper.replaceRecursiveRegExp(n, c, "]*>", "", "gim"), n = o.converter._dispatch("hashCodeTags.after", n, i, o), n; + }), a.subParser("hashElement", function(n, i, o) { + return function(c, u) { + var f = u; + return f = f.replace(/\n\n/g, ` +`), f = f.replace(/^\n/, ""), f = f.replace(/\n+$/g, ""), f = ` -¨K` + (o.gHtmlBlocks.push(m) - 1) + `K +¨K` + (o.gHtmlBlocks.push(f) - 1) + `K -`, m; +`, f; }; - }), n.subParser("hashHTMLBlocks", function(r, i, o) { - r = o.converter._dispatch("hashHTMLBlocks.before", r, i, o); - var l = [ + }), a.subParser("hashHTMLBlocks", function(n, i, o) { + n = o.converter._dispatch("hashHTMLBlocks.before", n, i, o); + var c = [ "pre", "div", "h1", @@ -8114,312 +8121,312 @@ var xl = { exports: {} }; "output", "video", "p" - ], u = function(w, q, W, J) { + ], u = function(w, U, W, J) { var V = w; - return W.search(/\bmarkdown\b/) !== -1 && (V = W + o.converter.makeHtml(q) + J), ` + return W.search(/\bmarkdown\b/) !== -1 && (V = W + o.converter.makeHtml(U) + J), ` ¨K` + (o.gHtmlBlocks.push(V) - 1) + `K `; }; - i.backslashEscapesHTMLTags && (r = r.replace(/\\<(\/?[^>]+?)>/g, function(w, q) { - return "<" + q + ">"; + i.backslashEscapesHTMLTags && (n = n.replace(/\\<(\/?[^>]+?)>/g, function(w, U) { + return "<" + U + ">"; })); - for (var m = 0; m < l.length; ++m) - for (var f, x = new RegExp("^ {0,3}(<" + l[m] + "\\b[^>]*>)", "im"), B = "<" + l[m] + "\\b[^>]*>", U = ""; (f = n.helper.regexIndexOf(r, x)) !== -1; ) { - var z = n.helper.splitAtIndex(r, f), H = n.helper.replaceRecursiveRegExp(z[1], u, B, U, "im"); - if (H === z[1]) + for (var f = 0; f < c.length; ++f) + for (var g, O = new RegExp("^ {0,3}(<" + c[f] + "\\b[^>]*>)", "im"), z = "<" + c[f] + "\\b[^>]*>", q = ""; (g = a.helper.regexIndexOf(n, O)) !== -1; ) { + var B = a.helper.splitAtIndex(n, g), G = a.helper.replaceRecursiveRegExp(B[1], u, z, q, "im"); + if (G === B[1]) break; - r = z[0].concat(H); + n = B[0].concat(G); } - return r = r.replace( + return n = n.replace( /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, - n.subParser("hashElement")(r, i, o) - ), r = n.helper.replaceRecursiveRegExp(r, function(w) { + a.subParser("hashElement")(n, i, o) + ), n = a.helper.replaceRecursiveRegExp(n, function(w) { return ` ¨K` + (o.gHtmlBlocks.push(w) - 1) + `K `; - }, "^ {0,3}", "gm"), r = r.replace( + }, "^ {0,3}", "gm"), n = n.replace( /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, - n.subParser("hashElement")(r, i, o) - ), r = o.converter._dispatch("hashHTMLBlocks.after", r, i, o), r; - }), n.subParser("hashHTMLSpans", function(r, i, o) { - r = o.converter._dispatch("hashHTMLSpans.before", r, i, o); - function l(u) { + a.subParser("hashElement")(n, i, o) + ), n = o.converter._dispatch("hashHTMLBlocks.after", n, i, o), n; + }), a.subParser("hashHTMLSpans", function(n, i, o) { + n = o.converter._dispatch("hashHTMLSpans.before", n, i, o); + function c(u) { return "¨C" + (o.gHtmlSpans.push(u) - 1) + "C"; } - return r = r.replace(/<[^>]+?\/>/gi, function(u) { - return l(u); - }), r = r.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(u) { - return l(u); - }), r = r.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(u) { - return l(u); - }), r = r.replace(/<[^>]+?>/gi, function(u) { - return l(u); - }), r = o.converter._dispatch("hashHTMLSpans.after", r, i, o), r; - }), n.subParser("unhashHTMLSpans", function(r, i, o) { - r = o.converter._dispatch("unhashHTMLSpans.before", r, i, o); - for (var l = 0; l < o.gHtmlSpans.length; ++l) { - for (var u = o.gHtmlSpans[l], m = 0; /¨C(\d+)C/.test(u); ) { - var f = RegExp.$1; - if (u = u.replace("¨C" + f + "C", o.gHtmlSpans[f]), m === 10) { + return n = n.replace(/<[^>]+?\/>/gi, function(u) { + return c(u); + }), n = n.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), n = n.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), n = n.replace(/<[^>]+?>/gi, function(u) { + return c(u); + }), n = o.converter._dispatch("hashHTMLSpans.after", n, i, o), n; + }), a.subParser("unhashHTMLSpans", function(n, i, o) { + n = o.converter._dispatch("unhashHTMLSpans.before", n, i, o); + for (var c = 0; c < o.gHtmlSpans.length; ++c) { + for (var u = o.gHtmlSpans[c], f = 0; /¨C(\d+)C/.test(u); ) { + var g = RegExp.$1; + if (u = u.replace("¨C" + g + "C", o.gHtmlSpans[g]), f === 10) { console.error("maximum nesting of 10 spans reached!!!"); break; } - ++m; + ++f; } - r = r.replace("¨C" + l + "C", u); + n = n.replace("¨C" + c + "C", u); } - return r = o.converter._dispatch("unhashHTMLSpans.after", r, i, o), r; - }), n.subParser("hashPreCodeTags", function(r, i, o) { - r = o.converter._dispatch("hashPreCodeTags.before", r, i, o); - var l = function(u, m, f, x) { - var B = f + n.subParser("encodeCode")(m, i, o) + x; + return n = o.converter._dispatch("unhashHTMLSpans.after", n, i, o), n; + }), a.subParser("hashPreCodeTags", function(n, i, o) { + n = o.converter._dispatch("hashPreCodeTags.before", n, i, o); + var c = function(u, f, g, O) { + var z = g + a.subParser("encodeCode")(f, i, o) + O; return ` -¨G` + (o.ghCodeBlocks.push({ text: u, codeblock: B }) - 1) + `G +¨G` + (o.ghCodeBlocks.push({ text: u, codeblock: z }) - 1) + `G `; }; - return r = n.helper.replaceRecursiveRegExp(r, l, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), r = o.converter._dispatch("hashPreCodeTags.after", r, i, o), r; - }), n.subParser("headers", function(r, i, o) { - r = o.converter._dispatch("headers.before", r, i, o); - var l = isNaN(parseInt(i.headerLevelStart)) ? 1 : parseInt(i.headerLevelStart), u = i.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, m = i.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; - r = r.replace(u, function(B, U) { - var z = n.subParser("spanGamut")(U, i, o), H = i.noHeaderId ? "" : ' id="' + x(U) + '"', w = l, q = "" + z + ""; - return n.subParser("hashBlock")(q, i, o); - }), r = r.replace(m, function(B, U) { - var z = n.subParser("spanGamut")(U, i, o), H = i.noHeaderId ? "" : ' id="' + x(U) + '"', w = l + 1, q = "" + z + ""; - return n.subParser("hashBlock")(q, i, o); + return n = a.helper.replaceRecursiveRegExp(n, c, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), n = o.converter._dispatch("hashPreCodeTags.after", n, i, o), n; + }), a.subParser("headers", function(n, i, o) { + n = o.converter._dispatch("headers.before", n, i, o); + var c = isNaN(parseInt(i.headerLevelStart)) ? 1 : parseInt(i.headerLevelStart), u = i.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, f = i.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; + n = n.replace(u, function(z, q) { + var B = a.subParser("spanGamut")(q, i, o), G = i.noHeaderId ? "" : ' id="' + O(q) + '"', w = c, U = "" + B + ""; + return a.subParser("hashBlock")(U, i, o); + }), n = n.replace(f, function(z, q) { + var B = a.subParser("spanGamut")(q, i, o), G = i.noHeaderId ? "" : ' id="' + O(q) + '"', w = c + 1, U = "" + B + ""; + return a.subParser("hashBlock")(U, i, o); }); - var f = i.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; - r = r.replace(f, function(B, U, z) { - var H = z; - i.customizedHeaderId && (H = z.replace(/\s?\{([^{]+?)}\s*$/, "")); - var w = n.subParser("spanGamut")(H, i, o), q = i.noHeaderId ? "" : ' id="' + x(z) + '"', W = l - 1 + U.length, J = "" + w + ""; - return n.subParser("hashBlock")(J, i, o); + var g = i.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; + n = n.replace(g, function(z, q, B) { + var G = B; + i.customizedHeaderId && (G = B.replace(/\s?\{([^{]+?)}\s*$/, "")); + var w = a.subParser("spanGamut")(G, i, o), U = i.noHeaderId ? "" : ' id="' + O(B) + '"', W = c - 1 + q.length, J = "" + w + ""; + return a.subParser("hashBlock")(J, i, o); }); - function x(B) { - var U, z; + function O(z) { + var q, B; if (i.customizedHeaderId) { - var H = B.match(/\{([^{]+?)}\s*$/); - H && H[1] && (B = H[1]); + var G = z.match(/\{([^{]+?)}\s*$/); + G && G[1] && (z = G[1]); } - return U = B, n.helper.isString(i.prefixHeaderId) ? z = i.prefixHeaderId : i.prefixHeaderId === !0 ? z = "section-" : z = "", i.rawPrefixHeaderId || (U = z + U), i.ghCompatibleHeaderId ? U = U.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : i.rawHeaderId ? U = U.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : U = U.replace(/[^\w]/g, "").toLowerCase(), i.rawPrefixHeaderId && (U = z + U), o.hashLinkCounts[U] ? U = U + "-" + o.hashLinkCounts[U]++ : o.hashLinkCounts[U] = 1, U; - } - return r = o.converter._dispatch("headers.after", r, i, o), r; - }), n.subParser("horizontalRule", function(r, i, o) { - r = o.converter._dispatch("horizontalRule.before", r, i, o); - var l = n.subParser("hashBlock")("
", i, o); - return r = r.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, l), r = r.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, l), r = r.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, l), r = o.converter._dispatch("horizontalRule.after", r, i, o), r; - }), n.subParser("images", function(r, i, o) { - r = o.converter._dispatch("images.before", r, i, o); - var l = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, u = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, m = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, f = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, x = /!\[([^\[\]]+)]()()()()()/g; - function B(z, H, w, q, W, J, V, E) { - return q = q.replace(/\s/g, ""), U(z, H, w, q, W, J, V, E); - } - function U(z, H, w, q, W, J, V, E) { - var F = o.gUrls, O = o.gTitles, d = o.gDimensions; - if (w = w.toLowerCase(), E || (E = ""), z.search(/\(? ?(['"].*['"])?\)$/m) > -1) - q = ""; - else if (q === "" || q === null) - if ((w === "" || w === null) && (w = H.toLowerCase().replace(/ ?\n/g, " ")), q = "#" + w, !n.helper.isUndefined(F[w])) - q = F[w], n.helper.isUndefined(O[w]) || (E = O[w]), n.helper.isUndefined(d[w]) || (W = d[w].width, J = d[w].height); + return q = z, a.helper.isString(i.prefixHeaderId) ? B = i.prefixHeaderId : i.prefixHeaderId === !0 ? B = "section-" : B = "", i.rawPrefixHeaderId || (q = B + q), i.ghCompatibleHeaderId ? q = q.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : i.rawHeaderId ? q = q.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : q = q.replace(/[^\w]/g, "").toLowerCase(), i.rawPrefixHeaderId && (q = B + q), o.hashLinkCounts[q] ? q = q + "-" + o.hashLinkCounts[q]++ : o.hashLinkCounts[q] = 1, q; + } + return n = o.converter._dispatch("headers.after", n, i, o), n; + }), a.subParser("horizontalRule", function(n, i, o) { + n = o.converter._dispatch("horizontalRule.before", n, i, o); + var c = a.subParser("hashBlock")("
", i, o); + return n = n.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, c), n = n.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, c), n = n.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, c), n = o.converter._dispatch("horizontalRule.after", n, i, o), n; + }), a.subParser("images", function(n, i, o) { + n = o.converter._dispatch("images.before", n, i, o); + var c = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, u = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, f = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, g = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, O = /!\[([^\[\]]+)]()()()()()/g; + function z(B, G, w, U, W, J, V, P) { + return U = U.replace(/\s/g, ""), q(B, G, w, U, W, J, V, P); + } + function q(B, G, w, U, W, J, V, P) { + var F = o.gUrls, L = o.gTitles, h = o.gDimensions; + if (w = w.toLowerCase(), P || (P = ""), B.search(/\(? ?(['"].*['"])?\)$/m) > -1) + U = ""; + else if (U === "" || U === null) + if ((w === "" || w === null) && (w = G.toLowerCase().replace(/ ?\n/g, " ")), U = "#" + w, !a.helper.isUndefined(F[w])) + U = F[w], a.helper.isUndefined(L[w]) || (P = L[w]), a.helper.isUndefined(h[w]) || (W = h[w].width, J = h[w].height); else - return z; - H = H.replace(/"/g, """).replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback), q = q.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var k = '' + H + '", ""); - }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(u, m) { - return l(m, "", ""); - }), r = r.replace(/\b_(\S[\s\S]*?)_\b/g, function(u, m) { - return l(m, "", ""); - })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/__(\S[\s\S]*?)__/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/_([^\s_][\s\S]*?)_/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - })), i.literalMidWordAsterisks ? (r = r.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - }), r = r.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - }), r = r.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - })) : (r = r.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/\*([^\s*][\s\S]*?)\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - })), r = o.converter._dispatch("italicsAndBold.after", r, i, o), r; - }), n.subParser("lists", function(r, i, o) { - function l(f, x) { - o.gListLevel++, f = f.replace(/\n{2,}$/, ` -`), f += "¨0"; - var B = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, U = /\n[ \t]*\n(?!¨0)/.test(f); - return i.disableForced4SpacesIndentedSublists && (B = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), f = f.replace(B, function(z, H, w, q, W, J, V) { + return B; + G = G.replace(/"/g, """).replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback), U = U.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var $ = '' + G + '", ""); + }), n = n.replace(/\b__(\S[\s\S]*?)__\b/g, function(u, f) { + return c(f, "", ""); + }), n = n.replace(/\b_(\S[\s\S]*?)_\b/g, function(u, f) { + return c(f, "", ""); + })) : (n = n.replace(/___(\S[\s\S]*?)___/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + }), n = n.replace(/__(\S[\s\S]*?)__/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + }), n = n.replace(/_([^\s_][\s\S]*?)_/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + })), i.literalMidWordAsterisks ? (n = n.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(u, f, g) { + return c(g, f + "", ""); + }), n = n.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(u, f, g) { + return c(g, f + "", ""); + }), n = n.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(u, f, g) { + return c(g, f + "", ""); + })) : (n = n.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + }), n = n.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + }), n = n.replace(/\*([^\s*][\s\S]*?)\*/g, function(u, f) { + return /\S$/.test(f) ? c(f, "", "") : u; + })), n = o.converter._dispatch("italicsAndBold.after", n, i, o), n; + }), a.subParser("lists", function(n, i, o) { + function c(g, O) { + o.gListLevel++, g = g.replace(/\n{2,}$/, ` +`), g += "¨0"; + var z = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, q = /\n[ \t]*\n(?!¨0)/.test(g); + return i.disableForced4SpacesIndentedSublists && (z = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), g = g.replace(z, function(B, G, w, U, W, J, V) { V = V && V.trim() !== ""; - var E = n.subParser("outdent")(W, i, o), F = ""; - return J && i.tasklists && (F = ' class="task-list-item" style="list-style-type: none;"', E = E.replace(/^[ \t]*\[(x|X| )?]/m, function() { - var O = ' -1 ? (E = n.subParser("githubCodeBlocks")(E, i, o), E = n.subParser("blockGamut")(E, i, o)) : (E = n.subParser("lists")(E, i, o), E = E.replace(/\n$/, ""), E = n.subParser("hashHTMLBlocks")(E, i, o), E = E.replace(/\n\n+/g, ` + var P = a.subParser("outdent")(W, i, o), F = ""; + return J && i.tasklists && (F = ' class="task-list-item" style="list-style-type: none;"', P = P.replace(/^[ \t]*\[(x|X| )?]/m, function() { + var L = ' -1 ? (P = a.subParser("githubCodeBlocks")(P, i, o), P = a.subParser("blockGamut")(P, i, o)) : (P = a.subParser("lists")(P, i, o), P = P.replace(/\n$/, ""), P = a.subParser("hashHTMLBlocks")(P, i, o), P = P.replace(/\n\n+/g, ` -`), U ? E = n.subParser("paragraphs")(E, i, o) : E = n.subParser("spanGamut")(E, i, o)), E = E.replace("¨A", ""), E = "" + E + ` -`, E; - }), f = f.replace(/¨0/g, ""), o.gListLevel--, x && (f = f.replace(/\s+$/, "")), f; - } - function u(f, x) { - if (x === "ol") { - var B = f.match(/^ *(\d+)\./); - if (B && B[1] !== "1") - return ' start="' + B[1] + '"'; +`), q ? P = a.subParser("paragraphs")(P, i, o) : P = a.subParser("spanGamut")(P, i, o)), P = P.replace("¨A", ""), P = "" + P + ` +`, P; + }), g = g.replace(/¨0/g, ""), o.gListLevel--, O && (g = g.replace(/\s+$/, "")), g; + } + function u(g, O) { + if (O === "ol") { + var z = g.match(/^ *(\d+)\./); + if (z && z[1] !== "1") + return ' start="' + z[1] + '"'; } return ""; } - function m(f, x, B) { - var U = i.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, z = i.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, H = x === "ul" ? U : z, w = ""; - if (f.search(H) !== -1) + function f(g, O, z) { + var q = i.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, B = i.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, G = O === "ul" ? q : B, w = ""; + if (g.search(G) !== -1) (function W(J) { - var V = J.search(H), E = u(f, x); + var V = J.search(G), P = u(g, O); V !== -1 ? (w += ` -<` + x + E + `> -` + l(J.slice(0, V), !!B) + " -`, x = x === "ul" ? "ol" : "ul", H = x === "ul" ? U : z, W(J.slice(V))) : w += ` +<` + O + P + `> +` + c(J.slice(0, V), !!z) + " +`, O = O === "ul" ? "ol" : "ul", G = O === "ul" ? q : B, W(J.slice(V))) : w += ` -<` + x + E + `> -` + l(J, !!B) + " +<` + O + P + `> +` + c(J, !!z) + " `; - })(f); + })(g); else { - var q = u(f, x); + var U = u(g, O); w = ` -<` + x + q + `> -` + l(f, !!B) + " +<` + O + U + `> +` + c(g, !!z) + " `; } return w; } - return r = o.converter._dispatch("lists.before", r, i, o), r += "¨0", o.gListLevel ? r = r.replace( + return n = o.converter._dispatch("lists.before", n, i, o), n += "¨0", o.gListLevel ? n = n.replace( /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, - function(f, x, B) { - var U = B.search(/[*+-]/g) > -1 ? "ul" : "ol"; - return m(x, U, !0); + function(g, O, z) { + var q = z.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return f(O, q, !0); } - ) : r = r.replace( + ) : n = n.replace( /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, - function(f, x, B, U) { - var z = U.search(/[*+-]/g) > -1 ? "ul" : "ol"; - return m(B, z, !1); + function(g, O, z, q) { + var B = q.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return f(z, B, !1); } - ), r = r.replace(/¨0/, ""), r = o.converter._dispatch("lists.after", r, i, o), r; - }), n.subParser("metadata", function(r, i, o) { + ), n = n.replace(/¨0/, ""), n = o.converter._dispatch("lists.after", n, i, o), n; + }), a.subParser("metadata", function(n, i, o) { if (!i.metadata) - return r; - r = o.converter._dispatch("metadata.before", r, i, o); - function l(u) { - o.metadata.raw = u, u = u.replace(/&/g, "&").replace(/"/g, """), u = u.replace(/\n {4}/g, " "), u.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(m, f, x) { - return o.metadata.parsed[f] = x, ""; + return n; + n = o.converter._dispatch("metadata.before", n, i, o); + function c(u) { + o.metadata.raw = u, u = u.replace(/&/g, "&").replace(/"/g, """), u = u.replace(/\n {4}/g, " "), u.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(f, g, O) { + return o.metadata.parsed[g] = O, ""; }); } - return r = r.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(u, m, f) { - return l(f), "¨M"; - }), r = r.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(u, m, f) { - return m && (o.metadata.format = m), l(f), "¨M"; - }), r = r.replace(/¨M/g, ""), r = o.converter._dispatch("metadata.after", r, i, o), r; - }), n.subParser("outdent", function(r, i, o) { - return r = o.converter._dispatch("outdent.before", r, i, o), r = r.replace(/^(\t|[ ]{1,4})/gm, "¨0"), r = r.replace(/¨0/g, ""), r = o.converter._dispatch("outdent.after", r, i, o), r; - }), n.subParser("paragraphs", function(r, i, o) { - r = o.converter._dispatch("paragraphs.before", r, i, o), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""); - for (var l = r.split(/\n{2,}/g), u = [], m = l.length, f = 0; f < m; f++) { - var x = l[f]; - x.search(/¨(K|G)(\d+)\1/g) >= 0 ? u.push(x) : x.search(/\S/) >= 0 && (x = n.subParser("spanGamut")(x, i, o), x = x.replace(/^([ \t]*)/g, "

"), x += "

", u.push(x)); - } - for (m = u.length, f = 0; f < m; f++) { - for (var B = "", U = u[f], z = !1; /¨(K|G)(\d+)\1/.test(U); ) { - var H = RegExp.$1, w = RegExp.$2; - H === "K" ? B = o.gHtmlBlocks[w] : z ? B = n.subParser("encodeCode")(o.ghCodeBlocks[w].text, i, o) : B = o.ghCodeBlocks[w].codeblock, B = B.replace(/\$/g, "$$$$"), U = U.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, B), /^]*>\s*]*>/.test(U) && (z = !0); + return n = n.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(u, f, g) { + return c(g), "¨M"; + }), n = n.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(u, f, g) { + return f && (o.metadata.format = f), c(g), "¨M"; + }), n = n.replace(/¨M/g, ""), n = o.converter._dispatch("metadata.after", n, i, o), n; + }), a.subParser("outdent", function(n, i, o) { + return n = o.converter._dispatch("outdent.before", n, i, o), n = n.replace(/^(\t|[ ]{1,4})/gm, "¨0"), n = n.replace(/¨0/g, ""), n = o.converter._dispatch("outdent.after", n, i, o), n; + }), a.subParser("paragraphs", function(n, i, o) { + n = o.converter._dispatch("paragraphs.before", n, i, o), n = n.replace(/^\n+/g, ""), n = n.replace(/\n+$/g, ""); + for (var c = n.split(/\n{2,}/g), u = [], f = c.length, g = 0; g < f; g++) { + var O = c[g]; + O.search(/¨(K|G)(\d+)\1/g) >= 0 ? u.push(O) : O.search(/\S/) >= 0 && (O = a.subParser("spanGamut")(O, i, o), O = O.replace(/^([ \t]*)/g, "

"), O += "

", u.push(O)); + } + for (f = u.length, g = 0; g < f; g++) { + for (var z = "", q = u[g], B = !1; /¨(K|G)(\d+)\1/.test(q); ) { + var G = RegExp.$1, w = RegExp.$2; + G === "K" ? z = o.gHtmlBlocks[w] : B ? z = a.subParser("encodeCode")(o.ghCodeBlocks[w].text, i, o) : z = o.ghCodeBlocks[w].codeblock, z = z.replace(/\$/g, "$$$$"), q = q.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, z), /^]*>\s*]*>/.test(q) && (B = !0); } - u[f] = U; + u[g] = q; } - return r = u.join(` -`), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""), o.converter._dispatch("paragraphs.after", r, i, o); - }), n.subParser("runExtension", function(r, i, o, l) { - if (r.filter) - i = r.filter(i, l.converter, o); - else if (r.regex) { - var u = r.regex; - u instanceof RegExp || (u = new RegExp(u, "g")), i = i.replace(u, r.replace); + return n = u.join(` +`), n = n.replace(/^\n+/g, ""), n = n.replace(/\n+$/g, ""), o.converter._dispatch("paragraphs.after", n, i, o); + }), a.subParser("runExtension", function(n, i, o, c) { + if (n.filter) + i = n.filter(i, c.converter, o); + else if (n.regex) { + var u = n.regex; + u instanceof RegExp || (u = new RegExp(u, "g")), i = i.replace(u, n.replace); } return i; - }), n.subParser("spanGamut", function(r, i, o) { - return r = o.converter._dispatch("spanGamut.before", r, i, o), r = n.subParser("codeSpans")(r, i, o), r = n.subParser("escapeSpecialCharsWithinTagAttributes")(r, i, o), r = n.subParser("encodeBackslashEscapes")(r, i, o), r = n.subParser("images")(r, i, o), r = n.subParser("anchors")(r, i, o), r = n.subParser("autoLinks")(r, i, o), r = n.subParser("simplifiedAutoLinks")(r, i, o), r = n.subParser("emoji")(r, i, o), r = n.subParser("underline")(r, i, o), r = n.subParser("italicsAndBold")(r, i, o), r = n.subParser("strikethrough")(r, i, o), r = n.subParser("ellipsis")(r, i, o), r = n.subParser("hashHTMLSpans")(r, i, o), r = n.subParser("encodeAmpsAndAngles")(r, i, o), i.simpleLineBreaks ? /\n\n¨K/.test(r) || (r = r.replace(/\n+/g, `
-`)) : r = r.replace(/ +\n/g, `
-`), r = o.converter._dispatch("spanGamut.after", r, i, o), r; - }), n.subParser("strikethrough", function(r, i, o) { - function l(u) { - return i.simplifiedAutoLink && (u = n.subParser("simplifiedAutoLinks")(u, i, o)), "" + u + ""; - } - return i.strikethrough && (r = o.converter._dispatch("strikethrough.before", r, i, o), r = r.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(u, m) { - return l(m); - }), r = o.converter._dispatch("strikethrough.after", r, i, o)), r; - }), n.subParser("stripLinkDefinitions", function(r, i, o) { - var l = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, u = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; - r += "¨0"; - var m = function(f, x, B, U, z, H, w) { - return x = x.toLowerCase(), r.toLowerCase().split(x).length - 1 < 2 ? f : (B.match(/^data:.+?\/.+?;base64,/) ? o.gUrls[x] = B.replace(/\s/g, "") : o.gUrls[x] = n.subParser("encodeAmpsAndAngles")(B, i, o), H ? H + w : (w && (o.gTitles[x] = w.replace(/"|'/g, """)), i.parseImgDimensions && U && z && (o.gDimensions[x] = { - width: U, - height: z + }), a.subParser("spanGamut", function(n, i, o) { + return n = o.converter._dispatch("spanGamut.before", n, i, o), n = a.subParser("codeSpans")(n, i, o), n = a.subParser("escapeSpecialCharsWithinTagAttributes")(n, i, o), n = a.subParser("encodeBackslashEscapes")(n, i, o), n = a.subParser("images")(n, i, o), n = a.subParser("anchors")(n, i, o), n = a.subParser("autoLinks")(n, i, o), n = a.subParser("simplifiedAutoLinks")(n, i, o), n = a.subParser("emoji")(n, i, o), n = a.subParser("underline")(n, i, o), n = a.subParser("italicsAndBold")(n, i, o), n = a.subParser("strikethrough")(n, i, o), n = a.subParser("ellipsis")(n, i, o), n = a.subParser("hashHTMLSpans")(n, i, o), n = a.subParser("encodeAmpsAndAngles")(n, i, o), i.simpleLineBreaks ? /\n\n¨K/.test(n) || (n = n.replace(/\n+/g, `
+`)) : n = n.replace(/ +\n/g, `
+`), n = o.converter._dispatch("spanGamut.after", n, i, o), n; + }), a.subParser("strikethrough", function(n, i, o) { + function c(u) { + return i.simplifiedAutoLink && (u = a.subParser("simplifiedAutoLinks")(u, i, o)), "" + u + ""; + } + return i.strikethrough && (n = o.converter._dispatch("strikethrough.before", n, i, o), n = n.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(u, f) { + return c(f); + }), n = o.converter._dispatch("strikethrough.after", n, i, o)), n; + }), a.subParser("stripLinkDefinitions", function(n, i, o) { + var c = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, u = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; + n += "¨0"; + var f = function(g, O, z, q, B, G, w) { + return O = O.toLowerCase(), n.toLowerCase().split(O).length - 1 < 2 ? g : (z.match(/^data:.+?\/.+?;base64,/) ? o.gUrls[O] = z.replace(/\s/g, "") : o.gUrls[O] = a.subParser("encodeAmpsAndAngles")(z, i, o), G ? G + w : (w && (o.gTitles[O] = w.replace(/"|'/g, """)), i.parseImgDimensions && q && B && (o.gDimensions[O] = { + width: q, + height: B }), "")); }; - return r = r.replace(u, m), r = r.replace(l, m), r = r.replace(/¨0/, ""), r; - }), n.subParser("tables", function(r, i, o) { + return n = n.replace(u, f), n = n.replace(c, f), n = n.replace(/¨0/, ""), n; + }), a.subParser("tables", function(n, i, o) { if (!i.tables) - return r; - var l = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, u = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; - function m(z) { - return /^:[ \t]*--*$/.test(z) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(z) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(z) ? ' style="text-align:center;"' : ""; + return n; + var c = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, u = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; + function f(B) { + return /^:[ \t]*--*$/.test(B) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(B) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(B) ? ' style="text-align:center;"' : ""; } - function f(z, H) { + function g(B, G) { var w = ""; - return z = z.trim(), (i.tablesHeaderId || i.tableHeaderId) && (w = ' id="' + z.replace(/ /g, "_").toLowerCase() + '"'), z = n.subParser("spanGamut")(z, i, o), "" + z + ` + return B = B.trim(), (i.tablesHeaderId || i.tableHeaderId) && (w = ' id="' + B.replace(/ /g, "_").toLowerCase() + '"'), B = a.subParser("spanGamut")(B, i, o), "" + B + ` `; } - function x(z, H) { - var w = n.subParser("spanGamut")(z, i, o); - return "" + w + ` + function O(B, G) { + var w = a.subParser("spanGamut")(B, i, o); + return "" + w + ` `; } - function B(z, H) { + function z(B, G) { for (var w = ` -`, q = z.length, W = 0; W < q; ++W) - w += z[W]; +`, U = B.length, W = 0; W < U; ++W) + w += B[W]; for (w += ` -`, W = 0; W < H.length; ++W) { +`, W = 0; W < G.length; ++W) { w += ` `; - for (var J = 0; J < q; ++J) - w += H[W][J]; + for (var J = 0; J < U; ++J) + w += G[W][J]; w += ` `; } @@ -8427,334 +8434,335 @@ var xl = { exports: {} };
`, w; } - function U(z) { - var H, w = z.split(` + function q(B) { + var G, w = B.split(` `); - for (H = 0; H < w.length; ++H) - /^ {0,3}\|/.test(w[H]) && (w[H] = w[H].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(w[H]) && (w[H] = w[H].replace(/\|[ \t]*$/, "")), w[H] = n.subParser("codeSpans")(w[H], i, o); - var q = w[0].split("|").map(function(k) { - return k.trim(); - }), W = w[1].split("|").map(function(k) { - return k.trim(); - }), J = [], V = [], E = [], F = []; - for (w.shift(), w.shift(), H = 0; H < w.length; ++H) - w[H].trim() !== "" && J.push( - w[H].split("|").map(function(k) { - return k.trim(); + for (G = 0; G < w.length; ++G) + /^ {0,3}\|/.test(w[G]) && (w[G] = w[G].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(w[G]) && (w[G] = w[G].replace(/\|[ \t]*$/, "")), w[G] = a.subParser("codeSpans")(w[G], i, o); + var U = w[0].split("|").map(function($) { + return $.trim(); + }), W = w[1].split("|").map(function($) { + return $.trim(); + }), J = [], V = [], P = [], F = []; + for (w.shift(), w.shift(), G = 0; G < w.length; ++G) + w[G].trim() !== "" && J.push( + w[G].split("|").map(function($) { + return $.trim(); }) ); - if (q.length < W.length) - return z; - for (H = 0; H < W.length; ++H) - E.push(m(W[H])); - for (H = 0; H < q.length; ++H) - n.helper.isUndefined(E[H]) && (E[H] = ""), V.push(f(q[H], E[H])); - for (H = 0; H < J.length; ++H) { - for (var O = [], d = 0; d < V.length; ++d) - n.helper.isUndefined(J[H][d]), O.push(x(J[H][d], E[d])); - F.push(O); + if (U.length < W.length) + return B; + for (G = 0; G < W.length; ++G) + P.push(f(W[G])); + for (G = 0; G < U.length; ++G) + a.helper.isUndefined(P[G]) && (P[G] = ""), V.push(g(U[G], P[G])); + for (G = 0; G < J.length; ++G) { + for (var L = [], h = 0; h < V.length; ++h) + a.helper.isUndefined(J[G][h]), L.push(O(J[G][h], P[h])); + F.push(L); } - return B(V, F); + return z(V, F); } - return r = o.converter._dispatch("tables.before", r, i, o), r = r.replace(/\\(\|)/g, n.helper.escapeCharactersCallback), r = r.replace(l, U), r = r.replace(u, U), r = o.converter._dispatch("tables.after", r, i, o), r; - }), n.subParser("underline", function(r, i, o) { - return i.underline && (r = o.converter._dispatch("underline.before", r, i, o), i.literalMidWordUnderscores ? (r = r.replace(/\b___(\S[\s\S]*?)___\b/g, function(l, u) { + return n = o.converter._dispatch("tables.before", n, i, o), n = n.replace(/\\(\|)/g, a.helper.escapeCharactersCallback), n = n.replace(c, q), n = n.replace(u, q), n = o.converter._dispatch("tables.after", n, i, o), n; + }), a.subParser("underline", function(n, i, o) { + return i.underline && (n = o.converter._dispatch("underline.before", n, i, o), i.literalMidWordUnderscores ? (n = n.replace(/\b___(\S[\s\S]*?)___\b/g, function(c, u) { return "" + u + ""; - }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(l, u) { + }), n = n.replace(/\b__(\S[\s\S]*?)__\b/g, function(c, u) { return "" + u + ""; - })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(l, u) { - return /\S$/.test(u) ? "" + u + "" : l; - }), r = r.replace(/__(\S[\s\S]*?)__/g, function(l, u) { - return /\S$/.test(u) ? "" + u + "" : l; - })), r = r.replace(/(_)/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("underline.after", r, i, o)), r; - }), n.subParser("unescapeSpecialChars", function(r, i, o) { - return r = o.converter._dispatch("unescapeSpecialChars.before", r, i, o), r = r.replace(/¨E(\d+)E/g, function(l, u) { - var m = parseInt(u); - return String.fromCharCode(m); - }), r = o.converter._dispatch("unescapeSpecialChars.after", r, i, o), r; - }), n.subParser("makeMarkdown.blockquote", function(r, i) { + })) : (n = n.replace(/___(\S[\s\S]*?)___/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + }), n = n.replace(/__(\S[\s\S]*?)__/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + })), n = n.replace(/(_)/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("underline.after", n, i, o)), n; + }), a.subParser("unescapeSpecialChars", function(n, i, o) { + return n = o.converter._dispatch("unescapeSpecialChars.before", n, i, o), n = n.replace(/¨E(\d+)E/g, function(c, u) { + var f = parseInt(u); + return String.fromCharCode(f); + }), n = o.converter._dispatch("unescapeSpecialChars.after", n, i, o), n; + }), a.subParser("makeMarkdown.blockquote", function(n, i) { var o = ""; - if (r.hasChildNodes()) - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) { - var f = n.subParser("makeMarkdown.node")(l[m], i); - f !== "" && (o += f); + if (n.hasChildNodes()) + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) { + var g = a.subParser("makeMarkdown.node")(c[f], i); + g !== "" && (o += g); } return o = o.trim(), o = "> " + o.split(` `).join(` > `), o; - }), n.subParser("makeMarkdown.codeBlock", function(r, i) { - var o = r.getAttribute("language"), l = r.getAttribute("precodenum"); + }), a.subParser("makeMarkdown.codeBlock", function(n, i) { + var o = n.getAttribute("language"), c = n.getAttribute("precodenum"); return "```" + o + ` -` + i.preList[l] + "\n```"; - }), n.subParser("makeMarkdown.codeSpan", function(r) { - return "`" + r.innerHTML + "`"; - }), n.subParser("makeMarkdown.emphasis", function(r, i) { +` + i.preList[c] + "\n```"; + }), a.subParser("makeMarkdown.codeSpan", function(n) { + return "`" + n.innerHTML + "`"; + }), a.subParser("makeMarkdown.emphasis", function(n, i) { var o = ""; - if (r.hasChildNodes()) { + if (n.hasChildNodes()) { o += "*"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); o += "*"; } return o; - }), n.subParser("makeMarkdown.header", function(r, i, o) { - var l = new Array(o + 1).join("#"), u = ""; - if (r.hasChildNodes()) { - u = l + " "; - for (var m = r.childNodes, f = m.length, x = 0; x < f; ++x) - u += n.subParser("makeMarkdown.node")(m[x], i); + }), a.subParser("makeMarkdown.header", function(n, i, o) { + var c = new Array(o + 1).join("#"), u = ""; + if (n.hasChildNodes()) { + u = c + " "; + for (var f = n.childNodes, g = f.length, O = 0; O < g; ++O) + u += a.subParser("makeMarkdown.node")(f[O], i); } return u; - }), n.subParser("makeMarkdown.hr", function() { + }), a.subParser("makeMarkdown.hr", function() { return "---"; - }), n.subParser("makeMarkdown.image", function(r) { + }), a.subParser("makeMarkdown.image", function(n) { var i = ""; - return r.hasAttribute("src") && (i += "![" + r.getAttribute("alt") + "](", i += "<" + r.getAttribute("src") + ">", r.hasAttribute("width") && r.hasAttribute("height") && (i += " =" + r.getAttribute("width") + "x" + r.getAttribute("height")), r.hasAttribute("title") && (i += ' "' + r.getAttribute("title") + '"'), i += ")"), i; - }), n.subParser("makeMarkdown.links", function(r, i) { + return n.hasAttribute("src") && (i += "![" + n.getAttribute("alt") + "](", i += "<" + n.getAttribute("src") + ">", n.hasAttribute("width") && n.hasAttribute("height") && (i += " =" + n.getAttribute("width") + "x" + n.getAttribute("height")), n.hasAttribute("title") && (i += ' "' + n.getAttribute("title") + '"'), i += ")"), i; + }), a.subParser("makeMarkdown.links", function(n, i) { var o = ""; - if (r.hasChildNodes() && r.hasAttribute("href")) { - var l = r.childNodes, u = l.length; + if (n.hasChildNodes() && n.hasAttribute("href")) { + var c = n.childNodes, u = c.length; o = "["; - for (var m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - o += "](", o += "<" + r.getAttribute("href") + ">", r.hasAttribute("title") && (o += ' "' + r.getAttribute("title") + '"'), o += ")"; + for (var f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); + o += "](", o += "<" + n.getAttribute("href") + ">", n.hasAttribute("title") && (o += ' "' + n.getAttribute("title") + '"'), o += ")"; } return o; - }), n.subParser("makeMarkdown.list", function(r, i, o) { - var l = ""; - if (!r.hasChildNodes()) + }), a.subParser("makeMarkdown.list", function(n, i, o) { + var c = ""; + if (!n.hasChildNodes()) return ""; - for (var u = r.childNodes, m = u.length, f = r.getAttribute("start") || 1, x = 0; x < m; ++x) - if (!(typeof u[x].tagName > "u" || u[x].tagName.toLowerCase() !== "li")) { - var B = ""; - o === "ol" ? B = f.toString() + ". " : B = "- ", l += B + n.subParser("makeMarkdown.listItem")(u[x], i), ++f; + for (var u = n.childNodes, f = u.length, g = n.getAttribute("start") || 1, O = 0; O < f; ++O) + if (!(typeof u[O].tagName > "u" || u[O].tagName.toLowerCase() !== "li")) { + var z = ""; + o === "ol" ? z = g.toString() + ". " : z = "- ", c += z + a.subParser("makeMarkdown.listItem")(u[O], i), ++g; } - return l += ` + return c += ` -`, l.trim(); - }), n.subParser("makeMarkdown.listItem", function(r, i) { - for (var o = "", l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); +`, c.trim(); + }), a.subParser("makeMarkdown.listItem", function(n, i) { + for (var o = "", c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); return /\n$/.test(o) ? o = o.split(` `).join(` `).replace(/^ {4}$/gm, "").replace(/\n\n+/g, ` `) : o += ` `, o; - }), n.subParser("makeMarkdown.node", function(r, i, o) { + }), a.subParser("makeMarkdown.node", function(n, i, o) { o = o || !1; - var l = ""; - if (r.nodeType === 3) - return n.subParser("makeMarkdown.txt")(r, i); - if (r.nodeType === 8) - return " + var c = ""; + if (n.nodeType === 3) + return a.subParser("makeMarkdown.txt")(n, i); + if (n.nodeType === 8) + return " `; - if (r.nodeType !== 1) + if (n.nodeType !== 1) return ""; - var u = r.tagName.toLowerCase(); + var u = n.tagName.toLowerCase(); switch (u) { case "h1": - o || (l = n.subParser("makeMarkdown.header")(r, i, 1) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 1) + ` `); break; case "h2": - o || (l = n.subParser("makeMarkdown.header")(r, i, 2) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 2) + ` `); break; case "h3": - o || (l = n.subParser("makeMarkdown.header")(r, i, 3) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 3) + ` `); break; case "h4": - o || (l = n.subParser("makeMarkdown.header")(r, i, 4) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 4) + ` `); break; case "h5": - o || (l = n.subParser("makeMarkdown.header")(r, i, 5) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 5) + ` `); break; case "h6": - o || (l = n.subParser("makeMarkdown.header")(r, i, 6) + ` + o || (c = a.subParser("makeMarkdown.header")(n, i, 6) + ` `); break; case "p": - o || (l = n.subParser("makeMarkdown.paragraph")(r, i) + ` + o || (c = a.subParser("makeMarkdown.paragraph")(n, i) + ` `); break; case "blockquote": - o || (l = n.subParser("makeMarkdown.blockquote")(r, i) + ` + o || (c = a.subParser("makeMarkdown.blockquote")(n, i) + ` `); break; case "hr": - o || (l = n.subParser("makeMarkdown.hr")(r, i) + ` + o || (c = a.subParser("makeMarkdown.hr")(n, i) + ` `); break; case "ol": - o || (l = n.subParser("makeMarkdown.list")(r, i, "ol") + ` + o || (c = a.subParser("makeMarkdown.list")(n, i, "ol") + ` `); break; case "ul": - o || (l = n.subParser("makeMarkdown.list")(r, i, "ul") + ` + o || (c = a.subParser("makeMarkdown.list")(n, i, "ul") + ` `); break; case "precode": - o || (l = n.subParser("makeMarkdown.codeBlock")(r, i) + ` + o || (c = a.subParser("makeMarkdown.codeBlock")(n, i) + ` `); break; case "pre": - o || (l = n.subParser("makeMarkdown.pre")(r, i) + ` + o || (c = a.subParser("makeMarkdown.pre")(n, i) + ` `); break; case "table": - o || (l = n.subParser("makeMarkdown.table")(r, i) + ` + o || (c = a.subParser("makeMarkdown.table")(n, i) + ` `); break; case "code": - l = n.subParser("makeMarkdown.codeSpan")(r, i); + c = a.subParser("makeMarkdown.codeSpan")(n, i); break; case "em": case "i": - l = n.subParser("makeMarkdown.emphasis")(r, i); + c = a.subParser("makeMarkdown.emphasis")(n, i); break; case "strong": case "b": - l = n.subParser("makeMarkdown.strong")(r, i); + c = a.subParser("makeMarkdown.strong")(n, i); break; case "del": - l = n.subParser("makeMarkdown.strikethrough")(r, i); + c = a.subParser("makeMarkdown.strikethrough")(n, i); break; case "a": - l = n.subParser("makeMarkdown.links")(r, i); + c = a.subParser("makeMarkdown.links")(n, i); break; case "img": - l = n.subParser("makeMarkdown.image")(r, i); + c = a.subParser("makeMarkdown.image")(n, i); break; default: - l = r.outerHTML + ` + c = n.outerHTML + ` `; } - return l; - }), n.subParser("makeMarkdown.paragraph", function(r, i) { + return c; + }), a.subParser("makeMarkdown.paragraph", function(n, i) { var o = ""; - if (r.hasChildNodes()) - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); + if (n.hasChildNodes()) + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); return o = o.trim(), o; - }), n.subParser("makeMarkdown.pre", function(r, i) { - var o = r.getAttribute("prenum"); + }), a.subParser("makeMarkdown.pre", function(n, i) { + var o = n.getAttribute("prenum"); return "
" + i.preList[o] + "
"; - }), n.subParser("makeMarkdown.strikethrough", function(r, i) { + }), a.subParser("makeMarkdown.strikethrough", function(n, i) { var o = ""; - if (r.hasChildNodes()) { + if (n.hasChildNodes()) { o += "~~"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); o += "~~"; } return o; - }), n.subParser("makeMarkdown.strong", function(r, i) { + }), a.subParser("makeMarkdown.strong", function(n, i) { var o = ""; - if (r.hasChildNodes()) { + if (n.hasChildNodes()) { o += "**"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i); o += "**"; } return o; - }), n.subParser("makeMarkdown.table", function(r, i) { - var o = "", l = [[], []], u = r.querySelectorAll("thead>tr>th"), m = r.querySelectorAll("tbody>tr"), f, x; - for (f = 0; f < u.length; ++f) { - var B = n.subParser("makeMarkdown.tableCell")(u[f], i), U = "---"; - if (u[f].hasAttribute("style")) { - var z = u[f].getAttribute("style").toLowerCase().replace(/\s/g, ""); - switch (z) { + }), a.subParser("makeMarkdown.table", function(n, i) { + var o = "", c = [[], []], u = n.querySelectorAll("thead>tr>th"), f = n.querySelectorAll("tbody>tr"), g, O; + for (g = 0; g < u.length; ++g) { + var z = a.subParser("makeMarkdown.tableCell")(u[g], i), q = "---"; + if (u[g].hasAttribute("style")) { + var B = u[g].getAttribute("style").toLowerCase().replace(/\s/g, ""); + switch (B) { case "text-align:left;": - U = ":---"; + q = ":---"; break; case "text-align:right;": - U = "---:"; + q = "---:"; break; case "text-align:center;": - U = ":---:"; + q = ":---:"; break; } } - l[0][f] = B.trim(), l[1][f] = U; + c[0][g] = z.trim(), c[1][g] = q; } - for (f = 0; f < m.length; ++f) { - var H = l.push([]) - 1, w = m[f].getElementsByTagName("td"); - for (x = 0; x < u.length; ++x) { - var q = " "; - typeof w[x] < "u" && (q = n.subParser("makeMarkdown.tableCell")(w[x], i)), l[H].push(q); + for (g = 0; g < f.length; ++g) { + var G = c.push([]) - 1, w = f[g].getElementsByTagName("td"); + for (O = 0; O < u.length; ++O) { + var U = " "; + typeof w[O] < "u" && (U = a.subParser("makeMarkdown.tableCell")(w[O], i)), c[G].push(U); } } var W = 3; - for (f = 0; f < l.length; ++f) - for (x = 0; x < l[f].length; ++x) { - var J = l[f][x].length; + for (g = 0; g < c.length; ++g) + for (O = 0; O < c[g].length; ++O) { + var J = c[g][O].length; J > W && (W = J); } - for (f = 0; f < l.length; ++f) { - for (x = 0; x < l[f].length; ++x) - f === 1 ? l[f][x].slice(-1) === ":" ? l[f][x] = n.helper.padEnd(l[f][x].slice(-1), W - 1, "-") + ":" : l[f][x] = n.helper.padEnd(l[f][x], W, "-") : l[f][x] = n.helper.padEnd(l[f][x], W); - o += "| " + l[f].join(" | ") + ` | + for (g = 0; g < c.length; ++g) { + for (O = 0; O < c[g].length; ++O) + g === 1 ? c[g][O].slice(-1) === ":" ? c[g][O] = a.helper.padEnd(c[g][O].slice(-1), W - 1, "-") + ":" : c[g][O] = a.helper.padEnd(c[g][O], W, "-") : c[g][O] = a.helper.padEnd(c[g][O], W); + o += "| " + c[g].join(" | ") + ` | `; } return o.trim(); - }), n.subParser("makeMarkdown.tableCell", function(r, i) { + }), a.subParser("makeMarkdown.tableCell", function(n, i) { var o = ""; - if (!r.hasChildNodes()) + if (!n.hasChildNodes()) return ""; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i, !0); + for (var c = n.childNodes, u = c.length, f = 0; f < u; ++f) + o += a.subParser("makeMarkdown.node")(c[f], i, !0); return o.trim(); - }), n.subParser("makeMarkdown.txt", function(r) { - var i = r.nodeValue; - return i = i.replace(/ +/g, " "), i = i.replace(/¨NBSP;/g, " "), i = n.helper.unescapeHTMLEntities(i), i = i.replace(/([*_~|`])/g, "\\$1"), i = i.replace(/^(\s*)>/g, "\\$1>"), i = i.replace(/^#/gm, "\\#"), i = i.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), i = i.replace(/^( {0,3}\d+)\./gm, "$1\\."), i = i.replace(/^( {0,3})([+-])/gm, "$1\\$2"), i = i.replace(/]([\s]*)\(/g, "\\]$1\\("), i = i.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), i; + }), a.subParser("makeMarkdown.txt", function(n) { + var i = n.nodeValue; + return i = i.replace(/ +/g, " "), i = i.replace(/¨NBSP;/g, " "), i = a.helper.unescapeHTMLEntities(i), i = i.replace(/([*_~|`])/g, "\\$1"), i = i.replace(/^(\s*)>/g, "\\$1>"), i = i.replace(/^#/gm, "\\#"), i = i.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), i = i.replace(/^( {0,3}\d+)\./gm, "$1\\."), i = i.replace(/^( {0,3})([+-])/gm, "$1\\$2"), i = i.replace(/]([\s]*)\(/g, "\\]$1\\("), i = i.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), i; }); - var I = this; - e.exports ? e.exports = n : I.showdown = n; - }).call(Rc); -})(xl); -var sm = xl.exports; -const Ki = /* @__PURE__ */ Ic(sm); -let Wi = class { + var R = this; + e.exports ? e.exports = a : R.showdown = a; + }).call(no); +})(Zo); +var qu = Zo.exports; +const Jn = /* @__PURE__ */ oo(qu); +class Zn { constructor() { - Ye(this, "logger"), Ye(this, "converter"), this.logger = Ps.zhiLog("showdown-adaptor"), this.converter = new Ki.Converter(); + Te(this, "logger"), Te(this, "converter"), this.logger = nn.zhiLog("showdown-adaptor"), this.converter = new Jn.Converter(); } isAvailable() { - return typeof Ki < "u"; + return typeof Jn < "u"; } renderMarkdownStr(t) { if (!this.isAvailable()) throw new Error("Showdown is not available"); return this.logger.info("Showdown is rendering md to HTML..."), Promise.resolve(this.converter.makeHtml(t)); } -}, Tl = class { +} +class Yo { constructor() { - Ye(this, "logger"), Ye(this, "mdAdaptor", new Wi()), this.logger = Ps.zhiLog("markdown-util"); + Te(this, "logger"), Te(this, "mdAdaptor", new Zn()), this.logger = nn.zhiLog("markdown-util"); } /** * 获取当前 MD 解析器名称 */ getCurrentAdaptorName() { - return this.mdAdaptor instanceof Gi ? "Lute" : this.mdAdaptor instanceof Wi ? "Showdown" : "None"; + return this.mdAdaptor instanceof Wn ? "Lute" : this.mdAdaptor instanceof Zn ? "Showdown" : "None"; } /** * 渲染Markdown @@ -8762,12 +8770,13 @@ let Wi = class { * @param md - Markdown文本 */ async renderHTML(t) { - const a = new Gi(); - return this.logger.debug("Lute status =>", a.isAvailable()), a.isAvailable() && (this.mdAdaptor = a), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(t); + const r = new Wn(); + return this.logger.debug("Lute status =>", r.isAvailable()), r.isAvailable() && (this.mdAdaptor = r), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(t); } -}, im = class { +} +class Uu { constructor() { - Ye(this, "mdUtil"), this.mdUtil = new Tl(); + Te(this, "mdUtil"), this.mdUtil = new Yo(); } /** * 移除标题数字 @@ -8775,9 +8784,9 @@ let Wi = class { * @param str - 字符串 */ removeTitleNumber(t) { - let a = t; - const n = /([0-9]*)\./; - return a = a.replace(n, ""), a; + let r = t; + const a = /([0-9]*)\./; + return r = r.replace(a, ""), r; } /** * 删除挂件的HTML @@ -8785,13 +8794,13 @@ let Wi = class { * @param str - 原字符 */ removeWidgetTag(t) { - let a = t.toString(); - const n = //g; - a = a.replace(n, ""); + let r = t.toString(); + const a = //g; + r = r.replace(a, ""); const s = //g; - a = a.replace(s, ""); - const c = //g; - return a = a.replace(c, ""), a; + r = r.replace(s, ""); + const l = //g; + return r = r.replace(l, ""), r; } /** * 删除Markdown文本的挂件的HTML @@ -8799,8 +8808,8 @@ let Wi = class { * @param str - 原字符 */ removeMdWidgetTag(t) { - let a = t.toString(); - return a = this.removeWidgetTag(a), a; + let r = t.toString(); + return r = this.removeWidgetTag(r), r; } /** * 去除html标签,残缺不全也可以 @@ -8809,9 +8818,9 @@ let Wi = class { */ filterHtml(t) { t = t.replace(//g, ""), t = t.replace(//g, ""), t = t.replace(/<[^>]*>/g, ""), t = t.replace(/&.*;/g, ""), t = t.replace(/(^\s*)|(\s*$)/g, ""), t = t.replace(//g, ""), t = t.replace(/"/g, "").replace(/'/g, ""), t = t.replace(/\*/g, ""), t = t.replace(/\$/g, ""), t = t.replace(/\./g, ""), t = t.replace(/\+/g, ""), t = t.replace(/\s+/g, ""), t = t.replace(/[:|:]/g, "_"), t = t.replace(/[;|;]/g, "_"), t = t.replace(/\^/g, "_"), t = t.replace(/!/g, "_"), t = t.replace(/@/g, "at_"); - const a = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; - for (let n = 0; n < a.length; n++) { - const s = new RegExp(a[n], "g"); + const r = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; + for (let a = 0; a < r.length; a++) { + const s = new RegExp(r[a], "g"); t = t.replace(s, ""); } return t = t.toLowerCase(), t; @@ -8823,9 +8832,9 @@ let Wi = class { * @param length - 长度 * @param ignore - 不要结尾省略号 */ - parseHtml(t, a, n) { + parseHtml(t, r, a) { const s = this.filterHtml(t); - return s.length < a ? s : n === !0 ? s.substring(0, a) : s.substring(0, a) + "..."; + return s.length < r ? s : a === !0 ? s.substring(0, r) : s.substring(0, r) + "..."; } /** * 将Markdown转换为HTML @@ -8833,8 +8842,8 @@ let Wi = class { * @param md - Markdown */ async mdToHtml(t) { - const a = await this.mdUtil.renderHTML(t); - return this.removeWidgetTag(a); + const r = await this.mdUtil.renderHTML(t); + return this.removeWidgetTag(r); } /** * 将Markdown转换为纯文本 @@ -8842,8 +8851,8 @@ let Wi = class { * @param md - Markdown */ async mdToPlainText(t) { - const a = await this.mdToHtml(t); - return this.filterHtml(a); + const r = await this.mdToHtml(t); + return this.filterHtml(r); } /** * 移除H1标签 @@ -8851,9 +8860,9 @@ let Wi = class { * @param html - html */ removeH1(t) { - let a = t; - const n = //g; - return a = a.replace(n, ""), a; + let r = t; + const a = //g; + return r = r.replace(a, ""), r; } /** * 移除Markdown里面的H1标签 @@ -8870,11 +8879,12 @@ let Wi = class { * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 */ removeMdH1(t) { - let a = t; - const n = /^# .*$/gm; - return a = a.replace(n, ""), a; + let r = t; + const a = /^# .*$/gm; + return r = r.replace(a, ""), r; } -}, cm = class { +} +class Gu { /** * 检测是否是空对象 * @@ -8883,82 +8893,83 @@ let Wi = class { isEmptyObject(t) { return t ? Object.getPrototypeOf(t) === Object.prototype && Object.getOwnPropertyNames(t).length === 0 && Object.getOwnPropertySymbols(t).length === 0 : !0; } -}, lm = class { +} +class Hu { constructor() { - Ye(this, "dateUtil"), Ye(this, "strUtil"), Ye(this, "versionUtil"), Ye(this, "htmlUtil"), Ye(this, "markdownUtil"), Ye(this, "jsonUtil"), Ye(this, "objectUtil"), this.dateUtil = new Rf(), this.strUtil = new If(), this.versionUtil = new zf(), this.htmlUtil = new im(), this.markdownUtil = new Tl(), this.jsonUtil = new Lf(), this.objectUtil = new cm(); + Te(this, "dateUtil"), Te(this, "strUtil"), Te(this, "versionUtil"), Te(this, "htmlUtil"), Te(this, "markdownUtil"), Te(this, "jsonUtil"), Te(this, "objectUtil"), this.dateUtil = new yu(), this.strUtil = new _u(), this.versionUtil = new Eu(), this.htmlUtil = new Uu(), this.markdownUtil = new Yo(), this.jsonUtil = new bu(), this.objectUtil = new Gu(); } -}; -const um = lm; -var dm = Object.defineProperty, hm = (e, t, a) => t in e ? dm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, xa = (e, t, a) => (hm(e, typeof t != "symbol" ? t + "" : t, a), a); -class Ta { } -xa(Ta, "NODE_ENV_KEY", "NODE_ENV"), /** +const Ku = Hu; +var Wu = Object.defineProperty, Ju = (e, t, r) => t in e ? Wu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, sr = (e, t, r) => (Ju(e, typeof t != "symbol" ? t + "" : t, r), r); +class ir { +} +sr(ir, "NODE_ENV_KEY", "NODE_ENV"), /** * 开发环境 */ -xa(Ta, "NODE_ENV_DEVELOPMENT", "development"), /** +sr(ir, "NODE_ENV_DEVELOPMENT", "development"), /** * 生产环境 */ -xa(Ta, "NODE_ENV_PRODUCTION", "production"), /** +sr(ir, "NODE_ENV_PRODUCTION", "production"), /** * 测试环境 */ -xa(Ta, "NODE_ENV_TEST", "test"), /** +sr(ir, "NODE_ENV_TEST", "test"), /** * 是否处于调试模式 */ -xa(Ta, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); -let pm = class { -}; -ye(pm, "DEFAULT_BLOG_TYPE_KEY", "VITE_DEFAULT_TYPE"); -class fm extends Mu { +sr(ir, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Zu { } -class Ji extends Au { - constructor(a, n) { +oe(Zu, "DEFAULT_BLOG_TYPE_KEY", "VITE_DEFAULT_TYPE"); +class Yu extends ks { +} +class Yn extends vs { + constructor(r, a) { super(); /** * 思源笔记伺服地址 */ - Ke(this, "apiUrl"); + $e(this, "apiUrl"); /** * 思源笔记 API token */ - Ke(this, "password"); + $e(this, "password"); /** * 思源笔记操作提示 * * @protected */ - Ke(this, "placeholder"); + $e(this, "placeholder"); /** * 是否修复标题 * * @protected */ - Ke(this, "fixTitle"); - this.apiUrl = a ?? "http://127.0.0.1:6806", this.passwordType = Lc.PasswordType_Token, this.password = n ?? "", this.placeholder = new fm(), this.fixTitle = !0; + $e(this, "fixTitle"); + this.apiUrl = r ?? "http://127.0.0.1:6806", this.passwordType = ao.PasswordType_Token, this.password = a ?? "", this.placeholder = new Yu(), this.fixTitle = !0; } } -var mm = Object.defineProperty, gm = (e, t, a) => t in e ? mm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, aa = (e, t, a) => (gm(e, typeof t != "symbol" ? t + "" : t, a), a); -let Ln = class { -}; -aa(Ln, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), aa(Ln, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); -var Yt = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(Yt || {}), jl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function Ss(e) { +var Qu = Object.defineProperty, Xu = (e, t, r) => t in e ? Qu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Gt = (e, t, r) => (Xu(e, typeof t != "symbol" ? t + "" : t, r), r); +class Kr { +} +Gt(Kr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Gt(Kr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var et = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(et || {}), Qo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function on(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } -var Cl = { exports: {} }; +var Xo = { exports: {} }; (function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.log = a(); - })(jl, function() { + (function(t, r) { + e.exports ? e.exports = r() : t.log = r(); + })(Qo, function() { var t = function() { - }, a = "undefined", n = typeof window !== a && typeof window.navigator !== a && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ + }, r = "undefined", a = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ "trace", "debug", "info", "warn", "error" ]; - function c(C, T) { - var v = C[T]; + function l(C, x) { + var v = C[x]; if (typeof v.bind == "function") return v.bind(C); try { @@ -8969,196 +8980,196 @@ var Cl = { exports: {} }; }; } } - function p() { + function d() { console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); } function b(C) { - return C === "debug" && (C = "log"), typeof console === a ? !1 : C === "trace" && n ? p : console[C] !== void 0 ? c(console, C) : console.log !== void 0 ? c(console, "log") : t; + return C === "debug" && (C = "log"), typeof console === r ? !1 : C === "trace" && a ? d : console[C] !== void 0 ? l(console, C) : console.log !== void 0 ? l(console, "log") : t; } - function _(C, T) { + function _(C, x) { for (var v = 0; v < s.length; v++) { - var j = s[v]; - this[j] = v < C ? t : this.methodFactory(j, C, T); + var T = s[v]; + this[T] = v < C ? t : this.methodFactory(T, C, x); } this.log = this.debug; } - function y(C, T, v) { + function y(C, x, v) { return function() { - typeof console !== a && (_.call(this, T, v), this[C].apply(this, arguments)); + typeof console !== r && (_.call(this, x, v), this[C].apply(this, arguments)); }; } - function g(C, T, v) { + function m(C, x, v) { return b(C) || y.apply(this, arguments); } - function S(C, T, v) { - var j = this, I; - T = T ?? "WARN"; - var r = "loglevel"; - typeof C == "string" ? r += ":" + C : typeof C == "symbol" && (r = void 0); - function i(m) { - var f = (s[m] || "silent").toUpperCase(); - if (!(typeof window === a || !r)) { + function k(C, x, v) { + var T = this, R; + x = x ?? "WARN"; + var n = "loglevel"; + typeof C == "string" ? n += ":" + C : typeof C == "symbol" && (n = void 0); + function i(f) { + var g = (s[f] || "silent").toUpperCase(); + if (!(typeof window === r || !n)) { try { - window.localStorage[r] = f; + window.localStorage[n] = g; return; } catch { } try { - window.document.cookie = encodeURIComponent(r) + "=" + f + ";"; + window.document.cookie = encodeURIComponent(n) + "=" + g + ";"; } catch { } } } function o() { - var m; - if (!(typeof window === a || !r)) { + var f; + if (!(typeof window === r || !n)) { try { - m = window.localStorage[r]; + f = window.localStorage[n]; } catch { } - if (typeof m === a) + if (typeof f === r) try { - var f = window.document.cookie, x = f.indexOf( - encodeURIComponent(r) + "=" + var g = window.document.cookie, O = g.indexOf( + encodeURIComponent(n) + "=" ); - x !== -1 && (m = /^([^;]+)/.exec(f.slice(x))[1]); + O !== -1 && (f = /^([^;]+)/.exec(g.slice(O))[1]); } catch { } - return j.levels[m] === void 0 && (m = void 0), m; + return T.levels[f] === void 0 && (f = void 0), f; } } - function l() { - if (!(typeof window === a || !r)) { + function c() { + if (!(typeof window === r || !n)) { try { - window.localStorage.removeItem(r); + window.localStorage.removeItem(n); return; } catch { } try { - window.document.cookie = encodeURIComponent(r) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + window.document.cookie = encodeURIComponent(n) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; } catch { } } } - j.name = C, j.levels = { + T.name = C, T.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 - }, j.methodFactory = v || g, j.getLevel = function() { - return I; - }, j.setLevel = function(m, f) { - if (typeof m == "string" && j.levels[m.toUpperCase()] !== void 0 && (m = j.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= j.levels.SILENT) { - if (I = m, f !== !1 && i(m), _.call(j, m, C), typeof console === a && m < j.levels.SILENT) + }, T.methodFactory = v || m, T.getLevel = function() { + return R; + }, T.setLevel = function(f, g) { + if (typeof f == "string" && T.levels[f.toUpperCase()] !== void 0 && (f = T.levels[f.toUpperCase()]), typeof f == "number" && f >= 0 && f <= T.levels.SILENT) { + if (R = f, g !== !1 && i(f), _.call(T, f, C), typeof console === r && f < T.levels.SILENT) return "No console available for logging"; } else - throw "log.setLevel() called with invalid level: " + m; - }, j.setDefaultLevel = function(m) { - T = m, o() || j.setLevel(m, !1); - }, j.resetLevel = function() { - j.setLevel(T, !1), l(); - }, j.enableAll = function(m) { - j.setLevel(j.levels.TRACE, m); - }, j.disableAll = function(m) { - j.setLevel(j.levels.SILENT, m); + throw "log.setLevel() called with invalid level: " + f; + }, T.setDefaultLevel = function(f) { + x = f, o() || T.setLevel(f, !1); + }, T.resetLevel = function() { + T.setLevel(x, !1), c(); + }, T.enableAll = function(f) { + T.setLevel(T.levels.TRACE, f); + }, T.disableAll = function(f) { + T.setLevel(T.levels.SILENT, f); }; var u = o(); - u == null && (u = T), j.setLevel(u, !1); + u == null && (u = x), T.setLevel(u, !1); } - var L = new S(), A = {}; - L.getLogger = function(C) { + var N = new k(), A = {}; + N.getLogger = function(C) { if (typeof C != "symbol" && typeof C != "string" || C === "") throw new TypeError("You must supply a name when creating a logger."); - var T = A[C]; - return T || (T = A[C] = new S( + var x = A[C]; + return x || (x = A[C] = new k( C, - L.getLevel(), - L.methodFactory - )), T; + N.getLevel(), + N.methodFactory + )), x; }; - var N = typeof window !== a ? window.log : void 0; - return L.noConflict = function() { - return typeof window !== a && window.log === L && (window.log = N), L; - }, L.getLoggers = function() { + var j = typeof window !== r ? window.log : void 0; + return N.noConflict = function() { + return typeof window !== r && window.log === N && (window.log = j), N; + }, N.getLoggers = function() { return A; - }, L.default = L, L; + }, N.default = N, N; }); -})(Cl); -var ym = Cl.exports; -const un = /* @__PURE__ */ Ss(ym); -var Ol = { exports: {} }; +})(Xo); +var ed = Xo.exports; +const Lr = /* @__PURE__ */ on(ed); +var es = { exports: {} }; (function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.prefix = a(t); - })(jl, function(t) { - var a = function(g) { - for (var S = 1, L = arguments.length, A; S < L; S++) - for (A in arguments[S]) - Object.prototype.hasOwnProperty.call(arguments[S], A) && (g[A] = arguments[S][A]); - return g; - }, n = { + (function(t, r) { + e.exports ? e.exports = r() : t.prefix = r(t); + })(Qo, function(t) { + var r = function(m) { + for (var k = 1, N = arguments.length, A; k < N; k++) + for (A in arguments[k]) + Object.prototype.hasOwnProperty.call(arguments[k], A) && (m[A] = arguments[k][A]); + return m; + }, a = { template: "[%t] %l:", - levelFormatter: function(g) { - return g.toUpperCase(); + levelFormatter: function(m) { + return m.toUpperCase(); }, - nameFormatter: function(g) { - return g || "root"; + nameFormatter: function(m) { + return m || "root"; }, - timestampFormatter: function(g) { - return g.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + timestampFormatter: function(m) { + return m.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); }, format: void 0 - }, s, c = {}, p = function(g) { - if (!g || !g.getLogger) + }, s, l = {}, d = function(m) { + if (!m || !m.getLogger) throw new TypeError("Argument is not a root logger"); - s = g; - }, b = function(g, S) { - if (!g || !g.setLevel) + s = m; + }, b = function(m, k) { + if (!m || !m.setLevel) throw new TypeError("Argument is not a logger"); - var L = g.methodFactory, A = g.name || "", N = c[A] || c[""] || n; - function C(T, v, j) { - var I = L(T, v, j), r = c[j] || c[""], i = r.template.indexOf("%t") !== -1, o = r.template.indexOf("%l") !== -1, l = r.template.indexOf("%n") !== -1; + var N = m.methodFactory, A = m.name || "", j = l[A] || l[""] || a; + function C(x, v, T) { + var R = N(x, v, T), n = l[T] || l[""], i = n.template.indexOf("%t") !== -1, o = n.template.indexOf("%l") !== -1, c = n.template.indexOf("%n") !== -1; return function() { - for (var u = "", m = arguments.length, f = Array(m), x = 0; x < m; x++) - f[x] = arguments[x]; - if (A || !c[j]) { - var B = r.timestampFormatter(/* @__PURE__ */ new Date()), U = r.levelFormatter(T), z = r.nameFormatter(j); - r.format ? u += r.format(U, z, B) : (u += r.template, i && (u = u.replace(/%t/, B)), o && (u = u.replace(/%l/, U)), l && (u = u.replace(/%n/, z))), f.length && typeof f[0] == "string" ? f[0] = u + " " + f[0] : f.unshift(u); + for (var u = "", f = arguments.length, g = Array(f), O = 0; O < f; O++) + g[O] = arguments[O]; + if (A || !l[T]) { + var z = n.timestampFormatter(/* @__PURE__ */ new Date()), q = n.levelFormatter(x), B = n.nameFormatter(T); + n.format ? u += n.format(q, B, z) : (u += n.template, i && (u = u.replace(/%t/, z)), o && (u = u.replace(/%l/, q)), c && (u = u.replace(/%n/, B))), g.length && typeof g[0] == "string" ? g[0] = u + " " + g[0] : g.unshift(u); } - I.apply(void 0, f); + R.apply(void 0, g); }; } - return c[A] || (g.methodFactory = C), S = S || {}, S.template && (S.format = void 0), c[A] = a({}, N, S), g.setLevel(g.getLevel()), s || g.warn( + return l[A] || (m.methodFactory = C), k = k || {}, k.template && (k.format = void 0), l[A] = r({}, j, k), m.setLevel(m.getLevel()), s || m.warn( "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" - ), g; + ), m; }, _ = { - reg: p, + reg: d, apply: b }, y; return t && (y = t.prefix, _.noConflict = function() { return t.prefix === _ && (t.prefix = y), _; }), _; }); -})(Ol); -var bm = Ol.exports; -const Zi = /* @__PURE__ */ Ss(bm); -function _m() { +})(es); +var td = es.exports; +const Qn = /* @__PURE__ */ on(td); +function rd() { const e = Error.prepareStackTrace; - Error.prepareStackTrace = (a, n) => n; + Error.prepareStackTrace = (r, a) => a; const t = new Error().stack.slice(1); return Error.prepareStackTrace = e, t; } -class Ha { +class mr { /** * 解析日志级别为枚举 * * @param enumObj - 枚举对象 * @param value - 配置的值 */ - static stringToEnumValue(t, a) { - return t[Object.keys(t).filter((n) => t[n].toString() === a)[0]]; + static stringToEnumValue(t, r) { + return t[Object.keys(t).filter((a) => t[a].toString() === r)[0]]; } /** * 获取配置的日志级别 @@ -9166,22 +9177,22 @@ class Ha { static getEnvLevel(t) { if (!t) return; - const a = t.getEnvOrDefault(Ln.LOG_LEVEL_KEY, Yt.LOG_LEVEL_INFO), n = Ha.stringToEnumValue(Yt, a.toUpperCase()); - return n || console.warn( + const r = t.getEnvOrDefault(Kr.LOG_LEVEL_KEY, et.LOG_LEVEL_INFO), a = mr.stringToEnumValue(et, r.toUpperCase()); + return a || console.warn( "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" - ), n; + ), a; } /** * 获取默认日志 */ static getEnvLogger(t) { - return t ? t.getEnv(Ln.LOG_PREFIX_KEY) : void 0; + return t ? t.getEnv(Kr.LOG_PREFIX_KEY) : void 0; } } -var xs = { exports: {} }, Yi = { exports: {} }, Qi; -function wm() { - return Qi || (Qi = 1, function(e) { - const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", a = typeof process < "u" && process.platform === "win32", n = typeof process < "u" && process.platform === "linux", s = { +var sn = { exports: {} }, Xn = { exports: {} }, eo; +function ad() { + return eo || (eo = 1, function(e) { + const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", s = { ballotDisabled: "☒", ballotOff: "☐", ballotOn: "☑", @@ -9208,7 +9219,7 @@ function wm() { starsOff: "☆", starsOn: "★", upDownArrow: "↕" - }, c = Object.assign({}, s, { + }, l = Object.assign({}, s, { check: "√", cross: "×", ellipsisLarge: "...", @@ -9220,7 +9231,7 @@ function wm() { radioOff: "( )", radioOn: "(*)", warning: "‼" - }), p = Object.assign({}, s, { + }), d = Object.assign({}, s, { ballotCross: "✘", check: "✔", cross: "✖", @@ -9229,169 +9240,169 @@ function wm() { info: "ℹ", questionFull: "?", questionSmall: "﹖", - pointer: n ? "▸" : "❯", - pointerSmall: n ? "‣" : "›", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", radioOff: "◯", radioOn: "◉", warning: "⚠" }); - e.exports = a && !t ? c : p, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: c }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: p }); - }(Yi)), Yi.exports; + e.exports = r && !t ? l : d, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: d }); + }(Xn)), Xn.exports; } -const vm = (e) => e !== null && typeof e == "object" && !Array.isArray(e), $m = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, km = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, Nl = () => { +const nd = (e) => e !== null && typeof e == "object" && !Array.isArray(e), od = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, sd = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, ts = () => { const e = { - enabled: km(), + enabled: sd(), visible: !0, styles: {}, keys: {} - }, t = (c) => { - let p = c.open = `\x1B[${c.codes[0]}m`, b = c.close = `\x1B[${c.codes[1]}m`, _ = c.regex = new RegExp(`\\u001b\\[${c.codes[1]}m`, "g"); - return c.wrap = (y, g) => { - y.includes(b) && (y = y.replace(_, b + p)); - let S = p + y + b; - return g ? S.replace(/\r*\n/g, `${b}$&${p}`) : S; - }, c; - }, a = (c, p, b) => typeof c == "function" ? c(p) : c.wrap(p, b), n = (c, p) => { - if (c === "" || c == null) + }, t = (l) => { + let d = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, _ = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g"); + return l.wrap = (y, m) => { + y.includes(b) && (y = y.replace(_, b + d)); + let k = d + y + b; + return m ? k.replace(/\r*\n/g, `${b}$&${d}`) : k; + }, l; + }, r = (l, d, b) => typeof l == "function" ? l(d) : l.wrap(d, b), a = (l, d) => { + if (l === "" || l == null) return ""; if (e.enabled === !1) - return c; + return l; if (e.visible === !1) return ""; - let b = "" + c, _ = b.includes(` -`), y = p.length; - for (y > 0 && p.includes("unstyle") && (p = [.../* @__PURE__ */ new Set(["unstyle", ...p])].reverse()); y-- > 0; ) - b = a(e.styles[p[y]], b, _); + let b = "" + l, _ = b.includes(` +`), y = d.length; + for (y > 0 && d.includes("unstyle") && (d = [.../* @__PURE__ */ new Set(["unstyle", ...d])].reverse()); y-- > 0; ) + b = r(e.styles[d[y]], b, _); return b; - }, s = (c, p, b) => { - e.styles[c] = t({ name: c, codes: p }), (e.keys[b] || (e.keys[b] = [])).push(c), Reflect.defineProperty(e, c, { + }, s = (l, d, b) => { + e.styles[l] = t({ name: l, codes: d }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, { configurable: !0, enumerable: !0, set(_) { - e.alias(c, _); + e.alias(l, _); }, get() { - let _ = (y) => n(y, _.stack); - return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(c) : [c], _; + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(l) : [l], _; } }); }; - return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = $m, e.hasColor = e.hasAnsi = (c) => (e.ansiRegex.lastIndex = 0, typeof c == "string" && c !== "" && e.ansiRegex.test(c)), e.alias = (c, p) => { - let b = typeof p == "string" ? e[p] : p; + return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = od, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, d) => { + let b = typeof d == "string" ? e[d] : d; if (typeof b != "function") throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); - b.stack || (Reflect.defineProperty(b, "name", { value: c }), e.styles[c] = b, b.stack = [c]), Reflect.defineProperty(e, c, { + b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, { configurable: !0, enumerable: !0, set(_) { - e.alias(c, _); + e.alias(l, _); }, get() { - let _ = (y) => n(y, _.stack); + let _ = (y) => a(y, _.stack); return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _; } }); - }, e.theme = (c) => { - if (!vm(c)) + }, e.theme = (l) => { + if (!nd(l)) throw new TypeError("Expected theme to be an object"); - for (let p of Object.keys(c)) - e.alias(p, c[p]); + for (let d of Object.keys(l)) + e.alias(d, l[d]); return e; - }, e.alias("unstyle", (c) => typeof c == "string" && c !== "" ? (e.ansiRegex.lastIndex = 0, c.replace(e.ansiRegex, "")) : ""), e.alias("noop", (c) => c), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = wm(), e.define = s, e; + }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = ad(), e.define = s, e; }; -xs.exports = Nl(); -xs.exports.create = Nl; -var Em = xs.exports; -const Ct = /* @__PURE__ */ Ss(Em); -let jo, Ll, Rl, Il, Al = !0; -typeof process < "u" && ({ FORCE_COLOR: jo, NODE_DISABLE_COLORS: Ll, NO_COLOR: Rl, TERM: Il } = process.env || {}, Al = process.stdout && process.stdout.isTTY); -const me = { - enabled: !Ll && Rl == null && Il !== "dumb" && (jo != null && jo !== "0" || Al), +sn.exports = ts(); +sn.exports.create = ts; +var id = sn.exports; +const He = /* @__PURE__ */ on(id); +let ga, rs, as, ns, os = !0; +typeof process < "u" && ({ FORCE_COLOR: ga, NODE_DISABLE_COLORS: rs, NO_COLOR: as, TERM: ns } = process.env || {}, os = process.stdout && process.stdout.isTTY); +const ae = { + enabled: !rs && as == null && ns !== "dumb" && (ga != null && ga !== "0" || os), // modifiers - reset: Oe(0, 0), - bold: Oe(1, 22), - dim: Oe(2, 22), - italic: Oe(3, 23), - underline: Oe(4, 24), - inverse: Oe(7, 27), - hidden: Oe(8, 28), - strikethrough: Oe(9, 29), + reset: ge(0, 0), + bold: ge(1, 22), + dim: ge(2, 22), + italic: ge(3, 23), + underline: ge(4, 24), + inverse: ge(7, 27), + hidden: ge(8, 28), + strikethrough: ge(9, 29), // colors - black: Oe(30, 39), - red: Oe(31, 39), - green: Oe(32, 39), - yellow: Oe(33, 39), - blue: Oe(34, 39), - magenta: Oe(35, 39), - cyan: Oe(36, 39), - white: Oe(37, 39), - gray: Oe(90, 39), - grey: Oe(90, 39), + black: ge(30, 39), + red: ge(31, 39), + green: ge(32, 39), + yellow: ge(33, 39), + blue: ge(34, 39), + magenta: ge(35, 39), + cyan: ge(36, 39), + white: ge(37, 39), + gray: ge(90, 39), + grey: ge(90, 39), // background colors - bgBlack: Oe(40, 49), - bgRed: Oe(41, 49), - bgGreen: Oe(42, 49), - bgYellow: Oe(43, 49), - bgBlue: Oe(44, 49), - bgMagenta: Oe(45, 49), - bgCyan: Oe(46, 49), - bgWhite: Oe(47, 49) + bgBlack: ge(40, 49), + bgRed: ge(41, 49), + bgGreen: ge(42, 49), + bgYellow: ge(43, 49), + bgBlue: ge(44, 49), + bgMagenta: ge(45, 49), + bgCyan: ge(46, 49), + bgWhite: ge(47, 49) }; -function Xi(e, t) { - let a = 0, n, s = "", c = ""; - for (; a < e.length; a++) - n = e[a], s += n.open, c += n.close, ~t.indexOf(n.close) && (t = t.replace(n.rgx, n.close + n.open)); - return s + t + c; -} -function Pm(e, t) { - let a = { has: e, keys: t }; - return a.reset = me.reset.bind(a), a.bold = me.bold.bind(a), a.dim = me.dim.bind(a), a.italic = me.italic.bind(a), a.underline = me.underline.bind(a), a.inverse = me.inverse.bind(a), a.hidden = me.hidden.bind(a), a.strikethrough = me.strikethrough.bind(a), a.black = me.black.bind(a), a.red = me.red.bind(a), a.green = me.green.bind(a), a.yellow = me.yellow.bind(a), a.blue = me.blue.bind(a), a.magenta = me.magenta.bind(a), a.cyan = me.cyan.bind(a), a.white = me.white.bind(a), a.gray = me.gray.bind(a), a.grey = me.grey.bind(a), a.bgBlack = me.bgBlack.bind(a), a.bgRed = me.bgRed.bind(a), a.bgGreen = me.bgGreen.bind(a), a.bgYellow = me.bgYellow.bind(a), a.bgBlue = me.bgBlue.bind(a), a.bgMagenta = me.bgMagenta.bind(a), a.bgCyan = me.bgCyan.bind(a), a.bgWhite = me.bgWhite.bind(a), a; -} -function Oe(e, t) { - let a = { +function to(e, t) { + let r = 0, a, s = "", l = ""; + for (; r < e.length; r++) + a = e[r], s += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open)); + return s + t + l; +} +function ld(e, t) { + let r = { has: e, keys: t }; + return r.reset = ae.reset.bind(r), r.bold = ae.bold.bind(r), r.dim = ae.dim.bind(r), r.italic = ae.italic.bind(r), r.underline = ae.underline.bind(r), r.inverse = ae.inverse.bind(r), r.hidden = ae.hidden.bind(r), r.strikethrough = ae.strikethrough.bind(r), r.black = ae.black.bind(r), r.red = ae.red.bind(r), r.green = ae.green.bind(r), r.yellow = ae.yellow.bind(r), r.blue = ae.blue.bind(r), r.magenta = ae.magenta.bind(r), r.cyan = ae.cyan.bind(r), r.white = ae.white.bind(r), r.gray = ae.gray.bind(r), r.grey = ae.grey.bind(r), r.bgBlack = ae.bgBlack.bind(r), r.bgRed = ae.bgRed.bind(r), r.bgGreen = ae.bgGreen.bind(r), r.bgYellow = ae.bgYellow.bind(r), r.bgBlue = ae.bgBlue.bind(r), r.bgMagenta = ae.bgMagenta.bind(r), r.bgCyan = ae.bgCyan.bind(r), r.bgWhite = ae.bgWhite.bind(r), r; +} +function ge(e, t) { + let r = { open: `\x1B[${e}m`, close: `\x1B[${t}m`, rgx: new RegExp(`\\x1b\\[${t}m`, "g") }; - return function(n) { - return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(a)), n === void 0 ? this : me.enabled ? Xi(this.keys, n + "") : n + "") : n === void 0 ? Pm([e], [a]) : me.enabled ? Xi([a], n + "") : n + ""; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(r)), a === void 0 ? this : ae.enabled ? to(this.keys, a + "") : a + "") : a === void 0 ? ld([e], [r]) : ae.enabled ? to([r], a + "") : a + ""; }; } -var Sm = Object.defineProperty, xm = (e, t, a) => t in e ? Sm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Je = (e, t, a) => (xm(e, typeof t != "symbol" ? t + "" : t, a), a); -const Jt = class { +var cd = Object.defineProperty, ud = (e, t, r) => t in e ? cd(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Se = (e, t, r) => (ud(e, typeof t != "symbol" ? t + "" : t, r), r); +const Xe = class { /** * 检测是否运行在Chrome插件中 */ static isInChromeExtension() { - return Jt.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + return Xe.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; } }; -let Pe = Jt; -Je(Pe, "isNode", typeof process < "u"), /** +let he = Xe; +Se(he, "isNode", typeof process < "u"), /** * 是否在浏览器环境 */ -Je(Pe, "isInBrowser", typeof window < "u"), /** +Se(he, "isInBrowser", typeof window < "u"), /** * 浏览器路径分隔符 */ -Je(Pe, "BrowserSeperator", "/"), /** +Se(he, "BrowserSeperator", "/"), /** * 是否是Electron环境 */ -Je(Pe, "isElectron", () => !Jt.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +Se(he, "isElectron", () => !Xe.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** * 是否有Node环境,目前包括 Electron 和 Node */ -Je(Pe, "hasNodeEnv", () => Jt.isElectron() || Jt.isNode), /** +Se(he, "hasNodeEnv", () => Xe.isElectron() || Xe.isNode), /** * 获取url参数 * * @param sParam - 参数 */ -Je(Pe, "getQueryString", (e) => { - if (!Jt.isInBrowser) +Se(he, "getQueryString", (e) => { + if (!Xe.isInBrowser) return ""; const t = window.location.search.substring(1).split("&"); - for (let a = 0; a < t.length; a++) { - const n = t[a].split("="); - if (n[0] === e) - return n[1]; + for (let r = 0; r < t.length; r++) { + const a = t[r].split("="); + if (a[0] === e) + return a[1]; } return ""; }), /** @@ -9411,15 +9422,15 @@ Je(Pe, "getQueryString", (e) => { * @param paramName - 参数名 * @param paramValue - 参数值 */ -Je(Pe, "replaceUrlParam", (e, t, a) => { - a == null && (a = ""); - const n = new RegExp("\\b(" + t + "=).*?(&|#|$)"); - if (e.search(n) >= 0) - return e.replace(n, "$1" + a + "$2"); - const [s, c] = e.split("#"), [p, b] = s.split("?"), _ = new URLSearchParams(b); - _.set(t, a); - const y = _.toString(), g = p + (y ? "?" + y : ""); - return c ? g + "#" + c : g; +Se(he, "replaceUrlParam", (e, t, r) => { + r == null && (r = ""); + const a = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + r + "$2"); + const [s, l] = e.split("#"), [d, b] = s.split("?"), _ = new URLSearchParams(b); + _.set(t, r); + const y = _.toString(), m = d + (y ? "?" + y : ""); + return l ? m + "#" + l : m; }), /** * 设置url参数 * @@ -9427,32 +9438,32 @@ Je(Pe, "replaceUrlParam", (e, t, a) => { * @param key - key * @param value - value */ -Je(Pe, "setUrlParameter", (e, t, a) => { +Se(he, "setUrlParameter", (e, t, r) => { if (e.includes(t)) - return Jt.replaceUrlParam(e, t, a); - const n = e.split("#"); - let s = n[0]; - const c = n[1]; - return s.includes("?") ? s += `&${t}=${a}` : s += `?${t}=${a}`, c && (s += "#" + c), s; + return Xe.replaceUrlParam(e, t, r); + const a = e.split("#"); + let s = a[0]; + const l = a[1]; + return s.includes("?") ? s += `&${t}=${r}` : s += `?${t}=${r}`, l && (s += "#" + l), s; }), /** * 重新加载指定tab * * @param tabname - tabname * @param t - 延迟时间 */ -Je(Pe, "reloadTabPage", (e, t = 200) => { +Se(he, "reloadTabPage", (e, t = 200) => { setTimeout(function() { - if (Jt.isInBrowser) { - const a = window.location.href; - window.location.href = Jt.setUrlParameter(a, "tab", e); + if (Xe.isInBrowser) { + const r = window.location.href; + window.location.href = Xe.setUrlParameter(r, "tab", e); } }, t); }), /** * 刷新当前tab页面 */ -Je(Pe, "reloadPage", () => { +Se(he, "reloadPage", () => { setTimeout(function() { - Jt.isInBrowser && window.location.reload(); + Xe.isInBrowser && window.location.reload(); }, 200); }), /** * 刷新当前tab页面 @@ -9460,18 +9471,18 @@ Je(Pe, "reloadPage", () => { * @param msg - 消息提示 * @param cb - 回调 */ -Je(Pe, "reloadPageWithMessageCallback", (e, t) => { +Se(he, "reloadPageWithMessageCallback", (e, t) => { t && t(e), setTimeout(function() { - Jt.isInBrowser && window.location.reload(); + Xe.isInBrowser && window.location.reload(); }, 200); }); -var ht = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(ht || {}); -const gt = class { +var Le = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(Le || {}); +const Me = class { /** * 检测是否运行在思源打开的浏览器中 */ static isInSiyuanBrowser() { - return Pe.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + return he.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; } /** * 思源笔记 window 对象 @@ -9493,28 +9504,28 @@ const gt = class { * @param type - 类型 */ static async importJs(e, t) { - let a = e; + let r = e; switch (t) { - case ht.BasePathType_Appearance: - a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + case Le.BasePathType_Appearance: + r = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); break; - case ht.BasePathType_Data: - a = this.browserJoinPath(this.siyuanDataRelativePath(), e); + case Le.BasePathType_Data: + r = this.browserJoinPath(this.siyuanDataRelativePath(), e); break; - case ht.BasePathType_Themes: - a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + case Le.BasePathType_Themes: + r = this.browserJoinPath(this.siyuanThemeRelativePath(), e); break; - case ht.BasePathType_ZhiTheme: - a = this.browserJoinPath(this.zhiThemeRelativePath(), e); + case Le.BasePathType_ZhiTheme: + r = this.browserJoinPath(this.zhiThemeRelativePath(), e); break; default: throw new Error("type must be provided"); } - const { default: n } = await import( + const { default: a } = await import( /* @vite-ignore */ - a + r ); - return n; + return a; } /** * 引入json @@ -9582,7 +9593,7 @@ const gt = class { * @param jsPath - 相对于 zhi 主题根路径的相对路径 */ static async importZhiThemeJs(e) { - return await this.importJs(e, ht.BasePathType_ZhiTheme); + return await this.importJs(e, Le.BasePathType_ZhiTheme); } // ========================= // import start @@ -9593,7 +9604,7 @@ const gt = class { * @param paths - 路径数组 */ static joinPath(...e) { - if (Pe.hasNodeEnv()) { + if (he.hasNodeEnv()) { const t = this.requireLib("path"); if (t) return t.join(...e); @@ -9601,7 +9612,7 @@ const gt = class { return this.browserJoinPath(...e); } static browserJoinPath(...e) { - return e.join(Pe.BrowserSeperator); + return e.join(he.BrowserSeperator); } /** * 思源笔记 conf 目录 @@ -9653,7 +9664,7 @@ const gt = class { * @since 0.1.0 */ static siyuanThemePath() { - if (Pe.hasNodeEnv()) + if (he.hasNodeEnv()) return this.joinPath(this.siyuanAppearancePath(), "themes"); { const e = this.siyuanWindow(); @@ -9683,8 +9694,8 @@ const gt = class { return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); } }; -let Lr = gt; -Je(Lr, "isInSiyuanWidget", () => Pe.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +let Tt = Me; +Se(Tt, "isInSiyuanWidget", () => he.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** * 思源笔记新窗口 * * @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 @@ -9692,7 +9703,7 @@ Je(Lr, "isInSiyuanWidget", () => Pe.isInBrowser ? window.frameElement != null && * @version 0.1.0 * @since 0.0.1 */ -Je(Lr, "isInSiyuanNewWin", () => !Pe.isInBrowser || !Pe.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +Se(Tt, "isInSiyuanNewWin", () => !he.isInBrowser || !he.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= // require start // ========================= /** @@ -9702,114 +9713,114 @@ Je(Lr, "isInSiyuanNewWin", () => !Pe.isInBrowser || !Pe.isElectron() ? !1 : type * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 * @param type - 可选,以谁的基本路径为准 */ -Je(Lr, "requireLib", (e, t = !0, a = ht.BasePathType_None) => { - if (!Pe.hasNodeEnv()) +Se(Tt, "requireLib", (e, t = !0, r = Le.BasePathType_None) => { + if (!he.hasNodeEnv()) throw new Error("require ony works on node env"); - let n = e; + let a = e; if (!t) - switch (a) { - case ht.BasePathType_Appearance: - n = gt.joinPath(gt.siyuanAppearancePath(), e); + switch (r) { + case Le.BasePathType_Appearance: + a = Me.joinPath(Me.siyuanAppearancePath(), e); break; - case ht.BasePathType_Data: - n = gt.joinPath(gt.siyuanDataPath(), e); + case Le.BasePathType_Data: + a = Me.joinPath(Me.siyuanDataPath(), e); break; - case ht.BasePathType_Themes: - n = gt.joinPath(gt.siyuanAppearancePath(), "themes", e); + case Le.BasePathType_Themes: + a = Me.joinPath(Me.siyuanAppearancePath(), "themes", e); break; - case ht.BasePathType_ZhiTheme: - n = gt.joinPath(gt.siyuanAppearancePath(), "themes", "zhi", e); + case Le.BasePathType_ZhiTheme: + a = Me.joinPath(Me.siyuanAppearancePath(), "themes", "zhi", e); break; default: throw new Error("type must be provided when not use absolute path"); } - const s = gt.siyuanWindow(); + const s = Me.siyuanWindow(); if (!s) - return require(n); + return require(a); if (typeof s.require < "u") - return s.require(n); + return s.require(a); }), /** * 引入依赖,以 data 的基本路径为准 * * @param libpath - 相对于 appearance 的相对路径 */ -Je(Lr, "requireAppearanceLib", (e) => gt.requireLib(e, !1, ht.BasePathType_Appearance)), /** +Se(Tt, "requireAppearanceLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Appearance)), /** * 引入依赖,以 data 的基本路径为准 * * @param libpath - 相对于 data 的相对路径 */ -Je(Lr, "requireDataLib", (e) => gt.requireLib(e, !1, ht.BasePathType_Data)), /** +Se(Tt, "requireDataLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Data)), /** * 引入依赖,以 theme 的基本路径为准 * * @param libpath - 相对于 theme 的相对路径 */ -Je(Lr, "requireThemesLib", (e) => gt.requireLib(e, !1, ht.BasePathType_Themes)), /** +Se(Tt, "requireThemesLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Themes)), /** * 引入依赖,以 ZhiTheme 的基本路径为准 * * @param libpath - 相对于 ZhiTheme 的相对路径 */ -Je(Lr, "requireZhiThemeLib", (e) => gt.requireLib(e, !1, ht.BasePathType_ZhiTheme)); -const Ot = { - white: (e) => Pe.isElectron() ? Ct.whiteBright(e) : me.white(e), - gray: (e) => Pe.isElectron() ? Ct.gray(e) : me.gray(e), - blue: (e) => Pe.isElectron() ? Ct.blue(e) : me.blue(e), - green: (e) => Pe.isElectron() ? Ct.green(e) : me.green(e), - yellow: (e) => Pe.isElectron() ? Ct.yellow(e) : me.yellow(e), - red: (e) => Pe.isElectron() ? Ct.red(e) : me.red(e), - bgWhite: (e) => Pe.isElectron() ? Ct.bgWhiteBright(e) : me.bgWhite(e), - bgGrey: (e) => Pe.isElectron() ? Ct.bgCyanBright(e) : me.bgCyan(e), - bgBlue: (e) => Pe.isElectron() ? Ct.bgBlueBright(e) : me.bgBlue(e), - bgGreen: (e) => Pe.isElectron() ? Ct.bgGreenBright(e) : me.bgGreen(e), - bgYellow: (e) => Pe.isElectron() ? Ct.bgYellowBright(e) : me.bgYellow(e), - bgRed: (e) => Pe.isElectron() ? Ct.bgRedBright(e) : me.bgRed(e) +Se(Tt, "requireZhiThemeLib", (e) => Me.requireLib(e, !1, Le.BasePathType_ZhiTheme)); +const Ke = { + white: (e) => he.isElectron() ? He.whiteBright(e) : ae.white(e), + gray: (e) => he.isElectron() ? He.gray(e) : ae.gray(e), + blue: (e) => he.isElectron() ? He.blue(e) : ae.blue(e), + green: (e) => he.isElectron() ? He.green(e) : ae.green(e), + yellow: (e) => he.isElectron() ? He.yellow(e) : ae.yellow(e), + red: (e) => he.isElectron() ? He.red(e) : ae.red(e), + bgWhite: (e) => he.isElectron() ? He.bgWhiteBright(e) : ae.bgWhite(e), + bgGrey: (e) => he.isElectron() ? He.bgCyanBright(e) : ae.bgCyan(e), + bgBlue: (e) => he.isElectron() ? He.bgBlueBright(e) : ae.bgBlue(e), + bgGreen: (e) => he.isElectron() ? He.bgGreenBright(e) : ae.bgGreen(e), + bgYellow: (e) => he.isElectron() ? He.bgYellowBright(e) : ae.bgYellow(e), + bgRed: (e) => he.isElectron() ? He.bgRedBright(e) : ae.bgRed(e) }; -let Tm = class { - constructor(t, a, n) { - aa(this, "consoleLogger", "console"), aa(this, "stackSize", 1), aa(this, "getLogger", (p) => { +class dd { + constructor(t, r, a) { + Gt(this, "consoleLogger", "console"), Gt(this, "stackSize", 1), Gt(this, "getLogger", (d) => { let b; - if (p) - b = p; + if (d) + b = d; else { - const _ = this.getCallStack(), y = [], g = []; - for (let S = 0; S < _.length; S++) { - const L = _[S], A = L.getFileName() ?? "none"; - if (S > this.stackSize - 1) + const _ = this.getCallStack(), y = [], m = []; + for (let k = 0; k < _.length; k++) { + const N = _[k], A = N.getFileName() ?? "none"; + if (k > this.stackSize - 1) break; - const N = A + "-" + L.getLineNumber() + ":" + L.getColumnNumber(); - y.push(N); + const j = A + "-" + N.getLineNumber() + ":" + N.getColumnNumber(); + y.push(j); } - g.length > 0 && (b = y.join(" -> ")); + m.length > 0 && (b = y.join(" -> ")); } - return (!b || b.trim().length === 0) && (b = this.consoleLogger), un.getLogger(b); + return (!b || b.trim().length === 0) && (b = this.consoleLogger), Lr.getLogger(b); }), this.stackSize = 1; let s; - t ? s = t : s = Ha.getEnvLevel(n), s = s ?? Yt.LOG_LEVEL_INFO, un.setLevel(s); - const c = (p, b, _, y) => { - const g = [], S = a ?? Ha.getEnvLogger(n) ?? "zhi"; - return g.push(Ot.gray("[") + y(S) + Ot.gray("]")), g.push(Ot.gray("[") + Ot.gray(_.toString()) + Ot.gray("]")), g.push(y(p.toUpperCase().toString())), g.push(y(b)), g.push(Ot.gray(":")), g; + t ? s = t : s = mr.getEnvLevel(a), s = s ?? et.LOG_LEVEL_INFO, Lr.setLevel(s); + const l = (d, b, _, y) => { + const m = [], k = r ?? mr.getEnvLogger(a) ?? "zhi"; + return m.push(Ke.gray("[") + y(k) + Ke.gray("]")), m.push(Ke.gray("[") + Ke.gray(_.toString()) + Ke.gray("]")), m.push(y(d.toUpperCase().toString())), m.push(y(b)), m.push(Ke.gray(":")), m; }; - Zi.reg(un), Zi.apply(un, { - format(p, b, _) { + Qn.reg(Lr), Qn.apply(Lr, { + format(d, b, _) { let y = []; - const g = b ?? ""; - switch (p) { - case Yt.LOG_LEVEL_TRACE: - y = c(p, g, _, Ot.gray); + const m = b ?? ""; + switch (d) { + case et.LOG_LEVEL_TRACE: + y = l(d, m, _, Ke.gray); break; - case Yt.LOG_LEVEL_DEBUG: - y = c(p, g, _, Ot.blue); + case et.LOG_LEVEL_DEBUG: + y = l(d, m, _, Ke.blue); break; - case Yt.LOG_LEVEL_INFO: - y = c(p, g, _, Ot.green); + case et.LOG_LEVEL_INFO: + y = l(d, m, _, Ke.green); break; - case Yt.LOG_LEVEL_WARN: - y = c(p, g, _, Ot.yellow); + case et.LOG_LEVEL_WARN: + y = l(d, m, _, Ke.yellow); break; - case Yt.LOG_LEVEL_ERROR: - y = c(p, g, _, Ot.red); + case et.LOG_LEVEL_ERROR: + y = l(d, m, _, Ke.red); break; default: - y = c(Yt.LOG_LEVEL_INFO, g, _, Ot.green); + y = l(et.LOG_LEVEL_INFO, m, _, Ke.green); break; } return y.join(" "); @@ -9833,13 +9844,14 @@ let Tm = class { getCallStack() { let t; try { - t = _m(); + t = rd(); } catch { t = []; } return t; } -}, jm = class { +} +class hd { /** * 默认日志级别 * @@ -9847,8 +9859,8 @@ let Tm = class { * @param sign - 可选前缀,默认zhi * @param env - 可选环境变量实例 */ - constructor(t, a, n) { - aa(this, "logger"), this.logger = new Tm(t, a, n); + constructor(t, r, a) { + Gt(this, "logger"), this.logger = new dd(t, r, a); } /** * 获取日志记录器 @@ -9857,13 +9869,13 @@ let Tm = class { * @param stackSize - 打印栈的深度 * @protected */ - getLogger(t, a) { - return this.logger.setStackSize(a), this.logger.getLogger(t); + getLogger(t, r) { + return this.logger.setStackSize(r), this.logger.getLogger(t); } -}; -class ec extends jm { - constructor(t, a, n) { - super(t, a, n); +} +class ro extends hd { + constructor(t, r, a) { + super(t, r, a); } /** * 获取默认的日志记录器 @@ -9871,19 +9883,19 @@ class ec extends jm { * @param loggerName - 日志记录器名称 * @param stackSize - 打印栈的深度 */ - getLogger(t, a) { - return super.getLogger(t, a); + getLogger(t, r) { + return super.getLogger(t, r); } } -let tc = class Ml { +class Wr { /** * 默认日志记录器 * * @param stackSize - 栈的深度 * @param env - 环境变量实例 */ - static defaultLogger(t, a) { - return Ml.customLogFactory(void 0, void 0, t).getLogger(void 0, a); + static defaultLogger(t, r) { + return Wr.customLogFactory(void 0, void 0, t).getLogger(void 0, r); } /** * 自定义日志工厂 @@ -9892,8 +9904,8 @@ let tc = class Ml { * @param sign - 标志 * @param env - 环境变量 */ - static customLogFactory(t, a, n) { - return new ec(t, a, n); + static customLogFactory(t, r, a) { + return new ro(t, r, a); } /** * 自定义日志工厂,自定义前缀 @@ -9901,8982 +9913,49 @@ let tc = class Ml { * @param sign - 标志 * @param env - 环境变量 */ - static customSignLogFactory(t, a) { - return new ec(void 0, t, a); + static customSignLogFactory(t, r) { + return new ro(void 0, t, r); } -}; -var Cm = Object.defineProperty, Om = (e, t, a) => t in e ? Cm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Qe = (e, t, a) => (Om(e, typeof t != "symbol" ? t + "" : t, a), a), Dl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function zl(e) { - return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } -var Co = { exports: {} }, Bl = {}, tr = {}, ca = {}, Qa = {}, ve = {}, Ga = {}; -(function(e) { - 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; - class t { - } - e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; - class a extends t { - constructor(j) { - if (super(), !e.IDENTIFIER.test(j)) - throw new Error("CodeGen: name must be a valid identifier"); - this.str = j; - } - toString() { - return this.str; - } - emptyStr() { - return !1; - } - get names() { - return { [this.str]: 1 }; - } - } - e.Name = a; - class n extends t { - constructor(j) { - super(), this._items = typeof j == "string" ? [j] : j; - } - toString() { - return this.str; - } - emptyStr() { - if (this._items.length > 1) - return !1; - const j = this._items[0]; - return j === "" || j === '""'; - } - get str() { - var j; - return (j = this._str) !== null && j !== void 0 ? j : this._str = this._items.reduce((I, r) => `${I}${r}`, ""); - } - get names() { - var j; - return (j = this._names) !== null && j !== void 0 ? j : this._names = this._items.reduce((I, r) => (r instanceof a && (I[r.str] = (I[r.str] || 0) + 1), I), {}); - } +class Jr { +} +/** + * 思源 API 伺服地址 + */ +$e(Jr, "VITE_SIYUAN_API_URL_KEY", "VITE_SIYUAN_API_URL"), /** + * 思源 token + */ +$e(Jr, "VITE_SIYUAN_AUTH_TOKEN_KEY", "VITE_SIYUAN_AUTH_TOKEN"); +class gr { + /** + * 通用环境变量 + * + * @param appInstance - 插件实例 + */ + static zhiEnv(t) { + return this.env || (this.env = new t.zhiEnv.Env({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; } - e._Code = n, e.nil = new n(""); - function s(v, ...j) { - const I = [v[0]]; - let r = 0; - for (; r < j.length; ) - b(I, j[r]), I.push(v[++r]); - return new n(I); + /** + * 通用日志 + * + * @param appInstance - 应用实例 + * @param loggerName - 日志名称 + */ + static zhiLog(t, r) { + const a = this.zhiEnv(t); + return t.zhiCommon.ZhiUtil.initEnv(a), t.zhiCommon.ZhiUtil.zhiLogWithSign("publisher", r); } - e._ = s; - const c = new n("+"); - function p(v, ...j) { - const I = [A(v[0])]; - let r = 0; - for (; r < j.length; ) - I.push(c), b(I, j[r]), I.push(c, A(v[++r])); - return _(I), new n(I); - } - e.str = p; - function b(v, j) { - j instanceof n ? v.push(...j._items) : j instanceof a ? v.push(j) : v.push(S(j)); - } - e.addCodeArg = b; - function _(v) { - let j = 1; - for (; j < v.length - 1; ) { - if (v[j] === c) { - const I = y(v[j - 1], v[j + 1]); - if (I !== void 0) { - v.splice(j - 1, 3, I); - continue; - } - v[j++] = "+"; - } - j++; - } - } - function y(v, j) { - if (j === '""') - return v; - if (v === '""') - return j; - if (typeof v == "string") - return j instanceof a || v[v.length - 1] !== '"' ? void 0 : typeof j != "string" ? `${v.slice(0, -1)}${j}"` : j[0] === '"' ? v.slice(0, -1) + j.slice(1) : void 0; - if (typeof j == "string" && j[0] === '"' && !(v instanceof a)) - return `"${v}${j.slice(1)}`; - } - function g(v, j) { - return j.emptyStr() ? v : v.emptyStr() ? j : p`${v}${j}`; - } - e.strConcat = g; - function S(v) { - return typeof v == "number" || typeof v == "boolean" || v === null ? v : A(Array.isArray(v) ? v.join(",") : v); - } - function L(v) { - return new n(A(v)); - } - e.stringify = L; - function A(v) { - return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); - } - e.safeStringify = A; - function N(v) { - return typeof v == "string" && e.IDENTIFIER.test(v) ? new n(`.${v}`) : s`[${v}]`; - } - e.getProperty = N; - function C(v) { - if (typeof v == "string" && e.IDENTIFIER.test(v)) - return new n(`${v}`); - throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`); - } - e.getEsmExportName = C; - function T(v) { - return new n(v.toString()); - } - e.regexpCode = T; -})(Ga); -var Oo = {}; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0; - const t = Ga; - class a extends Error { - constructor(y) { - super(`CodeGen: "code" for ${y} not defined`), this.value = y.value; - } - } - var n; - (function(_) { - _[_.Started = 0] = "Started", _[_.Completed = 1] = "Completed"; - })(n = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { - const: new t.Name("const"), - let: new t.Name("let"), - var: new t.Name("var") - }; - class s { - constructor({ prefixes: y, parent: g } = {}) { - this._names = {}, this._prefixes = y, this._parent = g; - } - toName(y) { - return y instanceof t.Name ? y : this.name(y); - } - name(y) { - return new t.Name(this._newName(y)); - } - _newName(y) { - const g = this._names[y] || this._nameGroup(y); - return `${y}${g.index++}`; - } - _nameGroup(y) { - var g, S; - if (!((S = (g = this._parent) === null || g === void 0 ? void 0 : g._prefixes) === null || S === void 0) && S.has(y) || this._prefixes && !this._prefixes.has(y)) - throw new Error(`CodeGen: prefix "${y}" is not allowed in this scope`); - return this._names[y] = { prefix: y, index: 0 }; - } - } - e.Scope = s; - class c extends t.Name { - constructor(y, g) { - super(g), this.prefix = y; - } - setValue(y, { property: g, itemIndex: S }) { - this.value = y, this.scopePath = (0, t._)`.${new t.Name(g)}[${S}]`; - } - } - e.ValueScopeName = c; - const p = (0, t._)`\n`; - class b extends s { - constructor(y) { - super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? p : t.nil }; - } - get() { - return this._scope; - } - name(y) { - return new c(y, this._newName(y)); - } - value(y, g) { - var S; - if (g.ref === void 0) - throw new Error("CodeGen: ref must be passed in value"); - const L = this.toName(y), { prefix: A } = L, N = (S = g.key) !== null && S !== void 0 ? S : g.ref; - let C = this._values[A]; - if (C) { - const j = C.get(N); - if (j) - return j; - } else - C = this._values[A] = /* @__PURE__ */ new Map(); - C.set(N, L); - const T = this._scope[A] || (this._scope[A] = []), v = T.length; - return T[v] = g.ref, L.setValue(g, { property: A, itemIndex: v }), L; - } - getValue(y, g) { - const S = this._values[y]; - if (S) - return S.get(g); - } - scopeRefs(y, g = this._values) { - return this._reduceValues(g, (S) => { - if (S.scopePath === void 0) - throw new Error(`CodeGen: name "${S}" has no value`); - return (0, t._)`${y}${S.scopePath}`; - }); - } - scopeCode(y = this._values, g, S) { - return this._reduceValues(y, (L) => { - if (L.value === void 0) - throw new Error(`CodeGen: name "${L}" has no value`); - return L.value.code; - }, g, S); - } - _reduceValues(y, g, S = {}, L) { - let A = t.nil; - for (const N in y) { - const C = y[N]; - if (!C) - continue; - const T = S[N] = S[N] || /* @__PURE__ */ new Map(); - C.forEach((v) => { - if (T.has(v)) - return; - T.set(v, n.Started); - let j = g(v); - if (j) { - const I = this.opts.es5 ? e.varKinds.var : e.varKinds.const; - A = (0, t._)`${A}${I} ${v} = ${j};${this.opts._n}`; - } else if (j = L == null ? void 0 : L(v)) - A = (0, t._)`${A}${j}${this.opts._n}`; - else - throw new a(v); - T.set(v, n.Completed); - }); - } - return A; - } - } - e.ValueScope = b; -})(Oo); -(function(e) { - 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; - const t = Ga, a = Oo; - var n = Ga; - Object.defineProperty(e, "_", { enumerable: !0, get: function() { - return n._; - } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { - return n.str; - } }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() { - return n.strConcat; - } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { - return n.nil; - } }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() { - return n.getProperty; - } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { - return n.stringify; - } }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() { - return n.regexpCode; - } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { - return n.Name; - } }); - var s = Oo; - Object.defineProperty(e, "Scope", { enumerable: !0, get: function() { - return s.Scope; - } }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() { - return s.ValueScope; - } }), Object.defineProperty(e, "ValueScopeName", { enumerable: !0, get: function() { - return s.ValueScopeName; - } }), Object.defineProperty(e, "varKinds", { enumerable: !0, get: function() { - return s.varKinds; - } }), e.operators = { - GT: new t._Code(">"), - GTE: new t._Code(">="), - LT: new t._Code("<"), - LTE: new t._Code("<="), - EQ: new t._Code("==="), - NEQ: new t._Code("!=="), - NOT: new t._Code("!"), - OR: new t._Code("||"), - AND: new t._Code("&&"), - ADD: new t._Code("+") - }; - class c { - optimizeNodes() { - return this; - } - optimizeNames(d, k) { - return this; - } - } - class p extends c { - constructor(d, k, R) { - super(), this.varKind = d, this.name = k, this.rhs = R; - } - render({ es5: d, _n: k }) { - const R = d ? a.varKinds.var : this.varKind, G = this.rhs === void 0 ? "" : ` = ${this.rhs}`; - return `${R} ${this.name}${G};` + k; - } - optimizeNames(d, k) { - if (d[this.name.str]) - return this.rhs && (this.rhs = z(this.rhs, d, k)), this; - } - get names() { - return this.rhs instanceof t._CodeOrName ? this.rhs.names : {}; - } - } - class b extends c { - constructor(d, k, R) { - super(), this.lhs = d, this.rhs = k, this.sideEffects = R; - } - render({ _n: d }) { - return `${this.lhs} = ${this.rhs};` + d; - } - optimizeNames(d, k) { - if (!(this.lhs instanceof t.Name && !d[this.lhs.str] && !this.sideEffects)) - return this.rhs = z(this.rhs, d, k), this; - } - get names() { - const d = this.lhs instanceof t.Name ? {} : { ...this.lhs.names }; - return U(d, this.rhs); - } - } - class _ extends b { - constructor(d, k, R, G) { - super(d, R, G), this.op = k; - } - render({ _n: d }) { - return `${this.lhs} ${this.op}= ${this.rhs};` + d; - } - } - class y extends c { - constructor(d) { - super(), this.label = d, this.names = {}; - } - render({ _n: d }) { - return `${this.label}:` + d; - } - } - class g extends c { - constructor(d) { - super(), this.label = d, this.names = {}; - } - render({ _n: d }) { - return `break${this.label ? ` ${this.label}` : ""};` + d; - } - } - class S extends c { - constructor(d) { - super(), this.error = d; - } - render({ _n: d }) { - return `throw ${this.error};` + d; - } - get names() { - return this.error.names; - } - } - class L extends c { - constructor(d) { - super(), this.code = d; - } - render({ _n: d }) { - return `${this.code};` + d; - } - optimizeNodes() { - return `${this.code}` ? this : void 0; - } - optimizeNames(d, k) { - return this.code = z(this.code, d, k), this; - } - get names() { - return this.code instanceof t._CodeOrName ? this.code.names : {}; - } - } - class A extends c { - constructor(d = []) { - super(), this.nodes = d; - } - render(d) { - return this.nodes.reduce((k, R) => k + R.render(d), ""); - } - optimizeNodes() { - const { nodes: d } = this; - let k = d.length; - for (; k--; ) { - const R = d[k].optimizeNodes(); - Array.isArray(R) ? d.splice(k, 1, ...R) : R ? d[k] = R : d.splice(k, 1); - } - return d.length > 0 ? this : void 0; - } - optimizeNames(d, k) { - const { nodes: R } = this; - let G = R.length; - for (; G--; ) { - const K = R[G]; - K.optimizeNames(d, k) || (H(d, K.names), R.splice(G, 1)); - } - return R.length > 0 ? this : void 0; - } - get names() { - return this.nodes.reduce((d, k) => B(d, k.names), {}); - } - } - class N extends A { - render(d) { - return "{" + d._n + super.render(d) + "}" + d._n; - } - } - class C extends A { - } - class T extends N { - } - T.kind = "else"; - class v extends N { - constructor(d, k) { - super(k), this.condition = d; - } - render(d) { - let k = `if(${this.condition})` + super.render(d); - return this.else && (k += "else " + this.else.render(d)), k; - } - optimizeNodes() { - super.optimizeNodes(); - const d = this.condition; - if (d === !0) - return this.nodes; - let k = this.else; - if (k) { - const R = k.optimizeNodes(); - k = this.else = Array.isArray(R) ? new T(R) : R; - } - if (k) - return d === !1 ? k instanceof v ? k : k.nodes : this.nodes.length ? this : new v(w(d), k instanceof v ? [k] : k.nodes); - if (!(d === !1 || !this.nodes.length)) - return this; - } - optimizeNames(d, k) { - var R; - if (this.else = (R = this.else) === null || R === void 0 ? void 0 : R.optimizeNames(d, k), !!(super.optimizeNames(d, k) || this.else)) - return this.condition = z(this.condition, d, k), this; - } - get names() { - const d = super.names; - return U(d, this.condition), this.else && B(d, this.else.names), d; - } - } - v.kind = "if"; - class j extends N { - } - j.kind = "for"; - class I extends j { - constructor(d) { - super(), this.iteration = d; - } - render(d) { - return `for(${this.iteration})` + super.render(d); - } - optimizeNames(d, k) { - if (super.optimizeNames(d, k)) - return this.iteration = z(this.iteration, d, k), this; - } - get names() { - return B(super.names, this.iteration.names); - } - } - class r extends j { - constructor(d, k, R, G) { - super(), this.varKind = d, this.name = k, this.from = R, this.to = G; - } - render(d) { - const k = d.es5 ? a.varKinds.var : this.varKind, { name: R, from: G, to: K } = this; - return `for(${k} ${R}=${G}; ${R}<${K}; ${R}++)` + super.render(d); - } - get names() { - const d = U(super.names, this.from); - return U(d, this.to); - } - } - class i extends j { - constructor(d, k, R, G) { - super(), this.loop = d, this.varKind = k, this.name = R, this.iterable = G; - } - render(d) { - return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(d); - } - optimizeNames(d, k) { - if (super.optimizeNames(d, k)) - return this.iterable = z(this.iterable, d, k), this; - } - get names() { - return B(super.names, this.iterable.names); - } - } - class o extends N { - constructor(d, k, R) { - super(), this.name = d, this.args = k, this.async = R; - } - render(d) { - return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(d); - } - } - o.kind = "func"; - class l extends A { - render(d) { - return "return " + super.render(d); - } - } - l.kind = "return"; - class u extends N { - render(d) { - let k = "try" + super.render(d); - return this.catch && (k += this.catch.render(d)), this.finally && (k += this.finally.render(d)), k; - } - optimizeNodes() { - var d, k; - return super.optimizeNodes(), (d = this.catch) === null || d === void 0 || d.optimizeNodes(), (k = this.finally) === null || k === void 0 || k.optimizeNodes(), this; - } - optimizeNames(d, k) { - var R, G; - return super.optimizeNames(d, k), (R = this.catch) === null || R === void 0 || R.optimizeNames(d, k), (G = this.finally) === null || G === void 0 || G.optimizeNames(d, k), this; - } - get names() { - const d = super.names; - return this.catch && B(d, this.catch.names), this.finally && B(d, this.finally.names), d; - } - } - class m extends N { - constructor(d) { - super(), this.error = d; - } - render(d) { - return `catch(${this.error})` + super.render(d); - } - } - m.kind = "catch"; - class f extends N { - render(d) { - return "finally" + super.render(d); - } - } - f.kind = "finally"; - class x { - constructor(d, k = {}) { - this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...k, _n: k.lines ? ` -` : "" }, this._extScope = d, this._scope = new a.Scope({ parent: d }), this._nodes = [new C()]; - } - toString() { - return this._root.render(this.opts); - } - // returns unique name in the internal scope - name(d) { - return this._scope.name(d); - } - // reserves unique name in the external scope - scopeName(d) { - return this._extScope.name(d); - } - // reserves unique name in the external scope and assigns value to it - scopeValue(d, k) { - const R = this._extScope.value(d, k); - return (this._values[R.prefix] || (this._values[R.prefix] = /* @__PURE__ */ new Set())).add(R), R; - } - getScopeValue(d, k) { - return this._extScope.getValue(d, k); - } - // 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(d) { - return this._extScope.scopeRefs(d, this._values); - } - scopeCode() { - return this._extScope.scopeCode(this._values); - } - _def(d, k, R, G) { - const K = this._scope.toName(k); - return R !== void 0 && G && (this._constants[K.str] = R), this._leafNode(new p(d, K, R)), K; - } - // `const` declaration (`var` in es5 mode) - const(d, k, R) { - return this._def(a.varKinds.const, d, k, R); - } - // `let` declaration with optional assignment (`var` in es5 mode) - let(d, k, R) { - return this._def(a.varKinds.let, d, k, R); - } - // `var` declaration with optional assignment - var(d, k, R) { - return this._def(a.varKinds.var, d, k, R); - } - // assignment code - assign(d, k, R) { - return this._leafNode(new b(d, k, R)); - } - // `+=` code - add(d, k) { - return this._leafNode(new _(d, e.operators.ADD, k)); - } - // appends passed SafeExpr to code or executes Block - code(d) { - return typeof d == "function" ? d() : d !== t.nil && this._leafNode(new L(d)), this; - } - // returns code for object literal for the passed argument list of key-value pairs - object(...d) { - const k = ["{"]; - for (const [R, G] of d) - k.length > 1 && k.push(","), k.push(R), (R !== G || this.opts.es5) && (k.push(":"), (0, t.addCodeArg)(k, G)); - return k.push("}"), new t._Code(k); - } - // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) - if(d, k, R) { - if (this._blockNode(new v(d)), k && R) - this.code(k).else().code(R).endIf(); - else if (k) - this.code(k).endIf(); - else if (R) - throw new Error('CodeGen: "else" body without "then" body'); - return this; - } - // `else if` clause - invalid without `if` or after `else` clauses - elseIf(d) { - return this._elseNode(new v(d)); - } - // `else` clause - only valid after `if` or `else if` clauses - else() { - return this._elseNode(new T()); - } - // end `if` statement (needed if gen.if was used only with condition) - endIf() { - return this._endBlockNode(v, T); - } - _for(d, k) { - return this._blockNode(d), k && this.code(k).endFor(), this; - } - // a generic `for` clause (or statement if `forBody` is passed) - for(d, k) { - return this._for(new I(d), k); - } - // `for` statement for a range of values - forRange(d, k, R, G, K = this.opts.es5 ? a.varKinds.var : a.varKinds.let) { - const X = this._scope.toName(d); - return this._for(new r(K, X, k, R), () => G(X)); - } - // `for-of` statement (in es5 mode replace with a normal for loop) - forOf(d, k, R, G = a.varKinds.const) { - const K = this._scope.toName(d); - if (this.opts.es5) { - const X = k instanceof t.Name ? k : this.var("_arr", k); - return this.forRange("_i", 0, (0, t._)`${X}.length`, (ee) => { - this.var(K, (0, t._)`${X}[${ee}]`), R(K); - }); - } - return this._for(new i("of", G, K, k), () => R(K)); - } - // `for-in` statement. - // With option `ownProperties` replaced with a `for-of` loop for object keys - forIn(d, k, R, G = this.opts.es5 ? a.varKinds.var : a.varKinds.const) { - if (this.opts.ownProperties) - return this.forOf(d, (0, t._)`Object.keys(${k})`, R); - const K = this._scope.toName(d); - return this._for(new i("in", G, K, k), () => R(K)); - } - // end `for` loop - endFor() { - return this._endBlockNode(j); - } - // `label` statement - label(d) { - return this._leafNode(new y(d)); - } - // `break` statement - break(d) { - return this._leafNode(new g(d)); - } - // `return` statement - return(d) { - const k = new l(); - if (this._blockNode(k), this.code(d), k.nodes.length !== 1) - throw new Error('CodeGen: "return" should have one node'); - return this._endBlockNode(l); - } - // `try` statement - try(d, k, R) { - if (!k && !R) - throw new Error('CodeGen: "try" without "catch" and "finally"'); - const G = new u(); - if (this._blockNode(G), this.code(d), k) { - const K = this.name("e"); - this._currNode = G.catch = new m(K), k(K); - } - return R && (this._currNode = G.finally = new f(), this.code(R)), this._endBlockNode(m, f); - } - // `throw` statement - throw(d) { - return this._leafNode(new S(d)); - } - // start self-balancing block - block(d, k) { - return this._blockStarts.push(this._nodes.length), d && this.code(d).endBlock(k), this; - } - // end the current self-balancing block - endBlock(d) { - const k = this._blockStarts.pop(); - if (k === void 0) - throw new Error("CodeGen: not in self-balancing block"); - const R = this._nodes.length - k; - if (R < 0 || d !== void 0 && R !== d) - throw new Error(`CodeGen: wrong number of nodes: ${R} vs ${d} expected`); - return this._nodes.length = k, this; - } - // `function` heading (or definition if funcBody is passed) - func(d, k = t.nil, R, G) { - return this._blockNode(new o(d, k, R)), G && this.code(G).endFunc(), this; - } - // end function definition - endFunc() { - return this._endBlockNode(o); - } - optimize(d = 1) { - for (; d-- > 0; ) - this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); - } - _leafNode(d) { - return this._currNode.nodes.push(d), this; - } - _blockNode(d) { - this._currNode.nodes.push(d), this._nodes.push(d); - } - _endBlockNode(d, k) { - const R = this._currNode; - if (R instanceof d || k && R instanceof k) - return this._nodes.pop(), this; - throw new Error(`CodeGen: not in block "${k ? `${d.kind}/${k.kind}` : d.kind}"`); - } - _elseNode(d) { - const k = this._currNode; - if (!(k instanceof v)) - throw new Error('CodeGen: "else" without "if"'); - return this._currNode = k.else = d, this; - } - get _root() { - return this._nodes[0]; - } - get _currNode() { - const d = this._nodes; - return d[d.length - 1]; - } - set _currNode(d) { - const k = this._nodes; - k[k.length - 1] = d; - } - } - e.CodeGen = x; - function B(O, d) { - for (const k in d) - O[k] = (O[k] || 0) + (d[k] || 0); - return O; - } - function U(O, d) { - return d instanceof t._CodeOrName ? B(O, d.names) : O; - } - function z(O, d, k) { - if (O instanceof t.Name) - return R(O); - if (!G(O)) - return O; - return new t._Code(O._items.reduce((K, X) => (X instanceof t.Name && (X = R(X)), X instanceof t._Code ? K.push(...X._items) : K.push(X), K), [])); - function R(K) { - const X = k[K.str]; - return X === void 0 || d[K.str] !== 1 ? K : (delete d[K.str], X); - } - function G(K) { - return K instanceof t._Code && K._items.some((X) => X instanceof t.Name && d[X.str] === 1 && k[X.str] !== void 0); - } - } - function H(O, d) { - for (const k in d) - O[k] = (O[k] || 0) - (d[k] || 0); - } - function w(O) { - return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${F(O)}`; - } - e.not = w; - const q = E(e.operators.AND); - function W(...O) { - return O.reduce(q); - } - e.and = W; - const J = E(e.operators.OR); - function V(...O) { - return O.reduce(J); - } - e.or = V; - function E(O) { - return (d, k) => d === t.nil ? k : k === t.nil ? d : (0, t._)`${F(d)} ${O} ${F(k)}`; - } - function F(O) { - return O instanceof t.Name ? O : (0, t._)`(${O})`; - } -})(ve); -var ke = {}; -(function(e) { - 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; - const t = ve, a = Ga; - function n(o) { - const l = {}; - for (const u of o) - l[u] = !0; - return l; - } - e.toHash = n; - function s(o, l) { - return typeof l == "boolean" ? l : Object.keys(l).length === 0 ? !0 : (c(o, l), !p(l, o.self.RULES.all)); - } - e.alwaysValidSchema = s; - function c(o, l = o.schema) { - const { opts: u, self: m } = o; - if (!u.strictSchema || typeof l == "boolean") - return; - const f = m.RULES.keywords; - for (const x in l) - f[x] || i(o, `unknown keyword: "${x}"`); - } - e.checkUnknownRules = c; - function p(o, l) { - if (typeof o == "boolean") - return !o; - for (const u in o) - if (l[u]) - return !0; - return !1; - } - e.schemaHasRules = p; - function b(o, l) { - if (typeof o == "boolean") - return !o; - for (const u in o) - if (u !== "$ref" && l.all[u]) - return !0; - return !1; - } - e.schemaHasRulesButRef = b; - function _({ topSchemaRef: o, schemaPath: l }, u, m, f) { - if (!f) { - if (typeof u == "number" || typeof u == "boolean") - return u; - if (typeof u == "string") - return (0, t._)`${u}`; - } - return (0, t._)`${o}${l}${(0, t.getProperty)(m)}`; - } - e.schemaRefOrVal = _; - function y(o) { - return L(decodeURIComponent(o)); - } - e.unescapeFragment = y; - function g(o) { - return encodeURIComponent(S(o)); - } - e.escapeFragment = g; - function S(o) { - return typeof o == "number" ? `${o}` : o.replace(/~/g, "~0").replace(/\//g, "~1"); - } - e.escapeJsonPointer = S; - function L(o) { - return o.replace(/~1/g, "/").replace(/~0/g, "~"); - } - e.unescapeJsonPointer = L; - function A(o, l) { - if (Array.isArray(o)) - for (const u of o) - l(u); - else - l(o); - } - e.eachItem = A; - function N({ mergeNames: o, mergeToName: l, mergeValues: u, resultToName: m }) { - return (f, x, B, U) => { - const z = B === void 0 ? x : B instanceof t.Name ? (x instanceof t.Name ? o(f, x, B) : l(f, x, B), B) : x instanceof t.Name ? (l(f, B, x), x) : u(x, B); - return U === t.Name && !(z instanceof t.Name) ? m(f, z) : z; - }; - } - e.mergeEvaluated = { - props: N({ - mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => { - o.if((0, t._)`${l} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${l})`)); - }), - mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => { - l === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), T(o, u, l)); - }), - mergeValues: (o, l) => o === !0 ? !0 : { ...o, ...l }, - resultToName: C - }), - items: N({ - mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => o.assign(u, (0, t._)`${l} === true ? true : ${u} > ${l} ? ${u} : ${l}`)), - mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, l === !0 ? !0 : (0, t._)`${u} > ${l} ? ${u} : ${l}`)), - mergeValues: (o, l) => o === !0 ? !0 : Math.max(o, l), - resultToName: (o, l) => o.var("items", l) - }) - }; - function C(o, l) { - if (l === !0) - return o.var("props", !0); - const u = o.var("props", (0, t._)`{}`); - return l !== void 0 && T(o, u, l), u; - } - e.evaluatedPropsToName = C; - function T(o, l, u) { - Object.keys(u).forEach((m) => o.assign((0, t._)`${l}${(0, t.getProperty)(m)}`, !0)); - } - e.setEvaluated = T; - const v = {}; - function j(o, l) { - return o.scopeValue("func", { - ref: l, - code: v[l.code] || (v[l.code] = new a._Code(l.code)) - }); - } - e.useFunc = j; - var I; - (function(o) { - o[o.Num = 0] = "Num", o[o.Str = 1] = "Str"; - })(I = e.Type || (e.Type = {})); - function r(o, l, u) { - if (o instanceof t.Name) { - const m = l === I.Num; - return u ? m ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : m ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`; - } - return u ? (0, t.getProperty)(o).toString() : "/" + S(o); - } - e.getErrorPath = r; - function i(o, l, u = o.opts.strictSchema) { - if (u) { - if (l = `strict mode: ${l}`, u === !0) - throw new Error(l); - o.self.logger.warn(l); - } - } - e.checkStrictMode = i; -})(ke); -var lr = {}; -Object.defineProperty(lr, "__esModule", { value: !0 }); -const nt = ve, Nm = { - // validation function arguments - data: new nt.Name("data"), - // args passed from referencing schema - valCxt: new nt.Name("valCxt"), - instancePath: new nt.Name("instancePath"), - parentData: new nt.Name("parentData"), - parentDataProperty: new nt.Name("parentDataProperty"), - rootData: new nt.Name("rootData"), - dynamicAnchors: new nt.Name("dynamicAnchors"), - // function scoped variables - vErrors: new nt.Name("vErrors"), - errors: new nt.Name("errors"), - this: new nt.Name("this"), - // "globals" - self: new nt.Name("self"), - scope: new nt.Name("scope"), - // JTD serialize/parse name for JSON string and position - json: new nt.Name("json"), - jsonPos: new nt.Name("jsonPos"), - jsonLen: new nt.Name("jsonLen"), - jsonPart: new nt.Name("jsonPart") -}; -lr.default = Nm; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0; - const t = ve, a = ke, n = lr; - e.keywordError = { - message: ({ keyword: T }) => (0, t.str)`must pass "${T}" keyword validation` - }, e.keyword$DataError = { - message: ({ keyword: T, schemaType: v }) => v ? (0, t.str)`"${T}" keyword must be ${v} ($data)` : (0, t.str)`"${T}" keyword is invalid ($data)` - }; - function s(T, v = e.keywordError, j, I) { - const { it: r } = T, { gen: i, compositeRule: o, allErrors: l } = r, u = S(T, v, j); - I ?? (o || l) ? _(i, u) : y(r, (0, t._)`[${u}]`); - } - e.reportError = s; - function c(T, v = e.keywordError, j) { - const { it: I } = T, { gen: r, compositeRule: i, allErrors: o } = I, l = S(T, v, j); - _(r, l), i || o || y(I, n.default.vErrors); - } - e.reportExtraError = c; - function p(T, v) { - T.assign(n.default.errors, v), T.if((0, t._)`${n.default.vErrors} !== null`, () => T.if(v, () => T.assign((0, t._)`${n.default.vErrors}.length`, v), () => T.assign(n.default.vErrors, null))); - } - e.resetErrorsCount = p; - function b({ gen: T, keyword: v, schemaValue: j, data: I, errsCount: r, it: i }) { - if (r === void 0) - throw new Error("ajv implementation error"); - const o = T.name("err"); - T.forRange("i", r, n.default.errors, (l) => { - T.const(o, (0, t._)`${n.default.vErrors}[${l}]`), T.if((0, t._)`${o}.instancePath === undefined`, () => T.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(n.default.instancePath, i.errorPath))), T.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (T.assign((0, t._)`${o}.schema`, j), T.assign((0, t._)`${o}.data`, I)); - }); - } - e.extendErrors = b; - function _(T, v) { - const j = T.const("err", v); - T.if((0, t._)`${n.default.vErrors} === null`, () => T.assign(n.default.vErrors, (0, t._)`[${j}]`), (0, t._)`${n.default.vErrors}.push(${j})`), T.code((0, t._)`${n.default.errors}++`); - } - function y(T, v) { - const { gen: j, validateName: I, schemaEnv: r } = T; - r.$async ? j.throw((0, t._)`new ${T.ValidationError}(${v})`) : (j.assign((0, t._)`${I}.errors`, v), j.return(!1)); - } - const g = { - keyword: new t.Name("keyword"), - schemaPath: new t.Name("schemaPath"), - params: new t.Name("params"), - propertyName: new t.Name("propertyName"), - message: new t.Name("message"), - schema: new t.Name("schema"), - parentSchema: new t.Name("parentSchema") - }; - function S(T, v, j) { - const { createErrors: I } = T.it; - return I === !1 ? (0, t._)`{}` : L(T, v, j); - } - function L(T, v, j = {}) { - const { gen: I, it: r } = T, i = [ - A(r, j), - N(T, j) - ]; - return C(T, v, i), I.object(...i); - } - function A({ errorPath: T }, { instancePath: v }) { - const j = v ? (0, t.str)`${T}${(0, a.getErrorPath)(v, a.Type.Str)}` : T; - return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, j)]; - } - function N({ keyword: T, it: { errSchemaPath: v } }, { schemaPath: j, parentSchema: I }) { - let r = I ? v : (0, t.str)`${v}/${T}`; - return j && (r = (0, t.str)`${r}${(0, a.getErrorPath)(j, a.Type.Str)}`), [g.schemaPath, r]; - } - function C(T, { params: v, message: j }, I) { - const { keyword: r, data: i, schemaValue: o, it: l } = T, { opts: u, propertyName: m, topSchemaRef: f, schemaPath: x } = l; - I.push([g.keyword, r], [g.params, typeof v == "function" ? v(T) : v || (0, t._)`{}`]), u.messages && I.push([g.message, typeof j == "function" ? j(T) : j]), u.verbose && I.push([g.schema, o], [g.parentSchema, (0, t._)`${f}${x}`], [n.default.data, i]), m && I.push([g.propertyName, m]); - } -})(Qa); -Object.defineProperty(ca, "__esModule", { value: !0 }); -ca.boolOrEmptySchema = ca.topBoolOrEmptySchema = void 0; -const Lm = Qa, Rm = ve, Im = lr, Am = { - message: "boolean schema is false" -}; -function Mm(e) { - const { gen: t, schema: a, validateName: n } = e; - a === !1 ? Vl(e, !1) : typeof a == "object" && a.$async === !0 ? t.return(Im.default.data) : (t.assign((0, Rm._)`${n}.errors`, null), t.return(!0)); -} -ca.topBoolOrEmptySchema = Mm; -function Dm(e, t) { - const { gen: a, schema: n } = e; - n === !1 ? (a.var(t, !1), Vl(e)) : a.var(t, !0); -} -ca.boolOrEmptySchema = Dm; -function Vl(e, t) { - const { gen: a, data: n } = e, s = { - gen: a, - keyword: "false schema", - data: n, - schema: !1, - schemaCode: !1, - schemaValue: !1, - params: {}, - it: e - }; - (0, Lm.reportError)(s, Am, void 0, t); -} -var Xa = {}, qr = {}; -Object.defineProperty(qr, "__esModule", { value: !0 }); -qr.getRules = qr.isJSONType = void 0; -const zm = ["string", "number", "integer", "boolean", "null", "object", "array"], Bm = new Set(zm); -function Vm(e) { - return typeof e == "string" && Bm.has(e); -} -qr.isJSONType = Vm; -function Fm() { - const e = { - number: { type: "number", rules: [] }, - string: { type: "string", rules: [] }, - array: { type: "array", rules: [] }, - object: { type: "object", rules: [] } - }; - return { - types: { ...e, integer: !0, boolean: !0, null: !0 }, - rules: [{ rules: [] }, e.number, e.string, e.array, e.object], - post: { rules: [] }, - all: {}, - keywords: {} - }; -} -qr.getRules = Fm; -var yr = {}; -Object.defineProperty(yr, "__esModule", { value: !0 }); -yr.shouldUseRule = yr.shouldUseGroup = yr.schemaHasRulesForType = void 0; -function Um({ schema: e, self: t }, a) { - const n = t.RULES.types[a]; - return n && n !== !0 && Fl(e, n); -} -yr.schemaHasRulesForType = Um; -function Fl(e, t) { - return t.rules.some((a) => Ul(e, a)); -} -yr.shouldUseGroup = Fl; -function Ul(e, t) { - var a; - return e[t.keyword] !== void 0 || ((a = t.definition.implements) === null || a === void 0 ? void 0 : a.some((n) => e[n] !== void 0)); -} -yr.shouldUseRule = Ul; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0; - const t = qr, a = yr, n = Qa, s = ve, c = ke; - var p; - (function(I) { - I[I.Correct = 0] = "Correct", I[I.Wrong = 1] = "Wrong"; - })(p = e.DataType || (e.DataType = {})); - function b(I) { - const r = _(I.type); - if (r.includes("null")) { - if (I.nullable === !1) - throw new Error("type: null contradicts nullable: false"); - } else { - if (!r.length && I.nullable !== void 0) - throw new Error('"nullable" cannot be used without "type"'); - I.nullable === !0 && r.push("null"); - } - return r; - } - e.getSchemaTypes = b; - function _(I) { - const r = Array.isArray(I) ? I : I ? [I] : []; - if (r.every(t.isJSONType)) - return r; - throw new Error("type must be JSONType or JSONType[]: " + r.join(",")); - } - e.getJSONTypes = _; - function y(I, r) { - const { gen: i, data: o, opts: l } = I, u = S(r, l.coerceTypes), m = r.length > 0 && !(u.length === 0 && r.length === 1 && (0, a.schemaHasRulesForType)(I, r[0])); - if (m) { - const f = C(r, o, l.strictNumbers, p.Wrong); - i.if(f, () => { - u.length ? L(I, r, u) : v(I); - }); - } - return m; - } - e.coerceAndCheckDataType = y; - const g = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); - function S(I, r) { - return r ? I.filter((i) => g.has(i) || r === "array" && i === "array") : []; - } - function L(I, r, i) { - const { gen: o, data: l, opts: u } = I, m = o.let("dataType", (0, s._)`typeof ${l}`), f = o.let("coerced", (0, s._)`undefined`); - u.coerceTypes === "array" && o.if((0, s._)`${m} == 'object' && Array.isArray(${l}) && ${l}.length == 1`, () => o.assign(l, (0, s._)`${l}[0]`).assign(m, (0, s._)`typeof ${l}`).if(C(r, l, u.strictNumbers), () => o.assign(f, l))), o.if((0, s._)`${f} !== undefined`); - for (const B of i) - (g.has(B) || B === "array" && u.coerceTypes === "array") && x(B); - o.else(), v(I), o.endIf(), o.if((0, s._)`${f} !== undefined`, () => { - o.assign(l, f), A(I, f); - }); - function x(B) { - switch (B) { - case "string": - o.elseIf((0, s._)`${m} == "number" || ${m} == "boolean"`).assign(f, (0, s._)`"" + ${l}`).elseIf((0, s._)`${l} === null`).assign(f, (0, s._)`""`); - return; - case "number": - o.elseIf((0, s._)`${m} == "boolean" || ${l} === null - || (${m} == "string" && ${l} && ${l} == +${l})`).assign(f, (0, s._)`+${l}`); - return; - case "integer": - o.elseIf((0, s._)`${m} === "boolean" || ${l} === null - || (${m} === "string" && ${l} && ${l} == +${l} && !(${l} % 1))`).assign(f, (0, s._)`+${l}`); - return; - case "boolean": - o.elseIf((0, s._)`${l} === "false" || ${l} === 0 || ${l} === null`).assign(f, !1).elseIf((0, s._)`${l} === "true" || ${l} === 1`).assign(f, !0); - return; - case "null": - o.elseIf((0, s._)`${l} === "" || ${l} === 0 || ${l} === false`), o.assign(f, null); - return; - case "array": - o.elseIf((0, s._)`${m} === "string" || ${m} === "number" - || ${m} === "boolean" || ${l} === null`).assign(f, (0, s._)`[${l}]`); - } - } - } - function A({ gen: I, parentData: r, parentDataProperty: i }, o) { - I.if((0, s._)`${r} !== undefined`, () => I.assign((0, s._)`${r}[${i}]`, o)); - } - function N(I, r, i, o = p.Correct) { - const l = o === p.Correct ? s.operators.EQ : s.operators.NEQ; - let u; - switch (I) { - case "null": - return (0, s._)`${r} ${l} null`; - case "array": - u = (0, s._)`Array.isArray(${r})`; - break; - case "object": - u = (0, s._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`; - break; - case "integer": - u = m((0, s._)`!(${r} % 1) && !isNaN(${r})`); - break; - case "number": - u = m(); - break; - default: - return (0, s._)`typeof ${r} ${l} ${I}`; - } - return o === p.Correct ? u : (0, s.not)(u); - function m(f = s.nil) { - return (0, s.and)((0, s._)`typeof ${r} == "number"`, f, i ? (0, s._)`isFinite(${r})` : s.nil); - } - } - e.checkDataType = N; - function C(I, r, i, o) { - if (I.length === 1) - return N(I[0], r, i, o); - let l; - const u = (0, c.toHash)(I); - if (u.array && u.object) { - const m = (0, s._)`typeof ${r} != "object"`; - l = u.null ? m : (0, s._)`!${r} || ${m}`, delete u.null, delete u.array, delete u.object; - } else - l = s.nil; - u.number && delete u.integer; - for (const m in u) - l = (0, s.and)(l, N(m, r, i, o)); - return l; - } - e.checkDataTypes = C; - const T = { - message: ({ schema: I }) => `must be ${I}`, - params: ({ schema: I, schemaValue: r }) => typeof I == "string" ? (0, s._)`{type: ${I}}` : (0, s._)`{type: ${r}}` - }; - function v(I) { - const r = j(I); - (0, n.reportError)(r, T); - } - e.reportTypeError = v; - function j(I) { - const { gen: r, data: i, schema: o } = I, l = (0, c.schemaRefOrVal)(I, o, "type"); - return { - gen: r, - keyword: "type", - data: i, - schema: o.type, - schemaCode: l, - schemaValue: l, - parentSchema: o, - params: {}, - it: I - }; - } -})(Xa); -var Gn = {}; -Object.defineProperty(Gn, "__esModule", { value: !0 }); -Gn.assignDefaults = void 0; -const Wr = ve, qm = ke; -function Hm(e, t) { - const { properties: a, items: n } = e.schema; - if (t === "object" && a) - for (const s in a) - rc(e, s, a[s].default); - else - t === "array" && Array.isArray(n) && n.forEach((s, c) => rc(e, c, s.default)); -} -Gn.assignDefaults = Hm; -function rc(e, t, a) { - const { gen: n, compositeRule: s, data: c, opts: p } = e; - if (a === void 0) - return; - const b = (0, Wr._)`${c}${(0, Wr.getProperty)(t)}`; - if (s) { - (0, qm.checkStrictMode)(e, `default is ignored for: ${b}`); - return; - } - let _ = (0, Wr._)`${b} === undefined`; - p.useDefaults === "empty" && (_ = (0, Wr._)`${_} || ${b} === null || ${b} === ""`), n.if(_, (0, Wr._)`${b} = ${(0, Wr.stringify)(a)}`); -} -var ir = {}, _e = {}; -Object.defineProperty(_e, "__esModule", { value: !0 }); -_e.validateUnion = _e.validateArray = _e.usePattern = _e.callValidateCode = _e.schemaProperties = _e.allSchemaProperties = _e.noPropertyInData = _e.propertyInData = _e.isOwnProperty = _e.hasPropFunc = _e.reportMissingProp = _e.checkMissingProp = _e.checkReportMissingProp = void 0; -const Me = ve, Ts = ke, vr = lr, Gm = ke; -function Km(e, t) { - const { gen: a, data: n, it: s } = e; - a.if(Cs(a, n, t, s.opts.ownProperties), () => { - e.setParams({ missingProperty: (0, Me._)`${t}` }, !0), e.error(); - }); -} -_e.checkReportMissingProp = Km; -function Wm({ gen: e, data: t, it: { opts: a } }, n, s) { - return (0, Me.or)(...n.map((c) => (0, Me.and)(Cs(e, t, c, a.ownProperties), (0, Me._)`${s} = ${c}`))); -} -_e.checkMissingProp = Wm; -function Jm(e, t) { - e.setParams({ missingProperty: t }, !0), e.error(); -} -_e.reportMissingProp = Jm; -function ql(e) { - return e.scopeValue("func", { - // eslint-disable-next-line @typescript-eslint/unbound-method - ref: Object.prototype.hasOwnProperty, - code: (0, Me._)`Object.prototype.hasOwnProperty` - }); -} -_e.hasPropFunc = ql; -function js(e, t, a) { - return (0, Me._)`${ql(e)}.call(${t}, ${a})`; -} -_e.isOwnProperty = js; -function Zm(e, t, a, n) { - const s = (0, Me._)`${t}${(0, Me.getProperty)(a)} !== undefined`; - return n ? (0, Me._)`${s} && ${js(e, t, a)}` : s; -} -_e.propertyInData = Zm; -function Cs(e, t, a, n) { - const s = (0, Me._)`${t}${(0, Me.getProperty)(a)} === undefined`; - return n ? (0, Me.or)(s, (0, Me.not)(js(e, t, a))) : s; -} -_e.noPropertyInData = Cs; -function Hl(e) { - return e ? Object.keys(e).filter((t) => t !== "__proto__") : []; -} -_e.allSchemaProperties = Hl; -function Ym(e, t) { - return Hl(t).filter((a) => !(0, Ts.alwaysValidSchema)(e, t[a])); -} -_e.schemaProperties = Ym; -function Qm({ schemaCode: e, data: t, it: { gen: a, topSchemaRef: n, schemaPath: s, errorPath: c }, it: p }, b, _, y) { - const g = y ? (0, Me._)`${e}, ${t}, ${n}${s}` : t, S = [ - [vr.default.instancePath, (0, Me.strConcat)(vr.default.instancePath, c)], - [vr.default.parentData, p.parentData], - [vr.default.parentDataProperty, p.parentDataProperty], - [vr.default.rootData, vr.default.rootData] - ]; - p.opts.dynamicRef && S.push([vr.default.dynamicAnchors, vr.default.dynamicAnchors]); - const L = (0, Me._)`${g}, ${a.object(...S)}`; - return _ !== Me.nil ? (0, Me._)`${b}.call(${_}, ${L})` : (0, Me._)`${b}(${L})`; -} -_e.callValidateCode = Qm; -const Xm = (0, Me._)`new RegExp`; -function eg({ gen: e, it: { opts: t } }, a) { - const n = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, c = s(a, n); - return e.scopeValue("pattern", { - key: c.toString(), - ref: c, - code: (0, Me._)`${s.code === "new RegExp" ? Xm : (0, Gm.useFunc)(e, s)}(${a}, ${n})` - }); -} -_e.usePattern = eg; -function tg(e) { - const { gen: t, data: a, keyword: n, it: s } = e, c = t.name("valid"); - if (s.allErrors) { - const b = t.let("valid", !0); - return p(() => t.assign(b, !1)), b; - } - return t.var(c, !0), p(() => t.break()), c; - function p(b) { - const _ = t.const("len", (0, Me._)`${a}.length`); - t.forRange("i", 0, _, (y) => { - e.subschema({ - keyword: n, - dataProp: y, - dataPropType: Ts.Type.Num - }, c), t.if((0, Me.not)(c), b); - }); - } -} -_e.validateArray = tg; -function rg(e) { - const { gen: t, schema: a, keyword: n, it: s } = e; - if (!Array.isArray(a)) - throw new Error("ajv implementation error"); - if (a.some((b) => (0, Ts.alwaysValidSchema)(s, b)) && !s.opts.unevaluated) - return; - const c = t.let("valid", !1), p = t.name("_valid"); - t.block(() => a.forEach((b, _) => { - const y = e.subschema({ - keyword: n, - schemaProp: _, - compositeRule: !0 - }, p); - t.assign(c, (0, Me._)`${c} || ${p}`), e.mergeValidEvaluated(y, p) || t.if((0, Me.not)(c)); - })), e.result(c, () => e.reset(), () => e.error(!0)); -} -_e.validateUnion = rg; -Object.defineProperty(ir, "__esModule", { value: !0 }); -ir.validateKeywordUsage = ir.validSchemaType = ir.funcKeywordCode = ir.macroKeywordCode = void 0; -const pt = ve, zr = lr, ag = _e, ng = Qa; -function og(e, t) { - const { gen: a, keyword: n, schema: s, parentSchema: c, it: p } = e, b = t.macro.call(p.self, s, c, p), _ = Gl(a, n, b); - p.opts.validateSchema !== !1 && p.self.validateSchema(b, !0); - const y = a.name("valid"); - e.subschema({ - schema: b, - schemaPath: pt.nil, - errSchemaPath: `${p.errSchemaPath}/${n}`, - topSchemaRef: _, - compositeRule: !0 - }, y), e.pass(y, () => e.error(!0)); -} -ir.macroKeywordCode = og; -function sg(e, t) { - var a; - const { gen: n, keyword: s, schema: c, parentSchema: p, $data: b, it: _ } = e; - cg(_, t); - const y = !b && t.compile ? t.compile.call(_.self, c, p, _) : t.validate, g = Gl(n, s, y), S = n.let("valid"); - e.block$data(S, L), e.ok((a = t.valid) !== null && a !== void 0 ? a : S); - function L() { - if (t.errors === !1) - C(), t.modifying && ac(e), T(() => e.error()); - else { - const v = t.async ? A() : N(); - t.modifying && ac(e), T(() => ig(e, v)); - } - } - function A() { - const v = n.let("ruleErrs", null); - return n.try(() => C((0, pt._)`await `), (j) => n.assign(S, !1).if((0, pt._)`${j} instanceof ${_.ValidationError}`, () => n.assign(v, (0, pt._)`${j}.errors`), () => n.throw(j))), v; - } - function N() { - const v = (0, pt._)`${g}.errors`; - return n.assign(v, null), C(pt.nil), v; - } - function C(v = t.async ? (0, pt._)`await ` : pt.nil) { - const j = _.opts.passContext ? zr.default.this : zr.default.self, I = !("compile" in t && !b || t.schema === !1); - n.assign(S, (0, pt._)`${v}${(0, ag.callValidateCode)(e, g, j, I)}`, t.modifying); - } - function T(v) { - var j; - n.if((0, pt.not)((j = t.valid) !== null && j !== void 0 ? j : S), v); - } -} -ir.funcKeywordCode = sg; -function ac(e) { - const { gen: t, data: a, it: n } = e; - t.if(n.parentData, () => t.assign(a, (0, pt._)`${n.parentData}[${n.parentDataProperty}]`)); -} -function ig(e, t) { - const { gen: a } = e; - a.if((0, pt._)`Array.isArray(${t})`, () => { - a.assign(zr.default.vErrors, (0, pt._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors, (0, pt._)`${zr.default.vErrors}.length`), (0, ng.extendErrors)(e); - }, () => e.error()); -} -function cg({ schemaEnv: e }, t) { - if (t.async && !e.$async) - throw new Error("async keyword in sync schema"); -} -function Gl(e, t, a) { - if (a === void 0) - throw new Error(`keyword "${t}" failed to compile`); - return e.scopeValue("keyword", typeof a == "function" ? { ref: a } : { ref: a, code: (0, pt.stringify)(a) }); -} -function lg(e, t, a = !1) { - return !t.length || t.some((n) => n === "array" ? Array.isArray(e) : n === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == n || a && typeof e > "u"); -} -ir.validSchemaType = lg; -function ug({ schema: e, opts: t, self: a, errSchemaPath: n }, s, c) { - if (Array.isArray(s.keyword) ? !s.keyword.includes(c) : s.keyword !== c) - throw new Error("ajv implementation error"); - const p = s.dependencies; - if (p != null && p.some((b) => !Object.prototype.hasOwnProperty.call(e, b))) - throw new Error(`parent schema must have dependencies of ${c}: ${p.join(",")}`); - if (s.validateSchema && !s.validateSchema(e[c])) { - const b = `keyword "${c}" value is invalid at path "${n}": ` + a.errorsText(s.validateSchema.errors); - if (t.validateSchema === "log") - a.logger.error(b); - else - throw new Error(b); - } -} -ir.validateKeywordUsage = ug; -var jr = {}; -Object.defineProperty(jr, "__esModule", { value: !0 }); -jr.extendSubschemaMode = jr.extendSubschemaData = jr.getSubschema = void 0; -const or = ve, Kl = ke; -function dg(e, { keyword: t, schemaProp: a, schema: n, schemaPath: s, errSchemaPath: c, topSchemaRef: p }) { - if (t !== void 0 && n !== void 0) - throw new Error('both "keyword" and "schema" passed, only one allowed'); - if (t !== void 0) { - const b = e.schema[t]; - return a === void 0 ? { - schema: b, - schemaPath: (0, or._)`${e.schemaPath}${(0, or.getProperty)(t)}`, - errSchemaPath: `${e.errSchemaPath}/${t}` - } : { - schema: b[a], - schemaPath: (0, or._)`${e.schemaPath}${(0, or.getProperty)(t)}${(0, or.getProperty)(a)}`, - errSchemaPath: `${e.errSchemaPath}/${t}/${(0, Kl.escapeFragment)(a)}` - }; - } - if (n !== void 0) { - if (s === void 0 || c === void 0 || p === void 0) - throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); - return { - schema: n, - schemaPath: s, - topSchemaRef: p, - errSchemaPath: c - }; - } - throw new Error('either "keyword" or "schema" must be passed'); -} -jr.getSubschema = dg; -function hg(e, t, { dataProp: a, dataPropType: n, data: s, dataTypes: c, propertyName: p }) { - if (s !== void 0 && a !== void 0) - throw new Error('both "data" and "dataProp" passed, only one allowed'); - const { gen: b } = t; - if (a !== void 0) { - const { errorPath: y, dataPathArr: g, opts: S } = t, L = b.let("data", (0, or._)`${t.data}${(0, or.getProperty)(a)}`, !0); - _(L), e.errorPath = (0, or.str)`${y}${(0, Kl.getErrorPath)(a, n, S.jsPropertySyntax)}`, e.parentDataProperty = (0, or._)`${a}`, e.dataPathArr = [...g, e.parentDataProperty]; - } - if (s !== void 0) { - const y = s instanceof or.Name ? s : b.let("data", s, !0); - _(y), p !== void 0 && (e.propertyName = p); - } - c && (e.dataTypes = c); - function _(y) { - e.data = y, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, y]; - } -} -jr.extendSubschemaData = hg; -function pg(e, { jtdDiscriminator: t, jtdMetadata: a, compositeRule: n, createErrors: s, allErrors: c }) { - n !== void 0 && (e.compositeRule = n), s !== void 0 && (e.createErrors = s), c !== void 0 && (e.allErrors = c), e.jtdDiscriminator = t, e.jtdMetadata = a; -} -jr.extendSubschemaMode = pg; -var rt = {}, Wl = function e(t, a) { - if (t === a) - return !0; - if (t && a && typeof t == "object" && typeof a == "object") { - if (t.constructor !== a.constructor) - return !1; - var n, s, c; - if (Array.isArray(t)) { - if (n = t.length, n != a.length) - return !1; - for (s = n; s-- !== 0; ) - if (!e(t[s], a[s])) - return !1; - return !0; - } - if (t.constructor === RegExp) - return t.source === a.source && t.flags === a.flags; - if (t.valueOf !== Object.prototype.valueOf) - return t.valueOf() === a.valueOf(); - if (t.toString !== Object.prototype.toString) - return t.toString() === a.toString(); - if (c = Object.keys(t), n = c.length, n !== Object.keys(a).length) - return !1; - for (s = n; s-- !== 0; ) - if (!Object.prototype.hasOwnProperty.call(a, c[s])) - return !1; - for (s = n; s-- !== 0; ) { - var p = c[s]; - if (!e(t[p], a[p])) - return !1; - } - return !0; - } - return t !== t && a !== a; -}, Jl = { exports: {} }, xr = Jl.exports = function(e, t, a) { - typeof t == "function" && (a = t, t = {}), a = t.cb || a; - var n = typeof a == "function" ? a : a.pre || function() { - }, s = a.post || function() { - }; - $n(t, n, s, e, "", e); -}; -xr.keywords = { - additionalItems: !0, - items: !0, - contains: !0, - additionalProperties: !0, - propertyNames: !0, - not: !0, - if: !0, - then: !0, - else: !0 -}; -xr.arrayKeywords = { - items: !0, - allOf: !0, - anyOf: !0, - oneOf: !0 -}; -xr.propsKeywords = { - $defs: !0, - definitions: !0, - properties: !0, - patternProperties: !0, - dependencies: !0 -}; -xr.skipKeywords = { - default: !0, - enum: !0, - const: !0, - required: !0, - maximum: !0, - minimum: !0, - exclusiveMaximum: !0, - exclusiveMinimum: !0, - multipleOf: !0, - maxLength: !0, - minLength: !0, - pattern: !0, - format: !0, - maxItems: !0, - minItems: !0, - uniqueItems: !0, - maxProperties: !0, - minProperties: !0 -}; -function $n(e, t, a, n, s, c, p, b, _, y) { - if (n && typeof n == "object" && !Array.isArray(n)) { - t(n, s, c, p, b, _, y); - for (var g in n) { - var S = n[g]; - if (Array.isArray(S)) { - if (g in xr.arrayKeywords) - for (var L = 0; L < S.length; L++) - $n(e, t, a, S[L], s + "/" + g + "/" + L, c, s, g, n, L); - } else if (g in xr.propsKeywords) { - if (S && typeof S == "object") - for (var A in S) - $n(e, t, a, S[A], s + "/" + g + "/" + fg(A), c, s, g, n, A); - } else - (g in xr.keywords || e.allKeys && !(g in xr.skipKeywords)) && $n(e, t, a, S, s + "/" + g, c, s, g, n); - } - a(n, s, c, p, b, _, y); - } -} -function fg(e) { - return e.replace(/~/g, "~0").replace(/\//g, "~1"); -} -var mg = Jl.exports; -Object.defineProperty(rt, "__esModule", { value: !0 }); -rt.getSchemaRefs = rt.resolveUrl = rt.normalizeId = rt._getFullPath = rt.getFullPath = rt.inlineRef = void 0; -const gg = ke, yg = Wl, bg = mg, _g = /* @__PURE__ */ new Set([ - "type", - "format", - "pattern", - "maxLength", - "minLength", - "maxProperties", - "minProperties", - "maxItems", - "minItems", - "maximum", - "minimum", - "uniqueItems", - "multipleOf", - "required", - "enum", - "const" -]); -function wg(e, t = !0) { - return typeof e == "boolean" ? !0 : t === !0 ? !No(e) : t ? Zl(e) <= t : !1; -} -rt.inlineRef = wg; -const vg = /* @__PURE__ */ new Set([ - "$ref", - "$recursiveRef", - "$recursiveAnchor", - "$dynamicRef", - "$dynamicAnchor" -]); -function No(e) { - for (const t in e) { - if (vg.has(t)) - return !0; - const a = e[t]; - if (Array.isArray(a) && a.some(No) || typeof a == "object" && No(a)) - return !0; - } - return !1; -} -function Zl(e) { - let t = 0; - for (const a in e) - if (a === "$ref" || (t++, !_g.has(a) && (typeof e[a] == "object" && (0, gg.eachItem)(e[a], (n) => t += Zl(n)), t === 1 / 0))) - return 1 / 0; - return t; -} -function Yl(e, t = "", a) { - a !== !1 && (t = na(t)); - const n = e.parse(t); - return Ql(e, n); -} -rt.getFullPath = Yl; -function Ql(e, t) { - return e.serialize(t).split("#")[0] + "#"; -} -rt._getFullPath = Ql; -const $g = /#\/?$/; -function na(e) { - return e ? e.replace($g, "") : ""; -} -rt.normalizeId = na; -function kg(e, t, a) { - return a = na(a), e.resolve(t, a); -} -rt.resolveUrl = kg; -const Eg = /^[a-z_][-a-z0-9._]*$/i; -function Pg(e, t) { - if (typeof e == "boolean") - return {}; - const { schemaId: a, uriResolver: n } = this.opts, s = na(e[a] || t), c = { "": s }, p = Yl(n, s, !1), b = {}, _ = /* @__PURE__ */ new Set(); - return bg(e, { allKeys: !0 }, (S, L, A, N) => { - if (N === void 0) - return; - const C = p + L; - let T = c[N]; - typeof S[a] == "string" && (T = v.call(this, S[a])), j.call(this, S.$anchor), j.call(this, S.$dynamicAnchor), c[L] = T; - function v(I) { - const r = this.opts.uriResolver.resolve; - if (I = na(T ? r(T, I) : I), _.has(I)) - throw g(I); - _.add(I); - let i = this.refs[I]; - return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(S, i.schema, I) : I !== na(C) && (I[0] === "#" ? (y(S, b[I], I), b[I] = S) : this.refs[I] = C), I; - } - function j(I) { - if (typeof I == "string") { - if (!Eg.test(I)) - throw new Error(`invalid anchor "${I}"`); - v.call(this, `#${I}`); - } - } - }), b; - function y(S, L, A) { - if (L !== void 0 && !yg(S, L)) - throw g(A); - } - function g(S) { - return new Error(`reference "${S}" resolves to more than one schema`); - } -} -rt.getSchemaRefs = Pg; -Object.defineProperty(tr, "__esModule", { value: !0 }); -tr.getData = tr.KeywordCxt = tr.validateFunctionCode = void 0; -const Xl = ca, nc = Xa, Os = yr, Rn = Xa, Sg = Gn, Da = ir, mo = jr, ne = ve, ue = lr, xg = rt, br = ke, ja = Qa; -function Tg(e) { - if (ru(e) && (au(e), tu(e))) { - Og(e); - return; - } - eu(e, () => (0, Xl.topBoolOrEmptySchema)(e)); -} -tr.validateFunctionCode = Tg; -function eu({ gen: e, validateName: t, schema: a, schemaEnv: n, opts: s }, c) { - s.code.es5 ? e.func(t, (0, ne._)`${ue.default.data}, ${ue.default.valCxt}`, n.$async, () => { - e.code((0, ne._)`"use strict"; ${oc(a, s)}`), Cg(e, s), e.code(c); - }) : e.func(t, (0, ne._)`${ue.default.data}, ${jg(s)}`, n.$async, () => e.code(oc(a, s)).code(c)); -} -function jg(e) { - return (0, ne._)`{${ue.default.instancePath}="", ${ue.default.parentData}, ${ue.default.parentDataProperty}, ${ue.default.rootData}=${ue.default.data}${e.dynamicRef ? (0, ne._)`, ${ue.default.dynamicAnchors}={}` : ne.nil}}={}`; -} -function Cg(e, t) { - e.if(ue.default.valCxt, () => { - e.var(ue.default.instancePath, (0, ne._)`${ue.default.valCxt}.${ue.default.instancePath}`), e.var(ue.default.parentData, (0, ne._)`${ue.default.valCxt}.${ue.default.parentData}`), e.var(ue.default.parentDataProperty, (0, ne._)`${ue.default.valCxt}.${ue.default.parentDataProperty}`), e.var(ue.default.rootData, (0, ne._)`${ue.default.valCxt}.${ue.default.rootData}`), t.dynamicRef && e.var(ue.default.dynamicAnchors, (0, ne._)`${ue.default.valCxt}.${ue.default.dynamicAnchors}`); - }, () => { - e.var(ue.default.instancePath, (0, ne._)`""`), e.var(ue.default.parentData, (0, ne._)`undefined`), e.var(ue.default.parentDataProperty, (0, ne._)`undefined`), e.var(ue.default.rootData, ue.default.data), t.dynamicRef && e.var(ue.default.dynamicAnchors, (0, ne._)`{}`); - }); -} -function Og(e) { - const { schema: t, opts: a, gen: n } = e; - eu(e, () => { - a.$comment && t.$comment && ou(e), Ag(e), n.let(ue.default.vErrors, null), n.let(ue.default.errors, 0), a.unevaluated && Ng(e), nu(e), zg(e); - }); -} -function Ng(e) { - const { gen: t, validateName: a } = e; - e.evaluated = t.const("evaluated", (0, ne._)`${a}.evaluated`), t.if((0, ne._)`${e.evaluated}.dynamicProps`, () => t.assign((0, ne._)`${e.evaluated}.props`, (0, ne._)`undefined`)), t.if((0, ne._)`${e.evaluated}.dynamicItems`, () => t.assign((0, ne._)`${e.evaluated}.items`, (0, ne._)`undefined`)); -} -function oc(e, t) { - const a = typeof e == "object" && e[t.schemaId]; - return a && (t.code.source || t.code.process) ? (0, ne._)`/*# sourceURL=${a} */` : ne.nil; -} -function Lg(e, t) { - if (ru(e) && (au(e), tu(e))) { - Rg(e, t); - return; - } - (0, Xl.boolOrEmptySchema)(e, t); -} -function tu({ schema: e, self: t }) { - if (typeof e == "boolean") - return !e; - for (const a in e) - if (t.RULES.all[a]) - return !0; - return !1; -} -function ru(e) { - return typeof e.schema != "boolean"; -} -function Rg(e, t) { - const { schema: a, gen: n, opts: s } = e; - s.$comment && a.$comment && ou(e), Mg(e), Dg(e); - const c = n.const("_errs", ue.default.errors); - nu(e, c), n.var(t, (0, ne._)`${c} === ${ue.default.errors}`); -} -function au(e) { - (0, br.checkUnknownRules)(e), Ig(e); -} -function nu(e, t) { - if (e.opts.jtd) - return sc(e, [], !1, t); - const a = (0, nc.getSchemaTypes)(e.schema), n = (0, nc.coerceAndCheckDataType)(e, a); - sc(e, a, !n, t); -} -function Ig(e) { - const { schema: t, errSchemaPath: a, opts: n, self: s } = e; - t.$ref && n.ignoreKeywordsWithRef && (0, br.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${a}"`); -} -function Ag(e) { - const { schema: t, opts: a } = e; - t.default !== void 0 && a.useDefaults && a.strictSchema && (0, br.checkStrictMode)(e, "default is ignored in the schema root"); -} -function Mg(e) { - const t = e.schema[e.opts.schemaId]; - t && (e.baseId = (0, xg.resolveUrl)(e.opts.uriResolver, e.baseId, t)); -} -function Dg(e) { - if (e.schema.$async && !e.schemaEnv.$async) - throw new Error("async schema in sync schema"); -} -function ou({ gen: e, schemaEnv: t, schema: a, errSchemaPath: n, opts: s }) { - const c = a.$comment; - if (s.$comment === !0) - e.code((0, ne._)`${ue.default.self}.logger.log(${c})`); - else if (typeof s.$comment == "function") { - const p = (0, ne.str)`${n}/$comment`, b = e.scopeValue("root", { ref: t.root }); - e.code((0, ne._)`${ue.default.self}.opts.$comment(${c}, ${p}, ${b}.schema)`); - } -} -function zg(e) { - const { gen: t, schemaEnv: a, validateName: n, ValidationError: s, opts: c } = e; - a.$async ? t.if((0, ne._)`${ue.default.errors} === 0`, () => t.return(ue.default.data), () => t.throw((0, ne._)`new ${s}(${ue.default.vErrors})`)) : (t.assign((0, ne._)`${n}.errors`, ue.default.vErrors), c.unevaluated && Bg(e), t.return((0, ne._)`${ue.default.errors} === 0`)); -} -function Bg({ gen: e, evaluated: t, props: a, items: n }) { - a instanceof ne.Name && e.assign((0, ne._)`${t}.props`, a), n instanceof ne.Name && e.assign((0, ne._)`${t}.items`, n); -} -function sc(e, t, a, n) { - const { gen: s, schema: c, data: p, allErrors: b, opts: _, self: y } = e, { RULES: g } = y; - if (c.$ref && (_.ignoreKeywordsWithRef || !(0, br.schemaHasRulesButRef)(c, g))) { - s.block(() => cu(e, "$ref", g.all.$ref.definition)); - return; - } - _.jtd || Vg(e, t), s.block(() => { - for (const L of g.rules) - S(L); - S(g.post); - }); - function S(L) { - (0, Os.shouldUseGroup)(c, L) && (L.type ? (s.if((0, Rn.checkDataType)(L.type, p, _.strictNumbers)), ic(e, L), t.length === 1 && t[0] === L.type && a && (s.else(), (0, Rn.reportTypeError)(e)), s.endIf()) : ic(e, L), b || s.if((0, ne._)`${ue.default.errors} === ${n || 0}`)); - } -} -function ic(e, t) { - const { gen: a, schema: n, opts: { useDefaults: s } } = e; - s && (0, Sg.assignDefaults)(e, t.type), a.block(() => { - for (const c of t.rules) - (0, Os.shouldUseRule)(n, c) && cu(e, c.keyword, c.definition, t.type); - }); -} -function Vg(e, t) { - e.schemaEnv.meta || !e.opts.strictTypes || (Fg(e, t), e.opts.allowUnionTypes || Ug(e, t), qg(e, e.dataTypes)); -} -function Fg(e, t) { - if (t.length) { - if (!e.dataTypes.length) { - e.dataTypes = t; - return; - } - t.forEach((a) => { - su(e.dataTypes, a) || Ns(e, `type "${a}" not allowed by context "${e.dataTypes.join(",")}"`); - }), Gg(e, t); - } -} -function Ug(e, t) { - t.length > 1 && !(t.length === 2 && t.includes("null")) && Ns(e, "use allowUnionTypes to allow union type keyword"); -} -function qg(e, t) { - const a = e.self.RULES.all; - for (const n in a) { - const s = a[n]; - if (typeof s == "object" && (0, Os.shouldUseRule)(e.schema, s)) { - const { type: c } = s.definition; - c.length && !c.some((p) => Hg(t, p)) && Ns(e, `missing type "${c.join(",")}" for keyword "${n}"`); - } - } -} -function Hg(e, t) { - return e.includes(t) || t === "number" && e.includes("integer"); -} -function su(e, t) { - return e.includes(t) || t === "integer" && e.includes("number"); -} -function Gg(e, t) { - const a = []; - for (const n of e.dataTypes) - su(t, n) ? a.push(n) : t.includes("integer") && n === "number" && a.push("integer"); - e.dataTypes = a; -} -function Ns(e, t) { - const a = e.schemaEnv.baseId + e.errSchemaPath; - t += ` at "${a}" (strictTypes)`, (0, br.checkStrictMode)(e, t, e.opts.strictTypes); -} -class iu { - constructor(t, a, n) { - if ((0, Da.validateKeywordUsage)(t, a, n), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = n, this.data = t.data, this.schema = t.schema[n], this.$data = a.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, br.schemaRefOrVal)(t, this.schema, n, this.$data), this.schemaType = a.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = a, this.$data) - this.schemaCode = t.gen.const("vSchema", lu(this.$data, t)); - else if (this.schemaCode = this.schemaValue, !(0, Da.validSchemaType)(this.schema, a.schemaType, a.allowUndefined)) - throw new Error(`${n} value must be ${JSON.stringify(a.schemaType)}`); - ("code" in a ? a.trackErrors : a.errors !== !1) && (this.errsCount = t.gen.const("_errs", ue.default.errors)); - } - result(t, a, n) { - this.failResult((0, ne.not)(t), a, n); - } - failResult(t, a, n) { - this.gen.if(t), n ? n() : this.error(), a ? (this.gen.else(), a(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); - } - pass(t, a) { - this.failResult((0, ne.not)(t), void 0, a); - } - fail(t) { - if (t === void 0) { - this.error(), this.allErrors || this.gen.if(!1); - return; - } - this.gen.if(t), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else(); - } - fail$data(t) { - if (!this.$data) - return this.fail(t); - const { schemaCode: a } = this; - this.fail((0, ne._)`${a} !== undefined && (${(0, ne.or)(this.invalid$data(), t)})`); - } - error(t, a, n) { - if (a) { - this.setParams(a), this._error(t, n), this.setParams({}); - return; - } - this._error(t, n); - } - _error(t, a) { - (t ? ja.reportExtraError : ja.reportError)(this, this.def.error, a); - } - $dataError() { - (0, ja.reportError)(this, this.def.$dataError || ja.keyword$DataError); - } - reset() { - if (this.errsCount === void 0) - throw new Error('add "trackErrors" to keyword definition'); - (0, ja.resetErrorsCount)(this.gen, this.errsCount); - } - ok(t) { - this.allErrors || this.gen.if(t); - } - setParams(t, a) { - a ? Object.assign(this.params, t) : this.params = t; - } - block$data(t, a, n = ne.nil) { - this.gen.block(() => { - this.check$data(t, n), a(); - }); - } - check$data(t = ne.nil, a = ne.nil) { - if (!this.$data) - return; - const { gen: n, schemaCode: s, schemaType: c, def: p } = this; - n.if((0, ne.or)((0, ne._)`${s} === undefined`, a)), t !== ne.nil && n.assign(t, !0), (c.length || p.validateSchema) && (n.elseIf(this.invalid$data()), this.$dataError(), t !== ne.nil && n.assign(t, !1)), n.else(); - } - invalid$data() { - const { gen: t, schemaCode: a, schemaType: n, def: s, it: c } = this; - return (0, ne.or)(p(), b()); - function p() { - if (n.length) { - if (!(a instanceof ne.Name)) - throw new Error("ajv implementation error"); - const _ = Array.isArray(n) ? n : [n]; - return (0, ne._)`${(0, Rn.checkDataTypes)(_, a, c.opts.strictNumbers, Rn.DataType.Wrong)}`; - } - return ne.nil; - } - function b() { - if (s.validateSchema) { - const _ = t.scopeValue("validate$data", { ref: s.validateSchema }); - return (0, ne._)`!${_}(${a})`; - } - return ne.nil; - } - } - subschema(t, a) { - const n = (0, mo.getSubschema)(this.it, t); - (0, mo.extendSubschemaData)(n, this.it, t), (0, mo.extendSubschemaMode)(n, t); - const s = { ...this.it, ...n, items: void 0, props: void 0 }; - return Lg(s, a), s; - } - mergeEvaluated(t, a) { - const { it: n, gen: s } = this; - n.opts.unevaluated && (n.props !== !0 && t.props !== void 0 && (n.props = br.mergeEvaluated.props(s, t.props, n.props, a)), n.items !== !0 && t.items !== void 0 && (n.items = br.mergeEvaluated.items(s, t.items, n.items, a))); - } - mergeValidEvaluated(t, a) { - const { it: n, gen: s } = this; - if (n.opts.unevaluated && (n.props !== !0 || n.items !== !0)) - return s.if(a, () => this.mergeEvaluated(t, ne.Name)), !0; - } -} -tr.KeywordCxt = iu; -function cu(e, t, a, n) { - const s = new iu(e, a, t); - "code" in a ? a.code(s, n) : s.$data && a.validate ? (0, Da.funcKeywordCode)(s, a) : "macro" in a ? (0, Da.macroKeywordCode)(s, a) : (a.compile || a.validate) && (0, Da.funcKeywordCode)(s, a); -} -const Kg = /^\/(?:[^~]|~0|~1)*$/, Wg = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; -function lu(e, { dataLevel: t, dataNames: a, dataPathArr: n }) { - let s, c; - if (e === "") - return ue.default.rootData; - if (e[0] === "/") { - if (!Kg.test(e)) - throw new Error(`Invalid JSON-pointer: ${e}`); - s = e, c = ue.default.rootData; - } else { - const y = Wg.exec(e); - if (!y) - throw new Error(`Invalid JSON-pointer: ${e}`); - const g = +y[1]; - if (s = y[2], s === "#") { - if (g >= t) - throw new Error(_("property/index", g)); - return n[t - g]; - } - if (g > t) - throw new Error(_("data", g)); - if (c = a[t - g], !s) - return c; - } - let p = c; - const b = s.split("/"); - for (const y of b) - y && (c = (0, ne._)`${c}${(0, ne.getProperty)((0, br.unescapeJsonPointer)(y))}`, p = (0, ne._)`${p} && ${c}`); - return p; - function _(y, g) { - return `Cannot access ${y} ${g} levels up, current level is ${t}`; - } -} -tr.getData = lu; -var en = {}; -Object.defineProperty(en, "__esModule", { value: !0 }); -class Jg extends Error { - constructor(t) { - super("validation failed"), this.errors = t, this.ajv = this.validation = !0; - } -} -en.default = Jg; -var tn = {}; -Object.defineProperty(tn, "__esModule", { value: !0 }); -const go = rt; -class Zg extends Error { - constructor(t, a, n, s) { - super(s || `can't resolve reference ${n} from id ${a}`), this.missingRef = (0, go.resolveUrl)(t, a, n), this.missingSchema = (0, go.normalizeId)((0, go.getFullPath)(t, this.missingRef)); - } -} -tn.default = Zg; -var vt = {}; -Object.defineProperty(vt, "__esModule", { value: !0 }); -vt.resolveSchema = vt.getCompilingSchema = vt.resolveRef = vt.compileSchema = vt.SchemaEnv = void 0; -const Ht = ve, Yg = en, Rr = lr, Xt = rt, cc = ke, Qg = tr; -class Kn { - constructor(t) { - var a; - this.refs = {}, this.dynamicAnchors = {}; - let n; - typeof t.schema == "object" && (n = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (a = t.baseId) !== null && a !== void 0 ? a : (0, Xt.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 = {}; - } -} -vt.SchemaEnv = Kn; -function Ls(e) { - const t = uu.call(this, e); - if (t) - return t; - const a = (0, Xt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: n, lines: s } = this.opts.code, { ownProperties: c } = this.opts, p = new Ht.CodeGen(this.scope, { es5: n, lines: s, ownProperties: c }); - let b; - e.$async && (b = p.scopeValue("Error", { - ref: Yg.default, - code: (0, Ht._)`require("ajv/dist/runtime/validation_error").default` - })); - const _ = p.scopeName("validate"); - e.validateName = _; - const y = { - gen: p, - allErrors: this.opts.allErrors, - data: Rr.default.data, - parentData: Rr.default.parentData, - parentDataProperty: Rr.default.parentDataProperty, - dataNames: [Rr.default.data], - dataPathArr: [Ht.nil], - dataLevel: 0, - dataTypes: [], - definedProperties: /* @__PURE__ */ new Set(), - topSchemaRef: p.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Ht.stringify)(e.schema) } : { ref: e.schema }), - validateName: _, - ValidationError: b, - schema: e.schema, - schemaEnv: e, - rootId: a, - baseId: e.baseId || a, - schemaPath: Ht.nil, - errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"), - errorPath: (0, Ht._)`""`, - opts: this.opts, - self: this - }; - let g; - try { - this._compilations.add(e), (0, Qg.validateFunctionCode)(y), p.optimize(this.opts.code.optimize); - const S = p.toString(); - g = `${p.scopeRefs(Rr.default.scope)}return ${S}`, this.opts.code.process && (g = this.opts.code.process(g, e)); - const L = new Function(`${Rr.default.self}`, `${Rr.default.scope}`, g)(this, this.scope.get()); - if (this.scope.value(_, { ref: L }), L.errors = null, L.schema = e.schema, L.schemaEnv = e, e.$async && (L.$async = !0), this.opts.code.source === !0 && (L.source = { validateName: _, validateCode: S, scopeValues: p._values }), this.opts.unevaluated) { - const { props: A, items: N } = y; - L.evaluated = { - props: A instanceof Ht.Name ? void 0 : A, - items: N instanceof Ht.Name ? void 0 : N, - dynamicProps: A instanceof Ht.Name, - dynamicItems: N instanceof Ht.Name - }, L.source && (L.source.evaluated = (0, Ht.stringify)(L.evaluated)); - } - return e.validate = L, e; - } catch (S) { - throw delete e.validate, delete e.validateName, g && this.logger.error("Error compiling schema, function code:", g), S; - } finally { - this._compilations.delete(e); - } -} -vt.compileSchema = Ls; -function Xg(e, t, a) { - var n; - a = (0, Xt.resolveUrl)(this.opts.uriResolver, t, a); - const s = e.refs[a]; - if (s) - return s; - let c = ry.call(this, e, a); - if (c === void 0) { - const p = (n = e.localRefs) === null || n === void 0 ? void 0 : n[a], { schemaId: b } = this.opts; - p && (c = new Kn({ schema: p, schemaId: b, root: e, baseId: t })); - } - if (c !== void 0) - return e.refs[a] = ey.call(this, c); -} -vt.resolveRef = Xg; -function ey(e) { - return (0, Xt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : Ls.call(this, e); -} -function uu(e) { - for (const t of this._compilations) - if (ty(t, e)) - return t; -} -vt.getCompilingSchema = uu; -function ty(e, t) { - return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId; -} -function ry(e, t) { - let a; - for (; typeof (a = this.refs[t]) == "string"; ) - t = a; - return a || this.schemas[t] || Wn.call(this, e, t); -} -function Wn(e, t) { - const a = this.opts.uriResolver.parse(t), n = (0, Xt._getFullPath)(this.opts.uriResolver, a); - let s = (0, Xt.getFullPath)(this.opts.uriResolver, e.baseId, void 0); - if (Object.keys(e.schema).length > 0 && n === s) - return yo.call(this, a, e); - const c = (0, Xt.normalizeId)(n), p = this.refs[c] || this.schemas[c]; - if (typeof p == "string") { - const b = Wn.call(this, e, p); - return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : yo.call(this, a, b); - } - if (typeof (p == null ? void 0 : p.schema) == "object") { - if (p.validate || Ls.call(this, p), c === (0, Xt.normalizeId)(t)) { - const { schema: b } = p, { schemaId: _ } = this.opts, y = b[_]; - return y && (s = (0, Xt.resolveUrl)(this.opts.uriResolver, s, y)), new Kn({ schema: b, schemaId: _, root: e, baseId: s }); - } - return yo.call(this, a, p); - } -} -vt.resolveSchema = Wn; -const ay = /* @__PURE__ */ new Set([ - "properties", - "patternProperties", - "enum", - "dependencies", - "definitions" -]); -function yo(e, { baseId: t, schema: a, root: n }) { - var s; - if (((s = e.fragment) === null || s === void 0 ? void 0 : s[0]) !== "/") - return; - for (const b of e.fragment.slice(1).split("/")) { - if (typeof a == "boolean") - return; - const _ = a[(0, cc.unescapeFragment)(b)]; - if (_ === void 0) - return; - a = _; - const y = typeof a == "object" && a[this.opts.schemaId]; - !ay.has(b) && y && (t = (0, Xt.resolveUrl)(this.opts.uriResolver, t, y)); - } - let c; - if (typeof a != "boolean" && a.$ref && !(0, cc.schemaHasRulesButRef)(a, this.RULES)) { - const b = (0, Xt.resolveUrl)(this.opts.uriResolver, t, a.$ref); - c = Wn.call(this, n, b); - } - const { schemaId: p } = this.opts; - if (c = c || new Kn({ schema: a, schemaId: p, root: n, baseId: t }), c.schema !== c.root.schema) - return c; -} -const ny = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", oy = "Meta-schema for $data reference (JSON AnySchema extension proposal)", sy = "object", iy = [ - "$data" -], cy = { - $data: { - type: "string", - anyOf: [ - { - format: "relative-json-pointer" - }, - { - format: "json-pointer" - } - ] - } -}, ly = !1, uy = { - $id: ny, - description: oy, - type: sy, - required: iy, - properties: cy, - additionalProperties: ly -}; -var Rs = {}, Lo = { exports: {} }; -/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ -(function(e, t) { - (function(a, n) { - n(t); - })(Dl, function(a) { - function n() { - for (var h = arguments.length, $ = Array(h), P = 0; P < h; P++) - $[P] = arguments[P]; - if ($.length > 1) { - $[0] = $[0].slice(0, -1); - for (var M = $.length - 1, D = 1; D < M; ++D) - $[D] = $[D].slice(1, -1); - return $[M] = $[M].slice(1), $.join(""); - } else - return $[0]; - } - function s(h) { - return "(?:" + h + ")"; - } - function c(h) { - return h === void 0 ? "undefined" : h === null ? "null" : Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase(); - } - function p(h) { - return h.toUpperCase(); - } - function b(h) { - return h != null ? h instanceof Array ? h : typeof h.length != "number" || h.split || h.setInterval || h.call ? [h] : Array.prototype.slice.call(h) : []; - } - function _(h, $) { - var P = h; - if ($) - for (var M in $) - P[M] = $[M]; - return P; - } - function y(h) { - var $ = "[A-Za-z]", P = "[0-9]", M = n(P, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Y = "[\\:\\/\\?\\#\\[\\]\\@]", Z = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", re = n(Y, Z), he = h ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", oe = h ? "[\\uE000-\\uF8FF]" : "[]", te = n($, P, "[\\-\\.\\_\\~]", he); - s($ + n($, P, "[\\+\\-\\.]") + "*"), s(s(D + "|" + n(te, Z, "[\\:]")) + "*"); - var ce = s(s("25[0-5]") + "|" + s("2[0-4]" + P) + "|" + s("1" + P + P) + "|" + s("0?[1-9]" + P) + "|0?0?" + P), de = s(ce + "\\." + ce + "\\." + ce + "\\." + ce), Q = s(M + "{1,4}"), pe = s(s(Q + "\\:" + Q) + "|" + de), se = s(s(Q + "\\:") + "{6}" + pe), Re = s("\\:\\:" + s(Q + "\\:") + "{5}" + pe), xt = s(s(Q) + "?\\:\\:" + s(Q + "\\:") + "{4}" + pe), De = s(s(s(Q + "\\:") + "{0,1}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{3}" + pe), He = s(s(s(Q + "\\:") + "{0,2}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{2}" + pe), it = s(s(s(Q + "\\:") + "{0,3}" + Q) + "?\\:\\:" + Q + "\\:" + pe), ct = s(s(s(Q + "\\:") + "{0,4}" + Q) + "?\\:\\:" + pe), Ie = s(s(s(Q + "\\:") + "{0,5}" + Q) + "?\\:\\:" + Q), Ge = s(s(s(Q + "\\:") + "{0,6}" + Q) + "?\\:\\:"), lt = s([se, Re, xt, De, He, it, ct, Ie, Ge].join("|")), Ve = s(s(te + "|" + D) + "+"); - s("[vV]" + M + "+\\." + n(te, Z, "[\\:]") + "+"), s(s(D + "|" + n(te, Z)) + "*"); - var dr = s(D + "|" + n(te, Z, "[\\:\\@]")); - return s(s(D + "|" + n(te, Z, "[\\@]")) + "+"), s(s(dr + "|" + n("[\\/\\?]", oe)) + "*"), { - NOT_SCHEME: new RegExp(n("[^]", $, P, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(n("[^\\%\\:]", te, Z), "g"), - NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", te, Z), "g"), - NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", te, Z), "g"), - NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", te, Z), "g"), - NOT_QUERY: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]", oe), "g"), - NOT_FRAGMENT: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(n("[^]", te, Z), "g"), - UNRESERVED: new RegExp(te, "g"), - OTHER_CHARS: new RegExp(n("[^\\%]", te, re), "g"), - PCT_ENCODED: new RegExp(D, "g"), - IPV4ADDRESS: new RegExp("^(" + de + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + lt + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + Ve + ")") + "?\\]?$") - //RFC 6874, with relaxed parsing rules - }; - } - var g = y(!1), S = y(!0), L = function() { - function h($, P) { - var M = [], D = !0, Y = !1, Z = void 0; - try { - for (var re = $[Symbol.iterator](), he; !(D = (he = re.next()).done) && (M.push(he.value), !(P && M.length === P)); D = !0) - ; - } catch (oe) { - Y = !0, Z = oe; - } finally { - try { - !D && re.return && re.return(); - } finally { - if (Y) - throw Z; - } - } - return M; - } - return function($, P) { - if (Array.isArray($)) - return $; - if (Symbol.iterator in Object($)) - return h($, P); - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - }; - }(), A = function(h) { - if (Array.isArray(h)) { - for (var $ = 0, P = Array(h.length); $ < h.length; $++) - P[$] = h[$]; - return P; - } else - return Array.from(h); - }, N = 2147483647, C = 36, T = 1, v = 26, j = 38, I = 700, r = 72, i = 128, o = "-", l = /^xn--/, u = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, f = { - overflow: "Overflow: input needs wider integers to process", - "not-basic": "Illegal input >= 0x80 (not a basic code point)", - "invalid-input": "Invalid input" - }, x = C - T, B = Math.floor, U = String.fromCharCode; - function z(h) { - throw new RangeError(f[h]); - } - function H(h, $) { - for (var P = [], M = h.length; M--; ) - P[M] = $(h[M]); - return P; - } - function w(h, $) { - var P = h.split("@"), M = ""; - P.length > 1 && (M = P[0] + "@", h = P[1]), h = h.replace(m, "."); - var D = h.split("."), Y = H(D, $).join("."); - return M + Y; - } - function q(h) { - for (var $ = [], P = 0, M = h.length; P < M; ) { - var D = h.charCodeAt(P++); - if (D >= 55296 && D <= 56319 && P < M) { - var Y = h.charCodeAt(P++); - (Y & 64512) == 56320 ? $.push(((D & 1023) << 10) + (Y & 1023) + 65536) : ($.push(D), P--); - } else - $.push(D); - } - return $; - } - var W = function(h) { - return String.fromCodePoint.apply(String, A(h)); - }, J = function(h) { - return h - 48 < 10 ? h - 22 : h - 65 < 26 ? h - 65 : h - 97 < 26 ? h - 97 : C; - }, V = function(h, $) { - return h + 22 + 75 * (h < 26) - (($ != 0) << 5); - }, E = function(h, $, P) { - var M = 0; - for ( - h = P ? B(h / I) : h >> 1, h += B(h / $); - /* no initialization */ - h > x * v >> 1; - M += C - ) - h = B(h / x); - return B(M + (x + 1) * h / (h + j)); - }, F = function(h) { - var $ = [], P = h.length, M = 0, D = i, Y = r, Z = h.lastIndexOf(o); - Z < 0 && (Z = 0); - for (var re = 0; re < Z; ++re) - h.charCodeAt(re) >= 128 && z("not-basic"), $.push(h.charCodeAt(re)); - for (var he = Z > 0 ? Z + 1 : 0; he < P; ) { - for ( - var oe = M, te = 1, ce = C; - ; - /* no condition */ - ce += C - ) { - he >= P && z("invalid-input"); - var de = J(h.charCodeAt(he++)); - (de >= C || de > B((N - M) / te)) && z("overflow"), M += de * te; - var Q = ce <= Y ? T : ce >= Y + v ? v : ce - Y; - if (de < Q) - break; - var pe = C - Q; - te > B(N / pe) && z("overflow"), te *= pe; - } - var se = $.length + 1; - Y = E(M - oe, se, oe == 0), B(M / se) > N - D && z("overflow"), D += B(M / se), M %= se, $.splice(M++, 0, D); - } - return String.fromCodePoint.apply(String, $); - }, O = function(h) { - var $ = []; - h = q(h); - var P = h.length, M = i, D = 0, Y = r, Z = !0, re = !1, he = void 0; - try { - for (var oe = h[Symbol.iterator](), te; !(Z = (te = oe.next()).done); Z = !0) { - var ce = te.value; - ce < 128 && $.push(U(ce)); - } - } catch (Ut) { - re = !0, he = Ut; - } finally { - try { - !Z && oe.return && oe.return(); - } finally { - if (re) - throw he; - } - } - var de = $.length, Q = de; - for (de && $.push(o); Q < P; ) { - var pe = N, se = !0, Re = !1, xt = void 0; - try { - for (var De = h[Symbol.iterator](), He; !(se = (He = De.next()).done); se = !0) { - var it = He.value; - it >= M && it < pe && (pe = it); - } - } catch (Ut) { - Re = !0, xt = Ut; - } finally { - try { - !se && De.return && De.return(); - } finally { - if (Re) - throw xt; - } - } - var ct = Q + 1; - pe - M > B((N - D) / ct) && z("overflow"), D += (pe - M) * ct, M = pe; - var Ie = !0, Ge = !1, lt = void 0; - try { - for (var Ve = h[Symbol.iterator](), dr; !(Ie = (dr = Ve.next()).done); Ie = !0) { - var $a = dr.value; - if ($a < M && ++D > N && z("overflow"), $a == M) { - for ( - var hr = D, pr = C; - ; - /* no condition */ - pr += C - ) { - var fr = pr <= Y ? T : pr >= Y + v ? v : pr - Y; - if (hr < fr) - break; - var ka = hr - fr, Ea = C - fr; - $.push(U(V(fr + ka % Ea, 0))), hr = B(ka / Ea); - } - $.push(U(V(hr, 0))), Y = E(D, ct, Q == de), D = 0, ++Q; - } - } - } catch (Ut) { - Ge = !0, lt = Ut; - } finally { - try { - !Ie && Ve.return && Ve.return(); - } finally { - if (Ge) - throw lt; - } - } - ++D, ++M; - } - return $.join(""); - }, d = function(h) { - return w(h, function($) { - return l.test($) ? F($.slice(4).toLowerCase()) : $; - }); - }, k = function(h) { - return w(h, function($) { - return u.test($) ? "xn--" + O($) : $; - }); - }, R = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - version: "2.1.0", - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - ucs2: { - decode: q, - encode: W - }, - decode: F, - encode: O, - toASCII: k, - toUnicode: d - }, G = {}; - function K(h) { - var $ = h.charCodeAt(0), P = void 0; - return $ < 16 ? P = "%0" + $.toString(16).toUpperCase() : $ < 128 ? P = "%" + $.toString(16).toUpperCase() : $ < 2048 ? P = "%" + ($ >> 6 | 192).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase() : P = "%" + ($ >> 12 | 224).toString(16).toUpperCase() + "%" + ($ >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase(), P; - } - function X(h) { - for (var $ = "", P = 0, M = h.length; P < M; ) { - var D = parseInt(h.substr(P + 1, 2), 16); - if (D < 128) - $ += String.fromCharCode(D), P += 3; - else if (D >= 194 && D < 224) { - if (M - P >= 6) { - var Y = parseInt(h.substr(P + 4, 2), 16); - $ += String.fromCharCode((D & 31) << 6 | Y & 63); - } else - $ += h.substr(P, 6); - P += 6; - } else if (D >= 224) { - if (M - P >= 9) { - var Z = parseInt(h.substr(P + 4, 2), 16), re = parseInt(h.substr(P + 7, 2), 16); - $ += String.fromCharCode((D & 15) << 12 | (Z & 63) << 6 | re & 63); - } else - $ += h.substr(P, 9); - P += 9; - } else - $ += h.substr(P, 3), P += 3; - } - return $; - } - function ee(h, $) { - function P(M) { - var D = X(M); - return D.match($.UNRESERVED) ? D : M; - } - return h.scheme && (h.scheme = String(h.scheme).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_SCHEME, "")), h.userinfo !== void 0 && (h.userinfo = String(h.userinfo).replace($.PCT_ENCODED, P).replace($.NOT_USERINFO, K).replace($.PCT_ENCODED, p)), h.host !== void 0 && (h.host = String(h.host).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_HOST, K).replace($.PCT_ENCODED, p)), h.path !== void 0 && (h.path = String(h.path).replace($.PCT_ENCODED, P).replace(h.scheme ? $.NOT_PATH : $.NOT_PATH_NOSCHEME, K).replace($.PCT_ENCODED, p)), h.query !== void 0 && (h.query = String(h.query).replace($.PCT_ENCODED, P).replace($.NOT_QUERY, K).replace($.PCT_ENCODED, p)), h.fragment !== void 0 && (h.fragment = String(h.fragment).replace($.PCT_ENCODED, P).replace($.NOT_FRAGMENT, K).replace($.PCT_ENCODED, p)), h; - } - function ie(h) { - return h.replace(/^0*(.*)/, "$1") || "0"; - } - function xe(h, $) { - var P = h.match($.IPV4ADDRESS) || [], M = L(P, 2), D = M[1]; - return D ? D.split(".").map(ie).join(".") : h; - } - function qe(h, $) { - var P = h.match($.IPV6ADDRESS) || [], M = L(P, 3), D = M[1], Y = M[2]; - if (D) { - for (var Z = D.toLowerCase().split("::").reverse(), re = L(Z, 2), he = re[0], oe = re[1], te = oe ? oe.split(":").map(ie) : [], ce = he.split(":").map(ie), de = $.IPV4ADDRESS.test(ce[ce.length - 1]), Q = de ? 7 : 8, pe = ce.length - Q, se = Array(Q), Re = 0; Re < Q; ++Re) - se[Re] = te[Re] || ce[pe + Re] || ""; - de && (se[Q - 1] = xe(se[Q - 1], $)); - var xt = se.reduce(function(Ie, Ge, lt) { - if (!Ge || Ge === "0") { - var Ve = Ie[Ie.length - 1]; - Ve && Ve.index + Ve.length === lt ? Ve.length++ : Ie.push({ index: lt, length: 1 }); - } - return Ie; - }, []), De = xt.sort(function(Ie, Ge) { - return Ge.length - Ie.length; - })[0], He = void 0; - if (De && De.length > 1) { - var it = se.slice(0, De.index), ct = se.slice(De.index + De.length); - He = it.join(":") + "::" + ct.join(":"); - } else - He = se.join(":"); - return Y && (He += "%" + Y), He; - } else - return h; - } - var At = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Mt = "".match(/(){0}/)[1] === void 0; - function je(h) { - var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = {}, M = $.iri !== !1 ? S : g; - $.reference === "suffix" && (h = ($.scheme ? $.scheme + ":" : "") + "//" + h); - var D = h.match(At); - if (D) { - Mt ? (P.scheme = D[1], P.userinfo = D[3], P.host = D[4], P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = D[7], P.fragment = D[8], isNaN(P.port) && (P.port = D[5])) : (P.scheme = D[1] || void 0, P.userinfo = h.indexOf("@") !== -1 ? D[3] : void 0, P.host = h.indexOf("//") !== -1 ? D[4] : void 0, P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = h.indexOf("?") !== -1 ? D[7] : void 0, P.fragment = h.indexOf("#") !== -1 ? D[8] : void 0, isNaN(P.port) && (P.port = h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), P.host && (P.host = qe(xe(P.host, M), M)), P.scheme === void 0 && P.userinfo === void 0 && P.host === void 0 && P.port === void 0 && !P.path && P.query === void 0 ? P.reference = "same-document" : P.scheme === void 0 ? P.reference = "relative" : P.fragment === void 0 ? P.reference = "absolute" : P.reference = "uri", $.reference && $.reference !== "suffix" && $.reference !== P.reference && (P.error = P.error || "URI is not a " + $.reference + " reference."); - var Y = G[($.scheme || P.scheme || "").toLowerCase()]; - if (!$.unicodeSupport && (!Y || !Y.unicodeSupport)) { - if (P.host && ($.domainHost || Y && Y.domainHost)) - try { - P.host = R.toASCII(P.host.replace(M.PCT_ENCODED, X).toLowerCase()); - } catch (Z) { - P.error = P.error || "Host's domain name can not be converted to ASCII via punycode: " + Z; - } - ee(P, g); - } else - ee(P, M); - Y && Y.parse && Y.parse(P, $); - } else - P.error = P.error || "URI can not be parsed."; - return P; - } - function Dt(h, $) { - var P = $.iri !== !1 ? S : g, M = []; - return h.userinfo !== void 0 && (M.push(h.userinfo), M.push("@")), h.host !== void 0 && M.push(qe(xe(String(h.host), P), P).replace(P.IPV6ADDRESS, function(D, Y, Z) { - return "[" + Y + (Z ? "%25" + Z : "") + "]"; - })), (typeof h.port == "number" || typeof h.port == "string") && (M.push(":"), M.push(String(h.port))), M.length ? M.join("") : void 0; - } - var $t = /^\.\.?\//, kt = /^\/\.(\/|$)/, Et = /^\/\.\.(\/|$)/, zt = /^\/?(?:.|\n)*?(?=\/|$)/; - function ze(h) { - for (var $ = []; h.length; ) - if (h.match($t)) - h = h.replace($t, ""); - else if (h.match(kt)) - h = h.replace(kt, "/"); - else if (h.match(Et)) - h = h.replace(Et, "/"), $.pop(); - else if (h === "." || h === "..") - h = ""; - else { - var P = h.match(zt); - if (P) { - var M = P[0]; - h = h.slice(M.length), $.push(M); - } else - throw new Error("Unexpected dot segment condition"); - } - return $.join(""); - } - function Te(h) { - var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = $.iri ? S : g, M = [], D = G[($.scheme || h.scheme || "").toLowerCase()]; - if (D && D.serialize && D.serialize(h, $), h.host && !P.IPV6ADDRESS.test(h.host) && ($.domainHost || D && D.domainHost)) - try { - h.host = $.iri ? R.toUnicode(h.host) : R.toASCII(h.host.replace(P.PCT_ENCODED, X).toLowerCase()); - } catch (re) { - h.error = h.error || "Host's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + re; - } - ee(h, P), $.reference !== "suffix" && h.scheme && (M.push(h.scheme), M.push(":")); - var Y = Dt(h, $); - if (Y !== void 0 && ($.reference !== "suffix" && M.push("//"), M.push(Y), h.path && h.path.charAt(0) !== "/" && M.push("/")), h.path !== void 0) { - var Z = h.path; - !$.absolutePath && (!D || !D.absolutePath) && (Z = ze(Z)), Y === void 0 && (Z = Z.replace(/^\/\//, "/%2F")), M.push(Z); - } - return h.query !== void 0 && (M.push("?"), M.push(h.query)), h.fragment !== void 0 && (M.push("#"), M.push(h.fragment)), M.join(""); - } - function Pt(h, $) { - var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {}; - return M || (h = je(Te(h, P), P), $ = je(Te($, P), P)), P = P || {}, !P.tolerant && $.scheme ? (D.scheme = $.scheme, D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.userinfo !== void 0 || $.host !== void 0 || $.port !== void 0 ? (D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.path ? ($.path.charAt(0) === "/" ? D.path = ze($.path) : ((h.userinfo !== void 0 || h.host !== void 0 || h.port !== void 0) && !h.path ? D.path = "/" + $.path : h.path ? D.path = h.path.slice(0, h.path.lastIndexOf("/") + 1) + $.path : D.path = $.path, D.path = ze(D.path)), D.query = $.query) : (D.path = h.path, $.query !== void 0 ? D.query = $.query : D.query = h.query), D.userinfo = h.userinfo, D.host = h.host, D.port = h.port), D.scheme = h.scheme), D.fragment = $.fragment, D; - } - function Bt(h, $, P) { - var M = _({ scheme: "null" }, P); - return Te(Pt(je(h, M), je($, M), M, !0), M); - } - function ot(h, $) { - return typeof h == "string" ? h = Te(je(h, $), $) : c(h) === "object" && (h = je(Te(h, $), $)), h; - } - function Vt(h, $, P) { - return typeof h == "string" ? h = Te(je(h, P), P) : c(h) === "object" && (h = Te(h, P)), typeof $ == "string" ? $ = Te(je($, P), P) : c($) === "object" && ($ = Te($, P)), h === $; - } - function ur(h, $) { - return h && h.toString().replace(!$ || !$.iri ? g.ESCAPE : S.ESCAPE, K); - } - function Le(h, $) { - return h && h.toString().replace(!$ || !$.iri ? g.PCT_ENCODED : S.PCT_ENCODED, X); - } - var st = { - scheme: "http", - domainHost: !0, - parse: function(h, $) { - return h.host || (h.error = h.error || "HTTP URIs must have a host."), h; - }, - serialize: function(h, $) { - var P = String(h.scheme).toLowerCase() === "https"; - return (h.port === (P ? 443 : 80) || h.port === "") && (h.port = void 0), h.path || (h.path = "/"), h; - } - }, fa = { - scheme: "https", - domainHost: st.domainHost, - parse: st.parse, - serialize: st.serialize - }; - function ma(h) { - return typeof h.secure == "boolean" ? h.secure : String(h.scheme).toLowerCase() === "wss"; - } - var Ft = { - scheme: "ws", - domainHost: !0, - parse: function(h, $) { - var P = h; - return P.secure = ma(P), P.resourceName = (P.path || "/") + (P.query ? "?" + P.query : ""), P.path = void 0, P.query = void 0, P; - }, - serialize: function(h, $) { - if ((h.port === (ma(h) ? 443 : 80) || h.port === "") && (h.port = void 0), typeof h.secure == "boolean" && (h.scheme = h.secure ? "wss" : "ws", h.secure = void 0), h.resourceName) { - var P = h.resourceName.split("?"), M = L(P, 2), D = M[0], Y = M[1]; - h.path = D && D !== "/" ? D : void 0, h.query = Y, h.resourceName = void 0; - } - return h.fragment = void 0, h; - } - }, ga = { - scheme: "wss", - domainHost: Ft.domainHost, - parse: Ft.parse, - serialize: Ft.serialize - }, Yn = {}, ya = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", Be = "[0-9A-Fa-f]", Qn = s(s("%[EFef]" + Be + "%" + Be + Be + "%" + Be + Be) + "|" + s("%[89A-Fa-f]" + Be + "%" + Be + Be) + "|" + s("%" + Be + Be)), Xn = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", eo = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", to = n(eo, '[\\"\\\\]'), ro = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ao = new RegExp(ya, "g"), St = new RegExp(Qn, "g"), no = new RegExp(n("[^]", Xn, "[\\.]", '[\\"]', to), "g"), ba = new RegExp(n("[^]", ya, ro), "g"), oo = ba; - function Cr(h) { - var $ = X(h); - return $.match(ao) ? $ : h; - } - var _a = { - scheme: "mailto", - parse: function(h, $) { - var P = h, M = P.to = P.path ? P.path.split(",") : []; - if (P.path = void 0, P.query) { - for (var D = !1, Y = {}, Z = P.query.split("&"), re = 0, he = Z.length; re < he; ++re) { - var oe = Z[re].split("="); - switch (oe[0]) { - case "to": - for (var te = oe[1].split(","), ce = 0, de = te.length; ce < de; ++ce) - M.push(te[ce]); - break; - case "subject": - P.subject = Le(oe[1], $); - break; - case "body": - P.body = Le(oe[1], $); - break; - default: - D = !0, Y[Le(oe[0], $)] = Le(oe[1], $); - break; - } - } - D && (P.headers = Y); - } - P.query = void 0; - for (var Q = 0, pe = M.length; Q < pe; ++Q) { - var se = M[Q].split("@"); - if (se[0] = Le(se[0]), $.unicodeSupport) - se[1] = Le(se[1], $).toLowerCase(); - else - try { - se[1] = R.toASCII(Le(se[1], $).toLowerCase()); - } catch (Re) { - P.error = P.error || "Email address's domain name can not be converted to ASCII via punycode: " + Re; - } - M[Q] = se.join("@"); - } - return P; - }, - serialize: function(h, $) { - var P = h, M = b(h.to); - if (M) { - for (var D = 0, Y = M.length; D < Y; ++D) { - var Z = String(M[D]), re = Z.lastIndexOf("@"), he = Z.slice(0, re).replace(St, Cr).replace(St, p).replace(no, K), oe = Z.slice(re + 1); - try { - oe = $.iri ? R.toUnicode(oe) : R.toASCII(Le(oe, $).toLowerCase()); - } catch (Q) { - P.error = P.error || "Email address's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + Q; - } - M[D] = he + "@" + oe; - } - P.path = M.join(","); - } - var te = h.headers = h.headers || {}; - h.subject && (te.subject = h.subject), h.body && (te.body = h.body); - var ce = []; - for (var de in te) - te[de] !== Yn[de] && ce.push(de.replace(St, Cr).replace(St, p).replace(ba, K) + "=" + te[de].replace(St, Cr).replace(St, p).replace(oo, K)); - return ce.length && (P.query = ce.join("&")), P; - } - }, so = /^([^\:]+)\:(.*)/, wa = { - scheme: "urn", - parse: function(h, $) { - var P = h.path && h.path.match(so), M = h; - if (P) { - var D = $.scheme || M.scheme || "urn", Y = P[1].toLowerCase(), Z = P[2], re = D + ":" + ($.nid || Y), he = G[re]; - M.nid = Y, M.nss = Z, M.path = void 0, he && (M = he.parse(M, $)); - } else - M.error = M.error || "URN can not be parsed."; - return M; - }, - serialize: function(h, $) { - var P = $.scheme || h.scheme || "urn", M = h.nid, D = P + ":" + ($.nid || M), Y = G[D]; - Y && (h = Y.serialize(h, $)); - var Z = h, re = h.nss; - return Z.path = (M || $.nid) + ":" + re, Z; - } - }, io = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, va = { - scheme: "urn:uuid", - parse: function(h, $) { - var P = h; - return P.uuid = P.nss, P.nss = void 0, !$.tolerant && (!P.uuid || !P.uuid.match(io)) && (P.error = P.error || "UUID is not valid."), P; - }, - serialize: function(h, $) { - var P = h; - return P.nss = (h.uuid || "").toLowerCase(), P; - } - }; - G[st.scheme] = st, G[fa.scheme] = fa, G[Ft.scheme] = Ft, G[ga.scheme] = ga, G[_a.scheme] = _a, G[wa.scheme] = wa, G[va.scheme] = va, a.SCHEMES = G, a.pctEncChar = K, a.pctDecChars = X, a.parse = je, a.removeDotSegments = ze, a.serialize = Te, a.resolveComponents = Pt, a.resolve = Bt, a.normalize = ot, a.equal = Vt, a.escapeComponent = ur, a.unescapeComponent = Le, Object.defineProperty(a, "__esModule", { value: !0 }); - }); -})(Lo, Lo.exports); -var dy = Lo.exports; -Object.defineProperty(Rs, "__esModule", { value: !0 }); -const du = dy; -du.code = 'require("ajv/dist/runtime/uri").default'; -Rs.default = du; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0; - var t = tr; - Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() { - return t.KeywordCxt; - } }); - var a = ve; - Object.defineProperty(e, "_", { enumerable: !0, get: function() { - return a._; - } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { - return a.str; - } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { - return a.stringify; - } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { - return a.nil; - } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { - return a.Name; - } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() { - return a.CodeGen; - } }); - const n = en, s = tn, c = qr, p = vt, b = ve, _ = rt, y = Xa, g = ke, S = uy, L = Rs, A = (V, E) => new RegExp(V, E); - A.code = "new RegExp"; - const N = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([ - "validate", - "serialize", - "parse", - "wrapper", - "root", - "schema", - "keyword", - "pattern", - "formats", - "validate$data", - "func", - "obj", - "Error" - ]), T = { - errorDataPath: "", - format: "`validateFormats: false` can be used instead.", - nullable: '"nullable" keyword is supported by default.', - jsonPointers: "Deprecated jsPropertySyntax can be used instead.", - extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", - missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", - processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", - sourceCode: "Use option `code: {source: true}`", - strictDefaults: "It is default now, see option `strict`.", - strictKeywords: "It is default now, see option `strict`.", - uniqueItems: '"uniqueItems" keyword is always validated.', - unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", - cache: "Map is used as cache, schema object as key.", - serialize: "Map is used as cache, schema object as key.", - ajvErrors: "It is default now." - }, v = { - ignoreKeywordsWithRef: "", - jsPropertySyntax: "", - unicode: '"minLength"/"maxLength" account for unicode characters by default.' - }, j = 200; - function I(V) { - var E, F, O, d, k, R, G, K, X, ee, ie, xe, qe, At, Mt, je, Dt, $t, kt, Et, zt, ze, Te, Pt, Bt; - const ot = V.strict, Vt = (E = V.code) === null || E === void 0 ? void 0 : E.optimize, ur = Vt === !0 || Vt === void 0 ? 1 : Vt || 0, Le = (O = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && O !== void 0 ? O : A, st = (d = V.uriResolver) !== null && d !== void 0 ? d : L.default; - return { - strictSchema: (R = (k = V.strictSchema) !== null && k !== void 0 ? k : ot) !== null && R !== void 0 ? R : !0, - strictNumbers: (K = (G = V.strictNumbers) !== null && G !== void 0 ? G : ot) !== null && K !== void 0 ? K : !0, - strictTypes: (ee = (X = V.strictTypes) !== null && X !== void 0 ? X : ot) !== null && ee !== void 0 ? ee : "log", - strictTuples: (xe = (ie = V.strictTuples) !== null && ie !== void 0 ? ie : ot) !== null && xe !== void 0 ? xe : "log", - strictRequired: (At = (qe = V.strictRequired) !== null && qe !== void 0 ? qe : ot) !== null && At !== void 0 ? At : !1, - code: V.code ? { ...V.code, optimize: ur, regExp: Le } : { optimize: ur, regExp: Le }, - loopRequired: (Mt = V.loopRequired) !== null && Mt !== void 0 ? Mt : j, - loopEnum: (je = V.loopEnum) !== null && je !== void 0 ? je : j, - meta: (Dt = V.meta) !== null && Dt !== void 0 ? Dt : !0, - messages: ($t = V.messages) !== null && $t !== void 0 ? $t : !0, - inlineRefs: (kt = V.inlineRefs) !== null && kt !== void 0 ? kt : !0, - schemaId: (Et = V.schemaId) !== null && Et !== void 0 ? Et : "$id", - addUsedSchema: (zt = V.addUsedSchema) !== null && zt !== void 0 ? zt : !0, - validateSchema: (ze = V.validateSchema) !== null && ze !== void 0 ? ze : !0, - validateFormats: (Te = V.validateFormats) !== null && Te !== void 0 ? Te : !0, - unicodeRegExp: (Pt = V.unicodeRegExp) !== null && Pt !== void 0 ? Pt : !0, - int32range: (Bt = V.int32range) !== null && Bt !== void 0 ? Bt : !0, - uriResolver: st - }; - } - class r { - constructor(E = {}) { - this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), E = this.opts = { ...E, ...I(E) }; - const { es5: F, lines: O } = this.opts.code; - this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: F, lines: O }), this.logger = B(E.logger); - const d = E.validateFormats; - E.validateFormats = !1, this.RULES = (0, c.getRules)(), i.call(this, T, E, "NOT SUPPORTED"), i.call(this, v, E, "DEPRECATED", "warn"), this._metaOpts = f.call(this), E.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), E.keywords && m.call(this, E.keywords), typeof E.meta == "object" && this.addMetaSchema(E.meta), l.call(this), E.validateFormats = d; - } - _addVocabularies() { - this.addKeyword("$async"); - } - _addDefaultMetaSchema() { - const { $data: E, meta: F, schemaId: O } = this.opts; - let d = S; - O === "id" && (d = { ...S }, d.id = d.$id, delete d.$id), F && E && this.addMetaSchema(d, d[O], !1); - } - defaultMeta() { - const { meta: E, schemaId: F } = this.opts; - return this.opts.defaultMeta = typeof E == "object" ? E[F] || E : void 0; - } - validate(E, F) { - let O; - if (typeof E == "string") { - if (O = this.getSchema(E), !O) - throw new Error(`no schema with key or ref "${E}"`); - } else - O = this.compile(E); - const d = O(F); - return "$async" in O || (this.errors = O.errors), d; - } - compile(E, F) { - const O = this._addSchema(E, F); - return O.validate || this._compileSchemaEnv(O); - } - compileAsync(E, F) { - if (typeof this.opts.loadSchema != "function") - throw new Error("options.loadSchema should be a function"); - const { loadSchema: O } = this.opts; - return d.call(this, E, F); - async function d(ee, ie) { - await k.call(this, ee.$schema); - const xe = this._addSchema(ee, ie); - return xe.validate || R.call(this, xe); - } - async function k(ee) { - ee && !this.getSchema(ee) && await d.call(this, { $ref: ee }, !0); - } - async function R(ee) { - try { - return this._compileSchemaEnv(ee); - } catch (ie) { - if (!(ie instanceof s.default)) - throw ie; - return G.call(this, ie), await K.call(this, ie.missingSchema), R.call(this, ee); - } - } - function G({ missingSchema: ee, missingRef: ie }) { - if (this.refs[ee]) - throw new Error(`AnySchema ${ee} is loaded but ${ie} cannot be resolved`); - } - async function K(ee) { - const ie = await X.call(this, ee); - this.refs[ee] || await k.call(this, ie.$schema), this.refs[ee] || this.addSchema(ie, ee, F); - } - async function X(ee) { - const ie = this._loading[ee]; - if (ie) - return ie; - try { - return await (this._loading[ee] = O(ee)); - } finally { - delete this._loading[ee]; - } - } - } - // Adds schema to the instance - addSchema(E, F, O, d = this.opts.validateSchema) { - if (Array.isArray(E)) { - for (const R of E) - this.addSchema(R, void 0, O, d); - return this; - } - let k; - if (typeof E == "object") { - const { schemaId: R } = this.opts; - if (k = E[R], k !== void 0 && typeof k != "string") - throw new Error(`schema ${R} must be string`); - } - return F = (0, _.normalizeId)(F || k), this._checkUnique(F), this.schemas[F] = this._addSchema(E, O, F, d, !0), this; - } - // Add schema that will be used to validate other schemas - // options in META_IGNORE_OPTIONS are alway set to false - addMetaSchema(E, F, O = this.opts.validateSchema) { - return this.addSchema(E, F, !0, O), this; - } - // Validate schema against its meta-schema - validateSchema(E, F) { - if (typeof E == "boolean") - return !0; - let O; - if (O = E.$schema, O !== void 0 && typeof O != "string") - throw new Error("$schema must be a string"); - if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O) - return this.logger.warn("meta-schema not available"), this.errors = null, !0; - const d = this.validate(O, E); - if (!d && F) { - const k = "schema is invalid: " + this.errorsText(); - if (this.opts.validateSchema === "log") - this.logger.error(k); - else - throw new Error(k); - } - return d; - } - // Get compiled schema by `key` or `ref`. - // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) - getSchema(E) { - let F; - for (; typeof (F = o.call(this, E)) == "string"; ) - E = F; - if (F === void 0) { - const { schemaId: O } = this.opts, d = new p.SchemaEnv({ schema: {}, schemaId: O }); - if (F = p.resolveSchema.call(this, d, E), !F) - return; - this.refs[E] = F; - } - return F.validate || this._compileSchemaEnv(F); - } - // Remove cached schema(s). - // If no parameter is passed all schemas but meta-schemas are removed. - // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - removeSchema(E) { - if (E instanceof RegExp) - return this._removeAllSchemas(this.schemas, E), this._removeAllSchemas(this.refs, E), this; - switch (typeof E) { - case "undefined": - return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; - case "string": { - const F = o.call(this, E); - return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[E], delete this.refs[E], this; - } - case "object": { - const F = E; - this._cache.delete(F); - let O = E[this.opts.schemaId]; - return O && (O = (0, _.normalizeId)(O), delete this.schemas[O], delete this.refs[O]), this; - } - default: - throw new Error("ajv.removeSchema: invalid parameter"); - } - } - // add "vocabulary" - a collection of keywords - addVocabulary(E) { - for (const F of E) - this.addKeyword(F); - return this; - } - addKeyword(E, F) { - let O; - if (typeof E == "string") - O = E, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = O); - else if (typeof E == "object" && F === void 0) { - if (F = E, O = F.keyword, Array.isArray(O) && !O.length) - throw new Error("addKeywords: keyword must be string or non-empty array"); - } else - throw new Error("invalid addKeywords parameters"); - if (z.call(this, O, F), !F) - return (0, g.eachItem)(O, (k) => H.call(this, k)), this; - q.call(this, F); - const d = { - ...F, - type: (0, y.getJSONTypes)(F.type), - schemaType: (0, y.getJSONTypes)(F.schemaType) - }; - return (0, g.eachItem)(O, d.type.length === 0 ? (k) => H.call(this, k, d) : (k) => d.type.forEach((R) => H.call(this, k, d, R))), this; - } - getKeyword(E) { - const F = this.RULES.all[E]; - return typeof F == "object" ? F.definition : !!F; - } - // Remove keyword - removeKeyword(E) { - const { RULES: F } = this; - delete F.keywords[E], delete F.all[E]; - for (const O of F.rules) { - const d = O.rules.findIndex((k) => k.keyword === E); - d >= 0 && O.rules.splice(d, 1); - } - return this; - } - // Add format - addFormat(E, F) { - return typeof F == "string" && (F = new RegExp(F)), this.formats[E] = F, this; - } - errorsText(E = this.errors, { separator: F = ", ", dataVar: O = "data" } = {}) { - return !E || E.length === 0 ? "No errors" : E.map((d) => `${O}${d.instancePath} ${d.message}`).reduce((d, k) => d + F + k); - } - $dataMetaSchema(E, F) { - const O = this.RULES.all; - E = JSON.parse(JSON.stringify(E)); - for (const d of F) { - const k = d.split("/").slice(1); - let R = E; - for (const G of k) - R = R[G]; - for (const G in O) { - const K = O[G]; - if (typeof K != "object") - continue; - const { $data: X } = K.definition, ee = R[G]; - X && ee && (R[G] = J(ee)); - } - } - return E; - } - _removeAllSchemas(E, F) { - for (const O in E) { - const d = E[O]; - (!F || F.test(O)) && (typeof d == "string" ? delete E[O] : d && !d.meta && (this._cache.delete(d.schema), delete E[O])); - } - } - _addSchema(E, F, O, d = this.opts.validateSchema, k = this.opts.addUsedSchema) { - let R; - const { schemaId: G } = this.opts; - if (typeof E == "object") - R = E[G]; - else { - if (this.opts.jtd) - throw new Error("schema must be object"); - if (typeof E != "boolean") - throw new Error("schema must be object or boolean"); - } - let K = this._cache.get(E); - if (K !== void 0) - return K; - O = (0, _.normalizeId)(R || O); - const X = _.getSchemaRefs.call(this, E, O); - return K = new p.SchemaEnv({ schema: E, schemaId: G, meta: F, baseId: O, localRefs: X }), this._cache.set(K.schema, K), k && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = K), d && this.validateSchema(E, !0), K; - } - _checkUnique(E) { - if (this.schemas[E] || this.refs[E]) - throw new Error(`schema with key or id "${E}" already exists`); - } - _compileSchemaEnv(E) { - if (E.meta ? this._compileMetaSchema(E) : p.compileSchema.call(this, E), !E.validate) - throw new Error("ajv implementation error"); - return E.validate; - } - _compileMetaSchema(E) { - const F = this.opts; - this.opts = this._metaOpts; - try { - p.compileSchema.call(this, E); - } finally { - this.opts = F; - } - } - } - e.default = r, r.ValidationError = n.default, r.MissingRefError = s.default; - function i(V, E, F, O = "error") { - for (const d in V) { - const k = d; - k in E && this.logger[O](`${F}: option ${d}. ${V[k]}`); - } - } - function o(V) { - return V = (0, _.normalizeId)(V), this.schemas[V] || this.refs[V]; - } - function l() { - const V = this.opts.schemas; - if (V) - if (Array.isArray(V)) - this.addSchema(V); - else - for (const E in V) - this.addSchema(V[E], E); - } - function u() { - for (const V in this.opts.formats) { - const E = this.opts.formats[V]; - E && this.addFormat(V, E); - } - } - function m(V) { - if (Array.isArray(V)) { - this.addVocabulary(V); - return; - } - this.logger.warn("keywords option as map is deprecated, pass array"); - for (const E in V) { - const F = V[E]; - F.keyword || (F.keyword = E), this.addKeyword(F); - } - } - function f() { - const V = { ...this.opts }; - for (const E of N) - delete V[E]; - return V; - } - const x = { log() { - }, warn() { - }, error() { - } }; - function B(V) { - if (V === !1) - return x; - if (V === void 0) - return console; - if (V.log && V.warn && V.error) - return V; - throw new Error("logger must implement log, warn and error methods"); - } - const U = /^[a-z_$][a-z0-9_$:-]*$/i; - function z(V, E) { - const { RULES: F } = this; - if ((0, g.eachItem)(V, (O) => { - if (F.keywords[O]) - throw new Error(`Keyword ${O} is already defined`); - if (!U.test(O)) - throw new Error(`Keyword ${O} has invalid name`); - }), !!E && E.$data && !("code" in E || "validate" in E)) - throw new Error('$data keyword must have "code" or "validate" function'); - } - function H(V, E, F) { - var O; - const d = E == null ? void 0 : E.post; - if (F && d) - throw new Error('keyword with "post" flag cannot have "type"'); - const { RULES: k } = this; - let R = d ? k.post : k.rules.find(({ type: K }) => K === F); - if (R || (R = { type: F, rules: [] }, k.rules.push(R)), k.keywords[V] = !0, !E) - return; - const G = { - keyword: V, - definition: { - ...E, - type: (0, y.getJSONTypes)(E.type), - schemaType: (0, y.getJSONTypes)(E.schemaType) - } - }; - E.before ? w.call(this, R, G, E.before) : R.rules.push(G), k.all[V] = G, (O = E.implements) === null || O === void 0 || O.forEach((K) => this.addKeyword(K)); - } - function w(V, E, F) { - const O = V.rules.findIndex((d) => d.keyword === F); - O >= 0 ? V.rules.splice(O, 0, E) : (V.rules.push(E), this.logger.warn(`rule ${F} is not defined`)); - } - function q(V) { - let { metaSchema: E } = V; - E !== void 0 && (V.$data && this.opts.$data && (E = J(E)), V.validateSchema = this.compile(E, !0)); - } - const W = { - $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" - }; - function J(V) { - return { anyOf: [V, W] }; - } -})(Bl); -var Is = {}, As = {}, Ms = {}; -Object.defineProperty(Ms, "__esModule", { value: !0 }); -const hy = { - keyword: "id", - code() { - throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); - } -}; -Ms.default = hy; -var Hr = {}; -Object.defineProperty(Hr, "__esModule", { value: !0 }); -Hr.callRef = Hr.getValidate = void 0; -const py = tn, lc = _e, _t = ve, Jr = lr, uc = vt, dn = ke, fy = { - keyword: "$ref", - schemaType: "string", - code(e) { - const { gen: t, schema: a, it: n } = e, { baseId: s, schemaEnv: c, validateName: p, opts: b, self: _ } = n, { root: y } = c; - if ((a === "#" || a === "#/") && s === y.baseId) - return S(); - const g = uc.resolveRef.call(_, y, s, a); - if (g === void 0) - throw new py.default(n.opts.uriResolver, s, a); - if (g instanceof uc.SchemaEnv) - return L(g); - return A(g); - function S() { - if (c === y) - return kn(e, p, c, c.$async); - const N = t.scopeValue("root", { ref: y }); - return kn(e, (0, _t._)`${N}.validate`, y, y.$async); - } - function L(N) { - const C = hu(e, N); - kn(e, C, N, N.$async); - } - function A(N) { - const C = t.scopeValue("schema", b.code.source === !0 ? { ref: N, code: (0, _t.stringify)(N) } : { ref: N }), T = t.name("valid"), v = e.subschema({ - schema: N, - dataTypes: [], - schemaPath: _t.nil, - topSchemaRef: C, - errSchemaPath: a - }, T); - e.mergeEvaluated(v), e.ok(T); - } - } -}; -function hu(e, t) { - const { gen: a } = e; - return t.validate ? a.scopeValue("validate", { ref: t.validate }) : (0, _t._)`${a.scopeValue("wrapper", { ref: t })}.validate`; -} -Hr.getValidate = hu; -function kn(e, t, a, n) { - const { gen: s, it: c } = e, { allErrors: p, schemaEnv: b, opts: _ } = c, y = _.passContext ? Jr.default.this : _t.nil; - n ? g() : S(); - function g() { - if (!b.$async) - throw new Error("async schema referenced by sync schema"); - const N = s.let("valid"); - s.try(() => { - s.code((0, _t._)`await ${(0, lc.callValidateCode)(e, t, y)}`), A(t), p || s.assign(N, !0); - }, (C) => { - s.if((0, _t._)`!(${C} instanceof ${c.ValidationError})`, () => s.throw(C)), L(C), p || s.assign(N, !1); - }), e.ok(N); - } - function S() { - e.result((0, lc.callValidateCode)(e, t, y), () => A(t), () => L(t)); - } - function L(N) { - const C = (0, _t._)`${N}.errors`; - s.assign(Jr.default.vErrors, (0, _t._)`${Jr.default.vErrors} === null ? ${C} : ${Jr.default.vErrors}.concat(${C})`), s.assign(Jr.default.errors, (0, _t._)`${Jr.default.vErrors}.length`); - } - function A(N) { - var C; - if (!c.opts.unevaluated) - return; - const T = (C = a == null ? void 0 : a.validate) === null || C === void 0 ? void 0 : C.evaluated; - if (c.props !== !0) - if (T && !T.dynamicProps) - T.props !== void 0 && (c.props = dn.mergeEvaluated.props(s, T.props, c.props)); - else { - const v = s.var("props", (0, _t._)`${N}.evaluated.props`); - c.props = dn.mergeEvaluated.props(s, v, c.props, _t.Name); - } - if (c.items !== !0) - if (T && !T.dynamicItems) - T.items !== void 0 && (c.items = dn.mergeEvaluated.items(s, T.items, c.items)); - else { - const v = s.var("items", (0, _t._)`${N}.evaluated.items`); - c.items = dn.mergeEvaluated.items(s, v, c.items, _t.Name); - } - } -} -Hr.callRef = kn; -Hr.default = fy; -Object.defineProperty(As, "__esModule", { value: !0 }); -const my = Ms, gy = Hr, yy = [ - "$schema", - "$id", - "$defs", - "$vocabulary", - { keyword: "$comment" }, - "definitions", - my.default, - gy.default -]; -As.default = yy; -var Ds = {}, zs = {}; -Object.defineProperty(zs, "__esModule", { value: !0 }); -const In = ve, $r = In.operators, An = { - maximum: { okStr: "<=", ok: $r.LTE, fail: $r.GT }, - minimum: { okStr: ">=", ok: $r.GTE, fail: $r.LT }, - exclusiveMaximum: { okStr: "<", ok: $r.LT, fail: $r.GTE }, - exclusiveMinimum: { okStr: ">", ok: $r.GT, fail: $r.LTE } -}, by = { - message: ({ keyword: e, schemaCode: t }) => (0, In.str)`must be ${An[e].okStr} ${t}`, - params: ({ keyword: e, schemaCode: t }) => (0, In._)`{comparison: ${An[e].okStr}, limit: ${t}}` -}, _y = { - keyword: Object.keys(An), - type: "number", - schemaType: "number", - $data: !0, - error: by, - code(e) { - const { keyword: t, data: a, schemaCode: n } = e; - e.fail$data((0, In._)`${a} ${An[t].fail} ${n} || isNaN(${a})`); - } -}; -zs.default = _y; -var Bs = {}; -Object.defineProperty(Bs, "__esModule", { value: !0 }); -const za = ve, wy = { - message: ({ schemaCode: e }) => (0, za.str)`must be multiple of ${e}`, - params: ({ schemaCode: e }) => (0, za._)`{multipleOf: ${e}}` -}, vy = { - keyword: "multipleOf", - type: "number", - schemaType: "number", - $data: !0, - error: wy, - code(e) { - const { gen: t, data: a, schemaCode: n, it: s } = e, c = s.opts.multipleOfPrecision, p = t.let("res"), b = c ? (0, za._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${c}` : (0, za._)`${p} !== parseInt(${p})`; - e.fail$data((0, za._)`(${n} === 0 || (${p} = ${a}/${n}, ${b}))`); - } -}; -Bs.default = vy; -var Vs = {}, Fs = {}; -Object.defineProperty(Fs, "__esModule", { value: !0 }); -function pu(e) { - const t = e.length; - let a = 0, n = 0, s; - for (; n < t; ) - a++, s = e.charCodeAt(n++), s >= 55296 && s <= 56319 && n < t && (s = e.charCodeAt(n), (s & 64512) === 56320 && n++); - return a; -} -Fs.default = pu; -pu.code = 'require("ajv/dist/runtime/ucs2length").default'; -Object.defineProperty(Vs, "__esModule", { value: !0 }); -const Br = ve, $y = ke, ky = Fs, Ey = { - message({ keyword: e, schemaCode: t }) { - const a = e === "maxLength" ? "more" : "fewer"; - return (0, Br.str)`must NOT have ${a} than ${t} characters`; - }, - params: ({ schemaCode: e }) => (0, Br._)`{limit: ${e}}` -}, Py = { - keyword: ["maxLength", "minLength"], - type: "string", - schemaType: "number", - $data: !0, - error: Ey, - code(e) { - const { keyword: t, data: a, schemaCode: n, it: s } = e, c = t === "maxLength" ? Br.operators.GT : Br.operators.LT, p = s.opts.unicode === !1 ? (0, Br._)`${a}.length` : (0, Br._)`${(0, $y.useFunc)(e.gen, ky.default)}(${a})`; - e.fail$data((0, Br._)`${p} ${c} ${n}`); - } -}; -Vs.default = Py; -var Us = {}; -Object.defineProperty(Us, "__esModule", { value: !0 }); -const Sy = _e, Mn = ve, xy = { - message: ({ schemaCode: e }) => (0, Mn.str)`must match pattern "${e}"`, - params: ({ schemaCode: e }) => (0, Mn._)`{pattern: ${e}}` -}, Ty = { - keyword: "pattern", - type: "string", - schemaType: "string", - $data: !0, - error: xy, - code(e) { - const { data: t, $data: a, schema: n, schemaCode: s, it: c } = e, p = c.opts.unicodeRegExp ? "u" : "", b = a ? (0, Mn._)`(new RegExp(${s}, ${p}))` : (0, Sy.usePattern)(e, n); - e.fail$data((0, Mn._)`!${b}.test(${t})`); - } -}; -Us.default = Ty; -var qs = {}; -Object.defineProperty(qs, "__esModule", { value: !0 }); -const Ba = ve, jy = { - message({ keyword: e, schemaCode: t }) { - const a = e === "maxProperties" ? "more" : "fewer"; - return (0, Ba.str)`must NOT have ${a} than ${t} properties`; - }, - params: ({ schemaCode: e }) => (0, Ba._)`{limit: ${e}}` -}, Cy = { - keyword: ["maxProperties", "minProperties"], - type: "object", - schemaType: "number", - $data: !0, - error: jy, - code(e) { - const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxProperties" ? Ba.operators.GT : Ba.operators.LT; - e.fail$data((0, Ba._)`Object.keys(${a}).length ${s} ${n}`); - } -}; -qs.default = Cy; -var Hs = {}; -Object.defineProperty(Hs, "__esModule", { value: !0 }); -const Ca = _e, Va = ve, Oy = ke, Ny = { - message: ({ params: { missingProperty: e } }) => (0, Va.str)`must have required property '${e}'`, - params: ({ params: { missingProperty: e } }) => (0, Va._)`{missingProperty: ${e}}` -}, Ly = { - keyword: "required", - type: "object", - schemaType: "array", - $data: !0, - error: Ny, - code(e) { - const { gen: t, schema: a, schemaCode: n, data: s, $data: c, it: p } = e, { opts: b } = p; - if (!c && a.length === 0) - return; - const _ = a.length >= b.loopRequired; - if (p.allErrors ? y() : g(), b.strictRequired) { - const A = e.parentSchema.properties, { definedProperties: N } = e.it; - for (const C of a) - if ((A == null ? void 0 : A[C]) === void 0 && !N.has(C)) { - const T = p.schemaEnv.baseId + p.errSchemaPath, v = `required property "${C}" is not defined at "${T}" (strictRequired)`; - (0, Oy.checkStrictMode)(p, v, p.opts.strictRequired); - } - } - function y() { - if (_ || c) - e.block$data(Va.nil, S); - else - for (const A of a) - (0, Ca.checkReportMissingProp)(e, A); - } - function g() { - const A = t.let("missing"); - if (_ || c) { - const N = t.let("valid", !0); - e.block$data(N, () => L(A, N)), e.ok(N); - } else - t.if((0, Ca.checkMissingProp)(e, a, A)), (0, Ca.reportMissingProp)(e, A), t.else(); - } - function S() { - t.forOf("prop", n, (A) => { - e.setParams({ missingProperty: A }), t.if((0, Ca.noPropertyInData)(t, s, A, b.ownProperties), () => e.error()); - }); - } - function L(A, N) { - e.setParams({ missingProperty: A }), t.forOf(A, n, () => { - t.assign(N, (0, Ca.propertyInData)(t, s, A, b.ownProperties)), t.if((0, Va.not)(N), () => { - e.error(), t.break(); - }); - }, Va.nil); - } - } -}; -Hs.default = Ly; -var Gs = {}; -Object.defineProperty(Gs, "__esModule", { value: !0 }); -const Fa = ve, Ry = { - message({ keyword: e, schemaCode: t }) { - const a = e === "maxItems" ? "more" : "fewer"; - return (0, Fa.str)`must NOT have ${a} than ${t} items`; - }, - params: ({ schemaCode: e }) => (0, Fa._)`{limit: ${e}}` -}, Iy = { - keyword: ["maxItems", "minItems"], - type: "array", - schemaType: "number", - $data: !0, - error: Ry, - code(e) { - const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxItems" ? Fa.operators.GT : Fa.operators.LT; - e.fail$data((0, Fa._)`${a}.length ${s} ${n}`); - } -}; -Gs.default = Iy; -var Ks = {}, rn = {}; -Object.defineProperty(rn, "__esModule", { value: !0 }); -const fu = Wl; -fu.code = 'require("ajv/dist/runtime/equal").default'; -rn.default = fu; -Object.defineProperty(Ks, "__esModule", { value: !0 }); -const bo = Xa, et = ve, Ay = ke, My = rn, Dy = { - message: ({ params: { i: e, j: t } }) => (0, et.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`, - params: ({ params: { i: e, j: t } }) => (0, et._)`{i: ${e}, j: ${t}}` -}, zy = { - keyword: "uniqueItems", - type: "array", - schemaType: "boolean", - $data: !0, - error: Dy, - code(e) { - const { gen: t, data: a, $data: n, schema: s, parentSchema: c, schemaCode: p, it: b } = e; - if (!n && !s) - return; - const _ = t.let("valid"), y = c.items ? (0, bo.getSchemaTypes)(c.items) : []; - e.block$data(_, g, (0, et._)`${p} === false`), e.ok(_); - function g() { - const N = t.let("i", (0, et._)`${a}.length`), C = t.let("j"); - e.setParams({ i: N, j: C }), t.assign(_, !0), t.if((0, et._)`${N} > 1`, () => (S() ? L : A)(N, C)); - } - function S() { - return y.length > 0 && !y.some((N) => N === "object" || N === "array"); - } - function L(N, C) { - const T = t.name("item"), v = (0, bo.checkDataTypes)(y, T, b.opts.strictNumbers, bo.DataType.Wrong), j = t.const("indices", (0, et._)`{}`); - t.for((0, et._)`;${N}--;`, () => { - t.let(T, (0, et._)`${a}[${N}]`), t.if(v, (0, et._)`continue`), y.length > 1 && t.if((0, et._)`typeof ${T} == "string"`, (0, et._)`${T} += "_"`), t.if((0, et._)`typeof ${j}[${T}] == "number"`, () => { - t.assign(C, (0, et._)`${j}[${T}]`), e.error(), t.assign(_, !1).break(); - }).code((0, et._)`${j}[${T}] = ${N}`); - }); - } - function A(N, C) { - const T = (0, Ay.useFunc)(t, My.default), v = t.name("outer"); - t.label(v).for((0, et._)`;${N}--;`, () => t.for((0, et._)`${C} = ${N}; ${C}--;`, () => t.if((0, et._)`${T}(${a}[${N}], ${a}[${C}])`, () => { - e.error(), t.assign(_, !1).break(v); - }))); - } - } -}; -Ks.default = zy; -var Ws = {}; -Object.defineProperty(Ws, "__esModule", { value: !0 }); -const Ro = ve, By = ke, Vy = rn, Fy = { - message: "must be equal to constant", - params: ({ schemaCode: e }) => (0, Ro._)`{allowedValue: ${e}}` -}, Uy = { - keyword: "const", - $data: !0, - error: Fy, - code(e) { - const { gen: t, data: a, $data: n, schemaCode: s, schema: c } = e; - n || c && typeof c == "object" ? e.fail$data((0, Ro._)`!${(0, By.useFunc)(t, Vy.default)}(${a}, ${s})`) : e.fail((0, Ro._)`${c} !== ${a}`); - } -}; -Ws.default = Uy; -var Js = {}; -Object.defineProperty(Js, "__esModule", { value: !0 }); -const Na = ve, qy = ke, Hy = rn, Gy = { - message: "must be equal to one of the allowed values", - params: ({ schemaCode: e }) => (0, Na._)`{allowedValues: ${e}}` -}, Ky = { - keyword: "enum", - schemaType: "array", - $data: !0, - error: Gy, - code(e) { - const { gen: t, data: a, $data: n, schema: s, schemaCode: c, it: p } = e; - if (!n && s.length === 0) - throw new Error("enum must have non-empty array"); - const b = s.length >= p.opts.loopEnum; - let _; - const y = () => _ ?? (_ = (0, qy.useFunc)(t, Hy.default)); - let g; - if (b || n) - g = t.let("valid"), e.block$data(g, S); - else { - if (!Array.isArray(s)) - throw new Error("ajv implementation error"); - const A = t.const("vSchema", c); - g = (0, Na.or)(...s.map((N, C) => L(A, C))); - } - e.pass(g); - function S() { - t.assign(g, !1), t.forOf("v", c, (A) => t.if((0, Na._)`${y()}(${a}, ${A})`, () => t.assign(g, !0).break())); - } - function L(A, N) { - const C = s[N]; - return typeof C == "object" && C !== null ? (0, Na._)`${y()}(${a}, ${A}[${N}])` : (0, Na._)`${a} === ${C}`; - } - } -}; -Js.default = Ky; -Object.defineProperty(Ds, "__esModule", { value: !0 }); -const Wy = zs, Jy = Bs, Zy = Vs, Yy = Us, Qy = qs, Xy = Hs, eb = Gs, tb = Ks, rb = Ws, ab = Js, nb = [ - // number - Wy.default, - Jy.default, - // string - Zy.default, - Yy.default, - // object - Qy.default, - Xy.default, - // array - eb.default, - tb.default, - // any - { keyword: "type", schemaType: ["string", "array"] }, - { keyword: "nullable", schemaType: "boolean" }, - rb.default, - ab.default -]; -Ds.default = nb; -var Zs = {}, ha = {}; -Object.defineProperty(ha, "__esModule", { value: !0 }); -ha.validateAdditionalItems = void 0; -const Vr = ve, Io = ke, ob = { - message: ({ params: { len: e } }) => (0, Vr.str)`must NOT have more than ${e} items`, - params: ({ params: { len: e } }) => (0, Vr._)`{limit: ${e}}` -}, sb = { - keyword: "additionalItems", - type: "array", - schemaType: ["boolean", "object"], - before: "uniqueItems", - error: ob, - code(e) { - const { parentSchema: t, it: a } = e, { items: n } = t; - if (!Array.isArray(n)) { - (0, Io.checkStrictMode)(a, '"additionalItems" is ignored when "items" is not an array of schemas'); - return; - } - mu(e, n); - } -}; -function mu(e, t) { - const { gen: a, schema: n, data: s, keyword: c, it: p } = e; - p.items = !0; - const b = a.const("len", (0, Vr._)`${s}.length`); - if (n === !1) - e.setParams({ len: t.length }), e.pass((0, Vr._)`${b} <= ${t.length}`); - else if (typeof n == "object" && !(0, Io.alwaysValidSchema)(p, n)) { - const y = a.var("valid", (0, Vr._)`${b} <= ${t.length}`); - a.if((0, Vr.not)(y), () => _(y)), e.ok(y); - } - function _(y) { - a.forRange("i", t.length, b, (g) => { - e.subschema({ keyword: c, dataProp: g, dataPropType: Io.Type.Num }, y), p.allErrors || a.if((0, Vr.not)(y), () => a.break()); - }); - } -} -ha.validateAdditionalItems = mu; -ha.default = sb; -var Ys = {}, pa = {}; -Object.defineProperty(pa, "__esModule", { value: !0 }); -pa.validateTuple = void 0; -const dc = ve, En = ke, ib = _e, cb = { - keyword: "items", - type: "array", - schemaType: ["object", "array", "boolean"], - before: "uniqueItems", - code(e) { - const { schema: t, it: a } = e; - if (Array.isArray(t)) - return gu(e, "additionalItems", t); - a.items = !0, !(0, En.alwaysValidSchema)(a, t) && e.ok((0, ib.validateArray)(e)); - } -}; -function gu(e, t, a = e.schema) { - const { gen: n, parentSchema: s, data: c, keyword: p, it: b } = e; - g(s), b.opts.unevaluated && a.length && b.items !== !0 && (b.items = En.mergeEvaluated.items(n, a.length, b.items)); - const _ = n.name("valid"), y = n.const("len", (0, dc._)`${c}.length`); - a.forEach((S, L) => { - (0, En.alwaysValidSchema)(b, S) || (n.if((0, dc._)`${y} > ${L}`, () => e.subschema({ - keyword: p, - schemaProp: L, - dataProp: L - }, _)), e.ok(_)); - }); - function g(S) { - const { opts: L, errSchemaPath: A } = b, N = a.length, C = N === S.minItems && (N === S.maxItems || S[t] === !1); - if (L.strictTuples && !C) { - const T = `"${p}" is ${N}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`; - (0, En.checkStrictMode)(b, T, L.strictTuples); - } - } -} -pa.validateTuple = gu; -pa.default = cb; -Object.defineProperty(Ys, "__esModule", { value: !0 }); -const lb = pa, ub = { - keyword: "prefixItems", - type: "array", - schemaType: ["array"], - before: "uniqueItems", - code: (e) => (0, lb.validateTuple)(e, "items") -}; -Ys.default = ub; -var Qs = {}; -Object.defineProperty(Qs, "__esModule", { value: !0 }); -const hc = ve, db = ke, hb = _e, pb = ha, fb = { - message: ({ params: { len: e } }) => (0, hc.str)`must NOT have more than ${e} items`, - params: ({ params: { len: e } }) => (0, hc._)`{limit: ${e}}` -}, mb = { - keyword: "items", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - error: fb, - code(e) { - const { schema: t, parentSchema: a, it: n } = e, { prefixItems: s } = a; - n.items = !0, !(0, db.alwaysValidSchema)(n, t) && (s ? (0, pb.validateAdditionalItems)(e, s) : e.ok((0, hb.validateArray)(e))); - } -}; -Qs.default = mb; -var Xs = {}; -Object.defineProperty(Xs, "__esModule", { value: !0 }); -const It = ve, hn = ke, gb = { - message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, It.str)`must contain at least ${e} valid item(s)` : (0, It.str)`must contain at least ${e} and no more than ${t} valid item(s)`, - params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, It._)`{minContains: ${e}}` : (0, It._)`{minContains: ${e}, maxContains: ${t}}` -}, yb = { - keyword: "contains", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - trackErrors: !0, - error: gb, - code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e; - let p, b; - const { minContains: _, maxContains: y } = n; - c.opts.next ? (p = _ === void 0 ? 1 : _, b = y) : p = 1; - const g = t.const("len", (0, It._)`${s}.length`); - if (e.setParams({ min: p, max: b }), b === void 0 && p === 0) { - (0, hn.checkStrictMode)(c, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); - return; - } - if (b !== void 0 && p > b) { - (0, hn.checkStrictMode)(c, '"minContains" > "maxContains" is always invalid'), e.fail(); - return; - } - if ((0, hn.alwaysValidSchema)(c, a)) { - let C = (0, It._)`${g} >= ${p}`; - b !== void 0 && (C = (0, It._)`${C} && ${g} <= ${b}`), e.pass(C); - return; - } - c.items = !0; - const S = t.name("valid"); - b === void 0 && p === 1 ? A(S, () => t.if(S, () => t.break())) : p === 0 ? (t.let(S, !0), b !== void 0 && t.if((0, It._)`${s}.length > 0`, L)) : (t.let(S, !1), L()), e.result(S, () => e.reset()); - function L() { - const C = t.name("_valid"), T = t.let("count", 0); - A(C, () => t.if(C, () => N(T))); - } - function A(C, T) { - t.forRange("i", 0, g, (v) => { - e.subschema({ - keyword: "contains", - dataProp: v, - dataPropType: hn.Type.Num, - compositeRule: !0 - }, C), T(); - }); - } - function N(C) { - t.code((0, It._)`${C}++`), b === void 0 ? t.if((0, It._)`${C} >= ${p}`, () => t.assign(S, !0).break()) : (t.if((0, It._)`${C} > ${b}`, () => t.assign(S, !1).break()), p === 1 ? t.assign(S, !0) : t.if((0, It._)`${C} >= ${p}`, () => t.assign(S, !0))); - } - } -}; -Xs.default = yb; -var yu = {}; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0; - const t = ve, a = ke, n = _e; - e.error = { - message: ({ params: { property: _, depsCount: y, deps: g } }) => { - const S = y === 1 ? "property" : "properties"; - return (0, t.str)`must have ${S} ${g} when property ${_} is present`; - }, - params: ({ params: { property: _, depsCount: y, deps: g, missingProperty: S } }) => (0, t._)`{property: ${_}, - missingProperty: ${S}, - depsCount: ${y}, - deps: ${g}}` - // TODO change to reference - }; - const s = { - keyword: "dependencies", - type: "object", - schemaType: "object", - error: e.error, - code(_) { - const [y, g] = c(_); - p(_, y), b(_, g); - } - }; - function c({ schema: _ }) { - const y = {}, g = {}; - for (const S in _) { - if (S === "__proto__") - continue; - const L = Array.isArray(_[S]) ? y : g; - L[S] = _[S]; - } - return [y, g]; - } - function p(_, y = _.schema) { - const { gen: g, data: S, it: L } = _; - if (Object.keys(y).length === 0) - return; - const A = g.let("missing"); - for (const N in y) { - const C = y[N]; - if (C.length === 0) - continue; - const T = (0, n.propertyInData)(g, S, N, L.opts.ownProperties); - _.setParams({ - property: N, - depsCount: C.length, - deps: C.join(", ") - }), L.allErrors ? g.if(T, () => { - for (const v of C) - (0, n.checkReportMissingProp)(_, v); - }) : (g.if((0, t._)`${T} && (${(0, n.checkMissingProp)(_, C, A)})`), (0, n.reportMissingProp)(_, A), g.else()); - } - } - e.validatePropertyDeps = p; - function b(_, y = _.schema) { - const { gen: g, data: S, keyword: L, it: A } = _, N = g.name("valid"); - for (const C in y) - (0, a.alwaysValidSchema)(A, y[C]) || (g.if( - (0, n.propertyInData)(g, S, C, A.opts.ownProperties), - () => { - const T = _.subschema({ keyword: L, schemaProp: C }, N); - _.mergeValidEvaluated(T, N); - }, - () => g.var(N, !0) - // TODO var - ), _.ok(N)); - } - e.validateSchemaDeps = b, e.default = s; -})(yu); -var ei = {}; -Object.defineProperty(ei, "__esModule", { value: !0 }); -const bu = ve, bb = ke, _b = { - message: "property name must be valid", - params: ({ params: e }) => (0, bu._)`{propertyName: ${e.propertyName}}` -}, wb = { - keyword: "propertyNames", - type: "object", - schemaType: ["object", "boolean"], - error: _b, - code(e) { - const { gen: t, schema: a, data: n, it: s } = e; - if ((0, bb.alwaysValidSchema)(s, a)) - return; - const c = t.name("valid"); - t.forIn("key", n, (p) => { - e.setParams({ propertyName: p }), e.subschema({ - keyword: "propertyNames", - data: p, - dataTypes: ["string"], - propertyName: p, - compositeRule: !0 - }, c), t.if((0, bu.not)(c), () => { - e.error(!0), s.allErrors || t.break(); - }); - }), e.ok(c); - } -}; -ei.default = wb; -var Jn = {}; -Object.defineProperty(Jn, "__esModule", { value: !0 }); -const pn = _e, Kt = ve, vb = lr, fn = ke, $b = { - message: "must NOT have additional properties", - params: ({ params: e }) => (0, Kt._)`{additionalProperty: ${e.additionalProperty}}` -}, kb = { - keyword: "additionalProperties", - type: ["object"], - schemaType: ["boolean", "object"], - allowUndefined: !0, - trackErrors: !0, - error: $b, - code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, errsCount: c, it: p } = e; - if (!c) - throw new Error("ajv implementation error"); - const { allErrors: b, opts: _ } = p; - if (p.props = !0, _.removeAdditional !== "all" && (0, fn.alwaysValidSchema)(p, a)) - return; - const y = (0, pn.allSchemaProperties)(n.properties), g = (0, pn.allSchemaProperties)(n.patternProperties); - S(), e.ok((0, Kt._)`${c} === ${vb.default.errors}`); - function S() { - t.forIn("key", s, (T) => { - !y.length && !g.length ? N(T) : t.if(L(T), () => N(T)); - }); - } - function L(T) { - let v; - if (y.length > 8) { - const j = (0, fn.schemaRefOrVal)(p, n.properties, "properties"); - v = (0, pn.isOwnProperty)(t, j, T); - } else - y.length ? v = (0, Kt.or)(...y.map((j) => (0, Kt._)`${T} === ${j}`)) : v = Kt.nil; - return g.length && (v = (0, Kt.or)(v, ...g.map((j) => (0, Kt._)`${(0, pn.usePattern)(e, j)}.test(${T})`))), (0, Kt.not)(v); - } - function A(T) { - t.code((0, Kt._)`delete ${s}[${T}]`); - } - function N(T) { - if (_.removeAdditional === "all" || _.removeAdditional && a === !1) { - A(T); - return; - } - if (a === !1) { - e.setParams({ additionalProperty: T }), e.error(), b || t.break(); - return; - } - if (typeof a == "object" && !(0, fn.alwaysValidSchema)(p, a)) { - const v = t.name("valid"); - _.removeAdditional === "failing" ? (C(T, v, !1), t.if((0, Kt.not)(v), () => { - e.reset(), A(T); - })) : (C(T, v), b || t.if((0, Kt.not)(v), () => t.break())); - } - } - function C(T, v, j) { - const I = { - keyword: "additionalProperties", - dataProp: T, - dataPropType: fn.Type.Str - }; - j === !1 && Object.assign(I, { - compositeRule: !0, - createErrors: !1, - allErrors: !1 - }), e.subschema(I, v); - } - } -}; -Jn.default = kb; -var ti = {}; -Object.defineProperty(ti, "__esModule", { value: !0 }); -const Eb = tr, pc = _e, _o = ke, fc = Jn, Pb = { - keyword: "properties", - type: "object", - schemaType: "object", - code(e) { - const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e; - c.opts.removeAdditional === "all" && n.additionalProperties === void 0 && fc.default.code(new Eb.KeywordCxt(c, fc.default, "additionalProperties")); - const p = (0, pc.allSchemaProperties)(a); - for (const S of p) - c.definedProperties.add(S); - c.opts.unevaluated && p.length && c.props !== !0 && (c.props = _o.mergeEvaluated.props(t, (0, _o.toHash)(p), c.props)); - const b = p.filter((S) => !(0, _o.alwaysValidSchema)(c, a[S])); - if (b.length === 0) - return; - const _ = t.name("valid"); - for (const S of b) - y(S) ? g(S) : (t.if((0, pc.propertyInData)(t, s, S, c.opts.ownProperties)), g(S), c.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(S), e.ok(_); - function y(S) { - return c.opts.useDefaults && !c.compositeRule && a[S].default !== void 0; - } - function g(S) { - e.subschema({ - keyword: "properties", - schemaProp: S, - dataProp: S - }, _); - } - } -}; -ti.default = Pb; -var ri = {}; -Object.defineProperty(ri, "__esModule", { value: !0 }); -const mc = _e, mn = ve, gc = ke, yc = ke, Sb = { - keyword: "patternProperties", - type: "object", - schemaType: "object", - code(e) { - const { gen: t, schema: a, data: n, parentSchema: s, it: c } = e, { opts: p } = c, b = (0, mc.allSchemaProperties)(a), _ = b.filter((C) => (0, gc.alwaysValidSchema)(c, a[C])); - if (b.length === 0 || _.length === b.length && (!c.opts.unevaluated || c.props === !0)) - return; - const y = p.strictSchema && !p.allowMatchingProperties && s.properties, g = t.name("valid"); - c.props !== !0 && !(c.props instanceof mn.Name) && (c.props = (0, yc.evaluatedPropsToName)(t, c.props)); - const { props: S } = c; - L(); - function L() { - for (const C of b) - y && A(C), c.allErrors ? N(C) : (t.var(g, !0), N(C), t.if(g)); - } - function A(C) { - for (const T in y) - new RegExp(C).test(T) && (0, gc.checkStrictMode)(c, `property ${T} matches pattern ${C} (use allowMatchingProperties)`); - } - function N(C) { - t.forIn("key", n, (T) => { - t.if((0, mn._)`${(0, mc.usePattern)(e, C)}.test(${T})`, () => { - const v = _.includes(C); - v || e.subschema({ - keyword: "patternProperties", - schemaProp: C, - dataProp: T, - dataPropType: yc.Type.Str - }, g), c.opts.unevaluated && S !== !0 ? t.assign((0, mn._)`${S}[${T}]`, !0) : !v && !c.allErrors && t.if((0, mn.not)(g), () => t.break()); - }); - }); - } - } -}; -ri.default = Sb; -var ai = {}; -Object.defineProperty(ai, "__esModule", { value: !0 }); -const xb = ke, Tb = { - keyword: "not", - schemaType: ["object", "boolean"], - trackErrors: !0, - code(e) { - const { gen: t, schema: a, it: n } = e; - if ((0, xb.alwaysValidSchema)(n, a)) { - e.fail(); - return; - } - const s = t.name("valid"); - e.subschema({ - keyword: "not", - compositeRule: !0, - createErrors: !1, - allErrors: !1 - }, s), e.failResult(s, () => e.reset(), () => e.error()); - }, - error: { message: "must NOT be valid" } -}; -ai.default = Tb; -var ni = {}; -Object.defineProperty(ni, "__esModule", { value: !0 }); -const jb = _e, Cb = { - keyword: "anyOf", - schemaType: "array", - trackErrors: !0, - code: jb.validateUnion, - error: { message: "must match a schema in anyOf" } -}; -ni.default = Cb; -var oi = {}; -Object.defineProperty(oi, "__esModule", { value: !0 }); -const Pn = ve, Ob = ke, Nb = { - message: "must match exactly one schema in oneOf", - params: ({ params: e }) => (0, Pn._)`{passingSchemas: ${e.passing}}` -}, Lb = { - keyword: "oneOf", - schemaType: "array", - trackErrors: !0, - error: Nb, - code(e) { - const { gen: t, schema: a, parentSchema: n, it: s } = e; - if (!Array.isArray(a)) - throw new Error("ajv implementation error"); - if (s.opts.discriminator && n.discriminator) - return; - const c = a, p = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid"); - e.setParams({ passing: b }), t.block(y), e.result(p, () => e.reset(), () => e.error(!0)); - function y() { - c.forEach((g, S) => { - let L; - (0, Ob.alwaysValidSchema)(s, g) ? t.var(_, !0) : L = e.subschema({ - keyword: "oneOf", - schemaProp: S, - compositeRule: !0 - }, _), S > 0 && t.if((0, Pn._)`${_} && ${p}`).assign(p, !1).assign(b, (0, Pn._)`[${b}, ${S}]`).else(), t.if(_, () => { - t.assign(p, !0), t.assign(b, S), L && e.mergeEvaluated(L, Pn.Name); - }); - }); - } - } -}; -oi.default = Lb; -var si = {}; -Object.defineProperty(si, "__esModule", { value: !0 }); -const Rb = ke, Ib = { - keyword: "allOf", - schemaType: "array", - code(e) { - const { gen: t, schema: a, it: n } = e; - if (!Array.isArray(a)) - throw new Error("ajv implementation error"); - const s = t.name("valid"); - a.forEach((c, p) => { - if ((0, Rb.alwaysValidSchema)(n, c)) - return; - const b = e.subschema({ keyword: "allOf", schemaProp: p }, s); - e.ok(s), e.mergeEvaluated(b); - }); - } -}; -si.default = Ib; -var ii = {}; -Object.defineProperty(ii, "__esModule", { value: !0 }); -const Dn = ve, _u = ke, Ab = { - message: ({ params: e }) => (0, Dn.str)`must match "${e.ifClause}" schema`, - params: ({ params: e }) => (0, Dn._)`{failingKeyword: ${e.ifClause}}` -}, Mb = { - keyword: "if", - schemaType: ["object", "boolean"], - trackErrors: !0, - error: Ab, - code(e) { - const { gen: t, parentSchema: a, it: n } = e; - a.then === void 0 && a.else === void 0 && (0, _u.checkStrictMode)(n, '"if" without "then" and "else" is ignored'); - const s = bc(n, "then"), c = bc(n, "else"); - if (!s && !c) - return; - const p = t.let("valid", !0), b = t.name("_valid"); - if (_(), e.reset(), s && c) { - const g = t.let("ifClause"); - e.setParams({ ifClause: g }), t.if(b, y("then", g), y("else", g)); - } else - s ? t.if(b, y("then")) : t.if((0, Dn.not)(b), y("else")); - e.pass(p, () => e.error(!0)); - function _() { - const g = e.subschema({ - keyword: "if", - compositeRule: !0, - createErrors: !1, - allErrors: !1 - }, b); - e.mergeEvaluated(g); - } - function y(g, S) { - return () => { - const L = e.subschema({ keyword: g }, b); - t.assign(p, b), e.mergeValidEvaluated(L, p), S ? t.assign(S, (0, Dn._)`${g}`) : e.setParams({ ifClause: g }); - }; - } - } -}; -function bc(e, t) { - const a = e.schema[t]; - return a !== void 0 && !(0, _u.alwaysValidSchema)(e, a); -} -ii.default = Mb; -var ci = {}; -Object.defineProperty(ci, "__esModule", { value: !0 }); -const Db = ke, zb = { - keyword: ["then", "else"], - schemaType: ["object", "boolean"], - code({ keyword: e, parentSchema: t, it: a }) { - t.if === void 0 && (0, Db.checkStrictMode)(a, `"${e}" without "if" is ignored`); - } -}; -ci.default = zb; -Object.defineProperty(Zs, "__esModule", { value: !0 }); -const Bb = ha, Vb = Ys, Fb = pa, Ub = Qs, qb = Xs, Hb = yu, Gb = ei, Kb = Jn, Wb = ti, Jb = ri, Zb = ai, Yb = ni, Qb = oi, Xb = si, e_ = ii, t_ = ci; -function r_(e = !1) { - const t = [ - // any - Zb.default, - Yb.default, - Qb.default, - Xb.default, - e_.default, - t_.default, - // object - Gb.default, - Kb.default, - Hb.default, - Wb.default, - Jb.default - ]; - return e ? t.push(Vb.default, Ub.default) : t.push(Bb.default, Fb.default), t.push(qb.default), t; -} -Zs.default = r_; -var li = {}, ui = {}; -Object.defineProperty(ui, "__esModule", { value: !0 }); -const Ue = ve, a_ = { - message: ({ schemaCode: e }) => (0, Ue.str)`must match format "${e}"`, - params: ({ schemaCode: e }) => (0, Ue._)`{format: ${e}}` -}, n_ = { - keyword: "format", - type: ["number", "string"], - schemaType: "string", - $data: !0, - error: a_, - code(e, t) { - const { gen: a, data: n, $data: s, schema: c, schemaCode: p, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: g, self: S } = b; - if (!_.validateFormats) - return; - s ? L() : A(); - function L() { - const N = a.scopeValue("formats", { - ref: S.formats, - code: _.code.formats - }), C = a.const("fDef", (0, Ue._)`${N}[${p}]`), T = a.let("fType"), v = a.let("format"); - a.if((0, Ue._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => a.assign(T, (0, Ue._)`${C}.type || "string"`).assign(v, (0, Ue._)`${C}.validate`), () => a.assign(T, (0, Ue._)`"string"`).assign(v, C)), e.fail$data((0, Ue.or)(j(), I())); - function j() { - return _.strictSchema === !1 ? Ue.nil : (0, Ue._)`${p} && !${v}`; - } - function I() { - const r = g.$async ? (0, Ue._)`(${C}.async ? await ${v}(${n}) : ${v}(${n}))` : (0, Ue._)`${v}(${n})`, i = (0, Ue._)`(typeof ${v} == "function" ? ${r} : ${v}.test(${n}))`; - return (0, Ue._)`${v} && ${v} !== true && ${T} === ${t} && !${i}`; - } - } - function A() { - const N = S.formats[c]; - if (!N) { - j(); - return; - } - if (N === !0) - return; - const [C, T, v] = I(N); - C === t && e.pass(r()); - function j() { - if (_.strictSchema === !1) { - S.logger.warn(i()); - return; - } - throw new Error(i()); - function i() { - return `unknown format "${c}" ignored in schema at path "${y}"`; - } - } - function I(i) { - const o = i instanceof RegExp ? (0, Ue.regexpCode)(i) : _.code.formats ? (0, Ue._)`${_.code.formats}${(0, Ue.getProperty)(c)}` : void 0, l = a.scopeValue("formats", { key: c, ref: i, code: o }); - return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, Ue._)`${l}.validate`] : ["string", i, l]; - } - function r() { - if (typeof N == "object" && !(N instanceof RegExp) && N.async) { - if (!g.$async) - throw new Error("async format in sync schema"); - return (0, Ue._)`await ${v}(${n})`; - } - return typeof T == "function" ? (0, Ue._)`${v}(${n})` : (0, Ue._)`${v}.test(${n})`; - } - } - } -}; -ui.default = n_; -Object.defineProperty(li, "__esModule", { value: !0 }); -const o_ = ui, s_ = [o_.default]; -li.default = s_; -var la = {}; -Object.defineProperty(la, "__esModule", { value: !0 }); -la.contentVocabulary = la.metadataVocabulary = void 0; -la.metadataVocabulary = [ - "title", - "description", - "default", - "deprecated", - "readOnly", - "writeOnly", - "examples" -]; -la.contentVocabulary = [ - "contentMediaType", - "contentEncoding", - "contentSchema" -]; -Object.defineProperty(Is, "__esModule", { value: !0 }); -const i_ = As, c_ = Ds, l_ = Zs, u_ = li, _c = la, d_ = [ - i_.default, - c_.default, - (0, l_.default)(), - u_.default, - _c.metadataVocabulary, - _c.contentVocabulary -]; -Is.default = d_; -var di = {}, wu = {}; -(function(e) { - Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(t) { - t.Tag = "tag", t.Mapping = "mapping"; - }(e.DiscrError || (e.DiscrError = {})); -})(wu); -Object.defineProperty(di, "__esModule", { value: !0 }); -const Qr = ve, Ao = wu, wc = vt, h_ = ke, p_ = { - message: ({ params: { discrError: e, tagName: t } }) => e === Ao.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`, - params: ({ params: { discrError: e, tag: t, tagName: a } }) => (0, Qr._)`{error: ${e}, tag: ${a}, tagValue: ${t}}` -}, f_ = { - keyword: "discriminator", - type: "object", - schemaType: "object", - error: p_, - code(e) { - const { gen: t, data: a, schema: n, parentSchema: s, it: c } = e, { oneOf: p } = s; - if (!c.opts.discriminator) - throw new Error("discriminator: requires discriminator option"); - const b = n.propertyName; - if (typeof b != "string") - throw new Error("discriminator: requires propertyName"); - if (n.mapping) - throw new Error("discriminator: mapping is not supported"); - if (!p) - throw new Error("discriminator: requires oneOf keyword"); - const _ = t.let("valid", !1), y = t.const("tag", (0, Qr._)`${a}${(0, Qr.getProperty)(b)}`); - t.if((0, Qr._)`typeof ${y} == "string"`, () => g(), () => e.error(!1, { discrError: Ao.DiscrError.Tag, tag: y, tagName: b })), e.ok(_); - function g() { - const A = L(); - t.if(!1); - for (const N in A) - t.elseIf((0, Qr._)`${y} === ${N}`), t.assign(_, S(A[N])); - t.else(), e.error(!1, { discrError: Ao.DiscrError.Mapping, tag: y, tagName: b }), t.endIf(); - } - function S(A) { - const N = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: A }, N); - return e.mergeEvaluated(C, Qr.Name), N; - } - function L() { - var A; - const N = {}, C = v(s); - let T = !0; - for (let r = 0; r < p.length; r++) { - let i = p[r]; - i != null && i.$ref && !(0, h_.schemaHasRulesButRef)(i, c.self.RULES) && (i = wc.resolveRef.call(c.self, c.schemaEnv.root, c.baseId, i == null ? void 0 : i.$ref), i instanceof wc.SchemaEnv && (i = i.schema)); - const o = (A = i == null ? void 0 : i.properties) === null || A === void 0 ? void 0 : A[b]; - if (typeof o != "object") - throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`); - T = T && (C || v(i)), j(o, r); - } - if (!T) - throw new Error(`discriminator: "${b}" must be required`); - return N; - function v({ required: r }) { - return Array.isArray(r) && r.includes(b); - } - function j(r, i) { - if (r.const) - I(r.const, i); - else if (r.enum) - for (const o of r.enum) - I(o, i); - else - throw new Error(`discriminator: "properties/${b}" must have "const" or "enum"`); - } - function I(r, i) { - if (typeof r != "string" || r in N) - throw new Error(`discriminator: "${b}" values must be unique strings`); - N[r] = i; - } - } - } -}; -di.default = f_; -const m_ = "http://json-schema.org/draft-07/schema#", g_ = "http://json-schema.org/draft-07/schema#", y_ = "Core schema meta-schema", b_ = { - schemaArray: { - type: "array", - minItems: 1, - items: { - $ref: "#" - } - }, - nonNegativeInteger: { - type: "integer", - minimum: 0 - }, - nonNegativeIntegerDefault0: { - allOf: [ - { - $ref: "#/definitions/nonNegativeInteger" - }, - { - default: 0 - } - ] - }, - simpleTypes: { - enum: [ - "array", - "boolean", - "integer", - "null", - "number", - "object", - "string" - ] - }, - stringArray: { - type: "array", - items: { - type: "string" - }, - uniqueItems: !0, - default: [] - } -}, __ = [ - "object", - "boolean" -], w_ = { - $id: { - type: "string", - format: "uri-reference" - }, - $schema: { - type: "string", - format: "uri" - }, - $ref: { - type: "string", - format: "uri-reference" - }, - $comment: { - type: "string" - }, - title: { - type: "string" - }, - description: { - type: "string" - }, - default: !0, - readOnly: { - type: "boolean", - default: !1 - }, - examples: { - type: "array", - items: !0 - }, - multipleOf: { - type: "number", - exclusiveMinimum: 0 - }, - maximum: { - type: "number" - }, - exclusiveMaximum: { - type: "number" - }, - minimum: { - type: "number" - }, - exclusiveMinimum: { - type: "number" - }, - maxLength: { - $ref: "#/definitions/nonNegativeInteger" - }, - minLength: { - $ref: "#/definitions/nonNegativeIntegerDefault0" - }, - pattern: { - type: "string", - format: "regex" - }, - additionalItems: { - $ref: "#" - }, - items: { - anyOf: [ - { - $ref: "#" - }, - { - $ref: "#/definitions/schemaArray" - } - ], - default: !0 - }, - maxItems: { - $ref: "#/definitions/nonNegativeInteger" - }, - minItems: { - $ref: "#/definitions/nonNegativeIntegerDefault0" - }, - uniqueItems: { - type: "boolean", - default: !1 - }, - contains: { - $ref: "#" - }, - maxProperties: { - $ref: "#/definitions/nonNegativeInteger" - }, - minProperties: { - $ref: "#/definitions/nonNegativeIntegerDefault0" - }, - required: { - $ref: "#/definitions/stringArray" - }, - additionalProperties: { - $ref: "#" - }, - definitions: { - type: "object", - additionalProperties: { - $ref: "#" - }, - default: {} - }, - properties: { - type: "object", - additionalProperties: { - $ref: "#" - }, - default: {} - }, - patternProperties: { - type: "object", - additionalProperties: { - $ref: "#" - }, - propertyNames: { - format: "regex" - }, - default: {} - }, - dependencies: { - type: "object", - additionalProperties: { - anyOf: [ - { - $ref: "#" - }, - { - $ref: "#/definitions/stringArray" - } - ] - } - }, - propertyNames: { - $ref: "#" - }, - const: !0, - enum: { - type: "array", - items: !0, - minItems: 1, - uniqueItems: !0 - }, - type: { - anyOf: [ - { - $ref: "#/definitions/simpleTypes" - }, - { - type: "array", - items: { - $ref: "#/definitions/simpleTypes" - }, - minItems: 1, - uniqueItems: !0 - } - ] - }, - format: { - type: "string" - }, - contentMediaType: { - type: "string" - }, - contentEncoding: { - type: "string" - }, - if: { - $ref: "#" - }, - then: { - $ref: "#" - }, - else: { - $ref: "#" - }, - allOf: { - $ref: "#/definitions/schemaArray" - }, - anyOf: { - $ref: "#/definitions/schemaArray" - }, - oneOf: { - $ref: "#/definitions/schemaArray" - }, - not: { - $ref: "#" - } -}, v_ = { - $schema: m_, - $id: g_, - title: y_, - definitions: b_, - type: __, - properties: w_, - default: !0 -}; -(function(e, t) { - 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; - const a = Bl, n = Is, s = di, c = v_, p = ["/properties"], b = "http://json-schema.org/draft-07/schema"; - class _ extends a.default { - _addVocabularies() { - super._addVocabularies(), n.default.forEach((N) => this.addVocabulary(N)), this.opts.discriminator && this.addKeyword(s.default); - } - _addDefaultMetaSchema() { - if (super._addDefaultMetaSchema(), !this.opts.meta) - return; - const N = this.opts.$data ? this.$dataMetaSchema(c, p) : c; - this.addMetaSchema(N, b, !1), this.refs["http://json-schema.org/schema"] = b; - } - defaultMeta() { - return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(b) ? b : void 0); - } - } - e.exports = t = _, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = _; - var y = tr; - Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() { - return y.KeywordCxt; - } }); - var g = ve; - Object.defineProperty(t, "_", { enumerable: !0, get: function() { - return g._; - } }), Object.defineProperty(t, "str", { enumerable: !0, get: function() { - return g.str; - } }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() { - return g.stringify; - } }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() { - return g.nil; - } }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() { - return g.Name; - } }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() { - return g.CodeGen; - } }); - var S = en; - Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() { - return S.default; - } }); - var L = tn; - Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() { - return L.default; - } }); -})(Co, Co.exports); -var $_ = Co.exports; -const k_ = /* @__PURE__ */ zl($_); -class E_ { - constructor() { - Qe(this, "ajv"), this.ajv = new k_(); - } - validateJson(t, a) { - const n = this.ajv.validate(t, a); - return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() }; - } - validateObjectSchema(t, a) { - const n = this.ajv.validate(t, a); - return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() }; - } -} -class P_ { - constructor() { - Qe(this, "TIME_SPLIT", " "); - } - /** - * 给日期添加小时 - * - * @param date - Date - * @param numOfHours - 数字 - * @author terwer - * @since 1.0.0 - */ - addHoursToDate(t, a) { - return t.setTime(t.getTime() + a * 60 * 60 * 1e3), t; - } - /** - * 转换ISO日期为中文日期的通用转换方法 - * - * @param str - '2022-07-18T06:25:48.000Z - * @param isAddTimeZone - 是否增加时区(默认不增加) - * @param isShort - 是否只返回日期 - * @author terwer - * @since 1.0.0 - */ - formatIsoToZhDateFormat(t, a, n) { - if (!t) - return ""; - let s = t; - const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, p = s.match(c); - if (p == null) - return t; - for (let b = 0; b < p.length; b++) { - const _ = p[b]; - let y = _; - a && (y = this.addHoursToDate(new Date(_), 8).toISOString()); - const g = y.split("T"), S = g[0], L = g[1].split(".")[0]; - let A = S + this.TIME_SPLIT + L; - n && (A = S), s = s.replace(_, A); - } - return s; - } - /** - * 转换ISO日期为中文完整时间 - * - * @param str - '2022-07-18T06:25:48.000Z - */ - formatIsoToZh(t) { - return this.formatIsoToZhDateFormat(t, !1, !1); - } - /** - * 转换ISO日期为中文日期 - * - * @param str - '2022-07-18T06:25:48.000Z - */ - formatIsoToZhDate(t) { - return this.formatIsoToZhDateFormat(t, !1, !0); - } - /** - * 转换ISO日期为中文时间 - * - * @param str - '2022-07-18T06:25:48.000Z - */ - formatIsoToZhTime(t) { - return this.formatIsoToZhDateFormat(t, !1).split(this.TIME_SPLIT)[1]; - } - /** - * 当前日期时间完整格式,格式:2023-03-10 02:03:43 - */ - nowZh() { - return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0); - } - /** - * 当前日期,格式:2023-03-10 - */ - nowDateZh() { - return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0, !0); - } - /** - * 当前时间,格式:02:03:43 - */ - nowTimeZh() { - return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1]; - } -} -class S_ { - /** - * 格式化字符串 - * - * @param str - 字符串,可用占位符,例如:test \{0\} str - * @param args - 按占位符顺序排列的参数 - * @author terwer - * @since 0.0.1 - */ - f(t, ...a) { - let n = t; - for (let s = 0; s < a.length; s++) { - const c = a[s]; - typeof c == "string" ? n = n.replace(`{${s}}`, c) : n = n.replace(`{${s}}`, c.toString()); - } - return n; - } - /** - * 字符串拼接 - * - * @param str - 字符串数组 - */ - appendStr(...t) { - return t.join(""); - } - /** - * 判断字符串中,是否包含数组中任何一个元素 - * - * @param str - 字符串 - * @param arr - 字符串数组 - */ - includeInArray(t, a) { - let n = !1; - for (let s = 0; s < a.length; s++) { - const c = a[s]; - t.includes(c) && (n = !0); - } - return n; - } - /** - * 截取指定长度的字符串 - * - * @param str - str - * @param length - 长度 - * @param ignore - 不要结尾省略号 - */ - getByLength(t, a, n) { - const s = t; - return s.length < a ? s : n ? s.substring(0, a) : s.substring(0, a) + "..."; - } - /** - * 字符串空值检测 - * - * @param str - 待检测的字符串 - */ - isEmptyString(t) { - return !t || typeof t != "string" ? !0 : t.trim().length === 0; - } - /** - * 路径组合,解决多出来/的问题 - * - * @param path1 - 路径1 - * @param path2 - 路径2 - */ - pathJoin(t, a) { - let n = t; - const s = t.lastIndexOf("/"); - return s + 1 === t.length && (n = t.substring(0, s)), a.indexOf("/") > 0 ? n = n + "/" + a : n = n + a, n; - } - /** - * 强转boolean - * - * @param val - val - */ - parseBoolean(t) { - return t || (t = "false"), t.toString().toLowerCase() === "true"; - } -} -const wo = (e, t) => { - const a = vc(e), n = vc(t), s = a.pop(), c = n.pop(), p = Ec(a, n); - return p !== 0 ? p : s && c ? Ec(s.split("."), c.split(".")) : s || c ? s ? -1 : 1 : 0; -}, x_ = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, vc = (e) => { - if (typeof e != "string") - throw new TypeError("Invalid argument expected string"); - const t = e.match(x_); - if (!t) - throw new Error(`Invalid argument not valid semver ('${e}' received)`); - return t.shift(), t; -}, $c = (e) => e === "*" || e === "x" || e === "X", kc = (e) => { - const t = parseInt(e, 10); - return isNaN(t) ? e : t; -}, T_ = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], j_ = (e, t) => { - if ($c(e) || $c(t)) - return 0; - const [a, n] = T_(kc(e), kc(t)); - return a > n ? 1 : a < n ? -1 : 0; -}, Ec = (e, t) => { - for (let a = 0; a < Math.max(e.length, t.length); a++) { - const n = j_(e[a] || "0", t[a] || "0"); - if (n !== 0) - return n; - } - return 0; -}; -class C_ { - /** - * Compare [semver](https://semver.org/) version strings - * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. - * - * @param v1 - First version to compare - * @param v2 - Second version to compare - * @returns boolean true if v1 is higher than v2 - */ - greater(t, a) { - return wo(t, a) > 0; - } - /** - * Compare [semver](https://semver.org/) version strings - * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. - * - * @param v1 - First version to compare - * @param v2 - Second version to compare - * @returns boolean true if v1 is equal to v2 - */ - equal(t, a) { - return wo(t, a) === 0; - } - /** - * Compare [semver](https://semver.org/) version strings - * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. - * - * @param v1 - First version to compare - * @param v2 - Second version to compare - * @returns boolean true if v1 is lesser than v2 - */ - lesser(t, a) { - return wo(t, a) < 0; - } -} -var O_ = Object.defineProperty, N_ = (e, t, a) => t in e ? O_(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Xr = (e, t, a) => (N_(e, typeof t != "symbol" ? t + "" : t, a), a); -let Er = class { -}; -Xr(Er, "NODE_ENV_KEY", "NODE_ENV"), /** -* 开发环境 -*/ -Xr(Er, "NODE_ENV_DEVELOPMENT", "development"), /** -* 生产环境 -*/ -Xr(Er, "NODE_ENV_PRODUCTION", "production"), /** -* 测试环境 -*/ -Xr(Er, "NODE_ENV_TEST", "test"), /** -* 是否处于调试模式 -*/ -Xr(Er, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); -class L_ { - /** - * 环境初始化 - * - * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 - * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} - */ - constructor(t) { - Xr(this, "envMeta"), this.envMeta = t; - } - /** - * 是否是开发阶段调试 - */ - isNodeDev() { - return this.getEnv(Er.NODE_ENV_KEY) === Er.NODE_ENV_DEVELOPMENT; - } - /** - * 是否是调试阶段 - */ - isDev() { - return this.isNodeDev() || this.getBooleanEnv(Er.VITE_DEBUG_MODE_KEY); - } - /** - * 获取环境变量,key不存在返回undefined - * @param key - key - */ - getEnv(t) { - let a; - try { - this.envMeta[t] && (a = this.envMeta[t]); - } catch { - } - return a; - } - /** - * 获取String类型的环境变量,key不存在直接返回空值 - * @param key - key - */ - getStringEnv(t) { - return this.getEnv(t) ?? ""; - } - /** - * 获取Boolean类型的环境变量,key不存在返回false - * @param key - key - */ - getBooleanEnv(t) { - let a = !1; - return this.getEnv(t) && (a = this.getStringEnv(t).toLowerCase() === "true"), a; - } - /** - * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 - * - * @param key - key - * @param defaultValue - 默认值 - * @since 0.1.0 - * @author terwer - */ - getEnvOrDefault(t, a) { - const n = this.getStringEnv(t); - return n.trim().length == 0 ? a : n; - } -} -var R_ = Object.defineProperty, I_ = (e, t, a) => t in e ? R_(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, oa = (e, t, a) => (I_(e, typeof t != "symbol" ? t + "" : t, a), a); -class zn { -} -oa(zn, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), oa(zn, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); -var ar = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(ar || {}), vu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function hi(e) { - return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; -} -var $u = { exports: {} }; -(function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.log = a(); - })(vu, function() { - var t = function() { - }, a = "undefined", n = typeof window !== a && typeof window.navigator !== a && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ - "trace", - "debug", - "info", - "warn", - "error" - ]; - function c(C, T) { - var v = C[T]; - if (typeof v.bind == "function") - return v.bind(C); - try { - return Function.prototype.bind.call(v, C); - } catch { - return function() { - return Function.prototype.apply.apply(v, [C, arguments]); - }; - } - } - function p() { - console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); - } - function b(C) { - return C === "debug" && (C = "log"), typeof console === a ? !1 : C === "trace" && n ? p : console[C] !== void 0 ? c(console, C) : console.log !== void 0 ? c(console, "log") : t; - } - function _(C, T) { - for (var v = 0; v < s.length; v++) { - var j = s[v]; - this[j] = v < C ? t : this.methodFactory(j, C, T); - } - this.log = this.debug; - } - function y(C, T, v) { - return function() { - typeof console !== a && (_.call(this, T, v), this[C].apply(this, arguments)); - }; - } - function g(C, T, v) { - return b(C) || y.apply(this, arguments); - } - function S(C, T, v) { - var j = this, I; - T = T ?? "WARN"; - var r = "loglevel"; - typeof C == "string" ? r += ":" + C : typeof C == "symbol" && (r = void 0); - function i(m) { - var f = (s[m] || "silent").toUpperCase(); - if (!(typeof window === a || !r)) { - try { - window.localStorage[r] = f; - return; - } catch { - } - try { - window.document.cookie = encodeURIComponent(r) + "=" + f + ";"; - } catch { - } - } - } - function o() { - var m; - if (!(typeof window === a || !r)) { - try { - m = window.localStorage[r]; - } catch { - } - if (typeof m === a) - try { - var f = window.document.cookie, x = f.indexOf( - encodeURIComponent(r) + "=" - ); - x !== -1 && (m = /^([^;]+)/.exec(f.slice(x))[1]); - } catch { - } - return j.levels[m] === void 0 && (m = void 0), m; - } - } - function l() { - if (!(typeof window === a || !r)) { - try { - window.localStorage.removeItem(r); - return; - } catch { - } - try { - window.document.cookie = encodeURIComponent(r) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; - } catch { - } - } - } - j.name = C, j.levels = { - TRACE: 0, - DEBUG: 1, - INFO: 2, - WARN: 3, - ERROR: 4, - SILENT: 5 - }, j.methodFactory = v || g, j.getLevel = function() { - return I; - }, j.setLevel = function(m, f) { - if (typeof m == "string" && j.levels[m.toUpperCase()] !== void 0 && (m = j.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= j.levels.SILENT) { - if (I = m, f !== !1 && i(m), _.call(j, m, C), typeof console === a && m < j.levels.SILENT) - return "No console available for logging"; - } else - throw "log.setLevel() called with invalid level: " + m; - }, j.setDefaultLevel = function(m) { - T = m, o() || j.setLevel(m, !1); - }, j.resetLevel = function() { - j.setLevel(T, !1), l(); - }, j.enableAll = function(m) { - j.setLevel(j.levels.TRACE, m); - }, j.disableAll = function(m) { - j.setLevel(j.levels.SILENT, m); - }; - var u = o(); - u == null && (u = T), j.setLevel(u, !1); - } - var L = new S(), A = {}; - L.getLogger = function(C) { - if (typeof C != "symbol" && typeof C != "string" || C === "") - throw new TypeError("You must supply a name when creating a logger."); - var T = A[C]; - return T || (T = A[C] = new S( - C, - L.getLevel(), - L.methodFactory - )), T; - }; - var N = typeof window !== a ? window.log : void 0; - return L.noConflict = function() { - return typeof window !== a && window.log === L && (window.log = N), L; - }, L.getLoggers = function() { - return A; - }, L.default = L, L; - }); -})($u); -var A_ = $u.exports; -const gn = /* @__PURE__ */ hi(A_); -var ku = { exports: {} }; -(function(e) { - (function(t, a) { - e.exports ? e.exports = a() : t.prefix = a(t); - })(vu, function(t) { - var a = function(g) { - for (var S = 1, L = arguments.length, A; S < L; S++) - for (A in arguments[S]) - Object.prototype.hasOwnProperty.call(arguments[S], A) && (g[A] = arguments[S][A]); - return g; - }, n = { - template: "[%t] %l:", - levelFormatter: function(g) { - return g.toUpperCase(); - }, - nameFormatter: function(g) { - return g || "root"; - }, - timestampFormatter: function(g) { - return g.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); - }, - format: void 0 - }, s, c = {}, p = function(g) { - if (!g || !g.getLogger) - throw new TypeError("Argument is not a root logger"); - s = g; - }, b = function(g, S) { - if (!g || !g.setLevel) - throw new TypeError("Argument is not a logger"); - var L = g.methodFactory, A = g.name || "", N = c[A] || c[""] || n; - function C(T, v, j) { - var I = L(T, v, j), r = c[j] || c[""], i = r.template.indexOf("%t") !== -1, o = r.template.indexOf("%l") !== -1, l = r.template.indexOf("%n") !== -1; - return function() { - for (var u = "", m = arguments.length, f = Array(m), x = 0; x < m; x++) - f[x] = arguments[x]; - if (A || !c[j]) { - var B = r.timestampFormatter(/* @__PURE__ */ new Date()), U = r.levelFormatter(T), z = r.nameFormatter(j); - r.format ? u += r.format(U, z, B) : (u += r.template, i && (u = u.replace(/%t/, B)), o && (u = u.replace(/%l/, U)), l && (u = u.replace(/%n/, z))), f.length && typeof f[0] == "string" ? f[0] = u + " " + f[0] : f.unshift(u); - } - I.apply(void 0, f); - }; - } - return c[A] || (g.methodFactory = C), S = S || {}, S.template && (S.format = void 0), c[A] = a({}, N, S), g.setLevel(g.getLevel()), s || g.warn( - "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" - ), g; - }, _ = { - reg: p, - apply: b - }, y; - return t && (y = t.prefix, _.noConflict = function() { - return t.prefix === _ && (t.prefix = y), _; - }), _; - }); -})(ku); -var M_ = ku.exports; -const Pc = /* @__PURE__ */ hi(M_); -function D_() { - const e = Error.prepareStackTrace; - Error.prepareStackTrace = (a, n) => n; - const t = new Error().stack.slice(1); - return Error.prepareStackTrace = e, t; -} -class Bn { - /** - * 解析日志级别为枚举 - * - * @param enumObj - 枚举对象 - * @param value - 配置的值 - */ - static stringToEnumValue(t, a) { - return t[Object.keys(t).filter((n) => t[n].toString() === a)[0]]; - } - /** - * 获取配置的日志级别 - */ - static getEnvLevel(t) { - if (!t) - return; - const a = t.getEnvOrDefault(zn.LOG_LEVEL_KEY, ar.LOG_LEVEL_INFO), n = Bn.stringToEnumValue(ar, a.toUpperCase()); - return n || console.warn( - "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" - ), n; - } - /** - * 获取默认日志 - */ - static getEnvLogger(t) { - return t ? t.getEnv(zn.LOG_PREFIX_KEY) : void 0; - } -} -var pi = { exports: {} }, Sc = { exports: {} }, xc; -function z_() { - return xc || (xc = 1, function(e) { - const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", a = typeof process < "u" && process.platform === "win32", n = typeof process < "u" && process.platform === "linux", s = { - ballotDisabled: "☒", - ballotOff: "☐", - ballotOn: "☑", - bullet: "•", - bulletWhite: "◦", - fullBlock: "█", - heart: "❤", - identicalTo: "≡", - line: "─", - mark: "※", - middot: "·", - minus: "-", - multiplication: "×", - obelus: "÷", - pencilDownRight: "✎", - pencilRight: "✏", - pencilUpRight: "✐", - percent: "%", - pilcrow2: "❡", - pilcrow: "¶", - plusMinus: "±", - question: "?", - section: "§", - starsOff: "☆", - starsOn: "★", - upDownArrow: "↕" - }, c = Object.assign({}, s, { - check: "√", - cross: "×", - ellipsisLarge: "...", - ellipsis: "...", - info: "i", - questionSmall: "?", - pointer: ">", - pointerSmall: "»", - radioOff: "( )", - radioOn: "(*)", - warning: "‼" - }), p = Object.assign({}, s, { - ballotCross: "✘", - check: "✔", - cross: "✖", - ellipsisLarge: "⋯", - ellipsis: "…", - info: "ℹ", - questionFull: "?", - questionSmall: "﹖", - pointer: n ? "▸" : "❯", - pointerSmall: n ? "‣" : "›", - radioOff: "◯", - radioOn: "◉", - warning: "⚠" - }); - e.exports = a && !t ? c : p, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: c }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: p }); - }(Sc)), Sc.exports; -} -const B_ = (e) => e !== null && typeof e == "object" && !Array.isArray(e), V_ = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, F_ = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, Eu = () => { - const e = { - enabled: F_(), - visible: !0, - styles: {}, - keys: {} - }, t = (c) => { - let p = c.open = `\x1B[${c.codes[0]}m`, b = c.close = `\x1B[${c.codes[1]}m`, _ = c.regex = new RegExp(`\\u001b\\[${c.codes[1]}m`, "g"); - return c.wrap = (y, g) => { - y.includes(b) && (y = y.replace(_, b + p)); - let S = p + y + b; - return g ? S.replace(/\r*\n/g, `${b}$&${p}`) : S; - }, c; - }, a = (c, p, b) => typeof c == "function" ? c(p) : c.wrap(p, b), n = (c, p) => { - if (c === "" || c == null) - return ""; - if (e.enabled === !1) - return c; - if (e.visible === !1) - return ""; - let b = "" + c, _ = b.includes(` -`), y = p.length; - for (y > 0 && p.includes("unstyle") && (p = [.../* @__PURE__ */ new Set(["unstyle", ...p])].reverse()); y-- > 0; ) - b = a(e.styles[p[y]], b, _); - return b; - }, s = (c, p, b) => { - e.styles[c] = t({ name: c, codes: p }), (e.keys[b] || (e.keys[b] = [])).push(c), Reflect.defineProperty(e, c, { - configurable: !0, - enumerable: !0, - set(_) { - e.alias(c, _); - }, - get() { - let _ = (y) => n(y, _.stack); - return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(c) : [c], _; - } - }); - }; - return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = V_, e.hasColor = e.hasAnsi = (c) => (e.ansiRegex.lastIndex = 0, typeof c == "string" && c !== "" && e.ansiRegex.test(c)), e.alias = (c, p) => { - let b = typeof p == "string" ? e[p] : p; - if (typeof b != "function") - throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); - b.stack || (Reflect.defineProperty(b, "name", { value: c }), e.styles[c] = b, b.stack = [c]), Reflect.defineProperty(e, c, { - configurable: !0, - enumerable: !0, - set(_) { - e.alias(c, _); - }, - get() { - let _ = (y) => n(y, _.stack); - return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _; - } - }); - }, e.theme = (c) => { - if (!B_(c)) - throw new TypeError("Expected theme to be an object"); - for (let p of Object.keys(c)) - e.alias(p, c[p]); - return e; - }, e.alias("unstyle", (c) => typeof c == "string" && c !== "" ? (e.ansiRegex.lastIndex = 0, c.replace(e.ansiRegex, "")) : ""), e.alias("noop", (c) => c), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = z_(), e.define = s, e; -}; -pi.exports = Eu(); -pi.exports.create = Eu; -var U_ = pi.exports; -const Nt = /* @__PURE__ */ hi(U_); -let Mo, Pu, Su, xu, Tu = !0; -typeof process < "u" && ({ FORCE_COLOR: Mo, NODE_DISABLE_COLORS: Pu, NO_COLOR: Su, TERM: xu } = process.env || {}, Tu = process.stdout && process.stdout.isTTY); -const ge = { - enabled: !Pu && Su == null && xu !== "dumb" && (Mo != null && Mo !== "0" || Tu), - // modifiers - reset: Ne(0, 0), - bold: Ne(1, 22), - dim: Ne(2, 22), - italic: Ne(3, 23), - underline: Ne(4, 24), - inverse: Ne(7, 27), - hidden: Ne(8, 28), - strikethrough: Ne(9, 29), - // colors - black: Ne(30, 39), - red: Ne(31, 39), - green: Ne(32, 39), - yellow: Ne(33, 39), - blue: Ne(34, 39), - magenta: Ne(35, 39), - cyan: Ne(36, 39), - white: Ne(37, 39), - gray: Ne(90, 39), - grey: Ne(90, 39), - // background colors - bgBlack: Ne(40, 49), - bgRed: Ne(41, 49), - bgGreen: Ne(42, 49), - bgYellow: Ne(43, 49), - bgBlue: Ne(44, 49), - bgMagenta: Ne(45, 49), - bgCyan: Ne(46, 49), - bgWhite: Ne(47, 49) -}; -function Tc(e, t) { - let a = 0, n, s = "", c = ""; - for (; a < e.length; a++) - n = e[a], s += n.open, c += n.close, ~t.indexOf(n.close) && (t = t.replace(n.rgx, n.close + n.open)); - return s + t + c; -} -function q_(e, t) { - let a = { has: e, keys: t }; - return a.reset = ge.reset.bind(a), a.bold = ge.bold.bind(a), a.dim = ge.dim.bind(a), a.italic = ge.italic.bind(a), a.underline = ge.underline.bind(a), a.inverse = ge.inverse.bind(a), a.hidden = ge.hidden.bind(a), a.strikethrough = ge.strikethrough.bind(a), a.black = ge.black.bind(a), a.red = ge.red.bind(a), a.green = ge.green.bind(a), a.yellow = ge.yellow.bind(a), a.blue = ge.blue.bind(a), a.magenta = ge.magenta.bind(a), a.cyan = ge.cyan.bind(a), a.white = ge.white.bind(a), a.gray = ge.gray.bind(a), a.grey = ge.grey.bind(a), a.bgBlack = ge.bgBlack.bind(a), a.bgRed = ge.bgRed.bind(a), a.bgGreen = ge.bgGreen.bind(a), a.bgYellow = ge.bgYellow.bind(a), a.bgBlue = ge.bgBlue.bind(a), a.bgMagenta = ge.bgMagenta.bind(a), a.bgCyan = ge.bgCyan.bind(a), a.bgWhite = ge.bgWhite.bind(a), a; -} -function Ne(e, t) { - let a = { - open: `\x1B[${e}m`, - close: `\x1B[${t}m`, - rgx: new RegExp(`\\x1b\\[${t}m`, "g") - }; - return function(n) { - return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(a)), n === void 0 ? this : ge.enabled ? Tc(this.keys, n + "") : n + "") : n === void 0 ? q_([e], [a]) : ge.enabled ? Tc([a], n + "") : n + ""; - }; -} -var H_ = Object.defineProperty, G_ = (e, t, a) => t in e ? H_(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Ze = (e, t, a) => (G_(e, typeof t != "symbol" ? t + "" : t, a), a); -const Zt = class { - /** - * 检测是否运行在Chrome插件中 - */ - static isInChromeExtension() { - return Zt.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; - } -}; -let Se = Zt; -Ze(Se, "isNode", typeof process < "u"), /** -* 是否在浏览器环境 -*/ -Ze(Se, "isInBrowser", typeof window < "u"), /** -* 浏览器路径分隔符 -*/ -Ze(Se, "BrowserSeperator", "/"), /** -* 是否是Electron环境 -*/ -Ze(Se, "isElectron", () => !Zt.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** -* 是否有Node环境,目前包括 Electron 和 Node -*/ -Ze(Se, "hasNodeEnv", () => Zt.isElectron() || Zt.isNode), /** -* 获取url参数 -* -* @param sParam - 参数 -*/ -Ze(Se, "getQueryString", (e) => { - if (!Zt.isInBrowser) - return ""; - const t = window.location.search.substring(1).split("&"); - for (let a = 0; a < t.length; a++) { - const n = t[a].split("="); - if (n[0] === e) - return n[1]; - } - return ""; -}), /** -* 替换 URL 的参数 -* 思路: -* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 -* -* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 -* -* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 -* -* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 -* -* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 -* -* @param url - 链接地址 -* @param paramName - 参数名 -* @param paramValue - 参数值 -*/ -Ze(Se, "replaceUrlParam", (e, t, a) => { - a == null && (a = ""); - const n = new RegExp("\\b(" + t + "=).*?(&|#|$)"); - if (e.search(n) >= 0) - return e.replace(n, "$1" + a + "$2"); - const [s, c] = e.split("#"), [p, b] = s.split("?"), _ = new URLSearchParams(b); - _.set(t, a); - const y = _.toString(), g = p + (y ? "?" + y : ""); - return c ? g + "#" + c : g; -}), /** -* 设置url参数 -* -* @param urlstring - url -* @param key - key -* @param value - value -*/ -Ze(Se, "setUrlParameter", (e, t, a) => { - if (e.includes(t)) - return Zt.replaceUrlParam(e, t, a); - const n = e.split("#"); - let s = n[0]; - const c = n[1]; - return s.includes("?") ? s += `&${t}=${a}` : s += `?${t}=${a}`, c && (s += "#" + c), s; -}), /** -* 重新加载指定tab -* -* @param tabname - tabname -* @param t - 延迟时间 -*/ -Ze(Se, "reloadTabPage", (e, t = 200) => { - setTimeout(function() { - if (Zt.isInBrowser) { - const a = window.location.href; - window.location.href = Zt.setUrlParameter(a, "tab", e); - } - }, t); -}), /** -* 刷新当前tab页面 -*/ -Ze(Se, "reloadPage", () => { - setTimeout(function() { - Zt.isInBrowser && window.location.reload(); - }, 200); -}), /** -* 刷新当前tab页面 -* -* @param msg - 消息提示 -* @param cb - 回调 -*/ -Ze(Se, "reloadPageWithMessageCallback", (e, t) => { - t && t(e), setTimeout(function() { - Zt.isInBrowser && window.location.reload(); - }, 200); -}); -var ft = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(ft || {}); -const yt = class { - /** - * 检测是否运行在思源打开的浏览器中 - */ - static isInSiyuanBrowser() { - return Se.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; - } - /** - * 思源笔记 window 对象 - */ - static siyuanWindow() { - let e; - return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; - } - // ========================= - // require end - // ========================= - // ========================= - // import start - // ========================= - /** - * 引入json - * - * @param jsPath - js相对路径全路径 - * @param type - 类型 - */ - static async importJs(e, t) { - let a = e; - switch (t) { - case ft.BasePathType_Appearance: - a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); - break; - case ft.BasePathType_Data: - a = this.browserJoinPath(this.siyuanDataRelativePath(), e); - break; - case ft.BasePathType_Themes: - a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); - break; - case ft.BasePathType_ZhiTheme: - a = this.browserJoinPath(this.zhiThemeRelativePath(), e); - break; - default: - throw new Error("type must be provided"); - } - const { default: n } = await import( - /* @vite-ignore */ - a - ); - return n; - } - /** - * 引入json - * - * @param jsonPath - json相对路径全路径 - * @param type - 类型 - */ - // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { - // let fullJsonPath = jsonPath - // switch (type) { - // case BasePathTypeEnum.BasePathType_Appearance: - // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) - // break - // case BasePathTypeEnum.BasePathType_Data: - // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) - // break - // case BasePathTypeEnum.BasePathType_Themes: - // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) - // break - // case BasePathTypeEnum.BasePathType_ZhiTheme: - // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) - // break - // default: - // throw new Error("type must be provided") - // } - // - // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) - // return data - // } - /** - * 引入 json - 以 data 为基本路径 - * - * @param jsonPath - 相对于 data 的相对路径 - */ - // public static async importDataJson(jsonPath: string) { - // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) - // } - /** - * 引入 json - 以 appearance 为基本路径 - * - * @param jsonPath - 相对于 appearance 的相对路径 - */ - // public static async importAppearanceJson(jsonPath: string) { - // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) - // } - /** - * 引入 json - 以 themes 为基本路径 - * - * @param jsonPath - 相对于 themes 的相对路径 - */ - // public static async importThemesJson(jsonPath: string) { - // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) - // } - /** - * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 - * - * @param jsonPath - 相对于 zhi 主题根路径的相对路径 - */ - // public static async importZhiThemeJson(jsonPath: string) { - // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) - // } - /** - * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 - * - * @param jsPath - 相对于 zhi 主题根路径的相对路径 - */ - static async importZhiThemeJs(e) { - return await this.importJs(e, ft.BasePathType_ZhiTheme); - } - // ========================= - // import start - // ========================= - /** - * 路径拼接 - * - * @param paths - 路径数组 - */ - static joinPath(...e) { - if (Se.hasNodeEnv()) { - const t = this.requireLib("path"); - if (t) - return t.join(...e); - } - return this.browserJoinPath(...e); - } - static browserJoinPath(...e) { - return e.join(Se.BrowserSeperator); - } - /** - * 思源笔记 conf 目录 - */ - static siyuanConfPath() { - const e = this.siyuanWindow(); - if (!e) - throw new Error("Not in siyuan env"); - return e.siyuan.config.system.confDir; - } - /** - * 思源笔记 data 目录 - */ - static siyuanDataPath() { - const e = this.siyuanWindow(); - if (!e) - throw new Error("Not in siyuan env"); - return e.siyuan.config.system.dataDir; - } - /** - * 思源笔记 data 目录-相对路径 - */ - static siyuanDataRelativePath() { - if (!this.siyuanWindow()) - throw new Error("Not in siyuan env"); - return ""; - } - /** - * 思源笔记 appearance 目录 - */ - static siyuanAppearancePath() { - return this.joinPath(this.siyuanConfPath(), "appearance"); - } - /** - * 思源笔记 appearance 目录-相对路径 - */ - static siyuanAppearanceRelativePath() { - if (!this.siyuanWindow()) - throw new Error("Not in siyuan env"); - return this.browserJoinPath("", "appearance"); - } - /** - * 思源笔记 themes 目录-绝对路径 - * - * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 - * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath - * - * @author terwer - * @since 0.1.0 - */ - static siyuanThemePath() { - if (Se.hasNodeEnv()) - return this.joinPath(this.siyuanAppearancePath(), "themes"); - { - const e = this.siyuanWindow(); - if (!e) - throw new Error("Not in siyuan env"); - return this.joinPath(e.location.origin, "appearance", "themes"); - } - } - /** - * 思源笔记 themes 目录-相对路径 - */ - static siyuanThemeRelativePath() { - if (!this.siyuanWindow()) - throw new Error("Not in siyuan env"); - return this.browserJoinPath("", "appearance", "themes"); - } - /** - * zhi 主题目录 - 绝对路径 - */ - static zhiThemePath() { - return this.joinPath(this.siyuanThemePath(), "zhi"); - } - /** - * zhi 主题目录 - 相对路径 - */ - static zhiThemeRelativePath() { - return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); - } -}; -let Ir = yt; -Ze(Ir, "isInSiyuanWidget", () => Se.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** -* 思源笔记新窗口 -* -* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 -* @author terwer -* @version 0.1.0 -* @since 0.0.1 -*/ -Ze(Ir, "isInSiyuanNewWin", () => !Se.isInBrowser || !Se.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= -// require start -// ========================= -/** - * 引入依赖 - * - * @param libpath - 依赖全路径 - * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 - * @param type - 可选,以谁的基本路径为准 - */ -Ze(Ir, "requireLib", (e, t = !0, a = ft.BasePathType_None) => { - if (!Se.hasNodeEnv()) - throw new Error("require ony works on node env"); - let n = e; - if (!t) - switch (a) { - case ft.BasePathType_Appearance: - n = yt.joinPath(yt.siyuanAppearancePath(), e); - break; - case ft.BasePathType_Data: - n = yt.joinPath(yt.siyuanDataPath(), e); - break; - case ft.BasePathType_Themes: - n = yt.joinPath(yt.siyuanAppearancePath(), "themes", e); - break; - case ft.BasePathType_ZhiTheme: - n = yt.joinPath(yt.siyuanAppearancePath(), "themes", "zhi", e); - break; - default: - throw new Error("type must be provided when not use absolute path"); - } - const s = yt.siyuanWindow(); - if (!s) - return require(n); - if (typeof s.require < "u") - return s.require(n); -}), /** -* 引入依赖,以 data 的基本路径为准 -* -* @param libpath - 相对于 appearance 的相对路径 -*/ -Ze(Ir, "requireAppearanceLib", (e) => yt.requireLib(e, !1, ft.BasePathType_Appearance)), /** -* 引入依赖,以 data 的基本路径为准 -* -* @param libpath - 相对于 data 的相对路径 -*/ -Ze(Ir, "requireDataLib", (e) => yt.requireLib(e, !1, ft.BasePathType_Data)), /** -* 引入依赖,以 theme 的基本路径为准 -* -* @param libpath - 相对于 theme 的相对路径 -*/ -Ze(Ir, "requireThemesLib", (e) => yt.requireLib(e, !1, ft.BasePathType_Themes)), /** -* 引入依赖,以 ZhiTheme 的基本路径为准 -* -* @param libpath - 相对于 ZhiTheme 的相对路径 -*/ -Ze(Ir, "requireZhiThemeLib", (e) => yt.requireLib(e, !1, ft.BasePathType_ZhiTheme)); -const Lt = { - white: (e) => Se.isElectron() ? Nt.whiteBright(e) : ge.white(e), - gray: (e) => Se.isElectron() ? Nt.gray(e) : ge.gray(e), - blue: (e) => Se.isElectron() ? Nt.blue(e) : ge.blue(e), - green: (e) => Se.isElectron() ? Nt.green(e) : ge.green(e), - yellow: (e) => Se.isElectron() ? Nt.yellow(e) : ge.yellow(e), - red: (e) => Se.isElectron() ? Nt.red(e) : ge.red(e), - bgWhite: (e) => Se.isElectron() ? Nt.bgWhiteBright(e) : ge.bgWhite(e), - bgGrey: (e) => Se.isElectron() ? Nt.bgCyanBright(e) : ge.bgCyan(e), - bgBlue: (e) => Se.isElectron() ? Nt.bgBlueBright(e) : ge.bgBlue(e), - bgGreen: (e) => Se.isElectron() ? Nt.bgGreenBright(e) : ge.bgGreen(e), - bgYellow: (e) => Se.isElectron() ? Nt.bgYellowBright(e) : ge.bgYellow(e), - bgRed: (e) => Se.isElectron() ? Nt.bgRedBright(e) : ge.bgRed(e) -}; -class K_ { - constructor(t, a, n) { - oa(this, "consoleLogger", "console"), oa(this, "stackSize", 1), oa(this, "getLogger", (p) => { - let b; - if (p) - b = p; - else { - const _ = this.getCallStack(), y = [], g = []; - for (let S = 0; S < _.length; S++) { - const L = _[S], A = L.getFileName() ?? "none"; - if (S > this.stackSize - 1) - break; - const N = A + "-" + L.getLineNumber() + ":" + L.getColumnNumber(); - y.push(N); - } - g.length > 0 && (b = y.join(" -> ")); - } - return (!b || b.trim().length === 0) && (b = this.consoleLogger), gn.getLogger(b); - }), this.stackSize = 1; - let s; - t ? s = t : s = Bn.getEnvLevel(n), s = s ?? ar.LOG_LEVEL_INFO, gn.setLevel(s); - const c = (p, b, _, y) => { - const g = [], S = a ?? Bn.getEnvLogger(n) ?? "zhi"; - return g.push(Lt.gray("[") + y(S) + Lt.gray("]")), g.push(Lt.gray("[") + Lt.gray(_.toString()) + Lt.gray("]")), g.push(y(p.toUpperCase().toString())), g.push(y(b)), g.push(Lt.gray(":")), g; - }; - Pc.reg(gn), Pc.apply(gn, { - format(p, b, _) { - let y = []; - const g = b ?? ""; - switch (p) { - case ar.LOG_LEVEL_TRACE: - y = c(p, g, _, Lt.gray); - break; - case ar.LOG_LEVEL_DEBUG: - y = c(p, g, _, Lt.blue); - break; - case ar.LOG_LEVEL_INFO: - y = c(p, g, _, Lt.green); - break; - case ar.LOG_LEVEL_WARN: - y = c(p, g, _, Lt.yellow); - break; - case ar.LOG_LEVEL_ERROR: - y = c(p, g, _, Lt.red); - break; - default: - y = c(ar.LOG_LEVEL_INFO, g, _, Lt.green); - break; - } - return y.join(" "); - } - }); - } - /** - * 设置输出栈的深度,默认1 - * - * @param stackSize - 栈的深度 - */ - setStackSize(t) { - this.stackSize = t ?? 1; - } - /** - * 获取调用堆栈,若未获取到直接返回空数组 - * - * @author terwer - * @since 1.6.0 - */ - getCallStack() { - let t; - try { - t = D_(); - } catch { - t = []; - } - return t; - } -} -class W_ { - /** - * 默认日志级别 - * - * @param level - 可选,未设置默认INFO - * @param sign - 可选前缀,默认zhi - * @param env - 可选环境变量实例 - */ - constructor(t, a, n) { - oa(this, "logger"), this.logger = new K_(t, a, n); - } - /** - * 获取日志记录器 - * - * @param loggerName - 日志记录器名称 - * @param stackSize - 打印栈的深度 - * @protected - */ - getLogger(t, a) { - return this.logger.setStackSize(a), this.logger.getLogger(t); - } -} -class jc extends W_ { - constructor(t, a, n) { - super(t, a, n); - } - /** - * 获取默认的日志记录器 - * - * @param loggerName - 日志记录器名称 - * @param stackSize - 打印栈的深度 - */ - getLogger(t, a) { - return super.getLogger(t, a); - } -} -class fi { - /** - * 默认日志记录器 - * - * @param stackSize - 栈的深度 - * @param env - 环境变量实例 - */ - static defaultLogger(t, a) { - return fi.customLogFactory(void 0, void 0, t).getLogger(void 0, a); - } - /** - * 自定义日志工厂 - * - * @param level - 级别 - * @param sign - 标志 - * @param env - 环境变量 - */ - static customLogFactory(t, a, n) { - return new jc(t, a, n); - } - /** - * 自定义日志工厂,自定义前缀 - * - * @param sign - 标志 - * @param env - 环境变量 - */ - static customSignLogFactory(t, a) { - return new jc(void 0, t, a); - } -} -const J_ = "zhi"; -class Ua { - /** - * 某些情况下,可能需要手动 init 之后才能用 - */ - static initEnv(t) { - this.env = t; - } - /** - * 获取 zhi-env 实例 - 必须在使用的时候重写此方法 - * - * ``` - * if (!this.env) { - * this.env = new Env({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false}) - * } - * return this.env - * ``` - * - * @see {@link https://github.com/terwer/zhi/tree/main/apps/zhi-env#usage docs for zhi-env usage} - */ - static zhiEnv() { - throw new Error("Method 'zhiEnv' must be implemented"); - } - /** - * 获取 zhi-log 实例 - * - * @param sign - 标志 - * @param loggerName - 日志名称 - */ - static zhiLogWithSign(t, a) { - if (this.loggerMap[a]) - return this.loggerMap[a].debug("Zhi-log use cache"), this.loggerMap[a]; - const n = this.env, s = fi.customSignLogFactory(t, n).getLogger(a); - return this.loggerMap[a] = s, s.debug("Zhi-log add new logger"), s; - } - /** - * 获取 zhi-log 实例 - * - * @param loggerName - 日志名称 - */ - static zhiLog(t) { - return this.zhiLogWithSign(J_, t); - } - /** - * 获取 zhi-common 实例 - */ - static zhiCommon() { - return this.common || (this.common = new Ou()), this.common; - } -} -Qe(Ua, "env"), /** -* zhi-util 的日志器缓存 -*/ -Qe(Ua, "loggerMap", {}), /** -* zhi-util 的通用工具类 -*/ -Qe(Ua, "common"); -class mi extends Ua { - static zhiEnv() { - return this.env || (this.env = new L_({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; - } -} -class Cc { - constructor() { - Qe(this, "logger"), this.logger = mi.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); - } - isAvailable() { - return typeof Lute < "u"; - } - /** - * 高亮关键字 - * - * @param str - 字符串 - * @private - */ - highlightWords(t) { - const a = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); - return t.replace(a, '$1'); - } - /** - * 渲染Markdown - * - * @param md - Markdown - */ - async renderMarkdownStr(t) { - if (!this.isAvailable()) - return this.logger.error("Lute is not available, will return original md"), t; - const a = Lute, n = a.New(), s = { - renderText: (c, p) => p ? [this.highlightWords(c.Text()), a.WalkContinue] : ["", a.WalkContinue] - // renderStrong: (node: any, entering: any) => { - // return ["", luteObj.WalkContinue] - // }, - // renderParagraph: (node: any, entering: any) => { - // return ["", luteObj.WalkContinue] - // } - }; - return n.SetJSRenderers({ - renderers: { - Md2HTML: s - } - }), this.logger.info("Lute is rendering md to HTML..."), n.MarkdownStr("", t); - } -} -var ju = { exports: {} }; -(function(e) { - (function() { - function t(r) { - var i = { - omitExtraWLInCodeBlocks: { - defaultValue: !1, - describe: "Omit the default extra whiteline added to code blocks", - type: "boolean" - }, - noHeaderId: { - defaultValue: !1, - describe: "Turn on/off generated header id", - type: "boolean" - }, - prefixHeaderId: { - defaultValue: !1, - describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix", - type: "string" - }, - rawPrefixHeaderId: { - defaultValue: !1, - describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)', - type: "boolean" - }, - ghCompatibleHeaderId: { - defaultValue: !1, - describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", - type: "boolean" - }, - rawHeaderId: { - defaultValue: !1, - describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, - type: "boolean" - }, - headerLevelStart: { - defaultValue: !1, - describe: "The header blocks level start", - type: "integer" - }, - parseImgDimensions: { - defaultValue: !1, - describe: "Turn on/off image dimension parsing", - type: "boolean" - }, - simplifiedAutoLink: { - defaultValue: !1, - describe: "Turn on/off GFM autolink style", - type: "boolean" - }, - excludeTrailingPunctuationFromURLs: { - defaultValue: !1, - describe: "Excludes trailing punctuation from links generated with autoLinking", - type: "boolean" - }, - literalMidWordUnderscores: { - defaultValue: !1, - describe: "Parse midword underscores as literal underscores", - type: "boolean" - }, - literalMidWordAsterisks: { - defaultValue: !1, - describe: "Parse midword asterisks as literal asterisks", - type: "boolean" - }, - strikethrough: { - defaultValue: !1, - describe: "Turn on/off strikethrough support", - type: "boolean" - }, - tables: { - defaultValue: !1, - describe: "Turn on/off tables support", - type: "boolean" - }, - tablesHeaderId: { - defaultValue: !1, - describe: "Add an id to table headers", - type: "boolean" - }, - ghCodeBlocks: { - defaultValue: !0, - describe: "Turn on/off GFM fenced code blocks support", - type: "boolean" - }, - tasklists: { - defaultValue: !1, - describe: "Turn on/off GFM tasklist support", - type: "boolean" - }, - smoothLivePreview: { - defaultValue: !1, - describe: "Prevents weird effects in live previews due to incomplete input", - type: "boolean" - }, - smartIndentationFix: { - defaultValue: !1, - describe: "Tries to smartly fix indentation in es6 strings", - type: "boolean" - }, - disableForced4SpacesIndentedSublists: { - defaultValue: !1, - describe: "Disables the requirement of indenting nested sublists by 4 spaces", - type: "boolean" - }, - simpleLineBreaks: { - defaultValue: !1, - describe: "Parses simple line breaks as
(GFM Style)", - type: "boolean" - }, - requireSpaceBeforeHeadingText: { - defaultValue: !1, - describe: "Makes adding a space between `#` and the header text mandatory (GFM Style)", - type: "boolean" - }, - ghMentions: { - defaultValue: !1, - describe: "Enables github @mentions", - type: "boolean" - }, - ghMentionsLink: { - defaultValue: "https://github.com/{u}", - describe: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", - type: "string" - }, - encodeEmails: { - defaultValue: !0, - describe: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", - type: "boolean" - }, - openLinksInNewWindow: { - defaultValue: !1, - describe: "Open all links in new windows", - type: "boolean" - }, - backslashEscapesHTMLTags: { - defaultValue: !1, - describe: "Support for HTML Tag escaping. ex:
foo
", - type: "boolean" - }, - emoji: { - defaultValue: !1, - describe: "Enable emoji support. Ex: `this is a :smile: emoji`", - type: "boolean" - }, - underline: { - defaultValue: !1, - describe: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``", - type: "boolean" - }, - ellipsis: { - defaultValue: !0, - describe: "Replaces three dots with the ellipsis unicode character", - type: "boolean" - }, - completeHTMLDocument: { - defaultValue: !1, - describe: "Outputs a complete html document, including ``, `` and `` tags", - type: "boolean" - }, - metadata: { - defaultValue: !1, - describe: "Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).", - type: "boolean" - }, - splitAdjacentBlockquotes: { - defaultValue: !1, - describe: "Split adjacent blockquote blocks", - type: "boolean" - } - }; - if (r === !1) - return JSON.parse(JSON.stringify(i)); - var o = {}; - for (var l in i) - i.hasOwnProperty(l) && (o[l] = i[l].defaultValue); - return o; - } - function a() { - var r = t(!0), i = {}; - for (var o in r) - r.hasOwnProperty(o) && (i[o] = !0); - return i; - } - var n = {}, s = {}, c = {}, p = t(!0), b = "vanilla", _ = { - github: { - omitExtraWLInCodeBlocks: !0, - simplifiedAutoLink: !0, - excludeTrailingPunctuationFromURLs: !0, - literalMidWordUnderscores: !0, - strikethrough: !0, - tables: !0, - tablesHeaderId: !0, - ghCodeBlocks: !0, - tasklists: !0, - disableForced4SpacesIndentedSublists: !0, - simpleLineBreaks: !0, - requireSpaceBeforeHeadingText: !0, - ghCompatibleHeaderId: !0, - ghMentions: !0, - backslashEscapesHTMLTags: !0, - emoji: !0, - splitAdjacentBlockquotes: !0 - }, - original: { - noHeaderId: !0, - ghCodeBlocks: !1 - }, - ghost: { - omitExtraWLInCodeBlocks: !0, - parseImgDimensions: !0, - simplifiedAutoLink: !0, - excludeTrailingPunctuationFromURLs: !0, - literalMidWordUnderscores: !0, - strikethrough: !0, - tables: !0, - tablesHeaderId: !0, - ghCodeBlocks: !0, - tasklists: !0, - smoothLivePreview: !0, - simpleLineBreaks: !0, - requireSpaceBeforeHeadingText: !0, - ghMentions: !1, - encodeEmails: !0 - }, - vanilla: t(!0), - allOn: a() - }; - n.helper = {}, n.extensions = {}, n.setOption = function(r, i) { - return p[r] = i, this; - }, n.getOption = function(r) { - return p[r]; - }, n.getOptions = function() { - return p; - }, n.resetOptions = function() { - p = t(!0); - }, n.setFlavor = function(r) { - if (!_.hasOwnProperty(r)) - throw Error(r + " flavor was not found"); - n.resetOptions(); - var i = _[r]; - b = r; - for (var o in i) - i.hasOwnProperty(o) && (p[o] = i[o]); - }, n.getFlavor = function() { - return b; - }, n.getFlavorOptions = function(r) { - if (_.hasOwnProperty(r)) - return _[r]; - }, n.getDefaultOptions = function(r) { - return t(r); - }, n.subParser = function(r, i) { - if (n.helper.isString(r)) - if (typeof i < "u") - s[r] = i; - else { - if (s.hasOwnProperty(r)) - return s[r]; - throw Error("SubParser named " + r + " not registered!"); - } - }, n.extension = function(r, i) { - if (!n.helper.isString(r)) - throw Error("Extension 'name' must be a string"); - if (r = n.helper.stdExtName(r), n.helper.isUndefined(i)) { - if (!c.hasOwnProperty(r)) - throw Error("Extension named " + r + " is not registered!"); - return c[r]; - } else { - typeof i == "function" && (i = i()), n.helper.isArray(i) || (i = [i]); - var o = y(i, r); - if (o.valid) - c[r] = i; - else - throw Error(o.error); - } - }, n.getAllExtensions = function() { - return c; - }, n.removeExtension = function(r) { - delete c[r]; - }, n.resetExtensions = function() { - c = {}; - }; - function y(r, i) { - var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", l = { - valid: !0, - error: "" - }; - n.helper.isArray(r) || (r = [r]); - for (var u = 0; u < r.length; ++u) { - var m = o + " sub-extension " + u + ": ", f = r[u]; - if (typeof f != "object") - return l.valid = !1, l.error = m + "must be an object, but " + typeof f + " given", l; - if (!n.helper.isString(f.type)) - return l.valid = !1, l.error = m + 'property "type" must be a string, but ' + typeof f.type + " given", l; - var x = f.type = f.type.toLowerCase(); - if (x === "language" && (x = f.type = "lang"), x === "html" && (x = f.type = "output"), x !== "lang" && x !== "output" && x !== "listener") - return l.valid = !1, l.error = m + "type " + x + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', l; - if (x === "listener") { - if (n.helper.isUndefined(f.listeners)) - return l.valid = !1, l.error = m + '. Extensions of type "listener" must have a property called "listeners"', l; - } else if (n.helper.isUndefined(f.filter) && n.helper.isUndefined(f.regex)) - return l.valid = !1, l.error = m + x + ' extensions must define either a "regex" property or a "filter" method', l; - if (f.listeners) { - if (typeof f.listeners != "object") - return l.valid = !1, l.error = m + '"listeners" property must be an object but ' + typeof f.listeners + " given", l; - for (var B in f.listeners) - if (f.listeners.hasOwnProperty(B) && typeof f.listeners[B] != "function") - return l.valid = !1, l.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + B + " must be a function but " + typeof f.listeners[B] + " given", l; - } - if (f.filter) { - if (typeof f.filter != "function") - return l.valid = !1, l.error = m + '"filter" must be a function, but ' + typeof f.filter + " given", l; - } else if (f.regex) { - if (n.helper.isString(f.regex) && (f.regex = new RegExp(f.regex, "g")), !(f.regex instanceof RegExp)) - return l.valid = !1, l.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof f.regex + " given", l; - if (n.helper.isUndefined(f.replace)) - return l.valid = !1, l.error = m + '"regex" extensions must implement a replace string or function', l; - } - } - return l; - } - n.validateExtension = function(r) { - var i = y(r, null); - return i.valid ? !0 : (console.warn(i.error), !1); - }, n.hasOwnProperty("helper") || (n.helper = {}), n.helper.isString = function(r) { - return typeof r == "string" || r instanceof String; - }, n.helper.isFunction = function(r) { - var i = {}; - return r && i.toString.call(r) === "[object Function]"; - }, n.helper.isArray = function(r) { - return Array.isArray(r); - }, n.helper.isUndefined = function(r) { - return typeof r > "u"; - }, n.helper.forEach = function(r, i) { - if (n.helper.isUndefined(r)) - throw new Error("obj param is required"); - if (n.helper.isUndefined(i)) - throw new Error("callback param is required"); - if (!n.helper.isFunction(i)) - throw new Error("callback param must be a function/closure"); - if (typeof r.forEach == "function") - r.forEach(i); - else if (n.helper.isArray(r)) - for (var o = 0; o < r.length; o++) - i(r[o], o, r); - else if (typeof r == "object") - for (var l in r) - r.hasOwnProperty(l) && i(r[l], l, r); - else - throw new Error("obj does not seem to be an array or an iterable object"); - }, n.helper.stdExtName = function(r) { - return r.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); - }; - function g(r, i) { - var o = i.charCodeAt(0); - return "¨E" + o + "E"; - } - n.helper.escapeCharactersCallback = g, n.helper.escapeCharacters = function(r, i, o) { - var l = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])"; - o && (l = "\\\\" + l); - var u = new RegExp(l, "g"); - return r = r.replace(u, g), r; - }, n.helper.unescapeHTMLEntities = function(r) { - return r.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); - }; - var S = function(r, i, o, l) { - var u = l || "", m = u.indexOf("g") > -1, f = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), x = new RegExp(i, u.replace(/g/g, "")), B = [], U, z, H, w, q; - do - for (U = 0; H = f.exec(r); ) - if (x.test(H[0])) - U++ || (z = f.lastIndex, w = z - H[0].length); - else if (U && !--U) { - q = H.index + H[0].length; - var W = { - left: { start: w, end: z }, - match: { start: z, end: H.index }, - right: { start: H.index, end: q }, - wholeMatch: { start: w, end: q } - }; - if (B.push(W), !m) - return B; - } - while (U && (f.lastIndex = z)); - return B; - }; - n.helper.matchRecursiveRegExp = function(r, i, o, l) { - for (var u = S(r, i, o, l), m = [], f = 0; f < u.length; ++f) - m.push([ - r.slice(u[f].wholeMatch.start, u[f].wholeMatch.end), - r.slice(u[f].match.start, u[f].match.end), - r.slice(u[f].left.start, u[f].left.end), - r.slice(u[f].right.start, u[f].right.end) - ]); - return m; - }, n.helper.replaceRecursiveRegExp = function(r, i, o, l, u) { - if (!n.helper.isFunction(i)) { - var m = i; - i = function() { - return m; - }; - } - var f = S(r, o, l, u), x = r, B = f.length; - if (B > 0) { - var U = []; - f[0].wholeMatch.start !== 0 && U.push(r.slice(0, f[0].wholeMatch.start)); - for (var z = 0; z < B; ++z) - U.push( - i( - r.slice(f[z].wholeMatch.start, f[z].wholeMatch.end), - r.slice(f[z].match.start, f[z].match.end), - r.slice(f[z].left.start, f[z].left.end), - r.slice(f[z].right.start, f[z].right.end) - ) - ), z < B - 1 && U.push(r.slice(f[z].wholeMatch.end, f[z + 1].wholeMatch.start)); - f[B - 1].wholeMatch.end < r.length && U.push(r.slice(f[B - 1].wholeMatch.end)), x = U.join(""); - } - return x; - }, n.helper.regexIndexOf = function(r, i, o) { - if (!n.helper.isString(r)) - throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; - if (!(i instanceof RegExp)) - throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; - var l = r.substring(o || 0).search(i); - return l >= 0 ? l + (o || 0) : l; - }, n.helper.splitAtIndex = function(r, i) { - if (!n.helper.isString(r)) - throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; - return [r.substring(0, i), r.substring(i)]; - }, n.helper.encodeEmailAddress = function(r) { - var i = [ - function(o) { - return "&#" + o.charCodeAt(0) + ";"; - }, - function(o) { - return "&#x" + o.charCodeAt(0).toString(16) + ";"; - }, - function(o) { - return o; - } - ]; - return r = r.replace(/./g, function(o) { - if (o === "@") - o = i[Math.floor(Math.random() * 2)](o); - else { - var l = Math.random(); - o = l > 0.9 ? i[2](o) : l > 0.45 ? i[1](o) : i[0](o); - } - return o; - }), r; - }, n.helper.padEnd = function(r, i, o) { - return i = i >> 0, o = String(o || " "), r.length > i ? String(r) : (i = i - r.length, i > o.length && (o += o.repeat(i / o.length)), String(r) + o.slice(0, i)); - }, typeof console > "u" && (console = { - warn: function(r) { - alert(r); - }, - log: function(r) { - alert(r); - }, - error: function(r) { - throw r; - } - }), n.helper.regexes = { - asteriskDashAndColon: /([*_:~])/g - }, n.helper.emojis = { - "+1": "👍", - "-1": "👎", - 100: "💯", - 1234: "🔢", - "1st_place_medal": "🥇", - "2nd_place_medal": "🥈", - "3rd_place_medal": "🥉", - "8ball": "🎱", - a: "🅰️", - ab: "🆎", - abc: "🔤", - abcd: "🔡", - accept: "🉑", - aerial_tramway: "🚡", - airplane: "✈️", - alarm_clock: "⏰", - alembic: "⚗️", - alien: "👽", - ambulance: "🚑", - amphora: "🏺", - anchor: "⚓️", - angel: "👼", - anger: "💢", - angry: "😠", - anguished: "😧", - ant: "🐜", - apple: "🍎", - aquarius: "♒️", - aries: "♈️", - arrow_backward: "◀️", - arrow_double_down: "⏬", - arrow_double_up: "⏫", - arrow_down: "⬇️", - arrow_down_small: "🔽", - arrow_forward: "▶️", - arrow_heading_down: "⤵️", - arrow_heading_up: "⤴️", - arrow_left: "⬅️", - arrow_lower_left: "↙️", - arrow_lower_right: "↘️", - arrow_right: "➡️", - arrow_right_hook: "↪️", - arrow_up: "⬆️", - arrow_up_down: "↕️", - arrow_up_small: "🔼", - arrow_upper_left: "↖️", - arrow_upper_right: "↗️", - arrows_clockwise: "🔃", - arrows_counterclockwise: "🔄", - art: "🎨", - articulated_lorry: "🚛", - artificial_satellite: "🛰", - astonished: "😲", - athletic_shoe: "👟", - atm: "🏧", - atom_symbol: "⚛️", - avocado: "🥑", - b: "🅱️", - baby: "👶", - baby_bottle: "🍼", - baby_chick: "🐤", - baby_symbol: "🚼", - back: "🔙", - bacon: "🥓", - badminton: "🏸", - baggage_claim: "🛄", - baguette_bread: "🥖", - balance_scale: "⚖️", - balloon: "🎈", - ballot_box: "🗳", - ballot_box_with_check: "☑️", - bamboo: "🎍", - banana: "🍌", - bangbang: "‼️", - bank: "🏦", - bar_chart: "📊", - barber: "💈", - baseball: "⚾️", - basketball: "🏀", - basketball_man: "⛹️", - basketball_woman: "⛹️‍♀️", - bat: "🦇", - bath: "🛀", - bathtub: "🛁", - battery: "🔋", - beach_umbrella: "🏖", - bear: "🐻", - bed: "🛏", - bee: "🐝", - beer: "🍺", - beers: "🍻", - beetle: "🐞", - beginner: "🔰", - bell: "🔔", - bellhop_bell: "🛎", - bento: "🍱", - biking_man: "🚴", - bike: "🚲", - biking_woman: "🚴‍♀️", - bikini: "👙", - biohazard: "☣️", - bird: "🐦", - birthday: "🎂", - black_circle: "⚫️", - black_flag: "🏴", - black_heart: "🖤", - black_joker: "🃏", - black_large_square: "⬛️", - black_medium_small_square: "◾️", - black_medium_square: "◼️", - black_nib: "✒️", - black_small_square: "▪️", - black_square_button: "🔲", - blonde_man: "👱", - blonde_woman: "👱‍♀️", - blossom: "🌼", - blowfish: "🐡", - blue_book: "📘", - blue_car: "🚙", - blue_heart: "💙", - blush: "😊", - boar: "🐗", - boat: "⛵️", - bomb: "💣", - book: "📖", - bookmark: "🔖", - bookmark_tabs: "📑", - books: "📚", - boom: "💥", - boot: "👢", - bouquet: "💐", - bowing_man: "🙇", - bow_and_arrow: "🏹", - bowing_woman: "🙇‍♀️", - bowling: "🎳", - boxing_glove: "🥊", - boy: "👦", - bread: "🍞", - bride_with_veil: "👰", - bridge_at_night: "🌉", - briefcase: "💼", - broken_heart: "💔", - bug: "🐛", - building_construction: "🏗", - bulb: "💡", - bullettrain_front: "🚅", - bullettrain_side: "🚄", - burrito: "🌯", - bus: "🚌", - business_suit_levitating: "🕴", - busstop: "🚏", - bust_in_silhouette: "👤", - busts_in_silhouette: "👥", - butterfly: "🦋", - cactus: "🌵", - cake: "🍰", - calendar: "📆", - call_me_hand: "🤙", - calling: "📲", - camel: "🐫", - camera: "📷", - camera_flash: "📸", - camping: "🏕", - cancer: "♋️", - candle: "🕯", - candy: "🍬", - canoe: "🛶", - capital_abcd: "🔠", - capricorn: "♑️", - car: "🚗", - card_file_box: "🗃", - card_index: "📇", - card_index_dividers: "🗂", - carousel_horse: "🎠", - carrot: "🥕", - cat: "🐱", - cat2: "🐈", - cd: "💿", - chains: "⛓", - champagne: "🍾", - chart: "💹", - chart_with_downwards_trend: "📉", - chart_with_upwards_trend: "📈", - checkered_flag: "🏁", - cheese: "🧀", - cherries: "🍒", - cherry_blossom: "🌸", - chestnut: "🌰", - chicken: "🐔", - children_crossing: "🚸", - chipmunk: "🐿", - chocolate_bar: "🍫", - christmas_tree: "🎄", - church: "⛪️", - cinema: "🎦", - circus_tent: "🎪", - city_sunrise: "🌇", - city_sunset: "🌆", - cityscape: "🏙", - cl: "🆑", - clamp: "🗜", - clap: "👏", - clapper: "🎬", - classical_building: "🏛", - clinking_glasses: "🥂", - clipboard: "📋", - clock1: "🕐", - clock10: "🕙", - clock1030: "🕥", - clock11: "🕚", - clock1130: "🕦", - clock12: "🕛", - clock1230: "🕧", - clock130: "🕜", - clock2: "🕑", - clock230: "🕝", - clock3: "🕒", - clock330: "🕞", - clock4: "🕓", - clock430: "🕟", - clock5: "🕔", - clock530: "🕠", - clock6: "🕕", - clock630: "🕡", - clock7: "🕖", - clock730: "🕢", - clock8: "🕗", - clock830: "🕣", - clock9: "🕘", - clock930: "🕤", - closed_book: "📕", - closed_lock_with_key: "🔐", - closed_umbrella: "🌂", - cloud: "☁️", - cloud_with_lightning: "🌩", - cloud_with_lightning_and_rain: "⛈", - cloud_with_rain: "🌧", - cloud_with_snow: "🌨", - clown_face: "🤡", - clubs: "♣️", - cocktail: "🍸", - coffee: "☕️", - coffin: "⚰️", - cold_sweat: "😰", - comet: "☄️", - computer: "💻", - computer_mouse: "🖱", - confetti_ball: "🎊", - confounded: "😖", - confused: "😕", - congratulations: "㊗️", - construction: "🚧", - construction_worker_man: "👷", - construction_worker_woman: "👷‍♀️", - control_knobs: "🎛", - convenience_store: "🏪", - cookie: "🍪", - cool: "🆒", - policeman: "👮", - copyright: "©️", - corn: "🌽", - couch_and_lamp: "🛋", - couple: "👫", - couple_with_heart_woman_man: "💑", - couple_with_heart_man_man: "👨‍❤️‍👨", - couple_with_heart_woman_woman: "👩‍❤️‍👩", - couplekiss_man_man: "👨‍❤️‍💋‍👨", - couplekiss_man_woman: "💏", - couplekiss_woman_woman: "👩‍❤️‍💋‍👩", - cow: "🐮", - cow2: "🐄", - cowboy_hat_face: "🤠", - crab: "🦀", - crayon: "🖍", - credit_card: "💳", - crescent_moon: "🌙", - cricket: "🏏", - crocodile: "🐊", - croissant: "🥐", - crossed_fingers: "🤞", - crossed_flags: "🎌", - crossed_swords: "⚔️", - crown: "👑", - cry: "😢", - crying_cat_face: "😿", - crystal_ball: "🔮", - cucumber: "🥒", - cupid: "💘", - curly_loop: "➰", - currency_exchange: "💱", - curry: "🍛", - custard: "🍮", - customs: "🛃", - cyclone: "🌀", - dagger: "🗡", - dancer: "💃", - dancing_women: "👯", - dancing_men: "👯‍♂️", - dango: "🍡", - dark_sunglasses: "🕶", - dart: "🎯", - dash: "💨", - date: "📅", - deciduous_tree: "🌳", - deer: "🦌", - department_store: "🏬", - derelict_house: "🏚", - desert: "🏜", - desert_island: "🏝", - desktop_computer: "🖥", - male_detective: "🕵️", - diamond_shape_with_a_dot_inside: "💠", - diamonds: "♦️", - disappointed: "😞", - disappointed_relieved: "😥", - dizzy: "💫", - dizzy_face: "😵", - do_not_litter: "🚯", - dog: "🐶", - dog2: "🐕", - dollar: "💵", - dolls: "🎎", - dolphin: "🐬", - door: "🚪", - doughnut: "🍩", - dove: "🕊", - dragon: "🐉", - dragon_face: "🐲", - dress: "👗", - dromedary_camel: "🐪", - drooling_face: "🤤", - droplet: "💧", - drum: "🥁", - duck: "🦆", - dvd: "📀", - "e-mail": "📧", - eagle: "🦅", - ear: "👂", - ear_of_rice: "🌾", - earth_africa: "🌍", - earth_americas: "🌎", - earth_asia: "🌏", - egg: "🥚", - eggplant: "🍆", - eight_pointed_black_star: "✴️", - eight_spoked_asterisk: "✳️", - electric_plug: "🔌", - elephant: "🐘", - email: "✉️", - end: "🔚", - envelope_with_arrow: "📩", - euro: "💶", - european_castle: "🏰", - european_post_office: "🏤", - evergreen_tree: "🌲", - exclamation: "❗️", - expressionless: "😑", - eye: "👁", - eye_speech_bubble: "👁‍🗨", - eyeglasses: "👓", - eyes: "👀", - face_with_head_bandage: "🤕", - face_with_thermometer: "🤒", - fist_oncoming: "👊", - factory: "🏭", - fallen_leaf: "🍂", - family_man_woman_boy: "👪", - family_man_boy: "👨‍👦", - family_man_boy_boy: "👨‍👦‍👦", - family_man_girl: "👨‍👧", - family_man_girl_boy: "👨‍👧‍👦", - family_man_girl_girl: "👨‍👧‍👧", - family_man_man_boy: "👨‍👨‍👦", - family_man_man_boy_boy: "👨‍👨‍👦‍👦", - family_man_man_girl: "👨‍👨‍👧", - family_man_man_girl_boy: "👨‍👨‍👧‍👦", - family_man_man_girl_girl: "👨‍👨‍👧‍👧", - family_man_woman_boy_boy: "👨‍👩‍👦‍👦", - family_man_woman_girl: "👨‍👩‍👧", - family_man_woman_girl_boy: "👨‍👩‍👧‍👦", - family_man_woman_girl_girl: "👨‍👩‍👧‍👧", - family_woman_boy: "👩‍👦", - family_woman_boy_boy: "👩‍👦‍👦", - family_woman_girl: "👩‍👧", - family_woman_girl_boy: "👩‍👧‍👦", - family_woman_girl_girl: "👩‍👧‍👧", - family_woman_woman_boy: "👩‍👩‍👦", - family_woman_woman_boy_boy: "👩‍👩‍👦‍👦", - family_woman_woman_girl: "👩‍👩‍👧", - family_woman_woman_girl_boy: "👩‍👩‍👧‍👦", - family_woman_woman_girl_girl: "👩‍👩‍👧‍👧", - fast_forward: "⏩", - fax: "📠", - fearful: "😨", - feet: "🐾", - female_detective: "🕵️‍♀️", - ferris_wheel: "🎡", - ferry: "⛴", - field_hockey: "🏑", - file_cabinet: "🗄", - file_folder: "📁", - film_projector: "📽", - film_strip: "🎞", - fire: "🔥", - fire_engine: "🚒", - fireworks: "🎆", - first_quarter_moon: "🌓", - first_quarter_moon_with_face: "🌛", - fish: "🐟", - fish_cake: "🍥", - fishing_pole_and_fish: "🎣", - fist_raised: "✊", - fist_left: "🤛", - fist_right: "🤜", - flags: "🎏", - flashlight: "🔦", - fleur_de_lis: "⚜️", - flight_arrival: "🛬", - flight_departure: "🛫", - floppy_disk: "💾", - flower_playing_cards: "🎴", - flushed: "😳", - fog: "🌫", - foggy: "🌁", - football: "🏈", - footprints: "👣", - fork_and_knife: "🍴", - fountain: "⛲️", - fountain_pen: "🖋", - four_leaf_clover: "🍀", - fox_face: "🦊", - framed_picture: "🖼", - free: "🆓", - fried_egg: "🍳", - fried_shrimp: "🍤", - fries: "🍟", - frog: "🐸", - frowning: "😦", - frowning_face: "☹️", - frowning_man: "🙍‍♂️", - frowning_woman: "🙍", - middle_finger: "🖕", - fuelpump: "⛽️", - full_moon: "🌕", - full_moon_with_face: "🌝", - funeral_urn: "⚱️", - game_die: "🎲", - gear: "⚙️", - gem: "💎", - gemini: "♊️", - ghost: "👻", - gift: "🎁", - gift_heart: "💝", - girl: "👧", - globe_with_meridians: "🌐", - goal_net: "🥅", - goat: "🐐", - golf: "⛳️", - golfing_man: "🏌️", - golfing_woman: "🏌️‍♀️", - gorilla: "🦍", - grapes: "🍇", - green_apple: "🍏", - green_book: "📗", - green_heart: "💚", - green_salad: "🥗", - grey_exclamation: "❕", - grey_question: "❔", - grimacing: "😬", - grin: "😁", - grinning: "😀", - guardsman: "💂", - guardswoman: "💂‍♀️", - guitar: "🎸", - gun: "🔫", - haircut_woman: "💇", - haircut_man: "💇‍♂️", - hamburger: "🍔", - hammer: "🔨", - hammer_and_pick: "⚒", - hammer_and_wrench: "🛠", - hamster: "🐹", - hand: "✋", - handbag: "👜", - handshake: "🤝", - hankey: "💩", - hatched_chick: "🐥", - hatching_chick: "🐣", - headphones: "🎧", - hear_no_evil: "🙉", - heart: "❤️", - heart_decoration: "💟", - heart_eyes: "😍", - heart_eyes_cat: "😻", - heartbeat: "💓", - heartpulse: "💗", - hearts: "♥️", - heavy_check_mark: "✔️", - heavy_division_sign: "➗", - heavy_dollar_sign: "💲", - heavy_heart_exclamation: "❣️", - heavy_minus_sign: "➖", - heavy_multiplication_x: "✖️", - heavy_plus_sign: "➕", - helicopter: "🚁", - herb: "🌿", - hibiscus: "🌺", - high_brightness: "🔆", - high_heel: "👠", - hocho: "🔪", - hole: "🕳", - honey_pot: "🍯", - horse: "🐴", - horse_racing: "🏇", - hospital: "🏥", - hot_pepper: "🌶", - hotdog: "🌭", - hotel: "🏨", - hotsprings: "♨️", - hourglass: "⌛️", - hourglass_flowing_sand: "⏳", - house: "🏠", - house_with_garden: "🏡", - houses: "🏘", - hugs: "🤗", - hushed: "😯", - ice_cream: "🍨", - ice_hockey: "🏒", - ice_skate: "⛸", - icecream: "🍦", - id: "🆔", - ideograph_advantage: "🉐", - imp: "👿", - inbox_tray: "📥", - incoming_envelope: "📨", - tipping_hand_woman: "💁", - information_source: "ℹ️", - innocent: "😇", - interrobang: "⁉️", - iphone: "📱", - izakaya_lantern: "🏮", - jack_o_lantern: "🎃", - japan: "🗾", - japanese_castle: "🏯", - japanese_goblin: "👺", - japanese_ogre: "👹", - jeans: "👖", - joy: "😂", - joy_cat: "😹", - joystick: "🕹", - kaaba: "🕋", - key: "🔑", - keyboard: "⌨️", - keycap_ten: "🔟", - kick_scooter: "🛴", - kimono: "👘", - kiss: "💋", - kissing: "😗", - kissing_cat: "😽", - kissing_closed_eyes: "😚", - kissing_heart: "😘", - kissing_smiling_eyes: "😙", - kiwi_fruit: "🥝", - koala: "🐨", - koko: "🈁", - label: "🏷", - large_blue_circle: "🔵", - large_blue_diamond: "🔷", - large_orange_diamond: "🔶", - last_quarter_moon: "🌗", - last_quarter_moon_with_face: "🌜", - latin_cross: "✝️", - laughing: "😆", - leaves: "🍃", - ledger: "📒", - left_luggage: "🛅", - left_right_arrow: "↔️", - leftwards_arrow_with_hook: "↩️", - lemon: "🍋", - leo: "♌️", - leopard: "🐆", - level_slider: "🎚", - libra: "♎️", - light_rail: "🚈", - link: "🔗", - lion: "🦁", - lips: "👄", - lipstick: "💄", - lizard: "🦎", - lock: "🔒", - lock_with_ink_pen: "🔏", - lollipop: "🍭", - loop: "➿", - loud_sound: "🔊", - loudspeaker: "📢", - love_hotel: "🏩", - love_letter: "💌", - low_brightness: "🔅", - lying_face: "🤥", - m: "Ⓜ️", - mag: "🔍", - mag_right: "🔎", - mahjong: "🀄️", - mailbox: "📫", - mailbox_closed: "📪", - mailbox_with_mail: "📬", - mailbox_with_no_mail: "📭", - man: "👨", - man_artist: "👨‍🎨", - man_astronaut: "👨‍🚀", - man_cartwheeling: "🤸‍♂️", - man_cook: "👨‍🍳", - man_dancing: "🕺", - man_facepalming: "🤦‍♂️", - man_factory_worker: "👨‍🏭", - man_farmer: "👨‍🌾", - man_firefighter: "👨‍🚒", - man_health_worker: "👨‍⚕️", - man_in_tuxedo: "🤵", - man_judge: "👨‍⚖️", - man_juggling: "🤹‍♂️", - man_mechanic: "👨‍🔧", - man_office_worker: "👨‍💼", - man_pilot: "👨‍✈️", - man_playing_handball: "🤾‍♂️", - man_playing_water_polo: "🤽‍♂️", - man_scientist: "👨‍🔬", - man_shrugging: "🤷‍♂️", - man_singer: "👨‍🎤", - man_student: "👨‍🎓", - man_teacher: "👨‍🏫", - man_technologist: "👨‍💻", - man_with_gua_pi_mao: "👲", - man_with_turban: "👳", - tangerine: "🍊", - mans_shoe: "👞", - mantelpiece_clock: "🕰", - maple_leaf: "🍁", - martial_arts_uniform: "🥋", - mask: "😷", - massage_woman: "💆", - massage_man: "💆‍♂️", - meat_on_bone: "🍖", - medal_military: "🎖", - medal_sports: "🏅", - mega: "📣", - melon: "🍈", - memo: "📝", - men_wrestling: "🤼‍♂️", - menorah: "🕎", - mens: "🚹", - metal: "🤘", - metro: "🚇", - microphone: "🎤", - microscope: "🔬", - milk_glass: "🥛", - milky_way: "🌌", - minibus: "🚐", - minidisc: "💽", - mobile_phone_off: "📴", - money_mouth_face: "🤑", - money_with_wings: "💸", - moneybag: "💰", - monkey: "🐒", - monkey_face: "🐵", - monorail: "🚝", - moon: "🌔", - mortar_board: "🎓", - mosque: "🕌", - motor_boat: "🛥", - motor_scooter: "🛵", - motorcycle: "🏍", - motorway: "🛣", - mount_fuji: "🗻", - mountain: "⛰", - mountain_biking_man: "🚵", - mountain_biking_woman: "🚵‍♀️", - mountain_cableway: "🚠", - mountain_railway: "🚞", - mountain_snow: "🏔", - mouse: "🐭", - mouse2: "🐁", - movie_camera: "🎥", - moyai: "🗿", - mrs_claus: "🤶", - muscle: "💪", - mushroom: "🍄", - musical_keyboard: "🎹", - musical_note: "🎵", - musical_score: "🎼", - mute: "🔇", - nail_care: "💅", - name_badge: "📛", - national_park: "🏞", - nauseated_face: "🤢", - necktie: "👔", - negative_squared_cross_mark: "❎", - nerd_face: "🤓", - neutral_face: "😐", - new: "🆕", - new_moon: "🌑", - new_moon_with_face: "🌚", - newspaper: "📰", - newspaper_roll: "🗞", - next_track_button: "⏭", - ng: "🆖", - no_good_man: "🙅‍♂️", - no_good_woman: "🙅", - night_with_stars: "🌃", - no_bell: "🔕", - no_bicycles: "🚳", - no_entry: "⛔️", - no_entry_sign: "🚫", - no_mobile_phones: "📵", - no_mouth: "😶", - no_pedestrians: "🚷", - no_smoking: "🚭", - "non-potable_water": "🚱", - nose: "👃", - notebook: "📓", - notebook_with_decorative_cover: "📔", - notes: "🎶", - nut_and_bolt: "🔩", - o: "⭕️", - o2: "🅾️", - ocean: "🌊", - octopus: "🐙", - oden: "🍢", - office: "🏢", - oil_drum: "🛢", - ok: "🆗", - ok_hand: "👌", - ok_man: "🙆‍♂️", - ok_woman: "🙆", - old_key: "🗝", - older_man: "👴", - older_woman: "👵", - om: "🕉", - on: "🔛", - oncoming_automobile: "🚘", - oncoming_bus: "🚍", - oncoming_police_car: "🚔", - oncoming_taxi: "🚖", - open_file_folder: "📂", - open_hands: "👐", - open_mouth: "😮", - open_umbrella: "☂️", - ophiuchus: "⛎", - orange_book: "📙", - orthodox_cross: "☦️", - outbox_tray: "📤", - owl: "🦉", - ox: "🐂", - package: "📦", - page_facing_up: "📄", - page_with_curl: "📃", - pager: "📟", - paintbrush: "🖌", - palm_tree: "🌴", - pancakes: "🥞", - panda_face: "🐼", - paperclip: "📎", - paperclips: "🖇", - parasol_on_ground: "⛱", - parking: "🅿️", - part_alternation_mark: "〽️", - partly_sunny: "⛅️", - passenger_ship: "🛳", - passport_control: "🛂", - pause_button: "⏸", - peace_symbol: "☮️", - peach: "🍑", - peanuts: "🥜", - pear: "🍐", - pen: "🖊", - pencil2: "✏️", - penguin: "🐧", - pensive: "😔", - performing_arts: "🎭", - persevere: "😣", - person_fencing: "🤺", - pouting_woman: "🙎", - phone: "☎️", - pick: "⛏", - pig: "🐷", - pig2: "🐖", - pig_nose: "🐽", - pill: "💊", - pineapple: "🍍", - ping_pong: "🏓", - pisces: "♓️", - pizza: "🍕", - place_of_worship: "🛐", - plate_with_cutlery: "🍽", - play_or_pause_button: "⏯", - point_down: "👇", - point_left: "👈", - point_right: "👉", - point_up: "☝️", - point_up_2: "👆", - police_car: "🚓", - policewoman: "👮‍♀️", - poodle: "🐩", - popcorn: "🍿", - post_office: "🏣", - postal_horn: "📯", - postbox: "📮", - potable_water: "🚰", - potato: "🥔", - pouch: "👝", - poultry_leg: "🍗", - pound: "💷", - rage: "😡", - pouting_cat: "😾", - pouting_man: "🙎‍♂️", - pray: "🙏", - prayer_beads: "📿", - pregnant_woman: "🤰", - previous_track_button: "⏮", - prince: "🤴", - princess: "👸", - printer: "🖨", - purple_heart: "💜", - purse: "👛", - pushpin: "📌", - put_litter_in_its_place: "🚮", - question: "❓", - rabbit: "🐰", - rabbit2: "🐇", - racehorse: "🐎", - racing_car: "🏎", - radio: "📻", - radio_button: "🔘", - radioactive: "☢️", - railway_car: "🚃", - railway_track: "🛤", - rainbow: "🌈", - rainbow_flag: "🏳️‍🌈", - raised_back_of_hand: "🤚", - raised_hand_with_fingers_splayed: "🖐", - raised_hands: "🙌", - raising_hand_woman: "🙋", - raising_hand_man: "🙋‍♂️", - ram: "🐏", - ramen: "🍜", - rat: "🐀", - record_button: "⏺", - recycle: "♻️", - red_circle: "🔴", - registered: "®️", - relaxed: "☺️", - relieved: "😌", - reminder_ribbon: "🎗", - repeat: "🔁", - repeat_one: "🔂", - rescue_worker_helmet: "⛑", - restroom: "🚻", - revolving_hearts: "💞", - rewind: "⏪", - rhinoceros: "🦏", - ribbon: "🎀", - rice: "🍚", - rice_ball: "🍙", - rice_cracker: "🍘", - rice_scene: "🎑", - right_anger_bubble: "🗯", - ring: "💍", - robot: "🤖", - rocket: "🚀", - rofl: "🤣", - roll_eyes: "🙄", - roller_coaster: "🎢", - rooster: "🐓", - rose: "🌹", - rosette: "🏵", - rotating_light: "🚨", - round_pushpin: "📍", - rowing_man: "🚣", - rowing_woman: "🚣‍♀️", - rugby_football: "🏉", - running_man: "🏃", - running_shirt_with_sash: "🎽", - running_woman: "🏃‍♀️", - sa: "🈂️", - sagittarius: "♐️", - sake: "🍶", - sandal: "👡", - santa: "🎅", - satellite: "📡", - saxophone: "🎷", - school: "🏫", - school_satchel: "🎒", - scissors: "✂️", - scorpion: "🦂", - scorpius: "♏️", - scream: "😱", - scream_cat: "🙀", - scroll: "📜", - seat: "💺", - secret: "㊙️", - see_no_evil: "🙈", - seedling: "🌱", - selfie: "🤳", - shallow_pan_of_food: "🥘", - shamrock: "☘️", - shark: "🦈", - shaved_ice: "🍧", - sheep: "🐑", - shell: "🐚", - shield: "🛡", - shinto_shrine: "⛩", - ship: "🚢", - shirt: "👕", - shopping: "🛍", - shopping_cart: "🛒", - shower: "🚿", - shrimp: "🦐", - signal_strength: "📶", - six_pointed_star: "🔯", - ski: "🎿", - skier: "⛷", - skull: "💀", - skull_and_crossbones: "☠️", - sleeping: "😴", - sleeping_bed: "🛌", - sleepy: "😪", - slightly_frowning_face: "🙁", - slightly_smiling_face: "🙂", - slot_machine: "🎰", - small_airplane: "🛩", - small_blue_diamond: "🔹", - small_orange_diamond: "🔸", - small_red_triangle: "🔺", - small_red_triangle_down: "🔻", - smile: "😄", - smile_cat: "😸", - smiley: "😃", - smiley_cat: "😺", - smiling_imp: "😈", - smirk: "😏", - smirk_cat: "😼", - smoking: "🚬", - snail: "🐌", - snake: "🐍", - sneezing_face: "🤧", - snowboarder: "🏂", - snowflake: "❄️", - snowman: "⛄️", - snowman_with_snow: "☃️", - sob: "😭", - soccer: "⚽️", - soon: "🔜", - sos: "🆘", - sound: "🔉", - space_invader: "👾", - spades: "♠️", - spaghetti: "🍝", - sparkle: "❇️", - sparkler: "🎇", - sparkles: "✨", - sparkling_heart: "💖", - speak_no_evil: "🙊", - speaker: "🔈", - speaking_head: "🗣", - speech_balloon: "💬", - speedboat: "🚤", - spider: "🕷", - spider_web: "🕸", - spiral_calendar: "🗓", - spiral_notepad: "🗒", - spoon: "🥄", - squid: "🦑", - stadium: "🏟", - star: "⭐️", - star2: "🌟", - star_and_crescent: "☪️", - star_of_david: "✡️", - stars: "🌠", - station: "🚉", - statue_of_liberty: "🗽", - steam_locomotive: "🚂", - stew: "🍲", - stop_button: "⏹", - stop_sign: "🛑", - stopwatch: "⏱", - straight_ruler: "📏", - strawberry: "🍓", - stuck_out_tongue: "😛", - stuck_out_tongue_closed_eyes: "😝", - stuck_out_tongue_winking_eye: "😜", - studio_microphone: "🎙", - stuffed_flatbread: "🥙", - sun_behind_large_cloud: "🌥", - sun_behind_rain_cloud: "🌦", - sun_behind_small_cloud: "🌤", - sun_with_face: "🌞", - sunflower: "🌻", - sunglasses: "😎", - sunny: "☀️", - sunrise: "🌅", - sunrise_over_mountains: "🌄", - surfing_man: "🏄", - surfing_woman: "🏄‍♀️", - sushi: "🍣", - suspension_railway: "🚟", - sweat: "😓", - sweat_drops: "💦", - sweat_smile: "😅", - sweet_potato: "🍠", - swimming_man: "🏊", - swimming_woman: "🏊‍♀️", - symbols: "🔣", - synagogue: "🕍", - syringe: "💉", - taco: "🌮", - tada: "🎉", - tanabata_tree: "🎋", - taurus: "♉️", - taxi: "🚕", - tea: "🍵", - telephone_receiver: "📞", - telescope: "🔭", - tennis: "🎾", - tent: "⛺️", - thermometer: "🌡", - thinking: "🤔", - thought_balloon: "💭", - ticket: "🎫", - tickets: "🎟", - tiger: "🐯", - tiger2: "🐅", - timer_clock: "⏲", - tipping_hand_man: "💁‍♂️", - tired_face: "😫", - tm: "™️", - toilet: "🚽", - tokyo_tower: "🗼", - tomato: "🍅", - tongue: "👅", - top: "🔝", - tophat: "🎩", - tornado: "🌪", - trackball: "🖲", - tractor: "🚜", - traffic_light: "🚥", - train: "🚋", - train2: "🚆", - tram: "🚊", - triangular_flag_on_post: "🚩", - triangular_ruler: "📐", - trident: "🔱", - triumph: "😤", - trolleybus: "🚎", - trophy: "🏆", - tropical_drink: "🍹", - tropical_fish: "🐠", - truck: "🚚", - trumpet: "🎺", - tulip: "🌷", - tumbler_glass: "🥃", - turkey: "🦃", - turtle: "🐢", - tv: "📺", - twisted_rightwards_arrows: "🔀", - two_hearts: "💕", - two_men_holding_hands: "👬", - two_women_holding_hands: "👭", - u5272: "🈹", - u5408: "🈴", - u55b6: "🈺", - u6307: "🈯️", - u6708: "🈷️", - u6709: "🈶", - u6e80: "🈵", - u7121: "🈚️", - u7533: "🈸", - u7981: "🈲", - u7a7a: "🈳", - umbrella: "☔️", - unamused: "😒", - underage: "🔞", - unicorn: "🦄", - unlock: "🔓", - up: "🆙", - upside_down_face: "🙃", - v: "✌️", - vertical_traffic_light: "🚦", - vhs: "📼", - vibration_mode: "📳", - video_camera: "📹", - video_game: "🎮", - violin: "🎻", - virgo: "♍️", - volcano: "🌋", - volleyball: "🏐", - vs: "🆚", - vulcan_salute: "🖖", - walking_man: "🚶", - walking_woman: "🚶‍♀️", - waning_crescent_moon: "🌘", - waning_gibbous_moon: "🌖", - warning: "⚠️", - wastebasket: "🗑", - watch: "⌚️", - water_buffalo: "🐃", - watermelon: "🍉", - wave: "👋", - wavy_dash: "〰️", - waxing_crescent_moon: "🌒", - wc: "🚾", - weary: "😩", - wedding: "💒", - weight_lifting_man: "🏋️", - weight_lifting_woman: "🏋️‍♀️", - whale: "🐳", - whale2: "🐋", - wheel_of_dharma: "☸️", - wheelchair: "♿️", - white_check_mark: "✅", - white_circle: "⚪️", - white_flag: "🏳️", - white_flower: "💮", - white_large_square: "⬜️", - white_medium_small_square: "◽️", - white_medium_square: "◻️", - white_small_square: "▫️", - white_square_button: "🔳", - wilted_flower: "🥀", - wind_chime: "🎐", - wind_face: "🌬", - wine_glass: "🍷", - wink: "😉", - wolf: "🐺", - woman: "👩", - woman_artist: "👩‍🎨", - woman_astronaut: "👩‍🚀", - woman_cartwheeling: "🤸‍♀️", - woman_cook: "👩‍🍳", - woman_facepalming: "🤦‍♀️", - woman_factory_worker: "👩‍🏭", - woman_farmer: "👩‍🌾", - woman_firefighter: "👩‍🚒", - woman_health_worker: "👩‍⚕️", - woman_judge: "👩‍⚖️", - woman_juggling: "🤹‍♀️", - woman_mechanic: "👩‍🔧", - woman_office_worker: "👩‍💼", - woman_pilot: "👩‍✈️", - woman_playing_handball: "🤾‍♀️", - woman_playing_water_polo: "🤽‍♀️", - woman_scientist: "👩‍🔬", - woman_shrugging: "🤷‍♀️", - woman_singer: "👩‍🎤", - woman_student: "👩‍🎓", - woman_teacher: "👩‍🏫", - woman_technologist: "👩‍💻", - woman_with_turban: "👳‍♀️", - womans_clothes: "👚", - womans_hat: "👒", - women_wrestling: "🤼‍♀️", - womens: "🚺", - world_map: "🗺", - worried: "😟", - wrench: "🔧", - writing_hand: "✍️", - x: "❌", - yellow_heart: "💛", - yen: "💴", - yin_yang: "☯️", - yum: "😋", - zap: "⚡️", - zipper_mouth_face: "🤐", - zzz: "💤", - /* special emojis :P */ - octocat: ':octocat:', - showdown: `S` - }, n.Converter = function(r) { - var i = {}, o = [], l = [], u = {}, m = b, f = { - parsed: {}, - raw: "", - format: "" - }; - x(); - function x() { - r = r || {}; - for (var w in p) - p.hasOwnProperty(w) && (i[w] = p[w]); - if (typeof r == "object") - for (var q in r) - r.hasOwnProperty(q) && (i[q] = r[q]); - else - throw Error("Converter expects the passed parameter to be an object, but " + typeof r + " was passed instead."); - i.extensions && n.helper.forEach(i.extensions, B); - } - function B(w, q) { - if (q = q || null, n.helper.isString(w)) - if (w = n.helper.stdExtName(w), q = w, n.extensions[w]) { - console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), U(n.extensions[w], w); - return; - } else if (!n.helper.isUndefined(c[w])) - w = c[w]; - else - throw Error('Extension "' + w + '" could not be loaded. It was either not found or is not a valid extension.'); - typeof w == "function" && (w = w()), n.helper.isArray(w) || (w = [w]); - var W = y(w, q); - if (!W.valid) - throw Error(W.error); - for (var J = 0; J < w.length; ++J) { - switch (w[J].type) { - case "lang": - o.push(w[J]); - break; - case "output": - l.push(w[J]); - break; - } - if (w[J].hasOwnProperty("listeners")) - for (var V in w[J].listeners) - w[J].listeners.hasOwnProperty(V) && z(V, w[J].listeners[V]); - } - } - function U(w, q) { - typeof w == "function" && (w = w(new n.Converter())), n.helper.isArray(w) || (w = [w]); - var W = y(w, q); - if (!W.valid) - throw Error(W.error); - for (var J = 0; J < w.length; ++J) - switch (w[J].type) { - case "lang": - o.push(w[J]); - break; - case "output": - l.push(w[J]); - break; - default: - throw Error("Extension loader error: Type unrecognized!!!"); - } - } - function z(w, q) { - if (!n.helper.isString(w)) - throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof w + " given"); - if (typeof q != "function") - throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof q + " given"); - u.hasOwnProperty(w) || (u[w] = []), u[w].push(q); - } - function H(w) { - var q = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + q + "}", "gm"); - return w.replace(W, ""); - } - this._dispatch = function(w, q, W, J) { - if (u.hasOwnProperty(w)) - for (var V = 0; V < u[w].length; ++V) { - var E = u[w][V](w, q, this, W, J); - E && typeof E < "u" && (q = E); - } - return q; - }, this.listen = function(w, q) { - return z(w, q), this; - }, this.makeHtml = function(w) { - if (!w) - return w; - var q = { - gHtmlBlocks: [], - gHtmlMdBlocks: [], - gHtmlSpans: [], - gUrls: {}, - gTitles: {}, - gDimensions: {}, - gListLevel: 0, - hashLinkCounts: {}, - langExtensions: o, - outputModifiers: l, - converter: this, - ghCodeBlocks: [], - metadata: { - parsed: {}, - raw: "", - format: "" - } - }; - return w = w.replace(/¨/g, "¨T"), w = w.replace(/\$/g, "¨D"), w = w.replace(/\r\n/g, ` -`), w = w.replace(/\r/g, ` -`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = H(w)), w = ` - -` + w + ` - -`, w = n.subParser("detab")(w, i, q), w = w.replace(/^[ \t]+$/mg, ""), n.helper.forEach(o, function(W) { - w = n.subParser("runExtension")(W, w, i, q); - }), w = n.subParser("metadata")(w, i, q), w = n.subParser("hashPreCodeTags")(w, i, q), w = n.subParser("githubCodeBlocks")(w, i, q), w = n.subParser("hashHTMLBlocks")(w, i, q), w = n.subParser("hashCodeTags")(w, i, q), w = n.subParser("stripLinkDefinitions")(w, i, q), w = n.subParser("blockGamut")(w, i, q), w = n.subParser("unhashHTMLSpans")(w, i, q), w = n.subParser("unescapeSpecialChars")(w, i, q), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = n.subParser("completeHTMLDocument")(w, i, q), n.helper.forEach(l, function(W) { - w = n.subParser("runExtension")(W, w, i, q); - }), f = q.metadata, w; - }, this.makeMarkdown = this.makeMd = function(w, q) { - if (w = w.replace(/\r\n/g, ` -`), w = w.replace(/\r/g, ` -`), w = w.replace(/>[ \t]+¨NBSP;<"), !q) - if (window && window.document) - q = window.document; - else - throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"); - var W = q.createElement("div"); - W.innerHTML = w; - var J = { - preList: d(W) - }; - O(W); - for (var V = W.childNodes, E = "", F = 0; F < V.length; F++) - E += n.subParser("makeMarkdown.node")(V[F], J); - function O(k) { - for (var R = 0; R < k.childNodes.length; ++R) { - var G = k.childNodes[R]; - G.nodeType === 3 ? !/\S/.test(G.nodeValue) && !/^[ ]+$/.test(G.nodeValue) ? (k.removeChild(G), --R) : (G.nodeValue = G.nodeValue.split(` -`).join(" "), G.nodeValue = G.nodeValue.replace(/(\s)+/g, "$1")) : G.nodeType === 1 && O(G); - } - } - function d(k) { - for (var R = k.querySelectorAll("pre"), G = [], K = 0; K < R.length; ++K) - if (R[K].childElementCount === 1 && R[K].firstChild.tagName.toLowerCase() === "code") { - var X = R[K].firstChild.innerHTML.trim(), ee = R[K].firstChild.getAttribute("data-language") || ""; - if (ee === "") - for (var ie = R[K].firstChild.className.split(" "), xe = 0; xe < ie.length; ++xe) { - var qe = ie[xe].match(/^language-(.+)$/); - if (qe !== null) { - ee = qe[1]; - break; - } - } - X = n.helper.unescapeHTMLEntities(X), G.push(X), R[K].outerHTML = ''; - } else - G.push(R[K].innerHTML), R[K].innerHTML = "", R[K].setAttribute("prenum", K.toString()); - return G; - } - return E; - }, this.setOption = function(w, q) { - i[w] = q; - }, this.getOption = function(w) { - return i[w]; - }, this.getOptions = function() { - return i; - }, this.addExtension = function(w, q) { - q = q || null, B(w, q); - }, this.useExtension = function(w) { - B(w); - }, this.setFlavor = function(w) { - if (!_.hasOwnProperty(w)) - throw Error(w + " flavor was not found"); - var q = _[w]; - m = w; - for (var W in q) - q.hasOwnProperty(W) && (i[W] = q[W]); - }, this.getFlavor = function() { - return m; - }, this.removeExtension = function(w) { - n.helper.isArray(w) || (w = [w]); - for (var q = 0; q < w.length; ++q) { - for (var W = w[q], J = 0; J < o.length; ++J) - o[J] === W && o.splice(J, 1); - for (var V = 0; V < l.length; ++V) - l[V] === W && l.splice(V, 1); - } - }, this.getAllExtensions = function() { - return { - language: o, - output: l - }; - }, this.getMetadata = function(w) { - return w ? f.raw : f.parsed; - }, this.getMetadataFormat = function() { - return f.format; - }, this._setMetadataPair = function(w, q) { - f.parsed[w] = q; - }, this._setMetadataFormat = function(w) { - f.format = w; - }, this._setMetadataRaw = function(w) { - f.raw = w; - }; - }, n.subParser("anchors", function(r, i, o) { - r = o.converter._dispatch("anchors.before", r, i, o); - var l = function(u, m, f, x, B, U, z) { - if (n.helper.isUndefined(z) && (z = ""), f = f.toLowerCase(), u.search(/\(? ?(['"].*['"])?\)$/m) > -1) - x = ""; - else if (!x) - if (f || (f = m.toLowerCase().replace(/ ?\n/g, " ")), x = "#" + f, !n.helper.isUndefined(o.gUrls[f])) - x = o.gUrls[f], n.helper.isUndefined(o.gTitles[f]) || (z = o.gTitles[f]); - else - return u; - x = x.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var H = '", H; - }; - return r = r.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, l), r = r.replace( - /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, - l - ), r = r.replace( - /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, - l - ), r = r.replace(/\[([^\[\]]+)]()()()()()/g, l), i.ghMentions && (r = r.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(u, m, f, x, B) { - if (f === "\\") - return m + x; - if (!n.helper.isString(i.ghMentionsLink)) - throw new Error("ghMentionsLink option must be a string"); - var U = i.ghMentionsLink.replace(/\{u}/g, B), z = ""; - return i.openLinksInNewWindow && (z = ' rel="noopener noreferrer" target="¨E95Eblank"'), m + '" + x + ""; - })), r = o.converter._dispatch("anchors.after", r, i, o), r; - }); - var L = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, A = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, N = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, C = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, T = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, v = function(r) { - return function(i, o, l, u, m, f, x) { - l = l.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var B = l, U = "", z = "", H = o || "", w = x || ""; - return /^www\./i.test(l) && (l = l.replace(/^www\./i, "http://www.")), r.excludeTrailingPunctuationFromURLs && f && (U = f), r.openLinksInNewWindow && (z = ' rel="noopener noreferrer" target="¨E95Eblank"'), H + '" + B + "" + U + w; - }; - }, j = function(r, i) { - return function(o, l, u) { - var m = "mailto:"; - return l = l || "", u = n.subParser("unescapeSpecialChars")(u, r, i), r.encodeEmails ? (m = n.helper.encodeEmailAddress(m + u), u = n.helper.encodeEmailAddress(u)) : m = m + u, l + '' + u + ""; - }; - }; - n.subParser("autoLinks", function(r, i, o) { - return r = o.converter._dispatch("autoLinks.before", r, i, o), r = r.replace(N, v(i)), r = r.replace(T, j(i, o)), r = o.converter._dispatch("autoLinks.after", r, i, o), r; - }), n.subParser("simplifiedAutoLinks", function(r, i, o) { - return i.simplifiedAutoLink && (r = o.converter._dispatch("simplifiedAutoLinks.before", r, i, o), i.excludeTrailingPunctuationFromURLs ? r = r.replace(A, v(i)) : r = r.replace(L, v(i)), r = r.replace(C, j(i, o)), r = o.converter._dispatch("simplifiedAutoLinks.after", r, i, o)), r; - }), n.subParser("blockGamut", function(r, i, o) { - return r = o.converter._dispatch("blockGamut.before", r, i, o), r = n.subParser("blockQuotes")(r, i, o), r = n.subParser("headers")(r, i, o), r = n.subParser("horizontalRule")(r, i, o), r = n.subParser("lists")(r, i, o), r = n.subParser("codeBlocks")(r, i, o), r = n.subParser("tables")(r, i, o), r = n.subParser("hashHTMLBlocks")(r, i, o), r = n.subParser("paragraphs")(r, i, o), r = o.converter._dispatch("blockGamut.after", r, i, o), r; - }), n.subParser("blockQuotes", function(r, i, o) { - r = o.converter._dispatch("blockQuotes.before", r, i, o), r = r + ` - -`; - var l = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; - return i.splitAdjacentBlockquotes && (l = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), r = r.replace(l, function(u) { - return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = n.subParser("githubCodeBlocks")(u, i, o), u = n.subParser("blockGamut")(u, i, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(m, f) {
-          var x = f;
-          return x = x.replace(/^  /mg, "¨0"), x = x.replace(/¨0/g, ""), x;
-        }), n.subParser("hashBlock")(`
-` + u + ` -
`, i, o); - }), r = o.converter._dispatch("blockQuotes.after", r, i, o), r; - }), n.subParser("codeBlocks", function(r, i, o) { - r = o.converter._dispatch("codeBlocks.before", r, i, o), r += "¨0"; - var l = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; - return r = r.replace(l, function(u, m, f) { - var x = m, B = f, U = ` -`; - return x = n.subParser("outdent")(x, i, o), x = n.subParser("encodeCode")(x, i, o), x = n.subParser("detab")(x, i, o), x = x.replace(/^\n+/g, ""), x = x.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (U = ""), x = "
" + x + U + "
", n.subParser("hashBlock")(x, i, o) + B; - }), r = r.replace(/¨0/, ""), r = o.converter._dispatch("codeBlocks.after", r, i, o), r; - }), n.subParser("codeSpans", function(r, i, o) { - return r = o.converter._dispatch("codeSpans.before", r, i, o), typeof r > "u" && (r = ""), r = r.replace( - /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, - function(l, u, m, f) { - var x = f; - return x = x.replace(/^([ \t]*)/g, ""), x = x.replace(/[ \t]*$/g, ""), x = n.subParser("encodeCode")(x, i, o), x = u + "" + x + "", x = n.subParser("hashHTMLSpans")(x, i, o), x; - } - ), r = o.converter._dispatch("codeSpans.after", r, i, o), r; - }), n.subParser("completeHTMLDocument", function(r, i, o) { - if (!i.completeHTMLDocument) - return r; - r = o.converter._dispatch("completeHTMLDocument.before", r, i, o); - var l = "html", u = ` -`, m = "", f = ` -`, x = "", B = ""; - typeof o.metadata.parsed.doctype < "u" && (u = " -`, l = o.metadata.parsed.doctype.toString().toLowerCase(), (l === "html" || l === "html5") && (f = '')); - for (var U in o.metadata.parsed) - if (o.metadata.parsed.hasOwnProperty(U)) - switch (U.toLowerCase()) { - case "doctype": - break; - case "title": - m = "" + o.metadata.parsed.title + ` -`; - break; - case "charset": - l === "html" || l === "html5" ? f = ' -` : f = ' -`; - break; - case "language": - case "lang": - x = ' lang="' + o.metadata.parsed[U] + '"', B += ' -`; - break; - default: - B += ' -`; - } - return r = u + " - -` + m + f + B + ` - -` + r.trim() + ` - -`, r = o.converter._dispatch("completeHTMLDocument.after", r, i, o), r; - }), n.subParser("detab", function(r, i, o) { - return r = o.converter._dispatch("detab.before", r, i, o), r = r.replace(/\t(?=\t)/g, " "), r = r.replace(/\t/g, "¨A¨B"), r = r.replace(/¨B(.+?)¨A/g, function(l, u) { - for (var m = u, f = 4 - m.length % 4, x = 0; x < f; x++) - m += " "; - return m; - }), r = r.replace(/¨A/g, " "), r = r.replace(/¨B/g, ""), r = o.converter._dispatch("detab.after", r, i, o), r; - }), n.subParser("ellipsis", function(r, i, o) { - return i.ellipsis && (r = o.converter._dispatch("ellipsis.before", r, i, o), r = r.replace(/\.\.\./g, "…"), r = o.converter._dispatch("ellipsis.after", r, i, o)), r; - }), n.subParser("emoji", function(r, i, o) { - if (!i.emoji) - return r; - r = o.converter._dispatch("emoji.before", r, i, o); - var l = /:([\S]+?):/g; - return r = r.replace(l, function(u, m) { - return n.helper.emojis.hasOwnProperty(m) ? n.helper.emojis[m] : u; - }), r = o.converter._dispatch("emoji.after", r, i, o), r; - }), n.subParser("encodeAmpsAndAngles", function(r, i, o) { - return r = o.converter._dispatch("encodeAmpsAndAngles.before", r, i, o), r = r.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), r = r.replace(/<(?![a-z\/?$!])/gi, "<"), r = r.replace(//g, ">"), r = o.converter._dispatch("encodeAmpsAndAngles.after", r, i, o), r; - }), n.subParser("encodeBackslashEscapes", function(r, i, o) { - return r = o.converter._dispatch("encodeBackslashEscapes.before", r, i, o), r = r.replace(/\\(\\)/g, n.helper.escapeCharactersCallback), r = r.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeBackslashEscapes.after", r, i, o), r; - }), n.subParser("encodeCode", function(r, i, o) { - return r = o.converter._dispatch("encodeCode.before", r, i, o), r = r.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeCode.after", r, i, o), r; - }), n.subParser("escapeSpecialCharsWithinTagAttributes", function(r, i, o) { - r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", r, i, o); - var l = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, u = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; - return r = r.replace(l, function(m) { - return m.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, n.helper.escapeCharactersCallback); - }), r = r.replace(u, function(m) { - return m.replace(/([\\`*_~=|])/g, n.helper.escapeCharactersCallback); - }), r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", r, i, o), r; - }), n.subParser("githubCodeBlocks", function(r, i, o) { - return i.ghCodeBlocks ? (r = o.converter._dispatch("githubCodeBlocks.before", r, i, o), r += "¨0", r = r.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(l, u, m, f) { - var x = i.omitExtraWLInCodeBlocks ? "" : ` -`; - return f = n.subParser("encodeCode")(f, i, o), f = n.subParser("detab")(f, i, o), f = f.replace(/^\n+/g, ""), f = f.replace(/\n+$/g, ""), f = "
" + f + x + "
", f = n.subParser("hashBlock")(f, i, o), ` - -¨G` + (o.ghCodeBlocks.push({ text: l, codeblock: f }) - 1) + `G - -`; - }), r = r.replace(/¨0/, ""), o.converter._dispatch("githubCodeBlocks.after", r, i, o)) : r; - }), n.subParser("hashBlock", function(r, i, o) { - return r = o.converter._dispatch("hashBlock.before", r, i, o), r = r.replace(/(^\n+|\n+$)/g, ""), r = ` - -¨K` + (o.gHtmlBlocks.push(r) - 1) + `K - -`, r = o.converter._dispatch("hashBlock.after", r, i, o), r; - }), n.subParser("hashCodeTags", function(r, i, o) { - r = o.converter._dispatch("hashCodeTags.before", r, i, o); - var l = function(u, m, f, x) { - var B = f + n.subParser("encodeCode")(m, i, o) + x; - return "¨C" + (o.gHtmlSpans.push(B) - 1) + "C"; - }; - return r = n.helper.replaceRecursiveRegExp(r, l, "]*>", "", "gim"), r = o.converter._dispatch("hashCodeTags.after", r, i, o), r; - }), n.subParser("hashElement", function(r, i, o) { - return function(l, u) { - var m = u; - return m = m.replace(/\n\n/g, ` -`), m = m.replace(/^\n/, ""), m = m.replace(/\n+$/g, ""), m = ` - -¨K` + (o.gHtmlBlocks.push(m) - 1) + `K - -`, m; - }; - }), n.subParser("hashHTMLBlocks", function(r, i, o) { - r = o.converter._dispatch("hashHTMLBlocks.before", r, i, o); - var l = [ - "pre", - "div", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "blockquote", - "table", - "dl", - "ol", - "ul", - "script", - "noscript", - "form", - "fieldset", - "iframe", - "math", - "style", - "section", - "header", - "footer", - "nav", - "article", - "aside", - "address", - "audio", - "canvas", - "figure", - "hgroup", - "output", - "video", - "p" - ], u = function(w, q, W, J) { - var V = w; - return W.search(/\bmarkdown\b/) !== -1 && (V = W + o.converter.makeHtml(q) + J), ` - -¨K` + (o.gHtmlBlocks.push(V) - 1) + `K - -`; - }; - i.backslashEscapesHTMLTags && (r = r.replace(/\\<(\/?[^>]+?)>/g, function(w, q) { - return "<" + q + ">"; - })); - for (var m = 0; m < l.length; ++m) - for (var f, x = new RegExp("^ {0,3}(<" + l[m] + "\\b[^>]*>)", "im"), B = "<" + l[m] + "\\b[^>]*>", U = ""; (f = n.helper.regexIndexOf(r, x)) !== -1; ) { - var z = n.helper.splitAtIndex(r, f), H = n.helper.replaceRecursiveRegExp(z[1], u, B, U, "im"); - if (H === z[1]) - break; - r = z[0].concat(H); - } - return r = r.replace( - /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, - n.subParser("hashElement")(r, i, o) - ), r = n.helper.replaceRecursiveRegExp(r, function(w) { - return ` - -¨K` + (o.gHtmlBlocks.push(w) - 1) + `K - -`; - }, "^ {0,3}", "gm"), r = r.replace( - /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, - n.subParser("hashElement")(r, i, o) - ), r = o.converter._dispatch("hashHTMLBlocks.after", r, i, o), r; - }), n.subParser("hashHTMLSpans", function(r, i, o) { - r = o.converter._dispatch("hashHTMLSpans.before", r, i, o); - function l(u) { - return "¨C" + (o.gHtmlSpans.push(u) - 1) + "C"; - } - return r = r.replace(/<[^>]+?\/>/gi, function(u) { - return l(u); - }), r = r.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(u) { - return l(u); - }), r = r.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(u) { - return l(u); - }), r = r.replace(/<[^>]+?>/gi, function(u) { - return l(u); - }), r = o.converter._dispatch("hashHTMLSpans.after", r, i, o), r; - }), n.subParser("unhashHTMLSpans", function(r, i, o) { - r = o.converter._dispatch("unhashHTMLSpans.before", r, i, o); - for (var l = 0; l < o.gHtmlSpans.length; ++l) { - for (var u = o.gHtmlSpans[l], m = 0; /¨C(\d+)C/.test(u); ) { - var f = RegExp.$1; - if (u = u.replace("¨C" + f + "C", o.gHtmlSpans[f]), m === 10) { - console.error("maximum nesting of 10 spans reached!!!"); - break; - } - ++m; - } - r = r.replace("¨C" + l + "C", u); - } - return r = o.converter._dispatch("unhashHTMLSpans.after", r, i, o), r; - }), n.subParser("hashPreCodeTags", function(r, i, o) { - r = o.converter._dispatch("hashPreCodeTags.before", r, i, o); - var l = function(u, m, f, x) { - var B = f + n.subParser("encodeCode")(m, i, o) + x; - return ` - -¨G` + (o.ghCodeBlocks.push({ text: u, codeblock: B }) - 1) + `G - -`; - }; - return r = n.helper.replaceRecursiveRegExp(r, l, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), r = o.converter._dispatch("hashPreCodeTags.after", r, i, o), r; - }), n.subParser("headers", function(r, i, o) { - r = o.converter._dispatch("headers.before", r, i, o); - var l = isNaN(parseInt(i.headerLevelStart)) ? 1 : parseInt(i.headerLevelStart), u = i.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, m = i.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; - r = r.replace(u, function(B, U) { - var z = n.subParser("spanGamut")(U, i, o), H = i.noHeaderId ? "" : ' id="' + x(U) + '"', w = l, q = "" + z + ""; - return n.subParser("hashBlock")(q, i, o); - }), r = r.replace(m, function(B, U) { - var z = n.subParser("spanGamut")(U, i, o), H = i.noHeaderId ? "" : ' id="' + x(U) + '"', w = l + 1, q = "" + z + ""; - return n.subParser("hashBlock")(q, i, o); - }); - var f = i.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; - r = r.replace(f, function(B, U, z) { - var H = z; - i.customizedHeaderId && (H = z.replace(/\s?\{([^{]+?)}\s*$/, "")); - var w = n.subParser("spanGamut")(H, i, o), q = i.noHeaderId ? "" : ' id="' + x(z) + '"', W = l - 1 + U.length, J = "" + w + ""; - return n.subParser("hashBlock")(J, i, o); - }); - function x(B) { - var U, z; - if (i.customizedHeaderId) { - var H = B.match(/\{([^{]+?)}\s*$/); - H && H[1] && (B = H[1]); - } - return U = B, n.helper.isString(i.prefixHeaderId) ? z = i.prefixHeaderId : i.prefixHeaderId === !0 ? z = "section-" : z = "", i.rawPrefixHeaderId || (U = z + U), i.ghCompatibleHeaderId ? U = U.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : i.rawHeaderId ? U = U.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : U = U.replace(/[^\w]/g, "").toLowerCase(), i.rawPrefixHeaderId && (U = z + U), o.hashLinkCounts[U] ? U = U + "-" + o.hashLinkCounts[U]++ : o.hashLinkCounts[U] = 1, U; - } - return r = o.converter._dispatch("headers.after", r, i, o), r; - }), n.subParser("horizontalRule", function(r, i, o) { - r = o.converter._dispatch("horizontalRule.before", r, i, o); - var l = n.subParser("hashBlock")("
", i, o); - return r = r.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, l), r = r.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, l), r = r.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, l), r = o.converter._dispatch("horizontalRule.after", r, i, o), r; - }), n.subParser("images", function(r, i, o) { - r = o.converter._dispatch("images.before", r, i, o); - var l = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, u = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, m = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, f = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, x = /!\[([^\[\]]+)]()()()()()/g; - function B(z, H, w, q, W, J, V, E) { - return q = q.replace(/\s/g, ""), U(z, H, w, q, W, J, V, E); - } - function U(z, H, w, q, W, J, V, E) { - var F = o.gUrls, O = o.gTitles, d = o.gDimensions; - if (w = w.toLowerCase(), E || (E = ""), z.search(/\(? ?(['"].*['"])?\)$/m) > -1) - q = ""; - else if (q === "" || q === null) - if ((w === "" || w === null) && (w = H.toLowerCase().replace(/ ?\n/g, " ")), q = "#" + w, !n.helper.isUndefined(F[w])) - q = F[w], n.helper.isUndefined(O[w]) || (E = O[w]), n.helper.isUndefined(d[w]) || (W = d[w].width, J = d[w].height); - else - return z; - H = H.replace(/"/g, """).replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback), q = q.replace(n.helper.regexes.asteriskDashAndColon, n.helper.escapeCharactersCallback); - var k = '' + H + '", "
"); - }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(u, m) { - return l(m, "", ""); - }), r = r.replace(/\b_(\S[\s\S]*?)_\b/g, function(u, m) { - return l(m, "", ""); - })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/__(\S[\s\S]*?)__/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/_([^\s_][\s\S]*?)_/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - })), i.literalMidWordAsterisks ? (r = r.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - }), r = r.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - }), r = r.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(u, m, f) { - return l(f, m + "", ""); - })) : (r = r.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - }), r = r.replace(/\*([^\s*][\s\S]*?)\*/g, function(u, m) { - return /\S$/.test(m) ? l(m, "", "") : u; - })), r = o.converter._dispatch("italicsAndBold.after", r, i, o), r; - }), n.subParser("lists", function(r, i, o) { - function l(f, x) { - o.gListLevel++, f = f.replace(/\n{2,}$/, ` -`), f += "¨0"; - var B = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, U = /\n[ \t]*\n(?!¨0)/.test(f); - return i.disableForced4SpacesIndentedSublists && (B = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), f = f.replace(B, function(z, H, w, q, W, J, V) { - V = V && V.trim() !== ""; - var E = n.subParser("outdent")(W, i, o), F = ""; - return J && i.tasklists && (F = ' class="task-list-item" style="list-style-type: none;"', E = E.replace(/^[ \t]*\[(x|X| )?]/m, function() { - var O = ' -1 ? (E = n.subParser("githubCodeBlocks")(E, i, o), E = n.subParser("blockGamut")(E, i, o)) : (E = n.subParser("lists")(E, i, o), E = E.replace(/\n$/, ""), E = n.subParser("hashHTMLBlocks")(E, i, o), E = E.replace(/\n\n+/g, ` - -`), U ? E = n.subParser("paragraphs")(E, i, o) : E = n.subParser("spanGamut")(E, i, o)), E = E.replace("¨A", ""), E = "" + E + ` -`, E; - }), f = f.replace(/¨0/g, ""), o.gListLevel--, x && (f = f.replace(/\s+$/, "")), f; - } - function u(f, x) { - if (x === "ol") { - var B = f.match(/^ *(\d+)\./); - if (B && B[1] !== "1") - return ' start="' + B[1] + '"'; - } - return ""; - } - function m(f, x, B) { - var U = i.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, z = i.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, H = x === "ul" ? U : z, w = ""; - if (f.search(H) !== -1) - (function W(J) { - var V = J.search(H), E = u(f, x); - V !== -1 ? (w += ` - -<` + x + E + `> -` + l(J.slice(0, V), !!B) + " -`, x = x === "ul" ? "ol" : "ul", H = x === "ul" ? U : z, W(J.slice(V))) : w += ` - -<` + x + E + `> -` + l(J, !!B) + " -`; - })(f); - else { - var q = u(f, x); - w = ` - -<` + x + q + `> -` + l(f, !!B) + " -`; - } - return w; - } - return r = o.converter._dispatch("lists.before", r, i, o), r += "¨0", o.gListLevel ? r = r.replace( - /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, - function(f, x, B) { - var U = B.search(/[*+-]/g) > -1 ? "ul" : "ol"; - return m(x, U, !0); - } - ) : r = r.replace( - /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, - function(f, x, B, U) { - var z = U.search(/[*+-]/g) > -1 ? "ul" : "ol"; - return m(B, z, !1); - } - ), r = r.replace(/¨0/, ""), r = o.converter._dispatch("lists.after", r, i, o), r; - }), n.subParser("metadata", function(r, i, o) { - if (!i.metadata) - return r; - r = o.converter._dispatch("metadata.before", r, i, o); - function l(u) { - o.metadata.raw = u, u = u.replace(/&/g, "&").replace(/"/g, """), u = u.replace(/\n {4}/g, " "), u.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(m, f, x) { - return o.metadata.parsed[f] = x, ""; - }); - } - return r = r.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(u, m, f) { - return l(f), "¨M"; - }), r = r.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(u, m, f) { - return m && (o.metadata.format = m), l(f), "¨M"; - }), r = r.replace(/¨M/g, ""), r = o.converter._dispatch("metadata.after", r, i, o), r; - }), n.subParser("outdent", function(r, i, o) { - return r = o.converter._dispatch("outdent.before", r, i, o), r = r.replace(/^(\t|[ ]{1,4})/gm, "¨0"), r = r.replace(/¨0/g, ""), r = o.converter._dispatch("outdent.after", r, i, o), r; - }), n.subParser("paragraphs", function(r, i, o) { - r = o.converter._dispatch("paragraphs.before", r, i, o), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""); - for (var l = r.split(/\n{2,}/g), u = [], m = l.length, f = 0; f < m; f++) { - var x = l[f]; - x.search(/¨(K|G)(\d+)\1/g) >= 0 ? u.push(x) : x.search(/\S/) >= 0 && (x = n.subParser("spanGamut")(x, i, o), x = x.replace(/^([ \t]*)/g, "

"), x += "

", u.push(x)); - } - for (m = u.length, f = 0; f < m; f++) { - for (var B = "", U = u[f], z = !1; /¨(K|G)(\d+)\1/.test(U); ) { - var H = RegExp.$1, w = RegExp.$2; - H === "K" ? B = o.gHtmlBlocks[w] : z ? B = n.subParser("encodeCode")(o.ghCodeBlocks[w].text, i, o) : B = o.ghCodeBlocks[w].codeblock, B = B.replace(/\$/g, "$$$$"), U = U.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, B), /^]*>\s*]*>/.test(U) && (z = !0); - } - u[f] = U; - } - return r = u.join(` -`), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""), o.converter._dispatch("paragraphs.after", r, i, o); - }), n.subParser("runExtension", function(r, i, o, l) { - if (r.filter) - i = r.filter(i, l.converter, o); - else if (r.regex) { - var u = r.regex; - u instanceof RegExp || (u = new RegExp(u, "g")), i = i.replace(u, r.replace); - } - return i; - }), n.subParser("spanGamut", function(r, i, o) { - return r = o.converter._dispatch("spanGamut.before", r, i, o), r = n.subParser("codeSpans")(r, i, o), r = n.subParser("escapeSpecialCharsWithinTagAttributes")(r, i, o), r = n.subParser("encodeBackslashEscapes")(r, i, o), r = n.subParser("images")(r, i, o), r = n.subParser("anchors")(r, i, o), r = n.subParser("autoLinks")(r, i, o), r = n.subParser("simplifiedAutoLinks")(r, i, o), r = n.subParser("emoji")(r, i, o), r = n.subParser("underline")(r, i, o), r = n.subParser("italicsAndBold")(r, i, o), r = n.subParser("strikethrough")(r, i, o), r = n.subParser("ellipsis")(r, i, o), r = n.subParser("hashHTMLSpans")(r, i, o), r = n.subParser("encodeAmpsAndAngles")(r, i, o), i.simpleLineBreaks ? /\n\n¨K/.test(r) || (r = r.replace(/\n+/g, `
-`)) : r = r.replace(/ +\n/g, `
-`), r = o.converter._dispatch("spanGamut.after", r, i, o), r; - }), n.subParser("strikethrough", function(r, i, o) { - function l(u) { - return i.simplifiedAutoLink && (u = n.subParser("simplifiedAutoLinks")(u, i, o)), "" + u + ""; - } - return i.strikethrough && (r = o.converter._dispatch("strikethrough.before", r, i, o), r = r.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(u, m) { - return l(m); - }), r = o.converter._dispatch("strikethrough.after", r, i, o)), r; - }), n.subParser("stripLinkDefinitions", function(r, i, o) { - var l = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, u = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; - r += "¨0"; - var m = function(f, x, B, U, z, H, w) { - return x = x.toLowerCase(), r.toLowerCase().split(x).length - 1 < 2 ? f : (B.match(/^data:.+?\/.+?;base64,/) ? o.gUrls[x] = B.replace(/\s/g, "") : o.gUrls[x] = n.subParser("encodeAmpsAndAngles")(B, i, o), H ? H + w : (w && (o.gTitles[x] = w.replace(/"|'/g, """)), i.parseImgDimensions && U && z && (o.gDimensions[x] = { - width: U, - height: z - }), "")); - }; - return r = r.replace(u, m), r = r.replace(l, m), r = r.replace(/¨0/, ""), r; - }), n.subParser("tables", function(r, i, o) { - if (!i.tables) - return r; - var l = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, u = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; - function m(z) { - return /^:[ \t]*--*$/.test(z) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(z) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(z) ? ' style="text-align:center;"' : ""; - } - function f(z, H) { - var w = ""; - return z = z.trim(), (i.tablesHeaderId || i.tableHeaderId) && (w = ' id="' + z.replace(/ /g, "_").toLowerCase() + '"'), z = n.subParser("spanGamut")(z, i, o), "" + z + ` -`; - } - function x(z, H) { - var w = n.subParser("spanGamut")(z, i, o); - return "" + w + ` -`; - } - function B(z, H) { - for (var w = ` - - -`, q = z.length, W = 0; W < q; ++W) - w += z[W]; - for (w += ` - - -`, W = 0; W < H.length; ++W) { - w += ` -`; - for (var J = 0; J < q; ++J) - w += H[W][J]; - w += ` -`; - } - return w += ` -
-`, w; - } - function U(z) { - var H, w = z.split(` -`); - for (H = 0; H < w.length; ++H) - /^ {0,3}\|/.test(w[H]) && (w[H] = w[H].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(w[H]) && (w[H] = w[H].replace(/\|[ \t]*$/, "")), w[H] = n.subParser("codeSpans")(w[H], i, o); - var q = w[0].split("|").map(function(k) { - return k.trim(); - }), W = w[1].split("|").map(function(k) { - return k.trim(); - }), J = [], V = [], E = [], F = []; - for (w.shift(), w.shift(), H = 0; H < w.length; ++H) - w[H].trim() !== "" && J.push( - w[H].split("|").map(function(k) { - return k.trim(); - }) - ); - if (q.length < W.length) - return z; - for (H = 0; H < W.length; ++H) - E.push(m(W[H])); - for (H = 0; H < q.length; ++H) - n.helper.isUndefined(E[H]) && (E[H] = ""), V.push(f(q[H], E[H])); - for (H = 0; H < J.length; ++H) { - for (var O = [], d = 0; d < V.length; ++d) - n.helper.isUndefined(J[H][d]), O.push(x(J[H][d], E[d])); - F.push(O); - } - return B(V, F); - } - return r = o.converter._dispatch("tables.before", r, i, o), r = r.replace(/\\(\|)/g, n.helper.escapeCharactersCallback), r = r.replace(l, U), r = r.replace(u, U), r = o.converter._dispatch("tables.after", r, i, o), r; - }), n.subParser("underline", function(r, i, o) { - return i.underline && (r = o.converter._dispatch("underline.before", r, i, o), i.literalMidWordUnderscores ? (r = r.replace(/\b___(\S[\s\S]*?)___\b/g, function(l, u) { - return "" + u + ""; - }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(l, u) { - return "" + u + ""; - })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(l, u) { - return /\S$/.test(u) ? "" + u + "" : l; - }), r = r.replace(/__(\S[\s\S]*?)__/g, function(l, u) { - return /\S$/.test(u) ? "" + u + "" : l; - })), r = r.replace(/(_)/g, n.helper.escapeCharactersCallback), r = o.converter._dispatch("underline.after", r, i, o)), r; - }), n.subParser("unescapeSpecialChars", function(r, i, o) { - return r = o.converter._dispatch("unescapeSpecialChars.before", r, i, o), r = r.replace(/¨E(\d+)E/g, function(l, u) { - var m = parseInt(u); - return String.fromCharCode(m); - }), r = o.converter._dispatch("unescapeSpecialChars.after", r, i, o), r; - }), n.subParser("makeMarkdown.blockquote", function(r, i) { - var o = ""; - if (r.hasChildNodes()) - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) { - var f = n.subParser("makeMarkdown.node")(l[m], i); - f !== "" && (o += f); - } - return o = o.trim(), o = "> " + o.split(` -`).join(` -> `), o; - }), n.subParser("makeMarkdown.codeBlock", function(r, i) { - var o = r.getAttribute("language"), l = r.getAttribute("precodenum"); - return "```" + o + ` -` + i.preList[l] + "\n```"; - }), n.subParser("makeMarkdown.codeSpan", function(r) { - return "`" + r.innerHTML + "`"; - }), n.subParser("makeMarkdown.emphasis", function(r, i) { - var o = ""; - if (r.hasChildNodes()) { - o += "*"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - o += "*"; - } - return o; - }), n.subParser("makeMarkdown.header", function(r, i, o) { - var l = new Array(o + 1).join("#"), u = ""; - if (r.hasChildNodes()) { - u = l + " "; - for (var m = r.childNodes, f = m.length, x = 0; x < f; ++x) - u += n.subParser("makeMarkdown.node")(m[x], i); - } - return u; - }), n.subParser("makeMarkdown.hr", function() { - return "---"; - }), n.subParser("makeMarkdown.image", function(r) { - var i = ""; - return r.hasAttribute("src") && (i += "![" + r.getAttribute("alt") + "](", i += "<" + r.getAttribute("src") + ">", r.hasAttribute("width") && r.hasAttribute("height") && (i += " =" + r.getAttribute("width") + "x" + r.getAttribute("height")), r.hasAttribute("title") && (i += ' "' + r.getAttribute("title") + '"'), i += ")"), i; - }), n.subParser("makeMarkdown.links", function(r, i) { - var o = ""; - if (r.hasChildNodes() && r.hasAttribute("href")) { - var l = r.childNodes, u = l.length; - o = "["; - for (var m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - o += "](", o += "<" + r.getAttribute("href") + ">", r.hasAttribute("title") && (o += ' "' + r.getAttribute("title") + '"'), o += ")"; - } - return o; - }), n.subParser("makeMarkdown.list", function(r, i, o) { - var l = ""; - if (!r.hasChildNodes()) - return ""; - for (var u = r.childNodes, m = u.length, f = r.getAttribute("start") || 1, x = 0; x < m; ++x) - if (!(typeof u[x].tagName > "u" || u[x].tagName.toLowerCase() !== "li")) { - var B = ""; - o === "ol" ? B = f.toString() + ". " : B = "- ", l += B + n.subParser("makeMarkdown.listItem")(u[x], i), ++f; - } - return l += ` - -`, l.trim(); - }), n.subParser("makeMarkdown.listItem", function(r, i) { - for (var o = "", l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - return /\n$/.test(o) ? o = o.split(` -`).join(` - `).replace(/^ {4}$/gm, "").replace(/\n\n+/g, ` - -`) : o += ` -`, o; - }), n.subParser("makeMarkdown.node", function(r, i, o) { - o = o || !1; - var l = ""; - if (r.nodeType === 3) - return n.subParser("makeMarkdown.txt")(r, i); - if (r.nodeType === 8) - return " - -`; - if (r.nodeType !== 1) - return ""; - var u = r.tagName.toLowerCase(); - switch (u) { - case "h1": - o || (l = n.subParser("makeMarkdown.header")(r, i, 1) + ` - -`); - break; - case "h2": - o || (l = n.subParser("makeMarkdown.header")(r, i, 2) + ` - -`); - break; - case "h3": - o || (l = n.subParser("makeMarkdown.header")(r, i, 3) + ` - -`); - break; - case "h4": - o || (l = n.subParser("makeMarkdown.header")(r, i, 4) + ` - -`); - break; - case "h5": - o || (l = n.subParser("makeMarkdown.header")(r, i, 5) + ` - -`); - break; - case "h6": - o || (l = n.subParser("makeMarkdown.header")(r, i, 6) + ` - -`); - break; - case "p": - o || (l = n.subParser("makeMarkdown.paragraph")(r, i) + ` - -`); - break; - case "blockquote": - o || (l = n.subParser("makeMarkdown.blockquote")(r, i) + ` - -`); - break; - case "hr": - o || (l = n.subParser("makeMarkdown.hr")(r, i) + ` - -`); - break; - case "ol": - o || (l = n.subParser("makeMarkdown.list")(r, i, "ol") + ` - -`); - break; - case "ul": - o || (l = n.subParser("makeMarkdown.list")(r, i, "ul") + ` - -`); - break; - case "precode": - o || (l = n.subParser("makeMarkdown.codeBlock")(r, i) + ` - -`); - break; - case "pre": - o || (l = n.subParser("makeMarkdown.pre")(r, i) + ` - -`); - break; - case "table": - o || (l = n.subParser("makeMarkdown.table")(r, i) + ` - -`); - break; - case "code": - l = n.subParser("makeMarkdown.codeSpan")(r, i); - break; - case "em": - case "i": - l = n.subParser("makeMarkdown.emphasis")(r, i); - break; - case "strong": - case "b": - l = n.subParser("makeMarkdown.strong")(r, i); - break; - case "del": - l = n.subParser("makeMarkdown.strikethrough")(r, i); - break; - case "a": - l = n.subParser("makeMarkdown.links")(r, i); - break; - case "img": - l = n.subParser("makeMarkdown.image")(r, i); - break; - default: - l = r.outerHTML + ` - -`; - } - return l; - }), n.subParser("makeMarkdown.paragraph", function(r, i) { - var o = ""; - if (r.hasChildNodes()) - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - return o = o.trim(), o; - }), n.subParser("makeMarkdown.pre", function(r, i) { - var o = r.getAttribute("prenum"); - return "
" + i.preList[o] + "
"; - }), n.subParser("makeMarkdown.strikethrough", function(r, i) { - var o = ""; - if (r.hasChildNodes()) { - o += "~~"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - o += "~~"; - } - return o; - }), n.subParser("makeMarkdown.strong", function(r, i) { - var o = ""; - if (r.hasChildNodes()) { - o += "**"; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i); - o += "**"; - } - return o; - }), n.subParser("makeMarkdown.table", function(r, i) { - var o = "", l = [[], []], u = r.querySelectorAll("thead>tr>th"), m = r.querySelectorAll("tbody>tr"), f, x; - for (f = 0; f < u.length; ++f) { - var B = n.subParser("makeMarkdown.tableCell")(u[f], i), U = "---"; - if (u[f].hasAttribute("style")) { - var z = u[f].getAttribute("style").toLowerCase().replace(/\s/g, ""); - switch (z) { - case "text-align:left;": - U = ":---"; - break; - case "text-align:right;": - U = "---:"; - break; - case "text-align:center;": - U = ":---:"; - break; - } - } - l[0][f] = B.trim(), l[1][f] = U; - } - for (f = 0; f < m.length; ++f) { - var H = l.push([]) - 1, w = m[f].getElementsByTagName("td"); - for (x = 0; x < u.length; ++x) { - var q = " "; - typeof w[x] < "u" && (q = n.subParser("makeMarkdown.tableCell")(w[x], i)), l[H].push(q); - } - } - var W = 3; - for (f = 0; f < l.length; ++f) - for (x = 0; x < l[f].length; ++x) { - var J = l[f][x].length; - J > W && (W = J); - } - for (f = 0; f < l.length; ++f) { - for (x = 0; x < l[f].length; ++x) - f === 1 ? l[f][x].slice(-1) === ":" ? l[f][x] = n.helper.padEnd(l[f][x].slice(-1), W - 1, "-") + ":" : l[f][x] = n.helper.padEnd(l[f][x], W, "-") : l[f][x] = n.helper.padEnd(l[f][x], W); - o += "| " + l[f].join(" | ") + ` | -`; - } - return o.trim(); - }), n.subParser("makeMarkdown.tableCell", function(r, i) { - var o = ""; - if (!r.hasChildNodes()) - return ""; - for (var l = r.childNodes, u = l.length, m = 0; m < u; ++m) - o += n.subParser("makeMarkdown.node")(l[m], i, !0); - return o.trim(); - }), n.subParser("makeMarkdown.txt", function(r) { - var i = r.nodeValue; - return i = i.replace(/ +/g, " "), i = i.replace(/¨NBSP;/g, " "), i = n.helper.unescapeHTMLEntities(i), i = i.replace(/([*_~|`])/g, "\\$1"), i = i.replace(/^(\s*)>/g, "\\$1>"), i = i.replace(/^#/gm, "\\#"), i = i.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), i = i.replace(/^( {0,3}\d+)\./gm, "$1\\."), i = i.replace(/^( {0,3})([+-])/gm, "$1\\$2"), i = i.replace(/]([\s]*)\(/g, "\\]$1\\("), i = i.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), i; - }); - var I = this; - e.exports ? e.exports = n : I.showdown = n; - }).call(Dl); -})(ju); -var Z_ = ju.exports; -const Oc = /* @__PURE__ */ zl(Z_); -class Nc { - constructor() { - Qe(this, "logger"), Qe(this, "converter"), this.logger = mi.zhiLog("showdown-adaptor"), this.converter = new Oc.Converter(); - } - isAvailable() { - return typeof Oc < "u"; - } - renderMarkdownStr(t) { - if (!this.isAvailable()) - throw new Error("Showdown is not available"); - return this.logger.info("Showdown is rendering md to HTML..."), Promise.resolve(this.converter.makeHtml(t)); - } -} -class Cu { - constructor() { - Qe(this, "logger"), Qe(this, "mdAdaptor", new Nc()), this.logger = mi.zhiLog("markdown-util"); - } - /** - * 获取当前 MD 解析器名称 - */ - getCurrentAdaptorName() { - return this.mdAdaptor instanceof Cc ? "Lute" : this.mdAdaptor instanceof Nc ? "Showdown" : "None"; - } - /** - * 渲染Markdown - * - * @param md - Markdown文本 - */ - async renderHTML(t) { - const a = new Cc(); - return this.logger.debug("Lute status =>", a.isAvailable()), a.isAvailable() && (this.mdAdaptor = a), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(t); - } -} -class Y_ { - constructor() { - Qe(this, "mdUtil"), this.mdUtil = new Cu(); - } - /** - * 移除标题数字 - * - * @param str - 字符串 - */ - removeTitleNumber(t) { - let a = t; - const n = /([0-9]*)\./; - return a = a.replace(n, ""), a; - } - /** - * 删除挂件的HTML - * - * @param str - 原字符 - */ - removeWidgetTag(t) { - let a = t.toString(); - const n = //g; - a = a.replace(n, ""); - const s = //g; - a = a.replace(s, ""); - const c = //g; - return a = a.replace(c, ""), a; - } - /** - * 删除Markdown文本的挂件的HTML - * - * @param str - 原字符 - */ - removeMdWidgetTag(t) { - let a = t.toString(); - return a = this.removeWidgetTag(a), a; - } - /** - * 去除html标签,残缺不全也可以 - * - * @param str - 字符串 - */ - filterHtml(t) { - t = t.replace(//g, ""), t = t.replace(//g, ""), t = t.replace(/<[^>]*>/g, ""), t = t.replace(/&.*;/g, ""), t = t.replace(/(^\s*)|(\s*$)/g, ""), t = t.replace(//g, ""), t = t.replace(/"/g, "").replace(/'/g, ""), t = t.replace(/\*/g, ""), t = t.replace(/\$/g, ""), t = t.replace(/\./g, ""), t = t.replace(/\+/g, ""), t = t.replace(/\s+/g, ""), t = t.replace(/[:|:]/g, "_"), t = t.replace(/[;|;]/g, "_"), t = t.replace(/\^/g, "_"), t = t.replace(/!/g, "_"), t = t.replace(/@/g, "at_"); - const a = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; - for (let n = 0; n < a.length; n++) { - const s = new RegExp(a[n], "g"); - t = t.replace(s, ""); - } - return t = t.toLowerCase(), t; - } - /** - * 截取指定长度html - * - * @param html - html - * @param length - 长度 - * @param ignore - 不要结尾省略号 - */ - parseHtml(t, a, n) { - const s = this.filterHtml(t); - return s.length < a ? s : n === !0 ? s.substring(0, a) : s.substring(0, a) + "..."; - } - /** - * 将Markdown转换为HTML - * - * @param md - Markdown - */ - async mdToHtml(t) { - const a = await this.mdUtil.renderHTML(t); - return this.removeWidgetTag(a); - } - /** - * 将Markdown转换为纯文本 - * - * @param md - Markdown - */ - async mdToPlainText(t) { - const a = await this.mdToHtml(t); - return this.filterHtml(a); - } - /** - * 移除H1标签 - * - * @param html - html - */ - removeH1(t) { - let a = t; - const n = //g; - return a = a.replace(n, ""), a; - } - /** - * 移除Markdown里面的H1标签 - * - * JavaScript 正则表达式可以用来删除所有 Markdown 中的 h1 标签。下面是一个示例代码: - * - * const str = "# This is an H1\n## This is an H2\n### This is an H3"; - * - * const regex = /^# .*$/gm; - * const result = str.replace(regex, ''); - * - * console.log(result); - * 在这个例子中,我们使用正则表达式 /^# .*$/gm 来匹配所有的 h1 标签。 - * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 - */ - removeMdH1(t) { - let a = t; - const n = /^# .*$/gm; - return a = a.replace(n, ""), a; - } -} -class Q_ { - /** - * 检测是否是空对象 - * - * @param obj - 对象 - */ - isEmptyObject(t) { - return t ? Object.getPrototypeOf(t) === Object.prototype && Object.getOwnPropertyNames(t).length === 0 && Object.getOwnPropertySymbols(t).length === 0 : !0; - } -} -class X_ { - constructor() { - Qe(this, "dateUtil"), Qe(this, "strUtil"), Qe(this, "versionUtil"), Qe(this, "htmlUtil"), Qe(this, "markdownUtil"), Qe(this, "jsonUtil"), Qe(this, "objectUtil"), this.dateUtil = new P_(), this.strUtil = new S_(), this.versionUtil = new C_(), this.htmlUtil = new Y_(), this.markdownUtil = new Cu(), this.jsonUtil = new E_(), this.objectUtil = new Q_(); - } -} -const Ou = X_; -class Vn { -} -/** - * 思源 API 伺服地址 - */ -Ke(Vn, "VITE_SIYUAN_API_URL_KEY", "VITE_SIYUAN_API_URL"), /** - * 思源 token - */ -Ke(Vn, "VITE_SIYUAN_AUTH_TOKEN_KEY", "VITE_SIYUAN_AUTH_TOKEN"); -var ew = Object.defineProperty, tw = (e, t, a) => t in e ? ew(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, ea = (e, t, a) => (tw(e, typeof t != "symbol" ? t + "" : t, a), a); -class Pr { -} -ea(Pr, "NODE_ENV_KEY", "NODE_ENV"), /** -* 开发环境 -*/ -ea(Pr, "NODE_ENV_DEVELOPMENT", "development"), /** -* 生产环境 -*/ -ea(Pr, "NODE_ENV_PRODUCTION", "production"), /** -* 测试环境 -*/ -ea(Pr, "NODE_ENV_TEST", "test"), /** -* 是否处于调试模式 -*/ -ea(Pr, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); -class rw { - /** - * 环境初始化 - * - * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 - * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} - */ - constructor(t) { - ea(this, "envMeta"), this.envMeta = t; - } - /** - * 是否是开发阶段调试 - */ - isNodeDev() { - return this.getEnv(Pr.NODE_ENV_KEY) === Pr.NODE_ENV_DEVELOPMENT; - } - /** - * 是否是调试阶段 - */ - isDev() { - return this.isNodeDev() || this.getBooleanEnv(Pr.VITE_DEBUG_MODE_KEY); - } - /** - * 获取环境变量,key不存在返回undefined - * @param key - key - */ - getEnv(t) { - let a; - try { - this.envMeta[t] && (a = this.envMeta[t]); - } catch { - } - return a; - } - /** - * 获取String类型的环境变量,key不存在直接返回空值 - * @param key - key - */ - getStringEnv(t) { - return this.getEnv(t) ?? ""; - } - /** - * 获取Boolean类型的环境变量,key不存在返回false - * @param key - key - */ - getBooleanEnv(t) { - let a = !1; - return this.getEnv(t) && (a = this.getStringEnv(t).toLowerCase() === "true"), a; - } - /** - * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 - * - * @param key - key - * @param defaultValue - 默认值 - * @since 0.1.0 - * @author terwer - */ - getEnvOrDefault(t, a) { - const n = this.getStringEnv(t); - return n.trim().length == 0 ? a : n; - } -} -class Do extends Ua { - static zhiEnv() { - return this.env || (this.env = new rw({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + /** + * 通用工具入口 + * + * @param appInstance - 应用实例 + */ + static zhiCommon(t) { + return t.zhiCommon.ZhiUtil.zhiCommon(); } } -class Zn { +$e(gr, "env"); +class ea { /** * 初始化思源服务端 API * @@ -18886,30 +9965,33 @@ class Zn { /** * 思源笔记服务端API版本号 */ - Ke(this, "VERSION"); - Ke(this, "logger"); - Ke(this, "env"); - Ke(this, "common"); - Ke(this, "siyuanConfig"); - if (this.VERSION = "1.0.0", this.env = Do.zhiEnv(), this.common = new Ou(), t instanceof Ji) - this.siyuanConfig = t, this.logger = tc.customLogFactory(Yt.LOG_LEVEL_DEBUG, "zhi").getLogger("siyuan-kernel-api"); + $e(this, "VERSION"); + $e(this, "logger"); + $e(this, "env"); + $e(this, "common"); + $e(this, "siyuanConfig"); + if (this.VERSION = "1.0.0", t instanceof Yn) + this.siyuanConfig = t, this.logger = Wr.customLogFactory(et.LOG_LEVEL_DEBUG, "zhi").getLogger("siyuan-kernel-api"); else { - const a = t, n = Ha.getEnvLevel(a), s = a.getStringEnv(Vn.VITE_SIYUAN_API_URL_KEY), c = a.getStringEnv(Vn.VITE_SIYUAN_AUTH_TOKEN_KEY); - this.siyuanConfig = new Ji(s, c), this.logger = tc.customLogFactory(n, "siyuan-kernel-api", a).getLogger(Zn.name); + const r = t, a = mr.getEnvLevel(r), s = r.getStringEnv(Jr.VITE_SIYUAN_API_URL_KEY), l = r.getStringEnv(Jr.VITE_SIYUAN_AUTH_TOKEN_KEY); + this.siyuanConfig = new Yn(s, l), this.logger = Wr.customLogFactory(a, "siyuan-kernel-api", r).getLogger(ea.name); } } + init(t) { + this.env = gr.zhiEnv(t), this.common = gr.zhiCommon(t); + } /** * 分页获取根文档 * * @param keyword - 关键字 */ async getRootBlocksCount(t) { - const a = `SELECT COUNT(DISTINCT b1.root_id) as count + const r = `SELECT COUNT(DISTINCT b1.root_id) as count FROM blocks b1 WHERE 1 = 1 AND (b1.root_id ='${t}' OR (b1.content LIKE '%${t}%') OR (b1.tag LIKE '%${t}%') - )`, n = await this.sql(a); - return this.logger.debug("getRootBlocksCount data=>", n[0].count), n[0].count; + )`, a = await this.sql(r); + return this.logger.debug("getRootBlocksCount data=>", a[0].count), a[0].count; } /** * 分页获取根文档 @@ -18931,15 +10013,15 @@ class Zn { * @param pagesize 数目 * @param keyword 可选,搜索关键字 */ - async getRootBlocks(t, a, n) { + async getRootBlocks(t, r, a) { const s = `select DISTINCT b2.root_id,b2.parent_id,b2.content from blocks b2 WHERE 1==1 AND b2.id IN ( SELECT DISTINCT b1.root_id FROM blocks b1 WHERE 1 = 1 - AND (b1.root_id ='${n}' OR (b1.content LIKE '%${n}%') OR (b1.tag LIKE '%${n}%')) - ORDER BY b1.updated DESC,b1.created DESC LIMIT ${t * a},${a} + AND (b1.root_id ='${a}' OR (b1.content LIKE '%${a}%') OR (b1.tag LIKE '%${a}%')) + ORDER BY b1.updated DESC,b1.created DESC LIMIT ${t * r},${r} ) ORDER BY b2.updated DESC,b2.created DESC`; return await this.sql(s); @@ -18956,10 +10038,10 @@ class Zn { * @param docId 文档ID */ async getSubdocCount(t) { - const a = `SELECT COUNT(DISTINCT b1.root_id) AS count + const r = `SELECT COUNT(DISTINCT b1.root_id) AS count FROM blocks b1 WHERE b1.root_id='${t}' OR b1.path LIKE '%/${t}%'`; - return (await this.sql(a))[0].count; + return (await this.sql(r))[0].count; } /** * 分页获取子文档 @@ -18981,37 +10063,37 @@ class Zn { * @param pagesize 数目 * @param keyword 关键字 */ - async getSubdocs(t, a, n, s) { - const c = `SELECT DISTINCT b2.root_id,b2.content,b2.path FROM blocks b2 + async getSubdocs(t, r, a, s) { + const l = `SELECT DISTINCT b2.root_id,b2.content,b2.path FROM blocks b2 WHERE b2.id IN ( SELECT DISTINCT b1.root_id FROM blocks b1 WHERE b1.root_id='${t}' OR b1.path like '%/${t}%' AND ((b1.content LIKE '%${s}%') OR (b1.tag LIKE '%${s}%')) - ORDER BY b1.updated DESC,b1.created DESC LIMIT ${a * n},${n} + ORDER BY b1.updated DESC,b1.created DESC LIMIT ${r * a},${a} ) ORDER BY b2.content,b2.updated DESC,b2.created DESC,id`; - return this.logger.debug("siyuanApi getSubdocs sql=>", c), await this.sql(c); + return this.logger.debug("siyuanApi getSubdocs sql=>", l), await this.sql(l); } /** * 以id获取思源块信息 * @param blockId 块ID */ async getBlockByID(t) { - const a = `select * + const r = `select * from blocks - where id = '${t}'`, n = await this.sql(a); - if (!n || n.length === 0) + where id = '${t}'`, a = await this.sql(r); + if (!a || a.length === 0) throw new Error("通过ID查询块信息失败"); - return n[0]; + return a[0]; } /** * 以slug获取思源块信息 * @param slug 内容快别名 */ async getRootBlockBySlug(t) { - const a = `select root_id from attributes where name='custom-slug' and value='${t}' limit 1`; - return (await this.sql(a))[0]; + const r = `select root_id from attributes where name='custom-slug' and value='${t}' limit 1`; + return (await this.sql(r))[0]; } /** * 以内容块ID获取根块 @@ -19019,18 +10101,18 @@ class Zn { * @param blockID 内容块ID */ async getRootBlock(t) { - const a = `select root_id from blocks where id='${t}' limit 1`; - return (await this.sql(a))[0]; + const r = `select root_id from blocks where id='${t}' limit 1`; + return (await this.sql(r))[0]; } /** * 导出markdown文本 * @param docId 文档id */ async exportMdContent(t) { - const a = { + const r = { id: t - }, n = "/api/export/exportMdContent"; - return await this.siyuanRequest(n, a); + }, a = "/api/export/exportMdContent"; + return await this.siyuanRequest(a, r); } /** * 以sql发送请求 @@ -19038,10 +10120,10 @@ class Zn { * @param sql - sql */ async sql(t) { - const a = { + const r = { stmt: t - }, n = "/api/query/sql"; - return this.env.isDev() && this.logger.trace("sql=>", t), await this.siyuanRequest(n, a); + }, a = "/api/query/sql"; + return this.env.isDev() && this.logger.trace("sql=>", t), await this.siyuanRequest(a, r); } /** * 向思源请求数据 @@ -19049,20 +10131,20 @@ class Zn { * @param url - url * @param data - 数据 */ - async siyuanRequest(t, a) { - const n = `${this.siyuanConfig.apiUrl}${t}`, s = { - body: JSON.stringify(a), + async siyuanRequest(t, r) { + const a = `${this.siyuanConfig.apiUrl}${t}`, s = { + body: JSON.stringify(r), method: "POST" }; this.common.strUtil.isEmptyString(this.siyuanConfig.password) || Object.assign(s, { headers: { Authorization: `Token ${this.siyuanConfig.password}` } - }), this.env.isDev() && (this.logger.trace("开始向思源请求数据,reqUrl=>", n), this.logger.trace("开始向思源请求数据,fetchOps=>", s)); - const p = await (await fetch(n, s)).json(); - if (this.env.isDev() && this.logger.trace("思源请求数据返回,resJson=>", p), p.code === -1) - throw new Error(p.msg); - return p.code === 0 ? p.data : null; + }), this.env.isDev() && (this.logger.trace("开始向思源请求数据,reqUrl=>", a), this.logger.trace("开始向思源请求数据,fetchOps=>", s)); + const d = await (await fetch(a, s)).json(); + if (this.env.isDev() && this.logger.trace("思源请求数据返回,resJson=>", d), d.code === -1) + throw new Error(d.msg); + return d.code === 0 ? d.data : null; } /** * 列出笔记本 @@ -19096,10 +10178,10 @@ class Zn { * @param notebookId - 笔记本ID * @param name - 新笔记本名称 */ - async renameNotebook(t, a) { + async renameNotebook(t, r) { return await this.siyuanRequest("/api/notebook/renameNotebook", { notebook: t, - name: a + name: r }); } /** @@ -19224,27 +10306,27 @@ class Zn { * @param blockId */ async getBlockAttrs(t) { - const a = { + const r = { id: t - }, n = "/api/attr/getBlockAttrs"; - return await this.siyuanRequest(n, a); + }, a = "/api/attr/getBlockAttrs"; + return await this.siyuanRequest(a, r); } /** * 设置块属性 * @param blockId * @param attrs */ - async setBlockAttrs(t, a) { - const n = "/api/attr/setBlockAttrs"; - return await this.siyuanRequest(n, { + async setBlockAttrs(t, r) { + const a = "/api/attr/setBlockAttrs"; + return await this.siyuanRequest(a, { id: t, - attrs: a + attrs: r }); } } -class aw { +class pd { } -class Cw { +class md { /** * 构造思源 API对象 * @@ -19254,74 +10336,77 @@ class Cw { /** * 思源笔记内核API */ - Ke(this, "kernelApi"); + $e(this, "kernelApi"); /** * 思源笔记客户端API */ - Ke(this, "clientApi"); - this.kernelApi = new Zn(t), this.clientApi = new aw(); + $e(this, "clientApi"); + this.kernelApi = new ea(t), this.clientApi = new pd(); } } -class Ow { +class gd { /** * 初始化思源 API 适配器 * * @param cfg - 环境变量 或者 配置项 */ constructor(t) { - Ke(this, "logger"); - Ke(this, "common"); - Ke(this, "siyuanKernelApi"); - Ke(this, "cfg"); - this.logger = Do.zhiLog("siyuan-api-adaptor"), this.common = Do.zhiCommon(), this.siyuanKernelApi = new Zn(t), this.cfg = this.siyuanKernelApi.siyuanConfig; + $e(this, "logger"); + $e(this, "common"); + $e(this, "siyuanKernelApi"); + $e(this, "cfg"); + this.siyuanKernelApi = new ea(t), this.cfg = this.siyuanKernelApi.siyuanConfig; + } + init(t) { + this.logger = gr.zhiLog(t, "siyuan-api-adaptor"), this.common = gr.zhiCommon(t), this.siyuanKernelApi.init(t); } async deletePost(t) { return console.log(t), Promise.resolve(!1); } - async editPost(t, a, n) { - return console.log(`${t} ${a} ${n}`), Promise.resolve(!1); + async editPost(t, r, a) { + return console.log(`${t} ${r} ${a}`), Promise.resolve(!1); } async getCategories() { return Promise.resolve([]); } - async getPost(t, a, n) { + async getPost(t, r, a) { let s = t; - if (a) { - const N = await this.siyuanKernelApi.getRootBlockBySlug(t); - N && (s = N.root_id); + if (r) { + const j = await this.siyuanKernelApi.getRootBlockBySlug(t); + j && (s = j.root_id); } - const c = await this.siyuanKernelApi.getBlockByID(s); - if (!c) + const l = await this.siyuanKernelApi.getBlockByID(s); + if (!l) throw new Error("文章不存存在,postid=>" + s); - const p = await this.siyuanKernelApi.getBlockAttrs(s); + const d = await this.siyuanKernelApi.getBlockAttrs(s); let b = !0; - (p["custom-publish-status"] || "draft") === "secret" && (b = !1); - const y = p["custom-post-password"] || "", g = p["custom-desc"] || ""; - let S = c.content ?? ""; - this.cfg.fixTitle && (S = this.common.htmlUtil.removeTitleNumber(S)); - let L; - if (!n) { - const N = await this.siyuanKernelApi.exportMdContent(s); - L = await this.common.markdownUtil.renderHTML(N.content), L = this.common.htmlUtil.removeWidgetTag(L), this.cfg.fixTitle && (L = this.common.htmlUtil.removeH1(L)); - } - const A = new gi(); - return A.postid = c.root_id || "", A.title = S || "", A.description = L || "", A.shortDesc = g || "", A.mt_keywords = p.tags || "", A.post_status = b ? Sn.PostStatusEnum_Publish : Sn.PostStatusEnum_Draft, A.wp_password = y, A; + (d["custom-publish-status"] || "draft") === "secret" && (b = !1); + const y = d["custom-post-password"] || "", m = d["custom-desc"] || ""; + let k = l.content ?? ""; + this.cfg.fixTitle && (k = this.common.htmlUtil.removeTitleNumber(k)); + let N; + if (!a) { + const j = await this.siyuanKernelApi.exportMdContent(s); + N = await this.common.markdownUtil.renderHTML(j.content), N = this.common.htmlUtil.removeWidgetTag(N), this.cfg.fixTitle && (N = this.common.htmlUtil.removeH1(N)); + } + const A = new _n(); + return A.postid = l.root_id || "", A.title = k || "", A.description = N || "", A.shortDesc = m || "", A.mt_keywords = d.tags || "", A.post_status = b ? Br.PostStatusEnum_Publish : Br.PostStatusEnum_Draft, A.wp_password = y, A; } async getPreviewUrl(t) { return console.log(t), Promise.resolve(""); } - async getRecentPosts(t, a, n) { + async getRecentPosts(t, r, a) { const s = []; - let c = 0; - a && (c = a); - const p = n ?? "", b = await this.siyuanKernelApi.getRootBlocks(c, t, p); + let l = 0; + r && (l = r); + const d = a ?? "", b = await this.siyuanKernelApi.getRootBlocks(l, t, d); this.logger.debug("getRecentPosts from siyuan, get counts =>", b.length); for (let _ = 0; _ < b.length; _++) { - const y = b[_], g = await this.siyuanKernelApi.getBlockAttrs(y.root_id), S = await this.getPost(y.root_id, !1, !0), L = g["custom-slug"] || ""; + const y = b[_], m = await this.siyuanKernelApi.getBlockAttrs(y.root_id), k = await this.getPost(y.root_id, !1, !0), N = m["custom-slug"] || ""; let A = y.content ?? ""; this.cfg.fixTitle && (A = this.common.htmlUtil.removeTitleNumber(A)); - const N = new gi(); - N.postid = y.root_id, N.title = A, N.permalink = L === "" ? this.common.strUtil.appendStr("/post/", y.root_id) : this.common.strUtil.appendStr("/post/", L, ".html"), N.mt_keywords = S.mt_keywords, N.description = S.description, s.push(N); + const j = new _n(); + j.postid = y.root_id, j.title = A, j.permalink = N === "" ? this.common.strUtil.appendStr("/post/", y.root_id) : this.common.strUtil.appendStr("/post/", N, ".html"), j.mt_keywords = k.mt_keywords, j.description = k.description, s.push(j); } return s; } @@ -19334,14 +10419,14 @@ class Ow { newMediaObject(t) { return console.log(t), Promise.resolve({}); } - async newPost(t, a) { - return console.log(`${t} ${a}`), Promise.resolve(""); + async newPost(t, r) { + return console.log(`${t} ${r}`), Promise.resolve(""); } } export { - Ow as SiYuanApiAdaptor, - Cw as SiyuanApi, - Ji as SiyuanConfig, - Vn as SiyuanConstants, - Zn as SiyuanKernelApi + gd as SiYuanApiAdaptor, + md as SiyuanApi, + Yn as SiyuanConfig, + Jr as SiyuanConstants, + ea as SiyuanKernelApi }; diff --git a/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts b/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts index 716e3bf7..979e2a95 100644 --- a/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts +++ b/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts @@ -1,5 +1,3 @@ -import { Env } from "zhi-env"; -import { ZhiUtil } from "zhi-common"; /** * 工具类统一入口,每个应用自己实现 * @@ -7,7 +5,26 @@ import { ZhiUtil } from "zhi-common"; * @author terwer * @since 1.0.0 */ -declare class ZhiSiyuanApiUtil extends ZhiUtil { - static zhiEnv(): Env; +declare class ZhiSiyuanApiUtil { + private static env; + /** + * 通用环境变量 + * + * @param appInstance - 插件实例 + */ + static zhiEnv(appInstance: any): any; + /** + * 通用日志 + * + * @param appInstance - 应用实例 + * @param loggerName - 日志名称 + */ + static zhiLog(appInstance: any, loggerName: string): any; + /** + * 通用工具入口 + * + * @param appInstance - 应用实例 + */ + static zhiCommon(appInstance: any): any; } export default ZhiSiyuanApiUtil; diff --git a/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts b/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts index 2b257188..2401719c 100644 --- a/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts +++ b/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts @@ -9,8 +9,8 @@ import SiyuanConfig from "./siyuanConfig"; * @since 1.0.0 */ declare class SiYuanApiAdaptor implements IBlogApi { - private readonly logger; - private readonly common; + private logger; + private common; private readonly siyuanKernelApi; private readonly cfg; /** @@ -19,6 +19,7 @@ declare class SiYuanApiAdaptor implements IBlogApi { * @param cfg - 环境变量 或者 配置项 */ constructor(cfg: Env | SiyuanConfig); + init(appInstance: any): void; deletePost(postid: string): Promise; editPost(postid: string, post: Post, publish?: boolean): Promise; getCategories(): Promise; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts index 4bc5e4bd..e201b139 100644 --- a/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts +++ b/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts @@ -21,9 +21,9 @@ declare class SiyuanKernelApi implements ISiyuanKernelApi { * 思源笔记服务端API版本号 */ readonly VERSION: string; - private readonly logger; - private readonly env; - private readonly common; + private logger; + private env; + private common; readonly siyuanConfig: SiyuanConfig; /** * 初始化思源服务端 API @@ -31,6 +31,7 @@ declare class SiyuanKernelApi implements ISiyuanKernelApi { * @param cfg - 环境变量 或者 配置项 */ constructor(cfg: Env | SiyuanConfig); + init(appInstance: any): void; /** * 分页获取根文档 * diff --git a/public/libs/zhi-siyuan-api/package.json b/public/libs/zhi-siyuan-api/package.json index c43c415c..8b59007f 100644 --- a/public/libs/zhi-siyuan-api/package.json +++ b/public/libs/zhi-siyuan-api/package.json @@ -35,7 +35,6 @@ "dependencies": { "zhi-env": "workspace:*", "zhi-log": "workspace:*", - "zhi-common": "workspace:*", "zhi-blog-api": "workspace:*" } } diff --git a/src/index.ts b/src/index.ts index 8b7985b4..ea347365 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { Plugin } from "siyuan" import "./index.styl" import { initLibs } from "~/src/loader" -import { Utils } from "~/src/utils/utils" +import { initTools } from "~/src/tools" export default class PublisherPlugin extends Plugin { public fs @@ -26,7 +26,7 @@ export default class PublisherPlugin extends Plugin { ZhiCommon ZhiUtil } - public zhiElectron + // public zhiElectron public zhiBlogApi: { BlogConstants BlogTypeEnum @@ -43,17 +43,16 @@ export default class PublisherPlugin extends Plugin { // 初始化常用工具类 // private env - private logger + public logger // private common - private blogApi + public blogApi // lifecycle async onload() { // 初始化基础类库 await initLibs(this) - // 初始化常用工具类 - await this.initUtils() + await initTools(this) // 业务逻辑 const posts = await this.blogApi.getRecentPosts(10) @@ -72,23 +71,4 @@ export default class PublisherPlugin extends Plugin { // ====================== // private functions // ====================== - private async initUtils() { - // this.env = Utils.zhiEnv(this) - this.logger = Utils.zhiLog(this, "publisher-index") - // this.common = Utils.zhiCommon(this) - - // blogApi - const publishSdk = this.zhiPublisherSdk.PublishSdk - publishSdk.init({ - Env: this.zhiEnv.Env, - BlogConstants: this.zhiBlogApi.BlogConstants, - BlogTypeEnum: this.zhiBlogApi.BlogTypeEnum, - SiyuanConstants: this.zhiSiyuanApi.SiyuanConstants, - SiyuanConfig: this.zhiSiyuanApi.SiyuanConfig, - SiYuanApiAdaptor: this.zhiSiyuanApi.SiYuanApiAdaptor, - BlogApi: this.zhiBlogApi.BlogApi, - }) - const cfg = new this.zhiSiyuanApi.SiyuanConfig("", "") - this.blogApi = publishSdk.blogApi(this.zhiBlogApi.BlogTypeEnum.BlogTypeEnum_Siyuan, cfg) - } } diff --git a/src/tools.ts b/src/tools.ts new file mode 100644 index 00000000..f2a174b5 --- /dev/null +++ b/src/tools.ts @@ -0,0 +1,16 @@ +import { Utils } from "~/src/utils/utils" +import PublisherPlugin from "~/src/index" + +/** + * 初始化工具类 + * + * @param appInstance - 应用实例 + */ +export const initTools = async (appInstance: PublisherPlugin) => { + // this.env = Utils.zhiEnv(this) + appInstance.logger = Utils.zhiLog(appInstance, "publisher-index") + // this.common = Utils.zhiCommon(appInstance) + + // blogApi + appInstance.blogApi = Utils.blogApi(appInstance) +} diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 4f8cf8f7..636065ee 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -45,4 +45,21 @@ export class Utils { public static zhiCommon(pluginInstance: PublisherPlugin) { return pluginInstance.zhiCommon.ZhiUtil.zhiCommon() } + + public static blogApi(appInstance: PublisherPlugin, blogType?: any, blogCfg?: any) { + const publishSdk = appInstance.zhiPublisherSdk.PublishSdk + publishSdk.init({ + appInstance: appInstance, + Env: appInstance.zhiEnv.Env, + BlogConstants: appInstance.zhiBlogApi.BlogConstants, + BlogTypeEnum: appInstance.zhiBlogApi.BlogTypeEnum, + SiyuanConstants: appInstance.zhiSiyuanApi.SiyuanConstants, + SiyuanConfig: appInstance.zhiSiyuanApi.SiyuanConfig, + SiYuanApiAdaptor: appInstance.zhiSiyuanApi.SiYuanApiAdaptor, + BlogApi: appInstance.zhiBlogApi.BlogApi, + }) + const type = blogType ?? appInstance.zhiBlogApi.BlogTypeEnum.BlogTypeEnum_Siyuan + const cfg = blogCfg ?? new appInstance.zhiSiyuanApi.SiyuanConfig("", "") + return publishSdk.blogApi(type, cfg) + } }