@wp-playground/blueprints 0.6.9 → 0.6.10
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/blueprint-schema.json +28 -1
- package/index.cjs +25 -15
- package/index.d.ts +9 -19
- package/index.js +1013 -985
- package/lib/steps/handlers.d.ts +1 -2
- package/lib/steps/import-wxr.d.ts +27 -0
- package/lib/steps/index.d.ts +3 -3
- package/package.json +2 -2
- package/lib/steps/export-wxz.d.ts +0 -9
- package/lib/steps/import-file.d.ts +0 -29
package/index.js
CHANGED
|
@@ -84,7 +84,6 @@ const wpContentFilesExcludedFromExport = [
|
|
|
84
84
|
"plugins/wordpress-importer",
|
|
85
85
|
"mu-plugins/sqlite-database-integration",
|
|
86
86
|
"mu-plugins/playground-includes",
|
|
87
|
-
"mu-plugins/export-wxz.php",
|
|
88
87
|
"mu-plugins/0-playground.php",
|
|
89
88
|
/*
|
|
90
89
|
* Listing core themes like that here isn't ideal, especially since
|
|
@@ -859,14 +858,14 @@ echo json_encode($deactivated_plugins);
|
|
|
859
858
|
PATH_CURRENT_SITE: r
|
|
860
859
|
}
|
|
861
860
|
});
|
|
862
|
-
const p = new URL(await e.absoluteUrl),
|
|
861
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
863
862
|
await e.writeFile(
|
|
864
863
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
865
864
|
`<?php
|
|
866
865
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
867
866
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
868
867
|
}
|
|
869
|
-
$folder = ${phpVar(
|
|
868
|
+
$folder = ${phpVar(g)};
|
|
870
869
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
871
870
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
872
871
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -903,47 +902,27 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
903
902
|
WP_SITEURL: t
|
|
904
903
|
}
|
|
905
904
|
});
|
|
906
|
-
},
|
|
907
|
-
var
|
|
908
|
-
(
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}), s = (p = DOM(n).getElementById("import-upload-form")) == null ? void 0 : p.getAttribute("action"), i = await e.request({
|
|
912
|
-
url: `/wp-admin/${s}`,
|
|
913
|
-
method: "POST",
|
|
914
|
-
body: { import: t }
|
|
915
|
-
}), o = DOM(i).querySelector(
|
|
916
|
-
"#wpbody-content form"
|
|
917
|
-
);
|
|
918
|
-
if (!o)
|
|
919
|
-
throw console.log(i.text), new Error(
|
|
920
|
-
"Could not find an importer form in response. See the response text above for details."
|
|
921
|
-
);
|
|
922
|
-
const l = getFormData(o);
|
|
923
|
-
l.fetch_attachments = "1";
|
|
924
|
-
for (const $ in l)
|
|
925
|
-
if ($.startsWith("user_map[")) {
|
|
926
|
-
const O = "user_new[" + $.slice(9, -1) + "]";
|
|
927
|
-
l[O] = "1";
|
|
928
|
-
}
|
|
929
|
-
const d = await e.request({
|
|
930
|
-
url: o.action,
|
|
931
|
-
method: "POST",
|
|
932
|
-
body: l
|
|
905
|
+
}, importWxr = async (e, { file: t }, r) => {
|
|
906
|
+
var s;
|
|
907
|
+
(s = r == null ? void 0 : r.tracker) == null || s.setCaption("Importing content"), await writeFile(e, {
|
|
908
|
+
path: "/tmp/import.wxr",
|
|
909
|
+
data: t
|
|
933
910
|
});
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
911
|
+
const n = await e.documentRoot;
|
|
912
|
+
await e.run({
|
|
913
|
+
code: `<?php
|
|
914
|
+
require ${phpVar(n)} . '/wp-load.php';
|
|
915
|
+
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
916
|
+
$importer = new WXR_Importer( array(
|
|
917
|
+
'fetch_attachments' => true,
|
|
918
|
+
'default_author' => $admin_id
|
|
919
|
+
) );
|
|
920
|
+
$logger = new WP_Importer_Logger_CLI();
|
|
921
|
+
$importer->set_logger( $logger );
|
|
922
|
+
$result = $importer->import( '/tmp/import.wxr' );
|
|
923
|
+
`
|
|
924
|
+
});
|
|
925
|
+
}, zipFunctions = `<?php
|
|
947
926
|
|
|
948
927
|
function zipDir($root, $output, $options = array())
|
|
949
928
|
{
|
|
@@ -1064,13 +1043,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1064
1043
|
}), s = joinPaths(s, r);
|
|
1065
1044
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1066
1045
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1067
|
-
const
|
|
1046
|
+
const g = joinPaths(
|
|
1068
1047
|
i,
|
|
1069
1048
|
p
|
|
1070
1049
|
);
|
|
1071
|
-
await removePath(e,
|
|
1050
|
+
await removePath(e, g);
|
|
1072
1051
|
const O = joinPaths(o, p);
|
|
1073
|
-
await e.fileExists(O) && (await e.mkdir(dirname(
|
|
1052
|
+
await e.fileExists(O) && (await e.mkdir(dirname(g)), await e.mv(O, g));
|
|
1074
1053
|
}
|
|
1075
1054
|
const l = joinPaths(
|
|
1076
1055
|
s,
|
|
@@ -1109,12 +1088,6 @@ async function exportWXR(e) {
|
|
|
1109
1088
|
});
|
|
1110
1089
|
return new File([t.bytes], "export.xml");
|
|
1111
1090
|
}
|
|
1112
|
-
async function exportWXZ(e) {
|
|
1113
|
-
const t = await e.request({
|
|
1114
|
-
url: "/wp-admin/export.php?download=true&content=all&export_wxz=1"
|
|
1115
|
-
});
|
|
1116
|
-
return new File([t.bytes], "export.wxz");
|
|
1117
|
-
}
|
|
1118
1091
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1119
1092
|
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), o = joinPaths(i, randomString()), l = joinPaths(o, "assets", s);
|
|
1120
1093
|
await e.fileExists(l) && await e.rmdir(o, {
|
|
@@ -1130,10 +1103,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1130
1103
|
});
|
|
1131
1104
|
d = d.filter((N) => !N.endsWith("/__MACOSX"));
|
|
1132
1105
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1133
|
-
let p,
|
|
1134
|
-
u ? (
|
|
1106
|
+
let p, g = "";
|
|
1107
|
+
u ? (g = d[0], p = d[0].split("/").pop()) : (g = l, p = s);
|
|
1135
1108
|
const O = `${t}/${p}`;
|
|
1136
|
-
return await e.mv(
|
|
1109
|
+
return await e.mv(g, O), {
|
|
1137
1110
|
assetFolderPath: O,
|
|
1138
1111
|
assetFolderName: p
|
|
1139
1112
|
};
|
|
@@ -1278,9 +1251,8 @@ const allStepHandlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
1278
1251
|
defineWpConfigConsts,
|
|
1279
1252
|
enableMultisite,
|
|
1280
1253
|
exportWXR,
|
|
1281
|
-
exportWXZ,
|
|
1282
|
-
importFile,
|
|
1283
1254
|
importWordPressFiles,
|
|
1255
|
+
importWxr,
|
|
1284
1256
|
installPlugin,
|
|
1285
1257
|
installTheme,
|
|
1286
1258
|
login,
|
|
@@ -1724,7 +1696,8 @@ const SupportedPHPVersions = [
|
|
|
1724
1696
|
"xml-bundle",
|
|
1725
1697
|
"gd"
|
|
1726
1698
|
], SupportedPHPExtensionBundles = {
|
|
1727
|
-
"kitchen-sink": SupportedPHPExtensionsList
|
|
1699
|
+
"kitchen-sink": SupportedPHPExtensionsList,
|
|
1700
|
+
light: []
|
|
1728
1701
|
};
|
|
1729
1702
|
var Ae, Ge;
|
|
1730
1703
|
class PHPBrowser {
|
|
@@ -1852,7 +1825,7 @@ function fileToUint8Array(e) {
|
|
|
1852
1825
|
}, r.readAsArrayBuffer(e);
|
|
1853
1826
|
});
|
|
1854
1827
|
}
|
|
1855
|
-
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, xt, _t, Wt,
|
|
1828
|
+
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, xt, _t, Wt, gt, Bt;
|
|
1856
1829
|
class PHPRequestHandler {
|
|
1857
1830
|
/**
|
|
1858
1831
|
* @param php - The PHP instance.
|
|
@@ -1883,7 +1856,7 @@ class PHPRequestHandler {
|
|
|
1883
1856
|
* @throws {Error} If the requested path doesn't exist.
|
|
1884
1857
|
* @returns The resolved filesystem path.
|
|
1885
1858
|
*/
|
|
1886
|
-
Q(this,
|
|
1859
|
+
Q(this, gt);
|
|
1887
1860
|
Q(this, Pe, void 0);
|
|
1888
1861
|
Q(this, Ke, void 0);
|
|
1889
1862
|
Q(this, dt, void 0);
|
|
@@ -1998,7 +1971,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1998
1971
|
}
|
|
1999
1972
|
let d;
|
|
2000
1973
|
try {
|
|
2001
|
-
d = ce(this,
|
|
1974
|
+
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2002
1975
|
} catch {
|
|
2003
1976
|
return new PHPResponse(
|
|
2004
1977
|
404,
|
|
@@ -2020,7 +1993,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2020
1993
|
} finally {
|
|
2021
1994
|
n();
|
|
2022
1995
|
}
|
|
2023
|
-
},
|
|
1996
|
+
}, gt = new WeakSet(), Bt = function(t) {
|
|
2024
1997
|
let r = removePathPrefix(t, H(this, ve));
|
|
2025
1998
|
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";
|
|
2026
1999
|
const n = `${H(this, Pe)}${r}`;
|
|
@@ -2176,8 +2149,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2176
2149
|
} catch (l) {
|
|
2177
2150
|
const d = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2178
2151
|
if (d in FileErrorCodes) {
|
|
2179
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2180
|
-
throw new Error(`${
|
|
2152
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, g = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2153
|
+
throw new Error(`${g}: ${u}`, {
|
|
2181
2154
|
cause: l
|
|
2182
2155
|
});
|
|
2183
2156
|
}
|
|
@@ -2200,7 +2173,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2200
2173
|
return n && s && __defProp(t, r, s), s;
|
|
2201
2174
|
};
|
|
2202
2175
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2203
|
-
var Me, Ze, Ye, be, Re, Te, Ee, Xe,
|
|
2176
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, $t, Gt, yt, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2204
2177
|
class BasePHP {
|
|
2205
2178
|
/**
|
|
2206
2179
|
* Initializes a PHP runtime.
|
|
@@ -2210,7 +2183,7 @@ class BasePHP {
|
|
|
2210
2183
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2211
2184
|
*/
|
|
2212
2185
|
constructor(e, t) {
|
|
2213
|
-
Q(this,
|
|
2186
|
+
Q(this, $t);
|
|
2214
2187
|
Q(this, yt);
|
|
2215
2188
|
Q(this, vt);
|
|
2216
2189
|
Q(this, wt);
|
|
@@ -2221,7 +2194,7 @@ class BasePHP {
|
|
|
2221
2194
|
Q(this, Rt);
|
|
2222
2195
|
Q(this, Tt);
|
|
2223
2196
|
Q(this, kt);
|
|
2224
|
-
Q(this,
|
|
2197
|
+
Q(this, Ct);
|
|
2225
2198
|
Q(this, Me, void 0);
|
|
2226
2199
|
Q(this, Ze, void 0);
|
|
2227
2200
|
Q(this, Ye, void 0);
|
|
@@ -2335,7 +2308,7 @@ class BasePHP {
|
|
|
2335
2308
|
const t = await this.semaphore.acquire();
|
|
2336
2309
|
let r;
|
|
2337
2310
|
try {
|
|
2338
|
-
if (H(this, be) || (ce(this,
|
|
2311
|
+
if (H(this, be) || (ce(this, $t, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2339
2312
|
throw new Error(
|
|
2340
2313
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2341
2314
|
);
|
|
@@ -2345,7 +2318,7 @@ class BasePHP {
|
|
|
2345
2318
|
const i = e.env || {};
|
|
2346
2319
|
for (const l in i)
|
|
2347
2320
|
ce(this, Tt, rr).call(this, l, i[l]);
|
|
2348
|
-
const o = await ce(this,
|
|
2321
|
+
const o = await ce(this, Ct, sr).call(this);
|
|
2349
2322
|
if (o.exitCode !== 0) {
|
|
2350
2323
|
const l = {
|
|
2351
2324
|
stdout: o.text,
|
|
@@ -2488,7 +2461,7 @@ class BasePHP {
|
|
|
2488
2461
|
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2489
2462
|
}
|
|
2490
2463
|
}
|
|
2491
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(),
|
|
2464
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), $t = new WeakSet(), Gt = function() {
|
|
2492
2465
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2493
2466
|
"/internal/consts.php",
|
|
2494
2467
|
`<?php
|
|
@@ -2646,7 +2619,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2646
2619
|
[STRING],
|
|
2647
2620
|
[e]
|
|
2648
2621
|
);
|
|
2649
|
-
},
|
|
2622
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
2650
2623
|
var s;
|
|
2651
2624
|
let e, t;
|
|
2652
2625
|
try {
|
|
@@ -2979,10 +2952,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2979
2952
|
}
|
|
2980
2953
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2981
2954
|
class r extends t {
|
|
2982
|
-
constructor(
|
|
2983
|
-
if (super(), !e.IDENTIFIER.test(
|
|
2955
|
+
constructor($) {
|
|
2956
|
+
if (super(), !e.IDENTIFIER.test($))
|
|
2984
2957
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
2985
|
-
this.str =
|
|
2958
|
+
this.str = $;
|
|
2986
2959
|
}
|
|
2987
2960
|
toString() {
|
|
2988
2961
|
return this.str;
|
|
@@ -2996,8 +2969,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2996
2969
|
}
|
|
2997
2970
|
e.Name = r;
|
|
2998
2971
|
class n extends t {
|
|
2999
|
-
constructor(
|
|
3000
|
-
super(), this._items = typeof
|
|
2972
|
+
constructor($) {
|
|
2973
|
+
super(), this._items = typeof $ == "string" ? [$] : $;
|
|
3001
2974
|
}
|
|
3002
2975
|
toString() {
|
|
3003
2976
|
return this.str;
|
|
@@ -3005,93 +2978,93 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3005
2978
|
emptyStr() {
|
|
3006
2979
|
if (this._items.length > 1)
|
|
3007
2980
|
return !1;
|
|
3008
|
-
const
|
|
3009
|
-
return
|
|
2981
|
+
const $ = this._items[0];
|
|
2982
|
+
return $ === "" || $ === '""';
|
|
3010
2983
|
}
|
|
3011
2984
|
get str() {
|
|
3012
|
-
var
|
|
3013
|
-
return (
|
|
2985
|
+
var $;
|
|
2986
|
+
return ($ = this._str) !== null && $ !== void 0 ? $ : this._str = this._items.reduce((P, I) => `${P}${I}`, "");
|
|
3014
2987
|
}
|
|
3015
2988
|
get names() {
|
|
3016
|
-
var
|
|
3017
|
-
return (
|
|
2989
|
+
var $;
|
|
2990
|
+
return ($ = this._names) !== null && $ !== void 0 ? $ : this._names = this._items.reduce((P, I) => (I instanceof r && (P[I.str] = (P[I.str] || 0) + 1), P), {});
|
|
3018
2991
|
}
|
|
3019
2992
|
}
|
|
3020
2993
|
e._Code = n, e.nil = new n("");
|
|
3021
|
-
function s(
|
|
3022
|
-
const
|
|
2994
|
+
function s(_, ...$) {
|
|
2995
|
+
const P = [_[0]];
|
|
3023
2996
|
let I = 0;
|
|
3024
|
-
for (; I <
|
|
3025
|
-
l(
|
|
3026
|
-
return new n(
|
|
2997
|
+
for (; I < $.length; )
|
|
2998
|
+
l(P, $[I]), P.push(_[++I]);
|
|
2999
|
+
return new n(P);
|
|
3027
3000
|
}
|
|
3028
3001
|
e._ = s;
|
|
3029
3002
|
const i = new n("+");
|
|
3030
|
-
function o(
|
|
3031
|
-
const
|
|
3003
|
+
function o(_, ...$) {
|
|
3004
|
+
const P = [N(_[0])];
|
|
3032
3005
|
let I = 0;
|
|
3033
|
-
for (; I <
|
|
3034
|
-
|
|
3035
|
-
return d(
|
|
3006
|
+
for (; I < $.length; )
|
|
3007
|
+
P.push(i), l(P, $[I]), P.push(i, N(_[++I]));
|
|
3008
|
+
return d(P), new n(P);
|
|
3036
3009
|
}
|
|
3037
3010
|
e.str = o;
|
|
3038
|
-
function l(
|
|
3039
|
-
|
|
3011
|
+
function l(_, $) {
|
|
3012
|
+
$ instanceof n ? _.push(...$._items) : $ instanceof r ? _.push($) : _.push(g($));
|
|
3040
3013
|
}
|
|
3041
3014
|
e.addCodeArg = l;
|
|
3042
|
-
function d(
|
|
3043
|
-
let
|
|
3044
|
-
for (;
|
|
3045
|
-
if (
|
|
3046
|
-
const
|
|
3047
|
-
if (
|
|
3048
|
-
|
|
3015
|
+
function d(_) {
|
|
3016
|
+
let $ = 1;
|
|
3017
|
+
for (; $ < _.length - 1; ) {
|
|
3018
|
+
if (_[$] === i) {
|
|
3019
|
+
const P = u(_[$ - 1], _[$ + 1]);
|
|
3020
|
+
if (P !== void 0) {
|
|
3021
|
+
_.splice($ - 1, 3, P);
|
|
3049
3022
|
continue;
|
|
3050
3023
|
}
|
|
3051
|
-
|
|
3024
|
+
_[$++] = "+";
|
|
3052
3025
|
}
|
|
3053
|
-
|
|
3026
|
+
$++;
|
|
3054
3027
|
}
|
|
3055
3028
|
}
|
|
3056
|
-
function u(
|
|
3057
|
-
if (
|
|
3058
|
-
return
|
|
3059
|
-
if (
|
|
3060
|
-
return
|
|
3061
|
-
if (typeof
|
|
3062
|
-
return
|
|
3063
|
-
if (typeof
|
|
3064
|
-
return `"${
|
|
3029
|
+
function u(_, $) {
|
|
3030
|
+
if ($ === '""')
|
|
3031
|
+
return _;
|
|
3032
|
+
if (_ === '""')
|
|
3033
|
+
return $;
|
|
3034
|
+
if (typeof _ == "string")
|
|
3035
|
+
return $ instanceof r || _[_.length - 1] !== '"' ? void 0 : typeof $ != "string" ? `${_.slice(0, -1)}${$}"` : $[0] === '"' ? _.slice(0, -1) + $.slice(1) : void 0;
|
|
3036
|
+
if (typeof $ == "string" && $[0] === '"' && !(_ instanceof r))
|
|
3037
|
+
return `"${_}${$.slice(1)}`;
|
|
3065
3038
|
}
|
|
3066
|
-
function p(
|
|
3067
|
-
return
|
|
3039
|
+
function p(_, $) {
|
|
3040
|
+
return $.emptyStr() ? _ : _.emptyStr() ? $ : o`${_}${$}`;
|
|
3068
3041
|
}
|
|
3069
3042
|
e.strConcat = p;
|
|
3070
|
-
function
|
|
3071
|
-
return typeof
|
|
3043
|
+
function g(_) {
|
|
3044
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : N(Array.isArray(_) ? _.join(",") : _);
|
|
3072
3045
|
}
|
|
3073
|
-
function O(
|
|
3074
|
-
return new n(N(
|
|
3046
|
+
function O(_) {
|
|
3047
|
+
return new n(N(_));
|
|
3075
3048
|
}
|
|
3076
3049
|
e.stringify = O;
|
|
3077
|
-
function N(
|
|
3078
|
-
return JSON.stringify(
|
|
3050
|
+
function N(_) {
|
|
3051
|
+
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3079
3052
|
}
|
|
3080
3053
|
e.safeStringify = N;
|
|
3081
|
-
function R(
|
|
3082
|
-
return typeof
|
|
3054
|
+
function R(_) {
|
|
3055
|
+
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3083
3056
|
}
|
|
3084
3057
|
e.getProperty = R;
|
|
3085
|
-
function
|
|
3086
|
-
if (typeof
|
|
3087
|
-
return new n(`${
|
|
3088
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
3058
|
+
function T(_) {
|
|
3059
|
+
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3060
|
+
return new n(`${_}`);
|
|
3061
|
+
throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`);
|
|
3089
3062
|
}
|
|
3090
|
-
e.getEsmExportName =
|
|
3091
|
-
function
|
|
3092
|
-
return new n(
|
|
3063
|
+
e.getEsmExportName = T;
|
|
3064
|
+
function y(_) {
|
|
3065
|
+
return new n(_.toString());
|
|
3093
3066
|
}
|
|
3094
|
-
e.regexpCode =
|
|
3067
|
+
e.regexpCode = y;
|
|
3095
3068
|
})(code$1);
|
|
3096
3069
|
var scope = {};
|
|
3097
3070
|
(function(e) {
|
|
@@ -3125,8 +3098,8 @@ var scope = {};
|
|
|
3125
3098
|
return `${u}${p.index++}`;
|
|
3126
3099
|
}
|
|
3127
3100
|
_nameGroup(u) {
|
|
3128
|
-
var p,
|
|
3129
|
-
if (!((
|
|
3101
|
+
var p, g;
|
|
3102
|
+
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))
|
|
3130
3103
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3131
3104
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3132
3105
|
}
|
|
@@ -3136,8 +3109,8 @@ var scope = {};
|
|
|
3136
3109
|
constructor(u, p) {
|
|
3137
3110
|
super(p), this.prefix = u;
|
|
3138
3111
|
}
|
|
3139
|
-
setValue(u, { property: p, itemIndex:
|
|
3140
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3112
|
+
setValue(u, { property: p, itemIndex: g }) {
|
|
3113
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${g}]`;
|
|
3141
3114
|
}
|
|
3142
3115
|
}
|
|
3143
3116
|
e.ValueScopeName = i;
|
|
@@ -3153,60 +3126,60 @@ var scope = {};
|
|
|
3153
3126
|
return new i(u, this._newName(u));
|
|
3154
3127
|
}
|
|
3155
3128
|
value(u, p) {
|
|
3156
|
-
var
|
|
3129
|
+
var g;
|
|
3157
3130
|
if (p.ref === void 0)
|
|
3158
3131
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3159
|
-
const O = this.toName(u), { prefix: N } = O, R = (
|
|
3160
|
-
let
|
|
3161
|
-
if (
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3164
|
-
return
|
|
3132
|
+
const O = this.toName(u), { prefix: N } = O, R = (g = p.key) !== null && g !== void 0 ? g : p.ref;
|
|
3133
|
+
let T = this._values[N];
|
|
3134
|
+
if (T) {
|
|
3135
|
+
const $ = T.get(R);
|
|
3136
|
+
if ($)
|
|
3137
|
+
return $;
|
|
3165
3138
|
} else
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
const
|
|
3169
|
-
return
|
|
3139
|
+
T = this._values[N] = /* @__PURE__ */ new Map();
|
|
3140
|
+
T.set(R, O);
|
|
3141
|
+
const y = this._scope[N] || (this._scope[N] = []), _ = y.length;
|
|
3142
|
+
return y[_] = p.ref, O.setValue(p, { property: N, itemIndex: _ }), O;
|
|
3170
3143
|
}
|
|
3171
3144
|
getValue(u, p) {
|
|
3172
|
-
const
|
|
3173
|
-
if (
|
|
3174
|
-
return
|
|
3145
|
+
const g = this._values[u];
|
|
3146
|
+
if (g)
|
|
3147
|
+
return g.get(p);
|
|
3175
3148
|
}
|
|
3176
3149
|
scopeRefs(u, p = this._values) {
|
|
3177
|
-
return this._reduceValues(p, (
|
|
3178
|
-
if (
|
|
3179
|
-
throw new Error(`CodeGen: name "${
|
|
3180
|
-
return (0, t._)`${u}${
|
|
3150
|
+
return this._reduceValues(p, (g) => {
|
|
3151
|
+
if (g.scopePath === void 0)
|
|
3152
|
+
throw new Error(`CodeGen: name "${g}" has no value`);
|
|
3153
|
+
return (0, t._)`${u}${g.scopePath}`;
|
|
3181
3154
|
});
|
|
3182
3155
|
}
|
|
3183
|
-
scopeCode(u = this._values, p,
|
|
3156
|
+
scopeCode(u = this._values, p, g) {
|
|
3184
3157
|
return this._reduceValues(u, (O) => {
|
|
3185
3158
|
if (O.value === void 0)
|
|
3186
3159
|
throw new Error(`CodeGen: name "${O}" has no value`);
|
|
3187
3160
|
return O.value.code;
|
|
3188
|
-
}, p,
|
|
3161
|
+
}, p, g);
|
|
3189
3162
|
}
|
|
3190
|
-
_reduceValues(u, p,
|
|
3163
|
+
_reduceValues(u, p, g = {}, O) {
|
|
3191
3164
|
let N = t.nil;
|
|
3192
3165
|
for (const R in u) {
|
|
3193
|
-
const
|
|
3194
|
-
if (!
|
|
3166
|
+
const T = u[R];
|
|
3167
|
+
if (!T)
|
|
3195
3168
|
continue;
|
|
3196
|
-
const
|
|
3197
|
-
|
|
3198
|
-
if (
|
|
3169
|
+
const y = g[R] = g[R] || /* @__PURE__ */ new Map();
|
|
3170
|
+
T.forEach((_) => {
|
|
3171
|
+
if (y.has(_))
|
|
3199
3172
|
return;
|
|
3200
|
-
|
|
3201
|
-
let
|
|
3202
|
-
if (
|
|
3203
|
-
const
|
|
3204
|
-
N = (0, t._)`${N}${
|
|
3205
|
-
} else if (
|
|
3206
|
-
N = (0, t._)`${N}${
|
|
3173
|
+
y.set(_, n.Started);
|
|
3174
|
+
let $ = p(_);
|
|
3175
|
+
if ($) {
|
|
3176
|
+
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3177
|
+
N = (0, t._)`${N}${P} ${_} = ${$};${this.opts._n}`;
|
|
3178
|
+
} else if ($ = O == null ? void 0 : O(_))
|
|
3179
|
+
N = (0, t._)`${N}${$}${this.opts._n}`;
|
|
3207
3180
|
else
|
|
3208
|
-
throw new r(
|
|
3209
|
-
|
|
3181
|
+
throw new r(_);
|
|
3182
|
+
y.set(_, n.Completed);
|
|
3210
3183
|
});
|
|
3211
3184
|
}
|
|
3212
3185
|
return N;
|
|
@@ -3320,7 +3293,7 @@ var scope = {};
|
|
|
3320
3293
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3321
3294
|
}
|
|
3322
3295
|
}
|
|
3323
|
-
class
|
|
3296
|
+
class g extends i {
|
|
3324
3297
|
constructor(a) {
|
|
3325
3298
|
super(), this.error = a;
|
|
3326
3299
|
}
|
|
@@ -3382,12 +3355,12 @@ var scope = {};
|
|
|
3382
3355
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3383
3356
|
}
|
|
3384
3357
|
}
|
|
3385
|
-
class
|
|
3358
|
+
class T extends N {
|
|
3386
3359
|
}
|
|
3387
|
-
class
|
|
3360
|
+
class y extends R {
|
|
3388
3361
|
}
|
|
3389
|
-
|
|
3390
|
-
class
|
|
3362
|
+
y.kind = "else";
|
|
3363
|
+
class _ extends R {
|
|
3391
3364
|
constructor(a, h) {
|
|
3392
3365
|
super(h), this.condition = a;
|
|
3393
3366
|
}
|
|
@@ -3403,10 +3376,10 @@ var scope = {};
|
|
|
3403
3376
|
let h = this.else;
|
|
3404
3377
|
if (h) {
|
|
3405
3378
|
const C = h.optimizeNodes();
|
|
3406
|
-
h = this.else = Array.isArray(C) ? new
|
|
3379
|
+
h = this.else = Array.isArray(C) ? new y(C) : C;
|
|
3407
3380
|
}
|
|
3408
3381
|
if (h)
|
|
3409
|
-
return a === !1 ? h instanceof
|
|
3382
|
+
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(a), h instanceof _ ? [h] : h.nodes);
|
|
3410
3383
|
if (!(a === !1 || !this.nodes.length))
|
|
3411
3384
|
return this;
|
|
3412
3385
|
}
|
|
@@ -3420,11 +3393,11 @@ var scope = {};
|
|
|
3420
3393
|
return ue(a, this.condition), this.else && K(a, this.else.names), a;
|
|
3421
3394
|
}
|
|
3422
3395
|
}
|
|
3423
|
-
|
|
3424
|
-
class
|
|
3396
|
+
_.kind = "if";
|
|
3397
|
+
class $ extends R {
|
|
3425
3398
|
}
|
|
3426
|
-
|
|
3427
|
-
class
|
|
3399
|
+
$.kind = "for";
|
|
3400
|
+
class P extends $ {
|
|
3428
3401
|
constructor(a) {
|
|
3429
3402
|
super(), this.iteration = a;
|
|
3430
3403
|
}
|
|
@@ -3439,7 +3412,7 @@ var scope = {};
|
|
|
3439
3412
|
return K(super.names, this.iteration.names);
|
|
3440
3413
|
}
|
|
3441
3414
|
}
|
|
3442
|
-
class I extends
|
|
3415
|
+
class I extends $ {
|
|
3443
3416
|
constructor(a, h, C, M) {
|
|
3444
3417
|
super(), this.varKind = a, this.name = h, this.from = C, this.to = M;
|
|
3445
3418
|
}
|
|
@@ -3452,7 +3425,7 @@ var scope = {};
|
|
|
3452
3425
|
return ue(a, this.to);
|
|
3453
3426
|
}
|
|
3454
3427
|
}
|
|
3455
|
-
class D extends
|
|
3428
|
+
class D extends $ {
|
|
3456
3429
|
constructor(a, h, C, M) {
|
|
3457
3430
|
super(), this.loop = a, this.varKind = h, this.name = C, this.iterable = M;
|
|
3458
3431
|
}
|
|
@@ -3518,7 +3491,7 @@ var scope = {};
|
|
|
3518
3491
|
class re {
|
|
3519
3492
|
constructor(a, h = {}) {
|
|
3520
3493
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3521
|
-
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new
|
|
3494
|
+
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new T()];
|
|
3522
3495
|
}
|
|
3523
3496
|
toString() {
|
|
3524
3497
|
return this._root.render(this.opts);
|
|
@@ -3584,7 +3557,7 @@ var scope = {};
|
|
|
3584
3557
|
}
|
|
3585
3558
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3586
3559
|
if(a, h, C) {
|
|
3587
|
-
if (this._blockNode(new
|
|
3560
|
+
if (this._blockNode(new _(a)), h && C)
|
|
3588
3561
|
this.code(h).else().code(C).endIf();
|
|
3589
3562
|
else if (h)
|
|
3590
3563
|
this.code(h).endIf();
|
|
@@ -3594,22 +3567,22 @@ var scope = {};
|
|
|
3594
3567
|
}
|
|
3595
3568
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
3596
3569
|
elseIf(a) {
|
|
3597
|
-
return this._elseNode(new
|
|
3570
|
+
return this._elseNode(new _(a));
|
|
3598
3571
|
}
|
|
3599
3572
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3600
3573
|
else() {
|
|
3601
|
-
return this._elseNode(new
|
|
3574
|
+
return this._elseNode(new y());
|
|
3602
3575
|
}
|
|
3603
3576
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3604
3577
|
endIf() {
|
|
3605
|
-
return this._endBlockNode(
|
|
3578
|
+
return this._endBlockNode(_, y);
|
|
3606
3579
|
}
|
|
3607
3580
|
_for(a, h) {
|
|
3608
3581
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
3609
3582
|
}
|
|
3610
3583
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3611
3584
|
for(a, h) {
|
|
3612
|
-
return this._for(new
|
|
3585
|
+
return this._for(new P(a), h);
|
|
3613
3586
|
}
|
|
3614
3587
|
// `for` statement for a range of values
|
|
3615
3588
|
forRange(a, h, C, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
@@ -3637,7 +3610,7 @@ var scope = {};
|
|
|
3637
3610
|
}
|
|
3638
3611
|
// end `for` loop
|
|
3639
3612
|
endFor() {
|
|
3640
|
-
return this._endBlockNode(
|
|
3613
|
+
return this._endBlockNode($);
|
|
3641
3614
|
}
|
|
3642
3615
|
// `label` statement
|
|
3643
3616
|
label(a) {
|
|
@@ -3667,7 +3640,7 @@ var scope = {};
|
|
|
3667
3640
|
}
|
|
3668
3641
|
// `throw` statement
|
|
3669
3642
|
throw(a) {
|
|
3670
|
-
return this._leafNode(new
|
|
3643
|
+
return this._leafNode(new g(a));
|
|
3671
3644
|
}
|
|
3672
3645
|
// start self-balancing block
|
|
3673
3646
|
block(a, h) {
|
|
@@ -3709,7 +3682,7 @@ var scope = {};
|
|
|
3709
3682
|
}
|
|
3710
3683
|
_elseNode(a) {
|
|
3711
3684
|
const h = this._currNode;
|
|
3712
|
-
if (!(h instanceof
|
|
3685
|
+
if (!(h instanceof _))
|
|
3713
3686
|
throw new Error('CodeGen: "else" without "if"');
|
|
3714
3687
|
return this._currNode = h.else = a, this;
|
|
3715
3688
|
}
|
|
@@ -3726,20 +3699,20 @@ var scope = {};
|
|
|
3726
3699
|
}
|
|
3727
3700
|
}
|
|
3728
3701
|
e.CodeGen = re;
|
|
3729
|
-
function K(
|
|
3702
|
+
function K(b, a) {
|
|
3730
3703
|
for (const h in a)
|
|
3731
|
-
|
|
3732
|
-
return
|
|
3733
|
-
}
|
|
3734
|
-
function ue(
|
|
3735
|
-
return a instanceof t._CodeOrName ? K(
|
|
3736
|
-
}
|
|
3737
|
-
function oe(
|
|
3738
|
-
if (
|
|
3739
|
-
return C(
|
|
3740
|
-
if (!M(
|
|
3741
|
-
return
|
|
3742
|
-
return new t._Code(
|
|
3704
|
+
b[h] = (b[h] || 0) + (a[h] || 0);
|
|
3705
|
+
return b;
|
|
3706
|
+
}
|
|
3707
|
+
function ue(b, a) {
|
|
3708
|
+
return a instanceof t._CodeOrName ? K(b, a.names) : b;
|
|
3709
|
+
}
|
|
3710
|
+
function oe(b, a, h) {
|
|
3711
|
+
if (b instanceof t.Name)
|
|
3712
|
+
return C(b);
|
|
3713
|
+
if (!M(b))
|
|
3714
|
+
return b;
|
|
3715
|
+
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W = C(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3743
3716
|
function C(q) {
|
|
3744
3717
|
const W = h[q.str];
|
|
3745
3718
|
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
@@ -3748,29 +3721,29 @@ var scope = {};
|
|
|
3748
3721
|
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3749
3722
|
}
|
|
3750
3723
|
}
|
|
3751
|
-
function ke(
|
|
3724
|
+
function ke(b, a) {
|
|
3752
3725
|
for (const h in a)
|
|
3753
|
-
|
|
3726
|
+
b[h] = (b[h] || 0) - (a[h] || 0);
|
|
3754
3727
|
}
|
|
3755
|
-
function
|
|
3756
|
-
return typeof
|
|
3728
|
+
function Ce(b) {
|
|
3729
|
+
return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
|
|
3757
3730
|
}
|
|
3758
|
-
e.not =
|
|
3759
|
-
const qe =
|
|
3760
|
-
function et(...
|
|
3761
|
-
return
|
|
3731
|
+
e.not = Ce;
|
|
3732
|
+
const qe = v(e.operators.AND);
|
|
3733
|
+
function et(...b) {
|
|
3734
|
+
return b.reduce(qe);
|
|
3762
3735
|
}
|
|
3763
3736
|
e.and = et;
|
|
3764
|
-
const Ue =
|
|
3765
|
-
function F(...
|
|
3766
|
-
return
|
|
3737
|
+
const Ue = v(e.operators.OR);
|
|
3738
|
+
function F(...b) {
|
|
3739
|
+
return b.reduce(Ue);
|
|
3767
3740
|
}
|
|
3768
3741
|
e.or = F;
|
|
3769
|
-
function
|
|
3770
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3742
|
+
function v(b) {
|
|
3743
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${b} ${j(h)}`;
|
|
3771
3744
|
}
|
|
3772
|
-
function j(
|
|
3773
|
-
return
|
|
3745
|
+
function j(b) {
|
|
3746
|
+
return b instanceof t.Name ? b : (0, t._)`(${b})`;
|
|
3774
3747
|
}
|
|
3775
3748
|
})(codegen);
|
|
3776
3749
|
var util = {};
|
|
@@ -3830,13 +3803,13 @@ var util = {};
|
|
|
3830
3803
|
}
|
|
3831
3804
|
e.unescapeFragment = u;
|
|
3832
3805
|
function p(w) {
|
|
3833
|
-
return encodeURIComponent(
|
|
3806
|
+
return encodeURIComponent(g(w));
|
|
3834
3807
|
}
|
|
3835
3808
|
e.escapeFragment = p;
|
|
3836
|
-
function
|
|
3809
|
+
function g(w) {
|
|
3837
3810
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3838
3811
|
}
|
|
3839
|
-
e.escapeJsonPointer =
|
|
3812
|
+
e.escapeJsonPointer = g;
|
|
3840
3813
|
function O(w) {
|
|
3841
3814
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3842
3815
|
}
|
|
@@ -3861,10 +3834,10 @@ var util = {};
|
|
|
3861
3834
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3862
3835
|
}),
|
|
3863
3836
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3864
|
-
k === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`),
|
|
3837
|
+
k === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), y(w, A, k));
|
|
3865
3838
|
}),
|
|
3866
3839
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3867
|
-
resultToName:
|
|
3840
|
+
resultToName: T
|
|
3868
3841
|
}),
|
|
3869
3842
|
items: R({
|
|
3870
3843
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => w.assign(A, (0, t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),
|
|
@@ -3873,35 +3846,35 @@ var util = {};
|
|
|
3873
3846
|
resultToName: (w, k) => w.var("items", k)
|
|
3874
3847
|
})
|
|
3875
3848
|
};
|
|
3876
|
-
function
|
|
3849
|
+
function T(w, k) {
|
|
3877
3850
|
if (k === !0)
|
|
3878
3851
|
return w.var("props", !0);
|
|
3879
3852
|
const A = w.var("props", (0, t._)`{}`);
|
|
3880
|
-
return k !== void 0 &&
|
|
3853
|
+
return k !== void 0 && y(w, A, k), A;
|
|
3881
3854
|
}
|
|
3882
|
-
e.evaluatedPropsToName =
|
|
3883
|
-
function
|
|
3855
|
+
e.evaluatedPropsToName = T;
|
|
3856
|
+
function y(w, k, A) {
|
|
3884
3857
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${k}${(0, t.getProperty)(V)}`, !0));
|
|
3885
3858
|
}
|
|
3886
|
-
e.setEvaluated =
|
|
3887
|
-
const
|
|
3888
|
-
function
|
|
3859
|
+
e.setEvaluated = y;
|
|
3860
|
+
const _ = {};
|
|
3861
|
+
function $(w, k) {
|
|
3889
3862
|
return w.scopeValue("func", {
|
|
3890
3863
|
ref: k,
|
|
3891
|
-
code:
|
|
3864
|
+
code: _[k.code] || (_[k.code] = new r._Code(k.code))
|
|
3892
3865
|
});
|
|
3893
3866
|
}
|
|
3894
|
-
e.useFunc =
|
|
3895
|
-
var
|
|
3867
|
+
e.useFunc = $;
|
|
3868
|
+
var P;
|
|
3896
3869
|
(function(w) {
|
|
3897
3870
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3898
|
-
})(
|
|
3871
|
+
})(P = e.Type || (e.Type = {}));
|
|
3899
3872
|
function I(w, k, A) {
|
|
3900
3873
|
if (w instanceof t.Name) {
|
|
3901
|
-
const V = k ===
|
|
3874
|
+
const V = k === P.Num;
|
|
3902
3875
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3903
3876
|
}
|
|
3904
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3877
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3905
3878
|
}
|
|
3906
3879
|
e.getErrorPath = I;
|
|
3907
3880
|
function D(w, k, A = w.opts.strictSchema) {
|
|
@@ -3943,40 +3916,40 @@ names$1.default = names;
|
|
|
3943
3916
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3944
3917
|
const t = codegen, r = util, n = names$1;
|
|
3945
3918
|
e.keywordError = {
|
|
3946
|
-
message: ({ keyword:
|
|
3919
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3947
3920
|
}, e.keyword$DataError = {
|
|
3948
|
-
message: ({ keyword:
|
|
3921
|
+
message: ({ keyword: y, schemaType: _ }) => _ ? (0, t.str)`"${y}" keyword must be ${_} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3949
3922
|
};
|
|
3950
|
-
function s(
|
|
3951
|
-
const { it: I } =
|
|
3952
|
-
|
|
3923
|
+
function s(y, _ = e.keywordError, $, P) {
|
|
3924
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A = g(y, _, $);
|
|
3925
|
+
P ?? (w || k) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3953
3926
|
}
|
|
3954
3927
|
e.reportError = s;
|
|
3955
|
-
function i(
|
|
3956
|
-
const { it:
|
|
3957
|
-
d(I, k), D || w || u(
|
|
3928
|
+
function i(y, _ = e.keywordError, $) {
|
|
3929
|
+
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k = g(y, _, $);
|
|
3930
|
+
d(I, k), D || w || u(P, n.default.vErrors);
|
|
3958
3931
|
}
|
|
3959
3932
|
e.reportExtraError = i;
|
|
3960
|
-
function o(
|
|
3961
|
-
|
|
3933
|
+
function o(y, _) {
|
|
3934
|
+
y.assign(n.default.errors, _), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(_, () => y.assign((0, t._)`${n.default.vErrors}.length`, _), () => y.assign(n.default.vErrors, null)));
|
|
3962
3935
|
}
|
|
3963
3936
|
e.resetErrorsCount = o;
|
|
3964
|
-
function l({ gen:
|
|
3937
|
+
function l({ gen: y, keyword: _, schemaValue: $, data: P, errsCount: I, it: D }) {
|
|
3965
3938
|
if (I === void 0)
|
|
3966
3939
|
throw new Error("ajv implementation error");
|
|
3967
|
-
const w =
|
|
3968
|
-
|
|
3969
|
-
|
|
3940
|
+
const w = y.name("err");
|
|
3941
|
+
y.forRange("i", I, n.default.errors, (k) => {
|
|
3942
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${k}]`), 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}/${_}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, $), y.assign((0, t._)`${w}.data`, P));
|
|
3970
3943
|
});
|
|
3971
3944
|
}
|
|
3972
3945
|
e.extendErrors = l;
|
|
3973
|
-
function d(
|
|
3974
|
-
const
|
|
3975
|
-
|
|
3946
|
+
function d(y, _) {
|
|
3947
|
+
const $ = y.const("err", _);
|
|
3948
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${$}]`), (0, t._)`${n.default.vErrors}.push(${$})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3976
3949
|
}
|
|
3977
|
-
function u(
|
|
3978
|
-
const { gen:
|
|
3979
|
-
I.$async ?
|
|
3950
|
+
function u(y, _) {
|
|
3951
|
+
const { gen: $, validateName: P, schemaEnv: I } = y;
|
|
3952
|
+
I.$async ? $.throw((0, t._)`new ${y.ValidationError}(${_})`) : ($.assign((0, t._)`${P}.errors`, _), $.return(!1));
|
|
3980
3953
|
}
|
|
3981
3954
|
const p = {
|
|
3982
3955
|
keyword: new t.Name("keyword"),
|
|
@@ -3987,28 +3960,28 @@ names$1.default = names;
|
|
|
3987
3960
|
schema: new t.Name("schema"),
|
|
3988
3961
|
parentSchema: new t.Name("parentSchema")
|
|
3989
3962
|
};
|
|
3990
|
-
function
|
|
3991
|
-
const { createErrors:
|
|
3992
|
-
return
|
|
3993
|
-
}
|
|
3994
|
-
function O(
|
|
3995
|
-
const { gen:
|
|
3996
|
-
N(I,
|
|
3997
|
-
R(
|
|
3963
|
+
function g(y, _, $) {
|
|
3964
|
+
const { createErrors: P } = y.it;
|
|
3965
|
+
return P === !1 ? (0, t._)`{}` : O(y, _, $);
|
|
3966
|
+
}
|
|
3967
|
+
function O(y, _, $ = {}) {
|
|
3968
|
+
const { gen: P, it: I } = y, D = [
|
|
3969
|
+
N(I, $),
|
|
3970
|
+
R(y, $)
|
|
3998
3971
|
];
|
|
3999
|
-
return
|
|
3972
|
+
return T(y, _, D), P.object(...D);
|
|
4000
3973
|
}
|
|
4001
|
-
function N({ errorPath:
|
|
4002
|
-
const
|
|
4003
|
-
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath,
|
|
3974
|
+
function N({ errorPath: y }, { instancePath: _ }) {
|
|
3975
|
+
const $ = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
3976
|
+
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, $)];
|
|
4004
3977
|
}
|
|
4005
|
-
function R({ keyword:
|
|
4006
|
-
let I =
|
|
4007
|
-
return
|
|
3978
|
+
function R({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: $, parentSchema: P }) {
|
|
3979
|
+
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
3980
|
+
return $ && (I = (0, t.str)`${I}${(0, r.getErrorPath)($, r.Type.Str)}`), [p.schemaPath, I];
|
|
4008
3981
|
}
|
|
4009
|
-
function
|
|
4010
|
-
const { keyword: I, data: D, schemaValue: w, it: k } =
|
|
4011
|
-
|
|
3982
|
+
function T(y, { params: _, message: $ }, P) {
|
|
3983
|
+
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = k;
|
|
3984
|
+
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof $ == "function" ? $(y) : $]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && P.push([p.propertyName, V]);
|
|
4012
3985
|
}
|
|
4013
3986
|
})(errors);
|
|
4014
3987
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4084,51 +4057,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4084
4057
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4085
4058
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4086
4059
|
var o;
|
|
4087
|
-
(function(
|
|
4088
|
-
|
|
4060
|
+
(function(P) {
|
|
4061
|
+
P[P.Correct = 0] = "Correct", P[P.Wrong = 1] = "Wrong";
|
|
4089
4062
|
})(o = e.DataType || (e.DataType = {}));
|
|
4090
|
-
function l(
|
|
4091
|
-
const I = d(
|
|
4063
|
+
function l(P) {
|
|
4064
|
+
const I = d(P.type);
|
|
4092
4065
|
if (I.includes("null")) {
|
|
4093
|
-
if (
|
|
4066
|
+
if (P.nullable === !1)
|
|
4094
4067
|
throw new Error("type: null contradicts nullable: false");
|
|
4095
4068
|
} else {
|
|
4096
|
-
if (!I.length &&
|
|
4069
|
+
if (!I.length && P.nullable !== void 0)
|
|
4097
4070
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4098
|
-
|
|
4071
|
+
P.nullable === !0 && I.push("null");
|
|
4099
4072
|
}
|
|
4100
4073
|
return I;
|
|
4101
4074
|
}
|
|
4102
4075
|
e.getSchemaTypes = l;
|
|
4103
|
-
function d(
|
|
4104
|
-
const I = Array.isArray(
|
|
4076
|
+
function d(P) {
|
|
4077
|
+
const I = Array.isArray(P) ? P : P ? [P] : [];
|
|
4105
4078
|
if (I.every(t.isJSONType))
|
|
4106
4079
|
return I;
|
|
4107
4080
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4108
4081
|
}
|
|
4109
4082
|
e.getJSONTypes = d;
|
|
4110
|
-
function u(
|
|
4111
|
-
const { gen: D, data: w, opts: k } =
|
|
4083
|
+
function u(P, I) {
|
|
4084
|
+
const { gen: D, data: w, opts: k } = P, A = g(I, k.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
|
|
4112
4085
|
if (V) {
|
|
4113
|
-
const x =
|
|
4086
|
+
const x = T(I, w, k.strictNumbers, o.Wrong);
|
|
4114
4087
|
D.if(x, () => {
|
|
4115
|
-
A.length ? O(
|
|
4088
|
+
A.length ? O(P, I, A) : _(P);
|
|
4116
4089
|
});
|
|
4117
4090
|
}
|
|
4118
4091
|
return V;
|
|
4119
4092
|
}
|
|
4120
4093
|
e.coerceAndCheckDataType = u;
|
|
4121
4094
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4122
|
-
function
|
|
4123
|
-
return I ?
|
|
4095
|
+
function g(P, I) {
|
|
4096
|
+
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4124
4097
|
}
|
|
4125
|
-
function O(
|
|
4126
|
-
const { gen: w, data: k, opts: A } =
|
|
4127
|
-
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(
|
|
4098
|
+
function O(P, I, D) {
|
|
4099
|
+
const { gen: w, data: k, opts: A } = P, V = w.let("dataType", (0, s._)`typeof ${k}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4100
|
+
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(T(I, k, A.strictNumbers), () => w.assign(x, k))), w.if((0, s._)`${x} !== undefined`);
|
|
4128
4101
|
for (const K of D)
|
|
4129
4102
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4130
|
-
w.else(),
|
|
4131
|
-
w.assign(k, x), N(
|
|
4103
|
+
w.else(), _(P), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4104
|
+
w.assign(k, x), N(P, x);
|
|
4132
4105
|
});
|
|
4133
4106
|
function re(K) {
|
|
4134
4107
|
switch (K) {
|
|
@@ -4155,13 +4128,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4155
4128
|
}
|
|
4156
4129
|
}
|
|
4157
4130
|
}
|
|
4158
|
-
function N({ gen:
|
|
4159
|
-
|
|
4131
|
+
function N({ gen: P, parentData: I, parentDataProperty: D }, w) {
|
|
4132
|
+
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
|
|
4160
4133
|
}
|
|
4161
|
-
function R(
|
|
4134
|
+
function R(P, I, D, w = o.Correct) {
|
|
4162
4135
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4163
4136
|
let A;
|
|
4164
|
-
switch (
|
|
4137
|
+
switch (P) {
|
|
4165
4138
|
case "null":
|
|
4166
4139
|
return (0, s._)`${I} ${k} null`;
|
|
4167
4140
|
case "array":
|
|
@@ -4177,7 +4150,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4177
4150
|
A = V();
|
|
4178
4151
|
break;
|
|
4179
4152
|
default:
|
|
4180
|
-
return (0, s._)`typeof ${I} ${k} ${
|
|
4153
|
+
return (0, s._)`typeof ${I} ${k} ${P}`;
|
|
4181
4154
|
}
|
|
4182
4155
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4183
4156
|
function V(x = s.nil) {
|
|
@@ -4185,11 +4158,11 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4185
4158
|
}
|
|
4186
4159
|
}
|
|
4187
4160
|
e.checkDataType = R;
|
|
4188
|
-
function
|
|
4189
|
-
if (
|
|
4190
|
-
return R(
|
|
4161
|
+
function T(P, I, D, w) {
|
|
4162
|
+
if (P.length === 1)
|
|
4163
|
+
return R(P[0], I, D, w);
|
|
4191
4164
|
let k;
|
|
4192
|
-
const A = (0, i.toHash)(
|
|
4165
|
+
const A = (0, i.toHash)(P);
|
|
4193
4166
|
if (A.array && A.object) {
|
|
4194
4167
|
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4195
4168
|
k = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
@@ -4200,18 +4173,18 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4200
4173
|
k = (0, s.and)(k, R(V, I, D, w));
|
|
4201
4174
|
return k;
|
|
4202
4175
|
}
|
|
4203
|
-
e.checkDataTypes =
|
|
4204
|
-
const
|
|
4205
|
-
message: ({ schema:
|
|
4206
|
-
params: ({ schema:
|
|
4176
|
+
e.checkDataTypes = T;
|
|
4177
|
+
const y = {
|
|
4178
|
+
message: ({ schema: P }) => `must be ${P}`,
|
|
4179
|
+
params: ({ schema: P, schemaValue: I }) => typeof P == "string" ? (0, s._)`{type: ${P}}` : (0, s._)`{type: ${I}}`
|
|
4207
4180
|
};
|
|
4208
|
-
function
|
|
4209
|
-
const I =
|
|
4210
|
-
(0, n.reportError)(I,
|
|
4181
|
+
function _(P) {
|
|
4182
|
+
const I = $(P);
|
|
4183
|
+
(0, n.reportError)(I, y);
|
|
4211
4184
|
}
|
|
4212
|
-
e.reportTypeError =
|
|
4213
|
-
function
|
|
4214
|
-
const { gen: I, data: D, schema: w } =
|
|
4185
|
+
e.reportTypeError = _;
|
|
4186
|
+
function $(P) {
|
|
4187
|
+
const { gen: I, data: D, schema: w } = P, k = (0, i.schemaRefOrVal)(P, w, "type");
|
|
4215
4188
|
return {
|
|
4216
4189
|
gen: I,
|
|
4217
4190
|
keyword: "type",
|
|
@@ -4221,7 +4194,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4221
4194
|
schemaValue: k,
|
|
4222
4195
|
parentSchema: w,
|
|
4223
4196
|
params: {},
|
|
4224
|
-
it:
|
|
4197
|
+
it: P
|
|
4225
4198
|
};
|
|
4226
4199
|
}
|
|
4227
4200
|
})(dataType);
|
|
@@ -4300,14 +4273,14 @@ function schemaProperties(e, t) {
|
|
|
4300
4273
|
}
|
|
4301
4274
|
code.schemaProperties = schemaProperties;
|
|
4302
4275
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, l, d, u) {
|
|
4303
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4276
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, g = [
|
|
4304
4277
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4305
4278
|
[names_1$5.default.parentData, o.parentData],
|
|
4306
4279
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4307
4280
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4308
4281
|
];
|
|
4309
|
-
o.opts.dynamicRef &&
|
|
4310
|
-
const O = (0, codegen_1$q._)`${p}, ${r.object(
|
|
4282
|
+
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4283
|
+
const O = (0, codegen_1$q._)`${p}, ${r.object(...g)}`;
|
|
4311
4284
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${O})` : (0, codegen_1$q._)`${l}(${O})`;
|
|
4312
4285
|
}
|
|
4313
4286
|
code.callValidateCode = callValidateCode;
|
|
@@ -4377,31 +4350,31 @@ function funcKeywordCode(e, t) {
|
|
|
4377
4350
|
var r;
|
|
4378
4351
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4379
4352
|
checkAsyncKeyword(d, t);
|
|
4380
|
-
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4381
|
-
e.block$data(
|
|
4353
|
+
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), g = n.let("valid");
|
|
4354
|
+
e.block$data(g, O), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4382
4355
|
function O() {
|
|
4383
4356
|
if (t.errors === !1)
|
|
4384
|
-
|
|
4357
|
+
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
4385
4358
|
else {
|
|
4386
|
-
const
|
|
4387
|
-
t.modifying && modifyData(e),
|
|
4359
|
+
const _ = t.async ? N() : R();
|
|
4360
|
+
t.modifying && modifyData(e), y(() => addErrs(e, _));
|
|
4388
4361
|
}
|
|
4389
4362
|
}
|
|
4390
4363
|
function N() {
|
|
4391
|
-
const
|
|
4392
|
-
return n.try(() =>
|
|
4364
|
+
const _ = n.let("ruleErrs", null);
|
|
4365
|
+
return n.try(() => T((0, codegen_1$p._)`await `), ($) => n.assign(g, !1).if((0, codegen_1$p._)`${$} instanceof ${d.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${$}.errors`), () => n.throw($))), _;
|
|
4393
4366
|
}
|
|
4394
4367
|
function R() {
|
|
4395
|
-
const
|
|
4396
|
-
return n.assign(
|
|
4368
|
+
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4369
|
+
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4397
4370
|
}
|
|
4398
|
-
function
|
|
4399
|
-
const
|
|
4400
|
-
n.assign(
|
|
4371
|
+
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4372
|
+
const $ = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !l || t.schema === !1);
|
|
4373
|
+
n.assign(g, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, p, $, P)}`, t.modifying);
|
|
4401
4374
|
}
|
|
4402
|
-
function
|
|
4403
|
-
var
|
|
4404
|
-
n.if((0, codegen_1$p.not)((
|
|
4375
|
+
function y(_) {
|
|
4376
|
+
var $;
|
|
4377
|
+
n.if((0, codegen_1$p.not)(($ = t.valid) !== null && $ !== void 0 ? $ : g), _);
|
|
4405
4378
|
}
|
|
4406
4379
|
}
|
|
4407
4380
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4480,8 +4453,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4480
4453
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4481
4454
|
const { gen: l } = t;
|
|
4482
4455
|
if (r !== void 0) {
|
|
4483
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4484
|
-
d(O), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4456
|
+
const { errorPath: u, dataPathArr: p, opts: g } = t, O = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4457
|
+
d(O), 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];
|
|
4485
4458
|
}
|
|
4486
4459
|
if (s !== void 0) {
|
|
4487
4460
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4586,17 +4559,17 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4586
4559
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4587
4560
|
t(n, s, i, o, l, d, u);
|
|
4588
4561
|
for (var p in n) {
|
|
4589
|
-
var
|
|
4590
|
-
if (Array.isArray(
|
|
4562
|
+
var g = n[p];
|
|
4563
|
+
if (Array.isArray(g)) {
|
|
4591
4564
|
if (p in traverse$1.arrayKeywords)
|
|
4592
|
-
for (var O = 0; O <
|
|
4593
|
-
_traverse(e, t, r,
|
|
4565
|
+
for (var O = 0; O < g.length; O++)
|
|
4566
|
+
_traverse(e, t, r, g[O], s + "/" + p + "/" + O, i, s, p, n, O);
|
|
4594
4567
|
} else if (p in traverse$1.propsKeywords) {
|
|
4595
|
-
if (
|
|
4596
|
-
for (var N in
|
|
4597
|
-
_traverse(e, t, r,
|
|
4568
|
+
if (g && typeof g == "object")
|
|
4569
|
+
for (var N in g)
|
|
4570
|
+
_traverse(e, t, r, g[N], s + "/" + p + "/" + escapeJsonPtr(N), i, s, p, n, N);
|
|
4598
4571
|
} else
|
|
4599
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4572
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, g, s + "/" + p, i, s, p, n);
|
|
4600
4573
|
}
|
|
4601
4574
|
r(n, s, i, o, l, d, u);
|
|
4602
4575
|
}
|
|
@@ -4680,34 +4653,34 @@ function getSchemaRefs(e, t) {
|
|
|
4680
4653
|
if (typeof e == "boolean")
|
|
4681
4654
|
return {};
|
|
4682
4655
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4683
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4656
|
+
return traverse(e, { allKeys: !0 }, (g, O, N, R) => {
|
|
4684
4657
|
if (R === void 0)
|
|
4685
4658
|
return;
|
|
4686
|
-
const
|
|
4687
|
-
let
|
|
4688
|
-
typeof
|
|
4689
|
-
function
|
|
4659
|
+
const T = o + O;
|
|
4660
|
+
let y = i[R];
|
|
4661
|
+
typeof g[r] == "string" && (y = _.call(this, g[r])), $.call(this, g.$anchor), $.call(this, g.$dynamicAnchor), i[O] = y;
|
|
4662
|
+
function _(P) {
|
|
4690
4663
|
const I = this.opts.uriResolver.resolve;
|
|
4691
|
-
if (
|
|
4692
|
-
throw p(
|
|
4693
|
-
d.add(
|
|
4694
|
-
let D = this.refs[
|
|
4695
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4696
|
-
}
|
|
4697
|
-
function
|
|
4698
|
-
if (typeof
|
|
4699
|
-
if (!ANCHOR.test(
|
|
4700
|
-
throw new Error(`invalid anchor "${
|
|
4701
|
-
|
|
4664
|
+
if (P = normalizeId(y ? I(y, P) : P), d.has(P))
|
|
4665
|
+
throw p(P);
|
|
4666
|
+
d.add(P);
|
|
4667
|
+
let D = this.refs[P];
|
|
4668
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(g, D.schema, P) : P !== normalizeId(T) && (P[0] === "#" ? (u(g, l[P], P), l[P] = g) : this.refs[P] = T), P;
|
|
4669
|
+
}
|
|
4670
|
+
function $(P) {
|
|
4671
|
+
if (typeof P == "string") {
|
|
4672
|
+
if (!ANCHOR.test(P))
|
|
4673
|
+
throw new Error(`invalid anchor "${P}"`);
|
|
4674
|
+
_.call(this, `#${P}`);
|
|
4702
4675
|
}
|
|
4703
4676
|
}
|
|
4704
4677
|
}), l;
|
|
4705
|
-
function u(
|
|
4706
|
-
if (O !== void 0 && !equal$2(
|
|
4678
|
+
function u(g, O, N) {
|
|
4679
|
+
if (O !== void 0 && !equal$2(g, O))
|
|
4707
4680
|
throw p(N);
|
|
4708
4681
|
}
|
|
4709
|
-
function p(
|
|
4710
|
-
return new Error(`reference "${
|
|
4682
|
+
function p(g) {
|
|
4683
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4711
4684
|
}
|
|
4712
4685
|
}
|
|
4713
4686
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4824,10 +4797,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4824
4797
|
}
|
|
4825
4798
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4826
4799
|
for (const O of p.rules)
|
|
4827
|
-
|
|
4828
|
-
|
|
4800
|
+
g(O);
|
|
4801
|
+
g(p.post);
|
|
4829
4802
|
});
|
|
4830
|
-
function
|
|
4803
|
+
function g(O) {
|
|
4831
4804
|
(0, applicability_1.shouldUseGroup)(i, O) && (O.type ? (s.if((0, dataType_2.checkDataType)(O.type, o, d.strictNumbers)), iterateKeywords(e, O), t.length === 1 && t[0] === O.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, O), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4832
4805
|
}
|
|
4833
4806
|
}
|
|
@@ -5090,21 +5063,21 @@ function compileSchema(e) {
|
|
|
5090
5063
|
let p;
|
|
5091
5064
|
try {
|
|
5092
5065
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5093
|
-
const
|
|
5094
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5066
|
+
const g = o.toString();
|
|
5067
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${g}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5095
5068
|
const N = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5096
|
-
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode:
|
|
5097
|
-
const { props: R, items:
|
|
5069
|
+
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode: g, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5070
|
+
const { props: R, items: T } = u;
|
|
5098
5071
|
N.evaluated = {
|
|
5099
5072
|
props: R instanceof codegen_1$m.Name ? void 0 : R,
|
|
5100
|
-
items:
|
|
5073
|
+
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5101
5074
|
dynamicProps: R instanceof codegen_1$m.Name,
|
|
5102
|
-
dynamicItems:
|
|
5075
|
+
dynamicItems: T instanceof codegen_1$m.Name
|
|
5103
5076
|
}, N.source && (N.source.evaluated = (0, codegen_1$m.stringify)(N.evaluated));
|
|
5104
5077
|
}
|
|
5105
5078
|
return e.validate = N, e;
|
|
5106
|
-
} catch (
|
|
5107
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5079
|
+
} catch (g) {
|
|
5080
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), g;
|
|
5108
5081
|
} finally {
|
|
5109
5082
|
this._compilations.delete(e);
|
|
5110
5083
|
}
|
|
@@ -5221,13 +5194,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5221
5194
|
n(t);
|
|
5222
5195
|
})(commonjsGlobal, function(r) {
|
|
5223
5196
|
function n() {
|
|
5224
|
-
for (var f = arguments.length, c = Array(f),
|
|
5225
|
-
c[
|
|
5197
|
+
for (var f = arguments.length, c = Array(f), m = 0; m < f; m++)
|
|
5198
|
+
c[m] = arguments[m];
|
|
5226
5199
|
if (c.length > 1) {
|
|
5227
5200
|
c[0] = c[0].slice(0, -1);
|
|
5228
|
-
for (var
|
|
5229
|
-
c[
|
|
5230
|
-
return c[
|
|
5201
|
+
for (var S = c.length - 1, E = 1; E < S; ++E)
|
|
5202
|
+
c[E] = c[E].slice(1, -1);
|
|
5203
|
+
return c[S] = c[S].slice(1), c.join("");
|
|
5231
5204
|
} else
|
|
5232
5205
|
return c[0];
|
|
5233
5206
|
}
|
|
@@ -5244,20 +5217,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5244
5217
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5245
5218
|
}
|
|
5246
5219
|
function d(f, c) {
|
|
5247
|
-
var
|
|
5220
|
+
var m = f;
|
|
5248
5221
|
if (c)
|
|
5249
|
-
for (var
|
|
5250
|
-
|
|
5251
|
-
return
|
|
5222
|
+
for (var S in c)
|
|
5223
|
+
m[S] = c[S];
|
|
5224
|
+
return m;
|
|
5252
5225
|
}
|
|
5253
5226
|
function u(f) {
|
|
5254
|
-
var c = "[A-Za-z]",
|
|
5255
|
-
s(c + n(c,
|
|
5256
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5257
|
-
s("[vV]" +
|
|
5258
|
-
var ct = s(
|
|
5259
|
-
return s(s(
|
|
5260
|
-
NOT_SCHEME: new RegExp(n("[^]", c,
|
|
5227
|
+
var c = "[A-Za-z]", m = "[0-9]", S = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + S + "%" + S + S + "%" + S + S) + "|" + s("%[89A-Fa-f]" + S + "%" + S + S) + "|" + s("%" + S + S)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5228
|
+
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, L, "[\\:]")) + "*");
|
|
5229
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), z = s(S + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), ge = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), $e = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Se, ge, $e, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + E) + "+");
|
|
5230
|
+
s("[vV]" + S + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5231
|
+
var ct = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5232
|
+
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5233
|
+
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5261
5234
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5262
5235
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5263
5236
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
@@ -5267,123 +5240,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5267
5240
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5268
5241
|
UNRESERVED: new RegExp(B, "g"),
|
|
5269
5242
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5270
|
-
PCT_ENCODED: new RegExp(
|
|
5243
|
+
PCT_ENCODED: new RegExp(E, "g"),
|
|
5271
5244
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5272
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5245
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + S + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5273
5246
|
//RFC 6874, with relaxed parsing rules
|
|
5274
5247
|
};
|
|
5275
5248
|
}
|
|
5276
|
-
var p = u(!1),
|
|
5277
|
-
function f(c,
|
|
5278
|
-
var
|
|
5249
|
+
var p = u(!1), g = u(!0), O = function() {
|
|
5250
|
+
function f(c, m) {
|
|
5251
|
+
var S = [], E = !0, U = !1, L = void 0;
|
|
5279
5252
|
try {
|
|
5280
|
-
for (var J = c[Symbol.iterator](), Y; !(
|
|
5253
|
+
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (S.push(Y.value), !(m && S.length === m)); E = !0)
|
|
5281
5254
|
;
|
|
5282
5255
|
} catch (se) {
|
|
5283
5256
|
U = !0, L = se;
|
|
5284
5257
|
} finally {
|
|
5285
5258
|
try {
|
|
5286
|
-
!
|
|
5259
|
+
!E && J.return && J.return();
|
|
5287
5260
|
} finally {
|
|
5288
5261
|
if (U)
|
|
5289
5262
|
throw L;
|
|
5290
5263
|
}
|
|
5291
5264
|
}
|
|
5292
|
-
return
|
|
5265
|
+
return S;
|
|
5293
5266
|
}
|
|
5294
|
-
return function(c,
|
|
5267
|
+
return function(c, m) {
|
|
5295
5268
|
if (Array.isArray(c))
|
|
5296
5269
|
return c;
|
|
5297
5270
|
if (Symbol.iterator in Object(c))
|
|
5298
|
-
return f(c,
|
|
5271
|
+
return f(c, m);
|
|
5299
5272
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5300
5273
|
};
|
|
5301
5274
|
}(), N = function(f) {
|
|
5302
5275
|
if (Array.isArray(f)) {
|
|
5303
|
-
for (var c = 0,
|
|
5304
|
-
|
|
5305
|
-
return
|
|
5276
|
+
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5277
|
+
m[c] = f[c];
|
|
5278
|
+
return m;
|
|
5306
5279
|
} else
|
|
5307
5280
|
return Array.from(f);
|
|
5308
|
-
}, R = 2147483647,
|
|
5281
|
+
}, R = 2147483647, T = 36, y = 1, _ = 26, $ = 38, P = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5309
5282
|
overflow: "Overflow: input needs wider integers to process",
|
|
5310
5283
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5311
5284
|
"invalid-input": "Invalid input"
|
|
5312
|
-
}, re =
|
|
5285
|
+
}, re = T - y, K = Math.floor, ue = String.fromCharCode;
|
|
5313
5286
|
function oe(f) {
|
|
5314
5287
|
throw new RangeError(x[f]);
|
|
5315
5288
|
}
|
|
5316
5289
|
function ke(f, c) {
|
|
5317
|
-
for (var
|
|
5318
|
-
|
|
5319
|
-
return
|
|
5290
|
+
for (var m = [], S = f.length; S--; )
|
|
5291
|
+
m[S] = c(f[S]);
|
|
5292
|
+
return m;
|
|
5320
5293
|
}
|
|
5321
|
-
function
|
|
5322
|
-
var
|
|
5323
|
-
|
|
5324
|
-
var
|
|
5325
|
-
return
|
|
5294
|
+
function Ce(f, c) {
|
|
5295
|
+
var m = f.split("@"), S = "";
|
|
5296
|
+
m.length > 1 && (S = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5297
|
+
var E = f.split("."), U = ke(E, c).join(".");
|
|
5298
|
+
return S + U;
|
|
5326
5299
|
}
|
|
5327
5300
|
function qe(f) {
|
|
5328
|
-
for (var c = [],
|
|
5329
|
-
var
|
|
5330
|
-
if (
|
|
5331
|
-
var U = f.charCodeAt(
|
|
5332
|
-
(U & 64512) == 56320 ? c.push(((
|
|
5301
|
+
for (var c = [], m = 0, S = f.length; m < S; ) {
|
|
5302
|
+
var E = f.charCodeAt(m++);
|
|
5303
|
+
if (E >= 55296 && E <= 56319 && m < S) {
|
|
5304
|
+
var U = f.charCodeAt(m++);
|
|
5305
|
+
(U & 64512) == 56320 ? c.push(((E & 1023) << 10) + (U & 1023) + 65536) : (c.push(E), m--);
|
|
5333
5306
|
} else
|
|
5334
|
-
c.push(
|
|
5307
|
+
c.push(E);
|
|
5335
5308
|
}
|
|
5336
5309
|
return c;
|
|
5337
5310
|
}
|
|
5338
5311
|
var et = function(c) {
|
|
5339
5312
|
return String.fromCodePoint.apply(String, N(c));
|
|
5340
5313
|
}, Ue = function(c) {
|
|
5341
|
-
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 :
|
|
5342
|
-
}, F = function(c,
|
|
5343
|
-
return c + 22 + 75 * (c < 26) - ((
|
|
5344
|
-
},
|
|
5345
|
-
var
|
|
5314
|
+
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5315
|
+
}, F = function(c, m) {
|
|
5316
|
+
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5317
|
+
}, v = function(c, m, S) {
|
|
5318
|
+
var E = 0;
|
|
5346
5319
|
for (
|
|
5347
|
-
c =
|
|
5320
|
+
c = S ? K(c / P) : c >> 1, c += K(c / m);
|
|
5348
5321
|
/* no initialization */
|
|
5349
|
-
c > re *
|
|
5350
|
-
|
|
5322
|
+
c > re * _ >> 1;
|
|
5323
|
+
E += T
|
|
5351
5324
|
)
|
|
5352
5325
|
c = K(c / re);
|
|
5353
|
-
return K(
|
|
5326
|
+
return K(E + (re + 1) * c / (c + $));
|
|
5354
5327
|
}, j = function(c) {
|
|
5355
|
-
var
|
|
5328
|
+
var m = [], S = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5356
5329
|
J < 0 && (J = 0);
|
|
5357
5330
|
for (var Y = 0; Y < J; ++Y)
|
|
5358
|
-
c.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5359
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5331
|
+
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Y));
|
|
5332
|
+
for (var se = J > 0 ? J + 1 : 0; se < S; ) {
|
|
5360
5333
|
for (
|
|
5361
|
-
var B =
|
|
5334
|
+
var B = E, Z = 1, ie = T;
|
|
5362
5335
|
;
|
|
5363
5336
|
/* no condition */
|
|
5364
|
-
ie +=
|
|
5337
|
+
ie += T
|
|
5365
5338
|
) {
|
|
5366
|
-
se >=
|
|
5339
|
+
se >= S && oe("invalid-input");
|
|
5367
5340
|
var z = Ue(c.charCodeAt(se++));
|
|
5368
|
-
(z >=
|
|
5369
|
-
var X = ie <= L ?
|
|
5341
|
+
(z >= T || z > K((R - E) / Z)) && oe("overflow"), E += z * Z;
|
|
5342
|
+
var X = ie <= L ? y : ie >= L + _ ? _ : ie - L;
|
|
5370
5343
|
if (z < X)
|
|
5371
5344
|
break;
|
|
5372
|
-
var ae =
|
|
5345
|
+
var ae = T - X;
|
|
5373
5346
|
Z > K(R / ae) && oe("overflow"), Z *= ae;
|
|
5374
5347
|
}
|
|
5375
|
-
var ee =
|
|
5376
|
-
L =
|
|
5348
|
+
var ee = m.length + 1;
|
|
5349
|
+
L = v(E - B, ee, B == 0), K(E / ee) > R - U && oe("overflow"), U += K(E / ee), E %= ee, m.splice(E++, 0, U);
|
|
5377
5350
|
}
|
|
5378
|
-
return String.fromCodePoint.apply(String,
|
|
5379
|
-
},
|
|
5380
|
-
var
|
|
5351
|
+
return String.fromCodePoint.apply(String, m);
|
|
5352
|
+
}, b = function(c) {
|
|
5353
|
+
var m = [];
|
|
5381
5354
|
c = qe(c);
|
|
5382
|
-
var
|
|
5355
|
+
var S = c.length, E = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5383
5356
|
try {
|
|
5384
5357
|
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5385
5358
|
var ie = Z.value;
|
|
5386
|
-
ie < 128 &&
|
|
5359
|
+
ie < 128 && m.push(ue(ie));
|
|
5387
5360
|
}
|
|
5388
5361
|
} catch (lt) {
|
|
5389
5362
|
Y = !0, se = lt;
|
|
@@ -5395,44 +5368,44 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5395
5368
|
throw se;
|
|
5396
5369
|
}
|
|
5397
5370
|
}
|
|
5398
|
-
var z =
|
|
5399
|
-
for (z &&
|
|
5400
|
-
var ae = R, ee = !0, Se = !1,
|
|
5371
|
+
var z = m.length, X = z;
|
|
5372
|
+
for (z && m.push(w); X < S; ) {
|
|
5373
|
+
var ae = R, ee = !0, Se = !1, ge = void 0;
|
|
5401
5374
|
try {
|
|
5402
|
-
for (var
|
|
5375
|
+
for (var $e = c[Symbol.iterator](), Be; !(ee = (Be = $e.next()).done); ee = !0) {
|
|
5403
5376
|
var Ie = Be.value;
|
|
5404
|
-
Ie >=
|
|
5377
|
+
Ie >= E && Ie < ae && (ae = Ie);
|
|
5405
5378
|
}
|
|
5406
5379
|
} catch (lt) {
|
|
5407
|
-
Se = !0,
|
|
5380
|
+
Se = !0, ge = lt;
|
|
5408
5381
|
} finally {
|
|
5409
5382
|
try {
|
|
5410
|
-
!ee &&
|
|
5383
|
+
!ee && $e.return && $e.return();
|
|
5411
5384
|
} finally {
|
|
5412
5385
|
if (Se)
|
|
5413
|
-
throw
|
|
5386
|
+
throw ge;
|
|
5414
5387
|
}
|
|
5415
5388
|
}
|
|
5416
5389
|
var fe = X + 1;
|
|
5417
|
-
ae -
|
|
5390
|
+
ae - E > K((R - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5418
5391
|
var ye = !0, je = !1, we = void 0;
|
|
5419
5392
|
try {
|
|
5420
5393
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5421
5394
|
var Ht = Lt.value;
|
|
5422
|
-
if (Ht <
|
|
5395
|
+
if (Ht < E && ++U > R && oe("overflow"), Ht == E) {
|
|
5423
5396
|
for (
|
|
5424
|
-
var pt = U, ft =
|
|
5397
|
+
var pt = U, ft = T;
|
|
5425
5398
|
;
|
|
5426
5399
|
/* no condition */
|
|
5427
|
-
ft +=
|
|
5400
|
+
ft += T
|
|
5428
5401
|
) {
|
|
5429
|
-
var ht = ft <= L ?
|
|
5402
|
+
var ht = ft <= L ? y : ft >= L + _ ? _ : ft - L;
|
|
5430
5403
|
if (pt < ht)
|
|
5431
5404
|
break;
|
|
5432
|
-
var Vt = pt - ht, zt =
|
|
5433
|
-
|
|
5405
|
+
var Vt = pt - ht, zt = T - ht;
|
|
5406
|
+
m.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5434
5407
|
}
|
|
5435
|
-
|
|
5408
|
+
m.push(ue(F(pt, 0))), L = v(U, fe, X == z), U = 0, ++X;
|
|
5436
5409
|
}
|
|
5437
5410
|
}
|
|
5438
5411
|
} catch (lt) {
|
|
@@ -5445,16 +5418,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5445
5418
|
throw we;
|
|
5446
5419
|
}
|
|
5447
5420
|
}
|
|
5448
|
-
++U, ++
|
|
5421
|
+
++U, ++E;
|
|
5449
5422
|
}
|
|
5450
|
-
return
|
|
5423
|
+
return m.join("");
|
|
5451
5424
|
}, a = function(c) {
|
|
5452
|
-
return
|
|
5453
|
-
return k.test(
|
|
5425
|
+
return Ce(c, function(m) {
|
|
5426
|
+
return k.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5454
5427
|
});
|
|
5455
5428
|
}, h = function(c) {
|
|
5456
|
-
return
|
|
5457
|
-
return A.test(
|
|
5429
|
+
return Ce(c, function(m) {
|
|
5430
|
+
return A.test(m) ? "xn--" + b(m) : m;
|
|
5458
5431
|
});
|
|
5459
5432
|
}, C = {
|
|
5460
5433
|
/**
|
|
@@ -5475,56 +5448,56 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5475
5448
|
encode: et
|
|
5476
5449
|
},
|
|
5477
5450
|
decode: j,
|
|
5478
|
-
encode:
|
|
5451
|
+
encode: b,
|
|
5479
5452
|
toASCII: h,
|
|
5480
5453
|
toUnicode: a
|
|
5481
5454
|
}, M = {};
|
|
5482
5455
|
function q(f) {
|
|
5483
|
-
var c = f.charCodeAt(0),
|
|
5484
|
-
return c < 16 ?
|
|
5456
|
+
var c = f.charCodeAt(0), m = void 0;
|
|
5457
|
+
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5485
5458
|
}
|
|
5486
5459
|
function W(f) {
|
|
5487
|
-
for (var c = "",
|
|
5488
|
-
var
|
|
5489
|
-
if (
|
|
5490
|
-
c += String.fromCharCode(
|
|
5491
|
-
else if (
|
|
5492
|
-
if (
|
|
5493
|
-
var U = parseInt(f.substr(
|
|
5494
|
-
c += String.fromCharCode((
|
|
5460
|
+
for (var c = "", m = 0, S = f.length; m < S; ) {
|
|
5461
|
+
var E = parseInt(f.substr(m + 1, 2), 16);
|
|
5462
|
+
if (E < 128)
|
|
5463
|
+
c += String.fromCharCode(E), m += 3;
|
|
5464
|
+
else if (E >= 194 && E < 224) {
|
|
5465
|
+
if (S - m >= 6) {
|
|
5466
|
+
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5467
|
+
c += String.fromCharCode((E & 31) << 6 | U & 63);
|
|
5495
5468
|
} else
|
|
5496
|
-
c += f.substr(
|
|
5497
|
-
|
|
5498
|
-
} else if (
|
|
5499
|
-
if (
|
|
5500
|
-
var L = parseInt(f.substr(
|
|
5501
|
-
c += String.fromCharCode((
|
|
5469
|
+
c += f.substr(m, 6);
|
|
5470
|
+
m += 6;
|
|
5471
|
+
} else if (E >= 224) {
|
|
5472
|
+
if (S - m >= 9) {
|
|
5473
|
+
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5474
|
+
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5502
5475
|
} else
|
|
5503
|
-
c += f.substr(
|
|
5504
|
-
|
|
5476
|
+
c += f.substr(m, 9);
|
|
5477
|
+
m += 9;
|
|
5505
5478
|
} else
|
|
5506
|
-
c += f.substr(
|
|
5479
|
+
c += f.substr(m, 3), m += 3;
|
|
5507
5480
|
}
|
|
5508
5481
|
return c;
|
|
5509
5482
|
}
|
|
5510
5483
|
function G(f, c) {
|
|
5511
|
-
function
|
|
5512
|
-
var
|
|
5513
|
-
return
|
|
5484
|
+
function m(S) {
|
|
5485
|
+
var E = W(S);
|
|
5486
|
+
return E.match(c.UNRESERVED) ? E : S;
|
|
5514
5487
|
}
|
|
5515
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED,
|
|
5488
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(c.PCT_ENCODED, m).replace(f.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, o)), f;
|
|
5516
5489
|
}
|
|
5517
5490
|
function ne(f) {
|
|
5518
5491
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5519
5492
|
}
|
|
5520
5493
|
function he(f, c) {
|
|
5521
|
-
var
|
|
5522
|
-
return
|
|
5494
|
+
var m = f.match(c.IPV4ADDRESS) || [], S = O(m, 2), E = S[1];
|
|
5495
|
+
return E ? E.split(".").map(ne).join(".") : f;
|
|
5523
5496
|
}
|
|
5524
5497
|
function Le(f, c) {
|
|
5525
|
-
var
|
|
5526
|
-
if (
|
|
5527
|
-
for (var L =
|
|
5498
|
+
var m = f.match(c.IPV6ADDRESS) || [], S = O(m, 3), E = S[1], U = S[2];
|
|
5499
|
+
if (E) {
|
|
5500
|
+
for (var L = E.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Z[Z.length - 1]), z = ie ? 7 : 8, X = Z.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5528
5501
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5529
5502
|
ie && (ae[z - 1] = he(ae[z - 1], c));
|
|
5530
5503
|
var Se = ae.reduce(function(fe, ye, je) {
|
|
@@ -5533,46 +5506,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5533
5506
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5534
5507
|
}
|
|
5535
5508
|
return fe;
|
|
5536
|
-
}, []),
|
|
5509
|
+
}, []), ge = Se.sort(function(fe, ye) {
|
|
5537
5510
|
return ye.length - fe.length;
|
|
5538
|
-
})[0],
|
|
5539
|
-
if (
|
|
5540
|
-
var Be = ae.slice(0,
|
|
5541
|
-
|
|
5511
|
+
})[0], $e = void 0;
|
|
5512
|
+
if (ge && ge.length > 1) {
|
|
5513
|
+
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5514
|
+
$e = Be.join(":") + "::" + Ie.join(":");
|
|
5542
5515
|
} else
|
|
5543
|
-
|
|
5544
|
-
return U && (
|
|
5516
|
+
$e = ae.join(":");
|
|
5517
|
+
return U && ($e += "%" + U), $e;
|
|
5545
5518
|
} else
|
|
5546
5519
|
return f;
|
|
5547
5520
|
}
|
|
5548
5521
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5549
5522
|
function de(f) {
|
|
5550
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5523
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ? g : p;
|
|
5551
5524
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5552
|
-
var
|
|
5553
|
-
if (
|
|
5554
|
-
rt ? (
|
|
5555
|
-
var U = M[(c.scheme ||
|
|
5525
|
+
var E = f.match(tt);
|
|
5526
|
+
if (E) {
|
|
5527
|
+
rt ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? E[3] : void 0, m.host = f.indexOf("//") !== -1 ? E[4] : void 0, m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = f.indexOf("?") !== -1 ? E[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? E[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? E[4] : void 0)), m.host && (m.host = Le(he(m.host, S), S)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5528
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5556
5529
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5557
|
-
if (
|
|
5530
|
+
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5558
5531
|
try {
|
|
5559
|
-
|
|
5532
|
+
m.host = C.toASCII(m.host.replace(S.PCT_ENCODED, W).toLowerCase());
|
|
5560
5533
|
} catch (L) {
|
|
5561
|
-
|
|
5534
|
+
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5562
5535
|
}
|
|
5563
|
-
G(
|
|
5536
|
+
G(m, p);
|
|
5564
5537
|
} else
|
|
5565
|
-
G(
|
|
5566
|
-
U && U.parse && U.parse(
|
|
5538
|
+
G(m, S);
|
|
5539
|
+
U && U.parse && U.parse(m, c);
|
|
5567
5540
|
} else
|
|
5568
|
-
|
|
5569
|
-
return
|
|
5541
|
+
m.error = m.error || "URI can not be parsed.";
|
|
5542
|
+
return m;
|
|
5570
5543
|
}
|
|
5571
5544
|
function nt(f, c) {
|
|
5572
|
-
var
|
|
5573
|
-
return f.userinfo !== void 0 && (
|
|
5545
|
+
var m = c.iri !== !1 ? g : p, S = [];
|
|
5546
|
+
return f.userinfo !== void 0 && (S.push(f.userinfo), S.push("@")), f.host !== void 0 && S.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5574
5547
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5575
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5548
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (S.push(":"), S.push(String(f.port))), S.length ? S.join("") : void 0;
|
|
5576
5549
|
}
|
|
5577
5550
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5578
5551
|
function me(f) {
|
|
@@ -5586,62 +5559,62 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5586
5559
|
else if (f === "." || f === "..")
|
|
5587
5560
|
f = "";
|
|
5588
5561
|
else {
|
|
5589
|
-
var
|
|
5590
|
-
if (
|
|
5591
|
-
var
|
|
5592
|
-
f = f.slice(
|
|
5562
|
+
var m = f.match(st);
|
|
5563
|
+
if (m) {
|
|
5564
|
+
var S = m[0];
|
|
5565
|
+
f = f.slice(S.length), c.push(S);
|
|
5593
5566
|
} else
|
|
5594
5567
|
throw new Error("Unexpected dot segment condition");
|
|
5595
5568
|
}
|
|
5596
5569
|
return c.join("");
|
|
5597
5570
|
}
|
|
5598
5571
|
function le(f) {
|
|
5599
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5600
|
-
if (
|
|
5601
|
-
if (c.domainHost ||
|
|
5572
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? g : p, S = [], E = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5573
|
+
if (E && E.serialize && E.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5574
|
+
if (c.domainHost || E && E.domainHost)
|
|
5602
5575
|
try {
|
|
5603
|
-
f.host = c.iri ? C.toUnicode(f.host) : C.toASCII(f.host.replace(
|
|
5576
|
+
f.host = c.iri ? C.toUnicode(f.host) : C.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5604
5577
|
} catch (J) {
|
|
5605
5578
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5606
5579
|
}
|
|
5607
5580
|
}
|
|
5608
|
-
G(f,
|
|
5581
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (S.push(f.scheme), S.push(":"));
|
|
5609
5582
|
var U = nt(f, c);
|
|
5610
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5583
|
+
if (U !== void 0 && (c.reference !== "suffix" && S.push("//"), S.push(U), f.path && f.path.charAt(0) !== "/" && S.push("/")), f.path !== void 0) {
|
|
5611
5584
|
var L = f.path;
|
|
5612
|
-
!c.absolutePath && (!
|
|
5585
|
+
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), S.push(L);
|
|
5613
5586
|
}
|
|
5614
|
-
return f.query !== void 0 && (
|
|
5587
|
+
return f.query !== void 0 && (S.push("?"), S.push(f.query)), f.fragment !== void 0 && (S.push("#"), S.push(f.fragment)), S.join("");
|
|
5615
5588
|
}
|
|
5616
5589
|
function xe(f, c) {
|
|
5617
|
-
var
|
|
5618
|
-
return
|
|
5590
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, S = arguments[3], E = {};
|
|
5591
|
+
return S || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (E.scheme = c.scheme, E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? E.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + c.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : E.path = c.path, E.path = me(E.path)), E.query = c.query) : (E.path = f.path, c.query !== void 0 ? E.query = c.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = c.fragment, E;
|
|
5619
5592
|
}
|
|
5620
|
-
function it(f, c,
|
|
5621
|
-
var
|
|
5622
|
-
return le(xe(de(f,
|
|
5593
|
+
function it(f, c, m) {
|
|
5594
|
+
var S = d({ scheme: "null" }, m);
|
|
5595
|
+
return le(xe(de(f, S), de(c, S), S, !0), S);
|
|
5623
5596
|
}
|
|
5624
|
-
function
|
|
5597
|
+
function Oe(f, c) {
|
|
5625
5598
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
5626
5599
|
}
|
|
5627
|
-
function ot(f, c,
|
|
5628
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5600
|
+
function ot(f, c, m) {
|
|
5601
|
+
return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : i(c) === "object" && (c = le(c, m)), f === c;
|
|
5629
5602
|
}
|
|
5630
5603
|
function ut(f, c) {
|
|
5631
|
-
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE :
|
|
5604
|
+
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE : g.ESCAPE, q);
|
|
5632
5605
|
}
|
|
5633
5606
|
function pe(f, c) {
|
|
5634
|
-
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED :
|
|
5607
|
+
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED : g.PCT_ENCODED, W);
|
|
5635
5608
|
}
|
|
5636
5609
|
var Ne = {
|
|
5637
5610
|
scheme: "http",
|
|
5638
5611
|
domainHost: !0,
|
|
5639
|
-
parse: function(c,
|
|
5612
|
+
parse: function(c, m) {
|
|
5640
5613
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
5641
5614
|
},
|
|
5642
|
-
serialize: function(c,
|
|
5643
|
-
var
|
|
5644
|
-
return (c.port === (
|
|
5615
|
+
serialize: function(c, m) {
|
|
5616
|
+
var S = String(c.scheme).toLowerCase() === "https";
|
|
5617
|
+
return (c.port === (S ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5645
5618
|
}
|
|
5646
5619
|
}, It = {
|
|
5647
5620
|
scheme: "https",
|
|
@@ -5655,13 +5628,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5655
5628
|
var at = {
|
|
5656
5629
|
scheme: "ws",
|
|
5657
5630
|
domainHost: !0,
|
|
5658
|
-
parse: function(c,
|
|
5659
|
-
var
|
|
5660
|
-
return
|
|
5631
|
+
parse: function(c, m) {
|
|
5632
|
+
var S = c;
|
|
5633
|
+
return S.secure = jt(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S;
|
|
5661
5634
|
},
|
|
5662
|
-
serialize: function(c,
|
|
5635
|
+
serialize: function(c, m) {
|
|
5663
5636
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5664
|
-
var
|
|
5637
|
+
var S = c.resourceName.split("?"), E = O(S, 2), U = E[0], L = E[1];
|
|
5665
5638
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5666
5639
|
}
|
|
5667
5640
|
return c.fragment = void 0, c;
|
|
@@ -5672,100 +5645,100 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5672
5645
|
parse: at.parse,
|
|
5673
5646
|
serialize: at.serialize
|
|
5674
5647
|
}, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
5675
|
-
function
|
|
5648
|
+
function Ot(f) {
|
|
5676
5649
|
var c = W(f);
|
|
5677
5650
|
return c.match(ur) ? c : f;
|
|
5678
5651
|
}
|
|
5679
5652
|
var Mt = {
|
|
5680
5653
|
scheme: "mailto",
|
|
5681
|
-
parse: function(c,
|
|
5682
|
-
var
|
|
5683
|
-
if (
|
|
5684
|
-
for (var U = !1, L = {}, J =
|
|
5654
|
+
parse: function(c, m) {
|
|
5655
|
+
var S = c, E = S.to = S.path ? S.path.split(",") : [];
|
|
5656
|
+
if (S.path = void 0, S.query) {
|
|
5657
|
+
for (var U = !1, L = {}, J = S.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5685
5658
|
var B = J[Y].split("=");
|
|
5686
5659
|
switch (B[0]) {
|
|
5687
5660
|
case "to":
|
|
5688
5661
|
for (var Z = B[1].split(","), ie = 0, z = Z.length; ie < z; ++ie)
|
|
5689
|
-
|
|
5662
|
+
E.push(Z[ie]);
|
|
5690
5663
|
break;
|
|
5691
5664
|
case "subject":
|
|
5692
|
-
|
|
5665
|
+
S.subject = pe(B[1], m);
|
|
5693
5666
|
break;
|
|
5694
5667
|
case "body":
|
|
5695
|
-
|
|
5668
|
+
S.body = pe(B[1], m);
|
|
5696
5669
|
break;
|
|
5697
5670
|
default:
|
|
5698
|
-
U = !0, L[pe(B[0],
|
|
5671
|
+
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
5699
5672
|
break;
|
|
5700
5673
|
}
|
|
5701
5674
|
}
|
|
5702
|
-
U && (
|
|
5675
|
+
U && (S.headers = L);
|
|
5703
5676
|
}
|
|
5704
|
-
|
|
5705
|
-
for (var X = 0, ae =
|
|
5706
|
-
var ee =
|
|
5707
|
-
if (ee[0] = pe(ee[0]),
|
|
5708
|
-
ee[1] = pe(ee[1],
|
|
5677
|
+
S.query = void 0;
|
|
5678
|
+
for (var X = 0, ae = E.length; X < ae; ++X) {
|
|
5679
|
+
var ee = E[X].split("@");
|
|
5680
|
+
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5681
|
+
ee[1] = pe(ee[1], m).toLowerCase();
|
|
5709
5682
|
else
|
|
5710
5683
|
try {
|
|
5711
|
-
ee[1] = C.toASCII(pe(ee[1],
|
|
5684
|
+
ee[1] = C.toASCII(pe(ee[1], m).toLowerCase());
|
|
5712
5685
|
} catch (Se) {
|
|
5713
|
-
|
|
5686
|
+
S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5714
5687
|
}
|
|
5715
|
-
|
|
5688
|
+
E[X] = ee.join("@");
|
|
5716
5689
|
}
|
|
5717
|
-
return
|
|
5690
|
+
return S;
|
|
5718
5691
|
},
|
|
5719
|
-
serialize: function(c,
|
|
5720
|
-
var
|
|
5721
|
-
if (
|
|
5722
|
-
for (var U = 0, L =
|
|
5723
|
-
var J = String(
|
|
5692
|
+
serialize: function(c, m) {
|
|
5693
|
+
var S = c, E = l(c.to);
|
|
5694
|
+
if (E) {
|
|
5695
|
+
for (var U = 0, L = E.length; U < L; ++U) {
|
|
5696
|
+
var J = String(E[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5724
5697
|
try {
|
|
5725
|
-
B =
|
|
5698
|
+
B = m.iri ? C.toUnicode(B) : C.toASCII(pe(B, m).toLowerCase());
|
|
5726
5699
|
} catch (X) {
|
|
5727
|
-
|
|
5700
|
+
S.error = S.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5728
5701
|
}
|
|
5729
|
-
|
|
5702
|
+
E[U] = se + "@" + B;
|
|
5730
5703
|
}
|
|
5731
|
-
|
|
5704
|
+
S.path = E.join(",");
|
|
5732
5705
|
}
|
|
5733
5706
|
var Z = c.headers = c.headers || {};
|
|
5734
5707
|
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5735
5708
|
var ie = [];
|
|
5736
5709
|
for (var z in Z)
|
|
5737
|
-
Z[z] !== ir[z] && ie.push(z.replace(We,
|
|
5738
|
-
return ie.length && (
|
|
5710
|
+
Z[z] !== ir[z] && ie.push(z.replace(We, Ot).replace(We, o).replace(Ft, q) + "=" + Z[z].replace(We, Ot).replace(We, o).replace(fr, q));
|
|
5711
|
+
return ie.length && (S.query = ie.join("&")), S;
|
|
5739
5712
|
}
|
|
5740
5713
|
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5741
5714
|
scheme: "urn",
|
|
5742
|
-
parse: function(c,
|
|
5743
|
-
var
|
|
5744
|
-
if (
|
|
5745
|
-
var U =
|
|
5746
|
-
|
|
5715
|
+
parse: function(c, m) {
|
|
5716
|
+
var S = c.path && c.path.match(hr), E = c;
|
|
5717
|
+
if (S) {
|
|
5718
|
+
var U = m.scheme || E.scheme || "urn", L = S[1].toLowerCase(), J = S[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5719
|
+
E.nid = L, E.nss = J, E.path = void 0, se && (E = se.parse(E, m));
|
|
5747
5720
|
} else
|
|
5748
|
-
|
|
5749
|
-
return
|
|
5721
|
+
E.error = E.error || "URN can not be parsed.";
|
|
5722
|
+
return E;
|
|
5750
5723
|
},
|
|
5751
|
-
serialize: function(c,
|
|
5752
|
-
var
|
|
5753
|
-
L && (c = L.serialize(c,
|
|
5724
|
+
serialize: function(c, m) {
|
|
5725
|
+
var S = m.scheme || c.scheme || "urn", E = c.nid, U = S + ":" + (m.nid || E), L = M[U];
|
|
5726
|
+
L && (c = L.serialize(c, m));
|
|
5754
5727
|
var J = c, Y = c.nss;
|
|
5755
|
-
return J.path = (
|
|
5728
|
+
return J.path = (E || m.nid) + ":" + Y, J;
|
|
5756
5729
|
}
|
|
5757
5730
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5758
5731
|
scheme: "urn:uuid",
|
|
5759
|
-
parse: function(c,
|
|
5760
|
-
var
|
|
5761
|
-
return
|
|
5732
|
+
parse: function(c, m) {
|
|
5733
|
+
var S = c;
|
|
5734
|
+
return S.uuid = S.nss, S.nss = void 0, !m.tolerant && (!S.uuid || !S.uuid.match(mr)) && (S.error = S.error || "UUID is not valid."), S;
|
|
5762
5735
|
},
|
|
5763
|
-
serialize: function(c,
|
|
5764
|
-
var
|
|
5765
|
-
return
|
|
5736
|
+
serialize: function(c, m) {
|
|
5737
|
+
var S = c;
|
|
5738
|
+
return S.nss = (c.uuid || "").toLowerCase(), S;
|
|
5766
5739
|
}
|
|
5767
5740
|
};
|
|
5768
|
-
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize =
|
|
5741
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5769
5742
|
});
|
|
5770
5743
|
})(uri_all, uri_all.exports);
|
|
5771
5744
|
var uri_allExports = uri_all.exports;
|
|
@@ -5793,9 +5766,9 @@ uri$1.default = uri;
|
|
|
5793
5766
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5794
5767
|
return r.CodeGen;
|
|
5795
5768
|
} });
|
|
5796
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util,
|
|
5769
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util, g = require$$9, O = uri$1, N = (F, v) => new RegExp(F, v);
|
|
5797
5770
|
N.code = "new RegExp";
|
|
5798
|
-
const R = ["removeAdditional", "useDefaults", "coerceTypes"],
|
|
5771
|
+
const R = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5799
5772
|
"validate",
|
|
5800
5773
|
"serialize",
|
|
5801
5774
|
"parse",
|
|
@@ -5809,7 +5782,7 @@ uri$1.default = uri;
|
|
|
5809
5782
|
"func",
|
|
5810
5783
|
"obj",
|
|
5811
5784
|
"Error"
|
|
5812
|
-
]),
|
|
5785
|
+
]), y = {
|
|
5813
5786
|
errorDataPath: "",
|
|
5814
5787
|
format: "`validateFormats: false` can be used instead.",
|
|
5815
5788
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5825,23 +5798,23 @@ uri$1.default = uri;
|
|
|
5825
5798
|
cache: "Map is used as cache, schema object as key.",
|
|
5826
5799
|
serialize: "Map is used as cache, schema object as key.",
|
|
5827
5800
|
ajvErrors: "It is default now."
|
|
5828
|
-
},
|
|
5801
|
+
}, _ = {
|
|
5829
5802
|
ignoreKeywordsWithRef: "",
|
|
5830
5803
|
jsPropertySyntax: "",
|
|
5831
5804
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5832
|
-
},
|
|
5833
|
-
function
|
|
5834
|
-
var
|
|
5835
|
-
const
|
|
5805
|
+
}, $ = 200;
|
|
5806
|
+
function P(F) {
|
|
5807
|
+
var v, j, b, a, h, C, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, it;
|
|
5808
|
+
const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : N, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5836
5809
|
return {
|
|
5837
|
-
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5838
|
-
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5839
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5840
|
-
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne :
|
|
5841
|
-
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le :
|
|
5810
|
+
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && C !== void 0 ? C : !0,
|
|
5811
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5812
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5813
|
+
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5814
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
5842
5815
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5843
|
-
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt :
|
|
5844
|
-
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de :
|
|
5816
|
+
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : $,
|
|
5817
|
+
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : $,
|
|
5845
5818
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
5846
5819
|
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5847
5820
|
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
@@ -5855,44 +5828,44 @@ uri$1.default = uri;
|
|
|
5855
5828
|
};
|
|
5856
5829
|
}
|
|
5857
5830
|
class I {
|
|
5858
|
-
constructor(
|
|
5859
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5860
|
-
const { es5: j, lines:
|
|
5861
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes:
|
|
5862
|
-
const a =
|
|
5863
|
-
|
|
5831
|
+
constructor(v = {}) {
|
|
5832
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
|
|
5833
|
+
const { es5: j, lines: b } = this.opts.code;
|
|
5834
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: b }), this.logger = K(v.logger);
|
|
5835
|
+
const a = v.validateFormats;
|
|
5836
|
+
v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, y, v, "NOT SUPPORTED"), D.call(this, _, v, "DEPRECATED", "warn"), this._metaOpts = x.call(this), v.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && V.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), k.call(this), v.validateFormats = a;
|
|
5864
5837
|
}
|
|
5865
5838
|
_addVocabularies() {
|
|
5866
5839
|
this.addKeyword("$async");
|
|
5867
5840
|
}
|
|
5868
5841
|
_addDefaultMetaSchema() {
|
|
5869
|
-
const { $data:
|
|
5870
|
-
let a =
|
|
5871
|
-
|
|
5842
|
+
const { $data: v, meta: j, schemaId: b } = this.opts;
|
|
5843
|
+
let a = g;
|
|
5844
|
+
b === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[b], !1);
|
|
5872
5845
|
}
|
|
5873
5846
|
defaultMeta() {
|
|
5874
|
-
const { meta:
|
|
5875
|
-
return this.opts.defaultMeta = typeof
|
|
5876
|
-
}
|
|
5877
|
-
validate(
|
|
5878
|
-
let
|
|
5879
|
-
if (typeof
|
|
5880
|
-
if (
|
|
5881
|
-
throw new Error(`no schema with key or ref "${
|
|
5847
|
+
const { meta: v, schemaId: j } = this.opts;
|
|
5848
|
+
return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
|
|
5849
|
+
}
|
|
5850
|
+
validate(v, j) {
|
|
5851
|
+
let b;
|
|
5852
|
+
if (typeof v == "string") {
|
|
5853
|
+
if (b = this.getSchema(v), !b)
|
|
5854
|
+
throw new Error(`no schema with key or ref "${v}"`);
|
|
5882
5855
|
} else
|
|
5883
|
-
|
|
5884
|
-
const a =
|
|
5885
|
-
return "$async" in
|
|
5856
|
+
b = this.compile(v);
|
|
5857
|
+
const a = b(j);
|
|
5858
|
+
return "$async" in b || (this.errors = b.errors), a;
|
|
5886
5859
|
}
|
|
5887
|
-
compile(
|
|
5888
|
-
const
|
|
5889
|
-
return
|
|
5860
|
+
compile(v, j) {
|
|
5861
|
+
const b = this._addSchema(v, j);
|
|
5862
|
+
return b.validate || this._compileSchemaEnv(b);
|
|
5890
5863
|
}
|
|
5891
|
-
compileAsync(
|
|
5864
|
+
compileAsync(v, j) {
|
|
5892
5865
|
if (typeof this.opts.loadSchema != "function")
|
|
5893
5866
|
throw new Error("options.loadSchema should be a function");
|
|
5894
|
-
const { loadSchema:
|
|
5895
|
-
return a.call(this,
|
|
5867
|
+
const { loadSchema: b } = this.opts;
|
|
5868
|
+
return a.call(this, v, j);
|
|
5896
5869
|
async function a(G, ne) {
|
|
5897
5870
|
await h.call(this, G.$schema);
|
|
5898
5871
|
const he = this._addSchema(G, ne);
|
|
@@ -5923,42 +5896,42 @@ uri$1.default = uri;
|
|
|
5923
5896
|
if (ne)
|
|
5924
5897
|
return ne;
|
|
5925
5898
|
try {
|
|
5926
|
-
return await (this._loading[G] =
|
|
5899
|
+
return await (this._loading[G] = b(G));
|
|
5927
5900
|
} finally {
|
|
5928
5901
|
delete this._loading[G];
|
|
5929
5902
|
}
|
|
5930
5903
|
}
|
|
5931
5904
|
}
|
|
5932
5905
|
// Adds schema to the instance
|
|
5933
|
-
addSchema(
|
|
5934
|
-
if (Array.isArray(
|
|
5935
|
-
for (const C of
|
|
5936
|
-
this.addSchema(C, void 0,
|
|
5906
|
+
addSchema(v, j, b, a = this.opts.validateSchema) {
|
|
5907
|
+
if (Array.isArray(v)) {
|
|
5908
|
+
for (const C of v)
|
|
5909
|
+
this.addSchema(C, void 0, b, a);
|
|
5937
5910
|
return this;
|
|
5938
5911
|
}
|
|
5939
5912
|
let h;
|
|
5940
|
-
if (typeof
|
|
5913
|
+
if (typeof v == "object") {
|
|
5941
5914
|
const { schemaId: C } = this.opts;
|
|
5942
|
-
if (h =
|
|
5915
|
+
if (h = v[C], h !== void 0 && typeof h != "string")
|
|
5943
5916
|
throw new Error(`schema ${C} must be string`);
|
|
5944
5917
|
}
|
|
5945
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
5918
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, b, j, a, !0), this;
|
|
5946
5919
|
}
|
|
5947
5920
|
// Add schema that will be used to validate other schemas
|
|
5948
5921
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5949
|
-
addMetaSchema(
|
|
5950
|
-
return this.addSchema(
|
|
5922
|
+
addMetaSchema(v, j, b = this.opts.validateSchema) {
|
|
5923
|
+
return this.addSchema(v, j, !0, b), this;
|
|
5951
5924
|
}
|
|
5952
5925
|
// Validate schema against its meta-schema
|
|
5953
|
-
validateSchema(
|
|
5954
|
-
if (typeof
|
|
5926
|
+
validateSchema(v, j) {
|
|
5927
|
+
if (typeof v == "boolean")
|
|
5955
5928
|
return !0;
|
|
5956
|
-
let
|
|
5957
|
-
if (
|
|
5929
|
+
let b;
|
|
5930
|
+
if (b = v.$schema, b !== void 0 && typeof b != "string")
|
|
5958
5931
|
throw new Error("$schema must be a string");
|
|
5959
|
-
if (
|
|
5932
|
+
if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
|
|
5960
5933
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5961
|
-
const a = this.validate(
|
|
5934
|
+
const a = this.validate(b, v);
|
|
5962
5935
|
if (!a && j) {
|
|
5963
5936
|
const h = "schema is invalid: " + this.errorsText();
|
|
5964
5937
|
if (this.opts.validateSchema === "log")
|
|
@@ -5970,15 +5943,15 @@ uri$1.default = uri;
|
|
|
5970
5943
|
}
|
|
5971
5944
|
// Get compiled schema by `key` or `ref`.
|
|
5972
5945
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5973
|
-
getSchema(
|
|
5946
|
+
getSchema(v) {
|
|
5974
5947
|
let j;
|
|
5975
|
-
for (; typeof (j = w.call(this,
|
|
5976
|
-
|
|
5948
|
+
for (; typeof (j = w.call(this, v)) == "string"; )
|
|
5949
|
+
v = j;
|
|
5977
5950
|
if (j === void 0) {
|
|
5978
|
-
const { schemaId:
|
|
5979
|
-
if (j = o.resolveSchema.call(this, a,
|
|
5951
|
+
const { schemaId: b } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: b });
|
|
5952
|
+
if (j = o.resolveSchema.call(this, a, v), !j)
|
|
5980
5953
|
return;
|
|
5981
|
-
this.refs[
|
|
5954
|
+
this.refs[v] = j;
|
|
5982
5955
|
}
|
|
5983
5956
|
return j.validate || this._compileSchemaEnv(j);
|
|
5984
5957
|
}
|
|
@@ -5986,138 +5959,138 @@ uri$1.default = uri;
|
|
|
5986
5959
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5987
5960
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5988
5961
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5989
|
-
removeSchema(
|
|
5990
|
-
if (
|
|
5991
|
-
return this._removeAllSchemas(this.schemas,
|
|
5992
|
-
switch (typeof
|
|
5962
|
+
removeSchema(v) {
|
|
5963
|
+
if (v instanceof RegExp)
|
|
5964
|
+
return this._removeAllSchemas(this.schemas, v), this._removeAllSchemas(this.refs, v), this;
|
|
5965
|
+
switch (typeof v) {
|
|
5993
5966
|
case "undefined":
|
|
5994
5967
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
5995
5968
|
case "string": {
|
|
5996
|
-
const j = w.call(this,
|
|
5997
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
5969
|
+
const j = w.call(this, v);
|
|
5970
|
+
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[v], delete this.refs[v], this;
|
|
5998
5971
|
}
|
|
5999
5972
|
case "object": {
|
|
6000
|
-
const j =
|
|
5973
|
+
const j = v;
|
|
6001
5974
|
this._cache.delete(j);
|
|
6002
|
-
let
|
|
6003
|
-
return
|
|
5975
|
+
let b = v[this.opts.schemaId];
|
|
5976
|
+
return b && (b = (0, d.normalizeId)(b), delete this.schemas[b], delete this.refs[b]), this;
|
|
6004
5977
|
}
|
|
6005
5978
|
default:
|
|
6006
5979
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
6007
5980
|
}
|
|
6008
5981
|
}
|
|
6009
5982
|
// add "vocabulary" - a collection of keywords
|
|
6010
|
-
addVocabulary(
|
|
6011
|
-
for (const j of
|
|
5983
|
+
addVocabulary(v) {
|
|
5984
|
+
for (const j of v)
|
|
6012
5985
|
this.addKeyword(j);
|
|
6013
5986
|
return this;
|
|
6014
5987
|
}
|
|
6015
|
-
addKeyword(
|
|
6016
|
-
let
|
|
6017
|
-
if (typeof
|
|
6018
|
-
|
|
6019
|
-
else if (typeof
|
|
6020
|
-
if (j =
|
|
5988
|
+
addKeyword(v, j) {
|
|
5989
|
+
let b;
|
|
5990
|
+
if (typeof v == "string")
|
|
5991
|
+
b = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = b);
|
|
5992
|
+
else if (typeof v == "object" && j === void 0) {
|
|
5993
|
+
if (j = v, b = j.keyword, Array.isArray(b) && !b.length)
|
|
6021
5994
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6022
5995
|
} else
|
|
6023
5996
|
throw new Error("invalid addKeywords parameters");
|
|
6024
|
-
if (oe.call(this,
|
|
6025
|
-
return (0, p.eachItem)(
|
|
5997
|
+
if (oe.call(this, b, j), !j)
|
|
5998
|
+
return (0, p.eachItem)(b, (h) => ke.call(this, h)), this;
|
|
6026
5999
|
qe.call(this, j);
|
|
6027
6000
|
const a = {
|
|
6028
6001
|
...j,
|
|
6029
6002
|
type: (0, u.getJSONTypes)(j.type),
|
|
6030
6003
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6031
6004
|
};
|
|
6032
|
-
return (0, p.eachItem)(
|
|
6005
|
+
return (0, p.eachItem)(b, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((C) => ke.call(this, h, a, C))), this;
|
|
6033
6006
|
}
|
|
6034
|
-
getKeyword(
|
|
6035
|
-
const j = this.RULES.all[
|
|
6007
|
+
getKeyword(v) {
|
|
6008
|
+
const j = this.RULES.all[v];
|
|
6036
6009
|
return typeof j == "object" ? j.definition : !!j;
|
|
6037
6010
|
}
|
|
6038
6011
|
// Remove keyword
|
|
6039
|
-
removeKeyword(
|
|
6012
|
+
removeKeyword(v) {
|
|
6040
6013
|
const { RULES: j } = this;
|
|
6041
|
-
delete j.keywords[
|
|
6042
|
-
for (const
|
|
6043
|
-
const a =
|
|
6044
|
-
a >= 0 &&
|
|
6014
|
+
delete j.keywords[v], delete j.all[v];
|
|
6015
|
+
for (const b of j.rules) {
|
|
6016
|
+
const a = b.rules.findIndex((h) => h.keyword === v);
|
|
6017
|
+
a >= 0 && b.rules.splice(a, 1);
|
|
6045
6018
|
}
|
|
6046
6019
|
return this;
|
|
6047
6020
|
}
|
|
6048
6021
|
// Add format
|
|
6049
|
-
addFormat(
|
|
6050
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6022
|
+
addFormat(v, j) {
|
|
6023
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
|
|
6051
6024
|
}
|
|
6052
|
-
errorsText(
|
|
6053
|
-
return !
|
|
6025
|
+
errorsText(v = this.errors, { separator: j = ", ", dataVar: b = "data" } = {}) {
|
|
6026
|
+
return !v || v.length === 0 ? "No errors" : v.map((a) => `${b}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6054
6027
|
}
|
|
6055
|
-
$dataMetaSchema(
|
|
6056
|
-
const
|
|
6057
|
-
|
|
6028
|
+
$dataMetaSchema(v, j) {
|
|
6029
|
+
const b = this.RULES.all;
|
|
6030
|
+
v = JSON.parse(JSON.stringify(v));
|
|
6058
6031
|
for (const a of j) {
|
|
6059
6032
|
const h = a.split("/").slice(1);
|
|
6060
|
-
let C =
|
|
6033
|
+
let C = v;
|
|
6061
6034
|
for (const M of h)
|
|
6062
6035
|
C = C[M];
|
|
6063
|
-
for (const M in
|
|
6064
|
-
const q =
|
|
6036
|
+
for (const M in b) {
|
|
6037
|
+
const q = b[M];
|
|
6065
6038
|
if (typeof q != "object")
|
|
6066
6039
|
continue;
|
|
6067
6040
|
const { $data: W } = q.definition, G = C[M];
|
|
6068
6041
|
W && G && (C[M] = Ue(G));
|
|
6069
6042
|
}
|
|
6070
6043
|
}
|
|
6071
|
-
return
|
|
6044
|
+
return v;
|
|
6072
6045
|
}
|
|
6073
|
-
_removeAllSchemas(
|
|
6074
|
-
for (const
|
|
6075
|
-
const a =
|
|
6076
|
-
(!j || j.test(
|
|
6046
|
+
_removeAllSchemas(v, j) {
|
|
6047
|
+
for (const b in v) {
|
|
6048
|
+
const a = v[b];
|
|
6049
|
+
(!j || j.test(b)) && (typeof a == "string" ? delete v[b] : a && !a.meta && (this._cache.delete(a.schema), delete v[b]));
|
|
6077
6050
|
}
|
|
6078
6051
|
}
|
|
6079
|
-
_addSchema(
|
|
6052
|
+
_addSchema(v, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6080
6053
|
let C;
|
|
6081
6054
|
const { schemaId: M } = this.opts;
|
|
6082
|
-
if (typeof
|
|
6083
|
-
C =
|
|
6055
|
+
if (typeof v == "object")
|
|
6056
|
+
C = v[M];
|
|
6084
6057
|
else {
|
|
6085
6058
|
if (this.opts.jtd)
|
|
6086
6059
|
throw new Error("schema must be object");
|
|
6087
|
-
if (typeof
|
|
6060
|
+
if (typeof v != "boolean")
|
|
6088
6061
|
throw new Error("schema must be object or boolean");
|
|
6089
6062
|
}
|
|
6090
|
-
let q = this._cache.get(
|
|
6063
|
+
let q = this._cache.get(v);
|
|
6091
6064
|
if (q !== void 0)
|
|
6092
6065
|
return q;
|
|
6093
|
-
|
|
6094
|
-
const W = d.getSchemaRefs.call(this,
|
|
6095
|
-
return q = new o.SchemaEnv({ schema:
|
|
6066
|
+
b = (0, d.normalizeId)(C || b);
|
|
6067
|
+
const W = d.getSchemaRefs.call(this, v, b);
|
|
6068
|
+
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(q.schema, q), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = q), a && this.validateSchema(v, !0), q;
|
|
6096
6069
|
}
|
|
6097
|
-
_checkUnique(
|
|
6098
|
-
if (this.schemas[
|
|
6099
|
-
throw new Error(`schema with key or id "${
|
|
6070
|
+
_checkUnique(v) {
|
|
6071
|
+
if (this.schemas[v] || this.refs[v])
|
|
6072
|
+
throw new Error(`schema with key or id "${v}" already exists`);
|
|
6100
6073
|
}
|
|
6101
|
-
_compileSchemaEnv(
|
|
6102
|
-
if (
|
|
6074
|
+
_compileSchemaEnv(v) {
|
|
6075
|
+
if (v.meta ? this._compileMetaSchema(v) : o.compileSchema.call(this, v), !v.validate)
|
|
6103
6076
|
throw new Error("ajv implementation error");
|
|
6104
|
-
return
|
|
6077
|
+
return v.validate;
|
|
6105
6078
|
}
|
|
6106
|
-
_compileMetaSchema(
|
|
6079
|
+
_compileMetaSchema(v) {
|
|
6107
6080
|
const j = this.opts;
|
|
6108
6081
|
this.opts = this._metaOpts;
|
|
6109
6082
|
try {
|
|
6110
|
-
o.compileSchema.call(this,
|
|
6083
|
+
o.compileSchema.call(this, v);
|
|
6111
6084
|
} finally {
|
|
6112
6085
|
this.opts = j;
|
|
6113
6086
|
}
|
|
6114
6087
|
}
|
|
6115
6088
|
}
|
|
6116
6089
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6117
|
-
function D(F,
|
|
6090
|
+
function D(F, v, j, b = "error") {
|
|
6118
6091
|
for (const a in F) {
|
|
6119
6092
|
const h = a;
|
|
6120
|
-
h in
|
|
6093
|
+
h in v && this.logger[b](`${j}: option ${a}. ${F[h]}`);
|
|
6121
6094
|
}
|
|
6122
6095
|
}
|
|
6123
6096
|
function w(F) {
|
|
@@ -6129,13 +6102,13 @@ uri$1.default = uri;
|
|
|
6129
6102
|
if (Array.isArray(F))
|
|
6130
6103
|
this.addSchema(F);
|
|
6131
6104
|
else
|
|
6132
|
-
for (const
|
|
6133
|
-
this.addSchema(F[
|
|
6105
|
+
for (const v in F)
|
|
6106
|
+
this.addSchema(F[v], v);
|
|
6134
6107
|
}
|
|
6135
6108
|
function A() {
|
|
6136
6109
|
for (const F in this.opts.formats) {
|
|
6137
|
-
const
|
|
6138
|
-
|
|
6110
|
+
const v = this.opts.formats[F];
|
|
6111
|
+
v && this.addFormat(F, v);
|
|
6139
6112
|
}
|
|
6140
6113
|
}
|
|
6141
6114
|
function V(F) {
|
|
@@ -6144,15 +6117,15 @@ uri$1.default = uri;
|
|
|
6144
6117
|
return;
|
|
6145
6118
|
}
|
|
6146
6119
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6147
|
-
for (const
|
|
6148
|
-
const j = F[
|
|
6149
|
-
j.keyword || (j.keyword =
|
|
6120
|
+
for (const v in F) {
|
|
6121
|
+
const j = F[v];
|
|
6122
|
+
j.keyword || (j.keyword = v), this.addKeyword(j);
|
|
6150
6123
|
}
|
|
6151
6124
|
}
|
|
6152
6125
|
function x() {
|
|
6153
6126
|
const F = { ...this.opts };
|
|
6154
|
-
for (const
|
|
6155
|
-
delete F[
|
|
6127
|
+
for (const v of R)
|
|
6128
|
+
delete F[v];
|
|
6156
6129
|
return F;
|
|
6157
6130
|
}
|
|
6158
6131
|
const re = { log() {
|
|
@@ -6169,42 +6142,42 @@ uri$1.default = uri;
|
|
|
6169
6142
|
throw new Error("logger must implement log, warn and error methods");
|
|
6170
6143
|
}
|
|
6171
6144
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6172
|
-
function oe(F,
|
|
6145
|
+
function oe(F, v) {
|
|
6173
6146
|
const { RULES: j } = this;
|
|
6174
|
-
if ((0, p.eachItem)(F, (
|
|
6175
|
-
if (j.keywords[
|
|
6176
|
-
throw new Error(`Keyword ${
|
|
6177
|
-
if (!ue.test(
|
|
6178
|
-
throw new Error(`Keyword ${
|
|
6179
|
-
}), !!
|
|
6147
|
+
if ((0, p.eachItem)(F, (b) => {
|
|
6148
|
+
if (j.keywords[b])
|
|
6149
|
+
throw new Error(`Keyword ${b} is already defined`);
|
|
6150
|
+
if (!ue.test(b))
|
|
6151
|
+
throw new Error(`Keyword ${b} has invalid name`);
|
|
6152
|
+
}), !!v && v.$data && !("code" in v || "validate" in v))
|
|
6180
6153
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6181
6154
|
}
|
|
6182
|
-
function ke(F,
|
|
6183
|
-
var
|
|
6184
|
-
const a =
|
|
6155
|
+
function ke(F, v, j) {
|
|
6156
|
+
var b;
|
|
6157
|
+
const a = v == null ? void 0 : v.post;
|
|
6185
6158
|
if (j && a)
|
|
6186
6159
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6187
6160
|
const { RULES: h } = this;
|
|
6188
6161
|
let C = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6189
|
-
if (C || (C = { type: j, rules: [] }, h.rules.push(C)), h.keywords[F] = !0, !
|
|
6162
|
+
if (C || (C = { type: j, rules: [] }, h.rules.push(C)), h.keywords[F] = !0, !v)
|
|
6190
6163
|
return;
|
|
6191
6164
|
const M = {
|
|
6192
6165
|
keyword: F,
|
|
6193
6166
|
definition: {
|
|
6194
|
-
...
|
|
6195
|
-
type: (0, u.getJSONTypes)(
|
|
6196
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6167
|
+
...v,
|
|
6168
|
+
type: (0, u.getJSONTypes)(v.type),
|
|
6169
|
+
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6197
6170
|
}
|
|
6198
6171
|
};
|
|
6199
|
-
|
|
6172
|
+
v.before ? Ce.call(this, C, M, v.before) : C.rules.push(M), h.all[F] = M, (b = v.implements) === null || b === void 0 || b.forEach((q) => this.addKeyword(q));
|
|
6200
6173
|
}
|
|
6201
|
-
function
|
|
6202
|
-
const
|
|
6203
|
-
|
|
6174
|
+
function Ce(F, v, j) {
|
|
6175
|
+
const b = F.rules.findIndex((a) => a.keyword === j);
|
|
6176
|
+
b >= 0 ? F.rules.splice(b, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
|
|
6204
6177
|
}
|
|
6205
6178
|
function qe(F) {
|
|
6206
|
-
let { metaSchema:
|
|
6207
|
-
|
|
6179
|
+
let { metaSchema: v } = F;
|
|
6180
|
+
v !== void 0 && (F.$data && this.opts.$data && (v = Ue(v)), F.validateSchema = this.compile(v, !0));
|
|
6208
6181
|
}
|
|
6209
6182
|
const et = {
|
|
6210
6183
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
@@ -6231,32 +6204,32 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6231
6204
|
code(e) {
|
|
6232
6205
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: l, self: d } = n, { root: u } = i;
|
|
6233
6206
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6234
|
-
return
|
|
6207
|
+
return g();
|
|
6235
6208
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6236
6209
|
if (p === void 0)
|
|
6237
6210
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6238
6211
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6239
6212
|
return O(p);
|
|
6240
6213
|
return N(p);
|
|
6241
|
-
function
|
|
6214
|
+
function g() {
|
|
6242
6215
|
if (i === u)
|
|
6243
6216
|
return callRef(e, o, i, i.$async);
|
|
6244
6217
|
const R = t.scopeValue("root", { ref: u });
|
|
6245
6218
|
return callRef(e, (0, codegen_1$l._)`${R}.validate`, u, u.$async);
|
|
6246
6219
|
}
|
|
6247
6220
|
function O(R) {
|
|
6248
|
-
const
|
|
6249
|
-
callRef(e,
|
|
6221
|
+
const T = getValidate(e, R);
|
|
6222
|
+
callRef(e, T, R, R.$async);
|
|
6250
6223
|
}
|
|
6251
6224
|
function N(R) {
|
|
6252
|
-
const
|
|
6225
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: R, code: (0, codegen_1$l.stringify)(R) } : { ref: R }), y = t.name("valid"), _ = e.subschema({
|
|
6253
6226
|
schema: R,
|
|
6254
6227
|
dataTypes: [],
|
|
6255
6228
|
schemaPath: codegen_1$l.nil,
|
|
6256
|
-
topSchemaRef:
|
|
6229
|
+
topSchemaRef: T,
|
|
6257
6230
|
errSchemaPath: r
|
|
6258
|
-
},
|
|
6259
|
-
e.mergeEvaluated(
|
|
6231
|
+
}, y);
|
|
6232
|
+
e.mergeEvaluated(_), e.ok(y);
|
|
6260
6233
|
}
|
|
6261
6234
|
}
|
|
6262
6235
|
};
|
|
@@ -6267,42 +6240,42 @@ function getValidate(e, t) {
|
|
|
6267
6240
|
ref.getValidate = getValidate;
|
|
6268
6241
|
function callRef(e, t, r, n) {
|
|
6269
6242
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: l, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6270
|
-
n ? p() :
|
|
6243
|
+
n ? p() : g();
|
|
6271
6244
|
function p() {
|
|
6272
6245
|
if (!l.$async)
|
|
6273
6246
|
throw new Error("async schema referenced by sync schema");
|
|
6274
6247
|
const R = s.let("valid");
|
|
6275
6248
|
s.try(() => {
|
|
6276
6249
|
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), N(t), o || s.assign(R, !0);
|
|
6277
|
-
}, (
|
|
6278
|
-
s.if((0, codegen_1$l._)`!(${
|
|
6250
|
+
}, (T) => {
|
|
6251
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(R, !1);
|
|
6279
6252
|
}), e.ok(R);
|
|
6280
6253
|
}
|
|
6281
|
-
function
|
|
6254
|
+
function g() {
|
|
6282
6255
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => N(t), () => O(t));
|
|
6283
6256
|
}
|
|
6284
6257
|
function O(R) {
|
|
6285
|
-
const
|
|
6286
|
-
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${
|
|
6258
|
+
const T = (0, codegen_1$l._)`${R}.errors`;
|
|
6259
|
+
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6287
6260
|
}
|
|
6288
6261
|
function N(R) {
|
|
6289
|
-
var
|
|
6262
|
+
var T;
|
|
6290
6263
|
if (!i.opts.unevaluated)
|
|
6291
6264
|
return;
|
|
6292
|
-
const
|
|
6265
|
+
const y = (T = r == null ? void 0 : r.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
6293
6266
|
if (i.props !== !0)
|
|
6294
|
-
if (
|
|
6295
|
-
|
|
6267
|
+
if (y && !y.dynamicProps)
|
|
6268
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6296
6269
|
else {
|
|
6297
|
-
const
|
|
6298
|
-
i.props = util_1$j.mergeEvaluated.props(s,
|
|
6270
|
+
const _ = s.var("props", (0, codegen_1$l._)`${R}.evaluated.props`);
|
|
6271
|
+
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6299
6272
|
}
|
|
6300
6273
|
if (i.items !== !0)
|
|
6301
|
-
if (
|
|
6302
|
-
|
|
6274
|
+
if (y && !y.dynamicItems)
|
|
6275
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6303
6276
|
else {
|
|
6304
|
-
const
|
|
6305
|
-
i.items = util_1$j.mergeEvaluated.items(s,
|
|
6277
|
+
const _ = s.var("items", (0, codegen_1$l._)`${R}.evaluated.items`);
|
|
6278
|
+
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
6306
6279
|
}
|
|
6307
6280
|
}
|
|
6308
6281
|
}
|
|
@@ -6444,15 +6417,15 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6444
6417
|
const d = r.length >= l.loopRequired;
|
|
6445
6418
|
if (o.allErrors ? u() : p(), l.strictRequired) {
|
|
6446
6419
|
const N = e.parentSchema.properties, { definedProperties: R } = e.it;
|
|
6447
|
-
for (const
|
|
6448
|
-
if ((N == null ? void 0 : N[
|
|
6449
|
-
const
|
|
6450
|
-
(0, util_1$h.checkStrictMode)(o,
|
|
6420
|
+
for (const T of r)
|
|
6421
|
+
if ((N == null ? void 0 : N[T]) === void 0 && !R.has(T)) {
|
|
6422
|
+
const y = o.schemaEnv.baseId + o.errSchemaPath, _ = `required property "${T}" is not defined at "${y}" (strictRequired)`;
|
|
6423
|
+
(0, util_1$h.checkStrictMode)(o, _, o.opts.strictRequired);
|
|
6451
6424
|
}
|
|
6452
6425
|
}
|
|
6453
6426
|
function u() {
|
|
6454
6427
|
if (d || i)
|
|
6455
|
-
e.block$data(codegen_1$f.nil,
|
|
6428
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6456
6429
|
else
|
|
6457
6430
|
for (const N of r)
|
|
6458
6431
|
(0, code_1$6.checkReportMissingProp)(e, N);
|
|
@@ -6465,7 +6438,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6465
6438
|
} else
|
|
6466
6439
|
t.if((0, code_1$6.checkMissingProp)(e, r, N)), (0, code_1$6.reportMissingProp)(e, N), t.else();
|
|
6467
6440
|
}
|
|
6468
|
-
function
|
|
6441
|
+
function g() {
|
|
6469
6442
|
t.forOf("prop", n, (N) => {
|
|
6470
6443
|
e.setParams({ missingProperty: N }), t.if((0, code_1$6.noPropertyInData)(t, s, N, l.ownProperties), () => e.error());
|
|
6471
6444
|
});
|
|
@@ -6522,24 +6495,24 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6522
6495
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6523
6496
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6524
6497
|
function p() {
|
|
6525
|
-
const R = t.let("i", (0, codegen_1$d._)`${r}.length`),
|
|
6526
|
-
e.setParams({ i: R, j:
|
|
6498
|
+
const R = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6499
|
+
e.setParams({ i: R, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${R} > 1`, () => (g() ? O : N)(R, T));
|
|
6527
6500
|
}
|
|
6528
|
-
function
|
|
6501
|
+
function g() {
|
|
6529
6502
|
return u.length > 0 && !u.some((R) => R === "object" || R === "array");
|
|
6530
6503
|
}
|
|
6531
|
-
function O(R,
|
|
6532
|
-
const
|
|
6504
|
+
function O(R, T) {
|
|
6505
|
+
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), $ = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6533
6506
|
t.for((0, codegen_1$d._)`;${R}--;`, () => {
|
|
6534
|
-
t.let(
|
|
6535
|
-
t.assign(
|
|
6536
|
-
}).code((0, codegen_1$d._)`${
|
|
6507
|
+
t.let(y, (0, codegen_1$d._)`${r}[${R}]`), t.if(_, (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 ${$}[${y}] == "number"`, () => {
|
|
6508
|
+
t.assign(T, (0, codegen_1$d._)`${$}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6509
|
+
}).code((0, codegen_1$d._)`${$}[${y}] = ${R}`);
|
|
6537
6510
|
});
|
|
6538
6511
|
}
|
|
6539
|
-
function N(R,
|
|
6540
|
-
const
|
|
6541
|
-
t.label(
|
|
6542
|
-
e.error(), t.assign(d, !1).break(
|
|
6512
|
+
function N(R, T) {
|
|
6513
|
+
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6514
|
+
t.label(_).for((0, codegen_1$d._)`;${R}--;`, () => t.for((0, codegen_1$d._)`${T} = ${R}; ${T}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${R}], ${r}[${T}])`, () => {
|
|
6515
|
+
e.error(), t.assign(d, !1).break(_);
|
|
6543
6516
|
})));
|
|
6544
6517
|
}
|
|
6545
6518
|
}
|
|
@@ -6579,20 +6552,20 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6579
6552
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6580
6553
|
let p;
|
|
6581
6554
|
if (l || n)
|
|
6582
|
-
p = t.let("valid"), e.block$data(p,
|
|
6555
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6583
6556
|
else {
|
|
6584
6557
|
if (!Array.isArray(s))
|
|
6585
6558
|
throw new Error("ajv implementation error");
|
|
6586
6559
|
const N = t.const("vSchema", i);
|
|
6587
|
-
p = (0, codegen_1$b.or)(...s.map((R,
|
|
6560
|
+
p = (0, codegen_1$b.or)(...s.map((R, T) => O(N, T)));
|
|
6588
6561
|
}
|
|
6589
6562
|
e.pass(p);
|
|
6590
|
-
function
|
|
6563
|
+
function g() {
|
|
6591
6564
|
t.assign(p, !1), t.forOf("v", i, (N) => t.if((0, codegen_1$b._)`${u()}(${r}, ${N})`, () => t.assign(p, !0).break()));
|
|
6592
6565
|
}
|
|
6593
6566
|
function O(N, R) {
|
|
6594
|
-
const
|
|
6595
|
-
return typeof
|
|
6567
|
+
const T = s[R];
|
|
6568
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${N}[${R}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6596
6569
|
}
|
|
6597
6570
|
}
|
|
6598
6571
|
};
|
|
@@ -6676,18 +6649,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6676
6649
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6677
6650
|
p(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6678
6651
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6679
|
-
r.forEach((
|
|
6680
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6652
|
+
r.forEach((g, O) => {
|
|
6653
|
+
(0, util_1$c.alwaysValidSchema)(l, g) || (n.if((0, codegen_1$9._)`${u} > ${O}`, () => e.subschema({
|
|
6681
6654
|
keyword: o,
|
|
6682
6655
|
schemaProp: O,
|
|
6683
6656
|
dataProp: O
|
|
6684
6657
|
}, d)), e.ok(d));
|
|
6685
6658
|
});
|
|
6686
|
-
function p(
|
|
6687
|
-
const { opts: O, errSchemaPath: N } = l, R = r.length,
|
|
6688
|
-
if (O.strictTuples && !
|
|
6689
|
-
const
|
|
6690
|
-
(0, util_1$c.checkStrictMode)(l,
|
|
6659
|
+
function p(g) {
|
|
6660
|
+
const { opts: O, errSchemaPath: N } = l, R = r.length, T = R === g.minItems && (R === g.maxItems || g[t] === !1);
|
|
6661
|
+
if (O.strictTuples && !T) {
|
|
6662
|
+
const y = `"${o}" is ${R}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;
|
|
6663
|
+
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
6691
6664
|
}
|
|
6692
6665
|
}
|
|
6693
6666
|
}
|
|
@@ -6746,29 +6719,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6746
6719
|
return;
|
|
6747
6720
|
}
|
|
6748
6721
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
6749
|
-
let
|
|
6750
|
-
l !== void 0 && (
|
|
6722
|
+
let T = (0, codegen_1$7._)`${p} >= ${o}`;
|
|
6723
|
+
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${p} <= ${l}`), e.pass(T);
|
|
6751
6724
|
return;
|
|
6752
6725
|
}
|
|
6753
6726
|
i.items = !0;
|
|
6754
|
-
const
|
|
6755
|
-
l === void 0 && o === 1 ? N(
|
|
6727
|
+
const g = t.name("valid");
|
|
6728
|
+
l === void 0 && o === 1 ? N(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let(g, !1), O()), e.result(g, () => e.reset());
|
|
6756
6729
|
function O() {
|
|
6757
|
-
const
|
|
6758
|
-
N(
|
|
6730
|
+
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6731
|
+
N(T, () => t.if(T, () => R(y)));
|
|
6759
6732
|
}
|
|
6760
|
-
function N(
|
|
6761
|
-
t.forRange("i", 0, p, (
|
|
6733
|
+
function N(T, y) {
|
|
6734
|
+
t.forRange("i", 0, p, (_) => {
|
|
6762
6735
|
e.subschema({
|
|
6763
6736
|
keyword: "contains",
|
|
6764
|
-
dataProp:
|
|
6737
|
+
dataProp: _,
|
|
6765
6738
|
dataPropType: util_1$a.Type.Num,
|
|
6766
6739
|
compositeRule: !0
|
|
6767
|
-
},
|
|
6740
|
+
}, T), y();
|
|
6768
6741
|
});
|
|
6769
6742
|
}
|
|
6770
|
-
function R(
|
|
6771
|
-
t.code((0, codegen_1$7._)`${
|
|
6743
|
+
function R(T) {
|
|
6744
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(g, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign(g, !1).break()), o === 1 ? t.assign(g, !0) : t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(g, !0)));
|
|
6772
6745
|
}
|
|
6773
6746
|
}
|
|
6774
6747
|
};
|
|
@@ -6779,11 +6752,11 @@ var dependencies = {};
|
|
|
6779
6752
|
const t = codegen, r = util, n = code;
|
|
6780
6753
|
e.error = {
|
|
6781
6754
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6782
|
-
const
|
|
6783
|
-
return (0, t.str)`must have ${
|
|
6755
|
+
const g = u === 1 ? "property" : "properties";
|
|
6756
|
+
return (0, t.str)`must have ${g} ${p} when property ${d} is present`;
|
|
6784
6757
|
},
|
|
6785
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6786
|
-
missingProperty: ${
|
|
6758
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6759
|
+
missingProperty: ${g},
|
|
6787
6760
|
depsCount: ${u},
|
|
6788
6761
|
deps: ${p}}`
|
|
6789
6762
|
// TODO change to reference
|
|
@@ -6800,43 +6773,43 @@ var dependencies = {};
|
|
|
6800
6773
|
};
|
|
6801
6774
|
function i({ schema: d }) {
|
|
6802
6775
|
const u = {}, p = {};
|
|
6803
|
-
for (const
|
|
6804
|
-
if (
|
|
6776
|
+
for (const g in d) {
|
|
6777
|
+
if (g === "__proto__")
|
|
6805
6778
|
continue;
|
|
6806
|
-
const O = Array.isArray(d[
|
|
6807
|
-
O[
|
|
6779
|
+
const O = Array.isArray(d[g]) ? u : p;
|
|
6780
|
+
O[g] = d[g];
|
|
6808
6781
|
}
|
|
6809
6782
|
return [u, p];
|
|
6810
6783
|
}
|
|
6811
6784
|
function o(d, u = d.schema) {
|
|
6812
|
-
const { gen: p, data:
|
|
6785
|
+
const { gen: p, data: g, it: O } = d;
|
|
6813
6786
|
if (Object.keys(u).length === 0)
|
|
6814
6787
|
return;
|
|
6815
6788
|
const N = p.let("missing");
|
|
6816
6789
|
for (const R in u) {
|
|
6817
|
-
const
|
|
6818
|
-
if (
|
|
6790
|
+
const T = u[R];
|
|
6791
|
+
if (T.length === 0)
|
|
6819
6792
|
continue;
|
|
6820
|
-
const
|
|
6793
|
+
const y = (0, n.propertyInData)(p, g, R, O.opts.ownProperties);
|
|
6821
6794
|
d.setParams({
|
|
6822
6795
|
property: R,
|
|
6823
|
-
depsCount:
|
|
6824
|
-
deps:
|
|
6825
|
-
}), O.allErrors ? p.if(
|
|
6826
|
-
for (const
|
|
6827
|
-
(0, n.checkReportMissingProp)(d,
|
|
6828
|
-
}) : (p.if((0, t._)`${
|
|
6796
|
+
depsCount: T.length,
|
|
6797
|
+
deps: T.join(", ")
|
|
6798
|
+
}), O.allErrors ? p.if(y, () => {
|
|
6799
|
+
for (const _ of T)
|
|
6800
|
+
(0, n.checkReportMissingProp)(d, _);
|
|
6801
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, T, N)})`), (0, n.reportMissingProp)(d, N), p.else());
|
|
6829
6802
|
}
|
|
6830
6803
|
}
|
|
6831
6804
|
e.validatePropertyDeps = o;
|
|
6832
6805
|
function l(d, u = d.schema) {
|
|
6833
|
-
const { gen: p, data:
|
|
6834
|
-
for (const
|
|
6835
|
-
(0, r.alwaysValidSchema)(N, u[
|
|
6836
|
-
(0, n.propertyInData)(p,
|
|
6806
|
+
const { gen: p, data: g, keyword: O, it: N } = d, R = p.name("valid");
|
|
6807
|
+
for (const T in u)
|
|
6808
|
+
(0, r.alwaysValidSchema)(N, u[T]) || (p.if(
|
|
6809
|
+
(0, n.propertyInData)(p, g, T, N.opts.ownProperties),
|
|
6837
6810
|
() => {
|
|
6838
|
-
const
|
|
6839
|
-
d.mergeValidEvaluated(
|
|
6811
|
+
const y = d.subschema({ keyword: O, schemaProp: T }, R);
|
|
6812
|
+
d.mergeValidEvaluated(y, R);
|
|
6840
6813
|
},
|
|
6841
6814
|
() => p.var(R, !0)
|
|
6842
6815
|
// TODO var
|
|
@@ -6893,51 +6866,51 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6893
6866
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6894
6867
|
return;
|
|
6895
6868
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6896
|
-
|
|
6897
|
-
function
|
|
6898
|
-
t.forIn("key", s, (
|
|
6899
|
-
!u.length && !p.length ? R(
|
|
6869
|
+
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6870
|
+
function g() {
|
|
6871
|
+
t.forIn("key", s, (y) => {
|
|
6872
|
+
!u.length && !p.length ? R(y) : t.if(O(y), () => R(y));
|
|
6900
6873
|
});
|
|
6901
6874
|
}
|
|
6902
|
-
function O(
|
|
6903
|
-
let
|
|
6875
|
+
function O(y) {
|
|
6876
|
+
let _;
|
|
6904
6877
|
if (u.length > 8) {
|
|
6905
|
-
const
|
|
6906
|
-
|
|
6878
|
+
const $ = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6879
|
+
_ = (0, code_1$3.isOwnProperty)(t, $, y);
|
|
6907
6880
|
} else
|
|
6908
|
-
u.length ?
|
|
6909
|
-
return p.length && (
|
|
6881
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map(($) => (0, codegen_1$5._)`${y} === ${$}`)) : _ = codegen_1$5.nil;
|
|
6882
|
+
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map(($) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, $)}.test(${y})`))), (0, codegen_1$5.not)(_);
|
|
6910
6883
|
}
|
|
6911
|
-
function N(
|
|
6912
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6884
|
+
function N(y) {
|
|
6885
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6913
6886
|
}
|
|
6914
|
-
function R(
|
|
6887
|
+
function R(y) {
|
|
6915
6888
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6916
|
-
N(
|
|
6889
|
+
N(y);
|
|
6917
6890
|
return;
|
|
6918
6891
|
}
|
|
6919
6892
|
if (r === !1) {
|
|
6920
|
-
e.setParams({ additionalProperty:
|
|
6893
|
+
e.setParams({ additionalProperty: y }), e.error(), l || t.break();
|
|
6921
6894
|
return;
|
|
6922
6895
|
}
|
|
6923
6896
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6924
|
-
const
|
|
6925
|
-
d.removeAdditional === "failing" ? (
|
|
6926
|
-
e.reset(), N(
|
|
6927
|
-
})) : (
|
|
6897
|
+
const _ = t.name("valid");
|
|
6898
|
+
d.removeAdditional === "failing" ? (T(y, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6899
|
+
e.reset(), N(y);
|
|
6900
|
+
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6928
6901
|
}
|
|
6929
6902
|
}
|
|
6930
|
-
function
|
|
6931
|
-
const
|
|
6903
|
+
function T(y, _, $) {
|
|
6904
|
+
const P = {
|
|
6932
6905
|
keyword: "additionalProperties",
|
|
6933
|
-
dataProp:
|
|
6906
|
+
dataProp: y,
|
|
6934
6907
|
dataPropType: util_1$8.Type.Str
|
|
6935
6908
|
};
|
|
6936
|
-
|
|
6909
|
+
$ === !1 && Object.assign(P, {
|
|
6937
6910
|
compositeRule: !0,
|
|
6938
6911
|
createErrors: !1,
|
|
6939
6912
|
allErrors: !1
|
|
6940
|
-
}), e.subschema(
|
|
6913
|
+
}), e.subschema(P, _);
|
|
6941
6914
|
}
|
|
6942
6915
|
}
|
|
6943
6916
|
};
|
|
@@ -6952,23 +6925,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6952
6925
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6953
6926
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6954
6927
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6955
|
-
for (const
|
|
6956
|
-
i.definedProperties.add(
|
|
6928
|
+
for (const g of o)
|
|
6929
|
+
i.definedProperties.add(g);
|
|
6957
6930
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6958
|
-
const l = o.filter((
|
|
6931
|
+
const l = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6959
6932
|
if (l.length === 0)
|
|
6960
6933
|
return;
|
|
6961
6934
|
const d = t.name("valid");
|
|
6962
|
-
for (const
|
|
6963
|
-
u(
|
|
6964
|
-
function u(
|
|
6965
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6935
|
+
for (const g of l)
|
|
6936
|
+
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);
|
|
6937
|
+
function u(g) {
|
|
6938
|
+
return i.opts.useDefaults && !i.compositeRule && r[g].default !== void 0;
|
|
6966
6939
|
}
|
|
6967
|
-
function p(
|
|
6940
|
+
function p(g) {
|
|
6968
6941
|
e.subschema({
|
|
6969
6942
|
keyword: "properties",
|
|
6970
|
-
schemaProp:
|
|
6971
|
-
dataProp:
|
|
6943
|
+
schemaProp: g,
|
|
6944
|
+
dataProp: g
|
|
6972
6945
|
}, d);
|
|
6973
6946
|
}
|
|
6974
6947
|
}
|
|
@@ -6981,31 +6954,31 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6981
6954
|
type: "object",
|
|
6982
6955
|
schemaType: "object",
|
|
6983
6956
|
code(e) {
|
|
6984
|
-
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, l = (0, code_1$1.allSchemaProperties)(r), d = l.filter((
|
|
6957
|
+
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, l = (0, code_1$1.allSchemaProperties)(r), d = l.filter((T) => (0, util_1$6.alwaysValidSchema)(i, r[T]));
|
|
6985
6958
|
if (l.length === 0 || d.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
6986
6959
|
return;
|
|
6987
6960
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6988
6961
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6989
|
-
const { props:
|
|
6962
|
+
const { props: g } = i;
|
|
6990
6963
|
O();
|
|
6991
6964
|
function O() {
|
|
6992
|
-
for (const
|
|
6993
|
-
u && N(
|
|
6994
|
-
}
|
|
6995
|
-
function N(
|
|
6996
|
-
for (const
|
|
6997
|
-
new RegExp(
|
|
6998
|
-
}
|
|
6999
|
-
function R(
|
|
7000
|
-
t.forIn("key", n, (
|
|
7001
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e,
|
|
7002
|
-
const
|
|
7003
|
-
|
|
6965
|
+
for (const T of l)
|
|
6966
|
+
u && N(T), i.allErrors ? R(T) : (t.var(p, !0), R(T), t.if(p));
|
|
6967
|
+
}
|
|
6968
|
+
function N(T) {
|
|
6969
|
+
for (const y in u)
|
|
6970
|
+
new RegExp(T).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6971
|
+
}
|
|
6972
|
+
function R(T) {
|
|
6973
|
+
t.forIn("key", n, (y) => {
|
|
6974
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${y})`, () => {
|
|
6975
|
+
const _ = d.includes(T);
|
|
6976
|
+
_ || e.subschema({
|
|
7004
6977
|
keyword: "patternProperties",
|
|
7005
|
-
schemaProp:
|
|
7006
|
-
dataProp:
|
|
6978
|
+
schemaProp: T,
|
|
6979
|
+
dataProp: y,
|
|
7007
6980
|
dataPropType: util_2.Type.Str
|
|
7008
|
-
}, p), i.opts.unevaluated &&
|
|
6981
|
+
}, p), i.opts.unevaluated && g !== !0 ? t.assign((0, codegen_1$4._)`${g}[${y}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7009
6982
|
});
|
|
7010
6983
|
});
|
|
7011
6984
|
}
|
|
@@ -7064,14 +7037,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7064
7037
|
const i = r, o = t.let("valid", !1), l = t.let("passing", null), d = t.name("_valid");
|
|
7065
7038
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7066
7039
|
function u() {
|
|
7067
|
-
i.forEach((p,
|
|
7040
|
+
i.forEach((p, g) => {
|
|
7068
7041
|
let O;
|
|
7069
7042
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : O = e.subschema({
|
|
7070
7043
|
keyword: "oneOf",
|
|
7071
|
-
schemaProp:
|
|
7044
|
+
schemaProp: g,
|
|
7072
7045
|
compositeRule: !0
|
|
7073
|
-
}, d),
|
|
7074
|
-
t.assign(o, !0), t.assign(l,
|
|
7046
|
+
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(l, (0, codegen_1$3._)`[${l}, ${g}]`).else(), t.if(d, () => {
|
|
7047
|
+
t.assign(o, !0), t.assign(l, g), O && e.mergeEvaluated(O, codegen_1$3.Name);
|
|
7075
7048
|
});
|
|
7076
7049
|
});
|
|
7077
7050
|
}
|
|
@@ -7129,10 +7102,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7129
7102
|
}, l);
|
|
7130
7103
|
e.mergeEvaluated(p);
|
|
7131
7104
|
}
|
|
7132
|
-
function u(p,
|
|
7105
|
+
function u(p, g) {
|
|
7133
7106
|
return () => {
|
|
7134
7107
|
const O = e.subschema({ keyword: p }, l);
|
|
7135
|
-
t.assign(o, l), e.mergeValidEvaluated(O, o),
|
|
7108
|
+
t.assign(o, l), e.mergeValidEvaluated(O, o), g ? t.assign(g, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7136
7109
|
};
|
|
7137
7110
|
}
|
|
7138
7111
|
}
|
|
@@ -7185,37 +7158,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7185
7158
|
$data: !0,
|
|
7186
7159
|
error: error$1,
|
|
7187
7160
|
code(e, t) {
|
|
7188
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7161
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: g } = l;
|
|
7189
7162
|
if (!d.validateFormats)
|
|
7190
7163
|
return;
|
|
7191
7164
|
s ? O() : N();
|
|
7192
7165
|
function O() {
|
|
7193
7166
|
const R = r.scopeValue("formats", {
|
|
7194
|
-
ref:
|
|
7167
|
+
ref: g.formats,
|
|
7195
7168
|
code: d.code.formats
|
|
7196
|
-
}),
|
|
7197
|
-
r.if((0, codegen_1$1._)`typeof ${
|
|
7198
|
-
function
|
|
7199
|
-
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${
|
|
7169
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${R}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7170
|
+
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)($(), P()));
|
|
7171
|
+
function $() {
|
|
7172
|
+
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
7200
7173
|
}
|
|
7201
|
-
function
|
|
7202
|
-
const I = p.$async ? (0, codegen_1$1._)`(${
|
|
7203
|
-
return (0, codegen_1$1._)`${
|
|
7174
|
+
function P() {
|
|
7175
|
+
const I = p.$async ? (0, codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))` : (0, codegen_1$1._)`${_}(${n})`, D = (0, codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;
|
|
7176
|
+
return (0, codegen_1$1._)`${_} && ${_} !== true && ${y} === ${t} && !${D}`;
|
|
7204
7177
|
}
|
|
7205
7178
|
}
|
|
7206
7179
|
function N() {
|
|
7207
|
-
const R =
|
|
7180
|
+
const R = g.formats[i];
|
|
7208
7181
|
if (!R) {
|
|
7209
|
-
|
|
7182
|
+
$();
|
|
7210
7183
|
return;
|
|
7211
7184
|
}
|
|
7212
7185
|
if (R === !0)
|
|
7213
7186
|
return;
|
|
7214
|
-
const [
|
|
7215
|
-
|
|
7216
|
-
function
|
|
7187
|
+
const [T, y, _] = P(R);
|
|
7188
|
+
T === t && e.pass(I());
|
|
7189
|
+
function $() {
|
|
7217
7190
|
if (d.strictSchema === !1) {
|
|
7218
|
-
|
|
7191
|
+
g.logger.warn(D());
|
|
7219
7192
|
return;
|
|
7220
7193
|
}
|
|
7221
7194
|
throw new Error(D());
|
|
@@ -7223,7 +7196,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7223
7196
|
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7224
7197
|
}
|
|
7225
7198
|
}
|
|
7226
|
-
function
|
|
7199
|
+
function P(D) {
|
|
7227
7200
|
const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, k = r.scopeValue("formats", { key: i, ref: D, code: w });
|
|
7228
7201
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
7229
7202
|
}
|
|
@@ -7231,9 +7204,9 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7231
7204
|
if (typeof R == "object" && !(R instanceof RegExp) && R.async) {
|
|
7232
7205
|
if (!p.$async)
|
|
7233
7206
|
throw new Error("async format in sync schema");
|
|
7234
|
-
return (0, codegen_1$1._)`await ${
|
|
7207
|
+
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7235
7208
|
}
|
|
7236
|
-
return typeof
|
|
7209
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${_}(${n})` : (0, codegen_1$1._)`${_}.test(${n})`;
|
|
7237
7210
|
}
|
|
7238
7211
|
}
|
|
7239
7212
|
}
|
|
@@ -7301,41 +7274,41 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7301
7274
|
const N = O();
|
|
7302
7275
|
t.if(!1);
|
|
7303
7276
|
for (const R in N)
|
|
7304
|
-
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d,
|
|
7277
|
+
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d, g(N[R]));
|
|
7305
7278
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7306
7279
|
}
|
|
7307
|
-
function
|
|
7308
|
-
const R = t.name("valid"),
|
|
7309
|
-
return e.mergeEvaluated(
|
|
7280
|
+
function g(N) {
|
|
7281
|
+
const R = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: N }, R);
|
|
7282
|
+
return e.mergeEvaluated(T, codegen_1.Name), R;
|
|
7310
7283
|
}
|
|
7311
7284
|
function O() {
|
|
7312
7285
|
var N;
|
|
7313
|
-
const R = {},
|
|
7314
|
-
let
|
|
7286
|
+
const R = {}, T = _(s);
|
|
7287
|
+
let y = !0;
|
|
7315
7288
|
for (let I = 0; I < o.length; I++) {
|
|
7316
7289
|
let D = o[I];
|
|
7317
7290
|
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));
|
|
7318
7291
|
const w = (N = D == null ? void 0 : D.properties) === null || N === void 0 ? void 0 : N[l];
|
|
7319
7292
|
if (typeof w != "object")
|
|
7320
7293
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7321
|
-
|
|
7294
|
+
y = y && (T || _(D)), $(w, I);
|
|
7322
7295
|
}
|
|
7323
|
-
if (!
|
|
7296
|
+
if (!y)
|
|
7324
7297
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7325
7298
|
return R;
|
|
7326
|
-
function
|
|
7299
|
+
function _({ required: I }) {
|
|
7327
7300
|
return Array.isArray(I) && I.includes(l);
|
|
7328
7301
|
}
|
|
7329
|
-
function
|
|
7302
|
+
function $(I, D) {
|
|
7330
7303
|
if (I.const)
|
|
7331
|
-
|
|
7304
|
+
P(I.const, D);
|
|
7332
7305
|
else if (I.enum)
|
|
7333
7306
|
for (const w of I.enum)
|
|
7334
|
-
|
|
7307
|
+
P(w, D);
|
|
7335
7308
|
else
|
|
7336
7309
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7337
7310
|
}
|
|
7338
|
-
function
|
|
7311
|
+
function P(I, D) {
|
|
7339
7312
|
if (typeof I != "string" || I in R)
|
|
7340
7313
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7341
7314
|
R[I] = D;
|
|
@@ -7621,9 +7594,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7621
7594
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7622
7595
|
return p.CodeGen;
|
|
7623
7596
|
} });
|
|
7624
|
-
var
|
|
7597
|
+
var g = validation_error;
|
|
7625
7598
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7626
|
-
return
|
|
7599
|
+
return g.default;
|
|
7627
7600
|
} });
|
|
7628
7601
|
var O = ref_error;
|
|
7629
7602
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -7991,7 +7964,10 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7991
7964
|
},
|
|
7992
7965
|
SupportedPHPExtensionBundle: {
|
|
7993
7966
|
type: "string",
|
|
7994
|
-
|
|
7967
|
+
enum: [
|
|
7968
|
+
"kitchen-sink",
|
|
7969
|
+
"light"
|
|
7970
|
+
]
|
|
7995
7971
|
},
|
|
7996
7972
|
StepDefinition: {
|
|
7997
7973
|
type: "object",
|
|
@@ -8204,6 +8180,36 @@ for existing apps using this option.`
|
|
|
8204
8180
|
"step"
|
|
8205
8181
|
]
|
|
8206
8182
|
},
|
|
8183
|
+
{
|
|
8184
|
+
type: "object",
|
|
8185
|
+
additionalProperties: !1,
|
|
8186
|
+
properties: {
|
|
8187
|
+
progress: {
|
|
8188
|
+
type: "object",
|
|
8189
|
+
properties: {
|
|
8190
|
+
weight: {
|
|
8191
|
+
type: "number"
|
|
8192
|
+
},
|
|
8193
|
+
caption: {
|
|
8194
|
+
type: "string"
|
|
8195
|
+
}
|
|
8196
|
+
},
|
|
8197
|
+
additionalProperties: !1
|
|
8198
|
+
},
|
|
8199
|
+
step: {
|
|
8200
|
+
type: "string",
|
|
8201
|
+
const: "importWxr"
|
|
8202
|
+
},
|
|
8203
|
+
file: {
|
|
8204
|
+
$ref: "#/definitions/FileReference",
|
|
8205
|
+
description: "The file to import"
|
|
8206
|
+
}
|
|
8207
|
+
},
|
|
8208
|
+
required: [
|
|
8209
|
+
"file",
|
|
8210
|
+
"step"
|
|
8211
|
+
]
|
|
8212
|
+
},
|
|
8207
8213
|
{
|
|
8208
8214
|
type: "object",
|
|
8209
8215
|
additionalProperties: !1,
|
|
@@ -9199,7 +9205,8 @@ for existing apps using this option.`
|
|
|
9199
9205
|
definitions
|
|
9200
9206
|
}, { wpCLI, ...otherStepHandlers } = allStepHandlers, keyedStepHandlers = {
|
|
9201
9207
|
...otherStepHandlers,
|
|
9202
|
-
"wp-cli": wpCLI
|
|
9208
|
+
"wp-cli": wpCLI,
|
|
9209
|
+
importFile: otherStepHandlers.importWxr
|
|
9203
9210
|
};
|
|
9204
9211
|
function compileBlueprint(e, {
|
|
9205
9212
|
progress: t = new ProgressTracker(),
|
|
@@ -9207,39 +9214,46 @@ function compileBlueprint(e, {
|
|
|
9207
9214
|
onStepCompleted: n = () => {
|
|
9208
9215
|
}
|
|
9209
9216
|
} = {}) {
|
|
9210
|
-
var
|
|
9211
|
-
|
|
9217
|
+
var g, O, N, R, T, y, _;
|
|
9218
|
+
e = {
|
|
9212
9219
|
...e,
|
|
9213
9220
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
9214
|
-
}
|
|
9221
|
+
};
|
|
9222
|
+
for (const $ of e.steps)
|
|
9223
|
+
typeof $ == "object" && $.step === "importFile" && ($.step = "importWxr", console.warn(
|
|
9224
|
+
'The "importFile" step is deprecated. Use "importWxr" instead.'
|
|
9225
|
+
));
|
|
9226
|
+
if (e.constants && e.steps.unshift({
|
|
9215
9227
|
step: "defineWpConfigConsts",
|
|
9216
9228
|
consts: e.constants
|
|
9217
9229
|
}), e.siteOptions && e.steps.unshift({
|
|
9218
9230
|
step: "setSiteOptions",
|
|
9219
9231
|
options: e.siteOptions
|
|
9220
9232
|
}), e.plugins) {
|
|
9221
|
-
const
|
|
9233
|
+
const $ = e.plugins.map((P) => typeof P == "string" ? P.startsWith("https://") ? {
|
|
9222
9234
|
resource: "url",
|
|
9223
|
-
url:
|
|
9235
|
+
url: P
|
|
9224
9236
|
} : {
|
|
9225
9237
|
resource: "wordpress.org/plugins",
|
|
9226
|
-
slug:
|
|
9227
|
-
} :
|
|
9238
|
+
slug: P
|
|
9239
|
+
} : P).map((P) => ({
|
|
9228
9240
|
step: "installPlugin",
|
|
9229
|
-
pluginZipFile:
|
|
9241
|
+
pluginZipFile: P
|
|
9230
9242
|
}));
|
|
9231
|
-
e.steps.unshift(
|
|
9243
|
+
e.steps.unshift(...$);
|
|
9232
9244
|
}
|
|
9233
9245
|
e.login && e.steps.push({
|
|
9234
9246
|
step: "login",
|
|
9235
9247
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9236
|
-
});
|
|
9237
|
-
const s = (
|
|
9238
|
-
(
|
|
9248
|
+
}), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.length === 0 && e.phpExtensionBundles.push("kitchen-sink");
|
|
9249
|
+
const s = (g = e.steps) == null ? void 0 : g.findIndex(
|
|
9250
|
+
($) => typeof $ == "object" && ($ == null ? void 0 : $.step) === "wp-cli"
|
|
9239
9251
|
);
|
|
9240
|
-
s !== void 0 && s > -1 && (e.phpExtensionBundles
|
|
9241
|
-
|
|
9242
|
-
)
|
|
9252
|
+
s !== void 0 && s > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9253
|
+
($) => $ !== "light"
|
|
9254
|
+
), console.warn(
|
|
9255
|
+
"The wpCli 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. "
|
|
9256
|
+
)), (O = e.steps) == null || O.splice(s, 0, {
|
|
9243
9257
|
step: "writeFile",
|
|
9244
9258
|
data: {
|
|
9245
9259
|
resource: "url",
|
|
@@ -9257,34 +9271,49 @@ function compileBlueprint(e, {
|
|
|
9257
9271
|
},
|
|
9258
9272
|
path: "/tmp/wp-cli.phar"
|
|
9259
9273
|
}));
|
|
9260
|
-
const
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9274
|
+
const i = (N = e.steps) == null ? void 0 : N.findIndex(
|
|
9275
|
+
($) => typeof $ == "object" && ($ == null ? void 0 : $.step) === "importWxr"
|
|
9276
|
+
);
|
|
9277
|
+
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9278
|
+
($) => $ !== "light"
|
|
9279
|
+
), console.warn(
|
|
9280
|
+
"The importWxr 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. "
|
|
9281
|
+
)), (R = e.steps) == null || R.splice(i, 0, {
|
|
9282
|
+
step: "installPlugin",
|
|
9283
|
+
pluginZipFile: {
|
|
9284
|
+
resource: "url",
|
|
9285
|
+
url: "https://playground.wordpress.net/wordpress-importer.zip",
|
|
9286
|
+
caption: "Downloading the WordPress Importer plugin"
|
|
9287
|
+
}
|
|
9288
|
+
}));
|
|
9289
|
+
const { valid: o, errors: l } = validateBlueprint(e);
|
|
9290
|
+
if (!o) {
|
|
9291
|
+
const $ = new Error(
|
|
9292
|
+
`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`
|
|
9264
9293
|
);
|
|
9265
|
-
throw
|
|
9294
|
+
throw $.errors = l, $;
|
|
9266
9295
|
}
|
|
9267
|
-
const
|
|
9268
|
-
(
|
|
9269
|
-
var
|
|
9270
|
-
return
|
|
9296
|
+
const d = e.steps || [], u = d.reduce(
|
|
9297
|
+
($, P) => {
|
|
9298
|
+
var I;
|
|
9299
|
+
return $ + (((I = P.progress) == null ? void 0 : I.weight) || 1);
|
|
9271
9300
|
},
|
|
9272
9301
|
0
|
|
9273
|
-
),
|
|
9274
|
-
(
|
|
9302
|
+
), p = d.map(
|
|
9303
|
+
($) => compileStep($, {
|
|
9275
9304
|
semaphore: r,
|
|
9276
9305
|
rootProgressTracker: t,
|
|
9277
|
-
totalProgressWeight:
|
|
9306
|
+
totalProgressWeight: u
|
|
9278
9307
|
})
|
|
9279
9308
|
);
|
|
9280
9309
|
return {
|
|
9281
9310
|
versions: {
|
|
9282
9311
|
php: compileVersion(
|
|
9283
|
-
(
|
|
9312
|
+
(T = e.preferredVersions) == null ? void 0 : T.php,
|
|
9284
9313
|
SupportedPHPVersions,
|
|
9285
9314
|
LatestSupportedPHPVersion
|
|
9286
9315
|
),
|
|
9287
|
-
wp: ((
|
|
9316
|
+
wp: ((y = e.preferredVersions) == null ? void 0 : y.wp) || "latest"
|
|
9288
9317
|
},
|
|
9289
9318
|
phpExtensions: compilePHPExtensions(
|
|
9290
9319
|
[],
|
|
@@ -9292,28 +9321,28 @@ function compileBlueprint(e, {
|
|
|
9292
9321
|
),
|
|
9293
9322
|
features: {
|
|
9294
9323
|
// Disable networking by default
|
|
9295
|
-
networking: ((
|
|
9324
|
+
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9296
9325
|
},
|
|
9297
|
-
run: async (
|
|
9326
|
+
run: async ($) => {
|
|
9298
9327
|
try {
|
|
9299
|
-
for (const { resources:
|
|
9300
|
-
for (const
|
|
9301
|
-
|
|
9302
|
-
for (const [
|
|
9328
|
+
for (const { resources: P } of p)
|
|
9329
|
+
for (const I of P)
|
|
9330
|
+
I.setPlayground($), I.isAsync && I.resolve();
|
|
9331
|
+
for (const [P, { run: I, step: D }] of Object.entries(p))
|
|
9303
9332
|
try {
|
|
9304
|
-
const
|
|
9305
|
-
n(
|
|
9306
|
-
} catch (
|
|
9307
|
-
throw console.error(
|
|
9308
|
-
`Error when executing the blueprint step #${
|
|
9309
|
-
|
|
9310
|
-
)}) ${
|
|
9311
|
-
{ cause:
|
|
9333
|
+
const w = await I($);
|
|
9334
|
+
n(w, D);
|
|
9335
|
+
} catch (w) {
|
|
9336
|
+
throw console.error(w), new Error(
|
|
9337
|
+
`Error when executing the blueprint step #${P} (${JSON.stringify(
|
|
9338
|
+
D
|
|
9339
|
+
)}) ${w instanceof Error ? `: ${w.message}` : w}`,
|
|
9340
|
+
{ cause: w }
|
|
9312
9341
|
);
|
|
9313
9342
|
}
|
|
9314
9343
|
} finally {
|
|
9315
9344
|
try {
|
|
9316
|
-
await
|
|
9345
|
+
await $.goTo(
|
|
9317
9346
|
e.landingPage || "/"
|
|
9318
9347
|
);
|
|
9319
9348
|
} catch {
|
|
@@ -9365,17 +9394,17 @@ function compileStep(e, {
|
|
|
9365
9394
|
const s = r.stage(
|
|
9366
9395
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9367
9396
|
), i = {};
|
|
9368
|
-
for (const
|
|
9369
|
-
let O = e[
|
|
9397
|
+
for (const g of Object.keys(e)) {
|
|
9398
|
+
let O = e[g];
|
|
9370
9399
|
isFileReference(O) && (O = Resource.create(O, {
|
|
9371
9400
|
semaphore: t
|
|
9372
|
-
})), i[
|
|
9401
|
+
})), i[g] = O;
|
|
9373
9402
|
}
|
|
9374
|
-
const o = async (
|
|
9403
|
+
const o = async (g) => {
|
|
9375
9404
|
var O;
|
|
9376
9405
|
try {
|
|
9377
9406
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9378
|
-
|
|
9407
|
+
g,
|
|
9379
9408
|
await resolveArguments(i),
|
|
9380
9409
|
{
|
|
9381
9410
|
tracker: s,
|
|
@@ -9386,10 +9415,10 @@ function compileStep(e, {
|
|
|
9386
9415
|
s.finish();
|
|
9387
9416
|
}
|
|
9388
9417
|
}, l = getResources(i), d = getResources(i).filter(
|
|
9389
|
-
(
|
|
9418
|
+
(g) => g.isAsync
|
|
9390
9419
|
), u = 1 / (d.length + 1);
|
|
9391
|
-
for (const
|
|
9392
|
-
|
|
9420
|
+
for (const g of d)
|
|
9421
|
+
g.progress = s.stage(u);
|
|
9393
9422
|
return { run: o, step: e, resources: l };
|
|
9394
9423
|
}
|
|
9395
9424
|
function getResources(e) {
|
|
@@ -9422,9 +9451,8 @@ export {
|
|
|
9422
9451
|
defineWpConfigConsts,
|
|
9423
9452
|
enableMultisite,
|
|
9424
9453
|
exportWXR,
|
|
9425
|
-
exportWXZ,
|
|
9426
|
-
importFile,
|
|
9427
9454
|
importWordPressFiles,
|
|
9455
|
+
importWxr,
|
|
9428
9456
|
installPlugin,
|
|
9429
9457
|
installTheme,
|
|
9430
9458
|
login,
|