@wp-playground/client 0.6.6 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +14 -14
- package/index.d.ts +41 -3
- package/index.js +922 -786
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -8,56 +8,66 @@ var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get
|
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
9
9
|
}, te = (e, t, r, n) => (Nt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
10
10
|
var ce = (e, t, r) => (Nt(e, t, "access private method"), r);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const currentJsRuntime = function() {
|
|
12
|
+
var e;
|
|
13
|
+
return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
typeof WorkerGlobalScope < "u" && // @ts-ignore
|
|
16
|
+
self instanceof WorkerGlobalScope ? "WORKER" : "NODE"
|
|
17
|
+
);
|
|
18
|
+
}();
|
|
19
|
+
if (currentJsRuntime === "NODE") {
|
|
20
|
+
let e = function(r) {
|
|
21
|
+
return new Promise(function(n, s) {
|
|
22
|
+
r.onload = r.onerror = function(i) {
|
|
23
|
+
r.onload = r.onerror = null, i.type === "load" ? n(r.result) : s(new Error("Failed to read the blob/file"));
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}, t = function() {
|
|
27
|
+
const r = new Uint8Array([1, 2, 3, 4]), s = new File([r], "test").stream();
|
|
28
|
+
try {
|
|
29
|
+
return s.getReader({ mode: "byob" }), !0;
|
|
30
|
+
} catch {
|
|
31
|
+
return !1;
|
|
17
32
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
|
|
29
|
-
const t = new FileReader();
|
|
30
|
-
return t.readAsArrayBuffer(this), asPromise(t);
|
|
31
|
-
});
|
|
32
|
-
typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
|
|
33
|
-
const t = new FileReader();
|
|
34
|
-
return t.readAsText(this), asPromise(t);
|
|
35
|
-
});
|
|
36
|
-
function isByobSupported() {
|
|
37
|
-
const e = new Uint8Array([1, 2, 3, 4]), r = new File([e], "test").stream();
|
|
38
|
-
try {
|
|
39
|
-
return r.getReader({ mode: "byob" }), !0;
|
|
40
|
-
} catch {
|
|
41
|
-
return !1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
(typeof Blob.prototype.stream > "u" || !isByobSupported()) && (Blob.prototype.stream = function() {
|
|
45
|
-
let e = 0;
|
|
46
|
-
const t = this;
|
|
47
|
-
return new ReadableStream({
|
|
48
|
-
type: "bytes",
|
|
49
|
-
// 0.5 MB seems like a reasonable chunk size, let's adjust
|
|
50
|
-
// this if needed.
|
|
51
|
-
autoAllocateChunkSize: 512 * 1024,
|
|
52
|
-
async pull(r) {
|
|
53
|
-
const n = r.byobRequest.view, i = await t.slice(e, e + n.byteLength).arrayBuffer(), o = new Uint8Array(i);
|
|
54
|
-
new Uint8Array(n.buffer).set(o);
|
|
55
|
-
const c = o.byteLength;
|
|
56
|
-
r.byobRequest.respond(c), e += c, e >= t.size && r.close();
|
|
33
|
+
};
|
|
34
|
+
if (typeof File > "u") {
|
|
35
|
+
class r extends Blob {
|
|
36
|
+
constructor(s, i, o) {
|
|
37
|
+
super(s);
|
|
38
|
+
let c;
|
|
39
|
+
o != null && o.lastModified && (c = /* @__PURE__ */ new Date()), (!c || isNaN(c.getFullYear())) && (c = /* @__PURE__ */ new Date()), this.lastModifiedDate = c, this.lastModified = c.getMilliseconds(), this.name = i || "";
|
|
40
|
+
}
|
|
57
41
|
}
|
|
42
|
+
global.File = r;
|
|
43
|
+
}
|
|
44
|
+
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
|
|
45
|
+
const n = new FileReader();
|
|
46
|
+
return n.readAsArrayBuffer(this), e(n);
|
|
47
|
+
}), typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
|
|
48
|
+
const n = new FileReader();
|
|
49
|
+
return n.readAsText(this), e(n);
|
|
50
|
+
}), (typeof Blob.prototype.stream > "u" || !t()) && (Blob.prototype.stream = function() {
|
|
51
|
+
let r = 0;
|
|
52
|
+
const n = this;
|
|
53
|
+
return new ReadableStream({
|
|
54
|
+
type: "bytes",
|
|
55
|
+
// 0.5 MB seems like a reasonable chunk size, let's adjust
|
|
56
|
+
// this if needed.
|
|
57
|
+
autoAllocateChunkSize: 512 * 1024,
|
|
58
|
+
async pull(s) {
|
|
59
|
+
const i = s.byobRequest.view, c = await n.slice(
|
|
60
|
+
r,
|
|
61
|
+
r + i.byteLength
|
|
62
|
+
).arrayBuffer(), d = new Uint8Array(c);
|
|
63
|
+
new Uint8Array(i.buffer).set(d);
|
|
64
|
+
const u = d.byteLength;
|
|
65
|
+
s.byobRequest.respond(u), r += u, r >= n.size && s.close();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
58
68
|
});
|
|
59
|
-
}
|
|
60
|
-
if (typeof CustomEvent > "u") {
|
|
69
|
+
}
|
|
70
|
+
if (currentJsRuntime === "NODE" && typeof CustomEvent > "u") {
|
|
61
71
|
class e extends Event {
|
|
62
72
|
constructor(r, n = {}) {
|
|
63
73
|
super(r, n), this.detail = n.detail;
|
|
@@ -855,14 +865,14 @@ echo json_encode($deactivated_plugins);
|
|
|
855
865
|
PATH_CURRENT_SITE: r
|
|
856
866
|
}
|
|
857
867
|
});
|
|
858
|
-
const p = new URL(await e.absoluteUrl),
|
|
868
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
859
869
|
await e.writeFile(
|
|
860
870
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
861
871
|
`<?php
|
|
862
872
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
863
873
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
864
874
|
}
|
|
865
|
-
$folder = ${phpVar(
|
|
875
|
+
$folder = ${phpVar(g)};
|
|
866
876
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
867
877
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
868
878
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -917,9 +927,9 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
917
927
|
);
|
|
918
928
|
const c = getFormData(o);
|
|
919
929
|
c.fetch_attachments = "1";
|
|
920
|
-
for (const
|
|
921
|
-
if (
|
|
922
|
-
const R = "user_new[" +
|
|
930
|
+
for (const g in c)
|
|
931
|
+
if (g.startsWith("user_map[")) {
|
|
932
|
+
const R = "user_new[" + g.slice(9, -1) + "]";
|
|
923
933
|
c[R] = "1";
|
|
924
934
|
}
|
|
925
935
|
const d = await e.request({
|
|
@@ -1061,13 +1071,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1061
1071
|
}), s = joinPaths(s, r);
|
|
1062
1072
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1063
1073
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1064
|
-
const
|
|
1074
|
+
const g = joinPaths(
|
|
1065
1075
|
i,
|
|
1066
1076
|
p
|
|
1067
1077
|
);
|
|
1068
|
-
await removePath(e,
|
|
1078
|
+
await removePath(e, g);
|
|
1069
1079
|
const R = joinPaths(o, p);
|
|
1070
|
-
await e.fileExists(R) && (await e.mkdir(dirname(
|
|
1080
|
+
await e.fileExists(R) && (await e.mkdir(dirname(g)), await e.mv(R, g));
|
|
1071
1081
|
}
|
|
1072
1082
|
const c = joinPaths(
|
|
1073
1083
|
s,
|
|
@@ -1128,10 +1138,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1128
1138
|
});
|
|
1129
1139
|
d = d.filter((O) => !O.endsWith("/__MACOSX"));
|
|
1130
1140
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1131
|
-
let p,
|
|
1132
|
-
u ? (
|
|
1141
|
+
let p, g = "";
|
|
1142
|
+
u ? (g = d[0], p = d[0].split("/").pop()) : (g = c, p = s);
|
|
1133
1143
|
const R = `${t}/${p}`;
|
|
1134
|
-
return await e.mv(
|
|
1144
|
+
return await e.mv(g, R), {
|
|
1135
1145
|
assetFolderPath: R,
|
|
1136
1146
|
assetFolderName: p
|
|
1137
1147
|
};
|
|
@@ -1893,20 +1903,21 @@ class PHPRequestHandler {
|
|
|
1893
1903
|
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
1894
1904
|
const {
|
|
1895
1905
|
documentRoot: n = "/www/",
|
|
1896
|
-
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
1906
|
+
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : "",
|
|
1907
|
+
rewriteRules: i = []
|
|
1897
1908
|
} = r;
|
|
1898
1909
|
this.php = t, te(this, Pe, n);
|
|
1899
|
-
const
|
|
1900
|
-
te(this, dt,
|
|
1901
|
-
const
|
|
1910
|
+
const o = new URL(s);
|
|
1911
|
+
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
|
|
1912
|
+
const c = H(this, De) !== 443 && H(this, De) !== 80;
|
|
1902
1913
|
te(this, Je, [
|
|
1903
1914
|
H(this, dt),
|
|
1904
|
-
|
|
1905
|
-
].join("")), te(this, ve,
|
|
1915
|
+
c ? `:${H(this, De)}` : ""
|
|
1916
|
+
].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Qe, [
|
|
1906
1917
|
`${H(this, Ke)}://`,
|
|
1907
1918
|
H(this, Je),
|
|
1908
1919
|
H(this, ve)
|
|
1909
|
-
].join(""));
|
|
1920
|
+
].join("")), this.rewriteRules = i;
|
|
1910
1921
|
}
|
|
1911
1922
|
/** @inheritDoc */
|
|
1912
1923
|
pathToInternalUrl(t) {
|
|
@@ -1933,9 +1944,9 @@ class PHPRequestHandler {
|
|
|
1933
1944
|
const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
|
|
1934
1945
|
t.url,
|
|
1935
1946
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1936
|
-
), s =
|
|
1937
|
-
n.pathname,
|
|
1938
|
-
|
|
1947
|
+
), s = applyRewriteRules(
|
|
1948
|
+
removePathPrefix(n.pathname, H(this, ve)),
|
|
1949
|
+
this.rewriteRules
|
|
1939
1950
|
), i = `${H(this, Pe)}${s}`;
|
|
1940
1951
|
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
|
|
1941
1952
|
}
|
|
@@ -1966,7 +1977,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1966
1977
|
r
|
|
1967
1978
|
);
|
|
1968
1979
|
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1969
|
-
var s
|
|
1980
|
+
var s;
|
|
1970
1981
|
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1971
1982
|
return console.warn(
|
|
1972
1983
|
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
|
|
@@ -1981,28 +1992,20 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1981
1992
|
"HTTPS",
|
|
1982
1993
|
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1983
1994
|
);
|
|
1984
|
-
let
|
|
1985
|
-
const
|
|
1995
|
+
let i = "GET";
|
|
1996
|
+
const o = {
|
|
1986
1997
|
host: H(this, Je),
|
|
1987
1998
|
...normalizeHeaders(t.headers || {})
|
|
1988
1999
|
};
|
|
1989
|
-
let
|
|
1990
|
-
if (typeof
|
|
1991
|
-
|
|
1992
|
-
const { bytes:
|
|
1993
|
-
|
|
2000
|
+
let c = t.body;
|
|
2001
|
+
if (typeof c == "object" && !(c instanceof Uint8Array)) {
|
|
2002
|
+
i = "POST";
|
|
2003
|
+
const { bytes: u, contentType: p } = await encodeAsMultipart(c);
|
|
2004
|
+
c = u, o["content-type"] = p;
|
|
1994
2005
|
}
|
|
1995
|
-
let
|
|
2006
|
+
let d;
|
|
1996
2007
|
try {
|
|
1997
|
-
|
|
1998
|
-
if ((i = t.headers) != null && i["x-rewrite-url"])
|
|
1999
|
-
try {
|
|
2000
|
-
p = new URL(
|
|
2001
|
-
t.headers["x-rewrite-url"]
|
|
2002
|
-
).pathname;
|
|
2003
|
-
} catch {
|
|
2004
|
-
}
|
|
2005
|
-
u = ce(this, gt, Bt).call(this, p);
|
|
2008
|
+
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2006
2009
|
} catch {
|
|
2007
2010
|
return new PHPResponse(
|
|
2008
2011
|
404,
|
|
@@ -2016,17 +2019,17 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2016
2019
|
H(this, ve)
|
|
2017
2020
|
),
|
|
2018
2021
|
protocol: H(this, Ke),
|
|
2019
|
-
method: t.method ||
|
|
2020
|
-
body:
|
|
2021
|
-
scriptPath:
|
|
2022
|
-
headers:
|
|
2022
|
+
method: t.method || i,
|
|
2023
|
+
body: c,
|
|
2024
|
+
scriptPath: d,
|
|
2025
|
+
headers: o
|
|
2023
2026
|
});
|
|
2024
2027
|
} finally {
|
|
2025
2028
|
n();
|
|
2026
2029
|
}
|
|
2027
2030
|
}, gt = new WeakSet(), Bt = function(t) {
|
|
2028
2031
|
let r = removePathPrefix(t, H(this, ve));
|
|
2029
|
-
r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
2032
|
+
r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
2030
2033
|
const n = `${H(this, Pe)}${r}`;
|
|
2031
2034
|
if (this.php.fileExists(n))
|
|
2032
2035
|
return n;
|
|
@@ -2081,6 +2084,12 @@ function seemsLikeAPHPFile(e) {
|
|
|
2081
2084
|
function seemsLikeADirectoryRoot(e) {
|
|
2082
2085
|
return !e.split("/").pop().includes(".");
|
|
2083
2086
|
}
|
|
2087
|
+
function applyRewriteRules(e, t) {
|
|
2088
|
+
for (const r of t)
|
|
2089
|
+
if (new RegExp(r.match).test(e))
|
|
2090
|
+
return e.replace(r.match, r.replacement);
|
|
2091
|
+
return e;
|
|
2092
|
+
}
|
|
2084
2093
|
const FileErrorCodes = {
|
|
2085
2094
|
0: "No error occurred. System call completed successfully.",
|
|
2086
2095
|
1: "Argument list too long.",
|
|
@@ -2174,8 +2183,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2174
2183
|
} catch (c) {
|
|
2175
2184
|
const d = typeof c == "object" ? c == null ? void 0 : c.errno : null;
|
|
2176
2185
|
if (d in FileErrorCodes) {
|
|
2177
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2178
|
-
throw new Error(`${
|
|
2186
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, g = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2187
|
+
throw new Error(`${g}: ${u}`, {
|
|
2179
2188
|
cause: c
|
|
2180
2189
|
});
|
|
2181
2190
|
}
|
|
@@ -2198,7 +2207,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2198
2207
|
return n && s && __defProp(t, r, s), s;
|
|
2199
2208
|
};
|
|
2200
2209
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2201
|
-
var Me, Ze, Ye, be, Re, Te, Ee, Xe,
|
|
2210
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2202
2211
|
class BasePHP {
|
|
2203
2212
|
/**
|
|
2204
2213
|
* Initializes a PHP runtime.
|
|
@@ -2208,8 +2217,8 @@ class BasePHP {
|
|
|
2208
2217
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2209
2218
|
*/
|
|
2210
2219
|
constructor(e, t) {
|
|
2211
|
-
Q(this, $t);
|
|
2212
2220
|
Q(this, yt);
|
|
2221
|
+
Q(this, $t);
|
|
2213
2222
|
Q(this, vt);
|
|
2214
2223
|
Q(this, wt);
|
|
2215
2224
|
Q(this, Pt);
|
|
@@ -2333,7 +2342,7 @@ class BasePHP {
|
|
|
2333
2342
|
const t = await this.semaphore.acquire();
|
|
2334
2343
|
let r;
|
|
2335
2344
|
try {
|
|
2336
|
-
if (H(this, be) || (ce(this,
|
|
2345
|
+
if (H(this, be) || (ce(this, yt, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2337
2346
|
throw new Error(
|
|
2338
2347
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2339
2348
|
);
|
|
@@ -2356,6 +2365,11 @@ class BasePHP {
|
|
|
2356
2365
|
throw d.output = c, console.error(d), d;
|
|
2357
2366
|
}
|
|
2358
2367
|
return o;
|
|
2368
|
+
} catch (n) {
|
|
2369
|
+
throw this.dispatchEvent({
|
|
2370
|
+
type: "request.error",
|
|
2371
|
+
error: n
|
|
2372
|
+
}), n;
|
|
2359
2373
|
} finally {
|
|
2360
2374
|
try {
|
|
2361
2375
|
r && this[__private__dont__use].free(r);
|
|
@@ -2479,7 +2493,7 @@ class BasePHP {
|
|
|
2479
2493
|
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2480
2494
|
}
|
|
2481
2495
|
}
|
|
2482
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(),
|
|
2496
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
|
|
2483
2497
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2484
2498
|
"/internal/consts.php",
|
|
2485
2499
|
`<?php
|
|
@@ -2504,7 +2518,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2504
2518
|
);
|
|
2505
2519
|
}
|
|
2506
2520
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2507
|
-
},
|
|
2521
|
+
}, $t = new WeakSet(), Kt = function() {
|
|
2508
2522
|
const e = "/internal/headers.json";
|
|
2509
2523
|
if (!this.fileExists(e))
|
|
2510
2524
|
throw new Error(
|
|
@@ -2673,7 +2687,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2673
2687
|
} finally {
|
|
2674
2688
|
(s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
|
|
2675
2689
|
}
|
|
2676
|
-
const { headers: r, httpStatusCode: n } = ce(this,
|
|
2690
|
+
const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
|
|
2677
2691
|
return new PHPResponse(
|
|
2678
2692
|
n,
|
|
2679
2693
|
r,
|
|
@@ -3027,7 +3041,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3027
3041
|
}
|
|
3028
3042
|
e.str = o;
|
|
3029
3043
|
function c(m, k) {
|
|
3030
|
-
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(
|
|
3044
|
+
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(g(k));
|
|
3031
3045
|
}
|
|
3032
3046
|
e.addCodeArg = c;
|
|
3033
3047
|
function d(m) {
|
|
@@ -3058,7 +3072,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3058
3072
|
return k.emptyStr() ? m : m.emptyStr() ? k : o`${m}${k}`;
|
|
3059
3073
|
}
|
|
3060
3074
|
e.strConcat = p;
|
|
3061
|
-
function
|
|
3075
|
+
function g(m) {
|
|
3062
3076
|
return typeof m == "number" || typeof m == "boolean" || m === null ? m : O(Array.isArray(m) ? m.join(",") : m);
|
|
3063
3077
|
}
|
|
3064
3078
|
function R(m) {
|
|
@@ -3079,10 +3093,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3079
3093
|
throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`);
|
|
3080
3094
|
}
|
|
3081
3095
|
e.getEsmExportName = v;
|
|
3082
|
-
function
|
|
3096
|
+
function y(m) {
|
|
3083
3097
|
return new n(m.toString());
|
|
3084
3098
|
}
|
|
3085
|
-
e.regexpCode =
|
|
3099
|
+
e.regexpCode = y;
|
|
3086
3100
|
})(code$1);
|
|
3087
3101
|
var scope = {};
|
|
3088
3102
|
(function(e) {
|
|
@@ -3116,8 +3130,8 @@ var scope = {};
|
|
|
3116
3130
|
return `${u}${p.index++}`;
|
|
3117
3131
|
}
|
|
3118
3132
|
_nameGroup(u) {
|
|
3119
|
-
var p,
|
|
3120
|
-
if (!((
|
|
3133
|
+
var p, g;
|
|
3134
|
+
if (!((g = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || g === void 0) && g.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3121
3135
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3122
3136
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3123
3137
|
}
|
|
@@ -3127,8 +3141,8 @@ var scope = {};
|
|
|
3127
3141
|
constructor(u, p) {
|
|
3128
3142
|
super(p), this.prefix = u;
|
|
3129
3143
|
}
|
|
3130
|
-
setValue(u, { property: p, itemIndex:
|
|
3131
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3144
|
+
setValue(u, { property: p, itemIndex: g }) {
|
|
3145
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${g}]`;
|
|
3132
3146
|
}
|
|
3133
3147
|
}
|
|
3134
3148
|
e.ValueScopeName = i;
|
|
@@ -3144,10 +3158,10 @@ var scope = {};
|
|
|
3144
3158
|
return new i(u, this._newName(u));
|
|
3145
3159
|
}
|
|
3146
3160
|
value(u, p) {
|
|
3147
|
-
var
|
|
3161
|
+
var g;
|
|
3148
3162
|
if (p.ref === void 0)
|
|
3149
3163
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3150
|
-
const R = this.toName(u), { prefix: O } = R, T = (
|
|
3164
|
+
const R = this.toName(u), { prefix: O } = R, T = (g = p.key) !== null && g !== void 0 ? g : p.ref;
|
|
3151
3165
|
let v = this._values[O];
|
|
3152
3166
|
if (v) {
|
|
3153
3167
|
const k = v.get(T);
|
|
@@ -3156,39 +3170,39 @@ var scope = {};
|
|
|
3156
3170
|
} else
|
|
3157
3171
|
v = this._values[O] = /* @__PURE__ */ new Map();
|
|
3158
3172
|
v.set(T, R);
|
|
3159
|
-
const
|
|
3160
|
-
return
|
|
3173
|
+
const y = this._scope[O] || (this._scope[O] = []), m = y.length;
|
|
3174
|
+
return y[m] = p.ref, R.setValue(p, { property: O, itemIndex: m }), R;
|
|
3161
3175
|
}
|
|
3162
3176
|
getValue(u, p) {
|
|
3163
|
-
const
|
|
3164
|
-
if (
|
|
3165
|
-
return
|
|
3177
|
+
const g = this._values[u];
|
|
3178
|
+
if (g)
|
|
3179
|
+
return g.get(p);
|
|
3166
3180
|
}
|
|
3167
3181
|
scopeRefs(u, p = this._values) {
|
|
3168
|
-
return this._reduceValues(p, (
|
|
3169
|
-
if (
|
|
3170
|
-
throw new Error(`CodeGen: name "${
|
|
3171
|
-
return (0, t._)`${u}${
|
|
3182
|
+
return this._reduceValues(p, (g) => {
|
|
3183
|
+
if (g.scopePath === void 0)
|
|
3184
|
+
throw new Error(`CodeGen: name "${g}" has no value`);
|
|
3185
|
+
return (0, t._)`${u}${g.scopePath}`;
|
|
3172
3186
|
});
|
|
3173
3187
|
}
|
|
3174
|
-
scopeCode(u = this._values, p,
|
|
3188
|
+
scopeCode(u = this._values, p, g) {
|
|
3175
3189
|
return this._reduceValues(u, (R) => {
|
|
3176
3190
|
if (R.value === void 0)
|
|
3177
3191
|
throw new Error(`CodeGen: name "${R}" has no value`);
|
|
3178
3192
|
return R.value.code;
|
|
3179
|
-
}, p,
|
|
3193
|
+
}, p, g);
|
|
3180
3194
|
}
|
|
3181
|
-
_reduceValues(u, p,
|
|
3195
|
+
_reduceValues(u, p, g = {}, R) {
|
|
3182
3196
|
let O = t.nil;
|
|
3183
3197
|
for (const T in u) {
|
|
3184
3198
|
const v = u[T];
|
|
3185
3199
|
if (!v)
|
|
3186
3200
|
continue;
|
|
3187
|
-
const
|
|
3201
|
+
const y = g[T] = g[T] || /* @__PURE__ */ new Map();
|
|
3188
3202
|
v.forEach((m) => {
|
|
3189
|
-
if (
|
|
3203
|
+
if (y.has(m))
|
|
3190
3204
|
return;
|
|
3191
|
-
|
|
3205
|
+
y.set(m, n.Started);
|
|
3192
3206
|
let k = p(m);
|
|
3193
3207
|
if (k) {
|
|
3194
3208
|
const S = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
@@ -3197,7 +3211,7 @@ var scope = {};
|
|
|
3197
3211
|
O = (0, t._)`${O}${k}${this.opts._n}`;
|
|
3198
3212
|
else
|
|
3199
3213
|
throw new r(m);
|
|
3200
|
-
|
|
3214
|
+
y.set(m, n.Completed);
|
|
3201
3215
|
});
|
|
3202
3216
|
}
|
|
3203
3217
|
return O;
|
|
@@ -3311,7 +3325,7 @@ var scope = {};
|
|
|
3311
3325
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3312
3326
|
}
|
|
3313
3327
|
}
|
|
3314
|
-
class
|
|
3328
|
+
class g extends i {
|
|
3315
3329
|
constructor(a) {
|
|
3316
3330
|
super(), this.error = a;
|
|
3317
3331
|
}
|
|
@@ -3359,8 +3373,8 @@ var scope = {};
|
|
|
3359
3373
|
const { nodes: N } = this;
|
|
3360
3374
|
let M = N.length;
|
|
3361
3375
|
for (; M--; ) {
|
|
3362
|
-
const
|
|
3363
|
-
|
|
3376
|
+
const L = N[M];
|
|
3377
|
+
L.optimizeNames(a, h) || (ke(a, L.names), N.splice(M, 1));
|
|
3364
3378
|
}
|
|
3365
3379
|
return N.length > 0 ? this : void 0;
|
|
3366
3380
|
}
|
|
@@ -3375,9 +3389,9 @@ var scope = {};
|
|
|
3375
3389
|
}
|
|
3376
3390
|
class v extends O {
|
|
3377
3391
|
}
|
|
3378
|
-
class
|
|
3392
|
+
class y extends T {
|
|
3379
3393
|
}
|
|
3380
|
-
|
|
3394
|
+
y.kind = "else";
|
|
3381
3395
|
class m extends T {
|
|
3382
3396
|
constructor(a, h) {
|
|
3383
3397
|
super(h), this.condition = a;
|
|
@@ -3394,7 +3408,7 @@ var scope = {};
|
|
|
3394
3408
|
let h = this.else;
|
|
3395
3409
|
if (h) {
|
|
3396
3410
|
const N = h.optimizeNodes();
|
|
3397
|
-
h = this.else = Array.isArray(N) ? new
|
|
3411
|
+
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3398
3412
|
}
|
|
3399
3413
|
if (h)
|
|
3400
3414
|
return a === !1 ? h instanceof m ? h : h.nodes : this.nodes.length ? this : new m(Ce(a), h instanceof m ? [h] : h.nodes);
|
|
@@ -3435,8 +3449,8 @@ var scope = {};
|
|
|
3435
3449
|
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3436
3450
|
}
|
|
3437
3451
|
render(a) {
|
|
3438
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to:
|
|
3439
|
-
return `for(${h} ${N}=${M}; ${N}<${
|
|
3452
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: L } = this;
|
|
3453
|
+
return `for(${h} ${N}=${M}; ${N}<${L}; ${N}++)` + super.render(a);
|
|
3440
3454
|
}
|
|
3441
3455
|
get names() {
|
|
3442
3456
|
const a = ue(super.names, this.from);
|
|
@@ -3539,8 +3553,8 @@ var scope = {};
|
|
|
3539
3553
|
return this._extScope.scopeCode(this._values);
|
|
3540
3554
|
}
|
|
3541
3555
|
_def(a, h, N, M) {
|
|
3542
|
-
const
|
|
3543
|
-
return N !== void 0 && M && (this._constants[
|
|
3556
|
+
const L = this._scope.toName(h);
|
|
3557
|
+
return N !== void 0 && M && (this._constants[L.str] = N), this._leafNode(new o(a, L, N)), L;
|
|
3544
3558
|
}
|
|
3545
3559
|
// `const` declaration (`var` in es5 mode)
|
|
3546
3560
|
const(a, h, N) {
|
|
@@ -3589,11 +3603,11 @@ var scope = {};
|
|
|
3589
3603
|
}
|
|
3590
3604
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3591
3605
|
else() {
|
|
3592
|
-
return this._elseNode(new
|
|
3606
|
+
return this._elseNode(new y());
|
|
3593
3607
|
}
|
|
3594
3608
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3595
3609
|
endIf() {
|
|
3596
|
-
return this._endBlockNode(m,
|
|
3610
|
+
return this._endBlockNode(m, y);
|
|
3597
3611
|
}
|
|
3598
3612
|
_for(a, h) {
|
|
3599
3613
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
@@ -3603,28 +3617,28 @@ var scope = {};
|
|
|
3603
3617
|
return this._for(new S(a), h);
|
|
3604
3618
|
}
|
|
3605
3619
|
// `for` statement for a range of values
|
|
3606
|
-
forRange(a, h, N, M,
|
|
3620
|
+
forRange(a, h, N, M, L = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3607
3621
|
const W = this._scope.toName(a);
|
|
3608
|
-
return this._for(new I(
|
|
3622
|
+
return this._for(new I(L, W, h, N), () => M(W));
|
|
3609
3623
|
}
|
|
3610
3624
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3611
3625
|
forOf(a, h, N, M = r.varKinds.const) {
|
|
3612
|
-
const
|
|
3626
|
+
const L = this._scope.toName(a);
|
|
3613
3627
|
if (this.opts.es5) {
|
|
3614
3628
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3615
3629
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3616
|
-
this.var(
|
|
3630
|
+
this.var(L, (0, t._)`${W}[${G}]`), N(L);
|
|
3617
3631
|
});
|
|
3618
3632
|
}
|
|
3619
|
-
return this._for(new D("of", M,
|
|
3633
|
+
return this._for(new D("of", M, L, h), () => N(L));
|
|
3620
3634
|
}
|
|
3621
3635
|
// `for-in` statement.
|
|
3622
3636
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3623
3637
|
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3624
3638
|
if (this.opts.ownProperties)
|
|
3625
3639
|
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
3626
|
-
const
|
|
3627
|
-
return this._for(new D("in", M,
|
|
3640
|
+
const L = this._scope.toName(a);
|
|
3641
|
+
return this._for(new D("in", M, L, h), () => N(L));
|
|
3628
3642
|
}
|
|
3629
3643
|
// end `for` loop
|
|
3630
3644
|
endFor() {
|
|
@@ -3651,14 +3665,14 @@ var scope = {};
|
|
|
3651
3665
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3652
3666
|
const M = new A();
|
|
3653
3667
|
if (this._blockNode(M), this.code(a), h) {
|
|
3654
|
-
const
|
|
3655
|
-
this._currNode = M.catch = new V(
|
|
3668
|
+
const L = this.name("e");
|
|
3669
|
+
this._currNode = M.catch = new V(L), h(L);
|
|
3656
3670
|
}
|
|
3657
3671
|
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(V, z);
|
|
3658
3672
|
}
|
|
3659
3673
|
// `throw` statement
|
|
3660
3674
|
throw(a) {
|
|
3661
|
-
return this._leafNode(new
|
|
3675
|
+
return this._leafNode(new g(a));
|
|
3662
3676
|
}
|
|
3663
3677
|
// start self-balancing block
|
|
3664
3678
|
block(a, h) {
|
|
@@ -3730,13 +3744,13 @@ var scope = {};
|
|
|
3730
3744
|
return N(P);
|
|
3731
3745
|
if (!M(P))
|
|
3732
3746
|
return P;
|
|
3733
|
-
return new t._Code(P._items.reduce((
|
|
3734
|
-
function N(
|
|
3735
|
-
const W = h[
|
|
3736
|
-
return W === void 0 || a[
|
|
3747
|
+
return new t._Code(P._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
|
|
3748
|
+
function N(L) {
|
|
3749
|
+
const W = h[L.str];
|
|
3750
|
+
return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
|
|
3737
3751
|
}
|
|
3738
|
-
function M(
|
|
3739
|
-
return
|
|
3752
|
+
function M(L) {
|
|
3753
|
+
return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3740
3754
|
}
|
|
3741
3755
|
}
|
|
3742
3756
|
function ke(P, a) {
|
|
@@ -3747,17 +3761,17 @@ var scope = {};
|
|
|
3747
3761
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
3748
3762
|
}
|
|
3749
3763
|
e.not = Ce;
|
|
3750
|
-
const
|
|
3764
|
+
const Le = $(e.operators.AND);
|
|
3751
3765
|
function et(...P) {
|
|
3752
|
-
return P.reduce(
|
|
3766
|
+
return P.reduce(Le);
|
|
3753
3767
|
}
|
|
3754
3768
|
e.and = et;
|
|
3755
|
-
const
|
|
3769
|
+
const qe = $(e.operators.OR);
|
|
3756
3770
|
function F(...P) {
|
|
3757
|
-
return P.reduce(
|
|
3771
|
+
return P.reduce(qe);
|
|
3758
3772
|
}
|
|
3759
3773
|
e.or = F;
|
|
3760
|
-
function
|
|
3774
|
+
function $(P) {
|
|
3761
3775
|
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${P} ${j(h)}`;
|
|
3762
3776
|
}
|
|
3763
3777
|
function j(P) {
|
|
@@ -3821,13 +3835,13 @@ var util = {};
|
|
|
3821
3835
|
}
|
|
3822
3836
|
e.unescapeFragment = u;
|
|
3823
3837
|
function p(w) {
|
|
3824
|
-
return encodeURIComponent(
|
|
3838
|
+
return encodeURIComponent(g(w));
|
|
3825
3839
|
}
|
|
3826
3840
|
e.escapeFragment = p;
|
|
3827
|
-
function
|
|
3841
|
+
function g(w) {
|
|
3828
3842
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3829
3843
|
}
|
|
3830
|
-
e.escapeJsonPointer =
|
|
3844
|
+
e.escapeJsonPointer = g;
|
|
3831
3845
|
function R(w) {
|
|
3832
3846
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3833
3847
|
}
|
|
@@ -3852,7 +3866,7 @@ var util = {};
|
|
|
3852
3866
|
w.if((0, t._)`${C} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${C})`));
|
|
3853
3867
|
}),
|
|
3854
3868
|
mergeToName: (w, C, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3855
|
-
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`),
|
|
3869
|
+
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), y(w, A, C));
|
|
3856
3870
|
}),
|
|
3857
3871
|
mergeValues: (w, C) => w === !0 ? !0 : { ...w, ...C },
|
|
3858
3872
|
resultToName: v
|
|
@@ -3868,13 +3882,13 @@ var util = {};
|
|
|
3868
3882
|
if (C === !0)
|
|
3869
3883
|
return w.var("props", !0);
|
|
3870
3884
|
const A = w.var("props", (0, t._)`{}`);
|
|
3871
|
-
return C !== void 0 &&
|
|
3885
|
+
return C !== void 0 && y(w, A, C), A;
|
|
3872
3886
|
}
|
|
3873
3887
|
e.evaluatedPropsToName = v;
|
|
3874
|
-
function
|
|
3888
|
+
function y(w, C, A) {
|
|
3875
3889
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${C}${(0, t.getProperty)(V)}`, !0));
|
|
3876
3890
|
}
|
|
3877
|
-
e.setEvaluated =
|
|
3891
|
+
e.setEvaluated = y;
|
|
3878
3892
|
const m = {};
|
|
3879
3893
|
function k(w, C) {
|
|
3880
3894
|
return w.scopeValue("func", {
|
|
@@ -3892,7 +3906,7 @@ var util = {};
|
|
|
3892
3906
|
const V = C === S.Num;
|
|
3893
3907
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3894
3908
|
}
|
|
3895
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3909
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3896
3910
|
}
|
|
3897
3911
|
e.getErrorPath = I;
|
|
3898
3912
|
function D(w, C, A = w.opts.strictSchema) {
|
|
@@ -3934,40 +3948,40 @@ names$1.default = names;
|
|
|
3934
3948
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3935
3949
|
const t = codegen, r = util, n = names$1;
|
|
3936
3950
|
e.keywordError = {
|
|
3937
|
-
message: ({ keyword:
|
|
3951
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3938
3952
|
}, e.keyword$DataError = {
|
|
3939
|
-
message: ({ keyword:
|
|
3953
|
+
message: ({ keyword: y, schemaType: m }) => m ? (0, t.str)`"${y}" keyword must be ${m} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3940
3954
|
};
|
|
3941
|
-
function s(
|
|
3942
|
-
const { it: I } =
|
|
3955
|
+
function s(y, m = e.keywordError, k, S) {
|
|
3956
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: C } = I, A = g(y, m, k);
|
|
3943
3957
|
S ?? (w || C) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3944
3958
|
}
|
|
3945
3959
|
e.reportError = s;
|
|
3946
|
-
function i(
|
|
3947
|
-
const { it: S } =
|
|
3960
|
+
function i(y, m = e.keywordError, k) {
|
|
3961
|
+
const { it: S } = y, { gen: I, compositeRule: D, allErrors: w } = S, C = g(y, m, k);
|
|
3948
3962
|
d(I, C), D || w || u(S, n.default.vErrors);
|
|
3949
3963
|
}
|
|
3950
3964
|
e.reportExtraError = i;
|
|
3951
|
-
function o(
|
|
3952
|
-
|
|
3965
|
+
function o(y, m) {
|
|
3966
|
+
y.assign(n.default.errors, m), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(m, () => y.assign((0, t._)`${n.default.vErrors}.length`, m), () => y.assign(n.default.vErrors, null)));
|
|
3953
3967
|
}
|
|
3954
3968
|
e.resetErrorsCount = o;
|
|
3955
|
-
function c({ gen:
|
|
3969
|
+
function c({ gen: y, keyword: m, schemaValue: k, data: S, errsCount: I, it: D }) {
|
|
3956
3970
|
if (I === void 0)
|
|
3957
3971
|
throw new Error("ajv implementation error");
|
|
3958
|
-
const w =
|
|
3959
|
-
|
|
3960
|
-
|
|
3972
|
+
const w = y.name("err");
|
|
3973
|
+
y.forRange("i", I, n.default.errors, (C) => {
|
|
3974
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${C}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, k), y.assign((0, t._)`${w}.data`, S));
|
|
3961
3975
|
});
|
|
3962
3976
|
}
|
|
3963
3977
|
e.extendErrors = c;
|
|
3964
|
-
function d(
|
|
3965
|
-
const k =
|
|
3966
|
-
|
|
3978
|
+
function d(y, m) {
|
|
3979
|
+
const k = y.const("err", m);
|
|
3980
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${k}]`), (0, t._)`${n.default.vErrors}.push(${k})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3967
3981
|
}
|
|
3968
|
-
function u(
|
|
3969
|
-
const { gen: k, validateName: S, schemaEnv: I } =
|
|
3970
|
-
I.$async ? k.throw((0, t._)`new ${
|
|
3982
|
+
function u(y, m) {
|
|
3983
|
+
const { gen: k, validateName: S, schemaEnv: I } = y;
|
|
3984
|
+
I.$async ? k.throw((0, t._)`new ${y.ValidationError}(${m})`) : (k.assign((0, t._)`${S}.errors`, m), k.return(!1));
|
|
3971
3985
|
}
|
|
3972
3986
|
const p = {
|
|
3973
3987
|
keyword: new t.Name("keyword"),
|
|
@@ -3978,28 +3992,28 @@ names$1.default = names;
|
|
|
3978
3992
|
schema: new t.Name("schema"),
|
|
3979
3993
|
parentSchema: new t.Name("parentSchema")
|
|
3980
3994
|
};
|
|
3981
|
-
function
|
|
3982
|
-
const { createErrors: S } =
|
|
3983
|
-
return S === !1 ? (0, t._)`{}` : R(
|
|
3995
|
+
function g(y, m, k) {
|
|
3996
|
+
const { createErrors: S } = y.it;
|
|
3997
|
+
return S === !1 ? (0, t._)`{}` : R(y, m, k);
|
|
3984
3998
|
}
|
|
3985
|
-
function R(
|
|
3986
|
-
const { gen: S, it: I } =
|
|
3999
|
+
function R(y, m, k = {}) {
|
|
4000
|
+
const { gen: S, it: I } = y, D = [
|
|
3987
4001
|
O(I, k),
|
|
3988
|
-
T(
|
|
4002
|
+
T(y, k)
|
|
3989
4003
|
];
|
|
3990
|
-
return v(
|
|
4004
|
+
return v(y, m, D), S.object(...D);
|
|
3991
4005
|
}
|
|
3992
|
-
function O({ errorPath:
|
|
3993
|
-
const k = m ? (0, t.str)`${
|
|
4006
|
+
function O({ errorPath: y }, { instancePath: m }) {
|
|
4007
|
+
const k = m ? (0, t.str)`${y}${(0, r.getErrorPath)(m, r.Type.Str)}` : y;
|
|
3994
4008
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
3995
4009
|
}
|
|
3996
|
-
function T({ keyword:
|
|
3997
|
-
let I = S ? m : (0, t.str)`${m}/${
|
|
4010
|
+
function T({ keyword: y, it: { errSchemaPath: m } }, { schemaPath: k, parentSchema: S }) {
|
|
4011
|
+
let I = S ? m : (0, t.str)`${m}/${y}`;
|
|
3998
4012
|
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [p.schemaPath, I];
|
|
3999
4013
|
}
|
|
4000
|
-
function v(
|
|
4001
|
-
const { keyword: I, data: D, schemaValue: w, it: C } =
|
|
4002
|
-
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(
|
|
4014
|
+
function v(y, { params: m, message: k }, S) {
|
|
4015
|
+
const { keyword: I, data: D, schemaValue: w, it: C } = y, { opts: A, propertyName: V, topSchemaRef: z, schemaPath: re } = C;
|
|
4016
|
+
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(y) : m || (0, t._)`{}`]), A.messages && S.push([p.message, typeof k == "function" ? k(y) : k]), A.verbose && S.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), V && S.push([p.propertyName, V]);
|
|
4003
4017
|
}
|
|
4004
4018
|
})(errors);
|
|
4005
4019
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4099,7 +4113,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4099
4113
|
}
|
|
4100
4114
|
e.getJSONTypes = d;
|
|
4101
4115
|
function u(S, I) {
|
|
4102
|
-
const { gen: D, data: w, opts: C } = S, A =
|
|
4116
|
+
const { gen: D, data: w, opts: C } = S, A = g(I, C.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(S, I[0]));
|
|
4103
4117
|
if (V) {
|
|
4104
4118
|
const z = v(I, w, C.strictNumbers, o.Wrong);
|
|
4105
4119
|
D.if(z, () => {
|
|
@@ -4110,7 +4124,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4110
4124
|
}
|
|
4111
4125
|
e.coerceAndCheckDataType = u;
|
|
4112
4126
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4113
|
-
function
|
|
4127
|
+
function g(S, I) {
|
|
4114
4128
|
return I ? S.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4115
4129
|
}
|
|
4116
4130
|
function R(S, I, D) {
|
|
@@ -4192,13 +4206,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4192
4206
|
return C;
|
|
4193
4207
|
}
|
|
4194
4208
|
e.checkDataTypes = v;
|
|
4195
|
-
const
|
|
4209
|
+
const y = {
|
|
4196
4210
|
message: ({ schema: S }) => `must be ${S}`,
|
|
4197
4211
|
params: ({ schema: S, schemaValue: I }) => typeof S == "string" ? (0, s._)`{type: ${S}}` : (0, s._)`{type: ${I}}`
|
|
4198
4212
|
};
|
|
4199
4213
|
function m(S) {
|
|
4200
4214
|
const I = k(S);
|
|
4201
|
-
(0, n.reportError)(I,
|
|
4215
|
+
(0, n.reportError)(I, y);
|
|
4202
4216
|
}
|
|
4203
4217
|
e.reportTypeError = m;
|
|
4204
4218
|
function k(S) {
|
|
@@ -4291,14 +4305,14 @@ function schemaProperties(e, t) {
|
|
|
4291
4305
|
}
|
|
4292
4306
|
code.schemaProperties = schemaProperties;
|
|
4293
4307
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, c, d, u) {
|
|
4294
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4308
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, g = [
|
|
4295
4309
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4296
4310
|
[names_1$5.default.parentData, o.parentData],
|
|
4297
4311
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4298
4312
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4299
4313
|
];
|
|
4300
|
-
o.opts.dynamicRef &&
|
|
4301
|
-
const R = (0, codegen_1$q._)`${p}, ${r.object(...
|
|
4314
|
+
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4315
|
+
const R = (0, codegen_1$q._)`${p}, ${r.object(...g)}`;
|
|
4302
4316
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${c}.call(${d}, ${R})` : (0, codegen_1$q._)`${c}(${R})`;
|
|
4303
4317
|
}
|
|
4304
4318
|
code.callValidateCode = callValidateCode;
|
|
@@ -4368,19 +4382,19 @@ function funcKeywordCode(e, t) {
|
|
|
4368
4382
|
var r;
|
|
4369
4383
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: c, it: d } = e;
|
|
4370
4384
|
checkAsyncKeyword(d, t);
|
|
4371
|
-
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4372
|
-
e.block$data(
|
|
4385
|
+
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), g = n.let("valid");
|
|
4386
|
+
e.block$data(g, R), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4373
4387
|
function R() {
|
|
4374
4388
|
if (t.errors === !1)
|
|
4375
|
-
v(), t.modifying && modifyData(e),
|
|
4389
|
+
v(), t.modifying && modifyData(e), y(() => e.error());
|
|
4376
4390
|
else {
|
|
4377
4391
|
const m = t.async ? O() : T();
|
|
4378
|
-
t.modifying && modifyData(e),
|
|
4392
|
+
t.modifying && modifyData(e), y(() => addErrs(e, m));
|
|
4379
4393
|
}
|
|
4380
4394
|
}
|
|
4381
4395
|
function O() {
|
|
4382
4396
|
const m = n.let("ruleErrs", null);
|
|
4383
|
-
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(
|
|
4397
|
+
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(g, !1).if((0, codegen_1$p._)`${k} instanceof ${d.ValidationError}`, () => n.assign(m, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), m;
|
|
4384
4398
|
}
|
|
4385
4399
|
function T() {
|
|
4386
4400
|
const m = (0, codegen_1$p._)`${p}.errors`;
|
|
@@ -4388,11 +4402,11 @@ function funcKeywordCode(e, t) {
|
|
|
4388
4402
|
}
|
|
4389
4403
|
function v(m = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4390
4404
|
const k = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, S = !("compile" in t && !c || t.schema === !1);
|
|
4391
|
-
n.assign(
|
|
4405
|
+
n.assign(g, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, k, S)}`, t.modifying);
|
|
4392
4406
|
}
|
|
4393
|
-
function
|
|
4407
|
+
function y(m) {
|
|
4394
4408
|
var k;
|
|
4395
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4409
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : g), m);
|
|
4396
4410
|
}
|
|
4397
4411
|
}
|
|
4398
4412
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4471,8 +4485,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4471
4485
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4472
4486
|
const { gen: c } = t;
|
|
4473
4487
|
if (r !== void 0) {
|
|
4474
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4475
|
-
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4488
|
+
const { errorPath: u, dataPathArr: p, opts: g } = t, R = c.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4489
|
+
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, g.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4476
4490
|
}
|
|
4477
4491
|
if (s !== void 0) {
|
|
4478
4492
|
const u = s instanceof codegen_1$o.Name ? s : c.let("data", s, !0);
|
|
@@ -4577,17 +4591,17 @@ function _traverse(e, t, r, n, s, i, o, c, d, u) {
|
|
|
4577
4591
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4578
4592
|
t(n, s, i, o, c, d, u);
|
|
4579
4593
|
for (var p in n) {
|
|
4580
|
-
var
|
|
4581
|
-
if (Array.isArray(
|
|
4594
|
+
var g = n[p];
|
|
4595
|
+
if (Array.isArray(g)) {
|
|
4582
4596
|
if (p in traverse$1.arrayKeywords)
|
|
4583
|
-
for (var R = 0; R <
|
|
4584
|
-
_traverse(e, t, r,
|
|
4597
|
+
for (var R = 0; R < g.length; R++)
|
|
4598
|
+
_traverse(e, t, r, g[R], s + "/" + p + "/" + R, i, s, p, n, R);
|
|
4585
4599
|
} else if (p in traverse$1.propsKeywords) {
|
|
4586
|
-
if (
|
|
4587
|
-
for (var O in
|
|
4588
|
-
_traverse(e, t, r,
|
|
4600
|
+
if (g && typeof g == "object")
|
|
4601
|
+
for (var O in g)
|
|
4602
|
+
_traverse(e, t, r, g[O], s + "/" + p + "/" + escapeJsonPtr(O), i, s, p, n, O);
|
|
4589
4603
|
} else
|
|
4590
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4604
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, g, s + "/" + p, i, s, p, n);
|
|
4591
4605
|
}
|
|
4592
4606
|
r(n, s, i, o, c, d, u);
|
|
4593
4607
|
}
|
|
@@ -4671,19 +4685,19 @@ function getSchemaRefs(e, t) {
|
|
|
4671
4685
|
if (typeof e == "boolean")
|
|
4672
4686
|
return {};
|
|
4673
4687
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), c = {}, d = /* @__PURE__ */ new Set();
|
|
4674
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4688
|
+
return traverse(e, { allKeys: !0 }, (g, R, O, T) => {
|
|
4675
4689
|
if (T === void 0)
|
|
4676
4690
|
return;
|
|
4677
4691
|
const v = o + R;
|
|
4678
|
-
let
|
|
4679
|
-
typeof
|
|
4692
|
+
let y = i[T];
|
|
4693
|
+
typeof g[r] == "string" && (y = m.call(this, g[r])), k.call(this, g.$anchor), k.call(this, g.$dynamicAnchor), i[R] = y;
|
|
4680
4694
|
function m(S) {
|
|
4681
4695
|
const I = this.opts.uriResolver.resolve;
|
|
4682
|
-
if (S = normalizeId(
|
|
4696
|
+
if (S = normalizeId(y ? I(y, S) : S), d.has(S))
|
|
4683
4697
|
throw p(S);
|
|
4684
4698
|
d.add(S);
|
|
4685
4699
|
let D = this.refs[S];
|
|
4686
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4700
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(g, D.schema, S) : S !== normalizeId(v) && (S[0] === "#" ? (u(g, c[S], S), c[S] = g) : this.refs[S] = v), S;
|
|
4687
4701
|
}
|
|
4688
4702
|
function k(S) {
|
|
4689
4703
|
if (typeof S == "string") {
|
|
@@ -4693,12 +4707,12 @@ function getSchemaRefs(e, t) {
|
|
|
4693
4707
|
}
|
|
4694
4708
|
}
|
|
4695
4709
|
}), c;
|
|
4696
|
-
function u(
|
|
4697
|
-
if (R !== void 0 && !equal$2(
|
|
4710
|
+
function u(g, R, O) {
|
|
4711
|
+
if (R !== void 0 && !equal$2(g, R))
|
|
4698
4712
|
throw p(O);
|
|
4699
4713
|
}
|
|
4700
|
-
function p(
|
|
4701
|
-
return new Error(`reference "${
|
|
4714
|
+
function p(g) {
|
|
4715
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4702
4716
|
}
|
|
4703
4717
|
}
|
|
4704
4718
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4815,10 +4829,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4815
4829
|
}
|
|
4816
4830
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4817
4831
|
for (const R of p.rules)
|
|
4818
|
-
|
|
4819
|
-
|
|
4832
|
+
g(R);
|
|
4833
|
+
g(p.post);
|
|
4820
4834
|
});
|
|
4821
|
-
function
|
|
4835
|
+
function g(R) {
|
|
4822
4836
|
(0, applicability_1.shouldUseGroup)(i, R) && (R.type ? (s.if((0, dataType_2.checkDataType)(R.type, o, d.strictNumbers)), iterateKeywords(e, R), t.length === 1 && t[0] === R.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, R), c || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4823
4837
|
}
|
|
4824
4838
|
}
|
|
@@ -5081,10 +5095,10 @@ function compileSchema(e) {
|
|
|
5081
5095
|
let p;
|
|
5082
5096
|
try {
|
|
5083
5097
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5084
|
-
const
|
|
5085
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5098
|
+
const g = o.toString();
|
|
5099
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${g}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5086
5100
|
const O = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5087
|
-
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode:
|
|
5101
|
+
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode: g, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5088
5102
|
const { props: T, items: v } = u;
|
|
5089
5103
|
O.evaluated = {
|
|
5090
5104
|
props: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
@@ -5094,8 +5108,8 @@ function compileSchema(e) {
|
|
|
5094
5108
|
}, O.source && (O.source.evaluated = (0, codegen_1$m.stringify)(O.evaluated));
|
|
5095
5109
|
}
|
|
5096
5110
|
return e.validate = O, e;
|
|
5097
|
-
} catch (
|
|
5098
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5111
|
+
} catch (g) {
|
|
5112
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), g;
|
|
5099
5113
|
} finally {
|
|
5100
5114
|
this._compilations.delete(e);
|
|
5101
5115
|
}
|
|
@@ -5212,8 +5226,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5212
5226
|
n(t);
|
|
5213
5227
|
})(commonjsGlobal, function(r) {
|
|
5214
5228
|
function n() {
|
|
5215
|
-
for (var f = arguments.length, l = Array(f),
|
|
5216
|
-
l[
|
|
5229
|
+
for (var f = arguments.length, l = Array(f), _ = 0; _ < f; _++)
|
|
5230
|
+
l[_] = arguments[_];
|
|
5217
5231
|
if (l.length > 1) {
|
|
5218
5232
|
l[0] = l[0].slice(0, -1);
|
|
5219
5233
|
for (var E = l.length - 1, b = 1; b < E; ++b)
|
|
@@ -5235,20 +5249,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5235
5249
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5236
5250
|
}
|
|
5237
5251
|
function d(f, l) {
|
|
5238
|
-
var
|
|
5252
|
+
var _ = f;
|
|
5239
5253
|
if (l)
|
|
5240
5254
|
for (var E in l)
|
|
5241
|
-
|
|
5242
|
-
return
|
|
5255
|
+
_[E] = l[E];
|
|
5256
|
+
return _;
|
|
5243
5257
|
}
|
|
5244
5258
|
function u(f) {
|
|
5245
|
-
var l = "[A-Za-z]",
|
|
5246
|
-
s(l + n(l,
|
|
5247
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5259
|
+
var l = "[A-Za-z]", _ = "[0-9]", E = n(_, "[A-Fa-f]"), b = s(s("%[EFef]" + E + "%" + E + E + "%" + E + E) + "|" + s("%[89A-Fa-f]" + E + "%" + E + E) + "|" + s("%" + E + E)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, _, "[\\-\\.\\_\\~]", Y);
|
|
5260
|
+
s(l + n(l, _, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
|
|
5261
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + _) + "|" + s("1" + _ + _) + "|" + s("0?[1-9]" + _) + "|0?0?" + _), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), x = s(E + "{1,4}"), X = s(s(x + "\\:" + x) + "|" + ie), ae = s(s(x + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(x + "\\:") + "{5}" + X), Se = s(s(x) + "?\\:\\:" + s(x + "\\:") + "{4}" + X), ge = s(s(s(x + "\\:") + "{0,1}" + x) + "?\\:\\:" + s(x + "\\:") + "{3}" + X), ye = s(s(s(x + "\\:") + "{0,2}" + x) + "?\\:\\:" + s(x + "\\:") + "{2}" + X), Be = s(s(s(x + "\\:") + "{0,3}" + x) + "?\\:\\:" + x + "\\:" + X), Ie = s(s(s(x + "\\:") + "{0,4}" + x) + "?\\:\\:" + X), fe = s(s(s(x + "\\:") + "{0,5}" + x) + "?\\:\\:" + x), $e = s(s(s(x + "\\:") + "{0,6}" + x) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5248
5262
|
s("[vV]" + E + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
|
|
5249
5263
|
var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
|
|
5250
5264
|
return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5251
|
-
NOT_SCHEME: new RegExp(n("[^]", l,
|
|
5265
|
+
NOT_SCHEME: new RegExp(n("[^]", l, _, "[\\+\\-\\.]"), "g"),
|
|
5252
5266
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5253
5267
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5254
5268
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
@@ -5264,63 +5278,63 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5264
5278
|
//RFC 6874, with relaxed parsing rules
|
|
5265
5279
|
};
|
|
5266
5280
|
}
|
|
5267
|
-
var p = u(!1),
|
|
5268
|
-
function f(l,
|
|
5269
|
-
var E = [], b = !0,
|
|
5281
|
+
var p = u(!1), g = u(!0), R = function() {
|
|
5282
|
+
function f(l, _) {
|
|
5283
|
+
var E = [], b = !0, q = !1, U = void 0;
|
|
5270
5284
|
try {
|
|
5271
|
-
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (E.push(Y.value), !(
|
|
5285
|
+
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (E.push(Y.value), !(_ && E.length === _)); b = !0)
|
|
5272
5286
|
;
|
|
5273
5287
|
} catch (se) {
|
|
5274
|
-
|
|
5288
|
+
q = !0, U = se;
|
|
5275
5289
|
} finally {
|
|
5276
5290
|
try {
|
|
5277
5291
|
!b && J.return && J.return();
|
|
5278
5292
|
} finally {
|
|
5279
|
-
if (
|
|
5293
|
+
if (q)
|
|
5280
5294
|
throw U;
|
|
5281
5295
|
}
|
|
5282
5296
|
}
|
|
5283
5297
|
return E;
|
|
5284
5298
|
}
|
|
5285
|
-
return function(l,
|
|
5299
|
+
return function(l, _) {
|
|
5286
5300
|
if (Array.isArray(l))
|
|
5287
5301
|
return l;
|
|
5288
5302
|
if (Symbol.iterator in Object(l))
|
|
5289
|
-
return f(l,
|
|
5303
|
+
return f(l, _);
|
|
5290
5304
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5291
5305
|
};
|
|
5292
5306
|
}(), O = function(f) {
|
|
5293
5307
|
if (Array.isArray(f)) {
|
|
5294
|
-
for (var l = 0,
|
|
5295
|
-
|
|
5296
|
-
return
|
|
5308
|
+
for (var l = 0, _ = Array(f.length); l < f.length; l++)
|
|
5309
|
+
_[l] = f[l];
|
|
5310
|
+
return _;
|
|
5297
5311
|
} else
|
|
5298
5312
|
return Array.from(f);
|
|
5299
|
-
}, T = 2147483647, v = 36,
|
|
5313
|
+
}, T = 2147483647, v = 36, y = 1, m = 26, k = 38, S = 700, I = 72, D = 128, w = "-", C = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5300
5314
|
overflow: "Overflow: input needs wider integers to process",
|
|
5301
5315
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5302
5316
|
"invalid-input": "Invalid input"
|
|
5303
|
-
}, re = v -
|
|
5317
|
+
}, re = v - y, K = Math.floor, ue = String.fromCharCode;
|
|
5304
5318
|
function oe(f) {
|
|
5305
5319
|
throw new RangeError(z[f]);
|
|
5306
5320
|
}
|
|
5307
5321
|
function ke(f, l) {
|
|
5308
|
-
for (var
|
|
5309
|
-
|
|
5310
|
-
return
|
|
5322
|
+
for (var _ = [], E = f.length; E--; )
|
|
5323
|
+
_[E] = l(f[E]);
|
|
5324
|
+
return _;
|
|
5311
5325
|
}
|
|
5312
5326
|
function Ce(f, l) {
|
|
5313
|
-
var
|
|
5314
|
-
|
|
5315
|
-
var b = f.split("."),
|
|
5316
|
-
return E +
|
|
5317
|
-
}
|
|
5318
|
-
function
|
|
5319
|
-
for (var l = [],
|
|
5320
|
-
var b = f.charCodeAt(
|
|
5321
|
-
if (b >= 55296 && b <= 56319 &&
|
|
5322
|
-
var
|
|
5323
|
-
(
|
|
5327
|
+
var _ = f.split("@"), E = "";
|
|
5328
|
+
_.length > 1 && (E = _[0] + "@", f = _[1]), f = f.replace(V, ".");
|
|
5329
|
+
var b = f.split("."), q = ke(b, l).join(".");
|
|
5330
|
+
return E + q;
|
|
5331
|
+
}
|
|
5332
|
+
function Le(f) {
|
|
5333
|
+
for (var l = [], _ = 0, E = f.length; _ < E; ) {
|
|
5334
|
+
var b = f.charCodeAt(_++);
|
|
5335
|
+
if (b >= 55296 && b <= 56319 && _ < E) {
|
|
5336
|
+
var q = f.charCodeAt(_++);
|
|
5337
|
+
(q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), _--);
|
|
5324
5338
|
} else
|
|
5325
5339
|
l.push(b);
|
|
5326
5340
|
}
|
|
@@ -5328,14 +5342,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5328
5342
|
}
|
|
5329
5343
|
var et = function(l) {
|
|
5330
5344
|
return String.fromCodePoint.apply(String, O(l));
|
|
5331
|
-
},
|
|
5345
|
+
}, qe = function(l) {
|
|
5332
5346
|
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : v;
|
|
5333
|
-
}, F = function(l,
|
|
5334
|
-
return l + 22 + 75 * (l < 26) - ((
|
|
5335
|
-
},
|
|
5347
|
+
}, F = function(l, _) {
|
|
5348
|
+
return l + 22 + 75 * (l < 26) - ((_ != 0) << 5);
|
|
5349
|
+
}, $ = function(l, _, E) {
|
|
5336
5350
|
var b = 0;
|
|
5337
5351
|
for (
|
|
5338
|
-
l = E ? K(l / S) : l >> 1, l += K(l /
|
|
5352
|
+
l = E ? K(l / S) : l >> 1, l += K(l / _);
|
|
5339
5353
|
/* no initialization */
|
|
5340
5354
|
l > re * m >> 1;
|
|
5341
5355
|
b += v
|
|
@@ -5343,10 +5357,10 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5343
5357
|
l = K(l / re);
|
|
5344
5358
|
return K(b + (re + 1) * l / (l + k));
|
|
5345
5359
|
}, j = function(l) {
|
|
5346
|
-
var
|
|
5360
|
+
var _ = [], E = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
|
|
5347
5361
|
J < 0 && (J = 0);
|
|
5348
5362
|
for (var Y = 0; Y < J; ++Y)
|
|
5349
|
-
l.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5363
|
+
l.charCodeAt(Y) >= 128 && oe("not-basic"), _.push(l.charCodeAt(Y));
|
|
5350
5364
|
for (var se = J > 0 ? J + 1 : 0; se < E; ) {
|
|
5351
5365
|
for (
|
|
5352
5366
|
var B = b, Z = 1, ie = v;
|
|
@@ -5355,26 +5369,26 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5355
5369
|
ie += v
|
|
5356
5370
|
) {
|
|
5357
5371
|
se >= E && oe("invalid-input");
|
|
5358
|
-
var x =
|
|
5372
|
+
var x = qe(l.charCodeAt(se++));
|
|
5359
5373
|
(x >= v || x > K((T - b) / Z)) && oe("overflow"), b += x * Z;
|
|
5360
|
-
var X = ie <= U ?
|
|
5374
|
+
var X = ie <= U ? y : ie >= U + m ? m : ie - U;
|
|
5361
5375
|
if (x < X)
|
|
5362
5376
|
break;
|
|
5363
5377
|
var ae = v - X;
|
|
5364
5378
|
Z > K(T / ae) && oe("overflow"), Z *= ae;
|
|
5365
5379
|
}
|
|
5366
|
-
var ee =
|
|
5367
|
-
U =
|
|
5380
|
+
var ee = _.length + 1;
|
|
5381
|
+
U = $(b - B, ee, B == 0), K(b / ee) > T - q && oe("overflow"), q += K(b / ee), b %= ee, _.splice(b++, 0, q);
|
|
5368
5382
|
}
|
|
5369
|
-
return String.fromCodePoint.apply(String,
|
|
5383
|
+
return String.fromCodePoint.apply(String, _);
|
|
5370
5384
|
}, P = function(l) {
|
|
5371
|
-
var
|
|
5372
|
-
l =
|
|
5373
|
-
var E = l.length, b = D,
|
|
5385
|
+
var _ = [];
|
|
5386
|
+
l = Le(l);
|
|
5387
|
+
var E = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
|
|
5374
5388
|
try {
|
|
5375
5389
|
for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5376
5390
|
var ie = Z.value;
|
|
5377
|
-
ie < 128 &&
|
|
5391
|
+
ie < 128 && _.push(ue(ie));
|
|
5378
5392
|
}
|
|
5379
5393
|
} catch (lt) {
|
|
5380
5394
|
Y = !0, se = lt;
|
|
@@ -5386,11 +5400,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5386
5400
|
throw se;
|
|
5387
5401
|
}
|
|
5388
5402
|
}
|
|
5389
|
-
var x =
|
|
5390
|
-
for (x &&
|
|
5403
|
+
var x = _.length, X = x;
|
|
5404
|
+
for (x && _.push(w); X < E; ) {
|
|
5391
5405
|
var ae = T, ee = !0, Se = !1, ge = void 0;
|
|
5392
5406
|
try {
|
|
5393
|
-
for (var
|
|
5407
|
+
for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
|
|
5394
5408
|
var Ie = Be.value;
|
|
5395
5409
|
Ie >= b && Ie < ae && (ae = Ie);
|
|
5396
5410
|
}
|
|
@@ -5398,54 +5412,54 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5398
5412
|
Se = !0, ge = lt;
|
|
5399
5413
|
} finally {
|
|
5400
5414
|
try {
|
|
5401
|
-
!ee &&
|
|
5415
|
+
!ee && ye.return && ye.return();
|
|
5402
5416
|
} finally {
|
|
5403
5417
|
if (Se)
|
|
5404
5418
|
throw ge;
|
|
5405
5419
|
}
|
|
5406
5420
|
}
|
|
5407
5421
|
var fe = X + 1;
|
|
5408
|
-
ae - b > K((T -
|
|
5409
|
-
var
|
|
5422
|
+
ae - b > K((T - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
|
|
5423
|
+
var $e = !0, je = !1, we = void 0;
|
|
5410
5424
|
try {
|
|
5411
|
-
for (var ct = l[Symbol.iterator](), Ut; !(
|
|
5425
|
+
for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
|
|
5412
5426
|
var Ht = Ut.value;
|
|
5413
|
-
if (Ht < b && ++
|
|
5427
|
+
if (Ht < b && ++q > T && oe("overflow"), Ht == b) {
|
|
5414
5428
|
for (
|
|
5415
|
-
var pt =
|
|
5429
|
+
var pt = q, ft = v;
|
|
5416
5430
|
;
|
|
5417
5431
|
/* no condition */
|
|
5418
5432
|
ft += v
|
|
5419
5433
|
) {
|
|
5420
|
-
var ht = ft <= U ?
|
|
5434
|
+
var ht = ft <= U ? y : ft >= U + m ? m : ft - U;
|
|
5421
5435
|
if (pt < ht)
|
|
5422
5436
|
break;
|
|
5423
5437
|
var Vt = pt - ht, xt = v - ht;
|
|
5424
|
-
|
|
5438
|
+
_.push(ue(F(ht + Vt % xt, 0))), pt = K(Vt / xt);
|
|
5425
5439
|
}
|
|
5426
|
-
|
|
5440
|
+
_.push(ue(F(pt, 0))), U = $(q, fe, X == x), q = 0, ++X;
|
|
5427
5441
|
}
|
|
5428
5442
|
}
|
|
5429
5443
|
} catch (lt) {
|
|
5430
5444
|
je = !0, we = lt;
|
|
5431
5445
|
} finally {
|
|
5432
5446
|
try {
|
|
5433
|
-
|
|
5447
|
+
!$e && ct.return && ct.return();
|
|
5434
5448
|
} finally {
|
|
5435
5449
|
if (je)
|
|
5436
5450
|
throw we;
|
|
5437
5451
|
}
|
|
5438
5452
|
}
|
|
5439
|
-
++
|
|
5453
|
+
++q, ++b;
|
|
5440
5454
|
}
|
|
5441
|
-
return
|
|
5455
|
+
return _.join("");
|
|
5442
5456
|
}, a = function(l) {
|
|
5443
|
-
return Ce(l, function(
|
|
5444
|
-
return C.test(
|
|
5457
|
+
return Ce(l, function(_) {
|
|
5458
|
+
return C.test(_) ? j(_.slice(4).toLowerCase()) : _;
|
|
5445
5459
|
});
|
|
5446
5460
|
}, h = function(l) {
|
|
5447
|
-
return Ce(l, function(
|
|
5448
|
-
return A.test(
|
|
5461
|
+
return Ce(l, function(_) {
|
|
5462
|
+
return A.test(_) ? "xn--" + P(_) : _;
|
|
5449
5463
|
});
|
|
5450
5464
|
}, N = {
|
|
5451
5465
|
/**
|
|
@@ -5462,7 +5476,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5462
5476
|
* @type Object
|
|
5463
5477
|
*/
|
|
5464
5478
|
ucs2: {
|
|
5465
|
-
decode:
|
|
5479
|
+
decode: Le,
|
|
5466
5480
|
encode: et
|
|
5467
5481
|
},
|
|
5468
5482
|
decode: j,
|
|
@@ -5470,99 +5484,99 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5470
5484
|
toASCII: h,
|
|
5471
5485
|
toUnicode: a
|
|
5472
5486
|
}, M = {};
|
|
5473
|
-
function
|
|
5474
|
-
var l = f.charCodeAt(0),
|
|
5475
|
-
return l < 16 ?
|
|
5487
|
+
function L(f) {
|
|
5488
|
+
var l = f.charCodeAt(0), _ = void 0;
|
|
5489
|
+
return l < 16 ? _ = "%0" + l.toString(16).toUpperCase() : l < 128 ? _ = "%" + l.toString(16).toUpperCase() : l < 2048 ? _ = "%" + (l >> 6 | 192).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase() : _ = "%" + (l >> 12 | 224).toString(16).toUpperCase() + "%" + (l >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase(), _;
|
|
5476
5490
|
}
|
|
5477
5491
|
function W(f) {
|
|
5478
|
-
for (var l = "",
|
|
5479
|
-
var b = parseInt(f.substr(
|
|
5492
|
+
for (var l = "", _ = 0, E = f.length; _ < E; ) {
|
|
5493
|
+
var b = parseInt(f.substr(_ + 1, 2), 16);
|
|
5480
5494
|
if (b < 128)
|
|
5481
|
-
l += String.fromCharCode(b),
|
|
5495
|
+
l += String.fromCharCode(b), _ += 3;
|
|
5482
5496
|
else if (b >= 194 && b < 224) {
|
|
5483
|
-
if (E -
|
|
5484
|
-
var
|
|
5485
|
-
l += String.fromCharCode((b & 31) << 6 |
|
|
5497
|
+
if (E - _ >= 6) {
|
|
5498
|
+
var q = parseInt(f.substr(_ + 4, 2), 16);
|
|
5499
|
+
l += String.fromCharCode((b & 31) << 6 | q & 63);
|
|
5486
5500
|
} else
|
|
5487
|
-
l += f.substr(
|
|
5488
|
-
|
|
5501
|
+
l += f.substr(_, 6);
|
|
5502
|
+
_ += 6;
|
|
5489
5503
|
} else if (b >= 224) {
|
|
5490
|
-
if (E -
|
|
5491
|
-
var U = parseInt(f.substr(
|
|
5504
|
+
if (E - _ >= 9) {
|
|
5505
|
+
var U = parseInt(f.substr(_ + 4, 2), 16), J = parseInt(f.substr(_ + 7, 2), 16);
|
|
5492
5506
|
l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
|
|
5493
5507
|
} else
|
|
5494
|
-
l += f.substr(
|
|
5495
|
-
|
|
5508
|
+
l += f.substr(_, 9);
|
|
5509
|
+
_ += 9;
|
|
5496
5510
|
} else
|
|
5497
|
-
l += f.substr(
|
|
5511
|
+
l += f.substr(_, 3), _ += 3;
|
|
5498
5512
|
}
|
|
5499
5513
|
return l;
|
|
5500
5514
|
}
|
|
5501
5515
|
function G(f, l) {
|
|
5502
|
-
function
|
|
5516
|
+
function _(E) {
|
|
5503
5517
|
var b = W(E);
|
|
5504
5518
|
return b.match(l.UNRESERVED) ? b : E;
|
|
5505
5519
|
}
|
|
5506
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED,
|
|
5520
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, _).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, _).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, _).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, _).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
|
|
5507
5521
|
}
|
|
5508
5522
|
function ne(f) {
|
|
5509
5523
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5510
5524
|
}
|
|
5511
5525
|
function he(f, l) {
|
|
5512
|
-
var
|
|
5526
|
+
var _ = f.match(l.IPV4ADDRESS) || [], E = R(_, 2), b = E[1];
|
|
5513
5527
|
return b ? b.split(".").map(ne).join(".") : f;
|
|
5514
5528
|
}
|
|
5515
5529
|
function Ue(f, l) {
|
|
5516
|
-
var
|
|
5530
|
+
var _ = f.match(l.IPV6ADDRESS) || [], E = R(_, 3), b = E[1], q = E[2];
|
|
5517
5531
|
if (b) {
|
|
5518
5532
|
for (var U = b.toLowerCase().split("::").reverse(), J = R(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), x = ie ? 7 : 8, X = Z.length - x, ae = Array(x), ee = 0; ee < x; ++ee)
|
|
5519
5533
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5520
5534
|
ie && (ae[x - 1] = he(ae[x - 1], l));
|
|
5521
|
-
var Se = ae.reduce(function(fe,
|
|
5522
|
-
if (
|
|
5535
|
+
var Se = ae.reduce(function(fe, $e, je) {
|
|
5536
|
+
if (!$e || $e === "0") {
|
|
5523
5537
|
var we = fe[fe.length - 1];
|
|
5524
5538
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5525
5539
|
}
|
|
5526
5540
|
return fe;
|
|
5527
|
-
}, []), ge = Se.sort(function(fe,
|
|
5528
|
-
return
|
|
5529
|
-
})[0],
|
|
5541
|
+
}, []), ge = Se.sort(function(fe, $e) {
|
|
5542
|
+
return $e.length - fe.length;
|
|
5543
|
+
})[0], ye = void 0;
|
|
5530
5544
|
if (ge && ge.length > 1) {
|
|
5531
5545
|
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5532
|
-
|
|
5546
|
+
ye = Be.join(":") + "::" + Ie.join(":");
|
|
5533
5547
|
} else
|
|
5534
|
-
|
|
5535
|
-
return
|
|
5548
|
+
ye = ae.join(":");
|
|
5549
|
+
return q && (ye += "%" + q), ye;
|
|
5536
5550
|
} else
|
|
5537
5551
|
return f;
|
|
5538
5552
|
}
|
|
5539
5553
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5540
5554
|
function de(f) {
|
|
5541
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5555
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = {}, E = l.iri !== !1 ? g : p;
|
|
5542
5556
|
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5543
5557
|
var b = f.match(tt);
|
|
5544
5558
|
if (b) {
|
|
5545
|
-
rt ? (
|
|
5546
|
-
var
|
|
5547
|
-
if (!l.unicodeSupport && (!
|
|
5548
|
-
if (
|
|
5559
|
+
rt ? (_.scheme = b[1], _.userinfo = b[3], _.host = b[4], _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = b[7], _.fragment = b[8], isNaN(_.port) && (_.port = b[5])) : (_.scheme = b[1] || void 0, _.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, _.host = f.indexOf("//") !== -1 ? b[4] : void 0, _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = f.indexOf("?") !== -1 ? b[7] : void 0, _.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(_.port) && (_.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), _.host && (_.host = Ue(he(_.host, E), E)), _.scheme === void 0 && _.userinfo === void 0 && _.host === void 0 && _.port === void 0 && !_.path && _.query === void 0 ? _.reference = "same-document" : _.scheme === void 0 ? _.reference = "relative" : _.fragment === void 0 ? _.reference = "absolute" : _.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== _.reference && (_.error = _.error || "URI is not a " + l.reference + " reference.");
|
|
5560
|
+
var q = M[(l.scheme || _.scheme || "").toLowerCase()];
|
|
5561
|
+
if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
|
|
5562
|
+
if (_.host && (l.domainHost || q && q.domainHost))
|
|
5549
5563
|
try {
|
|
5550
|
-
|
|
5564
|
+
_.host = N.toASCII(_.host.replace(E.PCT_ENCODED, W).toLowerCase());
|
|
5551
5565
|
} catch (U) {
|
|
5552
|
-
|
|
5566
|
+
_.error = _.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5553
5567
|
}
|
|
5554
|
-
G(
|
|
5568
|
+
G(_, p);
|
|
5555
5569
|
} else
|
|
5556
|
-
G(
|
|
5557
|
-
|
|
5570
|
+
G(_, E);
|
|
5571
|
+
q && q.parse && q.parse(_, l);
|
|
5558
5572
|
} else
|
|
5559
|
-
|
|
5560
|
-
return
|
|
5573
|
+
_.error = _.error || "URI can not be parsed.";
|
|
5574
|
+
return _;
|
|
5561
5575
|
}
|
|
5562
5576
|
function nt(f, l) {
|
|
5563
|
-
var
|
|
5564
|
-
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host),
|
|
5565
|
-
return "[" +
|
|
5577
|
+
var _ = l.iri !== !1 ? g : p, E = [];
|
|
5578
|
+
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host), _), _).replace(_.IPV6ADDRESS, function(b, q, U) {
|
|
5579
|
+
return "[" + q + (U ? "%25" + U : "") + "]";
|
|
5566
5580
|
})), (typeof f.port == "number" || typeof f.port == "string") && (E.push(":"), E.push(String(f.port))), E.length ? E.join("") : void 0;
|
|
5567
5581
|
}
|
|
5568
5582
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
@@ -5577,9 +5591,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5577
5591
|
else if (f === "." || f === "..")
|
|
5578
5592
|
f = "";
|
|
5579
5593
|
else {
|
|
5580
|
-
var
|
|
5581
|
-
if (
|
|
5582
|
-
var E =
|
|
5594
|
+
var _ = f.match(st);
|
|
5595
|
+
if (_) {
|
|
5596
|
+
var E = _[0];
|
|
5583
5597
|
f = f.slice(E.length), l.push(E);
|
|
5584
5598
|
} else
|
|
5585
5599
|
throw new Error("Unexpected dot segment condition");
|
|
@@ -5587,50 +5601,50 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5587
5601
|
return l.join("");
|
|
5588
5602
|
}
|
|
5589
5603
|
function le(f) {
|
|
5590
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5591
|
-
if (b && b.serialize && b.serialize(f, l), f.host && !
|
|
5604
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = l.iri ? g : p, E = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
|
|
5605
|
+
if (b && b.serialize && b.serialize(f, l), f.host && !_.IPV6ADDRESS.test(f.host)) {
|
|
5592
5606
|
if (l.domainHost || b && b.domainHost)
|
|
5593
5607
|
try {
|
|
5594
|
-
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(
|
|
5608
|
+
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(_.PCT_ENCODED, W).toLowerCase());
|
|
5595
5609
|
} catch (J) {
|
|
5596
5610
|
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5597
5611
|
}
|
|
5598
5612
|
}
|
|
5599
|
-
G(f,
|
|
5600
|
-
var
|
|
5601
|
-
if (
|
|
5613
|
+
G(f, _), l.reference !== "suffix" && f.scheme && (E.push(f.scheme), E.push(":"));
|
|
5614
|
+
var q = nt(f, l);
|
|
5615
|
+
if (q !== void 0 && (l.reference !== "suffix" && E.push("//"), E.push(q), f.path && f.path.charAt(0) !== "/" && E.push("/")), f.path !== void 0) {
|
|
5602
5616
|
var U = f.path;
|
|
5603
|
-
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)),
|
|
5617
|
+
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), E.push(U);
|
|
5604
5618
|
}
|
|
5605
5619
|
return f.query !== void 0 && (E.push("?"), E.push(f.query)), f.fragment !== void 0 && (E.push("#"), E.push(f.fragment)), E.join("");
|
|
5606
5620
|
}
|
|
5607
5621
|
function ze(f, l) {
|
|
5608
|
-
var
|
|
5609
|
-
return E || (f = de(le(f,
|
|
5622
|
+
var _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, E = arguments[3], b = {};
|
|
5623
|
+
return E || (f = de(le(f, _), _), l = de(le(l, _), _)), _ = _ || {}, !_.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
|
|
5610
5624
|
}
|
|
5611
|
-
function it(f, l,
|
|
5612
|
-
var E = d({ scheme: "null" },
|
|
5625
|
+
function it(f, l, _) {
|
|
5626
|
+
var E = d({ scheme: "null" }, _);
|
|
5613
5627
|
return le(ze(de(f, E), de(l, E), E, !0), E);
|
|
5614
5628
|
}
|
|
5615
5629
|
function Oe(f, l) {
|
|
5616
5630
|
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
5617
5631
|
}
|
|
5618
|
-
function ot(f, l,
|
|
5619
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5632
|
+
function ot(f, l, _) {
|
|
5633
|
+
return typeof f == "string" ? f = le(de(f, _), _) : i(f) === "object" && (f = le(f, _)), typeof l == "string" ? l = le(de(l, _), _) : i(l) === "object" && (l = le(l, _)), f === l;
|
|
5620
5634
|
}
|
|
5621
5635
|
function ut(f, l) {
|
|
5622
|
-
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE :
|
|
5636
|
+
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : g.ESCAPE, L);
|
|
5623
5637
|
}
|
|
5624
5638
|
function pe(f, l) {
|
|
5625
|
-
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED :
|
|
5639
|
+
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : g.PCT_ENCODED, W);
|
|
5626
5640
|
}
|
|
5627
5641
|
var Ne = {
|
|
5628
5642
|
scheme: "http",
|
|
5629
5643
|
domainHost: !0,
|
|
5630
|
-
parse: function(l,
|
|
5644
|
+
parse: function(l, _) {
|
|
5631
5645
|
return l.host || (l.error = l.error || "HTTP URIs must have a host."), l;
|
|
5632
5646
|
},
|
|
5633
|
-
serialize: function(l,
|
|
5647
|
+
serialize: function(l, _) {
|
|
5634
5648
|
var E = String(l.scheme).toLowerCase() === "https";
|
|
5635
5649
|
return (l.port === (E ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5636
5650
|
}
|
|
@@ -5646,14 +5660,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5646
5660
|
var at = {
|
|
5647
5661
|
scheme: "ws",
|
|
5648
5662
|
domainHost: !0,
|
|
5649
|
-
parse: function(l,
|
|
5663
|
+
parse: function(l, _) {
|
|
5650
5664
|
var E = l;
|
|
5651
5665
|
return E.secure = jt(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E;
|
|
5652
5666
|
},
|
|
5653
|
-
serialize: function(l,
|
|
5667
|
+
serialize: function(l, _) {
|
|
5654
5668
|
if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
|
|
5655
|
-
var E = l.resourceName.split("?"), b = R(E, 2),
|
|
5656
|
-
l.path =
|
|
5669
|
+
var E = l.resourceName.split("?"), b = R(E, 2), q = b[0], U = b[1];
|
|
5670
|
+
l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
|
|
5657
5671
|
}
|
|
5658
5672
|
return l.fragment = void 0, l;
|
|
5659
5673
|
}
|
|
@@ -5669,10 +5683,10 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5669
5683
|
}
|
|
5670
5684
|
var Mt = {
|
|
5671
5685
|
scheme: "mailto",
|
|
5672
|
-
parse: function(l,
|
|
5686
|
+
parse: function(l, _) {
|
|
5673
5687
|
var E = l, b = E.to = E.path ? E.path.split(",") : [];
|
|
5674
5688
|
if (E.path = void 0, E.query) {
|
|
5675
|
-
for (var
|
|
5689
|
+
for (var q = !1, U = {}, J = E.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5676
5690
|
var B = J[Y].split("=");
|
|
5677
5691
|
switch (B[0]) {
|
|
5678
5692
|
case "to":
|
|
@@ -5680,26 +5694,26 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5680
5694
|
b.push(Z[ie]);
|
|
5681
5695
|
break;
|
|
5682
5696
|
case "subject":
|
|
5683
|
-
E.subject = pe(B[1],
|
|
5697
|
+
E.subject = pe(B[1], _);
|
|
5684
5698
|
break;
|
|
5685
5699
|
case "body":
|
|
5686
|
-
E.body = pe(B[1],
|
|
5700
|
+
E.body = pe(B[1], _);
|
|
5687
5701
|
break;
|
|
5688
5702
|
default:
|
|
5689
|
-
|
|
5703
|
+
q = !0, U[pe(B[0], _)] = pe(B[1], _);
|
|
5690
5704
|
break;
|
|
5691
5705
|
}
|
|
5692
5706
|
}
|
|
5693
|
-
|
|
5707
|
+
q && (E.headers = U);
|
|
5694
5708
|
}
|
|
5695
5709
|
E.query = void 0;
|
|
5696
5710
|
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
5697
5711
|
var ee = b[X].split("@");
|
|
5698
|
-
if (ee[0] = pe(ee[0]),
|
|
5699
|
-
ee[1] = pe(ee[1],
|
|
5712
|
+
if (ee[0] = pe(ee[0]), _.unicodeSupport)
|
|
5713
|
+
ee[1] = pe(ee[1], _).toLowerCase();
|
|
5700
5714
|
else
|
|
5701
5715
|
try {
|
|
5702
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5716
|
+
ee[1] = N.toASCII(pe(ee[1], _).toLowerCase());
|
|
5703
5717
|
} catch (Se) {
|
|
5704
5718
|
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5705
5719
|
}
|
|
@@ -5707,17 +5721,17 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5707
5721
|
}
|
|
5708
5722
|
return E;
|
|
5709
5723
|
},
|
|
5710
|
-
serialize: function(l,
|
|
5724
|
+
serialize: function(l, _) {
|
|
5711
5725
|
var E = l, b = c(l.to);
|
|
5712
5726
|
if (b) {
|
|
5713
|
-
for (var
|
|
5714
|
-
var J = String(b[
|
|
5727
|
+
for (var q = 0, U = b.length; q < U; ++q) {
|
|
5728
|
+
var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
|
|
5715
5729
|
try {
|
|
5716
|
-
B =
|
|
5730
|
+
B = _.iri ? N.toUnicode(B) : N.toASCII(pe(B, _).toLowerCase());
|
|
5717
5731
|
} catch (X) {
|
|
5718
|
-
E.error = E.error || "Email address's domain name can not be converted to " + (
|
|
5732
|
+
E.error = E.error || "Email address's domain name can not be converted to " + (_.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5719
5733
|
}
|
|
5720
|
-
b[
|
|
5734
|
+
b[q] = se + "@" + B;
|
|
5721
5735
|
}
|
|
5722
5736
|
E.path = b.join(",");
|
|
5723
5737
|
}
|
|
@@ -5725,38 +5739,38 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5725
5739
|
l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
|
|
5726
5740
|
var ie = [];
|
|
5727
5741
|
for (var x in Z)
|
|
5728
|
-
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft,
|
|
5742
|
+
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[x].replace(We, Ot).replace(We, o).replace(fr, L));
|
|
5729
5743
|
return ie.length && (E.query = ie.join("&")), E;
|
|
5730
5744
|
}
|
|
5731
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5745
|
+
}, hr = /^([^\:]+)\:(.*)/, Lt = {
|
|
5732
5746
|
scheme: "urn",
|
|
5733
|
-
parse: function(l,
|
|
5747
|
+
parse: function(l, _) {
|
|
5734
5748
|
var E = l.path && l.path.match(hr), b = l;
|
|
5735
5749
|
if (E) {
|
|
5736
|
-
var
|
|
5737
|
-
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b,
|
|
5750
|
+
var q = _.scheme || b.scheme || "urn", U = E[1].toLowerCase(), J = E[2], Y = q + ":" + (_.nid || U), se = M[Y];
|
|
5751
|
+
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, _));
|
|
5738
5752
|
} else
|
|
5739
5753
|
b.error = b.error || "URN can not be parsed.";
|
|
5740
5754
|
return b;
|
|
5741
5755
|
},
|
|
5742
|
-
serialize: function(l,
|
|
5743
|
-
var E =
|
|
5744
|
-
U && (l = U.serialize(l,
|
|
5756
|
+
serialize: function(l, _) {
|
|
5757
|
+
var E = _.scheme || l.scheme || "urn", b = l.nid, q = E + ":" + (_.nid || b), U = M[q];
|
|
5758
|
+
U && (l = U.serialize(l, _));
|
|
5745
5759
|
var J = l, Y = l.nss;
|
|
5746
|
-
return J.path = (b ||
|
|
5760
|
+
return J.path = (b || _.nid) + ":" + Y, J;
|
|
5747
5761
|
}
|
|
5748
|
-
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,
|
|
5762
|
+
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
|
|
5749
5763
|
scheme: "urn:uuid",
|
|
5750
|
-
parse: function(l,
|
|
5764
|
+
parse: function(l, _) {
|
|
5751
5765
|
var E = l;
|
|
5752
|
-
return E.uuid = E.nss, E.nss = void 0, !
|
|
5766
|
+
return E.uuid = E.nss, E.nss = void 0, !_.tolerant && (!E.uuid || !E.uuid.match(mr)) && (E.error = E.error || "UUID is not valid."), E;
|
|
5753
5767
|
},
|
|
5754
|
-
serialize: function(l,
|
|
5768
|
+
serialize: function(l, _) {
|
|
5755
5769
|
var E = l;
|
|
5756
5770
|
return E.nss = (l.uuid || "").toLowerCase(), E;
|
|
5757
5771
|
}
|
|
5758
5772
|
};
|
|
5759
|
-
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[
|
|
5773
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5760
5774
|
});
|
|
5761
5775
|
})(uri_all, uri_all.exports);
|
|
5762
5776
|
var uri_allExports = uri_all.exports;
|
|
@@ -5784,7 +5798,7 @@ uri$1.default = uri;
|
|
|
5784
5798
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5785
5799
|
return r.CodeGen;
|
|
5786
5800
|
} });
|
|
5787
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util,
|
|
5801
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, g = require$$9, R = uri$1, O = (F, $) => new RegExp(F, $);
|
|
5788
5802
|
O.code = "new RegExp";
|
|
5789
5803
|
const T = ["removeAdditional", "useDefaults", "coerceTypes"], v = /* @__PURE__ */ new Set([
|
|
5790
5804
|
"validate",
|
|
@@ -5800,7 +5814,7 @@ uri$1.default = uri;
|
|
|
5800
5814
|
"func",
|
|
5801
5815
|
"obj",
|
|
5802
5816
|
"Error"
|
|
5803
|
-
]),
|
|
5817
|
+
]), y = {
|
|
5804
5818
|
errorDataPath: "",
|
|
5805
5819
|
format: "`validateFormats: false` can be used instead.",
|
|
5806
5820
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5822,11 +5836,11 @@ uri$1.default = uri;
|
|
|
5822
5836
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5823
5837
|
}, k = 200;
|
|
5824
5838
|
function S(F) {
|
|
5825
|
-
var
|
|
5826
|
-
const Oe = F.strict, ot = (
|
|
5839
|
+
var $, j, P, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, Ve, xe, st, me, le, ze, it;
|
|
5840
|
+
const Oe = F.strict, ot = ($ = F.code) === null || $ === void 0 ? void 0 : $.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (P = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && P !== void 0 ? P : O, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : R.default;
|
|
5827
5841
|
return {
|
|
5828
5842
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5829
|
-
strictNumbers: (
|
|
5843
|
+
strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
|
|
5830
5844
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5831
5845
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5832
5846
|
strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
@@ -5846,44 +5860,44 @@ uri$1.default = uri;
|
|
|
5846
5860
|
};
|
|
5847
5861
|
}
|
|
5848
5862
|
class I {
|
|
5849
|
-
constructor(
|
|
5850
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5863
|
+
constructor($ = {}) {
|
|
5864
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), $ = this.opts = { ...$, ...S($) };
|
|
5851
5865
|
const { es5: j, lines: P } = this.opts.code;
|
|
5852
|
-
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K(
|
|
5853
|
-
const a =
|
|
5854
|
-
|
|
5866
|
+
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K($.logger);
|
|
5867
|
+
const a = $.validateFormats;
|
|
5868
|
+
$.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, y, $, "NOT SUPPORTED"), D.call(this, m, $, "DEPRECATED", "warn"), this._metaOpts = z.call(this), $.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), $.keywords && V.call(this, $.keywords), typeof $.meta == "object" && this.addMetaSchema($.meta), C.call(this), $.validateFormats = a;
|
|
5855
5869
|
}
|
|
5856
5870
|
_addVocabularies() {
|
|
5857
5871
|
this.addKeyword("$async");
|
|
5858
5872
|
}
|
|
5859
5873
|
_addDefaultMetaSchema() {
|
|
5860
|
-
const { $data:
|
|
5861
|
-
let a =
|
|
5862
|
-
P === "id" && (a = { ...
|
|
5874
|
+
const { $data: $, meta: j, schemaId: P } = this.opts;
|
|
5875
|
+
let a = g;
|
|
5876
|
+
P === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && $ && this.addMetaSchema(a, a[P], !1);
|
|
5863
5877
|
}
|
|
5864
5878
|
defaultMeta() {
|
|
5865
|
-
const { meta:
|
|
5866
|
-
return this.opts.defaultMeta = typeof
|
|
5879
|
+
const { meta: $, schemaId: j } = this.opts;
|
|
5880
|
+
return this.opts.defaultMeta = typeof $ == "object" ? $[j] || $ : void 0;
|
|
5867
5881
|
}
|
|
5868
|
-
validate(
|
|
5882
|
+
validate($, j) {
|
|
5869
5883
|
let P;
|
|
5870
|
-
if (typeof
|
|
5871
|
-
if (P = this.getSchema(
|
|
5872
|
-
throw new Error(`no schema with key or ref "${
|
|
5884
|
+
if (typeof $ == "string") {
|
|
5885
|
+
if (P = this.getSchema($), !P)
|
|
5886
|
+
throw new Error(`no schema with key or ref "${$}"`);
|
|
5873
5887
|
} else
|
|
5874
|
-
P = this.compile(
|
|
5888
|
+
P = this.compile($);
|
|
5875
5889
|
const a = P(j);
|
|
5876
5890
|
return "$async" in P || (this.errors = P.errors), a;
|
|
5877
5891
|
}
|
|
5878
|
-
compile(
|
|
5879
|
-
const P = this._addSchema(
|
|
5892
|
+
compile($, j) {
|
|
5893
|
+
const P = this._addSchema($, j);
|
|
5880
5894
|
return P.validate || this._compileSchemaEnv(P);
|
|
5881
5895
|
}
|
|
5882
|
-
compileAsync(
|
|
5896
|
+
compileAsync($, j) {
|
|
5883
5897
|
if (typeof this.opts.loadSchema != "function")
|
|
5884
5898
|
throw new Error("options.loadSchema should be a function");
|
|
5885
5899
|
const { loadSchema: P } = this.opts;
|
|
5886
|
-
return a.call(this,
|
|
5900
|
+
return a.call(this, $, j);
|
|
5887
5901
|
async function a(G, ne) {
|
|
5888
5902
|
await h.call(this, G.$schema);
|
|
5889
5903
|
const he = this._addSchema(G, ne);
|
|
@@ -5898,14 +5912,14 @@ uri$1.default = uri;
|
|
|
5898
5912
|
} catch (ne) {
|
|
5899
5913
|
if (!(ne instanceof s.default))
|
|
5900
5914
|
throw ne;
|
|
5901
|
-
return M.call(this, ne), await
|
|
5915
|
+
return M.call(this, ne), await L.call(this, ne.missingSchema), N.call(this, G);
|
|
5902
5916
|
}
|
|
5903
5917
|
}
|
|
5904
5918
|
function M({ missingSchema: G, missingRef: ne }) {
|
|
5905
5919
|
if (this.refs[G])
|
|
5906
5920
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
5907
5921
|
}
|
|
5908
|
-
async function
|
|
5922
|
+
async function L(G) {
|
|
5909
5923
|
const ne = await W.call(this, G);
|
|
5910
5924
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
5911
5925
|
}
|
|
@@ -5921,35 +5935,35 @@ uri$1.default = uri;
|
|
|
5921
5935
|
}
|
|
5922
5936
|
}
|
|
5923
5937
|
// Adds schema to the instance
|
|
5924
|
-
addSchema(
|
|
5925
|
-
if (Array.isArray(
|
|
5926
|
-
for (const N of
|
|
5938
|
+
addSchema($, j, P, a = this.opts.validateSchema) {
|
|
5939
|
+
if (Array.isArray($)) {
|
|
5940
|
+
for (const N of $)
|
|
5927
5941
|
this.addSchema(N, void 0, P, a);
|
|
5928
5942
|
return this;
|
|
5929
5943
|
}
|
|
5930
5944
|
let h;
|
|
5931
|
-
if (typeof
|
|
5945
|
+
if (typeof $ == "object") {
|
|
5932
5946
|
const { schemaId: N } = this.opts;
|
|
5933
|
-
if (h =
|
|
5947
|
+
if (h = $[N], h !== void 0 && typeof h != "string")
|
|
5934
5948
|
throw new Error(`schema ${N} must be string`);
|
|
5935
5949
|
}
|
|
5936
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
5950
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema($, P, j, a, !0), this;
|
|
5937
5951
|
}
|
|
5938
5952
|
// Add schema that will be used to validate other schemas
|
|
5939
5953
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5940
|
-
addMetaSchema(
|
|
5941
|
-
return this.addSchema(
|
|
5954
|
+
addMetaSchema($, j, P = this.opts.validateSchema) {
|
|
5955
|
+
return this.addSchema($, j, !0, P), this;
|
|
5942
5956
|
}
|
|
5943
5957
|
// Validate schema against its meta-schema
|
|
5944
|
-
validateSchema(
|
|
5945
|
-
if (typeof
|
|
5958
|
+
validateSchema($, j) {
|
|
5959
|
+
if (typeof $ == "boolean")
|
|
5946
5960
|
return !0;
|
|
5947
5961
|
let P;
|
|
5948
|
-
if (P =
|
|
5962
|
+
if (P = $.$schema, P !== void 0 && typeof P != "string")
|
|
5949
5963
|
throw new Error("$schema must be a string");
|
|
5950
5964
|
if (P = P || this.opts.defaultMeta || this.defaultMeta(), !P)
|
|
5951
5965
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5952
|
-
const a = this.validate(P,
|
|
5966
|
+
const a = this.validate(P, $);
|
|
5953
5967
|
if (!a && j) {
|
|
5954
5968
|
const h = "schema is invalid: " + this.errorsText();
|
|
5955
5969
|
if (this.opts.validateSchema === "log")
|
|
@@ -5961,15 +5975,15 @@ uri$1.default = uri;
|
|
|
5961
5975
|
}
|
|
5962
5976
|
// Get compiled schema by `key` or `ref`.
|
|
5963
5977
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5964
|
-
getSchema(
|
|
5978
|
+
getSchema($) {
|
|
5965
5979
|
let j;
|
|
5966
|
-
for (; typeof (j = w.call(this,
|
|
5967
|
-
|
|
5980
|
+
for (; typeof (j = w.call(this, $)) == "string"; )
|
|
5981
|
+
$ = j;
|
|
5968
5982
|
if (j === void 0) {
|
|
5969
5983
|
const { schemaId: P } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: P });
|
|
5970
|
-
if (j = o.resolveSchema.call(this, a,
|
|
5984
|
+
if (j = o.resolveSchema.call(this, a, $), !j)
|
|
5971
5985
|
return;
|
|
5972
|
-
this.refs[
|
|
5986
|
+
this.refs[$] = j;
|
|
5973
5987
|
}
|
|
5974
5988
|
return j.validate || this._compileSchemaEnv(j);
|
|
5975
5989
|
}
|
|
@@ -5977,20 +5991,20 @@ uri$1.default = uri;
|
|
|
5977
5991
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5978
5992
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5979
5993
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5980
|
-
removeSchema(
|
|
5981
|
-
if (
|
|
5982
|
-
return this._removeAllSchemas(this.schemas,
|
|
5983
|
-
switch (typeof
|
|
5994
|
+
removeSchema($) {
|
|
5995
|
+
if ($ instanceof RegExp)
|
|
5996
|
+
return this._removeAllSchemas(this.schemas, $), this._removeAllSchemas(this.refs, $), this;
|
|
5997
|
+
switch (typeof $) {
|
|
5984
5998
|
case "undefined":
|
|
5985
5999
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
5986
6000
|
case "string": {
|
|
5987
|
-
const j = w.call(this,
|
|
5988
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
6001
|
+
const j = w.call(this, $);
|
|
6002
|
+
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[$], delete this.refs[$], this;
|
|
5989
6003
|
}
|
|
5990
6004
|
case "object": {
|
|
5991
|
-
const j =
|
|
6005
|
+
const j = $;
|
|
5992
6006
|
this._cache.delete(j);
|
|
5993
|
-
let P =
|
|
6007
|
+
let P = $[this.opts.schemaId];
|
|
5994
6008
|
return P && (P = (0, d.normalizeId)(P), delete this.schemas[P], delete this.refs[P]), this;
|
|
5995
6009
|
}
|
|
5996
6010
|
default:
|
|
@@ -5998,23 +6012,23 @@ uri$1.default = uri;
|
|
|
5998
6012
|
}
|
|
5999
6013
|
}
|
|
6000
6014
|
// add "vocabulary" - a collection of keywords
|
|
6001
|
-
addVocabulary(
|
|
6002
|
-
for (const j of
|
|
6015
|
+
addVocabulary($) {
|
|
6016
|
+
for (const j of $)
|
|
6003
6017
|
this.addKeyword(j);
|
|
6004
6018
|
return this;
|
|
6005
6019
|
}
|
|
6006
|
-
addKeyword(
|
|
6020
|
+
addKeyword($, j) {
|
|
6007
6021
|
let P;
|
|
6008
|
-
if (typeof
|
|
6009
|
-
P =
|
|
6010
|
-
else if (typeof
|
|
6011
|
-
if (j =
|
|
6022
|
+
if (typeof $ == "string")
|
|
6023
|
+
P = $, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = P);
|
|
6024
|
+
else if (typeof $ == "object" && j === void 0) {
|
|
6025
|
+
if (j = $, P = j.keyword, Array.isArray(P) && !P.length)
|
|
6012
6026
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6013
6027
|
} else
|
|
6014
6028
|
throw new Error("invalid addKeywords parameters");
|
|
6015
6029
|
if (oe.call(this, P, j), !j)
|
|
6016
6030
|
return (0, p.eachItem)(P, (h) => ke.call(this, h)), this;
|
|
6017
|
-
|
|
6031
|
+
Le.call(this, j);
|
|
6018
6032
|
const a = {
|
|
6019
6033
|
...j,
|
|
6020
6034
|
type: (0, u.getJSONTypes)(j.type),
|
|
@@ -6022,93 +6036,93 @@ uri$1.default = uri;
|
|
|
6022
6036
|
};
|
|
6023
6037
|
return (0, p.eachItem)(P, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6024
6038
|
}
|
|
6025
|
-
getKeyword(
|
|
6026
|
-
const j = this.RULES.all[
|
|
6039
|
+
getKeyword($) {
|
|
6040
|
+
const j = this.RULES.all[$];
|
|
6027
6041
|
return typeof j == "object" ? j.definition : !!j;
|
|
6028
6042
|
}
|
|
6029
6043
|
// Remove keyword
|
|
6030
|
-
removeKeyword(
|
|
6044
|
+
removeKeyword($) {
|
|
6031
6045
|
const { RULES: j } = this;
|
|
6032
|
-
delete j.keywords[
|
|
6046
|
+
delete j.keywords[$], delete j.all[$];
|
|
6033
6047
|
for (const P of j.rules) {
|
|
6034
|
-
const a = P.rules.findIndex((h) => h.keyword ===
|
|
6048
|
+
const a = P.rules.findIndex((h) => h.keyword === $);
|
|
6035
6049
|
a >= 0 && P.rules.splice(a, 1);
|
|
6036
6050
|
}
|
|
6037
6051
|
return this;
|
|
6038
6052
|
}
|
|
6039
6053
|
// Add format
|
|
6040
|
-
addFormat(
|
|
6041
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6054
|
+
addFormat($, j) {
|
|
6055
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[$] = j, this;
|
|
6042
6056
|
}
|
|
6043
|
-
errorsText(
|
|
6044
|
-
return
|
|
6057
|
+
errorsText($ = this.errors, { separator: j = ", ", dataVar: P = "data" } = {}) {
|
|
6058
|
+
return !$ || $.length === 0 ? "No errors" : $.map((a) => `${P}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6045
6059
|
}
|
|
6046
|
-
$dataMetaSchema(
|
|
6060
|
+
$dataMetaSchema($, j) {
|
|
6047
6061
|
const P = this.RULES.all;
|
|
6048
|
-
|
|
6062
|
+
$ = JSON.parse(JSON.stringify($));
|
|
6049
6063
|
for (const a of j) {
|
|
6050
6064
|
const h = a.split("/").slice(1);
|
|
6051
|
-
let N =
|
|
6065
|
+
let N = $;
|
|
6052
6066
|
for (const M of h)
|
|
6053
6067
|
N = N[M];
|
|
6054
6068
|
for (const M in P) {
|
|
6055
|
-
const
|
|
6056
|
-
if (typeof
|
|
6069
|
+
const L = P[M];
|
|
6070
|
+
if (typeof L != "object")
|
|
6057
6071
|
continue;
|
|
6058
|
-
const { $data: W } =
|
|
6059
|
-
W && G && (N[M] =
|
|
6072
|
+
const { $data: W } = L.definition, G = N[M];
|
|
6073
|
+
W && G && (N[M] = qe(G));
|
|
6060
6074
|
}
|
|
6061
6075
|
}
|
|
6062
|
-
return
|
|
6076
|
+
return $;
|
|
6063
6077
|
}
|
|
6064
|
-
_removeAllSchemas(
|
|
6065
|
-
for (const P in
|
|
6066
|
-
const a =
|
|
6067
|
-
(!j || j.test(P)) && (typeof a == "string" ? delete
|
|
6078
|
+
_removeAllSchemas($, j) {
|
|
6079
|
+
for (const P in $) {
|
|
6080
|
+
const a = $[P];
|
|
6081
|
+
(!j || j.test(P)) && (typeof a == "string" ? delete $[P] : a && !a.meta && (this._cache.delete(a.schema), delete $[P]));
|
|
6068
6082
|
}
|
|
6069
6083
|
}
|
|
6070
|
-
_addSchema(
|
|
6084
|
+
_addSchema($, j, P, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6071
6085
|
let N;
|
|
6072
6086
|
const { schemaId: M } = this.opts;
|
|
6073
|
-
if (typeof
|
|
6074
|
-
N =
|
|
6087
|
+
if (typeof $ == "object")
|
|
6088
|
+
N = $[M];
|
|
6075
6089
|
else {
|
|
6076
6090
|
if (this.opts.jtd)
|
|
6077
6091
|
throw new Error("schema must be object");
|
|
6078
|
-
if (typeof
|
|
6092
|
+
if (typeof $ != "boolean")
|
|
6079
6093
|
throw new Error("schema must be object or boolean");
|
|
6080
6094
|
}
|
|
6081
|
-
let
|
|
6082
|
-
if (
|
|
6083
|
-
return
|
|
6095
|
+
let L = this._cache.get($);
|
|
6096
|
+
if (L !== void 0)
|
|
6097
|
+
return L;
|
|
6084
6098
|
P = (0, d.normalizeId)(N || P);
|
|
6085
|
-
const W = d.getSchemaRefs.call(this,
|
|
6086
|
-
return
|
|
6099
|
+
const W = d.getSchemaRefs.call(this, $, P);
|
|
6100
|
+
return L = new o.SchemaEnv({ schema: $, schemaId: M, meta: j, baseId: P, localRefs: W }), this._cache.set(L.schema, L), h && !P.startsWith("#") && (P && this._checkUnique(P), this.refs[P] = L), a && this.validateSchema($, !0), L;
|
|
6087
6101
|
}
|
|
6088
|
-
_checkUnique(
|
|
6089
|
-
if (this.schemas[
|
|
6090
|
-
throw new Error(`schema with key or id "${
|
|
6102
|
+
_checkUnique($) {
|
|
6103
|
+
if (this.schemas[$] || this.refs[$])
|
|
6104
|
+
throw new Error(`schema with key or id "${$}" already exists`);
|
|
6091
6105
|
}
|
|
6092
|
-
_compileSchemaEnv(
|
|
6093
|
-
if (
|
|
6106
|
+
_compileSchemaEnv($) {
|
|
6107
|
+
if ($.meta ? this._compileMetaSchema($) : o.compileSchema.call(this, $), !$.validate)
|
|
6094
6108
|
throw new Error("ajv implementation error");
|
|
6095
|
-
return
|
|
6109
|
+
return $.validate;
|
|
6096
6110
|
}
|
|
6097
|
-
_compileMetaSchema(
|
|
6111
|
+
_compileMetaSchema($) {
|
|
6098
6112
|
const j = this.opts;
|
|
6099
6113
|
this.opts = this._metaOpts;
|
|
6100
6114
|
try {
|
|
6101
|
-
o.compileSchema.call(this,
|
|
6115
|
+
o.compileSchema.call(this, $);
|
|
6102
6116
|
} finally {
|
|
6103
6117
|
this.opts = j;
|
|
6104
6118
|
}
|
|
6105
6119
|
}
|
|
6106
6120
|
}
|
|
6107
6121
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6108
|
-
function D(F,
|
|
6122
|
+
function D(F, $, j, P = "error") {
|
|
6109
6123
|
for (const a in F) {
|
|
6110
6124
|
const h = a;
|
|
6111
|
-
h in
|
|
6125
|
+
h in $ && this.logger[P](`${j}: option ${a}. ${F[h]}`);
|
|
6112
6126
|
}
|
|
6113
6127
|
}
|
|
6114
6128
|
function w(F) {
|
|
@@ -6120,13 +6134,13 @@ uri$1.default = uri;
|
|
|
6120
6134
|
if (Array.isArray(F))
|
|
6121
6135
|
this.addSchema(F);
|
|
6122
6136
|
else
|
|
6123
|
-
for (const
|
|
6124
|
-
this.addSchema(F[
|
|
6137
|
+
for (const $ in F)
|
|
6138
|
+
this.addSchema(F[$], $);
|
|
6125
6139
|
}
|
|
6126
6140
|
function A() {
|
|
6127
6141
|
for (const F in this.opts.formats) {
|
|
6128
|
-
const
|
|
6129
|
-
|
|
6142
|
+
const $ = this.opts.formats[F];
|
|
6143
|
+
$ && this.addFormat(F, $);
|
|
6130
6144
|
}
|
|
6131
6145
|
}
|
|
6132
6146
|
function V(F) {
|
|
@@ -6135,15 +6149,15 @@ uri$1.default = uri;
|
|
|
6135
6149
|
return;
|
|
6136
6150
|
}
|
|
6137
6151
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6138
|
-
for (const
|
|
6139
|
-
const j = F[
|
|
6140
|
-
j.keyword || (j.keyword =
|
|
6152
|
+
for (const $ in F) {
|
|
6153
|
+
const j = F[$];
|
|
6154
|
+
j.keyword || (j.keyword = $), this.addKeyword(j);
|
|
6141
6155
|
}
|
|
6142
6156
|
}
|
|
6143
6157
|
function z() {
|
|
6144
6158
|
const F = { ...this.opts };
|
|
6145
|
-
for (const
|
|
6146
|
-
delete F[
|
|
6159
|
+
for (const $ of T)
|
|
6160
|
+
delete F[$];
|
|
6147
6161
|
return F;
|
|
6148
6162
|
}
|
|
6149
6163
|
const re = { log() {
|
|
@@ -6160,47 +6174,47 @@ uri$1.default = uri;
|
|
|
6160
6174
|
throw new Error("logger must implement log, warn and error methods");
|
|
6161
6175
|
}
|
|
6162
6176
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6163
|
-
function oe(F,
|
|
6177
|
+
function oe(F, $) {
|
|
6164
6178
|
const { RULES: j } = this;
|
|
6165
6179
|
if ((0, p.eachItem)(F, (P) => {
|
|
6166
6180
|
if (j.keywords[P])
|
|
6167
6181
|
throw new Error(`Keyword ${P} is already defined`);
|
|
6168
6182
|
if (!ue.test(P))
|
|
6169
6183
|
throw new Error(`Keyword ${P} has invalid name`);
|
|
6170
|
-
}),
|
|
6184
|
+
}), !!$ && $.$data && !("code" in $ || "validate" in $))
|
|
6171
6185
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6172
6186
|
}
|
|
6173
|
-
function ke(F,
|
|
6187
|
+
function ke(F, $, j) {
|
|
6174
6188
|
var P;
|
|
6175
|
-
const a =
|
|
6189
|
+
const a = $ == null ? void 0 : $.post;
|
|
6176
6190
|
if (j && a)
|
|
6177
6191
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6178
6192
|
const { RULES: h } = this;
|
|
6179
|
-
let N = a ? h.post : h.rules.find(({ type:
|
|
6180
|
-
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0,
|
|
6193
|
+
let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
|
|
6194
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !$)
|
|
6181
6195
|
return;
|
|
6182
6196
|
const M = {
|
|
6183
6197
|
keyword: F,
|
|
6184
6198
|
definition: {
|
|
6185
|
-
|
|
6186
|
-
type: (0, u.getJSONTypes)(
|
|
6187
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6199
|
+
...$,
|
|
6200
|
+
type: (0, u.getJSONTypes)($.type),
|
|
6201
|
+
schemaType: (0, u.getJSONTypes)($.schemaType)
|
|
6188
6202
|
}
|
|
6189
6203
|
};
|
|
6190
|
-
|
|
6204
|
+
$.before ? Ce.call(this, N, M, $.before) : N.rules.push(M), h.all[F] = M, (P = $.implements) === null || P === void 0 || P.forEach((L) => this.addKeyword(L));
|
|
6191
6205
|
}
|
|
6192
|
-
function Ce(F,
|
|
6206
|
+
function Ce(F, $, j) {
|
|
6193
6207
|
const P = F.rules.findIndex((a) => a.keyword === j);
|
|
6194
|
-
P >= 0 ? F.rules.splice(P, 0,
|
|
6208
|
+
P >= 0 ? F.rules.splice(P, 0, $) : (F.rules.push($), this.logger.warn(`rule ${j} is not defined`));
|
|
6195
6209
|
}
|
|
6196
|
-
function
|
|
6197
|
-
let { metaSchema:
|
|
6198
|
-
|
|
6210
|
+
function Le(F) {
|
|
6211
|
+
let { metaSchema: $ } = F;
|
|
6212
|
+
$ !== void 0 && (F.$data && this.opts.$data && ($ = qe($)), F.validateSchema = this.compile($, !0));
|
|
6199
6213
|
}
|
|
6200
6214
|
const et = {
|
|
6201
6215
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6202
6216
|
};
|
|
6203
|
-
function
|
|
6217
|
+
function qe(F) {
|
|
6204
6218
|
return { anyOf: [F, et] };
|
|
6205
6219
|
}
|
|
6206
6220
|
})(core$2);
|
|
@@ -6222,14 +6236,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6222
6236
|
code(e) {
|
|
6223
6237
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: c, self: d } = n, { root: u } = i;
|
|
6224
6238
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6225
|
-
return
|
|
6239
|
+
return g();
|
|
6226
6240
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6227
6241
|
if (p === void 0)
|
|
6228
6242
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6229
6243
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6230
6244
|
return R(p);
|
|
6231
6245
|
return O(p);
|
|
6232
|
-
function
|
|
6246
|
+
function g() {
|
|
6233
6247
|
if (i === u)
|
|
6234
6248
|
return callRef(e, o, i, i.$async);
|
|
6235
6249
|
const T = t.scopeValue("root", { ref: u });
|
|
@@ -6240,14 +6254,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6240
6254
|
callRef(e, v, T, T.$async);
|
|
6241
6255
|
}
|
|
6242
6256
|
function O(T) {
|
|
6243
|
-
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }),
|
|
6257
|
+
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }), y = t.name("valid"), m = e.subschema({
|
|
6244
6258
|
schema: T,
|
|
6245
6259
|
dataTypes: [],
|
|
6246
6260
|
schemaPath: codegen_1$l.nil,
|
|
6247
6261
|
topSchemaRef: v,
|
|
6248
6262
|
errSchemaPath: r
|
|
6249
|
-
},
|
|
6250
|
-
e.mergeEvaluated(m), e.ok(
|
|
6263
|
+
}, y);
|
|
6264
|
+
e.mergeEvaluated(m), e.ok(y);
|
|
6251
6265
|
}
|
|
6252
6266
|
}
|
|
6253
6267
|
};
|
|
@@ -6258,7 +6272,7 @@ function getValidate(e, t) {
|
|
|
6258
6272
|
ref.getValidate = getValidate;
|
|
6259
6273
|
function callRef(e, t, r, n) {
|
|
6260
6274
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: c, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6261
|
-
n ? p() :
|
|
6275
|
+
n ? p() : g();
|
|
6262
6276
|
function p() {
|
|
6263
6277
|
if (!c.$async)
|
|
6264
6278
|
throw new Error("async schema referenced by sync schema");
|
|
@@ -6269,7 +6283,7 @@ function callRef(e, t, r, n) {
|
|
|
6269
6283
|
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), R(v), o || s.assign(T, !1);
|
|
6270
6284
|
}), e.ok(T);
|
|
6271
6285
|
}
|
|
6272
|
-
function
|
|
6286
|
+
function g() {
|
|
6273
6287
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => O(t), () => R(t));
|
|
6274
6288
|
}
|
|
6275
6289
|
function R(T) {
|
|
@@ -6280,17 +6294,17 @@ function callRef(e, t, r, n) {
|
|
|
6280
6294
|
var v;
|
|
6281
6295
|
if (!i.opts.unevaluated)
|
|
6282
6296
|
return;
|
|
6283
|
-
const
|
|
6297
|
+
const y = (v = r == null ? void 0 : r.validate) === null || v === void 0 ? void 0 : v.evaluated;
|
|
6284
6298
|
if (i.props !== !0)
|
|
6285
|
-
if (
|
|
6286
|
-
|
|
6299
|
+
if (y && !y.dynamicProps)
|
|
6300
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6287
6301
|
else {
|
|
6288
6302
|
const m = s.var("props", (0, codegen_1$l._)`${T}.evaluated.props`);
|
|
6289
6303
|
i.props = util_1$j.mergeEvaluated.props(s, m, i.props, codegen_1$l.Name);
|
|
6290
6304
|
}
|
|
6291
6305
|
if (i.items !== !0)
|
|
6292
|
-
if (
|
|
6293
|
-
|
|
6306
|
+
if (y && !y.dynamicItems)
|
|
6307
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6294
6308
|
else {
|
|
6295
6309
|
const m = s.var("items", (0, codegen_1$l._)`${T}.evaluated.items`);
|
|
6296
6310
|
i.items = util_1$j.mergeEvaluated.items(s, m, i.items, codegen_1$l.Name);
|
|
@@ -6437,13 +6451,13 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6437
6451
|
const O = e.parentSchema.properties, { definedProperties: T } = e.it;
|
|
6438
6452
|
for (const v of r)
|
|
6439
6453
|
if ((O == null ? void 0 : O[v]) === void 0 && !T.has(v)) {
|
|
6440
|
-
const
|
|
6454
|
+
const y = o.schemaEnv.baseId + o.errSchemaPath, m = `required property "${v}" is not defined at "${y}" (strictRequired)`;
|
|
6441
6455
|
(0, util_1$h.checkStrictMode)(o, m, o.opts.strictRequired);
|
|
6442
6456
|
}
|
|
6443
6457
|
}
|
|
6444
6458
|
function u() {
|
|
6445
6459
|
if (d || i)
|
|
6446
|
-
e.block$data(codegen_1$f.nil,
|
|
6460
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6447
6461
|
else
|
|
6448
6462
|
for (const O of r)
|
|
6449
6463
|
(0, code_1$6.checkReportMissingProp)(e, O);
|
|
@@ -6456,7 +6470,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6456
6470
|
} else
|
|
6457
6471
|
t.if((0, code_1$6.checkMissingProp)(e, r, O)), (0, code_1$6.reportMissingProp)(e, O), t.else();
|
|
6458
6472
|
}
|
|
6459
|
-
function
|
|
6473
|
+
function g() {
|
|
6460
6474
|
t.forOf("prop", n, (O) => {
|
|
6461
6475
|
e.setParams({ missingProperty: O }), t.if((0, code_1$6.noPropertyInData)(t, s, O, c.ownProperties), () => e.error());
|
|
6462
6476
|
});
|
|
@@ -6514,22 +6528,22 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6514
6528
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6515
6529
|
function p() {
|
|
6516
6530
|
const T = t.let("i", (0, codegen_1$d._)`${r}.length`), v = t.let("j");
|
|
6517
|
-
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (
|
|
6531
|
+
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (g() ? R : O)(T, v));
|
|
6518
6532
|
}
|
|
6519
|
-
function
|
|
6533
|
+
function g() {
|
|
6520
6534
|
return u.length > 0 && !u.some((T) => T === "object" || T === "array");
|
|
6521
6535
|
}
|
|
6522
6536
|
function R(T, v) {
|
|
6523
|
-
const
|
|
6537
|
+
const y = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, y, c.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6524
6538
|
t.for((0, codegen_1$d._)`;${T}--;`, () => {
|
|
6525
|
-
t.let(
|
|
6526
|
-
t.assign(v, (0, codegen_1$d._)`${k}[${
|
|
6527
|
-
}).code((0, codegen_1$d._)`${k}[${
|
|
6539
|
+
t.let(y, (0, codegen_1$d._)`${r}[${T}]`), t.if(m, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${y}] == "number"`, () => {
|
|
6540
|
+
t.assign(v, (0, codegen_1$d._)`${k}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6541
|
+
}).code((0, codegen_1$d._)`${k}[${y}] = ${T}`);
|
|
6528
6542
|
});
|
|
6529
6543
|
}
|
|
6530
6544
|
function O(T, v) {
|
|
6531
|
-
const
|
|
6532
|
-
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${
|
|
6545
|
+
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), m = t.name("outer");
|
|
6546
|
+
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${T}], ${r}[${v}])`, () => {
|
|
6533
6547
|
e.error(), t.assign(d, !1).break(m);
|
|
6534
6548
|
})));
|
|
6535
6549
|
}
|
|
@@ -6570,7 +6584,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6570
6584
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6571
6585
|
let p;
|
|
6572
6586
|
if (c || n)
|
|
6573
|
-
p = t.let("valid"), e.block$data(p,
|
|
6587
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6574
6588
|
else {
|
|
6575
6589
|
if (!Array.isArray(s))
|
|
6576
6590
|
throw new Error("ajv implementation error");
|
|
@@ -6578,7 +6592,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6578
6592
|
p = (0, codegen_1$b.or)(...s.map((T, v) => R(O, v)));
|
|
6579
6593
|
}
|
|
6580
6594
|
e.pass(p);
|
|
6581
|
-
function
|
|
6595
|
+
function g() {
|
|
6582
6596
|
t.assign(p, !1), t.forOf("v", i, (O) => t.if((0, codegen_1$b._)`${u()}(${r}, ${O})`, () => t.assign(p, !0).break()));
|
|
6583
6597
|
}
|
|
6584
6598
|
function R(O, T) {
|
|
@@ -6667,18 +6681,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6667
6681
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: c } = e;
|
|
6668
6682
|
p(s), c.opts.unevaluated && r.length && c.items !== !0 && (c.items = util_1$c.mergeEvaluated.items(n, r.length, c.items));
|
|
6669
6683
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6670
|
-
r.forEach((
|
|
6671
|
-
(0, util_1$c.alwaysValidSchema)(c,
|
|
6684
|
+
r.forEach((g, R) => {
|
|
6685
|
+
(0, util_1$c.alwaysValidSchema)(c, g) || (n.if((0, codegen_1$9._)`${u} > ${R}`, () => e.subschema({
|
|
6672
6686
|
keyword: o,
|
|
6673
6687
|
schemaProp: R,
|
|
6674
6688
|
dataProp: R
|
|
6675
6689
|
}, d)), e.ok(d));
|
|
6676
6690
|
});
|
|
6677
|
-
function p(
|
|
6678
|
-
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T ===
|
|
6691
|
+
function p(g) {
|
|
6692
|
+
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T === g.minItems && (T === g.maxItems || g[t] === !1);
|
|
6679
6693
|
if (R.strictTuples && !v) {
|
|
6680
|
-
const
|
|
6681
|
-
(0, util_1$c.checkStrictMode)(c,
|
|
6694
|
+
const y = `"${o}" is ${T}-tuple, but minItems or maxItems/${t} are not specified or different at path "${O}"`;
|
|
6695
|
+
(0, util_1$c.checkStrictMode)(c, y, R.strictTuples);
|
|
6682
6696
|
}
|
|
6683
6697
|
}
|
|
6684
6698
|
}
|
|
@@ -6742,24 +6756,24 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6742
6756
|
return;
|
|
6743
6757
|
}
|
|
6744
6758
|
i.items = !0;
|
|
6745
|
-
const
|
|
6746
|
-
c === void 0 && o === 1 ? O(
|
|
6759
|
+
const g = t.name("valid");
|
|
6760
|
+
c === void 0 && o === 1 ? O(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), c !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, R)) : (t.let(g, !1), R()), e.result(g, () => e.reset());
|
|
6747
6761
|
function R() {
|
|
6748
|
-
const v = t.name("_valid"),
|
|
6749
|
-
O(v, () => t.if(v, () => T(
|
|
6762
|
+
const v = t.name("_valid"), y = t.let("count", 0);
|
|
6763
|
+
O(v, () => t.if(v, () => T(y)));
|
|
6750
6764
|
}
|
|
6751
|
-
function O(v,
|
|
6765
|
+
function O(v, y) {
|
|
6752
6766
|
t.forRange("i", 0, p, (m) => {
|
|
6753
6767
|
e.subschema({
|
|
6754
6768
|
keyword: "contains",
|
|
6755
6769
|
dataProp: m,
|
|
6756
6770
|
dataPropType: util_1$a.Type.Num,
|
|
6757
6771
|
compositeRule: !0
|
|
6758
|
-
}, v),
|
|
6772
|
+
}, v), y();
|
|
6759
6773
|
});
|
|
6760
6774
|
}
|
|
6761
6775
|
function T(v) {
|
|
6762
|
-
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(
|
|
6776
|
+
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0).break()) : (t.if((0, codegen_1$7._)`${v} > ${c}`, () => t.assign(g, !1).break()), o === 1 ? t.assign(g, !0) : t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0)));
|
|
6763
6777
|
}
|
|
6764
6778
|
}
|
|
6765
6779
|
};
|
|
@@ -6770,11 +6784,11 @@ var dependencies = {};
|
|
|
6770
6784
|
const t = codegen, r = util, n = code;
|
|
6771
6785
|
e.error = {
|
|
6772
6786
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6773
|
-
const
|
|
6774
|
-
return (0, t.str)`must have ${
|
|
6787
|
+
const g = u === 1 ? "property" : "properties";
|
|
6788
|
+
return (0, t.str)`must have ${g} ${p} when property ${d} is present`;
|
|
6775
6789
|
},
|
|
6776
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6777
|
-
missingProperty: ${
|
|
6790
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6791
|
+
missingProperty: ${g},
|
|
6778
6792
|
depsCount: ${u},
|
|
6779
6793
|
deps: ${p}}`
|
|
6780
6794
|
// TODO change to reference
|
|
@@ -6791,16 +6805,16 @@ var dependencies = {};
|
|
|
6791
6805
|
};
|
|
6792
6806
|
function i({ schema: d }) {
|
|
6793
6807
|
const u = {}, p = {};
|
|
6794
|
-
for (const
|
|
6795
|
-
if (
|
|
6808
|
+
for (const g in d) {
|
|
6809
|
+
if (g === "__proto__")
|
|
6796
6810
|
continue;
|
|
6797
|
-
const R = Array.isArray(d[
|
|
6798
|
-
R[
|
|
6811
|
+
const R = Array.isArray(d[g]) ? u : p;
|
|
6812
|
+
R[g] = d[g];
|
|
6799
6813
|
}
|
|
6800
6814
|
return [u, p];
|
|
6801
6815
|
}
|
|
6802
6816
|
function o(d, u = d.schema) {
|
|
6803
|
-
const { gen: p, data:
|
|
6817
|
+
const { gen: p, data: g, it: R } = d;
|
|
6804
6818
|
if (Object.keys(u).length === 0)
|
|
6805
6819
|
return;
|
|
6806
6820
|
const O = p.let("missing");
|
|
@@ -6808,26 +6822,26 @@ var dependencies = {};
|
|
|
6808
6822
|
const v = u[T];
|
|
6809
6823
|
if (v.length === 0)
|
|
6810
6824
|
continue;
|
|
6811
|
-
const
|
|
6825
|
+
const y = (0, n.propertyInData)(p, g, T, R.opts.ownProperties);
|
|
6812
6826
|
d.setParams({
|
|
6813
6827
|
property: T,
|
|
6814
6828
|
depsCount: v.length,
|
|
6815
6829
|
deps: v.join(", ")
|
|
6816
|
-
}), R.allErrors ? p.if(
|
|
6830
|
+
}), R.allErrors ? p.if(y, () => {
|
|
6817
6831
|
for (const m of v)
|
|
6818
6832
|
(0, n.checkReportMissingProp)(d, m);
|
|
6819
|
-
}) : (p.if((0, t._)`${
|
|
6833
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, v, O)})`), (0, n.reportMissingProp)(d, O), p.else());
|
|
6820
6834
|
}
|
|
6821
6835
|
}
|
|
6822
6836
|
e.validatePropertyDeps = o;
|
|
6823
6837
|
function c(d, u = d.schema) {
|
|
6824
|
-
const { gen: p, data:
|
|
6838
|
+
const { gen: p, data: g, keyword: R, it: O } = d, T = p.name("valid");
|
|
6825
6839
|
for (const v in u)
|
|
6826
6840
|
(0, r.alwaysValidSchema)(O, u[v]) || (p.if(
|
|
6827
|
-
(0, n.propertyInData)(p,
|
|
6841
|
+
(0, n.propertyInData)(p, g, v, O.opts.ownProperties),
|
|
6828
6842
|
() => {
|
|
6829
|
-
const
|
|
6830
|
-
d.mergeValidEvaluated(
|
|
6843
|
+
const y = d.subschema({ keyword: R, schemaProp: v }, T);
|
|
6844
|
+
d.mergeValidEvaluated(y, T);
|
|
6831
6845
|
},
|
|
6832
6846
|
() => p.var(T, !0)
|
|
6833
6847
|
// TODO var
|
|
@@ -6884,44 +6898,44 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6884
6898
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6885
6899
|
return;
|
|
6886
6900
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6887
|
-
|
|
6888
|
-
function
|
|
6889
|
-
t.forIn("key", s, (
|
|
6890
|
-
!u.length && !p.length ? T(
|
|
6901
|
+
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6902
|
+
function g() {
|
|
6903
|
+
t.forIn("key", s, (y) => {
|
|
6904
|
+
!u.length && !p.length ? T(y) : t.if(R(y), () => T(y));
|
|
6891
6905
|
});
|
|
6892
6906
|
}
|
|
6893
|
-
function R(
|
|
6907
|
+
function R(y) {
|
|
6894
6908
|
let m;
|
|
6895
6909
|
if (u.length > 8) {
|
|
6896
6910
|
const k = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6897
|
-
m = (0, code_1$3.isOwnProperty)(t, k,
|
|
6911
|
+
m = (0, code_1$3.isOwnProperty)(t, k, y);
|
|
6898
6912
|
} else
|
|
6899
|
-
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${
|
|
6900
|
-
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${
|
|
6913
|
+
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${y} === ${k}`)) : m = codegen_1$5.nil;
|
|
6914
|
+
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${y})`))), (0, codegen_1$5.not)(m);
|
|
6901
6915
|
}
|
|
6902
|
-
function O(
|
|
6903
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6916
|
+
function O(y) {
|
|
6917
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6904
6918
|
}
|
|
6905
|
-
function T(
|
|
6919
|
+
function T(y) {
|
|
6906
6920
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6907
|
-
O(
|
|
6921
|
+
O(y);
|
|
6908
6922
|
return;
|
|
6909
6923
|
}
|
|
6910
6924
|
if (r === !1) {
|
|
6911
|
-
e.setParams({ additionalProperty:
|
|
6925
|
+
e.setParams({ additionalProperty: y }), e.error(), c || t.break();
|
|
6912
6926
|
return;
|
|
6913
6927
|
}
|
|
6914
6928
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6915
6929
|
const m = t.name("valid");
|
|
6916
|
-
d.removeAdditional === "failing" ? (v(
|
|
6917
|
-
e.reset(), O(
|
|
6918
|
-
})) : (v(
|
|
6930
|
+
d.removeAdditional === "failing" ? (v(y, m, !1), t.if((0, codegen_1$5.not)(m), () => {
|
|
6931
|
+
e.reset(), O(y);
|
|
6932
|
+
})) : (v(y, m), c || t.if((0, codegen_1$5.not)(m), () => t.break()));
|
|
6919
6933
|
}
|
|
6920
6934
|
}
|
|
6921
|
-
function v(
|
|
6935
|
+
function v(y, m, k) {
|
|
6922
6936
|
const S = {
|
|
6923
6937
|
keyword: "additionalProperties",
|
|
6924
|
-
dataProp:
|
|
6938
|
+
dataProp: y,
|
|
6925
6939
|
dataPropType: util_1$8.Type.Str
|
|
6926
6940
|
};
|
|
6927
6941
|
k === !1 && Object.assign(S, {
|
|
@@ -6943,23 +6957,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6943
6957
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6944
6958
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6945
6959
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6946
|
-
for (const
|
|
6947
|
-
i.definedProperties.add(
|
|
6960
|
+
for (const g of o)
|
|
6961
|
+
i.definedProperties.add(g);
|
|
6948
6962
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6949
|
-
const c = o.filter((
|
|
6963
|
+
const c = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6950
6964
|
if (c.length === 0)
|
|
6951
6965
|
return;
|
|
6952
6966
|
const d = t.name("valid");
|
|
6953
|
-
for (const
|
|
6954
|
-
u(
|
|
6955
|
-
function u(
|
|
6956
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6967
|
+
for (const g of c)
|
|
6968
|
+
u(g) ? p(g) : (t.if((0, code_1$2.propertyInData)(t, s, g, i.opts.ownProperties)), p(g), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(g), e.ok(d);
|
|
6969
|
+
function u(g) {
|
|
6970
|
+
return i.opts.useDefaults && !i.compositeRule && r[g].default !== void 0;
|
|
6957
6971
|
}
|
|
6958
|
-
function p(
|
|
6972
|
+
function p(g) {
|
|
6959
6973
|
e.subschema({
|
|
6960
6974
|
keyword: "properties",
|
|
6961
|
-
schemaProp:
|
|
6962
|
-
dataProp:
|
|
6975
|
+
schemaProp: g,
|
|
6976
|
+
dataProp: g
|
|
6963
6977
|
}, d);
|
|
6964
6978
|
}
|
|
6965
6979
|
}
|
|
@@ -6977,26 +6991,26 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6977
6991
|
return;
|
|
6978
6992
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6979
6993
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6980
|
-
const { props:
|
|
6994
|
+
const { props: g } = i;
|
|
6981
6995
|
R();
|
|
6982
6996
|
function R() {
|
|
6983
6997
|
for (const v of c)
|
|
6984
6998
|
u && O(v), i.allErrors ? T(v) : (t.var(p, !0), T(v), t.if(p));
|
|
6985
6999
|
}
|
|
6986
7000
|
function O(v) {
|
|
6987
|
-
for (const
|
|
6988
|
-
new RegExp(v).test(
|
|
7001
|
+
for (const y in u)
|
|
7002
|
+
new RegExp(v).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${v} (use allowMatchingProperties)`);
|
|
6989
7003
|
}
|
|
6990
7004
|
function T(v) {
|
|
6991
|
-
t.forIn("key", n, (
|
|
6992
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${
|
|
7005
|
+
t.forIn("key", n, (y) => {
|
|
7006
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${y})`, () => {
|
|
6993
7007
|
const m = d.includes(v);
|
|
6994
7008
|
m || e.subschema({
|
|
6995
7009
|
keyword: "patternProperties",
|
|
6996
7010
|
schemaProp: v,
|
|
6997
|
-
dataProp:
|
|
7011
|
+
dataProp: y,
|
|
6998
7012
|
dataPropType: util_2.Type.Str
|
|
6999
|
-
}, p), i.opts.unevaluated &&
|
|
7013
|
+
}, p), i.opts.unevaluated && g !== !0 ? t.assign((0, codegen_1$4._)`${g}[${y}]`, !0) : !m && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7000
7014
|
});
|
|
7001
7015
|
});
|
|
7002
7016
|
}
|
|
@@ -7055,14 +7069,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7055
7069
|
const i = r, o = t.let("valid", !1), c = t.let("passing", null), d = t.name("_valid");
|
|
7056
7070
|
e.setParams({ passing: c }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7057
7071
|
function u() {
|
|
7058
|
-
i.forEach((p,
|
|
7072
|
+
i.forEach((p, g) => {
|
|
7059
7073
|
let R;
|
|
7060
7074
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : R = e.subschema({
|
|
7061
7075
|
keyword: "oneOf",
|
|
7062
|
-
schemaProp:
|
|
7076
|
+
schemaProp: g,
|
|
7063
7077
|
compositeRule: !0
|
|
7064
|
-
}, d),
|
|
7065
|
-
t.assign(o, !0), t.assign(c,
|
|
7078
|
+
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(c, (0, codegen_1$3._)`[${c}, ${g}]`).else(), t.if(d, () => {
|
|
7079
|
+
t.assign(o, !0), t.assign(c, g), R && e.mergeEvaluated(R, codegen_1$3.Name);
|
|
7066
7080
|
});
|
|
7067
7081
|
});
|
|
7068
7082
|
}
|
|
@@ -7120,10 +7134,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7120
7134
|
}, c);
|
|
7121
7135
|
e.mergeEvaluated(p);
|
|
7122
7136
|
}
|
|
7123
|
-
function u(p,
|
|
7137
|
+
function u(p, g) {
|
|
7124
7138
|
return () => {
|
|
7125
7139
|
const R = e.subschema({ keyword: p }, c);
|
|
7126
|
-
t.assign(o, c), e.mergeValidEvaluated(R, o),
|
|
7140
|
+
t.assign(o, c), e.mergeValidEvaluated(R, o), g ? t.assign(g, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7127
7141
|
};
|
|
7128
7142
|
}
|
|
7129
7143
|
}
|
|
@@ -7176,37 +7190,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7176
7190
|
$data: !0,
|
|
7177
7191
|
error: error$1,
|
|
7178
7192
|
code(e, t) {
|
|
7179
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7193
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: g } = c;
|
|
7180
7194
|
if (!d.validateFormats)
|
|
7181
7195
|
return;
|
|
7182
7196
|
s ? R() : O();
|
|
7183
7197
|
function R() {
|
|
7184
7198
|
const T = r.scopeValue("formats", {
|
|
7185
|
-
ref:
|
|
7199
|
+
ref: g.formats,
|
|
7186
7200
|
code: d.code.formats
|
|
7187
|
-
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`),
|
|
7188
|
-
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(
|
|
7201
|
+
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`), y = r.let("fType"), m = r.let("format");
|
|
7202
|
+
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(k(), S()));
|
|
7189
7203
|
function k() {
|
|
7190
7204
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${m}`;
|
|
7191
7205
|
}
|
|
7192
7206
|
function S() {
|
|
7193
7207
|
const I = p.$async ? (0, codegen_1$1._)`(${v}.async ? await ${m}(${n}) : ${m}(${n}))` : (0, codegen_1$1._)`${m}(${n})`, D = (0, codegen_1$1._)`(typeof ${m} == "function" ? ${I} : ${m}.test(${n}))`;
|
|
7194
|
-
return (0, codegen_1$1._)`${m} && ${m} !== true && ${
|
|
7208
|
+
return (0, codegen_1$1._)`${m} && ${m} !== true && ${y} === ${t} && !${D}`;
|
|
7195
7209
|
}
|
|
7196
7210
|
}
|
|
7197
7211
|
function O() {
|
|
7198
|
-
const T =
|
|
7212
|
+
const T = g.formats[i];
|
|
7199
7213
|
if (!T) {
|
|
7200
7214
|
k();
|
|
7201
7215
|
return;
|
|
7202
7216
|
}
|
|
7203
7217
|
if (T === !0)
|
|
7204
7218
|
return;
|
|
7205
|
-
const [v,
|
|
7219
|
+
const [v, y, m] = S(T);
|
|
7206
7220
|
v === t && e.pass(I());
|
|
7207
7221
|
function k() {
|
|
7208
7222
|
if (d.strictSchema === !1) {
|
|
7209
|
-
|
|
7223
|
+
g.logger.warn(D());
|
|
7210
7224
|
return;
|
|
7211
7225
|
}
|
|
7212
7226
|
throw new Error(D());
|
|
@@ -7224,7 +7238,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7224
7238
|
throw new Error("async format in sync schema");
|
|
7225
7239
|
return (0, codegen_1$1._)`await ${m}(${n})`;
|
|
7226
7240
|
}
|
|
7227
|
-
return typeof
|
|
7241
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${m}(${n})` : (0, codegen_1$1._)`${m}.test(${n})`;
|
|
7228
7242
|
}
|
|
7229
7243
|
}
|
|
7230
7244
|
}
|
|
@@ -7292,26 +7306,26 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7292
7306
|
const O = R();
|
|
7293
7307
|
t.if(!1);
|
|
7294
7308
|
for (const T in O)
|
|
7295
|
-
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d,
|
|
7309
|
+
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d, g(O[T]));
|
|
7296
7310
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: c }), t.endIf();
|
|
7297
7311
|
}
|
|
7298
|
-
function
|
|
7312
|
+
function g(O) {
|
|
7299
7313
|
const T = t.name("valid"), v = e.subschema({ keyword: "oneOf", schemaProp: O }, T);
|
|
7300
7314
|
return e.mergeEvaluated(v, codegen_1.Name), T;
|
|
7301
7315
|
}
|
|
7302
7316
|
function R() {
|
|
7303
7317
|
var O;
|
|
7304
7318
|
const T = {}, v = m(s);
|
|
7305
|
-
let
|
|
7319
|
+
let y = !0;
|
|
7306
7320
|
for (let I = 0; I < o.length; I++) {
|
|
7307
7321
|
let D = o[I];
|
|
7308
7322
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7309
7323
|
const w = (O = D == null ? void 0 : D.properties) === null || O === void 0 ? void 0 : O[c];
|
|
7310
7324
|
if (typeof w != "object")
|
|
7311
7325
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7312
|
-
|
|
7326
|
+
y = y && (v || m(D)), k(w, I);
|
|
7313
7327
|
}
|
|
7314
|
-
if (
|
|
7328
|
+
if (!y)
|
|
7315
7329
|
throw new Error(`discriminator: "${c}" must be required`);
|
|
7316
7330
|
return T;
|
|
7317
7331
|
function m({ required: I }) {
|
|
@@ -7612,9 +7626,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7612
7626
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7613
7627
|
return p.CodeGen;
|
|
7614
7628
|
} });
|
|
7615
|
-
var
|
|
7629
|
+
var g = validation_error;
|
|
7616
7630
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7617
|
-
return
|
|
7631
|
+
return g.default;
|
|
7618
7632
|
} });
|
|
7619
7633
|
var R = ref_error;
|
|
7620
7634
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -7632,7 +7646,38 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7632
7646
|
},
|
|
7633
7647
|
description: {
|
|
7634
7648
|
type: "string",
|
|
7635
|
-
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."
|
|
7649
|
+
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",
|
|
7650
|
+
deprecated: "Use meta.description instead."
|
|
7651
|
+
},
|
|
7652
|
+
meta: {
|
|
7653
|
+
type: "object",
|
|
7654
|
+
properties: {
|
|
7655
|
+
title: {
|
|
7656
|
+
type: "string",
|
|
7657
|
+
description: "A clear and concise name for your Blueprint."
|
|
7658
|
+
},
|
|
7659
|
+
description: {
|
|
7660
|
+
type: "string",
|
|
7661
|
+
description: "A brief explanation of what your Blueprint offers."
|
|
7662
|
+
},
|
|
7663
|
+
author: {
|
|
7664
|
+
type: "string",
|
|
7665
|
+
description: "A GitHub username of the author of this Blueprint."
|
|
7666
|
+
},
|
|
7667
|
+
categories: {
|
|
7668
|
+
type: "array",
|
|
7669
|
+
items: {
|
|
7670
|
+
type: "string"
|
|
7671
|
+
},
|
|
7672
|
+
description: "Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."
|
|
7673
|
+
}
|
|
7674
|
+
},
|
|
7675
|
+
required: [
|
|
7676
|
+
"title",
|
|
7677
|
+
"author"
|
|
7678
|
+
],
|
|
7679
|
+
additionalProperties: !1,
|
|
7680
|
+
description: "Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"
|
|
7636
7681
|
},
|
|
7637
7682
|
preferredVersions: {
|
|
7638
7683
|
type: "object",
|
|
@@ -8909,46 +8954,129 @@ for existing apps using this option.`
|
|
|
8909
8954
|
$ref: "#/definitions/PHPRequestHeaders",
|
|
8910
8955
|
description: "Request headers."
|
|
8911
8956
|
},
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8957
|
+
body: {
|
|
8958
|
+
anyOf: [
|
|
8959
|
+
{
|
|
8960
|
+
type: "string"
|
|
8961
|
+
},
|
|
8962
|
+
{
|
|
8963
|
+
type: "object",
|
|
8964
|
+
properties: {
|
|
8965
|
+
BYTES_PER_ELEMENT: {
|
|
8966
|
+
type: "number"
|
|
8967
|
+
},
|
|
8968
|
+
buffer: {
|
|
8969
|
+
type: "object",
|
|
8970
|
+
properties: {
|
|
8971
|
+
byteLength: {
|
|
8972
|
+
type: "number"
|
|
8973
|
+
}
|
|
8974
|
+
},
|
|
8975
|
+
required: [
|
|
8976
|
+
"byteLength"
|
|
8977
|
+
],
|
|
8978
|
+
additionalProperties: !1
|
|
8979
|
+
},
|
|
8980
|
+
byteLength: {
|
|
8981
|
+
type: "number"
|
|
8982
|
+
},
|
|
8983
|
+
byteOffset: {
|
|
8984
|
+
type: "number"
|
|
8985
|
+
},
|
|
8986
|
+
length: {
|
|
8987
|
+
type: "number"
|
|
8988
|
+
}
|
|
8922
8989
|
},
|
|
8923
|
-
|
|
8990
|
+
required: [
|
|
8991
|
+
"BYTES_PER_ELEMENT",
|
|
8992
|
+
"buffer",
|
|
8993
|
+
"byteLength",
|
|
8994
|
+
"byteOffset",
|
|
8995
|
+
"length"
|
|
8996
|
+
],
|
|
8997
|
+
additionalProperties: {
|
|
8924
8998
|
type: "number"
|
|
8925
|
-
},
|
|
8926
|
-
name: {
|
|
8927
|
-
type: "string"
|
|
8928
|
-
},
|
|
8929
|
-
webkitRelativePath: {
|
|
8930
|
-
type: "string"
|
|
8931
8999
|
}
|
|
8932
9000
|
},
|
|
8933
|
-
|
|
8934
|
-
"
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
9001
|
+
{
|
|
9002
|
+
type: "object",
|
|
9003
|
+
additionalProperties: {
|
|
9004
|
+
anyOf: [
|
|
9005
|
+
{
|
|
9006
|
+
type: "string"
|
|
9007
|
+
},
|
|
9008
|
+
{
|
|
9009
|
+
type: "object",
|
|
9010
|
+
properties: {
|
|
9011
|
+
BYTES_PER_ELEMENT: {
|
|
9012
|
+
type: "number"
|
|
9013
|
+
},
|
|
9014
|
+
buffer: {
|
|
9015
|
+
type: "object",
|
|
9016
|
+
properties: {
|
|
9017
|
+
byteLength: {
|
|
9018
|
+
type: "number"
|
|
9019
|
+
}
|
|
9020
|
+
},
|
|
9021
|
+
required: [
|
|
9022
|
+
"byteLength"
|
|
9023
|
+
],
|
|
9024
|
+
additionalProperties: !1
|
|
9025
|
+
},
|
|
9026
|
+
byteLength: {
|
|
9027
|
+
type: "number"
|
|
9028
|
+
},
|
|
9029
|
+
byteOffset: {
|
|
9030
|
+
type: "number"
|
|
9031
|
+
},
|
|
9032
|
+
length: {
|
|
9033
|
+
type: "number"
|
|
9034
|
+
}
|
|
9035
|
+
},
|
|
9036
|
+
required: [
|
|
9037
|
+
"BYTES_PER_ELEMENT",
|
|
9038
|
+
"buffer",
|
|
9039
|
+
"byteLength",
|
|
9040
|
+
"byteOffset",
|
|
9041
|
+
"length"
|
|
9042
|
+
],
|
|
9043
|
+
additionalProperties: {
|
|
9044
|
+
type: "number"
|
|
9045
|
+
}
|
|
9046
|
+
},
|
|
9047
|
+
{
|
|
9048
|
+
type: "object",
|
|
9049
|
+
properties: {
|
|
9050
|
+
size: {
|
|
9051
|
+
type: "number"
|
|
9052
|
+
},
|
|
9053
|
+
type: {
|
|
9054
|
+
type: "string"
|
|
9055
|
+
},
|
|
9056
|
+
lastModified: {
|
|
9057
|
+
type: "number"
|
|
9058
|
+
},
|
|
9059
|
+
name: {
|
|
9060
|
+
type: "string"
|
|
9061
|
+
},
|
|
9062
|
+
webkitRelativePath: {
|
|
9063
|
+
type: "string"
|
|
9064
|
+
}
|
|
9065
|
+
},
|
|
9066
|
+
required: [
|
|
9067
|
+
"lastModified",
|
|
9068
|
+
"name",
|
|
9069
|
+
"size",
|
|
9070
|
+
"type",
|
|
9071
|
+
"webkitRelativePath"
|
|
9072
|
+
],
|
|
9073
|
+
additionalProperties: !1
|
|
9074
|
+
}
|
|
9075
|
+
]
|
|
9076
|
+
}
|
|
9077
|
+
}
|
|
9078
|
+
],
|
|
9079
|
+
description: "Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."
|
|
8952
9080
|
}
|
|
8953
9081
|
},
|
|
8954
9082
|
required: [
|
|
@@ -8998,85 +9126,68 @@ for existing apps using this option.`
|
|
|
8998
9126
|
description: "Request headers."
|
|
8999
9127
|
},
|
|
9000
9128
|
body: {
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
fileInfos: {
|
|
9005
|
-
type: "array",
|
|
9006
|
-
items: {
|
|
9007
|
-
$ref: "#/definitions/FileInfo"
|
|
9008
|
-
},
|
|
9009
|
-
description: "Uploaded files."
|
|
9010
|
-
},
|
|
9011
|
-
code: {
|
|
9012
|
-
type: "string",
|
|
9013
|
-
description: "The code snippet to eval instead of a php file."
|
|
9014
|
-
},
|
|
9015
|
-
throwOnError: {
|
|
9016
|
-
type: "boolean",
|
|
9017
|
-
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9018
|
-
}
|
|
9019
|
-
},
|
|
9020
|
-
additionalProperties: !1
|
|
9021
|
-
},
|
|
9022
|
-
FileInfo: {
|
|
9023
|
-
type: "object",
|
|
9024
|
-
properties: {
|
|
9025
|
-
key: {
|
|
9026
|
-
type: "string"
|
|
9027
|
-
},
|
|
9028
|
-
name: {
|
|
9029
|
-
type: "string"
|
|
9030
|
-
},
|
|
9031
|
-
type: {
|
|
9032
|
-
type: "string"
|
|
9033
|
-
},
|
|
9034
|
-
data: {
|
|
9035
|
-
type: "object",
|
|
9036
|
-
properties: {
|
|
9037
|
-
BYTES_PER_ELEMENT: {
|
|
9038
|
-
type: "number"
|
|
9129
|
+
anyOf: [
|
|
9130
|
+
{
|
|
9131
|
+
type: "string"
|
|
9039
9132
|
},
|
|
9040
|
-
|
|
9133
|
+
{
|
|
9041
9134
|
type: "object",
|
|
9042
9135
|
properties: {
|
|
9136
|
+
BYTES_PER_ELEMENT: {
|
|
9137
|
+
type: "number"
|
|
9138
|
+
},
|
|
9139
|
+
buffer: {
|
|
9140
|
+
type: "object",
|
|
9141
|
+
properties: {
|
|
9142
|
+
byteLength: {
|
|
9143
|
+
type: "number"
|
|
9144
|
+
}
|
|
9145
|
+
},
|
|
9146
|
+
required: [
|
|
9147
|
+
"byteLength"
|
|
9148
|
+
],
|
|
9149
|
+
additionalProperties: !1
|
|
9150
|
+
},
|
|
9043
9151
|
byteLength: {
|
|
9044
9152
|
type: "number"
|
|
9153
|
+
},
|
|
9154
|
+
byteOffset: {
|
|
9155
|
+
type: "number"
|
|
9156
|
+
},
|
|
9157
|
+
length: {
|
|
9158
|
+
type: "number"
|
|
9045
9159
|
}
|
|
9046
9160
|
},
|
|
9047
9161
|
required: [
|
|
9048
|
-
"
|
|
9162
|
+
"BYTES_PER_ELEMENT",
|
|
9163
|
+
"buffer",
|
|
9164
|
+
"byteLength",
|
|
9165
|
+
"byteOffset",
|
|
9166
|
+
"length"
|
|
9049
9167
|
],
|
|
9050
|
-
additionalProperties:
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
type: "number"
|
|
9054
|
-
},
|
|
9055
|
-
byteOffset: {
|
|
9056
|
-
type: "number"
|
|
9057
|
-
},
|
|
9058
|
-
length: {
|
|
9059
|
-
type: "number"
|
|
9168
|
+
additionalProperties: {
|
|
9169
|
+
type: "number"
|
|
9170
|
+
}
|
|
9060
9171
|
}
|
|
9061
|
-
},
|
|
9062
|
-
required: [
|
|
9063
|
-
"BYTES_PER_ELEMENT",
|
|
9064
|
-
"buffer",
|
|
9065
|
-
"byteLength",
|
|
9066
|
-
"byteOffset",
|
|
9067
|
-
"length"
|
|
9068
9172
|
],
|
|
9173
|
+
description: "Request body."
|
|
9174
|
+
},
|
|
9175
|
+
env: {
|
|
9176
|
+
type: "object",
|
|
9069
9177
|
additionalProperties: {
|
|
9070
|
-
type: "
|
|
9071
|
-
}
|
|
9178
|
+
type: "string"
|
|
9179
|
+
},
|
|
9180
|
+
description: "Environment variables to set for this run."
|
|
9181
|
+
},
|
|
9182
|
+
code: {
|
|
9183
|
+
type: "string",
|
|
9184
|
+
description: "The code snippet to eval instead of a php file."
|
|
9185
|
+
},
|
|
9186
|
+
throwOnError: {
|
|
9187
|
+
type: "boolean",
|
|
9188
|
+
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9072
9189
|
}
|
|
9073
9190
|
},
|
|
9074
|
-
required: [
|
|
9075
|
-
"key",
|
|
9076
|
-
"name",
|
|
9077
|
-
"type",
|
|
9078
|
-
"data"
|
|
9079
|
-
],
|
|
9080
9191
|
additionalProperties: !1
|
|
9081
9192
|
},
|
|
9082
9193
|
WordPressInstallationOptions: {
|
|
@@ -9105,7 +9216,7 @@ function compileBlueprint(e, {
|
|
|
9105
9216
|
onStepCompleted: n = () => {
|
|
9106
9217
|
}
|
|
9107
9218
|
} = {}) {
|
|
9108
|
-
var p,
|
|
9219
|
+
var p, g, R, O, T;
|
|
9109
9220
|
if (e = {
|
|
9110
9221
|
...e,
|
|
9111
9222
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9116,15 +9227,15 @@ function compileBlueprint(e, {
|
|
|
9116
9227
|
step: "setSiteOptions",
|
|
9117
9228
|
options: e.siteOptions
|
|
9118
9229
|
}), e.plugins) {
|
|
9119
|
-
const v = e.plugins.map((
|
|
9230
|
+
const v = e.plugins.map((y) => typeof y == "string" ? y.startsWith("https://") ? {
|
|
9120
9231
|
resource: "url",
|
|
9121
|
-
url:
|
|
9232
|
+
url: y
|
|
9122
9233
|
} : {
|
|
9123
9234
|
resource: "wordpress.org/plugins",
|
|
9124
|
-
slug:
|
|
9125
|
-
} :
|
|
9235
|
+
slug: y
|
|
9236
|
+
} : y).map((y) => ({
|
|
9126
9237
|
step: "installPlugin",
|
|
9127
|
-
pluginZipFile:
|
|
9238
|
+
pluginZipFile: y
|
|
9128
9239
|
}));
|
|
9129
9240
|
e.steps.unshift(...v);
|
|
9130
9241
|
}
|
|
@@ -9137,7 +9248,7 @@ function compileBlueprint(e, {
|
|
|
9137
9248
|
);
|
|
9138
9249
|
s !== void 0 && s > -1 && (e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.includes("kitchen-sink") || (e.phpExtensionBundles.push("kitchen-sink"), console.warn(
|
|
9139
9250
|
"The WP-CLI step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9140
|
-
)), (
|
|
9251
|
+
)), (g = e.steps) == null || g.splice(s, 0, {
|
|
9141
9252
|
step: "writeFile",
|
|
9142
9253
|
data: {
|
|
9143
9254
|
resource: "url",
|
|
@@ -9163,9 +9274,9 @@ function compileBlueprint(e, {
|
|
|
9163
9274
|
throw v.errors = o, v;
|
|
9164
9275
|
}
|
|
9165
9276
|
const c = e.steps || [], d = c.reduce(
|
|
9166
|
-
(v,
|
|
9277
|
+
(v, y) => {
|
|
9167
9278
|
var m;
|
|
9168
|
-
return v + (((m =
|
|
9279
|
+
return v + (((m = y.progress) == null ? void 0 : m.weight) || 1);
|
|
9169
9280
|
},
|
|
9170
9281
|
0
|
|
9171
9282
|
), u = c.map(
|
|
@@ -9194,16 +9305,16 @@ function compileBlueprint(e, {
|
|
|
9194
9305
|
},
|
|
9195
9306
|
run: async (v) => {
|
|
9196
9307
|
try {
|
|
9197
|
-
for (const { resources:
|
|
9198
|
-
for (const m of
|
|
9308
|
+
for (const { resources: y } of u)
|
|
9309
|
+
for (const m of y)
|
|
9199
9310
|
m.setPlayground(v), m.isAsync && m.resolve();
|
|
9200
|
-
for (const [
|
|
9311
|
+
for (const [y, { run: m, step: k }] of Object.entries(u))
|
|
9201
9312
|
try {
|
|
9202
9313
|
const S = await m(v);
|
|
9203
9314
|
n(S, k);
|
|
9204
9315
|
} catch (S) {
|
|
9205
9316
|
throw console.error(S), new Error(
|
|
9206
|
-
`Error when executing the blueprint step #${
|
|
9317
|
+
`Error when executing the blueprint step #${y} (${JSON.stringify(
|
|
9207
9318
|
k
|
|
9208
9319
|
)}) ${S instanceof Error ? `: ${S.message}` : S}`,
|
|
9209
9320
|
{ cause: S }
|
|
@@ -9263,17 +9374,17 @@ function compileStep(e, {
|
|
|
9263
9374
|
const s = r.stage(
|
|
9264
9375
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9265
9376
|
), i = {};
|
|
9266
|
-
for (const
|
|
9267
|
-
let R = e[
|
|
9377
|
+
for (const g of Object.keys(e)) {
|
|
9378
|
+
let R = e[g];
|
|
9268
9379
|
isFileReference(R) && (R = Resource.create(R, {
|
|
9269
9380
|
semaphore: t
|
|
9270
|
-
})), i[
|
|
9381
|
+
})), i[g] = R;
|
|
9271
9382
|
}
|
|
9272
|
-
const o = async (
|
|
9383
|
+
const o = async (g) => {
|
|
9273
9384
|
var R;
|
|
9274
9385
|
try {
|
|
9275
9386
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9276
|
-
|
|
9387
|
+
g,
|
|
9277
9388
|
await resolveArguments(i),
|
|
9278
9389
|
{
|
|
9279
9390
|
tracker: s,
|
|
@@ -9284,10 +9395,10 @@ function compileStep(e, {
|
|
|
9284
9395
|
s.finish();
|
|
9285
9396
|
}
|
|
9286
9397
|
}, c = getResources(i), d = getResources(i).filter(
|
|
9287
|
-
(
|
|
9398
|
+
(g) => g.isAsync
|
|
9288
9399
|
), u = 1 / (d.length + 1);
|
|
9289
|
-
for (const
|
|
9290
|
-
|
|
9400
|
+
for (const g of d)
|
|
9401
|
+
g.progress = s.stage(u);
|
|
9291
9402
|
return { run: o, step: e, resources: c };
|
|
9292
9403
|
}
|
|
9293
9404
|
function getResources(e) {
|
|
@@ -9362,20 +9473,20 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9362
9473
|
const { id: i, type: o, path: c } = Object.assign({ path: [] }, s.data), d = (s.data.argumentList || []).map(fromWireValue);
|
|
9363
9474
|
let u;
|
|
9364
9475
|
try {
|
|
9365
|
-
const p = c.slice(0, -1).reduce((R, O) => R[O], e),
|
|
9476
|
+
const p = c.slice(0, -1).reduce((R, O) => R[O], e), g = c.reduce((R, O) => R[O], e);
|
|
9366
9477
|
switch (o) {
|
|
9367
9478
|
case "GET":
|
|
9368
|
-
u =
|
|
9479
|
+
u = g;
|
|
9369
9480
|
break;
|
|
9370
9481
|
case "SET":
|
|
9371
9482
|
p[c.slice(-1)[0]] = fromWireValue(s.data.value), u = !0;
|
|
9372
9483
|
break;
|
|
9373
9484
|
case "APPLY":
|
|
9374
|
-
u =
|
|
9485
|
+
u = g.apply(p, d);
|
|
9375
9486
|
break;
|
|
9376
9487
|
case "CONSTRUCT":
|
|
9377
9488
|
{
|
|
9378
|
-
const R = new
|
|
9489
|
+
const R = new g(...d);
|
|
9379
9490
|
u = proxy(R);
|
|
9380
9491
|
}
|
|
9381
9492
|
break;
|
|
@@ -9395,14 +9506,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9395
9506
|
u = { value: p, [throwMarker]: 0 };
|
|
9396
9507
|
}
|
|
9397
9508
|
Promise.resolve(u).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
9398
|
-
const [
|
|
9399
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9509
|
+
const [g, R] = toWireValue(p);
|
|
9510
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R), o === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9400
9511
|
}).catch((p) => {
|
|
9401
|
-
const [
|
|
9512
|
+
const [g, R] = toWireValue({
|
|
9402
9513
|
value: new TypeError("Unserializable return value"),
|
|
9403
9514
|
[throwMarker]: 0
|
|
9404
9515
|
});
|
|
9405
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9516
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R);
|
|
9406
9517
|
});
|
|
9407
9518
|
}), t.start && t.start();
|
|
9408
9519
|
}
|
|
@@ -9478,7 +9589,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9478
9589
|
const [u, p] = processArguments(c);
|
|
9479
9590
|
return requestResponseMessage(e, {
|
|
9480
9591
|
type: "APPLY",
|
|
9481
|
-
path: t.map((
|
|
9592
|
+
path: t.map((g) => g.toString()),
|
|
9482
9593
|
argumentList: u
|
|
9483
9594
|
}, p).then(fromWireValue);
|
|
9484
9595
|
},
|
|
@@ -9623,9 +9734,9 @@ function proxyClone(e) {
|
|
|
9623
9734
|
}
|
|
9624
9735
|
});
|
|
9625
9736
|
}
|
|
9626
|
-
class Logger {
|
|
9737
|
+
class Logger extends EventTarget {
|
|
9627
9738
|
constructor(t) {
|
|
9628
|
-
this.
|
|
9739
|
+
super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
|
|
9629
9740
|
}
|
|
9630
9741
|
/**
|
|
9631
9742
|
* Read the WordPress debug.log file and return its content.
|
|
@@ -9644,7 +9755,7 @@ class Logger {
|
|
|
9644
9755
|
logWindowError(t) {
|
|
9645
9756
|
this.log(
|
|
9646
9757
|
`${t.message} in ${t.filename} on line ${t.lineno}:${t.colno}`,
|
|
9647
|
-
"
|
|
9758
|
+
"Error"
|
|
9648
9759
|
);
|
|
9649
9760
|
}
|
|
9650
9761
|
/**
|
|
@@ -9653,7 +9764,7 @@ class Logger {
|
|
|
9653
9764
|
* @param PromiseRejectionEvent event
|
|
9654
9765
|
*/
|
|
9655
9766
|
logUnhandledRejection(t) {
|
|
9656
|
-
this.log(`${t.reason.stack}`, "
|
|
9767
|
+
this.log(`${t.reason.stack}`, "Error");
|
|
9657
9768
|
}
|
|
9658
9769
|
/**
|
|
9659
9770
|
* Register a listener for the window error events and log the data.
|
|
@@ -9675,6 +9786,18 @@ class Logger {
|
|
|
9675
9786
|
t.addEventListener("request.end", async () => {
|
|
9676
9787
|
const r = await this.getRequestPhpErrorLog(t);
|
|
9677
9788
|
r.length > this.lastPHPLogLength && (this.logRaw(r.substring(this.lastPHPLogLength)), this.lastPHPLogLength = r.length);
|
|
9789
|
+
}), t.addEventListener("request.error", (r) => {
|
|
9790
|
+
r = r, r.error && (this.log(
|
|
9791
|
+
`${r.error.message} ${r.error.stack}`,
|
|
9792
|
+
"Fatal",
|
|
9793
|
+
"PHP-WASM"
|
|
9794
|
+
), this.dispatchEvent(
|
|
9795
|
+
new CustomEvent(this.fatalErrorEvent, {
|
|
9796
|
+
detail: {
|
|
9797
|
+
logs: this.getLogs()
|
|
9798
|
+
}
|
|
9799
|
+
})
|
|
9800
|
+
));
|
|
9678
9801
|
});
|
|
9679
9802
|
}
|
|
9680
9803
|
/**
|
|
@@ -9703,26 +9826,39 @@ class Logger {
|
|
|
9703
9826
|
* Format log message and severity and log it.
|
|
9704
9827
|
* @param string message
|
|
9705
9828
|
* @param LogSeverity severity
|
|
9829
|
+
* @param string prefix
|
|
9706
9830
|
*/
|
|
9707
|
-
formatMessage(t, r) {
|
|
9708
|
-
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${
|
|
9831
|
+
formatMessage(t, r, n) {
|
|
9832
|
+
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${n} ${r}: ${t}`;
|
|
9709
9833
|
}
|
|
9710
9834
|
/**
|
|
9711
9835
|
* Log message with severity and timestamp.
|
|
9712
9836
|
* @param string message
|
|
9713
9837
|
* @param LogSeverity severity
|
|
9838
|
+
* @param string prefix
|
|
9714
9839
|
*/
|
|
9715
|
-
log(t, r) {
|
|
9716
|
-
r === void 0 && (r = "
|
|
9717
|
-
const
|
|
9718
|
-
|
|
9840
|
+
log(t, r, n) {
|
|
9841
|
+
r === void 0 && (r = "Info");
|
|
9842
|
+
const s = this.formatMessage(
|
|
9843
|
+
t,
|
|
9844
|
+
r,
|
|
9845
|
+
n ?? "Playground"
|
|
9846
|
+
);
|
|
9847
|
+
this.logRaw(s);
|
|
9719
9848
|
}
|
|
9720
9849
|
/**
|
|
9721
9850
|
* Log message without severity and timestamp.
|
|
9722
9851
|
* @param string log
|
|
9723
9852
|
*/
|
|
9724
9853
|
logRaw(t) {
|
|
9725
|
-
console.debug(t);
|
|
9854
|
+
this.logs.push(t), console.debug(t);
|
|
9855
|
+
}
|
|
9856
|
+
/**
|
|
9857
|
+
* Get all logs.
|
|
9858
|
+
* @returns string[]
|
|
9859
|
+
*/
|
|
9860
|
+
getLogs() {
|
|
9861
|
+
return this.logs;
|
|
9726
9862
|
}
|
|
9727
9863
|
}
|
|
9728
9864
|
const logger = new Logger();
|