@wp-playground/blueprints 0.6.8 → 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 -5
- package/index.cjs +33 -23
- package/index.d.ts +11 -25
- package/index.js +1021 -1002
- 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/lib/steps/wp-cli.d.ts +1 -1
- package/package.json +2 -2
- package/schema-readme.md +1 -1
- 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
|
|
@@ -269,7 +268,6 @@ const activatePlugin = async (e, { pluginPath: t, pluginName: r }, n) => {
|
|
|
269
268
|
n == null || n.tracker.setCaption(`Activating ${r || t}`);
|
|
270
269
|
const s = await e.documentRoot;
|
|
271
270
|
await e.run({
|
|
272
|
-
throwOnError: !0,
|
|
273
271
|
code: `<?php
|
|
274
272
|
define( 'WP_ADMIN', true );
|
|
275
273
|
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
@@ -301,7 +299,6 @@ exit(1);
|
|
|
301
299
|
r == null || r.tracker.setCaption(`Activating ${t}`);
|
|
302
300
|
const n = await e.documentRoot;
|
|
303
301
|
await e.run({
|
|
304
|
-
throwOnError: !0,
|
|
305
302
|
code: `<?php
|
|
306
303
|
define( 'WP_ADMIN', true );
|
|
307
304
|
require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
@@ -312,7 +309,7 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
312
309
|
switch_theme( ${phpVar(t)} );
|
|
313
310
|
`
|
|
314
311
|
});
|
|
315
|
-
}, runPHP = async (e, { code: t }) => await e.run({ code: t
|
|
312
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
316
313
|
await e.unlink(t);
|
|
317
314
|
}, runSql = async (e, { sql: t }, r) => {
|
|
318
315
|
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
@@ -712,7 +709,6 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
712
709
|
consts: r
|
|
713
710
|
});
|
|
714
711
|
return await e.run({
|
|
715
|
-
throwOnError: !0,
|
|
716
712
|
code: `${rewriteWpConfigToDefineConstants}
|
|
717
713
|
$wp_config_path = '/tmp/code.php';
|
|
718
714
|
$wp_config = file_get_contents($wp_config_path);
|
|
@@ -745,7 +741,6 @@ const login = async (e, { username: t = "admin", password: r = "password" } = {}
|
|
|
745
741
|
}, setSiteOptions = async (e, { options: t }) => {
|
|
746
742
|
const r = await e.documentRoot;
|
|
747
743
|
await e.run({
|
|
748
|
-
throwOnError: !0,
|
|
749
744
|
code: `<?php
|
|
750
745
|
include ${phpVar(r)} . '/wp-load.php';
|
|
751
746
|
$site_options = ${phpVar(t)};
|
|
@@ -758,7 +753,6 @@ const login = async (e, { username: t = "admin", password: r = "password" } = {}
|
|
|
758
753
|
}, updateUserMeta = async (e, { meta: t, userId: r }) => {
|
|
759
754
|
const n = await e.documentRoot;
|
|
760
755
|
await e.run({
|
|
761
|
-
throwOnError: !0,
|
|
762
756
|
code: `<?php
|
|
763
757
|
include ${phpVar(n)} . '/wp-load.php';
|
|
764
758
|
$meta = ${phpVar(t)};
|
|
@@ -794,7 +788,6 @@ const enableMultisite = async (e) => {
|
|
|
794
788
|
}
|
|
795
789
|
}), await login(e, {});
|
|
796
790
|
const s = await e.documentRoot, o = (await e.run({
|
|
797
|
-
throwOnError: !0,
|
|
798
791
|
code: `<?php
|
|
799
792
|
define( 'WP_ADMIN', true );
|
|
800
793
|
require_once(${phpVar(s)} . "/wp-load.php");
|
|
@@ -865,14 +858,14 @@ echo json_encode($deactivated_plugins);
|
|
|
865
858
|
PATH_CURRENT_SITE: r
|
|
866
859
|
}
|
|
867
860
|
});
|
|
868
|
-
const p = new URL(await e.absoluteUrl),
|
|
861
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
869
862
|
await e.writeFile(
|
|
870
863
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
871
864
|
`<?php
|
|
872
865
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
873
866
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
874
867
|
}
|
|
875
|
-
$folder = ${phpVar(
|
|
868
|
+
$folder = ${phpVar(g)};
|
|
876
869
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
877
870
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
878
871
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -909,47 +902,27 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
909
902
|
WP_SITEURL: t
|
|
910
903
|
}
|
|
911
904
|
});
|
|
912
|
-
},
|
|
913
|
-
var
|
|
914
|
-
(
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
}), s = (p = DOM(n).getElementById("import-upload-form")) == null ? void 0 : p.getAttribute("action"), i = await e.request({
|
|
918
|
-
url: `/wp-admin/${s}`,
|
|
919
|
-
method: "POST",
|
|
920
|
-
body: { import: t }
|
|
921
|
-
}), o = DOM(i).querySelector(
|
|
922
|
-
"#wpbody-content form"
|
|
923
|
-
);
|
|
924
|
-
if (!o)
|
|
925
|
-
throw console.log(i.text), new Error(
|
|
926
|
-
"Could not find an importer form in response. See the response text above for details."
|
|
927
|
-
);
|
|
928
|
-
const l = getFormData(o);
|
|
929
|
-
l.fetch_attachments = "1";
|
|
930
|
-
for (const $ in l)
|
|
931
|
-
if ($.startsWith("user_map[")) {
|
|
932
|
-
const O = "user_new[" + $.slice(9, -1) + "]";
|
|
933
|
-
l[O] = "1";
|
|
934
|
-
}
|
|
935
|
-
const d = await e.request({
|
|
936
|
-
url: o.action,
|
|
937
|
-
method: "POST",
|
|
938
|
-
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
|
|
939
910
|
});
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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
|
|
953
926
|
|
|
954
927
|
function zipDir($root, $output, $options = array())
|
|
955
928
|
{
|
|
@@ -1035,7 +1008,6 @@ function delTree($dir)
|
|
|
1035
1008
|
`;
|
|
1036
1009
|
async function runPhpWithZipFunctions(e, t) {
|
|
1037
1010
|
return await e.run({
|
|
1038
|
-
throwOnError: !0,
|
|
1039
1011
|
code: zipFunctions + t
|
|
1040
1012
|
});
|
|
1041
1013
|
}
|
|
@@ -1071,13 +1043,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1071
1043
|
}), s = joinPaths(s, r);
|
|
1072
1044
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1073
1045
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1074
|
-
const
|
|
1046
|
+
const g = joinPaths(
|
|
1075
1047
|
i,
|
|
1076
1048
|
p
|
|
1077
1049
|
);
|
|
1078
|
-
await removePath(e,
|
|
1050
|
+
await removePath(e, g);
|
|
1079
1051
|
const O = joinPaths(o, p);
|
|
1080
|
-
await e.fileExists(O) && (await e.mkdir(dirname(
|
|
1052
|
+
await e.fileExists(O) && (await e.mkdir(dirname(g)), await e.mv(O, g));
|
|
1081
1053
|
}
|
|
1082
1054
|
const l = joinPaths(
|
|
1083
1055
|
s,
|
|
@@ -1101,7 +1073,6 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1101
1073
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1102
1074
|
);
|
|
1103
1075
|
await e.run({
|
|
1104
|
-
throwOnError: !0,
|
|
1105
1076
|
code: `<?php
|
|
1106
1077
|
$_GET['step'] = 'upgrade_db';
|
|
1107
1078
|
require ${u};
|
|
@@ -1117,12 +1088,6 @@ async function exportWXR(e) {
|
|
|
1117
1088
|
});
|
|
1118
1089
|
return new File([t.bytes], "export.xml");
|
|
1119
1090
|
}
|
|
1120
|
-
async function exportWXZ(e) {
|
|
1121
|
-
const t = await e.request({
|
|
1122
|
-
url: "/wp-admin/export.php?download=true&content=all&export_wxz=1"
|
|
1123
|
-
});
|
|
1124
|
-
return new File([t.bytes], "export.wxz");
|
|
1125
|
-
}
|
|
1126
1091
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1127
1092
|
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), o = joinPaths(i, randomString()), l = joinPaths(o, "assets", s);
|
|
1128
1093
|
await e.fileExists(l) && await e.rmdir(o, {
|
|
@@ -1138,10 +1103,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1138
1103
|
});
|
|
1139
1104
|
d = d.filter((N) => !N.endsWith("/__MACOSX"));
|
|
1140
1105
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1141
|
-
let p,
|
|
1142
|
-
u ? (
|
|
1106
|
+
let p, g = "";
|
|
1107
|
+
u ? (g = d[0], p = d[0].split("/").pop()) : (g = l, p = s);
|
|
1143
1108
|
const O = `${t}/${p}`;
|
|
1144
|
-
return await e.mv(
|
|
1109
|
+
return await e.mv(g, O), {
|
|
1145
1110
|
assetFolderPath: O,
|
|
1146
1111
|
assetFolderName: p
|
|
1147
1112
|
};
|
|
@@ -1286,9 +1251,8 @@ const allStepHandlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
1286
1251
|
defineWpConfigConsts,
|
|
1287
1252
|
enableMultisite,
|
|
1288
1253
|
exportWXR,
|
|
1289
|
-
exportWXZ,
|
|
1290
|
-
importFile,
|
|
1291
1254
|
importWordPressFiles,
|
|
1255
|
+
importWxr,
|
|
1292
1256
|
installPlugin,
|
|
1293
1257
|
installTheme,
|
|
1294
1258
|
login,
|
|
@@ -1732,7 +1696,8 @@ const SupportedPHPVersions = [
|
|
|
1732
1696
|
"xml-bundle",
|
|
1733
1697
|
"gd"
|
|
1734
1698
|
], SupportedPHPExtensionBundles = {
|
|
1735
|
-
"kitchen-sink": SupportedPHPExtensionsList
|
|
1699
|
+
"kitchen-sink": SupportedPHPExtensionsList,
|
|
1700
|
+
light: []
|
|
1736
1701
|
};
|
|
1737
1702
|
var Ae, Ge;
|
|
1738
1703
|
class PHPBrowser {
|
|
@@ -1860,7 +1825,7 @@ function fileToUint8Array(e) {
|
|
|
1860
1825
|
}, r.readAsArrayBuffer(e);
|
|
1861
1826
|
});
|
|
1862
1827
|
}
|
|
1863
|
-
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;
|
|
1864
1829
|
class PHPRequestHandler {
|
|
1865
1830
|
/**
|
|
1866
1831
|
* @param php - The PHP instance.
|
|
@@ -1891,7 +1856,7 @@ class PHPRequestHandler {
|
|
|
1891
1856
|
* @throws {Error} If the requested path doesn't exist.
|
|
1892
1857
|
* @returns The resolved filesystem path.
|
|
1893
1858
|
*/
|
|
1894
|
-
Q(this,
|
|
1859
|
+
Q(this, gt);
|
|
1895
1860
|
Q(this, Pe, void 0);
|
|
1896
1861
|
Q(this, Ke, void 0);
|
|
1897
1862
|
Q(this, dt, void 0);
|
|
@@ -1942,7 +1907,8 @@ class PHPRequestHandler {
|
|
|
1942
1907
|
/** @inheritDoc */
|
|
1943
1908
|
async request(t) {
|
|
1944
1909
|
const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
|
|
1945
|
-
|
|
1910
|
+
// Remove the hash part of the URL as it's not meant for the server.
|
|
1911
|
+
t.url.split("#")[0],
|
|
1946
1912
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1947
1913
|
), s = applyRewriteRules(
|
|
1948
1914
|
removePathPrefix(n.pathname, H(this, ve)),
|
|
@@ -2005,7 +1971,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2005
1971
|
}
|
|
2006
1972
|
let d;
|
|
2007
1973
|
try {
|
|
2008
|
-
d = ce(this,
|
|
1974
|
+
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2009
1975
|
} catch {
|
|
2010
1976
|
return new PHPResponse(
|
|
2011
1977
|
404,
|
|
@@ -2027,7 +1993,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2027
1993
|
} finally {
|
|
2028
1994
|
n();
|
|
2029
1995
|
}
|
|
2030
|
-
},
|
|
1996
|
+
}, gt = new WeakSet(), Bt = function(t) {
|
|
2031
1997
|
let r = removePathPrefix(t, H(this, ve));
|
|
2032
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";
|
|
2033
1999
|
const n = `${H(this, Pe)}${r}`;
|
|
@@ -2183,8 +2149,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2183
2149
|
} catch (l) {
|
|
2184
2150
|
const d = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2185
2151
|
if (d in FileErrorCodes) {
|
|
2186
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2187
|
-
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}`, {
|
|
2188
2154
|
cause: l
|
|
2189
2155
|
});
|
|
2190
2156
|
}
|
|
@@ -2207,7 +2173,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2207
2173
|
return n && s && __defProp(t, r, s), s;
|
|
2208
2174
|
};
|
|
2209
2175
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2210
|
-
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;
|
|
2211
2177
|
class BasePHP {
|
|
2212
2178
|
/**
|
|
2213
2179
|
* Initializes a PHP runtime.
|
|
@@ -2217,7 +2183,7 @@ class BasePHP {
|
|
|
2217
2183
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2218
2184
|
*/
|
|
2219
2185
|
constructor(e, t) {
|
|
2220
|
-
Q(this,
|
|
2186
|
+
Q(this, $t);
|
|
2221
2187
|
Q(this, yt);
|
|
2222
2188
|
Q(this, vt);
|
|
2223
2189
|
Q(this, wt);
|
|
@@ -2228,7 +2194,7 @@ class BasePHP {
|
|
|
2228
2194
|
Q(this, Rt);
|
|
2229
2195
|
Q(this, Tt);
|
|
2230
2196
|
Q(this, kt);
|
|
2231
|
-
Q(this,
|
|
2197
|
+
Q(this, Ct);
|
|
2232
2198
|
Q(this, Me, void 0);
|
|
2233
2199
|
Q(this, Ze, void 0);
|
|
2234
2200
|
Q(this, Ye, void 0);
|
|
@@ -2342,7 +2308,7 @@ class BasePHP {
|
|
|
2342
2308
|
const t = await this.semaphore.acquire();
|
|
2343
2309
|
let r;
|
|
2344
2310
|
try {
|
|
2345
|
-
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))
|
|
2346
2312
|
throw new Error(
|
|
2347
2313
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2348
2314
|
);
|
|
@@ -2352,8 +2318,8 @@ class BasePHP {
|
|
|
2352
2318
|
const i = e.env || {};
|
|
2353
2319
|
for (const l in i)
|
|
2354
2320
|
ce(this, Tt, rr).call(this, l, i[l]);
|
|
2355
|
-
const o = await ce(this,
|
|
2356
|
-
if (
|
|
2321
|
+
const o = await ce(this, Ct, sr).call(this);
|
|
2322
|
+
if (o.exitCode !== 0) {
|
|
2357
2323
|
const l = {
|
|
2358
2324
|
stdout: o.text,
|
|
2359
2325
|
stderr: o.errors
|
|
@@ -2362,13 +2328,15 @@ class BasePHP {
|
|
|
2362
2328
|
const d = new Error(
|
|
2363
2329
|
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2364
2330
|
);
|
|
2365
|
-
throw d.output = l, console.error(d), d;
|
|
2331
|
+
throw d.output = l, d.source = "request", console.error(d), d;
|
|
2366
2332
|
}
|
|
2367
2333
|
return o;
|
|
2368
2334
|
} catch (n) {
|
|
2369
2335
|
throw this.dispatchEvent({
|
|
2370
2336
|
type: "request.error",
|
|
2371
|
-
error: n
|
|
2337
|
+
error: n,
|
|
2338
|
+
// Distinguish between PHP request and PHP-wasm errors
|
|
2339
|
+
source: n.source ?? "php-wasm"
|
|
2372
2340
|
}), n;
|
|
2373
2341
|
} finally {
|
|
2374
2342
|
try {
|
|
@@ -2493,7 +2461,7 @@ class BasePHP {
|
|
|
2493
2461
|
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2494
2462
|
}
|
|
2495
2463
|
}
|
|
2496
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(),
|
|
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() {
|
|
2497
2465
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2498
2466
|
"/internal/consts.php",
|
|
2499
2467
|
`<?php
|
|
@@ -2651,7 +2619,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2651
2619
|
[STRING],
|
|
2652
2620
|
[e]
|
|
2653
2621
|
);
|
|
2654
|
-
},
|
|
2622
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
2655
2623
|
var s;
|
|
2656
2624
|
let e, t;
|
|
2657
2625
|
try {
|
|
@@ -2984,10 +2952,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2984
2952
|
}
|
|
2985
2953
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2986
2954
|
class r extends t {
|
|
2987
|
-
constructor(
|
|
2988
|
-
if (super(), !e.IDENTIFIER.test(
|
|
2955
|
+
constructor($) {
|
|
2956
|
+
if (super(), !e.IDENTIFIER.test($))
|
|
2989
2957
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
2990
|
-
this.str =
|
|
2958
|
+
this.str = $;
|
|
2991
2959
|
}
|
|
2992
2960
|
toString() {
|
|
2993
2961
|
return this.str;
|
|
@@ -3001,8 +2969,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3001
2969
|
}
|
|
3002
2970
|
e.Name = r;
|
|
3003
2971
|
class n extends t {
|
|
3004
|
-
constructor(
|
|
3005
|
-
super(), this._items = typeof
|
|
2972
|
+
constructor($) {
|
|
2973
|
+
super(), this._items = typeof $ == "string" ? [$] : $;
|
|
3006
2974
|
}
|
|
3007
2975
|
toString() {
|
|
3008
2976
|
return this.str;
|
|
@@ -3010,93 +2978,93 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3010
2978
|
emptyStr() {
|
|
3011
2979
|
if (this._items.length > 1)
|
|
3012
2980
|
return !1;
|
|
3013
|
-
const
|
|
3014
|
-
return
|
|
2981
|
+
const $ = this._items[0];
|
|
2982
|
+
return $ === "" || $ === '""';
|
|
3015
2983
|
}
|
|
3016
2984
|
get str() {
|
|
3017
|
-
var
|
|
3018
|
-
return (
|
|
2985
|
+
var $;
|
|
2986
|
+
return ($ = this._str) !== null && $ !== void 0 ? $ : this._str = this._items.reduce((P, I) => `${P}${I}`, "");
|
|
3019
2987
|
}
|
|
3020
2988
|
get names() {
|
|
3021
|
-
var
|
|
3022
|
-
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), {});
|
|
3023
2991
|
}
|
|
3024
2992
|
}
|
|
3025
2993
|
e._Code = n, e.nil = new n("");
|
|
3026
|
-
function s(
|
|
3027
|
-
const
|
|
2994
|
+
function s(_, ...$) {
|
|
2995
|
+
const P = [_[0]];
|
|
3028
2996
|
let I = 0;
|
|
3029
|
-
for (; I <
|
|
3030
|
-
l(
|
|
3031
|
-
return new n(
|
|
2997
|
+
for (; I < $.length; )
|
|
2998
|
+
l(P, $[I]), P.push(_[++I]);
|
|
2999
|
+
return new n(P);
|
|
3032
3000
|
}
|
|
3033
3001
|
e._ = s;
|
|
3034
3002
|
const i = new n("+");
|
|
3035
|
-
function o(
|
|
3036
|
-
const
|
|
3003
|
+
function o(_, ...$) {
|
|
3004
|
+
const P = [N(_[0])];
|
|
3037
3005
|
let I = 0;
|
|
3038
|
-
for (; I <
|
|
3039
|
-
|
|
3040
|
-
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);
|
|
3041
3009
|
}
|
|
3042
3010
|
e.str = o;
|
|
3043
|
-
function l(
|
|
3044
|
-
|
|
3011
|
+
function l(_, $) {
|
|
3012
|
+
$ instanceof n ? _.push(...$._items) : $ instanceof r ? _.push($) : _.push(g($));
|
|
3045
3013
|
}
|
|
3046
3014
|
e.addCodeArg = l;
|
|
3047
|
-
function d(
|
|
3048
|
-
let
|
|
3049
|
-
for (;
|
|
3050
|
-
if (
|
|
3051
|
-
const
|
|
3052
|
-
if (
|
|
3053
|
-
|
|
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);
|
|
3054
3022
|
continue;
|
|
3055
3023
|
}
|
|
3056
|
-
|
|
3024
|
+
_[$++] = "+";
|
|
3057
3025
|
}
|
|
3058
|
-
|
|
3026
|
+
$++;
|
|
3059
3027
|
}
|
|
3060
3028
|
}
|
|
3061
|
-
function u(
|
|
3062
|
-
if (
|
|
3063
|
-
return
|
|
3064
|
-
if (
|
|
3065
|
-
return
|
|
3066
|
-
if (typeof
|
|
3067
|
-
return
|
|
3068
|
-
if (typeof
|
|
3069
|
-
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)}`;
|
|
3070
3038
|
}
|
|
3071
|
-
function p(
|
|
3072
|
-
return
|
|
3039
|
+
function p(_, $) {
|
|
3040
|
+
return $.emptyStr() ? _ : _.emptyStr() ? $ : o`${_}${$}`;
|
|
3073
3041
|
}
|
|
3074
3042
|
e.strConcat = p;
|
|
3075
|
-
function
|
|
3076
|
-
return typeof
|
|
3043
|
+
function g(_) {
|
|
3044
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : N(Array.isArray(_) ? _.join(",") : _);
|
|
3077
3045
|
}
|
|
3078
|
-
function O(
|
|
3079
|
-
return new n(N(
|
|
3046
|
+
function O(_) {
|
|
3047
|
+
return new n(N(_));
|
|
3080
3048
|
}
|
|
3081
3049
|
e.stringify = O;
|
|
3082
|
-
function N(
|
|
3083
|
-
return JSON.stringify(
|
|
3050
|
+
function N(_) {
|
|
3051
|
+
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3084
3052
|
}
|
|
3085
3053
|
e.safeStringify = N;
|
|
3086
|
-
function R(
|
|
3087
|
-
return typeof
|
|
3054
|
+
function R(_) {
|
|
3055
|
+
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3088
3056
|
}
|
|
3089
3057
|
e.getProperty = R;
|
|
3090
|
-
function
|
|
3091
|
-
if (typeof
|
|
3092
|
-
return new n(`${
|
|
3093
|
-
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`);
|
|
3094
3062
|
}
|
|
3095
|
-
e.getEsmExportName =
|
|
3096
|
-
function
|
|
3097
|
-
return new n(
|
|
3063
|
+
e.getEsmExportName = T;
|
|
3064
|
+
function y(_) {
|
|
3065
|
+
return new n(_.toString());
|
|
3098
3066
|
}
|
|
3099
|
-
e.regexpCode =
|
|
3067
|
+
e.regexpCode = y;
|
|
3100
3068
|
})(code$1);
|
|
3101
3069
|
var scope = {};
|
|
3102
3070
|
(function(e) {
|
|
@@ -3130,8 +3098,8 @@ var scope = {};
|
|
|
3130
3098
|
return `${u}${p.index++}`;
|
|
3131
3099
|
}
|
|
3132
3100
|
_nameGroup(u) {
|
|
3133
|
-
var p,
|
|
3134
|
-
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))
|
|
3135
3103
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3136
3104
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3137
3105
|
}
|
|
@@ -3141,8 +3109,8 @@ var scope = {};
|
|
|
3141
3109
|
constructor(u, p) {
|
|
3142
3110
|
super(p), this.prefix = u;
|
|
3143
3111
|
}
|
|
3144
|
-
setValue(u, { property: p, itemIndex:
|
|
3145
|
-
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}]`;
|
|
3146
3114
|
}
|
|
3147
3115
|
}
|
|
3148
3116
|
e.ValueScopeName = i;
|
|
@@ -3158,60 +3126,60 @@ var scope = {};
|
|
|
3158
3126
|
return new i(u, this._newName(u));
|
|
3159
3127
|
}
|
|
3160
3128
|
value(u, p) {
|
|
3161
|
-
var
|
|
3129
|
+
var g;
|
|
3162
3130
|
if (p.ref === void 0)
|
|
3163
3131
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3164
|
-
const O = this.toName(u), { prefix: N } = O, R = (
|
|
3165
|
-
let
|
|
3166
|
-
if (
|
|
3167
|
-
const
|
|
3168
|
-
if (
|
|
3169
|
-
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 $;
|
|
3170
3138
|
} else
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
const
|
|
3174
|
-
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;
|
|
3175
3143
|
}
|
|
3176
3144
|
getValue(u, p) {
|
|
3177
|
-
const
|
|
3178
|
-
if (
|
|
3179
|
-
return
|
|
3145
|
+
const g = this._values[u];
|
|
3146
|
+
if (g)
|
|
3147
|
+
return g.get(p);
|
|
3180
3148
|
}
|
|
3181
3149
|
scopeRefs(u, p = this._values) {
|
|
3182
|
-
return this._reduceValues(p, (
|
|
3183
|
-
if (
|
|
3184
|
-
throw new Error(`CodeGen: name "${
|
|
3185
|
-
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}`;
|
|
3186
3154
|
});
|
|
3187
3155
|
}
|
|
3188
|
-
scopeCode(u = this._values, p,
|
|
3156
|
+
scopeCode(u = this._values, p, g) {
|
|
3189
3157
|
return this._reduceValues(u, (O) => {
|
|
3190
3158
|
if (O.value === void 0)
|
|
3191
3159
|
throw new Error(`CodeGen: name "${O}" has no value`);
|
|
3192
3160
|
return O.value.code;
|
|
3193
|
-
}, p,
|
|
3161
|
+
}, p, g);
|
|
3194
3162
|
}
|
|
3195
|
-
_reduceValues(u, p,
|
|
3163
|
+
_reduceValues(u, p, g = {}, O) {
|
|
3196
3164
|
let N = t.nil;
|
|
3197
3165
|
for (const R in u) {
|
|
3198
|
-
const
|
|
3199
|
-
if (!
|
|
3166
|
+
const T = u[R];
|
|
3167
|
+
if (!T)
|
|
3200
3168
|
continue;
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3203
|
-
if (
|
|
3169
|
+
const y = g[R] = g[R] || /* @__PURE__ */ new Map();
|
|
3170
|
+
T.forEach((_) => {
|
|
3171
|
+
if (y.has(_))
|
|
3204
3172
|
return;
|
|
3205
|
-
|
|
3206
|
-
let
|
|
3207
|
-
if (
|
|
3208
|
-
const
|
|
3209
|
-
N = (0, t._)`${N}${
|
|
3210
|
-
} else if (
|
|
3211
|
-
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}`;
|
|
3212
3180
|
else
|
|
3213
|
-
throw new r(
|
|
3214
|
-
|
|
3181
|
+
throw new r(_);
|
|
3182
|
+
y.set(_, n.Completed);
|
|
3215
3183
|
});
|
|
3216
3184
|
}
|
|
3217
3185
|
return N;
|
|
@@ -3325,7 +3293,7 @@ var scope = {};
|
|
|
3325
3293
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3326
3294
|
}
|
|
3327
3295
|
}
|
|
3328
|
-
class
|
|
3296
|
+
class g extends i {
|
|
3329
3297
|
constructor(a) {
|
|
3330
3298
|
super(), this.error = a;
|
|
3331
3299
|
}
|
|
@@ -3387,12 +3355,12 @@ var scope = {};
|
|
|
3387
3355
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3388
3356
|
}
|
|
3389
3357
|
}
|
|
3390
|
-
class
|
|
3358
|
+
class T extends N {
|
|
3391
3359
|
}
|
|
3392
|
-
class
|
|
3360
|
+
class y extends R {
|
|
3393
3361
|
}
|
|
3394
|
-
|
|
3395
|
-
class
|
|
3362
|
+
y.kind = "else";
|
|
3363
|
+
class _ extends R {
|
|
3396
3364
|
constructor(a, h) {
|
|
3397
3365
|
super(h), this.condition = a;
|
|
3398
3366
|
}
|
|
@@ -3408,10 +3376,10 @@ var scope = {};
|
|
|
3408
3376
|
let h = this.else;
|
|
3409
3377
|
if (h) {
|
|
3410
3378
|
const C = h.optimizeNodes();
|
|
3411
|
-
h = this.else = Array.isArray(C) ? new
|
|
3379
|
+
h = this.else = Array.isArray(C) ? new y(C) : C;
|
|
3412
3380
|
}
|
|
3413
3381
|
if (h)
|
|
3414
|
-
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);
|
|
3415
3383
|
if (!(a === !1 || !this.nodes.length))
|
|
3416
3384
|
return this;
|
|
3417
3385
|
}
|
|
@@ -3425,11 +3393,11 @@ var scope = {};
|
|
|
3425
3393
|
return ue(a, this.condition), this.else && K(a, this.else.names), a;
|
|
3426
3394
|
}
|
|
3427
3395
|
}
|
|
3428
|
-
|
|
3429
|
-
class
|
|
3396
|
+
_.kind = "if";
|
|
3397
|
+
class $ extends R {
|
|
3430
3398
|
}
|
|
3431
|
-
|
|
3432
|
-
class
|
|
3399
|
+
$.kind = "for";
|
|
3400
|
+
class P extends $ {
|
|
3433
3401
|
constructor(a) {
|
|
3434
3402
|
super(), this.iteration = a;
|
|
3435
3403
|
}
|
|
@@ -3444,7 +3412,7 @@ var scope = {};
|
|
|
3444
3412
|
return K(super.names, this.iteration.names);
|
|
3445
3413
|
}
|
|
3446
3414
|
}
|
|
3447
|
-
class I extends
|
|
3415
|
+
class I extends $ {
|
|
3448
3416
|
constructor(a, h, C, M) {
|
|
3449
3417
|
super(), this.varKind = a, this.name = h, this.from = C, this.to = M;
|
|
3450
3418
|
}
|
|
@@ -3457,7 +3425,7 @@ var scope = {};
|
|
|
3457
3425
|
return ue(a, this.to);
|
|
3458
3426
|
}
|
|
3459
3427
|
}
|
|
3460
|
-
class D extends
|
|
3428
|
+
class D extends $ {
|
|
3461
3429
|
constructor(a, h, C, M) {
|
|
3462
3430
|
super(), this.loop = a, this.varKind = h, this.name = C, this.iterable = M;
|
|
3463
3431
|
}
|
|
@@ -3523,7 +3491,7 @@ var scope = {};
|
|
|
3523
3491
|
class re {
|
|
3524
3492
|
constructor(a, h = {}) {
|
|
3525
3493
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3526
|
-
` : "" }, 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()];
|
|
3527
3495
|
}
|
|
3528
3496
|
toString() {
|
|
3529
3497
|
return this._root.render(this.opts);
|
|
@@ -3589,7 +3557,7 @@ var scope = {};
|
|
|
3589
3557
|
}
|
|
3590
3558
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3591
3559
|
if(a, h, C) {
|
|
3592
|
-
if (this._blockNode(new
|
|
3560
|
+
if (this._blockNode(new _(a)), h && C)
|
|
3593
3561
|
this.code(h).else().code(C).endIf();
|
|
3594
3562
|
else if (h)
|
|
3595
3563
|
this.code(h).endIf();
|
|
@@ -3599,22 +3567,22 @@ var scope = {};
|
|
|
3599
3567
|
}
|
|
3600
3568
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
3601
3569
|
elseIf(a) {
|
|
3602
|
-
return this._elseNode(new
|
|
3570
|
+
return this._elseNode(new _(a));
|
|
3603
3571
|
}
|
|
3604
3572
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3605
3573
|
else() {
|
|
3606
|
-
return this._elseNode(new
|
|
3574
|
+
return this._elseNode(new y());
|
|
3607
3575
|
}
|
|
3608
3576
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3609
3577
|
endIf() {
|
|
3610
|
-
return this._endBlockNode(
|
|
3578
|
+
return this._endBlockNode(_, y);
|
|
3611
3579
|
}
|
|
3612
3580
|
_for(a, h) {
|
|
3613
3581
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
3614
3582
|
}
|
|
3615
3583
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3616
3584
|
for(a, h) {
|
|
3617
|
-
return this._for(new
|
|
3585
|
+
return this._for(new P(a), h);
|
|
3618
3586
|
}
|
|
3619
3587
|
// `for` statement for a range of values
|
|
3620
3588
|
forRange(a, h, C, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
@@ -3642,7 +3610,7 @@ var scope = {};
|
|
|
3642
3610
|
}
|
|
3643
3611
|
// end `for` loop
|
|
3644
3612
|
endFor() {
|
|
3645
|
-
return this._endBlockNode(
|
|
3613
|
+
return this._endBlockNode($);
|
|
3646
3614
|
}
|
|
3647
3615
|
// `label` statement
|
|
3648
3616
|
label(a) {
|
|
@@ -3672,7 +3640,7 @@ var scope = {};
|
|
|
3672
3640
|
}
|
|
3673
3641
|
// `throw` statement
|
|
3674
3642
|
throw(a) {
|
|
3675
|
-
return this._leafNode(new
|
|
3643
|
+
return this._leafNode(new g(a));
|
|
3676
3644
|
}
|
|
3677
3645
|
// start self-balancing block
|
|
3678
3646
|
block(a, h) {
|
|
@@ -3714,7 +3682,7 @@ var scope = {};
|
|
|
3714
3682
|
}
|
|
3715
3683
|
_elseNode(a) {
|
|
3716
3684
|
const h = this._currNode;
|
|
3717
|
-
if (!(h instanceof
|
|
3685
|
+
if (!(h instanceof _))
|
|
3718
3686
|
throw new Error('CodeGen: "else" without "if"');
|
|
3719
3687
|
return this._currNode = h.else = a, this;
|
|
3720
3688
|
}
|
|
@@ -3731,20 +3699,20 @@ var scope = {};
|
|
|
3731
3699
|
}
|
|
3732
3700
|
}
|
|
3733
3701
|
e.CodeGen = re;
|
|
3734
|
-
function K(
|
|
3702
|
+
function K(b, a) {
|
|
3735
3703
|
for (const h in a)
|
|
3736
|
-
|
|
3737
|
-
return
|
|
3738
|
-
}
|
|
3739
|
-
function ue(
|
|
3740
|
-
return a instanceof t._CodeOrName ? K(
|
|
3741
|
-
}
|
|
3742
|
-
function oe(
|
|
3743
|
-
if (
|
|
3744
|
-
return C(
|
|
3745
|
-
if (!M(
|
|
3746
|
-
return
|
|
3747
|
-
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), []));
|
|
3748
3716
|
function C(q) {
|
|
3749
3717
|
const W = h[q.str];
|
|
3750
3718
|
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
@@ -3753,29 +3721,29 @@ var scope = {};
|
|
|
3753
3721
|
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3754
3722
|
}
|
|
3755
3723
|
}
|
|
3756
|
-
function ke(
|
|
3724
|
+
function ke(b, a) {
|
|
3757
3725
|
for (const h in a)
|
|
3758
|
-
|
|
3726
|
+
b[h] = (b[h] || 0) - (a[h] || 0);
|
|
3759
3727
|
}
|
|
3760
|
-
function
|
|
3761
|
-
return typeof
|
|
3728
|
+
function Ce(b) {
|
|
3729
|
+
return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
|
|
3762
3730
|
}
|
|
3763
|
-
e.not =
|
|
3764
|
-
const qe =
|
|
3765
|
-
function et(...
|
|
3766
|
-
return
|
|
3731
|
+
e.not = Ce;
|
|
3732
|
+
const qe = v(e.operators.AND);
|
|
3733
|
+
function et(...b) {
|
|
3734
|
+
return b.reduce(qe);
|
|
3767
3735
|
}
|
|
3768
3736
|
e.and = et;
|
|
3769
|
-
const Ue =
|
|
3770
|
-
function F(...
|
|
3771
|
-
return
|
|
3737
|
+
const Ue = v(e.operators.OR);
|
|
3738
|
+
function F(...b) {
|
|
3739
|
+
return b.reduce(Ue);
|
|
3772
3740
|
}
|
|
3773
3741
|
e.or = F;
|
|
3774
|
-
function
|
|
3775
|
-
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)}`;
|
|
3776
3744
|
}
|
|
3777
|
-
function j(
|
|
3778
|
-
return
|
|
3745
|
+
function j(b) {
|
|
3746
|
+
return b instanceof t.Name ? b : (0, t._)`(${b})`;
|
|
3779
3747
|
}
|
|
3780
3748
|
})(codegen);
|
|
3781
3749
|
var util = {};
|
|
@@ -3835,13 +3803,13 @@ var util = {};
|
|
|
3835
3803
|
}
|
|
3836
3804
|
e.unescapeFragment = u;
|
|
3837
3805
|
function p(w) {
|
|
3838
|
-
return encodeURIComponent(
|
|
3806
|
+
return encodeURIComponent(g(w));
|
|
3839
3807
|
}
|
|
3840
3808
|
e.escapeFragment = p;
|
|
3841
|
-
function
|
|
3809
|
+
function g(w) {
|
|
3842
3810
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3843
3811
|
}
|
|
3844
|
-
e.escapeJsonPointer =
|
|
3812
|
+
e.escapeJsonPointer = g;
|
|
3845
3813
|
function O(w) {
|
|
3846
3814
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3847
3815
|
}
|
|
@@ -3866,10 +3834,10 @@ var util = {};
|
|
|
3866
3834
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3867
3835
|
}),
|
|
3868
3836
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3869
|
-
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));
|
|
3870
3838
|
}),
|
|
3871
3839
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3872
|
-
resultToName:
|
|
3840
|
+
resultToName: T
|
|
3873
3841
|
}),
|
|
3874
3842
|
items: R({
|
|
3875
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}`)),
|
|
@@ -3878,35 +3846,35 @@ var util = {};
|
|
|
3878
3846
|
resultToName: (w, k) => w.var("items", k)
|
|
3879
3847
|
})
|
|
3880
3848
|
};
|
|
3881
|
-
function
|
|
3849
|
+
function T(w, k) {
|
|
3882
3850
|
if (k === !0)
|
|
3883
3851
|
return w.var("props", !0);
|
|
3884
3852
|
const A = w.var("props", (0, t._)`{}`);
|
|
3885
|
-
return k !== void 0 &&
|
|
3853
|
+
return k !== void 0 && y(w, A, k), A;
|
|
3886
3854
|
}
|
|
3887
|
-
e.evaluatedPropsToName =
|
|
3888
|
-
function
|
|
3855
|
+
e.evaluatedPropsToName = T;
|
|
3856
|
+
function y(w, k, A) {
|
|
3889
3857
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${k}${(0, t.getProperty)(V)}`, !0));
|
|
3890
3858
|
}
|
|
3891
|
-
e.setEvaluated =
|
|
3892
|
-
const
|
|
3893
|
-
function
|
|
3859
|
+
e.setEvaluated = y;
|
|
3860
|
+
const _ = {};
|
|
3861
|
+
function $(w, k) {
|
|
3894
3862
|
return w.scopeValue("func", {
|
|
3895
3863
|
ref: k,
|
|
3896
|
-
code:
|
|
3864
|
+
code: _[k.code] || (_[k.code] = new r._Code(k.code))
|
|
3897
3865
|
});
|
|
3898
3866
|
}
|
|
3899
|
-
e.useFunc =
|
|
3900
|
-
var
|
|
3867
|
+
e.useFunc = $;
|
|
3868
|
+
var P;
|
|
3901
3869
|
(function(w) {
|
|
3902
3870
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3903
|
-
})(
|
|
3871
|
+
})(P = e.Type || (e.Type = {}));
|
|
3904
3872
|
function I(w, k, A) {
|
|
3905
3873
|
if (w instanceof t.Name) {
|
|
3906
|
-
const V = k ===
|
|
3874
|
+
const V = k === P.Num;
|
|
3907
3875
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3908
3876
|
}
|
|
3909
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3877
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3910
3878
|
}
|
|
3911
3879
|
e.getErrorPath = I;
|
|
3912
3880
|
function D(w, k, A = w.opts.strictSchema) {
|
|
@@ -3948,40 +3916,40 @@ names$1.default = names;
|
|
|
3948
3916
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3949
3917
|
const t = codegen, r = util, n = names$1;
|
|
3950
3918
|
e.keywordError = {
|
|
3951
|
-
message: ({ keyword:
|
|
3919
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3952
3920
|
}, e.keyword$DataError = {
|
|
3953
|
-
message: ({ keyword:
|
|
3921
|
+
message: ({ keyword: y, schemaType: _ }) => _ ? (0, t.str)`"${y}" keyword must be ${_} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3954
3922
|
};
|
|
3955
|
-
function s(
|
|
3956
|
-
const { it: I } =
|
|
3957
|
-
|
|
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}]`);
|
|
3958
3926
|
}
|
|
3959
3927
|
e.reportError = s;
|
|
3960
|
-
function i(
|
|
3961
|
-
const { it:
|
|
3962
|
-
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);
|
|
3963
3931
|
}
|
|
3964
3932
|
e.reportExtraError = i;
|
|
3965
|
-
function o(
|
|
3966
|
-
|
|
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)));
|
|
3967
3935
|
}
|
|
3968
3936
|
e.resetErrorsCount = o;
|
|
3969
|
-
function l({ gen:
|
|
3937
|
+
function l({ gen: y, keyword: _, schemaValue: $, data: P, errsCount: I, it: D }) {
|
|
3970
3938
|
if (I === void 0)
|
|
3971
3939
|
throw new Error("ajv implementation error");
|
|
3972
|
-
const w =
|
|
3973
|
-
|
|
3974
|
-
|
|
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));
|
|
3975
3943
|
});
|
|
3976
3944
|
}
|
|
3977
3945
|
e.extendErrors = l;
|
|
3978
|
-
function d(
|
|
3979
|
-
const
|
|
3980
|
-
|
|
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}++`);
|
|
3981
3949
|
}
|
|
3982
|
-
function u(
|
|
3983
|
-
const { gen:
|
|
3984
|
-
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));
|
|
3985
3953
|
}
|
|
3986
3954
|
const p = {
|
|
3987
3955
|
keyword: new t.Name("keyword"),
|
|
@@ -3992,28 +3960,28 @@ names$1.default = names;
|
|
|
3992
3960
|
schema: new t.Name("schema"),
|
|
3993
3961
|
parentSchema: new t.Name("parentSchema")
|
|
3994
3962
|
};
|
|
3995
|
-
function
|
|
3996
|
-
const { createErrors:
|
|
3997
|
-
return
|
|
3998
|
-
}
|
|
3999
|
-
function O(
|
|
4000
|
-
const { gen:
|
|
4001
|
-
N(I,
|
|
4002
|
-
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, $)
|
|
4003
3971
|
];
|
|
4004
|
-
return
|
|
3972
|
+
return T(y, _, D), P.object(...D);
|
|
4005
3973
|
}
|
|
4006
|
-
function N({ errorPath:
|
|
4007
|
-
const
|
|
4008
|
-
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, $)];
|
|
4009
3977
|
}
|
|
4010
|
-
function R({ keyword:
|
|
4011
|
-
let I =
|
|
4012
|
-
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];
|
|
4013
3981
|
}
|
|
4014
|
-
function
|
|
4015
|
-
const { keyword: I, data: D, schemaValue: w, it: k } =
|
|
4016
|
-
|
|
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]);
|
|
4017
3985
|
}
|
|
4018
3986
|
})(errors);
|
|
4019
3987
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4089,51 +4057,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4089
4057
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4090
4058
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4091
4059
|
var o;
|
|
4092
|
-
(function(
|
|
4093
|
-
|
|
4060
|
+
(function(P) {
|
|
4061
|
+
P[P.Correct = 0] = "Correct", P[P.Wrong = 1] = "Wrong";
|
|
4094
4062
|
})(o = e.DataType || (e.DataType = {}));
|
|
4095
|
-
function l(
|
|
4096
|
-
const I = d(
|
|
4063
|
+
function l(P) {
|
|
4064
|
+
const I = d(P.type);
|
|
4097
4065
|
if (I.includes("null")) {
|
|
4098
|
-
if (
|
|
4066
|
+
if (P.nullable === !1)
|
|
4099
4067
|
throw new Error("type: null contradicts nullable: false");
|
|
4100
4068
|
} else {
|
|
4101
|
-
if (!I.length &&
|
|
4069
|
+
if (!I.length && P.nullable !== void 0)
|
|
4102
4070
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4103
|
-
|
|
4071
|
+
P.nullable === !0 && I.push("null");
|
|
4104
4072
|
}
|
|
4105
4073
|
return I;
|
|
4106
4074
|
}
|
|
4107
4075
|
e.getSchemaTypes = l;
|
|
4108
|
-
function d(
|
|
4109
|
-
const I = Array.isArray(
|
|
4076
|
+
function d(P) {
|
|
4077
|
+
const I = Array.isArray(P) ? P : P ? [P] : [];
|
|
4110
4078
|
if (I.every(t.isJSONType))
|
|
4111
4079
|
return I;
|
|
4112
4080
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4113
4081
|
}
|
|
4114
4082
|
e.getJSONTypes = d;
|
|
4115
|
-
function u(
|
|
4116
|
-
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]));
|
|
4117
4085
|
if (V) {
|
|
4118
|
-
const x =
|
|
4086
|
+
const x = T(I, w, k.strictNumbers, o.Wrong);
|
|
4119
4087
|
D.if(x, () => {
|
|
4120
|
-
A.length ? O(
|
|
4088
|
+
A.length ? O(P, I, A) : _(P);
|
|
4121
4089
|
});
|
|
4122
4090
|
}
|
|
4123
4091
|
return V;
|
|
4124
4092
|
}
|
|
4125
4093
|
e.coerceAndCheckDataType = u;
|
|
4126
4094
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4127
|
-
function
|
|
4128
|
-
return I ?
|
|
4095
|
+
function g(P, I) {
|
|
4096
|
+
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4129
4097
|
}
|
|
4130
|
-
function O(
|
|
4131
|
-
const { gen: w, data: k, opts: A } =
|
|
4132
|
-
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`);
|
|
4133
4101
|
for (const K of D)
|
|
4134
4102
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4135
|
-
w.else(),
|
|
4136
|
-
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);
|
|
4137
4105
|
});
|
|
4138
4106
|
function re(K) {
|
|
4139
4107
|
switch (K) {
|
|
@@ -4160,13 +4128,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4160
4128
|
}
|
|
4161
4129
|
}
|
|
4162
4130
|
}
|
|
4163
|
-
function N({ gen:
|
|
4164
|
-
|
|
4131
|
+
function N({ gen: P, parentData: I, parentDataProperty: D }, w) {
|
|
4132
|
+
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
|
|
4165
4133
|
}
|
|
4166
|
-
function R(
|
|
4134
|
+
function R(P, I, D, w = o.Correct) {
|
|
4167
4135
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4168
4136
|
let A;
|
|
4169
|
-
switch (
|
|
4137
|
+
switch (P) {
|
|
4170
4138
|
case "null":
|
|
4171
4139
|
return (0, s._)`${I} ${k} null`;
|
|
4172
4140
|
case "array":
|
|
@@ -4182,7 +4150,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4182
4150
|
A = V();
|
|
4183
4151
|
break;
|
|
4184
4152
|
default:
|
|
4185
|
-
return (0, s._)`typeof ${I} ${k} ${
|
|
4153
|
+
return (0, s._)`typeof ${I} ${k} ${P}`;
|
|
4186
4154
|
}
|
|
4187
4155
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4188
4156
|
function V(x = s.nil) {
|
|
@@ -4190,11 +4158,11 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4190
4158
|
}
|
|
4191
4159
|
}
|
|
4192
4160
|
e.checkDataType = R;
|
|
4193
|
-
function
|
|
4194
|
-
if (
|
|
4195
|
-
return R(
|
|
4161
|
+
function T(P, I, D, w) {
|
|
4162
|
+
if (P.length === 1)
|
|
4163
|
+
return R(P[0], I, D, w);
|
|
4196
4164
|
let k;
|
|
4197
|
-
const A = (0, i.toHash)(
|
|
4165
|
+
const A = (0, i.toHash)(P);
|
|
4198
4166
|
if (A.array && A.object) {
|
|
4199
4167
|
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4200
4168
|
k = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
@@ -4205,18 +4173,18 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4205
4173
|
k = (0, s.and)(k, R(V, I, D, w));
|
|
4206
4174
|
return k;
|
|
4207
4175
|
}
|
|
4208
|
-
e.checkDataTypes =
|
|
4209
|
-
const
|
|
4210
|
-
message: ({ schema:
|
|
4211
|
-
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}}`
|
|
4212
4180
|
};
|
|
4213
|
-
function
|
|
4214
|
-
const I =
|
|
4215
|
-
(0, n.reportError)(I,
|
|
4181
|
+
function _(P) {
|
|
4182
|
+
const I = $(P);
|
|
4183
|
+
(0, n.reportError)(I, y);
|
|
4216
4184
|
}
|
|
4217
|
-
e.reportTypeError =
|
|
4218
|
-
function
|
|
4219
|
-
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");
|
|
4220
4188
|
return {
|
|
4221
4189
|
gen: I,
|
|
4222
4190
|
keyword: "type",
|
|
@@ -4226,7 +4194,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4226
4194
|
schemaValue: k,
|
|
4227
4195
|
parentSchema: w,
|
|
4228
4196
|
params: {},
|
|
4229
|
-
it:
|
|
4197
|
+
it: P
|
|
4230
4198
|
};
|
|
4231
4199
|
}
|
|
4232
4200
|
})(dataType);
|
|
@@ -4305,14 +4273,14 @@ function schemaProperties(e, t) {
|
|
|
4305
4273
|
}
|
|
4306
4274
|
code.schemaProperties = schemaProperties;
|
|
4307
4275
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, l, d, u) {
|
|
4308
|
-
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 = [
|
|
4309
4277
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4310
4278
|
[names_1$5.default.parentData, o.parentData],
|
|
4311
4279
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4312
4280
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4313
4281
|
];
|
|
4314
|
-
o.opts.dynamicRef &&
|
|
4315
|
-
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)}`;
|
|
4316
4284
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${O})` : (0, codegen_1$q._)`${l}(${O})`;
|
|
4317
4285
|
}
|
|
4318
4286
|
code.callValidateCode = callValidateCode;
|
|
@@ -4382,31 +4350,31 @@ function funcKeywordCode(e, t) {
|
|
|
4382
4350
|
var r;
|
|
4383
4351
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4384
4352
|
checkAsyncKeyword(d, t);
|
|
4385
|
-
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4386
|
-
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);
|
|
4387
4355
|
function O() {
|
|
4388
4356
|
if (t.errors === !1)
|
|
4389
|
-
|
|
4357
|
+
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
4390
4358
|
else {
|
|
4391
|
-
const
|
|
4392
|
-
t.modifying && modifyData(e),
|
|
4359
|
+
const _ = t.async ? N() : R();
|
|
4360
|
+
t.modifying && modifyData(e), y(() => addErrs(e, _));
|
|
4393
4361
|
}
|
|
4394
4362
|
}
|
|
4395
4363
|
function N() {
|
|
4396
|
-
const
|
|
4397
|
-
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($))), _;
|
|
4398
4366
|
}
|
|
4399
4367
|
function R() {
|
|
4400
|
-
const
|
|
4401
|
-
return n.assign(
|
|
4368
|
+
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4369
|
+
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4402
4370
|
}
|
|
4403
|
-
function
|
|
4404
|
-
const
|
|
4405
|
-
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);
|
|
4406
4374
|
}
|
|
4407
|
-
function
|
|
4408
|
-
var
|
|
4409
|
-
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), _);
|
|
4410
4378
|
}
|
|
4411
4379
|
}
|
|
4412
4380
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4485,8 +4453,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4485
4453
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4486
4454
|
const { gen: l } = t;
|
|
4487
4455
|
if (r !== void 0) {
|
|
4488
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4489
|
-
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];
|
|
4490
4458
|
}
|
|
4491
4459
|
if (s !== void 0) {
|
|
4492
4460
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4591,17 +4559,17 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4591
4559
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4592
4560
|
t(n, s, i, o, l, d, u);
|
|
4593
4561
|
for (var p in n) {
|
|
4594
|
-
var
|
|
4595
|
-
if (Array.isArray(
|
|
4562
|
+
var g = n[p];
|
|
4563
|
+
if (Array.isArray(g)) {
|
|
4596
4564
|
if (p in traverse$1.arrayKeywords)
|
|
4597
|
-
for (var O = 0; O <
|
|
4598
|
-
_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);
|
|
4599
4567
|
} else if (p in traverse$1.propsKeywords) {
|
|
4600
|
-
if (
|
|
4601
|
-
for (var N in
|
|
4602
|
-
_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);
|
|
4603
4571
|
} else
|
|
4604
|
-
(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);
|
|
4605
4573
|
}
|
|
4606
4574
|
r(n, s, i, o, l, d, u);
|
|
4607
4575
|
}
|
|
@@ -4685,34 +4653,34 @@ function getSchemaRefs(e, t) {
|
|
|
4685
4653
|
if (typeof e == "boolean")
|
|
4686
4654
|
return {};
|
|
4687
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();
|
|
4688
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4656
|
+
return traverse(e, { allKeys: !0 }, (g, O, N, R) => {
|
|
4689
4657
|
if (R === void 0)
|
|
4690
4658
|
return;
|
|
4691
|
-
const
|
|
4692
|
-
let
|
|
4693
|
-
typeof
|
|
4694
|
-
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) {
|
|
4695
4663
|
const I = this.opts.uriResolver.resolve;
|
|
4696
|
-
if (
|
|
4697
|
-
throw p(
|
|
4698
|
-
d.add(
|
|
4699
|
-
let D = this.refs[
|
|
4700
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4701
|
-
}
|
|
4702
|
-
function
|
|
4703
|
-
if (typeof
|
|
4704
|
-
if (!ANCHOR.test(
|
|
4705
|
-
throw new Error(`invalid anchor "${
|
|
4706
|
-
|
|
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}`);
|
|
4707
4675
|
}
|
|
4708
4676
|
}
|
|
4709
4677
|
}), l;
|
|
4710
|
-
function u(
|
|
4711
|
-
if (O !== void 0 && !equal$2(
|
|
4678
|
+
function u(g, O, N) {
|
|
4679
|
+
if (O !== void 0 && !equal$2(g, O))
|
|
4712
4680
|
throw p(N);
|
|
4713
4681
|
}
|
|
4714
|
-
function p(
|
|
4715
|
-
return new Error(`reference "${
|
|
4682
|
+
function p(g) {
|
|
4683
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4716
4684
|
}
|
|
4717
4685
|
}
|
|
4718
4686
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4829,10 +4797,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4829
4797
|
}
|
|
4830
4798
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4831
4799
|
for (const O of p.rules)
|
|
4832
|
-
|
|
4833
|
-
|
|
4800
|
+
g(O);
|
|
4801
|
+
g(p.post);
|
|
4834
4802
|
});
|
|
4835
|
-
function
|
|
4803
|
+
function g(O) {
|
|
4836
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}`));
|
|
4837
4805
|
}
|
|
4838
4806
|
}
|
|
@@ -5095,21 +5063,21 @@ function compileSchema(e) {
|
|
|
5095
5063
|
let p;
|
|
5096
5064
|
try {
|
|
5097
5065
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5098
|
-
const
|
|
5099
|
-
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));
|
|
5100
5068
|
const N = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5101
|
-
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:
|
|
5102
|
-
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;
|
|
5103
5071
|
N.evaluated = {
|
|
5104
5072
|
props: R instanceof codegen_1$m.Name ? void 0 : R,
|
|
5105
|
-
items:
|
|
5073
|
+
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5106
5074
|
dynamicProps: R instanceof codegen_1$m.Name,
|
|
5107
|
-
dynamicItems:
|
|
5075
|
+
dynamicItems: T instanceof codegen_1$m.Name
|
|
5108
5076
|
}, N.source && (N.source.evaluated = (0, codegen_1$m.stringify)(N.evaluated));
|
|
5109
5077
|
}
|
|
5110
5078
|
return e.validate = N, e;
|
|
5111
|
-
} catch (
|
|
5112
|
-
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;
|
|
5113
5081
|
} finally {
|
|
5114
5082
|
this._compilations.delete(e);
|
|
5115
5083
|
}
|
|
@@ -5226,13 +5194,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5226
5194
|
n(t);
|
|
5227
5195
|
})(commonjsGlobal, function(r) {
|
|
5228
5196
|
function n() {
|
|
5229
|
-
for (var f = arguments.length, c = Array(f),
|
|
5230
|
-
c[
|
|
5197
|
+
for (var f = arguments.length, c = Array(f), m = 0; m < f; m++)
|
|
5198
|
+
c[m] = arguments[m];
|
|
5231
5199
|
if (c.length > 1) {
|
|
5232
5200
|
c[0] = c[0].slice(0, -1);
|
|
5233
|
-
for (var
|
|
5234
|
-
c[
|
|
5235
|
-
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("");
|
|
5236
5204
|
} else
|
|
5237
5205
|
return c[0];
|
|
5238
5206
|
}
|
|
@@ -5249,20 +5217,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5249
5217
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5250
5218
|
}
|
|
5251
5219
|
function d(f, c) {
|
|
5252
|
-
var
|
|
5220
|
+
var m = f;
|
|
5253
5221
|
if (c)
|
|
5254
|
-
for (var
|
|
5255
|
-
|
|
5256
|
-
return
|
|
5222
|
+
for (var S in c)
|
|
5223
|
+
m[S] = c[S];
|
|
5224
|
+
return m;
|
|
5257
5225
|
}
|
|
5258
5226
|
function u(f) {
|
|
5259
|
-
var c = "[A-Za-z]",
|
|
5260
|
-
s(c + n(c,
|
|
5261
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5262
|
-
s("[vV]" +
|
|
5263
|
-
var ct = s(
|
|
5264
|
-
return s(s(
|
|
5265
|
-
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"),
|
|
5266
5234
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5267
5235
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5268
5236
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
@@ -5272,123 +5240,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5272
5240
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5273
5241
|
UNRESERVED: new RegExp(B, "g"),
|
|
5274
5242
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5275
|
-
PCT_ENCODED: new RegExp(
|
|
5243
|
+
PCT_ENCODED: new RegExp(E, "g"),
|
|
5276
5244
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5277
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5245
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + S + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5278
5246
|
//RFC 6874, with relaxed parsing rules
|
|
5279
5247
|
};
|
|
5280
5248
|
}
|
|
5281
|
-
var p = u(!1),
|
|
5282
|
-
function f(c,
|
|
5283
|
-
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;
|
|
5284
5252
|
try {
|
|
5285
|
-
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)
|
|
5286
5254
|
;
|
|
5287
5255
|
} catch (se) {
|
|
5288
5256
|
U = !0, L = se;
|
|
5289
5257
|
} finally {
|
|
5290
5258
|
try {
|
|
5291
|
-
!
|
|
5259
|
+
!E && J.return && J.return();
|
|
5292
5260
|
} finally {
|
|
5293
5261
|
if (U)
|
|
5294
5262
|
throw L;
|
|
5295
5263
|
}
|
|
5296
5264
|
}
|
|
5297
|
-
return
|
|
5265
|
+
return S;
|
|
5298
5266
|
}
|
|
5299
|
-
return function(c,
|
|
5267
|
+
return function(c, m) {
|
|
5300
5268
|
if (Array.isArray(c))
|
|
5301
5269
|
return c;
|
|
5302
5270
|
if (Symbol.iterator in Object(c))
|
|
5303
|
-
return f(c,
|
|
5271
|
+
return f(c, m);
|
|
5304
5272
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5305
5273
|
};
|
|
5306
5274
|
}(), N = function(f) {
|
|
5307
5275
|
if (Array.isArray(f)) {
|
|
5308
|
-
for (var c = 0,
|
|
5309
|
-
|
|
5310
|
-
return
|
|
5276
|
+
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5277
|
+
m[c] = f[c];
|
|
5278
|
+
return m;
|
|
5311
5279
|
} else
|
|
5312
5280
|
return Array.from(f);
|
|
5313
|
-
}, 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 = {
|
|
5314
5282
|
overflow: "Overflow: input needs wider integers to process",
|
|
5315
5283
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5316
5284
|
"invalid-input": "Invalid input"
|
|
5317
|
-
}, re =
|
|
5285
|
+
}, re = T - y, K = Math.floor, ue = String.fromCharCode;
|
|
5318
5286
|
function oe(f) {
|
|
5319
5287
|
throw new RangeError(x[f]);
|
|
5320
5288
|
}
|
|
5321
5289
|
function ke(f, c) {
|
|
5322
|
-
for (var
|
|
5323
|
-
|
|
5324
|
-
return
|
|
5290
|
+
for (var m = [], S = f.length; S--; )
|
|
5291
|
+
m[S] = c(f[S]);
|
|
5292
|
+
return m;
|
|
5325
5293
|
}
|
|
5326
|
-
function
|
|
5327
|
-
var
|
|
5328
|
-
|
|
5329
|
-
var
|
|
5330
|
-
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;
|
|
5331
5299
|
}
|
|
5332
5300
|
function qe(f) {
|
|
5333
|
-
for (var c = [],
|
|
5334
|
-
var
|
|
5335
|
-
if (
|
|
5336
|
-
var U = f.charCodeAt(
|
|
5337
|
-
(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--);
|
|
5338
5306
|
} else
|
|
5339
|
-
c.push(
|
|
5307
|
+
c.push(E);
|
|
5340
5308
|
}
|
|
5341
5309
|
return c;
|
|
5342
5310
|
}
|
|
5343
5311
|
var et = function(c) {
|
|
5344
5312
|
return String.fromCodePoint.apply(String, N(c));
|
|
5345
5313
|
}, Ue = function(c) {
|
|
5346
|
-
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 :
|
|
5347
|
-
}, F = function(c,
|
|
5348
|
-
return c + 22 + 75 * (c < 26) - ((
|
|
5349
|
-
},
|
|
5350
|
-
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;
|
|
5351
5319
|
for (
|
|
5352
|
-
c =
|
|
5320
|
+
c = S ? K(c / P) : c >> 1, c += K(c / m);
|
|
5353
5321
|
/* no initialization */
|
|
5354
|
-
c > re *
|
|
5355
|
-
|
|
5322
|
+
c > re * _ >> 1;
|
|
5323
|
+
E += T
|
|
5356
5324
|
)
|
|
5357
5325
|
c = K(c / re);
|
|
5358
|
-
return K(
|
|
5326
|
+
return K(E + (re + 1) * c / (c + $));
|
|
5359
5327
|
}, j = function(c) {
|
|
5360
|
-
var
|
|
5328
|
+
var m = [], S = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5361
5329
|
J < 0 && (J = 0);
|
|
5362
5330
|
for (var Y = 0; Y < J; ++Y)
|
|
5363
|
-
c.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5364
|
-
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; ) {
|
|
5365
5333
|
for (
|
|
5366
|
-
var B =
|
|
5334
|
+
var B = E, Z = 1, ie = T;
|
|
5367
5335
|
;
|
|
5368
5336
|
/* no condition */
|
|
5369
|
-
ie +=
|
|
5337
|
+
ie += T
|
|
5370
5338
|
) {
|
|
5371
|
-
se >=
|
|
5339
|
+
se >= S && oe("invalid-input");
|
|
5372
5340
|
var z = Ue(c.charCodeAt(se++));
|
|
5373
|
-
(z >=
|
|
5374
|
-
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;
|
|
5375
5343
|
if (z < X)
|
|
5376
5344
|
break;
|
|
5377
|
-
var ae =
|
|
5345
|
+
var ae = T - X;
|
|
5378
5346
|
Z > K(R / ae) && oe("overflow"), Z *= ae;
|
|
5379
5347
|
}
|
|
5380
|
-
var ee =
|
|
5381
|
-
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);
|
|
5382
5350
|
}
|
|
5383
|
-
return String.fromCodePoint.apply(String,
|
|
5384
|
-
},
|
|
5385
|
-
var
|
|
5351
|
+
return String.fromCodePoint.apply(String, m);
|
|
5352
|
+
}, b = function(c) {
|
|
5353
|
+
var m = [];
|
|
5386
5354
|
c = qe(c);
|
|
5387
|
-
var
|
|
5355
|
+
var S = c.length, E = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5388
5356
|
try {
|
|
5389
5357
|
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5390
5358
|
var ie = Z.value;
|
|
5391
|
-
ie < 128 &&
|
|
5359
|
+
ie < 128 && m.push(ue(ie));
|
|
5392
5360
|
}
|
|
5393
5361
|
} catch (lt) {
|
|
5394
5362
|
Y = !0, se = lt;
|
|
@@ -5400,44 +5368,44 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5400
5368
|
throw se;
|
|
5401
5369
|
}
|
|
5402
5370
|
}
|
|
5403
|
-
var z =
|
|
5404
|
-
for (z &&
|
|
5405
|
-
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;
|
|
5406
5374
|
try {
|
|
5407
|
-
for (var
|
|
5375
|
+
for (var $e = c[Symbol.iterator](), Be; !(ee = (Be = $e.next()).done); ee = !0) {
|
|
5408
5376
|
var Ie = Be.value;
|
|
5409
|
-
Ie >=
|
|
5377
|
+
Ie >= E && Ie < ae && (ae = Ie);
|
|
5410
5378
|
}
|
|
5411
5379
|
} catch (lt) {
|
|
5412
|
-
Se = !0,
|
|
5380
|
+
Se = !0, ge = lt;
|
|
5413
5381
|
} finally {
|
|
5414
5382
|
try {
|
|
5415
|
-
!ee &&
|
|
5383
|
+
!ee && $e.return && $e.return();
|
|
5416
5384
|
} finally {
|
|
5417
5385
|
if (Se)
|
|
5418
|
-
throw
|
|
5386
|
+
throw ge;
|
|
5419
5387
|
}
|
|
5420
5388
|
}
|
|
5421
5389
|
var fe = X + 1;
|
|
5422
|
-
ae -
|
|
5390
|
+
ae - E > K((R - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5423
5391
|
var ye = !0, je = !1, we = void 0;
|
|
5424
5392
|
try {
|
|
5425
5393
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5426
5394
|
var Ht = Lt.value;
|
|
5427
|
-
if (Ht <
|
|
5395
|
+
if (Ht < E && ++U > R && oe("overflow"), Ht == E) {
|
|
5428
5396
|
for (
|
|
5429
|
-
var pt = U, ft =
|
|
5397
|
+
var pt = U, ft = T;
|
|
5430
5398
|
;
|
|
5431
5399
|
/* no condition */
|
|
5432
|
-
ft +=
|
|
5400
|
+
ft += T
|
|
5433
5401
|
) {
|
|
5434
|
-
var ht = ft <= L ?
|
|
5402
|
+
var ht = ft <= L ? y : ft >= L + _ ? _ : ft - L;
|
|
5435
5403
|
if (pt < ht)
|
|
5436
5404
|
break;
|
|
5437
|
-
var Vt = pt - ht, zt =
|
|
5438
|
-
|
|
5405
|
+
var Vt = pt - ht, zt = T - ht;
|
|
5406
|
+
m.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5439
5407
|
}
|
|
5440
|
-
|
|
5408
|
+
m.push(ue(F(pt, 0))), L = v(U, fe, X == z), U = 0, ++X;
|
|
5441
5409
|
}
|
|
5442
5410
|
}
|
|
5443
5411
|
} catch (lt) {
|
|
@@ -5450,16 +5418,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5450
5418
|
throw we;
|
|
5451
5419
|
}
|
|
5452
5420
|
}
|
|
5453
|
-
++U, ++
|
|
5421
|
+
++U, ++E;
|
|
5454
5422
|
}
|
|
5455
|
-
return
|
|
5423
|
+
return m.join("");
|
|
5456
5424
|
}, a = function(c) {
|
|
5457
|
-
return
|
|
5458
|
-
return k.test(
|
|
5425
|
+
return Ce(c, function(m) {
|
|
5426
|
+
return k.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5459
5427
|
});
|
|
5460
5428
|
}, h = function(c) {
|
|
5461
|
-
return
|
|
5462
|
-
return A.test(
|
|
5429
|
+
return Ce(c, function(m) {
|
|
5430
|
+
return A.test(m) ? "xn--" + b(m) : m;
|
|
5463
5431
|
});
|
|
5464
5432
|
}, C = {
|
|
5465
5433
|
/**
|
|
@@ -5480,56 +5448,56 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5480
5448
|
encode: et
|
|
5481
5449
|
},
|
|
5482
5450
|
decode: j,
|
|
5483
|
-
encode:
|
|
5451
|
+
encode: b,
|
|
5484
5452
|
toASCII: h,
|
|
5485
5453
|
toUnicode: a
|
|
5486
5454
|
}, M = {};
|
|
5487
5455
|
function q(f) {
|
|
5488
|
-
var c = f.charCodeAt(0),
|
|
5489
|
-
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;
|
|
5490
5458
|
}
|
|
5491
5459
|
function W(f) {
|
|
5492
|
-
for (var c = "",
|
|
5493
|
-
var
|
|
5494
|
-
if (
|
|
5495
|
-
c += String.fromCharCode(
|
|
5496
|
-
else if (
|
|
5497
|
-
if (
|
|
5498
|
-
var U = parseInt(f.substr(
|
|
5499
|
-
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);
|
|
5500
5468
|
} else
|
|
5501
|
-
c += f.substr(
|
|
5502
|
-
|
|
5503
|
-
} else if (
|
|
5504
|
-
if (
|
|
5505
|
-
var L = parseInt(f.substr(
|
|
5506
|
-
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);
|
|
5507
5475
|
} else
|
|
5508
|
-
c += f.substr(
|
|
5509
|
-
|
|
5476
|
+
c += f.substr(m, 9);
|
|
5477
|
+
m += 9;
|
|
5510
5478
|
} else
|
|
5511
|
-
c += f.substr(
|
|
5479
|
+
c += f.substr(m, 3), m += 3;
|
|
5512
5480
|
}
|
|
5513
5481
|
return c;
|
|
5514
5482
|
}
|
|
5515
5483
|
function G(f, c) {
|
|
5516
|
-
function
|
|
5517
|
-
var
|
|
5518
|
-
return
|
|
5484
|
+
function m(S) {
|
|
5485
|
+
var E = W(S);
|
|
5486
|
+
return E.match(c.UNRESERVED) ? E : S;
|
|
5519
5487
|
}
|
|
5520
|
-
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;
|
|
5521
5489
|
}
|
|
5522
5490
|
function ne(f) {
|
|
5523
5491
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5524
5492
|
}
|
|
5525
5493
|
function he(f, c) {
|
|
5526
|
-
var
|
|
5527
|
-
return
|
|
5494
|
+
var m = f.match(c.IPV4ADDRESS) || [], S = O(m, 2), E = S[1];
|
|
5495
|
+
return E ? E.split(".").map(ne).join(".") : f;
|
|
5528
5496
|
}
|
|
5529
5497
|
function Le(f, c) {
|
|
5530
|
-
var
|
|
5531
|
-
if (
|
|
5532
|
-
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)
|
|
5533
5501
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5534
5502
|
ie && (ae[z - 1] = he(ae[z - 1], c));
|
|
5535
5503
|
var Se = ae.reduce(function(fe, ye, je) {
|
|
@@ -5538,46 +5506,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5538
5506
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5539
5507
|
}
|
|
5540
5508
|
return fe;
|
|
5541
|
-
}, []),
|
|
5509
|
+
}, []), ge = Se.sort(function(fe, ye) {
|
|
5542
5510
|
return ye.length - fe.length;
|
|
5543
|
-
})[0],
|
|
5544
|
-
if (
|
|
5545
|
-
var Be = ae.slice(0,
|
|
5546
|
-
|
|
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(":");
|
|
5547
5515
|
} else
|
|
5548
|
-
|
|
5549
|
-
return U && (
|
|
5516
|
+
$e = ae.join(":");
|
|
5517
|
+
return U && ($e += "%" + U), $e;
|
|
5550
5518
|
} else
|
|
5551
5519
|
return f;
|
|
5552
5520
|
}
|
|
5553
5521
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5554
5522
|
function de(f) {
|
|
5555
|
-
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;
|
|
5556
5524
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5557
|
-
var
|
|
5558
|
-
if (
|
|
5559
|
-
rt ? (
|
|
5560
|
-
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()];
|
|
5561
5529
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5562
|
-
if (
|
|
5530
|
+
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5563
5531
|
try {
|
|
5564
|
-
|
|
5532
|
+
m.host = C.toASCII(m.host.replace(S.PCT_ENCODED, W).toLowerCase());
|
|
5565
5533
|
} catch (L) {
|
|
5566
|
-
|
|
5534
|
+
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5567
5535
|
}
|
|
5568
|
-
G(
|
|
5536
|
+
G(m, p);
|
|
5569
5537
|
} else
|
|
5570
|
-
G(
|
|
5571
|
-
U && U.parse && U.parse(
|
|
5538
|
+
G(m, S);
|
|
5539
|
+
U && U.parse && U.parse(m, c);
|
|
5572
5540
|
} else
|
|
5573
|
-
|
|
5574
|
-
return
|
|
5541
|
+
m.error = m.error || "URI can not be parsed.";
|
|
5542
|
+
return m;
|
|
5575
5543
|
}
|
|
5576
5544
|
function nt(f, c) {
|
|
5577
|
-
var
|
|
5578
|
-
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) {
|
|
5579
5547
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5580
|
-
})), (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;
|
|
5581
5549
|
}
|
|
5582
5550
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5583
5551
|
function me(f) {
|
|
@@ -5591,62 +5559,62 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5591
5559
|
else if (f === "." || f === "..")
|
|
5592
5560
|
f = "";
|
|
5593
5561
|
else {
|
|
5594
|
-
var
|
|
5595
|
-
if (
|
|
5596
|
-
var
|
|
5597
|
-
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);
|
|
5598
5566
|
} else
|
|
5599
5567
|
throw new Error("Unexpected dot segment condition");
|
|
5600
5568
|
}
|
|
5601
5569
|
return c.join("");
|
|
5602
5570
|
}
|
|
5603
5571
|
function le(f) {
|
|
5604
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5605
|
-
if (
|
|
5606
|
-
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)
|
|
5607
5575
|
try {
|
|
5608
|
-
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());
|
|
5609
5577
|
} catch (J) {
|
|
5610
5578
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5611
5579
|
}
|
|
5612
5580
|
}
|
|
5613
|
-
G(f,
|
|
5581
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (S.push(f.scheme), S.push(":"));
|
|
5614
5582
|
var U = nt(f, c);
|
|
5615
|
-
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) {
|
|
5616
5584
|
var L = f.path;
|
|
5617
|
-
!c.absolutePath && (!
|
|
5585
|
+
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), S.push(L);
|
|
5618
5586
|
}
|
|
5619
|
-
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("");
|
|
5620
5588
|
}
|
|
5621
5589
|
function xe(f, c) {
|
|
5622
|
-
var
|
|
5623
|
-
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;
|
|
5624
5592
|
}
|
|
5625
|
-
function it(f, c,
|
|
5626
|
-
var
|
|
5627
|
-
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);
|
|
5628
5596
|
}
|
|
5629
|
-
function
|
|
5597
|
+
function Oe(f, c) {
|
|
5630
5598
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
5631
5599
|
}
|
|
5632
|
-
function ot(f, c,
|
|
5633
|
-
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;
|
|
5634
5602
|
}
|
|
5635
5603
|
function ut(f, c) {
|
|
5636
|
-
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE :
|
|
5604
|
+
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE : g.ESCAPE, q);
|
|
5637
5605
|
}
|
|
5638
5606
|
function pe(f, c) {
|
|
5639
|
-
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);
|
|
5640
5608
|
}
|
|
5641
5609
|
var Ne = {
|
|
5642
5610
|
scheme: "http",
|
|
5643
5611
|
domainHost: !0,
|
|
5644
|
-
parse: function(c,
|
|
5612
|
+
parse: function(c, m) {
|
|
5645
5613
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
5646
5614
|
},
|
|
5647
|
-
serialize: function(c,
|
|
5648
|
-
var
|
|
5649
|
-
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;
|
|
5650
5618
|
}
|
|
5651
5619
|
}, It = {
|
|
5652
5620
|
scheme: "https",
|
|
@@ -5660,13 +5628,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5660
5628
|
var at = {
|
|
5661
5629
|
scheme: "ws",
|
|
5662
5630
|
domainHost: !0,
|
|
5663
|
-
parse: function(c,
|
|
5664
|
-
var
|
|
5665
|
-
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;
|
|
5666
5634
|
},
|
|
5667
|
-
serialize: function(c,
|
|
5635
|
+
serialize: function(c, m) {
|
|
5668
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) {
|
|
5669
|
-
var
|
|
5637
|
+
var S = c.resourceName.split("?"), E = O(S, 2), U = E[0], L = E[1];
|
|
5670
5638
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5671
5639
|
}
|
|
5672
5640
|
return c.fragment = void 0, c;
|
|
@@ -5677,100 +5645,100 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5677
5645
|
parse: at.parse,
|
|
5678
5646
|
serialize: at.serialize
|
|
5679
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;
|
|
5680
|
-
function
|
|
5648
|
+
function Ot(f) {
|
|
5681
5649
|
var c = W(f);
|
|
5682
5650
|
return c.match(ur) ? c : f;
|
|
5683
5651
|
}
|
|
5684
5652
|
var Mt = {
|
|
5685
5653
|
scheme: "mailto",
|
|
5686
|
-
parse: function(c,
|
|
5687
|
-
var
|
|
5688
|
-
if (
|
|
5689
|
-
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) {
|
|
5690
5658
|
var B = J[Y].split("=");
|
|
5691
5659
|
switch (B[0]) {
|
|
5692
5660
|
case "to":
|
|
5693
5661
|
for (var Z = B[1].split(","), ie = 0, z = Z.length; ie < z; ++ie)
|
|
5694
|
-
|
|
5662
|
+
E.push(Z[ie]);
|
|
5695
5663
|
break;
|
|
5696
5664
|
case "subject":
|
|
5697
|
-
|
|
5665
|
+
S.subject = pe(B[1], m);
|
|
5698
5666
|
break;
|
|
5699
5667
|
case "body":
|
|
5700
|
-
|
|
5668
|
+
S.body = pe(B[1], m);
|
|
5701
5669
|
break;
|
|
5702
5670
|
default:
|
|
5703
|
-
U = !0, L[pe(B[0],
|
|
5671
|
+
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
5704
5672
|
break;
|
|
5705
5673
|
}
|
|
5706
5674
|
}
|
|
5707
|
-
U && (
|
|
5675
|
+
U && (S.headers = L);
|
|
5708
5676
|
}
|
|
5709
|
-
|
|
5710
|
-
for (var X = 0, ae =
|
|
5711
|
-
var ee =
|
|
5712
|
-
if (ee[0] = pe(ee[0]),
|
|
5713
|
-
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();
|
|
5714
5682
|
else
|
|
5715
5683
|
try {
|
|
5716
|
-
ee[1] = C.toASCII(pe(ee[1],
|
|
5684
|
+
ee[1] = C.toASCII(pe(ee[1], m).toLowerCase());
|
|
5717
5685
|
} catch (Se) {
|
|
5718
|
-
|
|
5686
|
+
S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5719
5687
|
}
|
|
5720
|
-
|
|
5688
|
+
E[X] = ee.join("@");
|
|
5721
5689
|
}
|
|
5722
|
-
return
|
|
5690
|
+
return S;
|
|
5723
5691
|
},
|
|
5724
|
-
serialize: function(c,
|
|
5725
|
-
var
|
|
5726
|
-
if (
|
|
5727
|
-
for (var U = 0, L =
|
|
5728
|
-
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);
|
|
5729
5697
|
try {
|
|
5730
|
-
B =
|
|
5698
|
+
B = m.iri ? C.toUnicode(B) : C.toASCII(pe(B, m).toLowerCase());
|
|
5731
5699
|
} catch (X) {
|
|
5732
|
-
|
|
5700
|
+
S.error = S.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5733
5701
|
}
|
|
5734
|
-
|
|
5702
|
+
E[U] = se + "@" + B;
|
|
5735
5703
|
}
|
|
5736
|
-
|
|
5704
|
+
S.path = E.join(",");
|
|
5737
5705
|
}
|
|
5738
5706
|
var Z = c.headers = c.headers || {};
|
|
5739
5707
|
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5740
5708
|
var ie = [];
|
|
5741
5709
|
for (var z in Z)
|
|
5742
|
-
Z[z] !== ir[z] && ie.push(z.replace(We,
|
|
5743
|
-
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;
|
|
5744
5712
|
}
|
|
5745
5713
|
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5746
5714
|
scheme: "urn",
|
|
5747
|
-
parse: function(c,
|
|
5748
|
-
var
|
|
5749
|
-
if (
|
|
5750
|
-
var U =
|
|
5751
|
-
|
|
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));
|
|
5752
5720
|
} else
|
|
5753
|
-
|
|
5754
|
-
return
|
|
5721
|
+
E.error = E.error || "URN can not be parsed.";
|
|
5722
|
+
return E;
|
|
5755
5723
|
},
|
|
5756
|
-
serialize: function(c,
|
|
5757
|
-
var
|
|
5758
|
-
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));
|
|
5759
5727
|
var J = c, Y = c.nss;
|
|
5760
|
-
return J.path = (
|
|
5728
|
+
return J.path = (E || m.nid) + ":" + Y, J;
|
|
5761
5729
|
}
|
|
5762
5730
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5763
5731
|
scheme: "urn:uuid",
|
|
5764
|
-
parse: function(c,
|
|
5765
|
-
var
|
|
5766
|
-
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;
|
|
5767
5735
|
},
|
|
5768
|
-
serialize: function(c,
|
|
5769
|
-
var
|
|
5770
|
-
return
|
|
5736
|
+
serialize: function(c, m) {
|
|
5737
|
+
var S = c;
|
|
5738
|
+
return S.nss = (c.uuid || "").toLowerCase(), S;
|
|
5771
5739
|
}
|
|
5772
5740
|
};
|
|
5773
|
-
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 });
|
|
5774
5742
|
});
|
|
5775
5743
|
})(uri_all, uri_all.exports);
|
|
5776
5744
|
var uri_allExports = uri_all.exports;
|
|
@@ -5798,9 +5766,9 @@ uri$1.default = uri;
|
|
|
5798
5766
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5799
5767
|
return r.CodeGen;
|
|
5800
5768
|
} });
|
|
5801
|
-
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);
|
|
5802
5770
|
N.code = "new RegExp";
|
|
5803
|
-
const R = ["removeAdditional", "useDefaults", "coerceTypes"],
|
|
5771
|
+
const R = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5804
5772
|
"validate",
|
|
5805
5773
|
"serialize",
|
|
5806
5774
|
"parse",
|
|
@@ -5814,7 +5782,7 @@ uri$1.default = uri;
|
|
|
5814
5782
|
"func",
|
|
5815
5783
|
"obj",
|
|
5816
5784
|
"Error"
|
|
5817
|
-
]),
|
|
5785
|
+
]), y = {
|
|
5818
5786
|
errorDataPath: "",
|
|
5819
5787
|
format: "`validateFormats: false` can be used instead.",
|
|
5820
5788
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5830,23 +5798,23 @@ uri$1.default = uri;
|
|
|
5830
5798
|
cache: "Map is used as cache, schema object as key.",
|
|
5831
5799
|
serialize: "Map is used as cache, schema object as key.",
|
|
5832
5800
|
ajvErrors: "It is default now."
|
|
5833
|
-
},
|
|
5801
|
+
}, _ = {
|
|
5834
5802
|
ignoreKeywordsWithRef: "",
|
|
5835
5803
|
jsPropertySyntax: "",
|
|
5836
5804
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5837
|
-
},
|
|
5838
|
-
function
|
|
5839
|
-
var
|
|
5840
|
-
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;
|
|
5841
5809
|
return {
|
|
5842
|
-
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5843
|
-
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5844
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5845
|
-
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne :
|
|
5846
|
-
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,
|
|
5847
5815
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5848
|
-
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt :
|
|
5849
|
-
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 : $,
|
|
5850
5818
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
5851
5819
|
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5852
5820
|
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
@@ -5860,44 +5828,44 @@ uri$1.default = uri;
|
|
|
5860
5828
|
};
|
|
5861
5829
|
}
|
|
5862
5830
|
class I {
|
|
5863
|
-
constructor(
|
|
5864
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5865
|
-
const { es5: j, lines:
|
|
5866
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes:
|
|
5867
|
-
const a =
|
|
5868
|
-
|
|
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;
|
|
5869
5837
|
}
|
|
5870
5838
|
_addVocabularies() {
|
|
5871
5839
|
this.addKeyword("$async");
|
|
5872
5840
|
}
|
|
5873
5841
|
_addDefaultMetaSchema() {
|
|
5874
|
-
const { $data:
|
|
5875
|
-
let a =
|
|
5876
|
-
|
|
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);
|
|
5877
5845
|
}
|
|
5878
5846
|
defaultMeta() {
|
|
5879
|
-
const { meta:
|
|
5880
|
-
return this.opts.defaultMeta = typeof
|
|
5881
|
-
}
|
|
5882
|
-
validate(
|
|
5883
|
-
let
|
|
5884
|
-
if (typeof
|
|
5885
|
-
if (
|
|
5886
|
-
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}"`);
|
|
5887
5855
|
} else
|
|
5888
|
-
|
|
5889
|
-
const a =
|
|
5890
|
-
return "$async" in
|
|
5856
|
+
b = this.compile(v);
|
|
5857
|
+
const a = b(j);
|
|
5858
|
+
return "$async" in b || (this.errors = b.errors), a;
|
|
5891
5859
|
}
|
|
5892
|
-
compile(
|
|
5893
|
-
const
|
|
5894
|
-
return
|
|
5860
|
+
compile(v, j) {
|
|
5861
|
+
const b = this._addSchema(v, j);
|
|
5862
|
+
return b.validate || this._compileSchemaEnv(b);
|
|
5895
5863
|
}
|
|
5896
|
-
compileAsync(
|
|
5864
|
+
compileAsync(v, j) {
|
|
5897
5865
|
if (typeof this.opts.loadSchema != "function")
|
|
5898
5866
|
throw new Error("options.loadSchema should be a function");
|
|
5899
|
-
const { loadSchema:
|
|
5900
|
-
return a.call(this,
|
|
5867
|
+
const { loadSchema: b } = this.opts;
|
|
5868
|
+
return a.call(this, v, j);
|
|
5901
5869
|
async function a(G, ne) {
|
|
5902
5870
|
await h.call(this, G.$schema);
|
|
5903
5871
|
const he = this._addSchema(G, ne);
|
|
@@ -5928,42 +5896,42 @@ uri$1.default = uri;
|
|
|
5928
5896
|
if (ne)
|
|
5929
5897
|
return ne;
|
|
5930
5898
|
try {
|
|
5931
|
-
return await (this._loading[G] =
|
|
5899
|
+
return await (this._loading[G] = b(G));
|
|
5932
5900
|
} finally {
|
|
5933
5901
|
delete this._loading[G];
|
|
5934
5902
|
}
|
|
5935
5903
|
}
|
|
5936
5904
|
}
|
|
5937
5905
|
// Adds schema to the instance
|
|
5938
|
-
addSchema(
|
|
5939
|
-
if (Array.isArray(
|
|
5940
|
-
for (const C of
|
|
5941
|
-
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);
|
|
5942
5910
|
return this;
|
|
5943
5911
|
}
|
|
5944
5912
|
let h;
|
|
5945
|
-
if (typeof
|
|
5913
|
+
if (typeof v == "object") {
|
|
5946
5914
|
const { schemaId: C } = this.opts;
|
|
5947
|
-
if (h =
|
|
5915
|
+
if (h = v[C], h !== void 0 && typeof h != "string")
|
|
5948
5916
|
throw new Error(`schema ${C} must be string`);
|
|
5949
5917
|
}
|
|
5950
|
-
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;
|
|
5951
5919
|
}
|
|
5952
5920
|
// Add schema that will be used to validate other schemas
|
|
5953
5921
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5954
|
-
addMetaSchema(
|
|
5955
|
-
return this.addSchema(
|
|
5922
|
+
addMetaSchema(v, j, b = this.opts.validateSchema) {
|
|
5923
|
+
return this.addSchema(v, j, !0, b), this;
|
|
5956
5924
|
}
|
|
5957
5925
|
// Validate schema against its meta-schema
|
|
5958
|
-
validateSchema(
|
|
5959
|
-
if (typeof
|
|
5926
|
+
validateSchema(v, j) {
|
|
5927
|
+
if (typeof v == "boolean")
|
|
5960
5928
|
return !0;
|
|
5961
|
-
let
|
|
5962
|
-
if (
|
|
5929
|
+
let b;
|
|
5930
|
+
if (b = v.$schema, b !== void 0 && typeof b != "string")
|
|
5963
5931
|
throw new Error("$schema must be a string");
|
|
5964
|
-
if (
|
|
5932
|
+
if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
|
|
5965
5933
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5966
|
-
const a = this.validate(
|
|
5934
|
+
const a = this.validate(b, v);
|
|
5967
5935
|
if (!a && j) {
|
|
5968
5936
|
const h = "schema is invalid: " + this.errorsText();
|
|
5969
5937
|
if (this.opts.validateSchema === "log")
|
|
@@ -5975,15 +5943,15 @@ uri$1.default = uri;
|
|
|
5975
5943
|
}
|
|
5976
5944
|
// Get compiled schema by `key` or `ref`.
|
|
5977
5945
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5978
|
-
getSchema(
|
|
5946
|
+
getSchema(v) {
|
|
5979
5947
|
let j;
|
|
5980
|
-
for (; typeof (j = w.call(this,
|
|
5981
|
-
|
|
5948
|
+
for (; typeof (j = w.call(this, v)) == "string"; )
|
|
5949
|
+
v = j;
|
|
5982
5950
|
if (j === void 0) {
|
|
5983
|
-
const { schemaId:
|
|
5984
|
-
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)
|
|
5985
5953
|
return;
|
|
5986
|
-
this.refs[
|
|
5954
|
+
this.refs[v] = j;
|
|
5987
5955
|
}
|
|
5988
5956
|
return j.validate || this._compileSchemaEnv(j);
|
|
5989
5957
|
}
|
|
@@ -5991,138 +5959,138 @@ uri$1.default = uri;
|
|
|
5991
5959
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5992
5960
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5993
5961
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5994
|
-
removeSchema(
|
|
5995
|
-
if (
|
|
5996
|
-
return this._removeAllSchemas(this.schemas,
|
|
5997
|
-
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) {
|
|
5998
5966
|
case "undefined":
|
|
5999
5967
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
6000
5968
|
case "string": {
|
|
6001
|
-
const j = w.call(this,
|
|
6002
|
-
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;
|
|
6003
5971
|
}
|
|
6004
5972
|
case "object": {
|
|
6005
|
-
const j =
|
|
5973
|
+
const j = v;
|
|
6006
5974
|
this._cache.delete(j);
|
|
6007
|
-
let
|
|
6008
|
-
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;
|
|
6009
5977
|
}
|
|
6010
5978
|
default:
|
|
6011
5979
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
6012
5980
|
}
|
|
6013
5981
|
}
|
|
6014
5982
|
// add "vocabulary" - a collection of keywords
|
|
6015
|
-
addVocabulary(
|
|
6016
|
-
for (const j of
|
|
5983
|
+
addVocabulary(v) {
|
|
5984
|
+
for (const j of v)
|
|
6017
5985
|
this.addKeyword(j);
|
|
6018
5986
|
return this;
|
|
6019
5987
|
}
|
|
6020
|
-
addKeyword(
|
|
6021
|
-
let
|
|
6022
|
-
if (typeof
|
|
6023
|
-
|
|
6024
|
-
else if (typeof
|
|
6025
|
-
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)
|
|
6026
5994
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6027
5995
|
} else
|
|
6028
5996
|
throw new Error("invalid addKeywords parameters");
|
|
6029
|
-
if (oe.call(this,
|
|
6030
|
-
return (0, p.eachItem)(
|
|
5997
|
+
if (oe.call(this, b, j), !j)
|
|
5998
|
+
return (0, p.eachItem)(b, (h) => ke.call(this, h)), this;
|
|
6031
5999
|
qe.call(this, j);
|
|
6032
6000
|
const a = {
|
|
6033
6001
|
...j,
|
|
6034
6002
|
type: (0, u.getJSONTypes)(j.type),
|
|
6035
6003
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6036
6004
|
};
|
|
6037
|
-
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;
|
|
6038
6006
|
}
|
|
6039
|
-
getKeyword(
|
|
6040
|
-
const j = this.RULES.all[
|
|
6007
|
+
getKeyword(v) {
|
|
6008
|
+
const j = this.RULES.all[v];
|
|
6041
6009
|
return typeof j == "object" ? j.definition : !!j;
|
|
6042
6010
|
}
|
|
6043
6011
|
// Remove keyword
|
|
6044
|
-
removeKeyword(
|
|
6012
|
+
removeKeyword(v) {
|
|
6045
6013
|
const { RULES: j } = this;
|
|
6046
|
-
delete j.keywords[
|
|
6047
|
-
for (const
|
|
6048
|
-
const a =
|
|
6049
|
-
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);
|
|
6050
6018
|
}
|
|
6051
6019
|
return this;
|
|
6052
6020
|
}
|
|
6053
6021
|
// Add format
|
|
6054
|
-
addFormat(
|
|
6055
|
-
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;
|
|
6056
6024
|
}
|
|
6057
|
-
errorsText(
|
|
6058
|
-
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);
|
|
6059
6027
|
}
|
|
6060
|
-
$dataMetaSchema(
|
|
6061
|
-
const
|
|
6062
|
-
|
|
6028
|
+
$dataMetaSchema(v, j) {
|
|
6029
|
+
const b = this.RULES.all;
|
|
6030
|
+
v = JSON.parse(JSON.stringify(v));
|
|
6063
6031
|
for (const a of j) {
|
|
6064
6032
|
const h = a.split("/").slice(1);
|
|
6065
|
-
let C =
|
|
6033
|
+
let C = v;
|
|
6066
6034
|
for (const M of h)
|
|
6067
6035
|
C = C[M];
|
|
6068
|
-
for (const M in
|
|
6069
|
-
const q =
|
|
6036
|
+
for (const M in b) {
|
|
6037
|
+
const q = b[M];
|
|
6070
6038
|
if (typeof q != "object")
|
|
6071
6039
|
continue;
|
|
6072
6040
|
const { $data: W } = q.definition, G = C[M];
|
|
6073
6041
|
W && G && (C[M] = Ue(G));
|
|
6074
6042
|
}
|
|
6075
6043
|
}
|
|
6076
|
-
return
|
|
6044
|
+
return v;
|
|
6077
6045
|
}
|
|
6078
|
-
_removeAllSchemas(
|
|
6079
|
-
for (const
|
|
6080
|
-
const a =
|
|
6081
|
-
(!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]));
|
|
6082
6050
|
}
|
|
6083
6051
|
}
|
|
6084
|
-
_addSchema(
|
|
6052
|
+
_addSchema(v, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6085
6053
|
let C;
|
|
6086
6054
|
const { schemaId: M } = this.opts;
|
|
6087
|
-
if (typeof
|
|
6088
|
-
C =
|
|
6055
|
+
if (typeof v == "object")
|
|
6056
|
+
C = v[M];
|
|
6089
6057
|
else {
|
|
6090
6058
|
if (this.opts.jtd)
|
|
6091
6059
|
throw new Error("schema must be object");
|
|
6092
|
-
if (typeof
|
|
6060
|
+
if (typeof v != "boolean")
|
|
6093
6061
|
throw new Error("schema must be object or boolean");
|
|
6094
6062
|
}
|
|
6095
|
-
let q = this._cache.get(
|
|
6063
|
+
let q = this._cache.get(v);
|
|
6096
6064
|
if (q !== void 0)
|
|
6097
6065
|
return q;
|
|
6098
|
-
|
|
6099
|
-
const W = d.getSchemaRefs.call(this,
|
|
6100
|
-
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;
|
|
6101
6069
|
}
|
|
6102
|
-
_checkUnique(
|
|
6103
|
-
if (this.schemas[
|
|
6104
|
-
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`);
|
|
6105
6073
|
}
|
|
6106
|
-
_compileSchemaEnv(
|
|
6107
|
-
if (
|
|
6074
|
+
_compileSchemaEnv(v) {
|
|
6075
|
+
if (v.meta ? this._compileMetaSchema(v) : o.compileSchema.call(this, v), !v.validate)
|
|
6108
6076
|
throw new Error("ajv implementation error");
|
|
6109
|
-
return
|
|
6077
|
+
return v.validate;
|
|
6110
6078
|
}
|
|
6111
|
-
_compileMetaSchema(
|
|
6079
|
+
_compileMetaSchema(v) {
|
|
6112
6080
|
const j = this.opts;
|
|
6113
6081
|
this.opts = this._metaOpts;
|
|
6114
6082
|
try {
|
|
6115
|
-
o.compileSchema.call(this,
|
|
6083
|
+
o.compileSchema.call(this, v);
|
|
6116
6084
|
} finally {
|
|
6117
6085
|
this.opts = j;
|
|
6118
6086
|
}
|
|
6119
6087
|
}
|
|
6120
6088
|
}
|
|
6121
6089
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6122
|
-
function D(F,
|
|
6090
|
+
function D(F, v, j, b = "error") {
|
|
6123
6091
|
for (const a in F) {
|
|
6124
6092
|
const h = a;
|
|
6125
|
-
h in
|
|
6093
|
+
h in v && this.logger[b](`${j}: option ${a}. ${F[h]}`);
|
|
6126
6094
|
}
|
|
6127
6095
|
}
|
|
6128
6096
|
function w(F) {
|
|
@@ -6134,13 +6102,13 @@ uri$1.default = uri;
|
|
|
6134
6102
|
if (Array.isArray(F))
|
|
6135
6103
|
this.addSchema(F);
|
|
6136
6104
|
else
|
|
6137
|
-
for (const
|
|
6138
|
-
this.addSchema(F[
|
|
6105
|
+
for (const v in F)
|
|
6106
|
+
this.addSchema(F[v], v);
|
|
6139
6107
|
}
|
|
6140
6108
|
function A() {
|
|
6141
6109
|
for (const F in this.opts.formats) {
|
|
6142
|
-
const
|
|
6143
|
-
|
|
6110
|
+
const v = this.opts.formats[F];
|
|
6111
|
+
v && this.addFormat(F, v);
|
|
6144
6112
|
}
|
|
6145
6113
|
}
|
|
6146
6114
|
function V(F) {
|
|
@@ -6149,15 +6117,15 @@ uri$1.default = uri;
|
|
|
6149
6117
|
return;
|
|
6150
6118
|
}
|
|
6151
6119
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6152
|
-
for (const
|
|
6153
|
-
const j = F[
|
|
6154
|
-
j.keyword || (j.keyword =
|
|
6120
|
+
for (const v in F) {
|
|
6121
|
+
const j = F[v];
|
|
6122
|
+
j.keyword || (j.keyword = v), this.addKeyword(j);
|
|
6155
6123
|
}
|
|
6156
6124
|
}
|
|
6157
6125
|
function x() {
|
|
6158
6126
|
const F = { ...this.opts };
|
|
6159
|
-
for (const
|
|
6160
|
-
delete F[
|
|
6127
|
+
for (const v of R)
|
|
6128
|
+
delete F[v];
|
|
6161
6129
|
return F;
|
|
6162
6130
|
}
|
|
6163
6131
|
const re = { log() {
|
|
@@ -6174,42 +6142,42 @@ uri$1.default = uri;
|
|
|
6174
6142
|
throw new Error("logger must implement log, warn and error methods");
|
|
6175
6143
|
}
|
|
6176
6144
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6177
|
-
function oe(F,
|
|
6145
|
+
function oe(F, v) {
|
|
6178
6146
|
const { RULES: j } = this;
|
|
6179
|
-
if ((0, p.eachItem)(F, (
|
|
6180
|
-
if (j.keywords[
|
|
6181
|
-
throw new Error(`Keyword ${
|
|
6182
|
-
if (!ue.test(
|
|
6183
|
-
throw new Error(`Keyword ${
|
|
6184
|
-
}), !!
|
|
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))
|
|
6185
6153
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6186
6154
|
}
|
|
6187
|
-
function ke(F,
|
|
6188
|
-
var
|
|
6189
|
-
const a =
|
|
6155
|
+
function ke(F, v, j) {
|
|
6156
|
+
var b;
|
|
6157
|
+
const a = v == null ? void 0 : v.post;
|
|
6190
6158
|
if (j && a)
|
|
6191
6159
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6192
6160
|
const { RULES: h } = this;
|
|
6193
6161
|
let C = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6194
|
-
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)
|
|
6195
6163
|
return;
|
|
6196
6164
|
const M = {
|
|
6197
6165
|
keyword: F,
|
|
6198
6166
|
definition: {
|
|
6199
|
-
...
|
|
6200
|
-
type: (0, u.getJSONTypes)(
|
|
6201
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6167
|
+
...v,
|
|
6168
|
+
type: (0, u.getJSONTypes)(v.type),
|
|
6169
|
+
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6202
6170
|
}
|
|
6203
6171
|
};
|
|
6204
|
-
|
|
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));
|
|
6205
6173
|
}
|
|
6206
|
-
function
|
|
6207
|
-
const
|
|
6208
|
-
|
|
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`));
|
|
6209
6177
|
}
|
|
6210
6178
|
function qe(F) {
|
|
6211
|
-
let { metaSchema:
|
|
6212
|
-
|
|
6179
|
+
let { metaSchema: v } = F;
|
|
6180
|
+
v !== void 0 && (F.$data && this.opts.$data && (v = Ue(v)), F.validateSchema = this.compile(v, !0));
|
|
6213
6181
|
}
|
|
6214
6182
|
const et = {
|
|
6215
6183
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
@@ -6236,32 +6204,32 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6236
6204
|
code(e) {
|
|
6237
6205
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: l, self: d } = n, { root: u } = i;
|
|
6238
6206
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6239
|
-
return
|
|
6207
|
+
return g();
|
|
6240
6208
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6241
6209
|
if (p === void 0)
|
|
6242
6210
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6243
6211
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6244
6212
|
return O(p);
|
|
6245
6213
|
return N(p);
|
|
6246
|
-
function
|
|
6214
|
+
function g() {
|
|
6247
6215
|
if (i === u)
|
|
6248
6216
|
return callRef(e, o, i, i.$async);
|
|
6249
6217
|
const R = t.scopeValue("root", { ref: u });
|
|
6250
6218
|
return callRef(e, (0, codegen_1$l._)`${R}.validate`, u, u.$async);
|
|
6251
6219
|
}
|
|
6252
6220
|
function O(R) {
|
|
6253
|
-
const
|
|
6254
|
-
callRef(e,
|
|
6221
|
+
const T = getValidate(e, R);
|
|
6222
|
+
callRef(e, T, R, R.$async);
|
|
6255
6223
|
}
|
|
6256
6224
|
function N(R) {
|
|
6257
|
-
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({
|
|
6258
6226
|
schema: R,
|
|
6259
6227
|
dataTypes: [],
|
|
6260
6228
|
schemaPath: codegen_1$l.nil,
|
|
6261
|
-
topSchemaRef:
|
|
6229
|
+
topSchemaRef: T,
|
|
6262
6230
|
errSchemaPath: r
|
|
6263
|
-
},
|
|
6264
|
-
e.mergeEvaluated(
|
|
6231
|
+
}, y);
|
|
6232
|
+
e.mergeEvaluated(_), e.ok(y);
|
|
6265
6233
|
}
|
|
6266
6234
|
}
|
|
6267
6235
|
};
|
|
@@ -6272,42 +6240,42 @@ function getValidate(e, t) {
|
|
|
6272
6240
|
ref.getValidate = getValidate;
|
|
6273
6241
|
function callRef(e, t, r, n) {
|
|
6274
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;
|
|
6275
|
-
n ? p() :
|
|
6243
|
+
n ? p() : g();
|
|
6276
6244
|
function p() {
|
|
6277
6245
|
if (!l.$async)
|
|
6278
6246
|
throw new Error("async schema referenced by sync schema");
|
|
6279
6247
|
const R = s.let("valid");
|
|
6280
6248
|
s.try(() => {
|
|
6281
6249
|
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), N(t), o || s.assign(R, !0);
|
|
6282
|
-
}, (
|
|
6283
|
-
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);
|
|
6284
6252
|
}), e.ok(R);
|
|
6285
6253
|
}
|
|
6286
|
-
function
|
|
6254
|
+
function g() {
|
|
6287
6255
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => N(t), () => O(t));
|
|
6288
6256
|
}
|
|
6289
6257
|
function O(R) {
|
|
6290
|
-
const
|
|
6291
|
-
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`);
|
|
6292
6260
|
}
|
|
6293
6261
|
function N(R) {
|
|
6294
|
-
var
|
|
6262
|
+
var T;
|
|
6295
6263
|
if (!i.opts.unevaluated)
|
|
6296
6264
|
return;
|
|
6297
|
-
const
|
|
6265
|
+
const y = (T = r == null ? void 0 : r.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
6298
6266
|
if (i.props !== !0)
|
|
6299
|
-
if (
|
|
6300
|
-
|
|
6267
|
+
if (y && !y.dynamicProps)
|
|
6268
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6301
6269
|
else {
|
|
6302
|
-
const
|
|
6303
|
-
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);
|
|
6304
6272
|
}
|
|
6305
6273
|
if (i.items !== !0)
|
|
6306
|
-
if (
|
|
6307
|
-
|
|
6274
|
+
if (y && !y.dynamicItems)
|
|
6275
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6308
6276
|
else {
|
|
6309
|
-
const
|
|
6310
|
-
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);
|
|
6311
6279
|
}
|
|
6312
6280
|
}
|
|
6313
6281
|
}
|
|
@@ -6449,15 +6417,15 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6449
6417
|
const d = r.length >= l.loopRequired;
|
|
6450
6418
|
if (o.allErrors ? u() : p(), l.strictRequired) {
|
|
6451
6419
|
const N = e.parentSchema.properties, { definedProperties: R } = e.it;
|
|
6452
|
-
for (const
|
|
6453
|
-
if ((N == null ? void 0 : N[
|
|
6454
|
-
const
|
|
6455
|
-
(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);
|
|
6456
6424
|
}
|
|
6457
6425
|
}
|
|
6458
6426
|
function u() {
|
|
6459
6427
|
if (d || i)
|
|
6460
|
-
e.block$data(codegen_1$f.nil,
|
|
6428
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6461
6429
|
else
|
|
6462
6430
|
for (const N of r)
|
|
6463
6431
|
(0, code_1$6.checkReportMissingProp)(e, N);
|
|
@@ -6470,7 +6438,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6470
6438
|
} else
|
|
6471
6439
|
t.if((0, code_1$6.checkMissingProp)(e, r, N)), (0, code_1$6.reportMissingProp)(e, N), t.else();
|
|
6472
6440
|
}
|
|
6473
|
-
function
|
|
6441
|
+
function g() {
|
|
6474
6442
|
t.forOf("prop", n, (N) => {
|
|
6475
6443
|
e.setParams({ missingProperty: N }), t.if((0, code_1$6.noPropertyInData)(t, s, N, l.ownProperties), () => e.error());
|
|
6476
6444
|
});
|
|
@@ -6527,24 +6495,24 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6527
6495
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6528
6496
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6529
6497
|
function p() {
|
|
6530
|
-
const R = t.let("i", (0, codegen_1$d._)`${r}.length`),
|
|
6531
|
-
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));
|
|
6532
6500
|
}
|
|
6533
|
-
function
|
|
6501
|
+
function g() {
|
|
6534
6502
|
return u.length > 0 && !u.some((R) => R === "object" || R === "array");
|
|
6535
6503
|
}
|
|
6536
|
-
function O(R,
|
|
6537
|
-
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._)`{}`);
|
|
6538
6506
|
t.for((0, codegen_1$d._)`;${R}--;`, () => {
|
|
6539
|
-
t.let(
|
|
6540
|
-
t.assign(
|
|
6541
|
-
}).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}`);
|
|
6542
6510
|
});
|
|
6543
6511
|
}
|
|
6544
|
-
function N(R,
|
|
6545
|
-
const
|
|
6546
|
-
t.label(
|
|
6547
|
-
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(_);
|
|
6548
6516
|
})));
|
|
6549
6517
|
}
|
|
6550
6518
|
}
|
|
@@ -6584,20 +6552,20 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6584
6552
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6585
6553
|
let p;
|
|
6586
6554
|
if (l || n)
|
|
6587
|
-
p = t.let("valid"), e.block$data(p,
|
|
6555
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6588
6556
|
else {
|
|
6589
6557
|
if (!Array.isArray(s))
|
|
6590
6558
|
throw new Error("ajv implementation error");
|
|
6591
6559
|
const N = t.const("vSchema", i);
|
|
6592
|
-
p = (0, codegen_1$b.or)(...s.map((R,
|
|
6560
|
+
p = (0, codegen_1$b.or)(...s.map((R, T) => O(N, T)));
|
|
6593
6561
|
}
|
|
6594
6562
|
e.pass(p);
|
|
6595
|
-
function
|
|
6563
|
+
function g() {
|
|
6596
6564
|
t.assign(p, !1), t.forOf("v", i, (N) => t.if((0, codegen_1$b._)`${u()}(${r}, ${N})`, () => t.assign(p, !0).break()));
|
|
6597
6565
|
}
|
|
6598
6566
|
function O(N, R) {
|
|
6599
|
-
const
|
|
6600
|
-
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}`;
|
|
6601
6569
|
}
|
|
6602
6570
|
}
|
|
6603
6571
|
};
|
|
@@ -6681,18 +6649,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6681
6649
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6682
6650
|
p(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6683
6651
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6684
|
-
r.forEach((
|
|
6685
|
-
(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({
|
|
6686
6654
|
keyword: o,
|
|
6687
6655
|
schemaProp: O,
|
|
6688
6656
|
dataProp: O
|
|
6689
6657
|
}, d)), e.ok(d));
|
|
6690
6658
|
});
|
|
6691
|
-
function p(
|
|
6692
|
-
const { opts: O, errSchemaPath: N } = l, R = r.length,
|
|
6693
|
-
if (O.strictTuples && !
|
|
6694
|
-
const
|
|
6695
|
-
(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);
|
|
6696
6664
|
}
|
|
6697
6665
|
}
|
|
6698
6666
|
}
|
|
@@ -6751,29 +6719,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6751
6719
|
return;
|
|
6752
6720
|
}
|
|
6753
6721
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
6754
|
-
let
|
|
6755
|
-
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);
|
|
6756
6724
|
return;
|
|
6757
6725
|
}
|
|
6758
6726
|
i.items = !0;
|
|
6759
|
-
const
|
|
6760
|
-
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());
|
|
6761
6729
|
function O() {
|
|
6762
|
-
const
|
|
6763
|
-
N(
|
|
6730
|
+
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6731
|
+
N(T, () => t.if(T, () => R(y)));
|
|
6764
6732
|
}
|
|
6765
|
-
function N(
|
|
6766
|
-
t.forRange("i", 0, p, (
|
|
6733
|
+
function N(T, y) {
|
|
6734
|
+
t.forRange("i", 0, p, (_) => {
|
|
6767
6735
|
e.subschema({
|
|
6768
6736
|
keyword: "contains",
|
|
6769
|
-
dataProp:
|
|
6737
|
+
dataProp: _,
|
|
6770
6738
|
dataPropType: util_1$a.Type.Num,
|
|
6771
6739
|
compositeRule: !0
|
|
6772
|
-
},
|
|
6740
|
+
}, T), y();
|
|
6773
6741
|
});
|
|
6774
6742
|
}
|
|
6775
|
-
function R(
|
|
6776
|
-
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)));
|
|
6777
6745
|
}
|
|
6778
6746
|
}
|
|
6779
6747
|
};
|
|
@@ -6784,11 +6752,11 @@ var dependencies = {};
|
|
|
6784
6752
|
const t = codegen, r = util, n = code;
|
|
6785
6753
|
e.error = {
|
|
6786
6754
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6787
|
-
const
|
|
6788
|
-
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`;
|
|
6789
6757
|
},
|
|
6790
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6791
|
-
missingProperty: ${
|
|
6758
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6759
|
+
missingProperty: ${g},
|
|
6792
6760
|
depsCount: ${u},
|
|
6793
6761
|
deps: ${p}}`
|
|
6794
6762
|
// TODO change to reference
|
|
@@ -6805,43 +6773,43 @@ var dependencies = {};
|
|
|
6805
6773
|
};
|
|
6806
6774
|
function i({ schema: d }) {
|
|
6807
6775
|
const u = {}, p = {};
|
|
6808
|
-
for (const
|
|
6809
|
-
if (
|
|
6776
|
+
for (const g in d) {
|
|
6777
|
+
if (g === "__proto__")
|
|
6810
6778
|
continue;
|
|
6811
|
-
const O = Array.isArray(d[
|
|
6812
|
-
O[
|
|
6779
|
+
const O = Array.isArray(d[g]) ? u : p;
|
|
6780
|
+
O[g] = d[g];
|
|
6813
6781
|
}
|
|
6814
6782
|
return [u, p];
|
|
6815
6783
|
}
|
|
6816
6784
|
function o(d, u = d.schema) {
|
|
6817
|
-
const { gen: p, data:
|
|
6785
|
+
const { gen: p, data: g, it: O } = d;
|
|
6818
6786
|
if (Object.keys(u).length === 0)
|
|
6819
6787
|
return;
|
|
6820
6788
|
const N = p.let("missing");
|
|
6821
6789
|
for (const R in u) {
|
|
6822
|
-
const
|
|
6823
|
-
if (
|
|
6790
|
+
const T = u[R];
|
|
6791
|
+
if (T.length === 0)
|
|
6824
6792
|
continue;
|
|
6825
|
-
const
|
|
6793
|
+
const y = (0, n.propertyInData)(p, g, R, O.opts.ownProperties);
|
|
6826
6794
|
d.setParams({
|
|
6827
6795
|
property: R,
|
|
6828
|
-
depsCount:
|
|
6829
|
-
deps:
|
|
6830
|
-
}), O.allErrors ? p.if(
|
|
6831
|
-
for (const
|
|
6832
|
-
(0, n.checkReportMissingProp)(d,
|
|
6833
|
-
}) : (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());
|
|
6834
6802
|
}
|
|
6835
6803
|
}
|
|
6836
6804
|
e.validatePropertyDeps = o;
|
|
6837
6805
|
function l(d, u = d.schema) {
|
|
6838
|
-
const { gen: p, data:
|
|
6839
|
-
for (const
|
|
6840
|
-
(0, r.alwaysValidSchema)(N, u[
|
|
6841
|
-
(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),
|
|
6842
6810
|
() => {
|
|
6843
|
-
const
|
|
6844
|
-
d.mergeValidEvaluated(
|
|
6811
|
+
const y = d.subschema({ keyword: O, schemaProp: T }, R);
|
|
6812
|
+
d.mergeValidEvaluated(y, R);
|
|
6845
6813
|
},
|
|
6846
6814
|
() => p.var(R, !0)
|
|
6847
6815
|
// TODO var
|
|
@@ -6898,51 +6866,51 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6898
6866
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6899
6867
|
return;
|
|
6900
6868
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6901
|
-
|
|
6902
|
-
function
|
|
6903
|
-
t.forIn("key", s, (
|
|
6904
|
-
!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));
|
|
6905
6873
|
});
|
|
6906
6874
|
}
|
|
6907
|
-
function O(
|
|
6908
|
-
let
|
|
6875
|
+
function O(y) {
|
|
6876
|
+
let _;
|
|
6909
6877
|
if (u.length > 8) {
|
|
6910
|
-
const
|
|
6911
|
-
|
|
6878
|
+
const $ = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6879
|
+
_ = (0, code_1$3.isOwnProperty)(t, $, y);
|
|
6912
6880
|
} else
|
|
6913
|
-
u.length ?
|
|
6914
|
-
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)(_);
|
|
6915
6883
|
}
|
|
6916
|
-
function N(
|
|
6917
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6884
|
+
function N(y) {
|
|
6885
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6918
6886
|
}
|
|
6919
|
-
function R(
|
|
6887
|
+
function R(y) {
|
|
6920
6888
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6921
|
-
N(
|
|
6889
|
+
N(y);
|
|
6922
6890
|
return;
|
|
6923
6891
|
}
|
|
6924
6892
|
if (r === !1) {
|
|
6925
|
-
e.setParams({ additionalProperty:
|
|
6893
|
+
e.setParams({ additionalProperty: y }), e.error(), l || t.break();
|
|
6926
6894
|
return;
|
|
6927
6895
|
}
|
|
6928
6896
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6929
|
-
const
|
|
6930
|
-
d.removeAdditional === "failing" ? (
|
|
6931
|
-
e.reset(), N(
|
|
6932
|
-
})) : (
|
|
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()));
|
|
6933
6901
|
}
|
|
6934
6902
|
}
|
|
6935
|
-
function
|
|
6936
|
-
const
|
|
6903
|
+
function T(y, _, $) {
|
|
6904
|
+
const P = {
|
|
6937
6905
|
keyword: "additionalProperties",
|
|
6938
|
-
dataProp:
|
|
6906
|
+
dataProp: y,
|
|
6939
6907
|
dataPropType: util_1$8.Type.Str
|
|
6940
6908
|
};
|
|
6941
|
-
|
|
6909
|
+
$ === !1 && Object.assign(P, {
|
|
6942
6910
|
compositeRule: !0,
|
|
6943
6911
|
createErrors: !1,
|
|
6944
6912
|
allErrors: !1
|
|
6945
|
-
}), e.subschema(
|
|
6913
|
+
}), e.subschema(P, _);
|
|
6946
6914
|
}
|
|
6947
6915
|
}
|
|
6948
6916
|
};
|
|
@@ -6957,23 +6925,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6957
6925
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6958
6926
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6959
6927
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6960
|
-
for (const
|
|
6961
|
-
i.definedProperties.add(
|
|
6928
|
+
for (const g of o)
|
|
6929
|
+
i.definedProperties.add(g);
|
|
6962
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));
|
|
6963
|
-
const l = o.filter((
|
|
6931
|
+
const l = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6964
6932
|
if (l.length === 0)
|
|
6965
6933
|
return;
|
|
6966
6934
|
const d = t.name("valid");
|
|
6967
|
-
for (const
|
|
6968
|
-
u(
|
|
6969
|
-
function u(
|
|
6970
|
-
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;
|
|
6971
6939
|
}
|
|
6972
|
-
function p(
|
|
6940
|
+
function p(g) {
|
|
6973
6941
|
e.subschema({
|
|
6974
6942
|
keyword: "properties",
|
|
6975
|
-
schemaProp:
|
|
6976
|
-
dataProp:
|
|
6943
|
+
schemaProp: g,
|
|
6944
|
+
dataProp: g
|
|
6977
6945
|
}, d);
|
|
6978
6946
|
}
|
|
6979
6947
|
}
|
|
@@ -6986,31 +6954,31 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6986
6954
|
type: "object",
|
|
6987
6955
|
schemaType: "object",
|
|
6988
6956
|
code(e) {
|
|
6989
|
-
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]));
|
|
6990
6958
|
if (l.length === 0 || d.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
6991
6959
|
return;
|
|
6992
6960
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6993
6961
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6994
|
-
const { props:
|
|
6962
|
+
const { props: g } = i;
|
|
6995
6963
|
O();
|
|
6996
6964
|
function O() {
|
|
6997
|
-
for (const
|
|
6998
|
-
u && N(
|
|
6999
|
-
}
|
|
7000
|
-
function N(
|
|
7001
|
-
for (const
|
|
7002
|
-
new RegExp(
|
|
7003
|
-
}
|
|
7004
|
-
function R(
|
|
7005
|
-
t.forIn("key", n, (
|
|
7006
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e,
|
|
7007
|
-
const
|
|
7008
|
-
|
|
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({
|
|
7009
6977
|
keyword: "patternProperties",
|
|
7010
|
-
schemaProp:
|
|
7011
|
-
dataProp:
|
|
6978
|
+
schemaProp: T,
|
|
6979
|
+
dataProp: y,
|
|
7012
6980
|
dataPropType: util_2.Type.Str
|
|
7013
|
-
}, 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());
|
|
7014
6982
|
});
|
|
7015
6983
|
});
|
|
7016
6984
|
}
|
|
@@ -7069,14 +7037,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7069
7037
|
const i = r, o = t.let("valid", !1), l = t.let("passing", null), d = t.name("_valid");
|
|
7070
7038
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7071
7039
|
function u() {
|
|
7072
|
-
i.forEach((p,
|
|
7040
|
+
i.forEach((p, g) => {
|
|
7073
7041
|
let O;
|
|
7074
7042
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : O = e.subschema({
|
|
7075
7043
|
keyword: "oneOf",
|
|
7076
|
-
schemaProp:
|
|
7044
|
+
schemaProp: g,
|
|
7077
7045
|
compositeRule: !0
|
|
7078
|
-
}, d),
|
|
7079
|
-
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);
|
|
7080
7048
|
});
|
|
7081
7049
|
});
|
|
7082
7050
|
}
|
|
@@ -7134,10 +7102,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7134
7102
|
}, l);
|
|
7135
7103
|
e.mergeEvaluated(p);
|
|
7136
7104
|
}
|
|
7137
|
-
function u(p,
|
|
7105
|
+
function u(p, g) {
|
|
7138
7106
|
return () => {
|
|
7139
7107
|
const O = e.subschema({ keyword: p }, l);
|
|
7140
|
-
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 });
|
|
7141
7109
|
};
|
|
7142
7110
|
}
|
|
7143
7111
|
}
|
|
@@ -7190,37 +7158,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7190
7158
|
$data: !0,
|
|
7191
7159
|
error: error$1,
|
|
7192
7160
|
code(e, t) {
|
|
7193
|
-
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;
|
|
7194
7162
|
if (!d.validateFormats)
|
|
7195
7163
|
return;
|
|
7196
7164
|
s ? O() : N();
|
|
7197
7165
|
function O() {
|
|
7198
7166
|
const R = r.scopeValue("formats", {
|
|
7199
|
-
ref:
|
|
7167
|
+
ref: g.formats,
|
|
7200
7168
|
code: d.code.formats
|
|
7201
|
-
}),
|
|
7202
|
-
r.if((0, codegen_1$1._)`typeof ${
|
|
7203
|
-
function
|
|
7204
|
-
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} && !${_}`;
|
|
7205
7173
|
}
|
|
7206
|
-
function
|
|
7207
|
-
const I = p.$async ? (0, codegen_1$1._)`(${
|
|
7208
|
-
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}`;
|
|
7209
7177
|
}
|
|
7210
7178
|
}
|
|
7211
7179
|
function N() {
|
|
7212
|
-
const R =
|
|
7180
|
+
const R = g.formats[i];
|
|
7213
7181
|
if (!R) {
|
|
7214
|
-
|
|
7182
|
+
$();
|
|
7215
7183
|
return;
|
|
7216
7184
|
}
|
|
7217
7185
|
if (R === !0)
|
|
7218
7186
|
return;
|
|
7219
|
-
const [
|
|
7220
|
-
|
|
7221
|
-
function
|
|
7187
|
+
const [T, y, _] = P(R);
|
|
7188
|
+
T === t && e.pass(I());
|
|
7189
|
+
function $() {
|
|
7222
7190
|
if (d.strictSchema === !1) {
|
|
7223
|
-
|
|
7191
|
+
g.logger.warn(D());
|
|
7224
7192
|
return;
|
|
7225
7193
|
}
|
|
7226
7194
|
throw new Error(D());
|
|
@@ -7228,7 +7196,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7228
7196
|
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7229
7197
|
}
|
|
7230
7198
|
}
|
|
7231
|
-
function
|
|
7199
|
+
function P(D) {
|
|
7232
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 });
|
|
7233
7201
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
7234
7202
|
}
|
|
@@ -7236,9 +7204,9 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7236
7204
|
if (typeof R == "object" && !(R instanceof RegExp) && R.async) {
|
|
7237
7205
|
if (!p.$async)
|
|
7238
7206
|
throw new Error("async format in sync schema");
|
|
7239
|
-
return (0, codegen_1$1._)`await ${
|
|
7207
|
+
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7240
7208
|
}
|
|
7241
|
-
return typeof
|
|
7209
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${_}(${n})` : (0, codegen_1$1._)`${_}.test(${n})`;
|
|
7242
7210
|
}
|
|
7243
7211
|
}
|
|
7244
7212
|
}
|
|
@@ -7306,41 +7274,41 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7306
7274
|
const N = O();
|
|
7307
7275
|
t.if(!1);
|
|
7308
7276
|
for (const R in N)
|
|
7309
|
-
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d,
|
|
7277
|
+
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d, g(N[R]));
|
|
7310
7278
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7311
7279
|
}
|
|
7312
|
-
function
|
|
7313
|
-
const R = t.name("valid"),
|
|
7314
|
-
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;
|
|
7315
7283
|
}
|
|
7316
7284
|
function O() {
|
|
7317
7285
|
var N;
|
|
7318
|
-
const R = {},
|
|
7319
|
-
let
|
|
7286
|
+
const R = {}, T = _(s);
|
|
7287
|
+
let y = !0;
|
|
7320
7288
|
for (let I = 0; I < o.length; I++) {
|
|
7321
7289
|
let D = o[I];
|
|
7322
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));
|
|
7323
7291
|
const w = (N = D == null ? void 0 : D.properties) === null || N === void 0 ? void 0 : N[l];
|
|
7324
7292
|
if (typeof w != "object")
|
|
7325
7293
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7326
|
-
|
|
7294
|
+
y = y && (T || _(D)), $(w, I);
|
|
7327
7295
|
}
|
|
7328
|
-
if (!
|
|
7296
|
+
if (!y)
|
|
7329
7297
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7330
7298
|
return R;
|
|
7331
|
-
function
|
|
7299
|
+
function _({ required: I }) {
|
|
7332
7300
|
return Array.isArray(I) && I.includes(l);
|
|
7333
7301
|
}
|
|
7334
|
-
function
|
|
7302
|
+
function $(I, D) {
|
|
7335
7303
|
if (I.const)
|
|
7336
|
-
|
|
7304
|
+
P(I.const, D);
|
|
7337
7305
|
else if (I.enum)
|
|
7338
7306
|
for (const w of I.enum)
|
|
7339
|
-
|
|
7307
|
+
P(w, D);
|
|
7340
7308
|
else
|
|
7341
7309
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7342
7310
|
}
|
|
7343
|
-
function
|
|
7311
|
+
function P(I, D) {
|
|
7344
7312
|
if (typeof I != "string" || I in R)
|
|
7345
7313
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7346
7314
|
R[I] = D;
|
|
@@ -7626,9 +7594,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7626
7594
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7627
7595
|
return p.CodeGen;
|
|
7628
7596
|
} });
|
|
7629
|
-
var
|
|
7597
|
+
var g = validation_error;
|
|
7630
7598
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7631
|
-
return
|
|
7599
|
+
return g.default;
|
|
7632
7600
|
} });
|
|
7633
7601
|
var O = ref_error;
|
|
7634
7602
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -7996,7 +7964,10 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7996
7964
|
},
|
|
7997
7965
|
SupportedPHPExtensionBundle: {
|
|
7998
7966
|
type: "string",
|
|
7999
|
-
|
|
7967
|
+
enum: [
|
|
7968
|
+
"kitchen-sink",
|
|
7969
|
+
"light"
|
|
7970
|
+
]
|
|
8000
7971
|
},
|
|
8001
7972
|
StepDefinition: {
|
|
8002
7973
|
type: "object",
|
|
@@ -8209,6 +8180,36 @@ for existing apps using this option.`
|
|
|
8209
8180
|
"step"
|
|
8210
8181
|
]
|
|
8211
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
|
+
},
|
|
8212
8213
|
{
|
|
8213
8214
|
type: "object",
|
|
8214
8215
|
additionalProperties: !1,
|
|
@@ -9182,10 +9183,6 @@ for existing apps using this option.`
|
|
|
9182
9183
|
code: {
|
|
9183
9184
|
type: "string",
|
|
9184
9185
|
description: "The code snippet to eval instead of a php file."
|
|
9185
|
-
},
|
|
9186
|
-
throwOnError: {
|
|
9187
|
-
type: "boolean",
|
|
9188
|
-
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9189
9186
|
}
|
|
9190
9187
|
},
|
|
9191
9188
|
additionalProperties: !1
|
|
@@ -9208,7 +9205,8 @@ for existing apps using this option.`
|
|
|
9208
9205
|
definitions
|
|
9209
9206
|
}, { wpCLI, ...otherStepHandlers } = allStepHandlers, keyedStepHandlers = {
|
|
9210
9207
|
...otherStepHandlers,
|
|
9211
|
-
"wp-cli": wpCLI
|
|
9208
|
+
"wp-cli": wpCLI,
|
|
9209
|
+
importFile: otherStepHandlers.importWxr
|
|
9212
9210
|
};
|
|
9213
9211
|
function compileBlueprint(e, {
|
|
9214
9212
|
progress: t = new ProgressTracker(),
|
|
@@ -9216,39 +9214,46 @@ function compileBlueprint(e, {
|
|
|
9216
9214
|
onStepCompleted: n = () => {
|
|
9217
9215
|
}
|
|
9218
9216
|
} = {}) {
|
|
9219
|
-
var
|
|
9220
|
-
|
|
9217
|
+
var g, O, N, R, T, y, _;
|
|
9218
|
+
e = {
|
|
9221
9219
|
...e,
|
|
9222
9220
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
9223
|
-
}
|
|
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({
|
|
9224
9227
|
step: "defineWpConfigConsts",
|
|
9225
9228
|
consts: e.constants
|
|
9226
9229
|
}), e.siteOptions && e.steps.unshift({
|
|
9227
9230
|
step: "setSiteOptions",
|
|
9228
9231
|
options: e.siteOptions
|
|
9229
9232
|
}), e.plugins) {
|
|
9230
|
-
const
|
|
9233
|
+
const $ = e.plugins.map((P) => typeof P == "string" ? P.startsWith("https://") ? {
|
|
9231
9234
|
resource: "url",
|
|
9232
|
-
url:
|
|
9235
|
+
url: P
|
|
9233
9236
|
} : {
|
|
9234
9237
|
resource: "wordpress.org/plugins",
|
|
9235
|
-
slug:
|
|
9236
|
-
} :
|
|
9238
|
+
slug: P
|
|
9239
|
+
} : P).map((P) => ({
|
|
9237
9240
|
step: "installPlugin",
|
|
9238
|
-
pluginZipFile:
|
|
9241
|
+
pluginZipFile: P
|
|
9239
9242
|
}));
|
|
9240
|
-
e.steps.unshift(
|
|
9243
|
+
e.steps.unshift(...$);
|
|
9241
9244
|
}
|
|
9242
9245
|
e.login && e.steps.push({
|
|
9243
9246
|
step: "login",
|
|
9244
9247
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9245
|
-
});
|
|
9246
|
-
const s = (
|
|
9247
|
-
(
|
|
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"
|
|
9248
9251
|
);
|
|
9249
|
-
s !== void 0 && s > -1 && (e.phpExtensionBundles
|
|
9250
|
-
|
|
9251
|
-
)
|
|
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, {
|
|
9252
9257
|
step: "writeFile",
|
|
9253
9258
|
data: {
|
|
9254
9259
|
resource: "url",
|
|
@@ -9266,34 +9271,49 @@ function compileBlueprint(e, {
|
|
|
9266
9271
|
},
|
|
9267
9272
|
path: "/tmp/wp-cli.phar"
|
|
9268
9273
|
}));
|
|
9269
|
-
const
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
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}`
|
|
9273
9293
|
);
|
|
9274
|
-
throw
|
|
9294
|
+
throw $.errors = l, $;
|
|
9275
9295
|
}
|
|
9276
|
-
const
|
|
9277
|
-
(
|
|
9278
|
-
var
|
|
9279
|
-
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);
|
|
9280
9300
|
},
|
|
9281
9301
|
0
|
|
9282
|
-
),
|
|
9283
|
-
(
|
|
9302
|
+
), p = d.map(
|
|
9303
|
+
($) => compileStep($, {
|
|
9284
9304
|
semaphore: r,
|
|
9285
9305
|
rootProgressTracker: t,
|
|
9286
|
-
totalProgressWeight:
|
|
9306
|
+
totalProgressWeight: u
|
|
9287
9307
|
})
|
|
9288
9308
|
);
|
|
9289
9309
|
return {
|
|
9290
9310
|
versions: {
|
|
9291
9311
|
php: compileVersion(
|
|
9292
|
-
(
|
|
9312
|
+
(T = e.preferredVersions) == null ? void 0 : T.php,
|
|
9293
9313
|
SupportedPHPVersions,
|
|
9294
9314
|
LatestSupportedPHPVersion
|
|
9295
9315
|
),
|
|
9296
|
-
wp: ((
|
|
9316
|
+
wp: ((y = e.preferredVersions) == null ? void 0 : y.wp) || "latest"
|
|
9297
9317
|
},
|
|
9298
9318
|
phpExtensions: compilePHPExtensions(
|
|
9299
9319
|
[],
|
|
@@ -9301,28 +9321,28 @@ function compileBlueprint(e, {
|
|
|
9301
9321
|
),
|
|
9302
9322
|
features: {
|
|
9303
9323
|
// Disable networking by default
|
|
9304
|
-
networking: ((
|
|
9324
|
+
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9305
9325
|
},
|
|
9306
|
-
run: async (
|
|
9326
|
+
run: async ($) => {
|
|
9307
9327
|
try {
|
|
9308
|
-
for (const { resources:
|
|
9309
|
-
for (const
|
|
9310
|
-
|
|
9311
|
-
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))
|
|
9312
9332
|
try {
|
|
9313
|
-
const
|
|
9314
|
-
n(
|
|
9315
|
-
} catch (
|
|
9316
|
-
throw console.error(
|
|
9317
|
-
`Error when executing the blueprint step #${
|
|
9318
|
-
|
|
9319
|
-
)}) ${
|
|
9320
|
-
{ 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 }
|
|
9321
9341
|
);
|
|
9322
9342
|
}
|
|
9323
9343
|
} finally {
|
|
9324
9344
|
try {
|
|
9325
|
-
await
|
|
9345
|
+
await $.goTo(
|
|
9326
9346
|
e.landingPage || "/"
|
|
9327
9347
|
);
|
|
9328
9348
|
} catch {
|
|
@@ -9374,17 +9394,17 @@ function compileStep(e, {
|
|
|
9374
9394
|
const s = r.stage(
|
|
9375
9395
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9376
9396
|
), i = {};
|
|
9377
|
-
for (const
|
|
9378
|
-
let O = e[
|
|
9397
|
+
for (const g of Object.keys(e)) {
|
|
9398
|
+
let O = e[g];
|
|
9379
9399
|
isFileReference(O) && (O = Resource.create(O, {
|
|
9380
9400
|
semaphore: t
|
|
9381
|
-
})), i[
|
|
9401
|
+
})), i[g] = O;
|
|
9382
9402
|
}
|
|
9383
|
-
const o = async (
|
|
9403
|
+
const o = async (g) => {
|
|
9384
9404
|
var O;
|
|
9385
9405
|
try {
|
|
9386
9406
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9387
|
-
|
|
9407
|
+
g,
|
|
9388
9408
|
await resolveArguments(i),
|
|
9389
9409
|
{
|
|
9390
9410
|
tracker: s,
|
|
@@ -9395,10 +9415,10 @@ function compileStep(e, {
|
|
|
9395
9415
|
s.finish();
|
|
9396
9416
|
}
|
|
9397
9417
|
}, l = getResources(i), d = getResources(i).filter(
|
|
9398
|
-
(
|
|
9418
|
+
(g) => g.isAsync
|
|
9399
9419
|
), u = 1 / (d.length + 1);
|
|
9400
|
-
for (const
|
|
9401
|
-
|
|
9420
|
+
for (const g of d)
|
|
9421
|
+
g.progress = s.stage(u);
|
|
9402
9422
|
return { run: o, step: e, resources: l };
|
|
9403
9423
|
}
|
|
9404
9424
|
function getResources(e) {
|
|
@@ -9431,9 +9451,8 @@ export {
|
|
|
9431
9451
|
defineWpConfigConsts,
|
|
9432
9452
|
enableMultisite,
|
|
9433
9453
|
exportWXR,
|
|
9434
|
-
exportWXZ,
|
|
9435
|
-
importFile,
|
|
9436
9454
|
importWordPressFiles,
|
|
9455
|
+
importWxr,
|
|
9437
9456
|
installPlugin,
|
|
9438
9457
|
installTheme,
|
|
9439
9458
|
login,
|