diff --git a/dist-electron/main.js b/dist-electron/main.js index f733e2c..4744896 100644 --- a/dist-electron/main.js +++ b/dist-electron/main.js @@ -1,19 +1,19 @@ -"use strict";var od=Object.defineProperty;var Ti=e=>{throw TypeError(e)};var ad=(e,t,r)=>t in e?od(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var re=(e,t,r)=>ad(e,typeof t!="symbol"?t+"":t,r),Cs=(e,t,r)=>t.has(e)||Ti("Cannot "+r);var ae=(e,t,r)=>(Cs(e,t,"read from private field"),r?r.call(e):t.get(e)),wt=(e,t,r)=>t.has(e)?Ti("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Qe=(e,t,r,n)=>(Cs(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Nt=(e,t,r)=>(Cs(e,t,"access private method"),r);const z=require("electron"),Y=require("path"),te=require("fs"),Re=require("node:process"),he=require("node:path"),Ce=require("node:util"),oe=require("node:fs"),Qt=require("node:crypto"),ji=require("node:assert"),Ao=require("node:os"),id=require("node:events"),cd=require("node:stream"),Je=require("node:fs/promises"),Gr=require("child_process"),yr=require("crypto");function ld(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const se=ld(he),fr=e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},ll=new Set(["__proto__","prototype","constructor"]),ul=1e6,ud=e=>e>="0"&&e<="9";function dl(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=ul}return!1}function Ms(e,t){return ll.has(e)?!1:(e&&dl(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}function dd(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",s=!1,o=0;for(const i of e){if(o++,s){r+=i,s=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${o}`);s=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${o}`);if(n==="indexEnd"){n="property";break}if(!Ms(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${o}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Ms(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=ul&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${o}`);r+=i;break}default:{if(n==="index"&&!ud(i))throw new Error(`Invalid character '${i}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${o}`);n==="start"&&(n="property"),r+=i}}}switch(s&&(r+="\\"),n){case"property":{if(!Ms(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}function hs(e){if(typeof e=="string")return dd(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(ll.has(n))return[];typeof n=="string"&&dl(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}function Ai(e,t,r){if(!fr(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=hs(t);if(n.length===0)return r;for(let s=0;s{const t=he.join(Wt,"Library");return{data:he.join(t,"Application Support",e),config:he.join(t,"Preferences",e),cache:he.join(t,"Caches",e),log:he.join(t,"Logs",e),temp:he.join(ko,e)}},md=e=>{const t=Er.APPDATA||he.join(Wt,"AppData","Roaming"),r=Er.LOCALAPPDATA||he.join(Wt,"AppData","Local");return{data:he.join(r,e,"Data"),config:he.join(t,e,"Config"),cache:he.join(r,e,"Cache"),log:he.join(r,e,"Log"),temp:he.join(ko,e)}},pd=e=>{const t=he.basename(Wt);return{data:he.join(Er.XDG_DATA_HOME||he.join(Wt,".local","share"),e),config:he.join(Er.XDG_CONFIG_HOME||he.join(Wt,".config"),e),cache:he.join(Er.XDG_CACHE_HOME||he.join(Wt,".cache"),e),log:he.join(Er.XDG_STATE_HOME||he.join(Wt,".local","state"),e),temp:he.join(ko,t,e)}};function yd(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Re.platform==="darwin"?hd(e):Re.platform==="win32"?md(e):pd(e)}const Dt=(e,t)=>{const{onError:r}=t;return function(...s){return e.apply(void 0,s).catch(r)}},Rt=(e,t)=>{const{onError:r}=t;return function(...s){try{return e.apply(void 0,s)}catch(o){return r(o)}}},gd=250,Ft=(e,t)=>{const{isRetriable:r}=t;return function(s){const{timeout:o}=s,i=s.interval??gd,a=Date.now()+o;return function c(...d){return e.apply(void 0,d).catch(l=>{if(!r(l)||Date.now()>=a)throw l;const f=Math.round(i*Math.random());return f>0?new Promise(m=>setTimeout(m,f)).then(()=>c.apply(void 0,d)):c.apply(void 0,d)})}}},Lt=(e,t)=>{const{isRetriable:r}=t;return function(s){const{timeout:o}=s,i=Date.now()+o;return function(...c){for(;;)try{return e.apply(void 0,c)}catch(d){if(!r(d)||Date.now()>=i)throw d;continue}}}},br={isChangeErrorOk:e=>{if(!br.isNodeError(e))return!1;const{code:t}=e;return t==="ENOSYS"||!$d&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!br.isNodeError(e))return!1;const{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!br.isNodeError(e))throw e;if(!br.isChangeErrorOk(e))throw e}},vn={onError:br.onChangeError},et={onError:()=>{}},$d=Re.getuid?!Re.getuid():!1,Ve={isRetriable:br.isRetriableError},Ge={attempt:{chmod:Dt(Ce.promisify(oe.chmod),vn),chown:Dt(Ce.promisify(oe.chown),vn),close:Dt(Ce.promisify(oe.close),et),fsync:Dt(Ce.promisify(oe.fsync),et),mkdir:Dt(Ce.promisify(oe.mkdir),et),realpath:Dt(Ce.promisify(oe.realpath),et),stat:Dt(Ce.promisify(oe.stat),et),unlink:Dt(Ce.promisify(oe.unlink),et),chmodSync:Rt(oe.chmodSync,vn),chownSync:Rt(oe.chownSync,vn),closeSync:Rt(oe.closeSync,et),existsSync:Rt(oe.existsSync,et),fsyncSync:Rt(oe.fsync,et),mkdirSync:Rt(oe.mkdirSync,et),realpathSync:Rt(oe.realpathSync,et),statSync:Rt(oe.statSync,et),unlinkSync:Rt(oe.unlinkSync,et)},retry:{close:Ft(Ce.promisify(oe.close),Ve),fsync:Ft(Ce.promisify(oe.fsync),Ve),open:Ft(Ce.promisify(oe.open),Ve),readFile:Ft(Ce.promisify(oe.readFile),Ve),rename:Ft(Ce.promisify(oe.rename),Ve),stat:Ft(Ce.promisify(oe.stat),Ve),write:Ft(Ce.promisify(oe.write),Ve),writeFile:Ft(Ce.promisify(oe.writeFile),Ve),closeSync:Lt(oe.closeSync,Ve),fsyncSync:Lt(oe.fsyncSync,Ve),openSync:Lt(oe.openSync,Ve),readFileSync:Lt(oe.readFileSync,Ve),renameSync:Lt(oe.renameSync,Ve),statSync:Lt(oe.statSync,Ve),writeSync:Lt(oe.writeSync,Ve),writeFileSync:Lt(oe.writeFileSync,Ve)}},_d="utf8",ki=438,vd=511,wd={},Ed=Re.geteuid?Re.geteuid():-1,bd=Re.getegid?Re.getegid():-1,Sd=1e3,Pd=!!Re.getuid;Re.getuid&&Re.getuid();const Ci=128,Nd=e=>e instanceof Error&&"code"in e,Mi=e=>typeof e=="string",Fs=e=>e===void 0,Rd=Re.platform==="linux",fl=Re.platform==="win32",Co=["SIGHUP","SIGINT","SIGTERM"];fl||Co.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");Rd&&Co.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");class Od{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=t=>{if(!this.exited){this.exited=!0;for(const r of this.callbacks)r();t&&(fl&&t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL"?Re.kill(Re.pid,"SIGTERM"):Re.kill(Re.pid,t))}},this.hook=()=>{Re.once("exit",()=>this.exit());for(const t of Co)try{Re.once(t,()=>this.exit(t))}catch{}},this.register=t=>(this.callbacks.add(t),()=>{this.callbacks.delete(t)}),this.hook()}}const Id=new Od,Td=Id.register,Ke={store:{},create:e=>{const t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),s=`.tmp-${Date.now().toString().slice(-10)}${t}`;return`${e}${s}`},get:(e,t,r=!0)=>{const n=Ke.truncate(t(e));return n in Ke.store?Ke.get(e,t,r):(Ke.store[n]=r,[n,()=>delete Ke.store[n]])},purge:e=>{Ke.store[e]&&(delete Ke.store[e],Ge.attempt.unlink(e))},purgeSync:e=>{Ke.store[e]&&(delete Ke.store[e],Ge.attempt.unlinkSync(e))},purgeSyncAll:()=>{for(const e in Ke.store)Ke.purgeSync(e)},truncate:e=>{const t=he.basename(e);if(t.length<=Ci)return e;const r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;const n=t.length-Ci;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};Td(Ke.purgeSyncAll);function hl(e,t,r=wd){if(Mi(r))return hl(e,t,{encoding:r});const s={timeout:r.timeout??Sd};let o=null,i=null,a=null;try{const c=Ge.attempt.realpathSync(e),d=!!c;e=c||e,[i,o]=Ke.get(e,r.tmpCreate||Ke.create,r.tmpPurge!==!1);const l=Pd&&Fs(r.chown),f=Fs(r.mode);if(d&&(l||f)){const y=Ge.attempt.statSync(e);y&&(r={...r},l&&(r.chown={uid:y.uid,gid:y.gid}),f&&(r.mode=y.mode))}if(!d){const y=he.dirname(e);Ge.attempt.mkdirSync(y,{mode:vd,recursive:!0})}a=Ge.retry.openSync(s)(i,"w",r.mode||ki),r.tmpCreated&&r.tmpCreated(i),Mi(t)?Ge.retry.writeSync(s)(a,t,0,r.encoding||_d):Fs(t)||Ge.retry.writeSync(s)(a,t,0,t.length,0),r.fsync!==!1&&(r.fsyncWait!==!1?Ge.retry.fsyncSync(s)(a):Ge.attempt.fsync(a)),Ge.retry.closeSync(s)(a),a=null,r.chown&&(r.chown.uid!==Ed||r.chown.gid!==bd)&&Ge.attempt.chownSync(i,r.chown.uid,r.chown.gid),r.mode&&r.mode!==ki&&Ge.attempt.chmodSync(i,r.mode);try{Ge.retry.renameSync(s)(i,e)}catch(y){if(!Nd(y)||y.code!=="ENAMETOOLONG")throw y;Ge.retry.renameSync(s)(i,Ke.truncate(e))}o(),i=null}finally{a&&Ge.attempt.closeSync(a),i&&Ke.purge(i)}}function ml(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ao={exports:{}},pl={},Ot={},er={},hn={},ie={},dn={};(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(S){if(super(),!e.IDENTIFIER.test(S))throw new Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(S){super(),this._items=typeof S=="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((R,T)=>`${R}${T}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((R,T)=>(T instanceof r&&(R[T.str]=(R[T.str]||0)+1),R),{})}}e._Code=n,e.nil=new n("");function s(p,...S){const R=[p[0]];let T=0;for(;T{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${d}${f.scopePath}`})}scopeCode(d=this._values,l,f){return this._reduceValues(d,y=>{if(y.value===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return y.value.code},l,f)}_reduceValues(d,l,f={},y){let m=t.nil;for(const $ in d){const g=d[$];if(!g)continue;const _=f[$]=f[$]||new Map;g.forEach(p=>{if(_.has(p))return;_.set(p,n.Started);let S=l(p);if(S){const R=this.opts.es5?e.varKinds.var:e.varKinds.const;m=(0,t._)`${m}${R} ${p} = ${S};${this.opts._n}`}else if(S=y==null?void 0:y(p))m=(0,t._)`${m}${S}${this.opts._n}`;else throw new r(p);_.set(p,n.Completed)})}return m}}e.ValueScope=a})(io);(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=dn,r=io;var n=dn;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=io;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(u,h){return this}}class i extends o{constructor(u,h,P){super(),this.varKind=u,this.name=h,this.rhs=P}render({es5:u,_n:h}){const P=u?r.varKinds.var:this.varKind,C=this.rhs===void 0?"":` = ${this.rhs}`;return`${P} ${this.name}${C};`+h}optimizeNames(u,h){if(u[this.name.str])return this.rhs&&(this.rhs=k(this.rhs,u,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(u,h,P){super(),this.lhs=u,this.rhs=h,this.sideEffects=P}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,h){if(!(this.lhs instanceof t.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,u,h),this}get names(){const u=this.lhs instanceof t.Name?{}:{...this.lhs.names};return J(u,this.rhs)}}class c extends a{constructor(u,h,P,C){super(u,P,C),this.op=h}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}}class d extends o{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}}class l extends o{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}}class f extends o{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}}class y extends o{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,h){return this.code=k(this.code,u,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends o{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((h,P)=>h+P.render(u),"")}optimizeNodes(){const{nodes:u}=this;let h=u.length;for(;h--;){const P=u[h].optimizeNodes();Array.isArray(P)?u.splice(h,1,...P):P?u[h]=P:u.splice(h,1)}return u.length>0?this:void 0}optimizeNames(u,h){const{nodes:P}=this;let C=P.length;for(;C--;){const D=P[C];D.optimizeNames(u,h)||(F(u,D.names),P.splice(C,1))}return P.length>0?this:void 0}get names(){return this.nodes.reduce((u,h)=>Q(u,h.names),{})}}class $ extends m{render(u){return"{"+u._n+super.render(u)+"}"+u._n}}class g extends m{}class _ extends ${}_.kind="else";class p extends ${constructor(u,h){super(h),this.condition=u}render(u){let h=`if(${this.condition})`+super.render(u);return this.else&&(h+="else "+this.else.render(u)),h}optimizeNodes(){super.optimizeNodes();const u=this.condition;if(u===!0)return this.nodes;let h=this.else;if(h){const P=h.optimizeNodes();h=this.else=Array.isArray(P)?new _(P):P}if(h)return u===!1?h instanceof p?h:h.nodes:this.nodes.length?this:new p(H(u),h instanceof p?[h]:h.nodes);if(!(u===!1||!this.nodes.length))return this}optimizeNames(u,h){var P;if(this.else=(P=this.else)===null||P===void 0?void 0:P.optimizeNames(u,h),!!(super.optimizeNames(u,h)||this.else))return this.condition=k(this.condition,u,h),this}get names(){const u=super.names;return J(u,this.condition),this.else&&Q(u,this.else.names),u}}p.kind="if";class S extends ${}S.kind="for";class R extends S{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,h){if(super.optimizeNames(u,h))return this.iteration=k(this.iteration,u,h),this}get names(){return Q(super.names,this.iteration.names)}}class T extends S{constructor(u,h,P,C){super(),this.varKind=u,this.name=h,this.from=P,this.to=C}render(u){const h=u.es5?r.varKinds.var:this.varKind,{name:P,from:C,to:D}=this;return`for(${h} ${P}=${C}; ${P}<${D}; ${P}++)`+super.render(u)}get names(){const u=J(super.names,this.from);return J(u,this.to)}}class A extends S{constructor(u,h,P,C){super(),this.loop=u,this.varKind=h,this.name=P,this.iterable=C}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,h){if(super.optimizeNames(u,h))return this.iterable=k(this.iterable,u,h),this}get names(){return Q(super.names,this.iterable.names)}}class B extends ${constructor(u,h,P){super(),this.name=u,this.args=h,this.async=P}render(u){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(u)}}B.kind="func";class Z extends m{render(u){return"return "+super.render(u)}}Z.kind="return";class ye extends ${render(u){let h="try"+super.render(u);return this.catch&&(h+=this.catch.render(u)),this.finally&&(h+=this.finally.render(u)),h}optimizeNodes(){var u,h;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(u,h){var P,C;return super.optimizeNames(u,h),(P=this.catch)===null||P===void 0||P.optimizeNames(u,h),(C=this.finally)===null||C===void 0||C.optimizeNames(u,h),this}get names(){const u=super.names;return this.catch&&Q(u,this.catch.names),this.finally&&Q(u,this.finally.names),u}}class $e extends ${constructor(u){super(),this.error=u}render(u){return`catch(${this.error})`+super.render(u)}}$e.kind="catch";class we extends ${render(u){return"finally"+super.render(u)}}we.kind="finally";class G{constructor(u,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?` -`:""},this._extScope=u,this._scope=new r.Scope({parent:u}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(u){return this._scope.name(u)}scopeName(u){return this._extScope.name(u)}scopeValue(u,h){const P=this._extScope.value(u,h);return(this._values[P.prefix]||(this._values[P.prefix]=new Set)).add(P),P}getScopeValue(u,h){return this._extScope.getValue(u,h)}scopeRefs(u){return this._extScope.scopeRefs(u,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(u,h,P,C){const D=this._scope.toName(h);return P!==void 0&&C&&(this._constants[D.str]=P),this._leafNode(new i(u,D,P)),D}const(u,h,P){return this._def(r.varKinds.const,u,h,P)}let(u,h,P){return this._def(r.varKinds.let,u,h,P)}var(u,h,P){return this._def(r.varKinds.var,u,h,P)}assign(u,h,P){return this._leafNode(new a(u,h,P))}add(u,h){return this._leafNode(new c(u,e.operators.ADD,h))}code(u){return typeof u=="function"?u():u!==t.nil&&this._leafNode(new y(u)),this}object(...u){const h=["{"];for(const[P,C]of u)h.length>1&&h.push(","),h.push(P),(P!==C||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,C));return h.push("}"),new t._Code(h)}if(u,h,P){if(this._blockNode(new p(u)),h&&P)this.code(h).else().code(P).endIf();else if(h)this.code(h).endIf();else if(P)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(u){return this._elseNode(new p(u))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(p,_)}_for(u,h){return this._blockNode(u),h&&this.code(h).endFor(),this}for(u,h){return this._for(new R(u),h)}forRange(u,h,P,C,D=this.opts.es5?r.varKinds.var:r.varKinds.let){const X=this._scope.toName(u);return this._for(new T(D,X,h,P),()=>C(X))}forOf(u,h,P,C=r.varKinds.const){const D=this._scope.toName(u);if(this.opts.es5){const X=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${X}.length`,W=>{this.var(D,(0,t._)`${X}[${W}]`),P(D)})}return this._for(new A("of",C,D,h),()=>P(D))}forIn(u,h,P,C=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(u,(0,t._)`Object.keys(${h})`,P);const D=this._scope.toName(u);return this._for(new A("in",C,D,h),()=>P(D))}endFor(){return this._endBlockNode(S)}label(u){return this._leafNode(new d(u))}break(u){return this._leafNode(new l(u))}return(u){const h=new Z;if(this._blockNode(h),this.code(u),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Z)}try(u,h,P){if(!h&&!P)throw new Error('CodeGen: "try" without "catch" and "finally"');const C=new ye;if(this._blockNode(C),this.code(u),h){const D=this.name("e");this._currNode=C.catch=new $e(D),h(D)}return P&&(this._currNode=C.finally=new we,this.code(P)),this._endBlockNode($e,we)}throw(u){return this._leafNode(new f(u))}block(u,h){return this._blockStarts.push(this._nodes.length),u&&this.code(u).endBlock(h),this}endBlock(u){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const P=this._nodes.length-h;if(P<0||u!==void 0&&P!==u)throw new Error(`CodeGen: wrong number of nodes: ${P} vs ${u} expected`);return this._nodes.length=h,this}func(u,h=t.nil,P,C){return this._blockNode(new B(u,h,P)),C&&this.code(C).endFunc(),this}endFunc(){return this._endBlockNode(B)}optimize(u=1){for(;u-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(u){return this._currNode.nodes.push(u),this}_blockNode(u){this._currNode.nodes.push(u),this._nodes.push(u)}_endBlockNode(u,h){const P=this._currNode;if(P instanceof u||h&&P instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${u.kind}/${h.kind}`:u.kind}"`)}_elseNode(u){const h=this._currNode;if(!(h instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=u,this}get _root(){return this._nodes[0]}get _currNode(){const u=this._nodes;return u[u.length-1]}set _currNode(u){const h=this._nodes;h[h.length-1]=u}}e.CodeGen=G;function Q(E,u){for(const h in u)E[h]=(E[h]||0)+(u[h]||0);return E}function J(E,u){return u instanceof t._CodeOrName?Q(E,u.names):E}function k(E,u,h){if(E instanceof t.Name)return P(E);if(!C(E))return E;return new t._Code(E._items.reduce((D,X)=>(X instanceof t.Name&&(X=P(X)),X instanceof t._Code?D.push(...X._items):D.push(X),D),[]));function P(D){const X=h[D.str];return X===void 0||u[D.str]!==1?D:(delete u[D.str],X)}function C(D){return D instanceof t._Code&&D._items.some(X=>X instanceof t.Name&&u[X.str]===1&&h[X.str]!==void 0)}}function F(E,u){for(const h in u)E[h]=(E[h]||0)-(u[h]||0)}function H(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:(0,t._)`!${N(E)}`}e.not=H;const U=w(e.operators.AND);function ee(...E){return E.reduce(U)}e.and=ee;const K=w(e.operators.OR);function I(...E){return E.reduce(K)}e.or=I;function w(E){return(u,h)=>u===t.nil?h:h===t.nil?u:(0,t._)`${N(u)} ${E} ${N(h)}`}function N(E){return E instanceof t.Name?E:(0,t._)`(${E})`}})(ie);var q={};Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;const Ee=ie,jd=dn;function Ad(e){const t={};for(const r of e)t[r]=!0;return t}q.toHash=Ad;function kd(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(yl(e,t),!gl(t,e.self.RULES.all))}q.alwaysValidSchema=kd;function yl(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||vl(e,`unknown keyword: "${o}"`)}q.checkUnknownRules=yl;function gl(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}q.schemaHasRules=gl;function Cd(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}q.schemaHasRulesButRef=Cd;function Md({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ee._)`${r}`}return(0,Ee._)`${e}${t}${(0,Ee.getProperty)(n)}`}q.schemaRefOrVal=Md;function Dd(e){return $l(decodeURIComponent(e))}q.unescapeFragment=Dd;function Fd(e){return encodeURIComponent(Mo(e))}q.escapeFragment=Fd;function Mo(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Mo;function $l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=$l;function Ld(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}q.eachItem=Ld;function Di({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{const c=i===void 0?o:i instanceof Ee.Name?(o instanceof Ee.Name?e(s,o,i):t(s,o,i),i):o instanceof Ee.Name?(t(s,i,o),o):r(o,i);return a===Ee.Name&&!(c instanceof Ee.Name)?n(s,c):c}}q.mergeEvaluated={props:Di({mergeNames:(e,t,r)=>e.if((0,Ee._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Ee._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Ee._)`${r} || {}`).code((0,Ee._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Ee._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Ee._)`${r} || {}`),Do(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:_l}),items:Di({mergeNames:(e,t,r)=>e.if((0,Ee._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Ee._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Ee._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Ee._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function _l(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,Ee._)`{}`);return t!==void 0&&Do(e,r,t),r}q.evaluatedPropsToName=_l;function Do(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Ee._)`${t}${(0,Ee.getProperty)(n)}`,!0))}q.setEvaluated=Do;const Fi={};function zd(e,t){return e.scopeValue("func",{ref:t,code:Fi[t.code]||(Fi[t.code]=new jd._Code(t.code))})}q.useFunc=zd;var co;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(co||(q.Type=co={}));function Vd(e,t,r){if(e instanceof Ee.Name){const n=t===co.Num;return r?n?(0,Ee._)`"[" + ${e} + "]"`:(0,Ee._)`"['" + ${e} + "']"`:n?(0,Ee._)`"/" + ${e}`:(0,Ee._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ee.getProperty)(e).toString():"/"+Mo(e)}q.getErrorPath=Vd;function vl(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}q.checkStrictMode=vl;var nt={};Object.defineProperty(nt,"__esModule",{value:!0});const Ue=ie,Ud={data:new Ue.Name("data"),valCxt:new Ue.Name("valCxt"),instancePath:new Ue.Name("instancePath"),parentData:new Ue.Name("parentData"),parentDataProperty:new Ue.Name("parentDataProperty"),rootData:new Ue.Name("rootData"),dynamicAnchors:new Ue.Name("dynamicAnchors"),vErrors:new Ue.Name("vErrors"),errors:new Ue.Name("errors"),this:new Ue.Name("this"),self:new Ue.Name("self"),scope:new Ue.Name("scope"),json:new Ue.Name("json"),jsonPos:new Ue.Name("jsonPos"),jsonLen:new Ue.Name("jsonLen"),jsonPart:new Ue.Name("jsonPart")};nt.default=Ud;(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=ie,r=q,n=nt;e.keywordError={message:({keyword:_})=>(0,t.str)`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:p})=>p?(0,t.str)`"${_}" keyword must be ${p} ($data)`:(0,t.str)`"${_}" keyword is invalid ($data)`};function s(_,p=e.keywordError,S,R){const{it:T}=_,{gen:A,compositeRule:B,allErrors:Z}=T,ye=f(_,p,S);R??(B||Z)?c(A,ye):d(T,(0,t._)`[${ye}]`)}e.reportError=s;function o(_,p=e.keywordError,S){const{it:R}=_,{gen:T,compositeRule:A,allErrors:B}=R,Z=f(_,p,S);c(T,Z),A||B||d(R,n.default.vErrors)}e.reportExtraError=o;function i(_,p){_.assign(n.default.errors,p),_.if((0,t._)`${n.default.vErrors} !== null`,()=>_.if(p,()=>_.assign((0,t._)`${n.default.vErrors}.length`,p),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:_,keyword:p,schemaValue:S,data:R,errsCount:T,it:A}){if(T===void 0)throw new Error("ajv implementation error");const B=_.name("err");_.forRange("i",T,n.default.errors,Z=>{_.const(B,(0,t._)`${n.default.vErrors}[${Z}]`),_.if((0,t._)`${B}.instancePath === undefined`,()=>_.assign((0,t._)`${B}.instancePath`,(0,t.strConcat)(n.default.instancePath,A.errorPath))),_.assign((0,t._)`${B}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${p}`),A.opts.verbose&&(_.assign((0,t._)`${B}.schema`,S),_.assign((0,t._)`${B}.data`,R))})}e.extendErrors=a;function c(_,p){const S=_.const("err",p);_.if((0,t._)`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,(0,t._)`[${S}]`),(0,t._)`${n.default.vErrors}.push(${S})`),_.code((0,t._)`${n.default.errors}++`)}function d(_,p){const{gen:S,validateName:R,schemaEnv:T}=_;T.$async?S.throw((0,t._)`new ${_.ValidationError}(${p})`):(S.assign((0,t._)`${R}.errors`,p),S.return(!1))}const l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(_,p,S){const{createErrors:R}=_.it;return R===!1?(0,t._)`{}`:y(_,p,S)}function y(_,p,S={}){const{gen:R,it:T}=_,A=[m(T,S),$(_,S)];return g(_,p,A),R.object(...A)}function m({errorPath:_},{instancePath:p}){const S=p?(0,t.str)`${_}${(0,r.getErrorPath)(p,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,S)]}function $({keyword:_,it:{errSchemaPath:p}},{schemaPath:S,parentSchema:R}){let T=R?p:(0,t.str)`${p}/${_}`;return S&&(T=(0,t.str)`${T}${(0,r.getErrorPath)(S,r.Type.Str)}`),[l.schemaPath,T]}function g(_,{params:p,message:S},R){const{keyword:T,data:A,schemaValue:B,it:Z}=_,{opts:ye,propertyName:$e,topSchemaRef:we,schemaPath:G}=Z;R.push([l.keyword,T],[l.params,typeof p=="function"?p(_):p||(0,t._)`{}`]),ye.messages&&R.push([l.message,typeof S=="function"?S(_):S]),ye.verbose&&R.push([l.schema,B],[l.parentSchema,(0,t._)`${we}${G}`],[n.default.data,A]),$e&&R.push([l.propertyName,$e])}})(hn);var Li;function qd(){if(Li)return er;Li=1,Object.defineProperty(er,"__esModule",{value:!0}),er.boolOrEmptySchema=er.topBoolOrEmptySchema=void 0;const e=hn,t=ie,r=nt,n={message:"boolean schema is false"};function s(a){const{gen:c,schema:d,validateName:l}=a;d===!1?i(a,!1):typeof d=="object"&&d.$async===!0?c.return(r.default.data):(c.assign((0,t._)`${l}.errors`,null),c.return(!0))}er.topBoolOrEmptySchema=s;function o(a,c){const{gen:d,schema:l}=a;l===!1?(d.var(c,!1),i(a)):d.var(c,!0)}er.boolOrEmptySchema=o;function i(a,c){const{gen:d,data:l}=a,f={gen:d,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,e.reportError)(f,n,void 0,c)}return er}var Ae={},hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.getRules=hr.isJSONType=void 0;const Gd=["string","number","integer","boolean","null","object","array"],Kd=new Set(Gd);function Hd(e){return typeof e=="string"&&Kd.has(e)}hr.isJSONType=Hd;function Wd(){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:{}}}hr.getRules=Wd;var It={},zi;function wl(){if(zi)return It;zi=1,Object.defineProperty(It,"__esModule",{value:!0}),It.shouldUseRule=It.shouldUseGroup=It.schemaHasRulesForType=void 0;function e({schema:n,self:s},o){const i=s.RULES.types[o];return i&&i!==!0&&t(n,i)}It.schemaHasRulesForType=e;function t(n,s){return s.rules.some(o=>r(n,o))}It.shouldUseGroup=t;function r(n,s){var o;return n[s.keyword]!==void 0||((o=s.definition.implements)===null||o===void 0?void 0:o.some(i=>n[i]!==void 0))}return It.shouldUseRule=r,It}Object.defineProperty(Ae,"__esModule",{value:!0});Ae.reportTypeError=Ae.checkDataTypes=Ae.checkDataType=Ae.coerceAndCheckDataType=Ae.getJSONTypes=Ae.getSchemaTypes=Ae.DataType=void 0;const xd=hr,Bd=wl(),Yd=hn,ce=ie,El=q;var Sr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Sr||(Ae.DataType=Sr={}));function Jd(e){const t=bl(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ae.getSchemaTypes=Jd;function bl(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(xd.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ae.getJSONTypes=bl;function Xd(e,t){const{gen:r,data:n,opts:s}=e,o=Zd(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&(0,Bd.schemaHasRulesForType)(e,t[0]));if(i){const a=Fo(t,n,s.strictNumbers,Sr.Wrong);r.if(a,()=>{o.length?Qd(e,t,o):Lo(e)})}return i}Ae.coerceAndCheckDataType=Xd;const Sl=new Set(["string","number","integer","boolean","null"]);function Zd(e,t){return t?e.filter(r=>Sl.has(r)||t==="array"&&r==="array"):[]}function Qd(e,t,r){const{gen:n,data:s,opts:o}=e,i=n.let("dataType",(0,ce._)`typeof ${s}`),a=n.let("coerced",(0,ce._)`undefined`);o.coerceTypes==="array"&&n.if((0,ce._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,ce._)`${s}[0]`).assign(i,(0,ce._)`typeof ${s}`).if(Fo(t,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,ce._)`${a} !== undefined`);for(const d of r)(Sl.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),Lo(e),n.endIf(),n.if((0,ce._)`${a} !== undefined`,()=>{n.assign(s,a),ef(e,a)});function c(d){switch(d){case"string":n.elseIf((0,ce._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,ce._)`"" + ${s}`).elseIf((0,ce._)`${s} === null`).assign(a,(0,ce._)`""`);return;case"number":n.elseIf((0,ce._)`${i} == "boolean" || ${s} === null - || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,ce._)`+${s}`);return;case"integer":n.elseIf((0,ce._)`${i} === "boolean" || ${s} === null - || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,ce._)`+${s}`);return;case"boolean":n.elseIf((0,ce._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,ce._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ce._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ce._)`${i} === "string" || ${i} === "number" - || ${i} === "boolean" || ${s} === null`).assign(a,(0,ce._)`[${s}]`)}}}function ef({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,ce._)`${t} !== undefined`,()=>e.assign((0,ce._)`${t}[${r}]`,n))}function lo(e,t,r,n=Sr.Correct){const s=n===Sr.Correct?ce.operators.EQ:ce.operators.NEQ;let o;switch(e){case"null":return(0,ce._)`${t} ${s} null`;case"array":o=(0,ce._)`Array.isArray(${t})`;break;case"object":o=(0,ce._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i((0,ce._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return(0,ce._)`typeof ${t} ${s} ${e}`}return n===Sr.Correct?o:(0,ce.not)(o);function i(a=ce.nil){return(0,ce.and)((0,ce._)`typeof ${t} == "number"`,a,r?(0,ce._)`isFinite(${t})`:ce.nil)}}Ae.checkDataType=lo;function Fo(e,t,r,n){if(e.length===1)return lo(e[0],t,r,n);let s;const o=(0,El.toHash)(e);if(o.array&&o.object){const i=(0,ce._)`typeof ${t} != "object"`;s=o.null?i:(0,ce._)`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=ce.nil;o.number&&delete o.integer;for(const i in o)s=(0,ce.and)(s,lo(i,t,r,n));return s}Ae.checkDataTypes=Fo;const tf={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,ce._)`{type: ${e}}`:(0,ce._)`{type: ${t}}`};function Lo(e){const t=rf(e);(0,Yd.reportError)(t,tf)}Ae.reportTypeError=Lo;function rf(e){const{gen:t,data:r,schema:n}=e,s=(0,El.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Kr={},Vi;function nf(){if(Vi)return Kr;Vi=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.assignDefaults=void 0;const e=ie,t=q;function r(s,o){const{properties:i,items:a}=s.schema;if(o==="object"&&i)for(const c in i)n(s,c,i[c].default);else o==="array"&&Array.isArray(a)&&a.forEach((c,d)=>n(s,d,c.default))}Kr.assignDefaults=r;function n(s,o,i){const{gen:a,compositeRule:c,data:d,opts:l}=s;if(i===void 0)return;const f=(0,e._)`${d}${(0,e.getProperty)(o)}`;if(c){(0,t.checkStrictMode)(s,`default is ignored for: ${f}`);return}let y=(0,e._)`${f} === undefined`;l.useDefaults==="empty"&&(y=(0,e._)`${y} || ${f} === null || ${f} === ""`),a.if(y,(0,e._)`${f} = ${(0,e.stringify)(i)}`)}return Kr}var ct={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.validateUnion=de.validateArray=de.usePattern=de.callValidateCode=de.schemaProperties=de.allSchemaProperties=de.noPropertyInData=de.propertyInData=de.isOwnProperty=de.hasPropFunc=de.reportMissingProp=de.checkMissingProp=de.checkReportMissingProp=void 0;const Pe=ie,zo=q,zt=nt,sf=q;function of(e,t){const{gen:r,data:n,it:s}=e;r.if(Uo(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Pe._)`${t}`},!0),e.error()})}de.checkReportMissingProp=of;function af({gen:e,data:t,it:{opts:r}},n,s){return(0,Pe.or)(...n.map(o=>(0,Pe.and)(Uo(e,t,o,r.ownProperties),(0,Pe._)`${s} = ${o}`)))}de.checkMissingProp=af;function cf(e,t){e.setParams({missingProperty:t},!0),e.error()}de.reportMissingProp=cf;function Pl(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pe._)`Object.prototype.hasOwnProperty`})}de.hasPropFunc=Pl;function Vo(e,t,r){return(0,Pe._)`${Pl(e)}.call(${t}, ${r})`}de.isOwnProperty=Vo;function lf(e,t,r,n){const s=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} !== undefined`;return n?(0,Pe._)`${s} && ${Vo(e,t,r)}`:s}de.propertyInData=lf;function Uo(e,t,r,n){const s=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} === undefined`;return n?(0,Pe.or)(s,(0,Pe.not)(Vo(e,t,r))):s}de.noPropertyInData=Uo;function Nl(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}de.allSchemaProperties=Nl;function uf(e,t){return Nl(t).filter(r=>!(0,zo.alwaysValidSchema)(e,t[r]))}de.schemaProperties=uf;function df({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,d){const l=d?(0,Pe._)`${e}, ${t}, ${n}${s}`:t,f=[[zt.default.instancePath,(0,Pe.strConcat)(zt.default.instancePath,o)],[zt.default.parentData,i.parentData],[zt.default.parentDataProperty,i.parentDataProperty],[zt.default.rootData,zt.default.rootData]];i.opts.dynamicRef&&f.push([zt.default.dynamicAnchors,zt.default.dynamicAnchors]);const y=(0,Pe._)`${l}, ${r.object(...f)}`;return c!==Pe.nil?(0,Pe._)`${a}.call(${c}, ${y})`:(0,Pe._)`${a}(${y})`}de.callValidateCode=df;const ff=(0,Pe._)`new RegExp`;function hf({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Pe._)`${s.code==="new RegExp"?ff:(0,sf.useFunc)(e,s)}(${r}, ${n})`})}de.usePattern=hf;function mf(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){const c=t.const("len",(0,Pe._)`${r}.length`);t.forRange("i",0,c,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:zo.Type.Num},o),t.if((0,Pe.not)(o),a)})}}de.validateArray=mf;function pf(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,zo.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,d)=>{const l=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},a);t.assign(i,(0,Pe._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,Pe.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}de.validateUnion=pf;var Ui;function yf(){if(Ui)return ct;Ui=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.validateKeywordUsage=ct.validSchemaType=ct.funcKeywordCode=ct.macroKeywordCode=void 0;const e=ie,t=nt,r=de,n=hn;function s(y,m){const{gen:$,keyword:g,schema:_,parentSchema:p,it:S}=y,R=m.macro.call(S.self,_,p,S),T=d($,g,R);S.opts.validateSchema!==!1&&S.self.validateSchema(R,!0);const A=$.name("valid");y.subschema({schema:R,schemaPath:e.nil,errSchemaPath:`${S.errSchemaPath}/${g}`,topSchemaRef:T,compositeRule:!0},A),y.pass(A,()=>y.error(!0))}ct.macroKeywordCode=s;function o(y,m){var $;const{gen:g,keyword:_,schema:p,parentSchema:S,$data:R,it:T}=y;c(T,m);const A=!R&&m.compile?m.compile.call(T.self,p,S,T):m.validate,B=d(g,_,A),Z=g.let("valid");y.block$data(Z,ye),y.ok(($=m.valid)!==null&&$!==void 0?$:Z);function ye(){if(m.errors===!1)G(),m.modifying&&i(y),Q(()=>y.error());else{const J=m.async?$e():we();m.modifying&&i(y),Q(()=>a(y,J))}}function $e(){const J=g.let("ruleErrs",null);return g.try(()=>G((0,e._)`await `),k=>g.assign(Z,!1).if((0,e._)`${k} instanceof ${T.ValidationError}`,()=>g.assign(J,(0,e._)`${k}.errors`),()=>g.throw(k))),J}function we(){const J=(0,e._)`${B}.errors`;return g.assign(J,null),G(e.nil),J}function G(J=m.async?(0,e._)`await `:e.nil){const k=T.opts.passContext?t.default.this:t.default.self,F=!("compile"in m&&!R||m.schema===!1);g.assign(Z,(0,e._)`${J}${(0,r.callValidateCode)(y,B,k,F)}`,m.modifying)}function Q(J){var k;g.if((0,e.not)((k=m.valid)!==null&&k!==void 0?k:Z),J)}}ct.funcKeywordCode=o;function i(y){const{gen:m,data:$,it:g}=y;m.if(g.parentData,()=>m.assign($,(0,e._)`${g.parentData}[${g.parentDataProperty}]`))}function a(y,m){const{gen:$}=y;$.if((0,e._)`Array.isArray(${m})`,()=>{$.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${m} : ${t.default.vErrors}.concat(${m})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,n.extendErrors)(y)},()=>y.error())}function c({schemaEnv:y},m){if(m.async&&!y.$async)throw new Error("async keyword in sync schema")}function d(y,m,$){if($===void 0)throw new Error(`keyword "${m}" failed to compile`);return y.scopeValue("keyword",typeof $=="function"?{ref:$}:{ref:$,code:(0,e.stringify)($)})}function l(y,m,$=!1){return!m.length||m.some(g=>g==="array"?Array.isArray(y):g==="object"?y&&typeof y=="object"&&!Array.isArray(y):typeof y==g||$&&typeof y>"u")}ct.validSchemaType=l;function f({schema:y,opts:m,self:$,errSchemaPath:g},_,p){if(Array.isArray(_.keyword)?!_.keyword.includes(p):_.keyword!==p)throw new Error("ajv implementation error");const S=_.dependencies;if(S!=null&&S.some(R=>!Object.prototype.hasOwnProperty.call(y,R)))throw new Error(`parent schema must have dependencies of ${p}: ${S.join(",")}`);if(_.validateSchema&&!_.validateSchema(y[p])){const T=`keyword "${p}" value is invalid at path "${g}": `+$.errorsText(_.validateSchema.errors);if(m.validateSchema==="log")$.logger.error(T);else throw new Error(T)}}return ct.validateKeywordUsage=f,ct}var Tt={},qi;function gf(){if(qi)return Tt;qi=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.extendSubschemaMode=Tt.extendSubschemaData=Tt.getSubschema=void 0;const e=ie,t=q;function r(o,{keyword:i,schemaProp:a,schema:c,schemaPath:d,errSchemaPath:l,topSchemaRef:f}){if(i!==void 0&&c!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const y=o.schema[i];return a===void 0?{schema:y,schemaPath:(0,e._)`${o.schemaPath}${(0,e.getProperty)(i)}`,errSchemaPath:`${o.errSchemaPath}/${i}`}:{schema:y[a],schemaPath:(0,e._)`${o.schemaPath}${(0,e.getProperty)(i)}${(0,e.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${i}/${(0,t.escapeFragment)(a)}`}}if(c!==void 0){if(d===void 0||l===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:d,topSchemaRef:f,errSchemaPath:l}}throw new Error('either "keyword" or "schema" must be passed')}Tt.getSubschema=r;function n(o,i,{dataProp:a,dataPropType:c,data:d,dataTypes:l,propertyName:f}){if(d!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:y}=i;if(a!==void 0){const{errorPath:$,dataPathArr:g,opts:_}=i,p=y.let("data",(0,e._)`${i.data}${(0,e.getProperty)(a)}`,!0);m(p),o.errorPath=(0,e.str)`${$}${(0,t.getErrorPath)(a,c,_.jsPropertySyntax)}`,o.parentDataProperty=(0,e._)`${a}`,o.dataPathArr=[...g,o.parentDataProperty]}if(d!==void 0){const $=d instanceof e.Name?d:y.let("data",d,!0);m($),f!==void 0&&(o.propertyName=f)}l&&(o.dataTypes=l);function m($){o.data=$,o.dataLevel=i.dataLevel+1,o.dataTypes=[],i.definedProperties=new Set,o.parentData=i.data,o.dataNames=[...i.dataNames,$]}}Tt.extendSubschemaData=n;function s(o,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:c,createErrors:d,allErrors:l}){c!==void 0&&(o.compositeRule=c),d!==void 0&&(o.createErrors=d),l!==void 0&&(o.allErrors=l),o.jtdDiscriminator=i,o.jtdMetadata=a}return Tt.extendSubschemaMode=s,Tt}var Le={},ms=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},Rl={exports:{}},Bt=Rl.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(){};Gn(t,n,s,e,"",e)};Bt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Bt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Bt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Bt.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 Gn(e,t,r,n,s,o,i,a,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,a,c,d);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in Bt.arrayKeywords)for(var y=0;yt+=Ol(n)),t===1/0))return 1/0}return t}function Il(e,t="",r){r!==!1&&(t=Pr(t));const n=e.parse(t);return Tl(e,n)}Le.getFullPath=Il;function Tl(e,t){return e.serialize(t).split("#")[0]+"#"}Le._getFullPath=Tl;const Nf=/#\/?$/;function Pr(e){return e?e.replace(Nf,""):""}Le.normalizeId=Pr;function Rf(e,t,r){return r=Pr(r),e.resolve(t,r)}Le.resolveUrl=Rf;const Of=/^[a-z_][-a-z0-9._]*$/i;function If(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Pr(e[r]||t),o={"":s},i=Il(n,s,!1),a={},c=new Set;return Ef(e,{allKeys:!0},(f,y,m,$)=>{if($===void 0)return;const g=i+y;let _=o[$];typeof f[r]=="string"&&(_=p.call(this,f[r])),S.call(this,f.$anchor),S.call(this,f.$dynamicAnchor),o[y]=_;function p(R){const T=this.opts.uriResolver.resolve;if(R=Pr(_?T(_,R):R),c.has(R))throw l(R);c.add(R);let A=this.refs[R];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?d(f,A.schema,R):R!==Pr(g)&&(R[0]==="#"?(d(f,a[R],R),a[R]=f):this.refs[R]=g),R}function S(R){if(typeof R=="string"){if(!Of.test(R))throw new Error(`invalid anchor "${R}"`);p.call(this,`#${R}`)}}}),a;function d(f,y,m){if(y!==void 0&&!wf(f,y))throw l(m)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Le.getSchemaRefs=If;var Gi;function ps(){if(Gi)return Ot;Gi=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.getData=Ot.KeywordCxt=Ot.validateFunctionCode=void 0;const e=qd(),t=Ae,r=wl(),n=Ae,s=nf(),o=yf(),i=gf(),a=ie,c=nt,d=Le,l=q,f=hn;function y(v){if(A(v)&&(Z(v),T(v))){_(v);return}m(v,()=>(0,e.topBoolOrEmptySchema)(v))}Ot.validateFunctionCode=y;function m({gen:v,validateName:b,schema:O,schemaEnv:j,opts:M},V){M.code.es5?v.func(b,(0,a._)`${c.default.data}, ${c.default.valCxt}`,j.$async,()=>{v.code((0,a._)`"use strict"; ${S(O,M)}`),g(v,M),v.code(V)}):v.func(b,(0,a._)`${c.default.data}, ${$(M)}`,j.$async,()=>v.code(S(O,M)).code(V))}function $(v){return(0,a._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${v.dynamicRef?(0,a._)`, ${c.default.dynamicAnchors}={}`:a.nil}}={}`}function g(v,b){v.if(c.default.valCxt,()=>{v.var(c.default.instancePath,(0,a._)`${c.default.valCxt}.${c.default.instancePath}`),v.var(c.default.parentData,(0,a._)`${c.default.valCxt}.${c.default.parentData}`),v.var(c.default.parentDataProperty,(0,a._)`${c.default.valCxt}.${c.default.parentDataProperty}`),v.var(c.default.rootData,(0,a._)`${c.default.valCxt}.${c.default.rootData}`),b.dynamicRef&&v.var(c.default.dynamicAnchors,(0,a._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{v.var(c.default.instancePath,(0,a._)`""`),v.var(c.default.parentData,(0,a._)`undefined`),v.var(c.default.parentDataProperty,(0,a._)`undefined`),v.var(c.default.rootData,c.default.data),b.dynamicRef&&v.var(c.default.dynamicAnchors,(0,a._)`{}`)})}function _(v){const{schema:b,opts:O,gen:j}=v;m(v,()=>{O.$comment&&b.$comment&&J(v),we(v),j.let(c.default.vErrors,null),j.let(c.default.errors,0),O.unevaluated&&p(v),ye(v),k(v)})}function p(v){const{gen:b,validateName:O}=v;v.evaluated=b.const("evaluated",(0,a._)`${O}.evaluated`),b.if((0,a._)`${v.evaluated}.dynamicProps`,()=>b.assign((0,a._)`${v.evaluated}.props`,(0,a._)`undefined`)),b.if((0,a._)`${v.evaluated}.dynamicItems`,()=>b.assign((0,a._)`${v.evaluated}.items`,(0,a._)`undefined`))}function S(v,b){const O=typeof v=="object"&&v[b.schemaId];return O&&(b.code.source||b.code.process)?(0,a._)`/*# sourceURL=${O} */`:a.nil}function R(v,b){if(A(v)&&(Z(v),T(v))){B(v,b);return}(0,e.boolOrEmptySchema)(v,b)}function T({schema:v,self:b}){if(typeof v=="boolean")return!v;for(const O in v)if(b.RULES.all[O])return!0;return!1}function A(v){return typeof v.schema!="boolean"}function B(v,b){const{schema:O,gen:j,opts:M}=v;M.$comment&&O.$comment&&J(v),G(v),Q(v);const V=j.const("_errs",c.default.errors);ye(v,V),j.var(b,(0,a._)`${V} === ${c.default.errors}`)}function Z(v){(0,l.checkUnknownRules)(v),$e(v)}function ye(v,b){if(v.opts.jtd)return H(v,[],!1,b);const O=(0,t.getSchemaTypes)(v.schema),j=(0,t.coerceAndCheckDataType)(v,O);H(v,O,!j,b)}function $e(v){const{schema:b,errSchemaPath:O,opts:j,self:M}=v;b.$ref&&j.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(b,M.RULES)&&M.logger.warn(`$ref: keywords ignored in schema at path "${O}"`)}function we(v){const{schema:b,opts:O}=v;b.default!==void 0&&O.useDefaults&&O.strictSchema&&(0,l.checkStrictMode)(v,"default is ignored in the schema root")}function G(v){const b=v.schema[v.opts.schemaId];b&&(v.baseId=(0,d.resolveUrl)(v.opts.uriResolver,v.baseId,b))}function Q(v){if(v.schema.$async&&!v.schemaEnv.$async)throw new Error("async schema in sync schema")}function J({gen:v,schemaEnv:b,schema:O,errSchemaPath:j,opts:M}){const V=O.$comment;if(M.$comment===!0)v.code((0,a._)`${c.default.self}.logger.log(${V})`);else if(typeof M.$comment=="function"){const me=(0,a.str)`${j}/$comment`,Oe=v.scopeValue("root",{ref:b.root});v.code((0,a._)`${c.default.self}.opts.$comment(${V}, ${me}, ${Oe}.schema)`)}}function k(v){const{gen:b,schemaEnv:O,validateName:j,ValidationError:M,opts:V}=v;O.$async?b.if((0,a._)`${c.default.errors} === 0`,()=>b.return(c.default.data),()=>b.throw((0,a._)`new ${M}(${c.default.vErrors})`)):(b.assign((0,a._)`${j}.errors`,c.default.vErrors),V.unevaluated&&F(v),b.return((0,a._)`${c.default.errors} === 0`))}function F({gen:v,evaluated:b,props:O,items:j}){O instanceof a.Name&&v.assign((0,a._)`${b}.props`,O),j instanceof a.Name&&v.assign((0,a._)`${b}.items`,j)}function H(v,b,O,j){const{gen:M,schema:V,data:me,allErrors:Oe,opts:_e,self:ve}=v,{RULES:pe}=ve;if(V.$ref&&(_e.ignoreKeywordsWithRef||!(0,l.schemaHasRulesButRef)(V,pe))){M.block(()=>C(v,"$ref",pe.all.$ref.definition));return}_e.jtd||ee(v,b),M.block(()=>{for(const Se of pe.rules)Ze(Se);Ze(pe.post)});function Ze(Se){(0,r.shouldUseGroup)(V,Se)&&(Se.type?(M.if((0,n.checkDataType)(Se.type,me,_e.strictNumbers)),U(v,Se),b.length===1&&b[0]===Se.type&&O&&(M.else(),(0,n.reportTypeError)(v)),M.endIf()):U(v,Se),Oe||M.if((0,a._)`${c.default.errors} === ${j||0}`))}}function U(v,b){const{gen:O,schema:j,opts:{useDefaults:M}}=v;M&&(0,s.assignDefaults)(v,b.type),O.block(()=>{for(const V of b.rules)(0,r.shouldUseRule)(j,V)&&C(v,V.keyword,V.definition,b.type)})}function ee(v,b){v.schemaEnv.meta||!v.opts.strictTypes||(K(v,b),v.opts.allowUnionTypes||I(v,b),w(v,v.dataTypes))}function K(v,b){if(b.length){if(!v.dataTypes.length){v.dataTypes=b;return}b.forEach(O=>{E(v.dataTypes,O)||h(v,`type "${O}" not allowed by context "${v.dataTypes.join(",")}"`)}),u(v,b)}}function I(v,b){b.length>1&&!(b.length===2&&b.includes("null"))&&h(v,"use allowUnionTypes to allow union type keyword")}function w(v,b){const O=v.self.RULES.all;for(const j in O){const M=O[j];if(typeof M=="object"&&(0,r.shouldUseRule)(v.schema,M)){const{type:V}=M.definition;V.length&&!V.some(me=>N(b,me))&&h(v,`missing type "${V.join(",")}" for keyword "${j}"`)}}}function N(v,b){return v.includes(b)||b==="number"&&v.includes("integer")}function E(v,b){return v.includes(b)||b==="integer"&&v.includes("number")}function u(v,b){const O=[];for(const j of v.dataTypes)E(b,j)?O.push(j):b.includes("integer")&&j==="number"&&O.push("integer");v.dataTypes=O}function h(v,b){const O=v.schemaEnv.baseId+v.errSchemaPath;b+=` at "${O}" (strictTypes)`,(0,l.checkStrictMode)(v,b,v.opts.strictTypes)}class P{constructor(b,O,j){if((0,o.validateKeywordUsage)(b,O,j),this.gen=b.gen,this.allErrors=b.allErrors,this.keyword=j,this.data=b.data,this.schema=b.schema[j],this.$data=O.$data&&b.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(b,this.schema,j,this.$data),this.schemaType=O.schemaType,this.parentSchema=b.schema,this.params={},this.it=b,this.def=O,this.$data)this.schemaCode=b.gen.const("vSchema",W(this.$data,b));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,O.schemaType,O.allowUndefined))throw new Error(`${j} value must be ${JSON.stringify(O.schemaType)}`);("code"in O?O.trackErrors:O.errors!==!1)&&(this.errsCount=b.gen.const("_errs",c.default.errors))}result(b,O,j){this.failResult((0,a.not)(b),O,j)}failResult(b,O,j){this.gen.if(b),j?j():this.error(),O?(this.gen.else(),O(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(b,O){this.failResult((0,a.not)(b),void 0,O)}fail(b){if(b===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(b),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(b){if(!this.$data)return this.fail(b);const{schemaCode:O}=this;this.fail((0,a._)`${O} !== undefined && (${(0,a.or)(this.invalid$data(),b)})`)}error(b,O,j){if(O){this.setParams(O),this._error(b,j),this.setParams({});return}this._error(b,j)}_error(b,O){(b?f.reportExtraError:f.reportError)(this,this.def.error,O)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(b){this.allErrors||this.gen.if(b)}setParams(b,O){O?Object.assign(this.params,b):this.params=b}block$data(b,O,j=a.nil){this.gen.block(()=>{this.check$data(b,j),O()})}check$data(b=a.nil,O=a.nil){if(!this.$data)return;const{gen:j,schemaCode:M,schemaType:V,def:me}=this;j.if((0,a.or)((0,a._)`${M} === undefined`,O)),b!==a.nil&&j.assign(b,!0),(V.length||me.validateSchema)&&(j.elseIf(this.invalid$data()),this.$dataError(),b!==a.nil&&j.assign(b,!1)),j.else()}invalid$data(){const{gen:b,schemaCode:O,schemaType:j,def:M,it:V}=this;return(0,a.or)(me(),Oe());function me(){if(j.length){if(!(O instanceof a.Name))throw new Error("ajv implementation error");const _e=Array.isArray(j)?j:[j];return(0,a._)`${(0,n.checkDataTypes)(_e,O,V.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function Oe(){if(M.validateSchema){const _e=b.scopeValue("validate$data",{ref:M.validateSchema});return(0,a._)`!${_e}(${O})`}return a.nil}}subschema(b,O){const j=(0,i.getSubschema)(this.it,b);(0,i.extendSubschemaData)(j,this.it,b),(0,i.extendSubschemaMode)(j,b);const M={...this.it,...j,items:void 0,props:void 0};return R(M,O),M}mergeEvaluated(b,O){const{it:j,gen:M}=this;j.opts.unevaluated&&(j.props!==!0&&b.props!==void 0&&(j.props=l.mergeEvaluated.props(M,b.props,j.props,O)),j.items!==!0&&b.items!==void 0&&(j.items=l.mergeEvaluated.items(M,b.items,j.items,O)))}mergeValidEvaluated(b,O){const{it:j,gen:M}=this;if(j.opts.unevaluated&&(j.props!==!0||j.items!==!0))return M.if(O,()=>this.mergeEvaluated(b,a.Name)),!0}}Ot.KeywordCxt=P;function C(v,b,O,j){const M=new P(v,O,b);"code"in O?O.code(M,j):M.$data&&O.validate?(0,o.funcKeywordCode)(M,O):"macro"in O?(0,o.macroKeywordCode)(M,O):(O.compile||O.validate)&&(0,o.funcKeywordCode)(M,O)}const D=/^\/(?:[^~]|~0|~1)*$/,X=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W(v,{dataLevel:b,dataNames:O,dataPathArr:j}){let M,V;if(v==="")return c.default.rootData;if(v[0]==="/"){if(!D.test(v))throw new Error(`Invalid JSON-pointer: ${v}`);M=v,V=c.default.rootData}else{const ve=X.exec(v);if(!ve)throw new Error(`Invalid JSON-pointer: ${v}`);const pe=+ve[1];if(M=ve[2],M==="#"){if(pe>=b)throw new Error(_e("property/index",pe));return j[b-pe]}if(pe>b)throw new Error(_e("data",pe));if(V=O[b-pe],!M)return V}let me=V;const Oe=M.split("/");for(const ve of Oe)ve&&(V=(0,a._)`${V}${(0,a.getProperty)((0,l.unescapeJsonPointer)(ve))}`,me=(0,a._)`${me} && ${V}`);return me;function _e(ve,pe){return`Cannot access ${ve} ${pe} levels up, current level is ${b}`}}return Ot.getData=W,Ot}var wn={},Ki;function qo(){if(Ki)return wn;Ki=1,Object.defineProperty(wn,"__esModule",{value:!0});class e extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return wn.default=e,wn}var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0});const Ls=Le;let Tf=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ls.resolveUrl)(t,r,n),this.missingSchema=(0,Ls.normalizeId)((0,Ls.getFullPath)(t,this.missingRef))}};Ar.default=Tf;var He={};Object.defineProperty(He,"__esModule",{value:!0});He.resolveSchema=He.getCompilingSchema=He.resolveRef=He.compileSchema=He.SchemaEnv=void 0;const lt=ie,jf=qo(),tr=nt,gt=Le,Hi=q,Af=ps();let ys=class{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,gt.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={}}};He.SchemaEnv=ys;function Go(e){const t=jl.call(this,e);if(t)return t;const r=(0,gt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new lt.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let a;e.$async&&(a=i.scopeValue("Error",{ref:jf.default,code:(0,lt._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const d={gen:i,allErrors:this.opts.allErrors,data:tr.default.data,parentData:tr.default.parentData,parentDataProperty:tr.default.parentDataProperty,dataNames:[tr.default.data],dataPathArr:[lt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,lt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:lt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,lt._)`""`,opts:this.opts,self:this};let l;try{this._compilations.add(e),(0,Af.validateFunctionCode)(d),i.optimize(this.opts.code.optimize);const f=i.toString();l=`${i.scopeRefs(tr.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,e));const m=new Function(`${tr.default.self}`,`${tr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:$,items:g}=d;m.evaluated={props:$ instanceof lt.Name?void 0:$,items:g instanceof lt.Name?void 0:g,dynamicProps:$ instanceof lt.Name,dynamicItems:g instanceof lt.Name},m.source&&(m.source.evaluated=(0,lt.stringify)(m.evaluated))}return e.validate=m,e}catch(f){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),f}finally{this._compilations.delete(e)}}He.compileSchema=Go;function kf(e,t,r){var n;r=(0,gt.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=Df.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new ys({schema:i,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=Cf.call(this,o)}He.resolveRef=kf;function Cf(e){return(0,gt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Go.call(this,e)}function jl(e){for(const t of this._compilations)if(Mf(t,e))return t}He.getCompilingSchema=jl;function Mf(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Df(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||gs.call(this,e,t)}function gs(e,t){const r=this.opts.uriResolver.parse(t),n=(0,gt._getFullPath)(this.opts.uriResolver,r);let s=(0,gt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return zs.call(this,r,e);const o=(0,gt.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const a=gs.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:zs.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||Go.call(this,i),o===(0,gt.normalizeId)(t)){const{schema:a}=i,{schemaId:c}=this.opts,d=a[c];return d&&(s=(0,gt.resolveUrl)(this.opts.uriResolver,s,d)),new ys({schema:a,schemaId:c,root:e,baseId:s})}return zs.call(this,r,i)}}He.resolveSchema=gs;const Ff=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function zs(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,Hi.unescapeFragment)(a)];if(c===void 0)return;r=c;const d=typeof r=="object"&&r[this.opts.schemaId];!Ff.has(a)&&d&&(t=(0,gt.resolveUrl)(this.opts.uriResolver,t,d))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Hi.schemaHasRulesButRef)(r,this.RULES)){const a=(0,gt.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=gs.call(this,n,a)}const{schemaId:i}=this.opts;if(o=o||new ys({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const Lf="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",zf="Meta-schema for $data reference (JSON AnySchema extension proposal)",Vf="object",Uf=["$data"],qf={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Gf=!1,Kf={$id:Lf,description:zf,type:Vf,required:Uf,properties:qf,additionalProperties:Gf};var Ko={},$s={exports:{}};const Hf=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Al=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function kl(e){let t="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const Wf=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Wi(e){return e.length=0,!0}function xf(e,t,r){if(e.length){const n=kl(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Bf(e){let t=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,i=!1,a=xf;for(let c=0;c7){r.error=!0;break}c>0&&e[c-1]===":"&&(o=!0),n.push(":");continue}else if(d==="%"){if(!a(s,n,r))break;a=Wi}else{s.push(d);continue}}return s.length&&(a===Wi?r.zone=s.join(""):i?n.push(s.join("")):n.push(kl(s))),r.address=n.join(""),r}function Cl(e){if(Yf(e,":")<2)return{host:e,isIPV6:!1};const t=Bf(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Yf(e,t){let r=0;for(let n=0;nnew RegExp(I,w);m.code="new RegExp";const $=["removeAdditional","useDefaults","coerceTypes"],g=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."},p={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function R(I){var w,N,E,u,h,P,C,D,X,W,v,b,O,j,M,V,me,Oe,_e,ve,pe,Ze,Se,Jt,Xt;const it=I.strict,Zt=(w=I.code)===null||w===void 0?void 0:w.optimize,Ur=Zt===!0||Zt===void 0?1:Zt||0,qr=(E=(N=I.code)===null||N===void 0?void 0:N.regExp)!==null&&E!==void 0?E:m,ks=(u=I.uriResolver)!==null&&u!==void 0?u:y.default;return{strictSchema:(P=(h=I.strictSchema)!==null&&h!==void 0?h:it)!==null&&P!==void 0?P:!0,strictNumbers:(D=(C=I.strictNumbers)!==null&&C!==void 0?C:it)!==null&&D!==void 0?D:!0,strictTypes:(W=(X=I.strictTypes)!==null&&X!==void 0?X:it)!==null&&W!==void 0?W:"log",strictTuples:(b=(v=I.strictTuples)!==null&&v!==void 0?v:it)!==null&&b!==void 0?b:"log",strictRequired:(j=(O=I.strictRequired)!==null&&O!==void 0?O:it)!==null&&j!==void 0?j:!1,code:I.code?{...I.code,optimize:Ur,regExp:qr}:{optimize:Ur,regExp:qr},loopRequired:(M=I.loopRequired)!==null&&M!==void 0?M:S,loopEnum:(V=I.loopEnum)!==null&&V!==void 0?V:S,meta:(me=I.meta)!==null&&me!==void 0?me:!0,messages:(Oe=I.messages)!==null&&Oe!==void 0?Oe:!0,inlineRefs:(_e=I.inlineRefs)!==null&&_e!==void 0?_e:!0,schemaId:(ve=I.schemaId)!==null&&ve!==void 0?ve:"$id",addUsedSchema:(pe=I.addUsedSchema)!==null&&pe!==void 0?pe:!0,validateSchema:(Ze=I.validateSchema)!==null&&Ze!==void 0?Ze:!0,validateFormats:(Se=I.validateFormats)!==null&&Se!==void 0?Se:!0,unicodeRegExp:(Jt=I.unicodeRegExp)!==null&&Jt!==void 0?Jt:!0,int32range:(Xt=I.int32range)!==null&&Xt!==void 0?Xt:!0,uriResolver:ks}}class T{constructor(w={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,w=this.opts={...w,...R(w)};const{es5:N,lines:E}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:N,lines:E}),this.logger=Q(w.logger);const u=w.validateFormats;w.validateFormats=!1,this.RULES=(0,o.getRules)(),A.call(this,_,w,"NOT SUPPORTED"),A.call(this,p,w,"DEPRECATED","warn"),this._metaOpts=we.call(this),w.formats&&ye.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),w.keywords&&$e.call(this,w.keywords),typeof w.meta=="object"&&this.addMetaSchema(w.meta),Z.call(this),w.validateFormats=u}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:w,meta:N,schemaId:E}=this.opts;let u=f;E==="id"&&(u={...f},u.id=u.$id,delete u.$id),N&&w&&this.addMetaSchema(u,u[E],!1)}defaultMeta(){const{meta:w,schemaId:N}=this.opts;return this.opts.defaultMeta=typeof w=="object"?w[N]||w:void 0}validate(w,N){let E;if(typeof w=="string"){if(E=this.getSchema(w),!E)throw new Error(`no schema with key or ref "${w}"`)}else E=this.compile(w);const u=E(N);return"$async"in E||(this.errors=E.errors),u}compile(w,N){const E=this._addSchema(w,N);return E.validate||this._compileSchemaEnv(E)}compileAsync(w,N){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:E}=this.opts;return u.call(this,w,N);async function u(W,v){await h.call(this,W.$schema);const b=this._addSchema(W,v);return b.validate||P.call(this,b)}async function h(W){W&&!this.getSchema(W)&&await u.call(this,{$ref:W},!0)}async function P(W){try{return this._compileSchemaEnv(W)}catch(v){if(!(v instanceof s.default))throw v;return C.call(this,v),await D.call(this,v.missingSchema),P.call(this,W)}}function C({missingSchema:W,missingRef:v}){if(this.refs[W])throw new Error(`AnySchema ${W} is loaded but ${v} cannot be resolved`)}async function D(W){const v=await X.call(this,W);this.refs[W]||await h.call(this,v.$schema),this.refs[W]||this.addSchema(v,W,N)}async function X(W){const v=this._loading[W];if(v)return v;try{return await(this._loading[W]=E(W))}finally{delete this._loading[W]}}}addSchema(w,N,E,u=this.opts.validateSchema){if(Array.isArray(w)){for(const P of w)this.addSchema(P,void 0,E,u);return this}let h;if(typeof w=="object"){const{schemaId:P}=this.opts;if(h=w[P],h!==void 0&&typeof h!="string")throw new Error(`schema ${P} must be string`)}return N=(0,c.normalizeId)(N||h),this._checkUnique(N),this.schemas[N]=this._addSchema(w,E,N,u,!0),this}addMetaSchema(w,N,E=this.opts.validateSchema){return this.addSchema(w,N,!0,E),this}validateSchema(w,N){if(typeof w=="boolean")return!0;let E;if(E=w.$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 u=this.validate(E,w);if(!u&&N){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return u}getSchema(w){let N;for(;typeof(N=B.call(this,w))=="string";)w=N;if(N===void 0){const{schemaId:E}=this.opts,u=new i.SchemaEnv({schema:{},schemaId:E});if(N=i.resolveSchema.call(this,u,w),!N)return;this.refs[w]=N}return N.validate||this._compileSchemaEnv(N)}removeSchema(w){if(w instanceof RegExp)return this._removeAllSchemas(this.schemas,w),this._removeAllSchemas(this.refs,w),this;switch(typeof w){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const N=B.call(this,w);return typeof N=="object"&&this._cache.delete(N.schema),delete this.schemas[w],delete this.refs[w],this}case"object":{const N=w;this._cache.delete(N);let E=w[this.opts.schemaId];return E&&(E=(0,c.normalizeId)(E),delete this.schemas[E],delete this.refs[E]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(w){for(const N of w)this.addKeyword(N);return this}addKeyword(w,N){let E;if(typeof w=="string")E=w,typeof N=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),N.keyword=E);else if(typeof w=="object"&&N===void 0){if(N=w,E=N.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(k.call(this,E,N),!N)return(0,l.eachItem)(E,h=>F.call(this,h)),this;U.call(this,N);const u={...N,type:(0,d.getJSONTypes)(N.type),schemaType:(0,d.getJSONTypes)(N.schemaType)};return(0,l.eachItem)(E,u.type.length===0?h=>F.call(this,h,u):h=>u.type.forEach(P=>F.call(this,h,u,P))),this}getKeyword(w){const N=this.RULES.all[w];return typeof N=="object"?N.definition:!!N}removeKeyword(w){const{RULES:N}=this;delete N.keywords[w],delete N.all[w];for(const E of N.rules){const u=E.rules.findIndex(h=>h.keyword===w);u>=0&&E.rules.splice(u,1)}return this}addFormat(w,N){return typeof N=="string"&&(N=new RegExp(N)),this.formats[w]=N,this}errorsText(w=this.errors,{separator:N=", ",dataVar:E="data"}={}){return!w||w.length===0?"No errors":w.map(u=>`${E}${u.instancePath} ${u.message}`).reduce((u,h)=>u+N+h)}$dataMetaSchema(w,N){const E=this.RULES.all;w=JSON.parse(JSON.stringify(w));for(const u of N){const h=u.split("/").slice(1);let P=w;for(const C of h)P=P[C];for(const C in E){const D=E[C];if(typeof D!="object")continue;const{$data:X}=D.definition,W=P[C];X&&W&&(P[C]=K(W))}}return w}_removeAllSchemas(w,N){for(const E in w){const u=w[E];(!N||N.test(E))&&(typeof u=="string"?delete w[E]:u&&!u.meta&&(this._cache.delete(u.schema),delete w[E]))}}_addSchema(w,N,E,u=this.opts.validateSchema,h=this.opts.addUsedSchema){let P;const{schemaId:C}=this.opts;if(typeof w=="object")P=w[C];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof w!="boolean")throw new Error("schema must be object or boolean")}let D=this._cache.get(w);if(D!==void 0)return D;E=(0,c.normalizeId)(P||E);const X=c.getSchemaRefs.call(this,w,E);return D=new i.SchemaEnv({schema:w,schemaId:C,meta:N,baseId:E,localRefs:X}),this._cache.set(D.schema,D),h&&!E.startsWith("#")&&(E&&this._checkUnique(E),this.refs[E]=D),u&&this.validateSchema(w,!0),D}_checkUnique(w){if(this.schemas[w]||this.refs[w])throw new Error(`schema with key or id "${w}" already exists`)}_compileSchemaEnv(w){if(w.meta?this._compileMetaSchema(w):i.compileSchema.call(this,w),!w.validate)throw new Error("ajv implementation error");return w.validate}_compileMetaSchema(w){const N=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,w)}finally{this.opts=N}}}T.ValidationError=n.default,T.MissingRefError=s.default,e.default=T;function A(I,w,N,E="error"){for(const u in I){const h=u;h in w&&this.logger[E](`${N}: option ${u}. ${I[h]}`)}}function B(I){return I=(0,c.normalizeId)(I),this.schemas[I]||this.refs[I]}function Z(){const I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(const w in I)this.addSchema(I[w],w)}function ye(){for(const I in this.opts.formats){const w=this.opts.formats[I];w&&this.addFormat(I,w)}}function $e(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const w in I){const N=I[w];N.keyword||(N.keyword=w),this.addKeyword(N)}}function we(){const I={...this.opts};for(const w of $)delete I[w];return I}const G={log(){},warn(){},error(){}};function Q(I){if(I===!1)return G;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}const J=/^[a-z_$][a-z0-9_$:-]*$/i;function k(I,w){const{RULES:N}=this;if((0,l.eachItem)(I,E=>{if(N.keywords[E])throw new Error(`Keyword ${E} is already defined`);if(!J.test(E))throw new Error(`Keyword ${E} has invalid name`)}),!!w&&w.$data&&!("code"in w||"validate"in w))throw new Error('$data keyword must have "code" or "validate" function')}function F(I,w,N){var E;const u=w==null?void 0:w.post;if(N&&u)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let P=u?h.post:h.rules.find(({type:D})=>D===N);if(P||(P={type:N,rules:[]},h.rules.push(P)),h.keywords[I]=!0,!w)return;const C={keyword:I,definition:{...w,type:(0,d.getJSONTypes)(w.type),schemaType:(0,d.getJSONTypes)(w.schemaType)}};w.before?H.call(this,P,C,w.before):P.rules.push(C),h.all[I]=C,(E=w.implements)===null||E===void 0||E.forEach(D=>this.addKeyword(D))}function H(I,w,N){const E=I.rules.findIndex(u=>u.keyword===N);E>=0?I.rules.splice(E,0,w):(I.rules.push(w),this.logger.warn(`rule ${N} is not defined`))}function U(I){let{metaSchema:w}=I;w!==void 0&&(I.$data&&this.opts.$data&&(w=K(w)),I.validateSchema=this.compile(w,!0))}const ee={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function K(I){return{anyOf:[I,ee]}}})(pl);var xo={},Bo={},Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});const wh={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Yo.default=wh;var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.callRef=Mt.getValidate=void 0;const Eh=Ar,xi=de,Be=ie,gr=nt,Bi=He,bn=q,bh={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:d}=o;if((r==="#"||r==="#/")&&s===d.baseId)return f();const l=Bi.resolveRef.call(c,d,s,r);if(l===void 0)throw new Eh.default(n.opts.uriResolver,s,r);if(l instanceof Bi.SchemaEnv)return y(l);return m(l);function f(){if(o===d)return Hn(e,i,o,o.$async);const $=t.scopeValue("root",{ref:d});return Hn(e,(0,Be._)`${$}.validate`,d,d.$async)}function y($){const g=Kl(e,$);Hn(e,g,$,$.$async)}function m($){const g=t.scopeValue("schema",a.code.source===!0?{ref:$,code:(0,Be.stringify)($)}:{ref:$}),_=t.name("valid"),p=e.subschema({schema:$,dataTypes:[],schemaPath:Be.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(p),e.ok(_)}}};function Kl(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Mt.getValidate=Kl;function Hn(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,d=c.passContext?gr.default.this:Be.nil;n?l():f();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");const $=s.let("valid");s.try(()=>{s.code((0,Be._)`await ${(0,xi.callValidateCode)(e,t,d)}`),m(t),i||s.assign($,!0)},g=>{s.if((0,Be._)`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),y(g),i||s.assign($,!1)}),e.ok($)}function f(){e.result((0,xi.callValidateCode)(e,t,d),()=>m(t),()=>y(t))}function y($){const g=(0,Be._)`${$}.errors`;s.assign(gr.default.vErrors,(0,Be._)`${gr.default.vErrors} === null ? ${g} : ${gr.default.vErrors}.concat(${g})`),s.assign(gr.default.errors,(0,Be._)`${gr.default.vErrors}.length`)}function m($){var g;if(!o.opts.unevaluated)return;const _=(g=r==null?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(o.props=bn.mergeEvaluated.props(s,_.props,o.props));else{const p=s.var("props",(0,Be._)`${$}.evaluated.props`);o.props=bn.mergeEvaluated.props(s,p,o.props,Be.Name)}if(o.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(o.items=bn.mergeEvaluated.items(s,_.items,o.items));else{const p=s.var("items",(0,Be._)`${$}.evaluated.items`);o.items=bn.mergeEvaluated.items(s,p,o.items,Be.Name)}}}Mt.callRef=Hn;Mt.default=bh;Object.defineProperty(Bo,"__esModule",{value:!0});const Sh=Yo,Ph=Mt,Nh=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Sh.default,Ph.default];Bo.default=Nh;var Jo={},Xo={};Object.defineProperty(Xo,"__esModule",{value:!0});const ns=ie,Vt=ns.operators,ss={maximum:{okStr:"<=",ok:Vt.LTE,fail:Vt.GT},minimum:{okStr:">=",ok:Vt.GTE,fail:Vt.LT},exclusiveMaximum:{okStr:"<",ok:Vt.LT,fail:Vt.GTE},exclusiveMinimum:{okStr:">",ok:Vt.GT,fail:Vt.LTE}},Rh={message:({keyword:e,schemaCode:t})=>(0,ns.str)`must be ${ss[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ns._)`{comparison: ${ss[e].okStr}, limit: ${t}}`},Oh={keyword:Object.keys(ss),type:"number",schemaType:"number",$data:!0,error:Rh,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ns._)`${r} ${ss[t].fail} ${n} || isNaN(${r})`)}};Xo.default=Oh;var Zo={};Object.defineProperty(Zo,"__esModule",{value:!0});const Qr=ie,Ih={message:({schemaCode:e})=>(0,Qr.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Qr._)`{multipleOf: ${e}}`},Th={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ih,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?(0,Qr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Qr._)`${i} !== parseInt(${i})`;e.fail$data((0,Qr._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Zo.default=Th;var Qo={},ea={};Object.defineProperty(ea,"__esModule",{value:!0});function Hl(e){const t=e.length;let r=0,n=0,s;for(;n=55296&&s<=56319&&n(0,sr._)`{limit: ${e}}`},Ch={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:kh,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?sr.operators.GT:sr.operators.LT,i=s.opts.unicode===!1?(0,sr._)`${r}.length`:(0,sr._)`${(0,jh.useFunc)(e.gen,Ah.default)}(${r})`;e.fail$data((0,sr._)`${i} ${o} ${n}`)}};Qo.default=Ch;var ta={};Object.defineProperty(ta,"__esModule",{value:!0});const Mh=de,os=ie,Dh={message:({schemaCode:e})=>(0,os.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,os._)`{pattern: ${e}}`},Fh={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Dh,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",a=r?(0,os._)`(new RegExp(${s}, ${i}))`:(0,Mh.usePattern)(e,n);e.fail$data((0,os._)`!${a}.test(${t})`)}};ta.default=Fh;var ra={};Object.defineProperty(ra,"__esModule",{value:!0});const en=ie,Lh={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,en.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,en._)`{limit: ${e}}`},zh={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Lh,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?en.operators.GT:en.operators.LT;e.fail$data((0,en._)`Object.keys(${r}).length ${s} ${n}`)}};ra.default=zh;var na={};Object.defineProperty(na,"__esModule",{value:!0});const Hr=de,tn=ie,Vh=q,Uh={message:({params:{missingProperty:e}})=>(0,tn.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,tn._)`{missingProperty: ${e}}`},qh={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Uh,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&r.length===0)return;const c=r.length>=a.loopRequired;if(i.allErrors?d():l(),a.strictRequired){const m=e.parentSchema.properties,{definedProperties:$}=e.it;for(const g of r)if((m==null?void 0:m[g])===void 0&&!$.has(g)){const _=i.schemaEnv.baseId+i.errSchemaPath,p=`required property "${g}" is not defined at "${_}" (strictRequired)`;(0,Vh.checkStrictMode)(i,p,i.opts.strictRequired)}}function d(){if(c||o)e.block$data(tn.nil,f);else for(const m of r)(0,Hr.checkReportMissingProp)(e,m)}function l(){const m=t.let("missing");if(c||o){const $=t.let("valid",!0);e.block$data($,()=>y(m,$)),e.ok($)}else t.if((0,Hr.checkMissingProp)(e,r,m)),(0,Hr.reportMissingProp)(e,m),t.else()}function f(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,Hr.noPropertyInData)(t,s,m,a.ownProperties),()=>e.error())})}function y(m,$){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign($,(0,Hr.propertyInData)(t,s,m,a.ownProperties)),t.if((0,tn.not)($),()=>{e.error(),t.break()})},tn.nil)}}};na.default=qh;var sa={};Object.defineProperty(sa,"__esModule",{value:!0});const rn=ie,Gh={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,rn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,rn._)`{limit: ${e}}`},Kh={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Gh,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?rn.operators.GT:rn.operators.LT;e.fail$data((0,rn._)`${r}.length ${s} ${n}`)}};sa.default=Kh;var oa={},mn={};Object.defineProperty(mn,"__esModule",{value:!0});const Wl=ms;Wl.code='require("ajv/dist/runtime/equal").default';mn.default=Wl;Object.defineProperty(oa,"__esModule",{value:!0});const Vs=Ae,De=ie,Hh=q,Wh=mn,xh={message:({params:{i:e,j:t}})=>(0,De.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,De._)`{i: ${e}, j: ${t}}`},Bh={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:xh,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!n&&!s)return;const c=t.let("valid"),d=o.items?(0,Vs.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,De._)`${i} === false`),e.ok(c);function l(){const $=t.let("i",(0,De._)`${r}.length`),g=t.let("j");e.setParams({i:$,j:g}),t.assign(c,!0),t.if((0,De._)`${$} > 1`,()=>(f()?y:m)($,g))}function f(){return d.length>0&&!d.some($=>$==="object"||$==="array")}function y($,g){const _=t.name("item"),p=(0,Vs.checkDataTypes)(d,_,a.opts.strictNumbers,Vs.DataType.Wrong),S=t.const("indices",(0,De._)`{}`);t.for((0,De._)`;${$}--;`,()=>{t.let(_,(0,De._)`${r}[${$}]`),t.if(p,(0,De._)`continue`),d.length>1&&t.if((0,De._)`typeof ${_} == "string"`,(0,De._)`${_} += "_"`),t.if((0,De._)`typeof ${S}[${_}] == "number"`,()=>{t.assign(g,(0,De._)`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,De._)`${S}[${_}] = ${$}`)})}function m($,g){const _=(0,Hh.useFunc)(t,Wh.default),p=t.name("outer");t.label(p).for((0,De._)`;${$}--;`,()=>t.for((0,De._)`${g} = ${$}; ${g}--;`,()=>t.if((0,De._)`${_}(${r}[${$}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(p)})))}}};oa.default=Bh;var aa={};Object.defineProperty(aa,"__esModule",{value:!0});const fo=ie,Yh=q,Jh=mn,Xh={message:"must be equal to constant",params:({schemaCode:e})=>(0,fo._)`{allowedValue: ${e}}`},Zh={keyword:"const",$data:!0,error:Xh,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,fo._)`!${(0,Yh.useFunc)(t,Jh.default)}(${r}, ${s})`):e.fail((0,fo._)`${o} !== ${r}`)}};aa.default=Zh;var ia={};Object.defineProperty(ia,"__esModule",{value:!0});const Xr=ie,Qh=q,em=mn,tm={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Xr._)`{allowedValues: ${e}}`},rm={keyword:"enum",schemaType:"array",$data:!0,error:tm,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const a=s.length>=i.opts.loopEnum;let c;const d=()=>c??(c=(0,Qh.useFunc)(t,em.default));let l;if(a||n)l=t.let("valid"),e.block$data(l,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const m=t.const("vSchema",o);l=(0,Xr.or)(...s.map(($,g)=>y(m,g)))}e.pass(l);function f(){t.assign(l,!1),t.forOf("v",o,m=>t.if((0,Xr._)`${d()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function y(m,$){const g=s[$];return typeof g=="object"&&g!==null?(0,Xr._)`${d()}(${r}, ${m}[${$}])`:(0,Xr._)`${r} === ${g}`}}};ia.default=rm;Object.defineProperty(Jo,"__esModule",{value:!0});const nm=Xo,sm=Zo,om=Qo,am=ta,im=ra,cm=na,lm=sa,um=oa,dm=aa,fm=ia,hm=[nm.default,sm.default,om.default,am.default,im.default,cm.default,lm.default,um.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dm.default,fm.default];Jo.default=hm;var ca={},kr={};Object.defineProperty(kr,"__esModule",{value:!0});kr.validateAdditionalItems=void 0;const or=ie,ho=q,mm={message:({params:{len:e}})=>(0,or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,or._)`{limit: ${e}}`},pm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:mm,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,ho.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}xl(e,n)}};function xl(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const a=r.const("len",(0,or._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,or._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,ho.alwaysValidSchema)(i,n)){const d=r.var("valid",(0,or._)`${a} <= ${t.length}`);r.if((0,or.not)(d),()=>c(d)),e.ok(d)}function c(d){r.forRange("i",t.length,a,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:ho.Type.Num},d),i.allErrors||r.if((0,or.not)(d),()=>r.break())})}}kr.validateAdditionalItems=xl;kr.default=pm;var la={},Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.validateTuple=void 0;const Yi=ie,Wn=q,ym=de,gm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Bl(e,"additionalItems",t);r.items=!0,!(0,Wn.alwaysValidSchema)(r,t)&&e.ok((0,ym.validateArray)(e))}};function Bl(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:a}=e;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Wn.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),d=n.const("len",(0,Yi._)`${o}.length`);r.forEach((f,y)=>{(0,Wn.alwaysValidSchema)(a,f)||(n.if((0,Yi._)`${d} > ${y}`,()=>e.subschema({keyword:i,schemaProp:y,dataProp:y},c)),e.ok(c))});function l(f){const{opts:y,errSchemaPath:m}=a,$=r.length,g=$===f.minItems&&($===f.maxItems||f[t]===!1);if(y.strictTuples&&!g){const _=`"${i}" is ${$}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Wn.checkStrictMode)(a,_,y.strictTuples)}}}Cr.validateTuple=Bl;Cr.default=gm;Object.defineProperty(la,"__esModule",{value:!0});const $m=Cr,_m={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,$m.validateTuple)(e,"items")};la.default=_m;var ua={};Object.defineProperty(ua,"__esModule",{value:!0});const Ji=ie,vm=q,wm=de,Em=kr,bm={message:({params:{len:e}})=>(0,Ji.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ji._)`{limit: ${e}}`},Sm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:bm,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,vm.alwaysValidSchema)(n,t)&&(s?(0,Em.validateAdditionalItems)(e,s):e.ok((0,wm.validateArray)(e)))}};ua.default=Sm;var da={};Object.defineProperty(da,"__esModule",{value:!0});const ot=ie,Sn=q,Pm={message:({params:{min:e,max:t}})=>t===void 0?(0,ot.str)`must contain at least ${e} valid item(s)`:(0,ot.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ot._)`{minContains: ${e}}`:(0,ot._)`{minContains: ${e}, maxContains: ${t}}`},Nm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Pm,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,a;const{minContains:c,maxContains:d}=n;o.opts.next?(i=c===void 0?1:c,a=d):i=1;const l=t.const("len",(0,ot._)`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Sn.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Sn.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Sn.alwaysValidSchema)(o,r)){let g=(0,ot._)`${l} >= ${i}`;a!==void 0&&(g=(0,ot._)`${g} && ${l} <= ${a}`),e.pass(g);return}o.items=!0;const f=t.name("valid");a===void 0&&i===1?m(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,ot._)`${s}.length > 0`,y)):(t.let(f,!1),y()),e.result(f,()=>e.reset());function y(){const g=t.name("_valid"),_=t.let("count",0);m(g,()=>t.if(g,()=>$(_)))}function m(g,_){t.forRange("i",0,l,p=>{e.subschema({keyword:"contains",dataProp:p,dataPropType:Sn.Type.Num,compositeRule:!0},g),_()})}function $(g){t.code((0,ot._)`${g}++`),a===void 0?t.if((0,ot._)`${g} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,ot._)`${g} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,ot._)`${g} >= ${i}`,()=>t.assign(f,!0)))}}};da.default=Nm;var _s={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ie,r=q,n=de;e.error={message:({params:{property:c,depsCount:d,deps:l}})=>{const f=d===1?"property":"properties";return(0,t.str)`must have ${f} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:d,deps:l,missingProperty:f}})=>(0,t._)`{property: ${c}, +"use strict";var nf=Object.defineProperty;var Qi=e=>{throw TypeError(e)};var sf=(e,t,r)=>t in e?nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var J=(e,t,r)=>sf(e,typeof t!="symbol"?t+"":t,r),Zs=(e,t,r)=>t.has(e)||Qi("Cannot "+r);var ne=(e,t,r)=>(Zs(e,t,"read from private field"),r?r.call(e):t.get(e)),yt=(e,t,r)=>t.has(e)?Qi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Be=(e,t,r,n)=>(Zs(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Pt=(e,t,r)=>(Zs(e,t,"access private method"),r);const C=require("electron"),z=require("path"),q=require("fs"),_e=require("node:process"),de=require("node:path"),Re=require("node:util"),Q=require("node:fs"),lr=require("node:crypto"),ec=require("node:assert"),Zo=require("node:os"),of=require("node:events"),af=require("node:stream"),He=require("node:fs/promises"),nn=require("child_process"),Nr=require("crypto");function cf(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Z=cf(de),Er=e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},Al=new Set(["__proto__","prototype","constructor"]),kl=1e6,lf=e=>e>="0"&&e<="9";function Cl(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=kl}return!1}function Qs(e,t){return Al.has(e)?!1:(e&&Cl(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}function uf(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",s=!1,o=0;for(const a of e){if(o++,s){r+=a,s=!1;continue}if(a==="\\"){if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);s=!0,n=n==="start"?"property":n;continue}switch(a){case".":{if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd"){n="property";break}if(!Qs(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Qs(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const i=Number.parseInt(r,10);!Number.isNaN(i)&&Number.isFinite(i)&&i>=0&&i<=Number.MAX_SAFE_INTEGER&&i<=kl&&r===String(i)?t.push(i):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);r+=a;break}default:{if(n==="index"&&!lf(a))throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);n==="start"&&(n="property"),r+=a}}}switch(s&&(r+="\\"),n){case"property":{if(!Qs(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}function js(e){if(typeof e=="string")return uf(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(Al.has(n))return[];typeof n=="string"&&Cl(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}function tc(e,t,r){if(!Er(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=js(t);if(n.length===0)return r;for(let s=0;s{const t=de.join(Gt,"Library");return{data:de.join(t,"Application Support",e),config:de.join(t,"Preferences",e),cache:de.join(t,"Caches",e),log:de.join(t,"Logs",e),temp:de.join(Qo,e)}},hf=e=>{const t=Cr.APPDATA||de.join(Gt,"AppData","Roaming"),r=Cr.LOCALAPPDATA||de.join(Gt,"AppData","Local");return{data:de.join(r,e,"Data"),config:de.join(t,e,"Config"),cache:de.join(r,e,"Cache"),log:de.join(r,e,"Log"),temp:de.join(Qo,e)}},mf=e=>{const t=de.basename(Gt);return{data:de.join(Cr.XDG_DATA_HOME||de.join(Gt,".local","share"),e),config:de.join(Cr.XDG_CONFIG_HOME||de.join(Gt,".config"),e),cache:de.join(Cr.XDG_CACHE_HOME||de.join(Gt,".cache"),e),log:de.join(Cr.XDG_STATE_HOME||de.join(Gt,".local","state"),e),temp:de.join(Qo,t,e)}};function pf(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),_e.platform==="darwin"?ff(e):_e.platform==="win32"?hf(e):mf(e)}const kt=(e,t)=>{const{onError:r}=t;return function(...s){return e.apply(void 0,s).catch(r)}},Nt=(e,t)=>{const{onError:r}=t;return function(...s){try{return e.apply(void 0,s)}catch(o){return r(o)}}},yf=250,Ct=(e,t)=>{const{isRetriable:r}=t;return function(s){const{timeout:o}=s,a=s.interval??yf,i=Date.now()+o;return function c(...d){return e.apply(void 0,d).catch(u=>{if(!r(u)||Date.now()>=i)throw u;const f=Math.round(a*Math.random());return f>0?new Promise(y=>setTimeout(y,f)).then(()=>c.apply(void 0,d)):c.apply(void 0,d)})}}},Mt=(e,t)=>{const{isRetriable:r}=t;return function(s){const{timeout:o}=s,a=Date.now()+o;return function(...c){for(;;)try{return e.apply(void 0,c)}catch(d){if(!r(d)||Date.now()>=a)throw d;continue}}}},Mr={isChangeErrorOk:e=>{if(!Mr.isNodeError(e))return!1;const{code:t}=e;return t==="ENOSYS"||!$f&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!Mr.isNodeError(e))return!1;const{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!Mr.isNodeError(e))throw e;if(!Mr.isChangeErrorOk(e))throw e}},Fn={onError:Mr.onChangeError},Ye={onError:()=>{}},$f=_e.getuid?!_e.getuid():!1,ke={isRetriable:Mr.isRetriableError},De={attempt:{chmod:kt(Re.promisify(Q.chmod),Fn),chown:kt(Re.promisify(Q.chown),Fn),close:kt(Re.promisify(Q.close),Ye),fsync:kt(Re.promisify(Q.fsync),Ye),mkdir:kt(Re.promisify(Q.mkdir),Ye),realpath:kt(Re.promisify(Q.realpath),Ye),stat:kt(Re.promisify(Q.stat),Ye),unlink:kt(Re.promisify(Q.unlink),Ye),chmodSync:Nt(Q.chmodSync,Fn),chownSync:Nt(Q.chownSync,Fn),closeSync:Nt(Q.closeSync,Ye),existsSync:Nt(Q.existsSync,Ye),fsyncSync:Nt(Q.fsync,Ye),mkdirSync:Nt(Q.mkdirSync,Ye),realpathSync:Nt(Q.realpathSync,Ye),statSync:Nt(Q.statSync,Ye),unlinkSync:Nt(Q.unlinkSync,Ye)},retry:{close:Ct(Re.promisify(Q.close),ke),fsync:Ct(Re.promisify(Q.fsync),ke),open:Ct(Re.promisify(Q.open),ke),readFile:Ct(Re.promisify(Q.readFile),ke),rename:Ct(Re.promisify(Q.rename),ke),stat:Ct(Re.promisify(Q.stat),ke),write:Ct(Re.promisify(Q.write),ke),writeFile:Ct(Re.promisify(Q.writeFile),ke),closeSync:Mt(Q.closeSync,ke),fsyncSync:Mt(Q.fsyncSync,ke),openSync:Mt(Q.openSync,ke),readFileSync:Mt(Q.readFileSync,ke),renameSync:Mt(Q.renameSync,ke),statSync:Mt(Q.statSync,ke),writeSync:Mt(Q.writeSync,ke),writeFileSync:Mt(Q.writeFileSync,ke)}},gf="utf8",rc=438,_f=511,vf={},wf=_e.geteuid?_e.geteuid():-1,Ef=_e.getegid?_e.getegid():-1,bf=1e3,Sf=!!_e.getuid;_e.getuid&&_e.getuid();const nc=128,Pf=e=>e instanceof Error&&"code"in e,sc=e=>typeof e=="string",to=e=>e===void 0,Nf=_e.platform==="linux",Ml=_e.platform==="win32",ea=["SIGHUP","SIGINT","SIGTERM"];Ml||ea.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");Nf&&ea.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");class Rf{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=t=>{if(!this.exited){this.exited=!0;for(const r of this.callbacks)r();t&&(Ml&&t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL"?_e.kill(_e.pid,"SIGTERM"):_e.kill(_e.pid,t))}},this.hook=()=>{_e.once("exit",()=>this.exit());for(const t of ea)try{_e.once(t,()=>this.exit(t))}catch{}},this.register=t=>(this.callbacks.add(t),()=>{this.callbacks.delete(t)}),this.hook()}}const Of=new Rf,If=Of.register,Fe={store:{},create:e=>{const t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),s=`.tmp-${Date.now().toString().slice(-10)}${t}`;return`${e}${s}`},get:(e,t,r=!0)=>{const n=Fe.truncate(t(e));return n in Fe.store?Fe.get(e,t,r):(Fe.store[n]=r,[n,()=>delete Fe.store[n]])},purge:e=>{Fe.store[e]&&(delete Fe.store[e],De.attempt.unlink(e))},purgeSync:e=>{Fe.store[e]&&(delete Fe.store[e],De.attempt.unlinkSync(e))},purgeSyncAll:()=>{for(const e in Fe.store)Fe.purgeSync(e)},truncate:e=>{const t=de.basename(e);if(t.length<=nc)return e;const r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;const n=t.length-nc;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};If(Fe.purgeSyncAll);function Dl(e,t,r=vf){if(sc(r))return Dl(e,t,{encoding:r});const s={timeout:r.timeout??bf};let o=null,a=null,i=null;try{const c=De.attempt.realpathSync(e),d=!!c;e=c||e,[a,o]=Fe.get(e,r.tmpCreate||Fe.create,r.tmpPurge!==!1);const u=Sf&&to(r.chown),f=to(r.mode);if(d&&(u||f)){const v=De.attempt.statSync(e);v&&(r={...r},u&&(r.chown={uid:v.uid,gid:v.gid}),f&&(r.mode=v.mode))}if(!d){const v=de.dirname(e);De.attempt.mkdirSync(v,{mode:_f,recursive:!0})}i=De.retry.openSync(s)(a,"w",r.mode||rc),r.tmpCreated&&r.tmpCreated(a),sc(t)?De.retry.writeSync(s)(i,t,0,r.encoding||gf):to(t)||De.retry.writeSync(s)(i,t,0,t.length,0),r.fsync!==!1&&(r.fsyncWait!==!1?De.retry.fsyncSync(s)(i):De.attempt.fsync(i)),De.retry.closeSync(s)(i),i=null,r.chown&&(r.chown.uid!==wf||r.chown.gid!==Ef)&&De.attempt.chownSync(a,r.chown.uid,r.chown.gid),r.mode&&r.mode!==rc&&De.attempt.chmodSync(a,r.mode);try{De.retry.renameSync(s)(a,e)}catch(v){if(!Pf(v)||v.code!=="ENAMETOOLONG")throw v;De.retry.renameSync(s)(a,Fe.truncate(e))}o(),a=null}finally{i&&De.attempt.closeSync(i),a&&Fe.purge(a)}}function Fl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ro={exports:{}},Ll={},ft={},qr={},In={},se={},Rn={};(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(E){if(super(),!e.IDENTIFIER.test(E))throw new Error("CodeGen: name must be a valid identifier");this.str=E}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(E){super(),this._items=typeof E=="string"?[E]:E}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const E=this._items[0];return E===""||E==='""'}get str(){var E;return(E=this._str)!==null&&E!==void 0?E:this._str=this._items.reduce((N,R)=>`${N}${R}`,"")}get names(){var E;return(E=this._names)!==null&&E!==void 0?E:this._names=this._items.reduce((N,R)=>(R instanceof r&&(N[R.str]=(N[R.str]||0)+1),N),{})}}e._Code=n,e.nil=new n("");function s(m,...E){const N=[m[0]];let R=0;for(;R{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${d}${f.scopePath}`})}scopeCode(d=this._values,u,f){return this._reduceValues(d,v=>{if(v.value===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return v.value.code},u,f)}_reduceValues(d,u,f={},v){let y=t.nil;for(const w in d){const g=d[w];if(!g)continue;const $=f[w]=f[w]||new Map;g.forEach(m=>{if($.has(m))return;$.set(m,n.Started);let E=u(m);if(E){const N=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${N} ${m} = ${E};${this.opts._n}`}else if(E=v==null?void 0:v(m))y=(0,t._)`${y}${E}${this.opts._n}`;else throw new r(m);$.set(m,n.Completed)})}return y}}e.ValueScope=i})(Oo);(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=Rn,r=Oo;var n=Rn;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=Oo;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(l,h){return this}}class a extends o{constructor(l,h,b){super(),this.varKind=l,this.name=h,this.rhs=b}render({es5:l,_n:h}){const b=l?r.varKinds.var:this.varKind,I=this.rhs===void 0?"":` = ${this.rhs}`;return`${b} ${this.name}${I};`+h}optimizeNames(l,h){if(l[this.name.str])return this.rhs&&(this.rhs=T(this.rhs,l,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends o{constructor(l,h,b){super(),this.lhs=l,this.rhs=h,this.sideEffects=b}render({_n:l}){return`${this.lhs} = ${this.rhs};`+l}optimizeNames(l,h){if(!(this.lhs instanceof t.Name&&!l[this.lhs.str]&&!this.sideEffects))return this.rhs=T(this.rhs,l,h),this}get names(){const l=this.lhs instanceof t.Name?{}:{...this.lhs.names};return fe(l,this.rhs)}}class c extends i{constructor(l,h,b,I){super(l,b,I),this.op=h}render({_n:l}){return`${this.lhs} ${this.op}= ${this.rhs};`+l}}class d extends o{constructor(l){super(),this.label=l,this.names={}}render({_n:l}){return`${this.label}:`+l}}class u extends o{constructor(l){super(),this.label=l,this.names={}}render({_n:l}){return`break${this.label?` ${this.label}`:""};`+l}}class f extends o{constructor(l){super(),this.error=l}render({_n:l}){return`throw ${this.error};`+l}get names(){return this.error.names}}class v extends o{constructor(l){super(),this.code=l}render({_n:l}){return`${this.code};`+l}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(l,h){return this.code=T(this.code,l,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends o{constructor(l=[]){super(),this.nodes=l}render(l){return this.nodes.reduce((h,b)=>h+b.render(l),"")}optimizeNodes(){const{nodes:l}=this;let h=l.length;for(;h--;){const b=l[h].optimizeNodes();Array.isArray(b)?l.splice(h,1,...b):b?l[h]=b:l.splice(h,1)}return l.length>0?this:void 0}optimizeNames(l,h){const{nodes:b}=this;let I=b.length;for(;I--;){const j=b[I];j.optimizeNames(l,h)||(A(l,j.names),b.splice(I,1))}return b.length>0?this:void 0}get names(){return this.nodes.reduce((l,h)=>Y(l,h.names),{})}}class w extends y{render(l){return"{"+l._n+super.render(l)+"}"+l._n}}class g extends y{}class $ extends w{}$.kind="else";class m extends w{constructor(l,h){super(h),this.condition=l}render(l){let h=`if(${this.condition})`+super.render(l);return this.else&&(h+="else "+this.else.render(l)),h}optimizeNodes(){super.optimizeNodes();const l=this.condition;if(l===!0)return this.nodes;let h=this.else;if(h){const b=h.optimizeNodes();h=this.else=Array.isArray(b)?new $(b):b}if(h)return l===!1?h instanceof m?h:h.nodes:this.nodes.length?this:new m(V(l),h instanceof m?[h]:h.nodes);if(!(l===!1||!this.nodes.length))return this}optimizeNames(l,h){var b;if(this.else=(b=this.else)===null||b===void 0?void 0:b.optimizeNames(l,h),!!(super.optimizeNames(l,h)||this.else))return this.condition=T(this.condition,l,h),this}get names(){const l=super.names;return fe(l,this.condition),this.else&&Y(l,this.else.names),l}}m.kind="if";class E extends w{}E.kind="for";class N extends E{constructor(l){super(),this.iteration=l}render(l){return`for(${this.iteration})`+super.render(l)}optimizeNames(l,h){if(super.optimizeNames(l,h))return this.iteration=T(this.iteration,l,h),this}get names(){return Y(super.names,this.iteration.names)}}class R extends E{constructor(l,h,b,I){super(),this.varKind=l,this.name=h,this.from=b,this.to=I}render(l){const h=l.es5?r.varKinds.var:this.varKind,{name:b,from:I,to:j}=this;return`for(${h} ${b}=${I}; ${b}<${j}; ${b}++)`+super.render(l)}get names(){const l=fe(super.names,this.from);return fe(l,this.to)}}class O extends E{constructor(l,h,b,I){super(),this.loop=l,this.varKind=h,this.name=b,this.iterable=I}render(l){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(l)}optimizeNames(l,h){if(super.optimizeNames(l,h))return this.iterable=T(this.iterable,l,h),this}get names(){return Y(super.names,this.iterable.names)}}class x extends w{constructor(l,h,b){super(),this.name=l,this.args=h,this.async=b}render(l){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(l)}}x.kind="func";class re extends y{render(l){return"return "+super.render(l)}}re.kind="return";class ge extends w{render(l){let h="try"+super.render(l);return this.catch&&(h+=this.catch.render(l)),this.finally&&(h+=this.finally.render(l)),h}optimizeNodes(){var l,h;return super.optimizeNodes(),(l=this.catch)===null||l===void 0||l.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(l,h){var b,I;return super.optimizeNames(l,h),(b=this.catch)===null||b===void 0||b.optimizeNames(l,h),(I=this.finally)===null||I===void 0||I.optimizeNames(l,h),this}get names(){const l=super.names;return this.catch&&Y(l,this.catch.names),this.finally&&Y(l,this.finally.names),l}}class we extends w{constructor(l){super(),this.error=l}render(l){return`catch(${this.error})`+super.render(l)}}we.kind="catch";class Se extends w{render(l){return"finally"+super.render(l)}}Se.kind="finally";class K{constructor(l,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?` +`:""},this._extScope=l,this._scope=new r.Scope({parent:l}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(l){return this._scope.name(l)}scopeName(l){return this._extScope.name(l)}scopeValue(l,h){const b=this._extScope.value(l,h);return(this._values[b.prefix]||(this._values[b.prefix]=new Set)).add(b),b}getScopeValue(l,h){return this._extScope.getValue(l,h)}scopeRefs(l){return this._extScope.scopeRefs(l,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(l,h,b,I){const j=this._scope.toName(h);return b!==void 0&&I&&(this._constants[j.str]=b),this._leafNode(new a(l,j,b)),j}const(l,h,b){return this._def(r.varKinds.const,l,h,b)}let(l,h,b){return this._def(r.varKinds.let,l,h,b)}var(l,h,b){return this._def(r.varKinds.var,l,h,b)}assign(l,h,b){return this._leafNode(new i(l,h,b))}add(l,h){return this._leafNode(new c(l,e.operators.ADD,h))}code(l){return typeof l=="function"?l():l!==t.nil&&this._leafNode(new v(l)),this}object(...l){const h=["{"];for(const[b,I]of l)h.length>1&&h.push(","),h.push(b),(b!==I||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,I));return h.push("}"),new t._Code(h)}if(l,h,b){if(this._blockNode(new m(l)),h&&b)this.code(h).else().code(b).endIf();else if(h)this.code(h).endIf();else if(b)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(l){return this._elseNode(new m(l))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(m,$)}_for(l,h){return this._blockNode(l),h&&this.code(h).endFor(),this}for(l,h){return this._for(new N(l),h)}forRange(l,h,b,I,j=this.opts.es5?r.varKinds.var:r.varKinds.let){const G=this._scope.toName(l);return this._for(new R(j,G,h,b),()=>I(G))}forOf(l,h,b,I=r.varKinds.const){const j=this._scope.toName(l);if(this.opts.es5){const G=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${G}.length`,U=>{this.var(j,(0,t._)`${G}[${U}]`),b(j)})}return this._for(new O("of",I,j,h),()=>b(j))}forIn(l,h,b,I=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(l,(0,t._)`Object.keys(${h})`,b);const j=this._scope.toName(l);return this._for(new O("in",I,j,h),()=>b(j))}endFor(){return this._endBlockNode(E)}label(l){return this._leafNode(new d(l))}break(l){return this._leafNode(new u(l))}return(l){const h=new re;if(this._blockNode(h),this.code(l),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(re)}try(l,h,b){if(!h&&!b)throw new Error('CodeGen: "try" without "catch" and "finally"');const I=new ge;if(this._blockNode(I),this.code(l),h){const j=this.name("e");this._currNode=I.catch=new we(j),h(j)}return b&&(this._currNode=I.finally=new Se,this.code(b)),this._endBlockNode(we,Se)}throw(l){return this._leafNode(new f(l))}block(l,h){return this._blockStarts.push(this._nodes.length),l&&this.code(l).endBlock(h),this}endBlock(l){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const b=this._nodes.length-h;if(b<0||l!==void 0&&b!==l)throw new Error(`CodeGen: wrong number of nodes: ${b} vs ${l} expected`);return this._nodes.length=h,this}func(l,h=t.nil,b,I){return this._blockNode(new x(l,h,b)),I&&this.code(I).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(l=1){for(;l-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(l){return this._currNode.nodes.push(l),this}_blockNode(l){this._currNode.nodes.push(l),this._nodes.push(l)}_endBlockNode(l,h){const b=this._currNode;if(b instanceof l||h&&b instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${l.kind}/${h.kind}`:l.kind}"`)}_elseNode(l){const h=this._currNode;if(!(h instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=l,this}get _root(){return this._nodes[0]}get _currNode(){const l=this._nodes;return l[l.length-1]}set _currNode(l){const h=this._nodes;h[h.length-1]=l}}e.CodeGen=K;function Y(_,l){for(const h in l)_[h]=(_[h]||0)+(l[h]||0);return _}function fe(_,l){return l instanceof t._CodeOrName?Y(_,l.names):_}function T(_,l,h){if(_ instanceof t.Name)return b(_);if(!I(_))return _;return new t._Code(_._items.reduce((j,G)=>(G instanceof t.Name&&(G=b(G)),G instanceof t._Code?j.push(...G._items):j.push(G),j),[]));function b(j){const G=h[j.str];return G===void 0||l[j.str]!==1?j:(delete l[j.str],G)}function I(j){return j instanceof t._Code&&j._items.some(G=>G instanceof t.Name&&l[G.str]===1&&h[G.str]!==void 0)}}function A(_,l){for(const h in l)_[h]=(_[h]||0)-(l[h]||0)}function V(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:(0,t._)`!${S(_)}`}e.not=V;const F=p(e.operators.AND);function B(..._){return _.reduce(F)}e.and=B;const L=p(e.operators.OR);function P(..._){return _.reduce(L)}e.or=P;function p(_){return(l,h)=>l===t.nil?h:h===t.nil?l:(0,t._)`${S(l)} ${_} ${S(h)}`}function S(_){return _ instanceof t.Name?_:(0,t._)`(${_})`}})(se);var M={};Object.defineProperty(M,"__esModule",{value:!0});M.checkStrictMode=M.getErrorPath=M.Type=M.useFunc=M.setEvaluated=M.evaluatedPropsToName=M.mergeEvaluated=M.eachItem=M.unescapeJsonPointer=M.escapeJsonPointer=M.escapeFragment=M.unescapeFragment=M.schemaRefOrVal=M.schemaHasRulesButRef=M.schemaHasRules=M.checkUnknownRules=M.alwaysValidSchema=M.toHash=void 0;const me=se,Tf=Rn;function jf(e){const t={};for(const r of e)t[r]=!0;return t}M.toHash=jf;function Af(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(zl(e,t),!Vl(t,e.self.RULES.all))}M.alwaysValidSchema=Af;function zl(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||Gl(e,`unknown keyword: "${o}"`)}M.checkUnknownRules=zl;function Vl(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}M.schemaHasRules=Vl;function kf(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}M.schemaHasRulesButRef=kf;function Cf({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}M.schemaRefOrVal=Cf;function Mf(e){return Ul(decodeURIComponent(e))}M.unescapeFragment=Mf;function Df(e){return encodeURIComponent(ta(e))}M.escapeFragment=Df;function ta(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}M.escapeJsonPointer=ta;function Ul(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}M.unescapeJsonPointer=Ul;function Ff(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}M.eachItem=Ff;function oc({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,a,i)=>{const c=a===void 0?o:a instanceof me.Name?(o instanceof me.Name?e(s,o,a):t(s,o,a),a):o instanceof me.Name?(t(s,a,o),o):r(o,a);return i===me.Name&&!(c instanceof me.Name)?n(s,c):c}}M.mergeEvaluated={props:oc({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),ra(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:ql}),items:oc({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ql(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,me._)`{}`);return t!==void 0&&ra(e,r,t),r}M.evaluatedPropsToName=ql;function ra(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}M.setEvaluated=ra;const ac={};function Lf(e,t){return e.scopeValue("func",{ref:t,code:ac[t.code]||(ac[t.code]=new Tf._Code(t.code))})}M.useFunc=Lf;var Io;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Io||(M.Type=Io={}));function zf(e,t,r){if(e instanceof me.Name){const n=t===Io.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+ta(e)}M.getErrorPath=zf;function Gl(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}M.checkStrictMode=Gl;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});const Ce=se,Vf={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};Ze.default=Vf;(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=se,r=M,n=Ze;e.keywordError={message:({keyword:$})=>(0,t.str)`must pass "${$}" keyword validation`},e.keyword$DataError={message:({keyword:$,schemaType:m})=>m?(0,t.str)`"${$}" keyword must be ${m} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,m=e.keywordError,E,N){const{it:R}=$,{gen:O,compositeRule:x,allErrors:re}=R,ge=f($,m,E);N??(x||re)?c(O,ge):d(R,(0,t._)`[${ge}]`)}e.reportError=s;function o($,m=e.keywordError,E){const{it:N}=$,{gen:R,compositeRule:O,allErrors:x}=N,re=f($,m,E);c(R,re),O||x||d(N,n.default.vErrors)}e.reportExtraError=o;function a($,m){$.assign(n.default.errors,m),$.if((0,t._)`${n.default.vErrors} !== null`,()=>$.if(m,()=>$.assign((0,t._)`${n.default.vErrors}.length`,m),()=>$.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function i({gen:$,keyword:m,schemaValue:E,data:N,errsCount:R,it:O}){if(R===void 0)throw new Error("ajv implementation error");const x=$.name("err");$.forRange("i",R,n.default.errors,re=>{$.const(x,(0,t._)`${n.default.vErrors}[${re}]`),$.if((0,t._)`${x}.instancePath === undefined`,()=>$.assign((0,t._)`${x}.instancePath`,(0,t.strConcat)(n.default.instancePath,O.errorPath))),$.assign((0,t._)`${x}.schemaPath`,(0,t.str)`${O.errSchemaPath}/${m}`),O.opts.verbose&&($.assign((0,t._)`${x}.schema`,E),$.assign((0,t._)`${x}.data`,N))})}e.extendErrors=i;function c($,m){const E=$.const("err",m);$.if((0,t._)`${n.default.vErrors} === null`,()=>$.assign(n.default.vErrors,(0,t._)`[${E}]`),(0,t._)`${n.default.vErrors}.push(${E})`),$.code((0,t._)`${n.default.errors}++`)}function d($,m){const{gen:E,validateName:N,schemaEnv:R}=$;R.$async?E.throw((0,t._)`new ${$.ValidationError}(${m})`):(E.assign((0,t._)`${N}.errors`,m),E.return(!1))}const u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f($,m,E){const{createErrors:N}=$.it;return N===!1?(0,t._)`{}`:v($,m,E)}function v($,m,E={}){const{gen:N,it:R}=$,O=[y(R,E),w($,E)];return g($,m,O),N.object(...O)}function y({errorPath:$},{instancePath:m}){const E=m?(0,t.str)`${$}${(0,r.getErrorPath)(m,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)]}function w({keyword:$,it:{errSchemaPath:m}},{schemaPath:E,parentSchema:N}){let R=N?m:(0,t.str)`${m}/${$}`;return E&&(R=(0,t.str)`${R}${(0,r.getErrorPath)(E,r.Type.Str)}`),[u.schemaPath,R]}function g($,{params:m,message:E},N){const{keyword:R,data:O,schemaValue:x,it:re}=$,{opts:ge,propertyName:we,topSchemaRef:Se,schemaPath:K}=re;N.push([u.keyword,R],[u.params,typeof m=="function"?m($):m||(0,t._)`{}`]),ge.messages&&N.push([u.message,typeof E=="function"?E($):E]),ge.verbose&&N.push([u.schema,x],[u.parentSchema,(0,t._)`${Se}${K}`],[n.default.data,O]),we&&N.push([u.propertyName,we])}})(In);Object.defineProperty(qr,"__esModule",{value:!0});qr.boolOrEmptySchema=qr.topBoolOrEmptySchema=void 0;const Uf=In,qf=se,Gf=Ze,Kf={message:"boolean schema is false"};function Hf(e){const{gen:t,schema:r,validateName:n}=e;r===!1?Kl(e,!1):typeof r=="object"&&r.$async===!0?t.return(Gf.default.data):(t.assign((0,qf._)`${n}.errors`,null),t.return(!0))}qr.topBoolOrEmptySchema=Hf;function Wf(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Kl(e)):r.var(t,!0)}qr.boolOrEmptySchema=Wf;function Kl(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,Uf.reportError)(s,Kf,void 0,t)}var Pe={},br={};Object.defineProperty(br,"__esModule",{value:!0});br.getRules=br.isJSONType=void 0;const xf=["string","number","integer","boolean","null","object","array"],Bf=new Set(xf);function Yf(e){return typeof e=="string"&&Bf.has(e)}br.isJSONType=Yf;function Jf(){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:{}}}br.getRules=Jf;var Rt={};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.shouldUseRule=Rt.shouldUseGroup=Rt.schemaHasRulesForType=void 0;function Xf({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&Hl(e,n)}Rt.schemaHasRulesForType=Xf;function Hl(e,t){return t.rules.some(r=>Wl(e,r))}Rt.shouldUseGroup=Hl;function Wl(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))}Rt.shouldUseRule=Wl;Object.defineProperty(Pe,"__esModule",{value:!0});Pe.reportTypeError=Pe.checkDataTypes=Pe.checkDataType=Pe.coerceAndCheckDataType=Pe.getJSONTypes=Pe.getSchemaTypes=Pe.DataType=void 0;const Zf=br,Qf=Rt,eh=In,oe=se,xl=M;var Dr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Dr||(Pe.DataType=Dr={}));function th(e){const t=Bl(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Pe.getSchemaTypes=th;function Bl(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(Zf.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Pe.getJSONTypes=Bl;function rh(e,t){const{gen:r,data:n,opts:s}=e,o=nh(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,Qf.schemaHasRulesForType)(e,t[0]));if(a){const i=na(t,n,s.strictNumbers,Dr.Wrong);r.if(i,()=>{o.length?sh(e,t,o):sa(e)})}return a}Pe.coerceAndCheckDataType=rh;const Yl=new Set(["string","number","integer","boolean","null"]);function nh(e,t){return t?e.filter(r=>Yl.has(r)||t==="array"&&r==="array"):[]}function sh(e,t,r){const{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0,oe._)`typeof ${s}`),i=n.let("coerced",(0,oe._)`undefined`);o.coerceTypes==="array"&&n.if((0,oe._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,oe._)`${s}[0]`).assign(a,(0,oe._)`typeof ${s}`).if(na(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0,oe._)`${i} !== undefined`);for(const d of r)(Yl.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),sa(e),n.endIf(),n.if((0,oe._)`${i} !== undefined`,()=>{n.assign(s,i),oh(e,i)});function c(d){switch(d){case"string":n.elseIf((0,oe._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0,oe._)`"" + ${s}`).elseIf((0,oe._)`${s} === null`).assign(i,(0,oe._)`""`);return;case"number":n.elseIf((0,oe._)`${a} == "boolean" || ${s} === null + || (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0,oe._)`+${s}`);return;case"integer":n.elseIf((0,oe._)`${a} === "boolean" || ${s} === null + || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0,oe._)`+${s}`);return;case"boolean":n.elseIf((0,oe._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,!1).elseIf((0,oe._)`${s} === "true" || ${s} === 1`).assign(i,!0);return;case"null":n.elseIf((0,oe._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case"array":n.elseIf((0,oe._)`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${s} === null`).assign(i,(0,oe._)`[${s}]`)}}}function oh({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,oe._)`${t} !== undefined`,()=>e.assign((0,oe._)`${t}[${r}]`,n))}function To(e,t,r,n=Dr.Correct){const s=n===Dr.Correct?oe.operators.EQ:oe.operators.NEQ;let o;switch(e){case"null":return(0,oe._)`${t} ${s} null`;case"array":o=(0,oe._)`Array.isArray(${t})`;break;case"object":o=(0,oe._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,oe._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,oe._)`typeof ${t} ${s} ${e}`}return n===Dr.Correct?o:(0,oe.not)(o);function a(i=oe.nil){return(0,oe.and)((0,oe._)`typeof ${t} == "number"`,i,r?(0,oe._)`isFinite(${t})`:oe.nil)}}Pe.checkDataType=To;function na(e,t,r,n){if(e.length===1)return To(e[0],t,r,n);let s;const o=(0,xl.toHash)(e);if(o.array&&o.object){const a=(0,oe._)`typeof ${t} != "object"`;s=o.null?a:(0,oe._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else s=oe.nil;o.number&&delete o.integer;for(const a in o)s=(0,oe.and)(s,To(a,t,r,n));return s}Pe.checkDataTypes=na;const ah={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,oe._)`{type: ${e}}`:(0,oe._)`{type: ${t}}`};function sa(e){const t=ih(e);(0,eh.reportError)(t,ah)}Pe.reportTypeError=sa;function ih(e){const{gen:t,data:r,schema:n}=e,s=(0,xl.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var As={};Object.defineProperty(As,"__esModule",{value:!0});As.assignDefaults=void 0;const Rr=se,ch=M;function lh(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)ic(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>ic(e,o,s.default))}As.assignDefaults=lh;function ic(e,t,r){const{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;const i=(0,Rr._)`${o}${(0,Rr.getProperty)(t)}`;if(s){(0,ch.checkStrictMode)(e,`default is ignored for: ${i}`);return}let c=(0,Rr._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0,Rr._)`${c} || ${i} === null || ${i} === ""`),n.if(c,(0,Rr._)`${i} = ${(0,Rr.stringify)(r)}`)}var wt={},ce={};Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;const ye=se,oa=M,Dt=Ze,uh=M;function dh(e,t){const{gen:r,data:n,it:s}=e;r.if(ia(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ye._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=dh;function fh({gen:e,data:t,it:{opts:r}},n,s){return(0,ye.or)(...n.map(o=>(0,ye.and)(ia(e,t,o,r.ownProperties),(0,ye._)`${s} = ${o}`)))}ce.checkMissingProp=fh;function hh(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=hh;function Jl(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ye._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=Jl;function aa(e,t,r){return(0,ye._)`${Jl(e)}.call(${t}, ${r})`}ce.isOwnProperty=aa;function mh(e,t,r,n){const s=(0,ye._)`${t}${(0,ye.getProperty)(r)} !== undefined`;return n?(0,ye._)`${s} && ${aa(e,t,r)}`:s}ce.propertyInData=mh;function ia(e,t,r,n){const s=(0,ye._)`${t}${(0,ye.getProperty)(r)} === undefined`;return n?(0,ye.or)(s,(0,ye.not)(aa(e,t,r))):s}ce.noPropertyInData=ia;function Xl(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Xl;function ph(e,t){return Xl(t).filter(r=>!(0,oa.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=ph;function yh({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,c,d){const u=d?(0,ye._)`${e}, ${t}, ${n}${s}`:t,f=[[Dt.default.instancePath,(0,ye.strConcat)(Dt.default.instancePath,o)],[Dt.default.parentData,a.parentData],[Dt.default.parentDataProperty,a.parentDataProperty],[Dt.default.rootData,Dt.default.rootData]];a.opts.dynamicRef&&f.push([Dt.default.dynamicAnchors,Dt.default.dynamicAnchors]);const v=(0,ye._)`${u}, ${r.object(...f)}`;return c!==ye.nil?(0,ye._)`${i}.call(${c}, ${v})`:(0,ye._)`${i}(${v})`}ce.callValidateCode=yh;const $h=(0,ye._)`new RegExp`;function gh({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ye._)`${s.code==="new RegExp"?$h:(0,uh.useFunc)(e,s)}(${r}, ${n})`})}ce.usePattern=gh;function _h(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const i=t.let("valid",!0);return a(()=>t.assign(i,!1)),i}return t.var(o,!0),a(()=>t.break()),o;function a(i){const c=t.const("len",(0,ye._)`${r}.length`);t.forRange("i",0,c,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:oa.Type.Num},o),t.if((0,ye.not)(o),i)})}}ce.validateArray=_h;function vh(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,oa.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const a=t.let("valid",!1),i=t.name("_valid");t.block(()=>r.forEach((c,d)=>{const u=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},i);t.assign(a,(0,ye._)`${a} || ${i}`),e.mergeValidEvaluated(u,i)||t.if((0,ye.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=vh;Object.defineProperty(wt,"__esModule",{value:!0});wt.validateKeywordUsage=wt.validSchemaType=wt.funcKeywordCode=wt.macroKeywordCode=void 0;const Le=se,fr=Ze,wh=ce,Eh=In;function bh(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),c=Zl(r,n,i);a.opts.validateSchema!==!1&&a.self.validateSchema(i,!0);const d=r.name("valid");e.subschema({schema:i,schemaPath:Le.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}wt.macroKeywordCode=bh;function Sh(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:c}=e;Nh(c,t);const d=!i&&t.compile?t.compile.call(c.self,o,a,c):t.validate,u=Zl(n,s,d),f=n.let("valid");e.block$data(f,v),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function v(){if(t.errors===!1)g(),t.modifying&&cc(e),$(()=>e.error());else{const m=t.async?y():w();t.modifying&&cc(e),$(()=>Ph(e,m))}}function y(){const m=n.let("ruleErrs",null);return n.try(()=>g((0,Le._)`await `),E=>n.assign(f,!1).if((0,Le._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(m,(0,Le._)`${E}.errors`),()=>n.throw(E))),m}function w(){const m=(0,Le._)`${u}.errors`;return n.assign(m,null),g(Le.nil),m}function g(m=t.async?(0,Le._)`await `:Le.nil){const E=c.opts.passContext?fr.default.this:fr.default.self,N=!("compile"in t&&!i||t.schema===!1);n.assign(f,(0,Le._)`${m}${(0,wh.callValidateCode)(e,u,E,N)}`,t.modifying)}function $(m){var E;n.if((0,Le.not)((E=t.valid)!==null&&E!==void 0?E:f),m)}}wt.funcKeywordCode=Sh;function cc(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Le._)`${n.parentData}[${n.parentDataProperty}]`))}function Ph(e,t){const{gen:r}=e;r.if((0,Le._)`Array.isArray(${t})`,()=>{r.assign(fr.default.vErrors,(0,Le._)`${fr.default.vErrors} === null ? ${t} : ${fr.default.vErrors}.concat(${t})`).assign(fr.default.errors,(0,Le._)`${fr.default.vErrors}.length`),(0,Eh.extendErrors)(e)},()=>e.error())}function Nh({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Zl(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,Le.stringify)(r)})}function Rh(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")}wt.validSchemaType=Rh;function Oh({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const a=s.dependencies;if(a!=null&&a.some(i=>!Object.prototype.hasOwnProperty.call(e,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}wt.validateKeywordUsage=Oh;var xt={};Object.defineProperty(xt,"__esModule",{value:!0});xt.extendSubschemaMode=xt.extendSubschemaData=xt.getSubschema=void 0;const _t=se,Ql=M;function Ih(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const i=e.schema[t];return r===void 0?{schema:i,schemaPath:(0,_t._)`${e.schemaPath}${(0,_t.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0,_t._)`${e.schemaPath}${(0,_t.getProperty)(t)}${(0,_t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Ql.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}xt.getSubschema=Ih;function Th(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:a}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:i}=t;if(r!==void 0){const{errorPath:d,dataPathArr:u,opts:f}=t,v=i.let("data",(0,_t._)`${t.data}${(0,_t.getProperty)(r)}`,!0);c(v),e.errorPath=(0,_t.str)`${d}${(0,Ql.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,_t._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){const d=s instanceof _t.Name?s:i.let("data",s,!0);c(d),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(d){e.data=d,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,d]}}xt.extendSubschemaData=Th;function jh(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}xt.extendSubschemaMode=jh;var je={},ks=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var a=o[s];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r},eu={exports:{}},Ht=eu.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(){};os(t,n,s,e,"",e)};Ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ht.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 os(e,t,r,n,s,o,a,i,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,c,d);for(var u in n){var f=n[u];if(Array.isArray(f)){if(u in Ht.arrayKeywords)for(var v=0;vt+=tu(n)),t===1/0))return 1/0}return t}function ru(e,t="",r){r!==!1&&(t=Fr(t));const n=e.parse(t);return nu(e,n)}je.getFullPath=ru;function nu(e,t){return e.serialize(t).split("#")[0]+"#"}je._getFullPath=nu;const Vh=/#\/?$/;function Fr(e){return e?e.replace(Vh,""):""}je.normalizeId=Fr;function Uh(e,t,r){return r=Fr(r),e.resolve(t,r)}je.resolveUrl=Uh;const qh=/^[a-z_][-a-z0-9._]*$/i;function Gh(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Fr(e[r]||t),o={"":s},a=ru(n,s,!1),i={},c=new Set;return Dh(e,{allKeys:!0},(f,v,y,w)=>{if(w===void 0)return;const g=a+v;let $=o[w];typeof f[r]=="string"&&($=m.call(this,f[r])),E.call(this,f.$anchor),E.call(this,f.$dynamicAnchor),o[v]=$;function m(N){const R=this.opts.uriResolver.resolve;if(N=Fr($?R($,N):N),c.has(N))throw u(N);c.add(N);let O=this.refs[N];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?d(f,O.schema,N):N!==Fr(g)&&(N[0]==="#"?(d(f,i[N],N),i[N]=f):this.refs[N]=g),N}function E(N){if(typeof N=="string"){if(!qh.test(N))throw new Error(`invalid anchor "${N}"`);m.call(this,`#${N}`)}}}),i;function d(f,v,y){if(v!==void 0&&!Mh(f,v))throw u(y)}function u(f){return new Error(`reference "${f}" resolves to more than one schema`)}}je.getSchemaRefs=Gh;Object.defineProperty(ft,"__esModule",{value:!0});ft.getData=ft.KeywordCxt=ft.validateFunctionCode=void 0;const su=qr,lc=Pe,ca=Rt,gs=Pe,Kh=As,mn=wt,ro=xt,H=se,ee=Ze,Hh=je,Ot=M,sn=In;function Wh(e){if(iu(e)&&(cu(e),au(e))){Yh(e);return}ou(e,()=>(0,su.topBoolOrEmptySchema)(e))}ft.validateFunctionCode=Wh;function ou({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,H._)`${ee.default.data}, ${ee.default.valCxt}`,n.$async,()=>{e.code((0,H._)`"use strict"; ${uc(r,s)}`),Bh(e,s),e.code(o)}):e.func(t,(0,H._)`${ee.default.data}, ${xh(s)}`,n.$async,()=>e.code(uc(r,s)).code(o))}function xh(e){return(0,H._)`{${ee.default.instancePath}="", ${ee.default.parentData}, ${ee.default.parentDataProperty}, ${ee.default.rootData}=${ee.default.data}${e.dynamicRef?(0,H._)`, ${ee.default.dynamicAnchors}={}`:H.nil}}={}`}function Bh(e,t){e.if(ee.default.valCxt,()=>{e.var(ee.default.instancePath,(0,H._)`${ee.default.valCxt}.${ee.default.instancePath}`),e.var(ee.default.parentData,(0,H._)`${ee.default.valCxt}.${ee.default.parentData}`),e.var(ee.default.parentDataProperty,(0,H._)`${ee.default.valCxt}.${ee.default.parentDataProperty}`),e.var(ee.default.rootData,(0,H._)`${ee.default.valCxt}.${ee.default.rootData}`),t.dynamicRef&&e.var(ee.default.dynamicAnchors,(0,H._)`${ee.default.valCxt}.${ee.default.dynamicAnchors}`)},()=>{e.var(ee.default.instancePath,(0,H._)`""`),e.var(ee.default.parentData,(0,H._)`undefined`),e.var(ee.default.parentDataProperty,(0,H._)`undefined`),e.var(ee.default.rootData,ee.default.data),t.dynamicRef&&e.var(ee.default.dynamicAnchors,(0,H._)`{}`)})}function Yh(e){const{schema:t,opts:r,gen:n}=e;ou(e,()=>{r.$comment&&t.$comment&&uu(e),em(e),n.let(ee.default.vErrors,null),n.let(ee.default.errors,0),r.unevaluated&&Jh(e),lu(e),nm(e)})}function Jh(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,H._)`${r}.evaluated`),t.if((0,H._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,H._)`${e.evaluated}.props`,(0,H._)`undefined`)),t.if((0,H._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,H._)`${e.evaluated}.items`,(0,H._)`undefined`))}function uc(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,H._)`/*# sourceURL=${r} */`:H.nil}function Xh(e,t){if(iu(e)&&(cu(e),au(e))){Zh(e,t);return}(0,su.boolOrEmptySchema)(e,t)}function au({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 iu(e){return typeof e.schema!="boolean"}function Zh(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&uu(e),tm(e),rm(e);const o=n.const("_errs",ee.default.errors);lu(e,o),n.var(t,(0,H._)`${o} === ${ee.default.errors}`)}function cu(e){(0,Ot.checkUnknownRules)(e),Qh(e)}function lu(e,t){if(e.opts.jtd)return dc(e,[],!1,t);const r=(0,lc.getSchemaTypes)(e.schema),n=(0,lc.coerceAndCheckDataType)(e,r);dc(e,r,!n,t)}function Qh(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ot.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function em(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ot.checkStrictMode)(e,"default is ignored in the schema root")}function tm(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Hh.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function rm(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function uu({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,H._)`${ee.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const a=(0,H.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,H._)`${ee.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`)}}function nm(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,H._)`${ee.default.errors} === 0`,()=>t.return(ee.default.data),()=>t.throw((0,H._)`new ${s}(${ee.default.vErrors})`)):(t.assign((0,H._)`${n}.errors`,ee.default.vErrors),o.unevaluated&&sm(e),t.return((0,H._)`${ee.default.errors} === 0`))}function sm({gen:e,evaluated:t,props:r,items:n}){r instanceof H.Name&&e.assign((0,H._)`${t}.props`,r),n instanceof H.Name&&e.assign((0,H._)`${t}.items`,n)}function dc(e,t,r,n){const{gen:s,schema:o,data:a,allErrors:i,opts:c,self:d}=e,{RULES:u}=d;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Ot.schemaHasRulesButRef)(o,u))){s.block(()=>hu(e,"$ref",u.all.$ref.definition));return}c.jtd||om(e,t),s.block(()=>{for(const v of u.rules)f(v);f(u.post)});function f(v){(0,ca.shouldUseGroup)(o,v)&&(v.type?(s.if((0,gs.checkDataType)(v.type,a,c.strictNumbers)),fc(e,v),t.length===1&&t[0]===v.type&&r&&(s.else(),(0,gs.reportTypeError)(e)),s.endIf()):fc(e,v),i||s.if((0,H._)`${ee.default.errors} === ${n||0}`))}}function fc(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,Kh.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,ca.shouldUseRule)(n,o)&&hu(e,o.keyword,o.definition,t.type)})}function om(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(am(e,t),e.opts.allowUnionTypes||im(e,t),cm(e,e.dataTypes))}function am(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{du(e.dataTypes,r)||la(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),um(e,t)}}function im(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&la(e,"use allowUnionTypes to allow union type keyword")}function cm(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,ca.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(a=>lm(t,a))&&la(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function lm(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function du(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function um(e,t){const r=[];for(const n of e.dataTypes)du(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function la(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ot.checkStrictMode)(e,t,e.opts.strictTypes)}let fu=class{constructor(t,r,n){if((0,mn.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,Ot.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",mu(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,mn.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",ee.default.errors))}result(t,r,n){this.failResult((0,H.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,H.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,H._)`${r} !== undefined && (${(0,H.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?sn.reportExtraError:sn.reportError)(this,this.def.error,r)}$dataError(){(0,sn.reportError)(this,this.def.$dataError||sn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,sn.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=H.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=H.nil,r=H.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0,H.or)((0,H._)`${s} === undefined`,r)),t!==H.nil&&n.assign(t,!0),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==H.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,H.or)(a(),i());function a(){if(n.length){if(!(r instanceof H.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,H._)`${(0,gs.checkDataTypes)(c,r,o.opts.strictNumbers,gs.DataType.Wrong)}`}return H.nil}function i(){if(s.validateSchema){const c=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,H._)`!${c}(${r})`}return H.nil}}subschema(t,r){const n=(0,ro.getSubschema)(this.it,t);(0,ro.extendSubschemaData)(n,this.it,t),(0,ro.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return Xh(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ot.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ot.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,H.Name)),!0}};ft.KeywordCxt=fu;function hu(e,t,r,n){const s=new fu(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,mn.funcKeywordCode)(s,r):"macro"in r?(0,mn.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,mn.funcKeywordCode)(s,r)}const dm=/^\/(?:[^~]|~0|~1)*$/,fm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mu(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return ee.default.rootData;if(e[0]==="/"){if(!dm.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=ee.default.rootData}else{const d=fm.exec(e);if(!d)throw new Error(`Invalid JSON-pointer: ${e}`);const u=+d[1];if(s=d[2],s==="#"){if(u>=t)throw new Error(c("property/index",u));return n[t-u]}if(u>t)throw new Error(c("data",u));if(o=r[t-u],!s)return o}let a=o;const i=s.split("/");for(const d of i)d&&(o=(0,H._)`${o}${(0,H.getProperty)((0,Ot.unescapeJsonPointer)(d))}`,a=(0,H._)`${a} && ${o}`);return a;function c(d,u){return`Cannot access ${d} ${u} levels up, current level is ${t}`}}ft.getData=mu;var Tn={};Object.defineProperty(Tn,"__esModule",{value:!0});let hm=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Tn.default=hm;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});const no=je;let mm=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,no.resolveUrl)(t,r,n),this.missingSchema=(0,no.normalizeId)((0,no.getFullPath)(t,this.missingRef))}};Wr.default=mm;var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.resolveSchema=Ve.getCompilingSchema=Ve.resolveRef=Ve.compileSchema=Ve.SchemaEnv=void 0;const nt=se,pm=Tn,ur=Ze,ut=je,hc=M,ym=ft;let Cs=class{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,ut.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={}}};Ve.SchemaEnv=Cs;function ua(e){const t=pu.call(this,e);if(t)return t;const r=(0,ut.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new nt.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let i;e.$async&&(i=a.scopeValue("Error",{ref:pm.default,code:(0,nt._)`require("ajv/dist/runtime/validation_error").default`}));const c=a.scopeName("validate");e.validateName=c;const d={gen:a,allErrors:this.opts.allErrors,data:ur.default.data,parentData:ur.default.parentData,parentDataProperty:ur.default.parentDataProperty,dataNames:[ur.default.data],dataPathArr:[nt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,nt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:nt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,nt._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,ym.validateFunctionCode)(d),a.optimize(this.opts.code.optimize);const f=a.toString();u=`${a.scopeRefs(ur.default.scope)}return ${f}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const y=new Function(`${ur.default.self}`,`${ur.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:y}),y.errors=null,y.schema=e.schema,y.schemaEnv=e,e.$async&&(y.$async=!0),this.opts.code.source===!0&&(y.source={validateName:c,validateCode:f,scopeValues:a._values}),this.opts.unevaluated){const{props:w,items:g}=d;y.evaluated={props:w instanceof nt.Name?void 0:w,items:g instanceof nt.Name?void 0:g,dynamicProps:w instanceof nt.Name,dynamicItems:g instanceof nt.Name},y.source&&(y.source.evaluated=(0,nt.stringify)(y.evaluated))}return e.validate=y,e}catch(f){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),f}finally{this._compilations.delete(e)}}Ve.compileSchema=ua;function $m(e,t,r){var n;r=(0,ut.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=vm.call(this,e,r);if(o===void 0){const a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:i}=this.opts;a&&(o=new Cs({schema:a,schemaId:i,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=gm.call(this,o)}Ve.resolveRef=$m;function gm(e){return(0,ut.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ua.call(this,e)}function pu(e){for(const t of this._compilations)if(_m(t,e))return t}Ve.getCompilingSchema=pu;function _m(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function vm(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ms.call(this,e,t)}function Ms(e,t){const r=this.opts.uriResolver.parse(t),n=(0,ut._getFullPath)(this.opts.uriResolver,r);let s=(0,ut.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return so.call(this,r,e);const o=(0,ut.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){const i=Ms.call(this,e,a);return typeof(i==null?void 0:i.schema)!="object"?void 0:so.call(this,r,i)}if(typeof(a==null?void 0:a.schema)=="object"){if(a.validate||ua.call(this,a),o===(0,ut.normalizeId)(t)){const{schema:i}=a,{schemaId:c}=this.opts,d=i[c];return d&&(s=(0,ut.resolveUrl)(this.opts.uriResolver,s,d)),new Cs({schema:i,schemaId:c,root:e,baseId:s})}return so.call(this,r,a)}}Ve.resolveSchema=Ms;const wm=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function so(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const i of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,hc.unescapeFragment)(i)];if(c===void 0)return;r=c;const d=typeof r=="object"&&r[this.opts.schemaId];!wm.has(i)&&d&&(t=(0,ut.resolveUrl)(this.opts.uriResolver,t,d))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,hc.schemaHasRulesButRef)(r,this.RULES)){const i=(0,ut.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Ms.call(this,n,i)}const{schemaId:a}=this.opts;if(o=o||new Cs({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}const Em="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",bm="Meta-schema for $data reference (JSON AnySchema extension proposal)",Sm="object",Pm=["$data"],Nm={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Rm=!1,Om={$id:Em,description:bm,type:Sm,required:Pm,properties:Nm,additionalProperties:Rm};var da={},Ds={exports:{}};const Im=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),yu=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $u(e){let t="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const Tm=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function mc(e){return e.length=0,!0}function jm(e,t,r){if(e.length){const n=$u(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Am(e){let t=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,a=!1,i=jm;for(let c=0;c7){r.error=!0;break}c>0&&e[c-1]===":"&&(o=!0),n.push(":");continue}else if(d==="%"){if(!i(s,n,r))break;i=mc}else{s.push(d);continue}}return s.length&&(i===mc?r.zone=s.join(""):a?n.push(s.join("")):n.push($u(s))),r.address=n.join(""),r}function gu(e){if(km(e,":")<2)return{host:e,isIPV6:!1};const t=Am(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function km(e,t){let r=0;for(let n=0;nnew RegExp(P,p);y.code="new RegExp";const w=["removeAdditional","useDefaults","coerceTypes"],g=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."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},E=200;function N(P){var p,S,_,l,h,b,I,j,G,U,ue,xe,Yt,Jt,Xt,Zt,Qt,er,tr,rr,nr,sr,or,ar,ir;const rt=P.strict,cr=(p=P.code)===null||p===void 0?void 0:p.optimize,tn=cr===!0||cr===void 0?1:cr||0,rn=(_=(S=P.code)===null||S===void 0?void 0:S.regExp)!==null&&_!==void 0?_:y,Xs=(l=P.uriResolver)!==null&&l!==void 0?l:v.default;return{strictSchema:(b=(h=P.strictSchema)!==null&&h!==void 0?h:rt)!==null&&b!==void 0?b:!0,strictNumbers:(j=(I=P.strictNumbers)!==null&&I!==void 0?I:rt)!==null&&j!==void 0?j:!0,strictTypes:(U=(G=P.strictTypes)!==null&&G!==void 0?G:rt)!==null&&U!==void 0?U:"log",strictTuples:(xe=(ue=P.strictTuples)!==null&&ue!==void 0?ue:rt)!==null&&xe!==void 0?xe:"log",strictRequired:(Jt=(Yt=P.strictRequired)!==null&&Yt!==void 0?Yt:rt)!==null&&Jt!==void 0?Jt:!1,code:P.code?{...P.code,optimize:tn,regExp:rn}:{optimize:tn,regExp:rn},loopRequired:(Xt=P.loopRequired)!==null&&Xt!==void 0?Xt:E,loopEnum:(Zt=P.loopEnum)!==null&&Zt!==void 0?Zt:E,meta:(Qt=P.meta)!==null&&Qt!==void 0?Qt:!0,messages:(er=P.messages)!==null&&er!==void 0?er:!0,inlineRefs:(tr=P.inlineRefs)!==null&&tr!==void 0?tr:!0,schemaId:(rr=P.schemaId)!==null&&rr!==void 0?rr:"$id",addUsedSchema:(nr=P.addUsedSchema)!==null&&nr!==void 0?nr:!0,validateSchema:(sr=P.validateSchema)!==null&&sr!==void 0?sr:!0,validateFormats:(or=P.validateFormats)!==null&&or!==void 0?or:!0,unicodeRegExp:(ar=P.unicodeRegExp)!==null&&ar!==void 0?ar:!0,int32range:(ir=P.int32range)!==null&&ir!==void 0?ir:!0,uriResolver:Xs}}class R{constructor(p={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,p=this.opts={...p,...N(p)};const{es5:S,lines:_}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:g,es5:S,lines:_}),this.logger=Y(p.logger);const l=p.validateFormats;p.validateFormats=!1,this.RULES=(0,o.getRules)(),O.call(this,$,p,"NOT SUPPORTED"),O.call(this,m,p,"DEPRECATED","warn"),this._metaOpts=Se.call(this),p.formats&&ge.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),p.keywords&&we.call(this,p.keywords),typeof p.meta=="object"&&this.addMetaSchema(p.meta),re.call(this),p.validateFormats=l}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:p,meta:S,schemaId:_}=this.opts;let l=f;_==="id"&&(l={...f},l.id=l.$id,delete l.$id),S&&p&&this.addMetaSchema(l,l[_],!1)}defaultMeta(){const{meta:p,schemaId:S}=this.opts;return this.opts.defaultMeta=typeof p=="object"?p[S]||p:void 0}validate(p,S){let _;if(typeof p=="string"){if(_=this.getSchema(p),!_)throw new Error(`no schema with key or ref "${p}"`)}else _=this.compile(p);const l=_(S);return"$async"in _||(this.errors=_.errors),l}compile(p,S){const _=this._addSchema(p,S);return _.validate||this._compileSchemaEnv(_)}compileAsync(p,S){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:_}=this.opts;return l.call(this,p,S);async function l(U,ue){await h.call(this,U.$schema);const xe=this._addSchema(U,ue);return xe.validate||b.call(this,xe)}async function h(U){U&&!this.getSchema(U)&&await l.call(this,{$ref:U},!0)}async function b(U){try{return this._compileSchemaEnv(U)}catch(ue){if(!(ue instanceof s.default))throw ue;return I.call(this,ue),await j.call(this,ue.missingSchema),b.call(this,U)}}function I({missingSchema:U,missingRef:ue}){if(this.refs[U])throw new Error(`AnySchema ${U} is loaded but ${ue} cannot be resolved`)}async function j(U){const ue=await G.call(this,U);this.refs[U]||await h.call(this,ue.$schema),this.refs[U]||this.addSchema(ue,U,S)}async function G(U){const ue=this._loading[U];if(ue)return ue;try{return await(this._loading[U]=_(U))}finally{delete this._loading[U]}}}addSchema(p,S,_,l=this.opts.validateSchema){if(Array.isArray(p)){for(const b of p)this.addSchema(b,void 0,_,l);return this}let h;if(typeof p=="object"){const{schemaId:b}=this.opts;if(h=p[b],h!==void 0&&typeof h!="string")throw new Error(`schema ${b} must be string`)}return S=(0,c.normalizeId)(S||h),this._checkUnique(S),this.schemas[S]=this._addSchema(p,_,S,l,!0),this}addMetaSchema(p,S,_=this.opts.validateSchema){return this.addSchema(p,S,!0,_),this}validateSchema(p,S){if(typeof p=="boolean")return!0;let _;if(_=p.$schema,_!==void 0&&typeof _!="string")throw new Error("$schema must be a string");if(_=_||this.opts.defaultMeta||this.defaultMeta(),!_)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const l=this.validate(_,p);if(!l&&S){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return l}getSchema(p){let S;for(;typeof(S=x.call(this,p))=="string";)p=S;if(S===void 0){const{schemaId:_}=this.opts,l=new a.SchemaEnv({schema:{},schemaId:_});if(S=a.resolveSchema.call(this,l,p),!S)return;this.refs[p]=S}return S.validate||this._compileSchemaEnv(S)}removeSchema(p){if(p instanceof RegExp)return this._removeAllSchemas(this.schemas,p),this._removeAllSchemas(this.refs,p),this;switch(typeof p){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const S=x.call(this,p);return typeof S=="object"&&this._cache.delete(S.schema),delete this.schemas[p],delete this.refs[p],this}case"object":{const S=p;this._cache.delete(S);let _=p[this.opts.schemaId];return _&&(_=(0,c.normalizeId)(_),delete this.schemas[_],delete this.refs[_]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(p){for(const S of p)this.addKeyword(S);return this}addKeyword(p,S){let _;if(typeof p=="string")_=p,typeof S=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),S.keyword=_);else if(typeof p=="object"&&S===void 0){if(S=p,_=S.keyword,Array.isArray(_)&&!_.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(T.call(this,_,S),!S)return(0,u.eachItem)(_,h=>A.call(this,h)),this;F.call(this,S);const l={...S,type:(0,d.getJSONTypes)(S.type),schemaType:(0,d.getJSONTypes)(S.schemaType)};return(0,u.eachItem)(_,l.type.length===0?h=>A.call(this,h,l):h=>l.type.forEach(b=>A.call(this,h,l,b))),this}getKeyword(p){const S=this.RULES.all[p];return typeof S=="object"?S.definition:!!S}removeKeyword(p){const{RULES:S}=this;delete S.keywords[p],delete S.all[p];for(const _ of S.rules){const l=_.rules.findIndex(h=>h.keyword===p);l>=0&&_.rules.splice(l,1)}return this}addFormat(p,S){return typeof S=="string"&&(S=new RegExp(S)),this.formats[p]=S,this}errorsText(p=this.errors,{separator:S=", ",dataVar:_="data"}={}){return!p||p.length===0?"No errors":p.map(l=>`${_}${l.instancePath} ${l.message}`).reduce((l,h)=>l+S+h)}$dataMetaSchema(p,S){const _=this.RULES.all;p=JSON.parse(JSON.stringify(p));for(const l of S){const h=l.split("/").slice(1);let b=p;for(const I of h)b=b[I];for(const I in _){const j=_[I];if(typeof j!="object")continue;const{$data:G}=j.definition,U=b[I];G&&U&&(b[I]=L(U))}}return p}_removeAllSchemas(p,S){for(const _ in p){const l=p[_];(!S||S.test(_))&&(typeof l=="string"?delete p[_]:l&&!l.meta&&(this._cache.delete(l.schema),delete p[_]))}}_addSchema(p,S,_,l=this.opts.validateSchema,h=this.opts.addUsedSchema){let b;const{schemaId:I}=this.opts;if(typeof p=="object")b=p[I];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof p!="boolean")throw new Error("schema must be object or boolean")}let j=this._cache.get(p);if(j!==void 0)return j;_=(0,c.normalizeId)(b||_);const G=c.getSchemaRefs.call(this,p,_);return j=new a.SchemaEnv({schema:p,schemaId:I,meta:S,baseId:_,localRefs:G}),this._cache.set(j.schema,j),h&&!_.startsWith("#")&&(_&&this._checkUnique(_),this.refs[_]=j),l&&this.validateSchema(p,!0),j}_checkUnique(p){if(this.schemas[p]||this.refs[p])throw new Error(`schema with key or id "${p}" already exists`)}_compileSchemaEnv(p){if(p.meta?this._compileMetaSchema(p):a.compileSchema.call(this,p),!p.validate)throw new Error("ajv implementation error");return p.validate}_compileMetaSchema(p){const S=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,p)}finally{this.opts=S}}}R.ValidationError=n.default,R.MissingRefError=s.default,e.default=R;function O(P,p,S,_="error"){for(const l in P){const h=l;h in p&&this.logger[_](`${S}: option ${l}. ${P[h]}`)}}function x(P){return P=(0,c.normalizeId)(P),this.schemas[P]||this.refs[P]}function re(){const P=this.opts.schemas;if(P)if(Array.isArray(P))this.addSchema(P);else for(const p in P)this.addSchema(P[p],p)}function ge(){for(const P in this.opts.formats){const p=this.opts.formats[P];p&&this.addFormat(P,p)}}function we(P){if(Array.isArray(P)){this.addVocabulary(P);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const p in P){const S=P[p];S.keyword||(S.keyword=p),this.addKeyword(S)}}function Se(){const P={...this.opts};for(const p of w)delete P[p];return P}const K={log(){},warn(){},error(){}};function Y(P){if(P===!1)return K;if(P===void 0)return console;if(P.log&&P.warn&&P.error)return P;throw new Error("logger must implement log, warn and error methods")}const fe=/^[a-z_$][a-z0-9_$:-]*$/i;function T(P,p){const{RULES:S}=this;if((0,u.eachItem)(P,_=>{if(S.keywords[_])throw new Error(`Keyword ${_} is already defined`);if(!fe.test(_))throw new Error(`Keyword ${_} has invalid name`)}),!!p&&p.$data&&!("code"in p||"validate"in p))throw new Error('$data keyword must have "code" or "validate" function')}function A(P,p,S){var _;const l=p==null?void 0:p.post;if(S&&l)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let b=l?h.post:h.rules.find(({type:j})=>j===S);if(b||(b={type:S,rules:[]},h.rules.push(b)),h.keywords[P]=!0,!p)return;const I={keyword:P,definition:{...p,type:(0,d.getJSONTypes)(p.type),schemaType:(0,d.getJSONTypes)(p.schemaType)}};p.before?V.call(this,b,I,p.before):b.rules.push(I),h.all[P]=I,(_=p.implements)===null||_===void 0||_.forEach(j=>this.addKeyword(j))}function V(P,p,S){const _=P.rules.findIndex(l=>l.keyword===S);_>=0?P.rules.splice(_,0,p):(P.rules.push(p),this.logger.warn(`rule ${S} is not defined`))}function F(P){let{metaSchema:p}=P;p!==void 0&&(P.$data&&this.opts.$data&&(p=L(p)),P.validateSchema=this.compile(p,!0))}const B={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function L(P){return{anyOf:[P,B]}}})(Ll);var ma={},pa={},ya={};Object.defineProperty(ya,"__esModule",{value:!0});const op={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ya.default=op;var At={};Object.defineProperty(At,"__esModule",{value:!0});At.callRef=At.getValidate=void 0;const ap=Wr,pc=ce,Ge=se,Or=Ze,yc=Ve,zn=M,ip={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:c}=n,{root:d}=o;if((r==="#"||r==="#/")&&s===d.baseId)return f();const u=yc.resolveRef.call(c,d,s,r);if(u===void 0)throw new ap.default(n.opts.uriResolver,s,r);if(u instanceof yc.SchemaEnv)return v(u);return y(u);function f(){if(o===d)return is(e,a,o,o.$async);const w=t.scopeValue("root",{ref:d});return is(e,(0,Ge._)`${w}.validate`,d,d.$async)}function v(w){const g=Ou(e,w);is(e,g,w,w.$async)}function y(w){const g=t.scopeValue("schema",i.code.source===!0?{ref:w,code:(0,Ge.stringify)(w)}:{ref:w}),$=t.name("valid"),m=e.subschema({schema:w,dataTypes:[],schemaPath:Ge.nil,topSchemaRef:g,errSchemaPath:r},$);e.mergeEvaluated(m),e.ok($)}}};function Ou(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ge._)`${r.scopeValue("wrapper",{ref:t})}.validate`}At.getValidate=Ou;function is(e,t,r,n){const{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:c}=o,d=c.passContext?Or.default.this:Ge.nil;n?u():f();function u(){if(!i.$async)throw new Error("async schema referenced by sync schema");const w=s.let("valid");s.try(()=>{s.code((0,Ge._)`await ${(0,pc.callValidateCode)(e,t,d)}`),y(t),a||s.assign(w,!0)},g=>{s.if((0,Ge._)`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),v(g),a||s.assign(w,!1)}),e.ok(w)}function f(){e.result((0,pc.callValidateCode)(e,t,d),()=>y(t),()=>v(t))}function v(w){const g=(0,Ge._)`${w}.errors`;s.assign(Or.default.vErrors,(0,Ge._)`${Or.default.vErrors} === null ? ${g} : ${Or.default.vErrors}.concat(${g})`),s.assign(Or.default.errors,(0,Ge._)`${Or.default.vErrors}.length`)}function y(w){var g;if(!o.opts.unevaluated)return;const $=(g=r==null?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(o.props=zn.mergeEvaluated.props(s,$.props,o.props));else{const m=s.var("props",(0,Ge._)`${w}.evaluated.props`);o.props=zn.mergeEvaluated.props(s,m,o.props,Ge.Name)}if(o.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(o.items=zn.mergeEvaluated.items(s,$.items,o.items));else{const m=s.var("items",(0,Ge._)`${w}.evaluated.items`);o.items=zn.mergeEvaluated.items(s,m,o.items,Ge.Name)}}}At.callRef=is;At.default=ip;Object.defineProperty(pa,"__esModule",{value:!0});const cp=ya,lp=At,up=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",cp.default,lp.default];pa.default=up;var $a={},ga={};Object.defineProperty(ga,"__esModule",{value:!0});const vs=se,Ft=vs.operators,ws={maximum:{okStr:"<=",ok:Ft.LTE,fail:Ft.GT},minimum:{okStr:">=",ok:Ft.GTE,fail:Ft.LT},exclusiveMaximum:{okStr:"<",ok:Ft.LT,fail:Ft.GTE},exclusiveMinimum:{okStr:">",ok:Ft.GT,fail:Ft.LTE}},dp={message:({keyword:e,schemaCode:t})=>(0,vs.str)`must be ${ws[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,vs._)`{comparison: ${ws[e].okStr}, limit: ${t}}`},fp={keyword:Object.keys(ws),type:"number",schemaType:"number",$data:!0,error:dp,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,vs._)`${r} ${ws[t].fail} ${n} || isNaN(${r})`)}};ga.default=fp;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});const pn=se,hp={message:({schemaCode:e})=>(0,pn.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,pn._)`{multipleOf: ${e}}`},mp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:hp,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0,pn._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,pn._)`${a} !== parseInt(${a})`;e.fail$data((0,pn._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`)}};_a.default=mp;var va={},wa={};Object.defineProperty(wa,"__esModule",{value:!0});function Iu(e){const t=e.length;let r=0,n=0,s;for(;n=55296&&s<=56319&&n(0,hr._)`{limit: ${e}}`},gp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$p,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?hr.operators.GT:hr.operators.LT,a=s.opts.unicode===!1?(0,hr._)`${r}.length`:(0,hr._)`${(0,pp.useFunc)(e.gen,yp.default)}(${r})`;e.fail$data((0,hr._)`${a} ${o} ${n}`)}};va.default=gp;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});const _p=ce,Es=se,vp={message:({schemaCode:e})=>(0,Es.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Es._)`{pattern: ${e}}`},wp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:vp,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,a=o.opts.unicodeRegExp?"u":"",i=r?(0,Es._)`(new RegExp(${s}, ${a}))`:(0,_p.usePattern)(e,n);e.fail$data((0,Es._)`!${i}.test(${t})`)}};Ea.default=wp;var ba={};Object.defineProperty(ba,"__esModule",{value:!0});const yn=se,Ep={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,yn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,yn._)`{limit: ${e}}`},bp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ep,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?yn.operators.GT:yn.operators.LT;e.fail$data((0,yn._)`Object.keys(${r}).length ${s} ${n}`)}};ba.default=bp;var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});const on=ce,$n=se,Sp=M,Pp={message:({params:{missingProperty:e}})=>(0,$n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,$n._)`{missingProperty: ${e}}`},Np={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Pp,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:a}=e,{opts:i}=a;if(!o&&r.length===0)return;const c=r.length>=i.loopRequired;if(a.allErrors?d():u(),i.strictRequired){const y=e.parentSchema.properties,{definedProperties:w}=e.it;for(const g of r)if((y==null?void 0:y[g])===void 0&&!w.has(g)){const $=a.schemaEnv.baseId+a.errSchemaPath,m=`required property "${g}" is not defined at "${$}" (strictRequired)`;(0,Sp.checkStrictMode)(a,m,a.opts.strictRequired)}}function d(){if(c||o)e.block$data($n.nil,f);else for(const y of r)(0,on.checkReportMissingProp)(e,y)}function u(){const y=t.let("missing");if(c||o){const w=t.let("valid",!0);e.block$data(w,()=>v(y,w)),e.ok(w)}else t.if((0,on.checkMissingProp)(e,r,y)),(0,on.reportMissingProp)(e,y),t.else()}function f(){t.forOf("prop",n,y=>{e.setParams({missingProperty:y}),t.if((0,on.noPropertyInData)(t,s,y,i.ownProperties),()=>e.error())})}function v(y,w){e.setParams({missingProperty:y}),t.forOf(y,n,()=>{t.assign(w,(0,on.propertyInData)(t,s,y,i.ownProperties)),t.if((0,$n.not)(w),()=>{e.error(),t.break()})},$n.nil)}}};Sa.default=Np;var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});const gn=se,Rp={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,gn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,gn._)`{limit: ${e}}`},Op={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Rp,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?gn.operators.GT:gn.operators.LT;e.fail$data((0,gn._)`${r}.length ${s} ${n}`)}};Pa.default=Op;var Na={},jn={};Object.defineProperty(jn,"__esModule",{value:!0});const Tu=ks;Tu.code='require("ajv/dist/runtime/equal").default';jn.default=Tu;Object.defineProperty(Na,"__esModule",{value:!0});const oo=Pe,Ie=se,Ip=M,Tp=jn,jp={message:({params:{i:e,j:t}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ie._)`{i: ${e}, j: ${t}}`},Ap={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:jp,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;const c=t.let("valid"),d=o.items?(0,oo.getSchemaTypes)(o.items):[];e.block$data(c,u,(0,Ie._)`${a} === false`),e.ok(c);function u(){const w=t.let("i",(0,Ie._)`${r}.length`),g=t.let("j");e.setParams({i:w,j:g}),t.assign(c,!0),t.if((0,Ie._)`${w} > 1`,()=>(f()?v:y)(w,g))}function f(){return d.length>0&&!d.some(w=>w==="object"||w==="array")}function v(w,g){const $=t.name("item"),m=(0,oo.checkDataTypes)(d,$,i.opts.strictNumbers,oo.DataType.Wrong),E=t.const("indices",(0,Ie._)`{}`);t.for((0,Ie._)`;${w}--;`,()=>{t.let($,(0,Ie._)`${r}[${w}]`),t.if(m,(0,Ie._)`continue`),d.length>1&&t.if((0,Ie._)`typeof ${$} == "string"`,(0,Ie._)`${$} += "_"`),t.if((0,Ie._)`typeof ${E}[${$}] == "number"`,()=>{t.assign(g,(0,Ie._)`${E}[${$}]`),e.error(),t.assign(c,!1).break()}).code((0,Ie._)`${E}[${$}] = ${w}`)})}function y(w,g){const $=(0,Ip.useFunc)(t,Tp.default),m=t.name("outer");t.label(m).for((0,Ie._)`;${w}--;`,()=>t.for((0,Ie._)`${g} = ${w}; ${g}--;`,()=>t.if((0,Ie._)`${$}(${r}[${w}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(m)})))}}};Na.default=Ap;var Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});const Ao=se,kp=M,Cp=jn,Mp={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ao._)`{allowedValue: ${e}}`},Dp={keyword:"const",$data:!0,error:Mp,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Ao._)`!${(0,kp.useFunc)(t,Cp.default)}(${r}, ${s})`):e.fail((0,Ao._)`${o} !== ${r}`)}};Ra.default=Dp;var Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});const fn=se,Fp=M,Lp=jn,zp={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fn._)`{allowedValues: ${e}}`},Vp={keyword:"enum",schemaType:"array",$data:!0,error:zp,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const i=s.length>=a.opts.loopEnum;let c;const d=()=>c??(c=(0,Fp.useFunc)(t,Lp.default));let u;if(i||n)u=t.let("valid"),e.block$data(u,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const y=t.const("vSchema",o);u=(0,fn.or)(...s.map((w,g)=>v(y,g)))}e.pass(u);function f(){t.assign(u,!1),t.forOf("v",o,y=>t.if((0,fn._)`${d()}(${r}, ${y})`,()=>t.assign(u,!0).break()))}function v(y,w){const g=s[w];return typeof g=="object"&&g!==null?(0,fn._)`${d()}(${r}, ${y}[${w}])`:(0,fn._)`${r} === ${g}`}}};Oa.default=Vp;Object.defineProperty($a,"__esModule",{value:!0});const Up=ga,qp=_a,Gp=va,Kp=Ea,Hp=ba,Wp=Sa,xp=Pa,Bp=Na,Yp=Ra,Jp=Oa,Xp=[Up.default,qp.default,Gp.default,Kp.default,Hp.default,Wp.default,xp.default,Bp.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Yp.default,Jp.default];$a.default=Xp;var Ia={},xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.validateAdditionalItems=void 0;const mr=se,ko=M,Zp={message:({params:{len:e}})=>(0,mr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,mr._)`{limit: ${e}}`},Qp={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Zp,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,ko.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ju(e,n)}};function ju(e,t){const{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=!0;const i=r.const("len",(0,mr._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,mr._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0,ko.alwaysValidSchema)(a,n)){const d=r.var("valid",(0,mr._)`${i} <= ${t.length}`);r.if((0,mr.not)(d),()=>c(d)),e.ok(d)}function c(d){r.forRange("i",t.length,i,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:ko.Type.Num},d),a.allErrors||r.if((0,mr.not)(d),()=>r.break())})}}xr.validateAdditionalItems=ju;xr.default=Qp;var Ta={},Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.validateTuple=void 0;const $c=se,cs=M,ey=ce,ty={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Au(e,"additionalItems",t);r.items=!0,!(0,cs.alwaysValidSchema)(r,t)&&e.ok((0,ey.validateArray)(e))}};function Au(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;u(s),i.opts.unevaluated&&r.length&&i.items!==!0&&(i.items=cs.mergeEvaluated.items(n,r.length,i.items));const c=n.name("valid"),d=n.const("len",(0,$c._)`${o}.length`);r.forEach((f,v)=>{(0,cs.alwaysValidSchema)(i,f)||(n.if((0,$c._)`${d} > ${v}`,()=>e.subschema({keyword:a,schemaProp:v,dataProp:v},c)),e.ok(c))});function u(f){const{opts:v,errSchemaPath:y}=i,w=r.length,g=w===f.minItems&&(w===f.maxItems||f[t]===!1);if(v.strictTuples&&!g){const $=`"${a}" is ${w}-tuple, but minItems or maxItems/${t} are not specified or different at path "${y}"`;(0,cs.checkStrictMode)(i,$,v.strictTuples)}}}Br.validateTuple=Au;Br.default=ty;Object.defineProperty(Ta,"__esModule",{value:!0});const ry=Br,ny={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ry.validateTuple)(e,"items")};Ta.default=ny;var ja={};Object.defineProperty(ja,"__esModule",{value:!0});const gc=se,sy=M,oy=ce,ay=xr,iy={message:({params:{len:e}})=>(0,gc.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,gc._)`{limit: ${e}}`},cy={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:iy,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,sy.alwaysValidSchema)(n,t)&&(s?(0,ay.validateAdditionalItems)(e,s):e.ok((0,oy.validateArray)(e)))}};ja.default=cy;var Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});const et=se,Vn=M,ly={message:({params:{min:e,max:t}})=>t===void 0?(0,et.str)`must contain at least ${e} valid item(s)`:(0,et.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,et._)`{minContains: ${e}}`:(0,et._)`{minContains: ${e}, maxContains: ${t}}`},uy={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ly,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let a,i;const{minContains:c,maxContains:d}=n;o.opts.next?(a=c===void 0?1:c,i=d):a=1;const u=t.const("len",(0,et._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0,Vn.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0,Vn.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Vn.alwaysValidSchema)(o,r)){let g=(0,et._)`${u} >= ${a}`;i!==void 0&&(g=(0,et._)`${g} && ${u} <= ${i}`),e.pass(g);return}o.items=!0;const f=t.name("valid");i===void 0&&a===1?y(f,()=>t.if(f,()=>t.break())):a===0?(t.let(f,!0),i!==void 0&&t.if((0,et._)`${s}.length > 0`,v)):(t.let(f,!1),v()),e.result(f,()=>e.reset());function v(){const g=t.name("_valid"),$=t.let("count",0);y(g,()=>t.if(g,()=>w($)))}function y(g,$){t.forRange("i",0,u,m=>{e.subschema({keyword:"contains",dataProp:m,dataPropType:Vn.Type.Num,compositeRule:!0},g),$()})}function w(g){t.code((0,et._)`${g}++`),i===void 0?t.if((0,et._)`${g} >= ${a}`,()=>t.assign(f,!0).break()):(t.if((0,et._)`${g} > ${i}`,()=>t.assign(f,!1).break()),a===1?t.assign(f,!0):t.if((0,et._)`${g} >= ${a}`,()=>t.assign(f,!0)))}}};Aa.default=uy;var Fs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=se,r=M,n=ce;e.error={message:({params:{property:c,depsCount:d,deps:u}})=>{const f=d===1?"property":"properties";return(0,t.str)`must have ${f} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:d,deps:u,missingProperty:f}})=>(0,t._)`{property: ${c}, missingProperty: ${f}, depsCount: ${d}, - deps: ${l}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[d,l]=o(c);i(c,d),a(c,l)}};function o({schema:c}){const d={},l={};for(const f in c){if(f==="__proto__")continue;const y=Array.isArray(c[f])?d:l;y[f]=c[f]}return[d,l]}function i(c,d=c.schema){const{gen:l,data:f,it:y}=c;if(Object.keys(d).length===0)return;const m=l.let("missing");for(const $ in d){const g=d[$];if(g.length===0)continue;const _=(0,n.propertyInData)(l,f,$,y.opts.ownProperties);c.setParams({property:$,depsCount:g.length,deps:g.join(", ")}),y.allErrors?l.if(_,()=>{for(const p of g)(0,n.checkReportMissingProp)(c,p)}):(l.if((0,t._)`${_} && (${(0,n.checkMissingProp)(c,g,m)})`),(0,n.reportMissingProp)(c,m),l.else())}}e.validatePropertyDeps=i;function a(c,d=c.schema){const{gen:l,data:f,keyword:y,it:m}=c,$=l.name("valid");for(const g in d)(0,r.alwaysValidSchema)(m,d[g])||(l.if((0,n.propertyInData)(l,f,g,m.opts.ownProperties),()=>{const _=c.subschema({keyword:y,schemaProp:g},$);c.mergeValidEvaluated(_,$)},()=>l.var($,!0)),c.ok($))}e.validateSchemaDeps=a,e.default=s})(_s);var fa={};Object.defineProperty(fa,"__esModule",{value:!0});const Yl=ie,Rm=q,Om={message:"property name must be valid",params:({params:e})=>(0,Yl._)`{propertyName: ${e.propertyName}}`},Im={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Om,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,Rm.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,Yl.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};fa.default=Im;var vs={};Object.defineProperty(vs,"__esModule",{value:!0});const Pn=de,ft=ie,Tm=nt,Nn=q,jm={message:"must NOT have additional properties",params:({params:e})=>(0,ft._)`{additionalProperty: ${e.additionalProperty}}`},Am={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jm,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Nn.alwaysValidSchema)(i,r))return;const d=(0,Pn.allSchemaProperties)(n.properties),l=(0,Pn.allSchemaProperties)(n.patternProperties);f(),e.ok((0,ft._)`${o} === ${Tm.default.errors}`);function f(){t.forIn("key",s,_=>{!d.length&&!l.length?$(_):t.if(y(_),()=>$(_))})}function y(_){let p;if(d.length>8){const S=(0,Nn.schemaRefOrVal)(i,n.properties,"properties");p=(0,Pn.isOwnProperty)(t,S,_)}else d.length?p=(0,ft.or)(...d.map(S=>(0,ft._)`${_} === ${S}`)):p=ft.nil;return l.length&&(p=(0,ft.or)(p,...l.map(S=>(0,ft._)`${(0,Pn.usePattern)(e,S)}.test(${_})`))),(0,ft.not)(p)}function m(_){t.code((0,ft._)`delete ${s}[${_}]`)}function $(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Nn.alwaysValidSchema)(i,r)){const p=t.name("valid");c.removeAdditional==="failing"?(g(_,p,!1),t.if((0,ft.not)(p),()=>{e.reset(),m(_)})):(g(_,p),a||t.if((0,ft.not)(p),()=>t.break()))}}function g(_,p,S){const R={keyword:"additionalProperties",dataProp:_,dataPropType:Nn.Type.Str};S===!1&&Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(R,p)}}};vs.default=Am;var ha={};Object.defineProperty(ha,"__esModule",{value:!0});const km=ps(),Xi=de,Us=q,Zi=vs,Cm={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Zi.default.code(new km.KeywordCxt(o,Zi.default,"additionalProperties"));const i=(0,Xi.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Us.mergeEvaluated.props(t,(0,Us.toHash)(i),o.props));const a=i.filter(f=>!(0,Us.alwaysValidSchema)(o,r[f]));if(a.length===0)return;const c=t.name("valid");for(const f of a)d(f)?l(f):(t.if((0,Xi.propertyInData)(t,s,f,o.opts.ownProperties)),l(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function d(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};ha.default=Cm;var ma={};Object.defineProperty(ma,"__esModule",{value:!0});const Qi=de,Rn=ie,ec=q,tc=q,Mm={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,a=(0,Qi.allSchemaProperties)(r),c=a.filter(g=>(0,ec.alwaysValidSchema)(o,r[g]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;const d=i.strictSchema&&!i.allowMatchingProperties&&s.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof Rn.Name)&&(o.props=(0,tc.evaluatedPropsToName)(t,o.props));const{props:f}=o;y();function y(){for(const g of a)d&&m(g),o.allErrors?$(g):(t.var(l,!0),$(g),t.if(l))}function m(g){for(const _ in d)new RegExp(g).test(_)&&(0,ec.checkStrictMode)(o,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function $(g){t.forIn("key",n,_=>{t.if((0,Rn._)`${(0,Qi.usePattern)(e,g)}.test(${_})`,()=>{const p=c.includes(g);p||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:tc.Type.Str},l),o.opts.unevaluated&&f!==!0?t.assign((0,Rn._)`${f}[${_}]`,!0):!p&&!o.allErrors&&t.if((0,Rn.not)(l),()=>t.break())})})}}};ma.default=Mm;var pa={};Object.defineProperty(pa,"__esModule",{value:!0});const Dm=q,Fm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,Dm.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"}};pa.default=Fm;var ya={};Object.defineProperty(ya,"__esModule",{value:!0});const Lm=de,zm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Lm.validateUnion,error:{message:"must match a schema in anyOf"}};ya.default=zm;var ga={};Object.defineProperty(ga,"__esModule",{value:!0});const xn=ie,Vm=q,Um={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,xn._)`{passingSchemas: ${e.passing}}`},qm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Um,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(d),e.result(i,()=>e.reset(),()=>e.error(!0));function d(){o.forEach((l,f)=>{let y;(0,Vm.alwaysValidSchema)(s,l)?t.var(c,!0):y=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,xn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,xn._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,f),y&&e.mergeEvaluated(y,xn.Name)})})}}};ga.default=qm;var $a={};Object.defineProperty($a,"__esModule",{value:!0});const Gm=q,Km={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,Gm.alwaysValidSchema)(n,o))return;const a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};$a.default=Km;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});const as=ie,Jl=q,Hm={message:({params:e})=>(0,as.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,as._)`{failingKeyword: ${e.ifClause}}`},Wm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Hm,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Jl.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=rc(n,"then"),o=rc(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){const l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,d("then",l),d("else",l))}else s?t.if(a,d("then")):t.if((0,as.not)(a),d("else"));e.pass(i,()=>e.error(!0));function c(){const l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function d(l,f){return()=>{const y=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(y,i),f?t.assign(f,(0,as._)`${l}`):e.setParams({ifClause:l})}}}};function rc(e,t){const r=e.schema[t];return r!==void 0&&!(0,Jl.alwaysValidSchema)(e,r)}_a.default=Wm;var va={};Object.defineProperty(va,"__esModule",{value:!0});const xm=q,Bm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,xm.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};va.default=Bm;Object.defineProperty(ca,"__esModule",{value:!0});const Ym=kr,Jm=la,Xm=Cr,Zm=ua,Qm=da,ep=_s,tp=fa,rp=vs,np=ha,sp=ma,op=pa,ap=ya,ip=ga,cp=$a,lp=_a,up=va;function dp(e=!1){const t=[op.default,ap.default,ip.default,cp.default,lp.default,up.default,tp.default,rp.default,ep.default,np.default,sp.default];return e?t.push(Jm.default,Zm.default):t.push(Ym.default,Xm.default),t.push(Qm.default),t}ca.default=dp;var wa={},Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});Mr.dynamicAnchor=void 0;const qs=ie,fp=nt,nc=He,hp=Mt,mp={keyword:"$dynamicAnchor",schemaType:"string",code:e=>Xl(e,e.schema)};function Xl(e,t){const{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;const s=(0,qs._)`${fp.default.dynamicAnchors}${(0,qs.getProperty)(t)}`,o=n.errSchemaPath==="#"?n.validateName:pp(e);r.if((0,qs._)`!${s}`,()=>r.assign(s,o))}Mr.dynamicAnchor=Xl;function pp(e){const{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:c}=n.opts,d=new nc.SchemaEnv({schema:r,schemaId:c,root:s,baseId:o,localRefs:i,meta:a});return nc.compileSchema.call(n,d),(0,hp.getValidate)(e,d)}Mr.default=mp;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.dynamicRef=void 0;const sc=ie,yp=nt,oc=Mt,gp={keyword:"$dynamicRef",schemaType:"string",code:e=>Zl(e,e.schema)};function Zl(e,t){const{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);const o=t.slice(1);if(s.allErrors)i();else{const c=r.let("valid",!1);i(c),e.ok(c)}function i(c){if(s.schemaEnv.root.dynamicAnchors[o]){const d=r.let("_v",(0,sc._)`${yp.default.dynamicAnchors}${(0,sc.getProperty)(o)}`);r.if(d,a(d,c),a(s.validateName,c))}else a(s.validateName,c)()}function a(c,d){return d?()=>r.block(()=>{(0,oc.callRef)(e,c),r.let(d,!0)}):()=>(0,oc.callRef)(e,c)}}Dr.dynamicRef=Zl;Dr.default=gp;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});const $p=Mr,_p=q,vp={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,$p.dynamicAnchor)(e,""):(0,_p.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};Ea.default=vp;var ba={};Object.defineProperty(ba,"__esModule",{value:!0});const wp=Dr,Ep={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,wp.dynamicRef)(e,e.schema)};ba.default=Ep;Object.defineProperty(wa,"__esModule",{value:!0});const bp=Mr,Sp=Dr,Pp=Ea,Np=ba,Rp=[bp.default,Sp.default,Pp.default,Np.default];wa.default=Rp;var Sa={},Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});const ac=_s,Op={keyword:"dependentRequired",type:"object",schemaType:"object",error:ac.error,code:e=>(0,ac.validatePropertyDeps)(e)};Pa.default=Op;var Na={};Object.defineProperty(Na,"__esModule",{value:!0});const Ip=_s,Tp={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,Ip.validateSchemaDeps)(e)};Na.default=Tp;var Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});const jp=q,Ap={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){t.contains===void 0&&(0,jp.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}};Ra.default=Ap;Object.defineProperty(Sa,"__esModule",{value:!0});const kp=Pa,Cp=Na,Mp=Ra,Dp=[kp.default,Cp.default,Mp.default];Sa.default=Dp;var Oa={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});const Kt=ie,ic=q,Fp=nt,Lp={message:"must NOT have unevaluated properties",params:({params:e})=>(0,Kt._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},zp={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:Lp,code(e){const{gen:t,schema:r,data:n,errsCount:s,it:o}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:i,props:a}=o;a instanceof Kt.Name?t.if((0,Kt._)`${a} !== true`,()=>t.forIn("key",n,f=>t.if(d(a,f),()=>c(f)))):a!==!0&&t.forIn("key",n,f=>a===void 0?c(f):t.if(l(a,f),()=>c(f))),o.props=!0,e.ok((0,Kt._)`${s} === ${Fp.default.errors}`);function c(f){if(r===!1){e.setParams({unevaluatedProperty:f}),e.error(),i||t.break();return}if(!(0,ic.alwaysValidSchema)(o,r)){const y=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:ic.Type.Str},y),i||t.if((0,Kt.not)(y),()=>t.break())}}function d(f,y){return(0,Kt._)`!${f} || !${f}[${y}]`}function l(f,y){const m=[];for(const $ in f)f[$]===!0&&m.push((0,Kt._)`${y} !== ${$}`);return(0,Kt.and)(...m)}}};Ia.default=zp;var Ta={};Object.defineProperty(Ta,"__esModule",{value:!0});const ar=ie,cc=q,Vp={message:({params:{len:e}})=>(0,ar.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ar._)`{limit: ${e}}`},Up={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:Vp,code(e){const{gen:t,schema:r,data:n,it:s}=e,o=s.items||0;if(o===!0)return;const i=t.const("len",(0,ar._)`${n}.length`);if(r===!1)e.setParams({len:o}),e.fail((0,ar._)`${i} > ${o}`);else if(typeof r=="object"&&!(0,cc.alwaysValidSchema)(s,r)){const c=t.var("valid",(0,ar._)`${i} <= ${o}`);t.if((0,ar.not)(c),()=>a(c,o)),e.ok(c)}s.items=!0;function a(c,d){t.forRange("i",d,i,l=>{e.subschema({keyword:"unevaluatedItems",dataProp:l,dataPropType:cc.Type.Num},c),s.allErrors||t.if((0,ar.not)(c),()=>t.break())})}}};Ta.default=Up;Object.defineProperty(Oa,"__esModule",{value:!0});const qp=Ia,Gp=Ta,Kp=[qp.default,Gp.default];Oa.default=Kp;var ja={},Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});const Te=ie,Hp={message:({schemaCode:e})=>(0,Te.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Te._)`{format: ${e}}`},Wp={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Hp,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:d,schemaEnv:l,self:f}=a;if(!c.validateFormats)return;s?y():m();function y(){const $=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),g=r.const("fDef",(0,Te._)`${$}[${i}]`),_=r.let("fType"),p=r.let("format");r.if((0,Te._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,(0,Te._)`${g}.type || "string"`).assign(p,(0,Te._)`${g}.validate`),()=>r.assign(_,(0,Te._)`"string"`).assign(p,g)),e.fail$data((0,Te.or)(S(),R()));function S(){return c.strictSchema===!1?Te.nil:(0,Te._)`${i} && !${p}`}function R(){const T=l.$async?(0,Te._)`(${g}.async ? await ${p}(${n}) : ${p}(${n}))`:(0,Te._)`${p}(${n})`,A=(0,Te._)`(typeof ${p} == "function" ? ${T} : ${p}.test(${n}))`;return(0,Te._)`${p} && ${p} !== true && ${_} === ${t} && !${A}`}}function m(){const $=f.formats[o];if(!$){S();return}if($===!0)return;const[g,_,p]=R($);g===t&&e.pass(T());function S(){if(c.strictSchema===!1){f.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${o}" ignored in schema at path "${d}"`}}function R(A){const B=A instanceof RegExp?(0,Te.regexpCode)(A):c.code.formats?(0,Te._)`${c.code.formats}${(0,Te.getProperty)(o)}`:void 0,Z=r.scopeValue("formats",{key:o,ref:A,code:B});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,Te._)`${Z}.validate`]:["string",A,Z]}function T(){if(typeof $=="object"&&!($ instanceof RegExp)&&$.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Te._)`await ${p}(${n})`}return typeof _=="function"?(0,Te._)`${p}(${n})`:(0,Te._)`${p}.test(${n})`}}}};Aa.default=Wp;Object.defineProperty(ja,"__esModule",{value:!0});const xp=Aa,Bp=[xp.default];ja.default=Bp;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.contentVocabulary=Tr.metadataVocabulary=void 0;Tr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Tr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(xo,"__esModule",{value:!0});const Yp=Bo,Jp=Jo,Xp=ca,Zp=wa,Qp=Sa,ey=Oa,ty=ja,lc=Tr,ry=[Zp.default,Yp.default,Jp.default,(0,Xp.default)(!0),ty.default,lc.metadataVocabulary,lc.contentVocabulary,Qp.default,ey.default];xo.default=ry;var ka={},ws={};Object.defineProperty(ws,"__esModule",{value:!0});ws.DiscrError=void 0;var uc;(function(e){e.Tag="tag",e.Mapping="mapping"})(uc||(ws.DiscrError=uc={}));Object.defineProperty(ka,"__esModule",{value:!0});const vr=ie,mo=ws,dc=He,ny=Ar,sy=q,oy={message:({params:{discrError:e,tagName:t}})=>e===mo.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,vr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},ay={keyword:"discriminator",type:"object",schemaType:"object",error:oy,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),d=t.const("tag",(0,vr._)`${r}${(0,vr.getProperty)(a)}`);t.if((0,vr._)`typeof ${d} == "string"`,()=>l(),()=>e.error(!1,{discrError:mo.DiscrError.Tag,tag:d,tagName:a})),e.ok(c);function l(){const m=y();t.if(!1);for(const $ in m)t.elseIf((0,vr._)`${d} === ${$}`),t.assign(c,f(m[$]));t.else(),e.error(!1,{discrError:mo.DiscrError.Mapping,tag:d,tagName:a}),t.endIf()}function f(m){const $=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},$);return e.mergeEvaluated(g,vr.Name),$}function y(){var m;const $={},g=p(s);let _=!0;for(let T=0;Tthis.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,Tg):n}}Ca.default=jg;(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=t.Ajv2020=void 0;const r=pl,n=xo,s=ka,o=Ca,i="https://json-schema.org/draft/2020-12/schema";class a extends r.default{constructor(m={}){super({...m,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:m,meta:$}=this.opts;$&&(o.default.call(this,m),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv2020=a,e.exports=t=a,e.exports.Ajv2020=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a;var c=ps();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=ie;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var l=qo();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var f=Ar;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(ao,ao.exports);var Ag=ao.exports,po={exports:{}},Ql={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(G,Q){return{validate:G,compare:Q}}e.fullFormats={date:t(o,i),time:t(c(!0),d),"date-time":t(y(!0),m),"iso-time":t(c(),l),"iso-date-time":t(y(),$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:p,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:we,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:R,int32:{type:"number",validate:B},int64:{type:"number",validate:Z},float:{type:"number",validate:ye},double:{type:"number",validate:ye},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(G){return G%4===0&&(G%100!==0||G%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(G){const Q=n.exec(G);if(!Q)return!1;const J=+Q[1],k=+Q[2],F=+Q[3];return k>=1&&k<=12&&F>=1&&F<=(k===2&&r(J)?29:s[k])}function i(G,Q){if(G&&Q)return G>Q?1:G23||w>59||G&&!ee)return!1;if(F<=23&&H<=59&&U<60)return!0;const N=H-w*K,E=F-I*K-(N<0?1:0);return(E===23||E===-1)&&(N===59||N===-1)&&U<61}}function d(G,Q){if(!(G&&Q))return;const J=new Date("2020-01-01T"+G).valueOf(),k=new Date("2020-01-01T"+Q).valueOf();if(J&&k)return J-k}function l(G,Q){if(!(G&&Q))return;const J=a.exec(G),k=a.exec(Q);if(J&&k)return G=J[1]+J[2]+J[3],Q=k[1]+k[2]+k[3],G>Q?1:G=T}function Z(G){return Number.isInteger(G)}function ye(){return!0}const $e=/[^\\]\\Z/;function we(G){if($e.test(G))return!1;try{return new RegExp(G),!0}catch{return!1}}})(Ql);var eu={},yo={exports:{}},tu={},jt={},rr={},pn={},ue={},fn={};(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(S){if(super(),!e.IDENTIFIER.test(S))throw new Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(S){super(),this._items=typeof S=="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((R,T)=>`${R}${T}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((R,T)=>(T instanceof r&&(R[T.str]=(R[T.str]||0)+1),R),{})}}e._Code=n,e.nil=new n("");function s(p,...S){const R=[p[0]];let T=0;for(;T{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${d}${f.scopePath}`})}scopeCode(d=this._values,l,f){return this._reduceValues(d,y=>{if(y.value===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return y.value.code},l,f)}_reduceValues(d,l,f={},y){let m=t.nil;for(const $ in d){const g=d[$];if(!g)continue;const _=f[$]=f[$]||new Map;g.forEach(p=>{if(_.has(p))return;_.set(p,n.Started);let S=l(p);if(S){const R=this.opts.es5?e.varKinds.var:e.varKinds.const;m=(0,t._)`${m}${R} ${p} = ${S};${this.opts._n}`}else if(S=y==null?void 0:y(p))m=(0,t._)`${m}${S}${this.opts._n}`;else throw new r(p);_.set(p,n.Completed)})}return m}}e.ValueScope=a})(go);(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=fn,r=go;var n=fn;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=go;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(u,h){return this}}class i extends o{constructor(u,h,P){super(),this.varKind=u,this.name=h,this.rhs=P}render({es5:u,_n:h}){const P=u?r.varKinds.var:this.varKind,C=this.rhs===void 0?"":` = ${this.rhs}`;return`${P} ${this.name}${C};`+h}optimizeNames(u,h){if(u[this.name.str])return this.rhs&&(this.rhs=k(this.rhs,u,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(u,h,P){super(),this.lhs=u,this.rhs=h,this.sideEffects=P}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,h){if(!(this.lhs instanceof t.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,u,h),this}get names(){const u=this.lhs instanceof t.Name?{}:{...this.lhs.names};return J(u,this.rhs)}}class c extends a{constructor(u,h,P,C){super(u,P,C),this.op=h}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}}class d extends o{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}}class l extends o{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}}class f extends o{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}}class y extends o{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,h){return this.code=k(this.code,u,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends o{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((h,P)=>h+P.render(u),"")}optimizeNodes(){const{nodes:u}=this;let h=u.length;for(;h--;){const P=u[h].optimizeNodes();Array.isArray(P)?u.splice(h,1,...P):P?u[h]=P:u.splice(h,1)}return u.length>0?this:void 0}optimizeNames(u,h){const{nodes:P}=this;let C=P.length;for(;C--;){const D=P[C];D.optimizeNames(u,h)||(F(u,D.names),P.splice(C,1))}return P.length>0?this:void 0}get names(){return this.nodes.reduce((u,h)=>Q(u,h.names),{})}}class $ extends m{render(u){return"{"+u._n+super.render(u)+"}"+u._n}}class g extends m{}class _ extends ${}_.kind="else";class p extends ${constructor(u,h){super(h),this.condition=u}render(u){let h=`if(${this.condition})`+super.render(u);return this.else&&(h+="else "+this.else.render(u)),h}optimizeNodes(){super.optimizeNodes();const u=this.condition;if(u===!0)return this.nodes;let h=this.else;if(h){const P=h.optimizeNodes();h=this.else=Array.isArray(P)?new _(P):P}if(h)return u===!1?h instanceof p?h:h.nodes:this.nodes.length?this:new p(H(u),h instanceof p?[h]:h.nodes);if(!(u===!1||!this.nodes.length))return this}optimizeNames(u,h){var P;if(this.else=(P=this.else)===null||P===void 0?void 0:P.optimizeNames(u,h),!!(super.optimizeNames(u,h)||this.else))return this.condition=k(this.condition,u,h),this}get names(){const u=super.names;return J(u,this.condition),this.else&&Q(u,this.else.names),u}}p.kind="if";class S extends ${}S.kind="for";class R extends S{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,h){if(super.optimizeNames(u,h))return this.iteration=k(this.iteration,u,h),this}get names(){return Q(super.names,this.iteration.names)}}class T extends S{constructor(u,h,P,C){super(),this.varKind=u,this.name=h,this.from=P,this.to=C}render(u){const h=u.es5?r.varKinds.var:this.varKind,{name:P,from:C,to:D}=this;return`for(${h} ${P}=${C}; ${P}<${D}; ${P}++)`+super.render(u)}get names(){const u=J(super.names,this.from);return J(u,this.to)}}class A extends S{constructor(u,h,P,C){super(),this.loop=u,this.varKind=h,this.name=P,this.iterable=C}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,h){if(super.optimizeNames(u,h))return this.iterable=k(this.iterable,u,h),this}get names(){return Q(super.names,this.iterable.names)}}class B extends ${constructor(u,h,P){super(),this.name=u,this.args=h,this.async=P}render(u){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(u)}}B.kind="func";class Z extends m{render(u){return"return "+super.render(u)}}Z.kind="return";class ye extends ${render(u){let h="try"+super.render(u);return this.catch&&(h+=this.catch.render(u)),this.finally&&(h+=this.finally.render(u)),h}optimizeNodes(){var u,h;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(u,h){var P,C;return super.optimizeNames(u,h),(P=this.catch)===null||P===void 0||P.optimizeNames(u,h),(C=this.finally)===null||C===void 0||C.optimizeNames(u,h),this}get names(){const u=super.names;return this.catch&&Q(u,this.catch.names),this.finally&&Q(u,this.finally.names),u}}class $e extends ${constructor(u){super(),this.error=u}render(u){return`catch(${this.error})`+super.render(u)}}$e.kind="catch";class we extends ${render(u){return"finally"+super.render(u)}}we.kind="finally";class G{constructor(u,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?` -`:""},this._extScope=u,this._scope=new r.Scope({parent:u}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(u){return this._scope.name(u)}scopeName(u){return this._extScope.name(u)}scopeValue(u,h){const P=this._extScope.value(u,h);return(this._values[P.prefix]||(this._values[P.prefix]=new Set)).add(P),P}getScopeValue(u,h){return this._extScope.getValue(u,h)}scopeRefs(u){return this._extScope.scopeRefs(u,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(u,h,P,C){const D=this._scope.toName(h);return P!==void 0&&C&&(this._constants[D.str]=P),this._leafNode(new i(u,D,P)),D}const(u,h,P){return this._def(r.varKinds.const,u,h,P)}let(u,h,P){return this._def(r.varKinds.let,u,h,P)}var(u,h,P){return this._def(r.varKinds.var,u,h,P)}assign(u,h,P){return this._leafNode(new a(u,h,P))}add(u,h){return this._leafNode(new c(u,e.operators.ADD,h))}code(u){return typeof u=="function"?u():u!==t.nil&&this._leafNode(new y(u)),this}object(...u){const h=["{"];for(const[P,C]of u)h.length>1&&h.push(","),h.push(P),(P!==C||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,C));return h.push("}"),new t._Code(h)}if(u,h,P){if(this._blockNode(new p(u)),h&&P)this.code(h).else().code(P).endIf();else if(h)this.code(h).endIf();else if(P)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(u){return this._elseNode(new p(u))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(p,_)}_for(u,h){return this._blockNode(u),h&&this.code(h).endFor(),this}for(u,h){return this._for(new R(u),h)}forRange(u,h,P,C,D=this.opts.es5?r.varKinds.var:r.varKinds.let){const X=this._scope.toName(u);return this._for(new T(D,X,h,P),()=>C(X))}forOf(u,h,P,C=r.varKinds.const){const D=this._scope.toName(u);if(this.opts.es5){const X=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${X}.length`,W=>{this.var(D,(0,t._)`${X}[${W}]`),P(D)})}return this._for(new A("of",C,D,h),()=>P(D))}forIn(u,h,P,C=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(u,(0,t._)`Object.keys(${h})`,P);const D=this._scope.toName(u);return this._for(new A("in",C,D,h),()=>P(D))}endFor(){return this._endBlockNode(S)}label(u){return this._leafNode(new d(u))}break(u){return this._leafNode(new l(u))}return(u){const h=new Z;if(this._blockNode(h),this.code(u),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Z)}try(u,h,P){if(!h&&!P)throw new Error('CodeGen: "try" without "catch" and "finally"');const C=new ye;if(this._blockNode(C),this.code(u),h){const D=this.name("e");this._currNode=C.catch=new $e(D),h(D)}return P&&(this._currNode=C.finally=new we,this.code(P)),this._endBlockNode($e,we)}throw(u){return this._leafNode(new f(u))}block(u,h){return this._blockStarts.push(this._nodes.length),u&&this.code(u).endBlock(h),this}endBlock(u){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const P=this._nodes.length-h;if(P<0||u!==void 0&&P!==u)throw new Error(`CodeGen: wrong number of nodes: ${P} vs ${u} expected`);return this._nodes.length=h,this}func(u,h=t.nil,P,C){return this._blockNode(new B(u,h,P)),C&&this.code(C).endFunc(),this}endFunc(){return this._endBlockNode(B)}optimize(u=1){for(;u-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(u){return this._currNode.nodes.push(u),this}_blockNode(u){this._currNode.nodes.push(u),this._nodes.push(u)}_endBlockNode(u,h){const P=this._currNode;if(P instanceof u||h&&P instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${u.kind}/${h.kind}`:u.kind}"`)}_elseNode(u){const h=this._currNode;if(!(h instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=u,this}get _root(){return this._nodes[0]}get _currNode(){const u=this._nodes;return u[u.length-1]}set _currNode(u){const h=this._nodes;h[h.length-1]=u}}e.CodeGen=G;function Q(E,u){for(const h in u)E[h]=(E[h]||0)+(u[h]||0);return E}function J(E,u){return u instanceof t._CodeOrName?Q(E,u.names):E}function k(E,u,h){if(E instanceof t.Name)return P(E);if(!C(E))return E;return new t._Code(E._items.reduce((D,X)=>(X instanceof t.Name&&(X=P(X)),X instanceof t._Code?D.push(...X._items):D.push(X),D),[]));function P(D){const X=h[D.str];return X===void 0||u[D.str]!==1?D:(delete u[D.str],X)}function C(D){return D instanceof t._Code&&D._items.some(X=>X instanceof t.Name&&u[X.str]===1&&h[X.str]!==void 0)}}function F(E,u){for(const h in u)E[h]=(E[h]||0)-(u[h]||0)}function H(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:(0,t._)`!${N(E)}`}e.not=H;const U=w(e.operators.AND);function ee(...E){return E.reduce(U)}e.and=ee;const K=w(e.operators.OR);function I(...E){return E.reduce(K)}e.or=I;function w(E){return(u,h)=>u===t.nil?h:h===t.nil?u:(0,t._)`${N(u)} ${E} ${N(h)}`}function N(E){return E instanceof t.Name?E:(0,t._)`(${E})`}})(ue);var x={};Object.defineProperty(x,"__esModule",{value:!0});x.checkStrictMode=x.getErrorPath=x.Type=x.useFunc=x.setEvaluated=x.evaluatedPropsToName=x.mergeEvaluated=x.eachItem=x.unescapeJsonPointer=x.escapeJsonPointer=x.escapeFragment=x.unescapeFragment=x.schemaRefOrVal=x.schemaHasRulesButRef=x.schemaHasRules=x.checkUnknownRules=x.alwaysValidSchema=x.toHash=void 0;const be=ue,kg=fn;function Cg(e){const t={};for(const r of e)t[r]=!0;return t}x.toHash=Cg;function Mg(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(ru(e,t),!nu(t,e.self.RULES.all))}x.alwaysValidSchema=Mg;function ru(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||au(e,`unknown keyword: "${o}"`)}x.checkUnknownRules=ru;function nu(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}x.schemaHasRules=nu;function Dg(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}x.schemaHasRulesButRef=Dg;function Fg({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,be._)`${r}`}return(0,be._)`${e}${t}${(0,be.getProperty)(n)}`}x.schemaRefOrVal=Fg;function Lg(e){return su(decodeURIComponent(e))}x.unescapeFragment=Lg;function zg(e){return encodeURIComponent(Ma(e))}x.escapeFragment=zg;function Ma(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}x.escapeJsonPointer=Ma;function su(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}x.unescapeJsonPointer=su;function Vg(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}x.eachItem=Vg;function fc({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{const c=i===void 0?o:i instanceof be.Name?(o instanceof be.Name?e(s,o,i):t(s,o,i),i):o instanceof be.Name?(t(s,i,o),o):r(o,i);return a===be.Name&&!(c instanceof be.Name)?n(s,c):c}}x.mergeEvaluated={props:fc({mergeNames:(e,t,r)=>e.if((0,be._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,be._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,be._)`${r} || {}`).code((0,be._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,be._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,be._)`${r} || {}`),Da(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:ou}),items:fc({mergeNames:(e,t,r)=>e.if((0,be._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,be._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,be._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,be._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ou(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,be._)`{}`);return t!==void 0&&Da(e,r,t),r}x.evaluatedPropsToName=ou;function Da(e,t,r){Object.keys(r).forEach(n=>e.assign((0,be._)`${t}${(0,be.getProperty)(n)}`,!0))}x.setEvaluated=Da;const hc={};function Ug(e,t){return e.scopeValue("func",{ref:t,code:hc[t.code]||(hc[t.code]=new kg._Code(t.code))})}x.useFunc=Ug;var $o;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})($o||(x.Type=$o={}));function qg(e,t,r){if(e instanceof be.Name){const n=t===$o.Num;return r?n?(0,be._)`"[" + ${e} + "]"`:(0,be._)`"['" + ${e} + "']"`:n?(0,be._)`"/" + ${e}`:(0,be._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,be.getProperty)(e).toString():"/"+Ma(e)}x.getErrorPath=qg;function au(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}x.checkStrictMode=au;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});const qe=ue,Gg={data:new qe.Name("data"),valCxt:new qe.Name("valCxt"),instancePath:new qe.Name("instancePath"),parentData:new qe.Name("parentData"),parentDataProperty:new qe.Name("parentDataProperty"),rootData:new qe.Name("rootData"),dynamicAnchors:new qe.Name("dynamicAnchors"),vErrors:new qe.Name("vErrors"),errors:new qe.Name("errors"),this:new qe.Name("this"),self:new qe.Name("self"),scope:new qe.Name("scope"),json:new qe.Name("json"),jsonPos:new qe.Name("jsonPos"),jsonLen:new qe.Name("jsonLen"),jsonPart:new qe.Name("jsonPart")};Pt.default=Gg;(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=ue,r=x,n=Pt;e.keywordError={message:({keyword:_})=>(0,t.str)`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:p})=>p?(0,t.str)`"${_}" keyword must be ${p} ($data)`:(0,t.str)`"${_}" keyword is invalid ($data)`};function s(_,p=e.keywordError,S,R){const{it:T}=_,{gen:A,compositeRule:B,allErrors:Z}=T,ye=f(_,p,S);R??(B||Z)?c(A,ye):d(T,(0,t._)`[${ye}]`)}e.reportError=s;function o(_,p=e.keywordError,S){const{it:R}=_,{gen:T,compositeRule:A,allErrors:B}=R,Z=f(_,p,S);c(T,Z),A||B||d(R,n.default.vErrors)}e.reportExtraError=o;function i(_,p){_.assign(n.default.errors,p),_.if((0,t._)`${n.default.vErrors} !== null`,()=>_.if(p,()=>_.assign((0,t._)`${n.default.vErrors}.length`,p),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:_,keyword:p,schemaValue:S,data:R,errsCount:T,it:A}){if(T===void 0)throw new Error("ajv implementation error");const B=_.name("err");_.forRange("i",T,n.default.errors,Z=>{_.const(B,(0,t._)`${n.default.vErrors}[${Z}]`),_.if((0,t._)`${B}.instancePath === undefined`,()=>_.assign((0,t._)`${B}.instancePath`,(0,t.strConcat)(n.default.instancePath,A.errorPath))),_.assign((0,t._)`${B}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${p}`),A.opts.verbose&&(_.assign((0,t._)`${B}.schema`,S),_.assign((0,t._)`${B}.data`,R))})}e.extendErrors=a;function c(_,p){const S=_.const("err",p);_.if((0,t._)`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,(0,t._)`[${S}]`),(0,t._)`${n.default.vErrors}.push(${S})`),_.code((0,t._)`${n.default.errors}++`)}function d(_,p){const{gen:S,validateName:R,schemaEnv:T}=_;T.$async?S.throw((0,t._)`new ${_.ValidationError}(${p})`):(S.assign((0,t._)`${R}.errors`,p),S.return(!1))}const l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(_,p,S){const{createErrors:R}=_.it;return R===!1?(0,t._)`{}`:y(_,p,S)}function y(_,p,S={}){const{gen:R,it:T}=_,A=[m(T,S),$(_,S)];return g(_,p,A),R.object(...A)}function m({errorPath:_},{instancePath:p}){const S=p?(0,t.str)`${_}${(0,r.getErrorPath)(p,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,S)]}function $({keyword:_,it:{errSchemaPath:p}},{schemaPath:S,parentSchema:R}){let T=R?p:(0,t.str)`${p}/${_}`;return S&&(T=(0,t.str)`${T}${(0,r.getErrorPath)(S,r.Type.Str)}`),[l.schemaPath,T]}function g(_,{params:p,message:S},R){const{keyword:T,data:A,schemaValue:B,it:Z}=_,{opts:ye,propertyName:$e,topSchemaRef:we,schemaPath:G}=Z;R.push([l.keyword,T],[l.params,typeof p=="function"?p(_):p||(0,t._)`{}`]),ye.messages&&R.push([l.message,typeof S=="function"?S(_):S]),ye.verbose&&R.push([l.schema,B],[l.parentSchema,(0,t._)`${we}${G}`],[n.default.data,A]),$e&&R.push([l.propertyName,$e])}})(pn);var mc;function Kg(){if(mc)return rr;mc=1,Object.defineProperty(rr,"__esModule",{value:!0}),rr.boolOrEmptySchema=rr.topBoolOrEmptySchema=void 0;const e=pn,t=ue,r=Pt,n={message:"boolean schema is false"};function s(a){const{gen:c,schema:d,validateName:l}=a;d===!1?i(a,!1):typeof d=="object"&&d.$async===!0?c.return(r.default.data):(c.assign((0,t._)`${l}.errors`,null),c.return(!0))}rr.topBoolOrEmptySchema=s;function o(a,c){const{gen:d,schema:l}=a;l===!1?(d.var(c,!1),i(a)):d.var(c,!0)}rr.boolOrEmptySchema=o;function i(a,c){const{gen:d,data:l}=a,f={gen:d,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,e.reportError)(f,n,void 0,c)}return rr}var ke={},mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.getRules=mr.isJSONType=void 0;const Hg=["string","number","integer","boolean","null","object","array"],Wg=new Set(Hg);function xg(e){return typeof e=="string"&&Wg.has(e)}mr.isJSONType=xg;function Bg(){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:{}}}mr.getRules=Bg;var kt={};Object.defineProperty(kt,"__esModule",{value:!0});kt.shouldUseRule=kt.shouldUseGroup=kt.schemaHasRulesForType=void 0;function Yg({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&iu(e,n)}kt.schemaHasRulesForType=Yg;function iu(e,t){return t.rules.some(r=>cu(e,r))}kt.shouldUseGroup=iu;function cu(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))}kt.shouldUseRule=cu;Object.defineProperty(ke,"__esModule",{value:!0});ke.reportTypeError=ke.checkDataTypes=ke.checkDataType=ke.coerceAndCheckDataType=ke.getJSONTypes=ke.getSchemaTypes=ke.DataType=void 0;const Jg=mr,Xg=kt,Zg=pn,le=ue,lu=x;var Nr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Nr||(ke.DataType=Nr={}));function Qg(e){const t=uu(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}ke.getSchemaTypes=Qg;function uu(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(Jg.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ke.getJSONTypes=uu;function e$(e,t){const{gen:r,data:n,opts:s}=e,o=t$(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&(0,Xg.schemaHasRulesForType)(e,t[0]));if(i){const a=Fa(t,n,s.strictNumbers,Nr.Wrong);r.if(a,()=>{o.length?r$(e,t,o):La(e)})}return i}ke.coerceAndCheckDataType=e$;const du=new Set(["string","number","integer","boolean","null"]);function t$(e,t){return t?e.filter(r=>du.has(r)||t==="array"&&r==="array"):[]}function r$(e,t,r){const{gen:n,data:s,opts:o}=e,i=n.let("dataType",(0,le._)`typeof ${s}`),a=n.let("coerced",(0,le._)`undefined`);o.coerceTypes==="array"&&n.if((0,le._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,le._)`${s}[0]`).assign(i,(0,le._)`typeof ${s}`).if(Fa(t,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,le._)`${a} !== undefined`);for(const d of r)(du.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),La(e),n.endIf(),n.if((0,le._)`${a} !== undefined`,()=>{n.assign(s,a),n$(e,a)});function c(d){switch(d){case"string":n.elseIf((0,le._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,le._)`"" + ${s}`).elseIf((0,le._)`${s} === null`).assign(a,(0,le._)`""`);return;case"number":n.elseIf((0,le._)`${i} == "boolean" || ${s} === null - || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,le._)`+${s}`);return;case"integer":n.elseIf((0,le._)`${i} === "boolean" || ${s} === null - || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,le._)`+${s}`);return;case"boolean":n.elseIf((0,le._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,le._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,le._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,le._)`${i} === "string" || ${i} === "number" - || ${i} === "boolean" || ${s} === null`).assign(a,(0,le._)`[${s}]`)}}}function n$({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,le._)`${t} !== undefined`,()=>e.assign((0,le._)`${t}[${r}]`,n))}function _o(e,t,r,n=Nr.Correct){const s=n===Nr.Correct?le.operators.EQ:le.operators.NEQ;let o;switch(e){case"null":return(0,le._)`${t} ${s} null`;case"array":o=(0,le._)`Array.isArray(${t})`;break;case"object":o=(0,le._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i((0,le._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return(0,le._)`typeof ${t} ${s} ${e}`}return n===Nr.Correct?o:(0,le.not)(o);function i(a=le.nil){return(0,le.and)((0,le._)`typeof ${t} == "number"`,a,r?(0,le._)`isFinite(${t})`:le.nil)}}ke.checkDataType=_o;function Fa(e,t,r,n){if(e.length===1)return _o(e[0],t,r,n);let s;const o=(0,lu.toHash)(e);if(o.array&&o.object){const i=(0,le._)`typeof ${t} != "object"`;s=o.null?i:(0,le._)`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=le.nil;o.number&&delete o.integer;for(const i in o)s=(0,le.and)(s,_o(i,t,r,n));return s}ke.checkDataTypes=Fa;const s$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,le._)`{type: ${e}}`:(0,le._)`{type: ${t}}`};function La(e){const t=o$(e);(0,Zg.reportError)(t,s$)}ke.reportTypeError=La;function o$(e){const{gen:t,data:r,schema:n}=e,s=(0,lu.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Wr={},pc;function a$(){if(pc)return Wr;pc=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.assignDefaults=void 0;const e=ue,t=x;function r(s,o){const{properties:i,items:a}=s.schema;if(o==="object"&&i)for(const c in i)n(s,c,i[c].default);else o==="array"&&Array.isArray(a)&&a.forEach((c,d)=>n(s,d,c.default))}Wr.assignDefaults=r;function n(s,o,i){const{gen:a,compositeRule:c,data:d,opts:l}=s;if(i===void 0)return;const f=(0,e._)`${d}${(0,e.getProperty)(o)}`;if(c){(0,t.checkStrictMode)(s,`default is ignored for: ${f}`);return}let y=(0,e._)`${f} === undefined`;l.useDefaults==="empty"&&(y=(0,e._)`${y} || ${f} === null || ${f} === ""`),a.if(y,(0,e._)`${f} = ${(0,e.stringify)(i)}`)}return Wr}var ut={},fe={};Object.defineProperty(fe,"__esModule",{value:!0});fe.validateUnion=fe.validateArray=fe.usePattern=fe.callValidateCode=fe.schemaProperties=fe.allSchemaProperties=fe.noPropertyInData=fe.propertyInData=fe.isOwnProperty=fe.hasPropFunc=fe.reportMissingProp=fe.checkMissingProp=fe.checkReportMissingProp=void 0;const Ne=ue,za=x,Ut=Pt,i$=x;function c$(e,t){const{gen:r,data:n,it:s}=e;r.if(Ua(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Ne._)`${t}`},!0),e.error()})}fe.checkReportMissingProp=c$;function l$({gen:e,data:t,it:{opts:r}},n,s){return(0,Ne.or)(...n.map(o=>(0,Ne.and)(Ua(e,t,o,r.ownProperties),(0,Ne._)`${s} = ${o}`)))}fe.checkMissingProp=l$;function u$(e,t){e.setParams({missingProperty:t},!0),e.error()}fe.reportMissingProp=u$;function fu(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}fe.hasPropFunc=fu;function Va(e,t,r){return(0,Ne._)`${fu(e)}.call(${t}, ${r})`}fe.isOwnProperty=Va;function d$(e,t,r,n){const s=(0,Ne._)`${t}${(0,Ne.getProperty)(r)} !== undefined`;return n?(0,Ne._)`${s} && ${Va(e,t,r)}`:s}fe.propertyInData=d$;function Ua(e,t,r,n){const s=(0,Ne._)`${t}${(0,Ne.getProperty)(r)} === undefined`;return n?(0,Ne.or)(s,(0,Ne.not)(Va(e,t,r))):s}fe.noPropertyInData=Ua;function hu(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}fe.allSchemaProperties=hu;function f$(e,t){return hu(t).filter(r=>!(0,za.alwaysValidSchema)(e,t[r]))}fe.schemaProperties=f$;function h$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,d){const l=d?(0,Ne._)`${e}, ${t}, ${n}${s}`:t,f=[[Ut.default.instancePath,(0,Ne.strConcat)(Ut.default.instancePath,o)],[Ut.default.parentData,i.parentData],[Ut.default.parentDataProperty,i.parentDataProperty],[Ut.default.rootData,Ut.default.rootData]];i.opts.dynamicRef&&f.push([Ut.default.dynamicAnchors,Ut.default.dynamicAnchors]);const y=(0,Ne._)`${l}, ${r.object(...f)}`;return c!==Ne.nil?(0,Ne._)`${a}.call(${c}, ${y})`:(0,Ne._)`${a}(${y})`}fe.callValidateCode=h$;const m$=(0,Ne._)`new RegExp`;function p$({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Ne._)`${s.code==="new RegExp"?m$:(0,i$.useFunc)(e,s)}(${r}, ${n})`})}fe.usePattern=p$;function y$(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){const c=t.const("len",(0,Ne._)`${r}.length`);t.forRange("i",0,c,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:za.Type.Num},o),t.if((0,Ne.not)(o),a)})}}fe.validateArray=y$;function g$(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,za.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,d)=>{const l=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},a);t.assign(i,(0,Ne._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,Ne.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}fe.validateUnion=g$;var yc;function $$(){if(yc)return ut;yc=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.validateKeywordUsage=ut.validSchemaType=ut.funcKeywordCode=ut.macroKeywordCode=void 0;const e=ue,t=Pt,r=fe,n=pn;function s(y,m){const{gen:$,keyword:g,schema:_,parentSchema:p,it:S}=y,R=m.macro.call(S.self,_,p,S),T=d($,g,R);S.opts.validateSchema!==!1&&S.self.validateSchema(R,!0);const A=$.name("valid");y.subschema({schema:R,schemaPath:e.nil,errSchemaPath:`${S.errSchemaPath}/${g}`,topSchemaRef:T,compositeRule:!0},A),y.pass(A,()=>y.error(!0))}ut.macroKeywordCode=s;function o(y,m){var $;const{gen:g,keyword:_,schema:p,parentSchema:S,$data:R,it:T}=y;c(T,m);const A=!R&&m.compile?m.compile.call(T.self,p,S,T):m.validate,B=d(g,_,A),Z=g.let("valid");y.block$data(Z,ye),y.ok(($=m.valid)!==null&&$!==void 0?$:Z);function ye(){if(m.errors===!1)G(),m.modifying&&i(y),Q(()=>y.error());else{const J=m.async?$e():we();m.modifying&&i(y),Q(()=>a(y,J))}}function $e(){const J=g.let("ruleErrs",null);return g.try(()=>G((0,e._)`await `),k=>g.assign(Z,!1).if((0,e._)`${k} instanceof ${T.ValidationError}`,()=>g.assign(J,(0,e._)`${k}.errors`),()=>g.throw(k))),J}function we(){const J=(0,e._)`${B}.errors`;return g.assign(J,null),G(e.nil),J}function G(J=m.async?(0,e._)`await `:e.nil){const k=T.opts.passContext?t.default.this:t.default.self,F=!("compile"in m&&!R||m.schema===!1);g.assign(Z,(0,e._)`${J}${(0,r.callValidateCode)(y,B,k,F)}`,m.modifying)}function Q(J){var k;g.if((0,e.not)((k=m.valid)!==null&&k!==void 0?k:Z),J)}}ut.funcKeywordCode=o;function i(y){const{gen:m,data:$,it:g}=y;m.if(g.parentData,()=>m.assign($,(0,e._)`${g.parentData}[${g.parentDataProperty}]`))}function a(y,m){const{gen:$}=y;$.if((0,e._)`Array.isArray(${m})`,()=>{$.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${m} : ${t.default.vErrors}.concat(${m})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,n.extendErrors)(y)},()=>y.error())}function c({schemaEnv:y},m){if(m.async&&!y.$async)throw new Error("async keyword in sync schema")}function d(y,m,$){if($===void 0)throw new Error(`keyword "${m}" failed to compile`);return y.scopeValue("keyword",typeof $=="function"?{ref:$}:{ref:$,code:(0,e.stringify)($)})}function l(y,m,$=!1){return!m.length||m.some(g=>g==="array"?Array.isArray(y):g==="object"?y&&typeof y=="object"&&!Array.isArray(y):typeof y==g||$&&typeof y>"u")}ut.validSchemaType=l;function f({schema:y,opts:m,self:$,errSchemaPath:g},_,p){if(Array.isArray(_.keyword)?!_.keyword.includes(p):_.keyword!==p)throw new Error("ajv implementation error");const S=_.dependencies;if(S!=null&&S.some(R=>!Object.prototype.hasOwnProperty.call(y,R)))throw new Error(`parent schema must have dependencies of ${p}: ${S.join(",")}`);if(_.validateSchema&&!_.validateSchema(y[p])){const T=`keyword "${p}" value is invalid at path "${g}": `+$.errorsText(_.validateSchema.errors);if(m.validateSchema==="log")$.logger.error(T);else throw new Error(T)}}return ut.validateKeywordUsage=f,ut}var At={},gc;function _$(){if(gc)return At;gc=1,Object.defineProperty(At,"__esModule",{value:!0}),At.extendSubschemaMode=At.extendSubschemaData=At.getSubschema=void 0;const e=ue,t=x;function r(o,{keyword:i,schemaProp:a,schema:c,schemaPath:d,errSchemaPath:l,topSchemaRef:f}){if(i!==void 0&&c!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const y=o.schema[i];return a===void 0?{schema:y,schemaPath:(0,e._)`${o.schemaPath}${(0,e.getProperty)(i)}`,errSchemaPath:`${o.errSchemaPath}/${i}`}:{schema:y[a],schemaPath:(0,e._)`${o.schemaPath}${(0,e.getProperty)(i)}${(0,e.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${i}/${(0,t.escapeFragment)(a)}`}}if(c!==void 0){if(d===void 0||l===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:d,topSchemaRef:f,errSchemaPath:l}}throw new Error('either "keyword" or "schema" must be passed')}At.getSubschema=r;function n(o,i,{dataProp:a,dataPropType:c,data:d,dataTypes:l,propertyName:f}){if(d!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:y}=i;if(a!==void 0){const{errorPath:$,dataPathArr:g,opts:_}=i,p=y.let("data",(0,e._)`${i.data}${(0,e.getProperty)(a)}`,!0);m(p),o.errorPath=(0,e.str)`${$}${(0,t.getErrorPath)(a,c,_.jsPropertySyntax)}`,o.parentDataProperty=(0,e._)`${a}`,o.dataPathArr=[...g,o.parentDataProperty]}if(d!==void 0){const $=d instanceof e.Name?d:y.let("data",d,!0);m($),f!==void 0&&(o.propertyName=f)}l&&(o.dataTypes=l);function m($){o.data=$,o.dataLevel=i.dataLevel+1,o.dataTypes=[],i.definedProperties=new Set,o.parentData=i.data,o.dataNames=[...i.dataNames,$]}}At.extendSubschemaData=n;function s(o,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:c,createErrors:d,allErrors:l}){c!==void 0&&(o.compositeRule=c),d!==void 0&&(o.createErrors=d),l!==void 0&&(o.allErrors=l),o.jtdDiscriminator=i,o.jtdMetadata=a}return At.extendSubschemaMode=s,At}var ze={},mu={exports:{}},Yt=mu.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(){};Bn(t,n,s,e,"",e)};Yt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Yt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Yt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Yt.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 Bn(e,t,r,n,s,o,i,a,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,a,c,d);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in Yt.arrayKeywords)for(var y=0;yt+=pu(n)),t===1/0))return 1/0}return t}function yu(e,t="",r){r!==!1&&(t=Rr(t));const n=e.parse(t);return gu(e,n)}ze.getFullPath=yu;function gu(e,t){return e.serialize(t).split("#")[0]+"#"}ze._getFullPath=gu;const O$=/#\/?$/;function Rr(e){return e?e.replace(O$,""):""}ze.normalizeId=Rr;function I$(e,t,r){return r=Rr(r),e.resolve(t,r)}ze.resolveUrl=I$;const T$=/^[a-z_][-a-z0-9._]*$/i;function j$(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Rr(e[r]||t),o={"":s},i=yu(n,s,!1),a={},c=new Set;return S$(e,{allKeys:!0},(f,y,m,$)=>{if($===void 0)return;const g=i+y;let _=o[$];typeof f[r]=="string"&&(_=p.call(this,f[r])),S.call(this,f.$anchor),S.call(this,f.$dynamicAnchor),o[y]=_;function p(R){const T=this.opts.uriResolver.resolve;if(R=Rr(_?T(_,R):R),c.has(R))throw l(R);c.add(R);let A=this.refs[R];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?d(f,A.schema,R):R!==Rr(g)&&(R[0]==="#"?(d(f,a[R],R),a[R]=f):this.refs[R]=g),R}function S(R){if(typeof R=="string"){if(!T$.test(R))throw new Error(`invalid anchor "${R}"`);p.call(this,`#${R}`)}}}),a;function d(f,y,m){if(y!==void 0&&!b$(f,y))throw l(m)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}ze.getSchemaRefs=j$;var $c;function Es(){if($c)return jt;$c=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.getData=jt.KeywordCxt=jt.validateFunctionCode=void 0;const e=Kg(),t=ke,r=kt,n=ke,s=a$(),o=$$(),i=_$(),a=ue,c=Pt,d=ze,l=x,f=pn;function y(v){if(A(v)&&(Z(v),T(v))){_(v);return}m(v,()=>(0,e.topBoolOrEmptySchema)(v))}jt.validateFunctionCode=y;function m({gen:v,validateName:b,schema:O,schemaEnv:j,opts:M},V){M.code.es5?v.func(b,(0,a._)`${c.default.data}, ${c.default.valCxt}`,j.$async,()=>{v.code((0,a._)`"use strict"; ${S(O,M)}`),g(v,M),v.code(V)}):v.func(b,(0,a._)`${c.default.data}, ${$(M)}`,j.$async,()=>v.code(S(O,M)).code(V))}function $(v){return(0,a._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${v.dynamicRef?(0,a._)`, ${c.default.dynamicAnchors}={}`:a.nil}}={}`}function g(v,b){v.if(c.default.valCxt,()=>{v.var(c.default.instancePath,(0,a._)`${c.default.valCxt}.${c.default.instancePath}`),v.var(c.default.parentData,(0,a._)`${c.default.valCxt}.${c.default.parentData}`),v.var(c.default.parentDataProperty,(0,a._)`${c.default.valCxt}.${c.default.parentDataProperty}`),v.var(c.default.rootData,(0,a._)`${c.default.valCxt}.${c.default.rootData}`),b.dynamicRef&&v.var(c.default.dynamicAnchors,(0,a._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{v.var(c.default.instancePath,(0,a._)`""`),v.var(c.default.parentData,(0,a._)`undefined`),v.var(c.default.parentDataProperty,(0,a._)`undefined`),v.var(c.default.rootData,c.default.data),b.dynamicRef&&v.var(c.default.dynamicAnchors,(0,a._)`{}`)})}function _(v){const{schema:b,opts:O,gen:j}=v;m(v,()=>{O.$comment&&b.$comment&&J(v),we(v),j.let(c.default.vErrors,null),j.let(c.default.errors,0),O.unevaluated&&p(v),ye(v),k(v)})}function p(v){const{gen:b,validateName:O}=v;v.evaluated=b.const("evaluated",(0,a._)`${O}.evaluated`),b.if((0,a._)`${v.evaluated}.dynamicProps`,()=>b.assign((0,a._)`${v.evaluated}.props`,(0,a._)`undefined`)),b.if((0,a._)`${v.evaluated}.dynamicItems`,()=>b.assign((0,a._)`${v.evaluated}.items`,(0,a._)`undefined`))}function S(v,b){const O=typeof v=="object"&&v[b.schemaId];return O&&(b.code.source||b.code.process)?(0,a._)`/*# sourceURL=${O} */`:a.nil}function R(v,b){if(A(v)&&(Z(v),T(v))){B(v,b);return}(0,e.boolOrEmptySchema)(v,b)}function T({schema:v,self:b}){if(typeof v=="boolean")return!v;for(const O in v)if(b.RULES.all[O])return!0;return!1}function A(v){return typeof v.schema!="boolean"}function B(v,b){const{schema:O,gen:j,opts:M}=v;M.$comment&&O.$comment&&J(v),G(v),Q(v);const V=j.const("_errs",c.default.errors);ye(v,V),j.var(b,(0,a._)`${V} === ${c.default.errors}`)}function Z(v){(0,l.checkUnknownRules)(v),$e(v)}function ye(v,b){if(v.opts.jtd)return H(v,[],!1,b);const O=(0,t.getSchemaTypes)(v.schema),j=(0,t.coerceAndCheckDataType)(v,O);H(v,O,!j,b)}function $e(v){const{schema:b,errSchemaPath:O,opts:j,self:M}=v;b.$ref&&j.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(b,M.RULES)&&M.logger.warn(`$ref: keywords ignored in schema at path "${O}"`)}function we(v){const{schema:b,opts:O}=v;b.default!==void 0&&O.useDefaults&&O.strictSchema&&(0,l.checkStrictMode)(v,"default is ignored in the schema root")}function G(v){const b=v.schema[v.opts.schemaId];b&&(v.baseId=(0,d.resolveUrl)(v.opts.uriResolver,v.baseId,b))}function Q(v){if(v.schema.$async&&!v.schemaEnv.$async)throw new Error("async schema in sync schema")}function J({gen:v,schemaEnv:b,schema:O,errSchemaPath:j,opts:M}){const V=O.$comment;if(M.$comment===!0)v.code((0,a._)`${c.default.self}.logger.log(${V})`);else if(typeof M.$comment=="function"){const me=(0,a.str)`${j}/$comment`,Oe=v.scopeValue("root",{ref:b.root});v.code((0,a._)`${c.default.self}.opts.$comment(${V}, ${me}, ${Oe}.schema)`)}}function k(v){const{gen:b,schemaEnv:O,validateName:j,ValidationError:M,opts:V}=v;O.$async?b.if((0,a._)`${c.default.errors} === 0`,()=>b.return(c.default.data),()=>b.throw((0,a._)`new ${M}(${c.default.vErrors})`)):(b.assign((0,a._)`${j}.errors`,c.default.vErrors),V.unevaluated&&F(v),b.return((0,a._)`${c.default.errors} === 0`))}function F({gen:v,evaluated:b,props:O,items:j}){O instanceof a.Name&&v.assign((0,a._)`${b}.props`,O),j instanceof a.Name&&v.assign((0,a._)`${b}.items`,j)}function H(v,b,O,j){const{gen:M,schema:V,data:me,allErrors:Oe,opts:_e,self:ve}=v,{RULES:pe}=ve;if(V.$ref&&(_e.ignoreKeywordsWithRef||!(0,l.schemaHasRulesButRef)(V,pe))){M.block(()=>C(v,"$ref",pe.all.$ref.definition));return}_e.jtd||ee(v,b),M.block(()=>{for(const Se of pe.rules)Ze(Se);Ze(pe.post)});function Ze(Se){(0,r.shouldUseGroup)(V,Se)&&(Se.type?(M.if((0,n.checkDataType)(Se.type,me,_e.strictNumbers)),U(v,Se),b.length===1&&b[0]===Se.type&&O&&(M.else(),(0,n.reportTypeError)(v)),M.endIf()):U(v,Se),Oe||M.if((0,a._)`${c.default.errors} === ${j||0}`))}}function U(v,b){const{gen:O,schema:j,opts:{useDefaults:M}}=v;M&&(0,s.assignDefaults)(v,b.type),O.block(()=>{for(const V of b.rules)(0,r.shouldUseRule)(j,V)&&C(v,V.keyword,V.definition,b.type)})}function ee(v,b){v.schemaEnv.meta||!v.opts.strictTypes||(K(v,b),v.opts.allowUnionTypes||I(v,b),w(v,v.dataTypes))}function K(v,b){if(b.length){if(!v.dataTypes.length){v.dataTypes=b;return}b.forEach(O=>{E(v.dataTypes,O)||h(v,`type "${O}" not allowed by context "${v.dataTypes.join(",")}"`)}),u(v,b)}}function I(v,b){b.length>1&&!(b.length===2&&b.includes("null"))&&h(v,"use allowUnionTypes to allow union type keyword")}function w(v,b){const O=v.self.RULES.all;for(const j in O){const M=O[j];if(typeof M=="object"&&(0,r.shouldUseRule)(v.schema,M)){const{type:V}=M.definition;V.length&&!V.some(me=>N(b,me))&&h(v,`missing type "${V.join(",")}" for keyword "${j}"`)}}}function N(v,b){return v.includes(b)||b==="number"&&v.includes("integer")}function E(v,b){return v.includes(b)||b==="integer"&&v.includes("number")}function u(v,b){const O=[];for(const j of v.dataTypes)E(b,j)?O.push(j):b.includes("integer")&&j==="number"&&O.push("integer");v.dataTypes=O}function h(v,b){const O=v.schemaEnv.baseId+v.errSchemaPath;b+=` at "${O}" (strictTypes)`,(0,l.checkStrictMode)(v,b,v.opts.strictTypes)}class P{constructor(b,O,j){if((0,o.validateKeywordUsage)(b,O,j),this.gen=b.gen,this.allErrors=b.allErrors,this.keyword=j,this.data=b.data,this.schema=b.schema[j],this.$data=O.$data&&b.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(b,this.schema,j,this.$data),this.schemaType=O.schemaType,this.parentSchema=b.schema,this.params={},this.it=b,this.def=O,this.$data)this.schemaCode=b.gen.const("vSchema",W(this.$data,b));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,O.schemaType,O.allowUndefined))throw new Error(`${j} value must be ${JSON.stringify(O.schemaType)}`);("code"in O?O.trackErrors:O.errors!==!1)&&(this.errsCount=b.gen.const("_errs",c.default.errors))}result(b,O,j){this.failResult((0,a.not)(b),O,j)}failResult(b,O,j){this.gen.if(b),j?j():this.error(),O?(this.gen.else(),O(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(b,O){this.failResult((0,a.not)(b),void 0,O)}fail(b){if(b===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(b),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(b){if(!this.$data)return this.fail(b);const{schemaCode:O}=this;this.fail((0,a._)`${O} !== undefined && (${(0,a.or)(this.invalid$data(),b)})`)}error(b,O,j){if(O){this.setParams(O),this._error(b,j),this.setParams({});return}this._error(b,j)}_error(b,O){(b?f.reportExtraError:f.reportError)(this,this.def.error,O)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(b){this.allErrors||this.gen.if(b)}setParams(b,O){O?Object.assign(this.params,b):this.params=b}block$data(b,O,j=a.nil){this.gen.block(()=>{this.check$data(b,j),O()})}check$data(b=a.nil,O=a.nil){if(!this.$data)return;const{gen:j,schemaCode:M,schemaType:V,def:me}=this;j.if((0,a.or)((0,a._)`${M} === undefined`,O)),b!==a.nil&&j.assign(b,!0),(V.length||me.validateSchema)&&(j.elseIf(this.invalid$data()),this.$dataError(),b!==a.nil&&j.assign(b,!1)),j.else()}invalid$data(){const{gen:b,schemaCode:O,schemaType:j,def:M,it:V}=this;return(0,a.or)(me(),Oe());function me(){if(j.length){if(!(O instanceof a.Name))throw new Error("ajv implementation error");const _e=Array.isArray(j)?j:[j];return(0,a._)`${(0,n.checkDataTypes)(_e,O,V.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function Oe(){if(M.validateSchema){const _e=b.scopeValue("validate$data",{ref:M.validateSchema});return(0,a._)`!${_e}(${O})`}return a.nil}}subschema(b,O){const j=(0,i.getSubschema)(this.it,b);(0,i.extendSubschemaData)(j,this.it,b),(0,i.extendSubschemaMode)(j,b);const M={...this.it,...j,items:void 0,props:void 0};return R(M,O),M}mergeEvaluated(b,O){const{it:j,gen:M}=this;j.opts.unevaluated&&(j.props!==!0&&b.props!==void 0&&(j.props=l.mergeEvaluated.props(M,b.props,j.props,O)),j.items!==!0&&b.items!==void 0&&(j.items=l.mergeEvaluated.items(M,b.items,j.items,O)))}mergeValidEvaluated(b,O){const{it:j,gen:M}=this;if(j.opts.unevaluated&&(j.props!==!0||j.items!==!0))return M.if(O,()=>this.mergeEvaluated(b,a.Name)),!0}}jt.KeywordCxt=P;function C(v,b,O,j){const M=new P(v,O,b);"code"in O?O.code(M,j):M.$data&&O.validate?(0,o.funcKeywordCode)(M,O):"macro"in O?(0,o.macroKeywordCode)(M,O):(O.compile||O.validate)&&(0,o.funcKeywordCode)(M,O)}const D=/^\/(?:[^~]|~0|~1)*$/,X=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W(v,{dataLevel:b,dataNames:O,dataPathArr:j}){let M,V;if(v==="")return c.default.rootData;if(v[0]==="/"){if(!D.test(v))throw new Error(`Invalid JSON-pointer: ${v}`);M=v,V=c.default.rootData}else{const ve=X.exec(v);if(!ve)throw new Error(`Invalid JSON-pointer: ${v}`);const pe=+ve[1];if(M=ve[2],M==="#"){if(pe>=b)throw new Error(_e("property/index",pe));return j[b-pe]}if(pe>b)throw new Error(_e("data",pe));if(V=O[b-pe],!M)return V}let me=V;const Oe=M.split("/");for(const ve of Oe)ve&&(V=(0,a._)`${V}${(0,a.getProperty)((0,l.unescapeJsonPointer)(ve))}`,me=(0,a._)`${me} && ${V}`);return me;function _e(ve,pe){return`Cannot access ${ve} ${pe} levels up, current level is ${b}`}}return jt.getData=W,jt}var yn={};Object.defineProperty(yn,"__esModule",{value:!0});class A$ extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}yn.default=A$;var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});const Gs=ze;class k$ extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Gs.resolveUrl)(t,r,n),this.missingSchema=(0,Gs.normalizeId)((0,Gs.getFullPath)(t,this.missingRef))}}Fr.default=k$;var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.resolveSchema=Xe.getCompilingSchema=Xe.resolveRef=Xe.compileSchema=Xe.SchemaEnv=void 0;const dt=ue,C$=yn,nr=Pt,$t=ze,_c=x,M$=Es();class bs{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,$t.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={}}}Xe.SchemaEnv=bs;function qa(e){const t=$u.call(this,e);if(t)return t;const r=(0,$t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new dt.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let a;e.$async&&(a=i.scopeValue("Error",{ref:C$.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const d={gen:i,allErrors:this.opts.allErrors,data:nr.default.data,parentData:nr.default.parentData,parentDataProperty:nr.default.parentDataProperty,dataNames:[nr.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,dt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:dt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this};let l;try{this._compilations.add(e),(0,M$.validateFunctionCode)(d),i.optimize(this.opts.code.optimize);const f=i.toString();l=`${i.scopeRefs(nr.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,e));const m=new Function(`${nr.default.self}`,`${nr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:$,items:g}=d;m.evaluated={props:$ instanceof dt.Name?void 0:$,items:g instanceof dt.Name?void 0:g,dynamicProps:$ instanceof dt.Name,dynamicItems:g instanceof dt.Name},m.source&&(m.source.evaluated=(0,dt.stringify)(m.evaluated))}return e.validate=m,e}catch(f){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),f}finally{this._compilations.delete(e)}}Xe.compileSchema=qa;function D$(e,t,r){var n;r=(0,$t.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=z$.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new bs({schema:i,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=F$.call(this,o)}Xe.resolveRef=D$;function F$(e){return(0,$t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:qa.call(this,e)}function $u(e){for(const t of this._compilations)if(L$(t,e))return t}Xe.getCompilingSchema=$u;function L$(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function z$(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ss.call(this,e,t)}function Ss(e,t){const r=this.opts.uriResolver.parse(t),n=(0,$t._getFullPath)(this.opts.uriResolver,r);let s=(0,$t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Ks.call(this,r,e);const o=(0,$t.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const a=Ss.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:Ks.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||qa.call(this,i),o===(0,$t.normalizeId)(t)){const{schema:a}=i,{schemaId:c}=this.opts,d=a[c];return d&&(s=(0,$t.resolveUrl)(this.opts.uriResolver,s,d)),new bs({schema:a,schemaId:c,root:e,baseId:s})}return Ks.call(this,r,i)}}Xe.resolveSchema=Ss;const V$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ks(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,_c.unescapeFragment)(a)];if(c===void 0)return;r=c;const d=typeof r=="object"&&r[this.opts.schemaId];!V$.has(a)&&d&&(t=(0,$t.resolveUrl)(this.opts.uriResolver,t,d))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,_c.schemaHasRulesButRef)(r,this.RULES)){const a=(0,$t.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Ss.call(this,n,a)}const{schemaId:i}=this.opts;if(o=o||new bs({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const U$="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",q$="Meta-schema for $data reference (JSON AnySchema extension proposal)",G$="object",K$=["$data"],H$={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},W$=!1,x$={$id:U$,description:q$,type:G$,required:K$,properties:H$,additionalProperties:W$};var Ga={};Object.defineProperty(Ga,"__esModule",{value:!0});const _u=ql;_u.code='require("ajv/dist/runtime/uri").default';Ga.default=_u;(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=Es();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ue;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=yn,s=Fr,o=mr,i=Xe,a=ue,c=ze,d=ke,l=x,f=x$,y=Ga,m=(I,w)=>new RegExp(I,w);m.code="new RegExp";const $=["removeAdditional","useDefaults","coerceTypes"],g=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."},p={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function R(I){var w,N,E,u,h,P,C,D,X,W,v,b,O,j,M,V,me,Oe,_e,ve,pe,Ze,Se,Jt,Xt;const it=I.strict,Zt=(w=I.code)===null||w===void 0?void 0:w.optimize,Ur=Zt===!0||Zt===void 0?1:Zt||0,qr=(E=(N=I.code)===null||N===void 0?void 0:N.regExp)!==null&&E!==void 0?E:m,ks=(u=I.uriResolver)!==null&&u!==void 0?u:y.default;return{strictSchema:(P=(h=I.strictSchema)!==null&&h!==void 0?h:it)!==null&&P!==void 0?P:!0,strictNumbers:(D=(C=I.strictNumbers)!==null&&C!==void 0?C:it)!==null&&D!==void 0?D:!0,strictTypes:(W=(X=I.strictTypes)!==null&&X!==void 0?X:it)!==null&&W!==void 0?W:"log",strictTuples:(b=(v=I.strictTuples)!==null&&v!==void 0?v:it)!==null&&b!==void 0?b:"log",strictRequired:(j=(O=I.strictRequired)!==null&&O!==void 0?O:it)!==null&&j!==void 0?j:!1,code:I.code?{...I.code,optimize:Ur,regExp:qr}:{optimize:Ur,regExp:qr},loopRequired:(M=I.loopRequired)!==null&&M!==void 0?M:S,loopEnum:(V=I.loopEnum)!==null&&V!==void 0?V:S,meta:(me=I.meta)!==null&&me!==void 0?me:!0,messages:(Oe=I.messages)!==null&&Oe!==void 0?Oe:!0,inlineRefs:(_e=I.inlineRefs)!==null&&_e!==void 0?_e:!0,schemaId:(ve=I.schemaId)!==null&&ve!==void 0?ve:"$id",addUsedSchema:(pe=I.addUsedSchema)!==null&&pe!==void 0?pe:!0,validateSchema:(Ze=I.validateSchema)!==null&&Ze!==void 0?Ze:!0,validateFormats:(Se=I.validateFormats)!==null&&Se!==void 0?Se:!0,unicodeRegExp:(Jt=I.unicodeRegExp)!==null&&Jt!==void 0?Jt:!0,int32range:(Xt=I.int32range)!==null&&Xt!==void 0?Xt:!0,uriResolver:ks}}class T{constructor(w={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,w=this.opts={...w,...R(w)};const{es5:N,lines:E}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:N,lines:E}),this.logger=Q(w.logger);const u=w.validateFormats;w.validateFormats=!1,this.RULES=(0,o.getRules)(),A.call(this,_,w,"NOT SUPPORTED"),A.call(this,p,w,"DEPRECATED","warn"),this._metaOpts=we.call(this),w.formats&&ye.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),w.keywords&&$e.call(this,w.keywords),typeof w.meta=="object"&&this.addMetaSchema(w.meta),Z.call(this),w.validateFormats=u}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:w,meta:N,schemaId:E}=this.opts;let u=f;E==="id"&&(u={...f},u.id=u.$id,delete u.$id),N&&w&&this.addMetaSchema(u,u[E],!1)}defaultMeta(){const{meta:w,schemaId:N}=this.opts;return this.opts.defaultMeta=typeof w=="object"?w[N]||w:void 0}validate(w,N){let E;if(typeof w=="string"){if(E=this.getSchema(w),!E)throw new Error(`no schema with key or ref "${w}"`)}else E=this.compile(w);const u=E(N);return"$async"in E||(this.errors=E.errors),u}compile(w,N){const E=this._addSchema(w,N);return E.validate||this._compileSchemaEnv(E)}compileAsync(w,N){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:E}=this.opts;return u.call(this,w,N);async function u(W,v){await h.call(this,W.$schema);const b=this._addSchema(W,v);return b.validate||P.call(this,b)}async function h(W){W&&!this.getSchema(W)&&await u.call(this,{$ref:W},!0)}async function P(W){try{return this._compileSchemaEnv(W)}catch(v){if(!(v instanceof s.default))throw v;return C.call(this,v),await D.call(this,v.missingSchema),P.call(this,W)}}function C({missingSchema:W,missingRef:v}){if(this.refs[W])throw new Error(`AnySchema ${W} is loaded but ${v} cannot be resolved`)}async function D(W){const v=await X.call(this,W);this.refs[W]||await h.call(this,v.$schema),this.refs[W]||this.addSchema(v,W,N)}async function X(W){const v=this._loading[W];if(v)return v;try{return await(this._loading[W]=E(W))}finally{delete this._loading[W]}}}addSchema(w,N,E,u=this.opts.validateSchema){if(Array.isArray(w)){for(const P of w)this.addSchema(P,void 0,E,u);return this}let h;if(typeof w=="object"){const{schemaId:P}=this.opts;if(h=w[P],h!==void 0&&typeof h!="string")throw new Error(`schema ${P} must be string`)}return N=(0,c.normalizeId)(N||h),this._checkUnique(N),this.schemas[N]=this._addSchema(w,E,N,u,!0),this}addMetaSchema(w,N,E=this.opts.validateSchema){return this.addSchema(w,N,!0,E),this}validateSchema(w,N){if(typeof w=="boolean")return!0;let E;if(E=w.$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 u=this.validate(E,w);if(!u&&N){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return u}getSchema(w){let N;for(;typeof(N=B.call(this,w))=="string";)w=N;if(N===void 0){const{schemaId:E}=this.opts,u=new i.SchemaEnv({schema:{},schemaId:E});if(N=i.resolveSchema.call(this,u,w),!N)return;this.refs[w]=N}return N.validate||this._compileSchemaEnv(N)}removeSchema(w){if(w instanceof RegExp)return this._removeAllSchemas(this.schemas,w),this._removeAllSchemas(this.refs,w),this;switch(typeof w){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const N=B.call(this,w);return typeof N=="object"&&this._cache.delete(N.schema),delete this.schemas[w],delete this.refs[w],this}case"object":{const N=w;this._cache.delete(N);let E=w[this.opts.schemaId];return E&&(E=(0,c.normalizeId)(E),delete this.schemas[E],delete this.refs[E]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(w){for(const N of w)this.addKeyword(N);return this}addKeyword(w,N){let E;if(typeof w=="string")E=w,typeof N=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),N.keyword=E);else if(typeof w=="object"&&N===void 0){if(N=w,E=N.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(k.call(this,E,N),!N)return(0,l.eachItem)(E,h=>F.call(this,h)),this;U.call(this,N);const u={...N,type:(0,d.getJSONTypes)(N.type),schemaType:(0,d.getJSONTypes)(N.schemaType)};return(0,l.eachItem)(E,u.type.length===0?h=>F.call(this,h,u):h=>u.type.forEach(P=>F.call(this,h,u,P))),this}getKeyword(w){const N=this.RULES.all[w];return typeof N=="object"?N.definition:!!N}removeKeyword(w){const{RULES:N}=this;delete N.keywords[w],delete N.all[w];for(const E of N.rules){const u=E.rules.findIndex(h=>h.keyword===w);u>=0&&E.rules.splice(u,1)}return this}addFormat(w,N){return typeof N=="string"&&(N=new RegExp(N)),this.formats[w]=N,this}errorsText(w=this.errors,{separator:N=", ",dataVar:E="data"}={}){return!w||w.length===0?"No errors":w.map(u=>`${E}${u.instancePath} ${u.message}`).reduce((u,h)=>u+N+h)}$dataMetaSchema(w,N){const E=this.RULES.all;w=JSON.parse(JSON.stringify(w));for(const u of N){const h=u.split("/").slice(1);let P=w;for(const C of h)P=P[C];for(const C in E){const D=E[C];if(typeof D!="object")continue;const{$data:X}=D.definition,W=P[C];X&&W&&(P[C]=K(W))}}return w}_removeAllSchemas(w,N){for(const E in w){const u=w[E];(!N||N.test(E))&&(typeof u=="string"?delete w[E]:u&&!u.meta&&(this._cache.delete(u.schema),delete w[E]))}}_addSchema(w,N,E,u=this.opts.validateSchema,h=this.opts.addUsedSchema){let P;const{schemaId:C}=this.opts;if(typeof w=="object")P=w[C];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof w!="boolean")throw new Error("schema must be object or boolean")}let D=this._cache.get(w);if(D!==void 0)return D;E=(0,c.normalizeId)(P||E);const X=c.getSchemaRefs.call(this,w,E);return D=new i.SchemaEnv({schema:w,schemaId:C,meta:N,baseId:E,localRefs:X}),this._cache.set(D.schema,D),h&&!E.startsWith("#")&&(E&&this._checkUnique(E),this.refs[E]=D),u&&this.validateSchema(w,!0),D}_checkUnique(w){if(this.schemas[w]||this.refs[w])throw new Error(`schema with key or id "${w}" already exists`)}_compileSchemaEnv(w){if(w.meta?this._compileMetaSchema(w):i.compileSchema.call(this,w),!w.validate)throw new Error("ajv implementation error");return w.validate}_compileMetaSchema(w){const N=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,w)}finally{this.opts=N}}}T.ValidationError=n.default,T.MissingRefError=s.default,e.default=T;function A(I,w,N,E="error"){for(const u in I){const h=u;h in w&&this.logger[E](`${N}: option ${u}. ${I[h]}`)}}function B(I){return I=(0,c.normalizeId)(I),this.schemas[I]||this.refs[I]}function Z(){const I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(const w in I)this.addSchema(I[w],w)}function ye(){for(const I in this.opts.formats){const w=this.opts.formats[I];w&&this.addFormat(I,w)}}function $e(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const w in I){const N=I[w];N.keyword||(N.keyword=w),this.addKeyword(N)}}function we(){const I={...this.opts};for(const w of $)delete I[w];return I}const G={log(){},warn(){},error(){}};function Q(I){if(I===!1)return G;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}const J=/^[a-z_$][a-z0-9_$:-]*$/i;function k(I,w){const{RULES:N}=this;if((0,l.eachItem)(I,E=>{if(N.keywords[E])throw new Error(`Keyword ${E} is already defined`);if(!J.test(E))throw new Error(`Keyword ${E} has invalid name`)}),!!w&&w.$data&&!("code"in w||"validate"in w))throw new Error('$data keyword must have "code" or "validate" function')}function F(I,w,N){var E;const u=w==null?void 0:w.post;if(N&&u)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let P=u?h.post:h.rules.find(({type:D})=>D===N);if(P||(P={type:N,rules:[]},h.rules.push(P)),h.keywords[I]=!0,!w)return;const C={keyword:I,definition:{...w,type:(0,d.getJSONTypes)(w.type),schemaType:(0,d.getJSONTypes)(w.schemaType)}};w.before?H.call(this,P,C,w.before):P.rules.push(C),h.all[I]=C,(E=w.implements)===null||E===void 0||E.forEach(D=>this.addKeyword(D))}function H(I,w,N){const E=I.rules.findIndex(u=>u.keyword===N);E>=0?I.rules.splice(E,0,w):(I.rules.push(w),this.logger.warn(`rule ${N} is not defined`))}function U(I){let{metaSchema:w}=I;w!==void 0&&(I.$data&&this.opts.$data&&(w=K(w)),I.validateSchema=this.compile(w,!0))}const ee={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function K(I){return{anyOf:[I,ee]}}})(tu);var Ka={},Ha={},Wa={};Object.defineProperty(Wa,"__esModule",{value:!0});const B$={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Wa.default=B$;var pr={};Object.defineProperty(pr,"__esModule",{value:!0});pr.callRef=pr.getValidate=void 0;const Y$=Fr,vc=fe,Ye=ue,$r=Pt,wc=Xe,On=x,J$={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:d}=o;if((r==="#"||r==="#/")&&s===d.baseId)return f();const l=wc.resolveRef.call(c,d,s,r);if(l===void 0)throw new Y$.default(n.opts.uriResolver,s,r);if(l instanceof wc.SchemaEnv)return y(l);return m(l);function f(){if(o===d)return Yn(e,i,o,o.$async);const $=t.scopeValue("root",{ref:d});return Yn(e,(0,Ye._)`${$}.validate`,d,d.$async)}function y($){const g=vu(e,$);Yn(e,g,$,$.$async)}function m($){const g=t.scopeValue("schema",a.code.source===!0?{ref:$,code:(0,Ye.stringify)($)}:{ref:$}),_=t.name("valid"),p=e.subschema({schema:$,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(p),e.ok(_)}}};function vu(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:t})}.validate`}pr.getValidate=vu;function Yn(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,d=c.passContext?$r.default.this:Ye.nil;n?l():f();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");const $=s.let("valid");s.try(()=>{s.code((0,Ye._)`await ${(0,vc.callValidateCode)(e,t,d)}`),m(t),i||s.assign($,!0)},g=>{s.if((0,Ye._)`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),y(g),i||s.assign($,!1)}),e.ok($)}function f(){e.result((0,vc.callValidateCode)(e,t,d),()=>m(t),()=>y(t))}function y($){const g=(0,Ye._)`${$}.errors`;s.assign($r.default.vErrors,(0,Ye._)`${$r.default.vErrors} === null ? ${g} : ${$r.default.vErrors}.concat(${g})`),s.assign($r.default.errors,(0,Ye._)`${$r.default.vErrors}.length`)}function m($){var g;if(!o.opts.unevaluated)return;const _=(g=r==null?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(o.props=On.mergeEvaluated.props(s,_.props,o.props));else{const p=s.var("props",(0,Ye._)`${$}.evaluated.props`);o.props=On.mergeEvaluated.props(s,p,o.props,Ye.Name)}if(o.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(o.items=On.mergeEvaluated.items(s,_.items,o.items));else{const p=s.var("items",(0,Ye._)`${$}.evaluated.items`);o.items=On.mergeEvaluated.items(s,p,o.items,Ye.Name)}}}pr.callRef=Yn;pr.default=J$;Object.defineProperty(Ha,"__esModule",{value:!0});const X$=Wa,Z$=pr,Q$=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",X$.default,Z$.default];Ha.default=Q$;var xa={},Ba={};Object.defineProperty(Ba,"__esModule",{value:!0});const is=ue,qt=is.operators,cs={maximum:{okStr:"<=",ok:qt.LTE,fail:qt.GT},minimum:{okStr:">=",ok:qt.GTE,fail:qt.LT},exclusiveMaximum:{okStr:"<",ok:qt.LT,fail:qt.GTE},exclusiveMinimum:{okStr:">",ok:qt.GT,fail:qt.LTE}},e_={message:({keyword:e,schemaCode:t})=>(0,is.str)`must be ${cs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,is._)`{comparison: ${cs[e].okStr}, limit: ${t}}`},t_={keyword:Object.keys(cs),type:"number",schemaType:"number",$data:!0,error:e_,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,is._)`${r} ${cs[t].fail} ${n} || isNaN(${r})`)}};Ba.default=t_;var Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});const nn=ue,r_={message:({schemaCode:e})=>(0,nn.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,nn._)`{multipleOf: ${e}}`},n_={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r_,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?(0,nn._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,nn._)`${i} !== parseInt(${i})`;e.fail$data((0,nn._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ya.default=n_;var Ja={},Xa={};Object.defineProperty(Xa,"__esModule",{value:!0});function wu(e){const t=e.length;let r=0,n=0,s;for(;n=55296&&s<=56319&&n(0,ir._)`{limit: ${e}}`},i_={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:a_,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?ir.operators.GT:ir.operators.LT,i=s.opts.unicode===!1?(0,ir._)`${r}.length`:(0,ir._)`${(0,s_.useFunc)(e.gen,o_.default)}(${r})`;e.fail$data((0,ir._)`${i} ${o} ${n}`)}};Ja.default=i_;var Za={};Object.defineProperty(Za,"__esModule",{value:!0});const c_=fe,ls=ue,l_={message:({schemaCode:e})=>(0,ls.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ls._)`{pattern: ${e}}`},u_={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:l_,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",a=r?(0,ls._)`(new RegExp(${s}, ${i}))`:(0,c_.usePattern)(e,n);e.fail$data((0,ls._)`!${a}.test(${t})`)}};Za.default=u_;var Qa={};Object.defineProperty(Qa,"__esModule",{value:!0});const sn=ue,d_={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,sn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,sn._)`{limit: ${e}}`},f_={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:d_,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?sn.operators.GT:sn.operators.LT;e.fail$data((0,sn._)`Object.keys(${r}).length ${s} ${n}`)}};Qa.default=f_;var ei={};Object.defineProperty(ei,"__esModule",{value:!0});const xr=fe,on=ue,h_=x,m_={message:({params:{missingProperty:e}})=>(0,on.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,on._)`{missingProperty: ${e}}`},p_={keyword:"required",type:"object",schemaType:"array",$data:!0,error:m_,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&r.length===0)return;const c=r.length>=a.loopRequired;if(i.allErrors?d():l(),a.strictRequired){const m=e.parentSchema.properties,{definedProperties:$}=e.it;for(const g of r)if((m==null?void 0:m[g])===void 0&&!$.has(g)){const _=i.schemaEnv.baseId+i.errSchemaPath,p=`required property "${g}" is not defined at "${_}" (strictRequired)`;(0,h_.checkStrictMode)(i,p,i.opts.strictRequired)}}function d(){if(c||o)e.block$data(on.nil,f);else for(const m of r)(0,xr.checkReportMissingProp)(e,m)}function l(){const m=t.let("missing");if(c||o){const $=t.let("valid",!0);e.block$data($,()=>y(m,$)),e.ok($)}else t.if((0,xr.checkMissingProp)(e,r,m)),(0,xr.reportMissingProp)(e,m),t.else()}function f(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,xr.noPropertyInData)(t,s,m,a.ownProperties),()=>e.error())})}function y(m,$){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign($,(0,xr.propertyInData)(t,s,m,a.ownProperties)),t.if((0,on.not)($),()=>{e.error(),t.break()})},on.nil)}}};ei.default=p_;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const an=ue,y_={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,an.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,an._)`{limit: ${e}}`},g_={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:y_,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?an.operators.GT:an.operators.LT;e.fail$data((0,an._)`${r}.length ${s} ${n}`)}};ti.default=g_;var ri={},gn={};Object.defineProperty(gn,"__esModule",{value:!0});const Eu=ms;Eu.code='require("ajv/dist/runtime/equal").default';gn.default=Eu;Object.defineProperty(ri,"__esModule",{value:!0});const Hs=ke,Fe=ue,$_=x,__=gn,v_={message:({params:{i:e,j:t}})=>(0,Fe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Fe._)`{i: ${e}, j: ${t}}`},w_={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:v_,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!n&&!s)return;const c=t.let("valid"),d=o.items?(0,Hs.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Fe._)`${i} === false`),e.ok(c);function l(){const $=t.let("i",(0,Fe._)`${r}.length`),g=t.let("j");e.setParams({i:$,j:g}),t.assign(c,!0),t.if((0,Fe._)`${$} > 1`,()=>(f()?y:m)($,g))}function f(){return d.length>0&&!d.some($=>$==="object"||$==="array")}function y($,g){const _=t.name("item"),p=(0,Hs.checkDataTypes)(d,_,a.opts.strictNumbers,Hs.DataType.Wrong),S=t.const("indices",(0,Fe._)`{}`);t.for((0,Fe._)`;${$}--;`,()=>{t.let(_,(0,Fe._)`${r}[${$}]`),t.if(p,(0,Fe._)`continue`),d.length>1&&t.if((0,Fe._)`typeof ${_} == "string"`,(0,Fe._)`${_} += "_"`),t.if((0,Fe._)`typeof ${S}[${_}] == "number"`,()=>{t.assign(g,(0,Fe._)`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Fe._)`${S}[${_}] = ${$}`)})}function m($,g){const _=(0,$_.useFunc)(t,__.default),p=t.name("outer");t.label(p).for((0,Fe._)`;${$}--;`,()=>t.for((0,Fe._)`${g} = ${$}; ${g}--;`,()=>t.if((0,Fe._)`${_}(${r}[${$}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(p)})))}}};ri.default=w_;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const wo=ue,E_=x,b_=gn,S_={message:"must be equal to constant",params:({schemaCode:e})=>(0,wo._)`{allowedValue: ${e}}`},P_={keyword:"const",$data:!0,error:S_,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,wo._)`!${(0,E_.useFunc)(t,b_.default)}(${r}, ${s})`):e.fail((0,wo._)`${o} !== ${r}`)}};ni.default=P_;var si={};Object.defineProperty(si,"__esModule",{value:!0});const Zr=ue,N_=x,R_=gn,O_={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Zr._)`{allowedValues: ${e}}`},I_={keyword:"enum",schemaType:"array",$data:!0,error:O_,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const a=s.length>=i.opts.loopEnum;let c;const d=()=>c??(c=(0,N_.useFunc)(t,R_.default));let l;if(a||n)l=t.let("valid"),e.block$data(l,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const m=t.const("vSchema",o);l=(0,Zr.or)(...s.map(($,g)=>y(m,g)))}e.pass(l);function f(){t.assign(l,!1),t.forOf("v",o,m=>t.if((0,Zr._)`${d()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function y(m,$){const g=s[$];return typeof g=="object"&&g!==null?(0,Zr._)`${d()}(${r}, ${m}[${$}])`:(0,Zr._)`${r} === ${g}`}}};si.default=I_;Object.defineProperty(xa,"__esModule",{value:!0});const T_=Ba,j_=Ya,A_=Ja,k_=Za,C_=Qa,M_=ei,D_=ti,F_=ri,L_=ni,z_=si,V_=[T_.default,j_.default,A_.default,k_.default,C_.default,M_.default,D_.default,F_.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},L_.default,z_.default];xa.default=V_;var oi={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.validateAdditionalItems=void 0;const cr=ue,Eo=x,U_={message:({params:{len:e}})=>(0,cr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,cr._)`{limit: ${e}}`},q_={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:U_,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Eo.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}bu(e,n)}};function bu(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const a=r.const("len",(0,cr._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,cr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Eo.alwaysValidSchema)(i,n)){const d=r.var("valid",(0,cr._)`${a} <= ${t.length}`);r.if((0,cr.not)(d),()=>c(d)),e.ok(d)}function c(d){r.forRange("i",t.length,a,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:Eo.Type.Num},d),i.allErrors||r.if((0,cr.not)(d),()=>r.break())})}}Lr.validateAdditionalItems=bu;Lr.default=q_;var ai={},zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.validateTuple=void 0;const Ec=ue,Jn=x,G_=fe,K_={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Su(e,"additionalItems",t);r.items=!0,!(0,Jn.alwaysValidSchema)(r,t)&&e.ok((0,G_.validateArray)(e))}};function Su(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:a}=e;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Jn.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),d=n.const("len",(0,Ec._)`${o}.length`);r.forEach((f,y)=>{(0,Jn.alwaysValidSchema)(a,f)||(n.if((0,Ec._)`${d} > ${y}`,()=>e.subschema({keyword:i,schemaProp:y,dataProp:y},c)),e.ok(c))});function l(f){const{opts:y,errSchemaPath:m}=a,$=r.length,g=$===f.minItems&&($===f.maxItems||f[t]===!1);if(y.strictTuples&&!g){const _=`"${i}" is ${$}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Jn.checkStrictMode)(a,_,y.strictTuples)}}}zr.validateTuple=Su;zr.default=K_;Object.defineProperty(ai,"__esModule",{value:!0});const H_=zr,W_={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,H_.validateTuple)(e,"items")};ai.default=W_;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const bc=ue,x_=x,B_=fe,Y_=Lr,J_={message:({params:{len:e}})=>(0,bc.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,bc._)`{limit: ${e}}`},X_={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:J_,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,x_.alwaysValidSchema)(n,t)&&(s?(0,Y_.validateAdditionalItems)(e,s):e.ok((0,B_.validateArray)(e)))}};ii.default=X_;var ci={};Object.defineProperty(ci,"__esModule",{value:!0});const at=ue,In=x,Z_={message:({params:{min:e,max:t}})=>t===void 0?(0,at.str)`must contain at least ${e} valid item(s)`:(0,at.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,at._)`{minContains: ${e}}`:(0,at._)`{minContains: ${e}, maxContains: ${t}}`},Q_={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Z_,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,a;const{minContains:c,maxContains:d}=n;o.opts.next?(i=c===void 0?1:c,a=d):i=1;const l=t.const("len",(0,at._)`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,In.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,In.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,In.alwaysValidSchema)(o,r)){let g=(0,at._)`${l} >= ${i}`;a!==void 0&&(g=(0,at._)`${g} && ${l} <= ${a}`),e.pass(g);return}o.items=!0;const f=t.name("valid");a===void 0&&i===1?m(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,at._)`${s}.length > 0`,y)):(t.let(f,!1),y()),e.result(f,()=>e.reset());function y(){const g=t.name("_valid"),_=t.let("count",0);m(g,()=>t.if(g,()=>$(_)))}function m(g,_){t.forRange("i",0,l,p=>{e.subschema({keyword:"contains",dataProp:p,dataPropType:In.Type.Num,compositeRule:!0},g),_()})}function $(g){t.code((0,at._)`${g}++`),a===void 0?t.if((0,at._)`${g} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,at._)`${g} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,at._)`${g} >= ${i}`,()=>t.assign(f,!0)))}}};ci.default=Q_;var Pu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ue,r=x,n=fe;e.error={message:({params:{property:c,depsCount:d,deps:l}})=>{const f=d===1?"property":"properties";return(0,t.str)`must have ${f} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:d,deps:l,missingProperty:f}})=>(0,t._)`{property: ${c}, + deps: ${u}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[d,u]=o(c);a(c,d),i(c,u)}};function o({schema:c}){const d={},u={};for(const f in c){if(f==="__proto__")continue;const v=Array.isArray(c[f])?d:u;v[f]=c[f]}return[d,u]}function a(c,d=c.schema){const{gen:u,data:f,it:v}=c;if(Object.keys(d).length===0)return;const y=u.let("missing");for(const w in d){const g=d[w];if(g.length===0)continue;const $=(0,n.propertyInData)(u,f,w,v.opts.ownProperties);c.setParams({property:w,depsCount:g.length,deps:g.join(", ")}),v.allErrors?u.if($,()=>{for(const m of g)(0,n.checkReportMissingProp)(c,m)}):(u.if((0,t._)`${$} && (${(0,n.checkMissingProp)(c,g,y)})`),(0,n.reportMissingProp)(c,y),u.else())}}e.validatePropertyDeps=a;function i(c,d=c.schema){const{gen:u,data:f,keyword:v,it:y}=c,w=u.name("valid");for(const g in d)(0,r.alwaysValidSchema)(y,d[g])||(u.if((0,n.propertyInData)(u,f,g,y.opts.ownProperties),()=>{const $=c.subschema({keyword:v,schemaProp:g},w);c.mergeValidEvaluated($,w)},()=>u.var(w,!0)),c.ok(w))}e.validateSchemaDeps=i,e.default=s})(Fs);var ka={};Object.defineProperty(ka,"__esModule",{value:!0});const ku=se,dy=M,fy={message:"property name must be valid",params:({params:e})=>(0,ku._)`{propertyName: ${e.propertyName}}`},hy={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fy,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,dy.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,ku.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};ka.default=hy;var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});const Un=ce,ot=se,my=Ze,qn=M,py={message:"must NOT have additional properties",params:({params:e})=>(0,ot._)`{additionalProperty: ${e.additionalProperty}}`},yy={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:py,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:i,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,qn.alwaysValidSchema)(a,r))return;const d=(0,Un.allSchemaProperties)(n.properties),u=(0,Un.allSchemaProperties)(n.patternProperties);f(),e.ok((0,ot._)`${o} === ${my.default.errors}`);function f(){t.forIn("key",s,$=>{!d.length&&!u.length?w($):t.if(v($),()=>w($))})}function v($){let m;if(d.length>8){const E=(0,qn.schemaRefOrVal)(a,n.properties,"properties");m=(0,Un.isOwnProperty)(t,E,$)}else d.length?m=(0,ot.or)(...d.map(E=>(0,ot._)`${$} === ${E}`)):m=ot.nil;return u.length&&(m=(0,ot.or)(m,...u.map(E=>(0,ot._)`${(0,Un.usePattern)(e,E)}.test(${$})`))),(0,ot.not)(m)}function y($){t.code((0,ot._)`delete ${s}[${$}]`)}function w($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){y($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0,qn.alwaysValidSchema)(a,r)){const m=t.name("valid");c.removeAdditional==="failing"?(g($,m,!1),t.if((0,ot.not)(m),()=>{e.reset(),y($)})):(g($,m),i||t.if((0,ot.not)(m),()=>t.break()))}}function g($,m,E){const N={keyword:"additionalProperties",dataProp:$,dataPropType:qn.Type.Str};E===!1&&Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(N,m)}}};Ls.default=yy;var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0});const $y=ft,_c=ce,ao=M,vc=Ls,gy={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&vc.default.code(new $y.KeywordCxt(o,vc.default,"additionalProperties"));const a=(0,_c.allSchemaProperties)(r);for(const f of a)o.definedProperties.add(f);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=ao.mergeEvaluated.props(t,(0,ao.toHash)(a),o.props));const i=a.filter(f=>!(0,ao.alwaysValidSchema)(o,r[f]));if(i.length===0)return;const c=t.name("valid");for(const f of i)d(f)?u(f):(t.if((0,_c.propertyInData)(t,s,f,o.opts.ownProperties)),u(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function d(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function u(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};Ca.default=gy;var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0});const wc=ce,Gn=se,Ec=M,bc=M,_y={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:a}=o,i=(0,wc.allSchemaProperties)(r),c=i.filter(g=>(0,Ec.alwaysValidSchema)(o,r[g]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===!0))return;const d=a.strictSchema&&!a.allowMatchingProperties&&s.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof Gn.Name)&&(o.props=(0,bc.evaluatedPropsToName)(t,o.props));const{props:f}=o;v();function v(){for(const g of i)d&&y(g),o.allErrors?w(g):(t.var(u,!0),w(g),t.if(u))}function y(g){for(const $ in d)new RegExp(g).test($)&&(0,Ec.checkStrictMode)(o,`property ${$} matches pattern ${g} (use allowMatchingProperties)`)}function w(g){t.forIn("key",n,$=>{t.if((0,Gn._)`${(0,wc.usePattern)(e,g)}.test(${$})`,()=>{const m=c.includes(g);m||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:$,dataPropType:bc.Type.Str},u),o.opts.unevaluated&&f!==!0?t.assign((0,Gn._)`${f}[${$}]`,!0):!m&&!o.allErrors&&t.if((0,Gn.not)(u),()=>t.break())})})}}};Ma.default=_y;var Da={};Object.defineProperty(Da,"__esModule",{value:!0});const vy=M,wy={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,vy.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"}};Da.default=wy;var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});const Ey=ce,by={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ey.validateUnion,error:{message:"must match a schema in anyOf"}};Fa.default=by;var La={};Object.defineProperty(La,"__esModule",{value:!0});const ls=se,Sy=M,Py={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ls._)`{passingSchemas: ${e.passing}}`},Ny={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Py,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,a=t.let("valid",!1),i=t.let("passing",null),c=t.name("_valid");e.setParams({passing:i}),t.block(d),e.result(a,()=>e.reset(),()=>e.error(!0));function d(){o.forEach((u,f)=>{let v;(0,Sy.alwaysValidSchema)(s,u)?t.var(c,!0):v=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,ls._)`${c} && ${a}`).assign(a,!1).assign(i,(0,ls._)`[${i}, ${f}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(i,f),v&&e.mergeEvaluated(v,ls.Name)})})}}};La.default=Ny;var za={};Object.defineProperty(za,"__esModule",{value:!0});const Ry=M,Oy={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,a)=>{if((0,Ry.alwaysValidSchema)(n,o))return;const i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i)})}};za.default=Oy;var Va={};Object.defineProperty(Va,"__esModule",{value:!0});const bs=se,Cu=M,Iy={message:({params:e})=>(0,bs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,bs._)`{failingKeyword: ${e.ifClause}}`},Ty={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Iy,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Cu.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=Sc(n,"then"),o=Sc(n,"else");if(!s&&!o)return;const a=t.let("valid",!0),i=t.name("_valid");if(c(),e.reset(),s&&o){const u=t.let("ifClause");e.setParams({ifClause:u}),t.if(i,d("then",u),d("else",u))}else s?t.if(i,d("then")):t.if((0,bs.not)(i),d("else"));e.pass(a,()=>e.error(!0));function c(){const u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);e.mergeEvaluated(u)}function d(u,f){return()=>{const v=e.subschema({keyword:u},i);t.assign(a,i),e.mergeValidEvaluated(v,a),f?t.assign(f,(0,bs._)`${u}`):e.setParams({ifClause:u})}}}};function Sc(e,t){const r=e.schema[t];return r!==void 0&&!(0,Cu.alwaysValidSchema)(e,r)}Va.default=Ty;var Ua={};Object.defineProperty(Ua,"__esModule",{value:!0});const jy=M,Ay={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,jy.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Ua.default=Ay;Object.defineProperty(Ia,"__esModule",{value:!0});const ky=xr,Cy=Ta,My=Br,Dy=ja,Fy=Aa,Ly=Fs,zy=ka,Vy=Ls,Uy=Ca,qy=Ma,Gy=Da,Ky=Fa,Hy=La,Wy=za,xy=Va,By=Ua;function Yy(e=!1){const t=[Gy.default,Ky.default,Hy.default,Wy.default,xy.default,By.default,zy.default,Vy.default,Ly.default,Uy.default,qy.default];return e?t.push(Cy.default,Dy.default):t.push(ky.default,My.default),t.push(Fy.default),t}Ia.default=Yy;var qa={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.dynamicAnchor=void 0;const io=se,Jy=Ze,Pc=Ve,Xy=At,Zy={keyword:"$dynamicAnchor",schemaType:"string",code:e=>Mu(e,e.schema)};function Mu(e,t){const{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;const s=(0,io._)`${Jy.default.dynamicAnchors}${(0,io.getProperty)(t)}`,o=n.errSchemaPath==="#"?n.validateName:Qy(e);r.if((0,io._)`!${s}`,()=>r.assign(s,o))}Yr.dynamicAnchor=Mu;function Qy(e){const{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:o,localRefs:a,meta:i}=t.root,{schemaId:c}=n.opts,d=new Pc.SchemaEnv({schema:r,schemaId:c,root:s,baseId:o,localRefs:a,meta:i});return Pc.compileSchema.call(n,d),(0,Xy.getValidate)(e,d)}Yr.default=Zy;var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.dynamicRef=void 0;const Nc=se,e$=Ze,Rc=At,t$={keyword:"$dynamicRef",schemaType:"string",code:e=>Du(e,e.schema)};function Du(e,t){const{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);const o=t.slice(1);if(s.allErrors)a();else{const c=r.let("valid",!1);a(c),e.ok(c)}function a(c){if(s.schemaEnv.root.dynamicAnchors[o]){const d=r.let("_v",(0,Nc._)`${e$.default.dynamicAnchors}${(0,Nc.getProperty)(o)}`);r.if(d,i(d,c),i(s.validateName,c))}else i(s.validateName,c)()}function i(c,d){return d?()=>r.block(()=>{(0,Rc.callRef)(e,c),r.let(d,!0)}):()=>(0,Rc.callRef)(e,c)}}Jr.dynamicRef=Du;Jr.default=t$;var Ga={};Object.defineProperty(Ga,"__esModule",{value:!0});const r$=Yr,n$=M,s$={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r$.dynamicAnchor)(e,""):(0,n$.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};Ga.default=s$;var Ka={};Object.defineProperty(Ka,"__esModule",{value:!0});const o$=Jr,a$={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,o$.dynamicRef)(e,e.schema)};Ka.default=a$;Object.defineProperty(qa,"__esModule",{value:!0});const i$=Yr,c$=Jr,l$=Ga,u$=Ka,d$=[i$.default,c$.default,l$.default,u$.default];qa.default=d$;var Ha={},Wa={};Object.defineProperty(Wa,"__esModule",{value:!0});const Oc=Fs,f$={keyword:"dependentRequired",type:"object",schemaType:"object",error:Oc.error,code:e=>(0,Oc.validatePropertyDeps)(e)};Wa.default=f$;var xa={};Object.defineProperty(xa,"__esModule",{value:!0});const h$=Fs,m$={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,h$.validateSchemaDeps)(e)};xa.default=m$;var Ba={};Object.defineProperty(Ba,"__esModule",{value:!0});const p$=M,y$={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){t.contains===void 0&&(0,p$.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}};Ba.default=y$;Object.defineProperty(Ha,"__esModule",{value:!0});const $$=Wa,g$=xa,_$=Ba,v$=[$$.default,g$.default,_$.default];Ha.default=v$;var Ya={},Ja={};Object.defineProperty(Ja,"__esModule",{value:!0});const Ut=se,Ic=M,w$=Ze,E$={message:"must NOT have unevaluated properties",params:({params:e})=>(0,Ut._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},b$={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:E$,code(e){const{gen:t,schema:r,data:n,errsCount:s,it:o}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:a,props:i}=o;i instanceof Ut.Name?t.if((0,Ut._)`${i} !== true`,()=>t.forIn("key",n,f=>t.if(d(i,f),()=>c(f)))):i!==!0&&t.forIn("key",n,f=>i===void 0?c(f):t.if(u(i,f),()=>c(f))),o.props=!0,e.ok((0,Ut._)`${s} === ${w$.default.errors}`);function c(f){if(r===!1){e.setParams({unevaluatedProperty:f}),e.error(),a||t.break();return}if(!(0,Ic.alwaysValidSchema)(o,r)){const v=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:Ic.Type.Str},v),a||t.if((0,Ut.not)(v),()=>t.break())}}function d(f,v){return(0,Ut._)`!${f} || !${f}[${v}]`}function u(f,v){const y=[];for(const w in f)f[w]===!0&&y.push((0,Ut._)`${v} !== ${w}`);return(0,Ut.and)(...y)}}};Ja.default=b$;var Xa={};Object.defineProperty(Xa,"__esModule",{value:!0});const pr=se,Tc=M,S$={message:({params:{len:e}})=>(0,pr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,pr._)`{limit: ${e}}`},P$={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:S$,code(e){const{gen:t,schema:r,data:n,it:s}=e,o=s.items||0;if(o===!0)return;const a=t.const("len",(0,pr._)`${n}.length`);if(r===!1)e.setParams({len:o}),e.fail((0,pr._)`${a} > ${o}`);else if(typeof r=="object"&&!(0,Tc.alwaysValidSchema)(s,r)){const c=t.var("valid",(0,pr._)`${a} <= ${o}`);t.if((0,pr.not)(c),()=>i(c,o)),e.ok(c)}s.items=!0;function i(c,d){t.forRange("i",d,a,u=>{e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Tc.Type.Num},c),s.allErrors||t.if((0,pr.not)(c),()=>t.break())})}}};Xa.default=P$;Object.defineProperty(Ya,"__esModule",{value:!0});const N$=Ja,R$=Xa,O$=[N$.default,R$.default];Ya.default=O$;var Za={},Qa={};Object.defineProperty(Qa,"__esModule",{value:!0});const Ee=se,I$={message:({schemaCode:e})=>(0,Ee.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Ee._)`{format: ${e}}`},T$={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:I$,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:d,schemaEnv:u,self:f}=i;if(!c.validateFormats)return;s?v():y();function v(){const w=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),g=r.const("fDef",(0,Ee._)`${w}[${a}]`),$=r.let("fType"),m=r.let("format");r.if((0,Ee._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign($,(0,Ee._)`${g}.type || "string"`).assign(m,(0,Ee._)`${g}.validate`),()=>r.assign($,(0,Ee._)`"string"`).assign(m,g)),e.fail$data((0,Ee.or)(E(),N()));function E(){return c.strictSchema===!1?Ee.nil:(0,Ee._)`${a} && !${m}`}function N(){const R=u.$async?(0,Ee._)`(${g}.async ? await ${m}(${n}) : ${m}(${n}))`:(0,Ee._)`${m}(${n})`,O=(0,Ee._)`(typeof ${m} == "function" ? ${R} : ${m}.test(${n}))`;return(0,Ee._)`${m} && ${m} !== true && ${$} === ${t} && !${O}`}}function y(){const w=f.formats[o];if(!w){E();return}if(w===!0)return;const[g,$,m]=N(w);g===t&&e.pass(R());function E(){if(c.strictSchema===!1){f.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${o}" ignored in schema at path "${d}"`}}function N(O){const x=O instanceof RegExp?(0,Ee.regexpCode)(O):c.code.formats?(0,Ee._)`${c.code.formats}${(0,Ee.getProperty)(o)}`:void 0,re=r.scopeValue("formats",{key:o,ref:O,code:x});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,Ee._)`${re}.validate`]:["string",O,re]}function R(){if(typeof w=="object"&&!(w instanceof RegExp)&&w.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ee._)`await ${m}(${n})`}return typeof $=="function"?(0,Ee._)`${m}(${n})`:(0,Ee._)`${m}.test(${n})`}}}};Qa.default=T$;Object.defineProperty(Za,"__esModule",{value:!0});const j$=Qa,A$=[j$.default];Za.default=A$;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.contentVocabulary=Gr.metadataVocabulary=void 0;Gr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Gr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(ma,"__esModule",{value:!0});const k$=pa,C$=$a,M$=Ia,D$=qa,F$=Ha,L$=Ya,z$=Za,jc=Gr,V$=[D$.default,k$.default,C$.default,(0,M$.default)(!0),z$.default,jc.metadataVocabulary,jc.contentVocabulary,F$.default,L$.default];ma.default=V$;var ei={},zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.DiscrError=void 0;var Ac;(function(e){e.Tag="tag",e.Mapping="mapping"})(Ac||(zs.DiscrError=Ac={}));Object.defineProperty(ei,"__esModule",{value:!0});const Ar=se,Co=zs,kc=Ve,U$=Wr,q$=M,G$={message:({params:{discrError:e,tagName:t}})=>e===Co.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Ar._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},K$={keyword:"discriminator",type:"object",schemaType:"object",error:G$,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:a}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=n.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),d=t.const("tag",(0,Ar._)`${r}${(0,Ar.getProperty)(i)}`);t.if((0,Ar._)`typeof ${d} == "string"`,()=>u(),()=>e.error(!1,{discrError:Co.DiscrError.Tag,tag:d,tagName:i})),e.ok(c);function u(){const y=v();t.if(!1);for(const w in y)t.elseIf((0,Ar._)`${d} === ${w}`),t.assign(c,f(y[w]));t.else(),e.error(!1,{discrError:Co.DiscrError.Mapping,tag:d,tagName:i}),t.endIf()}function f(y){const w=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:y},w);return e.mergeEvaluated(g,Ar.Name),w}function v(){var y;const w={},g=m(s);let $=!0;for(let R=0;Rthis.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,m_):n}}ti.default=p_;(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=t.Ajv2020=void 0;const r=Ll,n=ma,s=ei,o=ti,a="https://json-schema.org/draft/2020-12/schema";class i extends r.default{constructor(y={}){super({...y,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:y,meta:w}=this.opts;w&&(o.default.call(this,y),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv2020=i,e.exports=t=i,e.exports.Ajv2020=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var c=ft;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=se;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var u=Tn;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return u.default}});var f=Wr;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Ro,Ro.exports);var y_=Ro.exports,Mo={exports:{}},Fu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(K,Y){return{validate:K,compare:Y}}e.fullFormats={date:t(o,a),time:t(c(!0),d),"date-time":t(v(!0),y),"iso-time":t(c(),u),"iso-date-time":t(v(),w),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:m,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Se,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:N,int32:{type:"number",validate:x},int64:{type:"number",validate:re},float:{type:"number",validate:ge},double:{type:"number",validate:ge},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,y),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,w),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(K){return K%4===0&&(K%100!==0||K%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(K){const Y=n.exec(K);if(!Y)return!1;const fe=+Y[1],T=+Y[2],A=+Y[3];return T>=1&&T<=12&&A>=1&&A<=(T===2&&r(fe)?29:s[T])}function a(K,Y){if(K&&Y)return K>Y?1:K23||p>59||K&&!B)return!1;if(A<=23&&V<=59&&F<60)return!0;const S=V-p*L,_=A-P*L-(S<0?1:0);return(_===23||_===-1)&&(S===59||S===-1)&&F<61}}function d(K,Y){if(!(K&&Y))return;const fe=new Date("2020-01-01T"+K).valueOf(),T=new Date("2020-01-01T"+Y).valueOf();if(fe&&T)return fe-T}function u(K,Y){if(!(K&&Y))return;const fe=i.exec(K),T=i.exec(Y);if(fe&&T)return K=fe[1]+fe[2]+fe[3],Y=T[1]+T[2]+T[3],K>Y?1:K=R}function re(K){return Number.isInteger(K)}function ge(){return!0}const we=/[^\\]\\Z/;function Se(K){if(we.test(K))return!1;try{return new RegExp(K),!0}catch{return!1}}})(Fu);var Lu={},Do={exports:{}},zu={},ht={},Kr={},An={},ie={},On={};(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(E){if(super(),!e.IDENTIFIER.test(E))throw new Error("CodeGen: name must be a valid identifier");this.str=E}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(E){super(),this._items=typeof E=="string"?[E]:E}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const E=this._items[0];return E===""||E==='""'}get str(){var E;return(E=this._str)!==null&&E!==void 0?E:this._str=this._items.reduce((N,R)=>`${N}${R}`,"")}get names(){var E;return(E=this._names)!==null&&E!==void 0?E:this._names=this._items.reduce((N,R)=>(R instanceof r&&(N[R.str]=(N[R.str]||0)+1),N),{})}}e._Code=n,e.nil=new n("");function s(m,...E){const N=[m[0]];let R=0;for(;R{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${d}${f.scopePath}`})}scopeCode(d=this._values,u,f){return this._reduceValues(d,v=>{if(v.value===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return v.value.code},u,f)}_reduceValues(d,u,f={},v){let y=t.nil;for(const w in d){const g=d[w];if(!g)continue;const $=f[w]=f[w]||new Map;g.forEach(m=>{if($.has(m))return;$.set(m,n.Started);let E=u(m);if(E){const N=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${N} ${m} = ${E};${this.opts._n}`}else if(E=v==null?void 0:v(m))y=(0,t._)`${y}${E}${this.opts._n}`;else throw new r(m);$.set(m,n.Completed)})}return y}}e.ValueScope=i})(Fo);(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=On,r=Fo;var n=On;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=Fo;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(l,h){return this}}class a extends o{constructor(l,h,b){super(),this.varKind=l,this.name=h,this.rhs=b}render({es5:l,_n:h}){const b=l?r.varKinds.var:this.varKind,I=this.rhs===void 0?"":` = ${this.rhs}`;return`${b} ${this.name}${I};`+h}optimizeNames(l,h){if(l[this.name.str])return this.rhs&&(this.rhs=T(this.rhs,l,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends o{constructor(l,h,b){super(),this.lhs=l,this.rhs=h,this.sideEffects=b}render({_n:l}){return`${this.lhs} = ${this.rhs};`+l}optimizeNames(l,h){if(!(this.lhs instanceof t.Name&&!l[this.lhs.str]&&!this.sideEffects))return this.rhs=T(this.rhs,l,h),this}get names(){const l=this.lhs instanceof t.Name?{}:{...this.lhs.names};return fe(l,this.rhs)}}class c extends i{constructor(l,h,b,I){super(l,b,I),this.op=h}render({_n:l}){return`${this.lhs} ${this.op}= ${this.rhs};`+l}}class d extends o{constructor(l){super(),this.label=l,this.names={}}render({_n:l}){return`${this.label}:`+l}}class u extends o{constructor(l){super(),this.label=l,this.names={}}render({_n:l}){return`break${this.label?` ${this.label}`:""};`+l}}class f extends o{constructor(l){super(),this.error=l}render({_n:l}){return`throw ${this.error};`+l}get names(){return this.error.names}}class v extends o{constructor(l){super(),this.code=l}render({_n:l}){return`${this.code};`+l}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(l,h){return this.code=T(this.code,l,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends o{constructor(l=[]){super(),this.nodes=l}render(l){return this.nodes.reduce((h,b)=>h+b.render(l),"")}optimizeNodes(){const{nodes:l}=this;let h=l.length;for(;h--;){const b=l[h].optimizeNodes();Array.isArray(b)?l.splice(h,1,...b):b?l[h]=b:l.splice(h,1)}return l.length>0?this:void 0}optimizeNames(l,h){const{nodes:b}=this;let I=b.length;for(;I--;){const j=b[I];j.optimizeNames(l,h)||(A(l,j.names),b.splice(I,1))}return b.length>0?this:void 0}get names(){return this.nodes.reduce((l,h)=>Y(l,h.names),{})}}class w extends y{render(l){return"{"+l._n+super.render(l)+"}"+l._n}}class g extends y{}class $ extends w{}$.kind="else";class m extends w{constructor(l,h){super(h),this.condition=l}render(l){let h=`if(${this.condition})`+super.render(l);return this.else&&(h+="else "+this.else.render(l)),h}optimizeNodes(){super.optimizeNodes();const l=this.condition;if(l===!0)return this.nodes;let h=this.else;if(h){const b=h.optimizeNodes();h=this.else=Array.isArray(b)?new $(b):b}if(h)return l===!1?h instanceof m?h:h.nodes:this.nodes.length?this:new m(V(l),h instanceof m?[h]:h.nodes);if(!(l===!1||!this.nodes.length))return this}optimizeNames(l,h){var b;if(this.else=(b=this.else)===null||b===void 0?void 0:b.optimizeNames(l,h),!!(super.optimizeNames(l,h)||this.else))return this.condition=T(this.condition,l,h),this}get names(){const l=super.names;return fe(l,this.condition),this.else&&Y(l,this.else.names),l}}m.kind="if";class E extends w{}E.kind="for";class N extends E{constructor(l){super(),this.iteration=l}render(l){return`for(${this.iteration})`+super.render(l)}optimizeNames(l,h){if(super.optimizeNames(l,h))return this.iteration=T(this.iteration,l,h),this}get names(){return Y(super.names,this.iteration.names)}}class R extends E{constructor(l,h,b,I){super(),this.varKind=l,this.name=h,this.from=b,this.to=I}render(l){const h=l.es5?r.varKinds.var:this.varKind,{name:b,from:I,to:j}=this;return`for(${h} ${b}=${I}; ${b}<${j}; ${b}++)`+super.render(l)}get names(){const l=fe(super.names,this.from);return fe(l,this.to)}}class O extends E{constructor(l,h,b,I){super(),this.loop=l,this.varKind=h,this.name=b,this.iterable=I}render(l){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(l)}optimizeNames(l,h){if(super.optimizeNames(l,h))return this.iterable=T(this.iterable,l,h),this}get names(){return Y(super.names,this.iterable.names)}}class x extends w{constructor(l,h,b){super(),this.name=l,this.args=h,this.async=b}render(l){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(l)}}x.kind="func";class re extends y{render(l){return"return "+super.render(l)}}re.kind="return";class ge extends w{render(l){let h="try"+super.render(l);return this.catch&&(h+=this.catch.render(l)),this.finally&&(h+=this.finally.render(l)),h}optimizeNodes(){var l,h;return super.optimizeNodes(),(l=this.catch)===null||l===void 0||l.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(l,h){var b,I;return super.optimizeNames(l,h),(b=this.catch)===null||b===void 0||b.optimizeNames(l,h),(I=this.finally)===null||I===void 0||I.optimizeNames(l,h),this}get names(){const l=super.names;return this.catch&&Y(l,this.catch.names),this.finally&&Y(l,this.finally.names),l}}class we extends w{constructor(l){super(),this.error=l}render(l){return`catch(${this.error})`+super.render(l)}}we.kind="catch";class Se extends w{render(l){return"finally"+super.render(l)}}Se.kind="finally";class K{constructor(l,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?` +`:""},this._extScope=l,this._scope=new r.Scope({parent:l}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(l){return this._scope.name(l)}scopeName(l){return this._extScope.name(l)}scopeValue(l,h){const b=this._extScope.value(l,h);return(this._values[b.prefix]||(this._values[b.prefix]=new Set)).add(b),b}getScopeValue(l,h){return this._extScope.getValue(l,h)}scopeRefs(l){return this._extScope.scopeRefs(l,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(l,h,b,I){const j=this._scope.toName(h);return b!==void 0&&I&&(this._constants[j.str]=b),this._leafNode(new a(l,j,b)),j}const(l,h,b){return this._def(r.varKinds.const,l,h,b)}let(l,h,b){return this._def(r.varKinds.let,l,h,b)}var(l,h,b){return this._def(r.varKinds.var,l,h,b)}assign(l,h,b){return this._leafNode(new i(l,h,b))}add(l,h){return this._leafNode(new c(l,e.operators.ADD,h))}code(l){return typeof l=="function"?l():l!==t.nil&&this._leafNode(new v(l)),this}object(...l){const h=["{"];for(const[b,I]of l)h.length>1&&h.push(","),h.push(b),(b!==I||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,I));return h.push("}"),new t._Code(h)}if(l,h,b){if(this._blockNode(new m(l)),h&&b)this.code(h).else().code(b).endIf();else if(h)this.code(h).endIf();else if(b)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(l){return this._elseNode(new m(l))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(m,$)}_for(l,h){return this._blockNode(l),h&&this.code(h).endFor(),this}for(l,h){return this._for(new N(l),h)}forRange(l,h,b,I,j=this.opts.es5?r.varKinds.var:r.varKinds.let){const G=this._scope.toName(l);return this._for(new R(j,G,h,b),()=>I(G))}forOf(l,h,b,I=r.varKinds.const){const j=this._scope.toName(l);if(this.opts.es5){const G=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${G}.length`,U=>{this.var(j,(0,t._)`${G}[${U}]`),b(j)})}return this._for(new O("of",I,j,h),()=>b(j))}forIn(l,h,b,I=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(l,(0,t._)`Object.keys(${h})`,b);const j=this._scope.toName(l);return this._for(new O("in",I,j,h),()=>b(j))}endFor(){return this._endBlockNode(E)}label(l){return this._leafNode(new d(l))}break(l){return this._leafNode(new u(l))}return(l){const h=new re;if(this._blockNode(h),this.code(l),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(re)}try(l,h,b){if(!h&&!b)throw new Error('CodeGen: "try" without "catch" and "finally"');const I=new ge;if(this._blockNode(I),this.code(l),h){const j=this.name("e");this._currNode=I.catch=new we(j),h(j)}return b&&(this._currNode=I.finally=new Se,this.code(b)),this._endBlockNode(we,Se)}throw(l){return this._leafNode(new f(l))}block(l,h){return this._blockStarts.push(this._nodes.length),l&&this.code(l).endBlock(h),this}endBlock(l){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const b=this._nodes.length-h;if(b<0||l!==void 0&&b!==l)throw new Error(`CodeGen: wrong number of nodes: ${b} vs ${l} expected`);return this._nodes.length=h,this}func(l,h=t.nil,b,I){return this._blockNode(new x(l,h,b)),I&&this.code(I).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(l=1){for(;l-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(l){return this._currNode.nodes.push(l),this}_blockNode(l){this._currNode.nodes.push(l),this._nodes.push(l)}_endBlockNode(l,h){const b=this._currNode;if(b instanceof l||h&&b instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${l.kind}/${h.kind}`:l.kind}"`)}_elseNode(l){const h=this._currNode;if(!(h instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=l,this}get _root(){return this._nodes[0]}get _currNode(){const l=this._nodes;return l[l.length-1]}set _currNode(l){const h=this._nodes;h[h.length-1]=l}}e.CodeGen=K;function Y(_,l){for(const h in l)_[h]=(_[h]||0)+(l[h]||0);return _}function fe(_,l){return l instanceof t._CodeOrName?Y(_,l.names):_}function T(_,l,h){if(_ instanceof t.Name)return b(_);if(!I(_))return _;return new t._Code(_._items.reduce((j,G)=>(G instanceof t.Name&&(G=b(G)),G instanceof t._Code?j.push(...G._items):j.push(G),j),[]));function b(j){const G=h[j.str];return G===void 0||l[j.str]!==1?j:(delete l[j.str],G)}function I(j){return j instanceof t._Code&&j._items.some(G=>G instanceof t.Name&&l[G.str]===1&&h[G.str]!==void 0)}}function A(_,l){for(const h in l)_[h]=(_[h]||0)-(l[h]||0)}function V(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:(0,t._)`!${S(_)}`}e.not=V;const F=p(e.operators.AND);function B(..._){return _.reduce(F)}e.and=B;const L=p(e.operators.OR);function P(..._){return _.reduce(L)}e.or=P;function p(_){return(l,h)=>l===t.nil?h:h===t.nil?l:(0,t._)`${S(l)} ${_} ${S(h)}`}function S(_){return _ instanceof t.Name?_:(0,t._)`(${_})`}})(ie);var D={};Object.defineProperty(D,"__esModule",{value:!0});D.checkStrictMode=D.getErrorPath=D.Type=D.useFunc=D.setEvaluated=D.evaluatedPropsToName=D.mergeEvaluated=D.eachItem=D.unescapeJsonPointer=D.escapeJsonPointer=D.escapeFragment=D.unescapeFragment=D.schemaRefOrVal=D.schemaHasRulesButRef=D.schemaHasRules=D.checkUnknownRules=D.alwaysValidSchema=D.toHash=void 0;const pe=ie,$_=On;function g_(e){const t={};for(const r of e)t[r]=!0;return t}D.toHash=g_;function __(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Vu(e,t),!Uu(t,e.self.RULES.all))}D.alwaysValidSchema=__;function Vu(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||Ku(e,`unknown keyword: "${o}"`)}D.checkUnknownRules=Vu;function Uu(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}D.schemaHasRules=Uu;function v_(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}D.schemaHasRulesButRef=v_;function w_({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}D.schemaRefOrVal=w_;function E_(e){return qu(decodeURIComponent(e))}D.unescapeFragment=E_;function b_(e){return encodeURIComponent(ri(e))}D.escapeFragment=b_;function ri(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}D.escapeJsonPointer=ri;function qu(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}D.unescapeJsonPointer=qu;function S_(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}D.eachItem=S_;function Cc({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,a,i)=>{const c=a===void 0?o:a instanceof pe.Name?(o instanceof pe.Name?e(s,o,a):t(s,o,a),a):o instanceof pe.Name?(t(s,a,o),o):r(o,a);return i===pe.Name&&!(c instanceof pe.Name)?n(s,c):c}}D.mergeEvaluated={props:Cc({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),ni(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Gu}),items:Cc({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Gu(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,pe._)`{}`);return t!==void 0&&ni(e,r,t),r}D.evaluatedPropsToName=Gu;function ni(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}D.setEvaluated=ni;const Mc={};function P_(e,t){return e.scopeValue("func",{ref:t,code:Mc[t.code]||(Mc[t.code]=new $_._Code(t.code))})}D.useFunc=P_;var Lo;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Lo||(D.Type=Lo={}));function N_(e,t,r){if(e instanceof pe.Name){const n=t===Lo.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+ri(e)}D.getErrorPath=N_;function Ku(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}D.checkStrictMode=Ku;var St={};Object.defineProperty(St,"__esModule",{value:!0});const Me=ie,R_={data:new Me.Name("data"),valCxt:new Me.Name("valCxt"),instancePath:new Me.Name("instancePath"),parentData:new Me.Name("parentData"),parentDataProperty:new Me.Name("parentDataProperty"),rootData:new Me.Name("rootData"),dynamicAnchors:new Me.Name("dynamicAnchors"),vErrors:new Me.Name("vErrors"),errors:new Me.Name("errors"),this:new Me.Name("this"),self:new Me.Name("self"),scope:new Me.Name("scope"),json:new Me.Name("json"),jsonPos:new Me.Name("jsonPos"),jsonLen:new Me.Name("jsonLen"),jsonPart:new Me.Name("jsonPart")};St.default=R_;(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=ie,r=D,n=St;e.keywordError={message:({keyword:$})=>(0,t.str)`must pass "${$}" keyword validation`},e.keyword$DataError={message:({keyword:$,schemaType:m})=>m?(0,t.str)`"${$}" keyword must be ${m} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,m=e.keywordError,E,N){const{it:R}=$,{gen:O,compositeRule:x,allErrors:re}=R,ge=f($,m,E);N??(x||re)?c(O,ge):d(R,(0,t._)`[${ge}]`)}e.reportError=s;function o($,m=e.keywordError,E){const{it:N}=$,{gen:R,compositeRule:O,allErrors:x}=N,re=f($,m,E);c(R,re),O||x||d(N,n.default.vErrors)}e.reportExtraError=o;function a($,m){$.assign(n.default.errors,m),$.if((0,t._)`${n.default.vErrors} !== null`,()=>$.if(m,()=>$.assign((0,t._)`${n.default.vErrors}.length`,m),()=>$.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function i({gen:$,keyword:m,schemaValue:E,data:N,errsCount:R,it:O}){if(R===void 0)throw new Error("ajv implementation error");const x=$.name("err");$.forRange("i",R,n.default.errors,re=>{$.const(x,(0,t._)`${n.default.vErrors}[${re}]`),$.if((0,t._)`${x}.instancePath === undefined`,()=>$.assign((0,t._)`${x}.instancePath`,(0,t.strConcat)(n.default.instancePath,O.errorPath))),$.assign((0,t._)`${x}.schemaPath`,(0,t.str)`${O.errSchemaPath}/${m}`),O.opts.verbose&&($.assign((0,t._)`${x}.schema`,E),$.assign((0,t._)`${x}.data`,N))})}e.extendErrors=i;function c($,m){const E=$.const("err",m);$.if((0,t._)`${n.default.vErrors} === null`,()=>$.assign(n.default.vErrors,(0,t._)`[${E}]`),(0,t._)`${n.default.vErrors}.push(${E})`),$.code((0,t._)`${n.default.errors}++`)}function d($,m){const{gen:E,validateName:N,schemaEnv:R}=$;R.$async?E.throw((0,t._)`new ${$.ValidationError}(${m})`):(E.assign((0,t._)`${N}.errors`,m),E.return(!1))}const u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f($,m,E){const{createErrors:N}=$.it;return N===!1?(0,t._)`{}`:v($,m,E)}function v($,m,E={}){const{gen:N,it:R}=$,O=[y(R,E),w($,E)];return g($,m,O),N.object(...O)}function y({errorPath:$},{instancePath:m}){const E=m?(0,t.str)`${$}${(0,r.getErrorPath)(m,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)]}function w({keyword:$,it:{errSchemaPath:m}},{schemaPath:E,parentSchema:N}){let R=N?m:(0,t.str)`${m}/${$}`;return E&&(R=(0,t.str)`${R}${(0,r.getErrorPath)(E,r.Type.Str)}`),[u.schemaPath,R]}function g($,{params:m,message:E},N){const{keyword:R,data:O,schemaValue:x,it:re}=$,{opts:ge,propertyName:we,topSchemaRef:Se,schemaPath:K}=re;N.push([u.keyword,R],[u.params,typeof m=="function"?m($):m||(0,t._)`{}`]),ge.messages&&N.push([u.message,typeof E=="function"?E($):E]),ge.verbose&&N.push([u.schema,x],[u.parentSchema,(0,t._)`${Se}${K}`],[n.default.data,O]),we&&N.push([u.propertyName,we])}})(An);Object.defineProperty(Kr,"__esModule",{value:!0});Kr.boolOrEmptySchema=Kr.topBoolOrEmptySchema=void 0;const O_=An,I_=ie,T_=St,j_={message:"boolean schema is false"};function A_(e){const{gen:t,schema:r,validateName:n}=e;r===!1?Hu(e,!1):typeof r=="object"&&r.$async===!0?t.return(T_.default.data):(t.assign((0,I_._)`${n}.errors`,null),t.return(!0))}Kr.topBoolOrEmptySchema=A_;function k_(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Hu(e)):r.var(t,!0)}Kr.boolOrEmptySchema=k_;function Hu(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,O_.reportError)(s,j_,void 0,t)}var Ne={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.getRules=Sr.isJSONType=void 0;const C_=["string","number","integer","boolean","null","object","array"],M_=new Set(C_);function D_(e){return typeof e=="string"&&M_.has(e)}Sr.isJSONType=D_;function F_(){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:{}}}Sr.getRules=F_;var It={};Object.defineProperty(It,"__esModule",{value:!0});It.shouldUseRule=It.shouldUseGroup=It.schemaHasRulesForType=void 0;function L_({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&Wu(e,n)}It.schemaHasRulesForType=L_;function Wu(e,t){return t.rules.some(r=>xu(e,r))}It.shouldUseGroup=Wu;function xu(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))}It.shouldUseRule=xu;Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;const z_=Sr,V_=It,U_=An,ae=ie,Bu=D;var Lr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Lr||(Ne.DataType=Lr={}));function q_(e){const t=Yu(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ne.getSchemaTypes=q_;function Yu(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(z_.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ne.getJSONTypes=Yu;function G_(e,t){const{gen:r,data:n,opts:s}=e,o=K_(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,V_.schemaHasRulesForType)(e,t[0]));if(a){const i=si(t,n,s.strictNumbers,Lr.Wrong);r.if(i,()=>{o.length?H_(e,t,o):oi(e)})}return a}Ne.coerceAndCheckDataType=G_;const Ju=new Set(["string","number","integer","boolean","null"]);function K_(e,t){return t?e.filter(r=>Ju.has(r)||t==="array"&&r==="array"):[]}function H_(e,t,r){const{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0,ae._)`typeof ${s}`),i=n.let("coerced",(0,ae._)`undefined`);o.coerceTypes==="array"&&n.if((0,ae._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,ae._)`${s}[0]`).assign(a,(0,ae._)`typeof ${s}`).if(si(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0,ae._)`${i} !== undefined`);for(const d of r)(Ju.has(d)||d==="array"&&o.coerceTypes==="array")&&c(d);n.else(),oi(e),n.endIf(),n.if((0,ae._)`${i} !== undefined`,()=>{n.assign(s,i),W_(e,i)});function c(d){switch(d){case"string":n.elseIf((0,ae._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0,ae._)`"" + ${s}`).elseIf((0,ae._)`${s} === null`).assign(i,(0,ae._)`""`);return;case"number":n.elseIf((0,ae._)`${a} == "boolean" || ${s} === null + || (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0,ae._)`+${s}`);return;case"integer":n.elseIf((0,ae._)`${a} === "boolean" || ${s} === null + || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0,ae._)`+${s}`);return;case"boolean":n.elseIf((0,ae._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,!1).elseIf((0,ae._)`${s} === "true" || ${s} === 1`).assign(i,!0);return;case"null":n.elseIf((0,ae._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case"array":n.elseIf((0,ae._)`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${s} === null`).assign(i,(0,ae._)`[${s}]`)}}}function W_({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,ae._)`${t} !== undefined`,()=>e.assign((0,ae._)`${t}[${r}]`,n))}function zo(e,t,r,n=Lr.Correct){const s=n===Lr.Correct?ae.operators.EQ:ae.operators.NEQ;let o;switch(e){case"null":return(0,ae._)`${t} ${s} null`;case"array":o=(0,ae._)`Array.isArray(${t})`;break;case"object":o=(0,ae._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,ae._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,ae._)`typeof ${t} ${s} ${e}`}return n===Lr.Correct?o:(0,ae.not)(o);function a(i=ae.nil){return(0,ae.and)((0,ae._)`typeof ${t} == "number"`,i,r?(0,ae._)`isFinite(${t})`:ae.nil)}}Ne.checkDataType=zo;function si(e,t,r,n){if(e.length===1)return zo(e[0],t,r,n);let s;const o=(0,Bu.toHash)(e);if(o.array&&o.object){const a=(0,ae._)`typeof ${t} != "object"`;s=o.null?a:(0,ae._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else s=ae.nil;o.number&&delete o.integer;for(const a in o)s=(0,ae.and)(s,zo(a,t,r,n));return s}Ne.checkDataTypes=si;const x_={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,ae._)`{type: ${e}}`:(0,ae._)`{type: ${t}}`};function oi(e){const t=B_(e);(0,U_.reportError)(t,x_)}Ne.reportTypeError=oi;function B_(e){const{gen:t,data:r,schema:n}=e,s=(0,Bu.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Vs={};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.assignDefaults=void 0;const Ir=ie,Y_=D;function J_(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)Dc(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Dc(e,o,s.default))}Vs.assignDefaults=J_;function Dc(e,t,r){const{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;const i=(0,Ir._)`${o}${(0,Ir.getProperty)(t)}`;if(s){(0,Y_.checkStrictMode)(e,`default is ignored for: ${i}`);return}let c=(0,Ir._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0,Ir._)`${c} || ${i} === null || ${i} === ""`),n.if(c,(0,Ir._)`${i} = ${(0,Ir.stringify)(r)}`)}var bt={},le={};Object.defineProperty(le,"__esModule",{value:!0});le.validateUnion=le.validateArray=le.usePattern=le.callValidateCode=le.schemaProperties=le.allSchemaProperties=le.noPropertyInData=le.propertyInData=le.isOwnProperty=le.hasPropFunc=le.reportMissingProp=le.checkMissingProp=le.checkReportMissingProp=void 0;const $e=ie,ai=D,Lt=St,X_=D;function Z_(e,t){const{gen:r,data:n,it:s}=e;r.if(ci(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,$e._)`${t}`},!0),e.error()})}le.checkReportMissingProp=Z_;function Q_({gen:e,data:t,it:{opts:r}},n,s){return(0,$e.or)(...n.map(o=>(0,$e.and)(ci(e,t,o,r.ownProperties),(0,$e._)`${s} = ${o}`)))}le.checkMissingProp=Q_;function ev(e,t){e.setParams({missingProperty:t},!0),e.error()}le.reportMissingProp=ev;function Xu(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,$e._)`Object.prototype.hasOwnProperty`})}le.hasPropFunc=Xu;function ii(e,t,r){return(0,$e._)`${Xu(e)}.call(${t}, ${r})`}le.isOwnProperty=ii;function tv(e,t,r,n){const s=(0,$e._)`${t}${(0,$e.getProperty)(r)} !== undefined`;return n?(0,$e._)`${s} && ${ii(e,t,r)}`:s}le.propertyInData=tv;function ci(e,t,r,n){const s=(0,$e._)`${t}${(0,$e.getProperty)(r)} === undefined`;return n?(0,$e.or)(s,(0,$e.not)(ii(e,t,r))):s}le.noPropertyInData=ci;function Zu(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}le.allSchemaProperties=Zu;function rv(e,t){return Zu(t).filter(r=>!(0,ai.alwaysValidSchema)(e,t[r]))}le.schemaProperties=rv;function nv({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,c,d){const u=d?(0,$e._)`${e}, ${t}, ${n}${s}`:t,f=[[Lt.default.instancePath,(0,$e.strConcat)(Lt.default.instancePath,o)],[Lt.default.parentData,a.parentData],[Lt.default.parentDataProperty,a.parentDataProperty],[Lt.default.rootData,Lt.default.rootData]];a.opts.dynamicRef&&f.push([Lt.default.dynamicAnchors,Lt.default.dynamicAnchors]);const v=(0,$e._)`${u}, ${r.object(...f)}`;return c!==$e.nil?(0,$e._)`${i}.call(${c}, ${v})`:(0,$e._)`${i}(${v})`}le.callValidateCode=nv;const sv=(0,$e._)`new RegExp`;function ov({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,$e._)`${s.code==="new RegExp"?sv:(0,X_.useFunc)(e,s)}(${r}, ${n})`})}le.usePattern=ov;function av(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const i=t.let("valid",!0);return a(()=>t.assign(i,!1)),i}return t.var(o,!0),a(()=>t.break()),o;function a(i){const c=t.const("len",(0,$e._)`${r}.length`);t.forRange("i",0,c,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:ai.Type.Num},o),t.if((0,$e.not)(o),i)})}}le.validateArray=av;function iv(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ai.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const a=t.let("valid",!1),i=t.name("_valid");t.block(()=>r.forEach((c,d)=>{const u=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},i);t.assign(a,(0,$e._)`${a} || ${i}`),e.mergeValidEvaluated(u,i)||t.if((0,$e.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}le.validateUnion=iv;Object.defineProperty(bt,"__esModule",{value:!0});bt.validateKeywordUsage=bt.validSchemaType=bt.funcKeywordCode=bt.macroKeywordCode=void 0;const ze=ie,yr=St,cv=le,lv=An;function uv(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),c=Qu(r,n,i);a.opts.validateSchema!==!1&&a.self.validateSchema(i,!0);const d=r.name("valid");e.subschema({schema:i,schemaPath:ze.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}bt.macroKeywordCode=uv;function dv(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:c}=e;hv(c,t);const d=!i&&t.compile?t.compile.call(c.self,o,a,c):t.validate,u=Qu(n,s,d),f=n.let("valid");e.block$data(f,v),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function v(){if(t.errors===!1)g(),t.modifying&&Fc(e),$(()=>e.error());else{const m=t.async?y():w();t.modifying&&Fc(e),$(()=>fv(e,m))}}function y(){const m=n.let("ruleErrs",null);return n.try(()=>g((0,ze._)`await `),E=>n.assign(f,!1).if((0,ze._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(m,(0,ze._)`${E}.errors`),()=>n.throw(E))),m}function w(){const m=(0,ze._)`${u}.errors`;return n.assign(m,null),g(ze.nil),m}function g(m=t.async?(0,ze._)`await `:ze.nil){const E=c.opts.passContext?yr.default.this:yr.default.self,N=!("compile"in t&&!i||t.schema===!1);n.assign(f,(0,ze._)`${m}${(0,cv.callValidateCode)(e,u,E,N)}`,t.modifying)}function $(m){var E;n.if((0,ze.not)((E=t.valid)!==null&&E!==void 0?E:f),m)}}bt.funcKeywordCode=dv;function Fc(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,ze._)`${n.parentData}[${n.parentDataProperty}]`))}function fv(e,t){const{gen:r}=e;r.if((0,ze._)`Array.isArray(${t})`,()=>{r.assign(yr.default.vErrors,(0,ze._)`${yr.default.vErrors} === null ? ${t} : ${yr.default.vErrors}.concat(${t})`).assign(yr.default.errors,(0,ze._)`${yr.default.vErrors}.length`),(0,lv.extendErrors)(e)},()=>e.error())}function hv({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Qu(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,ze.stringify)(r)})}function mv(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")}bt.validSchemaType=mv;function pv({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const a=s.dependencies;if(a!=null&&a.some(i=>!Object.prototype.hasOwnProperty.call(e,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}bt.validateKeywordUsage=pv;var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.extendSubschemaMode=Bt.extendSubschemaData=Bt.getSubschema=void 0;const vt=ie,ed=D;function yv(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const i=e.schema[t];return r===void 0?{schema:i,schemaPath:(0,vt._)`${e.schemaPath}${(0,vt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0,vt._)`${e.schemaPath}${(0,vt.getProperty)(t)}${(0,vt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,ed.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Bt.getSubschema=yv;function $v(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:a}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:i}=t;if(r!==void 0){const{errorPath:d,dataPathArr:u,opts:f}=t,v=i.let("data",(0,vt._)`${t.data}${(0,vt.getProperty)(r)}`,!0);c(v),e.errorPath=(0,vt.str)`${d}${(0,ed.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,vt._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){const d=s instanceof vt.Name?s:i.let("data",s,!0);c(d),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(d){e.data=d,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,d]}}Bt.extendSubschemaData=$v;function gv(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}Bt.extendSubschemaMode=gv;var Ae={},td={exports:{}},Wt=td.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(){};us(t,n,s,e,"",e)};Wt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Wt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Wt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Wt.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 us(e,t,r,n,s,o,a,i,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,c,d);for(var u in n){var f=n[u];if(Array.isArray(f)){if(u in Wt.arrayKeywords)for(var v=0;vt+=rd(n)),t===1/0))return 1/0}return t}function nd(e,t="",r){r!==!1&&(t=zr(t));const n=e.parse(t);return sd(e,n)}Ae.getFullPath=nd;function sd(e,t){return e.serialize(t).split("#")[0]+"#"}Ae._getFullPath=sd;const Rv=/#\/?$/;function zr(e){return e?e.replace(Rv,""):""}Ae.normalizeId=zr;function Ov(e,t,r){return r=zr(r),e.resolve(t,r)}Ae.resolveUrl=Ov;const Iv=/^[a-z_][-a-z0-9._]*$/i;function Tv(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=zr(e[r]||t),o={"":s},a=nd(n,s,!1),i={},c=new Set;return bv(e,{allKeys:!0},(f,v,y,w)=>{if(w===void 0)return;const g=a+v;let $=o[w];typeof f[r]=="string"&&($=m.call(this,f[r])),E.call(this,f.$anchor),E.call(this,f.$dynamicAnchor),o[v]=$;function m(N){const R=this.opts.uriResolver.resolve;if(N=zr($?R($,N):N),c.has(N))throw u(N);c.add(N);let O=this.refs[N];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?d(f,O.schema,N):N!==zr(g)&&(N[0]==="#"?(d(f,i[N],N),i[N]=f):this.refs[N]=g),N}function E(N){if(typeof N=="string"){if(!Iv.test(N))throw new Error(`invalid anchor "${N}"`);m.call(this,`#${N}`)}}}),i;function d(f,v,y){if(v!==void 0&&!Ev(f,v))throw u(y)}function u(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ae.getSchemaRefs=Tv;Object.defineProperty(ht,"__esModule",{value:!0});ht.getData=ht.KeywordCxt=ht.validateFunctionCode=void 0;const od=Kr,Lc=Ne,li=It,Ss=Ne,jv=Vs,_n=bt,co=Bt,W=ie,te=St,Av=Ae,Tt=D,an=An;function kv(e){if(cd(e)&&(ld(e),id(e))){Dv(e);return}ad(e,()=>(0,od.topBoolOrEmptySchema)(e))}ht.validateFunctionCode=kv;function ad({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,W._)`${te.default.data}, ${te.default.valCxt}`,n.$async,()=>{e.code((0,W._)`"use strict"; ${zc(r,s)}`),Mv(e,s),e.code(o)}):e.func(t,(0,W._)`${te.default.data}, ${Cv(s)}`,n.$async,()=>e.code(zc(r,s)).code(o))}function Cv(e){return(0,W._)`{${te.default.instancePath}="", ${te.default.parentData}, ${te.default.parentDataProperty}, ${te.default.rootData}=${te.default.data}${e.dynamicRef?(0,W._)`, ${te.default.dynamicAnchors}={}`:W.nil}}={}`}function Mv(e,t){e.if(te.default.valCxt,()=>{e.var(te.default.instancePath,(0,W._)`${te.default.valCxt}.${te.default.instancePath}`),e.var(te.default.parentData,(0,W._)`${te.default.valCxt}.${te.default.parentData}`),e.var(te.default.parentDataProperty,(0,W._)`${te.default.valCxt}.${te.default.parentDataProperty}`),e.var(te.default.rootData,(0,W._)`${te.default.valCxt}.${te.default.rootData}`),t.dynamicRef&&e.var(te.default.dynamicAnchors,(0,W._)`${te.default.valCxt}.${te.default.dynamicAnchors}`)},()=>{e.var(te.default.instancePath,(0,W._)`""`),e.var(te.default.parentData,(0,W._)`undefined`),e.var(te.default.parentDataProperty,(0,W._)`undefined`),e.var(te.default.rootData,te.default.data),t.dynamicRef&&e.var(te.default.dynamicAnchors,(0,W._)`{}`)})}function Dv(e){const{schema:t,opts:r,gen:n}=e;ad(e,()=>{r.$comment&&t.$comment&&dd(e),Uv(e),n.let(te.default.vErrors,null),n.let(te.default.errors,0),r.unevaluated&&Fv(e),ud(e),Kv(e)})}function Fv(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,W._)`${r}.evaluated`),t.if((0,W._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,W._)`${e.evaluated}.props`,(0,W._)`undefined`)),t.if((0,W._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,W._)`${e.evaluated}.items`,(0,W._)`undefined`))}function zc(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,W._)`/*# sourceURL=${r} */`:W.nil}function Lv(e,t){if(cd(e)&&(ld(e),id(e))){zv(e,t);return}(0,od.boolOrEmptySchema)(e,t)}function id({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 cd(e){return typeof e.schema!="boolean"}function zv(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&dd(e),qv(e),Gv(e);const o=n.const("_errs",te.default.errors);ud(e,o),n.var(t,(0,W._)`${o} === ${te.default.errors}`)}function ld(e){(0,Tt.checkUnknownRules)(e),Vv(e)}function ud(e,t){if(e.opts.jtd)return Vc(e,[],!1,t);const r=(0,Lc.getSchemaTypes)(e.schema),n=(0,Lc.coerceAndCheckDataType)(e,r);Vc(e,r,!n,t)}function Vv(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Tt.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Uv(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Tt.checkStrictMode)(e,"default is ignored in the schema root")}function qv(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Av.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Gv(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function dd({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,W._)`${te.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const a=(0,W.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,W._)`${te.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`)}}function Kv(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,W._)`${te.default.errors} === 0`,()=>t.return(te.default.data),()=>t.throw((0,W._)`new ${s}(${te.default.vErrors})`)):(t.assign((0,W._)`${n}.errors`,te.default.vErrors),o.unevaluated&&Hv(e),t.return((0,W._)`${te.default.errors} === 0`))}function Hv({gen:e,evaluated:t,props:r,items:n}){r instanceof W.Name&&e.assign((0,W._)`${t}.props`,r),n instanceof W.Name&&e.assign((0,W._)`${t}.items`,n)}function Vc(e,t,r,n){const{gen:s,schema:o,data:a,allErrors:i,opts:c,self:d}=e,{RULES:u}=d;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Tt.schemaHasRulesButRef)(o,u))){s.block(()=>md(e,"$ref",u.all.$ref.definition));return}c.jtd||Wv(e,t),s.block(()=>{for(const v of u.rules)f(v);f(u.post)});function f(v){(0,li.shouldUseGroup)(o,v)&&(v.type?(s.if((0,Ss.checkDataType)(v.type,a,c.strictNumbers)),Uc(e,v),t.length===1&&t[0]===v.type&&r&&(s.else(),(0,Ss.reportTypeError)(e)),s.endIf()):Uc(e,v),i||s.if((0,W._)`${te.default.errors} === ${n||0}`))}}function Uc(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,jv.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,li.shouldUseRule)(n,o)&&md(e,o.keyword,o.definition,t.type)})}function Wv(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(xv(e,t),e.opts.allowUnionTypes||Bv(e,t),Yv(e,e.dataTypes))}function xv(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{fd(e.dataTypes,r)||ui(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Xv(e,t)}}function Bv(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ui(e,"use allowUnionTypes to allow union type keyword")}function Yv(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,li.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(a=>Jv(t,a))&&ui(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Jv(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function fd(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Xv(e,t){const r=[];for(const n of e.dataTypes)fd(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ui(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Tt.checkStrictMode)(e,t,e.opts.strictTypes)}class hd{constructor(t,r,n){if((0,_n.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,Tt.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",pd(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,_n.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",te.default.errors))}result(t,r,n){this.failResult((0,W.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,W.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,W._)`${r} !== undefined && (${(0,W.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?an.reportExtraError:an.reportError)(this,this.def.error,r)}$dataError(){(0,an.reportError)(this,this.def.$dataError||an.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,an.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=W.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=W.nil,r=W.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0,W.or)((0,W._)`${s} === undefined`,r)),t!==W.nil&&n.assign(t,!0),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==W.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,W.or)(a(),i());function a(){if(n.length){if(!(r instanceof W.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,W._)`${(0,Ss.checkDataTypes)(c,r,o.opts.strictNumbers,Ss.DataType.Wrong)}`}return W.nil}function i(){if(s.validateSchema){const c=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,W._)`!${c}(${r})`}return W.nil}}subschema(t,r){const n=(0,co.getSubschema)(this.it,t);(0,co.extendSubschemaData)(n,this.it,t),(0,co.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return Lv(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Tt.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Tt.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,W.Name)),!0}}ht.KeywordCxt=hd;function md(e,t,r,n){const s=new hd(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,_n.funcKeywordCode)(s,r):"macro"in r?(0,_n.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,_n.funcKeywordCode)(s,r)}const Zv=/^\/(?:[^~]|~0|~1)*$/,Qv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pd(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return te.default.rootData;if(e[0]==="/"){if(!Zv.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=te.default.rootData}else{const d=Qv.exec(e);if(!d)throw new Error(`Invalid JSON-pointer: ${e}`);const u=+d[1];if(s=d[2],s==="#"){if(u>=t)throw new Error(c("property/index",u));return n[t-u]}if(u>t)throw new Error(c("data",u));if(o=r[t-u],!s)return o}let a=o;const i=s.split("/");for(const d of i)d&&(o=(0,W._)`${o}${(0,W.getProperty)((0,Tt.unescapeJsonPointer)(d))}`,a=(0,W._)`${a} && ${o}`);return a;function c(d,u){return`Cannot access ${d} ${u} levels up, current level is ${t}`}}ht.getData=pd;var kn={};Object.defineProperty(kn,"__esModule",{value:!0});class e0 extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}kn.default=e0;var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});const lo=Ae;class t0 extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,lo.resolveUrl)(t,r,n),this.missingSchema=(0,lo.normalizeId)((0,lo.getFullPath)(t,this.missingRef))}}Xr.default=t0;var We={};Object.defineProperty(We,"__esModule",{value:!0});We.resolveSchema=We.getCompilingSchema=We.resolveRef=We.compileSchema=We.SchemaEnv=void 0;const st=ie,r0=kn,dr=St,dt=Ae,qc=D,n0=ht;class Us{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,dt.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=Us;function di(e){const t=yd.call(this,e);if(t)return t;const r=(0,dt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new st.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let i;e.$async&&(i=a.scopeValue("Error",{ref:r0.default,code:(0,st._)`require("ajv/dist/runtime/validation_error").default`}));const c=a.scopeName("validate");e.validateName=c;const d={gen:a,allErrors:this.opts.allErrors,data:dr.default.data,parentData:dr.default.parentData,parentDataProperty:dr.default.parentDataProperty,dataNames:[dr.default.data],dataPathArr:[st.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,st.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:st.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,st._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,n0.validateFunctionCode)(d),a.optimize(this.opts.code.optimize);const f=a.toString();u=`${a.scopeRefs(dr.default.scope)}return ${f}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const y=new Function(`${dr.default.self}`,`${dr.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:y}),y.errors=null,y.schema=e.schema,y.schemaEnv=e,e.$async&&(y.$async=!0),this.opts.code.source===!0&&(y.source={validateName:c,validateCode:f,scopeValues:a._values}),this.opts.unevaluated){const{props:w,items:g}=d;y.evaluated={props:w instanceof st.Name?void 0:w,items:g instanceof st.Name?void 0:g,dynamicProps:w instanceof st.Name,dynamicItems:g instanceof st.Name},y.source&&(y.source.evaluated=(0,st.stringify)(y.evaluated))}return e.validate=y,e}catch(f){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),f}finally{this._compilations.delete(e)}}We.compileSchema=di;function s0(e,t,r){var n;r=(0,dt.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=i0.call(this,e,r);if(o===void 0){const a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:i}=this.opts;a&&(o=new Us({schema:a,schemaId:i,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=o0.call(this,o)}We.resolveRef=s0;function o0(e){return(0,dt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:di.call(this,e)}function yd(e){for(const t of this._compilations)if(a0(t,e))return t}We.getCompilingSchema=yd;function a0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function i0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||qs.call(this,e,t)}function qs(e,t){const r=this.opts.uriResolver.parse(t),n=(0,dt._getFullPath)(this.opts.uriResolver,r);let s=(0,dt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return uo.call(this,r,e);const o=(0,dt.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){const i=qs.call(this,e,a);return typeof(i==null?void 0:i.schema)!="object"?void 0:uo.call(this,r,i)}if(typeof(a==null?void 0:a.schema)=="object"){if(a.validate||di.call(this,a),o===(0,dt.normalizeId)(t)){const{schema:i}=a,{schemaId:c}=this.opts,d=i[c];return d&&(s=(0,dt.resolveUrl)(this.opts.uriResolver,s,d)),new Us({schema:i,schemaId:c,root:e,baseId:s})}return uo.call(this,r,a)}}We.resolveSchema=qs;const c0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function uo(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const i of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,qc.unescapeFragment)(i)];if(c===void 0)return;r=c;const d=typeof r=="object"&&r[this.opts.schemaId];!c0.has(i)&&d&&(t=(0,dt.resolveUrl)(this.opts.uriResolver,t,d))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,qc.schemaHasRulesButRef)(r,this.RULES)){const i=(0,dt.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=qs.call(this,n,i)}const{schemaId:a}=this.opts;if(o=o||new Us({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}const l0="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",u0="Meta-schema for $data reference (JSON AnySchema extension proposal)",d0="object",f0=["$data"],h0={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},m0=!1,p0={$id:l0,description:u0,type:d0,required:f0,properties:h0,additionalProperties:m0};var fi={};Object.defineProperty(fi,"__esModule",{value:!0});const $d=Nu;$d.code='require("ajv/dist/runtime/uri").default';fi.default=$d;(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=ht;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ie;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=kn,s=Xr,o=Sr,a=We,i=ie,c=Ae,d=Ne,u=D,f=p0,v=fi,y=(P,p)=>new RegExp(P,p);y.code="new RegExp";const w=["removeAdditional","useDefaults","coerceTypes"],g=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."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},E=200;function N(P){var p,S,_,l,h,b,I,j,G,U,ue,xe,Yt,Jt,Xt,Zt,Qt,er,tr,rr,nr,sr,or,ar,ir;const rt=P.strict,cr=(p=P.code)===null||p===void 0?void 0:p.optimize,tn=cr===!0||cr===void 0?1:cr||0,rn=(_=(S=P.code)===null||S===void 0?void 0:S.regExp)!==null&&_!==void 0?_:y,Xs=(l=P.uriResolver)!==null&&l!==void 0?l:v.default;return{strictSchema:(b=(h=P.strictSchema)!==null&&h!==void 0?h:rt)!==null&&b!==void 0?b:!0,strictNumbers:(j=(I=P.strictNumbers)!==null&&I!==void 0?I:rt)!==null&&j!==void 0?j:!0,strictTypes:(U=(G=P.strictTypes)!==null&&G!==void 0?G:rt)!==null&&U!==void 0?U:"log",strictTuples:(xe=(ue=P.strictTuples)!==null&&ue!==void 0?ue:rt)!==null&&xe!==void 0?xe:"log",strictRequired:(Jt=(Yt=P.strictRequired)!==null&&Yt!==void 0?Yt:rt)!==null&&Jt!==void 0?Jt:!1,code:P.code?{...P.code,optimize:tn,regExp:rn}:{optimize:tn,regExp:rn},loopRequired:(Xt=P.loopRequired)!==null&&Xt!==void 0?Xt:E,loopEnum:(Zt=P.loopEnum)!==null&&Zt!==void 0?Zt:E,meta:(Qt=P.meta)!==null&&Qt!==void 0?Qt:!0,messages:(er=P.messages)!==null&&er!==void 0?er:!0,inlineRefs:(tr=P.inlineRefs)!==null&&tr!==void 0?tr:!0,schemaId:(rr=P.schemaId)!==null&&rr!==void 0?rr:"$id",addUsedSchema:(nr=P.addUsedSchema)!==null&&nr!==void 0?nr:!0,validateSchema:(sr=P.validateSchema)!==null&&sr!==void 0?sr:!0,validateFormats:(or=P.validateFormats)!==null&&or!==void 0?or:!0,unicodeRegExp:(ar=P.unicodeRegExp)!==null&&ar!==void 0?ar:!0,int32range:(ir=P.int32range)!==null&&ir!==void 0?ir:!0,uriResolver:Xs}}class R{constructor(p={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,p=this.opts={...p,...N(p)};const{es5:S,lines:_}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:g,es5:S,lines:_}),this.logger=Y(p.logger);const l=p.validateFormats;p.validateFormats=!1,this.RULES=(0,o.getRules)(),O.call(this,$,p,"NOT SUPPORTED"),O.call(this,m,p,"DEPRECATED","warn"),this._metaOpts=Se.call(this),p.formats&&ge.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),p.keywords&&we.call(this,p.keywords),typeof p.meta=="object"&&this.addMetaSchema(p.meta),re.call(this),p.validateFormats=l}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:p,meta:S,schemaId:_}=this.opts;let l=f;_==="id"&&(l={...f},l.id=l.$id,delete l.$id),S&&p&&this.addMetaSchema(l,l[_],!1)}defaultMeta(){const{meta:p,schemaId:S}=this.opts;return this.opts.defaultMeta=typeof p=="object"?p[S]||p:void 0}validate(p,S){let _;if(typeof p=="string"){if(_=this.getSchema(p),!_)throw new Error(`no schema with key or ref "${p}"`)}else _=this.compile(p);const l=_(S);return"$async"in _||(this.errors=_.errors),l}compile(p,S){const _=this._addSchema(p,S);return _.validate||this._compileSchemaEnv(_)}compileAsync(p,S){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:_}=this.opts;return l.call(this,p,S);async function l(U,ue){await h.call(this,U.$schema);const xe=this._addSchema(U,ue);return xe.validate||b.call(this,xe)}async function h(U){U&&!this.getSchema(U)&&await l.call(this,{$ref:U},!0)}async function b(U){try{return this._compileSchemaEnv(U)}catch(ue){if(!(ue instanceof s.default))throw ue;return I.call(this,ue),await j.call(this,ue.missingSchema),b.call(this,U)}}function I({missingSchema:U,missingRef:ue}){if(this.refs[U])throw new Error(`AnySchema ${U} is loaded but ${ue} cannot be resolved`)}async function j(U){const ue=await G.call(this,U);this.refs[U]||await h.call(this,ue.$schema),this.refs[U]||this.addSchema(ue,U,S)}async function G(U){const ue=this._loading[U];if(ue)return ue;try{return await(this._loading[U]=_(U))}finally{delete this._loading[U]}}}addSchema(p,S,_,l=this.opts.validateSchema){if(Array.isArray(p)){for(const b of p)this.addSchema(b,void 0,_,l);return this}let h;if(typeof p=="object"){const{schemaId:b}=this.opts;if(h=p[b],h!==void 0&&typeof h!="string")throw new Error(`schema ${b} must be string`)}return S=(0,c.normalizeId)(S||h),this._checkUnique(S),this.schemas[S]=this._addSchema(p,_,S,l,!0),this}addMetaSchema(p,S,_=this.opts.validateSchema){return this.addSchema(p,S,!0,_),this}validateSchema(p,S){if(typeof p=="boolean")return!0;let _;if(_=p.$schema,_!==void 0&&typeof _!="string")throw new Error("$schema must be a string");if(_=_||this.opts.defaultMeta||this.defaultMeta(),!_)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const l=this.validate(_,p);if(!l&&S){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return l}getSchema(p){let S;for(;typeof(S=x.call(this,p))=="string";)p=S;if(S===void 0){const{schemaId:_}=this.opts,l=new a.SchemaEnv({schema:{},schemaId:_});if(S=a.resolveSchema.call(this,l,p),!S)return;this.refs[p]=S}return S.validate||this._compileSchemaEnv(S)}removeSchema(p){if(p instanceof RegExp)return this._removeAllSchemas(this.schemas,p),this._removeAllSchemas(this.refs,p),this;switch(typeof p){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const S=x.call(this,p);return typeof S=="object"&&this._cache.delete(S.schema),delete this.schemas[p],delete this.refs[p],this}case"object":{const S=p;this._cache.delete(S);let _=p[this.opts.schemaId];return _&&(_=(0,c.normalizeId)(_),delete this.schemas[_],delete this.refs[_]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(p){for(const S of p)this.addKeyword(S);return this}addKeyword(p,S){let _;if(typeof p=="string")_=p,typeof S=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),S.keyword=_);else if(typeof p=="object"&&S===void 0){if(S=p,_=S.keyword,Array.isArray(_)&&!_.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(T.call(this,_,S),!S)return(0,u.eachItem)(_,h=>A.call(this,h)),this;F.call(this,S);const l={...S,type:(0,d.getJSONTypes)(S.type),schemaType:(0,d.getJSONTypes)(S.schemaType)};return(0,u.eachItem)(_,l.type.length===0?h=>A.call(this,h,l):h=>l.type.forEach(b=>A.call(this,h,l,b))),this}getKeyword(p){const S=this.RULES.all[p];return typeof S=="object"?S.definition:!!S}removeKeyword(p){const{RULES:S}=this;delete S.keywords[p],delete S.all[p];for(const _ of S.rules){const l=_.rules.findIndex(h=>h.keyword===p);l>=0&&_.rules.splice(l,1)}return this}addFormat(p,S){return typeof S=="string"&&(S=new RegExp(S)),this.formats[p]=S,this}errorsText(p=this.errors,{separator:S=", ",dataVar:_="data"}={}){return!p||p.length===0?"No errors":p.map(l=>`${_}${l.instancePath} ${l.message}`).reduce((l,h)=>l+S+h)}$dataMetaSchema(p,S){const _=this.RULES.all;p=JSON.parse(JSON.stringify(p));for(const l of S){const h=l.split("/").slice(1);let b=p;for(const I of h)b=b[I];for(const I in _){const j=_[I];if(typeof j!="object")continue;const{$data:G}=j.definition,U=b[I];G&&U&&(b[I]=L(U))}}return p}_removeAllSchemas(p,S){for(const _ in p){const l=p[_];(!S||S.test(_))&&(typeof l=="string"?delete p[_]:l&&!l.meta&&(this._cache.delete(l.schema),delete p[_]))}}_addSchema(p,S,_,l=this.opts.validateSchema,h=this.opts.addUsedSchema){let b;const{schemaId:I}=this.opts;if(typeof p=="object")b=p[I];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof p!="boolean")throw new Error("schema must be object or boolean")}let j=this._cache.get(p);if(j!==void 0)return j;_=(0,c.normalizeId)(b||_);const G=c.getSchemaRefs.call(this,p,_);return j=new a.SchemaEnv({schema:p,schemaId:I,meta:S,baseId:_,localRefs:G}),this._cache.set(j.schema,j),h&&!_.startsWith("#")&&(_&&this._checkUnique(_),this.refs[_]=j),l&&this.validateSchema(p,!0),j}_checkUnique(p){if(this.schemas[p]||this.refs[p])throw new Error(`schema with key or id "${p}" already exists`)}_compileSchemaEnv(p){if(p.meta?this._compileMetaSchema(p):a.compileSchema.call(this,p),!p.validate)throw new Error("ajv implementation error");return p.validate}_compileMetaSchema(p){const S=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,p)}finally{this.opts=S}}}R.ValidationError=n.default,R.MissingRefError=s.default,e.default=R;function O(P,p,S,_="error"){for(const l in P){const h=l;h in p&&this.logger[_](`${S}: option ${l}. ${P[h]}`)}}function x(P){return P=(0,c.normalizeId)(P),this.schemas[P]||this.refs[P]}function re(){const P=this.opts.schemas;if(P)if(Array.isArray(P))this.addSchema(P);else for(const p in P)this.addSchema(P[p],p)}function ge(){for(const P in this.opts.formats){const p=this.opts.formats[P];p&&this.addFormat(P,p)}}function we(P){if(Array.isArray(P)){this.addVocabulary(P);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const p in P){const S=P[p];S.keyword||(S.keyword=p),this.addKeyword(S)}}function Se(){const P={...this.opts};for(const p of w)delete P[p];return P}const K={log(){},warn(){},error(){}};function Y(P){if(P===!1)return K;if(P===void 0)return console;if(P.log&&P.warn&&P.error)return P;throw new Error("logger must implement log, warn and error methods")}const fe=/^[a-z_$][a-z0-9_$:-]*$/i;function T(P,p){const{RULES:S}=this;if((0,u.eachItem)(P,_=>{if(S.keywords[_])throw new Error(`Keyword ${_} is already defined`);if(!fe.test(_))throw new Error(`Keyword ${_} has invalid name`)}),!!p&&p.$data&&!("code"in p||"validate"in p))throw new Error('$data keyword must have "code" or "validate" function')}function A(P,p,S){var _;const l=p==null?void 0:p.post;if(S&&l)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let b=l?h.post:h.rules.find(({type:j})=>j===S);if(b||(b={type:S,rules:[]},h.rules.push(b)),h.keywords[P]=!0,!p)return;const I={keyword:P,definition:{...p,type:(0,d.getJSONTypes)(p.type),schemaType:(0,d.getJSONTypes)(p.schemaType)}};p.before?V.call(this,b,I,p.before):b.rules.push(I),h.all[P]=I,(_=p.implements)===null||_===void 0||_.forEach(j=>this.addKeyword(j))}function V(P,p,S){const _=P.rules.findIndex(l=>l.keyword===S);_>=0?P.rules.splice(_,0,p):(P.rules.push(p),this.logger.warn(`rule ${S} is not defined`))}function F(P){let{metaSchema:p}=P;p!==void 0&&(P.$data&&this.opts.$data&&(p=L(p)),P.validateSchema=this.compile(p,!0))}const B={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function L(P){return{anyOf:[P,B]}}})(zu);var hi={},mi={},pi={};Object.defineProperty(pi,"__esModule",{value:!0});const y0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pi.default=y0;var Pr={};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.callRef=Pr.getValidate=void 0;const $0=Xr,Gc=le,Ke=ie,Tr=St,Kc=We,Kn=D,g0={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:c}=n,{root:d}=o;if((r==="#"||r==="#/")&&s===d.baseId)return f();const u=Kc.resolveRef.call(c,d,s,r);if(u===void 0)throw new $0.default(n.opts.uriResolver,s,r);if(u instanceof Kc.SchemaEnv)return v(u);return y(u);function f(){if(o===d)return ds(e,a,o,o.$async);const w=t.scopeValue("root",{ref:d});return ds(e,(0,Ke._)`${w}.validate`,d,d.$async)}function v(w){const g=gd(e,w);ds(e,g,w,w.$async)}function y(w){const g=t.scopeValue("schema",i.code.source===!0?{ref:w,code:(0,Ke.stringify)(w)}:{ref:w}),$=t.name("valid"),m=e.subschema({schema:w,dataTypes:[],schemaPath:Ke.nil,topSchemaRef:g,errSchemaPath:r},$);e.mergeEvaluated(m),e.ok($)}}};function gd(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ke._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Pr.getValidate=gd;function ds(e,t,r,n){const{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:c}=o,d=c.passContext?Tr.default.this:Ke.nil;n?u():f();function u(){if(!i.$async)throw new Error("async schema referenced by sync schema");const w=s.let("valid");s.try(()=>{s.code((0,Ke._)`await ${(0,Gc.callValidateCode)(e,t,d)}`),y(t),a||s.assign(w,!0)},g=>{s.if((0,Ke._)`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),v(g),a||s.assign(w,!1)}),e.ok(w)}function f(){e.result((0,Gc.callValidateCode)(e,t,d),()=>y(t),()=>v(t))}function v(w){const g=(0,Ke._)`${w}.errors`;s.assign(Tr.default.vErrors,(0,Ke._)`${Tr.default.vErrors} === null ? ${g} : ${Tr.default.vErrors}.concat(${g})`),s.assign(Tr.default.errors,(0,Ke._)`${Tr.default.vErrors}.length`)}function y(w){var g;if(!o.opts.unevaluated)return;const $=(g=r==null?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(o.props=Kn.mergeEvaluated.props(s,$.props,o.props));else{const m=s.var("props",(0,Ke._)`${w}.evaluated.props`);o.props=Kn.mergeEvaluated.props(s,m,o.props,Ke.Name)}if(o.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(o.items=Kn.mergeEvaluated.items(s,$.items,o.items));else{const m=s.var("items",(0,Ke._)`${w}.evaluated.items`);o.items=Kn.mergeEvaluated.items(s,m,o.items,Ke.Name)}}}Pr.callRef=ds;Pr.default=g0;Object.defineProperty(mi,"__esModule",{value:!0});const _0=pi,v0=Pr,w0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_0.default,v0.default];mi.default=w0;var yi={},$i={};Object.defineProperty($i,"__esModule",{value:!0});const Ps=ie,zt=Ps.operators,Ns={maximum:{okStr:"<=",ok:zt.LTE,fail:zt.GT},minimum:{okStr:">=",ok:zt.GTE,fail:zt.LT},exclusiveMaximum:{okStr:"<",ok:zt.LT,fail:zt.GTE},exclusiveMinimum:{okStr:">",ok:zt.GT,fail:zt.LTE}},E0={message:({keyword:e,schemaCode:t})=>(0,Ps.str)`must be ${Ns[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ps._)`{comparison: ${Ns[e].okStr}, limit: ${t}}`},b0={keyword:Object.keys(Ns),type:"number",schemaType:"number",$data:!0,error:E0,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ps._)`${r} ${Ns[t].fail} ${n} || isNaN(${r})`)}};$i.default=b0;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const vn=ie,S0={message:({schemaCode:e})=>(0,vn.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,vn._)`{multipleOf: ${e}}`},P0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:S0,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0,vn._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,vn._)`${a} !== parseInt(${a})`;e.fail$data((0,vn._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`)}};gi.default=P0;var _i={},vi={};Object.defineProperty(vi,"__esModule",{value:!0});function _d(e){const t=e.length;let r=0,n=0,s;for(;n=55296&&s<=56319&&n(0,$r._)`{limit: ${e}}`},I0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:O0,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?$r.operators.GT:$r.operators.LT,a=s.opts.unicode===!1?(0,$r._)`${r}.length`:(0,$r._)`${(0,N0.useFunc)(e.gen,R0.default)}(${r})`;e.fail$data((0,$r._)`${a} ${o} ${n}`)}};_i.default=I0;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});const T0=le,Rs=ie,j0={message:({schemaCode:e})=>(0,Rs.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Rs._)`{pattern: ${e}}`},A0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:j0,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,a=o.opts.unicodeRegExp?"u":"",i=r?(0,Rs._)`(new RegExp(${s}, ${a}))`:(0,T0.usePattern)(e,n);e.fail$data((0,Rs._)`!${i}.test(${t})`)}};wi.default=A0;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});const wn=ie,k0={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,wn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,wn._)`{limit: ${e}}`},C0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:k0,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?wn.operators.GT:wn.operators.LT;e.fail$data((0,wn._)`Object.keys(${r}).length ${s} ${n}`)}};Ei.default=C0;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});const cn=le,En=ie,M0=D,D0={message:({params:{missingProperty:e}})=>(0,En.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,En._)`{missingProperty: ${e}}`},F0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:D0,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:a}=e,{opts:i}=a;if(!o&&r.length===0)return;const c=r.length>=i.loopRequired;if(a.allErrors?d():u(),i.strictRequired){const y=e.parentSchema.properties,{definedProperties:w}=e.it;for(const g of r)if((y==null?void 0:y[g])===void 0&&!w.has(g)){const $=a.schemaEnv.baseId+a.errSchemaPath,m=`required property "${g}" is not defined at "${$}" (strictRequired)`;(0,M0.checkStrictMode)(a,m,a.opts.strictRequired)}}function d(){if(c||o)e.block$data(En.nil,f);else for(const y of r)(0,cn.checkReportMissingProp)(e,y)}function u(){const y=t.let("missing");if(c||o){const w=t.let("valid",!0);e.block$data(w,()=>v(y,w)),e.ok(w)}else t.if((0,cn.checkMissingProp)(e,r,y)),(0,cn.reportMissingProp)(e,y),t.else()}function f(){t.forOf("prop",n,y=>{e.setParams({missingProperty:y}),t.if((0,cn.noPropertyInData)(t,s,y,i.ownProperties),()=>e.error())})}function v(y,w){e.setParams({missingProperty:y}),t.forOf(y,n,()=>{t.assign(w,(0,cn.propertyInData)(t,s,y,i.ownProperties)),t.if((0,En.not)(w),()=>{e.error(),t.break()})},En.nil)}}};bi.default=F0;var Si={};Object.defineProperty(Si,"__esModule",{value:!0});const bn=ie,L0={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,bn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,bn._)`{limit: ${e}}`},z0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:L0,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?bn.operators.GT:bn.operators.LT;e.fail$data((0,bn._)`${r}.length ${s} ${n}`)}};Si.default=z0;var Pi={},Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});const vd=ks;vd.code='require("ajv/dist/runtime/equal").default';Cn.default=vd;Object.defineProperty(Pi,"__esModule",{value:!0});const fo=Ne,Te=ie,V0=D,U0=Cn,q0={message:({params:{i:e,j:t}})=>(0,Te.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Te._)`{i: ${e}, j: ${t}}`},G0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:q0,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;const c=t.let("valid"),d=o.items?(0,fo.getSchemaTypes)(o.items):[];e.block$data(c,u,(0,Te._)`${a} === false`),e.ok(c);function u(){const w=t.let("i",(0,Te._)`${r}.length`),g=t.let("j");e.setParams({i:w,j:g}),t.assign(c,!0),t.if((0,Te._)`${w} > 1`,()=>(f()?v:y)(w,g))}function f(){return d.length>0&&!d.some(w=>w==="object"||w==="array")}function v(w,g){const $=t.name("item"),m=(0,fo.checkDataTypes)(d,$,i.opts.strictNumbers,fo.DataType.Wrong),E=t.const("indices",(0,Te._)`{}`);t.for((0,Te._)`;${w}--;`,()=>{t.let($,(0,Te._)`${r}[${w}]`),t.if(m,(0,Te._)`continue`),d.length>1&&t.if((0,Te._)`typeof ${$} == "string"`,(0,Te._)`${$} += "_"`),t.if((0,Te._)`typeof ${E}[${$}] == "number"`,()=>{t.assign(g,(0,Te._)`${E}[${$}]`),e.error(),t.assign(c,!1).break()}).code((0,Te._)`${E}[${$}] = ${w}`)})}function y(w,g){const $=(0,V0.useFunc)(t,U0.default),m=t.name("outer");t.label(m).for((0,Te._)`;${w}--;`,()=>t.for((0,Te._)`${g} = ${w}; ${g}--;`,()=>t.if((0,Te._)`${$}(${r}[${w}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(m)})))}}};Pi.default=G0;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});const Uo=ie,K0=D,H0=Cn,W0={message:"must be equal to constant",params:({schemaCode:e})=>(0,Uo._)`{allowedValue: ${e}}`},x0={keyword:"const",$data:!0,error:W0,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Uo._)`!${(0,K0.useFunc)(t,H0.default)}(${r}, ${s})`):e.fail((0,Uo._)`${o} !== ${r}`)}};Ni.default=x0;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});const hn=ie,B0=D,Y0=Cn,J0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,hn._)`{allowedValues: ${e}}`},X0={keyword:"enum",schemaType:"array",$data:!0,error:J0,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const i=s.length>=a.opts.loopEnum;let c;const d=()=>c??(c=(0,B0.useFunc)(t,Y0.default));let u;if(i||n)u=t.let("valid"),e.block$data(u,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const y=t.const("vSchema",o);u=(0,hn.or)(...s.map((w,g)=>v(y,g)))}e.pass(u);function f(){t.assign(u,!1),t.forOf("v",o,y=>t.if((0,hn._)`${d()}(${r}, ${y})`,()=>t.assign(u,!0).break()))}function v(y,w){const g=s[w];return typeof g=="object"&&g!==null?(0,hn._)`${d()}(${r}, ${y}[${w}])`:(0,hn._)`${r} === ${g}`}}};Ri.default=X0;Object.defineProperty(yi,"__esModule",{value:!0});const Z0=$i,Q0=gi,ew=_i,tw=wi,rw=Ei,nw=bi,sw=Si,ow=Pi,aw=Ni,iw=Ri,cw=[Z0.default,Q0.default,ew.default,tw.default,rw.default,nw.default,sw.default,ow.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},aw.default,iw.default];yi.default=cw;var Oi={},Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.validateAdditionalItems=void 0;const gr=ie,qo=D,lw={message:({params:{len:e}})=>(0,gr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,gr._)`{limit: ${e}}`},uw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lw,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,qo.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}wd(e,n)}};function wd(e,t){const{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=!0;const i=r.const("len",(0,gr._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,gr._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0,qo.alwaysValidSchema)(a,n)){const d=r.var("valid",(0,gr._)`${i} <= ${t.length}`);r.if((0,gr.not)(d),()=>c(d)),e.ok(d)}function c(d){r.forRange("i",t.length,i,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:qo.Type.Num},d),a.allErrors||r.if((0,gr.not)(d),()=>r.break())})}}Zr.validateAdditionalItems=wd;Zr.default=uw;var Ii={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.validateTuple=void 0;const Hc=ie,fs=D,dw=le,fw={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Ed(e,"additionalItems",t);r.items=!0,!(0,fs.alwaysValidSchema)(r,t)&&e.ok((0,dw.validateArray)(e))}};function Ed(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;u(s),i.opts.unevaluated&&r.length&&i.items!==!0&&(i.items=fs.mergeEvaluated.items(n,r.length,i.items));const c=n.name("valid"),d=n.const("len",(0,Hc._)`${o}.length`);r.forEach((f,v)=>{(0,fs.alwaysValidSchema)(i,f)||(n.if((0,Hc._)`${d} > ${v}`,()=>e.subschema({keyword:a,schemaProp:v,dataProp:v},c)),e.ok(c))});function u(f){const{opts:v,errSchemaPath:y}=i,w=r.length,g=w===f.minItems&&(w===f.maxItems||f[t]===!1);if(v.strictTuples&&!g){const $=`"${a}" is ${w}-tuple, but minItems or maxItems/${t} are not specified or different at path "${y}"`;(0,fs.checkStrictMode)(i,$,v.strictTuples)}}}Qr.validateTuple=Ed;Qr.default=fw;Object.defineProperty(Ii,"__esModule",{value:!0});const hw=Qr,mw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hw.validateTuple)(e,"items")};Ii.default=mw;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});const Wc=ie,pw=D,yw=le,$w=Zr,gw={message:({params:{len:e}})=>(0,Wc.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Wc._)`{limit: ${e}}`},_w={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gw,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,pw.alwaysValidSchema)(n,t)&&(s?(0,$w.validateAdditionalItems)(e,s):e.ok((0,yw.validateArray)(e)))}};Ti.default=_w;var ji={};Object.defineProperty(ji,"__esModule",{value:!0});const tt=ie,Hn=D,vw={message:({params:{min:e,max:t}})=>t===void 0?(0,tt.str)`must contain at least ${e} valid item(s)`:(0,tt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,tt._)`{minContains: ${e}}`:(0,tt._)`{minContains: ${e}, maxContains: ${t}}`},ww={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:vw,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let a,i;const{minContains:c,maxContains:d}=n;o.opts.next?(a=c===void 0?1:c,i=d):a=1;const u=t.const("len",(0,tt._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0,Hn.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0,Hn.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Hn.alwaysValidSchema)(o,r)){let g=(0,tt._)`${u} >= ${a}`;i!==void 0&&(g=(0,tt._)`${g} && ${u} <= ${i}`),e.pass(g);return}o.items=!0;const f=t.name("valid");i===void 0&&a===1?y(f,()=>t.if(f,()=>t.break())):a===0?(t.let(f,!0),i!==void 0&&t.if((0,tt._)`${s}.length > 0`,v)):(t.let(f,!1),v()),e.result(f,()=>e.reset());function v(){const g=t.name("_valid"),$=t.let("count",0);y(g,()=>t.if(g,()=>w($)))}function y(g,$){t.forRange("i",0,u,m=>{e.subschema({keyword:"contains",dataProp:m,dataPropType:Hn.Type.Num,compositeRule:!0},g),$()})}function w(g){t.code((0,tt._)`${g}++`),i===void 0?t.if((0,tt._)`${g} >= ${a}`,()=>t.assign(f,!0).break()):(t.if((0,tt._)`${g} > ${i}`,()=>t.assign(f,!1).break()),a===1?t.assign(f,!0):t.if((0,tt._)`${g} >= ${a}`,()=>t.assign(f,!0)))}}};ji.default=ww;var bd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ie,r=D,n=le;e.error={message:({params:{property:c,depsCount:d,deps:u}})=>{const f=d===1?"property":"properties";return(0,t.str)`must have ${f} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:d,deps:u,missingProperty:f}})=>(0,t._)`{property: ${c}, missingProperty: ${f}, depsCount: ${d}, - deps: ${l}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[d,l]=o(c);i(c,d),a(c,l)}};function o({schema:c}){const d={},l={};for(const f in c){if(f==="__proto__")continue;const y=Array.isArray(c[f])?d:l;y[f]=c[f]}return[d,l]}function i(c,d=c.schema){const{gen:l,data:f,it:y}=c;if(Object.keys(d).length===0)return;const m=l.let("missing");for(const $ in d){const g=d[$];if(g.length===0)continue;const _=(0,n.propertyInData)(l,f,$,y.opts.ownProperties);c.setParams({property:$,depsCount:g.length,deps:g.join(", ")}),y.allErrors?l.if(_,()=>{for(const p of g)(0,n.checkReportMissingProp)(c,p)}):(l.if((0,t._)`${_} && (${(0,n.checkMissingProp)(c,g,m)})`),(0,n.reportMissingProp)(c,m),l.else())}}e.validatePropertyDeps=i;function a(c,d=c.schema){const{gen:l,data:f,keyword:y,it:m}=c,$=l.name("valid");for(const g in d)(0,r.alwaysValidSchema)(m,d[g])||(l.if((0,n.propertyInData)(l,f,g,m.opts.ownProperties),()=>{const _=c.subschema({keyword:y,schemaProp:g},$);c.mergeValidEvaluated(_,$)},()=>l.var($,!0)),c.ok($))}e.validateSchemaDeps=a,e.default=s})(Pu);var li={};Object.defineProperty(li,"__esModule",{value:!0});const Nu=ue,ev=x,tv={message:"property name must be valid",params:({params:e})=>(0,Nu._)`{propertyName: ${e.propertyName}}`},rv={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:tv,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,ev.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,Nu.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};li.default=rv;var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});const Tn=fe,ht=ue,nv=Pt,jn=x,sv={message:"must NOT have additional properties",params:({params:e})=>(0,ht._)`{additionalProperty: ${e.additionalProperty}}`},ov={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sv,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,jn.alwaysValidSchema)(i,r))return;const d=(0,Tn.allSchemaProperties)(n.properties),l=(0,Tn.allSchemaProperties)(n.patternProperties);f(),e.ok((0,ht._)`${o} === ${nv.default.errors}`);function f(){t.forIn("key",s,_=>{!d.length&&!l.length?$(_):t.if(y(_),()=>$(_))})}function y(_){let p;if(d.length>8){const S=(0,jn.schemaRefOrVal)(i,n.properties,"properties");p=(0,Tn.isOwnProperty)(t,S,_)}else d.length?p=(0,ht.or)(...d.map(S=>(0,ht._)`${_} === ${S}`)):p=ht.nil;return l.length&&(p=(0,ht.or)(p,...l.map(S=>(0,ht._)`${(0,Tn.usePattern)(e,S)}.test(${_})`))),(0,ht.not)(p)}function m(_){t.code((0,ht._)`delete ${s}[${_}]`)}function $(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,jn.alwaysValidSchema)(i,r)){const p=t.name("valid");c.removeAdditional==="failing"?(g(_,p,!1),t.if((0,ht.not)(p),()=>{e.reset(),m(_)})):(g(_,p),a||t.if((0,ht.not)(p),()=>t.break()))}}function g(_,p,S){const R={keyword:"additionalProperties",dataProp:_,dataPropType:jn.Type.Str};S===!1&&Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(R,p)}}};Ps.default=ov;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});const av=Es(),Sc=fe,Ws=x,Pc=Ps,iv={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Pc.default.code(new av.KeywordCxt(o,Pc.default,"additionalProperties"));const i=(0,Sc.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Ws.mergeEvaluated.props(t,(0,Ws.toHash)(i),o.props));const a=i.filter(f=>!(0,Ws.alwaysValidSchema)(o,r[f]));if(a.length===0)return;const c=t.name("valid");for(const f of a)d(f)?l(f):(t.if((0,Sc.propertyInData)(t,s,f,o.opts.ownProperties)),l(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function d(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};ui.default=iv;var di={};Object.defineProperty(di,"__esModule",{value:!0});const Nc=fe,An=ue,Rc=x,Oc=x,cv={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,a=(0,Nc.allSchemaProperties)(r),c=a.filter(g=>(0,Rc.alwaysValidSchema)(o,r[g]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;const d=i.strictSchema&&!i.allowMatchingProperties&&s.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof An.Name)&&(o.props=(0,Oc.evaluatedPropsToName)(t,o.props));const{props:f}=o;y();function y(){for(const g of a)d&&m(g),o.allErrors?$(g):(t.var(l,!0),$(g),t.if(l))}function m(g){for(const _ in d)new RegExp(g).test(_)&&(0,Rc.checkStrictMode)(o,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function $(g){t.forIn("key",n,_=>{t.if((0,An._)`${(0,Nc.usePattern)(e,g)}.test(${_})`,()=>{const p=c.includes(g);p||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:Oc.Type.Str},l),o.opts.unevaluated&&f!==!0?t.assign((0,An._)`${f}[${_}]`,!0):!p&&!o.allErrors&&t.if((0,An.not)(l),()=>t.break())})})}}};di.default=cv;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});const lv=x,uv={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,lv.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"}};fi.default=uv;var hi={};Object.defineProperty(hi,"__esModule",{value:!0});const dv=fe,fv={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:dv.validateUnion,error:{message:"must match a schema in anyOf"}};hi.default=fv;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});const Xn=ue,hv=x,mv={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Xn._)`{passingSchemas: ${e.passing}}`},pv={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:mv,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(d),e.result(i,()=>e.reset(),()=>e.error(!0));function d(){o.forEach((l,f)=>{let y;(0,hv.alwaysValidSchema)(s,l)?t.var(c,!0):y=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,Xn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Xn._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,f),y&&e.mergeEvaluated(y,Xn.Name)})})}}};mi.default=pv;var pi={};Object.defineProperty(pi,"__esModule",{value:!0});const yv=x,gv={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,yv.alwaysValidSchema)(n,o))return;const a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};pi.default=gv;var yi={};Object.defineProperty(yi,"__esModule",{value:!0});const us=ue,Ru=x,$v={message:({params:e})=>(0,us.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,us._)`{failingKeyword: ${e.ifClause}}`},_v={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:$v,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Ru.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=Ic(n,"then"),o=Ic(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){const l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,d("then",l),d("else",l))}else s?t.if(a,d("then")):t.if((0,us.not)(a),d("else"));e.pass(i,()=>e.error(!0));function c(){const l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function d(l,f){return()=>{const y=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(y,i),f?t.assign(f,(0,us._)`${l}`):e.setParams({ifClause:l})}}}};function Ic(e,t){const r=e.schema[t];return r!==void 0&&!(0,Ru.alwaysValidSchema)(e,r)}yi.default=_v;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const vv=x,wv={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,vv.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};gi.default=wv;Object.defineProperty(oi,"__esModule",{value:!0});const Ev=Lr,bv=ai,Sv=zr,Pv=ii,Nv=ci,Rv=Pu,Ov=li,Iv=Ps,Tv=ui,jv=di,Av=fi,kv=hi,Cv=mi,Mv=pi,Dv=yi,Fv=gi;function Lv(e=!1){const t=[Av.default,kv.default,Cv.default,Mv.default,Dv.default,Fv.default,Ov.default,Iv.default,Rv.default,Tv.default,jv.default];return e?t.push(bv.default,Pv.default):t.push(Ev.default,Sv.default),t.push(Nv.default),t}oi.default=Lv;var $i={},_i={};Object.defineProperty(_i,"__esModule",{value:!0});const je=ue,zv={message:({schemaCode:e})=>(0,je.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,je._)`{format: ${e}}`},Vv={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:zv,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:d,schemaEnv:l,self:f}=a;if(!c.validateFormats)return;s?y():m();function y(){const $=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),g=r.const("fDef",(0,je._)`${$}[${i}]`),_=r.let("fType"),p=r.let("format");r.if((0,je._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,(0,je._)`${g}.type || "string"`).assign(p,(0,je._)`${g}.validate`),()=>r.assign(_,(0,je._)`"string"`).assign(p,g)),e.fail$data((0,je.or)(S(),R()));function S(){return c.strictSchema===!1?je.nil:(0,je._)`${i} && !${p}`}function R(){const T=l.$async?(0,je._)`(${g}.async ? await ${p}(${n}) : ${p}(${n}))`:(0,je._)`${p}(${n})`,A=(0,je._)`(typeof ${p} == "function" ? ${T} : ${p}.test(${n}))`;return(0,je._)`${p} && ${p} !== true && ${_} === ${t} && !${A}`}}function m(){const $=f.formats[o];if(!$){S();return}if($===!0)return;const[g,_,p]=R($);g===t&&e.pass(T());function S(){if(c.strictSchema===!1){f.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${o}" ignored in schema at path "${d}"`}}function R(A){const B=A instanceof RegExp?(0,je.regexpCode)(A):c.code.formats?(0,je._)`${c.code.formats}${(0,je.getProperty)(o)}`:void 0,Z=r.scopeValue("formats",{key:o,ref:A,code:B});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,je._)`${Z}.validate`]:["string",A,Z]}function T(){if(typeof $=="object"&&!($ instanceof RegExp)&&$.async){if(!l.$async)throw new Error("async format in sync schema");return(0,je._)`await ${p}(${n})`}return typeof _=="function"?(0,je._)`${p}(${n})`:(0,je._)`${p}.test(${n})`}}}};_i.default=Vv;Object.defineProperty($i,"__esModule",{value:!0});const Uv=_i,qv=[Uv.default];$i.default=qv;var jr={};Object.defineProperty(jr,"__esModule",{value:!0});jr.contentVocabulary=jr.metadataVocabulary=void 0;jr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];jr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Ka,"__esModule",{value:!0});const Gv=Ha,Kv=xa,Hv=oi,Wv=$i,Tc=jr,xv=[Gv.default,Kv.default,(0,Hv.default)(),Wv.default,Tc.metadataVocabulary,Tc.contentVocabulary];Ka.default=xv;var vi={},Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.DiscrError=void 0;var jc;(function(e){e.Tag="tag",e.Mapping="mapping"})(jc||(Ns.DiscrError=jc={}));Object.defineProperty(vi,"__esModule",{value:!0});const wr=ue,bo=Ns,Ac=Xe,Bv=Fr,Yv=x,Jv={message:({params:{discrError:e,tagName:t}})=>e===bo.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,wr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Xv={keyword:"discriminator",type:"object",schemaType:"object",error:Jv,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),d=t.const("tag",(0,wr._)`${r}${(0,wr.getProperty)(a)}`);t.if((0,wr._)`typeof ${d} == "string"`,()=>l(),()=>e.error(!1,{discrError:bo.DiscrError.Tag,tag:d,tagName:a})),e.ok(c);function l(){const m=y();t.if(!1);for(const $ in m)t.elseIf((0,wr._)`${d} === ${$}`),t.assign(c,f(m[$]));t.else(),e.error(!1,{discrError:bo.DiscrError.Mapping,tag:d,tagName:a}),t.endIf()}function f(m){const $=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},$);return e.mergeEvaluated(g,wr.Name),$}function y(){var m;const $={},g=p(s);let _=!0;for(let T=0;Tthis.addVocabulary($)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const $=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema($,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var d=Es();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var l=ue;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var f=yn;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var y=Fr;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return y.default}})})(yo,yo.exports);var o0=yo.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=o0,r=ue,n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},o={message:({keyword:a,schemaCode:c})=>(0,r.str)`should be ${s[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${s[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:o,code(a){const{gen:c,data:d,schemaCode:l,keyword:f,it:y}=a,{opts:m,self:$}=y;if(!m.validateFormats)return;const g=new t.KeywordCxt(y,$.RULES.all.format.definition,"format");g.$data?_():p();function _(){const R=c.scopeValue("formats",{ref:$.formats,code:m.code.formats}),T=c.const("fmt",(0,r._)`${R}[${g.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${T} != "object"`,(0,r._)`${T} instanceof RegExp`,(0,r._)`typeof ${T}.compare != "function"`,S(T)))}function p(){const R=g.schema,T=$.formats[R];if(!T||T===!0)return;if(typeof T!="object"||T instanceof RegExp||typeof T.compare!="function")throw new Error(`"${f}": format "${R}" does not define "compare" function`);const A=c.scopeValue("formats",{key:R,ref:T,code:m.code.formats?(0,r._)`${m.code.formats}${(0,r.getProperty)(R)}`:void 0});a.fail$data(S(A))}function S(R){return(0,r._)`${R}.compare(${d}, ${l}) ${s[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i})(eu);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Ql,n=eu,s=ue,o=new s.Name("fullFormats"),i=new s.Name("fastFormats"),a=(d,l={keywords:!0})=>{if(Array.isArray(l))return c(d,l,r.fullFormats,o),d;const[f,y]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,o],m=l.formats||r.formatNames;return c(d,m,f,y),l.keywords&&(0,n.default)(d),d};a.get=(d,l="full")=>{const y=(l==="fast"?r.fastFormats:r.fullFormats)[d];if(!y)throw new Error(`Unknown format "${d}"`);return y};function c(d,l,f,y){var m,$;(m=($=d.opts.code).formats)!==null&&m!==void 0||($.formats=(0,s._)`require("ajv-formats/dist/formats").${y}`);for(const g of l)d.addFormat(g,f[g])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a})(po,po.exports);var a0=po.exports;const i0=ml(a0),c0=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const s=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!l0(s,o)&&n||Object.defineProperty(e,r,o)},l0=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},u0=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},d0=(e,t)=>`/* Wrapped ${e}*/ -${t}`,f0=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),h0=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),m0=(e,t,r)=>{const n=r===""?"":`with ${r.trim()}() `,s=d0.bind(null,n,t.toString());Object.defineProperty(s,"name",h0);const{writable:o,enumerable:i,configurable:a}=f0;Object.defineProperty(e,"toString",{value:s,writable:o,enumerable:i,configurable:a})};function p0(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:n}=e;for(const s of Reflect.ownKeys(t))c0(e,t,s,r);return u0(e,t),m0(e,t,n),e}const kc=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:s=!1,after:o=!0}=t;if(r<0||n<0)throw new RangeError("`wait` and `maxWait` must not be negative.");if(!s&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let i,a,c;const d=function(...l){const f=this,y=()=>{i=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=e.apply(f,l))},m=()=>{a=void 0,i&&(clearTimeout(i),i=void 0),o&&(c=e.apply(f,l))},$=s&&!i;return clearTimeout(i),i=setTimeout(y,r),n>0&&n!==Number.POSITIVE_INFINITY&&!a&&(a=setTimeout(m,n)),$&&(c=e.apply(f,l)),c};return p0(d,e),d.cancel=()=>{i&&(clearTimeout(i),i=void 0),a&&(clearTimeout(a),a=void 0)},d};var So={exports:{}};const y0="2.0.0",Ou=256,g0=Number.MAX_SAFE_INTEGER||9007199254740991,$0=16,_0=Ou-6,v0=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Rs={MAX_LENGTH:Ou,MAX_SAFE_COMPONENT_LENGTH:$0,MAX_SAFE_BUILD_LENGTH:_0,MAX_SAFE_INTEGER:g0,RELEASE_TYPES:v0,SEMVER_SPEC_VERSION:y0,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const w0=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Os=w0;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Rs,o=Os;t=e.exports={};const i=t.re=[],a=t.safeRe=[],c=t.src=[],d=t.safeSrc=[],l=t.t={};let f=0;const y="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[y,n]],$=_=>{for(const[p,S]of m)_=_.split(`${p}*`).join(`${p}{0,${S}}`).split(`${p}+`).join(`${p}{1,${S}}`);return _},g=(_,p,S)=>{const R=$(p),T=f++;o(_,T,p),l[_]=T,c[T]=p,d[T]=R,i[T]=new RegExp(p,S?"g":void 0),a[T]=new RegExp(R,S?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y}*`),g("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${y}+`),g("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),g("FULL",`^${c[l.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),g("LOOSE",`^${c[l.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),g("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),g("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",c[l.COERCE],!0),g("COERCERTLFULL",c[l.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(So,So.exports);var $n=So.exports;const E0=Object.freeze({loose:!0}),b0=Object.freeze({}),S0=e=>e?typeof e!="object"?E0:e:b0;var wi=S0;const Cc=/^[0-9]+$/,Iu=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eIu(t,e);var Tu={compareIdentifiers:Iu,rcompareIdentifiers:P0};const kn=Os,{MAX_LENGTH:Mc,MAX_SAFE_INTEGER:Cn}=Rs,{safeRe:Mn,t:Dn}=$n,N0=wi,{compareIdentifiers:xs}=Tu;let R0=class Et{constructor(t,r){if(r=N0(r),t instanceof Et){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Mc)throw new TypeError(`version is longer than ${Mc} characters`);kn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?Mn[Dn.LOOSE]:Mn[Dn.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Cn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Cn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Cn||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof Et||(t=new Et(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],s=t.prerelease[r];if(kn("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return xs(n,s)}while(++r)}compareBuild(t){t instanceof Et||(t=new Et(t,this.options));let r=0;do{const n=this.build[r],s=t.build[r];if(kn("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return xs(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const s=`-${r}`.match(this.options.loose?Mn[Dn.PRERELEASELOOSE]:Mn[Dn.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),xs(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var We=R0;const Dc=We,O0=(e,t,r=!1)=>{if(e instanceof Dc)return e;try{return new Dc(e,t)}catch(n){if(!r)return null;throw n}};var Vr=O0;const I0=Vr,T0=(e,t)=>{const r=I0(e,t);return r?r.version:null};var j0=T0;const A0=Vr,k0=(e,t)=>{const r=A0(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var C0=k0;const Fc=We,M0=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Fc(e instanceof Fc?e.version:e,r).inc(t,n,s).version}catch{return null}};var D0=M0;const Lc=Vr,F0=(e,t)=>{const r=Lc(e,null,!0),n=Lc(t,null,!0),s=r.compare(n);if(s===0)return null;const o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};var L0=F0;const z0=We,V0=(e,t)=>new z0(e,t).major;var U0=V0;const q0=We,G0=(e,t)=>new q0(e,t).minor;var K0=G0;const H0=We,W0=(e,t)=>new H0(e,t).patch;var x0=W0;const B0=Vr,Y0=(e,t)=>{const r=B0(e,t);return r&&r.prerelease.length?r.prerelease:null};var J0=Y0;const zc=We,X0=(e,t,r)=>new zc(e,r).compare(new zc(t,r));var _t=X0;const Z0=_t,Q0=(e,t,r)=>Z0(t,e,r);var ew=Q0;const tw=_t,rw=(e,t)=>tw(e,t,!0);var nw=rw;const Vc=We,sw=(e,t,r)=>{const n=new Vc(e,r),s=new Vc(t,r);return n.compare(s)||n.compareBuild(s)};var Ei=sw;const ow=Ei,aw=(e,t)=>e.sort((r,n)=>ow(r,n,t));var iw=aw;const cw=Ei,lw=(e,t)=>e.sort((r,n)=>cw(n,r,t));var uw=lw;const dw=_t,fw=(e,t,r)=>dw(e,t,r)>0;var Is=fw;const hw=_t,mw=(e,t,r)=>hw(e,t,r)<0;var bi=mw;const pw=_t,yw=(e,t,r)=>pw(e,t,r)===0;var ju=yw;const gw=_t,$w=(e,t,r)=>gw(e,t,r)!==0;var Au=$w;const _w=_t,vw=(e,t,r)=>_w(e,t,r)>=0;var Si=vw;const ww=_t,Ew=(e,t,r)=>ww(e,t,r)<=0;var Pi=Ew;const bw=ju,Sw=Au,Pw=Is,Nw=Si,Rw=bi,Ow=Pi,Iw=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return bw(e,r,n);case"!=":return Sw(e,r,n);case">":return Pw(e,r,n);case">=":return Nw(e,r,n);case"<":return Rw(e,r,n);case"<=":return Ow(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var ku=Iw;const Tw=We,jw=Vr,{safeRe:Fn,t:Ln}=$n,Aw=(e,t)=>{if(e instanceof Tw)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Fn[Ln.COERCEFULL]:Fn[Ln.COERCE]);else{const c=t.includePrerelease?Fn[Ln.COERCERTLFULL]:Fn[Ln.COERCERTL];let d;for(;(d=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||d.index+d[0].length!==r.index+r[0].length)&&(r=d),c.lastIndex=d.index+d[1].length+d[2].length;c.lastIndex=-1}if(r===null)return null;const n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return jw(`${n}.${s}.${o}${i}${a}`,t)};var kw=Aw;class Cw{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}}var Mw=Cw,Bs,Uc;function vt(){if(Uc)return Bs;Uc=1;const e=/\s+/g;class t{constructor(F,H){if(H=s(H),F instanceof t)return F.loose===!!H.loose&&F.includePrerelease===!!H.includePrerelease?F:new t(F.raw,H);if(F instanceof o)return this.raw=F.value,this.set=[[F]],this.formatted=void 0,this;if(this.options=H,this.loose=!!H.loose,this.includePrerelease=!!H.includePrerelease,this.raw=F.trim().replace(e," "),this.set=this.raw.split("||").map(U=>this.parseRange(U.trim())).filter(U=>U.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const U=this.set[0];if(this.set=this.set.filter(ee=>!g(ee[0])),this.set.length===0)this.set=[U];else if(this.set.length>1){for(const ee of this.set)if(ee.length===1&&_(ee[0])){this.set=[ee];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let F=0;F0&&(this.formatted+="||");const H=this.set[F];for(let U=0;U0&&(this.formatted+=" "),this.formatted+=H[U].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(F){const U=((this.options.includePrerelease&&m)|(this.options.loose&&$))+":"+F,ee=n.get(U);if(ee)return ee;const K=this.options.loose,I=K?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];F=F.replace(I,Q(this.options.includePrerelease)),i("hyphen replace",F),F=F.replace(c[d.COMPARATORTRIM],l),i("comparator trim",F),F=F.replace(c[d.TILDETRIM],f),i("tilde trim",F),F=F.replace(c[d.CARETTRIM],y),i("caret trim",F);let w=F.split(" ").map(h=>S(h,this.options)).join(" ").split(/\s+/).map(h=>G(h,this.options));K&&(w=w.filter(h=>(i("loose invalid filter",h,this.options),!!h.match(c[d.COMPARATORLOOSE])))),i("range list",w);const N=new Map,E=w.map(h=>new o(h,this.options));for(const h of E){if(g(h))return[h];N.set(h.value,h)}N.size>1&&N.has("")&&N.delete("");const u=[...N.values()];return n.set(U,u),u}intersects(F,H){if(!(F instanceof t))throw new TypeError("a Range is required");return this.set.some(U=>p(U,H)&&F.set.some(ee=>p(ee,H)&&U.every(K=>ee.every(I=>K.intersects(I,H)))))}test(F){if(!F)return!1;if(typeof F=="string")try{F=new a(F,this.options)}catch{return!1}for(let H=0;Hk.value==="<0.0.0-0",_=k=>k.value==="",p=(k,F)=>{let H=!0;const U=k.slice();let ee=U.pop();for(;H&&U.length;)H=U.every(K=>ee.intersects(K,F)),ee=U.pop();return H},S=(k,F)=>(k=k.replace(c[d.BUILD],""),i("comp",k,F),k=B(k,F),i("caret",k),k=T(k,F),i("tildes",k),k=ye(k,F),i("xrange",k),k=we(k,F),i("stars",k),k),R=k=>!k||k.toLowerCase()==="x"||k==="*",T=(k,F)=>k.trim().split(/\s+/).map(H=>A(H,F)).join(" "),A=(k,F)=>{const H=F.loose?c[d.TILDELOOSE]:c[d.TILDE];return k.replace(H,(U,ee,K,I,w)=>{i("tilde",k,U,ee,K,I,w);let N;return R(ee)?N="":R(K)?N=`>=${ee}.0.0 <${+ee+1}.0.0-0`:R(I)?N=`>=${ee}.${K}.0 <${ee}.${+K+1}.0-0`:w?(i("replaceTilde pr",w),N=`>=${ee}.${K}.${I}-${w} <${ee}.${+K+1}.0-0`):N=`>=${ee}.${K}.${I} <${ee}.${+K+1}.0-0`,i("tilde return",N),N})},B=(k,F)=>k.trim().split(/\s+/).map(H=>Z(H,F)).join(" "),Z=(k,F)=>{i("caret",k,F);const H=F.loose?c[d.CARETLOOSE]:c[d.CARET],U=F.includePrerelease?"-0":"";return k.replace(H,(ee,K,I,w,N)=>{i("caret",k,ee,K,I,w,N);let E;return R(K)?E="":R(I)?E=`>=${K}.0.0${U} <${+K+1}.0.0-0`:R(w)?K==="0"?E=`>=${K}.${I}.0${U} <${K}.${+I+1}.0-0`:E=`>=${K}.${I}.0${U} <${+K+1}.0.0-0`:N?(i("replaceCaret pr",N),K==="0"?I==="0"?E=`>=${K}.${I}.${w}-${N} <${K}.${I}.${+w+1}-0`:E=`>=${K}.${I}.${w}-${N} <${K}.${+I+1}.0-0`:E=`>=${K}.${I}.${w}-${N} <${+K+1}.0.0-0`):(i("no pr"),K==="0"?I==="0"?E=`>=${K}.${I}.${w}${U} <${K}.${I}.${+w+1}-0`:E=`>=${K}.${I}.${w}${U} <${K}.${+I+1}.0-0`:E=`>=${K}.${I}.${w} <${+K+1}.0.0-0`),i("caret return",E),E})},ye=(k,F)=>(i("replaceXRanges",k,F),k.split(/\s+/).map(H=>$e(H,F)).join(" ")),$e=(k,F)=>{k=k.trim();const H=F.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return k.replace(H,(U,ee,K,I,w,N)=>{i("xRange",k,U,ee,K,I,w,N);const E=R(K),u=E||R(I),h=u||R(w),P=h;return ee==="="&&P&&(ee=""),N=F.includePrerelease?"-0":"",E?ee===">"||ee==="<"?U="<0.0.0-0":U="*":ee&&P?(u&&(I=0),w=0,ee===">"?(ee=">=",u?(K=+K+1,I=0,w=0):(I=+I+1,w=0)):ee==="<="&&(ee="<",u?K=+K+1:I=+I+1),ee==="<"&&(N="-0"),U=`${ee+K}.${I}.${w}${N}`):u?U=`>=${K}.0.0${N} <${+K+1}.0.0-0`:h&&(U=`>=${K}.${I}.0${N} <${K}.${+I+1}.0-0`),i("xRange return",U),U})},we=(k,F)=>(i("replaceStars",k,F),k.trim().replace(c[d.STAR],"")),G=(k,F)=>(i("replaceGTE0",k,F),k.trim().replace(c[F.includePrerelease?d.GTE0PRE:d.GTE0],"")),Q=k=>(F,H,U,ee,K,I,w,N,E,u,h,P)=>(R(U)?H="":R(ee)?H=`>=${U}.0.0${k?"-0":""}`:R(K)?H=`>=${U}.${ee}.0${k?"-0":""}`:I?H=`>=${H}`:H=`>=${H}${k?"-0":""}`,R(E)?N="":R(u)?N=`<${+E+1}.0.0-0`:R(h)?N=`<${E}.${+u+1}.0-0`:P?N=`<=${E}.${u}.${h}-${P}`:k?N=`<${E}.${u}.${+h+1}-0`:N=`<=${N}`,`${H} ${N}`.trim()),J=(k,F,H)=>{for(let U=0;U0){const ee=k[U].semver;if(ee.major===F.major&&ee.minor===F.minor&&ee.patch===F.patch)return!0}return!1}return!0};return Bs}var Ys,qc;function Ts(){if(qc)return Ys;qc=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,f){if(f=r(f),l instanceof t){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),i("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(l){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],y=l.match(f);if(!y)throw new TypeError(`Invalid comparator: ${l}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new a(y[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(i("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return o(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||o(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||o(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}Ys=t;const r=wi,{safeRe:n,t:s}=$n,o=ku,i=Os,a=We,c=vt();return Ys}const Dw=vt(),Fw=(e,t,r)=>{try{t=new Dw(t,r)}catch{return!1}return t.test(e)};var js=Fw;const Lw=vt(),zw=(e,t)=>new Lw(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Vw=zw;const Uw=We,qw=vt(),Gw=(e,t,r)=>{let n=null,s=null,o=null;try{o=new qw(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new Uw(n,r))}),n};var Kw=Gw;const Hw=We,Ww=vt(),xw=(e,t,r)=>{let n=null,s=null,o=null;try{o=new Ww(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new Hw(n,r))}),n};var Bw=xw;const Js=We,Yw=vt(),Gc=Is,Jw=(e,t)=>{e=new Yw(e,t);let r=new Js("0.0.0");if(e.test(r)||(r=new Js("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new Js(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Gc(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Gc(r,o))&&(r=o)}return r&&e.test(r)?r:null};var Xw=Jw;const Zw=vt(),Qw=(e,t)=>{try{return new Zw(e,t).range||"*"}catch{return null}};var eE=Qw;const tE=We,Cu=Ts(),{ANY:rE}=Cu,nE=vt(),sE=js,Kc=Is,Hc=bi,oE=Pi,aE=Si,iE=(e,t,r,n)=>{e=new tE(e,n),t=new nE(t,n);let s,o,i,a,c;switch(r){case">":s=Kc,o=oE,i=Hc,a=">",c=">=";break;case"<":s=Hc,o=aE,i=Kc,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(sE(e,t,n))return!1;for(let d=0;d{m.semver===rE&&(m=new Cu(">=0.0.0")),f=f||m,y=y||m,s(m.semver,f.semver,n)?f=m:i(m.semver,y.semver,n)&&(y=m)}),f.operator===a||f.operator===c||(!y.operator||y.operator===a)&&o(e,y.semver))return!1;if(y.operator===c&&i(e,y.semver))return!1}return!0};var Ni=iE;const cE=Ni,lE=(e,t,r)=>cE(e,t,">",r);var uE=lE;const dE=Ni,fE=(e,t,r)=>dE(e,t,"<",r);var hE=fE;const Wc=vt(),mE=(e,t,r)=>(e=new Wc(e,r),t=new Wc(t,r),e.intersects(t,r));var pE=mE;const yE=js,gE=_t;var $E=(e,t,r)=>{const n=[];let s=null,o=null;const i=e.sort((l,f)=>gE(l,f,r));for(const l of i)yE(l,t,r)?(o=l,s||(s=l)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);const a=[];for(const[l,f]of n)l===f?a.push(l):!f&&l===i[0]?a.push("*"):f?l===i[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);const c=a.join(" || "),d=typeof t.raw=="string"?t.raw:String(t);return c.length{if(e===t)return!0;e=new xc(e,r),t=new xc(t,r);let n=!1;e:for(const s of e.set){for(const o of t.set){const i=wE(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},vE=[new Ri(">=0.0.0-0")],Bc=[new Ri(">=0.0.0")],wE=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Xs){if(t.length===1&&t[0].semver===Xs)return!0;r.includePrerelease?e=vE:e=Bc}if(t.length===1&&t[0].semver===Xs){if(r.includePrerelease)return!0;t=Bc}const n=new Set;let s,o;for(const m of e)m.operator===">"||m.operator===">="?s=Yc(s,m,r):m.operator==="<"||m.operator==="<="?o=Jc(o,m,r):n.add(m.semver);if(n.size>1)return null;let i;if(s&&o){if(i=Oi(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(const m of n){if(s&&!Br(m,String(s),r)||o&&!Br(m,String(o),r))return null;for(const $ of t)if(!Br(m,String($),r))return!1;return!0}let a,c,d,l,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,y=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const m of t){if(l=l||m.operator===">"||m.operator===">=",d=d||m.operator==="<"||m.operator==="<=",s){if(y&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===y.major&&m.semver.minor===y.minor&&m.semver.patch===y.patch&&(y=!1),m.operator===">"||m.operator===">="){if(a=Yc(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!Br(s.semver,String(m),r))return!1}if(o){if(f&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===f.major&&m.semver.minor===f.minor&&m.semver.patch===f.patch&&(f=!1),m.operator==="<"||m.operator==="<="){if(c=Jc(o,m,r),c===m&&c!==o)return!1}else if(o.operator==="<="&&!Br(o.semver,String(m),r))return!1}if(!m.operator&&(o||s)&&i!==0)return!1}return!(s&&d&&!o&&i!==0||o&&l&&!s&&i!==0||y||f)},Yc=(e,t,r)=>{if(!e)return t;const n=Oi(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Jc=(e,t,r)=>{if(!e)return t;const n=Oi(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var EE=_E;const Zs=$n,Xc=Rs,bE=We,Zc=Tu,SE=Vr,PE=j0,NE=C0,RE=D0,OE=L0,IE=U0,TE=K0,jE=x0,AE=J0,kE=_t,CE=ew,ME=nw,DE=Ei,FE=iw,LE=uw,zE=Is,VE=bi,UE=ju,qE=Au,GE=Si,KE=Pi,HE=ku,WE=kw,xE=Ts(),BE=vt(),YE=js,JE=Vw,XE=Kw,ZE=Bw,QE=Xw,eb=eE,tb=Ni,rb=uE,nb=hE,sb=pE,ob=$E,ab=EE;var ib={parse:SE,valid:PE,clean:NE,inc:RE,diff:OE,major:IE,minor:TE,patch:jE,prerelease:AE,compare:kE,rcompare:CE,compareLoose:ME,compareBuild:DE,sort:FE,rsort:LE,gt:zE,lt:VE,eq:UE,neq:qE,gte:GE,lte:KE,cmp:HE,coerce:WE,Comparator:xE,Range:BE,satisfies:YE,toComparators:JE,maxSatisfying:XE,minSatisfying:ZE,minVersion:QE,validRange:eb,outside:tb,gtr:rb,ltr:nb,intersects:sb,simplifyRange:ob,subset:ab,SemVer:bE,re:Zs.re,src:Zs.src,tokens:Zs.t,SEMVER_SPEC_VERSION:Xc.SEMVER_SPEC_VERSION,RELEASE_TYPES:Xc.RELEASE_TYPES,compareIdentifiers:Zc.compareIdentifiers,rcompareIdentifiers:Zc.rcompareIdentifiers};const _r=ml(ib),cb=Object.prototype.toString,lb="[object Uint8Array]",ub="[object ArrayBuffer]";function Mu(e,t,r){return e?e.constructor===t?!0:cb.call(e)===r:!1}function Du(e){return Mu(e,Uint8Array,lb)}function db(e){return Mu(e,ArrayBuffer,ub)}function fb(e){return Du(e)||db(e)}function hb(e){if(!Du(e))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function mb(e){if(!fb(e))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function Qs(e,t){if(e.length===0)return new Uint8Array(0);t??(t=e.reduce((s,o)=>s+o.length,0));const r=new Uint8Array(t);let n=0;for(const s of e)hb(s),r.set(s,n),n+=s.length;return r}const zn={utf8:new globalThis.TextDecoder("utf8")};function Vn(e,t="utf8"){return mb(e),zn[t]??(zn[t]=new globalThis.TextDecoder(t)),zn[t].decode(e)}function pb(e){if(typeof e!="string")throw new TypeError(`Expected \`string\`, got \`${typeof e}\``)}const yb=new globalThis.TextEncoder;function Un(e){return pb(e),yb.encode(e)}Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));const eo="aes-256-cbc",Gt=()=>Object.create(null),Qc=e=>e!==void 0,to=(e,t)=>{const r=new Set(["undefined","symbol","function"]),n=typeof t;if(r.has(n))throw new TypeError(`Setting a value of type \`${n}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},Ht="__internal__",ro=`${Ht}.migrations.version`;var xt,yt,xe,st,lr,ur,Ir,bt,Me,Fu,Lu,zu,Vu,Uu,qu,Gu,Ku;class gb{constructor(t={}){wt(this,Me);re(this,"path");re(this,"events");wt(this,xt);wt(this,yt);wt(this,xe);wt(this,st,{});wt(this,lr,!1);wt(this,ur);wt(this,Ir);wt(this,bt);re(this,"_deserialize",t=>JSON.parse(t));re(this,"_serialize",t=>JSON.stringify(t,void 0," "));const r=Nt(this,Me,Fu).call(this,t);Qe(this,xe,r),Nt(this,Me,Lu).call(this,r),Nt(this,Me,Vu).call(this,r),Nt(this,Me,Uu).call(this,r),this.events=new EventTarget,Qe(this,yt,r.encryptionKey),this.path=Nt(this,Me,qu).call(this,r),Nt(this,Me,Gu).call(this,r),r.watch&&this._watch()}get(t,r){if(ae(this,xe).accessPropertiesByDotNotation)return this._get(t,r);const{store:n}=this;return t in n?n[t]:r}set(t,r){if(typeof t!="string"&&typeof t!="object")throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`);if(typeof t!="object"&&r===void 0)throw new TypeError("Use `delete()` to clear values");if(this._containsReservedKey(t))throw new TypeError(`Please don't use the ${Ht} key, as it's used to manage this module internal operations.`);const{store:n}=this,s=(o,i)=>{if(to(o,i),ae(this,xe).accessPropertiesByDotNotation)_n(n,o,i);else{if(o==="__proto__"||o==="constructor"||o==="prototype")return;n[o]=i}};if(typeof t=="object"){const o=t;for(const[i,a]of Object.entries(o))s(i,a)}else s(t,r);this.store=n}has(t){return ae(this,xe).accessPropertiesByDotNotation?Ds(this.store,t):t in this.store}appendToArray(t,r){to(t,r);const n=ae(this,xe).accessPropertiesByDotNotation?this._get(t,[]):t in this.store?this.store[t]:[];if(!Array.isArray(n))throw new TypeError(`The key \`${t}\` is already set to a non-array value`);this.set(t,[...n,r])}reset(...t){for(const r of t)Qc(ae(this,st)[r])&&this.set(r,ae(this,st)[r])}delete(t){const{store:r}=this;ae(this,xe).accessPropertiesByDotNotation?fd(r,t):delete r[t],this.store=r}clear(){const t=Gt();for(const r of Object.keys(ae(this,st)))Qc(ae(this,st)[r])&&(to(r,ae(this,st)[r]),ae(this,xe).accessPropertiesByDotNotation?_n(t,r,ae(this,st)[r]):t[r]=ae(this,st)[r]);this.store=t}onDidChange(t,r){if(typeof t!="string")throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`);if(typeof r!="function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`);return this._handleValueChange(()=>this.get(t),r)}onDidAnyChange(t){if(typeof t!="function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleStoreChange(t)}get size(){return Object.keys(this.store).filter(r=>!this._isReservedKeyPath(r)).length}get store(){var t;try{const r=oe.readFileSync(this.path,ae(this,yt)?null:"utf8"),n=this._decryptData(r),s=this._deserialize(n);return ae(this,lr)||this._validate(s),Object.assign(Gt(),s)}catch(r){if((r==null?void 0:r.code)==="ENOENT")return this._ensureDirectory(),Gt();if(ae(this,xe).clearInvalidConfig){const n=r;if(n.name==="SyntaxError"||(t=n.message)!=null&&t.startsWith("Config schema violation:"))return Gt()}throw r}}set store(t){if(this._ensureDirectory(),!Ds(t,Ht))try{const r=oe.readFileSync(this.path,ae(this,yt)?null:"utf8"),n=this._decryptData(r),s=this._deserialize(n);Ds(s,Ht)&&_n(t,Ht,Ai(s,Ht))}catch{}ae(this,lr)||this._validate(t),this._write(t),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store))this._isReservedKeyPath(t)||(yield[t,r])}_closeWatcher(){ae(this,ur)&&(ae(this,ur).close(),Qe(this,ur,void 0)),ae(this,Ir)&&(oe.unwatchFile(this.path),Qe(this,Ir,!1)),Qe(this,bt,void 0)}_decryptData(t){if(!ae(this,yt))return typeof t=="string"?t:Vn(t);try{const r=t.slice(0,16),n=Qt.pbkdf2Sync(ae(this,yt),r,1e4,32,"sha512"),s=Qt.createDecipheriv(eo,n,r),o=t.slice(17),i=typeof o=="string"?Un(o):o;return Vn(Qs([s.update(i),s.final()]))}catch{try{const r=t.slice(0,16),n=Qt.pbkdf2Sync(ae(this,yt),r.toString(),1e4,32,"sha512"),s=Qt.createDecipheriv(eo,n,r),o=t.slice(17),i=typeof o=="string"?Un(o):o;return Vn(Qs([s.update(i),s.final()]))}catch{}}return typeof t=="string"?t:Vn(t)}_handleStoreChange(t){let r=this.store;const n=()=>{const s=r,o=this.store;Ce.isDeepStrictEqual(o,s)||(r=o,t.call(this,o,s))};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_handleValueChange(t,r){let n=t();const s=()=>{const o=n,i=t();Ce.isDeepStrictEqual(i,o)||(n=i,r.call(this,i,o))};return this.events.addEventListener("change",s),()=>{this.events.removeEventListener("change",s)}}_validate(t){if(!ae(this,xt)||ae(this,xt).call(this,t)||!ae(this,xt).errors)return;const n=ae(this,xt).errors.map(({instancePath:s,message:o=""})=>`\`${s.slice(1)}\` ${o}`);throw new Error("Config schema violation: "+n.join("; "))}_ensureDirectory(){oe.mkdirSync(he.dirname(this.path),{recursive:!0})}_write(t){let r=this._serialize(t);if(ae(this,yt)){const n=Qt.randomBytes(16),s=Qt.pbkdf2Sync(ae(this,yt),n,1e4,32,"sha512"),o=Qt.createCipheriv(eo,s,n);r=Qs([n,Un(":"),o.update(Un(r)),o.final()])}if(Re.env.SNAP)oe.writeFileSync(this.path,r,{mode:ae(this,xe).configFileMode});else try{hl(this.path,r,{mode:ae(this,xe).configFileMode})}catch(n){if((n==null?void 0:n.code)==="EXDEV"){oe.writeFileSync(this.path,r,{mode:ae(this,xe).configFileMode});return}throw n}}_watch(){if(this._ensureDirectory(),oe.existsSync(this.path)||this._write(Gt()),Re.platform==="win32"||Re.platform==="darwin"){ae(this,bt)??Qe(this,bt,kc(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));const t=he.dirname(this.path),r=he.basename(this.path);Qe(this,ur,oe.watch(t,{persistent:!1,encoding:"utf8"},(n,s)=>{s&&s!==r||typeof ae(this,bt)=="function"&&ae(this,bt).call(this)}))}else ae(this,bt)??Qe(this,bt,kc(()=>{this.events.dispatchEvent(new Event("change"))},{wait:1e3})),oe.watchFile(this.path,{persistent:!1},(t,r)=>{typeof ae(this,bt)=="function"&&ae(this,bt).call(this)}),Qe(this,Ir,!0)}_migrate(t,r,n){let s=this._get(ro,"0.0.0");const o=Object.keys(t).filter(a=>this._shouldPerformMigration(a,s,r));let i=structuredClone(this.store);for(const a of o)try{n&&n(this,{fromVersion:s,toVersion:a,finalVersion:r,versions:o});const c=t[a];c==null||c(this),this._set(ro,a),s=a,i=structuredClone(this.store)}catch(c){this.store=i;try{this._write(i)}catch{}const d=c instanceof Error?c.message:String(c);throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${d}`)}(this._isVersionInRangeFormat(s)||!_r.eq(s,r))&&this._set(ro,r)}_containsReservedKey(t){return typeof t=="string"?this._isReservedKeyPath(t):!t||typeof t!="object"?!1:this._objectContainsReservedKey(t)}_objectContainsReservedKey(t){if(!t||typeof t!="object")return!1;for(const[r,n]of Object.entries(t))if(this._isReservedKeyPath(r)||this._objectContainsReservedKey(n))return!0;return!1}_isReservedKeyPath(t){return t===Ht||t.startsWith(`${Ht}.`)}_isVersionInRangeFormat(t){return _r.clean(t)===null}_shouldPerformMigration(t,r,n){return this._isVersionInRangeFormat(t)?r!=="0.0.0"&&_r.satisfies(r,t)?!1:_r.satisfies(n,t):!(_r.lte(t,r)||_r.gt(t,n))}_get(t,r){return Ai(this.store,t,r)}_set(t,r){const{store:n}=this;_n(n,t,r),this.store=n}}xt=new WeakMap,yt=new WeakMap,xe=new WeakMap,st=new WeakMap,lr=new WeakMap,ur=new WeakMap,Ir=new WeakMap,bt=new WeakMap,Me=new WeakSet,Fu=function(t){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...t};if(!r.cwd){if(!r.projectName)throw new Error("Please specify the `projectName` option.");r.cwd=yd(r.projectName,{suffix:r.projectSuffix}).config}return typeof r.fileExtension=="string"&&(r.fileExtension=r.fileExtension.replace(/^\.+/,"")),r},Lu=function(t){if(!(t.schema??t.ajvOptions??t.rootSchema))return;if(t.schema&&typeof t.schema!="object")throw new TypeError("The `schema` option must be an object.");const r=i0.default,n=new Ag.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});r(n);const s={...t.rootSchema,type:"object",properties:t.schema};Qe(this,xt,n.compile(s)),Nt(this,Me,zu).call(this,t.schema)},zu=function(t){const r=Object.entries(t??{});for(const[n,s]of r){if(!s||typeof s!="object"||!Object.hasOwn(s,"default"))continue;const{default:o}=s;o!==void 0&&(ae(this,st)[n]=o)}},Vu=function(t){t.defaults&&Object.assign(ae(this,st),t.defaults)},Uu=function(t){t.serialize&&(this._serialize=t.serialize),t.deserialize&&(this._deserialize=t.deserialize)},qu=function(t){const r=typeof t.fileExtension=="string"?t.fileExtension:void 0,n=r?`.${r}`:"";return he.resolve(t.cwd,`${t.configName??"config"}${n}`)},Gu=function(t){if(t.migrations){Nt(this,Me,Ku).call(this,t),this._validate(this.store);return}const r=this.store,n=Object.assign(Gt(),t.defaults??{},r);this._validate(n);try{ji.deepEqual(r,n)}catch{this.store=n}},Ku=function(t){const{migrations:r,projectVersion:n}=t;if(r){if(!n)throw new Error("Please specify the `projectVersion` option.");Qe(this,lr,!0);try{const s=this.store,o=Object.assign(Gt(),t.defaults??{},s);try{ji.deepEqual(s,o)}catch{this._write(o)}this._migrate(r,n,t.beforeEachMigration)}finally{Qe(this,lr,!1)}}};const{app:Zn,ipcMain:Po,shell:$b}=z;let el=!1;const tl=()=>{if(!Po||!Zn)throw new Error("Electron Store: You need to call `.initRenderer()` from the main process.");const e={defaultCwd:Zn.getPath("userData"),appVersion:Zn.getVersion()};return el||(Po.on("electron-store-get-data",t=>{t.returnValue=e}),el=!0),e};class Hu extends gb{constructor(t){let r,n;if(Re.type==="renderer"){const s=z.ipcRenderer.sendSync("electron-store-get-data");if(!s)throw new Error("Electron Store: You need to call `.initRenderer()` from the main process.");({defaultCwd:r,appVersion:n}=s)}else Po&&Zn&&({defaultCwd:r,appVersion:n}=tl());t={name:"config",...t},t.projectVersion||(t.projectVersion=n),t.cwd?t.cwd=he.isAbsolute(t.cwd)?t.cwd:he.join(r,t.cwd):t.cwd=r,t.configName=t.name,delete t.name,super(t)}static initRenderer(){tl()}async openInEditor(){const t=await $b.openPath(this.path);if(t)throw new Error(t)}}const rt={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},No={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:rt.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(No);const Wu="READDIRP_RECURSIVE_ERROR",_b=new Set(["ENOENT","EPERM","EACCES","ELOOP",Wu]),rl=[rt.DIR_TYPE,rt.EVERYTHING_TYPE,rt.FILE_DIR_TYPE,rt.FILE_TYPE],vb=new Set([rt.DIR_TYPE,rt.EVERYTHING_TYPE,rt.FILE_DIR_TYPE]),wb=new Set([rt.EVERYTHING_TYPE,rt.FILE_DIR_TYPE,rt.FILE_TYPE]),Eb=e=>_b.has(e.code),bb=process.platform==="win32",nl=e=>!0,sl=e=>{if(e===void 0)return nl;if(typeof e=="function")return e;if(typeof e=="string"){const t=e.trim();return r=>r.basename===t}if(Array.isArray(e)){const t=e.map(r=>r.trim());return r=>t.some(n=>r.basename===n)}return nl};class Sb extends cd.Readable{constructor(r={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:r.highWaterMark});re(this,"parents");re(this,"reading");re(this,"parent");re(this,"_stat");re(this,"_maxDepth");re(this,"_wantsDir");re(this,"_wantsFile");re(this,"_wantsEverything");re(this,"_root");re(this,"_isDirent");re(this,"_statsProp");re(this,"_rdOptions");re(this,"_fileFilter");re(this,"_directoryFilter");const n={...No,...r},{root:s,type:o}=n;this._fileFilter=sl(n.fileFilter),this._directoryFilter=sl(n.directoryFilter);const i=n.lstat?Je.lstat:Je.stat;bb?this._stat=a=>i(a,{bigint:!0}):this._stat=i,this._maxDepth=n.depth!=null&&Number.isSafeInteger(n.depth)?n.depth:No.depth,this._wantsDir=o?vb.has(o):!1,this._wantsFile=o?wb.has(o):!1,this._wantsEverything=o===rt.EVERYTHING_TYPE,this._root=he.resolve(s),this._isDirent=!n.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(s,1)],this.reading=!1,this.parent=void 0}async _read(r){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&r>0;){const n=this.parent,s=n&&n.files;if(s&&s.length>0){const{path:o,depth:i}=n,a=s.splice(0,r).map(d=>this._formatEntry(d,o)),c=await Promise.all(a);for(const d of c){if(!d)continue;if(this.destroyed)return;const l=await this._getEntryType(d);l==="directory"&&this._directoryFilter(d)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(d.fullPath,i+1)),this._wantsDir&&(this.push(d),r--)):(l==="file"||this._includeAsFile(d))&&this._fileFilter(d)&&this._wantsFile&&(this.push(d),r--)}}else{const o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(n){this.destroy(n)}finally{this.reading=!1}}}async _exploreDir(r,n){let s;try{s=await Je.readdir(r,this._rdOptions)}catch(o){this._onError(o)}return{files:s,depth:n,path:r}}async _formatEntry(r,n){let s;const o=this._isDirent?r.name:r;try{const i=he.resolve(he.join(n,o));s={path:he.relative(this._root,i),fullPath:i,basename:o},s[this._statsProp]=this._isDirent?r:await this._stat(i)}catch(i){this._onError(i);return}return s}_onError(r){Eb(r)&&!this.destroyed?this.emit("warn",r):this.destroy(r)}async _getEntryType(r){if(!r&&this._statsProp in r)return"";const n=r[this._statsProp];if(n.isFile())return"file";if(n.isDirectory())return"directory";if(n&&n.isSymbolicLink()){const s=r.fullPath;try{const o=await Je.realpath(s),i=await Je.lstat(o);if(i.isFile())return"file";if(i.isDirectory()){const a=o.length;if(s.startsWith(o)&&s.substr(a,1)===he.sep){const c=new Error(`Circular symlink detected: "${s}" points to "${o}"`);return c.code=Wu,this._onError(c)}return"directory"}}catch(o){return this._onError(o),""}}}_includeAsFile(r){const n=r&&r[this._statsProp];return n&&this._wantsEverything&&!n.isDirectory()}}function Pb(e,t={}){let r=t.entryType||t.type;if(r==="both"&&(r=rt.FILE_DIR_TYPE),r&&(t.type=r),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(r&&!rl.includes(r))throw new Error(`readdirp: Invalid type passed. Use one of ${rl.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=e,new Sb(t)}const Nb="data",xu="end",Rb="close",Ii=()=>{},As=process.platform,Bu=As==="win32",Ob=As==="darwin",Ib=As==="linux",Tb=As==="freebsd",jb=Ao.type()==="OS400",Ie={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},mt=Ie,Ab="watch",kb={lstat:Je.lstat,stat:Je.stat},dr="listeners",Qn="errHandlers",Or="rawEmitters",Cb=[dr,Qn,Or],Mb=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Db=e=>Mb.has(se.extname(e).slice(1).toLowerCase()),Ro=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},cn=(e,t,r)=>{let n=e[t];n instanceof Set||(e[t]=n=new Set([n])),n.add(r)},Fb=e=>t=>{const r=e[t];r instanceof Set?r.clear():delete e[t]},ln=(e,t,r)=>{const n=e[t];n instanceof Set?n.delete(r):n===r&&delete e[t]},Yu=e=>e instanceof Set?e.size===0:!e,es=new Map;function ol(e,t,r,n,s){const o=(i,a)=>{r(e),s(i,a,{watchedPath:e}),a&&e!==a&&ts(se.resolve(e,a),dr,se.join(e,a))};try{return oe.watch(e,{persistent:t.persistent},o)}catch(i){n(i);return}}const ts=(e,t,r,n,s)=>{const o=es.get(e);o&&Ro(o[t],i=>{i(r,n,s)})},Lb=(e,t,r,n)=>{const{listener:s,errHandler:o,rawEmitter:i}=n;let a=es.get(t),c;if(!r.persistent)return c=ol(e,r,s,o,i),c?c.close.bind(c):void 0;if(a)cn(a,dr,s),cn(a,Qn,o),cn(a,Or,i);else{if(c=ol(e,r,ts.bind(null,t,dr),o,ts.bind(null,t,Or)),!c)return;c.on(mt.ERROR,async d=>{const l=ts.bind(null,t,Qn);if(a&&(a.watcherUnusable=!0),Bu&&d.code==="EPERM")try{await(await Je.open(e,"r")).close(),l(d)}catch{}else l(d)}),a={listeners:s,errHandlers:o,rawEmitters:i,watcher:c},es.set(t,a)}return()=>{ln(a,dr,s),ln(a,Qn,o),ln(a,Or,i),Yu(a.listeners)&&(a.watcher.close(),es.delete(t),Cb.forEach(Fb(a)),a.watcher=void 0,Object.freeze(a))}},no=new Map,zb=(e,t,r,n)=>{const{listener:s,rawEmitter:o}=n;let i=no.get(t);const a=i&&i.options;return a&&(a.persistentr.interval)&&(oe.unwatchFile(t),i=void 0),i?(cn(i,dr,s),cn(i,Or,o)):(i={listeners:s,rawEmitters:o,options:r,watcher:oe.watchFile(t,r,(c,d)=>{Ro(i.rawEmitters,f=>{f(mt.CHANGE,t,{curr:c,prev:d})});const l=c.mtimeMs;(c.size!==d.size||l>d.mtimeMs||l===0)&&Ro(i.listeners,f=>f(e,c))})},no.set(t,i)),()=>{ln(i,dr,s),ln(i,Or,o),Yu(i.listeners)&&(no.delete(t),oe.unwatchFile(t),i.options=i.watcher=void 0,Object.freeze(i))}};class Vb{constructor(t){re(this,"fsw");re(this,"_boundHandleError");this.fsw=t,this._boundHandleError=r=>t._handleError(r)}_watchWithNodeFs(t,r){const n=this.fsw.options,s=se.dirname(t),o=se.basename(t);this.fsw._getWatchedDir(s).add(o);const a=se.resolve(t),c={persistent:n.persistent};r||(r=Ii);let d;if(n.usePolling){const l=n.interval!==n.binaryInterval;c.interval=l&&Db(o)?n.binaryInterval:n.interval,d=zb(t,a,c,{listener:r,rawEmitter:this.fsw._emitRaw})}else d=Lb(t,a,c,{listener:r,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return d}_handleFile(t,r,n){if(this.fsw.closed)return;const s=se.dirname(t),o=se.basename(t),i=this.fsw._getWatchedDir(s);let a=r;if(i.has(o))return;const c=async(l,f)=>{if(this.fsw._throttle(Ab,t,5)){if(!f||f.mtimeMs===0)try{const y=await Je.stat(t);if(this.fsw.closed)return;const m=y.atimeMs,$=y.mtimeMs;if((!m||m<=$||$!==a.mtimeMs)&&this.fsw._emit(mt.CHANGE,t,y),(Ob||Ib||Tb)&&a.ino!==y.ino){this.fsw._closeFile(l),a=y;const g=this._watchWithNodeFs(t,c);g&&this.fsw._addPathCloser(l,g)}else a=y}catch{this.fsw._remove(s,o)}else if(i.has(o)){const y=f.atimeMs,m=f.mtimeMs;(!y||y<=m||m!==a.mtimeMs)&&this.fsw._emit(mt.CHANGE,t,f),a=f}}},d=this._watchWithNodeFs(t,c);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(mt.ADD,t,0))return;this.fsw._emit(mt.ADD,t,r)}return d}async _handleSymlink(t,r,n,s){if(this.fsw.closed)return;const o=t.fullPath,i=this.fsw._getWatchedDir(r);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await Je.realpath(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(i.has(s)?this.fsw._symlinkPaths.get(o)!==a&&(this.fsw._symlinkPaths.set(o,a),this.fsw._emit(mt.CHANGE,n,t.stats)):(i.add(s),this.fsw._symlinkPaths.set(o,a),this.fsw._emit(mt.ADD,n,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(t,r,n,s,o,i,a){t=se.join(t,"");const c=s?`${t}:${s}`:t;if(a=this.fsw._throttle("readdir",c,1e3),!a)return;const d=this.fsw._getWatchedDir(n.path),l=new Set;let f=this.fsw._readdirp(t,{fileFilter:y=>n.filterPath(y),directoryFilter:y=>n.filterDir(y)});if(f)return f.on(Nb,async y=>{if(this.fsw.closed){f=void 0;return}const m=y.path;let $=se.join(t,m);if(l.add(m),!(y.stats.isSymbolicLink()&&await this._handleSymlink(y,t,$,m))){if(this.fsw.closed){f=void 0;return}(m===s||!s&&!d.has(m))&&(this.fsw._incrReadyCount(),$=se.join(o,se.relative(o,$)),this._addToNodeFs($,r,n,i+1))}}).on(mt.ERROR,this._boundHandleError),new Promise((y,m)=>{if(!f)return m();f.once(xu,()=>{if(this.fsw.closed){f=void 0;return}const $=a?a.clear():!1;y(void 0),d.getChildren().filter(g=>g!==t&&!l.has(g)).forEach(g=>{this.fsw._remove(t,g)}),f=void 0,$&&this._handleRead(t,!1,n,s,o,i,a)})})}async _handleDir(t,r,n,s,o,i,a){const c=this.fsw._getWatchedDir(se.dirname(t)),d=c.has(se.basename(t));!(n&&this.fsw.options.ignoreInitial)&&!o&&!d&&this.fsw._emit(mt.ADD_DIR,t,r),c.add(se.basename(t)),this.fsw._getWatchedDir(t);let l,f;const y=this.fsw.options.depth;if((y==null||s<=y)&&!this.fsw._symlinkPaths.has(a)){if(!o&&(await this._handleRead(t,n,i,o,t,s,l),this.fsw.closed))return;f=this._watchWithNodeFs(t,(m,$)=>{$&&$.mtimeMs===0||this._handleRead(m,!1,i,o,t,s,l)})}return f}async _addToNodeFs(t,r,n,s,o){const i=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return i(),!1;const a=this.fsw._getWatchHelpers(t);n&&(a.filterPath=c=>n.filterPath(c),a.filterDir=c=>n.filterDir(c));try{const c=await kb[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,c))return i(),!1;const d=this.fsw.options.followSymlinks;let l;if(c.isDirectory()){const f=se.resolve(t),y=d?await Je.realpath(t):t;if(this.fsw.closed||(l=await this._handleDir(a.watchPath,c,r,s,o,a,y),this.fsw.closed))return;f!==y&&y!==void 0&&this.fsw._symlinkPaths.set(f,y)}else if(c.isSymbolicLink()){const f=d?await Je.realpath(t):t;if(this.fsw.closed)return;const y=se.dirname(a.watchPath);if(this.fsw._getWatchedDir(y).add(a.watchPath),this.fsw._emit(mt.ADD,a.watchPath,c),l=await this._handleDir(y,c,r,s,t,a,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(se.resolve(t),f)}else l=this._handleFile(a.watchPath,c,r);return i(),l&&this.fsw._addPathCloser(t,l),!1}catch(c){if(this.fsw._handleError(c))return i(),t}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */const so="/",Ub="//",Ju=".",qb="..",Gb="string",Kb=/\\/g,Xu=/\/\//g,Hb=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Wb=/^\.[/\\]/;function ds(e){return Array.isArray(e)?e:[e]}const oo=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);function xb(e){return typeof e=="function"?e:typeof e=="string"?t=>e===t:e instanceof RegExp?t=>e.test(t):typeof e=="object"&&e!==null?t=>{if(e.path===t)return!0;if(e.recursive){const r=se.relative(e.path,t);return r?!r.startsWith("..")&&!se.isAbsolute(r):!1}return!1}:()=>!1}function Bb(e){if(typeof e!="string")throw new Error("string expected");e=se.normalize(e),e=e.replace(/\\/g,"/");let t=!1;return e.startsWith("//")&&(t=!0),e=e.replace(Xu,"/"),t&&(e="/"+e),e}function Yb(e,t,r){const n=Bb(t);for(let s=0;sxb(s));return(s,o)=>Yb(n,s,o)}const al=e=>{const t=ds(e).flat();if(!t.every(r=>typeof r===Gb))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(Zu)},il=e=>{let t=e.replace(Kb,so),r=!1;return t.startsWith(Ub)&&(r=!0),t=t.replace(Xu,so),r&&(t=so+t),t},Zu=e=>il(se.normalize(il(e))),cl=(e="")=>t=>typeof t=="string"?Zu(se.isAbsolute(t)?t:se.join(e,t)):t,Xb=(e,t)=>se.isAbsolute(e)?e:se.join(t,e),Zb=Object.freeze(new Set);class Qb{constructor(t,r){re(this,"path");re(this,"_removeWatcher");re(this,"items");this.path=t,this._removeWatcher=r,this.items=new Set}add(t){const{items:r}=this;r&&t!==Ju&&t!==qb&&r.add(t)}async remove(t){const{items:r}=this;if(!r||(r.delete(t),r.size>0))return;const n=this.path;try{await Je.readdir(n)}catch{this._removeWatcher&&this._removeWatcher(se.dirname(n),se.basename(n))}}has(t){const{items:r}=this;if(r)return r.has(t)}getChildren(){const{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Ii,this.items=Zb,Object.freeze(this)}}const eS="stat",tS="lstat";class rS{constructor(t,r,n){re(this,"fsw");re(this,"path");re(this,"watchPath");re(this,"fullWatchPath");re(this,"dirParts");re(this,"followSymlinks");re(this,"statMethod");this.fsw=n;const s=t;this.path=t=t.replace(Wb,""),this.watchPath=s,this.fullWatchPath=se.resolve(s),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=r,this.statMethod=r?eS:tS}entryPath(t){return se.join(this.watchPath,se.relative(this.watchPath,t.fullPath))}filterPath(t){const{stats:r}=t;if(r&&r.isSymbolicLink())return this.filterDir(t);const n=this.entryPath(t);return this.fsw._isntIgnored(n,r)&&this.fsw._hasReadPermissions(r)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}}class nS extends id.EventEmitter{constructor(r={}){super();re(this,"closed");re(this,"options");re(this,"_closers");re(this,"_ignoredPaths");re(this,"_throttled");re(this,"_streams");re(this,"_symlinkPaths");re(this,"_watched");re(this,"_pendingWrites");re(this,"_pendingUnlinks");re(this,"_readyCount");re(this,"_emitReady");re(this,"_closePromise");re(this,"_userIgnored");re(this,"_readyEmitted");re(this,"_emitRaw");re(this,"_boundRemove");re(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;const n=r.awaitWriteFinish,s={stabilityThreshold:2e3,pollInterval:100},o={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...r,ignored:r.ignored?ds(r.ignored):ds([]),awaitWriteFinish:n===!0?s:typeof n=="object"?{...s,...n}:!1};jb&&(o.usePolling=!0),o.atomic===void 0&&(o.atomic=!o.usePolling);const i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){const d=i.toLowerCase();d==="false"||d==="0"?o.usePolling=!1:d==="true"||d==="1"?o.usePolling=!0:o.usePolling=!!d}const a=process.env.CHOKIDAR_INTERVAL;a&&(o.interval=Number.parseInt(a,10));let c=0;this._emitReady=()=>{c++,c>=this._readyCount&&(this._emitReady=Ii,this._readyEmitted=!0,process.nextTick(()=>this.emit(Ie.READY)))},this._emitRaw=(...d)=>this.emit(Ie.RAW,...d),this._boundRemove=this._remove.bind(this),this.options=o,this._nodeFsHandler=new Vb(this),Object.freeze(o)}_addIgnoredPath(r){if(oo(r)){for(const n of this._ignoredPaths)if(oo(n)&&n.path===r.path&&n.recursive===r.recursive)return}this._ignoredPaths.add(r)}_removeIgnoredPath(r){if(this._ignoredPaths.delete(r),typeof r=="string")for(const n of this._ignoredPaths)oo(n)&&n.path===r&&this._ignoredPaths.delete(n)}add(r,n,s){const{cwd:o}=this.options;this.closed=!1,this._closePromise=void 0;let i=al(r);return o&&(i=i.map(a=>Xb(a,o))),i.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=i.length,Promise.all(i.map(async a=>{const c=await this._nodeFsHandler._addToNodeFs(a,!s,void 0,0,n);return c&&this._emitReady(),c})).then(a=>{this.closed||a.forEach(c=>{c&&this.add(se.dirname(c),se.basename(n||c))})}),this}unwatch(r){if(this.closed)return this;const n=al(r),{cwd:s}=this.options;return n.forEach(o=>{!se.isAbsolute(o)&&!this._closers.has(o)&&(s&&(o=se.join(s,o)),o=se.resolve(o)),this._closePath(o),this._addIgnoredPath(o),this._watched.has(o)&&this._addIgnoredPath({path:o,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();const r=[];return this._closers.forEach(n=>n.forEach(s=>{const o=s();o instanceof Promise&&r.push(o)})),this._streams.forEach(n=>n.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(n=>n.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=r.length?Promise.all(r).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){const r={};return this._watched.forEach((n,s)=>{const i=(this.options.cwd?se.relative(this.options.cwd,s):s)||Ju;r[i]=n.getChildren().sort()}),r}emitWithAll(r,n){this.emit(r,...n),r!==Ie.ERROR&&this.emit(Ie.ALL,r,...n)}async _emit(r,n,s){if(this.closed)return;const o=this.options;Bu&&(n=se.normalize(n)),o.cwd&&(n=se.relative(o.cwd,n));const i=[n];s!=null&&i.push(s);const a=o.awaitWriteFinish;let c;if(a&&(c=this._pendingWrites.get(n)))return c.lastChange=new Date,this;if(o.atomic){if(r===Ie.UNLINK)return this._pendingUnlinks.set(n,[r,...i]),setTimeout(()=>{this._pendingUnlinks.forEach((d,l)=>{this.emit(...d),this.emit(Ie.ALL,...d),this._pendingUnlinks.delete(l)})},typeof o.atomic=="number"?o.atomic:100),this;r===Ie.ADD&&this._pendingUnlinks.has(n)&&(r=Ie.CHANGE,this._pendingUnlinks.delete(n))}if(a&&(r===Ie.ADD||r===Ie.CHANGE)&&this._readyEmitted){const d=(l,f)=>{l?(r=Ie.ERROR,i[0]=l,this.emitWithAll(r,i)):f&&(i.length>1?i[1]=f:i.push(f),this.emitWithAll(r,i))};return this._awaitWriteFinish(n,a.stabilityThreshold,r,d),this}if(r===Ie.CHANGE&&!this._throttle(Ie.CHANGE,n,50))return this;if(o.alwaysStat&&s===void 0&&(r===Ie.ADD||r===Ie.ADD_DIR||r===Ie.CHANGE)){const d=o.cwd?se.join(o.cwd,n):n;let l;try{l=await Je.stat(d)}catch{}if(!l||this.closed)return;i.push(l)}return this.emitWithAll(r,i),this}_handleError(r){const n=r&&r.code;return r&&n!=="ENOENT"&&n!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||n!=="EPERM"&&n!=="EACCES")&&this.emit(Ie.ERROR,r),r||this.closed}_throttle(r,n,s){this._throttled.has(r)||this._throttled.set(r,new Map);const o=this._throttled.get(r);if(!o)throw new Error("invalid throttle");const i=o.get(n);if(i)return i.count++,!1;let a;const c=()=>{const l=o.get(n),f=l?l.count:0;return o.delete(n),clearTimeout(a),l&&clearTimeout(l.timeoutObject),f};a=setTimeout(c,s);const d={timeoutObject:a,clear:c,count:0};return o.set(n,d),d}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(r,n,s,o){const i=this.options.awaitWriteFinish;if(typeof i!="object")return;const a=i.pollInterval;let c,d=r;this.options.cwd&&!se.isAbsolute(r)&&(d=se.join(this.options.cwd,r));const l=new Date,f=this._pendingWrites;function y(m){oe.stat(d,($,g)=>{if($||!f.has(r)){$&&$.code!=="ENOENT"&&o($);return}const _=Number(new Date);m&&g.size!==m.size&&(f.get(r).lastChange=_);const p=f.get(r);_-p.lastChange>=n?(f.delete(r),o(void 0,g)):c=setTimeout(y,a,g)})}f.has(r)||(f.set(r,{lastChange:l,cancelWait:()=>(f.delete(r),clearTimeout(c),s)}),c=setTimeout(y,a))}_isIgnored(r,n){if(this.options.atomic&&Hb.test(r))return!0;if(!this._userIgnored){const{cwd:s}=this.options,i=(this.options.ignored||[]).map(cl(s)),c=[...[...this._ignoredPaths].map(cl(s)),...i];this._userIgnored=Jb(c)}return this._userIgnored(r,n)}_isntIgnored(r,n){return!this._isIgnored(r,n)}_getWatchHelpers(r){return new rS(r,this.options.followSymlinks,this)}_getWatchedDir(r){const n=se.resolve(r);return this._watched.has(n)||this._watched.set(n,new Qb(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(r){return this.options.ignorePermissionErrors?!0:!!(Number(r.mode)&256)}_remove(r,n,s){const o=se.join(r,n),i=se.resolve(o);if(s=s??(this._watched.has(o)||this._watched.has(i)),!this._throttle("remove",o,100))return;!s&&this._watched.size===1&&this.add(r,n,!0),this._getWatchedDir(o).getChildren().forEach(m=>this._remove(o,m));const d=this._getWatchedDir(r),l=d.has(n);d.remove(n),this._symlinkPaths.has(i)&&this._symlinkPaths.delete(i);let f=o;if(this.options.cwd&&(f=se.relative(this.options.cwd,o)),this.options.awaitWriteFinish&&this._pendingWrites.has(f)&&this._pendingWrites.get(f).cancelWait()===Ie.ADD)return;this._watched.delete(o),this._watched.delete(i);const y=s?Ie.UNLINK_DIR:Ie.UNLINK;l&&!this._isIgnored(o)&&this._emit(y,o),this._closePath(o)}_closePath(r){this._closeFile(r);const n=se.dirname(r);this._getWatchedDir(n).remove(se.basename(r))}_closeFile(r){const n=this._closers.get(r);n&&(n.forEach(s=>s()),this._closers.delete(r))}_addPathCloser(r,n){if(!n)return;let s=this._closers.get(r);s||(s=[],this._closers.set(r,s)),s.push(n)}_readdirp(r,n){if(this.closed)return;const s={type:Ie.ALL,alwaysStat:!0,lstat:!0,...n,depth:0};let o=Pb(r,s);return this._streams.add(o),o.once(Rb,()=>{o=void 0}),o.once(xu,()=>{o&&(this._streams.delete(o),o=void 0)}),o}}function sS(e,t={}){const r=new nS(t);return r.add(e),r}const oS=process.mas===!0;process.platform!=="win32"&&(z.app.commandLine.appendSwitch("enable-features","Vulkan"),z.app.commandLine.appendSwitch("use-vulkan"),z.app.commandLine.appendSwitch("enable-unsafe-webgpu"));const un=process.env.VITE_DEV_SERVER_URL,ge=new Hu({defaults:{vaultPath:null,vaultBookmark:null}});let pt=null;const qn=new Hu({name:"settings",defaults:{theme:"light",fontFamily:"system",fontSize:17,ollamaBaseUrl:"http://localhost:11434",ollamaEnabled:!0,preferredEngine:"ollama",autoFallback:!0,customSystemPrompt:"",promptTemplates:[],defaultFormat:"md",smartFormatConversion:!0}}),Oo={zh:{about:"关于 {appName}",preferences:"偏好设置...",services:"服务",hide:"隐藏 {appName}",hideOthers:"隐藏其他",unhide:"显示全部",quit:"退出 {appName}",file:"文件",newArticle:"新建文章",newFolder:"新建文件夹",closeWindow:"关闭窗口",edit:"编辑",undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴",pasteAndMatchStyle:"粘贴并匹配样式",delete:"删除",selectAll:"全选",view:"视图",focusMode:"专注模式",cycleEditorMode:"切换编辑模式",reload:"刷新",forceReload:"强制刷新",devTools:"开发者工具",actualSize:"实际大小",zoomIn:"放大",zoomOut:"缩小",fullscreen:"全屏",window:"窗口",minimize:"最小化",zoom:"缩放",front:"前置全部窗口",close:"关闭",help:"帮助",visitGitHub:"访问 GitHub",visitWebsite:"访问官网",openSettings:"打开设置",toggleFocusMode:"切换专注模式",showMainWindow:"显示主窗口",enableSmartAutocomplete:"开启智能续写",disableSmartAutocomplete:"关闭智能续写"},"zh-TW":{about:"關於 {appName}",preferences:"偏好設定...",services:"服務",hide:"隱藏 {appName}",hideOthers:"隱藏其他",unhide:"顯示全部",quit:"結束 {appName}",file:"檔案",newArticle:"新建文章",newFolder:"新建資料夾",closeWindow:"關閉視窗",edit:"編輯",undo:"還原",redo:"重做",cut:"剪下",copy:"複製",paste:"貼上",pasteAndMatchStyle:"貼上並符合樣式",delete:"刪除",selectAll:"全選",view:"檢視",focusMode:"專注模式",reload:"重新載入",forceReload:"強制重新載入",devTools:"開發人員工具",actualSize:"實際大小",zoomIn:"放大",zoomOut:"縮小",fullscreen:"全螢幕",window:"視窗",minimize:"最小化",zoom:"縮放",front:"將全部移到最前面",close:"關閉",help:"說明",visitGitHub:"造訪 GitHub",visitWebsite:"造訪官網",openSettings:"開啟設定",toggleFocusMode:"切換專注模式",showMainWindow:"顯示主視窗",enableSmartAutocomplete:"開啟智能續寫",disableSmartAutocomplete:"關閉智能續寫"},en:{about:"About {appName}",preferences:"Preferences...",services:"Services",hide:"Hide {appName}",hideOthers:"Hide Others",unhide:"Show All",quit:"Quit {appName}",file:"File",newArticle:"New Article",newFolder:"New Folder",closeWindow:"Close Window",edit:"Edit",undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste",pasteAndMatchStyle:"Paste and Match Style",delete:"Delete",selectAll:"Select All",view:"View",focusMode:"Focus Mode",cycleEditorMode:"Cycle Editor Mode",reload:"Reload",forceReload:"Force Reload",devTools:"Developer Tools",actualSize:"Actual Size",zoomIn:"Zoom In",zoomOut:"Zoom Out",fullscreen:"Toggle Fullscreen",window:"Window",minimize:"Minimize",zoom:"Zoom",front:"Bring All to Front",close:"Close",help:"Help",visitGitHub:"Visit GitHub",visitWebsite:"Official Website",openSettings:"Open Settings",toggleFocusMode:"Toggle Focus Mode",showMainWindow:"Show Main Window",enableSmartAutocomplete:"Enable Smart Autocomplete",disableSmartAutocomplete:"Disable Smart Autocomplete"},ja:{about:"{appName} について",preferences:"環境設定...",services:"サービス",hide:"{appName} を隠す",hideOthers:"ほかを隠す",unhide:"すべてを表示",quit:"{appName} を終了",file:"ファイル",newArticle:"新規記事",newFolder:"新規フォルダ",closeWindow:"ウィンドウを閉じる",edit:"編集",undo:"取り消す",redo:"やり直す",cut:"カット",copy:"コピー",paste:"ペースト",pasteAndMatchStyle:"ペーストしてスタイルを合わせる",delete:"削除",selectAll:"すべてを選択",view:"表示",focusMode:"集中モード",reload:"再読み込み",forceReload:"強制再読み込み",devTools:"開発者ツール",actualSize:"実際のサイズ",zoomIn:"拡大",zoomOut:"縮小",fullscreen:"フルスクリーン",window:"ウィンドウ",minimize:"最小化",zoom:"拡大/縮小",front:"すべてを手前に移動",close:"閉じる",help:"ヘルプ",visitGitHub:"GitHub を開く",visitWebsite:"公式サイトを開く",openSettings:"設定を開く",toggleFocusMode:"集中モードを切り替え",showMainWindow:"メインウィンドウを表示",enableSmartAutocomplete:"スマート入力補完を有効化",disableSmartAutocomplete:"スマート入力補完を無効化"},ko:{about:"{appName} 정보",preferences:"환경설정...",services:"서비스",hide:"{appName} 숨기기",hideOthers:"기타 숨기기",unhide:"모두 표시",quit:"{appName} 종료",file:"파일",newArticle:"새 글",newFolder:"새 폴더",closeWindow:"창 닫기",edit:"편집",undo:"실행 취소",redo:"다시 실행",cut:"오려두기",copy:"복사",paste:"붙여넣기",pasteAndMatchStyle:"붙여넣고 스타일 맞추기",delete:"삭제",selectAll:"모두 선택",view:"보기",focusMode:"집중 모드",reload:"새로 고침",forceReload:"강제 새로 고침",devTools:"개발자 도구",actualSize:"실제 크기",zoomIn:"확대",zoomOut:"축소",fullscreen:"전체 화면",window:"창",minimize:"최소화",zoom:"확대/축소",front:"모두 앞으로 가져오기",close:"닫기",help:"도움말",visitGitHub:"GitHub 방문",visitWebsite:"공식 웹사이트 방문",openSettings:"설정 열기",toggleFocusMode:"집중 모드 전환",showMainWindow:"메인 윈도우 표시",enableSmartAutocomplete:"스마트 자동완성 활성화",disableSmartAutocomplete:"스마트 자동완성 비활성화"},fr:{about:"À propos de {appName}",preferences:"Préférences...",services:"Services",hide:"Masquer {appName}",hideOthers:"Masquer les autres",unhide:"Tout afficher",quit:"Quitter {appName}",file:"Fichier",newArticle:"Nouvel Article",newFolder:"Nouveau Dossier",closeWindow:"Fermer la fenêtre",edit:"Édition",undo:"Annuler",redo:"Rétablir",cut:"Couper",copy:"Copier",paste:"Coller",pasteAndMatchStyle:"Coller et adapter le style",delete:"Supprimer",selectAll:"Tout sélectionner",view:"Présentation",focusMode:"Mode Focus",reload:"Actualiser",forceReload:"Forcer l'actualisation",devTools:"Outils de développement",actualSize:"Taille réelle",zoomIn:"Zoom avant",zoomOut:"Zoom arrière",fullscreen:"Plein écran",window:"Fenêtre",minimize:"Réduire",zoom:"Zoom",front:"Tout ramener au premier plan",close:"Fermer",help:"Aide",visitGitHub:"Visiter GitHub",visitWebsite:"Site officiel",openSettings:"Ouvrir les Paramètres",toggleFocusMode:"Basculer Mode Focus",showMainWindow:"Afficher la fenêtre principale",enableSmartAutocomplete:"Activer Auto-complétion Intelligente",disableSmartAutocomplete:"Désactiver Auto-complétion Intelligente"},de:{about:"Über {appName}",preferences:"Einstellungen...",services:"Dienste",hide:"{appName} ausblenden",hideOthers:"Andere ausblenden",unhide:"Alle einblenden",quit:"{appName} beenden",file:"Ablage",newArticle:"Neuer Artikel",newFolder:"Neuer Ordner",closeWindow:"Fenster schließen",edit:"Bearbeiten",undo:"Widerrufen",redo:"Wiederholen",cut:"Ausschneiden",copy:"Kopieren",paste:"Einfügen",pasteAndMatchStyle:"Einsetzen und Stil anpassen",delete:"Löschen",selectAll:"Alles auswählen",view:"Darstellung",focusMode:"Fokus-Modus",reload:"Neu laden",forceReload:"Neu laden erzwingen",devTools:"Entwicklertools",actualSize:"Tatsächliche Größe",zoomIn:"Vergrößern",zoomOut:"Verkleinern",fullscreen:"Vollbild",window:"Fenster",minimize:"Minimieren",zoom:"Zoomen",front:"Alle nach vorne bringen",close:"Schließen",help:"Hilfe",visitGitHub:"GitHub besuchen",visitWebsite:"Offizielle Webseite",openSettings:"Einstellungen öffnen",toggleFocusMode:"Fokus-Modus umschalten",showMainWindow:"Hauptfenster anzeigen",enableSmartAutocomplete:"Intelligente Autovervollständigung aktivieren",disableSmartAutocomplete:"Intelligente Autovervollständigung deaktivieren"},es:{about:"Acerca de {appName}",preferences:"Preferencias...",services:"Servicios",hide:"Ocultar {appName}",hideOthers:"Ocultar otros",unhide:"Mostrar todo",quit:"Salir de {appName}",file:"Archivo",newArticle:"Nuevo Artículo",newFolder:"Nueva Carpeta",closeWindow:"Cerrar ventana",edit:"Edición",undo:"Deshacer",redo:"Rehacer",cut:"Cortar",copy:"Copiar",paste:"Pegar",pasteAndMatchStyle:"Pegar y ajustar estilo",delete:"Eliminar",selectAll:"Seleccionar todo",view:"Vista",focusMode:"Modo Enfoque",reload:"Recargar",forceReload:"Forzar recarga",devTools:"Herramientas de desarrollo",actualSize:"Tamaño real",zoomIn:"Ampliar",zoomOut:"Reducir",fullscreen:"Pantalla completa",window:"Ventana",minimize:"Minimizar",zoom:"Zoom",front:"Traer todo al frente",close:"Cerrar",help:"Ayuda",visitGitHub:"Visitar GitHub",visitWebsite:"Sitio web oficial",openSettings:"Abrir Ajustes",toggleFocusMode:"Alternar Modo Enfoque",showMainWindow:"Mostrar ventana principal",enableSmartAutocomplete:"Activar Autocompletado Inteligente",disableSmartAutocomplete:"Desactivar Autocompletado Inteligente"}};function aS(){const e=z.app.getLocale(),t={"zh-CN":"zh","zh-Hans":"zh","zh-SG":"zh","zh-TW":"zh-TW","zh-Hant":"zh-TW","zh-HK":"zh-TW","zh-MO":"zh-TW",en:"en","en-US":"en","en-GB":"en","en-AU":"en","en-CA":"en",ja:"ja","ja-JP":"ja",ko:"ko","ko-KR":"ko",fr:"fr","fr-FR":"fr","fr-CA":"fr",de:"de","de-DE":"de","de-AT":"de","de-CH":"de",es:"es","es-ES":"es","es-MX":"es","es-AR":"es"};if(t[e])return t[e];const r=e.split("-")[0];return t[r]?t[r]:"en"}let Io={menu:Oo.en};function Qu(e){const t=Oo[e];t?(Io={menu:t},console.log(`✓ 菜单语言: ${e}`)):(Io={menu:Oo.en},console.log(`⚠ 语言 ${e} 不支持,使用英文`))}function ne(e,t){const r=e.split(".");let n=Io;for(const o of r)if(n&&typeof n=="object")n=n[o];else return e;let s=typeof n=="string"?n:e;return t&&Object.keys(t).forEach(o=>{s=s.replace(`{${o}}`,t[o])}),s}let tt=null;const iS=[".DS_Store",".git","node_modules",".zennote","*.swp","*.swo","*~"];let L=null,ed=!0,To=null;const td=[".md",".markdown",".txt",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"];function cS(){if(un)return null;const e=process.argv.slice(1);for(const t of e)if(!t.startsWith("-")&&te.existsSync(t)){const r=Y.extname(t).toLowerCase();if(td.includes(r))return console.log("📂 从命令行参数获取文件:",t),t}return null}function rd(e){return e.startsWith(".")?!0:iS.some(t=>t.includes("*")?new RegExp("^"+t.replace(/\*/g,".*")+"$").test(e):e===t)}async function nd(e,t){const r=await te.promises.readdir(e,{withFileTypes:!0}),n=[];for(const s of r){if(rd(s.name))continue;const o=Y.join(e,s.name),i=Y.relative(t,o),a=await te.promises.stat(o);if(s.isDirectory()){const c=await nd(o,t);n.push({name:s.name,path:i,isDirectory:!0,children:c,modifiedAt:a.mtimeMs})}else{const c=Y.extname(s.name).toLowerCase();[".txt",".md",".markdown",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"].includes(c)&&n.push({name:s.name,path:i,isDirectory:!1,extension:c,modifiedAt:a.mtimeMs})}}return n.sort((s,o)=>s.isDirectory&&!o.isDirectory?-1:!s.isDirectory&&o.isDirectory?1:s.isDirectory&&o.isDirectory?s.name.localeCompare(o.name,"zh-CN"):(o.modifiedAt||0)-(s.modifiedAt||0))}function Yr(e){const t=Y.join(e,".zennote"),r=Y.join(t,"chats"),n=Y.join(t,"settings");te.existsSync(t)||te.mkdirSync(t,{recursive:!0}),te.existsSync(r)||te.mkdirSync(r,{recursive:!0}),te.existsSync(n)||te.mkdirSync(n,{recursive:!0})}function lS(){if(z.ipcMain.handle("fs:getVaultPath",()=>{const e=ge.get("vaultPath"),t=ge.get("vaultBookmark");if(e){if(t&&!pt)try{pt=z.app.startAccessingSecurityScopedResource(t),console.log("🔓 已恢复文件夹访问权限")}catch(r){console.warn("⚠️ 恢复权限失败,可能需要重新选择文件夹:",r)}if(!te.existsSync(e))return console.log("⚠️ Vault 文件夹不存在,自动清除配置:",e),ge.set("vaultPath",null),ge.set("vaultBookmark",null),pt&&(pt(),pt=null),null}return e}),z.ipcMain.handle("fs:setVaultPath",(e,t)=>(ge.set("vaultPath",t),Yr(t),!0)),z.ipcMain.handle("fs:selectDirectory",async()=>{const e=await z.dialog.showOpenDialog(L,{properties:["openDirectory","createDirectory"],securityScopedBookmarks:!0,title:"选择笔记存储目录",buttonLabel:"选择此文件夹"});if(e.canceled||e.filePaths.length===0)return null;const t=e.filePaths[0];return e.bookmarks&&e.bookmarks.length>0&&(ge.set("vaultBookmark",e.bookmarks[0]),console.log("📑 已保存 Security-Scoped Bookmark")),ge.set("vaultPath",t),Yr(t),t}),z.ipcMain.handle("fs:disconnectVault",async()=>(pt&&(pt(),pt=null,console.log("🔒 已释放文件夹访问权限")),ge.delete("vaultPath"),ge.delete("vaultBookmark"),!0)),z.ipcMain.handle("fs:readDirectory",async(e,t)=>{const r=t||ge.get("vaultPath");if(!r)return[];try{return await nd(r,r)}catch(n){return console.error("读取目录失败:",n),[]}}),z.ipcMain.handle("fs:readFile",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=Y.join(r,t);return await te.promises.readFile(n,"utf-8")}),z.ipcMain.handle("fs:writeFile",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");const s=Y.join(n,t),o=Y.dirname(s);return te.existsSync(o)||te.mkdirSync(o,{recursive:!0}),await te.promises.writeFile(s,r,"utf-8"),!0}),z.ipcMain.handle("fs:createFile",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=Y.join(r,t);return await te.promises.writeFile(n,"","utf-8"),!0}),z.ipcMain.handle("fs:createDirectory",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=Y.join(r,t);return await te.promises.mkdir(n,{recursive:!0}),!0}),z.ipcMain.handle("fs:deleteFile",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=Y.join(r,t);try{return await z.shell.trashItem(n),!0}catch(s){return console.error("移动到回收站失败,尝试永久删除:",s),(await te.promises.stat(n)).isDirectory()?await te.promises.rm(n,{recursive:!0,force:!0}):await te.promises.unlink(n),!0}}),z.ipcMain.handle("fs:renameFile",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");const s=Y.join(n,t),o=Y.join(n,r);return await te.promises.rename(s,o),!0}),z.ipcMain.handle("fs:readFileBuffer",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=Y.join(r,t);return(await te.promises.readFile(n)).buffer}),z.ipcMain.handle("fs:getExternalFilePath",()=>{const e=To||cS();return To=null,e}),z.ipcMain.handle("fs:copyExternalFile",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");console.log("📥 复制外部文件:",t),console.log(" - 目标目录:",r);const s=Y.basename(t),o=Y.extname(s).toLowerCase();if(![".txt",".md",".markdown",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"].includes(o))throw console.log(" - ❌ 不支持的文件格式:",o),new Error(`不支持的文件格式: ${o}`);const a=t.replace(/\\/g,"/"),c=n.replace(/\\/g,"/");if(a.startsWith(c+"/"))return console.log(" - 文件已在 Vault 内,返回相对路径"),Y.relative(n,t);const d=r?Y.join(n,r):n;te.existsSync(d)||te.mkdirSync(d,{recursive:!0});const l=await te.promises.readFile(t),f=yr.createHash("md5").update(l).digest("hex").substring(0,8);console.log(" - 源文件 hash:",f);const y=Y.basename(s,o);let m=s,$=Y.join(d,m);if(te.existsSync($)){const _=await te.promises.readFile($),p=yr.createHash("md5").update(_).digest("hex").substring(0,8);if(f===p)return console.log(" - ✨ 文件已存在且内容相同,跳过复制"),r?`${r}/${m}`:m;m=`${y}_${f}${o}`,$=Y.join(d,m),console.log(" - 文件名冲突,使用新名称:",m)}try{await te.promises.copyFile(t,$),console.log(" - ✅ 复制成功:",m)}catch(_){throw console.error(" - ❌ 复制失败:",_),_}const g=r?`${r}/${m}`:m;return console.log(" - 返回路径:",g),g}),z.ipcMain.handle("fs:saveImage",async(e,t,r,n)=>{const s=ge.get("vaultPath");if(!s)throw new Error("未设置 Vault 路径");const o=Y.join(s,t,".images");te.existsSync(o)||te.mkdirSync(o,{recursive:!0});const i=r.match(/^data:image\/(\w+);base64,(.+)$/);if(!i)throw new Error("无效的图片数据");const a=i[1]==="jpeg"?"jpg":i[1],c=Buffer.from(i[2],"base64"),d=Date.now(),l=n||`image_${d}.${a}`,f=Y.join(o,l);return await te.promises.writeFile(f,c),`.images/${l}`}),z.ipcMain.handle("fs:selectAndCopyImage",async(e,t)=>{const r=ge.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=await z.dialog.showOpenDialog(L,{properties:["openFile"],filters:[{name:"图片",extensions:["jpg","jpeg","png","gif","webp","svg"]}],title:"选择图片",buttonLabel:"插入图片"});if(n.canceled||n.filePaths.length===0)return null;const s=n.filePaths[0],o=Y.basename(s),i=s.replace(/\\/g,"/"),a=r.replace(/\\/g,"/");if(console.log("📷 图片选择调试:"),console.log(" - 源文件路径:",s),console.log(" - 规范化源路径:",i),console.log(" - Vault 路径:",r),console.log(" - 规范化 Vault 路径:",a),console.log(" - 相对目录路径:",t),console.log(" - 是否在 Vault 内:",i.startsWith(a+"/")),i.startsWith(a+"/")){Y.relative(r,s);const _=t?Y.join(r,t):r,p=Y.relative(_,s);return console.log(" - 图片在 Vault 内,使用相对路径:",p),p.replace(/\\/g,"/")}console.log(" - 图片在 Vault 外,复制到 .images 目录");const c=Y.join(r,t,".images");console.log(" - 目标目录:",c),te.existsSync(c)||(console.log(" - 创建目录:",c),te.mkdirSync(c,{recursive:!0}));const d=await te.promises.readFile(s),l=yr.createHash("md5").update(d).digest("hex").substring(0,8);console.log(" - 源文件 hash:",l);try{const _=await te.promises.readdir(c);for(const p of _){const S=Y.join(c,p),R=await te.promises.readFile(S),T=yr.createHash("md5").update(R).digest("hex").substring(0,8);if(l===T)return console.log(" - ✨ 找到相同内容图片,复用:",p),`.images/${p}`}}catch(_){console.log(" - 检查现有图片失败,继续复制:",_)}const f=Y.extname(o),m=`${Y.basename(o,f)}_${l}${f}`,$=Y.join(c,m);if(te.existsSync($))return console.log(" - ✨ 目标文件已存在,直接复用:",m),`.images/${m}`;console.log(" - 目标文件路径:",$);try{await te.promises.copyFile(s,$),console.log(" - ✅ 复制成功!")}catch(_){throw console.error(" - ❌ 复制失败:",_),_}const g=`.images/${m}`;return console.log(" - 返回路径:",g),g}),z.ipcMain.handle("fs:downloadAndSaveImage",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");console.log("📥 下载网络图片:",t),console.log(" - 目标目录:",r);try{const s=await z.net.fetch(t);if(!s.ok)throw new Error(`下载失败: HTTP ${s.status}`);const o=await s.arrayBuffer(),i=Buffer.from(o);let a="jpg";const c=s.headers.get("content-type");if(c)c.includes("png")?a="png":c.includes("gif")?a="gif":c.includes("webp")?a="webp":c.includes("svg")&&(a="svg");else{const $=new URL(t).pathname,g=Y.extname($).toLowerCase().replace(".","");["jpg","jpeg","png","gif","webp","svg"].includes(g)&&(a=g==="jpeg"?"jpg":g)}const d=Y.join(n,r,".images");te.existsSync(d)||te.mkdirSync(d,{recursive:!0});const l=yr.createHash("md5").update(i).digest("hex").substring(0,8);console.log(" - 图片 hash:",l);try{const $=await te.promises.readdir(d);for(const g of $){const _=Y.join(d,g),p=await te.promises.readFile(_),S=yr.createHash("md5").update(p).digest("hex").substring(0,8);if(l===S)return console.log(" - ✨ 找到相同内容图片,复用:",g),`.images/${g}`}}catch($){console.log(" - 检查现有图片失败,继续保存:",$)}const y=`web_${Date.now()}_${l}.${a}`,m=Y.join(d,y);return await te.promises.writeFile(m,i),console.log(" - ✅ 保存成功:",y),`.images/${y}`}catch(s){throw console.error(" - ❌ 下载失败:",s),s}}),z.ipcMain.handle("fs:isImageReferenced",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)return!1;const s=Y.basename(t),o=Y.dirname(t),i=Y.dirname(o),a=i==="."?n:Y.join(n,i);console.log(`🔍 检查图片引用: ${s}`),console.log(` - 搜索目录: ${a}`);try{const c=await te.promises.readdir(a);for(const d of c){if(r&&d===Y.basename(r)){console.log(` - 跳过排除文件: ${d}`);continue}if(!d.endsWith(".md")&&!d.endsWith(".txt"))continue;const l=Y.join(a,d);if((await te.promises.stat(l)).isDirectory())continue;if((await te.promises.readFile(l,"utf-8")).includes(s))return console.log(` - ✓ 图片被引用: ${d}`),!0}}catch(c){console.error("检查图片引用失败:",c)}return console.log(" - ✗ 图片未被引用"),!1}),z.ipcMain.handle("fs:deleteUnreferencedImage",async(e,t)=>{const r=ge.get("vaultPath");if(!r)return!1;const n=Y.join(r,t);if(te.existsSync(n))try{return await te.promises.unlink(n),console.log("🗑️ 删除未引用图片:",t),!0}catch(s){return console.error("删除图片失败:",s),!1}return!1}),z.ipcMain.handle("chat:load",async(e,t)=>{const r=ge.get("vaultPath");if(!r)return[];const n=Buffer.from(t).toString("base64").replace(/[\/+=]/g,"_"),s=Y.join(r,".zennote","chats",`${n}.json`);try{const o=await te.promises.readFile(s,"utf-8");return JSON.parse(o)}catch{return[]}}),z.ipcMain.handle("chat:save",async(e,t,r)=>{const n=ge.get("vaultPath");if(!n)return!1;Yr(n);const s=Buffer.from(t).toString("base64").replace(/[\/+=]/g,"_"),o=Y.join(n,".zennote","chats",`${s}.json`);return await te.promises.writeFile(o,JSON.stringify(r,null,2),"utf-8"),!0}),z.ipcMain.handle("chat:deleteAll",async()=>{const e=ge.get("vaultPath");if(!e)return!1;const t=Y.join(e,".zennote","chats");try{if(te.existsSync(t)){const r=await te.promises.readdir(t);for(const n of r)n.endsWith(".json")&&await te.promises.unlink(Y.join(t,n));console.log("🗑️ 已清除所有聊天记录:",r.length,"个文件")}return!0}catch(r){return console.error("清除聊天记录失败:",r),!1}}),z.ipcMain.handle("export-markdown-to-pdf",async(e,t)=>{const{htmlContent:r,outputPath:n,title:s}=t,o=new z.BrowserWindow({width:800,height:600,show:!1,webPreferences:{nodeIntegration:!1,contextIsolation:!0}});try{const i=` + deps: ${u}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[d,u]=o(c);a(c,d),i(c,u)}};function o({schema:c}){const d={},u={};for(const f in c){if(f==="__proto__")continue;const v=Array.isArray(c[f])?d:u;v[f]=c[f]}return[d,u]}function a(c,d=c.schema){const{gen:u,data:f,it:v}=c;if(Object.keys(d).length===0)return;const y=u.let("missing");for(const w in d){const g=d[w];if(g.length===0)continue;const $=(0,n.propertyInData)(u,f,w,v.opts.ownProperties);c.setParams({property:w,depsCount:g.length,deps:g.join(", ")}),v.allErrors?u.if($,()=>{for(const m of g)(0,n.checkReportMissingProp)(c,m)}):(u.if((0,t._)`${$} && (${(0,n.checkMissingProp)(c,g,y)})`),(0,n.reportMissingProp)(c,y),u.else())}}e.validatePropertyDeps=a;function i(c,d=c.schema){const{gen:u,data:f,keyword:v,it:y}=c,w=u.name("valid");for(const g in d)(0,r.alwaysValidSchema)(y,d[g])||(u.if((0,n.propertyInData)(u,f,g,y.opts.ownProperties),()=>{const $=c.subschema({keyword:v,schemaProp:g},w);c.mergeValidEvaluated($,w)},()=>u.var(w,!0)),c.ok(w))}e.validateSchemaDeps=i,e.default=s})(bd);var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});const Sd=ie,Ew=D,bw={message:"property name must be valid",params:({params:e})=>(0,Sd._)`{propertyName: ${e.propertyName}}`},Sw={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:bw,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,Ew.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,Sd.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};Ai.default=Sw;var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});const Wn=le,at=ie,Pw=St,xn=D,Nw={message:"must NOT have additional properties",params:({params:e})=>(0,at._)`{additionalProperty: ${e.additionalProperty}}`},Rw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Nw,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:i,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,xn.alwaysValidSchema)(a,r))return;const d=(0,Wn.allSchemaProperties)(n.properties),u=(0,Wn.allSchemaProperties)(n.patternProperties);f(),e.ok((0,at._)`${o} === ${Pw.default.errors}`);function f(){t.forIn("key",s,$=>{!d.length&&!u.length?w($):t.if(v($),()=>w($))})}function v($){let m;if(d.length>8){const E=(0,xn.schemaRefOrVal)(a,n.properties,"properties");m=(0,Wn.isOwnProperty)(t,E,$)}else d.length?m=(0,at.or)(...d.map(E=>(0,at._)`${$} === ${E}`)):m=at.nil;return u.length&&(m=(0,at.or)(m,...u.map(E=>(0,at._)`${(0,Wn.usePattern)(e,E)}.test(${$})`))),(0,at.not)(m)}function y($){t.code((0,at._)`delete ${s}[${$}]`)}function w($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){y($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0,xn.alwaysValidSchema)(a,r)){const m=t.name("valid");c.removeAdditional==="failing"?(g($,m,!1),t.if((0,at.not)(m),()=>{e.reset(),y($)})):(g($,m),i||t.if((0,at.not)(m),()=>t.break()))}}function g($,m,E){const N={keyword:"additionalProperties",dataProp:$,dataPropType:xn.Type.Str};E===!1&&Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(N,m)}}};Gs.default=Rw;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});const Ow=ht,xc=le,ho=D,Bc=Gs,Iw={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Bc.default.code(new Ow.KeywordCxt(o,Bc.default,"additionalProperties"));const a=(0,xc.allSchemaProperties)(r);for(const f of a)o.definedProperties.add(f);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=ho.mergeEvaluated.props(t,(0,ho.toHash)(a),o.props));const i=a.filter(f=>!(0,ho.alwaysValidSchema)(o,r[f]));if(i.length===0)return;const c=t.name("valid");for(const f of i)d(f)?u(f):(t.if((0,xc.propertyInData)(t,s,f,o.opts.ownProperties)),u(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function d(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function u(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};ki.default=Iw;var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});const Yc=le,Bn=ie,Jc=D,Xc=D,Tw={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:a}=o,i=(0,Yc.allSchemaProperties)(r),c=i.filter(g=>(0,Jc.alwaysValidSchema)(o,r[g]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===!0))return;const d=a.strictSchema&&!a.allowMatchingProperties&&s.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof Bn.Name)&&(o.props=(0,Xc.evaluatedPropsToName)(t,o.props));const{props:f}=o;v();function v(){for(const g of i)d&&y(g),o.allErrors?w(g):(t.var(u,!0),w(g),t.if(u))}function y(g){for(const $ in d)new RegExp(g).test($)&&(0,Jc.checkStrictMode)(o,`property ${$} matches pattern ${g} (use allowMatchingProperties)`)}function w(g){t.forIn("key",n,$=>{t.if((0,Bn._)`${(0,Yc.usePattern)(e,g)}.test(${$})`,()=>{const m=c.includes(g);m||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:$,dataPropType:Xc.Type.Str},u),o.opts.unevaluated&&f!==!0?t.assign((0,Bn._)`${f}[${$}]`,!0):!m&&!o.allErrors&&t.if((0,Bn.not)(u),()=>t.break())})})}}};Ci.default=Tw;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0});const jw=D,Aw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,jw.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"}};Mi.default=Aw;var Di={};Object.defineProperty(Di,"__esModule",{value:!0});const kw=le,Cw={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kw.validateUnion,error:{message:"must match a schema in anyOf"}};Di.default=Cw;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});const hs=ie,Mw=D,Dw={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,hs._)`{passingSchemas: ${e.passing}}`},Fw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Dw,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,a=t.let("valid",!1),i=t.let("passing",null),c=t.name("_valid");e.setParams({passing:i}),t.block(d),e.result(a,()=>e.reset(),()=>e.error(!0));function d(){o.forEach((u,f)=>{let v;(0,Mw.alwaysValidSchema)(s,u)?t.var(c,!0):v=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,hs._)`${c} && ${a}`).assign(a,!1).assign(i,(0,hs._)`[${i}, ${f}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(i,f),v&&e.mergeEvaluated(v,hs.Name)})})}}};Fi.default=Fw;var Li={};Object.defineProperty(Li,"__esModule",{value:!0});const Lw=D,zw={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,a)=>{if((0,Lw.alwaysValidSchema)(n,o))return;const i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i)})}};Li.default=zw;var zi={};Object.defineProperty(zi,"__esModule",{value:!0});const Os=ie,Pd=D,Vw={message:({params:e})=>(0,Os.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Os._)`{failingKeyword: ${e.ifClause}}`},Uw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Vw,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Pd.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=Zc(n,"then"),o=Zc(n,"else");if(!s&&!o)return;const a=t.let("valid",!0),i=t.name("_valid");if(c(),e.reset(),s&&o){const u=t.let("ifClause");e.setParams({ifClause:u}),t.if(i,d("then",u),d("else",u))}else s?t.if(i,d("then")):t.if((0,Os.not)(i),d("else"));e.pass(a,()=>e.error(!0));function c(){const u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);e.mergeEvaluated(u)}function d(u,f){return()=>{const v=e.subschema({keyword:u},i);t.assign(a,i),e.mergeValidEvaluated(v,a),f?t.assign(f,(0,Os._)`${u}`):e.setParams({ifClause:u})}}}};function Zc(e,t){const r=e.schema[t];return r!==void 0&&!(0,Pd.alwaysValidSchema)(e,r)}zi.default=Uw;var Vi={};Object.defineProperty(Vi,"__esModule",{value:!0});const qw=D,Gw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,qw.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Vi.default=Gw;Object.defineProperty(Oi,"__esModule",{value:!0});const Kw=Zr,Hw=Ii,Ww=Qr,xw=Ti,Bw=ji,Yw=bd,Jw=Ai,Xw=Gs,Zw=ki,Qw=Ci,eE=Mi,tE=Di,rE=Fi,nE=Li,sE=zi,oE=Vi;function aE(e=!1){const t=[eE.default,tE.default,rE.default,nE.default,sE.default,oE.default,Jw.default,Xw.default,Yw.default,Zw.default,Qw.default];return e?t.push(Hw.default,xw.default):t.push(Kw.default,Ww.default),t.push(Bw.default),t}Oi.default=aE;var Ui={},qi={};Object.defineProperty(qi,"__esModule",{value:!0});const be=ie,iE={message:({schemaCode:e})=>(0,be.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,be._)`{format: ${e}}`},cE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:iE,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:d,schemaEnv:u,self:f}=i;if(!c.validateFormats)return;s?v():y();function v(){const w=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),g=r.const("fDef",(0,be._)`${w}[${a}]`),$=r.let("fType"),m=r.let("format");r.if((0,be._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign($,(0,be._)`${g}.type || "string"`).assign(m,(0,be._)`${g}.validate`),()=>r.assign($,(0,be._)`"string"`).assign(m,g)),e.fail$data((0,be.or)(E(),N()));function E(){return c.strictSchema===!1?be.nil:(0,be._)`${a} && !${m}`}function N(){const R=u.$async?(0,be._)`(${g}.async ? await ${m}(${n}) : ${m}(${n}))`:(0,be._)`${m}(${n})`,O=(0,be._)`(typeof ${m} == "function" ? ${R} : ${m}.test(${n}))`;return(0,be._)`${m} && ${m} !== true && ${$} === ${t} && !${O}`}}function y(){const w=f.formats[o];if(!w){E();return}if(w===!0)return;const[g,$,m]=N(w);g===t&&e.pass(R());function E(){if(c.strictSchema===!1){f.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${o}" ignored in schema at path "${d}"`}}function N(O){const x=O instanceof RegExp?(0,be.regexpCode)(O):c.code.formats?(0,be._)`${c.code.formats}${(0,be.getProperty)(o)}`:void 0,re=r.scopeValue("formats",{key:o,ref:O,code:x});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,be._)`${re}.validate`]:["string",O,re]}function R(){if(typeof w=="object"&&!(w instanceof RegExp)&&w.async){if(!u.$async)throw new Error("async format in sync schema");return(0,be._)`await ${m}(${n})`}return typeof $=="function"?(0,be._)`${m}(${n})`:(0,be._)`${m}.test(${n})`}}}};qi.default=cE;Object.defineProperty(Ui,"__esModule",{value:!0});const lE=qi,uE=[lE.default];Ui.default=uE;var Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.contentVocabulary=Hr.metadataVocabulary=void 0;Hr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Hr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(hi,"__esModule",{value:!0});const dE=mi,fE=yi,hE=Oi,mE=Ui,Qc=Hr,pE=[dE.default,fE.default,(0,hE.default)(),mE.default,Qc.metadataVocabulary,Qc.contentVocabulary];hi.default=pE;var Gi={},Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.DiscrError=void 0;var el;(function(e){e.Tag="tag",e.Mapping="mapping"})(el||(Ks.DiscrError=el={}));Object.defineProperty(Gi,"__esModule",{value:!0});const kr=ie,Go=Ks,tl=We,yE=Xr,$E=D,gE={message:({params:{discrError:e,tagName:t}})=>e===Go.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,kr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},_E={keyword:"discriminator",type:"object",schemaType:"object",error:gE,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:a}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=n.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),d=t.const("tag",(0,kr._)`${r}${(0,kr.getProperty)(i)}`);t.if((0,kr._)`typeof ${d} == "string"`,()=>u(),()=>e.error(!1,{discrError:Go.DiscrError.Tag,tag:d,tagName:i})),e.ok(c);function u(){const y=v();t.if(!1);for(const w in y)t.elseIf((0,kr._)`${d} === ${w}`),t.assign(c,f(y[w]));t.else(),e.error(!1,{discrError:Go.DiscrError.Mapping,tag:d,tagName:i}),t.endIf()}function f(y){const w=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:y},w);return e.mergeEvaluated(g,kr.Name),w}function v(){var y;const w={},g=m(s);let $=!0;for(let R=0;Rthis.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const w=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(w,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var d=ht;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var u=ie;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=kn;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var v=Xr;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(Do,Do.exports);var RE=Do.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=RE,r=ie,n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},o={message:({keyword:i,schemaCode:c})=>(0,r.str)`should be ${s[i].okStr} ${c}`,params:({keyword:i,schemaCode:c})=>(0,r._)`{comparison: ${s[i].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:o,code(i){const{gen:c,data:d,schemaCode:u,keyword:f,it:v}=i,{opts:y,self:w}=v;if(!y.validateFormats)return;const g=new t.KeywordCxt(v,w.RULES.all.format.definition,"format");g.$data?$():m();function $(){const N=c.scopeValue("formats",{ref:w.formats,code:y.code.formats}),R=c.const("fmt",(0,r._)`${N}[${g.schemaCode}]`);i.fail$data((0,r.or)((0,r._)`typeof ${R} != "object"`,(0,r._)`${R} instanceof RegExp`,(0,r._)`typeof ${R}.compare != "function"`,E(R)))}function m(){const N=g.schema,R=w.formats[N];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw new Error(`"${f}": format "${N}" does not define "compare" function`);const O=c.scopeValue("formats",{key:N,ref:R,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(N)}`:void 0});i.fail$data(E(O))}function E(N){return(0,r._)`${N}.compare(${d}, ${u}) ${s[f].fail} 0`}},dependencies:["format"]};const a=i=>(i.addKeyword(e.formatLimitDefinition),i);e.default=a})(Lu);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Fu,n=Lu,s=ie,o=new s.Name("fullFormats"),a=new s.Name("fastFormats"),i=(d,u={keywords:!0})=>{if(Array.isArray(u))return c(d,u,r.fullFormats,o),d;const[f,v]=u.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,o],y=u.formats||r.formatNames;return c(d,y,f,v),u.keywords&&(0,n.default)(d),d};i.get=(d,u="full")=>{const v=(u==="fast"?r.fastFormats:r.fullFormats)[d];if(!v)throw new Error(`Unknown format "${d}"`);return v};function c(d,u,f,v){var y,w;(y=(w=d.opts.code).formats)!==null&&y!==void 0||(w.formats=(0,s._)`require("ajv-formats/dist/formats").${v}`);for(const g of u)d.addFormat(g,f[g])}e.exports=t=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i})(Mo,Mo.exports);var OE=Mo.exports;const IE=Fl(OE),TE=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const s=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!jE(s,o)&&n||Object.defineProperty(e,r,o)},jE=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},AE=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},kE=(e,t)=>`/* Wrapped ${e}*/ +${t}`,CE=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ME=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),DE=(e,t,r)=>{const n=r===""?"":`with ${r.trim()}() `,s=kE.bind(null,n,t.toString());Object.defineProperty(s,"name",ME);const{writable:o,enumerable:a,configurable:i}=CE;Object.defineProperty(e,"toString",{value:s,writable:o,enumerable:a,configurable:i})};function FE(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:n}=e;for(const s of Reflect.ownKeys(t))TE(e,t,s,r);return AE(e,t),DE(e,t,n),e}const rl=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:s=!1,after:o=!0}=t;if(r<0||n<0)throw new RangeError("`wait` and `maxWait` must not be negative.");if(!s&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let a,i,c;const d=function(...u){const f=this,v=()=>{a=void 0,i&&(clearTimeout(i),i=void 0),o&&(c=e.apply(f,u))},y=()=>{i=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=e.apply(f,u))},w=s&&!a;return clearTimeout(a),a=setTimeout(v,r),n>0&&n!==Number.POSITIVE_INFINITY&&!i&&(i=setTimeout(y,n)),w&&(c=e.apply(f,u)),c};return FE(d,e),d.cancel=()=>{a&&(clearTimeout(a),a=void 0),i&&(clearTimeout(i),i=void 0)},d};var Ko={exports:{}};const LE="2.0.0",Nd=256,zE=Number.MAX_SAFE_INTEGER||9007199254740991,VE=16,UE=Nd-6,qE=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Hs={MAX_LENGTH:Nd,MAX_SAFE_COMPONENT_LENGTH:VE,MAX_SAFE_BUILD_LENGTH:UE,MAX_SAFE_INTEGER:zE,RELEASE_TYPES:qE,SEMVER_SPEC_VERSION:LE,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const GE=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ws=GE;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Hs,o=Ws;t=e.exports={};const a=t.re=[],i=t.safeRe=[],c=t.src=[],d=t.safeSrc=[],u=t.t={};let f=0;const v="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",s],[v,n]],w=$=>{for(const[m,E]of y)$=$.split(`${m}*`).join(`${m}{0,${E}}`).split(`${m}+`).join(`${m}{1,${E}}`);return $},g=($,m,E)=>{const N=w(m),R=f++;o($,R,m),u[$]=R,c[R]=m,d[R]=N,a[R]=new RegExp(m,E?"g":void 0),i[R]=new RegExp(N,E?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${v}*`),g("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${v}+`),g("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),g("FULL",`^${c[u.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),g("LOOSE",`^${c[u.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),g("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),g("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",c[u.COERCE],!0),g("COERCERTLFULL",c[u.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Ko,Ko.exports);var Mn=Ko.exports;const KE=Object.freeze({loose:!0}),HE=Object.freeze({}),WE=e=>e?typeof e!="object"?KE:e:HE;var Ki=WE;const nl=/^[0-9]+$/,Rd=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:eRd(t,e);var Od={compareIdentifiers:Rd,rcompareIdentifiers:xE};const Yn=Ws,{MAX_LENGTH:sl,MAX_SAFE_INTEGER:Jn}=Hs,{safeRe:Xn,t:Zn}=Mn,BE=Ki,{compareIdentifiers:mo}=Od;let YE=class $t{constructor(t,r){if(r=BE(r),t instanceof $t){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>sl)throw new TypeError(`version is longer than ${sl} characters`);Yn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?Xn[Zn.LOOSE]:Xn[Zn.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Jn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Jn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Jn||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const o=+s;if(o>=0&&ot.major?1:this.minort.minor?1:this.patcht.patch?1:0}comparePre(t){if(t instanceof $t||(t=new $t(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],s=t.prerelease[r];if(Yn("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return mo(n,s)}while(++r)}compareBuild(t){t instanceof $t||(t=new $t(t,this.options));let r=0;do{const n=this.build[r],s=t.build[r];if(Yn("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return mo(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const s=`-${r}`.match(this.options.loose?Xn[Zn.PRERELEASELOOSE]:Xn[Zn.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),mo(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Ue=YE;const ol=Ue,JE=(e,t,r=!1)=>{if(e instanceof ol)return e;try{return new ol(e,t)}catch(n){if(!r)return null;throw n}};var en=JE;const XE=en,ZE=(e,t)=>{const r=XE(e,t);return r?r.version:null};var QE=ZE;const eb=en,tb=(e,t)=>{const r=eb(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var rb=tb;const al=Ue,nb=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new al(e instanceof al?e.version:e,r).inc(t,n,s).version}catch{return null}};var sb=nb;const il=en,ob=(e,t)=>{const r=il(e,null,!0),n=il(t,null,!0),s=r.compare(n);if(s===0)return null;const o=s>0,a=o?r:n,i=o?n:r,c=!!a.prerelease.length;if(!!i.prerelease.length&&!c){if(!i.patch&&!i.minor)return"major";if(i.compareMain(a)===0)return i.minor&&!i.patch?"minor":"patch"}const u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};var ab=ob;const ib=Ue,cb=(e,t)=>new ib(e,t).major;var lb=cb;const ub=Ue,db=(e,t)=>new ub(e,t).minor;var fb=db;const hb=Ue,mb=(e,t)=>new hb(e,t).patch;var pb=mb;const yb=en,$b=(e,t)=>{const r=yb(e,t);return r&&r.prerelease.length?r.prerelease:null};var gb=$b;const cl=Ue,_b=(e,t,r)=>new cl(e,r).compare(new cl(t,r));var mt=_b;const vb=mt,wb=(e,t,r)=>vb(t,e,r);var Eb=wb;const bb=mt,Sb=(e,t)=>bb(e,t,!0);var Pb=Sb;const ll=Ue,Nb=(e,t,r)=>{const n=new ll(e,r),s=new ll(t,r);return n.compare(s)||n.compareBuild(s)};var Hi=Nb;const Rb=Hi,Ob=(e,t)=>e.sort((r,n)=>Rb(r,n,t));var Ib=Ob;const Tb=Hi,jb=(e,t)=>e.sort((r,n)=>Tb(n,r,t));var Ab=jb;const kb=mt,Cb=(e,t,r)=>kb(e,t,r)>0;var xs=Cb;const Mb=mt,Db=(e,t,r)=>Mb(e,t,r)<0;var Wi=Db;const Fb=mt,Lb=(e,t,r)=>Fb(e,t,r)===0;var Id=Lb;const zb=mt,Vb=(e,t,r)=>zb(e,t,r)!==0;var Td=Vb;const Ub=mt,qb=(e,t,r)=>Ub(e,t,r)>=0;var xi=qb;const Gb=mt,Kb=(e,t,r)=>Gb(e,t,r)<=0;var Bi=Kb;const Hb=Id,Wb=Td,xb=xs,Bb=xi,Yb=Wi,Jb=Bi,Xb=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Hb(e,r,n);case"!=":return Wb(e,r,n);case">":return xb(e,r,n);case">=":return Bb(e,r,n);case"<":return Yb(e,r,n);case"<=":return Jb(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var jd=Xb;const Zb=Ue,Qb=en,{safeRe:Qn,t:es}=Mn,eS=(e,t)=>{if(e instanceof Zb)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Qn[es.COERCEFULL]:Qn[es.COERCE]);else{const c=t.includePrerelease?Qn[es.COERCERTLFULL]:Qn[es.COERCERTL];let d;for(;(d=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||d.index+d[0].length!==r.index+r[0].length)&&(r=d),c.lastIndex=d.index+d[1].length+d[2].length;c.lastIndex=-1}if(r===null)return null;const n=r[2],s=r[3]||"0",o=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",i=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Qb(`${n}.${s}.${o}${a}${i}`,t)};var tS=eS;class rS{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}}var nS=rS,po,ul;function pt(){if(ul)return po;ul=1;const e=/\s+/g;class t{constructor(A,V){if(V=s(V),A instanceof t)return A.loose===!!V.loose&&A.includePrerelease===!!V.includePrerelease?A:new t(A.raw,V);if(A instanceof o)return this.raw=A.value,this.set=[[A]],this.formatted=void 0,this;if(this.options=V,this.loose=!!V.loose,this.includePrerelease=!!V.includePrerelease,this.raw=A.trim().replace(e," "),this.set=this.raw.split("||").map(F=>this.parseRange(F.trim())).filter(F=>F.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const F=this.set[0];if(this.set=this.set.filter(B=>!g(B[0])),this.set.length===0)this.set=[F];else if(this.set.length>1){for(const B of this.set)if(B.length===1&&$(B[0])){this.set=[B];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let A=0;A0&&(this.formatted+="||");const V=this.set[A];for(let F=0;F0&&(this.formatted+=" "),this.formatted+=V[F].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(A){const F=((this.options.includePrerelease&&y)|(this.options.loose&&w))+":"+A,B=n.get(F);if(B)return B;const L=this.options.loose,P=L?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];A=A.replace(P,Y(this.options.includePrerelease)),a("hyphen replace",A),A=A.replace(c[d.COMPARATORTRIM],u),a("comparator trim",A),A=A.replace(c[d.TILDETRIM],f),a("tilde trim",A),A=A.replace(c[d.CARETTRIM],v),a("caret trim",A);let p=A.split(" ").map(h=>E(h,this.options)).join(" ").split(/\s+/).map(h=>K(h,this.options));L&&(p=p.filter(h=>(a("loose invalid filter",h,this.options),!!h.match(c[d.COMPARATORLOOSE])))),a("range list",p);const S=new Map,_=p.map(h=>new o(h,this.options));for(const h of _){if(g(h))return[h];S.set(h.value,h)}S.size>1&&S.has("")&&S.delete("");const l=[...S.values()];return n.set(F,l),l}intersects(A,V){if(!(A instanceof t))throw new TypeError("a Range is required");return this.set.some(F=>m(F,V)&&A.set.some(B=>m(B,V)&&F.every(L=>B.every(P=>L.intersects(P,V)))))}test(A){if(!A)return!1;if(typeof A=="string")try{A=new i(A,this.options)}catch{return!1}for(let V=0;VT.value==="<0.0.0-0",$=T=>T.value==="",m=(T,A)=>{let V=!0;const F=T.slice();let B=F.pop();for(;V&&F.length;)V=F.every(L=>B.intersects(L,A)),B=F.pop();return V},E=(T,A)=>(T=T.replace(c[d.BUILD],""),a("comp",T,A),T=x(T,A),a("caret",T),T=R(T,A),a("tildes",T),T=ge(T,A),a("xrange",T),T=Se(T,A),a("stars",T),T),N=T=>!T||T.toLowerCase()==="x"||T==="*",R=(T,A)=>T.trim().split(/\s+/).map(V=>O(V,A)).join(" "),O=(T,A)=>{const V=A.loose?c[d.TILDELOOSE]:c[d.TILDE];return T.replace(V,(F,B,L,P,p)=>{a("tilde",T,F,B,L,P,p);let S;return N(B)?S="":N(L)?S=`>=${B}.0.0 <${+B+1}.0.0-0`:N(P)?S=`>=${B}.${L}.0 <${B}.${+L+1}.0-0`:p?(a("replaceTilde pr",p),S=`>=${B}.${L}.${P}-${p} <${B}.${+L+1}.0-0`):S=`>=${B}.${L}.${P} <${B}.${+L+1}.0-0`,a("tilde return",S),S})},x=(T,A)=>T.trim().split(/\s+/).map(V=>re(V,A)).join(" "),re=(T,A)=>{a("caret",T,A);const V=A.loose?c[d.CARETLOOSE]:c[d.CARET],F=A.includePrerelease?"-0":"";return T.replace(V,(B,L,P,p,S)=>{a("caret",T,B,L,P,p,S);let _;return N(L)?_="":N(P)?_=`>=${L}.0.0${F} <${+L+1}.0.0-0`:N(p)?L==="0"?_=`>=${L}.${P}.0${F} <${L}.${+P+1}.0-0`:_=`>=${L}.${P}.0${F} <${+L+1}.0.0-0`:S?(a("replaceCaret pr",S),L==="0"?P==="0"?_=`>=${L}.${P}.${p}-${S} <${L}.${P}.${+p+1}-0`:_=`>=${L}.${P}.${p}-${S} <${L}.${+P+1}.0-0`:_=`>=${L}.${P}.${p}-${S} <${+L+1}.0.0-0`):(a("no pr"),L==="0"?P==="0"?_=`>=${L}.${P}.${p}${F} <${L}.${P}.${+p+1}-0`:_=`>=${L}.${P}.${p}${F} <${L}.${+P+1}.0-0`:_=`>=${L}.${P}.${p} <${+L+1}.0.0-0`),a("caret return",_),_})},ge=(T,A)=>(a("replaceXRanges",T,A),T.split(/\s+/).map(V=>we(V,A)).join(" ")),we=(T,A)=>{T=T.trim();const V=A.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return T.replace(V,(F,B,L,P,p,S)=>{a("xRange",T,F,B,L,P,p,S);const _=N(L),l=_||N(P),h=l||N(p),b=h;return B==="="&&b&&(B=""),S=A.includePrerelease?"-0":"",_?B===">"||B==="<"?F="<0.0.0-0":F="*":B&&b?(l&&(P=0),p=0,B===">"?(B=">=",l?(L=+L+1,P=0,p=0):(P=+P+1,p=0)):B==="<="&&(B="<",l?L=+L+1:P=+P+1),B==="<"&&(S="-0"),F=`${B+L}.${P}.${p}${S}`):l?F=`>=${L}.0.0${S} <${+L+1}.0.0-0`:h&&(F=`>=${L}.${P}.0${S} <${L}.${+P+1}.0-0`),a("xRange return",F),F})},Se=(T,A)=>(a("replaceStars",T,A),T.trim().replace(c[d.STAR],"")),K=(T,A)=>(a("replaceGTE0",T,A),T.trim().replace(c[A.includePrerelease?d.GTE0PRE:d.GTE0],"")),Y=T=>(A,V,F,B,L,P,p,S,_,l,h,b)=>(N(F)?V="":N(B)?V=`>=${F}.0.0${T?"-0":""}`:N(L)?V=`>=${F}.${B}.0${T?"-0":""}`:P?V=`>=${V}`:V=`>=${V}${T?"-0":""}`,N(_)?S="":N(l)?S=`<${+_+1}.0.0-0`:N(h)?S=`<${_}.${+l+1}.0-0`:b?S=`<=${_}.${l}.${h}-${b}`:T?S=`<${_}.${l}.${+h+1}-0`:S=`<=${S}`,`${V} ${S}`.trim()),fe=(T,A,V)=>{for(let F=0;F0){const B=T[F].semver;if(B.major===A.major&&B.minor===A.minor&&B.patch===A.patch)return!0}return!1}return!0};return po}var yo,dl;function Bs(){if(dl)return yo;dl=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(u,f){if(f=r(f),u instanceof t){if(u.loose===!!f.loose)return u;u=u.value}u=u.trim().split(/\s+/).join(" "),a("comparator",u,f),this.options=f,this.loose=!!f.loose,this.parse(u),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(u){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],v=u.match(f);if(!v)throw new TypeError(`Invalid comparator: ${u}`);this.operator=v[1]!==void 0?v[1]:"",this.operator==="="&&(this.operator=""),v[2]?this.semver=new i(v[2],this.options.loose):this.semver=e}toString(){return this.value}test(u){if(a("Comparator.test",u,this.options.loose),this.semver===e||u===e)return!0;if(typeof u=="string")try{u=new i(u,this.options)}catch{return!1}return o(u,this.operator,this.semver,this.options)}intersects(u,f){if(!(u instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(u.value,f).test(this.value):u.operator===""?u.value===""?!0:new c(this.value,f).test(u.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||u.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||u.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&u.operator.startsWith(">")||this.operator.startsWith("<")&&u.operator.startsWith("<")||this.semver.version===u.semver.version&&this.operator.includes("=")&&u.operator.includes("=")||o(this.semver,"<",u.semver,f)&&this.operator.startsWith(">")&&u.operator.startsWith("<")||o(this.semver,">",u.semver,f)&&this.operator.startsWith("<")&&u.operator.startsWith(">")))}}yo=t;const r=Ki,{safeRe:n,t:s}=Mn,o=jd,a=Ws,i=Ue,c=pt();return yo}const sS=pt(),oS=(e,t,r)=>{try{t=new sS(t,r)}catch{return!1}return t.test(e)};var Ys=oS;const aS=pt(),iS=(e,t)=>new aS(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var cS=iS;const lS=Ue,uS=pt(),dS=(e,t,r)=>{let n=null,s=null,o=null;try{o=new uS(t,r)}catch{return null}return e.forEach(a=>{o.test(a)&&(!n||s.compare(a)===-1)&&(n=a,s=new lS(n,r))}),n};var fS=dS;const hS=Ue,mS=pt(),pS=(e,t,r)=>{let n=null,s=null,o=null;try{o=new mS(t,r)}catch{return null}return e.forEach(a=>{o.test(a)&&(!n||s.compare(a)===1)&&(n=a,s=new hS(n,r))}),n};var yS=pS;const $o=Ue,$S=pt(),fl=xs,gS=(e,t)=>{e=new $S(e,t);let r=new $o("0.0.0");if(e.test(r)||(r=new $o("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const i=new $o(a.semver.version);switch(a.operator){case">":i.prerelease.length===0?i.patch++:i.prerelease.push(0),i.raw=i.format();case"":case">=":(!o||fl(i,o))&&(o=i);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),o&&(!r||fl(r,o))&&(r=o)}return r&&e.test(r)?r:null};var _S=gS;const vS=pt(),wS=(e,t)=>{try{return new vS(e,t).range||"*"}catch{return null}};var ES=wS;const bS=Ue,Ad=Bs(),{ANY:SS}=Ad,PS=pt(),NS=Ys,hl=xs,ml=Wi,RS=Bi,OS=xi,IS=(e,t,r,n)=>{e=new bS(e,n),t=new PS(t,n);let s,o,a,i,c;switch(r){case">":s=hl,o=RS,a=ml,i=">",c=">=";break;case"<":s=ml,o=OS,a=hl,i="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(NS(e,t,n))return!1;for(let d=0;d{y.semver===SS&&(y=new Ad(">=0.0.0")),f=f||y,v=v||y,s(y.semver,f.semver,n)?f=y:a(y.semver,v.semver,n)&&(v=y)}),f.operator===i||f.operator===c||(!v.operator||v.operator===i)&&o(e,v.semver))return!1;if(v.operator===c&&a(e,v.semver))return!1}return!0};var Yi=IS;const TS=Yi,jS=(e,t,r)=>TS(e,t,">",r);var AS=jS;const kS=Yi,CS=(e,t,r)=>kS(e,t,"<",r);var MS=CS;const pl=pt(),DS=(e,t,r)=>(e=new pl(e,r),t=new pl(t,r),e.intersects(t,r));var FS=DS;const LS=Ys,zS=mt;var VS=(e,t,r)=>{const n=[];let s=null,o=null;const a=e.sort((u,f)=>zS(u,f,r));for(const u of a)LS(u,t,r)?(o=u,s||(s=u)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);const i=[];for(const[u,f]of n)u===f?i.push(u):!f&&u===a[0]?i.push("*"):f?u===a[0]?i.push(`<=${f}`):i.push(`${u} - ${f}`):i.push(`>=${u}`);const c=i.join(" || "),d=typeof t.raw=="string"?t.raw:String(t);return c.length{if(e===t)return!0;e=new yl(e,r),t=new yl(t,r);let n=!1;e:for(const s of e.set){for(const o of t.set){const a=GS(s,o,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},qS=[new Ji(">=0.0.0-0")],$l=[new Ji(">=0.0.0")],GS=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===go){if(t.length===1&&t[0].semver===go)return!0;r.includePrerelease?e=qS:e=$l}if(t.length===1&&t[0].semver===go){if(r.includePrerelease)return!0;t=$l}const n=new Set;let s,o;for(const y of e)y.operator===">"||y.operator===">="?s=gl(s,y,r):y.operator==="<"||y.operator==="<="?o=_l(o,y,r):n.add(y.semver);if(n.size>1)return null;let a;if(s&&o){if(a=Xi(s.semver,o.semver,r),a>0)return null;if(a===0&&(s.operator!==">="||o.operator!=="<="))return null}for(const y of n){if(s&&!ln(y,String(s),r)||o&&!ln(y,String(o),r))return null;for(const w of t)if(!ln(y,String(w),r))return!1;return!0}let i,c,d,u,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,v=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const y of t){if(u=u||y.operator===">"||y.operator===">=",d=d||y.operator==="<"||y.operator==="<=",s){if(v&&y.semver.prerelease&&y.semver.prerelease.length&&y.semver.major===v.major&&y.semver.minor===v.minor&&y.semver.patch===v.patch&&(v=!1),y.operator===">"||y.operator===">="){if(i=gl(s,y,r),i===y&&i!==s)return!1}else if(s.operator===">="&&!ln(s.semver,String(y),r))return!1}if(o){if(f&&y.semver.prerelease&&y.semver.prerelease.length&&y.semver.major===f.major&&y.semver.minor===f.minor&&y.semver.patch===f.patch&&(f=!1),y.operator==="<"||y.operator==="<="){if(c=_l(o,y,r),c===y&&c!==o)return!1}else if(o.operator==="<="&&!ln(o.semver,String(y),r))return!1}if(!y.operator&&(o||s)&&a!==0)return!1}return!(s&&d&&!o&&a!==0||o&&u&&!s&&a!==0||v||f)},gl=(e,t,r)=>{if(!e)return t;const n=Xi(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},_l=(e,t,r)=>{if(!e)return t;const n=Xi(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var KS=US;const _o=Mn,vl=Hs,HS=Ue,wl=Od,WS=en,xS=QE,BS=rb,YS=sb,JS=ab,XS=lb,ZS=fb,QS=pb,eP=gb,tP=mt,rP=Eb,nP=Pb,sP=Hi,oP=Ib,aP=Ab,iP=xs,cP=Wi,lP=Id,uP=Td,dP=xi,fP=Bi,hP=jd,mP=tS,pP=Bs(),yP=pt(),$P=Ys,gP=cS,_P=fS,vP=yS,wP=_S,EP=ES,bP=Yi,SP=AS,PP=MS,NP=FS,RP=VS,OP=KS;var IP={parse:WS,valid:xS,clean:BS,inc:YS,diff:JS,major:XS,minor:ZS,patch:QS,prerelease:eP,compare:tP,rcompare:rP,compareLoose:nP,compareBuild:sP,sort:oP,rsort:aP,gt:iP,lt:cP,eq:lP,neq:uP,gte:dP,lte:fP,cmp:hP,coerce:mP,Comparator:pP,Range:yP,satisfies:$P,toComparators:gP,maxSatisfying:_P,minSatisfying:vP,minVersion:wP,validRange:EP,outside:bP,gtr:SP,ltr:PP,intersects:NP,simplifyRange:RP,subset:OP,SemVer:HS,re:_o.re,src:_o.src,tokens:_o.t,SEMVER_SPEC_VERSION:vl.SEMVER_SPEC_VERSION,RELEASE_TYPES:vl.RELEASE_TYPES,compareIdentifiers:wl.compareIdentifiers,rcompareIdentifiers:wl.rcompareIdentifiers};const jr=Fl(IP),TP=Object.prototype.toString,jP="[object Uint8Array]",AP="[object ArrayBuffer]";function kd(e,t,r){return e?e.constructor===t?!0:TP.call(e)===r:!1}function Cd(e){return kd(e,Uint8Array,jP)}function kP(e){return kd(e,ArrayBuffer,AP)}function CP(e){return Cd(e)||kP(e)}function MP(e){if(!Cd(e))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function DP(e){if(!CP(e))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function vo(e,t){if(e.length===0)return new Uint8Array(0);t??(t=e.reduce((s,o)=>s+o.length,0));const r=new Uint8Array(t);let n=0;for(const s of e)MP(s),r.set(s,n),n+=s.length;return r}const ts={utf8:new globalThis.TextDecoder("utf8")};function rs(e,t="utf8"){return DP(e),ts[t]??(ts[t]=new globalThis.TextDecoder(t)),ts[t].decode(e)}function FP(e){if(typeof e!="string")throw new TypeError(`Expected \`string\`, got \`${typeof e}\``)}const LP=new globalThis.TextEncoder;function ns(e){return FP(e),LP.encode(e)}Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));const wo="aes-256-cbc",Vt=()=>Object.create(null),El=e=>e!==void 0,Eo=(e,t)=>{const r=new Set(["undefined","symbol","function"]),n=typeof t;if(r.has(n))throw new TypeError(`Setting a value of type \`${n}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},qt="__internal__",bo=`${qt}.migrations.version`;var Kt,lt,qe,Qe,_r,vr,Ur,gt,Oe,Md,Dd,Fd,Ld,zd,Vd,Ud,qd;class zP{constructor(t={}){yt(this,Oe);J(this,"path");J(this,"events");yt(this,Kt);yt(this,lt);yt(this,qe);yt(this,Qe,{});yt(this,_r,!1);yt(this,vr);yt(this,Ur);yt(this,gt);J(this,"_deserialize",t=>JSON.parse(t));J(this,"_serialize",t=>JSON.stringify(t,void 0," "));const r=Pt(this,Oe,Md).call(this,t);Be(this,qe,r),Pt(this,Oe,Dd).call(this,r),Pt(this,Oe,Ld).call(this,r),Pt(this,Oe,zd).call(this,r),this.events=new EventTarget,Be(this,lt,r.encryptionKey),this.path=Pt(this,Oe,Vd).call(this,r),Pt(this,Oe,Ud).call(this,r),r.watch&&this._watch()}get(t,r){if(ne(this,qe).accessPropertiesByDotNotation)return this._get(t,r);const{store:n}=this;return t in n?n[t]:r}set(t,r){if(typeof t!="string"&&typeof t!="object")throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`);if(typeof t!="object"&&r===void 0)throw new TypeError("Use `delete()` to clear values");if(this._containsReservedKey(t))throw new TypeError(`Please don't use the ${qt} key, as it's used to manage this module internal operations.`);const{store:n}=this,s=(o,a)=>{if(Eo(o,a),ne(this,qe).accessPropertiesByDotNotation)Dn(n,o,a);else{if(o==="__proto__"||o==="constructor"||o==="prototype")return;n[o]=a}};if(typeof t=="object"){const o=t;for(const[a,i]of Object.entries(o))s(a,i)}else s(t,r);this.store=n}has(t){return ne(this,qe).accessPropertiesByDotNotation?eo(this.store,t):t in this.store}appendToArray(t,r){Eo(t,r);const n=ne(this,qe).accessPropertiesByDotNotation?this._get(t,[]):t in this.store?this.store[t]:[];if(!Array.isArray(n))throw new TypeError(`The key \`${t}\` is already set to a non-array value`);this.set(t,[...n,r])}reset(...t){for(const r of t)El(ne(this,Qe)[r])&&this.set(r,ne(this,Qe)[r])}delete(t){const{store:r}=this;ne(this,qe).accessPropertiesByDotNotation?df(r,t):delete r[t],this.store=r}clear(){const t=Vt();for(const r of Object.keys(ne(this,Qe)))El(ne(this,Qe)[r])&&(Eo(r,ne(this,Qe)[r]),ne(this,qe).accessPropertiesByDotNotation?Dn(t,r,ne(this,Qe)[r]):t[r]=ne(this,Qe)[r]);this.store=t}onDidChange(t,r){if(typeof t!="string")throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`);if(typeof r!="function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`);return this._handleValueChange(()=>this.get(t),r)}onDidAnyChange(t){if(typeof t!="function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleStoreChange(t)}get size(){return Object.keys(this.store).filter(r=>!this._isReservedKeyPath(r)).length}get store(){var t;try{const r=Q.readFileSync(this.path,ne(this,lt)?null:"utf8"),n=this._decryptData(r),s=this._deserialize(n);return ne(this,_r)||this._validate(s),Object.assign(Vt(),s)}catch(r){if((r==null?void 0:r.code)==="ENOENT")return this._ensureDirectory(),Vt();if(ne(this,qe).clearInvalidConfig){const n=r;if(n.name==="SyntaxError"||(t=n.message)!=null&&t.startsWith("Config schema violation:"))return Vt()}throw r}}set store(t){if(this._ensureDirectory(),!eo(t,qt))try{const r=Q.readFileSync(this.path,ne(this,lt)?null:"utf8"),n=this._decryptData(r),s=this._deserialize(n);eo(s,qt)&&Dn(t,qt,tc(s,qt))}catch{}ne(this,_r)||this._validate(t),this._write(t),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store))this._isReservedKeyPath(t)||(yield[t,r])}_closeWatcher(){ne(this,vr)&&(ne(this,vr).close(),Be(this,vr,void 0)),ne(this,Ur)&&(Q.unwatchFile(this.path),Be(this,Ur,!1)),Be(this,gt,void 0)}_decryptData(t){if(!ne(this,lt))return typeof t=="string"?t:rs(t);try{const r=t.slice(0,16),n=lr.pbkdf2Sync(ne(this,lt),r,1e4,32,"sha512"),s=lr.createDecipheriv(wo,n,r),o=t.slice(17),a=typeof o=="string"?ns(o):o;return rs(vo([s.update(a),s.final()]))}catch{try{const r=t.slice(0,16),n=lr.pbkdf2Sync(ne(this,lt),r.toString(),1e4,32,"sha512"),s=lr.createDecipheriv(wo,n,r),o=t.slice(17),a=typeof o=="string"?ns(o):o;return rs(vo([s.update(a),s.final()]))}catch{}}return typeof t=="string"?t:rs(t)}_handleStoreChange(t){let r=this.store;const n=()=>{const s=r,o=this.store;Re.isDeepStrictEqual(o,s)||(r=o,t.call(this,o,s))};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_handleValueChange(t,r){let n=t();const s=()=>{const o=n,a=t();Re.isDeepStrictEqual(a,o)||(n=a,r.call(this,a,o))};return this.events.addEventListener("change",s),()=>{this.events.removeEventListener("change",s)}}_validate(t){if(!ne(this,Kt)||ne(this,Kt).call(this,t)||!ne(this,Kt).errors)return;const n=ne(this,Kt).errors.map(({instancePath:s,message:o=""})=>`\`${s.slice(1)}\` ${o}`);throw new Error("Config schema violation: "+n.join("; "))}_ensureDirectory(){Q.mkdirSync(de.dirname(this.path),{recursive:!0})}_write(t){let r=this._serialize(t);if(ne(this,lt)){const n=lr.randomBytes(16),s=lr.pbkdf2Sync(ne(this,lt),n,1e4,32,"sha512"),o=lr.createCipheriv(wo,s,n);r=vo([n,ns(":"),o.update(ns(r)),o.final()])}if(_e.env.SNAP)Q.writeFileSync(this.path,r,{mode:ne(this,qe).configFileMode});else try{Dl(this.path,r,{mode:ne(this,qe).configFileMode})}catch(n){if((n==null?void 0:n.code)==="EXDEV"){Q.writeFileSync(this.path,r,{mode:ne(this,qe).configFileMode});return}throw n}}_watch(){if(this._ensureDirectory(),Q.existsSync(this.path)||this._write(Vt()),_e.platform==="win32"||_e.platform==="darwin"){ne(this,gt)??Be(this,gt,rl(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));const t=de.dirname(this.path),r=de.basename(this.path);Be(this,vr,Q.watch(t,{persistent:!1,encoding:"utf8"},(n,s)=>{s&&s!==r||typeof ne(this,gt)=="function"&&ne(this,gt).call(this)}))}else ne(this,gt)??Be(this,gt,rl(()=>{this.events.dispatchEvent(new Event("change"))},{wait:1e3})),Q.watchFile(this.path,{persistent:!1},(t,r)=>{typeof ne(this,gt)=="function"&&ne(this,gt).call(this)}),Be(this,Ur,!0)}_migrate(t,r,n){let s=this._get(bo,"0.0.0");const o=Object.keys(t).filter(i=>this._shouldPerformMigration(i,s,r));let a=structuredClone(this.store);for(const i of o)try{n&&n(this,{fromVersion:s,toVersion:i,finalVersion:r,versions:o});const c=t[i];c==null||c(this),this._set(bo,i),s=i,a=structuredClone(this.store)}catch(c){this.store=a;try{this._write(a)}catch{}const d=c instanceof Error?c.message:String(c);throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${d}`)}(this._isVersionInRangeFormat(s)||!jr.eq(s,r))&&this._set(bo,r)}_containsReservedKey(t){return typeof t=="string"?this._isReservedKeyPath(t):!t||typeof t!="object"?!1:this._objectContainsReservedKey(t)}_objectContainsReservedKey(t){if(!t||typeof t!="object")return!1;for(const[r,n]of Object.entries(t))if(this._isReservedKeyPath(r)||this._objectContainsReservedKey(n))return!0;return!1}_isReservedKeyPath(t){return t===qt||t.startsWith(`${qt}.`)}_isVersionInRangeFormat(t){return jr.clean(t)===null}_shouldPerformMigration(t,r,n){return this._isVersionInRangeFormat(t)?r!=="0.0.0"&&jr.satisfies(r,t)?!1:jr.satisfies(n,t):!(jr.lte(t,r)||jr.gt(t,n))}_get(t,r){return tc(this.store,t,r)}_set(t,r){const{store:n}=this;Dn(n,t,r),this.store=n}}Kt=new WeakMap,lt=new WeakMap,qe=new WeakMap,Qe=new WeakMap,_r=new WeakMap,vr=new WeakMap,Ur=new WeakMap,gt=new WeakMap,Oe=new WeakSet,Md=function(t){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...t};if(!r.cwd){if(!r.projectName)throw new Error("Please specify the `projectName` option.");r.cwd=pf(r.projectName,{suffix:r.projectSuffix}).config}return typeof r.fileExtension=="string"&&(r.fileExtension=r.fileExtension.replace(/^\.+/,"")),r},Dd=function(t){if(!(t.schema??t.ajvOptions??t.rootSchema))return;if(t.schema&&typeof t.schema!="object")throw new TypeError("The `schema` option must be an object.");const r=IE.default,n=new y_.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});r(n);const s={...t.rootSchema,type:"object",properties:t.schema};Be(this,Kt,n.compile(s)),Pt(this,Oe,Fd).call(this,t.schema)},Fd=function(t){const r=Object.entries(t??{});for(const[n,s]of r){if(!s||typeof s!="object"||!Object.hasOwn(s,"default"))continue;const{default:o}=s;o!==void 0&&(ne(this,Qe)[n]=o)}},Ld=function(t){t.defaults&&Object.assign(ne(this,Qe),t.defaults)},zd=function(t){t.serialize&&(this._serialize=t.serialize),t.deserialize&&(this._deserialize=t.deserialize)},Vd=function(t){const r=typeof t.fileExtension=="string"?t.fileExtension:void 0,n=r?`.${r}`:"";return de.resolve(t.cwd,`${t.configName??"config"}${n}`)},Ud=function(t){if(t.migrations){Pt(this,Oe,qd).call(this,t),this._validate(this.store);return}const r=this.store,n=Object.assign(Vt(),t.defaults??{},r);this._validate(n);try{ec.deepEqual(r,n)}catch{this.store=n}},qd=function(t){const{migrations:r,projectVersion:n}=t;if(r){if(!n)throw new Error("Please specify the `projectVersion` option.");Be(this,_r,!0);try{const s=this.store,o=Object.assign(Vt(),t.defaults??{},s);try{ec.deepEqual(s,o)}catch{this._write(o)}this._migrate(r,n,t.beforeEachMigration)}finally{Be(this,_r,!1)}}};const{app:ms,ipcMain:Ho,shell:VP}=C;let bl=!1;const Sl=()=>{if(!Ho||!ms)throw new Error("Electron Store: You need to call `.initRenderer()` from the main process.");const e={defaultCwd:ms.getPath("userData"),appVersion:ms.getVersion()};return bl||(Ho.on("electron-store-get-data",t=>{t.returnValue=e}),bl=!0),e};class Gd extends zP{constructor(t){let r,n;if(_e.type==="renderer"){const s=C.ipcRenderer.sendSync("electron-store-get-data");if(!s)throw new Error("Electron Store: You need to call `.initRenderer()` from the main process.");({defaultCwd:r,appVersion:n}=s)}else Ho&&ms&&({defaultCwd:r,appVersion:n}=Sl());t={name:"config",...t},t.projectVersion||(t.projectVersion=n),t.cwd?t.cwd=de.isAbsolute(t.cwd)?t.cwd:de.join(r,t.cwd):t.cwd=r,t.configName=t.name,delete t.name,super(t)}static initRenderer(){Sl()}async openInEditor(){const t=await VP.openPath(this.path);if(t)throw new Error(t)}}const Xe={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Wo={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:Xe.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Wo);const Kd="READDIRP_RECURSIVE_ERROR",UP=new Set(["ENOENT","EPERM","EACCES","ELOOP",Kd]),Pl=[Xe.DIR_TYPE,Xe.EVERYTHING_TYPE,Xe.FILE_DIR_TYPE,Xe.FILE_TYPE],qP=new Set([Xe.DIR_TYPE,Xe.EVERYTHING_TYPE,Xe.FILE_DIR_TYPE]),GP=new Set([Xe.EVERYTHING_TYPE,Xe.FILE_DIR_TYPE,Xe.FILE_TYPE]),KP=e=>UP.has(e.code),HP=process.platform==="win32",Nl=e=>!0,Rl=e=>{if(e===void 0)return Nl;if(typeof e=="function")return e;if(typeof e=="string"){const t=e.trim();return r=>r.basename===t}if(Array.isArray(e)){const t=e.map(r=>r.trim());return r=>t.some(n=>r.basename===n)}return Nl};class WP extends af.Readable{constructor(r={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:r.highWaterMark});J(this,"parents");J(this,"reading");J(this,"parent");J(this,"_stat");J(this,"_maxDepth");J(this,"_wantsDir");J(this,"_wantsFile");J(this,"_wantsEverything");J(this,"_root");J(this,"_isDirent");J(this,"_statsProp");J(this,"_rdOptions");J(this,"_fileFilter");J(this,"_directoryFilter");const n={...Wo,...r},{root:s,type:o}=n;this._fileFilter=Rl(n.fileFilter),this._directoryFilter=Rl(n.directoryFilter);const a=n.lstat?He.lstat:He.stat;HP?this._stat=i=>a(i,{bigint:!0}):this._stat=a,this._maxDepth=n.depth!=null&&Number.isSafeInteger(n.depth)?n.depth:Wo.depth,this._wantsDir=o?qP.has(o):!1,this._wantsFile=o?GP.has(o):!1,this._wantsEverything=o===Xe.EVERYTHING_TYPE,this._root=de.resolve(s),this._isDirent=!n.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(s,1)],this.reading=!1,this.parent=void 0}async _read(r){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&r>0;){const n=this.parent,s=n&&n.files;if(s&&s.length>0){const{path:o,depth:a}=n,i=s.splice(0,r).map(d=>this._formatEntry(d,o)),c=await Promise.all(i);for(const d of c){if(!d)continue;if(this.destroyed)return;const u=await this._getEntryType(d);u==="directory"&&this._directoryFilter(d)?(a<=this._maxDepth&&this.parents.push(this._exploreDir(d.fullPath,a+1)),this._wantsDir&&(this.push(d),r--)):(u==="file"||this._includeAsFile(d))&&this._fileFilter(d)&&this._wantsFile&&(this.push(d),r--)}}else{const o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(n){this.destroy(n)}finally{this.reading=!1}}}async _exploreDir(r,n){let s;try{s=await He.readdir(r,this._rdOptions)}catch(o){this._onError(o)}return{files:s,depth:n,path:r}}async _formatEntry(r,n){let s;const o=this._isDirent?r.name:r;try{const a=de.resolve(de.join(n,o));s={path:de.relative(this._root,a),fullPath:a,basename:o},s[this._statsProp]=this._isDirent?r:await this._stat(a)}catch(a){this._onError(a);return}return s}_onError(r){KP(r)&&!this.destroyed?this.emit("warn",r):this.destroy(r)}async _getEntryType(r){if(!r&&this._statsProp in r)return"";const n=r[this._statsProp];if(n.isFile())return"file";if(n.isDirectory())return"directory";if(n&&n.isSymbolicLink()){const s=r.fullPath;try{const o=await He.realpath(s),a=await He.lstat(o);if(a.isFile())return"file";if(a.isDirectory()){const i=o.length;if(s.startsWith(o)&&s.substr(i,1)===de.sep){const c=new Error(`Circular symlink detected: "${s}" points to "${o}"`);return c.code=Kd,this._onError(c)}return"directory"}}catch(o){return this._onError(o),""}}}_includeAsFile(r){const n=r&&r[this._statsProp];return n&&this._wantsEverything&&!n.isDirectory()}}function xP(e,t={}){let r=t.entryType||t.type;if(r==="both"&&(r=Xe.FILE_DIR_TYPE),r&&(t.type=r),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(r&&!Pl.includes(r))throw new Error(`readdirp: Invalid type passed. Use one of ${Pl.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=e,new WP(t)}const BP="data",Hd="end",YP="close",Zi=()=>{},Js=process.platform,Wd=Js==="win32",JP=Js==="darwin",XP=Js==="linux",ZP=Js==="freebsd",QP=Zo.type()==="OS400",ve={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},it=ve,eN="watch",tN={lstat:He.lstat,stat:He.stat},wr="listeners",ps="errHandlers",Vr="rawEmitters",rN=[wr,ps,Vr],nN=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),sN=e=>nN.has(Z.extname(e).slice(1).toLowerCase()),xo=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},Sn=(e,t,r)=>{let n=e[t];n instanceof Set||(e[t]=n=new Set([n])),n.add(r)},oN=e=>t=>{const r=e[t];r instanceof Set?r.clear():delete e[t]},Pn=(e,t,r)=>{const n=e[t];n instanceof Set?n.delete(r):n===r&&delete e[t]},xd=e=>e instanceof Set?e.size===0:!e,ys=new Map;function Ol(e,t,r,n,s){const o=(a,i)=>{r(e),s(a,i,{watchedPath:e}),i&&e!==i&&$s(Z.resolve(e,i),wr,Z.join(e,i))};try{return Q.watch(e,{persistent:t.persistent},o)}catch(a){n(a);return}}const $s=(e,t,r,n,s)=>{const o=ys.get(e);o&&xo(o[t],a=>{a(r,n,s)})},aN=(e,t,r,n)=>{const{listener:s,errHandler:o,rawEmitter:a}=n;let i=ys.get(t),c;if(!r.persistent)return c=Ol(e,r,s,o,a),c?c.close.bind(c):void 0;if(i)Sn(i,wr,s),Sn(i,ps,o),Sn(i,Vr,a);else{if(c=Ol(e,r,$s.bind(null,t,wr),o,$s.bind(null,t,Vr)),!c)return;c.on(it.ERROR,async d=>{const u=$s.bind(null,t,ps);if(i&&(i.watcherUnusable=!0),Wd&&d.code==="EPERM")try{await(await He.open(e,"r")).close(),u(d)}catch{}else u(d)}),i={listeners:s,errHandlers:o,rawEmitters:a,watcher:c},ys.set(t,i)}return()=>{Pn(i,wr,s),Pn(i,ps,o),Pn(i,Vr,a),xd(i.listeners)&&(i.watcher.close(),ys.delete(t),rN.forEach(oN(i)),i.watcher=void 0,Object.freeze(i))}},So=new Map,iN=(e,t,r,n)=>{const{listener:s,rawEmitter:o}=n;let a=So.get(t);const i=a&&a.options;return i&&(i.persistentr.interval)&&(Q.unwatchFile(t),a=void 0),a?(Sn(a,wr,s),Sn(a,Vr,o)):(a={listeners:s,rawEmitters:o,options:r,watcher:Q.watchFile(t,r,(c,d)=>{xo(a.rawEmitters,f=>{f(it.CHANGE,t,{curr:c,prev:d})});const u=c.mtimeMs;(c.size!==d.size||u>d.mtimeMs||u===0)&&xo(a.listeners,f=>f(e,c))})},So.set(t,a)),()=>{Pn(a,wr,s),Pn(a,Vr,o),xd(a.listeners)&&(So.delete(t),Q.unwatchFile(t),a.options=a.watcher=void 0,Object.freeze(a))}};class cN{constructor(t){J(this,"fsw");J(this,"_boundHandleError");this.fsw=t,this._boundHandleError=r=>t._handleError(r)}_watchWithNodeFs(t,r){const n=this.fsw.options,s=Z.dirname(t),o=Z.basename(t);this.fsw._getWatchedDir(s).add(o);const i=Z.resolve(t),c={persistent:n.persistent};r||(r=Zi);let d;if(n.usePolling){const u=n.interval!==n.binaryInterval;c.interval=u&&sN(o)?n.binaryInterval:n.interval,d=iN(t,i,c,{listener:r,rawEmitter:this.fsw._emitRaw})}else d=aN(t,i,c,{listener:r,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return d}_handleFile(t,r,n){if(this.fsw.closed)return;const s=Z.dirname(t),o=Z.basename(t),a=this.fsw._getWatchedDir(s);let i=r;if(a.has(o))return;const c=async(u,f)=>{if(this.fsw._throttle(eN,t,5)){if(!f||f.mtimeMs===0)try{const v=await He.stat(t);if(this.fsw.closed)return;const y=v.atimeMs,w=v.mtimeMs;if((!y||y<=w||w!==i.mtimeMs)&&this.fsw._emit(it.CHANGE,t,v),(JP||XP||ZP)&&i.ino!==v.ino){this.fsw._closeFile(u),i=v;const g=this._watchWithNodeFs(t,c);g&&this.fsw._addPathCloser(u,g)}else i=v}catch{this.fsw._remove(s,o)}else if(a.has(o)){const v=f.atimeMs,y=f.mtimeMs;(!v||v<=y||y!==i.mtimeMs)&&this.fsw._emit(it.CHANGE,t,f),i=f}}},d=this._watchWithNodeFs(t,c);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(it.ADD,t,0))return;this.fsw._emit(it.ADD,t,r)}return d}async _handleSymlink(t,r,n,s){if(this.fsw.closed)return;const o=t.fullPath,a=this.fsw._getWatchedDir(r);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let i;try{i=await He.realpath(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(s)?this.fsw._symlinkPaths.get(o)!==i&&(this.fsw._symlinkPaths.set(o,i),this.fsw._emit(it.CHANGE,n,t.stats)):(a.add(s),this.fsw._symlinkPaths.set(o,i),this.fsw._emit(it.ADD,n,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(t,r,n,s,o,a,i){t=Z.join(t,"");const c=s?`${t}:${s}`:t;if(i=this.fsw._throttle("readdir",c,1e3),!i)return;const d=this.fsw._getWatchedDir(n.path),u=new Set;let f=this.fsw._readdirp(t,{fileFilter:v=>n.filterPath(v),directoryFilter:v=>n.filterDir(v)});if(f)return f.on(BP,async v=>{if(this.fsw.closed){f=void 0;return}const y=v.path;let w=Z.join(t,y);if(u.add(y),!(v.stats.isSymbolicLink()&&await this._handleSymlink(v,t,w,y))){if(this.fsw.closed){f=void 0;return}(y===s||!s&&!d.has(y))&&(this.fsw._incrReadyCount(),w=Z.join(o,Z.relative(o,w)),this._addToNodeFs(w,r,n,a+1))}}).on(it.ERROR,this._boundHandleError),new Promise((v,y)=>{if(!f)return y();f.once(Hd,()=>{if(this.fsw.closed){f=void 0;return}const w=i?i.clear():!1;v(void 0),d.getChildren().filter(g=>g!==t&&!u.has(g)).forEach(g=>{this.fsw._remove(t,g)}),f=void 0,w&&this._handleRead(t,!1,n,s,o,a,i)})})}async _handleDir(t,r,n,s,o,a,i){const c=this.fsw._getWatchedDir(Z.dirname(t)),d=c.has(Z.basename(t));!(n&&this.fsw.options.ignoreInitial)&&!o&&!d&&this.fsw._emit(it.ADD_DIR,t,r),c.add(Z.basename(t)),this.fsw._getWatchedDir(t);let u,f;const v=this.fsw.options.depth;if((v==null||s<=v)&&!this.fsw._symlinkPaths.has(i)){if(!o&&(await this._handleRead(t,n,a,o,t,s,u),this.fsw.closed))return;f=this._watchWithNodeFs(t,(y,w)=>{w&&w.mtimeMs===0||this._handleRead(y,!1,a,o,t,s,u)})}return f}async _addToNodeFs(t,r,n,s,o){const a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;const i=this.fsw._getWatchHelpers(t);n&&(i.filterPath=c=>n.filterPath(c),i.filterDir=c=>n.filterDir(c));try{const c=await tN[i.statMethod](i.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(i.watchPath,c))return a(),!1;const d=this.fsw.options.followSymlinks;let u;if(c.isDirectory()){const f=Z.resolve(t),v=d?await He.realpath(t):t;if(this.fsw.closed||(u=await this._handleDir(i.watchPath,c,r,s,o,i,v),this.fsw.closed))return;f!==v&&v!==void 0&&this.fsw._symlinkPaths.set(f,v)}else if(c.isSymbolicLink()){const f=d?await He.realpath(t):t;if(this.fsw.closed)return;const v=Z.dirname(i.watchPath);if(this.fsw._getWatchedDir(v).add(i.watchPath),this.fsw._emit(it.ADD,i.watchPath,c),u=await this._handleDir(v,c,r,s,t,i,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(Z.resolve(t),f)}else u=this._handleFile(i.watchPath,c,r);return a(),u&&this.fsw._addPathCloser(t,u),!1}catch(c){if(this.fsw._handleError(c))return a(),t}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */const Po="/",lN="//",Bd=".",uN="..",dN="string",fN=/\\/g,Yd=/\/\//g,hN=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,mN=/^\.[/\\]/;function Is(e){return Array.isArray(e)?e:[e]}const No=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);function pN(e){return typeof e=="function"?e:typeof e=="string"?t=>e===t:e instanceof RegExp?t=>e.test(t):typeof e=="object"&&e!==null?t=>{if(e.path===t)return!0;if(e.recursive){const r=Z.relative(e.path,t);return r?!r.startsWith("..")&&!Z.isAbsolute(r):!1}return!1}:()=>!1}function yN(e){if(typeof e!="string")throw new Error("string expected");e=Z.normalize(e),e=e.replace(/\\/g,"/");let t=!1;return e.startsWith("//")&&(t=!0),e=e.replace(Yd,"/"),t&&(e="/"+e),e}function $N(e,t,r){const n=yN(t);for(let s=0;spN(s));return(s,o)=>$N(n,s,o)}const Il=e=>{const t=Is(e).flat();if(!t.every(r=>typeof r===dN))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(Jd)},Tl=e=>{let t=e.replace(fN,Po),r=!1;return t.startsWith(lN)&&(r=!0),t=t.replace(Yd,Po),r&&(t=Po+t),t},Jd=e=>Tl(Z.normalize(Tl(e))),jl=(e="")=>t=>typeof t=="string"?Jd(Z.isAbsolute(t)?t:Z.join(e,t)):t,_N=(e,t)=>Z.isAbsolute(e)?e:Z.join(t,e),vN=Object.freeze(new Set);class wN{constructor(t,r){J(this,"path");J(this,"_removeWatcher");J(this,"items");this.path=t,this._removeWatcher=r,this.items=new Set}add(t){const{items:r}=this;r&&t!==Bd&&t!==uN&&r.add(t)}async remove(t){const{items:r}=this;if(!r||(r.delete(t),r.size>0))return;const n=this.path;try{await He.readdir(n)}catch{this._removeWatcher&&this._removeWatcher(Z.dirname(n),Z.basename(n))}}has(t){const{items:r}=this;if(r)return r.has(t)}getChildren(){const{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Zi,this.items=vN,Object.freeze(this)}}const EN="stat",bN="lstat";class SN{constructor(t,r,n){J(this,"fsw");J(this,"path");J(this,"watchPath");J(this,"fullWatchPath");J(this,"dirParts");J(this,"followSymlinks");J(this,"statMethod");this.fsw=n;const s=t;this.path=t=t.replace(mN,""),this.watchPath=s,this.fullWatchPath=Z.resolve(s),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=r,this.statMethod=r?EN:bN}entryPath(t){return Z.join(this.watchPath,Z.relative(this.watchPath,t.fullPath))}filterPath(t){const{stats:r}=t;if(r&&r.isSymbolicLink())return this.filterDir(t);const n=this.entryPath(t);return this.fsw._isntIgnored(n,r)&&this.fsw._hasReadPermissions(r)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}}class PN extends of.EventEmitter{constructor(r={}){super();J(this,"closed");J(this,"options");J(this,"_closers");J(this,"_ignoredPaths");J(this,"_throttled");J(this,"_streams");J(this,"_symlinkPaths");J(this,"_watched");J(this,"_pendingWrites");J(this,"_pendingUnlinks");J(this,"_readyCount");J(this,"_emitReady");J(this,"_closePromise");J(this,"_userIgnored");J(this,"_readyEmitted");J(this,"_emitRaw");J(this,"_boundRemove");J(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;const n=r.awaitWriteFinish,s={stabilityThreshold:2e3,pollInterval:100},o={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...r,ignored:r.ignored?Is(r.ignored):Is([]),awaitWriteFinish:n===!0?s:typeof n=="object"?{...s,...n}:!1};QP&&(o.usePolling=!0),o.atomic===void 0&&(o.atomic=!o.usePolling);const a=process.env.CHOKIDAR_USEPOLLING;if(a!==void 0){const d=a.toLowerCase();d==="false"||d==="0"?o.usePolling=!1:d==="true"||d==="1"?o.usePolling=!0:o.usePolling=!!d}const i=process.env.CHOKIDAR_INTERVAL;i&&(o.interval=Number.parseInt(i,10));let c=0;this._emitReady=()=>{c++,c>=this._readyCount&&(this._emitReady=Zi,this._readyEmitted=!0,process.nextTick(()=>this.emit(ve.READY)))},this._emitRaw=(...d)=>this.emit(ve.RAW,...d),this._boundRemove=this._remove.bind(this),this.options=o,this._nodeFsHandler=new cN(this),Object.freeze(o)}_addIgnoredPath(r){if(No(r)){for(const n of this._ignoredPaths)if(No(n)&&n.path===r.path&&n.recursive===r.recursive)return}this._ignoredPaths.add(r)}_removeIgnoredPath(r){if(this._ignoredPaths.delete(r),typeof r=="string")for(const n of this._ignoredPaths)No(n)&&n.path===r&&this._ignoredPaths.delete(n)}add(r,n,s){const{cwd:o}=this.options;this.closed=!1,this._closePromise=void 0;let a=Il(r);return o&&(a=a.map(i=>_N(i,o))),a.forEach(i=>{this._removeIgnoredPath(i)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=a.length,Promise.all(a.map(async i=>{const c=await this._nodeFsHandler._addToNodeFs(i,!s,void 0,0,n);return c&&this._emitReady(),c})).then(i=>{this.closed||i.forEach(c=>{c&&this.add(Z.dirname(c),Z.basename(n||c))})}),this}unwatch(r){if(this.closed)return this;const n=Il(r),{cwd:s}=this.options;return n.forEach(o=>{!Z.isAbsolute(o)&&!this._closers.has(o)&&(s&&(o=Z.join(s,o)),o=Z.resolve(o)),this._closePath(o),this._addIgnoredPath(o),this._watched.has(o)&&this._addIgnoredPath({path:o,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();const r=[];return this._closers.forEach(n=>n.forEach(s=>{const o=s();o instanceof Promise&&r.push(o)})),this._streams.forEach(n=>n.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(n=>n.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=r.length?Promise.all(r).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){const r={};return this._watched.forEach((n,s)=>{const a=(this.options.cwd?Z.relative(this.options.cwd,s):s)||Bd;r[a]=n.getChildren().sort()}),r}emitWithAll(r,n){this.emit(r,...n),r!==ve.ERROR&&this.emit(ve.ALL,r,...n)}async _emit(r,n,s){if(this.closed)return;const o=this.options;Wd&&(n=Z.normalize(n)),o.cwd&&(n=Z.relative(o.cwd,n));const a=[n];s!=null&&a.push(s);const i=o.awaitWriteFinish;let c;if(i&&(c=this._pendingWrites.get(n)))return c.lastChange=new Date,this;if(o.atomic){if(r===ve.UNLINK)return this._pendingUnlinks.set(n,[r,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((d,u)=>{this.emit(...d),this.emit(ve.ALL,...d),this._pendingUnlinks.delete(u)})},typeof o.atomic=="number"?o.atomic:100),this;r===ve.ADD&&this._pendingUnlinks.has(n)&&(r=ve.CHANGE,this._pendingUnlinks.delete(n))}if(i&&(r===ve.ADD||r===ve.CHANGE)&&this._readyEmitted){const d=(u,f)=>{u?(r=ve.ERROR,a[0]=u,this.emitWithAll(r,a)):f&&(a.length>1?a[1]=f:a.push(f),this.emitWithAll(r,a))};return this._awaitWriteFinish(n,i.stabilityThreshold,r,d),this}if(r===ve.CHANGE&&!this._throttle(ve.CHANGE,n,50))return this;if(o.alwaysStat&&s===void 0&&(r===ve.ADD||r===ve.ADD_DIR||r===ve.CHANGE)){const d=o.cwd?Z.join(o.cwd,n):n;let u;try{u=await He.stat(d)}catch{}if(!u||this.closed)return;a.push(u)}return this.emitWithAll(r,a),this}_handleError(r){const n=r&&r.code;return r&&n!=="ENOENT"&&n!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||n!=="EPERM"&&n!=="EACCES")&&this.emit(ve.ERROR,r),r||this.closed}_throttle(r,n,s){this._throttled.has(r)||this._throttled.set(r,new Map);const o=this._throttled.get(r);if(!o)throw new Error("invalid throttle");const a=o.get(n);if(a)return a.count++,!1;let i;const c=()=>{const u=o.get(n),f=u?u.count:0;return o.delete(n),clearTimeout(i),u&&clearTimeout(u.timeoutObject),f};i=setTimeout(c,s);const d={timeoutObject:i,clear:c,count:0};return o.set(n,d),d}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(r,n,s,o){const a=this.options.awaitWriteFinish;if(typeof a!="object")return;const i=a.pollInterval;let c,d=r;this.options.cwd&&!Z.isAbsolute(r)&&(d=Z.join(this.options.cwd,r));const u=new Date,f=this._pendingWrites;function v(y){Q.stat(d,(w,g)=>{if(w||!f.has(r)){w&&w.code!=="ENOENT"&&o(w);return}const $=Number(new Date);y&&g.size!==y.size&&(f.get(r).lastChange=$);const m=f.get(r);$-m.lastChange>=n?(f.delete(r),o(void 0,g)):c=setTimeout(v,i,g)})}f.has(r)||(f.set(r,{lastChange:u,cancelWait:()=>(f.delete(r),clearTimeout(c),s)}),c=setTimeout(v,i))}_isIgnored(r,n){if(this.options.atomic&&hN.test(r))return!0;if(!this._userIgnored){const{cwd:s}=this.options,a=(this.options.ignored||[]).map(jl(s)),c=[...[...this._ignoredPaths].map(jl(s)),...a];this._userIgnored=gN(c)}return this._userIgnored(r,n)}_isntIgnored(r,n){return!this._isIgnored(r,n)}_getWatchHelpers(r){return new SN(r,this.options.followSymlinks,this)}_getWatchedDir(r){const n=Z.resolve(r);return this._watched.has(n)||this._watched.set(n,new wN(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(r){return this.options.ignorePermissionErrors?!0:!!(Number(r.mode)&256)}_remove(r,n,s){const o=Z.join(r,n),a=Z.resolve(o);if(s=s??(this._watched.has(o)||this._watched.has(a)),!this._throttle("remove",o,100))return;!s&&this._watched.size===1&&this.add(r,n,!0),this._getWatchedDir(o).getChildren().forEach(y=>this._remove(o,y));const d=this._getWatchedDir(r),u=d.has(n);d.remove(n),this._symlinkPaths.has(a)&&this._symlinkPaths.delete(a);let f=o;if(this.options.cwd&&(f=Z.relative(this.options.cwd,o)),this.options.awaitWriteFinish&&this._pendingWrites.has(f)&&this._pendingWrites.get(f).cancelWait()===ve.ADD)return;this._watched.delete(o),this._watched.delete(a);const v=s?ve.UNLINK_DIR:ve.UNLINK;u&&!this._isIgnored(o)&&this._emit(v,o),this._closePath(o)}_closePath(r){this._closeFile(r);const n=Z.dirname(r);this._getWatchedDir(n).remove(Z.basename(r))}_closeFile(r){const n=this._closers.get(r);n&&(n.forEach(s=>s()),this._closers.delete(r))}_addPathCloser(r,n){if(!n)return;let s=this._closers.get(r);s||(s=[],this._closers.set(r,s)),s.push(n)}_readdirp(r,n){if(this.closed)return;const s={type:ve.ALL,alwaysStat:!0,lstat:!0,...n,depth:0};let o=xP(r,s);return this._streams.add(o),o.once(YP,()=>{o=void 0}),o.once(Hd,()=>{o&&(this._streams.delete(o),o=void 0)}),o}}function NN(e,t={}){const r=new PN(t);return r.add(e),r}const RN=process.mas===!0;process.platform!=="win32"&&(C.app.commandLine.appendSwitch("enable-features","Vulkan"),C.app.commandLine.appendSwitch("use-vulkan"),C.app.commandLine.appendSwitch("enable-unsafe-webgpu"));const Nn=process.env.VITE_DEV_SERVER_URL,he=new Gd({defaults:{vaultPath:null,vaultBookmark:null}});let ct=null;const ss=new Gd({name:"settings",defaults:{theme:"light",fontFamily:"system",fontSize:17,ollamaBaseUrl:"http://localhost:11434",ollamaEnabled:!0,preferredEngine:"ollama",autoFallback:!0,customSystemPrompt:"",promptTemplates:[],defaultFormat:"md",smartFormatConversion:!0}}),Bo={zh:{about:"关于 {appName}",preferences:"偏好设置...",services:"服务",hide:"隐藏 {appName}",hideOthers:"隐藏其他",unhide:"显示全部",quit:"退出 {appName}",file:"文件",newArticle:"新建文章",newFolder:"新建文件夹",closeWindow:"关闭窗口",edit:"编辑",undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴",pasteAndMatchStyle:"粘贴并匹配样式",delete:"删除",selectAll:"全选",view:"视图",focusMode:"专注模式",cycleEditorMode:"切换编辑模式",reload:"刷新",forceReload:"强制刷新",devTools:"开发者工具",actualSize:"实际大小",zoomIn:"放大",zoomOut:"缩小",fullscreen:"全屏",window:"窗口",minimize:"最小化",zoom:"缩放",front:"前置全部窗口",close:"关闭",help:"帮助",visitGitHub:"访问 GitHub",visitWebsite:"访问官网",openSettings:"打开设置",toggleFocusMode:"切换专注模式",showMainWindow:"显示主窗口",enableSmartAutocomplete:"开启智能续写",disableSmartAutocomplete:"关闭智能续写"},"zh-TW":{about:"關於 {appName}",preferences:"偏好設定...",services:"服務",hide:"隱藏 {appName}",hideOthers:"隱藏其他",unhide:"顯示全部",quit:"結束 {appName}",file:"檔案",newArticle:"新建文章",newFolder:"新建資料夾",closeWindow:"關閉視窗",edit:"編輯",undo:"還原",redo:"重做",cut:"剪下",copy:"複製",paste:"貼上",pasteAndMatchStyle:"貼上並符合樣式",delete:"刪除",selectAll:"全選",view:"檢視",focusMode:"專注模式",reload:"重新載入",forceReload:"強制重新載入",devTools:"開發人員工具",actualSize:"實際大小",zoomIn:"放大",zoomOut:"縮小",fullscreen:"全螢幕",window:"視窗",minimize:"最小化",zoom:"縮放",front:"將全部移到最前面",close:"關閉",help:"說明",visitGitHub:"造訪 GitHub",visitWebsite:"造訪官網",openSettings:"開啟設定",toggleFocusMode:"切換專注模式",showMainWindow:"顯示主視窗",enableSmartAutocomplete:"開啟智能續寫",disableSmartAutocomplete:"關閉智能續寫"},en:{about:"About {appName}",preferences:"Preferences...",services:"Services",hide:"Hide {appName}",hideOthers:"Hide Others",unhide:"Show All",quit:"Quit {appName}",file:"File",newArticle:"New Article",newFolder:"New Folder",closeWindow:"Close Window",edit:"Edit",undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste",pasteAndMatchStyle:"Paste and Match Style",delete:"Delete",selectAll:"Select All",view:"View",focusMode:"Focus Mode",cycleEditorMode:"Cycle Editor Mode",reload:"Reload",forceReload:"Force Reload",devTools:"Developer Tools",actualSize:"Actual Size",zoomIn:"Zoom In",zoomOut:"Zoom Out",fullscreen:"Toggle Fullscreen",window:"Window",minimize:"Minimize",zoom:"Zoom",front:"Bring All to Front",close:"Close",help:"Help",visitGitHub:"Visit GitHub",visitWebsite:"Official Website",openSettings:"Open Settings",toggleFocusMode:"Toggle Focus Mode",showMainWindow:"Show Main Window",enableSmartAutocomplete:"Enable Smart Autocomplete",disableSmartAutocomplete:"Disable Smart Autocomplete"},ja:{about:"{appName} について",preferences:"環境設定...",services:"サービス",hide:"{appName} を隠す",hideOthers:"ほかを隠す",unhide:"すべてを表示",quit:"{appName} を終了",file:"ファイル",newArticle:"新規記事",newFolder:"新規フォルダ",closeWindow:"ウィンドウを閉じる",edit:"編集",undo:"取り消す",redo:"やり直す",cut:"カット",copy:"コピー",paste:"ペースト",pasteAndMatchStyle:"ペーストしてスタイルを合わせる",delete:"削除",selectAll:"すべてを選択",view:"表示",focusMode:"集中モード",reload:"再読み込み",forceReload:"強制再読み込み",devTools:"開発者ツール",actualSize:"実際のサイズ",zoomIn:"拡大",zoomOut:"縮小",fullscreen:"フルスクリーン",window:"ウィンドウ",minimize:"最小化",zoom:"拡大/縮小",front:"すべてを手前に移動",close:"閉じる",help:"ヘルプ",visitGitHub:"GitHub を開く",visitWebsite:"公式サイトを開く",openSettings:"設定を開く",toggleFocusMode:"集中モードを切り替え",showMainWindow:"メインウィンドウを表示",enableSmartAutocomplete:"スマート入力補完を有効化",disableSmartAutocomplete:"スマート入力補完を無効化"},ko:{about:"{appName} 정보",preferences:"환경설정...",services:"서비스",hide:"{appName} 숨기기",hideOthers:"기타 숨기기",unhide:"모두 표시",quit:"{appName} 종료",file:"파일",newArticle:"새 글",newFolder:"새 폴더",closeWindow:"창 닫기",edit:"편집",undo:"실행 취소",redo:"다시 실행",cut:"오려두기",copy:"복사",paste:"붙여넣기",pasteAndMatchStyle:"붙여넣고 스타일 맞추기",delete:"삭제",selectAll:"모두 선택",view:"보기",focusMode:"집중 모드",reload:"새로 고침",forceReload:"강제 새로 고침",devTools:"개발자 도구",actualSize:"실제 크기",zoomIn:"확대",zoomOut:"축소",fullscreen:"전체 화면",window:"창",minimize:"최소화",zoom:"확대/축소",front:"모두 앞으로 가져오기",close:"닫기",help:"도움말",visitGitHub:"GitHub 방문",visitWebsite:"공식 웹사이트 방문",openSettings:"설정 열기",toggleFocusMode:"집중 모드 전환",showMainWindow:"메인 윈도우 표시",enableSmartAutocomplete:"스마트 자동완성 활성화",disableSmartAutocomplete:"스마트 자동완성 비활성화"},fr:{about:"À propos de {appName}",preferences:"Préférences...",services:"Services",hide:"Masquer {appName}",hideOthers:"Masquer les autres",unhide:"Tout afficher",quit:"Quitter {appName}",file:"Fichier",newArticle:"Nouvel Article",newFolder:"Nouveau Dossier",closeWindow:"Fermer la fenêtre",edit:"Édition",undo:"Annuler",redo:"Rétablir",cut:"Couper",copy:"Copier",paste:"Coller",pasteAndMatchStyle:"Coller et adapter le style",delete:"Supprimer",selectAll:"Tout sélectionner",view:"Présentation",focusMode:"Mode Focus",reload:"Actualiser",forceReload:"Forcer l'actualisation",devTools:"Outils de développement",actualSize:"Taille réelle",zoomIn:"Zoom avant",zoomOut:"Zoom arrière",fullscreen:"Plein écran",window:"Fenêtre",minimize:"Réduire",zoom:"Zoom",front:"Tout ramener au premier plan",close:"Fermer",help:"Aide",visitGitHub:"Visiter GitHub",visitWebsite:"Site officiel",openSettings:"Ouvrir les Paramètres",toggleFocusMode:"Basculer Mode Focus",showMainWindow:"Afficher la fenêtre principale",enableSmartAutocomplete:"Activer Auto-complétion Intelligente",disableSmartAutocomplete:"Désactiver Auto-complétion Intelligente"},de:{about:"Über {appName}",preferences:"Einstellungen...",services:"Dienste",hide:"{appName} ausblenden",hideOthers:"Andere ausblenden",unhide:"Alle einblenden",quit:"{appName} beenden",file:"Ablage",newArticle:"Neuer Artikel",newFolder:"Neuer Ordner",closeWindow:"Fenster schließen",edit:"Bearbeiten",undo:"Widerrufen",redo:"Wiederholen",cut:"Ausschneiden",copy:"Kopieren",paste:"Einfügen",pasteAndMatchStyle:"Einsetzen und Stil anpassen",delete:"Löschen",selectAll:"Alles auswählen",view:"Darstellung",focusMode:"Fokus-Modus",reload:"Neu laden",forceReload:"Neu laden erzwingen",devTools:"Entwicklertools",actualSize:"Tatsächliche Größe",zoomIn:"Vergrößern",zoomOut:"Verkleinern",fullscreen:"Vollbild",window:"Fenster",minimize:"Minimieren",zoom:"Zoomen",front:"Alle nach vorne bringen",close:"Schließen",help:"Hilfe",visitGitHub:"GitHub besuchen",visitWebsite:"Offizielle Webseite",openSettings:"Einstellungen öffnen",toggleFocusMode:"Fokus-Modus umschalten",showMainWindow:"Hauptfenster anzeigen",enableSmartAutocomplete:"Intelligente Autovervollständigung aktivieren",disableSmartAutocomplete:"Intelligente Autovervollständigung deaktivieren"},es:{about:"Acerca de {appName}",preferences:"Preferencias...",services:"Servicios",hide:"Ocultar {appName}",hideOthers:"Ocultar otros",unhide:"Mostrar todo",quit:"Salir de {appName}",file:"Archivo",newArticle:"Nuevo Artículo",newFolder:"Nueva Carpeta",closeWindow:"Cerrar ventana",edit:"Edición",undo:"Deshacer",redo:"Rehacer",cut:"Cortar",copy:"Copiar",paste:"Pegar",pasteAndMatchStyle:"Pegar y ajustar estilo",delete:"Eliminar",selectAll:"Seleccionar todo",view:"Vista",focusMode:"Modo Enfoque",reload:"Recargar",forceReload:"Forzar recarga",devTools:"Herramientas de desarrollo",actualSize:"Tamaño real",zoomIn:"Ampliar",zoomOut:"Reducir",fullscreen:"Pantalla completa",window:"Ventana",minimize:"Minimizar",zoom:"Zoom",front:"Traer todo al frente",close:"Cerrar",help:"Ayuda",visitGitHub:"Visitar GitHub",visitWebsite:"Sitio web oficial",openSettings:"Abrir Ajustes",toggleFocusMode:"Alternar Modo Enfoque",showMainWindow:"Mostrar ventana principal",enableSmartAutocomplete:"Activar Autocompletado Inteligente",disableSmartAutocomplete:"Desactivar Autocompletado Inteligente"}};function ON(){const e=C.app.getLocale(),t={"zh-CN":"zh","zh-Hans":"zh","zh-SG":"zh","zh-TW":"zh-TW","zh-Hant":"zh-TW","zh-HK":"zh-TW","zh-MO":"zh-TW",en:"en","en-US":"en","en-GB":"en","en-AU":"en","en-CA":"en",ja:"ja","ja-JP":"ja",ko:"ko","ko-KR":"ko",fr:"fr","fr-FR":"fr","fr-CA":"fr",de:"de","de-DE":"de","de-AT":"de","de-CH":"de",es:"es","es-ES":"es","es-MX":"es","es-AR":"es"};if(t[e])return t[e];const r=e.split("-")[0];return t[r]?t[r]:"en"}let Yo={menu:Bo.en};function Xd(e){const t=Bo[e];t?(Yo={menu:t},console.log(`✓ 菜单语言: ${e}`)):(Yo={menu:Bo.en},console.log(`⚠ 语言 ${e} 不支持,使用英文`))}function X(e,t){const r=e.split(".");let n=Yo;for(const o of r)if(n&&typeof n=="object")n=n[o];else return e;let s=typeof n=="string"?n:e;return t&&Object.keys(t).forEach(o=>{s=s.replace(`{${o}}`,t[o])}),s}let Je=null;const IN=[".DS_Store",".git","node_modules",".zennote","*.swp","*.swo","*~"];let k=null,Zd=!0,Jo=null;const Qd=[".md",".markdown",".txt",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"];function TN(){if(Nn)return null;const e=process.argv.slice(1);for(const t of e)if(!t.startsWith("-")&&q.existsSync(t)){const r=z.extname(t).toLowerCase();if(Qd.includes(r))return console.log("📂 从命令行参数获取文件:",t),t}return null}function ef(e){return e.startsWith(".")?!0:IN.some(t=>t.includes("*")?new RegExp("^"+t.replace(/\*/g,".*")+"$").test(e):e===t)}async function tf(e,t){const r=await q.promises.readdir(e,{withFileTypes:!0}),n=[];for(const s of r){if(ef(s.name))continue;const o=z.join(e,s.name),a=z.relative(t,o),i=await q.promises.stat(o);if(s.isDirectory()){const c=await tf(o,t);n.push({name:s.name,path:a,isDirectory:!0,children:c,modifiedAt:i.mtimeMs})}else{const c=z.extname(s.name).toLowerCase();[".txt",".md",".markdown",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"].includes(c)&&n.push({name:s.name,path:a,isDirectory:!1,extension:c,modifiedAt:i.mtimeMs})}}return n.sort((s,o)=>s.isDirectory&&!o.isDirectory?-1:!s.isDirectory&&o.isDirectory?1:s.isDirectory&&o.isDirectory?s.name.localeCompare(o.name,"zh-CN"):(o.modifiedAt||0)-(s.modifiedAt||0))}function un(e){const t=z.join(e,".zennote"),r=z.join(t,"chats"),n=z.join(t,"settings");q.existsSync(t)||q.mkdirSync(t,{recursive:!0}),q.existsSync(r)||q.mkdirSync(r,{recursive:!0}),q.existsSync(n)||q.mkdirSync(n,{recursive:!0})}function jN(){if(C.ipcMain.handle("fs:getVaultPath",()=>{const e=he.get("vaultPath"),t=he.get("vaultBookmark");if(e){if(t&&!ct)try{ct=C.app.startAccessingSecurityScopedResource(t),console.log("🔓 已恢复文件夹访问权限")}catch(r){console.warn("⚠️ 恢复权限失败,可能需要重新选择文件夹:",r)}if(!q.existsSync(e))return console.log("⚠️ Vault 文件夹不存在,自动清除配置:",e),he.set("vaultPath",null),he.set("vaultBookmark",null),ct&&(ct(),ct=null),null}return e}),C.ipcMain.handle("fs:setVaultPath",(e,t)=>(he.set("vaultPath",t),un(t),!0)),C.ipcMain.handle("fs:selectDirectory",async()=>{const e=await C.dialog.showOpenDialog(k,{properties:["openDirectory","createDirectory"],securityScopedBookmarks:!0,title:"选择笔记存储目录",buttonLabel:"选择此文件夹"});if(e.canceled||e.filePaths.length===0)return null;const t=e.filePaths[0];return e.bookmarks&&e.bookmarks.length>0&&(he.set("vaultBookmark",e.bookmarks[0]),console.log("📑 已保存 Security-Scoped Bookmark")),he.set("vaultPath",t),un(t),t}),C.ipcMain.handle("fs:disconnectVault",async()=>(ct&&(ct(),ct=null,console.log("🔒 已释放文件夹访问权限")),he.delete("vaultPath"),he.delete("vaultBookmark"),!0)),C.ipcMain.handle("fs:readDirectory",async(e,t)=>{const r=t||he.get("vaultPath");if(!r)return[];try{return await tf(r,r)}catch(n){return console.error("读取目录失败:",n),[]}}),C.ipcMain.handle("fs:readFile",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=z.join(r,t);return await q.promises.readFile(n,"utf-8")}),C.ipcMain.handle("fs:writeFile",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");const s=z.join(n,t),o=z.dirname(s);return q.existsSync(o)||q.mkdirSync(o,{recursive:!0}),await q.promises.writeFile(s,r,"utf-8"),!0}),C.ipcMain.handle("fs:createFile",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=z.join(r,t);return await q.promises.writeFile(n,"","utf-8"),!0}),C.ipcMain.handle("fs:createDirectory",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=z.join(r,t);return await q.promises.mkdir(n,{recursive:!0}),!0}),C.ipcMain.handle("fs:deleteFile",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=z.join(r,t);try{return await C.shell.trashItem(n),!0}catch(s){return console.error("移动到回收站失败,尝试永久删除:",s),(await q.promises.stat(n)).isDirectory()?await q.promises.rm(n,{recursive:!0,force:!0}):await q.promises.unlink(n),!0}}),C.ipcMain.handle("fs:renameFile",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");const s=z.join(n,t),o=z.join(n,r);return await q.promises.rename(s,o),!0}),C.ipcMain.handle("fs:readFileBuffer",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=z.join(r,t);return(await q.promises.readFile(n)).buffer}),C.ipcMain.handle("fs:getExternalFilePath",()=>{const e=Jo||TN();return Jo=null,e}),C.ipcMain.handle("fs:copyExternalFile",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");console.log("📥 复制外部文件:",t),console.log(" - 目标目录:",r);const s=z.basename(t),o=z.extname(s).toLowerCase();if(![".txt",".md",".markdown",".pdf",".docx",".jpg",".jpeg",".png",".gif",".webp"].includes(o))throw console.log(" - ❌ 不支持的文件格式:",o),new Error(`不支持的文件格式: ${o}`);const i=t.replace(/\\/g,"/"),c=n.replace(/\\/g,"/");if(i.startsWith(c+"/"))return console.log(" - 文件已在 Vault 内,返回相对路径"),z.relative(n,t);const d=r?z.join(n,r):n;q.existsSync(d)||q.mkdirSync(d,{recursive:!0});const u=await q.promises.readFile(t),f=Nr.createHash("md5").update(u).digest("hex").substring(0,8);console.log(" - 源文件 hash:",f);const v=z.basename(s,o);let y=s,w=z.join(d,y);if(q.existsSync(w)){const $=await q.promises.readFile(w),m=Nr.createHash("md5").update($).digest("hex").substring(0,8);if(f===m)return console.log(" - ✨ 文件已存在且内容相同,跳过复制"),r?`${r}/${y}`:y;y=`${v}_${f}${o}`,w=z.join(d,y),console.log(" - 文件名冲突,使用新名称:",y)}try{await q.promises.copyFile(t,w),console.log(" - ✅ 复制成功:",y)}catch($){throw console.error(" - ❌ 复制失败:",$),$}const g=r?`${r}/${y}`:y;return console.log(" - 返回路径:",g),g}),C.ipcMain.handle("fs:saveImage",async(e,t,r,n)=>{const s=he.get("vaultPath");if(!s)throw new Error("未设置 Vault 路径");const o=z.join(s,t,".images");q.existsSync(o)||q.mkdirSync(o,{recursive:!0});const a=r.match(/^data:image\/(\w+);base64,(.+)$/);if(!a)throw new Error("无效的图片数据");const i=a[1]==="jpeg"?"jpg":a[1],c=Buffer.from(a[2],"base64"),d=Date.now(),u=n||`image_${d}.${i}`,f=z.join(o,u);return await q.promises.writeFile(f,c),`.images/${u}`}),C.ipcMain.handle("fs:selectAndCopyImage",async(e,t)=>{const r=he.get("vaultPath");if(!r)throw new Error("未设置 Vault 路径");const n=await C.dialog.showOpenDialog(k,{properties:["openFile"],filters:[{name:"图片",extensions:["jpg","jpeg","png","gif","webp","svg"]}],title:"选择图片",buttonLabel:"插入图片"});if(n.canceled||n.filePaths.length===0)return null;const s=n.filePaths[0],o=z.basename(s),a=s.replace(/\\/g,"/"),i=r.replace(/\\/g,"/");if(console.log("📷 图片选择调试:"),console.log(" - 源文件路径:",s),console.log(" - 规范化源路径:",a),console.log(" - Vault 路径:",r),console.log(" - 规范化 Vault 路径:",i),console.log(" - 相对目录路径:",t),console.log(" - 是否在 Vault 内:",a.startsWith(i+"/")),a.startsWith(i+"/")){z.relative(r,s);const $=t?z.join(r,t):r,m=z.relative($,s);return console.log(" - 图片在 Vault 内,使用相对路径:",m),m.replace(/\\/g,"/")}console.log(" - 图片在 Vault 外,复制到 .images 目录");const c=z.join(r,t,".images");console.log(" - 目标目录:",c),q.existsSync(c)||(console.log(" - 创建目录:",c),q.mkdirSync(c,{recursive:!0}));const d=await q.promises.readFile(s),u=Nr.createHash("md5").update(d).digest("hex").substring(0,8);console.log(" - 源文件 hash:",u);try{const $=await q.promises.readdir(c);for(const m of $){const E=z.join(c,m),N=await q.promises.readFile(E),R=Nr.createHash("md5").update(N).digest("hex").substring(0,8);if(u===R)return console.log(" - ✨ 找到相同内容图片,复用:",m),`.images/${m}`}}catch($){console.log(" - 检查现有图片失败,继续复制:",$)}const f=z.extname(o),y=`${z.basename(o,f)}_${u}${f}`,w=z.join(c,y);if(q.existsSync(w))return console.log(" - ✨ 目标文件已存在,直接复用:",y),`.images/${y}`;console.log(" - 目标文件路径:",w);try{await q.promises.copyFile(s,w),console.log(" - ✅ 复制成功!")}catch($){throw console.error(" - ❌ 复制失败:",$),$}const g=`.images/${y}`;return console.log(" - 返回路径:",g),g}),C.ipcMain.handle("fs:downloadAndSaveImage",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)throw new Error("未设置 Vault 路径");console.log("📥 下载网络图片:",t),console.log(" - 目标目录:",r);try{const s=await C.net.fetch(t);if(!s.ok)throw new Error(`下载失败: HTTP ${s.status}`);const o=await s.arrayBuffer(),a=Buffer.from(o);let i="jpg";const c=s.headers.get("content-type");if(c)c.includes("png")?i="png":c.includes("gif")?i="gif":c.includes("webp")?i="webp":c.includes("svg")&&(i="svg");else{const w=new URL(t).pathname,g=z.extname(w).toLowerCase().replace(".","");["jpg","jpeg","png","gif","webp","svg"].includes(g)&&(i=g==="jpeg"?"jpg":g)}const d=z.join(n,r,".images");q.existsSync(d)||q.mkdirSync(d,{recursive:!0});const u=Nr.createHash("md5").update(a).digest("hex").substring(0,8);console.log(" - 图片 hash:",u);try{const w=await q.promises.readdir(d);for(const g of w){const $=z.join(d,g),m=await q.promises.readFile($),E=Nr.createHash("md5").update(m).digest("hex").substring(0,8);if(u===E)return console.log(" - ✨ 找到相同内容图片,复用:",g),`.images/${g}`}}catch(w){console.log(" - 检查现有图片失败,继续保存:",w)}const v=`web_${Date.now()}_${u}.${i}`,y=z.join(d,v);return await q.promises.writeFile(y,a),console.log(" - ✅ 保存成功:",v),`.images/${v}`}catch(s){throw console.error(" - ❌ 下载失败:",s),s}}),C.ipcMain.handle("fs:isImageReferenced",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)return!1;const s=z.basename(t),o=z.dirname(t),a=z.dirname(o),i=a==="."?n:z.join(n,a);console.log(`🔍 检查图片引用: ${s}`),console.log(` - 搜索目录: ${i}`);try{const c=await q.promises.readdir(i);for(const d of c){if(r&&d===z.basename(r)){console.log(` - 跳过排除文件: ${d}`);continue}if(!d.endsWith(".md")&&!d.endsWith(".txt"))continue;const u=z.join(i,d);if((await q.promises.stat(u)).isDirectory())continue;if((await q.promises.readFile(u,"utf-8")).includes(s))return console.log(` - ✓ 图片被引用: ${d}`),!0}}catch(c){console.error("检查图片引用失败:",c)}return console.log(" - ✗ 图片未被引用"),!1}),C.ipcMain.handle("fs:deleteUnreferencedImage",async(e,t)=>{const r=he.get("vaultPath");if(!r)return!1;const n=z.join(r,t);if(q.existsSync(n))try{return await q.promises.unlink(n),console.log("🗑️ 删除未引用图片:",t),!0}catch(s){return console.error("删除图片失败:",s),!1}return!1}),C.ipcMain.handle("chat:load",async(e,t)=>{const r=he.get("vaultPath");if(!r)return[];const n=Buffer.from(t).toString("base64").replace(/[\/+=]/g,"_"),s=z.join(r,".zennote","chats",`${n}.json`);try{const o=await q.promises.readFile(s,"utf-8");return JSON.parse(o)}catch{return[]}}),C.ipcMain.handle("chat:save",async(e,t,r)=>{const n=he.get("vaultPath");if(!n)return!1;un(n);const s=Buffer.from(t).toString("base64").replace(/[\/+=]/g,"_"),o=z.join(n,".zennote","chats",`${s}.json`);return await q.promises.writeFile(o,JSON.stringify(r,null,2),"utf-8"),!0}),C.ipcMain.handle("chat:deleteAll",async()=>{const e=he.get("vaultPath");if(!e)return!1;const t=z.join(e,".zennote","chats");try{if(q.existsSync(t)){const r=await q.promises.readdir(t);for(const n of r)n.endsWith(".json")&&await q.promises.unlink(z.join(t,n));console.log("🗑️ 已清除所有聊天记录:",r.length,"个文件")}return!0}catch(r){return console.error("清除聊天记录失败:",r),!1}}),C.ipcMain.handle("export-markdown-to-pdf",async(e,t)=>{const{htmlContent:r,outputPath:n,title:s}=t,o=new C.BrowserWindow({width:800,height:600,show:!1,webPreferences:{nodeIntegration:!1,contextIsolation:!0}});try{const a=` @@ -118,5 +118,5 @@ ${t}`,f0=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),h0=Objec ${r} -`;await o.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(i)}`),await new Promise(f=>setTimeout(f,500));const a=await o.webContents.printToPDF({printBackground:!0,pageSize:"A4",margins:{top:.5,bottom:.5,left:.5,right:.5}}),c=ge.get("vaultPath");if(!c)throw new Error("未设置 Vault 路径");const d=Y.join(c,n),l=Y.dirname(d);return te.existsSync(l)||te.mkdirSync(l,{recursive:!0}),await te.promises.writeFile(d,a),console.log("✅ PDF 导出成功:",d),{success:!0}}catch(i){return console.error("❌ PDF 导出失败:",i),{success:!1,error:i instanceof Error?i.message:"导出失败"}}finally{o.close()}}),z.ipcMain.handle("fs:watch",(e,t)=>{const r=t||ge.get("vaultPath");return r?(tt&&tt.close(),tt=sS(r,{ignored:n=>{const s=Y.basename(n);return rd(s)},persistent:!0,ignoreInitial:!0,depth:10}),tt.on("add",n=>{const s=Y.relative(r,n);L==null||L.webContents.send("fs:change",{type:"add",path:s})}),tt.on("unlink",n=>{const s=Y.relative(r,n);L==null||L.webContents.send("fs:change",{type:"unlink",path:s})}),tt.on("change",n=>{const s=Y.relative(r,n);L==null||L.webContents.send("fs:change",{type:"change",path:s})}),tt.on("addDir",n=>{const s=Y.relative(r,n);L==null||L.webContents.send("fs:change",{type:"addDir",path:s})}),tt.on("unlinkDir",n=>{const s=Y.relative(r,n);L==null||L.webContents.send("fs:change",{type:"unlinkDir",path:s})}),console.log("📂 开始监听目录:",r),!0):!1}),z.ipcMain.handle("fs:unwatch",()=>(tt&&(tt.close(),tt=null,console.log("📂 停止监听目录")),!0)),z.ipcMain.handle("window:setWidth",(e,t)=>{if(L){const r=L.getBounds();return L.setBounds({...r,width:t}),!0}return!1}),z.ipcMain.handle("app:getVersion",()=>z.app.getVersion()),z.ipcMain.handle("settings:get",()=>qn.store),z.ipcMain.handle("settings:set",(e,t,r)=>(qn.set(t,r),!0)),z.ipcMain.handle("settings:reset",()=>(qn.clear(),!0)),z.ipcMain.handle("vault:syncSettings",async()=>{const e=ge.get("vaultPath");if(!e)return!1;try{Yr(e);const{customSystemPrompt:t,promptTemplates:r,theme:n,fontFamily:s,fontSize:o,defaultFormat:i,smartFormatConversion:a}=qn.store,c={theme:n,fontFamily:s,fontSize:o,defaultFormat:i,smartFormatConversion:a,customSystemPrompt:t,promptTemplates:r},d=Y.join(e,".zennote","settings","app_settings.json");return await te.promises.writeFile(d,JSON.stringify(c,null,2),"utf-8"),console.log("📝 设置已同步到 Vault"),!0}catch(t){return console.error("同步设置失败:",t),!1}}),z.ipcMain.handle("vault:loadSettings",async()=>{const e=ge.get("vaultPath");if(!e)return null;try{const t=Y.join(e,".zennote","settings","app_settings.json"),r=await te.promises.readFile(t,"utf-8"),n=JSON.parse(r);return console.log("📖 从 Vault 加载设置"),n}catch{return null}}),z.ipcMain.handle("vault:saveEngineConfig",async(e,t)=>{const r=ge.get("vaultPath");if(!r)return!1;try{Yr(r);const n=Y.join(r,".zennote","engine_config.json");return await te.promises.writeFile(n,JSON.stringify(t,null,2),"utf-8"),console.log("⚙️ 引擎配置已保存到 Vault"),!0}catch(n){return console.error("保存引擎配置失败:",n),!1}}),z.ipcMain.handle("vault:loadEngineConfig",async()=>{const e=ge.get("vaultPath");if(!e)return null;try{const t=Y.join(e,".zennote","engine_config.json"),r=await te.promises.readFile(t,"utf-8"),n=JSON.parse(r);return console.log("⚙️ 从 Vault 加载引擎配置"),n}catch{return null}}),z.ipcMain.handle("shortcuts:createArticle",()=>(L==null||L.webContents.send("shortcuts:createArticle"),!0)),z.ipcMain.handle("shortcuts:createFolder",()=>(L==null||L.webContents.send("shortcuts:createFolder"),!0)),z.ipcMain.handle("shortcuts:openSettings",()=>(L==null||L.webContents.send("shortcuts:openSettings"),!0)),z.ipcMain.handle("shortcuts:toggleFocusMode",()=>(L==null||L.webContents.send("shortcuts:toggleFocusMode"),!0)),z.ipcMain.handle("menu:changeLanguage",(e,t)=>(Qu(t),jo(),sd(),!0)),z.ipcMain.handle("menu:syncSmartAutocomplete",(e,t)=>(ed=t,jo(),!0)),oS){const e={success:!1,error:"Ollama 命令行功能在 App Store 版本中不可用。请使用 WebLLM 或通过 HTTP API 连接外部 Ollama 服务。",models:[]};z.ipcMain.handle("ollama:listModels",async()=>e),z.ipcMain.handle("ollama:pullModel",async()=>e),z.ipcMain.handle("ollama:cancelPull",async()=>e),z.ipcMain.handle("ollama:deleteModel",async()=>e),console.log("🛡️ MAS 沙盒模式: Ollama 命令行功能已禁用")}else{const e={...process.env,OLLAMA_HOST:"127.0.0.1:11434"};z.ipcMain.handle("ollama:listModels",async()=>{try{return new Promise(r=>{const n=Gr.spawn("ollama",["list"],{env:e});let s="";n.stdout.on("data",o=>{s+=o.toString()}),n.on("close",o=>{if(o===0)try{const a=s.trim().split(` -`).slice(1).map(c=>{const d=c.split(/\s{2,}/);return d.length>=3?{name:d[0],id:d[1],size:d[2],modified:d[3]||""}:null}).filter(c=>c!==null);r({success:!0,models:a})}catch{r({success:!1,error:"解析模型列表失败"})}else r({success:!1,error:"获取模型列表失败"})}),n.on("error",o=>{r({success:!1,error:o.message})})})}catch(r){return{success:!1,error:r instanceof Error?r.message:"Unknown error"}}});const t=new Map;z.ipcMain.handle("ollama:pullModel",async(r,n)=>new Promise((s,o)=>{var c,d;const i=Gr.spawn("ollama",["pull",n],{env:e});t.set(n,i);let a="";(c=i.stdout)==null||c.on("data",l=>{const f=l.toString();a+=f,L==null||L.webContents.send("ollama:pullProgress",{model:n,output:f})}),(d=i.stderr)==null||d.on("data",l=>{const f=l.toString();a+=f,L==null||L.webContents.send("ollama:pullProgress",{model:n,output:f})}),i.on("close",l=>{t.delete(n),l===0?s({success:!0,output:a}):o(new Error(`下载失败,退出码: ${l}`))}),i.on("error",l=>{t.delete(n),o(l)})})),z.ipcMain.handle("ollama:cancelPull",async(r,n)=>{if(n&&t.has(n)){console.log(`🛑 取消下载: ${n}`),t.get(n).kill("SIGTERM"),t.delete(n);try{Gr.spawn("ollama",["rm",n],{env:e}),console.log(`🗑️ 已清理未完成的模型: ${n}`)}catch(o){console.log("清理未完成模型失败:",o)}return{success:!0,cancelled:n}}if(t.size>0){const s=[];return Array.from(t.entries()).forEach(([o,i])=>{console.log(`🛑 取消下载: ${o}`),i.kill("SIGTERM"),s.push(o);try{Gr.spawn("ollama",["rm",o],{env:e}),console.log(`🗑️ 已清理未完成的模型: ${o}`)}catch(a){console.log("清理未完成模型失败:",a)}}),t.clear(),{success:!0,cancelled:s.join(", ")}}return{success:!1,error:"没有正在进行的下载"}}),z.ipcMain.handle("ollama:deleteModel",async(r,n)=>new Promise((s,o)=>{const i=Gr.spawn("ollama",["rm",n],{env:e});i.on("close",a=>{a===0?s({success:!0}):o(new Error(`删除失败,退出码: ${a}`))}),i.on("error",a=>o(a))}))}}function jo(){const e=process.platform==="darwin",t=[...e?[{label:z.app.name,submenu:[{role:"about",label:ne("menu.about",{appName:z.app.name})},{type:"separator"},{label:ne("menu.preferences"),accelerator:"CmdOrCtrl+,",click:()=>{L==null||L.webContents.send("shortcuts:openSettings")}},{type:"separator"},{role:"services",label:ne("menu.services")},{type:"separator"},{role:"hide",label:ne("menu.hide",{appName:z.app.name})},{role:"hideOthers",label:ne("menu.hideOthers")},{role:"unhide",label:ne("menu.unhide")},{type:"separator"},{role:"quit",label:ne("menu.quit",{appName:z.app.name})}]}]:[],{label:ne("menu.file"),submenu:[{label:ne("menu.newArticle"),accelerator:"CmdOrCtrl+N",click:()=>{L==null||L.webContents.send("shortcuts:createArticle")}},{label:ne("menu.newFolder"),accelerator:"CmdOrCtrl+Shift+N",click:()=>{L==null||L.webContents.send("shortcuts:createFolder")}},{type:"separator"},e?{role:"close",label:ne("menu.closeWindow")}:{role:"quit",label:ne("menu.quit",{appName:z.app.name})}]},{label:ne("menu.edit"),submenu:[{role:"undo",label:ne("menu.undo")},{role:"redo",label:ne("menu.redo")},{type:"separator"},{role:"cut",label:ne("menu.cut")},{role:"copy",label:ne("menu.copy")},{role:"paste",label:ne("menu.paste")},...e?[{role:"pasteAndMatchStyle",label:ne("menu.pasteAndMatchStyle")},{role:"delete",label:ne("menu.delete")},{role:"selectAll",label:ne("menu.selectAll")}]:[{role:"delete",label:ne("menu.delete")},{type:"separator"},{role:"selectAll",label:ne("menu.selectAll")}]]},{label:ne("menu.view"),submenu:[{label:ne("menu.focusMode"),accelerator:"CmdOrCtrl+Shift+F",click:()=>{L==null||L.webContents.send("shortcuts:toggleFocusMode")}},{label:ne("menu.cycleEditorMode"),accelerator:"CmdOrCtrl+E",click:()=>{L==null||L.webContents.send("shortcuts:cycleEditorMode")}},{label:ne(ed?"menu.disableSmartAutocomplete":"menu.enableSmartAutocomplete"),accelerator:"CmdOrCtrl+Shift+A",click:()=>{L==null||L.webContents.send("shortcuts:toggleSmartAutocomplete")}},{type:"separator"},{role:"reload",label:ne("menu.reload")},{role:"forceReload",label:ne("menu.forceReload")},{role:"toggleDevTools",label:ne("menu.devTools")},{type:"separator"},{role:"resetZoom",label:ne("menu.actualSize")},{role:"zoomIn",label:ne("menu.zoomIn")},{role:"zoomOut",label:ne("menu.zoomOut")},{type:"separator"},{role:"togglefullscreen",label:ne("menu.fullscreen")}]},{label:ne("menu.window"),submenu:[{label:ne("menu.showMainWindow"),accelerator:"CmdOrCtrl+1",click:()=>{L?(L.show(),L.focus()):fs()}},{type:"separator"},{role:"minimize",label:ne("menu.minimize")},{role:"zoom",label:ne("menu.zoom")},...e?[{type:"separator"},{role:"front",label:ne("menu.front")}]:[{role:"close",label:ne("menu.close")}]]},{role:"help",label:ne("menu.help"),submenu:[{label:ne("menu.visitWebsite"),click:async()=>{await z.shell.openExternal("https://hooosberg.github.io/WitNote/")}},{label:ne("menu.visitGitHub"),click:async()=>{await z.shell.openExternal("https://github.com/hooosberg/WitNote")}}]}],r=z.Menu.buildFromTemplate(t);z.Menu.setApplicationMenu(r)}function sd(){if(process.platform!=="darwin")return;const e=z.Menu.buildFromTemplate([{label:ne("menu.showMainWindow"),click:()=>{L?(L.show(),L.focus()):fs()}},{type:"separator"},{label:ne("menu.newArticle"),click:()=>{L==null||L.webContents.send("shortcuts:createArticle")}},{label:ne("menu.newFolder"),click:()=>{L==null||L.webContents.send("shortcuts:createFolder")}},{type:"separator"},{label:ne("menu.openSettings"),click:()=>{L==null||L.webContents.send("shortcuts:openSettings")}},{label:ne("menu.toggleFocusMode"),click:()=>{L==null||L.webContents.send("shortcuts:toggleFocusMode")}}]);z.app.dock.setMenu(e)}function fs(){const e=process.platform==="darwin",t={width:1400,height:900,minWidth:540,minHeight:606,hasShadow:!0,webPreferences:{preload:Y.join(__dirname,"preload.js"),nodeIntegration:!1,contextIsolation:!0,webSecurity:!0,experimentalFeatures:!0},title:"WitNote"};if(e?Object.assign(t,{vibrancy:"sidebar",visualEffectState:"active",transparent:!0,titleBarStyle:"hiddenInset",trafficLightPosition:{x:20,y:18},frame:!1}):Object.assign(t,{frame:!0,transparent:!1}),L=new z.BrowserWindow(t),un)console.log("🔗 开发模式: 连接到",un),L.loadURL(un),L.webContents.openDevTools();else{const r=Y.join(z.app.getAppPath(),"dist","index.html");console.log("📦 生产模式: 加载",r),L.loadFile(r)}L.on("closed",()=>{L=null}),L.webContents.on("did-finish-load",()=>{console.log("✅ 页面加载完成")})}const uS=z.app.requestSingleInstanceLock();uS?(z.app.on("second-instance",(e,t,r)=>{if(console.log("📂 检测到第二实例启动,命令行参数:",t),L){L.isMinimized()&&L.restore(),L.focus();for(const n of t.slice(1))if(!n.startsWith("-")&&te.existsSync(n)){const s=Y.extname(n).toLowerCase();if(td.includes(s)){console.log("📤 发送外部文件给渲染进程 (second-instance):",n),L.webContents.send("open-external-file",n);break}}}}),z.app.whenReady().then(async()=>{z.protocol.handle("local-file",t=>{const r=t.url.replace("local-file://","file://");return console.log("🖼️ 加载本地图片:",r),z.net.fetch(r)}),console.log("✅ 注册 local-file:// 协议");const e=aS();Qu(e),console.log(`🌍 系统语言: ${z.app.getLocale()} → 菜单语言: ${e}`),lS(),jo(),sd(),fs(),z.app.on("activate",()=>{L?(L.show(),L.focus()):z.BrowserWindow.getAllWindows().length===0&&fs()})})):(console.log("🔒 另一个实例正在运行,退出当前实例"),z.app.quit());z.app.on("open-file",(e,t)=>{e.preventDefault(),console.log("📂 macOS open-file 事件:",t),L&&L.webContents?L.webContents.send("open-external-file",t):To=t});z.app.on("window-all-closed",()=>{tt&&tt.close(),process.platform!=="darwin"&&z.app.quit()});z.app.on("will-quit",()=>{pt&&(pt(),pt=null,console.log("🔒 应用退出,释放文件夹访问权限"))});console.log("🧘 智简笔记本启动中...");console.log("📊 VITE_DEV_SERVER_URL:",un||"未设置 (生产模式)"); +`;await o.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(a)}`),await new Promise(f=>setTimeout(f,500));const i=await o.webContents.printToPDF({printBackground:!0,pageSize:"A4",margins:{top:.5,bottom:.5,left:.5,right:.5}}),c=he.get("vaultPath");if(!c)throw new Error("未设置 Vault 路径");const d=z.join(c,n),u=z.dirname(d);return q.existsSync(u)||q.mkdirSync(u,{recursive:!0}),await q.promises.writeFile(d,i),console.log("✅ PDF 导出成功:",d),{success:!0}}catch(a){return console.error("❌ PDF 导出失败:",a),{success:!1,error:a instanceof Error?a.message:"导出失败"}}finally{o.close()}}),C.ipcMain.handle("fs:watch",(e,t)=>{const r=t||he.get("vaultPath");return r?(Je&&Je.close(),Je=NN(r,{ignored:n=>{const s=z.basename(n);return ef(s)},persistent:!0,ignoreInitial:!0,depth:10}),Je.on("add",n=>{const s=z.relative(r,n);k==null||k.webContents.send("fs:change",{type:"add",path:s})}),Je.on("unlink",n=>{const s=z.relative(r,n);k==null||k.webContents.send("fs:change",{type:"unlink",path:s})}),Je.on("change",n=>{const s=z.relative(r,n);k==null||k.webContents.send("fs:change",{type:"change",path:s})}),Je.on("addDir",n=>{const s=z.relative(r,n);k==null||k.webContents.send("fs:change",{type:"addDir",path:s})}),Je.on("unlinkDir",n=>{const s=z.relative(r,n);k==null||k.webContents.send("fs:change",{type:"unlinkDir",path:s})}),console.log("📂 开始监听目录:",r),!0):!1}),C.ipcMain.handle("fs:unwatch",()=>(Je&&(Je.close(),Je=null,console.log("📂 停止监听目录")),!0)),C.ipcMain.handle("window:setWidth",(e,t)=>{if(k){const r=k.getBounds();return k.setBounds({...r,width:t}),!0}return!1}),C.ipcMain.handle("app:getVersion",()=>C.app.getVersion()),C.ipcMain.handle("settings:get",()=>ss.store),C.ipcMain.handle("settings:set",(e,t,r)=>(ss.set(t,r),!0)),C.ipcMain.handle("settings:reset",()=>(ss.clear(),!0)),C.ipcMain.handle("vault:syncSettings",async()=>{const e=he.get("vaultPath");if(!e)return!1;try{un(e);const{customSystemPrompt:t,promptTemplates:r,theme:n,fontFamily:s,fontSize:o,defaultFormat:a,smartFormatConversion:i}=ss.store,c={theme:n,fontFamily:s,fontSize:o,defaultFormat:a,smartFormatConversion:i,customSystemPrompt:t,promptTemplates:r},d=z.join(e,".zennote","settings","app_settings.json");return await q.promises.writeFile(d,JSON.stringify(c,null,2),"utf-8"),console.log("📝 设置已同步到 Vault"),!0}catch(t){return console.error("同步设置失败:",t),!1}}),C.ipcMain.handle("vault:loadSettings",async()=>{const e=he.get("vaultPath");if(!e)return null;try{const t=z.join(e,".zennote","settings","app_settings.json"),r=await q.promises.readFile(t,"utf-8"),n=JSON.parse(r);return console.log("📖 从 Vault 加载设置"),n}catch{return null}}),C.ipcMain.handle("vault:saveEngineConfig",async(e,t)=>{const r=he.get("vaultPath");if(!r)return!1;try{un(r);const n=z.join(r,".zennote","engine_config.json");return await q.promises.writeFile(n,JSON.stringify(t,null,2),"utf-8"),console.log("⚙️ 引擎配置已保存到 Vault"),!0}catch(n){return console.error("保存引擎配置失败:",n),!1}}),C.ipcMain.handle("vault:loadEngineConfig",async()=>{const e=he.get("vaultPath");if(!e)return null;try{const t=z.join(e,".zennote","engine_config.json"),r=await q.promises.readFile(t,"utf-8"),n=JSON.parse(r);return console.log("⚙️ 从 Vault 加载引擎配置"),n}catch{return null}}),C.ipcMain.handle("shortcuts:createArticle",()=>(k==null||k.webContents.send("shortcuts:createArticle"),!0)),C.ipcMain.handle("shortcuts:createFolder",()=>(k==null||k.webContents.send("shortcuts:createFolder"),!0)),C.ipcMain.handle("shortcuts:openSettings",()=>(k==null||k.webContents.send("shortcuts:openSettings"),!0)),C.ipcMain.handle("shortcuts:toggleFocusMode",()=>(k==null||k.webContents.send("shortcuts:toggleFocusMode"),!0)),C.ipcMain.handle("menu:changeLanguage",(e,t)=>(Xd(t),Xo(),rf(),!0)),C.ipcMain.handle("menu:syncSmartAutocomplete",(e,t)=>(Zd=t,Xo(),!0)),RN){const e={success:!1,error:"Ollama 命令行功能在 App Store 版本中不可用。请使用 WebLLM 或通过 HTTP API 连接外部 Ollama 服务。",models:[]};C.ipcMain.handle("ollama:listModels",async()=>e),C.ipcMain.handle("ollama:pullModel",async()=>e),C.ipcMain.handle("ollama:cancelPull",async()=>e),C.ipcMain.handle("ollama:deleteModel",async()=>e),console.log("🛡️ MAS 沙盒模式: Ollama 命令行功能已禁用")}else{const e={...process.env,OLLAMA_HOST:"127.0.0.1:11434"};C.ipcMain.handle("ollama:listModels",async()=>{try{return new Promise(r=>{const n=nn.spawn("ollama",["list"],{env:e});let s="";n.stdout.on("data",o=>{s+=o.toString()}),n.on("close",o=>{if(o===0)try{const i=s.trim().split(` +`).slice(1).map(c=>{const d=c.split(/\s{2,}/);return d.length>=3?{name:d[0],id:d[1],size:d[2],modified:d[3]||""}:null}).filter(c=>c!==null);r({success:!0,models:i})}catch{r({success:!1,error:"解析模型列表失败"})}else r({success:!1,error:"获取模型列表失败"})}),n.on("error",o=>{r({success:!1,error:o.message})})})}catch(r){return{success:!1,error:r instanceof Error?r.message:"Unknown error"}}});const t=new Map;C.ipcMain.handle("ollama:pullModel",async(r,n)=>new Promise((s,o)=>{var c,d;const a=nn.spawn("ollama",["pull",n],{env:e});t.set(n,a);let i="";(c=a.stdout)==null||c.on("data",u=>{const f=u.toString();i+=f,k==null||k.webContents.send("ollama:pullProgress",{model:n,output:f})}),(d=a.stderr)==null||d.on("data",u=>{const f=u.toString();i+=f,k==null||k.webContents.send("ollama:pullProgress",{model:n,output:f})}),a.on("close",u=>{t.delete(n),u===0?s({success:!0,output:i}):o(new Error(`下载失败,退出码: ${u}`))}),a.on("error",u=>{t.delete(n),o(u)})})),C.ipcMain.handle("ollama:cancelPull",async(r,n)=>{if(n&&t.has(n)){console.log(`🛑 取消下载: ${n}`),t.get(n).kill("SIGTERM"),t.delete(n);try{nn.spawn("ollama",["rm",n],{env:e}),console.log(`🗑️ 已清理未完成的模型: ${n}`)}catch(o){console.log("清理未完成模型失败:",o)}return{success:!0,cancelled:n}}if(t.size>0){const s=[];return Array.from(t.entries()).forEach(([o,a])=>{console.log(`🛑 取消下载: ${o}`),a.kill("SIGTERM"),s.push(o);try{nn.spawn("ollama",["rm",o],{env:e}),console.log(`🗑️ 已清理未完成的模型: ${o}`)}catch(i){console.log("清理未完成模型失败:",i)}}),t.clear(),{success:!0,cancelled:s.join(", ")}}return{success:!1,error:"没有正在进行的下载"}}),C.ipcMain.handle("ollama:deleteModel",async(r,n)=>new Promise((s,o)=>{const a=nn.spawn("ollama",["rm",n],{env:e});a.on("close",i=>{i===0?s({success:!0}):o(new Error(`删除失败,退出码: ${i}`))}),a.on("error",i=>o(i))}))}}function Xo(){const e=process.platform==="darwin",t=[...e?[{label:C.app.name,submenu:[{role:"about",label:X("menu.about",{appName:C.app.name})},{type:"separator"},{label:X("menu.preferences"),accelerator:"CmdOrCtrl+,",click:()=>{k==null||k.webContents.send("shortcuts:openSettings")}},{type:"separator"},{role:"services",label:X("menu.services")},{type:"separator"},{role:"hide",label:X("menu.hide",{appName:C.app.name})},{role:"hideOthers",label:X("menu.hideOthers")},{role:"unhide",label:X("menu.unhide")},{type:"separator"},{role:"quit",label:X("menu.quit",{appName:C.app.name})}]}]:[],{label:X("menu.file"),submenu:[{label:X("menu.newArticle"),accelerator:"CmdOrCtrl+N",click:()=>{k==null||k.webContents.send("shortcuts:createArticle")}},{label:X("menu.newFolder"),accelerator:"CmdOrCtrl+Shift+N",click:()=>{k==null||k.webContents.send("shortcuts:createFolder")}},{type:"separator"},e?{role:"close",label:X("menu.closeWindow")}:{role:"quit",label:X("menu.quit",{appName:C.app.name})}]},{label:X("menu.edit"),submenu:[{role:"undo",label:X("menu.undo")},{role:"redo",label:X("menu.redo")},{type:"separator"},{role:"cut",label:X("menu.cut")},{role:"copy",label:X("menu.copy")},{role:"paste",label:X("menu.paste")},...e?[{role:"pasteAndMatchStyle",label:X("menu.pasteAndMatchStyle")},{role:"delete",label:X("menu.delete")},{role:"selectAll",label:X("menu.selectAll")}]:[{role:"delete",label:X("menu.delete")},{type:"separator"},{role:"selectAll",label:X("menu.selectAll")}]]},{label:X("menu.view"),submenu:[{label:X("menu.focusMode"),accelerator:"CmdOrCtrl+Shift+F",click:()=>{k==null||k.webContents.send("shortcuts:toggleFocusMode")}},{label:X("menu.cycleEditorMode"),accelerator:"CmdOrCtrl+E",click:()=>{k==null||k.webContents.send("shortcuts:cycleEditorMode")}},{label:X(Zd?"menu.disableSmartAutocomplete":"menu.enableSmartAutocomplete"),accelerator:"CmdOrCtrl+Shift+A",click:()=>{k==null||k.webContents.send("shortcuts:toggleSmartAutocomplete")}},{type:"separator"},{role:"reload",label:X("menu.reload")},{role:"forceReload",label:X("menu.forceReload")},{role:"toggleDevTools",label:X("menu.devTools")},{type:"separator"},{role:"resetZoom",label:X("menu.actualSize")},{role:"zoomIn",label:X("menu.zoomIn")},{role:"zoomOut",label:X("menu.zoomOut")},{type:"separator"},{role:"togglefullscreen",label:X("menu.fullscreen")}]},{label:X("menu.window"),submenu:[{label:X("menu.showMainWindow"),accelerator:"CmdOrCtrl+1",click:()=>{k?(k.show(),k.focus()):Ts()}},{type:"separator"},{role:"minimize",label:X("menu.minimize")},{role:"zoom",label:X("menu.zoom")},...e?[{type:"separator"},{role:"front",label:X("menu.front")}]:[{role:"close",label:X("menu.close")}]]},{role:"help",label:X("menu.help"),submenu:[{label:X("menu.visitWebsite"),click:async()=>{await C.shell.openExternal("https://hooosberg.github.io/WitNote/")}},{label:X("menu.visitGitHub"),click:async()=>{await C.shell.openExternal("https://github.com/hooosberg/WitNote")}}]}],r=C.Menu.buildFromTemplate(t);C.Menu.setApplicationMenu(r)}function rf(){if(process.platform!=="darwin")return;const e=C.Menu.buildFromTemplate([{label:X("menu.showMainWindow"),click:()=>{k?(k.show(),k.focus()):Ts()}},{type:"separator"},{label:X("menu.newArticle"),click:()=>{k==null||k.webContents.send("shortcuts:createArticle")}},{label:X("menu.newFolder"),click:()=>{k==null||k.webContents.send("shortcuts:createFolder")}},{type:"separator"},{label:X("menu.openSettings"),click:()=>{k==null||k.webContents.send("shortcuts:openSettings")}},{label:X("menu.toggleFocusMode"),click:()=>{k==null||k.webContents.send("shortcuts:toggleFocusMode")}}]);C.app.dock.setMenu(e)}function Ts(){const e=process.platform==="darwin",t={width:1400,height:900,minWidth:540,minHeight:606,hasShadow:!0,webPreferences:{preload:z.join(__dirname,"preload.js"),nodeIntegration:!1,contextIsolation:!0,webSecurity:!0,experimentalFeatures:!0},title:"WitNote"};if(e?Object.assign(t,{vibrancy:"sidebar",visualEffectState:"active",transparent:!0,titleBarStyle:"hiddenInset",trafficLightPosition:{x:20,y:18},frame:!1}):Object.assign(t,{frame:!0,transparent:!1}),k=new C.BrowserWindow(t),Nn)console.log("🔗 开发模式: 连接到",Nn),k.loadURL(Nn),k.webContents.openDevTools();else{const r=z.join(C.app.getAppPath(),"dist","index.html");console.log("📦 生产模式: 加载",r),k.loadFile(r)}k.on("closed",()=>{k=null}),k.webContents.on("did-finish-load",()=>{console.log("✅ 页面加载完成")})}const AN=C.app.requestSingleInstanceLock();AN?(C.app.on("second-instance",(e,t,r)=>{if(console.log("📂 检测到第二实例启动,命令行参数:",t),k){k.isMinimized()&&k.restore(),k.focus();for(const n of t.slice(1))if(!n.startsWith("-")&&q.existsSync(n)){const s=z.extname(n).toLowerCase();if(Qd.includes(s)){console.log("📤 发送外部文件给渲染进程 (second-instance):",n),k.webContents.send("open-external-file",n);break}}}}),C.app.whenReady().then(async()=>{C.protocol.handle("local-file",t=>{const r=t.url.replace("local-file://","file://");return console.log("🖼️ 加载本地图片:",r),C.net.fetch(r)}),console.log("✅ 注册 local-file:// 协议");const e=ON();Xd(e),console.log(`🌍 系统语言: ${C.app.getLocale()} → 菜单语言: ${e}`),jN(),Xo(),rf(),Ts(),C.app.on("activate",()=>{k?(k.show(),k.focus()):C.BrowserWindow.getAllWindows().length===0&&Ts()})})):(console.log("🔒 另一个实例正在运行,退出当前实例"),C.app.quit());C.app.on("open-file",(e,t)=>{e.preventDefault(),console.log("📂 macOS open-file 事件:",t),k&&k.webContents?k.webContents.send("open-external-file",t):Jo=t});C.app.on("window-all-closed",()=>{Je&&Je.close(),process.platform!=="darwin"&&C.app.quit()});C.app.on("will-quit",()=>{ct&&(ct(),ct=null,console.log("🔒 应用退出,释放文件夹访问权限"))});console.log("🧘 智简笔记本启动中...");console.log("📊 VITE_DEV_SERVER_URL:",Nn||"未设置 (生产模式)"); diff --git a/package-lock.json b/package-lock.json index e742690..e278d44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "witnote", - "version": "1.3.2", + "version": "1.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "witnote", - "version": "1.3.2", + "version": "1.3.3", "license": "MIT", "dependencies": { "@mlc-ai/web-llm": "^0.2.80", @@ -139,7 +139,6 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -488,7 +487,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -532,7 +530,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -2802,7 +2799,6 @@ "integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" @@ -2993,7 +2989,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3218,6 +3213,7 @@ "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "archiver-utils": "^2.1.0", "async": "^3.2.4", @@ -3237,6 +3233,7 @@ "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", @@ -3259,6 +3256,7 @@ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3274,7 +3272,8 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/archiver-utils/node_modules/string_decoder": { "version": "1.1.1", @@ -3282,6 +3281,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "safe-buffer": "~5.1.0" } @@ -3434,6 +3434,7 @@ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -3496,7 +3497,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -3909,6 +3909,7 @@ "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "buffer-crc32": "^0.2.13", "crc32-stream": "^4.0.2", @@ -4111,6 +4112,7 @@ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "crc32": "bin/crc32.njs" }, @@ -4124,6 +4126,7 @@ "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" @@ -4415,7 +4418,6 @@ "integrity": "sha512-rcJUkMfnJpfCboZoOOPf4L29TRtEieHNOeAbYPWPxlaBw/Z1RKrRA86dOI9rwaI4tQSc/RD82zTNHprfUHXsoQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "app-builder-lib": "24.13.3", "builder-util": "24.13.1", @@ -4648,6 +4650,7 @@ "integrity": "sha512-oHkV0iogWfyK+ah9ZIvMDpei1m9ZRpdXcvde1wTpra2U8AFDNNpqJdnin5z+PM1GbQ5BoaKCWas2HSjtR0HwMg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "app-builder-lib": "24.13.3", "archiver": "^5.3.1", @@ -4661,6 +4664,7 @@ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -4676,6 +4680,7 @@ "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "universalify": "^2.0.0" }, @@ -4689,6 +4694,7 @@ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">= 10.0.0" } @@ -5193,7 +5199,8 @@ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/fs-extra": { "version": "8.1.0", @@ -5683,7 +5690,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.28.4" }, @@ -6136,6 +6142,7 @@ "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "readable-stream": "^2.0.5" }, @@ -6149,6 +6156,7 @@ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -6164,7 +6172,8 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lazystream/node_modules/string_decoder": { "version": "1.1.1", @@ -6172,6 +6181,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "safe-buffer": "~5.1.0" } @@ -6197,35 +6207,40 @@ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash.difference": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/loglevel": { "version": "1.9.2", @@ -6619,6 +6634,7 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -6792,7 +6808,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -6920,7 +6935,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", - "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -6933,7 +6947,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", - "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -7054,6 +7067,7 @@ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -7069,6 +7083,7 @@ "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "minimatch": "^5.1.0" } @@ -7225,7 +7240,8 @@ "url": "https://feross.org/support" } ], - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -7557,6 +7573,7 @@ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -7706,6 +7723,7 @@ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", @@ -7942,7 +7960,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8071,7 +8088,6 @@ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -8146,8 +8162,7 @@ "resolved": "https://registry.npmjs.org/vite-plugin-electron-renderer/-/vite-plugin-electron-renderer-0.14.6.tgz", "integrity": "sha512-oqkWFa7kQIkvHXG7+Mnl1RTroA4sP0yesKatmAy0gjZC4VwUqlvF9IvOpHd1fpLWsqYX/eZlVxlhULNtaQ78Jw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/vitest": { "version": "4.0.16", @@ -8693,7 +8708,6 @@ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -9056,6 +9070,7 @@ "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "archiver-utils": "^3.0.4", "compress-commons": "^4.1.2", @@ -9071,6 +9086,7 @@ "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "glob": "^7.2.3", "graceful-fs": "^4.2.0", diff --git a/src/components/AIDialog.tsx b/src/components/AIDialog.tsx new file mode 100644 index 0000000..9fb9f2b --- /dev/null +++ b/src/components/AIDialog.tsx @@ -0,0 +1,414 @@ +import { useEffect, useRef, useState } from 'react' +import { createPortal } from 'react-dom' +import { Loader2, ArrowRight, Copy, Check, RefreshCw } from 'lucide-react' +import { marked } from 'marked' + +interface AIDialogProps { + isOpen: boolean + onClose: () => void + onSubmit: (instruction: string) => void + onRegenerate?: () => Promise + isLoading?: boolean + isRegenerating?: boolean + previewData?: { original: string; new: string } | null + resultType?: 'edit' | 'ask' | null + onConfirmPreview?: () => void + onCancelPreview?: () => void + selectedText?: string +} + +export default function AIDialog({ + isOpen, + onClose, + onSubmit, + onRegenerate, + isLoading = false, + isRegenerating = false, + previewData, + resultType = null, + onConfirmPreview, + onCancelPreview, + selectedText = '' +}: AIDialogProps) { + const [instruction, setInstruction] = useState('') + const [conversation, setConversation] = useState<{ q: string; a: string }[]>([]) + const [copied, setCopied] = useState<'answer' | 'suggestion' | ''>('') + const textareaRef = useRef(null) + const answerEndRef = useRef(null) + + // 每次打开时重置所有状态 + useEffect(() => { + if (isOpen) { + setInstruction('') + setConversation([]) + setCopied('') + setTimeout(() => textareaRef.current?.focus(), 100) + } + }, [isOpen]) + + // 当 previewData 变化且是 ask 模式时,将问答加入对话历史 + useEffect(() => { + if (previewData && resultType === 'ask' && instruction.trim()) { + setConversation(prev => [...prev, { q: instruction.trim(), a: previewData.new }]) + setInstruction('') + setCopied('') + } + }, [previewData, resultType]) + + // 自动滚动到最新回答 + useEffect(() => { + if (answerEndRef.current) { + answerEndRef.current.scrollIntoView({ behavior: 'smooth' }) + } + }, [conversation]) + + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Escape' && isOpen) { + e.preventDefault() + onClose() + } + if (e.key === 'Enter' && !e.shiftKey && isOpen && !isLoading && !previewData) { + e.preventDefault() + handleSubmit() + } + // ask 模式下,有 previewData 时也可以按 Enter 提交新问题 + if (e.key === 'Enter' && !e.shiftKey && isOpen && !isLoading && previewData && resultType === 'ask') { + e.preventDefault() + handleSubmit() + } + } + document.addEventListener('keydown', handleKeyDown) + return () => document.removeEventListener('keydown', handleKeyDown) + }, [isOpen, instruction, onClose, onSubmit, isLoading, previewData, resultType]) + + const handleSubmit = async () => { + const trimmed = instruction.trim() + if (!trimmed || isLoading) return + onSubmit(trimmed) + } + + const copyToClipboard = async (text: string, type: 'answer' | 'suggestion') => { + try { + await navigator.clipboard.writeText(text) + setCopied(type) + setTimeout(() => setCopied(''), 2000) + } catch { + const ta = document.createElement('textarea') + ta.value = text + document.body.appendChild(ta) + ta.select() + document.execCommand('copy') + document.body.removeChild(ta) + setCopied(type) + setTimeout(() => setCopied(''), 2000) + } + } + + const renderMarkdown = (text: string) => { + try { + const html = marked.parse(text, { async: false }) as string + return html + } catch { + return text + } + } + + if (!isOpen) return null + + const isAskResult = resultType === 'ask' + + return createPortal( +
+
+ {/* 标题 */} +
+ AI 编辑 +
+ + {/* 选中内容 - 放大显示在顶部 */} + {selectedText && ( +
+
选中内容
+
+ {selectedText} +
+
+ )} + + {/* 输入区域 */} +
+