UNPKG

@povio/openapi-codegen-cli

Version:

**NOTE:** This CLI tool is primarily designed for use within our organization. The generated code output aligns with our internal template. If you are using this tool without our internal template, make sure to use it in **standalone** mode.

9 lines (8 loc) 484 kB
"use strict";var DP=Object.create;var ji=Object.defineProperty;var LP=Object.getOwnPropertyDescriptor;var FP=Object.getOwnPropertyNames;var HP=Object.getPrototypeOf,VP=Object.prototype.hasOwnProperty;var o=(e,t)=>ji(e,"name",{value:t,configurable:!0});var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),BP=(e,t)=>{for(var r in t)ji(e,r,{get:t[r],enumerable:!0})},Wd=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FP(t))!VP.call(e,i)&&i!==r&&ji(e,i,{get:()=>t[i],enumerable:!(n=LP(t,i))||n.enumerable});return e};var Re=(e,t,r)=>(r=e!=null?DP(HP(e)):{},Wd(t||!e||!e.__esModule?ji(r,"default",{value:e,enumerable:!0}):r,e)),GP=e=>Wd(ji({},"__esModule",{value:!0}),e);var He=h((Fe,Jd)=>{"use strict";var us=/^win/.test(process.platform),UP=/\//g,ZP=/^(\w{2,}):\/\//i,Yd=Jd.exports,zP=/~1/g,KP=/~0/g,Ic=[/\?/g,"%3F",/\#/g,"%23"],Tc=[/\%23/g,"#",/\%24/g,"$",/\%26/g,"&",/\%2C/g,",",/\%40/g,"@"];Fe.parse=require("url").parse;Fe.resolve=require("url").resolve;Fe.cwd=o(function(){if(process.browser)return location.href;let t=process.cwd(),r=t.slice(-1);return r==="/"||r==="\\"?t:t+"/"},"cwd");Fe.getProtocol=o(function(t){let r=ZP.exec(t);if(r)return r[1].toLowerCase()},"getProtocol");Fe.getExtension=o(function(t){let r=t.lastIndexOf(".");return r>=0?t.substr(r).toLowerCase():""},"getExtension");Fe.getHash=o(function(t){let r=t.indexOf("#");return r>=0?t.substr(r):"#"},"getHash");Fe.stripHash=o(function(t){let r=t.indexOf("#");return r>=0&&(t=t.substr(0,r)),t},"stripHash");Fe.isHttp=o(function(t){let r=Yd.getProtocol(t);return r==="http"||r==="https"?!0:r===void 0?process.browser:!1},"isHttp");Fe.isFileSystemPath=o(function(t){if(process.browser)return!1;let r=Yd.getProtocol(t);return r===void 0||r==="file"},"isFileSystemPath");Fe.fromFileSystemPath=o(function(t){us&&(t=t.replace(/\\/g,"/")),t=encodeURI(t);for(let r=0;r<Ic.length;r+=2)t=t.replace(Ic[r],Ic[r+1]);return t},"fromFileSystemPath");Fe.toFileSystemPath=o(function(t,r){t=decodeURI(t);for(let i=0;i<Tc.length;i+=2)t=t.replace(Tc[i],Tc[i+1]);let n=t.substr(0,7).toLowerCase()==="file://";return n&&(t=t[7]==="/"?t.substr(8):t.substr(7),us&&t[1]==="/"&&(t=t[0]+":"+t.substr(1)),r?t="file:///"+t:(n=!1,t=us?t:"/"+t)),us&&!n&&(t=t.replace(UP,"\\"),t.substr(1,2)===":\\"&&(t=t[0].toUpperCase()+t.substr(1))),t},"toFileSystemPath");Fe.safePointerToPath=o(function(t){return t.length<=1||t[0]!=="#"||t[1]!=="/"?[]:t.slice(2).split("/").map(r=>decodeURIComponent(r).replace(zP,"/").replace(KP,"~"))},"safePointerToPath")});var ls=h(qi=>{"use strict";var Xd=require("util"),QP=He();qi.format=Xd.format;qi.inherits=Xd.inherits;qi.swaggerParamRegExp=/\{([^/}]+)}/g;var WP=["get","post","put","delete","patch","options","head","trace"];function Cc(e,t){if(e.url&&e.url.startsWith("/")){let r=QP.parse(t),n=r.protocol+"//"+r.hostname+e.url;return e.url=n,e}}o(Cc,"fixServers");function YP(e,t){e.openapi&&t&&(t.startsWith("http:")||t.startsWith("https:"))&&(e.servers&&e.servers.map(r=>Cc(r,t)),["paths","webhooks"].forEach(r=>{Object.keys(e[r]||[]).forEach(n=>{let i=e[r][n];Object.keys(i).forEach(s=>{s==="servers"?i[s].map(a=>Cc(a,t)):WP.includes(s)&&i[s].servers&&i[s].servers.map(a=>Cc(a,t))})})}))}o(YP,"fixOasRelativeServers");qi.fixOasRelativeServers=YP});var ps=h(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.getDeepKeys=xn.toJSON=void 0;var JP=["function","symbol","undefined"],XP=["constructor","prototype","__proto__"],e2=Object.getPrototypeOf({});function t2(){let e={},t=this;for(let r of em(t))if(typeof r=="string"){let n=t[r],i=typeof n;JP.includes(i)||(e[r]=n)}return e}o(t2,"toJSON");xn.toJSON=t2;function em(e,t=[]){let r=[];for(;e&&e!==e2;)r=r.concat(Object.getOwnPropertyNames(e),Object.getOwnPropertySymbols(e)),e=Object.getPrototypeOf(e);let n=new Set(r);for(let i of t.concat(XP))n.delete(i);return n}o(em,"getDeepKeys");xn.getDeepKeys=em});var Rc=h(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.addInspectMethod=An.format=void 0;var tm=require("util"),r2=ps(),rm=tm.inspect.custom||Symbol.for("nodejs.util.inspect.custom");An.format=tm.format;function n2(e){e[rm]=i2}o(n2,"addInspectMethod");An.addInspectMethod=n2;function i2(){let e={},t=this;for(let r of r2.getDeepKeys(t)){let n=t[r];e[r]=n}return delete e[rm],e}o(i2,"inspect")});var om=h(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.lazyJoinStacks=yt.joinStacks=yt.isWritableStack=yt.isLazyStack=void 0;var o2=/\r?\n/,s2=/\bono[ @]/;function a2(e){return!!(e&&e.configurable&&typeof e.get=="function")}o(a2,"isLazyStack");yt.isLazyStack=a2;function c2(e){return!!(!e||e.writable||typeof e.set=="function")}o(c2,"isWritableStack");yt.isWritableStack=c2;function nm(e,t){let r=im(e.stack),n=t?t.stack:void 0;return r&&n?r+` `+n:r||n}o(nm,"joinStacks");yt.joinStacks=nm;function u2(e,t,r){r?Object.defineProperty(t,"stack",{get:o(()=>{let n=e.get.apply(t);return nm({stack:n},r)},"get"),enumerable:!1,configurable:!0}):l2(t,e)}o(u2,"lazyJoinStacks");yt.lazyJoinStacks=u2;function im(e){if(e){let t=e.split(o2),r;for(let n=0;n<t.length;n++){let i=t[n];if(s2.test(i))r===void 0&&(r=n);else if(r!==void 0){t.splice(r,n-r);break}}if(t.length>0)return t.join(` `)}return e}o(im,"popStack");function l2(e,t){Object.defineProperty(e,"stack",{get:o(()=>im(t.get.apply(e)),"get"),enumerable:!1,configurable:!0})}o(l2,"lazyPopStack")});var cm=h(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.extendError=void 0;var sm=Rc(),fs=om(),am=ps(),p2=["name","message","stack"];function f2(e,t,r){let n=e;return d2(n,t),t&&typeof t=="object"&&m2(n,t),n.toJSON=am.toJSON,sm.addInspectMethod&&sm.addInspectMethod(n),r&&typeof r=="object"&&Object.assign(n,r),n}o(f2,"extendError");ds.extendError=f2;function d2(e,t){let r=Object.getOwnPropertyDescriptor(e,"stack");fs.isLazyStack(r)?fs.lazyJoinStacks(r,e,t):fs.isWritableStack(r)&&(e.stack=fs.joinStacks(e,t))}o(d2,"extendStack");function m2(e,t){let r=am.getDeepKeys(t,p2),n=e,i=t;for(let s of r)if(n[s]===void 0)try{n[s]=i[s]}catch{}}o(m2,"mergeErrors")});var um=h(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.normalizeArgs=wn.normalizeOptions=void 0;var h2=Rc();function g2(e){return e=e||{},{concatMessages:e.concatMessages===void 0?!0:!!e.concatMessages,format:e.format===void 0?h2.format:typeof e.format=="function"?e.format:!1}}o(g2,"normalizeOptions");wn.normalizeOptions=g2;function y2(e,t){let r,n,i,s="";return typeof e[0]=="string"?i=e:typeof e[1]=="string"?(e[0]instanceof Error?r=e[0]:n=e[0],i=e.slice(1)):(r=e[0],n=e[1],i=e.slice(2)),i.length>0&&(t.format?s=t.format.apply(void 0,i):s=i.join(" ")),t.concatMessages&&r&&r.message&&(s+=(s?` `:"")+r.message),{originalError:r,props:n,message:s}}o(y2,"normalizeArgs");wn.normalizeArgs=y2});var kc=h(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.Ono=void 0;var ms=cm(),lm=um(),S2=ps(),v2=Nc;hs.Ono=v2;function Nc(e,t){t=lm.normalizeOptions(t);function r(...n){let{originalError:i,props:s,message:a}=lm.normalizeArgs(n,t),c=new e(a);return ms.extendError(c,i,s)}return o(r,"ono"),r[Symbol.species]=e,r}o(Nc,"Ono");Nc.toJSON=o(function(t){return S2.toJSON.call(t)},"toJSON");Nc.extend=o(function(t,r,n){return n||r instanceof Error?ms.extendError(t,r,n):r?ms.extendError(t,void 0,r):ms.extendError(t)},"extend")});var pm=h(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.ono=void 0;var Mr=kc(),b2=St;gs.ono=b2;St.error=new Mr.Ono(Error);St.eval=new Mr.Ono(EvalError);St.range=new Mr.Ono(RangeError);St.reference=new Mr.Ono(ReferenceError);St.syntax=new Mr.Ono(SyntaxError);St.type=new Mr.Ono(TypeError);St.uri=new Mr.Ono(URIError);var _2=St;function St(...e){let t=e[0];if(typeof t=="object"&&typeof t.name=="string"){for(let r of Object.values(_2))if(typeof r=="function"&&r.name==="ono"){let n=r[Symbol.species];if(n&&n!==Error&&(t instanceof n||t.name===n.name))return r.apply(void 0,e)}}return St.error.apply(void 0,e)}o(St,"ono")});var dm=h(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});var NM=require("util")});var ot=h((it,In)=>{"use strict";var E2=it&&it.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:o(function(){return t[r]},"get")})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),P2=it&&it.__exportStar||function(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&E2(t,e,r)};Object.defineProperty(it,"__esModule",{value:!0});it.ono=void 0;var mm=pm();Object.defineProperty(it,"ono",{enumerable:!0,get:o(function(){return mm.ono},"get")});var O2=kc();Object.defineProperty(it,"Ono",{enumerable:!0,get:o(function(){return O2.Ono},"get")});P2(dm(),it);it.default=mm.ono;typeof In=="object"&&typeof In.exports=="object"&&(In.exports=Object.assign(In.exports.default,In.exports))});var Li=h(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.regexpCode=F.getEsmExportName=F.getProperty=F.safeStringify=F.stringify=F.strConcat=F.addCodeArg=F.str=F._=F.nil=F._Code=F.Name=F.IDENTIFIER=F._CodeOrName=void 0;var Mc=class Mc{};o(Mc,"_CodeOrName");var Mi=Mc;F._CodeOrName=Mi;F.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Dc=class Dc extends Mi{constructor(t){if(super(),!F.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};o(Dc,"Name");var Dr=Dc;F.Name=Dr;var Lc=class Lc extends Mi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Dr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};o(Lc,"_Code");var ze=Lc;F._Code=ze;F.nil=new ze("");function hm(e,...t){let r=[e[0]],n=0;for(;n<t.length;)qc(r,t[n]),r.push(e[++n]);return new ze(r)}o(hm,"_");F._=hm;var jc=new ze("+");function gm(e,...t){let r=[Di(e[0])],n=0;for(;n<t.length;)r.push(jc),qc(r,t[n]),r.push(jc,Di(e[++n]));return $2(r),new ze(r)}o(gm,"str");F.str=gm;function qc(e,t){t instanceof ze?e.push(...t._items):t instanceof Dr?e.push(t):e.push(w2(t))}o(qc,"addCodeArg");F.addCodeArg=qc;function $2(e){let t=1;for(;t<e.length-1;){if(e[t]===jc){let r=x2(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}o($2,"optimize");function x2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Dr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Dr))return`"${e}${t.slice(1)}`}o(x2,"mergeExprItems");function A2(e,t){return t.emptyStr()?e:e.emptyStr()?t:gm`${e}${t}`}o(A2,"strConcat");F.strConcat=A2;function w2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Di(Array.isArray(e)?e.join(","):e)}o(w2,"interpolate");function I2(e){return new ze(Di(e))}o(I2,"stringify");F.stringify=I2;function Di(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}o(Di,"safeStringify");F.safeStringify=Di;function T2(e){return typeof e=="string"&&F.IDENTIFIER.test(e)?new ze(`.${e}`):hm`[${e}]`}o(T2,"getProperty");F.getProperty=T2;function C2(e){if(typeof e=="string"&&F.IDENTIFIER.test(e))return new ze(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}o(C2,"getEsmExportName");F.getEsmExportName=C2;function R2(e){return new ze(e.toString())}o(R2,"regexpCode");F.regexpCode=R2});var Zc=h(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.ValueScope=ke.ValueScopeName=ke.Scope=ke.varKinds=ke.UsedValueState=void 0;var Ne=Li(),Vc=class Vc extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};o(Vc,"ValueError");var Fc=Vc,ys;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ys||(ke.UsedValueState=ys={}));ke.varKinds={const:new Ne.Name("const"),let:new Ne.Name("let"),var:new Ne.Name("var")};var Bc=class Bc{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ne.Name?t:this.name(t)}name(t){return new Ne.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};o(Bc,"Scope");var Ss=Bc;ke.Scope=Ss;var Gc=class Gc extends Ne.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Ne._)`.${new Ne.Name(r)}[${n}]`}};o(Gc,"ValueScopeName");var vs=Gc;ke.ValueScopeName=vs;var N2=(0,Ne._)`\n`,Uc=class Uc extends Ss{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?N2:Ne.nil}}get(){return this._scope}name(t){return new vs(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:s}=i,a=(n=r.key)!==null&&n!==void 0?n:r.ref,c=this._values[s];if(c){let f=c.get(a);if(f)return f}else c=this._values[s]=new Map;c.set(a,i);let u=this._scope[s]||(this._scope[s]=[]),l=u.length;return u[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ne._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let s=Ne.nil;for(let a in t){let c=t[a];if(!c)continue;let u=n[a]=n[a]||new Map;c.forEach(l=>{if(u.has(l))return;u.set(l,ys.Started);let f=r(l);if(f){let p=this.opts.es5?ke.varKinds.var:ke.varKinds.const;s=(0,Ne._)`${s}${p} ${l} = ${f};${this.opts._n}`}else if(f=i==null?void 0:i(l))s=(0,Ne._)`${s}${f}${this.opts._n}`;else throw new Fc(l);u.set(l,ys.Completed)})}return s}};o(Uc,"ValueScope");var Hc=Uc;ke.ValueScope=Hc});var C=h(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var M=Li(),st=Zc(),nr=Li();Object.defineProperty(N,"_",{enumerable:!0,get:o(function(){return nr._},"get")});Object.defineProperty(N,"str",{enumerable:!0,get:o(function(){return nr.str},"get")});Object.defineProperty(N,"strConcat",{enumerable:!0,get:o(function(){return nr.strConcat},"get")});Object.defineProperty(N,"nil",{enumerable:!0,get:o(function(){return nr.nil},"get")});Object.defineProperty(N,"getProperty",{enumerable:!0,get:o(function(){return nr.getProperty},"get")});Object.defineProperty(N,"stringify",{enumerable:!0,get:o(function(){return nr.stringify},"get")});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:o(function(){return nr.regexpCode},"get")});Object.defineProperty(N,"Name",{enumerable:!0,get:o(function(){return nr.Name},"get")});var Ps=Zc();Object.defineProperty(N,"Scope",{enumerable:!0,get:o(function(){return Ps.Scope},"get")});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:o(function(){return Ps.ValueScope},"get")});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:o(function(){return Ps.ValueScopeName},"get")});Object.defineProperty(N,"varKinds",{enumerable:!0,get:o(function(){return Ps.varKinds},"get")});N.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var ou=class ou{optimizeNodes(){return this}optimizeNames(t,r){return this}};o(ou,"Node");var Lt=ou,su=class su extends Lt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?st.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Rn(this.rhs,t,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}};o(su,"Def");var zc=su,au=class au extends Lt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof M.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Rn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof M.Name?{}:{...this.lhs.names};return Es(t,this.rhs)}};o(au,"Assign");var bs=au,cu=class cu extends bs{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}};o(cu,"AssignOp");var Kc=cu,uu=class uu extends Lt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}};o(uu,"Label");var Qc=uu,lu=class lu extends Lt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}};o(lu,"Break");var Wc=lu,pu=class pu extends Lt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}};o(pu,"Throw");var Yc=pu,fu=class fu extends Lt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Rn(this.code,t,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}};o(fu,"AnyCode");var Jc=fu,du=class du extends Lt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(t,r)||(k2(t,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Hr(t,r.names),{})}};o(du,"ParentNode");var Fi=du,mu=class mu extends Fi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}};o(mu,"BlockNode");var Ft=mu,hu=class hu extends Fi{};o(hu,"Root");var Xc=hu,gu=class gu extends Ft{};o(gu,"Else");var Cn=gu;Cn.kind="else";var Tn=class Tn extends Ft{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Cn(n):n}if(r)return t===!1?r instanceof Tn?r:r.nodes:this.nodes.length?this:new Tn(ym(t),r instanceof Tn?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Rn(this.condition,t,r),this}get names(){let t=super.names;return Es(t,this.condition),this.else&&Hr(t,this.else.names),t}};o(Tn,"If");var Lr=Tn;Lr.kind="if";var yu=class yu extends Ft{};o(yu,"For");var Fr=yu;Fr.kind="for";var Su=class Su extends Fr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Rn(this.iteration,t,r),this}get names(){return Hr(super.names,this.iteration.names)}};o(Su,"ForLoop");var eu=Su,vu=class vu extends Fr{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?st.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=Es(super.names,this.from);return Es(t,this.to)}};o(vu,"ForRange");var tu=vu,bu=class bu extends Fr{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Rn(this.iterable,t,r),this}get names(){return Hr(super.names,this.iterable.names)}};o(bu,"ForIter");var _s=bu,_u=class _u extends Ft{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};o(_u,"Func");var Hi=_u;Hi.kind="func";var Eu=class Eu extends Fi{render(t){return"return "+super.render(t)}};o(Eu,"Return");var Vi=Eu;Vi.kind="return";var Pu=class Pu extends Ft{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Hr(t,this.catch.names),this.finally&&Hr(t,this.finally.names),t}};o(Pu,"Try");var ru=Pu,Ou=class Ou extends Ft{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};o(Ou,"Catch");var Bi=Ou;Bi.kind="catch";var $u=class $u extends Ft{render(t){return"finally"+super.render(t)}};o($u,"Finally");var Gi=$u;Gi.kind="finally";var xu=class xu{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` `:""},this._extScope=t,this._scope=new st.Scope({parent:t}),this._nodes=[new Xc]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new zc(t,s,n)),s}const(t,r,n){return this._def(st.varKinds.const,t,r,n)}let(t,r,n){return this._def(st.varKinds.let,t,r,n)}var(t,r,n){return this._def(st.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new bs(t,r,n))}add(t,r){return this._leafNode(new Kc(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==M.nil&&this._leafNode(new Jc(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,i));return r.push("}"),new M._Code(r)}if(t,r,n){if(this._blockNode(new Lr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Lr(t))}else(){return this._elseNode(new Cn)}endIf(){return this._endBlockNode(Lr,Cn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new eu(t),r)}forRange(t,r,n,i,s=this.opts.es5?st.varKinds.var:st.varKinds.let){let a=this._scope.toName(t);return this._for(new tu(s,a,r,n),()=>i(a))}forOf(t,r,n,i=st.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let a=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${a}.length`,c=>{this.var(s,(0,M._)`${a}[${c}]`),n(s)})}return this._for(new _s("of",i,s,r),()=>n(s))}forIn(t,r,n,i=this.opts.es5?st.varKinds.var:st.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,M._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new _s("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Fr)}label(t){return this._leafNode(new Qc(t))}break(t){return this._leafNode(new Wc(t))}return(t){let r=new Vi;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Vi)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new ru;if(this._blockNode(i),this.code(t),r){let s=this.name("e");this._currNode=i.catch=new Bi(s),r(s)}return n&&(this._currNode=i.finally=new Gi,this.code(n)),this._endBlockNode(Bi,Gi)}throw(t){return this._leafNode(new Yc(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=M.nil,n,i){return this._blockNode(new Hi(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Hi)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Lr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};o(xu,"CodeGen");var nu=xu;N.CodeGen=nu;function Hr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}o(Hr,"addNames");function Es(e,t){return t instanceof M._CodeOrName?Hr(e,t.names):e}o(Es,"addExprNames");function Rn(e,t,r){if(e instanceof M.Name)return n(e);if(!i(e))return e;return new M._Code(e._items.reduce((s,a)=>(a instanceof M.Name&&(a=n(a)),a instanceof M._Code?s.push(...a._items):s.push(a),s),[]));function n(s){let a=r[s.str];return a===void 0||t[s.str]!==1?s:(delete t[s.str],a)}function i(s){return s instanceof M._Code&&s._items.some(a=>a instanceof M.Name&&t[a.str]===1&&r[a.str]!==void 0)}}o(Rn,"optimizeExpr");function k2(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}o(k2,"subtractNames");function ym(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,M._)`!${iu(e)}`}o(ym,"not");N.not=ym;var j2=Sm(N.operators.AND);function q2(...e){return e.reduce(j2)}o(q2,"and");N.and=q2;var M2=Sm(N.operators.OR);function D2(...e){return e.reduce(M2)}o(D2,"or");N.or=D2;function Sm(e){return(t,r)=>t===M.nil?r:r===M.nil?t:(0,M._)`${iu(t)} ${e} ${iu(r)}`}o(Sm,"mappend");function iu(e){return e instanceof M.Name?e:(0,M._)`(${e})`}o(iu,"par")});var q=h(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.checkStrictMode=k.getErrorPath=k.Type=k.useFunc=k.setEvaluated=k.evaluatedPropsToName=k.mergeEvaluated=k.eachItem=k.unescapeJsonPointer=k.escapeJsonPointer=k.escapeFragment=k.unescapeFragment=k.schemaRefOrVal=k.schemaHasRulesButRef=k.schemaHasRules=k.checkUnknownRules=k.alwaysValidSchema=k.toHash=void 0;var U=C(),L2=Li();function F2(e){let t={};for(let r of e)t[r]=!0;return t}o(F2,"toHash");k.toHash=F2;function H2(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(_m(e,t),!Em(t,e.self.RULES.all))}o(H2,"alwaysValidSchema");k.alwaysValidSchema=H2;function _m(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let s in t)i[s]||$m(e,`unknown keyword: "${s}"`)}o(_m,"checkUnknownRules");k.checkUnknownRules=_m;function Em(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}o(Em,"schemaHasRules");k.schemaHasRules=Em;function V2(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}o(V2,"schemaHasRulesButRef");k.schemaHasRulesButRef=V2;function B2({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,U._)`${r}`}return(0,U._)`${e}${t}${(0,U.getProperty)(n)}`}o(B2,"schemaRefOrVal");k.schemaRefOrVal=B2;function G2(e){return Pm(decodeURIComponent(e))}o(G2,"unescapeFragment");k.unescapeFragment=G2;function U2(e){return encodeURIComponent(wu(e))}o(U2,"escapeFragment");k.escapeFragment=U2;function wu(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}o(wu,"escapeJsonPointer");k.escapeJsonPointer=wu;function Pm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}o(Pm,"unescapeJsonPointer");k.unescapeJsonPointer=Pm;function Z2(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}o(Z2,"eachItem");k.eachItem=Z2;function vm({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,s,a,c)=>{let u=a===void 0?s:a instanceof U.Name?(s instanceof U.Name?e(i,s,a):t(i,s,a),a):s instanceof U.Name?(t(i,a,s),s):r(s,a);return c===U.Name&&!(u instanceof U.Name)?n(i,u):u}}o(vm,"makeMergeEvaluated");k.mergeEvaluated={props:vm({mergeNames:o((e,t,r)=>e.if((0,U._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,U._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,U._)`${r} || {}`).code((0,U._)`Object.assign(${r}, ${t})`))}),"mergeNames"),mergeToName:o((e,t,r)=>e.if((0,U._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,U._)`${r} || {}`),Iu(e,r,t))}),"mergeToName"),mergeValues:o((e,t)=>e===!0?!0:{...e,...t},"mergeValues"),resultToName:Om}),items:vm({mergeNames:o((e,t,r)=>e.if((0,U._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,U._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),"mergeNames"),mergeToName:o((e,t,r)=>e.if((0,U._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,U._)`${r} > ${t} ? ${r} : ${t}`)),"mergeToName"),mergeValues:o((e,t)=>e===!0?!0:Math.max(e,t),"mergeValues"),resultToName:o((e,t)=>e.var("items",t),"resultToName")})};function Om(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,U._)`{}`);return t!==void 0&&Iu(e,r,t),r}o(Om,"evaluatedPropsToName");k.evaluatedPropsToName=Om;function Iu(e,t,r){Object.keys(r).forEach(n=>e.assign((0,U._)`${t}${(0,U.getProperty)(n)}`,!0))}o(Iu,"setEvaluated");k.setEvaluated=Iu;var bm={};function z2(e,t){return e.scopeValue("func",{ref:t,code:bm[t.code]||(bm[t.code]=new L2._Code(t.code))})}o(z2,"useFunc");k.useFunc=z2;var Au;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Au||(k.Type=Au={}));function K2(e,t,r){if(e instanceof U.Name){let n=t===Au.Num;return r?n?(0,U._)`"[" + ${e} + "]"`:(0,U._)`"['" + ${e} + "']"`:n?(0,U._)`"/" + ${e}`:(0,U._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,U.getProperty)(e).toString():"/"+wu(e)}o(K2,"getErrorPath");k.getErrorPath=K2;function $m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}o($m,"checkStrictMode");k.checkStrictMode=$m});var Ke=h(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});var ve=C(),Q2={data:new ve.Name("data"),valCxt:new ve.Name("valCxt"),instancePath:new ve.Name("instancePath"),parentData:new ve.Name("parentData"),parentDataProperty:new ve.Name("parentDataProperty"),rootData:new ve.Name("rootData"),dynamicAnchors:new ve.Name("dynamicAnchors"),vErrors:new ve.Name("vErrors"),errors:new ve.Name("errors"),this:new ve.Name("this"),self:new ve.Name("self"),scope:new ve.Name("scope"),json:new ve.Name("json"),jsonPos:new ve.Name("jsonPos"),jsonLen:new ve.Name("jsonLen"),jsonPart:new ve.Name("jsonPart")};Tu.default=Q2});var Ui=h(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.extendErrors=be.resetErrorsCount=be.reportExtraError=be.reportError=be.keyword$DataError=be.keywordError=void 0;var D=C(),Os=q(),Ae=Ke();be.keywordError={message:o(({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`,"message")};be.keyword$DataError={message:o(({keyword:e,schemaType:t})=>t?(0,D.str)`"${e}" keyword must be ${t} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`,"message")};function W2(e,t=be.keywordError,r,n){let{it:i}=e,{gen:s,compositeRule:a,allErrors:c}=i,u=wm(e,t,r);n??(a||c)?xm(s,u):Am(i,(0,D._)`[${u}]`)}o(W2,"reportError");be.reportError=W2;function Y2(e,t=be.keywordError,r){let{it:n}=e,{gen:i,compositeRule:s,allErrors:a}=n,c=wm(e,t,r);xm(i,c),s||a||Am(n,Ae.default.vErrors)}o(Y2,"reportExtraError");be.reportExtraError=Y2;function J2(e,t){e.assign(Ae.default.errors,t),e.if((0,D._)`${Ae.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,D._)`${Ae.default.vErrors}.length`,t),()=>e.assign(Ae.default.vErrors,null)))}o(J2,"resetErrorsCount");be.resetErrorsCount=J2;function X2({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",i,Ae.default.errors,c=>{e.const(a,(0,D._)`${Ae.default.vErrors}[${c}]`),e.if((0,D._)`${a}.instancePath === undefined`,()=>e.assign((0,D._)`${a}.instancePath`,(0,D.strConcat)(Ae.default.instancePath,s.errorPath))),e.assign((0,D._)`${a}.schemaPath`,(0,D.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,D._)`${a}.schema`,r),e.assign((0,D._)`${a}.data`,n))})}o(X2,"extendErrors");be.extendErrors=X2;function xm(e,t){let r=e.const("err",t);e.if((0,D._)`${Ae.default.vErrors} === null`,()=>e.assign(Ae.default.vErrors,(0,D._)`[${r}]`),(0,D._)`${Ae.default.vErrors}.push(${r})`),e.code((0,D._)`${Ae.default.errors}++`)}o(xm,"addError");function Am(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,D._)`new ${e.ValidationError}(${t})`):(r.assign((0,D._)`${n}.errors`,t),r.return(!1))}o(Am,"returnErrors");var Vr={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function wm(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,D._)`{}`:eO(e,t,r)}o(wm,"errorObjectCode");function eO(e,t,r={}){let{gen:n,it:i}=e,s=[tO(i,r),rO(e,r)];return nO(e,t,s),n.object(...s)}o(eO,"errorObject");function tO({errorPath:e},{instancePath:t}){let r=t?(0,D.str)`${e}${(0,Os.getErrorPath)(t,Os.Type.Str)}`:e;return[Ae.default.instancePath,(0,D.strConcat)(Ae.default.instancePath,r)]}o(tO,"errorInstancePath");function rO({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,D.str)`${t}/${e}`;return r&&(i=(0,D.str)`${i}${(0,Os.getErrorPath)(r,Os.Type.Str)}`),[Vr.schemaPath,i]}o(rO,"errorSchemaPath");function nO(e,{params:t,message:r},n){let{keyword:i,data:s,schemaValue:a,it:c}=e,{opts:u,propertyName:l,topSchemaRef:f,schemaPath:p}=c;n.push([Vr.keyword,i],[Vr.params,typeof t=="function"?t(e):t||(0,D._)`{}`]),u.messages&&n.push([Vr.message,typeof r=="function"?r(e):r]),u.verbose&&n.push([Vr.schema,a],[Vr.parentSchema,(0,D._)`${f}${p}`],[Ae.default.data,s]),l&&n.push([Vr.propertyName,l])}o(nO,"extraErrorProps")});var Tm=h(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.boolOrEmptySchema=Nn.topBoolOrEmptySchema=void 0;var iO=Ui(),oO=C(),sO=Ke(),aO={message:"boolean schema is false"};function cO(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Im(e,!1):typeof r=="object"&&r.$async===!0?t.return(sO.default.data):(t.assign((0,oO._)`${n}.errors`,null),t.return(!0))}o(cO,"topBoolOrEmptySchema");Nn.topBoolOrEmptySchema=cO;function uO(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Im(e)):r.var(t,!0)}o(uO,"boolOrEmptySchema");Nn.boolOrEmptySchema=uO;function Im(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,iO.reportError)(i,aO,void 0,t)}o(Im,"falseSchemaError")});var Cu=h(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.getRules=kn.isJSONType=void 0;var lO=["string","number","integer","boolean","null","object","array"],pO=new Set(lO);function fO(e){return typeof e=="string"&&pO.has(e)}o(fO,"isJSONType");kn.isJSONType=fO;function dO(){let 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:{}}}o(dO,"getRules");kn.getRules=dO});var Ru=h(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.shouldUseRule=ir.shouldUseGroup=ir.schemaHasRulesForType=void 0;function mO({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Cm(e,n)}o(mO,"schemaHasRulesForType");ir.schemaHasRulesForType=mO;function Cm(e,t){return t.rules.some(r=>Rm(e,r))}o(Cm,"shouldUseGroup");ir.shouldUseGroup=Cm;function Rm(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))}o(Rm,"shouldUseRule");ir.shouldUseRule=Rm});var Zi=h(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var hO=Cu(),gO=Ru(),yO=Ui(),R=C(),Nm=q(),jn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(jn||(_e.DataType=jn={}));function SO(e){let t=km(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}o(SO,"getSchemaTypes");_e.getSchemaTypes=SO;function km(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(hO.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}o(km,"getJSONTypes");_e.getJSONTypes=km;function vO(e,t){let{gen:r,data:n,opts:i}=e,s=bO(t,i.coerceTypes),a=t.length>0&&!(s.length===0&&t.length===1&&(0,gO.schemaHasRulesForType)(e,t[0]));if(a){let c=ku(t,n,i.strictNumbers,jn.Wrong);r.if(c,()=>{s.length?_O(e,t,s):ju(e)})}return a}o(vO,"coerceAndCheckDataType");_e.coerceAndCheckDataType=vO;var jm=new Set(["string","number","integer","boolean","null"]);function bO(e,t){return t?e.filter(r=>jm.has(r)||t==="array"&&r==="array"):[]}o(bO,"coerceToTypes");function _O(e,t,r){let{gen:n,data:i,opts:s}=e,a=n.let("dataType",(0,R._)`typeof ${i}`),c=n.let("coerced",(0,R._)`undefined`);s.coerceTypes==="array"&&n.if((0,R._)`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,R._)`${i}[0]`).assign(a,(0,R._)`typeof ${i}`).if(ku(t,i,s.strictNumbers),()=>n.assign(c,i))),n.if((0,R._)`${c} !== undefined`);for(let l of r)(jm.has(l)||l==="array"&&s.coerceTypes==="array")&&u(l);n.else(),ju(e),n.endIf(),n.if((0,R._)`${c} !== undefined`,()=>{n.assign(i,c),EO(e,c)});function u(l){switch(l){case"string":n.elseIf((0,R._)`${a} == "number" || ${a} == "boolean"`).assign(c,(0,R._)`"" + ${i}`).elseIf((0,R._)`${i} === null`).assign(c,(0,R._)`""`);return;case"number":n.elseIf((0,R._)`${a} == "boolean" || ${i} === null || (${a} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,R._)`+${i}`);return;case"integer":n.elseIf((0,R._)`${a} === "boolean" || ${i} === null || (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,R._)`+${i}`);return;case"boolean":n.elseIf((0,R._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf((0,R._)`${i} === "true" || ${i} === 1`).assign(c,!0);return;case"null":n.elseIf((0,R._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(c,null);return;case"array":n.elseIf((0,R._)`${a} === "string" || ${a} === "number" || ${a} === "boolean" || ${i} === null`).assign(c,(0,R._)`[${i}]`)}}o(u,"coerceSpecificType")}o(_O,"coerceData");function EO({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,R._)`${t} !== undefined`,()=>e.assign((0,R._)`${t}[${r}]`,n))}o(EO,"assignParentData");function Nu(e,t,r,n=jn.Correct){let i=n===jn.Correct?R.operators.EQ:R.operators.NEQ,s;switch(e){case"null":return(0,R._)`${t} ${i} null`;case"array":s=(0,R._)`Array.isArray(${t})`;break;case"object":s=(0,R._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a((0,R._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return(0,R._)`typeof ${t} ${i} ${e}`}return n===jn.Correct?s:(0,R.not)(s);function a(c=R.nil){return(0,R.and)((0,R._)`typeof ${t} == "number"`,c,r?(0,R._)`isFinite(${t})`:R.nil)}}o(Nu,"checkDataType");_e.checkDataType=Nu;function ku(e,t,r,n){if(e.length===1)return Nu(e[0],t,r,n);let i,s=(0,Nm.toHash)(e);if(s.array&&s.object){let a=(0,R._)`typeof ${t} != "object"`;i=s.null?a:(0,R._)`!${t} || ${a}`,delete s.null,delete s.array,delete s.object}else i=R.nil;s.number&&delete s.integer;for(let a in s)i=(0,R.and)(i,Nu(a,t,r,n));return i}o(ku,"checkDataTypes");_e.checkDataTypes=ku;var PO={message:o(({schema:e})=>`must be ${e}`,"message"),params:o(({schema:e,schemaValue:t})=>typeof e=="string"?(0,R._)`{type: ${e}}`:(0,R._)`{type: ${t}}`,"params")};function ju(e){let t=OO(e);(0,yO.reportError)(t,PO)}o(ju,"reportTypeError");_e.reportTypeError=ju;function OO(e){let{gen:t,data:r,schema:n}=e,i=(0,Nm.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}o(OO,"getTypeErrorContext")});var Mm=h($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.assignDefaults=void 0;var qn=C(),$O=q();function xO(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)qm(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,s)=>qm(e,s,i.default))}o(xO,"assignDefaults");$s.assignDefaults=xO;function qm(e,t,r){let{gen:n,compositeRule:i,data:s,opts:a}=e;if(r===void 0)return;let c=(0,qn._)`${s}${(0,qn.getProperty)(t)}`;if(i){(0,$O.checkStrictMode)(e,`default is ignored for: ${c}`);return}let u=(0,qn._)`${c} === undefined`;a.useDefaults==="empty"&&(u=(0,qn._)`${u} || ${c} === null || ${c} === ""`),n.if(u,(0,qn._)`${c} = ${(0,qn.stringify)(r)}`)}o(qm,"assignDefault")});var Qe=h(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.validateUnion=G.validateArray=G.usePattern=G.callValidateCode=G.schemaProperties=G.allSchemaProperties=G.noPropertyInData=G.propertyInData=G.isOwnProperty=G.hasPropFunc=G.reportMissingProp=G.checkMissingProp=G.checkReportMissingProp=void 0;var Z=C(),qu=q(),or=Ke(),AO=q();function wO(e,t){let{gen:r,data:n,it:i}=e;r.if(Du(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Z._)`${t}`},!0),e.error()})}o(wO,"checkReportMissingProp");G.checkReportMissingProp=wO;function IO({gen:e,data:t,it:{opts:r}},n,i){return(0,Z.or)(...n.map(s=>(0,Z.and)(Du(e,t,s,r.ownProperties),(0,Z._)`${i} = ${s}`)))}o(IO,"checkMissingProp");G.checkMissingProp=IO;function TO(e,t){e.setParams({missingProperty:t},!0),e.error()}o(TO,"reportMissingProp");G.reportMissingProp=TO;function Dm(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Z._)`Object.prototype.hasOwnProperty`})}o(Dm,"hasPropFunc");G.hasPropFunc=Dm;function Mu(e,t,r){return(0,Z._)`${Dm(e)}.call(${t}, ${r})`}o(Mu,"isOwnProperty");G.isOwnProperty=Mu;function CO(e,t,r,n){let i=(0,Z._)`${t}${(0,Z.getProperty)(r)} !== undefined`;return n?(0,Z._)`${i} && ${Mu(e,t,r)}`:i}o(CO,"propertyInData");G.propertyInData=CO;function Du(e,t,r,n){let i=(0,Z._)`${t}${(0,Z.getProperty)(r)} === undefined`;return n?(0,Z.or)(i,(0,Z.not)(Mu(e,t,r))):i}o(Du,"noPropertyInData");G.noPropertyInData=Du;function Lm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}o(Lm,"allSchemaProperties");G.allSchemaProperties=Lm;function RO(e,t){return Lm(t).filter(r=>!(0,qu.alwaysValidSchema)(e,t[r]))}o(RO,"schemaProperties");G.schemaProperties=RO;function NO({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:a},c,u,l){let f=l?(0,Z._)`${e}, ${t}, ${n}${i}`:t,p=[[or.default.instancePath,(0,Z.strConcat)(or.default.instancePath,s)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&p.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let d=(0,Z._)`${f}, ${r.object(...p)}`;return u!==Z.nil?(0,Z._)`${c}.call(${u}, ${d})`:(0,Z._)`${c}(${d})`}o(NO,"callValidateCode");G.callValidateCode=NO;var kO=(0,Z._)`new RegExp`;function jO({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,s=i(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Z._)`${i.code==="new RegExp"?kO:(0,AO.useFunc)(e,i)}(${r}, ${n})`})}o(jO,"usePattern");G.usePattern=jO;function qO(e){let{gen:t,data:r,keyword:n,it:i}=e,s=t.name("valid");if(i.allErrors){let c=t.let("valid",!0);return a(()=>t.assign(c,!1)),c}return t.var(s,!0),a(()=>t.break()),s;function a(c){let u=t.const("len",(0,Z._)`${r}.length`);t.forRange("i",0,u,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:qu.Type.Num},s),t.if((0,Z.not)(s),c)})}o(a,"validateItems")}o(qO,"validateArray");G.validateArray=qO;function MO(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,qu.alwaysValidSchema)(i,u))&&!i.opts.unevaluated)return;let a=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((u,l)=>{let f=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},c);t.assign(a,(0,Z._)`${a} || ${c}`),e.mergeValidEvaluated(f,c)||t.if((0,Z.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}o(MO,"validateUnion");G.validateUnion=MO});var Vm=h(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.validateKeywordUsage=vt.validSchemaType=vt.funcKeywordCode=vt.macroKeywordCode=void 0;var we=C(),Br=Ke(),DO=Qe(),LO=Ui();function FO(e,t){let{gen:r,keyword:n,schema:i,parentSchema:s,it:a}=e,c=t.macro.call(a.self,i,s,a),u=Hm(r,n,c);a.opts.validateSchema!==!1&&a.self.validateSchema(c,!0);let l=r.name("valid");e.subschema({schema:c,schemaPath:we.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}o(FO,"macroKeywordCode");vt.macroKeywordCode=FO;function HO(e,t){var r;let{gen:n,keyword:i,schema:s,parentSchema:a,$data:c,it:u}=e;BO(u,t);let l=!c&&t.compile?t.compile.call(u.self,s,a,u):t.validate,f=Hm(n,i,l),p=n.let("valid");e.block$data(p,d),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function d(){if(t.errors===!1)y(),t.modifying&&Fm(e),S(()=>e.error());else{let v=t.async?m():g();t.modifying&&Fm(e),S(()=>VO(e,v))}}o(d,"validateKeyword");function m(){let v=n.let("ruleErrs",null);return n.try(()=>y((0,we._)`await `),b=>n.assign(p,!1).if((0,we._)`${b} instanceof ${u.ValidationError}`,()=>n.assign(v,(0,we._)`${b}.errors`),()=>n.throw(b))),v}o(m,"validateAsync");function g(){let v=(0,we._)`${f}.errors`;return n.assign(v,null),y(we.nil),v}o(g,"validateSync");function y(v=t.async?(0,we._)`await `:we.nil){let b=u.opts.passContext?Br.default.this:Br.default.self,E=!("compile"in t&&!c||t.schema===!1);n.assign(p,(0,we._)`${v}${(0,DO.callValidateCode)(e,f,b,E)}`,t.modifying)}o(y,"assignValid");function S(v){var b;n.if((0,we.not)((b=t.valid)!==null&&b!==void 0?b:p),v)}o(S,"reportErrs")}o(HO,"funcKeywordCode");vt.funcKeywordCode=HO;function Fm(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,we._)`${n.parentData}[${n.parentDataProperty}]`))}o(Fm,"modifyData");function VO(e,t){let{gen:r}=e;r.if((0,we._)`Array.isArray(${t})`,()=>{r.assign(Br.default.vErrors,(0,we._)`${Br.default.vErrors} === null ? ${t} : ${Br.default.vErrors}.concat(${t})`).assign(Br.default.errors,(0,we._)`${Br.default.vErrors}.length`),(0,LO.extendErrors)(e)},()=>e.error())}o(VO,"addErrs");function BO({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}o(BO,"checkAsyncKeyword");function Hm(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,we.stringify)(r)})}o(Hm,"useKeyword");function GO(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")}o(GO,"validSchemaType");vt.validSchemaType=GO;function UO({schema:e,opts:t,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let a=i.dependencies;if(a!=null&&a.some(c=>!Object.prototype.hasOwnProperty.call(e,c)))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}o(UO,"validateKeywordUsage");vt.validateKeywordUsage=UO});var Gm=h(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.extendSubschemaMode=sr.extendSubschemaData=sr.getSubschema=void 0;var bt=C(),Bm=q();function ZO(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let c=e.schema[t];return r===void 0?{schema:c,schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:c[r],schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Bm.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:a,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}o(ZO,"getSubschema");sr.getSubschema=ZO;function zO(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:a}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and