@wp-playground/blueprints 0.6.16 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +46 -18
- package/index.d.ts +22 -170
- package/index.js +851 -744
- package/lib/steps/handlers.d.ts +0 -1
- package/lib/steps/index.d.ts +2 -3
- package/package.json +2 -2
- package/lib/steps/set-php-ini-entry.d.ts +0 -25
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var It = (e, t, r) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var H = (e, t, r) => (
|
|
5
|
+
var H = (e, t, r) => (It(e, t, "read from private field"), r ? r.call(e) : t.get(e)), K = (e, t, r) => {
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
9
|
-
},
|
|
10
|
-
var ce = (e, t, r) => (
|
|
9
|
+
}, ie = (e, t, r, n) => (It(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
10
|
+
var ce = (e, t, r) => (It(e, t, "access private method"), r);
|
|
11
11
|
const currentJsRuntime = function() {
|
|
12
12
|
var e;
|
|
13
13
|
return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
|
|
@@ -97,19 +97,40 @@ const wpContentFilesExcludedFromExport = [
|
|
|
97
97
|
"themes/twentytwentyfour",
|
|
98
98
|
"themes/twentytwentyfive",
|
|
99
99
|
"themes/twentytwentysix"
|
|
100
|
-
];
|
|
100
|
+
], SleepFinished = Symbol("SleepFinished");
|
|
101
|
+
function sleep(e) {
|
|
102
|
+
return new Promise((t) => {
|
|
103
|
+
setTimeout(() => t(SleepFinished), e);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
class AcquireTimeoutError extends Error {
|
|
107
|
+
constructor() {
|
|
108
|
+
super("Acquiring lock timed out");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
101
111
|
class Semaphore {
|
|
102
|
-
constructor({ concurrency: t }) {
|
|
103
|
-
this._running = 0, this.concurrency = t, this.queue = [];
|
|
112
|
+
constructor({ concurrency: t, timeout: r }) {
|
|
113
|
+
this._running = 0, this.concurrency = t, this.timeout = r, this.queue = [];
|
|
114
|
+
}
|
|
115
|
+
get remaining() {
|
|
116
|
+
return this.concurrency - this.running;
|
|
104
117
|
}
|
|
105
118
|
get running() {
|
|
106
119
|
return this._running;
|
|
107
120
|
}
|
|
108
121
|
async acquire() {
|
|
109
122
|
for (; ; )
|
|
110
|
-
if (this._running >= this.concurrency)
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
if (this._running >= this.concurrency) {
|
|
124
|
+
const t = new Promise((r) => {
|
|
125
|
+
this.queue.push(r);
|
|
126
|
+
});
|
|
127
|
+
this.timeout !== void 0 ? await Promise.race([t, sleep(this.timeout)]).then(
|
|
128
|
+
(r) => {
|
|
129
|
+
if (r === SleepFinished)
|
|
130
|
+
throw new AcquireTimeoutError();
|
|
131
|
+
}
|
|
132
|
+
) : await t;
|
|
133
|
+
} else {
|
|
113
134
|
this._running++;
|
|
114
135
|
let t = !1;
|
|
115
136
|
return () => {
|
|
@@ -341,8 +362,6 @@ switch_theme( ${phpVar(t)} );
|
|
|
341
362
|
`
|
|
342
363
|
});
|
|
343
364
|
return await rm(e, { path: n }), o;
|
|
344
|
-
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
345
|
-
await e.setPhpIniEntry(t, r);
|
|
346
365
|
}, request = async (e, { request: t }) => {
|
|
347
366
|
const r = await e.request(t);
|
|
348
367
|
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
@@ -858,14 +877,14 @@ echo json_encode($deactivated_plugins);
|
|
|
858
877
|
PATH_CURRENT_SITE: r
|
|
859
878
|
}
|
|
860
879
|
});
|
|
861
|
-
const p = new URL(await e.absoluteUrl),
|
|
880
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
862
881
|
await e.writeFile(
|
|
863
882
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
864
883
|
`<?php
|
|
865
884
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
866
885
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
867
886
|
}
|
|
868
|
-
$folder = ${phpVar(
|
|
887
|
+
$folder = ${phpVar(g)};
|
|
869
888
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
870
889
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
871
890
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -1050,13 +1069,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1050
1069
|
}), s = joinPaths(s, r);
|
|
1051
1070
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1052
1071
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1053
|
-
const
|
|
1072
|
+
const g = joinPaths(
|
|
1054
1073
|
i,
|
|
1055
1074
|
p
|
|
1056
1075
|
);
|
|
1057
|
-
await removePath(e,
|
|
1076
|
+
await removePath(e, g);
|
|
1058
1077
|
const O = joinPaths(o, p);
|
|
1059
|
-
await e.fileExists(O) && (await e.mkdir(dirname(
|
|
1078
|
+
await e.fileExists(O) && (await e.mkdir(dirname(g)), await e.mv(O, g));
|
|
1060
1079
|
}
|
|
1061
1080
|
const l = joinPaths(
|
|
1062
1081
|
s,
|
|
@@ -1114,13 +1133,13 @@ async function installAsset(e, {
|
|
|
1114
1133
|
});
|
|
1115
1134
|
u = u.filter((S) => !S.endsWith("/__MACOSX"));
|
|
1116
1135
|
const p = u.length === 1 && await e.isDir(u[0]);
|
|
1117
|
-
let
|
|
1118
|
-
p ? (O = u[0],
|
|
1119
|
-
const C = `${t}/${
|
|
1136
|
+
let g, O = "";
|
|
1137
|
+
p ? (O = u[0], g = u[0].split("/").pop()) : (O = d, g = i);
|
|
1138
|
+
const C = `${t}/${g}`;
|
|
1120
1139
|
if (await e.fileExists(C)) {
|
|
1121
1140
|
if (!await e.isDir(C))
|
|
1122
1141
|
throw new Error(
|
|
1123
|
-
`Cannot install asset ${
|
|
1142
|
+
`Cannot install asset ${g} to ${C} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`
|
|
1124
1143
|
);
|
|
1125
1144
|
if (n === "overwrite")
|
|
1126
1145
|
await e.rmdir(C, {
|
|
@@ -1130,16 +1149,16 @@ async function installAsset(e, {
|
|
|
1130
1149
|
if (n === "skip")
|
|
1131
1150
|
return {
|
|
1132
1151
|
assetFolderPath: C,
|
|
1133
|
-
assetFolderName:
|
|
1152
|
+
assetFolderName: g
|
|
1134
1153
|
};
|
|
1135
1154
|
throw new Error(
|
|
1136
|
-
`Cannot install asset ${
|
|
1155
|
+
`Cannot install asset ${g} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`
|
|
1137
1156
|
);
|
|
1138
1157
|
}
|
|
1139
1158
|
}
|
|
1140
1159
|
return await e.mv(O, C), {
|
|
1141
1160
|
assetFolderPath: C,
|
|
1142
|
-
assetFolderName:
|
|
1161
|
+
assetFolderName: g
|
|
1143
1162
|
};
|
|
1144
1163
|
} finally {
|
|
1145
1164
|
await e.rmdir(l, {
|
|
@@ -1298,7 +1317,6 @@ const allStepHandlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
1298
1317
|
runPHPWithOptions,
|
|
1299
1318
|
runSql,
|
|
1300
1319
|
runWpInstallationWizard,
|
|
1301
|
-
setPhpIniEntry,
|
|
1302
1320
|
setSiteOptions,
|
|
1303
1321
|
unzip,
|
|
1304
1322
|
updateUserMeta,
|
|
@@ -1731,96 +1749,7 @@ const SupportedPHPVersions = [
|
|
|
1731
1749
|
], SupportedPHPExtensionBundles = {
|
|
1732
1750
|
"kitchen-sink": SupportedPHPExtensionsList,
|
|
1733
1751
|
light: []
|
|
1734
|
-
};
|
|
1735
|
-
var Ae, Ge;
|
|
1736
|
-
class PHPBrowser {
|
|
1737
|
-
/**
|
|
1738
|
-
* @param server - The PHP server to browse.
|
|
1739
|
-
* @param config - The browser configuration.
|
|
1740
|
-
*/
|
|
1741
|
-
constructor(t, r = {}) {
|
|
1742
|
-
Q(this, Ae, void 0);
|
|
1743
|
-
Q(this, Ge, void 0);
|
|
1744
|
-
this.requestHandler = t, te(this, Ae, {}), te(this, Ge, {
|
|
1745
|
-
handleRedirects: !1,
|
|
1746
|
-
maxRedirects: 4,
|
|
1747
|
-
...r
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
/**
|
|
1751
|
-
* Sends the request to the server.
|
|
1752
|
-
*
|
|
1753
|
-
* When cookies are present in the response, this method stores
|
|
1754
|
-
* them and sends them with any subsequent requests.
|
|
1755
|
-
*
|
|
1756
|
-
* When a redirection is present in the response, this method
|
|
1757
|
-
* follows it by discarding a response and sending a subsequent
|
|
1758
|
-
* request.
|
|
1759
|
-
*
|
|
1760
|
-
* @param request - The request.
|
|
1761
|
-
* @param redirects - Internal. The number of redirects handled so far.
|
|
1762
|
-
* @returns PHPRequestHandler response.
|
|
1763
|
-
*/
|
|
1764
|
-
async request(t, r = 0) {
|
|
1765
|
-
const n = await this.requestHandler.request({
|
|
1766
|
-
...t,
|
|
1767
|
-
headers: {
|
|
1768
|
-
...t.headers,
|
|
1769
|
-
cookie: this.serializeCookies()
|
|
1770
|
-
}
|
|
1771
|
-
});
|
|
1772
|
-
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
|
|
1773
|
-
const s = new URL(
|
|
1774
|
-
n.headers.location[0],
|
|
1775
|
-
this.requestHandler.absoluteUrl
|
|
1776
|
-
);
|
|
1777
|
-
return this.request(
|
|
1778
|
-
{
|
|
1779
|
-
url: s.toString(),
|
|
1780
|
-
method: "GET",
|
|
1781
|
-
headers: {}
|
|
1782
|
-
},
|
|
1783
|
-
r + 1
|
|
1784
|
-
);
|
|
1785
|
-
}
|
|
1786
|
-
return n;
|
|
1787
|
-
}
|
|
1788
|
-
/** @inheritDoc */
|
|
1789
|
-
pathToInternalUrl(t) {
|
|
1790
|
-
return this.requestHandler.pathToInternalUrl(t);
|
|
1791
|
-
}
|
|
1792
|
-
/** @inheritDoc */
|
|
1793
|
-
internalUrlToPath(t) {
|
|
1794
|
-
return this.requestHandler.internalUrlToPath(t);
|
|
1795
|
-
}
|
|
1796
|
-
/** @inheritDoc */
|
|
1797
|
-
get absoluteUrl() {
|
|
1798
|
-
return this.requestHandler.absoluteUrl;
|
|
1799
|
-
}
|
|
1800
|
-
/** @inheritDoc */
|
|
1801
|
-
get documentRoot() {
|
|
1802
|
-
return this.requestHandler.documentRoot;
|
|
1803
|
-
}
|
|
1804
|
-
setCookies(t) {
|
|
1805
|
-
for (const r of t)
|
|
1806
|
-
try {
|
|
1807
|
-
if (!r.includes("="))
|
|
1808
|
-
continue;
|
|
1809
|
-
const n = r.indexOf("="), s = r.substring(0, n), i = r.substring(n + 1).split(";")[0];
|
|
1810
|
-
H(this, Ae)[s] = i;
|
|
1811
|
-
} catch (n) {
|
|
1812
|
-
console.error(n);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
serializeCookies() {
|
|
1816
|
-
const t = [];
|
|
1817
|
-
for (const r in H(this, Ae))
|
|
1818
|
-
t.push(`${r}=${H(this, Ae)[r]}`);
|
|
1819
|
-
return t.join("; ");
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
Ae = new WeakMap(), Ge = new WeakMap();
|
|
1823
|
-
const DEFAULT_BASE_URL = "http://example.com";
|
|
1752
|
+
}, DEFAULT_BASE_URL = "http://example.com";
|
|
1824
1753
|
function toRelativeUrl(e) {
|
|
1825
1754
|
return e.toString().substring(e.origin.length);
|
|
1826
1755
|
}
|
|
@@ -1858,7 +1787,30 @@ function fileToUint8Array(e) {
|
|
|
1858
1787
|
}, r.readAsArrayBuffer(e);
|
|
1859
1788
|
});
|
|
1860
1789
|
}
|
|
1861
|
-
|
|
1790
|
+
class HttpCookieStore {
|
|
1791
|
+
constructor() {
|
|
1792
|
+
this.cookies = {};
|
|
1793
|
+
}
|
|
1794
|
+
rememberCookiesFromResponseHeaders(t) {
|
|
1795
|
+
if (t != null && t["set-cookie"])
|
|
1796
|
+
for (const r of t["set-cookie"])
|
|
1797
|
+
try {
|
|
1798
|
+
if (!r.includes("="))
|
|
1799
|
+
continue;
|
|
1800
|
+
const n = r.indexOf("="), s = r.substring(0, n), i = r.substring(n + 1).split(";")[0];
|
|
1801
|
+
this.cookies[s] = i;
|
|
1802
|
+
} catch (n) {
|
|
1803
|
+
console.error(n);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
getCookieRequestHeader() {
|
|
1807
|
+
const t = [];
|
|
1808
|
+
for (const r in this.cookies)
|
|
1809
|
+
t.push(`${r}=${this.cookies[r]}`);
|
|
1810
|
+
return t.join("; ");
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
var Pe, We, ct, je, Be, ve, Ge, Ae, Ke, ft, Wt, ht, Bt, mt, Gt;
|
|
1862
1814
|
class PHPRequestHandler {
|
|
1863
1815
|
/**
|
|
1864
1816
|
* @param php - The PHP instance.
|
|
@@ -1871,7 +1823,7 @@ class PHPRequestHandler {
|
|
|
1871
1823
|
* @param fsPath - Absolute path of the static file to serve.
|
|
1872
1824
|
* @returns The response.
|
|
1873
1825
|
*/
|
|
1874
|
-
|
|
1826
|
+
K(this, ft);
|
|
1875
1827
|
/**
|
|
1876
1828
|
* Runs the requested PHP file with all the request and $_SERVER
|
|
1877
1829
|
* superglobals populated.
|
|
@@ -1879,7 +1831,7 @@ class PHPRequestHandler {
|
|
|
1879
1831
|
* @param request - The request.
|
|
1880
1832
|
* @returns The response.
|
|
1881
1833
|
*/
|
|
1882
|
-
|
|
1834
|
+
K(this, ht);
|
|
1883
1835
|
/**
|
|
1884
1836
|
* Resolve the requested path to the filesystem path of the requested PHP file.
|
|
1885
1837
|
*
|
|
@@ -1889,55 +1841,120 @@ class PHPRequestHandler {
|
|
|
1889
1841
|
* @throws {Error} If the requested path doesn't exist.
|
|
1890
1842
|
* @returns The resolved filesystem path.
|
|
1891
1843
|
*/
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1844
|
+
K(this, mt);
|
|
1845
|
+
K(this, Pe, void 0);
|
|
1846
|
+
K(this, We, void 0);
|
|
1847
|
+
K(this, ct, void 0);
|
|
1848
|
+
K(this, je, void 0);
|
|
1849
|
+
K(this, Be, void 0);
|
|
1850
|
+
K(this, ve, void 0);
|
|
1851
|
+
K(this, Ge, void 0);
|
|
1852
|
+
K(this, Ae, void 0);
|
|
1853
|
+
K(this, Ke, void 0);
|
|
1854
|
+
ie(this, Ae, new Semaphore({ concurrency: 1 }));
|
|
1902
1855
|
const {
|
|
1903
1856
|
documentRoot: n = "/www/",
|
|
1904
1857
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : "",
|
|
1905
1858
|
rewriteRules: i = []
|
|
1906
1859
|
} = r;
|
|
1907
|
-
this.php = t,
|
|
1860
|
+
this.php = t, ie(this, Ke, new HttpCookieStore()), ie(this, Pe, n);
|
|
1908
1861
|
const o = new URL(s);
|
|
1909
|
-
|
|
1910
|
-
const l = H(this,
|
|
1911
|
-
|
|
1912
|
-
H(this,
|
|
1913
|
-
l ? `:${H(this,
|
|
1914
|
-
].join("")),
|
|
1915
|
-
`${H(this,
|
|
1916
|
-
H(this,
|
|
1862
|
+
ie(this, ct, o.hostname), ie(this, je, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), ie(this, We, (o.protocol || "").replace(":", ""));
|
|
1863
|
+
const l = H(this, je) !== 443 && H(this, je) !== 80;
|
|
1864
|
+
ie(this, Be, [
|
|
1865
|
+
H(this, ct),
|
|
1866
|
+
l ? `:${H(this, je)}` : ""
|
|
1867
|
+
].join("")), ie(this, ve, o.pathname.replace(/\/+$/, "")), ie(this, Ge, [
|
|
1868
|
+
`${H(this, We)}://`,
|
|
1869
|
+
H(this, Be),
|
|
1917
1870
|
H(this, ve)
|
|
1918
1871
|
].join("")), this.rewriteRules = i;
|
|
1919
1872
|
}
|
|
1920
|
-
/**
|
|
1873
|
+
/**
|
|
1874
|
+
* Converts a path to an absolute URL based at the PHPRequestHandler
|
|
1875
|
+
* root.
|
|
1876
|
+
*
|
|
1877
|
+
* @param path The server path to convert to an absolute URL.
|
|
1878
|
+
* @returns The absolute URL.
|
|
1879
|
+
*/
|
|
1921
1880
|
pathToInternalUrl(t) {
|
|
1922
1881
|
return `${this.absoluteUrl}${t}`;
|
|
1923
1882
|
}
|
|
1924
|
-
/**
|
|
1883
|
+
/**
|
|
1884
|
+
* Converts an absolute URL based at the PHPRequestHandler to a relative path
|
|
1885
|
+
* without the server pathname and scope.
|
|
1886
|
+
*
|
|
1887
|
+
* @param internalUrl An absolute URL based at the PHPRequestHandler root.
|
|
1888
|
+
* @returns The relative path.
|
|
1889
|
+
*/
|
|
1925
1890
|
internalUrlToPath(t) {
|
|
1926
1891
|
const r = new URL(t);
|
|
1927
1892
|
return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
|
|
1928
1893
|
}
|
|
1929
1894
|
get isRequestRunning() {
|
|
1930
|
-
return H(this,
|
|
1895
|
+
return H(this, Ae).running > 0;
|
|
1931
1896
|
}
|
|
1932
|
-
/**
|
|
1897
|
+
/**
|
|
1898
|
+
* The absolute URL of this PHPRequestHandler instance.
|
|
1899
|
+
*/
|
|
1933
1900
|
get absoluteUrl() {
|
|
1934
|
-
return H(this,
|
|
1901
|
+
return H(this, Ge);
|
|
1935
1902
|
}
|
|
1936
|
-
/**
|
|
1903
|
+
/**
|
|
1904
|
+
* The directory in the PHP filesystem where the server will look
|
|
1905
|
+
* for the files to serve. Default: `/var/www`.
|
|
1906
|
+
*/
|
|
1937
1907
|
get documentRoot() {
|
|
1938
1908
|
return H(this, Pe);
|
|
1939
1909
|
}
|
|
1940
|
-
/**
|
|
1910
|
+
/**
|
|
1911
|
+
* Serves the request – either by serving a static file, or by
|
|
1912
|
+
* dispatching it to the PHP runtime.
|
|
1913
|
+
*
|
|
1914
|
+
* The request() method mode behaves like a web server and only works if
|
|
1915
|
+
* the PHP was initialized with a `requestHandler` option (which the online version
|
|
1916
|
+
* of WordPress Playground does by default).
|
|
1917
|
+
*
|
|
1918
|
+
* In the request mode, you pass an object containing the request information
|
|
1919
|
+
* (method, headers, body, etc.) and the path to the PHP file to run:
|
|
1920
|
+
*
|
|
1921
|
+
* ```ts
|
|
1922
|
+
* const php = PHP.load('7.4', {
|
|
1923
|
+
* requestHandler: {
|
|
1924
|
+
* documentRoot: "/www"
|
|
1925
|
+
* }
|
|
1926
|
+
* })
|
|
1927
|
+
* php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
|
|
1928
|
+
* const result = await php.request({
|
|
1929
|
+
* method: "GET",
|
|
1930
|
+
* headers: {
|
|
1931
|
+
* "Content-Type": "text/plain"
|
|
1932
|
+
* },
|
|
1933
|
+
* body: "Hello world!",
|
|
1934
|
+
* path: "/www/index.php"
|
|
1935
|
+
* });
|
|
1936
|
+
* // result.text === "Hello world!"
|
|
1937
|
+
* ```
|
|
1938
|
+
*
|
|
1939
|
+
* The `request()` method cannot be used in conjunction with `cli()`.
|
|
1940
|
+
*
|
|
1941
|
+
* @example
|
|
1942
|
+
* ```js
|
|
1943
|
+
* const output = await php.request({
|
|
1944
|
+
* method: 'GET',
|
|
1945
|
+
* url: '/index.php',
|
|
1946
|
+
* headers: {
|
|
1947
|
+
* 'X-foo': 'bar',
|
|
1948
|
+
* },
|
|
1949
|
+
* body: {
|
|
1950
|
+
* foo: 'bar',
|
|
1951
|
+
* },
|
|
1952
|
+
* });
|
|
1953
|
+
* console.log(output.stdout); // "Hello world!"
|
|
1954
|
+
* ```
|
|
1955
|
+
*
|
|
1956
|
+
* @param request - PHP Request data.
|
|
1957
|
+
*/
|
|
1941
1958
|
async request(t) {
|
|
1942
1959
|
const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
|
|
1943
1960
|
// Remove the hash part of the URL as it's not meant for the server.
|
|
@@ -1950,10 +1967,10 @@ class PHPRequestHandler {
|
|
|
1950
1967
|
),
|
|
1951
1968
|
this.rewriteRules
|
|
1952
1969
|
), i = joinPaths(H(this, Pe), s);
|
|
1953
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this,
|
|
1970
|
+
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, ht, Bt).call(this, t, n) : ce(this, ft, Wt).call(this, i);
|
|
1954
1971
|
}
|
|
1955
1972
|
}
|
|
1956
|
-
Pe = new WeakMap(),
|
|
1973
|
+
Pe = new WeakMap(), We = new WeakMap(), ct = new WeakMap(), je = new WeakMap(), Be = new WeakMap(), ve = new WeakMap(), Ge = new WeakMap(), Ae = new WeakMap(), Ke = new WeakMap(), ft = new WeakSet(), Wt = function(t) {
|
|
1957
1974
|
if (!this.php.fileExists(t))
|
|
1958
1975
|
return new PHPResponse(
|
|
1959
1976
|
404,
|
|
@@ -1978,9 +1995,9 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1978
1995
|
},
|
|
1979
1996
|
r
|
|
1980
1997
|
);
|
|
1981
|
-
},
|
|
1998
|
+
}, ht = new WeakSet(), Bt = async function(t, r) {
|
|
1982
1999
|
var s;
|
|
1983
|
-
if (H(this,
|
|
2000
|
+
if (H(this, Ae).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1984
2001
|
return console.warn(
|
|
1985
2002
|
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
|
|
1986
2003
|
), new PHPResponse(
|
|
@@ -1988,16 +2005,13 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1988
2005
|
{},
|
|
1989
2006
|
new TextEncoder().encode("502 Bad Gateway")
|
|
1990
2007
|
);
|
|
1991
|
-
const n = await H(this,
|
|
2008
|
+
const n = await H(this, Ae).acquire();
|
|
1992
2009
|
try {
|
|
1993
|
-
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Pe)), this.php.addServerGlobalEntry(
|
|
1994
|
-
"HTTPS",
|
|
1995
|
-
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1996
|
-
);
|
|
1997
2010
|
let i = "GET";
|
|
1998
2011
|
const o = {
|
|
1999
|
-
host: H(this,
|
|
2000
|
-
...normalizeHeaders(t.headers || {})
|
|
2012
|
+
host: H(this, Be),
|
|
2013
|
+
...normalizeHeaders(t.headers || {}),
|
|
2014
|
+
cookie: H(this, Ke).getCookieRequestHeader()
|
|
2001
2015
|
};
|
|
2002
2016
|
let l = t.body;
|
|
2003
2017
|
if (typeof l == "object" && !(l instanceof Uint8Array)) {
|
|
@@ -2007,7 +2021,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2007
2021
|
}
|
|
2008
2022
|
let d;
|
|
2009
2023
|
try {
|
|
2010
|
-
d = ce(this,
|
|
2024
|
+
d = ce(this, mt, Gt).call(this, decodeURIComponent(r.pathname));
|
|
2011
2025
|
} catch {
|
|
2012
2026
|
return new PHPResponse(
|
|
2013
2027
|
404,
|
|
@@ -2016,17 +2030,25 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2016
2030
|
);
|
|
2017
2031
|
}
|
|
2018
2032
|
try {
|
|
2019
|
-
|
|
2033
|
+
const u = await this.php.run({
|
|
2020
2034
|
relativeUri: ensurePathPrefix(
|
|
2021
2035
|
toRelativeUrl(r),
|
|
2022
2036
|
H(this, ve)
|
|
2023
2037
|
),
|
|
2024
|
-
protocol: H(this,
|
|
2038
|
+
protocol: H(this, We),
|
|
2025
2039
|
method: t.method || i,
|
|
2040
|
+
$_SERVER: {
|
|
2041
|
+
REMOTE_ADDR: "127.0.0.1",
|
|
2042
|
+
DOCUMENT_ROOT: H(this, Pe),
|
|
2043
|
+
HTTPS: H(this, Ge).startsWith("https://") ? "on" : ""
|
|
2044
|
+
},
|
|
2026
2045
|
body: l,
|
|
2027
2046
|
scriptPath: d,
|
|
2028
2047
|
headers: o
|
|
2029
2048
|
});
|
|
2049
|
+
return H(this, Ke).rememberCookiesFromResponseHeaders(
|
|
2050
|
+
u.headers
|
|
2051
|
+
), u;
|
|
2030
2052
|
} catch (u) {
|
|
2031
2053
|
const p = u;
|
|
2032
2054
|
if (p != null && p.response)
|
|
@@ -2036,7 +2058,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2036
2058
|
} finally {
|
|
2037
2059
|
n();
|
|
2038
2060
|
}
|
|
2039
|
-
},
|
|
2061
|
+
}, mt = new WeakSet(), Gt = function(t) {
|
|
2040
2062
|
let r = removePathPrefix(t, H(this, ve));
|
|
2041
2063
|
r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
2042
2064
|
const n = `${H(this, Pe)}${r}`;
|
|
@@ -2080,6 +2102,38 @@ function inferMimeType(e) {
|
|
|
2080
2102
|
case "txt":
|
|
2081
2103
|
case "md":
|
|
2082
2104
|
return "text/plain";
|
|
2105
|
+
case "pdf":
|
|
2106
|
+
return "application/pdf";
|
|
2107
|
+
case "webp":
|
|
2108
|
+
return "image/webp";
|
|
2109
|
+
case "mp3":
|
|
2110
|
+
return "audio/mpeg";
|
|
2111
|
+
case "mp4":
|
|
2112
|
+
return "video/mp4";
|
|
2113
|
+
case "csv":
|
|
2114
|
+
return "text/csv";
|
|
2115
|
+
case "xls":
|
|
2116
|
+
return "application/vnd.ms-excel";
|
|
2117
|
+
case "xlsx":
|
|
2118
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
2119
|
+
case "doc":
|
|
2120
|
+
return "application/msword";
|
|
2121
|
+
case "docx":
|
|
2122
|
+
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
2123
|
+
case "ppt":
|
|
2124
|
+
return "application/vnd.ms-powerpoint";
|
|
2125
|
+
case "pptx":
|
|
2126
|
+
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
2127
|
+
case "zip":
|
|
2128
|
+
return "application/zip";
|
|
2129
|
+
case "rar":
|
|
2130
|
+
return "application/x-rar-compressed";
|
|
2131
|
+
case "tar":
|
|
2132
|
+
return "application/x-tar";
|
|
2133
|
+
case "gz":
|
|
2134
|
+
return "application/gzip";
|
|
2135
|
+
case "7z":
|
|
2136
|
+
return "application/x-7z-compressed";
|
|
2083
2137
|
default:
|
|
2084
2138
|
return "application-octet-stream";
|
|
2085
2139
|
}
|
|
@@ -2192,8 +2246,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2192
2246
|
} catch (l) {
|
|
2193
2247
|
const d = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2194
2248
|
if (d in FileErrorCodes) {
|
|
2195
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2196
|
-
throw new Error(`${
|
|
2249
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, g = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2250
|
+
throw new Error(`${g}: ${u}`, {
|
|
2197
2251
|
cause: l
|
|
2198
2252
|
});
|
|
2199
2253
|
}
|
|
@@ -2221,7 +2275,7 @@ class PHPExecutionFailureError extends Error {
|
|
|
2221
2275
|
super(t), this.response = r, this.source = n;
|
|
2222
2276
|
}
|
|
2223
2277
|
}
|
|
2224
|
-
var
|
|
2278
|
+
var De, Je, Qe, be, Re, Ee, Ye, _t, Kt, gt, Jt, $t, Qt, yt, Yt, vt, Zt, wt, Xt, Pt, er, bt, tr, Et, rr, St, nr, Rt, sr, Tt, ir, kt, or, Ct, ar, Ot, cr;
|
|
2225
2279
|
class BasePHP {
|
|
2226
2280
|
/**
|
|
2227
2281
|
* Initializes a PHP runtime.
|
|
@@ -2231,29 +2285,38 @@ class BasePHP {
|
|
|
2231
2285
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2232
2286
|
*/
|
|
2233
2287
|
constructor(e, t) {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
)
|
|
2288
|
+
/**
|
|
2289
|
+
* Prepares the $_SERVER entries for the PHP runtime.
|
|
2290
|
+
*
|
|
2291
|
+
* @param defaults Default entries to include in $_SERVER.
|
|
2292
|
+
* @param headers HTTP headers to include in $_SERVER (as HTTP_ prefixed entries).
|
|
2293
|
+
* @param port HTTP port, used to determine infer $_SERVER['HTTPS'] value if none
|
|
2294
|
+
* was provided.
|
|
2295
|
+
* @returns Computed $_SERVER entries.
|
|
2296
|
+
*/
|
|
2297
|
+
K(this, _t);
|
|
2298
|
+
K(this, gt);
|
|
2299
|
+
K(this, $t);
|
|
2300
|
+
K(this, yt);
|
|
2301
|
+
K(this, vt);
|
|
2302
|
+
K(this, wt);
|
|
2303
|
+
K(this, Pt);
|
|
2304
|
+
K(this, bt);
|
|
2305
|
+
K(this, Et);
|
|
2306
|
+
K(this, St);
|
|
2307
|
+
K(this, Rt);
|
|
2308
|
+
K(this, Tt);
|
|
2309
|
+
K(this, kt);
|
|
2310
|
+
K(this, Ct);
|
|
2311
|
+
K(this, Ot);
|
|
2312
|
+
K(this, De, void 0);
|
|
2313
|
+
K(this, Je, void 0);
|
|
2314
|
+
K(this, Qe, void 0);
|
|
2315
|
+
K(this, be, void 0);
|
|
2316
|
+
K(this, Re, void 0);
|
|
2317
|
+
K(this, Ee, void 0);
|
|
2318
|
+
K(this, Ye, void 0);
|
|
2319
|
+
ie(this, De, []), ie(this, be, !1), ie(this, Re, null), ie(this, Ee, /* @__PURE__ */ new Map()), ie(this, Ye, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPRequestHandler(this, t));
|
|
2257
2320
|
}
|
|
2258
2321
|
addEventListener(e, t) {
|
|
2259
2322
|
H(this, Ee).has(e) || H(this, Ee).set(e, /* @__PURE__ */ new Set()), H(this, Ee).get(e).add(t);
|
|
@@ -2270,7 +2333,7 @@ class BasePHP {
|
|
|
2270
2333
|
}
|
|
2271
2334
|
/** @inheritDoc */
|
|
2272
2335
|
async onMessage(e) {
|
|
2273
|
-
H(this,
|
|
2336
|
+
H(this, Ye).push(e);
|
|
2274
2337
|
}
|
|
2275
2338
|
/** @inheritDoc */
|
|
2276
2339
|
async setSpawnHandler(handler) {
|
|
@@ -2278,21 +2341,19 @@ class BasePHP {
|
|
|
2278
2341
|
}
|
|
2279
2342
|
/** @inheritDoc */
|
|
2280
2343
|
get absoluteUrl() {
|
|
2281
|
-
return this.requestHandler.
|
|
2344
|
+
return this.requestHandler.absoluteUrl;
|
|
2282
2345
|
}
|
|
2283
2346
|
/** @inheritDoc */
|
|
2284
2347
|
get documentRoot() {
|
|
2285
|
-
return this.requestHandler.
|
|
2348
|
+
return this.requestHandler.documentRoot;
|
|
2286
2349
|
}
|
|
2287
2350
|
/** @inheritDoc */
|
|
2288
2351
|
pathToInternalUrl(e) {
|
|
2289
|
-
return this.requestHandler.
|
|
2352
|
+
return this.requestHandler.pathToInternalUrl(e);
|
|
2290
2353
|
}
|
|
2291
2354
|
/** @inheritDoc */
|
|
2292
2355
|
internalUrlToPath(e) {
|
|
2293
|
-
return this.requestHandler.
|
|
2294
|
-
e
|
|
2295
|
-
);
|
|
2356
|
+
return this.requestHandler.internalUrlToPath(e);
|
|
2296
2357
|
}
|
|
2297
2358
|
initializeRuntime(e) {
|
|
2298
2359
|
if (this[__private__dont__use])
|
|
@@ -2301,13 +2362,13 @@ class BasePHP {
|
|
|
2301
2362
|
if (!t)
|
|
2302
2363
|
throw new Error("Invalid PHP runtime id.");
|
|
2303
2364
|
this[__private__dont__use] = t, t.onMessage = async (r) => {
|
|
2304
|
-
for (const n of H(this,
|
|
2365
|
+
for (const n of H(this, Ye)) {
|
|
2305
2366
|
const s = await n(r);
|
|
2306
2367
|
if (s)
|
|
2307
2368
|
return s;
|
|
2308
2369
|
}
|
|
2309
2370
|
return "";
|
|
2310
|
-
},
|
|
2371
|
+
}, ie(this, Re, improveWASMErrorReporting(t)), this.dispatchEvent({
|
|
2311
2372
|
type: "runtime.initialized"
|
|
2312
2373
|
});
|
|
2313
2374
|
}
|
|
@@ -2322,13 +2383,13 @@ class BasePHP {
|
|
|
2322
2383
|
throw new Error(
|
|
2323
2384
|
"Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
|
|
2324
2385
|
);
|
|
2325
|
-
|
|
2386
|
+
ie(this, Qe, e);
|
|
2326
2387
|
}
|
|
2327
2388
|
/** @inheritDoc */
|
|
2328
2389
|
setPhpIniPath(e) {
|
|
2329
2390
|
if (H(this, be))
|
|
2330
2391
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2331
|
-
|
|
2392
|
+
ie(this, Je, e), this[__private__dont__use].ccall(
|
|
2332
2393
|
"wasm_set_phpini_path",
|
|
2333
2394
|
null,
|
|
2334
2395
|
["string"],
|
|
@@ -2339,44 +2400,47 @@ class BasePHP {
|
|
|
2339
2400
|
setPhpIniEntry(e, t) {
|
|
2340
2401
|
if (H(this, be))
|
|
2341
2402
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2342
|
-
H(this,
|
|
2403
|
+
H(this, De).push([e, t]);
|
|
2343
2404
|
}
|
|
2344
2405
|
/** @inheritDoc */
|
|
2345
2406
|
chdir(e) {
|
|
2346
2407
|
this[__private__dont__use].FS.chdir(e);
|
|
2347
2408
|
}
|
|
2348
2409
|
/** @inheritDoc */
|
|
2349
|
-
async request(e
|
|
2410
|
+
async request(e) {
|
|
2350
2411
|
if (!this.requestHandler)
|
|
2351
2412
|
throw new Error("No request handler available.");
|
|
2352
|
-
return this.requestHandler.request(e
|
|
2413
|
+
return this.requestHandler.request(e);
|
|
2353
2414
|
}
|
|
2354
2415
|
/** @inheritDoc */
|
|
2355
2416
|
async run(e) {
|
|
2356
2417
|
const t = await this.semaphore.acquire();
|
|
2357
2418
|
let r;
|
|
2358
2419
|
try {
|
|
2359
|
-
if (H(this, be) || (ce(this, gt,
|
|
2420
|
+
if (H(this, be) || (ce(this, gt, Jt).call(this), ie(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2360
2421
|
throw new Error(
|
|
2361
2422
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2362
2423
|
);
|
|
2363
|
-
ce(this,
|
|
2364
|
-
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2365
|
-
ce(this,
|
|
2366
|
-
const
|
|
2367
|
-
for (const
|
|
2368
|
-
ce(this, Tt,
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2424
|
+
ce(this, Rt, sr).call(this, e.scriptPath || ""), ce(this, yt, Yt).call(this, e.relativeUri || ""), ce(this, bt, tr).call(this, e.method || "GET");
|
|
2425
|
+
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443", i = ce(this, Pt, er).call(this, s, e.protocol || "http");
|
|
2426
|
+
ce(this, vt, Zt).call(this, s), ce(this, wt, Xt).call(this, i), ce(this, Et, rr).call(this, n), e.body && (r = ce(this, St, nr).call(this, e.body)), typeof e.code == "string" && ce(this, Ct, ar).call(this, " ?>" + e.code);
|
|
2427
|
+
const o = ce(this, _t, Kt).call(this, e.$_SERVER, n, i);
|
|
2428
|
+
for (const u in o)
|
|
2429
|
+
ce(this, Tt, ir).call(this, u, o[u]);
|
|
2430
|
+
const l = e.env || {};
|
|
2431
|
+
for (const u in l)
|
|
2432
|
+
ce(this, kt, or).call(this, u, l[u]);
|
|
2433
|
+
const d = await ce(this, Ot, cr).call(this);
|
|
2434
|
+
if (d.exitCode !== 0) {
|
|
2435
|
+
console.warn("PHP.run() output was:", d.text);
|
|
2436
|
+
const u = new PHPExecutionFailureError(
|
|
2437
|
+
`PHP.run() failed with exit code ${d.exitCode} and the following output: ` + d.errors,
|
|
2438
|
+
d,
|
|
2375
2439
|
"request"
|
|
2376
2440
|
);
|
|
2377
|
-
throw console.error(
|
|
2441
|
+
throw console.error(u), u;
|
|
2378
2442
|
}
|
|
2379
|
-
return
|
|
2443
|
+
return d;
|
|
2380
2444
|
} catch (n) {
|
|
2381
2445
|
throw this.dispatchEvent({
|
|
2382
2446
|
type: "request.error",
|
|
@@ -2394,9 +2458,6 @@ class BasePHP {
|
|
|
2394
2458
|
}
|
|
2395
2459
|
}
|
|
2396
2460
|
}
|
|
2397
|
-
addServerGlobalEntry(e, t) {
|
|
2398
|
-
H(this, Te)[e] = t;
|
|
2399
|
-
}
|
|
2400
2461
|
defineConstant(e, t) {
|
|
2401
2462
|
let r = {};
|
|
2402
2463
|
try {
|
|
@@ -2484,17 +2545,18 @@ class BasePHP {
|
|
|
2484
2545
|
* interrupting the operations of this PHP instance.
|
|
2485
2546
|
*
|
|
2486
2547
|
* @param runtime
|
|
2548
|
+
* @param cwd. Internal, the VFS path to recreate in the new runtime.
|
|
2549
|
+
* This arg is temporary and will be removed once BasePHP
|
|
2550
|
+
* is fully decoupled from the request handler and
|
|
2551
|
+
* accepts a constructor-level cwd argument.
|
|
2487
2552
|
*/
|
|
2488
|
-
hotSwapPHPRuntime(e) {
|
|
2489
|
-
const
|
|
2553
|
+
hotSwapPHPRuntime(e, t) {
|
|
2554
|
+
const r = this[__private__dont__use].FS;
|
|
2490
2555
|
try {
|
|
2491
2556
|
this.exit();
|
|
2492
2557
|
} catch {
|
|
2493
2558
|
}
|
|
2494
|
-
|
|
2495
|
-
const r = this.documentRoot;
|
|
2496
|
-
copyFS(t, this[__private__dont__use].FS, r);
|
|
2497
|
-
}
|
|
2559
|
+
this.initializeRuntime(e), H(this, Je) && this.setPhpIniPath(H(this, Je)), H(this, Qe) && this.setSapiName(H(this, Qe)), t && copyFS(r, this[__private__dont__use].FS, t);
|
|
2498
2560
|
}
|
|
2499
2561
|
exit(e = 0) {
|
|
2500
2562
|
this.dispatchEvent({
|
|
@@ -2504,10 +2566,20 @@ class BasePHP {
|
|
|
2504
2566
|
this[__private__dont__use]._exit(e);
|
|
2505
2567
|
} catch {
|
|
2506
2568
|
}
|
|
2507
|
-
|
|
2569
|
+
ie(this, be, !1), ie(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2508
2570
|
}
|
|
2509
2571
|
}
|
|
2510
|
-
|
|
2572
|
+
De = new WeakMap(), Je = new WeakMap(), Qe = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Ee = new WeakMap(), Ye = new WeakMap(), _t = new WeakSet(), Kt = function(e, t, r) {
|
|
2573
|
+
const n = {
|
|
2574
|
+
...e || {}
|
|
2575
|
+
};
|
|
2576
|
+
n.HTTPS = n.HTTPS || r === 443 ? "on" : "off";
|
|
2577
|
+
for (const s in t) {
|
|
2578
|
+
let i = "HTTP_";
|
|
2579
|
+
["content-type", "content-length"].includes(s.toLowerCase()) && (i = ""), n[`${i}${s.toUpperCase().replace(/-/g, "_")}`] = t[s];
|
|
2580
|
+
}
|
|
2581
|
+
return n;
|
|
2582
|
+
}, gt = new WeakSet(), Jt = function() {
|
|
2511
2583
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2512
2584
|
"/internal/consts.php",
|
|
2513
2585
|
`<?php
|
|
@@ -2519,8 +2591,8 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2519
2591
|
}
|
|
2520
2592
|
}
|
|
2521
2593
|
}`
|
|
2522
|
-
), H(this,
|
|
2523
|
-
const e = H(this,
|
|
2594
|
+
), H(this, De).length > 0) {
|
|
2595
|
+
const e = H(this, De).map(([t, r]) => `${t}=${r}`).join(`
|
|
2524
2596
|
`) + `
|
|
2525
2597
|
|
|
2526
2598
|
`;
|
|
@@ -2532,7 +2604,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2532
2604
|
);
|
|
2533
2605
|
}
|
|
2534
2606
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2535
|
-
},
|
|
2607
|
+
}, $t = new WeakSet(), Qt = function() {
|
|
2536
2608
|
const e = "/internal/headers.json";
|
|
2537
2609
|
if (!this.fileExists(e))
|
|
2538
2610
|
throw new Error(
|
|
@@ -2549,7 +2621,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2549
2621
|
headers: r,
|
|
2550
2622
|
httpStatusCode: t.status
|
|
2551
2623
|
};
|
|
2552
|
-
},
|
|
2624
|
+
}, yt = new WeakSet(), Yt = function(e) {
|
|
2553
2625
|
if (this[__private__dont__use].ccall(
|
|
2554
2626
|
"wasm_set_request_uri",
|
|
2555
2627
|
null,
|
|
@@ -2564,32 +2636,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2564
2636
|
[t]
|
|
2565
2637
|
);
|
|
2566
2638
|
}
|
|
2567
|
-
},
|
|
2639
|
+
}, vt = new WeakSet(), Zt = function(e) {
|
|
2568
2640
|
this[__private__dont__use].ccall(
|
|
2569
2641
|
"wasm_set_request_host",
|
|
2570
2642
|
null,
|
|
2571
2643
|
[STRING],
|
|
2572
2644
|
[e]
|
|
2573
2645
|
);
|
|
2646
|
+
}, wt = new WeakSet(), Xt = function(e) {
|
|
2647
|
+
this[__private__dont__use].ccall(
|
|
2648
|
+
"wasm_set_request_port",
|
|
2649
|
+
null,
|
|
2650
|
+
[NUMBER],
|
|
2651
|
+
[e]
|
|
2652
|
+
);
|
|
2653
|
+
}, Pt = new WeakSet(), er = function(e, t) {
|
|
2574
2654
|
let r;
|
|
2575
2655
|
try {
|
|
2576
2656
|
r = parseInt(new URL(e).port, 10);
|
|
2577
2657
|
} catch {
|
|
2578
2658
|
}
|
|
2579
|
-
(!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80),
|
|
2580
|
-
|
|
2581
|
-
null,
|
|
2582
|
-
[NUMBER],
|
|
2583
|
-
[r]
|
|
2584
|
-
), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
2585
|
-
}, Pt = new WeakSet(), Zt = function(e) {
|
|
2659
|
+
return (!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80), r;
|
|
2660
|
+
}, bt = new WeakSet(), tr = function(e) {
|
|
2586
2661
|
this[__private__dont__use].ccall(
|
|
2587
2662
|
"wasm_set_request_method",
|
|
2588
2663
|
null,
|
|
2589
2664
|
[STRING],
|
|
2590
2665
|
[e]
|
|
2591
2666
|
);
|
|
2592
|
-
},
|
|
2667
|
+
}, Et = new WeakSet(), rr = function(e) {
|
|
2593
2668
|
e.cookie && this[__private__dont__use].ccall(
|
|
2594
2669
|
"wasm_set_cookies",
|
|
2595
2670
|
null,
|
|
@@ -2606,14 +2681,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2606
2681
|
[NUMBER],
|
|
2607
2682
|
[parseInt(e["content-length"], 10)]
|
|
2608
2683
|
);
|
|
2609
|
-
|
|
2610
|
-
let r = "HTTP_";
|
|
2611
|
-
["content-type", "content-length"].includes(t.toLowerCase()) && (r = ""), this.addServerGlobalEntry(
|
|
2612
|
-
`${r}${t.toUpperCase().replace(/-/g, "_")}`,
|
|
2613
|
-
e[t]
|
|
2614
|
-
);
|
|
2615
|
-
}
|
|
2616
|
-
}, Et = new WeakSet(), Xt = function(e) {
|
|
2684
|
+
}, St = new WeakSet(), nr = function(e) {
|
|
2617
2685
|
let t, r;
|
|
2618
2686
|
typeof e == "string" ? (console.warn(
|
|
2619
2687
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2636,36 +2704,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2636
2704
|
[NUMBER],
|
|
2637
2705
|
[r]
|
|
2638
2706
|
), n;
|
|
2639
|
-
},
|
|
2707
|
+
}, Rt = new WeakSet(), sr = function(e) {
|
|
2640
2708
|
this[__private__dont__use].ccall(
|
|
2641
2709
|
"wasm_set_path_translated",
|
|
2642
2710
|
null,
|
|
2643
2711
|
[STRING],
|
|
2644
2712
|
[e]
|
|
2645
2713
|
);
|
|
2646
|
-
},
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
}, Tt = new WeakSet(), rr = function(e, t) {
|
|
2714
|
+
}, Tt = new WeakSet(), ir = function(e, t) {
|
|
2715
|
+
this[__private__dont__use].ccall(
|
|
2716
|
+
"wasm_add_SERVER_entry",
|
|
2717
|
+
null,
|
|
2718
|
+
[STRING, STRING],
|
|
2719
|
+
[e, t]
|
|
2720
|
+
);
|
|
2721
|
+
}, kt = new WeakSet(), or = function(e, t) {
|
|
2655
2722
|
this[__private__dont__use].ccall(
|
|
2656
2723
|
"wasm_add_ENV_entry",
|
|
2657
2724
|
null,
|
|
2658
2725
|
[STRING, STRING],
|
|
2659
2726
|
[e, t]
|
|
2660
2727
|
);
|
|
2661
|
-
},
|
|
2728
|
+
}, Ct = new WeakSet(), ar = function(e) {
|
|
2662
2729
|
this[__private__dont__use].ccall(
|
|
2663
2730
|
"wasm_set_php_code",
|
|
2664
2731
|
null,
|
|
2665
2732
|
[STRING],
|
|
2666
2733
|
[e]
|
|
2667
2734
|
);
|
|
2668
|
-
},
|
|
2735
|
+
}, Ot = new WeakSet(), cr = async function() {
|
|
2669
2736
|
var s;
|
|
2670
2737
|
let e, t;
|
|
2671
2738
|
try {
|
|
@@ -2699,9 +2766,9 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2699
2766
|
const o = i, l = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(l);
|
|
2700
2767
|
throw d.cause = o, console.error(d), d;
|
|
2701
2768
|
} finally {
|
|
2702
|
-
(s = H(this, Re)) == null || s.removeEventListener("error", t)
|
|
2769
|
+
(s = H(this, Re)) == null || s.removeEventListener("error", t);
|
|
2703
2770
|
}
|
|
2704
|
-
const { headers: r, httpStatusCode: n } = ce(this,
|
|
2771
|
+
const { headers: r, httpStatusCode: n } = ce(this, $t, Qt).call(this);
|
|
2705
2772
|
return new PHPResponse(
|
|
2706
2773
|
e === 0 ? n : 500,
|
|
2707
2774
|
r,
|
|
@@ -2865,16 +2932,52 @@ class FetchResource extends Resource {
|
|
|
2865
2932
|
}
|
|
2866
2933
|
/** @inheritDoc */
|
|
2867
2934
|
async resolve() {
|
|
2868
|
-
var
|
|
2869
|
-
(
|
|
2935
|
+
var r, n;
|
|
2936
|
+
(r = this.progress) == null || r.setCaption(this.caption);
|
|
2870
2937
|
const t = this.getURL();
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2938
|
+
try {
|
|
2939
|
+
let s = await fetch(t);
|
|
2940
|
+
if (!s.ok)
|
|
2941
|
+
throw new Error(`Could not download "${t}"`);
|
|
2942
|
+
if (s = await cloneResponseMonitorProgress(
|
|
2943
|
+
s,
|
|
2944
|
+
((n = this.progress) == null ? void 0 : n.loadingListener) ?? noop
|
|
2945
|
+
), s.status !== 200)
|
|
2946
|
+
throw new Error(`Could not download "${t}"`);
|
|
2947
|
+
return new File([await s.blob()], this.name);
|
|
2948
|
+
} catch (s) {
|
|
2949
|
+
throw new Error(
|
|
2950
|
+
`Could not download "${t}".
|
|
2951
|
+
Check if the URL is correct and the server is reachable.
|
|
2952
|
+
If the url is reachable, the server might be blocking the request.
|
|
2953
|
+
Check the console and network for more information.
|
|
2954
|
+
|
|
2955
|
+
## Does the console shows an error about "No 'Access-Control-Allow-Origin' header"?
|
|
2956
|
+
|
|
2957
|
+
This means the server where your file is hosted does not allow requests from other sites
|
|
2958
|
+
(cross-origin requests, or CORS). You will need to move it to another server that allows
|
|
2959
|
+
cross-origin file downloads. You can learn more about CORS at
|
|
2960
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.
|
|
2961
|
+
|
|
2962
|
+
If you're loading a file from https://github.com/, there's an easy fix – you can load it from
|
|
2963
|
+
raw.githubusercontent.com instead. Here's how to do that:
|
|
2964
|
+
|
|
2965
|
+
1. Start with the original GitHub URL for the file. For example:
|
|
2966
|
+
'''
|
|
2967
|
+
https://github.com/username/repository/blob/branch/filename
|
|
2968
|
+
'''
|
|
2969
|
+
2. Replace 'github.com' with 'raw.githubusercontent.com'.
|
|
2970
|
+
3. Remove the '/blob/' part of the URL.
|
|
2971
|
+
|
|
2972
|
+
The resulting URL should look like this:
|
|
2973
|
+
'''
|
|
2974
|
+
https://raw.githubusercontent.com/username/repository/branch/filename
|
|
2975
|
+
'''
|
|
2976
|
+
|
|
2977
|
+
Error:
|
|
2978
|
+
${s}`
|
|
2979
|
+
);
|
|
2980
|
+
}
|
|
2878
2981
|
}
|
|
2879
2982
|
/**
|
|
2880
2983
|
* Gets the caption for the progress tracker.
|
|
@@ -2998,10 +3101,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2998
3101
|
}
|
|
2999
3102
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
3000
3103
|
class r extends t {
|
|
3001
|
-
constructor(
|
|
3002
|
-
if (super(), !e.IDENTIFIER.test(
|
|
3104
|
+
constructor($) {
|
|
3105
|
+
if (super(), !e.IDENTIFIER.test($))
|
|
3003
3106
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
3004
|
-
this.str =
|
|
3107
|
+
this.str = $;
|
|
3005
3108
|
}
|
|
3006
3109
|
toString() {
|
|
3007
3110
|
return this.str;
|
|
@@ -3015,8 +3118,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3015
3118
|
}
|
|
3016
3119
|
e.Name = r;
|
|
3017
3120
|
class n extends t {
|
|
3018
|
-
constructor(
|
|
3019
|
-
super(), this._items = typeof
|
|
3121
|
+
constructor($) {
|
|
3122
|
+
super(), this._items = typeof $ == "string" ? [$] : $;
|
|
3020
3123
|
}
|
|
3021
3124
|
toString() {
|
|
3022
3125
|
return this.str;
|
|
@@ -3024,69 +3127,69 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3024
3127
|
emptyStr() {
|
|
3025
3128
|
if (this._items.length > 1)
|
|
3026
3129
|
return !1;
|
|
3027
|
-
const
|
|
3028
|
-
return
|
|
3130
|
+
const $ = this._items[0];
|
|
3131
|
+
return $ === "" || $ === '""';
|
|
3029
3132
|
}
|
|
3030
3133
|
get str() {
|
|
3031
|
-
var
|
|
3032
|
-
return (
|
|
3134
|
+
var $;
|
|
3135
|
+
return ($ = this._str) !== null && $ !== void 0 ? $ : this._str = this._items.reduce((P, I) => `${P}${I}`, "");
|
|
3033
3136
|
}
|
|
3034
3137
|
get names() {
|
|
3035
|
-
var
|
|
3036
|
-
return (
|
|
3138
|
+
var $;
|
|
3139
|
+
return ($ = this._names) !== null && $ !== void 0 ? $ : this._names = this._items.reduce((P, I) => (I instanceof r && (P[I.str] = (P[I.str] || 0) + 1), P), {});
|
|
3037
3140
|
}
|
|
3038
3141
|
}
|
|
3039
3142
|
e._Code = n, e.nil = new n("");
|
|
3040
|
-
function s(_,
|
|
3143
|
+
function s(_, ...$) {
|
|
3041
3144
|
const P = [_[0]];
|
|
3042
3145
|
let I = 0;
|
|
3043
|
-
for (; I <
|
|
3044
|
-
l(P,
|
|
3146
|
+
for (; I < $.length; )
|
|
3147
|
+
l(P, $[I]), P.push(_[++I]);
|
|
3045
3148
|
return new n(P);
|
|
3046
3149
|
}
|
|
3047
3150
|
e._ = s;
|
|
3048
3151
|
const i = new n("+");
|
|
3049
|
-
function o(_,
|
|
3152
|
+
function o(_, ...$) {
|
|
3050
3153
|
const P = [C(_[0])];
|
|
3051
3154
|
let I = 0;
|
|
3052
|
-
for (; I <
|
|
3053
|
-
P.push(i), l(P,
|
|
3155
|
+
for (; I < $.length; )
|
|
3156
|
+
P.push(i), l(P, $[I]), P.push(i, C(_[++I]));
|
|
3054
3157
|
return d(P), new n(P);
|
|
3055
3158
|
}
|
|
3056
3159
|
e.str = o;
|
|
3057
|
-
function l(_,
|
|
3058
|
-
|
|
3160
|
+
function l(_, $) {
|
|
3161
|
+
$ instanceof n ? _.push(...$._items) : $ instanceof r ? _.push($) : _.push(g($));
|
|
3059
3162
|
}
|
|
3060
3163
|
e.addCodeArg = l;
|
|
3061
3164
|
function d(_) {
|
|
3062
|
-
let
|
|
3063
|
-
for (;
|
|
3064
|
-
if (_[
|
|
3065
|
-
const P = u(_[
|
|
3165
|
+
let $ = 1;
|
|
3166
|
+
for (; $ < _.length - 1; ) {
|
|
3167
|
+
if (_[$] === i) {
|
|
3168
|
+
const P = u(_[$ - 1], _[$ + 1]);
|
|
3066
3169
|
if (P !== void 0) {
|
|
3067
|
-
_.splice(
|
|
3170
|
+
_.splice($ - 1, 3, P);
|
|
3068
3171
|
continue;
|
|
3069
3172
|
}
|
|
3070
|
-
_[
|
|
3173
|
+
_[$++] = "+";
|
|
3071
3174
|
}
|
|
3072
|
-
|
|
3175
|
+
$++;
|
|
3073
3176
|
}
|
|
3074
3177
|
}
|
|
3075
|
-
function u(_,
|
|
3076
|
-
if (
|
|
3178
|
+
function u(_, $) {
|
|
3179
|
+
if ($ === '""')
|
|
3077
3180
|
return _;
|
|
3078
3181
|
if (_ === '""')
|
|
3079
|
-
return
|
|
3182
|
+
return $;
|
|
3080
3183
|
if (typeof _ == "string")
|
|
3081
|
-
return
|
|
3082
|
-
if (typeof
|
|
3083
|
-
return `"${_}${
|
|
3184
|
+
return $ instanceof r || _[_.length - 1] !== '"' ? void 0 : typeof $ != "string" ? `${_.slice(0, -1)}${$}"` : $[0] === '"' ? _.slice(0, -1) + $.slice(1) : void 0;
|
|
3185
|
+
if (typeof $ == "string" && $[0] === '"' && !(_ instanceof r))
|
|
3186
|
+
return `"${_}${$.slice(1)}`;
|
|
3084
3187
|
}
|
|
3085
|
-
function p(_,
|
|
3086
|
-
return
|
|
3188
|
+
function p(_, $) {
|
|
3189
|
+
return $.emptyStr() ? _ : _.emptyStr() ? $ : o`${_}${$}`;
|
|
3087
3190
|
}
|
|
3088
3191
|
e.strConcat = p;
|
|
3089
|
-
function
|
|
3192
|
+
function g(_) {
|
|
3090
3193
|
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : C(Array.isArray(_) ? _.join(",") : _);
|
|
3091
3194
|
}
|
|
3092
3195
|
function O(_) {
|
|
@@ -3144,8 +3247,8 @@ var scope = {};
|
|
|
3144
3247
|
return `${u}${p.index++}`;
|
|
3145
3248
|
}
|
|
3146
3249
|
_nameGroup(u) {
|
|
3147
|
-
var p,
|
|
3148
|
-
if (!((
|
|
3250
|
+
var p, g;
|
|
3251
|
+
if (!((g = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || g === void 0) && g.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3149
3252
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3150
3253
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3151
3254
|
}
|
|
@@ -3155,8 +3258,8 @@ var scope = {};
|
|
|
3155
3258
|
constructor(u, p) {
|
|
3156
3259
|
super(p), this.prefix = u;
|
|
3157
3260
|
}
|
|
3158
|
-
setValue(u, { property: p, itemIndex:
|
|
3159
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3261
|
+
setValue(u, { property: p, itemIndex: g }) {
|
|
3262
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${g}]`;
|
|
3160
3263
|
}
|
|
3161
3264
|
}
|
|
3162
3265
|
e.ValueScopeName = i;
|
|
@@ -3172,15 +3275,15 @@ var scope = {};
|
|
|
3172
3275
|
return new i(u, this._newName(u));
|
|
3173
3276
|
}
|
|
3174
3277
|
value(u, p) {
|
|
3175
|
-
var
|
|
3278
|
+
var g;
|
|
3176
3279
|
if (p.ref === void 0)
|
|
3177
3280
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3178
|
-
const O = this.toName(u), { prefix: C } = O, S = (
|
|
3281
|
+
const O = this.toName(u), { prefix: C } = O, S = (g = p.key) !== null && g !== void 0 ? g : p.ref;
|
|
3179
3282
|
let T = this._values[C];
|
|
3180
3283
|
if (T) {
|
|
3181
|
-
const
|
|
3182
|
-
if (
|
|
3183
|
-
return
|
|
3284
|
+
const $ = T.get(S);
|
|
3285
|
+
if ($)
|
|
3286
|
+
return $;
|
|
3184
3287
|
} else
|
|
3185
3288
|
T = this._values[C] = /* @__PURE__ */ new Map();
|
|
3186
3289
|
T.set(S, O);
|
|
@@ -3188,41 +3291,41 @@ var scope = {};
|
|
|
3188
3291
|
return y[_] = p.ref, O.setValue(p, { property: C, itemIndex: _ }), O;
|
|
3189
3292
|
}
|
|
3190
3293
|
getValue(u, p) {
|
|
3191
|
-
const
|
|
3192
|
-
if (
|
|
3193
|
-
return
|
|
3294
|
+
const g = this._values[u];
|
|
3295
|
+
if (g)
|
|
3296
|
+
return g.get(p);
|
|
3194
3297
|
}
|
|
3195
3298
|
scopeRefs(u, p = this._values) {
|
|
3196
|
-
return this._reduceValues(p, (
|
|
3197
|
-
if (
|
|
3198
|
-
throw new Error(`CodeGen: name "${
|
|
3199
|
-
return (0, t._)`${u}${
|
|
3299
|
+
return this._reduceValues(p, (g) => {
|
|
3300
|
+
if (g.scopePath === void 0)
|
|
3301
|
+
throw new Error(`CodeGen: name "${g}" has no value`);
|
|
3302
|
+
return (0, t._)`${u}${g.scopePath}`;
|
|
3200
3303
|
});
|
|
3201
3304
|
}
|
|
3202
|
-
scopeCode(u = this._values, p,
|
|
3305
|
+
scopeCode(u = this._values, p, g) {
|
|
3203
3306
|
return this._reduceValues(u, (O) => {
|
|
3204
3307
|
if (O.value === void 0)
|
|
3205
3308
|
throw new Error(`CodeGen: name "${O}" has no value`);
|
|
3206
3309
|
return O.value.code;
|
|
3207
|
-
}, p,
|
|
3310
|
+
}, p, g);
|
|
3208
3311
|
}
|
|
3209
|
-
_reduceValues(u, p,
|
|
3312
|
+
_reduceValues(u, p, g = {}, O) {
|
|
3210
3313
|
let C = t.nil;
|
|
3211
3314
|
for (const S in u) {
|
|
3212
3315
|
const T = u[S];
|
|
3213
3316
|
if (!T)
|
|
3214
3317
|
continue;
|
|
3215
|
-
const y =
|
|
3318
|
+
const y = g[S] = g[S] || /* @__PURE__ */ new Map();
|
|
3216
3319
|
T.forEach((_) => {
|
|
3217
3320
|
if (y.has(_))
|
|
3218
3321
|
return;
|
|
3219
3322
|
y.set(_, n.Started);
|
|
3220
|
-
let
|
|
3221
|
-
if (
|
|
3323
|
+
let $ = p(_);
|
|
3324
|
+
if ($) {
|
|
3222
3325
|
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3223
|
-
C = (0, t._)`${C}${P} ${_} = ${
|
|
3224
|
-
} else if (
|
|
3225
|
-
C = (0, t._)`${C}${
|
|
3326
|
+
C = (0, t._)`${C}${P} ${_} = ${$};${this.opts._n}`;
|
|
3327
|
+
} else if ($ = O == null ? void 0 : O(_))
|
|
3328
|
+
C = (0, t._)`${C}${$}${this.opts._n}`;
|
|
3226
3329
|
else
|
|
3227
3330
|
throw new r(_);
|
|
3228
3331
|
y.set(_, n.Completed);
|
|
@@ -3339,7 +3442,7 @@ var scope = {};
|
|
|
3339
3442
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3340
3443
|
}
|
|
3341
3444
|
}
|
|
3342
|
-
class
|
|
3445
|
+
class g extends i {
|
|
3343
3446
|
constructor(a) {
|
|
3344
3447
|
super(), this.error = a;
|
|
3345
3448
|
}
|
|
@@ -3388,12 +3491,12 @@ var scope = {};
|
|
|
3388
3491
|
let M = N.length;
|
|
3389
3492
|
for (; M--; ) {
|
|
3390
3493
|
const q = N[M];
|
|
3391
|
-
q.optimizeNames(a, h) || (
|
|
3494
|
+
q.optimizeNames(a, h) || (Te(a, q.names), N.splice(M, 1));
|
|
3392
3495
|
}
|
|
3393
3496
|
return N.length > 0 ? this : void 0;
|
|
3394
3497
|
}
|
|
3395
3498
|
get names() {
|
|
3396
|
-
return this.nodes.reduce((a, h) =>
|
|
3499
|
+
return this.nodes.reduce((a, h) => J(a, h.names), {});
|
|
3397
3500
|
}
|
|
3398
3501
|
}
|
|
3399
3502
|
class S extends C {
|
|
@@ -3425,7 +3528,7 @@ var scope = {};
|
|
|
3425
3528
|
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3426
3529
|
}
|
|
3427
3530
|
if (h)
|
|
3428
|
-
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(
|
|
3531
|
+
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(ke(a), h instanceof _ ? [h] : h.nodes);
|
|
3429
3532
|
if (!(a === !1 || !this.nodes.length))
|
|
3430
3533
|
return this;
|
|
3431
3534
|
}
|
|
@@ -3436,14 +3539,14 @@ var scope = {};
|
|
|
3436
3539
|
}
|
|
3437
3540
|
get names() {
|
|
3438
3541
|
const a = super.names;
|
|
3439
|
-
return ue(a, this.condition), this.else &&
|
|
3542
|
+
return ue(a, this.condition), this.else && J(a, this.else.names), a;
|
|
3440
3543
|
}
|
|
3441
3544
|
}
|
|
3442
3545
|
_.kind = "if";
|
|
3443
|
-
class
|
|
3546
|
+
class $ extends S {
|
|
3444
3547
|
}
|
|
3445
|
-
|
|
3446
|
-
class P extends
|
|
3548
|
+
$.kind = "for";
|
|
3549
|
+
class P extends $ {
|
|
3447
3550
|
constructor(a) {
|
|
3448
3551
|
super(), this.iteration = a;
|
|
3449
3552
|
}
|
|
@@ -3455,10 +3558,10 @@ var scope = {};
|
|
|
3455
3558
|
return this.iteration = oe(this.iteration, a, h), this;
|
|
3456
3559
|
}
|
|
3457
3560
|
get names() {
|
|
3458
|
-
return
|
|
3561
|
+
return J(super.names, this.iteration.names);
|
|
3459
3562
|
}
|
|
3460
3563
|
}
|
|
3461
|
-
class I extends
|
|
3564
|
+
class I extends $ {
|
|
3462
3565
|
constructor(a, h, N, M) {
|
|
3463
3566
|
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3464
3567
|
}
|
|
@@ -3471,7 +3574,7 @@ var scope = {};
|
|
|
3471
3574
|
return ue(a, this.to);
|
|
3472
3575
|
}
|
|
3473
3576
|
}
|
|
3474
|
-
class D extends
|
|
3577
|
+
class D extends $ {
|
|
3475
3578
|
constructor(a, h, N, M) {
|
|
3476
3579
|
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3477
3580
|
}
|
|
@@ -3483,7 +3586,7 @@ var scope = {};
|
|
|
3483
3586
|
return this.iterable = oe(this.iterable, a, h), this;
|
|
3484
3587
|
}
|
|
3485
3588
|
get names() {
|
|
3486
|
-
return
|
|
3589
|
+
return J(super.names, this.iterable.names);
|
|
3487
3590
|
}
|
|
3488
3591
|
}
|
|
3489
3592
|
class w extends S {
|
|
@@ -3516,7 +3619,7 @@ var scope = {};
|
|
|
3516
3619
|
}
|
|
3517
3620
|
get names() {
|
|
3518
3621
|
const a = super.names;
|
|
3519
|
-
return this.catch &&
|
|
3622
|
+
return this.catch && J(a, this.catch.names), this.finally && J(a, this.finally.names), a;
|
|
3520
3623
|
}
|
|
3521
3624
|
}
|
|
3522
3625
|
class V extends S {
|
|
@@ -3534,7 +3637,7 @@ var scope = {};
|
|
|
3534
3637
|
}
|
|
3535
3638
|
}
|
|
3536
3639
|
x.kind = "finally";
|
|
3537
|
-
class
|
|
3640
|
+
class te {
|
|
3538
3641
|
constructor(a, h = {}) {
|
|
3539
3642
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3540
3643
|
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new T()];
|
|
@@ -3656,7 +3759,7 @@ var scope = {};
|
|
|
3656
3759
|
}
|
|
3657
3760
|
// end `for` loop
|
|
3658
3761
|
endFor() {
|
|
3659
|
-
return this._endBlockNode(
|
|
3762
|
+
return this._endBlockNode($);
|
|
3660
3763
|
}
|
|
3661
3764
|
// `label` statement
|
|
3662
3765
|
label(a) {
|
|
@@ -3686,7 +3789,7 @@ var scope = {};
|
|
|
3686
3789
|
}
|
|
3687
3790
|
// `throw` statement
|
|
3688
3791
|
throw(a) {
|
|
3689
|
-
return this._leafNode(new
|
|
3792
|
+
return this._leafNode(new g(a));
|
|
3690
3793
|
}
|
|
3691
3794
|
// start self-balancing block
|
|
3692
3795
|
block(a, h) {
|
|
@@ -3744,14 +3847,14 @@ var scope = {};
|
|
|
3744
3847
|
h[h.length - 1] = a;
|
|
3745
3848
|
}
|
|
3746
3849
|
}
|
|
3747
|
-
e.CodeGen =
|
|
3748
|
-
function
|
|
3850
|
+
e.CodeGen = te;
|
|
3851
|
+
function J(b, a) {
|
|
3749
3852
|
for (const h in a)
|
|
3750
3853
|
b[h] = (b[h] || 0) + (a[h] || 0);
|
|
3751
3854
|
return b;
|
|
3752
3855
|
}
|
|
3753
3856
|
function ue(b, a) {
|
|
3754
|
-
return a instanceof t._CodeOrName ?
|
|
3857
|
+
return a instanceof t._CodeOrName ? J(b, a.names) : b;
|
|
3755
3858
|
}
|
|
3756
3859
|
function oe(b, a, h) {
|
|
3757
3860
|
if (b instanceof t.Name)
|
|
@@ -3767,22 +3870,22 @@ var scope = {};
|
|
|
3767
3870
|
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3768
3871
|
}
|
|
3769
3872
|
}
|
|
3770
|
-
function
|
|
3873
|
+
function Te(b, a) {
|
|
3771
3874
|
for (const h in a)
|
|
3772
3875
|
b[h] = (b[h] || 0) - (a[h] || 0);
|
|
3773
3876
|
}
|
|
3774
|
-
function
|
|
3877
|
+
function ke(b) {
|
|
3775
3878
|
return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
|
|
3776
3879
|
}
|
|
3777
|
-
e.not =
|
|
3778
|
-
const
|
|
3779
|
-
function
|
|
3780
|
-
return b.reduce(
|
|
3880
|
+
e.not = ke;
|
|
3881
|
+
const Fe = v(e.operators.AND);
|
|
3882
|
+
function Ze(...b) {
|
|
3883
|
+
return b.reduce(Fe);
|
|
3781
3884
|
}
|
|
3782
|
-
e.and =
|
|
3783
|
-
const
|
|
3885
|
+
e.and = Ze;
|
|
3886
|
+
const Me = v(e.operators.OR);
|
|
3784
3887
|
function F(...b) {
|
|
3785
|
-
return b.reduce(
|
|
3888
|
+
return b.reduce(Me);
|
|
3786
3889
|
}
|
|
3787
3890
|
e.or = F;
|
|
3788
3891
|
function v(b) {
|
|
@@ -3812,8 +3915,8 @@ var util = {};
|
|
|
3812
3915
|
if (!A.strictSchema || typeof k == "boolean")
|
|
3813
3916
|
return;
|
|
3814
3917
|
const x = V.RULES.keywords;
|
|
3815
|
-
for (const
|
|
3816
|
-
x[
|
|
3918
|
+
for (const te in k)
|
|
3919
|
+
x[te] || D(w, `unknown keyword: "${te}"`);
|
|
3817
3920
|
}
|
|
3818
3921
|
e.checkUnknownRules = i;
|
|
3819
3922
|
function o(w, k) {
|
|
@@ -3849,13 +3952,13 @@ var util = {};
|
|
|
3849
3952
|
}
|
|
3850
3953
|
e.unescapeFragment = u;
|
|
3851
3954
|
function p(w) {
|
|
3852
|
-
return encodeURIComponent(
|
|
3955
|
+
return encodeURIComponent(g(w));
|
|
3853
3956
|
}
|
|
3854
3957
|
e.escapeFragment = p;
|
|
3855
|
-
function
|
|
3958
|
+
function g(w) {
|
|
3856
3959
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3857
3960
|
}
|
|
3858
|
-
e.escapeJsonPointer =
|
|
3961
|
+
e.escapeJsonPointer = g;
|
|
3859
3962
|
function O(w) {
|
|
3860
3963
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3861
3964
|
}
|
|
@@ -3869,8 +3972,8 @@ var util = {};
|
|
|
3869
3972
|
}
|
|
3870
3973
|
e.eachItem = C;
|
|
3871
3974
|
function S({ mergeNames: w, mergeToName: k, mergeValues: A, resultToName: V }) {
|
|
3872
|
-
return (x,
|
|
3873
|
-
const oe =
|
|
3975
|
+
return (x, te, J, ue) => {
|
|
3976
|
+
const oe = J === void 0 ? te : J instanceof t.Name ? (te instanceof t.Name ? w(x, te, J) : k(x, te, J), J) : te instanceof t.Name ? (k(x, J, te), te) : A(te, J);
|
|
3874
3977
|
return ue === t.Name && !(oe instanceof t.Name) ? V(x, oe) : oe;
|
|
3875
3978
|
};
|
|
3876
3979
|
}
|
|
@@ -3904,13 +4007,13 @@ var util = {};
|
|
|
3904
4007
|
}
|
|
3905
4008
|
e.setEvaluated = y;
|
|
3906
4009
|
const _ = {};
|
|
3907
|
-
function
|
|
4010
|
+
function $(w, k) {
|
|
3908
4011
|
return w.scopeValue("func", {
|
|
3909
4012
|
ref: k,
|
|
3910
4013
|
code: _[k.code] || (_[k.code] = new r._Code(k.code))
|
|
3911
4014
|
});
|
|
3912
4015
|
}
|
|
3913
|
-
e.useFunc =
|
|
4016
|
+
e.useFunc = $;
|
|
3914
4017
|
var P;
|
|
3915
4018
|
(function(w) {
|
|
3916
4019
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
@@ -3920,7 +4023,7 @@ var util = {};
|
|
|
3920
4023
|
const V = k === P.Num;
|
|
3921
4024
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3922
4025
|
}
|
|
3923
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
4026
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3924
4027
|
}
|
|
3925
4028
|
e.getErrorPath = I;
|
|
3926
4029
|
function D(w, k, A = w.opts.strictSchema) {
|
|
@@ -3966,13 +4069,13 @@ names$1.default = names;
|
|
|
3966
4069
|
}, e.keyword$DataError = {
|
|
3967
4070
|
message: ({ keyword: y, schemaType: _ }) => _ ? (0, t.str)`"${y}" keyword must be ${_} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3968
4071
|
};
|
|
3969
|
-
function s(y, _ = e.keywordError,
|
|
3970
|
-
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A =
|
|
4072
|
+
function s(y, _ = e.keywordError, $, P) {
|
|
4073
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A = g(y, _, $);
|
|
3971
4074
|
P ?? (w || k) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3972
4075
|
}
|
|
3973
4076
|
e.reportError = s;
|
|
3974
|
-
function i(y, _ = e.keywordError,
|
|
3975
|
-
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k =
|
|
4077
|
+
function i(y, _ = e.keywordError, $) {
|
|
4078
|
+
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k = g(y, _, $);
|
|
3976
4079
|
d(I, k), D || w || u(P, n.default.vErrors);
|
|
3977
4080
|
}
|
|
3978
4081
|
e.reportExtraError = i;
|
|
@@ -3980,22 +4083,22 @@ names$1.default = names;
|
|
|
3980
4083
|
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)));
|
|
3981
4084
|
}
|
|
3982
4085
|
e.resetErrorsCount = o;
|
|
3983
|
-
function l({ gen: y, keyword: _, schemaValue:
|
|
4086
|
+
function l({ gen: y, keyword: _, schemaValue: $, data: P, errsCount: I, it: D }) {
|
|
3984
4087
|
if (I === void 0)
|
|
3985
4088
|
throw new Error("ajv implementation error");
|
|
3986
4089
|
const w = y.name("err");
|
|
3987
4090
|
y.forRange("i", I, n.default.errors, (k) => {
|
|
3988
|
-
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`,
|
|
4091
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${k}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${_}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, $), y.assign((0, t._)`${w}.data`, P));
|
|
3989
4092
|
});
|
|
3990
4093
|
}
|
|
3991
4094
|
e.extendErrors = l;
|
|
3992
4095
|
function d(y, _) {
|
|
3993
|
-
const
|
|
3994
|
-
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${
|
|
4096
|
+
const $ = y.const("err", _);
|
|
4097
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${$}]`), (0, t._)`${n.default.vErrors}.push(${$})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3995
4098
|
}
|
|
3996
4099
|
function u(y, _) {
|
|
3997
|
-
const { gen:
|
|
3998
|
-
I.$async ?
|
|
4100
|
+
const { gen: $, validateName: P, schemaEnv: I } = y;
|
|
4101
|
+
I.$async ? $.throw((0, t._)`new ${y.ValidationError}(${_})`) : ($.assign((0, t._)`${P}.errors`, _), $.return(!1));
|
|
3999
4102
|
}
|
|
4000
4103
|
const p = {
|
|
4001
4104
|
keyword: new t.Name("keyword"),
|
|
@@ -4006,28 +4109,28 @@ names$1.default = names;
|
|
|
4006
4109
|
schema: new t.Name("schema"),
|
|
4007
4110
|
parentSchema: new t.Name("parentSchema")
|
|
4008
4111
|
};
|
|
4009
|
-
function
|
|
4112
|
+
function g(y, _, $) {
|
|
4010
4113
|
const { createErrors: P } = y.it;
|
|
4011
|
-
return P === !1 ? (0, t._)`{}` : O(y, _,
|
|
4114
|
+
return P === !1 ? (0, t._)`{}` : O(y, _, $);
|
|
4012
4115
|
}
|
|
4013
|
-
function O(y, _,
|
|
4116
|
+
function O(y, _, $ = {}) {
|
|
4014
4117
|
const { gen: P, it: I } = y, D = [
|
|
4015
|
-
C(I,
|
|
4016
|
-
S(y,
|
|
4118
|
+
C(I, $),
|
|
4119
|
+
S(y, $)
|
|
4017
4120
|
];
|
|
4018
4121
|
return T(y, _, D), P.object(...D);
|
|
4019
4122
|
}
|
|
4020
4123
|
function C({ errorPath: y }, { instancePath: _ }) {
|
|
4021
|
-
const
|
|
4022
|
-
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath,
|
|
4124
|
+
const $ = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
4125
|
+
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, $)];
|
|
4023
4126
|
}
|
|
4024
|
-
function S({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath:
|
|
4127
|
+
function S({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: $, parentSchema: P }) {
|
|
4025
4128
|
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
4026
|
-
return
|
|
4129
|
+
return $ && (I = (0, t.str)`${I}${(0, r.getErrorPath)($, r.Type.Str)}`), [p.schemaPath, I];
|
|
4027
4130
|
}
|
|
4028
|
-
function T(y, { params: _, message:
|
|
4029
|
-
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath:
|
|
4030
|
-
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof
|
|
4131
|
+
function T(y, { params: _, message: $ }, P) {
|
|
4132
|
+
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: te } = k;
|
|
4133
|
+
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof $ == "function" ? $(y) : $]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${x}${te}`], [n.default.data, D]), V && P.push([p.propertyName, V]);
|
|
4031
4134
|
}
|
|
4032
4135
|
})(errors);
|
|
4033
4136
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4127,7 +4230,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4127
4230
|
}
|
|
4128
4231
|
e.getJSONTypes = d;
|
|
4129
4232
|
function u(P, I) {
|
|
4130
|
-
const { gen: D, data: w, opts: k } = P, A =
|
|
4233
|
+
const { gen: D, data: w, opts: k } = P, A = g(I, k.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
|
|
4131
4234
|
if (V) {
|
|
4132
4235
|
const x = T(I, w, k.strictNumbers, o.Wrong);
|
|
4133
4236
|
D.if(x, () => {
|
|
@@ -4138,19 +4241,19 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4138
4241
|
}
|
|
4139
4242
|
e.coerceAndCheckDataType = u;
|
|
4140
4243
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4141
|
-
function
|
|
4244
|
+
function g(P, I) {
|
|
4142
4245
|
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4143
4246
|
}
|
|
4144
4247
|
function O(P, I, D) {
|
|
4145
4248
|
const { gen: w, data: k, opts: A } = P, V = w.let("dataType", (0, s._)`typeof ${k}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4146
4249
|
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`);
|
|
4147
|
-
for (const
|
|
4148
|
-
(p.has(
|
|
4250
|
+
for (const J of D)
|
|
4251
|
+
(p.has(J) || J === "array" && A.coerceTypes === "array") && te(J);
|
|
4149
4252
|
w.else(), _(P), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4150
4253
|
w.assign(k, x), C(P, x);
|
|
4151
4254
|
});
|
|
4152
|
-
function
|
|
4153
|
-
switch (
|
|
4255
|
+
function te(J) {
|
|
4256
|
+
switch (J) {
|
|
4154
4257
|
case "string":
|
|
4155
4258
|
w.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(x, (0, s._)`"" + ${k}`).elseIf((0, s._)`${k} === null`).assign(x, (0, s._)`""`);
|
|
4156
4259
|
return;
|
|
@@ -4225,11 +4328,11 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4225
4328
|
params: ({ schema: P, schemaValue: I }) => typeof P == "string" ? (0, s._)`{type: ${P}}` : (0, s._)`{type: ${I}}`
|
|
4226
4329
|
};
|
|
4227
4330
|
function _(P) {
|
|
4228
|
-
const I =
|
|
4331
|
+
const I = $(P);
|
|
4229
4332
|
(0, n.reportError)(I, y);
|
|
4230
4333
|
}
|
|
4231
4334
|
e.reportTypeError = _;
|
|
4232
|
-
function
|
|
4335
|
+
function $(P) {
|
|
4233
4336
|
const { gen: I, data: D, schema: w } = P, k = (0, i.schemaRefOrVal)(P, w, "type");
|
|
4234
4337
|
return {
|
|
4235
4338
|
gen: I,
|
|
@@ -4319,14 +4422,14 @@ function schemaProperties(e, t) {
|
|
|
4319
4422
|
}
|
|
4320
4423
|
code.schemaProperties = schemaProperties;
|
|
4321
4424
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, l, d, u) {
|
|
4322
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4425
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, g = [
|
|
4323
4426
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4324
4427
|
[names_1$5.default.parentData, o.parentData],
|
|
4325
4428
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4326
4429
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4327
4430
|
];
|
|
4328
|
-
o.opts.dynamicRef &&
|
|
4329
|
-
const O = (0, codegen_1$q._)`${p}, ${r.object(
|
|
4431
|
+
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4432
|
+
const O = (0, codegen_1$q._)`${p}, ${r.object(...g)}`;
|
|
4330
4433
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${O})` : (0, codegen_1$q._)`${l}(${O})`;
|
|
4331
4434
|
}
|
|
4332
4435
|
code.callValidateCode = callValidateCode;
|
|
@@ -4396,8 +4499,8 @@ function funcKeywordCode(e, t) {
|
|
|
4396
4499
|
var r;
|
|
4397
4500
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4398
4501
|
checkAsyncKeyword(d, t);
|
|
4399
|
-
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4400
|
-
e.block$data(
|
|
4502
|
+
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), g = n.let("valid");
|
|
4503
|
+
e.block$data(g, O), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4401
4504
|
function O() {
|
|
4402
4505
|
if (t.errors === !1)
|
|
4403
4506
|
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
@@ -4408,19 +4511,19 @@ function funcKeywordCode(e, t) {
|
|
|
4408
4511
|
}
|
|
4409
4512
|
function C() {
|
|
4410
4513
|
const _ = n.let("ruleErrs", null);
|
|
4411
|
-
return n.try(() => T((0, codegen_1$p._)`await `), (
|
|
4514
|
+
return n.try(() => T((0, codegen_1$p._)`await `), ($) => n.assign(g, !1).if((0, codegen_1$p._)`${$} instanceof ${d.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${$}.errors`), () => n.throw($))), _;
|
|
4412
4515
|
}
|
|
4413
4516
|
function S() {
|
|
4414
4517
|
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4415
4518
|
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4416
4519
|
}
|
|
4417
4520
|
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4418
|
-
const
|
|
4419
|
-
n.assign(
|
|
4521
|
+
const $ = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !l || t.schema === !1);
|
|
4522
|
+
n.assign(g, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, p, $, P)}`, t.modifying);
|
|
4420
4523
|
}
|
|
4421
4524
|
function y(_) {
|
|
4422
|
-
var
|
|
4423
|
-
n.if((0, codegen_1$p.not)((
|
|
4525
|
+
var $;
|
|
4526
|
+
n.if((0, codegen_1$p.not)(($ = t.valid) !== null && $ !== void 0 ? $ : g), _);
|
|
4424
4527
|
}
|
|
4425
4528
|
}
|
|
4426
4529
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4499,8 +4602,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4499
4602
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4500
4603
|
const { gen: l } = t;
|
|
4501
4604
|
if (r !== void 0) {
|
|
4502
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4503
|
-
d(O), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4605
|
+
const { errorPath: u, dataPathArr: p, opts: g } = t, O = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4606
|
+
d(O), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, g.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4504
4607
|
}
|
|
4505
4608
|
if (s !== void 0) {
|
|
4506
4609
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4605,17 +4708,17 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4605
4708
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4606
4709
|
t(n, s, i, o, l, d, u);
|
|
4607
4710
|
for (var p in n) {
|
|
4608
|
-
var
|
|
4609
|
-
if (Array.isArray(
|
|
4711
|
+
var g = n[p];
|
|
4712
|
+
if (Array.isArray(g)) {
|
|
4610
4713
|
if (p in traverse$1.arrayKeywords)
|
|
4611
|
-
for (var O = 0; O <
|
|
4612
|
-
_traverse(e, t, r,
|
|
4714
|
+
for (var O = 0; O < g.length; O++)
|
|
4715
|
+
_traverse(e, t, r, g[O], s + "/" + p + "/" + O, i, s, p, n, O);
|
|
4613
4716
|
} else if (p in traverse$1.propsKeywords) {
|
|
4614
|
-
if (
|
|
4615
|
-
for (var C in
|
|
4616
|
-
_traverse(e, t, r,
|
|
4717
|
+
if (g && typeof g == "object")
|
|
4718
|
+
for (var C in g)
|
|
4719
|
+
_traverse(e, t, r, g[C], s + "/" + p + "/" + escapeJsonPtr(C), i, s, p, n, C);
|
|
4617
4720
|
} else
|
|
4618
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4721
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, g, s + "/" + p, i, s, p, n);
|
|
4619
4722
|
}
|
|
4620
4723
|
r(n, s, i, o, l, d, u);
|
|
4621
4724
|
}
|
|
@@ -4699,21 +4802,21 @@ function getSchemaRefs(e, t) {
|
|
|
4699
4802
|
if (typeof e == "boolean")
|
|
4700
4803
|
return {};
|
|
4701
4804
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4702
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4805
|
+
return traverse(e, { allKeys: !0 }, (g, O, C, S) => {
|
|
4703
4806
|
if (S === void 0)
|
|
4704
4807
|
return;
|
|
4705
4808
|
const T = o + O;
|
|
4706
4809
|
let y = i[S];
|
|
4707
|
-
typeof
|
|
4810
|
+
typeof g[r] == "string" && (y = _.call(this, g[r])), $.call(this, g.$anchor), $.call(this, g.$dynamicAnchor), i[O] = y;
|
|
4708
4811
|
function _(P) {
|
|
4709
4812
|
const I = this.opts.uriResolver.resolve;
|
|
4710
4813
|
if (P = normalizeId(y ? I(y, P) : P), d.has(P))
|
|
4711
4814
|
throw p(P);
|
|
4712
4815
|
d.add(P);
|
|
4713
4816
|
let D = this.refs[P];
|
|
4714
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4817
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(g, D.schema, P) : P !== normalizeId(T) && (P[0] === "#" ? (u(g, l[P], P), l[P] = g) : this.refs[P] = T), P;
|
|
4715
4818
|
}
|
|
4716
|
-
function
|
|
4819
|
+
function $(P) {
|
|
4717
4820
|
if (typeof P == "string") {
|
|
4718
4821
|
if (!ANCHOR.test(P))
|
|
4719
4822
|
throw new Error(`invalid anchor "${P}"`);
|
|
@@ -4721,12 +4824,12 @@ function getSchemaRefs(e, t) {
|
|
|
4721
4824
|
}
|
|
4722
4825
|
}
|
|
4723
4826
|
}), l;
|
|
4724
|
-
function u(
|
|
4725
|
-
if (O !== void 0 && !equal$2(
|
|
4827
|
+
function u(g, O, C) {
|
|
4828
|
+
if (O !== void 0 && !equal$2(g, O))
|
|
4726
4829
|
throw p(C);
|
|
4727
4830
|
}
|
|
4728
|
-
function p(
|
|
4729
|
-
return new Error(`reference "${
|
|
4831
|
+
function p(g) {
|
|
4832
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4730
4833
|
}
|
|
4731
4834
|
}
|
|
4732
4835
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4843,10 +4946,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4843
4946
|
}
|
|
4844
4947
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4845
4948
|
for (const O of p.rules)
|
|
4846
|
-
|
|
4847
|
-
|
|
4949
|
+
g(O);
|
|
4950
|
+
g(p.post);
|
|
4848
4951
|
});
|
|
4849
|
-
function
|
|
4952
|
+
function g(O) {
|
|
4850
4953
|
(0, applicability_1.shouldUseGroup)(i, O) && (O.type ? (s.if((0, dataType_2.checkDataType)(O.type, o, d.strictNumbers)), iterateKeywords(e, O), t.length === 1 && t[0] === O.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, O), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4851
4954
|
}
|
|
4852
4955
|
}
|
|
@@ -5109,10 +5212,10 @@ function compileSchema(e) {
|
|
|
5109
5212
|
let p;
|
|
5110
5213
|
try {
|
|
5111
5214
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5112
|
-
const
|
|
5113
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5215
|
+
const g = o.toString();
|
|
5216
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${g}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5114
5217
|
const C = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5115
|
-
if (this.scope.value(d, { ref: C }), C.errors = null, C.schema = e.schema, C.schemaEnv = e, e.$async && (C.$async = !0), this.opts.code.source === !0 && (C.source = { validateName: d, validateCode:
|
|
5218
|
+
if (this.scope.value(d, { ref: C }), C.errors = null, C.schema = e.schema, C.schemaEnv = e, e.$async && (C.$async = !0), this.opts.code.source === !0 && (C.source = { validateName: d, validateCode: g, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5116
5219
|
const { props: S, items: T } = u;
|
|
5117
5220
|
C.evaluated = {
|
|
5118
5221
|
props: S instanceof codegen_1$m.Name ? void 0 : S,
|
|
@@ -5122,8 +5225,8 @@ function compileSchema(e) {
|
|
|
5122
5225
|
}, C.source && (C.source.evaluated = (0, codegen_1$m.stringify)(C.evaluated));
|
|
5123
5226
|
}
|
|
5124
5227
|
return e.validate = C, e;
|
|
5125
|
-
} catch (
|
|
5126
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5228
|
+
} catch (g) {
|
|
5229
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), g;
|
|
5127
5230
|
} finally {
|
|
5128
5231
|
this._compilations.delete(e);
|
|
5129
5232
|
}
|
|
@@ -5270,39 +5373,39 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5270
5373
|
return m;
|
|
5271
5374
|
}
|
|
5272
5375
|
function u(f) {
|
|
5273
|
-
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
|
5376
|
+
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", Q = n(U, L), Z = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", ne = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Z);
|
|
5274
5377
|
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, L, "[\\:]")) + "*");
|
|
5275
|
-
var
|
|
5378
|
+
var Y = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), se = s(Y + "\\." + Y + "\\." + Y + "\\." + Y), z = s(R + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + se), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), ge = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), $e = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), xe = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ne = 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) + "?\\:\\:"), Ie = s([ae, ee, Se, ge, $e, xe, Ne, fe, ye].join("|")), we = s(s(B + "|" + E) + "+");
|
|
5276
5379
|
s("[vV]" + R + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5277
|
-
var
|
|
5278
|
-
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(
|
|
5380
|
+
var ot = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5381
|
+
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ot + "|" + n("[\\/\\?]", ne)) + "*"), {
|
|
5279
5382
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5280
5383
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5281
5384
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5282
5385
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
5283
5386
|
NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", B, L), "g"),
|
|
5284
|
-
NOT_QUERY: new RegExp(n("[^\\%]", B, L, "[\\:\\@\\/\\?]",
|
|
5387
|
+
NOT_QUERY: new RegExp(n("[^\\%]", B, L, "[\\:\\@\\/\\?]", ne), "g"),
|
|
5285
5388
|
NOT_FRAGMENT: new RegExp(n("[^\\%]", B, L, "[\\:\\@\\/\\?]"), "g"),
|
|
5286
5389
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5287
5390
|
UNRESERVED: new RegExp(B, "g"),
|
|
5288
|
-
OTHER_CHARS: new RegExp(n("[^\\%]", B,
|
|
5391
|
+
OTHER_CHARS: new RegExp(n("[^\\%]", B, Q), "g"),
|
|
5289
5392
|
PCT_ENCODED: new RegExp(E, "g"),
|
|
5290
|
-
IPV4ADDRESS: new RegExp("^(" +
|
|
5291
|
-
IPV6ADDRESS: new RegExp("^\\[?(" +
|
|
5393
|
+
IPV4ADDRESS: new RegExp("^(" + se + ")$"),
|
|
5394
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + Ie + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5292
5395
|
//RFC 6874, with relaxed parsing rules
|
|
5293
5396
|
};
|
|
5294
5397
|
}
|
|
5295
|
-
var p = u(!1),
|
|
5398
|
+
var p = u(!1), g = u(!0), O = function() {
|
|
5296
5399
|
function f(c, m) {
|
|
5297
5400
|
var R = [], E = !0, U = !1, L = void 0;
|
|
5298
5401
|
try {
|
|
5299
|
-
for (var
|
|
5402
|
+
for (var Q = c[Symbol.iterator](), Z; !(E = (Z = Q.next()).done) && (R.push(Z.value), !(m && R.length === m)); E = !0)
|
|
5300
5403
|
;
|
|
5301
|
-
} catch (
|
|
5302
|
-
U = !0, L =
|
|
5404
|
+
} catch (ne) {
|
|
5405
|
+
U = !0, L = ne;
|
|
5303
5406
|
} finally {
|
|
5304
5407
|
try {
|
|
5305
|
-
!E &&
|
|
5408
|
+
!E && Q.return && Q.return();
|
|
5306
5409
|
} finally {
|
|
5307
5410
|
if (U)
|
|
5308
5411
|
throw L;
|
|
@@ -5324,26 +5427,26 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5324
5427
|
return m;
|
|
5325
5428
|
} else
|
|
5326
5429
|
return Array.from(f);
|
|
5327
|
-
}, S = 2147483647, T = 36, y = 1, _ = 26,
|
|
5430
|
+
}, S = 2147483647, T = 36, y = 1, _ = 26, $ = 38, P = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5328
5431
|
overflow: "Overflow: input needs wider integers to process",
|
|
5329
5432
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5330
5433
|
"invalid-input": "Invalid input"
|
|
5331
|
-
},
|
|
5434
|
+
}, te = T - y, J = Math.floor, ue = String.fromCharCode;
|
|
5332
5435
|
function oe(f) {
|
|
5333
5436
|
throw new RangeError(x[f]);
|
|
5334
5437
|
}
|
|
5335
|
-
function
|
|
5438
|
+
function Te(f, c) {
|
|
5336
5439
|
for (var m = [], R = f.length; R--; )
|
|
5337
5440
|
m[R] = c(f[R]);
|
|
5338
5441
|
return m;
|
|
5339
5442
|
}
|
|
5340
|
-
function
|
|
5443
|
+
function ke(f, c) {
|
|
5341
5444
|
var m = f.split("@"), R = "";
|
|
5342
5445
|
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5343
|
-
var E = f.split("."), U =
|
|
5446
|
+
var E = f.split("."), U = Te(E, c).join(".");
|
|
5344
5447
|
return R + U;
|
|
5345
5448
|
}
|
|
5346
|
-
function
|
|
5449
|
+
function Fe(f) {
|
|
5347
5450
|
for (var c = [], m = 0, R = f.length; m < R; ) {
|
|
5348
5451
|
var E = f.charCodeAt(m++);
|
|
5349
5452
|
if (E >= 55296 && E <= 56319 && m < R) {
|
|
@@ -5354,113 +5457,113 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5354
5457
|
}
|
|
5355
5458
|
return c;
|
|
5356
5459
|
}
|
|
5357
|
-
var
|
|
5460
|
+
var Ze = function(c) {
|
|
5358
5461
|
return String.fromCodePoint.apply(String, C(c));
|
|
5359
|
-
},
|
|
5462
|
+
}, Me = function(c) {
|
|
5360
5463
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5361
5464
|
}, F = function(c, m) {
|
|
5362
5465
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5363
5466
|
}, v = function(c, m, R) {
|
|
5364
5467
|
var E = 0;
|
|
5365
5468
|
for (
|
|
5366
|
-
c = R ?
|
|
5469
|
+
c = R ? J(c / P) : c >> 1, c += J(c / m);
|
|
5367
5470
|
/* no initialization */
|
|
5368
|
-
c >
|
|
5471
|
+
c > te * _ >> 1;
|
|
5369
5472
|
E += T
|
|
5370
5473
|
)
|
|
5371
|
-
c =
|
|
5372
|
-
return
|
|
5474
|
+
c = J(c / te);
|
|
5475
|
+
return J(E + (te + 1) * c / (c + $));
|
|
5373
5476
|
}, j = function(c) {
|
|
5374
|
-
var m = [], R = c.length, E = 0, U = D, L = I,
|
|
5375
|
-
|
|
5376
|
-
for (var
|
|
5377
|
-
c.charCodeAt(
|
|
5378
|
-
for (var
|
|
5477
|
+
var m = [], R = c.length, E = 0, U = D, L = I, Q = c.lastIndexOf(w);
|
|
5478
|
+
Q < 0 && (Q = 0);
|
|
5479
|
+
for (var Z = 0; Z < Q; ++Z)
|
|
5480
|
+
c.charCodeAt(Z) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Z));
|
|
5481
|
+
for (var ne = Q > 0 ? Q + 1 : 0; ne < R; ) {
|
|
5379
5482
|
for (
|
|
5380
|
-
var B = E,
|
|
5483
|
+
var B = E, Y = 1, se = T;
|
|
5381
5484
|
;
|
|
5382
5485
|
/* no condition */
|
|
5383
|
-
|
|
5486
|
+
se += T
|
|
5384
5487
|
) {
|
|
5385
|
-
|
|
5386
|
-
var z =
|
|
5387
|
-
(z >= T || z >
|
|
5388
|
-
var X =
|
|
5488
|
+
ne >= R && oe("invalid-input");
|
|
5489
|
+
var z = Me(c.charCodeAt(ne++));
|
|
5490
|
+
(z >= T || z > J((S - E) / Y)) && oe("overflow"), E += z * Y;
|
|
5491
|
+
var X = se <= L ? y : se >= L + _ ? _ : se - L;
|
|
5389
5492
|
if (z < X)
|
|
5390
5493
|
break;
|
|
5391
5494
|
var ae = T - X;
|
|
5392
|
-
|
|
5495
|
+
Y > J(S / ae) && oe("overflow"), Y *= ae;
|
|
5393
5496
|
}
|
|
5394
5497
|
var ee = m.length + 1;
|
|
5395
|
-
L = v(E - B, ee, B == 0),
|
|
5498
|
+
L = v(E - B, ee, B == 0), J(E / ee) > S - U && oe("overflow"), U += J(E / ee), E %= ee, m.splice(E++, 0, U);
|
|
5396
5499
|
}
|
|
5397
5500
|
return String.fromCodePoint.apply(String, m);
|
|
5398
5501
|
}, b = function(c) {
|
|
5399
5502
|
var m = [];
|
|
5400
|
-
c =
|
|
5401
|
-
var R = c.length, E = D, U = 0, L = I,
|
|
5503
|
+
c = Fe(c);
|
|
5504
|
+
var R = c.length, E = D, U = 0, L = I, Q = !0, Z = !1, ne = void 0;
|
|
5402
5505
|
try {
|
|
5403
|
-
for (var B = c[Symbol.iterator](),
|
|
5404
|
-
var
|
|
5405
|
-
|
|
5506
|
+
for (var B = c[Symbol.iterator](), Y; !(Q = (Y = B.next()).done); Q = !0) {
|
|
5507
|
+
var se = Y.value;
|
|
5508
|
+
se < 128 && m.push(ue(se));
|
|
5406
5509
|
}
|
|
5407
|
-
} catch (
|
|
5408
|
-
|
|
5510
|
+
} catch (at) {
|
|
5511
|
+
Z = !0, ne = at;
|
|
5409
5512
|
} finally {
|
|
5410
5513
|
try {
|
|
5411
|
-
!
|
|
5514
|
+
!Q && B.return && B.return();
|
|
5412
5515
|
} finally {
|
|
5413
|
-
if (
|
|
5414
|
-
throw
|
|
5516
|
+
if (Z)
|
|
5517
|
+
throw ne;
|
|
5415
5518
|
}
|
|
5416
5519
|
}
|
|
5417
5520
|
var z = m.length, X = z;
|
|
5418
5521
|
for (z && m.push(w); X < R; ) {
|
|
5419
|
-
var ae = S, ee = !0, Se = !1,
|
|
5522
|
+
var ae = S, ee = !0, Se = !1, ge = void 0;
|
|
5420
5523
|
try {
|
|
5421
|
-
for (var
|
|
5422
|
-
var
|
|
5423
|
-
|
|
5524
|
+
for (var $e = c[Symbol.iterator](), xe; !(ee = (xe = $e.next()).done); ee = !0) {
|
|
5525
|
+
var Ne = xe.value;
|
|
5526
|
+
Ne >= E && Ne < ae && (ae = Ne);
|
|
5424
5527
|
}
|
|
5425
|
-
} catch (
|
|
5426
|
-
Se = !0,
|
|
5528
|
+
} catch (at) {
|
|
5529
|
+
Se = !0, ge = at;
|
|
5427
5530
|
} finally {
|
|
5428
5531
|
try {
|
|
5429
|
-
!ee &&
|
|
5532
|
+
!ee && $e.return && $e.return();
|
|
5430
5533
|
} finally {
|
|
5431
5534
|
if (Se)
|
|
5432
|
-
throw
|
|
5535
|
+
throw ge;
|
|
5433
5536
|
}
|
|
5434
5537
|
}
|
|
5435
5538
|
var fe = X + 1;
|
|
5436
|
-
ae - E >
|
|
5437
|
-
var ye = !0,
|
|
5539
|
+
ae - E > J((S - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5540
|
+
var ye = !0, Ie = !1, we = void 0;
|
|
5438
5541
|
try {
|
|
5439
|
-
for (var
|
|
5440
|
-
var
|
|
5441
|
-
if (
|
|
5542
|
+
for (var ot = c[Symbol.iterator](), Ht; !(ye = (Ht = ot.next()).done); ye = !0) {
|
|
5543
|
+
var Vt = Ht.value;
|
|
5544
|
+
if (Vt < E && ++U > S && oe("overflow"), Vt == E) {
|
|
5442
5545
|
for (
|
|
5443
|
-
var
|
|
5546
|
+
var dt = U, ut = T;
|
|
5444
5547
|
;
|
|
5445
5548
|
/* no condition */
|
|
5446
|
-
|
|
5549
|
+
ut += T
|
|
5447
5550
|
) {
|
|
5448
|
-
var
|
|
5449
|
-
if (
|
|
5551
|
+
var pt = ut <= L ? y : ut >= L + _ ? _ : ut - L;
|
|
5552
|
+
if (dt < pt)
|
|
5450
5553
|
break;
|
|
5451
|
-
var
|
|
5452
|
-
m.push(ue(F(
|
|
5554
|
+
var zt = dt - pt, xt = T - pt;
|
|
5555
|
+
m.push(ue(F(pt + zt % xt, 0))), dt = J(zt / xt);
|
|
5453
5556
|
}
|
|
5454
|
-
m.push(ue(F(
|
|
5557
|
+
m.push(ue(F(dt, 0))), L = v(U, fe, X == z), U = 0, ++X;
|
|
5455
5558
|
}
|
|
5456
5559
|
}
|
|
5457
|
-
} catch (
|
|
5458
|
-
|
|
5560
|
+
} catch (at) {
|
|
5561
|
+
Ie = !0, we = at;
|
|
5459
5562
|
} finally {
|
|
5460
5563
|
try {
|
|
5461
|
-
!ye &&
|
|
5564
|
+
!ye && ot.return && ot.return();
|
|
5462
5565
|
} finally {
|
|
5463
|
-
if (
|
|
5566
|
+
if (Ie)
|
|
5464
5567
|
throw we;
|
|
5465
5568
|
}
|
|
5466
5569
|
}
|
|
@@ -5468,11 +5571,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5468
5571
|
}
|
|
5469
5572
|
return m.join("");
|
|
5470
5573
|
}, a = function(c) {
|
|
5471
|
-
return
|
|
5574
|
+
return ke(c, function(m) {
|
|
5472
5575
|
return k.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5473
5576
|
});
|
|
5474
5577
|
}, h = function(c) {
|
|
5475
|
-
return
|
|
5578
|
+
return ke(c, function(m) {
|
|
5476
5579
|
return A.test(m) ? "xn--" + b(m) : m;
|
|
5477
5580
|
});
|
|
5478
5581
|
}, N = {
|
|
@@ -5490,8 +5593,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5490
5593
|
* @type Object
|
|
5491
5594
|
*/
|
|
5492
5595
|
ucs2: {
|
|
5493
|
-
decode:
|
|
5494
|
-
encode:
|
|
5596
|
+
decode: Fe,
|
|
5597
|
+
encode: Ze
|
|
5495
5598
|
},
|
|
5496
5599
|
decode: j,
|
|
5497
5600
|
encode: b,
|
|
@@ -5516,8 +5619,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5516
5619
|
m += 6;
|
|
5517
5620
|
} else if (E >= 224) {
|
|
5518
5621
|
if (R - m >= 9) {
|
|
5519
|
-
var L = parseInt(f.substr(m + 4, 2), 16),
|
|
5520
|
-
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 |
|
|
5622
|
+
var L = parseInt(f.substr(m + 4, 2), 16), Q = parseInt(f.substr(m + 7, 2), 16);
|
|
5623
|
+
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 | Q & 63);
|
|
5521
5624
|
} else
|
|
5522
5625
|
c += f.substr(m, 9);
|
|
5523
5626
|
m += 9;
|
|
@@ -5533,44 +5636,44 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5533
5636
|
}
|
|
5534
5637
|
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;
|
|
5535
5638
|
}
|
|
5536
|
-
function
|
|
5639
|
+
function re(f) {
|
|
5537
5640
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5538
5641
|
}
|
|
5539
5642
|
function he(f, c) {
|
|
5540
5643
|
var m = f.match(c.IPV4ADDRESS) || [], R = O(m, 2), E = R[1];
|
|
5541
|
-
return E ? E.split(".").map(
|
|
5644
|
+
return E ? E.split(".").map(re).join(".") : f;
|
|
5542
5645
|
}
|
|
5543
|
-
function
|
|
5646
|
+
function qe(f, c) {
|
|
5544
5647
|
var m = f.match(c.IPV6ADDRESS) || [], R = O(m, 3), E = R[1], U = R[2];
|
|
5545
5648
|
if (E) {
|
|
5546
|
-
for (var L = E.toLowerCase().split("::").reverse(),
|
|
5547
|
-
ae[ee] = B[ee] ||
|
|
5548
|
-
|
|
5549
|
-
var Se = ae.reduce(function(fe, ye,
|
|
5649
|
+
for (var L = E.toLowerCase().split("::").reverse(), Q = O(L, 2), Z = Q[0], ne = Q[1], B = ne ? ne.split(":").map(re) : [], Y = Z.split(":").map(re), se = c.IPV4ADDRESS.test(Y[Y.length - 1]), z = se ? 7 : 8, X = Y.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5650
|
+
ae[ee] = B[ee] || Y[X + ee] || "";
|
|
5651
|
+
se && (ae[z - 1] = he(ae[z - 1], c));
|
|
5652
|
+
var Se = ae.reduce(function(fe, ye, Ie) {
|
|
5550
5653
|
if (!ye || ye === "0") {
|
|
5551
5654
|
var we = fe[fe.length - 1];
|
|
5552
|
-
we && we.index + we.length ===
|
|
5655
|
+
we && we.index + we.length === Ie ? we.length++ : fe.push({ index: Ie, length: 1 });
|
|
5553
5656
|
}
|
|
5554
5657
|
return fe;
|
|
5555
|
-
}, []),
|
|
5658
|
+
}, []), ge = Se.sort(function(fe, ye) {
|
|
5556
5659
|
return ye.length - fe.length;
|
|
5557
|
-
})[0],
|
|
5558
|
-
if (
|
|
5559
|
-
var
|
|
5560
|
-
|
|
5660
|
+
})[0], $e = void 0;
|
|
5661
|
+
if (ge && ge.length > 1) {
|
|
5662
|
+
var xe = ae.slice(0, ge.index), Ne = ae.slice(ge.index + ge.length);
|
|
5663
|
+
$e = xe.join(":") + "::" + Ne.join(":");
|
|
5561
5664
|
} else
|
|
5562
|
-
|
|
5563
|
-
return U && (
|
|
5665
|
+
$e = ae.join(":");
|
|
5666
|
+
return U && ($e += "%" + U), $e;
|
|
5564
5667
|
} else
|
|
5565
5668
|
return f;
|
|
5566
5669
|
}
|
|
5567
|
-
var
|
|
5670
|
+
var Xe = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, et = "".match(/(){0}/)[1] === void 0;
|
|
5568
5671
|
function de(f) {
|
|
5569
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ?
|
|
5672
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ? g : p;
|
|
5570
5673
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5571
|
-
var E = f.match(
|
|
5674
|
+
var E = f.match(Xe);
|
|
5572
5675
|
if (E) {
|
|
5573
|
-
|
|
5676
|
+
et ? (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 = qe(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5574
5677
|
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5575
5678
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5576
5679
|
if (m.host && (c.domainHost || U && U.domainHost))
|
|
@@ -5587,25 +5690,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5587
5690
|
m.error = m.error || "URI can not be parsed.";
|
|
5588
5691
|
return m;
|
|
5589
5692
|
}
|
|
5590
|
-
function
|
|
5591
|
-
var m = c.iri !== !1 ?
|
|
5592
|
-
return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(
|
|
5693
|
+
function tt(f, c) {
|
|
5694
|
+
var m = c.iri !== !1 ? g : p, R = [];
|
|
5695
|
+
return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(qe(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5593
5696
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5594
5697
|
})), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
|
|
5595
5698
|
}
|
|
5596
|
-
var
|
|
5699
|
+
var Ue = /^\.\.?\//, Le = /^\/\.(\/|$)/, He = /^\/\.\.(\/|$)/, rt = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5597
5700
|
function me(f) {
|
|
5598
5701
|
for (var c = []; f.length; )
|
|
5599
|
-
if (f.match(
|
|
5600
|
-
f = f.replace(
|
|
5601
|
-
else if (f.match(
|
|
5602
|
-
f = f.replace(
|
|
5603
|
-
else if (f.match(
|
|
5604
|
-
f = f.replace(
|
|
5702
|
+
if (f.match(Ue))
|
|
5703
|
+
f = f.replace(Ue, "");
|
|
5704
|
+
else if (f.match(Le))
|
|
5705
|
+
f = f.replace(Le, "/");
|
|
5706
|
+
else if (f.match(He))
|
|
5707
|
+
f = f.replace(He, "/"), c.pop();
|
|
5605
5708
|
else if (f === "." || f === "..")
|
|
5606
5709
|
f = "";
|
|
5607
5710
|
else {
|
|
5608
|
-
var m = f.match(
|
|
5711
|
+
var m = f.match(rt);
|
|
5609
5712
|
if (m) {
|
|
5610
5713
|
var R = m[0];
|
|
5611
5714
|
f = f.slice(R.length), c.push(R);
|
|
@@ -5615,44 +5718,44 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5615
5718
|
return c.join("");
|
|
5616
5719
|
}
|
|
5617
5720
|
function le(f) {
|
|
5618
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ?
|
|
5721
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? g : p, R = [], E = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5619
5722
|
if (E && E.serialize && E.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5620
5723
|
if (c.domainHost || E && E.domainHost)
|
|
5621
5724
|
try {
|
|
5622
5725
|
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5623
|
-
} catch (
|
|
5624
|
-
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " +
|
|
5726
|
+
} catch (Q) {
|
|
5727
|
+
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + Q;
|
|
5625
5728
|
}
|
|
5626
5729
|
}
|
|
5627
5730
|
G(f, m), c.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5628
|
-
var U =
|
|
5731
|
+
var U = tt(f, c);
|
|
5629
5732
|
if (U !== void 0 && (c.reference !== "suffix" && R.push("//"), R.push(U), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
|
|
5630
5733
|
var L = f.path;
|
|
5631
5734
|
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), R.push(L);
|
|
5632
5735
|
}
|
|
5633
5736
|
return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
|
|
5634
5737
|
}
|
|
5635
|
-
function
|
|
5738
|
+
function Ve(f, c) {
|
|
5636
5739
|
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], E = {};
|
|
5637
5740
|
return R || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (E.scheme = c.scheme, E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? E.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + c.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : E.path = c.path, E.path = me(E.path)), E.query = c.query) : (E.path = f.path, c.query !== void 0 ? E.query = c.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = c.fragment, E;
|
|
5638
5741
|
}
|
|
5639
|
-
function
|
|
5742
|
+
function nt(f, c, m) {
|
|
5640
5743
|
var R = d({ scheme: "null" }, m);
|
|
5641
|
-
return le(
|
|
5744
|
+
return le(Ve(de(f, R), de(c, R), R, !0), R);
|
|
5642
5745
|
}
|
|
5643
|
-
function
|
|
5746
|
+
function Ce(f, c) {
|
|
5644
5747
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
5645
5748
|
}
|
|
5646
|
-
function
|
|
5749
|
+
function st(f, c, m) {
|
|
5647
5750
|
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;
|
|
5648
5751
|
}
|
|
5649
|
-
function
|
|
5650
|
-
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE :
|
|
5752
|
+
function lt(f, c) {
|
|
5753
|
+
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE : g.ESCAPE, q);
|
|
5651
5754
|
}
|
|
5652
5755
|
function pe(f, c) {
|
|
5653
|
-
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED :
|
|
5756
|
+
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED : g.PCT_ENCODED, W);
|
|
5654
5757
|
}
|
|
5655
|
-
var
|
|
5758
|
+
var Oe = {
|
|
5656
5759
|
scheme: "http",
|
|
5657
5760
|
domainHost: !0,
|
|
5658
5761
|
parse: function(c, m) {
|
|
@@ -5662,50 +5765,50 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5662
5765
|
var R = String(c.scheme).toLowerCase() === "https";
|
|
5663
5766
|
return (c.port === (R ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5664
5767
|
}
|
|
5665
|
-
},
|
|
5768
|
+
}, jt = {
|
|
5666
5769
|
scheme: "https",
|
|
5667
|
-
domainHost:
|
|
5668
|
-
parse:
|
|
5669
|
-
serialize:
|
|
5770
|
+
domainHost: Oe.domainHost,
|
|
5771
|
+
parse: Oe.parse,
|
|
5772
|
+
serialize: Oe.serialize
|
|
5670
5773
|
};
|
|
5671
|
-
function
|
|
5774
|
+
function At(f) {
|
|
5672
5775
|
return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
|
|
5673
5776
|
}
|
|
5674
|
-
var
|
|
5777
|
+
var it = {
|
|
5675
5778
|
scheme: "ws",
|
|
5676
5779
|
domainHost: !0,
|
|
5677
5780
|
parse: function(c, m) {
|
|
5678
5781
|
var R = c;
|
|
5679
|
-
return R.secure =
|
|
5782
|
+
return R.secure = At(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
5680
5783
|
},
|
|
5681
5784
|
serialize: function(c, m) {
|
|
5682
|
-
if ((c.port === (
|
|
5785
|
+
if ((c.port === (At(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) {
|
|
5683
5786
|
var R = c.resourceName.split("?"), E = O(R, 2), U = E[0], L = E[1];
|
|
5684
5787
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5685
5788
|
}
|
|
5686
5789
|
return c.fragment = void 0, c;
|
|
5687
5790
|
}
|
|
5688
|
-
},
|
|
5791
|
+
}, Dt = {
|
|
5689
5792
|
scheme: "wss",
|
|
5690
|
-
domainHost:
|
|
5691
|
-
parse:
|
|
5692
|
-
serialize:
|
|
5693
|
-
},
|
|
5694
|
-
function
|
|
5793
|
+
domainHost: it.domainHost,
|
|
5794
|
+
parse: it.parse,
|
|
5795
|
+
serialize: it.serialize
|
|
5796
|
+
}, lr = {}, Ft = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", dr = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ur = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", pr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", fr = n(pr, '[\\"\\\\]'), hr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", mr = new RegExp(Ft, "g"), ze = new RegExp(dr, "g"), _r = new RegExp(n("[^]", ur, "[\\.]", '[\\"]', fr), "g"), Mt = new RegExp(n("[^]", Ft, hr), "g"), gr = Mt;
|
|
5797
|
+
function Nt(f) {
|
|
5695
5798
|
var c = W(f);
|
|
5696
|
-
return c.match(
|
|
5799
|
+
return c.match(mr) ? c : f;
|
|
5697
5800
|
}
|
|
5698
|
-
var
|
|
5801
|
+
var qt = {
|
|
5699
5802
|
scheme: "mailto",
|
|
5700
5803
|
parse: function(c, m) {
|
|
5701
5804
|
var R = c, E = R.to = R.path ? R.path.split(",") : [];
|
|
5702
5805
|
if (R.path = void 0, R.query) {
|
|
5703
|
-
for (var U = !1, L = {},
|
|
5704
|
-
var B =
|
|
5806
|
+
for (var U = !1, L = {}, Q = R.query.split("&"), Z = 0, ne = Q.length; Z < ne; ++Z) {
|
|
5807
|
+
var B = Q[Z].split("=");
|
|
5705
5808
|
switch (B[0]) {
|
|
5706
5809
|
case "to":
|
|
5707
|
-
for (var
|
|
5708
|
-
E.push(
|
|
5810
|
+
for (var Y = B[1].split(","), se = 0, z = Y.length; se < z; ++se)
|
|
5811
|
+
E.push(Y[se]);
|
|
5709
5812
|
break;
|
|
5710
5813
|
case "subject":
|
|
5711
5814
|
R.subject = pe(B[1], m);
|
|
@@ -5739,30 +5842,30 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5739
5842
|
var R = c, E = l(c.to);
|
|
5740
5843
|
if (E) {
|
|
5741
5844
|
for (var U = 0, L = E.length; U < L; ++U) {
|
|
5742
|
-
var
|
|
5845
|
+
var Q = String(E[U]), Z = Q.lastIndexOf("@"), ne = Q.slice(0, Z).replace(ze, Nt).replace(ze, o).replace(_r, q), B = Q.slice(Z + 1);
|
|
5743
5846
|
try {
|
|
5744
5847
|
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
5745
5848
|
} catch (X) {
|
|
5746
5849
|
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5747
5850
|
}
|
|
5748
|
-
E[U] =
|
|
5851
|
+
E[U] = ne + "@" + B;
|
|
5749
5852
|
}
|
|
5750
5853
|
R.path = E.join(",");
|
|
5751
5854
|
}
|
|
5752
|
-
var
|
|
5753
|
-
c.subject && (
|
|
5754
|
-
var
|
|
5755
|
-
for (var z in
|
|
5756
|
-
|
|
5757
|
-
return
|
|
5855
|
+
var Y = c.headers = c.headers || {};
|
|
5856
|
+
c.subject && (Y.subject = c.subject), c.body && (Y.body = c.body);
|
|
5857
|
+
var se = [];
|
|
5858
|
+
for (var z in Y)
|
|
5859
|
+
Y[z] !== lr[z] && se.push(z.replace(ze, Nt).replace(ze, o).replace(Mt, q) + "=" + Y[z].replace(ze, Nt).replace(ze, o).replace(gr, q));
|
|
5860
|
+
return se.length && (R.query = se.join("&")), R;
|
|
5758
5861
|
}
|
|
5759
|
-
},
|
|
5862
|
+
}, $r = /^([^\:]+)\:(.*)/, Ut = {
|
|
5760
5863
|
scheme: "urn",
|
|
5761
5864
|
parse: function(c, m) {
|
|
5762
|
-
var R = c.path && c.path.match(
|
|
5865
|
+
var R = c.path && c.path.match($r), E = c;
|
|
5763
5866
|
if (R) {
|
|
5764
|
-
var U = m.scheme || E.scheme || "urn", L = R[1].toLowerCase(),
|
|
5765
|
-
E.nid = L, E.nss =
|
|
5867
|
+
var U = m.scheme || E.scheme || "urn", L = R[1].toLowerCase(), Q = R[2], Z = U + ":" + (m.nid || L), ne = M[Z];
|
|
5868
|
+
E.nid = L, E.nss = Q, E.path = void 0, ne && (E = ne.parse(E, m));
|
|
5766
5869
|
} else
|
|
5767
5870
|
E.error = E.error || "URN can not be parsed.";
|
|
5768
5871
|
return E;
|
|
@@ -5770,21 +5873,21 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5770
5873
|
serialize: function(c, m) {
|
|
5771
5874
|
var R = m.scheme || c.scheme || "urn", E = c.nid, U = R + ":" + (m.nid || E), L = M[U];
|
|
5772
5875
|
L && (c = L.serialize(c, m));
|
|
5773
|
-
var
|
|
5774
|
-
return
|
|
5876
|
+
var Q = c, Z = c.nss;
|
|
5877
|
+
return Q.path = (E || m.nid) + ":" + Z, Q;
|
|
5775
5878
|
}
|
|
5776
|
-
},
|
|
5879
|
+
}, yr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Lt = {
|
|
5777
5880
|
scheme: "urn:uuid",
|
|
5778
5881
|
parse: function(c, m) {
|
|
5779
5882
|
var R = c;
|
|
5780
|
-
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(
|
|
5883
|
+
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(yr)) && (R.error = R.error || "UUID is not valid."), R;
|
|
5781
5884
|
},
|
|
5782
5885
|
serialize: function(c, m) {
|
|
5783
5886
|
var R = c;
|
|
5784
5887
|
return R.nss = (c.uuid || "").toLowerCase(), R;
|
|
5785
5888
|
}
|
|
5786
5889
|
};
|
|
5787
|
-
M[
|
|
5890
|
+
M[Oe.scheme] = Oe, M[jt.scheme] = jt, M[it.scheme] = it, M[Dt.scheme] = Dt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, M[Lt.scheme] = Lt, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = Ve, r.resolve = nt, r.normalize = Ce, r.equal = st, r.escapeComponent = lt, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5788
5891
|
});
|
|
5789
5892
|
})(uri_all, uri_all.exports);
|
|
5790
5893
|
var uri_allExports = uri_all.exports;
|
|
@@ -5812,7 +5915,7 @@ uri$1.default = uri;
|
|
|
5812
5915
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5813
5916
|
return r.CodeGen;
|
|
5814
5917
|
} });
|
|
5815
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util,
|
|
5918
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util, g = require$$9, O = uri$1, C = (F, v) => new RegExp(F, v);
|
|
5816
5919
|
C.code = "new RegExp";
|
|
5817
5920
|
const S = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5818
5921
|
"validate",
|
|
@@ -5848,36 +5951,36 @@ uri$1.default = uri;
|
|
|
5848
5951
|
ignoreKeywordsWithRef: "",
|
|
5849
5952
|
jsPropertySyntax: "",
|
|
5850
5953
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5851
|
-
},
|
|
5954
|
+
}, $ = 200;
|
|
5852
5955
|
function P(F) {
|
|
5853
|
-
var v, j, b, a, h, N, M, q, W, G,
|
|
5854
|
-
const
|
|
5956
|
+
var v, j, b, a, h, N, M, q, W, G, re, he, qe, Xe, et, de, tt, Ue, Le, He, rt, me, le, Ve, nt;
|
|
5957
|
+
const Ce = F.strict, st = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, lt = st === !0 || st === void 0 ? 1 : st || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : C, Oe = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5855
5958
|
return {
|
|
5856
|
-
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5857
|
-
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5858
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5859
|
-
strictTuples: (he = (
|
|
5860
|
-
strictRequired: (
|
|
5861
|
-
code: F.code ? { ...F.code, optimize:
|
|
5862
|
-
loopRequired: (
|
|
5863
|
-
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de :
|
|
5864
|
-
meta: (
|
|
5865
|
-
messages: (
|
|
5866
|
-
inlineRefs: (
|
|
5867
|
-
schemaId: (
|
|
5868
|
-
addUsedSchema: (
|
|
5959
|
+
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Ce) !== null && N !== void 0 ? N : !0,
|
|
5960
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Ce) !== null && q !== void 0 ? q : !0,
|
|
5961
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Ce) !== null && G !== void 0 ? G : "log",
|
|
5962
|
+
strictTuples: (he = (re = F.strictTuples) !== null && re !== void 0 ? re : Ce) !== null && he !== void 0 ? he : "log",
|
|
5963
|
+
strictRequired: (Xe = (qe = F.strictRequired) !== null && qe !== void 0 ? qe : Ce) !== null && Xe !== void 0 ? Xe : !1,
|
|
5964
|
+
code: F.code ? { ...F.code, optimize: lt, regExp: pe } : { optimize: lt, regExp: pe },
|
|
5965
|
+
loopRequired: (et = F.loopRequired) !== null && et !== void 0 ? et : $,
|
|
5966
|
+
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : $,
|
|
5967
|
+
meta: (tt = F.meta) !== null && tt !== void 0 ? tt : !0,
|
|
5968
|
+
messages: (Ue = F.messages) !== null && Ue !== void 0 ? Ue : !0,
|
|
5969
|
+
inlineRefs: (Le = F.inlineRefs) !== null && Le !== void 0 ? Le : !0,
|
|
5970
|
+
schemaId: (He = F.schemaId) !== null && He !== void 0 ? He : "$id",
|
|
5971
|
+
addUsedSchema: (rt = F.addUsedSchema) !== null && rt !== void 0 ? rt : !0,
|
|
5869
5972
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
5870
5973
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
5871
|
-
unicodeRegExp: (
|
|
5872
|
-
int32range: (
|
|
5873
|
-
uriResolver:
|
|
5974
|
+
unicodeRegExp: (Ve = F.unicodeRegExp) !== null && Ve !== void 0 ? Ve : !0,
|
|
5975
|
+
int32range: (nt = F.int32range) !== null && nt !== void 0 ? nt : !0,
|
|
5976
|
+
uriResolver: Oe
|
|
5874
5977
|
};
|
|
5875
5978
|
}
|
|
5876
5979
|
class I {
|
|
5877
5980
|
constructor(v = {}) {
|
|
5878
5981
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
|
|
5879
5982
|
const { es5: j, lines: b } = this.opts.code;
|
|
5880
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: b }), this.logger =
|
|
5983
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: b }), this.logger = J(v.logger);
|
|
5881
5984
|
const a = v.validateFormats;
|
|
5882
5985
|
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;
|
|
5883
5986
|
}
|
|
@@ -5886,8 +5989,8 @@ uri$1.default = uri;
|
|
|
5886
5989
|
}
|
|
5887
5990
|
_addDefaultMetaSchema() {
|
|
5888
5991
|
const { $data: v, meta: j, schemaId: b } = this.opts;
|
|
5889
|
-
let a =
|
|
5890
|
-
b === "id" && (a = {
|
|
5992
|
+
let a = g;
|
|
5993
|
+
b === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[b], !1);
|
|
5891
5994
|
}
|
|
5892
5995
|
defaultMeta() {
|
|
5893
5996
|
const { meta: v, schemaId: j } = this.opts;
|
|
@@ -5912,9 +6015,9 @@ uri$1.default = uri;
|
|
|
5912
6015
|
throw new Error("options.loadSchema should be a function");
|
|
5913
6016
|
const { loadSchema: b } = this.opts;
|
|
5914
6017
|
return a.call(this, v, j);
|
|
5915
|
-
async function a(G,
|
|
6018
|
+
async function a(G, re) {
|
|
5916
6019
|
await h.call(this, G.$schema);
|
|
5917
|
-
const he = this._addSchema(G,
|
|
6020
|
+
const he = this._addSchema(G, re);
|
|
5918
6021
|
return he.validate || N.call(this, he);
|
|
5919
6022
|
}
|
|
5920
6023
|
async function h(G) {
|
|
@@ -5923,24 +6026,24 @@ uri$1.default = uri;
|
|
|
5923
6026
|
async function N(G) {
|
|
5924
6027
|
try {
|
|
5925
6028
|
return this._compileSchemaEnv(G);
|
|
5926
|
-
} catch (
|
|
5927
|
-
if (!(
|
|
5928
|
-
throw
|
|
5929
|
-
return M.call(this,
|
|
6029
|
+
} catch (re) {
|
|
6030
|
+
if (!(re instanceof s.default))
|
|
6031
|
+
throw re;
|
|
6032
|
+
return M.call(this, re), await q.call(this, re.missingSchema), N.call(this, G);
|
|
5930
6033
|
}
|
|
5931
6034
|
}
|
|
5932
|
-
function M({ missingSchema: G, missingRef:
|
|
6035
|
+
function M({ missingSchema: G, missingRef: re }) {
|
|
5933
6036
|
if (this.refs[G])
|
|
5934
|
-
throw new Error(`AnySchema ${G} is loaded but ${
|
|
6037
|
+
throw new Error(`AnySchema ${G} is loaded but ${re} cannot be resolved`);
|
|
5935
6038
|
}
|
|
5936
6039
|
async function q(G) {
|
|
5937
|
-
const
|
|
5938
|
-
this.refs[G] || await h.call(this,
|
|
6040
|
+
const re = await W.call(this, G);
|
|
6041
|
+
this.refs[G] || await h.call(this, re.$schema), this.refs[G] || this.addSchema(re, G, j);
|
|
5939
6042
|
}
|
|
5940
6043
|
async function W(G) {
|
|
5941
|
-
const
|
|
5942
|
-
if (
|
|
5943
|
-
return
|
|
6044
|
+
const re = this._loading[G];
|
|
6045
|
+
if (re)
|
|
6046
|
+
return re;
|
|
5944
6047
|
try {
|
|
5945
6048
|
return await (this._loading[G] = b(G));
|
|
5946
6049
|
} finally {
|
|
@@ -6041,14 +6144,14 @@ uri$1.default = uri;
|
|
|
6041
6144
|
} else
|
|
6042
6145
|
throw new Error("invalid addKeywords parameters");
|
|
6043
6146
|
if (oe.call(this, b, j), !j)
|
|
6044
|
-
return (0, p.eachItem)(b, (h) =>
|
|
6045
|
-
|
|
6147
|
+
return (0, p.eachItem)(b, (h) => Te.call(this, h)), this;
|
|
6148
|
+
Fe.call(this, j);
|
|
6046
6149
|
const a = {
|
|
6047
6150
|
...j,
|
|
6048
6151
|
type: (0, u.getJSONTypes)(j.type),
|
|
6049
6152
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6050
6153
|
};
|
|
6051
|
-
return (0, p.eachItem)(b, a.type.length === 0 ? (h) =>
|
|
6154
|
+
return (0, p.eachItem)(b, a.type.length === 0 ? (h) => Te.call(this, h, a) : (h) => a.type.forEach((N) => Te.call(this, h, a, N))), this;
|
|
6052
6155
|
}
|
|
6053
6156
|
getKeyword(v) {
|
|
6054
6157
|
const j = this.RULES.all[v];
|
|
@@ -6084,7 +6187,7 @@ uri$1.default = uri;
|
|
|
6084
6187
|
if (typeof q != "object")
|
|
6085
6188
|
continue;
|
|
6086
6189
|
const { $data: W } = q.definition, G = N[M];
|
|
6087
|
-
W && G && (N[M] =
|
|
6190
|
+
W && G && (N[M] = Me(G));
|
|
6088
6191
|
}
|
|
6089
6192
|
}
|
|
6090
6193
|
return v;
|
|
@@ -6174,13 +6277,13 @@ uri$1.default = uri;
|
|
|
6174
6277
|
delete F[v];
|
|
6175
6278
|
return F;
|
|
6176
6279
|
}
|
|
6177
|
-
const
|
|
6280
|
+
const te = { log() {
|
|
6178
6281
|
}, warn() {
|
|
6179
6282
|
}, error() {
|
|
6180
6283
|
} };
|
|
6181
|
-
function
|
|
6284
|
+
function J(F) {
|
|
6182
6285
|
if (F === !1)
|
|
6183
|
-
return
|
|
6286
|
+
return te;
|
|
6184
6287
|
if (F === void 0)
|
|
6185
6288
|
return console;
|
|
6186
6289
|
if (F.log && F.warn && F.error)
|
|
@@ -6198,7 +6301,7 @@ uri$1.default = uri;
|
|
|
6198
6301
|
}), !!v && v.$data && !("code" in v || "validate" in v))
|
|
6199
6302
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6200
6303
|
}
|
|
6201
|
-
function
|
|
6304
|
+
function Te(F, v, j) {
|
|
6202
6305
|
var b;
|
|
6203
6306
|
const a = v == null ? void 0 : v.post;
|
|
6204
6307
|
if (j && a)
|
|
@@ -6215,21 +6318,21 @@ uri$1.default = uri;
|
|
|
6215
6318
|
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6216
6319
|
}
|
|
6217
6320
|
};
|
|
6218
|
-
v.before ?
|
|
6321
|
+
v.before ? ke.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (b = v.implements) === null || b === void 0 || b.forEach((q) => this.addKeyword(q));
|
|
6219
6322
|
}
|
|
6220
|
-
function
|
|
6323
|
+
function ke(F, v, j) {
|
|
6221
6324
|
const b = F.rules.findIndex((a) => a.keyword === j);
|
|
6222
6325
|
b >= 0 ? F.rules.splice(b, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
|
|
6223
6326
|
}
|
|
6224
|
-
function
|
|
6327
|
+
function Fe(F) {
|
|
6225
6328
|
let { metaSchema: v } = F;
|
|
6226
|
-
v !== void 0 && (F.$data && this.opts.$data && (v =
|
|
6329
|
+
v !== void 0 && (F.$data && this.opts.$data && (v = Me(v)), F.validateSchema = this.compile(v, !0));
|
|
6227
6330
|
}
|
|
6228
|
-
const
|
|
6331
|
+
const Ze = {
|
|
6229
6332
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6230
6333
|
};
|
|
6231
|
-
function
|
|
6232
|
-
return { anyOf: [F,
|
|
6334
|
+
function Me(F) {
|
|
6335
|
+
return { anyOf: [F, Ze] };
|
|
6233
6336
|
}
|
|
6234
6337
|
})(core$2);
|
|
6235
6338
|
var draft7 = {}, core$1 = {}, id = {};
|
|
@@ -6250,14 +6353,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6250
6353
|
code(e) {
|
|
6251
6354
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: l, self: d } = n, { root: u } = i;
|
|
6252
6355
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6253
|
-
return
|
|
6356
|
+
return g();
|
|
6254
6357
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6255
6358
|
if (p === void 0)
|
|
6256
6359
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6257
6360
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6258
6361
|
return O(p);
|
|
6259
6362
|
return C(p);
|
|
6260
|
-
function
|
|
6363
|
+
function g() {
|
|
6261
6364
|
if (i === u)
|
|
6262
6365
|
return callRef(e, o, i, i.$async);
|
|
6263
6366
|
const S = t.scopeValue("root", { ref: u });
|
|
@@ -6286,7 +6389,7 @@ function getValidate(e, t) {
|
|
|
6286
6389
|
ref.getValidate = getValidate;
|
|
6287
6390
|
function callRef(e, t, r, n) {
|
|
6288
6391
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: l, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6289
|
-
n ? p() :
|
|
6392
|
+
n ? p() : g();
|
|
6290
6393
|
function p() {
|
|
6291
6394
|
if (!l.$async)
|
|
6292
6395
|
throw new Error("async schema referenced by sync schema");
|
|
@@ -6297,7 +6400,7 @@ function callRef(e, t, r, n) {
|
|
|
6297
6400
|
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(S, !1);
|
|
6298
6401
|
}), e.ok(S);
|
|
6299
6402
|
}
|
|
6300
|
-
function
|
|
6403
|
+
function g() {
|
|
6301
6404
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () => O(t));
|
|
6302
6405
|
}
|
|
6303
6406
|
function O(S) {
|
|
@@ -6471,7 +6574,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6471
6574
|
}
|
|
6472
6575
|
function u() {
|
|
6473
6576
|
if (d || i)
|
|
6474
|
-
e.block$data(codegen_1$f.nil,
|
|
6577
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6475
6578
|
else
|
|
6476
6579
|
for (const C of r)
|
|
6477
6580
|
(0, code_1$6.checkReportMissingProp)(e, C);
|
|
@@ -6484,7 +6587,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6484
6587
|
} else
|
|
6485
6588
|
t.if((0, code_1$6.checkMissingProp)(e, r, C)), (0, code_1$6.reportMissingProp)(e, C), t.else();
|
|
6486
6589
|
}
|
|
6487
|
-
function
|
|
6590
|
+
function g() {
|
|
6488
6591
|
t.forOf("prop", n, (C) => {
|
|
6489
6592
|
e.setParams({ missingProperty: C }), t.if((0, code_1$6.noPropertyInData)(t, s, C, l.ownProperties), () => e.error());
|
|
6490
6593
|
});
|
|
@@ -6542,17 +6645,17 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6542
6645
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6543
6646
|
function p() {
|
|
6544
6647
|
const S = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6545
|
-
e.setParams({ i: S, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => (
|
|
6648
|
+
e.setParams({ i: S, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => (g() ? O : C)(S, T));
|
|
6546
6649
|
}
|
|
6547
|
-
function
|
|
6650
|
+
function g() {
|
|
6548
6651
|
return u.length > 0 && !u.some((S) => S === "object" || S === "array");
|
|
6549
6652
|
}
|
|
6550
6653
|
function O(S, T) {
|
|
6551
|
-
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong),
|
|
6654
|
+
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), $ = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6552
6655
|
t.for((0, codegen_1$d._)`;${S}--;`, () => {
|
|
6553
|
-
t.let(y, (0, codegen_1$d._)`${r}[${S}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${
|
|
6554
|
-
t.assign(T, (0, codegen_1$d._)`${
|
|
6555
|
-
}).code((0, codegen_1$d._)`${
|
|
6656
|
+
t.let(y, (0, codegen_1$d._)`${r}[${S}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${$}[${y}] == "number"`, () => {
|
|
6657
|
+
t.assign(T, (0, codegen_1$d._)`${$}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6658
|
+
}).code((0, codegen_1$d._)`${$}[${y}] = ${S}`);
|
|
6556
6659
|
});
|
|
6557
6660
|
}
|
|
6558
6661
|
function C(S, T) {
|
|
@@ -6598,7 +6701,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6598
6701
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6599
6702
|
let p;
|
|
6600
6703
|
if (l || n)
|
|
6601
|
-
p = t.let("valid"), e.block$data(p,
|
|
6704
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6602
6705
|
else {
|
|
6603
6706
|
if (!Array.isArray(s))
|
|
6604
6707
|
throw new Error("ajv implementation error");
|
|
@@ -6606,7 +6709,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6606
6709
|
p = (0, codegen_1$b.or)(...s.map((S, T) => O(C, T)));
|
|
6607
6710
|
}
|
|
6608
6711
|
e.pass(p);
|
|
6609
|
-
function
|
|
6712
|
+
function g() {
|
|
6610
6713
|
t.assign(p, !1), t.forOf("v", i, (C) => t.if((0, codegen_1$b._)`${u()}(${r}, ${C})`, () => t.assign(p, !0).break()));
|
|
6611
6714
|
}
|
|
6612
6715
|
function O(C, S) {
|
|
@@ -6695,15 +6798,15 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6695
6798
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6696
6799
|
p(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6697
6800
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6698
|
-
r.forEach((
|
|
6699
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6801
|
+
r.forEach((g, O) => {
|
|
6802
|
+
(0, util_1$c.alwaysValidSchema)(l, g) || (n.if((0, codegen_1$9._)`${u} > ${O}`, () => e.subschema({
|
|
6700
6803
|
keyword: o,
|
|
6701
6804
|
schemaProp: O,
|
|
6702
6805
|
dataProp: O
|
|
6703
6806
|
}, d)), e.ok(d));
|
|
6704
6807
|
});
|
|
6705
|
-
function p(
|
|
6706
|
-
const { opts: O, errSchemaPath: C } = l, S = r.length, T = S ===
|
|
6808
|
+
function p(g) {
|
|
6809
|
+
const { opts: O, errSchemaPath: C } = l, S = r.length, T = S === g.minItems && (S === g.maxItems || g[t] === !1);
|
|
6707
6810
|
if (O.strictTuples && !T) {
|
|
6708
6811
|
const y = `"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;
|
|
6709
6812
|
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
@@ -6770,8 +6873,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6770
6873
|
return;
|
|
6771
6874
|
}
|
|
6772
6875
|
i.items = !0;
|
|
6773
|
-
const
|
|
6774
|
-
l === void 0 && o === 1 ? C(
|
|
6876
|
+
const g = t.name("valid");
|
|
6877
|
+
l === void 0 && o === 1 ? C(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let(g, !1), O()), e.result(g, () => e.reset());
|
|
6775
6878
|
function O() {
|
|
6776
6879
|
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6777
6880
|
C(T, () => t.if(T, () => S(y)));
|
|
@@ -6787,7 +6890,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6787
6890
|
});
|
|
6788
6891
|
}
|
|
6789
6892
|
function S(T) {
|
|
6790
|
-
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(
|
|
6893
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(g, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign(g, !1).break()), o === 1 ? t.assign(g, !0) : t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(g, !0)));
|
|
6791
6894
|
}
|
|
6792
6895
|
}
|
|
6793
6896
|
};
|
|
@@ -6798,11 +6901,11 @@ var dependencies = {};
|
|
|
6798
6901
|
const t = codegen, r = util, n = code;
|
|
6799
6902
|
e.error = {
|
|
6800
6903
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6801
|
-
const
|
|
6802
|
-
return (0, t.str)`must have ${
|
|
6904
|
+
const g = u === 1 ? "property" : "properties";
|
|
6905
|
+
return (0, t.str)`must have ${g} ${p} when property ${d} is present`;
|
|
6803
6906
|
},
|
|
6804
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6805
|
-
missingProperty: ${
|
|
6907
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6908
|
+
missingProperty: ${g},
|
|
6806
6909
|
depsCount: ${u},
|
|
6807
6910
|
deps: ${p}}`
|
|
6808
6911
|
// TODO change to reference
|
|
@@ -6819,16 +6922,16 @@ var dependencies = {};
|
|
|
6819
6922
|
};
|
|
6820
6923
|
function i({ schema: d }) {
|
|
6821
6924
|
const u = {}, p = {};
|
|
6822
|
-
for (const
|
|
6823
|
-
if (
|
|
6925
|
+
for (const g in d) {
|
|
6926
|
+
if (g === "__proto__")
|
|
6824
6927
|
continue;
|
|
6825
|
-
const O = Array.isArray(d[
|
|
6826
|
-
O[
|
|
6928
|
+
const O = Array.isArray(d[g]) ? u : p;
|
|
6929
|
+
O[g] = d[g];
|
|
6827
6930
|
}
|
|
6828
6931
|
return [u, p];
|
|
6829
6932
|
}
|
|
6830
6933
|
function o(d, u = d.schema) {
|
|
6831
|
-
const { gen: p, data:
|
|
6934
|
+
const { gen: p, data: g, it: O } = d;
|
|
6832
6935
|
if (Object.keys(u).length === 0)
|
|
6833
6936
|
return;
|
|
6834
6937
|
const C = p.let("missing");
|
|
@@ -6836,7 +6939,7 @@ var dependencies = {};
|
|
|
6836
6939
|
const T = u[S];
|
|
6837
6940
|
if (T.length === 0)
|
|
6838
6941
|
continue;
|
|
6839
|
-
const y = (0, n.propertyInData)(p,
|
|
6942
|
+
const y = (0, n.propertyInData)(p, g, S, O.opts.ownProperties);
|
|
6840
6943
|
d.setParams({
|
|
6841
6944
|
property: S,
|
|
6842
6945
|
depsCount: T.length,
|
|
@@ -6849,10 +6952,10 @@ var dependencies = {};
|
|
|
6849
6952
|
}
|
|
6850
6953
|
e.validatePropertyDeps = o;
|
|
6851
6954
|
function l(d, u = d.schema) {
|
|
6852
|
-
const { gen: p, data:
|
|
6955
|
+
const { gen: p, data: g, keyword: O, it: C } = d, S = p.name("valid");
|
|
6853
6956
|
for (const T in u)
|
|
6854
6957
|
(0, r.alwaysValidSchema)(C, u[T]) || (p.if(
|
|
6855
|
-
(0, n.propertyInData)(p,
|
|
6958
|
+
(0, n.propertyInData)(p, g, T, C.opts.ownProperties),
|
|
6856
6959
|
() => {
|
|
6857
6960
|
const y = d.subschema({ keyword: O, schemaProp: T }, S);
|
|
6858
6961
|
d.mergeValidEvaluated(y, S);
|
|
@@ -6912,8 +7015,8 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6912
7015
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6913
7016
|
return;
|
|
6914
7017
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6915
|
-
|
|
6916
|
-
function
|
|
7018
|
+
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
7019
|
+
function g() {
|
|
6917
7020
|
t.forIn("key", s, (y) => {
|
|
6918
7021
|
!u.length && !p.length ? S(y) : t.if(O(y), () => S(y));
|
|
6919
7022
|
});
|
|
@@ -6921,11 +7024,11 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6921
7024
|
function O(y) {
|
|
6922
7025
|
let _;
|
|
6923
7026
|
if (u.length > 8) {
|
|
6924
|
-
const
|
|
6925
|
-
_ = (0, code_1$3.isOwnProperty)(t,
|
|
7027
|
+
const $ = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
7028
|
+
_ = (0, code_1$3.isOwnProperty)(t, $, y);
|
|
6926
7029
|
} else
|
|
6927
|
-
u.length ? _ = (0, codegen_1$5.or)(...u.map((
|
|
6928
|
-
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map((
|
|
7030
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map(($) => (0, codegen_1$5._)`${y} === ${$}`)) : _ = codegen_1$5.nil;
|
|
7031
|
+
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map(($) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, $)}.test(${y})`))), (0, codegen_1$5.not)(_);
|
|
6929
7032
|
}
|
|
6930
7033
|
function C(y) {
|
|
6931
7034
|
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
@@ -6946,13 +7049,13 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6946
7049
|
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6947
7050
|
}
|
|
6948
7051
|
}
|
|
6949
|
-
function T(y, _,
|
|
7052
|
+
function T(y, _, $) {
|
|
6950
7053
|
const P = {
|
|
6951
7054
|
keyword: "additionalProperties",
|
|
6952
7055
|
dataProp: y,
|
|
6953
7056
|
dataPropType: util_1$8.Type.Str
|
|
6954
7057
|
};
|
|
6955
|
-
|
|
7058
|
+
$ === !1 && Object.assign(P, {
|
|
6956
7059
|
compositeRule: !0,
|
|
6957
7060
|
createErrors: !1,
|
|
6958
7061
|
allErrors: !1
|
|
@@ -6971,23 +7074,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6971
7074
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6972
7075
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6973
7076
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6974
|
-
for (const
|
|
6975
|
-
i.definedProperties.add(
|
|
7077
|
+
for (const g of o)
|
|
7078
|
+
i.definedProperties.add(g);
|
|
6976
7079
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6977
|
-
const l = o.filter((
|
|
7080
|
+
const l = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6978
7081
|
if (l.length === 0)
|
|
6979
7082
|
return;
|
|
6980
7083
|
const d = t.name("valid");
|
|
6981
|
-
for (const
|
|
6982
|
-
u(
|
|
6983
|
-
function u(
|
|
6984
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
7084
|
+
for (const g of l)
|
|
7085
|
+
u(g) ? p(g) : (t.if((0, code_1$2.propertyInData)(t, s, g, i.opts.ownProperties)), p(g), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(g), e.ok(d);
|
|
7086
|
+
function u(g) {
|
|
7087
|
+
return i.opts.useDefaults && !i.compositeRule && r[g].default !== void 0;
|
|
6985
7088
|
}
|
|
6986
|
-
function p(
|
|
7089
|
+
function p(g) {
|
|
6987
7090
|
e.subschema({
|
|
6988
7091
|
keyword: "properties",
|
|
6989
|
-
schemaProp:
|
|
6990
|
-
dataProp:
|
|
7092
|
+
schemaProp: g,
|
|
7093
|
+
dataProp: g
|
|
6991
7094
|
}, d);
|
|
6992
7095
|
}
|
|
6993
7096
|
}
|
|
@@ -7005,7 +7108,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7005
7108
|
return;
|
|
7006
7109
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
7007
7110
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
7008
|
-
const { props:
|
|
7111
|
+
const { props: g } = i;
|
|
7009
7112
|
O();
|
|
7010
7113
|
function O() {
|
|
7011
7114
|
for (const T of l)
|
|
@@ -7024,7 +7127,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7024
7127
|
schemaProp: T,
|
|
7025
7128
|
dataProp: y,
|
|
7026
7129
|
dataPropType: util_2.Type.Str
|
|
7027
|
-
}, p), i.opts.unevaluated &&
|
|
7130
|
+
}, p), i.opts.unevaluated && g !== !0 ? t.assign((0, codegen_1$4._)`${g}[${y}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7028
7131
|
});
|
|
7029
7132
|
});
|
|
7030
7133
|
}
|
|
@@ -7083,14 +7186,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7083
7186
|
const i = r, o = t.let("valid", !1), l = t.let("passing", null), d = t.name("_valid");
|
|
7084
7187
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7085
7188
|
function u() {
|
|
7086
|
-
i.forEach((p,
|
|
7189
|
+
i.forEach((p, g) => {
|
|
7087
7190
|
let O;
|
|
7088
7191
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : O = e.subschema({
|
|
7089
7192
|
keyword: "oneOf",
|
|
7090
|
-
schemaProp:
|
|
7193
|
+
schemaProp: g,
|
|
7091
7194
|
compositeRule: !0
|
|
7092
|
-
}, d),
|
|
7093
|
-
t.assign(o, !0), t.assign(l,
|
|
7195
|
+
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(l, (0, codegen_1$3._)`[${l}, ${g}]`).else(), t.if(d, () => {
|
|
7196
|
+
t.assign(o, !0), t.assign(l, g), O && e.mergeEvaluated(O, codegen_1$3.Name);
|
|
7094
7197
|
});
|
|
7095
7198
|
});
|
|
7096
7199
|
}
|
|
@@ -7148,10 +7251,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7148
7251
|
}, l);
|
|
7149
7252
|
e.mergeEvaluated(p);
|
|
7150
7253
|
}
|
|
7151
|
-
function u(p,
|
|
7254
|
+
function u(p, g) {
|
|
7152
7255
|
return () => {
|
|
7153
7256
|
const O = e.subschema({ keyword: p }, l);
|
|
7154
|
-
t.assign(o, l), e.mergeValidEvaluated(O, o),
|
|
7257
|
+
t.assign(o, l), e.mergeValidEvaluated(O, o), g ? t.assign(g, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7155
7258
|
};
|
|
7156
7259
|
}
|
|
7157
7260
|
}
|
|
@@ -7204,17 +7307,17 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7204
7307
|
$data: !0,
|
|
7205
7308
|
error: error$1,
|
|
7206
7309
|
code(e, t) {
|
|
7207
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7310
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: g } = l;
|
|
7208
7311
|
if (!d.validateFormats)
|
|
7209
7312
|
return;
|
|
7210
7313
|
s ? O() : C();
|
|
7211
7314
|
function O() {
|
|
7212
7315
|
const S = r.scopeValue("formats", {
|
|
7213
|
-
ref:
|
|
7316
|
+
ref: g.formats,
|
|
7214
7317
|
code: d.code.formats
|
|
7215
7318
|
}), T = r.const("fDef", (0, codegen_1$1._)`${S}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7216
|
-
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(
|
|
7217
|
-
function
|
|
7319
|
+
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)($(), P()));
|
|
7320
|
+
function $() {
|
|
7218
7321
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
7219
7322
|
}
|
|
7220
7323
|
function P() {
|
|
@@ -7223,18 +7326,18 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7223
7326
|
}
|
|
7224
7327
|
}
|
|
7225
7328
|
function C() {
|
|
7226
|
-
const S =
|
|
7329
|
+
const S = g.formats[i];
|
|
7227
7330
|
if (!S) {
|
|
7228
|
-
|
|
7331
|
+
$();
|
|
7229
7332
|
return;
|
|
7230
7333
|
}
|
|
7231
7334
|
if (S === !0)
|
|
7232
7335
|
return;
|
|
7233
7336
|
const [T, y, _] = P(S);
|
|
7234
7337
|
T === t && e.pass(I());
|
|
7235
|
-
function
|
|
7338
|
+
function $() {
|
|
7236
7339
|
if (d.strictSchema === !1) {
|
|
7237
|
-
|
|
7340
|
+
g.logger.warn(D());
|
|
7238
7341
|
return;
|
|
7239
7342
|
}
|
|
7240
7343
|
throw new Error(D());
|
|
@@ -7320,10 +7423,10 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7320
7423
|
const C = O();
|
|
7321
7424
|
t.if(!1);
|
|
7322
7425
|
for (const S in C)
|
|
7323
|
-
t.elseIf((0, codegen_1._)`${u} === ${S}`), t.assign(d,
|
|
7426
|
+
t.elseIf((0, codegen_1._)`${u} === ${S}`), t.assign(d, g(C[S]));
|
|
7324
7427
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7325
7428
|
}
|
|
7326
|
-
function
|
|
7429
|
+
function g(C) {
|
|
7327
7430
|
const S = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: C }, S);
|
|
7328
7431
|
return e.mergeEvaluated(T, codegen_1.Name), S;
|
|
7329
7432
|
}
|
|
@@ -7337,7 +7440,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7337
7440
|
const w = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[l];
|
|
7338
7441
|
if (typeof w != "object")
|
|
7339
7442
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7340
|
-
y = y && (T || _(D)),
|
|
7443
|
+
y = y && (T || _(D)), $(w, I);
|
|
7341
7444
|
}
|
|
7342
7445
|
if (!y)
|
|
7343
7446
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
@@ -7345,7 +7448,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7345
7448
|
function _({ required: I }) {
|
|
7346
7449
|
return Array.isArray(I) && I.includes(l);
|
|
7347
7450
|
}
|
|
7348
|
-
function
|
|
7451
|
+
function $(I, D) {
|
|
7349
7452
|
if (I.const)
|
|
7350
7453
|
P(I.const, D);
|
|
7351
7454
|
else if (I.enum)
|
|
@@ -7640,9 +7743,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7640
7743
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7641
7744
|
return p.CodeGen;
|
|
7642
7745
|
} });
|
|
7643
|
-
var
|
|
7746
|
+
var g = validation_error;
|
|
7644
7747
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7645
|
-
return
|
|
7748
|
+
return g.default;
|
|
7646
7749
|
} });
|
|
7647
7750
|
var O = ref_error;
|
|
7648
7751
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -9248,13 +9351,13 @@ function compileBlueprint(e, {
|
|
|
9248
9351
|
onStepCompleted: n = () => {
|
|
9249
9352
|
}
|
|
9250
9353
|
} = {}) {
|
|
9251
|
-
var
|
|
9354
|
+
var g, O, C, S, T, y, _;
|
|
9252
9355
|
e = {
|
|
9253
9356
|
...e,
|
|
9254
|
-
steps: (e.steps || []).filter(isStepDefinition)
|
|
9357
|
+
steps: (e.steps || []).filter(isStepDefinition).filter(isStepStillSupported)
|
|
9255
9358
|
};
|
|
9256
|
-
for (const
|
|
9257
|
-
typeof
|
|
9359
|
+
for (const $ of e.steps)
|
|
9360
|
+
typeof $ == "object" && $.step === "importFile" && ($.step = "importWxr", console.warn(
|
|
9258
9361
|
'The "importFile" step is deprecated. Use "importWxr" instead.'
|
|
9259
9362
|
));
|
|
9260
9363
|
if (e.constants && e.steps.unshift({
|
|
@@ -9264,7 +9367,7 @@ function compileBlueprint(e, {
|
|
|
9264
9367
|
step: "setSiteOptions",
|
|
9265
9368
|
options: e.siteOptions
|
|
9266
9369
|
}), e.plugins) {
|
|
9267
|
-
const
|
|
9370
|
+
const $ = e.plugins.map((P) => typeof P == "string" ? P.startsWith("https://") ? {
|
|
9268
9371
|
resource: "url",
|
|
9269
9372
|
url: P
|
|
9270
9373
|
} : {
|
|
@@ -9274,17 +9377,17 @@ function compileBlueprint(e, {
|
|
|
9274
9377
|
step: "installPlugin",
|
|
9275
9378
|
pluginZipFile: P
|
|
9276
9379
|
}));
|
|
9277
|
-
e.steps.unshift(
|
|
9380
|
+
e.steps.unshift(...$);
|
|
9278
9381
|
}
|
|
9279
9382
|
e.login && e.steps.push({
|
|
9280
9383
|
step: "login",
|
|
9281
9384
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9282
9385
|
}), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.length === 0 && e.phpExtensionBundles.push("kitchen-sink");
|
|
9283
|
-
const s = (
|
|
9284
|
-
(
|
|
9386
|
+
const s = (g = e.steps) == null ? void 0 : g.findIndex(
|
|
9387
|
+
($) => typeof $ == "object" && ($ == null ? void 0 : $.step) === "wp-cli"
|
|
9285
9388
|
);
|
|
9286
9389
|
s !== void 0 && s > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9287
|
-
(
|
|
9390
|
+
($) => $ !== "light"
|
|
9288
9391
|
), console.warn(
|
|
9289
9392
|
"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. "
|
|
9290
9393
|
)), (O = e.steps) == null || O.splice(s, 0, {
|
|
@@ -9306,10 +9409,10 @@ function compileBlueprint(e, {
|
|
|
9306
9409
|
path: "/tmp/wp-cli.phar"
|
|
9307
9410
|
}));
|
|
9308
9411
|
const i = (C = e.steps) == null ? void 0 : C.findIndex(
|
|
9309
|
-
(
|
|
9412
|
+
($) => typeof $ == "object" && ($ == null ? void 0 : $.step) === "importWxr"
|
|
9310
9413
|
);
|
|
9311
9414
|
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9312
|
-
(
|
|
9415
|
+
($) => $ !== "light"
|
|
9313
9416
|
), console.warn(
|
|
9314
9417
|
"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. "
|
|
9315
9418
|
)), (S = e.steps) == null || S.splice(i, 0, {
|
|
@@ -9322,19 +9425,19 @@ function compileBlueprint(e, {
|
|
|
9322
9425
|
}));
|
|
9323
9426
|
const { valid: o, errors: l } = validateBlueprint(e);
|
|
9324
9427
|
if (!o) {
|
|
9325
|
-
const
|
|
9428
|
+
const $ = new Error(
|
|
9326
9429
|
`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`
|
|
9327
9430
|
);
|
|
9328
|
-
throw
|
|
9431
|
+
throw $.errors = l, $;
|
|
9329
9432
|
}
|
|
9330
9433
|
const d = e.steps || [], u = d.reduce(
|
|
9331
|
-
(
|
|
9434
|
+
($, P) => {
|
|
9332
9435
|
var I;
|
|
9333
|
-
return
|
|
9436
|
+
return $ + (((I = P.progress) == null ? void 0 : I.weight) || 1);
|
|
9334
9437
|
},
|
|
9335
9438
|
0
|
|
9336
9439
|
), p = d.map(
|
|
9337
|
-
(
|
|
9440
|
+
($) => compileStep($, {
|
|
9338
9441
|
semaphore: r,
|
|
9339
9442
|
rootProgressTracker: t,
|
|
9340
9443
|
totalProgressWeight: u
|
|
@@ -9357,14 +9460,14 @@ function compileBlueprint(e, {
|
|
|
9357
9460
|
// Disable networking by default
|
|
9358
9461
|
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9359
9462
|
},
|
|
9360
|
-
run: async (
|
|
9463
|
+
run: async ($) => {
|
|
9361
9464
|
try {
|
|
9362
9465
|
for (const { resources: P } of p)
|
|
9363
9466
|
for (const I of P)
|
|
9364
|
-
I.setPlayground(
|
|
9467
|
+
I.setPlayground($), I.isAsync && I.resolve();
|
|
9365
9468
|
for (const [P, { run: I, step: D }] of Object.entries(p))
|
|
9366
9469
|
try {
|
|
9367
|
-
const w = await I(
|
|
9470
|
+
const w = await I($);
|
|
9368
9471
|
n(w, D);
|
|
9369
9472
|
} catch (w) {
|
|
9370
9473
|
throw console.error(w), new Error(
|
|
@@ -9376,7 +9479,7 @@ function compileBlueprint(e, {
|
|
|
9376
9479
|
}
|
|
9377
9480
|
} finally {
|
|
9378
9481
|
try {
|
|
9379
|
-
await
|
|
9482
|
+
await $.goTo(
|
|
9380
9483
|
e.landingPage || "/"
|
|
9381
9484
|
);
|
|
9382
9485
|
} catch {
|
|
@@ -9419,6 +9522,11 @@ function compilePHPExtensions(e, t) {
|
|
|
9419
9522
|
function isStepDefinition(e) {
|
|
9420
9523
|
return !!(typeof e == "object" && e);
|
|
9421
9524
|
}
|
|
9525
|
+
function isStepStillSupported(e) {
|
|
9526
|
+
return e.step === "setPhpIniEntry" ? (console.warn(
|
|
9527
|
+
'The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'
|
|
9528
|
+
), !1) : !0;
|
|
9529
|
+
}
|
|
9422
9530
|
function compileStep(e, {
|
|
9423
9531
|
semaphore: t,
|
|
9424
9532
|
rootProgressTracker: r,
|
|
@@ -9428,17 +9536,17 @@ function compileStep(e, {
|
|
|
9428
9536
|
const s = r.stage(
|
|
9429
9537
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9430
9538
|
), i = {};
|
|
9431
|
-
for (const
|
|
9432
|
-
let O = e[
|
|
9539
|
+
for (const g of Object.keys(e)) {
|
|
9540
|
+
let O = e[g];
|
|
9433
9541
|
isFileReference(O) && (O = Resource.create(O, {
|
|
9434
9542
|
semaphore: t
|
|
9435
|
-
})), i[
|
|
9543
|
+
})), i[g] = O;
|
|
9436
9544
|
}
|
|
9437
|
-
const o = async (
|
|
9545
|
+
const o = async (g) => {
|
|
9438
9546
|
var O;
|
|
9439
9547
|
try {
|
|
9440
9548
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9441
|
-
|
|
9549
|
+
g,
|
|
9442
9550
|
await resolveArguments(i),
|
|
9443
9551
|
{
|
|
9444
9552
|
tracker: s,
|
|
@@ -9449,10 +9557,10 @@ function compileStep(e, {
|
|
|
9449
9557
|
s.finish();
|
|
9450
9558
|
}
|
|
9451
9559
|
}, l = getResources(i), d = getResources(i).filter(
|
|
9452
|
-
(
|
|
9560
|
+
(g) => g.isAsync
|
|
9453
9561
|
), u = 1 / (d.length + 1);
|
|
9454
|
-
for (const
|
|
9455
|
-
|
|
9562
|
+
for (const g of d)
|
|
9563
|
+
g.progress = s.stage(u);
|
|
9456
9564
|
return { run: o, step: e, resources: l };
|
|
9457
9565
|
}
|
|
9458
9566
|
function getResources(e) {
|
|
@@ -9500,7 +9608,6 @@ export {
|
|
|
9500
9608
|
runPHPWithOptions,
|
|
9501
9609
|
runSql,
|
|
9502
9610
|
runWpInstallationWizard,
|
|
9503
|
-
setPhpIniEntry,
|
|
9504
9611
|
setPluginProxyURL,
|
|
9505
9612
|
setSiteOptions,
|
|
9506
9613
|
unzip,
|