@wp-playground/blueprints 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/blueprint-schema.json +10 -27
- package/index.cjs +16 -16
- package/index.d.ts +27 -11
- package/index.js +469 -442
- package/lib/steps/define-site-url.d.ts +6 -9
- package/lib/steps/install-asset.d.ts +5 -1
- package/lib/steps/install-plugin.d.ts +2 -1
- package/lib/steps/install-theme.d.ts +2 -1
- 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";
|
|
@@ -872,9 +872,9 @@ echo json_encode($deactivated_plugins);
|
|
|
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) {
|
|
@@ -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"), l = joinPaths(o, randomString()), d = joinPaths(l, "assets", i);
|
|
1104
|
+
await e.fileExists(d) && await e.rmdir(l, {
|
|
1101
1105
|
recursive: !0
|
|
1102
|
-
}), await e.mkdir(
|
|
1106
|
+
}), await e.mkdir(l);
|
|
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 $, O = "";
|
|
1118
|
+
p ? (O = u[0], $ = u[0].split("/").pop()) : (O = 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(O, C), {
|
|
1141
|
+
assetFolderPath: C,
|
|
1142
|
+
assetFolderName: $
|
|
1119
1143
|
};
|
|
1120
1144
|
} finally {
|
|
1121
|
-
await e.rmdir(
|
|
1145
|
+
await e.rmdir(l, {
|
|
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: l } = 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: l,
|
|
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, xt).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, $t, Bt).call(this, r.pathname);
|
|
2010
|
+
d = ce(this, $t, 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: l,
|
|
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
|
}
|
|
@@ -2180,6 +2216,11 @@ 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");
|
|
2219
|
+
class PHPExecutionFailureError extends Error {
|
|
2220
|
+
constructor(t, r, n) {
|
|
2221
|
+
super(t), this.response = r, this.source = n;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2183
2224
|
var Me, Ze, Ye, be, Re, Te, Ee, Xe, gt, Gt, yt, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2184
2225
|
class BasePHP {
|
|
2185
2226
|
/**
|
|
@@ -2327,15 +2368,13 @@ class BasePHP {
|
|
|
2327
2368
|
ce(this, Tt, rr).call(this, l, i[l]);
|
|
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 l = 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(l), l;
|
|
2339
2378
|
}
|
|
2340
2379
|
return o;
|
|
2341
2380
|
} catch (n) {
|
|
@@ -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, yt, 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"),
|
|
@@ -3008,10 +3047,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3008
3047
|
e._ = s;
|
|
3009
3048
|
const i = new n("+");
|
|
3010
3049
|
function o(_, ...g) {
|
|
3011
|
-
const P = [
|
|
3050
|
+
const P = [C(_[0])];
|
|
3012
3051
|
let I = 0;
|
|
3013
3052
|
for (; I < g.length; )
|
|
3014
|
-
P.push(i), l(P, g[I]), P.push(i,
|
|
3053
|
+
P.push(i), l(P, g[I]), P.push(i, C(_[++I]));
|
|
3015
3054
|
return d(P), new n(P);
|
|
3016
3055
|
}
|
|
3017
3056
|
e.str = o;
|
|
@@ -3048,20 +3087,20 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3048
3087
|
}
|
|
3049
3088
|
e.strConcat = p;
|
|
3050
3089
|
function $(_) {
|
|
3051
|
-
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ :
|
|
3090
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : C(Array.isArray(_) ? _.join(",") : _);
|
|
3052
3091
|
}
|
|
3053
3092
|
function O(_) {
|
|
3054
|
-
return new n(
|
|
3093
|
+
return new n(C(_));
|
|
3055
3094
|
}
|
|
3056
3095
|
e.stringify = O;
|
|
3057
|
-
function
|
|
3096
|
+
function C(_) {
|
|
3058
3097
|
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3059
3098
|
}
|
|
3060
|
-
e.safeStringify =
|
|
3061
|
-
function
|
|
3099
|
+
e.safeStringify = C;
|
|
3100
|
+
function S(_) {
|
|
3062
3101
|
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3063
3102
|
}
|
|
3064
|
-
e.getProperty =
|
|
3103
|
+
e.getProperty = S;
|
|
3065
3104
|
function T(_) {
|
|
3066
3105
|
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3067
3106
|
return new n(`${_}`);
|
|
@@ -3136,17 +3175,17 @@ var scope = {};
|
|
|
3136
3175
|
var $;
|
|
3137
3176
|
if (p.ref === void 0)
|
|
3138
3177
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3139
|
-
const O = this.toName(u), { prefix:
|
|
3140
|
-
let T = this._values[
|
|
3178
|
+
const O = this.toName(u), { prefix: C } = O, S = ($ = p.key) !== null && $ !== void 0 ? $ : p.ref;
|
|
3179
|
+
let T = this._values[C];
|
|
3141
3180
|
if (T) {
|
|
3142
|
-
const g = T.get(
|
|
3181
|
+
const g = T.get(S);
|
|
3143
3182
|
if (g)
|
|
3144
3183
|
return g;
|
|
3145
3184
|
} else
|
|
3146
|
-
T = this._values[
|
|
3147
|
-
T.set(
|
|
3148
|
-
const y = this._scope[
|
|
3149
|
-
return y[_] = p.ref, O.setValue(p, { property:
|
|
3185
|
+
T = this._values[C] = /* @__PURE__ */ new Map();
|
|
3186
|
+
T.set(S, O);
|
|
3187
|
+
const y = this._scope[C] || (this._scope[C] = []), _ = y.length;
|
|
3188
|
+
return y[_] = p.ref, O.setValue(p, { property: C, itemIndex: _ }), O;
|
|
3150
3189
|
}
|
|
3151
3190
|
getValue(u, p) {
|
|
3152
3191
|
const $ = this._values[u];
|
|
@@ -3168,12 +3207,12 @@ var scope = {};
|
|
|
3168
3207
|
}, p, $);
|
|
3169
3208
|
}
|
|
3170
3209
|
_reduceValues(u, p, $ = {}, O) {
|
|
3171
|
-
let
|
|
3172
|
-
for (const
|
|
3173
|
-
const T = u[
|
|
3210
|
+
let C = t.nil;
|
|
3211
|
+
for (const S in u) {
|
|
3212
|
+
const T = u[S];
|
|
3174
3213
|
if (!T)
|
|
3175
3214
|
continue;
|
|
3176
|
-
const y = $[
|
|
3215
|
+
const y = $[S] = $[S] || /* @__PURE__ */ new Map();
|
|
3177
3216
|
T.forEach((_) => {
|
|
3178
3217
|
if (y.has(_))
|
|
3179
3218
|
return;
|
|
@@ -3181,15 +3220,15 @@ var scope = {};
|
|
|
3181
3220
|
let g = p(_);
|
|
3182
3221
|
if (g) {
|
|
3183
3222
|
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3184
|
-
|
|
3223
|
+
C = (0, t._)`${C}${P} ${_} = ${g};${this.opts._n}`;
|
|
3185
3224
|
} else if (g = O == null ? void 0 : O(_))
|
|
3186
|
-
|
|
3225
|
+
C = (0, t._)`${C}${g}${this.opts._n}`;
|
|
3187
3226
|
else
|
|
3188
3227
|
throw new r(_);
|
|
3189
3228
|
y.set(_, n.Completed);
|
|
3190
3229
|
});
|
|
3191
3230
|
}
|
|
3192
|
-
return
|
|
3231
|
+
return C;
|
|
3193
3232
|
}
|
|
3194
3233
|
}
|
|
3195
3234
|
e.ValueScope = l;
|
|
@@ -3245,12 +3284,12 @@ var scope = {};
|
|
|
3245
3284
|
}
|
|
3246
3285
|
}
|
|
3247
3286
|
class o extends i {
|
|
3248
|
-
constructor(a, h,
|
|
3249
|
-
super(), this.varKind = a, this.name = h, this.rhs =
|
|
3287
|
+
constructor(a, h, N) {
|
|
3288
|
+
super(), this.varKind = a, this.name = h, this.rhs = N;
|
|
3250
3289
|
}
|
|
3251
3290
|
render({ es5: a, _n: h }) {
|
|
3252
|
-
const
|
|
3253
|
-
return `${
|
|
3291
|
+
const N = a ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3292
|
+
return `${N} ${this.name}${M};` + h;
|
|
3254
3293
|
}
|
|
3255
3294
|
optimizeNames(a, h) {
|
|
3256
3295
|
if (a[this.name.str])
|
|
@@ -3261,8 +3300,8 @@ var scope = {};
|
|
|
3261
3300
|
}
|
|
3262
3301
|
}
|
|
3263
3302
|
class l extends i {
|
|
3264
|
-
constructor(a, h,
|
|
3265
|
-
super(), this.lhs = a, this.rhs = h, this.sideEffects =
|
|
3303
|
+
constructor(a, h, N) {
|
|
3304
|
+
super(), this.lhs = a, this.rhs = h, this.sideEffects = N;
|
|
3266
3305
|
}
|
|
3267
3306
|
render({ _n: a }) {
|
|
3268
3307
|
return `${this.lhs} = ${this.rhs};` + a;
|
|
@@ -3277,8 +3316,8 @@ var scope = {};
|
|
|
3277
3316
|
}
|
|
3278
3317
|
}
|
|
3279
3318
|
class d extends l {
|
|
3280
|
-
constructor(a, h,
|
|
3281
|
-
super(a,
|
|
3319
|
+
constructor(a, h, N, M) {
|
|
3320
|
+
super(a, N, M), this.op = h;
|
|
3282
3321
|
}
|
|
3283
3322
|
render({ _n: a }) {
|
|
3284
3323
|
return `${this.lhs} ${this.op}= ${this.rhs};` + a;
|
|
@@ -3328,46 +3367,46 @@ 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
|
}
|
|
3335
3374
|
render(a) {
|
|
3336
|
-
return this.nodes.reduce((h,
|
|
3375
|
+
return this.nodes.reduce((h, N) => h + N.render(a), "");
|
|
3337
3376
|
}
|
|
3338
3377
|
optimizeNodes() {
|
|
3339
3378
|
const { nodes: a } = this;
|
|
3340
3379
|
let h = a.length;
|
|
3341
3380
|
for (; h--; ) {
|
|
3342
|
-
const
|
|
3343
|
-
Array.isArray(
|
|
3381
|
+
const N = a[h].optimizeNodes();
|
|
3382
|
+
Array.isArray(N) ? a.splice(h, 1, ...N) : N ? a[h] = N : a.splice(h, 1);
|
|
3344
3383
|
}
|
|
3345
3384
|
return a.length > 0 ? this : void 0;
|
|
3346
3385
|
}
|
|
3347
3386
|
optimizeNames(a, h) {
|
|
3348
|
-
const { nodes:
|
|
3349
|
-
let M =
|
|
3387
|
+
const { nodes: N } = this;
|
|
3388
|
+
let M = N.length;
|
|
3350
3389
|
for (; M--; ) {
|
|
3351
|
-
const q =
|
|
3352
|
-
q.optimizeNames(a, h) || (ke(a, q.names),
|
|
3390
|
+
const q = N[M];
|
|
3391
|
+
q.optimizeNames(a, h) || (ke(a, q.names), N.splice(M, 1));
|
|
3353
3392
|
}
|
|
3354
|
-
return
|
|
3393
|
+
return N.length > 0 ? this : void 0;
|
|
3355
3394
|
}
|
|
3356
3395
|
get names() {
|
|
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 T extends
|
|
3404
|
+
class T extends C {
|
|
3366
3405
|
}
|
|
3367
|
-
class y extends
|
|
3406
|
+
class y extends S {
|
|
3368
3407
|
}
|
|
3369
3408
|
y.kind = "else";
|
|
3370
|
-
class _ extends
|
|
3409
|
+
class _ extends S {
|
|
3371
3410
|
constructor(a, h) {
|
|
3372
3411
|
super(h), this.condition = a;
|
|
3373
3412
|
}
|
|
@@ -3382,8 +3421,8 @@ var scope = {};
|
|
|
3382
3421
|
return this.nodes;
|
|
3383
3422
|
let h = this.else;
|
|
3384
3423
|
if (h) {
|
|
3385
|
-
const
|
|
3386
|
-
h = this.else = Array.isArray(
|
|
3424
|
+
const N = h.optimizeNodes();
|
|
3425
|
+
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3387
3426
|
}
|
|
3388
3427
|
if (h)
|
|
3389
3428
|
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(a), h instanceof _ ? [h] : h.nodes);
|
|
@@ -3391,8 +3430,8 @@ var scope = {};
|
|
|
3391
3430
|
return this;
|
|
3392
3431
|
}
|
|
3393
3432
|
optimizeNames(a, h) {
|
|
3394
|
-
var
|
|
3395
|
-
if (this.else = (
|
|
3433
|
+
var N;
|
|
3434
|
+
if (this.else = (N = this.else) === null || N === void 0 ? void 0 : N.optimizeNames(a, h), !!(super.optimizeNames(a, h) || this.else))
|
|
3396
3435
|
return this.condition = oe(this.condition, a, h), this;
|
|
3397
3436
|
}
|
|
3398
3437
|
get names() {
|
|
@@ -3401,7 +3440,7 @@ var scope = {};
|
|
|
3401
3440
|
}
|
|
3402
3441
|
}
|
|
3403
3442
|
_.kind = "if";
|
|
3404
|
-
class g extends
|
|
3443
|
+
class g extends S {
|
|
3405
3444
|
}
|
|
3406
3445
|
g.kind = "for";
|
|
3407
3446
|
class P extends g {
|
|
@@ -3420,12 +3459,12 @@ var scope = {};
|
|
|
3420
3459
|
}
|
|
3421
3460
|
}
|
|
3422
3461
|
class I extends g {
|
|
3423
|
-
constructor(a, h,
|
|
3424
|
-
super(), this.varKind = a, this.name = h, this.from =
|
|
3462
|
+
constructor(a, h, N, M) {
|
|
3463
|
+
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3425
3464
|
}
|
|
3426
3465
|
render(a) {
|
|
3427
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name:
|
|
3428
|
-
return `for(${h} ${
|
|
3466
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3467
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(a);
|
|
3429
3468
|
}
|
|
3430
3469
|
get names() {
|
|
3431
3470
|
const a = ue(super.names, this.from);
|
|
@@ -3433,8 +3472,8 @@ var scope = {};
|
|
|
3433
3472
|
}
|
|
3434
3473
|
}
|
|
3435
3474
|
class D extends g {
|
|
3436
|
-
constructor(a, h,
|
|
3437
|
-
super(), this.loop = a, this.varKind = h, this.name =
|
|
3475
|
+
constructor(a, h, N, M) {
|
|
3476
|
+
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3438
3477
|
}
|
|
3439
3478
|
render(a) {
|
|
3440
3479
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(a);
|
|
@@ -3447,22 +3486,22 @@ var scope = {};
|
|
|
3447
3486
|
return K(super.names, this.iterable.names);
|
|
3448
3487
|
}
|
|
3449
3488
|
}
|
|
3450
|
-
class w extends
|
|
3451
|
-
constructor(a, h,
|
|
3452
|
-
super(), this.name = a, this.args = h, this.async =
|
|
3489
|
+
class w extends S {
|
|
3490
|
+
constructor(a, h, N) {
|
|
3491
|
+
super(), this.name = a, this.args = h, this.async = N;
|
|
3453
3492
|
}
|
|
3454
3493
|
render(a) {
|
|
3455
3494
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
3456
3495
|
}
|
|
3457
3496
|
}
|
|
3458
3497
|
w.kind = "func";
|
|
3459
|
-
class k extends
|
|
3498
|
+
class k extends C {
|
|
3460
3499
|
render(a) {
|
|
3461
3500
|
return "return " + super.render(a);
|
|
3462
3501
|
}
|
|
3463
3502
|
}
|
|
3464
3503
|
k.kind = "return";
|
|
3465
|
-
class A extends
|
|
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;
|
|
@@ -3472,15 +3511,15 @@ var scope = {};
|
|
|
3472
3511
|
return super.optimizeNodes(), (a = this.catch) === null || a === void 0 || a.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3473
3512
|
}
|
|
3474
3513
|
optimizeNames(a, h) {
|
|
3475
|
-
var
|
|
3476
|
-
return super.optimizeNames(a, h), (
|
|
3514
|
+
var N, M;
|
|
3515
|
+
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(a, h), this;
|
|
3477
3516
|
}
|
|
3478
3517
|
get names() {
|
|
3479
3518
|
const a = super.names;
|
|
3480
3519
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3481
3520
|
}
|
|
3482
3521
|
}
|
|
3483
|
-
class V extends
|
|
3522
|
+
class V 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
|
V.kind = "catch";
|
|
3492
|
-
class x extends
|
|
3531
|
+
class x extends S {
|
|
3493
3532
|
render(a) {
|
|
3494
3533
|
return "finally" + super.render(a);
|
|
3495
3534
|
}
|
|
@@ -3513,8 +3552,8 @@ var scope = {};
|
|
|
3513
3552
|
}
|
|
3514
3553
|
// reserves unique name in the external scope and assigns value to it
|
|
3515
3554
|
scopeValue(a, h) {
|
|
3516
|
-
const
|
|
3517
|
-
return (this._values[
|
|
3555
|
+
const N = this._extScope.value(a, h);
|
|
3556
|
+
return (this._values[N.prefix] || (this._values[N.prefix] = /* @__PURE__ */ new Set())).add(N), N;
|
|
3518
3557
|
}
|
|
3519
3558
|
getScopeValue(a, h) {
|
|
3520
3559
|
return this._extScope.getValue(a, h);
|
|
@@ -3527,25 +3566,25 @@ var scope = {};
|
|
|
3527
3566
|
scopeCode() {
|
|
3528
3567
|
return this._extScope.scopeCode(this._values);
|
|
3529
3568
|
}
|
|
3530
|
-
_def(a, h,
|
|
3569
|
+
_def(a, h, N, M) {
|
|
3531
3570
|
const q = this._scope.toName(h);
|
|
3532
|
-
return
|
|
3571
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new o(a, q, N)), q;
|
|
3533
3572
|
}
|
|
3534
3573
|
// `const` declaration (`var` in es5 mode)
|
|
3535
|
-
const(a, h,
|
|
3536
|
-
return this._def(r.varKinds.const, a, h,
|
|
3574
|
+
const(a, h, N) {
|
|
3575
|
+
return this._def(r.varKinds.const, a, h, N);
|
|
3537
3576
|
}
|
|
3538
3577
|
// `let` declaration with optional assignment (`var` in es5 mode)
|
|
3539
|
-
let(a, h,
|
|
3540
|
-
return this._def(r.varKinds.let, a, h,
|
|
3578
|
+
let(a, h, N) {
|
|
3579
|
+
return this._def(r.varKinds.let, a, h, N);
|
|
3541
3580
|
}
|
|
3542
3581
|
// `var` declaration with optional assignment
|
|
3543
|
-
var(a, h,
|
|
3544
|
-
return this._def(r.varKinds.var, a, h,
|
|
3582
|
+
var(a, h, N) {
|
|
3583
|
+
return this._def(r.varKinds.var, a, h, N);
|
|
3545
3584
|
}
|
|
3546
3585
|
// assignment code
|
|
3547
|
-
assign(a, h,
|
|
3548
|
-
return this._leafNode(new l(a, h,
|
|
3586
|
+
assign(a, h, N) {
|
|
3587
|
+
return this._leafNode(new l(a, h, N));
|
|
3549
3588
|
}
|
|
3550
3589
|
// `+=` code
|
|
3551
3590
|
add(a, h) {
|
|
@@ -3558,17 +3597,17 @@ var scope = {};
|
|
|
3558
3597
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3559
3598
|
object(...a) {
|
|
3560
3599
|
const h = ["{"];
|
|
3561
|
-
for (const [
|
|
3562
|
-
h.length > 1 && h.push(","), h.push(
|
|
3600
|
+
for (const [N, M] of a)
|
|
3601
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3563
3602
|
return h.push("}"), new t._Code(h);
|
|
3564
3603
|
}
|
|
3565
3604
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3566
|
-
if(a, h,
|
|
3567
|
-
if (this._blockNode(new _(a)), h &&
|
|
3568
|
-
this.code(h).else().code(
|
|
3605
|
+
if(a, h, N) {
|
|
3606
|
+
if (this._blockNode(new _(a)), h && N)
|
|
3607
|
+
this.code(h).else().code(N).endIf();
|
|
3569
3608
|
else if (h)
|
|
3570
3609
|
this.code(h).endIf();
|
|
3571
|
-
else if (
|
|
3610
|
+
else if (N)
|
|
3572
3611
|
throw new Error('CodeGen: "else" body without "then" body');
|
|
3573
3612
|
return this;
|
|
3574
3613
|
}
|
|
@@ -3592,28 +3631,28 @@ var scope = {};
|
|
|
3592
3631
|
return this._for(new P(a), h);
|
|
3593
3632
|
}
|
|
3594
3633
|
// `for` statement for a range of values
|
|
3595
|
-
forRange(a, h,
|
|
3634
|
+
forRange(a, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3596
3635
|
const W = this._scope.toName(a);
|
|
3597
|
-
return this._for(new I(q, W, h,
|
|
3636
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3598
3637
|
}
|
|
3599
3638
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3600
|
-
forOf(a, h,
|
|
3639
|
+
forOf(a, h, N, M = r.varKinds.const) {
|
|
3601
3640
|
const q = this._scope.toName(a);
|
|
3602
3641
|
if (this.opts.es5) {
|
|
3603
3642
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3604
3643
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3605
|
-
this.var(q, (0, t._)`${W}[${G}]`),
|
|
3644
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
3606
3645
|
});
|
|
3607
3646
|
}
|
|
3608
|
-
return this._for(new D("of", M, q, h), () =>
|
|
3647
|
+
return this._for(new D("of", M, q, h), () => N(q));
|
|
3609
3648
|
}
|
|
3610
3649
|
// `for-in` statement.
|
|
3611
3650
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3612
|
-
forIn(a, h,
|
|
3651
|
+
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3613
3652
|
if (this.opts.ownProperties)
|
|
3614
|
-
return this.forOf(a, (0, t._)`Object.keys(${h})`,
|
|
3653
|
+
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
3615
3654
|
const q = this._scope.toName(a);
|
|
3616
|
-
return this._for(new D("in", M, q, h), () =>
|
|
3655
|
+
return this._for(new D("in", M, q, h), () => N(q));
|
|
3617
3656
|
}
|
|
3618
3657
|
// end `for` loop
|
|
3619
3658
|
endFor() {
|
|
@@ -3635,15 +3674,15 @@ var scope = {};
|
|
|
3635
3674
|
return this._endBlockNode(k);
|
|
3636
3675
|
}
|
|
3637
3676
|
// `try` statement
|
|
3638
|
-
try(a, h,
|
|
3639
|
-
if (!h && !
|
|
3677
|
+
try(a, h, N) {
|
|
3678
|
+
if (!h && !N)
|
|
3640
3679
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3641
3680
|
const M = new A();
|
|
3642
3681
|
if (this._blockNode(M), this.code(a), h) {
|
|
3643
3682
|
const q = this.name("e");
|
|
3644
3683
|
this._currNode = M.catch = new V(q), h(q);
|
|
3645
3684
|
}
|
|
3646
|
-
return
|
|
3685
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(V, x);
|
|
3647
3686
|
}
|
|
3648
3687
|
// `throw` statement
|
|
3649
3688
|
throw(a) {
|
|
@@ -3658,14 +3697,14 @@ var scope = {};
|
|
|
3658
3697
|
const h = this._blockStarts.pop();
|
|
3659
3698
|
if (h === void 0)
|
|
3660
3699
|
throw new Error("CodeGen: not in self-balancing block");
|
|
3661
|
-
const
|
|
3662
|
-
if (
|
|
3663
|
-
throw new Error(`CodeGen: wrong number of nodes: ${
|
|
3700
|
+
const N = this._nodes.length - h;
|
|
3701
|
+
if (N < 0 || a !== void 0 && N !== a)
|
|
3702
|
+
throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);
|
|
3664
3703
|
return this._nodes.length = h, this;
|
|
3665
3704
|
}
|
|
3666
3705
|
// `function` heading (or definition if funcBody is passed)
|
|
3667
|
-
func(a, h = t.nil,
|
|
3668
|
-
return this._blockNode(new w(a, h,
|
|
3706
|
+
func(a, h = t.nil, N, M) {
|
|
3707
|
+
return this._blockNode(new w(a, h, N)), M && this.code(M).endFunc(), this;
|
|
3669
3708
|
}
|
|
3670
3709
|
// end function definition
|
|
3671
3710
|
endFunc() {
|
|
@@ -3682,8 +3721,8 @@ var scope = {};
|
|
|
3682
3721
|
this._currNode.nodes.push(a), this._nodes.push(a);
|
|
3683
3722
|
}
|
|
3684
3723
|
_endBlockNode(a, h) {
|
|
3685
|
-
const
|
|
3686
|
-
if (
|
|
3724
|
+
const N = this._currNode;
|
|
3725
|
+
if (N instanceof a || h && N instanceof h)
|
|
3687
3726
|
return this._nodes.pop(), this;
|
|
3688
3727
|
throw new Error(`CodeGen: not in block "${h ? `${a.kind}/${h.kind}` : a.kind}"`);
|
|
3689
3728
|
}
|
|
@@ -3716,11 +3755,11 @@ var scope = {};
|
|
|
3716
3755
|
}
|
|
3717
3756
|
function oe(b, a, h) {
|
|
3718
3757
|
if (b instanceof t.Name)
|
|
3719
|
-
return
|
|
3758
|
+
return N(b);
|
|
3720
3759
|
if (!M(b))
|
|
3721
3760
|
return b;
|
|
3722
|
-
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W =
|
|
3723
|
-
function
|
|
3761
|
+
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3762
|
+
function N(q) {
|
|
3724
3763
|
const W = h[q.str];
|
|
3725
3764
|
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
3726
3765
|
}
|
|
@@ -3821,22 +3860,22 @@ var util = {};
|
|
|
3821
3860
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3822
3861
|
}
|
|
3823
3862
|
e.unescapeJsonPointer = O;
|
|
3824
|
-
function
|
|
3863
|
+
function C(w, k) {
|
|
3825
3864
|
if (Array.isArray(w))
|
|
3826
3865
|
for (const A of w)
|
|
3827
3866
|
k(A);
|
|
3828
3867
|
else
|
|
3829
3868
|
k(w);
|
|
3830
3869
|
}
|
|
3831
|
-
e.eachItem =
|
|
3832
|
-
function
|
|
3870
|
+
e.eachItem = C;
|
|
3871
|
+
function S({ mergeNames: w, mergeToName: k, mergeValues: A, resultToName: V }) {
|
|
3833
3872
|
return (x, re, K, ue) => {
|
|
3834
3873
|
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(x, re, K) : k(x, re, K), K) : re instanceof t.Name ? (k(x, K, re), re) : A(re, K);
|
|
3835
3874
|
return ue === t.Name && !(oe instanceof t.Name) ? V(x, oe) : oe;
|
|
3836
3875
|
};
|
|
3837
3876
|
}
|
|
3838
3877
|
e.mergeEvaluated = {
|
|
3839
|
-
props:
|
|
3878
|
+
props: S({
|
|
3840
3879
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => {
|
|
3841
3880
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3842
3881
|
}),
|
|
@@ -3846,7 +3885,7 @@ var util = {};
|
|
|
3846
3885
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3847
3886
|
resultToName: T
|
|
3848
3887
|
}),
|
|
3849
|
-
items:
|
|
3888
|
+
items: S({
|
|
3850
3889
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => w.assign(A, (0, t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),
|
|
3851
3890
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, k === !0 ? !0 : (0, t._)`${A} > ${k} ? ${A} : ${k}`)),
|
|
3852
3891
|
mergeValues: (w, k) => w === !0 ? !0 : Math.max(w, k),
|
|
@@ -3973,16 +4012,16 @@ names$1.default = names;
|
|
|
3973
4012
|
}
|
|
3974
4013
|
function O(y, _, g = {}) {
|
|
3975
4014
|
const { gen: P, it: I } = y, D = [
|
|
3976
|
-
|
|
3977
|
-
|
|
4015
|
+
C(I, g),
|
|
4016
|
+
S(y, g)
|
|
3978
4017
|
];
|
|
3979
4018
|
return T(y, _, D), P.object(...D);
|
|
3980
4019
|
}
|
|
3981
|
-
function
|
|
4020
|
+
function C({ errorPath: y }, { instancePath: _ }) {
|
|
3982
4021
|
const g = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
3983
4022
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, g)];
|
|
3984
4023
|
}
|
|
3985
|
-
function
|
|
4024
|
+
function S({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: g, parentSchema: P }) {
|
|
3986
4025
|
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
3987
4026
|
return g && (I = (0, t.str)`${I}${(0, r.getErrorPath)(g, r.Type.Str)}`), [p.schemaPath, I];
|
|
3988
4027
|
}
|
|
@@ -4108,7 +4147,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4108
4147
|
for (const K of D)
|
|
4109
4148
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4110
4149
|
w.else(), _(P), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4111
|
-
w.assign(k, x),
|
|
4150
|
+
w.assign(k, x), C(P, x);
|
|
4112
4151
|
});
|
|
4113
4152
|
function re(K) {
|
|
4114
4153
|
switch (K) {
|
|
@@ -4135,10 +4174,10 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
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
|
|
4180
|
+
function S(P, I, D, w = o.Correct) {
|
|
4142
4181
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4143
4182
|
let A;
|
|
4144
4183
|
switch (P) {
|
|
@@ -4164,10 +4203,10 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4164
4203
|
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4165
4204
|
}
|
|
4166
4205
|
}
|
|
4167
|
-
e.checkDataType =
|
|
4206
|
+
e.checkDataType = S;
|
|
4168
4207
|
function T(P, I, D, w) {
|
|
4169
4208
|
if (P.length === 1)
|
|
4170
|
-
return
|
|
4209
|
+
return S(P[0], I, D, w);
|
|
4171
4210
|
let k;
|
|
4172
4211
|
const A = (0, i.toHash)(P);
|
|
4173
4212
|
if (A.array && A.object) {
|
|
@@ -4177,7 +4216,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4177
4216
|
k = s.nil;
|
|
4178
4217
|
A.number && delete A.integer;
|
|
4179
4218
|
for (const V in A)
|
|
4180
|
-
k = (0, s.and)(k,
|
|
4219
|
+
k = (0, s.and)(k, S(V, I, D, w));
|
|
4181
4220
|
return k;
|
|
4182
4221
|
}
|
|
4183
4222
|
e.checkDataTypes = T;
|
|
@@ -4363,15 +4402,15 @@ function funcKeywordCode(e, t) {
|
|
|
4363
4402
|
if (t.errors === !1)
|
|
4364
4403
|
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
4365
4404
|
else {
|
|
4366
|
-
const _ = t.async ?
|
|
4405
|
+
const _ = t.async ? C() : S();
|
|
4367
4406
|
t.modifying && modifyData(e), y(() => addErrs(e, _));
|
|
4368
4407
|
}
|
|
4369
4408
|
}
|
|
4370
|
-
function
|
|
4409
|
+
function C() {
|
|
4371
4410
|
const _ = n.let("ruleErrs", null);
|
|
4372
4411
|
return n.try(() => T((0, codegen_1$p._)`await `), (g) => n.assign($, !1).if((0, codegen_1$p._)`${g} instanceof ${d.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${g}.errors`), () => n.throw(g))), _;
|
|
4373
4412
|
}
|
|
4374
|
-
function
|
|
4413
|
+
function S() {
|
|
4375
4414
|
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4376
4415
|
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4377
4416
|
}
|
|
@@ -4573,8 +4612,8 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4573
4612
|
_traverse(e, t, r, $[O], s + "/" + p + "/" + O, i, s, p, n, O);
|
|
4574
4613
|
} else if (p in traverse$1.propsKeywords) {
|
|
4575
4614
|
if ($ && typeof $ == "object")
|
|
4576
|
-
for (var
|
|
4577
|
-
_traverse(e, t, r, $[
|
|
4615
|
+
for (var C in $)
|
|
4616
|
+
_traverse(e, t, r, $[C], s + "/" + p + "/" + escapeJsonPtr(C), i, s, p, n, C);
|
|
4578
4617
|
} else
|
|
4579
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
|
}
|
|
@@ -4660,11 +4699,11 @@ 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), l = {}, d = /* @__PURE__ */ new Set();
|
|
4663
|
-
return traverse(e, { allKeys: !0 }, ($, O,
|
|
4664
|
-
if (
|
|
4702
|
+
return traverse(e, { allKeys: !0 }, ($, O, C, S) => {
|
|
4703
|
+
if (S === void 0)
|
|
4665
4704
|
return;
|
|
4666
4705
|
const T = o + O;
|
|
4667
|
-
let y = i[
|
|
4706
|
+
let y = i[S];
|
|
4668
4707
|
typeof $[r] == "string" && (y = _.call(this, $[r])), g.call(this, $.$anchor), g.call(this, $.$dynamicAnchor), i[O] = y;
|
|
4669
4708
|
function _(P) {
|
|
4670
4709
|
const I = this.opts.uriResolver.resolve;
|
|
@@ -4682,9 +4721,9 @@ function getSchemaRefs(e, t) {
|
|
|
4682
4721
|
}
|
|
4683
4722
|
}
|
|
4684
4723
|
}), l;
|
|
4685
|
-
function u($, O,
|
|
4724
|
+
function u($, O, C) {
|
|
4686
4725
|
if (O !== void 0 && !equal$2($, O))
|
|
4687
|
-
throw p(
|
|
4726
|
+
throw p(C);
|
|
4688
4727
|
}
|
|
4689
4728
|
function p($) {
|
|
4690
4729
|
return new Error(`reference "${$}" resolves to more than one schema`);
|
|
@@ -5072,17 +5111,17 @@ function compileSchema(e) {
|
|
|
5072
5111
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5073
5112
|
const $ = o.toString();
|
|
5074
5113
|
p = `${o.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5075
|
-
const
|
|
5076
|
-
if (this.scope.value(d, { ref:
|
|
5077
|
-
const { props:
|
|
5078
|
-
|
|
5079
|
-
props:
|
|
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: T } = u;
|
|
5117
|
+
C.evaluated = {
|
|
5118
|
+
props: S instanceof codegen_1$m.Name ? void 0 : S,
|
|
5080
5119
|
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5081
|
-
dynamicProps:
|
|
5120
|
+
dynamicProps: S instanceof codegen_1$m.Name,
|
|
5082
5121
|
dynamicItems: T 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 =
|
|
5124
|
+
return e.validate = C, e;
|
|
5086
5125
|
} catch ($) {
|
|
5087
5126
|
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), $;
|
|
5088
5127
|
} finally {
|
|
@@ -5205,9 +5244,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5205
5244
|
c[m] = arguments[m];
|
|
5206
5245
|
if (c.length > 1) {
|
|
5207
5246
|
c[0] = c[0].slice(0, -1);
|
|
5208
|
-
for (var
|
|
5247
|
+
for (var R = c.length - 1, E = 1; E < R; ++E)
|
|
5209
5248
|
c[E] = c[E].slice(1, -1);
|
|
5210
|
-
return c[
|
|
5249
|
+
return c[R] = c[R].slice(1), c.join("");
|
|
5211
5250
|
} else
|
|
5212
5251
|
return c[0];
|
|
5213
5252
|
}
|
|
@@ -5226,15 +5265,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5226
5265
|
function d(f, c) {
|
|
5227
5266
|
var m = f;
|
|
5228
5267
|
if (c)
|
|
5229
|
-
for (var
|
|
5230
|
-
m[
|
|
5268
|
+
for (var R in c)
|
|
5269
|
+
m[R] = c[R];
|
|
5231
5270
|
return m;
|
|
5232
5271
|
}
|
|
5233
5272
|
function u(f) {
|
|
5234
|
-
var c = "[A-Za-z]", m = "[0-9]",
|
|
5273
|
+
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5235
5274
|
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, L, "[\\:]")) + "*");
|
|
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), z = s(
|
|
5237
|
-
s("[vV]" +
|
|
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), z = s(R + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), $e = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), ge = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Se, $e, ge, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + E) + "+");
|
|
5276
|
+
s("[vV]" + R + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5238
5277
|
var ct = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5239
5278
|
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5240
5279
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
@@ -5249,15 +5288,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5249
5288
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5250
5289
|
PCT_ENCODED: new RegExp(E, "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
5295
|
var p = u(!1), $ = u(!0), O = function() {
|
|
5257
5296
|
function f(c, m) {
|
|
5258
|
-
var
|
|
5297
|
+
var R = [], E = !0, U = !1, L = void 0;
|
|
5259
5298
|
try {
|
|
5260
|
-
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (
|
|
5299
|
+
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); E = !0)
|
|
5261
5300
|
;
|
|
5262
5301
|
} catch (se) {
|
|
5263
5302
|
U = !0, L = se;
|
|
@@ -5269,7 +5308,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5269
5308
|
throw L;
|
|
5270
5309
|
}
|
|
5271
5310
|
}
|
|
5272
|
-
return
|
|
5311
|
+
return R;
|
|
5273
5312
|
}
|
|
5274
5313
|
return function(c, m) {
|
|
5275
5314
|
if (Array.isArray(c))
|
|
@@ -5278,14 +5317,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5278
5317
|
return f(c, 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 c = 0, m = Array(f.length); c < f.length; c++)
|
|
5284
5323
|
m[c] = f[c];
|
|
5285
5324
|
return m;
|
|
5286
5325
|
} else
|
|
5287
5326
|
return Array.from(f);
|
|
5288
|
-
},
|
|
5327
|
+
}, S = 2147483647, T = 36, y = 1, _ = 26, g = 38, P = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
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,20 +5333,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5294
5333
|
throw new RangeError(x[f]);
|
|
5295
5334
|
}
|
|
5296
5335
|
function ke(f, c) {
|
|
5297
|
-
for (var m = [],
|
|
5298
|
-
m[
|
|
5336
|
+
for (var m = [], R = f.length; R--; )
|
|
5337
|
+
m[R] = c(f[R]);
|
|
5299
5338
|
return m;
|
|
5300
5339
|
}
|
|
5301
5340
|
function Ce(f, c) {
|
|
5302
|
-
var m = f.split("@"),
|
|
5303
|
-
m.length > 1 && (
|
|
5341
|
+
var m = f.split("@"), R = "";
|
|
5342
|
+
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5304
5343
|
var E = f.split("."), U = ke(E, c).join(".");
|
|
5305
|
-
return
|
|
5344
|
+
return R + U;
|
|
5306
5345
|
}
|
|
5307
5346
|
function qe(f) {
|
|
5308
|
-
for (var c = [], m = 0,
|
|
5347
|
+
for (var c = [], m = 0, R = f.length; m < R; ) {
|
|
5309
5348
|
var E = f.charCodeAt(m++);
|
|
5310
|
-
if (E >= 55296 && E <= 56319 && m <
|
|
5349
|
+
if (E >= 55296 && E <= 56319 && m < R) {
|
|
5311
5350
|
var U = f.charCodeAt(m++);
|
|
5312
5351
|
(U & 64512) == 56320 ? c.push(((E & 1023) << 10) + (U & 1023) + 65536) : (c.push(E), m--);
|
|
5313
5352
|
} else
|
|
@@ -5316,15 +5355,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5316
5355
|
return c;
|
|
5317
5356
|
}
|
|
5318
5357
|
var et = function(c) {
|
|
5319
|
-
return String.fromCodePoint.apply(String,
|
|
5358
|
+
return String.fromCodePoint.apply(String, C(c));
|
|
5320
5359
|
}, Ue = function(c) {
|
|
5321
5360
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5322
5361
|
}, F = function(c, m) {
|
|
5323
5362
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5324
|
-
}, v = function(c, m,
|
|
5363
|
+
}, v = function(c, m, R) {
|
|
5325
5364
|
var E = 0;
|
|
5326
5365
|
for (
|
|
5327
|
-
c =
|
|
5366
|
+
c = R ? K(c / P) : c >> 1, c += K(c / m);
|
|
5328
5367
|
/* no initialization */
|
|
5329
5368
|
c > re * _ >> 1;
|
|
5330
5369
|
E += T
|
|
@@ -5332,34 +5371,34 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5332
5371
|
c = K(c / re);
|
|
5333
5372
|
return K(E + (re + 1) * c / (c + g));
|
|
5334
5373
|
}, j = function(c) {
|
|
5335
|
-
var m = [],
|
|
5374
|
+
var m = [], R = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5336
5375
|
J < 0 && (J = 0);
|
|
5337
5376
|
for (var Y = 0; Y < J; ++Y)
|
|
5338
5377
|
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.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
5380
|
var B = E, Z = 1, ie = T;
|
|
5342
5381
|
;
|
|
5343
5382
|
/* no condition */
|
|
5344
5383
|
ie += T
|
|
5345
5384
|
) {
|
|
5346
|
-
se >=
|
|
5385
|
+
se >= R && oe("invalid-input");
|
|
5347
5386
|
var z = Ue(c.charCodeAt(se++));
|
|
5348
|
-
(z >= T || z > K((
|
|
5387
|
+
(z >= T || z > K((S - E) / Z)) && oe("overflow"), E += z * Z;
|
|
5349
5388
|
var X = ie <= L ? y : ie >= L + _ ? _ : ie - L;
|
|
5350
5389
|
if (z < X)
|
|
5351
5390
|
break;
|
|
5352
5391
|
var ae = T - X;
|
|
5353
|
-
Z > K(
|
|
5392
|
+
Z > K(S / ae) && oe("overflow"), Z *= ae;
|
|
5354
5393
|
}
|
|
5355
5394
|
var ee = m.length + 1;
|
|
5356
|
-
L = v(E - B, ee, B == 0), K(E / ee) >
|
|
5395
|
+
L = v(E - B, ee, B == 0), K(E / ee) > S - U && oe("overflow"), U += K(E / ee), E %= ee, m.splice(E++, 0, U);
|
|
5357
5396
|
}
|
|
5358
5397
|
return String.fromCodePoint.apply(String, m);
|
|
5359
5398
|
}, b = function(c) {
|
|
5360
5399
|
var m = [];
|
|
5361
5400
|
c = qe(c);
|
|
5362
|
-
var
|
|
5401
|
+
var R = c.length, E = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5363
5402
|
try {
|
|
5364
5403
|
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5365
5404
|
var ie = Z.value;
|
|
@@ -5376,8 +5415,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5376
5415
|
}
|
|
5377
5416
|
}
|
|
5378
5417
|
var z = m.length, X = z;
|
|
5379
|
-
for (z && m.push(w); X <
|
|
5380
|
-
var ae =
|
|
5418
|
+
for (z && m.push(w); X < R; ) {
|
|
5419
|
+
var ae = S, ee = !0, Se = !1, $e = void 0;
|
|
5381
5420
|
try {
|
|
5382
5421
|
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5383
5422
|
var Ie = Be.value;
|
|
@@ -5394,12 +5433,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5394
5433
|
}
|
|
5395
5434
|
}
|
|
5396
5435
|
var fe = X + 1;
|
|
5397
|
-
ae - E > K((
|
|
5436
|
+
ae - E > K((S - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5398
5437
|
var ye = !0, je = !1, we = void 0;
|
|
5399
5438
|
try {
|
|
5400
5439
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5401
5440
|
var Ht = Lt.value;
|
|
5402
|
-
if (Ht < E && ++U >
|
|
5441
|
+
if (Ht < E && ++U > S && oe("overflow"), Ht == E) {
|
|
5403
5442
|
for (
|
|
5404
5443
|
var pt = U, ft = T;
|
|
5405
5444
|
;
|
|
@@ -5436,7 +5475,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5436
5475
|
return Ce(c, function(m) {
|
|
5437
5476
|
return A.test(m) ? "xn--" + b(m) : m;
|
|
5438
5477
|
});
|
|
5439
|
-
},
|
|
5478
|
+
}, N = {
|
|
5440
5479
|
/**
|
|
5441
5480
|
* A string representing the current Punycode.js version number.
|
|
5442
5481
|
* @memberOf punycode
|
|
@@ -5464,19 +5503,19 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5464
5503
|
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5465
5504
|
}
|
|
5466
5505
|
function W(f) {
|
|
5467
|
-
for (var c = "", m = 0,
|
|
5506
|
+
for (var c = "", m = 0, R = f.length; m < R; ) {
|
|
5468
5507
|
var E = parseInt(f.substr(m + 1, 2), 16);
|
|
5469
5508
|
if (E < 128)
|
|
5470
5509
|
c += String.fromCharCode(E), m += 3;
|
|
5471
5510
|
else if (E >= 194 && E < 224) {
|
|
5472
|
-
if (
|
|
5511
|
+
if (R - m >= 6) {
|
|
5473
5512
|
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5474
5513
|
c += String.fromCharCode((E & 31) << 6 | U & 63);
|
|
5475
5514
|
} else
|
|
5476
5515
|
c += f.substr(m, 6);
|
|
5477
5516
|
m += 6;
|
|
5478
5517
|
} else if (E >= 224) {
|
|
5479
|
-
if (
|
|
5518
|
+
if (R - m >= 9) {
|
|
5480
5519
|
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5481
5520
|
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5482
5521
|
} else
|
|
@@ -5488,9 +5527,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5488
5527
|
return c;
|
|
5489
5528
|
}
|
|
5490
5529
|
function G(f, c) {
|
|
5491
|
-
function m(
|
|
5492
|
-
var E = W(
|
|
5493
|
-
return E.match(c.UNRESERVED) ? E :
|
|
5530
|
+
function m(R) {
|
|
5531
|
+
var E = W(R);
|
|
5532
|
+
return E.match(c.UNRESERVED) ? E : R;
|
|
5494
5533
|
}
|
|
5495
5534
|
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(c.PCT_ENCODED, m).replace(f.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, o)), f;
|
|
5496
5535
|
}
|
|
@@ -5498,11 +5537,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5498
5537
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5499
5538
|
}
|
|
5500
5539
|
function he(f, c) {
|
|
5501
|
-
var m = f.match(c.IPV4ADDRESS) || [],
|
|
5540
|
+
var m = f.match(c.IPV4ADDRESS) || [], R = O(m, 2), E = R[1];
|
|
5502
5541
|
return E ? E.split(".").map(ne).join(".") : f;
|
|
5503
5542
|
}
|
|
5504
5543
|
function Le(f, c) {
|
|
5505
|
-
var m = f.match(c.IPV6ADDRESS) || [],
|
|
5544
|
+
var m = f.match(c.IPV6ADDRESS) || [], R = O(m, 3), E = R[1], U = R[2];
|
|
5506
5545
|
if (E) {
|
|
5507
5546
|
for (var L = E.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Z[Z.length - 1]), z = ie ? 7 : 8, X = Z.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5508
5547
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
@@ -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 c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {},
|
|
5569
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ? $ : p;
|
|
5531
5570
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5532
5571
|
var E = f.match(tt);
|
|
5533
5572
|
if (E) {
|
|
5534
|
-
rt ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? E[3] : void 0, m.host = f.indexOf("//") !== -1 ? E[4] : void 0, m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = f.indexOf("?") !== -1 ? E[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? E[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? E[4] : void 0)), m.host && (m.host = Le(he(m.host,
|
|
5573
|
+
rt ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? E[3] : void 0, m.host = f.indexOf("//") !== -1 ? E[4] : void 0, m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = f.indexOf("?") !== -1 ? E[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? E[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? E[4] : void 0)), m.host && (m.host = Le(he(m.host, 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", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5535
5574
|
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5536
5575
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5537
5576
|
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5538
5577
|
try {
|
|
5539
|
-
m.host =
|
|
5578
|
+
m.host = N.toASCII(m.host.replace(R.PCT_ENCODED, W).toLowerCase());
|
|
5540
5579
|
} catch (L) {
|
|
5541
5580
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5542
5581
|
}
|
|
5543
5582
|
G(m, p);
|
|
5544
5583
|
} else
|
|
5545
|
-
G(m,
|
|
5584
|
+
G(m, R);
|
|
5546
5585
|
U && U.parse && U.parse(m, c);
|
|
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, c) {
|
|
5552
|
-
var m = c.iri !== !1 ? $ : p,
|
|
5553
|
-
return f.userinfo !== void 0 && (
|
|
5591
|
+
var m = c.iri !== !1 ? $ : p, R = [];
|
|
5592
|
+
return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5554
5593
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
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 = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, 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), c.push(R);
|
|
5573
5612
|
} else
|
|
5574
5613
|
throw new Error("Unexpected dot segment condition");
|
|
5575
5614
|
}
|
|
5576
5615
|
return c.join("");
|
|
5577
5616
|
}
|
|
5578
5617
|
function le(f) {
|
|
5579
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : p,
|
|
5618
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : p, R = [], E = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5580
5619
|
if (E && E.serialize && E.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5581
5620
|
if (c.domainHost || E && E.domainHost)
|
|
5582
5621
|
try {
|
|
5583
|
-
f.host = c.iri ?
|
|
5622
|
+
f.host = c.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 " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5586
5625
|
}
|
|
5587
5626
|
}
|
|
5588
|
-
G(f, m), c.reference !== "suffix" && f.scheme && (
|
|
5627
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5589
5628
|
var U = nt(f, c);
|
|
5590
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5629
|
+
if (U !== void 0 && (c.reference !== "suffix" && R.push("//"), R.push(U), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
|
|
5591
5630
|
var L = f.path;
|
|
5592
|
-
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")),
|
|
5631
|
+
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), R.push(L);
|
|
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 xe(f, c) {
|
|
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], E = {};
|
|
5637
|
+
return R || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (E.scheme = c.scheme, E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? E.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + c.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : E.path = c.path, E.path = me(E.path)), E.query = c.query) : (E.path = f.path, c.query !== void 0 ? E.query = c.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = c.fragment, E;
|
|
5599
5638
|
}
|
|
5600
5639
|
function it(f, c, m) {
|
|
5601
|
-
var
|
|
5602
|
-
return le(xe(de(f,
|
|
5640
|
+
var R = d({ scheme: "null" }, m);
|
|
5641
|
+
return le(xe(de(f, R), de(c, R), R, !0), R);
|
|
5603
5642
|
}
|
|
5604
5643
|
function Oe(f, c) {
|
|
5605
5644
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
@@ -5620,8 +5659,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5620
5659
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
5621
5660
|
},
|
|
5622
5661
|
serialize: function(c, m) {
|
|
5623
|
-
var
|
|
5624
|
-
return (c.port === (
|
|
5662
|
+
var R = String(c.scheme).toLowerCase() === "https";
|
|
5663
|
+
return (c.port === (R ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
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(c, m) {
|
|
5639
|
-
var
|
|
5640
|
-
return
|
|
5678
|
+
var R = c;
|
|
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(c, m) {
|
|
5643
5682
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5644
|
-
var
|
|
5683
|
+
var R = c.resourceName.split("?"), E = O(R, 2), U = E[0], L = E[1];
|
|
5645
5684
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5646
5685
|
}
|
|
5647
5686
|
return c.fragment = void 0, c;
|
|
@@ -5659,9 +5698,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5659
5698
|
var Mt = {
|
|
5660
5699
|
scheme: "mailto",
|
|
5661
5700
|
parse: function(c, m) {
|
|
5662
|
-
var
|
|
5663
|
-
if (
|
|
5664
|
-
for (var U = !1, L = {}, J =
|
|
5701
|
+
var R = c, E = R.to = R.path ? R.path.split(",") : [];
|
|
5702
|
+
if (R.path = void 0, R.query) {
|
|
5703
|
+
for (var U = !1, L = {}, 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":
|
|
@@ -5669,67 +5708,67 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5669
5708
|
E.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
|
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
5679
5718
|
break;
|
|
5680
5719
|
}
|
|
5681
5720
|
}
|
|
5682
|
-
U && (
|
|
5721
|
+
U && (R.headers = L);
|
|
5683
5722
|
}
|
|
5684
|
-
|
|
5723
|
+
R.query = void 0;
|
|
5685
5724
|
for (var X = 0, ae = E.length; X < ae; ++X) {
|
|
5686
5725
|
var ee = E[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
|
-
ee[1] =
|
|
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
|
E[X] = ee.join("@");
|
|
5696
5735
|
}
|
|
5697
|
-
return
|
|
5736
|
+
return R;
|
|
5698
5737
|
},
|
|
5699
5738
|
serialize: function(c, m) {
|
|
5700
|
-
var
|
|
5739
|
+
var R = c, E = l(c.to);
|
|
5701
5740
|
if (E) {
|
|
5702
5741
|
for (var U = 0, L = E.length; U < L; ++U) {
|
|
5703
5742
|
var J = String(E[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5704
5743
|
try {
|
|
5705
|
-
B = m.iri ?
|
|
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
|
E[U] = se + "@" + B;
|
|
5710
5749
|
}
|
|
5711
|
-
|
|
5750
|
+
R.path = E.join(",");
|
|
5712
5751
|
}
|
|
5713
5752
|
var Z = c.headers = c.headers || {};
|
|
5714
5753
|
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5715
5754
|
var ie = [];
|
|
5716
5755
|
for (var z in Z)
|
|
5717
5756
|
Z[z] !== ir[z] && ie.push(z.replace(We, Ot).replace(We, o).replace(Ft, q) + "=" + Z[z].replace(We, Ot).replace(We, o).replace(fr, q));
|
|
5718
|
-
return ie.length && (
|
|
5757
|
+
return ie.length && (R.query = ie.join("&")), R;
|
|
5719
5758
|
}
|
|
5720
5759
|
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5721
5760
|
scheme: "urn",
|
|
5722
5761
|
parse: function(c, m) {
|
|
5723
|
-
var
|
|
5724
|
-
if (
|
|
5725
|
-
var U = m.scheme || E.scheme || "urn", L =
|
|
5762
|
+
var R = c.path && c.path.match(hr), E = c;
|
|
5763
|
+
if (R) {
|
|
5764
|
+
var U = m.scheme || E.scheme || "urn", L = R[1].toLowerCase(), J = R[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5726
5765
|
E.nid = L, E.nss = J, E.path = void 0, se && (E = se.parse(E, m));
|
|
5727
5766
|
} else
|
|
5728
5767
|
E.error = E.error || "URN can not be parsed.";
|
|
5729
5768
|
return E;
|
|
5730
5769
|
},
|
|
5731
5770
|
serialize: function(c, m) {
|
|
5732
|
-
var
|
|
5771
|
+
var R = m.scheme || c.scheme || "urn", E = c.nid, U = R + ":" + (m.nid || E), L = M[U];
|
|
5733
5772
|
L && (c = L.serialize(c, m));
|
|
5734
5773
|
var J = c, Y = c.nss;
|
|
5735
5774
|
return J.path = (E || m.nid) + ":" + Y, J;
|
|
@@ -5737,12 +5776,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5737
5776
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5738
5777
|
scheme: "urn:uuid",
|
|
5739
5778
|
parse: function(c, m) {
|
|
5740
|
-
var
|
|
5741
|
-
return
|
|
5779
|
+
var R = c;
|
|
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(c, m) {
|
|
5744
|
-
var
|
|
5745
|
-
return
|
|
5783
|
+
var R = c;
|
|
5784
|
+
return R.nss = (c.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[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
@@ -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, l = codegen, d = resolve$1, u = dataType, p = util, $ = require$$9, O = uri$1,
|
|
5777
|
-
|
|
5778
|
-
const
|
|
5815
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util, $ = require$$9, O = uri$1, C = (F, v) => new RegExp(F, v);
|
|
5816
|
+
C.code = "new RegExp";
|
|
5817
|
+
const S = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5779
5818
|
"validate",
|
|
5780
5819
|
"serialize",
|
|
5781
5820
|
"parse",
|
|
@@ -5811,10 +5850,10 @@ uri$1.default = uri;
|
|
|
5811
5850
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5812
5851
|
}, g = 200;
|
|
5813
5852
|
function P(F) {
|
|
5814
|
-
var v, j, b, a, h,
|
|
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 = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b :
|
|
5853
|
+
var v, j, b, a, h, N, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, 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 = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : C, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5816
5855
|
return {
|
|
5817
|
-
strictSchema: (
|
|
5856
|
+
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5818
5857
|
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5819
5858
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5820
5859
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
@@ -5876,18 +5915,18 @@ uri$1.default = uri;
|
|
|
5876
5915
|
async function a(G, ne) {
|
|
5877
5916
|
await h.call(this, G.$schema);
|
|
5878
5917
|
const he = this._addSchema(G, ne);
|
|
5879
|
-
return he.validate ||
|
|
5918
|
+
return he.validate || N.call(this, he);
|
|
5880
5919
|
}
|
|
5881
5920
|
async function h(G) {
|
|
5882
5921
|
G && !this.getSchema(G) && await a.call(this, { $ref: G }, !0);
|
|
5883
5922
|
}
|
|
5884
|
-
async function
|
|
5923
|
+
async function N(G) {
|
|
5885
5924
|
try {
|
|
5886
5925
|
return this._compileSchemaEnv(G);
|
|
5887
5926
|
} catch (ne) {
|
|
5888
5927
|
if (!(ne instanceof s.default))
|
|
5889
5928
|
throw ne;
|
|
5890
|
-
return M.call(this, ne), await q.call(this, ne.missingSchema),
|
|
5929
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
5891
5930
|
}
|
|
5892
5931
|
}
|
|
5893
5932
|
function M({ missingSchema: G, missingRef: ne }) {
|
|
@@ -5912,15 +5951,15 @@ uri$1.default = uri;
|
|
|
5912
5951
|
// Adds schema to the instance
|
|
5913
5952
|
addSchema(v, j, b, a = this.opts.validateSchema) {
|
|
5914
5953
|
if (Array.isArray(v)) {
|
|
5915
|
-
for (const
|
|
5916
|
-
this.addSchema(
|
|
5954
|
+
for (const N of v)
|
|
5955
|
+
this.addSchema(N, void 0, b, a);
|
|
5917
5956
|
return this;
|
|
5918
5957
|
}
|
|
5919
5958
|
let h;
|
|
5920
5959
|
if (typeof v == "object") {
|
|
5921
|
-
const { schemaId:
|
|
5922
|
-
if (h = v[
|
|
5923
|
-
throw new Error(`schema ${
|
|
5960
|
+
const { schemaId: N } = this.opts;
|
|
5961
|
+
if (h = v[N], h !== void 0 && typeof h != "string")
|
|
5962
|
+
throw new Error(`schema ${N} must be string`);
|
|
5924
5963
|
}
|
|
5925
5964
|
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, b, j, a, !0), this;
|
|
5926
5965
|
}
|
|
@@ -6009,7 +6048,7 @@ uri$1.default = uri;
|
|
|
6009
6048
|
type: (0, u.getJSONTypes)(j.type),
|
|
6010
6049
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6011
6050
|
};
|
|
6012
|
-
return (0, p.eachItem)(b, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((
|
|
6051
|
+
return (0, p.eachItem)(b, 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];
|
|
@@ -6037,15 +6076,15 @@ uri$1.default = uri;
|
|
|
6037
6076
|
v = JSON.parse(JSON.stringify(v));
|
|
6038
6077
|
for (const a of j) {
|
|
6039
6078
|
const h = a.split("/").slice(1);
|
|
6040
|
-
let
|
|
6079
|
+
let N = v;
|
|
6041
6080
|
for (const M of h)
|
|
6042
|
-
|
|
6081
|
+
N = N[M];
|
|
6043
6082
|
for (const M in b) {
|
|
6044
6083
|
const q = b[M];
|
|
6045
6084
|
if (typeof q != "object")
|
|
6046
6085
|
continue;
|
|
6047
|
-
const { $data: W } = q.definition, G =
|
|
6048
|
-
W && G && (
|
|
6086
|
+
const { $data: W } = q.definition, G = N[M];
|
|
6087
|
+
W && G && (N[M] = Ue(G));
|
|
6049
6088
|
}
|
|
6050
6089
|
}
|
|
6051
6090
|
return v;
|
|
@@ -6057,10 +6096,10 @@ uri$1.default = uri;
|
|
|
6057
6096
|
}
|
|
6058
6097
|
}
|
|
6059
6098
|
_addSchema(v, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6060
|
-
let
|
|
6099
|
+
let N;
|
|
6061
6100
|
const { schemaId: M } = this.opts;
|
|
6062
6101
|
if (typeof v == "object")
|
|
6063
|
-
|
|
6102
|
+
N = v[M];
|
|
6064
6103
|
else {
|
|
6065
6104
|
if (this.opts.jtd)
|
|
6066
6105
|
throw new Error("schema must be object");
|
|
@@ -6070,7 +6109,7 @@ uri$1.default = uri;
|
|
|
6070
6109
|
let q = this._cache.get(v);
|
|
6071
6110
|
if (q !== void 0)
|
|
6072
6111
|
return q;
|
|
6073
|
-
b = (0, d.normalizeId)(
|
|
6112
|
+
b = (0, d.normalizeId)(N || b);
|
|
6074
6113
|
const W = d.getSchemaRefs.call(this, v, b);
|
|
6075
6114
|
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(q.schema, q), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = q), a && this.validateSchema(v, !0), q;
|
|
6076
6115
|
}
|
|
@@ -6131,7 +6170,7 @@ uri$1.default = uri;
|
|
|
6131
6170
|
}
|
|
6132
6171
|
function x() {
|
|
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
|
}
|
|
@@ -6165,8 +6204,8 @@ uri$1.default = uri;
|
|
|
6165
6204
|
if (j && a)
|
|
6166
6205
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6167
6206
|
const { RULES: h } = this;
|
|
6168
|
-
let
|
|
6169
|
-
if (
|
|
6207
|
+
let N = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6208
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !v)
|
|
6170
6209
|
return;
|
|
6171
6210
|
const M = {
|
|
6172
6211
|
keyword: F,
|
|
@@ -6176,7 +6215,7 @@ uri$1.default = uri;
|
|
|
6176
6215
|
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6177
6216
|
}
|
|
6178
6217
|
};
|
|
6179
|
-
v.before ? Ce.call(this,
|
|
6218
|
+
v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (b = v.implements) === null || b === void 0 || b.forEach((q) => this.addKeyword(q));
|
|
6180
6219
|
}
|
|
6181
6220
|
function Ce(F, v, j) {
|
|
6182
6221
|
const b = F.rules.findIndex((a) => a.keyword === j);
|
|
@@ -6217,20 +6256,20 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
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 O(p);
|
|
6220
|
-
return
|
|
6259
|
+
return C(p);
|
|
6221
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 O(
|
|
6228
|
-
const T = getValidate(e,
|
|
6229
|
-
callRef(e, T,
|
|
6266
|
+
function O(S) {
|
|
6267
|
+
const T = getValidate(e, S);
|
|
6268
|
+
callRef(e, T, S, S.$async);
|
|
6230
6269
|
}
|
|
6231
|
-
function
|
|
6232
|
-
const T = t.scopeValue("schema", l.code.source === !0 ? { ref:
|
|
6233
|
-
schema:
|
|
6270
|
+
function C(S) {
|
|
6271
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: S, code: (0, codegen_1$l.stringify)(S) } : { ref: S }), y = t.name("valid"), _ = e.subschema({
|
|
6272
|
+
schema: S,
|
|
6234
6273
|
dataTypes: [],
|
|
6235
6274
|
schemaPath: codegen_1$l.nil,
|
|
6236
6275
|
topSchemaRef: T,
|
|
@@ -6251,21 +6290,21 @@ function callRef(e, t, r, n) {
|
|
|
6251
6290
|
function p() {
|
|
6252
6291
|
if (!l.$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
|
}, (T) => {
|
|
6258
|
-
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(
|
|
6259
|
-
}), e.ok(
|
|
6297
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(S, !1);
|
|
6298
|
+
}), e.ok(S);
|
|
6260
6299
|
}
|
|
6261
6300
|
function $() {
|
|
6262
|
-
e.result((0, code_1$8.callValidateCode)(e, t, u), () =>
|
|
6301
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () => O(t));
|
|
6263
6302
|
}
|
|
6264
|
-
function O(
|
|
6265
|
-
const T = (0, codegen_1$l._)`${
|
|
6303
|
+
function O(S) {
|
|
6304
|
+
const T = (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 ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6267
6306
|
}
|
|
6268
|
-
function
|
|
6307
|
+
function C(S) {
|
|
6269
6308
|
var T;
|
|
6270
6309
|
if (!i.opts.unevaluated)
|
|
6271
6310
|
return;
|
|
@@ -6274,14 +6313,14 @@ function callRef(e, t, r, n) {
|
|
|
6274
6313
|
if (y && !y.dynamicProps)
|
|
6275
6314
|
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6276
6315
|
else {
|
|
6277
|
-
const _ = s.var("props", (0, codegen_1$l._)`${
|
|
6316
|
+
const _ = s.var("props", (0, codegen_1$l._)`${S}.evaluated.props`);
|
|
6278
6317
|
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6279
6318
|
}
|
|
6280
6319
|
if (i.items !== !0)
|
|
6281
6320
|
if (y && !y.dynamicItems)
|
|
6282
6321
|
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6283
6322
|
else {
|
|
6284
|
-
const _ = s.var("items", (0, codegen_1$l._)`${
|
|
6323
|
+
const _ = s.var("items", (0, codegen_1$l._)`${S}.evaluated.items`);
|
|
6285
6324
|
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
6286
6325
|
}
|
|
6287
6326
|
}
|
|
@@ -6423,9 +6462,9 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6423
6462
|
return;
|
|
6424
6463
|
const d = r.length >= l.loopRequired;
|
|
6425
6464
|
if (o.allErrors ? u() : p(), l.strictRequired) {
|
|
6426
|
-
const
|
|
6465
|
+
const C = e.parentSchema.properties, { definedProperties: S } = e.it;
|
|
6427
6466
|
for (const T of r)
|
|
6428
|
-
if ((
|
|
6467
|
+
if ((C == null ? void 0 : C[T]) === void 0 && !S.has(T)) {
|
|
6429
6468
|
const y = o.schemaEnv.baseId + o.errSchemaPath, _ = `required property "${T}" is not defined at "${y}" (strictRequired)`;
|
|
6430
6469
|
(0, util_1$h.checkStrictMode)(o, _, o.opts.strictRequired);
|
|
6431
6470
|
}
|
|
@@ -6434,25 +6473,25 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6434
6473
|
if (d || i)
|
|
6435
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, () => O(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
6487
|
function $() {
|
|
6449
|
-
t.forOf("prop", n, (
|
|
6450
|
-
e.setParams({ missingProperty:
|
|
6488
|
+
t.forOf("prop", n, (C) => {
|
|
6489
|
+
e.setParams({ missingProperty: C }), t.if((0, code_1$6.noPropertyInData)(t, s, C, l.ownProperties), () => e.error());
|
|
6451
6490
|
});
|
|
6452
6491
|
}
|
|
6453
|
-
function O(
|
|
6454
|
-
e.setParams({ missingProperty:
|
|
6455
|
-
t.assign(
|
|
6492
|
+
function O(C, S) {
|
|
6493
|
+
e.setParams({ missingProperty: C }), t.forOf(C, n, () => {
|
|
6494
|
+
t.assign(S, (0, code_1$6.propertyInData)(t, s, C, l.ownProperties)), t.if((0, codegen_1$f.not)(S), () => {
|
|
6456
6495
|
e.error(), t.break();
|
|
6457
6496
|
});
|
|
6458
6497
|
}, codegen_1$f.nil);
|
|
@@ -6502,23 +6541,23 @@ 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`), T = t.let("j");
|
|
6545
|
+
e.setParams({ i: S, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => ($() ? O : C)(S, T));
|
|
6507
6546
|
}
|
|
6508
6547
|
function $() {
|
|
6509
|
-
return u.length > 0 && !u.some((
|
|
6548
|
+
return u.length > 0 && !u.some((S) => S === "object" || S === "array");
|
|
6510
6549
|
}
|
|
6511
|
-
function O(
|
|
6550
|
+
function O(S, T) {
|
|
6512
6551
|
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), g = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6513
|
-
t.for((0, codegen_1$d._)`;${
|
|
6514
|
-
t.let(y, (0, codegen_1$d._)`${r}[${
|
|
6552
|
+
t.for((0, codegen_1$d._)`;${S}--;`, () => {
|
|
6553
|
+
t.let(y, (0, codegen_1$d._)`${r}[${S}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${g}[${y}] == "number"`, () => {
|
|
6515
6554
|
t.assign(T, (0, codegen_1$d._)`${g}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6516
|
-
}).code((0, codegen_1$d._)`${g}[${y}] = ${
|
|
6555
|
+
}).code((0, codegen_1$d._)`${g}[${y}] = ${S}`);
|
|
6517
6556
|
});
|
|
6518
6557
|
}
|
|
6519
|
-
function
|
|
6558
|
+
function C(S, T) {
|
|
6520
6559
|
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6521
|
-
t.label(_).for((0, codegen_1$d._)`;${
|
|
6560
|
+
t.label(_).for((0, codegen_1$d._)`;${S}--;`, () => t.for((0, codegen_1$d._)`${T} = ${S}; ${T}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${S}], ${r}[${T}])`, () => {
|
|
6522
6561
|
e.error(), t.assign(d, !1).break(_);
|
|
6523
6562
|
})));
|
|
6524
6563
|
}
|
|
@@ -6563,16 +6602,16 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
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, T) => O(C, T)));
|
|
6568
6607
|
}
|
|
6569
6608
|
e.pass(p);
|
|
6570
6609
|
function $() {
|
|
6571
|
-
t.assign(p, !1), t.forOf("v", i, (
|
|
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 O(
|
|
6574
|
-
const T = s[
|
|
6575
|
-
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${
|
|
6612
|
+
function O(C, S) {
|
|
6613
|
+
const T = s[S];
|
|
6614
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${C}[${S}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6576
6615
|
}
|
|
6577
6616
|
}
|
|
6578
6617
|
};
|
|
@@ -6664,9 +6703,9 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6664
6703
|
}, d)), e.ok(d));
|
|
6665
6704
|
});
|
|
6666
6705
|
function p($) {
|
|
6667
|
-
const { opts: O, errSchemaPath:
|
|
6706
|
+
const { opts: O, errSchemaPath: C } = l, S = r.length, T = S === $.minItems && (S === $.maxItems || $[t] === !1);
|
|
6668
6707
|
if (O.strictTuples && !T) {
|
|
6669
|
-
const y = `"${o}" is ${
|
|
6708
|
+
const y = `"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;
|
|
6670
6709
|
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
6671
6710
|
}
|
|
6672
6711
|
}
|
|
@@ -6732,12 +6771,12 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6732
6771
|
}
|
|
6733
6772
|
i.items = !0;
|
|
6734
6773
|
const $ = t.name("valid");
|
|
6735
|
-
l === void 0 && o === 1 ?
|
|
6774
|
+
l === void 0 && o === 1 ? C($, () => t.if($, () => t.break())) : o === 0 ? (t.let($, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let($, !1), O()), e.result($, () => e.reset());
|
|
6736
6775
|
function O() {
|
|
6737
6776
|
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6738
|
-
|
|
6777
|
+
C(T, () => t.if(T, () => S(y)));
|
|
6739
6778
|
}
|
|
6740
|
-
function
|
|
6779
|
+
function C(T, y) {
|
|
6741
6780
|
t.forRange("i", 0, p, (_) => {
|
|
6742
6781
|
e.subschema({
|
|
6743
6782
|
keyword: "contains",
|
|
@@ -6747,7 +6786,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6747
6786
|
}, T), y();
|
|
6748
6787
|
});
|
|
6749
6788
|
}
|
|
6750
|
-
function
|
|
6789
|
+
function S(T) {
|
|
6751
6790
|
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign($, !1).break()), o === 1 ? t.assign($, !0) : t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0)));
|
|
6752
6791
|
}
|
|
6753
6792
|
}
|
|
@@ -6792,35 +6831,35 @@ var dependencies = {};
|
|
|
6792
6831
|
const { gen: p, data: $, it: O } = d;
|
|
6793
6832
|
if (Object.keys(u).length === 0)
|
|
6794
6833
|
return;
|
|
6795
|
-
const
|
|
6796
|
-
for (const
|
|
6797
|
-
const T = u[
|
|
6834
|
+
const C = p.let("missing");
|
|
6835
|
+
for (const S in u) {
|
|
6836
|
+
const T = u[S];
|
|
6798
6837
|
if (T.length === 0)
|
|
6799
6838
|
continue;
|
|
6800
|
-
const y = (0, n.propertyInData)(p, $,
|
|
6839
|
+
const y = (0, n.propertyInData)(p, $, S, O.opts.ownProperties);
|
|
6801
6840
|
d.setParams({
|
|
6802
|
-
property:
|
|
6841
|
+
property: S,
|
|
6803
6842
|
depsCount: T.length,
|
|
6804
6843
|
deps: T.join(", ")
|
|
6805
6844
|
}), O.allErrors ? p.if(y, () => {
|
|
6806
6845
|
for (const _ of T)
|
|
6807
6846
|
(0, n.checkReportMissingProp)(d, _);
|
|
6808
|
-
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, T,
|
|
6847
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, T, C)})`), (0, n.reportMissingProp)(d, C), p.else());
|
|
6809
6848
|
}
|
|
6810
6849
|
}
|
|
6811
6850
|
e.validatePropertyDeps = o;
|
|
6812
6851
|
function l(d, u = d.schema) {
|
|
6813
|
-
const { gen: p, data: $, keyword: O, it:
|
|
6852
|
+
const { gen: p, data: $, keyword: O, it: C } = d, S = p.name("valid");
|
|
6814
6853
|
for (const T in u)
|
|
6815
|
-
(0, r.alwaysValidSchema)(
|
|
6816
|
-
(0, n.propertyInData)(p, $, T,
|
|
6854
|
+
(0, r.alwaysValidSchema)(C, u[T]) || (p.if(
|
|
6855
|
+
(0, n.propertyInData)(p, $, T, C.opts.ownProperties),
|
|
6817
6856
|
() => {
|
|
6818
|
-
const y = d.subschema({ keyword: O, schemaProp: T },
|
|
6819
|
-
d.mergeValidEvaluated(y,
|
|
6857
|
+
const y = d.subschema({ keyword: O, schemaProp: T }, S);
|
|
6858
|
+
d.mergeValidEvaluated(y, 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 = l, e.default = s;
|
|
6826
6865
|
})(dependencies);
|
|
@@ -6876,7 +6915,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6876
6915
|
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6877
6916
|
function $() {
|
|
6878
6917
|
t.forIn("key", s, (y) => {
|
|
6879
|
-
!u.length && !p.length ?
|
|
6918
|
+
!u.length && !p.length ? S(y) : t.if(O(y), () => S(y));
|
|
6880
6919
|
});
|
|
6881
6920
|
}
|
|
6882
6921
|
function O(y) {
|
|
@@ -6888,12 +6927,12 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6888
6927
|
u.length ? _ = (0, codegen_1$5.or)(...u.map((g) => (0, codegen_1$5._)`${y} === ${g}`)) : _ = codegen_1$5.nil;
|
|
6889
6928
|
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map((g) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, g)}.test(${y})`))), (0, codegen_1$5.not)(_);
|
|
6890
6929
|
}
|
|
6891
|
-
function
|
|
6930
|
+
function C(y) {
|
|
6892
6931
|
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6893
6932
|
}
|
|
6894
|
-
function
|
|
6933
|
+
function S(y) {
|
|
6895
6934
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6896
|
-
|
|
6935
|
+
C(y);
|
|
6897
6936
|
return;
|
|
6898
6937
|
}
|
|
6899
6938
|
if (r === !1) {
|
|
@@ -6903,7 +6942,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6903
6942
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6904
6943
|
const _ = t.name("valid");
|
|
6905
6944
|
d.removeAdditional === "failing" ? (T(y, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6906
|
-
e.reset(),
|
|
6945
|
+
e.reset(), C(y);
|
|
6907
6946
|
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6908
6947
|
}
|
|
6909
6948
|
}
|
|
@@ -6970,13 +7009,13 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6970
7009
|
O();
|
|
6971
7010
|
function O() {
|
|
6972
7011
|
for (const T of l)
|
|
6973
|
-
u &&
|
|
7012
|
+
u && C(T), i.allErrors ? S(T) : (t.var(p, !0), S(T), t.if(p));
|
|
6974
7013
|
}
|
|
6975
|
-
function
|
|
7014
|
+
function C(T) {
|
|
6976
7015
|
for (const y in u)
|
|
6977
7016
|
new RegExp(T).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6978
7017
|
}
|
|
6979
|
-
function
|
|
7018
|
+
function S(T) {
|
|
6980
7019
|
t.forIn("key", n, (y) => {
|
|
6981
7020
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${y})`, () => {
|
|
6982
7021
|
const _ = d.includes(T);
|
|
@@ -7168,12 +7207,12 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7168
7207
|
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: $ } = l;
|
|
7169
7208
|
if (!d.validateFormats)
|
|
7170
7209
|
return;
|
|
7171
|
-
s ? O() :
|
|
7210
|
+
s ? O() : C();
|
|
7172
7211
|
function O() {
|
|
7173
|
-
const
|
|
7212
|
+
const S = r.scopeValue("formats", {
|
|
7174
7213
|
ref: $.formats,
|
|
7175
7214
|
code: d.code.formats
|
|
7176
|
-
}), T = r.const("fDef", (0, codegen_1$1._)`${
|
|
7215
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${S}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7177
7216
|
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(g(), P()));
|
|
7178
7217
|
function g() {
|
|
7179
7218
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
@@ -7183,15 +7222,15 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7183
7222
|
return (0, codegen_1$1._)`${_} && ${_} !== true && ${y} === ${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
|
g();
|
|
7190
7229
|
return;
|
|
7191
7230
|
}
|
|
7192
|
-
if (
|
|
7231
|
+
if (S === !0)
|
|
7193
7232
|
return;
|
|
7194
|
-
const [T, y, _] = P(
|
|
7233
|
+
const [T, y, _] = P(S);
|
|
7195
7234
|
T === t && e.pass(I());
|
|
7196
7235
|
function g() {
|
|
7197
7236
|
if (d.strictSchema === !1) {
|
|
@@ -7208,7 +7247,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7208
7247
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
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
7253
|
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
@@ -7278,31 +7317,31 @@ 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)(l)}`);
|
|
7279
7318
|
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => p(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: l })), e.ok(d);
|
|
7280
7319
|
function p() {
|
|
7281
|
-
const
|
|
7320
|
+
const C = O();
|
|
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: l }), t.endIf();
|
|
7286
7325
|
}
|
|
7287
|
-
function $(
|
|
7288
|
-
const
|
|
7289
|
-
return e.mergeEvaluated(T, codegen_1.Name),
|
|
7326
|
+
function $(C) {
|
|
7327
|
+
const S = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: C }, S);
|
|
7328
|
+
return e.mergeEvaluated(T, codegen_1.Name), S;
|
|
7290
7329
|
}
|
|
7291
7330
|
function O() {
|
|
7292
|
-
var
|
|
7293
|
-
const
|
|
7331
|
+
var C;
|
|
7332
|
+
const S = {}, T = _(s);
|
|
7294
7333
|
let y = !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[l];
|
|
7299
7338
|
if (typeof w != "object")
|
|
7300
7339
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7301
7340
|
y = y && (T || _(D)), g(w, I);
|
|
7302
7341
|
}
|
|
7303
7342
|
if (!y)
|
|
7304
7343
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7305
|
-
return
|
|
7344
|
+
return S;
|
|
7306
7345
|
function _({ required: I }) {
|
|
7307
7346
|
return Array.isArray(I) && I.includes(l);
|
|
7308
7347
|
}
|
|
@@ -7316,9 +7355,9 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7316
7355
|
throw new Error(`discriminator: "properties/${l}" 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: "${l}" 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"], l = "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, l, !1), this.refs["http://json-schema.org/schema"] = l;
|
|
7580
7619
|
}
|
|
7581
7620
|
defaultMeta() {
|
|
7582
7621
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
|
|
@@ -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 $, O,
|
|
9251
|
+
var $, O, C, S, T, y, _;
|
|
9225
9252
|
e = {
|
|
9226
9253
|
...e,
|
|
9227
9254
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -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
|
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "importWxr"
|
|
9283
9310
|
);
|
|
9284
9311
|
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9285
9312
|
(g) => g !== "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",
|