@wp-playground/client 0.7.20 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +72 -107
- package/index.d.ts +919 -677
- package/index.js +3769 -4395
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
`):JSON.stringify(e,null,2),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ds=function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Ds==="NODE"){let e=function(r){return new Promise(function(n,s){r.onload=r.onerror=function(i){r.onload=r.onerror=null,i.type==="load"?n(r.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),s=new File([r],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(s,i,c){super(s);let o;c!=null&&c.lastModified&&(o=new Date),(!o||isNaN(o.getFullYear()))&&(o=new Date),this.lastModifiedDate=o,this.lastModified=o.getMilliseconds(),this.name=i||""}}global.File=r}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),e(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),e(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let r=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,o=await n.slice(r,r+i.byteLength).arrayBuffer(),u=new Uint8Array(o);new Uint8Array(i.buffer).set(u);const d=u.byteLength;s.byobRequest.respond(d),r+=d,r>=n.size&&s.close()}})})}if(Ds==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const tn=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","mu-plugins/0-sqlite.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"],Ms=Symbol("SleepFinished");function eo(e){return new Promise(t=>{setTimeout(()=>t(Ms),e)})}class to extends Error{constructor(){super("Acquiring lock timed out")}}class ro{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,eo(this.timeout)]).then(r=>{if(r===Ms)throw new to}):await t}else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function me(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=Fs(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function Ls(e){if(e==="/")return"/";e=Fs(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function Fs(e){const t=e[0]==="/";return e=no(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function no(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const s=e[n];s==="."?e.splice(n,1):s===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function qs(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let s=e;s>0;--s)n+=r[Math.floor(Math.random()*r.length)];return n}function so(){return qs(36,"-_")}function ge(e){return`json_decode(base64_decode('${io(JSON.stringify(e))}'), true)`}function Wt(e){const t={};for(const r in e)t[r]=ge(e[r]);return t}function io(e){return oo(new TextEncoder().encode(e))}function oo(e){const t=String.fromCodePoint(...e);return btoa(t)}const ao="playground-log",rs=(e,...t)=>{Pe.dispatchEvent(new CustomEvent(ao,{detail:{log:e,args:t}}))},co=(e,...t)=>{switch(typeof e.message=="string"?e.message=xr(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=xr(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},uo=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
2
|
+
`):JSON.stringify(e,null,2),Us=[],ns=e=>{Us.push(e)},Hr=e=>{if(e.raw===!0)ns(e.message);else{const t=po(typeof e.message=="object"?uo(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");ns(t)}};class lo extends EventTarget{constructor(t=[]){super(),this.handlers=t,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(Hr)?[...Us]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
3
3
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
4
|
-
`),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const
|
|
4
|
+
`),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const fo=()=>{try{if(process.env.NODE_ENV==="test")return[Hr,rs]}catch{}return[Hr,co,rs]},Pe=new lo(fo()),xr=e=>e.replace(/\t/g,""),po=(e,t,r)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),c=s+" "+i;return e=xr(e),`[${c}] ${r} ${t}: ${e}`};let Ar=0;const ss="/wordpress/wp-content/debug.log",ho=async e=>await e.fileExists(ss)?await e.readFileAsText(ss):"",mo=(e,t)=>{t.addEventListener("request.end",async()=>{const r=await ho(t);if(r.length>Ar){const n=r.substring(Ar);e.logMessage({message:n,raw:!0}),Ar=r.length}}),t.addEventListener("request.error",r=>{r=r,r.error&&(e.logMessage({message:`${r.error.message} ${r.error.stack}`,severity:"Fatal",prefix:r.source==="request"?"PHP":"WASM Crash"}),e.dispatchEvent(new CustomEvent(e.fatalErrorEvent,{detail:{logs:e.getLogs(),source:r.source}})))})},Pr=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot,i=await e.run({code:`<?php
|
|
5
5
|
define( 'WP_ADMIN', true );
|
|
6
|
-
require_once( ${
|
|
7
|
-
require_once( ${
|
|
6
|
+
require_once( ${ge(s)}. "/wp-load.php" );
|
|
7
|
+
require_once( ${ge(s)}. "/wp-admin/includes/plugin.php" );
|
|
8
8
|
|
|
9
9
|
// Set current user to admin
|
|
10
10
|
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
11
11
|
|
|
12
|
-
$plugin_path = ${
|
|
12
|
+
$plugin_path = ${ge(t)};
|
|
13
13
|
$response = false;
|
|
14
14
|
if (!is_dir($plugin_path)) {
|
|
15
15
|
$response = activate_plugin($plugin_path);
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
throw new Exception( 'Unable to activate plugin' );
|
|
36
|
-
`});if(
|
|
36
|
+
`});if(i.text!=="Plugin activated successfully")throw Pe.debug(i),new Error(`Plugin ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},rn=async(e,{themeFolderName:t},r)=>{r==null||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot,s=`${n}/wp-content/themes/${t}`;if(!await e.fileExists(s))throw new Error(`
|
|
37
37
|
Couldn't activate theme ${t}.
|
|
38
38
|
Theme not found at the provided theme path: ${s}.
|
|
39
39
|
Check the theme path to ensure it's correct.
|
|
40
40
|
If the theme is not installed, you can install it using the installTheme step.
|
|
41
41
|
More info can be found in the Blueprint documentation: https://wordpress.github.io/wordpress-playground/blueprints-api/steps/#ActivateThemeStep
|
|
42
|
-
`);const
|
|
42
|
+
`);const i=await e.run({code:`<?php
|
|
43
43
|
define( 'WP_ADMIN', true );
|
|
44
44
|
require_once( getenv('docroot') . "/wp-load.php" );
|
|
45
45
|
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
throw new Exception( 'Theme ' . getenv('themeFolderName') . ' could not be activated.' );
|
|
53
53
|
}
|
|
54
54
|
die('Theme activated successfully');
|
|
55
|
-
`,env:{docroot:n,themeFolderName:t}});if(
|
|
56
|
-
require_once ${
|
|
55
|
+
`,env:{docroot:n,themeFolderName:t}});if(i.text!=="Theme activated successfully")throw Pe.debug(i),new Error(`Theme ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},Vs=async(e,{code:t})=>await e.run({code:t}),zs=async(e,{options:t})=>await e.run(t),nn=async(e,{path:t})=>{await e.unlink(t)},Ws=async(e,{sql:t},r)=>{r==null||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${so()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,i=Wt({docroot:s,sqlFilename:n}),c=await e.run({code:`<?php
|
|
56
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
57
57
|
|
|
58
|
-
$handle = fopen(${
|
|
58
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
59
59
|
$buffer = '';
|
|
60
60
|
|
|
61
61
|
global $wpdb;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
$wpdb->query($buffer);
|
|
72
72
|
$buffer = '';
|
|
73
73
|
}
|
|
74
|
-
`});return await
|
|
74
|
+
`});return await nn(e,{path:n}),c},pr=async(e,{request:t})=>{Pe.warn('Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.');const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw Pe.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},yo=`<?php
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Rewrites the wp-config.php file to ensure specific constants are defined
|
|
@@ -402,33 +402,33 @@ function skip_whitespace($tokens) {
|
|
|
402
402
|
}
|
|
403
403
|
return $output;
|
|
404
404
|
}
|
|
405
|
-
`,
|
|
405
|
+
`,Ut=async(e,{consts:t,method:r="define-before-run"})=>{switch(r){case"define-before-run":await go(e,t);break;case"rewrite-wp-config":{const n=await e.documentRoot,s=me(n,"/wp-config.php"),i=await e.readFileAsText(s),c=await $o(e,i,t);await e.writeFile(s,c);break}default:throw new Error(`Invalid method: ${r}`)}};async function go(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function $o(e,t,r){await e.writeFile("/tmp/code.php",t);const n=Wt({consts:r});return await e.run({code:`${yo}
|
|
406
406
|
$wp_config_path = '/tmp/code.php';
|
|
407
407
|
$wp_config = file_get_contents($wp_config_path);
|
|
408
408
|
$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});
|
|
409
409
|
file_put_contents($wp_config_path, $new_wp_config);
|
|
410
|
-
`}),await e.readFileAsText("/tmp/code.php")}const
|
|
411
|
-
include ${
|
|
412
|
-
$site_options = ${
|
|
410
|
+
`}),await e.readFileAsText("/tmp/code.php")}const hr=async(e,{username:t="admin",password:r="password"}={},n)=>{var i,c,o;n==null||n.tracker.setCaption((n==null?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const s=await e.request({url:"/wp-login.php",method:"POST",body:{log:t,pwd:r,rememberme:"forever"}});if(!((o=(c=(i=s.headers)==null?void 0:i.location)==null?void 0:c[0])!=null&&o.includes("/wp-admin/")))throw Pe.warn("WordPress response was",{response:s,text:s.text}),new Error(`Failed to log in as ${t} with password ${r}`)},sn=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({code:`<?php
|
|
411
|
+
include ${ge(r)} . '/wp-load.php';
|
|
412
|
+
$site_options = ${ge(t)};
|
|
413
413
|
foreach($site_options as $name => $value) {
|
|
414
414
|
update_option($name, $value);
|
|
415
415
|
}
|
|
416
416
|
echo "Success";
|
|
417
|
-
`})},
|
|
418
|
-
include ${
|
|
419
|
-
$meta = ${
|
|
417
|
+
`})},Hs=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({code:`<?php
|
|
418
|
+
include ${ge(n)} . '/wp-load.php';
|
|
419
|
+
$meta = ${ge(t)};
|
|
420
420
|
foreach($meta as $name => $value) {
|
|
421
|
-
update_user_meta(${
|
|
421
|
+
update_user_meta(${ge(r)}, $name, $value);
|
|
422
422
|
}
|
|
423
|
-
`})};function
|
|
423
|
+
`})};function xs(e){return e.pathname.startsWith("/scope:")}function _o(e){return xs(e)?e.pathname.split("/")[1].split(":")[1]:null}const Bs=async e=>{var v;await Ut(e,{consts:{WP_ALLOW_MULTISITE:1}});const t=new URL(await e.absoluteUrl);if(t.port!==""){let w=`The current host is ${t.host}, but WordPress multisites do not support custom ports.`;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)}const r=t.pathname.replace(/\/$/,"")+"/",n=`${t.protocol}//${t.hostname}${r}`;await sn(e,{options:{siteurl:n,home:n}}),await hr(e,{});const s=await e.documentRoot,c=(await e.run({code:`<?php
|
|
424
424
|
define( 'WP_ADMIN', true );
|
|
425
|
-
require_once(${
|
|
425
|
+
require_once(${ge(s)} . "/wp-load.php");
|
|
426
426
|
|
|
427
427
|
// Set current user to admin
|
|
428
428
|
( get_users(array('role' => 'Administrator') )[0] );
|
|
429
429
|
|
|
430
|
-
require_once(${
|
|
431
|
-
$plugins_root = ${
|
|
430
|
+
require_once(${ge(s)} . "/wp-admin/includes/plugin.php");
|
|
431
|
+
$plugins_root = ${ge(s)} . "/wp-content/plugins";
|
|
432
432
|
$plugins = glob($plugins_root . "/*");
|
|
433
433
|
|
|
434
434
|
$deactivated_plugins = [];
|
|
@@ -452,9 +452,9 @@ foreach($plugins as $plugin_path) {
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
echo json_encode($deactivated_plugins);
|
|
455
|
-
`})).json,u=(
|
|
456
|
-
$_SERVER['HTTP_HOST'] = ${
|
|
457
|
-
$folder = ${
|
|
455
|
+
`})).json,u=(v=(await pr(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:v[1],d=await pr(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:wo({_wpnonce:u,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(d.httpStatusCode!==200)throw Pe.warn("WordPress response was",{response:d,text:d.text,headers:d.headers}),new Error(`Failed to enable multisite. Response code was ${d.httpStatusCode}`);await Ut(e,{consts:{MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:t.hostname,PATH_CURRENT_SITE:r}});const f=new URL(await e.absoluteUrl),p=xs(f)?"scope:"+_o(f):null;await e.writeFile("/internal/shared/preload/sunrise.php",`<?php
|
|
456
|
+
$_SERVER['HTTP_HOST'] = ${ge(f.hostname)};
|
|
457
|
+
$folder = ${ge(p)};
|
|
458
458
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
459
459
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
460
460
|
}
|
|
@@ -462,13 +462,13 @@ echo json_encode($deactivated_plugins);
|
|
|
462
462
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
463
463
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
464
464
|
}
|
|
465
|
-
`),await
|
|
466
|
-
require ${
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
465
|
+
`),await hr(e,{});for(const w of c)await Pr(e,{pluginPath:w})};function wo(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const Gs=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},Ks=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},Js=async(e,{path:t})=>{await e.mkdir(t)},Qs=async(e,{path:t})=>{await e.rmdir(t)},on=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),t.startsWith("/wordpress/wp-content/mu-plugins")&&!await e.fileExists("/wordpress/wp-content/mu-plugins")&&await e.mkdir("/wordpress/wp-content/mu-plugins"),await e.writeFile(t,r)},an=async(e,{siteUrl:t})=>{await Ut(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},Ys=async(e,{file:t},r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Importing content"),await on(e,{path:"/tmp/import.wxr",data:t});const n=await e.documentRoot;await e.run({code:`<?php
|
|
466
|
+
require ${ge(n)} . '/wp-load.php';
|
|
467
|
+
require ${ge(n)} . '/wp-admin/includes/admin.php';
|
|
468
|
+
|
|
470
469
|
kses_remove_filters();
|
|
471
|
-
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
470
|
+
$admin_id = get_users(array('role' => 'Administrator') )[0]->ID;
|
|
471
|
+
wp_set_current_user( $admin_id );
|
|
472
472
|
$importer = new WXR_Importer( array(
|
|
473
473
|
'fetch_attachments' => true,
|
|
474
474
|
'default_author' => $admin_id
|
|
@@ -482,7 +482,7 @@ echo json_encode($deactivated_plugins);
|
|
|
482
482
|
});
|
|
483
483
|
|
|
484
484
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
485
|
-
`})},
|
|
485
|
+
`})},Dr="/tmp/file.zip",vo=async(e,t,r)=>{if(t instanceof File){const s=t;t=Dr,await e.writeFile(t,new Uint8Array(await s.arrayBuffer()))}const n=Wt({zipPath:t,extractToPath:r});await e.run({code:`<?php
|
|
486
486
|
function unzip($zipPath, $extractTo, $overwrite = true)
|
|
487
487
|
{
|
|
488
488
|
if (!is_dir($extractTo)) {
|
|
@@ -499,14 +499,28 @@ echo json_encode($deactivated_plugins);
|
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
unzip(${n.zipPath}, ${n.extractToPath});
|
|
502
|
-
`}),await e.fileExists(
|
|
502
|
+
`}),await e.fileExists(Dr)&&await e.unlink(Dr)},Sr=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)Pe.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(!t)throw new Error("Either zipPath or zipFile must be provided");await vo(e,t||r,n)},Zs=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=me("/tmp","import");await e.mkdir(s),await Sr(e,{zipFile:t,extractToPath:s}),s=me(s,r);const i=me(s,"wp-content"),c=me(n,"wp-content");for(const f of tn){const p=me(i,f);await is(e,p);const v=me(c,f);await e.fileExists(v)&&(await e.mkdir(Ls(p)),await e.mv(v,p))}const o=me(s,"wp-content","database");await e.fileExists(o)||await e.mv(me(n,"wp-content","database"),o);const u=await e.listFiles(s);for(const f of u)await is(e,me(n,f)),await e.mv(me(s,f),me(n,f));await e.rmdir(s),await an(e,{siteUrl:await e.absoluteUrl});const d=ge(me(n,"wp-admin","upgrade.php"));await e.run({code:`<?php
|
|
503
503
|
$_GET['step'] = 'upgrade_db';
|
|
504
|
-
require ${
|
|
505
|
-
`})};async function
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
504
|
+
require ${d};
|
|
505
|
+
`})};async function is(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function Xs(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function ei(e,{targetPath:t,zipFile:r,ifAlreadyInstalled:n="overwrite"}){const i=r.name.replace(/\.zip$/,""),c=me(await e.documentRoot,"wp-content"),o=me(c,qs()),u=me(o,"assets",i);await e.fileExists(u)&&await e.rmdir(o,{recursive:!0}),await e.mkdir(o);try{await Sr(e,{zipFile:r,extractToPath:u});let d=await e.listFiles(u,{prependPath:!0});d=d.filter(b=>!b.endsWith("/__MACOSX"));const f=d.length===1&&await e.isDir(d[0]);let p,v="";f?(v=d[0],p=d[0].split("/").pop()):(v=u,p=i);const w=`${t}/${p}`;if(await e.fileExists(w)){if(!await e.isDir(w))throw new Error(`Cannot install asset ${p} to ${w} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`);if(n==="overwrite")await e.rmdir(w,{recursive:!0});else{if(n==="skip")return{assetFolderPath:w,assetFolderName:p};throw new Error(`Cannot install asset ${p} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`)}}return await e.mv(v,w),{assetFolderPath:w,assetFolderName:p}}finally{await e.rmdir(o,{recursive:!0})}}function Tr(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const ti=async(e,{pluginZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=t.name.split("/").pop()||"plugin.zip",c=Tr(i);s==null||s.tracker.setCaption(`Installing the ${c} plugin`);const{assetFolderPath:o}=await ei(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in n?n.activate:!0)&&await Pr(e,{pluginPath:o,pluginName:c},s)},ri=async(e,{themeZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=Tr(t.name);s==null||s.tracker.setCaption(`Installing the ${i} theme`);const{assetFolderName:c}=await ei(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in n?n.activate:!0)&&await rn(e,{themeFolderName:c},s)},ni=async(e,t,r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Resetting WordPress data");const n=await e.documentRoot;await e.run({env:{DOCROOT:n},code:`<?php
|
|
506
|
+
require getenv('DOCROOT') . '/wp-load.php';
|
|
507
|
+
|
|
508
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_posts WHERE id > 0');
|
|
509
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_posts'");
|
|
510
|
+
|
|
511
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_postmeta WHERE post_id > 1');
|
|
512
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=20 WHERE NAME='wp_postmeta'");
|
|
513
|
+
|
|
514
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_comments');
|
|
515
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_comments'");
|
|
516
|
+
|
|
517
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_commentmeta');
|
|
518
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_commentmeta'");
|
|
519
|
+
`})},si=async(e,{options:t})=>{await e.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:t.adminPassword||"admin",admin_password:t.adminPassword||"password",admin_password2:t.adminPassword||"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}})},ii=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=me(n,"wp-content");let i=tn;t&&(i=i.filter(u=>!u.startsWith("themes/twenty")).filter(u=>u!=="mu-plugins/sqlite-database-integration"));const c=Wt({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(u=>me(n,"wp-content",u)),additionalPaths:t?{[me(n,"wp-config.php")]:"wp-config.php"}:{}});await Eo(e,`zipDir(${c.wpContentPath}, ${c.zipPath}, array(
|
|
520
|
+
'exclude_paths' => ${c.exceptPaths},
|
|
521
|
+
'zip_root' => ${c.documentRoot},
|
|
522
|
+
'additional_paths' => ${c.additionalPaths}
|
|
523
|
+
));`);const o=await e.readFileAsBuffer(r);return e.unlink(r),o},bo=`<?php
|
|
510
524
|
|
|
511
525
|
function zipDir($root, $output, $options = array())
|
|
512
526
|
{
|
|
@@ -565,7 +579,7 @@ function join_paths()
|
|
|
565
579
|
|
|
566
580
|
return preg_replace('#/+#', '/', join('/', $paths));
|
|
567
581
|
}
|
|
568
|
-
`;async function
|
|
582
|
+
`;async function Eo(e,t){return await e.run({code:bo+t})}const oi=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if(typeof t=="string"?(t=t.trim(),n=Po(t)):n=t,n.shift()!=="wp")throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`<?php
|
|
569
583
|
// Set up the environment to emulate a shell script
|
|
570
584
|
// call.
|
|
571
585
|
|
|
@@ -578,67 +592,18 @@ function join_paths()
|
|
|
578
592
|
$GLOBALS['argv'] = array_merge([
|
|
579
593
|
"/tmp/wp-cli.phar",
|
|
580
594
|
"--path=/wordpress"
|
|
581
|
-
], ${
|
|
595
|
+
], ${ge(n)});
|
|
582
596
|
|
|
583
597
|
// Provide stdin, stdout, stderr streams outside of
|
|
584
598
|
// the CLI SAPI.
|
|
585
599
|
define('STDIN', fopen('php://stdin', 'rb'));
|
|
586
600
|
define('STDOUT', fopen('php://stdout', 'wb'));
|
|
587
|
-
define('STDERR', fopen('
|
|
588
|
-
|
|
589
|
-
require( ${
|
|
590
|
-
`);const o=await e.run({scriptPath:"/wordpress/run-cli.php"});if(o.errors)throw new Error(o.errors);return o};function splitShellCommand(e){let n=0,s="";const o=[];let i="";for(let c=0;c<e.length;c++){const u=e[c];n===0?u==='"'||u==="'"?(n=1,s=u):u.match(/\s/)?(i&&o.push(i),i=""):i+=u:n===1&&(u==="\\"?(c++,i+=e[c]):u===s?(n=0,s=""):i+=u)}return i&&o.push(i),o}const allStepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,cp,defineSiteUrl,defineWpConfigConsts,enableMultisite,exportWXR,importWordPressFiles,importWxr,installPlugin,installTheme,login,mkdir,mv,request,rm,rmdir,runPHP,runPHPWithOptions,runSql,runWpInstallationWizard,setSiteOptions,unzip,updateUserMeta,wpCLI:wpCLI$1,writeFile,zipWpContent},Symbol.toStringTag,{value:"Module"})),FALLBACK_FILE_SIZE=5*1024*1024;function cloneResponseMonitorProgress(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||FALLBACK_FILE_SIZE;function s(o,i){t(new CustomEvent("progress",{detail:{loaded:o,total:i}}))}return new Response(new ReadableStream({async start(o){if(!e.body){o.close();return}const i=e.body.getReader();let c=0;for(;;)try{const{done:u,value:l}=await i.read();if(l&&(c+=l.byteLength),u){s(c,c),o.close();break}else s(c,n),o.enqueue(l)}catch(u){logger.error({e:u}),o.error(u);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const PROGRESS_EPSILON=1e-5;class ProgressTracker extends EventTarget{constructor({weight:t=1,caption:r="",fillTime:n=4}={}){super(),this._selfWeight=1,this._selfDone=!1,this._selfProgress=0,this._selfCaption="",this._isFilling=!1,this._subTrackers=[],this._weight=t,this._selfCaption=r,this._fillTime=n}stage(t,r=""){if(t||(t=this._selfWeight),this._selfWeight-t<-PROGRESS_EPSILON)throw new Error(`Cannot add a stage with weight ${t} as the total weight of registered stages would exceed 1.`);this._selfWeight-=t;const n=new ProgressTracker({caption:r,weight:t,fillTime:this._fillTime});return this._subTrackers.push(n),n.addEventListener("progress",()=>this.notifyProgress()),n.addEventListener("done",()=>{this.done&&this.notifyDone()}),n}fillSlowly({stopBeforeFinishing:t=!0}={}){if(this._isFilling)return;this._isFilling=!0;const r=100,n=this._fillTime/r;this._fillInterval=setInterval(()=>{this.set(this._selfProgress+1),t&&this._selfProgress>=99&&clearInterval(this._fillInterval)},n)}set(t){this._selfProgress=Math.min(t,100),this.notifyProgress(),this._selfProgress+PROGRESS_EPSILON>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let t=this._subTrackers.length-1;t>=0;t--)if(!this._subTrackers[t].done){const r=this._subTrackers[t].caption;if(r)return r}return this._selfCaption}setCaption(t){this._selfCaption=t,this.notifyProgress()}get done(){return this.progress+PROGRESS_EPSILON>=100}get progress(){if(this._selfDone)return 100;const t=this._subTrackers.reduce((r,n)=>r+n.progress*n.weight,this._selfProgress*this._selfWeight);return Math.round(t*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=t=>{this.set(t)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=t=>{this.set(t.detail.loaded/t.detail.total*100)}),this._loadingListener}pipe(t){t.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",r=>{t.setProgress({progress:r.detail.progress,caption:r.detail.caption})}),this.addEventListener("done",()=>{t.setLoaded()})}addEventListener(t,r){super.addEventListener(t,r)}removeEventListener(t,r){super.removeEventListener(t,r)}notifyProgress(){const t=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return t.progress},get caption(){return t.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const responseTexts={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class PHPResponse{constructor(t,r,n,s="",o=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=o,this.errors=s}static forHttpCode(t,r=""){return new PHPResponse(t,{},new TextEncoder().encode(r||responseTexts[t]||""))}static fromRawData(t){return new PHPResponse(t.httpStatusCode,t.headers,t.bytes,t.errors,t.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return new TextDecoder().decode(this.bytes)}}const FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(r,n,s){const o=s.value;s.value=function(...i){try{return o.apply(this,i)}catch(c){const u=typeof c=="object"?c==null?void 0:c.errno:null;if(u in FileErrorCodes){const l=FileErrorCodes[u],p=typeof i[0]=="string"?i[0]:null,f=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${f}: ${l}`,{cause:c})}throw c}}}}const loadedRuntimes=new Map;function getLoadedRuntime(e){return loadedRuntimes.get(e)}(function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"})();const kError=Symbol("error"),kMessage=Symbol("message");class ErrorEvent2 extends Event{constructor(t,r={}){super(t),this[kError]=r.error===void 0?null:r.error,this[kMessage]=r.message===void 0?"":r.message}get error(){return this[kError]}get message(){return this[kMessage]}}Object.defineProperty(ErrorEvent2.prototype,"error",{enumerable:!0});Object.defineProperty(ErrorEvent2.prototype,"message",{enumerable:!0});const ErrorEvent=typeof globalThis.ErrorEvent=="function"?globalThis.ErrorEvent:ErrorEvent2;function isExitCodeZero(e){return e instanceof Error?"exitCode"in e&&(e==null?void 0:e.exitCode)===0||(e==null?void 0:e.name)==="ExitStatus"&&"status"in e&&e.status===0:!1}class UnhandledRejectionsTarget extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(t,r){++this.listenersCount,super.addEventListener(t,r)}removeEventListener(t,r){--this.listenersCount,super.removeEventListener(t,r)}hasListeners(){return this.listenersCount>0}}function improveWASMErrorReporting(e){e.asm={...e.asm};const t=new UnhandledRejectionsTarget;for(const r in e.asm)if(typeof e.asm[r]=="function"){const n=e.asm[r];e.asm[r]=function(...s){var o;try{return n(...s)}catch(i){if(!(i instanceof Error))throw i;const c=clarifyErrorMessage(i,(o=e.lastAsyncifyStackSource)==null?void 0:o.stack);if(e.lastAsyncifyStackSource&&(i.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:i,message:c}));return}throw isExitCodeZero(i)||showCriticalErrorBox(c),i}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
|
|
591
|
-
|
|
592
|
-
This stack trace is lacking. For a better one initialize
|
|
593
|
-
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
594
|
-
|
|
595
|
-
`),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const n of functionsMaybeMissingFromAsyncify)r+=` * ${n}
|
|
596
|
-
`;return r}return e.message}const UNREACHABLE_ERROR=`
|
|
597
|
-
"unreachable" WASM instruction executed.
|
|
598
|
-
|
|
599
|
-
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
600
|
-
list when building PHP.wasm.
|
|
601
|
-
|
|
602
|
-
You will need to file a new issue in the WordPress Playground repository
|
|
603
|
-
and paste this error message there:
|
|
604
|
-
|
|
605
|
-
https://github.com/WordPress/wordpress-playground/issues/new
|
|
606
|
-
|
|
607
|
-
If you're a core developer, the typical fix is to:
|
|
608
|
-
|
|
609
|
-
* Isolate a minimal reproduction of the error
|
|
610
|
-
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
611
|
-
* Run 'npm run fix-asyncify'
|
|
612
|
-
* Commit the changes, push to the repo, release updated NPM packages
|
|
613
|
-
|
|
614
|
-
Below is a list of all the PHP functions found in the stack trace to
|
|
615
|
-
help with the minimal reproduction. If they're all already listed in
|
|
616
|
-
the Dockerfile, you'll need to trigger this error again with long stack
|
|
617
|
-
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
618
|
-
CLI option:
|
|
619
|
-
|
|
620
|
-
`,redBg="\x1B[41m",bold="\x1B[1m",reset="\x1B[0m",eol="\x1B[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,!(e!=null&&e.trim().startsWith("Program terminated with exit")))){logger.log(`${redBg}
|
|
621
|
-
${eol}
|
|
622
|
-
${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
623
|
-
`))logger.log(`${eol} ${t} `);logger.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split(`
|
|
624
|
-
`).slice(1).map(r=>{const n=r.trim().substring(3).split(" ");return{fn:n.length>=2?n[0]:"<unknown>",isWasm:r.includes("wasm://")}}).filter(({fn:r,isWasm:n})=>n&&!r.startsWith("dynCall_")&&!r.startsWith("invoke_")).map(({fn:r})=>r);return Array.from(new Set(t))}catch{return[]}}var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");class PHPExecutionFailureError extends Error{constructor(t,r,n){super(t),this.response=r,this.source=n}}const PHP_INI_PATH="/internal/shared/php.ini",AUTO_PREPEND_SCRIPT="/internal/shared/auto_prepend_file.php";var xe,be,Ee,we,Ue,nt,Nt,st,It,ot,jt,it,At,at,Dt,ct,Ft,lt,Mt,dt,Lt,ut,qt,pt,xt,Ze,yt,ft,Ut,ht,Vt,mt,Ht;class BasePHP{constructor(e){oe(this,nt);oe(this,st);oe(this,ot);oe(this,it);oe(this,at);oe(this,ct);oe(this,lt);oe(this,dt);oe(this,ut);oe(this,pt);oe(this,Ze);oe(this,ft);oe(this,ht);oe(this,mt);oe(this,xe,void 0);oe(this,be,void 0);oe(this,Ee,void 0);oe(this,we,void 0);oe(this,Ue,void 0);$e(this,be,!1),$e(this,Ee,null),$e(this,we,new Map),$e(this,Ue,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e)}addEventListener(e,t){ce(this,we).has(e)||ce(this,we).set(e,new Set),ce(this,we).get(e).add(t)}removeEventListener(e,t){var r;(r=ce(this,we).get(e))==null||r.delete(t)}dispatchEvent(e){const t=ce(this,we).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){ce(this,Ue).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.internalUrlToPath(e)}initializeRuntime(e){if(this[__private__dont__use])throw new Error("PHP runtime already initialized.");const t=getLoadedRuntime(e);if(!t)throw new Error("Invalid PHP runtime id.");this[__private__dont__use]=t,this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[PHP_INI_PATH]),this.fileExists(PHP_INI_PATH)||this.writeFile(PHP_INI_PATH,["auto_prepend_file="+AUTO_PREPEND_SCRIPT,"memory_limit=256M","ignore_repeated_errors = 1","error_reporting = E_ALL","display_errors = 1","html_errors = 1","display_startup_errors = On","log_errors = 1","always_populate_raw_post_data = -1","upload_max_filesize = 2000M","post_max_size = 2000M","disable_functions = curl_exec,curl_multi_exec","allow_url_fopen = Off","allow_url_include = Off","session.save_path = /home/web_user","implicit_flush = 1","output_buffering = 0","max_execution_time = 0","max_input_time = -1"].join(`
|
|
625
|
-
`)),this.fileExists(AUTO_PREPEND_SCRIPT)||this.writeFile(AUTO_PREPEND_SCRIPT,`<?php
|
|
626
|
-
// Define constants set via defineConstant() calls
|
|
627
|
-
if(file_exists('/internal/shared/consts.json')) {
|
|
628
|
-
$consts = json_decode(file_get_contents('/internal/shared/consts.json'), true);
|
|
629
|
-
foreach ($consts as $const => $value) {
|
|
630
|
-
if (!defined($const) && is_scalar($value)) {
|
|
631
|
-
define($const, $value);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
// Preload all the files from /internal/shared/preload
|
|
636
|
-
foreach (glob('/internal/shared/preload/*.php') as $file) {
|
|
637
|
-
require_once $file;
|
|
638
|
-
}
|
|
639
|
-
`),t.onMessage=async r=>{for(const n of ce(this,Ue)){const s=await n(r);if(s)return s}return""},$e(this,Ee,improveWASMErrorReporting(t)),this.dispatchEvent({type:"runtime.initialized"})}async setSapiName(e){if(this[__private__dont__use].ccall("wasm_set_sapi_name",NUMBER,[STRING],[e])!==0)throw new Error("Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?");$e(this,xe,e)}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e){if(logger.warn("PHP.request() is deprecated. Please use new PHPRequestHandler() instead."),!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e)}async run(e){const t=await this.semaphore.acquire();let r;try{if(ce(this,be)||(ie(this,st,It).call(this),$e(this,be,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ie(this,it,At).call(this,e.relativeUri||""),ie(this,dt,Lt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443",o=ie(this,lt,Mt).call(this,s,e.protocol||"http");ie(this,at,Dt).call(this,s),ie(this,ct,Ft).call(this,o),ie(this,ut,qt).call(this,n),e.body&&(r=ie(this,pt,xt).call(this,e.body)),typeof e.code=="string"?(this.writeFile("/internal/eval.php",e.code),ie(this,Ze,yt).call(this,"/internal/eval.php")):ie(this,Ze,yt).call(this,e.scriptPath||"");const i=ie(this,nt,Nt).call(this,e.$_SERVER,n,o);for(const l in i)ie(this,ft,Ut).call(this,l,i[l]);const c=e.env||{};for(const l in c)ie(this,ht,Vt).call(this,l,c[l]);const u=await ie(this,mt,Ht).call(this);if(u.exitCode!==0){logger.warn("PHP.run() output was:",u.text);const l=new PHPExecutionFailureError(`PHP.run() failed with exit code ${u.exitCode} and the following output: `+u.errors,u,"request");throw logger.error(l),l}return u}catch(n){throw this.dispatchEvent({type:"request.error",error:n,source:n.source??"php-wasm"}),n}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/shared/consts.json")&&this.readFileAsText("/internal/shared/consts.json")||"{}")}catch{}this.writeFile("/internal/shared/consts.json",JSON.stringify({...r,[e]:t}))}mkdir(e){this[__private__dont__use].FS.mkdirTree(e)}mkdirTree(e){this.mkdir(e)}readFileAsText(e){return new TextDecoder().decode(this.readFileAsBuffer(e))}readFileAsBuffer(e){return this[__private__dont__use].FS.readFile(e)}writeFile(e,t){this[__private__dont__use].FS.writeFile(e,t)}unlink(e){this[__private__dont__use].FS.unlink(e)}mv(e,t){const r=this[__private__dont__use].FS;try{const n=r.lookupPath(e).node.mount,s=this.fileExists(t)?r.lookupPath(t).node.mount:r.lookupPath(dirname(t)).node.mount;n.mountpoint!==s.mountpoint?(copyRecursive(r,e,t),this.rmdir(e,{recursive:!0})):r.rename(e,t)}catch(n){const s=getEmscriptenFsError(n);throw s?new Error(`Could not move ${e} to ${t}: ${s}`,{cause:n}):n}}rmdir(e,t={recursive:!0}){t!=null&&t.recursive&&this.listFiles(e).forEach(r=>{const n=`${e}/${r}`;this.isDir(n)?this.rmdir(n,t):this.unlink(n)}),this[__private__dont__use].FS.rmdir(e)}listFiles(e,t={prependPath:!1}){if(!this.fileExists(e))return[];try{const r=this[__private__dont__use].FS.readdir(e).filter(n=>n!=="."&&n!=="..");if(t.prependPath){const n=e.replace(/\/$/,"");return r.map(s=>`${n}/${s}`)}return r}catch(r){return logger.error(r,{path:e}),[]}}isDir(e){return this.fileExists(e)?this[__private__dont__use].FS.isDir(this[__private__dont__use].FS.lookupPath(e).node.mode):!1}fileExists(e){try{return this[__private__dont__use].FS.lookupPath(e),!0}catch{return!1}}hotSwapPHPRuntime(e,t){const r=this[__private__dont__use].FS;try{this.exit()}catch{}this.initializeRuntime(e),ce(this,xe)&&this.setSapiName(ce(this,xe)),t&©FS(r,this[__private__dont__use].FS,t)}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}$e(this,be,!1),$e(this,Ee,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}[Symbol.dispose](){ce(this,be)&&this.exit(0)}}xe=new WeakMap,be=new WeakMap,Ee=new WeakMap,we=new WeakMap,Ue=new WeakMap,nt=new WeakSet,Nt=function(e,t,r){const n={...e||{}};n.HTTPS=n.HTTPS||r===443?"on":"off";for(const s in t){let o="HTTP_";["content-type","content-length"].includes(s.toLowerCase())&&(o=""),n[`${o}${s.toUpperCase().replace(/-/g,"_")}`]=t[s]}return n},st=new WeakSet,It=function(){this[__private__dont__use].ccall("php_wasm_init",null,[],[])},ot=new WeakSet,jt=function(){const e="/internal/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const s=n.indexOf(": "),o=n.substring(0,s).toLowerCase(),i=n.substring(s+2);o in r||(r[o]=[]),r[o].push(i)}return{headers:r,httpStatusCode:t.status}},it=new WeakSet,At=function(e){if(this[__private__dont__use].ccall("wasm_set_request_uri",null,[STRING],[e]),e.includes("?")){const t=e.substring(e.indexOf("?")+1);this[__private__dont__use].ccall("wasm_set_query_string",null,[STRING],[t])}},at=new WeakSet,Dt=function(e){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e])},ct=new WeakSet,Ft=function(e){this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[e])},lt=new WeakSet,Mt=function(e,t){let r;try{r=parseInt(new URL(e).port,10)}catch{}return(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),r},dt=new WeakSet,Lt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},ut=new WeakSet,qt=function(e){e.cookie&&this[__private__dont__use].ccall("wasm_set_cookies",null,[STRING],[e.cookie]),e["content-type"]&&this[__private__dont__use].ccall("wasm_set_content_type",null,[STRING],[e["content-type"]]),e["content-length"]&&this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[parseInt(e["content-length"],10)])},pt=new WeakSet,xt=function(e){let t,r;typeof e=="string"?(logger.warn("Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"),r=this[__private__dont__use].lengthBytesUTF8(e),t=r+1):(r=e.byteLength,t=e.byteLength);const n=this[__private__dont__use].malloc(t);if(!n)throw new Error("Could not allocate memory for the request body.");return typeof e=="string"?this[__private__dont__use].stringToUTF8(e,n,t+1):this[__private__dont__use].HEAPU8.set(e,n),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[n]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[r]),n},Ze=new WeakSet,yt=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},ft=new WeakSet,Ut=function(e,t){this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,t])},ht=new WeakSet,Vt=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},mt=new WeakSet,Ht=async function(){var s;let e,t;try{e=await new Promise((o,i)=>{var u;t=l=>{logger.error(l),logger.error(l.error);const p=new Error("Rethrown");p.cause=l.error,p.betterMessage=l.message,i(p)},(u=ce(this,Ee))==null||u.addEventListener("error",t);const c=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return c instanceof Promise?c.then(o,i):o(c)})}catch(o){for(const l in this)typeof this[l]=="function"&&(this[l]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const i=o,c="betterMessage"in i?i.betterMessage:i.message,u=new Error(c);throw u.cause=i,logger.error(u),u}finally{(s=ce(this,Ee))==null||s.removeEventListener("error",t)}const{headers:r,httpStatusCode:n}=ie(this,ot,jt).call(this);return new PHPResponse(e===0?n:500,r,this.readFileAsBuffer("/internal/stdout"),this.readFileAsText("/internal/stderr"),e)};__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdir",1);__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdirTree",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsText",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsBuffer",1);__decorateClass([rethrowFileSystemError('Could not write to "{path}"')],BasePHP.prototype,"writeFile",1);__decorateClass([rethrowFileSystemError('Could not unlink "{path}"')],BasePHP.prototype,"unlink",1);__decorateClass([rethrowFileSystemError('Could not remove directory "{path}"')],BasePHP.prototype,"rmdir",1);__decorateClass([rethrowFileSystemError('Could not list files in "{path}"')],BasePHP.prototype,"listFiles",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"isDir",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"fileExists",1);function normalizeHeaders(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}function copyFS(e,t,r){let n;try{n=e.lookupPath(r)}catch{return}if(!("contents"in n.node))return;if(!e.isDir(n.node.mode)){t.writeFile(r,e.readFile(r));return}t.mkdirTree(r);const s=e.readdir(r).filter(o=>o!=="."&&o!=="..");for(const o of s)copyFS(e,t,joinPaths(r,o))}function copyRecursive(e,t,r){const n=e.lookupPath(t).node;if(e.isDir(n.mode)){e.mkdirTree(r);const s=e.readdir(t).filter(o=>o!=="."&&o!=="..");for(const o of s)copyRecursive(e,joinPaths(t,o),joinPaths(r,o))}else e.writeFile(r,e.readFile(t))}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const{hasOwnProperty}=Object.prototype,encode=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;const r=t.platform==="win32"?`\r
|
|
601
|
+
define('STDERR', fopen('php://stderr', 'wb'));
|
|
602
|
+
|
|
603
|
+
require( ${ge(r)} );
|
|
604
|
+
`);const i=await e.run({scriptPath:"/wordpress/run-cli.php"});if(i.errors)throw new Error(i.errors);return i};function Po(e){let n=0,s="";const i=[];let c="";for(let o=0;o<e.length;o++){const u=e[o];n===0?u==='"'||u==="'"?(n=1,s=u):u.match(/\s/)?(c&&i.push(c),c=""):c+=u:n===1&&(u==="\\"?(o++,c+=e[o]):u===s?(n=0,s=""):c+=u)}return c&&i.push(c),i}const So=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin:Pr,activateTheme:rn,cp:Gs,defineSiteUrl:an,defineWpConfigConsts:Ut,enableMultisite:Bs,exportWXR:Xs,importWordPressFiles:Zs,importWxr:Ys,installPlugin:ti,installTheme:ri,login:hr,mkdir:Js,mv:Ks,request:pr,resetData:ni,rm:nn,rmdir:Qs,runPHP:Vs,runPHPWithOptions:zs,runSql:Ws,runWpInstallationWizard:si,setSiteOptions:sn,unzip:Sr,updateUserMeta:Hs,wpCLI:oi,writeFile:on,zipWpContent:ii},Symbol.toStringTag,{value:"Module"})),To=5*1024*1024;function Ro(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||To;function s(i,c){t(new CustomEvent("progress",{detail:{loaded:i,total:c}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const c=e.body.getReader();let o=0;for(;;)try{const{done:u,value:d}=await c.read();if(d&&(o+=d.byteLength),u){s(o,o),i.close();break}else s(o,n),i.enqueue(d)}catch(u){Pe.error({e:u}),i.error(u);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const Mr=1e-5;class Rr extends EventTarget{constructor({weight:t=1,caption:r="",fillTime:n=4}={}){super(),this._selfWeight=1,this._selfDone=!1,this._selfProgress=0,this._selfCaption="",this._isFilling=!1,this._subTrackers=[],this._weight=t,this._selfCaption=r,this._fillTime=n}stage(t,r=""){if(t||(t=this._selfWeight),this._selfWeight-t<-Mr)throw new Error(`Cannot add a stage with weight ${t} as the total weight of registered stages would exceed 1.`);this._selfWeight-=t;const n=new Rr({caption:r,weight:t,fillTime:this._fillTime});return this._subTrackers.push(n),n.addEventListener("progress",()=>this.notifyProgress()),n.addEventListener("done",()=>{this.done&&this.notifyDone()}),n}fillSlowly({stopBeforeFinishing:t=!0}={}){if(this._isFilling)return;this._isFilling=!0;const r=100,n=this._fillTime/r;this._fillInterval=setInterval(()=>{this.set(this._selfProgress+1),t&&this._selfProgress>=99&&clearInterval(this._fillInterval)},n)}set(t){this._selfProgress=Math.min(t,100),this.notifyProgress(),this._selfProgress+Mr>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let t=this._subTrackers.length-1;t>=0;t--)if(!this._subTrackers[t].done){const r=this._subTrackers[t].caption;if(r)return r}return this._selfCaption}setCaption(t){this._selfCaption=t,this.notifyProgress()}get done(){return this.progress+Mr>=100}get progress(){if(this._selfDone)return 100;const t=this._subTrackers.reduce((r,n)=>r+n.progress*n.weight,this._selfProgress*this._selfWeight);return Math.round(t*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=t=>{this.set(t)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=t=>{this.set(t.detail.loaded/t.detail.total*100)}),this._loadingListener}pipe(t){t.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",r=>{t.setProgress({progress:r.detail.progress,caption:r.detail.caption})}),this.addEventListener("done",()=>{t.setLoaded()})}addEventListener(t,r){super.addEventListener(t,r)}removeEventListener(t,r){super.removeEventListener(t,r)}notifyProgress(){const t=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return t.progress},get caption(){return t.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const mr={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function ko(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in mr)return mr[t]}function He(e=""){return function(r,n,s){const i=s.value;s.value=function(...c){try{return i.apply(this,c)}catch(o){const u=typeof o=="object"?o==null?void 0:o.errno:null;if(u in mr){const d=mr[u],f=typeof c[1]=="string"?c[1]:null,p=f!==null?e.replaceAll("{path}",f):e;throw new Error(`${p}: ${d}`,{cause:o})}throw o}}}}var Oo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,xe=(e,t,r,n)=>{for(var s=n>1?void 0:n?Co(t,r):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(s=(n?c(t,r,s):c(s))||s);return n&&s&&Oo(t,r,s),s};const Be=class Ne{static readFileAsText(t,r){return new TextDecoder().decode(Ne.readFileAsBuffer(t,r))}static readFileAsBuffer(t,r){return t.readFile(r)}static writeFile(t,r,n){t.writeFile(r,n)}static unlink(t,r){t.unlink(r)}static mv(t,r,n){try{const s=t.lookupPath(r).node.mount,i=Ne.fileExists(t,n)?t.lookupPath(n).node.mount:t.lookupPath(Ls(n)).node.mount;s.mountpoint!==i.mountpoint?(Ne.copyRecursive(t,r,n),Ne.rmdir(t,r,{recursive:!0})):t.rename(r,n)}catch(s){const i=ko(s);throw i?new Error(`Could not move ${r} to ${n}: ${i}`,{cause:s}):s}}static rmdir(t,r,n={recursive:!0}){n!=null&&n.recursive&&Ne.listFiles(t,r).forEach(s=>{const i=`${r}/${s}`;Ne.isDir(t,i)?Ne.rmdir(t,i,n):Ne.unlink(t,i)}),t.rmdir(r)}static listFiles(t,r,n={prependPath:!1}){if(!Ne.fileExists(t,r))return[];try{const s=t.readdir(r).filter(i=>i!=="."&&i!=="..");if(n.prependPath){const i=r.replace(/\/$/,"");return s.map(c=>`${i}/${c}`)}return s}catch(s){return Pe.error(s,{path:r}),[]}}static isDir(t,r){return Ne.fileExists(t,r)?t.isDir(t.lookupPath(r).node.mode):!1}static fileExists(t,r){try{return t.lookupPath(r),!0}catch{return!1}}static mkdir(t,r){t.mkdirTree(r)}static copyRecursive(t,r,n){const s=t.lookupPath(r).node;if(t.isDir(s.mode)){t.mkdirTree(n);const i=t.readdir(r).filter(c=>c!=="."&&c!=="..");for(const c of i)Ne.copyRecursive(t,me(r,c),me(n,c))}else t.writeFile(n,t.readFile(r))}};xe([He('Could not read "{path}"')],Be,"readFileAsText",1);xe([He('Could not read "{path}"')],Be,"readFileAsBuffer",1);xe([He('Could not write to "{path}"')],Be,"writeFile",1);xe([He('Could not unlink "{path}"')],Be,"unlink",1);xe([He('Could not remove directory "{path}"')],Be,"rmdir",1);xe([He('Could not list files in "{path}"')],Be,"listFiles",1);xe([He('Could not stat "{path}"')],Be,"isDir",1);xe([He('Could not stat "{path}"')],Be,"fileExists",1);xe([He('Could not create directory "{path}"')],Be,"mkdir",1);xe([He('Could not copy files from "{path}"')],Be,"copyRecursive",1);const No={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class yr{constructor(t,r,n,s="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,this.errors=s}static forHttpCode(t,r=""){return new yr(t,{},new TextEncoder().encode(r||No[t]||""))}static fromRawData(t){return new yr(t.httpStatusCode,t.headers,t.bytes,t.errors,t.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return new TextDecoder().decode(this.bytes)}}(function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"})();const os="/internal/shared/php.ini";var Io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const{hasOwnProperty:Lr}=Object.prototype,Br=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;const r=t.platform==="win32"?`\r
|
|
640
605
|
`:`
|
|
641
|
-
`,n=t.whitespace?" = ":"=",s=[],
|
|
606
|
+
`,n=t.whitespace?" = ":"=",s=[],i=t.sort?Object.keys(e).sort():Object.keys(e);let c=0;t.align&&(c=Ye(i.filter(d=>e[d]===null||Array.isArray(e[d])||typeof e[d]!="object").map(d=>Array.isArray(e[d])?`${d}[]`:d).concat([""]).reduce((d,f)=>Ye(d).length>=Ye(f).length?d:f)).length);let o="";const u=t.bracketedArray?"[]":"";for(const d of i){const f=e[d];if(f&&Array.isArray(f))for(const p of f)o+=Ye(`${d}${u}`).padEnd(c," ")+n+Ye(p)+r;else f&&typeof f=="object"?s.push(d):o+=Ye(d).padEnd(c," ")+n+Ye(f)+r}t.section&&o.length&&(o="["+Ye(t.section)+"]"+(t.newline?r+r:r)+o);for(const d of s){const f=ai(d,".").join("\\."),p=(t.section?t.section+".":"")+f,v=Br(e[d],{...t,section:p});o.length&&v.length&&(o+=r),o+=v}return o};function ai(e,t){var r=0,n=0,s=0,i=[];do if(s=e.indexOf(t,r),s!==-1){if(r=s+t.length,s>0&&e[s-1]==="\\")continue;i.push(e.slice(n,s)),n=s+t.length}while(s!==-1);return i.push(e.slice(n)),i}const as=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;const r=Object.create(null);let n=r,s=null;const i=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,c=e.split(/[\r\n]+/g),o={};for(const d of c){if(!d||d.match(/^\s*[;#]/)||d.match(/^\s*$/))continue;const f=d.match(i);if(!f)continue;if(f[1]!==void 0){if(s=or(f[1]),s==="__proto__"){n=Object.create(null);continue}n=r[s]=r[s]||Object.create(null);continue}const p=or(f[2]);let v;t.bracketedArray?v=p.length>2&&p.slice(-2)==="[]":(o[p]=((o==null?void 0:o[p])||0)+1,v=o[p]>1);const w=v?p.slice(0,-2):p;if(w==="__proto__")continue;const b=f[3]?or(f[4]):!0,T=b==="true"||b==="false"||b==="null"?JSON.parse(b):b;v&&(Lr.call(n,w)?Array.isArray(n[w])||(n[w]=[n[w]]):n[w]=[]),Array.isArray(n[w])?n[w].push(T):n[w]=T}const u=[];for(const d of Object.keys(r)){if(!Lr.call(r,d)||typeof r[d]!="object"||Array.isArray(r[d]))continue;const f=ai(d,".");n=r;const p=f.pop(),v=p.replace(/\\\./g,".");for(const w of f)w!=="__proto__"&&((!Lr.call(n,w)||typeof n[w]!="object")&&(n[w]=Object.create(null)),n=n[w]);n===r&&v===p||(n[v]=r[d],u.push(d))}for(const d of u)delete r[d];return r},ci=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Ye=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&ci(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),or=e=>{if(e=(e||"").trim(),ci(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,r="";for(let n=0,s=e.length;n<s;n++){const i=e.charAt(n);if(t)"\\;#".indexOf(i)!==-1?r+=i:r+="\\"+i,t=!1;else{if(";#".indexOf(i)!==-1)break;i==="\\"?t=!0:r+=i}}return t&&(r+="\\"),r.trim()}return e};var cs={parse:as,decode:as,stringify:Br,encode:Br,safe:Ye,unsafe:or};async function Ao(e,t){const r=cs.parse(await e.readFileAsText(os));for(const[n,s]of Object.entries(t))s==null?delete r[n]:r[n]=s;await e.writeFile(os,cs.stringify(r))}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);const kr=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],ui=kr[0],Do=kr,li=["iconv","mbstring","xml-bundle","gd"],us={"kitchen-sink":li,light:[]},Mo=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function Lo(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&Mo.includes(e.resource)}class yt{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new Fo(t,n);break;case"literal":s=new qo(t,n);break;case"wordpress.org/themes":s=new zo(t,n);break;case"wordpress.org/plugins":s=new Wo(t,n);break;case"url":s=new Vo(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new Ho(s),r&&(s=new xo(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class Fo extends yt{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var r;const t=await this.playground.readFileAsBuffer(this.resource.path);return(r=this.progress)==null||r.set(100),new File([t],this.name)}get name(){return this.resource.path.split("/").pop()||""}}class qo extends yt{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var t;return(t=this.progress)==null||t.set(100),new File([this.resource.contents],this.resource.name)}get name(){return this.resource.name}}class cn extends yt{constructor(t){super(),this.progress=t}async resolve(){var r,n;(r=this.progress)==null||r.setCaption(this.caption);const t=this.getURL();try{let s=await fetch(t);if(!s.ok)throw new Error(`Could not download "${t}"`);if(s=await Ro(s,((n=this.progress)==null?void 0:n.loadingListener)??Uo),s.status!==200)throw new Error(`Could not download "${t}"`);return new File([await s.blob()],this.name)}catch(s){throw new Error(`Could not download "${t}".
|
|
642
607
|
Check if the URL is correct and the server is reachable.
|
|
643
608
|
If it is reachable, the server might be blocking the request.
|
|
644
609
|
Check the browser console and network tabs for more information.
|
|
@@ -662,21 +627,21 @@ ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
|
662
627
|
https://raw.githubusercontent.com/username/repository/branch/filename
|
|
663
628
|
|
|
664
629
|
Error:
|
|
665
|
-
${s}`)}}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const noop=()=>{};class UrlResource extends FetchResource{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class CoreThemeResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${toDirectoryZipName(this.resource.slug)}`}}class CorePluginResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${toDirectoryZipName(this.resource.slug)}`}}function toDirectoryZipName(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class DecoratedResource extends Resource{constructor(t){super(),this.resource=t}async resolve(){return this.resource.resolve()}async setPlayground(t){return this.resource.setPlayground(t)}get progress(){return this.resource.progress}set progress(t){this.resource.progress=t}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class CachedResource extends DecoratedResource{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class SemaphoreResource extends DecoratedResource{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var ajv$1={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(y){if(super(),!e.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((S,I)=>`${S}${I}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((S,I)=>(I instanceof r&&(S[I.str]=(S[I.str]||0)+1),S),{})}}e._Code=n,e.nil=new n("");function s(_,...y){const S=[_[0]];let I=0;for(;I<y.length;)c(S,y[I]),S.push(_[++I]);return new n(S)}e._=s;const o=new n("+");function i(_,...y){const S=[P(_[0])];let I=0;for(;I<y.length;)S.push(o),c(S,y[I]),S.push(o,P(_[++I]));return u(S),new n(S)}e.str=i;function c(_,y){y instanceof n?_.push(...y._items):y instanceof r?_.push(y):_.push(f(y))}e.addCodeArg=c;function u(_){let y=1;for(;y<_.length-1;){if(_[y]===o){const S=l(_[y-1],_[y+1]);if(S!==void 0){_.splice(y-1,3,S);continue}_[y++]="+"}y++}}function l(_,y){if(y==='""')return _;if(_==='""')return y;if(typeof _=="string")return y instanceof r||_[_.length-1]!=='"'?void 0:typeof y!="string"?`${_.slice(0,-1)}${y}"`:y[0]==='"'?_.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(_ instanceof r))return`"${_}${y.slice(1)}`}function p(_,y){return y.emptyStr()?_:_.emptyStr()?y:i`${_}${y}`}e.strConcat=p;function f(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:P(Array.isArray(_)?_.join(","):_)}function b(_){return new n(P(_))}e.stringify=b;function P(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=P;function E(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=E;function C(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=C;function $(_){return new n(_.toString())}e.regexpCode=$})(code$1);var scope={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=code$1;class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:l,parent:p}={}){this._names={},this._prefixes=l,this._parent=p}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){const p=this._names[l]||this._nameGroup(l);return`${l}${p.index++}`}_nameGroup(l){var p,f;if(!((f=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||f===void 0)&&f.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=s;class o extends t.Name{constructor(l,p){super(p),this.prefix=l}setValue(l,{property:p,itemIndex:f}){this.value=l,this.scopePath=(0,t._)`.${new t.Name(p)}[${f}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class c extends s{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?i:t.nil}}get(){return this._scope}name(l){return new o(l,this._newName(l))}value(l,p){var f;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(l),{prefix:P}=b,E=(f=p.key)!==null&&f!==void 0?f:p.ref;let C=this._values[P];if(C){const y=C.get(E);if(y)return y}else C=this._values[P]=new Map;C.set(E,b);const $=this._scope[P]||(this._scope[P]=[]),_=$.length;return $[_]=p.ref,b.setValue(p,{property:P,itemIndex:_}),b}getValue(l,p){const f=this._values[l];if(f)return f.get(p)}scopeRefs(l,p=this._values){return this._reduceValues(p,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${l}${f.scopePath}`})}scopeCode(l=this._values,p,f){return this._reduceValues(l,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},p,f)}_reduceValues(l,p,f={},b){let P=t.nil;for(const E in l){const C=l[E];if(!C)continue;const $=f[E]=f[E]||new Map;C.forEach(_=>{if($.has(_))return;$.set(_,n.Started);let y=p(_);if(y){const S=this.opts.es5?e.varKinds.var:e.varKinds.const;P=(0,t._)`${P}${S} ${_} = ${y};${this.opts._n}`}else if(y=b==null?void 0:b(_))P=(0,t._)`${P}${y}${this.opts._n}`;else throw new r(_);$.set(_,n.Completed)})}return P}}e.ValueScope=c})(scope);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=code$1,r=scope;var n=code$1;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=scope;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(a,m){return this}}class i extends o{constructor(a,m,N){super(),this.varKind=a,this.name=m,this.rhs=N}render({es5:a,_n:m}){const N=a?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${M};`+m}optimizeNames(a,m){if(a[this.name.str])return this.rhs&&(this.rhs=ne(this.rhs,a,m)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends o{constructor(a,m,N){super(),this.lhs=a,this.rhs=m,this.sideEffects=N}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,m){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=ne(this.rhs,a,m),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return de(a,this.rhs)}}class u extends c{constructor(a,m,N,M){super(a,N,M),this.op=m}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class l extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class p extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class f extends o{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class b extends o{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,m){return this.code=ne(this.code,a,m),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class P extends o{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((m,N)=>m+N.render(a),"")}optimizeNodes(){const{nodes:a}=this;let m=a.length;for(;m--;){const N=a[m].optimizeNodes();Array.isArray(N)?a.splice(m,1,...N):N?a[m]=N:a.splice(m,1)}return a.length>0?this:void 0}optimizeNames(a,m){const{nodes:N}=this;let M=N.length;for(;M--;){const L=N[M];L.optimizeNames(a,m)||(Se(a,L.names),N.splice(M,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((a,m)=>G(a,m.names),{})}}class E extends P{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class C extends P{}class $ extends E{}$.kind="else";class _ extends E{constructor(a,m){super(m),this.condition=a}render(a){let m=`if(${this.condition})`+super.render(a);return this.else&&(m+="else "+this.else.render(a)),m}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let m=this.else;if(m){const N=m.optimizeNodes();m=this.else=Array.isArray(N)?new $(N):N}if(m)return a===!1?m instanceof _?m:m.nodes:this.nodes.length?this:new _(Te(a),m instanceof _?[m]:m.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,m){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(a,m),!!(super.optimizeNames(a,m)||this.else))return this.condition=ne(this.condition,a,m),this}get names(){const a=super.names;return de(a,this.condition),this.else&&G(a,this.else.names),a}}_.kind="if";class y extends E{}y.kind="for";class S extends y{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iteration=ne(this.iteration,a,m),this}get names(){return G(super.names,this.iteration.names)}}class I extends y{constructor(a,m,N,M){super(),this.varKind=a,this.name=m,this.from=N,this.to=M}render(a){const m=a.es5?r.varKinds.var:this.varKind,{name:N,from:M,to:L}=this;return`for(${m} ${N}=${M}; ${N}<${L}; ${N}++)`+super.render(a)}get names(){const a=de(super.names,this.from);return de(a,this.to)}}class D extends y{constructor(a,m,N,M){super(),this.loop=a,this.varKind=m,this.name=N,this.iterable=M}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iterable=ne(this.iterable,a,m),this}get names(){return G(super.names,this.iterable.names)}}class w extends E{constructor(a,m,N){super(),this.name=a,this.args=m,this.async=N}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}w.kind="func";class O extends P{render(a){return"return "+super.render(a)}}O.kind="return";class A extends E{render(a){let m="try"+super.render(a);return this.catch&&(m+=this.catch.render(a)),this.finally&&(m+=this.finally.render(a)),m}optimizeNodes(){var a,m;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(m=this.finally)===null||m===void 0||m.optimizeNodes(),this}optimizeNames(a,m){var N,M;return super.optimizeNames(a,m),(N=this.catch)===null||N===void 0||N.optimizeNames(a,m),(M=this.finally)===null||M===void 0||M.optimizeNames(a,m),this}get names(){const a=super.names;return this.catch&&G(a,this.catch.names),this.finally&&G(a,this.finally.names),a}}class U extends E{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}U.kind="catch";class H extends E{render(a){return"finally"+super.render(a)}}H.kind="finally";class X{constructor(a,m={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...m,_n:m.lines?`
|
|
666
|
-
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new C]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,m){const N=this._extScope.value(a,m);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(a,m){return this._extScope.getValue(a,m)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,m,N,M){const L=this._scope.toName(m);return N!==void 0&&M&&(this._constants[L.str]=N),this._leafNode(new i(a,L,N)),L}const(a,m,N){return this._def(r.varKinds.const,a,m,N)}let(a,m,N){return this._def(r.varKinds.let,a,m,N)}var(a,m,N){return this._def(r.varKinds.var,a,m,N)}assign(a,m,N){return this._leafNode(new c(a,m,N))}add(a,m){return this._leafNode(new u(a,e.operators.ADD,m))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new b(a)),this}object(...a){const m=["{"];for(const[N,M]of a)m.length>1&&m.push(","),m.push(N),(N!==M||this.opts.es5)&&(m.push(":"),(0,t.addCodeArg)(m,M));return m.push("}"),new t._Code(m)}if(a,m,N){if(this._blockNode(new _(a)),m&&N)this.code(m).else().code(N).endIf();else if(m)this.code(m).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new _(a))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(_,$)}_for(a,m){return this._blockNode(a),m&&this.code(m).endFor(),this}for(a,m){return this._for(new S(a),m)}forRange(a,m,N,M,L=this.opts.es5?r.varKinds.var:r.varKinds.let){const z=this._scope.toName(a);return this._for(new I(L,z,m,N),()=>M(z))}forOf(a,m,N,M=r.varKinds.const){const L=this._scope.toName(a);if(this.opts.es5){const z=m instanceof t.Name?m:this.var("_arr",m);return this.forRange("_i",0,(0,t._)`${z}.length`,B=>{this.var(L,(0,t._)`${z}[${B}]`),N(L)})}return this._for(new D("of",M,L,m),()=>N(L))}forIn(a,m,N,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${m})`,N);const L=this._scope.toName(a);return this._for(new D("in",M,L,m),()=>N(L))}endFor(){return this._endBlockNode(y)}label(a){return this._leafNode(new l(a))}break(a){return this._leafNode(new p(a))}return(a){const m=new O;if(this._blockNode(m),this.code(a),m.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try(a,m,N){if(!m&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new A;if(this._blockNode(M),this.code(a),m){const L=this.name("e");this._currNode=M.catch=new U(L),m(L)}return N&&(this._currNode=M.finally=new H,this.code(N)),this._endBlockNode(U,H)}throw(a){return this._leafNode(new f(a))}block(a,m){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(m),this}endBlock(a){const m=this._blockStarts.pop();if(m===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-m;if(N<0||a!==void 0&&N!==a)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);return this._nodes.length=m,this}func(a,m=t.nil,N,M){return this._blockNode(new w(a,m,N)),M&&this.code(M).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,m){const N=this._currNode;if(N instanceof a||m&&N instanceof m)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${m?`${a.kind}/${m.kind}`:a.kind}"`)}_elseNode(a){const m=this._currNode;if(!(m instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=m.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const m=this._nodes;m[m.length-1]=a}}e.CodeGen=X;function G(T,a){for(const m in a)T[m]=(T[m]||0)+(a[m]||0);return T}function de(T,a){return a instanceof t._CodeOrName?G(T,a.names):T}function ne(T,a,m){if(T instanceof t.Name)return N(T);if(!M(T))return T;return new t._Code(T._items.reduce((L,z)=>(z instanceof t.Name&&(z=N(z)),z instanceof t._Code?L.push(...z._items):L.push(z),L),[]));function N(L){const z=m[L.str];return z===void 0||a[L.str]!==1?L:(delete a[L.str],z)}function M(L){return L instanceof t._Code&&L._items.some(z=>z instanceof t.Name&&a[z.str]===1&&m[z.str]!==void 0)}}function Se(T,a){for(const m in a)T[m]=(T[m]||0)-(a[m]||0)}function Te(T){return typeof T=="boolean"||typeof T=="number"||T===null?!T:(0,t._)`!${j(T)}`}e.not=Te;const Ne=v(e.operators.AND);function Ve(...T){return T.reduce(Ne)}e.and=Ve;const Ie=v(e.operators.OR);function F(...T){return T.reduce(Ie)}e.or=F;function v(T){return(a,m)=>a===t.nil?m:m===t.nil?a:(0,t._)`${j(a)} ${T} ${j(m)}`}function j(T){return T instanceof t.Name?T:(0,t._)`(${T})`}})(codegen);var util={};(function(e){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;const t=codegen,r=code$1;function n(w){const O={};for(const A of w)O[A]=!0;return O}e.toHash=n;function s(w,O){return typeof O=="boolean"?O:Object.keys(O).length===0?!0:(o(w,O),!i(O,w.self.RULES.all))}e.alwaysValidSchema=s;function o(w,O=w.schema){const{opts:A,self:U}=w;if(!A.strictSchema||typeof O=="boolean")return;const H=U.RULES.keywords;for(const X in O)H[X]||D(w,`unknown keyword: "${X}"`)}e.checkUnknownRules=o;function i(w,O){if(typeof w=="boolean")return!w;for(const A in w)if(O[A])return!0;return!1}e.schemaHasRules=i;function c(w,O){if(typeof w=="boolean")return!w;for(const A in w)if(A!=="$ref"&&O.all[A])return!0;return!1}e.schemaHasRulesButRef=c;function u({topSchemaRef:w,schemaPath:O},A,U,H){if(!H){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${w}${O}${(0,t.getProperty)(U)}`}e.schemaRefOrVal=u;function l(w){return b(decodeURIComponent(w))}e.unescapeFragment=l;function p(w){return encodeURIComponent(f(w))}e.escapeFragment=p;function f(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=f;function b(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=b;function P(w,O){if(Array.isArray(w))for(const A of w)O(A);else O(w)}e.eachItem=P;function E({mergeNames:w,mergeToName:O,mergeValues:A,resultToName:U}){return(H,X,G,de)=>{const ne=G===void 0?X:G instanceof t.Name?(X instanceof t.Name?w(H,X,G):O(H,X,G),G):X instanceof t.Name?(O(H,G,X),X):A(X,G);return de===t.Name&&!(ne instanceof t.Name)?U(H,ne):ne}}e.mergeEvaluated={props:E({mergeNames:(w,O,A)=>w.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>{w.if((0,t._)`${O} === true`,()=>w.assign(A,!0),()=>w.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${O})`))}),mergeToName:(w,O,A)=>w.if((0,t._)`${A} !== true`,()=>{O===!0?w.assign(A,!0):(w.assign(A,(0,t._)`${A} || {}`),$(w,A,O))}),mergeValues:(w,O)=>w===!0?!0:{...w,...O},resultToName:C}),items:E({mergeNames:(w,O,A)=>w.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>w.assign(A,(0,t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),mergeToName:(w,O,A)=>w.if((0,t._)`${A} !== true`,()=>w.assign(A,O===!0?!0:(0,t._)`${A} > ${O} ? ${A} : ${O}`)),mergeValues:(w,O)=>w===!0?!0:Math.max(w,O),resultToName:(w,O)=>w.var("items",O)})};function C(w,O){if(O===!0)return w.var("props",!0);const A=w.var("props",(0,t._)`{}`);return O!==void 0&&$(w,A,O),A}e.evaluatedPropsToName=C;function $(w,O,A){Object.keys(A).forEach(U=>w.assign((0,t._)`${O}${(0,t.getProperty)(U)}`,!0))}e.setEvaluated=$;const _={};function y(w,O){return w.scopeValue("func",{ref:O,code:_[O.code]||(_[O.code]=new r._Code(O.code))})}e.useFunc=y;var S;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(S=e.Type||(e.Type={}));function I(w,O,A){if(w instanceof t.Name){const U=O===S.Num;return A?U?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:U?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(w).toString():"/"+f(w)}e.getErrorPath=I;function D(w,O,A=w.opts.strictSchema){if(A){if(O=`strict mode: ${O}`,A===!0)throw new Error(O);w.self.logger.warn(O)}}e.checkStrictMode=D})(util);var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$t=codegen,names={data:new codegen_1$t.Name("data"),valCxt:new codegen_1$t.Name("valCxt"),instancePath:new codegen_1$t.Name("instancePath"),parentData:new codegen_1$t.Name("parentData"),parentDataProperty:new codegen_1$t.Name("parentDataProperty"),rootData:new codegen_1$t.Name("rootData"),dynamicAnchors:new codegen_1$t.Name("dynamicAnchors"),vErrors:new codegen_1$t.Name("vErrors"),errors:new codegen_1$t.Name("errors"),this:new codegen_1$t.Name("this"),self:new codegen_1$t.Name("self"),scope:new codegen_1$t.Name("scope"),json:new codegen_1$t.Name("json"),jsonPos:new codegen_1$t.Name("jsonPos"),jsonLen:new codegen_1$t.Name("jsonLen"),jsonPart:new codegen_1$t.Name("jsonPart")};names$1.default=names;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=codegen,r=util,n=names$1;e.keywordError={message:({keyword:$})=>(0,t.str)`must pass "${$}" keyword validation`},e.keyword$DataError={message:({keyword:$,schemaType:_})=>_?(0,t.str)`"${$}" keyword must be ${_} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,_=e.keywordError,y,S){const{it:I}=$,{gen:D,compositeRule:w,allErrors:O}=I,A=f($,_,y);S??(w||O)?u(D,A):l(I,(0,t._)`[${A}]`)}e.reportError=s;function o($,_=e.keywordError,y){const{it:S}=$,{gen:I,compositeRule:D,allErrors:w}=S,O=f($,_,y);u(I,O),D||w||l(S,n.default.vErrors)}e.reportExtraError=o;function i($,_){$.assign(n.default.errors,_),$.if((0,t._)`${n.default.vErrors} !== null`,()=>$.if(_,()=>$.assign((0,t._)`${n.default.vErrors}.length`,_),()=>$.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:$,keyword:_,schemaValue:y,data:S,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const w=$.name("err");$.forRange("i",I,n.default.errors,O=>{$.const(w,(0,t._)`${n.default.vErrors}[${O}]`),$.if((0,t._)`${w}.instancePath === undefined`,()=>$.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),$.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${_}`),D.opts.verbose&&($.assign((0,t._)`${w}.schema`,y),$.assign((0,t._)`${w}.data`,S))})}e.extendErrors=c;function u($,_){const y=$.const("err",_);$.if((0,t._)`${n.default.vErrors} === null`,()=>$.assign(n.default.vErrors,(0,t._)`[${y}]`),(0,t._)`${n.default.vErrors}.push(${y})`),$.code((0,t._)`${n.default.errors}++`)}function l($,_){const{gen:y,validateName:S,schemaEnv:I}=$;I.$async?y.throw((0,t._)`new ${$.ValidationError}(${_})`):(y.assign((0,t._)`${S}.errors`,_),y.return(!1))}const p={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f($,_,y){const{createErrors:S}=$.it;return S===!1?(0,t._)`{}`:b($,_,y)}function b($,_,y={}){const{gen:S,it:I}=$,D=[P(I,y),E($,y)];return C($,_,D),S.object(...D)}function P({errorPath:$},{instancePath:_}){const y=_?(0,t.str)`${$}${(0,r.getErrorPath)(_,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,y)]}function E({keyword:$,it:{errSchemaPath:_}},{schemaPath:y,parentSchema:S}){let I=S?_:(0,t.str)`${_}/${$}`;return y&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(y,r.Type.Str)}`),[p.schemaPath,I]}function C($,{params:_,message:y},S){const{keyword:I,data:D,schemaValue:w,it:O}=$,{opts:A,propertyName:U,topSchemaRef:H,schemaPath:X}=O;S.push([p.keyword,I],[p.params,typeof _=="function"?_($):_||(0,t._)`{}`]),A.messages&&S.push([p.message,typeof y=="function"?y($):y]),A.verbose&&S.push([p.schema,w],[p.parentSchema,(0,t._)`${H}${X}`],[n.default.data,D]),U&&S.push([p.propertyName,U])}})(errors);Object.defineProperty(boolSchema,"__esModule",{value:!0});boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$2=errors,codegen_1$s=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:n}=e;r===!1?falseSchemaError(e,!1):typeof r=="object"&&r.$async===!0?t.return(names_1$6.default.data):(t.assign((0,codegen_1$s._)`${n}.errors`,null),t.return(!0))}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),falseSchemaError(e)):r.var(t,!0)}boolSchema.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,errors_1$2.reportError)(s,boolError,void 0,t)}var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0});rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(e){return typeof e=="string"&&jsonTypes.has(e)}rules.isJSONType=isJSONType;function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rules.getRules=getRules;var applicability={};Object.defineProperty(applicability,"__esModule",{value:!0});applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&shouldUseGroup(e,n)}applicability.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(e,t){return t.rules.some(r=>shouldUseRule(e,r))}applicability.shouldUseGroup=shouldUseGroup;function shouldUseRule(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}applicability.shouldUseRule=shouldUseRule;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=rules,r=applicability,n=errors,s=codegen,o=util;var i;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(i=e.DataType||(e.DataType={}));function c(S){const I=u(S.type);if(I.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=c;function u(S){const I=Array.isArray(S)?S:S?[S]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=u;function l(S,I){const{gen:D,data:w,opts:O}=S,A=f(I,O.coerceTypes),U=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(S,I[0]));if(U){const H=C(I,w,O.strictNumbers,i.Wrong);D.if(H,()=>{A.length?b(S,I,A):_(S)})}return U}e.coerceAndCheckDataType=l;const p=new Set(["string","number","integer","boolean","null"]);function f(S,I){return I?S.filter(D=>p.has(D)||I==="array"&&D==="array"):[]}function b(S,I,D){const{gen:w,data:O,opts:A}=S,U=w.let("dataType",(0,s._)`typeof ${O}`),H=w.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&w.if((0,s._)`${U} == 'object' && Array.isArray(${O}) && ${O}.length == 1`,()=>w.assign(O,(0,s._)`${O}[0]`).assign(U,(0,s._)`typeof ${O}`).if(C(I,O,A.strictNumbers),()=>w.assign(H,O))),w.if((0,s._)`${H} !== undefined`);for(const G of D)(p.has(G)||G==="array"&&A.coerceTypes==="array")&&X(G);w.else(),_(S),w.endIf(),w.if((0,s._)`${H} !== undefined`,()=>{w.assign(O,H),P(S,H)});function X(G){switch(G){case"string":w.elseIf((0,s._)`${U} == "number" || ${U} == "boolean"`).assign(H,(0,s._)`"" + ${O}`).elseIf((0,s._)`${O} === null`).assign(H,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${U} == "boolean" || ${O} === null
|
|
667
|
-
|| (${
|
|
668
|
-
|| (${
|
|
669
|
-
|| ${U} === "boolean" || ${O} === null`).assign(H,(0,s._)`[${O}]`)}}}function P({gen:S,parentData:I,parentDataProperty:D},w){S.if((0,s._)`${I} !== undefined`,()=>S.assign((0,s._)`${I}[${D}]`,w))}function E(S,I,D,w=i.Correct){const O=w===i.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(S){case"null":return(0,s._)`${I} ${O} null`;case"array":A=(0,s._)`Array.isArray(${I})`;break;case"object":A=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":A=U((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=U();break;default:return(0,s._)`typeof ${I} ${O} ${S}`}return w===i.Correct?A:(0,s.not)(A);function U(H=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,H,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=E;function C(S,I,D,w){if(S.length===1)return E(S[0],I,D,w);let O;const A=(0,o.toHash)(S);if(A.array&&A.object){const U=(0,s._)`typeof ${I} != "object"`;O=A.null?U:(0,s._)`!${I} || ${U}`,delete A.null,delete A.array,delete A.object}else O=s.nil;A.number&&delete A.integer;for(const U in A)O=(0,s.and)(O,E(U,I,D,w));return O}e.checkDataTypes=C;const $={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:I})=>typeof S=="string"?(0,s._)`{type: ${S}}`:(0,s._)`{type: ${I}}`};function _(S){const I=y(S);(0,n.reportError)(I,$)}e.reportTypeError=_;function y(S){const{gen:I,data:D,schema:w}=S,O=(0,o.schemaRefOrVal)(S,w,"type");return{gen:I,keyword:"type",data:D,schema:w.type,schemaCode:O,schemaValue:O,parentSchema:w,params:{},it:S}}})(dataType);var defaults={};Object.defineProperty(defaults,"__esModule",{value:!0});defaults.assignDefaults=void 0;const codegen_1$r=codegen,util_1$p=util;function assignDefaults(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)assignDefault(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>assignDefault(e,o,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const c=(0,codegen_1$r._)`${o}${(0,codegen_1$r.getProperty)(t)}`;if(s){(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${c}`);return}let u=(0,codegen_1$r._)`${c} === undefined`;i.useDefaults==="empty"&&(u=(0,codegen_1$r._)`${u} || ${c} === null || ${c} === ""`),n.if(u,(0,codegen_1$r._)`${c} = ${(0,codegen_1$r.stringify)(r)}`)}var keyword={},code={};Object.defineProperty(code,"__esModule",{value:!0});code.validateUnion=code.validateArray=code.usePattern=code.callValidateCode=code.schemaProperties=code.allSchemaProperties=code.noPropertyInData=code.propertyInData=code.isOwnProperty=code.hasPropFunc=code.reportMissingProp=code.checkMissingProp=code.checkReportMissingProp=void 0;const codegen_1$q=codegen,util_1$o=util,names_1$5=names$1,util_2$1=util;function checkReportMissingProp(e,t){const{gen:r,data:n,it:s}=e;r.if(noPropertyInData(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,codegen_1$q._)`${t}`},!0),e.error()})}code.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:e,data:t,it:{opts:r}},n,s){return(0,codegen_1$q.or)(...n.map(o=>(0,codegen_1$q.and)(noPropertyInData(e,t,o,r.ownProperties),(0,codegen_1$q._)`${s} = ${o}`)))}code.checkMissingProp=checkMissingProp;function reportMissingProp(e,t){e.setParams({missingProperty:t},!0),e.error()}code.reportMissingProp=reportMissingProp;function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,codegen_1$q._)`Object.prototype.hasOwnProperty`})}code.hasPropFunc=hasPropFunc;function isOwnProperty(e,t,r){return(0,codegen_1$q._)`${hasPropFunc(e)}.call(${t}, ${r})`}code.isOwnProperty=isOwnProperty;function propertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} !== undefined`;return n?(0,codegen_1$q._)`${s} && ${isOwnProperty(e,t,r)}`:s}code.propertyInData=propertyInData;function noPropertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} === undefined`;return n?(0,codegen_1$q.or)(s,(0,codegen_1$q.not)(isOwnProperty(e,t,r))):s}code.noPropertyInData=noPropertyInData;function allSchemaProperties(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}code.allSchemaProperties=allSchemaProperties;function schemaProperties(e,t){return allSchemaProperties(t).filter(r=>!(0,util_1$o.alwaysValidSchema)(e,t[r]))}code.schemaProperties=schemaProperties;function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},c,u,l){const p=l?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,f=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,o)],[names_1$5.default.parentData,i.parentData],[names_1$5.default.parentDataProperty,i.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];i.opts.dynamicRef&&f.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const b=(0,codegen_1$q._)`${p}, ${r.object(...f)}`;return u!==codegen_1$q.nil?(0,codegen_1$q._)`${c}.call(${u}, ${b})`:(0,codegen_1$q._)`${c}(${b})`}code.callValidateCode=callValidateCode;const newRegExp=(0,codegen_1$q._)`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,codegen_1$q._)`${s.code==="new RegExp"?newRegExp:(0,util_2$1.useFunc)(e,s)}(${r}, ${n})`})}code.usePattern=usePattern;function validateArray(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const c=t.let("valid",!0);return i(()=>t.assign(c,!1)),c}return t.var(o,!0),i(()=>t.break()),o;function i(c){const u=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,u,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:util_1$o.Type.Num},o),t.if((0,codegen_1$q.not)(o),c)})}}code.validateArray=validateArray;function validateUnion(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,util_1$o.alwaysValidSchema)(s,u))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((u,l)=>{const p=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},c);t.assign(i,(0,codegen_1$q._)`${i} || ${c}`),e.mergeValidEvaluated(p,c)||t.if((0,codegen_1$q.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}code.validateUnion=validateUnion;Object.defineProperty(keyword,"__esModule",{value:!0});keyword.validateKeywordUsage=keyword.validSchemaType=keyword.funcKeywordCode=keyword.macroKeywordCode=void 0;const codegen_1$p=codegen,names_1$4=names$1,code_1$9=code,errors_1$1=errors;function macroKeywordCode(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,c=t.macro.call(i.self,s,o,i),u=useKeyword(r,n,c);i.opts.validateSchema!==!1&&i.self.validateSchema(c,!0);const l=r.name("valid");e.subschema({schema:c,schemaPath:codegen_1$p.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:c,it:u}=e;checkAsyncKeyword(u,t);const l=!c&&t.compile?t.compile.call(u.self,o,i,u):t.validate,p=useKeyword(n,s,l),f=n.let("valid");e.block$data(f,b),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function b(){if(t.errors===!1)C(),t.modifying&&modifyData(e),$(()=>e.error());else{const _=t.async?P():E();t.modifying&&modifyData(e),$(()=>addErrs(e,_))}}function P(){const _=n.let("ruleErrs",null);return n.try(()=>C((0,codegen_1$p._)`await `),y=>n.assign(f,!1).if((0,codegen_1$p._)`${y} instanceof ${u.ValidationError}`,()=>n.assign(_,(0,codegen_1$p._)`${y}.errors`),()=>n.throw(y))),_}function E(){const _=(0,codegen_1$p._)`${p}.errors`;return n.assign(_,null),C(codegen_1$p.nil),_}function C(_=t.async?(0,codegen_1$p._)`await `:codegen_1$p.nil){const y=u.opts.passContext?names_1$4.default.this:names_1$4.default.self,S=!("compile"in t&&!c||t.schema===!1);n.assign(f,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,p,y,S)}`,t.modifying)}function $(_){var y;n.if((0,codegen_1$p.not)((y=t.valid)!==null&&y!==void 0?y:f),_)}}keyword.funcKeywordCode=funcKeywordCode;function modifyData(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,codegen_1$p._)`${n.parentData}[${n.parentDataProperty}]`))}function addErrs(e,t){const{gen:r}=e;r.if((0,codegen_1$p._)`Array.isArray(${t})`,()=>{r.assign(names_1$4.default.vErrors,(0,codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${t} : ${names_1$4.default.vErrors}.concat(${t})`).assign(names_1$4.default.errors,(0,codegen_1$p._)`${names_1$4.default.vErrors}.length`),(0,errors_1$1.extendErrors)(e)},()=>e.error())}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,codegen_1$p.stringify)(r)})}function validSchemaType(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}keyword.validSchemaType=validSchemaType;function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(c=>!Object.prototype.hasOwnProperty.call(e,c)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const u=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}keyword.validateKeywordUsage=validateKeywordUsage;var subschema={};Object.defineProperty(subschema,"__esModule",{value:!0});subschema.extendSubschemaMode=subschema.extendSubschemaData=subschema.getSubschema=void 0;const codegen_1$o=codegen,util_1$n=util;function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const c=e.schema[t];return r===void 0?{schema:c,schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:c[r],schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}${(0,codegen_1$o.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,util_1$n.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(r!==void 0){const{errorPath:l,dataPathArr:p,opts:f}=t,b=c.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);u(b),e.errorPath=(0,codegen_1$o.str)`${l}${(0,util_1$n.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const l=s instanceof codegen_1$o.Name?s:c.let("data",s,!0);u(l),i!==void 0&&(e.propertyName=i)}o&&(e.dataTypes=o);function u(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}subschema.extendSubschemaMode=extendSubschemaMode;var resolve$1={},fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},jsonSchemaTraverse={exports:{}},traverse$1=jsonSchemaTraverse.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};_traverse(t,n,s,e,"",e)};traverse$1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};traverse$1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};traverse$1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};traverse$1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _traverse(e,t,r,n,s,o,i,c,u,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,c,u,l);for(var p in n){var f=n[p];if(Array.isArray(f)){if(p in traverse$1.arrayKeywords)for(var b=0;b<f.length;b++)_traverse(e,t,r,f[b],s+"/"+p+"/"+b,o,s,p,n,b)}else if(p in traverse$1.propsKeywords){if(f&&typeof f=="object")for(var P in f)_traverse(e,t,r,f[P],s+"/"+p+"/"+escapeJsonPtr(P),o,s,p,n,P)}else(p in traverse$1.keywords||e.allKeys&&!(p in traverse$1.skipKeywords))&&_traverse(e,t,r,f,s+"/"+p,o,s,p,n)}r(n,s,o,i,c,u,l)}}function escapeJsonPtr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var jsonSchemaTraverseExports=jsonSchemaTraverse.exports;Object.defineProperty(resolve$1,"__esModule",{value:!0});resolve$1.getSchemaRefs=resolve$1.resolveUrl=resolve$1.normalizeId=resolve$1._getFullPath=resolve$1.getFullPath=resolve$1.inlineRef=void 0;const util_1$m=util,equal$2=fastDeepEqual,traverse=jsonSchemaTraverseExports,SIMPLE_INLINED=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(e,t=!0){return typeof e=="boolean"?!0:t===!0?!hasRef(e):t?countKeys(e)<=t:!1}resolve$1.inlineRef=inlineRef;const REF_KEYWORDS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(e){for(const t in e){if(REF_KEYWORDS.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(hasRef)||typeof r=="object"&&hasRef(r))return!0}return!1}function countKeys(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!SIMPLE_INLINED.has(r)&&(typeof e[r]=="object"&&(0,util_1$m.eachItem)(e[r],n=>t+=countKeys(n)),t===1/0))return 1/0}return t}function getFullPath(e,t="",r){r!==!1&&(t=normalizeId(t));const n=e.parse(t);return _getFullPath(e,n)}resolve$1.getFullPath=getFullPath;function _getFullPath(e,t){return e.serialize(t).split("#")[0]+"#"}resolve$1._getFullPath=_getFullPath;const TRAILING_SLASH_HASH=/#\/?$/;function normalizeId(e){return e?e.replace(TRAILING_SLASH_HASH,""):""}resolve$1.normalizeId=normalizeId;function resolveUrl(e,t,r){return r=normalizeId(r),e.resolve(t,r)}resolve$1.resolveUrl=resolveUrl;const ANCHOR=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=normalizeId(e[r]||t),o={"":s},i=getFullPath(n,s,!1),c={},u=new Set;return traverse(e,{allKeys:!0},(f,b,P,E)=>{if(E===void 0)return;const C=i+b;let $=o[E];typeof f[r]=="string"&&($=_.call(this,f[r])),y.call(this,f.$anchor),y.call(this,f.$dynamicAnchor),o[b]=$;function _(S){const I=this.opts.uriResolver.resolve;if(S=normalizeId($?I($,S):S),u.has(S))throw p(S);u.add(S);let D=this.refs[S];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?l(f,D.schema,S):S!==normalizeId(C)&&(S[0]==="#"?(l(f,c[S],S),c[S]=f):this.refs[S]=C),S}function y(S){if(typeof S=="string"){if(!ANCHOR.test(S))throw new Error(`invalid anchor "${S}"`);_.call(this,`#${S}`)}}}),c;function l(f,b,P){if(b!==void 0&&!equal$2(f,b))throw p(P)}function p(f){return new Error(`reference "${f}" resolves to more than one schema`)}}resolve$1.getSchemaRefs=getSchemaRefs;Object.defineProperty(validate,"__esModule",{value:!0});validate.getData=validate.KeywordCxt=validate.validateFunctionCode=void 0;const boolSchema_1=boolSchema,dataType_1$1=dataType,applicability_1=applicability,dataType_2=dataType,defaults_1=defaults,keyword_1=keyword,subschema_1=subschema,codegen_1$n=codegen,names_1$3=names$1,resolve_1$2=resolve$1,util_1$l=util,errors_1=errors;function validateFunctionCode(e){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){topSchemaObjCode(e);return}validateFunction(e,()=>(0,boolSchema_1.topBoolOrEmptySchema)(e))}validate.validateFunctionCode=validateFunctionCode;function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${names_1$3.default.valCxt}`,n.$async,()=>{e.code((0,codegen_1$n._)`"use strict"; ${funcSourceUrl(r,s)}`),destructureValCxtES5(e,s),e.code(o)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(o))}function destructureValCxt(e){return(0,codegen_1$n._)`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${e.dynamicRef?(0,codegen_1$n._)`, ${names_1$3.default.dynamicAnchors}={}`:codegen_1$n.nil}}={}`}function destructureValCxtES5(e,t){e.if(names_1$3.default.valCxt,()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`),e.var(names_1$3.default.rootData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`)},()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`""`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.rootData,names_1$3.default.data),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`{}`)})}function topSchemaObjCode(e){const{schema:t,opts:r,gen:n}=e;validateFunction(e,()=>{r.$comment&&t.$comment&&commentKeyword(e),checkNoDefault(e),n.let(names_1$3.default.vErrors,null),n.let(names_1$3.default.errors,0),r.unevaluated&&resetEvaluated(e),typeAndKeywords(e),returnResults(e)})}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,codegen_1$n._)`${r}.evaluated`),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.props`,(0,codegen_1$n._)`undefined`)),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.items`,(0,codegen_1$n._)`undefined`))}function funcSourceUrl(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,codegen_1$n._)`/*# sourceURL=${r} */`:codegen_1$n.nil}function subschemaCode(e,t){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){subSchemaObjCode(e,t);return}(0,boolSchema_1.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function isSchemaObj(e){return typeof e.schema!="boolean"}function subSchemaObjCode(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&commentKeyword(e),updateContext(e),checkAsyncSchema(e);const o=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,o),n.var(t,(0,codegen_1$n._)`${o} === ${names_1$3.default.errors}`)}function checkKeywords(e){(0,util_1$l.checkUnknownRules)(e),checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],!1,t);const r=(0,dataType_1$1.getSchemaTypes)(e.schema),n=(0,dataType_1$1.coerceAndCheckDataType)(e,r);schemaKeywords(e,r,!n,t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function checkNoDefault(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,util_1$l.checkStrictMode)(e,"default is ignored in the schema root")}function updateContext(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,resolve_1$2.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,codegen_1$n.str)`${n}/$comment`,c=e.scopeValue("root",{ref:t.root});e.code((0,codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${o}, ${i}, ${c}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,codegen_1$n._)`${names_1$3.default.errors} === 0`,()=>t.return(names_1$3.default.data),()=>t.throw((0,codegen_1$n._)`new ${s}(${names_1$3.default.vErrors})`)):(t.assign((0,codegen_1$n._)`${n}.errors`,names_1$3.default.vErrors),o.unevaluated&&assignEvaluated(e),t.return((0,codegen_1$n._)`${names_1$3.default.errors} === 0`))}function assignEvaluated({gen:e,evaluated:t,props:r,items:n}){r instanceof codegen_1$n.Name&&e.assign((0,codegen_1$n._)`${t}.props`,r),n instanceof codegen_1$n.Name&&e.assign((0,codegen_1$n._)`${t}.items`,n)}function schemaKeywords(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:c,opts:u,self:l}=e,{RULES:p}=l;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(o,p))){s.block(()=>keywordCode(e,"$ref",p.all.$ref.definition));return}u.jtd||checkStrictTypes(e,t),s.block(()=>{for(const b of p.rules)f(b);f(p.post)});function f(b){(0,applicability_1.shouldUseGroup)(o,b)&&(b.type?(s.if((0,dataType_2.checkDataType)(b.type,i,u.strictNumbers)),iterateKeywords(e,b),t.length===1&&t[0]===b.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,b),c||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}function iterateKeywords(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,defaults_1.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,applicability_1.shouldUseRule)(n,o)&&keywordCode(e,o.keyword,o.definition,t.type)})}function checkStrictTypes(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(checkContextTypes(e,t),e.opts.allowUnionTypes||checkMultipleTypes(e,t),checkKeywordTypes(e,e.dataTypes))}function checkContextTypes(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{includesType(e.dataTypes,r)||strictTypesError(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),narrowSchemaTypes(e,t)}}function checkMultipleTypes(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&strictTypesError(e,"use allowUnionTypes to allow union type keyword")}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,applicability_1.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>hasApplicableType(t,i))&&strictTypesError(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function hasApplicableType(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function includesType(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function narrowSchemaTypes(e,t){const r=[];for(const n of e.dataTypes)includesType(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function strictTypesError(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,util_1$l.checkStrictMode)(e,t,e.opts.strictTypes)}class KeywordCxt{constructor(t,r,n){if((0,keyword_1.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,util_1$l.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",getData(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,keyword_1.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",names_1$3.default.errors))}result(t,r,n){this.failResult((0,codegen_1$n.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,codegen_1$n.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,codegen_1$n._)`${r} !== undefined && (${(0,codegen_1$n.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?errors_1.reportExtraError:errors_1.reportError)(this,this.def.error,r)}$dataError(){(0,errors_1.reportError)(this,this.def.$dataError||errors_1.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,errors_1.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=codegen_1$n.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=codegen_1$n.nil,r=codegen_1$n.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==codegen_1$n.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,codegen_1$n.or)(i(),c());function i(){if(n.length){if(!(r instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const u=Array.isArray(n)?n:[n];return(0,codegen_1$n._)`${(0,dataType_2.checkDataTypes)(u,r,o.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}function c(){if(s.validateSchema){const u=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,codegen_1$n._)`!${u}(${r})`}return codegen_1$n.nil}}subschema(t,r){const n=(0,subschema_1.getSubschema)(this.it,t);(0,subschema_1.extendSubschemaData)(n,this.it,t),(0,subschema_1.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return subschemaCode(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=util_1$l.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=util_1$l.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,codegen_1$n.Name)),!0}}validate.KeywordCxt=KeywordCxt;function keywordCode(e,t,r,n){const s=new KeywordCxt(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,keyword_1.funcKeywordCode)(s,r):"macro"in r?(0,keyword_1.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,keyword_1.funcKeywordCode)(s,r)}const JSON_POINTER=/^\/(?:[^~]|~0|~1)*$/,RELATIVE_JSON_POINTER=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return names_1$3.default.rootData;if(e[0]==="/"){if(!JSON_POINTER.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=names_1$3.default.rootData}else{const l=RELATIVE_JSON_POINTER.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+l[1];if(s=l[2],s==="#"){if(p>=t)throw new Error(u("property/index",p));return n[t-p]}if(p>t)throw new Error(u("data",p));if(o=r[t-p],!s)return o}let i=o;const c=s.split("/");for(const l of c)l&&(o=(0,codegen_1$n._)`${o}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(l))}`,i=(0,codegen_1$n._)`${i} && ${o}`);return i;function u(l,p){return`Cannot access ${l} ${p} levels up, current level is ${t}`}}validate.getData=getData;var validation_error={};Object.defineProperty(validation_error,"__esModule",{value:!0});class ValidationError extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}validation_error.default=ValidationError;var ref_error={};Object.defineProperty(ref_error,"__esModule",{value:!0});const resolve_1$1=resolve$1;class MissingRefError extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,resolve_1$1.resolveUrl)(t,r,n),this.missingSchema=(0,resolve_1$1.normalizeId)((0,resolve_1$1.getFullPath)(t,this.missingRef))}}ref_error.default=MissingRefError;var compile={};Object.defineProperty(compile,"__esModule",{value:!0});compile.resolveSchema=compile.getCompilingSchema=compile.resolveRef=compile.compileSchema=compile.SchemaEnv=void 0;const codegen_1$m=codegen,validation_error_1=validation_error,names_1$2=names$1,resolve_1=resolve$1,util_1$k=util,validate_1$1=validate;class SchemaEnv{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,resolve_1.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}compile.SchemaEnv=SchemaEnv;function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let c;e.$async&&(c=i.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const u=i.scopeName("validate");e.validateName=u;const l={gen:i,allErrors:this.opts.allErrors,data:names_1$2.default.data,parentData:names_1$2.default.parentData,parentDataProperty:names_1$2.default.parentDataProperty,dataNames:[names_1$2.default.data],dataPathArr:[codegen_1$m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:c,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:codegen_1$m.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,codegen_1$m._)`""`,opts:this.opts,self:this};let p;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const f=i.toString();p=`${i.scopeRefs(names_1$2.default.scope)}return ${f}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const P=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,p)(this,this.scope.get());if(this.scope.value(u,{ref:P}),P.errors=null,P.schema=e.schema,P.schemaEnv=e,e.$async&&(P.$async=!0),this.opts.code.source===!0&&(P.source={validateName:u,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:E,items:C}=l;P.evaluated={props:E instanceof codegen_1$m.Name?void 0:E,items:C instanceof codegen_1$m.Name?void 0:C,dynamicProps:E instanceof codegen_1$m.Name,dynamicItems:C instanceof codegen_1$m.Name},P.source&&(P.source.evaluated=(0,codegen_1$m.stringify)(P.evaluated))}return e.validate=P,e}catch(f){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),f}finally{this._compilations.delete(e)}}compile.compileSchema=compileSchema;function resolveRef(e,t,r){var n;r=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=resolve.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:c}=this.opts;i&&(o=new SchemaEnv({schema:i,schemaId:c,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=inlineOrCompile.call(this,o)}compile.resolveRef=resolveRef;function inlineOrCompile(e){return(0,resolve_1.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations)if(sameSchemaEnv(t,e))return t}compile.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t),n=(0,resolve_1._getFullPath)(this.opts.uriResolver,r);let s=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return getJsonPointer.call(this,r,e);const o=(0,resolve_1.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const c=resolveSchema.call(this,e,i);return typeof(c==null?void 0:c.schema)!="object"?void 0:getJsonPointer.call(this,r,c)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||compileSchema.call(this,i),o===(0,resolve_1.normalizeId)(t)){const{schema:c}=i,{schemaId:u}=this.opts,l=c[u];return l&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,l)),new SchemaEnv({schema:c,schemaId:u,root:e,baseId:s})}return getJsonPointer.call(this,r,i)}}compile.resolveSchema=resolveSchema;const PREVENT_SCOPE_CHANGE=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const c of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const u=r[(0,util_1$k.unescapeFragment)(c)];if(u===void 0)return;r=u;const l=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(c)&&l&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const c=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=resolveSchema.call(this,n,c)}const{schemaId:i}=this.opts;if(o=o||new SchemaEnv({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const $id$1="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description="Meta-schema for $data reference (JSON AnySchema extension proposal)",type$1="object",required$1=["$data"],properties$2={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties$1=!1,require$$9={$id:$id$1,description,type:type$1,required:required$1,properties:properties$2,additionalProperties:additionalProperties$1};var uri$1={},uri_all={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(r,n){n(t)})(commonjsGlobal,function(r){function n(){for(var h=arguments.length,d=Array(h),g=0;g<h;g++)d[g]=arguments[g];if(d.length>1){d[0]=d[0].slice(0,-1);for(var k=d.length-1,R=1;R<k;++R)d[R]=d[R].slice(1,-1);return d[k]=d[k].slice(1),d.join("")}else return d[0]}function s(h){return"(?:"+h+")"}function o(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function i(h){return h.toUpperCase()}function c(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function u(h,d){var g=h;if(d)for(var k in d)g[k]=d[k];return g}function l(h){var d="[A-Za-z]",g="[0-9]",k=n(g,"[A-Fa-f]"),R=s(s("%[EFef]"+k+"%"+k+k+"%"+k+k)+"|"+s("%[89A-Fa-f]"+k+"%"+k+k)+"|"+s("%"+k+k)),q="[\\:\\/\\?\\#\\[\\]\\@]",x="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",K=n(q,x),Q=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",te=h?"[\\uE000-\\uF8FF]":"[]",W=n(d,g,"[\\-\\.\\_\\~]",Q);s(d+n(d,g,"[\\+\\-\\.]")+"*"),s(s(R+"|"+n(W,x,"[\\:]"))+"*");var J=s(s("25[0-5]")+"|"+s("2[0-4]"+g)+"|"+s("1"+g+g)+"|"+s("0?[1-9]"+g)+"|0?0?"+g),re=s(J+"\\."+J+"\\."+J+"\\."+J),V=s(k+"{1,4}"),Y=s(s(V+"\\:"+V)+"|"+re),se=s(s(V+"\\:")+"{6}"+Y),Z=s("\\:\\:"+s(V+"\\:")+"{5}"+Y),Pe=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+Y),ge=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+Y),_e=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+Y),qe=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+Y),Ce=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+Y),pe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),ye=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),Oe=s([se,Z,Pe,ge,_e,qe,Ce,pe,ye].join("|")),ve=s(s(W+"|"+R)+"+");s("[vV]"+k+"+\\."+n(W,x,"[\\:]")+"+"),s(s(R+"|"+n(W,x))+"*");var Qe=s(R+"|"+n(W,x,"[\\:\\@]"));return s(s(R+"|"+n(W,x,"[\\@]"))+"+"),s(s(Qe+"|"+n("[\\/\\?]",te))+"*"),{NOT_SCHEME:new RegExp(n("[^]",d,g,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",W,x),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",W,x),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",W,x),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",W,x),"g"),NOT_QUERY:new RegExp(n("[^\\%]",W,x,"[\\:\\@\\/\\?]",te),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",W,x,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",W,x),"g"),UNRESERVED:new RegExp(W,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",W,K),"g"),PCT_ENCODED:new RegExp(R,"g"),IPV4ADDRESS:new RegExp("^("+re+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Oe+")"+s(s("\\%25|\\%(?!"+k+"{2})")+"("+ve+")")+"?\\]?$")}}var p=l(!1),f=l(!0),b=function(){function h(d,g){var k=[],R=!0,q=!1,x=void 0;try{for(var K=d[Symbol.iterator](),Q;!(R=(Q=K.next()).done)&&(k.push(Q.value),!(g&&k.length===g));R=!0);}catch(te){q=!0,x=te}finally{try{!R&&K.return&&K.return()}finally{if(q)throw x}}return k}return function(d,g){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return h(d,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(h){if(Array.isArray(h)){for(var d=0,g=Array(h.length);d<h.length;d++)g[d]=h[d];return g}else return Array.from(h)},E=2147483647,C=36,$=1,_=26,y=38,S=700,I=72,D=128,w="-",O=/^xn--/,A=/[^\0-\x7E]/,U=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},X=C-$,G=Math.floor,de=String.fromCharCode;function ne(h){throw new RangeError(H[h])}function Se(h,d){for(var g=[],k=h.length;k--;)g[k]=d(h[k]);return g}function Te(h,d){var g=h.split("@"),k="";g.length>1&&(k=g[0]+"@",h=g[1]),h=h.replace(U,".");var R=h.split("."),q=Se(R,d).join(".");return k+q}function Ne(h){for(var d=[],g=0,k=h.length;g<k;){var R=h.charCodeAt(g++);if(R>=55296&&R<=56319&&g<k){var q=h.charCodeAt(g++);(q&64512)==56320?d.push(((R&1023)<<10)+(q&1023)+65536):(d.push(R),g--)}else d.push(R)}return d}var Ve=function(d){return String.fromCodePoint.apply(String,P(d))},Ie=function(d){return d-48<10?d-22:d-65<26?d-65:d-97<26?d-97:C},F=function(d,g){return d+22+75*(d<26)-((g!=0)<<5)},v=function(d,g,k){var R=0;for(d=k?G(d/S):d>>1,d+=G(d/g);d>X*_>>1;R+=C)d=G(d/X);return G(R+(X+1)*d/(d+y))},j=function(d){var g=[],k=d.length,R=0,q=D,x=I,K=d.lastIndexOf(w);K<0&&(K=0);for(var Q=0;Q<K;++Q)d.charCodeAt(Q)>=128&&ne("not-basic"),g.push(d.charCodeAt(Q));for(var te=K>0?K+1:0;te<k;){for(var W=R,J=1,re=C;;re+=C){te>=k&&ne("invalid-input");var V=Ie(d.charCodeAt(te++));(V>=C||V>G((E-R)/J))&&ne("overflow"),R+=V*J;var Y=re<=x?$:re>=x+_?_:re-x;if(V<Y)break;var se=C-Y;J>G(E/se)&&ne("overflow"),J*=se}var Z=g.length+1;x=v(R-W,Z,W==0),G(R/Z)>E-q&&ne("overflow"),q+=G(R/Z),R%=Z,g.splice(R++,0,q)}return String.fromCodePoint.apply(String,g)},T=function(d){var g=[];d=Ne(d);var k=d.length,R=D,q=0,x=I,K=!0,Q=!1,te=void 0;try{for(var W=d[Symbol.iterator](),J;!(K=(J=W.next()).done);K=!0){var re=J.value;re<128&&g.push(de(re))}}catch(Ye){Q=!0,te=Ye}finally{try{!K&&W.return&&W.return()}finally{if(Q)throw te}}var V=g.length,Y=V;for(V&&g.push(w);Y<k;){var se=E,Z=!0,Pe=!1,ge=void 0;try{for(var _e=d[Symbol.iterator](),qe;!(Z=(qe=_e.next()).done);Z=!0){var Ce=qe.value;Ce>=R&&Ce<se&&(se=Ce)}}catch(Ye){Pe=!0,ge=Ye}finally{try{!Z&&_e.return&&_e.return()}finally{if(Pe)throw ge}}var pe=Y+1;se-R>G((E-q)/pe)&&ne("overflow"),q+=(se-R)*pe,R=se;var ye=!0,Oe=!1,ve=void 0;try{for(var Qe=d[Symbol.iterator](),Rt;!(ye=(Rt=Qe.next()).done);ye=!0){var kt=Rt.value;if(kt<R&&++q>E&&ne("overflow"),kt==R){for(var et=q,tt=C;;tt+=C){var rt=tt<=x?$:tt>=x+_?_:tt-x;if(et<rt)break;var Ct=et-rt,Ot=C-rt;g.push(de(F(rt+Ct%Ot,0))),et=G(Ct/Ot)}g.push(de(F(et,0))),x=v(q,pe,Y==V),q=0,++Y}}}catch(Ye){Oe=!0,ve=Ye}finally{try{!ye&&Qe.return&&Qe.return()}finally{if(Oe)throw ve}}++q,++R}return g.join("")},a=function(d){return Te(d,function(g){return O.test(g)?j(g.slice(4).toLowerCase()):g})},m=function(d){return Te(d,function(g){return A.test(g)?"xn--"+T(g):g})},N={version:"2.1.0",ucs2:{decode:Ne,encode:Ve},decode:j,encode:T,toASCII:m,toUnicode:a},M={};function L(h){var d=h.charCodeAt(0),g=void 0;return d<16?g="%0"+d.toString(16).toUpperCase():d<128?g="%"+d.toString(16).toUpperCase():d<2048?g="%"+(d>>6|192).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase():g="%"+(d>>12|224).toString(16).toUpperCase()+"%"+(d>>6&63|128).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase(),g}function z(h){for(var d="",g=0,k=h.length;g<k;){var R=parseInt(h.substr(g+1,2),16);if(R<128)d+=String.fromCharCode(R),g+=3;else if(R>=194&&R<224){if(k-g>=6){var q=parseInt(h.substr(g+4,2),16);d+=String.fromCharCode((R&31)<<6|q&63)}else d+=h.substr(g,6);g+=6}else if(R>=224){if(k-g>=9){var x=parseInt(h.substr(g+4,2),16),K=parseInt(h.substr(g+7,2),16);d+=String.fromCharCode((R&15)<<12|(x&63)<<6|K&63)}else d+=h.substr(g,9);g+=9}else d+=h.substr(g,3),g+=3}return d}function B(h,d){function g(k){var R=z(k);return R.match(d.UNRESERVED)?R:k}return h.scheme&&(h.scheme=String(h.scheme).replace(d.PCT_ENCODED,g).toLowerCase().replace(d.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(d.PCT_ENCODED,g).replace(d.NOT_USERINFO,L).replace(d.PCT_ENCODED,i)),h.host!==void 0&&(h.host=String(h.host).replace(d.PCT_ENCODED,g).toLowerCase().replace(d.NOT_HOST,L).replace(d.PCT_ENCODED,i)),h.path!==void 0&&(h.path=String(h.path).replace(d.PCT_ENCODED,g).replace(h.scheme?d.NOT_PATH:d.NOT_PATH_NOSCHEME,L).replace(d.PCT_ENCODED,i)),h.query!==void 0&&(h.query=String(h.query).replace(d.PCT_ENCODED,g).replace(d.NOT_QUERY,L).replace(d.PCT_ENCODED,i)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(d.PCT_ENCODED,g).replace(d.NOT_FRAGMENT,L).replace(d.PCT_ENCODED,i)),h}function ee(h){return h.replace(/^0*(.*)/,"$1")||"0"}function fe(h,d){var g=h.match(d.IPV4ADDRESS)||[],k=b(g,2),R=k[1];return R?R.split(".").map(ee).join("."):h}function je(h,d){var g=h.match(d.IPV6ADDRESS)||[],k=b(g,3),R=k[1],q=k[2];if(R){for(var x=R.toLowerCase().split("::").reverse(),K=b(x,2),Q=K[0],te=K[1],W=te?te.split(":").map(ee):[],J=Q.split(":").map(ee),re=d.IPV4ADDRESS.test(J[J.length-1]),V=re?7:8,Y=J.length-V,se=Array(V),Z=0;Z<V;++Z)se[Z]=W[Z]||J[Y+Z]||"";re&&(se[V-1]=fe(se[V-1],d));var Pe=se.reduce(function(pe,ye,Oe){if(!ye||ye==="0"){var ve=pe[pe.length-1];ve&&ve.index+ve.length===Oe?ve.length++:pe.push({index:Oe,length:1})}return pe},[]),ge=Pe.sort(function(pe,ye){return ye.length-pe.length})[0],_e=void 0;if(ge&&ge.length>1){var qe=se.slice(0,ge.index),Ce=se.slice(ge.index+ge.length);_e=qe.join(":")+"::"+Ce.join(":")}else _e=se.join(":");return q&&(_e+="%"+q),_e}else return h}var He=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ze="".match(/(){0}/)[1]===void 0;function le(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},k=d.iri!==!1?f:p;d.reference==="suffix"&&(h=(d.scheme?d.scheme+":":"")+"//"+h);var R=h.match(He);if(R){ze?(g.scheme=R[1],g.userinfo=R[3],g.host=R[4],g.port=parseInt(R[5],10),g.path=R[6]||"",g.query=R[7],g.fragment=R[8],isNaN(g.port)&&(g.port=R[5])):(g.scheme=R[1]||void 0,g.userinfo=h.indexOf("@")!==-1?R[3]:void 0,g.host=h.indexOf("//")!==-1?R[4]:void 0,g.port=parseInt(R[5],10),g.path=R[6]||"",g.query=h.indexOf("?")!==-1?R[7]:void 0,g.fragment=h.indexOf("#")!==-1?R[8]:void 0,isNaN(g.port)&&(g.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),g.host&&(g.host=je(fe(g.host,k),k)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==g.reference&&(g.error=g.error||"URI is not a "+d.reference+" reference.");var q=M[(d.scheme||g.scheme||"").toLowerCase()];if(!d.unicodeSupport&&(!q||!q.unicodeSupport)){if(g.host&&(d.domainHost||q&&q.domainHost))try{g.host=N.toASCII(g.host.replace(k.PCT_ENCODED,z).toLowerCase())}catch(x){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+x}B(g,p)}else B(g,k);q&&q.parse&&q.parse(g,d)}else g.error=g.error||"URI can not be parsed.";return g}function We(h,d){var g=d.iri!==!1?f:p,k=[];return h.userinfo!==void 0&&(k.push(h.userinfo),k.push("@")),h.host!==void 0&&k.push(je(fe(String(h.host),g),g).replace(g.IPV6ADDRESS,function(R,q,x){return"["+q+(x?"%25"+x:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(k.push(":"),k.push(String(h.port))),k.length?k.join(""):void 0}var Ae=/^\.\.?\//,De=/^\/\.(\/|$)/,Fe=/^\/\.\.(\/|$)/,Be=/^\/?(?:.|\n)*?(?=\/|$)/;function he(h){for(var d=[];h.length;)if(h.match(Ae))h=h.replace(Ae,"");else if(h.match(De))h=h.replace(De,"/");else if(h.match(Fe))h=h.replace(Fe,"/"),d.pop();else if(h==="."||h==="..")h="";else{var g=h.match(Be);if(g){var k=g[0];h=h.slice(k.length),d.push(k)}else throw new Error("Unexpected dot segment condition")}return d.join("")}function ae(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=d.iri?f:p,k=[],R=M[(d.scheme||h.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(h,d),h.host&&!g.IPV6ADDRESS.test(h.host)){if(d.domainHost||R&&R.domainHost)try{h.host=d.iri?N.toUnicode(h.host):N.toASCII(h.host.replace(g.PCT_ENCODED,z).toLowerCase())}catch(K){h.error=h.error||"Host's domain name can not be converted to "+(d.iri?"Unicode":"ASCII")+" via punycode: "+K}}B(h,g),d.reference!=="suffix"&&h.scheme&&(k.push(h.scheme),k.push(":"));var q=We(h,d);if(q!==void 0&&(d.reference!=="suffix"&&k.push("//"),k.push(q),h.path&&h.path.charAt(0)!=="/"&&k.push("/")),h.path!==void 0){var x=h.path;!d.absolutePath&&(!R||!R.absolutePath)&&(x=he(x)),q===void 0&&(x=x.replace(/^\/\//,"/%2F")),k.push(x)}return h.query!==void 0&&(k.push("?"),k.push(h.query)),h.fragment!==void 0&&(k.push("#"),k.push(h.fragment)),k.join("")}function Me(h,d){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=arguments[3],R={};return k||(h=le(ae(h,g),g),d=le(ae(d,g),g)),g=g||{},!g.tolerant&&d.scheme?(R.scheme=d.scheme,R.userinfo=d.userinfo,R.host=d.host,R.port=d.port,R.path=he(d.path||""),R.query=d.query):(d.userinfo!==void 0||d.host!==void 0||d.port!==void 0?(R.userinfo=d.userinfo,R.host=d.host,R.port=d.port,R.path=he(d.path||""),R.query=d.query):(d.path?(d.path.charAt(0)==="/"?R.path=he(d.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?R.path="/"+d.path:h.path?R.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+d.path:R.path=d.path,R.path=he(R.path)),R.query=d.query):(R.path=h.path,d.query!==void 0?R.query=d.query:R.query=h.query),R.userinfo=h.userinfo,R.host=h.host,R.port=h.port),R.scheme=h.scheme),R.fragment=d.fragment,R}function Ge(h,d,g){var k=u({scheme:"null"},g);return ae(Me(le(h,k),le(d,k),k,!0),k)}function Re(h,d){return typeof h=="string"?h=ae(le(h,d),d):o(h)==="object"&&(h=le(ae(h,d),d)),h}function Ke(h,d,g){return typeof h=="string"?h=ae(le(h,g),g):o(h)==="object"&&(h=ae(h,g)),typeof d=="string"?d=ae(le(d,g),g):o(d)==="object"&&(d=ae(d,g)),h===d}function Xe(h,d){return h&&h.toString().replace(!d||!d.iri?p.ESCAPE:f.ESCAPE,L)}function ue(h,d){return h&&h.toString().replace(!d||!d.iri?p.PCT_ENCODED:f.PCT_ENCODED,z)}var ke={scheme:"http",domainHost:!0,parse:function(d,g){return d.host||(d.error=d.error||"HTTP URIs must have a host."),d},serialize:function(d,g){var k=String(d.scheme).toLowerCase()==="https";return(d.port===(k?443:80)||d.port==="")&&(d.port=void 0),d.path||(d.path="/"),d}},$t={scheme:"https",domainHost:ke.domainHost,parse:ke.parse,serialize:ke.serialize};function vt(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var Je={scheme:"ws",domainHost:!0,parse:function(d,g){var k=d;return k.secure=vt(k),k.resourceName=(k.path||"/")+(k.query?"?"+k.query:""),k.path=void 0,k.query=void 0,k},serialize:function(d,g){if((d.port===(vt(d)?443:80)||d.port==="")&&(d.port=void 0),typeof d.secure=="boolean"&&(d.scheme=d.secure?"wss":"ws",d.secure=void 0),d.resourceName){var k=d.resourceName.split("?"),R=b(k,2),q=R[0],x=R[1];d.path=q&&q!=="/"?q:void 0,d.query=x,d.resourceName=void 0}return d.fragment=void 0,d}},wt={scheme:"wss",domainHost:Je.domainHost,parse:Je.parse,serialize:Je.serialize},zt={},Pt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",me="[0-9A-Fa-f]",Wt=s(s("%[EFef]"+me+"%"+me+me+"%"+me+me)+"|"+s("%[89A-Fa-f]"+me+"%"+me+me)+"|"+s("%"+me+me)),Bt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Gt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Kt=n(Gt,'[\\"\\\\]'),Jt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Qt=new RegExp(Pt,"g"),Le=new RegExp(Wt,"g"),Yt=new RegExp(n("[^]",Bt,"[\\.]",'[\\"]',Kt),"g"),bt=new RegExp(n("[^]",Pt,Jt),"g"),Zt=bt;function gt(h){var d=z(h);return d.match(Qt)?d:h}var Et={scheme:"mailto",parse:function(d,g){var k=d,R=k.to=k.path?k.path.split(","):[];if(k.path=void 0,k.query){for(var q=!1,x={},K=k.query.split("&"),Q=0,te=K.length;Q<te;++Q){var W=K[Q].split("=");switch(W[0]){case"to":for(var J=W[1].split(","),re=0,V=J.length;re<V;++re)R.push(J[re]);break;case"subject":k.subject=ue(W[1],g);break;case"body":k.body=ue(W[1],g);break;default:q=!0,x[ue(W[0],g)]=ue(W[1],g);break}}q&&(k.headers=x)}k.query=void 0;for(var Y=0,se=R.length;Y<se;++Y){var Z=R[Y].split("@");if(Z[0]=ue(Z[0]),g.unicodeSupport)Z[1]=ue(Z[1],g).toLowerCase();else try{Z[1]=N.toASCII(ue(Z[1],g).toLowerCase())}catch(Pe){k.error=k.error||"Email address's domain name can not be converted to ASCII via punycode: "+Pe}R[Y]=Z.join("@")}return k},serialize:function(d,g){var k=d,R=c(d.to);if(R){for(var q=0,x=R.length;q<x;++q){var K=String(R[q]),Q=K.lastIndexOf("@"),te=K.slice(0,Q).replace(Le,gt).replace(Le,i).replace(Yt,L),W=K.slice(Q+1);try{W=g.iri?N.toUnicode(W):N.toASCII(ue(W,g).toLowerCase())}catch(Y){k.error=k.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+Y}R[q]=te+"@"+W}k.path=R.join(",")}var J=d.headers=d.headers||{};d.subject&&(J.subject=d.subject),d.body&&(J.body=d.body);var re=[];for(var V in J)J[V]!==zt[V]&&re.push(V.replace(Le,gt).replace(Le,i).replace(bt,L)+"="+J[V].replace(Le,gt).replace(Le,i).replace(Zt,L));return re.length&&(k.query=re.join("&")),k}},Xt=/^([^\:]+)\:(.*)/,St={scheme:"urn",parse:function(d,g){var k=d.path&&d.path.match(Xt),R=d;if(k){var q=g.scheme||R.scheme||"urn",x=k[1].toLowerCase(),K=k[2],Q=q+":"+(g.nid||x),te=M[Q];R.nid=x,R.nss=K,R.path=void 0,te&&(R=te.parse(R,g))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(d,g){var k=g.scheme||d.scheme||"urn",R=d.nid,q=k+":"+(g.nid||R),x=M[q];x&&(d=x.serialize(d,g));var K=d,Q=d.nss;return K.path=(R||g.nid)+":"+Q,K}},er=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(d,g){var k=d;return k.uuid=k.nss,k.nss=void 0,!g.tolerant&&(!k.uuid||!k.uuid.match(er))&&(k.error=k.error||"UUID is not valid."),k},serialize:function(d,g){var k=d;return k.nss=(d.uuid||"").toLowerCase(),k}};M[ke.scheme]=ke,M[$t.scheme]=$t,M[Je.scheme]=Je,M[wt.scheme]=wt,M[Et.scheme]=Et,M[St.scheme]=St,M[Tt.scheme]=Tt,r.SCHEMES=M,r.pctEncChar=L,r.pctDecChars=z,r.parse=le,r.removeDotSegments=he,r.serialize=ae,r.resolveComponents=Me,r.resolve=Ge,r.normalize=Re,r.equal=Ke,r.escapeComponent=Xe,r.unescapeComponent=ue,Object.defineProperty(r,"__esModule",{value:!0})})})(uri_all,uri_all.exports);var uri_allExports=uri_all.exports;Object.defineProperty(uri$1,"__esModule",{value:!0});const uri=uri_allExports;uri.code='require("ajv/dist/runtime/uri").default';uri$1.default=uri;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=validate;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=codegen;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=validation_error,s=ref_error,o=rules,i=compile,c=codegen,u=resolve$1,l=dataType,p=util,f=require$$9,b=uri$1,P=(F,v)=>new RegExp(F,v);P.code="new RegExp";const E=["removeAdditional","useDefaults","coerceTypes"],C=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},y=200;function S(F){var v,j,T,a,m,N,M,L,z,B,ee,fe,je,He,ze,le,We,Ae,De,Fe,Be,he,ae,Me,Ge;const Re=F.strict,Ke=(v=F.code)===null||v===void 0?void 0:v.optimize,Xe=Ke===!0||Ke===void 0?1:Ke||0,ue=(T=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&T!==void 0?T:P,ke=(a=F.uriResolver)!==null&&a!==void 0?a:b.default;return{strictSchema:(N=(m=F.strictSchema)!==null&&m!==void 0?m:Re)!==null&&N!==void 0?N:!0,strictNumbers:(L=(M=F.strictNumbers)!==null&&M!==void 0?M:Re)!==null&&L!==void 0?L:!0,strictTypes:(B=(z=F.strictTypes)!==null&&z!==void 0?z:Re)!==null&&B!==void 0?B:"log",strictTuples:(fe=(ee=F.strictTuples)!==null&&ee!==void 0?ee:Re)!==null&&fe!==void 0?fe:"log",strictRequired:(He=(je=F.strictRequired)!==null&&je!==void 0?je:Re)!==null&&He!==void 0?He:!1,code:F.code?{...F.code,optimize:Xe,regExp:ue}:{optimize:Xe,regExp:ue},loopRequired:(ze=F.loopRequired)!==null&&ze!==void 0?ze:y,loopEnum:(le=F.loopEnum)!==null&&le!==void 0?le:y,meta:(We=F.meta)!==null&&We!==void 0?We:!0,messages:(Ae=F.messages)!==null&&Ae!==void 0?Ae:!0,inlineRefs:(De=F.inlineRefs)!==null&&De!==void 0?De:!0,schemaId:(Fe=F.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(Be=F.addUsedSchema)!==null&&Be!==void 0?Be:!0,validateSchema:(he=F.validateSchema)!==null&&he!==void 0?he:!0,validateFormats:(ae=F.validateFormats)!==null&&ae!==void 0?ae:!0,unicodeRegExp:(Me=F.unicodeRegExp)!==null&&Me!==void 0?Me:!0,int32range:(Ge=F.int32range)!==null&&Ge!==void 0?Ge:!0,uriResolver:ke}}class I{constructor(v={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,v=this.opts={...v,...S(v)};const{es5:j,lines:T}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:C,es5:j,lines:T}),this.logger=G(v.logger);const a=v.validateFormats;v.validateFormats=!1,this.RULES=(0,o.getRules)(),D.call(this,$,v,"NOT SUPPORTED"),D.call(this,_,v,"DEPRECATED","warn"),this._metaOpts=H.call(this),v.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),v.keywords&&U.call(this,v.keywords),typeof v.meta=="object"&&this.addMetaSchema(v.meta),O.call(this),v.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:v,meta:j,schemaId:T}=this.opts;let a=f;T==="id"&&(a={...f},a.id=a.$id,delete a.$id),j&&v&&this.addMetaSchema(a,a[T],!1)}defaultMeta(){const{meta:v,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof v=="object"?v[j]||v:void 0}validate(v,j){let T;if(typeof v=="string"){if(T=this.getSchema(v),!T)throw new Error(`no schema with key or ref "${v}"`)}else T=this.compile(v);const a=T(j);return"$async"in T||(this.errors=T.errors),a}compile(v,j){const T=this._addSchema(v,j);return T.validate||this._compileSchemaEnv(T)}compileAsync(v,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:T}=this.opts;return a.call(this,v,j);async function a(B,ee){await m.call(this,B.$schema);const fe=this._addSchema(B,ee);return fe.validate||N.call(this,fe)}async function m(B){B&&!this.getSchema(B)&&await a.call(this,{$ref:B},!0)}async function N(B){try{return this._compileSchemaEnv(B)}catch(ee){if(!(ee instanceof s.default))throw ee;return M.call(this,ee),await L.call(this,ee.missingSchema),N.call(this,B)}}function M({missingSchema:B,missingRef:ee}){if(this.refs[B])throw new Error(`AnySchema ${B} is loaded but ${ee} cannot be resolved`)}async function L(B){const ee=await z.call(this,B);this.refs[B]||await m.call(this,ee.$schema),this.refs[B]||this.addSchema(ee,B,j)}async function z(B){const ee=this._loading[B];if(ee)return ee;try{return await(this._loading[B]=T(B))}finally{delete this._loading[B]}}}addSchema(v,j,T,a=this.opts.validateSchema){if(Array.isArray(v)){for(const N of v)this.addSchema(N,void 0,T,a);return this}let m;if(typeof v=="object"){const{schemaId:N}=this.opts;if(m=v[N],m!==void 0&&typeof m!="string")throw new Error(`schema ${N} must be string`)}return j=(0,u.normalizeId)(j||m),this._checkUnique(j),this.schemas[j]=this._addSchema(v,T,j,a,!0),this}addMetaSchema(v,j,T=this.opts.validateSchema){return this.addSchema(v,j,!0,T),this}validateSchema(v,j){if(typeof v=="boolean")return!0;let T;if(T=v.$schema,T!==void 0&&typeof T!="string")throw new Error("$schema must be a string");if(T=T||this.opts.defaultMeta||this.defaultMeta(),!T)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(T,v);if(!a&&j){const m="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(m);else throw new Error(m)}return a}getSchema(v){let j;for(;typeof(j=w.call(this,v))=="string";)v=j;if(j===void 0){const{schemaId:T}=this.opts,a=new i.SchemaEnv({schema:{},schemaId:T});if(j=i.resolveSchema.call(this,a,v),!j)return;this.refs[v]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(v){if(v instanceof RegExp)return this._removeAllSchemas(this.schemas,v),this._removeAllSchemas(this.refs,v),this;switch(typeof v){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=w.call(this,v);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[v],delete this.refs[v],this}case"object":{const j=v;this._cache.delete(j);let T=v[this.opts.schemaId];return T&&(T=(0,u.normalizeId)(T),delete this.schemas[T],delete this.refs[T]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(v){for(const j of v)this.addKeyword(j);return this}addKeyword(v,j){let T;if(typeof v=="string")T=v,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=T);else if(typeof v=="object"&&j===void 0){if(j=v,T=j.keyword,Array.isArray(T)&&!T.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ne.call(this,T,j),!j)return(0,p.eachItem)(T,m=>Se.call(this,m)),this;Ne.call(this,j);const a={...j,type:(0,l.getJSONTypes)(j.type),schemaType:(0,l.getJSONTypes)(j.schemaType)};return(0,p.eachItem)(T,a.type.length===0?m=>Se.call(this,m,a):m=>a.type.forEach(N=>Se.call(this,m,a,N))),this}getKeyword(v){const j=this.RULES.all[v];return typeof j=="object"?j.definition:!!j}removeKeyword(v){const{RULES:j}=this;delete j.keywords[v],delete j.all[v];for(const T of j.rules){const a=T.rules.findIndex(m=>m.keyword===v);a>=0&&T.rules.splice(a,1)}return this}addFormat(v,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[v]=j,this}errorsText(v=this.errors,{separator:j=", ",dataVar:T="data"}={}){return!v||v.length===0?"No errors":v.map(a=>`${T}${a.instancePath} ${a.message}`).reduce((a,m)=>a+j+m)}$dataMetaSchema(v,j){const T=this.RULES.all;v=JSON.parse(JSON.stringify(v));for(const a of j){const m=a.split("/").slice(1);let N=v;for(const M of m)N=N[M];for(const M in T){const L=T[M];if(typeof L!="object")continue;const{$data:z}=L.definition,B=N[M];z&&B&&(N[M]=Ie(B))}}return v}_removeAllSchemas(v,j){for(const T in v){const a=v[T];(!j||j.test(T))&&(typeof a=="string"?delete v[T]:a&&!a.meta&&(this._cache.delete(a.schema),delete v[T]))}}_addSchema(v,j,T,a=this.opts.validateSchema,m=this.opts.addUsedSchema){let N;const{schemaId:M}=this.opts;if(typeof v=="object")N=v[M];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof v!="boolean")throw new Error("schema must be object or boolean")}let L=this._cache.get(v);if(L!==void 0)return L;T=(0,u.normalizeId)(N||T);const z=u.getSchemaRefs.call(this,v,T);return L=new i.SchemaEnv({schema:v,schemaId:M,meta:j,baseId:T,localRefs:z}),this._cache.set(L.schema,L),m&&!T.startsWith("#")&&(T&&this._checkUnique(T),this.refs[T]=L),a&&this.validateSchema(v,!0),L}_checkUnique(v){if(this.schemas[v]||this.refs[v])throw new Error(`schema with key or id "${v}" already exists`)}_compileSchemaEnv(v){if(v.meta?this._compileMetaSchema(v):i.compileSchema.call(this,v),!v.validate)throw new Error("ajv implementation error");return v.validate}_compileMetaSchema(v){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,v)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(F,v,j,T="error"){for(const a in F){const m=a;m in v&&this.logger[T](`${j}: option ${a}. ${F[m]}`)}}function w(F){return F=(0,u.normalizeId)(F),this.schemas[F]||this.refs[F]}function O(){const F=this.opts.schemas;if(F)if(Array.isArray(F))this.addSchema(F);else for(const v in F)this.addSchema(F[v],v)}function A(){for(const F in this.opts.formats){const v=this.opts.formats[F];v&&this.addFormat(F,v)}}function U(F){if(Array.isArray(F)){this.addVocabulary(F);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const v in F){const j=F[v];j.keyword||(j.keyword=v),this.addKeyword(j)}}function H(){const F={...this.opts};for(const v of E)delete F[v];return F}const X={log(){},warn(){},error(){}};function G(F){if(F===!1)return X;if(F===void 0)return console;if(F.log&&F.warn&&F.error)return F;throw new Error("logger must implement log, warn and error methods")}const de=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(F,v){const{RULES:j}=this;if((0,p.eachItem)(F,T=>{if(j.keywords[T])throw new Error(`Keyword ${T} is already defined`);if(!de.test(T))throw new Error(`Keyword ${T} has invalid name`)}),!!v&&v.$data&&!("code"in v||"validate"in v))throw new Error('$data keyword must have "code" or "validate" function')}function Se(F,v,j){var T;const a=v==null?void 0:v.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:m}=this;let N=a?m.post:m.rules.find(({type:L})=>L===j);if(N||(N={type:j,rules:[]},m.rules.push(N)),m.keywords[F]=!0,!v)return;const M={keyword:F,definition:{...v,type:(0,l.getJSONTypes)(v.type),schemaType:(0,l.getJSONTypes)(v.schemaType)}};v.before?Te.call(this,N,M,v.before):N.rules.push(M),m.all[F]=M,(T=v.implements)===null||T===void 0||T.forEach(L=>this.addKeyword(L))}function Te(F,v,j){const T=F.rules.findIndex(a=>a.keyword===j);T>=0?F.rules.splice(T,0,v):(F.rules.push(v),this.logger.warn(`rule ${j} is not defined`))}function Ne(F){let{metaSchema:v}=F;v!==void 0&&(F.$data&&this.opts.$data&&(v=Ie(v)),F.validateSchema=this.compile(v,!0))}const Ve={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(F){return{anyOf:[F,Ve]}}})(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0});ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:c,self:u}=n,{root:l}=o;if((r==="#"||r==="#/")&&s===l.baseId)return f();const p=compile_1$1.resolveRef.call(u,l,s,r);if(p===void 0)throw new ref_error_1.default(n.opts.uriResolver,s,r);if(p instanceof compile_1$1.SchemaEnv)return b(p);return P(p);function f(){if(o===l)return callRef(e,i,o,o.$async);const E=t.scopeValue("root",{ref:l});return callRef(e,(0,codegen_1$l._)`${E}.validate`,l,l.$async)}function b(E){const C=getValidate(e,E);callRef(e,C,E,E.$async)}function P(E){const C=t.scopeValue("schema",c.code.source===!0?{ref:E,code:(0,codegen_1$l.stringify)(E)}:{ref:E}),$=t.name("valid"),_=e.subschema({schema:E,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:C,errSchemaPath:r},$);e.mergeEvaluated(_),e.ok($)}}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,codegen_1$l._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ref.getValidate=getValidate;function callRef(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:c,opts:u}=o,l=u.passContext?names_1$1.default.this:codegen_1$l.nil;n?p():f();function p(){if(!c.$async)throw new Error("async schema referenced by sync schema");const E=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,l)}`),P(t),i||s.assign(E,!0)},C=>{s.if((0,codegen_1$l._)`!(${C} instanceof ${o.ValidationError})`,()=>s.throw(C)),b(C),i||s.assign(E,!1)}),e.ok(E)}function f(){e.result((0,code_1$8.callValidateCode)(e,t,l),()=>P(t),()=>b(t))}function b(E){const C=(0,codegen_1$l._)`${E}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${C} : ${names_1$1.default.vErrors}.concat(${C})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function P(E){var C;if(!o.opts.unevaluated)return;const $=(C=r==null?void 0:r.validate)===null||C===void 0?void 0:C.evaluated;if(o.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(o.props=util_1$j.mergeEvaluated.props(s,$.props,o.props));else{const _=s.var("props",(0,codegen_1$l._)`${E}.evaluated.props`);o.props=util_1$j.mergeEvaluated.props(s,_,o.props,codegen_1$l.Name)}if(o.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(o.items=util_1$j.mergeEvaluated.items(s,$.items,o.items));else{const _=s.var("items",(0,codegen_1$l._)`${E}.evaluated.items`);o.items=util_1$j.mergeEvaluated.items(s,_,o.items,codegen_1$l.Name)}}}ref.callRef=callRef;ref.default=def$r;Object.defineProperty(core$1,"__esModule",{value:!0});const id_1=id,ref_1=ref,core=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",id_1.default,ref_1.default];core$1.default=core;var validation$1={},limitNumber={};Object.defineProperty(limitNumber,"__esModule",{value:!0});const codegen_1$k=codegen,ops=codegen_1$k.operators,KWDs={maximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},minimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},exclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},exclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error$i={message:({keyword:e,schemaCode:t})=>(0,codegen_1$k.str)`must be ${KWDs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,codegen_1$k._)`{comparison: ${KWDs[e].okStr}, limit: ${t}}`},def$q={keyword:Object.keys(KWDs),type:"number",schemaType:"number",$data:!0,error:error$i,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,codegen_1$k._)`${r} ${KWDs[t].fail} ${n} || isNaN(${r})`)}};limitNumber.default=def$q;var multipleOf={};Object.defineProperty(multipleOf,"__esModule",{value:!0});const codegen_1$j=codegen,error$h={message:({schemaCode:e})=>(0,codegen_1$j.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,codegen_1$j._)`{multipleOf: ${e}}`},def$p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:error$h,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),c=o?(0,codegen_1$j._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,codegen_1$j._)`${i} !== parseInt(${i})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${i} = ${r}/${n}, ${c}))`)}};multipleOf.default=def$p;var limitLength={},ucs2length$1={};Object.defineProperty(ucs2length$1,"__esModule",{value:!0});function ucs2length(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}ucs2length$1.default=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(limitLength,"__esModule",{value:!0});const codegen_1$i=codegen,util_1$i=util,ucs2length_1=ucs2length$1,error$g={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,codegen_1$i.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,codegen_1$i._)`{limit: ${e}}`},def$o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:error$g,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,i=s.opts.unicode===!1?(0,codegen_1$i._)`${r}.length`:(0,codegen_1$i._)`${(0,util_1$i.useFunc)(e.gen,ucs2length_1.default)}(${r})`;e.fail$data((0,codegen_1$i._)`${i} ${o} ${n}`)}};limitLength.default=def$o;var pattern={};Object.defineProperty(pattern,"__esModule",{value:!0});const code_1$7=code,codegen_1$h=codegen,error$f={message:({schemaCode:e})=>(0,codegen_1$h.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,codegen_1$h._)`{pattern: ${e}}`},def$n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:error$f,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",c=r?(0,codegen_1$h._)`(new RegExp(${s}, ${i}))`:(0,code_1$7.usePattern)(e,n);e.fail$data((0,codegen_1$h._)`!${c}.test(${t})`)}};pattern.default=def$n;var limitProperties={};Object.defineProperty(limitProperties,"__esModule",{value:!0});const codegen_1$g=codegen,error$e={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,codegen_1$g.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,codegen_1$g._)`{limit: ${e}}`},def$m={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:error$e,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?codegen_1$g.operators.GT:codegen_1$g.operators.LT;e.fail$data((0,codegen_1$g._)`Object.keys(${r}).length ${s} ${n}`)}};limitProperties.default=def$m;var required={};Object.defineProperty(required,"__esModule",{value:!0});const code_1$6=code,codegen_1$f=codegen,util_1$h=util,error$d={message:({params:{missingProperty:e}})=>(0,codegen_1$f.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,codegen_1$f._)`{missingProperty: ${e}}`},def$l={keyword:"required",type:"object",schemaType:"array",$data:!0,error:error$d,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:c}=i;if(!o&&r.length===0)return;const u=r.length>=c.loopRequired;if(i.allErrors?l():p(),c.strictRequired){const P=e.parentSchema.properties,{definedProperties:E}=e.it;for(const C of r)if((P==null?void 0:P[C])===void 0&&!E.has(C)){const $=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${C}" is not defined at "${$}" (strictRequired)`;(0,util_1$h.checkStrictMode)(i,_,i.opts.strictRequired)}}function l(){if(u||o)e.block$data(codegen_1$f.nil,f);else for(const P of r)(0,code_1$6.checkReportMissingProp)(e,P)}function p(){const P=t.let("missing");if(u||o){const E=t.let("valid",!0);e.block$data(E,()=>b(P,E)),e.ok(E)}else t.if((0,code_1$6.checkMissingProp)(e,r,P)),(0,code_1$6.reportMissingProp)(e,P),t.else()}function f(){t.forOf("prop",n,P=>{e.setParams({missingProperty:P}),t.if((0,code_1$6.noPropertyInData)(t,s,P,c.ownProperties),()=>e.error())})}function b(P,E){e.setParams({missingProperty:P}),t.forOf(P,n,()=>{t.assign(E,(0,code_1$6.propertyInData)(t,s,P,c.ownProperties)),t.if((0,codegen_1$f.not)(E),()=>{e.error(),t.break()})},codegen_1$f.nil)}}};required.default=def$l;var limitItems={};Object.defineProperty(limitItems,"__esModule",{value:!0});const codegen_1$e=codegen,error$c={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,codegen_1$e.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,codegen_1$e._)`{limit: ${e}}`},def$k={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:error$c,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?codegen_1$e.operators.GT:codegen_1$e.operators.LT;e.fail$data((0,codegen_1$e._)`${r}.length ${s} ${n}`)}};limitItems.default=def$k;var uniqueItems={},equal$1={};Object.defineProperty(equal$1,"__esModule",{value:!0});const equal=fastDeepEqual;equal.code='require("ajv/dist/runtime/equal").default';equal$1.default=equal;Object.defineProperty(uniqueItems,"__esModule",{value:!0});const dataType_1=dataType,codegen_1$d=codegen,util_1$g=util,equal_1$2=equal$1,error$b={message:({params:{i:e,j:t}})=>(0,codegen_1$d.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,codegen_1$d._)`{i: ${e}, j: ${t}}`},def$j={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:error$b,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:c}=e;if(!n&&!s)return;const u=t.let("valid"),l=o.items?(0,dataType_1.getSchemaTypes)(o.items):[];e.block$data(u,p,(0,codegen_1$d._)`${i} === false`),e.ok(u);function p(){const E=t.let("i",(0,codegen_1$d._)`${r}.length`),C=t.let("j");e.setParams({i:E,j:C}),t.assign(u,!0),t.if((0,codegen_1$d._)`${E} > 1`,()=>(f()?b:P)(E,C))}function f(){return l.length>0&&!l.some(E=>E==="object"||E==="array")}function b(E,C){const $=t.name("item"),_=(0,dataType_1.checkDataTypes)(l,$,c.opts.strictNumbers,dataType_1.DataType.Wrong),y=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${E}--;`,()=>{t.let($,(0,codegen_1$d._)`${r}[${E}]`),t.if(_,(0,codegen_1$d._)`continue`),l.length>1&&t.if((0,codegen_1$d._)`typeof ${$} == "string"`,(0,codegen_1$d._)`${$} += "_"`),t.if((0,codegen_1$d._)`typeof ${y}[${$}] == "number"`,()=>{t.assign(C,(0,codegen_1$d._)`${y}[${$}]`),e.error(),t.assign(u,!1).break()}).code((0,codegen_1$d._)`${y}[${$}] = ${E}`)})}function P(E,C){const $=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${E}--;`,()=>t.for((0,codegen_1$d._)`${C} = ${E}; ${C}--;`,()=>t.if((0,codegen_1$d._)`${$}(${r}[${E}], ${r}[${C}])`,()=>{e.error(),t.assign(u,!1).break(_)})))}}};uniqueItems.default=def$j;var _const={};Object.defineProperty(_const,"__esModule",{value:!0});const codegen_1$c=codegen,util_1$f=util,equal_1$1=equal$1,error$a={message:"must be equal to constant",params:({schemaCode:e})=>(0,codegen_1$c._)`{allowedValue: ${e}}`},def$i={keyword:"const",$data:!0,error:error$a,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,codegen_1$c._)`!${(0,util_1$f.useFunc)(t,equal_1$1.default)}(${r}, ${s})`):e.fail((0,codegen_1$c._)`${o} !== ${r}`)}};_const.default=def$i;var _enum={};Object.defineProperty(_enum,"__esModule",{value:!0});const codegen_1$b=codegen,util_1$e=util,equal_1=equal$1,error$9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,codegen_1$b._)`{allowedValues: ${e}}`},def$h={keyword:"enum",schemaType:"array",$data:!0,error:error$9,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const c=s.length>=i.opts.loopEnum;let u;const l=()=>u??(u=(0,util_1$e.useFunc)(t,equal_1.default));let p;if(c||n)p=t.let("valid"),e.block$data(p,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const P=t.const("vSchema",o);p=(0,codegen_1$b.or)(...s.map((E,C)=>b(P,C)))}e.pass(p);function f(){t.assign(p,!1),t.forOf("v",o,P=>t.if((0,codegen_1$b._)`${l()}(${r}, ${P})`,()=>t.assign(p,!0).break()))}function b(P,E){const C=s[E];return typeof C=="object"&&C!==null?(0,codegen_1$b._)`${l()}(${r}, ${P}[${E}])`:(0,codegen_1$b._)`${r} === ${C}`}}};_enum.default=def$h;Object.defineProperty(validation$1,"__esModule",{value:!0});const limitNumber_1=limitNumber,multipleOf_1=multipleOf,limitLength_1=limitLength,pattern_1=pattern,limitProperties_1=limitProperties,required_1=required,limitItems_1=limitItems,uniqueItems_1=uniqueItems,const_1=_const,enum_1=_enum,validation=[limitNumber_1.default,multipleOf_1.default,limitLength_1.default,pattern_1.default,limitProperties_1.default,required_1.default,limitItems_1.default,uniqueItems_1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},const_1.default,enum_1.default];validation$1.default=validation;var applicator={},additionalItems={};Object.defineProperty(additionalItems,"__esModule",{value:!0});additionalItems.validateAdditionalItems=void 0;const codegen_1$a=codegen,util_1$d=util,error$8={message:({params:{len:e}})=>(0,codegen_1$a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$a._)`{limit: ${e}}`},def$g={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:error$8,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,util_1$d.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(e,n)}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const c=r.const("len",(0,codegen_1$a._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,codegen_1$a._)`${c} <= ${t.length}`);else if(typeof n=="object"&&!(0,util_1$d.alwaysValidSchema)(i,n)){const l=r.var("valid",(0,codegen_1$a._)`${c} <= ${t.length}`);r.if((0,codegen_1$a.not)(l),()=>u(l)),e.ok(l)}function u(l){r.forRange("i",t.length,c,p=>{e.subschema({keyword:o,dataProp:p,dataPropType:util_1$d.Type.Num},l),i.allErrors||r.if((0,codegen_1$a.not)(l),()=>r.break())})}}additionalItems.validateAdditionalItems=validateAdditionalItems;additionalItems.default=def$g;var prefixItems={},items={};Object.defineProperty(items,"__esModule",{value:!0});items.validateTuple=void 0;const codegen_1$9=codegen,util_1$c=util,code_1$5=code,def$f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=!0,!(0,util_1$c.alwaysValidSchema)(r,t)&&e.ok((0,code_1$5.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:c}=e;p(s),c.opts.unevaluated&&r.length&&c.items!==!0&&(c.items=util_1$c.mergeEvaluated.items(n,r.length,c.items));const u=n.name("valid"),l=n.const("len",(0,codegen_1$9._)`${o}.length`);r.forEach((f,b)=>{(0,util_1$c.alwaysValidSchema)(c,f)||(n.if((0,codegen_1$9._)`${l} > ${b}`,()=>e.subschema({keyword:i,schemaProp:b,dataProp:b},u)),e.ok(u))});function p(f){const{opts:b,errSchemaPath:P}=c,E=r.length,C=E===f.minItems&&(E===f.maxItems||f[t]===!1);if(b.strictTuples&&!C){const $=`"${i}" is ${E}-tuple, but minItems or maxItems/${t} are not specified or different at path "${P}"`;(0,util_1$c.checkStrictMode)(c,$,b.strictTuples)}}}items.validateTuple=validateTuple;items.default=def$f;Object.defineProperty(prefixItems,"__esModule",{value:!0});const items_1$1=items,def$e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,items_1$1.validateTuple)(e,"items")};prefixItems.default=def$e;var items2020={};Object.defineProperty(items2020,"__esModule",{value:!0});const codegen_1$8=codegen,util_1$b=util,code_1$4=code,additionalItems_1$1=additionalItems,error$7={message:({params:{len:e}})=>(0,codegen_1$8.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$8._)`{limit: ${e}}`},def$d={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:error$7,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,util_1$b.alwaysValidSchema)(n,t)&&(s?(0,additionalItems_1$1.validateAdditionalItems)(e,s):e.ok((0,code_1$4.validateArray)(e)))}};items2020.default=def$d;var contains={};Object.defineProperty(contains,"__esModule",{value:!0});const codegen_1$7=codegen,util_1$a=util,error$6={message:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7.str)`must contain at least ${e} valid item(s)`:(0,codegen_1$7.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7._)`{minContains: ${e}}`:(0,codegen_1$7._)`{minContains: ${e}, maxContains: ${t}}`},def$c={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:error$6,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,c;const{minContains:u,maxContains:l}=n;o.opts.next?(i=u===void 0?1:u,c=l):i=1;const p=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:i,max:c}),c===void 0&&i===0){(0,util_1$a.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(c!==void 0&&i>c){(0,util_1$a.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(o,r)){let C=(0,codegen_1$7._)`${p} >= ${i}`;c!==void 0&&(C=(0,codegen_1$7._)`${C} && ${p} <= ${c}`),e.pass(C);return}o.items=!0;const f=t.name("valid");c===void 0&&i===1?P(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),c!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,b)):(t.let(f,!1),b()),e.result(f,()=>e.reset());function b(){const C=t.name("_valid"),$=t.let("count",0);P(C,()=>t.if(C,()=>E($)))}function P(C,$){t.forRange("i",0,p,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},C),$()})}function E(C){t.code((0,codegen_1$7._)`${C}++`),c===void 0?t.if((0,codegen_1$7._)`${C} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,codegen_1$7._)`${C} > ${c}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,codegen_1$7._)`${C} >= ${i}`,()=>t.assign(f,!0)))}}};contains.default=def$c;var dependencies={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=codegen,r=util,n=code;e.error={message:({params:{property:u,depsCount:l,deps:p}})=>{const f=l===1?"property":"properties";return(0,t.str)`must have ${f} ${p} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:p,missingProperty:f}})=>(0,t._)`{property: ${u},
|
|
670
|
-
missingProperty: ${
|
|
671
|
-
depsCount: ${
|
|
672
|
-
deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[l,p]=o(u);i(u,l),c(u,p)}};function o({schema:u}){const l={},p={};for(const f in u){if(f==="__proto__")continue;const b=Array.isArray(u[f])?l:p;b[f]=u[f]}return[l,p]}function i(u,l=u.schema){const{gen:p,data:f,it:b}=u;if(Object.keys(l).length===0)return;const P=p.let("missing");for(const E in l){const C=l[E];if(C.length===0)continue;const $=(0,n.propertyInData)(p,f,E,b.opts.ownProperties);u.setParams({property:E,depsCount:C.length,deps:C.join(", ")}),b.allErrors?p.if($,()=>{for(const _ of C)(0,n.checkReportMissingProp)(u,_)}):(p.if((0,t._)`${$} && (${(0,n.checkMissingProp)(u,C,P)})`),(0,n.reportMissingProp)(u,P),p.else())}}e.validatePropertyDeps=i;function c(u,l=u.schema){const{gen:p,data:f,keyword:b,it:P}=u,E=p.name("valid");for(const C in l)(0,r.alwaysValidSchema)(P,l[C])||(p.if((0,n.propertyInData)(p,f,C,P.opts.ownProperties),()=>{const $=u.subschema({keyword:b,schemaProp:C},E);u.mergeValidEvaluated($,E)},()=>p.var(E,!0)),u.ok(E))}e.validateSchemaDeps=c,e.default=s})(dependencies);var propertyNames={};Object.defineProperty(propertyNames,"__esModule",{value:!0});const codegen_1$6=codegen,util_1$9=util,error$5={message:"property name must be valid",params:({params:e})=>(0,codegen_1$6._)`{propertyName: ${e.propertyName}}`},def$b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:error$5,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,util_1$9.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,codegen_1$6.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};propertyNames.default=def$b;var additionalProperties={};Object.defineProperty(additionalProperties,"__esModule",{value:!0});const code_1$3=code,codegen_1$5=codegen,names_1=names$1,util_1$8=util,error$4={message:"must NOT have additional properties",params:({params:e})=>(0,codegen_1$5._)`{additionalProperty: ${e.additionalProperty}}`},def$a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:error$4,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:c,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(i,r))return;const l=(0,code_1$3.allSchemaProperties)(n.properties),p=(0,code_1$3.allSchemaProperties)(n.patternProperties);f(),e.ok((0,codegen_1$5._)`${o} === ${names_1.default.errors}`);function f(){t.forIn("key",s,$=>{!l.length&&!p.length?E($):t.if(b($),()=>E($))})}function b($){let _;if(l.length>8){const y=(0,util_1$8.schemaRefOrVal)(i,n.properties,"properties");_=(0,code_1$3.isOwnProperty)(t,y,$)}else l.length?_=(0,codegen_1$5.or)(...l.map(y=>(0,codegen_1$5._)`${$} === ${y}`)):_=codegen_1$5.nil;return p.length&&(_=(0,codegen_1$5.or)(_,...p.map(y=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,y)}.test(${$})`))),(0,codegen_1$5.not)(_)}function P($){t.code((0,codegen_1$5._)`delete ${s}[${$}]`)}function E($){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){P($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),c||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(i,r)){const _=t.name("valid");u.removeAdditional==="failing"?(C($,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),P($)})):(C($,_),c||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function C($,_,y){const S={keyword:"additionalProperties",dataProp:$,dataPropType:util_1$8.Type.Str};y===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,_)}}};additionalProperties.default=def$a;var properties$1={};Object.defineProperty(properties$1,"__esModule",{value:!0});const validate_1=validate,code_1$2=code,util_1$7=util,additionalProperties_1$1=additionalProperties,def$9={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(o,additionalProperties_1$1.default,"additionalProperties"));const i=(0,code_1$2.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(i),o.props));const c=i.filter(f=>!(0,util_1$7.alwaysValidSchema)(o,r[f]));if(c.length===0)return;const u=t.name("valid");for(const f of c)l(f)?p(f):(t.if((0,code_1$2.propertyInData)(t,s,f,o.opts.ownProperties)),p(f),o.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function l(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function p(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};properties$1.default=def$9;var patternProperties={};Object.defineProperty(patternProperties,"__esModule",{value:!0});const code_1$1=code,codegen_1$4=codegen,util_1$6=util,util_2=util,def$8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,c=(0,code_1$1.allSchemaProperties)(r),u=c.filter(C=>(0,util_1$6.alwaysValidSchema)(o,r[C]));if(c.length===0||u.length===c.length&&(!o.opts.unevaluated||o.props===!0))return;const l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,p=t.name("valid");o.props!==!0&&!(o.props instanceof codegen_1$4.Name)&&(o.props=(0,util_2.evaluatedPropsToName)(t,o.props));const{props:f}=o;b();function b(){for(const C of c)l&&P(C),o.allErrors?E(C):(t.var(p,!0),E(C),t.if(p))}function P(C){for(const $ in l)new RegExp(C).test($)&&(0,util_1$6.checkStrictMode)(o,`property ${$} matches pattern ${C} (use allowMatchingProperties)`)}function E(C){t.forIn("key",n,$=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,C)}.test(${$})`,()=>{const _=u.includes(C);_||e.subschema({keyword:"patternProperties",schemaProp:C,dataProp:$,dataPropType:util_2.Type.Str},p),o.opts.unevaluated&&f!==!0?t.assign((0,codegen_1$4._)`${f}[${$}]`,!0):!_&&!o.allErrors&&t.if((0,codegen_1$4.not)(p),()=>t.break())})})}}};patternProperties.default=def$8;var not={};Object.defineProperty(not,"__esModule",{value:!0});const util_1$5=util,def$7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,util_1$5.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};not.default=def$7;var anyOf={};Object.defineProperty(anyOf,"__esModule",{value:!0});const code_1=code,def$6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:code_1.validateUnion,error:{message:"must match a schema in anyOf"}};anyOf.default=def$6;var oneOf={};Object.defineProperty(oneOf,"__esModule",{value:!0});const codegen_1$3=codegen,util_1$4=util,error$3={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,codegen_1$3._)`{passingSchemas: ${e.passing}}`},def$5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:error$3,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((p,f)=>{let b;(0,util_1$4.alwaysValidSchema)(s,p)?t.var(u,!0):b=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,codegen_1$3._)`${u} && ${i}`).assign(i,!1).assign(c,(0,codegen_1$3._)`[${c}, ${f}]`).else(),t.if(u,()=>{t.assign(i,!0),t.assign(c,f),b&&e.mergeEvaluated(b,codegen_1$3.Name)})})}}};oneOf.default=def$5;var allOf={};Object.defineProperty(allOf,"__esModule",{value:!0});const util_1$3=util,def$4={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,util_1$3.alwaysValidSchema)(n,o))return;const c=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(c)})}};allOf.default=def$4;var _if={};Object.defineProperty(_if,"__esModule",{value:!0});const codegen_1$2=codegen,util_1$2=util,error$2={message:({params:e})=>(0,codegen_1$2.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,codegen_1$2._)`{failingKeyword: ${e.ifClause}}`},def$3={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:error$2,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,util_1$2.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=hasSchema(n,"then"),o=hasSchema(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),c=t.name("_valid");if(u(),e.reset(),s&&o){const p=t.let("ifClause");e.setParams({ifClause:p}),t.if(c,l("then",p),l("else",p))}else s?t.if(c,l("then")):t.if((0,codegen_1$2.not)(c),l("else"));e.pass(i,()=>e.error(!0));function u(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(p)}function l(p,f){return()=>{const b=e.subschema({keyword:p},c);t.assign(i,c),e.mergeValidEvaluated(b,i),f?t.assign(f,(0,codegen_1$2._)`${p}`):e.setParams({ifClause:p})}}}};function hasSchema(e,t){const r=e.schema[t];return r!==void 0&&!(0,util_1$2.alwaysValidSchema)(e,r)}_if.default=def$3;var thenElse={};Object.defineProperty(thenElse,"__esModule",{value:!0});const util_1$1=util,def$2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,util_1$1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};thenElse.default=def$2;Object.defineProperty(applicator,"__esModule",{value:!0});const additionalItems_1=additionalItems,prefixItems_1=prefixItems,items_1=items,items2020_1=items2020,contains_1=contains,dependencies_1=dependencies,propertyNames_1=propertyNames,additionalProperties_1=additionalProperties,properties_1=properties$1,patternProperties_1=patternProperties,not_1=not,anyOf_1=anyOf,oneOf_1=oneOf,allOf_1=allOf,if_1=_if,thenElse_1=thenElse;function getApplicator(e=!1){const t=[not_1.default,anyOf_1.default,oneOf_1.default,allOf_1.default,if_1.default,thenElse_1.default,propertyNames_1.default,additionalProperties_1.default,dependencies_1.default,properties_1.default,patternProperties_1.default];return e?t.push(prefixItems_1.default,items2020_1.default):t.push(additionalItems_1.default,items_1.default),t.push(contains_1.default),t}applicator.default=getApplicator;var format$2={},format$1={};Object.defineProperty(format$1,"__esModule",{value:!0});const codegen_1$1=codegen,error$1={message:({schemaCode:e})=>(0,codegen_1$1.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,codegen_1$1._)`{format: ${e}}`},def$1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:error$1,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:c}=e,{opts:u,errSchemaPath:l,schemaEnv:p,self:f}=c;if(!u.validateFormats)return;s?b():P();function b(){const E=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),C=r.const("fDef",(0,codegen_1$1._)`${E}[${i}]`),$=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign($,(0,codegen_1$1._)`${C}.type || "string"`).assign(_,(0,codegen_1$1._)`${C}.validate`),()=>r.assign($,(0,codegen_1$1._)`"string"`).assign(_,C)),e.fail$data((0,codegen_1$1.or)(y(),S()));function y(){return u.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${i} && !${_}`}function S(){const I=p.$async?(0,codegen_1$1._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,D=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${$} === ${t} && !${D}`}}function P(){const E=f.formats[o];if(!E){y();return}if(E===!0)return;const[C,$,_]=S(E);C===t&&e.pass(I());function y(){if(u.strictSchema===!1){f.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function S(D){const w=D instanceof RegExp?(0,codegen_1$1.regexpCode)(D):u.code.formats?(0,codegen_1$1._)`${u.code.formats}${(0,codegen_1$1.getProperty)(o)}`:void 0,O=r.scopeValue("formats",{key:o,ref:D,code:w});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,codegen_1$1._)`${O}.validate`]:["string",D,O]}function I(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!p.$async)throw new Error("async format in sync schema");return(0,codegen_1$1._)`await ${_}(${n})`}return typeof $=="function"?(0,codegen_1$1._)`${_}(${n})`:(0,codegen_1$1._)`${_}.test(${n})`}}}};format$1.default=def$1;Object.defineProperty(format$2,"__esModule",{value:!0});const format_1$1=format$1,format=[format_1$1.default];format$2.default=format;var metadata={};Object.defineProperty(metadata,"__esModule",{value:!0});metadata.contentVocabulary=metadata.metadataVocabulary=void 0;metadata.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];metadata.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(draft7,"__esModule",{value:!0});const core_1=core$1,validation_1=validation$1,applicator_1=applicator,format_1=format$2,metadata_1=metadata,draft7Vocabularies=[core_1.default,validation_1.default,(0,applicator_1.default)(),format_1.default,metadata_1.metadataVocabulary,metadata_1.contentVocabulary];draft7.default=draft7Vocabularies;var discriminator={},types={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(types);Object.defineProperty(discriminator,"__esModule",{value:!0});const codegen_1=codegen,types_1=types,compile_1=compile,util_1=util,error={message:({params:{discrError:e,tagName:t}})=>e===types_1.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,codegen_1._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},def={keyword:"discriminator",type:"object",schemaType:"object",error,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=n.propertyName;if(typeof c!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const u=t.let("valid",!1),l=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(c)}`);t.if((0,codegen_1._)`typeof ${l} == "string"`,()=>p(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:l,tagName:c})),e.ok(u);function p(){const P=b();t.if(!1);for(const E in P)t.elseIf((0,codegen_1._)`${l} === ${E}`),t.assign(u,f(P[E]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:l,tagName:c}),t.endIf()}function f(P){const E=t.name("valid"),C=e.subschema({keyword:"oneOf",schemaProp:P},E);return e.mergeEvaluated(C,codegen_1.Name),E}function b(){var P;const E={},C=_(s);let $=!0;for(let I=0;I<i.length;I++){let D=i[I];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));const w=(P=D==null?void 0:D.properties)===null||P===void 0?void 0:P[c];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);$=$&&(C||_(D)),y(w,I)}if(!$)throw new Error(`discriminator: "${c}" must be required`);return E;function _({required:I}){return Array.isArray(I)&&I.includes(c)}function y(I,D){if(I.const)S(I.const,D);else if(I.enum)for(const w of I.enum)S(w,D);else throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`)}function S(I,D){if(typeof I!="string"||I in E)throw new Error(`discriminator: "${c}" values must be unique strings`);E[I]=D}}}};discriminator.default=def;const $schema$1="http://json-schema.org/draft-07/schema#",$id="http://json-schema.org/draft-07/schema#",title="Core schema meta-schema",definitions$1={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type=["object","boolean"],properties={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},require$$3={$schema:$schema$1,$id,title,definitions:definitions$1,type,properties,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=core$2,n=draft7,s=discriminator,o=require$$3,i=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(E=>this.addVocabulary(E)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const E=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(E,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var l=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var p=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var f=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var b=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return b.default}})})(ajv$1,ajv$1.exports);var ajvExports=ajv$1.exports;const Ajv=getDefaultExportFromCjs(ajvExports),$schema="http://json-schema.org/schema",$ref="#/definitions/Blueprint",definitions={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",enum:["kitchen-sink","light"]},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants in wp-config.php. Possible values are:
|
|
630
|
+
${s}`)}}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const Uo=()=>{};class Vo extends cn{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class zo extends cn{constructor(t,r){super(r),this.resource=t}get name(){return Tr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${di(this.resource.slug)}`}}class Wo extends cn{constructor(t,r){super(r),this.resource=t}get name(){return Tr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${di(this.resource.slug)}`}}function di(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class fi extends yt{constructor(t){super(),this.resource=t}async resolve(){return this.resource.resolve()}async setPlayground(t){return this.resource.setPlayground(t)}get progress(){return this.resource.progress}set progress(t){this.resource.progress=t}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class Ho extends fi{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class xo extends fi{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var Gr={exports:{}},pi={},Je={},ut={},Ht={},X={},Vt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(m){if(super(),!e.IDENTIFIER.test(m))throw new Error("CodeGen: name must be a valid identifier");this.str=m}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(m){super(),this._items=typeof m=="string"?[m]:m}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const m=this._items[0];return m===""||m==='""'}get str(){var m;return(m=this._str)!==null&&m!==void 0?m:this._str=this._items.reduce((_,R)=>`${_}${R}`,"")}get names(){var m;return(m=this._names)!==null&&m!==void 0?m:this._names=this._items.reduce((_,R)=>(R instanceof r&&(_[R.str]=(_[R.str]||0)+1),_),{})}}e._Code=n,e.nil=new n("");function s(g,...m){const _=[g[0]];let R=0;for(;R<m.length;)o(_,m[R]),_.push(g[++R]);return new n(_)}e._=s;const i=new n("+");function c(g,...m){const _=[w(g[0])];let R=0;for(;R<m.length;)_.push(i),o(_,m[R]),_.push(i,w(g[++R]));return u(_),new n(_)}e.str=c;function o(g,m){m instanceof n?g.push(...m._items):m instanceof r?g.push(m):g.push(p(m))}e.addCodeArg=o;function u(g){let m=1;for(;m<g.length-1;){if(g[m]===i){const _=d(g[m-1],g[m+1]);if(_!==void 0){g.splice(m-1,3,_);continue}g[m++]="+"}m++}}function d(g,m){if(m==='""')return g;if(g==='""')return m;if(typeof g=="string")return m instanceof r||g[g.length-1]!=='"'?void 0:typeof m!="string"?`${g.slice(0,-1)}${m}"`:m[0]==='"'?g.slice(0,-1)+m.slice(1):void 0;if(typeof m=="string"&&m[0]==='"'&&!(g instanceof r))return`"${g}${m.slice(1)}`}function f(g,m){return m.emptyStr()?g:g.emptyStr()?m:c`${g}${m}`}e.strConcat=f;function p(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:w(Array.isArray(g)?g.join(","):g)}function v(g){return new n(w(g))}e.stringify=v;function w(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function b(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):s`[${g}]`}e.getProperty=b;function T(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=T;function S(g){return new n(g.toString())}e.regexpCode=S})(Vt);var Kr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Vt;class r extends Error{constructor(d){super(`CodeGen: "code" for ${d} not defined`),this.value=d.value}}var n;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:d,parent:f}={}){this._names={},this._prefixes=d,this._parent=f}toName(d){return d instanceof t.Name?d:this.name(d)}name(d){return new t.Name(this._newName(d))}_newName(d){const f=this._names[d]||this._nameGroup(d);return`${d}${f.index++}`}_nameGroup(d){var f,p;if(!((p=(f=this._parent)===null||f===void 0?void 0:f._prefixes)===null||p===void 0)&&p.has(d)||this._prefixes&&!this._prefixes.has(d))throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);return this._names[d]={prefix:d,index:0}}}e.Scope=s;class i extends t.Name{constructor(d,f){super(f),this.prefix=d}setValue(d,{property:f,itemIndex:p}){this.value=d,this.scopePath=(0,t._)`.${new t.Name(f)}[${p}]`}}e.ValueScopeName=i;const c=(0,t._)`\n`;class o extends s{constructor(d){super(d),this._values={},this._scope=d.scope,this.opts={...d,_n:d.lines?c:t.nil}}get(){return this._scope}name(d){return new i(d,this._newName(d))}value(d,f){var p;if(f.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const v=this.toName(d),{prefix:w}=v,b=(p=f.key)!==null&&p!==void 0?p:f.ref;let T=this._values[w];if(T){const m=T.get(b);if(m)return m}else T=this._values[w]=new Map;T.set(b,v);const S=this._scope[w]||(this._scope[w]=[]),g=S.length;return S[g]=f.ref,v.setValue(f,{property:w,itemIndex:g}),v}getValue(d,f){const p=this._values[d];if(p)return p.get(f)}scopeRefs(d,f=this._values){return this._reduceValues(f,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,t._)`${d}${p.scopePath}`})}scopeCode(d=this._values,f,p){return this._reduceValues(d,v=>{if(v.value===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return v.value.code},f,p)}_reduceValues(d,f,p={},v){let w=t.nil;for(const b in d){const T=d[b];if(!T)continue;const S=p[b]=p[b]||new Map;T.forEach(g=>{if(S.has(g))return;S.set(g,n.Started);let m=f(g);if(m){const _=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,t._)`${w}${_} ${g} = ${m};${this.opts._n}`}else if(m=v==null?void 0:v(g))w=(0,t._)`${w}${m}${this.opts._n}`;else throw new r(g);S.set(g,n.Completed)})}return w}}e.ValueScope=o})(Kr);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Vt,r=Kr;var n=Vt;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Kr;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(a,y){return this}}class c extends i{constructor(a,y,A){super(),this.varKind=a,this.name=y,this.rhs=A}render({es5:a,_n:y}){const A=a?r.varKinds.var:this.varKind,V=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${V};`+y}optimizeNames(a,y){if(a[this.name.str])return this.rhs&&(this.rhs=re(this.rhs,a,y)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class o extends i{constructor(a,y,A){super(),this.lhs=a,this.rhs=y,this.sideEffects=A}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,y){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=re(this.rhs,a,y),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ie(a,this.rhs)}}class u extends o{constructor(a,y,A,V){super(a,A,V),this.op=y}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class d extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class f extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class p extends i{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class v extends i{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,y){return this.code=re(this.code,a,y),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((y,A)=>y+A.render(a),"")}optimizeNodes(){const{nodes:a}=this;let y=a.length;for(;y--;){const A=a[y].optimizeNodes();Array.isArray(A)?a.splice(y,1,...A):A?a[y]=A:a.splice(y,1)}return a.length>0?this:void 0}optimizeNames(a,y){const{nodes:A}=this;let V=A.length;for(;V--;){const z=A[V];z.optimizeNames(a,y)||(je(a,z.names),A.splice(V,1))}return A.length>0?this:void 0}get names(){return this.nodes.reduce((a,y)=>Q(a,y.names),{})}}class b extends w{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class T extends w{}class S extends b{}S.kind="else";class g extends b{constructor(a,y){super(y),this.condition=a}render(a){let y=`if(${this.condition})`+super.render(a);return this.else&&(y+="else "+this.else.render(a)),y}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let y=this.else;if(y){const A=y.optimizeNodes();y=this.else=Array.isArray(A)?new S(A):A}if(y)return a===!1?y instanceof g?y:y.nodes:this.nodes.length?this:new g(qe(a),y instanceof g?[y]:y.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,y){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(a,y),!!(super.optimizeNames(a,y)||this.else))return this.condition=re(this.condition,a,y),this}get names(){const a=super.names;return ie(a,this.condition),this.else&&Q(a,this.else.names),a}}g.kind="if";class m extends b{}m.kind="for";class _ extends m{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,y){if(super.optimizeNames(a,y))return this.iteration=re(this.iteration,a,y),this}get names(){return Q(super.names,this.iteration.names)}}class R extends m{constructor(a,y,A,V){super(),this.varKind=a,this.name=y,this.from=A,this.to=V}render(a){const y=a.es5?r.varKinds.var:this.varKind,{name:A,from:V,to:z}=this;return`for(${y} ${A}=${V}; ${A}<${z}; ${A}++)`+super.render(a)}get names(){const a=ie(super.names,this.from);return ie(a,this.to)}}class D extends m{constructor(a,y,A,V){super(),this.loop=a,this.varKind=y,this.name=A,this.iterable=V}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,y){if(super.optimizeNames(a,y))return this.iterable=re(this.iterable,a,y),this}get names(){return Q(super.names,this.iterable.names)}}class E extends b{constructor(a,y,A){super(),this.name=a,this.args=y,this.async=A}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}E.kind="func";class C extends w{render(a){return"return "+super.render(a)}}C.kind="return";class L extends b{render(a){let y="try"+super.render(a);return this.catch&&(y+=this.catch.render(a)),this.finally&&(y+=this.finally.render(a)),y}optimizeNodes(){var a,y;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(y=this.finally)===null||y===void 0||y.optimizeNodes(),this}optimizeNames(a,y){var A,V;return super.optimizeNames(a,y),(A=this.catch)===null||A===void 0||A.optimizeNames(a,y),(V=this.finally)===null||V===void 0||V.optimizeNames(a,y),this}get names(){const a=super.names;return this.catch&&Q(a,this.catch.names),this.finally&&Q(a,this.finally.names),a}}class W extends b{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}W.kind="catch";class G extends b{render(a){return"finally"+super.render(a)}}G.kind="finally";class te{constructor(a,y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...y,_n:y.lines?`
|
|
631
|
+
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new T]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,y){const A=this._extScope.value(a,y);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(a,y){return this._extScope.getValue(a,y)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,y,A,V){const z=this._scope.toName(y);return A!==void 0&&V&&(this._constants[z.str]=A),this._leafNode(new c(a,z,A)),z}const(a,y,A){return this._def(r.varKinds.const,a,y,A)}let(a,y,A){return this._def(r.varKinds.let,a,y,A)}var(a,y,A){return this._def(r.varKinds.var,a,y,A)}assign(a,y,A){return this._leafNode(new o(a,y,A))}add(a,y){return this._leafNode(new u(a,e.operators.ADD,y))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new v(a)),this}object(...a){const y=["{"];for(const[A,V]of a)y.length>1&&y.push(","),y.push(A),(A!==V||this.opts.es5)&&(y.push(":"),(0,t.addCodeArg)(y,V));return y.push("}"),new t._Code(y)}if(a,y,A){if(this._blockNode(new g(a)),y&&A)this.code(y).else().code(A).endIf();else if(y)this.code(y).endIf();else if(A)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new g(a))}else(){return this._elseNode(new S)}endIf(){return this._endBlockNode(g,S)}_for(a,y){return this._blockNode(a),y&&this.code(y).endFor(),this}for(a,y){return this._for(new _(a),y)}forRange(a,y,A,V,z=this.opts.es5?r.varKinds.var:r.varKinds.let){const Y=this._scope.toName(a);return this._for(new R(z,Y,y,A),()=>V(Y))}forOf(a,y,A,V=r.varKinds.const){const z=this._scope.toName(a);if(this.opts.es5){const Y=y instanceof t.Name?y:this.var("_arr",y);return this.forRange("_i",0,(0,t._)`${Y}.length`,Z=>{this.var(z,(0,t._)`${Y}[${Z}]`),A(z)})}return this._for(new D("of",V,z,y),()=>A(z))}forIn(a,y,A,V=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${y})`,A);const z=this._scope.toName(a);return this._for(new D("in",V,z,y),()=>A(z))}endFor(){return this._endBlockNode(m)}label(a){return this._leafNode(new d(a))}break(a){return this._leafNode(new f(a))}return(a){const y=new C;if(this._blockNode(y),this.code(a),y.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(a,y,A){if(!y&&!A)throw new Error('CodeGen: "try" without "catch" and "finally"');const V=new L;if(this._blockNode(V),this.code(a),y){const z=this.name("e");this._currNode=V.catch=new W(z),y(z)}return A&&(this._currNode=V.finally=new G,this.code(A)),this._endBlockNode(W,G)}throw(a){return this._leafNode(new p(a))}block(a,y){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(y),this}endBlock(a){const y=this._blockStarts.pop();if(y===void 0)throw new Error("CodeGen: not in self-balancing block");const A=this._nodes.length-y;if(A<0||a!==void 0&&A!==a)throw new Error(`CodeGen: wrong number of nodes: ${A} vs ${a} expected`);return this._nodes.length=y,this}func(a,y=t.nil,A,V){return this._blockNode(new E(a,y,A)),V&&this.code(V).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,y){const A=this._currNode;if(A instanceof a||y&&A instanceof y)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${y?`${a.kind}/${y.kind}`:a.kind}"`)}_elseNode(a){const y=this._currNode;if(!(y instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=y.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const y=this._nodes;y[y.length-1]=a}}e.CodeGen=te;function Q(N,a){for(const y in a)N[y]=(N[y]||0)+(a[y]||0);return N}function ie(N,a){return a instanceof t._CodeOrName?Q(N,a.names):N}function re(N,a,y){if(N instanceof t.Name)return A(N);if(!V(N))return N;return new t._Code(N._items.reduce((z,Y)=>(Y instanceof t.Name&&(Y=A(Y)),Y instanceof t._Code?z.push(...Y._items):z.push(Y),z),[]));function A(z){const Y=y[z.str];return Y===void 0||a[z.str]!==1?z:(delete a[z.str],Y)}function V(z){return z instanceof t._Code&&z._items.some(Y=>Y instanceof t.Name&&a[Y.str]===1&&y[Y.str]!==void 0)}}function je(N,a){for(const y in a)N[y]=(N[y]||0)-(a[y]||0)}function qe(N){return typeof N=="boolean"||typeof N=="number"||N===null?!N:(0,t._)`!${F(N)}`}e.not=qe;const Ge=k(e.operators.AND);function st(...N){return N.reduce(Ge)}e.and=st;const Xe=k(e.operators.OR);function U(...N){return N.reduce(Xe)}e.or=U;function k(N){return(a,y)=>a===t.nil?y:y===t.nil?a:(0,t._)`${F(a)} ${N} ${F(y)}`}function F(N){return N instanceof t.Name?N:(0,t._)`(${N})`}})(X);var se={};(function(e){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;const t=X,r=Vt;function n(E){const C={};for(const L of E)C[L]=!0;return C}e.toHash=n;function s(E,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(i(E,C),!c(C,E.self.RULES.all))}e.alwaysValidSchema=s;function i(E,C=E.schema){const{opts:L,self:W}=E;if(!L.strictSchema||typeof C=="boolean")return;const G=W.RULES.keywords;for(const te in C)G[te]||D(E,`unknown keyword: "${te}"`)}e.checkUnknownRules=i;function c(E,C){if(typeof E=="boolean")return!E;for(const L in E)if(C[L])return!0;return!1}e.schemaHasRules=c;function o(E,C){if(typeof E=="boolean")return!E;for(const L in E)if(L!=="$ref"&&C.all[L])return!0;return!1}e.schemaHasRulesButRef=o;function u({topSchemaRef:E,schemaPath:C},L,W,G){if(!G){if(typeof L=="number"||typeof L=="boolean")return L;if(typeof L=="string")return(0,t._)`${L}`}return(0,t._)`${E}${C}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=u;function d(E){return v(decodeURIComponent(E))}e.unescapeFragment=d;function f(E){return encodeURIComponent(p(E))}e.escapeFragment=f;function p(E){return typeof E=="number"?`${E}`:E.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function v(E){return E.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=v;function w(E,C){if(Array.isArray(E))for(const L of E)C(L);else C(E)}e.eachItem=w;function b({mergeNames:E,mergeToName:C,mergeValues:L,resultToName:W}){return(G,te,Q,ie)=>{const re=Q===void 0?te:Q instanceof t.Name?(te instanceof t.Name?E(G,te,Q):C(G,te,Q),Q):te instanceof t.Name?(C(G,Q,te),te):L(te,Q);return ie===t.Name&&!(re instanceof t.Name)?W(G,re):re}}e.mergeEvaluated={props:b({mergeNames:(E,C,L)=>E.if((0,t._)`${L} !== true && ${C} !== undefined`,()=>{E.if((0,t._)`${C} === true`,()=>E.assign(L,!0),()=>E.assign(L,(0,t._)`${L} || {}`).code((0,t._)`Object.assign(${L}, ${C})`))}),mergeToName:(E,C,L)=>E.if((0,t._)`${L} !== true`,()=>{C===!0?E.assign(L,!0):(E.assign(L,(0,t._)`${L} || {}`),S(E,L,C))}),mergeValues:(E,C)=>E===!0?!0:{...E,...C},resultToName:T}),items:b({mergeNames:(E,C,L)=>E.if((0,t._)`${L} !== true && ${C} !== undefined`,()=>E.assign(L,(0,t._)`${C} === true ? true : ${L} > ${C} ? ${L} : ${C}`)),mergeToName:(E,C,L)=>E.if((0,t._)`${L} !== true`,()=>E.assign(L,C===!0?!0:(0,t._)`${L} > ${C} ? ${L} : ${C}`)),mergeValues:(E,C)=>E===!0?!0:Math.max(E,C),resultToName:(E,C)=>E.var("items",C)})};function T(E,C){if(C===!0)return E.var("props",!0);const L=E.var("props",(0,t._)`{}`);return C!==void 0&&S(E,L,C),L}e.evaluatedPropsToName=T;function S(E,C,L){Object.keys(L).forEach(W=>E.assign((0,t._)`${C}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=S;const g={};function m(E,C){return E.scopeValue("func",{ref:C,code:g[C.code]||(g[C.code]=new r._Code(C.code))})}e.useFunc=m;var _;(function(E){E[E.Num=0]="Num",E[E.Str=1]="Str"})(_=e.Type||(e.Type={}));function R(E,C,L){if(E instanceof t.Name){const W=C===_.Num;return L?W?(0,t._)`"[" + ${E} + "]"`:(0,t._)`"['" + ${E} + "']"`:W?(0,t._)`"/" + ${E}`:(0,t._)`"/" + ${E}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return L?(0,t.getProperty)(E).toString():"/"+p(E)}e.getErrorPath=R;function D(E,C,L=E.opts.strictSchema){if(L){if(C=`strict mode: ${C}`,L===!0)throw new Error(C);E.self.logger.warn(C)}}e.checkStrictMode=D})(se);var Zt={},ls;function nt(){if(ls)return Zt;ls=1,Object.defineProperty(Zt,"__esModule",{value:!0});const e=X,t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Zt.default=t,Zt}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=X,r=se,n=nt();e.keywordError={message:({keyword:S})=>(0,t.str)`must pass "${S}" keyword validation`},e.keyword$DataError={message:({keyword:S,schemaType:g})=>g?(0,t.str)`"${S}" keyword must be ${g} ($data)`:(0,t.str)`"${S}" keyword is invalid ($data)`};function s(S,g=e.keywordError,m,_){const{it:R}=S,{gen:D,compositeRule:E,allErrors:C}=R,L=p(S,g,m);_??(E||C)?u(D,L):d(R,(0,t._)`[${L}]`)}e.reportError=s;function i(S,g=e.keywordError,m){const{it:_}=S,{gen:R,compositeRule:D,allErrors:E}=_,C=p(S,g,m);u(R,C),D||E||d(_,n.default.vErrors)}e.reportExtraError=i;function c(S,g){S.assign(n.default.errors,g),S.if((0,t._)`${n.default.vErrors} !== null`,()=>S.if(g,()=>S.assign((0,t._)`${n.default.vErrors}.length`,g),()=>S.assign(n.default.vErrors,null)))}e.resetErrorsCount=c;function o({gen:S,keyword:g,schemaValue:m,data:_,errsCount:R,it:D}){if(R===void 0)throw new Error("ajv implementation error");const E=S.name("err");S.forRange("i",R,n.default.errors,C=>{S.const(E,(0,t._)`${n.default.vErrors}[${C}]`),S.if((0,t._)`${E}.instancePath === undefined`,()=>S.assign((0,t._)`${E}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),S.assign((0,t._)`${E}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${g}`),D.opts.verbose&&(S.assign((0,t._)`${E}.schema`,m),S.assign((0,t._)`${E}.data`,_))})}e.extendErrors=o;function u(S,g){const m=S.const("err",g);S.if((0,t._)`${n.default.vErrors} === null`,()=>S.assign(n.default.vErrors,(0,t._)`[${m}]`),(0,t._)`${n.default.vErrors}.push(${m})`),S.code((0,t._)`${n.default.errors}++`)}function d(S,g){const{gen:m,validateName:_,schemaEnv:R}=S;R.$async?m.throw((0,t._)`new ${S.ValidationError}(${g})`):(m.assign((0,t._)`${_}.errors`,g),m.return(!1))}const f={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(S,g,m){const{createErrors:_}=S.it;return _===!1?(0,t._)`{}`:v(S,g,m)}function v(S,g,m={}){const{gen:_,it:R}=S,D=[w(R,m),b(S,m)];return T(S,g,D),_.object(...D)}function w({errorPath:S},{instancePath:g}){const m=g?(0,t.str)`${S}${(0,r.getErrorPath)(g,r.Type.Str)}`:S;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,m)]}function b({keyword:S,it:{errSchemaPath:g}},{schemaPath:m,parentSchema:_}){let R=_?g:(0,t.str)`${g}/${S}`;return m&&(R=(0,t.str)`${R}${(0,r.getErrorPath)(m,r.Type.Str)}`),[f.schemaPath,R]}function T(S,{params:g,message:m},_){const{keyword:R,data:D,schemaValue:E,it:C}=S,{opts:L,propertyName:W,topSchemaRef:G,schemaPath:te}=C;_.push([f.keyword,R],[f.params,typeof g=="function"?g(S):g||(0,t._)`{}`]),L.messages&&_.push([f.message,typeof m=="function"?m(S):m]),L.verbose&&_.push([f.schema,E],[f.parentSchema,(0,t._)`${G}${te}`],[n.default.data,D]),W&&_.push([f.propertyName,W])}})(Ht);var ds;function Bo(){if(ds)return ut;ds=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.boolOrEmptySchema=ut.topBoolOrEmptySchema=void 0;const e=Ht,t=X,r=nt(),n={message:"boolean schema is false"};function s(o){const{gen:u,schema:d,validateName:f}=o;d===!1?c(o,!1):typeof d=="object"&&d.$async===!0?u.return(r.default.data):(u.assign((0,t._)`${f}.errors`,null),u.return(!0))}ut.topBoolOrEmptySchema=s;function i(o,u){const{gen:d,schema:f}=o;f===!1?(d.var(u,!1),c(o)):d.var(u,!0)}ut.boolOrEmptySchema=i;function c(o,u){const{gen:d,data:f}=o,p={gen:d,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,e.reportError)(p,n,void 0,u)}return ut}var zt={},ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.getRules=ht.isJSONType=void 0;const Go=["string","number","integer","boolean","null","object","array"],Ko=new Set(Go);function Jo(e){return typeof e=="string"&&Ko.has(e)}ht.isJSONType=Jo;function Qo(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ht.getRules=Qo;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.shouldUseRule=Ze.shouldUseGroup=Ze.schemaHasRulesForType=void 0;function Yo({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&hi(e,n)}Ze.schemaHasRulesForType=Yo;function hi(e,t){return t.rules.some(r=>mi(e,r))}Ze.shouldUseGroup=hi;function mi(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Ze.shouldUseRule=mi;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=ht,r=Ze,n=Ht,s=X,i=se;var c;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(c=e.DataType||(e.DataType={}));function o(_){const R=u(_.type);if(R.includes("null")){if(_.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!R.length&&_.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');_.nullable===!0&&R.push("null")}return R}e.getSchemaTypes=o;function u(_){const R=Array.isArray(_)?_:_?[_]:[];if(R.every(t.isJSONType))return R;throw new Error("type must be JSONType or JSONType[]: "+R.join(","))}e.getJSONTypes=u;function d(_,R){const{gen:D,data:E,opts:C}=_,L=p(R,C.coerceTypes),W=R.length>0&&!(L.length===0&&R.length===1&&(0,r.schemaHasRulesForType)(_,R[0]));if(W){const G=T(R,E,C.strictNumbers,c.Wrong);D.if(G,()=>{L.length?v(_,R,L):g(_)})}return W}e.coerceAndCheckDataType=d;const f=new Set(["string","number","integer","boolean","null"]);function p(_,R){return R?_.filter(D=>f.has(D)||R==="array"&&D==="array"):[]}function v(_,R,D){const{gen:E,data:C,opts:L}=_,W=E.let("dataType",(0,s._)`typeof ${C}`),G=E.let("coerced",(0,s._)`undefined`);L.coerceTypes==="array"&&E.if((0,s._)`${W} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>E.assign(C,(0,s._)`${C}[0]`).assign(W,(0,s._)`typeof ${C}`).if(T(R,C,L.strictNumbers),()=>E.assign(G,C))),E.if((0,s._)`${G} !== undefined`);for(const Q of D)(f.has(Q)||Q==="array"&&L.coerceTypes==="array")&&te(Q);E.else(),g(_),E.endIf(),E.if((0,s._)`${G} !== undefined`,()=>{E.assign(C,G),w(_,G)});function te(Q){switch(Q){case"string":E.elseIf((0,s._)`${W} == "number" || ${W} == "boolean"`).assign(G,(0,s._)`"" + ${C}`).elseIf((0,s._)`${C} === null`).assign(G,(0,s._)`""`);return;case"number":E.elseIf((0,s._)`${W} == "boolean" || ${C} === null
|
|
632
|
+
|| (${W} == "string" && ${C} && ${C} == +${C})`).assign(G,(0,s._)`+${C}`);return;case"integer":E.elseIf((0,s._)`${W} === "boolean" || ${C} === null
|
|
633
|
+
|| (${W} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(G,(0,s._)`+${C}`);return;case"boolean":E.elseIf((0,s._)`${C} === "false" || ${C} === 0 || ${C} === null`).assign(G,!1).elseIf((0,s._)`${C} === "true" || ${C} === 1`).assign(G,!0);return;case"null":E.elseIf((0,s._)`${C} === "" || ${C} === 0 || ${C} === false`),E.assign(G,null);return;case"array":E.elseIf((0,s._)`${W} === "string" || ${W} === "number"
|
|
634
|
+
|| ${W} === "boolean" || ${C} === null`).assign(G,(0,s._)`[${C}]`)}}}function w({gen:_,parentData:R,parentDataProperty:D},E){_.if((0,s._)`${R} !== undefined`,()=>_.assign((0,s._)`${R}[${D}]`,E))}function b(_,R,D,E=c.Correct){const C=E===c.Correct?s.operators.EQ:s.operators.NEQ;let L;switch(_){case"null":return(0,s._)`${R} ${C} null`;case"array":L=(0,s._)`Array.isArray(${R})`;break;case"object":L=(0,s._)`${R} && typeof ${R} == "object" && !Array.isArray(${R})`;break;case"integer":L=W((0,s._)`!(${R} % 1) && !isNaN(${R})`);break;case"number":L=W();break;default:return(0,s._)`typeof ${R} ${C} ${_}`}return E===c.Correct?L:(0,s.not)(L);function W(G=s.nil){return(0,s.and)((0,s._)`typeof ${R} == "number"`,G,D?(0,s._)`isFinite(${R})`:s.nil)}}e.checkDataType=b;function T(_,R,D,E){if(_.length===1)return b(_[0],R,D,E);let C;const L=(0,i.toHash)(_);if(L.array&&L.object){const W=(0,s._)`typeof ${R} != "object"`;C=L.null?W:(0,s._)`!${R} || ${W}`,delete L.null,delete L.array,delete L.object}else C=s.nil;L.number&&delete L.integer;for(const W in L)C=(0,s.and)(C,b(W,R,D,E));return C}e.checkDataTypes=T;const S={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:R})=>typeof _=="string"?(0,s._)`{type: ${_}}`:(0,s._)`{type: ${R}}`};function g(_){const R=m(_);(0,n.reportError)(R,S)}e.reportTypeError=g;function m(_){const{gen:R,data:D,schema:E}=_,C=(0,i.schemaRefOrVal)(_,E,"type");return{gen:R,keyword:"type",data:D,schema:E.type,schemaCode:C,schemaValue:C,parentSchema:E,params:{},it:_}}})(zt);var jt={},fs;function Zo(){if(fs)return jt;fs=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.assignDefaults=void 0;const e=X,t=se;function r(s,i){const{properties:c,items:o}=s.schema;if(i==="object"&&c)for(const u in c)n(s,u,c[u].default);else i==="array"&&Array.isArray(o)&&o.forEach((u,d)=>n(s,d,u.default))}jt.assignDefaults=r;function n(s,i,c){const{gen:o,compositeRule:u,data:d,opts:f}=s;if(c===void 0)return;const p=(0,e._)`${d}${(0,e.getProperty)(i)}`;if(u){(0,t.checkStrictMode)(s,`default is ignored for: ${p}`);return}let v=(0,e._)`${p} === undefined`;f.useDefaults==="empty"&&(v=(0,e._)`${v} || ${p} === null || ${p} === ""`),o.if(v,(0,e._)`${p} = ${(0,e.stringify)(c)}`)}return jt}var Ae={},oe={},ps;function Fe(){if(ps)return oe;ps=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.validateUnion=oe.validateArray=oe.usePattern=oe.callValidateCode=oe.schemaProperties=oe.allSchemaProperties=oe.noPropertyInData=oe.propertyInData=oe.isOwnProperty=oe.hasPropFunc=oe.reportMissingProp=oe.checkMissingProp=oe.checkReportMissingProp=void 0;const e=X,t=se,r=nt(),n=se;function s(m,_){const{gen:R,data:D,it:E}=m;R.if(f(R,D,_,E.opts.ownProperties),()=>{m.setParams({missingProperty:(0,e._)`${_}`},!0),m.error()})}oe.checkReportMissingProp=s;function i({gen:m,data:_,it:{opts:R}},D,E){return(0,e.or)(...D.map(C=>(0,e.and)(f(m,_,C,R.ownProperties),(0,e._)`${E} = ${C}`)))}oe.checkMissingProp=i;function c(m,_){m.setParams({missingProperty:_},!0),m.error()}oe.reportMissingProp=c;function o(m){return m.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}oe.hasPropFunc=o;function u(m,_,R){return(0,e._)`${o(m)}.call(${_}, ${R})`}oe.isOwnProperty=u;function d(m,_,R,D){const E=(0,e._)`${_}${(0,e.getProperty)(R)} !== undefined`;return D?(0,e._)`${E} && ${u(m,_,R)}`:E}oe.propertyInData=d;function f(m,_,R,D){const E=(0,e._)`${_}${(0,e.getProperty)(R)} === undefined`;return D?(0,e.or)(E,(0,e.not)(u(m,_,R))):E}oe.noPropertyInData=f;function p(m){return m?Object.keys(m).filter(_=>_!=="__proto__"):[]}oe.allSchemaProperties=p;function v(m,_){return p(_).filter(R=>!(0,t.alwaysValidSchema)(m,_[R]))}oe.schemaProperties=v;function w({schemaCode:m,data:_,it:{gen:R,topSchemaRef:D,schemaPath:E,errorPath:C},it:L},W,G,te){const Q=te?(0,e._)`${m}, ${_}, ${D}${E}`:_,ie=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,C)],[r.default.parentData,L.parentData],[r.default.parentDataProperty,L.parentDataProperty],[r.default.rootData,r.default.rootData]];L.opts.dynamicRef&&ie.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const re=(0,e._)`${Q}, ${R.object(...ie)}`;return G!==e.nil?(0,e._)`${W}.call(${G}, ${re})`:(0,e._)`${W}(${re})`}oe.callValidateCode=w;const b=(0,e._)`new RegExp`;function T({gen:m,it:{opts:_}},R){const D=_.unicodeRegExp?"u":"",{regExp:E}=_.code,C=E(R,D);return m.scopeValue("pattern",{key:C.toString(),ref:C,code:(0,e._)`${E.code==="new RegExp"?b:(0,n.useFunc)(m,E)}(${R}, ${D})`})}oe.usePattern=T;function S(m){const{gen:_,data:R,keyword:D,it:E}=m,C=_.name("valid");if(E.allErrors){const W=_.let("valid",!0);return L(()=>_.assign(W,!1)),W}return _.var(C,!0),L(()=>_.break()),C;function L(W){const G=_.const("len",(0,e._)`${R}.length`);_.forRange("i",0,G,te=>{m.subschema({keyword:D,dataProp:te,dataPropType:t.Type.Num},C),_.if((0,e.not)(C),W)})}}oe.validateArray=S;function g(m){const{gen:_,schema:R,keyword:D,it:E}=m;if(!Array.isArray(R))throw new Error("ajv implementation error");if(R.some(G=>(0,t.alwaysValidSchema)(E,G))&&!E.opts.unevaluated)return;const L=_.let("valid",!1),W=_.name("_valid");_.block(()=>R.forEach((G,te)=>{const Q=m.subschema({keyword:D,schemaProp:te,compositeRule:!0},W);_.assign(L,(0,e._)`${L} || ${W}`),m.mergeValidEvaluated(Q,W)||_.if((0,e.not)(L))})),m.result(L,()=>m.reset(),()=>m.error(!0))}return oe.validateUnion=g,oe}var hs;function Xo(){if(hs)return Ae;hs=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.validateKeywordUsage=Ae.validSchemaType=Ae.funcKeywordCode=Ae.macroKeywordCode=void 0;const e=X,t=nt(),r=Fe(),n=Ht;function s(v,w){const{gen:b,keyword:T,schema:S,parentSchema:g,it:m}=v,_=w.macro.call(m.self,S,g,m),R=d(b,T,_);m.opts.validateSchema!==!1&&m.self.validateSchema(_,!0);const D=b.name("valid");v.subschema({schema:_,schemaPath:e.nil,errSchemaPath:`${m.errSchemaPath}/${T}`,topSchemaRef:R,compositeRule:!0},D),v.pass(D,()=>v.error(!0))}Ae.macroKeywordCode=s;function i(v,w){var b;const{gen:T,keyword:S,schema:g,parentSchema:m,$data:_,it:R}=v;u(R,w);const D=!_&&w.compile?w.compile.call(R.self,g,m,R):w.validate,E=d(T,S,D),C=T.let("valid");v.block$data(C,L),v.ok((b=w.valid)!==null&&b!==void 0?b:C);function L(){if(w.errors===!1)te(),w.modifying&&c(v),Q(()=>v.error());else{const ie=w.async?W():G();w.modifying&&c(v),Q(()=>o(v,ie))}}function W(){const ie=T.let("ruleErrs",null);return T.try(()=>te((0,e._)`await `),re=>T.assign(C,!1).if((0,e._)`${re} instanceof ${R.ValidationError}`,()=>T.assign(ie,(0,e._)`${re}.errors`),()=>T.throw(re))),ie}function G(){const ie=(0,e._)`${E}.errors`;return T.assign(ie,null),te(e.nil),ie}function te(ie=w.async?(0,e._)`await `:e.nil){const re=R.opts.passContext?t.default.this:t.default.self,je=!("compile"in w&&!_||w.schema===!1);T.assign(C,(0,e._)`${ie}${(0,r.callValidateCode)(v,E,re,je)}`,w.modifying)}function Q(ie){var re;T.if((0,e.not)((re=w.valid)!==null&&re!==void 0?re:C),ie)}}Ae.funcKeywordCode=i;function c(v){const{gen:w,data:b,it:T}=v;w.if(T.parentData,()=>w.assign(b,(0,e._)`${T.parentData}[${T.parentDataProperty}]`))}function o(v,w){const{gen:b}=v;b.if((0,e._)`Array.isArray(${w})`,()=>{b.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${w} : ${t.default.vErrors}.concat(${w})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,n.extendErrors)(v)},()=>v.error())}function u({schemaEnv:v},w){if(w.async&&!v.$async)throw new Error("async keyword in sync schema")}function d(v,w,b){if(b===void 0)throw new Error(`keyword "${w}" failed to compile`);return v.scopeValue("keyword",typeof b=="function"?{ref:b}:{ref:b,code:(0,e.stringify)(b)})}function f(v,w,b=!1){return!w.length||w.some(T=>T==="array"?Array.isArray(v):T==="object"?v&&typeof v=="object"&&!Array.isArray(v):typeof v==T||b&&typeof v>"u")}Ae.validSchemaType=f;function p({schema:v,opts:w,self:b,errSchemaPath:T},S,g){if(Array.isArray(S.keyword)?!S.keyword.includes(g):S.keyword!==g)throw new Error("ajv implementation error");const m=S.dependencies;if(m!=null&&m.some(_=>!Object.prototype.hasOwnProperty.call(v,_)))throw new Error(`parent schema must have dependencies of ${g}: ${m.join(",")}`);if(S.validateSchema&&!S.validateSchema(v[g])){const R=`keyword "${g}" value is invalid at path "${T}": `+b.errorsText(S.validateSchema.errors);if(w.validateSchema==="log")b.logger.error(R);else throw new Error(R)}}return Ae.validateKeywordUsage=p,Ae}var Qe={},ms;function ea(){if(ms)return Qe;ms=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.extendSubschemaMode=Qe.extendSubschemaData=Qe.getSubschema=void 0;const e=X,t=se;function r(i,{keyword:c,schemaProp:o,schema:u,schemaPath:d,errSchemaPath:f,topSchemaRef:p}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){const v=i.schema[c];return o===void 0?{schema:v,schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${c}`}:{schema:v[o],schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(c)}${(0,e.getProperty)(o)}`,errSchemaPath:`${i.errSchemaPath}/${c}/${(0,t.escapeFragment)(o)}`}}if(u!==void 0){if(d===void 0||f===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:d,topSchemaRef:p,errSchemaPath:f}}throw new Error('either "keyword" or "schema" must be passed')}Qe.getSubschema=r;function n(i,c,{dataProp:o,dataPropType:u,data:d,dataTypes:f,propertyName:p}){if(d!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:v}=c;if(o!==void 0){const{errorPath:b,dataPathArr:T,opts:S}=c,g=v.let("data",(0,e._)`${c.data}${(0,e.getProperty)(o)}`,!0);w(g),i.errorPath=(0,e.str)`${b}${(0,t.getErrorPath)(o,u,S.jsPropertySyntax)}`,i.parentDataProperty=(0,e._)`${o}`,i.dataPathArr=[...T,i.parentDataProperty]}if(d!==void 0){const b=d instanceof e.Name?d:v.let("data",d,!0);w(b),p!==void 0&&(i.propertyName=p)}f&&(i.dataTypes=f);function w(b){i.data=b,i.dataLevel=c.dataLevel+1,i.dataTypes=[],c.definedProperties=new Set,i.parentData=c.data,i.dataNames=[...c.dataNames,b]}}Qe.extendSubschemaData=n;function s(i,{jtdDiscriminator:c,jtdMetadata:o,compositeRule:u,createErrors:d,allErrors:f}){u!==void 0&&(i.compositeRule=u),d!==void 0&&(i.createErrors=d),f!==void 0&&(i.allErrors=f),i.jtdDiscriminator=c,i.jtdMetadata=o}return Qe.extendSubschemaMode=s,Qe}var Ee={},yi=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var c=i[s];if(!e(t[c],r[c]))return!1}return!0}return t!==t&&r!==r},gi={exports:{}},rt=gi.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};ar(t,n,s,e,"",e)};rt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};rt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};rt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};rt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ar(e,t,r,n,s,i,c,o,u,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,c,o,u,d);for(var f in n){var p=n[f];if(Array.isArray(p)){if(f in rt.arrayKeywords)for(var v=0;v<p.length;v++)ar(e,t,r,p[v],s+"/"+f+"/"+v,i,s,f,n,v)}else if(f in rt.propsKeywords){if(p&&typeof p=="object")for(var w in p)ar(e,t,r,p[w],s+"/"+f+"/"+ta(w),i,s,f,n,w)}else(f in rt.keywords||e.allKeys&&!(f in rt.skipKeywords))&&ar(e,t,r,p,s+"/"+f,i,s,f,n)}r(n,s,i,c,o,u,d)}}function ta(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var ra=gi.exports;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getSchemaRefs=Ee.resolveUrl=Ee.normalizeId=Ee._getFullPath=Ee.getFullPath=Ee.inlineRef=void 0;const na=se,sa=yi,ia=ra,oa=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function aa(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Jr(e):t?$i(e)<=t:!1}Ee.inlineRef=aa;const ca=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Jr(e){for(const t in e){if(ca.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Jr)||typeof r=="object"&&Jr(r))return!0}return!1}function $i(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!oa.has(r)&&(typeof e[r]=="object"&&(0,na.eachItem)(e[r],n=>t+=$i(n)),t===1/0))return 1/0}return t}function _i(e,t="",r){r!==!1&&(t=Pt(t));const n=e.parse(t);return wi(e,n)}Ee.getFullPath=_i;function wi(e,t){return e.serialize(t).split("#")[0]+"#"}Ee._getFullPath=wi;const ua=/#\/?$/;function Pt(e){return e?e.replace(ua,""):""}Ee.normalizeId=Pt;function la(e,t,r){return r=Pt(r),e.resolve(t,r)}Ee.resolveUrl=la;const da=/^[a-z_][-a-z0-9._]*$/i;function fa(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Pt(e[r]||t),i={"":s},c=_i(n,s,!1),o={},u=new Set;return ia(e,{allKeys:!0},(p,v,w,b)=>{if(b===void 0)return;const T=c+v;let S=i[b];typeof p[r]=="string"&&(S=g.call(this,p[r])),m.call(this,p.$anchor),m.call(this,p.$dynamicAnchor),i[v]=S;function g(_){const R=this.opts.uriResolver.resolve;if(_=Pt(S?R(S,_):_),u.has(_))throw f(_);u.add(_);let D=this.refs[_];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?d(p,D.schema,_):_!==Pt(T)&&(_[0]==="#"?(d(p,o[_],_),o[_]=p):this.refs[_]=T),_}function m(_){if(typeof _=="string"){if(!da.test(_))throw new Error(`invalid anchor "${_}"`);g.call(this,`#${_}`)}}}),o;function d(p,v,w){if(v!==void 0&&!sa(p,v))throw f(w)}function f(p){return new Error(`reference "${p}" resolves to more than one schema`)}}Ee.getSchemaRefs=fa;var ys;function Or(){if(ys)return Je;ys=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.getData=Je.KeywordCxt=Je.validateFunctionCode=void 0;const e=Bo(),t=zt,r=Ze,n=zt,s=Zo(),i=Xo(),c=ea(),o=X,u=nt(),d=Ee,f=se,p=Ht;function v(P){if(D(P)&&(C(P),R(P))){S(P);return}w(P,()=>(0,e.topBoolOrEmptySchema)(P))}Je.validateFunctionCode=v;function w({gen:P,validateName:O,schema:M,schemaEnv:q,opts:H},K){H.code.es5?P.func(O,(0,o._)`${u.default.data}, ${u.default.valCxt}`,q.$async,()=>{P.code((0,o._)`"use strict"; ${m(M,H)}`),T(P,H),P.code(K)}):P.func(O,(0,o._)`${u.default.data}, ${b(H)}`,q.$async,()=>P.code(m(M,H)).code(K))}function b(P){return(0,o._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${P.dynamicRef?(0,o._)`, ${u.default.dynamicAnchors}={}`:o.nil}}={}`}function T(P,O){P.if(u.default.valCxt,()=>{P.var(u.default.instancePath,(0,o._)`${u.default.valCxt}.${u.default.instancePath}`),P.var(u.default.parentData,(0,o._)`${u.default.valCxt}.${u.default.parentData}`),P.var(u.default.parentDataProperty,(0,o._)`${u.default.valCxt}.${u.default.parentDataProperty}`),P.var(u.default.rootData,(0,o._)`${u.default.valCxt}.${u.default.rootData}`),O.dynamicRef&&P.var(u.default.dynamicAnchors,(0,o._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{P.var(u.default.instancePath,(0,o._)`""`),P.var(u.default.parentData,(0,o._)`undefined`),P.var(u.default.parentDataProperty,(0,o._)`undefined`),P.var(u.default.rootData,u.default.data),O.dynamicRef&&P.var(u.default.dynamicAnchors,(0,o._)`{}`)})}function S(P){const{schema:O,opts:M,gen:q}=P;w(P,()=>{M.$comment&&O.$comment&&ie(P),G(P),q.let(u.default.vErrors,null),q.let(u.default.errors,0),M.unevaluated&&g(P),L(P),re(P)})}function g(P){const{gen:O,validateName:M}=P;P.evaluated=O.const("evaluated",(0,o._)`${M}.evaluated`),O.if((0,o._)`${P.evaluated}.dynamicProps`,()=>O.assign((0,o._)`${P.evaluated}.props`,(0,o._)`undefined`)),O.if((0,o._)`${P.evaluated}.dynamicItems`,()=>O.assign((0,o._)`${P.evaluated}.items`,(0,o._)`undefined`))}function m(P,O){const M=typeof P=="object"&&P[O.schemaId];return M&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${M} */`:o.nil}function _(P,O){if(D(P)&&(C(P),R(P))){E(P,O);return}(0,e.boolOrEmptySchema)(P,O)}function R({schema:P,self:O}){if(typeof P=="boolean")return!P;for(const M in P)if(O.RULES.all[M])return!0;return!1}function D(P){return typeof P.schema!="boolean"}function E(P,O){const{schema:M,gen:q,opts:H}=P;H.$comment&&M.$comment&&ie(P),te(P),Q(P);const K=q.const("_errs",u.default.errors);L(P,K),q.var(O,(0,o._)`${K} === ${u.default.errors}`)}function C(P){(0,f.checkUnknownRules)(P),W(P)}function L(P,O){if(P.opts.jtd)return qe(P,[],!1,O);const M=(0,t.getSchemaTypes)(P.schema),q=(0,t.coerceAndCheckDataType)(P,M);qe(P,M,!q,O)}function W(P){const{schema:O,errSchemaPath:M,opts:q,self:H}=P;O.$ref&&q.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(O,H.RULES)&&H.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function G(P){const{schema:O,opts:M}=P;O.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,f.checkStrictMode)(P,"default is ignored in the schema root")}function te(P){const O=P.schema[P.opts.schemaId];O&&(P.baseId=(0,d.resolveUrl)(P.opts.uriResolver,P.baseId,O))}function Q(P){if(P.schema.$async&&!P.schemaEnv.$async)throw new Error("async schema in sync schema")}function ie({gen:P,schemaEnv:O,schema:M,errSchemaPath:q,opts:H}){const K=M.$comment;if(H.$comment===!0)P.code((0,o._)`${u.default.self}.logger.log(${K})`);else if(typeof H.$comment=="function"){const $e=(0,o.str)`${q}/$comment`,Se=P.scopeValue("root",{ref:O.root});P.code((0,o._)`${u.default.self}.opts.$comment(${K}, ${$e}, ${Se}.schema)`)}}function re(P){const{gen:O,schemaEnv:M,validateName:q,ValidationError:H,opts:K}=P;M.$async?O.if((0,o._)`${u.default.errors} === 0`,()=>O.return(u.default.data),()=>O.throw((0,o._)`new ${H}(${u.default.vErrors})`)):(O.assign((0,o._)`${q}.errors`,u.default.vErrors),K.unevaluated&&je(P),O.return((0,o._)`${u.default.errors} === 0`))}function je({gen:P,evaluated:O,props:M,items:q}){M instanceof o.Name&&P.assign((0,o._)`${O}.props`,M),q instanceof o.Name&&P.assign((0,o._)`${O}.items`,q)}function qe(P,O,M,q){const{gen:H,schema:K,data:$e,allErrors:Se,opts:we,self:ve}=P,{RULES:_e}=ve;if(K.$ref&&(we.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(K,_e))){H.block(()=>V(P,"$ref",_e.all.$ref.definition));return}we.jtd||st(P,O),H.block(()=>{for(const de of _e.rules)ke(de);ke(_e.post)});function ke(de){(0,r.shouldUseGroup)(K,de)&&(de.type?(H.if((0,n.checkDataType)(de.type,$e,we.strictNumbers)),Ge(P,de),O.length===1&&O[0]===de.type&&M&&(H.else(),(0,n.reportTypeError)(P)),H.endIf()):Ge(P,de),Se||H.if((0,o._)`${u.default.errors} === ${q||0}`))}}function Ge(P,O){const{gen:M,schema:q,opts:{useDefaults:H}}=P;H&&(0,s.assignDefaults)(P,O.type),M.block(()=>{for(const K of O.rules)(0,r.shouldUseRule)(q,K)&&V(P,K.keyword,K.definition,O.type)})}function st(P,O){P.schemaEnv.meta||!P.opts.strictTypes||(Xe(P,O),P.opts.allowUnionTypes||U(P,O),k(P,P.dataTypes))}function Xe(P,O){if(O.length){if(!P.dataTypes.length){P.dataTypes=O;return}O.forEach(M=>{N(P.dataTypes,M)||y(P,`type "${M}" not allowed by context "${P.dataTypes.join(",")}"`)}),a(P,O)}}function U(P,O){O.length>1&&!(O.length===2&&O.includes("null"))&&y(P,"use allowUnionTypes to allow union type keyword")}function k(P,O){const M=P.self.RULES.all;for(const q in M){const H=M[q];if(typeof H=="object"&&(0,r.shouldUseRule)(P.schema,H)){const{type:K}=H.definition;K.length&&!K.some($e=>F(O,$e))&&y(P,`missing type "${K.join(",")}" for keyword "${q}"`)}}}function F(P,O){return P.includes(O)||O==="number"&&P.includes("integer")}function N(P,O){return P.includes(O)||O==="integer"&&P.includes("number")}function a(P,O){const M=[];for(const q of P.dataTypes)N(O,q)?M.push(q):O.includes("integer")&&q==="number"&&M.push("integer");P.dataTypes=M}function y(P,O){const M=P.schemaEnv.baseId+P.errSchemaPath;O+=` at "${M}" (strictTypes)`,(0,f.checkStrictMode)(P,O,P.opts.strictTypes)}class A{constructor(O,M,q){if((0,i.validateKeywordUsage)(O,M,q),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=q,this.data=O.data,this.schema=O.schema[q],this.$data=M.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(O,this.schema,q,this.$data),this.schemaType=M.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=M,this.$data)this.schemaCode=O.gen.const("vSchema",Z(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${q} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=O.gen.const("_errs",u.default.errors))}result(O,M,q){this.failResult((0,o.not)(O),M,q)}failResult(O,M,q){this.gen.if(O),q?q():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,M){this.failResult((0,o.not)(O),void 0,M)}fail(O){if(O===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(O),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);const{schemaCode:M}=this;this.fail((0,o._)`${M} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,M,q){if(M){this.setParams(M),this._error(O,q),this.setParams({});return}this._error(O,q)}_error(O,M){(O?p.reportExtraError:p.reportError)(this,this.def.error,M)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(O){this.allErrors||this.gen.if(O)}setParams(O,M){M?Object.assign(this.params,O):this.params=O}block$data(O,M,q=o.nil){this.gen.block(()=>{this.check$data(O,q),M()})}check$data(O=o.nil,M=o.nil){if(!this.$data)return;const{gen:q,schemaCode:H,schemaType:K,def:$e}=this;q.if((0,o.or)((0,o._)`${H} === undefined`,M)),O!==o.nil&&q.assign(O,!0),(K.length||$e.validateSchema)&&(q.elseIf(this.invalid$data()),this.$dataError(),O!==o.nil&&q.assign(O,!1)),q.else()}invalid$data(){const{gen:O,schemaCode:M,schemaType:q,def:H,it:K}=this;return(0,o.or)($e(),Se());function $e(){if(q.length){if(!(M instanceof o.Name))throw new Error("ajv implementation error");const we=Array.isArray(q)?q:[q];return(0,o._)`${(0,n.checkDataTypes)(we,M,K.opts.strictNumbers,n.DataType.Wrong)}`}return o.nil}function Se(){if(H.validateSchema){const we=O.scopeValue("validate$data",{ref:H.validateSchema});return(0,o._)`!${we}(${M})`}return o.nil}}subschema(O,M){const q=(0,c.getSubschema)(this.it,O);(0,c.extendSubschemaData)(q,this.it,O),(0,c.extendSubschemaMode)(q,O);const H={...this.it,...q,items:void 0,props:void 0};return _(H,M),H}mergeEvaluated(O,M){const{it:q,gen:H}=this;q.opts.unevaluated&&(q.props!==!0&&O.props!==void 0&&(q.props=f.mergeEvaluated.props(H,O.props,q.props,M)),q.items!==!0&&O.items!==void 0&&(q.items=f.mergeEvaluated.items(H,O.items,q.items,M)))}mergeValidEvaluated(O,M){const{it:q,gen:H}=this;if(q.opts.unevaluated&&(q.props!==!0||q.items!==!0))return H.if(M,()=>this.mergeEvaluated(O,o.Name)),!0}}Je.KeywordCxt=A;function V(P,O,M,q){const H=new A(P,M,O);"code"in M?M.code(H,q):H.$data&&M.validate?(0,i.funcKeywordCode)(H,M):"macro"in M?(0,i.macroKeywordCode)(H,M):(M.compile||M.validate)&&(0,i.funcKeywordCode)(H,M)}const z=/^\/(?:[^~]|~0|~1)*$/,Y=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Z(P,{dataLevel:O,dataNames:M,dataPathArr:q}){let H,K;if(P==="")return u.default.rootData;if(P[0]==="/"){if(!z.test(P))throw new Error(`Invalid JSON-pointer: ${P}`);H=P,K=u.default.rootData}else{const ve=Y.exec(P);if(!ve)throw new Error(`Invalid JSON-pointer: ${P}`);const _e=+ve[1];if(H=ve[2],H==="#"){if(_e>=O)throw new Error(we("property/index",_e));return q[O-_e]}if(_e>O)throw new Error(we("data",_e));if(K=M[O-_e],!H)return K}let $e=K;const Se=H.split("/");for(const ve of Se)ve&&(K=(0,o._)`${K}${(0,o.getProperty)((0,f.unescapeJsonPointer)(ve))}`,$e=(0,o._)`${$e} && ${K}`);return $e;function we(ve,_e){return`Cannot access ${ve} ${_e} levels up, current level is ${O}`}}return Je.getData=Z,Je}var xt={};Object.defineProperty(xt,"__esModule",{value:!0});class pa extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}xt.default=pa;var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});const Fr=Ee;class ha extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Fr.resolveUrl)(t,r,n),this.missingSchema=(0,Fr.normalizeId)((0,Fr.getFullPath)(t,this.missingRef))}}Bt.default=ha;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.resolveSchema=Re.getCompilingSchema=Re.resolveRef=Re.compileSchema=Re.SchemaEnv=void 0;const De=X,ma=xt,lt=nt(),Le=Ee,gs=se,ya=Or();class Cr{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Le.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}Re.SchemaEnv=Cr;function un(e){const t=vi.call(this,e);if(t)return t;const r=(0,Le.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,c=new De.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let o;e.$async&&(o=c.scopeValue("Error",{ref:ma.default,code:(0,De._)`require("ajv/dist/runtime/validation_error").default`}));const u=c.scopeName("validate");e.validateName=u;const d={gen:c,allErrors:this.opts.allErrors,data:lt.default.data,parentData:lt.default.parentData,parentDataProperty:lt.default.parentDataProperty,dataNames:[lt.default.data],dataPathArr:[De.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:c.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,De.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:o,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:De.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,De._)`""`,opts:this.opts,self:this};let f;try{this._compilations.add(e),(0,ya.validateFunctionCode)(d),c.optimize(this.opts.code.optimize);const p=c.toString();f=`${c.scopeRefs(lt.default.scope)}return ${p}`,this.opts.code.process&&(f=this.opts.code.process(f,e));const w=new Function(`${lt.default.self}`,`${lt.default.scope}`,f)(this,this.scope.get());if(this.scope.value(u,{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:u,validateCode:p,scopeValues:c._values}),this.opts.unevaluated){const{props:b,items:T}=d;w.evaluated={props:b instanceof De.Name?void 0:b,items:T instanceof De.Name?void 0:T,dynamicProps:b instanceof De.Name,dynamicItems:T instanceof De.Name},w.source&&(w.source.evaluated=(0,De.stringify)(w.evaluated))}return e.validate=w,e}catch(p){throw delete e.validate,delete e.validateName,f&&this.logger.error("Error compiling schema, function code:",f),p}finally{this._compilations.delete(e)}}Re.compileSchema=un;function ga(e,t,r){var n;r=(0,Le.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=wa.call(this,e,r);if(i===void 0){const c=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:o}=this.opts;c&&(i=new Cr({schema:c,schemaId:o,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=$a.call(this,i)}Re.resolveRef=ga;function $a(e){return(0,Le.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:un.call(this,e)}function vi(e){for(const t of this._compilations)if(_a(t,e))return t}Re.getCompilingSchema=vi;function _a(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function wa(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Nr.call(this,e,t)}function Nr(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Le._getFullPath)(this.opts.uriResolver,r);let s=(0,Le.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return qr.call(this,r,e);const i=(0,Le.normalizeId)(n),c=this.refs[i]||this.schemas[i];if(typeof c=="string"){const o=Nr.call(this,e,c);return typeof(o==null?void 0:o.schema)!="object"?void 0:qr.call(this,r,o)}if(typeof(c==null?void 0:c.schema)=="object"){if(c.validate||un.call(this,c),i===(0,Le.normalizeId)(t)){const{schema:o}=c,{schemaId:u}=this.opts,d=o[u];return d&&(s=(0,Le.resolveUrl)(this.opts.uriResolver,s,d)),new Cr({schema:o,schemaId:u,root:e,baseId:s})}return qr.call(this,r,c)}}Re.resolveSchema=Nr;const va=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function qr(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const o of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const u=r[(0,gs.unescapeFragment)(o)];if(u===void 0)return;r=u;const d=typeof r=="object"&&r[this.opts.schemaId];!va.has(o)&&d&&(t=(0,Le.resolveUrl)(this.opts.uriResolver,t,d))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,gs.schemaHasRulesButRef)(r,this.RULES)){const o=(0,Le.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Nr.call(this,n,o)}const{schemaId:c}=this.opts;if(i=i||new Cr({schema:r,schemaId:c,root:n,baseId:t}),i.schema!==i.root.schema)return i}const ba="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Ea="Meta-schema for $data reference (JSON AnySchema extension proposal)",Pa="object",Sa=["$data"],Ta={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Ra=!1,ka={$id:ba,description:Ea,type:Pa,required:Sa,properties:Ta,additionalProperties:Ra};var ln={},Qr={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(r,n){n(t)})(Io,function(r){function n(){for(var h=arguments.length,l=Array(h),$=0;$<h;$++)l[$]=arguments[$];if(l.length>1){l[0]=l[0].slice(0,-1);for(var j=l.length-1,I=1;I<j;++I)l[I]=l[I].slice(1,-1);return l[j]=l[j].slice(1),l.join("")}else return l[0]}function s(h){return"(?:"+h+")"}function i(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function c(h){return h.toUpperCase()}function o(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function u(h,l){var $=h;if(l)for(var j in l)$[j]=l[j];return $}function d(h){var l="[A-Za-z]",$="[0-9]",j=n($,"[A-Fa-f]"),I=s(s("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+s("%[89A-Fa-f]"+j+"%"+j+j)+"|"+s("%"+j+j)),x="[\\:\\/\\?\\#\\[\\]\\@]",B="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ne=n(x,B),ce=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",fe=h?"[\\uE000-\\uF8FF]":"[]",ee=n(l,$,"[\\-\\.\\_\\~]",ce);s(l+n(l,$,"[\\+\\-\\.]")+"*"),s(s(I+"|"+n(ee,B,"[\\:]"))+"*");var ae=s(s("25[0-5]")+"|"+s("2[0-4]"+$)+"|"+s("1"+$+$)+"|"+s("0?[1-9]"+$)+"|0?0?"+$),pe=s(ae+"\\."+ae+"\\."+ae+"\\."+ae),J=s(j+"{1,4}"),ue=s(s(J+"\\:"+J)+"|"+pe),ye=s(s(J+"\\:")+"{6}"+ue),le=s("\\:\\:"+s(J+"\\:")+"{5}"+ue),et=s(s(J)+"?\\:\\:"+s(J+"\\:")+"{4}"+ue),Ve=s(s(s(J+"\\:")+"{0,1}"+J)+"?\\:\\:"+s(J+"\\:")+"{3}"+ue),ze=s(s(s(J+"\\:")+"{0,2}"+J)+"?\\:\\:"+s(J+"\\:")+"{2}"+ue),_t=s(s(s(J+"\\:")+"{0,3}"+J)+"?\\:\\:"+J+"\\:"+ue),at=s(s(s(J+"\\:")+"{0,4}"+J)+"?\\:\\:"+ue),Ce=s(s(s(J+"\\:")+"{0,5}"+J)+"?\\:\\:"+J),We=s(s(s(J+"\\:")+"{0,6}"+J)+"?\\:\\:"),ct=s([ye,le,et,Ve,ze,_t,at,Ce,We].join("|")),Ke=s(s(ee+"|"+I)+"+");s("[vV]"+j+"+\\."+n(ee,B,"[\\:]")+"+"),s(s(I+"|"+n(ee,B))+"*");var Nt=s(I+"|"+n(ee,B,"[\\:\\@]"));return s(s(I+"|"+n(ee,B,"[\\@]"))+"+"),s(s(Nt+"|"+n("[\\/\\?]",fe))+"*"),{NOT_SCHEME:new RegExp(n("[^]",l,$,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",ee,B),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",ee,B),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",ee,B),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",ee,B),"g"),NOT_QUERY:new RegExp(n("[^\\%]",ee,B,"[\\:\\@\\/\\?]",fe),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",ee,B,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",ee,B),"g"),UNRESERVED:new RegExp(ee,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",ee,ne),"g"),PCT_ENCODED:new RegExp(I,"g"),IPV4ADDRESS:new RegExp("^("+pe+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ct+")"+s(s("\\%25|\\%(?!"+j+"{2})")+"("+Ke+")")+"?\\]?$")}}var f=d(!1),p=d(!0),v=function(){function h(l,$){var j=[],I=!0,x=!1,B=void 0;try{for(var ne=l[Symbol.iterator](),ce;!(I=(ce=ne.next()).done)&&(j.push(ce.value),!($&&j.length===$));I=!0);}catch(fe){x=!0,B=fe}finally{try{!I&&ne.return&&ne.return()}finally{if(x)throw B}}return j}return function(l,$){if(Array.isArray(l))return l;if(Symbol.iterator in Object(l))return h(l,$);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),w=function(h){if(Array.isArray(h)){for(var l=0,$=Array(h.length);l<h.length;l++)$[l]=h[l];return $}else return Array.from(h)},b=2147483647,T=36,S=1,g=26,m=38,_=700,R=72,D=128,E="-",C=/^xn--/,L=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,G={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},te=T-S,Q=Math.floor,ie=String.fromCharCode;function re(h){throw new RangeError(G[h])}function je(h,l){for(var $=[],j=h.length;j--;)$[j]=l(h[j]);return $}function qe(h,l){var $=h.split("@"),j="";$.length>1&&(j=$[0]+"@",h=$[1]),h=h.replace(W,".");var I=h.split("."),x=je(I,l).join(".");return j+x}function Ge(h){for(var l=[],$=0,j=h.length;$<j;){var I=h.charCodeAt($++);if(I>=55296&&I<=56319&&$<j){var x=h.charCodeAt($++);(x&64512)==56320?l.push(((I&1023)<<10)+(x&1023)+65536):(l.push(I),$--)}else l.push(I)}return l}var st=function(l){return String.fromCodePoint.apply(String,w(l))},Xe=function(l){return l-48<10?l-22:l-65<26?l-65:l-97<26?l-97:T},U=function(l,$){return l+22+75*(l<26)-(($!=0)<<5)},k=function(l,$,j){var I=0;for(l=j?Q(l/_):l>>1,l+=Q(l/$);l>te*g>>1;I+=T)l=Q(l/te);return Q(I+(te+1)*l/(l+m))},F=function(l){var $=[],j=l.length,I=0,x=D,B=R,ne=l.lastIndexOf(E);ne<0&&(ne=0);for(var ce=0;ce<ne;++ce)l.charCodeAt(ce)>=128&&re("not-basic"),$.push(l.charCodeAt(ce));for(var fe=ne>0?ne+1:0;fe<j;){for(var ee=I,ae=1,pe=T;;pe+=T){fe>=j&&re("invalid-input");var J=Xe(l.charCodeAt(fe++));(J>=T||J>Q((b-I)/ae))&&re("overflow"),I+=J*ae;var ue=pe<=B?S:pe>=B+g?g:pe-B;if(J<ue)break;var ye=T-ue;ae>Q(b/ye)&&re("overflow"),ae*=ye}var le=$.length+1;B=k(I-ee,le,ee==0),Q(I/le)>b-x&&re("overflow"),x+=Q(I/le),I%=le,$.splice(I++,0,x)}return String.fromCodePoint.apply(String,$)},N=function(l){var $=[];l=Ge(l);var j=l.length,I=D,x=0,B=R,ne=!0,ce=!1,fe=void 0;try{for(var ee=l[Symbol.iterator](),ae;!(ne=(ae=ee.next()).done);ne=!0){var pe=ae.value;pe<128&&$.push(ie(pe))}}catch(It){ce=!0,fe=It}finally{try{!ne&&ee.return&&ee.return()}finally{if(ce)throw fe}}var J=$.length,ue=J;for(J&&$.push(E);ue<j;){var ye=b,le=!0,et=!1,Ve=void 0;try{for(var ze=l[Symbol.iterator](),_t;!(le=(_t=ze.next()).done);le=!0){var at=_t.value;at>=I&&at<ye&&(ye=at)}}catch(It){et=!0,Ve=It}finally{try{!le&&ze.return&&ze.return()}finally{if(et)throw Ve}}var Ce=ue+1;ye-I>Q((b-x)/Ce)&&re("overflow"),x+=(ye-I)*Ce,I=ye;var We=!0,ct=!1,Ke=void 0;try{for(var Nt=l[Symbol.iterator](),Zn;!(We=(Zn=Nt.next()).done);We=!0){var Xn=Zn.value;if(Xn<I&&++x>b&&re("overflow"),Xn==I){for(var Jt=x,Qt=T;;Qt+=T){var Yt=Qt<=B?S:Qt>=B+g?g:Qt-B;if(Jt<Yt)break;var es=Jt-Yt,ts=T-Yt;$.push(ie(U(Yt+es%ts,0))),Jt=Q(es/ts)}$.push(ie(U(Jt,0))),B=k(x,Ce,ue==J),x=0,++ue}}}catch(It){ct=!0,Ke=It}finally{try{!We&&Nt.return&&Nt.return()}finally{if(ct)throw Ke}}++x,++I}return $.join("")},a=function(l){return qe(l,function($){return C.test($)?F($.slice(4).toLowerCase()):$})},y=function(l){return qe(l,function($){return L.test($)?"xn--"+N($):$})},A={version:"2.1.0",ucs2:{decode:Ge,encode:st},decode:F,encode:N,toASCII:y,toUnicode:a},V={};function z(h){var l=h.charCodeAt(0),$=void 0;return l<16?$="%0"+l.toString(16).toUpperCase():l<128?$="%"+l.toString(16).toUpperCase():l<2048?$="%"+(l>>6|192).toString(16).toUpperCase()+"%"+(l&63|128).toString(16).toUpperCase():$="%"+(l>>12|224).toString(16).toUpperCase()+"%"+(l>>6&63|128).toString(16).toUpperCase()+"%"+(l&63|128).toString(16).toUpperCase(),$}function Y(h){for(var l="",$=0,j=h.length;$<j;){var I=parseInt(h.substr($+1,2),16);if(I<128)l+=String.fromCharCode(I),$+=3;else if(I>=194&&I<224){if(j-$>=6){var x=parseInt(h.substr($+4,2),16);l+=String.fromCharCode((I&31)<<6|x&63)}else l+=h.substr($,6);$+=6}else if(I>=224){if(j-$>=9){var B=parseInt(h.substr($+4,2),16),ne=parseInt(h.substr($+7,2),16);l+=String.fromCharCode((I&15)<<12|(B&63)<<6|ne&63)}else l+=h.substr($,9);$+=9}else l+=h.substr($,3),$+=3}return l}function Z(h,l){function $(j){var I=Y(j);return I.match(l.UNRESERVED)?I:j}return h.scheme&&(h.scheme=String(h.scheme).replace(l.PCT_ENCODED,$).toLowerCase().replace(l.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(l.PCT_ENCODED,$).replace(l.NOT_USERINFO,z).replace(l.PCT_ENCODED,c)),h.host!==void 0&&(h.host=String(h.host).replace(l.PCT_ENCODED,$).toLowerCase().replace(l.NOT_HOST,z).replace(l.PCT_ENCODED,c)),h.path!==void 0&&(h.path=String(h.path).replace(l.PCT_ENCODED,$).replace(h.scheme?l.NOT_PATH:l.NOT_PATH_NOSCHEME,z).replace(l.PCT_ENCODED,c)),h.query!==void 0&&(h.query=String(h.query).replace(l.PCT_ENCODED,$).replace(l.NOT_QUERY,z).replace(l.PCT_ENCODED,c)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(l.PCT_ENCODED,$).replace(l.NOT_FRAGMENT,z).replace(l.PCT_ENCODED,c)),h}function P(h){return h.replace(/^0*(.*)/,"$1")||"0"}function O(h,l){var $=h.match(l.IPV4ADDRESS)||[],j=v($,2),I=j[1];return I?I.split(".").map(P).join("."):h}function M(h,l){var $=h.match(l.IPV6ADDRESS)||[],j=v($,3),I=j[1],x=j[2];if(I){for(var B=I.toLowerCase().split("::").reverse(),ne=v(B,2),ce=ne[0],fe=ne[1],ee=fe?fe.split(":").map(P):[],ae=ce.split(":").map(P),pe=l.IPV4ADDRESS.test(ae[ae.length-1]),J=pe?7:8,ue=ae.length-J,ye=Array(J),le=0;le<J;++le)ye[le]=ee[le]||ae[ue+le]||"";pe&&(ye[J-1]=O(ye[J-1],l));var et=ye.reduce(function(Ce,We,ct){if(!We||We==="0"){var Ke=Ce[Ce.length-1];Ke&&Ke.index+Ke.length===ct?Ke.length++:Ce.push({index:ct,length:1})}return Ce},[]),Ve=et.sort(function(Ce,We){return We.length-Ce.length})[0],ze=void 0;if(Ve&&Ve.length>1){var _t=ye.slice(0,Ve.index),at=ye.slice(Ve.index+Ve.length);ze=_t.join(":")+"::"+at.join(":")}else ze=ye.join(":");return x&&(ze+="%"+x),ze}else return h}var q=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,H="".match(/(){0}/)[1]===void 0;function K(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},j=l.iri!==!1?p:f;l.reference==="suffix"&&(h=(l.scheme?l.scheme+":":"")+"//"+h);var I=h.match(q);if(I){H?($.scheme=I[1],$.userinfo=I[3],$.host=I[4],$.port=parseInt(I[5],10),$.path=I[6]||"",$.query=I[7],$.fragment=I[8],isNaN($.port)&&($.port=I[5])):($.scheme=I[1]||void 0,$.userinfo=h.indexOf("@")!==-1?I[3]:void 0,$.host=h.indexOf("//")!==-1?I[4]:void 0,$.port=parseInt(I[5],10),$.path=I[6]||"",$.query=h.indexOf("?")!==-1?I[7]:void 0,$.fragment=h.indexOf("#")!==-1?I[8]:void 0,isNaN($.port)&&($.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),$.host&&($.host=M(O($.host,j),j)),$.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0?$.reference="same-document":$.scheme===void 0?$.reference="relative":$.fragment===void 0?$.reference="absolute":$.reference="uri",l.reference&&l.reference!=="suffix"&&l.reference!==$.reference&&($.error=$.error||"URI is not a "+l.reference+" reference.");var x=V[(l.scheme||$.scheme||"").toLowerCase()];if(!l.unicodeSupport&&(!x||!x.unicodeSupport)){if($.host&&(l.domainHost||x&&x.domainHost))try{$.host=A.toASCII($.host.replace(j.PCT_ENCODED,Y).toLowerCase())}catch(B){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+B}Z($,f)}else Z($,j);x&&x.parse&&x.parse($,l)}else $.error=$.error||"URI can not be parsed.";return $}function $e(h,l){var $=l.iri!==!1?p:f,j=[];return h.userinfo!==void 0&&(j.push(h.userinfo),j.push("@")),h.host!==void 0&&j.push(M(O(String(h.host),$),$).replace($.IPV6ADDRESS,function(I,x,B){return"["+x+(B?"%25"+B:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(j.push(":"),j.push(String(h.port))),j.length?j.join(""):void 0}var Se=/^\.\.?\//,we=/^\/\.(\/|$)/,ve=/^\/\.\.(\/|$)/,_e=/^\/?(?:.|\n)*?(?=\/|$)/;function ke(h){for(var l=[];h.length;)if(h.match(Se))h=h.replace(Se,"");else if(h.match(we))h=h.replace(we,"/");else if(h.match(ve))h=h.replace(ve,"/"),l.pop();else if(h==="."||h==="..")h="";else{var $=h.match(_e);if($){var j=$[0];h=h.slice(j.length),l.push(j)}else throw new Error("Unexpected dot segment condition")}return l.join("")}function de(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=l.iri?p:f,j=[],I=V[(l.scheme||h.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize(h,l),h.host&&!$.IPV6ADDRESS.test(h.host)){if(l.domainHost||I&&I.domainHost)try{h.host=l.iri?A.toUnicode(h.host):A.toASCII(h.host.replace($.PCT_ENCODED,Y).toLowerCase())}catch(ne){h.error=h.error||"Host's domain name can not be converted to "+(l.iri?"Unicode":"ASCII")+" via punycode: "+ne}}Z(h,$),l.reference!=="suffix"&&h.scheme&&(j.push(h.scheme),j.push(":"));var x=$e(h,l);if(x!==void 0&&(l.reference!=="suffix"&&j.push("//"),j.push(x),h.path&&h.path.charAt(0)!=="/"&&j.push("/")),h.path!==void 0){var B=h.path;!l.absolutePath&&(!I||!I.absolutePath)&&(B=ke(B)),x===void 0&&(B=B.replace(/^\/\//,"/%2F")),j.push(B)}return h.query!==void 0&&(j.push("?"),j.push(h.query)),h.fragment!==void 0&&(j.push("#"),j.push(h.fragment)),j.join("")}function gt(h,l){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments[3],I={};return j||(h=K(de(h,$),$),l=K(de(l,$),$)),$=$||{},!$.tolerant&&l.scheme?(I.scheme=l.scheme,I.userinfo=l.userinfo,I.host=l.host,I.port=l.port,I.path=ke(l.path||""),I.query=l.query):(l.userinfo!==void 0||l.host!==void 0||l.port!==void 0?(I.userinfo=l.userinfo,I.host=l.host,I.port=l.port,I.path=ke(l.path||""),I.query=l.query):(l.path?(l.path.charAt(0)==="/"?I.path=ke(l.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?I.path="/"+l.path:h.path?I.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+l.path:I.path=l.path,I.path=ke(I.path)),I.query=l.query):(I.path=h.path,l.query!==void 0?I.query=l.query:I.query=h.query),I.userinfo=h.userinfo,I.host=h.host,I.port=h.port),I.scheme=h.scheme),I.fragment=l.fragment,I}function kt(h,l,$){var j=u({scheme:"null"},$);return de(gt(K(h,j),K(l,j),j,!0),j)}function it(h,l){return typeof h=="string"?h=de(K(h,l),l):i(h)==="object"&&(h=K(de(h,l),l)),h}function Ot(h,l,$){return typeof h=="string"?h=de(K(h,$),$):i(h)==="object"&&(h=de(h,$)),typeof l=="string"?l=de(K(l,$),$):i(l)==="object"&&(l=de(l,$)),h===l}function Kt(h,l){return h&&h.toString().replace(!l||!l.iri?f.ESCAPE:p.ESCAPE,z)}function Oe(h,l){return h&&h.toString().replace(!l||!l.iri?f.PCT_ENCODED:p.PCT_ENCODED,Y)}var ot={scheme:"http",domainHost:!0,parse:function(l,$){return l.host||(l.error=l.error||"HTTP URIs must have a host."),l},serialize:function(l,$){var j=String(l.scheme).toLowerCase()==="https";return(l.port===(j?443:80)||l.port==="")&&(l.port=void 0),l.path||(l.path="/"),l}},Hn={scheme:"https",domainHost:ot.domainHost,parse:ot.parse,serialize:ot.serialize};function xn(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var Ct={scheme:"ws",domainHost:!0,parse:function(l,$){var j=l;return j.secure=xn(j),j.resourceName=(j.path||"/")+(j.query?"?"+j.query:""),j.path=void 0,j.query=void 0,j},serialize:function(l,$){if((l.port===(xn(l)?443:80)||l.port==="")&&(l.port=void 0),typeof l.secure=="boolean"&&(l.scheme=l.secure?"wss":"ws",l.secure=void 0),l.resourceName){var j=l.resourceName.split("?"),I=v(j,2),x=I[0],B=I[1];l.path=x&&x!=="/"?x:void 0,l.query=B,l.resourceName=void 0}return l.fragment=void 0,l}},Bn={scheme:"wss",domainHost:Ct.domainHost,parse:Ct.parse,serialize:Ct.serialize},Wi={},Gn="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Ue="[0-9A-Fa-f]",Hi=s(s("%[EFef]"+Ue+"%"+Ue+Ue+"%"+Ue+Ue)+"|"+s("%[89A-Fa-f]"+Ue+"%"+Ue+Ue)+"|"+s("%"+Ue+Ue)),xi="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Bi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Gi=n(Bi,'[\\"\\\\]'),Ki="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ji=new RegExp(Gn,"g"),$t=new RegExp(Hi,"g"),Qi=new RegExp(n("[^]",xi,"[\\.]",'[\\"]',Gi),"g"),Kn=new RegExp(n("[^]",Gn,Ki),"g"),Yi=Kn;function jr(h){var l=Y(h);return l.match(Ji)?l:h}var Jn={scheme:"mailto",parse:function(l,$){var j=l,I=j.to=j.path?j.path.split(","):[];if(j.path=void 0,j.query){for(var x=!1,B={},ne=j.query.split("&"),ce=0,fe=ne.length;ce<fe;++ce){var ee=ne[ce].split("=");switch(ee[0]){case"to":for(var ae=ee[1].split(","),pe=0,J=ae.length;pe<J;++pe)I.push(ae[pe]);break;case"subject":j.subject=Oe(ee[1],$);break;case"body":j.body=Oe(ee[1],$);break;default:x=!0,B[Oe(ee[0],$)]=Oe(ee[1],$);break}}x&&(j.headers=B)}j.query=void 0;for(var ue=0,ye=I.length;ue<ye;++ue){var le=I[ue].split("@");if(le[0]=Oe(le[0]),$.unicodeSupport)le[1]=Oe(le[1],$).toLowerCase();else try{le[1]=A.toASCII(Oe(le[1],$).toLowerCase())}catch(et){j.error=j.error||"Email address's domain name can not be converted to ASCII via punycode: "+et}I[ue]=le.join("@")}return j},serialize:function(l,$){var j=l,I=o(l.to);if(I){for(var x=0,B=I.length;x<B;++x){var ne=String(I[x]),ce=ne.lastIndexOf("@"),fe=ne.slice(0,ce).replace($t,jr).replace($t,c).replace(Qi,z),ee=ne.slice(ce+1);try{ee=$.iri?A.toUnicode(ee):A.toASCII(Oe(ee,$).toLowerCase())}catch(ue){j.error=j.error||"Email address's domain name can not be converted to "+($.iri?"Unicode":"ASCII")+" via punycode: "+ue}I[x]=fe+"@"+ee}j.path=I.join(",")}var ae=l.headers=l.headers||{};l.subject&&(ae.subject=l.subject),l.body&&(ae.body=l.body);var pe=[];for(var J in ae)ae[J]!==Wi[J]&&pe.push(J.replace($t,jr).replace($t,c).replace(Kn,z)+"="+ae[J].replace($t,jr).replace($t,c).replace(Yi,z));return pe.length&&(j.query=pe.join("&")),j}},Zi=/^([^\:]+)\:(.*)/,Qn={scheme:"urn",parse:function(l,$){var j=l.path&&l.path.match(Zi),I=l;if(j){var x=$.scheme||I.scheme||"urn",B=j[1].toLowerCase(),ne=j[2],ce=x+":"+($.nid||B),fe=V[ce];I.nid=B,I.nss=ne,I.path=void 0,fe&&(I=fe.parse(I,$))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(l,$){var j=$.scheme||l.scheme||"urn",I=l.nid,x=j+":"+($.nid||I),B=V[x];B&&(l=B.serialize(l,$));var ne=l,ce=l.nss;return ne.path=(I||$.nid)+":"+ce,ne}},Xi=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Yn={scheme:"urn:uuid",parse:function(l,$){var j=l;return j.uuid=j.nss,j.nss=void 0,!$.tolerant&&(!j.uuid||!j.uuid.match(Xi))&&(j.error=j.error||"UUID is not valid."),j},serialize:function(l,$){var j=l;return j.nss=(l.uuid||"").toLowerCase(),j}};V[ot.scheme]=ot,V[Hn.scheme]=Hn,V[Ct.scheme]=Ct,V[Bn.scheme]=Bn,V[Jn.scheme]=Jn,V[Qn.scheme]=Qn,V[Yn.scheme]=Yn,r.SCHEMES=V,r.pctEncChar=z,r.pctDecChars=Y,r.parse=K,r.removeDotSegments=ke,r.serialize=de,r.resolveComponents=gt,r.resolve=kt,r.normalize=it,r.equal=Ot,r.escapeComponent=Kt,r.unescapeComponent=Oe,Object.defineProperty(r,"__esModule",{value:!0})})})(Qr,Qr.exports);var Oa=Qr.exports;Object.defineProperty(ln,"__esModule",{value:!0});const bi=Oa;bi.code='require("ajv/dist/runtime/uri").default';ln.default=bi;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Or();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=X;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=xt,s=Bt,i=ht,c=Re,o=X,u=Ee,d=zt,f=se,p=ka,v=ln,w=(U,k)=>new RegExp(U,k);w.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"],T=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),S={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},m=200;function _(U){var k,F,N,a,y,A,V,z,Y,Z,P,O,M,q,H,K,$e,Se,we,ve,_e,ke,de,gt,kt;const it=U.strict,Ot=(k=U.code)===null||k===void 0?void 0:k.optimize,Kt=Ot===!0||Ot===void 0?1:Ot||0,Oe=(N=(F=U.code)===null||F===void 0?void 0:F.regExp)!==null&&N!==void 0?N:w,ot=(a=U.uriResolver)!==null&&a!==void 0?a:v.default;return{strictSchema:(A=(y=U.strictSchema)!==null&&y!==void 0?y:it)!==null&&A!==void 0?A:!0,strictNumbers:(z=(V=U.strictNumbers)!==null&&V!==void 0?V:it)!==null&&z!==void 0?z:!0,strictTypes:(Z=(Y=U.strictTypes)!==null&&Y!==void 0?Y:it)!==null&&Z!==void 0?Z:"log",strictTuples:(O=(P=U.strictTuples)!==null&&P!==void 0?P:it)!==null&&O!==void 0?O:"log",strictRequired:(q=(M=U.strictRequired)!==null&&M!==void 0?M:it)!==null&&q!==void 0?q:!1,code:U.code?{...U.code,optimize:Kt,regExp:Oe}:{optimize:Kt,regExp:Oe},loopRequired:(H=U.loopRequired)!==null&&H!==void 0?H:m,loopEnum:(K=U.loopEnum)!==null&&K!==void 0?K:m,meta:($e=U.meta)!==null&&$e!==void 0?$e:!0,messages:(Se=U.messages)!==null&&Se!==void 0?Se:!0,inlineRefs:(we=U.inlineRefs)!==null&&we!==void 0?we:!0,schemaId:(ve=U.schemaId)!==null&&ve!==void 0?ve:"$id",addUsedSchema:(_e=U.addUsedSchema)!==null&&_e!==void 0?_e:!0,validateSchema:(ke=U.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(de=U.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(gt=U.unicodeRegExp)!==null&>!==void 0?gt:!0,int32range:(kt=U.int32range)!==null&&kt!==void 0?kt:!0,uriResolver:ot}}class R{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,..._(k)};const{es5:F,lines:N}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:T,es5:F,lines:N}),this.logger=Q(k.logger);const a=k.validateFormats;k.validateFormats=!1,this.RULES=(0,i.getRules)(),D.call(this,S,k,"NOT SUPPORTED"),D.call(this,g,k,"DEPRECATED","warn"),this._metaOpts=G.call(this),k.formats&&L.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&W.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),C.call(this),k.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:F,schemaId:N}=this.opts;let a=p;N==="id"&&(a={...p},a.id=a.$id,delete a.$id),F&&k&&this.addMetaSchema(a,a[N],!1)}defaultMeta(){const{meta:k,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[F]||k:void 0}validate(k,F){let N;if(typeof k=="string"){if(N=this.getSchema(k),!N)throw new Error(`no schema with key or ref "${k}"`)}else N=this.compile(k);const a=N(F);return"$async"in N||(this.errors=N.errors),a}compile(k,F){const N=this._addSchema(k,F);return N.validate||this._compileSchemaEnv(N)}compileAsync(k,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:N}=this.opts;return a.call(this,k,F);async function a(Z,P){await y.call(this,Z.$schema);const O=this._addSchema(Z,P);return O.validate||A.call(this,O)}async function y(Z){Z&&!this.getSchema(Z)&&await a.call(this,{$ref:Z},!0)}async function A(Z){try{return this._compileSchemaEnv(Z)}catch(P){if(!(P instanceof s.default))throw P;return V.call(this,P),await z.call(this,P.missingSchema),A.call(this,Z)}}function V({missingSchema:Z,missingRef:P}){if(this.refs[Z])throw new Error(`AnySchema ${Z} is loaded but ${P} cannot be resolved`)}async function z(Z){const P=await Y.call(this,Z);this.refs[Z]||await y.call(this,P.$schema),this.refs[Z]||this.addSchema(P,Z,F)}async function Y(Z){const P=this._loading[Z];if(P)return P;try{return await(this._loading[Z]=N(Z))}finally{delete this._loading[Z]}}}addSchema(k,F,N,a=this.opts.validateSchema){if(Array.isArray(k)){for(const A of k)this.addSchema(A,void 0,N,a);return this}let y;if(typeof k=="object"){const{schemaId:A}=this.opts;if(y=k[A],y!==void 0&&typeof y!="string")throw new Error(`schema ${A} must be string`)}return F=(0,u.normalizeId)(F||y),this._checkUnique(F),this.schemas[F]=this._addSchema(k,N,F,a,!0),this}addMetaSchema(k,F,N=this.opts.validateSchema){return this.addSchema(k,F,!0,N),this}validateSchema(k,F){if(typeof k=="boolean")return!0;let N;if(N=k.$schema,N!==void 0&&typeof N!="string")throw new Error("$schema must be a string");if(N=N||this.opts.defaultMeta||this.defaultMeta(),!N)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(N,k);if(!a&&F){const y="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(y);else throw new Error(y)}return a}getSchema(k){let F;for(;typeof(F=E.call(this,k))=="string";)k=F;if(F===void 0){const{schemaId:N}=this.opts,a=new c.SchemaEnv({schema:{},schemaId:N});if(F=c.resolveSchema.call(this,a,k),!F)return;this.refs[k]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=E.call(this,k);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const F=k;this._cache.delete(F);let N=k[this.opts.schemaId];return N&&(N=(0,u.normalizeId)(N),delete this.schemas[N],delete this.refs[N]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const F of k)this.addKeyword(F);return this}addKeyword(k,F){let N;if(typeof k=="string")N=k,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=N);else if(typeof k=="object"&&F===void 0){if(F=k,N=F.keyword,Array.isArray(N)&&!N.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(re.call(this,N,F),!F)return(0,f.eachItem)(N,y=>je.call(this,y)),this;Ge.call(this,F);const a={...F,type:(0,d.getJSONTypes)(F.type),schemaType:(0,d.getJSONTypes)(F.schemaType)};return(0,f.eachItem)(N,a.type.length===0?y=>je.call(this,y,a):y=>a.type.forEach(A=>je.call(this,y,a,A))),this}getKeyword(k){const F=this.RULES.all[k];return typeof F=="object"?F.definition:!!F}removeKeyword(k){const{RULES:F}=this;delete F.keywords[k],delete F.all[k];for(const N of F.rules){const a=N.rules.findIndex(y=>y.keyword===k);a>=0&&N.rules.splice(a,1)}return this}addFormat(k,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[k]=F,this}errorsText(k=this.errors,{separator:F=", ",dataVar:N="data"}={}){return!k||k.length===0?"No errors":k.map(a=>`${N}${a.instancePath} ${a.message}`).reduce((a,y)=>a+F+y)}$dataMetaSchema(k,F){const N=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const a of F){const y=a.split("/").slice(1);let A=k;for(const V of y)A=A[V];for(const V in N){const z=N[V];if(typeof z!="object")continue;const{$data:Y}=z.definition,Z=A[V];Y&&Z&&(A[V]=Xe(Z))}}return k}_removeAllSchemas(k,F){for(const N in k){const a=k[N];(!F||F.test(N))&&(typeof a=="string"?delete k[N]:a&&!a.meta&&(this._cache.delete(a.schema),delete k[N]))}}_addSchema(k,F,N,a=this.opts.validateSchema,y=this.opts.addUsedSchema){let A;const{schemaId:V}=this.opts;if(typeof k=="object")A=k[V];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let z=this._cache.get(k);if(z!==void 0)return z;N=(0,u.normalizeId)(A||N);const Y=u.getSchemaRefs.call(this,k,N);return z=new c.SchemaEnv({schema:k,schemaId:V,meta:F,baseId:N,localRefs:Y}),this._cache.set(z.schema,z),y&&!N.startsWith("#")&&(N&&this._checkUnique(N),this.refs[N]=z),a&&this.validateSchema(k,!0),z}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):c.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const F=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,k)}finally{this.opts=F}}}e.default=R,R.ValidationError=n.default,R.MissingRefError=s.default;function D(U,k,F,N="error"){for(const a in U){const y=a;y in k&&this.logger[N](`${F}: option ${a}. ${U[y]}`)}}function E(U){return U=(0,u.normalizeId)(U),this.schemas[U]||this.refs[U]}function C(){const U=this.opts.schemas;if(U)if(Array.isArray(U))this.addSchema(U);else for(const k in U)this.addSchema(U[k],k)}function L(){for(const U in this.opts.formats){const k=this.opts.formats[U];k&&this.addFormat(U,k)}}function W(U){if(Array.isArray(U)){this.addVocabulary(U);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in U){const F=U[k];F.keyword||(F.keyword=k),this.addKeyword(F)}}function G(){const U={...this.opts};for(const k of b)delete U[k];return U}const te={log(){},warn(){},error(){}};function Q(U){if(U===!1)return te;if(U===void 0)return console;if(U.log&&U.warn&&U.error)return U;throw new Error("logger must implement log, warn and error methods")}const ie=/^[a-z_$][a-z0-9_$:-]*$/i;function re(U,k){const{RULES:F}=this;if((0,f.eachItem)(U,N=>{if(F.keywords[N])throw new Error(`Keyword ${N} is already defined`);if(!ie.test(N))throw new Error(`Keyword ${N} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function je(U,k,F){var N;const a=k==null?void 0:k.post;if(F&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:y}=this;let A=a?y.post:y.rules.find(({type:z})=>z===F);if(A||(A={type:F,rules:[]},y.rules.push(A)),y.keywords[U]=!0,!k)return;const V={keyword:U,definition:{...k,type:(0,d.getJSONTypes)(k.type),schemaType:(0,d.getJSONTypes)(k.schemaType)}};k.before?qe.call(this,A,V,k.before):A.rules.push(V),y.all[U]=V,(N=k.implements)===null||N===void 0||N.forEach(z=>this.addKeyword(z))}function qe(U,k,F){const N=U.rules.findIndex(a=>a.keyword===F);N>=0?U.rules.splice(N,0,k):(U.rules.push(k),this.logger.warn(`rule ${F} is not defined`))}function Ge(U){let{metaSchema:k}=U;k!==void 0&&(U.$data&&this.opts.$data&&(k=Xe(k)),U.validateSchema=this.compile(k,!0))}const st={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xe(U){return{anyOf:[U,st]}}})(pi);var dn={},fn={},pn={};Object.defineProperty(pn,"__esModule",{value:!0});const Ca={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pn.default=Ca;var mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.callRef=mt.getValidate=void 0;const Na=Bt,$s=Fe(),Te=X,wt=nt(),_s=Re,Xt=se,Ia={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:c,opts:o,self:u}=n,{root:d}=i;if((r==="#"||r==="#/")&&s===d.baseId)return p();const f=_s.resolveRef.call(u,d,s,r);if(f===void 0)throw new Na.default(n.opts.uriResolver,s,r);if(f instanceof _s.SchemaEnv)return v(f);return w(f);function p(){if(i===d)return cr(e,c,i,i.$async);const b=t.scopeValue("root",{ref:d});return cr(e,(0,Te._)`${b}.validate`,d,d.$async)}function v(b){const T=Ei(e,b);cr(e,T,b,b.$async)}function w(b){const T=t.scopeValue("schema",o.code.source===!0?{ref:b,code:(0,Te.stringify)(b)}:{ref:b}),S=t.name("valid"),g=e.subschema({schema:b,dataTypes:[],schemaPath:Te.nil,topSchemaRef:T,errSchemaPath:r},S);e.mergeEvaluated(g),e.ok(S)}}};function Ei(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Te._)`${r.scopeValue("wrapper",{ref:t})}.validate`}mt.getValidate=Ei;function cr(e,t,r,n){const{gen:s,it:i}=e,{allErrors:c,schemaEnv:o,opts:u}=i,d=u.passContext?wt.default.this:Te.nil;n?f():p();function f(){if(!o.$async)throw new Error("async schema referenced by sync schema");const b=s.let("valid");s.try(()=>{s.code((0,Te._)`await ${(0,$s.callValidateCode)(e,t,d)}`),w(t),c||s.assign(b,!0)},T=>{s.if((0,Te._)`!(${T} instanceof ${i.ValidationError})`,()=>s.throw(T)),v(T),c||s.assign(b,!1)}),e.ok(b)}function p(){e.result((0,$s.callValidateCode)(e,t,d),()=>w(t),()=>v(t))}function v(b){const T=(0,Te._)`${b}.errors`;s.assign(wt.default.vErrors,(0,Te._)`${wt.default.vErrors} === null ? ${T} : ${wt.default.vErrors}.concat(${T})`),s.assign(wt.default.errors,(0,Te._)`${wt.default.vErrors}.length`)}function w(b){var T;if(!i.opts.unevaluated)return;const S=(T=r==null?void 0:r.validate)===null||T===void 0?void 0:T.evaluated;if(i.props!==!0)if(S&&!S.dynamicProps)S.props!==void 0&&(i.props=Xt.mergeEvaluated.props(s,S.props,i.props));else{const g=s.var("props",(0,Te._)`${b}.evaluated.props`);i.props=Xt.mergeEvaluated.props(s,g,i.props,Te.Name)}if(i.items!==!0)if(S&&!S.dynamicItems)S.items!==void 0&&(i.items=Xt.mergeEvaluated.items(s,S.items,i.items));else{const g=s.var("items",(0,Te._)`${b}.evaluated.items`);i.items=Xt.mergeEvaluated.items(s,g,i.items,Te.Name)}}}mt.callRef=cr;mt.default=Ia;Object.defineProperty(fn,"__esModule",{value:!0});const ja=pn,Aa=mt,Da=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",ja.default,Aa.default];fn.default=Da;var hn={},mn={};Object.defineProperty(mn,"__esModule",{value:!0});const gr=X,tt=gr.operators,$r={maximum:{okStr:"<=",ok:tt.LTE,fail:tt.GT},minimum:{okStr:">=",ok:tt.GTE,fail:tt.LT},exclusiveMaximum:{okStr:"<",ok:tt.LT,fail:tt.GTE},exclusiveMinimum:{okStr:">",ok:tt.GT,fail:tt.LTE}},Ma={message:({keyword:e,schemaCode:t})=>(0,gr.str)`must be ${$r[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,gr._)`{comparison: ${$r[e].okStr}, limit: ${t}}`},La={keyword:Object.keys($r),type:"number",schemaType:"number",$data:!0,error:Ma,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,gr._)`${r} ${$r[t].fail} ${n} || isNaN(${r})`)}};mn.default=La;var yn={};Object.defineProperty(yn,"__esModule",{value:!0});const Mt=X,Fa={message:({schemaCode:e})=>(0,Mt.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Mt._)`{multipleOf: ${e}}`},qa={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Fa,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,c=t.let("res"),o=i?(0,Mt._)`Math.abs(Math.round(${c}) - ${c}) > 1e-${i}`:(0,Mt._)`${c} !== parseInt(${c})`;e.fail$data((0,Mt._)`(${n} === 0 || (${c} = ${r}/${n}, ${o}))`)}};yn.default=qa;var gn={},$n={};Object.defineProperty($n,"__esModule",{value:!0});function Pi(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}$n.default=Pi;Pi.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(gn,"__esModule",{value:!0});const dt=X,Ua=se,Va=$n,za={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,dt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,dt._)`{limit: ${e}}`},Wa={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:za,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?dt.operators.GT:dt.operators.LT,c=s.opts.unicode===!1?(0,dt._)`${r}.length`:(0,dt._)`${(0,Ua.useFunc)(e.gen,Va.default)}(${r})`;e.fail$data((0,dt._)`${c} ${i} ${n}`)}};gn.default=Wa;var _n={};Object.defineProperty(_n,"__esModule",{value:!0});const Ha=Fe(),_r=X,xa={message:({schemaCode:e})=>(0,_r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,_r._)`{pattern: ${e}}`},Ba={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:xa,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:i}=e,c=i.opts.unicodeRegExp?"u":"",o=r?(0,_r._)`(new RegExp(${s}, ${c}))`:(0,Ha.usePattern)(e,n);e.fail$data((0,_r._)`!${o}.test(${t})`)}};_n.default=Ba;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});const Lt=X,Ga={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,Lt.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Lt._)`{limit: ${e}}`},Ka={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ga,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Lt.operators.GT:Lt.operators.LT;e.fail$data((0,Lt._)`Object.keys(${r}).length ${s} ${n}`)}};wn.default=Ka;var vn={};Object.defineProperty(vn,"__esModule",{value:!0});const At=Fe(),Ft=X,Ja=se,Qa={message:({params:{missingProperty:e}})=>(0,Ft.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ft._)`{missingProperty: ${e}}`},Ya={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Qa,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:c}=e,{opts:o}=c;if(!i&&r.length===0)return;const u=r.length>=o.loopRequired;if(c.allErrors?d():f(),o.strictRequired){const w=e.parentSchema.properties,{definedProperties:b}=e.it;for(const T of r)if((w==null?void 0:w[T])===void 0&&!b.has(T)){const S=c.schemaEnv.baseId+c.errSchemaPath,g=`required property "${T}" is not defined at "${S}" (strictRequired)`;(0,Ja.checkStrictMode)(c,g,c.opts.strictRequired)}}function d(){if(u||i)e.block$data(Ft.nil,p);else for(const w of r)(0,At.checkReportMissingProp)(e,w)}function f(){const w=t.let("missing");if(u||i){const b=t.let("valid",!0);e.block$data(b,()=>v(w,b)),e.ok(b)}else t.if((0,At.checkMissingProp)(e,r,w)),(0,At.reportMissingProp)(e,w),t.else()}function p(){t.forOf("prop",n,w=>{e.setParams({missingProperty:w}),t.if((0,At.noPropertyInData)(t,s,w,o.ownProperties),()=>e.error())})}function v(w,b){e.setParams({missingProperty:w}),t.forOf(w,n,()=>{t.assign(b,(0,At.propertyInData)(t,s,w,o.ownProperties)),t.if((0,Ft.not)(b),()=>{e.error(),t.break()})},Ft.nil)}}};vn.default=Ya;var bn={};Object.defineProperty(bn,"__esModule",{value:!0});const qt=X,Za={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,qt.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,qt._)`{limit: ${e}}`},Xa={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Za,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?qt.operators.GT:qt.operators.LT;e.fail$data((0,qt._)`${r}.length ${s} ${n}`)}};bn.default=Xa;var En={},Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});const Si=yi;Si.code='require("ajv/dist/runtime/equal").default';Gt.default=Si;Object.defineProperty(En,"__esModule",{value:!0});const Ur=zt,be=X,ec=se,tc=Gt,rc={message:({params:{i:e,j:t}})=>(0,be.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,be._)`{i: ${e}, j: ${t}}`},nc={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rc,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:c,it:o}=e;if(!n&&!s)return;const u=t.let("valid"),d=i.items?(0,Ur.getSchemaTypes)(i.items):[];e.block$data(u,f,(0,be._)`${c} === false`),e.ok(u);function f(){const b=t.let("i",(0,be._)`${r}.length`),T=t.let("j");e.setParams({i:b,j:T}),t.assign(u,!0),t.if((0,be._)`${b} > 1`,()=>(p()?v:w)(b,T))}function p(){return d.length>0&&!d.some(b=>b==="object"||b==="array")}function v(b,T){const S=t.name("item"),g=(0,Ur.checkDataTypes)(d,S,o.opts.strictNumbers,Ur.DataType.Wrong),m=t.const("indices",(0,be._)`{}`);t.for((0,be._)`;${b}--;`,()=>{t.let(S,(0,be._)`${r}[${b}]`),t.if(g,(0,be._)`continue`),d.length>1&&t.if((0,be._)`typeof ${S} == "string"`,(0,be._)`${S} += "_"`),t.if((0,be._)`typeof ${m}[${S}] == "number"`,()=>{t.assign(T,(0,be._)`${m}[${S}]`),e.error(),t.assign(u,!1).break()}).code((0,be._)`${m}[${S}] = ${b}`)})}function w(b,T){const S=(0,ec.useFunc)(t,tc.default),g=t.name("outer");t.label(g).for((0,be._)`;${b}--;`,()=>t.for((0,be._)`${T} = ${b}; ${T}--;`,()=>t.if((0,be._)`${S}(${r}[${b}], ${r}[${T}])`,()=>{e.error(),t.assign(u,!1).break(g)})))}}};En.default=nc;var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});const Yr=X,sc=se,ic=Gt,oc={message:"must be equal to constant",params:({schemaCode:e})=>(0,Yr._)`{allowedValue: ${e}}`},ac={keyword:"const",$data:!0,error:oc,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Yr._)`!${(0,sc.useFunc)(t,ic.default)}(${r}, ${s})`):e.fail((0,Yr._)`${i} !== ${r}`)}};Pn.default=ac;var Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});const Dt=X,cc=se,uc=Gt,lc={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Dt._)`{allowedValues: ${e}}`},dc={keyword:"enum",schemaType:"array",$data:!0,error:lc,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:c}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const o=s.length>=c.opts.loopEnum;let u;const d=()=>u??(u=(0,cc.useFunc)(t,uc.default));let f;if(o||n)f=t.let("valid"),e.block$data(f,p);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const w=t.const("vSchema",i);f=(0,Dt.or)(...s.map((b,T)=>v(w,T)))}e.pass(f);function p(){t.assign(f,!1),t.forOf("v",i,w=>t.if((0,Dt._)`${d()}(${r}, ${w})`,()=>t.assign(f,!0).break()))}function v(w,b){const T=s[b];return typeof T=="object"&&T!==null?(0,Dt._)`${d()}(${r}, ${w}[${b}])`:(0,Dt._)`${r} === ${T}`}}};Sn.default=dc;Object.defineProperty(hn,"__esModule",{value:!0});const fc=mn,pc=yn,hc=gn,mc=_n,yc=wn,gc=vn,$c=bn,_c=En,wc=Pn,vc=Sn,bc=[fc.default,pc.default,hc.default,mc.default,yc.default,gc.default,$c.default,_c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},wc.default,vc.default];hn.default=bc;var Tn={},Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.validateAdditionalItems=void 0;const ft=X,Zr=se,Ec={message:({params:{len:e}})=>(0,ft.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ft._)`{limit: ${e}}`},Pc={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Ec,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Zr.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ti(e,n)}};function Ti(e,t){const{gen:r,schema:n,data:s,keyword:i,it:c}=e;c.items=!0;const o=r.const("len",(0,ft._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,ft._)`${o} <= ${t.length}`);else if(typeof n=="object"&&!(0,Zr.alwaysValidSchema)(c,n)){const d=r.var("valid",(0,ft._)`${o} <= ${t.length}`);r.if((0,ft.not)(d),()=>u(d)),e.ok(d)}function u(d){r.forRange("i",t.length,o,f=>{e.subschema({keyword:i,dataProp:f,dataPropType:Zr.Type.Num},d),c.allErrors||r.if((0,ft.not)(d),()=>r.break())})}}Tt.validateAdditionalItems=Ti;Tt.default=Pc;var Rn={},Rt={};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.validateTuple=void 0;const ws=X,ur=se,Sc=Fe(),Tc={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Ri(e,"additionalItems",t);r.items=!0,!(0,ur.alwaysValidSchema)(r,t)&&e.ok((0,Sc.validateArray)(e))}};function Ri(e,t,r=e.schema){const{gen:n,parentSchema:s,data:i,keyword:c,it:o}=e;f(s),o.opts.unevaluated&&r.length&&o.items!==!0&&(o.items=ur.mergeEvaluated.items(n,r.length,o.items));const u=n.name("valid"),d=n.const("len",(0,ws._)`${i}.length`);r.forEach((p,v)=>{(0,ur.alwaysValidSchema)(o,p)||(n.if((0,ws._)`${d} > ${v}`,()=>e.subschema({keyword:c,schemaProp:v,dataProp:v},u)),e.ok(u))});function f(p){const{opts:v,errSchemaPath:w}=o,b=r.length,T=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(v.strictTuples&&!T){const S=`"${c}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${w}"`;(0,ur.checkStrictMode)(o,S,v.strictTuples)}}}Rt.validateTuple=Ri;Rt.default=Tc;Object.defineProperty(Rn,"__esModule",{value:!0});const Rc=Rt,kc={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Rc.validateTuple)(e,"items")};Rn.default=kc;var kn={};Object.defineProperty(kn,"__esModule",{value:!0});const vs=X,Oc=se,Cc=Fe(),Nc=Tt,Ic={message:({params:{len:e}})=>(0,vs.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,vs._)`{limit: ${e}}`},jc={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ic,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,Oc.alwaysValidSchema)(n,t)&&(s?(0,Nc.validateAdditionalItems)(e,s):e.ok((0,Cc.validateArray)(e)))}};kn.default=jc;var On={};Object.defineProperty(On,"__esModule",{value:!0});const Ie=X,er=se,Ac={message:({params:{min:e,max:t}})=>t===void 0?(0,Ie.str)`must contain at least ${e} valid item(s)`:(0,Ie.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ie._)`{minContains: ${e}}`:(0,Ie._)`{minContains: ${e}, maxContains: ${t}}`},Dc={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Ac,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;let c,o;const{minContains:u,maxContains:d}=n;i.opts.next?(c=u===void 0?1:u,o=d):c=1;const f=t.const("len",(0,Ie._)`${s}.length`);if(e.setParams({min:c,max:o}),o===void 0&&c===0){(0,er.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&c>o){(0,er.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,er.alwaysValidSchema)(i,r)){let T=(0,Ie._)`${f} >= ${c}`;o!==void 0&&(T=(0,Ie._)`${T} && ${f} <= ${o}`),e.pass(T);return}i.items=!0;const p=t.name("valid");o===void 0&&c===1?w(p,()=>t.if(p,()=>t.break())):c===0?(t.let(p,!0),o!==void 0&&t.if((0,Ie._)`${s}.length > 0`,v)):(t.let(p,!1),v()),e.result(p,()=>e.reset());function v(){const T=t.name("_valid"),S=t.let("count",0);w(T,()=>t.if(T,()=>b(S)))}function w(T,S){t.forRange("i",0,f,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:er.Type.Num,compositeRule:!0},T),S()})}function b(T){t.code((0,Ie._)`${T}++`),o===void 0?t.if((0,Ie._)`${T} >= ${c}`,()=>t.assign(p,!0).break()):(t.if((0,Ie._)`${T} > ${o}`,()=>t.assign(p,!1).break()),c===1?t.assign(p,!0):t.if((0,Ie._)`${T} >= ${c}`,()=>t.assign(p,!0)))}}};On.default=Dc;var ki={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=X,r=se,n=Fe();e.error={message:({params:{property:u,depsCount:d,deps:f}})=>{const p=d===1?"property":"properties";return(0,t.str)`must have ${p} ${f} when property ${u} is present`},params:({params:{property:u,depsCount:d,deps:f,missingProperty:p}})=>(0,t._)`{property: ${u},
|
|
635
|
+
missingProperty: ${p},
|
|
636
|
+
depsCount: ${d},
|
|
637
|
+
deps: ${f}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[d,f]=i(u);c(u,d),o(u,f)}};function i({schema:u}){const d={},f={};for(const p in u){if(p==="__proto__")continue;const v=Array.isArray(u[p])?d:f;v[p]=u[p]}return[d,f]}function c(u,d=u.schema){const{gen:f,data:p,it:v}=u;if(Object.keys(d).length===0)return;const w=f.let("missing");for(const b in d){const T=d[b];if(T.length===0)continue;const S=(0,n.propertyInData)(f,p,b,v.opts.ownProperties);u.setParams({property:b,depsCount:T.length,deps:T.join(", ")}),v.allErrors?f.if(S,()=>{for(const g of T)(0,n.checkReportMissingProp)(u,g)}):(f.if((0,t._)`${S} && (${(0,n.checkMissingProp)(u,T,w)})`),(0,n.reportMissingProp)(u,w),f.else())}}e.validatePropertyDeps=c;function o(u,d=u.schema){const{gen:f,data:p,keyword:v,it:w}=u,b=f.name("valid");for(const T in d)(0,r.alwaysValidSchema)(w,d[T])||(f.if((0,n.propertyInData)(f,p,T,w.opts.ownProperties),()=>{const S=u.subschema({keyword:v,schemaProp:T},b);u.mergeValidEvaluated(S,b)},()=>f.var(b,!0)),u.ok(b))}e.validateSchemaDeps=o,e.default=s})(ki);var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});const Oi=X,Mc=se,Lc={message:"property name must be valid",params:({params:e})=>(0,Oi._)`{propertyName: ${e.propertyName}}`},Fc={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Lc,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,Mc.alwaysValidSchema)(s,r))return;const i=t.name("valid");t.forIn("key",n,c=>{e.setParams({propertyName:c}),e.subschema({keyword:"propertyNames",data:c,dataTypes:["string"],propertyName:c,compositeRule:!0},i),t.if((0,Oi.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};Cn.default=Fc;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});const tr=Fe(),Me=X,qc=nt(),rr=se,Uc={message:"must NOT have additional properties",params:({params:e})=>(0,Me._)`{additionalProperty: ${e.additionalProperty}}`},Vc={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Uc,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:c}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:o,opts:u}=c;if(c.props=!0,u.removeAdditional!=="all"&&(0,rr.alwaysValidSchema)(c,r))return;const d=(0,tr.allSchemaProperties)(n.properties),f=(0,tr.allSchemaProperties)(n.patternProperties);p(),e.ok((0,Me._)`${i} === ${qc.default.errors}`);function p(){t.forIn("key",s,S=>{!d.length&&!f.length?b(S):t.if(v(S),()=>b(S))})}function v(S){let g;if(d.length>8){const m=(0,rr.schemaRefOrVal)(c,n.properties,"properties");g=(0,tr.isOwnProperty)(t,m,S)}else d.length?g=(0,Me.or)(...d.map(m=>(0,Me._)`${S} === ${m}`)):g=Me.nil;return f.length&&(g=(0,Me.or)(g,...f.map(m=>(0,Me._)`${(0,tr.usePattern)(e,m)}.test(${S})`))),(0,Me.not)(g)}function w(S){t.code((0,Me._)`delete ${s}[${S}]`)}function b(S){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){w(S);return}if(r===!1){e.setParams({additionalProperty:S}),e.error(),o||t.break();return}if(typeof r=="object"&&!(0,rr.alwaysValidSchema)(c,r)){const g=t.name("valid");u.removeAdditional==="failing"?(T(S,g,!1),t.if((0,Me.not)(g),()=>{e.reset(),w(S)})):(T(S,g),o||t.if((0,Me.not)(g),()=>t.break()))}}function T(S,g,m){const _={keyword:"additionalProperties",dataProp:S,dataPropType:rr.Type.Str};m===!1&&Object.assign(_,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(_,g)}}};Ir.default=Vc;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const zc=Or(),bs=Fe(),Vr=se,Es=Ir,Wc={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Es.default.code(new zc.KeywordCxt(i,Es.default,"additionalProperties"));const c=(0,bs.allSchemaProperties)(r);for(const p of c)i.definedProperties.add(p);i.opts.unevaluated&&c.length&&i.props!==!0&&(i.props=Vr.mergeEvaluated.props(t,(0,Vr.toHash)(c),i.props));const o=c.filter(p=>!(0,Vr.alwaysValidSchema)(i,r[p]));if(o.length===0)return;const u=t.name("valid");for(const p of o)d(p)?f(p):(t.if((0,bs.propertyInData)(t,s,p,i.opts.ownProperties)),f(p),i.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(u);function d(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function f(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},u)}}};Nn.default=Wc;var In={};Object.defineProperty(In,"__esModule",{value:!0});const Ps=Fe(),nr=X,Ss=se,Ts=se,Hc={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:c}=i,o=(0,Ps.allSchemaProperties)(r),u=o.filter(T=>(0,Ss.alwaysValidSchema)(i,r[T]));if(o.length===0||u.length===o.length&&(!i.opts.unevaluated||i.props===!0))return;const d=c.strictSchema&&!c.allowMatchingProperties&&s.properties,f=t.name("valid");i.props!==!0&&!(i.props instanceof nr.Name)&&(i.props=(0,Ts.evaluatedPropsToName)(t,i.props));const{props:p}=i;v();function v(){for(const T of o)d&&w(T),i.allErrors?b(T):(t.var(f,!0),b(T),t.if(f))}function w(T){for(const S in d)new RegExp(T).test(S)&&(0,Ss.checkStrictMode)(i,`property ${S} matches pattern ${T} (use allowMatchingProperties)`)}function b(T){t.forIn("key",n,S=>{t.if((0,nr._)`${(0,Ps.usePattern)(e,T)}.test(${S})`,()=>{const g=u.includes(T);g||e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:S,dataPropType:Ts.Type.Str},f),i.opts.unevaluated&&p!==!0?t.assign((0,nr._)`${p}[${S}]`,!0):!g&&!i.allErrors&&t.if((0,nr.not)(f),()=>t.break())})})}}};In.default=Hc;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});const xc=se,Bc={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,xc.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};jn.default=Bc;var An={};Object.defineProperty(An,"__esModule",{value:!0});const Gc=Fe(),Kc={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Gc.validateUnion,error:{message:"must match a schema in anyOf"}};An.default=Kc;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const lr=X,Jc=se,Qc={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,lr._)`{passingSchemas: ${e.passing}}`},Yc={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Qc,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const i=r,c=t.let("valid",!1),o=t.let("passing",null),u=t.name("_valid");e.setParams({passing:o}),t.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){i.forEach((f,p)=>{let v;(0,Jc.alwaysValidSchema)(s,f)?t.var(u,!0):v=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},u),p>0&&t.if((0,lr._)`${u} && ${c}`).assign(c,!1).assign(o,(0,lr._)`[${o}, ${p}]`).else(),t.if(u,()=>{t.assign(c,!0),t.assign(o,p),v&&e.mergeEvaluated(v,lr.Name)})})}}};Dn.default=Yc;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Zc=se,Xc={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((i,c)=>{if((0,Zc.alwaysValidSchema)(n,i))return;const o=e.subschema({keyword:"allOf",schemaProp:c},s);e.ok(s),e.mergeEvaluated(o)})}};Mn.default=Xc;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const wr=X,Ci=se,eu={message:({params:e})=>(0,wr.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,wr._)`{failingKeyword: ${e.ifClause}}`},tu={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:eu,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Ci.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=Rs(n,"then"),i=Rs(n,"else");if(!s&&!i)return;const c=t.let("valid",!0),o=t.name("_valid");if(u(),e.reset(),s&&i){const f=t.let("ifClause");e.setParams({ifClause:f}),t.if(o,d("then",f),d("else",f))}else s?t.if(o,d("then")):t.if((0,wr.not)(o),d("else"));e.pass(c,()=>e.error(!0));function u(){const f=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);e.mergeEvaluated(f)}function d(f,p){return()=>{const v=e.subschema({keyword:f},o);t.assign(c,o),e.mergeValidEvaluated(v,c),p?t.assign(p,(0,wr._)`${f}`):e.setParams({ifClause:f})}}}};function Rs(e,t){const r=e.schema[t];return r!==void 0&&!(0,Ci.alwaysValidSchema)(e,r)}Ln.default=tu;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const ru=se,nu={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,ru.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Fn.default=nu;Object.defineProperty(Tn,"__esModule",{value:!0});const su=Tt,iu=Rn,ou=Rt,au=kn,cu=On,uu=ki,lu=Cn,du=Ir,fu=Nn,pu=In,hu=jn,mu=An,yu=Dn,gu=Mn,$u=Ln,_u=Fn;function wu(e=!1){const t=[hu.default,mu.default,yu.default,gu.default,$u.default,_u.default,lu.default,du.default,uu.default,fu.default,pu.default];return e?t.push(iu.default,au.default):t.push(su.default,ou.default),t.push(cu.default),t}Tn.default=wu;var qn={},Un={};Object.defineProperty(Un,"__esModule",{value:!0});const he=X,vu={message:({schemaCode:e})=>(0,he.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,he._)`{format: ${e}}`},bu={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:vu,code(e,t){const{gen:r,data:n,$data:s,schema:i,schemaCode:c,it:o}=e,{opts:u,errSchemaPath:d,schemaEnv:f,self:p}=o;if(!u.validateFormats)return;s?v():w();function v(){const b=r.scopeValue("formats",{ref:p.formats,code:u.code.formats}),T=r.const("fDef",(0,he._)`${b}[${c}]`),S=r.let("fType"),g=r.let("format");r.if((0,he._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign(S,(0,he._)`${T}.type || "string"`).assign(g,(0,he._)`${T}.validate`),()=>r.assign(S,(0,he._)`"string"`).assign(g,T)),e.fail$data((0,he.or)(m(),_()));function m(){return u.strictSchema===!1?he.nil:(0,he._)`${c} && !${g}`}function _(){const R=f.$async?(0,he._)`(${T}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,he._)`${g}(${n})`,D=(0,he._)`(typeof ${g} == "function" ? ${R} : ${g}.test(${n}))`;return(0,he._)`${g} && ${g} !== true && ${S} === ${t} && !${D}`}}function w(){const b=p.formats[i];if(!b){m();return}if(b===!0)return;const[T,S,g]=_(b);T===t&&e.pass(R());function m(){if(u.strictSchema===!1){p.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${d}"`}}function _(D){const E=D instanceof RegExp?(0,he.regexpCode)(D):u.code.formats?(0,he._)`${u.code.formats}${(0,he.getProperty)(i)}`:void 0,C=r.scopeValue("formats",{key:i,ref:D,code:E});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,he._)`${C}.validate`]:["string",D,C]}function R(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!f.$async)throw new Error("async format in sync schema");return(0,he._)`await ${g}(${n})`}return typeof S=="function"?(0,he._)`${g}(${n})`:(0,he._)`${g}.test(${n})`}}}};Un.default=bu;Object.defineProperty(qn,"__esModule",{value:!0});const Eu=Un,Pu=[Eu.default];qn.default=Pu;var St={};Object.defineProperty(St,"__esModule",{value:!0});St.contentVocabulary=St.metadataVocabulary=void 0;St.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];St.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(dn,"__esModule",{value:!0});const Su=fn,Tu=hn,Ru=Tn,ku=qn,ks=St,Ou=[Su.default,Tu.default,(0,Ru.default)(),ku.default,ks.metadataVocabulary,ks.contentVocabulary];dn.default=Ou;var Vn={},Ni={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(Ni);Object.defineProperty(Vn,"__esModule",{value:!0});const vt=X,Xr=Ni,Os=Re,Cu=se,Nu={message:({params:{discrError:e,tagName:t}})=>e===Xr.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,vt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Iu={keyword:"discriminator",type:"object",schemaType:"object",error:Nu,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:c}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const o=n.propertyName;if(typeof o!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!c)throw new Error("discriminator: requires oneOf keyword");const u=t.let("valid",!1),d=t.const("tag",(0,vt._)`${r}${(0,vt.getProperty)(o)}`);t.if((0,vt._)`typeof ${d} == "string"`,()=>f(),()=>e.error(!1,{discrError:Xr.DiscrError.Tag,tag:d,tagName:o})),e.ok(u);function f(){const w=v();t.if(!1);for(const b in w)t.elseIf((0,vt._)`${d} === ${b}`),t.assign(u,p(w[b]));t.else(),e.error(!1,{discrError:Xr.DiscrError.Mapping,tag:d,tagName:o}),t.endIf()}function p(w){const b=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:w},b);return e.mergeEvaluated(T,vt.Name),b}function v(){var w;const b={},T=g(s);let S=!0;for(let R=0;R<c.length;R++){let D=c[R];D!=null&&D.$ref&&!(0,Cu.schemaHasRulesButRef)(D,i.self.RULES)&&(D=Os.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,D==null?void 0:D.$ref),D instanceof Os.SchemaEnv&&(D=D.schema));const E=(w=D==null?void 0:D.properties)===null||w===void 0?void 0:w[o];if(typeof E!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);S=S&&(T||g(D)),m(E,R)}if(!S)throw new Error(`discriminator: "${o}" must be required`);return b;function g({required:R}){return Array.isArray(R)&&R.includes(o)}function m(R,D){if(R.const)_(R.const,D);else if(R.enum)for(const E of R.enum)_(E,D);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function _(R,D){if(typeof R!="string"||R in b)throw new Error(`discriminator: "${o}" values must be unique strings`);b[R]=D}}}};Vn.default=Iu;const ju="http://json-schema.org/draft-07/schema#",Au="http://json-schema.org/draft-07/schema#",Du="Core schema meta-schema",Mu={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},Lu=["object","boolean"],Fu={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},qu={$schema:ju,$id:Au,title:Du,definitions:Mu,type:Lu,properties:Fu,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=pi,n=dn,s=Vn,i=qu,c=["/properties"],o="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(b=>this.addVocabulary(b)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const b=this.opts.$data?this.$dataMetaSchema(i,c):i;this.addMetaSchema(b,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.exports=t=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var d=Or();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var f=X;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var p=xt;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var v=Bt;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(Gr,Gr.exports);var Uu=Gr.exports;const Vu=jo(Uu),zu="http://json-schema.org/schema",Wu="#/definitions/Blueprint",Hu={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate"},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define"},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",enum:["kitchen-sink","light"]},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants in wp-config.php. Possible values are:
|
|
673
638
|
|
|
674
639
|
- rewrite-wp-config: Default. Rewrites the wp-config.php file to explicitly call define() with the requested name and value. This method alters the file on the disk, but it doesn't conflict with existing define() calls in wp-config.php.
|
|
675
640
|
|
|
676
641
|
- define-before-run: Defines the constant before running the requested script. It doesn't alter any files on the disk, but constants defined this way may conflict with existing define() calls in wp-config.php.`},virtualize:{type:"boolean",deprecated:`This option is noop and will be removed in a future version.
|
|
677
642
|
This option is only kept in here to avoid breaking Blueprint schema validation
|
|
678
|
-
for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWxr"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1}]}}],description:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema,$ref,definitions},{wpCLI,...otherStepHandlers}=allStepHandlers,keyedStepHandlers={...otherStepHandlers,"wp-cli":wpCLI,importFile:otherStepHandlers.importWxr};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=()=>{}}={}){var f,b,P,E,C,$,_;e={...e,steps:(e.steps||[]).filter(isStepDefinition).filter(isStepStillSupported)};for(const y of e.steps)typeof y=="object"&&y.step==="importFile"&&(y.step="importWxr",logger.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const y=e.plugins.map(S=>typeof S=="string"?S.startsWith("https://")?{resource:"url",url:S}:{resource:"wordpress.org/plugins",slug:S}:S).map(S=>({step:"installPlugin",pluginZipFile:S}));e.steps.unshift(...y)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login}),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.length===0&&e.phpExtensionBundles.push("kitchen-sink");const s=(f=e.steps)==null?void 0:f.findIndex(y=>typeof y=="object"&&(y==null?void 0:y.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(y=>y!=="light"),logger.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(b=e.steps)==null||b.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const o=(P=e.steps)==null?void 0:P.findIndex(y=>typeof y=="object"&&(y==null?void 0:y.step)==="importWxr");o!==void 0&&o>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(y=>y!=="light"),logger.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(E=e.steps)==null||E.splice(o,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:i,errors:c}=validateBlueprint(e);if(!i){const y=new Error(`Invalid blueprint: ${c[0].message} at ${c[0].instancePath}`);throw y.errors=c,y}const u=e.steps||[],l=u.reduce((y,S)=>{var I;return y+(((I=S.progress)==null?void 0:I.weight)||1)},0),p=u.map(y=>compileStep(y,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:compileVersion((C=e.preferredVersions)==null?void 0:C.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:(($=e.preferredVersions)==null?void 0:$.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:((_=e.features)==null?void 0:_.networking)??!1},run:async y=>{try{for(const{resources:S}of p)for(const I of S)I.setPlayground(y),I.isAsync&&I.resolve();for(const[S,{run:I,step:D}]of Object.entries(p))try{const w=await I(y);n(w,D)}catch(w){throw logger.error(w),new Error(`Error when executing the blueprint step #${S} (${JSON.stringify(D)}) ${w instanceof Error?`: ${w.message}`:w}`,{cause:w})}}finally{try{await y.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const ajv=new Ajv({discriminator:!0});let blueprintValidator;function validateBlueprint(e){var s;blueprintValidator=ajv.compile(blueprintSchema);const t=blueprintValidator(e);if(t)return{valid:t};const r=new Set;for(const o of blueprintValidator.errors)o.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(o.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(o=>!(o.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(o.instancePath)));return{valid:t,errors:n}}function compileVersion(e,t,r){return e&&t.includes(e)?e:r}function compilePHPExtensions(e,t){const r=SupportedPHPExtensionsList.filter(s=>e.includes(s)),n=t.flatMap(s=>s in SupportedPHPExtensionBundles?SupportedPHPExtensionBundles[s]:[]);return Array.from(new Set([...r,...n]))}function isStepDefinition(e){return!!(typeof e=="object"&&e)}function isStepStillSupported(e){return e.step==="setPhpIniEntry"?(logger.warn('The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'),!1):!0}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var p;const s=r.stage((((p=e.progress)==null?void 0:p.weight)||1)/n),o={};for(const f of Object.keys(e)){let b=e[f];isFileReference(b)&&(b=Resource.create(b,{semaphore:t})),o[f]=b}const i=async f=>{var b;try{return s.fillSlowly(),await keyedStepHandlers[e.step](f,await resolveArguments(o),{tracker:s,initialCaption:(b=e.progress)==null?void 0:b.caption})}finally{s.finish()}},c=getResources(o),u=getResources(o).filter(f=>f.isAsync),l=1/(u.length+1);for(const f of u)f.progress=s.stage(l);return{run:i,step:e,resources:c}}function getResources(e){const t=[];for(const r in e){const n=e[r];n instanceof Resource&&t.push(n)}return t}async function resolveArguments(e){const t={};for(const r in e){const n=e[r];n instanceof Resource?t[r]=await n.resolve():t[r]=n}return t}async function runBlueprintSteps(e,t){await e.run(t)}function setPluginProxyURL(){}/**
|
|
643
|
+
for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWxr"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"resetData"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1}]}}],description:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},xu={$schema:zu,$ref:Wu,definitions:Hu},{wpCLI:Bu,...Cs}=So,Gu={...Cs,"wp-cli":Bu,importFile:Cs.importWxr};function Ii(e,{progress:t=new Rr,semaphore:r=new ro({concurrency:3}),onStepCompleted:n=()=>{}}={}){var p,v,w,b,T,S,g;e={...e,steps:(e.steps||[]).filter(Zu).filter(Xu)};for(const m of e.steps)typeof m=="object"&&m.step==="importFile"&&(m.step="importWxr",Pe.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const m=e.plugins.map(_=>typeof _=="string"?_.startsWith("https://")?{resource:"url",url:_}:{resource:"wordpress.org/plugins",slug:_}:_).map(_=>({step:"installPlugin",pluginZipFile:_}));e.steps.unshift(...m)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login}),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.length===0&&e.phpExtensionBundles.push("kitchen-sink");const s=(p=e.steps)==null?void 0:p.findIndex(m=>typeof m=="object"&&(m==null?void 0:m.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(m=>m!=="light"),Pe.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(v=e.steps)==null||v.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const i=(w=e.steps)==null?void 0:w.findIndex(m=>typeof m=="object"&&(m==null?void 0:m.step)==="importWxr");i!==void 0&&i>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(m=>m!=="light"),Pe.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(b=e.steps)==null||b.splice(i,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:c,errors:o}=Ju(e);if(!c){const m=new Error(`Invalid blueprint: ${o[0].message} at ${o[0].instancePath}`);throw m.errors=o,m}const u=e.steps||[],d=u.reduce((m,_)=>{var R;return m+(((R=_.progress)==null?void 0:R.weight)||1)},0),f=u.map(m=>el(m,{semaphore:r,rootProgressTracker:t,totalProgressWeight:d}));return{versions:{php:Qu((T=e.preferredVersions)==null?void 0:T.php,kr,ui),wp:((S=e.preferredVersions)==null?void 0:S.wp)||"latest"},phpExtensions:Yu([],e.phpExtensionBundles||[]),features:{networking:((g=e.features)==null?void 0:g.networking)??!1},run:async m=>{try{for(const{resources:_}of f)for(const R of _)R.setPlayground(m),R.isAsync&&R.resolve();for(const[_,{run:R,step:D}]of Object.entries(f))try{const E=await R(m);n(E,D)}catch(E){throw Pe.error(E),new Error(`Error when executing the blueprint step #${_} (${JSON.stringify(D)}) ${E instanceof Error?`: ${E.message}`:E}`,{cause:E})}}finally{try{await m.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const Ku=new Vu({discriminator:!0});let sr;function Ju(e){var s;sr=Ku.compile(xu);const t=sr(e);if(t)return{valid:t};const r=new Set;for(const i of sr.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=sr.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.instancePath)));return{valid:t,errors:n}}function Qu(e,t,r){return e&&t.includes(e)?e:r}function Yu(e,t){const r=li.filter(s=>e.includes(s)),n=t.flatMap(s=>s in us?us[s]:[]);return Array.from(new Set([...r,...n]))}function Zu(e){return!!(typeof e=="object"&&e)}function Xu(e){return["setPhpIniEntry","request"].includes(e.step)?(Pe.warn(`The "${e.step}" Blueprint is no longer supported and you can remove it from your Blueprint.`),!1):!0}function el(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var f;const s=r.stage((((f=e.progress)==null?void 0:f.weight)||1)/n),i={};for(const p of Object.keys(e)){let v=e[p];Lo(v)&&(v=yt.create(v,{semaphore:t})),i[p]=v}const c=async p=>{var v;try{return s.fillSlowly(),await Gu[e.step](p,await tl(i),{tracker:s,initialCaption:(v=e.progress)==null?void 0:v.caption})}finally{s.finish()}},o=Ns(i),u=Ns(i).filter(p=>p.isAsync),d=1/(u.length+1);for(const p of u)p.progress=s.stage(d);return{run:c,step:e,resources:o}}function Ns(e){const t=[];for(const r in e){const n=e[r];n instanceof yt&&t.push(n)}return t}async function tl(e){const t={};for(const r in e){const n=e[r];n instanceof yt?t[r]=await n.resolve():t[r]=n}return t}async function ji(e,t){await e.run(t)}function rl(){}/**
|
|
679
644
|
* @license
|
|
680
645
|
* Copyright 2019 Google LLC
|
|
681
646
|
* SPDX-License-Identifier: Apache-2.0
|
|
682
|
-
*/const proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=e=>typeof e=="object"&&e!==null||typeof e=="function",proxyTransferHandler={canHandle:e=>isObject(e)&&e[proxyMarker],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize(e){return e.start(),wrap(e)}},throwTransferHandler={canHandle:e=>isObject(e)&&throwMarker in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function expose(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!isAllowedOrigin(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:o,type:i,path:c}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(fromWireValue);let l;try{const p=c.slice(0,-1).reduce((b,P)=>b[P],e),f=c.reduce((b,P)=>b[P],e);switch(i){case"GET":l=f;break;case"SET":p[c.slice(-1)[0]]=fromWireValue(s.data.value),l=!0;break;case"APPLY":l=f.apply(p,u);break;case"CONSTRUCT":{const b=new f(...u);l=proxy(b)}break;case"ENDPOINT":{const{port1:b,port2:P}=new MessageChannel;expose(e,P),l=transfer(b,[b])}break;case"RELEASE":l=void 0;break;default:return}}catch(p){l={value:p,[throwMarker]:0}}Promise.resolve(l).catch(p=>({value:p,[throwMarker]:0})).then(p=>{const[f,b]=toWireValue(p);t.postMessage(Object.assign(Object.assign({},f),{id:o}),b),i==="RELEASE"&&(t.removeEventListener("message",n),closeEndPoint(t),finalizer in e&&typeof e[finalizer]=="function"&&e[finalizer]())}).catch(p=>{const[f,b]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});t.postMessage(Object.assign(Object.assign({},f),{id:o}),b)})}),t.start&&t.start()}function isMessagePort(e){return e.constructor.name==="MessagePort"}function closeEndPoint(e){isMessagePort(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(e){return requestResponseMessage(e,{type:"RELEASE"}).then(()=>{closeEndPoint(e)})}const proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(proxyCounter.get(e)||0)-1;proxyCounter.set(e,t),t===0&&releaseEndpoint(e)});function registerProxy(e,t){const r=(proxyCounter.get(t)||0)+1;proxyCounter.set(t,r),proxyFinalizers&&proxyFinalizers.register(e,t,e)}function unregisterProxy(e){proxyFinalizers&&proxyFinalizers.unregister(e)}function createProxy(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(o,i){if(throwIfProxyReleased(n),i===releaseProxy)return()=>{unregisterProxy(s),releaseEndpoint(e),n=!0};if(i==="then"){if(t.length===0)return{then:()=>s};const c=requestResponseMessage(e,{type:"GET",path:t.map(u=>u.toString())}).then(fromWireValue);return c.then.bind(c)}return createProxy(e,[...t,i])},set(o,i,c){throwIfProxyReleased(n);const[u,l]=toWireValue(c);return requestResponseMessage(e,{type:"SET",path:[...t,i].map(p=>p.toString()),value:u},l).then(fromWireValue)},apply(o,i,c){throwIfProxyReleased(n);const u=t[t.length-1];if(u===createEndpoint)return requestResponseMessage(e,{type:"ENDPOINT"}).then(fromWireValue);if(u==="bind")return createProxy(e,t.slice(0,-1));const[l,p]=processArguments(c);return requestResponseMessage(e,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:l},p).then(fromWireValue)},construct(o,i){throwIfProxyReleased(n);const[c,u]=processArguments(i);return requestResponseMessage(e,{type:"CONSTRUCT",path:t.map(l=>l.toString()),argumentList:c},u).then(fromWireValue)}});return registerProxy(s,e),s}function myFlat(e){return Array.prototype.concat.apply([],e)}function processArguments(e){const t=e.map(toWireValue);return[t.map(r=>r[0]),myFlat(t.map(r=>r[1]))]}const transferCache=new WeakMap;function transfer(e,t){return transferCache.set(e,t),e}function proxy(e){return Object.assign(e,{[proxyMarker]:!0})}function windowEndpoint(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of transferHandlers)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},transferCache.get(e)||[]]}function fromWireValue(e){switch(e.type){case"HANDLER":return transferHandlers.get(e.name).deserialize(e.value);case"RAW":return e.value}}function requestResponseMessage(e,t,r){return new Promise(n=>{const s=generateUUID();e.addEventListener("message",function o(i){!i.data||!i.data.id||i.data.id!==s||(e.removeEventListener("message",o),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function generateUUID(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function consumeAPI(e,t=void 0){setupTransferHandlers();const r=e instanceof Worker?e:windowEndpoint(e,t),n=wrap(r),s=proxyClone(n);return new Proxy(s,{get:(o,i)=>i==="isConnected"?async()=>{for(;;)try{await runWithTimeout(n.isConnected(),200);break}catch{}}:n[i]})}async function runWithTimeout(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let isTransferHandlersSetup=!1;function setupTransferHandlers(){if(isTransferHandlersSetup)return;isTransferHandlersSetup=!0,transferHandlers.set("EVENT",{canHandle:r=>r instanceof CustomEvent,serialize:r=>[{detail:r.detail},[]],deserialize:r=>r}),transferHandlers.set("FUNCTION",{canHandle:r=>typeof r=="function",serialize(r){const{port1:n,port2:s}=new MessageChannel;return expose(r,n),[s,[s]]},deserialize(r){return r.start(),wrap(r)}}),transferHandlers.set("PHPResponse",{canHandle:r=>typeof r=="object"&&r!==null&&"headers"in r&&"bytes"in r&&"errors"in r&&"exitCode"in r&&"httpStatusCode"in r,serialize(r){return[r.toRawData(),[]]},deserialize(r){return PHPResponse.fromRawData(r)}});const e=transferHandlers.get("throw"),t=e==null?void 0:e.serialize;e.serialize=({value:r})=>{const n=t({value:r});return r.response&&(n[0].value.response=r.response),r.source&&(n[0].value.source=r.source),n}}function proxyClone(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:proxyClone(t[r]);case"undefined":case"number":case"string":return t[r];default:return proxy(t[r])}}})}async function startPlaygroundWeb({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new ProgressTracker,disableProgressBar:s,onBlueprintStepCompleted:o,onClientConnected:i=()=>{},sapiName:c}){if(assertValidRemote(r),allowStorageAccessByUserActivation(e),r=setQueryParams(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t){const p=await doStartPlaygroundWeb(e,setQueryParams(r,{"php-extension":"kitchen-sink"}),n);return i(p),p}const u=compileBlueprint(t,{progress:n.stage(.5),onStepCompleted:o}),l=await doStartPlaygroundWeb(e,setQueryParams(r,{php:u.versions.php,wp:u.versions.wp,"sapi-name":c,"php-extension":u.phpExtensions,networking:u.features.networking?"yes":"no"}),n);return collectPhpLogs(logger,l),i(l),await runBlueprintSteps(u,l),n.finish(),l}function allowStorageAccessByUserActivation(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function doStartPlaygroundWeb(e,t,r){await new Promise(o=>{e.src=t,e.addEventListener("load",o,!1)});const n=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const officialRemoteOrigin="https://playground.wordpress.net";function assertValidRemote(e){const t=new URL(e,officialRemoteOrigin);if((t.origin===officialRemoteOrigin||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${officialRemoteOrigin}/remote.html.`)}function setQueryParams(e,t){const r=new URL(e,officialRemoteOrigin),n=new URLSearchParams(r.search);for(const[s,o]of Object.entries(t))if(o!=null&&o!==!1)if(Array.isArray(o))for(const i of o)n.append(s,i.toString());else n.set(s,o.toString());return r.search=n.toString(),r.toString()}async function connectPlayground(e,t){if(logger.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return startPlaygroundWeb({iframe:e,remoteUrl:t.loadRemote});const r=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=LatestSupportedPHPVersion;exports.SupportedPHPVersions=SupportedPHPVersions;exports.SupportedPHPVersionsList=SupportedPHPVersionsList;exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.compileBlueprint=compileBlueprint;exports.connectPlayground=connectPlayground;exports.cp=cp;exports.defineSiteUrl=defineSiteUrl;exports.defineWpConfigConsts=defineWpConfigConsts;exports.enableMultisite=enableMultisite;exports.exportWXR=exportWXR;exports.importWordPressFiles=importWordPressFiles;exports.importWxr=importWxr;exports.installPlugin=installPlugin;exports.installTheme=installTheme;exports.login=login;exports.mkdir=mkdir;exports.mv=mv;exports.phpVar=phpVar;exports.phpVars=phpVars;exports.request=request;exports.rm=rm;exports.rmdir=rmdir;exports.runBlueprintSteps=runBlueprintSteps;exports.runPHP=runPHP;exports.runPHPWithOptions=runPHPWithOptions;exports.runSql=runSql;exports.runWpInstallationWizard=runWpInstallationWizard;exports.setPhpIniEntries=setPhpIniEntries;exports.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.startPlaygroundWeb=startPlaygroundWeb;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpCLI=wpCLI$1;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
|
|
647
|
+
*/const Ai=Symbol("Comlink.proxy"),nl=Symbol("Comlink.endpoint"),sl=Symbol("Comlink.releaseProxy"),zr=Symbol("Comlink.finalizer"),dr=Symbol("Comlink.thrown"),Di=e=>typeof e=="object"&&e!==null||typeof e=="function",il={canHandle:e=>Di(e)&&e[Ai],serialize(e){const{port1:t,port2:r}=new MessageChannel;return zn(e,t),[r,[r]]},deserialize(e){return e.start(),Wn(e)}},ol={canHandle:e=>Di(e)&&dr in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},Et=new Map([["proxy",il],["throw",ol]]);function al(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function zn(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!al(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:i,type:c,path:o}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(pt);let d;try{const f=o.slice(0,-1).reduce((v,w)=>v[w],e),p=o.reduce((v,w)=>v[w],e);switch(c){case"GET":d=p;break;case"SET":f[o.slice(-1)[0]]=pt(s.data.value),d=!0;break;case"APPLY":d=p.apply(f,u);break;case"CONSTRUCT":{const v=new p(...u);d=qi(v)}break;case"ENDPOINT":{const{port1:v,port2:w}=new MessageChannel;zn(e,w),d=fl(v,[v])}break;case"RELEASE":d=void 0;break;default:return}}catch(f){d={value:f,[dr]:0}}Promise.resolve(d).catch(f=>({value:f,[dr]:0})).then(f=>{const[p,v]=Er(f);t.postMessage(Object.assign(Object.assign({},p),{id:i}),v),c==="RELEASE"&&(t.removeEventListener("message",n),Mi(t),zr in e&&typeof e[zr]=="function"&&e[zr]())}).catch(f=>{const[p,v]=Er({value:new TypeError("Unserializable return value"),[dr]:0});t.postMessage(Object.assign(Object.assign({},p),{id:i}),v)})}),t.start&&t.start()}function cl(e){return e.constructor.name==="MessagePort"}function Mi(e){cl(e)&&e.close()}function Wn(e,t){return en(e,[],t)}function ir(e){if(e)throw new Error("Proxy has been released and is not useable")}function Li(e){return bt(e,{type:"RELEASE"}).then(()=>{Mi(e)})}const vr=new WeakMap,br="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(vr.get(e)||0)-1;vr.set(e,t),t===0&&Li(e)});function ul(e,t){const r=(vr.get(t)||0)+1;vr.set(t,r),br&&br.register(e,t,e)}function ll(e){br&&br.unregister(e)}function en(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(i,c){if(ir(n),c===sl)return()=>{ll(s),Li(e),n=!0};if(c==="then"){if(t.length===0)return{then:()=>s};const o=bt(e,{type:"GET",path:t.map(u=>u.toString())}).then(pt);return o.then.bind(o)}return en(e,[...t,c])},set(i,c,o){ir(n);const[u,d]=Er(o);return bt(e,{type:"SET",path:[...t,c].map(f=>f.toString()),value:u},d).then(pt)},apply(i,c,o){ir(n);const u=t[t.length-1];if(u===nl)return bt(e,{type:"ENDPOINT"}).then(pt);if(u==="bind")return en(e,t.slice(0,-1));const[d,f]=Is(o);return bt(e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:d},f).then(pt)},construct(i,c){ir(n);const[o,u]=Is(c);return bt(e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:o},u).then(pt)}});return ul(s,e),s}function dl(e){return Array.prototype.concat.apply([],e)}function Is(e){const t=e.map(Er);return[t.map(r=>r[0]),dl(t.map(r=>r[1]))]}const Fi=new WeakMap;function fl(e,t){return Fi.set(e,t),e}function qi(e){return Object.assign(e,{[Ai]:!0})}function pl(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function Er(e){for(const[t,r]of Et)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},Fi.get(e)||[]]}function pt(e){switch(e.type){case"HANDLER":return Et.get(e.name).deserialize(e.value);case"RAW":return e.value}}function bt(e,t,r){return new Promise(n=>{const s=hl();e.addEventListener("message",function i(c){!c.data||!c.data.id||c.data.id!==s||(e.removeEventListener("message",i),n(c.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function hl(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function Ui(e,t=void 0){yl();const r=e instanceof Worker?e:pl(e,t),n=Wn(r),s=Vi(n);return new Proxy(s,{get:(i,c)=>c==="isConnected"?async()=>{for(;;)try{await ml(n.isConnected(),200);break}catch{}}:n[c]})}async function ml(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let js=!1;function yl(){if(js)return;js=!0,Et.set("EVENT",{canHandle:r=>r instanceof CustomEvent,serialize:r=>[{detail:r.detail},[]],deserialize:r=>r}),Et.set("FUNCTION",{canHandle:r=>typeof r=="function",serialize(r){const{port1:n,port2:s}=new MessageChannel;return zn(r,n),[s,[s]]},deserialize(r){return r.start(),Wn(r)}}),Et.set("PHPResponse",{canHandle:r=>typeof r=="object"&&r!==null&&"headers"in r&&"bytes"in r&&"errors"in r&&"exitCode"in r&&"httpStatusCode"in r,serialize(r){return[r.toRawData(),[]]},deserialize(r){return yr.fromRawData(r)}});const e=Et.get("throw"),t=e==null?void 0:e.serialize;e.serialize=({value:r})=>{const n=t({value:r});return r.response&&(n[0].value.response=r.response),r.source&&(n[0].value.source=r.source),n}}function Vi(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:Vi(t[r]);case"undefined":case"number":case"string":return t[r];default:return qi(t[r])}}})}async function zi({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new Rr,disableProgressBar:s,onBlueprintStepCompleted:i,onClientConnected:c=()=>{},sapiName:o,onBeforeBlueprint:u,siteSlug:d}){if($l(r),gl(e),r=Wr(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t){const v=await As(e,Wr(r,{"php-extension":"kitchen-sink","site-slug":d}),n);return c(v),v}const f=Ii(t,{progress:n.stage(.5),onStepCompleted:i}),p=await As(e,Wr(r,{php:f.versions.php,wp:f.versions.wp,"sapi-name":o,"php-extension":f.phpExtensions,networking:f.features.networking?"yes":"no","site-slug":d}),n);return mo(Pe,p),c(p),u&&await u(),await ji(f,p),n.finish(),p}function gl(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function As(e,t,r){await new Promise(i=>{e.src=t,e.addEventListener("load",i,!1)});const n=Ui(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const fr="https://playground.wordpress.net";function $l(e){const t=new URL(e,fr);if((t.origin===fr||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${fr}/remote.html.`)}function Wr(e,t){const r=new URL(e,fr),n=new URLSearchParams(r.search);for(const[s,i]of Object.entries(t))if(i!=null&&i!==!1)if(Array.isArray(i))for(const c of i)n.append(s,c.toString());else n.set(s,i.toString());return r.search=n.toString(),r.toString()}async function _l(e,t){if(Pe.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return zi({iframe:e,remoteUrl:t.loadRemote});const r=Ui(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=ui;exports.SupportedPHPVersions=kr;exports.SupportedPHPVersionsList=Do;exports.activatePlugin=Pr;exports.activateTheme=rn;exports.compileBlueprint=Ii;exports.connectPlayground=_l;exports.cp=Gs;exports.defineSiteUrl=an;exports.defineWpConfigConsts=Ut;exports.enableMultisite=Bs;exports.exportWXR=Xs;exports.importWordPressFiles=Zs;exports.importWxr=Ys;exports.installPlugin=ti;exports.installTheme=ri;exports.login=hr;exports.mkdir=Js;exports.mv=Ks;exports.phpVar=ge;exports.phpVars=Wt;exports.request=pr;exports.resetData=ni;exports.rm=nn;exports.rmdir=Qs;exports.runBlueprintSteps=ji;exports.runPHP=Vs;exports.runPHPWithOptions=zs;exports.runSql=Ws;exports.runWpInstallationWizard=si;exports.setPhpIniEntries=Ao;exports.setPluginProxyURL=rl;exports.setSiteOptions=sn;exports.startPlaygroundWeb=zi;exports.unzip=Sr;exports.updateUserMeta=Hs;exports.wpCLI=oi;exports.wpContentFilesExcludedFromExport=tn;exports.writeFile=on;exports.zipWpContent=ii;
|