@wp-playground/client 0.6.14 → 0.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +19 -19
- package/index.d.ts +27 -11
- package/index.js +860 -826
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -274,7 +274,7 @@ require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
|
274
274
|
require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
|
|
275
275
|
|
|
276
276
|
// Set current user to admin
|
|
277
|
-
|
|
277
|
+
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
278
278
|
|
|
279
279
|
$plugin_path = ${phpVar(t)};
|
|
280
280
|
|
|
@@ -304,7 +304,7 @@ define( 'WP_ADMIN', true );
|
|
|
304
304
|
require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
305
305
|
|
|
306
306
|
// Set current user to admin
|
|
307
|
-
|
|
307
|
+
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
308
308
|
|
|
309
309
|
switch_theme( ${phpVar(t)} );
|
|
310
310
|
`
|
|
@@ -777,8 +777,8 @@ const enableMultisite = async (e) => {
|
|
|
777
777
|
});
|
|
778
778
|
const t = new URL(await e.absoluteUrl);
|
|
779
779
|
if (t.port !== "") {
|
|
780
|
-
let
|
|
781
|
-
throw t.hostname === "localhost" && (
|
|
780
|
+
let C = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
781
|
+
throw t.hostname === "localhost" && (C += " For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."), new Error(C);
|
|
782
782
|
}
|
|
783
783
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
784
784
|
await setSiteOptions(e, {
|
|
@@ -793,7 +793,7 @@ define( 'WP_ADMIN', true );
|
|
|
793
793
|
require_once(${phpVar(s)} . "/wp-load.php");
|
|
794
794
|
|
|
795
795
|
// Set current user to admin
|
|
796
|
-
|
|
796
|
+
( get_users(array('role' => 'Administrator') )[0] );
|
|
797
797
|
|
|
798
798
|
require_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");
|
|
799
799
|
$plugins_root = ${phpVar(s)} . "/wp-content/plugins";
|
|
@@ -858,23 +858,23 @@ echo json_encode($deactivated_plugins);
|
|
|
858
858
|
PATH_CURRENT_SITE: r
|
|
859
859
|
}
|
|
860
860
|
});
|
|
861
|
-
const p = new URL(await e.absoluteUrl),
|
|
861
|
+
const p = new URL(await e.absoluteUrl), _ = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
862
862
|
await e.writeFile(
|
|
863
863
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
864
864
|
`<?php
|
|
865
865
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
866
866
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
867
867
|
}
|
|
868
|
-
$folder = ${phpVar(
|
|
868
|
+
$folder = ${phpVar(_)};
|
|
869
869
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
870
870
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
871
871
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
872
872
|
}
|
|
873
873
|
`
|
|
874
874
|
), await login(e, {});
|
|
875
|
-
for (const
|
|
875
|
+
for (const C of o)
|
|
876
876
|
await activatePlugin(e, {
|
|
877
|
-
pluginPath:
|
|
877
|
+
pluginPath: C
|
|
878
878
|
});
|
|
879
879
|
};
|
|
880
880
|
function jsonToUrlEncoded(e) {
|
|
@@ -1050,13 +1050,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1050
1050
|
}), s = joinPaths(s, r);
|
|
1051
1051
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1052
1052
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1053
|
-
const
|
|
1053
|
+
const _ = joinPaths(
|
|
1054
1054
|
i,
|
|
1055
1055
|
p
|
|
1056
1056
|
);
|
|
1057
|
-
await removePath(e,
|
|
1057
|
+
await removePath(e, _);
|
|
1058
1058
|
const T = joinPaths(o, p);
|
|
1059
|
-
await e.fileExists(T) && (await e.mkdir(dirname(
|
|
1059
|
+
await e.fileExists(T) && (await e.mkdir(dirname(_)), await e.mv(T, _));
|
|
1060
1060
|
}
|
|
1061
1061
|
const c = joinPaths(
|
|
1062
1062
|
s,
|
|
@@ -1095,30 +1095,54 @@ async function exportWXR(e) {
|
|
|
1095
1095
|
});
|
|
1096
1096
|
return new File([t.bytes], "export.xml");
|
|
1097
1097
|
}
|
|
1098
|
-
async function installAsset(e, {
|
|
1099
|
-
|
|
1100
|
-
|
|
1098
|
+
async function installAsset(e, {
|
|
1099
|
+
targetPath: t,
|
|
1100
|
+
zipFile: r,
|
|
1101
|
+
ifAlreadyInstalled: n = "overwrite"
|
|
1102
|
+
}) {
|
|
1103
|
+
const i = r.name.replace(/\.zip$/, ""), o = joinPaths(await e.documentRoot, "wp-content"), c = joinPaths(o, randomString()), d = joinPaths(c, "assets", i);
|
|
1104
|
+
await e.fileExists(d) && await e.rmdir(c, {
|
|
1101
1105
|
recursive: !0
|
|
1102
|
-
}), await e.mkdir(
|
|
1106
|
+
}), await e.mkdir(c);
|
|
1103
1107
|
try {
|
|
1104
1108
|
await unzip(e, {
|
|
1105
1109
|
zipFile: r,
|
|
1106
|
-
extractToPath:
|
|
1110
|
+
extractToPath: d
|
|
1107
1111
|
});
|
|
1108
|
-
let
|
|
1112
|
+
let u = await e.listFiles(d, {
|
|
1109
1113
|
prependPath: !0
|
|
1110
1114
|
});
|
|
1111
|
-
|
|
1112
|
-
const
|
|
1113
|
-
let
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1115
|
+
u = u.filter((S) => !S.endsWith("/__MACOSX"));
|
|
1116
|
+
const p = u.length === 1 && await e.isDir(u[0]);
|
|
1117
|
+
let _, T = "";
|
|
1118
|
+
p ? (T = u[0], _ = u[0].split("/").pop()) : (T = d, _ = i);
|
|
1119
|
+
const C = `${t}/${_}`;
|
|
1120
|
+
if (await e.fileExists(C)) {
|
|
1121
|
+
if (!await e.isDir(C))
|
|
1122
|
+
throw new Error(
|
|
1123
|
+
`Cannot install asset ${_} to ${C} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`
|
|
1124
|
+
);
|
|
1125
|
+
if (n === "overwrite")
|
|
1126
|
+
await e.rmdir(C, {
|
|
1127
|
+
recursive: !0
|
|
1128
|
+
});
|
|
1129
|
+
else {
|
|
1130
|
+
if (n === "skip")
|
|
1131
|
+
return {
|
|
1132
|
+
assetFolderPath: C,
|
|
1133
|
+
assetFolderName: _
|
|
1134
|
+
};
|
|
1135
|
+
throw new Error(
|
|
1136
|
+
`Cannot install asset ${_} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
return await e.mv(T, C), {
|
|
1141
|
+
assetFolderPath: C,
|
|
1142
|
+
assetFolderName: _
|
|
1119
1143
|
};
|
|
1120
1144
|
} finally {
|
|
1121
|
-
await e.rmdir(
|
|
1145
|
+
await e.rmdir(c, {
|
|
1122
1146
|
recursive: !0
|
|
1123
1147
|
});
|
|
1124
1148
|
}
|
|
@@ -1127,34 +1151,36 @@ function zipNameToHumanName(e) {
|
|
|
1127
1151
|
const t = e.split(".").shift().replace(/-/g, " ");
|
|
1128
1152
|
return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
|
|
1129
1153
|
}
|
|
1130
|
-
const installPlugin = async (e, { pluginZipFile: t,
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
const { assetFolderPath:
|
|
1154
|
+
const installPlugin = async (e, { pluginZipFile: t, ifAlreadyInstalled: r, options: n = {} }, s) => {
|
|
1155
|
+
const i = t.name.split("/").pop() || "plugin.zip", o = zipNameToHumanName(i);
|
|
1156
|
+
s == null || s.tracker.setCaption(`Installing the ${o} plugin`);
|
|
1157
|
+
const { assetFolderPath: c } = await installAsset(e, {
|
|
1158
|
+
ifAlreadyInstalled: r,
|
|
1134
1159
|
zipFile: t,
|
|
1135
1160
|
targetPath: `${await e.documentRoot}/wp-content/plugins`
|
|
1136
1161
|
});
|
|
1137
|
-
("activate" in
|
|
1162
|
+
("activate" in n ? n.activate : !0) && await activatePlugin(
|
|
1138
1163
|
e,
|
|
1139
1164
|
{
|
|
1140
|
-
pluginPath:
|
|
1141
|
-
pluginName:
|
|
1165
|
+
pluginPath: c,
|
|
1166
|
+
pluginName: o
|
|
1142
1167
|
},
|
|
1143
|
-
|
|
1168
|
+
s
|
|
1144
1169
|
);
|
|
1145
|
-
}, installTheme = async (e, { themeZipFile: t,
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
const { assetFolderName:
|
|
1170
|
+
}, installTheme = async (e, { themeZipFile: t, ifAlreadyInstalled: r, options: n = {} }, s) => {
|
|
1171
|
+
const i = zipNameToHumanName(t.name);
|
|
1172
|
+
s == null || s.tracker.setCaption(`Installing the ${i} theme`);
|
|
1173
|
+
const { assetFolderName: o } = await installAsset(e, {
|
|
1174
|
+
ifAlreadyInstalled: r,
|
|
1149
1175
|
zipFile: t,
|
|
1150
1176
|
targetPath: `${await e.documentRoot}/wp-content/themes`
|
|
1151
1177
|
});
|
|
1152
|
-
("activate" in
|
|
1178
|
+
("activate" in n ? n.activate : !0) && await activateTheme(
|
|
1153
1179
|
e,
|
|
1154
1180
|
{
|
|
1155
|
-
themeFolderName:
|
|
1181
|
+
themeFolderName: o
|
|
1156
1182
|
},
|
|
1157
|
-
|
|
1183
|
+
s
|
|
1158
1184
|
);
|
|
1159
1185
|
}, runWpInstallationWizard = async (e, { options: t }) => {
|
|
1160
1186
|
await e.request({
|
|
@@ -1918,9 +1944,12 @@ class PHPRequestHandler {
|
|
|
1918
1944
|
t.url.split("#")[0],
|
|
1919
1945
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1920
1946
|
), s = applyRewriteRules(
|
|
1921
|
-
removePathPrefix(
|
|
1947
|
+
removePathPrefix(
|
|
1948
|
+
decodeURIComponent(n.pathname),
|
|
1949
|
+
H(this, ve)
|
|
1950
|
+
),
|
|
1922
1951
|
this.rewriteRules
|
|
1923
|
-
), i =
|
|
1952
|
+
), i = joinPaths(H(this, Pe), s);
|
|
1924
1953
|
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
|
|
1925
1954
|
}
|
|
1926
1955
|
}
|
|
@@ -1978,7 +2007,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1978
2007
|
}
|
|
1979
2008
|
let d;
|
|
1980
2009
|
try {
|
|
1981
|
-
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2010
|
+
d = ce(this, gt, Bt).call(this, decodeURIComponent(r.pathname));
|
|
1982
2011
|
} catch {
|
|
1983
2012
|
return new PHPResponse(
|
|
1984
2013
|
404,
|
|
@@ -1986,17 +2015,24 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1986
2015
|
new TextEncoder().encode("404 File not found")
|
|
1987
2016
|
);
|
|
1988
2017
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2018
|
+
try {
|
|
2019
|
+
return await this.php.run({
|
|
2020
|
+
relativeUri: ensurePathPrefix(
|
|
2021
|
+
toRelativeUrl(r),
|
|
2022
|
+
H(this, ve)
|
|
2023
|
+
),
|
|
2024
|
+
protocol: H(this, Ke),
|
|
2025
|
+
method: t.method || i,
|
|
2026
|
+
body: c,
|
|
2027
|
+
scriptPath: d,
|
|
2028
|
+
headers: o
|
|
2029
|
+
});
|
|
2030
|
+
} catch (u) {
|
|
2031
|
+
const p = u;
|
|
2032
|
+
if (p != null && p.response)
|
|
2033
|
+
return p.response;
|
|
2034
|
+
throw u;
|
|
2035
|
+
}
|
|
2000
2036
|
} finally {
|
|
2001
2037
|
n();
|
|
2002
2038
|
}
|
|
@@ -2156,8 +2192,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2156
2192
|
} catch (c) {
|
|
2157
2193
|
const d = typeof c == "object" ? c == null ? void 0 : c.errno : null;
|
|
2158
2194
|
if (d in FileErrorCodes) {
|
|
2159
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2160
|
-
throw new Error(`${
|
|
2195
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, _ = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2196
|
+
throw new Error(`${_}: ${u}`, {
|
|
2161
2197
|
cause: c
|
|
2162
2198
|
});
|
|
2163
2199
|
}
|
|
@@ -2180,7 +2216,12 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2180
2216
|
return n && s && __defProp(t, r, s), s;
|
|
2181
2217
|
};
|
|
2182
2218
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2183
|
-
|
|
2219
|
+
class PHPExecutionFailureError extends Error {
|
|
2220
|
+
constructor(t, r, n) {
|
|
2221
|
+
super(t), this.response = r, this.source = n;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
var Me, Ze, Ye, Ee, Re, Te, be, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, Et, Yt, bt, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2184
2225
|
class BasePHP {
|
|
2185
2226
|
/**
|
|
2186
2227
|
* Initializes a PHP runtime.
|
|
@@ -2195,8 +2236,8 @@ class BasePHP {
|
|
|
2195
2236
|
Q(this, vt);
|
|
2196
2237
|
Q(this, wt);
|
|
2197
2238
|
Q(this, Pt);
|
|
2198
|
-
Q(this, bt);
|
|
2199
2239
|
Q(this, Et);
|
|
2240
|
+
Q(this, bt);
|
|
2200
2241
|
Q(this, St);
|
|
2201
2242
|
Q(this, Rt);
|
|
2202
2243
|
Q(this, Tt);
|
|
@@ -2205,24 +2246,24 @@ class BasePHP {
|
|
|
2205
2246
|
Q(this, Me, void 0);
|
|
2206
2247
|
Q(this, Ze, void 0);
|
|
2207
2248
|
Q(this, Ye, void 0);
|
|
2208
|
-
Q(this,
|
|
2249
|
+
Q(this, Ee, void 0);
|
|
2209
2250
|
Q(this, Re, void 0);
|
|
2210
2251
|
Q(this, Te, void 0);
|
|
2211
|
-
Q(this,
|
|
2252
|
+
Q(this, be, void 0);
|
|
2212
2253
|
Q(this, Xe, void 0);
|
|
2213
|
-
te(this, Me, []), te(this,
|
|
2254
|
+
te(this, Me, []), te(this, Ee, !1), te(this, Re, null), te(this, Te, {}), te(this, be, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
|
|
2214
2255
|
new PHPRequestHandler(this, t)
|
|
2215
2256
|
));
|
|
2216
2257
|
}
|
|
2217
2258
|
addEventListener(e, t) {
|
|
2218
|
-
H(this,
|
|
2259
|
+
H(this, be).has(e) || H(this, be).set(e, /* @__PURE__ */ new Set()), H(this, be).get(e).add(t);
|
|
2219
2260
|
}
|
|
2220
2261
|
removeEventListener(e, t) {
|
|
2221
2262
|
var r;
|
|
2222
|
-
(r = H(this,
|
|
2263
|
+
(r = H(this, be).get(e)) == null || r.delete(t);
|
|
2223
2264
|
}
|
|
2224
2265
|
dispatchEvent(e) {
|
|
2225
|
-
const t = H(this,
|
|
2266
|
+
const t = H(this, be).get(e.type);
|
|
2226
2267
|
if (t)
|
|
2227
2268
|
for (const r of t)
|
|
2228
2269
|
r(e);
|
|
@@ -2285,7 +2326,7 @@ class BasePHP {
|
|
|
2285
2326
|
}
|
|
2286
2327
|
/** @inheritDoc */
|
|
2287
2328
|
setPhpIniPath(e) {
|
|
2288
|
-
if (H(this,
|
|
2329
|
+
if (H(this, Ee))
|
|
2289
2330
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2290
2331
|
te(this, Ze, e), this[__private__dont__use].ccall(
|
|
2291
2332
|
"wasm_set_phpini_path",
|
|
@@ -2296,7 +2337,7 @@ class BasePHP {
|
|
|
2296
2337
|
}
|
|
2297
2338
|
/** @inheritDoc */
|
|
2298
2339
|
setPhpIniEntry(e, t) {
|
|
2299
|
-
if (H(this,
|
|
2340
|
+
if (H(this, Ee))
|
|
2300
2341
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2301
2342
|
H(this, Me).push([e, t]);
|
|
2302
2343
|
}
|
|
@@ -2315,27 +2356,25 @@ class BasePHP {
|
|
|
2315
2356
|
const t = await this.semaphore.acquire();
|
|
2316
2357
|
let r;
|
|
2317
2358
|
try {
|
|
2318
|
-
if (H(this,
|
|
2359
|
+
if (H(this, Ee) || (ce(this, yt, Gt).call(this), te(this, Ee, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2319
2360
|
throw new Error(
|
|
2320
2361
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2321
2362
|
);
|
|
2322
2363
|
ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Zt).call(this, e.method || "GET");
|
|
2323
2364
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2324
|
-
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this,
|
|
2365
|
+
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this, Et, Yt).call(this, n), e.body && (r = ce(this, bt, Xt).call(this, e.body)), typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
2325
2366
|
const i = e.env || {};
|
|
2326
2367
|
for (const c in i)
|
|
2327
2368
|
ce(this, Tt, rr).call(this, c, i[c]);
|
|
2328
2369
|
const o = await ce(this, Ct, sr).call(this);
|
|
2329
2370
|
if (o.exitCode !== 0) {
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
const d = new Error(
|
|
2336
|
-
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2371
|
+
console.warn("PHP.run() output was:", o.text);
|
|
2372
|
+
const c = new PHPExecutionFailureError(
|
|
2373
|
+
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors,
|
|
2374
|
+
o,
|
|
2375
|
+
"request"
|
|
2337
2376
|
);
|
|
2338
|
-
throw
|
|
2377
|
+
throw console.error(c), c;
|
|
2339
2378
|
}
|
|
2340
2379
|
return o;
|
|
2341
2380
|
} catch (n) {
|
|
@@ -2465,10 +2504,10 @@ class BasePHP {
|
|
|
2465
2504
|
this[__private__dont__use]._exit(e);
|
|
2466
2505
|
} catch {
|
|
2467
2506
|
}
|
|
2468
|
-
te(this,
|
|
2507
|
+
te(this, Ee, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2469
2508
|
}
|
|
2470
2509
|
}
|
|
2471
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(),
|
|
2510
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
|
|
2472
2511
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2473
2512
|
"/internal/consts.php",
|
|
2474
2513
|
`<?php
|
|
@@ -2550,7 +2589,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2550
2589
|
[STRING],
|
|
2551
2590
|
[e]
|
|
2552
2591
|
);
|
|
2553
|
-
},
|
|
2592
|
+
}, Et = new WeakSet(), Yt = function(e) {
|
|
2554
2593
|
e.cookie && this[__private__dont__use].ccall(
|
|
2555
2594
|
"wasm_set_cookies",
|
|
2556
2595
|
null,
|
|
@@ -2574,7 +2613,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2574
2613
|
e[t]
|
|
2575
2614
|
);
|
|
2576
2615
|
}
|
|
2577
|
-
},
|
|
2616
|
+
}, bt = new WeakSet(), Xt = function(e) {
|
|
2578
2617
|
let t, r;
|
|
2579
2618
|
typeof e == "string" ? (console.warn(
|
|
2580
2619
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2664,7 +2703,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2664
2703
|
}
|
|
2665
2704
|
const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
|
|
2666
2705
|
return new PHPResponse(
|
|
2667
|
-
n,
|
|
2706
|
+
e === 0 ? n : 500,
|
|
2668
2707
|
r,
|
|
2669
2708
|
this.readFileAsBuffer("/internal/stdout"),
|
|
2670
2709
|
this.readFileAsText("/internal/stderr"),
|
|
@@ -2998,78 +3037,78 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2998
3037
|
}
|
|
2999
3038
|
}
|
|
3000
3039
|
e._Code = n, e.nil = new n("");
|
|
3001
|
-
function s(
|
|
3002
|
-
const P = [
|
|
3040
|
+
function s(g, ...y) {
|
|
3041
|
+
const P = [g[0]];
|
|
3003
3042
|
let I = 0;
|
|
3004
3043
|
for (; I < y.length; )
|
|
3005
|
-
c(P, y[I]), P.push(
|
|
3044
|
+
c(P, y[I]), P.push(g[++I]);
|
|
3006
3045
|
return new n(P);
|
|
3007
3046
|
}
|
|
3008
3047
|
e._ = s;
|
|
3009
3048
|
const i = new n("+");
|
|
3010
|
-
function o(
|
|
3011
|
-
const P = [
|
|
3049
|
+
function o(g, ...y) {
|
|
3050
|
+
const P = [C(g[0])];
|
|
3012
3051
|
let I = 0;
|
|
3013
3052
|
for (; I < y.length; )
|
|
3014
|
-
P.push(i), c(P, y[I]), P.push(i,
|
|
3053
|
+
P.push(i), c(P, y[I]), P.push(i, C(g[++I]));
|
|
3015
3054
|
return d(P), new n(P);
|
|
3016
3055
|
}
|
|
3017
3056
|
e.str = o;
|
|
3018
|
-
function c(
|
|
3019
|
-
y instanceof n ?
|
|
3057
|
+
function c(g, y) {
|
|
3058
|
+
y instanceof n ? g.push(...y._items) : y instanceof r ? g.push(y) : g.push(_(y));
|
|
3020
3059
|
}
|
|
3021
3060
|
e.addCodeArg = c;
|
|
3022
|
-
function d(
|
|
3061
|
+
function d(g) {
|
|
3023
3062
|
let y = 1;
|
|
3024
|
-
for (; y <
|
|
3025
|
-
if (
|
|
3026
|
-
const P = u(
|
|
3063
|
+
for (; y < g.length - 1; ) {
|
|
3064
|
+
if (g[y] === i) {
|
|
3065
|
+
const P = u(g[y - 1], g[y + 1]);
|
|
3027
3066
|
if (P !== void 0) {
|
|
3028
|
-
|
|
3067
|
+
g.splice(y - 1, 3, P);
|
|
3029
3068
|
continue;
|
|
3030
3069
|
}
|
|
3031
|
-
|
|
3070
|
+
g[y++] = "+";
|
|
3032
3071
|
}
|
|
3033
3072
|
y++;
|
|
3034
3073
|
}
|
|
3035
3074
|
}
|
|
3036
|
-
function u(
|
|
3075
|
+
function u(g, y) {
|
|
3037
3076
|
if (y === '""')
|
|
3038
|
-
return
|
|
3039
|
-
if (
|
|
3077
|
+
return g;
|
|
3078
|
+
if (g === '""')
|
|
3040
3079
|
return y;
|
|
3041
|
-
if (typeof
|
|
3042
|
-
return y instanceof r ||
|
|
3043
|
-
if (typeof y == "string" && y[0] === '"' && !(
|
|
3044
|
-
return `"${
|
|
3080
|
+
if (typeof g == "string")
|
|
3081
|
+
return y instanceof r || g[g.length - 1] !== '"' ? void 0 : typeof y != "string" ? `${g.slice(0, -1)}${y}"` : y[0] === '"' ? g.slice(0, -1) + y.slice(1) : void 0;
|
|
3082
|
+
if (typeof y == "string" && y[0] === '"' && !(g instanceof r))
|
|
3083
|
+
return `"${g}${y.slice(1)}`;
|
|
3045
3084
|
}
|
|
3046
|
-
function p(
|
|
3047
|
-
return y.emptyStr() ?
|
|
3085
|
+
function p(g, y) {
|
|
3086
|
+
return y.emptyStr() ? g : g.emptyStr() ? y : o`${g}${y}`;
|
|
3048
3087
|
}
|
|
3049
3088
|
e.strConcat = p;
|
|
3050
|
-
function g
|
|
3051
|
-
return typeof
|
|
3089
|
+
function _(g) {
|
|
3090
|
+
return typeof g == "number" || typeof g == "boolean" || g === null ? g : C(Array.isArray(g) ? g.join(",") : g);
|
|
3052
3091
|
}
|
|
3053
|
-
function T(
|
|
3054
|
-
return new n(
|
|
3092
|
+
function T(g) {
|
|
3093
|
+
return new n(C(g));
|
|
3055
3094
|
}
|
|
3056
3095
|
e.stringify = T;
|
|
3057
|
-
function
|
|
3058
|
-
return JSON.stringify(
|
|
3096
|
+
function C(g) {
|
|
3097
|
+
return JSON.stringify(g).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3059
3098
|
}
|
|
3060
|
-
e.safeStringify =
|
|
3061
|
-
function
|
|
3062
|
-
return typeof
|
|
3099
|
+
e.safeStringify = C;
|
|
3100
|
+
function S(g) {
|
|
3101
|
+
return typeof g == "string" && e.IDENTIFIER.test(g) ? new n(`.${g}`) : s`[${g}]`;
|
|
3063
3102
|
}
|
|
3064
|
-
e.getProperty =
|
|
3065
|
-
function k(
|
|
3066
|
-
if (typeof
|
|
3067
|
-
return new n(`${
|
|
3068
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
3103
|
+
e.getProperty = S;
|
|
3104
|
+
function k(g) {
|
|
3105
|
+
if (typeof g == "string" && e.IDENTIFIER.test(g))
|
|
3106
|
+
return new n(`${g}`);
|
|
3107
|
+
throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`);
|
|
3069
3108
|
}
|
|
3070
3109
|
e.getEsmExportName = k;
|
|
3071
|
-
function $(
|
|
3072
|
-
return new n(
|
|
3110
|
+
function $(g) {
|
|
3111
|
+
return new n(g.toString());
|
|
3073
3112
|
}
|
|
3074
3113
|
e.regexpCode = $;
|
|
3075
3114
|
})(code$1);
|
|
@@ -3105,8 +3144,8 @@ var scope = {};
|
|
|
3105
3144
|
return `${u}${p.index++}`;
|
|
3106
3145
|
}
|
|
3107
3146
|
_nameGroup(u) {
|
|
3108
|
-
var p,
|
|
3109
|
-
if (!((
|
|
3147
|
+
var p, _;
|
|
3148
|
+
if (!((_ = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || _ === void 0) && _.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3110
3149
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3111
3150
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3112
3151
|
}
|
|
@@ -3116,8 +3155,8 @@ var scope = {};
|
|
|
3116
3155
|
constructor(u, p) {
|
|
3117
3156
|
super(p), this.prefix = u;
|
|
3118
3157
|
}
|
|
3119
|
-
setValue(u, { property: p, itemIndex:
|
|
3120
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3158
|
+
setValue(u, { property: p, itemIndex: _ }) {
|
|
3159
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${_}]`;
|
|
3121
3160
|
}
|
|
3122
3161
|
}
|
|
3123
3162
|
e.ValueScopeName = i;
|
|
@@ -3133,63 +3172,63 @@ var scope = {};
|
|
|
3133
3172
|
return new i(u, this._newName(u));
|
|
3134
3173
|
}
|
|
3135
3174
|
value(u, p) {
|
|
3136
|
-
var
|
|
3175
|
+
var _;
|
|
3137
3176
|
if (p.ref === void 0)
|
|
3138
3177
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3139
|
-
const T = this.toName(u), { prefix:
|
|
3140
|
-
let k = this._values[
|
|
3178
|
+
const T = this.toName(u), { prefix: C } = T, S = (_ = p.key) !== null && _ !== void 0 ? _ : p.ref;
|
|
3179
|
+
let k = this._values[C];
|
|
3141
3180
|
if (k) {
|
|
3142
|
-
const y = k.get(
|
|
3181
|
+
const y = k.get(S);
|
|
3143
3182
|
if (y)
|
|
3144
3183
|
return y;
|
|
3145
3184
|
} else
|
|
3146
|
-
k = this._values[
|
|
3147
|
-
k.set(
|
|
3148
|
-
const $ = this._scope[
|
|
3149
|
-
return $[
|
|
3185
|
+
k = this._values[C] = /* @__PURE__ */ new Map();
|
|
3186
|
+
k.set(S, T);
|
|
3187
|
+
const $ = this._scope[C] || (this._scope[C] = []), g = $.length;
|
|
3188
|
+
return $[g] = p.ref, T.setValue(p, { property: C, itemIndex: g }), T;
|
|
3150
3189
|
}
|
|
3151
3190
|
getValue(u, p) {
|
|
3152
|
-
const
|
|
3153
|
-
if (
|
|
3154
|
-
return
|
|
3191
|
+
const _ = this._values[u];
|
|
3192
|
+
if (_)
|
|
3193
|
+
return _.get(p);
|
|
3155
3194
|
}
|
|
3156
3195
|
scopeRefs(u, p = this._values) {
|
|
3157
|
-
return this._reduceValues(p, (
|
|
3158
|
-
if (
|
|
3159
|
-
throw new Error(`CodeGen: name "${
|
|
3160
|
-
return (0, t._)`${u}${
|
|
3196
|
+
return this._reduceValues(p, (_) => {
|
|
3197
|
+
if (_.scopePath === void 0)
|
|
3198
|
+
throw new Error(`CodeGen: name "${_}" has no value`);
|
|
3199
|
+
return (0, t._)`${u}${_.scopePath}`;
|
|
3161
3200
|
});
|
|
3162
3201
|
}
|
|
3163
|
-
scopeCode(u = this._values, p,
|
|
3202
|
+
scopeCode(u = this._values, p, _) {
|
|
3164
3203
|
return this._reduceValues(u, (T) => {
|
|
3165
3204
|
if (T.value === void 0)
|
|
3166
3205
|
throw new Error(`CodeGen: name "${T}" has no value`);
|
|
3167
3206
|
return T.value.code;
|
|
3168
|
-
}, p,
|
|
3207
|
+
}, p, _);
|
|
3169
3208
|
}
|
|
3170
|
-
_reduceValues(u, p,
|
|
3171
|
-
let
|
|
3172
|
-
for (const
|
|
3173
|
-
const k = u[
|
|
3209
|
+
_reduceValues(u, p, _ = {}, T) {
|
|
3210
|
+
let C = t.nil;
|
|
3211
|
+
for (const S in u) {
|
|
3212
|
+
const k = u[S];
|
|
3174
3213
|
if (!k)
|
|
3175
3214
|
continue;
|
|
3176
|
-
const $ =
|
|
3177
|
-
k.forEach((
|
|
3178
|
-
if ($.has(
|
|
3215
|
+
const $ = _[S] = _[S] || /* @__PURE__ */ new Map();
|
|
3216
|
+
k.forEach((g) => {
|
|
3217
|
+
if ($.has(g))
|
|
3179
3218
|
return;
|
|
3180
|
-
$.set(
|
|
3181
|
-
let y = p(
|
|
3219
|
+
$.set(g, n.Started);
|
|
3220
|
+
let y = p(g);
|
|
3182
3221
|
if (y) {
|
|
3183
3222
|
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3184
|
-
|
|
3185
|
-
} else if (y = T == null ? void 0 : T(
|
|
3186
|
-
|
|
3223
|
+
C = (0, t._)`${C}${P} ${g} = ${y};${this.opts._n}`;
|
|
3224
|
+
} else if (y = T == null ? void 0 : T(g))
|
|
3225
|
+
C = (0, t._)`${C}${y}${this.opts._n}`;
|
|
3187
3226
|
else
|
|
3188
|
-
throw new r(
|
|
3189
|
-
$.set(
|
|
3227
|
+
throw new r(g);
|
|
3228
|
+
$.set(g, n.Completed);
|
|
3190
3229
|
});
|
|
3191
3230
|
}
|
|
3192
|
-
return
|
|
3231
|
+
return C;
|
|
3193
3232
|
}
|
|
3194
3233
|
}
|
|
3195
3234
|
e.ValueScope = c;
|
|
@@ -3300,7 +3339,7 @@ var scope = {};
|
|
|
3300
3339
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3301
3340
|
}
|
|
3302
3341
|
}
|
|
3303
|
-
class
|
|
3342
|
+
class _ extends i {
|
|
3304
3343
|
constructor(a) {
|
|
3305
3344
|
super(), this.error = a;
|
|
3306
3345
|
}
|
|
@@ -3328,7 +3367,7 @@ var scope = {};
|
|
|
3328
3367
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3329
3368
|
}
|
|
3330
3369
|
}
|
|
3331
|
-
class
|
|
3370
|
+
class C extends i {
|
|
3332
3371
|
constructor(a = []) {
|
|
3333
3372
|
super(), this.nodes = a;
|
|
3334
3373
|
}
|
|
@@ -3357,17 +3396,17 @@ var scope = {};
|
|
|
3357
3396
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3358
3397
|
}
|
|
3359
3398
|
}
|
|
3360
|
-
class
|
|
3399
|
+
class S extends C {
|
|
3361
3400
|
render(a) {
|
|
3362
3401
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3363
3402
|
}
|
|
3364
3403
|
}
|
|
3365
|
-
class k extends
|
|
3404
|
+
class k extends C {
|
|
3366
3405
|
}
|
|
3367
|
-
class $ extends
|
|
3406
|
+
class $ extends S {
|
|
3368
3407
|
}
|
|
3369
3408
|
$.kind = "else";
|
|
3370
|
-
class
|
|
3409
|
+
class g extends S {
|
|
3371
3410
|
constructor(a, h) {
|
|
3372
3411
|
super(h), this.condition = a;
|
|
3373
3412
|
}
|
|
@@ -3386,7 +3425,7 @@ var scope = {};
|
|
|
3386
3425
|
h = this.else = Array.isArray(N) ? new $(N) : N;
|
|
3387
3426
|
}
|
|
3388
3427
|
if (h)
|
|
3389
|
-
return a === !1 ? h instanceof
|
|
3428
|
+
return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(Ce(a), h instanceof g ? [h] : h.nodes);
|
|
3390
3429
|
if (!(a === !1 || !this.nodes.length))
|
|
3391
3430
|
return this;
|
|
3392
3431
|
}
|
|
@@ -3400,8 +3439,8 @@ var scope = {};
|
|
|
3400
3439
|
return ue(a, this.condition), this.else && K(a, this.else.names), a;
|
|
3401
3440
|
}
|
|
3402
3441
|
}
|
|
3403
|
-
|
|
3404
|
-
class y extends
|
|
3442
|
+
g.kind = "if";
|
|
3443
|
+
class y extends S {
|
|
3405
3444
|
}
|
|
3406
3445
|
y.kind = "for";
|
|
3407
3446
|
class P extends y {
|
|
@@ -3447,7 +3486,7 @@ var scope = {};
|
|
|
3447
3486
|
return K(super.names, this.iterable.names);
|
|
3448
3487
|
}
|
|
3449
3488
|
}
|
|
3450
|
-
class w extends
|
|
3489
|
+
class w extends S {
|
|
3451
3490
|
constructor(a, h, N) {
|
|
3452
3491
|
super(), this.name = a, this.args = h, this.async = N;
|
|
3453
3492
|
}
|
|
@@ -3456,13 +3495,13 @@ var scope = {};
|
|
|
3456
3495
|
}
|
|
3457
3496
|
}
|
|
3458
3497
|
w.kind = "func";
|
|
3459
|
-
class
|
|
3498
|
+
class O extends C {
|
|
3460
3499
|
render(a) {
|
|
3461
3500
|
return "return " + super.render(a);
|
|
3462
3501
|
}
|
|
3463
3502
|
}
|
|
3464
|
-
|
|
3465
|
-
class A extends
|
|
3503
|
+
O.kind = "return";
|
|
3504
|
+
class A extends S {
|
|
3466
3505
|
render(a) {
|
|
3467
3506
|
let h = "try" + super.render(a);
|
|
3468
3507
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3480,7 +3519,7 @@ var scope = {};
|
|
|
3480
3519
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3481
3520
|
}
|
|
3482
3521
|
}
|
|
3483
|
-
class x extends
|
|
3522
|
+
class x extends S {
|
|
3484
3523
|
constructor(a) {
|
|
3485
3524
|
super(), this.error = a;
|
|
3486
3525
|
}
|
|
@@ -3489,7 +3528,7 @@ var scope = {};
|
|
|
3489
3528
|
}
|
|
3490
3529
|
}
|
|
3491
3530
|
x.kind = "catch";
|
|
3492
|
-
class z extends
|
|
3531
|
+
class z extends S {
|
|
3493
3532
|
render(a) {
|
|
3494
3533
|
return "finally" + super.render(a);
|
|
3495
3534
|
}
|
|
@@ -3564,7 +3603,7 @@ var scope = {};
|
|
|
3564
3603
|
}
|
|
3565
3604
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3566
3605
|
if(a, h, N) {
|
|
3567
|
-
if (this._blockNode(new
|
|
3606
|
+
if (this._blockNode(new g(a)), h && N)
|
|
3568
3607
|
this.code(h).else().code(N).endIf();
|
|
3569
3608
|
else if (h)
|
|
3570
3609
|
this.code(h).endIf();
|
|
@@ -3574,7 +3613,7 @@ var scope = {};
|
|
|
3574
3613
|
}
|
|
3575
3614
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
3576
3615
|
elseIf(a) {
|
|
3577
|
-
return this._elseNode(new
|
|
3616
|
+
return this._elseNode(new g(a));
|
|
3578
3617
|
}
|
|
3579
3618
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3580
3619
|
else() {
|
|
@@ -3582,7 +3621,7 @@ var scope = {};
|
|
|
3582
3621
|
}
|
|
3583
3622
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3584
3623
|
endIf() {
|
|
3585
|
-
return this._endBlockNode(
|
|
3624
|
+
return this._endBlockNode(g, $);
|
|
3586
3625
|
}
|
|
3587
3626
|
_for(a, h) {
|
|
3588
3627
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
@@ -3629,10 +3668,10 @@ var scope = {};
|
|
|
3629
3668
|
}
|
|
3630
3669
|
// `return` statement
|
|
3631
3670
|
return(a) {
|
|
3632
|
-
const h = new
|
|
3671
|
+
const h = new O();
|
|
3633
3672
|
if (this._blockNode(h), this.code(a), h.nodes.length !== 1)
|
|
3634
3673
|
throw new Error('CodeGen: "return" should have one node');
|
|
3635
|
-
return this._endBlockNode(
|
|
3674
|
+
return this._endBlockNode(O);
|
|
3636
3675
|
}
|
|
3637
3676
|
// `try` statement
|
|
3638
3677
|
try(a, h, N) {
|
|
@@ -3647,7 +3686,7 @@ var scope = {};
|
|
|
3647
3686
|
}
|
|
3648
3687
|
// `throw` statement
|
|
3649
3688
|
throw(a) {
|
|
3650
|
-
return this._leafNode(new
|
|
3689
|
+
return this._leafNode(new _(a));
|
|
3651
3690
|
}
|
|
3652
3691
|
// start self-balancing block
|
|
3653
3692
|
block(a, h) {
|
|
@@ -3689,7 +3728,7 @@ var scope = {};
|
|
|
3689
3728
|
}
|
|
3690
3729
|
_elseNode(a) {
|
|
3691
3730
|
const h = this._currNode;
|
|
3692
|
-
if (!(h instanceof
|
|
3731
|
+
if (!(h instanceof g))
|
|
3693
3732
|
throw new Error('CodeGen: "else" without "if"');
|
|
3694
3733
|
return this._currNode = h.else = a, this;
|
|
3695
3734
|
}
|
|
@@ -3706,20 +3745,20 @@ var scope = {};
|
|
|
3706
3745
|
}
|
|
3707
3746
|
}
|
|
3708
3747
|
e.CodeGen = re;
|
|
3709
|
-
function K(
|
|
3748
|
+
function K(E, a) {
|
|
3710
3749
|
for (const h in a)
|
|
3711
|
-
|
|
3712
|
-
return
|
|
3713
|
-
}
|
|
3714
|
-
function ue(
|
|
3715
|
-
return a instanceof t._CodeOrName ? K(
|
|
3716
|
-
}
|
|
3717
|
-
function oe(
|
|
3718
|
-
if (
|
|
3719
|
-
return N(
|
|
3720
|
-
if (!M(
|
|
3721
|
-
return
|
|
3722
|
-
return new t._Code(
|
|
3750
|
+
E[h] = (E[h] || 0) + (a[h] || 0);
|
|
3751
|
+
return E;
|
|
3752
|
+
}
|
|
3753
|
+
function ue(E, a) {
|
|
3754
|
+
return a instanceof t._CodeOrName ? K(E, a.names) : E;
|
|
3755
|
+
}
|
|
3756
|
+
function oe(E, a, h) {
|
|
3757
|
+
if (E instanceof t.Name)
|
|
3758
|
+
return N(E);
|
|
3759
|
+
if (!M(E))
|
|
3760
|
+
return E;
|
|
3761
|
+
return new t._Code(E._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
|
|
3723
3762
|
function N(L) {
|
|
3724
3763
|
const W = h[L.str];
|
|
3725
3764
|
return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
|
|
@@ -3728,29 +3767,29 @@ var scope = {};
|
|
|
3728
3767
|
return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3729
3768
|
}
|
|
3730
3769
|
}
|
|
3731
|
-
function ke(
|
|
3770
|
+
function ke(E, a) {
|
|
3732
3771
|
for (const h in a)
|
|
3733
|
-
|
|
3772
|
+
E[h] = (E[h] || 0) - (a[h] || 0);
|
|
3734
3773
|
}
|
|
3735
|
-
function Ce(
|
|
3736
|
-
return typeof
|
|
3774
|
+
function Ce(E) {
|
|
3775
|
+
return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
|
|
3737
3776
|
}
|
|
3738
3777
|
e.not = Ce;
|
|
3739
3778
|
const Le = v(e.operators.AND);
|
|
3740
|
-
function et(...
|
|
3741
|
-
return
|
|
3779
|
+
function et(...E) {
|
|
3780
|
+
return E.reduce(Le);
|
|
3742
3781
|
}
|
|
3743
3782
|
e.and = et;
|
|
3744
3783
|
const qe = v(e.operators.OR);
|
|
3745
|
-
function F(...
|
|
3746
|
-
return
|
|
3784
|
+
function F(...E) {
|
|
3785
|
+
return E.reduce(qe);
|
|
3747
3786
|
}
|
|
3748
3787
|
e.or = F;
|
|
3749
|
-
function v(
|
|
3750
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3788
|
+
function v(E) {
|
|
3789
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
|
|
3751
3790
|
}
|
|
3752
|
-
function j(
|
|
3753
|
-
return
|
|
3791
|
+
function j(E) {
|
|
3792
|
+
return E instanceof t.Name ? E : (0, t._)`(${E})`;
|
|
3754
3793
|
}
|
|
3755
3794
|
})(codegen);
|
|
3756
3795
|
var util = {};
|
|
@@ -3758,51 +3797,51 @@ var util = {};
|
|
|
3758
3797
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
|
|
3759
3798
|
const t = codegen, r = code$1;
|
|
3760
3799
|
function n(w) {
|
|
3761
|
-
const
|
|
3800
|
+
const O = {};
|
|
3762
3801
|
for (const A of w)
|
|
3763
|
-
|
|
3764
|
-
return
|
|
3802
|
+
O[A] = !0;
|
|
3803
|
+
return O;
|
|
3765
3804
|
}
|
|
3766
3805
|
e.toHash = n;
|
|
3767
|
-
function s(w,
|
|
3768
|
-
return typeof
|
|
3806
|
+
function s(w, O) {
|
|
3807
|
+
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(w, O), !o(O, w.self.RULES.all));
|
|
3769
3808
|
}
|
|
3770
3809
|
e.alwaysValidSchema = s;
|
|
3771
|
-
function i(w,
|
|
3810
|
+
function i(w, O = w.schema) {
|
|
3772
3811
|
const { opts: A, self: x } = w;
|
|
3773
|
-
if (!A.strictSchema || typeof
|
|
3812
|
+
if (!A.strictSchema || typeof O == "boolean")
|
|
3774
3813
|
return;
|
|
3775
3814
|
const z = x.RULES.keywords;
|
|
3776
|
-
for (const re in
|
|
3815
|
+
for (const re in O)
|
|
3777
3816
|
z[re] || D(w, `unknown keyword: "${re}"`);
|
|
3778
3817
|
}
|
|
3779
3818
|
e.checkUnknownRules = i;
|
|
3780
|
-
function o(w,
|
|
3819
|
+
function o(w, O) {
|
|
3781
3820
|
if (typeof w == "boolean")
|
|
3782
3821
|
return !w;
|
|
3783
3822
|
for (const A in w)
|
|
3784
|
-
if (
|
|
3823
|
+
if (O[A])
|
|
3785
3824
|
return !0;
|
|
3786
3825
|
return !1;
|
|
3787
3826
|
}
|
|
3788
3827
|
e.schemaHasRules = o;
|
|
3789
|
-
function c(w,
|
|
3828
|
+
function c(w, O) {
|
|
3790
3829
|
if (typeof w == "boolean")
|
|
3791
3830
|
return !w;
|
|
3792
3831
|
for (const A in w)
|
|
3793
|
-
if (A !== "$ref" &&
|
|
3832
|
+
if (A !== "$ref" && O.all[A])
|
|
3794
3833
|
return !0;
|
|
3795
3834
|
return !1;
|
|
3796
3835
|
}
|
|
3797
3836
|
e.schemaHasRulesButRef = c;
|
|
3798
|
-
function d({ topSchemaRef: w, schemaPath:
|
|
3837
|
+
function d({ topSchemaRef: w, schemaPath: O }, A, x, z) {
|
|
3799
3838
|
if (!z) {
|
|
3800
3839
|
if (typeof A == "number" || typeof A == "boolean")
|
|
3801
3840
|
return A;
|
|
3802
3841
|
if (typeof A == "string")
|
|
3803
3842
|
return (0, t._)`${A}`;
|
|
3804
3843
|
}
|
|
3805
|
-
return (0, t._)`${w}${
|
|
3844
|
+
return (0, t._)`${w}${O}${(0, t.getProperty)(x)}`;
|
|
3806
3845
|
}
|
|
3807
3846
|
e.schemaRefOrVal = d;
|
|
3808
3847
|
function u(w) {
|
|
@@ -3810,65 +3849,65 @@ var util = {};
|
|
|
3810
3849
|
}
|
|
3811
3850
|
e.unescapeFragment = u;
|
|
3812
3851
|
function p(w) {
|
|
3813
|
-
return encodeURIComponent(
|
|
3852
|
+
return encodeURIComponent(_(w));
|
|
3814
3853
|
}
|
|
3815
3854
|
e.escapeFragment = p;
|
|
3816
|
-
function
|
|
3855
|
+
function _(w) {
|
|
3817
3856
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3818
3857
|
}
|
|
3819
|
-
e.escapeJsonPointer =
|
|
3858
|
+
e.escapeJsonPointer = _;
|
|
3820
3859
|
function T(w) {
|
|
3821
3860
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3822
3861
|
}
|
|
3823
3862
|
e.unescapeJsonPointer = T;
|
|
3824
|
-
function
|
|
3863
|
+
function C(w, O) {
|
|
3825
3864
|
if (Array.isArray(w))
|
|
3826
3865
|
for (const A of w)
|
|
3827
|
-
|
|
3866
|
+
O(A);
|
|
3828
3867
|
else
|
|
3829
|
-
|
|
3868
|
+
O(w);
|
|
3830
3869
|
}
|
|
3831
|
-
e.eachItem =
|
|
3832
|
-
function
|
|
3870
|
+
e.eachItem = C;
|
|
3871
|
+
function S({ mergeNames: w, mergeToName: O, mergeValues: A, resultToName: x }) {
|
|
3833
3872
|
return (z, re, K, ue) => {
|
|
3834
|
-
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(z, re, K) :
|
|
3873
|
+
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(z, re, K) : O(z, re, K), K) : re instanceof t.Name ? (O(z, K, re), re) : A(re, K);
|
|
3835
3874
|
return ue === t.Name && !(oe instanceof t.Name) ? x(z, oe) : oe;
|
|
3836
3875
|
};
|
|
3837
3876
|
}
|
|
3838
3877
|
e.mergeEvaluated = {
|
|
3839
|
-
props:
|
|
3840
|
-
mergeNames: (w,
|
|
3841
|
-
w.if((0, t._)`${
|
|
3878
|
+
props: S({
|
|
3879
|
+
mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
|
|
3880
|
+
w.if((0, t._)`${O} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
|
|
3842
3881
|
}),
|
|
3843
|
-
mergeToName: (w,
|
|
3844
|
-
|
|
3882
|
+
mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3883
|
+
O === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), $(w, A, O));
|
|
3845
3884
|
}),
|
|
3846
|
-
mergeValues: (w,
|
|
3885
|
+
mergeValues: (w, O) => w === !0 ? !0 : { ...w, ...O },
|
|
3847
3886
|
resultToName: k
|
|
3848
3887
|
}),
|
|
3849
|
-
items:
|
|
3850
|
-
mergeNames: (w,
|
|
3851
|
-
mergeToName: (w,
|
|
3852
|
-
mergeValues: (w,
|
|
3853
|
-
resultToName: (w,
|
|
3888
|
+
items: S({
|
|
3889
|
+
mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => w.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
|
|
3890
|
+
mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
|
|
3891
|
+
mergeValues: (w, O) => w === !0 ? !0 : Math.max(w, O),
|
|
3892
|
+
resultToName: (w, O) => w.var("items", O)
|
|
3854
3893
|
})
|
|
3855
3894
|
};
|
|
3856
|
-
function k(w,
|
|
3857
|
-
if (
|
|
3895
|
+
function k(w, O) {
|
|
3896
|
+
if (O === !0)
|
|
3858
3897
|
return w.var("props", !0);
|
|
3859
3898
|
const A = w.var("props", (0, t._)`{}`);
|
|
3860
|
-
return
|
|
3899
|
+
return O !== void 0 && $(w, A, O), A;
|
|
3861
3900
|
}
|
|
3862
3901
|
e.evaluatedPropsToName = k;
|
|
3863
|
-
function $(w,
|
|
3864
|
-
Object.keys(A).forEach((x) => w.assign((0, t._)`${
|
|
3902
|
+
function $(w, O, A) {
|
|
3903
|
+
Object.keys(A).forEach((x) => w.assign((0, t._)`${O}${(0, t.getProperty)(x)}`, !0));
|
|
3865
3904
|
}
|
|
3866
3905
|
e.setEvaluated = $;
|
|
3867
|
-
const
|
|
3868
|
-
function y(w,
|
|
3906
|
+
const g = {};
|
|
3907
|
+
function y(w, O) {
|
|
3869
3908
|
return w.scopeValue("func", {
|
|
3870
|
-
ref:
|
|
3871
|
-
code:
|
|
3909
|
+
ref: O,
|
|
3910
|
+
code: g[O.code] || (g[O.code] = new r._Code(O.code))
|
|
3872
3911
|
});
|
|
3873
3912
|
}
|
|
3874
3913
|
e.useFunc = y;
|
|
@@ -3876,19 +3915,19 @@ var util = {};
|
|
|
3876
3915
|
(function(w) {
|
|
3877
3916
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3878
3917
|
})(P = e.Type || (e.Type = {}));
|
|
3879
|
-
function I(w,
|
|
3918
|
+
function I(w, O, A) {
|
|
3880
3919
|
if (w instanceof t.Name) {
|
|
3881
|
-
const x =
|
|
3920
|
+
const x = O === P.Num;
|
|
3882
3921
|
return A ? x ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : x ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3883
3922
|
}
|
|
3884
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3923
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + _(w);
|
|
3885
3924
|
}
|
|
3886
3925
|
e.getErrorPath = I;
|
|
3887
|
-
function D(w,
|
|
3926
|
+
function D(w, O, A = w.opts.strictSchema) {
|
|
3888
3927
|
if (A) {
|
|
3889
|
-
if (
|
|
3890
|
-
throw new Error(
|
|
3891
|
-
w.self.logger.warn(
|
|
3928
|
+
if (O = `strict mode: ${O}`, A === !0)
|
|
3929
|
+
throw new Error(O);
|
|
3930
|
+
w.self.logger.warn(O);
|
|
3892
3931
|
}
|
|
3893
3932
|
}
|
|
3894
3933
|
e.checkStrictMode = D;
|
|
@@ -3925,38 +3964,38 @@ names$1.default = names;
|
|
|
3925
3964
|
e.keywordError = {
|
|
3926
3965
|
message: ({ keyword: $ }) => (0, t.str)`must pass "${$}" keyword validation`
|
|
3927
3966
|
}, e.keyword$DataError = {
|
|
3928
|
-
message: ({ keyword: $, schemaType:
|
|
3967
|
+
message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
|
|
3929
3968
|
};
|
|
3930
|
-
function s($,
|
|
3931
|
-
const { it: I } = $, { gen: D, compositeRule: w, allErrors:
|
|
3932
|
-
P ?? (w ||
|
|
3969
|
+
function s($, g = e.keywordError, y, P) {
|
|
3970
|
+
const { it: I } = $, { gen: D, compositeRule: w, allErrors: O } = I, A = _($, g, y);
|
|
3971
|
+
P ?? (w || O) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3933
3972
|
}
|
|
3934
3973
|
e.reportError = s;
|
|
3935
|
-
function i($,
|
|
3936
|
-
const { it: P } = $, { gen: I, compositeRule: D, allErrors: w } = P,
|
|
3937
|
-
d(I,
|
|
3974
|
+
function i($, g = e.keywordError, y) {
|
|
3975
|
+
const { it: P } = $, { gen: I, compositeRule: D, allErrors: w } = P, O = _($, g, y);
|
|
3976
|
+
d(I, O), D || w || u(P, n.default.vErrors);
|
|
3938
3977
|
}
|
|
3939
3978
|
e.reportExtraError = i;
|
|
3940
|
-
function o($,
|
|
3941
|
-
$.assign(n.default.errors,
|
|
3979
|
+
function o($, g) {
|
|
3980
|
+
$.assign(n.default.errors, g), $.if((0, t._)`${n.default.vErrors} !== null`, () => $.if(g, () => $.assign((0, t._)`${n.default.vErrors}.length`, g), () => $.assign(n.default.vErrors, null)));
|
|
3942
3981
|
}
|
|
3943
3982
|
e.resetErrorsCount = o;
|
|
3944
|
-
function c({ gen: $, keyword:
|
|
3983
|
+
function c({ gen: $, keyword: g, schemaValue: y, data: P, errsCount: I, it: D }) {
|
|
3945
3984
|
if (I === void 0)
|
|
3946
3985
|
throw new Error("ajv implementation error");
|
|
3947
3986
|
const w = $.name("err");
|
|
3948
|
-
$.forRange("i", I, n.default.errors, (
|
|
3949
|
-
$.const(w, (0, t._)`${n.default.vErrors}[${
|
|
3987
|
+
$.forRange("i", I, n.default.errors, (O) => {
|
|
3988
|
+
$.const(w, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${w}.instancePath === undefined`, () => $.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${w}.schema`, y), $.assign((0, t._)`${w}.data`, P));
|
|
3950
3989
|
});
|
|
3951
3990
|
}
|
|
3952
3991
|
e.extendErrors = c;
|
|
3953
|
-
function d($,
|
|
3954
|
-
const y = $.const("err",
|
|
3992
|
+
function d($, g) {
|
|
3993
|
+
const y = $.const("err", g);
|
|
3955
3994
|
$.if((0, t._)`${n.default.vErrors} === null`, () => $.assign(n.default.vErrors, (0, t._)`[${y}]`), (0, t._)`${n.default.vErrors}.push(${y})`), $.code((0, t._)`${n.default.errors}++`);
|
|
3956
3995
|
}
|
|
3957
|
-
function u($,
|
|
3996
|
+
function u($, g) {
|
|
3958
3997
|
const { gen: y, validateName: P, schemaEnv: I } = $;
|
|
3959
|
-
I.$async ? y.throw((0, t._)`new ${$.ValidationError}(${
|
|
3998
|
+
I.$async ? y.throw((0, t._)`new ${$.ValidationError}(${g})`) : (y.assign((0, t._)`${P}.errors`, g), y.return(!1));
|
|
3960
3999
|
}
|
|
3961
4000
|
const p = {
|
|
3962
4001
|
keyword: new t.Name("keyword"),
|
|
@@ -3967,28 +4006,28 @@ names$1.default = names;
|
|
|
3967
4006
|
schema: new t.Name("schema"),
|
|
3968
4007
|
parentSchema: new t.Name("parentSchema")
|
|
3969
4008
|
};
|
|
3970
|
-
function
|
|
4009
|
+
function _($, g, y) {
|
|
3971
4010
|
const { createErrors: P } = $.it;
|
|
3972
|
-
return P === !1 ? (0, t._)`{}` : T($,
|
|
4011
|
+
return P === !1 ? (0, t._)`{}` : T($, g, y);
|
|
3973
4012
|
}
|
|
3974
|
-
function T($,
|
|
4013
|
+
function T($, g, y = {}) {
|
|
3975
4014
|
const { gen: P, it: I } = $, D = [
|
|
3976
|
-
|
|
3977
|
-
|
|
4015
|
+
C(I, y),
|
|
4016
|
+
S($, y)
|
|
3978
4017
|
];
|
|
3979
|
-
return k($,
|
|
4018
|
+
return k($, g, D), P.object(...D);
|
|
3980
4019
|
}
|
|
3981
|
-
function
|
|
3982
|
-
const y =
|
|
4020
|
+
function C({ errorPath: $ }, { instancePath: g }) {
|
|
4021
|
+
const y = g ? (0, t.str)`${$}${(0, r.getErrorPath)(g, r.Type.Str)}` : $;
|
|
3983
4022
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, y)];
|
|
3984
4023
|
}
|
|
3985
|
-
function
|
|
3986
|
-
let I = P ?
|
|
4024
|
+
function S({ keyword: $, it: { errSchemaPath: g } }, { schemaPath: y, parentSchema: P }) {
|
|
4025
|
+
let I = P ? g : (0, t.str)`${g}/${$}`;
|
|
3987
4026
|
return y && (I = (0, t.str)`${I}${(0, r.getErrorPath)(y, r.Type.Str)}`), [p.schemaPath, I];
|
|
3988
4027
|
}
|
|
3989
|
-
function k($, { params:
|
|
3990
|
-
const { keyword: I, data: D, schemaValue: w, it:
|
|
3991
|
-
P.push([p.keyword, I], [p.params, typeof
|
|
4028
|
+
function k($, { params: g, message: y }, P) {
|
|
4029
|
+
const { keyword: I, data: D, schemaValue: w, it: O } = $, { opts: A, propertyName: x, topSchemaRef: z, schemaPath: re } = O;
|
|
4030
|
+
P.push([p.keyword, I], [p.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && P.push([p.message, typeof y == "function" ? y($) : y]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), x && P.push([p.propertyName, x]);
|
|
3992
4031
|
}
|
|
3993
4032
|
})(errors);
|
|
3994
4033
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4088,62 +4127,62 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4088
4127
|
}
|
|
4089
4128
|
e.getJSONTypes = d;
|
|
4090
4129
|
function u(P, I) {
|
|
4091
|
-
const { gen: D, data: w, opts:
|
|
4130
|
+
const { gen: D, data: w, opts: O } = P, A = _(I, O.coerceTypes), x = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
|
|
4092
4131
|
if (x) {
|
|
4093
|
-
const z = k(I, w,
|
|
4132
|
+
const z = k(I, w, O.strictNumbers, o.Wrong);
|
|
4094
4133
|
D.if(z, () => {
|
|
4095
|
-
A.length ? T(P, I, A) :
|
|
4134
|
+
A.length ? T(P, I, A) : g(P);
|
|
4096
4135
|
});
|
|
4097
4136
|
}
|
|
4098
4137
|
return x;
|
|
4099
4138
|
}
|
|
4100
4139
|
e.coerceAndCheckDataType = u;
|
|
4101
4140
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4102
|
-
function
|
|
4141
|
+
function _(P, I) {
|
|
4103
4142
|
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4104
4143
|
}
|
|
4105
4144
|
function T(P, I, D) {
|
|
4106
|
-
const { gen: w, data:
|
|
4107
|
-
A.coerceTypes === "array" && w.if((0, s._)`${x} == 'object' && Array.isArray(${
|
|
4145
|
+
const { gen: w, data: O, opts: A } = P, x = w.let("dataType", (0, s._)`typeof ${O}`), z = w.let("coerced", (0, s._)`undefined`);
|
|
4146
|
+
A.coerceTypes === "array" && w.if((0, s._)`${x} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => w.assign(O, (0, s._)`${O}[0]`).assign(x, (0, s._)`typeof ${O}`).if(k(I, O, A.strictNumbers), () => w.assign(z, O))), w.if((0, s._)`${z} !== undefined`);
|
|
4108
4147
|
for (const K of D)
|
|
4109
4148
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4110
|
-
w.else(),
|
|
4111
|
-
w.assign(
|
|
4149
|
+
w.else(), g(P), w.endIf(), w.if((0, s._)`${z} !== undefined`, () => {
|
|
4150
|
+
w.assign(O, z), C(P, z);
|
|
4112
4151
|
});
|
|
4113
4152
|
function re(K) {
|
|
4114
4153
|
switch (K) {
|
|
4115
4154
|
case "string":
|
|
4116
|
-
w.elseIf((0, s._)`${x} == "number" || ${x} == "boolean"`).assign(z, (0, s._)`"" + ${
|
|
4155
|
+
w.elseIf((0, s._)`${x} == "number" || ${x} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
|
|
4117
4156
|
return;
|
|
4118
4157
|
case "number":
|
|
4119
|
-
w.elseIf((0, s._)`${x} == "boolean" || ${
|
|
4120
|
-
|| (${x} == "string" && ${
|
|
4158
|
+
w.elseIf((0, s._)`${x} == "boolean" || ${O} === null
|
|
4159
|
+
|| (${x} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
|
|
4121
4160
|
return;
|
|
4122
4161
|
case "integer":
|
|
4123
|
-
w.elseIf((0, s._)`${x} === "boolean" || ${
|
|
4124
|
-
|| (${x} === "string" && ${
|
|
4162
|
+
w.elseIf((0, s._)`${x} === "boolean" || ${O} === null
|
|
4163
|
+
|| (${x} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
|
|
4125
4164
|
return;
|
|
4126
4165
|
case "boolean":
|
|
4127
|
-
w.elseIf((0, s._)`${
|
|
4166
|
+
w.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
|
|
4128
4167
|
return;
|
|
4129
4168
|
case "null":
|
|
4130
|
-
w.elseIf((0, s._)`${
|
|
4169
|
+
w.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), w.assign(z, null);
|
|
4131
4170
|
return;
|
|
4132
4171
|
case "array":
|
|
4133
4172
|
w.elseIf((0, s._)`${x} === "string" || ${x} === "number"
|
|
4134
|
-
|| ${x} === "boolean" || ${
|
|
4173
|
+
|| ${x} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
|
|
4135
4174
|
}
|
|
4136
4175
|
}
|
|
4137
4176
|
}
|
|
4138
|
-
function
|
|
4177
|
+
function C({ gen: P, parentData: I, parentDataProperty: D }, w) {
|
|
4139
4178
|
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
|
|
4140
4179
|
}
|
|
4141
|
-
function
|
|
4142
|
-
const
|
|
4180
|
+
function S(P, I, D, w = o.Correct) {
|
|
4181
|
+
const O = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4143
4182
|
let A;
|
|
4144
4183
|
switch (P) {
|
|
4145
4184
|
case "null":
|
|
4146
|
-
return (0, s._)`${I} ${
|
|
4185
|
+
return (0, s._)`${I} ${O} null`;
|
|
4147
4186
|
case "array":
|
|
4148
4187
|
A = (0, s._)`Array.isArray(${I})`;
|
|
4149
4188
|
break;
|
|
@@ -4157,48 +4196,48 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4157
4196
|
A = x();
|
|
4158
4197
|
break;
|
|
4159
4198
|
default:
|
|
4160
|
-
return (0, s._)`typeof ${I} ${
|
|
4199
|
+
return (0, s._)`typeof ${I} ${O} ${P}`;
|
|
4161
4200
|
}
|
|
4162
4201
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4163
4202
|
function x(z = s.nil) {
|
|
4164
4203
|
return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4165
4204
|
}
|
|
4166
4205
|
}
|
|
4167
|
-
e.checkDataType =
|
|
4206
|
+
e.checkDataType = S;
|
|
4168
4207
|
function k(P, I, D, w) {
|
|
4169
4208
|
if (P.length === 1)
|
|
4170
|
-
return
|
|
4171
|
-
let
|
|
4209
|
+
return S(P[0], I, D, w);
|
|
4210
|
+
let O;
|
|
4172
4211
|
const A = (0, i.toHash)(P);
|
|
4173
4212
|
if (A.array && A.object) {
|
|
4174
4213
|
const x = (0, s._)`typeof ${I} != "object"`;
|
|
4175
|
-
|
|
4214
|
+
O = A.null ? x : (0, s._)`!${I} || ${x}`, delete A.null, delete A.array, delete A.object;
|
|
4176
4215
|
} else
|
|
4177
|
-
|
|
4216
|
+
O = s.nil;
|
|
4178
4217
|
A.number && delete A.integer;
|
|
4179
4218
|
for (const x in A)
|
|
4180
|
-
|
|
4181
|
-
return
|
|
4219
|
+
O = (0, s.and)(O, S(x, I, D, w));
|
|
4220
|
+
return O;
|
|
4182
4221
|
}
|
|
4183
4222
|
e.checkDataTypes = k;
|
|
4184
4223
|
const $ = {
|
|
4185
4224
|
message: ({ schema: P }) => `must be ${P}`,
|
|
4186
4225
|
params: ({ schema: P, schemaValue: I }) => typeof P == "string" ? (0, s._)`{type: ${P}}` : (0, s._)`{type: ${I}}`
|
|
4187
4226
|
};
|
|
4188
|
-
function
|
|
4227
|
+
function g(P) {
|
|
4189
4228
|
const I = y(P);
|
|
4190
4229
|
(0, n.reportError)(I, $);
|
|
4191
4230
|
}
|
|
4192
|
-
e.reportTypeError =
|
|
4231
|
+
e.reportTypeError = g;
|
|
4193
4232
|
function y(P) {
|
|
4194
|
-
const { gen: I, data: D, schema: w } = P,
|
|
4233
|
+
const { gen: I, data: D, schema: w } = P, O = (0, i.schemaRefOrVal)(P, w, "type");
|
|
4195
4234
|
return {
|
|
4196
4235
|
gen: I,
|
|
4197
4236
|
keyword: "type",
|
|
4198
4237
|
data: D,
|
|
4199
4238
|
schema: w.type,
|
|
4200
|
-
schemaCode:
|
|
4201
|
-
schemaValue:
|
|
4239
|
+
schemaCode: O,
|
|
4240
|
+
schemaValue: O,
|
|
4202
4241
|
parentSchema: w,
|
|
4203
4242
|
params: {},
|
|
4204
4243
|
it: P
|
|
@@ -4280,14 +4319,14 @@ function schemaProperties(e, t) {
|
|
|
4280
4319
|
}
|
|
4281
4320
|
code.schemaProperties = schemaProperties;
|
|
4282
4321
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, c, d, u) {
|
|
4283
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4322
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, _ = [
|
|
4284
4323
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4285
4324
|
[names_1$5.default.parentData, o.parentData],
|
|
4286
4325
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4287
4326
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4288
4327
|
];
|
|
4289
|
-
o.opts.dynamicRef &&
|
|
4290
|
-
const T = (0, codegen_1$q._)`${p}, ${r.object(...
|
|
4328
|
+
o.opts.dynamicRef && _.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4329
|
+
const T = (0, codegen_1$q._)`${p}, ${r.object(..._)}`;
|
|
4291
4330
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${c}.call(${d}, ${T})` : (0, codegen_1$q._)`${c}(${T})`;
|
|
4292
4331
|
}
|
|
4293
4332
|
code.callValidateCode = callValidateCode;
|
|
@@ -4357,31 +4396,31 @@ function funcKeywordCode(e, t) {
|
|
|
4357
4396
|
var r;
|
|
4358
4397
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: c, it: d } = e;
|
|
4359
4398
|
checkAsyncKeyword(d, t);
|
|
4360
|
-
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4361
|
-
e.block$data(
|
|
4399
|
+
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), _ = n.let("valid");
|
|
4400
|
+
e.block$data(_, T), e.ok((r = t.valid) !== null && r !== void 0 ? r : _);
|
|
4362
4401
|
function T() {
|
|
4363
4402
|
if (t.errors === !1)
|
|
4364
4403
|
k(), t.modifying && modifyData(e), $(() => e.error());
|
|
4365
4404
|
else {
|
|
4366
|
-
const
|
|
4367
|
-
t.modifying && modifyData(e), $(() => addErrs(e,
|
|
4405
|
+
const g = t.async ? C() : S();
|
|
4406
|
+
t.modifying && modifyData(e), $(() => addErrs(e, g));
|
|
4368
4407
|
}
|
|
4369
4408
|
}
|
|
4370
|
-
function
|
|
4371
|
-
const
|
|
4372
|
-
return n.try(() => k((0, codegen_1$p._)`await `), (y) => n.assign(
|
|
4409
|
+
function C() {
|
|
4410
|
+
const g = n.let("ruleErrs", null);
|
|
4411
|
+
return n.try(() => k((0, codegen_1$p._)`await `), (y) => n.assign(_, !1).if((0, codegen_1$p._)`${y} instanceof ${d.ValidationError}`, () => n.assign(g, (0, codegen_1$p._)`${y}.errors`), () => n.throw(y))), g;
|
|
4373
4412
|
}
|
|
4374
|
-
function
|
|
4375
|
-
const
|
|
4376
|
-
return n.assign(
|
|
4413
|
+
function S() {
|
|
4414
|
+
const g = (0, codegen_1$p._)`${p}.errors`;
|
|
4415
|
+
return n.assign(g, null), k(codegen_1$p.nil), g;
|
|
4377
4416
|
}
|
|
4378
|
-
function k(
|
|
4417
|
+
function k(g = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4379
4418
|
const y = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !c || t.schema === !1);
|
|
4380
|
-
n.assign(
|
|
4419
|
+
n.assign(_, (0, codegen_1$p._)`${g}${(0, code_1$9.callValidateCode)(e, p, y, P)}`, t.modifying);
|
|
4381
4420
|
}
|
|
4382
|
-
function $(
|
|
4421
|
+
function $(g) {
|
|
4383
4422
|
var y;
|
|
4384
|
-
n.if((0, codegen_1$p.not)((y = t.valid) !== null && y !== void 0 ? y :
|
|
4423
|
+
n.if((0, codegen_1$p.not)((y = t.valid) !== null && y !== void 0 ? y : _), g);
|
|
4385
4424
|
}
|
|
4386
4425
|
}
|
|
4387
4426
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4460,8 +4499,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4460
4499
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4461
4500
|
const { gen: c } = t;
|
|
4462
4501
|
if (r !== void 0) {
|
|
4463
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4464
|
-
d(T), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4502
|
+
const { errorPath: u, dataPathArr: p, opts: _ } = t, T = c.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4503
|
+
d(T), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, _.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4465
4504
|
}
|
|
4466
4505
|
if (s !== void 0) {
|
|
4467
4506
|
const u = s instanceof codegen_1$o.Name ? s : c.let("data", s, !0);
|
|
@@ -4566,17 +4605,17 @@ function _traverse(e, t, r, n, s, i, o, c, d, u) {
|
|
|
4566
4605
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4567
4606
|
t(n, s, i, o, c, d, u);
|
|
4568
4607
|
for (var p in n) {
|
|
4569
|
-
var
|
|
4570
|
-
if (Array.isArray(
|
|
4608
|
+
var _ = n[p];
|
|
4609
|
+
if (Array.isArray(_)) {
|
|
4571
4610
|
if (p in traverse$1.arrayKeywords)
|
|
4572
|
-
for (var T = 0; T <
|
|
4573
|
-
_traverse(e, t, r,
|
|
4611
|
+
for (var T = 0; T < _.length; T++)
|
|
4612
|
+
_traverse(e, t, r, _[T], s + "/" + p + "/" + T, i, s, p, n, T);
|
|
4574
4613
|
} else if (p in traverse$1.propsKeywords) {
|
|
4575
|
-
if (
|
|
4576
|
-
for (var
|
|
4577
|
-
_traverse(e, t, r,
|
|
4614
|
+
if (_ && typeof _ == "object")
|
|
4615
|
+
for (var C in _)
|
|
4616
|
+
_traverse(e, t, r, _[C], s + "/" + p + "/" + escapeJsonPtr(C), i, s, p, n, C);
|
|
4578
4617
|
} else
|
|
4579
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4618
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, _, s + "/" + p, i, s, p, n);
|
|
4580
4619
|
}
|
|
4581
4620
|
r(n, s, i, o, c, d, u);
|
|
4582
4621
|
}
|
|
@@ -4660,34 +4699,34 @@ function getSchemaRefs(e, t) {
|
|
|
4660
4699
|
if (typeof e == "boolean")
|
|
4661
4700
|
return {};
|
|
4662
4701
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), c = {}, d = /* @__PURE__ */ new Set();
|
|
4663
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4664
|
-
if (
|
|
4702
|
+
return traverse(e, { allKeys: !0 }, (_, T, C, S) => {
|
|
4703
|
+
if (S === void 0)
|
|
4665
4704
|
return;
|
|
4666
4705
|
const k = o + T;
|
|
4667
|
-
let $ = i[
|
|
4668
|
-
typeof
|
|
4669
|
-
function
|
|
4706
|
+
let $ = i[S];
|
|
4707
|
+
typeof _[r] == "string" && ($ = g.call(this, _[r])), y.call(this, _.$anchor), y.call(this, _.$dynamicAnchor), i[T] = $;
|
|
4708
|
+
function g(P) {
|
|
4670
4709
|
const I = this.opts.uriResolver.resolve;
|
|
4671
4710
|
if (P = normalizeId($ ? I($, P) : P), d.has(P))
|
|
4672
4711
|
throw p(P);
|
|
4673
4712
|
d.add(P);
|
|
4674
4713
|
let D = this.refs[P];
|
|
4675
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4714
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(_, D.schema, P) : P !== normalizeId(k) && (P[0] === "#" ? (u(_, c[P], P), c[P] = _) : this.refs[P] = k), P;
|
|
4676
4715
|
}
|
|
4677
4716
|
function y(P) {
|
|
4678
4717
|
if (typeof P == "string") {
|
|
4679
4718
|
if (!ANCHOR.test(P))
|
|
4680
4719
|
throw new Error(`invalid anchor "${P}"`);
|
|
4681
|
-
|
|
4720
|
+
g.call(this, `#${P}`);
|
|
4682
4721
|
}
|
|
4683
4722
|
}
|
|
4684
4723
|
}), c;
|
|
4685
|
-
function u(
|
|
4686
|
-
if (T !== void 0 && !equal$2(
|
|
4687
|
-
throw p(
|
|
4724
|
+
function u(_, T, C) {
|
|
4725
|
+
if (T !== void 0 && !equal$2(_, T))
|
|
4726
|
+
throw p(C);
|
|
4688
4727
|
}
|
|
4689
|
-
function p(
|
|
4690
|
-
return new Error(`reference "${
|
|
4728
|
+
function p(_) {
|
|
4729
|
+
return new Error(`reference "${_}" resolves to more than one schema`);
|
|
4691
4730
|
}
|
|
4692
4731
|
}
|
|
4693
4732
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4804,10 +4843,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4804
4843
|
}
|
|
4805
4844
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4806
4845
|
for (const T of p.rules)
|
|
4807
|
-
|
|
4808
|
-
|
|
4846
|
+
_(T);
|
|
4847
|
+
_(p.post);
|
|
4809
4848
|
});
|
|
4810
|
-
function
|
|
4849
|
+
function _(T) {
|
|
4811
4850
|
(0, applicability_1.shouldUseGroup)(i, T) && (T.type ? (s.if((0, dataType_2.checkDataType)(T.type, o, d.strictNumbers)), iterateKeywords(e, T), t.length === 1 && t[0] === T.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, T), c || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4812
4851
|
}
|
|
4813
4852
|
}
|
|
@@ -5070,21 +5109,21 @@ function compileSchema(e) {
|
|
|
5070
5109
|
let p;
|
|
5071
5110
|
try {
|
|
5072
5111
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5073
|
-
const
|
|
5074
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5075
|
-
const
|
|
5076
|
-
if (this.scope.value(d, { ref:
|
|
5077
|
-
const { props:
|
|
5078
|
-
|
|
5079
|
-
props:
|
|
5112
|
+
const _ = o.toString();
|
|
5113
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${_}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5114
|
+
const C = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5115
|
+
if (this.scope.value(d, { ref: C }), C.errors = null, C.schema = e.schema, C.schemaEnv = e, e.$async && (C.$async = !0), this.opts.code.source === !0 && (C.source = { validateName: d, validateCode: _, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5116
|
+
const { props: S, items: k } = u;
|
|
5117
|
+
C.evaluated = {
|
|
5118
|
+
props: S instanceof codegen_1$m.Name ? void 0 : S,
|
|
5080
5119
|
items: k instanceof codegen_1$m.Name ? void 0 : k,
|
|
5081
|
-
dynamicProps:
|
|
5120
|
+
dynamicProps: S instanceof codegen_1$m.Name,
|
|
5082
5121
|
dynamicItems: k instanceof codegen_1$m.Name
|
|
5083
|
-
},
|
|
5122
|
+
}, C.source && (C.source.evaluated = (0, codegen_1$m.stringify)(C.evaluated));
|
|
5084
5123
|
}
|
|
5085
|
-
return e.validate =
|
|
5086
|
-
} catch (
|
|
5087
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5124
|
+
return e.validate = C, e;
|
|
5125
|
+
} catch (_) {
|
|
5126
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), _;
|
|
5088
5127
|
} finally {
|
|
5089
5128
|
this._compilations.delete(e);
|
|
5090
5129
|
}
|
|
@@ -5205,9 +5244,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5205
5244
|
l[m] = arguments[m];
|
|
5206
5245
|
if (l.length > 1) {
|
|
5207
5246
|
l[0] = l[0].slice(0, -1);
|
|
5208
|
-
for (var
|
|
5209
|
-
l[
|
|
5210
|
-
return l[
|
|
5247
|
+
for (var R = l.length - 1, b = 1; b < R; ++b)
|
|
5248
|
+
l[b] = l[b].slice(1, -1);
|
|
5249
|
+
return l[R] = l[R].slice(1), l.join("");
|
|
5211
5250
|
} else
|
|
5212
5251
|
return l[0];
|
|
5213
5252
|
}
|
|
@@ -5226,17 +5265,17 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5226
5265
|
function d(f, l) {
|
|
5227
5266
|
var m = f;
|
|
5228
5267
|
if (l)
|
|
5229
|
-
for (var
|
|
5230
|
-
m[
|
|
5268
|
+
for (var R in l)
|
|
5269
|
+
m[R] = l[R];
|
|
5231
5270
|
return m;
|
|
5232
5271
|
}
|
|
5233
5272
|
function u(f) {
|
|
5234
|
-
var l = "[A-Za-z]", m = "[0-9]",
|
|
5235
|
-
s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(
|
|
5236
|
-
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), V = s(
|
|
5237
|
-
s("[vV]" +
|
|
5238
|
-
var ct = s(
|
|
5239
|
-
return s(s(
|
|
5273
|
+
var l = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), b = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, m, "[\\-\\.\\_\\~]", Y);
|
|
5274
|
+
s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
|
|
5275
|
+
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), V = s(R + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + ie), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Se = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), ge = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ye = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), Be = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ie = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), $e = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5276
|
+
s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
|
|
5277
|
+
var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
|
|
5278
|
+
return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5240
5279
|
NOT_SCHEME: new RegExp(n("[^]", l, m, "[\\+\\-\\.]"), "g"),
|
|
5241
5280
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5242
5281
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
@@ -5247,29 +5286,29 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5247
5286
|
ESCAPE: new RegExp(n("[^]", B, U), "g"),
|
|
5248
5287
|
UNRESERVED: new RegExp(B, "g"),
|
|
5249
5288
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5250
|
-
PCT_ENCODED: new RegExp(
|
|
5289
|
+
PCT_ENCODED: new RegExp(b, "g"),
|
|
5251
5290
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5252
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5291
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5253
5292
|
//RFC 6874, with relaxed parsing rules
|
|
5254
5293
|
};
|
|
5255
5294
|
}
|
|
5256
|
-
var p = u(!1),
|
|
5295
|
+
var p = u(!1), _ = u(!0), T = function() {
|
|
5257
5296
|
function f(l, m) {
|
|
5258
|
-
var
|
|
5297
|
+
var R = [], b = !0, q = !1, U = void 0;
|
|
5259
5298
|
try {
|
|
5260
|
-
for (var J = l[Symbol.iterator](), Y; !(
|
|
5299
|
+
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); b = !0)
|
|
5261
5300
|
;
|
|
5262
5301
|
} catch (se) {
|
|
5263
5302
|
q = !0, U = se;
|
|
5264
5303
|
} finally {
|
|
5265
5304
|
try {
|
|
5266
|
-
!
|
|
5305
|
+
!b && J.return && J.return();
|
|
5267
5306
|
} finally {
|
|
5268
5307
|
if (q)
|
|
5269
5308
|
throw U;
|
|
5270
5309
|
}
|
|
5271
5310
|
}
|
|
5272
|
-
return
|
|
5311
|
+
return R;
|
|
5273
5312
|
}
|
|
5274
5313
|
return function(l, m) {
|
|
5275
5314
|
if (Array.isArray(l))
|
|
@@ -5278,14 +5317,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5278
5317
|
return f(l, m);
|
|
5279
5318
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5280
5319
|
};
|
|
5281
|
-
}(),
|
|
5320
|
+
}(), C = function(f) {
|
|
5282
5321
|
if (Array.isArray(f)) {
|
|
5283
5322
|
for (var l = 0, m = Array(f.length); l < f.length; l++)
|
|
5284
5323
|
m[l] = f[l];
|
|
5285
5324
|
return m;
|
|
5286
5325
|
} else
|
|
5287
5326
|
return Array.from(f);
|
|
5288
|
-
},
|
|
5327
|
+
}, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128, w = "-", O = /^xn--/, A = /[^\0-\x7E]/, x = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5289
5328
|
overflow: "Overflow: input needs wider integers to process",
|
|
5290
5329
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5291
5330
|
"invalid-input": "Invalid input"
|
|
@@ -5294,72 +5333,72 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5294
5333
|
throw new RangeError(z[f]);
|
|
5295
5334
|
}
|
|
5296
5335
|
function ke(f, l) {
|
|
5297
|
-
for (var m = [],
|
|
5298
|
-
m[
|
|
5336
|
+
for (var m = [], R = f.length; R--; )
|
|
5337
|
+
m[R] = l(f[R]);
|
|
5299
5338
|
return m;
|
|
5300
5339
|
}
|
|
5301
5340
|
function Ce(f, l) {
|
|
5302
|
-
var m = f.split("@"),
|
|
5303
|
-
m.length > 1 && (
|
|
5304
|
-
var
|
|
5305
|
-
return
|
|
5341
|
+
var m = f.split("@"), R = "";
|
|
5342
|
+
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(x, ".");
|
|
5343
|
+
var b = f.split("."), q = ke(b, l).join(".");
|
|
5344
|
+
return R + q;
|
|
5306
5345
|
}
|
|
5307
5346
|
function Le(f) {
|
|
5308
|
-
for (var l = [], m = 0,
|
|
5309
|
-
var
|
|
5310
|
-
if (
|
|
5347
|
+
for (var l = [], m = 0, R = f.length; m < R; ) {
|
|
5348
|
+
var b = f.charCodeAt(m++);
|
|
5349
|
+
if (b >= 55296 && b <= 56319 && m < R) {
|
|
5311
5350
|
var q = f.charCodeAt(m++);
|
|
5312
|
-
(q & 64512) == 56320 ? l.push(((
|
|
5351
|
+
(q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), m--);
|
|
5313
5352
|
} else
|
|
5314
|
-
l.push(
|
|
5353
|
+
l.push(b);
|
|
5315
5354
|
}
|
|
5316
5355
|
return l;
|
|
5317
5356
|
}
|
|
5318
5357
|
var et = function(l) {
|
|
5319
|
-
return String.fromCodePoint.apply(String,
|
|
5358
|
+
return String.fromCodePoint.apply(String, C(l));
|
|
5320
5359
|
}, qe = function(l) {
|
|
5321
5360
|
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : k;
|
|
5322
5361
|
}, F = function(l, m) {
|
|
5323
5362
|
return l + 22 + 75 * (l < 26) - ((m != 0) << 5);
|
|
5324
|
-
}, v = function(l, m,
|
|
5325
|
-
var
|
|
5363
|
+
}, v = function(l, m, R) {
|
|
5364
|
+
var b = 0;
|
|
5326
5365
|
for (
|
|
5327
|
-
l =
|
|
5366
|
+
l = R ? K(l / P) : l >> 1, l += K(l / m);
|
|
5328
5367
|
/* no initialization */
|
|
5329
|
-
l > re *
|
|
5330
|
-
|
|
5368
|
+
l > re * g >> 1;
|
|
5369
|
+
b += k
|
|
5331
5370
|
)
|
|
5332
5371
|
l = K(l / re);
|
|
5333
|
-
return K(
|
|
5372
|
+
return K(b + (re + 1) * l / (l + y));
|
|
5334
5373
|
}, j = function(l) {
|
|
5335
|
-
var m = [],
|
|
5374
|
+
var m = [], R = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
|
|
5336
5375
|
J < 0 && (J = 0);
|
|
5337
5376
|
for (var Y = 0; Y < J; ++Y)
|
|
5338
5377
|
l.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(l.charCodeAt(Y));
|
|
5339
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5378
|
+
for (var se = J > 0 ? J + 1 : 0; se < R; ) {
|
|
5340
5379
|
for (
|
|
5341
|
-
var B =
|
|
5380
|
+
var B = b, Z = 1, ie = k;
|
|
5342
5381
|
;
|
|
5343
5382
|
/* no condition */
|
|
5344
5383
|
ie += k
|
|
5345
5384
|
) {
|
|
5346
|
-
se >=
|
|
5385
|
+
se >= R && oe("invalid-input");
|
|
5347
5386
|
var V = qe(l.charCodeAt(se++));
|
|
5348
|
-
(V >= k || V > K((
|
|
5349
|
-
var X = ie <= U ? $ : ie >= U +
|
|
5387
|
+
(V >= k || V > K((S - b) / Z)) && oe("overflow"), b += V * Z;
|
|
5388
|
+
var X = ie <= U ? $ : ie >= U + g ? g : ie - U;
|
|
5350
5389
|
if (V < X)
|
|
5351
5390
|
break;
|
|
5352
5391
|
var ae = k - X;
|
|
5353
|
-
Z > K(
|
|
5392
|
+
Z > K(S / ae) && oe("overflow"), Z *= ae;
|
|
5354
5393
|
}
|
|
5355
5394
|
var ee = m.length + 1;
|
|
5356
|
-
U = v(
|
|
5395
|
+
U = v(b - B, ee, B == 0), K(b / ee) > S - q && oe("overflow"), q += K(b / ee), b %= ee, m.splice(b++, 0, q);
|
|
5357
5396
|
}
|
|
5358
5397
|
return String.fromCodePoint.apply(String, m);
|
|
5359
|
-
},
|
|
5398
|
+
}, E = function(l) {
|
|
5360
5399
|
var m = [];
|
|
5361
5400
|
l = Le(l);
|
|
5362
|
-
var
|
|
5401
|
+
var R = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
|
|
5363
5402
|
try {
|
|
5364
5403
|
for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5365
5404
|
var ie = Z.value;
|
|
@@ -5376,12 +5415,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5376
5415
|
}
|
|
5377
5416
|
}
|
|
5378
5417
|
var V = m.length, X = V;
|
|
5379
|
-
for (V && m.push(w); X <
|
|
5380
|
-
var ae =
|
|
5418
|
+
for (V && m.push(w); X < R; ) {
|
|
5419
|
+
var ae = S, ee = !0, Se = !1, ge = void 0;
|
|
5381
5420
|
try {
|
|
5382
5421
|
for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
|
|
5383
5422
|
var Ie = Be.value;
|
|
5384
|
-
Ie >=
|
|
5423
|
+
Ie >= b && Ie < ae && (ae = Ie);
|
|
5385
5424
|
}
|
|
5386
5425
|
} catch (lt) {
|
|
5387
5426
|
Se = !0, ge = lt;
|
|
@@ -5394,19 +5433,19 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5394
5433
|
}
|
|
5395
5434
|
}
|
|
5396
5435
|
var fe = X + 1;
|
|
5397
|
-
ae -
|
|
5436
|
+
ae - b > K((S - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
|
|
5398
5437
|
var $e = !0, je = !1, we = void 0;
|
|
5399
5438
|
try {
|
|
5400
5439
|
for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
|
|
5401
5440
|
var Ht = Ut.value;
|
|
5402
|
-
if (Ht <
|
|
5441
|
+
if (Ht < b && ++q > S && oe("overflow"), Ht == b) {
|
|
5403
5442
|
for (
|
|
5404
5443
|
var pt = q, ft = k;
|
|
5405
5444
|
;
|
|
5406
5445
|
/* no condition */
|
|
5407
5446
|
ft += k
|
|
5408
5447
|
) {
|
|
5409
|
-
var ht = ft <= U ? $ : ft >= U +
|
|
5448
|
+
var ht = ft <= U ? $ : ft >= U + g ? g : ft - U;
|
|
5410
5449
|
if (pt < ht)
|
|
5411
5450
|
break;
|
|
5412
5451
|
var xt = pt - ht, Vt = k - ht;
|
|
@@ -5425,16 +5464,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5425
5464
|
throw we;
|
|
5426
5465
|
}
|
|
5427
5466
|
}
|
|
5428
|
-
++q, ++
|
|
5467
|
+
++q, ++b;
|
|
5429
5468
|
}
|
|
5430
5469
|
return m.join("");
|
|
5431
5470
|
}, a = function(l) {
|
|
5432
5471
|
return Ce(l, function(m) {
|
|
5433
|
-
return
|
|
5472
|
+
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5434
5473
|
});
|
|
5435
5474
|
}, h = function(l) {
|
|
5436
5475
|
return Ce(l, function(m) {
|
|
5437
|
-
return A.test(m) ? "xn--" +
|
|
5476
|
+
return A.test(m) ? "xn--" + E(m) : m;
|
|
5438
5477
|
});
|
|
5439
5478
|
}, N = {
|
|
5440
5479
|
/**
|
|
@@ -5455,7 +5494,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5455
5494
|
encode: et
|
|
5456
5495
|
},
|
|
5457
5496
|
decode: j,
|
|
5458
|
-
encode:
|
|
5497
|
+
encode: E,
|
|
5459
5498
|
toASCII: h,
|
|
5460
5499
|
toUnicode: a
|
|
5461
5500
|
}, M = {};
|
|
@@ -5464,21 +5503,21 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5464
5503
|
return l < 16 ? m = "%0" + l.toString(16).toUpperCase() : l < 128 ? m = "%" + l.toString(16).toUpperCase() : l < 2048 ? m = "%" + (l >> 6 | 192).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase() : m = "%" + (l >> 12 | 224).toString(16).toUpperCase() + "%" + (l >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase(), m;
|
|
5465
5504
|
}
|
|
5466
5505
|
function W(f) {
|
|
5467
|
-
for (var l = "", m = 0,
|
|
5468
|
-
var
|
|
5469
|
-
if (
|
|
5470
|
-
l += String.fromCharCode(
|
|
5471
|
-
else if (
|
|
5472
|
-
if (
|
|
5506
|
+
for (var l = "", m = 0, R = f.length; m < R; ) {
|
|
5507
|
+
var b = parseInt(f.substr(m + 1, 2), 16);
|
|
5508
|
+
if (b < 128)
|
|
5509
|
+
l += String.fromCharCode(b), m += 3;
|
|
5510
|
+
else if (b >= 194 && b < 224) {
|
|
5511
|
+
if (R - m >= 6) {
|
|
5473
5512
|
var q = parseInt(f.substr(m + 4, 2), 16);
|
|
5474
|
-
l += String.fromCharCode((
|
|
5513
|
+
l += String.fromCharCode((b & 31) << 6 | q & 63);
|
|
5475
5514
|
} else
|
|
5476
5515
|
l += f.substr(m, 6);
|
|
5477
5516
|
m += 6;
|
|
5478
|
-
} else if (
|
|
5479
|
-
if (
|
|
5517
|
+
} else if (b >= 224) {
|
|
5518
|
+
if (R - m >= 9) {
|
|
5480
5519
|
var U = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5481
|
-
l += String.fromCharCode((
|
|
5520
|
+
l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
|
|
5482
5521
|
} else
|
|
5483
5522
|
l += f.substr(m, 9);
|
|
5484
5523
|
m += 9;
|
|
@@ -5488,9 +5527,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5488
5527
|
return l;
|
|
5489
5528
|
}
|
|
5490
5529
|
function G(f, l) {
|
|
5491
|
-
function m(
|
|
5492
|
-
var
|
|
5493
|
-
return
|
|
5530
|
+
function m(R) {
|
|
5531
|
+
var b = W(R);
|
|
5532
|
+
return b.match(l.UNRESERVED) ? b : R;
|
|
5494
5533
|
}
|
|
5495
5534
|
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, m).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, m).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, m).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, m).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
|
|
5496
5535
|
}
|
|
@@ -5498,13 +5537,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5498
5537
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5499
5538
|
}
|
|
5500
5539
|
function he(f, l) {
|
|
5501
|
-
var m = f.match(l.IPV4ADDRESS) || [],
|
|
5502
|
-
return
|
|
5540
|
+
var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2), b = R[1];
|
|
5541
|
+
return b ? b.split(".").map(ne).join(".") : f;
|
|
5503
5542
|
}
|
|
5504
5543
|
function Ue(f, l) {
|
|
5505
|
-
var m = f.match(l.IPV6ADDRESS) || [],
|
|
5506
|
-
if (
|
|
5507
|
-
for (var U =
|
|
5544
|
+
var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3), b = R[1], q = R[2];
|
|
5545
|
+
if (b) {
|
|
5546
|
+
for (var U = b.toLowerCase().split("::").reverse(), J = T(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), V = ie ? 7 : 8, X = Z.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
|
|
5508
5547
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5509
5548
|
ie && (ae[V - 1] = he(ae[V - 1], l));
|
|
5510
5549
|
var Se = ae.reduce(function(fe, $e, je) {
|
|
@@ -5527,32 +5566,32 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5527
5566
|
}
|
|
5528
5567
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5529
5568
|
function de(f) {
|
|
5530
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {},
|
|
5569
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = l.iri !== !1 ? _ : p;
|
|
5531
5570
|
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5532
|
-
var
|
|
5533
|
-
if (
|
|
5534
|
-
rt ? (m.scheme =
|
|
5571
|
+
var b = f.match(tt);
|
|
5572
|
+
if (b) {
|
|
5573
|
+
rt ? (m.scheme = b[1], m.userinfo = b[3], m.host = b[4], m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = b[7], m.fragment = b[8], isNaN(m.port) && (m.port = b[5])) : (m.scheme = b[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, m.host = f.indexOf("//") !== -1 ? b[4] : void 0, m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = f.indexOf("?") !== -1 ? b[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), m.host && (m.host = Ue(he(m.host, R), R)), 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", l.reference && l.reference !== "suffix" && l.reference !== m.reference && (m.error = m.error || "URI is not a " + l.reference + " reference.");
|
|
5535
5574
|
var q = M[(l.scheme || m.scheme || "").toLowerCase()];
|
|
5536
5575
|
if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
|
|
5537
5576
|
if (m.host && (l.domainHost || q && q.domainHost))
|
|
5538
5577
|
try {
|
|
5539
|
-
m.host = N.toASCII(m.host.replace(
|
|
5578
|
+
m.host = N.toASCII(m.host.replace(R.PCT_ENCODED, W).toLowerCase());
|
|
5540
5579
|
} catch (U) {
|
|
5541
5580
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5542
5581
|
}
|
|
5543
5582
|
G(m, p);
|
|
5544
5583
|
} else
|
|
5545
|
-
G(m,
|
|
5584
|
+
G(m, R);
|
|
5546
5585
|
q && q.parse && q.parse(m, l);
|
|
5547
5586
|
} else
|
|
5548
5587
|
m.error = m.error || "URI can not be parsed.";
|
|
5549
5588
|
return m;
|
|
5550
5589
|
}
|
|
5551
5590
|
function nt(f, l) {
|
|
5552
|
-
var m = l.iri !== !1 ?
|
|
5553
|
-
return f.userinfo !== void 0 && (
|
|
5591
|
+
var m = l.iri !== !1 ? _ : p, R = [];
|
|
5592
|
+
return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Ue(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(b, q, U) {
|
|
5554
5593
|
return "[" + q + (U ? "%25" + U : "") + "]";
|
|
5555
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5594
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
|
|
5556
5595
|
}
|
|
5557
5596
|
var He = /^\.\.?\//, xe = /^\/\.(\/|$)/, Ve = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5558
5597
|
function me(f) {
|
|
@@ -5568,38 +5607,38 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5568
5607
|
else {
|
|
5569
5608
|
var m = f.match(st);
|
|
5570
5609
|
if (m) {
|
|
5571
|
-
var
|
|
5572
|
-
f = f.slice(
|
|
5610
|
+
var R = m[0];
|
|
5611
|
+
f = f.slice(R.length), l.push(R);
|
|
5573
5612
|
} else
|
|
5574
5613
|
throw new Error("Unexpected dot segment condition");
|
|
5575
5614
|
}
|
|
5576
5615
|
return l.join("");
|
|
5577
5616
|
}
|
|
5578
5617
|
function le(f) {
|
|
5579
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ?
|
|
5580
|
-
if (
|
|
5581
|
-
if (l.domainHost ||
|
|
5618
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
|
|
5619
|
+
if (b && b.serialize && b.serialize(f, l), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5620
|
+
if (l.domainHost || b && b.domainHost)
|
|
5582
5621
|
try {
|
|
5583
5622
|
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5584
5623
|
} catch (J) {
|
|
5585
5624
|
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5586
5625
|
}
|
|
5587
5626
|
}
|
|
5588
|
-
G(f, m), l.reference !== "suffix" && f.scheme && (
|
|
5627
|
+
G(f, m), l.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5589
5628
|
var q = nt(f, l);
|
|
5590
|
-
if (q !== void 0 && (l.reference !== "suffix" &&
|
|
5629
|
+
if (q !== void 0 && (l.reference !== "suffix" && R.push("//"), R.push(q), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
|
|
5591
5630
|
var U = f.path;
|
|
5592
|
-
!l.absolutePath && (!
|
|
5631
|
+
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
|
|
5593
5632
|
}
|
|
5594
|
-
return f.query !== void 0 && (
|
|
5633
|
+
return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
|
|
5595
5634
|
}
|
|
5596
5635
|
function ze(f, l) {
|
|
5597
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},
|
|
5598
|
-
return
|
|
5636
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], b = {};
|
|
5637
|
+
return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
|
|
5599
5638
|
}
|
|
5600
5639
|
function it(f, l, m) {
|
|
5601
|
-
var
|
|
5602
|
-
return le(ze(de(f,
|
|
5640
|
+
var R = d({ scheme: "null" }, m);
|
|
5641
|
+
return le(ze(de(f, R), de(l, R), R, !0), R);
|
|
5603
5642
|
}
|
|
5604
5643
|
function Oe(f, l) {
|
|
5605
5644
|
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
@@ -5608,10 +5647,10 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5608
5647
|
return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof l == "string" ? l = le(de(l, m), m) : i(l) === "object" && (l = le(l, m)), f === l;
|
|
5609
5648
|
}
|
|
5610
5649
|
function ut(f, l) {
|
|
5611
|
-
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE :
|
|
5650
|
+
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : _.ESCAPE, L);
|
|
5612
5651
|
}
|
|
5613
5652
|
function pe(f, l) {
|
|
5614
|
-
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED :
|
|
5653
|
+
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : _.PCT_ENCODED, W);
|
|
5615
5654
|
}
|
|
5616
5655
|
var Ne = {
|
|
5617
5656
|
scheme: "http",
|
|
@@ -5620,8 +5659,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5620
5659
|
return l.host || (l.error = l.error || "HTTP URIs must have a host."), l;
|
|
5621
5660
|
},
|
|
5622
5661
|
serialize: function(l, m) {
|
|
5623
|
-
var
|
|
5624
|
-
return (l.port === (
|
|
5662
|
+
var R = String(l.scheme).toLowerCase() === "https";
|
|
5663
|
+
return (l.port === (R ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5625
5664
|
}
|
|
5626
5665
|
}, It = {
|
|
5627
5666
|
scheme: "https",
|
|
@@ -5636,12 +5675,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5636
5675
|
scheme: "ws",
|
|
5637
5676
|
domainHost: !0,
|
|
5638
5677
|
parse: function(l, m) {
|
|
5639
|
-
var
|
|
5640
|
-
return
|
|
5678
|
+
var R = l;
|
|
5679
|
+
return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
5641
5680
|
},
|
|
5642
5681
|
serialize: function(l, m) {
|
|
5643
5682
|
if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
|
|
5644
|
-
var
|
|
5683
|
+
var R = l.resourceName.split("?"), b = T(R, 2), q = b[0], U = b[1];
|
|
5645
5684
|
l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
|
|
5646
5685
|
}
|
|
5647
5686
|
return l.fragment = void 0, l;
|
|
@@ -5659,90 +5698,90 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5659
5698
|
var Mt = {
|
|
5660
5699
|
scheme: "mailto",
|
|
5661
5700
|
parse: function(l, m) {
|
|
5662
|
-
var
|
|
5663
|
-
if (
|
|
5664
|
-
for (var q = !1, U = {}, J =
|
|
5701
|
+
var R = l, b = R.to = R.path ? R.path.split(",") : [];
|
|
5702
|
+
if (R.path = void 0, R.query) {
|
|
5703
|
+
for (var q = !1, U = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5665
5704
|
var B = J[Y].split("=");
|
|
5666
5705
|
switch (B[0]) {
|
|
5667
5706
|
case "to":
|
|
5668
5707
|
for (var Z = B[1].split(","), ie = 0, V = Z.length; ie < V; ++ie)
|
|
5669
|
-
|
|
5708
|
+
b.push(Z[ie]);
|
|
5670
5709
|
break;
|
|
5671
5710
|
case "subject":
|
|
5672
|
-
|
|
5711
|
+
R.subject = pe(B[1], m);
|
|
5673
5712
|
break;
|
|
5674
5713
|
case "body":
|
|
5675
|
-
|
|
5714
|
+
R.body = pe(B[1], m);
|
|
5676
5715
|
break;
|
|
5677
5716
|
default:
|
|
5678
5717
|
q = !0, U[pe(B[0], m)] = pe(B[1], m);
|
|
5679
5718
|
break;
|
|
5680
5719
|
}
|
|
5681
5720
|
}
|
|
5682
|
-
q && (
|
|
5721
|
+
q && (R.headers = U);
|
|
5683
5722
|
}
|
|
5684
|
-
|
|
5685
|
-
for (var X = 0, ae =
|
|
5686
|
-
var ee =
|
|
5723
|
+
R.query = void 0;
|
|
5724
|
+
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
5725
|
+
var ee = b[X].split("@");
|
|
5687
5726
|
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5688
5727
|
ee[1] = pe(ee[1], m).toLowerCase();
|
|
5689
5728
|
else
|
|
5690
5729
|
try {
|
|
5691
5730
|
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
5692
5731
|
} catch (Se) {
|
|
5693
|
-
|
|
5732
|
+
R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5694
5733
|
}
|
|
5695
|
-
|
|
5734
|
+
b[X] = ee.join("@");
|
|
5696
5735
|
}
|
|
5697
|
-
return
|
|
5736
|
+
return R;
|
|
5698
5737
|
},
|
|
5699
5738
|
serialize: function(l, m) {
|
|
5700
|
-
var
|
|
5701
|
-
if (
|
|
5702
|
-
for (var q = 0, U =
|
|
5703
|
-
var J = String(
|
|
5739
|
+
var R = l, b = c(l.to);
|
|
5740
|
+
if (b) {
|
|
5741
|
+
for (var q = 0, U = b.length; q < U; ++q) {
|
|
5742
|
+
var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
|
|
5704
5743
|
try {
|
|
5705
5744
|
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
5706
5745
|
} catch (X) {
|
|
5707
|
-
|
|
5746
|
+
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5708
5747
|
}
|
|
5709
|
-
|
|
5748
|
+
b[q] = se + "@" + B;
|
|
5710
5749
|
}
|
|
5711
|
-
|
|
5750
|
+
R.path = b.join(",");
|
|
5712
5751
|
}
|
|
5713
5752
|
var Z = l.headers = l.headers || {};
|
|
5714
5753
|
l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
|
|
5715
5754
|
var ie = [];
|
|
5716
5755
|
for (var V in Z)
|
|
5717
5756
|
Z[V] !== ir[V] && ie.push(V.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[V].replace(We, Ot).replace(We, o).replace(fr, L));
|
|
5718
|
-
return ie.length && (
|
|
5757
|
+
return ie.length && (R.query = ie.join("&")), R;
|
|
5719
5758
|
}
|
|
5720
5759
|
}, hr = /^([^\:]+)\:(.*)/, Lt = {
|
|
5721
5760
|
scheme: "urn",
|
|
5722
5761
|
parse: function(l, m) {
|
|
5723
|
-
var
|
|
5724
|
-
if (
|
|
5725
|
-
var q = m.scheme ||
|
|
5726
|
-
|
|
5762
|
+
var R = l.path && l.path.match(hr), b = l;
|
|
5763
|
+
if (R) {
|
|
5764
|
+
var q = m.scheme || b.scheme || "urn", U = R[1].toLowerCase(), J = R[2], Y = q + ":" + (m.nid || U), se = M[Y];
|
|
5765
|
+
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, m));
|
|
5727
5766
|
} else
|
|
5728
|
-
|
|
5729
|
-
return
|
|
5767
|
+
b.error = b.error || "URN can not be parsed.";
|
|
5768
|
+
return b;
|
|
5730
5769
|
},
|
|
5731
5770
|
serialize: function(l, m) {
|
|
5732
|
-
var
|
|
5771
|
+
var R = m.scheme || l.scheme || "urn", b = l.nid, q = R + ":" + (m.nid || b), U = M[q];
|
|
5733
5772
|
U && (l = U.serialize(l, m));
|
|
5734
5773
|
var J = l, Y = l.nss;
|
|
5735
|
-
return J.path = (
|
|
5774
|
+
return J.path = (b || m.nid) + ":" + Y, J;
|
|
5736
5775
|
}
|
|
5737
5776
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
|
|
5738
5777
|
scheme: "urn:uuid",
|
|
5739
5778
|
parse: function(l, m) {
|
|
5740
|
-
var
|
|
5741
|
-
return
|
|
5779
|
+
var R = l;
|
|
5780
|
+
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(mr)) && (R.error = R.error || "UUID is not valid."), R;
|
|
5742
5781
|
},
|
|
5743
5782
|
serialize: function(l, m) {
|
|
5744
|
-
var
|
|
5745
|
-
return
|
|
5783
|
+
var R = l;
|
|
5784
|
+
return R.nss = (l.uuid || "").toLowerCase(), R;
|
|
5746
5785
|
}
|
|
5747
5786
|
};
|
|
5748
5787
|
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
@@ -5773,9 +5812,9 @@ uri$1.default = uri;
|
|
|
5773
5812
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5774
5813
|
return r.CodeGen;
|
|
5775
5814
|
} });
|
|
5776
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util,
|
|
5777
|
-
|
|
5778
|
-
const
|
|
5815
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, T = uri$1, C = (F, v) => new RegExp(F, v);
|
|
5816
|
+
C.code = "new RegExp";
|
|
5817
|
+
const S = ["removeAdditional", "useDefaults", "coerceTypes"], k = /* @__PURE__ */ new Set([
|
|
5779
5818
|
"validate",
|
|
5780
5819
|
"serialize",
|
|
5781
5820
|
"parse",
|
|
@@ -5805,14 +5844,14 @@ uri$1.default = uri;
|
|
|
5805
5844
|
cache: "Map is used as cache, schema object as key.",
|
|
5806
5845
|
serialize: "Map is used as cache, schema object as key.",
|
|
5807
5846
|
ajvErrors: "It is default now."
|
|
5808
|
-
},
|
|
5847
|
+
}, g = {
|
|
5809
5848
|
ignoreKeywordsWithRef: "",
|
|
5810
5849
|
jsPropertySyntax: "",
|
|
5811
5850
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5812
5851
|
}, y = 200;
|
|
5813
5852
|
function P(F) {
|
|
5814
|
-
var v, j,
|
|
5815
|
-
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 = (
|
|
5853
|
+
var v, j, E, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, xe, Ve, st, me, le, ze, it;
|
|
5854
|
+
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 = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : C, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : T.default;
|
|
5816
5855
|
return {
|
|
5817
5856
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5818
5857
|
strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
|
|
@@ -5837,41 +5876,41 @@ uri$1.default = uri;
|
|
|
5837
5876
|
class I {
|
|
5838
5877
|
constructor(v = {}) {
|
|
5839
5878
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
|
|
5840
|
-
const { es5: j, lines:
|
|
5841
|
-
this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines:
|
|
5879
|
+
const { es5: j, lines: E } = this.opts.code;
|
|
5880
|
+
this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines: E }), this.logger = K(v.logger);
|
|
5842
5881
|
const a = v.validateFormats;
|
|
5843
|
-
v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, v, "NOT SUPPORTED"), D.call(this,
|
|
5882
|
+
v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, v, "NOT SUPPORTED"), D.call(this, g, v, "DEPRECATED", "warn"), this._metaOpts = z.call(this), v.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && x.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), O.call(this), v.validateFormats = a;
|
|
5844
5883
|
}
|
|
5845
5884
|
_addVocabularies() {
|
|
5846
5885
|
this.addKeyword("$async");
|
|
5847
5886
|
}
|
|
5848
5887
|
_addDefaultMetaSchema() {
|
|
5849
|
-
const { $data: v, meta: j, schemaId:
|
|
5850
|
-
let a =
|
|
5851
|
-
|
|
5888
|
+
const { $data: v, meta: j, schemaId: E } = this.opts;
|
|
5889
|
+
let a = _;
|
|
5890
|
+
E === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[E], !1);
|
|
5852
5891
|
}
|
|
5853
5892
|
defaultMeta() {
|
|
5854
5893
|
const { meta: v, schemaId: j } = this.opts;
|
|
5855
5894
|
return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
|
|
5856
5895
|
}
|
|
5857
5896
|
validate(v, j) {
|
|
5858
|
-
let
|
|
5897
|
+
let E;
|
|
5859
5898
|
if (typeof v == "string") {
|
|
5860
|
-
if (
|
|
5899
|
+
if (E = this.getSchema(v), !E)
|
|
5861
5900
|
throw new Error(`no schema with key or ref "${v}"`);
|
|
5862
5901
|
} else
|
|
5863
|
-
|
|
5864
|
-
const a =
|
|
5865
|
-
return "$async" in
|
|
5902
|
+
E = this.compile(v);
|
|
5903
|
+
const a = E(j);
|
|
5904
|
+
return "$async" in E || (this.errors = E.errors), a;
|
|
5866
5905
|
}
|
|
5867
5906
|
compile(v, j) {
|
|
5868
|
-
const
|
|
5869
|
-
return
|
|
5907
|
+
const E = this._addSchema(v, j);
|
|
5908
|
+
return E.validate || this._compileSchemaEnv(E);
|
|
5870
5909
|
}
|
|
5871
5910
|
compileAsync(v, j) {
|
|
5872
5911
|
if (typeof this.opts.loadSchema != "function")
|
|
5873
5912
|
throw new Error("options.loadSchema should be a function");
|
|
5874
|
-
const { loadSchema:
|
|
5913
|
+
const { loadSchema: E } = this.opts;
|
|
5875
5914
|
return a.call(this, v, j);
|
|
5876
5915
|
async function a(G, ne) {
|
|
5877
5916
|
await h.call(this, G.$schema);
|
|
@@ -5903,17 +5942,17 @@ uri$1.default = uri;
|
|
|
5903
5942
|
if (ne)
|
|
5904
5943
|
return ne;
|
|
5905
5944
|
try {
|
|
5906
|
-
return await (this._loading[G] =
|
|
5945
|
+
return await (this._loading[G] = E(G));
|
|
5907
5946
|
} finally {
|
|
5908
5947
|
delete this._loading[G];
|
|
5909
5948
|
}
|
|
5910
5949
|
}
|
|
5911
5950
|
}
|
|
5912
5951
|
// Adds schema to the instance
|
|
5913
|
-
addSchema(v, j,
|
|
5952
|
+
addSchema(v, j, E, a = this.opts.validateSchema) {
|
|
5914
5953
|
if (Array.isArray(v)) {
|
|
5915
5954
|
for (const N of v)
|
|
5916
|
-
this.addSchema(N, void 0,
|
|
5955
|
+
this.addSchema(N, void 0, E, a);
|
|
5917
5956
|
return this;
|
|
5918
5957
|
}
|
|
5919
5958
|
let h;
|
|
@@ -5922,23 +5961,23 @@ uri$1.default = uri;
|
|
|
5922
5961
|
if (h = v[N], h !== void 0 && typeof h != "string")
|
|
5923
5962
|
throw new Error(`schema ${N} must be string`);
|
|
5924
5963
|
}
|
|
5925
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v,
|
|
5964
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, E, j, a, !0), this;
|
|
5926
5965
|
}
|
|
5927
5966
|
// Add schema that will be used to validate other schemas
|
|
5928
5967
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5929
|
-
addMetaSchema(v, j,
|
|
5930
|
-
return this.addSchema(v, j, !0,
|
|
5968
|
+
addMetaSchema(v, j, E = this.opts.validateSchema) {
|
|
5969
|
+
return this.addSchema(v, j, !0, E), this;
|
|
5931
5970
|
}
|
|
5932
5971
|
// Validate schema against its meta-schema
|
|
5933
5972
|
validateSchema(v, j) {
|
|
5934
5973
|
if (typeof v == "boolean")
|
|
5935
5974
|
return !0;
|
|
5936
|
-
let
|
|
5937
|
-
if (
|
|
5975
|
+
let E;
|
|
5976
|
+
if (E = v.$schema, E !== void 0 && typeof E != "string")
|
|
5938
5977
|
throw new Error("$schema must be a string");
|
|
5939
|
-
if (
|
|
5978
|
+
if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
|
|
5940
5979
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5941
|
-
const a = this.validate(
|
|
5980
|
+
const a = this.validate(E, v);
|
|
5942
5981
|
if (!a && j) {
|
|
5943
5982
|
const h = "schema is invalid: " + this.errorsText();
|
|
5944
5983
|
if (this.opts.validateSchema === "log")
|
|
@@ -5955,7 +5994,7 @@ uri$1.default = uri;
|
|
|
5955
5994
|
for (; typeof (j = w.call(this, v)) == "string"; )
|
|
5956
5995
|
v = j;
|
|
5957
5996
|
if (j === void 0) {
|
|
5958
|
-
const { schemaId:
|
|
5997
|
+
const { schemaId: E } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: E });
|
|
5959
5998
|
if (j = o.resolveSchema.call(this, a, v), !j)
|
|
5960
5999
|
return;
|
|
5961
6000
|
this.refs[v] = j;
|
|
@@ -5979,8 +6018,8 @@ uri$1.default = uri;
|
|
|
5979
6018
|
case "object": {
|
|
5980
6019
|
const j = v;
|
|
5981
6020
|
this._cache.delete(j);
|
|
5982
|
-
let
|
|
5983
|
-
return
|
|
6021
|
+
let E = v[this.opts.schemaId];
|
|
6022
|
+
return E && (E = (0, d.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
|
|
5984
6023
|
}
|
|
5985
6024
|
default:
|
|
5986
6025
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
@@ -5993,23 +6032,23 @@ uri$1.default = uri;
|
|
|
5993
6032
|
return this;
|
|
5994
6033
|
}
|
|
5995
6034
|
addKeyword(v, j) {
|
|
5996
|
-
let
|
|
6035
|
+
let E;
|
|
5997
6036
|
if (typeof v == "string")
|
|
5998
|
-
|
|
6037
|
+
E = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
|
|
5999
6038
|
else if (typeof v == "object" && j === void 0) {
|
|
6000
|
-
if (j = v,
|
|
6039
|
+
if (j = v, E = j.keyword, Array.isArray(E) && !E.length)
|
|
6001
6040
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6002
6041
|
} else
|
|
6003
6042
|
throw new Error("invalid addKeywords parameters");
|
|
6004
|
-
if (oe.call(this,
|
|
6005
|
-
return (0, p.eachItem)(
|
|
6043
|
+
if (oe.call(this, E, j), !j)
|
|
6044
|
+
return (0, p.eachItem)(E, (h) => ke.call(this, h)), this;
|
|
6006
6045
|
Le.call(this, j);
|
|
6007
6046
|
const a = {
|
|
6008
6047
|
...j,
|
|
6009
6048
|
type: (0, u.getJSONTypes)(j.type),
|
|
6010
6049
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6011
6050
|
};
|
|
6012
|
-
return (0, p.eachItem)(
|
|
6051
|
+
return (0, p.eachItem)(E, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6013
6052
|
}
|
|
6014
6053
|
getKeyword(v) {
|
|
6015
6054
|
const j = this.RULES.all[v];
|
|
@@ -6019,9 +6058,9 @@ uri$1.default = uri;
|
|
|
6019
6058
|
removeKeyword(v) {
|
|
6020
6059
|
const { RULES: j } = this;
|
|
6021
6060
|
delete j.keywords[v], delete j.all[v];
|
|
6022
|
-
for (const
|
|
6023
|
-
const a =
|
|
6024
|
-
a >= 0 &&
|
|
6061
|
+
for (const E of j.rules) {
|
|
6062
|
+
const a = E.rules.findIndex((h) => h.keyword === v);
|
|
6063
|
+
a >= 0 && E.rules.splice(a, 1);
|
|
6025
6064
|
}
|
|
6026
6065
|
return this;
|
|
6027
6066
|
}
|
|
@@ -6029,19 +6068,19 @@ uri$1.default = uri;
|
|
|
6029
6068
|
addFormat(v, j) {
|
|
6030
6069
|
return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
|
|
6031
6070
|
}
|
|
6032
|
-
errorsText(v = this.errors, { separator: j = ", ", dataVar:
|
|
6033
|
-
return !v || v.length === 0 ? "No errors" : v.map((a) => `${
|
|
6071
|
+
errorsText(v = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
|
|
6072
|
+
return !v || v.length === 0 ? "No errors" : v.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6034
6073
|
}
|
|
6035
6074
|
$dataMetaSchema(v, j) {
|
|
6036
|
-
const
|
|
6075
|
+
const E = this.RULES.all;
|
|
6037
6076
|
v = JSON.parse(JSON.stringify(v));
|
|
6038
6077
|
for (const a of j) {
|
|
6039
6078
|
const h = a.split("/").slice(1);
|
|
6040
6079
|
let N = v;
|
|
6041
6080
|
for (const M of h)
|
|
6042
6081
|
N = N[M];
|
|
6043
|
-
for (const M in
|
|
6044
|
-
const L =
|
|
6082
|
+
for (const M in E) {
|
|
6083
|
+
const L = E[M];
|
|
6045
6084
|
if (typeof L != "object")
|
|
6046
6085
|
continue;
|
|
6047
6086
|
const { $data: W } = L.definition, G = N[M];
|
|
@@ -6051,12 +6090,12 @@ uri$1.default = uri;
|
|
|
6051
6090
|
return v;
|
|
6052
6091
|
}
|
|
6053
6092
|
_removeAllSchemas(v, j) {
|
|
6054
|
-
for (const
|
|
6055
|
-
const a = v[
|
|
6056
|
-
(!j || j.test(
|
|
6093
|
+
for (const E in v) {
|
|
6094
|
+
const a = v[E];
|
|
6095
|
+
(!j || j.test(E)) && (typeof a == "string" ? delete v[E] : a && !a.meta && (this._cache.delete(a.schema), delete v[E]));
|
|
6057
6096
|
}
|
|
6058
6097
|
}
|
|
6059
|
-
_addSchema(v, j,
|
|
6098
|
+
_addSchema(v, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6060
6099
|
let N;
|
|
6061
6100
|
const { schemaId: M } = this.opts;
|
|
6062
6101
|
if (typeof v == "object")
|
|
@@ -6070,9 +6109,9 @@ uri$1.default = uri;
|
|
|
6070
6109
|
let L = this._cache.get(v);
|
|
6071
6110
|
if (L !== void 0)
|
|
6072
6111
|
return L;
|
|
6073
|
-
|
|
6074
|
-
const W = d.getSchemaRefs.call(this, v,
|
|
6075
|
-
return L = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId:
|
|
6112
|
+
E = (0, d.normalizeId)(N || E);
|
|
6113
|
+
const W = d.getSchemaRefs.call(this, v, E);
|
|
6114
|
+
return L = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: E, localRefs: W }), this._cache.set(L.schema, L), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = L), a && this.validateSchema(v, !0), L;
|
|
6076
6115
|
}
|
|
6077
6116
|
_checkUnique(v) {
|
|
6078
6117
|
if (this.schemas[v] || this.refs[v])
|
|
@@ -6094,16 +6133,16 @@ uri$1.default = uri;
|
|
|
6094
6133
|
}
|
|
6095
6134
|
}
|
|
6096
6135
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6097
|
-
function D(F, v, j,
|
|
6136
|
+
function D(F, v, j, E = "error") {
|
|
6098
6137
|
for (const a in F) {
|
|
6099
6138
|
const h = a;
|
|
6100
|
-
h in v && this.logger[
|
|
6139
|
+
h in v && this.logger[E](`${j}: option ${a}. ${F[h]}`);
|
|
6101
6140
|
}
|
|
6102
6141
|
}
|
|
6103
6142
|
function w(F) {
|
|
6104
6143
|
return F = (0, d.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6105
6144
|
}
|
|
6106
|
-
function
|
|
6145
|
+
function O() {
|
|
6107
6146
|
const F = this.opts.schemas;
|
|
6108
6147
|
if (F)
|
|
6109
6148
|
if (Array.isArray(F))
|
|
@@ -6131,7 +6170,7 @@ uri$1.default = uri;
|
|
|
6131
6170
|
}
|
|
6132
6171
|
function z() {
|
|
6133
6172
|
const F = { ...this.opts };
|
|
6134
|
-
for (const v of
|
|
6173
|
+
for (const v of S)
|
|
6135
6174
|
delete F[v];
|
|
6136
6175
|
return F;
|
|
6137
6176
|
}
|
|
@@ -6151,16 +6190,16 @@ uri$1.default = uri;
|
|
|
6151
6190
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6152
6191
|
function oe(F, v) {
|
|
6153
6192
|
const { RULES: j } = this;
|
|
6154
|
-
if ((0, p.eachItem)(F, (
|
|
6155
|
-
if (j.keywords[
|
|
6156
|
-
throw new Error(`Keyword ${
|
|
6157
|
-
if (!ue.test(
|
|
6158
|
-
throw new Error(`Keyword ${
|
|
6193
|
+
if ((0, p.eachItem)(F, (E) => {
|
|
6194
|
+
if (j.keywords[E])
|
|
6195
|
+
throw new Error(`Keyword ${E} is already defined`);
|
|
6196
|
+
if (!ue.test(E))
|
|
6197
|
+
throw new Error(`Keyword ${E} has invalid name`);
|
|
6159
6198
|
}), !!v && v.$data && !("code" in v || "validate" in v))
|
|
6160
6199
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6161
6200
|
}
|
|
6162
6201
|
function ke(F, v, j) {
|
|
6163
|
-
var
|
|
6202
|
+
var E;
|
|
6164
6203
|
const a = v == null ? void 0 : v.post;
|
|
6165
6204
|
if (j && a)
|
|
6166
6205
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -6176,11 +6215,11 @@ uri$1.default = uri;
|
|
|
6176
6215
|
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6177
6216
|
}
|
|
6178
6217
|
};
|
|
6179
|
-
v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (
|
|
6218
|
+
v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (E = v.implements) === null || E === void 0 || E.forEach((L) => this.addKeyword(L));
|
|
6180
6219
|
}
|
|
6181
6220
|
function Ce(F, v, j) {
|
|
6182
|
-
const
|
|
6183
|
-
|
|
6221
|
+
const E = F.rules.findIndex((a) => a.keyword === j);
|
|
6222
|
+
E >= 0 ? F.rules.splice(E, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
|
|
6184
6223
|
}
|
|
6185
6224
|
function Le(F) {
|
|
6186
6225
|
let { metaSchema: v } = F;
|
|
@@ -6211,32 +6250,32 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6211
6250
|
code(e) {
|
|
6212
6251
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: c, self: d } = n, { root: u } = i;
|
|
6213
6252
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6214
|
-
return
|
|
6253
|
+
return _();
|
|
6215
6254
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6216
6255
|
if (p === void 0)
|
|
6217
6256
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6218
6257
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6219
6258
|
return T(p);
|
|
6220
|
-
return
|
|
6221
|
-
function
|
|
6259
|
+
return C(p);
|
|
6260
|
+
function _() {
|
|
6222
6261
|
if (i === u)
|
|
6223
6262
|
return callRef(e, o, i, i.$async);
|
|
6224
|
-
const
|
|
6225
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6263
|
+
const S = t.scopeValue("root", { ref: u });
|
|
6264
|
+
return callRef(e, (0, codegen_1$l._)`${S}.validate`, u, u.$async);
|
|
6226
6265
|
}
|
|
6227
|
-
function T(
|
|
6228
|
-
const k = getValidate(e,
|
|
6229
|
-
callRef(e, k,
|
|
6266
|
+
function T(S) {
|
|
6267
|
+
const k = getValidate(e, S);
|
|
6268
|
+
callRef(e, k, S, S.$async);
|
|
6230
6269
|
}
|
|
6231
|
-
function
|
|
6232
|
-
const k = t.scopeValue("schema", c.code.source === !0 ? { ref:
|
|
6233
|
-
schema:
|
|
6270
|
+
function C(S) {
|
|
6271
|
+
const k = t.scopeValue("schema", c.code.source === !0 ? { ref: S, code: (0, codegen_1$l.stringify)(S) } : { ref: S }), $ = t.name("valid"), g = e.subschema({
|
|
6272
|
+
schema: S,
|
|
6234
6273
|
dataTypes: [],
|
|
6235
6274
|
schemaPath: codegen_1$l.nil,
|
|
6236
6275
|
topSchemaRef: k,
|
|
6237
6276
|
errSchemaPath: r
|
|
6238
6277
|
}, $);
|
|
6239
|
-
e.mergeEvaluated(
|
|
6278
|
+
e.mergeEvaluated(g), e.ok($);
|
|
6240
6279
|
}
|
|
6241
6280
|
}
|
|
6242
6281
|
};
|
|
@@ -6247,25 +6286,25 @@ function getValidate(e, t) {
|
|
|
6247
6286
|
ref.getValidate = getValidate;
|
|
6248
6287
|
function callRef(e, t, r, n) {
|
|
6249
6288
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: c, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6250
|
-
n ? p() :
|
|
6289
|
+
n ? p() : _();
|
|
6251
6290
|
function p() {
|
|
6252
6291
|
if (!c.$async)
|
|
6253
6292
|
throw new Error("async schema referenced by sync schema");
|
|
6254
|
-
const
|
|
6293
|
+
const S = s.let("valid");
|
|
6255
6294
|
s.try(() => {
|
|
6256
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`),
|
|
6295
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), C(t), o || s.assign(S, !0);
|
|
6257
6296
|
}, (k) => {
|
|
6258
|
-
s.if((0, codegen_1$l._)`!(${k} instanceof ${i.ValidationError})`, () => s.throw(k)), T(k), o || s.assign(
|
|
6259
|
-
}), e.ok(
|
|
6297
|
+
s.if((0, codegen_1$l._)`!(${k} instanceof ${i.ValidationError})`, () => s.throw(k)), T(k), o || s.assign(S, !1);
|
|
6298
|
+
}), e.ok(S);
|
|
6260
6299
|
}
|
|
6261
|
-
function
|
|
6262
|
-
e.result((0, code_1$8.callValidateCode)(e, t, u), () =>
|
|
6300
|
+
function _() {
|
|
6301
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () => T(t));
|
|
6263
6302
|
}
|
|
6264
|
-
function T(
|
|
6265
|
-
const k = (0, codegen_1$l._)`${
|
|
6303
|
+
function T(S) {
|
|
6304
|
+
const k = (0, codegen_1$l._)`${S}.errors`;
|
|
6266
6305
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${k} : ${names_1$1.default.vErrors}.concat(${k})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6267
6306
|
}
|
|
6268
|
-
function
|
|
6307
|
+
function C(S) {
|
|
6269
6308
|
var k;
|
|
6270
6309
|
if (!i.opts.unevaluated)
|
|
6271
6310
|
return;
|
|
@@ -6274,15 +6313,15 @@ function callRef(e, t, r, n) {
|
|
|
6274
6313
|
if ($ && !$.dynamicProps)
|
|
6275
6314
|
$.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, $.props, i.props));
|
|
6276
6315
|
else {
|
|
6277
|
-
const
|
|
6278
|
-
i.props = util_1$j.mergeEvaluated.props(s,
|
|
6316
|
+
const g = s.var("props", (0, codegen_1$l._)`${S}.evaluated.props`);
|
|
6317
|
+
i.props = util_1$j.mergeEvaluated.props(s, g, i.props, codegen_1$l.Name);
|
|
6279
6318
|
}
|
|
6280
6319
|
if (i.items !== !0)
|
|
6281
6320
|
if ($ && !$.dynamicItems)
|
|
6282
6321
|
$.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, $.items, i.items));
|
|
6283
6322
|
else {
|
|
6284
|
-
const
|
|
6285
|
-
i.items = util_1$j.mergeEvaluated.items(s,
|
|
6323
|
+
const g = s.var("items", (0, codegen_1$l._)`${S}.evaluated.items`);
|
|
6324
|
+
i.items = util_1$j.mergeEvaluated.items(s, g, i.items, codegen_1$l.Name);
|
|
6286
6325
|
}
|
|
6287
6326
|
}
|
|
6288
6327
|
}
|
|
@@ -6423,36 +6462,36 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6423
6462
|
return;
|
|
6424
6463
|
const d = r.length >= c.loopRequired;
|
|
6425
6464
|
if (o.allErrors ? u() : p(), c.strictRequired) {
|
|
6426
|
-
const
|
|
6465
|
+
const C = e.parentSchema.properties, { definedProperties: S } = e.it;
|
|
6427
6466
|
for (const k of r)
|
|
6428
|
-
if ((
|
|
6429
|
-
const $ = o.schemaEnv.baseId + o.errSchemaPath,
|
|
6430
|
-
(0, util_1$h.checkStrictMode)(o,
|
|
6467
|
+
if ((C == null ? void 0 : C[k]) === void 0 && !S.has(k)) {
|
|
6468
|
+
const $ = o.schemaEnv.baseId + o.errSchemaPath, g = `required property "${k}" is not defined at "${$}" (strictRequired)`;
|
|
6469
|
+
(0, util_1$h.checkStrictMode)(o, g, o.opts.strictRequired);
|
|
6431
6470
|
}
|
|
6432
6471
|
}
|
|
6433
6472
|
function u() {
|
|
6434
6473
|
if (d || i)
|
|
6435
|
-
e.block$data(codegen_1$f.nil,
|
|
6474
|
+
e.block$data(codegen_1$f.nil, _);
|
|
6436
6475
|
else
|
|
6437
|
-
for (const
|
|
6438
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6476
|
+
for (const C of r)
|
|
6477
|
+
(0, code_1$6.checkReportMissingProp)(e, C);
|
|
6439
6478
|
}
|
|
6440
6479
|
function p() {
|
|
6441
|
-
const
|
|
6480
|
+
const C = t.let("missing");
|
|
6442
6481
|
if (d || i) {
|
|
6443
|
-
const
|
|
6444
|
-
e.block$data(
|
|
6482
|
+
const S = t.let("valid", !0);
|
|
6483
|
+
e.block$data(S, () => T(C, S)), e.ok(S);
|
|
6445
6484
|
} else
|
|
6446
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6485
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, C)), (0, code_1$6.reportMissingProp)(e, C), t.else();
|
|
6447
6486
|
}
|
|
6448
|
-
function
|
|
6449
|
-
t.forOf("prop", n, (
|
|
6450
|
-
e.setParams({ missingProperty:
|
|
6487
|
+
function _() {
|
|
6488
|
+
t.forOf("prop", n, (C) => {
|
|
6489
|
+
e.setParams({ missingProperty: C }), t.if((0, code_1$6.noPropertyInData)(t, s, C, c.ownProperties), () => e.error());
|
|
6451
6490
|
});
|
|
6452
6491
|
}
|
|
6453
|
-
function T(
|
|
6454
|
-
e.setParams({ missingProperty:
|
|
6455
|
-
t.assign(
|
|
6492
|
+
function T(C, S) {
|
|
6493
|
+
e.setParams({ missingProperty: C }), t.forOf(C, n, () => {
|
|
6494
|
+
t.assign(S, (0, code_1$6.propertyInData)(t, s, C, c.ownProperties)), t.if((0, codegen_1$f.not)(S), () => {
|
|
6456
6495
|
e.error(), t.break();
|
|
6457
6496
|
});
|
|
6458
6497
|
}, codegen_1$f.nil);
|
|
@@ -6502,24 +6541,24 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6502
6541
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6503
6542
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6504
6543
|
function p() {
|
|
6505
|
-
const
|
|
6506
|
-
e.setParams({ i:
|
|
6544
|
+
const S = t.let("i", (0, codegen_1$d._)`${r}.length`), k = t.let("j");
|
|
6545
|
+
e.setParams({ i: S, j: k }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => (_() ? T : C)(S, k));
|
|
6507
6546
|
}
|
|
6508
|
-
function
|
|
6509
|
-
return u.length > 0 && !u.some((
|
|
6547
|
+
function _() {
|
|
6548
|
+
return u.length > 0 && !u.some((S) => S === "object" || S === "array");
|
|
6510
6549
|
}
|
|
6511
|
-
function T(
|
|
6512
|
-
const $ = t.name("item"),
|
|
6513
|
-
t.for((0, codegen_1$d._)`;${
|
|
6514
|
-
t.let($, (0, codegen_1$d._)`${r}[${
|
|
6550
|
+
function T(S, k) {
|
|
6551
|
+
const $ = t.name("item"), g = (0, dataType_1.checkDataTypes)(u, $, c.opts.strictNumbers, dataType_1.DataType.Wrong), y = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6552
|
+
t.for((0, codegen_1$d._)`;${S}--;`, () => {
|
|
6553
|
+
t.let($, (0, codegen_1$d._)`${r}[${S}]`), t.if(g, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${$} == "string"`, (0, codegen_1$d._)`${$} += "_"`), t.if((0, codegen_1$d._)`typeof ${y}[${$}] == "number"`, () => {
|
|
6515
6554
|
t.assign(k, (0, codegen_1$d._)`${y}[${$}]`), e.error(), t.assign(d, !1).break();
|
|
6516
|
-
}).code((0, codegen_1$d._)`${y}[${$}] = ${
|
|
6555
|
+
}).code((0, codegen_1$d._)`${y}[${$}] = ${S}`);
|
|
6517
6556
|
});
|
|
6518
6557
|
}
|
|
6519
|
-
function
|
|
6520
|
-
const $ = (0, util_1$g.useFunc)(t, equal_1$2.default),
|
|
6521
|
-
t.label(
|
|
6522
|
-
e.error(), t.assign(d, !1).break(
|
|
6558
|
+
function C(S, k) {
|
|
6559
|
+
const $ = (0, util_1$g.useFunc)(t, equal_1$2.default), g = t.name("outer");
|
|
6560
|
+
t.label(g).for((0, codegen_1$d._)`;${S}--;`, () => t.for((0, codegen_1$d._)`${k} = ${S}; ${k}--;`, () => t.if((0, codegen_1$d._)`${$}(${r}[${S}], ${r}[${k}])`, () => {
|
|
6561
|
+
e.error(), t.assign(d, !1).break(g);
|
|
6523
6562
|
})));
|
|
6524
6563
|
}
|
|
6525
6564
|
}
|
|
@@ -6559,20 +6598,20 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6559
6598
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6560
6599
|
let p;
|
|
6561
6600
|
if (c || n)
|
|
6562
|
-
p = t.let("valid"), e.block$data(p,
|
|
6601
|
+
p = t.let("valid"), e.block$data(p, _);
|
|
6563
6602
|
else {
|
|
6564
6603
|
if (!Array.isArray(s))
|
|
6565
6604
|
throw new Error("ajv implementation error");
|
|
6566
|
-
const
|
|
6567
|
-
p = (0, codegen_1$b.or)(...s.map((
|
|
6605
|
+
const C = t.const("vSchema", i);
|
|
6606
|
+
p = (0, codegen_1$b.or)(...s.map((S, k) => T(C, k)));
|
|
6568
6607
|
}
|
|
6569
6608
|
e.pass(p);
|
|
6570
|
-
function
|
|
6571
|
-
t.assign(p, !1), t.forOf("v", i, (
|
|
6609
|
+
function _() {
|
|
6610
|
+
t.assign(p, !1), t.forOf("v", i, (C) => t.if((0, codegen_1$b._)`${u()}(${r}, ${C})`, () => t.assign(p, !0).break()));
|
|
6572
6611
|
}
|
|
6573
|
-
function T(
|
|
6574
|
-
const k = s[
|
|
6575
|
-
return typeof k == "object" && k !== null ? (0, codegen_1$b._)`${u()}(${r}, ${
|
|
6612
|
+
function T(C, S) {
|
|
6613
|
+
const k = s[S];
|
|
6614
|
+
return typeof k == "object" && k !== null ? (0, codegen_1$b._)`${u()}(${r}, ${C}[${S}])` : (0, codegen_1$b._)`${r} === ${k}`;
|
|
6576
6615
|
}
|
|
6577
6616
|
}
|
|
6578
6617
|
};
|
|
@@ -6656,17 +6695,17 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6656
6695
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: c } = e;
|
|
6657
6696
|
p(s), c.opts.unevaluated && r.length && c.items !== !0 && (c.items = util_1$c.mergeEvaluated.items(n, r.length, c.items));
|
|
6658
6697
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6659
|
-
r.forEach((
|
|
6660
|
-
(0, util_1$c.alwaysValidSchema)(c,
|
|
6698
|
+
r.forEach((_, T) => {
|
|
6699
|
+
(0, util_1$c.alwaysValidSchema)(c, _) || (n.if((0, codegen_1$9._)`${u} > ${T}`, () => e.subschema({
|
|
6661
6700
|
keyword: o,
|
|
6662
6701
|
schemaProp: T,
|
|
6663
6702
|
dataProp: T
|
|
6664
6703
|
}, d)), e.ok(d));
|
|
6665
6704
|
});
|
|
6666
|
-
function p(
|
|
6667
|
-
const { opts: T, errSchemaPath:
|
|
6705
|
+
function p(_) {
|
|
6706
|
+
const { opts: T, errSchemaPath: C } = c, S = r.length, k = S === _.minItems && (S === _.maxItems || _[t] === !1);
|
|
6668
6707
|
if (T.strictTuples && !k) {
|
|
6669
|
-
const $ = `"${o}" is ${
|
|
6708
|
+
const $ = `"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;
|
|
6670
6709
|
(0, util_1$c.checkStrictMode)(c, $, T.strictTuples);
|
|
6671
6710
|
}
|
|
6672
6711
|
}
|
|
@@ -6731,24 +6770,24 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6731
6770
|
return;
|
|
6732
6771
|
}
|
|
6733
6772
|
i.items = !0;
|
|
6734
|
-
const
|
|
6735
|
-
c === void 0 && o === 1 ?
|
|
6773
|
+
const _ = t.name("valid");
|
|
6774
|
+
c === void 0 && o === 1 ? C(_, () => t.if(_, () => t.break())) : o === 0 ? (t.let(_, !0), c !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, T)) : (t.let(_, !1), T()), e.result(_, () => e.reset());
|
|
6736
6775
|
function T() {
|
|
6737
6776
|
const k = t.name("_valid"), $ = t.let("count", 0);
|
|
6738
|
-
|
|
6777
|
+
C(k, () => t.if(k, () => S($)));
|
|
6739
6778
|
}
|
|
6740
|
-
function
|
|
6741
|
-
t.forRange("i", 0, p, (
|
|
6779
|
+
function C(k, $) {
|
|
6780
|
+
t.forRange("i", 0, p, (g) => {
|
|
6742
6781
|
e.subschema({
|
|
6743
6782
|
keyword: "contains",
|
|
6744
|
-
dataProp:
|
|
6783
|
+
dataProp: g,
|
|
6745
6784
|
dataPropType: util_1$a.Type.Num,
|
|
6746
6785
|
compositeRule: !0
|
|
6747
6786
|
}, k), $();
|
|
6748
6787
|
});
|
|
6749
6788
|
}
|
|
6750
|
-
function
|
|
6751
|
-
t.code((0, codegen_1$7._)`${k}++`), c === void 0 ? t.if((0, codegen_1$7._)`${k} >= ${o}`, () => t.assign(
|
|
6789
|
+
function S(k) {
|
|
6790
|
+
t.code((0, codegen_1$7._)`${k}++`), c === void 0 ? t.if((0, codegen_1$7._)`${k} >= ${o}`, () => t.assign(_, !0).break()) : (t.if((0, codegen_1$7._)`${k} > ${c}`, () => t.assign(_, !1).break()), o === 1 ? t.assign(_, !0) : t.if((0, codegen_1$7._)`${k} >= ${o}`, () => t.assign(_, !0)));
|
|
6752
6791
|
}
|
|
6753
6792
|
}
|
|
6754
6793
|
};
|
|
@@ -6759,11 +6798,11 @@ var dependencies = {};
|
|
|
6759
6798
|
const t = codegen, r = util, n = code;
|
|
6760
6799
|
e.error = {
|
|
6761
6800
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6762
|
-
const
|
|
6763
|
-
return (0, t.str)`must have ${
|
|
6801
|
+
const _ = u === 1 ? "property" : "properties";
|
|
6802
|
+
return (0, t.str)`must have ${_} ${p} when property ${d} is present`;
|
|
6764
6803
|
},
|
|
6765
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6766
|
-
missingProperty: ${
|
|
6804
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: _ } }) => (0, t._)`{property: ${d},
|
|
6805
|
+
missingProperty: ${_},
|
|
6767
6806
|
depsCount: ${u},
|
|
6768
6807
|
deps: ${p}}`
|
|
6769
6808
|
// TODO change to reference
|
|
@@ -6780,47 +6819,47 @@ var dependencies = {};
|
|
|
6780
6819
|
};
|
|
6781
6820
|
function i({ schema: d }) {
|
|
6782
6821
|
const u = {}, p = {};
|
|
6783
|
-
for (const
|
|
6784
|
-
if (
|
|
6822
|
+
for (const _ in d) {
|
|
6823
|
+
if (_ === "__proto__")
|
|
6785
6824
|
continue;
|
|
6786
|
-
const T = Array.isArray(d[
|
|
6787
|
-
T[
|
|
6825
|
+
const T = Array.isArray(d[_]) ? u : p;
|
|
6826
|
+
T[_] = d[_];
|
|
6788
6827
|
}
|
|
6789
6828
|
return [u, p];
|
|
6790
6829
|
}
|
|
6791
6830
|
function o(d, u = d.schema) {
|
|
6792
|
-
const { gen: p, data:
|
|
6831
|
+
const { gen: p, data: _, it: T } = d;
|
|
6793
6832
|
if (Object.keys(u).length === 0)
|
|
6794
6833
|
return;
|
|
6795
|
-
const
|
|
6796
|
-
for (const
|
|
6797
|
-
const k = u[
|
|
6834
|
+
const C = p.let("missing");
|
|
6835
|
+
for (const S in u) {
|
|
6836
|
+
const k = u[S];
|
|
6798
6837
|
if (k.length === 0)
|
|
6799
6838
|
continue;
|
|
6800
|
-
const $ = (0, n.propertyInData)(p,
|
|
6839
|
+
const $ = (0, n.propertyInData)(p, _, S, T.opts.ownProperties);
|
|
6801
6840
|
d.setParams({
|
|
6802
|
-
property:
|
|
6841
|
+
property: S,
|
|
6803
6842
|
depsCount: k.length,
|
|
6804
6843
|
deps: k.join(", ")
|
|
6805
6844
|
}), T.allErrors ? p.if($, () => {
|
|
6806
|
-
for (const
|
|
6807
|
-
(0, n.checkReportMissingProp)(d,
|
|
6808
|
-
}) : (p.if((0, t._)`${$} && (${(0, n.checkMissingProp)(d, k,
|
|
6845
|
+
for (const g of k)
|
|
6846
|
+
(0, n.checkReportMissingProp)(d, g);
|
|
6847
|
+
}) : (p.if((0, t._)`${$} && (${(0, n.checkMissingProp)(d, k, C)})`), (0, n.reportMissingProp)(d, C), p.else());
|
|
6809
6848
|
}
|
|
6810
6849
|
}
|
|
6811
6850
|
e.validatePropertyDeps = o;
|
|
6812
6851
|
function c(d, u = d.schema) {
|
|
6813
|
-
const { gen: p, data:
|
|
6852
|
+
const { gen: p, data: _, keyword: T, it: C } = d, S = p.name("valid");
|
|
6814
6853
|
for (const k in u)
|
|
6815
|
-
(0, r.alwaysValidSchema)(
|
|
6816
|
-
(0, n.propertyInData)(p,
|
|
6854
|
+
(0, r.alwaysValidSchema)(C, u[k]) || (p.if(
|
|
6855
|
+
(0, n.propertyInData)(p, _, k, C.opts.ownProperties),
|
|
6817
6856
|
() => {
|
|
6818
|
-
const $ = d.subschema({ keyword: T, schemaProp: k },
|
|
6819
|
-
d.mergeValidEvaluated($,
|
|
6857
|
+
const $ = d.subschema({ keyword: T, schemaProp: k }, S);
|
|
6858
|
+
d.mergeValidEvaluated($, S);
|
|
6820
6859
|
},
|
|
6821
|
-
() => p.var(
|
|
6860
|
+
() => p.var(S, !0)
|
|
6822
6861
|
// TODO var
|
|
6823
|
-
), d.ok(
|
|
6862
|
+
), d.ok(S));
|
|
6824
6863
|
}
|
|
6825
6864
|
e.validateSchemaDeps = c, e.default = s;
|
|
6826
6865
|
})(dependencies);
|
|
@@ -6873,27 +6912,27 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6873
6912
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6874
6913
|
return;
|
|
6875
6914
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6876
|
-
|
|
6877
|
-
function
|
|
6915
|
+
_(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6916
|
+
function _() {
|
|
6878
6917
|
t.forIn("key", s, ($) => {
|
|
6879
|
-
!u.length && !p.length ?
|
|
6918
|
+
!u.length && !p.length ? S($) : t.if(T($), () => S($));
|
|
6880
6919
|
});
|
|
6881
6920
|
}
|
|
6882
6921
|
function T($) {
|
|
6883
|
-
let
|
|
6922
|
+
let g;
|
|
6884
6923
|
if (u.length > 8) {
|
|
6885
6924
|
const y = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6886
|
-
|
|
6925
|
+
g = (0, code_1$3.isOwnProperty)(t, y, $);
|
|
6887
6926
|
} else
|
|
6888
|
-
u.length ?
|
|
6889
|
-
return p.length && (
|
|
6927
|
+
u.length ? g = (0, codegen_1$5.or)(...u.map((y) => (0, codegen_1$5._)`${$} === ${y}`)) : g = codegen_1$5.nil;
|
|
6928
|
+
return p.length && (g = (0, codegen_1$5.or)(g, ...p.map((y) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, y)}.test(${$})`))), (0, codegen_1$5.not)(g);
|
|
6890
6929
|
}
|
|
6891
|
-
function
|
|
6930
|
+
function C($) {
|
|
6892
6931
|
t.code((0, codegen_1$5._)`delete ${s}[${$}]`);
|
|
6893
6932
|
}
|
|
6894
|
-
function
|
|
6933
|
+
function S($) {
|
|
6895
6934
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6896
|
-
|
|
6935
|
+
C($);
|
|
6897
6936
|
return;
|
|
6898
6937
|
}
|
|
6899
6938
|
if (r === !1) {
|
|
@@ -6901,13 +6940,13 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6901
6940
|
return;
|
|
6902
6941
|
}
|
|
6903
6942
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6904
|
-
const
|
|
6905
|
-
d.removeAdditional === "failing" ? (k($,
|
|
6906
|
-
e.reset(),
|
|
6907
|
-
})) : (k($,
|
|
6943
|
+
const g = t.name("valid");
|
|
6944
|
+
d.removeAdditional === "failing" ? (k($, g, !1), t.if((0, codegen_1$5.not)(g), () => {
|
|
6945
|
+
e.reset(), C($);
|
|
6946
|
+
})) : (k($, g), c || t.if((0, codegen_1$5.not)(g), () => t.break()));
|
|
6908
6947
|
}
|
|
6909
6948
|
}
|
|
6910
|
-
function k($,
|
|
6949
|
+
function k($, g, y) {
|
|
6911
6950
|
const P = {
|
|
6912
6951
|
keyword: "additionalProperties",
|
|
6913
6952
|
dataProp: $,
|
|
@@ -6917,7 +6956,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6917
6956
|
compositeRule: !0,
|
|
6918
6957
|
createErrors: !1,
|
|
6919
6958
|
allErrors: !1
|
|
6920
|
-
}), e.subschema(P,
|
|
6959
|
+
}), e.subschema(P, g);
|
|
6921
6960
|
}
|
|
6922
6961
|
}
|
|
6923
6962
|
};
|
|
@@ -6932,23 +6971,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6932
6971
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6933
6972
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6934
6973
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6935
|
-
for (const
|
|
6936
|
-
i.definedProperties.add(
|
|
6974
|
+
for (const _ of o)
|
|
6975
|
+
i.definedProperties.add(_);
|
|
6937
6976
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6938
|
-
const c = o.filter((
|
|
6977
|
+
const c = o.filter((_) => !(0, util_1$7.alwaysValidSchema)(i, r[_]));
|
|
6939
6978
|
if (c.length === 0)
|
|
6940
6979
|
return;
|
|
6941
6980
|
const d = t.name("valid");
|
|
6942
|
-
for (const
|
|
6943
|
-
u(
|
|
6944
|
-
function u(
|
|
6945
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6981
|
+
for (const _ of c)
|
|
6982
|
+
u(_) ? p(_) : (t.if((0, code_1$2.propertyInData)(t, s, _, i.opts.ownProperties)), p(_), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(_), e.ok(d);
|
|
6983
|
+
function u(_) {
|
|
6984
|
+
return i.opts.useDefaults && !i.compositeRule && r[_].default !== void 0;
|
|
6946
6985
|
}
|
|
6947
|
-
function p(
|
|
6986
|
+
function p(_) {
|
|
6948
6987
|
e.subschema({
|
|
6949
6988
|
keyword: "properties",
|
|
6950
|
-
schemaProp:
|
|
6951
|
-
dataProp:
|
|
6989
|
+
schemaProp: _,
|
|
6990
|
+
dataProp: _
|
|
6952
6991
|
}, d);
|
|
6953
6992
|
}
|
|
6954
6993
|
}
|
|
@@ -6966,26 +7005,26 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6966
7005
|
return;
|
|
6967
7006
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6968
7007
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6969
|
-
const { props:
|
|
7008
|
+
const { props: _ } = i;
|
|
6970
7009
|
T();
|
|
6971
7010
|
function T() {
|
|
6972
7011
|
for (const k of c)
|
|
6973
|
-
u &&
|
|
7012
|
+
u && C(k), i.allErrors ? S(k) : (t.var(p, !0), S(k), t.if(p));
|
|
6974
7013
|
}
|
|
6975
|
-
function
|
|
7014
|
+
function C(k) {
|
|
6976
7015
|
for (const $ in u)
|
|
6977
7016
|
new RegExp(k).test($) && (0, util_1$6.checkStrictMode)(i, `property ${$} matches pattern ${k} (use allowMatchingProperties)`);
|
|
6978
7017
|
}
|
|
6979
|
-
function
|
|
7018
|
+
function S(k) {
|
|
6980
7019
|
t.forIn("key", n, ($) => {
|
|
6981
7020
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, k)}.test(${$})`, () => {
|
|
6982
|
-
const
|
|
6983
|
-
|
|
7021
|
+
const g = d.includes(k);
|
|
7022
|
+
g || e.subschema({
|
|
6984
7023
|
keyword: "patternProperties",
|
|
6985
7024
|
schemaProp: k,
|
|
6986
7025
|
dataProp: $,
|
|
6987
7026
|
dataPropType: util_2.Type.Str
|
|
6988
|
-
}, p), i.opts.unevaluated &&
|
|
7027
|
+
}, p), i.opts.unevaluated && _ !== !0 ? t.assign((0, codegen_1$4._)`${_}[${$}]`, !0) : !g && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
6989
7028
|
});
|
|
6990
7029
|
});
|
|
6991
7030
|
}
|
|
@@ -7044,14 +7083,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7044
7083
|
const i = r, o = t.let("valid", !1), c = t.let("passing", null), d = t.name("_valid");
|
|
7045
7084
|
e.setParams({ passing: c }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7046
7085
|
function u() {
|
|
7047
|
-
i.forEach((p,
|
|
7086
|
+
i.forEach((p, _) => {
|
|
7048
7087
|
let T;
|
|
7049
7088
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : T = e.subschema({
|
|
7050
7089
|
keyword: "oneOf",
|
|
7051
|
-
schemaProp:
|
|
7090
|
+
schemaProp: _,
|
|
7052
7091
|
compositeRule: !0
|
|
7053
|
-
}, d),
|
|
7054
|
-
t.assign(o, !0), t.assign(c,
|
|
7092
|
+
}, d), _ > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(c, (0, codegen_1$3._)`[${c}, ${_}]`).else(), t.if(d, () => {
|
|
7093
|
+
t.assign(o, !0), t.assign(c, _), T && e.mergeEvaluated(T, codegen_1$3.Name);
|
|
7055
7094
|
});
|
|
7056
7095
|
});
|
|
7057
7096
|
}
|
|
@@ -7109,10 +7148,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7109
7148
|
}, c);
|
|
7110
7149
|
e.mergeEvaluated(p);
|
|
7111
7150
|
}
|
|
7112
|
-
function u(p,
|
|
7151
|
+
function u(p, _) {
|
|
7113
7152
|
return () => {
|
|
7114
7153
|
const T = e.subschema({ keyword: p }, c);
|
|
7115
|
-
t.assign(o, c), e.mergeValidEvaluated(T, o),
|
|
7154
|
+
t.assign(o, c), e.mergeValidEvaluated(T, o), _ ? t.assign(_, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7116
7155
|
};
|
|
7117
7156
|
}
|
|
7118
7157
|
}
|
|
@@ -7165,37 +7204,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7165
7204
|
$data: !0,
|
|
7166
7205
|
error: error$1,
|
|
7167
7206
|
code(e, t) {
|
|
7168
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7207
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: _ } = c;
|
|
7169
7208
|
if (!d.validateFormats)
|
|
7170
7209
|
return;
|
|
7171
|
-
s ? T() :
|
|
7210
|
+
s ? T() : C();
|
|
7172
7211
|
function T() {
|
|
7173
|
-
const
|
|
7174
|
-
ref:
|
|
7212
|
+
const S = r.scopeValue("formats", {
|
|
7213
|
+
ref: _.formats,
|
|
7175
7214
|
code: d.code.formats
|
|
7176
|
-
}), k = r.const("fDef", (0, codegen_1$1._)`${
|
|
7177
|
-
r.if((0, codegen_1$1._)`typeof ${k} == "object" && !(${k} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${k}.type || "string"`).assign(
|
|
7215
|
+
}), k = r.const("fDef", (0, codegen_1$1._)`${S}[${o}]`), $ = r.let("fType"), g = r.let("format");
|
|
7216
|
+
r.if((0, codegen_1$1._)`typeof ${k} == "object" && !(${k} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${k}.type || "string"`).assign(g, (0, codegen_1$1._)`${k}.validate`), () => r.assign($, (0, codegen_1$1._)`"string"`).assign(g, k)), e.fail$data((0, codegen_1$1.or)(y(), P()));
|
|
7178
7217
|
function y() {
|
|
7179
|
-
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${
|
|
7218
|
+
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${g}`;
|
|
7180
7219
|
}
|
|
7181
7220
|
function P() {
|
|
7182
|
-
const I = p.$async ? (0, codegen_1$1._)`(${k}.async ? await ${
|
|
7183
|
-
return (0, codegen_1$1._)`${
|
|
7221
|
+
const I = p.$async ? (0, codegen_1$1._)`(${k}.async ? await ${g}(${n}) : ${g}(${n}))` : (0, codegen_1$1._)`${g}(${n})`, D = (0, codegen_1$1._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;
|
|
7222
|
+
return (0, codegen_1$1._)`${g} && ${g} !== true && ${$} === ${t} && !${D}`;
|
|
7184
7223
|
}
|
|
7185
7224
|
}
|
|
7186
|
-
function
|
|
7187
|
-
const
|
|
7188
|
-
if (!
|
|
7225
|
+
function C() {
|
|
7226
|
+
const S = _.formats[i];
|
|
7227
|
+
if (!S) {
|
|
7189
7228
|
y();
|
|
7190
7229
|
return;
|
|
7191
7230
|
}
|
|
7192
|
-
if (
|
|
7231
|
+
if (S === !0)
|
|
7193
7232
|
return;
|
|
7194
|
-
const [k, $,
|
|
7233
|
+
const [k, $, g] = P(S);
|
|
7195
7234
|
k === t && e.pass(I());
|
|
7196
7235
|
function y() {
|
|
7197
7236
|
if (d.strictSchema === !1) {
|
|
7198
|
-
|
|
7237
|
+
_.logger.warn(D());
|
|
7199
7238
|
return;
|
|
7200
7239
|
}
|
|
7201
7240
|
throw new Error(D());
|
|
@@ -7204,16 +7243,16 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7204
7243
|
}
|
|
7205
7244
|
}
|
|
7206
7245
|
function P(D) {
|
|
7207
|
-
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,
|
|
7208
|
-
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${
|
|
7246
|
+
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, O = r.scopeValue("formats", { key: i, ref: D, code: w });
|
|
7247
|
+
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
|
|
7209
7248
|
}
|
|
7210
7249
|
function I() {
|
|
7211
|
-
if (typeof
|
|
7250
|
+
if (typeof S == "object" && !(S instanceof RegExp) && S.async) {
|
|
7212
7251
|
if (!p.$async)
|
|
7213
7252
|
throw new Error("async format in sync schema");
|
|
7214
|
-
return (0, codegen_1$1._)`await ${
|
|
7253
|
+
return (0, codegen_1$1._)`await ${g}(${n})`;
|
|
7215
7254
|
}
|
|
7216
|
-
return typeof $ == "function" ? (0, codegen_1$1._)`${
|
|
7255
|
+
return typeof $ == "function" ? (0, codegen_1$1._)`${g}(${n})` : (0, codegen_1$1._)`${g}.test(${n})`;
|
|
7217
7256
|
}
|
|
7218
7257
|
}
|
|
7219
7258
|
}
|
|
@@ -7278,32 +7317,32 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7278
7317
|
const d = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(c)}`);
|
|
7279
7318
|
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => p(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: c })), e.ok(d);
|
|
7280
7319
|
function p() {
|
|
7281
|
-
const
|
|
7320
|
+
const C = T();
|
|
7282
7321
|
t.if(!1);
|
|
7283
|
-
for (const
|
|
7284
|
-
t.elseIf((0, codegen_1._)`${u} === ${
|
|
7322
|
+
for (const S in C)
|
|
7323
|
+
t.elseIf((0, codegen_1._)`${u} === ${S}`), t.assign(d, _(C[S]));
|
|
7285
7324
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: c }), t.endIf();
|
|
7286
7325
|
}
|
|
7287
|
-
function
|
|
7288
|
-
const
|
|
7289
|
-
return e.mergeEvaluated(k, codegen_1.Name),
|
|
7326
|
+
function _(C) {
|
|
7327
|
+
const S = t.name("valid"), k = e.subschema({ keyword: "oneOf", schemaProp: C }, S);
|
|
7328
|
+
return e.mergeEvaluated(k, codegen_1.Name), S;
|
|
7290
7329
|
}
|
|
7291
7330
|
function T() {
|
|
7292
|
-
var
|
|
7293
|
-
const
|
|
7331
|
+
var C;
|
|
7332
|
+
const S = {}, k = g(s);
|
|
7294
7333
|
let $ = !0;
|
|
7295
7334
|
for (let I = 0; I < o.length; I++) {
|
|
7296
7335
|
let D = o[I];
|
|
7297
7336
|
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));
|
|
7298
|
-
const w = (
|
|
7337
|
+
const w = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
|
|
7299
7338
|
if (typeof w != "object")
|
|
7300
7339
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7301
|
-
$ = $ && (k ||
|
|
7340
|
+
$ = $ && (k || g(D)), y(w, I);
|
|
7302
7341
|
}
|
|
7303
7342
|
if (!$)
|
|
7304
7343
|
throw new Error(`discriminator: "${c}" must be required`);
|
|
7305
|
-
return
|
|
7306
|
-
function
|
|
7344
|
+
return S;
|
|
7345
|
+
function g({ required: I }) {
|
|
7307
7346
|
return Array.isArray(I) && I.includes(c);
|
|
7308
7347
|
}
|
|
7309
7348
|
function y(I, D) {
|
|
@@ -7316,9 +7355,9 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7316
7355
|
throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`);
|
|
7317
7356
|
}
|
|
7318
7357
|
function P(I, D) {
|
|
7319
|
-
if (typeof I != "string" || I in
|
|
7358
|
+
if (typeof I != "string" || I in S)
|
|
7320
7359
|
throw new Error(`discriminator: "${c}" values must be unique strings`);
|
|
7321
|
-
|
|
7360
|
+
S[I] = D;
|
|
7322
7361
|
}
|
|
7323
7362
|
}
|
|
7324
7363
|
}
|
|
@@ -7570,13 +7609,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7570
7609
|
const r = core$2, n = draft7, s = discriminator, i = require$$3, o = ["/properties"], c = "http://json-schema.org/draft-07/schema";
|
|
7571
7610
|
class d extends r.default {
|
|
7572
7611
|
_addVocabularies() {
|
|
7573
|
-
super._addVocabularies(), n.default.forEach((
|
|
7612
|
+
super._addVocabularies(), n.default.forEach((S) => this.addVocabulary(S)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7574
7613
|
}
|
|
7575
7614
|
_addDefaultMetaSchema() {
|
|
7576
7615
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7577
7616
|
return;
|
|
7578
|
-
const
|
|
7579
|
-
this.addMetaSchema(
|
|
7617
|
+
const S = this.opts.$data ? this.$dataMetaSchema(i, o) : i;
|
|
7618
|
+
this.addMetaSchema(S, c, !1), this.refs["http://json-schema.org/schema"] = c;
|
|
7580
7619
|
}
|
|
7581
7620
|
defaultMeta() {
|
|
7582
7621
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(c) ? c : void 0);
|
|
@@ -7601,9 +7640,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7601
7640
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7602
7641
|
return p.CodeGen;
|
|
7603
7642
|
} });
|
|
7604
|
-
var
|
|
7643
|
+
var _ = validation_error;
|
|
7605
7644
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7606
|
-
return
|
|
7645
|
+
return _.default;
|
|
7607
7646
|
} });
|
|
7608
7647
|
var T = ref_error;
|
|
7609
7648
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -8217,36 +8256,6 @@ for existing apps using this option.`
|
|
|
8217
8256
|
"step"
|
|
8218
8257
|
]
|
|
8219
8258
|
},
|
|
8220
|
-
{
|
|
8221
|
-
type: "object",
|
|
8222
|
-
additionalProperties: !1,
|
|
8223
|
-
properties: {
|
|
8224
|
-
progress: {
|
|
8225
|
-
type: "object",
|
|
8226
|
-
properties: {
|
|
8227
|
-
weight: {
|
|
8228
|
-
type: "number"
|
|
8229
|
-
},
|
|
8230
|
-
caption: {
|
|
8231
|
-
type: "string"
|
|
8232
|
-
}
|
|
8233
|
-
},
|
|
8234
|
-
additionalProperties: !1
|
|
8235
|
-
},
|
|
8236
|
-
step: {
|
|
8237
|
-
type: "string",
|
|
8238
|
-
const: "importFile"
|
|
8239
|
-
},
|
|
8240
|
-
file: {
|
|
8241
|
-
$ref: "#/definitions/FileReference",
|
|
8242
|
-
description: "The file to import"
|
|
8243
|
-
}
|
|
8244
|
-
},
|
|
8245
|
-
required: [
|
|
8246
|
-
"file",
|
|
8247
|
-
"step"
|
|
8248
|
-
]
|
|
8249
|
-
},
|
|
8250
8259
|
{
|
|
8251
8260
|
type: "object",
|
|
8252
8261
|
additionalProperties: !1,
|
|
@@ -8297,6 +8306,15 @@ for existing apps using this option.`
|
|
|
8297
8306
|
},
|
|
8298
8307
|
additionalProperties: !1
|
|
8299
8308
|
},
|
|
8309
|
+
ifAlreadyInstalled: {
|
|
8310
|
+
type: "string",
|
|
8311
|
+
enum: [
|
|
8312
|
+
"overwrite",
|
|
8313
|
+
"skip",
|
|
8314
|
+
"error"
|
|
8315
|
+
],
|
|
8316
|
+
description: "What to do if the asset already exists."
|
|
8317
|
+
},
|
|
8300
8318
|
step: {
|
|
8301
8319
|
type: "string",
|
|
8302
8320
|
const: "installPlugin",
|
|
@@ -8332,6 +8350,15 @@ for existing apps using this option.`
|
|
|
8332
8350
|
},
|
|
8333
8351
|
additionalProperties: !1
|
|
8334
8352
|
},
|
|
8353
|
+
ifAlreadyInstalled: {
|
|
8354
|
+
type: "string",
|
|
8355
|
+
enum: [
|
|
8356
|
+
"overwrite",
|
|
8357
|
+
"skip",
|
|
8358
|
+
"error"
|
|
8359
|
+
],
|
|
8360
|
+
description: "What to do if the asset already exists."
|
|
8361
|
+
},
|
|
8335
8362
|
step: {
|
|
8336
8363
|
type: "string",
|
|
8337
8364
|
const: "installTheme",
|
|
@@ -9221,7 +9248,7 @@ function compileBlueprint(e, {
|
|
|
9221
9248
|
onStepCompleted: n = () => {
|
|
9222
9249
|
}
|
|
9223
9250
|
} = {}) {
|
|
9224
|
-
var
|
|
9251
|
+
var _, T, C, S, k, $, g;
|
|
9225
9252
|
e = {
|
|
9226
9253
|
...e,
|
|
9227
9254
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9253,7 +9280,7 @@ function compileBlueprint(e, {
|
|
|
9253
9280
|
step: "login",
|
|
9254
9281
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9255
9282
|
}), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.length === 0 && e.phpExtensionBundles.push("kitchen-sink");
|
|
9256
|
-
const s = (
|
|
9283
|
+
const s = (_ = e.steps) == null ? void 0 : _.findIndex(
|
|
9257
9284
|
(y) => typeof y == "object" && (y == null ? void 0 : y.step) === "wp-cli"
|
|
9258
9285
|
);
|
|
9259
9286
|
s !== void 0 && s > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
@@ -9278,14 +9305,14 @@ function compileBlueprint(e, {
|
|
|
9278
9305
|
},
|
|
9279
9306
|
path: "/tmp/wp-cli.phar"
|
|
9280
9307
|
}));
|
|
9281
|
-
const i = (
|
|
9308
|
+
const i = (C = e.steps) == null ? void 0 : C.findIndex(
|
|
9282
9309
|
(y) => typeof y == "object" && (y == null ? void 0 : y.step) === "importWxr"
|
|
9283
9310
|
);
|
|
9284
9311
|
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9285
9312
|
(y) => y !== "light"
|
|
9286
9313
|
), console.warn(
|
|
9287
9314
|
"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. "
|
|
9288
|
-
)), (
|
|
9315
|
+
)), (S = e.steps) == null || S.splice(i, 0, {
|
|
9289
9316
|
step: "installPlugin",
|
|
9290
9317
|
pluginZipFile: {
|
|
9291
9318
|
resource: "url",
|
|
@@ -9328,7 +9355,7 @@ function compileBlueprint(e, {
|
|
|
9328
9355
|
),
|
|
9329
9356
|
features: {
|
|
9330
9357
|
// Disable networking by default
|
|
9331
|
-
networking: ((
|
|
9358
|
+
networking: ((g = e.features) == null ? void 0 : g.networking) ?? !1
|
|
9332
9359
|
},
|
|
9333
9360
|
run: async (y) => {
|
|
9334
9361
|
try {
|
|
@@ -9401,17 +9428,17 @@ function compileStep(e, {
|
|
|
9401
9428
|
const s = r.stage(
|
|
9402
9429
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9403
9430
|
), i = {};
|
|
9404
|
-
for (const
|
|
9405
|
-
let T = e[
|
|
9431
|
+
for (const _ of Object.keys(e)) {
|
|
9432
|
+
let T = e[_];
|
|
9406
9433
|
isFileReference(T) && (T = Resource.create(T, {
|
|
9407
9434
|
semaphore: t
|
|
9408
|
-
})), i[
|
|
9435
|
+
})), i[_] = T;
|
|
9409
9436
|
}
|
|
9410
|
-
const o = async (
|
|
9437
|
+
const o = async (_) => {
|
|
9411
9438
|
var T;
|
|
9412
9439
|
try {
|
|
9413
9440
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9414
|
-
|
|
9441
|
+
_,
|
|
9415
9442
|
await resolveArguments(i),
|
|
9416
9443
|
{
|
|
9417
9444
|
tracker: s,
|
|
@@ -9422,10 +9449,10 @@ function compileStep(e, {
|
|
|
9422
9449
|
s.finish();
|
|
9423
9450
|
}
|
|
9424
9451
|
}, c = getResources(i), d = getResources(i).filter(
|
|
9425
|
-
(
|
|
9452
|
+
(_) => _.isAsync
|
|
9426
9453
|
), u = 1 / (d.length + 1);
|
|
9427
|
-
for (const
|
|
9428
|
-
|
|
9454
|
+
for (const _ of d)
|
|
9455
|
+
_.progress = s.stage(u);
|
|
9429
9456
|
return { run: o, step: e, resources: c };
|
|
9430
9457
|
}
|
|
9431
9458
|
function getResources(e) {
|
|
@@ -9500,27 +9527,27 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9500
9527
|
const { id: i, type: o, path: c } = Object.assign({ path: [] }, s.data), d = (s.data.argumentList || []).map(fromWireValue);
|
|
9501
9528
|
let u;
|
|
9502
9529
|
try {
|
|
9503
|
-
const p = c.slice(0, -1).reduce((T,
|
|
9530
|
+
const p = c.slice(0, -1).reduce((T, C) => T[C], e), _ = c.reduce((T, C) => T[C], e);
|
|
9504
9531
|
switch (o) {
|
|
9505
9532
|
case "GET":
|
|
9506
|
-
u =
|
|
9533
|
+
u = _;
|
|
9507
9534
|
break;
|
|
9508
9535
|
case "SET":
|
|
9509
9536
|
p[c.slice(-1)[0]] = fromWireValue(s.data.value), u = !0;
|
|
9510
9537
|
break;
|
|
9511
9538
|
case "APPLY":
|
|
9512
|
-
u =
|
|
9539
|
+
u = _.apply(p, d);
|
|
9513
9540
|
break;
|
|
9514
9541
|
case "CONSTRUCT":
|
|
9515
9542
|
{
|
|
9516
|
-
const T = new
|
|
9543
|
+
const T = new _(...d);
|
|
9517
9544
|
u = proxy(T);
|
|
9518
9545
|
}
|
|
9519
9546
|
break;
|
|
9520
9547
|
case "ENDPOINT":
|
|
9521
9548
|
{
|
|
9522
|
-
const { port1: T, port2:
|
|
9523
|
-
expose(e,
|
|
9549
|
+
const { port1: T, port2: C } = new MessageChannel();
|
|
9550
|
+
expose(e, C), u = transfer(T, [T]);
|
|
9524
9551
|
}
|
|
9525
9552
|
break;
|
|
9526
9553
|
case "RELEASE":
|
|
@@ -9533,14 +9560,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9533
9560
|
u = { value: p, [throwMarker]: 0 };
|
|
9534
9561
|
}
|
|
9535
9562
|
Promise.resolve(u).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
9536
|
-
const [
|
|
9537
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9563
|
+
const [_, T] = toWireValue(p);
|
|
9564
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: i }), T), o === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9538
9565
|
}).catch((p) => {
|
|
9539
|
-
const [
|
|
9566
|
+
const [_, T] = toWireValue({
|
|
9540
9567
|
value: new TypeError("Unserializable return value"),
|
|
9541
9568
|
[throwMarker]: 0
|
|
9542
9569
|
});
|
|
9543
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9570
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: i }), T);
|
|
9544
9571
|
});
|
|
9545
9572
|
}), t.start && t.start();
|
|
9546
9573
|
}
|
|
@@ -9616,7 +9643,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9616
9643
|
const [u, p] = processArguments(c);
|
|
9617
9644
|
return requestResponseMessage(e, {
|
|
9618
9645
|
type: "APPLY",
|
|
9619
|
-
path: t.map((
|
|
9646
|
+
path: t.map((_) => _.toString()),
|
|
9620
9647
|
argumentList: u
|
|
9621
9648
|
}, p).then(fromWireValue);
|
|
9622
9649
|
},
|
|
@@ -9714,34 +9741,41 @@ async function runWithTimeout(e, t) {
|
|
|
9714
9741
|
}
|
|
9715
9742
|
let isTransferHandlersSetup = !1;
|
|
9716
9743
|
function setupTransferHandlers() {
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9744
|
+
if (isTransferHandlersSetup)
|
|
9745
|
+
return;
|
|
9746
|
+
isTransferHandlersSetup = !0, transferHandlers.set("EVENT", {
|
|
9747
|
+
canHandle: (r) => r instanceof CustomEvent,
|
|
9748
|
+
serialize: (r) => [
|
|
9720
9749
|
{
|
|
9721
|
-
detail:
|
|
9750
|
+
detail: r.detail
|
|
9722
9751
|
},
|
|
9723
9752
|
[]
|
|
9724
9753
|
],
|
|
9725
|
-
deserialize: (
|
|
9754
|
+
deserialize: (r) => r
|
|
9726
9755
|
}), transferHandlers.set("FUNCTION", {
|
|
9727
|
-
canHandle: (
|
|
9728
|
-
serialize(
|
|
9756
|
+
canHandle: (r) => typeof r == "function",
|
|
9757
|
+
serialize(r) {
|
|
9729
9758
|
console.debug("[Comlink][Performance] Proxying a function");
|
|
9730
|
-
const { port1:
|
|
9731
|
-
return expose(
|
|
9759
|
+
const { port1: n, port2: s } = new MessageChannel();
|
|
9760
|
+
return expose(r, n), [s, [s]];
|
|
9732
9761
|
},
|
|
9733
|
-
deserialize(
|
|
9734
|
-
return
|
|
9762
|
+
deserialize(r) {
|
|
9763
|
+
return r.start(), wrap(r);
|
|
9735
9764
|
}
|
|
9736
9765
|
}), transferHandlers.set("PHPResponse", {
|
|
9737
|
-
canHandle: (
|
|
9738
|
-
serialize(
|
|
9739
|
-
return [
|
|
9766
|
+
canHandle: (r) => typeof r == "object" && r !== null && "headers" in r && "bytes" in r && "errors" in r && "exitCode" in r && "httpStatusCode" in r,
|
|
9767
|
+
serialize(r) {
|
|
9768
|
+
return [r.toRawData(), []];
|
|
9740
9769
|
},
|
|
9741
|
-
deserialize(
|
|
9742
|
-
return PHPResponse.fromRawData(
|
|
9770
|
+
deserialize(r) {
|
|
9771
|
+
return PHPResponse.fromRawData(r);
|
|
9743
9772
|
}
|
|
9744
|
-
})
|
|
9773
|
+
});
|
|
9774
|
+
const e = transferHandlers.get("throw"), t = e == null ? void 0 : e.serialize;
|
|
9775
|
+
e.serialize = ({ value: r }) => {
|
|
9776
|
+
const n = t({ value: r });
|
|
9777
|
+
return r.response && (n[0].value.response = r.response), r.source && (n[0].value.source = r.source), n;
|
|
9778
|
+
};
|
|
9745
9779
|
}
|
|
9746
9780
|
function proxyClone(e) {
|
|
9747
9781
|
return new Proxy(e, {
|