jaz-clio 9.4.3 → 9.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/skills/api/SKILL.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jaz-kit/SKILL.md +1 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +2 -2
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -222,7 +222,7 @@ ${n.count} ${n.noun} ${n.is} pending:
|
|
|
222
222
|
${t.format(r)}
|
|
223
223
|
`.trim())}};P0e.exports=F5});var pQ=I((iPr,j0e)=>{"use strict";var U0e=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:_Dt}=xr(),wDt=Bb();q0e()===void 0&&$0e(new wDt);function $0e(e){if(!e||typeof e.dispatch!="function")throw new _Dt("Argument agent must implement Agent");Object.defineProperty(globalThis,U0e,{value:e,writable:!0,enumerable:!1,configurable:!1})}function q0e(){return globalThis[U0e]}j0e.exports={setGlobalDispatcher:$0e,getGlobalDispatcher:q0e}});var hQ=I((sPr,Y0e)=>{"use strict";Y0e.exports=class{#e;constructor(t){if(typeof t!="object"||t===null)throw new TypeError("handler must be an object");this.#e=t}onConnect(...t){return this.#e.onConnect?.(...t)}onError(...t){return this.#e.onError?.(...t)}onUpgrade(...t){return this.#e.onUpgrade?.(...t)}onResponseStarted(...t){return this.#e.onResponseStarted?.(...t)}onHeaders(...t){return this.#e.onHeaders?.(...t)}onData(...t){return this.#e.onData?.(...t)}onComplete(...t){return this.#e.onComplete?.(...t)}onBodySent(...t){return this.#e.onBodySent?.(...t)}}});var z0e=I((aPr,H0e)=>{"use strict";var vDt=z1();H0e.exports=e=>{let t=e?.maxRedirections;return r=>function(i,o){let{maxRedirections:s=t,...a}=i;if(!s)return r(i,o);let c=new vDt(r,s,i,o);return r(a,c)}}});var G0e=I((cPr,J0e)=>{"use strict";var SDt=nQ();J0e.exports=e=>t=>function(n,i){return t(n,new SDt({...n,retryOptions:{...e,...n.retryOptions}},{handler:i,dispatch:t}))}});var W0e=I((lPr,V0e)=>{"use strict";var DDt=rr(),{InvalidArgumentError:RDt,RequestAbortedError:TDt}=xr(),xDt=hQ(),Q5=class extends xDt{#e=1024*1024;#t=null;#r=!1;#i=!1;#o=0;#n=null;#a=null;constructor({maxSize:t},r){if(super(r),t!=null&&(!Number.isFinite(t)||t<1))throw new RDt("maxSize must be a number greater than 0");this.#e=t??this.#e,this.#a=r}onConnect(t){this.#t=t,this.#a.onConnect(this.#s.bind(this))}#s(t){this.#i=!0,this.#n=t}onHeaders(t,r,n,i){let s=DDt.parseHeaders(r)["content-length"];if(s!=null&&s>this.#e)throw new TDt(`Response size (${s}) larger than maxSize (${this.#e})`);return this.#i?!0:this.#a.onHeaders(t,r,n,i)}onError(t){this.#r||(t=this.#n??t,this.#a.onError(t))}onData(t){return this.#o=this.#o+t.length,this.#o>=this.#e&&(this.#r=!0,this.#i?this.#a.onError(this.#n):this.#a.onComplete([])),!0}onComplete(t){if(!this.#r){if(this.#i){this.#a.onError(this.reason);return}this.#a.onComplete(t)}}};function kDt({maxSize:e}={maxSize:1024*1024}){return t=>function(n,i){let{dumpMaxSize:o=e}=n,s=new Q5({maxSize:o},i);return t(n,s)}}V0e.exports=kDt});var X0e=I((uPr,Z0e)=>{"use strict";var{isIP:BDt}=z("node:net"),{lookup:NDt}=z("node:dns"),ODt=hQ(),{InvalidArgumentError:qb,InformationalError:FDt}=xr(),K0e=Math.pow(2,31)-1,L5=class{#e=0;#t=0;#r=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(t){this.#e=t.maxTTL,this.#t=t.maxItems,this.dualStack=t.dualStack,this.affinity=t.affinity,this.lookup=t.lookup??this.#i,this.pick=t.pick??this.#o}get full(){return this.#r.size===this.#t}runLookup(t,r,n){let i=this.#r.get(t.hostname);if(i==null&&this.full){n(null,t.origin);return}let o={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...r.dns,maxTTL:this.#e,maxItems:this.#t};if(i==null)this.lookup(t,o,(s,a)=>{if(s||a==null||a.length===0){n(s??new FDt("No DNS entries found"));return}this.setRecords(t,a);let c=this.#r.get(t.hostname),u=this.pick(t,c,o.affinity),d;typeof u.port=="number"?d=`:${u.port}`:t.port!==""?d=`:${t.port}`:d="",n(null,`${t.protocol}//${u.family===6?`[${u.address}]`:u.address}${d}`)});else{let s=this.pick(t,i,o.affinity);if(s==null){this.#r.delete(t.hostname),this.runLookup(t,r,n);return}let a;typeof s.port=="number"?a=`:${s.port}`:t.port!==""?a=`:${t.port}`:a="",n(null,`${t.protocol}//${s.family===6?`[${s.address}]`:s.address}${a}`)}}#i(t,r,n){NDt(t.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(i,o)=>{if(i)return n(i);let s=new Map;for(let a of o)s.set(`${a.address}:${a.family}`,a);n(null,s.values())})}#o(t,r,n){let i=null,{records:o,offset:s}=r,a;if(this.dualStack?(n==null&&(s==null||s===K0e?(r.offset=0,n=4):(r.offset++,n=(r.offset&1)===1?6:4)),o[n]!=null&&o[n].ips.length>0?a=o[n]:a=o[n===4?6:4]):a=o[n],a==null||a.ips.length===0)return i;a.offset==null||a.offset===K0e?a.offset=0:a.offset++;let c=a.offset%a.ips.length;return i=a.ips[c]??null,i==null?i:Date.now()-i.timestamp>i.ttl?(a.ips.splice(c,1),this.pick(t,r,n)):i}setRecords(t,r){let n=Date.now(),i={records:{4:null,6:null}};for(let o of r){o.timestamp=n,typeof o.ttl=="number"?o.ttl=Math.min(o.ttl,this.#e):o.ttl=this.#e;let s=i.records[o.family]??{ips:[]};s.ips.push(o),i.records[o.family]=s}this.#r.set(t.hostname,i)}getHandler(t,r){return new P5(this,t,r)}},P5=class extends ODt{#e=null;#t=null;#r=null;#i=null;#o=null;constructor(t,{origin:r,handler:n,dispatch:i},o){super(n),this.#o=r,this.#i=n,this.#t={...o},this.#e=t,this.#r=i}onError(t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#o,this.#t,(r,n)=>{if(r)return this.#i.onError(r);let i={...this.#t,origin:n};this.#r(i,this)});return}this.#i.onError(t);return}case"ENOTFOUND":this.#e.deleteRecord(this.#o);default:this.#i.onError(t);break}}};Z0e.exports=e=>{if(e?.maxTTL!=null&&(typeof e?.maxTTL!="number"||e?.maxTTL<0))throw new qb("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&(typeof e?.maxItems!="number"||e?.maxItems<1))throw new qb("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new qb("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&typeof e?.dualStack!="boolean")throw new qb("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&typeof e?.lookup!="function")throw new qb("Invalid lookup. Must be a function");if(e?.pick!=null&&typeof e?.pick!="function")throw new qb("Invalid pick. Must be a function");let t=e?.dualStack??!0,r;t?r=e?.affinity??null:r=e?.affinity??4;let n={maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:t,affinity:r,maxItems:e?.maxItems??1/0},i=new L5(n);return o=>function(a,c){let u=a.origin.constructor===URL?a.origin:new URL(a.origin);return BDt(u.hostname)!==0?o(a,c):(i.runLookup(u,a,(d,f)=>{if(d)return c.onError(d);let p=null;p={...a,servername:u.hostname,origin:f,headers:{host:u.hostname,...a.headers}},o(p,i.getHandler({origin:u,dispatch:o,handler:c},a))}),!0)}}});var qA=I((dPr,sSe)=>{"use strict";var{kConstruct:QDt}=qn(),{kEnumerableProperty:jb}=rr(),{iteratorMixin:LDt,isValidHeaderName:V0,isValidHeaderValue:tSe}=ka(),{webidl:vr}=Lo(),M5=z("node:assert"),mQ=z("node:util"),ji=Symbol("headers map"),Fa=Symbol("headers map sorted");function eSe(e){return e===10||e===13||e===9||e===32}function rSe(e){let t=0,r=e.length;for(;r>t&&eSe(e.charCodeAt(r-1));)--r;for(;r>t&&eSe(e.charCodeAt(t));)++t;return t===0&&r===e.length?e:e.substring(t,r)}function nSe(e,t){if(Array.isArray(t))for(let r=0;r<t.length;++r){let n=t[r];if(n.length!==2)throw vr.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${n.length}.`});U5(e,n[0],n[1])}else if(typeof t=="object"&&t!==null){let r=Object.keys(t);for(let n=0;n<r.length;++n)U5(e,r[n],t[r[n]])}else throw vr.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function U5(e,t,r){if(r=rSe(r),V0(t)){if(!tSe(r))throw vr.errors.invalidArgument({prefix:"Headers.append",value:r,type:"header value"})}else throw vr.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(oSe(e)==="immutable")throw new TypeError("immutable");return $5(e).append(t,r,!1)}function iSe(e,t){return e[0]<t[0]?-1:1}var AQ=class e{cookies=null;constructor(t){t instanceof e?(this[ji]=new Map(t[ji]),this[Fa]=t[Fa],this.cookies=t.cookies===null?null:[...t.cookies]):(this[ji]=new Map(t),this[Fa]=null)}contains(t,r){return this[ji].has(r?t:t.toLowerCase())}clear(){this[ji].clear(),this[Fa]=null,this.cookies=null}append(t,r,n){this[Fa]=null;let i=n?t:t.toLowerCase(),o=this[ji].get(i);if(o){let s=i==="cookie"?"; ":", ";this[ji].set(i,{name:o.name,value:`${o.value}${s}${r}`})}else this[ji].set(i,{name:t,value:r});i==="set-cookie"&&(this.cookies??=[]).push(r)}set(t,r,n){this[Fa]=null;let i=n?t:t.toLowerCase();i==="set-cookie"&&(this.cookies=[r]),this[ji].set(i,{name:t,value:r})}delete(t,r){this[Fa]=null,r||(t=t.toLowerCase()),t==="set-cookie"&&(this.cookies=null),this[ji].delete(t)}get(t,r){return this[ji].get(r?t:t.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:t,1:{value:r}}of this[ji])yield[t,r]}get entries(){let t={};if(this[ji].size!==0)for(let{name:r,value:n}of this[ji].values())t[r]=n;return t}rawValues(){return this[ji].values()}get entriesList(){let t=[];if(this[ji].size!==0)for(let{0:r,1:{name:n,value:i}}of this[ji])if(r==="set-cookie")for(let o of this.cookies)t.push([n,o]);else t.push([n,i]);return t}toSortedArray(){let t=this[ji].size,r=new Array(t);if(t<=32){if(t===0)return r;let n=this[ji][Symbol.iterator](),i=n.next().value;r[0]=[i[0],i[1].value],M5(i[1].value!==null);for(let o=1,s=0,a=0,c=0,u=0,d,f;o<t;++o){for(f=n.next().value,d=r[o]=[f[0],f[1].value],M5(d[1]!==null),c=0,a=o;c<a;)u=c+(a-c>>1),r[u][0]<=d[0]?c=u+1:a=u;if(o!==u){for(s=o;s>c;)r[s]=r[--s];r[c]=d}}if(!n.next().done)throw new TypeError("Unreachable");return r}else{let n=0;for(let{0:i,1:{value:o}}of this[ji])r[n++]=[i,o],M5(o!==null);return r.sort(iSe)}}},gl=class e{#e;#t;constructor(t=void 0){vr.util.markAsUncloneable(this),t!==QDt&&(this.#t=new AQ,this.#e="none",t!==void 0&&(t=vr.converters.HeadersInit(t,"Headers contructor","init"),nSe(this,t)))}append(t,r){vr.brandCheck(this,e),vr.argumentLengthCheck(arguments,2,"Headers.append");let n="Headers.append";return t=vr.converters.ByteString(t,n,"name"),r=vr.converters.ByteString(r,n,"value"),U5(this,t,r)}delete(t){if(vr.brandCheck(this,e),vr.argumentLengthCheck(arguments,1,"Headers.delete"),t=vr.converters.ByteString(t,"Headers.delete","name"),!V0(t))throw vr.errors.invalidArgument({prefix:"Headers.delete",value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(t,!1)&&this.#t.delete(t,!1)}get(t){vr.brandCheck(this,e),vr.argumentLengthCheck(arguments,1,"Headers.get");let r="Headers.get";if(t=vr.converters.ByteString(t,r,"name"),!V0(t))throw vr.errors.invalidArgument({prefix:r,value:t,type:"header name"});return this.#t.get(t,!1)}has(t){vr.brandCheck(this,e),vr.argumentLengthCheck(arguments,1,"Headers.has");let r="Headers.has";if(t=vr.converters.ByteString(t,r,"name"),!V0(t))throw vr.errors.invalidArgument({prefix:r,value:t,type:"header name"});return this.#t.contains(t,!1)}set(t,r){vr.brandCheck(this,e),vr.argumentLengthCheck(arguments,2,"Headers.set");let n="Headers.set";if(t=vr.converters.ByteString(t,n,"name"),r=vr.converters.ByteString(r,n,"value"),r=rSe(r),V0(t)){if(!tSe(r))throw vr.errors.invalidArgument({prefix:n,value:r,type:"header value"})}else throw vr.errors.invalidArgument({prefix:n,value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(t,r,!1)}getSetCookie(){vr.brandCheck(this,e);let t=this.#t.cookies;return t?[...t]:[]}get[Fa](){if(this.#t[Fa])return this.#t[Fa];let t=[],r=this.#t.toSortedArray(),n=this.#t.cookies;if(n===null||n.length===1)return this.#t[Fa]=r;for(let i=0;i<r.length;++i){let{0:o,1:s}=r[i];if(o==="set-cookie")for(let a=0;a<n.length;++a)t.push([o,n[a]]);else t.push([o,s])}return this.#t[Fa]=t}[mQ.inspect.custom](t,r){return r.depth??=t,`Headers ${mQ.formatWithOptions(r,this.#t.entries)}`}static getHeadersGuard(t){return t.#e}static setHeadersGuard(t,r){t.#e=r}static getHeadersList(t){return t.#t}static setHeadersList(t,r){t.#t=r}},{getHeadersGuard:oSe,setHeadersGuard:PDt,getHeadersList:$5,setHeadersList:MDt}=gl;Reflect.deleteProperty(gl,"getHeadersGuard");Reflect.deleteProperty(gl,"setHeadersGuard");Reflect.deleteProperty(gl,"getHeadersList");Reflect.deleteProperty(gl,"setHeadersList");LDt("Headers",gl,Fa,0,1);Object.defineProperties(gl.prototype,{append:jb,delete:jb,get:jb,has:jb,set:jb,getSetCookie:jb,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[mQ.inspect.custom]:{enumerable:!1}});vr.converters.HeadersInit=function(e,t,r){if(vr.util.Type(e)==="Object"){let n=Reflect.get(e,Symbol.iterator);if(!mQ.types.isProxy(e)&&n===gl.prototype.entries)try{return $5(e).entriesList}catch{}return typeof n=="function"?vr.converters["sequence<sequence<ByteString>>"](e,t,r,n.bind(e)):vr.converters["record<ByteString, ByteString>"](e,t,r)}throw vr.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};sSe.exports={fill:nSe,compareHeaderName:iSe,Headers:gl,HeadersList:AQ,getHeadersGuard:oSe,setHeadersGuard:PDt,setHeadersList:MDt,getHeadersList:$5}});var K0=I((fPr,ySe)=>{"use strict";var{Headers:fSe,HeadersList:aSe,fill:UDt,getHeadersGuard:$Dt,setHeadersGuard:pSe,setHeadersList:hSe}=qA(),{extractBody:cSe,cloneBody:qDt,mixinBody:jDt,hasFinalizationRegistry:mSe,streamRegistry:ASe,bodyUnusable:YDt}=_b(),q5=rr(),lSe=z("node:util"),{kEnumerableProperty:Qa}=q5,{isValidReasonPhrase:HDt,isCancelled:zDt,isAborted:JDt,isBlobLike:GDt,serializeJavascriptValueToJSONString:VDt,isErrorLike:WDt,isomorphicEncode:KDt,environmentSettingsObject:ZDt}=ka(),{redirectStatusSet:XDt,nullBodyStatus:eRt}=b0(),{kState:Yn,kHeaders:qd}=yp(),{webidl:Ht}=Lo(),{FormData:tRt}=S0(),{URLSerializer:uSe}=na(),{kConstruct:yQ}=qn(),j5=z("node:assert"),{types:rRt}=z("node:util"),nRt=new TextEncoder("utf-8"),jA=class e{static error(){return W0(EQ(),"immutable")}static json(t,r={}){Ht.argumentLengthCheck(arguments,1,"Response.json"),r!==null&&(r=Ht.converters.ResponseInit(r));let n=nRt.encode(VDt(t)),i=cSe(n),o=W0(Yb({}),"response");return dSe(o,r,{body:i[0],type:"application/json"}),o}static redirect(t,r=302){Ht.argumentLengthCheck(arguments,1,"Response.redirect"),t=Ht.converters.USVString(t),r=Ht.converters["unsigned short"](r);let n;try{n=new URL(t,ZDt.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${t}`,{cause:s})}if(!XDt.has(r))throw new RangeError(`Invalid status code ${r}`);let i=W0(Yb({}),"immutable");i[Yn].status=r;let o=KDt(uSe(n));return i[Yn].headersList.append("location",o,!0),i}constructor(t=null,r={}){if(Ht.util.markAsUncloneable(this),t===yQ)return;t!==null&&(t=Ht.converters.BodyInit(t)),r=Ht.converters.ResponseInit(r),this[Yn]=Yb({}),this[qd]=new fSe(yQ),pSe(this[qd],"response"),hSe(this[qd],this[Yn].headersList);let n=null;if(t!=null){let[i,o]=cSe(t);n={body:i,type:o}}dSe(this,r,n)}get type(){return Ht.brandCheck(this,e),this[Yn].type}get url(){Ht.brandCheck(this,e);let t=this[Yn].urlList,r=t[t.length-1]??null;return r===null?"":uSe(r,!0)}get redirected(){return Ht.brandCheck(this,e),this[Yn].urlList.length>1}get status(){return Ht.brandCheck(this,e),this[Yn].status}get ok(){return Ht.brandCheck(this,e),this[Yn].status>=200&&this[Yn].status<=299}get statusText(){return Ht.brandCheck(this,e),this[Yn].statusText}get headers(){return Ht.brandCheck(this,e),this[qd]}get body(){return Ht.brandCheck(this,e),this[Yn].body?this[Yn].body.stream:null}get bodyUsed(){return Ht.brandCheck(this,e),!!this[Yn].body&&q5.isDisturbed(this[Yn].body.stream)}clone(){if(Ht.brandCheck(this,e),YDt(this))throw Ht.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let t=Y5(this[Yn]);return mSe&&this[Yn].body?.stream&&ASe.register(this,new WeakRef(this[Yn].body.stream)),W0(t,$Dt(this[qd]))}[lSe.inspect.custom](t,r){r.depth===null&&(r.depth=2),r.colors??=!0;let n={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${lSe.formatWithOptions(r,n)}`}};jDt(jA);Object.defineProperties(jA.prototype,{type:Qa,url:Qa,status:Qa,ok:Qa,redirected:Qa,statusText:Qa,headers:Qa,clone:Qa,body:Qa,bodyUsed:Qa,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(jA,{json:Qa,redirect:Qa,error:Qa});function Y5(e){if(e.internalResponse)return gSe(Y5(e.internalResponse),e.type);let t=Yb({...e,body:null});return e.body!=null&&(t.body=qDt(t,e.body)),t}function Yb(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new aSe(e?.headersList):new aSe,urlList:e?.urlList?[...e.urlList]:[]}}function EQ(e){let t=WDt(e);return Yb({type:"error",status:0,error:t?e:new Error(e&&String(e)),aborted:e&&e.name==="AbortError"})}function iRt(e){return e.type==="error"&&e.status===0}function gQ(e,t){return t={internalResponse:e,...t},new Proxy(e,{get(r,n){return n in t?t[n]:r[n]},set(r,n,i){return j5(!(n in t)),r[n]=i,!0}})}function gSe(e,t){if(t==="basic")return gQ(e,{type:"basic",headersList:e.headersList});if(t==="cors")return gQ(e,{type:"cors",headersList:e.headersList});if(t==="opaque")return gQ(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(t==="opaqueredirect")return gQ(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});j5(!1)}function oRt(e,t=null){return j5(zDt(e)),JDt(e)?EQ(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):EQ(Object.assign(new DOMException("Request was cancelled."),{cause:t}))}function dSe(e,t,r){if(t.status!==null&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&t.statusText!=null&&!HDt(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&t.status!=null&&(e[Yn].status=t.status),"statusText"in t&&t.statusText!=null&&(e[Yn].statusText=t.statusText),"headers"in t&&t.headers!=null&&UDt(e[qd],t.headers),r){if(eRt.includes(e.status))throw Ht.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});e[Yn].body=r.body,r.type!=null&&!e[Yn].headersList.contains("content-type",!0)&&e[Yn].headersList.append("content-type",r.type,!0)}}function W0(e,t){let r=new jA(yQ);return r[Yn]=e,r[qd]=new fSe(yQ),hSe(r[qd],e.headersList),pSe(r[qd],t),mSe&&e.body?.stream&&ASe.register(r,new WeakRef(e.body.stream)),r}Ht.converters.ReadableStream=Ht.interfaceConverter(ReadableStream);Ht.converters.FormData=Ht.interfaceConverter(tRt);Ht.converters.URLSearchParams=Ht.interfaceConverter(URLSearchParams);Ht.converters.XMLHttpRequestBodyInit=function(e,t,r){return typeof e=="string"?Ht.converters.USVString(e,t,r):GDt(e)?Ht.converters.Blob(e,t,r,{strict:!1}):ArrayBuffer.isView(e)||rRt.isArrayBuffer(e)?Ht.converters.BufferSource(e,t,r):q5.isFormDataLike(e)?Ht.converters.FormData(e,t,r,{strict:!1}):e instanceof URLSearchParams?Ht.converters.URLSearchParams(e,t,r):Ht.converters.DOMString(e,t,r)};Ht.converters.BodyInit=function(e,t,r){return e instanceof ReadableStream?Ht.converters.ReadableStream(e,t,r):e?.[Symbol.asyncIterator]?e:Ht.converters.XMLHttpRequestBodyInit(e,t,r)};Ht.converters.ResponseInit=Ht.dictionaryConverter([{key:"status",converter:Ht.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:Ht.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:Ht.converters.HeadersInit}]);ySe.exports={isNetworkError:iRt,makeNetworkError:EQ,makeResponse:Yb,makeAppropriateNetworkError:oRt,filterResponse:gSe,Response:jA,cloneResponse:Y5,fromInnerResponse:W0}});var CSe=I((pPr,ISe)=>{"use strict";var{kConnected:ESe,kSize:bSe}=qn(),H5=class{constructor(t){this.value=t}deref(){return this.value[ESe]===0&&this.value[bSe]===0?void 0:this.value}},z5=class{constructor(t){this.finalizer=t}register(t,r){t.on&&t.on("disconnect",()=>{t[ESe]===0&&t[bSe]===0&&this.finalizer(r)})}unregister(t){}};ISe.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:H5,FinalizationRegistry:z5}):{WeakRef,FinalizationRegistry}}});var Hb=I((hPr,LSe)=>{"use strict";var{extractBody:sRt,mixinBody:aRt,cloneBody:cRt,bodyUnusable:_Se}=_b(),{Headers:BSe,fill:lRt,HeadersList:_Q,setHeadersGuard:G5,getHeadersGuard:uRt,setHeadersList:NSe,getHeadersList:wSe}=qA(),{FinalizationRegistry:dRt}=CSe()(),IQ=rr(),vSe=z("node:util"),{isValidHTTPToken:fRt,sameOrigin:SSe,environmentSettingsObject:bQ}=ka(),{forbiddenMethodsSet:pRt,corsSafeListedMethodsSet:hRt,referrerPolicy:mRt,requestRedirect:ARt,requestMode:gRt,requestCredentials:yRt,requestCache:ERt,requestDuplex:bRt}=b0(),{kEnumerableProperty:Yi,normalizedMethodRecordsBase:IRt,normalizedMethodRecords:CRt}=IQ,{kHeaders:La,kSignal:CQ,kState:xn,kDispatcher:J5}=yp(),{webidl:St}=Lo(),{URLSerializer:_Rt}=na(),{kConstruct:wQ}=qn(),wRt=z("node:assert"),{getMaxListeners:DSe,setMaxListeners:RSe,getEventListeners:vRt,defaultMaxListeners:TSe}=z("node:events"),SRt=Symbol("abortController"),OSe=new dRt(({signal:e,abort:t})=>{e.removeEventListener("abort",t)}),vQ=new WeakMap;function xSe(e){return t;function t(){let r=e.deref();if(r!==void 0){OSe.unregister(t),this.removeEventListener("abort",t),r.abort(this.reason);let n=vQ.get(r.signal);if(n!==void 0){if(n.size!==0){for(let i of n){let o=i.deref();o!==void 0&&o.abort(this.reason)}n.clear()}vQ.delete(r.signal)}}}}var kSe=!1,xp=class e{constructor(t,r={}){if(St.util.markAsUncloneable(this),t===wQ)return;let n="Request constructor";St.argumentLengthCheck(arguments,1,n),t=St.converters.RequestInfo(t,n,"input"),r=St.converters.RequestInit(r,n,"init");let i=null,o=null,s=bQ.settingsObject.baseUrl,a=null;if(typeof t=="string"){this[J5]=r.dispatcher;let y;try{y=new URL(t,s)}catch(b){throw new TypeError("Failed to parse URL from "+t,{cause:b})}if(y.username||y.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+t);i=SQ({urlList:[y]}),o="cors"}else this[J5]=r.dispatcher||t[J5],wRt(t instanceof e),i=t[xn],a=t[CQ];let c=bQ.settingsObject.origin,u="client";if(i.window?.constructor?.name==="EnvironmentSettingsObject"&&SSe(i.window,c)&&(u=i.window),r.window!=null)throw new TypeError(`'window' option '${u}' must be null`);"window"in r&&(u="no-window"),i=SQ({method:i.method,headersList:i.headersList,unsafeRequest:i.unsafeRequest,client:bQ.settingsObject,window:u,priority:i.priority,origin:i.origin,referrer:i.referrer,referrerPolicy:i.referrerPolicy,mode:i.mode,credentials:i.credentials,cache:i.cache,redirect:i.redirect,integrity:i.integrity,keepalive:i.keepalive,reloadNavigation:i.reloadNavigation,historyNavigation:i.historyNavigation,urlList:[...i.urlList]});let d=Object.keys(r).length!==0;if(d&&(i.mode==="navigate"&&(i.mode="same-origin"),i.reloadNavigation=!1,i.historyNavigation=!1,i.origin="client",i.referrer="client",i.referrerPolicy="",i.url=i.urlList[i.urlList.length-1],i.urlList=[i.url]),r.referrer!==void 0){let y=r.referrer;if(y==="")i.referrer="no-referrer";else{let b;try{b=new URL(y,s)}catch(E){throw new TypeError(`Referrer "${y}" is not a valid URL.`,{cause:E})}b.protocol==="about:"&&b.hostname==="client"||c&&!SSe(b,bQ.settingsObject.baseUrl)?i.referrer="client":i.referrer=b}}r.referrerPolicy!==void 0&&(i.referrerPolicy=r.referrerPolicy);let f;if(r.mode!==void 0?f=r.mode:f=o,f==="navigate")throw St.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(f!=null&&(i.mode=f),r.credentials!==void 0&&(i.credentials=r.credentials),r.cache!==void 0&&(i.cache=r.cache),i.cache==="only-if-cached"&&i.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(r.redirect!==void 0&&(i.redirect=r.redirect),r.integrity!=null&&(i.integrity=String(r.integrity)),r.keepalive!==void 0&&(i.keepalive=!!r.keepalive),r.method!==void 0){let y=r.method,b=CRt[y];if(b!==void 0)i.method=b;else{if(!fRt(y))throw new TypeError(`'${y}' is not a valid HTTP method.`);let E=y.toUpperCase();if(pRt.has(E))throw new TypeError(`'${y}' HTTP method is unsupported.`);y=IRt[E]??y,i.method=y}!kSe&&i.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),kSe=!0)}r.signal!==void 0&&(a=r.signal),this[xn]=i;let p=new AbortController;if(this[CQ]=p.signal,a!=null){if(!a||typeof a.aborted!="boolean"||typeof a.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(a.aborted)p.abort(a.reason);else{this[SRt]=p;let y=new WeakRef(p),b=xSe(y);try{(typeof DSe=="function"&&DSe(a)===TSe||vRt(a,"abort").length>=TSe)&&RSe(1500,a)}catch{}IQ.addAbortListener(a,b),OSe.register(p,{signal:a,abort:b},b)}}if(this[La]=new BSe(wQ),NSe(this[La],i.headersList),G5(this[La],"request"),f==="no-cors"){if(!hRt.has(i.method))throw new TypeError(`'${i.method} is unsupported in no-cors mode.`);G5(this[La],"request-no-cors")}if(d){let y=wSe(this[La]),b=r.headers!==void 0?r.headers:new _Q(y);if(y.clear(),b instanceof _Q){for(let{name:E,value:C}of b.rawValues())y.append(E,C,!1);y.cookies=b.cookies}else lRt(this[La],b)}let h=t instanceof e?t[xn].body:null;if((r.body!=null||h!=null)&&(i.method==="GET"||i.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let m=null;if(r.body!=null){let[y,b]=sRt(r.body,i.keepalive);m=y,b&&!wSe(this[La]).contains("content-type",!0)&&this[La].append("content-type",b)}let A=m??h;if(A!=null&&A.source==null){if(m!=null&&r.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(i.mode!=="same-origin"&&i.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');i.useCORSPreflightFlag=!0}let g=A;if(m==null&&h!=null){if(_Se(t))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let y=new TransformStream;h.stream.pipeThrough(y),g={source:h.source,length:h.length,stream:y.readable}}this[xn].body=g}get method(){return St.brandCheck(this,e),this[xn].method}get url(){return St.brandCheck(this,e),_Rt(this[xn].url)}get headers(){return St.brandCheck(this,e),this[La]}get destination(){return St.brandCheck(this,e),this[xn].destination}get referrer(){return St.brandCheck(this,e),this[xn].referrer==="no-referrer"?"":this[xn].referrer==="client"?"about:client":this[xn].referrer.toString()}get referrerPolicy(){return St.brandCheck(this,e),this[xn].referrerPolicy}get mode(){return St.brandCheck(this,e),this[xn].mode}get credentials(){return this[xn].credentials}get cache(){return St.brandCheck(this,e),this[xn].cache}get redirect(){return St.brandCheck(this,e),this[xn].redirect}get integrity(){return St.brandCheck(this,e),this[xn].integrity}get keepalive(){return St.brandCheck(this,e),this[xn].keepalive}get isReloadNavigation(){return St.brandCheck(this,e),this[xn].reloadNavigation}get isHistoryNavigation(){return St.brandCheck(this,e),this[xn].historyNavigation}get signal(){return St.brandCheck(this,e),this[CQ]}get body(){return St.brandCheck(this,e),this[xn].body?this[xn].body.stream:null}get bodyUsed(){return St.brandCheck(this,e),!!this[xn].body&&IQ.isDisturbed(this[xn].body.stream)}get duplex(){return St.brandCheck(this,e),"half"}clone(){if(St.brandCheck(this,e),_Se(this))throw new TypeError("unusable");let t=FSe(this[xn]),r=new AbortController;if(this.signal.aborted)r.abort(this.signal.reason);else{let n=vQ.get(this.signal);n===void 0&&(n=new Set,vQ.set(this.signal,n));let i=new WeakRef(r);n.add(i),IQ.addAbortListener(r.signal,xSe(i))}return QSe(t,r.signal,uRt(this[La]))}[vSe.inspect.custom](t,r){r.depth===null&&(r.depth=2),r.colors??=!0;let n={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${vSe.formatWithOptions(r,n)}`}};aRt(xp);function SQ(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new _Q(e.headersList):new _Q}}function FSe(e){let t=SQ({...e,body:null});return e.body!=null&&(t.body=cRt(t,e.body)),t}function QSe(e,t,r){let n=new xp(wQ);return n[xn]=e,n[CQ]=t,n[La]=new BSe(wQ),NSe(n[La],e.headersList),G5(n[La],r),n}Object.defineProperties(xp.prototype,{method:Yi,url:Yi,headers:Yi,redirect:Yi,clone:Yi,signal:Yi,duplex:Yi,destination:Yi,body:Yi,bodyUsed:Yi,isHistoryNavigation:Yi,isReloadNavigation:Yi,keepalive:Yi,integrity:Yi,cache:Yi,credentials:Yi,attribute:Yi,referrerPolicy:Yi,referrer:Yi,mode:Yi,[Symbol.toStringTag]:{value:"Request",configurable:!0}});St.converters.Request=St.interfaceConverter(xp);St.converters.RequestInfo=function(e,t,r){return typeof e=="string"?St.converters.USVString(e,t,r):e instanceof xp?St.converters.Request(e,t,r):St.converters.USVString(e,t,r)};St.converters.AbortSignal=St.interfaceConverter(AbortSignal);St.converters.RequestInit=St.dictionaryConverter([{key:"method",converter:St.converters.ByteString},{key:"headers",converter:St.converters.HeadersInit},{key:"body",converter:St.nullableConverter(St.converters.BodyInit)},{key:"referrer",converter:St.converters.USVString},{key:"referrerPolicy",converter:St.converters.DOMString,allowedValues:mRt},{key:"mode",converter:St.converters.DOMString,allowedValues:gRt},{key:"credentials",converter:St.converters.DOMString,allowedValues:yRt},{key:"cache",converter:St.converters.DOMString,allowedValues:ERt},{key:"redirect",converter:St.converters.DOMString,allowedValues:ARt},{key:"integrity",converter:St.converters.DOMString},{key:"keepalive",converter:St.converters.boolean},{key:"signal",converter:St.nullableConverter(e=>St.converters.AbortSignal(e,"RequestInit","signal",{strict:!1}))},{key:"window",converter:St.converters.any},{key:"duplex",converter:St.converters.DOMString,allowedValues:bRt},{key:"dispatcher",converter:St.converters.any}]);LSe.exports={Request:xp,makeRequest:SQ,fromInnerRequest:QSe,cloneRequest:FSe}});var X0=I((mPr,ZSe)=>{"use strict";var{makeNetworkError:rn,makeAppropriateNetworkError:DQ,filterResponse:V5,makeResponse:RQ,fromInnerResponse:DRt}=K0(),{HeadersList:PSe}=qA(),{Request:RRt,cloneRequest:TRt}=Hb(),kp=z("node:zlib"),{bytesMatch:xRt,makePolicyContainer:kRt,clonePolicyContainer:BRt,requestBadPort:NRt,TAOCheck:ORt,appendRequestOriginHeader:FRt,responseLocationURL:QRt,requestCurrentURL:_u,setRequestReferrerPolicyOnRedirect:LRt,tryUpgradeRequestToAPotentiallyTrustworthyURL:PRt,createOpaqueTimingInfo:eK,appendFetchMetadata:MRt,corsCheck:URt,crossOriginResourcePolicyCheck:$Rt,determineRequestsReferrer:qRt,coarsenedSharedCurrentTime:Z0,createDeferredPromise:jRt,isBlobLike:YRt,sameOrigin:X5,isCancelled:YA,isAborted:MSe,isErrorLike:HRt,fullyReadBody:zRt,readableStreamClose:JRt,isomorphicEncode:TQ,urlIsLocal:GRt,urlIsHttpHttpsScheme:tK,urlHasHttpsScheme:VRt,clampAndCoarsenConnectionTimingInfo:WRt,simpleRangeHeaderValue:KRt,buildContentRange:ZRt,createInflate:XRt,extractMimeType:eTt}=ka(),{kState:jSe,kDispatcher:tTt}=yp(),HA=z("node:assert"),{safelyExtractBody:rK,extractBody:USe}=_b(),{redirectStatusSet:YSe,nullBodyStatus:HSe,safeMethodsSet:rTt,requestBodyHeader:nTt,subresourceSet:iTt}=b0(),oTt=z("node:events"),{Readable:sTt,pipeline:aTt,finished:cTt}=z("node:stream"),{addAbortListener:lTt,isErrored:uTt,isReadable:xQ,bufferToLowerCasedHeaderName:$Se}=rr(),{dataURLProcessor:dTt,serializeAMimeType:fTt,minimizeSupportedMimeType:pTt}=na(),{getGlobalDispatcher:hTt}=pQ(),{webidl:mTt}=Lo(),{STATUS_CODES:ATt}=z("node:http"),gTt=["GET","HEAD"],yTt=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",W5,kQ=class extends oTt{constructor(t){super(),this.dispatcher=t,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(t){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(t),this.emit("terminated",t))}abort(t){this.state==="ongoing"&&(this.state="aborted",t||(t=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=t,this.connection?.destroy(t),this.emit("terminated",t))}};function ETt(e){zSe(e,"fetch")}function bTt(e,t=void 0){mTt.argumentLengthCheck(arguments,1,"globalThis.fetch");let r=jRt(),n;try{n=new RRt(e,t)}catch(d){return r.reject(d),r.promise}let i=n[jSe];if(n.signal.aborted)return K5(r,i,null,n.signal.reason),r.promise;i.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(i.serviceWorkers="none");let s=null,a=!1,c=null;return lTt(n.signal,()=>{a=!0,HA(c!=null),c.abort(n.signal.reason);let d=s?.deref();K5(r,i,d,n.signal.reason)}),c=GSe({request:i,processResponseEndOfBody:ETt,processResponse:d=>{if(!a){if(d.aborted){K5(r,i,s,c.serializedAbortReason);return}if(d.type==="error"){r.reject(new TypeError("fetch failed",{cause:d.error}));return}s=new WeakRef(DRt(d,"immutable")),r.resolve(s.deref()),r=null}},dispatcher:n[tTt]}),r.promise}function zSe(e,t="other"){if(e.type==="error"&&e.aborted||!e.urlList?.length)return;let r=e.urlList[0],n=e.timingInfo,i=e.cacheState;tK(r)&&n!==null&&(e.timingAllowPassed||(n=eK({startTime:n.startTime}),i=""),n.endTime=Z0(),e.timingInfo=n,JSe(n,r.href,t,globalThis,i))}var JSe=performance.markResourceTiming;function K5(e,t,r,n){if(e&&e.reject(n),t.body!=null&&xQ(t.body?.stream)&&t.body.stream.cancel(n).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),r==null)return;let i=r[jSe];i.body!=null&&xQ(i.body?.stream)&&i.body.stream.cancel(n).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function GSe({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:r,processResponse:n,processResponseEndOfBody:i,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:a=hTt()}){HA(a);let c=null,u=!1;e.client!=null&&(c=e.client.globalObject,u=e.client.crossOriginIsolatedCapability);let d=Z0(u),f=eK({startTime:d}),p={controller:new kQ(a),request:e,timingInfo:f,processRequestBodyChunkLength:t,processRequestEndOfBody:r,processResponse:n,processResponseConsumeBody:o,processResponseEndOfBody:i,taskDestination:c,crossOriginIsolatedCapability:u};return HA(!e.body||e.body.stream),e.window==="client"&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),e.origin==="client"&&(e.origin=e.client.origin),e.policyContainer==="client"&&(e.client!=null?e.policyContainer=BRt(e.client.policyContainer):e.policyContainer=kRt()),e.headersList.contains("accept",!0)||e.headersList.append("accept","*/*",!0),e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,iTt.has(e.destination),VSe(p).catch(h=>{p.controller.terminate(h)}),p.controller}async function VSe(e,t=!1){let r=e.request,n=null;if(r.localURLsOnly&&!GRt(_u(r))&&(n=rn("local URLs only")),PRt(r),NRt(r)==="blocked"&&(n=rn("bad port")),r.referrerPolicy===""&&(r.referrerPolicy=r.policyContainer.referrerPolicy),r.referrer!=="no-referrer"&&(r.referrer=qRt(r)),n===null&&(n=await(async()=>{let o=_u(r);return X5(o,r.url)&&r.responseTainting==="basic"||o.protocol==="data:"||r.mode==="navigate"||r.mode==="websocket"?(r.responseTainting="basic",await qSe(e)):r.mode==="same-origin"?rn('request mode cannot be "same-origin"'):r.mode==="no-cors"?r.redirect!=="follow"?rn('redirect mode cannot be "follow" for "no-cors" request'):(r.responseTainting="opaque",await qSe(e)):tK(_u(r))?(r.responseTainting="cors",await WSe(e)):rn("URL scheme must be a HTTP(S) scheme")})()),t)return n;n.status!==0&&!n.internalResponse&&(r.responseTainting,r.responseTainting==="basic"?n=V5(n,"basic"):r.responseTainting==="cors"?n=V5(n,"cors"):r.responseTainting==="opaque"?n=V5(n,"opaque"):HA(!1));let i=n.status===0?n:n.internalResponse;if(i.urlList.length===0&&i.urlList.push(...r.urlList),r.timingAllowFailed||(n.timingAllowPassed=!0),n.type==="opaque"&&i.status===206&&i.rangeRequested&&!r.headers.contains("range",!0)&&(n=i=rn()),n.status!==0&&(r.method==="HEAD"||r.method==="CONNECT"||HSe.includes(i.status))&&(i.body=null,e.controller.dump=!0),r.integrity){let o=a=>Z5(e,rn(a));if(r.responseTainting==="opaque"||n.body==null){o(n.error);return}let s=a=>{if(!xRt(a,r.integrity)){o("integrity mismatch");return}n.body=rK(a)[0],Z5(e,n)};await zRt(n.body,s,o)}else Z5(e,n)}function qSe(e){if(YA(e)&&e.request.redirectCount===0)return Promise.resolve(DQ(e));let{request:t}=e,{protocol:r}=_u(t);switch(r){case"about:":return Promise.resolve(rn("about scheme is not supported"));case"blob:":{W5||(W5=z("node:buffer").resolveObjectURL);let n=_u(t);if(n.search.length!==0)return Promise.resolve(rn("NetworkError when attempting to fetch resource."));let i=W5(n.toString());if(t.method!=="GET"||!YRt(i))return Promise.resolve(rn("invalid method"));let o=RQ(),s=i.size,a=TQ(`${s}`),c=i.type;if(t.headersList.contains("range",!0)){o.rangeRequested=!0;let u=t.headersList.get("range",!0),d=KRt(u,!0);if(d==="failure")return Promise.resolve(rn("failed to fetch the data URL"));let{rangeStartValue:f,rangeEndValue:p}=d;if(f===null)f=s-p,p=f+p-1;else{if(f>=s)return Promise.resolve(rn("Range start is greater than the blob's size."));(p===null||p>=s)&&(p=s-1)}let h=i.slice(f,p,c),m=USe(h);o.body=m[0];let A=TQ(`${h.size}`),g=ZRt(f,p,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",A,!0),o.headersList.set("content-type",c,!0),o.headersList.set("content-range",g,!0)}else{let u=USe(i);o.statusText="OK",o.body=u[0],o.headersList.set("content-length",a,!0),o.headersList.set("content-type",c,!0)}return Promise.resolve(o)}case"data:":{let n=_u(t),i=dTt(n);if(i==="failure")return Promise.resolve(rn("failed to fetch the data URL"));let o=fTt(i.mimeType);return Promise.resolve(RQ({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:rK(i.body)[0]}))}case"file:":return Promise.resolve(rn("not implemented... yet..."));case"http:":case"https:":return WSe(e).catch(n=>rn(n));default:return Promise.resolve(rn("unknown scheme"))}}function ITt(e,t){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(t))}function Z5(e,t){let r=e.timingInfo,n=()=>{let o=Date.now();e.request.destination==="document"&&(e.controller.fullTimingInfo=r),e.controller.reportTimingSteps=()=>{if(e.request.url.protocol!=="https:")return;r.endTime=o;let a=t.cacheState,c=t.bodyInfo;t.timingAllowPassed||(r=eK(r),a="");let u=0;if(e.request.mode!=="navigator"||!t.hasCrossOriginRedirects){u=t.status;let d=eTt(t.headersList);d!=="failure"&&(c.contentType=pTt(d))}e.request.initiatorType!=null&&JSe(r,e.request.url.href,e.request.initiatorType,globalThis,a,c,u)};let s=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(t)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>s())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(t),e.processResponse=null});let i=t.type==="error"?t:t.internalResponse??t;i.body==null?n():cTt(i.body.stream,()=>{n()})}async function WSe(e){let t=e.request,r=null,n=null,i=e.timingInfo;if(t.serviceWorkers,r===null){if(t.redirect==="follow"&&(t.serviceWorkers="none"),n=r=await KSe(e),t.responseTainting==="cors"&&URt(t,r)==="failure")return rn("cors failure");ORt(t,r)==="failure"&&(t.timingAllowFailed=!0)}return(t.responseTainting==="opaque"||r.type==="opaque")&&$Rt(t.origin,t.client,t.destination,n)==="blocked"?rn("blocked"):(YSe.has(n.status)&&(t.redirect!=="manual"&&e.controller.connection.destroy(void 0,!1),t.redirect==="error"?r=rn("unexpected redirect"):t.redirect==="manual"?r=n:t.redirect==="follow"?r=await CTt(e,r):HA(!1)),r.timingInfo=i,r)}function CTt(e,t){let r=e.request,n=t.internalResponse?t.internalResponse:t,i;try{if(i=QRt(n,_u(r).hash),i==null)return t}catch(s){return Promise.resolve(rn(s))}if(!tK(i))return Promise.resolve(rn("URL scheme must be a HTTP(S) scheme"));if(r.redirectCount===20)return Promise.resolve(rn("redirect count exceeded"));if(r.redirectCount+=1,r.mode==="cors"&&(i.username||i.password)&&!X5(r,i))return Promise.resolve(rn('cross origin not allowed for request mode "cors"'));if(r.responseTainting==="cors"&&(i.username||i.password))return Promise.resolve(rn('URL cannot contain credentials for request mode "cors"'));if(n.status!==303&&r.body!=null&&r.body.source==null)return Promise.resolve(rn());if([301,302].includes(n.status)&&r.method==="POST"||n.status===303&&!gTt.includes(r.method)){r.method="GET",r.body=null;for(let s of nTt)r.headersList.delete(s)}X5(_u(r),i)||(r.headersList.delete("authorization",!0),r.headersList.delete("proxy-authorization",!0),r.headersList.delete("cookie",!0),r.headersList.delete("host",!0)),r.body!=null&&(HA(r.body.source!=null),r.body=rK(r.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=Z0(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),r.urlList.push(i),LRt(r,n),VSe(e,!0)}async function KSe(e,t=!1,r=!1){let n=e.request,i=null,o=null,s=null,a=null,c=!1;n.window==="no-window"&&n.redirect==="error"?(i=e,o=n):(o=TRt(n),i={...e},i.request=o);let u=n.credentials==="include"||n.credentials==="same-origin"&&n.responseTainting==="basic",d=o.body?o.body.length:null,f=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(f="0"),d!=null&&(f=TQ(`${d}`)),f!=null&&o.headersList.append("content-length",f,!0),d!=null&&o.keepalive,o.referrer instanceof URL&&o.headersList.append("referer",TQ(o.referrer.href),!0),FRt(o),MRt(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",yTt),o.cache==="default"&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),o.cache==="no-cache"&&!o.preventNoCacheCacheControlHeaderModification&&!o.headersList.contains("cache-control",!0)&&o.headersList.append("cache-control","max-age=0",!0),(o.cache==="no-store"||o.cache==="reload")&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(VRt(_u(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),a==null&&(o.cache="no-store"),o.cache!=="no-store"&&o.cache,s==null){if(o.cache==="only-if-cached")return rn("only if cached");let p=await _Tt(i,u,r);!rTt.has(o.method)&&p.status>=200&&p.status<=399,c&&p.status,s==null&&(s=p)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=u,s.status===407)return n.window==="no-window"?rn():YA(e)?DQ(e):rn("proxy authentication required");if(s.status===421&&!r&&(n.body==null||n.body.source!=null)){if(YA(e))return DQ(e);e.controller.connection.destroy(),s=await KSe(e,t,!0)}return s}async function _Tt(e,t=!1,r=!1){HA(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(m,A=!0){this.destroyed||(this.destroyed=!0,A&&this.abort?.(m??new DOMException("The operation was aborted.","AbortError")))}};let n=e.request,i=null,o=e.timingInfo;null==null&&(n.cache="no-store");let a=r?"yes":"no";n.mode;let c=null;if(n.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(n.body!=null){let m=async function*(y){YA(e)||(yield y,e.processRequestBodyChunkLength?.(y.byteLength))},A=()=>{YA(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},g=y=>{YA(e)||(y.name==="AbortError"?e.controller.abort():e.controller.terminate(y))};c=(async function*(){try{for await(let y of n.body.stream)yield*m(y);A()}catch(y){g(y)}})()}try{let{body:m,status:A,statusText:g,headersList:y,socket:b}=await h({body:c});if(b)i=RQ({status:A,statusText:g,headersList:y,socket:b});else{let E=m[Symbol.asyncIterator]();e.controller.next=()=>E.next(),i=RQ({status:A,statusText:g,headersList:y})}}catch(m){return m.name==="AbortError"?(e.controller.connection.destroy(),DQ(e,m)):rn(m)}let u=async()=>{await e.controller.resume()},d=m=>{YA(e)||e.controller.abort(m)},f=new ReadableStream({async start(m){e.controller.controller=m},async pull(m){await u(m)},async cancel(m){await d(m)},type:"bytes"});i.body={stream:f,source:null,length:null},e.controller.onAborted=p,e.controller.on("terminated",p),e.controller.resume=async()=>{for(;;){let m,A;try{let{done:y,value:b}=await e.controller.next();if(MSe(e))break;m=y?void 0:b}catch(y){e.controller.ended&&!o.encodedBodySize?m=void 0:(m=y,A=!0)}if(m===void 0){JRt(e.controller.controller),ITt(e,i);return}if(o.decodedBodySize+=m?.byteLength??0,A){e.controller.terminate(m);return}let g=new Uint8Array(m);if(g.byteLength&&e.controller.controller.enqueue(g),uTt(f)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function p(m){MSe(e)?(i.aborted=!0,xQ(f)&&e.controller.controller.error(e.controller.serializedAbortReason)):xQ(f)&&e.controller.controller.error(new TypeError("terminated",{cause:HRt(m)?m:void 0})),e.controller.connection.destroy()}return i;function h({body:m}){let A=_u(n),g=e.controller.dispatcher;return new Promise((y,b)=>g.dispatch({path:A.pathname+A.search,origin:A.origin,method:n.method,body:g.isMockActive?n.body&&(n.body.source||n.body.stream):m,headers:n.headersList.entries,maxRedirections:0,upgrade:n.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(E){let{connection:C}=e.controller;o.finalConnectionTimingInfo=WRt(void 0,o.postRedirectStartTime,e.crossOriginIsolatedCapability),C.destroyed?E(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",E),this.abort=C.abort=E),o.finalNetworkRequestStartTime=Z0(e.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=Z0(e.crossOriginIsolatedCapability)},onHeaders(E,C,w,T){if(E<200)return;let R="",k=new PSe;for(let S=0;S<C.length;S+=2)k.append($Se(C[S]),C[S+1].toString("latin1"),!0);R=k.get("location",!0),this.body=new sTt({read:w});let O=[],J=R&&n.redirect==="follow"&&YSe.has(E);if(n.method!=="HEAD"&&n.method!=="CONNECT"&&!HSe.includes(E)&&!J){let S=k.get("content-encoding",!0),N=S?S.toLowerCase().split(","):[],P=5;if(N.length>P)return b(new Error(`too many content-encodings in response: ${N.length}, maximum allowed is ${P}`)),!0;for(let W=N.length-1;W>=0;--W){let B=N[W].trim();if(B==="x-gzip"||B==="gzip")O.push(kp.createGunzip({flush:kp.constants.Z_SYNC_FLUSH,finishFlush:kp.constants.Z_SYNC_FLUSH}));else if(B==="deflate")O.push(XRt({flush:kp.constants.Z_SYNC_FLUSH,finishFlush:kp.constants.Z_SYNC_FLUSH}));else if(B==="br")O.push(kp.createBrotliDecompress({flush:kp.constants.BROTLI_OPERATION_FLUSH,finishFlush:kp.constants.BROTLI_OPERATION_FLUSH}));else{O.length=0;break}}}let j=this.onError.bind(this);return y({status:E,statusText:T,headersList:k,body:O.length?aTt(this.body,...O,S=>{S&&this.onError(S)}).on("error",j):this.body.on("error",j)}),!0},onData(E){if(e.controller.dump)return;let C=E;return o.encodedBodySize+=C.byteLength,this.body.push(C)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.onAborted&&e.controller.off("terminated",e.controller.onAborted),e.controller.ended=!0,this.body.push(null)},onError(E){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(E),e.controller.terminate(E),b(E)},onUpgrade(E,C,w){if(E!==101)return;let T=new PSe;for(let R=0;R<C.length;R+=2)T.append($Se(C[R]),C[R+1].toString("latin1"),!0);return y({status:E,statusText:ATt[E],headersList:T,socket:w}),!0}}))}}ZSe.exports={fetch:bTt,Fetch:kQ,fetching:GSe,finalizeAndReportTiming:zSe}});var nK=I((APr,XSe)=>{"use strict";XSe.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var tDe=I((gPr,eDe)=>{"use strict";var{webidl:Pa}=Lo(),BQ=Symbol("ProgressEvent state"),iK=class e extends Event{constructor(t,r={}){t=Pa.converters.DOMString(t,"ProgressEvent constructor","type"),r=Pa.converters.ProgressEventInit(r??{}),super(t,r),this[BQ]={lengthComputable:r.lengthComputable,loaded:r.loaded,total:r.total}}get lengthComputable(){return Pa.brandCheck(this,e),this[BQ].lengthComputable}get loaded(){return Pa.brandCheck(this,e),this[BQ].loaded}get total(){return Pa.brandCheck(this,e),this[BQ].total}};Pa.converters.ProgressEventInit=Pa.dictionaryConverter([{key:"lengthComputable",converter:Pa.converters.boolean,defaultValue:()=>!1},{key:"loaded",converter:Pa.converters["unsigned long long"],defaultValue:()=>0},{key:"total",converter:Pa.converters["unsigned long long"],defaultValue:()=>0},{key:"bubbles",converter:Pa.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:Pa.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:Pa.converters.boolean,defaultValue:()=>!1}]);eDe.exports={ProgressEvent:iK}});var nDe=I((yPr,rDe)=>{"use strict";function wTt(e){if(!e)return"failure";switch(e.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}rDe.exports={getEncoding:wTt}});var dDe=I((EPr,uDe)=>{"use strict";var{kState:zb,kError:oK,kResult:iDe,kAborted:eS,kLastProgressEventFired:sK}=nK(),{ProgressEvent:vTt}=tDe(),{getEncoding:oDe}=nDe(),{serializeAMimeType:STt,parseMIMEType:sDe}=na(),{types:DTt}=z("node:util"),{StringDecoder:aDe}=z("string_decoder"),{btoa:cDe}=z("node:buffer"),RTt={enumerable:!0,writable:!1,configurable:!1};function TTt(e,t,r,n){if(e[zb]==="loading")throw new DOMException("Invalid state","InvalidStateError");e[zb]="loading",e[iDe]=null,e[oK]=null;let o=t.stream().getReader(),s=[],a=o.read(),c=!0;(async()=>{for(;!e[eS];)try{let{done:u,value:d}=await a;if(c&&!e[eS]&&queueMicrotask(()=>{Bp("loadstart",e)}),c=!1,!u&&DTt.isUint8Array(d))s.push(d),(e[sK]===void 0||Date.now()-e[sK]>=50)&&!e[eS]&&(e[sK]=Date.now(),queueMicrotask(()=>{Bp("progress",e)})),a=o.read();else if(u){queueMicrotask(()=>{e[zb]="done";try{let f=xTt(s,r,t.type,n);if(e[eS])return;e[iDe]=f,Bp("load",e)}catch(f){e[oK]=f,Bp("error",e)}e[zb]!=="loading"&&Bp("loadend",e)});break}}catch(u){if(e[eS])return;queueMicrotask(()=>{e[zb]="done",e[oK]=u,Bp("error",e),e[zb]!=="loading"&&Bp("loadend",e)});break}})()}function Bp(e,t){let r=new vTt(e,{bubbles:!1,cancelable:!1});t.dispatchEvent(r)}function xTt(e,t,r,n){switch(t){case"DataURL":{let i="data:",o=sDe(r||"application/octet-stream");o!=="failure"&&(i+=STt(o)),i+=";base64,";let s=new aDe("latin1");for(let a of e)i+=cDe(s.write(a));return i+=cDe(s.end()),i}case"Text":{let i="failure";if(n&&(i=oDe(n)),i==="failure"&&r){let o=sDe(r);o!=="failure"&&(i=oDe(o.parameters.get("charset")))}return i==="failure"&&(i="UTF-8"),kTt(e,i)}case"ArrayBuffer":return lDe(e).buffer;case"BinaryString":{let i="",o=new aDe("latin1");for(let s of e)i+=o.write(s);return i+=o.end(),i}}}function kTt(e,t){let r=lDe(e),n=BTt(r),i=0;n!==null&&(t=n,i=n==="UTF-8"?3:2);let o=r.slice(i);return new TextDecoder(t).decode(o)}function BTt(e){let[t,r,n]=e;return t===239&&r===187&&n===191?"UTF-8":t===254&&r===255?"UTF-16BE":t===255&&r===254?"UTF-16LE":null}function lDe(e){let t=e.reduce((n,i)=>n+i.byteLength,0),r=0;return e.reduce((n,i)=>(n.set(i,r),r+=i.byteLength,n),new Uint8Array(t))}uDe.exports={staticPropertyDescriptors:RTt,readOperation:TTt,fireAProgressEvent:Bp}});var mDe=I((bPr,hDe)=>{"use strict";var{staticPropertyDescriptors:Jb,readOperation:NQ,fireAProgressEvent:fDe}=dDe(),{kState:zA,kError:pDe,kResult:OQ,kEvents:Hr,kAborted:NTt}=nK(),{webidl:ln}=Lo(),{kEnumerableProperty:sa}=rr(),yl=class e extends EventTarget{constructor(){super(),this[zA]="empty",this[OQ]=null,this[pDe]=null,this[Hr]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(t){ln.brandCheck(this,e),ln.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),t=ln.converters.Blob(t,{strict:!1}),NQ(this,t,"ArrayBuffer")}readAsBinaryString(t){ln.brandCheck(this,e),ln.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),t=ln.converters.Blob(t,{strict:!1}),NQ(this,t,"BinaryString")}readAsText(t,r=void 0){ln.brandCheck(this,e),ln.argumentLengthCheck(arguments,1,"FileReader.readAsText"),t=ln.converters.Blob(t,{strict:!1}),r!==void 0&&(r=ln.converters.DOMString(r,"FileReader.readAsText","encoding")),NQ(this,t,"Text",r)}readAsDataURL(t){ln.brandCheck(this,e),ln.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),t=ln.converters.Blob(t,{strict:!1}),NQ(this,t,"DataURL")}abort(){if(this[zA]==="empty"||this[zA]==="done"){this[OQ]=null;return}this[zA]==="loading"&&(this[zA]="done",this[OQ]=null),this[NTt]=!0,fDe("abort",this),this[zA]!=="loading"&&fDe("loadend",this)}get readyState(){switch(ln.brandCheck(this,e),this[zA]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return ln.brandCheck(this,e),this[OQ]}get error(){return ln.brandCheck(this,e),this[pDe]}get onloadend(){return ln.brandCheck(this,e),this[Hr].loadend}set onloadend(t){ln.brandCheck(this,e),this[Hr].loadend&&this.removeEventListener("loadend",this[Hr].loadend),typeof t=="function"?(this[Hr].loadend=t,this.addEventListener("loadend",t)):this[Hr].loadend=null}get onerror(){return ln.brandCheck(this,e),this[Hr].error}set onerror(t){ln.brandCheck(this,e),this[Hr].error&&this.removeEventListener("error",this[Hr].error),typeof t=="function"?(this[Hr].error=t,this.addEventListener("error",t)):this[Hr].error=null}get onloadstart(){return ln.brandCheck(this,e),this[Hr].loadstart}set onloadstart(t){ln.brandCheck(this,e),this[Hr].loadstart&&this.removeEventListener("loadstart",this[Hr].loadstart),typeof t=="function"?(this[Hr].loadstart=t,this.addEventListener("loadstart",t)):this[Hr].loadstart=null}get onprogress(){return ln.brandCheck(this,e),this[Hr].progress}set onprogress(t){ln.brandCheck(this,e),this[Hr].progress&&this.removeEventListener("progress",this[Hr].progress),typeof t=="function"?(this[Hr].progress=t,this.addEventListener("progress",t)):this[Hr].progress=null}get onload(){return ln.brandCheck(this,e),this[Hr].load}set onload(t){ln.brandCheck(this,e),this[Hr].load&&this.removeEventListener("load",this[Hr].load),typeof t=="function"?(this[Hr].load=t,this.addEventListener("load",t)):this[Hr].load=null}get onabort(){return ln.brandCheck(this,e),this[Hr].abort}set onabort(t){ln.brandCheck(this,e),this[Hr].abort&&this.removeEventListener("abort",this[Hr].abort),typeof t=="function"?(this[Hr].abort=t,this.addEventListener("abort",t)):this[Hr].abort=null}};yl.EMPTY=yl.prototype.EMPTY=0;yl.LOADING=yl.prototype.LOADING=1;yl.DONE=yl.prototype.DONE=2;Object.defineProperties(yl.prototype,{EMPTY:Jb,LOADING:Jb,DONE:Jb,readAsArrayBuffer:sa,readAsBinaryString:sa,readAsText:sa,readAsDataURL:sa,abort:sa,readyState:sa,result:sa,error:sa,onloadstart:sa,onprogress:sa,onload:sa,onabort:sa,onerror:sa,onloadend:sa,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(yl,{EMPTY:Jb,LOADING:Jb,DONE:Jb});hDe.exports={FileReader:yl}});var FQ=I((IPr,ADe)=>{"use strict";ADe.exports={kConstruct:qn().kConstruct}});var EDe=I((CPr,yDe)=>{"use strict";var OTt=z("node:assert"),{URLSerializer:gDe}=na(),{isValidHeaderName:FTt}=ka();function QTt(e,t,r=!1){let n=gDe(e,r),i=gDe(t,r);return n===i}function LTt(e){OTt(e!==null);let t=[];for(let r of e.split(","))r=r.trim(),FTt(r)&&t.push(r);return t}yDe.exports={urlEquals:QTt,getFieldValues:LTt}});var CDe=I((_Pr,IDe)=>{"use strict";var{kConstruct:PTt}=FQ(),{urlEquals:MTt,getFieldValues:aK}=EDe(),{kEnumerableProperty:JA,isDisturbed:UTt}=rr(),{webidl:pt}=Lo(),{Response:$Tt,cloneResponse:qTt,fromInnerResponse:jTt}=K0(),{Request:jd,fromInnerRequest:YTt}=Hb(),{kState:El}=yp(),{fetching:HTt}=X0(),{urlIsHttpHttpsScheme:QQ,createDeferredPromise:Gb,readAllBytes:zTt}=ka(),cK=z("node:assert"),LQ=class e{#e;constructor(){arguments[0]!==PTt&&pt.illegalConstructor(),pt.util.markAsUncloneable(this),this.#e=arguments[1]}async match(t,r={}){pt.brandCheck(this,e);let n="Cache.match";pt.argumentLengthCheck(arguments,1,n),t=pt.converters.RequestInfo(t,n,"request"),r=pt.converters.CacheQueryOptions(r,n,"options");let i=this.#o(t,r,1);if(i.length!==0)return i[0]}async matchAll(t=void 0,r={}){pt.brandCheck(this,e);let n="Cache.matchAll";return t!==void 0&&(t=pt.converters.RequestInfo(t,n,"request")),r=pt.converters.CacheQueryOptions(r,n,"options"),this.#o(t,r)}async add(t){pt.brandCheck(this,e);let r="Cache.add";pt.argumentLengthCheck(arguments,1,r),t=pt.converters.RequestInfo(t,r,"request");let n=[t];return await this.addAll(n)}async addAll(t){pt.brandCheck(this,e);let r="Cache.addAll";pt.argumentLengthCheck(arguments,1,r);let n=[],i=[];for(let p of t){if(p===void 0)throw pt.errors.conversionFailed({prefix:r,argument:"Argument 1",types:["undefined is not allowed"]});if(p=pt.converters.RequestInfo(p),typeof p=="string")continue;let h=p[El];if(!QQ(h.url)||h.method!=="GET")throw pt.errors.exception({header:r,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let p of t){let h=new jd(p)[El];if(!QQ(h.url))throw pt.errors.exception({header:r,message:"Expected http/s scheme."});h.initiator="fetch",h.destination="subresource",i.push(h);let m=Gb();o.push(HTt({request:h,processResponse(A){if(A.type==="error"||A.status===206||A.status<200||A.status>299)m.reject(pt.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(A.headersList.contains("vary")){let g=aK(A.headersList.get("vary"));for(let y of g)if(y==="*"){m.reject(pt.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let b of o)b.abort();return}}},processResponseEndOfBody(A){if(A.aborted){m.reject(new DOMException("aborted","AbortError"));return}m.resolve(A)}})),n.push(m.promise)}let a=await Promise.all(n),c=[],u=0;for(let p of a){let h={type:"put",request:i[u],response:p};c.push(h),u++}let d=Gb(),f=null;try{this.#t(c)}catch(p){f=p}return queueMicrotask(()=>{f===null?d.resolve(void 0):d.reject(f)}),d.promise}async put(t,r){pt.brandCheck(this,e);let n="Cache.put";pt.argumentLengthCheck(arguments,2,n),t=pt.converters.RequestInfo(t,n,"request"),r=pt.converters.Response(r,n,"response");let i=null;if(t instanceof jd?i=t[El]:i=new jd(t)[El],!QQ(i.url)||i.method!=="GET")throw pt.errors.exception({header:n,message:"Expected an http/s scheme when method is not GET"});let o=r[El];if(o.status===206)throw pt.errors.exception({header:n,message:"Got 206 status"});if(o.headersList.contains("vary")){let h=aK(o.headersList.get("vary"));for(let m of h)if(m==="*")throw pt.errors.exception({header:n,message:"Got * vary field value"})}if(o.body&&(UTt(o.body.stream)||o.body.stream.locked))throw pt.errors.exception({header:n,message:"Response body is locked or disturbed"});let s=qTt(o),a=Gb();if(o.body!=null){let m=o.body.stream.getReader();zTt(m).then(a.resolve,a.reject)}else a.resolve(void 0);let c=[],u={type:"put",request:i,response:s};c.push(u);let d=await a.promise;s.body!=null&&(s.body.source=d);let f=Gb(),p=null;try{this.#t(c)}catch(h){p=h}return queueMicrotask(()=>{p===null?f.resolve():f.reject(p)}),f.promise}async delete(t,r={}){pt.brandCheck(this,e);let n="Cache.delete";pt.argumentLengthCheck(arguments,1,n),t=pt.converters.RequestInfo(t,n,"request"),r=pt.converters.CacheQueryOptions(r,n,"options");let i=null;if(t instanceof jd){if(i=t[El],i.method!=="GET"&&!r.ignoreMethod)return!1}else cK(typeof t=="string"),i=new jd(t)[El];let o=[],s={type:"delete",request:i,options:r};o.push(s);let a=Gb(),c=null,u;try{u=this.#t(o)}catch(d){c=d}return queueMicrotask(()=>{c===null?a.resolve(!!u?.length):a.reject(c)}),a.promise}async keys(t=void 0,r={}){pt.brandCheck(this,e);let n="Cache.keys";t!==void 0&&(t=pt.converters.RequestInfo(t,n,"request")),r=pt.converters.CacheQueryOptions(r,n,"options");let i=null;if(t!==void 0)if(t instanceof jd){if(i=t[El],i.method!=="GET"&&!r.ignoreMethod)return[]}else typeof t=="string"&&(i=new jd(t)[El]);let o=Gb(),s=[];if(t===void 0)for(let a of this.#e)s.push(a[0]);else{let a=this.#r(i,r);for(let c of a)s.push(c[0])}return queueMicrotask(()=>{let a=[];for(let c of s){let u=YTt(c,new AbortController().signal,"immutable");a.push(u)}o.resolve(Object.freeze(a))}),o.promise}#t(t){let r=this.#e,n=[...r],i=[],o=[];try{for(let s of t){if(s.type!=="delete"&&s.type!=="put")throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#r(s.request,s.options,i).length)throw new DOMException("???","InvalidStateError");let a;if(s.type==="delete"){if(a=this.#r(s.request,s.options),a.length===0)return[];for(let c of a){let u=r.indexOf(c);cK(u!==-1),r.splice(u,1)}}else if(s.type==="put"){if(s.response==null)throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let c=s.request;if(!QQ(c.url))throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(c.method!=="GET")throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw pt.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});a=this.#r(s.request);for(let u of a){let d=r.indexOf(u);cK(d!==-1),r.splice(d,1)}r.push([s.request,s.response]),i.push([s.request,s.response])}o.push([s.request,s.response])}return o}catch(s){throw this.#e.length=0,this.#e=n,s}}#r(t,r,n){let i=[],o=n??this.#e;for(let s of o){let[a,c]=s;this.#i(t,a,c,r)&&i.push(s)}return i}#i(t,r,n=null,i){let o=new URL(t.url),s=new URL(r.url);if(i?.ignoreSearch&&(s.search="",o.search=""),!MTt(o,s,!0))return!1;if(n==null||i?.ignoreVary||!n.headersList.contains("vary"))return!0;let a=aK(n.headersList.get("vary"));for(let c of a){if(c==="*")return!1;let u=r.headersList.get(c),d=t.headersList.get(c);if(u!==d)return!1}return!0}#o(t,r,n=1/0){let i=null;if(t!==void 0)if(t instanceof jd){if(i=t[El],i.method!=="GET"&&!r.ignoreMethod)return[]}else typeof t=="string"&&(i=new jd(t)[El]);let o=[];if(t===void 0)for(let a of this.#e)o.push(a[1]);else{let a=this.#r(i,r);for(let c of a)o.push(c[1])}let s=[];for(let a of o){let c=jTt(a,"immutable");if(s.push(c.clone()),s.length>=n)break}return Object.freeze(s)}};Object.defineProperties(LQ.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:JA,matchAll:JA,add:JA,addAll:JA,put:JA,delete:JA,keys:JA});var bDe=[{key:"ignoreSearch",converter:pt.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:pt.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:pt.converters.boolean,defaultValue:()=>!1}];pt.converters.CacheQueryOptions=pt.dictionaryConverter(bDe);pt.converters.MultiCacheQueryOptions=pt.dictionaryConverter([...bDe,{key:"cacheName",converter:pt.converters.DOMString}]);pt.converters.Response=pt.interfaceConverter($Tt);pt.converters["sequence<RequestInfo>"]=pt.sequenceConverter(pt.converters.RequestInfo);IDe.exports={Cache:LQ}});var wDe=I((wPr,_De)=>{"use strict";var{kConstruct:tS}=FQ(),{Cache:PQ}=CDe(),{webidl:os}=Lo(),{kEnumerableProperty:rS}=rr(),MQ=class e{#e=new Map;constructor(){arguments[0]!==tS&&os.illegalConstructor(),os.util.markAsUncloneable(this)}async match(t,r={}){if(os.brandCheck(this,e),os.argumentLengthCheck(arguments,1,"CacheStorage.match"),t=os.converters.RequestInfo(t),r=os.converters.MultiCacheQueryOptions(r),r.cacheName!=null){if(this.#e.has(r.cacheName)){let n=this.#e.get(r.cacheName);return await new PQ(tS,n).match(t,r)}}else for(let n of this.#e.values()){let o=await new PQ(tS,n).match(t,r);if(o!==void 0)return o}}async has(t){os.brandCheck(this,e);let r="CacheStorage.has";return os.argumentLengthCheck(arguments,1,r),t=os.converters.DOMString(t,r,"cacheName"),this.#e.has(t)}async open(t){os.brandCheck(this,e);let r="CacheStorage.open";if(os.argumentLengthCheck(arguments,1,r),t=os.converters.DOMString(t,r,"cacheName"),this.#e.has(t)){let i=this.#e.get(t);return new PQ(tS,i)}let n=[];return this.#e.set(t,n),new PQ(tS,n)}async delete(t){os.brandCheck(this,e);let r="CacheStorage.delete";return os.argumentLengthCheck(arguments,1,r),t=os.converters.DOMString(t,r,"cacheName"),this.#e.delete(t)}async keys(){return os.brandCheck(this,e),[...this.#e.keys()]}};Object.defineProperties(MQ.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:rS,has:rS,open:rS,delete:rS,keys:rS});_De.exports={CacheStorage:MQ}});var SDe=I((vPr,vDe)=>{"use strict";vDe.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var lK=I((SPr,kDe)=>{"use strict";function JTt(e){for(let t=0;t<e.length;++t){let r=e.charCodeAt(t);if(r>=0&&r<=8||r>=10&&r<=31||r===127)return!0}return!1}function DDe(e){for(let t=0;t<e.length;++t){let r=e.charCodeAt(t);if(r<33||r>126||r===34||r===40||r===41||r===60||r===62||r===64||r===44||r===59||r===58||r===92||r===47||r===91||r===93||r===63||r===61||r===123||r===125)throw new Error("Invalid cookie name")}}function RDe(e){let t=e.length,r=0;if(e[0]==='"'){if(t===1||e[t-1]!=='"')throw new Error("Invalid cookie value");--t,++r}for(;r<t;){let n=e.charCodeAt(r++);if(n<33||n>126||n===34||n===44||n===59||n===92)throw new Error("Invalid cookie value")}}function TDe(e){for(let t=0;t<e.length;++t){let r=e.charCodeAt(t);if(r<32||r===127||r===59)throw new Error("Invalid cookie path")}}function GTt(e){if(e.startsWith("-")||e.endsWith(".")||e.endsWith("-"))throw new Error("Invalid cookie domain")}var VTt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WTt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],UQ=Array(61).fill(0).map((e,t)=>t.toString().padStart(2,"0"));function xDe(e){return typeof e=="number"&&(e=new Date(e)),`${VTt[e.getUTCDay()]}, ${UQ[e.getUTCDate()]} ${WTt[e.getUTCMonth()]} ${e.getUTCFullYear()} ${UQ[e.getUTCHours()]}:${UQ[e.getUTCMinutes()]}:${UQ[e.getUTCSeconds()]} GMT`}function KTt(e){if(e<0)throw new Error("Invalid cookie max-age")}function ZTt(e){if(e.name.length===0)return null;DDe(e.name),RDe(e.value);let t=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&t.push("Secure"),e.httpOnly&&t.push("HttpOnly"),typeof e.maxAge=="number"&&(KTt(e.maxAge),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(GTt(e.domain),t.push(`Domain=${e.domain}`)),e.path&&(TDe(e.path),t.push(`Path=${e.path}`)),e.expires&&e.expires.toString()!=="Invalid Date"&&t.push(`Expires=${xDe(e.expires)}`),e.sameSite&&t.push(`SameSite=${e.sameSite}`);for(let r of e.unparsed){if(!r.includes("="))throw new Error("Invalid unparsed");let[n,...i]=r.split("=");t.push(`${n.trim()}=${i.join("=")}`)}return t.join("; ")}kDe.exports={isCTLExcludingHtab:JTt,validateCookieName:DDe,validateCookiePath:TDe,validateCookieValue:RDe,toIMFDate:xDe,stringify:ZTt}});var NDe=I((DPr,BDe)=>{"use strict";var{maxNameValuePairSize:XTt,maxAttributeValueSize:ext}=SDe(),{isCTLExcludingHtab:txt}=lK(),{collectASequenceOfCodePointsFast:$Q}=na(),rxt=z("node:assert");function nxt(e){if(txt(e))return null;let t="",r="",n="",i="";if(e.includes(";")){let o={position:0};t=$Q(";",e,o),r=e.slice(o.position)}else t=e;if(!t.includes("="))i=t;else{let o={position:0};n=$Q("=",t,o),i=t.slice(o.position+1)}return n=n.trim(),i=i.trim(),n.length+i.length>XTt?null:{name:n,value:i,...Vb(r)}}function Vb(e,t={}){if(e.length===0)return t;rxt(e[0]===";"),e=e.slice(1);let r="";e.includes(";")?(r=$Q(";",e,{position:0}),e=e.slice(r.length)):(r=e,e="");let n="",i="";if(r.includes("=")){let s={position:0};n=$Q("=",r,s),i=r.slice(s.position+1)}else n=r;if(n=n.trim(),i=i.trim(),i.length>ext)return Vb(e,t);let o=n.toLowerCase();if(o==="expires"){let s=new Date(i);t.expires=s}else if(o==="max-age"){let s=i.charCodeAt(0);if((s<48||s>57)&&i[0]!=="-"||!/^\d+$/.test(i))return Vb(e,t);let a=Number(i);t.maxAge=a}else if(o==="domain"){let s=i;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),t.domain=s}else if(o==="path"){let s="";i.length===0||i[0]!=="/"?s="/":s=i,t.path=s}else if(o==="secure")t.secure=!0;else if(o==="httponly")t.httpOnly=!0;else if(o==="samesite"){let s="Default",a=i.toLowerCase();a.includes("none")&&(s="None"),a.includes("strict")&&(s="Strict"),a.includes("lax")&&(s="Lax"),t.sameSite=s}else t.unparsed??=[],t.unparsed.push(`${n}=${i}`);return Vb(e,t)}BDe.exports={parseSetCookie:nxt,parseUnparsedAttributes:Vb}});var QDe=I((RPr,FDe)=>{"use strict";var{parseSetCookie:ixt}=NDe(),{stringify:oxt}=lK(),{webidl:mr}=Lo(),{Headers:qQ}=qA();function sxt(e){mr.argumentLengthCheck(arguments,1,"getCookies"),mr.brandCheck(e,qQ,{strict:!1});let t=e.get("cookie"),r={};if(!t)return r;for(let n of t.split(";")){let[i,...o]=n.split("=");r[i.trim()]=o.join("=")}return r}function axt(e,t,r){mr.brandCheck(e,qQ,{strict:!1});let n="deleteCookie";mr.argumentLengthCheck(arguments,2,n),t=mr.converters.DOMString(t,n,"name"),r=mr.converters.DeleteCookieAttributes(r),ODe(e,{name:t,value:"",expires:new Date(0),...r})}function cxt(e){mr.argumentLengthCheck(arguments,1,"getSetCookies"),mr.brandCheck(e,qQ,{strict:!1});let t=e.getSetCookie();return t?t.map(r=>ixt(r)):[]}function ODe(e,t){mr.argumentLengthCheck(arguments,2,"setCookie"),mr.brandCheck(e,qQ,{strict:!1}),t=mr.converters.Cookie(t);let r=oxt(t);r&&e.append("Set-Cookie",r)}mr.converters.DeleteCookieAttributes=mr.dictionaryConverter([{converter:mr.nullableConverter(mr.converters.DOMString),key:"path",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters.DOMString),key:"domain",defaultValue:()=>null}]);mr.converters.Cookie=mr.dictionaryConverter([{converter:mr.converters.DOMString,key:"name"},{converter:mr.converters.DOMString,key:"value"},{converter:mr.nullableConverter(e=>typeof e=="number"?mr.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters.DOMString),key:"path",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters.boolean),key:"secure",defaultValue:()=>null},{converter:mr.nullableConverter(mr.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:mr.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:mr.sequenceConverter(mr.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);FDe.exports={getCookies:sxt,deleteCookie:axt,getSetCookies:cxt,setCookie:ODe}});var Kb=I((TPr,PDe)=>{"use strict";var{webidl:lt}=Lo(),{kEnumerableProperty:aa}=rr(),{kConstruct:LDe}=qn(),{MessagePort:lxt}=z("node:worker_threads"),Wb=class e extends Event{#e;constructor(t,r={}){if(t===LDe){super(arguments[1],arguments[2]),lt.util.markAsUncloneable(this);return}let n="MessageEvent constructor";lt.argumentLengthCheck(arguments,1,n),t=lt.converters.DOMString(t,n,"type"),r=lt.converters.MessageEventInit(r,n,"eventInitDict"),super(t,r),this.#e=r,lt.util.markAsUncloneable(this)}get data(){return lt.brandCheck(this,e),this.#e.data}get origin(){return lt.brandCheck(this,e),this.#e.origin}get lastEventId(){return lt.brandCheck(this,e),this.#e.lastEventId}get source(){return lt.brandCheck(this,e),this.#e.source}get ports(){return lt.brandCheck(this,e),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(t,r=!1,n=!1,i=null,o="",s="",a=null,c=[]){return lt.brandCheck(this,e),lt.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new e(t,{bubbles:r,cancelable:n,data:i,origin:o,lastEventId:s,source:a,ports:c})}static createFastMessageEvent(t,r){let n=new e(LDe,t,r);return n.#e=r,n.#e.data??=null,n.#e.origin??="",n.#e.lastEventId??="",n.#e.source??=null,n.#e.ports??=[],n}},{createFastMessageEvent:uxt}=Wb;delete Wb.createFastMessageEvent;var jQ=class e extends Event{#e;constructor(t,r={}){let n="CloseEvent constructor";lt.argumentLengthCheck(arguments,1,n),t=lt.converters.DOMString(t,n,"type"),r=lt.converters.CloseEventInit(r),super(t,r),this.#e=r,lt.util.markAsUncloneable(this)}get wasClean(){return lt.brandCheck(this,e),this.#e.wasClean}get code(){return lt.brandCheck(this,e),this.#e.code}get reason(){return lt.brandCheck(this,e),this.#e.reason}},YQ=class e extends Event{#e;constructor(t,r){let n="ErrorEvent constructor";lt.argumentLengthCheck(arguments,1,n),super(t,r),lt.util.markAsUncloneable(this),t=lt.converters.DOMString(t,n,"type"),r=lt.converters.ErrorEventInit(r??{}),this.#e=r}get message(){return lt.brandCheck(this,e),this.#e.message}get filename(){return lt.brandCheck(this,e),this.#e.filename}get lineno(){return lt.brandCheck(this,e),this.#e.lineno}get colno(){return lt.brandCheck(this,e),this.#e.colno}get error(){return lt.brandCheck(this,e),this.#e.error}};Object.defineProperties(Wb.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:aa,origin:aa,lastEventId:aa,source:aa,ports:aa,initMessageEvent:aa});Object.defineProperties(jQ.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:aa,code:aa,wasClean:aa});Object.defineProperties(YQ.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:aa,filename:aa,lineno:aa,colno:aa,error:aa});lt.converters.MessagePort=lt.interfaceConverter(lxt);lt.converters["sequence<MessagePort>"]=lt.sequenceConverter(lt.converters.MessagePort);var uK=[{key:"bubbles",converter:lt.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:lt.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:lt.converters.boolean,defaultValue:()=>!1}];lt.converters.MessageEventInit=lt.dictionaryConverter([...uK,{key:"data",converter:lt.converters.any,defaultValue:()=>null},{key:"origin",converter:lt.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:lt.converters.DOMString,defaultValue:()=>""},{key:"source",converter:lt.nullableConverter(lt.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:lt.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);lt.converters.CloseEventInit=lt.dictionaryConverter([...uK,{key:"wasClean",converter:lt.converters.boolean,defaultValue:()=>!1},{key:"code",converter:lt.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:lt.converters.USVString,defaultValue:()=>""}]);lt.converters.ErrorEventInit=lt.dictionaryConverter([...uK,{key:"message",converter:lt.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:lt.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:lt.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:lt.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:lt.converters.any}]);PDe.exports={MessageEvent:Wb,CloseEvent:jQ,ErrorEvent:YQ,createFastMessageEvent:uxt}});var GA=I((xPr,MDe)=>{"use strict";var dxt="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",fxt={enumerable:!0,writable:!1,configurable:!1},pxt={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},hxt={NOT_SENT:0,PROCESSING:1,SENT:2},mxt={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},Axt=2**16-1,gxt={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},yxt=Buffer.allocUnsafe(0),Ext={string:1,typedArray:2,arrayBuffer:3,blob:4};MDe.exports={uid:dxt,sentCloseFrameState:hxt,staticPropertyDescriptors:fxt,states:pxt,opcodes:mxt,maxUnsigned16Bit:Axt,parserStates:gxt,emptyBuffer:yxt,sendHints:Ext}});var nS=I((kPr,UDe)=>{"use strict";UDe.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var sS=I((BPr,VDe)=>{"use strict";var{kReadyState:iS,kController:bxt,kResponse:Ixt,kBinaryType:Cxt,kWebSocketURL:_xt}=nS(),{states:oS,opcodes:Np}=GA(),{ErrorEvent:wxt,createFastMessageEvent:vxt}=Kb(),{isUtf8:Sxt}=z("node:buffer"),{collectASequenceOfCodePointsFast:Dxt,removeHTTPWhitespace:$De}=na();function Rxt(e){return e[iS]===oS.CONNECTING}function Txt(e){return e[iS]===oS.OPEN}function xxt(e){return e[iS]===oS.CLOSING}function kxt(e){return e[iS]===oS.CLOSED}function dK(e,t,r=(i,o)=>new Event(i,o),n={}){let i=r(e,n);t.dispatchEvent(i)}function Bxt(e,t,r){if(e[iS]!==oS.OPEN)return;let n;if(t===Np.TEXT)try{n=GDe(r)}catch{jDe(e,"Received invalid UTF-8 in text frame.");return}else t===Np.BINARY&&(e[Cxt]==="blob"?n=new Blob([r]):n=Nxt(r));dK("message",e,vxt,{origin:e[_xt].origin,data:n})}function Nxt(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function Oxt(e){if(e.length===0)return!1;for(let t=0;t<e.length;++t){let r=e.charCodeAt(t);if(r<33||r>126||r===34||r===40||r===41||r===44||r===47||r===58||r===59||r===60||r===61||r===62||r===63||r===64||r===91||r===92||r===93||r===123||r===125)return!1}return!0}function Fxt(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function jDe(e,t){let{[bxt]:r,[Ixt]:n}=e;r.abort(),n?.socket&&!n.socket.destroyed&&n.socket.destroy(),t&&dK("error",e,(i,o)=>new wxt(i,o),{error:new Error(t),message:t})}function YDe(e){return e===Np.CLOSE||e===Np.PING||e===Np.PONG}function HDe(e){return e===Np.CONTINUATION}function zDe(e){return e===Np.TEXT||e===Np.BINARY}function Qxt(e){return zDe(e)||HDe(e)||YDe(e)}function Lxt(e){let t={position:0},r=new Map;for(;t.position<e.length;){let n=Dxt(";",e,t),[i,o=""]=n.split("=");r.set($De(i,!0,!1),$De(o,!1,!0)),t.position++}return r}function Pxt(e){if(e.length===0)return!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}let t=Number.parseInt(e,10);return t>=8&&t<=15}var JDe=typeof process.versions.icu=="string",qDe=JDe?new TextDecoder("utf-8",{fatal:!0}):void 0,GDe=JDe?qDe.decode.bind(qDe):function(e){if(Sxt(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};VDe.exports={isConnecting:Rxt,isEstablished:Txt,isClosing:xxt,isClosed:kxt,fireEvent:dK,isValidSubprotocol:Oxt,isValidStatusCode:Fxt,failWebsocketConnection:jDe,websocketMessageReceived:Bxt,utf8Decode:GDe,isControlFrame:YDe,isContinuationFrame:HDe,isTextBinaryFrame:zDe,isValidOpcode:Qxt,parseExtensions:Lxt,isValidClientWindowBits:Pxt}});var zQ=I((NPr,WDe)=>{"use strict";var{maxUnsigned16Bit:Mxt}=GA(),HQ=16386,fK,aS=null,Zb=HQ;try{fK=z("node:crypto")}catch{fK={randomFillSync:function(t,r,n){for(let i=0;i<t.length;++i)t[i]=Math.random()*255|0;return t}}}function Uxt(){return Zb===HQ&&(Zb=0,fK.randomFillSync(aS??=Buffer.allocUnsafe(HQ),0,HQ)),[aS[Zb++],aS[Zb++],aS[Zb++],aS[Zb++]]}var pK=class{constructor(t){this.frameData=t}createFrame(t){let r=this.frameData,n=Uxt(),i=r?.byteLength??0,o=i,s=6;i>Mxt?(s+=8,o=127):i>125&&(s+=2,o=126);let a=Buffer.allocUnsafe(i+s);a[0]=a[1]=0,a[0]|=128,a[0]=(a[0]&240)+t;a[s-4]=n[0],a[s-3]=n[1],a[s-2]=n[2],a[s-1]=n[3],a[1]=o,o===126?a.writeUInt16BE(i,2):o===127&&(a[2]=a[3]=0,a.writeUIntBE(i,4,6)),a[1]|=128;for(let c=0;c<i;++c)a[s+c]=r[c]^n[c&3];return a}};WDe.exports={WebsocketFrameSend:pK}});var mK=I((OPr,nRe)=>{"use strict";var{uid:$xt,states:cS,sentCloseFrameState:JQ,emptyBuffer:qxt,opcodes:jxt}=GA(),{kReadyState:lS,kSentClose:GQ,kByteParser:ZDe,kReceivedClose:KDe,kResponse:XDe}=nS(),{fireEvent:Yxt,failWebsocketConnection:Op,isClosing:Hxt,isClosed:zxt,isEstablished:Jxt,parseExtensions:Gxt}=sS(),{channels:Xb}=ub(),{CloseEvent:Vxt}=Kb(),{makeRequest:Wxt}=Hb(),{fetching:Kxt}=X0(),{Headers:Zxt,getHeadersList:Xxt}=qA(),{getDecodeSplit:ekt}=ka(),{WebsocketFrameSend:tkt}=zQ(),hK;try{hK=z("node:crypto")}catch{}function rkt(e,t,r,n,i,o){let s=e;s.protocol=e.protocol==="ws:"?"http:":"https:";let a=Wxt({urlList:[s],client:r,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){let f=Xxt(new Zxt(o.headers));a.headersList=f}let c=hK.randomBytes(16).toString("base64");a.headersList.append("sec-websocket-key",c),a.headersList.append("sec-websocket-version","13");for(let f of t)a.headersList.append("sec-websocket-protocol",f);return a.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),Kxt({request:a,useParallelQueue:!0,dispatcher:o.dispatcher,processResponse(f){if(f.type==="error"||f.status!==101){Op(n,"Received network error or non-101 status code.");return}if(t.length!==0&&!f.headersList.get("Sec-WebSocket-Protocol")){Op(n,"Server did not respond with sent protocols.");return}if(f.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){Op(n,'Server did not set Upgrade header to "websocket".');return}if(f.headersList.get("Connection")?.toLowerCase()!=="upgrade"){Op(n,'Server did not set Connection header to "upgrade".');return}let p=f.headersList.get("Sec-WebSocket-Accept"),h=hK.createHash("sha1").update(c+$xt).digest("base64");if(p!==h){Op(n,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let m=f.headersList.get("Sec-WebSocket-Extensions"),A;if(m!==null&&(A=Gxt(m),!A.has("permessage-deflate"))){Op(n,"Sec-WebSocket-Extensions header does not match.");return}let g=f.headersList.get("Sec-WebSocket-Protocol");if(g!==null&&!ekt("sec-websocket-protocol",a.headersList).includes(g)){Op(n,"Protocol was not set in the opening handshake.");return}f.socket.on("data",eRe),f.socket.on("close",tRe),f.socket.on("error",rRe),Xb.open.hasSubscribers&&Xb.open.publish({address:f.socket.address(),protocol:g,extensions:m}),i(f,A)}})}function nkt(e,t,r,n){if(!(Hxt(e)||zxt(e)))if(!Jxt(e))Op(e,"Connection was closed before it was established."),e[lS]=cS.CLOSING;else if(e[GQ]===JQ.NOT_SENT){e[GQ]=JQ.PROCESSING;let i=new tkt;t!==void 0&&r===void 0?(i.frameData=Buffer.allocUnsafe(2),i.frameData.writeUInt16BE(t,0)):t!==void 0&&r!==void 0?(i.frameData=Buffer.allocUnsafe(2+n),i.frameData.writeUInt16BE(t,0),i.frameData.write(r,2,"utf-8")):i.frameData=qxt,e[XDe].socket.write(i.createFrame(jxt.CLOSE)),e[GQ]=JQ.SENT,e[lS]=cS.CLOSING}else e[lS]=cS.CLOSING}function eRe(e){this.ws[ZDe].write(e)||this.pause()}function tRe(){let{ws:e}=this,{[XDe]:t}=e;t.socket.off("data",eRe),t.socket.off("close",tRe),t.socket.off("error",rRe);let r=e[GQ]===JQ.SENT&&e[KDe],n=1005,i="",o=e[ZDe].closingInfo;o&&!o.error?(n=o.code??1005,i=o.reason):e[KDe]||(n=1006),e[lS]=cS.CLOSED,Yxt("close",e,(s,a)=>new Vxt(s,a),{wasClean:r,code:n,reason:i}),Xb.close.hasSubscribers&&Xb.close.publish({websocket:e,code:n,reason:i})}function rRe(e){let{ws:t}=this;t[lS]=cS.CLOSING,Xb.socketError.hasSubscribers&&Xb.socketError.publish(e),this.destroy()}nRe.exports={establishWebSocketConnection:rkt,closeWebSocketConnection:nkt}});var oRe=I((FPr,iRe)=>{"use strict";var{createInflateRaw:ikt,Z_DEFAULT_WINDOWBITS:okt}=z("node:zlib"),{isValidClientWindowBits:skt}=sS(),{MessageSizeExceededError:akt}=xr(),ckt=Buffer.from([0,0,255,255]),VQ=Symbol("kBuffer"),uS=Symbol("kLength"),AK=class{#e;#t={};#r=0;constructor(t,r){this.#t.serverNoContextTakeover=t.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=t.get("server_max_window_bits"),this.#r=r.maxPayloadSize}decompress(t,r,n){if(!this.#e){let i=okt;if(this.#t.serverMaxWindowBits){if(!skt(this.#t.serverMaxWindowBits)){n(new Error("Invalid server_max_window_bits"));return}i=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=ikt({windowBits:i})}catch(o){n(o);return}this.#e[VQ]=[],this.#e[uS]=0,this.#e.on("data",o=>{if(this.#e[uS]+=o.length,this.#r>0&&this.#e[uS]>this.#r){n(new akt),this.#e.removeAllListeners(),this.#e=null;return}this.#e[VQ].push(o)}),this.#e.on("error",o=>{this.#e=null,n(o)})}this.#e.write(t),r&&this.#e.write(ckt),this.#e.flush(()=>{if(!this.#e)return;let i=Buffer.concat(this.#e[VQ],this.#e[uS]);this.#e[VQ].length=0,this.#e[uS]=0,n(null,i)})}};iRe.exports={PerMessageDeflate:AK}});var mRe=I((QPr,hRe)=>{"use strict";var{Writable:lkt}=z("node:stream"),ukt=z("node:assert"),{parserStates:ca,opcodes:eI,states:dkt,emptyBuffer:sRe,sentCloseFrameState:aRe}=GA(),{kReadyState:fkt,kSentClose:cRe,kResponse:lRe,kReceivedClose:uRe}=nS(),{channels:WQ}=ub(),{isValidStatusCode:pkt,isValidOpcode:hkt,failWebsocketConnection:ss,websocketMessageReceived:dRe,utf8Decode:mkt,isControlFrame:gK,isTextBinaryFrame:yK,isContinuationFrame:Akt}=sS(),{WebsocketFrameSend:fRe}=zQ(),{closeWebSocketConnection:gkt}=mK(),{PerMessageDeflate:ykt}=oRe(),{MessageSizeExceededError:pRe}=xr(),EK=class extends lkt{#e=[];#t=0;#r=0;#i=!1;#o=ca.INFO;#n={};#a=[];#s;#c;constructor(t,r,n={}){super(),this.ws=t,this.#s=r??new Map,this.#c=n.maxPayloadSize??0,this.#s.has("permessage-deflate")&&this.#s.set("permessage-deflate",new ykt(r,n))}_write(t,r,n){this.#e.push(t),this.#r+=t.length,this.#i=!0,this.run(n)}#l(){return this.#c>0&&!gK(this.#n.opcode)&&this.#n.payloadLength>this.#c?(ss(this.ws,"Payload size exceeds maximum allowed size"),!1):!0}run(t){for(;this.#i;)if(this.#o===ca.INFO){if(this.#r<2)return t();let r=this.consume(2),n=(r[0]&128)!==0,i=r[0]&15,o=(r[1]&128)===128,s=!n&&i!==eI.CONTINUATION,a=r[1]&127,c=r[0]&64,u=r[0]&32,d=r[0]&16;if(!hkt(i))return ss(this.ws,"Invalid opcode received"),t();if(o)return ss(this.ws,"Frame cannot be masked"),t();if(c!==0&&!this.#s.has("permessage-deflate")){ss(this.ws,"Expected RSV1 to be clear.");return}if(u!==0||d!==0){ss(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!yK(i)){ss(this.ws,"Invalid frame type was fragmented.");return}if(yK(i)&&this.#a.length>0){ss(this.ws,"Expected continuation frame");return}if(this.#n.fragmented&&s){ss(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((a>125||s)&&gK(i)){ss(this.ws,"Control frame either too large or fragmented");return}if(Akt(i)&&this.#a.length===0&&!this.#n.compressed){ss(this.ws,"Unexpected continuation frame");return}if(a<=125){if(this.#n.payloadLength=a,this.#o=ca.READ_DATA,!this.#l())return}else a===126?this.#o=ca.PAYLOADLENGTH_16:a===127&&(this.#o=ca.PAYLOADLENGTH_64);yK(i)&&(this.#n.binaryType=i,this.#n.compressed=c!==0),this.#n.opcode=i,this.#n.masked=o,this.#n.fin=n,this.#n.fragmented=s}else if(this.#o===ca.PAYLOADLENGTH_16){if(this.#r<2)return t();let r=this.consume(2);if(this.#n.payloadLength=r.readUInt16BE(0),this.#o=ca.READ_DATA,!this.#l())return}else if(this.#o===ca.PAYLOADLENGTH_64){if(this.#r<8)return t();let r=this.consume(8),n=r.readUInt32BE(0),i=r.readUInt32BE(4);if(n!==0||i>2**31-1){ss(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#n.payloadLength=i,this.#o=ca.READ_DATA,!this.#l())return}else if(this.#o===ca.READ_DATA){if(this.#r<this.#n.payloadLength)return t();let r=this.consume(this.#n.payloadLength);if(gK(this.#n.opcode))this.#i=this.parseControlFrame(r),this.#o=ca.INFO;else if(this.#n.compressed){this.#s.get("permessage-deflate").decompress(r,this.#n.fin,(n,i)=>{if(n){ss(this.ws,n.message);return}if(this.writeFragments(i),this.#c>0&&this.#t>this.#c){ss(this.ws,new pRe().message);return}if(!this.#n.fin){this.#o=ca.INFO,this.#i=!0,this.run(t);return}dRe(this.ws,this.#n.binaryType,this.consumeFragments()),this.#i=!0,this.#o=ca.INFO,this.run(t)}),this.#i=!1;break}else{if(this.writeFragments(r),this.#c>0&&this.#t>this.#c){ss(this.ws,new pRe().message);return}!this.#n.fragmented&&this.#n.fin&&dRe(this.ws,this.#n.binaryType,this.consumeFragments()),this.#o=ca.INFO}}}consume(t){if(t>this.#r)throw new Error("Called consume() before buffers satiated.");if(t===0)return sRe;if(this.#e[0].length===t)return this.#r-=this.#e[0].length,this.#e.shift();let r=Buffer.allocUnsafe(t),n=0;for(;n!==t;){let i=this.#e[0],{length:o}=i;if(o+n===t){r.set(this.#e.shift(),n);break}else if(o+n>t){r.set(i.subarray(0,t-n),n),this.#e[0]=i.subarray(t-n);break}else r.set(this.#e.shift(),n),n+=i.length}return this.#r-=t,r}writeFragments(t){this.#t+=t.length,this.#a.push(t)}consumeFragments(){let t=this.#a;if(t.length===1)return this.#t=0,t.shift();let r=Buffer.concat(t,this.#t);return this.#a=[],this.#t=0,r}parseCloseBody(t){ukt(t.length!==1);let r;if(t.length>=2&&(r=t.readUInt16BE(0)),r!==void 0&&!pkt(r))return{code:1002,reason:"Invalid status code",error:!0};let n=t.subarray(2);n[0]===239&&n[1]===187&&n[2]===191&&(n=n.subarray(3));try{n=mkt(n)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:r,reason:n,error:!1}}parseControlFrame(t){let{opcode:r,payloadLength:n}=this.#n;if(r===eI.CLOSE){if(n===1)return ss(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#n.closeInfo=this.parseCloseBody(t),this.#n.closeInfo.error){let{code:i,reason:o}=this.#n.closeInfo;return gkt(this.ws,i,o,o.length),ss(this.ws,o),!1}if(this.ws[cRe]!==aRe.SENT){let i=sRe;this.#n.closeInfo.code&&(i=Buffer.allocUnsafe(2),i.writeUInt16BE(this.#n.closeInfo.code,0));let o=new fRe(i);this.ws[lRe].socket.write(o.createFrame(eI.CLOSE),s=>{s||(this.ws[cRe]=aRe.SENT)})}return this.ws[fkt]=dkt.CLOSING,this.ws[uRe]=!0,!1}else if(r===eI.PING){if(!this.ws[uRe]){let i=new fRe(t);this.ws[lRe].socket.write(i.createFrame(eI.PONG)),WQ.ping.hasSubscribers&&WQ.ping.publish({payload:t})}}else r===eI.PONG&&WQ.pong.hasSubscribers&&WQ.pong.publish({payload:t});return!0}get closingInfo(){return this.#n.closeInfo}};hRe.exports={ByteParser:EK}});var bRe=I((LPr,ERe)=>{"use strict";var{WebsocketFrameSend:Ekt}=zQ(),{opcodes:ARe,sendHints:tI}=GA(),bkt=R6(),gRe=Buffer[Symbol.species],bK=class{#e=new bkt;#t=!1;#r;constructor(t){this.#r=t}add(t,r,n){if(n!==tI.blob){let o=yRe(t,n);if(!this.#t)this.#r.write(o,r);else{let s={promise:null,callback:r,frame:o};this.#e.push(s)}return}let i={promise:t.arrayBuffer().then(o=>{i.promise=null,i.frame=yRe(o,n)}),callback:r,frame:null};this.#e.push(i),this.#t||this.#i()}async#i(){this.#t=!0;let t=this.#e;for(;!t.isEmpty();){let r=t.shift();r.promise!==null&&await r.promise,this.#r.write(r.frame,r.callback),r.callback=r.frame=null}this.#t=!1}};function yRe(e,t){return new Ekt(Ikt(e,t)).createFrame(t===tI.string?ARe.TEXT:ARe.BINARY)}function Ikt(e,t){switch(t){case tI.string:return Buffer.from(e);case tI.arrayBuffer:case tI.blob:return new gRe(e);case tI.typedArray:return new gRe(e.buffer,e.byteOffset,e.byteLength)}}ERe.exports={SendQueue:bK}});var xRe=I((PPr,TRe)=>{"use strict";var{webidl:xt}=Lo(),{URLSerializer:Ckt}=na(),{environmentSettingsObject:IRe}=ka(),{staticPropertyDescriptors:Fp,states:dS,sentCloseFrameState:_kt,sendHints:KQ}=GA(),{kWebSocketURL:CRe,kReadyState:IK,kController:_Re,kBinaryType:ZQ,kResponse:wRe,kSentClose:wkt,kByteParser:vkt}=nS(),{isConnecting:Skt,isEstablished:Dkt,isClosing:Rkt,isValidSubprotocol:Tkt,fireEvent:vRe}=sS(),{establishWebSocketConnection:xkt,closeWebSocketConnection:SRe}=mK(),{ByteParser:kkt}=mRe(),{kEnumerableProperty:pc,isBlobLike:DRe}=rr(),{getGlobalDispatcher:Bkt}=pQ(),{types:RRe}=z("node:util"),{ErrorEvent:Nkt,CloseEvent:Okt}=Kb(),{SendQueue:Fkt}=bRe(),Ma=class e extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#r="";#i="";#o;constructor(t,r=[]){super(),xt.util.markAsUncloneable(this);let n="WebSocket constructor";xt.argumentLengthCheck(arguments,1,n);let i=xt.converters["DOMString or sequence<DOMString> or WebSocketInit"](r,n,"options");t=xt.converters.USVString(t,n,"url"),r=i.protocols;let o=IRe.settingsObject.baseUrl,s;try{s=new URL(t,o)}catch(c){throw new DOMException(c,"SyntaxError")}if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${s.protocol}`,"SyntaxError");if(s.hash||s.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof r=="string"&&(r=[r]),r.length!==new Set(r.map(c=>c.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(r.length>0&&!r.every(c=>Tkt(c)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[CRe]=new URL(s.href);let a=IRe.settingsObject;this[_Re]=xkt(s,r,a,this,(c,u)=>this.#n(c,u),i),this[IK]=e.CONNECTING,this[wkt]=_kt.NOT_SENT,this[ZQ]="blob"}close(t=void 0,r=void 0){xt.brandCheck(this,e);let n="WebSocket.close";if(t!==void 0&&(t=xt.converters["unsigned short"](t,n,"code",{clamp:!0})),r!==void 0&&(r=xt.converters.USVString(r,n,"reason")),t!==void 0&&t!==1e3&&(t<3e3||t>4999))throw new DOMException("invalid code","InvalidAccessError");let i=0;if(r!==void 0&&(i=Buffer.byteLength(r),i>123))throw new DOMException(`Reason must be less than 123 bytes; received ${i}`,"SyntaxError");SRe(this,t,r,i)}send(t){xt.brandCheck(this,e);let r="WebSocket.send";if(xt.argumentLengthCheck(arguments,1,r),t=xt.converters.WebSocketSendData(t,r,"data"),Skt(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!Dkt(this)||Rkt(this)))if(typeof t=="string"){let n=Buffer.byteLength(t);this.#t+=n,this.#o.add(t,()=>{this.#t-=n},KQ.string)}else RRe.isArrayBuffer(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},KQ.arrayBuffer)):ArrayBuffer.isView(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},KQ.typedArray)):DRe(t)&&(this.#t+=t.size,this.#o.add(t,()=>{this.#t-=t.size},KQ.blob))}get readyState(){return xt.brandCheck(this,e),this[IK]}get bufferedAmount(){return xt.brandCheck(this,e),this.#t}get url(){return xt.brandCheck(this,e),Ckt(this[CRe])}get extensions(){return xt.brandCheck(this,e),this.#i}get protocol(){return xt.brandCheck(this,e),this.#r}get onopen(){return xt.brandCheck(this,e),this.#e.open}set onopen(t){xt.brandCheck(this,e),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onerror(){return xt.brandCheck(this,e),this.#e.error}set onerror(t){xt.brandCheck(this,e),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}get onclose(){return xt.brandCheck(this,e),this.#e.close}set onclose(t){xt.brandCheck(this,e),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof t=="function"?(this.#e.close=t,this.addEventListener("close",t)):this.#e.close=null}get onmessage(){return xt.brandCheck(this,e),this.#e.message}set onmessage(t){xt.brandCheck(this,e),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get binaryType(){return xt.brandCheck(this,e),this[ZQ]}set binaryType(t){xt.brandCheck(this,e),t!=="blob"&&t!=="arraybuffer"?this[ZQ]="blob":this[ZQ]=t}#n(t,r){this[wRe]=t;let n=this[_Re]?.dispatcher?.webSocketOptions?.maxPayloadSize,i=new kkt(this,r,{maxPayloadSize:n});i.on("drain",Qkt),i.on("error",Lkt.bind(this)),t.socket.ws=this,this[vkt]=i,this.#o=new Fkt(t.socket),this[IK]=dS.OPEN;let o=t.headersList.get("sec-websocket-extensions");o!==null&&(this.#i=o);let s=t.headersList.get("sec-websocket-protocol");s!==null&&(this.#r=s),vRe("open",this)}};Ma.CONNECTING=Ma.prototype.CONNECTING=dS.CONNECTING;Ma.OPEN=Ma.prototype.OPEN=dS.OPEN;Ma.CLOSING=Ma.prototype.CLOSING=dS.CLOSING;Ma.CLOSED=Ma.prototype.CLOSED=dS.CLOSED;Object.defineProperties(Ma.prototype,{CONNECTING:Fp,OPEN:Fp,CLOSING:Fp,CLOSED:Fp,url:pc,readyState:pc,bufferedAmount:pc,onopen:pc,onerror:pc,onclose:pc,close:pc,onmessage:pc,binaryType:pc,send:pc,extensions:pc,protocol:pc,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(Ma,{CONNECTING:Fp,OPEN:Fp,CLOSING:Fp,CLOSED:Fp});xt.converters["sequence<DOMString>"]=xt.sequenceConverter(xt.converters.DOMString);xt.converters["DOMString or sequence<DOMString>"]=function(e,t,r){return xt.util.Type(e)==="Object"&&Symbol.iterator in e?xt.converters["sequence<DOMString>"](e):xt.converters.DOMString(e,t,r)};xt.converters.WebSocketInit=xt.dictionaryConverter([{key:"protocols",converter:xt.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:xt.converters.any,defaultValue:()=>Bkt()},{key:"headers",converter:xt.nullableConverter(xt.converters.HeadersInit)}]);xt.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return xt.util.Type(e)==="Object"&&!(Symbol.iterator in e)?xt.converters.WebSocketInit(e):{protocols:xt.converters["DOMString or sequence<DOMString>"](e)}};xt.converters.WebSocketSendData=function(e){if(xt.util.Type(e)==="Object"){if(DRe(e))return xt.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||RRe.isArrayBuffer(e))return xt.converters.BufferSource(e)}return xt.converters.USVString(e)};function Qkt(){this.ws[wRe].socket.resume()}function Lkt(e){let t,r;e instanceof Okt?(t=e.reason,r=e.code):t=e.message,vRe("error",this,()=>new Nkt("error",{error:e,message:t})),SRe(this,r)}TRe.exports={WebSocket:Ma}});var CK=I((MPr,kRe)=>{"use strict";function Pkt(e){return e.indexOf("\0")===-1}function Mkt(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}function Ukt(e){return new Promise(t=>{setTimeout(t,e).unref()})}kRe.exports={isValidLastEventId:Pkt,isASCIINumber:Mkt,delay:Ukt}});var FRe=I((UPr,ORe)=>{"use strict";var{Transform:$kt}=z("node:stream"),{isASCIINumber:BRe,isValidLastEventId:NRe}=CK(),Yd=[239,187,191],_K=10,XQ=13,qkt=58,jkt=32,wK=class extends $kt{state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(t={}){t.readableObjectMode=!0,super(t),this.state=t.eventSourceSettings||{},t.push&&(this.push=t.push)}_transform(t,r,n){if(t.length===0){n();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,t]):this.buffer=t,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===Yd[0]){n();return}this.checkBOM=!1,n();return;case 2:if(this.buffer[0]===Yd[0]&&this.buffer[1]===Yd[1]){n();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===Yd[0]&&this.buffer[1]===Yd[1]&&this.buffer[2]===Yd[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,n();return}this.checkBOM=!1;break;default:this.buffer[0]===Yd[0]&&this.buffer[1]===Yd[1]&&this.buffer[2]===Yd[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos<this.buffer.length;){if(this.eventEndCheck){if(this.crlfCheck){if(this.buffer[this.pos]===_K){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===_K||this.buffer[this.pos]===XQ){this.buffer[this.pos]===XQ&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(this.event.data!==void 0||this.event.event||this.event.id||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(this.buffer[this.pos]===_K||this.buffer[this.pos]===XQ){this.buffer[this.pos]===XQ&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0;continue}this.pos++}n()}parseLine(t,r){if(t.length===0)return;let n=t.indexOf(qkt);if(n===0)return;let i="",o="";if(n!==-1){i=t.subarray(0,n).toString("utf8");let s=n+1;t[s]===jkt&&++s,o=t.subarray(s).toString("utf8")}else i=t.toString("utf8"),o="";switch(i){case"data":r[i]===void 0?r[i]=o:r[i]+=`
|
|
224
224
|
${o}`;break;case"retry":BRe(o)&&(r[i]=o);break;case"id":NRe(o)&&(r[i]=o);break;case"event":o.length>0&&(r[i]=o);break}}processEvent(t){t.retry&&BRe(t.retry)&&(this.state.reconnectionTime=parseInt(t.retry,10)),t.id&&NRe(t.id)&&(this.state.lastEventId=t.id),t.data!==void 0&&this.push({type:t.event||"message",options:{data:t.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};ORe.exports={EventSourceStream:wK}});var jRe=I(($Pr,qRe)=>{"use strict";var{pipeline:Ykt}=z("node:stream"),{fetching:Hkt}=X0(),{makeRequest:zkt}=Hb(),{webidl:Hd}=Lo(),{EventSourceStream:Jkt}=FRe(),{parseMIMEType:Gkt}=na(),{createFastMessageEvent:Vkt}=Kb(),{isNetworkError:QRe}=K0(),{delay:Wkt}=CK(),{kEnumerableProperty:VA}=rr(),{environmentSettingsObject:LRe}=ka(),PRe=!1,MRe=3e3,fS=0,URe=1,pS=2,Kkt="anonymous",Zkt="use-credentials",rI=class e extends EventTarget{#e={open:null,error:null,message:null};#t=null;#r=!1;#i=fS;#o=null;#n=null;#a;#s;constructor(t,r={}){super(),Hd.util.markAsUncloneable(this);let n="EventSource constructor";Hd.argumentLengthCheck(arguments,1,n),PRe||(PRe=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),t=Hd.converters.USVString(t,n,"url"),r=Hd.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#a=r.dispatcher,this.#s={lastEventId:"",reconnectionTime:MRe};let i=LRe,o;try{o=new URL(t,i.settingsObject.baseUrl),this.#s.origin=o.origin}catch(c){throw new DOMException(c,"SyntaxError")}this.#t=o.href;let s=Kkt;r.withCredentials&&(s=Zkt,this.#r=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=LRe.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#t)],this.#o=zkt(a),this.#c()}get readyState(){return this.#i}get url(){return this.#t}get withCredentials(){return this.#r}#c(){if(this.#i===pS)return;this.#i=fS;let t={request:this.#o,dispatcher:this.#a},r=n=>{QRe(n)&&(this.dispatchEvent(new Event("error")),this.close()),this.#l()};t.processResponseEndOfBody=r,t.processResponse=n=>{if(QRe(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#l();return}let i=n.headersList.get("content-type",!0),o=i!==null?Gkt(i):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(n.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=URe,this.dispatchEvent(new Event("open")),this.#s.origin=n.urlList[n.urlList.length-1].origin;let a=new Jkt({eventSourceSettings:this.#s,push:c=>{this.dispatchEvent(Vkt(c.type,c.options))}});Ykt(n.body.stream,a,c=>{c?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=Hkt(t)}async#l(){this.#i!==pS&&(this.#i=fS,this.dispatchEvent(new Event("error")),await Wkt(this.#s.reconnectionTime),this.#i===fS&&(this.#s.lastEventId.length&&this.#o.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#c()))}close(){Hd.brandCheck(this,e),this.#i!==pS&&(this.#i=pS,this.#n.abort(),this.#o=null)}get onopen(){return this.#e.open}set onopen(t){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(t){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(t){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}},$Re={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:fS,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:URe,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:pS,writable:!1}};Object.defineProperties(rI,$Re);Object.defineProperties(rI.prototype,$Re);Object.defineProperties(rI.prototype,{close:VA,onerror:VA,onmessage:VA,onopen:VA,readyState:VA,url:VA,withCredentials:VA});Hd.converters.EventSourceInitDict=Hd.dictionaryConverter([{key:"withCredentials",converter:Hd.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:Hd.converters.any}]);qRe.exports={EventSource:rI,defaultReconnectionTime:MRe}});var vK=I((qPr,Rt)=>{"use strict";var Xkt=xb(),YRe=g0(),eBt=kb(),tBt=$we(),rBt=Bb(),nBt=G6(),iBt=dve(),oBt=gve(),HRe=xr(),tL=rr(),{InvalidArgumentError:eL}=HRe,nI=n0e(),sBt=E0(),aBt=T5(),cBt=M0e(),lBt=B5(),uBt=A5(),dBt=nQ(),{getGlobalDispatcher:zRe,setGlobalDispatcher:fBt}=pQ(),pBt=hQ(),hBt=z1(),mBt=J1();Object.assign(YRe.prototype,nI);Rt.exports.Dispatcher=YRe;Rt.exports.Client=Xkt;Rt.exports.Pool=eBt;Rt.exports.BalancedPool=tBt;Rt.exports.Agent=rBt;Rt.exports.ProxyAgent=nBt;Rt.exports.EnvHttpProxyAgent=iBt;Rt.exports.RetryAgent=oBt;Rt.exports.RetryHandler=dBt;Rt.exports.DecoratorHandler=pBt;Rt.exports.RedirectHandler=hBt;Rt.exports.createRedirectInterceptor=mBt;Rt.exports.interceptors={redirect:z0e(),retry:G0e(),dump:W0e(),dns:X0e()};Rt.exports.buildConnector=sBt;Rt.exports.errors=HRe;Rt.exports.util={parseHeaders:tL.parseHeaders,headerNameToString:tL.headerNameToString};function hS(e){return(t,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!t||typeof t!="string"&&typeof t!="object"&&!(t instanceof URL))throw new eL("invalid url");if(r!=null&&typeof r!="object")throw new eL("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new eL("invalid opts.path");let s=r.path;r.path.startsWith("/")||(s=`/${s}`),t=new URL(tL.parseOrigin(t).origin+s)}else r||(r=typeof t=="object"?t:{}),t=tL.parseURL(t);let{agent:i,dispatcher:o=zRe()}=r;if(i)throw new eL("unsupported opts.agent. Did you mean opts.client?");return e.call(o,{...r,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}Rt.exports.setGlobalDispatcher=fBt;Rt.exports.getGlobalDispatcher=zRe;var ABt=X0().fetch;Rt.exports.fetch=async function(t,r=void 0){try{return await ABt(t,r)}catch(n){throw n&&typeof n=="object"&&Error.captureStackTrace(n),n}};Rt.exports.Headers=qA().Headers;Rt.exports.Response=K0().Response;Rt.exports.Request=Hb().Request;Rt.exports.FormData=S0().FormData;Rt.exports.File=globalThis.File??z("node:buffer").File;Rt.exports.FileReader=mDe().FileReader;var{setGlobalOrigin:gBt,getGlobalOrigin:yBt}=W9();Rt.exports.setGlobalOrigin=gBt;Rt.exports.getGlobalOrigin=yBt;var{CacheStorage:EBt}=wDe(),{kConstruct:bBt}=FQ();Rt.exports.caches=new EBt(bBt);var{deleteCookie:IBt,getCookies:CBt,getSetCookies:_Bt,setCookie:wBt}=QDe();Rt.exports.deleteCookie=IBt;Rt.exports.getCookies=CBt;Rt.exports.getSetCookies=_Bt;Rt.exports.setCookie=wBt;var{parseMIMEType:vBt,serializeAMimeType:SBt}=na();Rt.exports.parseMIMEType=vBt;Rt.exports.serializeAMimeType=SBt;var{CloseEvent:DBt,ErrorEvent:RBt,MessageEvent:TBt}=Kb();Rt.exports.WebSocket=xRe().WebSocket;Rt.exports.CloseEvent=DBt;Rt.exports.ErrorEvent=RBt;Rt.exports.MessageEvent=TBt;Rt.exports.request=hS(nI.request);Rt.exports.stream=hS(nI.stream);Rt.exports.pipeline=hS(nI.pipeline);Rt.exports.connect=hS(nI.connect);Rt.exports.upgrade=hS(nI.upgrade);Rt.exports.MockClient=aBt;Rt.exports.MockPool=lBt;Rt.exports.MockAgent=cBt;Rt.exports.mockErrors=uBt;var{EventSource:xBt}=jRe();Rt.exports.EventSource=xBt});import{readFileSync as kBt,writeFileSync as BBt,renameSync as NBt,mkdirSync as OBt,unlinkSync as FBt,existsSync as QBt,openSync as LBt,fsyncSync as PBt,closeSync as MBt}from"fs";import{join as JRe}from"path";import{homedir as UBt}from"os";function mS(){return iI}function wu(){try{let e=kBt(iI,"utf-8"),t=JSON.parse(e);if(t.version===2)return t;if(t.apiKey){let r={version:2,active:"default",orgs:{default:{apiKey:t.apiKey,orgName:"Unknown (migrated)",orgId:"",currency:"",country:"",addedAt:t.createdAt??new Date().toISOString()}}};try{AS(r)}catch{}return r}return null}catch{return null}}function AS(e){OBt(GRe,{recursive:!0});let t=iI+".tmp";BBt(t,JSON.stringify(e,null,2)+`
|
|
225
|
-
`,{mode:384});let r=LBt(t,"r");try{PBt(r)}finally{MBt(r)}NBt(t,iI)}function hc(e){return wu()?.orgs[e]??null}function gS(e,t){let r=wu()??{version:2,active:"",orgs:{}};r.orgs[e]=t,(!r.active||Object.keys(r.orgs).length===1)&&(r.active=e),AS(r)}function SK(e){let t=wu();return!t||!(e in t.orgs)?!1:(delete t.orgs[e],t.active===e&&(t.active=""),AS(t),!0)}function bl(){return wu()?.active||null}function DK(e){let t=wu();if(!t)throw new Error("No credentials file found. Run `clio auth add <key>` first.");if(!(e in t.orgs)){let r=Object.keys(t.orgs).join(", ");throw new Error(`Org '${e}' not found. Available: ${r}`)}t.active=e,AS(t)}function vu(){return wu()?.orgs??{}}function RK(e){let t=wu();if(!t)return null;for(let[r,n]of Object.entries(t.orgs))if(n.apiKey===e)return r;return null}function TK(){return QBt(iI)?(FBt(iI),!0):!1}var GRe,iI,oI=G(()=>{"use strict";GRe=JRe(UBt(),".config","jaz-clio"),iI=JRe(GRe,"credentials.json")});function QK(e){Qp=e}function iL(){return Qp}function Jd(){return oL}function Lp(){return Ls}function zd(e){let t=process.env[e];if(t===void 0)return;let r=t.trim();if(r!==""&&!r.includes("${"))return r}function bS(e){let t=e.split(",").map(s=>s.trim()).filter(Boolean);if(t.length===0)throw new Xt("Empty key value. Provide a Jaz API key (jk-...) or personal access token (pat-...).");let r=t.filter(s=>s.startsWith(JE)),n=t.filter(s=>s.startsWith("jk-"));if(t.filter(s=>!s.startsWith(JE)&&!s.startsWith("jk-")).length>0)throw new Xt("Invalid key format (unrecognized prefix). Expected jk-... (API key) or pat-... (personal access token).");if(r.length>0&&n.length>0)throw new Xt("Cannot mix PAT and API keys. Use either a single personal access token (pat-...) or one or more API keys (jk-...).");if(r.length>0&&t.length!==1)throw new Xt("Only one personal access token allowed. Do not combine with other keys.");return r.length===1?[{mode:"pat",token:r[0]}]:[...new Set(n)].map(s=>({mode:"direct",apiKey:s}))}function sL(e){if(oL=null,Ls=null,e)return Ls="flag-api-key",bS(e)[0];if(Qp)return Ls="flag-org",sI(Qp);let t=zd("JAZ_API_KEY");if(t)return Ls="env-api-key",bS(t)[0];let r=zd("JAZ_ORG");if(r)return Ls="env-org",sI(r);let n=sTe(!1);if(n)return Ls="oauth-session",n;let i=bl();return i?(Ls="active-file",sI(i)):null}function sI(e){let t=e.startsWith("oauth:")?null:hc(e);if(t)return oL=e,{mode:"direct",apiKey:t.apiKey};let r=!1;try{let a=Td(e);if(a)return a}catch(a){let c=a.code;if(e.startsWith("oauth:")||c!==Wv&&c!==il)throw a;c===il&&OW(a.message),r=c===Wv}let n=wu(),i=n?Object.keys(n.orgs):[],o=i.length>0?` Available: ${i.join(", ")}.`:r?"":" No organizations are set up. Run `clio auth login` to sign in, or `clio auth add <key>` for API-key access.",s=r?" For an OAuth organization, run `clio auth organizations` and use --org oauth:<resourceId>.":"";throw new Xt(`Org '${e}' not found.${o}${s}`)}function sTe(e){try{return Td(void 0,e)}catch(t){throw t.code!==il?t:new Xt("The Jaz sign-in file (oauth.json) is unreadable or damaged: run `clio auth logout` to remove it, or pass --org <label>.",il)}}function aL(e){if(oL=null,Ls=null,Qp&&e||!Qp&&zd("JAZ_ORG")&&(e||zd("JAZ_API_KEY")))throw new Xt("An API-key override conflicts with organization selection. Remove the key override to use the selected organization, or remove the selector to use the key.");if(e)return Ls="flag-api-key",bS(e);if(Qp)return Ls="flag-org",[sI(Qp)];let t=zd("JAZ_API_KEY");if(t)return Ls="env-api-key",bS(t);let r=zd("JAZ_ORG");if(r)return Ls="env-org",[sI(r)];let n=sTe(!0);if(n)return Ls="oauth-session",[n];let i=bl();return i?(Ls="active-file",[sI(i)]):[]}function WA(e){let t=sL(e);if(!t)throw new Xt("No Jaz authentication configured. Run `clio auth login` to sign in, or use `clio auth add <key>`, JAZ_API_KEY, or --api-key for API-key access.");return t}var Qp,oL,Ls,IS=G(()=>{"use strict";EA();GE();oI();oL=null;Ls=null});function aTe(e){return e.replace(/\/[a-f0-9-]{8,}(?=[/?#]|$)/gi,"/{id}")}function LK(e,t){return`${t}\0${aTe(e)}`}function cTe(e,t=""){let r=KA.get(LK(e,t));if(!r||r.state==="closed")return;let n=Date.now(),i=aTe(e);if(r.state==="open"){if(n-r.lastFailure>3e4){r.state="half-open",r.probeStartedAt=n;return}let a=3e4-(n-r.lastFailure);throw new Pp(`Circuit open for ${i}: API endpoint appears down (${r.failures} consecutive failures). Retry in ${Math.ceil(a/1e3)}s.`,a)}let o=n-(r.probeStartedAt??0);if(o>3e4){r.probeStartedAt=n;return}let s=Math.max(1e3,3e4-o);throw new Pp(`Circuit half-open for ${i}: a probe request is testing whether the API endpoint has recovered. Retry in ${Math.ceil(s/1e3)}s at most.`,s)}function PK(e,t=""){KA.delete(LK(e,t))}function lTe(e,t=""){let r=LK(e,t),n=KA.get(r);if(!n){if(KA.size>=1e4){let i=KA.keys().next().value;i!==void 0&&KA.delete(i)}n={failures:0,lastFailure:0,state:"closed"},KA.set(r,n)}n.failures++,n.lastFailure=Date.now(),n.failures>=5&&(n.state="open")}var KA,Pp,cL=G(()=>{"use strict";KA=new Map,Pp=class extends Error{retryAfterMs;circuitOpen=!0;constructor(t,r){super(t),this.retryAfterMs=r,this.name="CircuitOpenError"}}});function Ei(e){return{retryNetworkErrors:!1,readBack:e}}var Qt,Hi,lL,uTe,dTe,uL,fTe,dL,fL,pTe,Mp,CS,hTe,_S,mTe,la,ATe,gTe,cI,pL,MK,dMr,fMr,Ar=G(()=>{"use strict";Qt={readOnly:!0};Hi=Ei("Search for the document before creating it again: by its reference when one was set, otherwise by contact, date and amount. A second create can book the same document twice; bills, supplier credit notes and manual journals accept a duplicate reference without an error."),lL=Ei("Search invoices or bills for the converted document (by the reference used, or the order's contact and date) before converting again: a second convert can create a second document."),uTe=Ei("Read the document's approvalStatus (get or search it) before approving again: the approval may already have posted the ledger."),dTe=Ei("Search background jobs for a recent bulk approve and read each document's approvalStatus before approving again: the batch may already be queued."),uL=Ei("List the document's payments (list_invoice_payments / list_bill_payments, or search_cashflow_transactions by reference) before paying again: a second payment would be recorded."),fTe=Ei("Search background jobs for a recent payments job, and search_cashflow_transactions by reference or date for the records, before recording again: a second submit records every payment twice."),dL=Ei("List the document's applied credits (list_invoice_credits / list_bill_credits) before applying again: a second application can consume more credit."),fL=Ei("List the credit note's refunds (list_customer_credit_note_refunds / list_supplier_credit_note_refunds) before refunding again: a second refund would be recorded."),pTe=Ei("Search employee payouts (search_employee_payouts) by reference or date before recording again: a second payout would be recorded."),Mp=Ei("Search scheduled transactions (search_scheduled_transactions) by reference before creating again: a second schedule would generate every document twice."),CS=Ei("Search fixed assets (search_fixed_assets) and read the asset's status before sending again: the asset may already be registered, disposed, sold or transferred."),hTe=Ei("Search the account's bank records (search_bank_records) by date and amount before adding again: a second add creates duplicate statement lines."),_S=Ei("Check for the workflow or draft this upload started (get_magic_workflow_status, or search the drafts newest first) before uploading again. Extraction runs in the background, so a draft not there yet may still be processing: a second upload creates a second draft."),mTe=Ei("List the threads on the record and look for your comment text before posting again: a second send posts the comment twice."),la=Ei("Read the bank record's status (search_bank_records) before reconciling again: it may already be reconciled, with its transaction created."),ATe=Ei("Read it back with search_unapplied_payments (CLI: clio unapplied-payments search) before sending this again. Missing from that search may mean it became a batch payment (all its cash applied): check the batch-payment search with origin BATCH or ALL."),gTe=Ei("Search journals (search_journals) for a transfer trial balance on that date before creating again: a second one doubles every opening balance."),cI=Ei("Search background jobs (search_background_jobs) for a recent job of this type before submitting again: every row without a resourceId would be created twice."),pL=Ei("Search claims (search_claims) by reference, employee and date, or search_journals for the conversion, before sending again: a second send can create a second claim or journal."),MK=Ei("List the report templates (list_organization_report_templates) and look for this one by name before sending again: the first send may already have created or deleted it."),dMr=Ei("Call get_background_tasks before adding the note again: it does not list notes, and a second add_to_background_task call stores the note twice. If the task is still PAUSED or RESUMING, tell the user the change could not be confirmed and add it again only if they ask."),fMr=Ei("Call get_background_tasks before cancelling again: a task no longer listed was cancelled or has finished, and a task still PAUSED was not cancelled and can be cancelled again.")});import{AsyncLocalStorage as WBt}from"node:async_hooks";function ETe(){let e=yTe.getStore();e&&(e.sent=!0,e.writes=(e.writes??0)+1)}function bTe(){let e=yTe.getStore();e&&(e.refused=(e.refused??0)+1)}var yTe,ITe=G(()=>{"use strict";yTe=new WBt});import{createHash as KBt}from"node:crypto";function RTe(e){DTe=e}function _Te(e){if(Array.isArray(e)){let t=e;return{data:t,totalElements:t.length,totalPages:t.length?1:0}}if(e.data||(e.data=[]),e.totalElements===void 0){let t=e.pagination?.total;e.totalElements=typeof t=="number"?t:e.data.length}return e.totalPages===void 0&&(e.totalPages=e.data.length?1:0),e}function nNt(e,t){if(t.baseUrl!==void 0)return t.baseUrl;if(e.mode==="direct"){let r=process.env.JAZ_API_URL;if(r!==void 0){let n=r.trim();if(n!==""&&!n.includes("${"))return n}}return ZBt}function oNt(e){let t=jK.get(e);return t===void 0?!1:t>Date.now()-iNt?!0:(jK.delete(e),!1)}function wTe(e,t){return t.aborted?Promise.reject(t.reason):new Promise((r,n)=>{let i=()=>n(t.reason);t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})})}function vTe(e){try{return e&&JSON.parse(e)}catch{return e}}function $K(e,t,r){return Date.now()-e+t<r}function STe(e,t){return new Promise(r=>{if(t?.aborted){r();return}let n=()=>{clearTimeout(i),r()},i=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e);t?.addEventListener("abort",n,{once:!0})})}function qK(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.message=="string")return t.message;if(typeof t.error=="string")return t.error;if(t.error&&typeof t.error=="object"){let r=t.error;if(Array.isArray(r.errors)&&r.errors.length>0)return r.errors.join("; ");if(typeof r.error_type=="string")return r.error_type}return JSON.stringify(e)}return String(e)}var ZBt,XBt,eNt,tNt,rNt,CTe,DTe,gr,Gd,UK,Hn,iNt,jK,zi=G(()=>{"use strict";cL();kW();Ar();ITe();ZBt="https://api.getjaz.com",XBt=3e4,eNt=3,tNt=[429],rNt=[500,502,503],CTe=5e3,DTe="0.0.0";gr=class extends Error{status;body;endpoint;retryAfterMs;refusal;constructor(t,r,n,i,o){super(t),this.status=r,this.body=n,this.endpoint=i,this.retryAfterMs=o,this.name="JazApiError"}},Gd=class extends Error{endpoint;readBack;unconfirmed=!0;constructor(t,r,n,i){super(t,i),this.endpoint=r,this.readBack=n,this.name="UnconfirmedWriteError"}},UK="Read the record back (search for it) before sending this again: a second send can create a duplicate.";Hn=class{baseUrl;timeout;maxRetries;auth;onRequest;channel;requestId;constructor(t,r,n={}){this.auth=t,this.channel=r,this.baseUrl=nNt(t,n).replace(/\/$/,""),this.timeout=n.timeout??XBt,this.maxRetries=n.maxRetries??eNt,this.onRequest=n.onRequest,this.requestId=n.requestId&&n.requestId!=="none"?n.requestId:void 0}get isPatAuth(){return this.auth.mode==="pat"}get scopeKey(){let t=this.auth,r=t.mode==="direct"?`direct:${t.apiKey}`:t.mode==="pat"?`pat:${t.orgId??""}:${t.token}`:`delegated:${t.orgId}:${t.userId}:${t.orgUserId??""}`;return KBt("sha256").update(r).digest("hex").slice(0,24)}emitRequestEvent(t){try{this.onRequest?.(t)}catch{}}buildHeaders(t){let r={"Content-Type":"application/json","User-Agent":`jaz-clio/${DTe} (${this.channel})`,...t};switch(this.requestId&&(r["x-request-id"]=this.requestId),this.auth.mode){case"direct":r["x-jk-api-key"]=this.auth.apiKey;break;case"pat":r.Authorization=`Bearer ${this.auth.token}`,this.auth.orgId&&(r["\u0078\u002d\u0074\u0069\u006e\u0076\u0069\u006f\u002d\u006f\u0064\u0069\u006e\u002d\u006f\u0072\u0067\u002d\u006b\u0065\u0079"]=this.auth.orgId);break;case"delegated":this.auth.orgUserId?(r["x-channel-key"]=this.auth.adminKey,r["\u0078\u002d\u0074\u0069\u006e\u0076\u0069\u006f\u002d\u006f\u0064\u0069\u006e\u002d\u006f\u0072\u0067\u002d\u006b\u0065\u0079"]=this.auth.orgId,r["x-jaz-org-user-key"]=this.auth.orgUserId):(r["x-clio-admin-key"]=this.auth.adminKey,r["x-user-id"]=this.auth.userId,r["x-org-id"]=this.auth.orgId);break}return r}async request(t,r,n={}){let i=new URL(`${this.baseUrl}${r}`);if(n.query)for(let[T,R]of Object.entries(n.query))R!==void 0&&i.searchParams.set(T,String(R));let o=n.timeoutMs??this.timeout,s=AbortSignal.timeout(o),a=Date.now(),c=this.buildHeaders(n.headers),u=this.auth.mode==="pat"?this.auth.tokenProvider:void 0,d=this.auth.mode==="pat"?this.auth.orgId:void 0,f=u?await wTe(u(void 0,d),s):void 0;f!==void 0&&(c.Authorization=`Bearer ${f}`),n.raw&&delete c["Content-Type"];let p={method:t,headers:c,signal:s};n.body!==void 0&&t!=="GET"&&(p.body=n.raw?n.body:JSON.stringify(n.body));let h=this.scopeKey;cTe(r,h);let m,A=["GET","HEAD"].includes(t)||n.readOnly===!0,g,y=0,b=`${h}|${t} ${r}`,E=!1,C=!1,w;for(let T=0;T<=this.maxRetries;T++){let R=Date.now();try{A||(E&&w!==429&&(C=!0),E||ETe(),E=!0,w=void 0);let k=await fetch(i.toString(),p);A||(w=k.status);let O=tNt.includes(k.status)||A&&rNt.includes(k.status),J=EF({headers:k.headers});if(O&&T<this.maxRetries){let j=J??Math.min(1e3*2**T,8e3),N=!A&&n.retryNetworkErrors===!1?Math.max(CTe,o/3):0;if($K(a,j+N,o)){let P="";try{P=await k.text()}catch{}let W=vTe(P);g=new gr(`${t} ${r} \u2192 ${k.status}: ${qK(W)}`,k.status,W,r,J),m=void 0,this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!0}),await STe(j,s);continue}}if(!k.ok){let j=!A&&n.retryNetworkErrors===!1,S=Math.max(CTe,o/3),N=oNt(b);if(k.status===401&&y>0&&jK.set(b,Date.now()),k.status===401&&u&&y===0&&!N&&(j||$K(a,S,o))){y++;let W=f;await k.body?.cancel(),this.emitRequestEvent({method:t,path:r,statusCode:401,durationMs:Date.now()-R,attempt:T,retried:!j});let B;try{c.Authorization=`Bearer ${await wTe(u(W,d),s)}`}catch(Y){B=Y}if(j){let Y=B?`the sign-in could not be refreshed (${B.message})`:"the sign-in was refreshed";throw new Gd(`${t} ${r} \u2192 401: ${Y}, and the write was not sent again because the API may have acted before refusing.`,r,n.readBack??UK,{cause:B})}if(B){m=B;break}T--;continue}let P=vTe(await k.text());throw this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!1,error:qK(P)}),k.status>=500?lTe(r,h):PK(r,h),!A&&!C&&k.status>=400&&k.status<500&&k.status!==401&&bTe(),new gr(`${t} ${r} \u2192 ${k.status}: ${qK(P)}`,k.status,P,r,J)}if(this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!1}),PK(r,h),k.status===204)return;try{if(n.emptyBodyOk){let j=await k.text();return j.trim()===""?void 0:JSON.parse(j)}return await k.json()}catch(j){throw A?j:new Gd(`${t} ${r} \u2192 ${k.status}, but the answer could not be read (${j.message}). It was not sent again.`,r,n.readBack??UK,{cause:j})}}catch(k){if(k instanceof gr||k instanceof Gd)throw k;if(s.aborted&&T>0&&A){if(g)throw g;if(m){let j=new Error(`${t} ${r}: no answer within ${o} ms. The attempt before the last failed with: ${m.message}`,{cause:m});throw j.name="TimeoutError",j}}m=k,g=void 0;let O=Math.min(1e3*2**T,8e3),J=n.retryNetworkErrors!==!1&&T<this.maxRetries&&$K(a,O,o);if(this.emitRequestEvent({method:t,path:r,statusCode:0,durationMs:Date.now()-R,attempt:T,retried:J,error:m.message}),!J){if(n.retryNetworkErrors===!1)throw new Gd(`${t} ${r}: no answer arrived (${m.message}). The write may or may not have happened; it was not sent again.`,r,n.readBack??UK,{cause:m});break}await STe(O,s)}}throw m??new Error(`Request failed: ${t} ${r}`)}async get(t,r,n){return this.request("GET",t,{query:r,...n?.timeoutMs!==void 0?{timeoutMs:n.timeoutMs}:{}})}async post(t,r,n){return this.request("POST",t,{body:r,headers:n?.headers,...n?.query!==void 0?{query:n.query}:{},...n?.timeoutMs!==void 0?{timeoutMs:n.timeoutMs}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{},...n?.readOnly!==void 0?{readOnly:n.readOnly}:{},...n?.emptyBodyOk!==void 0?{emptyBodyOk:n.emptyBodyOk}:{}})}async put(t,r,n){return this.request("PUT",t,{body:r,headers:n?.headers,...n?.query!==void 0?{query:n.query}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async delete(t,r,n){return this.request("DELETE",t,{query:r,...n?.body!==void 0?{body:n.body}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async postMultipart(t,r,n){return this.request("POST",t,{body:r,raw:!0,...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async list(t,r,n){let i=await this.get(t,{...n,limit:r?.limit??100,offset:r?.offset??0,...r?.view?{view:r.view}:{}});return _Te(i)}async search(t,r){let n={};r.query&&(n.query=r.query),r.filter&&(n.filter=r.filter),r.limit!==void 0&&(n.limit=r.limit),r.offset!==void 0&&(n.offset=r.offset),r.view&&(n.view=r.view),r.magicSort&&(n.magicSort=r.magicSort),r.transactionType&&(n.transactionType=r.transactionType),r.multiContactOnly!==void 0&&(n.multiContactOnly=r.multiContactOnly),r.origin&&(n.origin=r.origin),r.sort?n.sort=r.sort:r.offset!==void 0&&(n.sort={sortBy:["createdAt"],order:"DESC"});let i=await this.post(t,n,Qt);return _Te(i)}async listAll(t,r=200){let n=[],i=0,o=!0;for(;o;){let s=await this.list(t,{limit:r,offset:i});if(n.push(...s.data),s.data.length<r)break;i+=1,o=i*r<s.totalElements}return n}};iNt=5*6e4,jK=new Map});async function as(e){let t=await e.get("/api/v1/organization");return Array.isArray(t.data)?t.data[0]:t.data}async function ZA(e){let t=await e.get("/api/v1/me/organizations"),r=t.boundOrganizationResourceId;return{organizations:Array.isArray(t.data)?t.data:[],boundOrganizationResourceId:r===null?"":r}}async function TTe(e){return(await ZA(e)).organizations}async function xTe(e){return(await e.get("/api/v1/me")).data}var Vd=G(()=>{"use strict"});function Il(e){return Object.hasOwn(PTe,e)?PTe[e]:void 0}function lI(e){return Object.entries(hNt).filter(([t])=>e[t]!==void 0&&e[t]!==null).map(([,t])=>t)}var hL,LTe,PTe,hNt,XA=G(()=>{"use strict";hL="Recipes were removed. Use calculate for the schedule and journal lines, then post with create_capsule and create_journal / create_bill / create_invoice / create_cash_in / create_cash_out (each with capsuleResourceId).",LTe="Recipe job tools were removed and have no replacement: calculate cannot resume or undo an existing recipe job. Tell the user this job cannot be managed from here.",PTe={plan_recipe:"plan_recipe was removed: use calculate (same inputs, `type` replaces `recipe`).",execute_recipe:hL,list_capsule_recipes:hL,get_capsule_recipe:hL,preview_capsule_recipe:hL,resume_capsule_recipe:LTe,rollback_capsule_recipe:LTe},hNt={capsuleRecipe:"capsuleRecipe is no longer available. Remove it. To group transactions, create a capsule (create_capsule) and pass capsuleResourceId; use calculate for the schedule."}});var ht,vo=G(()=>{"use strict";ht=class extends Error{constructor(t){super(t),this.name="ValidationError"}}});function UTe(e){let t=String(e).trim().toUpperCase().replace(/[\s-]+/g,"_"),r=/^(?:NET_?)?(\d+)$/.exec(t)?.[1],n=r===void 0?YK.find(i=>i===t&&i!=="CUSTOM"):MTe[Number(r)];if(n)return n;throw new ht(`payment terms "${e}" is not a term a single contact can take. Use ON_DELIVERY, NET_7, NET_15, NET_30, NET_45 or NET_60 (any case), or 0, 7, 15, 30, 45 or 60 days. For any other number of days, bulk-upsert the contact with customerPaymentTerms {name: "CUSTOM", value: "<days>"}.`)}function $Te(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return e;let{name:n,value:i}=e;if(typeof n!="string"||n.trim()==="")return e;if(n.trim().toUpperCase()!=="CUSTOM")return{name:n};let o=i==null?"":String(i).trim();if(!/^\d+$/.test(o)||Number(o)<=0)throw new ht(`row ${t}: ${r}.value must be a positive whole number of days when ${r}.name is CUSTOM (got ${JSON.stringify(i??null)}); the API rejects the WHOLE batch otherwise`);return{name:n,value:o}}function qTe(e){if(!e||typeof e!="object")return;let{name:t,value:r}=e,n=r==null?"":String(r).trim();if(!/^\d+$/.test(n))return;let i=typeof t=="string"&&t.trim().toUpperCase()==="CUSTOM",o=MTe[Number(n)];return!i&&o?{name:o}:Number(n)>0?{name:"CUSTOM",value:n}:void 0}var YK,MTe,wS=G(()=>{"use strict";vo();YK=["ON_DELIVERY","NET_7","NET_15","NET_30","NET_45","NET_60","CUSTOM"],MTe={0:"ON_DELIVERY",7:"NET_7",15:"NET_15",30:"NET_30",45:"NET_45",60:"NET_60"}});var zTe={};Qo(zTe,{collectValue:()=>tg,parseCustomFields:()=>pn,parseJournalEntries:()=>mc,parseJsonArray:()=>Ac,parseJsonObject:()=>AL,parseLineItems:()=>zn,parseMoney:()=>Vt,parseNonNegativeInt:()=>rt,parseOrderTerms:()=>eg,parsePaymentTerms:()=>uI,parsePositiveInt:()=>be,parseRate:()=>ri,parseTaxRatePercent:()=>mL,readBodyInput:()=>_e,requireFields:()=>Pe,splitCsv:()=>io,todayLocal:()=>HK});import{readFileSync as jTe}from"node:fs";function be(e){let t=String(e).trim(),r=Number.parseInt(t,10);return(!HTe.test(t)||!Number.isSafeInteger(r)||r<=0)&&(console.error(ne(`Error: invalid positive integer: ${e}`)),process.exit(1)),r}function rt(e){let t=String(e).trim(),r=Number.parseInt(t,10);return(!HTe.test(t)||!Number.isSafeInteger(r)||r<0)&&(console.error(ne(`Error: invalid non-negative integer: ${e}`)),process.exit(1)),r}function eg(e){let t=Number.parseInt(e,10);return(!Number.isFinite(t)||![0,7,15,30,45,60].includes(t))&&(console.error(ne(`Error: terms must be one of 0, 7, 15, 30, 45, 60 (got: ${e})`)),process.exit(1)),t}function uI(e){try{return UTe(e)}catch(t){console.error(ne(`Error: ${t.message}`)),process.exit(1)}}function Vt(e){return/^-?\d+(\.\d{1,2})?$/.test(e)||(console.error(ne(`Error: invalid amount: ${e} (max 2 decimal places)`)),process.exit(1)),Math.round(Number(e)*100)/100}function ri(e){let t=Number(e);return(!Number.isFinite(t)||t<=0)&&(console.error(ne(`Error: invalid exchange rate: ${e}`)),process.exit(1)),t}function mL(e){let t=String(e).trim(),r=Number(t);return(t===""||!Number.isFinite(r)||r<0||r>100)&&(console.error(ne(`Error: invalid tax rate percentage: ${e} (expected 0-100)`)),process.exit(1)),r}function zn(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Line items must be a JSON array");return t}catch{console.error(ne("Error: --lines must be valid JSON array")),console.error($(`Example: --lines '[{"name":"Service","quantity":1,"unitPrice":100,"accountResourceId":"..."}]'`)),console.error($("Tip: pipe the full request body via stdin, or use --input <file>")),process.exit(1)}}function mc(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Entries must be a JSON array");return t}catch{console.error(ne("Error: --entries must be valid JSON array")),console.error($(`Example: --entries '[{"accountResourceId":"...","amount":100,"type":"DEBIT"},...]'`)),console.error($("Tip: pipe the full request body via stdin, or use --input <file>")),process.exit(1)}}function pn(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Must be a JSON array");return t}catch{console.error(ne("Error: --custom-fields must be valid JSON array")),console.error($(`Example: --custom-fields '[{"customFieldName":"PO Number","actualValue":"PO-123"}]'`)),process.exit(1)}}function tg(e,t=[]){return t.push(e),t}function AL(e,t){try{let r=JSON.parse(e);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("not an object");return r}catch{return console.error(ne(`Error: ${t} must be a valid JSON object`)),process.exit(1),{}}}function YTe(e){let t=lI(e);return t.length>0&&(console.error(ne(`Error: ${t.join("; ")}`)),process.exit(1)),e}function _e(e){if(e.input){let t;try{t=jTe(e.input,"utf-8")}catch{console.error(ne(`Error: cannot read file: ${e.input}`)),process.exit(1)}try{let r=JSON.parse(t);return(typeof r!="object"||r===null||Array.isArray(r))&&(console.error(ne("Error: --input file must contain a JSON object")),process.exit(1)),YTe(r)}catch{console.error(ne("Error: --input file contains invalid JSON")),process.exit(1)}}if(!process.stdin.isTTY)try{let t=jTe(0,"utf-8").trim();if(t){let r=JSON.parse(t);return(typeof r!="object"||r===null||Array.isArray(r))&&(console.error(ne("Error: stdin must contain a JSON object")),process.exit(1)),YTe(r)}}catch(t){t.message?.includes("JSON")&&(console.error(ne("Error: stdin contains invalid JSON")),process.exit(1))}return null}function Pe(e,t){let r=t.filter(n=>e[n.key]===void 0);if(r.length>0){let n=r.map(i=>i.flag).join(", ");console.error(ne(`Error: missing required option(s): ${n}`)),console.error($("Provide flags, or pipe JSON via stdin, or use --input <file>")),process.exit(1)}}function io(e){if(e!==void 0)return e.split(",").map(t=>t.trim()).filter(Boolean)}function Ac(e,t){let r;try{r=JSON.parse(e)}catch{throw new Error(`Invalid JSON for ${t}: ${e.slice(0,80)}`)}if(!Array.isArray(r))throw new Error(`${t} must be a JSON array (got ${typeof r}).`);return r}function HK(){let e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`}var HTe,yt=G(()=>{"use strict";Ne();XA();wS();HTe=/^[+-]?\d+$/});async function So(e,t,r,n){return e.post(t,{[r]:n},cI)}function Ut(e,t,r=500,n=t){if(!Array.isArray(e))throw new he(`${t} must be an array.`);if(e.length===0)throw new he(`${t} array is empty.`);if(e.length>r)throw new he(`max ${r} ${n} per call (got ${e.length}). Split into batches.`)}function Cl(e,t){e.forEach((r,n)=>{if(!r||typeof r!="object")return;let i=r;if("dateFormat"in i)throw new he(`row ${n}: dateFormat field is no longer supported (ISO 8601 YYYY-MM-DD only)`);for(let o of t){let s=i[o];if(s!=null&&(typeof s!="string"||!mNt.test(s)))throw new he(`row ${n}: ${o} must be YYYY-MM-DD (got ${JSON.stringify(s)})`)}})}function ANt(e,t){e.forEach((r,n)=>{zK(r,"bulk-upsert",n);let i=r[t];if(!(typeof i=="string"&&i.trim()!==""))throw new he(`row ${n}: ${t} is required on every bulk-upsert transaction row (ISO 4217, e.g. "SGD") \u2014 without it the job fails the row with IMPORT_CURRENCY_REQUIRED`)})}function dI(e,t){if(!t.some(([n])=>n in e))return e;let r={...e};for(let[n,i]of t){if(!(n in r))continue;let o=r[n];delete r[n],o!==void 0&&(i in r||(r[i]=o))}return r}function zK(e,t,r){if(!e||typeof e!="object"||Array.isArray(e)){let n=r===void 0?"":`row ${r}: `;throw new he(`${n}each ${t} row must be an object (got ${e===null?"null":typeof e})`)}return e}function gNt(e){return dI(e,JTe)}function bNt(e){return!e||typeof e!="object"||Array.isArray(e)?e:dI(e,VTe)}function yL(e){return dI(zK(e,"item"),gL)}function WTe(e){return e.map((t,r)=>{let n=zK(t,"contact",r),i=dI(n,GTe),o=i===n?{...n}:i;if("emails"in o){let s=o.emails;!("emailList"in o)&&Array.isArray(s)&&(o.emailList=s.map(a=>typeof a=="string"?{email:a,label:"Contact Email"}:a)),delete o.emails}for(let s of["customerPaymentTerms","supplierPaymentTerms"])s in o&&(o[s]=$Te(o[s],r,s));if(typeof o.status=="string"&&o.status.trim().toUpperCase()==="INACTIVE")throw new he(`row ${r}: status INACTIVE is not applied by bulk upsert (the job reports SUCCESS and drops the row); the API has no working route that deactivates a contact`);for(let s of["billingAddress","deliveryAddress"]){if(!(s in o))continue;o[s]=bNt(o[s]);let a=o[s];if(a&&typeof a=="object"&&!Array.isArray(a)){let c=ENt.filter(u=>!a[u]);if(c.length>0)throw new he(`row ${r}: ${s} requires ${c.join(" and ")} \u2014 the API rejects the WHOLE batch with 422 otherwise`)}}return o})}function Up(e){return ANt(e,"currencyCode"),e.map(gNt)}function KTe(e,t){e.forEach((r,n)=>{if(!r||typeof r!="object")return;let i=r;for(let o of t){let s=i[o];if(s!=null&&(typeof s!="number"||!Number.isFinite(s)))throw new he(`row ${n}: ${o} must be epoch milliseconds on this endpoint, not a date string (got ${JSON.stringify(s)}) \u2014 e.g. 1745107200000`)}})}var mNt,JTe,yNt,GTe,VTe,ENt,gL,JK,HMr,Cn=G(()=>{"use strict";ut();wS();Ar();mNt=/^\d{4}-\d{2}-\d{2}$/;JTe=[["currencyCode","transactionCurrency"]];yNt=["BulkUpsertCustomerCreditNote","BulkUpsertLineItemBill","BulkUpsertLineItemInvoice","BulkUpsertSupplierCreditNote"],GTe=[["billingName","contactBillingName"],["currencyCode","currency"],["registrationNumber","registrationId"],["notes","customerInvoiceNotes"],["shippingAddress","deliveryAddress"]],VTe=[["address","addressLine1"]],ENt=["addressLine1","country"];gL=[["saleTaxProfileResourceId","saleTaxProfile"],["purchaseTaxProfileResourceId","purchaseTaxProfile"],["purchasePrice","purchaseItemPrice"]];JK=[["contactResourceIds","associatedContactResourceIds"]],HMr=[["BulkUpsertContact",GTe],["UpdateContactGroupClientRequest",JK],["BulkUpsertContactAddress",VTe],["BulkUpsertItemRequestItem",gL],["CreateItemClientRequest",gL],["UpdateItemClientRequest",gL],...yNt.map(e=>[e,JTe])]});async function exe(e,t,r){return e.get(`/api/v1/contacts/${t}/signals`,{btType:r})}async function fI(e,t){return e.list("/api/v1/contacts",t)}async function _l(e,t){return e.search("/api/v1/contacts/search",t)}async function pI(e,t){return e.post("/api/v1/contacts",t)}async function EL(e,t,r){return e.put(`/api/v1/contacts/${t}`,r)}async function rg(e,t){return e.get(`/api/v1/contacts/${t}`)}async function bL(e,t){await e.delete(`/api/v1/contacts/${t}`)}async function IL(e,t){return So(e,"/api/v1/contacts/bulk-upsert","contacts",await INt(e,WTe(t)))}async function INt(e,t){let r=o=>typeof o.resourceId=="string"&&ZTe.some(s=>!(s in o)),n=[...new Set(t.filter(r).map(o=>o.resourceId))];if(n.length===0)return t;let i=new Map;for(let o=0;o<n.length;o+=XTe){let s=n.slice(o,o+XTe),a=await _l(e,{filter:{resourceId:{in:s}},limit:s.length});for(let c of a.data)i.set(c.resourceId,c)}return t.map(o=>{if(!r(o))return o;let s=i.get(o.resourceId)?.paymentDetail,a={...o};for(let c of ZTe){if(c in a)continue;let u=qTe(s?.[c]?.[0]);u&&(a[c]=u)}return a})}var ZTe,XTe,ng=G(()=>{"use strict";Cn();wS();ZTe=["customerPaymentTerms","supplierPaymentTerms"],XTe=100});function Su(e){if(e===null||typeof e!="object"||Array.isArray(e))return e;let r={...e};if(r.organizationAccountResourceId!==void 0&&(r.accountResourceId===void 0&&(r.accountResourceId=r.organizationAccountResourceId),delete r.organizationAccountResourceId),r.discount!==null&&typeof r.discount=="object"&&!Array.isArray(r.discount)){let n=r.discount;r.discount=n.rateValue??0}if(r.taxProfile!==null&&typeof r.taxProfile=="object"&&!Array.isArray(r.taxProfile)){let n=r.taxProfile;r.taxProfileResourceId===void 0&&n.resourceId!==void 0&&(r.taxProfileResourceId=n.resourceId),delete r.taxProfile}return r}function hI(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.code==null||t.rate==null)return;let r={code:t.code,rate:t.rate};return t.type!=null&&(r.type=t.type),t.description!=null&&(r.description=t.description),r}function gc(e){let t={};e.name!=null&&(t.name=e.name),e.quantity!=null&&(t.quantity=e.quantity),e.unitPrice!=null&&(t.unitPrice=e.unitPrice),e.unit&&(t.unit=e.unit);let r=e.accountResourceId||e.organizationAccountResourceId;r&&(t.accountResourceId=r);let n=e.taxProfileResourceId||(e.taxProfile&&typeof e.taxProfile=="object"?e.taxProfile.resourceId:null);n&&(t.taxProfileResourceId=n),e.itemResourceId&&(t.itemResourceId=e.itemResourceId),e.discount!=null&&(t.discount=typeof e.discount=="object"?e.discount.rateValue??0:e.discount);let i=hI(e.withholdingTax);return i&&(t.withholdingTax=i),t}function mI(e){let t={},r=e.accountResourceId||e.organizationAccountResourceId;r&&(t.accountResourceId=r),e.amount!=null?t.amount=e.amount:e.debitAmount!=null&&e.debitAmount>0?t.amount=e.debitAmount:e.creditAmount!=null&&e.creditAmount>0&&(t.amount=e.creditAmount),e.type?t.type=e.type:e.debitAmount!=null&&e.debitAmount>0?t.type="DEBIT":e.creditAmount!=null&&e.creditAmount>0&&(t.type="CREDIT"),e.description&&(t.description=e.description);let n=e.taxProfileResourceId||(e.taxProfile&&typeof e.taxProfile=="object"?e.taxProfile.resourceId:null);return n&&(t.taxProfileResourceId=n),Array.isArray(e.classifierConfig)&&e.classifierConfig.length&&(t.classifierConfig=e.classifierConfig.map(CNt)),t}function CNt(e){let t={};for(let r of["resourceId","type","printable"])e?.[r]!=null&&(t[r]=e[r]);return Array.isArray(e?.selectedClasses)&&(t.selectedClasses=e.selectedClasses.map(r=>{let n={};for(let i of["className","resourceId","entityResourceId"])r?.[i]!=null&&(n[i]=r[i]);return n})),t}function Lt(e){if(e)return e.split("T")[0]}var $p=G(()=>{"use strict"});async function CL(e,t){return e.list("/api/v1/bills",t)}async function oo(e,t){return e.get(`/api/v1/bills/${t}`)}async function Kd(e,t){return e.search("/api/v1/bills/search",t)}async function vS(e,t){return e.post("/api/v1/bills",{...t,currency:zt(t.currency),taxCurrency:zt(t.taxCurrency),saveAsDraft:t.saveAsDraft??!0},Hi)}async function _L(e,t,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(Su)}:r;return e.put(`/api/v1/bills/${t}`,n)}async function SS(e,t,r){return e.put(`/api/v1/bills/${t}`,{...r,resourceId:t,saveAsDraft:!1})}async function wL(e,t,r){return e.delete(`/api/v1/bills/${t}`,r)}async function vL(e,t){return e.get(`/api/v1/bills/${t}/download`)}async function DS(e,t,r){return e.post(`/api/v1/bills/${t}/payments`,{...r,currency:zt(r.currency),saveAsDraft:r.saveAsDraft??!0},uL)}async function SL(e,t,r){return e.post(`/api/v1/bills/${t}/credits`,{credits:r},dL)}async function RS(e,t){return e.post("/api/v1/scheduled/bills",{...t,bill:{...t.bill,currency:zt(t.bill?.currency)}},Mp)}async function TS(e,t){let r=await e.get(`/api/v1/bills/${t}/payments`);return{data:Array.isArray(r)?r:r.data??[]}}async function DL(e,t){let r=await e.get(`/api/v1/bills/${t}/credits`);return{data:Array.isArray(r)?r:r.data??[]}}async function RL(e,t,r){await e.delete(`/api/v1/bills/${t}/credits/${r}`)}async function TL(e,t){return So(e,"/api/v1/bills/bulk-upsert","bills",t)}async function xL(e,t){return So(e,"/api/v1/bills/line-items/bulk-upsert","bills",Up(t))}var Zd=G(()=>{"use strict";Ar();$p();Cn();ut()});function Xd(e){if(typeof e=="number"){let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t.toISOString().slice(0,10)}if(typeof e=="string"){let t=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]|$)/.exec(e.trim());return t?`${t[1]}-${t[2].padStart(2,"0")}-${t[3].padStart(2,"0")}`:void 0}}var xS=G(()=>{"use strict"});async function kL(e,t){return e.list("/api/v1/items",t)}async function AI(e,t){return e.get(`/api/v1/items/${t}`)}async function gI(e,t){return e.search("/api/v1/items/search",t)}async function kS(e,t){let r={...t};return t.appliesToSale&&!r.saleItemName&&(r.saleItemName=t.internalName),t.appliesToPurchase&&!r.purchaseItemName&&(r.purchaseItemName=t.internalName),e.post("/api/v1/items",yL(r))}async function BL(e,t,r){let i=(await AI(e,t)).data,o={itemCode:i.itemCode,internalName:i.internalName,appliesToSale:i.appliesToSale,appliesToPurchase:i.appliesToPurchase};return i.appliesToSale&&(i.saleItemName&&(o.saleItemName=i.saleItemName),i.salePrice!==void 0&&(o.salePrice=i.salePrice),i.saleAccountResourceId&&(o.saleAccountResourceId=i.saleAccountResourceId)),i.appliesToPurchase&&(i.purchaseItemName&&(o.purchaseItemName=i.purchaseItemName),i.purchasePrice!==void 0&&(o.purchasePrice=i.purchasePrice),i.purchaseAccountResourceId&&(o.purchaseAccountResourceId=i.purchaseAccountResourceId)),Object.assign(o,r),e.put(`/api/v1/items/${t}`,yL(o))}async function NL(e,t){await e.delete(`/api/v1/items/${t}`)}async function OL(e,t){return e.post("/api/v1/items/bulk-upsert",{items:t.map(yL)})}var FL=G(()=>{"use strict";Cn()});async function yI(e,t){return e.list("/api/v1/chart-of-accounts",t)}async function EI(e,t){return e.search("/api/v1/chart-of-accounts/search",t)}async function QL(e,t){return e.get(`/api/v1/chart-of-accounts/${t}`)}async function BS(e,t){return e.post("/api/v1/chart-of-accounts",t)}async function txe(e,t,r){return e.put(`/api/v1/chart-of-accounts/${t}`,r)}function LL(e){let t={};for(let r of _Nt){let n=e[r];n!=null&&(r==="accountType"&&typeof n=="string"?t.accountType=bI(n):t[r]=n)}return t}async function PL(e,t){return e.post("/api/v1/chart-of-accounts/bulk-upsert",{accounts:t})}async function ML(e,t){await e.delete(`/api/v1/chart-of-accounts/${t}`)}async function rxe(e,t){return e.list("/api/v1/account-classifications",t)}var _Nt,NS=G(()=>{"use strict";ut();_Nt=["resourceId","code","name","accountType","currencyCode","description","status"]});async function II(e){return e.get("/api/v1/capsuleTypes")}async function OS(e,t){return e.post("/api/v1/capsuleTypes",t)}async function UL(e,t){return e.list("/api/v1/capsules",t)}async function CI(e,t){return e.search("/api/v1/capsules/search",t)}async function FS(e,t){return e.get(`/api/v1/capsules/${t}`)}async function QS(e,t){return e.post("/api/v1/capsules",t)}async function $L(e,t,r){let n=await FS(e,t),i=n.data.capsuleType?.resourceId;if(!i)throw new Error(`Cannot update capsule ${t}: missing capsuleType.resourceId from GET response`);let o={resourceId:t,capsuleTypeResourceId:i,title:n.data.title,description:n.data.description,...r};return e.put(`/api/v1/capsules/${t}`,o)}async function qL(e,t){await e.delete(`/api/v1/capsules/${t}`)}async function jL(e,t){return e.post("/api/v1/moveTransactionCapsules",t)}var YL=G(()=>{"use strict"});async function _I(e,t){return e.list("/api/v1/tax-profiles",t)}async function HL(e,t){return e.list("/api/v1/tax-types",t)}async function zL(e,t){return e.post("/api/v1/tax-profiles",t)}async function wI(e,t){return e.post("/api/v1/tax-profiles/search",t,Qt)}async function LS(e,t){return e.get(`/api/v1/tax-profiles/${t}`)}async function JL(e,t,r){let n={...r};if(n.name===void 0||n.description===void 0||n.taxType===void 0||n.vatValue===void 0){let i=await LS(e,t);n.name??=i.data.name??i.data.displayName,n.description??=i.data.description??"",n.taxType??=i.data.taxTypeCode,n.vatValue??=i.data.vatValue??i.data.taxRate}return e.put(`/api/v1/tax-profiles/${t}`,n)}async function GL(e,t,r){return e.list("/api/v1/withholding-codes",t,{...r})}var PS=G(()=>{"use strict";Ar()});async function vI(e,t){return e.list("/api/v1/tags",t)}async function VL(e,t){return e.get(`/api/v1/tags/${t}`)}async function WL(e,t){return e.search("/api/v1/tags/search",t)}async function MS(e,t){return e.post("/api/v1/tags",t)}async function KL(e,t,r){return e.put(`/api/v1/tags/${t}`,r)}async function ZL(e,t){await e.delete(`/api/v1/tags/${t}`)}function wl(e,t="tags"){if(e==null)return;let r=e;if(!(typeof e=="object"&&!Array.isArray(e)&&Object.keys(r).every(i=>i==="add"||i==="remove")&&nxe(r.add)&&nxe(r.remove)))throw Jt(new ht(`${t} takes { add: [names], remove: [names] }${Array.isArray(e)?", not a list":""}: tags it does not name stay. To set X, add X and remove the others. Nothing was changed.`));return{add:r.add,remove:r.remove}}function Du(e,t){let r=t.add??[],n=new Set((t.remove??[]).filter(i=>!r.includes(i)));return[...new Set([...(e??[]).filter(i=>!n.has(i)),...r])]}async function ef(e,t,r){try{return(await r()).data}catch(n){let i=n instanceof Error?n:new Error(String(n));throw i.message=`Could not read the tags on ${e} ${t}, so nothing was changed. ${i.message}`,Jt(i)}}var Ua,nxe,SI=G(()=>{"use strict";vo();ut();Ua={type:"object",description:"Others stay; set X: add X, remove rest",properties:{add:{type:"array",items:{type:"string"}},remove:{type:"array",items:{type:"string"}}}},nxe=e=>e===void 0||Array.isArray(e)&&e.every(t=>typeof t=="string")});async function XL(e,t){return e.list("/api/v1/claim-types",t)}async function eP(e,t){return e.get(`/api/v1/claim-types/${t}`)}async function DI(e,t){return e.search("/api/v1/claim-types/search",t)}async function tP(e,t){return e.post("/api/v1/claim-types",t)}async function rP(e,t,r){return e.put(`/api/v1/claim-types/${t}`,r)}async function nP(e,t){await e.delete(`/api/v1/claim-types/${t}`)}var US,iP=G(()=>{"use strict";US=["expenseAccountResourceId","taxProfileResourceId","classifierConfig"]});async function oP(e,t){return e.list("/api/v1/claim-profiles",t)}async function sP(e,t){return e.get(`/api/v1/claim-profiles/${t}`)}async function RI(e,t){return e.search("/api/v1/claim-profiles/search",t)}async function aP(e,t){return e.post("/api/v1/claim-profiles",t)}async function cP(e,t,r){return e.put(`/api/v1/claim-profiles/${t}`,r)}async function lP(e,t){await e.delete(`/api/v1/claim-profiles/${t}`)}var $S,GK,qS,jS=G(()=>{"use strict";$S=["DAILY","WEEKLY","MONTHLY","QUARTERLY","YEARLY"],GK=["NO_TAX","INCLUSIVE"],qS=["approverUserResourceId","visibleClaimTypeIds","visibleTaxProfileIds","visibleClassifierIds","visibleVendorResourceIds","allowedCurrencies","minClaimAmount","maxClaimAmount","maxPerPeriodAmount","perPeriod","employeeBalanceAccountResourceId","taxMode"]});async function uP(e,t){return e.list("/api/v1/posting-rules",t)}async function dP(e,t){return e.get(`/api/v1/posting-rules/${t}`)}async function TI(e,t){return e.search("/api/v1/posting-rules/search",t)}async function fP(e,t){return e.post("/api/v1/posting-rules",t)}async function pP(e,t,r){return e.put(`/api/v1/posting-rules/${t}`,r)}async function hP(e,t){await e.delete(`/api/v1/posting-rules/${t}`)}var YS,HS,zS=G(()=>{"use strict";YS=["PER_EMPLOYEE","PER_VENDOR","PER_PAIR","ONE_BATCH","PER_CLAIM"],HS=["RAW","BY_CT_TP_NC","BY_CT_TP_NC_EMPLOYEE","BY_CT_TP_NC_VENDOR"]});var JS={};Qo(JS,{default:()=>vNt,log:()=>VK});var mP,wNt,ixe,VK,vNt,GS=G(()=>{"use strict";mP=()=>{},wNt=()=>VK,ixe=(...e)=>{try{process.stderr.write(e.map(String).join(" ")+`
|
|
225
|
+
`,{mode:384});let r=LBt(t,"r");try{PBt(r)}finally{MBt(r)}NBt(t,iI)}function hc(e){return wu()?.orgs[e]??null}function gS(e,t){let r=wu()??{version:2,active:"",orgs:{}};r.orgs[e]=t,(!r.active||Object.keys(r.orgs).length===1)&&(r.active=e),AS(r)}function SK(e){let t=wu();return!t||!(e in t.orgs)?!1:(delete t.orgs[e],t.active===e&&(t.active=""),AS(t),!0)}function bl(){return wu()?.active||null}function DK(e){let t=wu();if(!t)throw new Error("No credentials file found. Run `clio auth add <key>` first.");if(!(e in t.orgs)){let r=Object.keys(t.orgs).join(", ");throw new Error(`Org '${e}' not found. Available: ${r}`)}t.active=e,AS(t)}function vu(){return wu()?.orgs??{}}function RK(e){let t=wu();if(!t)return null;for(let[r,n]of Object.entries(t.orgs))if(n.apiKey===e)return r;return null}function TK(){return QBt(iI)?(FBt(iI),!0):!1}var GRe,iI,oI=G(()=>{"use strict";GRe=JRe(UBt(),".config","jaz-clio"),iI=JRe(GRe,"credentials.json")});function QK(e){Qp=e}function iL(){return Qp}function Jd(){return oL}function Lp(){return Ls}function zd(e){let t=process.env[e];if(t===void 0)return;let r=t.trim();if(r!==""&&!r.includes("${"))return r}function bS(e){let t=e.split(",").map(s=>s.trim()).filter(Boolean);if(t.length===0)throw new Xt("Empty key value. Provide a Jaz API key (jk-...) or personal access token (pat-...).");let r=t.filter(s=>s.startsWith(JE)),n=t.filter(s=>s.startsWith("jk-"));if(t.filter(s=>!s.startsWith(JE)&&!s.startsWith("jk-")).length>0)throw new Xt("Invalid key format (unrecognized prefix). Expected jk-... (API key) or pat-... (personal access token).");if(r.length>0&&n.length>0)throw new Xt("Cannot mix PAT and API keys. Use either a single personal access token (pat-...) or one or more API keys (jk-...).");if(r.length>0&&t.length!==1)throw new Xt("Only one personal access token allowed. Do not combine with other keys.");return r.length===1?[{mode:"pat",token:r[0]}]:[...new Set(n)].map(s=>({mode:"direct",apiKey:s}))}function sL(e){if(oL=null,Ls=null,e)return Ls="flag-api-key",bS(e)[0];if(Qp)return Ls="flag-org",sI(Qp);let t=zd("JAZ_API_KEY");if(t)return Ls="env-api-key",bS(t)[0];let r=zd("JAZ_ORG");if(r)return Ls="env-org",sI(r);let n=sTe(!1);if(n)return Ls="oauth-session",n;let i=bl();return i?(Ls="active-file",sI(i)):null}function sI(e){let t=e.startsWith("oauth:")?null:hc(e);if(t)return oL=e,{mode:"direct",apiKey:t.apiKey};let r=!1;try{let a=Td(e);if(a)return a}catch(a){let c=a.code;if(e.startsWith("oauth:")||c!==Wv&&c!==il)throw a;c===il&&OW(a.message),r=c===Wv}let n=wu(),i=n?Object.keys(n.orgs):[],o=i.length>0?` Available: ${i.join(", ")}.`:r?"":" No organizations are set up. Run `clio auth login` to sign in, or `clio auth add <key>` for API-key access.",s=r?" For an OAuth organization, run `clio auth organizations` and use --org oauth:<resourceId>.":"";throw new Xt(`Org '${e}' not found.${o}${s}`)}function sTe(e){try{return Td(void 0,e)}catch(t){throw t.code!==il?t:new Xt("The Jaz sign-in file (oauth.json) is unreadable or damaged: run `clio auth logout` to remove it, or pass --org <label>.",il)}}function aL(e){if(oL=null,Ls=null,Qp&&e||!Qp&&zd("JAZ_ORG")&&(e||zd("JAZ_API_KEY")))throw new Xt("An API-key override conflicts with organization selection. Remove the key override to use the selected organization, or remove the selector to use the key.");if(e)return Ls="flag-api-key",bS(e);if(Qp)return Ls="flag-org",[sI(Qp)];let t=zd("JAZ_API_KEY");if(t)return Ls="env-api-key",bS(t);let r=zd("JAZ_ORG");if(r)return Ls="env-org",[sI(r)];let n=sTe(!0);if(n)return Ls="oauth-session",[n];let i=bl();return i?(Ls="active-file",[sI(i)]):[]}function WA(e){let t=sL(e);if(!t)throw new Xt("No Jaz authentication configured. Run `clio auth login` to sign in, or use `clio auth add <key>`, JAZ_API_KEY, or --api-key for API-key access.");return t}var Qp,oL,Ls,IS=G(()=>{"use strict";EA();GE();oI();oL=null;Ls=null});function aTe(e){return e.replace(/\/[a-f0-9-]{8,}(?=[/?#]|$)/gi,"/{id}")}function LK(e,t){return`${t}\0${aTe(e)}`}function cTe(e,t=""){let r=KA.get(LK(e,t));if(!r||r.state==="closed")return;let n=Date.now(),i=aTe(e);if(r.state==="open"){if(n-r.lastFailure>3e4){r.state="half-open",r.probeStartedAt=n;return}let a=3e4-(n-r.lastFailure);throw new Pp(`Circuit open for ${i}: API endpoint appears down (${r.failures} consecutive failures). Retry in ${Math.ceil(a/1e3)}s.`,a)}let o=n-(r.probeStartedAt??0);if(o>3e4){r.probeStartedAt=n;return}let s=Math.max(1e3,3e4-o);throw new Pp(`Circuit half-open for ${i}: a probe request is testing whether the API endpoint has recovered. Retry in ${Math.ceil(s/1e3)}s at most.`,s)}function PK(e,t=""){KA.delete(LK(e,t))}function lTe(e,t=""){let r=LK(e,t),n=KA.get(r);if(!n){if(KA.size>=1e4){let i=KA.keys().next().value;i!==void 0&&KA.delete(i)}n={failures:0,lastFailure:0,state:"closed"},KA.set(r,n)}n.failures++,n.lastFailure=Date.now(),n.failures>=5&&(n.state="open")}var KA,Pp,cL=G(()=>{"use strict";KA=new Map,Pp=class extends Error{retryAfterMs;circuitOpen=!0;constructor(t,r){super(t),this.retryAfterMs=r,this.name="CircuitOpenError"}}});function Ei(e){return{retryNetworkErrors:!1,readBack:e}}var Qt,Hi,lL,uTe,dTe,uL,fTe,dL,fL,pTe,Mp,CS,hTe,_S,mTe,la,ATe,gTe,cI,pL,MK,dMr,fMr,Ar=G(()=>{"use strict";Qt={readOnly:!0};Hi=Ei("Search for the document before creating it again: by its reference when one was set, otherwise by contact, date and amount. A second create can book the same document twice; bills, supplier credit notes and manual journals accept a duplicate reference without an error."),lL=Ei("Search invoices or bills for the converted document (by the reference used, or the order's contact and date) before converting again: a second convert can create a second document."),uTe=Ei("Read the document's approvalStatus (get or search it) before approving again: the approval may already have posted the ledger."),dTe=Ei("Search background jobs for a recent bulk approve and read each document's approvalStatus before approving again: the batch may already be queued."),uL=Ei("List the document's payments (list_invoice_payments / list_bill_payments, or search_cashflow_transactions by reference) before paying again: a second payment would be recorded."),fTe=Ei("Search background jobs for a recent payments job, and search_cashflow_transactions by reference or date for the records, before recording again: a second submit records every payment twice."),dL=Ei("List the document's applied credits (list_invoice_credits / list_bill_credits) before applying again: a second application can consume more credit."),fL=Ei("List the credit note's refunds (list_customer_credit_note_refunds / list_supplier_credit_note_refunds) before refunding again: a second refund would be recorded."),pTe=Ei("Search employee payouts (search_employee_payouts) by reference or date before recording again: a second payout would be recorded."),Mp=Ei("Search scheduled transactions (search_scheduled_transactions) by reference before creating again: a second schedule would generate every document twice."),CS=Ei("Search fixed assets (search_fixed_assets) and read the asset's status before sending again: the asset may already be registered, disposed, sold or transferred."),hTe=Ei("Search the account's bank records (search_bank_records) by date and amount before adding again: a second add creates duplicate statement lines."),_S=Ei("Check for the workflow or draft this upload started (get_magic_workflow_status, or search the drafts newest first) before uploading again. Extraction runs in the background, so a draft not there yet may still be processing: a second upload creates a second draft."),mTe=Ei("List the threads on the record and look for your comment text before posting again: a second send posts the comment twice."),la=Ei("Read the bank record's status (search_bank_records) before reconciling again: it may already be reconciled, with its transaction created."),ATe=Ei("Read it back with search_unapplied_payments (CLI: clio unapplied-payments search) before sending this again. Missing from that search may mean it became a batch payment (all its cash applied): check the batch-payment search with origin BATCH or ALL."),gTe=Ei("Search journals (search_journals) for a transfer trial balance on that date before creating again: a second one doubles every opening balance."),cI=Ei("Search background jobs (search_background_jobs) for a recent job of this type before submitting again: every row without a resourceId would be created twice."),pL=Ei("Search claims (search_claims) by reference, employee and date, or search_journals for the conversion, before sending again: a second send can create a second claim or journal."),MK=Ei("List the report templates (list_organization_report_templates) and look for this one by name before sending again: the first send may already have created or deleted it."),dMr=Ei("Call get_background_tasks before adding the note again: it does not list notes, and a second add_to_background_task call stores the note twice. If the task is still PAUSED or RESUMING, tell the user the change could not be confirmed and add it again only if they ask."),fMr=Ei("Call get_background_tasks before cancelling again: a task no longer listed was cancelled or has finished, and a task still PAUSED was not cancelled and can be cancelled again.")});import{AsyncLocalStorage as WBt}from"node:async_hooks";function ETe(){let e=yTe.getStore();e&&(e.sent=!0,e.writes=(e.writes??0)+1)}function bTe(){let e=yTe.getStore();e&&(e.refused=(e.refused??0)+1)}var yTe,ITe=G(()=>{"use strict";yTe=new WBt});import{createHash as KBt}from"node:crypto";function RTe(e){DTe=e}function _Te(e){if(Array.isArray(e)){let t=e;return{data:t,totalElements:t.length,totalPages:t.length?1:0}}if(e.data||(e.data=[]),e.totalElements===void 0){let t=e.pagination?.total;e.totalElements=typeof t=="number"?t:e.data.length}return e.totalPages===void 0&&(e.totalPages=e.data.length?1:0),e}function nNt(e,t){if(t.baseUrl!==void 0)return t.baseUrl;if(e.mode==="direct"){let r=process.env.JAZ_API_URL;if(r!==void 0){let n=r.trim();if(n!==""&&!n.includes("${"))return n}}return ZBt}function oNt(e){let t=jK.get(e);return t===void 0?!1:t>Date.now()-iNt?!0:(jK.delete(e),!1)}function wTe(e,t){return t.aborted?Promise.reject(t.reason):new Promise((r,n)=>{let i=()=>n(t.reason);t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})})}function vTe(e){try{return e&&JSON.parse(e)}catch{return e}}function $K(e,t,r){return Date.now()-e+t<r}function STe(e,t){return new Promise(r=>{if(t?.aborted){r();return}let n=()=>{clearTimeout(i),r()},i=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e);t?.addEventListener("abort",n,{once:!0})})}function qK(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.message=="string")return t.message;if(typeof t.error=="string")return t.error;if(t.error&&typeof t.error=="object"){let r=t.error;if(Array.isArray(r.errors)&&r.errors.length>0)return r.errors.join("; ");if(typeof r.error_type=="string")return r.error_type}return JSON.stringify(e)}return String(e)}var ZBt,XBt,eNt,tNt,rNt,CTe,DTe,gr,Gd,UK,Hn,iNt,jK,zi=G(()=>{"use strict";cL();kW();Ar();ITe();ZBt="https://api.getjaz.com",XBt=3e4,eNt=3,tNt=[429],rNt=[500,502,503],CTe=5e3,DTe="0.0.0";gr=class extends Error{status;body;endpoint;retryAfterMs;refusal;constructor(t,r,n,i,o){super(t),this.status=r,this.body=n,this.endpoint=i,this.retryAfterMs=o,this.name="JazApiError"}},Gd=class extends Error{endpoint;readBack;unconfirmed=!0;constructor(t,r,n,i){super(t,i),this.endpoint=r,this.readBack=n,this.name="UnconfirmedWriteError"}},UK="Read the record back (search for it) before sending this again: a second send can create a duplicate.";Hn=class{baseUrl;timeout;maxRetries;auth;onRequest;channel;requestId;constructor(t,r,n={}){this.auth=t,this.channel=r,this.baseUrl=nNt(t,n).replace(/\/$/,""),this.timeout=n.timeout??XBt,this.maxRetries=n.maxRetries??eNt,this.onRequest=n.onRequest,this.requestId=n.requestId&&n.requestId!=="none"?n.requestId:void 0}get isPatAuth(){return this.auth.mode==="pat"}get scopeKey(){let t=this.auth,r=t.mode==="direct"?`direct:${t.apiKey}`:t.mode==="pat"?`pat:${t.orgId??""}:${t.token}`:`delegated:${t.orgId}:${t.userId}:${t.orgUserId??""}`;return KBt("sha256").update(r).digest("hex").slice(0,24)}emitRequestEvent(t){try{this.onRequest?.(t)}catch{}}buildHeaders(t){let r={"Content-Type":"application/json","User-Agent":`jaz-clio/${DTe} (${this.channel})`,...t};switch(this.requestId&&(r["x-request-id"]=this.requestId),this.auth.mode){case"direct":r["x-jk-api-key"]=this.auth.apiKey;break;case"pat":r.Authorization=`Bearer ${this.auth.token}`,this.auth.orgId&&(r["\u0078\u002d\u0074\u0069\u006e\u0076\u0069\u006f\u002d\u006f\u0064\u0069\u006e\u002d\u006f\u0072\u0067\u002d\u006b\u0065\u0079"]=this.auth.orgId);break;case"delegated":this.auth.orgUserId?(r["x-channel-key"]=this.auth.adminKey,r["\u0078\u002d\u0074\u0069\u006e\u0076\u0069\u006f\u002d\u006f\u0064\u0069\u006e\u002d\u006f\u0072\u0067\u002d\u006b\u0065\u0079"]=this.auth.orgId,r["x-jaz-org-user-key"]=this.auth.orgUserId):(r["x-clio-admin-key"]=this.auth.adminKey,r["x-user-id"]=this.auth.userId,r["x-org-id"]=this.auth.orgId);break}return r}async request(t,r,n={}){let i=new URL(`${this.baseUrl}${r}`);if(n.query)for(let[T,R]of Object.entries(n.query))R!==void 0&&i.searchParams.set(T,String(R));let o=n.timeoutMs??this.timeout,s=AbortSignal.timeout(o),a=Date.now(),c=this.buildHeaders(n.headers),u=this.auth.mode==="pat"?this.auth.tokenProvider:void 0,d=this.auth.mode==="pat"?this.auth.orgId:void 0,f=u?await wTe(u(void 0,d),s):void 0;f!==void 0&&(c.Authorization=`Bearer ${f}`),n.raw&&delete c["Content-Type"];let p={method:t,headers:c,signal:s};n.body!==void 0&&t!=="GET"&&(p.body=n.raw?n.body:JSON.stringify(n.body));let h=this.scopeKey;cTe(r,h);let m,A=["GET","HEAD"].includes(t)||n.readOnly===!0,g,y=0,b=`${h}|${t} ${r}`,E=!1,C=!1,w;for(let T=0;T<=this.maxRetries;T++){let R=Date.now();try{A||(E&&w!==429&&(C=!0),E||ETe(),E=!0,w=void 0);let k=await fetch(i.toString(),p);A||(w=k.status);let O=tNt.includes(k.status)||A&&rNt.includes(k.status),J=EF({headers:k.headers});if(O&&T<this.maxRetries){let j=J??Math.min(1e3*2**T,8e3),N=!A&&n.retryNetworkErrors===!1?Math.max(CTe,o/3):0;if($K(a,j+N,o)){let P="";try{P=await k.text()}catch{}let W=vTe(P);g=new gr(`${t} ${r} \u2192 ${k.status}: ${qK(W)}`,k.status,W,r,J),m=void 0,this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!0}),await STe(j,s);continue}}if(!k.ok){let j=!A&&n.retryNetworkErrors===!1,S=Math.max(CTe,o/3),N=oNt(b);if(k.status===401&&y>0&&jK.set(b,Date.now()),k.status===401&&u&&y===0&&!N&&(j||$K(a,S,o))){y++;let W=f;await k.body?.cancel(),this.emitRequestEvent({method:t,path:r,statusCode:401,durationMs:Date.now()-R,attempt:T,retried:!j});let B;try{c.Authorization=`Bearer ${await wTe(u(W,d),s)}`}catch(Y){B=Y}if(j){let Y=B?`the sign-in could not be refreshed (${B.message})`:"the sign-in was refreshed";throw new Gd(`${t} ${r} \u2192 401: ${Y}, and the write was not sent again because the API may have acted before refusing.`,r,n.readBack??UK,{cause:B})}if(B){m=B;break}T--;continue}let P=vTe(await k.text());throw this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!1,error:qK(P)}),k.status>=500?lTe(r,h):PK(r,h),!A&&!C&&k.status>=400&&k.status<500&&k.status!==401&&bTe(),new gr(`${t} ${r} \u2192 ${k.status}: ${qK(P)}`,k.status,P,r,J)}if(this.emitRequestEvent({method:t,path:r,statusCode:k.status,durationMs:Date.now()-R,attempt:T,retried:!1}),PK(r,h),k.status===204)return;try{if(n.emptyBodyOk){let j=await k.text();return j.trim()===""?void 0:JSON.parse(j)}return await k.json()}catch(j){throw A?j:new Gd(`${t} ${r} \u2192 ${k.status}, but the answer could not be read (${j.message}). It was not sent again.`,r,n.readBack??UK,{cause:j})}}catch(k){if(k instanceof gr||k instanceof Gd)throw k;if(s.aborted&&T>0&&A){if(g)throw g;if(m){let j=new Error(`${t} ${r}: no answer within ${o} ms. The attempt before the last failed with: ${m.message}`,{cause:m});throw j.name="TimeoutError",j}}m=k,g=void 0;let O=Math.min(1e3*2**T,8e3),J=n.retryNetworkErrors!==!1&&T<this.maxRetries&&$K(a,O,o);if(this.emitRequestEvent({method:t,path:r,statusCode:0,durationMs:Date.now()-R,attempt:T,retried:J,error:m.message}),!J){if(n.retryNetworkErrors===!1)throw new Gd(`${t} ${r}: no answer arrived (${m.message}). The write may or may not have happened; it was not sent again.`,r,n.readBack??UK,{cause:m});break}await STe(O,s)}}throw m??new Error(`Request failed: ${t} ${r}`)}async get(t,r,n){return this.request("GET",t,{query:r,...n?.timeoutMs!==void 0?{timeoutMs:n.timeoutMs}:{}})}async post(t,r,n){return this.request("POST",t,{body:r,headers:n?.headers,...n?.query!==void 0?{query:n.query}:{},...n?.timeoutMs!==void 0?{timeoutMs:n.timeoutMs}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{},...n?.readOnly!==void 0?{readOnly:n.readOnly}:{},...n?.emptyBodyOk!==void 0?{emptyBodyOk:n.emptyBodyOk}:{}})}async put(t,r,n){return this.request("PUT",t,{body:r,headers:n?.headers,...n?.query!==void 0?{query:n.query}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async delete(t,r,n){return this.request("DELETE",t,{query:r,...n?.body!==void 0?{body:n.body}:{},...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async postMultipart(t,r,n){return this.request("POST",t,{body:r,raw:!0,...n?.retryNetworkErrors!==void 0?{retryNetworkErrors:n.retryNetworkErrors}:{},...n?.readBack!==void 0?{readBack:n.readBack}:{}})}async list(t,r,n){let i=await this.get(t,{...n,limit:r?.limit??100,offset:r?.offset??0,...r?.view?{view:r.view}:{}});return _Te(i)}async search(t,r){let n={};r.query&&(n.query=r.query),r.filter&&(n.filter=r.filter),r.limit!==void 0&&(n.limit=r.limit),r.offset!==void 0&&(n.offset=r.offset),r.view&&(n.view=r.view),r.magicSort&&(n.magicSort=r.magicSort),r.transactionType&&(n.transactionType=r.transactionType),r.multiContactOnly!==void 0&&(n.multiContactOnly=r.multiContactOnly),r.origin&&(n.origin=r.origin),r.sort?n.sort=r.sort:r.offset!==void 0&&(n.sort={sortBy:["createdAt"],order:"DESC"});let i=await this.post(t,n,Qt);return _Te(i)}async listAll(t,r=200){let n=[],i=0,o=!0;for(;o;){let s=await this.list(t,{limit:r,offset:i});if(n.push(...s.data),s.data.length<r)break;i+=1,o=i*r<s.totalElements}return n}};iNt=5*6e4,jK=new Map});async function as(e,t){let r=await e.get("/api/v1/organization",void 0,t);return Array.isArray(r.data)?r.data[0]:r.data}async function ZA(e){let t=await e.get("/api/v1/me/organizations"),r=t.boundOrganizationResourceId;return{organizations:Array.isArray(t.data)?t.data:[],boundOrganizationResourceId:r===null?"":r}}async function TTe(e){return(await ZA(e)).organizations}async function xTe(e){return(await e.get("/api/v1/me")).data}var Vd=G(()=>{"use strict"});function Il(e){return Object.hasOwn(PTe,e)?PTe[e]:void 0}function lI(e){return Object.entries(hNt).filter(([t])=>e[t]!==void 0&&e[t]!==null).map(([,t])=>t)}var hL,LTe,PTe,hNt,XA=G(()=>{"use strict";hL="Recipes were removed. Use calculate for the schedule and journal lines, then post with create_capsule and create_journal / create_bill / create_invoice / create_cash_in / create_cash_out (each with capsuleResourceId).",LTe="Recipe job tools were removed and have no replacement: calculate cannot resume or undo an existing recipe job. Tell the user this job cannot be managed from here.",PTe={plan_recipe:"plan_recipe was removed: use calculate (same inputs, `type` replaces `recipe`).",execute_recipe:hL,list_capsule_recipes:hL,get_capsule_recipe:hL,preview_capsule_recipe:hL,resume_capsule_recipe:LTe,rollback_capsule_recipe:LTe},hNt={capsuleRecipe:"capsuleRecipe is no longer available. Remove it. To group transactions, create a capsule (create_capsule) and pass capsuleResourceId; use calculate for the schedule."}});var ht,vo=G(()=>{"use strict";ht=class extends Error{constructor(t){super(t),this.name="ValidationError"}}});function UTe(e){let t=String(e).trim().toUpperCase().replace(/[\s-]+/g,"_"),r=/^(?:NET_?)?(\d+)$/.exec(t)?.[1],n=r===void 0?YK.find(i=>i===t&&i!=="CUSTOM"):MTe[Number(r)];if(n)return n;throw new ht(`payment terms "${e}" is not a term a single contact can take. Use ON_DELIVERY, NET_7, NET_15, NET_30, NET_45 or NET_60 (any case), or 0, 7, 15, 30, 45 or 60 days. For any other number of days, bulk-upsert the contact with customerPaymentTerms {name: "CUSTOM", value: "<days>"}.`)}function $Te(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return e;let{name:n,value:i}=e;if(typeof n!="string"||n.trim()==="")return e;if(n.trim().toUpperCase()!=="CUSTOM")return{name:n};let o=i==null?"":String(i).trim();if(!/^\d+$/.test(o)||Number(o)<=0)throw new ht(`row ${t}: ${r}.value must be a positive whole number of days when ${r}.name is CUSTOM (got ${JSON.stringify(i??null)}); the API rejects the WHOLE batch otherwise`);return{name:n,value:o}}function qTe(e){if(!e||typeof e!="object")return;let{name:t,value:r}=e,n=r==null?"":String(r).trim();if(!/^\d+$/.test(n))return;let i=typeof t=="string"&&t.trim().toUpperCase()==="CUSTOM",o=MTe[Number(n)];return!i&&o?{name:o}:Number(n)>0?{name:"CUSTOM",value:n}:void 0}var YK,MTe,wS=G(()=>{"use strict";vo();YK=["ON_DELIVERY","NET_7","NET_15","NET_30","NET_45","NET_60","CUSTOM"],MTe={0:"ON_DELIVERY",7:"NET_7",15:"NET_15",30:"NET_30",45:"NET_45",60:"NET_60"}});var zTe={};Qo(zTe,{collectValue:()=>tg,parseCustomFields:()=>pn,parseJournalEntries:()=>mc,parseJsonArray:()=>Ac,parseJsonObject:()=>AL,parseLineItems:()=>zn,parseMoney:()=>Vt,parseNonNegativeInt:()=>rt,parseOrderTerms:()=>eg,parsePaymentTerms:()=>uI,parsePositiveInt:()=>be,parseRate:()=>ri,parseTaxRatePercent:()=>mL,readBodyInput:()=>_e,requireFields:()=>Pe,splitCsv:()=>io,todayLocal:()=>HK});import{readFileSync as jTe}from"node:fs";function be(e){let t=String(e).trim(),r=Number.parseInt(t,10);return(!HTe.test(t)||!Number.isSafeInteger(r)||r<=0)&&(console.error(ne(`Error: invalid positive integer: ${e}`)),process.exit(1)),r}function rt(e){let t=String(e).trim(),r=Number.parseInt(t,10);return(!HTe.test(t)||!Number.isSafeInteger(r)||r<0)&&(console.error(ne(`Error: invalid non-negative integer: ${e}`)),process.exit(1)),r}function eg(e){let t=Number.parseInt(e,10);return(!Number.isFinite(t)||![0,7,15,30,45,60].includes(t))&&(console.error(ne(`Error: terms must be one of 0, 7, 15, 30, 45, 60 (got: ${e})`)),process.exit(1)),t}function uI(e){try{return UTe(e)}catch(t){console.error(ne(`Error: ${t.message}`)),process.exit(1)}}function Vt(e){return/^-?\d+(\.\d{1,2})?$/.test(e)||(console.error(ne(`Error: invalid amount: ${e} (max 2 decimal places)`)),process.exit(1)),Math.round(Number(e)*100)/100}function ri(e){let t=Number(e);return(!Number.isFinite(t)||t<=0)&&(console.error(ne(`Error: invalid exchange rate: ${e}`)),process.exit(1)),t}function mL(e){let t=String(e).trim(),r=Number(t);return(t===""||!Number.isFinite(r)||r<0||r>100)&&(console.error(ne(`Error: invalid tax rate percentage: ${e} (expected 0-100)`)),process.exit(1)),r}function zn(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Line items must be a JSON array");return t}catch{console.error(ne("Error: --lines must be valid JSON array")),console.error($(`Example: --lines '[{"name":"Service","quantity":1,"unitPrice":100,"accountResourceId":"..."}]'`)),console.error($("Tip: pipe the full request body via stdin, or use --input <file>")),process.exit(1)}}function mc(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Entries must be a JSON array");return t}catch{console.error(ne("Error: --entries must be valid JSON array")),console.error($(`Example: --entries '[{"accountResourceId":"...","amount":100,"type":"DEBIT"},...]'`)),console.error($("Tip: pipe the full request body via stdin, or use --input <file>")),process.exit(1)}}function pn(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Must be a JSON array");return t}catch{console.error(ne("Error: --custom-fields must be valid JSON array")),console.error($(`Example: --custom-fields '[{"customFieldName":"PO Number","actualValue":"PO-123"}]'`)),process.exit(1)}}function tg(e,t=[]){return t.push(e),t}function AL(e,t){try{let r=JSON.parse(e);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("not an object");return r}catch{return console.error(ne(`Error: ${t} must be a valid JSON object`)),process.exit(1),{}}}function YTe(e){let t=lI(e);return t.length>0&&(console.error(ne(`Error: ${t.join("; ")}`)),process.exit(1)),e}function _e(e){if(e.input){let t;try{t=jTe(e.input,"utf-8")}catch{console.error(ne(`Error: cannot read file: ${e.input}`)),process.exit(1)}try{let r=JSON.parse(t);return(typeof r!="object"||r===null||Array.isArray(r))&&(console.error(ne("Error: --input file must contain a JSON object")),process.exit(1)),YTe(r)}catch{console.error(ne("Error: --input file contains invalid JSON")),process.exit(1)}}if(!process.stdin.isTTY)try{let t=jTe(0,"utf-8").trim();if(t){let r=JSON.parse(t);return(typeof r!="object"||r===null||Array.isArray(r))&&(console.error(ne("Error: stdin must contain a JSON object")),process.exit(1)),YTe(r)}}catch(t){t.message?.includes("JSON")&&(console.error(ne("Error: stdin contains invalid JSON")),process.exit(1))}return null}function Pe(e,t){let r=t.filter(n=>e[n.key]===void 0);if(r.length>0){let n=r.map(i=>i.flag).join(", ");console.error(ne(`Error: missing required option(s): ${n}`)),console.error($("Provide flags, or pipe JSON via stdin, or use --input <file>")),process.exit(1)}}function io(e){if(e!==void 0)return e.split(",").map(t=>t.trim()).filter(Boolean)}function Ac(e,t){let r;try{r=JSON.parse(e)}catch{throw new Error(`Invalid JSON for ${t}: ${e.slice(0,80)}`)}if(!Array.isArray(r))throw new Error(`${t} must be a JSON array (got ${typeof r}).`);return r}function HK(){let e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`}var HTe,yt=G(()=>{"use strict";Ne();XA();wS();HTe=/^[+-]?\d+$/});async function So(e,t,r,n){return e.post(t,{[r]:n},cI)}function Ut(e,t,r=500,n=t){if(!Array.isArray(e))throw new he(`${t} must be an array.`);if(e.length===0)throw new he(`${t} array is empty.`);if(e.length>r)throw new he(`max ${r} ${n} per call (got ${e.length}). Split into batches.`)}function Cl(e,t){e.forEach((r,n)=>{if(!r||typeof r!="object")return;let i=r;if("dateFormat"in i)throw new he(`row ${n}: dateFormat field is no longer supported (ISO 8601 YYYY-MM-DD only)`);for(let o of t){let s=i[o];if(s!=null&&(typeof s!="string"||!mNt.test(s)))throw new he(`row ${n}: ${o} must be YYYY-MM-DD (got ${JSON.stringify(s)})`)}})}function ANt(e,t){e.forEach((r,n)=>{zK(r,"bulk-upsert",n);let i=r[t];if(!(typeof i=="string"&&i.trim()!==""))throw new he(`row ${n}: ${t} is required on every bulk-upsert transaction row (ISO 4217, e.g. "SGD") \u2014 without it the job fails the row with IMPORT_CURRENCY_REQUIRED`)})}function dI(e,t){if(!t.some(([n])=>n in e))return e;let r={...e};for(let[n,i]of t){if(!(n in r))continue;let o=r[n];delete r[n],o!==void 0&&(i in r||(r[i]=o))}return r}function zK(e,t,r){if(!e||typeof e!="object"||Array.isArray(e)){let n=r===void 0?"":`row ${r}: `;throw new he(`${n}each ${t} row must be an object (got ${e===null?"null":typeof e})`)}return e}function gNt(e){return dI(e,JTe)}function bNt(e){return!e||typeof e!="object"||Array.isArray(e)?e:dI(e,VTe)}function yL(e){return dI(zK(e,"item"),gL)}function WTe(e){return e.map((t,r)=>{let n=zK(t,"contact",r),i=dI(n,GTe),o=i===n?{...n}:i;if("emails"in o){let s=o.emails;!("emailList"in o)&&Array.isArray(s)&&(o.emailList=s.map(a=>typeof a=="string"?{email:a,label:"Contact Email"}:a)),delete o.emails}for(let s of["customerPaymentTerms","supplierPaymentTerms"])s in o&&(o[s]=$Te(o[s],r,s));if(typeof o.status=="string"&&o.status.trim().toUpperCase()==="INACTIVE")throw new he(`row ${r}: status INACTIVE is not applied by bulk upsert (the job reports SUCCESS and drops the row); the API has no working route that deactivates a contact`);for(let s of["billingAddress","deliveryAddress"]){if(!(s in o))continue;o[s]=bNt(o[s]);let a=o[s];if(a&&typeof a=="object"&&!Array.isArray(a)){let c=ENt.filter(u=>!a[u]);if(c.length>0)throw new he(`row ${r}: ${s} requires ${c.join(" and ")} \u2014 the API rejects the WHOLE batch with 422 otherwise`)}}return o})}function Up(e){return ANt(e,"currencyCode"),e.map(gNt)}function KTe(e,t){e.forEach((r,n)=>{if(!r||typeof r!="object")return;let i=r;for(let o of t){let s=i[o];if(s!=null&&(typeof s!="number"||!Number.isFinite(s)))throw new he(`row ${n}: ${o} must be epoch milliseconds on this endpoint, not a date string (got ${JSON.stringify(s)}) \u2014 e.g. 1745107200000`)}})}var mNt,JTe,yNt,GTe,VTe,ENt,gL,JK,HMr,Cn=G(()=>{"use strict";ut();wS();Ar();mNt=/^\d{4}-\d{2}-\d{2}$/;JTe=[["currencyCode","transactionCurrency"]];yNt=["BulkUpsertCustomerCreditNote","BulkUpsertLineItemBill","BulkUpsertLineItemInvoice","BulkUpsertSupplierCreditNote"],GTe=[["billingName","contactBillingName"],["currencyCode","currency"],["registrationNumber","registrationId"],["notes","customerInvoiceNotes"],["shippingAddress","deliveryAddress"]],VTe=[["address","addressLine1"]],ENt=["addressLine1","country"];gL=[["saleTaxProfileResourceId","saleTaxProfile"],["purchaseTaxProfileResourceId","purchaseTaxProfile"],["purchasePrice","purchaseItemPrice"]];JK=[["contactResourceIds","associatedContactResourceIds"]],HMr=[["BulkUpsertContact",GTe],["UpdateContactGroupClientRequest",JK],["BulkUpsertContactAddress",VTe],["BulkUpsertItemRequestItem",gL],["CreateItemClientRequest",gL],["UpdateItemClientRequest",gL],...yNt.map(e=>[e,JTe])]});async function exe(e,t,r){return e.get(`/api/v1/contacts/${t}/signals`,{btType:r})}async function fI(e,t){return e.list("/api/v1/contacts",t)}async function _l(e,t){return e.search("/api/v1/contacts/search",t)}async function pI(e,t){return e.post("/api/v1/contacts",t)}async function EL(e,t,r){return e.put(`/api/v1/contacts/${t}`,r)}async function rg(e,t){return e.get(`/api/v1/contacts/${t}`)}async function bL(e,t){await e.delete(`/api/v1/contacts/${t}`)}async function IL(e,t){return So(e,"/api/v1/contacts/bulk-upsert","contacts",await INt(e,WTe(t)))}async function INt(e,t){let r=o=>typeof o.resourceId=="string"&&ZTe.some(s=>!(s in o)),n=[...new Set(t.filter(r).map(o=>o.resourceId))];if(n.length===0)return t;let i=new Map;for(let o=0;o<n.length;o+=XTe){let s=n.slice(o,o+XTe),a=await _l(e,{filter:{resourceId:{in:s}},limit:s.length});for(let c of a.data)i.set(c.resourceId,c)}return t.map(o=>{if(!r(o))return o;let s=i.get(o.resourceId)?.paymentDetail,a={...o};for(let c of ZTe){if(c in a)continue;let u=qTe(s?.[c]?.[0]);u&&(a[c]=u)}return a})}var ZTe,XTe,ng=G(()=>{"use strict";Cn();wS();ZTe=["customerPaymentTerms","supplierPaymentTerms"],XTe=100});function Su(e){if(e===null||typeof e!="object"||Array.isArray(e))return e;let r={...e};if(r.organizationAccountResourceId!==void 0&&(r.accountResourceId===void 0&&(r.accountResourceId=r.organizationAccountResourceId),delete r.organizationAccountResourceId),r.discount!==null&&typeof r.discount=="object"&&!Array.isArray(r.discount)){let n=r.discount;r.discount=n.rateValue??0}if(r.taxProfile!==null&&typeof r.taxProfile=="object"&&!Array.isArray(r.taxProfile)){let n=r.taxProfile;r.taxProfileResourceId===void 0&&n.resourceId!==void 0&&(r.taxProfileResourceId=n.resourceId),delete r.taxProfile}return r}function hI(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.code==null||t.rate==null)return;let r={code:t.code,rate:t.rate};return t.type!=null&&(r.type=t.type),t.description!=null&&(r.description=t.description),r}function gc(e){let t={};e.name!=null&&(t.name=e.name),e.quantity!=null&&(t.quantity=e.quantity),e.unitPrice!=null&&(t.unitPrice=e.unitPrice),e.unit&&(t.unit=e.unit);let r=e.accountResourceId||e.organizationAccountResourceId;r&&(t.accountResourceId=r);let n=e.taxProfileResourceId||(e.taxProfile&&typeof e.taxProfile=="object"?e.taxProfile.resourceId:null);n&&(t.taxProfileResourceId=n),e.itemResourceId&&(t.itemResourceId=e.itemResourceId),e.discount!=null&&(t.discount=typeof e.discount=="object"?e.discount.rateValue??0:e.discount);let i=hI(e.withholdingTax);return i&&(t.withholdingTax=i),t}function mI(e){let t={},r=e.accountResourceId||e.organizationAccountResourceId;r&&(t.accountResourceId=r),e.amount!=null?t.amount=e.amount:e.debitAmount!=null&&e.debitAmount>0?t.amount=e.debitAmount:e.creditAmount!=null&&e.creditAmount>0&&(t.amount=e.creditAmount),e.type?t.type=e.type:e.debitAmount!=null&&e.debitAmount>0?t.type="DEBIT":e.creditAmount!=null&&e.creditAmount>0&&(t.type="CREDIT"),e.description&&(t.description=e.description);let n=e.taxProfileResourceId||(e.taxProfile&&typeof e.taxProfile=="object"?e.taxProfile.resourceId:null);return n&&(t.taxProfileResourceId=n),Array.isArray(e.classifierConfig)&&e.classifierConfig.length&&(t.classifierConfig=e.classifierConfig.map(CNt)),t}function CNt(e){let t={};for(let r of["resourceId","type","printable"])e?.[r]!=null&&(t[r]=e[r]);return Array.isArray(e?.selectedClasses)&&(t.selectedClasses=e.selectedClasses.map(r=>{let n={};for(let i of["className","resourceId","entityResourceId"])r?.[i]!=null&&(n[i]=r[i]);return n})),t}function Lt(e){if(e)return e.split("T")[0]}var $p=G(()=>{"use strict"});async function CL(e,t){return e.list("/api/v1/bills",t)}async function oo(e,t){return e.get(`/api/v1/bills/${t}`)}async function Kd(e,t){return e.search("/api/v1/bills/search",t)}async function vS(e,t){return e.post("/api/v1/bills",{...t,currency:zt(t.currency),taxCurrency:zt(t.taxCurrency),saveAsDraft:t.saveAsDraft??!0},Hi)}async function _L(e,t,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(Su)}:r;return e.put(`/api/v1/bills/${t}`,n)}async function SS(e,t,r){return e.put(`/api/v1/bills/${t}`,{...r,resourceId:t,saveAsDraft:!1})}async function wL(e,t,r){return e.delete(`/api/v1/bills/${t}`,r)}async function vL(e,t){return e.get(`/api/v1/bills/${t}/download`)}async function DS(e,t,r){return e.post(`/api/v1/bills/${t}/payments`,{...r,currency:zt(r.currency),saveAsDraft:r.saveAsDraft??!0},uL)}async function SL(e,t,r){return e.post(`/api/v1/bills/${t}/credits`,{credits:r},dL)}async function RS(e,t){return e.post("/api/v1/scheduled/bills",{...t,bill:{...t.bill,currency:zt(t.bill?.currency)}},Mp)}async function TS(e,t){let r=await e.get(`/api/v1/bills/${t}/payments`);return{data:Array.isArray(r)?r:r.data??[]}}async function DL(e,t){let r=await e.get(`/api/v1/bills/${t}/credits`);return{data:Array.isArray(r)?r:r.data??[]}}async function RL(e,t,r){await e.delete(`/api/v1/bills/${t}/credits/${r}`)}async function TL(e,t){return So(e,"/api/v1/bills/bulk-upsert","bills",t)}async function xL(e,t){return So(e,"/api/v1/bills/line-items/bulk-upsert","bills",Up(t))}var Zd=G(()=>{"use strict";Ar();$p();Cn();ut()});function Xd(e){if(typeof e=="number"){let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t.toISOString().slice(0,10)}if(typeof e=="string"){let t=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]|$)/.exec(e.trim());return t?`${t[1]}-${t[2].padStart(2,"0")}-${t[3].padStart(2,"0")}`:void 0}}var xS=G(()=>{"use strict"});async function kL(e,t){return e.list("/api/v1/items",t)}async function AI(e,t){return e.get(`/api/v1/items/${t}`)}async function gI(e,t){return e.search("/api/v1/items/search",t)}async function kS(e,t){let r={...t};return t.appliesToSale&&!r.saleItemName&&(r.saleItemName=t.internalName),t.appliesToPurchase&&!r.purchaseItemName&&(r.purchaseItemName=t.internalName),e.post("/api/v1/items",yL(r))}async function BL(e,t,r){let i=(await AI(e,t)).data,o={itemCode:i.itemCode,internalName:i.internalName,appliesToSale:i.appliesToSale,appliesToPurchase:i.appliesToPurchase};return i.appliesToSale&&(i.saleItemName&&(o.saleItemName=i.saleItemName),i.salePrice!==void 0&&(o.salePrice=i.salePrice),i.saleAccountResourceId&&(o.saleAccountResourceId=i.saleAccountResourceId)),i.appliesToPurchase&&(i.purchaseItemName&&(o.purchaseItemName=i.purchaseItemName),i.purchasePrice!==void 0&&(o.purchasePrice=i.purchasePrice),i.purchaseAccountResourceId&&(o.purchaseAccountResourceId=i.purchaseAccountResourceId)),Object.assign(o,r),e.put(`/api/v1/items/${t}`,yL(o))}async function NL(e,t){await e.delete(`/api/v1/items/${t}`)}async function OL(e,t){return e.post("/api/v1/items/bulk-upsert",{items:t.map(yL)})}var FL=G(()=>{"use strict";Cn()});async function yI(e,t){return e.list("/api/v1/chart-of-accounts",t)}async function EI(e,t){return e.search("/api/v1/chart-of-accounts/search",t)}async function QL(e,t){return e.get(`/api/v1/chart-of-accounts/${t}`)}async function BS(e,t){return e.post("/api/v1/chart-of-accounts",t)}async function txe(e,t,r){return e.put(`/api/v1/chart-of-accounts/${t}`,r)}function LL(e){let t={};for(let r of _Nt){let n=e[r];n!=null&&(r==="accountType"&&typeof n=="string"?t.accountType=bI(n):t[r]=n)}return t}async function PL(e,t){return e.post("/api/v1/chart-of-accounts/bulk-upsert",{accounts:t})}async function ML(e,t){await e.delete(`/api/v1/chart-of-accounts/${t}`)}async function rxe(e,t){return e.list("/api/v1/account-classifications",t)}var _Nt,NS=G(()=>{"use strict";ut();_Nt=["resourceId","code","name","accountType","currencyCode","description","status"]});async function II(e){return e.get("/api/v1/capsuleTypes")}async function OS(e,t){return e.post("/api/v1/capsuleTypes",t)}async function UL(e,t){return e.list("/api/v1/capsules",t)}async function CI(e,t){return e.search("/api/v1/capsules/search",t)}async function FS(e,t){return e.get(`/api/v1/capsules/${t}`)}async function QS(e,t){return e.post("/api/v1/capsules",t)}async function $L(e,t,r){let n=await FS(e,t),i=n.data.capsuleType?.resourceId;if(!i)throw new Error(`Cannot update capsule ${t}: missing capsuleType.resourceId from GET response`);let o={resourceId:t,capsuleTypeResourceId:i,title:n.data.title,description:n.data.description,...r};return e.put(`/api/v1/capsules/${t}`,o)}async function qL(e,t){await e.delete(`/api/v1/capsules/${t}`)}async function jL(e,t){return e.post("/api/v1/moveTransactionCapsules",t)}var YL=G(()=>{"use strict"});async function _I(e,t){return e.list("/api/v1/tax-profiles",t)}async function HL(e,t){return e.list("/api/v1/tax-types",t)}async function zL(e,t){return e.post("/api/v1/tax-profiles",t)}async function wI(e,t){return e.post("/api/v1/tax-profiles/search",t,Qt)}async function LS(e,t){return e.get(`/api/v1/tax-profiles/${t}`)}async function JL(e,t,r){let n={...r};if(n.name===void 0||n.description===void 0||n.taxType===void 0||n.vatValue===void 0){let i=await LS(e,t);n.name??=i.data.name??i.data.displayName,n.description??=i.data.description??"",n.taxType??=i.data.taxTypeCode,n.vatValue??=i.data.vatValue??i.data.taxRate}return e.put(`/api/v1/tax-profiles/${t}`,n)}async function GL(e,t,r){return e.list("/api/v1/withholding-codes",t,{...r})}var PS=G(()=>{"use strict";Ar()});async function vI(e,t){return e.list("/api/v1/tags",t)}async function VL(e,t){return e.get(`/api/v1/tags/${t}`)}async function WL(e,t){return e.search("/api/v1/tags/search",t)}async function MS(e,t){return e.post("/api/v1/tags",t)}async function KL(e,t,r){return e.put(`/api/v1/tags/${t}`,r)}async function ZL(e,t){await e.delete(`/api/v1/tags/${t}`)}function wl(e,t="tags"){if(e==null)return;let r=e;if(!(typeof e=="object"&&!Array.isArray(e)&&Object.keys(r).every(i=>i==="add"||i==="remove")&&nxe(r.add)&&nxe(r.remove)))throw Jt(new ht(`${t} takes { add: [names], remove: [names] }${Array.isArray(e)?", not a list":""}: tags it does not name stay. To set X, add X and remove the others. Nothing was changed.`));return{add:r.add,remove:r.remove}}function Du(e,t){let r=t.add??[],n=new Set((t.remove??[]).filter(i=>!r.includes(i)));return[...new Set([...(e??[]).filter(i=>!n.has(i)),...r])]}async function ef(e,t,r){try{return(await r()).data}catch(n){let i=n instanceof Error?n:new Error(String(n));throw i.message=`Could not read the tags on ${e} ${t}, so nothing was changed. ${i.message}`,Jt(i)}}var Ua,nxe,SI=G(()=>{"use strict";vo();ut();Ua={type:"object",description:"Others stay; set X: add X, remove rest",properties:{add:{type:"array",items:{type:"string"}},remove:{type:"array",items:{type:"string"}}}},nxe=e=>e===void 0||Array.isArray(e)&&e.every(t=>typeof t=="string")});async function XL(e,t){return e.list("/api/v1/claim-types",t)}async function eP(e,t){return e.get(`/api/v1/claim-types/${t}`)}async function DI(e,t){return e.search("/api/v1/claim-types/search",t)}async function tP(e,t){return e.post("/api/v1/claim-types",t)}async function rP(e,t,r){return e.put(`/api/v1/claim-types/${t}`,r)}async function nP(e,t){await e.delete(`/api/v1/claim-types/${t}`)}var US,iP=G(()=>{"use strict";US=["expenseAccountResourceId","taxProfileResourceId","classifierConfig"]});async function oP(e,t){return e.list("/api/v1/claim-profiles",t)}async function sP(e,t){return e.get(`/api/v1/claim-profiles/${t}`)}async function RI(e,t){return e.search("/api/v1/claim-profiles/search",t)}async function aP(e,t){return e.post("/api/v1/claim-profiles",t)}async function cP(e,t,r){return e.put(`/api/v1/claim-profiles/${t}`,r)}async function lP(e,t){await e.delete(`/api/v1/claim-profiles/${t}`)}var $S,GK,qS,jS=G(()=>{"use strict";$S=["DAILY","WEEKLY","MONTHLY","QUARTERLY","YEARLY"],GK=["NO_TAX","INCLUSIVE"],qS=["approverUserResourceId","visibleClaimTypeIds","visibleTaxProfileIds","visibleClassifierIds","visibleVendorResourceIds","allowedCurrencies","minClaimAmount","maxClaimAmount","maxPerPeriodAmount","perPeriod","employeeBalanceAccountResourceId","taxMode"]});async function uP(e,t){return e.list("/api/v1/posting-rules",t)}async function dP(e,t){return e.get(`/api/v1/posting-rules/${t}`)}async function TI(e,t){return e.search("/api/v1/posting-rules/search",t)}async function fP(e,t){return e.post("/api/v1/posting-rules",t)}async function pP(e,t,r){return e.put(`/api/v1/posting-rules/${t}`,r)}async function hP(e,t){await e.delete(`/api/v1/posting-rules/${t}`)}var YS,HS,zS=G(()=>{"use strict";YS=["PER_EMPLOYEE","PER_VENDOR","PER_PAIR","ONE_BATCH","PER_CLAIM"],HS=["RAW","BY_CT_TP_NC","BY_CT_TP_NC_EMPLOYEE","BY_CT_TP_NC_VENDOR"]});var JS={};Qo(JS,{default:()=>vNt,log:()=>VK});var mP,wNt,ixe,VK,vNt,GS=G(()=>{"use strict";mP=()=>{},wNt=()=>VK,ixe=(...e)=>{try{process.stderr.write(e.map(String).join(" ")+`
|
|
226
226
|
`)}catch{}},VK={info:mP,warn:mP,error:ixe,debug:mP,trace:mP,fatal:ixe,child:wNt,level:"error"},vNt=VK});import{lookup as WK}from"node:dns/promises";function XK(e){let t;try{t=new URL(e)}catch{return!1}return t.hostname.toLowerCase().replace(/\.+$/,"")==="api.telegram.org"&&t.pathname.startsWith("/file/")}function KK(e){return`unsafe URL: ${e} is not reachable from the Jaz server`}function gP(e,t,r="ssrf_refused"){let n=r==="ssrf_dns_inconclusive_forwarded";Promise.resolve().then(()=>(GS(),JS)).then(({log:i})=>(n?i.info:i.warn).call(i,{host:e,detail:t},r)).catch(()=>process.stderr.write(`[jaz-ssrf] ${r} ${e} (${t})
|
|
227
227
|
`))}async function DNt(e,t){let r;try{return await Promise.race([e,new Promise((n,i)=>{r=setTimeout(()=>i(new Error(`lookup exceeded ${t}ms`)),t),r.unref?.()})])}finally{r&&clearTimeout(r)}}function RNt(e){return e instanceof Error?`${e.code??"no code"}: ${e.message}`:String(e)}async function tf(e,t={}){let r;try{r=new URL(e)}catch{throw new Error(`unsafe URL: malformed (${e})`)}if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error(`unsafe URL: protocol ${r.protocol} not allowed`);let n=r.hostname.replace(/^\[|\]$/g,""),i=s=>{if(t.forwardedOnly)return gP(n,s,"ssrf_dns_inconclusive_forwarded"),r;throw gP(n,s),new Error(KK(n))},o;try{o=t.forwardedOnly?await DNt(WK(n,{all:!0}),SNt):await WK(n,{all:!0})}catch(s){return i(`lookup failed (${RNt(s)})`)}if(o.length===0)return i("lookup returned no records");for(let s of o)if(sxe(s.address,s.family))throw gP(n,`resolves to ${s.address}`),new Error(KK(n));return r}async function ig(e){try{await tf(e,{forwardedOnly:!0})}catch(t){let r=new ht(t.message);throw Jt(r)}}function TNt(e,t,r){WK(e,{all:!0}).then(n=>{for(let o of n)if(sxe(o.address,o.family)){gP(e,`resolves to ${o.address}`),r(new Error(KK(e)));return}let i=n[0];if(!i){r(new Error(`DNS lookup returned no records for ${e}`));return}if(t?.all){r(null,n);return}r(null,i.address,i.family)}).catch(n=>r(n))}async function xNt(){if(AP)return AP;let{Agent:e}=await Promise.resolve().then(()=>no(vK(),1));return AP=new e({connect:{lookup:TNt}}),AP}function BNt(e){return kNt.has(e)}async function yc(e,t){t.skipSsrfCheck||await tf(e.toString());let r=new AbortController,n,i=()=>{clearTimeout(n),n=setTimeout(()=>r.abort(new DOMException("stalled","TimeoutError")),t.timeoutMs)};i();let o={signal:r.signal};t.skipSsrfCheck||(o.dispatcher=await xNt(),o.redirect="manual");let s=await fetch(e,o);if(!t.skipSsrfCheck)for(let f=0;BNt(s.status);f++){if(f>=oxe)throw new Error(`too many redirects (${oxe})`);let p=s.headers.get("location");if(!p)break;let h=new URL(p,s.url||e);await tf(h.toString()),s=await fetch(h,o)}if(!s.ok){clearTimeout(n);let f=()=>{throw new Error(`response body was not read (status ${s.status})`)};return{arrayBuffer:async()=>new ArrayBuffer(0),text:f,json:f,headers:s.headers,ok:s.ok,status:s.status,statusText:s.statusText}}let a=[],c=0;try{if(s.body)for await(let f of s.body){if(i(),c+=f.byteLength,c>t.maxBytes)throw new Error(`response body exceeds maxBytes (${t.maxBytes})`);a.push(f)}}finally{clearTimeout(n)}let u=new Uint8Array(c),d=0;for(let f of a)u.set(f,d),d+=f.byteLength;return a.length=0,{arrayBuffer:async()=>u.buffer,text:async()=>new TextDecoder().decode(u),json:async()=>JSON.parse(new TextDecoder().decode(u)),headers:s.headers,ok:s.ok,status:s.status,statusText:s.statusText}}function sxe(e,t){return t===4?ZK(e):t===6?NNt(e):!0}function ZK(e){let t=e.split(".").map(o=>Number(o));if(t.length!==4||t.some(o=>!Number.isInteger(o)||o<0||o>255))return!0;let[r,n,i]=t;return r===10||r===127||r===0||r===100&&n>=64&&n<=127||r===169&&n===254||r===172&&n>=16&&n<=31||r===192&&n===0&&i===0||r===192&&n===168||r===198&&(n===18||n===19)||r>=224}function NNt(e){let t=e.toLowerCase();if(t==="::1"||t==="::"||t.startsWith("fe8")||t.startsWith("fe9")||t.startsWith("fea")||t.startsWith("feb")||t.startsWith("fc")||t.startsWith("fd"))return!0;if(t.startsWith("::ffff:")){let r=t.slice(7);if(r.includes("."))return ZK(r);let n=r.replace(":","");if(/^[0-9a-f]{8}$/.test(n)){let i=[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),parseInt(n.slice(6,8),16)].join(".");return ZK(i)}}return!1}var xI,yP,SNt,AP,kNt,oxe,Ru=G(()=>{"use strict";vo();ut();xI=15e3,yP=20*1024*1024;SNt=2e3;kNt=new Set([301,302,303,307,308]),oxe=5});function axe(e,t){if(e==null)return[];if(!Array.isArray(e))throw new he("clearFields must be an array of field names");let r=new Set(t);return e.map(n=>{if(typeof n!="string"||!r.has(n))throw new he(`Unsupported clearField: ${String(n)} (allowed: ${t.join(", ")})`);return n})}function og(e,t){return Object.fromEntries(axe(e,t).map(r=>[`clear${r.charAt(0).toUpperCase()}${r.slice(1)}`,!0]))}function cxe(e,t){return Object.fromEntries(axe(e,t).map(r=>[r,null]))}var VS=G(()=>{"use strict";ut()});async function kI(e,t){return e.search("/api/v1/employees/search",t)}async function EP(e,t){return e.search("/api/v1/employees/balances/search",t)}async function bP(e,t){return e.get(`/api/v1/employees/${t}`)}async function IP(e,t){return e.post("/api/v1/employees",t)}function ONt(e){let{clearFields:t,...r}=e,n=Object.fromEntries(Object.entries(r).filter(([s,a])=>a!=null&&(a!==""||s==="email"))),i=cxe(t,e7),o=Object.keys(i).filter(s=>s in n);if(o.length>0)throw new he(`Cannot both set and clear: ${o.join(", ")}. Pass each field as a value OR in clearFields, not both.`);return{...n,...i}}async function CP(e,t,r){return e.put(`/api/v1/employees/${t}`,ONt(r))}async function _P(e,t){return e.delete(`/api/v1/employees/${t}`)}async function wP(e,t,r){return e.post(`/api/v1/employees/${t}/bind-user`,{userResourceId:r})}async function vP(e,t){return await ig(t.fileUrl),e.post("/api/v1/employees/import/preprocess",t,Qt)}async function SP(e,t){if((t.create?.length??0)+(t.update?.length??0)+(t.delete?.length??0)===0)throw new he("import requires at least one create / update / delete row.");for(let[n,i]of Object.entries(t))if(Array.isArray(i)&&i.length>100)throw new he(`max 100 ${n} rows per import. Split into batches.`);return e.post("/api/v1/employees/import",t)}var sg,e7,WS=G(()=>{"use strict";Ru();ut();VS();Ar();sg=["FULL_TIME","PART_TIME","CONTRACTOR","INTERN","TEMPORARY","CONSULTANT"];e7=["email","phone","managerEmployeeResourceId","employmentType","userResourceId"]});function Jt(e){return Object.assign(e,{noWrite:!0})}function DP(e){for(let t of["taxVatApplicable","taxInclusion"])if(e[t]!==void 0&&typeof e[t]!="boolean")throw Jt(new Error(`${t} must be true or false, got ${JSON.stringify(e[t])}. Nothing was changed.`))}function uxe(e,t,r){if(!e||!r)return!1;let n=JSON.stringify(r);return e.some(i=>i.tool_name===t&&typeof i.output=="string"&&i.output.includes(n))}function dxe(e,t,r){return!e||!r?!1:e.some(n=>n.tool_name!==t||n.heldNoWrite||typeof n.output!="string"?!1:n.input?.previewId===r)}async function ZS(e,t){return t?((await _l(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(n=>n.name===t):void 0}async function RP(e,t){return t?((await gI(e,{filter:{itemCode:{eq:t}},limit:5}))?.data??[]).find(n=>n.itemCode===t):void 0}function bI(e){if(typeof e!="string")return String(e??"");let t=e.trim();return QNt[t.toLowerCase()]??t}function TP(e){if(typeof e!="string")return;let t=e.trim().toUpperCase().replace(/[\s-]+/g,"_");return t==="FUNCTIONAL_TO_SOURCE"||t==="SOURCE_TO_FUNCTIONAL"?t:void 0}function t7(e){if(e!=null){if(e!=="FUNCTIONAL_TO_SOURCE"&&e!=="SOURCE_TO_FUNCTIONAL")throw new KS(`Unknown rateDirection ${JSON.stringify(e)}. Use FUNCTIONAL_TO_SOURCE or SOURCE_TO_FUNCTIONAL (exact, upper-case).`);return e}}function r7(e,t){if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new KS(`${t} must be a finite number greater than 0 (got ${JSON.stringify(e)}).`);return e}function zt(e){if(!e||typeof e!="object")return e;let{rateDirection:t,exchangeRate:r,...n}=e;if(t7(t),r===void 0){if(t==="SOURCE_TO_FUNCTIONAL")throw new KS("rateDirection SOURCE_TO_FUNCTIONAL was supplied without exchangeRate \u2014 there is nothing to invert. Provide the rate, or drop rateDirection.");return{...n}}r7(r,"exchangeRate");let i=t==="SOURCE_TO_FUNCTIONAL"?1/r:r;return{...n,exchangeRate:i}}function jp(e,t){if(!e?.exchangeRate)return;let{sourceCurrency:r,exchangeRate:n,rateDirection:i}=e,o=i==="SOURCE_TO_FUNCTIONAL"?1/n:n,s=r||"the foreign currency",a=[`FX: 1 base unit = ${qp(o)} ${s}`];return i==="SOURCE_TO_FUNCTIONAL"&&a.push(`(from 1 ${s} = ${qp(n)} base, inverted for you)`),typeof t=="number"&&Number.isFinite(t)&&t>0&&a.push(`\u2192 ${s} ${qp(t)} books as ${qp(t/o)} base`),a.join(" ")}function n7(e){if(!e)return;let{baseCurrency:t,sourceCurrency:r,exchangeRate:n,date:i}=e;if(!(typeof t!="string"||t.length===0)&&!(typeof r!="string"||r.length===0)&&!(typeof i!="string"||i.length===0)&&!(typeof n!="number"||!Number.isFinite(n)||n<=0))return`FX: 1 ${t} (your base) = ${qp(n)} ${r} (applied rate for ${i})`}function XS(e,t){return n7(e)??jp(t)}function qp(e){return Number.isFinite(e)?new Intl.NumberFormat("en-US",{maximumSignificantDigits:10,maximumFractionDigits:20,useGrouping:!1,notation:"standard"}).format(e):String(e)}async function fxe(e,t){if(!t?.trim())return;let r=t.trim().toLowerCase();return((await CI(e,{filter:{title:{contains:t.trim()}},limit:20}))?.data??[]).find(i=>i.title?.trim().toLowerCase()===r)}async function xP(e,t){if(!t?.trim())return;let r=t.trim().toLowerCase();return((await II(e))?.data??[]).find(i=>i.displayName?.trim().toLowerCase()===r)}async function kP(e,t){return t?((await EI(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(n=>n.name===t):void 0}async function BP(e,t){return t?((await wI(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(n=>n.name===t):void 0}async function NP(e,t){if(!t)return;let r=t.toLowerCase().trim();return((await vI(e,{limit:500}))?.data??[]).find(i=>i.name.toLowerCase().trim()===r)}async function OP(e,t){if(!t)return;let r=t.toLowerCase().trim();return((await DI(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(i=>i.name.toLowerCase().trim()===r)}async function FP(e,t){if(!t)return;let r=t.toLowerCase().trim();return((await RI(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(i=>i.name.toLowerCase().trim()===r)}async function QP(e,t){if(!t)return;let r=t.toLowerCase().trim();return((await TI(e,{filter:{name:{eq:t}},limit:5}))?.data??[]).find(i=>i.name.toLowerCase().trim()===r)}async function LP(e,t){if(!t)return;let r=t.toLowerCase().trim();return((await kI(e,{filter:{email:{eq:t}},limit:5}))?.data??[]).find(i=>i.email?.toLowerCase().trim()===r)}function $Nt(e){let t=Date.parse(`${e}T00:00:00Z`);return Number.isNaN(t)?e:new Date(t+864e5).toISOString().slice(0,10)}function PP(e){if(!Array.isArray(e))return;let t=0;for(let r of e){if(!r||typeof r!="object")return;let n=r;if(n.discount!==void 0&&n.discount!==null&&Number(n.discount)!==0)return;let i=Number(n.quantity),o=Number(n.unitPrice);if(!Number.isFinite(i)||!Number.isFinite(o))return;t+=i*o}return t>0?t:void 0}async function MP(e,t){let{contactResourceId:r,valueDate:n,currencyCode:i,lineSubtotal:o}=t;if(!r||!n)return;let s={contactResourceId:{eq:r},valueDate:{gte:n,lte:$Nt(n)},status:{in:[...LNt]}};return i&&(s.currencyCode={eq:i}),o!==void 0&&(s.totalAmount={gte:o*PNt,lte:o*MNt}),((await Kd(e,{filter:s,limit:UNt}))?.data??[]).find(c=>c.contactResourceId===r&&Xd(c.valueDate)===n&&(!i||c.currencyCode===i)&&String(c.status??"").toUpperCase()!=="VOID")}function o7(e){return(Array.isArray(e.paymentRecords)?e.paymentRecords:[]).filter(r=>!i7.has(String(r.status??"").toUpperCase()))}function pxe(e){let t=e.currencyExchange;return!!t?.sourceCurrencyCode&&!!t.baseCurrencyCode&&t.sourceCurrencyCode!==t.baseCurrencyCode}function lxe(e){let t=Su(e)??{},r=i=>i==null?null:Number(i),n=hI(t.withholdingTax);return JSON.stringify([r(t.quantity),r(t.unitPrice),r(t.discount)??0,t.taxProfileResourceId??null,n?.code??null,r(n?.rate)])}function hxe(e,t){if(!Array.isArray(t))return!1;let r=(Array.isArray(e)?e:[]).map(lxe).sort(),n=t.map(lxe).sort();return r.length!==n.length||r.some((i,o)=>i!==n[o])}function mxe(e,t){let r=t?"refund":"payment",n=e.map(i=>{let o=o7(i).map(s=>`${s.reference??r} ${i.currencyCode??""} ${s.transactionAmount??s.paymentAmount}${s.valueDate?` on ${String(s.valueDate).slice(0,10)}`:""}`.replace(/\s+/g," "));return`${i.reference??i.resourceId}: ${o.join(", ")}`}).join("; ");return`Nothing was changed. This changes the amount, currency or exchange rate of a document with recorded ${r}s, and the platform then deletes them and releases their bank matches; nothing records them again. ${n}. Tell the user exactly which ${r}s this deletes, end your turn, and retry with allowPaymentDeletion: true only after they confirm. They can record them again afterwards.`}function Ji(e,t,r){if(!Ec.test(e))throw new he(`${t} must be a valid UUID (got "${e}"). ${r}`)}function s7(e,t,r){if(!qNt.test(e))throw new he(`${t} must be a 20-character letters-and-digits id, not a UUID (got "${e}"). ${r}`)}function Axe(e,t){if(!jNt.test(e)||YNt.test(e))throw new he(`notificationId must be 1 to 128 letters, digits, "|", "_" or "-", and not of the form __x__ (got "${e}"). ${t}`)}function bc(e,t,r="entity"){if(!e.includes(t))throw new he(`unknown ${r} "${t}": expected one of ${e.join(", ")}`);return t}function vl(e,t={}){if(!(t.assumeFinalize===!0||e.saveAsDraft===!1))return;let n=e.lineItems;if(!Array.isArray(n)||n.length===0)return;let i=[];for(let a=0;a<n.length;a++){let c=n[a];if(!c||typeof c!="object")continue;let u=c.accountResourceId;(typeof u!="string"||u.trim().length===0)&&i.push(a)}if(i.length===0)return;let o=i.slice(0,5).join(", "),s=i.length>5?` (and ${i.length-5} more)`:"";return{error:`lineItems[${o}]${s}: accountResourceId is required when finalizing.`,status:422,hint:"Pre-flight guard \u2014 request never hit Clio. Search for the right GL account first, then retry with the resourceId on each line item.",repair:{tool:"search_accounts",arguments:{},reason:"Line item missing accountResourceId on a finalize call. Search for the GL account (by name or accountType) and attach the resourceId to each line item."}}}function UP(e,t,r){let n=e.totalAmount===void 0?"amount unknown":`${e.currencyCode??""} ${e.totalAmount}`.trim();return`Nothing was created. A bill from this supplier already exists on ${Xd(e.valueDate)??t??"an unknown date"}: ${e.reference} (${n}, ${e.status}). Show it to the user and ask whether this is the same document. If they confirm it is a separate bill, retry with ${r}.`}function rf(e){if(e.userType!=="ADMIN")return;if(Array.isArray(e.moduleRoles)?e.moduleRoles.length>0:e.moduleRoles!==void 0&&e.moduleRoles!==null)throw new he("userType ADMIN grants every module, so moduleRoles cannot apply \u2014 sending both is a contradiction, and it was previously resolved by ignoring moduleRoles and granting full access. Use userType CUSTOM_USER with moduleRoles for restricted access, or drop moduleRoles to grant ADMIN deliberately.");if(e.role!==void 0&&e.role!=="ADMIN")throw new he(`userType ADMIN grants every module, so role ${e.role} cannot apply \u2014 this combination used to silently drop the role and grant full admin. Use --user-type CUSTOM_USER --role ${e.role} for restricted access, or drop --role to grant ADMIN deliberately.`)}var FNt,$Ur,QNt,KS,LNt,PNt,MNt,UNt,i7,Ec,he,qNt,jNt,YNt,ut=G(()=>{"use strict";vo();ng();Zd();xS();FL();NS();YL();PS();SI();$p();iP();jS();zS();WS();FNt=["duplicate_skipped","duplicate_suspected","invalid_transfer","confirmation_required"],$Ur=new Set(FNt);QNt={"current assets":"Current Asset","current asset":"Current Asset","non-current assets":"Non-current Asset","non-current asset":"Non-current Asset","noncurrent asset":"Non-current Asset","non current asset":"Non-current Asset","fixed assets":"Fixed Asset","fixed asset":"Fixed Asset","bank account":"Bank Accounts","bank accounts":"Bank Accounts",bank:"Bank Accounts","current liabilities":"Current Liability","current liability":"Current Liability","non-current liabilities":"Non-current Liability","non-current liability":"Non-current Liability","noncurrent liability":"Non-current Liability","non current liability":"Non-current Liability",equity:"Shareholders Equity","shareholders equity":"Shareholders Equity","shareholders' equity":"Shareholders Equity","shareholder's equity":"Shareholders Equity",revenue:"Operating Revenue","operating revenue":"Operating Revenue","other revenue":"Other Revenue","other income":"Other Revenue",expense:"Operating Expense","operating expense":"Operating Expense",expenses:"Operating Expense","operating expenses":"Operating Expense","other expense":"Other Expense","other expenses":"Other Expense","direct costs":"Direct Costs","direct cost":"Direct Costs","cost of goods sold":"Direct Costs",cogs:"Direct Costs","cost of sales":"Direct Costs",cash:"Cash","cash and cash equivalents":"Cash",inventory:"Inventory","discontinued expense":"Discontinued Expense","discontinued income":"Discontinued Income","finance cost":"Finance Cost","finance costs":"Finance Cost","financing income":"Financing Income",goodwill:"Goodwill","income tax expense":"Income Tax Expense","income tax":"Income Tax Expense","tax expense":"Income Tax Expense","investing expense":"Investing Expense","investing income":"Investing Income",investment:"Investment",investments:"Investment"};KS=class extends ht{constructor(t){super(t),this.name="ExchangeRateError"}};LNt=["DRAFT","UNPAID","PARTIALLY_PAID","PAID"],PNt=.995,MNt=1.3,UNt=20;i7=new Set(["VOID","VOIDED","DELETED","CANCELLED","INACTIVE"]);Ec=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,he=class extends ht{constructor(t){super(t),this.name="ApiValidationError"}};qNt=/^[A-Za-z0-9]{20}$/;jNt=/^[A-Za-z0-9|_-]{1,128}$/,YNt=/^__.*__$/});var Sxe=I(nn=>{"use strict";function Cxe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var _xe;function vxe(e,t,r,n,i){if(i===void 0&&(i=nn.PaymentDueTime.End),e===0)return-(n+r*t);var o=Math.pow(1+e,t);return-n*o-r*(1+e*(i===nn.PaymentDueTime.Begin?1:0))/e*(o-1)}function c7(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=nn.PaymentDueTime.End);var o=e===0,s=Math.pow(1+e,t),a=i===nn.PaymentDueTime.Begin?1:0,c=o?1:e;return-(n+r*s)/(o?t:(1+c*a)*(s-1)/c)}function wxe(e,t,r,n,i,o){if(i===void 0&&(i=0),o===void 0&&(o=nn.PaymentDueTime.End),t<1)return Number.NaN;if(o===nn.PaymentDueTime.Begin&&t===1)return 0;var s=HNt(e,t,c7(e,r,n,i,o),n,o)*e;return o===nn.PaymentDueTime.Begin&&t>1&&(s/=1+e),s}function a7(e,t){return t.reduce((function(r,n,i){return r+n/Math.pow(1+e,i)}),0)}function HNt(e,t,r,n,i){return vxe(e,t-1,r,n,i)}function zNt(e,t,r,n,i,o){var s=o===nn.PaymentDueTime.Begin?1:0,a=Math.pow(e+1,t),c=Math.pow(e+1,t-1);return(i+a*n+r*(a-1)*(e*s+1)/e)/(t*c*n-r*(a-1)*(e*s+1)/Math.pow(e,2)+t*r*c*(e*s+1)/e+r*(a-1)*s/e)}function JNt(e,t,r){for(var n=r+1,i=e[0],o=1;o<e.length;o++)i+=e[o]/Math.pow(n,(t[o]-t[0])/365);return i}function GNt(e,t,r){for(var n=r+1,i=0,o=1;o<e.length;o++){var s=(t[o]-t[0])/365;i-=s*e[o]/Math.pow(n,s+1)}return i}Object.defineProperty(nn,"__esModule",{value:!0}),nn.PaymentDueTime=void 0,(_xe=nn.PaymentDueTime||(nn.PaymentDueTime={})).Begin="begin",_xe.End="end",nn.fv=vxe,nn.ipmt=wxe,nn.irr=function(e,t,r,n){t===void 0&&(t=.1),r===void 0&&(r=1e-6),n===void 0&&(n=100);for(var i=[],o=!1,s=!1,a=0;a<e.length;a++)i[a]=a===0?0:i[a-1]+365,e[a]>0&&(o=!0),e[a]<0&&(s=!0);if(!o||!s)return Number.NaN;var c=t,u=0,d=0,f=0,p=0,h=!0;do u=c-(f=JNt(e,i,c))/GNt(e,i,c),d=Math.abs(u-c),c=u,h=d>r&&Math.abs(f)>r;while(h&&++p<n);return h?Number.NaN:c},nn.mirr=function(e,t,r){for(var n,i=!1,o=!1,s=(function(d,f){var p=typeof Symbol<"u"&&d[Symbol.iterator]||d["@@iterator"];if(p)return(p=p.call(d)).next.bind(p);if(Array.isArray(d)||(p=(function(m,A){if(m){if(typeof m=="string")return Cxe(m,A);var g=Object.prototype.toString.call(m).slice(8,-1);return g==="Object"&&m.constructor&&(g=m.constructor.name),g==="Map"||g==="Set"?Array.from(m):g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?Cxe(m,A):void 0}})(d))){p&&(d=p);var h=0;return function(){return h>=d.length?{done:!0}:{done:!1,value:d[h++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
228
228
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})(e);!(n=s()).done;){var a=n.value;a>0&&(i=!0),a<0&&(o=!0)}if(!i||!o)return Number.NaN;var c=Math.abs(a7(r,e.map((function(d){return d>0?d:0})))),u=Math.abs(a7(t,e.map((function(d){return d<0?d:0}))));return Math.pow(c/u,1/(e.length-1))*(1+r)-1},nn.nper=function(e,t,r,n,i){if(n===void 0&&(n=0),i===void 0&&(i=nn.PaymentDueTime.End),e===0)return-(n+r)/t;var o=t*(1+e*(i===nn.PaymentDueTime.Begin?1:0))/e;return Math.log((-n+o)/(r+o))/Math.log(1+e)},nn.npv=a7,nn.pmt=c7,nn.ppmt=function(e,t,r,n,i,o){return i===void 0&&(i=0),o===void 0&&(o=nn.PaymentDueTime.End),c7(e,r,n,i,o)-wxe(e,t,r,n,i,o)},nn.pv=function(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=nn.PaymentDueTime.End);var o=i===nn.PaymentDueTime.Begin?1:0,s=e===0,a=Math.pow(1+e,t);return-(n+r*(s?t:(1+e*o)*(a-1)/e))/a},nn.rate=function(e,t,r,n,i,o,s,a){i===void 0&&(i=nn.PaymentDueTime.End),o===void 0&&(o=.1),s===void 0&&(s=1e-6),a===void 0&&(a=100);for(var c=o,u=0,d=!1;u<a&&!d;){var f=c-zNt(c,e,t,r,n,i);d=Math.abs(f-c)<s,u++,c=f}return d?c:Number.NaN}});var xxe=I(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});function VNt(e,t){if(e){if(typeof e=="string")return Dxe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dxe(e,t)}}function Dxe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function WNt(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=VNt(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
@@ -833,7 +833,7 @@ USE THIS to check a specific draft; for "what does this contact normally look li
|
|
|
833
833
|
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,Gt._)`[${i}]`)}}}function aRr({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Gt._)`${t} !== undefined`,()=>e.assign((0,Gt._)`${t}[${r}]`,n))}function YAe(e,t,r,n=Tv.Correct){let i=n===Tv.Correct?Gt.operators.EQ:Gt.operators.NEQ,o;switch(e){case"null":return(0,Gt._)`${t} ${i} null`;case"array":o=(0,Gt._)`Array.isArray(${t})`;break;case"object":o=(0,Gt._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s((0,Gt._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return(0,Gt._)`typeof ${t} ${i} ${e}`}return n===Tv.Correct?o:(0,Gt.not)(o);function s(a=Gt.nil){return(0,Gt.and)((0,Gt._)`typeof ${t} == "number"`,a,r?(0,Gt._)`isFinite(${t})`:Gt.nil)}}xs.checkDataType=YAe;function HAe(e,t,r,n){if(e.length===1)return YAe(e[0],t,r,n);let i,o=(0,rdt.toHash)(e);if(o.array&&o.object){let s=(0,Gt._)`typeof ${t} != "object"`;i=o.null?s:(0,Gt._)`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else i=Gt.nil;o.number&&delete o.integer;for(let s in o)i=(0,Gt.and)(i,YAe(s,t,r,n));return i}xs.checkDataTypes=HAe;var cRr={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Gt._)`{type: ${e}}`:(0,Gt._)`{type: ${t}}`};function zAe(e){let t=lRr(e);(0,rRr.reportError)(t,cRr)}xs.reportTypeError=zAe;function lRr(e){let{gen:t,data:r,schema:n}=e,i=(0,rdt.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var sdt=I(S4=>{"use strict";Object.defineProperty(S4,"__esModule",{value:!0});S4.assignDefaults=void 0;var xv=Kt(),uRr=Rr();function dRr(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)odt(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,o)=>odt(e,o,i.default))}S4.assignDefaults=dRr;function odt(e,t,r){let{gen:n,compositeRule:i,data:o,opts:s}=e;if(r===void 0)return;let a=(0,xv._)`${o}${(0,xv.getProperty)(t)}`;if(i){(0,uRr.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,xv._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,xv._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,xv._)`${a} = ${(0,xv.stringify)(r)}`)}});var el=I(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.validateUnion=fn.validateArray=fn.usePattern=fn.callValidateCode=fn.schemaProperties=fn.allSchemaProperties=fn.noPropertyInData=fn.propertyInData=fn.isOwnProperty=fn.hasPropFunc=fn.reportMissingProp=fn.checkMissingProp=fn.checkReportMissingProp=void 0;var Qn=Kt(),JAe=Rr(),aA=ap(),fRr=Rr();function pRr(e,t){let{gen:r,data:n,it:i}=e;r.if(VAe(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Qn._)`${t}`},!0),e.error()})}fn.checkReportMissingProp=pRr;function hRr({gen:e,data:t,it:{opts:r}},n,i){return(0,Qn.or)(...n.map(o=>(0,Qn.and)(VAe(e,t,o,r.ownProperties),(0,Qn._)`${i} = ${o}`)))}fn.checkMissingProp=hRr;function mRr(e,t){e.setParams({missingProperty:t},!0),e.error()}fn.reportMissingProp=mRr;function adt(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Qn._)`Object.prototype.hasOwnProperty`})}fn.hasPropFunc=adt;function GAe(e,t,r){return(0,Qn._)`${adt(e)}.call(${t}, ${r})`}fn.isOwnProperty=GAe;function ARr(e,t,r,n){let i=(0,Qn._)`${t}${(0,Qn.getProperty)(r)} !== undefined`;return n?(0,Qn._)`${i} && ${GAe(e,t,r)}`:i}fn.propertyInData=ARr;function VAe(e,t,r,n){let i=(0,Qn._)`${t}${(0,Qn.getProperty)(r)} === undefined`;return n?(0,Qn.or)(i,(0,Qn.not)(GAe(e,t,r))):i}fn.noPropertyInData=VAe;function cdt(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}fn.allSchemaProperties=cdt;function gRr(e,t){return cdt(t).filter(r=>!(0,JAe.alwaysValidSchema)(e,t[r]))}fn.schemaProperties=gRr;function yRr({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,c,u){let d=u?(0,Qn._)`${e}, ${t}, ${n}${i}`:t,f=[[aA.default.instancePath,(0,Qn.strConcat)(aA.default.instancePath,o)],[aA.default.parentData,s.parentData],[aA.default.parentDataProperty,s.parentDataProperty],[aA.default.rootData,aA.default.rootData]];s.opts.dynamicRef&&f.push([aA.default.dynamicAnchors,aA.default.dynamicAnchors]);let p=(0,Qn._)`${d}, ${r.object(...f)}`;return c!==Qn.nil?(0,Qn._)`${a}.call(${c}, ${p})`:(0,Qn._)`${a}(${p})`}fn.callValidateCode=yRr;var ERr=(0,Qn._)`new RegExp`;function bRr({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Qn._)`${i.code==="new RegExp"?ERr:(0,fRr.useFunc)(e,i)}(${r}, ${n})`})}fn.usePattern=bRr;function IRr(e){let{gen:t,data:r,keyword:n,it:i}=e,o=t.name("valid");if(i.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(o,!0),s(()=>t.break()),o;function s(a){let c=t.const("len",(0,Qn._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:JAe.Type.Num},o),t.if((0,Qn.not)(o),a)})}}fn.validateArray=IRr;function CRr(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,JAe.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(s,(0,Qn._)`${s} || ${a}`),e.mergeValidEvaluated(d,a)||t.if((0,Qn.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}fn.validateUnion=CRr});var ddt=I(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.validateKeywordUsage=Ed.validSchemaType=Ed.funcKeywordCode=Ed.macroKeywordCode=void 0;var ea=Kt(),PE=ap(),_Rr=el(),wRr=wO();function vRr(e,t){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=e,a=t.macro.call(s.self,i,o,s),c=udt(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ea.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Ed.macroKeywordCode=vRr;function SRr(e,t){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:c}=e;RRr(c,t);let u=!a&&t.compile?t.compile.call(c.self,o,s,c):t.validate,d=udt(n,i,u),f=n.let("valid");e.block$data(f,p),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function p(){if(t.errors===!1)A(),t.modifying&&ldt(e),g(()=>e.error());else{let y=t.async?h():m();t.modifying&&ldt(e),g(()=>DRr(e,y))}}function h(){let y=n.let("ruleErrs",null);return n.try(()=>A((0,ea._)`await `),b=>n.assign(f,!1).if((0,ea._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,ea._)`${b}.errors`),()=>n.throw(b))),y}function m(){let y=(0,ea._)`${d}.errors`;return n.assign(y,null),A(ea.nil),y}function A(y=t.async?(0,ea._)`await `:ea.nil){let b=c.opts.passContext?PE.default.this:PE.default.self,E=!("compile"in t&&!a||t.schema===!1);n.assign(f,(0,ea._)`${y}${(0,_Rr.callValidateCode)(e,d,b,E)}`,t.modifying)}function g(y){var b;n.if((0,ea.not)((b=t.valid)!==null&&b!==void 0?b:f),y)}}Ed.funcKeywordCode=SRr;function ldt(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,ea._)`${n.parentData}[${n.parentDataProperty}]`))}function DRr(e,t){let{gen:r}=e;r.if((0,ea._)`Array.isArray(${t})`,()=>{r.assign(PE.default.vErrors,(0,ea._)`${PE.default.vErrors} === null ? ${t} : ${PE.default.vErrors}.concat(${t})`).assign(PE.default.errors,(0,ea._)`${PE.default.vErrors}.length`),(0,wRr.extendErrors)(e)},()=>e.error())}function RRr({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function udt(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,ea.stringify)(r)})}function TRr(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")}Ed.validSchemaType=TRr;function xRr({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ed.validateKeywordUsage=xRr});var pdt=I(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});cA.extendSubschemaMode=cA.extendSubschemaData=cA.getSubschema=void 0;var bd=Kt(),fdt=Rr();function kRr(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,bd._)`${e.schemaPath}${(0,bd.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,bd._)`${e.schemaPath}${(0,bd.getProperty)(t)}${(0,bd.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,fdt.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}cA.getSubschema=kRr;function BRr(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:d,opts:f}=t,p=a.let("data",(0,bd._)`${t.data}${(0,bd.getProperty)(r)}`,!0);c(p),e.errorPath=(0,bd.str)`${u}${(0,fdt.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,bd._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(i!==void 0){let u=i instanceof bd.Name?i:a.let("data",i,!0);c(u),s!==void 0&&(e.propertyName=s)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}cA.extendSubschemaData=BRr;function NRr(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}cA.extendSubschemaMode=NRr});var WAe=I((dfn,hdt)=>{"use strict";hdt.exports=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,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))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(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Adt=I((ffn,mdt)=>{"use strict";var lA=mdt.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};D4(t,n,i,e,"",e)};lA.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};lA.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};lA.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};lA.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 D4(e,t,r,n,i,o,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,o,s,a,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in lA.arrayKeywords)for(var p=0;p<f.length;p++)D4(e,t,r,f[p],i+"/"+d+"/"+p,o,i,d,n,p)}else if(d in lA.propsKeywords){if(f&&typeof f=="object")for(var h in f)D4(e,t,r,f[h],i+"/"+d+"/"+ORr(h),o,i,d,n,h)}else(d in lA.keywords||e.allKeys&&!(d in lA.skipKeywords))&&D4(e,t,r,f,i+"/"+d,o,i,d,n)}r(n,i,o,s,a,c,u)}}function ORr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var SO=I(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.getSchemaRefs=Ra.resolveUrl=Ra.normalizeId=Ra._getFullPath=Ra.getFullPath=Ra.inlineRef=void 0;var FRr=Rr(),QRr=WAe(),LRr=Adt(),PRr=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function MRr(e,t=!0){return typeof e=="boolean"?!0:t===!0?!KAe(e):t?gdt(e)<=t:!1}Ra.inlineRef=MRr;var URr=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function KAe(e){for(let t in e){if(URr.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(KAe)||typeof r=="object"&&KAe(r))return!0}return!1}function gdt(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!PRr.has(r)&&(typeof e[r]=="object"&&(0,FRr.eachItem)(e[r],n=>t+=gdt(n)),t===1/0))return 1/0}return t}function ydt(e,t="",r){r!==!1&&(t=kv(t));let n=e.parse(t);return Edt(e,n)}Ra.getFullPath=ydt;function Edt(e,t){return e.serialize(t).split("#")[0]+"#"}Ra._getFullPath=Edt;var $Rr=/#\/?$/;function kv(e){return e?e.replace($Rr,""):""}Ra.normalizeId=kv;function qRr(e,t,r){return r=kv(r),e.resolve(t,r)}Ra.resolveUrl=qRr;var jRr=/^[a-z_][-a-z0-9._]*$/i;function YRr(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=kv(e[r]||t),o={"":i},s=ydt(n,i,!1),a={},c=new Set;return LRr(e,{allKeys:!0},(f,p,h,m)=>{if(m===void 0)return;let A=s+p,g=o[m];typeof f[r]=="string"&&(g=y.call(this,f[r])),b.call(this,f.$anchor),b.call(this,f.$dynamicAnchor),o[p]=g;function y(E){let C=this.opts.uriResolver.resolve;if(E=kv(g?C(g,E):E),c.has(E))throw d(E);c.add(E);let w=this.refs[E];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(f,w.schema,E):E!==kv(A)&&(E[0]==="#"?(u(f,a[E],E),a[E]=f):this.refs[E]=A),E}function b(E){if(typeof E=="string"){if(!jRr.test(E))throw new Error(`invalid anchor "${E}"`);y.call(this,`#${E}`)}}}),a;function u(f,p,h){if(p!==void 0&&!QRr(f,p))throw d(h)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ra.getSchemaRefs=YRr});var TO=I(uA=>{"use strict";Object.defineProperty(uA,"__esModule",{value:!0});uA.getData=uA.KeywordCxt=uA.validateFunctionCode=void 0;var wdt=Xut(),bdt=vO(),XAe=jAe(),R4=vO(),HRr=sdt(),RO=ddt(),ZAe=pdt(),ct=Kt(),Mt=ap(),zRr=SO(),cp=Rr(),DO=wO();function JRr(e){if(Ddt(e)&&(Rdt(e),Sdt(e))){WRr(e);return}vdt(e,()=>(0,wdt.topBoolOrEmptySchema)(e))}uA.validateFunctionCode=JRr;function vdt({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,(0,ct._)`${Mt.default.data}, ${Mt.default.valCxt}`,n.$async,()=>{e.code((0,ct._)`"use strict"; ${Idt(r,i)}`),VRr(e,i),e.code(o)}):e.func(t,(0,ct._)`${Mt.default.data}, ${GRr(i)}`,n.$async,()=>e.code(Idt(r,i)).code(o))}function GRr(e){return(0,ct._)`{${Mt.default.instancePath}="", ${Mt.default.parentData}, ${Mt.default.parentDataProperty}, ${Mt.default.rootData}=${Mt.default.data}${e.dynamicRef?(0,ct._)`, ${Mt.default.dynamicAnchors}={}`:ct.nil}}={}`}function VRr(e,t){e.if(Mt.default.valCxt,()=>{e.var(Mt.default.instancePath,(0,ct._)`${Mt.default.valCxt}.${Mt.default.instancePath}`),e.var(Mt.default.parentData,(0,ct._)`${Mt.default.valCxt}.${Mt.default.parentData}`),e.var(Mt.default.parentDataProperty,(0,ct._)`${Mt.default.valCxt}.${Mt.default.parentDataProperty}`),e.var(Mt.default.rootData,(0,ct._)`${Mt.default.valCxt}.${Mt.default.rootData}`),t.dynamicRef&&e.var(Mt.default.dynamicAnchors,(0,ct._)`${Mt.default.valCxt}.${Mt.default.dynamicAnchors}`)},()=>{e.var(Mt.default.instancePath,(0,ct._)`""`),e.var(Mt.default.parentData,(0,ct._)`undefined`),e.var(Mt.default.parentDataProperty,(0,ct._)`undefined`),e.var(Mt.default.rootData,Mt.default.data),t.dynamicRef&&e.var(Mt.default.dynamicAnchors,(0,ct._)`{}`)})}function WRr(e){let{schema:t,opts:r,gen:n}=e;vdt(e,()=>{r.$comment&&t.$comment&&xdt(e),tTr(e),n.let(Mt.default.vErrors,null),n.let(Mt.default.errors,0),r.unevaluated&&KRr(e),Tdt(e),iTr(e)})}function KRr(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,ct._)`${r}.evaluated`),t.if((0,ct._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,ct._)`${e.evaluated}.props`,(0,ct._)`undefined`)),t.if((0,ct._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,ct._)`${e.evaluated}.items`,(0,ct._)`undefined`))}function Idt(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,ct._)`/*# sourceURL=${r} */`:ct.nil}function ZRr(e,t){if(Ddt(e)&&(Rdt(e),Sdt(e))){XRr(e,t);return}(0,wdt.boolOrEmptySchema)(e,t)}function Sdt({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Ddt(e){return typeof e.schema!="boolean"}function XRr(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&xdt(e),rTr(e),nTr(e);let o=n.const("_errs",Mt.default.errors);Tdt(e,o),n.var(t,(0,ct._)`${o} === ${Mt.default.errors}`)}function Rdt(e){(0,cp.checkUnknownRules)(e),eTr(e)}function Tdt(e,t){if(e.opts.jtd)return Cdt(e,[],!1,t);let r=(0,bdt.getSchemaTypes)(e.schema),n=(0,bdt.coerceAndCheckDataType)(e,r);Cdt(e,r,!n,t)}function eTr(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,cp.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function tTr(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,cp.checkStrictMode)(e,"default is ignored in the schema root")}function rTr(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,zRr.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function nTr(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function xdt({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)e.code((0,ct._)`${Mt.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,ct.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,ct._)`${Mt.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function iTr(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if((0,ct._)`${Mt.default.errors} === 0`,()=>t.return(Mt.default.data),()=>t.throw((0,ct._)`new ${i}(${Mt.default.vErrors})`)):(t.assign((0,ct._)`${n}.errors`,Mt.default.vErrors),o.unevaluated&&oTr(e),t.return((0,ct._)`${Mt.default.errors} === 0`))}function oTr({gen:e,evaluated:t,props:r,items:n}){r instanceof ct.Name&&e.assign((0,ct._)`${t}.props`,r),n instanceof ct.Name&&e.assign((0,ct._)`${t}.items`,n)}function Cdt(e,t,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,cp.schemaHasRulesButRef)(o,d))){i.block(()=>Bdt(e,"$ref",d.all.$ref.definition));return}c.jtd||sTr(e,t),i.block(()=>{for(let p of d.rules)f(p);f(d.post)});function f(p){(0,XAe.shouldUseGroup)(o,p)&&(p.type?(i.if((0,R4.checkDataType)(p.type,s,c.strictNumbers)),_dt(e,p),t.length===1&&t[0]===p.type&&r&&(i.else(),(0,R4.reportTypeError)(e)),i.endIf()):_dt(e,p),a||i.if((0,ct._)`${Mt.default.errors} === ${n||0}`))}}function _dt(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,HRr.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,XAe.shouldUseRule)(n,o)&&Bdt(e,o.keyword,o.definition,t.type)})}function sTr(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(aTr(e,t),e.opts.allowUnionTypes||cTr(e,t),lTr(e,e.dataTypes))}function aTr(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{kdt(e.dataTypes,r)||ege(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),dTr(e,t)}}function cTr(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ege(e,"use allowUnionTypes to allow union type keyword")}function lTr(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,XAe.shouldUseRule)(e.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>uTr(t,s))&&ege(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function uTr(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function kdt(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function dTr(e,t){let r=[];for(let n of e.dataTypes)kdt(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ege(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,cp.checkStrictMode)(e,t,e.opts.strictTypes)}var T4=class{constructor(t,r,n){if((0,RO.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,cp.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",Ndt(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,RO.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",Mt.default.errors))}result(t,r,n){this.failResult((0,ct.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,ct.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);let{schemaCode:r}=this;this.fail((0,ct._)`${r} !== undefined && (${(0,ct.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?DO.reportExtraError:DO.reportError)(this,this.def.error,r)}$dataError(){(0,DO.reportError)(this,this.def.$dataError||DO.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,DO.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=ct.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=ct.nil,r=ct.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,ct.or)((0,ct._)`${i} === undefined`,r)),t!==ct.nil&&n.assign(t,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==ct.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,ct.or)(s(),a());function s(){if(n.length){if(!(r instanceof ct.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ct._)`${(0,R4.checkDataTypes)(c,r,o.opts.strictNumbers,R4.DataType.Wrong)}`}return ct.nil}function a(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,ct._)`!${c}(${r})`}return ct.nil}}subschema(t,r){let n=(0,ZAe.getSubschema)(this.it,t);(0,ZAe.extendSubschemaData)(n,this.it,t),(0,ZAe.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return ZRr(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=cp.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=cp.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,ct.Name)),!0}};uA.KeywordCxt=T4;function Bdt(e,t,r,n){let i=new T4(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,RO.funcKeywordCode)(i,r):"macro"in r?(0,RO.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,RO.funcKeywordCode)(i,r)}var fTr=/^\/(?:[^~]|~0|~1)*$/,pTr=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ndt(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(e==="")return Mt.default.rootData;if(e[0]==="/"){if(!fTr.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=Mt.default.rootData}else{let u=pTr.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(i=u[2],i==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(o=r[t-d],!i)return o}let s=o,a=i.split("/");for(let u of a)u&&(o=(0,ct._)`${o}${(0,ct.getProperty)((0,cp.unescapeJsonPointer)(u))}`,s=(0,ct._)`${s} && ${o}`);return s;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}uA.getData=Ndt});var x4=I(rge=>{"use strict";Object.defineProperty(rge,"__esModule",{value:!0});var tge=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};rge.default=tge});var xO=I(oge=>{"use strict";Object.defineProperty(oge,"__esModule",{value:!0});var nge=SO(),ige=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,nge.resolveUrl)(t,r,n),this.missingSchema=(0,nge.normalizeId)((0,nge.getFullPath)(t,this.missingRef))}};oge.default=ige});var B4=I(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.resolveSchema=tl.getCompilingSchema=tl.resolveRef=tl.compileSchema=tl.SchemaEnv=void 0;var au=Kt(),hTr=x4(),ME=ap(),cu=SO(),Odt=Rr(),mTr=TO(),Bv=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,cu.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};tl.SchemaEnv=Bv;function age(e){let t=Fdt.call(this,e);if(t)return t;let r=(0,cu.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new au.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;e.$async&&(a=s.scopeValue("Error",{ref:hTr.default,code:(0,au._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ME.default.data,parentData:ME.default.parentData,parentDataProperty:ME.default.parentDataProperty,dataNames:[ME.default.data],dataPathArr:[au.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,au.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:au.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,au._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,mTr.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let f=s.toString();d=`${s.scopeRefs(ME.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));let h=new Function(`${ME.default.self}`,`${ME.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async&&(h.$async=!0),this.opts.code.source===!0&&(h.source={validateName:c,validateCode:f,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:A}=u;h.evaluated={props:m instanceof au.Name?void 0:m,items:A instanceof au.Name?void 0:A,dynamicProps:m instanceof au.Name,dynamicItems:A instanceof au.Name},h.source&&(h.source.evaluated=(0,au.stringify)(h.evaluated))}return e.validate=h,e}catch(f){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),f}finally{this._compilations.delete(e)}}tl.compileSchema=age;function ATr(e,t,r){var n;r=(0,cu.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let o=ETr.call(this,e,r);if(o===void 0){let s=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new Bv({schema:s,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=gTr.call(this,o)}tl.resolveRef=ATr;function gTr(e){return(0,cu.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:age.call(this,e)}function Fdt(e){for(let t of this._compilations)if(yTr(t,e))return t}tl.getCompilingSchema=Fdt;function yTr(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function ETr(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||k4.call(this,e,t)}function k4(e,t){let r=this.opts.uriResolver.parse(t),n=(0,cu._getFullPath)(this.opts.uriResolver,r),i=(0,cu.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return sge.call(this,r,e);let o=(0,cu.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=k4.call(this,e,s);return typeof a?.schema!="object"?void 0:sge.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||age.call(this,s),o===(0,cu.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(i=(0,cu.resolveUrl)(this.opts.uriResolver,i,u)),new Bv({schema:a,schemaId:c,root:e,baseId:i})}return sge.call(this,r,s)}}tl.resolveSchema=k4;var bTr=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function sge(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Odt.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!bTr.has(a)&&u&&(t=(0,cu.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Odt.schemaHasRulesButRef)(r,this.RULES)){let a=(0,cu.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=k4.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new Bv({schema:r,schemaId:s,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var Qdt=I((yfn,ITr)=>{ITr.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var lge=I((Efn,Udt)=>{"use strict";var CTr=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Pdt=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 cge(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var _Tr=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ldt(e){return e.length=0,!0}function wTr(e,t,r){if(e.length){let n=cge(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function vTr(e){let t=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,s=!1,a=wTr;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(s=!0),!a(i,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(o=!0),n.push(":");continue}else if(u==="%"){if(!a(i,n,r))break;a=Ldt}else{i.push(u);continue}}return i.length&&(a===Ldt?r.zone=i.join(""):s?n.push(i.join("")):n.push(cge(i))),r.address=n.join(""),r}function Mdt(e){if(STr(e,":")<2)return{host:e,isIPV6:!1};let t=vTr(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 STr(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function DTr(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function RTr(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function TTr(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Pdt(r)){let n=Mdt(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Udt.exports={nonSimpleDomain:_Tr,recomposeAuthority:TTr,normalizeComponentEncoding:RTr,removeDotSegments:DTr,isIPv4:Pdt,isUUID:CTr,normalizeIPv6:Mdt,stringArrayToHexStripped:cge}});var Hdt=I((bfn,Ydt)=>{"use strict";var{isUUID:xTr}=lge(),kTr=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,BTr=["http","https","ws","wss","urn","urn:uuid"];function NTr(e){return BTr.indexOf(e)!==-1}function uge(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function $dt(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function qdt(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function OTr(e){return e.secure=uge(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function FTr(e){if((e.port===(uge(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function QTr(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(kTr);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,o=dge(i);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function LTr(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,o=dge(i);o&&(e=o.serialize(e,t));let s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s}function PTr(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!xTr(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function MTr(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var jdt={scheme:"http",domainHost:!0,parse:$dt,serialize:qdt},UTr={scheme:"https",domainHost:jdt.domainHost,parse:$dt,serialize:qdt},N4={scheme:"ws",domainHost:!0,parse:OTr,serialize:FTr},$Tr={scheme:"wss",domainHost:N4.domainHost,parse:N4.parse,serialize:N4.serialize},qTr={scheme:"urn",parse:QTr,serialize:LTr,skipNormalize:!0},jTr={scheme:"urn:uuid",parse:PTr,serialize:MTr,skipNormalize:!0},O4={http:jdt,https:UTr,ws:N4,wss:$Tr,urn:qTr,"urn:uuid":jTr};Object.setPrototypeOf(O4,null);function dge(e){return e&&(O4[e]||O4[e.toLowerCase()])||void 0}Ydt.exports={wsIsSecure:uge,SCHEMES:O4,isValidSchemeName:NTr,getSchemeHandler:dge}});var Gdt=I((Ifn,Q4)=>{"use strict";var{normalizeIPv6:YTr,removeDotSegments:kO,recomposeAuthority:HTr,normalizeComponentEncoding:F4,isIPv4:zTr,nonSimpleDomain:JTr}=lge(),{SCHEMES:GTr,getSchemeHandler:zdt}=Hdt();function VTr(e,t){return typeof e=="string"?e=Id(lp(e,t),t):typeof e=="object"&&(e=lp(Id(e,t),t)),e}function WTr(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=Jdt(lp(e,n),lp(t,n),n,!0);return n.skipEscape=!0,Id(i,n)}function Jdt(e,t,r,n){let i={};return n||(e=lp(Id(e,r),r),t=lp(Id(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=kO(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=kO(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=kO(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=kO(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function KTr(e,t,r){return typeof e=="string"?(e=unescape(e),e=Id(F4(lp(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Id(F4(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Id(F4(lp(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Id(F4(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Id(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),i=[],o=zdt(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let s=HTr(r);if(s!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(s),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=kO(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var ZTr=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function lp(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(ZTr);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(zTr(n.host)===!1){let c=YTr(n.host);n.host=c.host.toLowerCase(),i=c.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=zdt(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&i===!1&&JTr(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var fge={SCHEMES:GTr,normalize:VTr,resolve:WTr,resolveComponent:Jdt,equal:KTr,serialize:Id,parse:lp};Q4.exports=fge;Q4.exports.default=fge;Q4.exports.fastUri=fge});var Wdt=I(pge=>{"use strict";Object.defineProperty(pge,"__esModule",{value:!0});var Vdt=Gdt();Vdt.code='require("ajv/dist/runtime/uri").default';pge.default=Vdt});var ift=I(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.CodeGen=Xo.Name=Xo.nil=Xo.stringify=Xo.str=Xo._=Xo.KeywordCxt=void 0;var XTr=TO();Object.defineProperty(Xo,"KeywordCxt",{enumerable:!0,get:function(){return XTr.KeywordCxt}});var Nv=Kt();Object.defineProperty(Xo,"_",{enumerable:!0,get:function(){return Nv._}});Object.defineProperty(Xo,"str",{enumerable:!0,get:function(){return Nv.str}});Object.defineProperty(Xo,"stringify",{enumerable:!0,get:function(){return Nv.stringify}});Object.defineProperty(Xo,"nil",{enumerable:!0,get:function(){return Nv.nil}});Object.defineProperty(Xo,"Name",{enumerable:!0,get:function(){return Nv.Name}});Object.defineProperty(Xo,"CodeGen",{enumerable:!0,get:function(){return Nv.CodeGen}});var exr=x4(),tft=xO(),txr=qAe(),BO=B4(),rxr=Kt(),NO=SO(),L4=vO(),mge=Rr(),Kdt=Qdt(),nxr=Wdt(),rft=(e,t)=>new RegExp(e,t);rft.code="new RegExp";var ixr=["removeAdditional","useDefaults","coerceTypes"],oxr=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sxr={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."},axr={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Zdt=200;function cxr(e){var t,r,n,i,o,s,a,c,u,d,f,p,h,m,A,g,y,b,E,C,w,T,R,k,O;let J=e.strict,j=(t=e.code)===null||t===void 0?void 0:t.optimize,S=j===!0||j===void 0?1:j||0,N=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:rft,P=(i=e.uriResolver)!==null&&i!==void 0?i:nxr.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:J)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:J)!==null&&c!==void 0?c:!0,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:J)!==null&&d!==void 0?d:"log",strictTuples:(p=(f=e.strictTuples)!==null&&f!==void 0?f:J)!==null&&p!==void 0?p:"log",strictRequired:(m=(h=e.strictRequired)!==null&&h!==void 0?h:J)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:S,regExp:N}:{optimize:S,regExp:N},loopRequired:(A=e.loopRequired)!==null&&A!==void 0?A:Zdt,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:Zdt,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(E=e.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(T=e.validateSchema)!==null&&T!==void 0?T:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(k=e.unicodeRegExp)!==null&&k!==void 0?k:!0,int32range:(O=e.int32range)!==null&&O!==void 0?O:!0,uriResolver:P}}var OO=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...cxr(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new rxr.ValueScope({scope:{},prefixes:oxr,es5:r,lines:n}),this.logger=hxr(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,txr.getRules)(),Xdt.call(this,sxr,t,"NOT SUPPORTED"),Xdt.call(this,axr,t,"DEPRECATED","warn"),this._metaOpts=fxr.call(this),t.formats&&uxr.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&dxr.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),lxr.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Kdt;n==="id"&&(i={...Kdt},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(d,f){await o.call(this,d.$schema);let p=this._addSchema(d,f);return p.validate||s.call(this,p)}async function o(d){d&&!this.getSchema(d)&&await i.call(this,{$ref:d},!0)}async function s(d){try{return this._compileSchemaEnv(d)}catch(f){if(!(f instanceof tft.default))throw f;return a.call(this,f),await c.call(this,f.missingSchema),s.call(this,d)}}function a({missingSchema:d,missingRef:f}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${f} cannot be resolved`)}async function c(d){let f=await u.call(this,d);this.refs[d]||await o.call(this,f.$schema),this.refs[d]||this.addSchema(f,d,r)}async function u(d){let f=this._loading[d];if(f)return f;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,n,i);return this}let o;if(typeof t=="object"){let{schemaId:s}=this.opts;if(o=t[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,NO.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,t);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(t){let r;for(;typeof(r=eft.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new BO.SchemaEnv({schema:{},schemaId:n});if(r=BO.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=eft.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,NO.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Axr.call(this,n,r),!r)return(0,mge.eachItem)(n,o=>hge.call(this,o)),this;yxr.call(this,r);let i={...r,type:(0,L4.getJSONTypes)(r.type),schemaType:(0,L4.getJSONTypes)(r.schemaType)};return(0,mge.eachItem)(n,i.type.length===0?o=>hge.call(this,o,i):o=>i.type.forEach(s=>hge.call(this,o,i,s))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let o=i.split("/").slice(1),s=t;for(let a of o)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,d=s[a];u&&d&&(s[a]=nft(d))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,NO.normalizeId)(s||n);let u=NO.getSchemaRefs.call(this,t,n);return c=new BO.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):BO.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{BO.compileSchema.call(this,t)}finally{this.opts=r}}};OO.ValidationError=exr.default;OO.MissingRefError=tft.default;Xo.default=OO;function Xdt(e,t,r,n="error"){for(let i in e){let o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function eft(e){return e=(0,NO.normalizeId)(e),this.schemas[e]||this.refs[e]}function lxr(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function uxr(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function dxr(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function fxr(){let e={...this.opts};for(let t of ixr)delete e[t];return e}var pxr={log(){},warn(){},error(){}};function hxr(e){if(e===!1)return pxr;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var mxr=/^[a-z_$][a-z0-9_$:-]*$/i;function Axr(e,t){let{RULES:r}=this;if((0,mge.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!mxr.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function hge(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,L4.getJSONTypes)(t.type),schemaType:(0,L4.getJSONTypes)(t.schemaType)}};t.before?gxr.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function gxr(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function yxr(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=nft(t)),e.validateSchema=this.compile(t,!0))}var Exr={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function nft(e){return{anyOf:[e,Exr]}}});var oft=I(Age=>{"use strict";Object.defineProperty(Age,"__esModule",{value:!0});var bxr={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Age.default=bxr});var lft=I(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.callRef=UE.getValidate=void 0;var Ixr=xO(),sft=el(),Ta=Kt(),Ov=ap(),aft=B4(),P4=Rr(),Cxr={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&i===u.baseId)return f();let d=aft.resolveRef.call(c,u,i,r);if(d===void 0)throw new Ixr.default(n.opts.uriResolver,i,r);if(d instanceof aft.SchemaEnv)return p(d);return h(d);function f(){if(o===u)return M4(e,s,o,o.$async);let m=t.scopeValue("root",{ref:u});return M4(e,(0,Ta._)`${m}.validate`,u,u.$async)}function p(m){let A=cft(e,m);M4(e,A,m,m.$async)}function h(m){let A=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Ta.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:Ta.nil,topSchemaRef:A,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function cft(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ta._)`${r.scopeValue("wrapper",{ref:t})}.validate`}UE.getValidate=cft;function M4(e,t,r,n){let{gen:i,it:o}=e,{allErrors:s,schemaEnv:a,opts:c}=o,u=c.passContext?Ov.default.this:Ta.nil;n?d():f();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Ta._)`await ${(0,sft.callValidateCode)(e,t,u)}`),h(t),s||i.assign(m,!0)},A=>{i.if((0,Ta._)`!(${A} instanceof ${o.ValidationError})`,()=>i.throw(A)),p(A),s||i.assign(m,!1)}),e.ok(m)}function f(){e.result((0,sft.callValidateCode)(e,t,u),()=>h(t),()=>p(t))}function p(m){let A=(0,Ta._)`${m}.errors`;i.assign(Ov.default.vErrors,(0,Ta._)`${Ov.default.vErrors} === null ? ${A} : ${Ov.default.vErrors}.concat(${A})`),i.assign(Ov.default.errors,(0,Ta._)`${Ov.default.vErrors}.length`)}function h(m){var A;if(!o.opts.unevaluated)return;let g=(A=r?.validate)===null||A===void 0?void 0:A.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=P4.mergeEvaluated.props(i,g.props,o.props));else{let y=i.var("props",(0,Ta._)`${m}.evaluated.props`);o.props=P4.mergeEvaluated.props(i,y,o.props,Ta.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=P4.mergeEvaluated.items(i,g.items,o.items));else{let y=i.var("items",(0,Ta._)`${m}.evaluated.items`);o.items=P4.mergeEvaluated.items(i,y,o.items,Ta.Name)}}}UE.callRef=M4;UE.default=Cxr});var uft=I(gge=>{"use strict";Object.defineProperty(gge,"__esModule",{value:!0});var _xr=oft(),wxr=lft(),vxr=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_xr.default,wxr.default];gge.default=vxr});var dft=I(yge=>{"use strict";Object.defineProperty(yge,"__esModule",{value:!0});var U4=Kt(),dA=U4.operators,$4={maximum:{okStr:"<=",ok:dA.LTE,fail:dA.GT},minimum:{okStr:">=",ok:dA.GTE,fail:dA.LT},exclusiveMaximum:{okStr:"<",ok:dA.LT,fail:dA.GTE},exclusiveMinimum:{okStr:">",ok:dA.GT,fail:dA.LTE}},Sxr={message:({keyword:e,schemaCode:t})=>(0,U4.str)`must be ${$4[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,U4._)`{comparison: ${$4[e].okStr}, limit: ${t}}`},Dxr={keyword:Object.keys($4),type:"number",schemaType:"number",$data:!0,error:Sxr,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,U4._)`${r} ${$4[t].fail} ${n} || isNaN(${r})`)}};yge.default=Dxr});var fft=I(Ege=>{"use strict";Object.defineProperty(Ege,"__esModule",{value:!0});var FO=Kt(),Rxr={message:({schemaCode:e})=>(0,FO.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,FO._)`{multipleOf: ${e}}`},Txr={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Rxr,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,o=i.opts.multipleOfPrecision,s=t.let("res"),a=o?(0,FO._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,FO._)`${s} !== parseInt(${s})`;e.fail$data((0,FO._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Ege.default=Txr});var hft=I(bge=>{"use strict";Object.defineProperty(bge,"__esModule",{value:!0});function pft(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}bge.default=pft;pft.code='require("ajv/dist/runtime/ucs2length").default'});var mft=I(Ige=>{"use strict";Object.defineProperty(Ige,"__esModule",{value:!0});var $E=Kt(),xxr=Rr(),kxr=hft(),Bxr={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,$E.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,$E._)`{limit: ${e}}`},Nxr={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Bxr,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,o=t==="maxLength"?$E.operators.GT:$E.operators.LT,s=i.opts.unicode===!1?(0,$E._)`${r}.length`:(0,$E._)`${(0,xxr.useFunc)(e.gen,kxr.default)}(${r})`;e.fail$data((0,$E._)`${s} ${o} ${n}`)}};Ige.default=Nxr});var Aft=I(Cge=>{"use strict";Object.defineProperty(Cge,"__esModule",{value:!0});var Oxr=el(),Fxr=Rr(),Fv=Kt(),Qxr={message:({schemaCode:e})=>(0,Fv.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Fv._)`{pattern: ${e}}`},Lxr={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Qxr,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,Fv._)`new RegExp`:(0,Fxr.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,(0,Fv._)`${u}(${o}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data((0,Fv._)`!${d}`)}else{let c=(0,Oxr.usePattern)(e,i);e.fail$data((0,Fv._)`!${c}.test(${r})`)}}};Cge.default=Lxr});var gft=I(_ge=>{"use strict";Object.defineProperty(_ge,"__esModule",{value:!0});var QO=Kt(),Pxr={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,QO.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,QO._)`{limit: ${e}}`},Mxr={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Pxr,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?QO.operators.GT:QO.operators.LT;e.fail$data((0,QO._)`Object.keys(${r}).length ${i} ${n}`)}};_ge.default=Mxr});var yft=I(wge=>{"use strict";Object.defineProperty(wge,"__esModule",{value:!0});var LO=el(),PO=Kt(),Uxr=Rr(),$xr={message:({params:{missingProperty:e}})=>(0,PO.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,PO._)`{missingProperty: ${e}}`},qxr={keyword:"required",type:"object",schemaType:"array",$data:!0,error:$xr,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:o,it:s}=e,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():d(),a.strictRequired){let h=e.parentSchema.properties,{definedProperties:m}=e.it;for(let A of r)if(h?.[A]===void 0&&!m.has(A)){let g=s.schemaEnv.baseId+s.errSchemaPath,y=`required property "${A}" is not defined at "${g}" (strictRequired)`;(0,Uxr.checkStrictMode)(s,y,s.opts.strictRequired)}}function u(){if(c||o)e.block$data(PO.nil,f);else for(let h of r)(0,LO.checkReportMissingProp)(e,h)}function d(){let h=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>p(h,m)),e.ok(m)}else t.if((0,LO.checkMissingProp)(e,r,h)),(0,LO.reportMissingProp)(e,h),t.else()}function f(){t.forOf("prop",n,h=>{e.setParams({missingProperty:h}),t.if((0,LO.noPropertyInData)(t,i,h,a.ownProperties),()=>e.error())})}function p(h,m){e.setParams({missingProperty:h}),t.forOf(h,n,()=>{t.assign(m,(0,LO.propertyInData)(t,i,h,a.ownProperties)),t.if((0,PO.not)(m),()=>{e.error(),t.break()})},PO.nil)}}};wge.default=qxr});var Eft=I(vge=>{"use strict";Object.defineProperty(vge,"__esModule",{value:!0});var MO=Kt(),jxr={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,MO.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,MO._)`{limit: ${e}}`},Yxr={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:jxr,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?MO.operators.GT:MO.operators.LT;e.fail$data((0,MO._)`${r}.length ${i} ${n}`)}};vge.default=Yxr});var q4=I(Sge=>{"use strict";Object.defineProperty(Sge,"__esModule",{value:!0});var bft=WAe();bft.code='require("ajv/dist/runtime/equal").default';Sge.default=bft});var Ift=I(Rge=>{"use strict";Object.defineProperty(Rge,"__esModule",{value:!0});var Dge=vO(),es=Kt(),Hxr=Rr(),zxr=q4(),Jxr={message:({params:{i:e,j:t}})=>(0,es.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,es._)`{i: ${e}, j: ${t}}`},Gxr={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Jxr,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=e;if(!n&&!i)return;let c=t.let("valid"),u=o.items?(0,Dge.getSchemaTypes)(o.items):[];e.block$data(c,d,(0,es._)`${s} === false`),e.ok(c);function d(){let m=t.let("i",(0,es._)`${r}.length`),A=t.let("j");e.setParams({i:m,j:A}),t.assign(c,!0),t.if((0,es._)`${m} > 1`,()=>(f()?p:h)(m,A))}function f(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,A){let g=t.name("item"),y=(0,Dge.checkDataTypes)(u,g,a.opts.strictNumbers,Dge.DataType.Wrong),b=t.const("indices",(0,es._)`{}`);t.for((0,es._)`;${m}--;`,()=>{t.let(g,(0,es._)`${r}[${m}]`),t.if(y,(0,es._)`continue`),u.length>1&&t.if((0,es._)`typeof ${g} == "string"`,(0,es._)`${g} += "_"`),t.if((0,es._)`typeof ${b}[${g}] == "number"`,()=>{t.assign(A,(0,es._)`${b}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,es._)`${b}[${g}] = ${m}`)})}function h(m,A){let g=(0,Hxr.useFunc)(t,zxr.default),y=t.name("outer");t.label(y).for((0,es._)`;${m}--;`,()=>t.for((0,es._)`${A} = ${m}; ${A}--;`,()=>t.if((0,es._)`${g}(${r}[${m}], ${r}[${A}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};Rge.default=Gxr});var Cft=I(xge=>{"use strict";Object.defineProperty(xge,"__esModule",{value:!0});var Tge=Kt(),Vxr=Rr(),Wxr=q4(),Kxr={message:"must be equal to constant",params:({schemaCode:e})=>(0,Tge._)`{allowedValue: ${e}}`},Zxr={keyword:"const",$data:!0,error:Kxr,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Tge._)`!${(0,Vxr.useFunc)(t,Wxr.default)}(${r}, ${i})`):e.fail((0,Tge._)`${o} !== ${r}`)}};xge.default=Zxr});var _ft=I(kge=>{"use strict";Object.defineProperty(kge,"__esModule",{value:!0});var UO=Kt(),Xxr=Rr(),ekr=q4(),tkr={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,UO._)`{allowedValues: ${e}}`},rkr={keyword:"enum",schemaType:"array",$data:!0,error:tkr,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:s}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,Xxr.useFunc)(t,ekr.default)),d;if(a||n)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let h=t.const("vSchema",o);d=(0,UO.or)(...i.map((m,A)=>p(h,A)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",o,h=>t.if((0,UO._)`${u()}(${r}, ${h})`,()=>t.assign(d,!0).break()))}function p(h,m){let A=i[m];return typeof A=="object"&&A!==null?(0,UO._)`${u()}(${r}, ${h}[${m}])`:(0,UO._)`${r} === ${A}`}}};kge.default=rkr});var wft=I(Bge=>{"use strict";Object.defineProperty(Bge,"__esModule",{value:!0});var nkr=dft(),ikr=fft(),okr=mft(),skr=Aft(),akr=gft(),ckr=yft(),lkr=Eft(),ukr=Ift(),dkr=Cft(),fkr=_ft(),pkr=[nkr.default,ikr.default,okr.default,skr.default,akr.default,ckr.default,lkr.default,ukr.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dkr.default,fkr.default];Bge.default=pkr});var Oge=I($O=>{"use strict";Object.defineProperty($O,"__esModule",{value:!0});$O.validateAdditionalItems=void 0;var qE=Kt(),Nge=Rr(),hkr={message:({params:{len:e}})=>(0,qE.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,qE._)`{limit: ${e}}`},mkr={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hkr,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Nge.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}vft(e,n)}};function vft(e,t){let{gen:r,schema:n,data:i,keyword:o,it:s}=e;s.items=!0;let a=r.const("len",(0,qE._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,qE._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Nge.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,qE._)`${a} <= ${t.length}`);r.if((0,qE.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:Nge.Type.Num},u),s.allErrors||r.if((0,qE.not)(u),()=>r.break())})}}$O.validateAdditionalItems=vft;$O.default=mkr});var Fge=I(qO=>{"use strict";Object.defineProperty(qO,"__esModule",{value:!0});qO.validateTuple=void 0;var Sft=Kt(),j4=Rr(),Akr=el(),gkr={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Dft(e,"additionalItems",t);r.items=!0,!(0,j4.alwaysValidSchema)(r,t)&&e.ok((0,Akr.validateArray)(e))}};function Dft(e,t,r=e.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=e;d(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=j4.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Sft._)`${o}.length`);r.forEach((f,p)=>{(0,j4.alwaysValidSchema)(a,f)||(n.if((0,Sft._)`${u} > ${p}`,()=>e.subschema({keyword:s,schemaProp:p,dataProp:p},c)),e.ok(c))});function d(f){let{opts:p,errSchemaPath:h}=a,m=r.length,A=m===f.minItems&&(m===f.maxItems||f[t]===!1);if(p.strictTuples&&!A){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0,j4.checkStrictMode)(a,g,p.strictTuples)}}}qO.validateTuple=Dft;qO.default=gkr});var Rft=I(Qge=>{"use strict";Object.defineProperty(Qge,"__esModule",{value:!0});var ykr=Fge(),Ekr={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ykr.validateTuple)(e,"items")};Qge.default=Ekr});var xft=I(Lge=>{"use strict";Object.defineProperty(Lge,"__esModule",{value:!0});var Tft=Kt(),bkr=Rr(),Ikr=el(),Ckr=Oge(),_kr={message:({params:{len:e}})=>(0,Tft.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Tft._)`{limit: ${e}}`},wkr={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_kr,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,bkr.alwaysValidSchema)(n,t)&&(i?(0,Ckr.validateAdditionalItems)(e,i):e.ok((0,Ikr.validateArray)(e)))}};Lge.default=wkr});var kft=I(Pge=>{"use strict";Object.defineProperty(Pge,"__esModule",{value:!0});var rl=Kt(),Y4=Rr(),vkr={message:({params:{min:e,max:t}})=>t===void 0?(0,rl.str)`must contain at least ${e} valid item(s)`:(0,rl.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,rl._)`{minContains: ${e}}`:(0,rl._)`{minContains: ${e}, maxContains: ${t}}`},Skr={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:vkr,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e,s,a,{minContains:c,maxContains:u}=n;o.opts.next?(s=c===void 0?1:c,a=u):s=1;let d=t.const("len",(0,rl._)`${i}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Y4.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Y4.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Y4.alwaysValidSchema)(o,r)){let A=(0,rl._)`${d} >= ${s}`;a!==void 0&&(A=(0,rl._)`${A} && ${d} <= ${a}`),e.pass(A);return}o.items=!0;let f=t.name("valid");a===void 0&&s===1?h(f,()=>t.if(f,()=>t.break())):s===0?(t.let(f,!0),a!==void 0&&t.if((0,rl._)`${i}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){let A=t.name("_valid"),g=t.let("count",0);h(A,()=>t.if(A,()=>m(g)))}function h(A,g){t.forRange("i",0,d,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Y4.Type.Num,compositeRule:!0},A),g()})}function m(A){t.code((0,rl._)`${A}++`),a===void 0?t.if((0,rl._)`${A} >= ${s}`,()=>t.assign(f,!0).break()):(t.if((0,rl._)`${A} > ${a}`,()=>t.assign(f,!1).break()),s===1?t.assign(f,!0):t.if((0,rl._)`${A} >= ${s}`,()=>t.assign(f,!0)))}}};Pge.default=Skr});var Oft=I(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.validateSchemaDeps=Cd.validatePropertyDeps=Cd.error=void 0;var Mge=Kt(),Dkr=Rr(),jO=el();Cd.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Mge.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Mge._)`{property: ${e},
|
|
834
834
|
missingProperty: ${n},
|
|
835
835
|
depsCount: ${t},
|
|
836
|
-
deps: ${r}}`};var Rkr={keyword:"dependencies",type:"object",schemaType:"object",error:Cd.error,code(e){let[t,r]=Tkr(e);Bft(e,t),Nft(e,r)}};function Tkr({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function Bft(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,jO.propertyInData)(r,n,s,i.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let u of a)(0,jO.checkReportMissingProp)(e,u)}):(r.if((0,Mge._)`${c} && (${(0,jO.checkMissingProp)(e,a,o)})`),(0,jO.reportMissingProp)(e,o),r.else())}}Cd.validatePropertyDeps=Bft;function Nft(e,t=e.schema){let{gen:r,data:n,keyword:i,it:o}=e,s=r.name("valid");for(let a in t)(0,Dkr.alwaysValidSchema)(o,t[a])||(r.if((0,jO.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}Cd.validateSchemaDeps=Nft;Cd.default=Rkr});var Qft=I(Uge=>{"use strict";Object.defineProperty(Uge,"__esModule",{value:!0});var Fft=Kt(),xkr=Rr(),kkr={message:"property name must be valid",params:({params:e})=>(0,Fft._)`{propertyName: ${e.propertyName}}`},Bkr={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:kkr,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,xkr.alwaysValidSchema)(i,r))return;let o=t.name("valid");t.forIn("key",n,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,Fft.not)(o),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(o)}};Uge.default=Bkr});var qge=I($ge=>{"use strict";Object.defineProperty($ge,"__esModule",{value:!0});var H4=el(),lu=Kt(),Nkr=ap(),z4=Rr(),Okr={message:"must NOT have additional properties",params:({params:e})=>(0,lu._)`{additionalProperty: ${e.additionalProperty}}`},Fkr={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Okr,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,z4.alwaysValidSchema)(s,r))return;let u=(0,H4.allSchemaProperties)(n.properties),d=(0,H4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,lu._)`${o} === ${Nkr.default.errors}`);function f(){t.forIn("key",i,g=>{!u.length&&!d.length?m(g):t.if(p(g),()=>m(g))})}function p(g){let y;if(u.length>8){let b=(0,z4.schemaRefOrVal)(s,n.properties,"properties");y=(0,H4.isOwnProperty)(t,b,g)}else u.length?y=(0,lu.or)(...u.map(b=>(0,lu._)`${g} === ${b}`)):y=lu.nil;return d.length&&(y=(0,lu.or)(y,...d.map(b=>(0,lu._)`${(0,H4.usePattern)(e,b)}.test(${g})`))),(0,lu.not)(y)}function h(g){t.code((0,lu._)`delete ${i}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){h(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,z4.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(A(g,y,!1),t.if((0,lu.not)(y),()=>{e.reset(),h(g)})):(A(g,y),a||t.if((0,lu.not)(y),()=>t.break()))}}function A(g,y,b){let E={keyword:"additionalProperties",dataProp:g,dataPropType:z4.Type.Str};b===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(E,y)}}};$ge.default=Fkr});var Mft=I(Yge=>{"use strict";Object.defineProperty(Yge,"__esModule",{value:!0});var Qkr=TO(),Lft=el(),jge=Rr(),Pft=qge(),Lkr={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Pft.default.code(new Qkr.KeywordCxt(o,Pft.default,"additionalProperties"));let s=(0,Lft.allSchemaProperties)(r);for(let f of s)o.definedProperties.add(f);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=jge.mergeEvaluated.props(t,(0,jge.toHash)(s),o.props));let a=s.filter(f=>!(0,jge.alwaysValidSchema)(o,r[f]));if(a.length===0)return;let c=t.name("valid");for(let f of a)u(f)?d(f):(t.if((0,Lft.propertyInData)(t,i,f,o.opts.ownProperties)),d(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function u(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};Yge.default=Lkr});var jft=I(Hge=>{"use strict";Object.defineProperty(Hge,"__esModule",{value:!0});var Uft=el(),J4=Kt(),$ft=Rr(),qft=Rr(),Pkr={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:s}=o,a=(0,Uft.allSchemaProperties)(r),c=a.filter(A=>(0,$ft.alwaysValidSchema)(o,r[A]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&i.properties,d=t.name("valid");o.props!==!0&&!(o.props instanceof J4.Name)&&(o.props=(0,qft.evaluatedPropsToName)(t,o.props));let{props:f}=o;p();function p(){for(let A of a)u&&h(A),o.allErrors?m(A):(t.var(d,!0),m(A),t.if(d))}function h(A){for(let g in u)new RegExp(A).test(g)&&(0,$ft.checkStrictMode)(o,`property ${g} matches pattern ${A} (use allowMatchingProperties)`)}function m(A){t.forIn("key",n,g=>{t.if((0,J4._)`${(0,Uft.usePattern)(e,A)}.test(${g})`,()=>{let y=c.includes(A);y||e.subschema({keyword:"patternProperties",schemaProp:A,dataProp:g,dataPropType:qft.Type.Str},d),o.opts.unevaluated&&f!==!0?t.assign((0,J4._)`${f}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,J4.not)(d),()=>t.break())})})}}};Hge.default=Pkr});var Yft=I(zge=>{"use strict";Object.defineProperty(zge,"__esModule",{value:!0});var Mkr=Rr(),Ukr={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Mkr.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};zge.default=Ukr});var Hft=I(Jge=>{"use strict";Object.defineProperty(Jge,"__esModule",{value:!0});var $kr=el(),qkr={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:$kr.validateUnion,error:{message:"must match a schema in anyOf"}};Jge.default=qkr});var zft=I(Gge=>{"use strict";Object.defineProperty(Gge,"__esModule",{value:!0});var G4=Kt(),jkr=Rr(),Ykr={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,G4._)`{passingSchemas: ${e.passing}}`},Hkr={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Ykr,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,f)=>{let p;(0,jkr.alwaysValidSchema)(i,d)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,G4._)`${c} && ${s}`).assign(s,!1).assign(a,(0,G4._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,f),p&&e.mergeEvaluated(p,G4.Name)})})}}};Gge.default=Hkr});var Jft=I(Vge=>{"use strict";Object.defineProperty(Vge,"__esModule",{value:!0});var zkr=Rr(),Jkr={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((o,s)=>{if((0,zkr.alwaysValidSchema)(n,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},i);e.ok(i),e.mergeEvaluated(a)})}};Vge.default=Jkr});var Wft=I(Wge=>{"use strict";Object.defineProperty(Wge,"__esModule",{value:!0});var V4=Kt(),Vft=Rr(),Gkr={message:({params:e})=>(0,V4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,V4._)`{failingKeyword: ${e.ifClause}}`},Vkr={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Gkr,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Vft.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Gft(n,"then"),o=Gft(n,"else");if(!i&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),i&&o){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else i?t.if(a,u("then")):t.if((0,V4.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{let p=e.subschema({keyword:d},a);t.assign(s,a),e.mergeValidEvaluated(p,s),f?t.assign(f,(0,V4._)`${d}`):e.setParams({ifClause:d})}}}};function Gft(e,t){let r=e.schema[t];return r!==void 0&&!(0,Vft.alwaysValidSchema)(e,r)}Wge.default=Vkr});var Kft=I(Kge=>{"use strict";Object.defineProperty(Kge,"__esModule",{value:!0});var Wkr=Rr(),Kkr={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Wkr.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Kge.default=Kkr});var Zft=I(Zge=>{"use strict";Object.defineProperty(Zge,"__esModule",{value:!0});var Zkr=Oge(),Xkr=Rft(),eBr=Fge(),tBr=xft(),rBr=kft(),nBr=Oft(),iBr=Qft(),oBr=qge(),sBr=Mft(),aBr=jft(),cBr=Yft(),lBr=Hft(),uBr=zft(),dBr=Jft(),fBr=Wft(),pBr=Kft();function hBr(e=!1){let t=[cBr.default,lBr.default,uBr.default,dBr.default,fBr.default,pBr.default,iBr.default,oBr.default,nBr.default,sBr.default,aBr.default];return e?t.push(Xkr.default,tBr.default):t.push(Zkr.default,eBr.default),t.push(rBr.default),t}Zge.default=hBr});var Xft=I(Xge=>{"use strict";Object.defineProperty(Xge,"__esModule",{value:!0});var qi=Kt(),mBr={message:({schemaCode:e})=>(0,qi.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,qi._)`{format: ${e}}`},ABr={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mBr,code(e,t){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!c.validateFormats)return;i?p():h();function p(){let m=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),A=r.const("fDef",(0,qi._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,qi._)`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>r.assign(g,(0,qi._)`${A}.type || "string"`).assign(y,(0,qi._)`${A}.validate`),()=>r.assign(g,(0,qi._)`"string"`).assign(y,A)),e.fail$data((0,qi.or)(b(),E()));function b(){return c.strictSchema===!1?qi.nil:(0,qi._)`${s} && !${y}`}function E(){let C=d.$async?(0,qi._)`(${A}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,qi._)`${y}(${n})`,w=(0,qi._)`(typeof ${y} == "function" ? ${C} : ${y}.test(${n}))`;return(0,qi._)`${y} && ${y} !== true && ${g} === ${t} && !${w}`}}function h(){let m=f.formats[o];if(!m){b();return}if(m===!0)return;let[A,g,y]=E(m);A===t&&e.pass(C());function b(){if(c.strictSchema===!1){f.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function E(w){let T=w instanceof RegExp?(0,qi.regexpCode)(w):c.code.formats?(0,qi._)`${c.code.formats}${(0,qi.getProperty)(o)}`:void 0,R=r.scopeValue("formats",{key:o,ref:w,code:T});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,qi._)`${R}.validate`]:["string",w,R]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!d.$async)throw new Error("async format in sync schema");return(0,qi._)`await ${y}(${n})`}return typeof g=="function"?(0,qi._)`${y}(${n})`:(0,qi._)`${y}.test(${n})`}}}};Xge.default=ABr});var ept=I(eye=>{"use strict";Object.defineProperty(eye,"__esModule",{value:!0});var gBr=Xft(),yBr=[gBr.default];eye.default=yBr});var tpt=I(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});Qv.contentVocabulary=Qv.metadataVocabulary=void 0;Qv.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Qv.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var npt=I(tye=>{"use strict";Object.defineProperty(tye,"__esModule",{value:!0});var EBr=uft(),bBr=wft(),IBr=Zft(),CBr=ept(),rpt=tpt(),_Br=[EBr.default,bBr.default,(0,IBr.default)(),CBr.default,rpt.metadataVocabulary,rpt.contentVocabulary];tye.default=_Br});var opt=I(W4=>{"use strict";Object.defineProperty(W4,"__esModule",{value:!0});W4.DiscrError=void 0;var ipt;(function(e){e.Tag="tag",e.Mapping="mapping"})(ipt||(W4.DiscrError=ipt={}))});var apt=I(nye=>{"use strict";Object.defineProperty(nye,"__esModule",{value:!0});var Lv=Kt(),rye=opt(),spt=B4(),wBr=xO(),vBr=Rr(),SBr={message:({params:{discrError:e,tagName:t}})=>e===rye.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Lv._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},DBr={keyword:"discriminator",type:"object",schemaType:"object",error:SBr,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let 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(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Lv._)`${r}${(0,Lv.getProperty)(a)}`);t.if((0,Lv._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:rye.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){let h=p();t.if(!1);for(let m in h)t.elseIf((0,Lv._)`${u} === ${m}`),t.assign(c,f(h[m]));t.else(),e.error(!1,{discrError:rye.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(h){let m=t.name("valid"),A=e.subschema({keyword:"oneOf",schemaProp:h},m);return e.mergeEvaluated(A,Lv.Name),m}function p(){var h;let m={},A=y(i),g=!0;for(let C=0;C<s.length;C++){let w=s[C];if(w?.$ref&&!(0,vBr.schemaHasRulesButRef)(w,o.self.RULES)){let R=w.$ref;if(w=spt.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,R),w instanceof spt.SchemaEnv&&(w=w.schema),w===void 0)throw new wBr.default(o.opts.uriResolver,o.baseId,R)}let T=(h=w?.properties)===null||h===void 0?void 0:h[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(A||y(w)),b(T,C)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,w){if(C.const)E(C.const,w);else if(C.enum)for(let T of C.enum)E(T,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function E(C,w){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=w}}}};nye.default=DBr});var cpt=I((lpn,RBr)=>{RBr.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var oye=I((Ln,iye)=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.MissingRefError=Ln.ValidationError=Ln.CodeGen=Ln.Name=Ln.nil=Ln.stringify=Ln.str=Ln._=Ln.KeywordCxt=Ln.Ajv=void 0;var TBr=ift(),xBr=npt(),kBr=apt(),lpt=cpt(),BBr=["/properties"],K4="http://json-schema.org/draft-07/schema",Pv=class extends TBr.default{_addVocabularies(){super._addVocabularies(),xBr.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(kBr.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(lpt,BBr):lpt;this.addMetaSchema(t,K4,!1),this.refs["http://json-schema.org/schema"]=K4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(K4)?K4:void 0)}};Ln.Ajv=Pv;iye.exports=Ln=Pv;iye.exports.Ajv=Pv;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=Pv;var NBr=TO();Object.defineProperty(Ln,"KeywordCxt",{enumerable:!0,get:function(){return NBr.KeywordCxt}});var Mv=Kt();Object.defineProperty(Ln,"_",{enumerable:!0,get:function(){return Mv._}});Object.defineProperty(Ln,"str",{enumerable:!0,get:function(){return Mv.str}});Object.defineProperty(Ln,"stringify",{enumerable:!0,get:function(){return Mv.stringify}});Object.defineProperty(Ln,"nil",{enumerable:!0,get:function(){return Mv.nil}});Object.defineProperty(Ln,"Name",{enumerable:!0,get:function(){return Mv.Name}});Object.defineProperty(Ln,"CodeGen",{enumerable:!0,get:function(){return Mv.CodeGen}});var OBr=x4();Object.defineProperty(Ln,"ValidationError",{enumerable:!0,get:function(){return OBr.default}});var FBr=xO();Object.defineProperty(Ln,"MissingRefError",{enumerable:!0,get:function(){return FBr.default}})});var gpt=I(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});wd.formatNames=wd.fastFormats=wd.fullFormats=void 0;function _d(e,t){return{validate:e,compare:t}}wd.fullFormats={date:_d(ppt,lye),time:_d(aye(!0),uye),"date-time":_d(upt(!0),mpt),"iso-time":_d(aye(),hpt),"iso-date-time":_d(upt(),Apt),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:$Br,"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:GBr,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:qBr,int32:{type:"number",validate:HBr},int64:{type:"number",validate:zBr},float:{type:"number",validate:fpt},double:{type:"number",validate:fpt},password:!0,binary:!0};wd.fastFormats={...wd.fullFormats,date:_d(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,lye),time:_d(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uye),"date-time":_d(/^\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,mpt),"iso-time":_d(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,hpt),"iso-date-time":_d(/^\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,Apt),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};wd.formatNames=Object.keys(wd.fullFormats);function QBr(e){return e%4===0&&(e%100!==0||e%400===0)}var LBr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PBr=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ppt(e){let t=LBr.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&QBr(r)?29:PBr[n])}function lye(e,t){if(e&&t)return e>t?1:e<t?-1:0}var sye=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function aye(e){return function(r){let n=sye.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],s=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),d=+(n[7]||0);if(u>23||d>59||e&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let f=o-d*c,p=i-u*c-(f<0?1:0);return(p===23||p===-1)&&(f===59||f===-1)&&s<61}}function uye(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function hpt(e,t){if(!(e&&t))return;let r=sye.exec(e),n=sye.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var cye=/t|\s/i;function upt(e){let t=aye(e);return function(n){let i=n.split(cye);return i.length===2&&ppt(i[0])&&t(i[1])}}function mpt(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Apt(e,t){if(!(e&&t))return;let[r,n]=e.split(cye),[i,o]=t.split(cye),s=lye(r,i);if(s!==void 0)return s||uye(n,o)}var MBr=/\/|:/,UBr=/^(?:[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;function $Br(e){return MBr.test(e)&&UBr.test(e)}var dpt=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function qBr(e){return dpt.lastIndex=0,dpt.test(e)}var jBr=-(2**31),YBr=2**31-1;function HBr(e){return Number.isInteger(e)&&e<=YBr&&e>=jBr}function zBr(e){return Number.isInteger(e)}function fpt(){return!0}var JBr=/[^\\]\\Z/;function GBr(e){if(JBr.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ypt=I(Uv=>{"use strict";Object.defineProperty(Uv,"__esModule",{value:!0});Uv.formatLimitDefinition=void 0;var VBr=oye(),uu=Kt(),fA=uu.operators,Z4={formatMaximum:{okStr:"<=",ok:fA.LTE,fail:fA.GT},formatMinimum:{okStr:">=",ok:fA.GTE,fail:fA.LT},formatExclusiveMaximum:{okStr:"<",ok:fA.LT,fail:fA.GTE},formatExclusiveMinimum:{okStr:">",ok:fA.GT,fail:fA.LTE}},WBr={message:({keyword:e,schemaCode:t})=>(0,uu.str)`should be ${Z4[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,uu._)`{comparison: ${Z4[e].okStr}, limit: ${t}}`};Uv.formatLimitDefinition={keyword:Object.keys(Z4),type:"string",schemaType:"string",$data:!0,error:WBr,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:o}=e,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new VBr.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?u():d();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),h=t.const("fmt",(0,uu._)`${p}[${c.schemaCode}]`);e.fail$data((0,uu.or)((0,uu._)`typeof ${h} != "object"`,(0,uu._)`${h} instanceof RegExp`,(0,uu._)`typeof ${h}.compare != "function"`,f(h)))}function d(){let p=c.schema,h=a.formats[p];if(!h||h===!0)return;if(typeof h!="object"||h instanceof RegExp||typeof h.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:h,code:s.code.formats?(0,uu._)`${s.code.formats}${(0,uu.getProperty)(p)}`:void 0});e.fail$data(f(m))}function f(p){return(0,uu._)`${p}.compare(${r}, ${n}) ${Z4[i].fail} 0`}},dependencies:["format"]};var KBr=e=>(e.addKeyword(Uv.formatLimitDefinition),e);Uv.default=KBr});var Cpt=I((YO,Ipt)=>{"use strict";Object.defineProperty(YO,"__esModule",{value:!0});var $v=gpt(),ZBr=ypt(),dye=Kt(),Ept=new dye.Name("fullFormats"),XBr=new dye.Name("fastFormats"),fye=(e,t={keywords:!0})=>{if(Array.isArray(t))return bpt(e,t,$v.fullFormats,Ept),e;let[r,n]=t.mode==="fast"?[$v.fastFormats,XBr]:[$v.fullFormats,Ept],i=t.formats||$v.formatNames;return bpt(e,i,r,n),t.keywords&&(0,ZBr.default)(e),e};fye.get=(e,t="full")=>{let n=(t==="fast"?$v.fastFormats:$v.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function bpt(e,t,r,n){var i,o;(i=(o=e.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,dye._)`require("ajv-formats/dist/formats").${n}`);for(let s of t)e.addFormat(s,r[s])}Ipt.exports=YO=fye;Object.defineProperty(YO,"__esModule",{value:!0});YO.default=fye});var kpt={};Qo(kpt,{clioErrorsTotal:()=>fNr,clioRequestDuration:()=>uNr,clioRequestsTotal:()=>lNr,clioRetriesTotal:()=>dNr,getMetricsMiddleware:()=>aNr,normalizeClioPath:()=>cNr,recordToolMetrics:()=>sNr});function sNr(){}function aNr(){return(e,t,r)=>r()}function cNr(e){return e}var nW,lNr,uNr,dNr,fNr,Bpt=G(()=>{"use strict";nW={labels:()=>({inc(){},observe(){}})};lNr=nW,uNr=nW,dNr=nW,fNr=nW});function xye(e){return{type:"function",name:e.name,description:e.description,parameters:eu(e.params,e.required),strict:!1}}function dmt(e){let t=[{type:"tool_search"}],r=new Map;for(let n of e){if(n.alwaysLoaded){t.push(xye(n));continue}let i=r.get(n.group)??[];i.push(n),r.set(n.group,i)}for(let n of Ni){let i=n.groups.flatMap(s=>r.get(s)??[]);if(i.length===0)continue;let o=n.channelToolsDescription!==void 0&&i.some(s=>s.channels!==void 0);t.push({type:"namespace",name:n.name,description:o?`${n.description} ${n.channelToolsDescription}`:n.description,tools:i.map(s=>({...xye(s),defer_loading:!0}))})}return t}function fmt(e){return e.map(xye)}var pmt=G(()=>{"use strict";ud();ev()});function hmt(e){return Math.ceil((e??"").length/4)}var mmt=G(()=>{"use strict"});var gmt={};Qo(gmt,{UNIVERSAL_TOOL_DEFINITIONS:()=>kye,emitManifestSizeLog:()=>wOr,measureAllScenarios:()=>_Or,measureManifest:()=>Amt});function EOr(e){let{searchHint:t,...r}=AN(e);return r}function bOr(e){return e.map(EOr)}function IOr(){return Km}function COr(e){return e.map(t=>{let{searchHint:r,...n}=AN(t);return{name:n.name,description:n.description,inputSchema:n.input_schema,annotations:f8(t)}})}function Amt(e,t=kye){let r,n;switch(e){case"anthropic-full":r=bOr(t),n=t.length;break;case"openai-deferred":r=dmt(t),n=t.length;break;case"openai-flat":r=fmt(t),n=t.length;break;case"mcp-meta-only":r=IOr(),n=Km.length;break;case"mcp-static-full":r=COr(t),n=t.length;break;case"mcp-namespace":{let o=IN();r=o,n=o.length;break}}let i=JSON.stringify(r);return{scenario:e,bytes:i.length,tokens:hmt(i),toolCount:n}}function _Or(e=kye){return["anthropic-full","openai-deferred","openai-flat","mcp-meta-only","mcp-static-full","mcp-namespace"].map(r=>Amt(r,e))}function wOr(e,t){for(let r of t)process.stderr.write(JSON.stringify({level:"info",_metric:"clio_tool_manifest_bytes",surface:e,scenario:r.scenario,bytes:r.bytes,tokens:r.tokens,tool_count:r.toolCount,ts:new Date().toISOString()})+`
|
|
836
|
+
deps: ${r}}`};var Rkr={keyword:"dependencies",type:"object",schemaType:"object",error:Cd.error,code(e){let[t,r]=Tkr(e);Bft(e,t),Nft(e,r)}};function Tkr({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function Bft(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,jO.propertyInData)(r,n,s,i.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let u of a)(0,jO.checkReportMissingProp)(e,u)}):(r.if((0,Mge._)`${c} && (${(0,jO.checkMissingProp)(e,a,o)})`),(0,jO.reportMissingProp)(e,o),r.else())}}Cd.validatePropertyDeps=Bft;function Nft(e,t=e.schema){let{gen:r,data:n,keyword:i,it:o}=e,s=r.name("valid");for(let a in t)(0,Dkr.alwaysValidSchema)(o,t[a])||(r.if((0,jO.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}Cd.validateSchemaDeps=Nft;Cd.default=Rkr});var Qft=I(Uge=>{"use strict";Object.defineProperty(Uge,"__esModule",{value:!0});var Fft=Kt(),xkr=Rr(),kkr={message:"property name must be valid",params:({params:e})=>(0,Fft._)`{propertyName: ${e.propertyName}}`},Bkr={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:kkr,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,xkr.alwaysValidSchema)(i,r))return;let o=t.name("valid");t.forIn("key",n,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,Fft.not)(o),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(o)}};Uge.default=Bkr});var qge=I($ge=>{"use strict";Object.defineProperty($ge,"__esModule",{value:!0});var H4=el(),lu=Kt(),Nkr=ap(),z4=Rr(),Okr={message:"must NOT have additional properties",params:({params:e})=>(0,lu._)`{additionalProperty: ${e.additionalProperty}}`},Fkr={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Okr,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,z4.alwaysValidSchema)(s,r))return;let u=(0,H4.allSchemaProperties)(n.properties),d=(0,H4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,lu._)`${o} === ${Nkr.default.errors}`);function f(){t.forIn("key",i,g=>{!u.length&&!d.length?m(g):t.if(p(g),()=>m(g))})}function p(g){let y;if(u.length>8){let b=(0,z4.schemaRefOrVal)(s,n.properties,"properties");y=(0,H4.isOwnProperty)(t,b,g)}else u.length?y=(0,lu.or)(...u.map(b=>(0,lu._)`${g} === ${b}`)):y=lu.nil;return d.length&&(y=(0,lu.or)(y,...d.map(b=>(0,lu._)`${(0,H4.usePattern)(e,b)}.test(${g})`))),(0,lu.not)(y)}function h(g){t.code((0,lu._)`delete ${i}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){h(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,z4.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(A(g,y,!1),t.if((0,lu.not)(y),()=>{e.reset(),h(g)})):(A(g,y),a||t.if((0,lu.not)(y),()=>t.break()))}}function A(g,y,b){let E={keyword:"additionalProperties",dataProp:g,dataPropType:z4.Type.Str};b===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(E,y)}}};$ge.default=Fkr});var Mft=I(Yge=>{"use strict";Object.defineProperty(Yge,"__esModule",{value:!0});var Qkr=TO(),Lft=el(),jge=Rr(),Pft=qge(),Lkr={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Pft.default.code(new Qkr.KeywordCxt(o,Pft.default,"additionalProperties"));let s=(0,Lft.allSchemaProperties)(r);for(let f of s)o.definedProperties.add(f);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=jge.mergeEvaluated.props(t,(0,jge.toHash)(s),o.props));let a=s.filter(f=>!(0,jge.alwaysValidSchema)(o,r[f]));if(a.length===0)return;let c=t.name("valid");for(let f of a)u(f)?d(f):(t.if((0,Lft.propertyInData)(t,i,f,o.opts.ownProperties)),d(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function u(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};Yge.default=Lkr});var jft=I(Hge=>{"use strict";Object.defineProperty(Hge,"__esModule",{value:!0});var Uft=el(),J4=Kt(),$ft=Rr(),qft=Rr(),Pkr={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:s}=o,a=(0,Uft.allSchemaProperties)(r),c=a.filter(A=>(0,$ft.alwaysValidSchema)(o,r[A]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&i.properties,d=t.name("valid");o.props!==!0&&!(o.props instanceof J4.Name)&&(o.props=(0,qft.evaluatedPropsToName)(t,o.props));let{props:f}=o;p();function p(){for(let A of a)u&&h(A),o.allErrors?m(A):(t.var(d,!0),m(A),t.if(d))}function h(A){for(let g in u)new RegExp(A).test(g)&&(0,$ft.checkStrictMode)(o,`property ${g} matches pattern ${A} (use allowMatchingProperties)`)}function m(A){t.forIn("key",n,g=>{t.if((0,J4._)`${(0,Uft.usePattern)(e,A)}.test(${g})`,()=>{let y=c.includes(A);y||e.subschema({keyword:"patternProperties",schemaProp:A,dataProp:g,dataPropType:qft.Type.Str},d),o.opts.unevaluated&&f!==!0?t.assign((0,J4._)`${f}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,J4.not)(d),()=>t.break())})})}}};Hge.default=Pkr});var Yft=I(zge=>{"use strict";Object.defineProperty(zge,"__esModule",{value:!0});var Mkr=Rr(),Ukr={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Mkr.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};zge.default=Ukr});var Hft=I(Jge=>{"use strict";Object.defineProperty(Jge,"__esModule",{value:!0});var $kr=el(),qkr={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:$kr.validateUnion,error:{message:"must match a schema in anyOf"}};Jge.default=qkr});var zft=I(Gge=>{"use strict";Object.defineProperty(Gge,"__esModule",{value:!0});var G4=Kt(),jkr=Rr(),Ykr={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,G4._)`{passingSchemas: ${e.passing}}`},Hkr={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Ykr,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,f)=>{let p;(0,jkr.alwaysValidSchema)(i,d)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,G4._)`${c} && ${s}`).assign(s,!1).assign(a,(0,G4._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,f),p&&e.mergeEvaluated(p,G4.Name)})})}}};Gge.default=Hkr});var Jft=I(Vge=>{"use strict";Object.defineProperty(Vge,"__esModule",{value:!0});var zkr=Rr(),Jkr={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((o,s)=>{if((0,zkr.alwaysValidSchema)(n,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},i);e.ok(i),e.mergeEvaluated(a)})}};Vge.default=Jkr});var Wft=I(Wge=>{"use strict";Object.defineProperty(Wge,"__esModule",{value:!0});var V4=Kt(),Vft=Rr(),Gkr={message:({params:e})=>(0,V4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,V4._)`{failingKeyword: ${e.ifClause}}`},Vkr={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Gkr,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Vft.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Gft(n,"then"),o=Gft(n,"else");if(!i&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),i&&o){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else i?t.if(a,u("then")):t.if((0,V4.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{let p=e.subschema({keyword:d},a);t.assign(s,a),e.mergeValidEvaluated(p,s),f?t.assign(f,(0,V4._)`${d}`):e.setParams({ifClause:d})}}}};function Gft(e,t){let r=e.schema[t];return r!==void 0&&!(0,Vft.alwaysValidSchema)(e,r)}Wge.default=Vkr});var Kft=I(Kge=>{"use strict";Object.defineProperty(Kge,"__esModule",{value:!0});var Wkr=Rr(),Kkr={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Wkr.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Kge.default=Kkr});var Zft=I(Zge=>{"use strict";Object.defineProperty(Zge,"__esModule",{value:!0});var Zkr=Oge(),Xkr=Rft(),eBr=Fge(),tBr=xft(),rBr=kft(),nBr=Oft(),iBr=Qft(),oBr=qge(),sBr=Mft(),aBr=jft(),cBr=Yft(),lBr=Hft(),uBr=zft(),dBr=Jft(),fBr=Wft(),pBr=Kft();function hBr(e=!1){let t=[cBr.default,lBr.default,uBr.default,dBr.default,fBr.default,pBr.default,iBr.default,oBr.default,nBr.default,sBr.default,aBr.default];return e?t.push(Xkr.default,tBr.default):t.push(Zkr.default,eBr.default),t.push(rBr.default),t}Zge.default=hBr});var Xft=I(Xge=>{"use strict";Object.defineProperty(Xge,"__esModule",{value:!0});var qi=Kt(),mBr={message:({schemaCode:e})=>(0,qi.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,qi._)`{format: ${e}}`},ABr={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mBr,code(e,t){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!c.validateFormats)return;i?p():h();function p(){let m=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),A=r.const("fDef",(0,qi._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,qi._)`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>r.assign(g,(0,qi._)`${A}.type || "string"`).assign(y,(0,qi._)`${A}.validate`),()=>r.assign(g,(0,qi._)`"string"`).assign(y,A)),e.fail$data((0,qi.or)(b(),E()));function b(){return c.strictSchema===!1?qi.nil:(0,qi._)`${s} && !${y}`}function E(){let C=d.$async?(0,qi._)`(${A}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,qi._)`${y}(${n})`,w=(0,qi._)`(typeof ${y} == "function" ? ${C} : ${y}.test(${n}))`;return(0,qi._)`${y} && ${y} !== true && ${g} === ${t} && !${w}`}}function h(){let m=f.formats[o];if(!m){b();return}if(m===!0)return;let[A,g,y]=E(m);A===t&&e.pass(C());function b(){if(c.strictSchema===!1){f.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function E(w){let T=w instanceof RegExp?(0,qi.regexpCode)(w):c.code.formats?(0,qi._)`${c.code.formats}${(0,qi.getProperty)(o)}`:void 0,R=r.scopeValue("formats",{key:o,ref:w,code:T});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,qi._)`${R}.validate`]:["string",w,R]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!d.$async)throw new Error("async format in sync schema");return(0,qi._)`await ${y}(${n})`}return typeof g=="function"?(0,qi._)`${y}(${n})`:(0,qi._)`${y}.test(${n})`}}}};Xge.default=ABr});var ept=I(eye=>{"use strict";Object.defineProperty(eye,"__esModule",{value:!0});var gBr=Xft(),yBr=[gBr.default];eye.default=yBr});var tpt=I(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});Qv.contentVocabulary=Qv.metadataVocabulary=void 0;Qv.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Qv.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var npt=I(tye=>{"use strict";Object.defineProperty(tye,"__esModule",{value:!0});var EBr=uft(),bBr=wft(),IBr=Zft(),CBr=ept(),rpt=tpt(),_Br=[EBr.default,bBr.default,(0,IBr.default)(),CBr.default,rpt.metadataVocabulary,rpt.contentVocabulary];tye.default=_Br});var opt=I(W4=>{"use strict";Object.defineProperty(W4,"__esModule",{value:!0});W4.DiscrError=void 0;var ipt;(function(e){e.Tag="tag",e.Mapping="mapping"})(ipt||(W4.DiscrError=ipt={}))});var apt=I(nye=>{"use strict";Object.defineProperty(nye,"__esModule",{value:!0});var Lv=Kt(),rye=opt(),spt=B4(),wBr=xO(),vBr=Rr(),SBr={message:({params:{discrError:e,tagName:t}})=>e===rye.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Lv._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},DBr={keyword:"discriminator",type:"object",schemaType:"object",error:SBr,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let 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(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Lv._)`${r}${(0,Lv.getProperty)(a)}`);t.if((0,Lv._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:rye.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){let h=p();t.if(!1);for(let m in h)t.elseIf((0,Lv._)`${u} === ${m}`),t.assign(c,f(h[m]));t.else(),e.error(!1,{discrError:rye.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(h){let m=t.name("valid"),A=e.subschema({keyword:"oneOf",schemaProp:h},m);return e.mergeEvaluated(A,Lv.Name),m}function p(){var h;let m={},A=y(i),g=!0;for(let C=0;C<s.length;C++){let w=s[C];if(w?.$ref&&!(0,vBr.schemaHasRulesButRef)(w,o.self.RULES)){let R=w.$ref;if(w=spt.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,R),w instanceof spt.SchemaEnv&&(w=w.schema),w===void 0)throw new wBr.default(o.opts.uriResolver,o.baseId,R)}let T=(h=w?.properties)===null||h===void 0?void 0:h[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(A||y(w)),b(T,C)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,w){if(C.const)E(C.const,w);else if(C.enum)for(let T of C.enum)E(T,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function E(C,w){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=w}}}};nye.default=DBr});var cpt=I((lpn,RBr)=>{RBr.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var oye=I((Ln,iye)=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.MissingRefError=Ln.ValidationError=Ln.CodeGen=Ln.Name=Ln.nil=Ln.stringify=Ln.str=Ln._=Ln.KeywordCxt=Ln.Ajv=void 0;var TBr=ift(),xBr=npt(),kBr=apt(),lpt=cpt(),BBr=["/properties"],K4="http://json-schema.org/draft-07/schema",Pv=class extends TBr.default{_addVocabularies(){super._addVocabularies(),xBr.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(kBr.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(lpt,BBr):lpt;this.addMetaSchema(t,K4,!1),this.refs["http://json-schema.org/schema"]=K4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(K4)?K4:void 0)}};Ln.Ajv=Pv;iye.exports=Ln=Pv;iye.exports.Ajv=Pv;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=Pv;var NBr=TO();Object.defineProperty(Ln,"KeywordCxt",{enumerable:!0,get:function(){return NBr.KeywordCxt}});var Mv=Kt();Object.defineProperty(Ln,"_",{enumerable:!0,get:function(){return Mv._}});Object.defineProperty(Ln,"str",{enumerable:!0,get:function(){return Mv.str}});Object.defineProperty(Ln,"stringify",{enumerable:!0,get:function(){return Mv.stringify}});Object.defineProperty(Ln,"nil",{enumerable:!0,get:function(){return Mv.nil}});Object.defineProperty(Ln,"Name",{enumerable:!0,get:function(){return Mv.Name}});Object.defineProperty(Ln,"CodeGen",{enumerable:!0,get:function(){return Mv.CodeGen}});var OBr=x4();Object.defineProperty(Ln,"ValidationError",{enumerable:!0,get:function(){return OBr.default}});var FBr=xO();Object.defineProperty(Ln,"MissingRefError",{enumerable:!0,get:function(){return FBr.default}})});var gpt=I(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});wd.formatNames=wd.fastFormats=wd.fullFormats=void 0;function _d(e,t){return{validate:e,compare:t}}wd.fullFormats={date:_d(ppt,lye),time:_d(aye(!0),uye),"date-time":_d(upt(!0),mpt),"iso-time":_d(aye(),hpt),"iso-date-time":_d(upt(),Apt),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:$Br,"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:GBr,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:qBr,int32:{type:"number",validate:HBr},int64:{type:"number",validate:zBr},float:{type:"number",validate:fpt},double:{type:"number",validate:fpt},password:!0,binary:!0};wd.fastFormats={...wd.fullFormats,date:_d(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,lye),time:_d(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uye),"date-time":_d(/^\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,mpt),"iso-time":_d(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,hpt),"iso-date-time":_d(/^\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,Apt),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};wd.formatNames=Object.keys(wd.fullFormats);function QBr(e){return e%4===0&&(e%100!==0||e%400===0)}var LBr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PBr=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ppt(e){let t=LBr.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&QBr(r)?29:PBr[n])}function lye(e,t){if(e&&t)return e>t?1:e<t?-1:0}var sye=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function aye(e){return function(r){let n=sye.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],s=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),d=+(n[7]||0);if(u>23||d>59||e&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let f=o-d*c,p=i-u*c-(f<0?1:0);return(p===23||p===-1)&&(f===59||f===-1)&&s<61}}function uye(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function hpt(e,t){if(!(e&&t))return;let r=sye.exec(e),n=sye.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var cye=/t|\s/i;function upt(e){let t=aye(e);return function(n){let i=n.split(cye);return i.length===2&&ppt(i[0])&&t(i[1])}}function mpt(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Apt(e,t){if(!(e&&t))return;let[r,n]=e.split(cye),[i,o]=t.split(cye),s=lye(r,i);if(s!==void 0)return s||uye(n,o)}var MBr=/\/|:/,UBr=/^(?:[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;function $Br(e){return MBr.test(e)&&UBr.test(e)}var dpt=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function qBr(e){return dpt.lastIndex=0,dpt.test(e)}var jBr=-(2**31),YBr=2**31-1;function HBr(e){return Number.isInteger(e)&&e<=YBr&&e>=jBr}function zBr(e){return Number.isInteger(e)}function fpt(){return!0}var JBr=/[^\\]\\Z/;function GBr(e){if(JBr.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ypt=I(Uv=>{"use strict";Object.defineProperty(Uv,"__esModule",{value:!0});Uv.formatLimitDefinition=void 0;var VBr=oye(),uu=Kt(),fA=uu.operators,Z4={formatMaximum:{okStr:"<=",ok:fA.LTE,fail:fA.GT},formatMinimum:{okStr:">=",ok:fA.GTE,fail:fA.LT},formatExclusiveMaximum:{okStr:"<",ok:fA.LT,fail:fA.GTE},formatExclusiveMinimum:{okStr:">",ok:fA.GT,fail:fA.LTE}},WBr={message:({keyword:e,schemaCode:t})=>(0,uu.str)`should be ${Z4[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,uu._)`{comparison: ${Z4[e].okStr}, limit: ${t}}`};Uv.formatLimitDefinition={keyword:Object.keys(Z4),type:"string",schemaType:"string",$data:!0,error:WBr,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:o}=e,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new VBr.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?u():d();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),h=t.const("fmt",(0,uu._)`${p}[${c.schemaCode}]`);e.fail$data((0,uu.or)((0,uu._)`typeof ${h} != "object"`,(0,uu._)`${h} instanceof RegExp`,(0,uu._)`typeof ${h}.compare != "function"`,f(h)))}function d(){let p=c.schema,h=a.formats[p];if(!h||h===!0)return;if(typeof h!="object"||h instanceof RegExp||typeof h.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:h,code:s.code.formats?(0,uu._)`${s.code.formats}${(0,uu.getProperty)(p)}`:void 0});e.fail$data(f(m))}function f(p){return(0,uu._)`${p}.compare(${r}, ${n}) ${Z4[i].fail} 0`}},dependencies:["format"]};var KBr=e=>(e.addKeyword(Uv.formatLimitDefinition),e);Uv.default=KBr});var Cpt=I((YO,Ipt)=>{"use strict";Object.defineProperty(YO,"__esModule",{value:!0});var $v=gpt(),ZBr=ypt(),dye=Kt(),Ept=new dye.Name("fullFormats"),XBr=new dye.Name("fastFormats"),fye=(e,t={keywords:!0})=>{if(Array.isArray(t))return bpt(e,t,$v.fullFormats,Ept),e;let[r,n]=t.mode==="fast"?[$v.fastFormats,XBr]:[$v.fullFormats,Ept],i=t.formats||$v.formatNames;return bpt(e,i,r,n),t.keywords&&(0,ZBr.default)(e),e};fye.get=(e,t="full")=>{let n=(t==="fast"?$v.fastFormats:$v.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function bpt(e,t,r,n){var i,o;(i=(o=e.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,dye._)`require("ajv-formats/dist/formats").${n}`);for(let s of t)e.addFormat(s,r[s])}Ipt.exports=YO=fye;Object.defineProperty(YO,"__esModule",{value:!0});YO.default=fye});var kpt={};Qo(kpt,{clioErrorsTotal:()=>fNr,clioRequestDuration:()=>uNr,clioRequestsTotal:()=>lNr,clioRetriesTotal:()=>dNr,getMetricsMiddleware:()=>aNr,normalizeClioPath:()=>cNr,recordToolMetrics:()=>sNr});function sNr(){}function aNr(){return(e,t,r)=>r()}function cNr(e){return e}var nW,lNr,uNr,dNr,fNr,Bpt=G(()=>{"use strict";nW={labels:()=>({inc(){},observe(){}})};lNr=nW,uNr=nW,dNr=nW,fNr=nW});function xye(e){return{type:"function",name:e.name,description:e.description,parameters:eu(e.params,e.required),strict:!1}}function dmt(e){let t=[],r=[],n=new Map;for(let i of e){if(i.alwaysLoaded){t.push(xye(i));continue}let o=n.get(i.group)??[];o.push(i),n.set(i.group,o)}for(let i of Ni){let o=i.groups.flatMap(a=>n.get(a)??[]);if(o.length===0)continue;let s=i.channelToolsDescription!==void 0&&o.some(a=>a.channels!==void 0);r.push({type:"namespace",name:i.name,description:s?`${i.description} ${i.channelToolsDescription}`:i.description,tools:o.map(a=>({...xye(a),defer_loading:!0}))})}return r.length>0?[{type:"tool_search"},...t,...r]:t}function fmt(e){return e.map(xye)}var pmt=G(()=>{"use strict";ud();ev()});function hmt(e){return Math.ceil((e??"").length/4)}var mmt=G(()=>{"use strict"});var gmt={};Qo(gmt,{UNIVERSAL_TOOL_DEFINITIONS:()=>kye,emitManifestSizeLog:()=>wOr,measureAllScenarios:()=>_Or,measureManifest:()=>Amt});function EOr(e){let{searchHint:t,...r}=AN(e);return r}function bOr(e){return e.map(EOr)}function IOr(){return Km}function COr(e){return e.map(t=>{let{searchHint:r,...n}=AN(t);return{name:n.name,description:n.description,inputSchema:n.input_schema,annotations:f8(t)}})}function Amt(e,t=kye){let r,n;switch(e){case"anthropic-full":r=bOr(t),n=t.length;break;case"openai-deferred":r=dmt(t),n=t.length;break;case"openai-flat":r=fmt(t),n=t.length;break;case"mcp-meta-only":r=IOr(),n=Km.length;break;case"mcp-static-full":r=COr(t),n=t.length;break;case"mcp-namespace":{let o=IN();r=o,n=o.length;break}}let i=JSON.stringify(r);return{scenario:e,bytes:i.length,tokens:hmt(i),toolCount:n}}function _Or(e=kye){return["anthropic-full","openai-deferred","openai-flat","mcp-meta-only","mcp-static-full","mcp-namespace"].map(r=>Amt(r,e))}function wOr(e,t){for(let r of t)process.stderr.write(JSON.stringify({level:"info",_metric:"clio_tool_manifest_bytes",surface:e,scenario:r.scenario,bytes:r.bytes,tokens:r.tokens,tool_count:r.toolCount,ts:new Date().toISOString()})+`
|
|
837
837
|
`)}var kye,ymt=G(()=>{"use strict";B8();_E();nv();ev();pmt();mmt();kye=ru.filter(e=>e.channels===void 0)});EA();import{readFileSync as xAt}from"fs";import{fileURLToPath as fFr}from"url";import{dirname as pFr,join as DAt}from"path";Ai();SF();a3();var s0=no(c3(),1);import LF from"node:process";SF();import sl from"node:process";function l3(){return sl.platform!=="win32"?sl.env.TERM!=="linux":!!sl.env.CI||!!sl.env.WT_SESSION||!!sl.env.TERMINUS_SUBLIME||sl.env.ConEmuTask==="{cmd::Cmder}"||sl.env.TERM_PROGRAM==="Terminus-Sublime"||sl.env.TERM_PROGRAM==="vscode"||sl.env.TERM==="xterm-256color"||sl.env.TERM==="alacritty"||sl.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var yyt={info:Fi.blue("\u2139"),success:Fi.green("\u2714"),warning:Fi.yellow("\u26A0"),error:Fi.red("\u2716")},Eyt={info:Fi.blue("i"),success:Fi.green("\u221A"),warning:Fi.yellow("\u203C"),error:Fi.red("\xD7")},byt=l3()?yyt:Eyt,e0=byt;tb();tb();QF();var Dbe=no(Sbe(),1),Byt=new Intl.Segmenter,Nyt=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function h3(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=al(e)),e.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:s}of Byt.segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!Nyt.test(s)){if((0,Dbe.default)().test(s)){i+=2;continue}i+=i0(a,o)}}return i}function m3({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}A3();import du from"node:process";var Oyt=3,g3=class{#e=0;start(){this.#e++,this.#e===1&&this.#t()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#r()}#t(){du.platform==="win32"||!du.stdin.isTTY||(du.stdin.setRawMode(!0),du.stdin.on("data",this.#i),du.stdin.resume())}#r(){du.stdin.isTTY&&(du.stdin.off("data",this.#i),du.stdin.pause(),du.stdin.setRawMode(!1))}#i(t){t[0]===Oyt&&du.emit("SIGINT")}},Fyt=new g3,y3=Fyt;var Qyt=no(c3(),1),E3=class{#e=0;#t=!1;#r=0;#i=-1;#o=0;#n;#a;#s;#c;#l;#f;#p;#h;#A;#u;#d;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#n={color:"cyan",stream:LF.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#n.color,this.spinner=this.#n.spinner,this.#l=this.#n.interval,this.#s=this.#n.stream,this.#f=typeof this.#n.isEnabled=="boolean"?this.#n.isEnabled:m3({stream:this.#s}),this.#p=typeof this.#n.isSilent=="boolean"?this.#n.isSilent:!1,this.text=this.#n.text,this.prefixText=this.#n.prefixText,this.suffixText=this.#n.suffixText,this.indent=this.#n.indent,LF.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#f,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(r){this.#e=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#i}}),Object.defineProperty(this,"_lineCount",{get(){return this.#r}}))}get indent(){return this.#h}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#h=t,this.#m()}get interval(){return this.#l??this.#a.interval??100}get spinner(){return this.#a}set spinner(t){if(this.#i=-1,this.#l=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#a=t}else if(!o0())this.#a=s0.default.line;else if(t===void 0)this.#a=s0.default.dots;else if(t!=="default"&&s0.default[t])this.#a=s0.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#A}set text(t=""){this.#A=t,this.#m()}get prefixText(){return this.#u}set prefixText(t=""){this.#u=t,this.#m()}get suffixText(){return this.#d}set suffixText(t=""){this.#d=t,this.#m()}get isSpinning(){return this.#c!==void 0}#g(t=this.#u,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#y(t=this.#d,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#s.columns??80,r=this.#g(this.#u,"-"),n=this.#y(this.#d,"-"),i=" ".repeat(this.#h)+r+"--"+this.#A+"--"+n;this.#r=0;for(let o of al(i).split(`
|
|
838
838
|
`))this.#r+=Math.max(1,Math.ceil(h3(o,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#f&&!this.#p}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#f=t}get isSilent(){return this.#p}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#p=t}frame(){let t=Date.now();(this.#i===-1||t-this.#o>=this.interval)&&(this.#i=++this.#i%this.#a.frames.length,this.#o=t);let{frames:r}=this.#a,n=r[this.#i];this.color&&(n=Fi[this.color](n));let i=typeof this.#u=="string"&&this.#u!==""?this.#u+" ":"",o=typeof this.text=="string"?" "+this.text:"",s=typeof this.#d=="string"&&this.#d!==""?" "+this.#d:"";return i+n+o+s}clear(){if(!this.#f||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let t=0;t<this.#e;t++)t>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#h||this.lastIndent!==this.#h)&&this.#s.cursorTo(this.#h),this.lastIndent=this.#h,this.#e=0,this}render(){return this.#p?this:(this.clear(),this.#s.write(this.frame()),this.#e=this.#r,this)}start(t){return t&&(this.text=t),this.#p?this:this.#f?this.isSpinning?this:(this.#n.hideCursor&&eb.hide(this.#s),this.#n.discardStdin&&LF.stdin.isTTY&&(this.#t=!0,y3.start()),this.render(),this.#c=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#s.write(`- ${this.text}
|
|
839
839
|
`),this)}stop(){return this.#f?(clearInterval(this.#c),this.#c=void 0,this.#i=0,this.clear(),this.#n.hideCursor&&eb.show(this.#s),this.#n.discardStdin&&LF.stdin.isTTY&&this.#t&&(y3.stop(),this.#t=!1),this):this}succeed(t){return this.stopAndPersist({symbol:e0.success,text:t})}fail(t){return this.stopAndPersist({symbol:e0.error,text:t})}warn(t){return this.stopAndPersist({symbol:e0.warning,text:t})}info(t){return this.stopAndPersist({symbol:e0.info,text:t})}stopAndPersist(t={}){if(this.#p)return this;let r=t.prefixText??this.#u,n=this.#g(r," "),i=t.symbol??" ",o=t.text??this.text,a=typeof o=="string"?(i?" ":"")+o:"",c=t.suffixText??this.#d,u=this.#y(c," "),d=n+i+a+u+`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaz-clio",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.5",
|
|
4
4
|
"description": "Fastest ledger for agents. Jaz accounting CLI and MCP server: invoicing, bills, payments, quotes & orders, bank reconciliation, fixed assets, inventory, expense claims, tax, reports, and period close.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|