@wp-playground/client 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.
Files changed (4) hide show
  1. package/index.cjs +57 -29
  2. package/index.d.ts +152 -226
  3. package/index.js +943 -812
  4. package/package.json +2 -2
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var Nt = (e, t, r) => {
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) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Q = (e, t, r) => {
5
+ var x = (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
- }, te = (e, t, r, n) => (Nt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
- var ce = (e, t, r) => (Nt(e, t, "access private method"), 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
- await new Promise((t) => this.queue.push(t));
112
- else {
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)
@@ -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
- var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, zt, _t, Wt, gt, Bt;
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, we, 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
- Q(this, mt);
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
- Q(this, _t);
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
- Q(this, gt);
1893
- Q(this, Pe, void 0);
1894
- Q(this, Ke, void 0);
1895
- Q(this, dt, void 0);
1896
- Q(this, De, void 0);
1897
- Q(this, Je, void 0);
1898
- Q(this, ve, void 0);
1899
- Q(this, Qe, void 0);
1900
- Q(this, Fe, void 0);
1901
- te(this, Fe, new Semaphore({ concurrency: 1 }));
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, we, 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, te(this, Pe, n);
1860
+ this.php = t, ie(this, Ke, new HttpCookieStore()), ie(this, Pe, n);
1908
1861
  const o = new URL(s);
1909
- te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
1910
- const c = H(this, De) !== 443 && H(this, De) !== 80;
1911
- te(this, Je, [
1912
- H(this, dt),
1913
- c ? `:${H(this, De)}` : ""
1914
- ].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Qe, [
1915
- `${H(this, Ke)}://`,
1916
- H(this, Je),
1917
- H(this, ve)
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 c = x(this, je) !== 443 && x(this, je) !== 80;
1864
+ ie(this, Be, [
1865
+ x(this, ct),
1866
+ c ? `:${x(this, je)}` : ""
1867
+ ].join("")), ie(this, we, o.pathname.replace(/\/+$/, "")), ie(this, Ge, [
1868
+ `${x(this, We)}://`,
1869
+ x(this, Be),
1870
+ x(this, we)
1918
1871
  ].join("")), this.rewriteRules = i;
1919
1872
  }
1920
- /** @inheritDoc */
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
- /** @inheritDoc */
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
- return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
1892
+ return r.pathname.startsWith(x(this, we)) && (r.pathname = r.pathname.slice(x(this, we).length)), toRelativeUrl(r);
1928
1893
  }
1929
1894
  get isRequestRunning() {
1930
- return H(this, Fe).running > 0;
1895
+ return x(this, Ae).running > 0;
1931
1896
  }
1932
- /** @inheritDoc */
1897
+ /**
1898
+ * The absolute URL of this PHPRequestHandler instance.
1899
+ */
1933
1900
  get absoluteUrl() {
1934
- return H(this, Qe);
1901
+ return x(this, Ge);
1935
1902
  }
1936
- /** @inheritDoc */
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
- return H(this, Pe);
1908
+ return x(this, Pe);
1939
1909
  }
1940
- /** @inheritDoc */
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.
@@ -1946,14 +1963,14 @@ class PHPRequestHandler {
1946
1963
  ), s = applyRewriteRules(
1947
1964
  removePathPrefix(
1948
1965
  decodeURIComponent(n.pathname),
1949
- H(this, ve)
1966
+ x(this, we)
1950
1967
  ),
1951
1968
  this.rewriteRules
1952
- ), i = joinPaths(H(this, Pe), s);
1953
- return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
1969
+ ), i = joinPaths(x(this, Pe), s);
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(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), zt = function(t) {
1973
+ Pe = new WeakMap(), We = new WeakMap(), ct = new WeakMap(), je = new WeakMap(), Be = new WeakMap(), we = 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
- }, _t = new WeakSet(), Wt = async function(t, r) {
1998
+ }, ht = new WeakSet(), Bt = async function(t, r) {
1982
1999
  var s;
1983
- if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
2000
+ if (x(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, Fe).acquire();
2008
+ const n = await x(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, Je),
2000
- ...normalizeHeaders(t.headers || {})
2012
+ host: x(this, Be),
2013
+ ...normalizeHeaders(t.headers || {}),
2014
+ cookie: x(this, Ke).getCookieRequestHeader()
2001
2015
  };
2002
2016
  let c = t.body;
2003
2017
  if (typeof c == "object" && !(c 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, gt, Bt).call(this, decodeURIComponent(r.pathname));
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
- return await this.php.run({
2033
+ const u = await this.php.run({
2020
2034
  relativeUri: ensurePathPrefix(
2021
2035
  toRelativeUrl(r),
2022
- H(this, ve)
2036
+ x(this, we)
2023
2037
  ),
2024
- protocol: H(this, Ke),
2038
+ protocol: x(this, We),
2025
2039
  method: t.method || i,
2040
+ $_SERVER: {
2041
+ REMOTE_ADDR: "127.0.0.1",
2042
+ DOCUMENT_ROOT: x(this, Pe),
2043
+ HTTPS: x(this, Ge).startsWith("https://") ? "on" : ""
2044
+ },
2026
2045
  body: c,
2027
2046
  scriptPath: d,
2028
2047
  headers: o
2029
2048
  });
2049
+ return x(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,10 +2058,10 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
2036
2058
  } finally {
2037
2059
  n();
2038
2060
  }
2039
- }, gt = new WeakSet(), Bt = function(t) {
2040
- let r = removePathPrefix(t, H(this, ve));
2041
- 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
- const n = `${H(this, Pe)}${r}`;
2061
+ }, mt = new WeakSet(), Gt = function(t) {
2062
+ let r = removePathPrefix(t, x(this, we));
2063
+ r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${x(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
2064
+ const n = `${x(this, Pe)}${r}`;
2043
2065
  if (this.php.fileExists(n))
2044
2066
  return n;
2045
2067
  throw new Error(`File not found: ${n}`);
@@ -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
  }
@@ -2221,7 +2275,7 @@ class PHPExecutionFailureError extends Error {
2221
2275
  super(t), this.response = r, this.source = n;
2222
2276
  }
2223
2277
  }
2224
- var Me, Ze, Ye, Ee, Re, Te, be, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, Et, Yt, bt, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
2278
+ var De, Je, Qe, be, Re, Ee, Ye, _t, Kt, gt, Jt, yt, Qt, $t, Yt, wt, Zt, vt, 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,46 +2285,55 @@ 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
- Q(this, yt);
2235
- Q(this, $t);
2236
- Q(this, vt);
2237
- Q(this, wt);
2238
- Q(this, Pt);
2239
- Q(this, Et);
2240
- Q(this, bt);
2241
- Q(this, St);
2242
- Q(this, Rt);
2243
- Q(this, Tt);
2244
- Q(this, kt);
2245
- Q(this, Ct);
2246
- Q(this, Me, void 0);
2247
- Q(this, Ze, void 0);
2248
- Q(this, Ye, void 0);
2249
- Q(this, Ee, void 0);
2250
- Q(this, Re, void 0);
2251
- Q(this, Te, void 0);
2252
- Q(this, be, void 0);
2253
- Q(this, Xe, void 0);
2254
- te(this, Me, []), te(this, Ee, !1), te(this, Re, null), te(this, Te, {}), te(this, be, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
2255
- new PHPRequestHandler(this, t)
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, yt);
2300
+ K(this, $t);
2301
+ K(this, wt);
2302
+ K(this, vt);
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
- H(this, be).has(e) || H(this, be).set(e, /* @__PURE__ */ new Set()), H(this, be).get(e).add(t);
2322
+ x(this, Ee).has(e) || x(this, Ee).set(e, /* @__PURE__ */ new Set()), x(this, Ee).get(e).add(t);
2260
2323
  }
2261
2324
  removeEventListener(e, t) {
2262
2325
  var r;
2263
- (r = H(this, be).get(e)) == null || r.delete(t);
2326
+ (r = x(this, Ee).get(e)) == null || r.delete(t);
2264
2327
  }
2265
2328
  dispatchEvent(e) {
2266
- const t = H(this, be).get(e.type);
2329
+ const t = x(this, Ee).get(e.type);
2267
2330
  if (t)
2268
2331
  for (const r of t)
2269
2332
  r(e);
2270
2333
  }
2271
2334
  /** @inheritDoc */
2272
2335
  async onMessage(e) {
2273
- H(this, Xe).push(e);
2336
+ x(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.requestHandler.absoluteUrl;
2344
+ return this.requestHandler.absoluteUrl;
2282
2345
  }
2283
2346
  /** @inheritDoc */
2284
2347
  get documentRoot() {
2285
- return this.requestHandler.requestHandler.documentRoot;
2348
+ return this.requestHandler.documentRoot;
2286
2349
  }
2287
2350
  /** @inheritDoc */
2288
2351
  pathToInternalUrl(e) {
2289
- return this.requestHandler.requestHandler.pathToInternalUrl(e);
2352
+ return this.requestHandler.pathToInternalUrl(e);
2290
2353
  }
2291
2354
  /** @inheritDoc */
2292
2355
  internalUrlToPath(e) {
2293
- return this.requestHandler.requestHandler.internalUrlToPath(
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, Xe)) {
2365
+ for (const n of x(this, Ye)) {
2305
2366
  const s = await n(r);
2306
2367
  if (s)
2307
2368
  return s;
2308
2369
  }
2309
2370
  return "";
2310
- }, te(this, Re, improveWASMErrorReporting(t)), this.dispatchEvent({
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
- te(this, Ye, e);
2386
+ ie(this, Qe, e);
2326
2387
  }
2327
2388
  /** @inheritDoc */
2328
2389
  setPhpIniPath(e) {
2329
- if (H(this, Ee))
2390
+ if (x(this, be))
2330
2391
  throw new Error("Cannot set PHP ini path after calling run().");
2331
- te(this, Ze, e), this[__private__dont__use].ccall(
2392
+ ie(this, Je, e), this[__private__dont__use].ccall(
2332
2393
  "wasm_set_phpini_path",
2333
2394
  null,
2334
2395
  ["string"],
@@ -2337,46 +2398,49 @@ class BasePHP {
2337
2398
  }
2338
2399
  /** @inheritDoc */
2339
2400
  setPhpIniEntry(e, t) {
2340
- if (H(this, Ee))
2401
+ if (x(this, be))
2341
2402
  throw new Error("Cannot set PHP ini entries after calling run().");
2342
- H(this, Me).push([e, t]);
2403
+ x(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, t) {
2410
+ async request(e) {
2350
2411
  if (!this.requestHandler)
2351
2412
  throw new Error("No request handler available.");
2352
- return this.requestHandler.request(e, t);
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, Ee) || (ce(this, yt, Gt).call(this), te(this, Ee, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
2420
+ if (x(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, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Zt).call(this, e.method || "GET");
2364
- const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
2365
- ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this, Et, Yt).call(this, n), e.body && (r = ce(this, bt, Xt).call(this, e.body)), typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
2366
- const i = e.env || {};
2367
- for (const c in i)
2368
- ce(this, Tt, rr).call(this, c, i[c]);
2369
- const o = await ce(this, Ct, sr).call(this);
2370
- if (o.exitCode !== 0) {
2371
- console.warn("PHP.run() output was:", o.text);
2372
- const c = new PHPExecutionFailureError(
2373
- `PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors,
2374
- o,
2424
+ ce(this, Rt, sr).call(this, e.scriptPath || ""), ce(this, $t, 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, wt, Zt).call(this, s), ce(this, vt, 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 c = e.env || {};
2431
+ for (const u in c)
2432
+ ce(this, kt, or).call(this, u, c[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(c), c;
2441
+ throw console.error(u), u;
2378
2442
  }
2379
- return o;
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 t = this[__private__dont__use].FS;
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
- if (this.initializeRuntime(e), H(this, Ze) && this.setPhpIniPath(H(this, Ze)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
2495
- const r = this.documentRoot;
2496
- copyFS(t, this[__private__dont__use].FS, r);
2497
- }
2559
+ this.initializeRuntime(e), x(this, Je) && this.setPhpIniPath(x(this, Je)), x(this, Qe) && this.setSapiName(x(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
- te(this, Ee, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
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
- Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
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(), Ee = new WeakMap(),
2519
2591
  }
2520
2592
  }
2521
2593
  }`
2522
- ), H(this, Me).length > 0) {
2523
- const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
2594
+ ), x(this, De).length > 0) {
2595
+ const e = x(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(), Ee = new WeakMap(),
2532
2604
  );
2533
2605
  }
2534
2606
  this[__private__dont__use].ccall("php_wasm_init", null, [], []);
2535
- }, $t = new WeakSet(), Kt = function() {
2607
+ }, yt = 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(), Ee = new WeakMap(),
2549
2621
  headers: r,
2550
2622
  httpStatusCode: t.status
2551
2623
  };
2552
- }, vt = new WeakSet(), Jt = function(e) {
2624
+ }, $t = 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(), Ee = new WeakMap(),
2564
2636
  [t]
2565
2637
  );
2566
2638
  }
2567
- }, wt = new WeakSet(), Qt = function(e, t) {
2639
+ }, wt = 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
+ }, vt = 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), this[__private__dont__use].ccall(
2580
- "wasm_set_request_port",
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
- }, Et = new WeakSet(), Yt = function(e) {
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(), Ee = new WeakMap(),
2606
2681
  [NUMBER],
2607
2682
  [parseInt(e["content-length"], 10)]
2608
2683
  );
2609
- for (const t in e) {
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
- }, bt = 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(), Ee = new WeakMap(),
2636
2704
  [NUMBER],
2637
2705
  [r]
2638
2706
  ), n;
2639
- }, St = new WeakSet(), er = function(e) {
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
- }, Rt = new WeakSet(), tr = function() {
2647
- for (const e in H(this, Te))
2648
- this[__private__dont__use].ccall(
2649
- "wasm_add_SERVER_entry",
2650
- null,
2651
- [STRING, STRING],
2652
- [e, H(this, Te)[e]]
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
- }, kt = new WeakSet(), nr = function(e) {
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
- }, Ct = new WeakSet(), sr = async function() {
2735
+ }, Ot = new WeakSet(), cr = async function() {
2669
2736
  var s;
2670
2737
  let e, t;
2671
2738
  try {
@@ -2675,7 +2742,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2675
2742
  console.error(u), console.error(u.error);
2676
2743
  const p = new Error("Rethrown");
2677
2744
  p.cause = u.error, p.betterMessage = u.message, o(p);
2678
- }, (d = H(this, Re)) == null || d.addEventListener(
2745
+ }, (d = x(this, Re)) == null || d.addEventListener(
2679
2746
  "error",
2680
2747
  t
2681
2748
  );
@@ -2699,9 +2766,9 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2699
2766
  const o = i, c = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(c);
2700
2767
  throw d.cause = o, console.error(d), d;
2701
2768
  } finally {
2702
- (s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
2769
+ (s = x(this, Re)) == null || s.removeEventListener("error", t);
2703
2770
  }
2704
- const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
2771
+ const { headers: r, httpStatusCode: n } = ce(this, yt, 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 n, s;
2869
- (n = this.progress) == null || n.setCaption(this.caption);
2935
+ var r, n;
2936
+ (r = this.progress) == null || r.setCaption(this.caption);
2870
2937
  const t = this.getURL();
2871
- let r = await fetch(t);
2872
- if (r = await cloneResponseMonitorProgress(
2873
- r,
2874
- ((s = this.progress) == null ? void 0 : s.loadingListener) ?? noop
2875
- ), r.status !== 200)
2876
- throw new Error(`Could not download "${t}"`);
2877
- return new File([await r.blob()], this.name);
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.
@@ -3388,12 +3491,12 @@ var scope = {};
3388
3491
  let M = N.length;
3389
3492
  for (; M--; ) {
3390
3493
  const L = N[M];
3391
- L.optimizeNames(a, h) || (ke(a, L.names), N.splice(M, 1));
3494
+ L.optimizeNames(a, h) || (Te(a, L.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) => K(a, h.names), {});
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 $(N) : N;
3426
3529
  }
3427
3530
  if (h)
3428
- return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(Ce(a), h instanceof g ? [h] : h.nodes);
3531
+ return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(ke(a), h instanceof g ? [h] : h.nodes);
3429
3532
  if (!(a === !1 || !this.nodes.length))
3430
3533
  return this;
3431
3534
  }
@@ -3436,7 +3539,7 @@ var scope = {};
3436
3539
  }
3437
3540
  get names() {
3438
3541
  const a = super.names;
3439
- return ue(a, this.condition), this.else && K(a, this.else.names), a;
3542
+ return ue(a, this.condition), this.else && J(a, this.else.names), a;
3440
3543
  }
3441
3544
  }
3442
3545
  g.kind = "if";
@@ -3455,7 +3558,7 @@ var scope = {};
3455
3558
  return this.iteration = oe(this.iteration, a, h), this;
3456
3559
  }
3457
3560
  get names() {
3458
- return K(super.names, this.iteration.names);
3561
+ return J(super.names, this.iteration.names);
3459
3562
  }
3460
3563
  }
3461
3564
  class I extends y {
@@ -3483,10 +3586,10 @@ var scope = {};
3483
3586
  return this.iterable = oe(this.iterable, a, h), this;
3484
3587
  }
3485
3588
  get names() {
3486
- return K(super.names, this.iterable.names);
3589
+ return J(super.names, this.iterable.names);
3487
3590
  }
3488
3591
  }
3489
- class w extends S {
3592
+ class v extends S {
3490
3593
  constructor(a, h, N) {
3491
3594
  super(), this.name = a, this.args = h, this.async = N;
3492
3595
  }
@@ -3494,7 +3597,7 @@ var scope = {};
3494
3597
  return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
3495
3598
  }
3496
3599
  }
3497
- w.kind = "func";
3600
+ v.kind = "func";
3498
3601
  class O extends C {
3499
3602
  render(a) {
3500
3603
  return "return " + super.render(a);
@@ -3516,10 +3619,10 @@ var scope = {};
3516
3619
  }
3517
3620
  get names() {
3518
3621
  const a = super.names;
3519
- return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
3622
+ return this.catch && J(a, this.catch.names), this.finally && J(a, this.finally.names), a;
3520
3623
  }
3521
3624
  }
3522
- class x extends S {
3625
+ class H extends S {
3523
3626
  constructor(a) {
3524
3627
  super(), this.error = a;
3525
3628
  }
@@ -3527,14 +3630,14 @@ var scope = {};
3527
3630
  return `catch(${this.error})` + super.render(a);
3528
3631
  }
3529
3632
  }
3530
- x.kind = "catch";
3633
+ H.kind = "catch";
3531
3634
  class z extends S {
3532
3635
  render(a) {
3533
3636
  return "finally" + super.render(a);
3534
3637
  }
3535
3638
  }
3536
3639
  z.kind = "finally";
3537
- class re {
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 k()];
@@ -3680,9 +3783,9 @@ var scope = {};
3680
3783
  const M = new A();
3681
3784
  if (this._blockNode(M), this.code(a), h) {
3682
3785
  const L = this.name("e");
3683
- this._currNode = M.catch = new x(L), h(L);
3786
+ this._currNode = M.catch = new H(L), h(L);
3684
3787
  }
3685
- return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(x, z);
3788
+ return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(H, z);
3686
3789
  }
3687
3790
  // `throw` statement
3688
3791
  throw(a) {
@@ -3704,11 +3807,11 @@ var scope = {};
3704
3807
  }
3705
3808
  // `function` heading (or definition if funcBody is passed)
3706
3809
  func(a, h = t.nil, N, M) {
3707
- return this._blockNode(new w(a, h, N)), M && this.code(M).endFunc(), this;
3810
+ return this._blockNode(new v(a, h, N)), M && this.code(M).endFunc(), this;
3708
3811
  }
3709
3812
  // end function definition
3710
3813
  endFunc() {
3711
- return this._endBlockNode(w);
3814
+ return this._endBlockNode(v);
3712
3815
  }
3713
3816
  optimize(a = 1) {
3714
3817
  for (; a-- > 0; )
@@ -3744,21 +3847,21 @@ var scope = {};
3744
3847
  h[h.length - 1] = a;
3745
3848
  }
3746
3849
  }
3747
- e.CodeGen = re;
3748
- function K(E, a) {
3850
+ e.CodeGen = te;
3851
+ function J(b, a) {
3749
3852
  for (const h in a)
3750
- E[h] = (E[h] || 0) + (a[h] || 0);
3751
- return E;
3752
- }
3753
- function ue(E, a) {
3754
- return a instanceof t._CodeOrName ? K(E, a.names) : E;
3755
- }
3756
- function oe(E, a, h) {
3757
- if (E instanceof t.Name)
3758
- return N(E);
3759
- if (!M(E))
3760
- return E;
3761
- return new t._Code(E._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
3853
+ b[h] = (b[h] || 0) + (a[h] || 0);
3854
+ return b;
3855
+ }
3856
+ function ue(b, a) {
3857
+ return a instanceof t._CodeOrName ? J(b, a.names) : b;
3858
+ }
3859
+ function oe(b, a, h) {
3860
+ if (b instanceof t.Name)
3861
+ return N(b);
3862
+ if (!M(b))
3863
+ return b;
3864
+ return new t._Code(b._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
3762
3865
  function N(L) {
3763
3866
  const W = h[L.str];
3764
3867
  return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
@@ -3767,167 +3870,167 @@ var scope = {};
3767
3870
  return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
3768
3871
  }
3769
3872
  }
3770
- function ke(E, a) {
3873
+ function Te(b, a) {
3771
3874
  for (const h in a)
3772
- E[h] = (E[h] || 0) - (a[h] || 0);
3875
+ b[h] = (b[h] || 0) - (a[h] || 0);
3773
3876
  }
3774
- function Ce(E) {
3775
- return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
3877
+ function ke(b) {
3878
+ return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
3776
3879
  }
3777
- e.not = Ce;
3778
- const Le = v(e.operators.AND);
3779
- function et(...E) {
3780
- return E.reduce(Le);
3880
+ e.not = ke;
3881
+ const Fe = w(e.operators.AND);
3882
+ function Ze(...b) {
3883
+ return b.reduce(Fe);
3781
3884
  }
3782
- e.and = et;
3783
- const qe = v(e.operators.OR);
3784
- function F(...E) {
3785
- return E.reduce(qe);
3885
+ e.and = Ze;
3886
+ const Me = w(e.operators.OR);
3887
+ function F(...b) {
3888
+ return b.reduce(Me);
3786
3889
  }
3787
3890
  e.or = F;
3788
- function v(E) {
3789
- return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
3891
+ function w(b) {
3892
+ return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${b} ${j(h)}`;
3790
3893
  }
3791
- function j(E) {
3792
- return E instanceof t.Name ? E : (0, t._)`(${E})`;
3894
+ function j(b) {
3895
+ return b instanceof t.Name ? b : (0, t._)`(${b})`;
3793
3896
  }
3794
3897
  })(codegen);
3795
3898
  var util = {};
3796
3899
  (function(e) {
3797
3900
  Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
3798
3901
  const t = codegen, r = code$1;
3799
- function n(w) {
3902
+ function n(v) {
3800
3903
  const O = {};
3801
- for (const A of w)
3904
+ for (const A of v)
3802
3905
  O[A] = !0;
3803
3906
  return O;
3804
3907
  }
3805
3908
  e.toHash = n;
3806
- function s(w, O) {
3807
- return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(w, O), !o(O, w.self.RULES.all));
3909
+ function s(v, O) {
3910
+ return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(v, O), !o(O, v.self.RULES.all));
3808
3911
  }
3809
3912
  e.alwaysValidSchema = s;
3810
- function i(w, O = w.schema) {
3811
- const { opts: A, self: x } = w;
3913
+ function i(v, O = v.schema) {
3914
+ const { opts: A, self: H } = v;
3812
3915
  if (!A.strictSchema || typeof O == "boolean")
3813
3916
  return;
3814
- const z = x.RULES.keywords;
3815
- for (const re in O)
3816
- z[re] || D(w, `unknown keyword: "${re}"`);
3917
+ const z = H.RULES.keywords;
3918
+ for (const te in O)
3919
+ z[te] || D(v, `unknown keyword: "${te}"`);
3817
3920
  }
3818
3921
  e.checkUnknownRules = i;
3819
- function o(w, O) {
3820
- if (typeof w == "boolean")
3821
- return !w;
3822
- for (const A in w)
3922
+ function o(v, O) {
3923
+ if (typeof v == "boolean")
3924
+ return !v;
3925
+ for (const A in v)
3823
3926
  if (O[A])
3824
3927
  return !0;
3825
3928
  return !1;
3826
3929
  }
3827
3930
  e.schemaHasRules = o;
3828
- function c(w, O) {
3829
- if (typeof w == "boolean")
3830
- return !w;
3831
- for (const A in w)
3931
+ function c(v, O) {
3932
+ if (typeof v == "boolean")
3933
+ return !v;
3934
+ for (const A in v)
3832
3935
  if (A !== "$ref" && O.all[A])
3833
3936
  return !0;
3834
3937
  return !1;
3835
3938
  }
3836
3939
  e.schemaHasRulesButRef = c;
3837
- function d({ topSchemaRef: w, schemaPath: O }, A, x, z) {
3940
+ function d({ topSchemaRef: v, schemaPath: O }, A, H, z) {
3838
3941
  if (!z) {
3839
3942
  if (typeof A == "number" || typeof A == "boolean")
3840
3943
  return A;
3841
3944
  if (typeof A == "string")
3842
3945
  return (0, t._)`${A}`;
3843
3946
  }
3844
- return (0, t._)`${w}${O}${(0, t.getProperty)(x)}`;
3947
+ return (0, t._)`${v}${O}${(0, t.getProperty)(H)}`;
3845
3948
  }
3846
3949
  e.schemaRefOrVal = d;
3847
- function u(w) {
3848
- return T(decodeURIComponent(w));
3950
+ function u(v) {
3951
+ return T(decodeURIComponent(v));
3849
3952
  }
3850
3953
  e.unescapeFragment = u;
3851
- function p(w) {
3852
- return encodeURIComponent(_(w));
3954
+ function p(v) {
3955
+ return encodeURIComponent(_(v));
3853
3956
  }
3854
3957
  e.escapeFragment = p;
3855
- function _(w) {
3856
- return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
3958
+ function _(v) {
3959
+ return typeof v == "number" ? `${v}` : v.replace(/~/g, "~0").replace(/\//g, "~1");
3857
3960
  }
3858
3961
  e.escapeJsonPointer = _;
3859
- function T(w) {
3860
- return w.replace(/~1/g, "/").replace(/~0/g, "~");
3962
+ function T(v) {
3963
+ return v.replace(/~1/g, "/").replace(/~0/g, "~");
3861
3964
  }
3862
3965
  e.unescapeJsonPointer = T;
3863
- function C(w, O) {
3864
- if (Array.isArray(w))
3865
- for (const A of w)
3966
+ function C(v, O) {
3967
+ if (Array.isArray(v))
3968
+ for (const A of v)
3866
3969
  O(A);
3867
3970
  else
3868
- O(w);
3971
+ O(v);
3869
3972
  }
3870
3973
  e.eachItem = C;
3871
- function S({ mergeNames: w, mergeToName: O, mergeValues: A, resultToName: x }) {
3872
- return (z, re, K, ue) => {
3873
- const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(z, re, K) : O(z, re, K), K) : re instanceof t.Name ? (O(z, K, re), re) : A(re, K);
3874
- return ue === t.Name && !(oe instanceof t.Name) ? x(z, oe) : oe;
3974
+ function S({ mergeNames: v, mergeToName: O, mergeValues: A, resultToName: H }) {
3975
+ return (z, te, J, ue) => {
3976
+ const oe = J === void 0 ? te : J instanceof t.Name ? (te instanceof t.Name ? v(z, te, J) : O(z, te, J), J) : te instanceof t.Name ? (O(z, J, te), te) : A(te, J);
3977
+ return ue === t.Name && !(oe instanceof t.Name) ? H(z, oe) : oe;
3875
3978
  };
3876
3979
  }
3877
3980
  e.mergeEvaluated = {
3878
3981
  props: S({
3879
- mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
3880
- w.if((0, t._)`${O} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
3982
+ mergeNames: (v, O, A) => v.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
3983
+ v.if((0, t._)`${O} === true`, () => v.assign(A, !0), () => v.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
3881
3984
  }),
3882
- mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => {
3883
- O === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), $(w, A, O));
3985
+ mergeToName: (v, O, A) => v.if((0, t._)`${A} !== true`, () => {
3986
+ O === !0 ? v.assign(A, !0) : (v.assign(A, (0, t._)`${A} || {}`), $(v, A, O));
3884
3987
  }),
3885
- mergeValues: (w, O) => w === !0 ? !0 : { ...w, ...O },
3988
+ mergeValues: (v, O) => v === !0 ? !0 : { ...v, ...O },
3886
3989
  resultToName: k
3887
3990
  }),
3888
3991
  items: S({
3889
- mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => w.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
3890
- mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
3891
- mergeValues: (w, O) => w === !0 ? !0 : Math.max(w, O),
3892
- resultToName: (w, O) => w.var("items", O)
3992
+ mergeNames: (v, O, A) => v.if((0, t._)`${A} !== true && ${O} !== undefined`, () => v.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
3993
+ mergeToName: (v, O, A) => v.if((0, t._)`${A} !== true`, () => v.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
3994
+ mergeValues: (v, O) => v === !0 ? !0 : Math.max(v, O),
3995
+ resultToName: (v, O) => v.var("items", O)
3893
3996
  })
3894
3997
  };
3895
- function k(w, O) {
3998
+ function k(v, O) {
3896
3999
  if (O === !0)
3897
- return w.var("props", !0);
3898
- const A = w.var("props", (0, t._)`{}`);
3899
- return O !== void 0 && $(w, A, O), A;
4000
+ return v.var("props", !0);
4001
+ const A = v.var("props", (0, t._)`{}`);
4002
+ return O !== void 0 && $(v, A, O), A;
3900
4003
  }
3901
4004
  e.evaluatedPropsToName = k;
3902
- function $(w, O, A) {
3903
- Object.keys(A).forEach((x) => w.assign((0, t._)`${O}${(0, t.getProperty)(x)}`, !0));
4005
+ function $(v, O, A) {
4006
+ Object.keys(A).forEach((H) => v.assign((0, t._)`${O}${(0, t.getProperty)(H)}`, !0));
3904
4007
  }
3905
4008
  e.setEvaluated = $;
3906
4009
  const g = {};
3907
- function y(w, O) {
3908
- return w.scopeValue("func", {
4010
+ function y(v, O) {
4011
+ return v.scopeValue("func", {
3909
4012
  ref: O,
3910
4013
  code: g[O.code] || (g[O.code] = new r._Code(O.code))
3911
4014
  });
3912
4015
  }
3913
4016
  e.useFunc = y;
3914
4017
  var P;
3915
- (function(w) {
3916
- w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
4018
+ (function(v) {
4019
+ v[v.Num = 0] = "Num", v[v.Str = 1] = "Str";
3917
4020
  })(P = e.Type || (e.Type = {}));
3918
- function I(w, O, A) {
3919
- if (w instanceof t.Name) {
3920
- const x = O === P.Num;
3921
- return A ? x ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : x ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
4021
+ function I(v, O, A) {
4022
+ if (v instanceof t.Name) {
4023
+ const H = O === P.Num;
4024
+ return A ? H ? (0, t._)`"[" + ${v} + "]"` : (0, t._)`"['" + ${v} + "']"` : H ? (0, t._)`"/" + ${v}` : (0, t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
3922
4025
  }
3923
- return A ? (0, t.getProperty)(w).toString() : "/" + _(w);
4026
+ return A ? (0, t.getProperty)(v).toString() : "/" + _(v);
3924
4027
  }
3925
4028
  e.getErrorPath = I;
3926
- function D(w, O, A = w.opts.strictSchema) {
4029
+ function D(v, O, A = v.opts.strictSchema) {
3927
4030
  if (A) {
3928
4031
  if (O = `strict mode: ${O}`, A === !0)
3929
4032
  throw new Error(O);
3930
- w.self.logger.warn(O);
4033
+ v.self.logger.warn(O);
3931
4034
  }
3932
4035
  }
3933
4036
  e.checkStrictMode = D;
@@ -3967,13 +4070,13 @@ names$1.default = names;
3967
4070
  message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
3968
4071
  };
3969
4072
  function s($, g = e.keywordError, y, P) {
3970
- const { it: I } = $, { gen: D, compositeRule: w, allErrors: O } = I, A = _($, g, y);
3971
- P ?? (w || O) ? d(D, A) : u(I, (0, t._)`[${A}]`);
4073
+ const { it: I } = $, { gen: D, compositeRule: v, allErrors: O } = I, A = _($, g, y);
4074
+ P ?? (v || O) ? d(D, A) : u(I, (0, t._)`[${A}]`);
3972
4075
  }
3973
4076
  e.reportError = s;
3974
4077
  function i($, g = e.keywordError, y) {
3975
- const { it: P } = $, { gen: I, compositeRule: D, allErrors: w } = P, O = _($, g, y);
3976
- d(I, O), D || w || u(P, n.default.vErrors);
4078
+ const { it: P } = $, { gen: I, compositeRule: D, allErrors: v } = P, O = _($, g, y);
4079
+ d(I, O), D || v || u(P, n.default.vErrors);
3977
4080
  }
3978
4081
  e.reportExtraError = i;
3979
4082
  function o($, g) {
@@ -3983,9 +4086,9 @@ names$1.default = names;
3983
4086
  function c({ gen: $, keyword: g, schemaValue: y, data: P, errsCount: I, it: D }) {
3984
4087
  if (I === void 0)
3985
4088
  throw new Error("ajv implementation error");
3986
- const w = $.name("err");
4089
+ const v = $.name("err");
3987
4090
  $.forRange("i", I, n.default.errors, (O) => {
3988
- $.const(w, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${w}.instancePath === undefined`, () => $.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${w}.schema`, y), $.assign((0, t._)`${w}.data`, P));
4091
+ $.const(v, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${v}.instancePath === undefined`, () => $.assign((0, t._)`${v}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${v}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${v}.schema`, y), $.assign((0, t._)`${v}.data`, P));
3989
4092
  });
3990
4093
  }
3991
4094
  e.extendErrors = c;
@@ -4026,8 +4129,8 @@ names$1.default = names;
4026
4129
  return y && (I = (0, t.str)`${I}${(0, r.getErrorPath)(y, r.Type.Str)}`), [p.schemaPath, I];
4027
4130
  }
4028
4131
  function k($, { params: g, message: y }, P) {
4029
- const { keyword: I, data: D, schemaValue: w, it: O } = $, { opts: A, propertyName: x, topSchemaRef: z, schemaPath: re } = O;
4030
- P.push([p.keyword, I], [p.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && P.push([p.message, typeof y == "function" ? y($) : y]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), x && P.push([p.propertyName, x]);
4132
+ const { keyword: I, data: D, schemaValue: v, it: O } = $, { opts: A, propertyName: H, topSchemaRef: z, schemaPath: te } = O;
4133
+ P.push([p.keyword, I], [p.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && P.push([p.message, typeof y == "function" ? y($) : y]), A.verbose && P.push([p.schema, v], [p.parentSchema, (0, t._)`${z}${te}`], [n.default.data, D]), H && P.push([p.propertyName, H]);
4031
4134
  }
4032
4135
  })(errors);
4033
4136
  Object.defineProperty(boolSchema, "__esModule", { value: !0 });
@@ -4127,14 +4230,14 @@ applicability.shouldUseRule = shouldUseRule;
4127
4230
  }
4128
4231
  e.getJSONTypes = d;
4129
4232
  function u(P, I) {
4130
- const { gen: D, data: w, opts: O } = P, A = _(I, O.coerceTypes), x = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
4131
- if (x) {
4132
- const z = k(I, w, O.strictNumbers, o.Wrong);
4233
+ const { gen: D, data: v, opts: O } = P, A = _(I, O.coerceTypes), H = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
4234
+ if (H) {
4235
+ const z = k(I, v, O.strictNumbers, o.Wrong);
4133
4236
  D.if(z, () => {
4134
4237
  A.length ? T(P, I, A) : g(P);
4135
4238
  });
4136
4239
  }
4137
- return x;
4240
+ return H;
4138
4241
  }
4139
4242
  e.coerceAndCheckDataType = u;
4140
4243
  const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
@@ -4142,43 +4245,43 @@ applicability.shouldUseRule = shouldUseRule;
4142
4245
  return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
4143
4246
  }
4144
4247
  function T(P, I, D) {
4145
- const { gen: w, data: O, opts: A } = P, x = w.let("dataType", (0, s._)`typeof ${O}`), z = w.let("coerced", (0, s._)`undefined`);
4146
- A.coerceTypes === "array" && w.if((0, s._)`${x} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => w.assign(O, (0, s._)`${O}[0]`).assign(x, (0, s._)`typeof ${O}`).if(k(I, O, A.strictNumbers), () => w.assign(z, O))), w.if((0, s._)`${z} !== undefined`);
4147
- for (const K of D)
4148
- (p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
4149
- w.else(), g(P), w.endIf(), w.if((0, s._)`${z} !== undefined`, () => {
4150
- w.assign(O, z), C(P, z);
4248
+ const { gen: v, data: O, opts: A } = P, H = v.let("dataType", (0, s._)`typeof ${O}`), z = v.let("coerced", (0, s._)`undefined`);
4249
+ A.coerceTypes === "array" && v.if((0, s._)`${H} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => v.assign(O, (0, s._)`${O}[0]`).assign(H, (0, s._)`typeof ${O}`).if(k(I, O, A.strictNumbers), () => v.assign(z, O))), v.if((0, s._)`${z} !== undefined`);
4250
+ for (const J of D)
4251
+ (p.has(J) || J === "array" && A.coerceTypes === "array") && te(J);
4252
+ v.else(), g(P), v.endIf(), v.if((0, s._)`${z} !== undefined`, () => {
4253
+ v.assign(O, z), C(P, z);
4151
4254
  });
4152
- function re(K) {
4153
- switch (K) {
4255
+ function te(J) {
4256
+ switch (J) {
4154
4257
  case "string":
4155
- w.elseIf((0, s._)`${x} == "number" || ${x} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
4258
+ v.elseIf((0, s._)`${H} == "number" || ${H} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
4156
4259
  return;
4157
4260
  case "number":
4158
- w.elseIf((0, s._)`${x} == "boolean" || ${O} === null
4159
- || (${x} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
4261
+ v.elseIf((0, s._)`${H} == "boolean" || ${O} === null
4262
+ || (${H} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
4160
4263
  return;
4161
4264
  case "integer":
4162
- w.elseIf((0, s._)`${x} === "boolean" || ${O} === null
4163
- || (${x} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
4265
+ v.elseIf((0, s._)`${H} === "boolean" || ${O} === null
4266
+ || (${H} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
4164
4267
  return;
4165
4268
  case "boolean":
4166
- w.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
4269
+ v.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
4167
4270
  return;
4168
4271
  case "null":
4169
- w.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), w.assign(z, null);
4272
+ v.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), v.assign(z, null);
4170
4273
  return;
4171
4274
  case "array":
4172
- w.elseIf((0, s._)`${x} === "string" || ${x} === "number"
4173
- || ${x} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
4275
+ v.elseIf((0, s._)`${H} === "string" || ${H} === "number"
4276
+ || ${H} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
4174
4277
  }
4175
4278
  }
4176
4279
  }
4177
- function C({ gen: P, parentData: I, parentDataProperty: D }, w) {
4178
- P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
4280
+ function C({ gen: P, parentData: I, parentDataProperty: D }, v) {
4281
+ P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, v));
4179
4282
  }
4180
- function S(P, I, D, w = o.Correct) {
4181
- const O = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
4283
+ function S(P, I, D, v = o.Correct) {
4284
+ const O = v === o.Correct ? s.operators.EQ : s.operators.NEQ;
4182
4285
  let A;
4183
4286
  switch (P) {
4184
4287
  case "null":
@@ -4190,33 +4293,33 @@ applicability.shouldUseRule = shouldUseRule;
4190
4293
  A = (0, s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;
4191
4294
  break;
4192
4295
  case "integer":
4193
- A = x((0, s._)`!(${I} % 1) && !isNaN(${I})`);
4296
+ A = H((0, s._)`!(${I} % 1) && !isNaN(${I})`);
4194
4297
  break;
4195
4298
  case "number":
4196
- A = x();
4299
+ A = H();
4197
4300
  break;
4198
4301
  default:
4199
4302
  return (0, s._)`typeof ${I} ${O} ${P}`;
4200
4303
  }
4201
- return w === o.Correct ? A : (0, s.not)(A);
4202
- function x(z = s.nil) {
4304
+ return v === o.Correct ? A : (0, s.not)(A);
4305
+ function H(z = s.nil) {
4203
4306
  return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, D ? (0, s._)`isFinite(${I})` : s.nil);
4204
4307
  }
4205
4308
  }
4206
4309
  e.checkDataType = S;
4207
- function k(P, I, D, w) {
4310
+ function k(P, I, D, v) {
4208
4311
  if (P.length === 1)
4209
- return S(P[0], I, D, w);
4312
+ return S(P[0], I, D, v);
4210
4313
  let O;
4211
4314
  const A = (0, i.toHash)(P);
4212
4315
  if (A.array && A.object) {
4213
- const x = (0, s._)`typeof ${I} != "object"`;
4214
- O = A.null ? x : (0, s._)`!${I} || ${x}`, delete A.null, delete A.array, delete A.object;
4316
+ const H = (0, s._)`typeof ${I} != "object"`;
4317
+ O = A.null ? H : (0, s._)`!${I} || ${H}`, delete A.null, delete A.array, delete A.object;
4215
4318
  } else
4216
4319
  O = s.nil;
4217
4320
  A.number && delete A.integer;
4218
- for (const x in A)
4219
- O = (0, s.and)(O, S(x, I, D, w));
4321
+ for (const H in A)
4322
+ O = (0, s.and)(O, S(H, I, D, v));
4220
4323
  return O;
4221
4324
  }
4222
4325
  e.checkDataTypes = k;
@@ -4230,15 +4333,15 @@ applicability.shouldUseRule = shouldUseRule;
4230
4333
  }
4231
4334
  e.reportTypeError = g;
4232
4335
  function y(P) {
4233
- const { gen: I, data: D, schema: w } = P, O = (0, i.schemaRefOrVal)(P, w, "type");
4336
+ const { gen: I, data: D, schema: v } = P, O = (0, i.schemaRefOrVal)(P, v, "type");
4234
4337
  return {
4235
4338
  gen: I,
4236
4339
  keyword: "type",
4237
4340
  data: D,
4238
- schema: w.type,
4341
+ schema: v.type,
4239
4342
  schemaCode: O,
4240
4343
  schemaValue: O,
4241
- parentSchema: w,
4344
+ parentSchema: v,
4242
4345
  params: {},
4243
4346
  it: P
4244
4347
  };
@@ -5244,8 +5347,8 @@ var uri$1 = {}, uri_all = { exports: {} };
5244
5347
  l[m] = arguments[m];
5245
5348
  if (l.length > 1) {
5246
5349
  l[0] = l[0].slice(0, -1);
5247
- for (var R = l.length - 1, b = 1; b < R; ++b)
5248
- l[b] = l[b].slice(1, -1);
5350
+ for (var R = l.length - 1, E = 1; E < R; ++E)
5351
+ l[E] = l[E].slice(1, -1);
5249
5352
  return l[R] = l[R].slice(1), l.join("");
5250
5353
  } else
5251
5354
  return l[0];
@@ -5270,39 +5373,39 @@ var uri$1 = {}, uri_all = { exports: {} };
5270
5373
  return m;
5271
5374
  }
5272
5375
  function u(f) {
5273
- var l = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), b = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, m, "[\\-\\.\\_\\~]", Y);
5274
- s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
5275
- var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), V = s(R + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + ie), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Se = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), ge = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ye = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), Be = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ie = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), $e = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
5276
- s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
5277
- var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
5278
- return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
5376
+ var l = "[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)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", Q = n(q, U), Z = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", ne = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, m, "[\\-\\.\\_\\~]", Z);
5377
+ s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, U, "[\\:]")) + "*");
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), V = s(R + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + se), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Se = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), ge = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ye = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), ze = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ne = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), $e = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), Ie = s([ae, ee, Se, ge, ye, ze, Ne, fe, $e].join("|")), ve = s(s(B + "|" + E) + "+");
5379
+ s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(E + "|" + n(B, U)) + "*");
5380
+ var ot = s(E + "|" + n(B, U, "[\\:\\@]"));
5381
+ return s(s(E + "|" + n(B, U, "[\\@]")) + "+"), s(s(ot + "|" + n("[\\/\\?]", ne)) + "*"), {
5279
5382
  NOT_SCHEME: new RegExp(n("[^]", l, m, "[\\+\\-\\.]"), "g"),
5280
5383
  NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
5281
5384
  NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
5282
5385
  NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
5283
5386
  NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", B, U), "g"),
5284
- NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", se), "g"),
5387
+ NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", ne), "g"),
5285
5388
  NOT_FRAGMENT: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]"), "g"),
5286
5389
  ESCAPE: new RegExp(n("[^]", B, U), "g"),
5287
5390
  UNRESERVED: new RegExp(B, "g"),
5288
- OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
5289
- PCT_ENCODED: new RegExp(b, "g"),
5290
- IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
5291
- IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
5391
+ OTHER_CHARS: new RegExp(n("[^\\%]", B, Q), "g"),
5392
+ PCT_ENCODED: new RegExp(E, "g"),
5393
+ IPV4ADDRESS: new RegExp("^(" + se + ")$"),
5394
+ IPV6ADDRESS: new RegExp("^\\[?(" + Ie + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + ve + ")") + "?\\]?$")
5292
5395
  //RFC 6874, with relaxed parsing rules
5293
5396
  };
5294
5397
  }
5295
5398
  var p = u(!1), _ = u(!0), T = function() {
5296
5399
  function f(l, m) {
5297
- var R = [], b = !0, q = !1, U = void 0;
5400
+ var R = [], E = !0, q = !1, U = void 0;
5298
5401
  try {
5299
- for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); b = !0)
5402
+ for (var Q = l[Symbol.iterator](), Z; !(E = (Z = Q.next()).done) && (R.push(Z.value), !(m && R.length === m)); E = !0)
5300
5403
  ;
5301
- } catch (se) {
5302
- q = !0, U = se;
5404
+ } catch (ne) {
5405
+ q = !0, U = ne;
5303
5406
  } finally {
5304
5407
  try {
5305
- !b && J.return && J.return();
5408
+ !E && Q.return && Q.return();
5306
5409
  } finally {
5307
5410
  if (q)
5308
5411
  throw U;
@@ -5324,106 +5427,106 @@ var uri$1 = {}, uri_all = { exports: {} };
5324
5427
  return m;
5325
5428
  } else
5326
5429
  return Array.from(f);
5327
- }, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128, w = "-", O = /^xn--/, A = /[^\0-\x7E]/, x = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
5430
+ }, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128, v = "-", O = /^xn--/, A = /[^\0-\x7E]/, H = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
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
- }, re = k - $, K = Math.floor, ue = String.fromCharCode;
5434
+ }, te = k - $, J = Math.floor, ue = String.fromCharCode;
5332
5435
  function oe(f) {
5333
5436
  throw new RangeError(z[f]);
5334
5437
  }
5335
- function ke(f, l) {
5438
+ function Te(f, l) {
5336
5439
  for (var m = [], R = f.length; R--; )
5337
5440
  m[R] = l(f[R]);
5338
5441
  return m;
5339
5442
  }
5340
- function Ce(f, l) {
5443
+ function ke(f, l) {
5341
5444
  var m = f.split("@"), R = "";
5342
- m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(x, ".");
5343
- var b = f.split("."), q = ke(b, l).join(".");
5445
+ m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(H, ".");
5446
+ var E = f.split("."), q = Te(E, l).join(".");
5344
5447
  return R + q;
5345
5448
  }
5346
- function Le(f) {
5449
+ function Fe(f) {
5347
5450
  for (var l = [], m = 0, R = f.length; m < R; ) {
5348
- var b = f.charCodeAt(m++);
5349
- if (b >= 55296 && b <= 56319 && m < R) {
5451
+ var E = f.charCodeAt(m++);
5452
+ if (E >= 55296 && E <= 56319 && m < R) {
5350
5453
  var q = f.charCodeAt(m++);
5351
- (q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), m--);
5454
+ (q & 64512) == 56320 ? l.push(((E & 1023) << 10) + (q & 1023) + 65536) : (l.push(E), m--);
5352
5455
  } else
5353
- l.push(b);
5456
+ l.push(E);
5354
5457
  }
5355
5458
  return l;
5356
5459
  }
5357
- var et = function(l) {
5460
+ var Ze = function(l) {
5358
5461
  return String.fromCodePoint.apply(String, C(l));
5359
- }, qe = function(l) {
5462
+ }, Me = function(l) {
5360
5463
  return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : k;
5361
5464
  }, F = function(l, m) {
5362
5465
  return l + 22 + 75 * (l < 26) - ((m != 0) << 5);
5363
- }, v = function(l, m, R) {
5364
- var b = 0;
5466
+ }, w = function(l, m, R) {
5467
+ var E = 0;
5365
5468
  for (
5366
- l = R ? K(l / P) : l >> 1, l += K(l / m);
5469
+ l = R ? J(l / P) : l >> 1, l += J(l / m);
5367
5470
  /* no initialization */
5368
- l > re * g >> 1;
5369
- b += k
5471
+ l > te * g >> 1;
5472
+ E += k
5370
5473
  )
5371
- l = K(l / re);
5372
- return K(b + (re + 1) * l / (l + y));
5474
+ l = J(l / te);
5475
+ return J(E + (te + 1) * l / (l + y));
5373
5476
  }, j = function(l) {
5374
- var m = [], R = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
5375
- J < 0 && (J = 0);
5376
- for (var Y = 0; Y < J; ++Y)
5377
- l.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(l.charCodeAt(Y));
5378
- for (var se = J > 0 ? J + 1 : 0; se < R; ) {
5477
+ var m = [], R = l.length, E = 0, q = D, U = I, Q = l.lastIndexOf(v);
5478
+ Q < 0 && (Q = 0);
5479
+ for (var Z = 0; Z < Q; ++Z)
5480
+ l.charCodeAt(Z) >= 128 && oe("not-basic"), m.push(l.charCodeAt(Z));
5481
+ for (var ne = Q > 0 ? Q + 1 : 0; ne < R; ) {
5379
5482
  for (
5380
- var B = b, Z = 1, ie = k;
5483
+ var B = E, Y = 1, se = k;
5381
5484
  ;
5382
5485
  /* no condition */
5383
- ie += k
5486
+ se += k
5384
5487
  ) {
5385
- se >= R && oe("invalid-input");
5386
- var V = qe(l.charCodeAt(se++));
5387
- (V >= k || V > K((S - b) / Z)) && oe("overflow"), b += V * Z;
5388
- var X = ie <= U ? $ : ie >= U + g ? g : ie - U;
5488
+ ne >= R && oe("invalid-input");
5489
+ var V = Me(l.charCodeAt(ne++));
5490
+ (V >= k || V > J((S - E) / Y)) && oe("overflow"), E += V * Y;
5491
+ var X = se <= U ? $ : se >= U + g ? g : se - U;
5389
5492
  if (V < X)
5390
5493
  break;
5391
5494
  var ae = k - X;
5392
- Z > K(S / ae) && oe("overflow"), Z *= ae;
5495
+ Y > J(S / ae) && oe("overflow"), Y *= ae;
5393
5496
  }
5394
5497
  var ee = m.length + 1;
5395
- U = v(b - B, ee, B == 0), K(b / ee) > S - q && oe("overflow"), q += K(b / ee), b %= ee, m.splice(b++, 0, q);
5498
+ U = w(E - B, ee, B == 0), J(E / ee) > S - q && oe("overflow"), q += J(E / ee), E %= ee, m.splice(E++, 0, q);
5396
5499
  }
5397
5500
  return String.fromCodePoint.apply(String, m);
5398
- }, E = function(l) {
5501
+ }, b = function(l) {
5399
5502
  var m = [];
5400
- l = Le(l);
5401
- var R = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
5503
+ l = Fe(l);
5504
+ var R = l.length, E = D, q = 0, U = I, Q = !0, Z = !1, ne = void 0;
5402
5505
  try {
5403
- for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
5404
- var ie = Z.value;
5405
- ie < 128 && m.push(ue(ie));
5506
+ for (var B = l[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 (lt) {
5408
- Y = !0, se = lt;
5510
+ } catch (at) {
5511
+ Z = !0, ne = at;
5409
5512
  } finally {
5410
5513
  try {
5411
- !J && B.return && B.return();
5514
+ !Q && B.return && B.return();
5412
5515
  } finally {
5413
- if (Y)
5414
- throw se;
5516
+ if (Z)
5517
+ throw ne;
5415
5518
  }
5416
5519
  }
5417
5520
  var V = m.length, X = V;
5418
- for (V && m.push(w); X < R; ) {
5521
+ for (V && m.push(v); X < R; ) {
5419
5522
  var ae = S, ee = !0, Se = !1, ge = void 0;
5420
5523
  try {
5421
- for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
5422
- var Ie = Be.value;
5423
- Ie >= b && Ie < ae && (ae = Ie);
5524
+ for (var ye = l[Symbol.iterator](), ze; !(ee = (ze = ye.next()).done); ee = !0) {
5525
+ var Ne = ze.value;
5526
+ Ne >= E && Ne < ae && (ae = Ne);
5424
5527
  }
5425
- } catch (lt) {
5426
- Se = !0, ge = lt;
5528
+ } catch (at) {
5529
+ Se = !0, ge = at;
5427
5530
  } finally {
5428
5531
  try {
5429
5532
  !ee && ye.return && ye.return();
@@ -5433,47 +5536,47 @@ var uri$1 = {}, uri_all = { exports: {} };
5433
5536
  }
5434
5537
  }
5435
5538
  var fe = X + 1;
5436
- ae - b > K((S - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
5437
- var $e = !0, je = !1, we = void 0;
5539
+ ae - E > J((S - q) / fe) && oe("overflow"), q += (ae - E) * fe, E = ae;
5540
+ var $e = !0, Ie = !1, ve = void 0;
5438
5541
  try {
5439
- for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
5440
- var Ht = Ut.value;
5441
- if (Ht < b && ++q > S && oe("overflow"), Ht == b) {
5542
+ for (var ot = l[Symbol.iterator](), xt; !($e = (xt = ot.next()).done); $e = !0) {
5543
+ var Ht = xt.value;
5544
+ if (Ht < E && ++q > S && oe("overflow"), Ht == E) {
5442
5545
  for (
5443
- var pt = q, ft = k;
5546
+ var dt = q, ut = k;
5444
5547
  ;
5445
5548
  /* no condition */
5446
- ft += k
5549
+ ut += k
5447
5550
  ) {
5448
- var ht = ft <= U ? $ : ft >= U + g ? g : ft - U;
5449
- if (pt < ht)
5551
+ var pt = ut <= U ? $ : ut >= U + g ? g : ut - U;
5552
+ if (dt < pt)
5450
5553
  break;
5451
- var xt = pt - ht, Vt = k - ht;
5452
- m.push(ue(F(ht + xt % Vt, 0))), pt = K(xt / Vt);
5554
+ var Vt = dt - pt, zt = k - pt;
5555
+ m.push(ue(F(pt + Vt % zt, 0))), dt = J(Vt / zt);
5453
5556
  }
5454
- m.push(ue(F(pt, 0))), U = v(q, fe, X == V), q = 0, ++X;
5557
+ m.push(ue(F(dt, 0))), U = w(q, fe, X == V), q = 0, ++X;
5455
5558
  }
5456
5559
  }
5457
- } catch (lt) {
5458
- je = !0, we = lt;
5560
+ } catch (at) {
5561
+ Ie = !0, ve = at;
5459
5562
  } finally {
5460
5563
  try {
5461
- !$e && ct.return && ct.return();
5564
+ !$e && ot.return && ot.return();
5462
5565
  } finally {
5463
- if (je)
5464
- throw we;
5566
+ if (Ie)
5567
+ throw ve;
5465
5568
  }
5466
5569
  }
5467
- ++q, ++b;
5570
+ ++q, ++E;
5468
5571
  }
5469
5572
  return m.join("");
5470
5573
  }, a = function(l) {
5471
- return Ce(l, function(m) {
5574
+ return ke(l, function(m) {
5472
5575
  return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
5473
5576
  });
5474
5577
  }, h = function(l) {
5475
- return Ce(l, function(m) {
5476
- return A.test(m) ? "xn--" + E(m) : m;
5578
+ return ke(l, function(m) {
5579
+ return A.test(m) ? "xn--" + b(m) : m;
5477
5580
  });
5478
5581
  }, N = {
5479
5582
  /**
@@ -5490,11 +5593,11 @@ var uri$1 = {}, uri_all = { exports: {} };
5490
5593
  * @type Object
5491
5594
  */
5492
5595
  ucs2: {
5493
- decode: Le,
5494
- encode: et
5596
+ decode: Fe,
5597
+ encode: Ze
5495
5598
  },
5496
5599
  decode: j,
5497
- encode: E,
5600
+ encode: b,
5498
5601
  toASCII: h,
5499
5602
  toUnicode: a
5500
5603
  }, M = {};
@@ -5504,20 +5607,20 @@ var uri$1 = {}, uri_all = { exports: {} };
5504
5607
  }
5505
5608
  function W(f) {
5506
5609
  for (var l = "", m = 0, R = f.length; m < R; ) {
5507
- var b = parseInt(f.substr(m + 1, 2), 16);
5508
- if (b < 128)
5509
- l += String.fromCharCode(b), m += 3;
5510
- else if (b >= 194 && b < 224) {
5610
+ var E = parseInt(f.substr(m + 1, 2), 16);
5611
+ if (E < 128)
5612
+ l += String.fromCharCode(E), m += 3;
5613
+ else if (E >= 194 && E < 224) {
5511
5614
  if (R - m >= 6) {
5512
5615
  var q = parseInt(f.substr(m + 4, 2), 16);
5513
- l += String.fromCharCode((b & 31) << 6 | q & 63);
5616
+ l += String.fromCharCode((E & 31) << 6 | q & 63);
5514
5617
  } else
5515
5618
  l += f.substr(m, 6);
5516
5619
  m += 6;
5517
- } else if (b >= 224) {
5620
+ } else if (E >= 224) {
5518
5621
  if (R - m >= 9) {
5519
- var U = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
5520
- l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
5622
+ var U = parseInt(f.substr(m + 4, 2), 16), Q = parseInt(f.substr(m + 7, 2), 16);
5623
+ l += String.fromCharCode((E & 15) << 12 | (U & 63) << 6 | Q & 63);
5521
5624
  } else
5522
5625
  l += f.substr(m, 9);
5523
5626
  m += 9;
@@ -5528,49 +5631,49 @@ var uri$1 = {}, uri_all = { exports: {} };
5528
5631
  }
5529
5632
  function G(f, l) {
5530
5633
  function m(R) {
5531
- var b = W(R);
5532
- return b.match(l.UNRESERVED) ? b : R;
5634
+ var E = W(R);
5635
+ return E.match(l.UNRESERVED) ? E : R;
5533
5636
  }
5534
5637
  return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, m).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, m).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, m).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, m).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
5535
5638
  }
5536
- function ne(f) {
5639
+ function re(f) {
5537
5640
  return f.replace(/^0*(.*)/, "$1") || "0";
5538
5641
  }
5539
5642
  function he(f, l) {
5540
- var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2), b = R[1];
5541
- return b ? b.split(".").map(ne).join(".") : f;
5542
- }
5543
- function Ue(f, l) {
5544
- var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3), b = R[1], q = R[2];
5545
- if (b) {
5546
- for (var U = b.toLowerCase().split("::").reverse(), J = T(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), V = ie ? 7 : 8, X = Z.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
5547
- ae[ee] = B[ee] || Z[X + ee] || "";
5548
- ie && (ae[V - 1] = he(ae[V - 1], l));
5549
- var Se = ae.reduce(function(fe, $e, je) {
5643
+ var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2), E = R[1];
5644
+ return E ? E.split(".").map(re).join(".") : f;
5645
+ }
5646
+ function Le(f, l) {
5647
+ var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3), E = R[1], q = R[2];
5648
+ if (E) {
5649
+ for (var U = E.toLowerCase().split("::").reverse(), Q = T(U, 2), Z = Q[0], ne = Q[1], B = ne ? ne.split(":").map(re) : [], Y = Z.split(":").map(re), se = l.IPV4ADDRESS.test(Y[Y.length - 1]), V = se ? 7 : 8, X = Y.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
5650
+ ae[ee] = B[ee] || Y[X + ee] || "";
5651
+ se && (ae[V - 1] = he(ae[V - 1], l));
5652
+ var Se = ae.reduce(function(fe, $e, Ie) {
5550
5653
  if (!$e || $e === "0") {
5551
- var we = fe[fe.length - 1];
5552
- we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
5654
+ var ve = fe[fe.length - 1];
5655
+ ve && ve.index + ve.length === Ie ? ve.length++ : fe.push({ index: Ie, length: 1 });
5553
5656
  }
5554
5657
  return fe;
5555
5658
  }, []), ge = Se.sort(function(fe, $e) {
5556
5659
  return $e.length - fe.length;
5557
5660
  })[0], ye = void 0;
5558
5661
  if (ge && ge.length > 1) {
5559
- var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
5560
- ye = Be.join(":") + "::" + Ie.join(":");
5662
+ var ze = ae.slice(0, ge.index), Ne = ae.slice(ge.index + ge.length);
5663
+ ye = ze.join(":") + "::" + Ne.join(":");
5561
5664
  } else
5562
5665
  ye = ae.join(":");
5563
5666
  return q && (ye += "%" + q), ye;
5564
5667
  } else
5565
5668
  return f;
5566
5669
  }
5567
- var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
5670
+ var Xe = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, et = "".match(/(){0}/)[1] === void 0;
5568
5671
  function de(f) {
5569
5672
  var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = l.iri !== !1 ? _ : p;
5570
5673
  l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
5571
- var b = f.match(tt);
5572
- if (b) {
5573
- rt ? (m.scheme = b[1], m.userinfo = b[3], m.host = b[4], m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = b[7], m.fragment = b[8], isNaN(m.port) && (m.port = b[5])) : (m.scheme = b[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, m.host = f.indexOf("//") !== -1 ? b[4] : void 0, m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = f.indexOf("?") !== -1 ? b[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), m.host && (m.host = Ue(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== m.reference && (m.error = m.error || "URI is not a " + l.reference + " reference.");
5674
+ var E = f.match(Xe);
5675
+ if (E) {
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 = Le(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== m.reference && (m.error = m.error || "URI is not a " + l.reference + " reference.");
5574
5677
  var q = M[(l.scheme || m.scheme || "").toLowerCase()];
5575
5678
  if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
5576
5679
  if (m.host && (l.domainHost || q && q.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 nt(f, l) {
5693
+ function tt(f, l) {
5591
5694
  var m = l.iri !== !1 ? _ : p, R = [];
5592
- return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Ue(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(b, q, U) {
5695
+ return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, q, U) {
5593
5696
  return "[" + q + (U ? "%25" + U : "") + "]";
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 He = /^\.\.?\//, xe = /^\/\.(\/|$)/, Ve = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
5699
+ var qe = /^\.\.?\//, Ue = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, rt = /^\/?(?:.|\n)*?(?=\/|$)/;
5597
5700
  function me(f) {
5598
5701
  for (var l = []; f.length; )
5599
- if (f.match(He))
5600
- f = f.replace(He, "");
5702
+ if (f.match(qe))
5703
+ f = f.replace(qe, "");
5704
+ else if (f.match(Ue))
5705
+ f = f.replace(Ue, "/");
5601
5706
  else if (f.match(xe))
5602
- f = f.replace(xe, "/");
5603
- else if (f.match(Ve))
5604
- f = f.replace(Ve, "/"), l.pop();
5707
+ f = f.replace(xe, "/"), l.pop();
5605
5708
  else if (f === "." || f === "..")
5606
5709
  f = "";
5607
5710
  else {
5608
- var m = f.match(st);
5711
+ var m = f.match(rt);
5609
5712
  if (m) {
5610
5713
  var R = m[0];
5611
5714
  f = f.slice(R.length), l.push(R);
@@ -5615,44 +5718,44 @@ var uri$1 = {}, uri_all = { exports: {} };
5615
5718
  return l.join("");
5616
5719
  }
5617
5720
  function le(f) {
5618
- var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
5619
- if (b && b.serialize && b.serialize(f, l), f.host && !m.IPV6ADDRESS.test(f.host)) {
5620
- if (l.domainHost || b && b.domainHost)
5721
+ var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [], E = M[(l.scheme || f.scheme || "").toLowerCase()];
5722
+ if (E && E.serialize && E.serialize(f, l), f.host && !m.IPV6ADDRESS.test(f.host)) {
5723
+ if (l.domainHost || E && E.domainHost)
5621
5724
  try {
5622
5725
  f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
5623
- } catch (J) {
5624
- f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
5726
+ } catch (Q) {
5727
+ f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + Q;
5625
5728
  }
5626
5729
  }
5627
5730
  G(f, m), l.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
5628
- var q = nt(f, l);
5731
+ var q = tt(f, l);
5629
5732
  if (q !== void 0 && (l.reference !== "suffix" && R.push("//"), R.push(q), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
5630
5733
  var U = f.path;
5631
- !l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
5734
+ !l.absolutePath && (!E || !E.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
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 ze(f, l) {
5636
- var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], b = {};
5637
- return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
5738
+ function He(f, l) {
5739
+ var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], E = {};
5740
+ return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (E.scheme = l.scheme, E.userinfo = l.userinfo, E.host = l.host, E.port = l.port, E.path = me(l.path || ""), E.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (E.userinfo = l.userinfo, E.host = l.host, E.port = l.port, E.path = me(l.path || ""), E.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? E.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + l.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : E.path = l.path, E.path = me(E.path)), E.query = l.query) : (E.path = f.path, l.query !== void 0 ? E.query = l.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = l.fragment, E;
5638
5741
  }
5639
- function it(f, l, m) {
5742
+ function nt(f, l, m) {
5640
5743
  var R = d({ scheme: "null" }, m);
5641
- return le(ze(de(f, R), de(l, R), R, !0), R);
5744
+ return le(He(de(f, R), de(l, R), R, !0), R);
5642
5745
  }
5643
- function Oe(f, l) {
5746
+ function Ce(f, l) {
5644
5747
  return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
5645
5748
  }
5646
- function ot(f, l, m) {
5749
+ function st(f, l, m) {
5647
5750
  return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof l == "string" ? l = le(de(l, m), m) : i(l) === "object" && (l = le(l, m)), f === l;
5648
5751
  }
5649
- function ut(f, l) {
5752
+ function lt(f, l) {
5650
5753
  return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : _.ESCAPE, L);
5651
5754
  }
5652
5755
  function pe(f, l) {
5653
5756
  return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : _.PCT_ENCODED, W);
5654
5757
  }
5655
- var Ne = {
5758
+ var Oe = {
5656
5759
  scheme: "http",
5657
5760
  domainHost: !0,
5658
5761
  parse: function(l, m) {
@@ -5662,50 +5765,50 @@ var uri$1 = {}, uri_all = { exports: {} };
5662
5765
  var R = String(l.scheme).toLowerCase() === "https";
5663
5766
  return (l.port === (R ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
5664
5767
  }
5665
- }, It = {
5768
+ }, jt = {
5666
5769
  scheme: "https",
5667
- domainHost: Ne.domainHost,
5668
- parse: Ne.parse,
5669
- serialize: Ne.serialize
5770
+ domainHost: Oe.domainHost,
5771
+ parse: Oe.parse,
5772
+ serialize: Oe.serialize
5670
5773
  };
5671
- function jt(f) {
5774
+ function At(f) {
5672
5775
  return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
5673
5776
  }
5674
- var at = {
5777
+ var it = {
5675
5778
  scheme: "ws",
5676
5779
  domainHost: !0,
5677
5780
  parse: function(l, m) {
5678
5781
  var R = l;
5679
- return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
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(l, m) {
5682
- if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
5683
- var R = l.resourceName.split("?"), b = T(R, 2), q = b[0], U = b[1];
5785
+ if ((l.port === (At(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
5786
+ var R = l.resourceName.split("?"), E = T(R, 2), q = E[0], U = E[1];
5684
5787
  l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
5685
5788
  }
5686
5789
  return l.fragment = void 0, l;
5687
5790
  }
5688
- }, At = {
5791
+ }, Dt = {
5689
5792
  scheme: "wss",
5690
- domainHost: at.domainHost,
5691
- parse: at.parse,
5692
- serialize: at.serialize
5693
- }, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
5694
- function Ot(f) {
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"), Ve = 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 l = W(f);
5696
- return l.match(ur) ? l : f;
5799
+ return l.match(mr) ? l : f;
5697
5800
  }
5698
- var Mt = {
5801
+ var Lt = {
5699
5802
  scheme: "mailto",
5700
5803
  parse: function(l, m) {
5701
- var R = l, b = R.to = R.path ? R.path.split(",") : [];
5804
+ var R = l, E = R.to = R.path ? R.path.split(",") : [];
5702
5805
  if (R.path = void 0, R.query) {
5703
- for (var q = !1, U = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
5704
- var B = J[Y].split("=");
5806
+ for (var q = !1, U = {}, 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 Z = B[1].split(","), ie = 0, V = Z.length; ie < V; ++ie)
5708
- b.push(Z[ie]);
5810
+ for (var Y = B[1].split(","), se = 0, V = Y.length; se < V; ++se)
5811
+ E.push(Y[se]);
5709
5812
  break;
5710
5813
  case "subject":
5711
5814
  R.subject = pe(B[1], m);
@@ -5721,8 +5824,8 @@ var uri$1 = {}, uri_all = { exports: {} };
5721
5824
  q && (R.headers = U);
5722
5825
  }
5723
5826
  R.query = void 0;
5724
- for (var X = 0, ae = b.length; X < ae; ++X) {
5725
- var ee = b[X].split("@");
5827
+ for (var X = 0, ae = E.length; X < ae; ++X) {
5828
+ var ee = E[X].split("@");
5726
5829
  if (ee[0] = pe(ee[0]), m.unicodeSupport)
5727
5830
  ee[1] = pe(ee[1], m).toLowerCase();
5728
5831
  else
@@ -5731,60 +5834,60 @@ var uri$1 = {}, uri_all = { exports: {} };
5731
5834
  } catch (Se) {
5732
5835
  R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
5733
5836
  }
5734
- b[X] = ee.join("@");
5837
+ E[X] = ee.join("@");
5735
5838
  }
5736
5839
  return R;
5737
5840
  },
5738
5841
  serialize: function(l, m) {
5739
- var R = l, b = c(l.to);
5740
- if (b) {
5741
- for (var q = 0, U = b.length; q < U; ++q) {
5742
- var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
5842
+ var R = l, E = c(l.to);
5843
+ if (E) {
5844
+ for (var q = 0, U = E.length; q < U; ++q) {
5845
+ var Q = String(E[q]), Z = Q.lastIndexOf("@"), ne = Q.slice(0, Z).replace(Ve, Nt).replace(Ve, o).replace(_r, L), 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
- b[q] = se + "@" + B;
5851
+ E[q] = ne + "@" + B;
5749
5852
  }
5750
- R.path = b.join(",");
5853
+ R.path = E.join(",");
5751
5854
  }
5752
- var Z = l.headers = l.headers || {};
5753
- l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
5754
- var ie = [];
5755
- for (var V in Z)
5756
- Z[V] !== ir[V] && ie.push(V.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[V].replace(We, Ot).replace(We, o).replace(fr, L));
5757
- return ie.length && (R.query = ie.join("&")), R;
5855
+ var Y = l.headers = l.headers || {};
5856
+ l.subject && (Y.subject = l.subject), l.body && (Y.body = l.body);
5857
+ var se = [];
5858
+ for (var V in Y)
5859
+ Y[V] !== lr[V] && se.push(V.replace(Ve, Nt).replace(Ve, o).replace(Mt, L) + "=" + Y[V].replace(Ve, Nt).replace(Ve, o).replace(gr, L));
5860
+ return se.length && (R.query = se.join("&")), R;
5758
5861
  }
5759
- }, hr = /^([^\:]+)\:(.*)/, Lt = {
5862
+ }, yr = /^([^\:]+)\:(.*)/, qt = {
5760
5863
  scheme: "urn",
5761
5864
  parse: function(l, m) {
5762
- var R = l.path && l.path.match(hr), b = l;
5865
+ var R = l.path && l.path.match(yr), E = l;
5763
5866
  if (R) {
5764
- var q = m.scheme || b.scheme || "urn", U = R[1].toLowerCase(), J = R[2], Y = q + ":" + (m.nid || U), se = M[Y];
5765
- b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, m));
5867
+ var q = m.scheme || E.scheme || "urn", U = R[1].toLowerCase(), Q = R[2], Z = q + ":" + (m.nid || U), ne = M[Z];
5868
+ E.nid = U, E.nss = Q, E.path = void 0, ne && (E = ne.parse(E, m));
5766
5869
  } else
5767
- b.error = b.error || "URN can not be parsed.";
5768
- return b;
5870
+ E.error = E.error || "URN can not be parsed.";
5871
+ return E;
5769
5872
  },
5770
5873
  serialize: function(l, m) {
5771
- var R = m.scheme || l.scheme || "urn", b = l.nid, q = R + ":" + (m.nid || b), U = M[q];
5874
+ var R = m.scheme || l.scheme || "urn", E = l.nid, q = R + ":" + (m.nid || E), U = M[q];
5772
5875
  U && (l = U.serialize(l, m));
5773
- var J = l, Y = l.nss;
5774
- return J.path = (b || m.nid) + ":" + Y, J;
5876
+ var Q = l, Z = l.nss;
5877
+ return Q.path = (E || m.nid) + ":" + Z, Q;
5775
5878
  }
5776
- }, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
5879
+ }, $r = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
5777
5880
  scheme: "urn:uuid",
5778
5881
  parse: function(l, m) {
5779
5882
  var R = l;
5780
- return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(mr)) && (R.error = R.error || "UUID is not valid."), R;
5883
+ return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match($r)) && (R.error = R.error || "UUID is not valid."), R;
5781
5884
  },
5782
5885
  serialize: function(l, m) {
5783
5886
  var R = l;
5784
5887
  return R.nss = (l.uuid || "").toLowerCase(), R;
5785
5888
  }
5786
5889
  };
5787
- M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
5890
+ M[Oe.scheme] = Oe, M[jt.scheme] = jt, M[it.scheme] = it, M[Dt.scheme] = Dt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = He, 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, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, T = uri$1, C = (F, v) => new RegExp(F, v);
5918
+ const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, T = uri$1, C = (F, w) => new RegExp(F, w);
5816
5919
  C.code = "new RegExp";
5817
5920
  const S = ["removeAdditional", "useDefaults", "coerceTypes"], k = /* @__PURE__ */ new Set([
5818
5921
  "validate",
@@ -5850,71 +5953,71 @@ uri$1.default = uri;
5850
5953
  unicode: '"minLength"/"maxLength" account for unicode characters by default.'
5851
5954
  }, y = 200;
5852
5955
  function P(F) {
5853
- var v, j, E, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, xe, Ve, st, me, le, ze, it;
5854
- const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : C, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : T.default;
5956
+ var w, j, b, a, h, N, M, L, W, G, re, he, Le, Xe, et, de, tt, qe, Ue, xe, rt, me, le, He, nt;
5957
+ const Ce = F.strict, st = (w = F.code) === null || w === void 0 ? void 0 : w.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 : T.default;
5855
5958
  return {
5856
- strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
5857
- strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
5858
- strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
5859
- strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
5860
- strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
5861
- code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
5862
- loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : y,
5959
+ strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Ce) !== null && N !== void 0 ? N : !0,
5960
+ strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Ce) !== null && L !== void 0 ? L : !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 = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : 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 : y,
5863
5966
  loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : y,
5864
- meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
5865
- messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
5866
- inlineRefs: (xe = F.inlineRefs) !== null && xe !== void 0 ? xe : !0,
5867
- schemaId: (Ve = F.schemaId) !== null && Ve !== void 0 ? Ve : "$id",
5868
- addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
5967
+ meta: (tt = F.meta) !== null && tt !== void 0 ? tt : !0,
5968
+ messages: (qe = F.messages) !== null && qe !== void 0 ? qe : !0,
5969
+ inlineRefs: (Ue = F.inlineRefs) !== null && Ue !== void 0 ? Ue : !0,
5970
+ schemaId: (xe = F.schemaId) !== null && xe !== void 0 ? xe : "$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: (ze = F.unicodeRegExp) !== null && ze !== void 0 ? ze : !0,
5872
- int32range: (it = F.int32range) !== null && it !== void 0 ? it : !0,
5873
- uriResolver: Ne
5974
+ unicodeRegExp: (He = F.unicodeRegExp) !== null && He !== void 0 ? He : !0,
5975
+ int32range: (nt = F.int32range) !== null && nt !== void 0 ? nt : !0,
5976
+ uriResolver: Oe
5874
5977
  };
5875
5978
  }
5876
5979
  class I {
5877
- constructor(v = {}) {
5878
- this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
5879
- const { es5: j, lines: E } = this.opts.code;
5880
- this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines: E }), this.logger = K(v.logger);
5881
- const a = v.validateFormats;
5882
- v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, v, "NOT SUPPORTED"), D.call(this, g, v, "DEPRECATED", "warn"), this._metaOpts = z.call(this), v.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && x.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), O.call(this), v.validateFormats = a;
5980
+ constructor(w = {}) {
5981
+ this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), w = this.opts = { ...w, ...P(w) };
5982
+ const { es5: j, lines: b } = this.opts.code;
5983
+ this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines: b }), this.logger = J(w.logger);
5984
+ const a = w.validateFormats;
5985
+ w.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, w, "NOT SUPPORTED"), D.call(this, g, w, "DEPRECATED", "warn"), this._metaOpts = z.call(this), w.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), w.keywords && H.call(this, w.keywords), typeof w.meta == "object" && this.addMetaSchema(w.meta), O.call(this), w.validateFormats = a;
5883
5986
  }
5884
5987
  _addVocabularies() {
5885
5988
  this.addKeyword("$async");
5886
5989
  }
5887
5990
  _addDefaultMetaSchema() {
5888
- const { $data: v, meta: j, schemaId: E } = this.opts;
5991
+ const { $data: w, meta: j, schemaId: b } = this.opts;
5889
5992
  let a = _;
5890
- E === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[E], !1);
5993
+ b === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && w && this.addMetaSchema(a, a[b], !1);
5891
5994
  }
5892
5995
  defaultMeta() {
5893
- const { meta: v, schemaId: j } = this.opts;
5894
- return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
5895
- }
5896
- validate(v, j) {
5897
- let E;
5898
- if (typeof v == "string") {
5899
- if (E = this.getSchema(v), !E)
5900
- throw new Error(`no schema with key or ref "${v}"`);
5996
+ const { meta: w, schemaId: j } = this.opts;
5997
+ return this.opts.defaultMeta = typeof w == "object" ? w[j] || w : void 0;
5998
+ }
5999
+ validate(w, j) {
6000
+ let b;
6001
+ if (typeof w == "string") {
6002
+ if (b = this.getSchema(w), !b)
6003
+ throw new Error(`no schema with key or ref "${w}"`);
5901
6004
  } else
5902
- E = this.compile(v);
5903
- const a = E(j);
5904
- return "$async" in E || (this.errors = E.errors), a;
6005
+ b = this.compile(w);
6006
+ const a = b(j);
6007
+ return "$async" in b || (this.errors = b.errors), a;
5905
6008
  }
5906
- compile(v, j) {
5907
- const E = this._addSchema(v, j);
5908
- return E.validate || this._compileSchemaEnv(E);
6009
+ compile(w, j) {
6010
+ const b = this._addSchema(w, j);
6011
+ return b.validate || this._compileSchemaEnv(b);
5909
6012
  }
5910
- compileAsync(v, j) {
6013
+ compileAsync(w, j) {
5911
6014
  if (typeof this.opts.loadSchema != "function")
5912
6015
  throw new Error("options.loadSchema should be a function");
5913
- const { loadSchema: E } = this.opts;
5914
- return a.call(this, v, j);
5915
- async function a(G, ne) {
6016
+ const { loadSchema: b } = this.opts;
6017
+ return a.call(this, w, j);
6018
+ async function a(G, re) {
5916
6019
  await h.call(this, G.$schema);
5917
- const he = this._addSchema(G, ne);
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,61 +6026,61 @@ uri$1.default = uri;
5923
6026
  async function N(G) {
5924
6027
  try {
5925
6028
  return this._compileSchemaEnv(G);
5926
- } catch (ne) {
5927
- if (!(ne instanceof s.default))
5928
- throw ne;
5929
- return M.call(this, ne), await L.call(this, ne.missingSchema), N.call(this, G);
6029
+ } catch (re) {
6030
+ if (!(re instanceof s.default))
6031
+ throw re;
6032
+ return M.call(this, re), await L.call(this, re.missingSchema), N.call(this, G);
5930
6033
  }
5931
6034
  }
5932
- function M({ missingSchema: G, missingRef: ne }) {
6035
+ function M({ missingSchema: G, missingRef: re }) {
5933
6036
  if (this.refs[G])
5934
- throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
6037
+ throw new Error(`AnySchema ${G} is loaded but ${re} cannot be resolved`);
5935
6038
  }
5936
6039
  async function L(G) {
5937
- const ne = await W.call(this, G);
5938
- this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
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 ne = this._loading[G];
5942
- if (ne)
5943
- return ne;
6044
+ const re = this._loading[G];
6045
+ if (re)
6046
+ return re;
5944
6047
  try {
5945
- return await (this._loading[G] = E(G));
6048
+ return await (this._loading[G] = b(G));
5946
6049
  } finally {
5947
6050
  delete this._loading[G];
5948
6051
  }
5949
6052
  }
5950
6053
  }
5951
6054
  // Adds schema to the instance
5952
- addSchema(v, j, E, a = this.opts.validateSchema) {
5953
- if (Array.isArray(v)) {
5954
- for (const N of v)
5955
- this.addSchema(N, void 0, E, a);
6055
+ addSchema(w, j, b, a = this.opts.validateSchema) {
6056
+ if (Array.isArray(w)) {
6057
+ for (const N of w)
6058
+ this.addSchema(N, void 0, b, a);
5956
6059
  return this;
5957
6060
  }
5958
6061
  let h;
5959
- if (typeof v == "object") {
6062
+ if (typeof w == "object") {
5960
6063
  const { schemaId: N } = this.opts;
5961
- if (h = v[N], h !== void 0 && typeof h != "string")
6064
+ if (h = w[N], h !== void 0 && typeof h != "string")
5962
6065
  throw new Error(`schema ${N} must be string`);
5963
6066
  }
5964
- return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, E, j, a, !0), this;
6067
+ return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(w, b, j, a, !0), this;
5965
6068
  }
5966
6069
  // Add schema that will be used to validate other schemas
5967
6070
  // options in META_IGNORE_OPTIONS are alway set to false
5968
- addMetaSchema(v, j, E = this.opts.validateSchema) {
5969
- return this.addSchema(v, j, !0, E), this;
6071
+ addMetaSchema(w, j, b = this.opts.validateSchema) {
6072
+ return this.addSchema(w, j, !0, b), this;
5970
6073
  }
5971
6074
  // Validate schema against its meta-schema
5972
- validateSchema(v, j) {
5973
- if (typeof v == "boolean")
6075
+ validateSchema(w, j) {
6076
+ if (typeof w == "boolean")
5974
6077
  return !0;
5975
- let E;
5976
- if (E = v.$schema, E !== void 0 && typeof E != "string")
6078
+ let b;
6079
+ if (b = w.$schema, b !== void 0 && typeof b != "string")
5977
6080
  throw new Error("$schema must be a string");
5978
- if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
6081
+ if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
5979
6082
  return this.logger.warn("meta-schema not available"), this.errors = null, !0;
5980
- const a = this.validate(E, v);
6083
+ const a = this.validate(b, w);
5981
6084
  if (!a && j) {
5982
6085
  const h = "schema is invalid: " + this.errorsText();
5983
6086
  if (this.opts.validateSchema === "log")
@@ -5989,15 +6092,15 @@ uri$1.default = uri;
5989
6092
  }
5990
6093
  // Get compiled schema by `key` or `ref`.
5991
6094
  // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
5992
- getSchema(v) {
6095
+ getSchema(w) {
5993
6096
  let j;
5994
- for (; typeof (j = w.call(this, v)) == "string"; )
5995
- v = j;
6097
+ for (; typeof (j = v.call(this, w)) == "string"; )
6098
+ w = j;
5996
6099
  if (j === void 0) {
5997
- const { schemaId: E } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: E });
5998
- if (j = o.resolveSchema.call(this, a, v), !j)
6100
+ const { schemaId: b } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: b });
6101
+ if (j = o.resolveSchema.call(this, a, w), !j)
5999
6102
  return;
6000
- this.refs[v] = j;
6103
+ this.refs[w] = j;
6001
6104
  }
6002
6105
  return j.validate || this._compileSchemaEnv(j);
6003
6106
  }
@@ -6005,141 +6108,141 @@ uri$1.default = uri;
6005
6108
  // If no parameter is passed all schemas but meta-schemas are removed.
6006
6109
  // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
6007
6110
  // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
6008
- removeSchema(v) {
6009
- if (v instanceof RegExp)
6010
- return this._removeAllSchemas(this.schemas, v), this._removeAllSchemas(this.refs, v), this;
6011
- switch (typeof v) {
6111
+ removeSchema(w) {
6112
+ if (w instanceof RegExp)
6113
+ return this._removeAllSchemas(this.schemas, w), this._removeAllSchemas(this.refs, w), this;
6114
+ switch (typeof w) {
6012
6115
  case "undefined":
6013
6116
  return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
6014
6117
  case "string": {
6015
- const j = w.call(this, v);
6016
- return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[v], delete this.refs[v], this;
6118
+ const j = v.call(this, w);
6119
+ return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[w], delete this.refs[w], this;
6017
6120
  }
6018
6121
  case "object": {
6019
- const j = v;
6122
+ const j = w;
6020
6123
  this._cache.delete(j);
6021
- let E = v[this.opts.schemaId];
6022
- return E && (E = (0, d.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
6124
+ let b = w[this.opts.schemaId];
6125
+ return b && (b = (0, d.normalizeId)(b), delete this.schemas[b], delete this.refs[b]), this;
6023
6126
  }
6024
6127
  default:
6025
6128
  throw new Error("ajv.removeSchema: invalid parameter");
6026
6129
  }
6027
6130
  }
6028
6131
  // add "vocabulary" - a collection of keywords
6029
- addVocabulary(v) {
6030
- for (const j of v)
6132
+ addVocabulary(w) {
6133
+ for (const j of w)
6031
6134
  this.addKeyword(j);
6032
6135
  return this;
6033
6136
  }
6034
- addKeyword(v, j) {
6035
- let E;
6036
- if (typeof v == "string")
6037
- E = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
6038
- else if (typeof v == "object" && j === void 0) {
6039
- if (j = v, E = j.keyword, Array.isArray(E) && !E.length)
6137
+ addKeyword(w, j) {
6138
+ let b;
6139
+ if (typeof w == "string")
6140
+ b = w, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = b);
6141
+ else if (typeof w == "object" && j === void 0) {
6142
+ if (j = w, b = j.keyword, Array.isArray(b) && !b.length)
6040
6143
  throw new Error("addKeywords: keyword must be string or non-empty array");
6041
6144
  } else
6042
6145
  throw new Error("invalid addKeywords parameters");
6043
- if (oe.call(this, E, j), !j)
6044
- return (0, p.eachItem)(E, (h) => ke.call(this, h)), this;
6045
- Le.call(this, j);
6146
+ if (oe.call(this, b, j), !j)
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)(E, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
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
- getKeyword(v) {
6054
- const j = this.RULES.all[v];
6156
+ getKeyword(w) {
6157
+ const j = this.RULES.all[w];
6055
6158
  return typeof j == "object" ? j.definition : !!j;
6056
6159
  }
6057
6160
  // Remove keyword
6058
- removeKeyword(v) {
6161
+ removeKeyword(w) {
6059
6162
  const { RULES: j } = this;
6060
- delete j.keywords[v], delete j.all[v];
6061
- for (const E of j.rules) {
6062
- const a = E.rules.findIndex((h) => h.keyword === v);
6063
- a >= 0 && E.rules.splice(a, 1);
6163
+ delete j.keywords[w], delete j.all[w];
6164
+ for (const b of j.rules) {
6165
+ const a = b.rules.findIndex((h) => h.keyword === w);
6166
+ a >= 0 && b.rules.splice(a, 1);
6064
6167
  }
6065
6168
  return this;
6066
6169
  }
6067
6170
  // Add format
6068
- addFormat(v, j) {
6069
- return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
6171
+ addFormat(w, j) {
6172
+ return typeof j == "string" && (j = new RegExp(j)), this.formats[w] = j, this;
6070
6173
  }
6071
- errorsText(v = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
6072
- return !v || v.length === 0 ? "No errors" : v.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
6174
+ errorsText(w = this.errors, { separator: j = ", ", dataVar: b = "data" } = {}) {
6175
+ return !w || w.length === 0 ? "No errors" : w.map((a) => `${b}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
6073
6176
  }
6074
- $dataMetaSchema(v, j) {
6075
- const E = this.RULES.all;
6076
- v = JSON.parse(JSON.stringify(v));
6177
+ $dataMetaSchema(w, j) {
6178
+ const b = this.RULES.all;
6179
+ w = JSON.parse(JSON.stringify(w));
6077
6180
  for (const a of j) {
6078
6181
  const h = a.split("/").slice(1);
6079
- let N = v;
6182
+ let N = w;
6080
6183
  for (const M of h)
6081
6184
  N = N[M];
6082
- for (const M in E) {
6083
- const L = E[M];
6185
+ for (const M in b) {
6186
+ const L = b[M];
6084
6187
  if (typeof L != "object")
6085
6188
  continue;
6086
6189
  const { $data: W } = L.definition, G = N[M];
6087
- W && G && (N[M] = qe(G));
6190
+ W && G && (N[M] = Me(G));
6088
6191
  }
6089
6192
  }
6090
- return v;
6193
+ return w;
6091
6194
  }
6092
- _removeAllSchemas(v, j) {
6093
- for (const E in v) {
6094
- const a = v[E];
6095
- (!j || j.test(E)) && (typeof a == "string" ? delete v[E] : a && !a.meta && (this._cache.delete(a.schema), delete v[E]));
6195
+ _removeAllSchemas(w, j) {
6196
+ for (const b in w) {
6197
+ const a = w[b];
6198
+ (!j || j.test(b)) && (typeof a == "string" ? delete w[b] : a && !a.meta && (this._cache.delete(a.schema), delete w[b]));
6096
6199
  }
6097
6200
  }
6098
- _addSchema(v, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
6201
+ _addSchema(w, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
6099
6202
  let N;
6100
6203
  const { schemaId: M } = this.opts;
6101
- if (typeof v == "object")
6102
- N = v[M];
6204
+ if (typeof w == "object")
6205
+ N = w[M];
6103
6206
  else {
6104
6207
  if (this.opts.jtd)
6105
6208
  throw new Error("schema must be object");
6106
- if (typeof v != "boolean")
6209
+ if (typeof w != "boolean")
6107
6210
  throw new Error("schema must be object or boolean");
6108
6211
  }
6109
- let L = this._cache.get(v);
6212
+ let L = this._cache.get(w);
6110
6213
  if (L !== void 0)
6111
6214
  return L;
6112
- E = (0, d.normalizeId)(N || E);
6113
- const W = d.getSchemaRefs.call(this, v, E);
6114
- return L = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: E, localRefs: W }), this._cache.set(L.schema, L), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = L), a && this.validateSchema(v, !0), L;
6215
+ b = (0, d.normalizeId)(N || b);
6216
+ const W = d.getSchemaRefs.call(this, w, b);
6217
+ return L = new o.SchemaEnv({ schema: w, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(L.schema, L), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = L), a && this.validateSchema(w, !0), L;
6115
6218
  }
6116
- _checkUnique(v) {
6117
- if (this.schemas[v] || this.refs[v])
6118
- throw new Error(`schema with key or id "${v}" already exists`);
6219
+ _checkUnique(w) {
6220
+ if (this.schemas[w] || this.refs[w])
6221
+ throw new Error(`schema with key or id "${w}" already exists`);
6119
6222
  }
6120
- _compileSchemaEnv(v) {
6121
- if (v.meta ? this._compileMetaSchema(v) : o.compileSchema.call(this, v), !v.validate)
6223
+ _compileSchemaEnv(w) {
6224
+ if (w.meta ? this._compileMetaSchema(w) : o.compileSchema.call(this, w), !w.validate)
6122
6225
  throw new Error("ajv implementation error");
6123
- return v.validate;
6226
+ return w.validate;
6124
6227
  }
6125
- _compileMetaSchema(v) {
6228
+ _compileMetaSchema(w) {
6126
6229
  const j = this.opts;
6127
6230
  this.opts = this._metaOpts;
6128
6231
  try {
6129
- o.compileSchema.call(this, v);
6232
+ o.compileSchema.call(this, w);
6130
6233
  } finally {
6131
6234
  this.opts = j;
6132
6235
  }
6133
6236
  }
6134
6237
  }
6135
6238
  e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
6136
- function D(F, v, j, E = "error") {
6239
+ function D(F, w, j, b = "error") {
6137
6240
  for (const a in F) {
6138
6241
  const h = a;
6139
- h in v && this.logger[E](`${j}: option ${a}. ${F[h]}`);
6242
+ h in w && this.logger[b](`${j}: option ${a}. ${F[h]}`);
6140
6243
  }
6141
6244
  }
6142
- function w(F) {
6245
+ function v(F) {
6143
6246
  return F = (0, d.normalizeId)(F), this.schemas[F] || this.refs[F];
6144
6247
  }
6145
6248
  function O() {
@@ -6148,39 +6251,39 @@ uri$1.default = uri;
6148
6251
  if (Array.isArray(F))
6149
6252
  this.addSchema(F);
6150
6253
  else
6151
- for (const v in F)
6152
- this.addSchema(F[v], v);
6254
+ for (const w in F)
6255
+ this.addSchema(F[w], w);
6153
6256
  }
6154
6257
  function A() {
6155
6258
  for (const F in this.opts.formats) {
6156
- const v = this.opts.formats[F];
6157
- v && this.addFormat(F, v);
6259
+ const w = this.opts.formats[F];
6260
+ w && this.addFormat(F, w);
6158
6261
  }
6159
6262
  }
6160
- function x(F) {
6263
+ function H(F) {
6161
6264
  if (Array.isArray(F)) {
6162
6265
  this.addVocabulary(F);
6163
6266
  return;
6164
6267
  }
6165
6268
  this.logger.warn("keywords option as map is deprecated, pass array");
6166
- for (const v in F) {
6167
- const j = F[v];
6168
- j.keyword || (j.keyword = v), this.addKeyword(j);
6269
+ for (const w in F) {
6270
+ const j = F[w];
6271
+ j.keyword || (j.keyword = w), this.addKeyword(j);
6169
6272
  }
6170
6273
  }
6171
6274
  function z() {
6172
6275
  const F = { ...this.opts };
6173
- for (const v of S)
6174
- delete F[v];
6276
+ for (const w of S)
6277
+ delete F[w];
6175
6278
  return F;
6176
6279
  }
6177
- const re = { log() {
6280
+ const te = { log() {
6178
6281
  }, warn() {
6179
6282
  }, error() {
6180
6283
  } };
6181
- function K(F) {
6284
+ function J(F) {
6182
6285
  if (F === !1)
6183
- return re;
6286
+ return te;
6184
6287
  if (F === void 0)
6185
6288
  return console;
6186
6289
  if (F.log && F.warn && F.error)
@@ -6188,48 +6291,48 @@ uri$1.default = uri;
6188
6291
  throw new Error("logger must implement log, warn and error methods");
6189
6292
  }
6190
6293
  const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
6191
- function oe(F, v) {
6294
+ function oe(F, w) {
6192
6295
  const { RULES: j } = this;
6193
- if ((0, p.eachItem)(F, (E) => {
6194
- if (j.keywords[E])
6195
- throw new Error(`Keyword ${E} is already defined`);
6196
- if (!ue.test(E))
6197
- throw new Error(`Keyword ${E} has invalid name`);
6198
- }), !!v && v.$data && !("code" in v || "validate" in v))
6296
+ if ((0, p.eachItem)(F, (b) => {
6297
+ if (j.keywords[b])
6298
+ throw new Error(`Keyword ${b} is already defined`);
6299
+ if (!ue.test(b))
6300
+ throw new Error(`Keyword ${b} has invalid name`);
6301
+ }), !!w && w.$data && !("code" in w || "validate" in w))
6199
6302
  throw new Error('$data keyword must have "code" or "validate" function');
6200
6303
  }
6201
- function ke(F, v, j) {
6202
- var E;
6203
- const a = v == null ? void 0 : v.post;
6304
+ function Te(F, w, j) {
6305
+ var b;
6306
+ const a = w == null ? void 0 : w.post;
6204
6307
  if (j && a)
6205
6308
  throw new Error('keyword with "post" flag cannot have "type"');
6206
6309
  const { RULES: h } = this;
6207
6310
  let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
6208
- if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !v)
6311
+ if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !w)
6209
6312
  return;
6210
6313
  const M = {
6211
6314
  keyword: F,
6212
6315
  definition: {
6213
- ...v,
6214
- type: (0, u.getJSONTypes)(v.type),
6215
- schemaType: (0, u.getJSONTypes)(v.schemaType)
6316
+ ...w,
6317
+ type: (0, u.getJSONTypes)(w.type),
6318
+ schemaType: (0, u.getJSONTypes)(w.schemaType)
6216
6319
  }
6217
6320
  };
6218
- v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (E = v.implements) === null || E === void 0 || E.forEach((L) => this.addKeyword(L));
6321
+ w.before ? ke.call(this, N, M, w.before) : N.rules.push(M), h.all[F] = M, (b = w.implements) === null || b === void 0 || b.forEach((L) => this.addKeyword(L));
6219
6322
  }
6220
- function Ce(F, v, j) {
6221
- const E = F.rules.findIndex((a) => a.keyword === j);
6222
- E >= 0 ? F.rules.splice(E, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
6323
+ function ke(F, w, j) {
6324
+ const b = F.rules.findIndex((a) => a.keyword === j);
6325
+ b >= 0 ? F.rules.splice(b, 0, w) : (F.rules.push(w), this.logger.warn(`rule ${j} is not defined`));
6223
6326
  }
6224
- function Le(F) {
6225
- let { metaSchema: v } = F;
6226
- v !== void 0 && (F.$data && this.opts.$data && (v = qe(v)), F.validateSchema = this.compile(v, !0));
6327
+ function Fe(F) {
6328
+ let { metaSchema: w } = F;
6329
+ w !== void 0 && (F.$data && this.opts.$data && (w = Me(w)), F.validateSchema = this.compile(w, !0));
6227
6330
  }
6228
- const et = {
6331
+ const Ze = {
6229
6332
  $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
6230
6333
  };
6231
- function qe(F) {
6232
- return { anyOf: [F, et] };
6334
+ function Me(F) {
6335
+ return { anyOf: [F, Ze] };
6233
6336
  }
6234
6337
  })(core$2);
6235
6338
  var draft7 = {}, core$1 = {}, id = {};
@@ -7243,7 +7346,7 @@ const codegen_1$1 = codegen, error$1 = {
7243
7346
  }
7244
7347
  }
7245
7348
  function P(D) {
7246
- const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, O = r.scopeValue("formats", { key: i, ref: D, code: w });
7349
+ const v = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, O = r.scopeValue("formats", { key: i, ref: D, code: v });
7247
7350
  return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
7248
7351
  }
7249
7352
  function I() {
@@ -7334,10 +7437,10 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
7334
7437
  for (let I = 0; I < o.length; I++) {
7335
7438
  let D = o[I];
7336
7439
  D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
7337
- const w = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
7338
- if (typeof w != "object")
7440
+ const v = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
7441
+ if (typeof v != "object")
7339
7442
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
7340
- $ = $ && (k || g(D)), y(w, I);
7443
+ $ = $ && (k || g(D)), y(v, I);
7341
7444
  }
7342
7445
  if (!$)
7343
7446
  throw new Error(`discriminator: "${c}" must be required`);
@@ -7349,8 +7452,8 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
7349
7452
  if (I.const)
7350
7453
  P(I.const, D);
7351
7454
  else if (I.enum)
7352
- for (const w of I.enum)
7353
- P(w, D);
7455
+ for (const v of I.enum)
7456
+ P(v, D);
7354
7457
  else
7355
7458
  throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`);
7356
7459
  }
@@ -9251,7 +9354,7 @@ function compileBlueprint(e, {
9251
9354
  var _, T, C, S, k, $, g;
9252
9355
  e = {
9253
9356
  ...e,
9254
- steps: (e.steps || []).filter(isStepDefinition)
9357
+ steps: (e.steps || []).filter(isStepDefinition).filter(isStepStillSupported)
9255
9358
  };
9256
9359
  for (const y of e.steps)
9257
9360
  typeof y == "object" && y.step === "importFile" && (y.step = "importWxr", console.warn(
@@ -9364,14 +9467,14 @@ function compileBlueprint(e, {
9364
9467
  I.setPlayground(y), 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(y);
9368
- n(w, D);
9369
- } catch (w) {
9370
- throw console.error(w), new Error(
9470
+ const v = await I(y);
9471
+ n(v, D);
9472
+ } catch (v) {
9473
+ throw console.error(v), new Error(
9371
9474
  `Error when executing the blueprint step #${P} (${JSON.stringify(
9372
9475
  D
9373
- )}) ${w instanceof Error ? `: ${w.message}` : w}`,
9374
- { cause: w }
9476
+ )}) ${v instanceof Error ? `: ${v.message}` : v}`,
9477
+ { cause: v }
9375
9478
  );
9376
9479
  }
9377
9480
  } finally {
@@ -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,
@@ -9797,7 +9905,7 @@ function proxyClone(e) {
9797
9905
  }
9798
9906
  class Logger extends EventTarget {
9799
9907
  constructor(t) {
9800
- super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
9908
+ super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.context = {}, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
9801
9909
  }
9802
9910
  /**
9803
9911
  * Read the WordPress debug.log file and return its content.
@@ -9842,6 +9950,18 @@ class Logger extends EventTarget {
9842
9950
  this.logUnhandledRejection.bind(this)
9843
9951
  ), this.windowConnected = !0);
9844
9952
  }
9953
+ /**
9954
+ * Register a listener for service worker messages and log the data.
9955
+ * The service worker will send the number of open Playground tabs.
9956
+ */
9957
+ addServiceWorkerMessageListener() {
9958
+ navigator.serviceWorker.addEventListener("message", (t) => {
9959
+ var r;
9960
+ ((r = t.data) == null ? void 0 : r.numberOfOpenPlaygroundTabs) !== void 0 && this.addContext({
9961
+ numberOfOpenPlaygroundTabs: t.data.numberOfOpenPlaygroundTabs
9962
+ });
9963
+ });
9964
+ }
9845
9965
  /**
9846
9966
  * Register a listener for the request.end event and log the data.
9847
9967
  * @param UniversalPHP playground instance
@@ -9923,7 +10043,19 @@ class Logger extends EventTarget {
9923
10043
  * @returns string[]
9924
10044
  */
9925
10045
  getLogs() {
9926
- return this.logs;
10046
+ return [...this.logs];
10047
+ }
10048
+ /**
10049
+ * Add context data.
10050
+ */
10051
+ addContext(t) {
10052
+ this.context = { ...this.context, ...t };
10053
+ }
10054
+ /**
10055
+ * Get context data.
10056
+ */
10057
+ getContext() {
10058
+ return { ...this.context };
9927
10059
  }
9928
10060
  }
9929
10061
  const logger = new Logger();
@@ -10048,7 +10180,6 @@ export {
10048
10180
  runPHPWithOptions,
10049
10181
  runSql,
10050
10182
  runWpInstallationWizard,
10051
- setPhpIniEntry,
10052
10183
  setPluginProxyURL,
10053
10184
  setSiteOptions,
10054
10185
  startPlaygroundWeb,