@wp-playground/blueprints 0.6.9 → 0.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var H=(e,t,r)=>(Nt(e,t,"read from private field"),r?r.call(e):t.get(e)),Q=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},te=(e,t,r,n)=>(Nt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var ce=(e,t,r)=>(Nt(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const currentJsRuntime=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(currentJsRuntime==="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,o){super(s);let l;o!=null&&o.lastModified&&(l=new Date),(!l||isNaN(l.getFullYear()))&&(l=new Date),this.lastModifiedDate=l,this.lastModified=l.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,l=await n.slice(r,r+i.byteLength).arrayBuffer(),d=new Uint8Array(l);new Uint8Array(i.buffer).set(d);const u=d.byteLength;s.byobRequest.respond(u),r+=u,r>=n.size&&s.close()}})})}if(currentJsRuntime==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const wpContentFilesExcludedFromExport=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/export-wxz.php","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"];class Semaphore{constructor({concurrency:t}){this._running=0,this.concurrency=t,this.queue=[]}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency)await new Promise(t=>this.queue.push(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 joinPaths(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=normalizePath(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function dirname(e){if(e==="/")return"/";e=normalizePath(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function normalizePath(e){const t=e[0]==="/";return e=normalizePathsArray(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function normalizePathsArray(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 splitShellCommand$1(e){let n=0,s="";const i=[];let o="";for(let l=0;l<e.length;l++){const d=e[l];d==="\\"?((e[l+1]==='"'||e[l+1]==="'")&&l++,o+=e[l]):n===0?d==='"'||d==="'"?(n=1,s=d):d.match(/\s/)?(o.trim().length&&i.push(o.trim()),o=d):i.length&&!o?o=i.pop()+d:o+=d:n===1&&(d===s?(n=0,s=""):o+=d)}return o&&i.push(o.trim()),i}function createSpawnHandler(e){return function(t,r=[],n={}){const s=new ChildProcess,i=new ProcessApi(s);return setTimeout(async()=>{let o=[];if(r.length)o=[t,...r];else if(typeof t=="string")o=splitShellCommand$1(t);else if(Array.isArray(t))o=t;else throw new Error("Invalid command ",t);await e(o,i,n),s.emit("spawn",!0)}),s}}class EventEmitter{constructor(){this.listeners={}}emit(t,r){this.listeners[t]&&this.listeners[t].forEach(function(n){n(r)})}on(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)}}class ProcessApi extends EventEmitter{constructor(t){super(),this.childProcess=t,this.exited=!1,this.stdinData=[],t.on("stdin",r=>{this.stdinData?this.stdinData.push(r.slice()):this.emit("stdin",r)})}stdout(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stdout.emit("data",t)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stderr.emit("data",t)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(t){this.exited||(this.exited=!0,this.childProcess.emit("exit",t))}flushStdin(){if(this.stdinData)for(let t=0;t<this.stdinData.length;t++)this.emit("stdin",this.stdinData[t]);this.stdinData=null}}let lastPid=9743;class ChildProcess extends EventEmitter{constructor(t=lastPid++){super(),this.pid=t,this.stdout=new EventEmitter,this.stderr=new EventEmitter;const r=this;this.stdin={write:n=>{r.emit("stdin",n)}}}}function randomString(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 randomFilename(){return randomString(36,"-_")}function phpVar(e){return`json_decode(base64_decode('${stringToBase64(JSON.stringify(e))}'), true)`}function phpVars(e){const t={};for(const r in e)t[r]=phpVar(e[r]);return t}function stringToBase64(e){return bytesToBase64(new TextEncoder().encode(e))}function bytesToBase64(e){const t=String.fromCodePoint(...e);return btoa(t)}const activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot;await e.run({code:`<?php
1
+ "use strict";var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var H=(e,t,r)=>(Nt(e,t,"read from private field"),r?r.call(e):t.get(e)),Q=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},te=(e,t,r,n)=>(Nt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var ce=(e,t,r)=>(Nt(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const currentJsRuntime=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(currentJsRuntime==="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,o){super(s);let l;o!=null&&o.lastModified&&(l=new Date),(!l||isNaN(l.getFullYear()))&&(l=new Date),this.lastModifiedDate=l,this.lastModified=l.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,l=await n.slice(r,r+i.byteLength).arrayBuffer(),d=new Uint8Array(l);new Uint8Array(i.buffer).set(d);const u=d.byteLength;s.byobRequest.respond(u),r+=u,r>=n.size&&s.close()}})})}if(currentJsRuntime==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const wpContentFilesExcludedFromExport=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"];class Semaphore{constructor({concurrency:t}){this._running=0,this.concurrency=t,this.queue=[]}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency)await new Promise(t=>this.queue.push(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 joinPaths(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=normalizePath(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function dirname(e){if(e==="/")return"/";e=normalizePath(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function normalizePath(e){const t=e[0]==="/";return e=normalizePathsArray(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function normalizePathsArray(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 splitShellCommand$1(e){let n=0,s="";const i=[];let o="";for(let l=0;l<e.length;l++){const d=e[l];d==="\\"?((e[l+1]==='"'||e[l+1]==="'")&&l++,o+=e[l]):n===0?d==='"'||d==="'"?(n=1,s=d):d.match(/\s/)?(o.trim().length&&i.push(o.trim()),o=d):i.length&&!o?o=i.pop()+d:o+=d:n===1&&(d===s?(n=0,s=""):o+=d)}return o&&i.push(o.trim()),i}function createSpawnHandler(e){return function(t,r=[],n={}){const s=new ChildProcess,i=new ProcessApi(s);return setTimeout(async()=>{let o=[];if(r.length)o=[t,...r];else if(typeof t=="string")o=splitShellCommand$1(t);else if(Array.isArray(t))o=t;else throw new Error("Invalid command ",t);await e(o,i,n),s.emit("spawn",!0)}),s}}class EventEmitter{constructor(){this.listeners={}}emit(t,r){this.listeners[t]&&this.listeners[t].forEach(function(n){n(r)})}on(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)}}class ProcessApi extends EventEmitter{constructor(t){super(),this.childProcess=t,this.exited=!1,this.stdinData=[],t.on("stdin",r=>{this.stdinData?this.stdinData.push(r.slice()):this.emit("stdin",r)})}stdout(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stdout.emit("data",t)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stderr.emit("data",t)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(t){this.exited||(this.exited=!0,this.childProcess.emit("exit",t))}flushStdin(){if(this.stdinData)for(let t=0;t<this.stdinData.length;t++)this.emit("stdin",this.stdinData[t]);this.stdinData=null}}let lastPid=9743;class ChildProcess extends EventEmitter{constructor(t=lastPid++){super(),this.pid=t,this.stdout=new EventEmitter,this.stderr=new EventEmitter;const r=this;this.stdin={write:n=>{r.emit("stdin",n)}}}}function randomString(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 randomFilename(){return randomString(36,"-_")}function phpVar(e){return`json_decode(base64_decode('${stringToBase64(JSON.stringify(e))}'), true)`}function phpVars(e){const t={};for(const r in e)t[r]=phpVar(e[r]);return t}function stringToBase64(e){return bytesToBase64(new TextEncoder().encode(e))}function bytesToBase64(e){const t=String.fromCodePoint(...e);return btoa(t)}const activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot;await e.run({code:`<?php
2
2
  define( 'WP_ADMIN', true );
3
3
  require_once( ${phpVar(s)}. "/wp-load.php" );
4
4
  require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
@@ -427,16 +427,33 @@ foreach($plugins as $plugin_path) {
427
427
  }
428
428
  }
429
429
  echo json_encode($deactivated_plugins);
430
- `})).json,d=(O=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:O[1],u=await request(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:jsonToUrlEncoded({_wpnonce:d,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(u.httpStatusCode!==200)throw console.warn("WordPress response was",{response:u,text:u.text,headers:u.headers}),new Error(`Failed to enable multisite. Response code was ${u.httpStatusCode}`);await defineWpConfigConsts(e,{consts:{SUNRISE:"on",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 p=new URL(await e.absoluteUrl),$=isURLScoped(p)?"scope:"+getURLScope(p):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`<?php
430
+ `})).json,d=(O=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:O[1],u=await request(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:jsonToUrlEncoded({_wpnonce:d,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(u.httpStatusCode!==200)throw console.warn("WordPress response was",{response:u,text:u.text,headers:u.headers}),new Error(`Failed to enable multisite. Response code was ${u.httpStatusCode}`);await defineWpConfigConsts(e,{consts:{SUNRISE:"on",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 p=new URL(await e.absoluteUrl),g=isURLScoped(p)?"scope:"+getURLScope(p):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`<?php
431
431
  if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
432
432
  define( 'BLOG_ID_CURRENT_SITE', 1 );
433
433
  }
434
- $folder = ${phpVar($)};
434
+ $folder = ${phpVar(g)};
435
435
  if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
436
436
  $_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
437
437
  $_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
438
438
  }
439
- `),await login(e,{});for(const N of o)await activatePlugin(e,{pluginPath:N})};function jsonToUrlEncoded(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importFile=async(e,{file:t},r)=>{var u,p;(u=r==null?void 0:r.tracker)==null||u.setCaption("Importing content");const n=await e.request({url:"/wp-admin/admin.php?import=wordpress"}),s=(p=DOM(n).getElementById("import-upload-form"))==null?void 0:p.getAttribute("action"),i=await e.request({url:`/wp-admin/${s}`,method:"POST",body:{import:t}}),o=DOM(i).querySelector("#wpbody-content form");if(!o)throw console.log(i.text),new Error("Could not find an importer form in response. See the response text above for details.");const l=getFormData(o);l.fetch_attachments="1";for(const $ in l)if($.startsWith("user_map[")){const O="user_new["+$.slice(9,-1)+"]";l[O]="1"}const d=await e.request({url:o.action,method:"POST",body:l});if(!d.text.includes("All done."))throw console.warn("WordPress response was: ",{text:d.text,errors:d.errors}),new Error("Import failed, see console for details.")};function DOM(e){return new DOMParser().parseFromString(e.text,"text/html")}function getFormData(e){return Object.fromEntries(new FormData(e).entries())}const zipFunctions=`<?php
439
+ `),await login(e,{});for(const N of o)await activatePlugin(e,{pluginPath:N})};function jsonToUrlEncoded(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importWxr=async(e,{file:t},r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Importing content"),await writeFile(e,{path:"/tmp/import.wxr",data:t});const n=await e.documentRoot;await e.run({code:`<?php
440
+ require ${phpVar(n)} . '/wp-load.php';
441
+ kses_remove_filters();
442
+ $admin_id = get_users(array('role' => 'Administrator') )[0];
443
+ $importer = new WXR_Importer( array(
444
+ 'fetch_attachments' => true,
445
+ 'default_author' => $admin_id
446
+ ) );
447
+ $logger = new WP_Importer_Logger_CLI();
448
+ $importer->set_logger( $logger );
449
+
450
+ // Slashes from the imported content are lost if we don't call wp_slash here.
451
+ add_action( 'wp_insert_post_data', function( $data ) {
452
+ return wp_slash($data);
453
+ });
454
+
455
+ $result = $importer->import( '/tmp/import.wxr' );
456
+ `})},zipFunctions=`<?php
440
457
 
441
458
  function zipDir($root, $output, $options = array())
442
459
  {
@@ -519,10 +536,10 @@ function delTree($dir)
519
536
  }
520
537
  return rmdir($dir);
521
538
  }
522
- `;async function runPhpWithZipFunctions(e,t){return await e.run({code:zipFunctions+t})}const tmpPath="/tmp/file.zip",unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)await e.writeFile(tmpPath,await e.readFileAsBuffer(r)),console.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(t)await e.writeFile(tmpPath,new Uint8Array(await t.arrayBuffer()));else throw new Error("Either zipPath or zipFile must be provided");const s=phpVars({zipPath:tmpPath,extractToPath:n});await runPhpWithZipFunctions(e,`unzip(${s.zipPath}, ${s.extractToPath});`),e.fileExists(tmpPath)&&await e.unlink(tmpPath)},importWordPressFiles=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=joinPaths("/tmp","import");await e.mkdir(s),await unzip(e,{zipFile:t,extractToPath:s}),s=joinPaths(s,r);const i=joinPaths(s,"wp-content"),o=joinPaths(n,"wp-content");for(const p of wpContentFilesExcludedFromExport){const $=joinPaths(i,p);await removePath(e,$);const O=joinPaths(o,p);await e.fileExists(O)&&(await e.mkdir(dirname($)),await e.mv(O,$))}const l=joinPaths(s,"wp-content","database");await e.fileExists(l)||await e.mv(joinPaths(n,"wp-content","database"),l);const d=await e.listFiles(s);for(const p of d)await removePath(e,joinPaths(n,p)),await e.mv(joinPaths(s,p),joinPaths(n,p));await e.rmdir(s),await defineSiteUrl(e,{siteUrl:await e.absoluteUrl});const u=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({code:`<?php
539
+ `;async function runPhpWithZipFunctions(e,t){return await e.run({code:zipFunctions+t})}const tmpPath="/tmp/file.zip",unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)await e.writeFile(tmpPath,await e.readFileAsBuffer(r)),console.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(t)await e.writeFile(tmpPath,new Uint8Array(await t.arrayBuffer()));else throw new Error("Either zipPath or zipFile must be provided");const s=phpVars({zipPath:tmpPath,extractToPath:n});await runPhpWithZipFunctions(e,`unzip(${s.zipPath}, ${s.extractToPath});`),e.fileExists(tmpPath)&&await e.unlink(tmpPath)},importWordPressFiles=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=joinPaths("/tmp","import");await e.mkdir(s),await unzip(e,{zipFile:t,extractToPath:s}),s=joinPaths(s,r);const i=joinPaths(s,"wp-content"),o=joinPaths(n,"wp-content");for(const p of wpContentFilesExcludedFromExport){const g=joinPaths(i,p);await removePath(e,g);const O=joinPaths(o,p);await e.fileExists(O)&&(await e.mkdir(dirname(g)),await e.mv(O,g))}const l=joinPaths(s,"wp-content","database");await e.fileExists(l)||await e.mv(joinPaths(n,"wp-content","database"),l);const d=await e.listFiles(s);for(const p of d)await removePath(e,joinPaths(n,p)),await e.mv(joinPaths(s,p),joinPaths(n,p));await e.rmdir(s),await defineSiteUrl(e,{siteUrl:await e.absoluteUrl});const u=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({code:`<?php
523
540
  $_GET['step'] = 'upgrade_db';
524
541
  require ${u};
525
- `})};async function removePath(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function exportWXR(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function exportWXZ(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all&export_wxz=1"});return new File([t.bytes],"export.wxz")}async function installAsset(e,{targetPath:t,zipFile:r}){const s=r.name.replace(/\.zip$/,""),i=joinPaths(await e.documentRoot,"wp-content"),o=joinPaths(i,randomString()),l=joinPaths(o,"assets",s);await e.fileExists(l)&&await e.rmdir(o,{recursive:!0}),await e.mkdir(o);try{await unzip(e,{zipFile:r,extractToPath:l});let d=await e.listFiles(l,{prependPath:!0});d=d.filter(N=>!N.endsWith("/__MACOSX"));const u=d.length===1&&await e.isDir(d[0]);let p,$="";u?($=d[0],p=d[0].split("/").pop()):($=l,p=s);const O=`${t}/${p}`;return await e.mv($,O),{assetFolderPath:O,assetFolderName:p}}finally{await e.rmdir(o,{recursive:!0})}}function zipNameToHumanName(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const installPlugin=async(e,{pluginZipFile:t,options:r={}},n)=>{const s=t.name.split("/").pop()||"plugin.zip",i=zipNameToHumanName(s);n==null||n.tracker.setCaption(`Installing the ${i} plugin`);const{assetFolderPath:o}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in r?r.activate:!0)&&await activatePlugin(e,{pluginPath:o,pluginName:i},n)},installTheme=async(e,{themeZipFile:t,options:r={}},n)=>{const s=zipNameToHumanName(t.name);n==null||n.tracker.setCaption(`Installing the ${s} theme`);const{assetFolderName:i}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in r?r.activate:!0)&&await activateTheme(e,{themeFolderName:i},n)},runWpInstallationWizard=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"}})},zipWpContent=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=joinPaths(n,"wp-content");let i=wpContentFilesExcludedFromExport;t&&(i=i.filter(d=>!d.startsWith("themes/twenty")).filter(d=>d!=="mu-plugins/sqlite-database-integration"));const o=phpVars({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(d=>joinPaths(n,"wp-content",d)),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${o.wpContentPath}, ${o.zipPath}, array(
542
+ `})};async function removePath(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function exportWXR(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function installAsset(e,{targetPath:t,zipFile:r}){const s=r.name.replace(/\.zip$/,""),i=joinPaths(await e.documentRoot,"wp-content"),o=joinPaths(i,randomString()),l=joinPaths(o,"assets",s);await e.fileExists(l)&&await e.rmdir(o,{recursive:!0}),await e.mkdir(o);try{await unzip(e,{zipFile:r,extractToPath:l});let d=await e.listFiles(l,{prependPath:!0});d=d.filter(N=>!N.endsWith("/__MACOSX"));const u=d.length===1&&await e.isDir(d[0]);let p,g="";u?(g=d[0],p=d[0].split("/").pop()):(g=l,p=s);const O=`${t}/${p}`;return await e.mv(g,O),{assetFolderPath:O,assetFolderName:p}}finally{await e.rmdir(o,{recursive:!0})}}function zipNameToHumanName(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const installPlugin=async(e,{pluginZipFile:t,options:r={}},n)=>{const s=t.name.split("/").pop()||"plugin.zip",i=zipNameToHumanName(s);n==null||n.tracker.setCaption(`Installing the ${i} plugin`);const{assetFolderPath:o}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in r?r.activate:!0)&&await activatePlugin(e,{pluginPath:o,pluginName:i},n)},installTheme=async(e,{themeZipFile:t,options:r={}},n)=>{const s=zipNameToHumanName(t.name);n==null||n.tracker.setCaption(`Installing the ${s} theme`);const{assetFolderName:i}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in r?r.activate:!0)&&await activateTheme(e,{themeFolderName:i},n)},runWpInstallationWizard=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"}})},zipWpContent=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=joinPaths(n,"wp-content");let i=wpContentFilesExcludedFromExport;t&&(i=i.filter(d=>!d.startsWith("themes/twenty")).filter(d=>d!=="mu-plugins/sqlite-database-integration"));const o=phpVars({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(d=>joinPaths(n,"wp-content",d)),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${o.wpContentPath}, ${o.zipPath}, array(
526
543
  'exclude_paths' => ${o.exceptPaths},
527
544
  'zip_root' => ${o.documentRoot},
528
545
  'additional_paths' => ${o.additionalPaths}
@@ -548,7 +565,7 @@ function delTree($dir)
548
565
  define('STDERR', fopen('/tmp/stderr', 'wb'));
549
566
 
550
567
  require( ${phpVar(r)} );
551
- `);const i=await e.run({scriptPath:"/wordpress/run-cli.php"});if(i.errors)throw new Error(i.errors);return i};function splitShellCommand(e){let n=0,s="";const i=[];let o="";for(let l=0;l<e.length;l++){const d=e[l];n===0?d==='"'||d==="'"?(n=1,s=d):d.match(/\s/)?(o&&i.push(o),o=""):o+=d:n===1&&(d==="\\"?(l++,o+=e[l]):d===s?(n=0,s=""):o+=d)}return o&&i.push(o),i}const allStepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,cp,defineSiteUrl,defineWpConfigConsts,enableMultisite,exportWXR,exportWXZ,importFile,importWordPressFiles,installPlugin,installTheme,login,mkdir,mv,request,rm,rmdir,runPHP,runPHPWithOptions,runSql,runWpInstallationWizard,setPhpIniEntry,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(i,o){t(new CustomEvent("progress",{detail:{loaded:i,total:o}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const o=e.body.getReader();let l=0;for(;;)try{const{done:d,value:u}=await o.read();if(u&&(l+=u.byteLength),d){s(l,l),i.close();break}else s(l,n),i.enqueue(u)}catch(d){console.error({e:d}),i.error(d);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 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 i;try{return n(...s)}catch(o){if(!(o instanceof Error))throw o;const l=clarifyErrorMessage(o,(i=e.lastAsyncifyStackSource)==null?void 0:i.stack);if(e.lastAsyncifyStackSource&&(o.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:o,message:l}));return}throw isExitCodeZero(o)||showCriticalErrorBox(l),o}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
568
+ `);const i=await e.run({scriptPath:"/wordpress/run-cli.php"});if(i.errors)throw new Error(i.errors);return i};function splitShellCommand(e){let n=0,s="";const i=[];let o="";for(let l=0;l<e.length;l++){const d=e[l];n===0?d==='"'||d==="'"?(n=1,s=d):d.match(/\s/)?(o&&i.push(o),o=""):o+=d:n===1&&(d==="\\"?(l++,o+=e[l]):d===s?(n=0,s=""):o+=d)}return o&&i.push(o),i}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,setPhpIniEntry,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(i,o){t(new CustomEvent("progress",{detail:{loaded:i,total:o}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const o=e.body.getReader();let l=0;for(;;)try{const{done:d,value:u}=await o.read();if(u&&(l+=u.byteLength),d){s(l,l),i.close();break}else s(l,n),i.enqueue(u)}catch(d){console.error({e:d}),i.error(d);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 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 i;try{return n(...s)}catch(o){if(!(o instanceof Error))throw o;const l=clarifyErrorMessage(o,(i=e.lastAsyncifyStackSource)==null?void 0:i.stack);if(e.lastAsyncifyStackSource&&(o.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:o,message:l}));return}throw isExitCodeZero(o)||showCriticalErrorBox(l),o}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
552
569
 
553
570
  This stack trace is lacking. For a better one initialize
554
571
  the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
@@ -582,13 +599,13 @@ CLI option:
582
599
  ${eol}
583
600
  ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
584
601
  `))console.log(`${eol} ${t} `);console.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split(`
585
- `).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[]}}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]);class PHPResponse{constructor(t,r,n,s="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,this.errors=s}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 SupportedPHPVersions=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],LatestSupportedPHPVersion=SupportedPHPVersions[0],SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList};var Ae,Ge;class PHPBrowser{constructor(t,r={}){Q(this,Ae,void 0);Q(this,Ge,void 0);this.requestHandler=t,te(this,Ae,{}),te(this,Ge,{handleRedirects:!1,maxRedirects:4,...r})}async request(t,r=0){const n=await this.requestHandler.request({...t,headers:{...t.headers,cookie:this.serializeCookies()}});if(n.headers["set-cookie"]&&this.setCookies(n.headers["set-cookie"]),H(this,Ge).handleRedirects&&n.headers.location&&r<H(this,Ge).maxRedirects){const s=new URL(n.headers.location[0],this.requestHandler.absoluteUrl);return this.request({url:s.toString(),method:"GET",headers:{}},r+1)}return n}pathToInternalUrl(t){return this.requestHandler.pathToInternalUrl(t)}internalUrlToPath(t){return this.requestHandler.internalUrlToPath(t)}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}setCookies(t){for(const r of t)try{if(!r.includes("="))continue;const n=r.indexOf("="),s=r.substring(0,n),i=r.substring(n+1).split(";")[0];H(this,Ae)[s]=i}catch(n){console.error(n)}}serializeCookies(){const t=[];for(const r in H(this,Ae))t.push(`${r}=${H(this,Ae)[r]}`);return t.join("; ")}}Ae=new WeakMap,Ge=new WeakMap;const DEFAULT_BASE_URL="http://example.com";function toRelativeUrl(e){return e.toString().substring(e.origin.length)}function removePathPrefix(e,t){return!t||!e.startsWith(t)?e:e.substring(t.length)}function ensurePathPrefix(e,t){return!t||e.startsWith(t)?e:t+e}async function encodeAsMultipart(e){const t=`----${Math.random().toString(36).slice(2)}`,r=`multipart/form-data; boundary=${t}`,n=new TextEncoder,s=[];for(const[d,u]of Object.entries(e))s.push(`--${t}\r
602
+ `).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[]}}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]);class PHPResponse{constructor(t,r,n,s="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,this.errors=s}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 SupportedPHPVersions=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],LatestSupportedPHPVersion=SupportedPHPVersions[0],SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList,light:[]};var Ae,Ge;class PHPBrowser{constructor(t,r={}){Q(this,Ae,void 0);Q(this,Ge,void 0);this.requestHandler=t,te(this,Ae,{}),te(this,Ge,{handleRedirects:!1,maxRedirects:4,...r})}async request(t,r=0){const n=await this.requestHandler.request({...t,headers:{...t.headers,cookie:this.serializeCookies()}});if(n.headers["set-cookie"]&&this.setCookies(n.headers["set-cookie"]),H(this,Ge).handleRedirects&&n.headers.location&&r<H(this,Ge).maxRedirects){const s=new URL(n.headers.location[0],this.requestHandler.absoluteUrl);return this.request({url:s.toString(),method:"GET",headers:{}},r+1)}return n}pathToInternalUrl(t){return this.requestHandler.pathToInternalUrl(t)}internalUrlToPath(t){return this.requestHandler.internalUrlToPath(t)}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}setCookies(t){for(const r of t)try{if(!r.includes("="))continue;const n=r.indexOf("="),s=r.substring(0,n),i=r.substring(n+1).split(";")[0];H(this,Ae)[s]=i}catch(n){console.error(n)}}serializeCookies(){const t=[];for(const r in H(this,Ae))t.push(`${r}=${H(this,Ae)[r]}`);return t.join("; ")}}Ae=new WeakMap,Ge=new WeakMap;const DEFAULT_BASE_URL="http://example.com";function toRelativeUrl(e){return e.toString().substring(e.origin.length)}function removePathPrefix(e,t){return!t||!e.startsWith(t)?e:e.substring(t.length)}function ensurePathPrefix(e,t){return!t||e.startsWith(t)?e:t+e}async function encodeAsMultipart(e){const t=`----${Math.random().toString(36).slice(2)}`,r=`multipart/form-data; boundary=${t}`,n=new TextEncoder,s=[];for(const[d,u]of Object.entries(e))s.push(`--${t}\r
586
603
  `),s.push(`Content-Disposition: form-data; name="${d}"`),u instanceof File&&s.push(`; filename="${u.name}"`),s.push(`\r
587
604
  `),u instanceof File&&(s.push("Content-Type: application/octet-stream"),s.push(`\r
588
605
  `)),s.push(`\r
589
606
  `),u instanceof File?s.push(await fileToUint8Array(u)):s.push(u),s.push(`\r
590
607
  `);s.push(`--${t}--\r
591
- `);const i=s.reduce((d,u)=>d+u.length,0),o=new Uint8Array(i);let l=0;for(const d of s)o.set(typeof d=="string"?n.encode(d):d,l),l+=d.length;return{bytes:o,contentType:r}}function fileToUint8Array(e){return new Promise(t=>{const r=new FileReader;r.onload=()=>{t(new Uint8Array(r.result))},r.readAsArrayBuffer(e)})}var Pe,Ke,dt,De,Je,ve,Qe,Fe,mt,zt,_t,Wt,$t,Bt;class PHPRequestHandler{constructor(t,r={}){Q(this,mt);Q(this,_t);Q(this,$t);Q(this,Pe,void 0);Q(this,Ke,void 0);Q(this,dt,void 0);Q(this,De,void 0);Q(this,Je,void 0);Q(this,ve,void 0);Q(this,Qe,void 0);Q(this,Fe,void 0);te(this,Fe,new Semaphore({concurrency:1}));const{documentRoot:n="/www/",absoluteUrl:s=typeof location=="object"?location==null?void 0:location.href:"",rewriteRules:i=[]}=r;this.php=t,te(this,Pe,n);const o=new URL(s);te(this,dt,o.hostname),te(this,De,o.port?Number(o.port):o.protocol==="https:"?443:80),te(this,Ke,(o.protocol||"").replace(":",""));const l=H(this,De)!==443&&H(this,De)!==80;te(this,Je,[H(this,dt),l?`:${H(this,De)}`:""].join("")),te(this,ve,o.pathname.replace(/\/+$/,"")),te(this,Qe,[`${H(this,Ke)}://`,H(this,Je),H(this,ve)].join("")),this.rewriteRules=i}pathToInternalUrl(t){return`${this.absoluteUrl}${t}`}internalUrlToPath(t){const r=new URL(t);return r.pathname.startsWith(H(this,ve))&&(r.pathname=r.pathname.slice(H(this,ve).length)),toRelativeUrl(r)}get isRequestRunning(){return H(this,Fe).running>0}get absoluteUrl(){return H(this,Qe)}get documentRoot(){return H(this,Pe)}async request(t){const r=t.url.startsWith("http://")||t.url.startsWith("https://"),n=new URL(t.url.split("#")[0],r?void 0:DEFAULT_BASE_URL),s=applyRewriteRules(removePathPrefix(n.pathname,H(this,ve)),this.rewriteRules),i=`${H(this,Pe)}${s}`;return seemsLikeAPHPRequestHandlerPath(i)?await ce(this,_t,Wt).call(this,t,n):ce(this,mt,zt).call(this,i)}}Pe=new WeakMap,Ke=new WeakMap,dt=new WeakMap,De=new WeakMap,Je=new WeakMap,ve=new WeakMap,Qe=new WeakMap,Fe=new WeakMap,mt=new WeakSet,zt=function(t){if(!this.php.fileExists(t))return new PHPResponse(404,{"x-file-type":["static"]},new TextEncoder().encode("404 File not found"));const r=this.php.readFileAsBuffer(t);return new PHPResponse(200,{"content-length":[`${r.byteLength}`],"content-type":[inferMimeType(t)],"accept-ranges":["bytes"],"cache-control":["public, max-age=0"]},r)},_t=new WeakSet,Wt=async function(t,r){var s;if(H(this,Fe).running>0&&((s=t.headers)==null?void 0:s["x-request-issuer"])==="php")return console.warn("Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."),new PHPResponse(502,{},new TextEncoder().encode("502 Bad Gateway"));const n=await H(this,Fe).acquire();try{this.php.addServerGlobalEntry("REMOTE_ADDR","127.0.0.1"),this.php.addServerGlobalEntry("DOCUMENT_ROOT",H(this,Pe)),this.php.addServerGlobalEntry("HTTPS",H(this,Qe).startsWith("https://")?"on":"");let i="GET";const o={host:H(this,Je),...normalizeHeaders(t.headers||{})};let l=t.body;if(typeof l=="object"&&!(l instanceof Uint8Array)){i="POST";const{bytes:u,contentType:p}=await encodeAsMultipart(l);l=u,o["content-type"]=p}let d;try{d=ce(this,$t,Bt).call(this,r.pathname)}catch{return new PHPResponse(404,{},new TextEncoder().encode("404 File not found"))}return await this.php.run({relativeUri:ensurePathPrefix(toRelativeUrl(r),H(this,ve)),protocol:H(this,Ke),method:t.method||i,body:l,scriptPath:d,headers:o})}finally{n()}},$t=new WeakSet,Bt=function(t){let r=removePathPrefix(t,H(this,ve));r=applyRewriteRules(r,this.rewriteRules),r.includes(".php")?r=r.split(".php")[0]+".php":this.php.isDir(`${H(this,Pe)}${r}`)?(r.endsWith("/")||(r=`${r}/`),r=`${r}index.php`):r="/index.php";const n=`${H(this,Pe)}${r}`;if(this.php.fileExists(n))return n;throw new Error(`File not found: ${n}`)};function inferMimeType(e){switch(e.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}function seemsLikeAPHPRequestHandlerPath(e){return seemsLikeAPHPFile(e)||seemsLikeADirectoryRoot(e)}function seemsLikeAPHPFile(e){return e.endsWith(".php")||e.includes(".php/")}function seemsLikeADirectoryRoot(e){return!e.split("/").pop().includes(".")}function applyRewriteRules(e,t){for(const r of t)if(new RegExp(r.match).test(e))return e.replace(r.match,r.replacement);return e}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 i=s.value;s.value=function(...o){try{return i.apply(this,o)}catch(l){const d=typeof l=="object"?l==null?void 0:l.errno:null;if(d in FileErrorCodes){const u=FileErrorCodes[d],p=typeof o[0]=="string"?o[0]:null,$=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${$}: ${u}`,{cause:l})}throw l}}}}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"})();var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");var Me,Ze,Ye,be,Re,Te,Ee,Xe,gt,Gt,yt,Kt,vt,Jt,wt,Qt,Pt,Zt,bt,Yt,Et,Xt,St,er,Rt,tr,Tt,rr,kt,nr,Ot,sr;class BasePHP{constructor(e,t){Q(this,gt);Q(this,yt);Q(this,vt);Q(this,wt);Q(this,Pt);Q(this,bt);Q(this,Et);Q(this,St);Q(this,Rt);Q(this,Tt);Q(this,kt);Q(this,Ot);Q(this,Me,void 0);Q(this,Ze,void 0);Q(this,Ye,void 0);Q(this,be,void 0);Q(this,Re,void 0);Q(this,Te,void 0);Q(this,Ee,void 0);Q(this,Xe,void 0);te(this,Me,[]),te(this,be,!1),te(this,Re,null),te(this,Te,{}),te(this,Ee,new Map),te(this,Xe,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e),t&&(this.requestHandler=new PHPBrowser(new PHPRequestHandler(this,t)))}addEventListener(e,t){H(this,Ee).has(e)||H(this,Ee).set(e,new Set),H(this,Ee).get(e).add(t)}removeEventListener(e,t){var r;(r=H(this,Ee).get(e))==null||r.delete(t)}dispatchEvent(e){const t=H(this,Ee).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){H(this,Xe).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.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,t.onMessage=async r=>{for(const n of H(this,Xe)){const s=await n(r);if(s)return s}return""},te(this,Re,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?");te(this,Ye,e)}setPhpIniPath(e){if(H(this,be))throw new Error("Cannot set PHP ini path after calling run().");te(this,Ze,e),this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[e])}setPhpIniEntry(e,t){if(H(this,be))throw new Error("Cannot set PHP ini entries after calling run().");H(this,Me).push([e,t])}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e,t){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e,t)}async run(e){const t=await this.semaphore.acquire();let r;try{if(H(this,be)||(ce(this,gt,Gt).call(this),te(this,be,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ce(this,St,er).call(this,e.scriptPath||""),ce(this,vt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Zt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443";ce(this,wt,Qt).call(this,s,e.protocol||"http"),ce(this,bt,Yt).call(this,n),e.body&&(r=ce(this,Et,Xt).call(this,e.body)),typeof e.code=="string"&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const i=e.env||{};for(const l in i)ce(this,Tt,rr).call(this,l,i[l]);const o=await ce(this,Ot,sr).call(this);if(o.exitCode!==0){const l={stdout:o.text,stderr:o.errors};console.warn("PHP.run() output was:",l);const d=new Error(`PHP.run() failed with exit code ${o.exitCode} and the following output: `+o.errors);throw d.output=l,d.source="request",console.error(d),d}return o}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"})}}}addServerGlobalEntry(e,t){H(this,Te)[e]=t}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/consts.json")&&this.readFileAsText("/internal/consts.json")||"{}")}catch{}this.writeFile("/internal/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){try{this[__private__dont__use].FS.rename(e,t)}catch(r){const n=getEmscriptenFsError(r);throw n?new Error(`Could not move ${e} to ${t}: ${n}`,{cause:r}):r}}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 console.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){const t=this[__private__dont__use].FS;try{this.exit()}catch{}if(this.initializeRuntime(e),H(this,Ze)&&this.setPhpIniPath(H(this,Ze)),H(this,Ye)&&this.setSapiName(H(this,Ye)),this.requestHandler){const r=this.documentRoot;copyFS(t,this[__private__dont__use].FS,r)}}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}te(this,be,!1),te(this,Re,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}}Me=new WeakMap,Ze=new WeakMap,Ye=new WeakMap,be=new WeakMap,Re=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Xe=new WeakMap,gt=new WeakSet,Gt=function(){if(this.setPhpIniEntry("auto_prepend_file","/internal/consts.php"),this.fileExists("/internal/consts.php")||this.writeFile("/internal/consts.php",`<?php
608
+ `);const i=s.reduce((d,u)=>d+u.length,0),o=new Uint8Array(i);let l=0;for(const d of s)o.set(typeof d=="string"?n.encode(d):d,l),l+=d.length;return{bytes:o,contentType:r}}function fileToUint8Array(e){return new Promise(t=>{const r=new FileReader;r.onload=()=>{t(new Uint8Array(r.result))},r.readAsArrayBuffer(e)})}var Pe,Ke,dt,De,Je,ve,Qe,Fe,mt,zt,_t,Wt,gt,Bt;class PHPRequestHandler{constructor(t,r={}){Q(this,mt);Q(this,_t);Q(this,gt);Q(this,Pe,void 0);Q(this,Ke,void 0);Q(this,dt,void 0);Q(this,De,void 0);Q(this,Je,void 0);Q(this,ve,void 0);Q(this,Qe,void 0);Q(this,Fe,void 0);te(this,Fe,new Semaphore({concurrency:1}));const{documentRoot:n="/www/",absoluteUrl:s=typeof location=="object"?location==null?void 0:location.href:"",rewriteRules:i=[]}=r;this.php=t,te(this,Pe,n);const o=new URL(s);te(this,dt,o.hostname),te(this,De,o.port?Number(o.port):o.protocol==="https:"?443:80),te(this,Ke,(o.protocol||"").replace(":",""));const l=H(this,De)!==443&&H(this,De)!==80;te(this,Je,[H(this,dt),l?`:${H(this,De)}`:""].join("")),te(this,ve,o.pathname.replace(/\/+$/,"")),te(this,Qe,[`${H(this,Ke)}://`,H(this,Je),H(this,ve)].join("")),this.rewriteRules=i}pathToInternalUrl(t){return`${this.absoluteUrl}${t}`}internalUrlToPath(t){const r=new URL(t);return r.pathname.startsWith(H(this,ve))&&(r.pathname=r.pathname.slice(H(this,ve).length)),toRelativeUrl(r)}get isRequestRunning(){return H(this,Fe).running>0}get absoluteUrl(){return H(this,Qe)}get documentRoot(){return H(this,Pe)}async request(t){const r=t.url.startsWith("http://")||t.url.startsWith("https://"),n=new URL(t.url.split("#")[0],r?void 0:DEFAULT_BASE_URL),s=applyRewriteRules(removePathPrefix(n.pathname,H(this,ve)),this.rewriteRules),i=`${H(this,Pe)}${s}`;return seemsLikeAPHPRequestHandlerPath(i)?await ce(this,_t,Wt).call(this,t,n):ce(this,mt,zt).call(this,i)}}Pe=new WeakMap,Ke=new WeakMap,dt=new WeakMap,De=new WeakMap,Je=new WeakMap,ve=new WeakMap,Qe=new WeakMap,Fe=new WeakMap,mt=new WeakSet,zt=function(t){if(!this.php.fileExists(t))return new PHPResponse(404,{"x-file-type":["static"]},new TextEncoder().encode("404 File not found"));const r=this.php.readFileAsBuffer(t);return new PHPResponse(200,{"content-length":[`${r.byteLength}`],"content-type":[inferMimeType(t)],"accept-ranges":["bytes"],"cache-control":["public, max-age=0"]},r)},_t=new WeakSet,Wt=async function(t,r){var s;if(H(this,Fe).running>0&&((s=t.headers)==null?void 0:s["x-request-issuer"])==="php")return console.warn("Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."),new PHPResponse(502,{},new TextEncoder().encode("502 Bad Gateway"));const n=await H(this,Fe).acquire();try{this.php.addServerGlobalEntry("REMOTE_ADDR","127.0.0.1"),this.php.addServerGlobalEntry("DOCUMENT_ROOT",H(this,Pe)),this.php.addServerGlobalEntry("HTTPS",H(this,Qe).startsWith("https://")?"on":"");let i="GET";const o={host:H(this,Je),...normalizeHeaders(t.headers||{})};let l=t.body;if(typeof l=="object"&&!(l instanceof Uint8Array)){i="POST";const{bytes:u,contentType:p}=await encodeAsMultipart(l);l=u,o["content-type"]=p}let d;try{d=ce(this,gt,Bt).call(this,r.pathname)}catch{return new PHPResponse(404,{},new TextEncoder().encode("404 File not found"))}return await this.php.run({relativeUri:ensurePathPrefix(toRelativeUrl(r),H(this,ve)),protocol:H(this,Ke),method:t.method||i,body:l,scriptPath:d,headers:o})}finally{n()}},gt=new WeakSet,Bt=function(t){let r=removePathPrefix(t,H(this,ve));r=applyRewriteRules(r,this.rewriteRules),r.includes(".php")?r=r.split(".php")[0]+".php":this.php.isDir(`${H(this,Pe)}${r}`)?(r.endsWith("/")||(r=`${r}/`),r=`${r}index.php`):r="/index.php";const n=`${H(this,Pe)}${r}`;if(this.php.fileExists(n))return n;throw new Error(`File not found: ${n}`)};function inferMimeType(e){switch(e.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}function seemsLikeAPHPRequestHandlerPath(e){return seemsLikeAPHPFile(e)||seemsLikeADirectoryRoot(e)}function seemsLikeAPHPFile(e){return e.endsWith(".php")||e.includes(".php/")}function seemsLikeADirectoryRoot(e){return!e.split("/").pop().includes(".")}function applyRewriteRules(e,t){for(const r of t)if(new RegExp(r.match).test(e))return e.replace(r.match,r.replacement);return e}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 i=s.value;s.value=function(...o){try{return i.apply(this,o)}catch(l){const d=typeof l=="object"?l==null?void 0:l.errno:null;if(d in FileErrorCodes){const u=FileErrorCodes[d],p=typeof o[0]=="string"?o[0]:null,g=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${g}: ${u}`,{cause:l})}throw l}}}}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"})();var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");var Me,Ze,Ye,be,Re,Te,Ee,Xe,$t,Gt,yt,Kt,vt,Jt,wt,Qt,Pt,Zt,bt,Yt,Et,Xt,St,er,Rt,tr,Tt,rr,kt,nr,Ct,sr;class BasePHP{constructor(e,t){Q(this,$t);Q(this,yt);Q(this,vt);Q(this,wt);Q(this,Pt);Q(this,bt);Q(this,Et);Q(this,St);Q(this,Rt);Q(this,Tt);Q(this,kt);Q(this,Ct);Q(this,Me,void 0);Q(this,Ze,void 0);Q(this,Ye,void 0);Q(this,be,void 0);Q(this,Re,void 0);Q(this,Te,void 0);Q(this,Ee,void 0);Q(this,Xe,void 0);te(this,Me,[]),te(this,be,!1),te(this,Re,null),te(this,Te,{}),te(this,Ee,new Map),te(this,Xe,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e),t&&(this.requestHandler=new PHPBrowser(new PHPRequestHandler(this,t)))}addEventListener(e,t){H(this,Ee).has(e)||H(this,Ee).set(e,new Set),H(this,Ee).get(e).add(t)}removeEventListener(e,t){var r;(r=H(this,Ee).get(e))==null||r.delete(t)}dispatchEvent(e){const t=H(this,Ee).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){H(this,Xe).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.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,t.onMessage=async r=>{for(const n of H(this,Xe)){const s=await n(r);if(s)return s}return""},te(this,Re,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?");te(this,Ye,e)}setPhpIniPath(e){if(H(this,be))throw new Error("Cannot set PHP ini path after calling run().");te(this,Ze,e),this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[e])}setPhpIniEntry(e,t){if(H(this,be))throw new Error("Cannot set PHP ini entries after calling run().");H(this,Me).push([e,t])}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e,t){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e,t)}async run(e){const t=await this.semaphore.acquire();let r;try{if(H(this,be)||(ce(this,$t,Gt).call(this),te(this,be,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ce(this,St,er).call(this,e.scriptPath||""),ce(this,vt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Zt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443";ce(this,wt,Qt).call(this,s,e.protocol||"http"),ce(this,bt,Yt).call(this,n),e.body&&(r=ce(this,Et,Xt).call(this,e.body)),typeof e.code=="string"&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const i=e.env||{};for(const l in i)ce(this,Tt,rr).call(this,l,i[l]);const o=await ce(this,Ct,sr).call(this);if(o.exitCode!==0){const l={stdout:o.text,stderr:o.errors};console.warn("PHP.run() output was:",l);const d=new Error(`PHP.run() failed with exit code ${o.exitCode} and the following output: `+o.errors);throw d.output=l,d.source="request",console.error(d),d}return o}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"})}}}addServerGlobalEntry(e,t){H(this,Te)[e]=t}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/consts.json")&&this.readFileAsText("/internal/consts.json")||"{}")}catch{}this.writeFile("/internal/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){try{this[__private__dont__use].FS.rename(e,t)}catch(r){const n=getEmscriptenFsError(r);throw n?new Error(`Could not move ${e} to ${t}: ${n}`,{cause:r}):r}}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 console.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){const t=this[__private__dont__use].FS;try{this.exit()}catch{}if(this.initializeRuntime(e),H(this,Ze)&&this.setPhpIniPath(H(this,Ze)),H(this,Ye)&&this.setSapiName(H(this,Ye)),this.requestHandler){const r=this.documentRoot;copyFS(t,this[__private__dont__use].FS,r)}}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}te(this,be,!1),te(this,Re,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}}Me=new WeakMap,Ze=new WeakMap,Ye=new WeakMap,be=new WeakMap,Re=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Xe=new WeakMap,$t=new WeakSet,Gt=function(){if(this.setPhpIniEntry("auto_prepend_file","/internal/consts.php"),this.fileExists("/internal/consts.php")||this.writeFile("/internal/consts.php",`<?php
592
609
  if(file_exists('/internal/consts.json')) {
593
610
  $consts = json_decode(file_get_contents('/internal/consts.json'), true);
594
611
  foreach ($consts as $const => $value) {
@@ -599,16 +616,16 @@ ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
599
616
  }`),H(this,Me).length>0){const e=H(this,Me).map(([t,r])=>`${t}=${r}`).join(`
600
617
  `)+`
601
618
 
602
- `;this[__private__dont__use].ccall("wasm_set_phpini_entries",null,[STRING],[e])}this[__private__dont__use].ccall("php_wasm_init",null,[],[])},yt=new WeakSet,Kt=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(": "),i=n.substring(0,s).toLowerCase(),o=n.substring(s+2);i in r||(r[i]=[]),r[i].push(o)}return{headers:r,httpStatusCode:t.status}},vt=new WeakSet,Jt=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])}},wt=new WeakSet,Qt=function(e,t){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e]);let r;try{r=parseInt(new URL(e).port,10)}catch{}(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[r]),(t==="https"||!t&&r===443)&&this.addServerGlobalEntry("HTTPS","on")},Pt=new WeakSet,Zt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},bt=new WeakSet,Yt=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)]);for(const t in e){let r="HTTP_";["content-type","content-length"].includes(t.toLowerCase())&&(r=""),this.addServerGlobalEntry(`${r}${t.toUpperCase().replace(/-/g,"_")}`,e[t])}},Et=new WeakSet,Xt=function(e){let t,r;typeof e=="string"?(console.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},St=new WeakSet,er=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},Rt=new WeakSet,tr=function(){for(const e in H(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,H(this,Te)[e]])},Tt=new WeakSet,rr=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},kt=new WeakSet,nr=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},Ot=new WeakSet,sr=async function(){var s;let e,t;try{e=await new Promise((i,o)=>{var d;t=u=>{console.error(u),console.error(u.error);const p=new Error("Rethrown");p.cause=u.error,p.betterMessage=u.message,o(p)},(d=H(this,Re))==null||d.addEventListener("error",t);const l=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return l instanceof Promise?l.then(i,o):i(l)})}catch(i){for(const u in this)typeof this[u]=="function"&&(this[u]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const o=i,l="betterMessage"in o?o.betterMessage:o.message,d=new Error(l);throw d.cause=o,console.error(d),d}finally{(s=H(this,Re))==null||s.removeEventListener("error",t),te(this,Te,{})}const{headers:r,httpStatusCode:n}=ce(this,yt,Kt).call(this);return new PHPResponse(n,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(i=>i!=="."&&i!=="..");for(const i of s)copyFS(e,t,joinPaths(r,i))}const ResourceTypes=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function isFileReference(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&ResourceTypes.includes(e.resource)}class Resource{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new VFSResource(t,n);break;case"literal":s=new LiteralResource(t,n);break;case"wordpress.org/themes":s=new CoreThemeResource(t,n);break;case"wordpress.org/plugins":s=new CorePluginResource(t,n);break;case"url":s=new UrlResource(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new CachedResource(s),r&&(s=new SemaphoreResource(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class VFSResource extends Resource{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 LiteralResource extends Resource{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 FetchResource extends Resource{constructor(t){super(),this.progress=t}async resolve(){var n,s;(n=this.progress)==null||n.setCaption(this.caption);const t=this.getURL();let r=await fetch(t);if(r=await cloneResponseMonitorProgress(r,((s=this.progress)==null?void 0:s.loadingListener)??noop),r.status!==200)throw new Error(`Could not download "${t}"`);return new File([await r.blob()],this.name)}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 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}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(T){if(super(),!e.IDENTIFIER.test(T))throw new Error("CodeGen: name must be a valid identifier");this.str=T}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(T){super(),this._items=typeof T=="string"?[T]:T}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const T=this._items[0];return T===""||T==='""'}get str(){var T;return(T=this._str)!==null&&T!==void 0?T:this._str=this._items.reduce((S,I)=>`${S}${I}`,"")}get names(){var T;return(T=this._names)!==null&&T!==void 0?T: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(m,...T){const S=[m[0]];let I=0;for(;I<T.length;)l(S,T[I]),S.push(m[++I]);return new n(S)}e._=s;const i=new n("+");function o(m,...T){const S=[N(m[0])];let I=0;for(;I<T.length;)S.push(i),l(S,T[I]),S.push(i,N(m[++I]));return d(S),new n(S)}e.str=o;function l(m,T){T instanceof n?m.push(...T._items):T instanceof r?m.push(T):m.push($(T))}e.addCodeArg=l;function d(m){let T=1;for(;T<m.length-1;){if(m[T]===i){const S=u(m[T-1],m[T+1]);if(S!==void 0){m.splice(T-1,3,S);continue}m[T++]="+"}T++}}function u(m,T){if(T==='""')return m;if(m==='""')return T;if(typeof m=="string")return T instanceof r||m[m.length-1]!=='"'?void 0:typeof T!="string"?`${m.slice(0,-1)}${T}"`:T[0]==='"'?m.slice(0,-1)+T.slice(1):void 0;if(typeof T=="string"&&T[0]==='"'&&!(m instanceof r))return`"${m}${T.slice(1)}`}function p(m,T){return T.emptyStr()?m:m.emptyStr()?T:o`${m}${T}`}e.strConcat=p;function $(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:N(Array.isArray(m)?m.join(","):m)}function O(m){return new n(N(m))}e.stringify=O;function N(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=N;function R(m){return typeof m=="string"&&e.IDENTIFIER.test(m)?new n(`.${m}`):s`[${m}]`}e.getProperty=R;function v(m){if(typeof m=="string"&&e.IDENTIFIER.test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}e.getEsmExportName=v;function g(m){return new n(m.toString())}e.regexpCode=g})(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(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(d){d[d.Started=0]="Started",d[d.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:u,parent:p}={}){this._names={},this._prefixes=u,this._parent=p}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const p=this._names[u]||this._nameGroup(u);return`${u}${p.index++}`}_nameGroup(u){var p,$;if(!(($=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||$===void 0)&&$.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class i extends t.Name{constructor(u,p){super(p),this.prefix=u}setValue(u,{property:p,itemIndex:$}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(p)}[${$}]`}}e.ValueScopeName=i;const o=(0,t._)`\n`;class l extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:t.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,p){var $;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const O=this.toName(u),{prefix:N}=O,R=($=p.key)!==null&&$!==void 0?$:p.ref;let v=this._values[N];if(v){const T=v.get(R);if(T)return T}else v=this._values[N]=new Map;v.set(R,O);const g=this._scope[N]||(this._scope[N]=[]),m=g.length;return g[m]=p.ref,O.setValue(p,{property:N,itemIndex:m}),O}getValue(u,p){const $=this._values[u];if($)return $.get(p)}scopeRefs(u,p=this._values){return this._reduceValues(p,$=>{if($.scopePath===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return(0,t._)`${u}${$.scopePath}`})}scopeCode(u=this._values,p,$){return this._reduceValues(u,O=>{if(O.value===void 0)throw new Error(`CodeGen: name "${O}" has no value`);return O.value.code},p,$)}_reduceValues(u,p,$={},O){let N=t.nil;for(const R in u){const v=u[R];if(!v)continue;const g=$[R]=$[R]||new Map;v.forEach(m=>{if(g.has(m))return;g.set(m,n.Started);let T=p(m);if(T){const S=this.opts.es5?e.varKinds.var:e.varKinds.const;N=(0,t._)`${N}${S} ${m} = ${T};${this.opts._n}`}else if(T=O==null?void 0:O(m))N=(0,t._)`${N}${T}${this.opts._n}`;else throw new r(m);g.set(m,n.Completed)})}return N}}e.ValueScope=l})(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 i{optimizeNodes(){return this}optimizeNames(a,h){return this}}class o extends i{constructor(a,h,C){super(),this.varKind=a,this.name=h,this.rhs=C}render({es5:a,_n:h}){const C=a?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${M};`+h}optimizeNames(a,h){if(a[this.name.str])return this.rhs&&(this.rhs=oe(this.rhs,a,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(a,h,C){super(),this.lhs=a,this.rhs=h,this.sideEffects=C}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,h){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=oe(this.rhs,a,h),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ue(a,this.rhs)}}class d extends l{constructor(a,h,C,M){super(a,C,M),this.op=h}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class u extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class p extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class $ extends i{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class O extends i{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,h){return this.code=oe(this.code,a,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class N extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((h,C)=>h+C.render(a),"")}optimizeNodes(){const{nodes:a}=this;let h=a.length;for(;h--;){const C=a[h].optimizeNodes();Array.isArray(C)?a.splice(h,1,...C):C?a[h]=C:a.splice(h,1)}return a.length>0?this:void 0}optimizeNames(a,h){const{nodes:C}=this;let M=C.length;for(;M--;){const q=C[M];q.optimizeNames(a,h)||(ke(a,q.names),C.splice(M,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((a,h)=>K(a,h.names),{})}}class R extends N{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class v extends N{}class g extends R{}g.kind="else";class m extends R{constructor(a,h){super(h),this.condition=a}render(a){let h=`if(${this.condition})`+super.render(a);return this.else&&(h+="else "+this.else.render(a)),h}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let h=this.else;if(h){const C=h.optimizeNodes();h=this.else=Array.isArray(C)?new g(C):C}if(h)return a===!1?h instanceof m?h:h.nodes:this.nodes.length?this:new m(Oe(a),h instanceof m?[h]:h.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,h){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(a,h),!!(super.optimizeNames(a,h)||this.else))return this.condition=oe(this.condition,a,h),this}get names(){const a=super.names;return ue(a,this.condition),this.else&&K(a,this.else.names),a}}m.kind="if";class T extends R{}T.kind="for";class S extends T{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iteration=oe(this.iteration,a,h),this}get names(){return K(super.names,this.iteration.names)}}class I extends T{constructor(a,h,C,M){super(),this.varKind=a,this.name=h,this.from=C,this.to=M}render(a){const h=a.es5?r.varKinds.var:this.varKind,{name:C,from:M,to:q}=this;return`for(${h} ${C}=${M}; ${C}<${q}; ${C}++)`+super.render(a)}get names(){const a=ue(super.names,this.from);return ue(a,this.to)}}class D extends T{constructor(a,h,C,M){super(),this.loop=a,this.varKind=h,this.name=C,this.iterable=M}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iterable=oe(this.iterable,a,h),this}get names(){return K(super.names,this.iterable.names)}}class w extends R{constructor(a,h,C){super(),this.name=a,this.args=h,this.async=C}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}w.kind="func";class k extends N{render(a){return"return "+super.render(a)}}k.kind="return";class A extends R{render(a){let h="try"+super.render(a);return this.catch&&(h+=this.catch.render(a)),this.finally&&(h+=this.finally.render(a)),h}optimizeNodes(){var a,h;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(a,h){var C,M;return super.optimizeNames(a,h),(C=this.catch)===null||C===void 0||C.optimizeNames(a,h),(M=this.finally)===null||M===void 0||M.optimizeNames(a,h),this}get names(){const a=super.names;return this.catch&&K(a,this.catch.names),this.finally&&K(a,this.finally.names),a}}class x extends R{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}x.kind="catch";class z extends R{render(a){return"finally"+super.render(a)}}z.kind="finally";class re{constructor(a,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
603
- `:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,h){const C=this._extScope.value(a,h);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(a,h){return this._extScope.getValue(a,h)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,h,C,M){const q=this._scope.toName(h);return C!==void 0&&M&&(this._constants[q.str]=C),this._leafNode(new o(a,q,C)),q}const(a,h,C){return this._def(r.varKinds.const,a,h,C)}let(a,h,C){return this._def(r.varKinds.let,a,h,C)}var(a,h,C){return this._def(r.varKinds.var,a,h,C)}assign(a,h,C){return this._leafNode(new l(a,h,C))}add(a,h){return this._leafNode(new d(a,e.operators.ADD,h))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new O(a)),this}object(...a){const h=["{"];for(const[C,M]of a)h.length>1&&h.push(","),h.push(C),(C!==M||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,M));return h.push("}"),new t._Code(h)}if(a,h,C){if(this._blockNode(new m(a)),h&&C)this.code(h).else().code(C).endIf();else if(h)this.code(h).endIf();else if(C)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new m(a))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(m,g)}_for(a,h){return this._blockNode(a),h&&this.code(h).endFor(),this}for(a,h){return this._for(new S(a),h)}forRange(a,h,C,M,q=this.opts.es5?r.varKinds.var:r.varKinds.let){const W=this._scope.toName(a);return this._for(new I(q,W,h,C),()=>M(W))}forOf(a,h,C,M=r.varKinds.const){const q=this._scope.toName(a);if(this.opts.es5){const W=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${W}.length`,G=>{this.var(q,(0,t._)`${W}[${G}]`),C(q)})}return this._for(new D("of",M,q,h),()=>C(q))}forIn(a,h,C,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${h})`,C);const q=this._scope.toName(a);return this._for(new D("in",M,q,h),()=>C(q))}endFor(){return this._endBlockNode(T)}label(a){return this._leafNode(new u(a))}break(a){return this._leafNode(new p(a))}return(a){const h=new k;if(this._blockNode(h),this.code(a),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(a,h,C){if(!h&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new A;if(this._blockNode(M),this.code(a),h){const q=this.name("e");this._currNode=M.catch=new x(q),h(q)}return C&&(this._currNode=M.finally=new z,this.code(C)),this._endBlockNode(x,z)}throw(a){return this._leafNode(new $(a))}block(a,h){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(h),this}endBlock(a){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const C=this._nodes.length-h;if(C<0||a!==void 0&&C!==a)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${a} expected`);return this._nodes.length=h,this}func(a,h=t.nil,C,M){return this._blockNode(new w(a,h,C)),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,h){const C=this._currNode;if(C instanceof a||h&&C instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${a.kind}/${h.kind}`:a.kind}"`)}_elseNode(a){const h=this._currNode;if(!(h instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const h=this._nodes;h[h.length-1]=a}}e.CodeGen=re;function K(P,a){for(const h in a)P[h]=(P[h]||0)+(a[h]||0);return P}function ue(P,a){return a instanceof t._CodeOrName?K(P,a.names):P}function oe(P,a,h){if(P instanceof t.Name)return C(P);if(!M(P))return P;return new t._Code(P._items.reduce((q,W)=>(W instanceof t.Name&&(W=C(W)),W instanceof t._Code?q.push(...W._items):q.push(W),q),[]));function C(q){const W=h[q.str];return W===void 0||a[q.str]!==1?q:(delete a[q.str],W)}function M(q){return q instanceof t._Code&&q._items.some(W=>W instanceof t.Name&&a[W.str]===1&&h[W.str]!==void 0)}}function ke(P,a){for(const h in a)P[h]=(P[h]||0)-(a[h]||0)}function Oe(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,t._)`!${j(P)}`}e.not=Oe;const qe=y(e.operators.AND);function et(...P){return P.reduce(qe)}e.and=et;const Ue=y(e.operators.OR);function F(...P){return P.reduce(Ue)}e.or=F;function y(P){return(a,h)=>a===t.nil?h:h===t.nil?a:(0,t._)`${j(a)} ${P} ${j(h)}`}function j(P){return P instanceof t.Name?P:(0,t._)`(${P})`}})(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 k={};for(const A of w)k[A]=!0;return k}e.toHash=n;function s(w,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(i(w,k),!o(k,w.self.RULES.all))}e.alwaysValidSchema=s;function i(w,k=w.schema){const{opts:A,self:x}=w;if(!A.strictSchema||typeof k=="boolean")return;const z=x.RULES.keywords;for(const re in k)z[re]||D(w,`unknown keyword: "${re}"`)}e.checkUnknownRules=i;function o(w,k){if(typeof w=="boolean")return!w;for(const A in w)if(k[A])return!0;return!1}e.schemaHasRules=o;function l(w,k){if(typeof w=="boolean")return!w;for(const A in w)if(A!=="$ref"&&k.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function d({topSchemaRef:w,schemaPath:k},A,x,z){if(!z){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${w}${k}${(0,t.getProperty)(x)}`}e.schemaRefOrVal=d;function u(w){return O(decodeURIComponent(w))}e.unescapeFragment=u;function p(w){return encodeURIComponent($(w))}e.escapeFragment=p;function $(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=$;function O(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=O;function N(w,k){if(Array.isArray(w))for(const A of w)k(A);else k(w)}e.eachItem=N;function R({mergeNames:w,mergeToName:k,mergeValues:A,resultToName:x}){return(z,re,K,ue)=>{const oe=K===void 0?re:K instanceof t.Name?(re instanceof t.Name?w(z,re,K):k(z,re,K),K):re instanceof t.Name?(k(z,K,re),re):A(re,K);return ue===t.Name&&!(oe instanceof t.Name)?x(z,oe):oe}}e.mergeEvaluated={props:R({mergeNames:(w,k,A)=>w.if((0,t._)`${A} !== true && ${k} !== undefined`,()=>{w.if((0,t._)`${k} === true`,()=>w.assign(A,!0),()=>w.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${k})`))}),mergeToName:(w,k,A)=>w.if((0,t._)`${A} !== true`,()=>{k===!0?w.assign(A,!0):(w.assign(A,(0,t._)`${A} || {}`),g(w,A,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:v}),items:R({mergeNames:(w,k,A)=>w.if((0,t._)`${A} !== true && ${k} !== undefined`,()=>w.assign(A,(0,t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),mergeToName:(w,k,A)=>w.if((0,t._)`${A} !== true`,()=>w.assign(A,k===!0?!0:(0,t._)`${A} > ${k} ? ${A} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function v(w,k){if(k===!0)return w.var("props",!0);const A=w.var("props",(0,t._)`{}`);return k!==void 0&&g(w,A,k),A}e.evaluatedPropsToName=v;function g(w,k,A){Object.keys(A).forEach(x=>w.assign((0,t._)`${k}${(0,t.getProperty)(x)}`,!0))}e.setEvaluated=g;const m={};function T(w,k){return w.scopeValue("func",{ref:k,code:m[k.code]||(m[k.code]=new r._Code(k.code))})}e.useFunc=T;var S;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(S=e.Type||(e.Type={}));function I(w,k,A){if(w instanceof t.Name){const x=k===S.Num;return A?x?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:x?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(w).toString():"/"+$(w)}e.getErrorPath=I;function D(w,k,A=w.opts.strictSchema){if(A){if(k=`strict mode: ${k}`,A===!0)throw new Error(k);w.self.logger.warn(k)}}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:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:m})=>m?(0,t.str)`"${g}" keyword must be ${m} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function s(g,m=e.keywordError,T,S){const{it:I}=g,{gen:D,compositeRule:w,allErrors:k}=I,A=$(g,m,T);S??(w||k)?d(D,A):u(I,(0,t._)`[${A}]`)}e.reportError=s;function i(g,m=e.keywordError,T){const{it:S}=g,{gen:I,compositeRule:D,allErrors:w}=S,k=$(g,m,T);d(I,k),D||w||u(S,n.default.vErrors)}e.reportExtraError=i;function o(g,m){g.assign(n.default.errors,m),g.if((0,t._)`${n.default.vErrors} !== null`,()=>g.if(m,()=>g.assign((0,t._)`${n.default.vErrors}.length`,m),()=>g.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function l({gen:g,keyword:m,schemaValue:T,data:S,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const w=g.name("err");g.forRange("i",I,n.default.errors,k=>{g.const(w,(0,t._)`${n.default.vErrors}[${k}]`),g.if((0,t._)`${w}.instancePath === undefined`,()=>g.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),g.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${m}`),D.opts.verbose&&(g.assign((0,t._)`${w}.schema`,T),g.assign((0,t._)`${w}.data`,S))})}e.extendErrors=l;function d(g,m){const T=g.const("err",m);g.if((0,t._)`${n.default.vErrors} === null`,()=>g.assign(n.default.vErrors,(0,t._)`[${T}]`),(0,t._)`${n.default.vErrors}.push(${T})`),g.code((0,t._)`${n.default.errors}++`)}function u(g,m){const{gen:T,validateName:S,schemaEnv:I}=g;I.$async?T.throw((0,t._)`new ${g.ValidationError}(${m})`):(T.assign((0,t._)`${S}.errors`,m),T.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 $(g,m,T){const{createErrors:S}=g.it;return S===!1?(0,t._)`{}`:O(g,m,T)}function O(g,m,T={}){const{gen:S,it:I}=g,D=[N(I,T),R(g,T)];return v(g,m,D),S.object(...D)}function N({errorPath:g},{instancePath:m}){const T=m?(0,t.str)`${g}${(0,r.getErrorPath)(m,r.Type.Str)}`:g;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,T)]}function R({keyword:g,it:{errSchemaPath:m}},{schemaPath:T,parentSchema:S}){let I=S?m:(0,t.str)`${m}/${g}`;return T&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(T,r.Type.Str)}`),[p.schemaPath,I]}function v(g,{params:m,message:T},S){const{keyword:I,data:D,schemaValue:w,it:k}=g,{opts:A,propertyName:x,topSchemaRef:z,schemaPath:re}=k;S.push([p.keyword,I],[p.params,typeof m=="function"?m(g):m||(0,t._)`{}`]),A.messages&&S.push([p.message,typeof T=="function"?T(g):T]),A.verbose&&S.push([p.schema,w],[p.parentSchema,(0,t._)`${z}${re}`],[n.default.data,D]),x&&S.push([p.propertyName,x])}})(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,i=util;var o;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(o=e.DataType||(e.DataType={}));function l(S){const I=d(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=l;function d(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=d;function u(S,I){const{gen:D,data:w,opts:k}=S,A=$(I,k.coerceTypes),x=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(S,I[0]));if(x){const z=v(I,w,k.strictNumbers,o.Wrong);D.if(z,()=>{A.length?O(S,I,A):m(S)})}return x}e.coerceAndCheckDataType=u;const p=new Set(["string","number","integer","boolean","null"]);function $(S,I){return I?S.filter(D=>p.has(D)||I==="array"&&D==="array"):[]}function O(S,I,D){const{gen:w,data:k,opts:A}=S,x=w.let("dataType",(0,s._)`typeof ${k}`),z=w.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&w.if((0,s._)`${x} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>w.assign(k,(0,s._)`${k}[0]`).assign(x,(0,s._)`typeof ${k}`).if(v(I,k,A.strictNumbers),()=>w.assign(z,k))),w.if((0,s._)`${z} !== undefined`);for(const K of D)(p.has(K)||K==="array"&&A.coerceTypes==="array")&&re(K);w.else(),m(S),w.endIf(),w.if((0,s._)`${z} !== undefined`,()=>{w.assign(k,z),N(S,z)});function re(K){switch(K){case"string":w.elseIf((0,s._)`${x} == "number" || ${x} == "boolean"`).assign(z,(0,s._)`"" + ${k}`).elseIf((0,s._)`${k} === null`).assign(z,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${x} == "boolean" || ${k} === null
619
+ `;this[__private__dont__use].ccall("wasm_set_phpini_entries",null,[STRING],[e])}this[__private__dont__use].ccall("php_wasm_init",null,[],[])},yt=new WeakSet,Kt=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(": "),i=n.substring(0,s).toLowerCase(),o=n.substring(s+2);i in r||(r[i]=[]),r[i].push(o)}return{headers:r,httpStatusCode:t.status}},vt=new WeakSet,Jt=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])}},wt=new WeakSet,Qt=function(e,t){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e]);let r;try{r=parseInt(new URL(e).port,10)}catch{}(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[r]),(t==="https"||!t&&r===443)&&this.addServerGlobalEntry("HTTPS","on")},Pt=new WeakSet,Zt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},bt=new WeakSet,Yt=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)]);for(const t in e){let r="HTTP_";["content-type","content-length"].includes(t.toLowerCase())&&(r=""),this.addServerGlobalEntry(`${r}${t.toUpperCase().replace(/-/g,"_")}`,e[t])}},Et=new WeakSet,Xt=function(e){let t,r;typeof e=="string"?(console.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},St=new WeakSet,er=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},Rt=new WeakSet,tr=function(){for(const e in H(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,H(this,Te)[e]])},Tt=new WeakSet,rr=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},kt=new WeakSet,nr=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},Ct=new WeakSet,sr=async function(){var s;let e,t;try{e=await new Promise((i,o)=>{var d;t=u=>{console.error(u),console.error(u.error);const p=new Error("Rethrown");p.cause=u.error,p.betterMessage=u.message,o(p)},(d=H(this,Re))==null||d.addEventListener("error",t);const l=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return l instanceof Promise?l.then(i,o):i(l)})}catch(i){for(const u in this)typeof this[u]=="function"&&(this[u]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const o=i,l="betterMessage"in o?o.betterMessage:o.message,d=new Error(l);throw d.cause=o,console.error(d),d}finally{(s=H(this,Re))==null||s.removeEventListener("error",t),te(this,Te,{})}const{headers:r,httpStatusCode:n}=ce(this,yt,Kt).call(this);return new PHPResponse(n,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(i=>i!=="."&&i!=="..");for(const i of s)copyFS(e,t,joinPaths(r,i))}const ResourceTypes=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function isFileReference(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&ResourceTypes.includes(e.resource)}class Resource{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new VFSResource(t,n);break;case"literal":s=new LiteralResource(t,n);break;case"wordpress.org/themes":s=new CoreThemeResource(t,n);break;case"wordpress.org/plugins":s=new CorePluginResource(t,n);break;case"url":s=new UrlResource(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new CachedResource(s),r&&(s=new SemaphoreResource(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class VFSResource extends Resource{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 LiteralResource extends Resource{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 FetchResource extends Resource{constructor(t){super(),this.progress=t}async resolve(){var n,s;(n=this.progress)==null||n.setCaption(this.caption);const t=this.getURL();let r=await fetch(t);if(r=await cloneResponseMonitorProgress(r,((s=this.progress)==null?void 0:s.loadingListener)??noop),r.status!==200)throw new Error(`Could not download "${t}"`);return new File([await r.blob()],this.name)}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 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}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($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((P,I)=>`${P}${I}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((P,I)=>(I instanceof r&&(P[I.str]=(P[I.str]||0)+1),P),{})}}e._Code=n,e.nil=new n("");function s(_,...$){const P=[_[0]];let I=0;for(;I<$.length;)l(P,$[I]),P.push(_[++I]);return new n(P)}e._=s;const i=new n("+");function o(_,...$){const P=[N(_[0])];let I=0;for(;I<$.length;)P.push(i),l(P,$[I]),P.push(i,N(_[++I]));return d(P),new n(P)}e.str=o;function l(_,$){$ instanceof n?_.push(...$._items):$ instanceof r?_.push($):_.push(g($))}e.addCodeArg=l;function d(_){let $=1;for(;$<_.length-1;){if(_[$]===i){const P=u(_[$-1],_[$+1]);if(P!==void 0){_.splice($-1,3,P);continue}_[$++]="+"}$++}}function u(_,$){if($==='""')return _;if(_==='""')return $;if(typeof _=="string")return $ instanceof r||_[_.length-1]!=='"'?void 0:typeof $!="string"?`${_.slice(0,-1)}${$}"`:$[0]==='"'?_.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(_ instanceof r))return`"${_}${$.slice(1)}`}function p(_,$){return $.emptyStr()?_:_.emptyStr()?$:o`${_}${$}`}e.strConcat=p;function g(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:N(Array.isArray(_)?_.join(","):_)}function O(_){return new n(N(_))}e.stringify=O;function N(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=N;function R(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=R;function T(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=T;function y(_){return new n(_.toString())}e.regexpCode=y})(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(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(d){d[d.Started=0]="Started",d[d.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:u,parent:p}={}){this._names={},this._prefixes=u,this._parent=p}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const p=this._names[u]||this._nameGroup(u);return`${u}${p.index++}`}_nameGroup(u){var p,g;if(!((g=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||g===void 0)&&g.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class i extends t.Name{constructor(u,p){super(p),this.prefix=u}setValue(u,{property:p,itemIndex:g}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(p)}[${g}]`}}e.ValueScopeName=i;const o=(0,t._)`\n`;class l extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:t.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,p){var g;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const O=this.toName(u),{prefix:N}=O,R=(g=p.key)!==null&&g!==void 0?g:p.ref;let T=this._values[N];if(T){const $=T.get(R);if($)return $}else T=this._values[N]=new Map;T.set(R,O);const y=this._scope[N]||(this._scope[N]=[]),_=y.length;return y[_]=p.ref,O.setValue(p,{property:N,itemIndex:_}),O}getValue(u,p){const g=this._values[u];if(g)return g.get(p)}scopeRefs(u,p=this._values){return this._reduceValues(p,g=>{if(g.scopePath===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return(0,t._)`${u}${g.scopePath}`})}scopeCode(u=this._values,p,g){return this._reduceValues(u,O=>{if(O.value===void 0)throw new Error(`CodeGen: name "${O}" has no value`);return O.value.code},p,g)}_reduceValues(u,p,g={},O){let N=t.nil;for(const R in u){const T=u[R];if(!T)continue;const y=g[R]=g[R]||new Map;T.forEach(_=>{if(y.has(_))return;y.set(_,n.Started);let $=p(_);if($){const P=this.opts.es5?e.varKinds.var:e.varKinds.const;N=(0,t._)`${N}${P} ${_} = ${$};${this.opts._n}`}else if($=O==null?void 0:O(_))N=(0,t._)`${N}${$}${this.opts._n}`;else throw new r(_);y.set(_,n.Completed)})}return N}}e.ValueScope=l})(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 i{optimizeNodes(){return this}optimizeNames(a,h){return this}}class o extends i{constructor(a,h,C){super(),this.varKind=a,this.name=h,this.rhs=C}render({es5:a,_n:h}){const C=a?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${M};`+h}optimizeNames(a,h){if(a[this.name.str])return this.rhs&&(this.rhs=oe(this.rhs,a,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(a,h,C){super(),this.lhs=a,this.rhs=h,this.sideEffects=C}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,h){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=oe(this.rhs,a,h),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ue(a,this.rhs)}}class d extends l{constructor(a,h,C,M){super(a,C,M),this.op=h}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class u extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class p extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class g extends i{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class O extends i{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,h){return this.code=oe(this.code,a,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class N extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((h,C)=>h+C.render(a),"")}optimizeNodes(){const{nodes:a}=this;let h=a.length;for(;h--;){const C=a[h].optimizeNodes();Array.isArray(C)?a.splice(h,1,...C):C?a[h]=C:a.splice(h,1)}return a.length>0?this:void 0}optimizeNames(a,h){const{nodes:C}=this;let M=C.length;for(;M--;){const q=C[M];q.optimizeNames(a,h)||(ke(a,q.names),C.splice(M,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((a,h)=>K(a,h.names),{})}}class R extends N{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class T extends N{}class y extends R{}y.kind="else";class _ extends R{constructor(a,h){super(h),this.condition=a}render(a){let h=`if(${this.condition})`+super.render(a);return this.else&&(h+="else "+this.else.render(a)),h}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let h=this.else;if(h){const C=h.optimizeNodes();h=this.else=Array.isArray(C)?new y(C):C}if(h)return a===!1?h instanceof _?h:h.nodes:this.nodes.length?this:new _(Ce(a),h instanceof _?[h]:h.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,h){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(a,h),!!(super.optimizeNames(a,h)||this.else))return this.condition=oe(this.condition,a,h),this}get names(){const a=super.names;return ue(a,this.condition),this.else&&K(a,this.else.names),a}}_.kind="if";class $ extends R{}$.kind="for";class P extends ${constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iteration=oe(this.iteration,a,h),this}get names(){return K(super.names,this.iteration.names)}}class I extends ${constructor(a,h,C,M){super(),this.varKind=a,this.name=h,this.from=C,this.to=M}render(a){const h=a.es5?r.varKinds.var:this.varKind,{name:C,from:M,to:q}=this;return`for(${h} ${C}=${M}; ${C}<${q}; ${C}++)`+super.render(a)}get names(){const a=ue(super.names,this.from);return ue(a,this.to)}}class D extends ${constructor(a,h,C,M){super(),this.loop=a,this.varKind=h,this.name=C,this.iterable=M}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iterable=oe(this.iterable,a,h),this}get names(){return K(super.names,this.iterable.names)}}class w extends R{constructor(a,h,C){super(),this.name=a,this.args=h,this.async=C}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}w.kind="func";class k extends N{render(a){return"return "+super.render(a)}}k.kind="return";class A extends R{render(a){let h="try"+super.render(a);return this.catch&&(h+=this.catch.render(a)),this.finally&&(h+=this.finally.render(a)),h}optimizeNodes(){var a,h;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(a,h){var C,M;return super.optimizeNames(a,h),(C=this.catch)===null||C===void 0||C.optimizeNames(a,h),(M=this.finally)===null||M===void 0||M.optimizeNames(a,h),this}get names(){const a=super.names;return this.catch&&K(a,this.catch.names),this.finally&&K(a,this.finally.names),a}}class x extends R{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}x.kind="catch";class z extends R{render(a){return"finally"+super.render(a)}}z.kind="finally";class re{constructor(a,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
620
+ `:""},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,h){const C=this._extScope.value(a,h);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(a,h){return this._extScope.getValue(a,h)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,h,C,M){const q=this._scope.toName(h);return C!==void 0&&M&&(this._constants[q.str]=C),this._leafNode(new o(a,q,C)),q}const(a,h,C){return this._def(r.varKinds.const,a,h,C)}let(a,h,C){return this._def(r.varKinds.let,a,h,C)}var(a,h,C){return this._def(r.varKinds.var,a,h,C)}assign(a,h,C){return this._leafNode(new l(a,h,C))}add(a,h){return this._leafNode(new d(a,e.operators.ADD,h))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new O(a)),this}object(...a){const h=["{"];for(const[C,M]of a)h.length>1&&h.push(","),h.push(C),(C!==M||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,M));return h.push("}"),new t._Code(h)}if(a,h,C){if(this._blockNode(new _(a)),h&&C)this.code(h).else().code(C).endIf();else if(h)this.code(h).endIf();else if(C)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new _(a))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(_,y)}_for(a,h){return this._blockNode(a),h&&this.code(h).endFor(),this}for(a,h){return this._for(new P(a),h)}forRange(a,h,C,M,q=this.opts.es5?r.varKinds.var:r.varKinds.let){const W=this._scope.toName(a);return this._for(new I(q,W,h,C),()=>M(W))}forOf(a,h,C,M=r.varKinds.const){const q=this._scope.toName(a);if(this.opts.es5){const W=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${W}.length`,G=>{this.var(q,(0,t._)`${W}[${G}]`),C(q)})}return this._for(new D("of",M,q,h),()=>C(q))}forIn(a,h,C,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${h})`,C);const q=this._scope.toName(a);return this._for(new D("in",M,q,h),()=>C(q))}endFor(){return this._endBlockNode($)}label(a){return this._leafNode(new u(a))}break(a){return this._leafNode(new p(a))}return(a){const h=new k;if(this._blockNode(h),this.code(a),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(a,h,C){if(!h&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new A;if(this._blockNode(M),this.code(a),h){const q=this.name("e");this._currNode=M.catch=new x(q),h(q)}return C&&(this._currNode=M.finally=new z,this.code(C)),this._endBlockNode(x,z)}throw(a){return this._leafNode(new g(a))}block(a,h){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(h),this}endBlock(a){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const C=this._nodes.length-h;if(C<0||a!==void 0&&C!==a)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${a} expected`);return this._nodes.length=h,this}func(a,h=t.nil,C,M){return this._blockNode(new w(a,h,C)),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,h){const C=this._currNode;if(C instanceof a||h&&C instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${a.kind}/${h.kind}`:a.kind}"`)}_elseNode(a){const h=this._currNode;if(!(h instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const h=this._nodes;h[h.length-1]=a}}e.CodeGen=re;function K(b,a){for(const h in a)b[h]=(b[h]||0)+(a[h]||0);return b}function ue(b,a){return a instanceof t._CodeOrName?K(b,a.names):b}function oe(b,a,h){if(b instanceof t.Name)return C(b);if(!M(b))return b;return new t._Code(b._items.reduce((q,W)=>(W instanceof t.Name&&(W=C(W)),W instanceof t._Code?q.push(...W._items):q.push(W),q),[]));function C(q){const W=h[q.str];return W===void 0||a[q.str]!==1?q:(delete a[q.str],W)}function M(q){return q instanceof t._Code&&q._items.some(W=>W instanceof t.Name&&a[W.str]===1&&h[W.str]!==void 0)}}function ke(b,a){for(const h in a)b[h]=(b[h]||0)-(a[h]||0)}function Ce(b){return typeof b=="boolean"||typeof b=="number"||b===null?!b:(0,t._)`!${j(b)}`}e.not=Ce;const qe=v(e.operators.AND);function et(...b){return b.reduce(qe)}e.and=et;const Ue=v(e.operators.OR);function F(...b){return b.reduce(Ue)}e.or=F;function v(b){return(a,h)=>a===t.nil?h:h===t.nil?a:(0,t._)`${j(a)} ${b} ${j(h)}`}function j(b){return b instanceof t.Name?b:(0,t._)`(${b})`}})(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 k={};for(const A of w)k[A]=!0;return k}e.toHash=n;function s(w,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(i(w,k),!o(k,w.self.RULES.all))}e.alwaysValidSchema=s;function i(w,k=w.schema){const{opts:A,self:x}=w;if(!A.strictSchema||typeof k=="boolean")return;const z=x.RULES.keywords;for(const re in k)z[re]||D(w,`unknown keyword: "${re}"`)}e.checkUnknownRules=i;function o(w,k){if(typeof w=="boolean")return!w;for(const A in w)if(k[A])return!0;return!1}e.schemaHasRules=o;function l(w,k){if(typeof w=="boolean")return!w;for(const A in w)if(A!=="$ref"&&k.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function d({topSchemaRef:w,schemaPath:k},A,x,z){if(!z){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${w}${k}${(0,t.getProperty)(x)}`}e.schemaRefOrVal=d;function u(w){return O(decodeURIComponent(w))}e.unescapeFragment=u;function p(w){return encodeURIComponent(g(w))}e.escapeFragment=p;function g(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=g;function O(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=O;function N(w,k){if(Array.isArray(w))for(const A of w)k(A);else k(w)}e.eachItem=N;function R({mergeNames:w,mergeToName:k,mergeValues:A,resultToName:x}){return(z,re,K,ue)=>{const oe=K===void 0?re:K instanceof t.Name?(re instanceof t.Name?w(z,re,K):k(z,re,K),K):re instanceof t.Name?(k(z,K,re),re):A(re,K);return ue===t.Name&&!(oe instanceof t.Name)?x(z,oe):oe}}e.mergeEvaluated={props:R({mergeNames:(w,k,A)=>w.if((0,t._)`${A} !== true && ${k} !== undefined`,()=>{w.if((0,t._)`${k} === true`,()=>w.assign(A,!0),()=>w.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${k})`))}),mergeToName:(w,k,A)=>w.if((0,t._)`${A} !== true`,()=>{k===!0?w.assign(A,!0):(w.assign(A,(0,t._)`${A} || {}`),y(w,A,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:T}),items:R({mergeNames:(w,k,A)=>w.if((0,t._)`${A} !== true && ${k} !== undefined`,()=>w.assign(A,(0,t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),mergeToName:(w,k,A)=>w.if((0,t._)`${A} !== true`,()=>w.assign(A,k===!0?!0:(0,t._)`${A} > ${k} ? ${A} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function T(w,k){if(k===!0)return w.var("props",!0);const A=w.var("props",(0,t._)`{}`);return k!==void 0&&y(w,A,k),A}e.evaluatedPropsToName=T;function y(w,k,A){Object.keys(A).forEach(x=>w.assign((0,t._)`${k}${(0,t.getProperty)(x)}`,!0))}e.setEvaluated=y;const _={};function $(w,k){return w.scopeValue("func",{ref:k,code:_[k.code]||(_[k.code]=new r._Code(k.code))})}e.useFunc=$;var P;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(P=e.Type||(e.Type={}));function I(w,k,A){if(w instanceof t.Name){const x=k===P.Num;return A?x?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:x?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(w).toString():"/"+g(w)}e.getErrorPath=I;function D(w,k,A=w.opts.strictSchema){if(A){if(k=`strict mode: ${k}`,A===!0)throw new Error(k);w.self.logger.warn(k)}}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:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:_})=>_?(0,t.str)`"${y}" keyword must be ${_} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function s(y,_=e.keywordError,$,P){const{it:I}=y,{gen:D,compositeRule:w,allErrors:k}=I,A=g(y,_,$);P??(w||k)?d(D,A):u(I,(0,t._)`[${A}]`)}e.reportError=s;function i(y,_=e.keywordError,$){const{it:P}=y,{gen:I,compositeRule:D,allErrors:w}=P,k=g(y,_,$);d(I,k),D||w||u(P,n.default.vErrors)}e.reportExtraError=i;function o(y,_){y.assign(n.default.errors,_),y.if((0,t._)`${n.default.vErrors} !== null`,()=>y.if(_,()=>y.assign((0,t._)`${n.default.vErrors}.length`,_),()=>y.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function l({gen:y,keyword:_,schemaValue:$,data:P,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const w=y.name("err");y.forRange("i",I,n.default.errors,k=>{y.const(w,(0,t._)`${n.default.vErrors}[${k}]`),y.if((0,t._)`${w}.instancePath === undefined`,()=>y.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),y.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${_}`),D.opts.verbose&&(y.assign((0,t._)`${w}.schema`,$),y.assign((0,t._)`${w}.data`,P))})}e.extendErrors=l;function d(y,_){const $=y.const("err",_);y.if((0,t._)`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,(0,t._)`[${$}]`),(0,t._)`${n.default.vErrors}.push(${$})`),y.code((0,t._)`${n.default.errors}++`)}function u(y,_){const{gen:$,validateName:P,schemaEnv:I}=y;I.$async?$.throw((0,t._)`new ${y.ValidationError}(${_})`):($.assign((0,t._)`${P}.errors`,_),$.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 g(y,_,$){const{createErrors:P}=y.it;return P===!1?(0,t._)`{}`:O(y,_,$)}function O(y,_,$={}){const{gen:P,it:I}=y,D=[N(I,$),R(y,$)];return T(y,_,D),P.object(...D)}function N({errorPath:y},{instancePath:_}){const $=_?(0,t.str)`${y}${(0,r.getErrorPath)(_,r.Type.Str)}`:y;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,$)]}function R({keyword:y,it:{errSchemaPath:_}},{schemaPath:$,parentSchema:P}){let I=P?_:(0,t.str)`${_}/${y}`;return $&&(I=(0,t.str)`${I}${(0,r.getErrorPath)($,r.Type.Str)}`),[p.schemaPath,I]}function T(y,{params:_,message:$},P){const{keyword:I,data:D,schemaValue:w,it:k}=y,{opts:A,propertyName:x,topSchemaRef:z,schemaPath:re}=k;P.push([p.keyword,I],[p.params,typeof _=="function"?_(y):_||(0,t._)`{}`]),A.messages&&P.push([p.message,typeof $=="function"?$(y):$]),A.verbose&&P.push([p.schema,w],[p.parentSchema,(0,t._)`${z}${re}`],[n.default.data,D]),x&&P.push([p.propertyName,x])}})(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,i=util;var o;(function(P){P[P.Correct=0]="Correct",P[P.Wrong=1]="Wrong"})(o=e.DataType||(e.DataType={}));function l(P){const I=d(P.type);if(I.includes("null")){if(P.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&P.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');P.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=l;function d(P){const I=Array.isArray(P)?P:P?[P]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=d;function u(P,I){const{gen:D,data:w,opts:k}=P,A=g(I,k.coerceTypes),x=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(P,I[0]));if(x){const z=T(I,w,k.strictNumbers,o.Wrong);D.if(z,()=>{A.length?O(P,I,A):_(P)})}return x}e.coerceAndCheckDataType=u;const p=new Set(["string","number","integer","boolean","null"]);function g(P,I){return I?P.filter(D=>p.has(D)||I==="array"&&D==="array"):[]}function O(P,I,D){const{gen:w,data:k,opts:A}=P,x=w.let("dataType",(0,s._)`typeof ${k}`),z=w.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&w.if((0,s._)`${x} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>w.assign(k,(0,s._)`${k}[0]`).assign(x,(0,s._)`typeof ${k}`).if(T(I,k,A.strictNumbers),()=>w.assign(z,k))),w.if((0,s._)`${z} !== undefined`);for(const K of D)(p.has(K)||K==="array"&&A.coerceTypes==="array")&&re(K);w.else(),_(P),w.endIf(),w.if((0,s._)`${z} !== undefined`,()=>{w.assign(k,z),N(P,z)});function re(K){switch(K){case"string":w.elseIf((0,s._)`${x} == "number" || ${x} == "boolean"`).assign(z,(0,s._)`"" + ${k}`).elseIf((0,s._)`${k} === null`).assign(z,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${x} == "boolean" || ${k} === null
604
621
  || (${x} == "string" && ${k} && ${k} == +${k})`).assign(z,(0,s._)`+${k}`);return;case"integer":w.elseIf((0,s._)`${x} === "boolean" || ${k} === null
605
622
  || (${x} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(z,(0,s._)`+${k}`);return;case"boolean":w.elseIf((0,s._)`${k} === "false" || ${k} === 0 || ${k} === null`).assign(z,!1).elseIf((0,s._)`${k} === "true" || ${k} === 1`).assign(z,!0);return;case"null":w.elseIf((0,s._)`${k} === "" || ${k} === 0 || ${k} === false`),w.assign(z,null);return;case"array":w.elseIf((0,s._)`${x} === "string" || ${x} === "number"
606
- || ${x} === "boolean" || ${k} === null`).assign(z,(0,s._)`[${k}]`)}}}function N({gen:S,parentData:I,parentDataProperty:D},w){S.if((0,s._)`${I} !== undefined`,()=>S.assign((0,s._)`${I}[${D}]`,w))}function R(S,I,D,w=o.Correct){const k=w===o.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(S){case"null":return(0,s._)`${I} ${k} 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=x((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=x();break;default:return(0,s._)`typeof ${I} ${k} ${S}`}return w===o.Correct?A:(0,s.not)(A);function x(z=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,z,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=R;function v(S,I,D,w){if(S.length===1)return R(S[0],I,D,w);let k;const A=(0,i.toHash)(S);if(A.array&&A.object){const x=(0,s._)`typeof ${I} != "object"`;k=A.null?x:(0,s._)`!${I} || ${x}`,delete A.null,delete A.array,delete A.object}else k=s.nil;A.number&&delete A.integer;for(const x in A)k=(0,s.and)(k,R(x,I,D,w));return k}e.checkDataTypes=v;const g={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:I})=>typeof S=="string"?(0,s._)`{type: ${S}}`:(0,s._)`{type: ${I}}`};function m(S){const I=T(S);(0,n.reportError)(I,g)}e.reportTypeError=m;function T(S){const{gen:I,data:D,schema:w}=S,k=(0,i.schemaRefOrVal)(S,w,"type");return{gen:I,keyword:"type",data:D,schema:w.type,schemaCode:k,schemaValue:k,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,i)=>assignDefault(e,i,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;const l=(0,codegen_1$r._)`${i}${(0,codegen_1$r.getProperty)(t)}`;if(s){(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${l}`);return}let d=(0,codegen_1$r._)`${l} === undefined`;o.useDefaults==="empty"&&(d=(0,codegen_1$r._)`${d} || ${l} === null || ${l} === ""`),n.if(d,(0,codegen_1$r._)`${l} = ${(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(i=>(0,codegen_1$q.and)(noPropertyInData(e,t,i,r.ownProperties),(0,codegen_1$q._)`${s} = ${i}`)))}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:i},it:o},l,d,u){const p=u?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,$=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,i)],[names_1$5.default.parentData,o.parentData],[names_1$5.default.parentDataProperty,o.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];o.opts.dynamicRef&&$.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const O=(0,codegen_1$q._)`${p}, ${r.object(...$)}`;return d!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${d}, ${O})`:(0,codegen_1$q._)`${l}(${O})`}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,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,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,i=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return o(()=>t.assign(l,!1)),l}return t.var(i,!0),o(()=>t.break()),i;function o(l){const d=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,d,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:util_1$o.Type.Num},i),t.if((0,codegen_1$q.not)(i),l)})}}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(d=>(0,util_1$o.alwaysValidSchema)(s,d))&&!s.opts.unevaluated)return;const o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((d,u)=>{const p=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(o,(0,codegen_1$q._)`${o} || ${l}`),e.mergeValidEvaluated(p,l)||t.if((0,codegen_1$q.not)(o))})),e.result(o,()=>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:i,it:o}=e,l=t.macro.call(o.self,s,i,o),d=useKeyword(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:codegen_1$p.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:o,$data:l,it:d}=e;checkAsyncKeyword(d,t);const u=!l&&t.compile?t.compile.call(d.self,i,o,d):t.validate,p=useKeyword(n,s,u),$=n.let("valid");e.block$data($,O),e.ok((r=t.valid)!==null&&r!==void 0?r:$);function O(){if(t.errors===!1)v(),t.modifying&&modifyData(e),g(()=>e.error());else{const m=t.async?N():R();t.modifying&&modifyData(e),g(()=>addErrs(e,m))}}function N(){const m=n.let("ruleErrs",null);return n.try(()=>v((0,codegen_1$p._)`await `),T=>n.assign($,!1).if((0,codegen_1$p._)`${T} instanceof ${d.ValidationError}`,()=>n.assign(m,(0,codegen_1$p._)`${T}.errors`),()=>n.throw(T))),m}function R(){const m=(0,codegen_1$p._)`${p}.errors`;return n.assign(m,null),v(codegen_1$p.nil),m}function v(m=t.async?(0,codegen_1$p._)`await `:codegen_1$p.nil){const T=d.opts.passContext?names_1$4.default.this:names_1$4.default.self,S=!("compile"in t&&!l||t.schema===!1);n.assign($,(0,codegen_1$p._)`${m}${(0,code_1$9.callValidateCode)(e,p,T,S)}`,t.modifying)}function g(m){var T;n.if((0,codegen_1$p.not)((T=t.valid)!==null&&T!==void 0?T:$),m)}}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,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const o=s.dependencies;if(o!=null&&o.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const d=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(d);else throw new Error(d)}}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:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const l=e.schema[t];return r===void 0?{schema:l,schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[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||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(r!==void 0){const{errorPath:u,dataPathArr:p,opts:$}=t,O=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);d(O),e.errorPath=(0,codegen_1$o.str)`${u}${(0,util_1$n.getErrorPath)(r,n,$.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const u=s instanceof codegen_1$o.Name?s:l.let("data",s,!0);d(u),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function d(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),i!==void 0&&(e.allErrors=i),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,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 o=i[s];if(!e(t[o],r[o]))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,i,o,l,d,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,l,d,u);for(var p in n){var $=n[p];if(Array.isArray($)){if(p in traverse$1.arrayKeywords)for(var O=0;O<$.length;O++)_traverse(e,t,r,$[O],s+"/"+p+"/"+O,i,s,p,n,O)}else if(p in traverse$1.propsKeywords){if($&&typeof $=="object")for(var N in $)_traverse(e,t,r,$[N],s+"/"+p+"/"+escapeJsonPtr(N),i,s,p,n,N)}else(p in traverse$1.keywords||e.allKeys&&!(p in traverse$1.skipKeywords))&&_traverse(e,t,r,$,s+"/"+p,i,s,p,n)}r(n,s,i,o,l,d,u)}}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),i={"":s},o=getFullPath(n,s,!1),l={},d=new Set;return traverse(e,{allKeys:!0},($,O,N,R)=>{if(R===void 0)return;const v=o+O;let g=i[R];typeof $[r]=="string"&&(g=m.call(this,$[r])),T.call(this,$.$anchor),T.call(this,$.$dynamicAnchor),i[O]=g;function m(S){const I=this.opts.uriResolver.resolve;if(S=normalizeId(g?I(g,S):S),d.has(S))throw p(S);d.add(S);let D=this.refs[S];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?u($,D.schema,S):S!==normalizeId(v)&&(S[0]==="#"?(u($,l[S],S),l[S]=$):this.refs[S]=v),S}function T(S){if(typeof S=="string"){if(!ANCHOR.test(S))throw new Error(`invalid anchor "${S}"`);m.call(this,`#${S}`)}}}),l;function u($,O,N){if(O!==void 0&&!equal$2($,O))throw p(N)}function p($){return new Error(`reference "${$}" 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},i){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(i)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(i))}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 i=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,i),n.var(t,(0,codegen_1$n._)`${i} === ${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 i=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const o=(0,codegen_1$n.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${i}, ${o}, ${l}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=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),i.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:i,data:o,allErrors:l,opts:d,self:u}=e,{RULES:p}=u;if(i.$ref&&(d.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(i,p))){s.block(()=>keywordCode(e,"$ref",p.all.$ref.definition));return}d.jtd||checkStrictTypes(e,t),s.block(()=>{for(const O of p.rules)$(O);$(p.post)});function $(O){(0,applicability_1.shouldUseGroup)(i,O)&&(O.type?(s.if((0,dataType_2.checkDataType)(O.type,o,d.strictNumbers)),iterateKeywords(e,O),t.length===1&&t[0]===O.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,O),l||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}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 i of t.rules)(0,applicability_1.shouldUseRule)(n,i)&&keywordCode(e,i.keyword,i.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:i}=s.definition;i.length&&!i.some(o=>hasApplicableType(t,o))&&strictTypesError(e,`missing type "${i.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:i,def:o}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(i.length||o.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:i}=this;return(0,codegen_1$n.or)(o(),l());function o(){if(n.length){if(!(r instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const d=Array.isArray(n)?n:[n];return(0,codegen_1$n._)`${(0,dataType_2.checkDataTypes)(d,r,i.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}function l(){if(s.validateSchema){const d=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,codegen_1$n._)`!${d}(${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,i;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,i=names_1$3.default.rootData}else{const u=RELATIVE_JSON_POINTER.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+u[1];if(s=u[2],s==="#"){if(p>=t)throw new Error(d("property/index",p));return n[t-p]}if(p>t)throw new Error(d("data",p));if(i=r[t-p],!s)return i}let o=i;const l=s.split("/");for(const u of l)u&&(i=(0,codegen_1$n._)`${i}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(u))}`,o=(0,codegen_1$n._)`${o} && ${i}`);return o;function d(u,p){return`Cannot access ${u} ${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:i}=this.opts,o=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=o.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const d=o.scopeName("validate");e.validateName=d;const u={gen:o,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:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:l,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)(u),o.optimize(this.opts.code.optimize);const $=o.toString();p=`${o.scopeRefs(names_1$2.default.scope)}return ${$}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const N=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,p)(this,this.scope.get());if(this.scope.value(d,{ref:N}),N.errors=null,N.schema=e.schema,N.schemaEnv=e,e.$async&&(N.$async=!0),this.opts.code.source===!0&&(N.source={validateName:d,validateCode:$,scopeValues:o._values}),this.opts.unevaluated){const{props:R,items:v}=u;N.evaluated={props:R instanceof codegen_1$m.Name?void 0:R,items:v instanceof codegen_1$m.Name?void 0:v,dynamicProps:R instanceof codegen_1$m.Name,dynamicItems:v instanceof codegen_1$m.Name},N.source&&(N.source.evaluated=(0,codegen_1$m.stringify)(N.evaluated))}return e.validate=N,e}catch($){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),$}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 i=resolve.call(this,e,r);if(i===void 0){const o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(i=new SchemaEnv({schema:o,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=inlineOrCompile.call(this,i)}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 i=(0,resolve_1.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){const l=resolveSchema.call(this,e,o);return typeof(l==null?void 0:l.schema)!="object"?void 0:getJsonPointer.call(this,r,l)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||compileSchema.call(this,o),i===(0,resolve_1.normalizeId)(t)){const{schema:l}=o,{schemaId:d}=this.opts,u=l[d];return u&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,u)),new SchemaEnv({schema:l,schemaId:d,root:e,baseId:s})}return getJsonPointer.call(this,r,o)}}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 l of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const d=r[(0,util_1$k.unescapeFragment)(l)];if(d===void 0)return;r=d;const u=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(l)&&u&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const l=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=resolveSchema.call(this,n,l)}const{schemaId:o}=this.opts;if(i=i||new SchemaEnv({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i}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 f=arguments.length,c=Array(f),_=0;_<f;_++)c[_]=arguments[_];if(c.length>1){c[0]=c[0].slice(0,-1);for(var E=c.length-1,b=1;b<E;++b)c[b]=c[b].slice(1,-1);return c[E]=c[E].slice(1),c.join("")}else return c[0]}function s(f){return"(?:"+f+")"}function i(f){return f===void 0?"undefined":f===null?"null":Object.prototype.toString.call(f).split(" ").pop().split("]").shift().toLowerCase()}function o(f){return f.toUpperCase()}function l(f){return f!=null?f instanceof Array?f:typeof f.length!="number"||f.split||f.setInterval||f.call?[f]:Array.prototype.slice.call(f):[]}function d(f,c){var _=f;if(c)for(var E in c)_[E]=c[E];return _}function u(f){var c="[A-Za-z]",_="[0-9]",E=n(_,"[A-Fa-f]"),b=s(s("%[EFef]"+E+"%"+E+E+"%"+E+E)+"|"+s("%[89A-Fa-f]"+E+"%"+E+E)+"|"+s("%"+E+E)),U="[\\:\\/\\?\\#\\[\\]\\@]",L="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",J=n(U,L),Y=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",se=f?"[\\uE000-\\uF8FF]":"[]",B=n(c,_,"[\\-\\.\\_\\~]",Y);s(c+n(c,_,"[\\+\\-\\.]")+"*"),s(s(b+"|"+n(B,L,"[\\:]"))+"*");var Z=s(s("25[0-5]")+"|"+s("2[0-4]"+_)+"|"+s("1"+_+_)+"|"+s("0?[1-9]"+_)+"|0?0?"+_),ie=s(Z+"\\."+Z+"\\."+Z+"\\."+Z),V=s(E+"{1,4}"),X=s(s(V+"\\:"+V)+"|"+ie),ae=s(s(V+"\\:")+"{6}"+X),ee=s("\\:\\:"+s(V+"\\:")+"{5}"+X),Se=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+X),$e=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+X),ge=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+X),Be=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+X),Ie=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+X),fe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),ye=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),je=s([ae,ee,Se,$e,ge,Be,Ie,fe,ye].join("|")),we=s(s(B+"|"+b)+"+");s("[vV]"+E+"+\\."+n(B,L,"[\\:]")+"+"),s(s(b+"|"+n(B,L))+"*");var ct=s(b+"|"+n(B,L,"[\\:\\@]"));return s(s(b+"|"+n(B,L,"[\\@]"))+"+"),s(s(ct+"|"+n("[\\/\\?]",se))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,_,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",B,L),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",B,L),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",B,L),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",B,L),"g"),NOT_QUERY:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]",se),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",B,L),"g"),UNRESERVED:new RegExp(B,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",B,J),"g"),PCT_ENCODED:new RegExp(b,"g"),IPV4ADDRESS:new RegExp("^("+ie+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+s(s("\\%25|\\%(?!"+E+"{2})")+"("+we+")")+"?\\]?$")}}var p=u(!1),$=u(!0),O=function(){function f(c,_){var E=[],b=!0,U=!1,L=void 0;try{for(var J=c[Symbol.iterator](),Y;!(b=(Y=J.next()).done)&&(E.push(Y.value),!(_&&E.length===_));b=!0);}catch(se){U=!0,L=se}finally{try{!b&&J.return&&J.return()}finally{if(U)throw L}}return E}return function(c,_){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),N=function(f){if(Array.isArray(f)){for(var c=0,_=Array(f.length);c<f.length;c++)_[c]=f[c];return _}else return Array.from(f)},R=2147483647,v=36,g=1,m=26,T=38,S=700,I=72,D=128,w="-",k=/^xn--/,A=/[^\0-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=v-g,K=Math.floor,ue=String.fromCharCode;function oe(f){throw new RangeError(z[f])}function ke(f,c){for(var _=[],E=f.length;E--;)_[E]=c(f[E]);return _}function Oe(f,c){var _=f.split("@"),E="";_.length>1&&(E=_[0]+"@",f=_[1]),f=f.replace(x,".");var b=f.split("."),U=ke(b,c).join(".");return E+U}function qe(f){for(var c=[],_=0,E=f.length;_<E;){var b=f.charCodeAt(_++);if(b>=55296&&b<=56319&&_<E){var U=f.charCodeAt(_++);(U&64512)==56320?c.push(((b&1023)<<10)+(U&1023)+65536):(c.push(b),_--)}else c.push(b)}return c}var et=function(c){return String.fromCodePoint.apply(String,N(c))},Ue=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:v},F=function(c,_){return c+22+75*(c<26)-((_!=0)<<5)},y=function(c,_,E){var b=0;for(c=E?K(c/S):c>>1,c+=K(c/_);c>re*m>>1;b+=v)c=K(c/re);return K(b+(re+1)*c/(c+T))},j=function(c){var _=[],E=c.length,b=0,U=D,L=I,J=c.lastIndexOf(w);J<0&&(J=0);for(var Y=0;Y<J;++Y)c.charCodeAt(Y)>=128&&oe("not-basic"),_.push(c.charCodeAt(Y));for(var se=J>0?J+1:0;se<E;){for(var B=b,Z=1,ie=v;;ie+=v){se>=E&&oe("invalid-input");var V=Ue(c.charCodeAt(se++));(V>=v||V>K((R-b)/Z))&&oe("overflow"),b+=V*Z;var X=ie<=L?g:ie>=L+m?m:ie-L;if(V<X)break;var ae=v-X;Z>K(R/ae)&&oe("overflow"),Z*=ae}var ee=_.length+1;L=y(b-B,ee,B==0),K(b/ee)>R-U&&oe("overflow"),U+=K(b/ee),b%=ee,_.splice(b++,0,U)}return String.fromCodePoint.apply(String,_)},P=function(c){var _=[];c=qe(c);var E=c.length,b=D,U=0,L=I,J=!0,Y=!1,se=void 0;try{for(var B=c[Symbol.iterator](),Z;!(J=(Z=B.next()).done);J=!0){var ie=Z.value;ie<128&&_.push(ue(ie))}}catch(lt){Y=!0,se=lt}finally{try{!J&&B.return&&B.return()}finally{if(Y)throw se}}var V=_.length,X=V;for(V&&_.push(w);X<E;){var ae=R,ee=!0,Se=!1,$e=void 0;try{for(var ge=c[Symbol.iterator](),Be;!(ee=(Be=ge.next()).done);ee=!0){var Ie=Be.value;Ie>=b&&Ie<ae&&(ae=Ie)}}catch(lt){Se=!0,$e=lt}finally{try{!ee&&ge.return&&ge.return()}finally{if(Se)throw $e}}var fe=X+1;ae-b>K((R-U)/fe)&&oe("overflow"),U+=(ae-b)*fe,b=ae;var ye=!0,je=!1,we=void 0;try{for(var ct=c[Symbol.iterator](),Lt;!(ye=(Lt=ct.next()).done);ye=!0){var Ht=Lt.value;if(Ht<b&&++U>R&&oe("overflow"),Ht==b){for(var pt=U,ft=v;;ft+=v){var ht=ft<=L?g:ft>=L+m?m:ft-L;if(pt<ht)break;var xt=pt-ht,Vt=v-ht;_.push(ue(F(ht+xt%Vt,0))),pt=K(xt/Vt)}_.push(ue(F(pt,0))),L=y(U,fe,X==V),U=0,++X}}}catch(lt){je=!0,we=lt}finally{try{!ye&&ct.return&&ct.return()}finally{if(je)throw we}}++U,++b}return _.join("")},a=function(c){return Oe(c,function(_){return k.test(_)?j(_.slice(4).toLowerCase()):_})},h=function(c){return Oe(c,function(_){return A.test(_)?"xn--"+P(_):_})},C={version:"2.1.0",ucs2:{decode:qe,encode:et},decode:j,encode:P,toASCII:h,toUnicode:a},M={};function q(f){var c=f.charCodeAt(0),_=void 0;return c<16?_="%0"+c.toString(16).toUpperCase():c<128?_="%"+c.toString(16).toUpperCase():c<2048?_="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():_="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),_}function W(f){for(var c="",_=0,E=f.length;_<E;){var b=parseInt(f.substr(_+1,2),16);if(b<128)c+=String.fromCharCode(b),_+=3;else if(b>=194&&b<224){if(E-_>=6){var U=parseInt(f.substr(_+4,2),16);c+=String.fromCharCode((b&31)<<6|U&63)}else c+=f.substr(_,6);_+=6}else if(b>=224){if(E-_>=9){var L=parseInt(f.substr(_+4,2),16),J=parseInt(f.substr(_+7,2),16);c+=String.fromCharCode((b&15)<<12|(L&63)<<6|J&63)}else c+=f.substr(_,9);_+=9}else c+=f.substr(_,3),_+=3}return c}function G(f,c){function _(E){var b=W(E);return b.match(c.UNRESERVED)?b:E}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,_).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,_).replace(c.NOT_USERINFO,q).replace(c.PCT_ENCODED,o)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,_).toLowerCase().replace(c.NOT_HOST,q).replace(c.PCT_ENCODED,o)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,_).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,q).replace(c.PCT_ENCODED,o)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,_).replace(c.NOT_QUERY,q).replace(c.PCT_ENCODED,o)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,_).replace(c.NOT_FRAGMENT,q).replace(c.PCT_ENCODED,o)),f}function ne(f){return f.replace(/^0*(.*)/,"$1")||"0"}function he(f,c){var _=f.match(c.IPV4ADDRESS)||[],E=O(_,2),b=E[1];return b?b.split(".").map(ne).join("."):f}function Le(f,c){var _=f.match(c.IPV6ADDRESS)||[],E=O(_,3),b=E[1],U=E[2];if(b){for(var L=b.toLowerCase().split("::").reverse(),J=O(L,2),Y=J[0],se=J[1],B=se?se.split(":").map(ne):[],Z=Y.split(":").map(ne),ie=c.IPV4ADDRESS.test(Z[Z.length-1]),V=ie?7:8,X=Z.length-V,ae=Array(V),ee=0;ee<V;++ee)ae[ee]=B[ee]||Z[X+ee]||"";ie&&(ae[V-1]=he(ae[V-1],c));var Se=ae.reduce(function(fe,ye,je){if(!ye||ye==="0"){var we=fe[fe.length-1];we&&we.index+we.length===je?we.length++:fe.push({index:je,length:1})}return fe},[]),$e=Se.sort(function(fe,ye){return ye.length-fe.length})[0],ge=void 0;if($e&&$e.length>1){var Be=ae.slice(0,$e.index),Ie=ae.slice($e.index+$e.length);ge=Be.join(":")+"::"+Ie.join(":")}else ge=ae.join(":");return U&&(ge+="%"+U),ge}else return f}var tt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,rt="".match(/(){0}/)[1]===void 0;function de(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},E=c.iri!==!1?$:p;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var b=f.match(tt);if(b){rt?(_.scheme=b[1],_.userinfo=b[3],_.host=b[4],_.port=parseInt(b[5],10),_.path=b[6]||"",_.query=b[7],_.fragment=b[8],isNaN(_.port)&&(_.port=b[5])):(_.scheme=b[1]||void 0,_.userinfo=f.indexOf("@")!==-1?b[3]:void 0,_.host=f.indexOf("//")!==-1?b[4]:void 0,_.port=parseInt(b[5],10),_.path=b[6]||"",_.query=f.indexOf("?")!==-1?b[7]:void 0,_.fragment=f.indexOf("#")!==-1?b[8]:void 0,isNaN(_.port)&&(_.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b[4]:void 0)),_.host&&(_.host=Le(he(_.host,E),E)),_.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",c.reference&&c.reference!=="suffix"&&c.reference!==_.reference&&(_.error=_.error||"URI is not a "+c.reference+" reference.");var U=M[(c.scheme||_.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(_.host&&(c.domainHost||U&&U.domainHost))try{_.host=C.toASCII(_.host.replace(E.PCT_ENCODED,W).toLowerCase())}catch(L){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+L}G(_,p)}else G(_,E);U&&U.parse&&U.parse(_,c)}else _.error=_.error||"URI can not be parsed.";return _}function nt(f,c){var _=c.iri!==!1?$:p,E=[];return f.userinfo!==void 0&&(E.push(f.userinfo),E.push("@")),f.host!==void 0&&E.push(Le(he(String(f.host),_),_).replace(_.IPV6ADDRESS,function(b,U,L){return"["+U+(L?"%25"+L:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(E.push(":"),E.push(String(f.port))),E.length?E.join(""):void 0}var He=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ve=/^\/\.\.(\/|$)/,st=/^\/?(?:.|\n)*?(?=\/|$)/;function me(f){for(var c=[];f.length;)if(f.match(He))f=f.replace(He,"");else if(f.match(xe))f=f.replace(xe,"/");else if(f.match(Ve))f=f.replace(Ve,"/"),c.pop();else if(f==="."||f==="..")f="";else{var _=f.match(st);if(_){var E=_[0];f=f.slice(E.length),c.push(E)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function le(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=c.iri?$:p,E=[],b=M[(c.scheme||f.scheme||"").toLowerCase()];if(b&&b.serialize&&b.serialize(f,c),f.host&&!_.IPV6ADDRESS.test(f.host)){if(c.domainHost||b&&b.domainHost)try{f.host=c.iri?C.toUnicode(f.host):C.toASCII(f.host.replace(_.PCT_ENCODED,W).toLowerCase())}catch(J){f.error=f.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+J}}G(f,_),c.reference!=="suffix"&&f.scheme&&(E.push(f.scheme),E.push(":"));var U=nt(f,c);if(U!==void 0&&(c.reference!=="suffix"&&E.push("//"),E.push(U),f.path&&f.path.charAt(0)!=="/"&&E.push("/")),f.path!==void 0){var L=f.path;!c.absolutePath&&(!b||!b.absolutePath)&&(L=me(L)),U===void 0&&(L=L.replace(/^\/\//,"/%2F")),E.push(L)}return f.query!==void 0&&(E.push("?"),E.push(f.query)),f.fragment!==void 0&&(E.push("#"),E.push(f.fragment)),E.join("")}function ze(f,c){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments[3],b={};return E||(f=de(le(f,_),_),c=de(le(c,_),_)),_=_||{},!_.tolerant&&c.scheme?(b.scheme=c.scheme,b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.path?(c.path.charAt(0)==="/"?b.path=me(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?b.path="/"+c.path:f.path?b.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:b.path=c.path,b.path=me(b.path)),b.query=c.query):(b.path=f.path,c.query!==void 0?b.query=c.query:b.query=f.query),b.userinfo=f.userinfo,b.host=f.host,b.port=f.port),b.scheme=f.scheme),b.fragment=c.fragment,b}function it(f,c,_){var E=d({scheme:"null"},_);return le(ze(de(f,E),de(c,E),E,!0),E)}function Ce(f,c){return typeof f=="string"?f=le(de(f,c),c):i(f)==="object"&&(f=de(le(f,c),c)),f}function ot(f,c,_){return typeof f=="string"?f=le(de(f,_),_):i(f)==="object"&&(f=le(f,_)),typeof c=="string"?c=le(de(c,_),_):i(c)==="object"&&(c=le(c,_)),f===c}function ut(f,c){return f&&f.toString().replace(!c||!c.iri?p.ESCAPE:$.ESCAPE,q)}function pe(f,c){return f&&f.toString().replace(!c||!c.iri?p.PCT_ENCODED:$.PCT_ENCODED,W)}var Ne={scheme:"http",domainHost:!0,parse:function(c,_){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,_){var E=String(c.scheme).toLowerCase()==="https";return(c.port===(E?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},It={scheme:"https",domainHost:Ne.domainHost,parse:Ne.parse,serialize:Ne.serialize};function jt(f){return typeof f.secure=="boolean"?f.secure:String(f.scheme).toLowerCase()==="wss"}var at={scheme:"ws",domainHost:!0,parse:function(c,_){var E=c;return E.secure=jt(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E},serialize:function(c,_){if((c.port===(jt(c)?443:80)||c.port==="")&&(c.port=void 0),typeof c.secure=="boolean"&&(c.scheme=c.secure?"wss":"ws",c.secure=void 0),c.resourceName){var E=c.resourceName.split("?"),b=O(E,2),U=b[0],L=b[1];c.path=U&&U!=="/"?U:void 0,c.query=L,c.resourceName=void 0}return c.fragment=void 0,c}},At={scheme:"wss",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize},ir={},Dt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_e="[0-9A-Fa-f]",or=s(s("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+s("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+s("%"+_e+_e)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",cr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lr=n(cr,'[\\"\\\\]'),dr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(Dt,"g"),We=new RegExp(or,"g"),pr=new RegExp(n("[^]",ar,"[\\.]",'[\\"]',lr),"g"),Ft=new RegExp(n("[^]",Dt,dr),"g"),fr=Ft;function Ct(f){var c=W(f);return c.match(ur)?c:f}var Mt={scheme:"mailto",parse:function(c,_){var E=c,b=E.to=E.path?E.path.split(","):[];if(E.path=void 0,E.query){for(var U=!1,L={},J=E.query.split("&"),Y=0,se=J.length;Y<se;++Y){var B=J[Y].split("=");switch(B[0]){case"to":for(var Z=B[1].split(","),ie=0,V=Z.length;ie<V;++ie)b.push(Z[ie]);break;case"subject":E.subject=pe(B[1],_);break;case"body":E.body=pe(B[1],_);break;default:U=!0,L[pe(B[0],_)]=pe(B[1],_);break}}U&&(E.headers=L)}E.query=void 0;for(var X=0,ae=b.length;X<ae;++X){var ee=b[X].split("@");if(ee[0]=pe(ee[0]),_.unicodeSupport)ee[1]=pe(ee[1],_).toLowerCase();else try{ee[1]=C.toASCII(pe(ee[1],_).toLowerCase())}catch(Se){E.error=E.error||"Email address's domain name can not be converted to ASCII via punycode: "+Se}b[X]=ee.join("@")}return E},serialize:function(c,_){var E=c,b=l(c.to);if(b){for(var U=0,L=b.length;U<L;++U){var J=String(b[U]),Y=J.lastIndexOf("@"),se=J.slice(0,Y).replace(We,Ct).replace(We,o).replace(pr,q),B=J.slice(Y+1);try{B=_.iri?C.toUnicode(B):C.toASCII(pe(B,_).toLowerCase())}catch(X){E.error=E.error||"Email address's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+X}b[U]=se+"@"+B}E.path=b.join(",")}var Z=c.headers=c.headers||{};c.subject&&(Z.subject=c.subject),c.body&&(Z.body=c.body);var ie=[];for(var V in Z)Z[V]!==ir[V]&&ie.push(V.replace(We,Ct).replace(We,o).replace(Ft,q)+"="+Z[V].replace(We,Ct).replace(We,o).replace(fr,q));return ie.length&&(E.query=ie.join("&")),E}},hr=/^([^\:]+)\:(.*)/,qt={scheme:"urn",parse:function(c,_){var E=c.path&&c.path.match(hr),b=c;if(E){var U=_.scheme||b.scheme||"urn",L=E[1].toLowerCase(),J=E[2],Y=U+":"+(_.nid||L),se=M[Y];b.nid=L,b.nss=J,b.path=void 0,se&&(b=se.parse(b,_))}else b.error=b.error||"URN can not be parsed.";return b},serialize:function(c,_){var E=_.scheme||c.scheme||"urn",b=c.nid,U=E+":"+(_.nid||b),L=M[U];L&&(c=L.serialize(c,_));var J=c,Y=c.nss;return J.path=(b||_.nid)+":"+Y,J}},mr=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ut={scheme:"urn:uuid",parse:function(c,_){var E=c;return E.uuid=E.nss,E.nss=void 0,!_.tolerant&&(!E.uuid||!E.uuid.match(mr))&&(E.error=E.error||"UUID is not valid."),E},serialize:function(c,_){var E=c;return E.nss=(c.uuid||"").toLowerCase(),E}};M[Ne.scheme]=Ne,M[It.scheme]=It,M[at.scheme]=at,M[At.scheme]=At,M[Mt.scheme]=Mt,M[qt.scheme]=qt,M[Ut.scheme]=Ut,r.SCHEMES=M,r.pctEncChar=q,r.pctDecChars=W,r.parse=de,r.removeDotSegments=me,r.serialize=le,r.resolveComponents=ze,r.resolve=it,r.normalize=Ce,r.equal=ot,r.escapeComponent=ut,r.unescapeComponent=pe,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,i=rules,o=compile,l=codegen,d=resolve$1,u=dataType,p=util,$=require$$9,O=uri$1,N=(F,y)=>new RegExp(F,y);N.code="new RegExp";const R=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={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."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},T=200;function S(F){var y,j,P,a,h,C,M,q,W,G,ne,he,Le,tt,rt,de,nt,He,xe,Ve,st,me,le,ze,it;const Ce=F.strict,ot=(y=F.code)===null||y===void 0?void 0:y.optimize,ut=ot===!0||ot===void 0?1:ot||0,pe=(P=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&P!==void 0?P:N,Ne=(a=F.uriResolver)!==null&&a!==void 0?a:O.default;return{strictSchema:(C=(h=F.strictSchema)!==null&&h!==void 0?h:Ce)!==null&&C!==void 0?C:!0,strictNumbers:(q=(M=F.strictNumbers)!==null&&M!==void 0?M:Ce)!==null&&q!==void 0?q:!0,strictTypes:(G=(W=F.strictTypes)!==null&&W!==void 0?W:Ce)!==null&&G!==void 0?G:"log",strictTuples:(he=(ne=F.strictTuples)!==null&&ne!==void 0?ne:Ce)!==null&&he!==void 0?he:"log",strictRequired:(tt=(Le=F.strictRequired)!==null&&Le!==void 0?Le:Ce)!==null&&tt!==void 0?tt:!1,code:F.code?{...F.code,optimize:ut,regExp:pe}:{optimize:ut,regExp:pe},loopRequired:(rt=F.loopRequired)!==null&&rt!==void 0?rt:T,loopEnum:(de=F.loopEnum)!==null&&de!==void 0?de:T,meta:(nt=F.meta)!==null&&nt!==void 0?nt:!0,messages:(He=F.messages)!==null&&He!==void 0?He:!0,inlineRefs:(xe=F.inlineRefs)!==null&&xe!==void 0?xe:!0,schemaId:(Ve=F.schemaId)!==null&&Ve!==void 0?Ve:"$id",addUsedSchema:(st=F.addUsedSchema)!==null&&st!==void 0?st:!0,validateSchema:(me=F.validateSchema)!==null&&me!==void 0?me:!0,validateFormats:(le=F.validateFormats)!==null&&le!==void 0?le:!0,unicodeRegExp:(ze=F.unicodeRegExp)!==null&&ze!==void 0?ze:!0,int32range:(it=F.int32range)!==null&&it!==void 0?it:!0,uriResolver:Ne}}class I{constructor(y={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,y=this.opts={...y,...S(y)};const{es5:j,lines:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:v,es5:j,lines:P}),this.logger=K(y.logger);const a=y.validateFormats;y.validateFormats=!1,this.RULES=(0,i.getRules)(),D.call(this,g,y,"NOT SUPPORTED"),D.call(this,m,y,"DEPRECATED","warn"),this._metaOpts=z.call(this),y.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),y.keywords&&x.call(this,y.keywords),typeof y.meta=="object"&&this.addMetaSchema(y.meta),k.call(this),y.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:y,meta:j,schemaId:P}=this.opts;let a=$;P==="id"&&(a={...$},a.id=a.$id,delete a.$id),j&&y&&this.addMetaSchema(a,a[P],!1)}defaultMeta(){const{meta:y,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof y=="object"?y[j]||y:void 0}validate(y,j){let P;if(typeof y=="string"){if(P=this.getSchema(y),!P)throw new Error(`no schema with key or ref "${y}"`)}else P=this.compile(y);const a=P(j);return"$async"in P||(this.errors=P.errors),a}compile(y,j){const P=this._addSchema(y,j);return P.validate||this._compileSchemaEnv(P)}compileAsync(y,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return a.call(this,y,j);async function a(G,ne){await h.call(this,G.$schema);const he=this._addSchema(G,ne);return he.validate||C.call(this,he)}async function h(G){G&&!this.getSchema(G)&&await a.call(this,{$ref:G},!0)}async function C(G){try{return this._compileSchemaEnv(G)}catch(ne){if(!(ne instanceof s.default))throw ne;return M.call(this,ne),await q.call(this,ne.missingSchema),C.call(this,G)}}function M({missingSchema:G,missingRef:ne}){if(this.refs[G])throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`)}async function q(G){const ne=await W.call(this,G);this.refs[G]||await h.call(this,ne.$schema),this.refs[G]||this.addSchema(ne,G,j)}async function W(G){const ne=this._loading[G];if(ne)return ne;try{return await(this._loading[G]=P(G))}finally{delete this._loading[G]}}}addSchema(y,j,P,a=this.opts.validateSchema){if(Array.isArray(y)){for(const C of y)this.addSchema(C,void 0,P,a);return this}let h;if(typeof y=="object"){const{schemaId:C}=this.opts;if(h=y[C],h!==void 0&&typeof h!="string")throw new Error(`schema ${C} must be string`)}return j=(0,d.normalizeId)(j||h),this._checkUnique(j),this.schemas[j]=this._addSchema(y,P,j,a,!0),this}addMetaSchema(y,j,P=this.opts.validateSchema){return this.addSchema(y,j,!0,P),this}validateSchema(y,j){if(typeof y=="boolean")return!0;let P;if(P=y.$schema,P!==void 0&&typeof P!="string")throw new Error("$schema must be a string");if(P=P||this.opts.defaultMeta||this.defaultMeta(),!P)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(P,y);if(!a&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return a}getSchema(y){let j;for(;typeof(j=w.call(this,y))=="string";)y=j;if(j===void 0){const{schemaId:P}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:P});if(j=o.resolveSchema.call(this,a,y),!j)return;this.refs[y]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(y){if(y instanceof RegExp)return this._removeAllSchemas(this.schemas,y),this._removeAllSchemas(this.refs,y),this;switch(typeof y){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=w.call(this,y);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[y],delete this.refs[y],this}case"object":{const j=y;this._cache.delete(j);let P=y[this.opts.schemaId];return P&&(P=(0,d.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(y){for(const j of y)this.addKeyword(j);return this}addKeyword(y,j){let P;if(typeof y=="string")P=y,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=P);else if(typeof y=="object"&&j===void 0){if(j=y,P=j.keyword,Array.isArray(P)&&!P.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(oe.call(this,P,j),!j)return(0,p.eachItem)(P,h=>ke.call(this,h)),this;qe.call(this,j);const a={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,p.eachItem)(P,a.type.length===0?h=>ke.call(this,h,a):h=>a.type.forEach(C=>ke.call(this,h,a,C))),this}getKeyword(y){const j=this.RULES.all[y];return typeof j=="object"?j.definition:!!j}removeKeyword(y){const{RULES:j}=this;delete j.keywords[y],delete j.all[y];for(const P of j.rules){const a=P.rules.findIndex(h=>h.keyword===y);a>=0&&P.rules.splice(a,1)}return this}addFormat(y,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[y]=j,this}errorsText(y=this.errors,{separator:j=", ",dataVar:P="data"}={}){return!y||y.length===0?"No errors":y.map(a=>`${P}${a.instancePath} ${a.message}`).reduce((a,h)=>a+j+h)}$dataMetaSchema(y,j){const P=this.RULES.all;y=JSON.parse(JSON.stringify(y));for(const a of j){const h=a.split("/").slice(1);let C=y;for(const M of h)C=C[M];for(const M in P){const q=P[M];if(typeof q!="object")continue;const{$data:W}=q.definition,G=C[M];W&&G&&(C[M]=Ue(G))}}return y}_removeAllSchemas(y,j){for(const P in y){const a=y[P];(!j||j.test(P))&&(typeof a=="string"?delete y[P]:a&&!a.meta&&(this._cache.delete(a.schema),delete y[P]))}}_addSchema(y,j,P,a=this.opts.validateSchema,h=this.opts.addUsedSchema){let C;const{schemaId:M}=this.opts;if(typeof y=="object")C=y[M];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof y!="boolean")throw new Error("schema must be object or boolean")}let q=this._cache.get(y);if(q!==void 0)return q;P=(0,d.normalizeId)(C||P);const W=d.getSchemaRefs.call(this,y,P);return q=new o.SchemaEnv({schema:y,schemaId:M,meta:j,baseId:P,localRefs:W}),this._cache.set(q.schema,q),h&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=q),a&&this.validateSchema(y,!0),q}_checkUnique(y){if(this.schemas[y]||this.refs[y])throw new Error(`schema with key or id "${y}" already exists`)}_compileSchemaEnv(y){if(y.meta?this._compileMetaSchema(y):o.compileSchema.call(this,y),!y.validate)throw new Error("ajv implementation error");return y.validate}_compileMetaSchema(y){const j=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,y)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(F,y,j,P="error"){for(const a in F){const h=a;h in y&&this.logger[P](`${j}: option ${a}. ${F[h]}`)}}function w(F){return F=(0,d.normalizeId)(F),this.schemas[F]||this.refs[F]}function k(){const F=this.opts.schemas;if(F)if(Array.isArray(F))this.addSchema(F);else for(const y in F)this.addSchema(F[y],y)}function A(){for(const F in this.opts.formats){const y=this.opts.formats[F];y&&this.addFormat(F,y)}}function x(F){if(Array.isArray(F)){this.addVocabulary(F);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const y in F){const j=F[y];j.keyword||(j.keyword=y),this.addKeyword(j)}}function z(){const F={...this.opts};for(const y of R)delete F[y];return F}const re={log(){},warn(){},error(){}};function K(F){if(F===!1)return re;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 ue=/^[a-z_$][a-z0-9_$:-]*$/i;function oe(F,y){const{RULES:j}=this;if((0,p.eachItem)(F,P=>{if(j.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!ue.test(P))throw new Error(`Keyword ${P} has invalid name`)}),!!y&&y.$data&&!("code"in y||"validate"in y))throw new Error('$data keyword must have "code" or "validate" function')}function ke(F,y,j){var P;const a=y==null?void 0:y.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let C=a?h.post:h.rules.find(({type:q})=>q===j);if(C||(C={type:j,rules:[]},h.rules.push(C)),h.keywords[F]=!0,!y)return;const M={keyword:F,definition:{...y,type:(0,u.getJSONTypes)(y.type),schemaType:(0,u.getJSONTypes)(y.schemaType)}};y.before?Oe.call(this,C,M,y.before):C.rules.push(M),h.all[F]=M,(P=y.implements)===null||P===void 0||P.forEach(q=>this.addKeyword(q))}function Oe(F,y,j){const P=F.rules.findIndex(a=>a.keyword===j);P>=0?F.rules.splice(P,0,y):(F.rules.push(y),this.logger.warn(`rule ${j} is not defined`))}function qe(F){let{metaSchema:y}=F;y!==void 0&&(F.$data&&this.opts.$data&&(y=Ue(y)),F.validateSchema=this.compile(y,!0))}const et={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ue(F){return{anyOf:[F,et]}}})(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:i,validateName:o,opts:l,self:d}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return $();const p=compile_1$1.resolveRef.call(d,u,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 O(p);return N(p);function $(){if(i===u)return callRef(e,o,i,i.$async);const R=t.scopeValue("root",{ref:u});return callRef(e,(0,codegen_1$l._)`${R}.validate`,u,u.$async)}function O(R){const v=getValidate(e,R);callRef(e,v,R,R.$async)}function N(R){const v=t.scopeValue("schema",l.code.source===!0?{ref:R,code:(0,codegen_1$l.stringify)(R)}:{ref:R}),g=t.name("valid"),m=e.subschema({schema:R,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:v,errSchemaPath:r},g);e.mergeEvaluated(m),e.ok(g)}}};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:i}=e,{allErrors:o,schemaEnv:l,opts:d}=i,u=d.passContext?names_1$1.default.this:codegen_1$l.nil;n?p():$();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");const R=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,u)}`),N(t),o||s.assign(R,!0)},v=>{s.if((0,codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`,()=>s.throw(v)),O(v),o||s.assign(R,!1)}),e.ok(R)}function $(){e.result((0,code_1$8.callValidateCode)(e,t,u),()=>N(t),()=>O(t))}function O(R){const v=(0,codegen_1$l._)`${R}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${v} : ${names_1$1.default.vErrors}.concat(${v})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function N(R){var v;if(!i.opts.unevaluated)return;const g=(v=r==null?void 0:r.validate)===null||v===void 0?void 0:v.evaluated;if(i.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(i.props=util_1$j.mergeEvaluated.props(s,g.props,i.props));else{const m=s.var("props",(0,codegen_1$l._)`${R}.evaluated.props`);i.props=util_1$j.mergeEvaluated.props(s,m,i.props,codegen_1$l.Name)}if(i.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(i.items=util_1$j.mergeEvaluated.items(s,g.items,i.items));else{const m=s.var("items",(0,codegen_1$l._)`${R}.evaluated.items`);i.items=util_1$j.mergeEvaluated.items(s,m,i.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,i=s.opts.multipleOfPrecision,o=t.let("res"),l=i?(0,codegen_1$j._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,codegen_1$j._)`${o} !== parseInt(${o})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};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,i=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,o=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._)`${o} ${i} ${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:i}=e,o=i.opts.unicodeRegExp?"u":"",l=r?(0,codegen_1$h._)`(new RegExp(${s}, ${o}))`:(0,code_1$7.usePattern)(e,n);e.fail$data((0,codegen_1$h._)`!${l}.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:i,it:o}=e,{opts:l}=o;if(!i&&r.length===0)return;const d=r.length>=l.loopRequired;if(o.allErrors?u():p(),l.strictRequired){const N=e.parentSchema.properties,{definedProperties:R}=e.it;for(const v of r)if((N==null?void 0:N[v])===void 0&&!R.has(v)){const g=o.schemaEnv.baseId+o.errSchemaPath,m=`required property "${v}" is not defined at "${g}" (strictRequired)`;(0,util_1$h.checkStrictMode)(o,m,o.opts.strictRequired)}}function u(){if(d||i)e.block$data(codegen_1$f.nil,$);else for(const N of r)(0,code_1$6.checkReportMissingProp)(e,N)}function p(){const N=t.let("missing");if(d||i){const R=t.let("valid",!0);e.block$data(R,()=>O(N,R)),e.ok(R)}else t.if((0,code_1$6.checkMissingProp)(e,r,N)),(0,code_1$6.reportMissingProp)(e,N),t.else()}function $(){t.forOf("prop",n,N=>{e.setParams({missingProperty:N}),t.if((0,code_1$6.noPropertyInData)(t,s,N,l.ownProperties),()=>e.error())})}function O(N,R){e.setParams({missingProperty:N}),t.forOf(N,n,()=>{t.assign(R,(0,code_1$6.propertyInData)(t,s,N,l.ownProperties)),t.if((0,codegen_1$f.not)(R),()=>{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:i,schemaCode:o,it:l}=e;if(!n&&!s)return;const d=t.let("valid"),u=i.items?(0,dataType_1.getSchemaTypes)(i.items):[];e.block$data(d,p,(0,codegen_1$d._)`${o} === false`),e.ok(d);function p(){const R=t.let("i",(0,codegen_1$d._)`${r}.length`),v=t.let("j");e.setParams({i:R,j:v}),t.assign(d,!0),t.if((0,codegen_1$d._)`${R} > 1`,()=>($()?O:N)(R,v))}function $(){return u.length>0&&!u.some(R=>R==="object"||R==="array")}function O(R,v){const g=t.name("item"),m=(0,dataType_1.checkDataTypes)(u,g,l.opts.strictNumbers,dataType_1.DataType.Wrong),T=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${R}--;`,()=>{t.let(g,(0,codegen_1$d._)`${r}[${R}]`),t.if(m,(0,codegen_1$d._)`continue`),u.length>1&&t.if((0,codegen_1$d._)`typeof ${g} == "string"`,(0,codegen_1$d._)`${g} += "_"`),t.if((0,codegen_1$d._)`typeof ${T}[${g}] == "number"`,()=>{t.assign(v,(0,codegen_1$d._)`${T}[${g}]`),e.error(),t.assign(d,!1).break()}).code((0,codegen_1$d._)`${T}[${g}] = ${R}`)})}function N(R,v){const g=(0,util_1$g.useFunc)(t,equal_1$2.default),m=t.name("outer");t.label(m).for((0,codegen_1$d._)`;${R}--;`,()=>t.for((0,codegen_1$d._)`${v} = ${R}; ${v}--;`,()=>t.if((0,codegen_1$d._)`${g}(${r}[${R}], ${r}[${v}])`,()=>{e.error(),t.assign(d,!1).break(m)})))}}};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:i}=e;n||i&&typeof i=="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._)`${i} !== ${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:i,it:o}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=o.opts.loopEnum;let d;const u=()=>d??(d=(0,util_1$e.useFunc)(t,equal_1.default));let p;if(l||n)p=t.let("valid"),e.block$data(p,$);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const N=t.const("vSchema",i);p=(0,codegen_1$b.or)(...s.map((R,v)=>O(N,v)))}e.pass(p);function $(){t.assign(p,!1),t.forOf("v",i,N=>t.if((0,codegen_1$b._)`${u()}(${r}, ${N})`,()=>t.assign(p,!0).break()))}function O(N,R){const v=s[R];return typeof v=="object"&&v!==null?(0,codegen_1$b._)`${u()}(${r}, ${N}[${R}])`:(0,codegen_1$b._)`${r} === ${v}`}}};_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:i,it:o}=e;o.items=!0;const l=r.const("len",(0,codegen_1$a._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,codegen_1$a._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,util_1$d.alwaysValidSchema)(o,n)){const u=r.var("valid",(0,codegen_1$a._)`${l} <= ${t.length}`);r.if((0,codegen_1$a.not)(u),()=>d(u)),e.ok(u)}function d(u){r.forRange("i",t.length,l,p=>{e.subschema({keyword:i,dataProp:p,dataPropType:util_1$d.Type.Num},u),o.allErrors||r.if((0,codegen_1$a.not)(u),()=>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:i,keyword:o,it:l}=e;p(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=util_1$c.mergeEvaluated.items(n,r.length,l.items));const d=n.name("valid"),u=n.const("len",(0,codegen_1$9._)`${i}.length`);r.forEach(($,O)=>{(0,util_1$c.alwaysValidSchema)(l,$)||(n.if((0,codegen_1$9._)`${u} > ${O}`,()=>e.subschema({keyword:o,schemaProp:O,dataProp:O},d)),e.ok(d))});function p($){const{opts:O,errSchemaPath:N}=l,R=r.length,v=R===$.minItems&&(R===$.maxItems||$[t]===!1);if(O.strictTuples&&!v){const g=`"${o}" is ${R}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;(0,util_1$c.checkStrictMode)(l,g,O.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:i}=e;let o,l;const{minContains:d,maxContains:u}=n;i.opts.next?(o=d===void 0?1:d,l=u):o=1;const p=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:o,max:l}),l===void 0&&o===0){(0,util_1$a.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,util_1$a.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(i,r)){let v=(0,codegen_1$7._)`${p} >= ${o}`;l!==void 0&&(v=(0,codegen_1$7._)`${v} && ${p} <= ${l}`),e.pass(v);return}i.items=!0;const $=t.name("valid");l===void 0&&o===1?N($,()=>t.if($,()=>t.break())):o===0?(t.let($,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,O)):(t.let($,!1),O()),e.result($,()=>e.reset());function O(){const v=t.name("_valid"),g=t.let("count",0);N(v,()=>t.if(v,()=>R(g)))}function N(v,g){t.forRange("i",0,p,m=>{e.subschema({keyword:"contains",dataProp:m,dataPropType:util_1$a.Type.Num,compositeRule:!0},v),g()})}function R(v){t.code((0,codegen_1$7._)`${v}++`),l===void 0?t.if((0,codegen_1$7._)`${v} >= ${o}`,()=>t.assign($,!0).break()):(t.if((0,codegen_1$7._)`${v} > ${l}`,()=>t.assign($,!1).break()),o===1?t.assign($,!0):t.if((0,codegen_1$7._)`${v} >= ${o}`,()=>t.assign($,!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:d,depsCount:u,deps:p}})=>{const $=u===1?"property":"properties";return(0,t.str)`must have ${$} ${p} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:p,missingProperty:$}})=>(0,t._)`{property: ${d},
607
- missingProperty: ${$},
623
+ || ${x} === "boolean" || ${k} === null`).assign(z,(0,s._)`[${k}]`)}}}function N({gen:P,parentData:I,parentDataProperty:D},w){P.if((0,s._)`${I} !== undefined`,()=>P.assign((0,s._)`${I}[${D}]`,w))}function R(P,I,D,w=o.Correct){const k=w===o.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(P){case"null":return(0,s._)`${I} ${k} 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=x((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=x();break;default:return(0,s._)`typeof ${I} ${k} ${P}`}return w===o.Correct?A:(0,s.not)(A);function x(z=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,z,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=R;function T(P,I,D,w){if(P.length===1)return R(P[0],I,D,w);let k;const A=(0,i.toHash)(P);if(A.array&&A.object){const x=(0,s._)`typeof ${I} != "object"`;k=A.null?x:(0,s._)`!${I} || ${x}`,delete A.null,delete A.array,delete A.object}else k=s.nil;A.number&&delete A.integer;for(const x in A)k=(0,s.and)(k,R(x,I,D,w));return k}e.checkDataTypes=T;const y={message:({schema:P})=>`must be ${P}`,params:({schema:P,schemaValue:I})=>typeof P=="string"?(0,s._)`{type: ${P}}`:(0,s._)`{type: ${I}}`};function _(P){const I=$(P);(0,n.reportError)(I,y)}e.reportTypeError=_;function $(P){const{gen:I,data:D,schema:w}=P,k=(0,i.schemaRefOrVal)(P,w,"type");return{gen:I,keyword:"type",data:D,schema:w.type,schemaCode:k,schemaValue:k,parentSchema:w,params:{},it:P}}})(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,i)=>assignDefault(e,i,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;const l=(0,codegen_1$r._)`${i}${(0,codegen_1$r.getProperty)(t)}`;if(s){(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${l}`);return}let d=(0,codegen_1$r._)`${l} === undefined`;o.useDefaults==="empty"&&(d=(0,codegen_1$r._)`${d} || ${l} === null || ${l} === ""`),n.if(d,(0,codegen_1$r._)`${l} = ${(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(i=>(0,codegen_1$q.and)(noPropertyInData(e,t,i,r.ownProperties),(0,codegen_1$q._)`${s} = ${i}`)))}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:i},it:o},l,d,u){const p=u?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,g=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,i)],[names_1$5.default.parentData,o.parentData],[names_1$5.default.parentDataProperty,o.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];o.opts.dynamicRef&&g.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const O=(0,codegen_1$q._)`${p}, ${r.object(...g)}`;return d!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${d}, ${O})`:(0,codegen_1$q._)`${l}(${O})`}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,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,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,i=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return o(()=>t.assign(l,!1)),l}return t.var(i,!0),o(()=>t.break()),i;function o(l){const d=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,d,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:util_1$o.Type.Num},i),t.if((0,codegen_1$q.not)(i),l)})}}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(d=>(0,util_1$o.alwaysValidSchema)(s,d))&&!s.opts.unevaluated)return;const o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((d,u)=>{const p=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(o,(0,codegen_1$q._)`${o} || ${l}`),e.mergeValidEvaluated(p,l)||t.if((0,codegen_1$q.not)(o))})),e.result(o,()=>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:i,it:o}=e,l=t.macro.call(o.self,s,i,o),d=useKeyword(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:codegen_1$p.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:o,$data:l,it:d}=e;checkAsyncKeyword(d,t);const u=!l&&t.compile?t.compile.call(d.self,i,o,d):t.validate,p=useKeyword(n,s,u),g=n.let("valid");e.block$data(g,O),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function O(){if(t.errors===!1)T(),t.modifying&&modifyData(e),y(()=>e.error());else{const _=t.async?N():R();t.modifying&&modifyData(e),y(()=>addErrs(e,_))}}function N(){const _=n.let("ruleErrs",null);return n.try(()=>T((0,codegen_1$p._)`await `),$=>n.assign(g,!1).if((0,codegen_1$p._)`${$} instanceof ${d.ValidationError}`,()=>n.assign(_,(0,codegen_1$p._)`${$}.errors`),()=>n.throw($))),_}function R(){const _=(0,codegen_1$p._)`${p}.errors`;return n.assign(_,null),T(codegen_1$p.nil),_}function T(_=t.async?(0,codegen_1$p._)`await `:codegen_1$p.nil){const $=d.opts.passContext?names_1$4.default.this:names_1$4.default.self,P=!("compile"in t&&!l||t.schema===!1);n.assign(g,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,p,$,P)}`,t.modifying)}function y(_){var $;n.if((0,codegen_1$p.not)(($=t.valid)!==null&&$!==void 0?$:g),_)}}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,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const o=s.dependencies;if(o!=null&&o.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const d=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(d);else throw new Error(d)}}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:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const l=e.schema[t];return r===void 0?{schema:l,schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[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||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(r!==void 0){const{errorPath:u,dataPathArr:p,opts:g}=t,O=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);d(O),e.errorPath=(0,codegen_1$o.str)`${u}${(0,util_1$n.getErrorPath)(r,n,g.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const u=s instanceof codegen_1$o.Name?s:l.let("data",s,!0);d(u),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function d(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),i!==void 0&&(e.allErrors=i),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,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 o=i[s];if(!e(t[o],r[o]))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,i,o,l,d,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,l,d,u);for(var p in n){var g=n[p];if(Array.isArray(g)){if(p in traverse$1.arrayKeywords)for(var O=0;O<g.length;O++)_traverse(e,t,r,g[O],s+"/"+p+"/"+O,i,s,p,n,O)}else if(p in traverse$1.propsKeywords){if(g&&typeof g=="object")for(var N in g)_traverse(e,t,r,g[N],s+"/"+p+"/"+escapeJsonPtr(N),i,s,p,n,N)}else(p in traverse$1.keywords||e.allKeys&&!(p in traverse$1.skipKeywords))&&_traverse(e,t,r,g,s+"/"+p,i,s,p,n)}r(n,s,i,o,l,d,u)}}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),i={"":s},o=getFullPath(n,s,!1),l={},d=new Set;return traverse(e,{allKeys:!0},(g,O,N,R)=>{if(R===void 0)return;const T=o+O;let y=i[R];typeof g[r]=="string"&&(y=_.call(this,g[r])),$.call(this,g.$anchor),$.call(this,g.$dynamicAnchor),i[O]=y;function _(P){const I=this.opts.uriResolver.resolve;if(P=normalizeId(y?I(y,P):P),d.has(P))throw p(P);d.add(P);let D=this.refs[P];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?u(g,D.schema,P):P!==normalizeId(T)&&(P[0]==="#"?(u(g,l[P],P),l[P]=g):this.refs[P]=T),P}function $(P){if(typeof P=="string"){if(!ANCHOR.test(P))throw new Error(`invalid anchor "${P}"`);_.call(this,`#${P}`)}}}),l;function u(g,O,N){if(O!==void 0&&!equal$2(g,O))throw p(N)}function p(g){return new Error(`reference "${g}" 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},i){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(i)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(i))}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 i=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,i),n.var(t,(0,codegen_1$n._)`${i} === ${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 i=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const o=(0,codegen_1$n.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${i}, ${o}, ${l}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=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),i.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:i,data:o,allErrors:l,opts:d,self:u}=e,{RULES:p}=u;if(i.$ref&&(d.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(i,p))){s.block(()=>keywordCode(e,"$ref",p.all.$ref.definition));return}d.jtd||checkStrictTypes(e,t),s.block(()=>{for(const O of p.rules)g(O);g(p.post)});function g(O){(0,applicability_1.shouldUseGroup)(i,O)&&(O.type?(s.if((0,dataType_2.checkDataType)(O.type,o,d.strictNumbers)),iterateKeywords(e,O),t.length===1&&t[0]===O.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,O),l||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}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 i of t.rules)(0,applicability_1.shouldUseRule)(n,i)&&keywordCode(e,i.keyword,i.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:i}=s.definition;i.length&&!i.some(o=>hasApplicableType(t,o))&&strictTypesError(e,`missing type "${i.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:i,def:o}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(i.length||o.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:i}=this;return(0,codegen_1$n.or)(o(),l());function o(){if(n.length){if(!(r instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const d=Array.isArray(n)?n:[n];return(0,codegen_1$n._)`${(0,dataType_2.checkDataTypes)(d,r,i.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}function l(){if(s.validateSchema){const d=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,codegen_1$n._)`!${d}(${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,i;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,i=names_1$3.default.rootData}else{const u=RELATIVE_JSON_POINTER.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+u[1];if(s=u[2],s==="#"){if(p>=t)throw new Error(d("property/index",p));return n[t-p]}if(p>t)throw new Error(d("data",p));if(i=r[t-p],!s)return i}let o=i;const l=s.split("/");for(const u of l)u&&(i=(0,codegen_1$n._)`${i}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(u))}`,o=(0,codegen_1$n._)`${o} && ${i}`);return o;function d(u,p){return`Cannot access ${u} ${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:i}=this.opts,o=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=o.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const d=o.scopeName("validate");e.validateName=d;const u={gen:o,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:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:l,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)(u),o.optimize(this.opts.code.optimize);const g=o.toString();p=`${o.scopeRefs(names_1$2.default.scope)}return ${g}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const N=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,p)(this,this.scope.get());if(this.scope.value(d,{ref:N}),N.errors=null,N.schema=e.schema,N.schemaEnv=e,e.$async&&(N.$async=!0),this.opts.code.source===!0&&(N.source={validateName:d,validateCode:g,scopeValues:o._values}),this.opts.unevaluated){const{props:R,items:T}=u;N.evaluated={props:R instanceof codegen_1$m.Name?void 0:R,items:T instanceof codegen_1$m.Name?void 0:T,dynamicProps:R instanceof codegen_1$m.Name,dynamicItems:T instanceof codegen_1$m.Name},N.source&&(N.source.evaluated=(0,codegen_1$m.stringify)(N.evaluated))}return e.validate=N,e}catch(g){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),g}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 i=resolve.call(this,e,r);if(i===void 0){const o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(i=new SchemaEnv({schema:o,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=inlineOrCompile.call(this,i)}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 i=(0,resolve_1.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){const l=resolveSchema.call(this,e,o);return typeof(l==null?void 0:l.schema)!="object"?void 0:getJsonPointer.call(this,r,l)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||compileSchema.call(this,o),i===(0,resolve_1.normalizeId)(t)){const{schema:l}=o,{schemaId:d}=this.opts,u=l[d];return u&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,u)),new SchemaEnv({schema:l,schemaId:d,root:e,baseId:s})}return getJsonPointer.call(this,r,o)}}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 l of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const d=r[(0,util_1$k.unescapeFragment)(l)];if(d===void 0)return;r=d;const u=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(l)&&u&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const l=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=resolveSchema.call(this,n,l)}const{schemaId:o}=this.opts;if(i=i||new SchemaEnv({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i}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 f=arguments.length,c=Array(f),m=0;m<f;m++)c[m]=arguments[m];if(c.length>1){c[0]=c[0].slice(0,-1);for(var S=c.length-1,E=1;E<S;++E)c[E]=c[E].slice(1,-1);return c[S]=c[S].slice(1),c.join("")}else return c[0]}function s(f){return"(?:"+f+")"}function i(f){return f===void 0?"undefined":f===null?"null":Object.prototype.toString.call(f).split(" ").pop().split("]").shift().toLowerCase()}function o(f){return f.toUpperCase()}function l(f){return f!=null?f instanceof Array?f:typeof f.length!="number"||f.split||f.setInterval||f.call?[f]:Array.prototype.slice.call(f):[]}function d(f,c){var m=f;if(c)for(var S in c)m[S]=c[S];return m}function u(f){var c="[A-Za-z]",m="[0-9]",S=n(m,"[A-Fa-f]"),E=s(s("%[EFef]"+S+"%"+S+S+"%"+S+S)+"|"+s("%[89A-Fa-f]"+S+"%"+S+S)+"|"+s("%"+S+S)),U="[\\:\\/\\?\\#\\[\\]\\@]",L="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",J=n(U,L),Y=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",se=f?"[\\uE000-\\uF8FF]":"[]",B=n(c,m,"[\\-\\.\\_\\~]",Y);s(c+n(c,m,"[\\+\\-\\.]")+"*"),s(s(E+"|"+n(B,L,"[\\:]"))+"*");var Z=s(s("25[0-5]")+"|"+s("2[0-4]"+m)+"|"+s("1"+m+m)+"|"+s("0?[1-9]"+m)+"|0?0?"+m),ie=s(Z+"\\."+Z+"\\."+Z+"\\."+Z),V=s(S+"{1,4}"),X=s(s(V+"\\:"+V)+"|"+ie),ae=s(s(V+"\\:")+"{6}"+X),ee=s("\\:\\:"+s(V+"\\:")+"{5}"+X),Se=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+X),ge=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+X),$e=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+X),Be=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+X),Ie=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+X),fe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),ye=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),je=s([ae,ee,Se,ge,$e,Be,Ie,fe,ye].join("|")),we=s(s(B+"|"+E)+"+");s("[vV]"+S+"+\\."+n(B,L,"[\\:]")+"+"),s(s(E+"|"+n(B,L))+"*");var ct=s(E+"|"+n(B,L,"[\\:\\@]"));return s(s(E+"|"+n(B,L,"[\\@]"))+"+"),s(s(ct+"|"+n("[\\/\\?]",se))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,m,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",B,L),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",B,L),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",B,L),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",B,L),"g"),NOT_QUERY:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]",se),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",B,L),"g"),UNRESERVED:new RegExp(B,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",B,J),"g"),PCT_ENCODED:new RegExp(E,"g"),IPV4ADDRESS:new RegExp("^("+ie+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+s(s("\\%25|\\%(?!"+S+"{2})")+"("+we+")")+"?\\]?$")}}var p=u(!1),g=u(!0),O=function(){function f(c,m){var S=[],E=!0,U=!1,L=void 0;try{for(var J=c[Symbol.iterator](),Y;!(E=(Y=J.next()).done)&&(S.push(Y.value),!(m&&S.length===m));E=!0);}catch(se){U=!0,L=se}finally{try{!E&&J.return&&J.return()}finally{if(U)throw L}}return S}return function(c,m){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),N=function(f){if(Array.isArray(f)){for(var c=0,m=Array(f.length);c<f.length;c++)m[c]=f[c];return m}else return Array.from(f)},R=2147483647,T=36,y=1,_=26,$=38,P=700,I=72,D=128,w="-",k=/^xn--/,A=/[^\0-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=T-y,K=Math.floor,ue=String.fromCharCode;function oe(f){throw new RangeError(z[f])}function ke(f,c){for(var m=[],S=f.length;S--;)m[S]=c(f[S]);return m}function Ce(f,c){var m=f.split("@"),S="";m.length>1&&(S=m[0]+"@",f=m[1]),f=f.replace(x,".");var E=f.split("."),U=ke(E,c).join(".");return S+U}function qe(f){for(var c=[],m=0,S=f.length;m<S;){var E=f.charCodeAt(m++);if(E>=55296&&E<=56319&&m<S){var U=f.charCodeAt(m++);(U&64512)==56320?c.push(((E&1023)<<10)+(U&1023)+65536):(c.push(E),m--)}else c.push(E)}return c}var et=function(c){return String.fromCodePoint.apply(String,N(c))},Ue=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:T},F=function(c,m){return c+22+75*(c<26)-((m!=0)<<5)},v=function(c,m,S){var E=0;for(c=S?K(c/P):c>>1,c+=K(c/m);c>re*_>>1;E+=T)c=K(c/re);return K(E+(re+1)*c/(c+$))},j=function(c){var m=[],S=c.length,E=0,U=D,L=I,J=c.lastIndexOf(w);J<0&&(J=0);for(var Y=0;Y<J;++Y)c.charCodeAt(Y)>=128&&oe("not-basic"),m.push(c.charCodeAt(Y));for(var se=J>0?J+1:0;se<S;){for(var B=E,Z=1,ie=T;;ie+=T){se>=S&&oe("invalid-input");var V=Ue(c.charCodeAt(se++));(V>=T||V>K((R-E)/Z))&&oe("overflow"),E+=V*Z;var X=ie<=L?y:ie>=L+_?_:ie-L;if(V<X)break;var ae=T-X;Z>K(R/ae)&&oe("overflow"),Z*=ae}var ee=m.length+1;L=v(E-B,ee,B==0),K(E/ee)>R-U&&oe("overflow"),U+=K(E/ee),E%=ee,m.splice(E++,0,U)}return String.fromCodePoint.apply(String,m)},b=function(c){var m=[];c=qe(c);var S=c.length,E=D,U=0,L=I,J=!0,Y=!1,se=void 0;try{for(var B=c[Symbol.iterator](),Z;!(J=(Z=B.next()).done);J=!0){var ie=Z.value;ie<128&&m.push(ue(ie))}}catch(lt){Y=!0,se=lt}finally{try{!J&&B.return&&B.return()}finally{if(Y)throw se}}var V=m.length,X=V;for(V&&m.push(w);X<S;){var ae=R,ee=!0,Se=!1,ge=void 0;try{for(var $e=c[Symbol.iterator](),Be;!(ee=(Be=$e.next()).done);ee=!0){var Ie=Be.value;Ie>=E&&Ie<ae&&(ae=Ie)}}catch(lt){Se=!0,ge=lt}finally{try{!ee&&$e.return&&$e.return()}finally{if(Se)throw ge}}var fe=X+1;ae-E>K((R-U)/fe)&&oe("overflow"),U+=(ae-E)*fe,E=ae;var ye=!0,je=!1,we=void 0;try{for(var ct=c[Symbol.iterator](),Lt;!(ye=(Lt=ct.next()).done);ye=!0){var Ht=Lt.value;if(Ht<E&&++U>R&&oe("overflow"),Ht==E){for(var pt=U,ft=T;;ft+=T){var ht=ft<=L?y:ft>=L+_?_:ft-L;if(pt<ht)break;var xt=pt-ht,Vt=T-ht;m.push(ue(F(ht+xt%Vt,0))),pt=K(xt/Vt)}m.push(ue(F(pt,0))),L=v(U,fe,X==V),U=0,++X}}}catch(lt){je=!0,we=lt}finally{try{!ye&&ct.return&&ct.return()}finally{if(je)throw we}}++U,++E}return m.join("")},a=function(c){return Ce(c,function(m){return k.test(m)?j(m.slice(4).toLowerCase()):m})},h=function(c){return Ce(c,function(m){return A.test(m)?"xn--"+b(m):m})},C={version:"2.1.0",ucs2:{decode:qe,encode:et},decode:j,encode:b,toASCII:h,toUnicode:a},M={};function q(f){var c=f.charCodeAt(0),m=void 0;return c<16?m="%0"+c.toString(16).toUpperCase():c<128?m="%"+c.toString(16).toUpperCase():c<2048?m="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():m="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),m}function W(f){for(var c="",m=0,S=f.length;m<S;){var E=parseInt(f.substr(m+1,2),16);if(E<128)c+=String.fromCharCode(E),m+=3;else if(E>=194&&E<224){if(S-m>=6){var U=parseInt(f.substr(m+4,2),16);c+=String.fromCharCode((E&31)<<6|U&63)}else c+=f.substr(m,6);m+=6}else if(E>=224){if(S-m>=9){var L=parseInt(f.substr(m+4,2),16),J=parseInt(f.substr(m+7,2),16);c+=String.fromCharCode((E&15)<<12|(L&63)<<6|J&63)}else c+=f.substr(m,9);m+=9}else c+=f.substr(m,3),m+=3}return c}function G(f,c){function m(S){var E=W(S);return E.match(c.UNRESERVED)?E:S}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,m).replace(c.NOT_USERINFO,q).replace(c.PCT_ENCODED,o)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_HOST,q).replace(c.PCT_ENCODED,o)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,m).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,q).replace(c.PCT_ENCODED,o)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,m).replace(c.NOT_QUERY,q).replace(c.PCT_ENCODED,o)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,m).replace(c.NOT_FRAGMENT,q).replace(c.PCT_ENCODED,o)),f}function ne(f){return f.replace(/^0*(.*)/,"$1")||"0"}function he(f,c){var m=f.match(c.IPV4ADDRESS)||[],S=O(m,2),E=S[1];return E?E.split(".").map(ne).join("."):f}function Le(f,c){var m=f.match(c.IPV6ADDRESS)||[],S=O(m,3),E=S[1],U=S[2];if(E){for(var L=E.toLowerCase().split("::").reverse(),J=O(L,2),Y=J[0],se=J[1],B=se?se.split(":").map(ne):[],Z=Y.split(":").map(ne),ie=c.IPV4ADDRESS.test(Z[Z.length-1]),V=ie?7:8,X=Z.length-V,ae=Array(V),ee=0;ee<V;++ee)ae[ee]=B[ee]||Z[X+ee]||"";ie&&(ae[V-1]=he(ae[V-1],c));var Se=ae.reduce(function(fe,ye,je){if(!ye||ye==="0"){var we=fe[fe.length-1];we&&we.index+we.length===je?we.length++:fe.push({index:je,length:1})}return fe},[]),ge=Se.sort(function(fe,ye){return ye.length-fe.length})[0],$e=void 0;if(ge&&ge.length>1){var Be=ae.slice(0,ge.index),Ie=ae.slice(ge.index+ge.length);$e=Be.join(":")+"::"+Ie.join(":")}else $e=ae.join(":");return U&&($e+="%"+U),$e}else return f}var tt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,rt="".match(/(){0}/)[1]===void 0;function de(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m={},S=c.iri!==!1?g:p;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var E=f.match(tt);if(E){rt?(m.scheme=E[1],m.userinfo=E[3],m.host=E[4],m.port=parseInt(E[5],10),m.path=E[6]||"",m.query=E[7],m.fragment=E[8],isNaN(m.port)&&(m.port=E[5])):(m.scheme=E[1]||void 0,m.userinfo=f.indexOf("@")!==-1?E[3]:void 0,m.host=f.indexOf("//")!==-1?E[4]:void 0,m.port=parseInt(E[5],10),m.path=E[6]||"",m.query=f.indexOf("?")!==-1?E[7]:void 0,m.fragment=f.indexOf("#")!==-1?E[8]:void 0,isNaN(m.port)&&(m.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),m.host&&(m.host=Le(he(m.host,S),S)),m.scheme===void 0&&m.userinfo===void 0&&m.host===void 0&&m.port===void 0&&!m.path&&m.query===void 0?m.reference="same-document":m.scheme===void 0?m.reference="relative":m.fragment===void 0?m.reference="absolute":m.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==m.reference&&(m.error=m.error||"URI is not a "+c.reference+" reference.");var U=M[(c.scheme||m.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(m.host&&(c.domainHost||U&&U.domainHost))try{m.host=C.toASCII(m.host.replace(S.PCT_ENCODED,W).toLowerCase())}catch(L){m.error=m.error||"Host's domain name can not be converted to ASCII via punycode: "+L}G(m,p)}else G(m,S);U&&U.parse&&U.parse(m,c)}else m.error=m.error||"URI can not be parsed.";return m}function nt(f,c){var m=c.iri!==!1?g:p,S=[];return f.userinfo!==void 0&&(S.push(f.userinfo),S.push("@")),f.host!==void 0&&S.push(Le(he(String(f.host),m),m).replace(m.IPV6ADDRESS,function(E,U,L){return"["+U+(L?"%25"+L:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(S.push(":"),S.push(String(f.port))),S.length?S.join(""):void 0}var He=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ve=/^\/\.\.(\/|$)/,st=/^\/?(?:.|\n)*?(?=\/|$)/;function me(f){for(var c=[];f.length;)if(f.match(He))f=f.replace(He,"");else if(f.match(xe))f=f.replace(xe,"/");else if(f.match(Ve))f=f.replace(Ve,"/"),c.pop();else if(f==="."||f==="..")f="";else{var m=f.match(st);if(m){var S=m[0];f=f.slice(S.length),c.push(S)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function le(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=c.iri?g:p,S=[],E=M[(c.scheme||f.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(f,c),f.host&&!m.IPV6ADDRESS.test(f.host)){if(c.domainHost||E&&E.domainHost)try{f.host=c.iri?C.toUnicode(f.host):C.toASCII(f.host.replace(m.PCT_ENCODED,W).toLowerCase())}catch(J){f.error=f.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+J}}G(f,m),c.reference!=="suffix"&&f.scheme&&(S.push(f.scheme),S.push(":"));var U=nt(f,c);if(U!==void 0&&(c.reference!=="suffix"&&S.push("//"),S.push(U),f.path&&f.path.charAt(0)!=="/"&&S.push("/")),f.path!==void 0){var L=f.path;!c.absolutePath&&(!E||!E.absolutePath)&&(L=me(L)),U===void 0&&(L=L.replace(/^\/\//,"/%2F")),S.push(L)}return f.query!==void 0&&(S.push("?"),S.push(f.query)),f.fragment!==void 0&&(S.push("#"),S.push(f.fragment)),S.join("")}function ze(f,c){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=arguments[3],E={};return S||(f=de(le(f,m),m),c=de(le(c,m),m)),m=m||{},!m.tolerant&&c.scheme?(E.scheme=c.scheme,E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=me(c.path||""),E.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=me(c.path||""),E.query=c.query):(c.path?(c.path.charAt(0)==="/"?E.path=me(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?E.path="/"+c.path:f.path?E.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:E.path=c.path,E.path=me(E.path)),E.query=c.query):(E.path=f.path,c.query!==void 0?E.query=c.query:E.query=f.query),E.userinfo=f.userinfo,E.host=f.host,E.port=f.port),E.scheme=f.scheme),E.fragment=c.fragment,E}function it(f,c,m){var S=d({scheme:"null"},m);return le(ze(de(f,S),de(c,S),S,!0),S)}function Oe(f,c){return typeof f=="string"?f=le(de(f,c),c):i(f)==="object"&&(f=de(le(f,c),c)),f}function ot(f,c,m){return typeof f=="string"?f=le(de(f,m),m):i(f)==="object"&&(f=le(f,m)),typeof c=="string"?c=le(de(c,m),m):i(c)==="object"&&(c=le(c,m)),f===c}function ut(f,c){return f&&f.toString().replace(!c||!c.iri?p.ESCAPE:g.ESCAPE,q)}function pe(f,c){return f&&f.toString().replace(!c||!c.iri?p.PCT_ENCODED:g.PCT_ENCODED,W)}var Ne={scheme:"http",domainHost:!0,parse:function(c,m){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,m){var S=String(c.scheme).toLowerCase()==="https";return(c.port===(S?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},It={scheme:"https",domainHost:Ne.domainHost,parse:Ne.parse,serialize:Ne.serialize};function jt(f){return typeof f.secure=="boolean"?f.secure:String(f.scheme).toLowerCase()==="wss"}var at={scheme:"ws",domainHost:!0,parse:function(c,m){var S=c;return S.secure=jt(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S},serialize:function(c,m){if((c.port===(jt(c)?443:80)||c.port==="")&&(c.port=void 0),typeof c.secure=="boolean"&&(c.scheme=c.secure?"wss":"ws",c.secure=void 0),c.resourceName){var S=c.resourceName.split("?"),E=O(S,2),U=E[0],L=E[1];c.path=U&&U!=="/"?U:void 0,c.query=L,c.resourceName=void 0}return c.fragment=void 0,c}},At={scheme:"wss",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize},ir={},Dt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_e="[0-9A-Fa-f]",or=s(s("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+s("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+s("%"+_e+_e)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",cr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lr=n(cr,'[\\"\\\\]'),dr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(Dt,"g"),We=new RegExp(or,"g"),pr=new RegExp(n("[^]",ar,"[\\.]",'[\\"]',lr),"g"),Ft=new RegExp(n("[^]",Dt,dr),"g"),fr=Ft;function Ot(f){var c=W(f);return c.match(ur)?c:f}var Mt={scheme:"mailto",parse:function(c,m){var S=c,E=S.to=S.path?S.path.split(","):[];if(S.path=void 0,S.query){for(var U=!1,L={},J=S.query.split("&"),Y=0,se=J.length;Y<se;++Y){var B=J[Y].split("=");switch(B[0]){case"to":for(var Z=B[1].split(","),ie=0,V=Z.length;ie<V;++ie)E.push(Z[ie]);break;case"subject":S.subject=pe(B[1],m);break;case"body":S.body=pe(B[1],m);break;default:U=!0,L[pe(B[0],m)]=pe(B[1],m);break}}U&&(S.headers=L)}S.query=void 0;for(var X=0,ae=E.length;X<ae;++X){var ee=E[X].split("@");if(ee[0]=pe(ee[0]),m.unicodeSupport)ee[1]=pe(ee[1],m).toLowerCase();else try{ee[1]=C.toASCII(pe(ee[1],m).toLowerCase())}catch(Se){S.error=S.error||"Email address's domain name can not be converted to ASCII via punycode: "+Se}E[X]=ee.join("@")}return S},serialize:function(c,m){var S=c,E=l(c.to);if(E){for(var U=0,L=E.length;U<L;++U){var J=String(E[U]),Y=J.lastIndexOf("@"),se=J.slice(0,Y).replace(We,Ot).replace(We,o).replace(pr,q),B=J.slice(Y+1);try{B=m.iri?C.toUnicode(B):C.toASCII(pe(B,m).toLowerCase())}catch(X){S.error=S.error||"Email address's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+X}E[U]=se+"@"+B}S.path=E.join(",")}var Z=c.headers=c.headers||{};c.subject&&(Z.subject=c.subject),c.body&&(Z.body=c.body);var ie=[];for(var V in Z)Z[V]!==ir[V]&&ie.push(V.replace(We,Ot).replace(We,o).replace(Ft,q)+"="+Z[V].replace(We,Ot).replace(We,o).replace(fr,q));return ie.length&&(S.query=ie.join("&")),S}},hr=/^([^\:]+)\:(.*)/,qt={scheme:"urn",parse:function(c,m){var S=c.path&&c.path.match(hr),E=c;if(S){var U=m.scheme||E.scheme||"urn",L=S[1].toLowerCase(),J=S[2],Y=U+":"+(m.nid||L),se=M[Y];E.nid=L,E.nss=J,E.path=void 0,se&&(E=se.parse(E,m))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(c,m){var S=m.scheme||c.scheme||"urn",E=c.nid,U=S+":"+(m.nid||E),L=M[U];L&&(c=L.serialize(c,m));var J=c,Y=c.nss;return J.path=(E||m.nid)+":"+Y,J}},mr=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ut={scheme:"urn:uuid",parse:function(c,m){var S=c;return S.uuid=S.nss,S.nss=void 0,!m.tolerant&&(!S.uuid||!S.uuid.match(mr))&&(S.error=S.error||"UUID is not valid."),S},serialize:function(c,m){var S=c;return S.nss=(c.uuid||"").toLowerCase(),S}};M[Ne.scheme]=Ne,M[It.scheme]=It,M[at.scheme]=at,M[At.scheme]=At,M[Mt.scheme]=Mt,M[qt.scheme]=qt,M[Ut.scheme]=Ut,r.SCHEMES=M,r.pctEncChar=q,r.pctDecChars=W,r.parse=de,r.removeDotSegments=me,r.serialize=le,r.resolveComponents=ze,r.resolve=it,r.normalize=Oe,r.equal=ot,r.escapeComponent=ut,r.unescapeComponent=pe,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,i=rules,o=compile,l=codegen,d=resolve$1,u=dataType,p=util,g=require$$9,O=uri$1,N=(F,v)=>new RegExp(F,v);N.code="new RegExp";const R=["removeAdditional","useDefaults","coerceTypes"],T=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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.'},$=200;function P(F){var v,j,b,a,h,C,M,q,W,G,ne,he,Le,tt,rt,de,nt,He,xe,Ve,st,me,le,ze,it;const Oe=F.strict,ot=(v=F.code)===null||v===void 0?void 0:v.optimize,ut=ot===!0||ot===void 0?1:ot||0,pe=(b=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&b!==void 0?b:N,Ne=(a=F.uriResolver)!==null&&a!==void 0?a:O.default;return{strictSchema:(C=(h=F.strictSchema)!==null&&h!==void 0?h:Oe)!==null&&C!==void 0?C:!0,strictNumbers:(q=(M=F.strictNumbers)!==null&&M!==void 0?M:Oe)!==null&&q!==void 0?q:!0,strictTypes:(G=(W=F.strictTypes)!==null&&W!==void 0?W:Oe)!==null&&G!==void 0?G:"log",strictTuples:(he=(ne=F.strictTuples)!==null&&ne!==void 0?ne:Oe)!==null&&he!==void 0?he:"log",strictRequired:(tt=(Le=F.strictRequired)!==null&&Le!==void 0?Le:Oe)!==null&&tt!==void 0?tt:!1,code:F.code?{...F.code,optimize:ut,regExp:pe}:{optimize:ut,regExp:pe},loopRequired:(rt=F.loopRequired)!==null&&rt!==void 0?rt:$,loopEnum:(de=F.loopEnum)!==null&&de!==void 0?de:$,meta:(nt=F.meta)!==null&&nt!==void 0?nt:!0,messages:(He=F.messages)!==null&&He!==void 0?He:!0,inlineRefs:(xe=F.inlineRefs)!==null&&xe!==void 0?xe:!0,schemaId:(Ve=F.schemaId)!==null&&Ve!==void 0?Ve:"$id",addUsedSchema:(st=F.addUsedSchema)!==null&&st!==void 0?st:!0,validateSchema:(me=F.validateSchema)!==null&&me!==void 0?me:!0,validateFormats:(le=F.validateFormats)!==null&&le!==void 0?le:!0,unicodeRegExp:(ze=F.unicodeRegExp)!==null&&ze!==void 0?ze:!0,int32range:(it=F.int32range)!==null&&it!==void 0?it:!0,uriResolver:Ne}}class I{constructor(v={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,v=this.opts={...v,...P(v)};const{es5:j,lines:b}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:T,es5:j,lines:b}),this.logger=K(v.logger);const a=v.validateFormats;v.validateFormats=!1,this.RULES=(0,i.getRules)(),D.call(this,y,v,"NOT SUPPORTED"),D.call(this,_,v,"DEPRECATED","warn"),this._metaOpts=z.call(this),v.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),v.keywords&&x.call(this,v.keywords),typeof v.meta=="object"&&this.addMetaSchema(v.meta),k.call(this),v.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:v,meta:j,schemaId:b}=this.opts;let a=g;b==="id"&&(a={...g},a.id=a.$id,delete a.$id),j&&v&&this.addMetaSchema(a,a[b],!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 b;if(typeof v=="string"){if(b=this.getSchema(v),!b)throw new Error(`no schema with key or ref "${v}"`)}else b=this.compile(v);const a=b(j);return"$async"in b||(this.errors=b.errors),a}compile(v,j){const b=this._addSchema(v,j);return b.validate||this._compileSchemaEnv(b)}compileAsync(v,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:b}=this.opts;return a.call(this,v,j);async function a(G,ne){await h.call(this,G.$schema);const he=this._addSchema(G,ne);return he.validate||C.call(this,he)}async function h(G){G&&!this.getSchema(G)&&await a.call(this,{$ref:G},!0)}async function C(G){try{return this._compileSchemaEnv(G)}catch(ne){if(!(ne instanceof s.default))throw ne;return M.call(this,ne),await q.call(this,ne.missingSchema),C.call(this,G)}}function M({missingSchema:G,missingRef:ne}){if(this.refs[G])throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`)}async function q(G){const ne=await W.call(this,G);this.refs[G]||await h.call(this,ne.$schema),this.refs[G]||this.addSchema(ne,G,j)}async function W(G){const ne=this._loading[G];if(ne)return ne;try{return await(this._loading[G]=b(G))}finally{delete this._loading[G]}}}addSchema(v,j,b,a=this.opts.validateSchema){if(Array.isArray(v)){for(const C of v)this.addSchema(C,void 0,b,a);return this}let h;if(typeof v=="object"){const{schemaId:C}=this.opts;if(h=v[C],h!==void 0&&typeof h!="string")throw new Error(`schema ${C} must be string`)}return j=(0,d.normalizeId)(j||h),this._checkUnique(j),this.schemas[j]=this._addSchema(v,b,j,a,!0),this}addMetaSchema(v,j,b=this.opts.validateSchema){return this.addSchema(v,j,!0,b),this}validateSchema(v,j){if(typeof v=="boolean")return!0;let b;if(b=v.$schema,b!==void 0&&typeof b!="string")throw new Error("$schema must be a string");if(b=b||this.opts.defaultMeta||this.defaultMeta(),!b)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(b,v);if(!a&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return a}getSchema(v){let j;for(;typeof(j=w.call(this,v))=="string";)v=j;if(j===void 0){const{schemaId:b}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:b});if(j=o.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 b=v[this.opts.schemaId];return b&&(b=(0,d.normalizeId)(b),delete this.schemas[b],delete this.refs[b]),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 b;if(typeof v=="string")b=v,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=b);else if(typeof v=="object"&&j===void 0){if(j=v,b=j.keyword,Array.isArray(b)&&!b.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(oe.call(this,b,j),!j)return(0,p.eachItem)(b,h=>ke.call(this,h)),this;qe.call(this,j);const a={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,p.eachItem)(b,a.type.length===0?h=>ke.call(this,h,a):h=>a.type.forEach(C=>ke.call(this,h,a,C))),this}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 b of j.rules){const a=b.rules.findIndex(h=>h.keyword===v);a>=0&&b.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:b="data"}={}){return!v||v.length===0?"No errors":v.map(a=>`${b}${a.instancePath} ${a.message}`).reduce((a,h)=>a+j+h)}$dataMetaSchema(v,j){const b=this.RULES.all;v=JSON.parse(JSON.stringify(v));for(const a of j){const h=a.split("/").slice(1);let C=v;for(const M of h)C=C[M];for(const M in b){const q=b[M];if(typeof q!="object")continue;const{$data:W}=q.definition,G=C[M];W&&G&&(C[M]=Ue(G))}}return v}_removeAllSchemas(v,j){for(const b in v){const a=v[b];(!j||j.test(b))&&(typeof a=="string"?delete v[b]:a&&!a.meta&&(this._cache.delete(a.schema),delete v[b]))}}_addSchema(v,j,b,a=this.opts.validateSchema,h=this.opts.addUsedSchema){let C;const{schemaId:M}=this.opts;if(typeof v=="object")C=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 q=this._cache.get(v);if(q!==void 0)return q;b=(0,d.normalizeId)(C||b);const W=d.getSchemaRefs.call(this,v,b);return q=new o.SchemaEnv({schema:v,schemaId:M,meta:j,baseId:b,localRefs:W}),this._cache.set(q.schema,q),h&&!b.startsWith("#")&&(b&&this._checkUnique(b),this.refs[b]=q),a&&this.validateSchema(v,!0),q}_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):o.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{o.compileSchema.call(this,v)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(F,v,j,b="error"){for(const a in F){const h=a;h in v&&this.logger[b](`${j}: option ${a}. ${F[h]}`)}}function w(F){return F=(0,d.normalizeId)(F),this.schemas[F]||this.refs[F]}function k(){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 x(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 z(){const F={...this.opts};for(const v of R)delete F[v];return F}const re={log(){},warn(){},error(){}};function K(F){if(F===!1)return re;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 ue=/^[a-z_$][a-z0-9_$:-]*$/i;function oe(F,v){const{RULES:j}=this;if((0,p.eachItem)(F,b=>{if(j.keywords[b])throw new Error(`Keyword ${b} is already defined`);if(!ue.test(b))throw new Error(`Keyword ${b} has invalid name`)}),!!v&&v.$data&&!("code"in v||"validate"in v))throw new Error('$data keyword must have "code" or "validate" function')}function ke(F,v,j){var b;const a=v==null?void 0:v.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let C=a?h.post:h.rules.find(({type:q})=>q===j);if(C||(C={type:j,rules:[]},h.rules.push(C)),h.keywords[F]=!0,!v)return;const M={keyword:F,definition:{...v,type:(0,u.getJSONTypes)(v.type),schemaType:(0,u.getJSONTypes)(v.schemaType)}};v.before?Ce.call(this,C,M,v.before):C.rules.push(M),h.all[F]=M,(b=v.implements)===null||b===void 0||b.forEach(q=>this.addKeyword(q))}function Ce(F,v,j){const b=F.rules.findIndex(a=>a.keyword===j);b>=0?F.rules.splice(b,0,v):(F.rules.push(v),this.logger.warn(`rule ${j} is not defined`))}function qe(F){let{metaSchema:v}=F;v!==void 0&&(F.$data&&this.opts.$data&&(v=Ue(v)),F.validateSchema=this.compile(v,!0))}const et={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ue(F){return{anyOf:[F,et]}}})(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:i,validateName:o,opts:l,self:d}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return g();const p=compile_1$1.resolveRef.call(d,u,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 O(p);return N(p);function g(){if(i===u)return callRef(e,o,i,i.$async);const R=t.scopeValue("root",{ref:u});return callRef(e,(0,codegen_1$l._)`${R}.validate`,u,u.$async)}function O(R){const T=getValidate(e,R);callRef(e,T,R,R.$async)}function N(R){const T=t.scopeValue("schema",l.code.source===!0?{ref:R,code:(0,codegen_1$l.stringify)(R)}:{ref:R}),y=t.name("valid"),_=e.subschema({schema:R,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:T,errSchemaPath:r},y);e.mergeEvaluated(_),e.ok(y)}}};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:i}=e,{allErrors:o,schemaEnv:l,opts:d}=i,u=d.passContext?names_1$1.default.this:codegen_1$l.nil;n?p():g();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");const R=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,u)}`),N(t),o||s.assign(R,!0)},T=>{s.if((0,codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`,()=>s.throw(T)),O(T),o||s.assign(R,!1)}),e.ok(R)}function g(){e.result((0,code_1$8.callValidateCode)(e,t,u),()=>N(t),()=>O(t))}function O(R){const T=(0,codegen_1$l._)`${R}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function N(R){var T;if(!i.opts.unevaluated)return;const y=(T=r==null?void 0:r.validate)===null||T===void 0?void 0:T.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=util_1$j.mergeEvaluated.props(s,y.props,i.props));else{const _=s.var("props",(0,codegen_1$l._)`${R}.evaluated.props`);i.props=util_1$j.mergeEvaluated.props(s,_,i.props,codegen_1$l.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=util_1$j.mergeEvaluated.items(s,y.items,i.items));else{const _=s.var("items",(0,codegen_1$l._)`${R}.evaluated.items`);i.items=util_1$j.mergeEvaluated.items(s,_,i.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,i=s.opts.multipleOfPrecision,o=t.let("res"),l=i?(0,codegen_1$j._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,codegen_1$j._)`${o} !== parseInt(${o})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};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,i=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,o=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._)`${o} ${i} ${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:i}=e,o=i.opts.unicodeRegExp?"u":"",l=r?(0,codegen_1$h._)`(new RegExp(${s}, ${o}))`:(0,code_1$7.usePattern)(e,n);e.fail$data((0,codegen_1$h._)`!${l}.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:i,it:o}=e,{opts:l}=o;if(!i&&r.length===0)return;const d=r.length>=l.loopRequired;if(o.allErrors?u():p(),l.strictRequired){const N=e.parentSchema.properties,{definedProperties:R}=e.it;for(const T of r)if((N==null?void 0:N[T])===void 0&&!R.has(T)){const y=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${T}" is not defined at "${y}" (strictRequired)`;(0,util_1$h.checkStrictMode)(o,_,o.opts.strictRequired)}}function u(){if(d||i)e.block$data(codegen_1$f.nil,g);else for(const N of r)(0,code_1$6.checkReportMissingProp)(e,N)}function p(){const N=t.let("missing");if(d||i){const R=t.let("valid",!0);e.block$data(R,()=>O(N,R)),e.ok(R)}else t.if((0,code_1$6.checkMissingProp)(e,r,N)),(0,code_1$6.reportMissingProp)(e,N),t.else()}function g(){t.forOf("prop",n,N=>{e.setParams({missingProperty:N}),t.if((0,code_1$6.noPropertyInData)(t,s,N,l.ownProperties),()=>e.error())})}function O(N,R){e.setParams({missingProperty:N}),t.forOf(N,n,()=>{t.assign(R,(0,code_1$6.propertyInData)(t,s,N,l.ownProperties)),t.if((0,codegen_1$f.not)(R),()=>{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:i,schemaCode:o,it:l}=e;if(!n&&!s)return;const d=t.let("valid"),u=i.items?(0,dataType_1.getSchemaTypes)(i.items):[];e.block$data(d,p,(0,codegen_1$d._)`${o} === false`),e.ok(d);function p(){const R=t.let("i",(0,codegen_1$d._)`${r}.length`),T=t.let("j");e.setParams({i:R,j:T}),t.assign(d,!0),t.if((0,codegen_1$d._)`${R} > 1`,()=>(g()?O:N)(R,T))}function g(){return u.length>0&&!u.some(R=>R==="object"||R==="array")}function O(R,T){const y=t.name("item"),_=(0,dataType_1.checkDataTypes)(u,y,l.opts.strictNumbers,dataType_1.DataType.Wrong),$=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${R}--;`,()=>{t.let(y,(0,codegen_1$d._)`${r}[${R}]`),t.if(_,(0,codegen_1$d._)`continue`),u.length>1&&t.if((0,codegen_1$d._)`typeof ${y} == "string"`,(0,codegen_1$d._)`${y} += "_"`),t.if((0,codegen_1$d._)`typeof ${$}[${y}] == "number"`,()=>{t.assign(T,(0,codegen_1$d._)`${$}[${y}]`),e.error(),t.assign(d,!1).break()}).code((0,codegen_1$d._)`${$}[${y}] = ${R}`)})}function N(R,T){const y=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${R}--;`,()=>t.for((0,codegen_1$d._)`${T} = ${R}; ${T}--;`,()=>t.if((0,codegen_1$d._)`${y}(${r}[${R}], ${r}[${T}])`,()=>{e.error(),t.assign(d,!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:i}=e;n||i&&typeof i=="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._)`${i} !== ${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:i,it:o}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=o.opts.loopEnum;let d;const u=()=>d??(d=(0,util_1$e.useFunc)(t,equal_1.default));let p;if(l||n)p=t.let("valid"),e.block$data(p,g);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const N=t.const("vSchema",i);p=(0,codegen_1$b.or)(...s.map((R,T)=>O(N,T)))}e.pass(p);function g(){t.assign(p,!1),t.forOf("v",i,N=>t.if((0,codegen_1$b._)`${u()}(${r}, ${N})`,()=>t.assign(p,!0).break()))}function O(N,R){const T=s[R];return typeof T=="object"&&T!==null?(0,codegen_1$b._)`${u()}(${r}, ${N}[${R}])`:(0,codegen_1$b._)`${r} === ${T}`}}};_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:i,it:o}=e;o.items=!0;const l=r.const("len",(0,codegen_1$a._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,codegen_1$a._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,util_1$d.alwaysValidSchema)(o,n)){const u=r.var("valid",(0,codegen_1$a._)`${l} <= ${t.length}`);r.if((0,codegen_1$a.not)(u),()=>d(u)),e.ok(u)}function d(u){r.forRange("i",t.length,l,p=>{e.subschema({keyword:i,dataProp:p,dataPropType:util_1$d.Type.Num},u),o.allErrors||r.if((0,codegen_1$a.not)(u),()=>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:i,keyword:o,it:l}=e;p(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=util_1$c.mergeEvaluated.items(n,r.length,l.items));const d=n.name("valid"),u=n.const("len",(0,codegen_1$9._)`${i}.length`);r.forEach((g,O)=>{(0,util_1$c.alwaysValidSchema)(l,g)||(n.if((0,codegen_1$9._)`${u} > ${O}`,()=>e.subschema({keyword:o,schemaProp:O,dataProp:O},d)),e.ok(d))});function p(g){const{opts:O,errSchemaPath:N}=l,R=r.length,T=R===g.minItems&&(R===g.maxItems||g[t]===!1);if(O.strictTuples&&!T){const y=`"${o}" is ${R}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;(0,util_1$c.checkStrictMode)(l,y,O.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:i}=e;let o,l;const{minContains:d,maxContains:u}=n;i.opts.next?(o=d===void 0?1:d,l=u):o=1;const p=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:o,max:l}),l===void 0&&o===0){(0,util_1$a.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,util_1$a.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(i,r)){let T=(0,codegen_1$7._)`${p} >= ${o}`;l!==void 0&&(T=(0,codegen_1$7._)`${T} && ${p} <= ${l}`),e.pass(T);return}i.items=!0;const g=t.name("valid");l===void 0&&o===1?N(g,()=>t.if(g,()=>t.break())):o===0?(t.let(g,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,O)):(t.let(g,!1),O()),e.result(g,()=>e.reset());function O(){const T=t.name("_valid"),y=t.let("count",0);N(T,()=>t.if(T,()=>R(y)))}function N(T,y){t.forRange("i",0,p,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},T),y()})}function R(T){t.code((0,codegen_1$7._)`${T}++`),l===void 0?t.if((0,codegen_1$7._)`${T} >= ${o}`,()=>t.assign(g,!0).break()):(t.if((0,codegen_1$7._)`${T} > ${l}`,()=>t.assign(g,!1).break()),o===1?t.assign(g,!0):t.if((0,codegen_1$7._)`${T} >= ${o}`,()=>t.assign(g,!0)))}}};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:d,depsCount:u,deps:p}})=>{const g=u===1?"property":"properties";return(0,t.str)`must have ${g} ${p} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:p,missingProperty:g}})=>(0,t._)`{property: ${d},
624
+ missingProperty: ${g},
608
625
  depsCount: ${u},
609
- deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,p]=i(d);o(d,u),l(d,p)}};function i({schema:d}){const u={},p={};for(const $ in d){if($==="__proto__")continue;const O=Array.isArray(d[$])?u:p;O[$]=d[$]}return[u,p]}function o(d,u=d.schema){const{gen:p,data:$,it:O}=d;if(Object.keys(u).length===0)return;const N=p.let("missing");for(const R in u){const v=u[R];if(v.length===0)continue;const g=(0,n.propertyInData)(p,$,R,O.opts.ownProperties);d.setParams({property:R,depsCount:v.length,deps:v.join(", ")}),O.allErrors?p.if(g,()=>{for(const m of v)(0,n.checkReportMissingProp)(d,m)}):(p.if((0,t._)`${g} && (${(0,n.checkMissingProp)(d,v,N)})`),(0,n.reportMissingProp)(d,N),p.else())}}e.validatePropertyDeps=o;function l(d,u=d.schema){const{gen:p,data:$,keyword:O,it:N}=d,R=p.name("valid");for(const v in u)(0,r.alwaysValidSchema)(N,u[v])||(p.if((0,n.propertyInData)(p,$,v,N.opts.ownProperties),()=>{const g=d.subschema({keyword:O,schemaProp:v},R);d.mergeValidEvaluated(g,R)},()=>p.var(R,!0)),d.ok(R))}e.validateSchemaDeps=l,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 i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,codegen_1$6.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};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:i,it:o}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:d}=o;if(o.props=!0,d.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(o,r))return;const u=(0,code_1$3.allSchemaProperties)(n.properties),p=(0,code_1$3.allSchemaProperties)(n.patternProperties);$(),e.ok((0,codegen_1$5._)`${i} === ${names_1.default.errors}`);function $(){t.forIn("key",s,g=>{!u.length&&!p.length?R(g):t.if(O(g),()=>R(g))})}function O(g){let m;if(u.length>8){const T=(0,util_1$8.schemaRefOrVal)(o,n.properties,"properties");m=(0,code_1$3.isOwnProperty)(t,T,g)}else u.length?m=(0,codegen_1$5.or)(...u.map(T=>(0,codegen_1$5._)`${g} === ${T}`)):m=codegen_1$5.nil;return p.length&&(m=(0,codegen_1$5.or)(m,...p.map(T=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,T)}.test(${g})`))),(0,codegen_1$5.not)(m)}function N(g){t.code((0,codegen_1$5._)`delete ${s}[${g}]`)}function R(g){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){N(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(o,r)){const m=t.name("valid");d.removeAdditional==="failing"?(v(g,m,!1),t.if((0,codegen_1$5.not)(m),()=>{e.reset(),N(g)})):(v(g,m),l||t.if((0,codegen_1$5.not)(m),()=>t.break()))}}function v(g,m,T){const S={keyword:"additionalProperties",dataProp:g,dataPropType:util_1$8.Type.Str};T===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,m)}}};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:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i,additionalProperties_1$1.default,"additionalProperties"));const o=(0,code_1$2.allSchemaProperties)(r);for(const $ of o)i.definedProperties.add($);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(o),i.props));const l=o.filter($=>!(0,util_1$7.alwaysValidSchema)(i,r[$]));if(l.length===0)return;const d=t.name("valid");for(const $ of l)u($)?p($):(t.if((0,code_1$2.propertyInData)(t,s,$,i.opts.ownProperties)),p($),i.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add($),e.ok(d);function u($){return i.opts.useDefaults&&!i.compositeRule&&r[$].default!==void 0}function p($){e.subschema({keyword:"properties",schemaProp:$,dataProp:$},d)}}};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:i}=e,{opts:o}=i,l=(0,code_1$1.allSchemaProperties)(r),d=l.filter(v=>(0,util_1$6.alwaysValidSchema)(i,r[v]));if(l.length===0||d.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,p=t.name("valid");i.props!==!0&&!(i.props instanceof codegen_1$4.Name)&&(i.props=(0,util_2.evaluatedPropsToName)(t,i.props));const{props:$}=i;O();function O(){for(const v of l)u&&N(v),i.allErrors?R(v):(t.var(p,!0),R(v),t.if(p))}function N(v){for(const g in u)new RegExp(v).test(g)&&(0,util_1$6.checkStrictMode)(i,`property ${g} matches pattern ${v} (use allowMatchingProperties)`)}function R(v){t.forIn("key",n,g=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,v)}.test(${g})`,()=>{const m=d.includes(v);m||e.subschema({keyword:"patternProperties",schemaProp:v,dataProp:g,dataPropType:util_2.Type.Str},p),i.opts.unevaluated&&$!==!0?t.assign((0,codegen_1$4._)`${$}[${g}]`,!0):!m&&!i.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 i=r,o=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(u),e.result(o,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((p,$)=>{let O;(0,util_1$4.alwaysValidSchema)(s,p)?t.var(d,!0):O=e.subschema({keyword:"oneOf",schemaProp:$,compositeRule:!0},d),$>0&&t.if((0,codegen_1$3._)`${d} && ${o}`).assign(o,!1).assign(l,(0,codegen_1$3._)`[${l}, ${$}]`).else(),t.if(d,()=>{t.assign(o,!0),t.assign(l,$),O&&e.mergeEvaluated(O,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((i,o)=>{if((0,util_1$3.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(l)})}};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"),i=hasSchema(n,"else");if(!s&&!i)return;const o=t.let("valid",!0),l=t.name("_valid");if(d(),e.reset(),s&&i){const p=t.let("ifClause");e.setParams({ifClause:p}),t.if(l,u("then",p),u("else",p))}else s?t.if(l,u("then")):t.if((0,codegen_1$2.not)(l),u("else"));e.pass(o,()=>e.error(!0));function d(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(p)}function u(p,$){return()=>{const O=e.subschema({keyword:p},l);t.assign(o,l),e.mergeValidEvaluated(O,o),$?t.assign($,(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:i,schemaCode:o,it:l}=e,{opts:d,errSchemaPath:u,schemaEnv:p,self:$}=l;if(!d.validateFormats)return;s?O():N();function O(){const R=r.scopeValue("formats",{ref:$.formats,code:d.code.formats}),v=r.const("fDef",(0,codegen_1$1._)`${R}[${o}]`),g=r.let("fType"),m=r.let("format");r.if((0,codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(g,(0,codegen_1$1._)`${v}.type || "string"`).assign(m,(0,codegen_1$1._)`${v}.validate`),()=>r.assign(g,(0,codegen_1$1._)`"string"`).assign(m,v)),e.fail$data((0,codegen_1$1.or)(T(),S()));function T(){return d.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${o} && !${m}`}function S(){const I=p.$async?(0,codegen_1$1._)`(${v}.async ? await ${m}(${n}) : ${m}(${n}))`:(0,codegen_1$1._)`${m}(${n})`,D=(0,codegen_1$1._)`(typeof ${m} == "function" ? ${I} : ${m}.test(${n}))`;return(0,codegen_1$1._)`${m} && ${m} !== true && ${g} === ${t} && !${D}`}}function N(){const R=$.formats[i];if(!R){T();return}if(R===!0)return;const[v,g,m]=S(R);v===t&&e.pass(I());function T(){if(d.strictSchema===!1){$.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function S(D){const w=D instanceof RegExp?(0,codegen_1$1.regexpCode)(D):d.code.formats?(0,codegen_1$1._)`${d.code.formats}${(0,codegen_1$1.getProperty)(i)}`:void 0,k=r.scopeValue("formats",{key:i,ref:D,code:w});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,codegen_1$1._)`${k}.validate`]:["string",D,k]}function I(){if(typeof R=="object"&&!(R instanceof RegExp)&&R.async){if(!p.$async)throw new Error("async format in sync schema");return(0,codegen_1$1._)`await ${m}(${n})`}return typeof g=="function"?(0,codegen_1$1._)`${m}(${n})`:(0,codegen_1$1._)`${m}.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:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),u=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(l)}`);t.if((0,codegen_1._)`typeof ${u} == "string"`,()=>p(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:u,tagName:l})),e.ok(d);function p(){const N=O();t.if(!1);for(const R in N)t.elseIf((0,codegen_1._)`${u} === ${R}`),t.assign(d,$(N[R]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function $(N){const R=t.name("valid"),v=e.subschema({keyword:"oneOf",schemaProp:N},R);return e.mergeEvaluated(v,codegen_1.Name),R}function O(){var N;const R={},v=m(s);let g=!0;for(let I=0;I<o.length;I++){let D=o[I];D!=null&&D.$ref&&!(0,util_1.schemaHasRulesButRef)(D,i.self.RULES)&&(D=compile_1.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,D==null?void 0:D.$ref),D instanceof compile_1.SchemaEnv&&(D=D.schema));const w=(N=D==null?void 0:D.properties)===null||N===void 0?void 0:N[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);g=g&&(v||m(D)),T(w,I)}if(!g)throw new Error(`discriminator: "${l}" must be required`);return R;function m({required:I}){return Array.isArray(I)&&I.includes(l)}function T(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/${l}" must have "const" or "enum"`)}function S(I,D){if(typeof I!="string"||I in R)throw new Error(`discriminator: "${l}" values must be unique strings`);R[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,i=require$$3,o=["/properties"],l="http://json-schema.org/draft-07/schema";class d extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(R=>this.addVocabulary(R)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const R=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(R,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.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 $=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return $.default}});var O=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return O.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",const:"kitchen-sink"},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. Possible values are:
626
+ deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,p]=i(d);o(d,u),l(d,p)}};function i({schema:d}){const u={},p={};for(const g in d){if(g==="__proto__")continue;const O=Array.isArray(d[g])?u:p;O[g]=d[g]}return[u,p]}function o(d,u=d.schema){const{gen:p,data:g,it:O}=d;if(Object.keys(u).length===0)return;const N=p.let("missing");for(const R in u){const T=u[R];if(T.length===0)continue;const y=(0,n.propertyInData)(p,g,R,O.opts.ownProperties);d.setParams({property:R,depsCount:T.length,deps:T.join(", ")}),O.allErrors?p.if(y,()=>{for(const _ of T)(0,n.checkReportMissingProp)(d,_)}):(p.if((0,t._)`${y} && (${(0,n.checkMissingProp)(d,T,N)})`),(0,n.reportMissingProp)(d,N),p.else())}}e.validatePropertyDeps=o;function l(d,u=d.schema){const{gen:p,data:g,keyword:O,it:N}=d,R=p.name("valid");for(const T in u)(0,r.alwaysValidSchema)(N,u[T])||(p.if((0,n.propertyInData)(p,g,T,N.opts.ownProperties),()=>{const y=d.subschema({keyword:O,schemaProp:T},R);d.mergeValidEvaluated(y,R)},()=>p.var(R,!0)),d.ok(R))}e.validateSchemaDeps=l,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 i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,codegen_1$6.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};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:i,it:o}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:d}=o;if(o.props=!0,d.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(o,r))return;const u=(0,code_1$3.allSchemaProperties)(n.properties),p=(0,code_1$3.allSchemaProperties)(n.patternProperties);g(),e.ok((0,codegen_1$5._)`${i} === ${names_1.default.errors}`);function g(){t.forIn("key",s,y=>{!u.length&&!p.length?R(y):t.if(O(y),()=>R(y))})}function O(y){let _;if(u.length>8){const $=(0,util_1$8.schemaRefOrVal)(o,n.properties,"properties");_=(0,code_1$3.isOwnProperty)(t,$,y)}else u.length?_=(0,codegen_1$5.or)(...u.map($=>(0,codegen_1$5._)`${y} === ${$}`)):_=codegen_1$5.nil;return p.length&&(_=(0,codegen_1$5.or)(_,...p.map($=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,$)}.test(${y})`))),(0,codegen_1$5.not)(_)}function N(y){t.code((0,codegen_1$5._)`delete ${s}[${y}]`)}function R(y){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){N(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(o,r)){const _=t.name("valid");d.removeAdditional==="failing"?(T(y,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),N(y)})):(T(y,_),l||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function T(y,_,$){const P={keyword:"additionalProperties",dataProp:y,dataPropType:util_1$8.Type.Str};$===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(P,_)}}};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:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i,additionalProperties_1$1.default,"additionalProperties"));const o=(0,code_1$2.allSchemaProperties)(r);for(const g of o)i.definedProperties.add(g);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(o),i.props));const l=o.filter(g=>!(0,util_1$7.alwaysValidSchema)(i,r[g]));if(l.length===0)return;const d=t.name("valid");for(const g of l)u(g)?p(g):(t.if((0,code_1$2.propertyInData)(t,s,g,i.opts.ownProperties)),p(g),i.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(g),e.ok(d);function u(g){return i.opts.useDefaults&&!i.compositeRule&&r[g].default!==void 0}function p(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},d)}}};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:i}=e,{opts:o}=i,l=(0,code_1$1.allSchemaProperties)(r),d=l.filter(T=>(0,util_1$6.alwaysValidSchema)(i,r[T]));if(l.length===0||d.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,p=t.name("valid");i.props!==!0&&!(i.props instanceof codegen_1$4.Name)&&(i.props=(0,util_2.evaluatedPropsToName)(t,i.props));const{props:g}=i;O();function O(){for(const T of l)u&&N(T),i.allErrors?R(T):(t.var(p,!0),R(T),t.if(p))}function N(T){for(const y in u)new RegExp(T).test(y)&&(0,util_1$6.checkStrictMode)(i,`property ${y} matches pattern ${T} (use allowMatchingProperties)`)}function R(T){t.forIn("key",n,y=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,T)}.test(${y})`,()=>{const _=d.includes(T);_||e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:y,dataPropType:util_2.Type.Str},p),i.opts.unevaluated&&g!==!0?t.assign((0,codegen_1$4._)`${g}[${y}]`,!0):!_&&!i.allErrors&&t.if((0,codegen_1$4.not)(p),()=>t.break())})})}}};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 i=r,o=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(u),e.result(o,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((p,g)=>{let O;(0,util_1$4.alwaysValidSchema)(s,p)?t.var(d,!0):O=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},d),g>0&&t.if((0,codegen_1$3._)`${d} && ${o}`).assign(o,!1).assign(l,(0,codegen_1$3._)`[${l}, ${g}]`).else(),t.if(d,()=>{t.assign(o,!0),t.assign(l,g),O&&e.mergeEvaluated(O,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((i,o)=>{if((0,util_1$3.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(l)})}};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"),i=hasSchema(n,"else");if(!s&&!i)return;const o=t.let("valid",!0),l=t.name("_valid");if(d(),e.reset(),s&&i){const p=t.let("ifClause");e.setParams({ifClause:p}),t.if(l,u("then",p),u("else",p))}else s?t.if(l,u("then")):t.if((0,codegen_1$2.not)(l),u("else"));e.pass(o,()=>e.error(!0));function d(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(p)}function u(p,g){return()=>{const O=e.subschema({keyword:p},l);t.assign(o,l),e.mergeValidEvaluated(O,o),g?t.assign(g,(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:i,schemaCode:o,it:l}=e,{opts:d,errSchemaPath:u,schemaEnv:p,self:g}=l;if(!d.validateFormats)return;s?O():N();function O(){const R=r.scopeValue("formats",{ref:g.formats,code:d.code.formats}),T=r.const("fDef",(0,codegen_1$1._)`${R}[${o}]`),y=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign(y,(0,codegen_1$1._)`${T}.type || "string"`).assign(_,(0,codegen_1$1._)`${T}.validate`),()=>r.assign(y,(0,codegen_1$1._)`"string"`).assign(_,T)),e.fail$data((0,codegen_1$1.or)($(),P()));function $(){return d.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${o} && !${_}`}function P(){const I=p.$async?(0,codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,D=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${y} === ${t} && !${D}`}}function N(){const R=g.formats[i];if(!R){$();return}if(R===!0)return;const[T,y,_]=P(R);T===t&&e.pass(I());function $(){if(d.strictSchema===!1){g.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function P(D){const w=D instanceof RegExp?(0,codegen_1$1.regexpCode)(D):d.code.formats?(0,codegen_1$1._)`${d.code.formats}${(0,codegen_1$1.getProperty)(i)}`:void 0,k=r.scopeValue("formats",{key:i,ref:D,code:w});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,codegen_1$1._)`${k}.validate`]:["string",D,k]}function I(){if(typeof R=="object"&&!(R instanceof RegExp)&&R.async){if(!p.$async)throw new Error("async format in sync schema");return(0,codegen_1$1._)`await ${_}(${n})`}return typeof y=="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:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),u=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(l)}`);t.if((0,codegen_1._)`typeof ${u} == "string"`,()=>p(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:u,tagName:l})),e.ok(d);function p(){const N=O();t.if(!1);for(const R in N)t.elseIf((0,codegen_1._)`${u} === ${R}`),t.assign(d,g(N[R]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function g(N){const R=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:N},R);return e.mergeEvaluated(T,codegen_1.Name),R}function O(){var N;const R={},T=_(s);let y=!0;for(let I=0;I<o.length;I++){let D=o[I];D!=null&&D.$ref&&!(0,util_1.schemaHasRulesButRef)(D,i.self.RULES)&&(D=compile_1.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,D==null?void 0:D.$ref),D instanceof compile_1.SchemaEnv&&(D=D.schema));const w=(N=D==null?void 0:D.properties)===null||N===void 0?void 0:N[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);y=y&&(T||_(D)),$(w,I)}if(!y)throw new Error(`discriminator: "${l}" must be required`);return R;function _({required:I}){return Array.isArray(I)&&I.includes(l)}function $(I,D){if(I.const)P(I.const,D);else if(I.enum)for(const w of I.enum)P(w,D);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function P(I,D){if(typeof I!="string"||I in R)throw new Error(`discriminator: "${l}" values must be unique strings`);R[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,i=require$$3,o=["/properties"],l="http://json-schema.org/draft-07/schema";class d extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(R=>this.addVocabulary(R)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const R=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(R,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.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 g=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var O=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return O.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. Possible values are:
610
627
 
611
628
  - 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.
612
629
  - 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.
613
630
  This option is only kept in here to avoid breaking Blueprint schema validation
614
- 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:"importFile"},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},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},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:"setPhpIniEntry"},key:{type:"string",description:'Entry name e.g. "display_errors"'},value:{type:"string",description:'Entry value as a string e.g. "1"'}},required:["key","step","value"]},{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."},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};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=()=>{}}={}){var p,$,O,N,R;if(e={...e,steps:(e.steps||[]).filter(isStepDefinition)},e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const v=e.plugins.map(g=>typeof g=="string"?g.startsWith("https://")?{resource:"url",url:g}:{resource:"wordpress.org/plugins",slug:g}:g).map(g=>({step:"installPlugin",pluginZipFile:g}));e.steps.unshift(...v)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login});const s=(p=e.steps)==null?void 0:p.findIndex(v=>typeof v=="object"&&(v==null?void 0:v.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.includes("kitchen-sink")||(e.phpExtensionBundles.push("kitchen-sink"),console.warn("The WP-CLI 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.steps)==null||$.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const{valid:i,errors:o}=validateBlueprint(e);if(!i){const v=new Error(`Invalid blueprint: ${o[0].message} at ${o[0].instancePath}`);throw v.errors=o,v}const l=e.steps||[],d=l.reduce((v,g)=>{var m;return v+(((m=g.progress)==null?void 0:m.weight)||1)},0),u=l.map(v=>compileStep(v,{semaphore:r,rootProgressTracker:t,totalProgressWeight:d}));return{versions:{php:compileVersion((O=e.preferredVersions)==null?void 0:O.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:((N=e.preferredVersions)==null?void 0:N.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:((R=e.features)==null?void 0:R.networking)??!1},run:async v=>{try{for(const{resources:g}of u)for(const m of g)m.setPlayground(v),m.isAsync&&m.resolve();for(const[g,{run:m,step:T}]of Object.entries(u))try{const S=await m(v);n(S,T)}catch(S){throw console.error(S),new Error(`Error when executing the blueprint step #${g} (${JSON.stringify(T)}) ${S instanceof Error?`: ${S.message}`:S}`,{cause:S})}}finally{try{await v.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 i of blueprintValidator.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.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 compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var p;const s=r.stage((((p=e.progress)==null?void 0:p.weight)||1)/n),i={};for(const $ of Object.keys(e)){let O=e[$];isFileReference(O)&&(O=Resource.create(O,{semaphore:t})),i[$]=O}const o=async $=>{var O;try{return s.fillSlowly(),await keyedStepHandlers[e.step]($,await resolveArguments(i),{tracker:s,initialCaption:(O=e.progress)==null?void 0:O.caption})}finally{s.finish()}},l=getResources(i),d=getResources(i).filter($=>$.isAsync),u=1/(d.length+1);for(const $ of d)$.progress=s.stage(u);return{run:o,step:e,resources:l}}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(){}exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.compileBlueprint=compileBlueprint;exports.cp=cp;exports.defineSiteUrl=defineSiteUrl;exports.defineWpConfigConsts=defineWpConfigConsts;exports.enableMultisite=enableMultisite;exports.exportWXR=exportWXR;exports.exportWXZ=exportWXZ;exports.importFile=importFile;exports.importWordPressFiles=importWordPressFiles;exports.installPlugin=installPlugin;exports.installTheme=installTheme;exports.login=login;exports.mkdir=mkdir;exports.mv=mv;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.setPhpIniEntry=setPhpIniEntry;exports.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpCLI=wpCLI$1;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
631
+ 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:"importFile"},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},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},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:"setPhpIniEntry"},key:{type:"string",description:'Entry name e.g. "display_errors"'},value:{type:"string",description:'Entry value as a string e.g. "1"'}},required:["key","step","value"]},{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."},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 g,O,N,R,T,y,_;e={...e,steps:(e.steps||[]).filter(isStepDefinition)};for(const $ of e.steps)typeof $=="object"&&$.step==="importFile"&&($.step="importWxr",console.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 $=e.plugins.map(P=>typeof P=="string"?P.startsWith("https://")?{resource:"url",url:P}:{resource:"wordpress.org/plugins",slug:P}:P).map(P=>({step:"installPlugin",pluginZipFile:P}));e.steps.unshift(...$)}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=(g=e.steps)==null?void 0:g.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),console.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. ")),(O=e.steps)==null||O.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const i=(N=e.steps)==null?void 0:N.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="importWxr");i!==void 0&&i>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),console.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. ")),(R=e.steps)==null||R.splice(i,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:o,errors:l}=validateBlueprint(e);if(!o){const $=new Error(`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`);throw $.errors=l,$}const d=e.steps||[],u=d.reduce(($,P)=>{var I;return $+(((I=P.progress)==null?void 0:I.weight)||1)},0),p=d.map($=>compileStep($,{semaphore:r,rootProgressTracker:t,totalProgressWeight:u}));return{versions:{php:compileVersion((T=e.preferredVersions)==null?void 0:T.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:((y=e.preferredVersions)==null?void 0:y.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:((_=e.features)==null?void 0:_.networking)??!1},run:async $=>{try{for(const{resources:P}of p)for(const I of P)I.setPlayground($),I.isAsync&&I.resolve();for(const[P,{run:I,step:D}]of Object.entries(p))try{const w=await I($);n(w,D)}catch(w){throw console.error(w),new Error(`Error when executing the blueprint step #${P} (${JSON.stringify(D)}) ${w instanceof Error?`: ${w.message}`:w}`,{cause:w})}}finally{try{await $.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 i of blueprintValidator.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.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 compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var p;const s=r.stage((((p=e.progress)==null?void 0:p.weight)||1)/n),i={};for(const g of Object.keys(e)){let O=e[g];isFileReference(O)&&(O=Resource.create(O,{semaphore:t})),i[g]=O}const o=async g=>{var O;try{return s.fillSlowly(),await keyedStepHandlers[e.step](g,await resolveArguments(i),{tracker:s,initialCaption:(O=e.progress)==null?void 0:O.caption})}finally{s.finish()}},l=getResources(i),d=getResources(i).filter(g=>g.isAsync),u=1/(d.length+1);for(const g of d)g.progress=s.stage(u);return{run:o,step:e,resources:l}}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(){}exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.compileBlueprint=compileBlueprint;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.request=request;exports.rm=rm;exports.rmdir=rmdir;exports.runBlueprintSteps=runBlueprintSteps;exports.runPHP=runPHP;exports.runPHPWithOptions=runPHPWithOptions;exports.runSql=runSql;exports.runWpInstallationWizard=runWpInstallationWizard;exports.setPhpIniEntry=setPhpIniEntry;exports.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpCLI=wpCLI$1;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;