@wp-playground/client 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__vite-browser-external-2447137e.js +4 -0
- package/__vite-browser-external-b3701507.cjs +1 -0
- package/index.cjs +41 -385
- package/index.d.ts +3 -18
- package/index.js +1021 -1533
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var Nt = (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)),
|
|
5
|
+
var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Z = (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);
|
|
@@ -67,6 +67,9 @@ if (typeof CustomEvent > "u") {
|
|
|
67
67
|
}
|
|
68
68
|
globalThis.CustomEvent = e;
|
|
69
69
|
}
|
|
70
|
+
typeof crypto > "u" && import("./__vite-browser-external-2447137e.js").then((e) => {
|
|
71
|
+
global.crypto = e;
|
|
72
|
+
});
|
|
70
73
|
const wpContentFilesExcludedFromExport = [
|
|
71
74
|
"db.php",
|
|
72
75
|
"plugins/akismet",
|
|
@@ -267,6 +270,47 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
267
270
|
switch_theme( ${phpVar(t)} );
|
|
268
271
|
`
|
|
269
272
|
});
|
|
273
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
274
|
+
await e.unlink(t);
|
|
275
|
+
}, runSql = async (e, { sql: t }, r) => {
|
|
276
|
+
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
277
|
+
const n = `/tmp/${crypto.randomUUID()}.sql`;
|
|
278
|
+
await e.writeFile(
|
|
279
|
+
n,
|
|
280
|
+
new Uint8Array(await t.arrayBuffer())
|
|
281
|
+
);
|
|
282
|
+
const s = await e.documentRoot, o = phpVars({ docroot: s, sqlFilename: n }), i = await e.run({
|
|
283
|
+
code: `<?php
|
|
284
|
+
require_once ${o.docroot} . '/wp-load.php';
|
|
285
|
+
|
|
286
|
+
$handle = fopen(${o.sqlFilename}, 'r');
|
|
287
|
+
$buffer = '';
|
|
288
|
+
|
|
289
|
+
global $wpdb;
|
|
290
|
+
|
|
291
|
+
while ($bytes = fgets($handle)) {
|
|
292
|
+
$buffer .= $bytes;
|
|
293
|
+
|
|
294
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
295
|
+
") {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
$wpdb->query($buffer);
|
|
300
|
+
$buffer = '';
|
|
301
|
+
}
|
|
302
|
+
`
|
|
303
|
+
});
|
|
304
|
+
return await rm(e, { path: n }), i;
|
|
305
|
+
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
306
|
+
await e.setPhpIniEntry(t, r);
|
|
307
|
+
}, request = async (e, { request: t }) => {
|
|
308
|
+
const r = await e.request(t);
|
|
309
|
+
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
310
|
+
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
311
|
+
`Request failed with status ${r.httpStatusCode}`
|
|
312
|
+
);
|
|
313
|
+
return r;
|
|
270
314
|
}, rewriteWpConfigToDefineConstants = `<?php
|
|
271
315
|
|
|
272
316
|
/**
|
|
@@ -635,522 +679,7 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
635
679
|
`
|
|
636
680
|
}), await e.readFileAsText("/tmp/code.php");
|
|
637
681
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* This transport delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
642
|
-
*
|
|
643
|
-
* This file isn't actually used. It's just here for reference and development. The actual
|
|
644
|
-
* PHP code used in WordPress is hardcoded copy residing in wordpress.mjs in the _patchWordPressCode
|
|
645
|
-
* function.
|
|
646
|
-
*
|
|
647
|
-
* The reason for calling it Wp_Http_Fetch and not something more natural like
|
|
648
|
-
* Requests_Transport_Fetch is the _get_first_available_transport(). It checks for
|
|
649
|
-
* a class named "Wp_Http_" . $transport_name – which means we must adhere to this
|
|
650
|
-
* hardcoded pattern.
|
|
651
|
-
*/
|
|
652
|
-
class Wp_Http_Fetch_Base
|
|
653
|
-
{
|
|
654
|
-
public $headers = '';
|
|
655
|
-
|
|
656
|
-
public function __construct()
|
|
657
|
-
{
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
public function __destruct()
|
|
661
|
-
{
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
666
|
-
*
|
|
667
|
-
* @TODO Implement handling for more $options such as cookies, filename, auth, etc.
|
|
668
|
-
*
|
|
669
|
-
* @param $url
|
|
670
|
-
* @param $headers
|
|
671
|
-
* @param $data
|
|
672
|
-
* @param $options
|
|
673
|
-
*
|
|
674
|
-
* @return false|string
|
|
675
|
-
*/
|
|
676
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
677
|
-
{
|
|
678
|
-
// Disable wp-cron requests that are extremely slow in node.js runtime environment.
|
|
679
|
-
// @TODO: Make wp-cron requests faster.
|
|
680
|
-
if (str_contains($url, '/wp-cron.php')) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
if (!empty($data)) {
|
|
685
|
-
$data_format = $options['data_format'];
|
|
686
|
-
if ($data_format === 'query') {
|
|
687
|
-
$url = self::format_get($url, $data);
|
|
688
|
-
$data = '';
|
|
689
|
-
} elseif (!is_string($data)) {
|
|
690
|
-
$data = http_build_query($data, null, '&');
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
$request = json_encode(
|
|
695
|
-
array(
|
|
696
|
-
'type' => 'request',
|
|
697
|
-
'data' => [
|
|
698
|
-
'headers' => $headers,
|
|
699
|
-
'data' => $data,
|
|
700
|
-
'url' => $url,
|
|
701
|
-
'method' => $options['type'],
|
|
702
|
-
]
|
|
703
|
-
)
|
|
704
|
-
);
|
|
705
|
-
|
|
706
|
-
$this->headers = post_message_to_js($request);
|
|
707
|
-
|
|
708
|
-
// Store a file if the request specifies it.
|
|
709
|
-
// Are we sure that \`$this->headers\` includes the body of the response?
|
|
710
|
-
$before_response_body = strpos($this->headers, "\\r\\n\\r\\n");
|
|
711
|
-
if (isset($options['filename']) && $options['filename'] && false !== $before_response_body) {
|
|
712
|
-
$response_body = substr($this->headers, $before_response_body + 4);
|
|
713
|
-
$this->headers = substr($this->headers, 0, $before_response_body);
|
|
714
|
-
file_put_contents($options['filename'], $response_body);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
return $this->headers;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
public function request_multiple($requests, $options)
|
|
721
|
-
{
|
|
722
|
-
$responses = array();
|
|
723
|
-
$class = get_class($this);
|
|
724
|
-
foreach ($requests as $id => $request) {
|
|
725
|
-
try {
|
|
726
|
-
$handler = new $class();
|
|
727
|
-
$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
|
|
728
|
-
$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
|
|
729
|
-
} catch (Requests_Exception $e) {
|
|
730
|
-
$responses[$id] = $e;
|
|
731
|
-
}
|
|
732
|
-
if (!is_string($responses[$id])) {
|
|
733
|
-
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return $responses;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
protected static function format_get($url, $data)
|
|
741
|
-
{
|
|
742
|
-
if (!empty($data)) {
|
|
743
|
-
$query = '';
|
|
744
|
-
$url_parts = parse_url($url);
|
|
745
|
-
if (empty($url_parts['query'])) {
|
|
746
|
-
$url_parts['query'] = '';
|
|
747
|
-
} else {
|
|
748
|
-
$query = $url_parts['query'];
|
|
749
|
-
}
|
|
750
|
-
$query .= '&' . http_build_query($data, null, '&');
|
|
751
|
-
$query = trim($query, '&');
|
|
752
|
-
if (empty($url_parts['query'])) {
|
|
753
|
-
$url .= '?' . $query;
|
|
754
|
-
} else {
|
|
755
|
-
$url = str_replace($url_parts['query'], $query, $url);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
return $url;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
public static function test($capabilities = array())
|
|
763
|
-
{
|
|
764
|
-
if (!function_exists('post_message_to_js')) {
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return true;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
773
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements \\WpOrg\\Requests\\Transport
|
|
774
|
-
{
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
} else {
|
|
778
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements Requests_Transport
|
|
779
|
-
{
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
`, transportDummy = `<?php
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* This transport does not perform any HTTP requests and only exists
|
|
787
|
-
* to prevent the Requests class from complaining about not having any
|
|
788
|
-
* transports.
|
|
789
|
-
*/
|
|
790
|
-
class Requests_Transport_Dummy_Base
|
|
791
|
-
{
|
|
792
|
-
public $headers = '';
|
|
793
|
-
|
|
794
|
-
public function __construct()
|
|
795
|
-
{
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
public function __destruct()
|
|
799
|
-
{
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
803
|
-
{
|
|
804
|
-
return false;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
public function request_multiple($requests, $options)
|
|
808
|
-
{
|
|
809
|
-
$responses = array();
|
|
810
|
-
foreach ($requests as $id => $request) {
|
|
811
|
-
$responses[] = false;
|
|
812
|
-
}
|
|
813
|
-
return $responses;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
protected static function format_get($url, $data)
|
|
817
|
-
{
|
|
818
|
-
return $url;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
public static function test($capabilities = array())
|
|
822
|
-
{
|
|
823
|
-
return true;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
828
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements \\WpOrg\\Requests\\Transport
|
|
829
|
-
{
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
} else {
|
|
833
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements Requests_Transport
|
|
834
|
-
{
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
`, playgroundMuPlugin = `<?php
|
|
839
|
-
/**
|
|
840
|
-
* Add a notice to wp-login.php offering the username and password.
|
|
841
|
-
*/
|
|
842
|
-
add_action(
|
|
843
|
-
'login_message',
|
|
844
|
-
function () {
|
|
845
|
-
return <<<EOT
|
|
846
|
-
<div class="message info">
|
|
847
|
-
<strong>username:</strong> <code>admin</code><br><strong>password</strong>: <code>password</code>
|
|
848
|
-
</div>
|
|
849
|
-
EOT;
|
|
850
|
-
}
|
|
851
|
-
);
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* Because the in-browser Playground doesn't have access to the internet,
|
|
855
|
-
* network-dependent features like directories don't work. Normally, you'll
|
|
856
|
-
* see a confusing message like "An unexpected error occurred." This mu-plugin
|
|
857
|
-
* makes it more clear that the feature is not yet supported.
|
|
858
|
-
*
|
|
859
|
-
* https://github.com/WordPress/wordpress-playground/issues/498
|
|
860
|
-
*
|
|
861
|
-
* Added styling to hide the Popular tags section of the Plugins page
|
|
862
|
-
* and the nonfunctional Try Again button (both Plugins and Themes) that's
|
|
863
|
-
* appended when the message is displayed.
|
|
864
|
-
*
|
|
865
|
-
* https://github.com/WordPress/wordpress-playground/issues/927
|
|
866
|
-
*
|
|
867
|
-
*/
|
|
868
|
-
|
|
869
|
-
add_action('admin_head', function () {
|
|
870
|
-
echo '<style>
|
|
871
|
-
:is(.plugins-popular-tags-wrapper:has(div.networking_err_msg),
|
|
872
|
-
button.button.try-again) {
|
|
873
|
-
display: none;
|
|
874
|
-
}
|
|
875
|
-
</style>';
|
|
876
|
-
});
|
|
877
|
-
|
|
878
|
-
add_action('init', 'networking_disabled');
|
|
879
|
-
function networking_disabled() {
|
|
880
|
-
$networking_err_msg = '<div class="networking_err_msg">Network access is an <a href="https://github.com/WordPress/wordpress-playground/issues/85">experimental, opt-in feature</a>, which means you need to enable it to allow Playground to access the Plugins/Themes directories.
|
|
881
|
-
<p>There are two alternative methods to enable global networking support:</p>
|
|
882
|
-
<ol>
|
|
883
|
-
<li>Using the <a href="https://wordpress.github.io/wordpress-playground/query-api">Query API</a>: for example, https://playground.wordpress.net/<em>?networking=yes</em>; <strong>or</strong>
|
|
884
|
-
<li> Using the <a href="https://wordpress.github.io/wordpress-playground/blueprints-api/data-format/#features">Blueprint API</a>: add <code>"features": { "networking": true }</code> to the JSON file.
|
|
885
|
-
</li></ol>
|
|
886
|
-
<p>
|
|
887
|
-
When browsing Playground as a standalone instance, you can enable networking via the settings panel: select the option "Network access (e.g. for browsing plugins)" and hit the "Apply changes" button.<p>
|
|
888
|
-
<strong>Please note:</strong> This option is hidden when browsing Playground as an embedded iframe.</p></div>';
|
|
889
|
-
return $networking_err_msg;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
add_filter('plugins_api_result', function ($res) {
|
|
893
|
-
if ($res instanceof WP_Error) {
|
|
894
|
-
$res = new WP_Error(
|
|
895
|
-
'plugins_api_failed',
|
|
896
|
-
networking_disabled()
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
return $res;
|
|
900
|
-
});
|
|
901
|
-
|
|
902
|
-
add_filter('gettext', function ($translation) {
|
|
903
|
-
if( $GLOBALS['pagenow'] === 'theme-install.php') {
|
|
904
|
-
if ($translation === 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.') {
|
|
905
|
-
return networking_disabled();
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return $translation;
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* Links with target="top" don't work in the playground iframe because of
|
|
913
|
-
* the sandbox attribute. What they really should be targeting is the
|
|
914
|
-
* playground iframe itself (name="playground"). This mu-plugin rewrites
|
|
915
|
-
* all target="_top" links to target="playground" instead.
|
|
916
|
-
*
|
|
917
|
-
* https://github.com/WordPress/wordpress-playground/issues/266
|
|
918
|
-
*/
|
|
919
|
-
add_action('admin_print_scripts', function () {
|
|
920
|
-
?>
|
|
921
|
-
<script>
|
|
922
|
-
document.addEventListener('click', function (event) {
|
|
923
|
-
if (event.target.tagName === 'A' && ['_parent', '_top'].includes(event.target.target)) {
|
|
924
|
-
event.target.target = 'wordpress-playground';
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
<\/script>
|
|
928
|
-
<?php
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Supports URL rewriting to remove \`index.php\` from permalinks.
|
|
933
|
-
*/
|
|
934
|
-
add_filter('got_url_rewrite', '__return_true');
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* The default WordPress requests transports have been disabled
|
|
938
|
-
* at this point. However, the Requests class requires at least
|
|
939
|
-
* one working transport or else it throws warnings and acts up.
|
|
940
|
-
*
|
|
941
|
-
* This mu-plugin provides that transport. It's one of the two:
|
|
942
|
-
*
|
|
943
|
-
* * WP_Http_Fetch – Sends requests using browser's fetch() function.
|
|
944
|
-
* Only enabled when PHP was compiled with the VRZNO
|
|
945
|
-
* extension.
|
|
946
|
-
* * Requests_Transport_Dummy – Does not send any requests and only exists to keep
|
|
947
|
-
* the Requests class happy.
|
|
948
|
-
*/
|
|
949
|
-
$__requests_class = class_exists( '\\WpOrg\\Requests\\Requests' ) ? '\\WpOrg\\Requests\\Requests' : 'Requests';
|
|
950
|
-
if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
951
|
-
require(__DIR__ . '/playground-includes/wp_http_fetch.php');
|
|
952
|
-
$__requests_class::add_transport('WP_Http_Fetch');
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Add Fetch transport to the list of transports that WordPress
|
|
956
|
-
* will test for in the _get_first_available_transport() function.
|
|
957
|
-
*/
|
|
958
|
-
add_filter('http_api_transports', function ($transports) {
|
|
959
|
-
$transports[] = 'Fetch';
|
|
960
|
-
return $transports;
|
|
961
|
-
});
|
|
962
|
-
/**
|
|
963
|
-
* Disable signature verification as it doesn't seem to work with
|
|
964
|
-
* fetch requests:
|
|
965
|
-
*
|
|
966
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip returns no signature header.
|
|
967
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip.sig returns 404.
|
|
968
|
-
*
|
|
969
|
-
* @TODO Investigate why.
|
|
970
|
-
*/
|
|
971
|
-
add_filter('wp_signature_hosts', function ($hosts) {
|
|
972
|
-
return [];
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
add_filter('http_request_host_is_external', function ($arg) {
|
|
976
|
-
return true;
|
|
977
|
-
});
|
|
978
|
-
} else {
|
|
979
|
-
require(__DIR__ . '/playground-includes/requests_transport_dummy.php');
|
|
980
|
-
$__requests_class::add_transport('Requests_Transport_Dummy');
|
|
981
|
-
}
|
|
982
|
-
`;
|
|
983
|
-
async function updateFile(e, t, r) {
|
|
984
|
-
let n = "";
|
|
985
|
-
await e.fileExists(t) && (n = await e.readFileAsText(t)), await e.writeFile(t, r(n));
|
|
986
|
-
}
|
|
987
|
-
const applyWordPressPatches = async (e, t) => {
|
|
988
|
-
const r = new WordPressPatcher(
|
|
989
|
-
e,
|
|
990
|
-
t.wordpressPath || "/wordpress",
|
|
991
|
-
t.siteUrl
|
|
992
|
-
);
|
|
993
|
-
t.addPhpInfo === !0 && await r.addPhpInfo(), t.siteUrl && await r.patchSiteUrl(), t.patchSecrets === !0 && await r.patchSecrets(), t.disableSiteHealth === !0 && await r.disableSiteHealth(), t.disableWpNewBlogNotification === !0 && await r.disableWpNewBlogNotification(), t.prepareForRunningInsideWebBrowser === !0 && await r.prepareForRunningInsideWebBrowser(), t.addFetchNetworkTransport === !0 && await r.addFetchNetworkTransport();
|
|
994
|
-
};
|
|
995
|
-
class WordPressPatcher {
|
|
996
|
-
constructor(t, r, n) {
|
|
997
|
-
this.php = t, this.scopedSiteUrl = n, this.wordpressPath = r;
|
|
998
|
-
}
|
|
999
|
-
async addPhpInfo() {
|
|
1000
|
-
await this.php.writeFile(
|
|
1001
|
-
joinPaths(this.wordpressPath, "phpinfo.php"),
|
|
1002
|
-
"<?php phpinfo(); "
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
async patchSiteUrl() {
|
|
1006
|
-
await defineWpConfigConsts(this.php, {
|
|
1007
|
-
consts: {
|
|
1008
|
-
WP_HOME: this.scopedSiteUrl,
|
|
1009
|
-
WP_SITEURL: this.scopedSiteUrl
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
async patchSecrets() {
|
|
1014
|
-
await defineWpConfigConsts(this.php, {
|
|
1015
|
-
consts: {
|
|
1016
|
-
AUTH_KEY: randomString(40),
|
|
1017
|
-
SECURE_AUTH_KEY: randomString(40),
|
|
1018
|
-
LOGGED_IN_KEY: randomString(40),
|
|
1019
|
-
NONCE_KEY: randomString(40),
|
|
1020
|
-
AUTH_SALT: randomString(40),
|
|
1021
|
-
SECURE_AUTH_SALT: randomString(40),
|
|
1022
|
-
LOGGED_IN_SALT: randomString(40),
|
|
1023
|
-
NONCE_SALT: randomString(40)
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
async disableSiteHealth() {
|
|
1028
|
-
await updateFile(
|
|
1029
|
-
this.php,
|
|
1030
|
-
joinPaths(this.wordpressPath, "wp-includes/default-filters.php"),
|
|
1031
|
-
(t) => t.replace(
|
|
1032
|
-
/add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;/i,
|
|
1033
|
-
""
|
|
1034
|
-
)
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
|
-
async disableWpNewBlogNotification() {
|
|
1038
|
-
await updateFile(
|
|
1039
|
-
this.php,
|
|
1040
|
-
joinPaths(this.wordpressPath, "wp-config.php"),
|
|
1041
|
-
// The original version of this function crashes WASM PHP, let's define an empty one instead.
|
|
1042
|
-
(t) => `${t} function wp_new_blog_notification(...$args){} `
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
async prepareForRunningInsideWebBrowser() {
|
|
1046
|
-
await this.php.mkdir(
|
|
1047
|
-
joinPaths(this.wordpressPath, "wp-content/mu-plugins")
|
|
1048
|
-
), await this.php.writeFile(
|
|
1049
|
-
joinPaths(
|
|
1050
|
-
this.wordpressPath,
|
|
1051
|
-
"/wp-content/mu-plugins/0-playground.php"
|
|
1052
|
-
),
|
|
1053
|
-
playgroundMuPlugin
|
|
1054
|
-
), await this.php.mkdir(
|
|
1055
|
-
joinPaths(
|
|
1056
|
-
this.wordpressPath,
|
|
1057
|
-
"/wp-content/mu-plugins/playground-includes"
|
|
1058
|
-
)
|
|
1059
|
-
), await this.php.writeFile(
|
|
1060
|
-
joinPaths(
|
|
1061
|
-
this.wordpressPath,
|
|
1062
|
-
"/wp-content/mu-plugins/playground-includes/requests_transport_dummy.php"
|
|
1063
|
-
),
|
|
1064
|
-
transportDummy
|
|
1065
|
-
);
|
|
1066
|
-
}
|
|
1067
|
-
async addFetchNetworkTransport() {
|
|
1068
|
-
await defineWpConfigConsts(this.php, {
|
|
1069
|
-
consts: {
|
|
1070
|
-
USE_FETCH_FOR_REQUESTS: !0
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
const t = [
|
|
1074
|
-
joinPaths(
|
|
1075
|
-
this.wordpressPath,
|
|
1076
|
-
"/wp-includes/Requests/Transport/fsockopen.php"
|
|
1077
|
-
),
|
|
1078
|
-
joinPaths(
|
|
1079
|
-
this.wordpressPath,
|
|
1080
|
-
"/wp-includes/Requests/Transport/cURL.php"
|
|
1081
|
-
),
|
|
1082
|
-
joinPaths(
|
|
1083
|
-
this.wordpressPath,
|
|
1084
|
-
"/wp-includes/Requests/src/Transport/Fsockopen.php"
|
|
1085
|
-
),
|
|
1086
|
-
joinPaths(
|
|
1087
|
-
this.wordpressPath,
|
|
1088
|
-
"/wp-includes/Requests/src/Transport/Curl.php"
|
|
1089
|
-
)
|
|
1090
|
-
];
|
|
1091
|
-
for (const r of t)
|
|
1092
|
-
await this.php.fileExists(r) && await updateFile(this.php, r, (n) => n.includes("public static function test2") ? n : n.replace(
|
|
1093
|
-
"public static function test",
|
|
1094
|
-
"public static function test( $capabilities = array() ) { return false; } public static function test2"
|
|
1095
|
-
));
|
|
1096
|
-
await this.php.writeFile(
|
|
1097
|
-
joinPaths(
|
|
1098
|
-
this.wordpressPath,
|
|
1099
|
-
"wp-content/mu-plugins/playground-includes/wp_http_fetch.php"
|
|
1100
|
-
),
|
|
1101
|
-
transportFetch
|
|
1102
|
-
), await this.php.mkdir(`${this.wordpressPath}/wp-content/fonts`);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
function randomString(e) {
|
|
1106
|
-
const t = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-[]/.,<>?";
|
|
1107
|
-
let r = "";
|
|
1108
|
-
for (let n = e; n > 0; --n)
|
|
1109
|
-
r += t[Math.floor(Math.random() * t.length)];
|
|
1110
|
-
return r;
|
|
1111
|
-
}
|
|
1112
|
-
const runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
1113
|
-
await e.unlink(t);
|
|
1114
|
-
}, runSql = async (e, { sql: t }, r) => {
|
|
1115
|
-
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
1116
|
-
const n = `/tmp/${crypto.randomUUID()}.sql`;
|
|
1117
|
-
await e.writeFile(
|
|
1118
|
-
n,
|
|
1119
|
-
new Uint8Array(await t.arrayBuffer())
|
|
1120
|
-
);
|
|
1121
|
-
const s = await e.documentRoot, o = phpVars({ docroot: s, sqlFilename: n }), i = await e.run({
|
|
1122
|
-
code: `<?php
|
|
1123
|
-
require_once ${o.docroot} . '/wp-load.php';
|
|
1124
|
-
|
|
1125
|
-
$handle = fopen(${o.sqlFilename}, 'r');
|
|
1126
|
-
$buffer = '';
|
|
1127
|
-
|
|
1128
|
-
global $wpdb;
|
|
1129
|
-
|
|
1130
|
-
while ($bytes = fgets($handle)) {
|
|
1131
|
-
$buffer .= $bytes;
|
|
1132
|
-
|
|
1133
|
-
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
1134
|
-
") {
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
$wpdb->query($buffer);
|
|
1139
|
-
$buffer = '';
|
|
1140
|
-
}
|
|
1141
|
-
`
|
|
1142
|
-
});
|
|
1143
|
-
return await rm(e, { path: n }), i;
|
|
1144
|
-
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
1145
|
-
await e.setPhpIniEntry(t, r);
|
|
1146
|
-
}, request = async (e, { request: t }) => {
|
|
1147
|
-
const r = await e.request(t);
|
|
1148
|
-
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
1149
|
-
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
1150
|
-
`Request failed with status ${r.httpStatusCode}`
|
|
1151
|
-
);
|
|
1152
|
-
return r;
|
|
1153
|
-
}, login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
682
|
+
const login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
1154
683
|
var o, i, l;
|
|
1155
684
|
n == null || n.tracker.setCaption((n == null ? void 0 : n.initialCaption) || "Logging in"), await e.request({
|
|
1156
685
|
url: "/wp-login.php"
|
|
@@ -1204,7 +733,7 @@ function getURLScope(e) {
|
|
|
1204
733
|
return isURLScoped(e) ? e.pathname.split("/")[1].split(":")[1] : null;
|
|
1205
734
|
}
|
|
1206
735
|
const enableMultisite = async (e) => {
|
|
1207
|
-
var
|
|
736
|
+
var v;
|
|
1208
737
|
await defineWpConfigConsts(e, {
|
|
1209
738
|
consts: {
|
|
1210
739
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -1212,8 +741,8 @@ const enableMultisite = async (e) => {
|
|
|
1212
741
|
});
|
|
1213
742
|
const t = new URL(await e.absoluteUrl);
|
|
1214
743
|
if (t.port !== "") {
|
|
1215
|
-
let
|
|
1216
|
-
throw t.hostname === "localhost" && (
|
|
744
|
+
let w = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
745
|
+
throw t.hostname === "localhost" && (w += " For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."), new Error(w);
|
|
1217
746
|
}
|
|
1218
747
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
1219
748
|
await setSiteOptions(e, {
|
|
@@ -1253,13 +782,13 @@ foreach($plugins as $plugin_path) {
|
|
|
1253
782
|
}
|
|
1254
783
|
echo json_encode($deactivated_plugins);
|
|
1255
784
|
`
|
|
1256
|
-
})).json, p = (
|
|
785
|
+
})).json, p = (v = (await request(e, {
|
|
1257
786
|
request: {
|
|
1258
787
|
url: "/wp-admin/network.php"
|
|
1259
788
|
}
|
|
1260
789
|
})).text.match(
|
|
1261
790
|
/name="_wpnonce"\s+value="([^"]+)"/
|
|
1262
|
-
)) == null ? void 0 :
|
|
791
|
+
)) == null ? void 0 : v[1], d = await request(e, {
|
|
1263
792
|
request: {
|
|
1264
793
|
url: "/wp-admin/network.php",
|
|
1265
794
|
method: "POST",
|
|
@@ -1294,23 +823,23 @@ echo json_encode($deactivated_plugins);
|
|
|
1294
823
|
PATH_CURRENT_SITE: r
|
|
1295
824
|
}
|
|
1296
825
|
});
|
|
1297
|
-
const u = new URL(await e.absoluteUrl),
|
|
826
|
+
const u = new URL(await e.absoluteUrl), _ = isURLScoped(u) ? "scope:" + getURLScope(u) : null;
|
|
1298
827
|
await e.writeFile(
|
|
1299
828
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
1300
829
|
`<?php
|
|
1301
830
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
1302
831
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1303
832
|
}
|
|
1304
|
-
$folder = ${phpVar(
|
|
833
|
+
$folder = ${phpVar(_)};
|
|
1305
834
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
1306
835
|
$_SERVER['HTTP_HOST'] = ${phpVar(u.hostname)};
|
|
1307
836
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
1308
837
|
}
|
|
1309
838
|
`
|
|
1310
839
|
), await login(e, {});
|
|
1311
|
-
for (const
|
|
840
|
+
for (const w of i)
|
|
1312
841
|
await activatePlugin(e, {
|
|
1313
|
-
pluginPath:
|
|
842
|
+
pluginPath: w
|
|
1314
843
|
});
|
|
1315
844
|
};
|
|
1316
845
|
function jsonToUrlEncoded(e) {
|
|
@@ -1494,13 +1023,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1494
1023
|
}), s = joinPaths(s, r);
|
|
1495
1024
|
const o = joinPaths(s, "wp-content"), i = joinPaths(n, "wp-content");
|
|
1496
1025
|
for (const u of wpContentFilesExcludedFromExport) {
|
|
1497
|
-
const
|
|
1026
|
+
const _ = joinPaths(
|
|
1498
1027
|
o,
|
|
1499
1028
|
u
|
|
1500
1029
|
);
|
|
1501
|
-
await removePath(e,
|
|
1502
|
-
const
|
|
1503
|
-
await e.fileExists(
|
|
1030
|
+
await removePath(e, _);
|
|
1031
|
+
const v = joinPaths(i, u);
|
|
1032
|
+
await e.fileExists(v) && (await e.mkdir(dirname(_)), await e.mv(v, _));
|
|
1504
1033
|
}
|
|
1505
1034
|
const l = joinPaths(
|
|
1506
1035
|
s,
|
|
@@ -1517,7 +1046,9 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1517
1046
|
joinPaths(s, u),
|
|
1518
1047
|
joinPaths(n, u)
|
|
1519
1048
|
);
|
|
1520
|
-
await e.rmdir(s)
|
|
1049
|
+
await e.rmdir(s), await defineSiteUrl(e, {
|
|
1050
|
+
siteUrl: await e.absoluteUrl
|
|
1051
|
+
});
|
|
1521
1052
|
const d = phpVar(
|
|
1522
1053
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1523
1054
|
);
|
|
@@ -1557,13 +1088,13 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1557
1088
|
let p = await e.listFiles(l, {
|
|
1558
1089
|
prependPath: !0
|
|
1559
1090
|
});
|
|
1560
|
-
p = p.filter((
|
|
1091
|
+
p = p.filter((w) => !w.endsWith("/__MACOSX"));
|
|
1561
1092
|
const d = p.length === 1 && await e.isDir(p[0]);
|
|
1562
|
-
let u,
|
|
1563
|
-
d ? (
|
|
1564
|
-
const
|
|
1565
|
-
return await e.mv(
|
|
1566
|
-
assetFolderPath:
|
|
1093
|
+
let u, _ = "";
|
|
1094
|
+
d ? (_ = p[0], u = p[0].split("/").pop()) : (_ = l, u = s);
|
|
1095
|
+
const v = `${t}/${u}`;
|
|
1096
|
+
return await e.mv(_, v), {
|
|
1097
|
+
assetFolderPath: v,
|
|
1567
1098
|
assetFolderName: u
|
|
1568
1099
|
};
|
|
1569
1100
|
} finally {
|
|
@@ -1653,7 +1184,6 @@ const installPlugin = async (e, { pluginZipFile: t, options: r = {} }, n) => {
|
|
|
1653
1184
|
__proto__: null,
|
|
1654
1185
|
activatePlugin,
|
|
1655
1186
|
activateTheme,
|
|
1656
|
-
applyWordPressPatches,
|
|
1657
1187
|
cp,
|
|
1658
1188
|
defineSiteUrl,
|
|
1659
1189
|
defineWpConfigConsts,
|
|
@@ -2106,16 +1636,16 @@ const SupportedPHPVersions = [
|
|
|
2106
1636
|
], SupportedPHPExtensionBundles = {
|
|
2107
1637
|
"kitchen-sink": SupportedPHPExtensionsList
|
|
2108
1638
|
};
|
|
2109
|
-
var Ae,
|
|
1639
|
+
var Ae, Ge;
|
|
2110
1640
|
class PHPBrowser {
|
|
2111
1641
|
/**
|
|
2112
1642
|
* @param server - The PHP server to browse.
|
|
2113
1643
|
* @param config - The browser configuration.
|
|
2114
1644
|
*/
|
|
2115
1645
|
constructor(t, r = {}) {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
this.requestHandler = t, te(this, Ae, {}), te(this,
|
|
1646
|
+
Z(this, Ae, void 0);
|
|
1647
|
+
Z(this, Ge, void 0);
|
|
1648
|
+
this.requestHandler = t, te(this, Ae, {}), te(this, Ge, {
|
|
2119
1649
|
handleRedirects: !1,
|
|
2120
1650
|
maxRedirects: 4,
|
|
2121
1651
|
...r
|
|
@@ -2143,7 +1673,7 @@ class PHPBrowser {
|
|
|
2143
1673
|
cookie: this.serializeCookies()
|
|
2144
1674
|
}
|
|
2145
1675
|
});
|
|
2146
|
-
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this,
|
|
1676
|
+
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
|
|
2147
1677
|
const s = new URL(
|
|
2148
1678
|
n.headers.location[0],
|
|
2149
1679
|
this.requestHandler.absoluteUrl
|
|
@@ -2193,7 +1723,7 @@ class PHPBrowser {
|
|
|
2193
1723
|
return t.join("; ");
|
|
2194
1724
|
}
|
|
2195
1725
|
}
|
|
2196
|
-
Ae = new WeakMap(),
|
|
1726
|
+
Ae = new WeakMap(), Ge = new WeakMap();
|
|
2197
1727
|
const DEFAULT_BASE_URL = "http://example.com";
|
|
2198
1728
|
function toRelativeUrl(e) {
|
|
2199
1729
|
return e.toString().substring(e.origin.length);
|
|
@@ -2204,7 +1734,7 @@ function removePathPrefix(e, t) {
|
|
|
2204
1734
|
function ensurePathPrefix(e, t) {
|
|
2205
1735
|
return !t || e.startsWith(t) ? e : t + e;
|
|
2206
1736
|
}
|
|
2207
|
-
var Se,
|
|
1737
|
+
var Se, Ke, dt, De, Je, ve, Ze, Fe, mt, xt, _t, Wt, gt, Bt;
|
|
2208
1738
|
class PHPRequestHandler {
|
|
2209
1739
|
/**
|
|
2210
1740
|
* @param php - The PHP instance.
|
|
@@ -2217,7 +1747,7 @@ class PHPRequestHandler {
|
|
|
2217
1747
|
* @param fsPath - Absolute path of the static file to serve.
|
|
2218
1748
|
* @returns The response.
|
|
2219
1749
|
*/
|
|
2220
|
-
|
|
1750
|
+
Z(this, mt);
|
|
2221
1751
|
/**
|
|
2222
1752
|
* Runs the requested PHP file with all the request and $_SERVER
|
|
2223
1753
|
* superglobals populated.
|
|
@@ -2225,7 +1755,7 @@ class PHPRequestHandler {
|
|
|
2225
1755
|
* @param request - The request.
|
|
2226
1756
|
* @returns The response.
|
|
2227
1757
|
*/
|
|
2228
|
-
|
|
1758
|
+
Z(this, _t);
|
|
2229
1759
|
/**
|
|
2230
1760
|
* Resolve the requested path to the filesystem path of the requested PHP file.
|
|
2231
1761
|
*
|
|
@@ -2235,31 +1765,31 @@ class PHPRequestHandler {
|
|
|
2235
1765
|
* @throws {Error} If the requested path doesn't exist.
|
|
2236
1766
|
* @returns The resolved filesystem path.
|
|
2237
1767
|
*/
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
te(this,
|
|
1768
|
+
Z(this, gt);
|
|
1769
|
+
Z(this, Se, void 0);
|
|
1770
|
+
Z(this, Ke, void 0);
|
|
1771
|
+
Z(this, dt, void 0);
|
|
1772
|
+
Z(this, De, void 0);
|
|
1773
|
+
Z(this, Je, void 0);
|
|
1774
|
+
Z(this, ve, void 0);
|
|
1775
|
+
Z(this, Ze, void 0);
|
|
1776
|
+
Z(this, Fe, void 0);
|
|
1777
|
+
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
2248
1778
|
const {
|
|
2249
1779
|
documentRoot: n = "/www/",
|
|
2250
1780
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
2251
1781
|
} = r;
|
|
2252
1782
|
this.php = t, te(this, Se, n);
|
|
2253
1783
|
const o = new URL(s);
|
|
2254
|
-
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this,
|
|
1784
|
+
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
|
|
2255
1785
|
const i = H(this, De) !== 443 && H(this, De) !== 80;
|
|
2256
|
-
te(this,
|
|
1786
|
+
te(this, Je, [
|
|
2257
1787
|
H(this, dt),
|
|
2258
1788
|
i ? `:${H(this, De)}` : ""
|
|
2259
|
-
].join("")), te(this,
|
|
2260
|
-
`${H(this,
|
|
2261
|
-
H(this,
|
|
2262
|
-
H(this,
|
|
1789
|
+
].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Ze, [
|
|
1790
|
+
`${H(this, Ke)}://`,
|
|
1791
|
+
H(this, Je),
|
|
1792
|
+
H(this, ve)
|
|
2263
1793
|
].join(""));
|
|
2264
1794
|
}
|
|
2265
1795
|
/** @inheritDoc */
|
|
@@ -2269,14 +1799,14 @@ class PHPRequestHandler {
|
|
|
2269
1799
|
/** @inheritDoc */
|
|
2270
1800
|
internalUrlToPath(t) {
|
|
2271
1801
|
const r = new URL(t);
|
|
2272
|
-
return r.pathname.startsWith(H(this,
|
|
1802
|
+
return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
|
|
2273
1803
|
}
|
|
2274
1804
|
get isRequestRunning() {
|
|
2275
|
-
return H(this,
|
|
1805
|
+
return H(this, Fe).running > 0;
|
|
2276
1806
|
}
|
|
2277
1807
|
/** @inheritDoc */
|
|
2278
1808
|
get absoluteUrl() {
|
|
2279
|
-
return H(this,
|
|
1809
|
+
return H(this, Ze);
|
|
2280
1810
|
}
|
|
2281
1811
|
/** @inheritDoc */
|
|
2282
1812
|
get documentRoot() {
|
|
@@ -2289,12 +1819,12 @@ class PHPRequestHandler {
|
|
|
2289
1819
|
r ? void 0 : DEFAULT_BASE_URL
|
|
2290
1820
|
), s = removePathPrefix(
|
|
2291
1821
|
n.pathname,
|
|
2292
|
-
H(this,
|
|
1822
|
+
H(this, ve)
|
|
2293
1823
|
), o = `${H(this, Se)}${s}`;
|
|
2294
|
-
return seemsLikeAPHPRequestHandlerPath(o) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt,
|
|
1824
|
+
return seemsLikeAPHPRequestHandlerPath(o) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, o);
|
|
2295
1825
|
}
|
|
2296
1826
|
}
|
|
2297
|
-
Se = new WeakMap(),
|
|
1827
|
+
Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Ze = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), xt = function(t) {
|
|
2298
1828
|
if (!this.php.fileExists(t))
|
|
2299
1829
|
return new PHPResponse(
|
|
2300
1830
|
404,
|
|
@@ -2320,48 +1850,56 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2320
1850
|
r
|
|
2321
1851
|
);
|
|
2322
1852
|
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
2323
|
-
var s, o;
|
|
2324
|
-
|
|
1853
|
+
var s, o, i;
|
|
1854
|
+
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1855
|
+
return console.warn(
|
|
1856
|
+
"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."
|
|
1857
|
+
), new PHPResponse(
|
|
1858
|
+
502,
|
|
1859
|
+
{},
|
|
1860
|
+
new TextEncoder().encode("502 Bad Gateway")
|
|
1861
|
+
);
|
|
1862
|
+
const n = await H(this, Fe).acquire();
|
|
2325
1863
|
try {
|
|
2326
1864
|
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Se)), this.php.addServerGlobalEntry(
|
|
2327
1865
|
"HTTPS",
|
|
2328
|
-
H(this,
|
|
1866
|
+
H(this, Ze).startsWith("https://") ? "on" : ""
|
|
2329
1867
|
);
|
|
2330
|
-
let
|
|
2331
|
-
const
|
|
2332
|
-
host: H(this,
|
|
1868
|
+
let l = "GET";
|
|
1869
|
+
const p = {
|
|
1870
|
+
host: H(this, Je),
|
|
2333
1871
|
...normalizeHeaders(t.headers || {})
|
|
2334
|
-
},
|
|
1872
|
+
}, d = [];
|
|
2335
1873
|
if (t.files && Object.keys(t.files).length) {
|
|
2336
|
-
|
|
2337
|
-
for (const
|
|
2338
|
-
const w = t.files[
|
|
2339
|
-
|
|
2340
|
-
key:
|
|
1874
|
+
l = "POST";
|
|
1875
|
+
for (const v in t.files) {
|
|
1876
|
+
const w = t.files[v];
|
|
1877
|
+
d.push({
|
|
1878
|
+
key: v,
|
|
2341
1879
|
name: w.name,
|
|
2342
1880
|
type: w.type,
|
|
2343
1881
|
data: new Uint8Array(await w.arrayBuffer())
|
|
2344
1882
|
});
|
|
2345
1883
|
}
|
|
2346
|
-
(
|
|
1884
|
+
(o = p["content-type"]) != null && o.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
|
|
2347
1885
|
t.body || ""
|
|
2348
|
-
),
|
|
1886
|
+
), p["content-type"] = "application/x-www-form-urlencoded", delete t.body);
|
|
2349
1887
|
}
|
|
2350
|
-
let d;
|
|
2351
|
-
t.formData !== void 0 ? (i = "POST", l["content-type"] = l["content-type"] || "application/x-www-form-urlencoded", d = new URLSearchParams(
|
|
2352
|
-
t.formData
|
|
2353
|
-
).toString()) : d = t.body;
|
|
2354
1888
|
let u;
|
|
1889
|
+
t.formData !== void 0 ? (l = "POST", p["content-type"] = p["content-type"] || "application/x-www-form-urlencoded", u = new URLSearchParams(
|
|
1890
|
+
t.formData
|
|
1891
|
+
).toString()) : u = t.body;
|
|
1892
|
+
let _;
|
|
2355
1893
|
try {
|
|
2356
|
-
let
|
|
2357
|
-
if ((
|
|
1894
|
+
let v = r.pathname;
|
|
1895
|
+
if ((i = t.headers) != null && i["x-rewrite-url"])
|
|
2358
1896
|
try {
|
|
2359
|
-
|
|
1897
|
+
v = new URL(
|
|
2360
1898
|
t.headers["x-rewrite-url"]
|
|
2361
1899
|
).pathname;
|
|
2362
1900
|
} catch {
|
|
2363
1901
|
}
|
|
2364
|
-
|
|
1902
|
+
_ = ce(this, gt, Bt).call(this, v);
|
|
2365
1903
|
} catch {
|
|
2366
1904
|
return new PHPResponse(
|
|
2367
1905
|
404,
|
|
@@ -2372,20 +1910,20 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2372
1910
|
return await this.php.run({
|
|
2373
1911
|
relativeUri: ensurePathPrefix(
|
|
2374
1912
|
toRelativeUrl(r),
|
|
2375
|
-
H(this,
|
|
1913
|
+
H(this, ve)
|
|
2376
1914
|
),
|
|
2377
|
-
protocol: H(this,
|
|
2378
|
-
method: t.method ||
|
|
2379
|
-
body:
|
|
2380
|
-
fileInfos:
|
|
2381
|
-
scriptPath:
|
|
2382
|
-
headers:
|
|
1915
|
+
protocol: H(this, Ke),
|
|
1916
|
+
method: t.method || l,
|
|
1917
|
+
body: u,
|
|
1918
|
+
fileInfos: d,
|
|
1919
|
+
scriptPath: _,
|
|
1920
|
+
headers: p
|
|
2383
1921
|
});
|
|
2384
1922
|
} finally {
|
|
2385
1923
|
n();
|
|
2386
1924
|
}
|
|
2387
1925
|
}, gt = new WeakSet(), Bt = function(t) {
|
|
2388
|
-
let r = removePathPrefix(t, H(this,
|
|
1926
|
+
let r = removePathPrefix(t, H(this, ve));
|
|
2389
1927
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
2390
1928
|
const n = `${H(this, Se)}${r}`;
|
|
2391
1929
|
if (this.php.fileExists(n))
|
|
@@ -2549,8 +2087,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2549
2087
|
} catch (l) {
|
|
2550
2088
|
const p = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2551
2089
|
if (p in FileErrorCodes) {
|
|
2552
|
-
const d = FileErrorCodes[p], u = typeof i[0] == "string" ? i[0] : null,
|
|
2553
|
-
throw new Error(`${
|
|
2090
|
+
const d = FileErrorCodes[p], u = typeof i[0] == "string" ? i[0] : null, _ = u !== null ? e.replaceAll("{path}", u) : e;
|
|
2091
|
+
throw new Error(`${_}: ${d}`, {
|
|
2554
2092
|
cause: l
|
|
2555
2093
|
});
|
|
2556
2094
|
}
|
|
@@ -2573,7 +2111,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2573
2111
|
return n && s && __defProp(t, r, s), s;
|
|
2574
2112
|
};
|
|
2575
2113
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2576
|
-
var
|
|
2114
|
+
var Me, Qe, Ye, Pe, Re, Te, be, Xe, $t, Gt, yt, Kt, vt, Jt, wt, Zt, Pt, Qt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2577
2115
|
class BasePHP {
|
|
2578
2116
|
/**
|
|
2579
2117
|
* Initializes a PHP runtime.
|
|
@@ -2583,15 +2121,15 @@ class BasePHP {
|
|
|
2583
2121
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2584
2122
|
*/
|
|
2585
2123
|
constructor(e, t) {
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2124
|
+
Z(this, $t);
|
|
2125
|
+
Z(this, yt);
|
|
2126
|
+
Z(this, vt);
|
|
2127
|
+
Z(this, wt);
|
|
2128
|
+
Z(this, Pt);
|
|
2129
|
+
Z(this, bt);
|
|
2130
|
+
Z(this, Et);
|
|
2131
|
+
Z(this, St);
|
|
2132
|
+
Z(this, Rt);
|
|
2595
2133
|
/**
|
|
2596
2134
|
* Adds file information to $_FILES superglobal in PHP.
|
|
2597
2135
|
*
|
|
@@ -2601,18 +2139,18 @@ class BasePHP {
|
|
|
2601
2139
|
*
|
|
2602
2140
|
* @param fileInfo - File details
|
|
2603
2141
|
*/
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
te(this,
|
|
2142
|
+
Z(this, Tt);
|
|
2143
|
+
Z(this, kt);
|
|
2144
|
+
Z(this, Ct);
|
|
2145
|
+
Z(this, Me, void 0);
|
|
2146
|
+
Z(this, Qe, void 0);
|
|
2147
|
+
Z(this, Ye, void 0);
|
|
2148
|
+
Z(this, Pe, void 0);
|
|
2149
|
+
Z(this, Re, void 0);
|
|
2150
|
+
Z(this, Te, void 0);
|
|
2151
|
+
Z(this, be, void 0);
|
|
2152
|
+
Z(this, Xe, void 0);
|
|
2153
|
+
te(this, Me, []), te(this, Pe, !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(
|
|
2616
2154
|
new PHPRequestHandler(this, t)
|
|
2617
2155
|
));
|
|
2618
2156
|
}
|
|
@@ -2689,7 +2227,7 @@ class BasePHP {
|
|
|
2689
2227
|
setPhpIniPath(e) {
|
|
2690
2228
|
if (H(this, Pe))
|
|
2691
2229
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2692
|
-
te(this,
|
|
2230
|
+
te(this, Qe, e), this[__private__dont__use].ccall(
|
|
2693
2231
|
"wasm_set_phpini_path",
|
|
2694
2232
|
null,
|
|
2695
2233
|
["string"],
|
|
@@ -2700,7 +2238,7 @@ class BasePHP {
|
|
|
2700
2238
|
setPhpIniEntry(e, t) {
|
|
2701
2239
|
if (H(this, Pe))
|
|
2702
2240
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2703
|
-
H(this,
|
|
2241
|
+
H(this, Me).push([e, t]);
|
|
2704
2242
|
}
|
|
2705
2243
|
/** @inheritDoc */
|
|
2706
2244
|
chdir(e) {
|
|
@@ -2717,9 +2255,9 @@ class BasePHP {
|
|
|
2717
2255
|
const t = await this.semaphore.acquire();
|
|
2718
2256
|
let r;
|
|
2719
2257
|
try {
|
|
2720
|
-
H(this, Pe) || (ce(this, $t, Gt).call(this), te(this, Pe, !0)), ce(this, St, er).call(this, e.scriptPath || ""), ce(this,
|
|
2258
|
+
H(this, Pe) || (ce(this, $t, Gt).call(this), te(this, Pe, !0)), ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Qt).call(this, e.method || "GET");
|
|
2721
2259
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2722
|
-
if (ce(this,
|
|
2260
|
+
if (ce(this, wt, Zt).call(this, s, e.protocol || "http"), ce(this, bt, Yt).call(this, n), e.body && (r = ce(this, Et, Xt).call(this, e.body)), e.fileInfos)
|
|
2723
2261
|
for (const i of e.fileInfos)
|
|
2724
2262
|
ce(this, Tt, rr).call(this, i);
|
|
2725
2263
|
typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
@@ -2843,7 +2381,7 @@ class BasePHP {
|
|
|
2843
2381
|
this.exit();
|
|
2844
2382
|
} catch {
|
|
2845
2383
|
}
|
|
2846
|
-
if (this.initializeRuntime(e), H(this,
|
|
2384
|
+
if (this.initializeRuntime(e), H(this, Qe) && this.setPhpIniPath(H(this, Qe)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
|
|
2847
2385
|
const r = this.documentRoot;
|
|
2848
2386
|
recreateMemFS(this[__private__dont__use].FS, t, r);
|
|
2849
2387
|
}
|
|
@@ -2859,7 +2397,7 @@ class BasePHP {
|
|
|
2859
2397
|
te(this, Pe, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2860
2398
|
}
|
|
2861
2399
|
}
|
|
2862
|
-
|
|
2400
|
+
Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), $t = new WeakSet(), Gt = function() {
|
|
2863
2401
|
if (this.setPhpIniEntry("auto_prepend_file", "/tmp/consts.php"), this.fileExists("/tmp/consts.php") || this.writeFile(
|
|
2864
2402
|
"/tmp/consts.php",
|
|
2865
2403
|
`<?php
|
|
@@ -2871,8 +2409,8 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2871
2409
|
}
|
|
2872
2410
|
}
|
|
2873
2411
|
}`
|
|
2874
|
-
), H(this,
|
|
2875
|
-
const e = H(this,
|
|
2412
|
+
), H(this, Me).length > 0) {
|
|
2413
|
+
const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
|
|
2876
2414
|
`) + `
|
|
2877
2415
|
|
|
2878
2416
|
`;
|
|
@@ -2901,7 +2439,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2901
2439
|
headers: r,
|
|
2902
2440
|
httpStatusCode: t.status
|
|
2903
2441
|
};
|
|
2904
|
-
},
|
|
2442
|
+
}, vt = new WeakSet(), Jt = function(e) {
|
|
2905
2443
|
if (this[__private__dont__use].ccall(
|
|
2906
2444
|
"wasm_set_request_uri",
|
|
2907
2445
|
null,
|
|
@@ -2916,7 +2454,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2916
2454
|
[t]
|
|
2917
2455
|
);
|
|
2918
2456
|
}
|
|
2919
|
-
},
|
|
2457
|
+
}, wt = new WeakSet(), Zt = function(e, t) {
|
|
2920
2458
|
this[__private__dont__use].ccall(
|
|
2921
2459
|
"wasm_set_request_host",
|
|
2922
2460
|
null,
|
|
@@ -2934,7 +2472,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2934
2472
|
[NUMBER],
|
|
2935
2473
|
[r]
|
|
2936
2474
|
), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
2937
|
-
}, Pt = new WeakSet(),
|
|
2475
|
+
}, Pt = new WeakSet(), Qt = function(e) {
|
|
2938
2476
|
this[__private__dont__use].ccall(
|
|
2939
2477
|
"wasm_set_request_method",
|
|
2940
2478
|
null,
|
|
@@ -3402,15 +2940,15 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3402
2940
|
e._ = s;
|
|
3403
2941
|
const o = new n("+");
|
|
3404
2942
|
function i(g, ...k) {
|
|
3405
|
-
const C = [
|
|
2943
|
+
const C = [w(g[0])];
|
|
3406
2944
|
let I = 0;
|
|
3407
2945
|
for (; I < k.length; )
|
|
3408
|
-
C.push(o), l(C, k[I]), C.push(o,
|
|
2946
|
+
C.push(o), l(C, k[I]), C.push(o, w(g[++I]));
|
|
3409
2947
|
return p(C), new n(C);
|
|
3410
2948
|
}
|
|
3411
2949
|
e.str = i;
|
|
3412
2950
|
function l(g, k) {
|
|
3413
|
-
k instanceof n ? g.push(...k._items) : k instanceof r ? g.push(k) : g.push(
|
|
2951
|
+
k instanceof n ? g.push(...k._items) : k instanceof r ? g.push(k) : g.push(_(k));
|
|
3414
2952
|
}
|
|
3415
2953
|
e.addCodeArg = l;
|
|
3416
2954
|
function p(g) {
|
|
@@ -3441,21 +2979,21 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3441
2979
|
return k.emptyStr() ? g : g.emptyStr() ? k : i`${g}${k}`;
|
|
3442
2980
|
}
|
|
3443
2981
|
e.strConcat = u;
|
|
3444
|
-
function
|
|
3445
|
-
return typeof g == "number" || typeof g == "boolean" || g === null ? g :
|
|
2982
|
+
function _(g) {
|
|
2983
|
+
return typeof g == "number" || typeof g == "boolean" || g === null ? g : w(Array.isArray(g) ? g.join(",") : g);
|
|
3446
2984
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return new n(
|
|
2985
|
+
function v(g) {
|
|
2986
|
+
return new n(w(g));
|
|
3449
2987
|
}
|
|
3450
|
-
e.stringify =
|
|
3451
|
-
function
|
|
2988
|
+
e.stringify = v;
|
|
2989
|
+
function w(g) {
|
|
3452
2990
|
return JSON.stringify(g).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3453
2991
|
}
|
|
3454
|
-
e.safeStringify =
|
|
3455
|
-
function
|
|
2992
|
+
e.safeStringify = w;
|
|
2993
|
+
function P(g) {
|
|
3456
2994
|
return typeof g == "string" && e.IDENTIFIER.test(g) ? new n(`.${g}`) : s`[${g}]`;
|
|
3457
2995
|
}
|
|
3458
|
-
e.getProperty =
|
|
2996
|
+
e.getProperty = P;
|
|
3459
2997
|
function T(g) {
|
|
3460
2998
|
if (typeof g == "string" && e.IDENTIFIER.test(g))
|
|
3461
2999
|
return new n(`${g}`);
|
|
@@ -3499,8 +3037,8 @@ var scope = {};
|
|
|
3499
3037
|
return `${d}${u.index++}`;
|
|
3500
3038
|
}
|
|
3501
3039
|
_nameGroup(d) {
|
|
3502
|
-
var u,
|
|
3503
|
-
if (!((
|
|
3040
|
+
var u, _;
|
|
3041
|
+
if (!((_ = (u = this._parent) === null || u === void 0 ? void 0 : u._prefixes) === null || _ === void 0) && _.has(d) || this._prefixes && !this._prefixes.has(d))
|
|
3504
3042
|
throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);
|
|
3505
3043
|
return this._names[d] = { prefix: d, index: 0 };
|
|
3506
3044
|
}
|
|
@@ -3510,8 +3048,8 @@ var scope = {};
|
|
|
3510
3048
|
constructor(d, u) {
|
|
3511
3049
|
super(u), this.prefix = d;
|
|
3512
3050
|
}
|
|
3513
|
-
setValue(d, { property: u, itemIndex:
|
|
3514
|
-
this.value = d, this.scopePath = (0, t._)`.${new t.Name(u)}[${
|
|
3051
|
+
setValue(d, { property: u, itemIndex: _ }) {
|
|
3052
|
+
this.value = d, this.scopePath = (0, t._)`.${new t.Name(u)}[${_}]`;
|
|
3515
3053
|
}
|
|
3516
3054
|
}
|
|
3517
3055
|
e.ValueScopeName = o;
|
|
@@ -3527,47 +3065,47 @@ var scope = {};
|
|
|
3527
3065
|
return new o(d, this._newName(d));
|
|
3528
3066
|
}
|
|
3529
3067
|
value(d, u) {
|
|
3530
|
-
var
|
|
3068
|
+
var _;
|
|
3531
3069
|
if (u.ref === void 0)
|
|
3532
3070
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3533
|
-
const
|
|
3534
|
-
let T = this._values[
|
|
3071
|
+
const v = this.toName(d), { prefix: w } = v, P = (_ = u.key) !== null && _ !== void 0 ? _ : u.ref;
|
|
3072
|
+
let T = this._values[w];
|
|
3535
3073
|
if (T) {
|
|
3536
|
-
const k = T.get(
|
|
3074
|
+
const k = T.get(P);
|
|
3537
3075
|
if (k)
|
|
3538
3076
|
return k;
|
|
3539
3077
|
} else
|
|
3540
|
-
T = this._values[
|
|
3541
|
-
T.set(
|
|
3542
|
-
const $ = this._scope[
|
|
3543
|
-
return $[g] = u.ref,
|
|
3078
|
+
T = this._values[w] = /* @__PURE__ */ new Map();
|
|
3079
|
+
T.set(P, v);
|
|
3080
|
+
const $ = this._scope[w] || (this._scope[w] = []), g = $.length;
|
|
3081
|
+
return $[g] = u.ref, v.setValue(u, { property: w, itemIndex: g }), v;
|
|
3544
3082
|
}
|
|
3545
3083
|
getValue(d, u) {
|
|
3546
|
-
const
|
|
3547
|
-
if (
|
|
3548
|
-
return
|
|
3084
|
+
const _ = this._values[d];
|
|
3085
|
+
if (_)
|
|
3086
|
+
return _.get(u);
|
|
3549
3087
|
}
|
|
3550
3088
|
scopeRefs(d, u = this._values) {
|
|
3551
|
-
return this._reduceValues(u, (
|
|
3552
|
-
if (
|
|
3553
|
-
throw new Error(`CodeGen: name "${
|
|
3554
|
-
return (0, t._)`${d}${
|
|
3089
|
+
return this._reduceValues(u, (_) => {
|
|
3090
|
+
if (_.scopePath === void 0)
|
|
3091
|
+
throw new Error(`CodeGen: name "${_}" has no value`);
|
|
3092
|
+
return (0, t._)`${d}${_.scopePath}`;
|
|
3555
3093
|
});
|
|
3556
3094
|
}
|
|
3557
|
-
scopeCode(d = this._values, u,
|
|
3558
|
-
return this._reduceValues(d, (
|
|
3559
|
-
if (
|
|
3560
|
-
throw new Error(`CodeGen: name "${
|
|
3561
|
-
return
|
|
3562
|
-
}, u,
|
|
3563
|
-
}
|
|
3564
|
-
_reduceValues(d, u,
|
|
3565
|
-
let
|
|
3566
|
-
for (const
|
|
3567
|
-
const T = d[
|
|
3095
|
+
scopeCode(d = this._values, u, _) {
|
|
3096
|
+
return this._reduceValues(d, (v) => {
|
|
3097
|
+
if (v.value === void 0)
|
|
3098
|
+
throw new Error(`CodeGen: name "${v}" has no value`);
|
|
3099
|
+
return v.value.code;
|
|
3100
|
+
}, u, _);
|
|
3101
|
+
}
|
|
3102
|
+
_reduceValues(d, u, _ = {}, v) {
|
|
3103
|
+
let w = t.nil;
|
|
3104
|
+
for (const P in d) {
|
|
3105
|
+
const T = d[P];
|
|
3568
3106
|
if (!T)
|
|
3569
3107
|
continue;
|
|
3570
|
-
const $ =
|
|
3108
|
+
const $ = _[P] = _[P] || /* @__PURE__ */ new Map();
|
|
3571
3109
|
T.forEach((g) => {
|
|
3572
3110
|
if ($.has(g))
|
|
3573
3111
|
return;
|
|
@@ -3575,15 +3113,15 @@ var scope = {};
|
|
|
3575
3113
|
let k = u(g);
|
|
3576
3114
|
if (k) {
|
|
3577
3115
|
const C = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3578
|
-
|
|
3579
|
-
} else if (k =
|
|
3580
|
-
|
|
3116
|
+
w = (0, t._)`${w}${C} ${g} = ${k};${this.opts._n}`;
|
|
3117
|
+
} else if (k = v == null ? void 0 : v(g))
|
|
3118
|
+
w = (0, t._)`${w}${k}${this.opts._n}`;
|
|
3581
3119
|
else
|
|
3582
3120
|
throw new r(g);
|
|
3583
3121
|
$.set(g, n.Completed);
|
|
3584
3122
|
});
|
|
3585
3123
|
}
|
|
3586
|
-
return
|
|
3124
|
+
return w;
|
|
3587
3125
|
}
|
|
3588
3126
|
}
|
|
3589
3127
|
e.ValueScope = l;
|
|
@@ -3643,8 +3181,8 @@ var scope = {};
|
|
|
3643
3181
|
super(), this.varKind = a, this.name = h, this.rhs = N;
|
|
3644
3182
|
}
|
|
3645
3183
|
render({ es5: a, _n: h }) {
|
|
3646
|
-
const N = a ? r.varKinds.var : this.varKind,
|
|
3647
|
-
return `${N} ${this.name}${
|
|
3184
|
+
const N = a ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3185
|
+
return `${N} ${this.name}${M};` + h;
|
|
3648
3186
|
}
|
|
3649
3187
|
optimizeNames(a, h) {
|
|
3650
3188
|
if (a[this.name.str])
|
|
@@ -3671,8 +3209,8 @@ var scope = {};
|
|
|
3671
3209
|
}
|
|
3672
3210
|
}
|
|
3673
3211
|
class p extends l {
|
|
3674
|
-
constructor(a, h, N,
|
|
3675
|
-
super(a, N,
|
|
3212
|
+
constructor(a, h, N, M) {
|
|
3213
|
+
super(a, N, M), this.op = h;
|
|
3676
3214
|
}
|
|
3677
3215
|
render({ _n: a }) {
|
|
3678
3216
|
return `${this.lhs} ${this.op}= ${this.rhs};` + a;
|
|
@@ -3694,7 +3232,7 @@ var scope = {};
|
|
|
3694
3232
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3695
3233
|
}
|
|
3696
3234
|
}
|
|
3697
|
-
class
|
|
3235
|
+
class _ extends o {
|
|
3698
3236
|
constructor(a) {
|
|
3699
3237
|
super(), this.error = a;
|
|
3700
3238
|
}
|
|
@@ -3705,7 +3243,7 @@ var scope = {};
|
|
|
3705
3243
|
return this.error.names;
|
|
3706
3244
|
}
|
|
3707
3245
|
}
|
|
3708
|
-
class
|
|
3246
|
+
class v extends o {
|
|
3709
3247
|
constructor(a) {
|
|
3710
3248
|
super(), this.code = a;
|
|
3711
3249
|
}
|
|
@@ -3722,7 +3260,7 @@ var scope = {};
|
|
|
3722
3260
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3723
3261
|
}
|
|
3724
3262
|
}
|
|
3725
|
-
class
|
|
3263
|
+
class w extends o {
|
|
3726
3264
|
constructor(a = []) {
|
|
3727
3265
|
super(), this.nodes = a;
|
|
3728
3266
|
}
|
|
@@ -3740,10 +3278,10 @@ var scope = {};
|
|
|
3740
3278
|
}
|
|
3741
3279
|
optimizeNames(a, h) {
|
|
3742
3280
|
const { nodes: N } = this;
|
|
3743
|
-
let
|
|
3744
|
-
for (;
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3281
|
+
let M = N.length;
|
|
3282
|
+
for (; M--; ) {
|
|
3283
|
+
const q = N[M];
|
|
3284
|
+
q.optimizeNames(a, h) || (ke(a, q.names), N.splice(M, 1));
|
|
3747
3285
|
}
|
|
3748
3286
|
return N.length > 0 ? this : void 0;
|
|
3749
3287
|
}
|
|
@@ -3751,17 +3289,17 @@ var scope = {};
|
|
|
3751
3289
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3752
3290
|
}
|
|
3753
3291
|
}
|
|
3754
|
-
class
|
|
3292
|
+
class P extends w {
|
|
3755
3293
|
render(a) {
|
|
3756
3294
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3757
3295
|
}
|
|
3758
3296
|
}
|
|
3759
|
-
class T extends
|
|
3297
|
+
class T extends w {
|
|
3760
3298
|
}
|
|
3761
|
-
class $ extends
|
|
3299
|
+
class $ extends P {
|
|
3762
3300
|
}
|
|
3763
3301
|
$.kind = "else";
|
|
3764
|
-
class g extends
|
|
3302
|
+
class g extends P {
|
|
3765
3303
|
constructor(a, h) {
|
|
3766
3304
|
super(h), this.condition = a;
|
|
3767
3305
|
}
|
|
@@ -3795,7 +3333,7 @@ var scope = {};
|
|
|
3795
3333
|
}
|
|
3796
3334
|
}
|
|
3797
3335
|
g.kind = "if";
|
|
3798
|
-
class k extends
|
|
3336
|
+
class k extends P {
|
|
3799
3337
|
}
|
|
3800
3338
|
k.kind = "for";
|
|
3801
3339
|
class C extends k {
|
|
@@ -3814,12 +3352,12 @@ var scope = {};
|
|
|
3814
3352
|
}
|
|
3815
3353
|
}
|
|
3816
3354
|
class I extends k {
|
|
3817
|
-
constructor(a, h, N,
|
|
3818
|
-
super(), this.varKind = a, this.name = h, this.from = N, this.to =
|
|
3355
|
+
constructor(a, h, N, M) {
|
|
3356
|
+
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3819
3357
|
}
|
|
3820
3358
|
render(a) {
|
|
3821
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from:
|
|
3822
|
-
return `for(${h} ${N}=${
|
|
3359
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3360
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(a);
|
|
3823
3361
|
}
|
|
3824
3362
|
get names() {
|
|
3825
3363
|
const a = ue(super.names, this.from);
|
|
@@ -3827,8 +3365,8 @@ var scope = {};
|
|
|
3827
3365
|
}
|
|
3828
3366
|
}
|
|
3829
3367
|
class D extends k {
|
|
3830
|
-
constructor(a, h, N,
|
|
3831
|
-
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable =
|
|
3368
|
+
constructor(a, h, N, M) {
|
|
3369
|
+
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3832
3370
|
}
|
|
3833
3371
|
render(a) {
|
|
3834
3372
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(a);
|
|
@@ -3841,7 +3379,7 @@ var scope = {};
|
|
|
3841
3379
|
return K(super.names, this.iterable.names);
|
|
3842
3380
|
}
|
|
3843
3381
|
}
|
|
3844
|
-
class
|
|
3382
|
+
class b extends P {
|
|
3845
3383
|
constructor(a, h, N) {
|
|
3846
3384
|
super(), this.name = a, this.args = h, this.async = N;
|
|
3847
3385
|
}
|
|
@@ -3849,14 +3387,14 @@ var scope = {};
|
|
|
3849
3387
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
3850
3388
|
}
|
|
3851
3389
|
}
|
|
3852
|
-
|
|
3853
|
-
class O extends
|
|
3390
|
+
b.kind = "func";
|
|
3391
|
+
class O extends w {
|
|
3854
3392
|
render(a) {
|
|
3855
3393
|
return "return " + super.render(a);
|
|
3856
3394
|
}
|
|
3857
3395
|
}
|
|
3858
3396
|
O.kind = "return";
|
|
3859
|
-
class A extends
|
|
3397
|
+
class A extends P {
|
|
3860
3398
|
render(a) {
|
|
3861
3399
|
let h = "try" + super.render(a);
|
|
3862
3400
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3866,15 +3404,15 @@ var scope = {};
|
|
|
3866
3404
|
return super.optimizeNodes(), (a = this.catch) === null || a === void 0 || a.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3867
3405
|
}
|
|
3868
3406
|
optimizeNames(a, h) {
|
|
3869
|
-
var N,
|
|
3870
|
-
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (
|
|
3407
|
+
var N, M;
|
|
3408
|
+
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(a, h), this;
|
|
3871
3409
|
}
|
|
3872
3410
|
get names() {
|
|
3873
3411
|
const a = super.names;
|
|
3874
3412
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3875
3413
|
}
|
|
3876
3414
|
}
|
|
3877
|
-
class
|
|
3415
|
+
class V extends P {
|
|
3878
3416
|
constructor(a) {
|
|
3879
3417
|
super(), this.error = a;
|
|
3880
3418
|
}
|
|
@@ -3882,13 +3420,13 @@ var scope = {};
|
|
|
3882
3420
|
return `catch(${this.error})` + super.render(a);
|
|
3883
3421
|
}
|
|
3884
3422
|
}
|
|
3885
|
-
|
|
3886
|
-
class
|
|
3423
|
+
V.kind = "catch";
|
|
3424
|
+
class x extends P {
|
|
3887
3425
|
render(a) {
|
|
3888
3426
|
return "finally" + super.render(a);
|
|
3889
3427
|
}
|
|
3890
3428
|
}
|
|
3891
|
-
|
|
3429
|
+
x.kind = "finally";
|
|
3892
3430
|
class re {
|
|
3893
3431
|
constructor(a, h = {}) {
|
|
3894
3432
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
@@ -3921,9 +3459,9 @@ var scope = {};
|
|
|
3921
3459
|
scopeCode() {
|
|
3922
3460
|
return this._extScope.scopeCode(this._values);
|
|
3923
3461
|
}
|
|
3924
|
-
_def(a, h, N,
|
|
3925
|
-
const
|
|
3926
|
-
return N !== void 0 &&
|
|
3462
|
+
_def(a, h, N, M) {
|
|
3463
|
+
const q = this._scope.toName(h);
|
|
3464
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new i(a, q, N)), q;
|
|
3927
3465
|
}
|
|
3928
3466
|
// `const` declaration (`var` in es5 mode)
|
|
3929
3467
|
const(a, h, N) {
|
|
@@ -3947,13 +3485,13 @@ var scope = {};
|
|
|
3947
3485
|
}
|
|
3948
3486
|
// appends passed SafeExpr to code or executes Block
|
|
3949
3487
|
code(a) {
|
|
3950
|
-
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new
|
|
3488
|
+
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new v(a)), this;
|
|
3951
3489
|
}
|
|
3952
3490
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3953
3491
|
object(...a) {
|
|
3954
3492
|
const h = ["{"];
|
|
3955
|
-
for (const [N,
|
|
3956
|
-
h.length > 1 && h.push(","), h.push(N), (N !==
|
|
3493
|
+
for (const [N, M] of a)
|
|
3494
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3957
3495
|
return h.push("}"), new t._Code(h);
|
|
3958
3496
|
}
|
|
3959
3497
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
@@ -3986,28 +3524,28 @@ var scope = {};
|
|
|
3986
3524
|
return this._for(new C(a), h);
|
|
3987
3525
|
}
|
|
3988
3526
|
// `for` statement for a range of values
|
|
3989
|
-
forRange(a, h, N,
|
|
3527
|
+
forRange(a, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3990
3528
|
const W = this._scope.toName(a);
|
|
3991
|
-
return this._for(new I(
|
|
3529
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3992
3530
|
}
|
|
3993
3531
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3994
|
-
forOf(a, h, N,
|
|
3995
|
-
const
|
|
3532
|
+
forOf(a, h, N, M = r.varKinds.const) {
|
|
3533
|
+
const q = this._scope.toName(a);
|
|
3996
3534
|
if (this.opts.es5) {
|
|
3997
3535
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3998
3536
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3999
|
-
this.var(
|
|
3537
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
4000
3538
|
});
|
|
4001
3539
|
}
|
|
4002
|
-
return this._for(new D("of",
|
|
3540
|
+
return this._for(new D("of", M, q, h), () => N(q));
|
|
4003
3541
|
}
|
|
4004
3542
|
// `for-in` statement.
|
|
4005
3543
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
4006
|
-
forIn(a, h, N,
|
|
3544
|
+
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
4007
3545
|
if (this.opts.ownProperties)
|
|
4008
3546
|
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
4009
|
-
const
|
|
4010
|
-
return this._for(new D("in",
|
|
3547
|
+
const q = this._scope.toName(a);
|
|
3548
|
+
return this._for(new D("in", M, q, h), () => N(q));
|
|
4011
3549
|
}
|
|
4012
3550
|
// end `for` loop
|
|
4013
3551
|
endFor() {
|
|
@@ -4032,16 +3570,16 @@ var scope = {};
|
|
|
4032
3570
|
try(a, h, N) {
|
|
4033
3571
|
if (!h && !N)
|
|
4034
3572
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
4035
|
-
const
|
|
4036
|
-
if (this._blockNode(
|
|
4037
|
-
const
|
|
4038
|
-
this._currNode =
|
|
3573
|
+
const M = new A();
|
|
3574
|
+
if (this._blockNode(M), this.code(a), h) {
|
|
3575
|
+
const q = this.name("e");
|
|
3576
|
+
this._currNode = M.catch = new V(q), h(q);
|
|
4039
3577
|
}
|
|
4040
|
-
return N && (this._currNode =
|
|
3578
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(V, x);
|
|
4041
3579
|
}
|
|
4042
3580
|
// `throw` statement
|
|
4043
3581
|
throw(a) {
|
|
4044
|
-
return this._leafNode(new
|
|
3582
|
+
return this._leafNode(new _(a));
|
|
4045
3583
|
}
|
|
4046
3584
|
// start self-balancing block
|
|
4047
3585
|
block(a, h) {
|
|
@@ -4058,12 +3596,12 @@ var scope = {};
|
|
|
4058
3596
|
return this._nodes.length = h, this;
|
|
4059
3597
|
}
|
|
4060
3598
|
// `function` heading (or definition if funcBody is passed)
|
|
4061
|
-
func(a, h = t.nil, N,
|
|
4062
|
-
return this._blockNode(new
|
|
3599
|
+
func(a, h = t.nil, N, M) {
|
|
3600
|
+
return this._blockNode(new b(a, h, N)), M && this.code(M).endFunc(), this;
|
|
4063
3601
|
}
|
|
4064
3602
|
// end function definition
|
|
4065
3603
|
endFunc() {
|
|
4066
|
-
return this._endBlockNode(
|
|
3604
|
+
return this._endBlockNode(b);
|
|
4067
3605
|
}
|
|
4068
3606
|
optimize(a = 1) {
|
|
4069
3607
|
for (; a-- > 0; )
|
|
@@ -4100,189 +3638,189 @@ var scope = {};
|
|
|
4100
3638
|
}
|
|
4101
3639
|
}
|
|
4102
3640
|
e.CodeGen = re;
|
|
4103
|
-
function K(
|
|
3641
|
+
function K(E, a) {
|
|
4104
3642
|
for (const h in a)
|
|
4105
|
-
|
|
4106
|
-
return
|
|
3643
|
+
E[h] = (E[h] || 0) + (a[h] || 0);
|
|
3644
|
+
return E;
|
|
4107
3645
|
}
|
|
4108
|
-
function ue(
|
|
4109
|
-
return a instanceof t._CodeOrName ? K(
|
|
3646
|
+
function ue(E, a) {
|
|
3647
|
+
return a instanceof t._CodeOrName ? K(E, a.names) : E;
|
|
4110
3648
|
}
|
|
4111
|
-
function ie(
|
|
4112
|
-
if (
|
|
4113
|
-
return N(
|
|
4114
|
-
if (!
|
|
4115
|
-
return
|
|
4116
|
-
return new t._Code(
|
|
4117
|
-
function N(
|
|
4118
|
-
const W = h[
|
|
4119
|
-
return W === void 0 || a[
|
|
3649
|
+
function ie(E, a, h) {
|
|
3650
|
+
if (E instanceof t.Name)
|
|
3651
|
+
return N(E);
|
|
3652
|
+
if (!M(E))
|
|
3653
|
+
return E;
|
|
3654
|
+
return new t._Code(E._items.reduce((q, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3655
|
+
function N(q) {
|
|
3656
|
+
const W = h[q.str];
|
|
3657
|
+
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
4120
3658
|
}
|
|
4121
|
-
function q
|
|
4122
|
-
return
|
|
3659
|
+
function M(q) {
|
|
3660
|
+
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
4123
3661
|
}
|
|
4124
3662
|
}
|
|
4125
|
-
function ke(
|
|
3663
|
+
function ke(E, a) {
|
|
4126
3664
|
for (const h in a)
|
|
4127
|
-
|
|
3665
|
+
E[h] = (E[h] || 0) - (a[h] || 0);
|
|
4128
3666
|
}
|
|
4129
|
-
function Ce(
|
|
4130
|
-
return typeof
|
|
3667
|
+
function Ce(E) {
|
|
3668
|
+
return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
|
|
4131
3669
|
}
|
|
4132
3670
|
e.not = Ce;
|
|
4133
3671
|
const qe = y(e.operators.AND);
|
|
4134
|
-
function et(...
|
|
4135
|
-
return
|
|
3672
|
+
function et(...E) {
|
|
3673
|
+
return E.reduce(qe);
|
|
4136
3674
|
}
|
|
4137
3675
|
e.and = et;
|
|
4138
|
-
const
|
|
4139
|
-
function F(...
|
|
4140
|
-
return
|
|
3676
|
+
const Ue = y(e.operators.OR);
|
|
3677
|
+
function F(...E) {
|
|
3678
|
+
return E.reduce(Ue);
|
|
4141
3679
|
}
|
|
4142
3680
|
e.or = F;
|
|
4143
|
-
function y(
|
|
4144
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3681
|
+
function y(E) {
|
|
3682
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
|
|
4145
3683
|
}
|
|
4146
|
-
function j(
|
|
4147
|
-
return
|
|
3684
|
+
function j(E) {
|
|
3685
|
+
return E instanceof t.Name ? E : (0, t._)`(${E})`;
|
|
4148
3686
|
}
|
|
4149
3687
|
})(codegen);
|
|
4150
3688
|
var util = {};
|
|
4151
3689
|
(function(e) {
|
|
4152
3690
|
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;
|
|
4153
3691
|
const t = codegen, r = code$1;
|
|
4154
|
-
function n(
|
|
3692
|
+
function n(b) {
|
|
4155
3693
|
const O = {};
|
|
4156
|
-
for (const A of
|
|
3694
|
+
for (const A of b)
|
|
4157
3695
|
O[A] = !0;
|
|
4158
3696
|
return O;
|
|
4159
3697
|
}
|
|
4160
3698
|
e.toHash = n;
|
|
4161
|
-
function s(
|
|
4162
|
-
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (o(
|
|
3699
|
+
function s(b, O) {
|
|
3700
|
+
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (o(b, O), !i(O, b.self.RULES.all));
|
|
4163
3701
|
}
|
|
4164
3702
|
e.alwaysValidSchema = s;
|
|
4165
|
-
function o(
|
|
4166
|
-
const { opts: A, self:
|
|
3703
|
+
function o(b, O = b.schema) {
|
|
3704
|
+
const { opts: A, self: V } = b;
|
|
4167
3705
|
if (!A.strictSchema || typeof O == "boolean")
|
|
4168
3706
|
return;
|
|
4169
|
-
const
|
|
3707
|
+
const x = V.RULES.keywords;
|
|
4170
3708
|
for (const re in O)
|
|
4171
|
-
|
|
3709
|
+
x[re] || D(b, `unknown keyword: "${re}"`);
|
|
4172
3710
|
}
|
|
4173
3711
|
e.checkUnknownRules = o;
|
|
4174
|
-
function i(
|
|
4175
|
-
if (typeof
|
|
4176
|
-
return !
|
|
4177
|
-
for (const A in
|
|
3712
|
+
function i(b, O) {
|
|
3713
|
+
if (typeof b == "boolean")
|
|
3714
|
+
return !b;
|
|
3715
|
+
for (const A in b)
|
|
4178
3716
|
if (O[A])
|
|
4179
3717
|
return !0;
|
|
4180
3718
|
return !1;
|
|
4181
3719
|
}
|
|
4182
3720
|
e.schemaHasRules = i;
|
|
4183
|
-
function l(
|
|
4184
|
-
if (typeof
|
|
4185
|
-
return !
|
|
4186
|
-
for (const A in
|
|
3721
|
+
function l(b, O) {
|
|
3722
|
+
if (typeof b == "boolean")
|
|
3723
|
+
return !b;
|
|
3724
|
+
for (const A in b)
|
|
4187
3725
|
if (A !== "$ref" && O.all[A])
|
|
4188
3726
|
return !0;
|
|
4189
3727
|
return !1;
|
|
4190
3728
|
}
|
|
4191
3729
|
e.schemaHasRulesButRef = l;
|
|
4192
|
-
function p({ topSchemaRef:
|
|
4193
|
-
if (!
|
|
3730
|
+
function p({ topSchemaRef: b, schemaPath: O }, A, V, x) {
|
|
3731
|
+
if (!x) {
|
|
4194
3732
|
if (typeof A == "number" || typeof A == "boolean")
|
|
4195
3733
|
return A;
|
|
4196
3734
|
if (typeof A == "string")
|
|
4197
3735
|
return (0, t._)`${A}`;
|
|
4198
3736
|
}
|
|
4199
|
-
return (0, t._)`${
|
|
3737
|
+
return (0, t._)`${b}${O}${(0, t.getProperty)(V)}`;
|
|
4200
3738
|
}
|
|
4201
3739
|
e.schemaRefOrVal = p;
|
|
4202
|
-
function d(
|
|
4203
|
-
return
|
|
3740
|
+
function d(b) {
|
|
3741
|
+
return v(decodeURIComponent(b));
|
|
4204
3742
|
}
|
|
4205
3743
|
e.unescapeFragment = d;
|
|
4206
|
-
function u(
|
|
4207
|
-
return encodeURIComponent(
|
|
3744
|
+
function u(b) {
|
|
3745
|
+
return encodeURIComponent(_(b));
|
|
4208
3746
|
}
|
|
4209
3747
|
e.escapeFragment = u;
|
|
4210
|
-
function
|
|
4211
|
-
return typeof
|
|
3748
|
+
function _(b) {
|
|
3749
|
+
return typeof b == "number" ? `${b}` : b.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4212
3750
|
}
|
|
4213
|
-
e.escapeJsonPointer =
|
|
4214
|
-
function
|
|
4215
|
-
return
|
|
3751
|
+
e.escapeJsonPointer = _;
|
|
3752
|
+
function v(b) {
|
|
3753
|
+
return b.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
4216
3754
|
}
|
|
4217
|
-
e.unescapeJsonPointer =
|
|
4218
|
-
function
|
|
4219
|
-
if (Array.isArray(
|
|
4220
|
-
for (const A of
|
|
3755
|
+
e.unescapeJsonPointer = v;
|
|
3756
|
+
function w(b, O) {
|
|
3757
|
+
if (Array.isArray(b))
|
|
3758
|
+
for (const A of b)
|
|
4221
3759
|
O(A);
|
|
4222
3760
|
else
|
|
4223
|
-
O(
|
|
3761
|
+
O(b);
|
|
4224
3762
|
}
|
|
4225
|
-
e.eachItem =
|
|
4226
|
-
function
|
|
4227
|
-
return (
|
|
4228
|
-
const ie = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ?
|
|
4229
|
-
return ue === t.Name && !(ie instanceof t.Name) ? x
|
|
3763
|
+
e.eachItem = w;
|
|
3764
|
+
function P({ mergeNames: b, mergeToName: O, mergeValues: A, resultToName: V }) {
|
|
3765
|
+
return (x, re, K, ue) => {
|
|
3766
|
+
const ie = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? b(x, re, K) : O(x, re, K), K) : re instanceof t.Name ? (O(x, K, re), re) : A(re, K);
|
|
3767
|
+
return ue === t.Name && !(ie instanceof t.Name) ? V(x, ie) : ie;
|
|
4230
3768
|
};
|
|
4231
3769
|
}
|
|
4232
3770
|
e.mergeEvaluated = {
|
|
4233
|
-
props:
|
|
4234
|
-
mergeNames: (
|
|
4235
|
-
|
|
3771
|
+
props: P({
|
|
3772
|
+
mergeNames: (b, O, A) => b.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
|
|
3773
|
+
b.if((0, t._)`${O} === true`, () => b.assign(A, !0), () => b.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
|
|
4236
3774
|
}),
|
|
4237
|
-
mergeToName: (
|
|
4238
|
-
O === !0 ?
|
|
3775
|
+
mergeToName: (b, O, A) => b.if((0, t._)`${A} !== true`, () => {
|
|
3776
|
+
O === !0 ? b.assign(A, !0) : (b.assign(A, (0, t._)`${A} || {}`), $(b, A, O));
|
|
4239
3777
|
}),
|
|
4240
|
-
mergeValues: (
|
|
3778
|
+
mergeValues: (b, O) => b === !0 ? !0 : { ...b, ...O },
|
|
4241
3779
|
resultToName: T
|
|
4242
3780
|
}),
|
|
4243
|
-
items:
|
|
4244
|
-
mergeNames: (
|
|
4245
|
-
mergeToName: (
|
|
4246
|
-
mergeValues: (
|
|
4247
|
-
resultToName: (
|
|
3781
|
+
items: P({
|
|
3782
|
+
mergeNames: (b, O, A) => b.if((0, t._)`${A} !== true && ${O} !== undefined`, () => b.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
|
|
3783
|
+
mergeToName: (b, O, A) => b.if((0, t._)`${A} !== true`, () => b.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
|
|
3784
|
+
mergeValues: (b, O) => b === !0 ? !0 : Math.max(b, O),
|
|
3785
|
+
resultToName: (b, O) => b.var("items", O)
|
|
4248
3786
|
})
|
|
4249
3787
|
};
|
|
4250
|
-
function T(
|
|
3788
|
+
function T(b, O) {
|
|
4251
3789
|
if (O === !0)
|
|
4252
|
-
return
|
|
4253
|
-
const A =
|
|
4254
|
-
return O !== void 0 && $(
|
|
3790
|
+
return b.var("props", !0);
|
|
3791
|
+
const A = b.var("props", (0, t._)`{}`);
|
|
3792
|
+
return O !== void 0 && $(b, A, O), A;
|
|
4255
3793
|
}
|
|
4256
3794
|
e.evaluatedPropsToName = T;
|
|
4257
|
-
function $(
|
|
4258
|
-
Object.keys(A).forEach((
|
|
3795
|
+
function $(b, O, A) {
|
|
3796
|
+
Object.keys(A).forEach((V) => b.assign((0, t._)`${O}${(0, t.getProperty)(V)}`, !0));
|
|
4259
3797
|
}
|
|
4260
3798
|
e.setEvaluated = $;
|
|
4261
3799
|
const g = {};
|
|
4262
|
-
function k(
|
|
4263
|
-
return
|
|
3800
|
+
function k(b, O) {
|
|
3801
|
+
return b.scopeValue("func", {
|
|
4264
3802
|
ref: O,
|
|
4265
3803
|
code: g[O.code] || (g[O.code] = new r._Code(O.code))
|
|
4266
3804
|
});
|
|
4267
3805
|
}
|
|
4268
3806
|
e.useFunc = k;
|
|
4269
3807
|
var C;
|
|
4270
|
-
(function(
|
|
4271
|
-
|
|
3808
|
+
(function(b) {
|
|
3809
|
+
b[b.Num = 0] = "Num", b[b.Str = 1] = "Str";
|
|
4272
3810
|
})(C = e.Type || (e.Type = {}));
|
|
4273
|
-
function I(
|
|
4274
|
-
if (
|
|
4275
|
-
const
|
|
4276
|
-
return A ?
|
|
3811
|
+
function I(b, O, A) {
|
|
3812
|
+
if (b instanceof t.Name) {
|
|
3813
|
+
const V = O === C.Num;
|
|
3814
|
+
return A ? V ? (0, t._)`"[" + ${b} + "]"` : (0, t._)`"['" + ${b} + "']"` : V ? (0, t._)`"/" + ${b}` : (0, t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
4277
3815
|
}
|
|
4278
|
-
return A ? (0, t.getProperty)(
|
|
3816
|
+
return A ? (0, t.getProperty)(b).toString() : "/" + _(b);
|
|
4279
3817
|
}
|
|
4280
3818
|
e.getErrorPath = I;
|
|
4281
|
-
function D(
|
|
3819
|
+
function D(b, O, A = b.opts.strictSchema) {
|
|
4282
3820
|
if (A) {
|
|
4283
3821
|
if (O = `strict mode: ${O}`, A === !0)
|
|
4284
3822
|
throw new Error(O);
|
|
4285
|
-
|
|
3823
|
+
b.self.logger.warn(O);
|
|
4286
3824
|
}
|
|
4287
3825
|
}
|
|
4288
3826
|
e.checkStrictMode = D;
|
|
@@ -4322,13 +3860,13 @@ names$1.default = names;
|
|
|
4322
3860
|
message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
|
|
4323
3861
|
};
|
|
4324
3862
|
function s($, g = e.keywordError, k, C) {
|
|
4325
|
-
const { it: I } = $, { gen: D, compositeRule:
|
|
4326
|
-
C ?? (
|
|
3863
|
+
const { it: I } = $, { gen: D, compositeRule: b, allErrors: O } = I, A = _($, g, k);
|
|
3864
|
+
C ?? (b || O) ? p(D, A) : d(I, (0, t._)`[${A}]`);
|
|
4327
3865
|
}
|
|
4328
3866
|
e.reportError = s;
|
|
4329
3867
|
function o($, g = e.keywordError, k) {
|
|
4330
|
-
const { it: C } = $, { gen: I, compositeRule: D, allErrors:
|
|
4331
|
-
p(I, O), D ||
|
|
3868
|
+
const { it: C } = $, { gen: I, compositeRule: D, allErrors: b } = C, O = _($, g, k);
|
|
3869
|
+
p(I, O), D || b || d(C, n.default.vErrors);
|
|
4332
3870
|
}
|
|
4333
3871
|
e.reportExtraError = o;
|
|
4334
3872
|
function i($, g) {
|
|
@@ -4338,9 +3876,9 @@ names$1.default = names;
|
|
|
4338
3876
|
function l({ gen: $, keyword: g, schemaValue: k, data: C, errsCount: I, it: D }) {
|
|
4339
3877
|
if (I === void 0)
|
|
4340
3878
|
throw new Error("ajv implementation error");
|
|
4341
|
-
const
|
|
3879
|
+
const b = $.name("err");
|
|
4342
3880
|
$.forRange("i", I, n.default.errors, (O) => {
|
|
4343
|
-
$.const(
|
|
3881
|
+
$.const(b, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${b}.instancePath === undefined`, () => $.assign((0, t._)`${b}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${b}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${b}.schema`, k), $.assign((0, t._)`${b}.data`, C));
|
|
4344
3882
|
});
|
|
4345
3883
|
}
|
|
4346
3884
|
e.extendErrors = l;
|
|
@@ -4361,28 +3899,28 @@ names$1.default = names;
|
|
|
4361
3899
|
schema: new t.Name("schema"),
|
|
4362
3900
|
parentSchema: new t.Name("parentSchema")
|
|
4363
3901
|
};
|
|
4364
|
-
function
|
|
3902
|
+
function _($, g, k) {
|
|
4365
3903
|
const { createErrors: C } = $.it;
|
|
4366
|
-
return C === !1 ? (0, t._)`{}` :
|
|
3904
|
+
return C === !1 ? (0, t._)`{}` : v($, g, k);
|
|
4367
3905
|
}
|
|
4368
|
-
function
|
|
3906
|
+
function v($, g, k = {}) {
|
|
4369
3907
|
const { gen: C, it: I } = $, D = [
|
|
4370
|
-
|
|
4371
|
-
|
|
3908
|
+
w(I, k),
|
|
3909
|
+
P($, k)
|
|
4372
3910
|
];
|
|
4373
3911
|
return T($, g, D), C.object(...D);
|
|
4374
3912
|
}
|
|
4375
|
-
function
|
|
3913
|
+
function w({ errorPath: $ }, { instancePath: g }) {
|
|
4376
3914
|
const k = g ? (0, t.str)`${$}${(0, r.getErrorPath)(g, r.Type.Str)}` : $;
|
|
4377
3915
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4378
3916
|
}
|
|
4379
|
-
function
|
|
3917
|
+
function P({ keyword: $, it: { errSchemaPath: g } }, { schemaPath: k, parentSchema: C }) {
|
|
4380
3918
|
let I = C ? g : (0, t.str)`${g}/${$}`;
|
|
4381
3919
|
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [u.schemaPath, I];
|
|
4382
3920
|
}
|
|
4383
3921
|
function T($, { params: g, message: k }, C) {
|
|
4384
|
-
const { keyword: I, data: D, schemaValue:
|
|
4385
|
-
C.push([u.keyword, I], [u.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && C.push([u.message, typeof k == "function" ? k($) : k]), A.verbose && C.push([u.schema,
|
|
3922
|
+
const { keyword: I, data: D, schemaValue: b, it: O } = $, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = O;
|
|
3923
|
+
C.push([u.keyword, I], [u.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && C.push([u.message, typeof k == "function" ? k($) : k]), A.verbose && C.push([u.schema, b], [u.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && C.push([u.propertyName, V]);
|
|
4386
3924
|
}
|
|
4387
3925
|
})(errors);
|
|
4388
3926
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4482,58 +4020,58 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4482
4020
|
}
|
|
4483
4021
|
e.getJSONTypes = p;
|
|
4484
4022
|
function d(C, I) {
|
|
4485
|
-
const { gen: D, data:
|
|
4486
|
-
if (
|
|
4487
|
-
const
|
|
4488
|
-
D.if(
|
|
4489
|
-
A.length ?
|
|
4023
|
+
const { gen: D, data: b, opts: O } = C, A = _(I, O.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(C, I[0]));
|
|
4024
|
+
if (V) {
|
|
4025
|
+
const x = T(I, b, O.strictNumbers, i.Wrong);
|
|
4026
|
+
D.if(x, () => {
|
|
4027
|
+
A.length ? v(C, I, A) : g(C);
|
|
4490
4028
|
});
|
|
4491
4029
|
}
|
|
4492
|
-
return
|
|
4030
|
+
return V;
|
|
4493
4031
|
}
|
|
4494
4032
|
e.coerceAndCheckDataType = d;
|
|
4495
4033
|
const u = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4496
|
-
function
|
|
4034
|
+
function _(C, I) {
|
|
4497
4035
|
return I ? C.filter((D) => u.has(D) || I === "array" && D === "array") : [];
|
|
4498
4036
|
}
|
|
4499
|
-
function
|
|
4500
|
-
const { gen:
|
|
4501
|
-
A.coerceTypes === "array" &&
|
|
4037
|
+
function v(C, I, D) {
|
|
4038
|
+
const { gen: b, data: O, opts: A } = C, V = b.let("dataType", (0, s._)`typeof ${O}`), x = b.let("coerced", (0, s._)`undefined`);
|
|
4039
|
+
A.coerceTypes === "array" && b.if((0, s._)`${V} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => b.assign(O, (0, s._)`${O}[0]`).assign(V, (0, s._)`typeof ${O}`).if(T(I, O, A.strictNumbers), () => b.assign(x, O))), b.if((0, s._)`${x} !== undefined`);
|
|
4502
4040
|
for (const K of D)
|
|
4503
4041
|
(u.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4504
|
-
|
|
4505
|
-
|
|
4042
|
+
b.else(), g(C), b.endIf(), b.if((0, s._)`${x} !== undefined`, () => {
|
|
4043
|
+
b.assign(O, x), w(C, x);
|
|
4506
4044
|
});
|
|
4507
4045
|
function re(K) {
|
|
4508
4046
|
switch (K) {
|
|
4509
4047
|
case "string":
|
|
4510
|
-
|
|
4048
|
+
b.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(x, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(x, (0, s._)`""`);
|
|
4511
4049
|
return;
|
|
4512
4050
|
case "number":
|
|
4513
|
-
|
|
4514
|
-
|| (${
|
|
4051
|
+
b.elseIf((0, s._)`${V} == "boolean" || ${O} === null
|
|
4052
|
+
|| (${V} == "string" && ${O} && ${O} == +${O})`).assign(x, (0, s._)`+${O}`);
|
|
4515
4053
|
return;
|
|
4516
4054
|
case "integer":
|
|
4517
|
-
|
|
4518
|
-
|| (${
|
|
4055
|
+
b.elseIf((0, s._)`${V} === "boolean" || ${O} === null
|
|
4056
|
+
|| (${V} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(x, (0, s._)`+${O}`);
|
|
4519
4057
|
return;
|
|
4520
4058
|
case "boolean":
|
|
4521
|
-
|
|
4059
|
+
b.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(x, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(x, !0);
|
|
4522
4060
|
return;
|
|
4523
4061
|
case "null":
|
|
4524
|
-
|
|
4062
|
+
b.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), b.assign(x, null);
|
|
4525
4063
|
return;
|
|
4526
4064
|
case "array":
|
|
4527
|
-
|
|
4528
|
-
|| ${
|
|
4065
|
+
b.elseIf((0, s._)`${V} === "string" || ${V} === "number"
|
|
4066
|
+
|| ${V} === "boolean" || ${O} === null`).assign(x, (0, s._)`[${O}]`);
|
|
4529
4067
|
}
|
|
4530
4068
|
}
|
|
4531
4069
|
}
|
|
4532
|
-
function
|
|
4533
|
-
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${D}]`,
|
|
4070
|
+
function w({ gen: C, parentData: I, parentDataProperty: D }, b) {
|
|
4071
|
+
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${D}]`, b));
|
|
4534
4072
|
}
|
|
4535
|
-
function
|
|
4536
|
-
const O =
|
|
4073
|
+
function P(C, I, D, b = i.Correct) {
|
|
4074
|
+
const O = b === i.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4537
4075
|
let A;
|
|
4538
4076
|
switch (C) {
|
|
4539
4077
|
case "null":
|
|
@@ -4545,33 +4083,33 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4545
4083
|
A = (0, s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;
|
|
4546
4084
|
break;
|
|
4547
4085
|
case "integer":
|
|
4548
|
-
A =
|
|
4086
|
+
A = V((0, s._)`!(${I} % 1) && !isNaN(${I})`);
|
|
4549
4087
|
break;
|
|
4550
4088
|
case "number":
|
|
4551
|
-
A =
|
|
4089
|
+
A = V();
|
|
4552
4090
|
break;
|
|
4553
4091
|
default:
|
|
4554
4092
|
return (0, s._)`typeof ${I} ${O} ${C}`;
|
|
4555
4093
|
}
|
|
4556
|
-
return
|
|
4557
|
-
function x
|
|
4558
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4094
|
+
return b === i.Correct ? A : (0, s.not)(A);
|
|
4095
|
+
function V(x = s.nil) {
|
|
4096
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4559
4097
|
}
|
|
4560
4098
|
}
|
|
4561
|
-
e.checkDataType =
|
|
4562
|
-
function T(C, I, D,
|
|
4099
|
+
e.checkDataType = P;
|
|
4100
|
+
function T(C, I, D, b) {
|
|
4563
4101
|
if (C.length === 1)
|
|
4564
|
-
return
|
|
4102
|
+
return P(C[0], I, D, b);
|
|
4565
4103
|
let O;
|
|
4566
4104
|
const A = (0, o.toHash)(C);
|
|
4567
4105
|
if (A.array && A.object) {
|
|
4568
|
-
const
|
|
4569
|
-
O = A.null ?
|
|
4106
|
+
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4107
|
+
O = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
4570
4108
|
} else
|
|
4571
4109
|
O = s.nil;
|
|
4572
4110
|
A.number && delete A.integer;
|
|
4573
|
-
for (const
|
|
4574
|
-
O = (0, s.and)(O,
|
|
4111
|
+
for (const V in A)
|
|
4112
|
+
O = (0, s.and)(O, P(V, I, D, b));
|
|
4575
4113
|
return O;
|
|
4576
4114
|
}
|
|
4577
4115
|
e.checkDataTypes = T;
|
|
@@ -4585,15 +4123,15 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4585
4123
|
}
|
|
4586
4124
|
e.reportTypeError = g;
|
|
4587
4125
|
function k(C) {
|
|
4588
|
-
const { gen: I, data: D, schema:
|
|
4126
|
+
const { gen: I, data: D, schema: b } = C, O = (0, o.schemaRefOrVal)(C, b, "type");
|
|
4589
4127
|
return {
|
|
4590
4128
|
gen: I,
|
|
4591
4129
|
keyword: "type",
|
|
4592
4130
|
data: D,
|
|
4593
|
-
schema:
|
|
4131
|
+
schema: b.type,
|
|
4594
4132
|
schemaCode: O,
|
|
4595
4133
|
schemaValue: O,
|
|
4596
|
-
parentSchema:
|
|
4134
|
+
parentSchema: b,
|
|
4597
4135
|
params: {},
|
|
4598
4136
|
it: C
|
|
4599
4137
|
};
|
|
@@ -4674,15 +4212,15 @@ function schemaProperties(e, t) {
|
|
|
4674
4212
|
}
|
|
4675
4213
|
code.schemaProperties = schemaProperties;
|
|
4676
4214
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: o }, it: i }, l, p, d) {
|
|
4677
|
-
const u = d ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4215
|
+
const u = d ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, _ = [
|
|
4678
4216
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, o)],
|
|
4679
4217
|
[names_1$5.default.parentData, i.parentData],
|
|
4680
4218
|
[names_1$5.default.parentDataProperty, i.parentDataProperty],
|
|
4681
4219
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4682
4220
|
];
|
|
4683
|
-
i.opts.dynamicRef &&
|
|
4684
|
-
const
|
|
4685
|
-
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${
|
|
4221
|
+
i.opts.dynamicRef && _.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4222
|
+
const v = (0, codegen_1$q._)`${u}, ${r.object(..._)}`;
|
|
4223
|
+
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${v})` : (0, codegen_1$q._)`${l}(${v})`;
|
|
4686
4224
|
}
|
|
4687
4225
|
code.callValidateCode = callValidateCode;
|
|
4688
4226
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4751,31 +4289,31 @@ function funcKeywordCode(e, t) {
|
|
|
4751
4289
|
var r;
|
|
4752
4290
|
const { gen: n, keyword: s, schema: o, parentSchema: i, $data: l, it: p } = e;
|
|
4753
4291
|
checkAsyncKeyword(p, t);
|
|
4754
|
-
const d = !l && t.compile ? t.compile.call(p.self, o, i, p) : t.validate, u = useKeyword(n, s, d),
|
|
4755
|
-
e.block$data(
|
|
4756
|
-
function
|
|
4292
|
+
const d = !l && t.compile ? t.compile.call(p.self, o, i, p) : t.validate, u = useKeyword(n, s, d), _ = n.let("valid");
|
|
4293
|
+
e.block$data(_, v), e.ok((r = t.valid) !== null && r !== void 0 ? r : _);
|
|
4294
|
+
function v() {
|
|
4757
4295
|
if (t.errors === !1)
|
|
4758
4296
|
T(), t.modifying && modifyData(e), $(() => e.error());
|
|
4759
4297
|
else {
|
|
4760
|
-
const g = t.async ?
|
|
4298
|
+
const g = t.async ? w() : P();
|
|
4761
4299
|
t.modifying && modifyData(e), $(() => addErrs(e, g));
|
|
4762
4300
|
}
|
|
4763
4301
|
}
|
|
4764
|
-
function
|
|
4302
|
+
function w() {
|
|
4765
4303
|
const g = n.let("ruleErrs", null);
|
|
4766
|
-
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign(
|
|
4304
|
+
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign(_, !1).if((0, codegen_1$p._)`${k} instanceof ${p.ValidationError}`, () => n.assign(g, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), g;
|
|
4767
4305
|
}
|
|
4768
|
-
function
|
|
4306
|
+
function P() {
|
|
4769
4307
|
const g = (0, codegen_1$p._)`${u}.errors`;
|
|
4770
4308
|
return n.assign(g, null), T(codegen_1$p.nil), g;
|
|
4771
4309
|
}
|
|
4772
4310
|
function T(g = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4773
4311
|
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self, C = !("compile" in t && !l || t.schema === !1);
|
|
4774
|
-
n.assign(
|
|
4312
|
+
n.assign(_, (0, codegen_1$p._)`${g}${(0, code_1$9.callValidateCode)(e, u, k, C)}`, t.modifying);
|
|
4775
4313
|
}
|
|
4776
4314
|
function $(g) {
|
|
4777
4315
|
var k;
|
|
4778
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4316
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : _), g);
|
|
4779
4317
|
}
|
|
4780
4318
|
}
|
|
4781
4319
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4854,8 +4392,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4854
4392
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4855
4393
|
const { gen: l } = t;
|
|
4856
4394
|
if (r !== void 0) {
|
|
4857
|
-
const { errorPath: d, dataPathArr: u, opts:
|
|
4858
|
-
p(
|
|
4395
|
+
const { errorPath: d, dataPathArr: u, opts: _ } = t, v = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4396
|
+
p(v), e.errorPath = (0, codegen_1$o.str)`${d}${(0, util_1$n.getErrorPath)(r, n, _.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...u, e.parentDataProperty];
|
|
4859
4397
|
}
|
|
4860
4398
|
if (s !== void 0) {
|
|
4861
4399
|
const d = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4960,17 +4498,17 @@ function _traverse(e, t, r, n, s, o, i, l, p, d) {
|
|
|
4960
4498
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4961
4499
|
t(n, s, o, i, l, p, d);
|
|
4962
4500
|
for (var u in n) {
|
|
4963
|
-
var
|
|
4964
|
-
if (Array.isArray(
|
|
4501
|
+
var _ = n[u];
|
|
4502
|
+
if (Array.isArray(_)) {
|
|
4965
4503
|
if (u in traverse$1.arrayKeywords)
|
|
4966
|
-
for (var
|
|
4967
|
-
_traverse(e, t, r,
|
|
4504
|
+
for (var v = 0; v < _.length; v++)
|
|
4505
|
+
_traverse(e, t, r, _[v], s + "/" + u + "/" + v, o, s, u, n, v);
|
|
4968
4506
|
} else if (u in traverse$1.propsKeywords) {
|
|
4969
|
-
if (
|
|
4970
|
-
for (var
|
|
4971
|
-
_traverse(e, t, r,
|
|
4507
|
+
if (_ && typeof _ == "object")
|
|
4508
|
+
for (var w in _)
|
|
4509
|
+
_traverse(e, t, r, _[w], s + "/" + u + "/" + escapeJsonPtr(w), o, s, u, n, w);
|
|
4972
4510
|
} else
|
|
4973
|
-
(u in traverse$1.keywords || e.allKeys && !(u in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4511
|
+
(u in traverse$1.keywords || e.allKeys && !(u in traverse$1.skipKeywords)) && _traverse(e, t, r, _, s + "/" + u, o, s, u, n);
|
|
4974
4512
|
}
|
|
4975
4513
|
r(n, s, o, i, l, p, d);
|
|
4976
4514
|
}
|
|
@@ -5054,19 +4592,19 @@ function getSchemaRefs(e, t) {
|
|
|
5054
4592
|
if (typeof e == "boolean")
|
|
5055
4593
|
return {};
|
|
5056
4594
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), o = { "": s }, i = getFullPath(n, s, !1), l = {}, p = /* @__PURE__ */ new Set();
|
|
5057
|
-
return traverse(e, { allKeys: !0 }, (
|
|
5058
|
-
if (
|
|
4595
|
+
return traverse(e, { allKeys: !0 }, (_, v, w, P) => {
|
|
4596
|
+
if (P === void 0)
|
|
5059
4597
|
return;
|
|
5060
|
-
const T = i +
|
|
5061
|
-
let $ = o[
|
|
5062
|
-
typeof
|
|
4598
|
+
const T = i + v;
|
|
4599
|
+
let $ = o[P];
|
|
4600
|
+
typeof _[r] == "string" && ($ = g.call(this, _[r])), k.call(this, _.$anchor), k.call(this, _.$dynamicAnchor), o[v] = $;
|
|
5063
4601
|
function g(C) {
|
|
5064
4602
|
const I = this.opts.uriResolver.resolve;
|
|
5065
4603
|
if (C = normalizeId($ ? I($, C) : C), p.has(C))
|
|
5066
4604
|
throw u(C);
|
|
5067
4605
|
p.add(C);
|
|
5068
4606
|
let D = this.refs[C];
|
|
5069
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? d(
|
|
4607
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? d(_, D.schema, C) : C !== normalizeId(T) && (C[0] === "#" ? (d(_, l[C], C), l[C] = _) : this.refs[C] = T), C;
|
|
5070
4608
|
}
|
|
5071
4609
|
function k(C) {
|
|
5072
4610
|
if (typeof C == "string") {
|
|
@@ -5076,12 +4614,12 @@ function getSchemaRefs(e, t) {
|
|
|
5076
4614
|
}
|
|
5077
4615
|
}
|
|
5078
4616
|
}), l;
|
|
5079
|
-
function d(
|
|
5080
|
-
if (
|
|
5081
|
-
throw u(
|
|
4617
|
+
function d(_, v, w) {
|
|
4618
|
+
if (v !== void 0 && !equal$2(_, v))
|
|
4619
|
+
throw u(w);
|
|
5082
4620
|
}
|
|
5083
|
-
function u(
|
|
5084
|
-
return new Error(`reference "${
|
|
4621
|
+
function u(_) {
|
|
4622
|
+
return new Error(`reference "${_}" resolves to more than one schema`);
|
|
5085
4623
|
}
|
|
5086
4624
|
}
|
|
5087
4625
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -5197,12 +4735,12 @@ function schemaKeywords(e, t, r, n) {
|
|
|
5197
4735
|
return;
|
|
5198
4736
|
}
|
|
5199
4737
|
p.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
5200
|
-
for (const
|
|
5201
|
-
|
|
5202
|
-
|
|
4738
|
+
for (const v of u.rules)
|
|
4739
|
+
_(v);
|
|
4740
|
+
_(u.post);
|
|
5203
4741
|
});
|
|
5204
|
-
function
|
|
5205
|
-
(0, applicability_1.shouldUseGroup)(o,
|
|
4742
|
+
function _(v) {
|
|
4743
|
+
(0, applicability_1.shouldUseGroup)(o, v) && (v.type ? (s.if((0, dataType_2.checkDataType)(v.type, i, p.strictNumbers)), iterateKeywords(e, v), t.length === 1 && t[0] === v.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, v), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
5206
4744
|
}
|
|
5207
4745
|
}
|
|
5208
4746
|
function iterateKeywords(e, t) {
|
|
@@ -5464,21 +5002,21 @@ function compileSchema(e) {
|
|
|
5464
5002
|
let u;
|
|
5465
5003
|
try {
|
|
5466
5004
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(d), i.optimize(this.opts.code.optimize);
|
|
5467
|
-
const
|
|
5468
|
-
u = `${i.scopeRefs(names_1$2.default.scope)}return ${
|
|
5469
|
-
const
|
|
5470
|
-
if (this.scope.value(p, { ref:
|
|
5471
|
-
const { props:
|
|
5472
|
-
|
|
5473
|
-
props:
|
|
5005
|
+
const _ = i.toString();
|
|
5006
|
+
u = `${i.scopeRefs(names_1$2.default.scope)}return ${_}`, this.opts.code.process && (u = this.opts.code.process(u, e));
|
|
5007
|
+
const w = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, u)(this, this.scope.get());
|
|
5008
|
+
if (this.scope.value(p, { ref: w }), w.errors = null, w.schema = e.schema, w.schemaEnv = e, e.$async && (w.$async = !0), this.opts.code.source === !0 && (w.source = { validateName: p, validateCode: _, scopeValues: i._values }), this.opts.unevaluated) {
|
|
5009
|
+
const { props: P, items: T } = d;
|
|
5010
|
+
w.evaluated = {
|
|
5011
|
+
props: P instanceof codegen_1$m.Name ? void 0 : P,
|
|
5474
5012
|
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5475
|
-
dynamicProps:
|
|
5013
|
+
dynamicProps: P instanceof codegen_1$m.Name,
|
|
5476
5014
|
dynamicItems: T instanceof codegen_1$m.Name
|
|
5477
|
-
},
|
|
5015
|
+
}, w.source && (w.source.evaluated = (0, codegen_1$m.stringify)(w.evaluated));
|
|
5478
5016
|
}
|
|
5479
|
-
return e.validate =
|
|
5480
|
-
} catch (
|
|
5481
|
-
throw delete e.validate, delete e.validateName, u && this.logger.error("Error compiling schema, function code:", u),
|
|
5017
|
+
return e.validate = w, e;
|
|
5018
|
+
} catch (_) {
|
|
5019
|
+
throw delete e.validate, delete e.validateName, u && this.logger.error("Error compiling schema, function code:", u), _;
|
|
5482
5020
|
} finally {
|
|
5483
5021
|
this._compilations.delete(e);
|
|
5484
5022
|
}
|
|
@@ -5595,13 +5133,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5595
5133
|
n(t);
|
|
5596
5134
|
})(commonjsGlobal, function(r) {
|
|
5597
5135
|
function n() {
|
|
5598
|
-
for (var f = arguments.length, c = Array(f),
|
|
5599
|
-
c[
|
|
5136
|
+
for (var f = arguments.length, c = Array(f), m = 0; m < f; m++)
|
|
5137
|
+
c[m] = arguments[m];
|
|
5600
5138
|
if (c.length > 1) {
|
|
5601
5139
|
c[0] = c[0].slice(0, -1);
|
|
5602
|
-
for (var
|
|
5603
|
-
c[
|
|
5604
|
-
return c[
|
|
5140
|
+
for (var R = c.length - 1, S = 1; S < R; ++S)
|
|
5141
|
+
c[S] = c[S].slice(1, -1);
|
|
5142
|
+
return c[R] = c[R].slice(1), c.join("");
|
|
5605
5143
|
} else
|
|
5606
5144
|
return c[0];
|
|
5607
5145
|
}
|
|
@@ -5618,20 +5156,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5618
5156
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5619
5157
|
}
|
|
5620
5158
|
function p(f, c) {
|
|
5621
|
-
var
|
|
5159
|
+
var m = f;
|
|
5622
5160
|
if (c)
|
|
5623
|
-
for (var
|
|
5624
|
-
|
|
5625
|
-
return
|
|
5161
|
+
for (var R in c)
|
|
5162
|
+
m[R] = c[R];
|
|
5163
|
+
return m;
|
|
5626
5164
|
}
|
|
5627
5165
|
function d(f) {
|
|
5628
|
-
var c = "[A-Za-z]",
|
|
5629
|
-
s(c + n(c,
|
|
5630
|
-
var
|
|
5631
|
-
s("[vV]" +
|
|
5632
|
-
var ct = s(
|
|
5633
|
-
return s(s(
|
|
5634
|
-
NOT_SCHEME: new RegExp(n("[^]", c,
|
|
5166
|
+
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), S = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5167
|
+
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(S + "|" + n(B, L, "[\\:]")) + "*");
|
|
5168
|
+
var Q = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), oe = s(Q + "\\." + Q + "\\." + Q + "\\." + Q), z = s(R + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + oe), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Ee = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), ge = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), $e = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Ee, ge, $e, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + S) + "+");
|
|
5169
|
+
s("[vV]" + R + "+\\." + n(B, L, "[\\:]") + "+"), s(s(S + "|" + n(B, L)) + "*");
|
|
5170
|
+
var ct = s(S + "|" + n(B, L, "[\\:\\@]"));
|
|
5171
|
+
return s(s(S + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5172
|
+
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5635
5173
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5636
5174
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5637
5175
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
@@ -5641,123 +5179,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5641
5179
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5642
5180
|
UNRESERVED: new RegExp(B, "g"),
|
|
5643
5181
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5644
|
-
PCT_ENCODED: new RegExp(
|
|
5182
|
+
PCT_ENCODED: new RegExp(S, "g"),
|
|
5645
5183
|
IPV4ADDRESS: new RegExp("^(" + oe + ")$"),
|
|
5646
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5184
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5647
5185
|
//RFC 6874, with relaxed parsing rules
|
|
5648
5186
|
};
|
|
5649
5187
|
}
|
|
5650
|
-
var u = d(!1),
|
|
5651
|
-
function f(c,
|
|
5652
|
-
var
|
|
5188
|
+
var u = d(!1), _ = d(!0), v = function() {
|
|
5189
|
+
function f(c, m) {
|
|
5190
|
+
var R = [], S = !0, U = !1, L = void 0;
|
|
5653
5191
|
try {
|
|
5654
|
-
for (var J = c[Symbol.iterator](), Y; !(
|
|
5192
|
+
for (var J = c[Symbol.iterator](), Y; !(S = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); S = !0)
|
|
5655
5193
|
;
|
|
5656
5194
|
} catch (se) {
|
|
5657
5195
|
U = !0, L = se;
|
|
5658
5196
|
} finally {
|
|
5659
5197
|
try {
|
|
5660
|
-
!
|
|
5198
|
+
!S && J.return && J.return();
|
|
5661
5199
|
} finally {
|
|
5662
5200
|
if (U)
|
|
5663
5201
|
throw L;
|
|
5664
5202
|
}
|
|
5665
5203
|
}
|
|
5666
|
-
return
|
|
5204
|
+
return R;
|
|
5667
5205
|
}
|
|
5668
|
-
return function(c,
|
|
5206
|
+
return function(c, m) {
|
|
5669
5207
|
if (Array.isArray(c))
|
|
5670
5208
|
return c;
|
|
5671
5209
|
if (Symbol.iterator in Object(c))
|
|
5672
|
-
return f(c,
|
|
5210
|
+
return f(c, m);
|
|
5673
5211
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5674
5212
|
};
|
|
5675
|
-
}(),
|
|
5213
|
+
}(), w = function(f) {
|
|
5676
5214
|
if (Array.isArray(f)) {
|
|
5677
|
-
for (var c = 0,
|
|
5678
|
-
|
|
5679
|
-
return
|
|
5215
|
+
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5216
|
+
m[c] = f[c];
|
|
5217
|
+
return m;
|
|
5680
5218
|
} else
|
|
5681
5219
|
return Array.from(f);
|
|
5682
|
-
},
|
|
5220
|
+
}, P = 2147483647, T = 36, $ = 1, g = 26, k = 38, C = 700, I = 72, D = 128, b = "-", O = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5683
5221
|
overflow: "Overflow: input needs wider integers to process",
|
|
5684
5222
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5685
5223
|
"invalid-input": "Invalid input"
|
|
5686
5224
|
}, re = T - $, K = Math.floor, ue = String.fromCharCode;
|
|
5687
5225
|
function ie(f) {
|
|
5688
|
-
throw new RangeError(
|
|
5226
|
+
throw new RangeError(x[f]);
|
|
5689
5227
|
}
|
|
5690
5228
|
function ke(f, c) {
|
|
5691
|
-
for (var
|
|
5692
|
-
|
|
5693
|
-
return
|
|
5229
|
+
for (var m = [], R = f.length; R--; )
|
|
5230
|
+
m[R] = c(f[R]);
|
|
5231
|
+
return m;
|
|
5694
5232
|
}
|
|
5695
5233
|
function Ce(f, c) {
|
|
5696
|
-
var
|
|
5697
|
-
|
|
5698
|
-
var
|
|
5699
|
-
return
|
|
5234
|
+
var m = f.split("@"), R = "";
|
|
5235
|
+
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5236
|
+
var S = f.split("."), U = ke(S, c).join(".");
|
|
5237
|
+
return R + U;
|
|
5700
5238
|
}
|
|
5701
5239
|
function qe(f) {
|
|
5702
|
-
for (var c = [],
|
|
5703
|
-
var
|
|
5704
|
-
if (
|
|
5705
|
-
var U = f.charCodeAt(
|
|
5706
|
-
(U & 64512) == 56320 ? c.push(((
|
|
5240
|
+
for (var c = [], m = 0, R = f.length; m < R; ) {
|
|
5241
|
+
var S = f.charCodeAt(m++);
|
|
5242
|
+
if (S >= 55296 && S <= 56319 && m < R) {
|
|
5243
|
+
var U = f.charCodeAt(m++);
|
|
5244
|
+
(U & 64512) == 56320 ? c.push(((S & 1023) << 10) + (U & 1023) + 65536) : (c.push(S), m--);
|
|
5707
5245
|
} else
|
|
5708
|
-
c.push(
|
|
5246
|
+
c.push(S);
|
|
5709
5247
|
}
|
|
5710
5248
|
return c;
|
|
5711
5249
|
}
|
|
5712
5250
|
var et = function(c) {
|
|
5713
|
-
return String.fromCodePoint.apply(String,
|
|
5714
|
-
},
|
|
5251
|
+
return String.fromCodePoint.apply(String, w(c));
|
|
5252
|
+
}, Ue = function(c) {
|
|
5715
5253
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5716
|
-
}, F = function(c,
|
|
5717
|
-
return c + 22 + 75 * (c < 26) - ((
|
|
5718
|
-
}, y = function(c,
|
|
5719
|
-
var
|
|
5254
|
+
}, F = function(c, m) {
|
|
5255
|
+
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5256
|
+
}, y = function(c, m, R) {
|
|
5257
|
+
var S = 0;
|
|
5720
5258
|
for (
|
|
5721
|
-
c =
|
|
5259
|
+
c = R ? K(c / C) : c >> 1, c += K(c / m);
|
|
5722
5260
|
/* no initialization */
|
|
5723
5261
|
c > re * g >> 1;
|
|
5724
|
-
|
|
5262
|
+
S += T
|
|
5725
5263
|
)
|
|
5726
5264
|
c = K(c / re);
|
|
5727
|
-
return K(
|
|
5265
|
+
return K(S + (re + 1) * c / (c + k));
|
|
5728
5266
|
}, j = function(c) {
|
|
5729
|
-
var
|
|
5267
|
+
var m = [], R = c.length, S = 0, U = D, L = I, J = c.lastIndexOf(b);
|
|
5730
5268
|
J < 0 && (J = 0);
|
|
5731
5269
|
for (var Y = 0; Y < J; ++Y)
|
|
5732
|
-
c.charCodeAt(Y) >= 128 && ie("not-basic"),
|
|
5733
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5270
|
+
c.charCodeAt(Y) >= 128 && ie("not-basic"), m.push(c.charCodeAt(Y));
|
|
5271
|
+
for (var se = J > 0 ? J + 1 : 0; se < R; ) {
|
|
5734
5272
|
for (
|
|
5735
|
-
var B =
|
|
5273
|
+
var B = S, Q = 1, oe = T;
|
|
5736
5274
|
;
|
|
5737
5275
|
/* no condition */
|
|
5738
5276
|
oe += T
|
|
5739
5277
|
) {
|
|
5740
|
-
se >=
|
|
5741
|
-
var
|
|
5742
|
-
(
|
|
5278
|
+
se >= R && ie("invalid-input");
|
|
5279
|
+
var z = Ue(c.charCodeAt(se++));
|
|
5280
|
+
(z >= T || z > K((P - S) / Q)) && ie("overflow"), S += z * Q;
|
|
5743
5281
|
var X = oe <= L ? $ : oe >= L + g ? g : oe - L;
|
|
5744
|
-
if (
|
|
5282
|
+
if (z < X)
|
|
5745
5283
|
break;
|
|
5746
5284
|
var ae = T - X;
|
|
5747
|
-
|
|
5285
|
+
Q > K(P / ae) && ie("overflow"), Q *= ae;
|
|
5748
5286
|
}
|
|
5749
|
-
var ee =
|
|
5750
|
-
L = y(
|
|
5287
|
+
var ee = m.length + 1;
|
|
5288
|
+
L = y(S - B, ee, B == 0), K(S / ee) > P - U && ie("overflow"), U += K(S / ee), S %= ee, m.splice(S++, 0, U);
|
|
5751
5289
|
}
|
|
5752
|
-
return String.fromCodePoint.apply(String,
|
|
5753
|
-
},
|
|
5754
|
-
var
|
|
5290
|
+
return String.fromCodePoint.apply(String, m);
|
|
5291
|
+
}, E = function(c) {
|
|
5292
|
+
var m = [];
|
|
5755
5293
|
c = qe(c);
|
|
5756
|
-
var
|
|
5294
|
+
var R = c.length, S = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5757
5295
|
try {
|
|
5758
|
-
for (var B = c[Symbol.iterator](),
|
|
5759
|
-
var oe =
|
|
5760
|
-
oe < 128 &&
|
|
5296
|
+
for (var B = c[Symbol.iterator](), Q; !(J = (Q = B.next()).done); J = !0) {
|
|
5297
|
+
var oe = Q.value;
|
|
5298
|
+
oe < 128 && m.push(ue(oe));
|
|
5761
5299
|
}
|
|
5762
5300
|
} catch (lt) {
|
|
5763
5301
|
Y = !0, se = lt;
|
|
@@ -5769,13 +5307,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5769
5307
|
throw se;
|
|
5770
5308
|
}
|
|
5771
5309
|
}
|
|
5772
|
-
var
|
|
5773
|
-
for (
|
|
5774
|
-
var ae =
|
|
5310
|
+
var z = m.length, X = z;
|
|
5311
|
+
for (z && m.push(b); X < R; ) {
|
|
5312
|
+
var ae = P, ee = !0, Ee = !1, ge = void 0;
|
|
5775
5313
|
try {
|
|
5776
|
-
for (var $e = c[Symbol.iterator](),
|
|
5777
|
-
var Ie =
|
|
5778
|
-
Ie >=
|
|
5314
|
+
for (var $e = c[Symbol.iterator](), Be; !(ee = (Be = $e.next()).done); ee = !0) {
|
|
5315
|
+
var Ie = Be.value;
|
|
5316
|
+
Ie >= S && Ie < ae && (ae = Ie);
|
|
5779
5317
|
}
|
|
5780
5318
|
} catch (lt) {
|
|
5781
5319
|
Ee = !0, ge = lt;
|
|
@@ -5788,12 +5326,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5788
5326
|
}
|
|
5789
5327
|
}
|
|
5790
5328
|
var fe = X + 1;
|
|
5791
|
-
ae -
|
|
5792
|
-
var ye = !0, je = !1,
|
|
5329
|
+
ae - S > K((P - U) / fe) && ie("overflow"), U += (ae - S) * fe, S = ae;
|
|
5330
|
+
var ye = !0, je = !1, we = void 0;
|
|
5793
5331
|
try {
|
|
5794
5332
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5795
5333
|
var Ht = Lt.value;
|
|
5796
|
-
if (Ht <
|
|
5334
|
+
if (Ht < S && ++U > P && ie("overflow"), Ht == S) {
|
|
5797
5335
|
for (
|
|
5798
5336
|
var pt = U, ft = T;
|
|
5799
5337
|
;
|
|
@@ -5803,32 +5341,32 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5803
5341
|
var ht = ft <= L ? $ : ft >= L + g ? g : ft - L;
|
|
5804
5342
|
if (pt < ht)
|
|
5805
5343
|
break;
|
|
5806
|
-
var
|
|
5807
|
-
|
|
5344
|
+
var Vt = pt - ht, zt = T - ht;
|
|
5345
|
+
m.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5808
5346
|
}
|
|
5809
|
-
|
|
5347
|
+
m.push(ue(F(pt, 0))), L = y(U, fe, X == z), U = 0, ++X;
|
|
5810
5348
|
}
|
|
5811
5349
|
}
|
|
5812
5350
|
} catch (lt) {
|
|
5813
|
-
je = !0,
|
|
5351
|
+
je = !0, we = lt;
|
|
5814
5352
|
} finally {
|
|
5815
5353
|
try {
|
|
5816
5354
|
!ye && ct.return && ct.return();
|
|
5817
5355
|
} finally {
|
|
5818
5356
|
if (je)
|
|
5819
|
-
throw
|
|
5357
|
+
throw we;
|
|
5820
5358
|
}
|
|
5821
5359
|
}
|
|
5822
|
-
++U, ++
|
|
5360
|
+
++U, ++S;
|
|
5823
5361
|
}
|
|
5824
|
-
return
|
|
5362
|
+
return m.join("");
|
|
5825
5363
|
}, a = function(c) {
|
|
5826
|
-
return Ce(c, function(
|
|
5827
|
-
return O.test(
|
|
5364
|
+
return Ce(c, function(m) {
|
|
5365
|
+
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5828
5366
|
});
|
|
5829
5367
|
}, h = function(c) {
|
|
5830
|
-
return Ce(c, function(
|
|
5831
|
-
return A.test(
|
|
5368
|
+
return Ce(c, function(m) {
|
|
5369
|
+
return A.test(m) ? "xn--" + E(m) : m;
|
|
5832
5370
|
});
|
|
5833
5371
|
}, N = {
|
|
5834
5372
|
/**
|
|
@@ -5849,70 +5387,70 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5849
5387
|
encode: et
|
|
5850
5388
|
},
|
|
5851
5389
|
decode: j,
|
|
5852
|
-
encode:
|
|
5390
|
+
encode: E,
|
|
5853
5391
|
toASCII: h,
|
|
5854
5392
|
toUnicode: a
|
|
5855
|
-
},
|
|
5856
|
-
function
|
|
5857
|
-
var c = f.charCodeAt(0),
|
|
5858
|
-
return c < 16 ?
|
|
5393
|
+
}, M = {};
|
|
5394
|
+
function q(f) {
|
|
5395
|
+
var c = f.charCodeAt(0), m = void 0;
|
|
5396
|
+
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5859
5397
|
}
|
|
5860
5398
|
function W(f) {
|
|
5861
|
-
for (var c = "",
|
|
5862
|
-
var
|
|
5863
|
-
if (
|
|
5864
|
-
c += String.fromCharCode(
|
|
5865
|
-
else if (
|
|
5866
|
-
if (
|
|
5867
|
-
var U = parseInt(f.substr(
|
|
5868
|
-
c += String.fromCharCode((
|
|
5399
|
+
for (var c = "", m = 0, R = f.length; m < R; ) {
|
|
5400
|
+
var S = parseInt(f.substr(m + 1, 2), 16);
|
|
5401
|
+
if (S < 128)
|
|
5402
|
+
c += String.fromCharCode(S), m += 3;
|
|
5403
|
+
else if (S >= 194 && S < 224) {
|
|
5404
|
+
if (R - m >= 6) {
|
|
5405
|
+
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5406
|
+
c += String.fromCharCode((S & 31) << 6 | U & 63);
|
|
5869
5407
|
} else
|
|
5870
|
-
c += f.substr(
|
|
5871
|
-
|
|
5872
|
-
} else if (
|
|
5873
|
-
if (
|
|
5874
|
-
var L = parseInt(f.substr(
|
|
5875
|
-
c += String.fromCharCode((
|
|
5408
|
+
c += f.substr(m, 6);
|
|
5409
|
+
m += 6;
|
|
5410
|
+
} else if (S >= 224) {
|
|
5411
|
+
if (R - m >= 9) {
|
|
5412
|
+
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5413
|
+
c += String.fromCharCode((S & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5876
5414
|
} else
|
|
5877
|
-
c += f.substr(
|
|
5878
|
-
|
|
5415
|
+
c += f.substr(m, 9);
|
|
5416
|
+
m += 9;
|
|
5879
5417
|
} else
|
|
5880
|
-
c += f.substr(
|
|
5418
|
+
c += f.substr(m, 3), m += 3;
|
|
5881
5419
|
}
|
|
5882
5420
|
return c;
|
|
5883
5421
|
}
|
|
5884
5422
|
function G(f, c) {
|
|
5885
|
-
function
|
|
5886
|
-
var
|
|
5887
|
-
return
|
|
5423
|
+
function m(R) {
|
|
5424
|
+
var S = W(R);
|
|
5425
|
+
return S.match(c.UNRESERVED) ? S : R;
|
|
5888
5426
|
}
|
|
5889
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED,
|
|
5427
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, i)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, i)), f.path !== void 0 && (f.path = String(f.path).replace(c.PCT_ENCODED, m).replace(f.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, i)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, i)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, i)), f;
|
|
5890
5428
|
}
|
|
5891
5429
|
function ne(f) {
|
|
5892
5430
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5893
5431
|
}
|
|
5894
5432
|
function he(f, c) {
|
|
5895
|
-
var
|
|
5896
|
-
return
|
|
5897
|
-
}
|
|
5898
|
-
function
|
|
5899
|
-
var
|
|
5900
|
-
if (
|
|
5901
|
-
for (var L =
|
|
5902
|
-
ae[ee] = B[ee] ||
|
|
5903
|
-
oe && (ae[
|
|
5433
|
+
var m = f.match(c.IPV4ADDRESS) || [], R = v(m, 2), S = R[1];
|
|
5434
|
+
return S ? S.split(".").map(ne).join(".") : f;
|
|
5435
|
+
}
|
|
5436
|
+
function Le(f, c) {
|
|
5437
|
+
var m = f.match(c.IPV6ADDRESS) || [], R = v(m, 3), S = R[1], U = R[2];
|
|
5438
|
+
if (S) {
|
|
5439
|
+
for (var L = S.toLowerCase().split("::").reverse(), J = v(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Q = Y.split(":").map(ne), oe = c.IPV4ADDRESS.test(Q[Q.length - 1]), z = oe ? 7 : 8, X = Q.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5440
|
+
ae[ee] = B[ee] || Q[X + ee] || "";
|
|
5441
|
+
oe && (ae[z - 1] = he(ae[z - 1], c));
|
|
5904
5442
|
var Ee = ae.reduce(function(fe, ye, je) {
|
|
5905
5443
|
if (!ye || ye === "0") {
|
|
5906
|
-
var
|
|
5907
|
-
|
|
5444
|
+
var we = fe[fe.length - 1];
|
|
5445
|
+
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5908
5446
|
}
|
|
5909
5447
|
return fe;
|
|
5910
5448
|
}, []), ge = Ee.sort(function(fe, ye) {
|
|
5911
5449
|
return ye.length - fe.length;
|
|
5912
5450
|
})[0], $e = void 0;
|
|
5913
5451
|
if (ge && ge.length > 1) {
|
|
5914
|
-
var
|
|
5915
|
-
$e =
|
|
5452
|
+
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5453
|
+
$e = Be.join(":") + "::" + Ie.join(":");
|
|
5916
5454
|
} else
|
|
5917
5455
|
$e = ae.join(":");
|
|
5918
5456
|
return U && ($e += "%" + U), $e;
|
|
@@ -5921,101 +5459,101 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5921
5459
|
}
|
|
5922
5460
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5923
5461
|
function de(f) {
|
|
5924
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5462
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ? _ : u;
|
|
5925
5463
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5926
|
-
var
|
|
5927
|
-
if (
|
|
5928
|
-
rt ? (
|
|
5929
|
-
var U =
|
|
5464
|
+
var S = f.match(tt);
|
|
5465
|
+
if (S) {
|
|
5466
|
+
rt ? (m.scheme = S[1], m.userinfo = S[3], m.host = S[4], m.port = parseInt(S[5], 10), m.path = S[6] || "", m.query = S[7], m.fragment = S[8], isNaN(m.port) && (m.port = S[5])) : (m.scheme = S[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? S[3] : void 0, m.host = f.indexOf("//") !== -1 ? S[4] : void 0, m.port = parseInt(S[5], 10), m.path = S[6] || "", m.query = f.indexOf("?") !== -1 ? S[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? S[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? S[4] : void 0)), m.host && (m.host = Le(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5467
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5930
5468
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5931
|
-
if (
|
|
5469
|
+
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5932
5470
|
try {
|
|
5933
|
-
|
|
5471
|
+
m.host = N.toASCII(m.host.replace(R.PCT_ENCODED, W).toLowerCase());
|
|
5934
5472
|
} catch (L) {
|
|
5935
|
-
|
|
5473
|
+
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5936
5474
|
}
|
|
5937
|
-
G(
|
|
5475
|
+
G(m, u);
|
|
5938
5476
|
} else
|
|
5939
|
-
G(
|
|
5940
|
-
U && U.parse && U.parse(
|
|
5477
|
+
G(m, R);
|
|
5478
|
+
U && U.parse && U.parse(m, c);
|
|
5941
5479
|
} else
|
|
5942
|
-
|
|
5943
|
-
return
|
|
5480
|
+
m.error = m.error || "URI can not be parsed.";
|
|
5481
|
+
return m;
|
|
5944
5482
|
}
|
|
5945
5483
|
function nt(f, c) {
|
|
5946
|
-
var
|
|
5947
|
-
return f.userinfo !== void 0 && (
|
|
5484
|
+
var m = c.iri !== !1 ? _ : u, R = [];
|
|
5485
|
+
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(S, U, L) {
|
|
5948
5486
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5949
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5487
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
|
|
5950
5488
|
}
|
|
5951
|
-
var
|
|
5489
|
+
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5952
5490
|
function me(f) {
|
|
5953
5491
|
for (var c = []; f.length; )
|
|
5954
|
-
if (f.match(
|
|
5955
|
-
f = f.replace(
|
|
5956
|
-
else if (f.match(
|
|
5957
|
-
f = f.replace(
|
|
5958
|
-
else if (f.match(
|
|
5959
|
-
f = f.replace(
|
|
5492
|
+
if (f.match(He))
|
|
5493
|
+
f = f.replace(He, "");
|
|
5494
|
+
else if (f.match(Ve))
|
|
5495
|
+
f = f.replace(Ve, "/");
|
|
5496
|
+
else if (f.match(ze))
|
|
5497
|
+
f = f.replace(ze, "/"), c.pop();
|
|
5960
5498
|
else if (f === "." || f === "..")
|
|
5961
5499
|
f = "";
|
|
5962
5500
|
else {
|
|
5963
|
-
var
|
|
5964
|
-
if (
|
|
5965
|
-
var
|
|
5966
|
-
f = f.slice(
|
|
5501
|
+
var m = f.match(st);
|
|
5502
|
+
if (m) {
|
|
5503
|
+
var R = m[0];
|
|
5504
|
+
f = f.slice(R.length), c.push(R);
|
|
5967
5505
|
} else
|
|
5968
5506
|
throw new Error("Unexpected dot segment condition");
|
|
5969
5507
|
}
|
|
5970
5508
|
return c.join("");
|
|
5971
5509
|
}
|
|
5972
5510
|
function le(f) {
|
|
5973
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5974
|
-
if (
|
|
5975
|
-
if (c.domainHost ||
|
|
5511
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? _ : u, R = [], S = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5512
|
+
if (S && S.serialize && S.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5513
|
+
if (c.domainHost || S && S.domainHost)
|
|
5976
5514
|
try {
|
|
5977
|
-
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(
|
|
5515
|
+
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5978
5516
|
} catch (J) {
|
|
5979
5517
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5980
5518
|
}
|
|
5981
5519
|
}
|
|
5982
|
-
G(f,
|
|
5520
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5983
5521
|
var U = nt(f, c);
|
|
5984
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5522
|
+
if (U !== void 0 && (c.reference !== "suffix" && R.push("//"), R.push(U), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
|
|
5985
5523
|
var L = f.path;
|
|
5986
|
-
!c.absolutePath && (!
|
|
5524
|
+
!c.absolutePath && (!S || !S.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), R.push(L);
|
|
5987
5525
|
}
|
|
5988
|
-
return f.query !== void 0 && (
|
|
5526
|
+
return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
|
|
5989
5527
|
}
|
|
5990
|
-
function
|
|
5991
|
-
var
|
|
5992
|
-
return
|
|
5528
|
+
function xe(f, c) {
|
|
5529
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], S = {};
|
|
5530
|
+
return R || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (S.scheme = c.scheme, S.userinfo = c.userinfo, S.host = c.host, S.port = c.port, S.path = me(c.path || ""), S.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (S.userinfo = c.userinfo, S.host = c.host, S.port = c.port, S.path = me(c.path || ""), S.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? S.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? S.path = "/" + c.path : f.path ? S.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : S.path = c.path, S.path = me(S.path)), S.query = c.query) : (S.path = f.path, c.query !== void 0 ? S.query = c.query : S.query = f.query), S.userinfo = f.userinfo, S.host = f.host, S.port = f.port), S.scheme = f.scheme), S.fragment = c.fragment, S;
|
|
5993
5531
|
}
|
|
5994
|
-
function ot(f, c,
|
|
5995
|
-
var
|
|
5996
|
-
return le(
|
|
5532
|
+
function ot(f, c, m) {
|
|
5533
|
+
var R = p({ scheme: "null" }, m);
|
|
5534
|
+
return le(xe(de(f, R), de(c, R), R, !0), R);
|
|
5997
5535
|
}
|
|
5998
5536
|
function Oe(f, c) {
|
|
5999
5537
|
return typeof f == "string" ? f = le(de(f, c), c) : o(f) === "object" && (f = de(le(f, c), c)), f;
|
|
6000
5538
|
}
|
|
6001
|
-
function it(f, c,
|
|
6002
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5539
|
+
function it(f, c, m) {
|
|
5540
|
+
return typeof f == "string" ? f = le(de(f, m), m) : o(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : o(c) === "object" && (c = le(c, m)), f === c;
|
|
6003
5541
|
}
|
|
6004
5542
|
function ut(f, c) {
|
|
6005
|
-
return f && f.toString().replace(!c || !c.iri ? u.ESCAPE :
|
|
5543
|
+
return f && f.toString().replace(!c || !c.iri ? u.ESCAPE : _.ESCAPE, q);
|
|
6006
5544
|
}
|
|
6007
5545
|
function pe(f, c) {
|
|
6008
|
-
return f && f.toString().replace(!c || !c.iri ? u.PCT_ENCODED :
|
|
5546
|
+
return f && f.toString().replace(!c || !c.iri ? u.PCT_ENCODED : _.PCT_ENCODED, W);
|
|
6009
5547
|
}
|
|
6010
5548
|
var Ne = {
|
|
6011
5549
|
scheme: "http",
|
|
6012
5550
|
domainHost: !0,
|
|
6013
|
-
parse: function(c,
|
|
5551
|
+
parse: function(c, m) {
|
|
6014
5552
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
6015
5553
|
},
|
|
6016
|
-
serialize: function(c,
|
|
6017
|
-
var
|
|
6018
|
-
return (c.port === (
|
|
5554
|
+
serialize: function(c, m) {
|
|
5555
|
+
var R = String(c.scheme).toLowerCase() === "https";
|
|
5556
|
+
return (c.port === (R ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
6019
5557
|
}
|
|
6020
5558
|
}, It = {
|
|
6021
5559
|
scheme: "https",
|
|
@@ -6029,13 +5567,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6029
5567
|
var at = {
|
|
6030
5568
|
scheme: "ws",
|
|
6031
5569
|
domainHost: !0,
|
|
6032
|
-
parse: function(c,
|
|
6033
|
-
var
|
|
6034
|
-
return
|
|
5570
|
+
parse: function(c, m) {
|
|
5571
|
+
var R = c;
|
|
5572
|
+
return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
6035
5573
|
},
|
|
6036
|
-
serialize: function(c,
|
|
5574
|
+
serialize: function(c, m) {
|
|
6037
5575
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
6038
|
-
var
|
|
5576
|
+
var R = c.resourceName.split("?"), S = v(R, 2), U = S[0], L = S[1];
|
|
6039
5577
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
6040
5578
|
}
|
|
6041
5579
|
return c.fragment = void 0, c;
|
|
@@ -6045,101 +5583,101 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6045
5583
|
domainHost: at.domainHost,
|
|
6046
5584
|
parse: at.parse,
|
|
6047
5585
|
serialize: at.serialize
|
|
6048
|
-
}, or = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", ir = 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"),
|
|
5586
|
+
}, or = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", ir = 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(ir, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
6049
5587
|
function Ot(f) {
|
|
6050
5588
|
var c = W(f);
|
|
6051
5589
|
return c.match(ur) ? c : f;
|
|
6052
5590
|
}
|
|
6053
|
-
var
|
|
5591
|
+
var Mt = {
|
|
6054
5592
|
scheme: "mailto",
|
|
6055
|
-
parse: function(c,
|
|
6056
|
-
var
|
|
6057
|
-
if (
|
|
6058
|
-
for (var U = !1, L = {}, J =
|
|
5593
|
+
parse: function(c, m) {
|
|
5594
|
+
var R = c, S = R.to = R.path ? R.path.split(",") : [];
|
|
5595
|
+
if (R.path = void 0, R.query) {
|
|
5596
|
+
for (var U = !1, L = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
6059
5597
|
var B = J[Y].split("=");
|
|
6060
5598
|
switch (B[0]) {
|
|
6061
5599
|
case "to":
|
|
6062
|
-
for (var
|
|
6063
|
-
|
|
5600
|
+
for (var Q = B[1].split(","), oe = 0, z = Q.length; oe < z; ++oe)
|
|
5601
|
+
S.push(Q[oe]);
|
|
6064
5602
|
break;
|
|
6065
5603
|
case "subject":
|
|
6066
|
-
|
|
5604
|
+
R.subject = pe(B[1], m);
|
|
6067
5605
|
break;
|
|
6068
5606
|
case "body":
|
|
6069
|
-
|
|
5607
|
+
R.body = pe(B[1], m);
|
|
6070
5608
|
break;
|
|
6071
5609
|
default:
|
|
6072
|
-
U = !0, L[pe(B[0],
|
|
5610
|
+
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
6073
5611
|
break;
|
|
6074
5612
|
}
|
|
6075
5613
|
}
|
|
6076
|
-
U && (
|
|
5614
|
+
U && (R.headers = L);
|
|
6077
5615
|
}
|
|
6078
|
-
|
|
6079
|
-
for (var X = 0, ae =
|
|
6080
|
-
var ee =
|
|
6081
|
-
if (ee[0] = pe(ee[0]),
|
|
6082
|
-
ee[1] = pe(ee[1],
|
|
5616
|
+
R.query = void 0;
|
|
5617
|
+
for (var X = 0, ae = S.length; X < ae; ++X) {
|
|
5618
|
+
var ee = S[X].split("@");
|
|
5619
|
+
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5620
|
+
ee[1] = pe(ee[1], m).toLowerCase();
|
|
6083
5621
|
else
|
|
6084
5622
|
try {
|
|
6085
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5623
|
+
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
6086
5624
|
} catch (Ee) {
|
|
6087
|
-
|
|
5625
|
+
R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Ee;
|
|
6088
5626
|
}
|
|
6089
|
-
|
|
5627
|
+
S[X] = ee.join("@");
|
|
6090
5628
|
}
|
|
6091
|
-
return
|
|
5629
|
+
return R;
|
|
6092
5630
|
},
|
|
6093
|
-
serialize: function(c,
|
|
6094
|
-
var
|
|
6095
|
-
if (
|
|
6096
|
-
for (var U = 0, L =
|
|
6097
|
-
var J = String(
|
|
5631
|
+
serialize: function(c, m) {
|
|
5632
|
+
var R = c, S = l(c.to);
|
|
5633
|
+
if (S) {
|
|
5634
|
+
for (var U = 0, L = S.length; U < L; ++U) {
|
|
5635
|
+
var J = String(S[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, i).replace(pr, q), B = J.slice(Y + 1);
|
|
6098
5636
|
try {
|
|
6099
|
-
B =
|
|
5637
|
+
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
6100
5638
|
} catch (X) {
|
|
6101
|
-
|
|
5639
|
+
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
6102
5640
|
}
|
|
6103
|
-
|
|
5641
|
+
S[U] = se + "@" + B;
|
|
6104
5642
|
}
|
|
6105
|
-
|
|
5643
|
+
R.path = S.join(",");
|
|
6106
5644
|
}
|
|
6107
|
-
var
|
|
6108
|
-
c.subject && (
|
|
5645
|
+
var Q = c.headers = c.headers || {};
|
|
5646
|
+
c.subject && (Q.subject = c.subject), c.body && (Q.body = c.body);
|
|
6109
5647
|
var oe = [];
|
|
6110
|
-
for (var
|
|
6111
|
-
|
|
6112
|
-
return oe.length && (
|
|
5648
|
+
for (var z in Q)
|
|
5649
|
+
Q[z] !== or[z] && oe.push(z.replace(We, Ot).replace(We, i).replace(Ft, q) + "=" + Q[z].replace(We, Ot).replace(We, i).replace(fr, q));
|
|
5650
|
+
return oe.length && (R.query = oe.join("&")), R;
|
|
6113
5651
|
}
|
|
6114
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5652
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
6115
5653
|
scheme: "urn",
|
|
6116
|
-
parse: function(c,
|
|
6117
|
-
var
|
|
6118
|
-
if (
|
|
6119
|
-
var U =
|
|
6120
|
-
|
|
5654
|
+
parse: function(c, m) {
|
|
5655
|
+
var R = c.path && c.path.match(hr), S = c;
|
|
5656
|
+
if (R) {
|
|
5657
|
+
var U = m.scheme || S.scheme || "urn", L = R[1].toLowerCase(), J = R[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5658
|
+
S.nid = L, S.nss = J, S.path = void 0, se && (S = se.parse(S, m));
|
|
6121
5659
|
} else
|
|
6122
|
-
|
|
6123
|
-
return
|
|
5660
|
+
S.error = S.error || "URN can not be parsed.";
|
|
5661
|
+
return S;
|
|
6124
5662
|
},
|
|
6125
|
-
serialize: function(c,
|
|
6126
|
-
var
|
|
6127
|
-
L && (c = L.serialize(c,
|
|
5663
|
+
serialize: function(c, m) {
|
|
5664
|
+
var R = m.scheme || c.scheme || "urn", S = c.nid, U = R + ":" + (m.nid || S), L = M[U];
|
|
5665
|
+
L && (c = L.serialize(c, m));
|
|
6128
5666
|
var J = c, Y = c.nss;
|
|
6129
|
-
return J.path = (
|
|
5667
|
+
return J.path = (S || m.nid) + ":" + Y, J;
|
|
6130
5668
|
}
|
|
6131
5669
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
6132
5670
|
scheme: "urn:uuid",
|
|
6133
|
-
parse: function(c,
|
|
6134
|
-
var
|
|
6135
|
-
return
|
|
5671
|
+
parse: function(c, m) {
|
|
5672
|
+
var R = c;
|
|
5673
|
+
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;
|
|
6136
5674
|
},
|
|
6137
|
-
serialize: function(c,
|
|
6138
|
-
var
|
|
6139
|
-
return
|
|
5675
|
+
serialize: function(c, m) {
|
|
5676
|
+
var R = c;
|
|
5677
|
+
return R.nss = (c.uuid || "").toLowerCase(), R;
|
|
6140
5678
|
}
|
|
6141
5679
|
};
|
|
6142
|
-
|
|
5680
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = ot, r.normalize = Oe, r.equal = it, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
6143
5681
|
});
|
|
6144
5682
|
})(uri_all, uri_all.exports);
|
|
6145
5683
|
var uri_allExports = uri_all.exports;
|
|
@@ -6167,9 +5705,9 @@ uri$1.default = uri;
|
|
|
6167
5705
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
6168
5706
|
return r.CodeGen;
|
|
6169
5707
|
} });
|
|
6170
|
-
const n = validation_error, s = ref_error, o = rules, i = compile, l = codegen, p = resolve$1, d = dataType, u = util,
|
|
6171
|
-
|
|
6172
|
-
const
|
|
5708
|
+
const n = validation_error, s = ref_error, o = rules, i = compile, l = codegen, p = resolve$1, d = dataType, u = util, _ = require$$9, v = uri$1, w = (F, y) => new RegExp(F, y);
|
|
5709
|
+
w.code = "new RegExp";
|
|
5710
|
+
const P = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
6173
5711
|
"validate",
|
|
6174
5712
|
"serialize",
|
|
6175
5713
|
"parse",
|
|
@@ -6205,25 +5743,25 @@ uri$1.default = uri;
|
|
|
6205
5743
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
6206
5744
|
}, k = 200;
|
|
6207
5745
|
function C(F) {
|
|
6208
|
-
var y, j,
|
|
6209
|
-
const Oe = F.strict, it = (y = F.code) === null || y === void 0 ? void 0 : y.optimize, ut = it === !0 || it === void 0 ? 1 : it || 0, pe = (
|
|
5746
|
+
var y, j, E, a, h, N, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, ot;
|
|
5747
|
+
const Oe = F.strict, it = (y = F.code) === null || y === void 0 ? void 0 : y.optimize, ut = it === !0 || it === void 0 ? 1 : it || 0, pe = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : w, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : v.default;
|
|
6210
5748
|
return {
|
|
6211
5749
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
6212
|
-
strictNumbers: (
|
|
5750
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
6213
5751
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
6214
5752
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
6215
|
-
strictRequired: (tt = (
|
|
5753
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
6216
5754
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
6217
5755
|
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : k,
|
|
6218
5756
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : k,
|
|
6219
5757
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
6220
|
-
messages: (
|
|
6221
|
-
inlineRefs: (
|
|
6222
|
-
schemaId: (
|
|
5758
|
+
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5759
|
+
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
5760
|
+
schemaId: (ze = F.schemaId) !== null && ze !== void 0 ? ze : "$id",
|
|
6223
5761
|
addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
|
|
6224
5762
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
6225
5763
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
6226
|
-
unicodeRegExp: (
|
|
5764
|
+
unicodeRegExp: (xe = F.unicodeRegExp) !== null && xe !== void 0 ? xe : !0,
|
|
6227
5765
|
int32range: (ot = F.int32range) !== null && ot !== void 0 ? ot : !0,
|
|
6228
5766
|
uriResolver: Ne
|
|
6229
5767
|
};
|
|
@@ -6231,41 +5769,41 @@ uri$1.default = uri;
|
|
|
6231
5769
|
class I {
|
|
6232
5770
|
constructor(y = {}) {
|
|
6233
5771
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...C(y) };
|
|
6234
|
-
const { es5: j, lines:
|
|
6235
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines:
|
|
5772
|
+
const { es5: j, lines: E } = this.opts.code;
|
|
5773
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: E }), this.logger = K(y.logger);
|
|
6236
5774
|
const a = y.validateFormats;
|
|
6237
|
-
y.validateFormats = !1, this.RULES = (0, o.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, g, y, "DEPRECATED", "warn"), this._metaOpts =
|
|
5775
|
+
y.validateFormats = !1, this.RULES = (0, o.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, g, y, "DEPRECATED", "warn"), this._metaOpts = x.call(this), y.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), y.keywords && V.call(this, y.keywords), typeof y.meta == "object" && this.addMetaSchema(y.meta), O.call(this), y.validateFormats = a;
|
|
6238
5776
|
}
|
|
6239
5777
|
_addVocabularies() {
|
|
6240
5778
|
this.addKeyword("$async");
|
|
6241
5779
|
}
|
|
6242
5780
|
_addDefaultMetaSchema() {
|
|
6243
|
-
const { $data: y, meta: j, schemaId:
|
|
6244
|
-
let a =
|
|
6245
|
-
|
|
5781
|
+
const { $data: y, meta: j, schemaId: E } = this.opts;
|
|
5782
|
+
let a = _;
|
|
5783
|
+
E === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && y && this.addMetaSchema(a, a[E], !1);
|
|
6246
5784
|
}
|
|
6247
5785
|
defaultMeta() {
|
|
6248
5786
|
const { meta: y, schemaId: j } = this.opts;
|
|
6249
5787
|
return this.opts.defaultMeta = typeof y == "object" ? y[j] || y : void 0;
|
|
6250
5788
|
}
|
|
6251
5789
|
validate(y, j) {
|
|
6252
|
-
let
|
|
5790
|
+
let E;
|
|
6253
5791
|
if (typeof y == "string") {
|
|
6254
|
-
if (
|
|
5792
|
+
if (E = this.getSchema(y), !E)
|
|
6255
5793
|
throw new Error(`no schema with key or ref "${y}"`);
|
|
6256
5794
|
} else
|
|
6257
|
-
|
|
6258
|
-
const a =
|
|
6259
|
-
return "$async" in
|
|
5795
|
+
E = this.compile(y);
|
|
5796
|
+
const a = E(j);
|
|
5797
|
+
return "$async" in E || (this.errors = E.errors), a;
|
|
6260
5798
|
}
|
|
6261
5799
|
compile(y, j) {
|
|
6262
|
-
const
|
|
6263
|
-
return
|
|
5800
|
+
const E = this._addSchema(y, j);
|
|
5801
|
+
return E.validate || this._compileSchemaEnv(E);
|
|
6264
5802
|
}
|
|
6265
5803
|
compileAsync(y, j) {
|
|
6266
5804
|
if (typeof this.opts.loadSchema != "function")
|
|
6267
5805
|
throw new Error("options.loadSchema should be a function");
|
|
6268
|
-
const { loadSchema:
|
|
5806
|
+
const { loadSchema: E } = this.opts;
|
|
6269
5807
|
return a.call(this, y, j);
|
|
6270
5808
|
async function a(G, ne) {
|
|
6271
5809
|
await h.call(this, G.$schema);
|
|
@@ -6281,14 +5819,14 @@ uri$1.default = uri;
|
|
|
6281
5819
|
} catch (ne) {
|
|
6282
5820
|
if (!(ne instanceof s.default))
|
|
6283
5821
|
throw ne;
|
|
6284
|
-
return
|
|
5822
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
6285
5823
|
}
|
|
6286
5824
|
}
|
|
6287
|
-
function
|
|
5825
|
+
function M({ missingSchema: G, missingRef: ne }) {
|
|
6288
5826
|
if (this.refs[G])
|
|
6289
5827
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
6290
5828
|
}
|
|
6291
|
-
async function
|
|
5829
|
+
async function q(G) {
|
|
6292
5830
|
const ne = await W.call(this, G);
|
|
6293
5831
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
6294
5832
|
}
|
|
@@ -6297,17 +5835,17 @@ uri$1.default = uri;
|
|
|
6297
5835
|
if (ne)
|
|
6298
5836
|
return ne;
|
|
6299
5837
|
try {
|
|
6300
|
-
return await (this._loading[G] =
|
|
5838
|
+
return await (this._loading[G] = E(G));
|
|
6301
5839
|
} finally {
|
|
6302
5840
|
delete this._loading[G];
|
|
6303
5841
|
}
|
|
6304
5842
|
}
|
|
6305
5843
|
}
|
|
6306
5844
|
// Adds schema to the instance
|
|
6307
|
-
addSchema(y, j,
|
|
5845
|
+
addSchema(y, j, E, a = this.opts.validateSchema) {
|
|
6308
5846
|
if (Array.isArray(y)) {
|
|
6309
5847
|
for (const N of y)
|
|
6310
|
-
this.addSchema(N, void 0,
|
|
5848
|
+
this.addSchema(N, void 0, E, a);
|
|
6311
5849
|
return this;
|
|
6312
5850
|
}
|
|
6313
5851
|
let h;
|
|
@@ -6316,23 +5854,23 @@ uri$1.default = uri;
|
|
|
6316
5854
|
if (h = y[N], h !== void 0 && typeof h != "string")
|
|
6317
5855
|
throw new Error(`schema ${N} must be string`);
|
|
6318
5856
|
}
|
|
6319
|
-
return j = (0, p.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(y,
|
|
5857
|
+
return j = (0, p.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(y, E, j, a, !0), this;
|
|
6320
5858
|
}
|
|
6321
5859
|
// Add schema that will be used to validate other schemas
|
|
6322
5860
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
6323
|
-
addMetaSchema(y, j,
|
|
6324
|
-
return this.addSchema(y, j, !0,
|
|
5861
|
+
addMetaSchema(y, j, E = this.opts.validateSchema) {
|
|
5862
|
+
return this.addSchema(y, j, !0, E), this;
|
|
6325
5863
|
}
|
|
6326
5864
|
// Validate schema against its meta-schema
|
|
6327
5865
|
validateSchema(y, j) {
|
|
6328
5866
|
if (typeof y == "boolean")
|
|
6329
5867
|
return !0;
|
|
6330
|
-
let
|
|
6331
|
-
if (
|
|
5868
|
+
let E;
|
|
5869
|
+
if (E = y.$schema, E !== void 0 && typeof E != "string")
|
|
6332
5870
|
throw new Error("$schema must be a string");
|
|
6333
|
-
if (
|
|
5871
|
+
if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
|
|
6334
5872
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
6335
|
-
const a = this.validate(
|
|
5873
|
+
const a = this.validate(E, y);
|
|
6336
5874
|
if (!a && j) {
|
|
6337
5875
|
const h = "schema is invalid: " + this.errorsText();
|
|
6338
5876
|
if (this.opts.validateSchema === "log")
|
|
@@ -6346,10 +5884,10 @@ uri$1.default = uri;
|
|
|
6346
5884
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
6347
5885
|
getSchema(y) {
|
|
6348
5886
|
let j;
|
|
6349
|
-
for (; typeof (j =
|
|
5887
|
+
for (; typeof (j = b.call(this, y)) == "string"; )
|
|
6350
5888
|
y = j;
|
|
6351
5889
|
if (j === void 0) {
|
|
6352
|
-
const { schemaId:
|
|
5890
|
+
const { schemaId: E } = this.opts, a = new i.SchemaEnv({ schema: {}, schemaId: E });
|
|
6353
5891
|
if (j = i.resolveSchema.call(this, a, y), !j)
|
|
6354
5892
|
return;
|
|
6355
5893
|
this.refs[y] = j;
|
|
@@ -6367,14 +5905,14 @@ uri$1.default = uri;
|
|
|
6367
5905
|
case "undefined":
|
|
6368
5906
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
6369
5907
|
case "string": {
|
|
6370
|
-
const j =
|
|
5908
|
+
const j = b.call(this, y);
|
|
6371
5909
|
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[y], delete this.refs[y], this;
|
|
6372
5910
|
}
|
|
6373
5911
|
case "object": {
|
|
6374
5912
|
const j = y;
|
|
6375
5913
|
this._cache.delete(j);
|
|
6376
|
-
let
|
|
6377
|
-
return
|
|
5914
|
+
let E = y[this.opts.schemaId];
|
|
5915
|
+
return E && (E = (0, p.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
|
|
6378
5916
|
}
|
|
6379
5917
|
default:
|
|
6380
5918
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
@@ -6387,23 +5925,23 @@ uri$1.default = uri;
|
|
|
6387
5925
|
return this;
|
|
6388
5926
|
}
|
|
6389
5927
|
addKeyword(y, j) {
|
|
6390
|
-
let
|
|
5928
|
+
let E;
|
|
6391
5929
|
if (typeof y == "string")
|
|
6392
|
-
|
|
5930
|
+
E = y, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
|
|
6393
5931
|
else if (typeof y == "object" && j === void 0) {
|
|
6394
|
-
if (j = y,
|
|
5932
|
+
if (j = y, E = j.keyword, Array.isArray(E) && !E.length)
|
|
6395
5933
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6396
5934
|
} else
|
|
6397
5935
|
throw new Error("invalid addKeywords parameters");
|
|
6398
|
-
if (ie.call(this,
|
|
6399
|
-
return (0, u.eachItem)(
|
|
5936
|
+
if (ie.call(this, E, j), !j)
|
|
5937
|
+
return (0, u.eachItem)(E, (h) => ke.call(this, h)), this;
|
|
6400
5938
|
qe.call(this, j);
|
|
6401
5939
|
const a = {
|
|
6402
5940
|
...j,
|
|
6403
5941
|
type: (0, d.getJSONTypes)(j.type),
|
|
6404
5942
|
schemaType: (0, d.getJSONTypes)(j.schemaType)
|
|
6405
5943
|
};
|
|
6406
|
-
return (0, u.eachItem)(
|
|
5944
|
+
return (0, u.eachItem)(E, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6407
5945
|
}
|
|
6408
5946
|
getKeyword(y) {
|
|
6409
5947
|
const j = this.RULES.all[y];
|
|
@@ -6413,9 +5951,9 @@ uri$1.default = uri;
|
|
|
6413
5951
|
removeKeyword(y) {
|
|
6414
5952
|
const { RULES: j } = this;
|
|
6415
5953
|
delete j.keywords[y], delete j.all[y];
|
|
6416
|
-
for (const
|
|
6417
|
-
const a =
|
|
6418
|
-
a >= 0 &&
|
|
5954
|
+
for (const E of j.rules) {
|
|
5955
|
+
const a = E.rules.findIndex((h) => h.keyword === y);
|
|
5956
|
+
a >= 0 && E.rules.splice(a, 1);
|
|
6419
5957
|
}
|
|
6420
5958
|
return this;
|
|
6421
5959
|
}
|
|
@@ -6423,50 +5961,50 @@ uri$1.default = uri;
|
|
|
6423
5961
|
addFormat(y, j) {
|
|
6424
5962
|
return typeof j == "string" && (j = new RegExp(j)), this.formats[y] = j, this;
|
|
6425
5963
|
}
|
|
6426
|
-
errorsText(y = this.errors, { separator: j = ", ", dataVar:
|
|
6427
|
-
return !y || y.length === 0 ? "No errors" : y.map((a) => `${
|
|
5964
|
+
errorsText(y = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
|
|
5965
|
+
return !y || y.length === 0 ? "No errors" : y.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6428
5966
|
}
|
|
6429
5967
|
$dataMetaSchema(y, j) {
|
|
6430
|
-
const
|
|
5968
|
+
const E = this.RULES.all;
|
|
6431
5969
|
y = JSON.parse(JSON.stringify(y));
|
|
6432
5970
|
for (const a of j) {
|
|
6433
5971
|
const h = a.split("/").slice(1);
|
|
6434
5972
|
let N = y;
|
|
6435
|
-
for (const
|
|
6436
|
-
N = N[
|
|
6437
|
-
for (const
|
|
6438
|
-
const
|
|
6439
|
-
if (typeof
|
|
5973
|
+
for (const M of h)
|
|
5974
|
+
N = N[M];
|
|
5975
|
+
for (const M in E) {
|
|
5976
|
+
const q = E[M];
|
|
5977
|
+
if (typeof q != "object")
|
|
6440
5978
|
continue;
|
|
6441
|
-
const { $data: W } =
|
|
6442
|
-
W && G && (N[
|
|
5979
|
+
const { $data: W } = q.definition, G = N[M];
|
|
5980
|
+
W && G && (N[M] = Ue(G));
|
|
6443
5981
|
}
|
|
6444
5982
|
}
|
|
6445
5983
|
return y;
|
|
6446
5984
|
}
|
|
6447
5985
|
_removeAllSchemas(y, j) {
|
|
6448
|
-
for (const
|
|
6449
|
-
const a = y[
|
|
6450
|
-
(!j || j.test(
|
|
5986
|
+
for (const E in y) {
|
|
5987
|
+
const a = y[E];
|
|
5988
|
+
(!j || j.test(E)) && (typeof a == "string" ? delete y[E] : a && !a.meta && (this._cache.delete(a.schema), delete y[E]));
|
|
6451
5989
|
}
|
|
6452
5990
|
}
|
|
6453
|
-
_addSchema(y, j,
|
|
5991
|
+
_addSchema(y, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6454
5992
|
let N;
|
|
6455
|
-
const { schemaId:
|
|
5993
|
+
const { schemaId: M } = this.opts;
|
|
6456
5994
|
if (typeof y == "object")
|
|
6457
|
-
N = y[
|
|
5995
|
+
N = y[M];
|
|
6458
5996
|
else {
|
|
6459
5997
|
if (this.opts.jtd)
|
|
6460
5998
|
throw new Error("schema must be object");
|
|
6461
5999
|
if (typeof y != "boolean")
|
|
6462
6000
|
throw new Error("schema must be object or boolean");
|
|
6463
6001
|
}
|
|
6464
|
-
let
|
|
6465
|
-
if (
|
|
6466
|
-
return
|
|
6467
|
-
|
|
6468
|
-
const W = p.getSchemaRefs.call(this, y,
|
|
6469
|
-
return
|
|
6002
|
+
let q = this._cache.get(y);
|
|
6003
|
+
if (q !== void 0)
|
|
6004
|
+
return q;
|
|
6005
|
+
E = (0, p.normalizeId)(N || E);
|
|
6006
|
+
const W = p.getSchemaRefs.call(this, y, E);
|
|
6007
|
+
return q = new i.SchemaEnv({ schema: y, schemaId: M, meta: j, baseId: E, localRefs: W }), this._cache.set(q.schema, q), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = q), a && this.validateSchema(y, !0), q;
|
|
6470
6008
|
}
|
|
6471
6009
|
_checkUnique(y) {
|
|
6472
6010
|
if (this.schemas[y] || this.refs[y])
|
|
@@ -6488,13 +6026,13 @@ uri$1.default = uri;
|
|
|
6488
6026
|
}
|
|
6489
6027
|
}
|
|
6490
6028
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6491
|
-
function D(F, y, j,
|
|
6029
|
+
function D(F, y, j, E = "error") {
|
|
6492
6030
|
for (const a in F) {
|
|
6493
6031
|
const h = a;
|
|
6494
|
-
h in y && this.logger[
|
|
6032
|
+
h in y && this.logger[E](`${j}: option ${a}. ${F[h]}`);
|
|
6495
6033
|
}
|
|
6496
6034
|
}
|
|
6497
|
-
function
|
|
6035
|
+
function b(F) {
|
|
6498
6036
|
return F = (0, p.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6499
6037
|
}
|
|
6500
6038
|
function O() {
|
|
@@ -6512,7 +6050,7 @@ uri$1.default = uri;
|
|
|
6512
6050
|
y && this.addFormat(F, y);
|
|
6513
6051
|
}
|
|
6514
6052
|
}
|
|
6515
|
-
function
|
|
6053
|
+
function V(F) {
|
|
6516
6054
|
if (Array.isArray(F)) {
|
|
6517
6055
|
this.addVocabulary(F);
|
|
6518
6056
|
return;
|
|
@@ -6523,9 +6061,9 @@ uri$1.default = uri;
|
|
|
6523
6061
|
j.keyword || (j.keyword = y), this.addKeyword(j);
|
|
6524
6062
|
}
|
|
6525
6063
|
}
|
|
6526
|
-
function
|
|
6064
|
+
function x() {
|
|
6527
6065
|
const F = { ...this.opts };
|
|
6528
|
-
for (const y of
|
|
6066
|
+
for (const y of P)
|
|
6529
6067
|
delete F[y];
|
|
6530
6068
|
return F;
|
|
6531
6069
|
}
|
|
@@ -6545,24 +6083,24 @@ uri$1.default = uri;
|
|
|
6545
6083
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6546
6084
|
function ie(F, y) {
|
|
6547
6085
|
const { RULES: j } = this;
|
|
6548
|
-
if ((0, u.eachItem)(F, (
|
|
6549
|
-
if (j.keywords[
|
|
6550
|
-
throw new Error(`Keyword ${
|
|
6551
|
-
if (!ue.test(
|
|
6552
|
-
throw new Error(`Keyword ${
|
|
6086
|
+
if ((0, u.eachItem)(F, (E) => {
|
|
6087
|
+
if (j.keywords[E])
|
|
6088
|
+
throw new Error(`Keyword ${E} is already defined`);
|
|
6089
|
+
if (!ue.test(E))
|
|
6090
|
+
throw new Error(`Keyword ${E} has invalid name`);
|
|
6553
6091
|
}), !!y && y.$data && !("code" in y || "validate" in y))
|
|
6554
6092
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6555
6093
|
}
|
|
6556
6094
|
function ke(F, y, j) {
|
|
6557
|
-
var
|
|
6095
|
+
var E;
|
|
6558
6096
|
const a = y == null ? void 0 : y.post;
|
|
6559
6097
|
if (j && a)
|
|
6560
6098
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6561
6099
|
const { RULES: h } = this;
|
|
6562
|
-
let N = a ? h.post : h.rules.find(({ type:
|
|
6100
|
+
let N = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6563
6101
|
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !y)
|
|
6564
6102
|
return;
|
|
6565
|
-
const
|
|
6103
|
+
const M = {
|
|
6566
6104
|
keyword: F,
|
|
6567
6105
|
definition: {
|
|
6568
6106
|
...y,
|
|
@@ -6570,20 +6108,20 @@ uri$1.default = uri;
|
|
|
6570
6108
|
schemaType: (0, d.getJSONTypes)(y.schemaType)
|
|
6571
6109
|
}
|
|
6572
6110
|
};
|
|
6573
|
-
y.before ? Ce.call(this, N,
|
|
6111
|
+
y.before ? Ce.call(this, N, M, y.before) : N.rules.push(M), h.all[F] = M, (E = y.implements) === null || E === void 0 || E.forEach((q) => this.addKeyword(q));
|
|
6574
6112
|
}
|
|
6575
6113
|
function Ce(F, y, j) {
|
|
6576
|
-
const
|
|
6577
|
-
|
|
6114
|
+
const E = F.rules.findIndex((a) => a.keyword === j);
|
|
6115
|
+
E >= 0 ? F.rules.splice(E, 0, y) : (F.rules.push(y), this.logger.warn(`rule ${j} is not defined`));
|
|
6578
6116
|
}
|
|
6579
6117
|
function qe(F) {
|
|
6580
6118
|
let { metaSchema: y } = F;
|
|
6581
|
-
y !== void 0 && (F.$data && this.opts.$data && (y =
|
|
6119
|
+
y !== void 0 && (F.$data && this.opts.$data && (y = Ue(y)), F.validateSchema = this.compile(y, !0));
|
|
6582
6120
|
}
|
|
6583
6121
|
const et = {
|
|
6584
6122
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6585
6123
|
};
|
|
6586
|
-
function
|
|
6124
|
+
function Ue(F) {
|
|
6587
6125
|
return { anyOf: [F, et] };
|
|
6588
6126
|
}
|
|
6589
6127
|
})(core$2);
|
|
@@ -6605,26 +6143,26 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6605
6143
|
code(e) {
|
|
6606
6144
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: o, validateName: i, opts: l, self: p } = n, { root: d } = o;
|
|
6607
6145
|
if ((r === "#" || r === "#/") && s === d.baseId)
|
|
6608
|
-
return
|
|
6146
|
+
return _();
|
|
6609
6147
|
const u = compile_1$1.resolveRef.call(p, d, s, r);
|
|
6610
6148
|
if (u === void 0)
|
|
6611
6149
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6612
6150
|
if (u instanceof compile_1$1.SchemaEnv)
|
|
6613
|
-
return
|
|
6614
|
-
return
|
|
6615
|
-
function
|
|
6151
|
+
return v(u);
|
|
6152
|
+
return w(u);
|
|
6153
|
+
function _() {
|
|
6616
6154
|
if (o === d)
|
|
6617
6155
|
return callRef(e, i, o, o.$async);
|
|
6618
|
-
const
|
|
6619
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6156
|
+
const P = t.scopeValue("root", { ref: d });
|
|
6157
|
+
return callRef(e, (0, codegen_1$l._)`${P}.validate`, d, d.$async);
|
|
6620
6158
|
}
|
|
6621
|
-
function
|
|
6622
|
-
const T = getValidate(e,
|
|
6623
|
-
callRef(e, T,
|
|
6159
|
+
function v(P) {
|
|
6160
|
+
const T = getValidate(e, P);
|
|
6161
|
+
callRef(e, T, P, P.$async);
|
|
6624
6162
|
}
|
|
6625
|
-
function
|
|
6626
|
-
const T = t.scopeValue("schema", l.code.source === !0 ? { ref:
|
|
6627
|
-
schema:
|
|
6163
|
+
function w(P) {
|
|
6164
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: P, code: (0, codegen_1$l.stringify)(P) } : { ref: P }), $ = t.name("valid"), g = e.subschema({
|
|
6165
|
+
schema: P,
|
|
6628
6166
|
dataTypes: [],
|
|
6629
6167
|
schemaPath: codegen_1$l.nil,
|
|
6630
6168
|
topSchemaRef: T,
|
|
@@ -6641,25 +6179,25 @@ function getValidate(e, t) {
|
|
|
6641
6179
|
ref.getValidate = getValidate;
|
|
6642
6180
|
function callRef(e, t, r, n) {
|
|
6643
6181
|
const { gen: s, it: o } = e, { allErrors: i, schemaEnv: l, opts: p } = o, d = p.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6644
|
-
n ? u() :
|
|
6182
|
+
n ? u() : _();
|
|
6645
6183
|
function u() {
|
|
6646
6184
|
if (!l.$async)
|
|
6647
6185
|
throw new Error("async schema referenced by sync schema");
|
|
6648
|
-
const
|
|
6186
|
+
const P = s.let("valid");
|
|
6649
6187
|
s.try(() => {
|
|
6650
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, d)}`),
|
|
6188
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, d)}`), w(t), i || s.assign(P, !0);
|
|
6651
6189
|
}, (T) => {
|
|
6652
|
-
s.if((0, codegen_1$l._)`!(${T} instanceof ${o.ValidationError})`, () => s.throw(T)),
|
|
6653
|
-
}), e.ok(
|
|
6190
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${o.ValidationError})`, () => s.throw(T)), v(T), i || s.assign(P, !1);
|
|
6191
|
+
}), e.ok(P);
|
|
6654
6192
|
}
|
|
6655
|
-
function
|
|
6656
|
-
e.result((0, code_1$8.callValidateCode)(e, t, d), () =>
|
|
6193
|
+
function _() {
|
|
6194
|
+
e.result((0, code_1$8.callValidateCode)(e, t, d), () => w(t), () => v(t));
|
|
6657
6195
|
}
|
|
6658
|
-
function
|
|
6659
|
-
const T = (0, codegen_1$l._)`${
|
|
6196
|
+
function v(P) {
|
|
6197
|
+
const T = (0, codegen_1$l._)`${P}.errors`;
|
|
6660
6198
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6661
6199
|
}
|
|
6662
|
-
function
|
|
6200
|
+
function w(P) {
|
|
6663
6201
|
var T;
|
|
6664
6202
|
if (!o.opts.unevaluated)
|
|
6665
6203
|
return;
|
|
@@ -6668,14 +6206,14 @@ function callRef(e, t, r, n) {
|
|
|
6668
6206
|
if ($ && !$.dynamicProps)
|
|
6669
6207
|
$.props !== void 0 && (o.props = util_1$j.mergeEvaluated.props(s, $.props, o.props));
|
|
6670
6208
|
else {
|
|
6671
|
-
const g = s.var("props", (0, codegen_1$l._)`${
|
|
6209
|
+
const g = s.var("props", (0, codegen_1$l._)`${P}.evaluated.props`);
|
|
6672
6210
|
o.props = util_1$j.mergeEvaluated.props(s, g, o.props, codegen_1$l.Name);
|
|
6673
6211
|
}
|
|
6674
6212
|
if (o.items !== !0)
|
|
6675
6213
|
if ($ && !$.dynamicItems)
|
|
6676
6214
|
$.items !== void 0 && (o.items = util_1$j.mergeEvaluated.items(s, $.items, o.items));
|
|
6677
6215
|
else {
|
|
6678
|
-
const g = s.var("items", (0, codegen_1$l._)`${
|
|
6216
|
+
const g = s.var("items", (0, codegen_1$l._)`${P}.evaluated.items`);
|
|
6679
6217
|
o.items = util_1$j.mergeEvaluated.items(s, g, o.items, codegen_1$l.Name);
|
|
6680
6218
|
}
|
|
6681
6219
|
}
|
|
@@ -6817,36 +6355,36 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6817
6355
|
return;
|
|
6818
6356
|
const p = r.length >= l.loopRequired;
|
|
6819
6357
|
if (i.allErrors ? d() : u(), l.strictRequired) {
|
|
6820
|
-
const
|
|
6358
|
+
const w = e.parentSchema.properties, { definedProperties: P } = e.it;
|
|
6821
6359
|
for (const T of r)
|
|
6822
|
-
if ((
|
|
6360
|
+
if ((w == null ? void 0 : w[T]) === void 0 && !P.has(T)) {
|
|
6823
6361
|
const $ = i.schemaEnv.baseId + i.errSchemaPath, g = `required property "${T}" is not defined at "${$}" (strictRequired)`;
|
|
6824
6362
|
(0, util_1$h.checkStrictMode)(i, g, i.opts.strictRequired);
|
|
6825
6363
|
}
|
|
6826
6364
|
}
|
|
6827
6365
|
function d() {
|
|
6828
6366
|
if (p || o)
|
|
6829
|
-
e.block$data(codegen_1$f.nil,
|
|
6367
|
+
e.block$data(codegen_1$f.nil, _);
|
|
6830
6368
|
else
|
|
6831
|
-
for (const
|
|
6832
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6369
|
+
for (const w of r)
|
|
6370
|
+
(0, code_1$6.checkReportMissingProp)(e, w);
|
|
6833
6371
|
}
|
|
6834
6372
|
function u() {
|
|
6835
|
-
const
|
|
6373
|
+
const w = t.let("missing");
|
|
6836
6374
|
if (p || o) {
|
|
6837
|
-
const
|
|
6838
|
-
e.block$data(
|
|
6375
|
+
const P = t.let("valid", !0);
|
|
6376
|
+
e.block$data(P, () => v(w, P)), e.ok(P);
|
|
6839
6377
|
} else
|
|
6840
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6378
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, w)), (0, code_1$6.reportMissingProp)(e, w), t.else();
|
|
6841
6379
|
}
|
|
6842
|
-
function
|
|
6843
|
-
t.forOf("prop", n, (
|
|
6844
|
-
e.setParams({ missingProperty:
|
|
6380
|
+
function _() {
|
|
6381
|
+
t.forOf("prop", n, (w) => {
|
|
6382
|
+
e.setParams({ missingProperty: w }), t.if((0, code_1$6.noPropertyInData)(t, s, w, l.ownProperties), () => e.error());
|
|
6845
6383
|
});
|
|
6846
6384
|
}
|
|
6847
|
-
function w
|
|
6848
|
-
e.setParams({ missingProperty:
|
|
6849
|
-
t.assign(
|
|
6385
|
+
function v(w, P) {
|
|
6386
|
+
e.setParams({ missingProperty: w }), t.forOf(w, n, () => {
|
|
6387
|
+
t.assign(P, (0, code_1$6.propertyInData)(t, s, w, l.ownProperties)), t.if((0, codegen_1$f.not)(P), () => {
|
|
6850
6388
|
e.error(), t.break();
|
|
6851
6389
|
});
|
|
6852
6390
|
}, codegen_1$f.nil);
|
|
@@ -6896,23 +6434,23 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6896
6434
|
const p = t.let("valid"), d = o.items ? (0, dataType_1.getSchemaTypes)(o.items) : [];
|
|
6897
6435
|
e.block$data(p, u, (0, codegen_1$d._)`${i} === false`), e.ok(p);
|
|
6898
6436
|
function u() {
|
|
6899
|
-
const
|
|
6900
|
-
e.setParams({ i:
|
|
6437
|
+
const P = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6438
|
+
e.setParams({ i: P, j: T }), t.assign(p, !0), t.if((0, codegen_1$d._)`${P} > 1`, () => (_() ? v : w)(P, T));
|
|
6901
6439
|
}
|
|
6902
|
-
function
|
|
6903
|
-
return d.length > 0 && !d.some((
|
|
6440
|
+
function _() {
|
|
6441
|
+
return d.length > 0 && !d.some((P) => P === "object" || P === "array");
|
|
6904
6442
|
}
|
|
6905
|
-
function
|
|
6443
|
+
function v(P, T) {
|
|
6906
6444
|
const $ = t.name("item"), g = (0, dataType_1.checkDataTypes)(d, $, l.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6907
|
-
t.for((0, codegen_1$d._)`;${
|
|
6908
|
-
t.let($, (0, codegen_1$d._)`${r}[${
|
|
6445
|
+
t.for((0, codegen_1$d._)`;${P}--;`, () => {
|
|
6446
|
+
t.let($, (0, codegen_1$d._)`${r}[${P}]`), t.if(g, (0, codegen_1$d._)`continue`), d.length > 1 && t.if((0, codegen_1$d._)`typeof ${$} == "string"`, (0, codegen_1$d._)`${$} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${$}] == "number"`, () => {
|
|
6909
6447
|
t.assign(T, (0, codegen_1$d._)`${k}[${$}]`), e.error(), t.assign(p, !1).break();
|
|
6910
|
-
}).code((0, codegen_1$d._)`${k}[${$}] = ${
|
|
6448
|
+
}).code((0, codegen_1$d._)`${k}[${$}] = ${P}`);
|
|
6911
6449
|
});
|
|
6912
6450
|
}
|
|
6913
|
-
function
|
|
6451
|
+
function w(P, T) {
|
|
6914
6452
|
const $ = (0, util_1$g.useFunc)(t, equal_1$2.default), g = t.name("outer");
|
|
6915
|
-
t.label(g).for((0, codegen_1$d._)`;${
|
|
6453
|
+
t.label(g).for((0, codegen_1$d._)`;${P}--;`, () => t.for((0, codegen_1$d._)`${T} = ${P}; ${T}--;`, () => t.if((0, codegen_1$d._)`${$}(${r}[${P}], ${r}[${T}])`, () => {
|
|
6916
6454
|
e.error(), t.assign(p, !1).break(g);
|
|
6917
6455
|
})));
|
|
6918
6456
|
}
|
|
@@ -6953,20 +6491,20 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6953
6491
|
const d = () => p ?? (p = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6954
6492
|
let u;
|
|
6955
6493
|
if (l || n)
|
|
6956
|
-
u = t.let("valid"), e.block$data(u,
|
|
6494
|
+
u = t.let("valid"), e.block$data(u, _);
|
|
6957
6495
|
else {
|
|
6958
6496
|
if (!Array.isArray(s))
|
|
6959
6497
|
throw new Error("ajv implementation error");
|
|
6960
|
-
const
|
|
6961
|
-
u = (0, codegen_1$b.or)(...s.map((
|
|
6498
|
+
const w = t.const("vSchema", o);
|
|
6499
|
+
u = (0, codegen_1$b.or)(...s.map((P, T) => v(w, T)));
|
|
6962
6500
|
}
|
|
6963
6501
|
e.pass(u);
|
|
6964
|
-
function
|
|
6965
|
-
t.assign(u, !1), t.forOf("v", o, (
|
|
6502
|
+
function _() {
|
|
6503
|
+
t.assign(u, !1), t.forOf("v", o, (w) => t.if((0, codegen_1$b._)`${d()}(${r}, ${w})`, () => t.assign(u, !0).break()));
|
|
6966
6504
|
}
|
|
6967
|
-
function w
|
|
6968
|
-
const T = s[
|
|
6969
|
-
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${d()}(${r}, ${
|
|
6505
|
+
function v(w, P) {
|
|
6506
|
+
const T = s[P];
|
|
6507
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${d()}(${r}, ${w}[${P}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6970
6508
|
}
|
|
6971
6509
|
}
|
|
6972
6510
|
};
|
|
@@ -7050,18 +6588,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
7050
6588
|
const { gen: n, parentSchema: s, data: o, keyword: i, it: l } = e;
|
|
7051
6589
|
u(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
7052
6590
|
const p = n.name("valid"), d = n.const("len", (0, codegen_1$9._)`${o}.length`);
|
|
7053
|
-
r.forEach((
|
|
7054
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6591
|
+
r.forEach((_, v) => {
|
|
6592
|
+
(0, util_1$c.alwaysValidSchema)(l, _) || (n.if((0, codegen_1$9._)`${d} > ${v}`, () => e.subschema({
|
|
7055
6593
|
keyword: i,
|
|
7056
|
-
schemaProp:
|
|
7057
|
-
dataProp:
|
|
6594
|
+
schemaProp: v,
|
|
6595
|
+
dataProp: v
|
|
7058
6596
|
}, p)), e.ok(p));
|
|
7059
6597
|
});
|
|
7060
|
-
function u(
|
|
7061
|
-
const { opts:
|
|
7062
|
-
if (
|
|
7063
|
-
const $ = `"${i}" is ${
|
|
7064
|
-
(0, util_1$c.checkStrictMode)(l, $,
|
|
6598
|
+
function u(_) {
|
|
6599
|
+
const { opts: v, errSchemaPath: w } = l, P = r.length, T = P === _.minItems && (P === _.maxItems || _[t] === !1);
|
|
6600
|
+
if (v.strictTuples && !T) {
|
|
6601
|
+
const $ = `"${i}" is ${P}-tuple, but minItems or maxItems/${t} are not specified or different at path "${w}"`;
|
|
6602
|
+
(0, util_1$c.checkStrictMode)(l, $, v.strictTuples);
|
|
7065
6603
|
}
|
|
7066
6604
|
}
|
|
7067
6605
|
}
|
|
@@ -7125,13 +6663,13 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7125
6663
|
return;
|
|
7126
6664
|
}
|
|
7127
6665
|
o.items = !0;
|
|
7128
|
-
const
|
|
7129
|
-
l === void 0 && i === 1 ?
|
|
7130
|
-
function
|
|
6666
|
+
const _ = t.name("valid");
|
|
6667
|
+
l === void 0 && i === 1 ? w(_, () => t.if(_, () => t.break())) : i === 0 ? (t.let(_, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, v)) : (t.let(_, !1), v()), e.result(_, () => e.reset());
|
|
6668
|
+
function v() {
|
|
7131
6669
|
const T = t.name("_valid"), $ = t.let("count", 0);
|
|
7132
|
-
|
|
6670
|
+
w(T, () => t.if(T, () => P($)));
|
|
7133
6671
|
}
|
|
7134
|
-
function
|
|
6672
|
+
function w(T, $) {
|
|
7135
6673
|
t.forRange("i", 0, u, (g) => {
|
|
7136
6674
|
e.subschema({
|
|
7137
6675
|
keyword: "contains",
|
|
@@ -7141,8 +6679,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7141
6679
|
}, T), $();
|
|
7142
6680
|
});
|
|
7143
6681
|
}
|
|
7144
|
-
function
|
|
7145
|
-
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(
|
|
6682
|
+
function P(T) {
|
|
6683
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(_, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign(_, !1).break()), i === 1 ? t.assign(_, !0) : t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(_, !0)));
|
|
7146
6684
|
}
|
|
7147
6685
|
}
|
|
7148
6686
|
};
|
|
@@ -7153,11 +6691,11 @@ var dependencies = {};
|
|
|
7153
6691
|
const t = codegen, r = util, n = code;
|
|
7154
6692
|
e.error = {
|
|
7155
6693
|
message: ({ params: { property: p, depsCount: d, deps: u } }) => {
|
|
7156
|
-
const
|
|
7157
|
-
return (0, t.str)`must have ${
|
|
6694
|
+
const _ = d === 1 ? "property" : "properties";
|
|
6695
|
+
return (0, t.str)`must have ${_} ${u} when property ${p} is present`;
|
|
7158
6696
|
},
|
|
7159
|
-
params: ({ params: { property: p, depsCount: d, deps: u, missingProperty:
|
|
7160
|
-
missingProperty: ${
|
|
6697
|
+
params: ({ params: { property: p, depsCount: d, deps: u, missingProperty: _ } }) => (0, t._)`{property: ${p},
|
|
6698
|
+
missingProperty: ${_},
|
|
7161
6699
|
depsCount: ${d},
|
|
7162
6700
|
deps: ${u}}`
|
|
7163
6701
|
// TODO change to reference
|
|
@@ -7174,47 +6712,47 @@ var dependencies = {};
|
|
|
7174
6712
|
};
|
|
7175
6713
|
function o({ schema: p }) {
|
|
7176
6714
|
const d = {}, u = {};
|
|
7177
|
-
for (const
|
|
7178
|
-
if (
|
|
6715
|
+
for (const _ in p) {
|
|
6716
|
+
if (_ === "__proto__")
|
|
7179
6717
|
continue;
|
|
7180
|
-
const
|
|
7181
|
-
|
|
6718
|
+
const v = Array.isArray(p[_]) ? d : u;
|
|
6719
|
+
v[_] = p[_];
|
|
7182
6720
|
}
|
|
7183
6721
|
return [d, u];
|
|
7184
6722
|
}
|
|
7185
6723
|
function i(p, d = p.schema) {
|
|
7186
|
-
const { gen: u, data:
|
|
6724
|
+
const { gen: u, data: _, it: v } = p;
|
|
7187
6725
|
if (Object.keys(d).length === 0)
|
|
7188
6726
|
return;
|
|
7189
|
-
const
|
|
7190
|
-
for (const
|
|
7191
|
-
const T = d[
|
|
6727
|
+
const w = u.let("missing");
|
|
6728
|
+
for (const P in d) {
|
|
6729
|
+
const T = d[P];
|
|
7192
6730
|
if (T.length === 0)
|
|
7193
6731
|
continue;
|
|
7194
|
-
const $ = (0, n.propertyInData)(u,
|
|
6732
|
+
const $ = (0, n.propertyInData)(u, _, P, v.opts.ownProperties);
|
|
7195
6733
|
p.setParams({
|
|
7196
|
-
property:
|
|
6734
|
+
property: P,
|
|
7197
6735
|
depsCount: T.length,
|
|
7198
6736
|
deps: T.join(", ")
|
|
7199
|
-
}),
|
|
6737
|
+
}), v.allErrors ? u.if($, () => {
|
|
7200
6738
|
for (const g of T)
|
|
7201
6739
|
(0, n.checkReportMissingProp)(p, g);
|
|
7202
|
-
}) : (u.if((0, t._)`${$} && (${(0, n.checkMissingProp)(p, T,
|
|
6740
|
+
}) : (u.if((0, t._)`${$} && (${(0, n.checkMissingProp)(p, T, w)})`), (0, n.reportMissingProp)(p, w), u.else());
|
|
7203
6741
|
}
|
|
7204
6742
|
}
|
|
7205
6743
|
e.validatePropertyDeps = i;
|
|
7206
6744
|
function l(p, d = p.schema) {
|
|
7207
|
-
const { gen: u, data:
|
|
6745
|
+
const { gen: u, data: _, keyword: v, it: w } = p, P = u.name("valid");
|
|
7208
6746
|
for (const T in d)
|
|
7209
|
-
(0, r.alwaysValidSchema)(
|
|
7210
|
-
(0, n.propertyInData)(u,
|
|
6747
|
+
(0, r.alwaysValidSchema)(w, d[T]) || (u.if(
|
|
6748
|
+
(0, n.propertyInData)(u, _, T, w.opts.ownProperties),
|
|
7211
6749
|
() => {
|
|
7212
|
-
const $ = p.subschema({ keyword:
|
|
7213
|
-
p.mergeValidEvaluated($,
|
|
6750
|
+
const $ = p.subschema({ keyword: v, schemaProp: T }, P);
|
|
6751
|
+
p.mergeValidEvaluated($, P);
|
|
7214
6752
|
},
|
|
7215
|
-
() => u.var(
|
|
6753
|
+
() => u.var(P, !0)
|
|
7216
6754
|
// TODO var
|
|
7217
|
-
), p.ok(
|
|
6755
|
+
), p.ok(P));
|
|
7218
6756
|
}
|
|
7219
6757
|
e.validateSchemaDeps = l, e.default = s;
|
|
7220
6758
|
})(dependencies);
|
|
@@ -7267,13 +6805,13 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7267
6805
|
if (i.props = !0, p.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(i, r))
|
|
7268
6806
|
return;
|
|
7269
6807
|
const d = (0, code_1$3.allSchemaProperties)(n.properties), u = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
7270
|
-
|
|
7271
|
-
function
|
|
6808
|
+
_(), e.ok((0, codegen_1$5._)`${o} === ${names_1.default.errors}`);
|
|
6809
|
+
function _() {
|
|
7272
6810
|
t.forIn("key", s, ($) => {
|
|
7273
|
-
!d.length && !u.length ?
|
|
6811
|
+
!d.length && !u.length ? P($) : t.if(v($), () => P($));
|
|
7274
6812
|
});
|
|
7275
6813
|
}
|
|
7276
|
-
function
|
|
6814
|
+
function v($) {
|
|
7277
6815
|
let g;
|
|
7278
6816
|
if (d.length > 8) {
|
|
7279
6817
|
const k = (0, util_1$8.schemaRefOrVal)(i, n.properties, "properties");
|
|
@@ -7282,12 +6820,12 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7282
6820
|
d.length ? g = (0, codegen_1$5.or)(...d.map((k) => (0, codegen_1$5._)`${$} === ${k}`)) : g = codegen_1$5.nil;
|
|
7283
6821
|
return u.length && (g = (0, codegen_1$5.or)(g, ...u.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${$})`))), (0, codegen_1$5.not)(g);
|
|
7284
6822
|
}
|
|
7285
|
-
function
|
|
6823
|
+
function w($) {
|
|
7286
6824
|
t.code((0, codegen_1$5._)`delete ${s}[${$}]`);
|
|
7287
6825
|
}
|
|
7288
|
-
function
|
|
6826
|
+
function P($) {
|
|
7289
6827
|
if (p.removeAdditional === "all" || p.removeAdditional && r === !1) {
|
|
7290
|
-
|
|
6828
|
+
w($);
|
|
7291
6829
|
return;
|
|
7292
6830
|
}
|
|
7293
6831
|
if (r === !1) {
|
|
@@ -7297,7 +6835,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7297
6835
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(i, r)) {
|
|
7298
6836
|
const g = t.name("valid");
|
|
7299
6837
|
p.removeAdditional === "failing" ? (T($, g, !1), t.if((0, codegen_1$5.not)(g), () => {
|
|
7300
|
-
e.reset(),
|
|
6838
|
+
e.reset(), w($);
|
|
7301
6839
|
})) : (T($, g), l || t.if((0, codegen_1$5.not)(g), () => t.break()));
|
|
7302
6840
|
}
|
|
7303
6841
|
}
|
|
@@ -7326,23 +6864,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
7326
6864
|
const { gen: t, schema: r, parentSchema: n, data: s, it: o } = e;
|
|
7327
6865
|
o.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(o, additionalProperties_1$1.default, "additionalProperties"));
|
|
7328
6866
|
const i = (0, code_1$2.allSchemaProperties)(r);
|
|
7329
|
-
for (const
|
|
7330
|
-
o.definedProperties.add(
|
|
6867
|
+
for (const _ of i)
|
|
6868
|
+
o.definedProperties.add(_);
|
|
7331
6869
|
o.opts.unevaluated && i.length && o.props !== !0 && (o.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(i), o.props));
|
|
7332
|
-
const l = i.filter((
|
|
6870
|
+
const l = i.filter((_) => !(0, util_1$7.alwaysValidSchema)(o, r[_]));
|
|
7333
6871
|
if (l.length === 0)
|
|
7334
6872
|
return;
|
|
7335
6873
|
const p = t.name("valid");
|
|
7336
|
-
for (const
|
|
7337
|
-
d(
|
|
7338
|
-
function d(
|
|
7339
|
-
return o.opts.useDefaults && !o.compositeRule && r[
|
|
6874
|
+
for (const _ of l)
|
|
6875
|
+
d(_) ? u(_) : (t.if((0, code_1$2.propertyInData)(t, s, _, o.opts.ownProperties)), u(_), o.allErrors || t.else().var(p, !0), t.endIf()), e.it.definedProperties.add(_), e.ok(p);
|
|
6876
|
+
function d(_) {
|
|
6877
|
+
return o.opts.useDefaults && !o.compositeRule && r[_].default !== void 0;
|
|
7340
6878
|
}
|
|
7341
|
-
function u(
|
|
6879
|
+
function u(_) {
|
|
7342
6880
|
e.subschema({
|
|
7343
6881
|
keyword: "properties",
|
|
7344
|
-
schemaProp:
|
|
7345
|
-
dataProp:
|
|
6882
|
+
schemaProp: _,
|
|
6883
|
+
dataProp: _
|
|
7346
6884
|
}, p);
|
|
7347
6885
|
}
|
|
7348
6886
|
}
|
|
@@ -7360,17 +6898,17 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7360
6898
|
return;
|
|
7361
6899
|
const d = i.strictSchema && !i.allowMatchingProperties && s.properties, u = t.name("valid");
|
|
7362
6900
|
o.props !== !0 && !(o.props instanceof codegen_1$4.Name) && (o.props = (0, util_2.evaluatedPropsToName)(t, o.props));
|
|
7363
|
-
const { props:
|
|
7364
|
-
|
|
7365
|
-
function
|
|
6901
|
+
const { props: _ } = o;
|
|
6902
|
+
v();
|
|
6903
|
+
function v() {
|
|
7366
6904
|
for (const T of l)
|
|
7367
|
-
d &&
|
|
6905
|
+
d && w(T), o.allErrors ? P(T) : (t.var(u, !0), P(T), t.if(u));
|
|
7368
6906
|
}
|
|
7369
|
-
function
|
|
6907
|
+
function w(T) {
|
|
7370
6908
|
for (const $ in d)
|
|
7371
6909
|
new RegExp(T).test($) && (0, util_1$6.checkStrictMode)(o, `property ${$} matches pattern ${T} (use allowMatchingProperties)`);
|
|
7372
6910
|
}
|
|
7373
|
-
function
|
|
6911
|
+
function P(T) {
|
|
7374
6912
|
t.forIn("key", n, ($) => {
|
|
7375
6913
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${$})`, () => {
|
|
7376
6914
|
const g = p.includes(T);
|
|
@@ -7379,7 +6917,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7379
6917
|
schemaProp: T,
|
|
7380
6918
|
dataProp: $,
|
|
7381
6919
|
dataPropType: util_2.Type.Str
|
|
7382
|
-
}, u), o.opts.unevaluated &&
|
|
6920
|
+
}, u), o.opts.unevaluated && _ !== !0 ? t.assign((0, codegen_1$4._)`${_}[${$}]`, !0) : !g && !o.allErrors && t.if((0, codegen_1$4.not)(u), () => t.break());
|
|
7383
6921
|
});
|
|
7384
6922
|
});
|
|
7385
6923
|
}
|
|
@@ -7438,14 +6976,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7438
6976
|
const o = r, i = t.let("valid", !1), l = t.let("passing", null), p = t.name("_valid");
|
|
7439
6977
|
e.setParams({ passing: l }), t.block(d), e.result(i, () => e.reset(), () => e.error(!0));
|
|
7440
6978
|
function d() {
|
|
7441
|
-
o.forEach((u,
|
|
7442
|
-
let
|
|
7443
|
-
(0, util_1$4.alwaysValidSchema)(s, u) ? t.var(p, !0) :
|
|
6979
|
+
o.forEach((u, _) => {
|
|
6980
|
+
let v;
|
|
6981
|
+
(0, util_1$4.alwaysValidSchema)(s, u) ? t.var(p, !0) : v = e.subschema({
|
|
7444
6982
|
keyword: "oneOf",
|
|
7445
|
-
schemaProp:
|
|
6983
|
+
schemaProp: _,
|
|
7446
6984
|
compositeRule: !0
|
|
7447
|
-
}, p),
|
|
7448
|
-
t.assign(i, !0), t.assign(l,
|
|
6985
|
+
}, p), _ > 0 && t.if((0, codegen_1$3._)`${p} && ${i}`).assign(i, !1).assign(l, (0, codegen_1$3._)`[${l}, ${_}]`).else(), t.if(p, () => {
|
|
6986
|
+
t.assign(i, !0), t.assign(l, _), v && e.mergeEvaluated(v, codegen_1$3.Name);
|
|
7449
6987
|
});
|
|
7450
6988
|
});
|
|
7451
6989
|
}
|
|
@@ -7503,10 +7041,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7503
7041
|
}, l);
|
|
7504
7042
|
e.mergeEvaluated(u);
|
|
7505
7043
|
}
|
|
7506
|
-
function d(u,
|
|
7044
|
+
function d(u, _) {
|
|
7507
7045
|
return () => {
|
|
7508
|
-
const
|
|
7509
|
-
t.assign(i, l), e.mergeValidEvaluated(
|
|
7046
|
+
const v = e.subschema({ keyword: u }, l);
|
|
7047
|
+
t.assign(i, l), e.mergeValidEvaluated(v, i), _ ? t.assign(_, (0, codegen_1$2._)`${u}`) : e.setParams({ ifClause: u });
|
|
7510
7048
|
};
|
|
7511
7049
|
}
|
|
7512
7050
|
}
|
|
@@ -7559,15 +7097,15 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7559
7097
|
$data: !0,
|
|
7560
7098
|
error: error$1,
|
|
7561
7099
|
code(e, t) {
|
|
7562
|
-
const { gen: r, data: n, $data: s, schema: o, schemaCode: i, it: l } = e, { opts: p, errSchemaPath: d, schemaEnv: u, self:
|
|
7100
|
+
const { gen: r, data: n, $data: s, schema: o, schemaCode: i, it: l } = e, { opts: p, errSchemaPath: d, schemaEnv: u, self: _ } = l;
|
|
7563
7101
|
if (!p.validateFormats)
|
|
7564
7102
|
return;
|
|
7565
|
-
s ?
|
|
7566
|
-
function
|
|
7567
|
-
const
|
|
7568
|
-
ref:
|
|
7103
|
+
s ? v() : w();
|
|
7104
|
+
function v() {
|
|
7105
|
+
const P = r.scopeValue("formats", {
|
|
7106
|
+
ref: _.formats,
|
|
7569
7107
|
code: p.code.formats
|
|
7570
|
-
}), T = r.const("fDef", (0, codegen_1$1._)`${
|
|
7108
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${P}[${i}]`), $ = r.let("fType"), g = r.let("format");
|
|
7571
7109
|
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${T}.type || "string"`).assign(g, (0, codegen_1$1._)`${T}.validate`), () => r.assign($, (0, codegen_1$1._)`"string"`).assign(g, T)), e.fail$data((0, codegen_1$1.or)(k(), C()));
|
|
7572
7110
|
function k() {
|
|
7573
7111
|
return p.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${i} && !${g}`;
|
|
@@ -7577,19 +7115,19 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7577
7115
|
return (0, codegen_1$1._)`${g} && ${g} !== true && ${$} === ${t} && !${D}`;
|
|
7578
7116
|
}
|
|
7579
7117
|
}
|
|
7580
|
-
function
|
|
7581
|
-
const
|
|
7582
|
-
if (!
|
|
7118
|
+
function w() {
|
|
7119
|
+
const P = _.formats[o];
|
|
7120
|
+
if (!P) {
|
|
7583
7121
|
k();
|
|
7584
7122
|
return;
|
|
7585
7123
|
}
|
|
7586
|
-
if (
|
|
7124
|
+
if (P === !0)
|
|
7587
7125
|
return;
|
|
7588
|
-
const [T, $, g] = C(
|
|
7126
|
+
const [T, $, g] = C(P);
|
|
7589
7127
|
T === t && e.pass(I());
|
|
7590
7128
|
function k() {
|
|
7591
7129
|
if (p.strictSchema === !1) {
|
|
7592
|
-
|
|
7130
|
+
_.logger.warn(D());
|
|
7593
7131
|
return;
|
|
7594
7132
|
}
|
|
7595
7133
|
throw new Error(D());
|
|
@@ -7598,11 +7136,11 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7598
7136
|
}
|
|
7599
7137
|
}
|
|
7600
7138
|
function C(D) {
|
|
7601
|
-
const
|
|
7139
|
+
const b = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : p.code.formats ? (0, codegen_1$1._)`${p.code.formats}${(0, codegen_1$1.getProperty)(o)}` : void 0, O = r.scopeValue("formats", { key: o, ref: D, code: b });
|
|
7602
7140
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
|
|
7603
7141
|
}
|
|
7604
7142
|
function I() {
|
|
7605
|
-
if (typeof
|
|
7143
|
+
if (typeof P == "object" && !(P instanceof RegExp) && P.async) {
|
|
7606
7144
|
if (!u.$async)
|
|
7607
7145
|
throw new Error("async format in sync schema");
|
|
7608
7146
|
return (0, codegen_1$1._)`await ${g}(${n})`;
|
|
@@ -7672,31 +7210,31 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7672
7210
|
const p = t.let("valid", !1), d = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7673
7211
|
t.if((0, codegen_1._)`typeof ${d} == "string"`, () => u(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: d, tagName: l })), e.ok(p);
|
|
7674
7212
|
function u() {
|
|
7675
|
-
const
|
|
7213
|
+
const w = v();
|
|
7676
7214
|
t.if(!1);
|
|
7677
|
-
for (const
|
|
7678
|
-
t.elseIf((0, codegen_1._)`${d} === ${
|
|
7215
|
+
for (const P in w)
|
|
7216
|
+
t.elseIf((0, codegen_1._)`${d} === ${P}`), t.assign(p, _(w[P]));
|
|
7679
7217
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: d, tagName: l }), t.endIf();
|
|
7680
7218
|
}
|
|
7681
|
-
function
|
|
7682
|
-
const
|
|
7683
|
-
return e.mergeEvaluated(T, codegen_1.Name),
|
|
7219
|
+
function _(w) {
|
|
7220
|
+
const P = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: w }, P);
|
|
7221
|
+
return e.mergeEvaluated(T, codegen_1.Name), P;
|
|
7684
7222
|
}
|
|
7685
|
-
function
|
|
7686
|
-
var
|
|
7687
|
-
const
|
|
7223
|
+
function v() {
|
|
7224
|
+
var w;
|
|
7225
|
+
const P = {}, T = g(s);
|
|
7688
7226
|
let $ = !0;
|
|
7689
7227
|
for (let I = 0; I < i.length; I++) {
|
|
7690
7228
|
let D = i[I];
|
|
7691
7229
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, o.self.RULES) && (D = compile_1.resolveRef.call(o.self, o.schemaEnv.root, o.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7692
|
-
const
|
|
7693
|
-
if (typeof
|
|
7230
|
+
const b = (w = D == null ? void 0 : D.properties) === null || w === void 0 ? void 0 : w[l];
|
|
7231
|
+
if (typeof b != "object")
|
|
7694
7232
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7695
|
-
$ = $ && (T || g(D)), k(
|
|
7233
|
+
$ = $ && (T || g(D)), k(b, I);
|
|
7696
7234
|
}
|
|
7697
7235
|
if (!$)
|
|
7698
7236
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7699
|
-
return
|
|
7237
|
+
return P;
|
|
7700
7238
|
function g({ required: I }) {
|
|
7701
7239
|
return Array.isArray(I) && I.includes(l);
|
|
7702
7240
|
}
|
|
@@ -7704,15 +7242,15 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7704
7242
|
if (I.const)
|
|
7705
7243
|
C(I.const, D);
|
|
7706
7244
|
else if (I.enum)
|
|
7707
|
-
for (const
|
|
7708
|
-
C(
|
|
7245
|
+
for (const b of I.enum)
|
|
7246
|
+
C(b, D);
|
|
7709
7247
|
else
|
|
7710
7248
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7711
7249
|
}
|
|
7712
7250
|
function C(I, D) {
|
|
7713
|
-
if (typeof I != "string" || I in
|
|
7251
|
+
if (typeof I != "string" || I in P)
|
|
7714
7252
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7715
|
-
|
|
7253
|
+
P[I] = D;
|
|
7716
7254
|
}
|
|
7717
7255
|
}
|
|
7718
7256
|
}
|
|
@@ -7964,13 +7502,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7964
7502
|
const r = core$2, n = draft7, s = discriminator, o = require$$3, i = ["/properties"], l = "http://json-schema.org/draft-07/schema";
|
|
7965
7503
|
class p extends r.default {
|
|
7966
7504
|
_addVocabularies() {
|
|
7967
|
-
super._addVocabularies(), n.default.forEach((
|
|
7505
|
+
super._addVocabularies(), n.default.forEach((P) => this.addVocabulary(P)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7968
7506
|
}
|
|
7969
7507
|
_addDefaultMetaSchema() {
|
|
7970
7508
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7971
7509
|
return;
|
|
7972
|
-
const
|
|
7973
|
-
this.addMetaSchema(
|
|
7510
|
+
const P = this.opts.$data ? this.$dataMetaSchema(o, i) : o;
|
|
7511
|
+
this.addMetaSchema(P, l, !1), this.refs["http://json-schema.org/schema"] = l;
|
|
7974
7512
|
}
|
|
7975
7513
|
defaultMeta() {
|
|
7976
7514
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
|
|
@@ -7995,13 +7533,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7995
7533
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7996
7534
|
return u.CodeGen;
|
|
7997
7535
|
} });
|
|
7998
|
-
var
|
|
7536
|
+
var _ = validation_error;
|
|
7999
7537
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
8000
|
-
return
|
|
7538
|
+
return _.default;
|
|
8001
7539
|
} });
|
|
8002
|
-
var
|
|
7540
|
+
var v = ref_error;
|
|
8003
7541
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
8004
|
-
return
|
|
7542
|
+
return v.default;
|
|
8005
7543
|
} });
|
|
8006
7544
|
})(ajv$1, ajv$1.exports);
|
|
8007
7545
|
var ajvExports = ajv$1.exports;
|
|
@@ -8409,55 +7947,6 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
8409
7947
|
"themeFolderName"
|
|
8410
7948
|
]
|
|
8411
7949
|
},
|
|
8412
|
-
{
|
|
8413
|
-
type: "object",
|
|
8414
|
-
additionalProperties: !1,
|
|
8415
|
-
properties: {
|
|
8416
|
-
progress: {
|
|
8417
|
-
type: "object",
|
|
8418
|
-
properties: {
|
|
8419
|
-
weight: {
|
|
8420
|
-
type: "number"
|
|
8421
|
-
},
|
|
8422
|
-
caption: {
|
|
8423
|
-
type: "string"
|
|
8424
|
-
}
|
|
8425
|
-
},
|
|
8426
|
-
additionalProperties: !1
|
|
8427
|
-
},
|
|
8428
|
-
step: {
|
|
8429
|
-
type: "string",
|
|
8430
|
-
const: "applyWordPressPatches"
|
|
8431
|
-
},
|
|
8432
|
-
siteUrl: {
|
|
8433
|
-
type: "string"
|
|
8434
|
-
},
|
|
8435
|
-
wordpressPath: {
|
|
8436
|
-
type: "string"
|
|
8437
|
-
},
|
|
8438
|
-
addPhpInfo: {
|
|
8439
|
-
type: "boolean"
|
|
8440
|
-
},
|
|
8441
|
-
patchSecrets: {
|
|
8442
|
-
type: "boolean"
|
|
8443
|
-
},
|
|
8444
|
-
disableSiteHealth: {
|
|
8445
|
-
type: "boolean"
|
|
8446
|
-
},
|
|
8447
|
-
disableWpNewBlogNotification: {
|
|
8448
|
-
type: "boolean"
|
|
8449
|
-
},
|
|
8450
|
-
prepareForRunningInsideWebBrowser: {
|
|
8451
|
-
type: "boolean"
|
|
8452
|
-
},
|
|
8453
|
-
addFetchNetworkTransport: {
|
|
8454
|
-
type: "boolean"
|
|
8455
|
-
}
|
|
8456
|
-
},
|
|
8457
|
-
required: [
|
|
8458
|
-
"step"
|
|
8459
|
-
]
|
|
8460
|
-
},
|
|
8461
7950
|
{
|
|
8462
7951
|
type: "object",
|
|
8463
7952
|
additionalProperties: !1,
|
|
@@ -9489,7 +8978,7 @@ function compileBlueprint(e, {
|
|
|
9489
8978
|
onStepCompleted: n = () => {
|
|
9490
8979
|
}
|
|
9491
8980
|
} = {}) {
|
|
9492
|
-
var d, u,
|
|
8981
|
+
var d, u, _;
|
|
9493
8982
|
if (e = {
|
|
9494
8983
|
...e,
|
|
9495
8984
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9500,17 +8989,17 @@ function compileBlueprint(e, {
|
|
|
9500
8989
|
step: "setSiteOptions",
|
|
9501
8990
|
options: e.siteOptions
|
|
9502
8991
|
}), e.plugins) {
|
|
9503
|
-
const
|
|
8992
|
+
const v = e.plugins.map((w) => typeof w == "string" ? w.startsWith("https://") ? {
|
|
9504
8993
|
resource: "url",
|
|
9505
|
-
url:
|
|
8994
|
+
url: w
|
|
9506
8995
|
} : {
|
|
9507
8996
|
resource: "wordpress.org/plugins",
|
|
9508
|
-
slug:
|
|
9509
|
-
} :
|
|
8997
|
+
slug: w
|
|
8998
|
+
} : w).map((w) => ({
|
|
9510
8999
|
step: "installPlugin",
|
|
9511
|
-
pluginZipFile:
|
|
9000
|
+
pluginZipFile: w
|
|
9512
9001
|
}));
|
|
9513
|
-
e.steps.unshift(...
|
|
9002
|
+
e.steps.unshift(...v);
|
|
9514
9003
|
}
|
|
9515
9004
|
e.login && e.steps.push({
|
|
9516
9005
|
step: "login",
|
|
@@ -9518,19 +9007,19 @@ function compileBlueprint(e, {
|
|
|
9518
9007
|
});
|
|
9519
9008
|
const { valid: s, errors: o } = validateBlueprint(e);
|
|
9520
9009
|
if (!s) {
|
|
9521
|
-
const
|
|
9010
|
+
const v = new Error(
|
|
9522
9011
|
`Invalid blueprint: ${o[0].message} at ${o[0].instancePath}`
|
|
9523
9012
|
);
|
|
9524
|
-
throw
|
|
9013
|
+
throw v.errors = o, v;
|
|
9525
9014
|
}
|
|
9526
9015
|
const i = e.steps || [], l = i.reduce(
|
|
9527
|
-
(
|
|
9528
|
-
var
|
|
9529
|
-
return
|
|
9016
|
+
(v, w) => {
|
|
9017
|
+
var P;
|
|
9018
|
+
return v + (((P = w.progress) == null ? void 0 : P.weight) || 1);
|
|
9530
9019
|
},
|
|
9531
9020
|
0
|
|
9532
9021
|
), p = i.map(
|
|
9533
|
-
(
|
|
9022
|
+
(v) => compileStep(v, {
|
|
9534
9023
|
semaphore: r,
|
|
9535
9024
|
rootProgressTracker: t,
|
|
9536
9025
|
totalProgressWeight: l
|
|
@@ -9551,20 +9040,20 @@ function compileBlueprint(e, {
|
|
|
9551
9040
|
),
|
|
9552
9041
|
features: {
|
|
9553
9042
|
// Disable networking by default
|
|
9554
|
-
networking: ((
|
|
9043
|
+
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9555
9044
|
},
|
|
9556
|
-
run: async (
|
|
9045
|
+
run: async (v) => {
|
|
9557
9046
|
try {
|
|
9558
|
-
for (const { resources:
|
|
9559
|
-
for (const
|
|
9560
|
-
|
|
9561
|
-
for (const [
|
|
9047
|
+
for (const { resources: w } of p)
|
|
9048
|
+
for (const P of w)
|
|
9049
|
+
P.setPlayground(v), P.isAsync && P.resolve();
|
|
9050
|
+
for (const [w, { run: P, step: T }] of Object.entries(p))
|
|
9562
9051
|
try {
|
|
9563
|
-
const $ = await v
|
|
9052
|
+
const $ = await P(v);
|
|
9564
9053
|
n($, T);
|
|
9565
9054
|
} catch ($) {
|
|
9566
9055
|
throw new Error(
|
|
9567
|
-
`Error when executing the blueprint step #${
|
|
9056
|
+
`Error when executing the blueprint step #${w} (${JSON.stringify(
|
|
9568
9057
|
T
|
|
9569
9058
|
)}). Inspect the cause of this error for more details`,
|
|
9570
9059
|
{
|
|
@@ -9574,7 +9063,7 @@ function compileBlueprint(e, {
|
|
|
9574
9063
|
}
|
|
9575
9064
|
} finally {
|
|
9576
9065
|
try {
|
|
9577
|
-
await
|
|
9066
|
+
await v.goTo(
|
|
9578
9067
|
e.landingPage || "/"
|
|
9579
9068
|
);
|
|
9580
9069
|
} catch {
|
|
@@ -9626,31 +9115,31 @@ function compileStep(e, {
|
|
|
9626
9115
|
const s = r.stage(
|
|
9627
9116
|
(((u = e.progress) == null ? void 0 : u.weight) || 1) / n
|
|
9628
9117
|
), o = {};
|
|
9629
|
-
for (const
|
|
9630
|
-
let
|
|
9631
|
-
isFileReference(
|
|
9118
|
+
for (const _ of Object.keys(e)) {
|
|
9119
|
+
let v = e[_];
|
|
9120
|
+
isFileReference(v) && (v = Resource.create(v, {
|
|
9632
9121
|
semaphore: t
|
|
9633
|
-
})), o[
|
|
9122
|
+
})), o[_] = v;
|
|
9634
9123
|
}
|
|
9635
|
-
const i = async (
|
|
9636
|
-
var
|
|
9124
|
+
const i = async (_) => {
|
|
9125
|
+
var v;
|
|
9637
9126
|
try {
|
|
9638
9127
|
return s.fillSlowly(), await stepHandlers[e.step](
|
|
9639
|
-
|
|
9128
|
+
_,
|
|
9640
9129
|
await resolveArguments(o),
|
|
9641
9130
|
{
|
|
9642
9131
|
tracker: s,
|
|
9643
|
-
initialCaption: (
|
|
9132
|
+
initialCaption: (v = e.progress) == null ? void 0 : v.caption
|
|
9644
9133
|
}
|
|
9645
9134
|
);
|
|
9646
9135
|
} finally {
|
|
9647
9136
|
s.finish();
|
|
9648
9137
|
}
|
|
9649
9138
|
}, l = getResources(o), p = getResources(o).filter(
|
|
9650
|
-
(
|
|
9139
|
+
(_) => _.isAsync
|
|
9651
9140
|
), d = 1 / (p.length + 1);
|
|
9652
|
-
for (const
|
|
9653
|
-
|
|
9141
|
+
for (const _ of p)
|
|
9142
|
+
_.progress = s.stage(d);
|
|
9654
9143
|
return { run: i, step: e, resources: l };
|
|
9655
9144
|
}
|
|
9656
9145
|
function getResources(e) {
|
|
@@ -9725,27 +9214,27 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9725
9214
|
const { id: o, type: i, path: l } = Object.assign({ path: [] }, s.data), p = (s.data.argumentList || []).map(fromWireValue);
|
|
9726
9215
|
let d;
|
|
9727
9216
|
try {
|
|
9728
|
-
const u = l.slice(0, -1).reduce((
|
|
9217
|
+
const u = l.slice(0, -1).reduce((v, w) => v[w], e), _ = l.reduce((v, w) => v[w], e);
|
|
9729
9218
|
switch (i) {
|
|
9730
9219
|
case "GET":
|
|
9731
|
-
d =
|
|
9220
|
+
d = _;
|
|
9732
9221
|
break;
|
|
9733
9222
|
case "SET":
|
|
9734
9223
|
u[l.slice(-1)[0]] = fromWireValue(s.data.value), d = !0;
|
|
9735
9224
|
break;
|
|
9736
9225
|
case "APPLY":
|
|
9737
|
-
d =
|
|
9226
|
+
d = _.apply(u, p);
|
|
9738
9227
|
break;
|
|
9739
9228
|
case "CONSTRUCT":
|
|
9740
9229
|
{
|
|
9741
|
-
const
|
|
9742
|
-
d = proxy(
|
|
9230
|
+
const v = new _(...p);
|
|
9231
|
+
d = proxy(v);
|
|
9743
9232
|
}
|
|
9744
9233
|
break;
|
|
9745
9234
|
case "ENDPOINT":
|
|
9746
9235
|
{
|
|
9747
|
-
const { port1:
|
|
9748
|
-
expose(e,
|
|
9236
|
+
const { port1: v, port2: w } = new MessageChannel();
|
|
9237
|
+
expose(e, w), d = transfer(v, [v]);
|
|
9749
9238
|
}
|
|
9750
9239
|
break;
|
|
9751
9240
|
case "RELEASE":
|
|
@@ -9758,14 +9247,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9758
9247
|
d = { value: u, [throwMarker]: 0 };
|
|
9759
9248
|
}
|
|
9760
9249
|
Promise.resolve(d).catch((u) => ({ value: u, [throwMarker]: 0 })).then((u) => {
|
|
9761
|
-
const [
|
|
9762
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9250
|
+
const [_, v] = toWireValue(u);
|
|
9251
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: o }), v), i === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9763
9252
|
}).catch((u) => {
|
|
9764
|
-
const [
|
|
9253
|
+
const [_, v] = toWireValue({
|
|
9765
9254
|
value: new TypeError("Unserializable return value"),
|
|
9766
9255
|
[throwMarker]: 0
|
|
9767
9256
|
});
|
|
9768
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9257
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: o }), v);
|
|
9769
9258
|
});
|
|
9770
9259
|
}), t.start && t.start();
|
|
9771
9260
|
}
|
|
@@ -9841,7 +9330,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9841
9330
|
const [d, u] = processArguments(l);
|
|
9842
9331
|
return requestResponseMessage(e, {
|
|
9843
9332
|
type: "APPLY",
|
|
9844
|
-
path: t.map((
|
|
9333
|
+
path: t.map((_) => _.toString()),
|
|
9845
9334
|
argumentList: d
|
|
9846
9335
|
}, u).then(fromWireValue);
|
|
9847
9336
|
},
|
|
@@ -10068,7 +9557,6 @@ export {
|
|
|
10068
9557
|
SupportedPHPVersionsList,
|
|
10069
9558
|
activatePlugin,
|
|
10070
9559
|
activateTheme,
|
|
10071
|
-
applyWordPressPatches,
|
|
10072
9560
|
compileBlueprint,
|
|
10073
9561
|
connectPlayground,
|
|
10074
9562
|
cp,
|