@wp-playground/blueprints 0.7.20 → 0.9.2

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,15 +1,15 @@
1
- "use strict";var gt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ce=(e,t,r)=>(gt(e,t,"read from private field"),r?r.call(e):t.get(e)),ie=(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)},ye=(e,t,r,n)=>(gt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var oe=(e,t,r)=>(gt(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"],SleepFinished=Symbol("SleepFinished");function sleep(e){return new Promise(t=>{setTimeout(()=>t(SleepFinished),e)})}class AcquireTimeoutError extends Error{constructor(){super("Acquiring lock timed out")}}class Semaphore{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,sleep(this.timeout)]).then(r=>{if(r===SleepFinished)throw new AcquireTimeoutError}):await t}else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function 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);try{await e(o,i,n)}catch(l){s.emit("error",l),typeof l=="object"&&l!==null&&"message"in l&&typeof l.message=="string"&&i.stderr(l.message),i.exit(1)}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 logToConsole=(e,...t)=>{switch(typeof e.message=="string"?e.message=prepareLogMessage(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=prepareLogMessage(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},prepareLogMessage$1=e=>e instanceof Error?[e.message,e.stack].join(`
2
- `):JSON.stringify(e,null,2),logs=[],addToLogArray=e=>{logs.push(e)},logToMemory=e=>{if(e.raw===!0)addToLogArray(e.message);else{const t=formatLogEntry(typeof e.message=="object"?prepareLogMessage$1(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");addToLogArray(t)}};class Logger extends EventTarget{constructor(t=[]){super(),this.handlers=t,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(logToMemory)?[...logs]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bs=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(bs==="NODE"){let e=function(r){return new Promise(function(n,s){r.onload=r.onerror=function(i){r.onload=r.onerror=null,i.type==="load"?n(r.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),s=new File([r],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(s,i,c){super(s);let l;c!=null&&c.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 f=d.byteLength;s.byobRequest.respond(f),r+=f,r>=n.size&&s.close()}})})}if(bs==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Gr=["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"],Es=Symbol("SleepFinished");function Bi(e){return new Promise(t=>{setTimeout(()=>t(Es),e)})}class Hi extends Error{constructor(){super("Acquiring lock timed out")}}class Gi{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,Bi(this.timeout)]).then(r=>{if(r===Es)throw new Hi}):await t}else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function ue(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=Ss(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function Ps(e){if(e==="/")return"/";e=Ss(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function Ss(e){const t=e[0]==="/";return e=xi(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function xi(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 Ts(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 Ki(){return Ts(36,"-_")}function pe(e){return`json_decode(base64_decode('${Ji(JSON.stringify(e))}'), true)`}function wr(e){const t={};for(const r in e)t[r]=pe(e[r]);return t}function Ji(e){return Qi(new TextEncoder().encode(e))}function Qi(e){const t=String.fromCodePoint(...e);return btoa(t)}const Zi="playground-log",Zn=(e,...t)=>{$e.dispatchEvent(new CustomEvent(Zi,{detail:{log:e,args:t}}))},Yi=(e,...t)=>{switch(typeof e.message=="string"?e.message=Lr(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=Lr(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},Xi=e=>e instanceof Error?[e.message,e.stack].join(`
2
+ `):JSON.stringify(e,null,2),Rs=[],Yn=e=>{Rs.push(e)},Fr=e=>{if(e.raw===!0)Yn(e.message);else{const t=ro(typeof e.message=="object"?Xi(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");Yn(t)}};class eo extends EventTarget{constructor(t=[]){super(),this.handlers=t,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(Fr)?[...Rs]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
3
3
  If you're using a custom logger instance, make sure to register logToMemory handler.
4
- `),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const getDefaultHandlers=()=>{try{if(process.env.NODE_ENV==="test")return[logToMemory]}catch{}return[logToMemory,logToConsole]},logger=new Logger(getDefaultHandlers()),prepareLogMessage=e=>e.replace(/\t/g,""),formatLogEntry=(e,t,r)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),o=s+" "+i;return e=prepareLogMessage(e),`[${o}] ${r} ${t}: ${e}`},activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot,i=await e.run({code:`<?php
4
+ `),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const to=()=>{try{if(process.env.NODE_ENV==="test")return[Fr,Zn]}catch{}return[Fr,Yi,Zn]},$e=new eo(to()),Lr=e=>e.replace(/\t/g,""),ro=(e,t,r)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),c=s+" "+i;return e=Lr(e),`[${c}] ${r} ${t}: ${e}`},br=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot,i=await e.run({code:`<?php
5
5
  define( 'WP_ADMIN', true );
6
- require_once( ${phpVar(s)}. "/wp-load.php" );
7
- require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
6
+ require_once( ${pe(s)}. "/wp-load.php" );
7
+ require_once( ${pe(s)}. "/wp-admin/includes/plugin.php" );
8
8
 
9
9
  // Set current user to admin
10
10
  wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
11
11
 
12
- $plugin_path = ${phpVar(t)};
12
+ $plugin_path = ${pe(t)};
13
13
  $response = false;
14
14
  if (!is_dir($plugin_path)) {
15
15
  $response = activate_plugin($plugin_path);
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  throw new Exception( 'Unable to activate plugin' );
36
- `});if(i.text!=="Plugin activated successfully")throw logger.debug(i),new Error(`Plugin ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},activateTheme=async(e,{themeFolderName:t},r)=>{r==null||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot,s=`${n}/wp-content/themes/${t}`;if(!await e.fileExists(s))throw new Error(`
36
+ `});if(i.text!=="Plugin activated successfully")throw $e.debug(i),new Error(`Plugin ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},xr=async(e,{themeFolderName:t},r)=>{r==null||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot,s=`${n}/wp-content/themes/${t}`;if(!await e.fileExists(s))throw new Error(`
37
37
  Couldn't activate theme ${t}.
38
38
  Theme not found at the provided theme path: ${s}.
39
39
  Check the theme path to ensure it's correct.
@@ -52,7 +52,7 @@
52
52
  throw new Exception( 'Theme ' . getenv('themeFolderName') . ' could not be activated.' );
53
53
  }
54
54
  die('Theme activated successfully');
55
- `,env:{docroot:n,themeFolderName:t}});if(i.text!=="Theme activated successfully")throw logger.debug(i),new Error(`Theme ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},runPHP=async(e,{code:t})=>await e.run({code:t}),runPHPWithOptions=async(e,{options:t})=>await e.run(t),rm=async(e,{path:t})=>{await e.unlink(t)},runSql=async(e,{sql:t},r)=>{r==null||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${randomFilename()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,i=phpVars({docroot:s,sqlFilename:n}),o=await e.run({code:`<?php
55
+ `,env:{docroot:n,themeFolderName:t}});if(i.text!=="Theme activated successfully")throw $e.debug(i),new Error(`Theme ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},ks=async(e,{code:t})=>await e.run({code:t}),Os=async(e,{options:t})=>await e.run(t),Kr=async(e,{path:t})=>{await e.unlink(t)},Ns=async(e,{sql:t},r)=>{r==null||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${Ki()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,i=wr({docroot:s,sqlFilename:n}),c=await e.run({code:`<?php
56
56
  require_once ${i.docroot} . '/wp-load.php';
57
57
 
58
58
  $handle = fopen(${i.sqlFilename}, 'r');
@@ -71,7 +71,7 @@
71
71
  $wpdb->query($buffer);
72
72
  $buffer = '';
73
73
  }
74
- `});return await rm(e,{path:n}),o},request=async(e,{request:t})=>{logger.warn('Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.');const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw logger.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},rewriteWpConfigToDefineConstants=`<?php
74
+ `});return await Kr(e,{path:n}),c},pr=async(e,{request:t})=>{$e.warn('Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.');const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw $e.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},no=`<?php
75
75
 
76
76
  /**
77
77
  * Rewrites the wp-config.php file to ensure specific constants are defined
@@ -402,33 +402,33 @@ function skip_whitespace($tokens) {
402
402
  }
403
403
  return $output;
404
404
  }
405
- `,defineWpConfigConsts=async(e,{consts:t,method:r="define-before-run"})=>{switch(r){case"define-before-run":await defineBeforeRun(e,t);break;case"rewrite-wp-config":{const n=await e.documentRoot,s=joinPaths(n,"/wp-config.php"),i=await e.readFileAsText(s),o=await rewriteDefineCalls(e,i,t);await e.writeFile(s,o);break}default:throw new Error(`Invalid method: ${r}`)}};async function defineBeforeRun(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function rewriteDefineCalls(e,t,r){await e.writeFile("/tmp/code.php",t);const n=phpVars({consts:r});return await e.run({code:`${rewriteWpConfigToDefineConstants}
405
+ `,Gt=async(e,{consts:t,method:r="define-before-run"})=>{switch(r){case"define-before-run":await so(e,t);break;case"rewrite-wp-config":{const n=await e.documentRoot,s=ue(n,"/wp-config.php"),i=await e.readFileAsText(s),c=await io(e,i,t);await e.writeFile(s,c);break}default:throw new Error(`Invalid method: ${r}`)}};async function so(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function io(e,t,r){await e.writeFile("/tmp/code.php",t);const n=wr({consts:r});return await e.run({code:`${no}
406
406
  $wp_config_path = '/tmp/code.php';
407
407
  $wp_config = file_get_contents($wp_config_path);
408
408
  $new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});
409
409
  file_put_contents($wp_config_path, $new_wp_config);
410
- `}),await e.readFileAsText("/tmp/code.php")}const login=async(e,{username:t="admin",password:r="password"}={},n)=>{var i,o,l;n==null||n.tracker.setCaption((n==null?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const s=await e.request({url:"/wp-login.php",method:"POST",body:{log:t,pwd:r,rememberme:"forever"}});if(!((l=(o=(i=s.headers)==null?void 0:i.location)==null?void 0:o[0])!=null&&l.includes("/wp-admin/")))throw logger.warn("WordPress response was",{response:s,text:s.text}),new Error(`Failed to log in as ${t} with password ${r}`)},setSiteOptions=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({code:`<?php
411
- include ${phpVar(r)} . '/wp-load.php';
412
- $site_options = ${phpVar(t)};
410
+ `}),await e.readFileAsText("/tmp/code.php")}const hr=async(e,{username:t="admin",password:r="password"}={},n)=>{var i,c,l;n==null||n.tracker.setCaption((n==null?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const s=await e.request({url:"/wp-login.php",method:"POST",body:{log:t,pwd:r,rememberme:"forever"}});if(!((l=(c=(i=s.headers)==null?void 0:i.location)==null?void 0:c[0])!=null&&l.includes("/wp-admin/")))throw $e.warn("WordPress response was",{response:s,text:s.text}),new Error(`Failed to log in as ${t} with password ${r}`)},Jr=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({code:`<?php
411
+ include ${pe(r)} . '/wp-load.php';
412
+ $site_options = ${pe(t)};
413
413
  foreach($site_options as $name => $value) {
414
414
  update_option($name, $value);
415
415
  }
416
416
  echo "Success";
417
- `})},updateUserMeta=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({code:`<?php
418
- include ${phpVar(n)} . '/wp-load.php';
419
- $meta = ${phpVar(t)};
417
+ `})},Cs=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({code:`<?php
418
+ include ${pe(n)} . '/wp-load.php';
419
+ $meta = ${pe(t)};
420
420
  foreach($meta as $name => $value) {
421
- update_user_meta(${phpVar(r)}, $name, $value);
421
+ update_user_meta(${pe(r)}, $name, $value);
422
422
  }
423
- `})};function isURLScoped(e){return e.pathname.startsWith("/scope:")}function getURLScope(e){return isURLScoped(e)?e.pathname.split("/")[1].split(":")[1]:null}const enableMultisite=async e=>{var N;await defineWpConfigConsts(e,{consts:{WP_ALLOW_MULTISITE:1}});const t=new URL(await e.absoluteUrl);if(t.port!==""){let C=`The current host is ${t.host}, but WordPress multisites do not support custom ports.`;throw t.hostname==="localhost"&&(C+=" For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."),new Error(C)}const r=t.pathname.replace(/\/$/,"")+"/",n=`${t.protocol}//${t.hostname}${r}`;await setSiteOptions(e,{options:{siteurl:n,home:n}}),await login(e,{});const s=await e.documentRoot,o=(await e.run({code:`<?php
423
+ `})};function Is(e){return e.pathname.startsWith("/scope:")}function oo(e){return Is(e)?e.pathname.split("/")[1].split(":")[1]:null}const js=async e=>{var N;await Gt(e,{consts:{WP_ALLOW_MULTISITE:1}});const t=new URL(await e.absoluteUrl);if(t.port!==""){let O=`The current host is ${t.host}, but WordPress multisites do not support custom ports.`;throw t.hostname==="localhost"&&(O+=" For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."),new Error(O)}const r=t.pathname.replace(/\/$/,"")+"/",n=`${t.protocol}//${t.hostname}${r}`;await Jr(e,{options:{siteurl:n,home:n}}),await hr(e,{});const s=await e.documentRoot,c=(await e.run({code:`<?php
424
424
  define( 'WP_ADMIN', true );
425
- require_once(${phpVar(s)} . "/wp-load.php");
425
+ require_once(${pe(s)} . "/wp-load.php");
426
426
 
427
427
  // Set current user to admin
428
428
  ( get_users(array('role' => 'Administrator') )[0] );
429
429
 
430
- require_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");
431
- $plugins_root = ${phpVar(s)} . "/wp-content/plugins";
430
+ require_once(${pe(s)} . "/wp-admin/includes/plugin.php");
431
+ $plugins_root = ${pe(s)} . "/wp-content/plugins";
432
432
  $plugins = glob($plugins_root . "/*");
433
433
 
434
434
  $deactivated_plugins = [];
@@ -452,9 +452,9 @@ foreach($plugins as $plugin_path) {
452
452
  }
453
453
  }
454
454
  echo json_encode($deactivated_plugins);
455
- `})).json,d=(N=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:N[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 logger.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:{MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:t.hostname,PATH_CURRENT_SITE:r}});const f=new URL(await e.absoluteUrl),g=isURLScoped(f)?"scope:"+getURLScope(f):null;await e.writeFile("/internal/shared/preload/sunrise.php",`<?php
456
- $_SERVER['HTTP_HOST'] = ${phpVar(f.hostname)};
457
- $folder = ${phpVar(g)};
455
+ `})).json,d=(N=(await pr(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:N[1],f=await pr(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:ao({_wpnonce:d,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(f.httpStatusCode!==200)throw $e.warn("WordPress response was",{response:f,text:f.text,headers:f.headers}),new Error(`Failed to enable multisite. Response code was ${f.httpStatusCode}`);await Gt(e,{consts:{MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:t.hostname,PATH_CURRENT_SITE:r}});const p=new URL(await e.absoluteUrl),g=Is(p)?"scope:"+oo(p):null;await e.writeFile("/internal/shared/preload/sunrise.php",`<?php
456
+ $_SERVER['HTTP_HOST'] = ${pe(p.hostname)};
457
+ $folder = ${pe(g)};
458
458
  if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
459
459
  $_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
460
460
  }
@@ -462,13 +462,13 @@ echo json_encode($deactivated_plugins);
462
462
  if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
463
463
  define( 'BLOG_ID_CURRENT_SITE', 1 );
464
464
  }
465
- `),await login(e,{});for(const C of o)await activatePlugin(e,{pluginPath:C})};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
466
- require ${phpVar(n)} . '/wp-load.php';
467
- if ( ! function_exists( 'wp_crop_image' ) ) {
468
- require ${phpVar(n)} . '/wp-admin/includes/image.php';
469
- }
465
+ `),await hr(e,{});for(const O of c)await br(e,{pluginPath:O})};function ao(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const Ds=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},As=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},Ms=async(e,{path:t})=>{await e.mkdir(t)},Fs=async(e,{path:t})=>{await e.rmdir(t)},Qr=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),t.startsWith("/wordpress/wp-content/mu-plugins")&&!await e.fileExists("/wordpress/wp-content/mu-plugins")&&await e.mkdir("/wordpress/wp-content/mu-plugins"),await e.writeFile(t,r)},Zr=async(e,{siteUrl:t})=>{await Gt(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},Ls=async(e,{file:t},r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Importing content"),await Qr(e,{path:"/tmp/import.wxr",data:t});const n=await e.documentRoot;await e.run({code:`<?php
466
+ require ${pe(n)} . '/wp-load.php';
467
+ require ${pe(n)} . '/wp-admin/includes/admin.php';
468
+
470
469
  kses_remove_filters();
471
- $admin_id = get_users(array('role' => 'Administrator') )[0];
470
+ $admin_id = get_users(array('role' => 'Administrator') )[0]->ID;
471
+ wp_set_current_user( $admin_id );
472
472
  $importer = new WXR_Importer( array(
473
473
  'fetch_attachments' => true,
474
474
  'default_author' => $admin_id
@@ -482,7 +482,7 @@ echo json_encode($deactivated_plugins);
482
482
  });
483
483
 
484
484
  $result = $importer->import( '/tmp/import.wxr' );
485
- `})},tmpPath="/tmp/file.zip",unzipFile=async(e,t,r)=>{if(t instanceof File){const s=t;t=tmpPath,await e.writeFile(t,new Uint8Array(await s.arrayBuffer()))}const n=phpVars({zipPath:t,extractToPath:r});await e.run({code:`<?php
485
+ `})},Nr="/tmp/file.zip",co=async(e,t,r)=>{if(t instanceof File){const s=t;t=Nr,await e.writeFile(t,new Uint8Array(await s.arrayBuffer()))}const n=wr({zipPath:t,extractToPath:r});await e.run({code:`<?php
486
486
  function unzip($zipPath, $extractTo, $overwrite = true)
487
487
  {
488
488
  if (!is_dir($extractTo)) {
@@ -499,14 +499,28 @@ echo json_encode($deactivated_plugins);
499
499
  }
500
500
  }
501
501
  unzip(${n.zipPath}, ${n.extractToPath});
502
- `}),await e.fileExists(tmpPath)&&await e.unlink(tmpPath)},unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)logger.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(!t)throw new Error("Either zipPath or zipFile must be provided");await unzipFile(e,t||r,n)},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 f of wpContentFilesExcludedFromExport){const g=joinPaths(i,f);await removePath(e,g);const N=joinPaths(o,f);await e.fileExists(N)&&(await e.mkdir(dirname(g)),await e.mv(N,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 f of d)await removePath(e,joinPaths(n,f)),await e.mv(joinPaths(s,f),joinPaths(n,f));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
502
+ `}),await e.fileExists(Nr)&&await e.unlink(Nr)},Er=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)$e.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(!t)throw new Error("Either zipPath or zipFile must be provided");await co(e,t||r,n)},qs=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=ue("/tmp","import");await e.mkdir(s),await Er(e,{zipFile:t,extractToPath:s}),s=ue(s,r);const i=ue(s,"wp-content"),c=ue(n,"wp-content");for(const p of Gr){const g=ue(i,p);await Xn(e,g);const N=ue(c,p);await e.fileExists(N)&&(await e.mkdir(Ps(g)),await e.mv(N,g))}const l=ue(s,"wp-content","database");await e.fileExists(l)||await e.mv(ue(n,"wp-content","database"),l);const d=await e.listFiles(s);for(const p of d)await Xn(e,ue(n,p)),await e.mv(ue(s,p),ue(n,p));await e.rmdir(s),await Zr(e,{siteUrl:await e.absoluteUrl});const f=pe(ue(n,"wp-admin","upgrade.php"));await e.run({code:`<?php
503
503
  $_GET['step'] = 'upgrade_db';
504
- require ${u};
505
- `})};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,ifAlreadyInstalled:n="overwrite"}){const i=r.name.replace(/\.zip$/,""),o=joinPaths(await e.documentRoot,"wp-content"),l=joinPaths(o,randomString()),d=joinPaths(l,"assets",i);await e.fileExists(d)&&await e.rmdir(l,{recursive:!0}),await e.mkdir(l);try{await unzip(e,{zipFile:r,extractToPath:d});let u=await e.listFiles(d,{prependPath:!0});u=u.filter(S=>!S.endsWith("/__MACOSX"));const f=u.length===1&&await e.isDir(u[0]);let g,N="";f?(N=u[0],g=u[0].split("/").pop()):(N=d,g=i);const C=`${t}/${g}`;if(await e.fileExists(C)){if(!await e.isDir(C))throw new Error(`Cannot install asset ${g} to ${C} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`);if(n==="overwrite")await e.rmdir(C,{recursive:!0});else{if(n==="skip")return{assetFolderPath:C,assetFolderName:g};throw new Error(`Cannot install asset ${g} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`)}}return await e.mv(N,C),{assetFolderPath:C,assetFolderName:g}}finally{await e.rmdir(l,{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,ifAlreadyInstalled:r,options:n={}},s)=>{const i=t.name.split("/").pop()||"plugin.zip",o=zipNameToHumanName(i);s==null||s.tracker.setCaption(`Installing the ${o} plugin`);const{assetFolderPath:l}=await installAsset(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in n?n.activate:!0)&&await activatePlugin(e,{pluginPath:l,pluginName:o},s)},installTheme=async(e,{themeZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=zipNameToHumanName(t.name);s==null||s.tracker.setCaption(`Installing the ${i} theme`);const{assetFolderName:o}=await installAsset(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in n?n.activate:!0)&&await activateTheme(e,{themeFolderName:o},s)},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(
506
- 'exclude_paths' => ${o.exceptPaths},
507
- 'zip_root' => ${o.documentRoot},
508
- 'additional_paths' => ${o.additionalPaths}
509
- ));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},zipFunctions=`<?php
504
+ require ${f};
505
+ `})};async function Xn(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function Us(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function Vs(e,{targetPath:t,zipFile:r,ifAlreadyInstalled:n="overwrite"}){const i=r.name.replace(/\.zip$/,""),c=ue(await e.documentRoot,"wp-content"),l=ue(c,Ts()),d=ue(l,"assets",i);await e.fileExists(d)&&await e.rmdir(l,{recursive:!0}),await e.mkdir(l);try{await Er(e,{zipFile:r,extractToPath:d});let f=await e.listFiles(d,{prependPath:!0});f=f.filter(S=>!S.endsWith("/__MACOSX"));const p=f.length===1&&await e.isDir(f[0]);let g,N="";p?(N=f[0],g=f[0].split("/").pop()):(N=d,g=i);const O=`${t}/${g}`;if(await e.fileExists(O)){if(!await e.isDir(O))throw new Error(`Cannot install asset ${g} to ${O} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`);if(n==="overwrite")await e.rmdir(O,{recursive:!0});else{if(n==="skip")return{assetFolderPath:O,assetFolderName:g};throw new Error(`Cannot install asset ${g} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`)}}return await e.mv(N,O),{assetFolderPath:O,assetFolderName:g}}finally{await e.rmdir(l,{recursive:!0})}}function Pr(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const zs=async(e,{pluginZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=t.name.split("/").pop()||"plugin.zip",c=Pr(i);s==null||s.tracker.setCaption(`Installing the ${c} plugin`);const{assetFolderPath:l}=await Vs(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in n?n.activate:!0)&&await br(e,{pluginPath:l,pluginName:c},s)},Ws=async(e,{themeZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=Pr(t.name);s==null||s.tracker.setCaption(`Installing the ${i} theme`);const{assetFolderName:c}=await Vs(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in n?n.activate:!0)&&await xr(e,{themeFolderName:c},s)},Bs=async(e,t,r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Resetting WordPress data");const n=await e.documentRoot;await e.run({env:{DOCROOT:n},code:`<?php
506
+ require getenv('DOCROOT') . '/wp-load.php';
507
+
508
+ $GLOBALS['@pdo']->query('DELETE FROM wp_posts WHERE id > 0');
509
+ $GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_posts'");
510
+
511
+ $GLOBALS['@pdo']->query('DELETE FROM wp_postmeta WHERE post_id > 1');
512
+ $GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=20 WHERE NAME='wp_postmeta'");
513
+
514
+ $GLOBALS['@pdo']->query('DELETE FROM wp_comments');
515
+ $GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_comments'");
516
+
517
+ $GLOBALS['@pdo']->query('DELETE FROM wp_commentmeta');
518
+ $GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_commentmeta'");
519
+ `})},Hs=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"}})},Gs=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=ue(n,"wp-content");let i=Gr;t&&(i=i.filter(d=>!d.startsWith("themes/twenty")).filter(d=>d!=="mu-plugins/sqlite-database-integration"));const c=wr({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(d=>ue(n,"wp-content",d)),additionalPaths:t?{[ue(n,"wp-config.php")]:"wp-config.php"}:{}});await uo(e,`zipDir(${c.wpContentPath}, ${c.zipPath}, array(
520
+ 'exclude_paths' => ${c.exceptPaths},
521
+ 'zip_root' => ${c.documentRoot},
522
+ 'additional_paths' => ${c.additionalPaths}
523
+ ));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},lo=`<?php
510
524
 
511
525
  function zipDir($root, $output, $options = array())
512
526
  {
@@ -565,7 +579,7 @@ function join_paths()
565
579
 
566
580
  return preg_replace('#/+#', '/', join('/', $paths));
567
581
  }
568
- `;async function runPhpWithZipFunctions(e,t){return await e.run({code:zipFunctions+t})}const wpCLI$1=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if(typeof t=="string"?(t=t.trim(),n=splitShellCommand(t)):n=t,n.shift()!=="wp")throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`<?php
582
+ `;async function uo(e,t){return await e.run({code:lo+t})}const xs=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if(typeof t=="string"?(t=t.trim(),n=fo(t)):n=t,n.shift()!=="wp")throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`<?php
569
583
  // Set up the environment to emulate a shell script
570
584
  // call.
571
585
 
@@ -578,65 +592,16 @@ function join_paths()
578
592
  $GLOBALS['argv'] = array_merge([
579
593
  "/tmp/wp-cli.phar",
580
594
  "--path=/wordpress"
581
- ], ${phpVar(n)});
595
+ ], ${pe(n)});
582
596
 
583
597
  // Provide stdin, stdout, stderr streams outside of
584
598
  // the CLI SAPI.
585
599
  define('STDIN', fopen('php://stdin', 'rb'));
586
600
  define('STDOUT', fopen('php://stdout', 'wb'));
587
- define('STDERR', fopen('/tmp/stderr', 'wb'));
588
-
589
- require( ${phpVar(r)} );
590
- `);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,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){logger.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 responseTexts={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class PHPResponse{constructor(t,r,n,s="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,this.errors=s}static forHttpCode(t,r=""){return new PHPResponse(t,{},new TextEncoder().encode(r||responseTexts[t]||""))}static fromRawData(t){return new PHPResponse(t.httpStatusCode,t.headers,t.bytes,t.errors,t.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return new TextDecoder().decode(this.bytes)}}const FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(r,n,s){const 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],f=typeof o[0]=="string"?o[0]:null,g=f!==null?e.replaceAll("{path}",f):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"})();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+=`
591
-
592
- This stack trace is lacking. For a better one initialize
593
- the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
594
-
595
- `),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const n of functionsMaybeMissingFromAsyncify)r+=` * ${n}
596
- `;return r}return e.message}const UNREACHABLE_ERROR=`
597
- "unreachable" WASM instruction executed.
598
-
599
- The typical reason is a PHP function missing from the ASYNCIFY_ONLY
600
- list when building PHP.wasm.
601
-
602
- You will need to file a new issue in the WordPress Playground repository
603
- and paste this error message there:
604
-
605
- https://github.com/WordPress/wordpress-playground/issues/new
606
-
607
- If you're a core developer, the typical fix is to:
608
-
609
- * Isolate a minimal reproduction of the error
610
- * Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
611
- * Run 'npm run fix-asyncify'
612
- * Commit the changes, push to the repo, release updated NPM packages
613
-
614
- Below is a list of all the PHP functions found in the stack trace to
615
- help with the minimal reproduction. If they're all already listed in
616
- the Dockerfile, you'll need to trigger this error again with long stack
617
- traces enabled. In node.js, you can do it using the --stack-trace-limit=100
618
- CLI option:
619
-
620
- `,redBg="\x1B[41m",bold="\x1B[1m",reset="\x1B[0m",eol="\x1B[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,!(e!=null&&e.trim().startsWith("Program terminated with exit")))){logger.log(`${redBg}
621
- ${eol}
622
- ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
623
- `))logger.log(`${eol} ${t} `);logger.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split(`
624
- `).slice(1).map(r=>{const n=r.trim().substring(3).split(" ");return{fn:n.length>=2?n[0]:"<unknown>",isWasm:r.includes("wasm://")}}).filter(({fn:r,isWasm:n})=>n&&!r.startsWith("dynCall_")&&!r.startsWith("invoke_")).map(({fn:r})=>r);return Array.from(new Set(t))}catch{return[]}}var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,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");class PHPExecutionFailureError extends Error{constructor(t,r,n){super(t),this.response=r,this.source=n}}const PHP_INI_PATH="/internal/shared/php.ini",AUTO_PREPEND_SCRIPT="/internal/shared/auto_prepend_file.php";var Ue,Ee,Pe,we,xe,nt,Ot,st,It,it,jt,ot,Dt,at,At,ct,Ft,lt,Mt,dt,qt,ut,Lt,pt,Ut,Ye,$t,ft,xt,ht,Vt,mt,zt;class BasePHP{constructor(e){ie(this,nt);ie(this,st);ie(this,it);ie(this,ot);ie(this,at);ie(this,ct);ie(this,lt);ie(this,dt);ie(this,ut);ie(this,pt);ie(this,Ye);ie(this,ft);ie(this,ht);ie(this,mt);ie(this,Ue,void 0);ie(this,Ee,void 0);ie(this,Pe,void 0);ie(this,we,void 0);ie(this,xe,void 0);ye(this,Ee,!1),ye(this,Pe,null),ye(this,we,new Map),ye(this,xe,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e)}addEventListener(e,t){ce(this,we).has(e)||ce(this,we).set(e,new Set),ce(this,we).get(e).add(t)}removeEventListener(e,t){var r;(r=ce(this,we).get(e))==null||r.delete(t)}dispatchEvent(e){const t=ce(this,we).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){ce(this,xe).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.internalUrlToPath(e)}initializeRuntime(e){if(this[__private__dont__use])throw new Error("PHP runtime already initialized.");const t=getLoadedRuntime(e);if(!t)throw new Error("Invalid PHP runtime id.");this[__private__dont__use]=t,this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[PHP_INI_PATH]),this.fileExists(PHP_INI_PATH)||this.writeFile(PHP_INI_PATH,["auto_prepend_file="+AUTO_PREPEND_SCRIPT,"memory_limit=256M","ignore_repeated_errors = 1","error_reporting = E_ALL","display_errors = 1","html_errors = 1","display_startup_errors = On","log_errors = 1","always_populate_raw_post_data = -1","upload_max_filesize = 2000M","post_max_size = 2000M","disable_functions = curl_exec,curl_multi_exec","allow_url_fopen = Off","allow_url_include = Off","session.save_path = /home/web_user","implicit_flush = 1","output_buffering = 0","max_execution_time = 0","max_input_time = -1"].join(`
625
- `)),this.fileExists(AUTO_PREPEND_SCRIPT)||this.writeFile(AUTO_PREPEND_SCRIPT,`<?php
626
- // Define constants set via defineConstant() calls
627
- if(file_exists('/internal/shared/consts.json')) {
628
- $consts = json_decode(file_get_contents('/internal/shared/consts.json'), true);
629
- foreach ($consts as $const => $value) {
630
- if (!defined($const) && is_scalar($value)) {
631
- define($const, $value);
632
- }
633
- }
634
- }
635
- // Preload all the files from /internal/shared/preload
636
- foreach (glob('/internal/shared/preload/*.php') as $file) {
637
- require_once $file;
638
- }
639
- `),t.onMessage=async r=>{for(const n of ce(this,xe)){const s=await n(r);if(s)return s}return""},ye(this,Pe,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?");ye(this,Ue,e)}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e){if(logger.warn("PHP.request() is deprecated. Please use new PHPRequestHandler() instead."),!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e)}async run(e){const t=await this.semaphore.acquire();let r;try{if(ce(this,Ee)||(oe(this,st,It).call(this),ye(this,Ee,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);oe(this,ot,Dt).call(this,e.relativeUri||""),oe(this,dt,qt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443",i=oe(this,lt,Mt).call(this,s,e.protocol||"http");oe(this,at,At).call(this,s),oe(this,ct,Ft).call(this,i),oe(this,ut,Lt).call(this,n),e.body&&(r=oe(this,pt,Ut).call(this,e.body)),typeof e.code=="string"?(this.writeFile("/internal/eval.php",e.code),oe(this,Ye,$t).call(this,"/internal/eval.php")):oe(this,Ye,$t).call(this,e.scriptPath||"");const o=oe(this,nt,Ot).call(this,e.$_SERVER,n,i);for(const u in o)oe(this,ft,xt).call(this,u,o[u]);const l=e.env||{};for(const u in l)oe(this,ht,Vt).call(this,u,l[u]);const d=await oe(this,mt,zt).call(this);if(d.exitCode!==0){logger.warn("PHP.run() output was:",d.text);const u=new PHPExecutionFailureError(`PHP.run() failed with exit code ${d.exitCode} and the following output: `+d.errors,d,"request");throw logger.error(u),u}return d}catch(n){throw this.dispatchEvent({type:"request.error",error:n,source:n.source??"php-wasm"}),n}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/shared/consts.json")&&this.readFileAsText("/internal/shared/consts.json")||"{}")}catch{}this.writeFile("/internal/shared/consts.json",JSON.stringify({...r,[e]:t}))}mkdir(e){this[__private__dont__use].FS.mkdirTree(e)}mkdirTree(e){this.mkdir(e)}readFileAsText(e){return new TextDecoder().decode(this.readFileAsBuffer(e))}readFileAsBuffer(e){return this[__private__dont__use].FS.readFile(e)}writeFile(e,t){this[__private__dont__use].FS.writeFile(e,t)}unlink(e){this[__private__dont__use].FS.unlink(e)}mv(e,t){const r=this[__private__dont__use].FS;try{const n=r.lookupPath(e).node.mount,s=this.fileExists(t)?r.lookupPath(t).node.mount:r.lookupPath(dirname(t)).node.mount;n.mountpoint!==s.mountpoint?(copyRecursive(r,e,t),this.rmdir(e,{recursive:!0})):r.rename(e,t)}catch(n){const s=getEmscriptenFsError(n);throw s?new Error(`Could not move ${e} to ${t}: ${s}`,{cause:n}):n}}rmdir(e,t={recursive:!0}){t!=null&&t.recursive&&this.listFiles(e).forEach(r=>{const n=`${e}/${r}`;this.isDir(n)?this.rmdir(n,t):this.unlink(n)}),this[__private__dont__use].FS.rmdir(e)}listFiles(e,t={prependPath:!1}){if(!this.fileExists(e))return[];try{const r=this[__private__dont__use].FS.readdir(e).filter(n=>n!=="."&&n!=="..");if(t.prependPath){const n=e.replace(/\/$/,"");return r.map(s=>`${n}/${s}`)}return r}catch(r){return logger.error(r,{path:e}),[]}}isDir(e){return this.fileExists(e)?this[__private__dont__use].FS.isDir(this[__private__dont__use].FS.lookupPath(e).node.mode):!1}fileExists(e){try{return this[__private__dont__use].FS.lookupPath(e),!0}catch{return!1}}hotSwapPHPRuntime(e,t){const r=this[__private__dont__use].FS;try{this.exit()}catch{}this.initializeRuntime(e),ce(this,Ue)&&this.setSapiName(ce(this,Ue)),t&&copyFS(r,this[__private__dont__use].FS,t)}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}ye(this,Ee,!1),ye(this,Pe,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}[Symbol.dispose](){ce(this,Ee)&&this.exit(0)}}Ue=new WeakMap,Ee=new WeakMap,Pe=new WeakMap,we=new WeakMap,xe=new WeakMap,nt=new WeakSet,Ot=function(e,t,r){const n={...e||{}};n.HTTPS=n.HTTPS||r===443?"on":"off";for(const s in t){let i="HTTP_";["content-type","content-length"].includes(s.toLowerCase())&&(i=""),n[`${i}${s.toUpperCase().replace(/-/g,"_")}`]=t[s]}return n},st=new WeakSet,It=function(){this[__private__dont__use].ccall("php_wasm_init",null,[],[])},it=new WeakSet,jt=function(){const e="/internal/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const s=n.indexOf(": "),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}},ot=new WeakSet,Dt=function(e){if(this[__private__dont__use].ccall("wasm_set_request_uri",null,[STRING],[e]),e.includes("?")){const t=e.substring(e.indexOf("?")+1);this[__private__dont__use].ccall("wasm_set_query_string",null,[STRING],[t])}},at=new WeakSet,At=function(e){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e])},ct=new WeakSet,Ft=function(e){this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[e])},lt=new WeakSet,Mt=function(e,t){let r;try{r=parseInt(new URL(e).port,10)}catch{}return(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),r},dt=new WeakSet,qt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},ut=new WeakSet,Lt=function(e){e.cookie&&this[__private__dont__use].ccall("wasm_set_cookies",null,[STRING],[e.cookie]),e["content-type"]&&this[__private__dont__use].ccall("wasm_set_content_type",null,[STRING],[e["content-type"]]),e["content-length"]&&this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[parseInt(e["content-length"],10)])},pt=new WeakSet,Ut=function(e){let t,r;typeof e=="string"?(logger.warn("Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"),r=this[__private__dont__use].lengthBytesUTF8(e),t=r+1):(r=e.byteLength,t=e.byteLength);const n=this[__private__dont__use].malloc(t);if(!n)throw new Error("Could not allocate memory for the request body.");return typeof e=="string"?this[__private__dont__use].stringToUTF8(e,n,t+1):this[__private__dont__use].HEAPU8.set(e,n),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[n]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[r]),n},Ye=new WeakSet,$t=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},ft=new WeakSet,xt=function(e,t){this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,t])},ht=new WeakSet,Vt=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},mt=new WeakSet,zt=async function(){var s;let e,t;try{e=await new Promise((i,o)=>{var d;t=u=>{logger.error(u),logger.error(u.error);const f=new Error("Rethrown");f.cause=u.error,f.betterMessage=u.message,o(f)},(d=ce(this,Pe))==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,logger.error(d),d}finally{(s=ce(this,Pe))==null||s.removeEventListener("error",t)}const{headers:r,httpStatusCode:n}=oe(this,it,jt).call(this);return new PHPResponse(e===0?n:500,r,this.readFileAsBuffer("/internal/stdout"),this.readFileAsText("/internal/stderr"),e)};__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdir",1);__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdirTree",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsText",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsBuffer",1);__decorateClass([rethrowFileSystemError('Could not write to "{path}"')],BasePHP.prototype,"writeFile",1);__decorateClass([rethrowFileSystemError('Could not unlink "{path}"')],BasePHP.prototype,"unlink",1);__decorateClass([rethrowFileSystemError('Could not remove directory "{path}"')],BasePHP.prototype,"rmdir",1);__decorateClass([rethrowFileSystemError('Could not list files in "{path}"')],BasePHP.prototype,"listFiles",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"isDir",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"fileExists",1);function normalizeHeaders(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}function copyFS(e,t,r){let n;try{n=e.lookupPath(r)}catch{return}if(!("contents"in n.node))return;if(!e.isDir(n.node.mode)){t.writeFile(r,e.readFile(r));return}t.mkdirTree(r);const s=e.readdir(r).filter(i=>i!=="."&&i!=="..");for(const i of s)copyFS(e,t,joinPaths(r,i))}function copyRecursive(e,t,r){const n=e.lookupPath(t).node;if(e.isDir(n.mode)){e.mkdirTree(r);const s=e.readdir(t).filter(i=>i!=="."&&i!=="..");for(const i of s)copyRecursive(e,joinPaths(t,i),joinPaths(r,i))}else e.writeFile(r,e.readFile(t))}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);const 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:[]},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 r,n;(r=this.progress)==null||r.setCaption(this.caption);const t=this.getURL();try{let s=await fetch(t);if(!s.ok)throw new Error(`Could not download "${t}"`);if(s=await cloneResponseMonitorProgress(s,((n=this.progress)==null?void 0:n.loadingListener)??noop),s.status!==200)throw new Error(`Could not download "${t}"`);return new File([await s.blob()],this.name)}catch(s){throw new Error(`Could not download "${t}".
601
+ define('STDERR', fopen('php://stderr', 'wb'));
602
+
603
+ require( ${pe(r)} );
604
+ `);const i=await e.run({scriptPath:"/wordpress/run-cli.php"});if(i.errors)throw new Error(i.errors);return i};function fo(e){let n=0,s="";const i=[];let c="";for(let l=0;l<e.length;l++){const d=e[l];n===0?d==='"'||d==="'"?(n=1,s=d):d.match(/\s/)?(c&&i.push(c),c=""):c+=d:n===1&&(d==="\\"?(l++,c+=e[l]):d===s?(n=0,s=""):c+=d)}return c&&i.push(c),i}const po=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin:br,activateTheme:xr,cp:Ds,defineSiteUrl:Zr,defineWpConfigConsts:Gt,enableMultisite:js,exportWXR:Us,importWordPressFiles:qs,importWxr:Ls,installPlugin:zs,installTheme:Ws,login:hr,mkdir:Ms,mv:As,request:pr,resetData:Bs,rm:Kr,rmdir:Fs,runPHP:ks,runPHPWithOptions:Os,runSql:Ns,runWpInstallationWizard:Hs,setSiteOptions:Jr,unzip:Er,updateUserMeta:Cs,wpCLI:xs,writeFile:Qr,zipWpContent:Gs},Symbol.toStringTag,{value:"Module"})),ho=5*1024*1024;function mo(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||ho;function s(i,c){t(new CustomEvent("progress",{detail:{loaded:i,total:c}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const c=e.body.getReader();let l=0;for(;;)try{const{done:d,value:f}=await c.read();if(f&&(l+=f.byteLength),d){s(l,l),i.close();break}else s(l,n),i.enqueue(f)}catch(d){$e.error({e:d}),i.error(d);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const Cr=1e-5;class Yr 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<-Cr)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 Yr({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+Cr>=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+Cr>=100}get progress(){if(this._selfDone)return 100;const t=this._subTrackers.reduce((r,n)=>r+n.progress*n.weight,this._selfProgress*this._selfWeight);return Math.round(t*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=t=>{this.set(t)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=t=>{this.set(t.detail.loaded/t.detail.total*100)}),this._loadingListener}pipe(t){t.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",r=>{t.setProgress({progress:r.detail.progress,caption:r.detail.caption})}),this.addEventListener("done",()=>{t.setLoaded()})}addEventListener(t,r){super.addEventListener(t,r)}removeEventListener(t,r){super.removeEventListener(t,r)}notifyProgress(){const t=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return t.progress},get caption(){return t.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const mr={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function yo(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in mr)return mr[t]}function Ue(e=""){return function(r,n,s){const i=s.value;s.value=function(...c){try{return i.apply(this,c)}catch(l){const d=typeof l=="object"?l==null?void 0:l.errno:null;if(d in mr){const f=mr[d],p=typeof c[1]=="string"?c[1]:null,g=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${g}: ${f}`,{cause:l})}throw l}}}}var go=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Ve=(e,t,r,n)=>{for(var s=n>1?void 0:n?$o(t,r):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(s=(n?c(t,r,s):c(s))||s);return n&&s&&go(t,r,s),s};const ze=class Te{static readFileAsText(t,r){return new TextDecoder().decode(Te.readFileAsBuffer(t,r))}static readFileAsBuffer(t,r){return t.readFile(r)}static writeFile(t,r,n){t.writeFile(r,n)}static unlink(t,r){t.unlink(r)}static mv(t,r,n){try{const s=t.lookupPath(r).node.mount,i=Te.fileExists(t,n)?t.lookupPath(n).node.mount:t.lookupPath(Ps(n)).node.mount;s.mountpoint!==i.mountpoint?(Te.copyRecursive(t,r,n),Te.rmdir(t,r,{recursive:!0})):t.rename(r,n)}catch(s){const i=yo(s);throw i?new Error(`Could not move ${r} to ${n}: ${i}`,{cause:s}):s}}static rmdir(t,r,n={recursive:!0}){n!=null&&n.recursive&&Te.listFiles(t,r).forEach(s=>{const i=`${r}/${s}`;Te.isDir(t,i)?Te.rmdir(t,i,n):Te.unlink(t,i)}),t.rmdir(r)}static listFiles(t,r,n={prependPath:!1}){if(!Te.fileExists(t,r))return[];try{const s=t.readdir(r).filter(i=>i!=="."&&i!=="..");if(n.prependPath){const i=r.replace(/\/$/,"");return s.map(c=>`${i}/${c}`)}return s}catch(s){return $e.error(s,{path:r}),[]}}static isDir(t,r){return Te.fileExists(t,r)?t.isDir(t.lookupPath(r).node.mode):!1}static fileExists(t,r){try{return t.lookupPath(r),!0}catch{return!1}}static mkdir(t,r){t.mkdirTree(r)}static copyRecursive(t,r,n){const s=t.lookupPath(r).node;if(t.isDir(s.mode)){t.mkdirTree(n);const i=t.readdir(r).filter(c=>c!=="."&&c!=="..");for(const c of i)Te.copyRecursive(t,ue(r,c),ue(n,c))}else t.writeFile(n,t.readFile(r))}};Ve([Ue('Could not read "{path}"')],ze,"readFileAsText",1);Ve([Ue('Could not read "{path}"')],ze,"readFileAsBuffer",1);Ve([Ue('Could not write to "{path}"')],ze,"writeFile",1);Ve([Ue('Could not unlink "{path}"')],ze,"unlink",1);Ve([Ue('Could not remove directory "{path}"')],ze,"rmdir",1);Ve([Ue('Could not list files in "{path}"')],ze,"listFiles",1);Ve([Ue('Could not stat "{path}"')],ze,"isDir",1);Ve([Ue('Could not stat "{path}"')],ze,"fileExists",1);Ve([Ue('Could not create directory "{path}"')],ze,"mkdir",1);Ve([Ue('Could not copy files from "{path}"')],ze,"copyRecursive",1);(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 _o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);const Ks=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],wo=Ks[0],Js=["iconv","mbstring","xml-bundle","gd"],es={"kitchen-sink":Js,light:[]},bo=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function Eo(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&bo.includes(e.resource)}class ut{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new Po(t,n);break;case"literal":s=new So(t,n);break;case"wordpress.org/themes":s=new ko(t,n);break;case"wordpress.org/plugins":s=new Oo(t,n);break;case"url":s=new Ro(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new No(s),r&&(s=new Co(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class Po extends ut{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 So extends ut{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 Xr extends ut{constructor(t){super(),this.progress=t}async resolve(){var r,n;(r=this.progress)==null||r.setCaption(this.caption);const t=this.getURL();try{let s=await fetch(t);if(!s.ok)throw new Error(`Could not download "${t}"`);if(s=await mo(s,((n=this.progress)==null?void 0:n.loadingListener)??To),s.status!==200)throw new Error(`Could not download "${t}"`);return new File([await s.blob()],this.name)}catch(s){throw new Error(`Could not download "${t}".
640
605
  Check if the URL is correct and the server is reachable.
641
606
  If it is reachable, the server might be blocking the request.
642
607
  Check the browser console and network tabs for more information.
@@ -660,17 +625,17 @@ ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
660
625
  https://raw.githubusercontent.com/username/repository/branch/filename
661
626
 
662
627
  Error:
663
- ${s}`)}}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const noop=()=>{};class UrlResource extends FetchResource{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class CoreThemeResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${toDirectoryZipName(this.resource.slug)}`}}class CorePluginResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${toDirectoryZipName(this.resource.slug)}`}}function toDirectoryZipName(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class DecoratedResource extends Resource{constructor(t){super(),this.resource=t}async resolve(){return this.resource.resolve()}async setPlayground(t){return this.resource.setPlayground(t)}get progress(){return this.resource.progress}set progress(t){this.resource.progress=t}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class CachedResource extends DecoratedResource{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class SemaphoreResource extends DecoratedResource{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var ajv$1={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor($){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((b,I)=>`${b}${I}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((b,I)=>(I instanceof r&&(b[I.str]=(b[I.str]||0)+1),b),{})}}e._Code=n,e.nil=new n("");function s(_,...$){const b=[_[0]];let I=0;for(;I<$.length;)l(b,$[I]),b.push(_[++I]);return new n(b)}e._=s;const i=new n("+");function o(_,...$){const b=[C(_[0])];let I=0;for(;I<$.length;)b.push(i),l(b,$[I]),b.push(i,C(_[++I]));return d(b),new n(b)}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 b=u(_[$-1],_[$+1]);if(b!==void 0){_.splice($-1,3,b);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 f(_,$){return $.emptyStr()?_:_.emptyStr()?$:o`${_}${$}`}e.strConcat=f;function g(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:C(Array.isArray(_)?_.join(","):_)}function N(_){return new n(C(_))}e.stringify=N;function C(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=C;function S(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=S;function R(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=R;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:f}={}){this._names={},this._prefixes=u,this._parent=f}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const f=this._names[u]||this._nameGroup(u);return`${u}${f.index++}`}_nameGroup(u){var f,g;if(!((g=(f=this._parent)===null||f===void 0?void 0:f._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,f){super(f),this.prefix=u}setValue(u,{property:f,itemIndex:g}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(f)}[${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,f){var g;if(f.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const N=this.toName(u),{prefix:C}=N,S=(g=f.key)!==null&&g!==void 0?g:f.ref;let R=this._values[C];if(R){const $=R.get(S);if($)return $}else R=this._values[C]=new Map;R.set(S,N);const y=this._scope[C]||(this._scope[C]=[]),_=y.length;return y[_]=f.ref,N.setValue(f,{property:C,itemIndex:_}),N}getValue(u,f){const g=this._values[u];if(g)return g.get(f)}scopeRefs(u,f=this._values){return this._reduceValues(f,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,f,g){return this._reduceValues(u,N=>{if(N.value===void 0)throw new Error(`CodeGen: name "${N}" has no value`);return N.value.code},f,g)}_reduceValues(u,f,g={},N){let C=t.nil;for(const S in u){const R=u[S];if(!R)continue;const y=g[S]=g[S]||new Map;R.forEach(_=>{if(y.has(_))return;y.set(_,n.Started);let $=f(_);if($){const b=this.opts.es5?e.varKinds.var:e.varKinds.const;C=(0,t._)`${C}${b} ${_} = ${$};${this.opts._n}`}else if($=N==null?void 0:N(_))C=(0,t._)`${C}${$}${this.opts._n}`;else throw new r(_);y.set(_,n.Completed)})}return C}}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,O){super(),this.varKind=a,this.name=h,this.rhs=O}render({es5:a,_n:h}){const O=a?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${M};`+h}optimizeNames(a,h){if(a[this.name.str])return this.rhs&&(this.rhs=ne(this.rhs,a,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(a,h,O){super(),this.lhs=a,this.rhs=h,this.sideEffects=O}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=ne(this.rhs,a,h),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return de(a,this.rhs)}}class d extends l{constructor(a,h,O,M){super(a,O,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 f 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 N 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=ne(this.code,a,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class C extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((h,O)=>h+O.render(a),"")}optimizeNodes(){const{nodes:a}=this;let h=a.length;for(;h--;){const O=a[h].optimizeNodes();Array.isArray(O)?a.splice(h,1,...O):O?a[h]=O:a.splice(h,1)}return a.length>0?this:void 0}optimizeNames(a,h){const{nodes:O}=this;let M=O.length;for(;M--;){const q=O[M];q.optimizeNames(a,h)||(Se(a,q.names),O.splice(M,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((a,h)=>G(a,h.names),{})}}class S extends C{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class R extends C{}class y extends S{}y.kind="else";class _ extends S{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 O=h.optimizeNodes();h=this.else=Array.isArray(O)?new y(O):O}if(h)return a===!1?h instanceof _?h:h.nodes:this.nodes.length?this:new _(Te(a),h instanceof _?[h]:h.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,h){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(a,h),!!(super.optimizeNames(a,h)||this.else))return this.condition=ne(this.condition,a,h),this}get names(){const a=super.names;return de(a,this.condition),this.else&&G(a,this.else.names),a}}_.kind="if";class $ extends S{}$.kind="for";class b 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=ne(this.iteration,a,h),this}get names(){return G(super.names,this.iteration.names)}}class I extends ${constructor(a,h,O,M){super(),this.varKind=a,this.name=h,this.from=O,this.to=M}render(a){const h=a.es5?r.varKinds.var:this.varKind,{name:O,from:M,to:q}=this;return`for(${h} ${O}=${M}; ${O}<${q}; ${O}++)`+super.render(a)}get names(){const a=de(super.names,this.from);return de(a,this.to)}}class A extends ${constructor(a,h,O,M){super(),this.loop=a,this.varKind=h,this.name=O,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=ne(this.iterable,a,h),this}get names(){return G(super.names,this.iterable.names)}}class w extends S{constructor(a,h,O){super(),this.name=a,this.args=h,this.async=O}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}w.kind="func";class k extends C{render(a){return"return "+super.render(a)}}k.kind="return";class D extends S{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 O,M;return super.optimizeNames(a,h),(O=this.catch)===null||O===void 0||O.optimizeNames(a,h),(M=this.finally)===null||M===void 0||M.optimizeNames(a,h),this}get names(){const a=super.names;return this.catch&&G(a,this.catch.names),this.finally&&G(a,this.finally.names),a}}class x extends S{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}x.kind="catch";class z extends S{render(a){return"finally"+super.render(a)}}z.kind="finally";class X{constructor(a,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
664
- `:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new R]}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 O=this._extScope.value(a,h);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}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,O,M){const q=this._scope.toName(h);return O!==void 0&&M&&(this._constants[q.str]=O),this._leafNode(new o(a,q,O)),q}const(a,h,O){return this._def(r.varKinds.const,a,h,O)}let(a,h,O){return this._def(r.varKinds.let,a,h,O)}var(a,h,O){return this._def(r.varKinds.var,a,h,O)}assign(a,h,O){return this._leafNode(new l(a,h,O))}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 N(a)),this}object(...a){const h=["{"];for(const[O,M]of a)h.length>1&&h.push(","),h.push(O),(O!==M||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,M));return h.push("}"),new t._Code(h)}if(a,h,O){if(this._blockNode(new _(a)),h&&O)this.code(h).else().code(O).endIf();else if(h)this.code(h).endIf();else if(O)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 b(a),h)}forRange(a,h,O,M,q=this.opts.es5?r.varKinds.var:r.varKinds.let){const H=this._scope.toName(a);return this._for(new I(q,H,h,O),()=>M(H))}forOf(a,h,O,M=r.varKinds.const){const q=this._scope.toName(a);if(this.opts.es5){const H=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${H}.length`,B=>{this.var(q,(0,t._)`${H}[${B}]`),O(q)})}return this._for(new A("of",M,q,h),()=>O(q))}forIn(a,h,O,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${h})`,O);const q=this._scope.toName(a);return this._for(new A("in",M,q,h),()=>O(q))}endFor(){return this._endBlockNode($)}label(a){return this._leafNode(new u(a))}break(a){return this._leafNode(new f(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,O){if(!h&&!O)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new D;if(this._blockNode(M),this.code(a),h){const q=this.name("e");this._currNode=M.catch=new x(q),h(q)}return O&&(this._currNode=M.finally=new z,this.code(O)),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 O=this._nodes.length-h;if(O<0||a!==void 0&&O!==a)throw new Error(`CodeGen: wrong number of nodes: ${O} vs ${a} expected`);return this._nodes.length=h,this}func(a,h=t.nil,O,M){return this._blockNode(new w(a,h,O)),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 O=this._currNode;if(O instanceof a||h&&O 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=X;function G(E,a){for(const h in a)E[h]=(E[h]||0)+(a[h]||0);return E}function de(E,a){return a instanceof t._CodeOrName?G(E,a.names):E}function ne(E,a,h){if(E instanceof t.Name)return O(E);if(!M(E))return E;return new t._Code(E._items.reduce((q,H)=>(H instanceof t.Name&&(H=O(H)),H instanceof t._Code?q.push(...H._items):q.push(H),q),[]));function O(q){const H=h[q.str];return H===void 0||a[q.str]!==1?q:(delete a[q.str],H)}function M(q){return q instanceof t._Code&&q._items.some(H=>H instanceof t.Name&&a[H.str]===1&&h[H.str]!==void 0)}}function Se(E,a){for(const h in a)E[h]=(E[h]||0)-(a[h]||0)}function Te(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:(0,t._)`!${j(E)}`}e.not=Te;const Oe=v(e.operators.AND);function Ve(...E){return E.reduce(Oe)}e.and=Ve;const Ie=v(e.operators.OR);function F(...E){return E.reduce(Ie)}e.or=F;function v(E){return(a,h)=>a===t.nil?h:h===t.nil?a:(0,t._)`${j(a)} ${E} ${j(h)}`}function j(E){return E instanceof t.Name?E:(0,t._)`(${E})`}})(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 D of w)k[D]=!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:D,self:x}=w;if(!D.strictSchema||typeof k=="boolean")return;const z=x.RULES.keywords;for(const X in k)z[X]||A(w,`unknown keyword: "${X}"`)}e.checkUnknownRules=i;function o(w,k){if(typeof w=="boolean")return!w;for(const D in w)if(k[D])return!0;return!1}e.schemaHasRules=o;function l(w,k){if(typeof w=="boolean")return!w;for(const D in w)if(D!=="$ref"&&k.all[D])return!0;return!1}e.schemaHasRulesButRef=l;function d({topSchemaRef:w,schemaPath:k},D,x,z){if(!z){if(typeof D=="number"||typeof D=="boolean")return D;if(typeof D=="string")return(0,t._)`${D}`}return(0,t._)`${w}${k}${(0,t.getProperty)(x)}`}e.schemaRefOrVal=d;function u(w){return N(decodeURIComponent(w))}e.unescapeFragment=u;function f(w){return encodeURIComponent(g(w))}e.escapeFragment=f;function g(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=g;function N(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=N;function C(w,k){if(Array.isArray(w))for(const D of w)k(D);else k(w)}e.eachItem=C;function S({mergeNames:w,mergeToName:k,mergeValues:D,resultToName:x}){return(z,X,G,de)=>{const ne=G===void 0?X:G instanceof t.Name?(X instanceof t.Name?w(z,X,G):k(z,X,G),G):X instanceof t.Name?(k(z,G,X),X):D(X,G);return de===t.Name&&!(ne instanceof t.Name)?x(z,ne):ne}}e.mergeEvaluated={props:S({mergeNames:(w,k,D)=>w.if((0,t._)`${D} !== true && ${k} !== undefined`,()=>{w.if((0,t._)`${k} === true`,()=>w.assign(D,!0),()=>w.assign(D,(0,t._)`${D} || {}`).code((0,t._)`Object.assign(${D}, ${k})`))}),mergeToName:(w,k,D)=>w.if((0,t._)`${D} !== true`,()=>{k===!0?w.assign(D,!0):(w.assign(D,(0,t._)`${D} || {}`),y(w,D,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:R}),items:S({mergeNames:(w,k,D)=>w.if((0,t._)`${D} !== true && ${k} !== undefined`,()=>w.assign(D,(0,t._)`${k} === true ? true : ${D} > ${k} ? ${D} : ${k}`)),mergeToName:(w,k,D)=>w.if((0,t._)`${D} !== true`,()=>w.assign(D,k===!0?!0:(0,t._)`${D} > ${k} ? ${D} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function R(w,k){if(k===!0)return w.var("props",!0);const D=w.var("props",(0,t._)`{}`);return k!==void 0&&y(w,D,k),D}e.evaluatedPropsToName=R;function y(w,k,D){Object.keys(D).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 b;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(b=e.Type||(e.Type={}));function I(w,k,D){if(w instanceof t.Name){const x=k===b.Num;return D?x?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:x?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,t.getProperty)(w).toString():"/"+g(w)}e.getErrorPath=I;function A(w,k,D=w.opts.strictSchema){if(D){if(k=`strict mode: ${k}`,D===!0)throw new Error(k);w.self.logger.warn(k)}}e.checkStrictMode=A})(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,$,b){const{it:I}=y,{gen:A,compositeRule:w,allErrors:k}=I,D=g(y,_,$);b??(w||k)?d(A,D):u(I,(0,t._)`[${D}]`)}e.reportError=s;function i(y,_=e.keywordError,$){const{it:b}=y,{gen:I,compositeRule:A,allErrors:w}=b,k=g(y,_,$);d(I,k),A||w||u(b,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:b,errsCount:I,it:A}){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,A.errorPath))),y.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${_}`),A.opts.verbose&&(y.assign((0,t._)`${w}.schema`,$),y.assign((0,t._)`${w}.data`,b))})}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:b,schemaEnv:I}=y;I.$async?$.throw((0,t._)`new ${y.ValidationError}(${_})`):($.assign((0,t._)`${b}.errors`,_),$.return(!1))}const f={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function g(y,_,$){const{createErrors:b}=y.it;return b===!1?(0,t._)`{}`:N(y,_,$)}function N(y,_,$={}){const{gen:b,it:I}=y,A=[C(I,$),S(y,$)];return R(y,_,A),b.object(...A)}function C({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 S({keyword:y,it:{errSchemaPath:_}},{schemaPath:$,parentSchema:b}){let I=b?_:(0,t.str)`${_}/${y}`;return $&&(I=(0,t.str)`${I}${(0,r.getErrorPath)($,r.Type.Str)}`),[f.schemaPath,I]}function R(y,{params:_,message:$},b){const{keyword:I,data:A,schemaValue:w,it:k}=y,{opts:D,propertyName:x,topSchemaRef:z,schemaPath:X}=k;b.push([f.keyword,I],[f.params,typeof _=="function"?_(y):_||(0,t._)`{}`]),D.messages&&b.push([f.message,typeof $=="function"?$(y):$]),D.verbose&&b.push([f.schema,w],[f.parentSchema,(0,t._)`${z}${X}`],[n.default.data,A]),x&&b.push([f.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(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(o=e.DataType||(e.DataType={}));function l(b){const I=d(b.type);if(I.includes("null")){if(b.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&b.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');b.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=l;function d(b){const I=Array.isArray(b)?b:b?[b]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=d;function u(b,I){const{gen:A,data:w,opts:k}=b,D=g(I,k.coerceTypes),x=I.length>0&&!(D.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(b,I[0]));if(x){const z=R(I,w,k.strictNumbers,o.Wrong);A.if(z,()=>{D.length?N(b,I,D):_(b)})}return x}e.coerceAndCheckDataType=u;const f=new Set(["string","number","integer","boolean","null"]);function g(b,I){return I?b.filter(A=>f.has(A)||I==="array"&&A==="array"):[]}function N(b,I,A){const{gen:w,data:k,opts:D}=b,x=w.let("dataType",(0,s._)`typeof ${k}`),z=w.let("coerced",(0,s._)`undefined`);D.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(R(I,k,D.strictNumbers),()=>w.assign(z,k))),w.if((0,s._)`${z} !== undefined`);for(const G of A)(f.has(G)||G==="array"&&D.coerceTypes==="array")&&X(G);w.else(),_(b),w.endIf(),w.if((0,s._)`${z} !== undefined`,()=>{w.assign(k,z),C(b,z)});function X(G){switch(G){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
665
- || (${x} == "string" && ${k} && ${k} == +${k})`).assign(z,(0,s._)`+${k}`);return;case"integer":w.elseIf((0,s._)`${x} === "boolean" || ${k} === null
666
- || (${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"
667
- || ${x} === "boolean" || ${k} === null`).assign(z,(0,s._)`[${k}]`)}}}function C({gen:b,parentData:I,parentDataProperty:A},w){b.if((0,s._)`${I} !== undefined`,()=>b.assign((0,s._)`${I}[${A}]`,w))}function S(b,I,A,w=o.Correct){const k=w===o.Correct?s.operators.EQ:s.operators.NEQ;let D;switch(b){case"null":return(0,s._)`${I} ${k} null`;case"array":D=(0,s._)`Array.isArray(${I})`;break;case"object":D=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":D=x((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":D=x();break;default:return(0,s._)`typeof ${I} ${k} ${b}`}return w===o.Correct?D:(0,s.not)(D);function x(z=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,z,A?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=S;function R(b,I,A,w){if(b.length===1)return S(b[0],I,A,w);let k;const D=(0,i.toHash)(b);if(D.array&&D.object){const x=(0,s._)`typeof ${I} != "object"`;k=D.null?x:(0,s._)`!${I} || ${x}`,delete D.null,delete D.array,delete D.object}else k=s.nil;D.number&&delete D.integer;for(const x in D)k=(0,s.and)(k,S(x,I,A,w));return k}e.checkDataTypes=R;const y={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:I})=>typeof b=="string"?(0,s._)`{type: ${b}}`:(0,s._)`{type: ${I}}`};function _(b){const I=$(b);(0,n.reportError)(I,y)}e.reportTypeError=_;function $(b){const{gen:I,data:A,schema:w}=b,k=(0,i.schemaRefOrVal)(b,w,"type");return{gen:I,keyword:"type",data:A,schema:w.type,schemaCode:k,schemaValue:k,parentSchema:w,params:{},it:b}}})(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 f=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 N=(0,codegen_1$q._)`${f}, ${r.object(...g)}`;return d!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${d}, ${N})`:(0,codegen_1$q._)`${l}(${N})`}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 f=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(o,(0,codegen_1$q._)`${o} || ${l}`),e.mergeValidEvaluated(f,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,f=useKeyword(n,s,u),g=n.let("valid");e.block$data(g,N),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function N(){if(t.errors===!1)R(),t.modifying&&modifyData(e),y(()=>e.error());else{const _=t.async?C():S();t.modifying&&modifyData(e),y(()=>addErrs(e,_))}}function C(){const _=n.let("ruleErrs",null);return n.try(()=>R((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 S(){const _=(0,codegen_1$p._)`${f}.errors`;return n.assign(_,null),R(codegen_1$p.nil),_}function R(_=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,b=!("compile"in t&&!l||t.schema===!1);n.assign(g,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,f,$,b)}`,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:f,opts:g}=t,N=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);d(N),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=[...f,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 f in n){var g=n[f];if(Array.isArray(g)){if(f in traverse$1.arrayKeywords)for(var N=0;N<g.length;N++)_traverse(e,t,r,g[N],s+"/"+f+"/"+N,i,s,f,n,N)}else if(f in traverse$1.propsKeywords){if(g&&typeof g=="object")for(var C in g)_traverse(e,t,r,g[C],s+"/"+f+"/"+escapeJsonPtr(C),i,s,f,n,C)}else(f in traverse$1.keywords||e.allKeys&&!(f in traverse$1.skipKeywords))&&_traverse(e,t,r,g,s+"/"+f,i,s,f,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,N,C,S)=>{if(S===void 0)return;const R=o+N;let y=i[S];typeof g[r]=="string"&&(y=_.call(this,g[r])),$.call(this,g.$anchor),$.call(this,g.$dynamicAnchor),i[N]=y;function _(b){const I=this.opts.uriResolver.resolve;if(b=normalizeId(y?I(y,b):b),d.has(b))throw f(b);d.add(b);let A=this.refs[b];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?u(g,A.schema,b):b!==normalizeId(R)&&(b[0]==="#"?(u(g,l[b],b),l[b]=g):this.refs[b]=R),b}function $(b){if(typeof b=="string"){if(!ANCHOR.test(b))throw new Error(`invalid anchor "${b}"`);_.call(this,`#${b}`)}}}),l;function u(g,N,C){if(N!==void 0&&!equal$2(g,N))throw f(C)}function f(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:f}=u;if(i.$ref&&(d.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(i,f))){s.block(()=>keywordCode(e,"$ref",f.all.$ref.definition));return}d.jtd||checkStrictTypes(e,t),s.block(()=>{for(const N of f.rules)g(N);g(f.post)});function g(N){(0,applicability_1.shouldUseGroup)(i,N)&&(N.type?(s.if((0,dataType_2.checkDataType)(N.type,o,d.strictNumbers)),iterateKeywords(e,N),t.length===1&&t[0]===N.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,N),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 f=+u[1];if(s=u[2],s==="#"){if(f>=t)throw new Error(d("property/index",f));return n[t-f]}if(f>t)throw new Error(d("data",f));if(i=r[t-f],!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,f){return`Cannot access ${u} ${f} 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 f;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);const g=o.toString();f=`${o.scopeRefs(names_1$2.default.scope)}return ${g}`,this.opts.code.process&&(f=this.opts.code.process(f,e));const C=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,f)(this,this.scope.get());if(this.scope.value(d,{ref:C}),C.errors=null,C.schema=e.schema,C.schemaEnv=e,e.$async&&(C.$async=!0),this.opts.code.source===!0&&(C.source={validateName:d,validateCode:g,scopeValues:o._values}),this.opts.unevaluated){const{props:S,items:R}=u;C.evaluated={props:S instanceof codegen_1$m.Name?void 0:S,items:R instanceof codegen_1$m.Name?void 0:R,dynamicProps:S instanceof codegen_1$m.Name,dynamicItems:R instanceof codegen_1$m.Name},C.source&&(C.source.evaluated=(0,codegen_1$m.stringify)(C.evaluated))}return e.validate=C,e}catch(g){throw delete e.validate,delete e.validateName,f&&this.logger.error("Error compiling schema, function code:",f),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 p=arguments.length,c=Array(p),m=0;m<p;m++)c[m]=arguments[m];if(c.length>1){c[0]=c[0].slice(0,-1);for(var T=c.length-1,P=1;P<T;++P)c[P]=c[P].slice(1,-1);return c[T]=c[T].slice(1),c.join("")}else return c[0]}function s(p){return"(?:"+p+")"}function i(p){return p===void 0?"undefined":p===null?"null":Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase()}function o(p){return p.toUpperCase()}function l(p){return p!=null?p instanceof Array?p:typeof p.length!="number"||p.split||p.setInterval||p.call?[p]:Array.prototype.slice.call(p):[]}function d(p,c){var m=p;if(c)for(var T in c)m[T]=c[T];return m}function u(p){var c="[A-Za-z]",m="[0-9]",T=n(m,"[A-Fa-f]"),P=s(s("%[EFef]"+T+"%"+T+T+"%"+T+T)+"|"+s("%[89A-Fa-f]"+T+"%"+T+T)+"|"+s("%"+T+T)),L="[\\:\\/\\?\\#\\[\\]\\@]",U="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",K=n(L,U),Q=p?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",te=p?"[\\uE000-\\uF8FF]":"[]",W=n(c,m,"[\\-\\.\\_\\~]",Q);s(c+n(c,m,"[\\+\\-\\.]")+"*"),s(s(P+"|"+n(W,U,"[\\:]"))+"*");var J=s(s("25[0-5]")+"|"+s("2[0-4]"+m)+"|"+s("1"+m+m)+"|"+s("0?[1-9]"+m)+"|0?0?"+m),re=s(J+"\\."+J+"\\."+J+"\\."+J),V=s(T+"{1,4}"),Z=s(s(V+"\\:"+V)+"|"+re),se=s(s(V+"\\:")+"{6}"+Z),Y=s("\\:\\:"+s(V+"\\:")+"{5}"+Z),be=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+Z),_e=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+Z),ge=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+Z),Le=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+Z),Ce=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+Z),pe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),$e=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),Ne=s([se,Y,be,_e,ge,Le,Ce,pe,$e].join("|")),ve=s(s(W+"|"+P)+"+");s("[vV]"+T+"+\\."+n(W,U,"[\\:]")+"+"),s(s(P+"|"+n(W,U))+"*");var Qe=s(P+"|"+n(W,U,"[\\:\\@]"));return s(s(P+"|"+n(W,U,"[\\@]"))+"+"),s(s(Qe+"|"+n("[\\/\\?]",te))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,m,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",W,U),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",W,U),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",W,U),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",W,U),"g"),NOT_QUERY:new RegExp(n("[^\\%]",W,U,"[\\:\\@\\/\\?]",te),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",W,U,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",W,U),"g"),UNRESERVED:new RegExp(W,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",W,K),"g"),PCT_ENCODED:new RegExp(P,"g"),IPV4ADDRESS:new RegExp("^("+re+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ne+")"+s(s("\\%25|\\%(?!"+T+"{2})")+"("+ve+")")+"?\\]?$")}}var f=u(!1),g=u(!0),N=function(){function p(c,m){var T=[],P=!0,L=!1,U=void 0;try{for(var K=c[Symbol.iterator](),Q;!(P=(Q=K.next()).done)&&(T.push(Q.value),!(m&&T.length===m));P=!0);}catch(te){L=!0,U=te}finally{try{!P&&K.return&&K.return()}finally{if(L)throw U}}return T}return function(c,m){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return p(c,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),C=function(p){if(Array.isArray(p)){for(var c=0,m=Array(p.length);c<p.length;c++)m[c]=p[c];return m}else return Array.from(p)},S=2147483647,R=36,y=1,_=26,$=38,b=700,I=72,A=128,w="-",k=/^xn--/,D=/[^\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"},X=R-y,G=Math.floor,de=String.fromCharCode;function ne(p){throw new RangeError(z[p])}function Se(p,c){for(var m=[],T=p.length;T--;)m[T]=c(p[T]);return m}function Te(p,c){var m=p.split("@"),T="";m.length>1&&(T=m[0]+"@",p=m[1]),p=p.replace(x,".");var P=p.split("."),L=Se(P,c).join(".");return T+L}function Oe(p){for(var c=[],m=0,T=p.length;m<T;){var P=p.charCodeAt(m++);if(P>=55296&&P<=56319&&m<T){var L=p.charCodeAt(m++);(L&64512)==56320?c.push(((P&1023)<<10)+(L&1023)+65536):(c.push(P),m--)}else c.push(P)}return c}var Ve=function(c){return String.fromCodePoint.apply(String,C(c))},Ie=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:R},F=function(c,m){return c+22+75*(c<26)-((m!=0)<<5)},v=function(c,m,T){var P=0;for(c=T?G(c/b):c>>1,c+=G(c/m);c>X*_>>1;P+=R)c=G(c/X);return G(P+(X+1)*c/(c+$))},j=function(c){var m=[],T=c.length,P=0,L=A,U=I,K=c.lastIndexOf(w);K<0&&(K=0);for(var Q=0;Q<K;++Q)c.charCodeAt(Q)>=128&&ne("not-basic"),m.push(c.charCodeAt(Q));for(var te=K>0?K+1:0;te<T;){for(var W=P,J=1,re=R;;re+=R){te>=T&&ne("invalid-input");var V=Ie(c.charCodeAt(te++));(V>=R||V>G((S-P)/J))&&ne("overflow"),P+=V*J;var Z=re<=U?y:re>=U+_?_:re-U;if(V<Z)break;var se=R-Z;J>G(S/se)&&ne("overflow"),J*=se}var Y=m.length+1;U=v(P-W,Y,W==0),G(P/Y)>S-L&&ne("overflow"),L+=G(P/Y),P%=Y,m.splice(P++,0,L)}return String.fromCodePoint.apply(String,m)},E=function(c){var m=[];c=Oe(c);var T=c.length,P=A,L=0,U=I,K=!0,Q=!1,te=void 0;try{for(var W=c[Symbol.iterator](),J;!(K=(J=W.next()).done);K=!0){var re=J.value;re<128&&m.push(de(re))}}catch(Ze){Q=!0,te=Ze}finally{try{!K&&W.return&&W.return()}finally{if(Q)throw te}}var V=m.length,Z=V;for(V&&m.push(w);Z<T;){var se=S,Y=!0,be=!1,_e=void 0;try{for(var ge=c[Symbol.iterator](),Le;!(Y=(Le=ge.next()).done);Y=!0){var Ce=Le.value;Ce>=P&&Ce<se&&(se=Ce)}}catch(Ze){be=!0,_e=Ze}finally{try{!Y&&ge.return&&ge.return()}finally{if(be)throw _e}}var pe=Z+1;se-P>G((S-L)/pe)&&ne("overflow"),L+=(se-P)*pe,P=se;var $e=!0,Ne=!1,ve=void 0;try{for(var Qe=c[Symbol.iterator](),Rt;!($e=(Rt=Qe.next()).done);$e=!0){var kt=Rt.value;if(kt<P&&++L>S&&ne("overflow"),kt==P){for(var et=L,tt=R;;tt+=R){var rt=tt<=U?y:tt>=U+_?_:tt-U;if(et<rt)break;var Ct=et-rt,Nt=R-rt;m.push(de(F(rt+Ct%Nt,0))),et=G(Ct/Nt)}m.push(de(F(et,0))),U=v(L,pe,Z==V),L=0,++Z}}}catch(Ze){Ne=!0,ve=Ze}finally{try{!$e&&Qe.return&&Qe.return()}finally{if(Ne)throw ve}}++L,++P}return m.join("")},a=function(c){return Te(c,function(m){return k.test(m)?j(m.slice(4).toLowerCase()):m})},h=function(c){return Te(c,function(m){return D.test(m)?"xn--"+E(m):m})},O={version:"2.1.0",ucs2:{decode:Oe,encode:Ve},decode:j,encode:E,toASCII:h,toUnicode:a},M={};function q(p){var c=p.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 H(p){for(var c="",m=0,T=p.length;m<T;){var P=parseInt(p.substr(m+1,2),16);if(P<128)c+=String.fromCharCode(P),m+=3;else if(P>=194&&P<224){if(T-m>=6){var L=parseInt(p.substr(m+4,2),16);c+=String.fromCharCode((P&31)<<6|L&63)}else c+=p.substr(m,6);m+=6}else if(P>=224){if(T-m>=9){var U=parseInt(p.substr(m+4,2),16),K=parseInt(p.substr(m+7,2),16);c+=String.fromCharCode((P&15)<<12|(U&63)<<6|K&63)}else c+=p.substr(m,9);m+=9}else c+=p.substr(m,3),m+=3}return c}function B(p,c){function m(T){var P=H(T);return P.match(c.UNRESERVED)?P:T}return p.scheme&&(p.scheme=String(p.scheme).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_SCHEME,"")),p.userinfo!==void 0&&(p.userinfo=String(p.userinfo).replace(c.PCT_ENCODED,m).replace(c.NOT_USERINFO,q).replace(c.PCT_ENCODED,o)),p.host!==void 0&&(p.host=String(p.host).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_HOST,q).replace(c.PCT_ENCODED,o)),p.path!==void 0&&(p.path=String(p.path).replace(c.PCT_ENCODED,m).replace(p.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,q).replace(c.PCT_ENCODED,o)),p.query!==void 0&&(p.query=String(p.query).replace(c.PCT_ENCODED,m).replace(c.NOT_QUERY,q).replace(c.PCT_ENCODED,o)),p.fragment!==void 0&&(p.fragment=String(p.fragment).replace(c.PCT_ENCODED,m).replace(c.NOT_FRAGMENT,q).replace(c.PCT_ENCODED,o)),p}function ee(p){return p.replace(/^0*(.*)/,"$1")||"0"}function fe(p,c){var m=p.match(c.IPV4ADDRESS)||[],T=N(m,2),P=T[1];return P?P.split(".").map(ee).join("."):p}function je(p,c){var m=p.match(c.IPV6ADDRESS)||[],T=N(m,3),P=T[1],L=T[2];if(P){for(var U=P.toLowerCase().split("::").reverse(),K=N(U,2),Q=K[0],te=K[1],W=te?te.split(":").map(ee):[],J=Q.split(":").map(ee),re=c.IPV4ADDRESS.test(J[J.length-1]),V=re?7:8,Z=J.length-V,se=Array(V),Y=0;Y<V;++Y)se[Y]=W[Y]||J[Z+Y]||"";re&&(se[V-1]=fe(se[V-1],c));var be=se.reduce(function(pe,$e,Ne){if(!$e||$e==="0"){var ve=pe[pe.length-1];ve&&ve.index+ve.length===Ne?ve.length++:pe.push({index:Ne,length:1})}return pe},[]),_e=be.sort(function(pe,$e){return $e.length-pe.length})[0],ge=void 0;if(_e&&_e.length>1){var Le=se.slice(0,_e.index),Ce=se.slice(_e.index+_e.length);ge=Le.join(":")+"::"+Ce.join(":")}else ge=se.join(":");return L&&(ge+="%"+L),ge}else return p}var ze=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,He="".match(/(){0}/)[1]===void 0;function le(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m={},T=c.iri!==!1?g:f;c.reference==="suffix"&&(p=(c.scheme?c.scheme+":":"")+"//"+p);var P=p.match(ze);if(P){He?(m.scheme=P[1],m.userinfo=P[3],m.host=P[4],m.port=parseInt(P[5],10),m.path=P[6]||"",m.query=P[7],m.fragment=P[8],isNaN(m.port)&&(m.port=P[5])):(m.scheme=P[1]||void 0,m.userinfo=p.indexOf("@")!==-1?P[3]:void 0,m.host=p.indexOf("//")!==-1?P[4]:void 0,m.port=parseInt(P[5],10),m.path=P[6]||"",m.query=p.indexOf("?")!==-1?P[7]:void 0,m.fragment=p.indexOf("#")!==-1?P[8]:void 0,isNaN(m.port)&&(m.port=p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),m.host&&(m.host=je(fe(m.host,T),T)),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 L=M[(c.scheme||m.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!L||!L.unicodeSupport)){if(m.host&&(c.domainHost||L&&L.domainHost))try{m.host=O.toASCII(m.host.replace(T.PCT_ENCODED,H).toLowerCase())}catch(U){m.error=m.error||"Host's domain name can not be converted to ASCII via punycode: "+U}B(m,f)}else B(m,T);L&&L.parse&&L.parse(m,c)}else m.error=m.error||"URI can not be parsed.";return m}function We(p,c){var m=c.iri!==!1?g:f,T=[];return p.userinfo!==void 0&&(T.push(p.userinfo),T.push("@")),p.host!==void 0&&T.push(je(fe(String(p.host),m),m).replace(m.IPV6ADDRESS,function(P,L,U){return"["+L+(U?"%25"+U:"")+"]"})),(typeof p.port=="number"||typeof p.port=="string")&&(T.push(":"),T.push(String(p.port))),T.length?T.join(""):void 0}var De=/^\.\.?\//,Ae=/^\/\.(\/|$)/,Fe=/^\/\.\.(\/|$)/,Be=/^\/?(?:.|\n)*?(?=\/|$)/;function he(p){for(var c=[];p.length;)if(p.match(De))p=p.replace(De,"");else if(p.match(Ae))p=p.replace(Ae,"/");else if(p.match(Fe))p=p.replace(Fe,"/"),c.pop();else if(p==="."||p==="..")p="";else{var m=p.match(Be);if(m){var T=m[0];p=p.slice(T.length),c.push(T)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function ae(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=c.iri?g:f,T=[],P=M[(c.scheme||p.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(p,c),p.host&&!m.IPV6ADDRESS.test(p.host)){if(c.domainHost||P&&P.domainHost)try{p.host=c.iri?O.toUnicode(p.host):O.toASCII(p.host.replace(m.PCT_ENCODED,H).toLowerCase())}catch(K){p.error=p.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+K}}B(p,m),c.reference!=="suffix"&&p.scheme&&(T.push(p.scheme),T.push(":"));var L=We(p,c);if(L!==void 0&&(c.reference!=="suffix"&&T.push("//"),T.push(L),p.path&&p.path.charAt(0)!=="/"&&T.push("/")),p.path!==void 0){var U=p.path;!c.absolutePath&&(!P||!P.absolutePath)&&(U=he(U)),L===void 0&&(U=U.replace(/^\/\//,"/%2F")),T.push(U)}return p.query!==void 0&&(T.push("?"),T.push(p.query)),p.fragment!==void 0&&(T.push("#"),T.push(p.fragment)),T.join("")}function Me(p,c){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},T=arguments[3],P={};return T||(p=le(ae(p,m),m),c=le(ae(c,m),m)),m=m||{},!m.tolerant&&c.scheme?(P.scheme=c.scheme,P.userinfo=c.userinfo,P.host=c.host,P.port=c.port,P.path=he(c.path||""),P.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(P.userinfo=c.userinfo,P.host=c.host,P.port=c.port,P.path=he(c.path||""),P.query=c.query):(c.path?(c.path.charAt(0)==="/"?P.path=he(c.path):((p.userinfo!==void 0||p.host!==void 0||p.port!==void 0)&&!p.path?P.path="/"+c.path:p.path?P.path=p.path.slice(0,p.path.lastIndexOf("/")+1)+c.path:P.path=c.path,P.path=he(P.path)),P.query=c.query):(P.path=p.path,c.query!==void 0?P.query=c.query:P.query=p.query),P.userinfo=p.userinfo,P.host=p.host,P.port=p.port),P.scheme=p.scheme),P.fragment=c.fragment,P}function Ge(p,c,m){var T=d({scheme:"null"},m);return ae(Me(le(p,T),le(c,T),T,!0),T)}function Re(p,c){return typeof p=="string"?p=ae(le(p,c),c):i(p)==="object"&&(p=le(ae(p,c),c)),p}function Ke(p,c,m){return typeof p=="string"?p=ae(le(p,m),m):i(p)==="object"&&(p=ae(p,m)),typeof c=="string"?c=ae(le(c,m),m):i(c)==="object"&&(c=ae(c,m)),p===c}function Xe(p,c){return p&&p.toString().replace(!c||!c.iri?f.ESCAPE:g.ESCAPE,q)}function ue(p,c){return p&&p.toString().replace(!c||!c.iri?f.PCT_ENCODED:g.PCT_ENCODED,H)}var ke={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 T=String(c.scheme).toLowerCase()==="https";return(c.port===(T?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},yt={scheme:"https",domainHost:ke.domainHost,parse:ke.parse,serialize:ke.serialize};function vt(p){return typeof p.secure=="boolean"?p.secure:String(p.scheme).toLowerCase()==="wss"}var Je={scheme:"ws",domainHost:!0,parse:function(c,m){var T=c;return T.secure=vt(T),T.resourceName=(T.path||"/")+(T.query?"?"+T.query:""),T.path=void 0,T.query=void 0,T},serialize:function(c,m){if((c.port===(vt(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 T=c.resourceName.split("?"),P=N(T,2),L=P[0],U=P[1];c.path=L&&L!=="/"?L:void 0,c.query=U,c.resourceName=void 0}return c.fragment=void 0,c}},wt={scheme:"wss",domainHost:Je.domainHost,parse:Je.parse,serialize:Je.serialize},Ht={},bt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",me="[0-9A-Fa-f]",Wt=s(s("%[EFef]"+me+"%"+me+me+"%"+me+me)+"|"+s("%[89A-Fa-f]"+me+"%"+me+me)+"|"+s("%"+me+me)),Bt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Gt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Kt=n(Gt,'[\\"\\\\]'),Jt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Qt=new RegExp(bt,"g"),qe=new RegExp(Wt,"g"),Zt=new RegExp(n("[^]",Bt,"[\\.]",'[\\"]',Kt),"g"),Et=new RegExp(n("[^]",bt,Jt),"g"),Yt=Et;function _t(p){var c=H(p);return c.match(Qt)?c:p}var Pt={scheme:"mailto",parse:function(c,m){var T=c,P=T.to=T.path?T.path.split(","):[];if(T.path=void 0,T.query){for(var L=!1,U={},K=T.query.split("&"),Q=0,te=K.length;Q<te;++Q){var W=K[Q].split("=");switch(W[0]){case"to":for(var J=W[1].split(","),re=0,V=J.length;re<V;++re)P.push(J[re]);break;case"subject":T.subject=ue(W[1],m);break;case"body":T.body=ue(W[1],m);break;default:L=!0,U[ue(W[0],m)]=ue(W[1],m);break}}L&&(T.headers=U)}T.query=void 0;for(var Z=0,se=P.length;Z<se;++Z){var Y=P[Z].split("@");if(Y[0]=ue(Y[0]),m.unicodeSupport)Y[1]=ue(Y[1],m).toLowerCase();else try{Y[1]=O.toASCII(ue(Y[1],m).toLowerCase())}catch(be){T.error=T.error||"Email address's domain name can not be converted to ASCII via punycode: "+be}P[Z]=Y.join("@")}return T},serialize:function(c,m){var T=c,P=l(c.to);if(P){for(var L=0,U=P.length;L<U;++L){var K=String(P[L]),Q=K.lastIndexOf("@"),te=K.slice(0,Q).replace(qe,_t).replace(qe,o).replace(Zt,q),W=K.slice(Q+1);try{W=m.iri?O.toUnicode(W):O.toASCII(ue(W,m).toLowerCase())}catch(Z){T.error=T.error||"Email address's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+Z}P[L]=te+"@"+W}T.path=P.join(",")}var J=c.headers=c.headers||{};c.subject&&(J.subject=c.subject),c.body&&(J.body=c.body);var re=[];for(var V in J)J[V]!==Ht[V]&&re.push(V.replace(qe,_t).replace(qe,o).replace(Et,q)+"="+J[V].replace(qe,_t).replace(qe,o).replace(Yt,q));return re.length&&(T.query=re.join("&")),T}},Xt=/^([^\:]+)\:(.*)/,St={scheme:"urn",parse:function(c,m){var T=c.path&&c.path.match(Xt),P=c;if(T){var L=m.scheme||P.scheme||"urn",U=T[1].toLowerCase(),K=T[2],Q=L+":"+(m.nid||U),te=M[Q];P.nid=U,P.nss=K,P.path=void 0,te&&(P=te.parse(P,m))}else P.error=P.error||"URN can not be parsed.";return P},serialize:function(c,m){var T=m.scheme||c.scheme||"urn",P=c.nid,L=T+":"+(m.nid||P),U=M[L];U&&(c=U.serialize(c,m));var K=c,Q=c.nss;return K.path=(P||m.nid)+":"+Q,K}},er=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(c,m){var T=c;return T.uuid=T.nss,T.nss=void 0,!m.tolerant&&(!T.uuid||!T.uuid.match(er))&&(T.error=T.error||"UUID is not valid."),T},serialize:function(c,m){var T=c;return T.nss=(c.uuid||"").toLowerCase(),T}};M[ke.scheme]=ke,M[yt.scheme]=yt,M[Je.scheme]=Je,M[wt.scheme]=wt,M[Pt.scheme]=Pt,M[St.scheme]=St,M[Tt.scheme]=Tt,r.SCHEMES=M,r.pctEncChar=q,r.pctDecChars=H,r.parse=le,r.removeDotSegments=he,r.serialize=ae,r.resolveComponents=Me,r.resolve=Ge,r.normalize=Re,r.equal=Ke,r.escapeComponent=Xe,r.unescapeComponent=ue,Object.defineProperty(r,"__esModule",{value:!0})})})(uri_all,uri_all.exports);var uri_allExports=uri_all.exports;Object.defineProperty(uri$1,"__esModule",{value:!0});const uri=uri_allExports;uri.code='require("ajv/dist/runtime/uri").default';uri$1.default=uri;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=validate;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=codegen;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=validation_error,s=ref_error,i=rules,o=compile,l=codegen,d=resolve$1,u=dataType,f=util,g=require$$9,N=uri$1,C=(F,v)=>new RegExp(F,v);C.code="new RegExp";const S=["removeAdditional","useDefaults","coerceTypes"],R=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 b(F){var v,j,E,a,h,O,M,q,H,B,ee,fe,je,ze,He,le,We,De,Ae,Fe,Be,he,ae,Me,Ge;const Re=F.strict,Ke=(v=F.code)===null||v===void 0?void 0:v.optimize,Xe=Ke===!0||Ke===void 0?1:Ke||0,ue=(E=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&E!==void 0?E:C,ke=(a=F.uriResolver)!==null&&a!==void 0?a:N.default;return{strictSchema:(O=(h=F.strictSchema)!==null&&h!==void 0?h:Re)!==null&&O!==void 0?O:!0,strictNumbers:(q=(M=F.strictNumbers)!==null&&M!==void 0?M:Re)!==null&&q!==void 0?q:!0,strictTypes:(B=(H=F.strictTypes)!==null&&H!==void 0?H:Re)!==null&&B!==void 0?B:"log",strictTuples:(fe=(ee=F.strictTuples)!==null&&ee!==void 0?ee:Re)!==null&&fe!==void 0?fe:"log",strictRequired:(ze=(je=F.strictRequired)!==null&&je!==void 0?je:Re)!==null&&ze!==void 0?ze:!1,code:F.code?{...F.code,optimize:Xe,regExp:ue}:{optimize:Xe,regExp:ue},loopRequired:(He=F.loopRequired)!==null&&He!==void 0?He:$,loopEnum:(le=F.loopEnum)!==null&&le!==void 0?le:$,meta:(We=F.meta)!==null&&We!==void 0?We:!0,messages:(De=F.messages)!==null&&De!==void 0?De:!0,inlineRefs:(Ae=F.inlineRefs)!==null&&Ae!==void 0?Ae:!0,schemaId:(Fe=F.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(Be=F.addUsedSchema)!==null&&Be!==void 0?Be:!0,validateSchema:(he=F.validateSchema)!==null&&he!==void 0?he:!0,validateFormats:(ae=F.validateFormats)!==null&&ae!==void 0?ae:!0,unicodeRegExp:(Me=F.unicodeRegExp)!==null&&Me!==void 0?Me:!0,int32range:(Ge=F.int32range)!==null&&Ge!==void 0?Ge:!0,uriResolver:ke}}class I{constructor(v={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,v=this.opts={...v,...b(v)};const{es5:j,lines:E}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:R,es5:j,lines:E}),this.logger=G(v.logger);const a=v.validateFormats;v.validateFormats=!1,this.RULES=(0,i.getRules)(),A.call(this,y,v,"NOT SUPPORTED"),A.call(this,_,v,"DEPRECATED","warn"),this._metaOpts=z.call(this),v.formats&&D.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:E}=this.opts;let a=g;E==="id"&&(a={...g},a.id=a.$id,delete a.$id),j&&v&&this.addMetaSchema(a,a[E],!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 E;if(typeof v=="string"){if(E=this.getSchema(v),!E)throw new Error(`no schema with key or ref "${v}"`)}else E=this.compile(v);const a=E(j);return"$async"in E||(this.errors=E.errors),a}compile(v,j){const E=this._addSchema(v,j);return E.validate||this._compileSchemaEnv(E)}compileAsync(v,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:E}=this.opts;return a.call(this,v,j);async function a(B,ee){await h.call(this,B.$schema);const fe=this._addSchema(B,ee);return fe.validate||O.call(this,fe)}async function h(B){B&&!this.getSchema(B)&&await a.call(this,{$ref:B},!0)}async function O(B){try{return this._compileSchemaEnv(B)}catch(ee){if(!(ee instanceof s.default))throw ee;return M.call(this,ee),await q.call(this,ee.missingSchema),O.call(this,B)}}function M({missingSchema:B,missingRef:ee}){if(this.refs[B])throw new Error(`AnySchema ${B} is loaded but ${ee} cannot be resolved`)}async function q(B){const ee=await H.call(this,B);this.refs[B]||await h.call(this,ee.$schema),this.refs[B]||this.addSchema(ee,B,j)}async function H(B){const ee=this._loading[B];if(ee)return ee;try{return await(this._loading[B]=E(B))}finally{delete this._loading[B]}}}addSchema(v,j,E,a=this.opts.validateSchema){if(Array.isArray(v)){for(const O of v)this.addSchema(O,void 0,E,a);return this}let h;if(typeof v=="object"){const{schemaId:O}=this.opts;if(h=v[O],h!==void 0&&typeof h!="string")throw new Error(`schema ${O} must be string`)}return j=(0,d.normalizeId)(j||h),this._checkUnique(j),this.schemas[j]=this._addSchema(v,E,j,a,!0),this}addMetaSchema(v,j,E=this.opts.validateSchema){return this.addSchema(v,j,!0,E),this}validateSchema(v,j){if(typeof v=="boolean")return!0;let E;if(E=v.$schema,E!==void 0&&typeof E!="string")throw new Error("$schema must be a string");if(E=E||this.opts.defaultMeta||this.defaultMeta(),!E)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(E,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:E}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:E});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 E=v[this.opts.schemaId];return E&&(E=(0,d.normalizeId)(E),delete this.schemas[E],delete this.refs[E]),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 E;if(typeof v=="string")E=v,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=E);else if(typeof v=="object"&&j===void 0){if(j=v,E=j.keyword,Array.isArray(E)&&!E.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ne.call(this,E,j),!j)return(0,f.eachItem)(E,h=>Se.call(this,h)),this;Oe.call(this,j);const a={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,f.eachItem)(E,a.type.length===0?h=>Se.call(this,h,a):h=>a.type.forEach(O=>Se.call(this,h,a,O))),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 E of j.rules){const a=E.rules.findIndex(h=>h.keyword===v);a>=0&&E.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:E="data"}={}){return!v||v.length===0?"No errors":v.map(a=>`${E}${a.instancePath} ${a.message}`).reduce((a,h)=>a+j+h)}$dataMetaSchema(v,j){const E=this.RULES.all;v=JSON.parse(JSON.stringify(v));for(const a of j){const h=a.split("/").slice(1);let O=v;for(const M of h)O=O[M];for(const M in E){const q=E[M];if(typeof q!="object")continue;const{$data:H}=q.definition,B=O[M];H&&B&&(O[M]=Ie(B))}}return v}_removeAllSchemas(v,j){for(const E in v){const a=v[E];(!j||j.test(E))&&(typeof a=="string"?delete v[E]:a&&!a.meta&&(this._cache.delete(a.schema),delete v[E]))}}_addSchema(v,j,E,a=this.opts.validateSchema,h=this.opts.addUsedSchema){let O;const{schemaId:M}=this.opts;if(typeof v=="object")O=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;E=(0,d.normalizeId)(O||E);const H=d.getSchemaRefs.call(this,v,E);return q=new o.SchemaEnv({schema:v,schemaId:M,meta:j,baseId:E,localRefs:H}),this._cache.set(q.schema,q),h&&!E.startsWith("#")&&(E&&this._checkUnique(E),this.refs[E]=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 A(F,v,j,E="error"){for(const a in F){const h=a;h in v&&this.logger[E](`${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 D(){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 S)delete F[v];return F}const X={log(){},warn(){},error(){}};function G(F){if(F===!1)return X;if(F===void 0)return console;if(F.log&&F.warn&&F.error)return F;throw new Error("logger must implement log, warn and error methods")}const de=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(F,v){const{RULES:j}=this;if((0,f.eachItem)(F,E=>{if(j.keywords[E])throw new Error(`Keyword ${E} is already defined`);if(!de.test(E))throw new Error(`Keyword ${E} has invalid name`)}),!!v&&v.$data&&!("code"in v||"validate"in v))throw new Error('$data keyword must have "code" or "validate" function')}function Se(F,v,j){var E;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 O=a?h.post:h.rules.find(({type:q})=>q===j);if(O||(O={type:j,rules:[]},h.rules.push(O)),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?Te.call(this,O,M,v.before):O.rules.push(M),h.all[F]=M,(E=v.implements)===null||E===void 0||E.forEach(q=>this.addKeyword(q))}function Te(F,v,j){const E=F.rules.findIndex(a=>a.keyword===j);E>=0?F.rules.splice(E,0,v):(F.rules.push(v),this.logger.warn(`rule ${j} is not defined`))}function Oe(F){let{metaSchema:v}=F;v!==void 0&&(F.$data&&this.opts.$data&&(v=Ie(v)),F.validateSchema=this.compile(v,!0))}const Ve={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(F){return{anyOf:[F,Ve]}}})(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0});ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:l,self:d}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return g();const f=compile_1$1.resolveRef.call(d,u,s,r);if(f===void 0)throw new ref_error_1.default(n.opts.uriResolver,s,r);if(f instanceof compile_1$1.SchemaEnv)return N(f);return C(f);function g(){if(i===u)return callRef(e,o,i,i.$async);const S=t.scopeValue("root",{ref:u});return callRef(e,(0,codegen_1$l._)`${S}.validate`,u,u.$async)}function N(S){const R=getValidate(e,S);callRef(e,R,S,S.$async)}function C(S){const R=t.scopeValue("schema",l.code.source===!0?{ref:S,code:(0,codegen_1$l.stringify)(S)}:{ref:S}),y=t.name("valid"),_=e.subschema({schema:S,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:R,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?f():g();function f(){if(!l.$async)throw new Error("async schema referenced by sync schema");const S=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,u)}`),C(t),o||s.assign(S,!0)},R=>{s.if((0,codegen_1$l._)`!(${R} instanceof ${i.ValidationError})`,()=>s.throw(R)),N(R),o||s.assign(S,!1)}),e.ok(S)}function g(){e.result((0,code_1$8.callValidateCode)(e,t,u),()=>C(t),()=>N(t))}function N(S){const R=(0,codegen_1$l._)`${S}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${R} : ${names_1$1.default.vErrors}.concat(${R})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function C(S){var R;if(!i.opts.unevaluated)return;const y=(R=r==null?void 0:r.validate)===null||R===void 0?void 0:R.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._)`${S}.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._)`${S}.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():f(),l.strictRequired){const C=e.parentSchema.properties,{definedProperties:S}=e.it;for(const R of r)if((C==null?void 0:C[R])===void 0&&!S.has(R)){const y=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${R}" 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 C of r)(0,code_1$6.checkReportMissingProp)(e,C)}function f(){const C=t.let("missing");if(d||i){const S=t.let("valid",!0);e.block$data(S,()=>N(C,S)),e.ok(S)}else t.if((0,code_1$6.checkMissingProp)(e,r,C)),(0,code_1$6.reportMissingProp)(e,C),t.else()}function g(){t.forOf("prop",n,C=>{e.setParams({missingProperty:C}),t.if((0,code_1$6.noPropertyInData)(t,s,C,l.ownProperties),()=>e.error())})}function N(C,S){e.setParams({missingProperty:C}),t.forOf(C,n,()=>{t.assign(S,(0,code_1$6.propertyInData)(t,s,C,l.ownProperties)),t.if((0,codegen_1$f.not)(S),()=>{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,f,(0,codegen_1$d._)`${o} === false`),e.ok(d);function f(){const S=t.let("i",(0,codegen_1$d._)`${r}.length`),R=t.let("j");e.setParams({i:S,j:R}),t.assign(d,!0),t.if((0,codegen_1$d._)`${S} > 1`,()=>(g()?N:C)(S,R))}function g(){return u.length>0&&!u.some(S=>S==="object"||S==="array")}function N(S,R){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._)`;${S}--;`,()=>{t.let(y,(0,codegen_1$d._)`${r}[${S}]`),t.if(_,(0,codegen_1$d._)`continue`),u.length>1&&t.if((0,codegen_1$d._)`typeof ${y} == "string"`,(0,codegen_1$d._)`${y} += "_"`),t.if((0,codegen_1$d._)`typeof ${$}[${y}] == "number"`,()=>{t.assign(R,(0,codegen_1$d._)`${$}[${y}]`),e.error(),t.assign(d,!1).break()}).code((0,codegen_1$d._)`${$}[${y}] = ${S}`)})}function C(S,R){const y=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${S}--;`,()=>t.for((0,codegen_1$d._)`${R} = ${S}; ${R}--;`,()=>t.if((0,codegen_1$d._)`${y}(${r}[${S}], ${r}[${R}])`,()=>{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 f;if(l||n)f=t.let("valid"),e.block$data(f,g);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const C=t.const("vSchema",i);f=(0,codegen_1$b.or)(...s.map((S,R)=>N(C,R)))}e.pass(f);function g(){t.assign(f,!1),t.forOf("v",i,C=>t.if((0,codegen_1$b._)`${u()}(${r}, ${C})`,()=>t.assign(f,!0).break()))}function N(C,S){const R=s[S];return typeof R=="object"&&R!==null?(0,codegen_1$b._)`${u()}(${r}, ${C}[${S}])`:(0,codegen_1$b._)`${r} === ${R}`}}};_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,f=>{e.subschema({keyword:i,dataProp:f,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;f(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,N)=>{(0,util_1$c.alwaysValidSchema)(l,g)||(n.if((0,codegen_1$9._)`${u} > ${N}`,()=>e.subschema({keyword:o,schemaProp:N,dataProp:N},d)),e.ok(d))});function f(g){const{opts:N,errSchemaPath:C}=l,S=r.length,R=S===g.minItems&&(S===g.maxItems||g[t]===!1);if(N.strictTuples&&!R){const y=`"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;(0,util_1$c.checkStrictMode)(l,y,N.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 f=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 R=(0,codegen_1$7._)`${f} >= ${o}`;l!==void 0&&(R=(0,codegen_1$7._)`${R} && ${f} <= ${l}`),e.pass(R);return}i.items=!0;const g=t.name("valid");l===void 0&&o===1?C(g,()=>t.if(g,()=>t.break())):o===0?(t.let(g,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,N)):(t.let(g,!1),N()),e.result(g,()=>e.reset());function N(){const R=t.name("_valid"),y=t.let("count",0);C(R,()=>t.if(R,()=>S(y)))}function C(R,y){t.forRange("i",0,f,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},R),y()})}function S(R){t.code((0,codegen_1$7._)`${R}++`),l===void 0?t.if((0,codegen_1$7._)`${R} >= ${o}`,()=>t.assign(g,!0).break()):(t.if((0,codegen_1$7._)`${R} > ${l}`,()=>t.assign(g,!1).break()),o===1?t.assign(g,!0):t.if((0,codegen_1$7._)`${R} >= ${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:f}})=>{const g=u===1?"property":"properties";return(0,t.str)`must have ${g} ${f} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:f,missingProperty:g}})=>(0,t._)`{property: ${d},
628
+ ${s}`)}}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const To=()=>{};class Ro extends Xr{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class ko extends Xr{constructor(t,r){super(r),this.resource=t}get name(){return Pr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${Qs(this.resource.slug)}`}}class Oo extends Xr{constructor(t,r){super(r),this.resource=t}get name(){return Pr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${Qs(this.resource.slug)}`}}function Qs(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class Zs extends ut{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 No extends Zs{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class Co extends Zs{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var qr={exports:{}},Ys={},Ce={},Pt={},Kt={},G={},xt={};(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((b,I)=>`${b}${I}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((b,I)=>(I instanceof r&&(b[I.str]=(b[I.str]||0)+1),b),{})}}e._Code=n,e.nil=new n("");function s(y,...$){const b=[y[0]];let I=0;for(;I<$.length;)l(b,$[I]),b.push(y[++I]);return new n(b)}e._=s;const i=new n("+");function c(y,...$){const b=[O(y[0])];let I=0;for(;I<$.length;)b.push(i),l(b,$[I]),b.push(i,O(y[++I]));return d(b),new n(b)}e.str=c;function l(y,$){$ instanceof n?y.push(...$._items):$ instanceof r?y.push($):y.push(g($))}e.addCodeArg=l;function d(y){let $=1;for(;$<y.length-1;){if(y[$]===i){const b=f(y[$-1],y[$+1]);if(b!==void 0){y.splice($-1,3,b);continue}y[$++]="+"}$++}}function f(y,$){if($==='""')return y;if(y==='""')return $;if(typeof y=="string")return $ instanceof r||y[y.length-1]!=='"'?void 0:typeof $!="string"?`${y.slice(0,-1)}${$}"`:$[0]==='"'?y.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(y instanceof r))return`"${y}${$.slice(1)}`}function p(y,$){return $.emptyStr()?y:y.emptyStr()?$:c`${y}${$}`}e.strConcat=p;function g(y){return typeof y=="number"||typeof y=="boolean"||y===null?y:O(Array.isArray(y)?y.join(","):y)}function N(y){return new n(O(y))}e.stringify=N;function O(y){return JSON.stringify(y).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=O;function S(y){return typeof y=="string"&&e.IDENTIFIER.test(y)?new n(`.${y}`):s`[${y}]`}e.getProperty=S;function R(y){if(typeof y=="string"&&e.IDENTIFIER.test(y))return new n(`${y}`);throw new Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`)}e.getEsmExportName=R;function _(y){return new n(y.toString())}e.regexpCode=_})(xt);var Ur={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=xt;class r extends Error{constructor(f){super(`CodeGen: "code" for ${f} not defined`),this.value=f.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:f,parent:p}={}){this._names={},this._prefixes=f,this._parent=p}toName(f){return f instanceof t.Name?f:this.name(f)}name(f){return new t.Name(this._newName(f))}_newName(f){const p=this._names[f]||this._nameGroup(f);return`${f}${p.index++}`}_nameGroup(f){var p,g;if(!((g=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||g===void 0)&&g.has(f)||this._prefixes&&!this._prefixes.has(f))throw new Error(`CodeGen: prefix "${f}" is not allowed in this scope`);return this._names[f]={prefix:f,index:0}}}e.Scope=s;class i extends t.Name{constructor(f,p){super(p),this.prefix=f}setValue(f,{property:p,itemIndex:g}){this.value=f,this.scopePath=(0,t._)`.${new t.Name(p)}[${g}]`}}e.ValueScopeName=i;const c=(0,t._)`\n`;class l extends s{constructor(f){super(f),this._values={},this._scope=f.scope,this.opts={...f,_n:f.lines?c:t.nil}}get(){return this._scope}name(f){return new i(f,this._newName(f))}value(f,p){var g;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const N=this.toName(f),{prefix:O}=N,S=(g=p.key)!==null&&g!==void 0?g:p.ref;let R=this._values[O];if(R){const $=R.get(S);if($)return $}else R=this._values[O]=new Map;R.set(S,N);const _=this._scope[O]||(this._scope[O]=[]),y=_.length;return _[y]=p.ref,N.setValue(p,{property:O,itemIndex:y}),N}getValue(f,p){const g=this._values[f];if(g)return g.get(p)}scopeRefs(f,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._)`${f}${g.scopePath}`})}scopeCode(f=this._values,p,g){return this._reduceValues(f,N=>{if(N.value===void 0)throw new Error(`CodeGen: name "${N}" has no value`);return N.value.code},p,g)}_reduceValues(f,p,g={},N){let O=t.nil;for(const S in f){const R=f[S];if(!R)continue;const _=g[S]=g[S]||new Map;R.forEach(y=>{if(_.has(y))return;_.set(y,n.Started);let $=p(y);if($){const b=this.opts.es5?e.varKinds.var:e.varKinds.const;O=(0,t._)`${O}${b} ${y} = ${$};${this.opts._n}`}else if($=N==null?void 0:N(y))O=(0,t._)`${O}${$}${this.opts._n}`;else throw new r(y);_.set(y,n.Completed)})}return O}}e.ValueScope=l})(Ur);(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=xt,r=Ur;var n=xt;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=Ur;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(o,h){return this}}class c extends i{constructor(o,h,C){super(),this.varKind=o,this.name=h,this.rhs=C}render({es5:o,_n:h}){const C=o?r.varKinds.var:this.varKind,F=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${F};`+h}optimizeNames(o,h){if(o[this.name.str])return this.rhs&&(this.rhs=de(this.rhs,o,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(o,h,C){super(),this.lhs=o,this.rhs=h,this.sideEffects=C}render({_n:o}){return`${this.lhs} = ${this.rhs};`+o}optimizeNames(o,h){if(!(this.lhs instanceof t.Name&&!o[this.lhs.str]&&!this.sideEffects))return this.rhs=de(this.rhs,o,h),this}get names(){const o=this.lhs instanceof t.Name?{}:{...this.lhs.names};return Ee(o,this.rhs)}}class d extends l{constructor(o,h,C,F){super(o,C,F),this.op=h}render({_n:o}){return`${this.lhs} ${this.op}= ${this.rhs};`+o}}class f extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`${this.label}:`+o}}class p extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`break${this.label?` ${this.label}`:""};`+o}}class g extends i{constructor(o){super(),this.error=o}render({_n:o}){return`throw ${this.error};`+o}get names(){return this.error.names}}class N extends i{constructor(o){super(),this.code=o}render({_n:o}){return`${this.code};`+o}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(o,h){return this.code=de(this.code,o,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class O extends i{constructor(o=[]){super(),this.nodes=o}render(o){return this.nodes.reduce((h,C)=>h+C.render(o),"")}optimizeNodes(){const{nodes:o}=this;let h=o.length;for(;h--;){const C=o[h].optimizeNodes();Array.isArray(C)?o.splice(h,1,...C):C?o[h]=C:o.splice(h,1)}return o.length>0?this:void 0}optimizeNames(o,h){const{nodes:C}=this;let F=C.length;for(;F--;){const L=C[F];L.optimizeNames(o,h)||(Ye(o,L.names),C.splice(F,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((o,h)=>Z(o,h.names),{})}}class S extends O{render(o){return"{"+o._n+super.render(o)+"}"+o._n}}class R extends O{}class _ extends S{}_.kind="else";class y extends S{constructor(o,h){super(h),this.condition=o}render(o){let h=`if(${this.condition})`+super.render(o);return this.else&&(h+="else "+this.else.render(o)),h}optimizeNodes(){super.optimizeNodes();const o=this.condition;if(o===!0)return this.nodes;let h=this.else;if(h){const C=h.optimizeNodes();h=this.else=Array.isArray(C)?new _(C):C}if(h)return o===!1?h instanceof y?h:h.nodes:this.nodes.length?this:new y(Xe(o),h instanceof y?[h]:h.nodes);if(!(o===!1||!this.nodes.length))return this}optimizeNames(o,h){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(o,h),!!(super.optimizeNames(o,h)||this.else))return this.condition=de(this.condition,o,h),this}get names(){const o=super.names;return Ee(o,this.condition),this.else&&Z(o,this.else.names),o}}y.kind="if";class $ extends S{}$.kind="for";class b extends ${constructor(o){super(),this.iteration=o}render(o){return`for(${this.iteration})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iteration=de(this.iteration,o,h),this}get names(){return Z(super.names,this.iteration.names)}}class I extends ${constructor(o,h,C,F){super(),this.varKind=o,this.name=h,this.from=C,this.to=F}render(o){const h=o.es5?r.varKinds.var:this.varKind,{name:C,from:F,to:L}=this;return`for(${h} ${C}=${F}; ${C}<${L}; ${C}++)`+super.render(o)}get names(){const o=Ee(super.names,this.from);return Ee(o,this.to)}}class A extends ${constructor(o,h,C,F){super(),this.loop=o,this.varKind=h,this.name=C,this.iterable=F}render(o){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iterable=de(this.iterable,o,h),this}get names(){return Z(super.names,this.iterable.names)}}class w extends S{constructor(o,h,C){super(),this.name=o,this.args=h,this.async=C}render(o){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(o)}}w.kind="func";class k extends O{render(o){return"return "+super.render(o)}}k.kind="return";class D extends S{render(o){let h="try"+super.render(o);return this.catch&&(h+=this.catch.render(o)),this.finally&&(h+=this.finally.render(o)),h}optimizeNodes(){var o,h;return super.optimizeNodes(),(o=this.catch)===null||o===void 0||o.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(o,h){var C,F;return super.optimizeNames(o,h),(C=this.catch)===null||C===void 0||C.optimizeNames(o,h),(F=this.finally)===null||F===void 0||F.optimizeNames(o,h),this}get names(){const o=super.names;return this.catch&&Z(o,this.catch.names),this.finally&&Z(o,this.finally.names),o}}class W extends S{constructor(o){super(),this.error=o}render(o){return`catch(${this.error})`+super.render(o)}}W.kind="catch";class x extends S{render(o){return"finally"+super.render(o)}}x.kind="finally";class ie{constructor(o,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
629
+ `:""},this._extScope=o,this._scope=new r.Scope({parent:o}),this._nodes=[new R]}toString(){return this._root.render(this.opts)}name(o){return this._scope.name(o)}scopeName(o){return this._extScope.name(o)}scopeValue(o,h){const C=this._extScope.value(o,h);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(o,h){return this._extScope.getValue(o,h)}scopeRefs(o){return this._extScope.scopeRefs(o,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(o,h,C,F){const L=this._scope.toName(h);return C!==void 0&&F&&(this._constants[L.str]=C),this._leafNode(new c(o,L,C)),L}const(o,h,C){return this._def(r.varKinds.const,o,h,C)}let(o,h,C){return this._def(r.varKinds.let,o,h,C)}var(o,h,C){return this._def(r.varKinds.var,o,h,C)}assign(o,h,C){return this._leafNode(new l(o,h,C))}add(o,h){return this._leafNode(new d(o,e.operators.ADD,h))}code(o){return typeof o=="function"?o():o!==t.nil&&this._leafNode(new N(o)),this}object(...o){const h=["{"];for(const[C,F]of o)h.length>1&&h.push(","),h.push(C),(C!==F||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,F));return h.push("}"),new t._Code(h)}if(o,h,C){if(this._blockNode(new y(o)),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(o){return this._elseNode(new y(o))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(y,_)}_for(o,h){return this._blockNode(o),h&&this.code(h).endFor(),this}for(o,h){return this._for(new b(o),h)}forRange(o,h,C,F,L=this.opts.es5?r.varKinds.var:r.varKinds.let){const K=this._scope.toName(o);return this._for(new I(L,K,h,C),()=>F(K))}forOf(o,h,C,F=r.varKinds.const){const L=this._scope.toName(o);if(this.opts.es5){const K=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${K}.length`,Q=>{this.var(L,(0,t._)`${K}[${Q}]`),C(L)})}return this._for(new A("of",F,L,h),()=>C(L))}forIn(o,h,C,F=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(o,(0,t._)`Object.keys(${h})`,C);const L=this._scope.toName(o);return this._for(new A("in",F,L,h),()=>C(L))}endFor(){return this._endBlockNode($)}label(o){return this._leafNode(new f(o))}break(o){return this._leafNode(new p(o))}return(o){const h=new k;if(this._blockNode(h),this.code(o),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(o,h,C){if(!h&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const F=new D;if(this._blockNode(F),this.code(o),h){const L=this.name("e");this._currNode=F.catch=new W(L),h(L)}return C&&(this._currNode=F.finally=new x,this.code(C)),this._endBlockNode(W,x)}throw(o){return this._leafNode(new g(o))}block(o,h){return this._blockStarts.push(this._nodes.length),o&&this.code(o).endBlock(h),this}endBlock(o){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||o!==void 0&&C!==o)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${o} expected`);return this._nodes.length=h,this}func(o,h=t.nil,C,F){return this._blockNode(new w(o,h,C)),F&&this.code(F).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(o=1){for(;o-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(o){return this._currNode.nodes.push(o),this}_blockNode(o){this._currNode.nodes.push(o),this._nodes.push(o)}_endBlockNode(o,h){const C=this._currNode;if(C instanceof o||h&&C instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${o.kind}/${h.kind}`:o.kind}"`)}_elseNode(o){const h=this._currNode;if(!(h instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=o,this}get _root(){return this._nodes[0]}get _currNode(){const o=this._nodes;return o[o.length-1]}set _currNode(o){const h=this._nodes;h[h.length-1]=o}}e.CodeGen=ie;function Z(E,o){for(const h in o)E[h]=(E[h]||0)+(o[h]||0);return E}function Ee(E,o){return o instanceof t._CodeOrName?Z(E,o.names):E}function de(E,o,h){if(E instanceof t.Name)return C(E);if(!F(E))return E;return new t._Code(E._items.reduce((L,K)=>(K instanceof t.Name&&(K=C(K)),K instanceof t._Code?L.push(...K._items):L.push(K),L),[]));function C(L){const K=h[L.str];return K===void 0||o[L.str]!==1?L:(delete o[L.str],K)}function F(L){return L instanceof t._Code&&L._items.some(K=>K instanceof t.Name&&o[K.str]===1&&h[K.str]!==void 0)}}function Ye(E,o){for(const h in o)E[h]=(E[h]||0)-(o[h]||0)}function Xe(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:(0,t._)`!${j(E)}`}e.not=Xe;const dt=v(e.operators.AND);function kt(...E){return E.reduce(dt)}e.and=kt;const ft=v(e.operators.OR);function M(...E){return E.reduce(ft)}e.or=M;function v(E){return(o,h)=>o===t.nil?h:h===t.nil?o:(0,t._)`${j(o)} ${E} ${j(h)}`}function j(E){return E instanceof t.Name?E:(0,t._)`(${E})`}})(G);var X={};(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=G,r=xt;function n(w){const k={};for(const D of w)k[D]=!0;return k}e.toHash=n;function s(w,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(i(w,k),!c(k,w.self.RULES.all))}e.alwaysValidSchema=s;function i(w,k=w.schema){const{opts:D,self:W}=w;if(!D.strictSchema||typeof k=="boolean")return;const x=W.RULES.keywords;for(const ie in k)x[ie]||A(w,`unknown keyword: "${ie}"`)}e.checkUnknownRules=i;function c(w,k){if(typeof w=="boolean")return!w;for(const D in w)if(k[D])return!0;return!1}e.schemaHasRules=c;function l(w,k){if(typeof w=="boolean")return!w;for(const D in w)if(D!=="$ref"&&k.all[D])return!0;return!1}e.schemaHasRulesButRef=l;function d({topSchemaRef:w,schemaPath:k},D,W,x){if(!x){if(typeof D=="number"||typeof D=="boolean")return D;if(typeof D=="string")return(0,t._)`${D}`}return(0,t._)`${w}${k}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=d;function f(w){return N(decodeURIComponent(w))}e.unescapeFragment=f;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 N(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=N;function O(w,k){if(Array.isArray(w))for(const D of w)k(D);else k(w)}e.eachItem=O;function S({mergeNames:w,mergeToName:k,mergeValues:D,resultToName:W}){return(x,ie,Z,Ee)=>{const de=Z===void 0?ie:Z instanceof t.Name?(ie instanceof t.Name?w(x,ie,Z):k(x,ie,Z),Z):ie instanceof t.Name?(k(x,Z,ie),ie):D(ie,Z);return Ee===t.Name&&!(de instanceof t.Name)?W(x,de):de}}e.mergeEvaluated={props:S({mergeNames:(w,k,D)=>w.if((0,t._)`${D} !== true && ${k} !== undefined`,()=>{w.if((0,t._)`${k} === true`,()=>w.assign(D,!0),()=>w.assign(D,(0,t._)`${D} || {}`).code((0,t._)`Object.assign(${D}, ${k})`))}),mergeToName:(w,k,D)=>w.if((0,t._)`${D} !== true`,()=>{k===!0?w.assign(D,!0):(w.assign(D,(0,t._)`${D} || {}`),_(w,D,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:R}),items:S({mergeNames:(w,k,D)=>w.if((0,t._)`${D} !== true && ${k} !== undefined`,()=>w.assign(D,(0,t._)`${k} === true ? true : ${D} > ${k} ? ${D} : ${k}`)),mergeToName:(w,k,D)=>w.if((0,t._)`${D} !== true`,()=>w.assign(D,k===!0?!0:(0,t._)`${D} > ${k} ? ${D} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function R(w,k){if(k===!0)return w.var("props",!0);const D=w.var("props",(0,t._)`{}`);return k!==void 0&&_(w,D,k),D}e.evaluatedPropsToName=R;function _(w,k,D){Object.keys(D).forEach(W=>w.assign((0,t._)`${k}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=_;const y={};function $(w,k){return w.scopeValue("func",{ref:k,code:y[k.code]||(y[k.code]=new r._Code(k.code))})}e.useFunc=$;var b;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(b=e.Type||(e.Type={}));function I(w,k,D){if(w instanceof t.Name){const W=k===b.Num;return D?W?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:W?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,t.getProperty)(w).toString():"/"+g(w)}e.getErrorPath=I;function A(w,k,D=w.opts.strictSchema){if(D){if(k=`strict mode: ${k}`,D===!0)throw new Error(k);w.self.logger.warn(k)}}e.checkStrictMode=A})(X);var We={};Object.defineProperty(We,"__esModule",{value:!0});const ye=G,Io={data:new ye.Name("data"),valCxt:new ye.Name("valCxt"),instancePath:new ye.Name("instancePath"),parentData:new ye.Name("parentData"),parentDataProperty:new ye.Name("parentDataProperty"),rootData:new ye.Name("rootData"),dynamicAnchors:new ye.Name("dynamicAnchors"),vErrors:new ye.Name("vErrors"),errors:new ye.Name("errors"),this:new ye.Name("this"),self:new ye.Name("self"),scope:new ye.Name("scope"),json:new ye.Name("json"),jsonPos:new ye.Name("jsonPos"),jsonLen:new ye.Name("jsonLen"),jsonPart:new ye.Name("jsonPart")};We.default=Io;(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=G,r=X,n=We;e.keywordError={message:({keyword:_})=>(0,t.str)`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:y})=>y?(0,t.str)`"${_}" keyword must be ${y} ($data)`:(0,t.str)`"${_}" keyword is invalid ($data)`};function s(_,y=e.keywordError,$,b){const{it:I}=_,{gen:A,compositeRule:w,allErrors:k}=I,D=g(_,y,$);b??(w||k)?d(A,D):f(I,(0,t._)`[${D}]`)}e.reportError=s;function i(_,y=e.keywordError,$){const{it:b}=_,{gen:I,compositeRule:A,allErrors:w}=b,k=g(_,y,$);d(I,k),A||w||f(b,n.default.vErrors)}e.reportExtraError=i;function c(_,y){_.assign(n.default.errors,y),_.if((0,t._)`${n.default.vErrors} !== null`,()=>_.if(y,()=>_.assign((0,t._)`${n.default.vErrors}.length`,y),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=c;function l({gen:_,keyword:y,schemaValue:$,data:b,errsCount:I,it:A}){if(I===void 0)throw new Error("ajv implementation error");const w=_.name("err");_.forRange("i",I,n.default.errors,k=>{_.const(w,(0,t._)`${n.default.vErrors}[${k}]`),_.if((0,t._)`${w}.instancePath === undefined`,()=>_.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,A.errorPath))),_.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${y}`),A.opts.verbose&&(_.assign((0,t._)`${w}.schema`,$),_.assign((0,t._)`${w}.data`,b))})}e.extendErrors=l;function d(_,y){const $=_.const("err",y);_.if((0,t._)`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,(0,t._)`[${$}]`),(0,t._)`${n.default.vErrors}.push(${$})`),_.code((0,t._)`${n.default.errors}++`)}function f(_,y){const{gen:$,validateName:b,schemaEnv:I}=_;I.$async?$.throw((0,t._)`new ${_.ValidationError}(${y})`):($.assign((0,t._)`${b}.errors`,y),$.return(!1))}const p={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function g(_,y,$){const{createErrors:b}=_.it;return b===!1?(0,t._)`{}`:N(_,y,$)}function N(_,y,$={}){const{gen:b,it:I}=_,A=[O(I,$),S(_,$)];return R(_,y,A),b.object(...A)}function O({errorPath:_},{instancePath:y}){const $=y?(0,t.str)`${_}${(0,r.getErrorPath)(y,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,$)]}function S({keyword:_,it:{errSchemaPath:y}},{schemaPath:$,parentSchema:b}){let I=b?y:(0,t.str)`${y}/${_}`;return $&&(I=(0,t.str)`${I}${(0,r.getErrorPath)($,r.Type.Str)}`),[p.schemaPath,I]}function R(_,{params:y,message:$},b){const{keyword:I,data:A,schemaValue:w,it:k}=_,{opts:D,propertyName:W,topSchemaRef:x,schemaPath:ie}=k;b.push([p.keyword,I],[p.params,typeof y=="function"?y(_):y||(0,t._)`{}`]),D.messages&&b.push([p.message,typeof $=="function"?$(_):$]),D.verbose&&b.push([p.schema,w],[p.parentSchema,(0,t._)`${x}${ie}`],[n.default.data,A]),W&&b.push([p.propertyName,W])}})(Kt);Object.defineProperty(Pt,"__esModule",{value:!0});Pt.boolOrEmptySchema=Pt.topBoolOrEmptySchema=void 0;const jo=Kt,Do=G,Ao=We,Mo={message:"boolean schema is false"};function Fo(e){const{gen:t,schema:r,validateName:n}=e;r===!1?Xs(e,!1):typeof r=="object"&&r.$async===!0?t.return(Ao.default.data):(t.assign((0,Do._)`${n}.errors`,null),t.return(!0))}Pt.topBoolOrEmptySchema=Fo;function Lo(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Xs(e)):r.var(t,!0)}Pt.boolOrEmptySchema=Lo;function Xs(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,jo.reportError)(s,Mo,void 0,t)}var Jt={},ct={};Object.defineProperty(ct,"__esModule",{value:!0});ct.getRules=ct.isJSONType=void 0;const qo=["string","number","integer","boolean","null","object","array"],Uo=new Set(qo);function Vo(e){return typeof e=="string"&&Uo.has(e)}ct.isJSONType=Vo;function zo(){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:{}}}ct.getRules=zo;var He={};Object.defineProperty(He,"__esModule",{value:!0});He.shouldUseRule=He.shouldUseGroup=He.schemaHasRulesForType=void 0;function Wo({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&ei(e,n)}He.schemaHasRulesForType=Wo;function ei(e,t){return t.rules.some(r=>ti(e,r))}He.shouldUseGroup=ei;function ti(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))}He.shouldUseRule=ti;(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=ct,r=He,n=Kt,s=G,i=X;var c;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(c=e.DataType||(e.DataType={}));function l(b){const I=d(b.type);if(I.includes("null")){if(b.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&b.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');b.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=l;function d(b){const I=Array.isArray(b)?b:b?[b]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=d;function f(b,I){const{gen:A,data:w,opts:k}=b,D=g(I,k.coerceTypes),W=I.length>0&&!(D.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(b,I[0]));if(W){const x=R(I,w,k.strictNumbers,c.Wrong);A.if(x,()=>{D.length?N(b,I,D):y(b)})}return W}e.coerceAndCheckDataType=f;const p=new Set(["string","number","integer","boolean","null"]);function g(b,I){return I?b.filter(A=>p.has(A)||I==="array"&&A==="array"):[]}function N(b,I,A){const{gen:w,data:k,opts:D}=b,W=w.let("dataType",(0,s._)`typeof ${k}`),x=w.let("coerced",(0,s._)`undefined`);D.coerceTypes==="array"&&w.if((0,s._)`${W} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>w.assign(k,(0,s._)`${k}[0]`).assign(W,(0,s._)`typeof ${k}`).if(R(I,k,D.strictNumbers),()=>w.assign(x,k))),w.if((0,s._)`${x} !== undefined`);for(const Z of A)(p.has(Z)||Z==="array"&&D.coerceTypes==="array")&&ie(Z);w.else(),y(b),w.endIf(),w.if((0,s._)`${x} !== undefined`,()=>{w.assign(k,x),O(b,x)});function ie(Z){switch(Z){case"string":w.elseIf((0,s._)`${W} == "number" || ${W} == "boolean"`).assign(x,(0,s._)`"" + ${k}`).elseIf((0,s._)`${k} === null`).assign(x,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${W} == "boolean" || ${k} === null
630
+ || (${W} == "string" && ${k} && ${k} == +${k})`).assign(x,(0,s._)`+${k}`);return;case"integer":w.elseIf((0,s._)`${W} === "boolean" || ${k} === null
631
+ || (${W} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(x,(0,s._)`+${k}`);return;case"boolean":w.elseIf((0,s._)`${k} === "false" || ${k} === 0 || ${k} === null`).assign(x,!1).elseIf((0,s._)`${k} === "true" || ${k} === 1`).assign(x,!0);return;case"null":w.elseIf((0,s._)`${k} === "" || ${k} === 0 || ${k} === false`),w.assign(x,null);return;case"array":w.elseIf((0,s._)`${W} === "string" || ${W} === "number"
632
+ || ${W} === "boolean" || ${k} === null`).assign(x,(0,s._)`[${k}]`)}}}function O({gen:b,parentData:I,parentDataProperty:A},w){b.if((0,s._)`${I} !== undefined`,()=>b.assign((0,s._)`${I}[${A}]`,w))}function S(b,I,A,w=c.Correct){const k=w===c.Correct?s.operators.EQ:s.operators.NEQ;let D;switch(b){case"null":return(0,s._)`${I} ${k} null`;case"array":D=(0,s._)`Array.isArray(${I})`;break;case"object":D=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":D=W((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":D=W();break;default:return(0,s._)`typeof ${I} ${k} ${b}`}return w===c.Correct?D:(0,s.not)(D);function W(x=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,x,A?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=S;function R(b,I,A,w){if(b.length===1)return S(b[0],I,A,w);let k;const D=(0,i.toHash)(b);if(D.array&&D.object){const W=(0,s._)`typeof ${I} != "object"`;k=D.null?W:(0,s._)`!${I} || ${W}`,delete D.null,delete D.array,delete D.object}else k=s.nil;D.number&&delete D.integer;for(const W in D)k=(0,s.and)(k,S(W,I,A,w));return k}e.checkDataTypes=R;const _={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:I})=>typeof b=="string"?(0,s._)`{type: ${b}}`:(0,s._)`{type: ${I}}`};function y(b){const I=$(b);(0,n.reportError)(I,_)}e.reportTypeError=y;function $(b){const{gen:I,data:A,schema:w}=b,k=(0,i.schemaRefOrVal)(b,w,"type");return{gen:I,keyword:"type",data:A,schema:w.type,schemaCode:k,schemaValue:k,parentSchema:w,params:{},it:b}}})(Jt);var Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.assignDefaults=void 0;const vt=G,Bo=X;function Ho(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)ts(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,i)=>ts(e,i,s.default))}Sr.assignDefaults=Ho;function ts(e,t,r){const{gen:n,compositeRule:s,data:i,opts:c}=e;if(r===void 0)return;const l=(0,vt._)`${i}${(0,vt.getProperty)(t)}`;if(s){(0,Bo.checkStrictMode)(e,`default is ignored for: ${l}`);return}let d=(0,vt._)`${l} === undefined`;c.useDefaults==="empty"&&(d=(0,vt._)`${d} || ${l} === null || ${l} === ""`),n.if(d,(0,vt._)`${l} = ${(0,vt.stringify)(r)}`)}var qe={},H={};Object.defineProperty(H,"__esModule",{value:!0});H.validateUnion=H.validateArray=H.usePattern=H.callValidateCode=H.schemaProperties=H.allSchemaProperties=H.noPropertyInData=H.propertyInData=H.isOwnProperty=H.hasPropFunc=H.reportMissingProp=H.checkMissingProp=H.checkReportMissingProp=void 0;const re=G,en=X,Ke=We,Go=X;function xo(e,t){const{gen:r,data:n,it:s}=e;r.if(rn(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,re._)`${t}`},!0),e.error()})}H.checkReportMissingProp=xo;function Ko({gen:e,data:t,it:{opts:r}},n,s){return(0,re.or)(...n.map(i=>(0,re.and)(rn(e,t,i,r.ownProperties),(0,re._)`${s} = ${i}`)))}H.checkMissingProp=Ko;function Jo(e,t){e.setParams({missingProperty:t},!0),e.error()}H.reportMissingProp=Jo;function ri(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,re._)`Object.prototype.hasOwnProperty`})}H.hasPropFunc=ri;function tn(e,t,r){return(0,re._)`${ri(e)}.call(${t}, ${r})`}H.isOwnProperty=tn;function Qo(e,t,r,n){const s=(0,re._)`${t}${(0,re.getProperty)(r)} !== undefined`;return n?(0,re._)`${s} && ${tn(e,t,r)}`:s}H.propertyInData=Qo;function rn(e,t,r,n){const s=(0,re._)`${t}${(0,re.getProperty)(r)} === undefined`;return n?(0,re.or)(s,(0,re.not)(tn(e,t,r))):s}H.noPropertyInData=rn;function ni(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}H.allSchemaProperties=ni;function Zo(e,t){return ni(t).filter(r=>!(0,en.alwaysValidSchema)(e,t[r]))}H.schemaProperties=Zo;function Yo({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:c},l,d,f){const p=f?(0,re._)`${e}, ${t}, ${n}${s}`:t,g=[[Ke.default.instancePath,(0,re.strConcat)(Ke.default.instancePath,i)],[Ke.default.parentData,c.parentData],[Ke.default.parentDataProperty,c.parentDataProperty],[Ke.default.rootData,Ke.default.rootData]];c.opts.dynamicRef&&g.push([Ke.default.dynamicAnchors,Ke.default.dynamicAnchors]);const N=(0,re._)`${p}, ${r.object(...g)}`;return d!==re.nil?(0,re._)`${l}.call(${d}, ${N})`:(0,re._)`${l}(${N})`}H.callValidateCode=Yo;const Xo=(0,re._)`new RegExp`;function ea({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,re._)`${s.code==="new RegExp"?Xo:(0,Go.useFunc)(e,s)}(${r}, ${n})`})}H.usePattern=ea;function ta(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 c(()=>t.assign(l,!1)),l}return t.var(i,!0),c(()=>t.break()),i;function c(l){const d=t.const("len",(0,re._)`${r}.length`);t.forRange("i",0,d,f=>{e.subschema({keyword:n,dataProp:f,dataPropType:en.Type.Num},i),t.if((0,re.not)(i),l)})}}H.validateArray=ta;function ra(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,en.alwaysValidSchema)(s,d))&&!s.opts.unevaluated)return;const c=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((d,f)=>{const p=e.subschema({keyword:n,schemaProp:f,compositeRule:!0},l);t.assign(c,(0,re._)`${c} || ${l}`),e.mergeValidEvaluated(p,l)||t.if((0,re.not)(c))})),e.result(c,()=>e.reset(),()=>e.error(!0))}H.validateUnion=ra;Object.defineProperty(qe,"__esModule",{value:!0});qe.validateKeywordUsage=qe.validSchemaType=qe.funcKeywordCode=qe.macroKeywordCode=void 0;const ge=G,it=We,na=H,sa=Kt;function ia(e,t){const{gen:r,keyword:n,schema:s,parentSchema:i,it:c}=e,l=t.macro.call(c.self,s,i,c),d=si(r,n,l);c.opts.validateSchema!==!1&&c.self.validateSchema(l,!0);const f=r.name("valid");e.subschema({schema:l,schemaPath:ge.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},f),e.pass(f,()=>e.error(!0))}qe.macroKeywordCode=ia;function oa(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:c,$data:l,it:d}=e;ca(d,t);const f=!l&&t.compile?t.compile.call(d.self,i,c,d):t.validate,p=si(n,s,f),g=n.let("valid");e.block$data(g,N),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function N(){if(t.errors===!1)R(),t.modifying&&rs(e),_(()=>e.error());else{const y=t.async?O():S();t.modifying&&rs(e),_(()=>aa(e,y))}}function O(){const y=n.let("ruleErrs",null);return n.try(()=>R((0,ge._)`await `),$=>n.assign(g,!1).if((0,ge._)`${$} instanceof ${d.ValidationError}`,()=>n.assign(y,(0,ge._)`${$}.errors`),()=>n.throw($))),y}function S(){const y=(0,ge._)`${p}.errors`;return n.assign(y,null),R(ge.nil),y}function R(y=t.async?(0,ge._)`await `:ge.nil){const $=d.opts.passContext?it.default.this:it.default.self,b=!("compile"in t&&!l||t.schema===!1);n.assign(g,(0,ge._)`${y}${(0,na.callValidateCode)(e,p,$,b)}`,t.modifying)}function _(y){var $;n.if((0,ge.not)(($=t.valid)!==null&&$!==void 0?$:g),y)}}qe.funcKeywordCode=oa;function rs(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,ge._)`${n.parentData}[${n.parentDataProperty}]`))}function aa(e,t){const{gen:r}=e;r.if((0,ge._)`Array.isArray(${t})`,()=>{r.assign(it.default.vErrors,(0,ge._)`${it.default.vErrors} === null ? ${t} : ${it.default.vErrors}.concat(${t})`).assign(it.default.errors,(0,ge._)`${it.default.vErrors}.length`),(0,sa.extendErrors)(e)},()=>e.error())}function ca({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function si(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,ge.stringify)(r)})}function la(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")}qe.validSchemaType=la;function ua({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 c=s.dependencies;if(c!=null&&c.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${c.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)}}qe.validateKeywordUsage=ua;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendSubschemaMode=Ze.extendSubschemaData=Ze.getSubschema=void 0;const Le=G,ii=X;function da(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:c}){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,Le._)`${e.schemaPath}${(0,Le.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[r],schemaPath:(0,Le._)`${e.schemaPath}${(0,Le.getProperty)(t)}${(0,Le.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,ii.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||c===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Ze.getSubschema=da;function fa(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:c}){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:f,dataPathArr:p,opts:g}=t,N=l.let("data",(0,Le._)`${t.data}${(0,Le.getProperty)(r)}`,!0);d(N),e.errorPath=(0,Le.str)`${f}${(0,ii.getErrorPath)(r,n,g.jsPropertySyntax)}`,e.parentDataProperty=(0,Le._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const f=s instanceof Le.Name?s:l.let("data",s,!0);d(f),c!==void 0&&(e.propertyName=c)}i&&(e.dataTypes=i);function d(f){e.data=f,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,f]}}Ze.extendSubschemaData=fa;function pa(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}Ze.extendSubschemaMode=pa;var me={},oi=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var c=i[s];if(!e(t[c],r[c]))return!1}return!0}return t!==t&&r!==r},ai={exports:{}},Qe=ai.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(){};lr(t,n,s,e,"",e)};Qe.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Qe.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Qe.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Qe.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 lr(e,t,r,n,s,i,c,l,d,f){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,c,l,d,f);for(var p in n){var g=n[p];if(Array.isArray(g)){if(p in Qe.arrayKeywords)for(var N=0;N<g.length;N++)lr(e,t,r,g[N],s+"/"+p+"/"+N,i,s,p,n,N)}else if(p in Qe.propsKeywords){if(g&&typeof g=="object")for(var O in g)lr(e,t,r,g[O],s+"/"+p+"/"+ha(O),i,s,p,n,O)}else(p in Qe.keywords||e.allKeys&&!(p in Qe.skipKeywords))&&lr(e,t,r,g,s+"/"+p,i,s,p,n)}r(n,s,i,c,l,d,f)}}function ha(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var ma=ai.exports;Object.defineProperty(me,"__esModule",{value:!0});me.getSchemaRefs=me.resolveUrl=me.normalizeId=me._getFullPath=me.getFullPath=me.inlineRef=void 0;const ya=X,ga=oi,$a=ma,_a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function va(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Vr(e):t?ci(e)<=t:!1}me.inlineRef=va;const wa=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Vr(e){for(const t in e){if(wa.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Vr)||typeof r=="object"&&Vr(r))return!0}return!1}function ci(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!_a.has(r)&&(typeof e[r]=="object"&&(0,ya.eachItem)(e[r],n=>t+=ci(n)),t===1/0))return 1/0}return t}function li(e,t="",r){r!==!1&&(t=Et(t));const n=e.parse(t);return ui(e,n)}me.getFullPath=li;function ui(e,t){return e.serialize(t).split("#")[0]+"#"}me._getFullPath=ui;const ba=/#\/?$/;function Et(e){return e?e.replace(ba,""):""}me.normalizeId=Et;function Ea(e,t,r){return r=Et(r),e.resolve(t,r)}me.resolveUrl=Ea;const Pa=/^[a-z_][-a-z0-9._]*$/i;function Sa(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Et(e[r]||t),i={"":s},c=li(n,s,!1),l={},d=new Set;return $a(e,{allKeys:!0},(g,N,O,S)=>{if(S===void 0)return;const R=c+N;let _=i[S];typeof g[r]=="string"&&(_=y.call(this,g[r])),$.call(this,g.$anchor),$.call(this,g.$dynamicAnchor),i[N]=_;function y(b){const I=this.opts.uriResolver.resolve;if(b=Et(_?I(_,b):b),d.has(b))throw p(b);d.add(b);let A=this.refs[b];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?f(g,A.schema,b):b!==Et(R)&&(b[0]==="#"?(f(g,l[b],b),l[b]=g):this.refs[b]=R),b}function $(b){if(typeof b=="string"){if(!Pa.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),l;function f(g,N,O){if(N!==void 0&&!ga(g,N))throw p(O)}function p(g){return new Error(`reference "${g}" resolves to more than one schema`)}}me.getSchemaRefs=Sa;Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getData=Ce.KeywordCxt=Ce.validateFunctionCode=void 0;const di=Pt,ns=Jt,nn=He,yr=Jt,Ta=Sr,Vt=qe,Ir=Ze,q=G,z=We,Ra=me,Ge=X,Lt=Kt;function ka(e){if(hi(e)&&(mi(e),pi(e))){Ca(e);return}fi(e,()=>(0,di.topBoolOrEmptySchema)(e))}Ce.validateFunctionCode=ka;function fi({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){s.code.es5?e.func(t,(0,q._)`${z.default.data}, ${z.default.valCxt}`,n.$async,()=>{e.code((0,q._)`"use strict"; ${ss(r,s)}`),Na(e,s),e.code(i)}):e.func(t,(0,q._)`${z.default.data}, ${Oa(s)}`,n.$async,()=>e.code(ss(r,s)).code(i))}function Oa(e){return(0,q._)`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${e.dynamicRef?(0,q._)`, ${z.default.dynamicAnchors}={}`:q.nil}}={}`}function Na(e,t){e.if(z.default.valCxt,()=>{e.var(z.default.instancePath,(0,q._)`${z.default.valCxt}.${z.default.instancePath}`),e.var(z.default.parentData,(0,q._)`${z.default.valCxt}.${z.default.parentData}`),e.var(z.default.parentDataProperty,(0,q._)`${z.default.valCxt}.${z.default.parentDataProperty}`),e.var(z.default.rootData,(0,q._)`${z.default.valCxt}.${z.default.rootData}`),t.dynamicRef&&e.var(z.default.dynamicAnchors,(0,q._)`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{e.var(z.default.instancePath,(0,q._)`""`),e.var(z.default.parentData,(0,q._)`undefined`),e.var(z.default.parentDataProperty,(0,q._)`undefined`),e.var(z.default.rootData,z.default.data),t.dynamicRef&&e.var(z.default.dynamicAnchors,(0,q._)`{}`)})}function Ca(e){const{schema:t,opts:r,gen:n}=e;fi(e,()=>{r.$comment&&t.$comment&&gi(e),Ma(e),n.let(z.default.vErrors,null),n.let(z.default.errors,0),r.unevaluated&&Ia(e),yi(e),qa(e)})}function Ia(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,q._)`${r}.evaluated`),t.if((0,q._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,q._)`${e.evaluated}.props`,(0,q._)`undefined`)),t.if((0,q._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,q._)`${e.evaluated}.items`,(0,q._)`undefined`))}function ss(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function ja(e,t){if(hi(e)&&(mi(e),pi(e))){Da(e,t);return}(0,di.boolOrEmptySchema)(e,t)}function pi({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 hi(e){return typeof e.schema!="boolean"}function Da(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&gi(e),Fa(e),La(e);const i=n.const("_errs",z.default.errors);yi(e,i),n.var(t,(0,q._)`${i} === ${z.default.errors}`)}function mi(e){(0,Ge.checkUnknownRules)(e),Aa(e)}function yi(e,t){if(e.opts.jtd)return is(e,[],!1,t);const r=(0,ns.getSchemaTypes)(e.schema),n=(0,ns.coerceAndCheckDataType)(e,r);is(e,r,!n,t)}function Aa(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ge.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Ma(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ge.checkStrictMode)(e,"default is ignored in the schema root")}function Fa(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Ra.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function La(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function gi({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const i=r.$comment;if(s.$comment===!0)e.code((0,q._)`${z.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const c=(0,q.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,q._)`${z.default.self}.opts.$comment(${i}, ${c}, ${l}.schema)`)}}function qa(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;r.$async?t.if((0,q._)`${z.default.errors} === 0`,()=>t.return(z.default.data),()=>t.throw((0,q._)`new ${s}(${z.default.vErrors})`)):(t.assign((0,q._)`${n}.errors`,z.default.vErrors),i.unevaluated&&Ua(e),t.return((0,q._)`${z.default.errors} === 0`))}function Ua({gen:e,evaluated:t,props:r,items:n}){r instanceof q.Name&&e.assign((0,q._)`${t}.props`,r),n instanceof q.Name&&e.assign((0,q._)`${t}.items`,n)}function is(e,t,r,n){const{gen:s,schema:i,data:c,allErrors:l,opts:d,self:f}=e,{RULES:p}=f;if(i.$ref&&(d.ignoreKeywordsWithRef||!(0,Ge.schemaHasRulesButRef)(i,p))){s.block(()=>vi(e,"$ref",p.all.$ref.definition));return}d.jtd||Va(e,t),s.block(()=>{for(const N of p.rules)g(N);g(p.post)});function g(N){(0,nn.shouldUseGroup)(i,N)&&(N.type?(s.if((0,yr.checkDataType)(N.type,c,d.strictNumbers)),os(e,N),t.length===1&&t[0]===N.type&&r&&(s.else(),(0,yr.reportTypeError)(e)),s.endIf()):os(e,N),l||s.if((0,q._)`${z.default.errors} === ${n||0}`))}}function os(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,Ta.assignDefaults)(e,t.type),r.block(()=>{for(const i of t.rules)(0,nn.shouldUseRule)(n,i)&&vi(e,i.keyword,i.definition,t.type)})}function Va(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(za(e,t),e.opts.allowUnionTypes||Wa(e,t),Ba(e,e.dataTypes))}function za(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{$i(e.dataTypes,r)||sn(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Ga(e,t)}}function Wa(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&sn(e,"use allowUnionTypes to allow union type keyword")}function Ba(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,nn.shouldUseRule)(e.schema,s)){const{type:i}=s.definition;i.length&&!i.some(c=>Ha(t,c))&&sn(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function Ha(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function $i(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Ga(e,t){const r=[];for(const n of e.dataTypes)$i(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function sn(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ge.checkStrictMode)(e,t,e.opts.strictTypes)}class _i{constructor(t,r,n){if((0,Vt.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,Ge.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",wi(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Vt.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",z.default.errors))}result(t,r,n){this.failResult((0,q.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,q.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,q._)`${r} !== undefined && (${(0,q.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?Lt.reportExtraError:Lt.reportError)(this,this.def.error,r)}$dataError(){(0,Lt.reportError)(this,this.def.$dataError||Lt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Lt.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=q.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=q.nil,r=q.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:i,def:c}=this;n.if((0,q.or)((0,q._)`${s} === undefined`,r)),t!==q.nil&&n.assign(t,!0),(i.length||c.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==q.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:i}=this;return(0,q.or)(c(),l());function c(){if(n.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");const d=Array.isArray(n)?n:[n];return(0,q._)`${(0,yr.checkDataTypes)(d,r,i.opts.strictNumbers,yr.DataType.Wrong)}`}return q.nil}function l(){if(s.validateSchema){const d=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,q._)`!${d}(${r})`}return q.nil}}subschema(t,r){const n=(0,Ir.getSubschema)(this.it,t);(0,Ir.extendSubschemaData)(n,this.it,t),(0,Ir.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return ja(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ge.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ge.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,q.Name)),!0}}Ce.KeywordCxt=_i;function vi(e,t,r,n){const s=new _i(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Vt.funcKeywordCode)(s,r):"macro"in r?(0,Vt.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Vt.funcKeywordCode)(s,r)}const xa=/^\/(?:[^~]|~0|~1)*$/,Ka=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function wi(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return z.default.rootData;if(e[0]==="/"){if(!xa.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,i=z.default.rootData}else{const f=Ka.exec(e);if(!f)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+f[1];if(s=f[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 c=i;const l=s.split("/");for(const f of l)f&&(i=(0,q._)`${i}${(0,q.getProperty)((0,Ge.unescapeJsonPointer)(f))}`,c=(0,q._)`${c} && ${i}`);return c;function d(f,p){return`Cannot access ${f} ${p} levels up, current level is ${t}`}}Ce.getData=wi;var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0});class Ja extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Qt.default=Ja;var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});const jr=me;class Qa extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,jr.resolveUrl)(t,r,n),this.missingSchema=(0,jr.normalizeId)((0,jr.getFullPath)(t,this.missingRef))}}Zt.default=Qa;var we={};Object.defineProperty(we,"__esModule",{value:!0});we.resolveSchema=we.getCompilingSchema=we.resolveRef=we.compileSchema=we.SchemaEnv=void 0;const ke=G,Za=Qt,st=We,Ne=me,as=X,Ya=Ce;class Tr{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,Ne.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={}}}we.SchemaEnv=Tr;function on(e){const t=bi.call(this,e);if(t)return t;const r=(0,Ne.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,c=new ke.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=c.scopeValue("Error",{ref:Za.default,code:(0,ke._)`require("ajv/dist/runtime/validation_error").default`}));const d=c.scopeName("validate");e.validateName=d;const f={gen:c,allErrors:this.opts.allErrors,data:st.default.data,parentData:st.default.parentData,parentDataProperty:st.default.parentDataProperty,dataNames:[st.default.data],dataPathArr:[ke.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:c.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ke.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:l,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ke.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ke._)`""`,opts:this.opts,self:this};let p;try{this._compilations.add(e),(0,Ya.validateFunctionCode)(f),c.optimize(this.opts.code.optimize);const g=c.toString();p=`${c.scopeRefs(st.default.scope)}return ${g}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const O=new Function(`${st.default.self}`,`${st.default.scope}`,p)(this,this.scope.get());if(this.scope.value(d,{ref:O}),O.errors=null,O.schema=e.schema,O.schemaEnv=e,e.$async&&(O.$async=!0),this.opts.code.source===!0&&(O.source={validateName:d,validateCode:g,scopeValues:c._values}),this.opts.unevaluated){const{props:S,items:R}=f;O.evaluated={props:S instanceof ke.Name?void 0:S,items:R instanceof ke.Name?void 0:R,dynamicProps:S instanceof ke.Name,dynamicItems:R instanceof ke.Name},O.source&&(O.source.evaluated=(0,ke.stringify)(O.evaluated))}return e.validate=O,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)}}we.compileSchema=on;function Xa(e,t,r){var n;r=(0,Ne.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=rc.call(this,e,r);if(i===void 0){const c=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;c&&(i=new Tr({schema:c,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=ec.call(this,i)}we.resolveRef=Xa;function ec(e){return(0,Ne.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:on.call(this,e)}function bi(e){for(const t of this._compilations)if(tc(t,e))return t}we.getCompilingSchema=bi;function tc(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function rc(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Rr.call(this,e,t)}function Rr(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Ne._getFullPath)(this.opts.uriResolver,r);let s=(0,Ne.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Dr.call(this,r,e);const i=(0,Ne.normalizeId)(n),c=this.refs[i]||this.schemas[i];if(typeof c=="string"){const l=Rr.call(this,e,c);return typeof(l==null?void 0:l.schema)!="object"?void 0:Dr.call(this,r,l)}if(typeof(c==null?void 0:c.schema)=="object"){if(c.validate||on.call(this,c),i===(0,Ne.normalizeId)(t)){const{schema:l}=c,{schemaId:d}=this.opts,f=l[d];return f&&(s=(0,Ne.resolveUrl)(this.opts.uriResolver,s,f)),new Tr({schema:l,schemaId:d,root:e,baseId:s})}return Dr.call(this,r,c)}}we.resolveSchema=Rr;const nc=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Dr(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,as.unescapeFragment)(l)];if(d===void 0)return;r=d;const f=typeof r=="object"&&r[this.opts.schemaId];!nc.has(l)&&f&&(t=(0,Ne.resolveUrl)(this.opts.uriResolver,t,f))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,as.schemaHasRulesButRef)(r,this.RULES)){const l=(0,Ne.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Rr.call(this,n,l)}const{schemaId:c}=this.opts;if(i=i||new Tr({schema:r,schemaId:c,root:n,baseId:t}),i.schema!==i.root.schema)return i}const sc="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",ic="Meta-schema for $data reference (JSON AnySchema extension proposal)",oc="object",ac=["$data"],cc={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},lc=!1,uc={$id:sc,description:ic,type:oc,required:ac,properties:cc,additionalProperties:lc};var an={},zr={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)})(_o,function(r){function n(){for(var u=arguments.length,a=Array(u),m=0;m<u;m++)a[m]=arguments[m];if(a.length>1){a[0]=a[0].slice(0,-1);for(var T=a.length-1,P=1;P<T;++P)a[P]=a[P].slice(1,-1);return a[T]=a[T].slice(1),a.join("")}else return a[0]}function s(u){return"(?:"+u+")"}function i(u){return u===void 0?"undefined":u===null?"null":Object.prototype.toString.call(u).split(" ").pop().split("]").shift().toLowerCase()}function c(u){return u.toUpperCase()}function l(u){return u!=null?u instanceof Array?u:typeof u.length!="number"||u.split||u.setInterval||u.call?[u]:Array.prototype.slice.call(u):[]}function d(u,a){var m=u;if(a)for(var T in a)m[T]=a[T];return m}function f(u){var a="[A-Za-z]",m="[0-9]",T=n(m,"[A-Fa-f]"),P=s(s("%[EFef]"+T+"%"+T+T+"%"+T+T)+"|"+s("%[89A-Fa-f]"+T+"%"+T+T)+"|"+s("%"+T+T)),U="[\\:\\/\\?\\#\\[\\]\\@]",V="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Y=n(U,V),te=u?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ae=u?"[\\uE000-\\uF8FF]":"[]",J=n(a,m,"[\\-\\.\\_\\~]",te);s(a+n(a,m,"[\\+\\-\\.]")+"*"),s(s(P+"|"+n(J,V,"[\\:]"))+"*");var ee=s(s("25[0-5]")+"|"+s("2[0-4]"+m)+"|"+s("1"+m+m)+"|"+s("0?[1-9]"+m)+"|0?0?"+m),ce=s(ee+"\\."+ee+"\\."+ee+"\\."+ee),B=s(T+"{1,4}"),ne=s(s(B+"\\:"+B)+"|"+ce),fe=s(s(B+"\\:")+"{6}"+ne),se=s("\\:\\:"+s(B+"\\:")+"{5}"+ne),xe=s(s(B)+"?\\:\\:"+s(B+"\\:")+"{4}"+ne),Ae=s(s(s(B+"\\:")+"{0,1}"+B)+"?\\:\\:"+s(B+"\\:")+"{3}"+ne),Me=s(s(s(B+"\\:")+"{0,2}"+B)+"?\\:\\:"+s(B+"\\:")+"{2}"+ne),_t=s(s(s(B+"\\:")+"{0,3}"+B)+"?\\:\\:"+B+"\\:"+ne),rt=s(s(s(B+"\\:")+"{0,4}"+B)+"?\\:\\:"+ne),Se=s(s(s(B+"\\:")+"{0,5}"+B)+"?\\:\\:"+B),Fe=s(s(s(B+"\\:")+"{0,6}"+B)+"?\\:\\:"),nt=s([fe,se,xe,Ae,Me,_t,rt,Se,Fe].join("|")),Be=s(s(J+"|"+P)+"+");s("[vV]"+T+"+\\."+n(J,V,"[\\:]")+"+"),s(s(P+"|"+n(J,V))+"*");var Mt=s(P+"|"+n(J,V,"[\\:\\@]"));return s(s(P+"|"+n(J,V,"[\\@]"))+"+"),s(s(Mt+"|"+n("[\\/\\?]",ae))+"*"),{NOT_SCHEME:new RegExp(n("[^]",a,m,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",J,V),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",J,V),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",J,V),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",J,V),"g"),NOT_QUERY:new RegExp(n("[^\\%]",J,V,"[\\:\\@\\/\\?]",ae),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",J,V,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",J,V),"g"),UNRESERVED:new RegExp(J,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",J,Y),"g"),PCT_ENCODED:new RegExp(P,"g"),IPV4ADDRESS:new RegExp("^("+ce+")$"),IPV6ADDRESS:new RegExp("^\\[?("+nt+")"+s(s("\\%25|\\%(?!"+T+"{2})")+"("+Be+")")+"?\\]?$")}}var p=f(!1),g=f(!0),N=function(){function u(a,m){var T=[],P=!0,U=!1,V=void 0;try{for(var Y=a[Symbol.iterator](),te;!(P=(te=Y.next()).done)&&(T.push(te.value),!(m&&T.length===m));P=!0);}catch(ae){U=!0,V=ae}finally{try{!P&&Y.return&&Y.return()}finally{if(U)throw V}}return T}return function(a,m){if(Array.isArray(a))return a;if(Symbol.iterator in Object(a))return u(a,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),O=function(u){if(Array.isArray(u)){for(var a=0,m=Array(u.length);a<u.length;a++)m[a]=u[a];return m}else return Array.from(u)},S=2147483647,R=36,_=1,y=26,$=38,b=700,I=72,A=128,w="-",k=/^xn--/,D=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ie=R-_,Z=Math.floor,Ee=String.fromCharCode;function de(u){throw new RangeError(x[u])}function Ye(u,a){for(var m=[],T=u.length;T--;)m[T]=a(u[T]);return m}function Xe(u,a){var m=u.split("@"),T="";m.length>1&&(T=m[0]+"@",u=m[1]),u=u.replace(W,".");var P=u.split("."),U=Ye(P,a).join(".");return T+U}function dt(u){for(var a=[],m=0,T=u.length;m<T;){var P=u.charCodeAt(m++);if(P>=55296&&P<=56319&&m<T){var U=u.charCodeAt(m++);(U&64512)==56320?a.push(((P&1023)<<10)+(U&1023)+65536):(a.push(P),m--)}else a.push(P)}return a}var kt=function(a){return String.fromCodePoint.apply(String,O(a))},ft=function(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:R},M=function(a,m){return a+22+75*(a<26)-((m!=0)<<5)},v=function(a,m,T){var P=0;for(a=T?Z(a/b):a>>1,a+=Z(a/m);a>ie*y>>1;P+=R)a=Z(a/ie);return Z(P+(ie+1)*a/(a+$))},j=function(a){var m=[],T=a.length,P=0,U=A,V=I,Y=a.lastIndexOf(w);Y<0&&(Y=0);for(var te=0;te<Y;++te)a.charCodeAt(te)>=128&&de("not-basic"),m.push(a.charCodeAt(te));for(var ae=Y>0?Y+1:0;ae<T;){for(var J=P,ee=1,ce=R;;ce+=R){ae>=T&&de("invalid-input");var B=ft(a.charCodeAt(ae++));(B>=R||B>Z((S-P)/ee))&&de("overflow"),P+=B*ee;var ne=ce<=V?_:ce>=V+y?y:ce-V;if(B<ne)break;var fe=R-ne;ee>Z(S/fe)&&de("overflow"),ee*=fe}var se=m.length+1;V=v(P-J,se,J==0),Z(P/se)>S-U&&de("overflow"),U+=Z(P/se),P%=se,m.splice(P++,0,U)}return String.fromCodePoint.apply(String,m)},E=function(a){var m=[];a=dt(a);var T=a.length,P=A,U=0,V=I,Y=!0,te=!1,ae=void 0;try{for(var J=a[Symbol.iterator](),ee;!(Y=(ee=J.next()).done);Y=!0){var ce=ee.value;ce<128&&m.push(Ee(ce))}}catch(Ft){te=!0,ae=Ft}finally{try{!Y&&J.return&&J.return()}finally{if(te)throw ae}}var B=m.length,ne=B;for(B&&m.push(w);ne<T;){var fe=S,se=!0,xe=!1,Ae=void 0;try{for(var Me=a[Symbol.iterator](),_t;!(se=(_t=Me.next()).done);se=!0){var rt=_t.value;rt>=P&&rt<fe&&(fe=rt)}}catch(Ft){xe=!0,Ae=Ft}finally{try{!se&&Me.return&&Me.return()}finally{if(xe)throw Ae}}var Se=ne+1;fe-P>Z((S-U)/Se)&&de("overflow"),U+=(fe-P)*Se,P=fe;var Fe=!0,nt=!1,Be=void 0;try{for(var Mt=a[Symbol.iterator](),xn;!(Fe=(xn=Mt.next()).done);Fe=!0){var Kn=xn.value;if(Kn<P&&++U>S&&de("overflow"),Kn==P){for(var er=U,tr=R;;tr+=R){var rr=tr<=V?_:tr>=V+y?y:tr-V;if(er<rr)break;var Jn=er-rr,Qn=R-rr;m.push(Ee(M(rr+Jn%Qn,0))),er=Z(Jn/Qn)}m.push(Ee(M(er,0))),V=v(U,Se,ne==B),U=0,++ne}}}catch(Ft){nt=!0,Be=Ft}finally{try{!Fe&&Mt.return&&Mt.return()}finally{if(nt)throw Be}}++U,++P}return m.join("")},o=function(a){return Xe(a,function(m){return k.test(m)?j(m.slice(4).toLowerCase()):m})},h=function(a){return Xe(a,function(m){return D.test(m)?"xn--"+E(m):m})},C={version:"2.1.0",ucs2:{decode:dt,encode:kt},decode:j,encode:E,toASCII:h,toUnicode:o},F={};function L(u){var a=u.charCodeAt(0),m=void 0;return a<16?m="%0"+a.toString(16).toUpperCase():a<128?m="%"+a.toString(16).toUpperCase():a<2048?m="%"+(a>>6|192).toString(16).toUpperCase()+"%"+(a&63|128).toString(16).toUpperCase():m="%"+(a>>12|224).toString(16).toUpperCase()+"%"+(a>>6&63|128).toString(16).toUpperCase()+"%"+(a&63|128).toString(16).toUpperCase(),m}function K(u){for(var a="",m=0,T=u.length;m<T;){var P=parseInt(u.substr(m+1,2),16);if(P<128)a+=String.fromCharCode(P),m+=3;else if(P>=194&&P<224){if(T-m>=6){var U=parseInt(u.substr(m+4,2),16);a+=String.fromCharCode((P&31)<<6|U&63)}else a+=u.substr(m,6);m+=6}else if(P>=224){if(T-m>=9){var V=parseInt(u.substr(m+4,2),16),Y=parseInt(u.substr(m+7,2),16);a+=String.fromCharCode((P&15)<<12|(V&63)<<6|Y&63)}else a+=u.substr(m,9);m+=9}else a+=u.substr(m,3),m+=3}return a}function Q(u,a){function m(T){var P=K(T);return P.match(a.UNRESERVED)?P:T}return u.scheme&&(u.scheme=String(u.scheme).replace(a.PCT_ENCODED,m).toLowerCase().replace(a.NOT_SCHEME,"")),u.userinfo!==void 0&&(u.userinfo=String(u.userinfo).replace(a.PCT_ENCODED,m).replace(a.NOT_USERINFO,L).replace(a.PCT_ENCODED,c)),u.host!==void 0&&(u.host=String(u.host).replace(a.PCT_ENCODED,m).toLowerCase().replace(a.NOT_HOST,L).replace(a.PCT_ENCODED,c)),u.path!==void 0&&(u.path=String(u.path).replace(a.PCT_ENCODED,m).replace(u.scheme?a.NOT_PATH:a.NOT_PATH_NOSCHEME,L).replace(a.PCT_ENCODED,c)),u.query!==void 0&&(u.query=String(u.query).replace(a.PCT_ENCODED,m).replace(a.NOT_QUERY,L).replace(a.PCT_ENCODED,c)),u.fragment!==void 0&&(u.fragment=String(u.fragment).replace(a.PCT_ENCODED,m).replace(a.NOT_FRAGMENT,L).replace(a.PCT_ENCODED,c)),u}function oe(u){return u.replace(/^0*(.*)/,"$1")||"0"}function Ie(u,a){var m=u.match(a.IPV4ADDRESS)||[],T=N(m,2),P=T[1];return P?P.split(".").map(oe).join("."):u}function pt(u,a){var m=u.match(a.IPV6ADDRESS)||[],T=N(m,3),P=T[1],U=T[2];if(P){for(var V=P.toLowerCase().split("::").reverse(),Y=N(V,2),te=Y[0],ae=Y[1],J=ae?ae.split(":").map(oe):[],ee=te.split(":").map(oe),ce=a.IPV4ADDRESS.test(ee[ee.length-1]),B=ce?7:8,ne=ee.length-B,fe=Array(B),se=0;se<B;++se)fe[se]=J[se]||ee[ne+se]||"";ce&&(fe[B-1]=Ie(fe[B-1],a));var xe=fe.reduce(function(Se,Fe,nt){if(!Fe||Fe==="0"){var Be=Se[Se.length-1];Be&&Be.index+Be.length===nt?Be.length++:Se.push({index:nt,length:1})}return Se},[]),Ae=xe.sort(function(Se,Fe){return Fe.length-Se.length})[0],Me=void 0;if(Ae&&Ae.length>1){var _t=fe.slice(0,Ae.index),rt=fe.slice(Ae.index+Ae.length);Me=_t.join(":")+"::"+rt.join(":")}else Me=fe.join(":");return U&&(Me+="%"+U),Me}else return u}var Ot=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Nt="".match(/(){0}/)[1]===void 0;function be(u){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m={},T=a.iri!==!1?g:p;a.reference==="suffix"&&(u=(a.scheme?a.scheme+":":"")+"//"+u);var P=u.match(Ot);if(P){Nt?(m.scheme=P[1],m.userinfo=P[3],m.host=P[4],m.port=parseInt(P[5],10),m.path=P[6]||"",m.query=P[7],m.fragment=P[8],isNaN(m.port)&&(m.port=P[5])):(m.scheme=P[1]||void 0,m.userinfo=u.indexOf("@")!==-1?P[3]:void 0,m.host=u.indexOf("//")!==-1?P[4]:void 0,m.port=parseInt(P[5],10),m.path=P[6]||"",m.query=u.indexOf("?")!==-1?P[7]:void 0,m.fragment=u.indexOf("#")!==-1?P[8]:void 0,isNaN(m.port)&&(m.port=u.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),m.host&&(m.host=pt(Ie(m.host,T),T)),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",a.reference&&a.reference!=="suffix"&&a.reference!==m.reference&&(m.error=m.error||"URI is not a "+a.reference+" reference.");var U=F[(a.scheme||m.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!U||!U.unicodeSupport)){if(m.host&&(a.domainHost||U&&U.domainHost))try{m.host=C.toASCII(m.host.replace(T.PCT_ENCODED,K).toLowerCase())}catch(V){m.error=m.error||"Host's domain name can not be converted to ASCII via punycode: "+V}Q(m,p)}else Q(m,T);U&&U.parse&&U.parse(m,a)}else m.error=m.error||"URI can not be parsed.";return m}function Ct(u,a){var m=a.iri!==!1?g:p,T=[];return u.userinfo!==void 0&&(T.push(u.userinfo),T.push("@")),u.host!==void 0&&T.push(pt(Ie(String(u.host),m),m).replace(m.IPV6ADDRESS,function(P,U,V){return"["+U+(V?"%25"+V:"")+"]"})),(typeof u.port=="number"||typeof u.port=="string")&&(T.push(":"),T.push(String(u.port))),T.length?T.join(""):void 0}var ht=/^\.\.?\//,mt=/^\/\.(\/|$)/,yt=/^\/\.\.(\/|$)/,It=/^\/?(?:.|\n)*?(?=\/|$)/;function je(u){for(var a=[];u.length;)if(u.match(ht))u=u.replace(ht,"");else if(u.match(mt))u=u.replace(mt,"/");else if(u.match(yt))u=u.replace(yt,"/"),a.pop();else if(u==="."||u==="..")u="";else{var m=u.match(It);if(m){var T=m[0];u=u.slice(T.length),a.push(T)}else throw new Error("Unexpected dot segment condition")}return a.join("")}function _e(u){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=a.iri?g:p,T=[],P=F[(a.scheme||u.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(u,a),u.host&&!m.IPV6ADDRESS.test(u.host)){if(a.domainHost||P&&P.domainHost)try{u.host=a.iri?C.toUnicode(u.host):C.toASCII(u.host.replace(m.PCT_ENCODED,K).toLowerCase())}catch(Y){u.error=u.error||"Host's domain name can not be converted to "+(a.iri?"Unicode":"ASCII")+" via punycode: "+Y}}Q(u,m),a.reference!=="suffix"&&u.scheme&&(T.push(u.scheme),T.push(":"));var U=Ct(u,a);if(U!==void 0&&(a.reference!=="suffix"&&T.push("//"),T.push(U),u.path&&u.path.charAt(0)!=="/"&&T.push("/")),u.path!==void 0){var V=u.path;!a.absolutePath&&(!P||!P.absolutePath)&&(V=je(V)),U===void 0&&(V=V.replace(/^\/\//,"/%2F")),T.push(V)}return u.query!==void 0&&(T.push("?"),T.push(u.query)),u.fragment!==void 0&&(T.push("#"),T.push(u.fragment)),T.join("")}function gt(u,a){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},T=arguments[3],P={};return T||(u=be(_e(u,m),m),a=be(_e(a,m),m)),m=m||{},!m.tolerant&&a.scheme?(P.scheme=a.scheme,P.userinfo=a.userinfo,P.host=a.host,P.port=a.port,P.path=je(a.path||""),P.query=a.query):(a.userinfo!==void 0||a.host!==void 0||a.port!==void 0?(P.userinfo=a.userinfo,P.host=a.host,P.port=a.port,P.path=je(a.path||""),P.query=a.query):(a.path?(a.path.charAt(0)==="/"?P.path=je(a.path):((u.userinfo!==void 0||u.host!==void 0||u.port!==void 0)&&!u.path?P.path="/"+a.path:u.path?P.path=u.path.slice(0,u.path.lastIndexOf("/")+1)+a.path:P.path=a.path,P.path=je(P.path)),P.query=a.query):(P.path=u.path,a.query!==void 0?P.query=a.query:P.query=u.query),P.userinfo=u.userinfo,P.host=u.host,P.port=u.port),P.scheme=u.scheme),P.fragment=a.fragment,P}function jt(u,a,m){var T=d({scheme:"null"},m);return _e(gt(be(u,T),be(a,T),T,!0),T)}function et(u,a){return typeof u=="string"?u=_e(be(u,a),a):i(u)==="object"&&(u=be(_e(u,a),a)),u}function Dt(u,a,m){return typeof u=="string"?u=_e(be(u,m),m):i(u)==="object"&&(u=_e(u,m)),typeof a=="string"?a=_e(be(a,m),m):i(a)==="object"&&(a=_e(a,m)),u===a}function Xt(u,a){return u&&u.toString().replace(!a||!a.iri?p.ESCAPE:g.ESCAPE,L)}function Pe(u,a){return u&&u.toString().replace(!a||!a.iri?p.PCT_ENCODED:g.PCT_ENCODED,K)}var tt={scheme:"http",domainHost:!0,parse:function(a,m){return a.host||(a.error=a.error||"HTTP URIs must have a host."),a},serialize:function(a,m){var T=String(a.scheme).toLowerCase()==="https";return(a.port===(T?443:80)||a.port==="")&&(a.port=void 0),a.path||(a.path="/"),a}},qn={scheme:"https",domainHost:tt.domainHost,parse:tt.parse,serialize:tt.serialize};function Un(u){return typeof u.secure=="boolean"?u.secure:String(u.scheme).toLowerCase()==="wss"}var At={scheme:"ws",domainHost:!0,parse:function(a,m){var T=a;return T.secure=Un(T),T.resourceName=(T.path||"/")+(T.query?"?"+T.query:""),T.path=void 0,T.query=void 0,T},serialize:function(a,m){if((a.port===(Un(a)?443:80)||a.port==="")&&(a.port=void 0),typeof a.secure=="boolean"&&(a.scheme=a.secure?"wss":"ws",a.secure=void 0),a.resourceName){var T=a.resourceName.split("?"),P=N(T,2),U=P[0],V=P[1];a.path=U&&U!=="/"?U:void 0,a.query=V,a.resourceName=void 0}return a.fragment=void 0,a}},Vn={scheme:"wss",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize},ji={},zn="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",De="[0-9A-Fa-f]",Di=s(s("%[EFef]"+De+"%"+De+De+"%"+De+De)+"|"+s("%[89A-Fa-f]"+De+"%"+De+De)+"|"+s("%"+De+De)),Ai="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Mi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Fi=n(Mi,'[\\"\\\\]'),Li="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",qi=new RegExp(zn,"g"),$t=new RegExp(Di,"g"),Ui=new RegExp(n("[^]",Ai,"[\\.]",'[\\"]',Fi),"g"),Wn=new RegExp(n("[^]",zn,Li),"g"),Vi=Wn;function Or(u){var a=K(u);return a.match(qi)?a:u}var Bn={scheme:"mailto",parse:function(a,m){var T=a,P=T.to=T.path?T.path.split(","):[];if(T.path=void 0,T.query){for(var U=!1,V={},Y=T.query.split("&"),te=0,ae=Y.length;te<ae;++te){var J=Y[te].split("=");switch(J[0]){case"to":for(var ee=J[1].split(","),ce=0,B=ee.length;ce<B;++ce)P.push(ee[ce]);break;case"subject":T.subject=Pe(J[1],m);break;case"body":T.body=Pe(J[1],m);break;default:U=!0,V[Pe(J[0],m)]=Pe(J[1],m);break}}U&&(T.headers=V)}T.query=void 0;for(var ne=0,fe=P.length;ne<fe;++ne){var se=P[ne].split("@");if(se[0]=Pe(se[0]),m.unicodeSupport)se[1]=Pe(se[1],m).toLowerCase();else try{se[1]=C.toASCII(Pe(se[1],m).toLowerCase())}catch(xe){T.error=T.error||"Email address's domain name can not be converted to ASCII via punycode: "+xe}P[ne]=se.join("@")}return T},serialize:function(a,m){var T=a,P=l(a.to);if(P){for(var U=0,V=P.length;U<V;++U){var Y=String(P[U]),te=Y.lastIndexOf("@"),ae=Y.slice(0,te).replace($t,Or).replace($t,c).replace(Ui,L),J=Y.slice(te+1);try{J=m.iri?C.toUnicode(J):C.toASCII(Pe(J,m).toLowerCase())}catch(ne){T.error=T.error||"Email address's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+ne}P[U]=ae+"@"+J}T.path=P.join(",")}var ee=a.headers=a.headers||{};a.subject&&(ee.subject=a.subject),a.body&&(ee.body=a.body);var ce=[];for(var B in ee)ee[B]!==ji[B]&&ce.push(B.replace($t,Or).replace($t,c).replace(Wn,L)+"="+ee[B].replace($t,Or).replace($t,c).replace(Vi,L));return ce.length&&(T.query=ce.join("&")),T}},zi=/^([^\:]+)\:(.*)/,Hn={scheme:"urn",parse:function(a,m){var T=a.path&&a.path.match(zi),P=a;if(T){var U=m.scheme||P.scheme||"urn",V=T[1].toLowerCase(),Y=T[2],te=U+":"+(m.nid||V),ae=F[te];P.nid=V,P.nss=Y,P.path=void 0,ae&&(P=ae.parse(P,m))}else P.error=P.error||"URN can not be parsed.";return P},serialize:function(a,m){var T=m.scheme||a.scheme||"urn",P=a.nid,U=T+":"+(m.nid||P),V=F[U];V&&(a=V.serialize(a,m));var Y=a,te=a.nss;return Y.path=(P||m.nid)+":"+te,Y}},Wi=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Gn={scheme:"urn:uuid",parse:function(a,m){var T=a;return T.uuid=T.nss,T.nss=void 0,!m.tolerant&&(!T.uuid||!T.uuid.match(Wi))&&(T.error=T.error||"UUID is not valid."),T},serialize:function(a,m){var T=a;return T.nss=(a.uuid||"").toLowerCase(),T}};F[tt.scheme]=tt,F[qn.scheme]=qn,F[At.scheme]=At,F[Vn.scheme]=Vn,F[Bn.scheme]=Bn,F[Hn.scheme]=Hn,F[Gn.scheme]=Gn,r.SCHEMES=F,r.pctEncChar=L,r.pctDecChars=K,r.parse=be,r.removeDotSegments=je,r.serialize=_e,r.resolveComponents=gt,r.resolve=jt,r.normalize=et,r.equal=Dt,r.escapeComponent=Xt,r.unescapeComponent=Pe,Object.defineProperty(r,"__esModule",{value:!0})})})(zr,zr.exports);var dc=zr.exports;Object.defineProperty(an,"__esModule",{value:!0});const Ei=dc;Ei.code='require("ajv/dist/runtime/uri").default';an.default=Ei;(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=Ce;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=G;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=Qt,s=Zt,i=ct,c=we,l=G,d=me,f=Jt,p=X,g=uc,N=an,O=(M,v)=>new RegExp(M,v);O.code="new RegExp";const S=["removeAdditional","useDefaults","coerceTypes"],R=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$=200;function b(M){var v,j,E,o,h,C,F,L,K,Q,oe,Ie,pt,Ot,Nt,be,Ct,ht,mt,yt,It,je,_e,gt,jt;const et=M.strict,Dt=(v=M.code)===null||v===void 0?void 0:v.optimize,Xt=Dt===!0||Dt===void 0?1:Dt||0,Pe=(E=(j=M.code)===null||j===void 0?void 0:j.regExp)!==null&&E!==void 0?E:O,tt=(o=M.uriResolver)!==null&&o!==void 0?o:N.default;return{strictSchema:(C=(h=M.strictSchema)!==null&&h!==void 0?h:et)!==null&&C!==void 0?C:!0,strictNumbers:(L=(F=M.strictNumbers)!==null&&F!==void 0?F:et)!==null&&L!==void 0?L:!0,strictTypes:(Q=(K=M.strictTypes)!==null&&K!==void 0?K:et)!==null&&Q!==void 0?Q:"log",strictTuples:(Ie=(oe=M.strictTuples)!==null&&oe!==void 0?oe:et)!==null&&Ie!==void 0?Ie:"log",strictRequired:(Ot=(pt=M.strictRequired)!==null&&pt!==void 0?pt:et)!==null&&Ot!==void 0?Ot:!1,code:M.code?{...M.code,optimize:Xt,regExp:Pe}:{optimize:Xt,regExp:Pe},loopRequired:(Nt=M.loopRequired)!==null&&Nt!==void 0?Nt:$,loopEnum:(be=M.loopEnum)!==null&&be!==void 0?be:$,meta:(Ct=M.meta)!==null&&Ct!==void 0?Ct:!0,messages:(ht=M.messages)!==null&&ht!==void 0?ht:!0,inlineRefs:(mt=M.inlineRefs)!==null&&mt!==void 0?mt:!0,schemaId:(yt=M.schemaId)!==null&&yt!==void 0?yt:"$id",addUsedSchema:(It=M.addUsedSchema)!==null&&It!==void 0?It:!0,validateSchema:(je=M.validateSchema)!==null&&je!==void 0?je:!0,validateFormats:(_e=M.validateFormats)!==null&&_e!==void 0?_e:!0,unicodeRegExp:(gt=M.unicodeRegExp)!==null&&gt!==void 0?gt:!0,int32range:(jt=M.int32range)!==null&&jt!==void 0?jt:!0,uriResolver:tt}}class I{constructor(v={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,v=this.opts={...v,...b(v)};const{es5:j,lines:E}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:R,es5:j,lines:E}),this.logger=Z(v.logger);const o=v.validateFormats;v.validateFormats=!1,this.RULES=(0,i.getRules)(),A.call(this,_,v,"NOT SUPPORTED"),A.call(this,y,v,"DEPRECATED","warn"),this._metaOpts=x.call(this),v.formats&&D.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),v.keywords&&W.call(this,v.keywords),typeof v.meta=="object"&&this.addMetaSchema(v.meta),k.call(this),v.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:v,meta:j,schemaId:E}=this.opts;let o=g;E==="id"&&(o={...g},o.id=o.$id,delete o.$id),j&&v&&this.addMetaSchema(o,o[E],!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 E;if(typeof v=="string"){if(E=this.getSchema(v),!E)throw new Error(`no schema with key or ref "${v}"`)}else E=this.compile(v);const o=E(j);return"$async"in E||(this.errors=E.errors),o}compile(v,j){const E=this._addSchema(v,j);return E.validate||this._compileSchemaEnv(E)}compileAsync(v,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:E}=this.opts;return o.call(this,v,j);async function o(Q,oe){await h.call(this,Q.$schema);const Ie=this._addSchema(Q,oe);return Ie.validate||C.call(this,Ie)}async function h(Q){Q&&!this.getSchema(Q)&&await o.call(this,{$ref:Q},!0)}async function C(Q){try{return this._compileSchemaEnv(Q)}catch(oe){if(!(oe instanceof s.default))throw oe;return F.call(this,oe),await L.call(this,oe.missingSchema),C.call(this,Q)}}function F({missingSchema:Q,missingRef:oe}){if(this.refs[Q])throw new Error(`AnySchema ${Q} is loaded but ${oe} cannot be resolved`)}async function L(Q){const oe=await K.call(this,Q);this.refs[Q]||await h.call(this,oe.$schema),this.refs[Q]||this.addSchema(oe,Q,j)}async function K(Q){const oe=this._loading[Q];if(oe)return oe;try{return await(this._loading[Q]=E(Q))}finally{delete this._loading[Q]}}}addSchema(v,j,E,o=this.opts.validateSchema){if(Array.isArray(v)){for(const C of v)this.addSchema(C,void 0,E,o);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,E,j,o,!0),this}addMetaSchema(v,j,E=this.opts.validateSchema){return this.addSchema(v,j,!0,E),this}validateSchema(v,j){if(typeof v=="boolean")return!0;let E;if(E=v.$schema,E!==void 0&&typeof E!="string")throw new Error("$schema must be a string");if(E=E||this.opts.defaultMeta||this.defaultMeta(),!E)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const o=this.validate(E,v);if(!o&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return o}getSchema(v){let j;for(;typeof(j=w.call(this,v))=="string";)v=j;if(j===void 0){const{schemaId:E}=this.opts,o=new c.SchemaEnv({schema:{},schemaId:E});if(j=c.resolveSchema.call(this,o,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 E=v[this.opts.schemaId];return E&&(E=(0,d.normalizeId)(E),delete this.schemas[E],delete this.refs[E]),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 E;if(typeof v=="string")E=v,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=E);else if(typeof v=="object"&&j===void 0){if(j=v,E=j.keyword,Array.isArray(E)&&!E.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(de.call(this,E,j),!j)return(0,p.eachItem)(E,h=>Ye.call(this,h)),this;dt.call(this,j);const o={...j,type:(0,f.getJSONTypes)(j.type),schemaType:(0,f.getJSONTypes)(j.schemaType)};return(0,p.eachItem)(E,o.type.length===0?h=>Ye.call(this,h,o):h=>o.type.forEach(C=>Ye.call(this,h,o,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 E of j.rules){const o=E.rules.findIndex(h=>h.keyword===v);o>=0&&E.rules.splice(o,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:E="data"}={}){return!v||v.length===0?"No errors":v.map(o=>`${E}${o.instancePath} ${o.message}`).reduce((o,h)=>o+j+h)}$dataMetaSchema(v,j){const E=this.RULES.all;v=JSON.parse(JSON.stringify(v));for(const o of j){const h=o.split("/").slice(1);let C=v;for(const F of h)C=C[F];for(const F in E){const L=E[F];if(typeof L!="object")continue;const{$data:K}=L.definition,Q=C[F];K&&Q&&(C[F]=ft(Q))}}return v}_removeAllSchemas(v,j){for(const E in v){const o=v[E];(!j||j.test(E))&&(typeof o=="string"?delete v[E]:o&&!o.meta&&(this._cache.delete(o.schema),delete v[E]))}}_addSchema(v,j,E,o=this.opts.validateSchema,h=this.opts.addUsedSchema){let C;const{schemaId:F}=this.opts;if(typeof v=="object")C=v[F];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof v!="boolean")throw new Error("schema must be object or boolean")}let L=this._cache.get(v);if(L!==void 0)return L;E=(0,d.normalizeId)(C||E);const K=d.getSchemaRefs.call(this,v,E);return L=new c.SchemaEnv({schema:v,schemaId:F,meta:j,baseId:E,localRefs:K}),this._cache.set(L.schema,L),h&&!E.startsWith("#")&&(E&&this._checkUnique(E),this.refs[E]=L),o&&this.validateSchema(v,!0),L}_checkUnique(v){if(this.schemas[v]||this.refs[v])throw new Error(`schema with key or id "${v}" already exists`)}_compileSchemaEnv(v){if(v.meta?this._compileMetaSchema(v):c.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{c.compileSchema.call(this,v)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function A(M,v,j,E="error"){for(const o in M){const h=o;h in v&&this.logger[E](`${j}: option ${o}. ${M[h]}`)}}function w(M){return M=(0,d.normalizeId)(M),this.schemas[M]||this.refs[M]}function k(){const M=this.opts.schemas;if(M)if(Array.isArray(M))this.addSchema(M);else for(const v in M)this.addSchema(M[v],v)}function D(){for(const M in this.opts.formats){const v=this.opts.formats[M];v&&this.addFormat(M,v)}}function W(M){if(Array.isArray(M)){this.addVocabulary(M);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const v in M){const j=M[v];j.keyword||(j.keyword=v),this.addKeyword(j)}}function x(){const M={...this.opts};for(const v of S)delete M[v];return M}const ie={log(){},warn(){},error(){}};function Z(M){if(M===!1)return ie;if(M===void 0)return console;if(M.log&&M.warn&&M.error)return M;throw new Error("logger must implement log, warn and error methods")}const Ee=/^[a-z_$][a-z0-9_$:-]*$/i;function de(M,v){const{RULES:j}=this;if((0,p.eachItem)(M,E=>{if(j.keywords[E])throw new Error(`Keyword ${E} is already defined`);if(!Ee.test(E))throw new Error(`Keyword ${E} has invalid name`)}),!!v&&v.$data&&!("code"in v||"validate"in v))throw new Error('$data keyword must have "code" or "validate" function')}function Ye(M,v,j){var E;const o=v==null?void 0:v.post;if(j&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let C=o?h.post:h.rules.find(({type:L})=>L===j);if(C||(C={type:j,rules:[]},h.rules.push(C)),h.keywords[M]=!0,!v)return;const F={keyword:M,definition:{...v,type:(0,f.getJSONTypes)(v.type),schemaType:(0,f.getJSONTypes)(v.schemaType)}};v.before?Xe.call(this,C,F,v.before):C.rules.push(F),h.all[M]=F,(E=v.implements)===null||E===void 0||E.forEach(L=>this.addKeyword(L))}function Xe(M,v,j){const E=M.rules.findIndex(o=>o.keyword===j);E>=0?M.rules.splice(E,0,v):(M.rules.push(v),this.logger.warn(`rule ${j} is not defined`))}function dt(M){let{metaSchema:v}=M;v!==void 0&&(M.$data&&this.opts.$data&&(v=ft(v)),M.validateSchema=this.compile(v,!0))}const kt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ft(M){return{anyOf:[M,kt]}}})(Ys);var cn={},ln={},un={};Object.defineProperty(un,"__esModule",{value:!0});const fc={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};un.default=fc;var lt={};Object.defineProperty(lt,"__esModule",{value:!0});lt.callRef=lt.getValidate=void 0;const pc=Zt,cs=H,ve=G,wt=We,ls=we,nr=X,hc={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:c,opts:l,self:d}=n,{root:f}=i;if((r==="#"||r==="#/")&&s===f.baseId)return g();const p=ls.resolveRef.call(d,f,s,r);if(p===void 0)throw new pc.default(n.opts.uriResolver,s,r);if(p instanceof ls.SchemaEnv)return N(p);return O(p);function g(){if(i===f)return ur(e,c,i,i.$async);const S=t.scopeValue("root",{ref:f});return ur(e,(0,ve._)`${S}.validate`,f,f.$async)}function N(S){const R=Pi(e,S);ur(e,R,S,S.$async)}function O(S){const R=t.scopeValue("schema",l.code.source===!0?{ref:S,code:(0,ve.stringify)(S)}:{ref:S}),_=t.name("valid"),y=e.subschema({schema:S,dataTypes:[],schemaPath:ve.nil,topSchemaRef:R,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function Pi(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ve._)`${r.scopeValue("wrapper",{ref:t})}.validate`}lt.getValidate=Pi;function ur(e,t,r,n){const{gen:s,it:i}=e,{allErrors:c,schemaEnv:l,opts:d}=i,f=d.passContext?wt.default.this:ve.nil;n?p():g();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");const S=s.let("valid");s.try(()=>{s.code((0,ve._)`await ${(0,cs.callValidateCode)(e,t,f)}`),O(t),c||s.assign(S,!0)},R=>{s.if((0,ve._)`!(${R} instanceof ${i.ValidationError})`,()=>s.throw(R)),N(R),c||s.assign(S,!1)}),e.ok(S)}function g(){e.result((0,cs.callValidateCode)(e,t,f),()=>O(t),()=>N(t))}function N(S){const R=(0,ve._)`${S}.errors`;s.assign(wt.default.vErrors,(0,ve._)`${wt.default.vErrors} === null ? ${R} : ${wt.default.vErrors}.concat(${R})`),s.assign(wt.default.errors,(0,ve._)`${wt.default.vErrors}.length`)}function O(S){var R;if(!i.opts.unevaluated)return;const _=(R=r==null?void 0:r.validate)===null||R===void 0?void 0:R.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=nr.mergeEvaluated.props(s,_.props,i.props));else{const y=s.var("props",(0,ve._)`${S}.evaluated.props`);i.props=nr.mergeEvaluated.props(s,y,i.props,ve.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=nr.mergeEvaluated.items(s,_.items,i.items));else{const y=s.var("items",(0,ve._)`${S}.evaluated.items`);i.items=nr.mergeEvaluated.items(s,y,i.items,ve.Name)}}}lt.callRef=ur;lt.default=hc;Object.defineProperty(ln,"__esModule",{value:!0});const mc=un,yc=lt,gc=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",mc.default,yc.default];ln.default=gc;var dn={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});const gr=G,Je=gr.operators,$r={maximum:{okStr:"<=",ok:Je.LTE,fail:Je.GT},minimum:{okStr:">=",ok:Je.GTE,fail:Je.LT},exclusiveMaximum:{okStr:"<",ok:Je.LT,fail:Je.GTE},exclusiveMinimum:{okStr:">",ok:Je.GT,fail:Je.LTE}},$c={message:({keyword:e,schemaCode:t})=>(0,gr.str)`must be ${$r[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,gr._)`{comparison: ${$r[e].okStr}, limit: ${t}}`},_c={keyword:Object.keys($r),type:"number",schemaType:"number",$data:!0,error:$c,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,gr._)`${r} ${$r[t].fail} ${n} || isNaN(${r})`)}};fn.default=_c;var pn={};Object.defineProperty(pn,"__esModule",{value:!0});const zt=G,vc={message:({schemaCode:e})=>(0,zt.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,zt._)`{multipleOf: ${e}}`},wc={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:vc,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,c=t.let("res"),l=i?(0,zt._)`Math.abs(Math.round(${c}) - ${c}) > 1e-${i}`:(0,zt._)`${c} !== parseInt(${c})`;e.fail$data((0,zt._)`(${n} === 0 || (${c} = ${r}/${n}, ${l}))`)}};pn.default=wc;var hn={},mn={};Object.defineProperty(mn,"__esModule",{value:!0});function Si(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}mn.default=Si;Si.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(hn,"__esModule",{value:!0});const ot=G,bc=X,Ec=mn,Pc={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,ot.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,ot._)`{limit: ${e}}`},Sc={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Pc,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?ot.operators.GT:ot.operators.LT,c=s.opts.unicode===!1?(0,ot._)`${r}.length`:(0,ot._)`${(0,bc.useFunc)(e.gen,Ec.default)}(${r})`;e.fail$data((0,ot._)`${c} ${i} ${n}`)}};hn.default=Sc;var yn={};Object.defineProperty(yn,"__esModule",{value:!0});const Tc=H,_r=G,Rc={message:({schemaCode:e})=>(0,_r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,_r._)`{pattern: ${e}}`},kc={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Rc,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:i}=e,c=i.opts.unicodeRegExp?"u":"",l=r?(0,_r._)`(new RegExp(${s}, ${c}))`:(0,Tc.usePattern)(e,n);e.fail$data((0,_r._)`!${l}.test(${t})`)}};yn.default=kc;var gn={};Object.defineProperty(gn,"__esModule",{value:!0});const Wt=G,Oc={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,Wt.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Wt._)`{limit: ${e}}`},Nc={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Oc,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Wt.operators.GT:Wt.operators.LT;e.fail$data((0,Wt._)`Object.keys(${r}).length ${s} ${n}`)}};gn.default=Nc;var $n={};Object.defineProperty($n,"__esModule",{value:!0});const qt=H,Bt=G,Cc=X,Ic={message:({params:{missingProperty:e}})=>(0,Bt.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Bt._)`{missingProperty: ${e}}`},jc={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Ic,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:c}=e,{opts:l}=c;if(!i&&r.length===0)return;const d=r.length>=l.loopRequired;if(c.allErrors?f():p(),l.strictRequired){const O=e.parentSchema.properties,{definedProperties:S}=e.it;for(const R of r)if((O==null?void 0:O[R])===void 0&&!S.has(R)){const _=c.schemaEnv.baseId+c.errSchemaPath,y=`required property "${R}" is not defined at "${_}" (strictRequired)`;(0,Cc.checkStrictMode)(c,y,c.opts.strictRequired)}}function f(){if(d||i)e.block$data(Bt.nil,g);else for(const O of r)(0,qt.checkReportMissingProp)(e,O)}function p(){const O=t.let("missing");if(d||i){const S=t.let("valid",!0);e.block$data(S,()=>N(O,S)),e.ok(S)}else t.if((0,qt.checkMissingProp)(e,r,O)),(0,qt.reportMissingProp)(e,O),t.else()}function g(){t.forOf("prop",n,O=>{e.setParams({missingProperty:O}),t.if((0,qt.noPropertyInData)(t,s,O,l.ownProperties),()=>e.error())})}function N(O,S){e.setParams({missingProperty:O}),t.forOf(O,n,()=>{t.assign(S,(0,qt.propertyInData)(t,s,O,l.ownProperties)),t.if((0,Bt.not)(S),()=>{e.error(),t.break()})},Bt.nil)}}};$n.default=jc;var _n={};Object.defineProperty(_n,"__esModule",{value:!0});const Ht=G,Dc={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,Ht.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Ht._)`{limit: ${e}}`},Ac={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Dc,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Ht.operators.GT:Ht.operators.LT;e.fail$data((0,Ht._)`${r}.length ${s} ${n}`)}};_n.default=Ac;var vn={},Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});const Ti=oi;Ti.code='require("ajv/dist/runtime/equal").default';Yt.default=Ti;Object.defineProperty(vn,"__esModule",{value:!0});const Ar=Jt,he=G,Mc=X,Fc=Yt,Lc={message:({params:{i:e,j:t}})=>(0,he.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,he._)`{i: ${e}, j: ${t}}`},qc={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Lc,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:c,it:l}=e;if(!n&&!s)return;const d=t.let("valid"),f=i.items?(0,Ar.getSchemaTypes)(i.items):[];e.block$data(d,p,(0,he._)`${c} === false`),e.ok(d);function p(){const S=t.let("i",(0,he._)`${r}.length`),R=t.let("j");e.setParams({i:S,j:R}),t.assign(d,!0),t.if((0,he._)`${S} > 1`,()=>(g()?N:O)(S,R))}function g(){return f.length>0&&!f.some(S=>S==="object"||S==="array")}function N(S,R){const _=t.name("item"),y=(0,Ar.checkDataTypes)(f,_,l.opts.strictNumbers,Ar.DataType.Wrong),$=t.const("indices",(0,he._)`{}`);t.for((0,he._)`;${S}--;`,()=>{t.let(_,(0,he._)`${r}[${S}]`),t.if(y,(0,he._)`continue`),f.length>1&&t.if((0,he._)`typeof ${_} == "string"`,(0,he._)`${_} += "_"`),t.if((0,he._)`typeof ${$}[${_}] == "number"`,()=>{t.assign(R,(0,he._)`${$}[${_}]`),e.error(),t.assign(d,!1).break()}).code((0,he._)`${$}[${_}] = ${S}`)})}function O(S,R){const _=(0,Mc.useFunc)(t,Fc.default),y=t.name("outer");t.label(y).for((0,he._)`;${S}--;`,()=>t.for((0,he._)`${R} = ${S}; ${R}--;`,()=>t.if((0,he._)`${_}(${r}[${S}], ${r}[${R}])`,()=>{e.error(),t.assign(d,!1).break(y)})))}}};vn.default=qc;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});const Wr=G,Uc=X,Vc=Yt,zc={message:"must be equal to constant",params:({schemaCode:e})=>(0,Wr._)`{allowedValue: ${e}}`},Wc={keyword:"const",$data:!0,error:zc,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Wr._)`!${(0,Uc.useFunc)(t,Vc.default)}(${r}, ${s})`):e.fail((0,Wr._)`${i} !== ${r}`)}};wn.default=Wc;var bn={};Object.defineProperty(bn,"__esModule",{value:!0});const Ut=G,Bc=X,Hc=Yt,Gc={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ut._)`{allowedValues: ${e}}`},xc={keyword:"enum",schemaType:"array",$data:!0,error:Gc,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:c}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=c.opts.loopEnum;let d;const f=()=>d??(d=(0,Bc.useFunc)(t,Hc.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 O=t.const("vSchema",i);p=(0,Ut.or)(...s.map((S,R)=>N(O,R)))}e.pass(p);function g(){t.assign(p,!1),t.forOf("v",i,O=>t.if((0,Ut._)`${f()}(${r}, ${O})`,()=>t.assign(p,!0).break()))}function N(O,S){const R=s[S];return typeof R=="object"&&R!==null?(0,Ut._)`${f()}(${r}, ${O}[${S}])`:(0,Ut._)`${r} === ${R}`}}};bn.default=xc;Object.defineProperty(dn,"__esModule",{value:!0});const Kc=fn,Jc=pn,Qc=hn,Zc=yn,Yc=gn,Xc=$n,el=_n,tl=vn,rl=wn,nl=bn,sl=[Kc.default,Jc.default,Qc.default,Zc.default,Yc.default,Xc.default,el.default,tl.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},rl.default,nl.default];dn.default=sl;var En={},Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.validateAdditionalItems=void 0;const at=G,Br=X,il={message:({params:{len:e}})=>(0,at.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,at._)`{limit: ${e}}`},ol={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:il,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Br.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ri(e,n)}};function Ri(e,t){const{gen:r,schema:n,data:s,keyword:i,it:c}=e;c.items=!0;const l=r.const("len",(0,at._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,at._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,Br.alwaysValidSchema)(c,n)){const f=r.var("valid",(0,at._)`${l} <= ${t.length}`);r.if((0,at.not)(f),()=>d(f)),e.ok(f)}function d(f){r.forRange("i",t.length,l,p=>{e.subschema({keyword:i,dataProp:p,dataPropType:Br.Type.Num},f),c.allErrors||r.if((0,at.not)(f),()=>r.break())})}}Tt.validateAdditionalItems=Ri;Tt.default=ol;var Pn={},Rt={};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.validateTuple=void 0;const us=G,dr=X,al=H,cl={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return ki(e,"additionalItems",t);r.items=!0,!(0,dr.alwaysValidSchema)(r,t)&&e.ok((0,al.validateArray)(e))}};function ki(e,t,r=e.schema){const{gen:n,parentSchema:s,data:i,keyword:c,it:l}=e;p(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=dr.mergeEvaluated.items(n,r.length,l.items));const d=n.name("valid"),f=n.const("len",(0,us._)`${i}.length`);r.forEach((g,N)=>{(0,dr.alwaysValidSchema)(l,g)||(n.if((0,us._)`${f} > ${N}`,()=>e.subschema({keyword:c,schemaProp:N,dataProp:N},d)),e.ok(d))});function p(g){const{opts:N,errSchemaPath:O}=l,S=r.length,R=S===g.minItems&&(S===g.maxItems||g[t]===!1);if(N.strictTuples&&!R){const _=`"${c}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${O}"`;(0,dr.checkStrictMode)(l,_,N.strictTuples)}}}Rt.validateTuple=ki;Rt.default=cl;Object.defineProperty(Pn,"__esModule",{value:!0});const ll=Rt,ul={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ll.validateTuple)(e,"items")};Pn.default=ul;var Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});const ds=G,dl=X,fl=H,pl=Tt,hl={message:({params:{len:e}})=>(0,ds.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ds._)`{limit: ${e}}`},ml={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hl,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,dl.alwaysValidSchema)(n,t)&&(s?(0,pl.validateAdditionalItems)(e,s):e.ok((0,fl.validateArray)(e)))}};Sn.default=ml;var Tn={};Object.defineProperty(Tn,"__esModule",{value:!0});const Re=G,sr=X,yl={message:({params:{min:e,max:t}})=>t===void 0?(0,Re.str)`must contain at least ${e} valid item(s)`:(0,Re.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Re._)`{minContains: ${e}}`:(0,Re._)`{minContains: ${e}, maxContains: ${t}}`},gl={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yl,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;let c,l;const{minContains:d,maxContains:f}=n;i.opts.next?(c=d===void 0?1:d,l=f):c=1;const p=t.const("len",(0,Re._)`${s}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,sr.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&c>l){(0,sr.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,sr.alwaysValidSchema)(i,r)){let R=(0,Re._)`${p} >= ${c}`;l!==void 0&&(R=(0,Re._)`${R} && ${p} <= ${l}`),e.pass(R);return}i.items=!0;const g=t.name("valid");l===void 0&&c===1?O(g,()=>t.if(g,()=>t.break())):c===0?(t.let(g,!0),l!==void 0&&t.if((0,Re._)`${s}.length > 0`,N)):(t.let(g,!1),N()),e.result(g,()=>e.reset());function N(){const R=t.name("_valid"),_=t.let("count",0);O(R,()=>t.if(R,()=>S(_)))}function O(R,_){t.forRange("i",0,p,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:sr.Type.Num,compositeRule:!0},R),_()})}function S(R){t.code((0,Re._)`${R}++`),l===void 0?t.if((0,Re._)`${R} >= ${c}`,()=>t.assign(g,!0).break()):(t.if((0,Re._)`${R} > ${l}`,()=>t.assign(g,!1).break()),c===1?t.assign(g,!0):t.if((0,Re._)`${R} >= ${c}`,()=>t.assign(g,!0)))}}};Tn.default=gl;var Oi={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=G,r=X,n=H;e.error={message:({params:{property:d,depsCount:f,deps:p}})=>{const g=f===1?"property":"properties";return(0,t.str)`must have ${g} ${p} when property ${d} is present`},params:({params:{property:d,depsCount:f,deps:p,missingProperty:g}})=>(0,t._)`{property: ${d},
668
633
  missingProperty: ${g},
669
- depsCount: ${u},
670
- deps: ${f}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,f]=i(d);o(d,u),l(d,f)}};function i({schema:d}){const u={},f={};for(const g in d){if(g==="__proto__")continue;const N=Array.isArray(d[g])?u:f;N[g]=d[g]}return[u,f]}function o(d,u=d.schema){const{gen:f,data:g,it:N}=d;if(Object.keys(u).length===0)return;const C=f.let("missing");for(const S in u){const R=u[S];if(R.length===0)continue;const y=(0,n.propertyInData)(f,g,S,N.opts.ownProperties);d.setParams({property:S,depsCount:R.length,deps:R.join(", ")}),N.allErrors?f.if(y,()=>{for(const _ of R)(0,n.checkReportMissingProp)(d,_)}):(f.if((0,t._)`${y} && (${(0,n.checkMissingProp)(d,R,C)})`),(0,n.reportMissingProp)(d,C),f.else())}}e.validatePropertyDeps=o;function l(d,u=d.schema){const{gen:f,data:g,keyword:N,it:C}=d,S=f.name("valid");for(const R in u)(0,r.alwaysValidSchema)(C,u[R])||(f.if((0,n.propertyInData)(f,g,R,C.opts.ownProperties),()=>{const y=d.subschema({keyword:N,schemaProp:R},S);d.mergeValidEvaluated(y,S)},()=>f.var(S,!0)),d.ok(S))}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),f=(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&&!f.length?S(y):t.if(N(y),()=>S(y))})}function N(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 f.length&&(_=(0,codegen_1$5.or)(_,...f.map($=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,$)}.test(${y})`))),(0,codegen_1$5.not)(_)}function C(y){t.code((0,codegen_1$5._)`delete ${s}[${y}]`)}function S(y){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){C(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"?(R(y,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),C(y)})):(R(y,_),l||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function R(y,_,$){const b={keyword:"additionalProperties",dataProp:y,dataPropType:util_1$8.Type.Str};$===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,_)}}};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)?f(g):(t.if((0,code_1$2.propertyInData)(t,s,g,i.opts.ownProperties)),f(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 f(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(R=>(0,util_1$6.alwaysValidSchema)(i,r[R]));if(l.length===0||d.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,f=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;N();function N(){for(const R of l)u&&C(R),i.allErrors?S(R):(t.var(f,!0),S(R),t.if(f))}function C(R){for(const y in u)new RegExp(R).test(y)&&(0,util_1$6.checkStrictMode)(i,`property ${y} matches pattern ${R} (use allowMatchingProperties)`)}function S(R){t.forIn("key",n,y=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,R)}.test(${y})`,()=>{const _=d.includes(R);_||e.subschema({keyword:"patternProperties",schemaProp:R,dataProp:y,dataPropType:util_2.Type.Str},f),i.opts.unevaluated&&g!==!0?t.assign((0,codegen_1$4._)`${g}[${y}]`,!0):!_&&!i.allErrors&&t.if((0,codegen_1$4.not)(f),()=>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((f,g)=>{let N;(0,util_1$4.alwaysValidSchema)(s,f)?t.var(d,!0):N=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),N&&e.mergeEvaluated(N,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 f=t.let("ifClause");e.setParams({ifClause:f}),t.if(l,u("then",f),u("else",f))}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 f=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(f)}function u(f,g){return()=>{const N=e.subschema({keyword:f},l);t.assign(o,l),e.mergeValidEvaluated(N,o),g?t.assign(g,(0,codegen_1$2._)`${f}`):e.setParams({ifClause:f})}}}};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:f,self:g}=l;if(!d.validateFormats)return;s?N():C();function N(){const S=r.scopeValue("formats",{ref:g.formats,code:d.code.formats}),R=r.const("fDef",(0,codegen_1$1._)`${S}[${o}]`),y=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${R} == "object" && !(${R} instanceof RegExp)`,()=>r.assign(y,(0,codegen_1$1._)`${R}.type || "string"`).assign(_,(0,codegen_1$1._)`${R}.validate`),()=>r.assign(y,(0,codegen_1$1._)`"string"`).assign(_,R)),e.fail$data((0,codegen_1$1.or)($(),b()));function $(){return d.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${o} && !${_}`}function b(){const I=f.$async?(0,codegen_1$1._)`(${R}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,A=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${y} === ${t} && !${A}`}}function C(){const S=g.formats[i];if(!S){$();return}if(S===!0)return;const[R,y,_]=b(S);R===t&&e.pass(I());function $(){if(d.strictSchema===!1){g.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function b(A){const w=A instanceof RegExp?(0,codegen_1$1.regexpCode)(A):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:A,code:w});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,codegen_1$1._)`${k}.validate`]:["string",A,k]}function I(){if(typeof S=="object"&&!(S instanceof RegExp)&&S.async){if(!f.$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"`,()=>f(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:u,tagName:l})),e.ok(d);function f(){const C=N();t.if(!1);for(const S in C)t.elseIf((0,codegen_1._)`${u} === ${S}`),t.assign(d,g(C[S]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function g(C){const S=t.name("valid"),R=e.subschema({keyword:"oneOf",schemaProp:C},S);return e.mergeEvaluated(R,codegen_1.Name),S}function N(){var C;const S={},R=_(s);let y=!0;for(let I=0;I<o.length;I++){let A=o[I];A!=null&&A.$ref&&!(0,util_1.schemaHasRulesButRef)(A,i.self.RULES)&&(A=compile_1.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,A==null?void 0:A.$ref),A instanceof compile_1.SchemaEnv&&(A=A.schema));const w=(C=A==null?void 0:A.properties)===null||C===void 0?void 0:C[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);y=y&&(R||_(A)),$(w,I)}if(!y)throw new Error(`discriminator: "${l}" must be required`);return S;function _({required:I}){return Array.isArray(I)&&I.includes(l)}function $(I,A){if(I.const)b(I.const,A);else if(I.enum)for(const w of I.enum)b(w,A);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function b(I,A){if(typeof I!="string"||I in S)throw new Error(`discriminator: "${l}" values must be unique strings`);S[I]=A}}}};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(S=>this.addVocabulary(S)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const S=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(S,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 f=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var g=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var N=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return N.default}})})(ajv$1,ajv$1.exports);var ajvExports=ajv$1.exports;const Ajv=getDefaultExportFromCjs(ajvExports),$schema="http://json-schema.org/schema",$ref="#/definitions/Blueprint",definitions={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",enum:["kitchen-sink","light"]},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants in wp-config.php. Possible values are:
634
+ depsCount: ${f},
635
+ deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[f,p]=i(d);c(d,f),l(d,p)}};function i({schema:d}){const f={},p={};for(const g in d){if(g==="__proto__")continue;const N=Array.isArray(d[g])?f:p;N[g]=d[g]}return[f,p]}function c(d,f=d.schema){const{gen:p,data:g,it:N}=d;if(Object.keys(f).length===0)return;const O=p.let("missing");for(const S in f){const R=f[S];if(R.length===0)continue;const _=(0,n.propertyInData)(p,g,S,N.opts.ownProperties);d.setParams({property:S,depsCount:R.length,deps:R.join(", ")}),N.allErrors?p.if(_,()=>{for(const y of R)(0,n.checkReportMissingProp)(d,y)}):(p.if((0,t._)`${_} && (${(0,n.checkMissingProp)(d,R,O)})`),(0,n.reportMissingProp)(d,O),p.else())}}e.validatePropertyDeps=c;function l(d,f=d.schema){const{gen:p,data:g,keyword:N,it:O}=d,S=p.name("valid");for(const R in f)(0,r.alwaysValidSchema)(O,f[R])||(p.if((0,n.propertyInData)(p,g,R,O.opts.ownProperties),()=>{const _=d.subschema({keyword:N,schemaProp:R},S);d.mergeValidEvaluated(_,S)},()=>p.var(S,!0)),d.ok(S))}e.validateSchemaDeps=l,e.default=s})(Oi);var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});const Ni=G,$l=X,_l={message:"property name must be valid",params:({params:e})=>(0,Ni._)`{propertyName: ${e.propertyName}}`},vl={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_l,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,$l.alwaysValidSchema)(s,r))return;const i=t.name("valid");t.forIn("key",n,c=>{e.setParams({propertyName:c}),e.subschema({keyword:"propertyNames",data:c,dataTypes:["string"],propertyName:c,compositeRule:!0},i),t.if((0,Ni.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};Rn.default=vl;var kr={};Object.defineProperty(kr,"__esModule",{value:!0});const ir=H,Oe=G,wl=We,or=X,bl={message:"must NOT have additional properties",params:({params:e})=>(0,Oe._)`{additionalProperty: ${e.additionalProperty}}`},El={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:bl,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:c}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:d}=c;if(c.props=!0,d.removeAdditional!=="all"&&(0,or.alwaysValidSchema)(c,r))return;const f=(0,ir.allSchemaProperties)(n.properties),p=(0,ir.allSchemaProperties)(n.patternProperties);g(),e.ok((0,Oe._)`${i} === ${wl.default.errors}`);function g(){t.forIn("key",s,_=>{!f.length&&!p.length?S(_):t.if(N(_),()=>S(_))})}function N(_){let y;if(f.length>8){const $=(0,or.schemaRefOrVal)(c,n.properties,"properties");y=(0,ir.isOwnProperty)(t,$,_)}else f.length?y=(0,Oe.or)(...f.map($=>(0,Oe._)`${_} === ${$}`)):y=Oe.nil;return p.length&&(y=(0,Oe.or)(y,...p.map($=>(0,Oe._)`${(0,ir.usePattern)(e,$)}.test(${_})`))),(0,Oe.not)(y)}function O(_){t.code((0,Oe._)`delete ${s}[${_}]`)}function S(_){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){O(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,or.alwaysValidSchema)(c,r)){const y=t.name("valid");d.removeAdditional==="failing"?(R(_,y,!1),t.if((0,Oe.not)(y),()=>{e.reset(),O(_)})):(R(_,y),l||t.if((0,Oe.not)(y),()=>t.break()))}}function R(_,y,$){const b={keyword:"additionalProperties",dataProp:_,dataPropType:or.Type.Str};$===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};kr.default=El;var kn={};Object.defineProperty(kn,"__esModule",{value:!0});const Pl=Ce,fs=H,Mr=X,ps=kr,Sl={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&&ps.default.code(new Pl.KeywordCxt(i,ps.default,"additionalProperties"));const c=(0,fs.allSchemaProperties)(r);for(const g of c)i.definedProperties.add(g);i.opts.unevaluated&&c.length&&i.props!==!0&&(i.props=Mr.mergeEvaluated.props(t,(0,Mr.toHash)(c),i.props));const l=c.filter(g=>!(0,Mr.alwaysValidSchema)(i,r[g]));if(l.length===0)return;const d=t.name("valid");for(const g of l)f(g)?p(g):(t.if((0,fs.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 f(g){return i.opts.useDefaults&&!i.compositeRule&&r[g].default!==void 0}function p(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},d)}}};kn.default=Sl;var On={};Object.defineProperty(On,"__esModule",{value:!0});const hs=H,ar=G,ms=X,ys=X,Tl={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:c}=i,l=(0,hs.allSchemaProperties)(r),d=l.filter(R=>(0,ms.alwaysValidSchema)(i,r[R]));if(l.length===0||d.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const f=c.strictSchema&&!c.allowMatchingProperties&&s.properties,p=t.name("valid");i.props!==!0&&!(i.props instanceof ar.Name)&&(i.props=(0,ys.evaluatedPropsToName)(t,i.props));const{props:g}=i;N();function N(){for(const R of l)f&&O(R),i.allErrors?S(R):(t.var(p,!0),S(R),t.if(p))}function O(R){for(const _ in f)new RegExp(R).test(_)&&(0,ms.checkStrictMode)(i,`property ${_} matches pattern ${R} (use allowMatchingProperties)`)}function S(R){t.forIn("key",n,_=>{t.if((0,ar._)`${(0,hs.usePattern)(e,R)}.test(${_})`,()=>{const y=d.includes(R);y||e.subschema({keyword:"patternProperties",schemaProp:R,dataProp:_,dataPropType:ys.Type.Str},p),i.opts.unevaluated&&g!==!0?t.assign((0,ar._)`${g}[${_}]`,!0):!y&&!i.allErrors&&t.if((0,ar.not)(p),()=>t.break())})})}}};On.default=Tl;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const Rl=X,kl={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,Rl.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"}};Nn.default=kl;var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});const Ol=H,Nl={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ol.validateUnion,error:{message:"must match a schema in anyOf"}};Cn.default=Nl;var In={};Object.defineProperty(In,"__esModule",{value:!0});const fr=G,Cl=X,Il={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,fr._)`{passingSchemas: ${e.passing}}`},jl={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Il,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const i=r,c=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(f),e.result(c,()=>e.reset(),()=>e.error(!0));function f(){i.forEach((p,g)=>{let N;(0,Cl.alwaysValidSchema)(s,p)?t.var(d,!0):N=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},d),g>0&&t.if((0,fr._)`${d} && ${c}`).assign(c,!1).assign(l,(0,fr._)`[${l}, ${g}]`).else(),t.if(d,()=>{t.assign(c,!0),t.assign(l,g),N&&e.mergeEvaluated(N,fr.Name)})})}}};In.default=jl;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});const Dl=X,Al={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((i,c)=>{if((0,Dl.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:c},s);e.ok(s),e.mergeEvaluated(l)})}};jn.default=Al;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const vr=G,Ci=X,Ml={message:({params:e})=>(0,vr.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,vr._)`{failingKeyword: ${e.ifClause}}`},Fl={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ml,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Ci.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=gs(n,"then"),i=gs(n,"else");if(!s&&!i)return;const c=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,f("then",p),f("else",p))}else s?t.if(l,f("then")):t.if((0,vr.not)(l),f("else"));e.pass(c,()=>e.error(!0));function d(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(p)}function f(p,g){return()=>{const N=e.subschema({keyword:p},l);t.assign(c,l),e.mergeValidEvaluated(N,c),g?t.assign(g,(0,vr._)`${p}`):e.setParams({ifClause:p})}}}};function gs(e,t){const r=e.schema[t];return r!==void 0&&!(0,Ci.alwaysValidSchema)(e,r)}Dn.default=Fl;var An={};Object.defineProperty(An,"__esModule",{value:!0});const Ll=X,ql={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Ll.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};An.default=ql;Object.defineProperty(En,"__esModule",{value:!0});const Ul=Tt,Vl=Pn,zl=Rt,Wl=Sn,Bl=Tn,Hl=Oi,Gl=Rn,xl=kr,Kl=kn,Jl=On,Ql=Nn,Zl=Cn,Yl=In,Xl=jn,eu=Dn,tu=An;function ru(e=!1){const t=[Ql.default,Zl.default,Yl.default,Xl.default,eu.default,tu.default,Gl.default,xl.default,Hl.default,Kl.default,Jl.default];return e?t.push(Vl.default,Wl.default):t.push(Ul.default,zl.default),t.push(Bl.default),t}En.default=ru;var Mn={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const le=G,nu={message:({schemaCode:e})=>(0,le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,le._)`{format: ${e}}`},su={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:nu,code(e,t){const{gen:r,data:n,$data:s,schema:i,schemaCode:c,it:l}=e,{opts:d,errSchemaPath:f,schemaEnv:p,self:g}=l;if(!d.validateFormats)return;s?N():O();function N(){const S=r.scopeValue("formats",{ref:g.formats,code:d.code.formats}),R=r.const("fDef",(0,le._)`${S}[${c}]`),_=r.let("fType"),y=r.let("format");r.if((0,le._)`typeof ${R} == "object" && !(${R} instanceof RegExp)`,()=>r.assign(_,(0,le._)`${R}.type || "string"`).assign(y,(0,le._)`${R}.validate`),()=>r.assign(_,(0,le._)`"string"`).assign(y,R)),e.fail$data((0,le.or)($(),b()));function $(){return d.strictSchema===!1?le.nil:(0,le._)`${c} && !${y}`}function b(){const I=p.$async?(0,le._)`(${R}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,le._)`${y}(${n})`,A=(0,le._)`(typeof ${y} == "function" ? ${I} : ${y}.test(${n}))`;return(0,le._)`${y} && ${y} !== true && ${_} === ${t} && !${A}`}}function O(){const S=g.formats[i];if(!S){$();return}if(S===!0)return;const[R,_,y]=b(S);R===t&&e.pass(I());function $(){if(d.strictSchema===!1){g.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${f}"`}}function b(A){const w=A instanceof RegExp?(0,le.regexpCode)(A):d.code.formats?(0,le._)`${d.code.formats}${(0,le.getProperty)(i)}`:void 0,k=r.scopeValue("formats",{key:i,ref:A,code:w});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,le._)`${k}.validate`]:["string",A,k]}function I(){if(typeof S=="object"&&!(S instanceof RegExp)&&S.async){if(!p.$async)throw new Error("async format in sync schema");return(0,le._)`await ${y}(${n})`}return typeof _=="function"?(0,le._)`${y}(${n})`:(0,le._)`${y}.test(${n})`}}}};Fn.default=su;Object.defineProperty(Mn,"__esModule",{value:!0});const iu=Fn,ou=[iu.default];Mn.default=ou;var St={};Object.defineProperty(St,"__esModule",{value:!0});St.contentVocabulary=St.metadataVocabulary=void 0;St.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];St.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(cn,"__esModule",{value:!0});const au=ln,cu=dn,lu=En,uu=Mn,$s=St,du=[au.default,cu.default,(0,lu.default)(),uu.default,$s.metadataVocabulary,$s.contentVocabulary];cn.default=du;var Ln={},Ii={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(Ii);Object.defineProperty(Ln,"__esModule",{value:!0});const bt=G,Hr=Ii,_s=we,fu=X,pu={message:({params:{discrError:e,tagName:t}})=>e===Hr.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,bt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},hu={keyword:"discriminator",type:"object",schemaType:"object",error:pu,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:c}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const 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(!c)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),f=t.const("tag",(0,bt._)`${r}${(0,bt.getProperty)(l)}`);t.if((0,bt._)`typeof ${f} == "string"`,()=>p(),()=>e.error(!1,{discrError:Hr.DiscrError.Tag,tag:f,tagName:l})),e.ok(d);function p(){const O=N();t.if(!1);for(const S in O)t.elseIf((0,bt._)`${f} === ${S}`),t.assign(d,g(O[S]));t.else(),e.error(!1,{discrError:Hr.DiscrError.Mapping,tag:f,tagName:l}),t.endIf()}function g(O){const S=t.name("valid"),R=e.subschema({keyword:"oneOf",schemaProp:O},S);return e.mergeEvaluated(R,bt.Name),S}function N(){var O;const S={},R=y(s);let _=!0;for(let I=0;I<c.length;I++){let A=c[I];A!=null&&A.$ref&&!(0,fu.schemaHasRulesButRef)(A,i.self.RULES)&&(A=_s.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,A==null?void 0:A.$ref),A instanceof _s.SchemaEnv&&(A=A.schema));const w=(O=A==null?void 0:A.properties)===null||O===void 0?void 0:O[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);_=_&&(R||y(A)),$(w,I)}if(!_)throw new Error(`discriminator: "${l}" must be required`);return S;function y({required:I}){return Array.isArray(I)&&I.includes(l)}function $(I,A){if(I.const)b(I.const,A);else if(I.enum)for(const w of I.enum)b(w,A);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function b(I,A){if(typeof I!="string"||I in S)throw new Error(`discriminator: "${l}" values must be unique strings`);S[I]=A}}}};Ln.default=hu;const mu="http://json-schema.org/draft-07/schema#",yu="http://json-schema.org/draft-07/schema#",gu="Core schema meta-schema",$u={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:[]}},_u=["object","boolean"],vu={$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:"#"}},wu={$schema:mu,$id:yu,title:gu,definitions:$u,type:_u,properties:vu,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=Ys,n=cn,s=Ln,i=wu,c=["/properties"],l="http://json-schema.org/draft-07/schema";class d extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(S=>this.addVocabulary(S)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const S=this.opts.$data?this.$dataMetaSchema(i,c):i;this.addMetaSchema(S,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 f=Ce;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return f.KeywordCxt}});var p=G;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=Qt;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var N=Zt;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return N.default}})})(qr,qr.exports);var bu=qr.exports;const Eu=vo(bu),Pu="http://json-schema.org/schema",Su="#/definitions/Blueprint",Tu={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate"},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define"},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",enum:["kitchen-sink","light"]},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants in wp-config.php. Possible values are:
671
636
 
672
637
  - 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.
673
638
 
674
639
  - 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.
675
640
  This option is only kept in here to avoid breaking Blueprint schema validation
676
- for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWxr"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1}]}}],description:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema,$ref,definitions},{wpCLI,...otherStepHandlers}=allStepHandlers,keyedStepHandlers={...otherStepHandlers,"wp-cli":wpCLI,importFile:otherStepHandlers.importWxr};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=()=>{}}={}){var g,N,C,S,R,y,_;e={...e,steps:(e.steps||[]).filter(isStepDefinition).filter(isStepStillSupported)};for(const $ of e.steps)typeof $=="object"&&$.step==="importFile"&&($.step="importWxr",logger.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const $=e.plugins.map(b=>typeof b=="string"?b.startsWith("https://")?{resource:"url",url:b}:{resource:"wordpress.org/plugins",slug:b}:b).map(b=>({step:"installPlugin",pluginZipFile:b}));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"),logger.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(N=e.steps)==null||N.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const i=(C=e.steps)==null?void 0:C.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="importWxr");i!==void 0&&i>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),logger.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(S=e.steps)==null||S.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(($,b)=>{var I;return $+(((I=b.progress)==null?void 0:I.weight)||1)},0),f=d.map($=>compileStep($,{semaphore:r,rootProgressTracker:t,totalProgressWeight:u}));return{versions:{php:compileVersion((R=e.preferredVersions)==null?void 0:R.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:b}of f)for(const I of b)I.setPlayground($),I.isAsync&&I.resolve();for(const[b,{run:I,step:A}]of Object.entries(f))try{const w=await I($);n(w,A)}catch(w){throw logger.error(w),new Error(`Error when executing the blueprint step #${b} (${JSON.stringify(A)}) ${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 isStepStillSupported(e){return e.step==="setPhpIniEntry"?(logger.warn('The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'),!1):!0}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var f;const s=r.stage((((f=e.progress)==null?void 0:f.weight)||1)/n),i={};for(const g of Object.keys(e)){let N=e[g];isFileReference(N)&&(N=Resource.create(N,{semaphore:t})),i[g]=N}const o=async g=>{var N;try{return s.fillSlowly(),await keyedStepHandlers[e.step](g,await resolveArguments(i),{tracker:s,initialCaption:(N=e.progress)==null?void 0:N.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.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpCLI=wpCLI$1;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
641
+ for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWxr"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"resetData"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1}]}}],description:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},Ru={$schema:Pu,$ref:Su,definitions:Tu},{wpCLI:ku,...vs}=po,Ou={...vs,"wp-cli":ku,importFile:vs.importWxr};function Nu(e,{progress:t=new Yr,semaphore:r=new Gi({concurrency:3}),onStepCompleted:n=()=>{}}={}){var g,N,O,S,R,_,y;e={...e,steps:(e.steps||[]).filter(Au).filter(Mu)};for(const $ of e.steps)typeof $=="object"&&$.step==="importFile"&&($.step="importWxr",$e.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(b=>typeof b=="string"?b.startsWith("https://")?{resource:"url",url:b}:{resource:"wordpress.org/plugins",slug:b}:b).map(b=>({step:"installPlugin",pluginZipFile:b}));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"),$e.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. ")),(N=e.steps)==null||N.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const i=(O=e.steps)==null?void 0:O.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="importWxr");i!==void 0&&i>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),$e.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. ")),(S=e.steps)==null||S.splice(i,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:c,errors:l}=Iu(e);if(!c){const $=new Error(`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`);throw $.errors=l,$}const d=e.steps||[],f=d.reduce(($,b)=>{var I;return $+(((I=b.progress)==null?void 0:I.weight)||1)},0),p=d.map($=>Fu($,{semaphore:r,rootProgressTracker:t,totalProgressWeight:f}));return{versions:{php:ju((R=e.preferredVersions)==null?void 0:R.php,Ks,wo),wp:((_=e.preferredVersions)==null?void 0:_.wp)||"latest"},phpExtensions:Du([],e.phpExtensionBundles||[]),features:{networking:((y=e.features)==null?void 0:y.networking)??!1},run:async $=>{try{for(const{resources:b}of p)for(const I of b)I.setPlayground($),I.isAsync&&I.resolve();for(const[b,{run:I,step:A}]of Object.entries(p))try{const w=await I($);n(w,A)}catch(w){throw $e.error(w),new Error(`Error when executing the blueprint step #${b} (${JSON.stringify(A)}) ${w instanceof Error?`: ${w.message}`:w}`,{cause:w})}}finally{try{await $.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const Cu=new Eu({discriminator:!0});let cr;function Iu(e){var s;cr=Cu.compile(Ru);const t=cr(e);if(t)return{valid:t};const r=new Set;for(const i of cr.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=cr.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.instancePath)));return{valid:t,errors:n}}function ju(e,t,r){return e&&t.includes(e)?e:r}function Du(e,t){const r=Js.filter(s=>e.includes(s)),n=t.flatMap(s=>s in es?es[s]:[]);return Array.from(new Set([...r,...n]))}function Au(e){return!!(typeof e=="object"&&e)}function Mu(e){return["setPhpIniEntry","request"].includes(e.step)?($e.warn(`The "${e.step}" Blueprint is no longer supported and you can remove it from your Blueprint.`),!1):!0}function Fu(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 N=e[g];Eo(N)&&(N=ut.create(N,{semaphore:t})),i[g]=N}const c=async g=>{var N;try{return s.fillSlowly(),await Ou[e.step](g,await Lu(i),{tracker:s,initialCaption:(N=e.progress)==null?void 0:N.caption})}finally{s.finish()}},l=ws(i),d=ws(i).filter(g=>g.isAsync),f=1/(d.length+1);for(const g of d)g.progress=s.stage(f);return{run:c,step:e,resources:l}}function ws(e){const t=[];for(const r in e){const n=e[r];n instanceof ut&&t.push(n)}return t}async function Lu(e){const t={};for(const r in e){const n=e[r];n instanceof ut?t[r]=await n.resolve():t[r]=n}return t}async function qu(e,t){await e.run(t)}function Uu(){}exports.activatePlugin=br;exports.activateTheme=xr;exports.compileBlueprint=Nu;exports.cp=Ds;exports.defineSiteUrl=Zr;exports.defineWpConfigConsts=Gt;exports.enableMultisite=js;exports.exportWXR=Us;exports.importWordPressFiles=qs;exports.importWxr=Ls;exports.installPlugin=zs;exports.installTheme=Ws;exports.login=hr;exports.mkdir=Ms;exports.mv=As;exports.request=pr;exports.resetData=Bs;exports.rm=Kr;exports.rmdir=Fs;exports.runBlueprintSteps=qu;exports.runPHP=ks;exports.runPHPWithOptions=Os;exports.runSql=Ns;exports.runWpInstallationWizard=Hs;exports.setPluginProxyURL=Uu;exports.setSiteOptions=Jr;exports.unzip=Er;exports.updateUserMeta=Cs;exports.wpCLI=xs;exports.wpContentFilesExcludedFromExport=Gr;exports.writeFile=Qr;exports.zipWpContent=Gs;