@wp-playground/blueprints 0.6.9 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blueprint-schema.json +28 -1
- package/index.cjs +32 -15
- package/index.d.ts +13 -23
- package/index.js +878 -843
- package/lib/steps/handlers.d.ts +1 -2
- package/lib/steps/import-wordpress-files.d.ts +4 -4
- package/lib/steps/import-wxr.d.ts +27 -0
- package/lib/steps/index.d.ts +3 -3
- package/package.json +2 -2
- package/lib/steps/export-wxz.d.ts +0 -9
- package/lib/steps/import-file.d.ts +0 -29
package/index.js
CHANGED
|
@@ -84,7 +84,6 @@ const wpContentFilesExcludedFromExport = [
|
|
|
84
84
|
"plugins/wordpress-importer",
|
|
85
85
|
"mu-plugins/sqlite-database-integration",
|
|
86
86
|
"mu-plugins/playground-includes",
|
|
87
|
-
"mu-plugins/export-wxz.php",
|
|
88
87
|
"mu-plugins/0-playground.php",
|
|
89
88
|
/*
|
|
90
89
|
* Listing core themes like that here isn't ideal, especially since
|
|
@@ -903,47 +902,34 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
903
902
|
WP_SITEURL: t
|
|
904
903
|
}
|
|
905
904
|
});
|
|
906
|
-
},
|
|
907
|
-
var
|
|
908
|
-
(
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}), s = (p = DOM(n).getElementById("import-upload-form")) == null ? void 0 : p.getAttribute("action"), i = await e.request({
|
|
912
|
-
url: `/wp-admin/${s}`,
|
|
913
|
-
method: "POST",
|
|
914
|
-
body: { import: t }
|
|
915
|
-
}), o = DOM(i).querySelector(
|
|
916
|
-
"#wpbody-content form"
|
|
917
|
-
);
|
|
918
|
-
if (!o)
|
|
919
|
-
throw console.log(i.text), new Error(
|
|
920
|
-
"Could not find an importer form in response. See the response text above for details."
|
|
921
|
-
);
|
|
922
|
-
const l = getFormData(o);
|
|
923
|
-
l.fetch_attachments = "1";
|
|
924
|
-
for (const $ in l)
|
|
925
|
-
if ($.startsWith("user_map[")) {
|
|
926
|
-
const O = "user_new[" + $.slice(9, -1) + "]";
|
|
927
|
-
l[O] = "1";
|
|
928
|
-
}
|
|
929
|
-
const d = await e.request({
|
|
930
|
-
url: o.action,
|
|
931
|
-
method: "POST",
|
|
932
|
-
body: l
|
|
905
|
+
}, importWxr = async (e, { file: t }, r) => {
|
|
906
|
+
var s;
|
|
907
|
+
(s = r == null ? void 0 : r.tracker) == null || s.setCaption("Importing content"), await writeFile(e, {
|
|
908
|
+
path: "/tmp/import.wxr",
|
|
909
|
+
data: t
|
|
933
910
|
});
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
911
|
+
const n = await e.documentRoot;
|
|
912
|
+
await e.run({
|
|
913
|
+
code: `<?php
|
|
914
|
+
require ${phpVar(n)} . '/wp-load.php';
|
|
915
|
+
kses_remove_filters();
|
|
916
|
+
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
917
|
+
$importer = new WXR_Importer( array(
|
|
918
|
+
'fetch_attachments' => true,
|
|
919
|
+
'default_author' => $admin_id
|
|
920
|
+
) );
|
|
921
|
+
$logger = new WP_Importer_Logger_CLI();
|
|
922
|
+
$importer->set_logger( $logger );
|
|
923
|
+
|
|
924
|
+
// Slashes from the imported content are lost if we don't call wp_slash here.
|
|
925
|
+
add_action( 'wp_insert_post_data', function( $data ) {
|
|
926
|
+
return wp_slash($data);
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
$result = $importer->import( '/tmp/import.wxr' );
|
|
930
|
+
`
|
|
931
|
+
});
|
|
932
|
+
}, zipFunctions = `<?php
|
|
947
933
|
|
|
948
934
|
function zipDir($root, $output, $options = array())
|
|
949
935
|
{
|
|
@@ -1109,12 +1095,6 @@ async function exportWXR(e) {
|
|
|
1109
1095
|
});
|
|
1110
1096
|
return new File([t.bytes], "export.xml");
|
|
1111
1097
|
}
|
|
1112
|
-
async function exportWXZ(e) {
|
|
1113
|
-
const t = await e.request({
|
|
1114
|
-
url: "/wp-admin/export.php?download=true&content=all&export_wxz=1"
|
|
1115
|
-
});
|
|
1116
|
-
return new File([t.bytes], "export.wxz");
|
|
1117
|
-
}
|
|
1118
1098
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1119
1099
|
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), o = joinPaths(i, randomString()), l = joinPaths(o, "assets", s);
|
|
1120
1100
|
await e.fileExists(l) && await e.rmdir(o, {
|
|
@@ -1278,9 +1258,8 @@ const allStepHandlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
1278
1258
|
defineWpConfigConsts,
|
|
1279
1259
|
enableMultisite,
|
|
1280
1260
|
exportWXR,
|
|
1281
|
-
exportWXZ,
|
|
1282
|
-
importFile,
|
|
1283
1261
|
importWordPressFiles,
|
|
1262
|
+
importWxr,
|
|
1284
1263
|
installPlugin,
|
|
1285
1264
|
installTheme,
|
|
1286
1265
|
login,
|
|
@@ -1724,7 +1703,8 @@ const SupportedPHPVersions = [
|
|
|
1724
1703
|
"xml-bundle",
|
|
1725
1704
|
"gd"
|
|
1726
1705
|
], SupportedPHPExtensionBundles = {
|
|
1727
|
-
"kitchen-sink": SupportedPHPExtensionsList
|
|
1706
|
+
"kitchen-sink": SupportedPHPExtensionsList,
|
|
1707
|
+
light: []
|
|
1728
1708
|
};
|
|
1729
1709
|
var Ae, Ge;
|
|
1730
1710
|
class PHPBrowser {
|
|
@@ -2200,7 +2180,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2200
2180
|
return n && s && __defProp(t, r, s), s;
|
|
2201
2181
|
};
|
|
2202
2182
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2203
|
-
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,
|
|
2183
|
+
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;
|
|
2204
2184
|
class BasePHP {
|
|
2205
2185
|
/**
|
|
2206
2186
|
* Initializes a PHP runtime.
|
|
@@ -2221,7 +2201,7 @@ class BasePHP {
|
|
|
2221
2201
|
Q(this, Rt);
|
|
2222
2202
|
Q(this, Tt);
|
|
2223
2203
|
Q(this, kt);
|
|
2224
|
-
Q(this,
|
|
2204
|
+
Q(this, Ct);
|
|
2225
2205
|
Q(this, Me, void 0);
|
|
2226
2206
|
Q(this, Ze, void 0);
|
|
2227
2207
|
Q(this, Ye, void 0);
|
|
@@ -2345,7 +2325,7 @@ class BasePHP {
|
|
|
2345
2325
|
const i = e.env || {};
|
|
2346
2326
|
for (const l in i)
|
|
2347
2327
|
ce(this, Tt, rr).call(this, l, i[l]);
|
|
2348
|
-
const o = await ce(this,
|
|
2328
|
+
const o = await ce(this, Ct, sr).call(this);
|
|
2349
2329
|
if (o.exitCode !== 0) {
|
|
2350
2330
|
const l = {
|
|
2351
2331
|
stdout: o.text,
|
|
@@ -2646,7 +2626,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2646
2626
|
[STRING],
|
|
2647
2627
|
[e]
|
|
2648
2628
|
);
|
|
2649
|
-
},
|
|
2629
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
2650
2630
|
var s;
|
|
2651
2631
|
let e, t;
|
|
2652
2632
|
try {
|
|
@@ -2979,10 +2959,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2979
2959
|
}
|
|
2980
2960
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2981
2961
|
class r extends t {
|
|
2982
|
-
constructor(
|
|
2983
|
-
if (super(), !e.IDENTIFIER.test(
|
|
2962
|
+
constructor(g) {
|
|
2963
|
+
if (super(), !e.IDENTIFIER.test(g))
|
|
2984
2964
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
2985
|
-
this.str =
|
|
2965
|
+
this.str = g;
|
|
2986
2966
|
}
|
|
2987
2967
|
toString() {
|
|
2988
2968
|
return this.str;
|
|
@@ -2996,8 +2976,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2996
2976
|
}
|
|
2997
2977
|
e.Name = r;
|
|
2998
2978
|
class n extends t {
|
|
2999
|
-
constructor(
|
|
3000
|
-
super(), this._items = typeof
|
|
2979
|
+
constructor(g) {
|
|
2980
|
+
super(), this._items = typeof g == "string" ? [g] : g;
|
|
3001
2981
|
}
|
|
3002
2982
|
toString() {
|
|
3003
2983
|
return this.str;
|
|
@@ -3005,93 +2985,93 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3005
2985
|
emptyStr() {
|
|
3006
2986
|
if (this._items.length > 1)
|
|
3007
2987
|
return !1;
|
|
3008
|
-
const
|
|
3009
|
-
return
|
|
2988
|
+
const g = this._items[0];
|
|
2989
|
+
return g === "" || g === '""';
|
|
3010
2990
|
}
|
|
3011
2991
|
get str() {
|
|
3012
|
-
var
|
|
3013
|
-
return (
|
|
2992
|
+
var g;
|
|
2993
|
+
return (g = this._str) !== null && g !== void 0 ? g : this._str = this._items.reduce((P, I) => `${P}${I}`, "");
|
|
3014
2994
|
}
|
|
3015
2995
|
get names() {
|
|
3016
|
-
var
|
|
3017
|
-
return (
|
|
2996
|
+
var g;
|
|
2997
|
+
return (g = this._names) !== null && g !== void 0 ? g : this._names = this._items.reduce((P, I) => (I instanceof r && (P[I.str] = (P[I.str] || 0) + 1), P), {});
|
|
3018
2998
|
}
|
|
3019
2999
|
}
|
|
3020
3000
|
e._Code = n, e.nil = new n("");
|
|
3021
|
-
function s(
|
|
3022
|
-
const
|
|
3001
|
+
function s(_, ...g) {
|
|
3002
|
+
const P = [_[0]];
|
|
3023
3003
|
let I = 0;
|
|
3024
|
-
for (; I <
|
|
3025
|
-
l(
|
|
3026
|
-
return new n(
|
|
3004
|
+
for (; I < g.length; )
|
|
3005
|
+
l(P, g[I]), P.push(_[++I]);
|
|
3006
|
+
return new n(P);
|
|
3027
3007
|
}
|
|
3028
3008
|
e._ = s;
|
|
3029
3009
|
const i = new n("+");
|
|
3030
|
-
function o(
|
|
3031
|
-
const
|
|
3010
|
+
function o(_, ...g) {
|
|
3011
|
+
const P = [N(_[0])];
|
|
3032
3012
|
let I = 0;
|
|
3033
|
-
for (; I <
|
|
3034
|
-
|
|
3035
|
-
return d(
|
|
3013
|
+
for (; I < g.length; )
|
|
3014
|
+
P.push(i), l(P, g[I]), P.push(i, N(_[++I]));
|
|
3015
|
+
return d(P), new n(P);
|
|
3036
3016
|
}
|
|
3037
3017
|
e.str = o;
|
|
3038
|
-
function l(
|
|
3039
|
-
|
|
3018
|
+
function l(_, g) {
|
|
3019
|
+
g instanceof n ? _.push(...g._items) : g instanceof r ? _.push(g) : _.push($(g));
|
|
3040
3020
|
}
|
|
3041
3021
|
e.addCodeArg = l;
|
|
3042
|
-
function d(
|
|
3043
|
-
let
|
|
3044
|
-
for (;
|
|
3045
|
-
if (
|
|
3046
|
-
const
|
|
3047
|
-
if (
|
|
3048
|
-
|
|
3022
|
+
function d(_) {
|
|
3023
|
+
let g = 1;
|
|
3024
|
+
for (; g < _.length - 1; ) {
|
|
3025
|
+
if (_[g] === i) {
|
|
3026
|
+
const P = u(_[g - 1], _[g + 1]);
|
|
3027
|
+
if (P !== void 0) {
|
|
3028
|
+
_.splice(g - 1, 3, P);
|
|
3049
3029
|
continue;
|
|
3050
3030
|
}
|
|
3051
|
-
|
|
3031
|
+
_[g++] = "+";
|
|
3052
3032
|
}
|
|
3053
|
-
|
|
3033
|
+
g++;
|
|
3054
3034
|
}
|
|
3055
3035
|
}
|
|
3056
|
-
function u(
|
|
3057
|
-
if (
|
|
3058
|
-
return
|
|
3059
|
-
if (
|
|
3060
|
-
return
|
|
3061
|
-
if (typeof
|
|
3062
|
-
return
|
|
3063
|
-
if (typeof
|
|
3064
|
-
return `"${
|
|
3036
|
+
function u(_, g) {
|
|
3037
|
+
if (g === '""')
|
|
3038
|
+
return _;
|
|
3039
|
+
if (_ === '""')
|
|
3040
|
+
return g;
|
|
3041
|
+
if (typeof _ == "string")
|
|
3042
|
+
return g instanceof r || _[_.length - 1] !== '"' ? void 0 : typeof g != "string" ? `${_.slice(0, -1)}${g}"` : g[0] === '"' ? _.slice(0, -1) + g.slice(1) : void 0;
|
|
3043
|
+
if (typeof g == "string" && g[0] === '"' && !(_ instanceof r))
|
|
3044
|
+
return `"${_}${g.slice(1)}`;
|
|
3065
3045
|
}
|
|
3066
|
-
function p(
|
|
3067
|
-
return
|
|
3046
|
+
function p(_, g) {
|
|
3047
|
+
return g.emptyStr() ? _ : _.emptyStr() ? g : o`${_}${g}`;
|
|
3068
3048
|
}
|
|
3069
3049
|
e.strConcat = p;
|
|
3070
|
-
function $(
|
|
3071
|
-
return typeof
|
|
3050
|
+
function $(_) {
|
|
3051
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : N(Array.isArray(_) ? _.join(",") : _);
|
|
3072
3052
|
}
|
|
3073
|
-
function O(
|
|
3074
|
-
return new n(N(
|
|
3053
|
+
function O(_) {
|
|
3054
|
+
return new n(N(_));
|
|
3075
3055
|
}
|
|
3076
3056
|
e.stringify = O;
|
|
3077
|
-
function N(
|
|
3078
|
-
return JSON.stringify(
|
|
3057
|
+
function N(_) {
|
|
3058
|
+
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3079
3059
|
}
|
|
3080
3060
|
e.safeStringify = N;
|
|
3081
|
-
function R(
|
|
3082
|
-
return typeof
|
|
3061
|
+
function R(_) {
|
|
3062
|
+
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3083
3063
|
}
|
|
3084
3064
|
e.getProperty = R;
|
|
3085
|
-
function
|
|
3086
|
-
if (typeof
|
|
3087
|
-
return new n(`${
|
|
3088
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
3065
|
+
function T(_) {
|
|
3066
|
+
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3067
|
+
return new n(`${_}`);
|
|
3068
|
+
throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`);
|
|
3089
3069
|
}
|
|
3090
|
-
e.getEsmExportName =
|
|
3091
|
-
function
|
|
3092
|
-
return new n(
|
|
3070
|
+
e.getEsmExportName = T;
|
|
3071
|
+
function y(_) {
|
|
3072
|
+
return new n(_.toString());
|
|
3093
3073
|
}
|
|
3094
|
-
e.regexpCode =
|
|
3074
|
+
e.regexpCode = y;
|
|
3095
3075
|
})(code$1);
|
|
3096
3076
|
var scope = {};
|
|
3097
3077
|
(function(e) {
|
|
@@ -3157,16 +3137,16 @@ var scope = {};
|
|
|
3157
3137
|
if (p.ref === void 0)
|
|
3158
3138
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3159
3139
|
const O = this.toName(u), { prefix: N } = O, R = ($ = p.key) !== null && $ !== void 0 ? $ : p.ref;
|
|
3160
|
-
let
|
|
3161
|
-
if (
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3164
|
-
return
|
|
3140
|
+
let T = this._values[N];
|
|
3141
|
+
if (T) {
|
|
3142
|
+
const g = T.get(R);
|
|
3143
|
+
if (g)
|
|
3144
|
+
return g;
|
|
3165
3145
|
} else
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
const
|
|
3169
|
-
return
|
|
3146
|
+
T = this._values[N] = /* @__PURE__ */ new Map();
|
|
3147
|
+
T.set(R, O);
|
|
3148
|
+
const y = this._scope[N] || (this._scope[N] = []), _ = y.length;
|
|
3149
|
+
return y[_] = p.ref, O.setValue(p, { property: N, itemIndex: _ }), O;
|
|
3170
3150
|
}
|
|
3171
3151
|
getValue(u, p) {
|
|
3172
3152
|
const $ = this._values[u];
|
|
@@ -3190,23 +3170,23 @@ var scope = {};
|
|
|
3190
3170
|
_reduceValues(u, p, $ = {}, O) {
|
|
3191
3171
|
let N = t.nil;
|
|
3192
3172
|
for (const R in u) {
|
|
3193
|
-
const
|
|
3194
|
-
if (!
|
|
3173
|
+
const T = u[R];
|
|
3174
|
+
if (!T)
|
|
3195
3175
|
continue;
|
|
3196
|
-
const
|
|
3197
|
-
|
|
3198
|
-
if (
|
|
3176
|
+
const y = $[R] = $[R] || /* @__PURE__ */ new Map();
|
|
3177
|
+
T.forEach((_) => {
|
|
3178
|
+
if (y.has(_))
|
|
3199
3179
|
return;
|
|
3200
|
-
|
|
3201
|
-
let
|
|
3202
|
-
if (
|
|
3203
|
-
const
|
|
3204
|
-
N = (0, t._)`${N}${
|
|
3205
|
-
} else if (
|
|
3206
|
-
N = (0, t._)`${N}${
|
|
3180
|
+
y.set(_, n.Started);
|
|
3181
|
+
let g = p(_);
|
|
3182
|
+
if (g) {
|
|
3183
|
+
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3184
|
+
N = (0, t._)`${N}${P} ${_} = ${g};${this.opts._n}`;
|
|
3185
|
+
} else if (g = O == null ? void 0 : O(_))
|
|
3186
|
+
N = (0, t._)`${N}${g}${this.opts._n}`;
|
|
3207
3187
|
else
|
|
3208
|
-
throw new r(
|
|
3209
|
-
|
|
3188
|
+
throw new r(_);
|
|
3189
|
+
y.set(_, n.Completed);
|
|
3210
3190
|
});
|
|
3211
3191
|
}
|
|
3212
3192
|
return N;
|
|
@@ -3382,12 +3362,12 @@ var scope = {};
|
|
|
3382
3362
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3383
3363
|
}
|
|
3384
3364
|
}
|
|
3385
|
-
class
|
|
3365
|
+
class T extends N {
|
|
3386
3366
|
}
|
|
3387
|
-
class
|
|
3367
|
+
class y extends R {
|
|
3388
3368
|
}
|
|
3389
|
-
|
|
3390
|
-
class
|
|
3369
|
+
y.kind = "else";
|
|
3370
|
+
class _ extends R {
|
|
3391
3371
|
constructor(a, h) {
|
|
3392
3372
|
super(h), this.condition = a;
|
|
3393
3373
|
}
|
|
@@ -3403,10 +3383,10 @@ var scope = {};
|
|
|
3403
3383
|
let h = this.else;
|
|
3404
3384
|
if (h) {
|
|
3405
3385
|
const C = h.optimizeNodes();
|
|
3406
|
-
h = this.else = Array.isArray(C) ? new
|
|
3386
|
+
h = this.else = Array.isArray(C) ? new y(C) : C;
|
|
3407
3387
|
}
|
|
3408
3388
|
if (h)
|
|
3409
|
-
return a === !1 ? h instanceof
|
|
3389
|
+
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(a), h instanceof _ ? [h] : h.nodes);
|
|
3410
3390
|
if (!(a === !1 || !this.nodes.length))
|
|
3411
3391
|
return this;
|
|
3412
3392
|
}
|
|
@@ -3420,11 +3400,11 @@ var scope = {};
|
|
|
3420
3400
|
return ue(a, this.condition), this.else && K(a, this.else.names), a;
|
|
3421
3401
|
}
|
|
3422
3402
|
}
|
|
3423
|
-
|
|
3424
|
-
class
|
|
3403
|
+
_.kind = "if";
|
|
3404
|
+
class g extends R {
|
|
3425
3405
|
}
|
|
3426
|
-
|
|
3427
|
-
class
|
|
3406
|
+
g.kind = "for";
|
|
3407
|
+
class P extends g {
|
|
3428
3408
|
constructor(a) {
|
|
3429
3409
|
super(), this.iteration = a;
|
|
3430
3410
|
}
|
|
@@ -3439,7 +3419,7 @@ var scope = {};
|
|
|
3439
3419
|
return K(super.names, this.iteration.names);
|
|
3440
3420
|
}
|
|
3441
3421
|
}
|
|
3442
|
-
class I extends
|
|
3422
|
+
class I extends g {
|
|
3443
3423
|
constructor(a, h, C, M) {
|
|
3444
3424
|
super(), this.varKind = a, this.name = h, this.from = C, this.to = M;
|
|
3445
3425
|
}
|
|
@@ -3452,7 +3432,7 @@ var scope = {};
|
|
|
3452
3432
|
return ue(a, this.to);
|
|
3453
3433
|
}
|
|
3454
3434
|
}
|
|
3455
|
-
class D extends
|
|
3435
|
+
class D extends g {
|
|
3456
3436
|
constructor(a, h, C, M) {
|
|
3457
3437
|
super(), this.loop = a, this.varKind = h, this.name = C, this.iterable = M;
|
|
3458
3438
|
}
|
|
@@ -3518,7 +3498,7 @@ var scope = {};
|
|
|
3518
3498
|
class re {
|
|
3519
3499
|
constructor(a, h = {}) {
|
|
3520
3500
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3521
|
-
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new
|
|
3501
|
+
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new T()];
|
|
3522
3502
|
}
|
|
3523
3503
|
toString() {
|
|
3524
3504
|
return this._root.render(this.opts);
|
|
@@ -3584,7 +3564,7 @@ var scope = {};
|
|
|
3584
3564
|
}
|
|
3585
3565
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3586
3566
|
if(a, h, C) {
|
|
3587
|
-
if (this._blockNode(new
|
|
3567
|
+
if (this._blockNode(new _(a)), h && C)
|
|
3588
3568
|
this.code(h).else().code(C).endIf();
|
|
3589
3569
|
else if (h)
|
|
3590
3570
|
this.code(h).endIf();
|
|
@@ -3594,22 +3574,22 @@ var scope = {};
|
|
|
3594
3574
|
}
|
|
3595
3575
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
3596
3576
|
elseIf(a) {
|
|
3597
|
-
return this._elseNode(new
|
|
3577
|
+
return this._elseNode(new _(a));
|
|
3598
3578
|
}
|
|
3599
3579
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3600
3580
|
else() {
|
|
3601
|
-
return this._elseNode(new
|
|
3581
|
+
return this._elseNode(new y());
|
|
3602
3582
|
}
|
|
3603
3583
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3604
3584
|
endIf() {
|
|
3605
|
-
return this._endBlockNode(
|
|
3585
|
+
return this._endBlockNode(_, y);
|
|
3606
3586
|
}
|
|
3607
3587
|
_for(a, h) {
|
|
3608
3588
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
3609
3589
|
}
|
|
3610
3590
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3611
3591
|
for(a, h) {
|
|
3612
|
-
return this._for(new
|
|
3592
|
+
return this._for(new P(a), h);
|
|
3613
3593
|
}
|
|
3614
3594
|
// `for` statement for a range of values
|
|
3615
3595
|
forRange(a, h, C, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
@@ -3637,7 +3617,7 @@ var scope = {};
|
|
|
3637
3617
|
}
|
|
3638
3618
|
// end `for` loop
|
|
3639
3619
|
endFor() {
|
|
3640
|
-
return this._endBlockNode(
|
|
3620
|
+
return this._endBlockNode(g);
|
|
3641
3621
|
}
|
|
3642
3622
|
// `label` statement
|
|
3643
3623
|
label(a) {
|
|
@@ -3709,7 +3689,7 @@ var scope = {};
|
|
|
3709
3689
|
}
|
|
3710
3690
|
_elseNode(a) {
|
|
3711
3691
|
const h = this._currNode;
|
|
3712
|
-
if (!(h instanceof
|
|
3692
|
+
if (!(h instanceof _))
|
|
3713
3693
|
throw new Error('CodeGen: "else" without "if"');
|
|
3714
3694
|
return this._currNode = h.else = a, this;
|
|
3715
3695
|
}
|
|
@@ -3726,20 +3706,20 @@ var scope = {};
|
|
|
3726
3706
|
}
|
|
3727
3707
|
}
|
|
3728
3708
|
e.CodeGen = re;
|
|
3729
|
-
function K(
|
|
3709
|
+
function K(b, a) {
|
|
3730
3710
|
for (const h in a)
|
|
3731
|
-
|
|
3732
|
-
return
|
|
3733
|
-
}
|
|
3734
|
-
function ue(
|
|
3735
|
-
return a instanceof t._CodeOrName ? K(
|
|
3736
|
-
}
|
|
3737
|
-
function oe(
|
|
3738
|
-
if (
|
|
3739
|
-
return C(
|
|
3740
|
-
if (!M(
|
|
3741
|
-
return
|
|
3742
|
-
return new t._Code(
|
|
3711
|
+
b[h] = (b[h] || 0) + (a[h] || 0);
|
|
3712
|
+
return b;
|
|
3713
|
+
}
|
|
3714
|
+
function ue(b, a) {
|
|
3715
|
+
return a instanceof t._CodeOrName ? K(b, a.names) : b;
|
|
3716
|
+
}
|
|
3717
|
+
function oe(b, a, h) {
|
|
3718
|
+
if (b instanceof t.Name)
|
|
3719
|
+
return C(b);
|
|
3720
|
+
if (!M(b))
|
|
3721
|
+
return b;
|
|
3722
|
+
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W = C(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3743
3723
|
function C(q) {
|
|
3744
3724
|
const W = h[q.str];
|
|
3745
3725
|
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
@@ -3748,29 +3728,29 @@ var scope = {};
|
|
|
3748
3728
|
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3749
3729
|
}
|
|
3750
3730
|
}
|
|
3751
|
-
function ke(
|
|
3731
|
+
function ke(b, a) {
|
|
3752
3732
|
for (const h in a)
|
|
3753
|
-
|
|
3733
|
+
b[h] = (b[h] || 0) - (a[h] || 0);
|
|
3754
3734
|
}
|
|
3755
|
-
function
|
|
3756
|
-
return typeof
|
|
3735
|
+
function Ce(b) {
|
|
3736
|
+
return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
|
|
3757
3737
|
}
|
|
3758
|
-
e.not =
|
|
3759
|
-
const qe =
|
|
3760
|
-
function et(...
|
|
3761
|
-
return
|
|
3738
|
+
e.not = Ce;
|
|
3739
|
+
const qe = v(e.operators.AND);
|
|
3740
|
+
function et(...b) {
|
|
3741
|
+
return b.reduce(qe);
|
|
3762
3742
|
}
|
|
3763
3743
|
e.and = et;
|
|
3764
|
-
const Ue =
|
|
3765
|
-
function F(...
|
|
3766
|
-
return
|
|
3744
|
+
const Ue = v(e.operators.OR);
|
|
3745
|
+
function F(...b) {
|
|
3746
|
+
return b.reduce(Ue);
|
|
3767
3747
|
}
|
|
3768
3748
|
e.or = F;
|
|
3769
|
-
function
|
|
3770
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3749
|
+
function v(b) {
|
|
3750
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${b} ${j(h)}`;
|
|
3771
3751
|
}
|
|
3772
|
-
function j(
|
|
3773
|
-
return
|
|
3752
|
+
function j(b) {
|
|
3753
|
+
return b instanceof t.Name ? b : (0, t._)`(${b})`;
|
|
3774
3754
|
}
|
|
3775
3755
|
})(codegen);
|
|
3776
3756
|
var util = {};
|
|
@@ -3861,10 +3841,10 @@ var util = {};
|
|
|
3861
3841
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3862
3842
|
}),
|
|
3863
3843
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3864
|
-
k === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`),
|
|
3844
|
+
k === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), y(w, A, k));
|
|
3865
3845
|
}),
|
|
3866
3846
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3867
|
-
resultToName:
|
|
3847
|
+
resultToName: T
|
|
3868
3848
|
}),
|
|
3869
3849
|
items: R({
|
|
3870
3850
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => w.assign(A, (0, t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),
|
|
@@ -3873,32 +3853,32 @@ var util = {};
|
|
|
3873
3853
|
resultToName: (w, k) => w.var("items", k)
|
|
3874
3854
|
})
|
|
3875
3855
|
};
|
|
3876
|
-
function
|
|
3856
|
+
function T(w, k) {
|
|
3877
3857
|
if (k === !0)
|
|
3878
3858
|
return w.var("props", !0);
|
|
3879
3859
|
const A = w.var("props", (0, t._)`{}`);
|
|
3880
|
-
return k !== void 0 &&
|
|
3860
|
+
return k !== void 0 && y(w, A, k), A;
|
|
3881
3861
|
}
|
|
3882
|
-
e.evaluatedPropsToName =
|
|
3883
|
-
function
|
|
3862
|
+
e.evaluatedPropsToName = T;
|
|
3863
|
+
function y(w, k, A) {
|
|
3884
3864
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${k}${(0, t.getProperty)(V)}`, !0));
|
|
3885
3865
|
}
|
|
3886
|
-
e.setEvaluated =
|
|
3887
|
-
const
|
|
3888
|
-
function
|
|
3866
|
+
e.setEvaluated = y;
|
|
3867
|
+
const _ = {};
|
|
3868
|
+
function g(w, k) {
|
|
3889
3869
|
return w.scopeValue("func", {
|
|
3890
3870
|
ref: k,
|
|
3891
|
-
code:
|
|
3871
|
+
code: _[k.code] || (_[k.code] = new r._Code(k.code))
|
|
3892
3872
|
});
|
|
3893
3873
|
}
|
|
3894
|
-
e.useFunc =
|
|
3895
|
-
var
|
|
3874
|
+
e.useFunc = g;
|
|
3875
|
+
var P;
|
|
3896
3876
|
(function(w) {
|
|
3897
3877
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3898
|
-
})(
|
|
3878
|
+
})(P = e.Type || (e.Type = {}));
|
|
3899
3879
|
function I(w, k, A) {
|
|
3900
3880
|
if (w instanceof t.Name) {
|
|
3901
|
-
const V = k ===
|
|
3881
|
+
const V = k === P.Num;
|
|
3902
3882
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3903
3883
|
}
|
|
3904
3884
|
return A ? (0, t.getProperty)(w).toString() : "/" + $(w);
|
|
@@ -3943,40 +3923,40 @@ names$1.default = names;
|
|
|
3943
3923
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3944
3924
|
const t = codegen, r = util, n = names$1;
|
|
3945
3925
|
e.keywordError = {
|
|
3946
|
-
message: ({ keyword:
|
|
3926
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3947
3927
|
}, e.keyword$DataError = {
|
|
3948
|
-
message: ({ keyword:
|
|
3928
|
+
message: ({ keyword: y, schemaType: _ }) => _ ? (0, t.str)`"${y}" keyword must be ${_} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3949
3929
|
};
|
|
3950
|
-
function s(
|
|
3951
|
-
const { it: I } =
|
|
3952
|
-
|
|
3930
|
+
function s(y, _ = e.keywordError, g, P) {
|
|
3931
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A = $(y, _, g);
|
|
3932
|
+
P ?? (w || k) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3953
3933
|
}
|
|
3954
3934
|
e.reportError = s;
|
|
3955
|
-
function i(
|
|
3956
|
-
const { it:
|
|
3957
|
-
d(I, k), D || w || u(
|
|
3935
|
+
function i(y, _ = e.keywordError, g) {
|
|
3936
|
+
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k = $(y, _, g);
|
|
3937
|
+
d(I, k), D || w || u(P, n.default.vErrors);
|
|
3958
3938
|
}
|
|
3959
3939
|
e.reportExtraError = i;
|
|
3960
|
-
function o(
|
|
3961
|
-
|
|
3940
|
+
function o(y, _) {
|
|
3941
|
+
y.assign(n.default.errors, _), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(_, () => y.assign((0, t._)`${n.default.vErrors}.length`, _), () => y.assign(n.default.vErrors, null)));
|
|
3962
3942
|
}
|
|
3963
3943
|
e.resetErrorsCount = o;
|
|
3964
|
-
function l({ gen:
|
|
3944
|
+
function l({ gen: y, keyword: _, schemaValue: g, data: P, errsCount: I, it: D }) {
|
|
3965
3945
|
if (I === void 0)
|
|
3966
3946
|
throw new Error("ajv implementation error");
|
|
3967
|
-
const w =
|
|
3968
|
-
|
|
3969
|
-
|
|
3947
|
+
const w = y.name("err");
|
|
3948
|
+
y.forRange("i", I, n.default.errors, (k) => {
|
|
3949
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${k}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${_}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, g), y.assign((0, t._)`${w}.data`, P));
|
|
3970
3950
|
});
|
|
3971
3951
|
}
|
|
3972
3952
|
e.extendErrors = l;
|
|
3973
|
-
function d(
|
|
3974
|
-
const
|
|
3975
|
-
|
|
3953
|
+
function d(y, _) {
|
|
3954
|
+
const g = y.const("err", _);
|
|
3955
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${g}]`), (0, t._)`${n.default.vErrors}.push(${g})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3976
3956
|
}
|
|
3977
|
-
function u(
|
|
3978
|
-
const { gen:
|
|
3979
|
-
I.$async ?
|
|
3957
|
+
function u(y, _) {
|
|
3958
|
+
const { gen: g, validateName: P, schemaEnv: I } = y;
|
|
3959
|
+
I.$async ? g.throw((0, t._)`new ${y.ValidationError}(${_})`) : (g.assign((0, t._)`${P}.errors`, _), g.return(!1));
|
|
3980
3960
|
}
|
|
3981
3961
|
const p = {
|
|
3982
3962
|
keyword: new t.Name("keyword"),
|
|
@@ -3987,28 +3967,28 @@ names$1.default = names;
|
|
|
3987
3967
|
schema: new t.Name("schema"),
|
|
3988
3968
|
parentSchema: new t.Name("parentSchema")
|
|
3989
3969
|
};
|
|
3990
|
-
function $(
|
|
3991
|
-
const { createErrors:
|
|
3992
|
-
return
|
|
3993
|
-
}
|
|
3994
|
-
function O(
|
|
3995
|
-
const { gen:
|
|
3996
|
-
N(I,
|
|
3997
|
-
R(
|
|
3970
|
+
function $(y, _, g) {
|
|
3971
|
+
const { createErrors: P } = y.it;
|
|
3972
|
+
return P === !1 ? (0, t._)`{}` : O(y, _, g);
|
|
3973
|
+
}
|
|
3974
|
+
function O(y, _, g = {}) {
|
|
3975
|
+
const { gen: P, it: I } = y, D = [
|
|
3976
|
+
N(I, g),
|
|
3977
|
+
R(y, g)
|
|
3998
3978
|
];
|
|
3999
|
-
return
|
|
3979
|
+
return T(y, _, D), P.object(...D);
|
|
4000
3980
|
}
|
|
4001
|
-
function N({ errorPath:
|
|
4002
|
-
const
|
|
4003
|
-
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath,
|
|
3981
|
+
function N({ errorPath: y }, { instancePath: _ }) {
|
|
3982
|
+
const g = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
3983
|
+
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, g)];
|
|
4004
3984
|
}
|
|
4005
|
-
function R({ keyword:
|
|
4006
|
-
let I =
|
|
4007
|
-
return
|
|
3985
|
+
function R({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: g, parentSchema: P }) {
|
|
3986
|
+
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
3987
|
+
return g && (I = (0, t.str)`${I}${(0, r.getErrorPath)(g, r.Type.Str)}`), [p.schemaPath, I];
|
|
4008
3988
|
}
|
|
4009
|
-
function
|
|
4010
|
-
const { keyword: I, data: D, schemaValue: w, it: k } =
|
|
4011
|
-
|
|
3989
|
+
function T(y, { params: _, message: g }, P) {
|
|
3990
|
+
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = k;
|
|
3991
|
+
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof g == "function" ? g(y) : g]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && P.push([p.propertyName, V]);
|
|
4012
3992
|
}
|
|
4013
3993
|
})(errors);
|
|
4014
3994
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4084,51 +4064,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4084
4064
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4085
4065
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4086
4066
|
var o;
|
|
4087
|
-
(function(
|
|
4088
|
-
|
|
4067
|
+
(function(P) {
|
|
4068
|
+
P[P.Correct = 0] = "Correct", P[P.Wrong = 1] = "Wrong";
|
|
4089
4069
|
})(o = e.DataType || (e.DataType = {}));
|
|
4090
|
-
function l(
|
|
4091
|
-
const I = d(
|
|
4070
|
+
function l(P) {
|
|
4071
|
+
const I = d(P.type);
|
|
4092
4072
|
if (I.includes("null")) {
|
|
4093
|
-
if (
|
|
4073
|
+
if (P.nullable === !1)
|
|
4094
4074
|
throw new Error("type: null contradicts nullable: false");
|
|
4095
4075
|
} else {
|
|
4096
|
-
if (!I.length &&
|
|
4076
|
+
if (!I.length && P.nullable !== void 0)
|
|
4097
4077
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4098
|
-
|
|
4078
|
+
P.nullable === !0 && I.push("null");
|
|
4099
4079
|
}
|
|
4100
4080
|
return I;
|
|
4101
4081
|
}
|
|
4102
4082
|
e.getSchemaTypes = l;
|
|
4103
|
-
function d(
|
|
4104
|
-
const I = Array.isArray(
|
|
4083
|
+
function d(P) {
|
|
4084
|
+
const I = Array.isArray(P) ? P : P ? [P] : [];
|
|
4105
4085
|
if (I.every(t.isJSONType))
|
|
4106
4086
|
return I;
|
|
4107
4087
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4108
4088
|
}
|
|
4109
4089
|
e.getJSONTypes = d;
|
|
4110
|
-
function u(
|
|
4111
|
-
const { gen: D, data: w, opts: k } =
|
|
4090
|
+
function u(P, I) {
|
|
4091
|
+
const { gen: D, data: w, opts: k } = P, A = $(I, k.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
|
|
4112
4092
|
if (V) {
|
|
4113
|
-
const x =
|
|
4093
|
+
const x = T(I, w, k.strictNumbers, o.Wrong);
|
|
4114
4094
|
D.if(x, () => {
|
|
4115
|
-
A.length ? O(
|
|
4095
|
+
A.length ? O(P, I, A) : _(P);
|
|
4116
4096
|
});
|
|
4117
4097
|
}
|
|
4118
4098
|
return V;
|
|
4119
4099
|
}
|
|
4120
4100
|
e.coerceAndCheckDataType = u;
|
|
4121
4101
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4122
|
-
function $(
|
|
4123
|
-
return I ?
|
|
4102
|
+
function $(P, I) {
|
|
4103
|
+
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4124
4104
|
}
|
|
4125
|
-
function O(
|
|
4126
|
-
const { gen: w, data: k, opts: A } =
|
|
4127
|
-
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(
|
|
4105
|
+
function O(P, I, D) {
|
|
4106
|
+
const { gen: w, data: k, opts: A } = P, V = w.let("dataType", (0, s._)`typeof ${k}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4107
|
+
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(T(I, k, A.strictNumbers), () => w.assign(x, k))), w.if((0, s._)`${x} !== undefined`);
|
|
4128
4108
|
for (const K of D)
|
|
4129
4109
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4130
|
-
w.else(),
|
|
4131
|
-
w.assign(k, x), N(
|
|
4110
|
+
w.else(), _(P), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4111
|
+
w.assign(k, x), N(P, x);
|
|
4132
4112
|
});
|
|
4133
4113
|
function re(K) {
|
|
4134
4114
|
switch (K) {
|
|
@@ -4155,13 +4135,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4155
4135
|
}
|
|
4156
4136
|
}
|
|
4157
4137
|
}
|
|
4158
|
-
function N({ gen:
|
|
4159
|
-
|
|
4138
|
+
function N({ gen: P, parentData: I, parentDataProperty: D }, w) {
|
|
4139
|
+
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
|
|
4160
4140
|
}
|
|
4161
|
-
function R(
|
|
4141
|
+
function R(P, I, D, w = o.Correct) {
|
|
4162
4142
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4163
4143
|
let A;
|
|
4164
|
-
switch (
|
|
4144
|
+
switch (P) {
|
|
4165
4145
|
case "null":
|
|
4166
4146
|
return (0, s._)`${I} ${k} null`;
|
|
4167
4147
|
case "array":
|
|
@@ -4177,7 +4157,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4177
4157
|
A = V();
|
|
4178
4158
|
break;
|
|
4179
4159
|
default:
|
|
4180
|
-
return (0, s._)`typeof ${I} ${k} ${
|
|
4160
|
+
return (0, s._)`typeof ${I} ${k} ${P}`;
|
|
4181
4161
|
}
|
|
4182
4162
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4183
4163
|
function V(x = s.nil) {
|
|
@@ -4185,11 +4165,11 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4185
4165
|
}
|
|
4186
4166
|
}
|
|
4187
4167
|
e.checkDataType = R;
|
|
4188
|
-
function
|
|
4189
|
-
if (
|
|
4190
|
-
return R(
|
|
4168
|
+
function T(P, I, D, w) {
|
|
4169
|
+
if (P.length === 1)
|
|
4170
|
+
return R(P[0], I, D, w);
|
|
4191
4171
|
let k;
|
|
4192
|
-
const A = (0, i.toHash)(
|
|
4172
|
+
const A = (0, i.toHash)(P);
|
|
4193
4173
|
if (A.array && A.object) {
|
|
4194
4174
|
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4195
4175
|
k = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
@@ -4200,18 +4180,18 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4200
4180
|
k = (0, s.and)(k, R(V, I, D, w));
|
|
4201
4181
|
return k;
|
|
4202
4182
|
}
|
|
4203
|
-
e.checkDataTypes =
|
|
4204
|
-
const
|
|
4205
|
-
message: ({ schema:
|
|
4206
|
-
params: ({ schema:
|
|
4183
|
+
e.checkDataTypes = T;
|
|
4184
|
+
const y = {
|
|
4185
|
+
message: ({ schema: P }) => `must be ${P}`,
|
|
4186
|
+
params: ({ schema: P, schemaValue: I }) => typeof P == "string" ? (0, s._)`{type: ${P}}` : (0, s._)`{type: ${I}}`
|
|
4207
4187
|
};
|
|
4208
|
-
function
|
|
4209
|
-
const I =
|
|
4210
|
-
(0, n.reportError)(I,
|
|
4188
|
+
function _(P) {
|
|
4189
|
+
const I = g(P);
|
|
4190
|
+
(0, n.reportError)(I, y);
|
|
4211
4191
|
}
|
|
4212
|
-
e.reportTypeError =
|
|
4213
|
-
function
|
|
4214
|
-
const { gen: I, data: D, schema: w } =
|
|
4192
|
+
e.reportTypeError = _;
|
|
4193
|
+
function g(P) {
|
|
4194
|
+
const { gen: I, data: D, schema: w } = P, k = (0, i.schemaRefOrVal)(P, w, "type");
|
|
4215
4195
|
return {
|
|
4216
4196
|
gen: I,
|
|
4217
4197
|
keyword: "type",
|
|
@@ -4221,7 +4201,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4221
4201
|
schemaValue: k,
|
|
4222
4202
|
parentSchema: w,
|
|
4223
4203
|
params: {},
|
|
4224
|
-
it:
|
|
4204
|
+
it: P
|
|
4225
4205
|
};
|
|
4226
4206
|
}
|
|
4227
4207
|
})(dataType);
|
|
@@ -4381,27 +4361,27 @@ function funcKeywordCode(e, t) {
|
|
|
4381
4361
|
e.block$data($, O), e.ok((r = t.valid) !== null && r !== void 0 ? r : $);
|
|
4382
4362
|
function O() {
|
|
4383
4363
|
if (t.errors === !1)
|
|
4384
|
-
|
|
4364
|
+
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
4385
4365
|
else {
|
|
4386
|
-
const
|
|
4387
|
-
t.modifying && modifyData(e),
|
|
4366
|
+
const _ = t.async ? N() : R();
|
|
4367
|
+
t.modifying && modifyData(e), y(() => addErrs(e, _));
|
|
4388
4368
|
}
|
|
4389
4369
|
}
|
|
4390
4370
|
function N() {
|
|
4391
|
-
const
|
|
4392
|
-
return n.try(() =>
|
|
4371
|
+
const _ = n.let("ruleErrs", null);
|
|
4372
|
+
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))), _;
|
|
4393
4373
|
}
|
|
4394
4374
|
function R() {
|
|
4395
|
-
const
|
|
4396
|
-
return n.assign(
|
|
4375
|
+
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4376
|
+
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4397
4377
|
}
|
|
4398
|
-
function
|
|
4399
|
-
const
|
|
4400
|
-
n.assign($, (0, codegen_1$p._)`${
|
|
4378
|
+
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4379
|
+
const g = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !l || t.schema === !1);
|
|
4380
|
+
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, p, g, P)}`, t.modifying);
|
|
4401
4381
|
}
|
|
4402
|
-
function
|
|
4403
|
-
var
|
|
4404
|
-
n.if((0, codegen_1$p.not)((
|
|
4382
|
+
function y(_) {
|
|
4383
|
+
var g;
|
|
4384
|
+
n.if((0, codegen_1$p.not)((g = t.valid) !== null && g !== void 0 ? g : $), _);
|
|
4405
4385
|
}
|
|
4406
4386
|
}
|
|
4407
4387
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4683,22 +4663,22 @@ function getSchemaRefs(e, t) {
|
|
|
4683
4663
|
return traverse(e, { allKeys: !0 }, ($, O, N, R) => {
|
|
4684
4664
|
if (R === void 0)
|
|
4685
4665
|
return;
|
|
4686
|
-
const
|
|
4687
|
-
let
|
|
4688
|
-
typeof $[r] == "string" && (
|
|
4689
|
-
function
|
|
4666
|
+
const T = o + O;
|
|
4667
|
+
let y = i[R];
|
|
4668
|
+
typeof $[r] == "string" && (y = _.call(this, $[r])), g.call(this, $.$anchor), g.call(this, $.$dynamicAnchor), i[O] = y;
|
|
4669
|
+
function _(P) {
|
|
4690
4670
|
const I = this.opts.uriResolver.resolve;
|
|
4691
|
-
if (
|
|
4692
|
-
throw p(
|
|
4693
|
-
d.add(
|
|
4694
|
-
let D = this.refs[
|
|
4695
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema,
|
|
4696
|
-
}
|
|
4697
|
-
function
|
|
4698
|
-
if (typeof
|
|
4699
|
-
if (!ANCHOR.test(
|
|
4700
|
-
throw new Error(`invalid anchor "${
|
|
4701
|
-
|
|
4671
|
+
if (P = normalizeId(y ? I(y, P) : P), d.has(P))
|
|
4672
|
+
throw p(P);
|
|
4673
|
+
d.add(P);
|
|
4674
|
+
let D = this.refs[P];
|
|
4675
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema, P) : P !== normalizeId(T) && (P[0] === "#" ? (u($, l[P], P), l[P] = $) : this.refs[P] = T), P;
|
|
4676
|
+
}
|
|
4677
|
+
function g(P) {
|
|
4678
|
+
if (typeof P == "string") {
|
|
4679
|
+
if (!ANCHOR.test(P))
|
|
4680
|
+
throw new Error(`invalid anchor "${P}"`);
|
|
4681
|
+
_.call(this, `#${P}`);
|
|
4702
4682
|
}
|
|
4703
4683
|
}
|
|
4704
4684
|
}), l;
|
|
@@ -5094,12 +5074,12 @@ function compileSchema(e) {
|
|
|
5094
5074
|
p = `${o.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5095
5075
|
const N = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5096
5076
|
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode: $, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5097
|
-
const { props: R, items:
|
|
5077
|
+
const { props: R, items: T } = u;
|
|
5098
5078
|
N.evaluated = {
|
|
5099
5079
|
props: R instanceof codegen_1$m.Name ? void 0 : R,
|
|
5100
|
-
items:
|
|
5080
|
+
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5101
5081
|
dynamicProps: R instanceof codegen_1$m.Name,
|
|
5102
|
-
dynamicItems:
|
|
5082
|
+
dynamicItems: T instanceof codegen_1$m.Name
|
|
5103
5083
|
}, N.source && (N.source.evaluated = (0, codegen_1$m.stringify)(N.evaluated));
|
|
5104
5084
|
}
|
|
5105
5085
|
return e.validate = N, e;
|
|
@@ -5221,13 +5201,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5221
5201
|
n(t);
|
|
5222
5202
|
})(commonjsGlobal, function(r) {
|
|
5223
5203
|
function n() {
|
|
5224
|
-
for (var f = arguments.length, c = Array(f),
|
|
5225
|
-
c[
|
|
5204
|
+
for (var f = arguments.length, c = Array(f), m = 0; m < f; m++)
|
|
5205
|
+
c[m] = arguments[m];
|
|
5226
5206
|
if (c.length > 1) {
|
|
5227
5207
|
c[0] = c[0].slice(0, -1);
|
|
5228
|
-
for (var
|
|
5229
|
-
c[
|
|
5230
|
-
return c[
|
|
5208
|
+
for (var S = c.length - 1, E = 1; E < S; ++E)
|
|
5209
|
+
c[E] = c[E].slice(1, -1);
|
|
5210
|
+
return c[S] = c[S].slice(1), c.join("");
|
|
5231
5211
|
} else
|
|
5232
5212
|
return c[0];
|
|
5233
5213
|
}
|
|
@@ -5244,20 +5224,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5244
5224
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5245
5225
|
}
|
|
5246
5226
|
function d(f, c) {
|
|
5247
|
-
var
|
|
5227
|
+
var m = f;
|
|
5248
5228
|
if (c)
|
|
5249
|
-
for (var
|
|
5250
|
-
|
|
5251
|
-
return
|
|
5229
|
+
for (var S in c)
|
|
5230
|
+
m[S] = c[S];
|
|
5231
|
+
return m;
|
|
5252
5232
|
}
|
|
5253
5233
|
function u(f) {
|
|
5254
|
-
var c = "[A-Za-z]",
|
|
5255
|
-
s(c + n(c,
|
|
5256
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5257
|
-
s("[vV]" +
|
|
5258
|
-
var ct = s(
|
|
5259
|
-
return s(s(
|
|
5260
|
-
NOT_SCHEME: new RegExp(n("[^]", c,
|
|
5234
|
+
var c = "[A-Za-z]", m = "[0-9]", S = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + S + "%" + S + S + "%" + S + S) + "|" + s("%[89A-Fa-f]" + S + "%" + S + S) + "|" + s("%" + S + S)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5235
|
+
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(S + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), $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) + "+");
|
|
5237
|
+
s("[vV]" + S + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5238
|
+
var ct = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5239
|
+
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5240
|
+
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5261
5241
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5262
5242
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5263
5243
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
@@ -5267,123 +5247,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5267
5247
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5268
5248
|
UNRESERVED: new RegExp(B, "g"),
|
|
5269
5249
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5270
|
-
PCT_ENCODED: new RegExp(
|
|
5250
|
+
PCT_ENCODED: new RegExp(E, "g"),
|
|
5271
5251
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5272
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5252
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + S + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5273
5253
|
//RFC 6874, with relaxed parsing rules
|
|
5274
5254
|
};
|
|
5275
5255
|
}
|
|
5276
5256
|
var p = u(!1), $ = u(!0), O = function() {
|
|
5277
|
-
function f(c,
|
|
5278
|
-
var
|
|
5257
|
+
function f(c, m) {
|
|
5258
|
+
var S = [], E = !0, U = !1, L = void 0;
|
|
5279
5259
|
try {
|
|
5280
|
-
for (var J = c[Symbol.iterator](), Y; !(
|
|
5260
|
+
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (S.push(Y.value), !(m && S.length === m)); E = !0)
|
|
5281
5261
|
;
|
|
5282
5262
|
} catch (se) {
|
|
5283
5263
|
U = !0, L = se;
|
|
5284
5264
|
} finally {
|
|
5285
5265
|
try {
|
|
5286
|
-
!
|
|
5266
|
+
!E && J.return && J.return();
|
|
5287
5267
|
} finally {
|
|
5288
5268
|
if (U)
|
|
5289
5269
|
throw L;
|
|
5290
5270
|
}
|
|
5291
5271
|
}
|
|
5292
|
-
return
|
|
5272
|
+
return S;
|
|
5293
5273
|
}
|
|
5294
|
-
return function(c,
|
|
5274
|
+
return function(c, m) {
|
|
5295
5275
|
if (Array.isArray(c))
|
|
5296
5276
|
return c;
|
|
5297
5277
|
if (Symbol.iterator in Object(c))
|
|
5298
|
-
return f(c,
|
|
5278
|
+
return f(c, m);
|
|
5299
5279
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5300
5280
|
};
|
|
5301
5281
|
}(), N = function(f) {
|
|
5302
5282
|
if (Array.isArray(f)) {
|
|
5303
|
-
for (var c = 0,
|
|
5304
|
-
|
|
5305
|
-
return
|
|
5283
|
+
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5284
|
+
m[c] = f[c];
|
|
5285
|
+
return m;
|
|
5306
5286
|
} else
|
|
5307
5287
|
return Array.from(f);
|
|
5308
|
-
}, R = 2147483647,
|
|
5288
|
+
}, R = 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 = {
|
|
5309
5289
|
overflow: "Overflow: input needs wider integers to process",
|
|
5310
5290
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5311
5291
|
"invalid-input": "Invalid input"
|
|
5312
|
-
}, re =
|
|
5292
|
+
}, re = T - y, K = Math.floor, ue = String.fromCharCode;
|
|
5313
5293
|
function oe(f) {
|
|
5314
5294
|
throw new RangeError(x[f]);
|
|
5315
5295
|
}
|
|
5316
5296
|
function ke(f, c) {
|
|
5317
|
-
for (var
|
|
5318
|
-
|
|
5319
|
-
return
|
|
5297
|
+
for (var m = [], S = f.length; S--; )
|
|
5298
|
+
m[S] = c(f[S]);
|
|
5299
|
+
return m;
|
|
5320
5300
|
}
|
|
5321
|
-
function
|
|
5322
|
-
var
|
|
5323
|
-
|
|
5324
|
-
var
|
|
5325
|
-
return
|
|
5301
|
+
function Ce(f, c) {
|
|
5302
|
+
var m = f.split("@"), S = "";
|
|
5303
|
+
m.length > 1 && (S = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5304
|
+
var E = f.split("."), U = ke(E, c).join(".");
|
|
5305
|
+
return S + U;
|
|
5326
5306
|
}
|
|
5327
5307
|
function qe(f) {
|
|
5328
|
-
for (var c = [],
|
|
5329
|
-
var
|
|
5330
|
-
if (
|
|
5331
|
-
var U = f.charCodeAt(
|
|
5332
|
-
(U & 64512) == 56320 ? c.push(((
|
|
5308
|
+
for (var c = [], m = 0, S = f.length; m < S; ) {
|
|
5309
|
+
var E = f.charCodeAt(m++);
|
|
5310
|
+
if (E >= 55296 && E <= 56319 && m < S) {
|
|
5311
|
+
var U = f.charCodeAt(m++);
|
|
5312
|
+
(U & 64512) == 56320 ? c.push(((E & 1023) << 10) + (U & 1023) + 65536) : (c.push(E), m--);
|
|
5333
5313
|
} else
|
|
5334
|
-
c.push(
|
|
5314
|
+
c.push(E);
|
|
5335
5315
|
}
|
|
5336
5316
|
return c;
|
|
5337
5317
|
}
|
|
5338
5318
|
var et = function(c) {
|
|
5339
5319
|
return String.fromCodePoint.apply(String, N(c));
|
|
5340
5320
|
}, Ue = function(c) {
|
|
5341
|
-
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 :
|
|
5342
|
-
}, F = function(c,
|
|
5343
|
-
return c + 22 + 75 * (c < 26) - ((
|
|
5344
|
-
},
|
|
5345
|
-
var
|
|
5321
|
+
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5322
|
+
}, F = function(c, m) {
|
|
5323
|
+
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5324
|
+
}, v = function(c, m, S) {
|
|
5325
|
+
var E = 0;
|
|
5346
5326
|
for (
|
|
5347
|
-
c =
|
|
5327
|
+
c = S ? K(c / P) : c >> 1, c += K(c / m);
|
|
5348
5328
|
/* no initialization */
|
|
5349
|
-
c > re *
|
|
5350
|
-
|
|
5329
|
+
c > re * _ >> 1;
|
|
5330
|
+
E += T
|
|
5351
5331
|
)
|
|
5352
5332
|
c = K(c / re);
|
|
5353
|
-
return K(
|
|
5333
|
+
return K(E + (re + 1) * c / (c + g));
|
|
5354
5334
|
}, j = function(c) {
|
|
5355
|
-
var
|
|
5335
|
+
var m = [], S = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5356
5336
|
J < 0 && (J = 0);
|
|
5357
5337
|
for (var Y = 0; Y < J; ++Y)
|
|
5358
|
-
c.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5359
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5338
|
+
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Y));
|
|
5339
|
+
for (var se = J > 0 ? J + 1 : 0; se < S; ) {
|
|
5360
5340
|
for (
|
|
5361
|
-
var B =
|
|
5341
|
+
var B = E, Z = 1, ie = T;
|
|
5362
5342
|
;
|
|
5363
5343
|
/* no condition */
|
|
5364
|
-
ie +=
|
|
5344
|
+
ie += T
|
|
5365
5345
|
) {
|
|
5366
|
-
se >=
|
|
5346
|
+
se >= S && oe("invalid-input");
|
|
5367
5347
|
var z = Ue(c.charCodeAt(se++));
|
|
5368
|
-
(z >=
|
|
5369
|
-
var X = ie <= L ?
|
|
5348
|
+
(z >= T || z > K((R - E) / Z)) && oe("overflow"), E += z * Z;
|
|
5349
|
+
var X = ie <= L ? y : ie >= L + _ ? _ : ie - L;
|
|
5370
5350
|
if (z < X)
|
|
5371
5351
|
break;
|
|
5372
|
-
var ae =
|
|
5352
|
+
var ae = T - X;
|
|
5373
5353
|
Z > K(R / ae) && oe("overflow"), Z *= ae;
|
|
5374
5354
|
}
|
|
5375
|
-
var ee =
|
|
5376
|
-
L =
|
|
5355
|
+
var ee = m.length + 1;
|
|
5356
|
+
L = v(E - B, ee, B == 0), K(E / ee) > R - U && oe("overflow"), U += K(E / ee), E %= ee, m.splice(E++, 0, U);
|
|
5377
5357
|
}
|
|
5378
|
-
return String.fromCodePoint.apply(String,
|
|
5379
|
-
},
|
|
5380
|
-
var
|
|
5358
|
+
return String.fromCodePoint.apply(String, m);
|
|
5359
|
+
}, b = function(c) {
|
|
5360
|
+
var m = [];
|
|
5381
5361
|
c = qe(c);
|
|
5382
|
-
var
|
|
5362
|
+
var S = c.length, E = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5383
5363
|
try {
|
|
5384
5364
|
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5385
5365
|
var ie = Z.value;
|
|
5386
|
-
ie < 128 &&
|
|
5366
|
+
ie < 128 && m.push(ue(ie));
|
|
5387
5367
|
}
|
|
5388
5368
|
} catch (lt) {
|
|
5389
5369
|
Y = !0, se = lt;
|
|
@@ -5395,13 +5375,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5395
5375
|
throw se;
|
|
5396
5376
|
}
|
|
5397
5377
|
}
|
|
5398
|
-
var z =
|
|
5399
|
-
for (z &&
|
|
5378
|
+
var z = m.length, X = z;
|
|
5379
|
+
for (z && m.push(w); X < S; ) {
|
|
5400
5380
|
var ae = R, ee = !0, Se = !1, $e = void 0;
|
|
5401
5381
|
try {
|
|
5402
5382
|
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5403
5383
|
var Ie = Be.value;
|
|
5404
|
-
Ie >=
|
|
5384
|
+
Ie >= E && Ie < ae && (ae = Ie);
|
|
5405
5385
|
}
|
|
5406
5386
|
} catch (lt) {
|
|
5407
5387
|
Se = !0, $e = lt;
|
|
@@ -5414,25 +5394,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5414
5394
|
}
|
|
5415
5395
|
}
|
|
5416
5396
|
var fe = X + 1;
|
|
5417
|
-
ae -
|
|
5397
|
+
ae - E > K((R - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5418
5398
|
var ye = !0, je = !1, we = void 0;
|
|
5419
5399
|
try {
|
|
5420
5400
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5421
5401
|
var Ht = Lt.value;
|
|
5422
|
-
if (Ht <
|
|
5402
|
+
if (Ht < E && ++U > R && oe("overflow"), Ht == E) {
|
|
5423
5403
|
for (
|
|
5424
|
-
var pt = U, ft =
|
|
5404
|
+
var pt = U, ft = T;
|
|
5425
5405
|
;
|
|
5426
5406
|
/* no condition */
|
|
5427
|
-
ft +=
|
|
5407
|
+
ft += T
|
|
5428
5408
|
) {
|
|
5429
|
-
var ht = ft <= L ?
|
|
5409
|
+
var ht = ft <= L ? y : ft >= L + _ ? _ : ft - L;
|
|
5430
5410
|
if (pt < ht)
|
|
5431
5411
|
break;
|
|
5432
|
-
var Vt = pt - ht, zt =
|
|
5433
|
-
|
|
5412
|
+
var Vt = pt - ht, zt = T - ht;
|
|
5413
|
+
m.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5434
5414
|
}
|
|
5435
|
-
|
|
5415
|
+
m.push(ue(F(pt, 0))), L = v(U, fe, X == z), U = 0, ++X;
|
|
5436
5416
|
}
|
|
5437
5417
|
}
|
|
5438
5418
|
} catch (lt) {
|
|
@@ -5445,16 +5425,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5445
5425
|
throw we;
|
|
5446
5426
|
}
|
|
5447
5427
|
}
|
|
5448
|
-
++U, ++
|
|
5428
|
+
++U, ++E;
|
|
5449
5429
|
}
|
|
5450
|
-
return
|
|
5430
|
+
return m.join("");
|
|
5451
5431
|
}, a = function(c) {
|
|
5452
|
-
return
|
|
5453
|
-
return k.test(
|
|
5432
|
+
return Ce(c, function(m) {
|
|
5433
|
+
return k.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5454
5434
|
});
|
|
5455
5435
|
}, h = function(c) {
|
|
5456
|
-
return
|
|
5457
|
-
return A.test(
|
|
5436
|
+
return Ce(c, function(m) {
|
|
5437
|
+
return A.test(m) ? "xn--" + b(m) : m;
|
|
5458
5438
|
});
|
|
5459
5439
|
}, C = {
|
|
5460
5440
|
/**
|
|
@@ -5475,56 +5455,56 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5475
5455
|
encode: et
|
|
5476
5456
|
},
|
|
5477
5457
|
decode: j,
|
|
5478
|
-
encode:
|
|
5458
|
+
encode: b,
|
|
5479
5459
|
toASCII: h,
|
|
5480
5460
|
toUnicode: a
|
|
5481
5461
|
}, M = {};
|
|
5482
5462
|
function q(f) {
|
|
5483
|
-
var c = f.charCodeAt(0),
|
|
5484
|
-
return c < 16 ?
|
|
5463
|
+
var c = f.charCodeAt(0), m = void 0;
|
|
5464
|
+
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5485
5465
|
}
|
|
5486
5466
|
function W(f) {
|
|
5487
|
-
for (var c = "",
|
|
5488
|
-
var
|
|
5489
|
-
if (
|
|
5490
|
-
c += String.fromCharCode(
|
|
5491
|
-
else if (
|
|
5492
|
-
if (
|
|
5493
|
-
var U = parseInt(f.substr(
|
|
5494
|
-
c += String.fromCharCode((
|
|
5467
|
+
for (var c = "", m = 0, S = f.length; m < S; ) {
|
|
5468
|
+
var E = parseInt(f.substr(m + 1, 2), 16);
|
|
5469
|
+
if (E < 128)
|
|
5470
|
+
c += String.fromCharCode(E), m += 3;
|
|
5471
|
+
else if (E >= 194 && E < 224) {
|
|
5472
|
+
if (S - m >= 6) {
|
|
5473
|
+
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5474
|
+
c += String.fromCharCode((E & 31) << 6 | U & 63);
|
|
5495
5475
|
} else
|
|
5496
|
-
c += f.substr(
|
|
5497
|
-
|
|
5498
|
-
} else if (
|
|
5499
|
-
if (
|
|
5500
|
-
var L = parseInt(f.substr(
|
|
5501
|
-
c += String.fromCharCode((
|
|
5476
|
+
c += f.substr(m, 6);
|
|
5477
|
+
m += 6;
|
|
5478
|
+
} else if (E >= 224) {
|
|
5479
|
+
if (S - m >= 9) {
|
|
5480
|
+
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5481
|
+
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5502
5482
|
} else
|
|
5503
|
-
c += f.substr(
|
|
5504
|
-
|
|
5483
|
+
c += f.substr(m, 9);
|
|
5484
|
+
m += 9;
|
|
5505
5485
|
} else
|
|
5506
|
-
c += f.substr(
|
|
5486
|
+
c += f.substr(m, 3), m += 3;
|
|
5507
5487
|
}
|
|
5508
5488
|
return c;
|
|
5509
5489
|
}
|
|
5510
5490
|
function G(f, c) {
|
|
5511
|
-
function
|
|
5512
|
-
var
|
|
5513
|
-
return
|
|
5491
|
+
function m(S) {
|
|
5492
|
+
var E = W(S);
|
|
5493
|
+
return E.match(c.UNRESERVED) ? E : S;
|
|
5514
5494
|
}
|
|
5515
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED,
|
|
5495
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(c.PCT_ENCODED, m).replace(f.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, o)), f;
|
|
5516
5496
|
}
|
|
5517
5497
|
function ne(f) {
|
|
5518
5498
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5519
5499
|
}
|
|
5520
5500
|
function he(f, c) {
|
|
5521
|
-
var
|
|
5522
|
-
return
|
|
5501
|
+
var m = f.match(c.IPV4ADDRESS) || [], S = O(m, 2), E = S[1];
|
|
5502
|
+
return E ? E.split(".").map(ne).join(".") : f;
|
|
5523
5503
|
}
|
|
5524
5504
|
function Le(f, c) {
|
|
5525
|
-
var
|
|
5526
|
-
if (
|
|
5527
|
-
for (var L =
|
|
5505
|
+
var m = f.match(c.IPV6ADDRESS) || [], S = O(m, 3), E = S[1], U = S[2];
|
|
5506
|
+
if (E) {
|
|
5507
|
+
for (var L = E.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Z[Z.length - 1]), z = ie ? 7 : 8, X = Z.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5528
5508
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5529
5509
|
ie && (ae[z - 1] = he(ae[z - 1], c));
|
|
5530
5510
|
var Se = ae.reduce(function(fe, ye, je) {
|
|
@@ -5547,32 +5527,32 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5547
5527
|
}
|
|
5548
5528
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5549
5529
|
function de(f) {
|
|
5550
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5530
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ? $ : p;
|
|
5551
5531
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5552
|
-
var
|
|
5553
|
-
if (
|
|
5554
|
-
rt ? (
|
|
5555
|
-
var U = M[(c.scheme ||
|
|
5532
|
+
var E = f.match(tt);
|
|
5533
|
+
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, S), S)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5535
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5556
5536
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5557
|
-
if (
|
|
5537
|
+
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5558
5538
|
try {
|
|
5559
|
-
|
|
5539
|
+
m.host = C.toASCII(m.host.replace(S.PCT_ENCODED, W).toLowerCase());
|
|
5560
5540
|
} catch (L) {
|
|
5561
|
-
|
|
5541
|
+
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5562
5542
|
}
|
|
5563
|
-
G(
|
|
5543
|
+
G(m, p);
|
|
5564
5544
|
} else
|
|
5565
|
-
G(
|
|
5566
|
-
U && U.parse && U.parse(
|
|
5545
|
+
G(m, S);
|
|
5546
|
+
U && U.parse && U.parse(m, c);
|
|
5567
5547
|
} else
|
|
5568
|
-
|
|
5569
|
-
return
|
|
5548
|
+
m.error = m.error || "URI can not be parsed.";
|
|
5549
|
+
return m;
|
|
5570
5550
|
}
|
|
5571
5551
|
function nt(f, c) {
|
|
5572
|
-
var
|
|
5573
|
-
return f.userinfo !== void 0 && (
|
|
5552
|
+
var m = c.iri !== !1 ? $ : p, S = [];
|
|
5553
|
+
return f.userinfo !== void 0 && (S.push(f.userinfo), S.push("@")), f.host !== void 0 && S.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5574
5554
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5575
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5555
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (S.push(":"), S.push(String(f.port))), S.length ? S.join("") : void 0;
|
|
5576
5556
|
}
|
|
5577
5557
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5578
5558
|
function me(f) {
|
|
@@ -5586,46 +5566,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5586
5566
|
else if (f === "." || f === "..")
|
|
5587
5567
|
f = "";
|
|
5588
5568
|
else {
|
|
5589
|
-
var
|
|
5590
|
-
if (
|
|
5591
|
-
var
|
|
5592
|
-
f = f.slice(
|
|
5569
|
+
var m = f.match(st);
|
|
5570
|
+
if (m) {
|
|
5571
|
+
var S = m[0];
|
|
5572
|
+
f = f.slice(S.length), c.push(S);
|
|
5593
5573
|
} else
|
|
5594
5574
|
throw new Error("Unexpected dot segment condition");
|
|
5595
5575
|
}
|
|
5596
5576
|
return c.join("");
|
|
5597
5577
|
}
|
|
5598
5578
|
function le(f) {
|
|
5599
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5600
|
-
if (
|
|
5601
|
-
if (c.domainHost ||
|
|
5579
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : p, S = [], E = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5580
|
+
if (E && E.serialize && E.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5581
|
+
if (c.domainHost || E && E.domainHost)
|
|
5602
5582
|
try {
|
|
5603
|
-
f.host = c.iri ? C.toUnicode(f.host) : C.toASCII(f.host.replace(
|
|
5583
|
+
f.host = c.iri ? C.toUnicode(f.host) : C.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5604
5584
|
} catch (J) {
|
|
5605
5585
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5606
5586
|
}
|
|
5607
5587
|
}
|
|
5608
|
-
G(f,
|
|
5588
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (S.push(f.scheme), S.push(":"));
|
|
5609
5589
|
var U = nt(f, c);
|
|
5610
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5590
|
+
if (U !== void 0 && (c.reference !== "suffix" && S.push("//"), S.push(U), f.path && f.path.charAt(0) !== "/" && S.push("/")), f.path !== void 0) {
|
|
5611
5591
|
var L = f.path;
|
|
5612
|
-
!c.absolutePath && (!
|
|
5592
|
+
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), S.push(L);
|
|
5613
5593
|
}
|
|
5614
|
-
return f.query !== void 0 && (
|
|
5594
|
+
return f.query !== void 0 && (S.push("?"), S.push(f.query)), f.fragment !== void 0 && (S.push("#"), S.push(f.fragment)), S.join("");
|
|
5615
5595
|
}
|
|
5616
5596
|
function xe(f, c) {
|
|
5617
|
-
var
|
|
5618
|
-
return
|
|
5597
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, S = arguments[3], E = {};
|
|
5598
|
+
return S || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (E.scheme = c.scheme, E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? E.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + c.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : E.path = c.path, E.path = me(E.path)), E.query = c.query) : (E.path = f.path, c.query !== void 0 ? E.query = c.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = c.fragment, E;
|
|
5619
5599
|
}
|
|
5620
|
-
function it(f, c,
|
|
5621
|
-
var
|
|
5622
|
-
return le(xe(de(f,
|
|
5600
|
+
function it(f, c, m) {
|
|
5601
|
+
var S = d({ scheme: "null" }, m);
|
|
5602
|
+
return le(xe(de(f, S), de(c, S), S, !0), S);
|
|
5623
5603
|
}
|
|
5624
|
-
function
|
|
5604
|
+
function Oe(f, c) {
|
|
5625
5605
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
5626
5606
|
}
|
|
5627
|
-
function ot(f, c,
|
|
5628
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5607
|
+
function ot(f, c, m) {
|
|
5608
|
+
return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : i(c) === "object" && (c = le(c, m)), f === c;
|
|
5629
5609
|
}
|
|
5630
5610
|
function ut(f, c) {
|
|
5631
5611
|
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE : $.ESCAPE, q);
|
|
@@ -5636,12 +5616,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5636
5616
|
var Ne = {
|
|
5637
5617
|
scheme: "http",
|
|
5638
5618
|
domainHost: !0,
|
|
5639
|
-
parse: function(c,
|
|
5619
|
+
parse: function(c, m) {
|
|
5640
5620
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
5641
5621
|
},
|
|
5642
|
-
serialize: function(c,
|
|
5643
|
-
var
|
|
5644
|
-
return (c.port === (
|
|
5622
|
+
serialize: function(c, m) {
|
|
5623
|
+
var S = String(c.scheme).toLowerCase() === "https";
|
|
5624
|
+
return (c.port === (S ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5645
5625
|
}
|
|
5646
5626
|
}, It = {
|
|
5647
5627
|
scheme: "https",
|
|
@@ -5655,13 +5635,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5655
5635
|
var at = {
|
|
5656
5636
|
scheme: "ws",
|
|
5657
5637
|
domainHost: !0,
|
|
5658
|
-
parse: function(c,
|
|
5659
|
-
var
|
|
5660
|
-
return
|
|
5638
|
+
parse: function(c, m) {
|
|
5639
|
+
var S = c;
|
|
5640
|
+
return S.secure = jt(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S;
|
|
5661
5641
|
},
|
|
5662
|
-
serialize: function(c,
|
|
5642
|
+
serialize: function(c, m) {
|
|
5663
5643
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5664
|
-
var
|
|
5644
|
+
var S = c.resourceName.split("?"), E = O(S, 2), U = E[0], L = E[1];
|
|
5665
5645
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5666
5646
|
}
|
|
5667
5647
|
return c.fragment = void 0, c;
|
|
@@ -5672,100 +5652,100 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5672
5652
|
parse: at.parse,
|
|
5673
5653
|
serialize: at.serialize
|
|
5674
5654
|
}, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
5675
|
-
function
|
|
5655
|
+
function Ot(f) {
|
|
5676
5656
|
var c = W(f);
|
|
5677
5657
|
return c.match(ur) ? c : f;
|
|
5678
5658
|
}
|
|
5679
5659
|
var Mt = {
|
|
5680
5660
|
scheme: "mailto",
|
|
5681
|
-
parse: function(c,
|
|
5682
|
-
var
|
|
5683
|
-
if (
|
|
5684
|
-
for (var U = !1, L = {}, J =
|
|
5661
|
+
parse: function(c, m) {
|
|
5662
|
+
var S = c, E = S.to = S.path ? S.path.split(",") : [];
|
|
5663
|
+
if (S.path = void 0, S.query) {
|
|
5664
|
+
for (var U = !1, L = {}, J = S.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5685
5665
|
var B = J[Y].split("=");
|
|
5686
5666
|
switch (B[0]) {
|
|
5687
5667
|
case "to":
|
|
5688
5668
|
for (var Z = B[1].split(","), ie = 0, z = Z.length; ie < z; ++ie)
|
|
5689
|
-
|
|
5669
|
+
E.push(Z[ie]);
|
|
5690
5670
|
break;
|
|
5691
5671
|
case "subject":
|
|
5692
|
-
|
|
5672
|
+
S.subject = pe(B[1], m);
|
|
5693
5673
|
break;
|
|
5694
5674
|
case "body":
|
|
5695
|
-
|
|
5675
|
+
S.body = pe(B[1], m);
|
|
5696
5676
|
break;
|
|
5697
5677
|
default:
|
|
5698
|
-
U = !0, L[pe(B[0],
|
|
5678
|
+
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
5699
5679
|
break;
|
|
5700
5680
|
}
|
|
5701
5681
|
}
|
|
5702
|
-
U && (
|
|
5682
|
+
U && (S.headers = L);
|
|
5703
5683
|
}
|
|
5704
|
-
|
|
5705
|
-
for (var X = 0, ae =
|
|
5706
|
-
var ee =
|
|
5707
|
-
if (ee[0] = pe(ee[0]),
|
|
5708
|
-
ee[1] = pe(ee[1],
|
|
5684
|
+
S.query = void 0;
|
|
5685
|
+
for (var X = 0, ae = E.length; X < ae; ++X) {
|
|
5686
|
+
var ee = E[X].split("@");
|
|
5687
|
+
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5688
|
+
ee[1] = pe(ee[1], m).toLowerCase();
|
|
5709
5689
|
else
|
|
5710
5690
|
try {
|
|
5711
|
-
ee[1] = C.toASCII(pe(ee[1],
|
|
5691
|
+
ee[1] = C.toASCII(pe(ee[1], m).toLowerCase());
|
|
5712
5692
|
} catch (Se) {
|
|
5713
|
-
|
|
5693
|
+
S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5714
5694
|
}
|
|
5715
|
-
|
|
5695
|
+
E[X] = ee.join("@");
|
|
5716
5696
|
}
|
|
5717
|
-
return
|
|
5697
|
+
return S;
|
|
5718
5698
|
},
|
|
5719
|
-
serialize: function(c,
|
|
5720
|
-
var
|
|
5721
|
-
if (
|
|
5722
|
-
for (var U = 0, L =
|
|
5723
|
-
var J = String(
|
|
5699
|
+
serialize: function(c, m) {
|
|
5700
|
+
var S = c, E = l(c.to);
|
|
5701
|
+
if (E) {
|
|
5702
|
+
for (var U = 0, L = E.length; U < L; ++U) {
|
|
5703
|
+
var J = String(E[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5724
5704
|
try {
|
|
5725
|
-
B =
|
|
5705
|
+
B = m.iri ? C.toUnicode(B) : C.toASCII(pe(B, m).toLowerCase());
|
|
5726
5706
|
} catch (X) {
|
|
5727
|
-
|
|
5707
|
+
S.error = S.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5728
5708
|
}
|
|
5729
|
-
|
|
5709
|
+
E[U] = se + "@" + B;
|
|
5730
5710
|
}
|
|
5731
|
-
|
|
5711
|
+
S.path = E.join(",");
|
|
5732
5712
|
}
|
|
5733
5713
|
var Z = c.headers = c.headers || {};
|
|
5734
5714
|
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5735
5715
|
var ie = [];
|
|
5736
5716
|
for (var z in Z)
|
|
5737
|
-
Z[z] !== ir[z] && ie.push(z.replace(We,
|
|
5738
|
-
return ie.length && (
|
|
5717
|
+
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 && (S.query = ie.join("&")), S;
|
|
5739
5719
|
}
|
|
5740
5720
|
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5741
5721
|
scheme: "urn",
|
|
5742
|
-
parse: function(c,
|
|
5743
|
-
var
|
|
5744
|
-
if (
|
|
5745
|
-
var U =
|
|
5746
|
-
|
|
5722
|
+
parse: function(c, m) {
|
|
5723
|
+
var S = c.path && c.path.match(hr), E = c;
|
|
5724
|
+
if (S) {
|
|
5725
|
+
var U = m.scheme || E.scheme || "urn", L = S[1].toLowerCase(), J = S[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5726
|
+
E.nid = L, E.nss = J, E.path = void 0, se && (E = se.parse(E, m));
|
|
5747
5727
|
} else
|
|
5748
|
-
|
|
5749
|
-
return
|
|
5728
|
+
E.error = E.error || "URN can not be parsed.";
|
|
5729
|
+
return E;
|
|
5750
5730
|
},
|
|
5751
|
-
serialize: function(c,
|
|
5752
|
-
var
|
|
5753
|
-
L && (c = L.serialize(c,
|
|
5731
|
+
serialize: function(c, m) {
|
|
5732
|
+
var S = m.scheme || c.scheme || "urn", E = c.nid, U = S + ":" + (m.nid || E), L = M[U];
|
|
5733
|
+
L && (c = L.serialize(c, m));
|
|
5754
5734
|
var J = c, Y = c.nss;
|
|
5755
|
-
return J.path = (
|
|
5735
|
+
return J.path = (E || m.nid) + ":" + Y, J;
|
|
5756
5736
|
}
|
|
5757
5737
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5758
5738
|
scheme: "urn:uuid",
|
|
5759
|
-
parse: function(c,
|
|
5760
|
-
var
|
|
5761
|
-
return
|
|
5739
|
+
parse: function(c, m) {
|
|
5740
|
+
var S = c;
|
|
5741
|
+
return S.uuid = S.nss, S.nss = void 0, !m.tolerant && (!S.uuid || !S.uuid.match(mr)) && (S.error = S.error || "UUID is not valid."), S;
|
|
5762
5742
|
},
|
|
5763
|
-
serialize: function(c,
|
|
5764
|
-
var
|
|
5765
|
-
return
|
|
5743
|
+
serialize: function(c, m) {
|
|
5744
|
+
var S = c;
|
|
5745
|
+
return S.nss = (c.uuid || "").toLowerCase(), S;
|
|
5766
5746
|
}
|
|
5767
5747
|
};
|
|
5768
|
-
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize =
|
|
5748
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5769
5749
|
});
|
|
5770
5750
|
})(uri_all, uri_all.exports);
|
|
5771
5751
|
var uri_allExports = uri_all.exports;
|
|
@@ -5793,9 +5773,9 @@ uri$1.default = uri;
|
|
|
5793
5773
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5794
5774
|
return r.CodeGen;
|
|
5795
5775
|
} });
|
|
5796
|
-
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, N = (F,
|
|
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, N = (F, v) => new RegExp(F, v);
|
|
5797
5777
|
N.code = "new RegExp";
|
|
5798
|
-
const R = ["removeAdditional", "useDefaults", "coerceTypes"],
|
|
5778
|
+
const R = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5799
5779
|
"validate",
|
|
5800
5780
|
"serialize",
|
|
5801
5781
|
"parse",
|
|
@@ -5809,7 +5789,7 @@ uri$1.default = uri;
|
|
|
5809
5789
|
"func",
|
|
5810
5790
|
"obj",
|
|
5811
5791
|
"Error"
|
|
5812
|
-
]),
|
|
5792
|
+
]), y = {
|
|
5813
5793
|
errorDataPath: "",
|
|
5814
5794
|
format: "`validateFormats: false` can be used instead.",
|
|
5815
5795
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5825,23 +5805,23 @@ uri$1.default = uri;
|
|
|
5825
5805
|
cache: "Map is used as cache, schema object as key.",
|
|
5826
5806
|
serialize: "Map is used as cache, schema object as key.",
|
|
5827
5807
|
ajvErrors: "It is default now."
|
|
5828
|
-
},
|
|
5808
|
+
}, _ = {
|
|
5829
5809
|
ignoreKeywordsWithRef: "",
|
|
5830
5810
|
jsPropertySyntax: "",
|
|
5831
5811
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5832
|
-
},
|
|
5833
|
-
function
|
|
5834
|
-
var
|
|
5835
|
-
const
|
|
5812
|
+
}, g = 200;
|
|
5813
|
+
function P(F) {
|
|
5814
|
+
var v, j, b, a, h, C, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, it;
|
|
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 : N, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5836
5816
|
return {
|
|
5837
|
-
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5838
|
-
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5839
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5840
|
-
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne :
|
|
5841
|
-
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le :
|
|
5817
|
+
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && C !== void 0 ? C : !0,
|
|
5818
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5819
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5820
|
+
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5821
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
5842
5822
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5843
|
-
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt :
|
|
5844
|
-
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de :
|
|
5823
|
+
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : g,
|
|
5824
|
+
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : g,
|
|
5845
5825
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
5846
5826
|
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5847
5827
|
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
@@ -5855,44 +5835,44 @@ uri$1.default = uri;
|
|
|
5855
5835
|
};
|
|
5856
5836
|
}
|
|
5857
5837
|
class I {
|
|
5858
|
-
constructor(
|
|
5859
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5860
|
-
const { es5: j, lines:
|
|
5861
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes:
|
|
5862
|
-
const a =
|
|
5863
|
-
|
|
5838
|
+
constructor(v = {}) {
|
|
5839
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
|
|
5840
|
+
const { es5: j, lines: b } = this.opts.code;
|
|
5841
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: b }), this.logger = K(v.logger);
|
|
5842
|
+
const a = v.validateFormats;
|
|
5843
|
+
v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, y, v, "NOT SUPPORTED"), D.call(this, _, v, "DEPRECATED", "warn"), this._metaOpts = x.call(this), v.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && V.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), k.call(this), v.validateFormats = a;
|
|
5864
5844
|
}
|
|
5865
5845
|
_addVocabularies() {
|
|
5866
5846
|
this.addKeyword("$async");
|
|
5867
5847
|
}
|
|
5868
5848
|
_addDefaultMetaSchema() {
|
|
5869
|
-
const { $data:
|
|
5849
|
+
const { $data: v, meta: j, schemaId: b } = this.opts;
|
|
5870
5850
|
let a = $;
|
|
5871
|
-
|
|
5851
|
+
b === "id" && (a = { ...$ }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[b], !1);
|
|
5872
5852
|
}
|
|
5873
5853
|
defaultMeta() {
|
|
5874
|
-
const { meta:
|
|
5875
|
-
return this.opts.defaultMeta = typeof
|
|
5876
|
-
}
|
|
5877
|
-
validate(
|
|
5878
|
-
let
|
|
5879
|
-
if (typeof
|
|
5880
|
-
if (
|
|
5881
|
-
throw new Error(`no schema with key or ref "${
|
|
5854
|
+
const { meta: v, schemaId: j } = this.opts;
|
|
5855
|
+
return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
|
|
5856
|
+
}
|
|
5857
|
+
validate(v, j) {
|
|
5858
|
+
let b;
|
|
5859
|
+
if (typeof v == "string") {
|
|
5860
|
+
if (b = this.getSchema(v), !b)
|
|
5861
|
+
throw new Error(`no schema with key or ref "${v}"`);
|
|
5882
5862
|
} else
|
|
5883
|
-
|
|
5884
|
-
const a =
|
|
5885
|
-
return "$async" in
|
|
5863
|
+
b = this.compile(v);
|
|
5864
|
+
const a = b(j);
|
|
5865
|
+
return "$async" in b || (this.errors = b.errors), a;
|
|
5886
5866
|
}
|
|
5887
|
-
compile(
|
|
5888
|
-
const
|
|
5889
|
-
return
|
|
5867
|
+
compile(v, j) {
|
|
5868
|
+
const b = this._addSchema(v, j);
|
|
5869
|
+
return b.validate || this._compileSchemaEnv(b);
|
|
5890
5870
|
}
|
|
5891
|
-
compileAsync(
|
|
5871
|
+
compileAsync(v, j) {
|
|
5892
5872
|
if (typeof this.opts.loadSchema != "function")
|
|
5893
5873
|
throw new Error("options.loadSchema should be a function");
|
|
5894
|
-
const { loadSchema:
|
|
5895
|
-
return a.call(this,
|
|
5874
|
+
const { loadSchema: b } = this.opts;
|
|
5875
|
+
return a.call(this, v, j);
|
|
5896
5876
|
async function a(G, ne) {
|
|
5897
5877
|
await h.call(this, G.$schema);
|
|
5898
5878
|
const he = this._addSchema(G, ne);
|
|
@@ -5923,42 +5903,42 @@ uri$1.default = uri;
|
|
|
5923
5903
|
if (ne)
|
|
5924
5904
|
return ne;
|
|
5925
5905
|
try {
|
|
5926
|
-
return await (this._loading[G] =
|
|
5906
|
+
return await (this._loading[G] = b(G));
|
|
5927
5907
|
} finally {
|
|
5928
5908
|
delete this._loading[G];
|
|
5929
5909
|
}
|
|
5930
5910
|
}
|
|
5931
5911
|
}
|
|
5932
5912
|
// Adds schema to the instance
|
|
5933
|
-
addSchema(
|
|
5934
|
-
if (Array.isArray(
|
|
5935
|
-
for (const C of
|
|
5936
|
-
this.addSchema(C, void 0,
|
|
5913
|
+
addSchema(v, j, b, a = this.opts.validateSchema) {
|
|
5914
|
+
if (Array.isArray(v)) {
|
|
5915
|
+
for (const C of v)
|
|
5916
|
+
this.addSchema(C, void 0, b, a);
|
|
5937
5917
|
return this;
|
|
5938
5918
|
}
|
|
5939
5919
|
let h;
|
|
5940
|
-
if (typeof
|
|
5920
|
+
if (typeof v == "object") {
|
|
5941
5921
|
const { schemaId: C } = this.opts;
|
|
5942
|
-
if (h =
|
|
5922
|
+
if (h = v[C], h !== void 0 && typeof h != "string")
|
|
5943
5923
|
throw new Error(`schema ${C} must be string`);
|
|
5944
5924
|
}
|
|
5945
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
5925
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, b, j, a, !0), this;
|
|
5946
5926
|
}
|
|
5947
5927
|
// Add schema that will be used to validate other schemas
|
|
5948
5928
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5949
|
-
addMetaSchema(
|
|
5950
|
-
return this.addSchema(
|
|
5929
|
+
addMetaSchema(v, j, b = this.opts.validateSchema) {
|
|
5930
|
+
return this.addSchema(v, j, !0, b), this;
|
|
5951
5931
|
}
|
|
5952
5932
|
// Validate schema against its meta-schema
|
|
5953
|
-
validateSchema(
|
|
5954
|
-
if (typeof
|
|
5933
|
+
validateSchema(v, j) {
|
|
5934
|
+
if (typeof v == "boolean")
|
|
5955
5935
|
return !0;
|
|
5956
|
-
let
|
|
5957
|
-
if (
|
|
5936
|
+
let b;
|
|
5937
|
+
if (b = v.$schema, b !== void 0 && typeof b != "string")
|
|
5958
5938
|
throw new Error("$schema must be a string");
|
|
5959
|
-
if (
|
|
5939
|
+
if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
|
|
5960
5940
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5961
|
-
const a = this.validate(
|
|
5941
|
+
const a = this.validate(b, v);
|
|
5962
5942
|
if (!a && j) {
|
|
5963
5943
|
const h = "schema is invalid: " + this.errorsText();
|
|
5964
5944
|
if (this.opts.validateSchema === "log")
|
|
@@ -5970,15 +5950,15 @@ uri$1.default = uri;
|
|
|
5970
5950
|
}
|
|
5971
5951
|
// Get compiled schema by `key` or `ref`.
|
|
5972
5952
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5973
|
-
getSchema(
|
|
5953
|
+
getSchema(v) {
|
|
5974
5954
|
let j;
|
|
5975
|
-
for (; typeof (j = w.call(this,
|
|
5976
|
-
|
|
5955
|
+
for (; typeof (j = w.call(this, v)) == "string"; )
|
|
5956
|
+
v = j;
|
|
5977
5957
|
if (j === void 0) {
|
|
5978
|
-
const { schemaId:
|
|
5979
|
-
if (j = o.resolveSchema.call(this, a,
|
|
5958
|
+
const { schemaId: b } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: b });
|
|
5959
|
+
if (j = o.resolveSchema.call(this, a, v), !j)
|
|
5980
5960
|
return;
|
|
5981
|
-
this.refs[
|
|
5961
|
+
this.refs[v] = j;
|
|
5982
5962
|
}
|
|
5983
5963
|
return j.validate || this._compileSchemaEnv(j);
|
|
5984
5964
|
}
|
|
@@ -5986,138 +5966,138 @@ uri$1.default = uri;
|
|
|
5986
5966
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5987
5967
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5988
5968
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5989
|
-
removeSchema(
|
|
5990
|
-
if (
|
|
5991
|
-
return this._removeAllSchemas(this.schemas,
|
|
5992
|
-
switch (typeof
|
|
5969
|
+
removeSchema(v) {
|
|
5970
|
+
if (v instanceof RegExp)
|
|
5971
|
+
return this._removeAllSchemas(this.schemas, v), this._removeAllSchemas(this.refs, v), this;
|
|
5972
|
+
switch (typeof v) {
|
|
5993
5973
|
case "undefined":
|
|
5994
5974
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
5995
5975
|
case "string": {
|
|
5996
|
-
const j = w.call(this,
|
|
5997
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
5976
|
+
const j = w.call(this, v);
|
|
5977
|
+
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[v], delete this.refs[v], this;
|
|
5998
5978
|
}
|
|
5999
5979
|
case "object": {
|
|
6000
|
-
const j =
|
|
5980
|
+
const j = v;
|
|
6001
5981
|
this._cache.delete(j);
|
|
6002
|
-
let
|
|
6003
|
-
return
|
|
5982
|
+
let b = v[this.opts.schemaId];
|
|
5983
|
+
return b && (b = (0, d.normalizeId)(b), delete this.schemas[b], delete this.refs[b]), this;
|
|
6004
5984
|
}
|
|
6005
5985
|
default:
|
|
6006
5986
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
6007
5987
|
}
|
|
6008
5988
|
}
|
|
6009
5989
|
// add "vocabulary" - a collection of keywords
|
|
6010
|
-
addVocabulary(
|
|
6011
|
-
for (const j of
|
|
5990
|
+
addVocabulary(v) {
|
|
5991
|
+
for (const j of v)
|
|
6012
5992
|
this.addKeyword(j);
|
|
6013
5993
|
return this;
|
|
6014
5994
|
}
|
|
6015
|
-
addKeyword(
|
|
6016
|
-
let
|
|
6017
|
-
if (typeof
|
|
6018
|
-
|
|
6019
|
-
else if (typeof
|
|
6020
|
-
if (j =
|
|
5995
|
+
addKeyword(v, j) {
|
|
5996
|
+
let b;
|
|
5997
|
+
if (typeof v == "string")
|
|
5998
|
+
b = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = b);
|
|
5999
|
+
else if (typeof v == "object" && j === void 0) {
|
|
6000
|
+
if (j = v, b = j.keyword, Array.isArray(b) && !b.length)
|
|
6021
6001
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6022
6002
|
} else
|
|
6023
6003
|
throw new Error("invalid addKeywords parameters");
|
|
6024
|
-
if (oe.call(this,
|
|
6025
|
-
return (0, p.eachItem)(
|
|
6004
|
+
if (oe.call(this, b, j), !j)
|
|
6005
|
+
return (0, p.eachItem)(b, (h) => ke.call(this, h)), this;
|
|
6026
6006
|
qe.call(this, j);
|
|
6027
6007
|
const a = {
|
|
6028
6008
|
...j,
|
|
6029
6009
|
type: (0, u.getJSONTypes)(j.type),
|
|
6030
6010
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6031
6011
|
};
|
|
6032
|
-
return (0, p.eachItem)(
|
|
6012
|
+
return (0, p.eachItem)(b, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((C) => ke.call(this, h, a, C))), this;
|
|
6033
6013
|
}
|
|
6034
|
-
getKeyword(
|
|
6035
|
-
const j = this.RULES.all[
|
|
6014
|
+
getKeyword(v) {
|
|
6015
|
+
const j = this.RULES.all[v];
|
|
6036
6016
|
return typeof j == "object" ? j.definition : !!j;
|
|
6037
6017
|
}
|
|
6038
6018
|
// Remove keyword
|
|
6039
|
-
removeKeyword(
|
|
6019
|
+
removeKeyword(v) {
|
|
6040
6020
|
const { RULES: j } = this;
|
|
6041
|
-
delete j.keywords[
|
|
6042
|
-
for (const
|
|
6043
|
-
const a =
|
|
6044
|
-
a >= 0 &&
|
|
6021
|
+
delete j.keywords[v], delete j.all[v];
|
|
6022
|
+
for (const b of j.rules) {
|
|
6023
|
+
const a = b.rules.findIndex((h) => h.keyword === v);
|
|
6024
|
+
a >= 0 && b.rules.splice(a, 1);
|
|
6045
6025
|
}
|
|
6046
6026
|
return this;
|
|
6047
6027
|
}
|
|
6048
6028
|
// Add format
|
|
6049
|
-
addFormat(
|
|
6050
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6029
|
+
addFormat(v, j) {
|
|
6030
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
|
|
6051
6031
|
}
|
|
6052
|
-
errorsText(
|
|
6053
|
-
return !
|
|
6032
|
+
errorsText(v = this.errors, { separator: j = ", ", dataVar: b = "data" } = {}) {
|
|
6033
|
+
return !v || v.length === 0 ? "No errors" : v.map((a) => `${b}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6054
6034
|
}
|
|
6055
|
-
$dataMetaSchema(
|
|
6056
|
-
const
|
|
6057
|
-
|
|
6035
|
+
$dataMetaSchema(v, j) {
|
|
6036
|
+
const b = this.RULES.all;
|
|
6037
|
+
v = JSON.parse(JSON.stringify(v));
|
|
6058
6038
|
for (const a of j) {
|
|
6059
6039
|
const h = a.split("/").slice(1);
|
|
6060
|
-
let C =
|
|
6040
|
+
let C = v;
|
|
6061
6041
|
for (const M of h)
|
|
6062
6042
|
C = C[M];
|
|
6063
|
-
for (const M in
|
|
6064
|
-
const q =
|
|
6043
|
+
for (const M in b) {
|
|
6044
|
+
const q = b[M];
|
|
6065
6045
|
if (typeof q != "object")
|
|
6066
6046
|
continue;
|
|
6067
6047
|
const { $data: W } = q.definition, G = C[M];
|
|
6068
6048
|
W && G && (C[M] = Ue(G));
|
|
6069
6049
|
}
|
|
6070
6050
|
}
|
|
6071
|
-
return
|
|
6051
|
+
return v;
|
|
6072
6052
|
}
|
|
6073
|
-
_removeAllSchemas(
|
|
6074
|
-
for (const
|
|
6075
|
-
const a =
|
|
6076
|
-
(!j || j.test(
|
|
6053
|
+
_removeAllSchemas(v, j) {
|
|
6054
|
+
for (const b in v) {
|
|
6055
|
+
const a = v[b];
|
|
6056
|
+
(!j || j.test(b)) && (typeof a == "string" ? delete v[b] : a && !a.meta && (this._cache.delete(a.schema), delete v[b]));
|
|
6077
6057
|
}
|
|
6078
6058
|
}
|
|
6079
|
-
_addSchema(
|
|
6059
|
+
_addSchema(v, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6080
6060
|
let C;
|
|
6081
6061
|
const { schemaId: M } = this.opts;
|
|
6082
|
-
if (typeof
|
|
6083
|
-
C =
|
|
6062
|
+
if (typeof v == "object")
|
|
6063
|
+
C = v[M];
|
|
6084
6064
|
else {
|
|
6085
6065
|
if (this.opts.jtd)
|
|
6086
6066
|
throw new Error("schema must be object");
|
|
6087
|
-
if (typeof
|
|
6067
|
+
if (typeof v != "boolean")
|
|
6088
6068
|
throw new Error("schema must be object or boolean");
|
|
6089
6069
|
}
|
|
6090
|
-
let q = this._cache.get(
|
|
6070
|
+
let q = this._cache.get(v);
|
|
6091
6071
|
if (q !== void 0)
|
|
6092
6072
|
return q;
|
|
6093
|
-
|
|
6094
|
-
const W = d.getSchemaRefs.call(this,
|
|
6095
|
-
return q = new o.SchemaEnv({ schema:
|
|
6073
|
+
b = (0, d.normalizeId)(C || b);
|
|
6074
|
+
const W = d.getSchemaRefs.call(this, v, b);
|
|
6075
|
+
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(q.schema, q), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = q), a && this.validateSchema(v, !0), q;
|
|
6096
6076
|
}
|
|
6097
|
-
_checkUnique(
|
|
6098
|
-
if (this.schemas[
|
|
6099
|
-
throw new Error(`schema with key or id "${
|
|
6077
|
+
_checkUnique(v) {
|
|
6078
|
+
if (this.schemas[v] || this.refs[v])
|
|
6079
|
+
throw new Error(`schema with key or id "${v}" already exists`);
|
|
6100
6080
|
}
|
|
6101
|
-
_compileSchemaEnv(
|
|
6102
|
-
if (
|
|
6081
|
+
_compileSchemaEnv(v) {
|
|
6082
|
+
if (v.meta ? this._compileMetaSchema(v) : o.compileSchema.call(this, v), !v.validate)
|
|
6103
6083
|
throw new Error("ajv implementation error");
|
|
6104
|
-
return
|
|
6084
|
+
return v.validate;
|
|
6105
6085
|
}
|
|
6106
|
-
_compileMetaSchema(
|
|
6086
|
+
_compileMetaSchema(v) {
|
|
6107
6087
|
const j = this.opts;
|
|
6108
6088
|
this.opts = this._metaOpts;
|
|
6109
6089
|
try {
|
|
6110
|
-
o.compileSchema.call(this,
|
|
6090
|
+
o.compileSchema.call(this, v);
|
|
6111
6091
|
} finally {
|
|
6112
6092
|
this.opts = j;
|
|
6113
6093
|
}
|
|
6114
6094
|
}
|
|
6115
6095
|
}
|
|
6116
6096
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6117
|
-
function D(F,
|
|
6097
|
+
function D(F, v, j, b = "error") {
|
|
6118
6098
|
for (const a in F) {
|
|
6119
6099
|
const h = a;
|
|
6120
|
-
h in
|
|
6100
|
+
h in v && this.logger[b](`${j}: option ${a}. ${F[h]}`);
|
|
6121
6101
|
}
|
|
6122
6102
|
}
|
|
6123
6103
|
function w(F) {
|
|
@@ -6129,13 +6109,13 @@ uri$1.default = uri;
|
|
|
6129
6109
|
if (Array.isArray(F))
|
|
6130
6110
|
this.addSchema(F);
|
|
6131
6111
|
else
|
|
6132
|
-
for (const
|
|
6133
|
-
this.addSchema(F[
|
|
6112
|
+
for (const v in F)
|
|
6113
|
+
this.addSchema(F[v], v);
|
|
6134
6114
|
}
|
|
6135
6115
|
function A() {
|
|
6136
6116
|
for (const F in this.opts.formats) {
|
|
6137
|
-
const
|
|
6138
|
-
|
|
6117
|
+
const v = this.opts.formats[F];
|
|
6118
|
+
v && this.addFormat(F, v);
|
|
6139
6119
|
}
|
|
6140
6120
|
}
|
|
6141
6121
|
function V(F) {
|
|
@@ -6144,15 +6124,15 @@ uri$1.default = uri;
|
|
|
6144
6124
|
return;
|
|
6145
6125
|
}
|
|
6146
6126
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6147
|
-
for (const
|
|
6148
|
-
const j = F[
|
|
6149
|
-
j.keyword || (j.keyword =
|
|
6127
|
+
for (const v in F) {
|
|
6128
|
+
const j = F[v];
|
|
6129
|
+
j.keyword || (j.keyword = v), this.addKeyword(j);
|
|
6150
6130
|
}
|
|
6151
6131
|
}
|
|
6152
6132
|
function x() {
|
|
6153
6133
|
const F = { ...this.opts };
|
|
6154
|
-
for (const
|
|
6155
|
-
delete F[
|
|
6134
|
+
for (const v of R)
|
|
6135
|
+
delete F[v];
|
|
6156
6136
|
return F;
|
|
6157
6137
|
}
|
|
6158
6138
|
const re = { log() {
|
|
@@ -6169,42 +6149,42 @@ uri$1.default = uri;
|
|
|
6169
6149
|
throw new Error("logger must implement log, warn and error methods");
|
|
6170
6150
|
}
|
|
6171
6151
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6172
|
-
function oe(F,
|
|
6152
|
+
function oe(F, v) {
|
|
6173
6153
|
const { RULES: j } = this;
|
|
6174
|
-
if ((0, p.eachItem)(F, (
|
|
6175
|
-
if (j.keywords[
|
|
6176
|
-
throw new Error(`Keyword ${
|
|
6177
|
-
if (!ue.test(
|
|
6178
|
-
throw new Error(`Keyword ${
|
|
6179
|
-
}), !!
|
|
6154
|
+
if ((0, p.eachItem)(F, (b) => {
|
|
6155
|
+
if (j.keywords[b])
|
|
6156
|
+
throw new Error(`Keyword ${b} is already defined`);
|
|
6157
|
+
if (!ue.test(b))
|
|
6158
|
+
throw new Error(`Keyword ${b} has invalid name`);
|
|
6159
|
+
}), !!v && v.$data && !("code" in v || "validate" in v))
|
|
6180
6160
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6181
6161
|
}
|
|
6182
|
-
function ke(F,
|
|
6183
|
-
var
|
|
6184
|
-
const a =
|
|
6162
|
+
function ke(F, v, j) {
|
|
6163
|
+
var b;
|
|
6164
|
+
const a = v == null ? void 0 : v.post;
|
|
6185
6165
|
if (j && a)
|
|
6186
6166
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6187
6167
|
const { RULES: h } = this;
|
|
6188
6168
|
let C = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6189
|
-
if (C || (C = { type: j, rules: [] }, h.rules.push(C)), h.keywords[F] = !0, !
|
|
6169
|
+
if (C || (C = { type: j, rules: [] }, h.rules.push(C)), h.keywords[F] = !0, !v)
|
|
6190
6170
|
return;
|
|
6191
6171
|
const M = {
|
|
6192
6172
|
keyword: F,
|
|
6193
6173
|
definition: {
|
|
6194
|
-
...
|
|
6195
|
-
type: (0, u.getJSONTypes)(
|
|
6196
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6174
|
+
...v,
|
|
6175
|
+
type: (0, u.getJSONTypes)(v.type),
|
|
6176
|
+
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6197
6177
|
}
|
|
6198
6178
|
};
|
|
6199
|
-
|
|
6179
|
+
v.before ? Ce.call(this, C, M, v.before) : C.rules.push(M), h.all[F] = M, (b = v.implements) === null || b === void 0 || b.forEach((q) => this.addKeyword(q));
|
|
6200
6180
|
}
|
|
6201
|
-
function
|
|
6202
|
-
const
|
|
6203
|
-
|
|
6181
|
+
function Ce(F, v, j) {
|
|
6182
|
+
const b = F.rules.findIndex((a) => a.keyword === j);
|
|
6183
|
+
b >= 0 ? F.rules.splice(b, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
|
|
6204
6184
|
}
|
|
6205
6185
|
function qe(F) {
|
|
6206
|
-
let { metaSchema:
|
|
6207
|
-
|
|
6186
|
+
let { metaSchema: v } = F;
|
|
6187
|
+
v !== void 0 && (F.$data && this.opts.$data && (v = Ue(v)), F.validateSchema = this.compile(v, !0));
|
|
6208
6188
|
}
|
|
6209
6189
|
const et = {
|
|
6210
6190
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
@@ -6245,18 +6225,18 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6245
6225
|
return callRef(e, (0, codegen_1$l._)`${R}.validate`, u, u.$async);
|
|
6246
6226
|
}
|
|
6247
6227
|
function O(R) {
|
|
6248
|
-
const
|
|
6249
|
-
callRef(e,
|
|
6228
|
+
const T = getValidate(e, R);
|
|
6229
|
+
callRef(e, T, R, R.$async);
|
|
6250
6230
|
}
|
|
6251
6231
|
function N(R) {
|
|
6252
|
-
const
|
|
6232
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: R, code: (0, codegen_1$l.stringify)(R) } : { ref: R }), y = t.name("valid"), _ = e.subschema({
|
|
6253
6233
|
schema: R,
|
|
6254
6234
|
dataTypes: [],
|
|
6255
6235
|
schemaPath: codegen_1$l.nil,
|
|
6256
|
-
topSchemaRef:
|
|
6236
|
+
topSchemaRef: T,
|
|
6257
6237
|
errSchemaPath: r
|
|
6258
|
-
},
|
|
6259
|
-
e.mergeEvaluated(
|
|
6238
|
+
}, y);
|
|
6239
|
+
e.mergeEvaluated(_), e.ok(y);
|
|
6260
6240
|
}
|
|
6261
6241
|
}
|
|
6262
6242
|
};
|
|
@@ -6274,35 +6254,35 @@ function callRef(e, t, r, n) {
|
|
|
6274
6254
|
const R = s.let("valid");
|
|
6275
6255
|
s.try(() => {
|
|
6276
6256
|
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), N(t), o || s.assign(R, !0);
|
|
6277
|
-
}, (
|
|
6278
|
-
s.if((0, codegen_1$l._)`!(${
|
|
6257
|
+
}, (T) => {
|
|
6258
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(R, !1);
|
|
6279
6259
|
}), e.ok(R);
|
|
6280
6260
|
}
|
|
6281
6261
|
function $() {
|
|
6282
6262
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => N(t), () => O(t));
|
|
6283
6263
|
}
|
|
6284
6264
|
function O(R) {
|
|
6285
|
-
const
|
|
6286
|
-
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${
|
|
6265
|
+
const T = (0, codegen_1$l._)`${R}.errors`;
|
|
6266
|
+
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6287
6267
|
}
|
|
6288
6268
|
function N(R) {
|
|
6289
|
-
var
|
|
6269
|
+
var T;
|
|
6290
6270
|
if (!i.opts.unevaluated)
|
|
6291
6271
|
return;
|
|
6292
|
-
const
|
|
6272
|
+
const y = (T = r == null ? void 0 : r.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
6293
6273
|
if (i.props !== !0)
|
|
6294
|
-
if (
|
|
6295
|
-
|
|
6274
|
+
if (y && !y.dynamicProps)
|
|
6275
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6296
6276
|
else {
|
|
6297
|
-
const
|
|
6298
|
-
i.props = util_1$j.mergeEvaluated.props(s,
|
|
6277
|
+
const _ = s.var("props", (0, codegen_1$l._)`${R}.evaluated.props`);
|
|
6278
|
+
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6299
6279
|
}
|
|
6300
6280
|
if (i.items !== !0)
|
|
6301
|
-
if (
|
|
6302
|
-
|
|
6281
|
+
if (y && !y.dynamicItems)
|
|
6282
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6303
6283
|
else {
|
|
6304
|
-
const
|
|
6305
|
-
i.items = util_1$j.mergeEvaluated.items(s,
|
|
6284
|
+
const _ = s.var("items", (0, codegen_1$l._)`${R}.evaluated.items`);
|
|
6285
|
+
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
6306
6286
|
}
|
|
6307
6287
|
}
|
|
6308
6288
|
}
|
|
@@ -6444,10 +6424,10 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6444
6424
|
const d = r.length >= l.loopRequired;
|
|
6445
6425
|
if (o.allErrors ? u() : p(), l.strictRequired) {
|
|
6446
6426
|
const N = e.parentSchema.properties, { definedProperties: R } = e.it;
|
|
6447
|
-
for (const
|
|
6448
|
-
if ((N == null ? void 0 : N[
|
|
6449
|
-
const
|
|
6450
|
-
(0, util_1$h.checkStrictMode)(o,
|
|
6427
|
+
for (const T of r)
|
|
6428
|
+
if ((N == null ? void 0 : N[T]) === void 0 && !R.has(T)) {
|
|
6429
|
+
const y = o.schemaEnv.baseId + o.errSchemaPath, _ = `required property "${T}" is not defined at "${y}" (strictRequired)`;
|
|
6430
|
+
(0, util_1$h.checkStrictMode)(o, _, o.opts.strictRequired);
|
|
6451
6431
|
}
|
|
6452
6432
|
}
|
|
6453
6433
|
function u() {
|
|
@@ -6522,24 +6502,24 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6522
6502
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6523
6503
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6524
6504
|
function p() {
|
|
6525
|
-
const R = t.let("i", (0, codegen_1$d._)`${r}.length`),
|
|
6526
|
-
e.setParams({ i: R, j:
|
|
6505
|
+
const R = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6506
|
+
e.setParams({ i: R, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${R} > 1`, () => ($() ? O : N)(R, T));
|
|
6527
6507
|
}
|
|
6528
6508
|
function $() {
|
|
6529
6509
|
return u.length > 0 && !u.some((R) => R === "object" || R === "array");
|
|
6530
6510
|
}
|
|
6531
|
-
function O(R,
|
|
6532
|
-
const
|
|
6511
|
+
function O(R, T) {
|
|
6512
|
+
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._)`{}`);
|
|
6533
6513
|
t.for((0, codegen_1$d._)`;${R}--;`, () => {
|
|
6534
|
-
t.let(
|
|
6535
|
-
t.assign(
|
|
6536
|
-
}).code((0, codegen_1$d._)`${
|
|
6514
|
+
t.let(y, (0, codegen_1$d._)`${r}[${R}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${g}[${y}] == "number"`, () => {
|
|
6515
|
+
t.assign(T, (0, codegen_1$d._)`${g}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6516
|
+
}).code((0, codegen_1$d._)`${g}[${y}] = ${R}`);
|
|
6537
6517
|
});
|
|
6538
6518
|
}
|
|
6539
|
-
function N(R,
|
|
6540
|
-
const
|
|
6541
|
-
t.label(
|
|
6542
|
-
e.error(), t.assign(d, !1).break(
|
|
6519
|
+
function N(R, T) {
|
|
6520
|
+
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6521
|
+
t.label(_).for((0, codegen_1$d._)`;${R}--;`, () => t.for((0, codegen_1$d._)`${T} = ${R}; ${T}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${R}], ${r}[${T}])`, () => {
|
|
6522
|
+
e.error(), t.assign(d, !1).break(_);
|
|
6543
6523
|
})));
|
|
6544
6524
|
}
|
|
6545
6525
|
}
|
|
@@ -6584,15 +6564,15 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6584
6564
|
if (!Array.isArray(s))
|
|
6585
6565
|
throw new Error("ajv implementation error");
|
|
6586
6566
|
const N = t.const("vSchema", i);
|
|
6587
|
-
p = (0, codegen_1$b.or)(...s.map((R,
|
|
6567
|
+
p = (0, codegen_1$b.or)(...s.map((R, T) => O(N, T)));
|
|
6588
6568
|
}
|
|
6589
6569
|
e.pass(p);
|
|
6590
6570
|
function $() {
|
|
6591
6571
|
t.assign(p, !1), t.forOf("v", i, (N) => t.if((0, codegen_1$b._)`${u()}(${r}, ${N})`, () => t.assign(p, !0).break()));
|
|
6592
6572
|
}
|
|
6593
6573
|
function O(N, R) {
|
|
6594
|
-
const
|
|
6595
|
-
return typeof
|
|
6574
|
+
const T = s[R];
|
|
6575
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${N}[${R}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6596
6576
|
}
|
|
6597
6577
|
}
|
|
6598
6578
|
};
|
|
@@ -6684,10 +6664,10 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6684
6664
|
}, d)), e.ok(d));
|
|
6685
6665
|
});
|
|
6686
6666
|
function p($) {
|
|
6687
|
-
const { opts: O, errSchemaPath: N } = l, R = r.length,
|
|
6688
|
-
if (O.strictTuples && !
|
|
6689
|
-
const
|
|
6690
|
-
(0, util_1$c.checkStrictMode)(l,
|
|
6667
|
+
const { opts: O, errSchemaPath: N } = l, R = r.length, T = R === $.minItems && (R === $.maxItems || $[t] === !1);
|
|
6668
|
+
if (O.strictTuples && !T) {
|
|
6669
|
+
const y = `"${o}" is ${R}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;
|
|
6670
|
+
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
6691
6671
|
}
|
|
6692
6672
|
}
|
|
6693
6673
|
}
|
|
@@ -6746,29 +6726,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6746
6726
|
return;
|
|
6747
6727
|
}
|
|
6748
6728
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
6749
|
-
let
|
|
6750
|
-
l !== void 0 && (
|
|
6729
|
+
let T = (0, codegen_1$7._)`${p} >= ${o}`;
|
|
6730
|
+
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${p} <= ${l}`), e.pass(T);
|
|
6751
6731
|
return;
|
|
6752
6732
|
}
|
|
6753
6733
|
i.items = !0;
|
|
6754
6734
|
const $ = t.name("valid");
|
|
6755
6735
|
l === void 0 && o === 1 ? N($, () => 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());
|
|
6756
6736
|
function O() {
|
|
6757
|
-
const
|
|
6758
|
-
N(
|
|
6737
|
+
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6738
|
+
N(T, () => t.if(T, () => R(y)));
|
|
6759
6739
|
}
|
|
6760
|
-
function N(
|
|
6761
|
-
t.forRange("i", 0, p, (
|
|
6740
|
+
function N(T, y) {
|
|
6741
|
+
t.forRange("i", 0, p, (_) => {
|
|
6762
6742
|
e.subschema({
|
|
6763
6743
|
keyword: "contains",
|
|
6764
|
-
dataProp:
|
|
6744
|
+
dataProp: _,
|
|
6765
6745
|
dataPropType: util_1$a.Type.Num,
|
|
6766
6746
|
compositeRule: !0
|
|
6767
|
-
},
|
|
6747
|
+
}, T), y();
|
|
6768
6748
|
});
|
|
6769
6749
|
}
|
|
6770
|
-
function R(
|
|
6771
|
-
t.code((0, codegen_1$7._)`${
|
|
6750
|
+
function R(T) {
|
|
6751
|
+
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)));
|
|
6772
6752
|
}
|
|
6773
6753
|
}
|
|
6774
6754
|
};
|
|
@@ -6814,29 +6794,29 @@ var dependencies = {};
|
|
|
6814
6794
|
return;
|
|
6815
6795
|
const N = p.let("missing");
|
|
6816
6796
|
for (const R in u) {
|
|
6817
|
-
const
|
|
6818
|
-
if (
|
|
6797
|
+
const T = u[R];
|
|
6798
|
+
if (T.length === 0)
|
|
6819
6799
|
continue;
|
|
6820
|
-
const
|
|
6800
|
+
const y = (0, n.propertyInData)(p, $, R, O.opts.ownProperties);
|
|
6821
6801
|
d.setParams({
|
|
6822
6802
|
property: R,
|
|
6823
|
-
depsCount:
|
|
6824
|
-
deps:
|
|
6825
|
-
}), O.allErrors ? p.if(
|
|
6826
|
-
for (const
|
|
6827
|
-
(0, n.checkReportMissingProp)(d,
|
|
6828
|
-
}) : (p.if((0, t._)`${
|
|
6803
|
+
depsCount: T.length,
|
|
6804
|
+
deps: T.join(", ")
|
|
6805
|
+
}), O.allErrors ? p.if(y, () => {
|
|
6806
|
+
for (const _ of T)
|
|
6807
|
+
(0, n.checkReportMissingProp)(d, _);
|
|
6808
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, T, N)})`), (0, n.reportMissingProp)(d, N), p.else());
|
|
6829
6809
|
}
|
|
6830
6810
|
}
|
|
6831
6811
|
e.validatePropertyDeps = o;
|
|
6832
6812
|
function l(d, u = d.schema) {
|
|
6833
6813
|
const { gen: p, data: $, keyword: O, it: N } = d, R = p.name("valid");
|
|
6834
|
-
for (const
|
|
6835
|
-
(0, r.alwaysValidSchema)(N, u[
|
|
6836
|
-
(0, n.propertyInData)(p, $,
|
|
6814
|
+
for (const T in u)
|
|
6815
|
+
(0, r.alwaysValidSchema)(N, u[T]) || (p.if(
|
|
6816
|
+
(0, n.propertyInData)(p, $, T, N.opts.ownProperties),
|
|
6837
6817
|
() => {
|
|
6838
|
-
const
|
|
6839
|
-
d.mergeValidEvaluated(
|
|
6818
|
+
const y = d.subschema({ keyword: O, schemaProp: T }, R);
|
|
6819
|
+
d.mergeValidEvaluated(y, R);
|
|
6840
6820
|
},
|
|
6841
6821
|
() => p.var(R, !0)
|
|
6842
6822
|
// TODO var
|
|
@@ -6895,49 +6875,49 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6895
6875
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6896
6876
|
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6897
6877
|
function $() {
|
|
6898
|
-
t.forIn("key", s, (
|
|
6899
|
-
!u.length && !p.length ? R(
|
|
6878
|
+
t.forIn("key", s, (y) => {
|
|
6879
|
+
!u.length && !p.length ? R(y) : t.if(O(y), () => R(y));
|
|
6900
6880
|
});
|
|
6901
6881
|
}
|
|
6902
|
-
function O(
|
|
6903
|
-
let
|
|
6882
|
+
function O(y) {
|
|
6883
|
+
let _;
|
|
6904
6884
|
if (u.length > 8) {
|
|
6905
|
-
const
|
|
6906
|
-
|
|
6885
|
+
const g = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6886
|
+
_ = (0, code_1$3.isOwnProperty)(t, g, y);
|
|
6907
6887
|
} else
|
|
6908
|
-
u.length ?
|
|
6909
|
-
return p.length && (
|
|
6888
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map((g) => (0, codegen_1$5._)`${y} === ${g}`)) : _ = codegen_1$5.nil;
|
|
6889
|
+
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)(_);
|
|
6910
6890
|
}
|
|
6911
|
-
function N(
|
|
6912
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6891
|
+
function N(y) {
|
|
6892
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6913
6893
|
}
|
|
6914
|
-
function R(
|
|
6894
|
+
function R(y) {
|
|
6915
6895
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6916
|
-
N(
|
|
6896
|
+
N(y);
|
|
6917
6897
|
return;
|
|
6918
6898
|
}
|
|
6919
6899
|
if (r === !1) {
|
|
6920
|
-
e.setParams({ additionalProperty:
|
|
6900
|
+
e.setParams({ additionalProperty: y }), e.error(), l || t.break();
|
|
6921
6901
|
return;
|
|
6922
6902
|
}
|
|
6923
6903
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6924
|
-
const
|
|
6925
|
-
d.removeAdditional === "failing" ? (
|
|
6926
|
-
e.reset(), N(
|
|
6927
|
-
})) : (
|
|
6904
|
+
const _ = t.name("valid");
|
|
6905
|
+
d.removeAdditional === "failing" ? (T(y, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6906
|
+
e.reset(), N(y);
|
|
6907
|
+
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6928
6908
|
}
|
|
6929
6909
|
}
|
|
6930
|
-
function
|
|
6931
|
-
const
|
|
6910
|
+
function T(y, _, g) {
|
|
6911
|
+
const P = {
|
|
6932
6912
|
keyword: "additionalProperties",
|
|
6933
|
-
dataProp:
|
|
6913
|
+
dataProp: y,
|
|
6934
6914
|
dataPropType: util_1$8.Type.Str
|
|
6935
6915
|
};
|
|
6936
|
-
|
|
6916
|
+
g === !1 && Object.assign(P, {
|
|
6937
6917
|
compositeRule: !0,
|
|
6938
6918
|
createErrors: !1,
|
|
6939
6919
|
allErrors: !1
|
|
6940
|
-
}), e.subschema(
|
|
6920
|
+
}), e.subschema(P, _);
|
|
6941
6921
|
}
|
|
6942
6922
|
}
|
|
6943
6923
|
};
|
|
@@ -6981,7 +6961,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6981
6961
|
type: "object",
|
|
6982
6962
|
schemaType: "object",
|
|
6983
6963
|
code(e) {
|
|
6984
|
-
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, l = (0, code_1$1.allSchemaProperties)(r), d = l.filter((
|
|
6964
|
+
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, l = (0, code_1$1.allSchemaProperties)(r), d = l.filter((T) => (0, util_1$6.alwaysValidSchema)(i, r[T]));
|
|
6985
6965
|
if (l.length === 0 || d.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
6986
6966
|
return;
|
|
6987
6967
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
@@ -6989,23 +6969,23 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6989
6969
|
const { props: $ } = i;
|
|
6990
6970
|
O();
|
|
6991
6971
|
function O() {
|
|
6992
|
-
for (const
|
|
6993
|
-
u && N(
|
|
6994
|
-
}
|
|
6995
|
-
function N(
|
|
6996
|
-
for (const
|
|
6997
|
-
new RegExp(
|
|
6998
|
-
}
|
|
6999
|
-
function R(
|
|
7000
|
-
t.forIn("key", n, (
|
|
7001
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e,
|
|
7002
|
-
const
|
|
7003
|
-
|
|
6972
|
+
for (const T of l)
|
|
6973
|
+
u && N(T), i.allErrors ? R(T) : (t.var(p, !0), R(T), t.if(p));
|
|
6974
|
+
}
|
|
6975
|
+
function N(T) {
|
|
6976
|
+
for (const y in u)
|
|
6977
|
+
new RegExp(T).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6978
|
+
}
|
|
6979
|
+
function R(T) {
|
|
6980
|
+
t.forIn("key", n, (y) => {
|
|
6981
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${y})`, () => {
|
|
6982
|
+
const _ = d.includes(T);
|
|
6983
|
+
_ || e.subschema({
|
|
7004
6984
|
keyword: "patternProperties",
|
|
7005
|
-
schemaProp:
|
|
7006
|
-
dataProp:
|
|
6985
|
+
schemaProp: T,
|
|
6986
|
+
dataProp: y,
|
|
7007
6987
|
dataPropType: util_2.Type.Str
|
|
7008
|
-
}, p), i.opts.unevaluated && $ !== !0 ? t.assign((0, codegen_1$4._)`${$}[${
|
|
6988
|
+
}, p), i.opts.unevaluated && $ !== !0 ? t.assign((0, codegen_1$4._)`${$}[${y}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7009
6989
|
});
|
|
7010
6990
|
});
|
|
7011
6991
|
}
|
|
@@ -7193,27 +7173,27 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7193
7173
|
const R = r.scopeValue("formats", {
|
|
7194
7174
|
ref: $.formats,
|
|
7195
7175
|
code: d.code.formats
|
|
7196
|
-
}),
|
|
7197
|
-
r.if((0, codegen_1$1._)`typeof ${
|
|
7198
|
-
function
|
|
7199
|
-
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${
|
|
7176
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${R}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7177
|
+
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
|
+
function g() {
|
|
7179
|
+
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
7200
7180
|
}
|
|
7201
|
-
function
|
|
7202
|
-
const I = p.$async ? (0, codegen_1$1._)`(${
|
|
7203
|
-
return (0, codegen_1$1._)`${
|
|
7181
|
+
function P() {
|
|
7182
|
+
const I = p.$async ? (0, codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))` : (0, codegen_1$1._)`${_}(${n})`, D = (0, codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;
|
|
7183
|
+
return (0, codegen_1$1._)`${_} && ${_} !== true && ${y} === ${t} && !${D}`;
|
|
7204
7184
|
}
|
|
7205
7185
|
}
|
|
7206
7186
|
function N() {
|
|
7207
7187
|
const R = $.formats[i];
|
|
7208
7188
|
if (!R) {
|
|
7209
|
-
|
|
7189
|
+
g();
|
|
7210
7190
|
return;
|
|
7211
7191
|
}
|
|
7212
7192
|
if (R === !0)
|
|
7213
7193
|
return;
|
|
7214
|
-
const [
|
|
7215
|
-
|
|
7216
|
-
function
|
|
7194
|
+
const [T, y, _] = P(R);
|
|
7195
|
+
T === t && e.pass(I());
|
|
7196
|
+
function g() {
|
|
7217
7197
|
if (d.strictSchema === !1) {
|
|
7218
7198
|
$.logger.warn(D());
|
|
7219
7199
|
return;
|
|
@@ -7223,7 +7203,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7223
7203
|
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7224
7204
|
}
|
|
7225
7205
|
}
|
|
7226
|
-
function
|
|
7206
|
+
function P(D) {
|
|
7227
7207
|
const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, k = r.scopeValue("formats", { key: i, ref: D, code: w });
|
|
7228
7208
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
7229
7209
|
}
|
|
@@ -7231,9 +7211,9 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7231
7211
|
if (typeof R == "object" && !(R instanceof RegExp) && R.async) {
|
|
7232
7212
|
if (!p.$async)
|
|
7233
7213
|
throw new Error("async format in sync schema");
|
|
7234
|
-
return (0, codegen_1$1._)`await ${
|
|
7214
|
+
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7235
7215
|
}
|
|
7236
|
-
return typeof
|
|
7216
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${_}(${n})` : (0, codegen_1$1._)`${_}.test(${n})`;
|
|
7237
7217
|
}
|
|
7238
7218
|
}
|
|
7239
7219
|
}
|
|
@@ -7305,37 +7285,37 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7305
7285
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7306
7286
|
}
|
|
7307
7287
|
function $(N) {
|
|
7308
|
-
const R = t.name("valid"),
|
|
7309
|
-
return e.mergeEvaluated(
|
|
7288
|
+
const R = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: N }, R);
|
|
7289
|
+
return e.mergeEvaluated(T, codegen_1.Name), R;
|
|
7310
7290
|
}
|
|
7311
7291
|
function O() {
|
|
7312
7292
|
var N;
|
|
7313
|
-
const R = {},
|
|
7314
|
-
let
|
|
7293
|
+
const R = {}, T = _(s);
|
|
7294
|
+
let y = !0;
|
|
7315
7295
|
for (let I = 0; I < o.length; I++) {
|
|
7316
7296
|
let D = o[I];
|
|
7317
7297
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7318
7298
|
const w = (N = D == null ? void 0 : D.properties) === null || N === void 0 ? void 0 : N[l];
|
|
7319
7299
|
if (typeof w != "object")
|
|
7320
7300
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7321
|
-
|
|
7301
|
+
y = y && (T || _(D)), g(w, I);
|
|
7322
7302
|
}
|
|
7323
|
-
if (!
|
|
7303
|
+
if (!y)
|
|
7324
7304
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7325
7305
|
return R;
|
|
7326
|
-
function
|
|
7306
|
+
function _({ required: I }) {
|
|
7327
7307
|
return Array.isArray(I) && I.includes(l);
|
|
7328
7308
|
}
|
|
7329
|
-
function
|
|
7309
|
+
function g(I, D) {
|
|
7330
7310
|
if (I.const)
|
|
7331
|
-
|
|
7311
|
+
P(I.const, D);
|
|
7332
7312
|
else if (I.enum)
|
|
7333
7313
|
for (const w of I.enum)
|
|
7334
|
-
|
|
7314
|
+
P(w, D);
|
|
7335
7315
|
else
|
|
7336
7316
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7337
7317
|
}
|
|
7338
|
-
function
|
|
7318
|
+
function P(I, D) {
|
|
7339
7319
|
if (typeof I != "string" || I in R)
|
|
7340
7320
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7341
7321
|
R[I] = D;
|
|
@@ -7991,7 +7971,10 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7991
7971
|
},
|
|
7992
7972
|
SupportedPHPExtensionBundle: {
|
|
7993
7973
|
type: "string",
|
|
7994
|
-
|
|
7974
|
+
enum: [
|
|
7975
|
+
"kitchen-sink",
|
|
7976
|
+
"light"
|
|
7977
|
+
]
|
|
7995
7978
|
},
|
|
7996
7979
|
StepDefinition: {
|
|
7997
7980
|
type: "object",
|
|
@@ -8204,6 +8187,36 @@ for existing apps using this option.`
|
|
|
8204
8187
|
"step"
|
|
8205
8188
|
]
|
|
8206
8189
|
},
|
|
8190
|
+
{
|
|
8191
|
+
type: "object",
|
|
8192
|
+
additionalProperties: !1,
|
|
8193
|
+
properties: {
|
|
8194
|
+
progress: {
|
|
8195
|
+
type: "object",
|
|
8196
|
+
properties: {
|
|
8197
|
+
weight: {
|
|
8198
|
+
type: "number"
|
|
8199
|
+
},
|
|
8200
|
+
caption: {
|
|
8201
|
+
type: "string"
|
|
8202
|
+
}
|
|
8203
|
+
},
|
|
8204
|
+
additionalProperties: !1
|
|
8205
|
+
},
|
|
8206
|
+
step: {
|
|
8207
|
+
type: "string",
|
|
8208
|
+
const: "importWxr"
|
|
8209
|
+
},
|
|
8210
|
+
file: {
|
|
8211
|
+
$ref: "#/definitions/FileReference",
|
|
8212
|
+
description: "The file to import"
|
|
8213
|
+
}
|
|
8214
|
+
},
|
|
8215
|
+
required: [
|
|
8216
|
+
"file",
|
|
8217
|
+
"step"
|
|
8218
|
+
]
|
|
8219
|
+
},
|
|
8207
8220
|
{
|
|
8208
8221
|
type: "object",
|
|
8209
8222
|
additionalProperties: !1,
|
|
@@ -9199,7 +9212,8 @@ for existing apps using this option.`
|
|
|
9199
9212
|
definitions
|
|
9200
9213
|
}, { wpCLI, ...otherStepHandlers } = allStepHandlers, keyedStepHandlers = {
|
|
9201
9214
|
...otherStepHandlers,
|
|
9202
|
-
"wp-cli": wpCLI
|
|
9215
|
+
"wp-cli": wpCLI,
|
|
9216
|
+
importFile: otherStepHandlers.importWxr
|
|
9203
9217
|
};
|
|
9204
9218
|
function compileBlueprint(e, {
|
|
9205
9219
|
progress: t = new ProgressTracker(),
|
|
@@ -9207,39 +9221,46 @@ function compileBlueprint(e, {
|
|
|
9207
9221
|
onStepCompleted: n = () => {
|
|
9208
9222
|
}
|
|
9209
9223
|
} = {}) {
|
|
9210
|
-
var
|
|
9211
|
-
|
|
9224
|
+
var $, O, N, R, T, y, _;
|
|
9225
|
+
e = {
|
|
9212
9226
|
...e,
|
|
9213
9227
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
9214
|
-
}
|
|
9228
|
+
};
|
|
9229
|
+
for (const g of e.steps)
|
|
9230
|
+
typeof g == "object" && g.step === "importFile" && (g.step = "importWxr", console.warn(
|
|
9231
|
+
'The "importFile" step is deprecated. Use "importWxr" instead.'
|
|
9232
|
+
));
|
|
9233
|
+
if (e.constants && e.steps.unshift({
|
|
9215
9234
|
step: "defineWpConfigConsts",
|
|
9216
9235
|
consts: e.constants
|
|
9217
9236
|
}), e.siteOptions && e.steps.unshift({
|
|
9218
9237
|
step: "setSiteOptions",
|
|
9219
9238
|
options: e.siteOptions
|
|
9220
9239
|
}), e.plugins) {
|
|
9221
|
-
const
|
|
9240
|
+
const g = e.plugins.map((P) => typeof P == "string" ? P.startsWith("https://") ? {
|
|
9222
9241
|
resource: "url",
|
|
9223
|
-
url:
|
|
9242
|
+
url: P
|
|
9224
9243
|
} : {
|
|
9225
9244
|
resource: "wordpress.org/plugins",
|
|
9226
|
-
slug:
|
|
9227
|
-
} :
|
|
9245
|
+
slug: P
|
|
9246
|
+
} : P).map((P) => ({
|
|
9228
9247
|
step: "installPlugin",
|
|
9229
|
-
pluginZipFile:
|
|
9248
|
+
pluginZipFile: P
|
|
9230
9249
|
}));
|
|
9231
|
-
e.steps.unshift(...
|
|
9250
|
+
e.steps.unshift(...g);
|
|
9232
9251
|
}
|
|
9233
9252
|
e.login && e.steps.push({
|
|
9234
9253
|
step: "login",
|
|
9235
9254
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9236
|
-
});
|
|
9237
|
-
const s = (
|
|
9238
|
-
(
|
|
9255
|
+
}), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.length === 0 && e.phpExtensionBundles.push("kitchen-sink");
|
|
9256
|
+
const s = ($ = e.steps) == null ? void 0 : $.findIndex(
|
|
9257
|
+
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "wp-cli"
|
|
9239
9258
|
);
|
|
9240
|
-
s !== void 0 && s > -1 && (e.phpExtensionBundles
|
|
9241
|
-
|
|
9242
|
-
)
|
|
9259
|
+
s !== void 0 && s > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9260
|
+
(g) => g !== "light"
|
|
9261
|
+
), console.warn(
|
|
9262
|
+
"The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9263
|
+
)), (O = e.steps) == null || O.splice(s, 0, {
|
|
9243
9264
|
step: "writeFile",
|
|
9244
9265
|
data: {
|
|
9245
9266
|
resource: "url",
|
|
@@ -9257,34 +9278,49 @@ function compileBlueprint(e, {
|
|
|
9257
9278
|
},
|
|
9258
9279
|
path: "/tmp/wp-cli.phar"
|
|
9259
9280
|
}));
|
|
9260
|
-
const
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9281
|
+
const i = (N = e.steps) == null ? void 0 : N.findIndex(
|
|
9282
|
+
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "importWxr"
|
|
9283
|
+
);
|
|
9284
|
+
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9285
|
+
(g) => g !== "light"
|
|
9286
|
+
), console.warn(
|
|
9287
|
+
"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
|
+
)), (R = e.steps) == null || R.splice(i, 0, {
|
|
9289
|
+
step: "installPlugin",
|
|
9290
|
+
pluginZipFile: {
|
|
9291
|
+
resource: "url",
|
|
9292
|
+
url: "https://playground.wordpress.net/wordpress-importer.zip",
|
|
9293
|
+
caption: "Downloading the WordPress Importer plugin"
|
|
9294
|
+
}
|
|
9295
|
+
}));
|
|
9296
|
+
const { valid: o, errors: l } = validateBlueprint(e);
|
|
9297
|
+
if (!o) {
|
|
9298
|
+
const g = new Error(
|
|
9299
|
+
`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`
|
|
9264
9300
|
);
|
|
9265
|
-
throw
|
|
9301
|
+
throw g.errors = l, g;
|
|
9266
9302
|
}
|
|
9267
|
-
const
|
|
9268
|
-
(
|
|
9269
|
-
var
|
|
9270
|
-
return
|
|
9303
|
+
const d = e.steps || [], u = d.reduce(
|
|
9304
|
+
(g, P) => {
|
|
9305
|
+
var I;
|
|
9306
|
+
return g + (((I = P.progress) == null ? void 0 : I.weight) || 1);
|
|
9271
9307
|
},
|
|
9272
9308
|
0
|
|
9273
|
-
),
|
|
9274
|
-
(
|
|
9309
|
+
), p = d.map(
|
|
9310
|
+
(g) => compileStep(g, {
|
|
9275
9311
|
semaphore: r,
|
|
9276
9312
|
rootProgressTracker: t,
|
|
9277
|
-
totalProgressWeight:
|
|
9313
|
+
totalProgressWeight: u
|
|
9278
9314
|
})
|
|
9279
9315
|
);
|
|
9280
9316
|
return {
|
|
9281
9317
|
versions: {
|
|
9282
9318
|
php: compileVersion(
|
|
9283
|
-
(
|
|
9319
|
+
(T = e.preferredVersions) == null ? void 0 : T.php,
|
|
9284
9320
|
SupportedPHPVersions,
|
|
9285
9321
|
LatestSupportedPHPVersion
|
|
9286
9322
|
),
|
|
9287
|
-
wp: ((
|
|
9323
|
+
wp: ((y = e.preferredVersions) == null ? void 0 : y.wp) || "latest"
|
|
9288
9324
|
},
|
|
9289
9325
|
phpExtensions: compilePHPExtensions(
|
|
9290
9326
|
[],
|
|
@@ -9292,28 +9328,28 @@ function compileBlueprint(e, {
|
|
|
9292
9328
|
),
|
|
9293
9329
|
features: {
|
|
9294
9330
|
// Disable networking by default
|
|
9295
|
-
networking: ((
|
|
9331
|
+
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9296
9332
|
},
|
|
9297
|
-
run: async (
|
|
9333
|
+
run: async (g) => {
|
|
9298
9334
|
try {
|
|
9299
|
-
for (const { resources:
|
|
9300
|
-
for (const
|
|
9301
|
-
|
|
9302
|
-
for (const [
|
|
9335
|
+
for (const { resources: P } of p)
|
|
9336
|
+
for (const I of P)
|
|
9337
|
+
I.setPlayground(g), I.isAsync && I.resolve();
|
|
9338
|
+
for (const [P, { run: I, step: D }] of Object.entries(p))
|
|
9303
9339
|
try {
|
|
9304
|
-
const
|
|
9305
|
-
n(
|
|
9306
|
-
} catch (
|
|
9307
|
-
throw console.error(
|
|
9308
|
-
`Error when executing the blueprint step #${
|
|
9309
|
-
|
|
9310
|
-
)}) ${
|
|
9311
|
-
{ cause:
|
|
9340
|
+
const w = await I(g);
|
|
9341
|
+
n(w, D);
|
|
9342
|
+
} catch (w) {
|
|
9343
|
+
throw console.error(w), new Error(
|
|
9344
|
+
`Error when executing the blueprint step #${P} (${JSON.stringify(
|
|
9345
|
+
D
|
|
9346
|
+
)}) ${w instanceof Error ? `: ${w.message}` : w}`,
|
|
9347
|
+
{ cause: w }
|
|
9312
9348
|
);
|
|
9313
9349
|
}
|
|
9314
9350
|
} finally {
|
|
9315
9351
|
try {
|
|
9316
|
-
await
|
|
9352
|
+
await g.goTo(
|
|
9317
9353
|
e.landingPage || "/"
|
|
9318
9354
|
);
|
|
9319
9355
|
} catch {
|
|
@@ -9422,9 +9458,8 @@ export {
|
|
|
9422
9458
|
defineWpConfigConsts,
|
|
9423
9459
|
enableMultisite,
|
|
9424
9460
|
exportWXR,
|
|
9425
|
-
exportWXZ,
|
|
9426
|
-
importFile,
|
|
9427
9461
|
importWordPressFiles,
|
|
9462
|
+
importWxr,
|
|
9428
9463
|
installPlugin,
|
|
9429
9464
|
installTheme,
|
|
9430
9465
|
login,
|