@iflow-ai/iflow-cli 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/iflow.js CHANGED
@@ -471,7 +471,7 @@ ${e.format(n)}`.trim())}};Mrt.exports=xDe});var FX=b((tJr,krt)=>{"use strict";va
471
471
  LIMIT ?
472
472
  )
473
473
  `)}close(){this.#n.close()}get(e){HDe(e);let n=this.#A(e);return n?{body:n.body?Buffer.from(n.body.buffer,n.body.byteOffset,n.body.byteLength):void 0,statusCode:n.statusCode,statusMessage:n.statusMessage,headers:n.headers?JSON.parse(n.headers):void 0,etag:n.etag?n.etag:void 0,vary:n.vary?JSON.parse(n.vary):void 0,cacheControlDirectives:n.cacheControlDirectives?JSON.parse(n.cacheControlDirectives):void 0,cachedAt:n.cachedAt,staleAt:n.staleAt,deleteAt:n.deleteAt}:void 0}set(e,n){HDe(e);let r=this.#p(e),i=Array.isArray(n.body)?Buffer.concat(n.body):n.body,o=i?.byteLength;if(o&&o>this.#e)return;let s=this.#A(e,!0);s?this.#o.run(i,n.deleteAt,n.statusCode,n.statusMessage,n.headers?JSON.stringify(n.headers):null,n.etag?n.etag:null,n.cacheControlDirectives?JSON.stringify(n.cacheControlDirectives):null,n.cachedAt,n.staleAt,s.id):(this.#s(),this.#i.run(r,e.method,i,n.deleteAt,n.statusCode,n.statusMessage,n.headers?JSON.stringify(n.headers):null,n.etag?n.etag:null,n.cacheControlDirectives?JSON.stringify(n.cacheControlDirectives):null,n.vary?JSON.stringify(n.vary):null,n.cachedAt,n.staleAt))}createWriteStream(e,n){HDe(e),o6n(n);let r=0,i=[],o=this;return new i6n({decodeStrings:!0,write(s,a,l){r+=s.byteLength,r<o.#e?i.push(s):this.destroy(),l()},final(s){o.set(e,{...n,body:i}),s()}})}delete(e){if(typeof e!="object")throw new TypeError(`expected key to be object, got ${typeof e}`);this.#l.run(this.#p(e))}#s(){if(Number.isFinite(this.#t)&&this.size<=this.#t)return 0;{let e=this.#u.run(Date.now()).changes;if(e)return e}{let e=this.#c?.run(Math.max(Math.floor(this.#t*.1),1)).changes;if(e)return e}return 0}get size(){let{total:e}=this.#a.get();return e}#p(e){return`${e.origin}/${e.path}`}#A(e,n=!1){let r=this.#p(e),{headers:i,method:o}=e,s=this.#r.all(r,o);if(s.length===0)return;let a=Date.now();for(let l of s){if(a>=l.deleteAt&&!n)return;let u=!0;if(l.vary){let c=JSON.parse(l.vary);for(let d in c)if(!s6n(i[d],c[d])){u=!1;break}}if(u)return l}}};function s6n(t,e){return t==null&&e==null?!0:t==null&&e!=null||t!=null&&e==null?!1:Array.isArray(t)&&Array.isArray(e)?t.length!==e.length?!1:t.every((n,r)=>n===e[r]):t===e}});var dN=b((EJr,wit)=>{"use strict";var{kConstruct:a6n}=rl(),{kEnumerableProperty:T8}=oo(),{iteratorMixin:l6n,isValidHeaderName:qU,isValidHeaderValue:_it}=jm(),{webidl:Ds}=Gp(),VDe=we("node:assert"),QX=we("node:util");function Sit(t){return t===10||t===13||t===9||t===32}function Iit(t){let e=0,n=t.length;for(;n>e&&Sit(t.charCodeAt(n-1));)--n;for(;n>e&&Sit(t.charCodeAt(e));)++e;return e===0&&n===t.length?t:t.substring(e,n)}function Tit(t,e){if(Array.isArray(e))for(let n=0;n<e.length;++n){let r=e[n];if(r.length!==2)throw Ds.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});$De(t,r[0],r[1])}else if(typeof e=="object"&&e!==null){let n=Object.keys(e);for(let r=0;r<n.length;++r)$De(t,n[r],e[n[r]])}else throw Ds.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function $De(t,e,n){if(n=Iit(n),qU(e)){if(!_it(n))throw Ds.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw Ds.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(xit(t)==="immutable")throw new TypeError("immutable");return UX(t).append(e,n,!1)}function u6n(t){let e=UX(t);if(!e)return[];if(e.sortedMap)return e.sortedMap;let n=[],r=e.toSortedArray(),i=e.cookies;if(i===null||i.length===1)return e.sortedMap=r;for(let o=0;o<r.length;++o){let{0:s,1:a}=r[o];if(s==="set-cookie")for(let l=0;l<i.length;++l)n.push([s,i[l]]);else n.push([s,a])}return e.sortedMap=n}function bit(t,e){return t[0]<e[0]?-1:1}var kX=class t{cookies=null;sortedMap;headersMap;constructor(e){e instanceof t?(this.headersMap=new Map(e.headersMap),this.sortedMap=e.sortedMap,this.cookies=e.cookies===null?null:[...e.cookies]):(this.headersMap=new Map(e),this.sortedMap=null)}contains(e,n){return this.headersMap.has(n?e:e.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(e,n,r){this.sortedMap=null;let i=r?e:e.toLowerCase(),o=this.headersMap.get(i);if(o){let s=i==="cookie"?"; ":", ";this.headersMap.set(i,{name:o.name,value:`${o.value}${s}${n}`})}else this.headersMap.set(i,{name:e,value:n});i==="set-cookie"&&(this.cookies??=[]).push(n)}set(e,n,r){this.sortedMap=null;let i=r?e:e.toLowerCase();i==="set-cookie"&&(this.cookies=[n]),this.headersMap.set(i,{name:e,value:n})}delete(e,n){this.sortedMap=null,n||(e=e.toLowerCase()),e==="set-cookie"&&(this.cookies=null),this.headersMap.delete(e)}get(e,n){return this.headersMap.get(n?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:n}}of this.headersMap)yield[e,n]}get entries(){let e={};if(this.headersMap.size!==0)for(let{name:n,value:r}of this.headersMap.values())e[n]=r;return e}rawValues(){return this.headersMap.values()}get entriesList(){let e=[];if(this.headersMap.size!==0)for(let{0:n,1:{name:r,value:i}}of this.headersMap)if(n==="set-cookie")for(let o of this.cookies)e.push([r,o]);else e.push([r,i]);return e}toSortedArray(){let e=this.headersMap.size,n=new Array(e);if(e<=32){if(e===0)return n;let r=this.headersMap[Symbol.iterator](),i=r.next().value;n[0]=[i[0],i[1].value],VDe(i[1].value!==null);for(let o=1,s=0,a=0,l=0,u=0,c,d;o<e;++o){for(d=r.next().value,c=n[o]=[d[0],d[1].value],VDe(c[1]!==null),l=0,a=o;l<a;)u=l+(a-l>>1),n[u][0]<=c[0]?l=u+1:a=u;if(o!==u){for(s=o;s>l;)n[s]=n[--s];n[l]=c}}if(!r.next().done)throw new TypeError("Unreachable");return n}else{let r=0;for(let{0:i,1:{value:o}}of this.headersMap)n[r++]=[i,o],VDe(o!==null);return n.sort(bit)}}},RC=class t{#e;#t;constructor(e=void 0){Ds.util.markAsUncloneable(this),e!==a6n&&(this.#t=new kX,this.#e="none",e!==void 0&&(e=Ds.converters.HeadersInit(e,"Headers constructor","init"),Tit(this,e)))}append(e,n){Ds.brandCheck(this,t),Ds.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return e=Ds.converters.ByteString(e,r,"name"),n=Ds.converters.ByteString(n,r,"value"),$De(this,e,n)}delete(e){if(Ds.brandCheck(this,t),Ds.argumentLengthCheck(arguments,1,"Headers.delete"),e=Ds.converters.ByteString(e,"Headers.delete","name"),!qU(e))throw Ds.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(e,!1)&&this.#t.delete(e,!1)}get(e){Ds.brandCheck(this,t),Ds.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(e=Ds.converters.ByteString(e,n,"name"),!qU(e))throw Ds.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.get(e,!1)}has(e){Ds.brandCheck(this,t),Ds.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(e=Ds.converters.ByteString(e,n,"name"),!qU(e))throw Ds.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.contains(e,!1)}set(e,n){Ds.brandCheck(this,t),Ds.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(e=Ds.converters.ByteString(e,r,"name"),n=Ds.converters.ByteString(n,r,"value"),n=Iit(n),qU(e)){if(!_it(n))throw Ds.errors.invalidArgument({prefix:r,value:n,type:"header value"})}else throw Ds.errors.invalidArgument({prefix:r,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(e,n,!1)}getSetCookie(){Ds.brandCheck(this,t);let e=this.#t.cookies;return e?[...e]:[]}[QX.inspect.custom](e,n){return n.depth??=e,`Headers ${QX.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,n){e.#e=n}static getHeadersList(e){return e.#t}static setHeadersList(e,n){e.#t=n}},{getHeadersGuard:xit,setHeadersGuard:c6n,getHeadersList:UX,setHeadersList:d6n}=RC;Reflect.deleteProperty(RC,"getHeadersGuard");Reflect.deleteProperty(RC,"setHeadersGuard");Reflect.deleteProperty(RC,"getHeadersList");Reflect.deleteProperty(RC,"setHeadersList");l6n("Headers",RC,u6n,0,1);Object.defineProperties(RC.prototype,{append:T8,delete:T8,get:T8,has:T8,set:T8,getSetCookie:T8,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[QX.inspect.custom]:{enumerable:!1}});Ds.converters.HeadersInit=function(t,e,n){if(Ds.util.Type(t)===Ds.util.Types.OBJECT){let r=Reflect.get(t,Symbol.iterator);if(!QX.types.isProxy(t)&&r===RC.prototype.entries)try{return UX(t).entriesList}catch{}return typeof r=="function"?Ds.converters["sequence<sequence<ByteString>>"](t,e,n,r.bind(t)):Ds.converters["record<ByteString, ByteString>"](t,e,n)}throw Ds.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};wit.exports={fill:Tit,compareHeaderName:bit,Headers:RC,HeadersList:kX,getHeadersGuard:xit,setHeadersGuard:c6n,setHeadersList:d6n,getHeadersList:UX}});var $U=b((yJr,Uit)=>{"use strict";var{Headers:Fit,HeadersList:Rit,fill:f6n,getHeadersGuard:p6n,setHeadersGuard:Lit,setHeadersList:Pit}=dN(),{extractBody:Bit,cloneBody:h6n,mixinBody:m6n,hasFinalizationRegistry:A6n,streamRegistry:g6n,bodyUnusable:E6n}=a8(),Qit=oo(),Nit=we("node:util"),{kEnumerableProperty:_0}=Qit,{isValidReasonPhrase:y6n,isCancelled:C6n,isAborted:v6n,serializeJavascriptValueToJSONString:D6n,isErrorLike:S6n,isomorphicEncode:_6n,environmentSettingsObject:I6n}=jm(),{redirectStatusSet:T6n,nullBodyStatus:b6n}=pU(),{webidl:hs}=Gp(),{URLSerializer:Oit}=C0(),{kConstruct:HX}=rl(),YDe=we("node:assert"),{types:x6n}=we("node:util"),w6n=new TextEncoder("utf-8"),I0=class t{#e;#t;static error(){return VU(qX(),"immutable")}static json(e,n=void 0){hs.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=hs.converters.ResponseInit(n));let r=w6n.encode(D6n(e)),i=Bit(r),o=VU(b8({}),"response");return Mit(o,n,{body:i[0],type:"application/json"}),o}static redirect(e,n=302){hs.argumentLengthCheck(arguments,1,"Response.redirect"),e=hs.converters.USVString(e),n=hs.converters["unsigned short"](n);let r;try{r=new URL(e,I6n.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${e}`,{cause:s})}if(!T6n.has(n))throw new RangeError(`Invalid status code ${n}`);let i=VU(b8({}),"immutable");i.#t.status=n;let o=_6n(Oit(r));return i.#t.headersList.append("location",o,!0),i}constructor(e=null,n=void 0){if(hs.util.markAsUncloneable(this),e===HX)return;e!==null&&(e=hs.converters.BodyInit(e)),n=hs.converters.ResponseInit(n),this.#t=b8({}),this.#e=new Fit(HX),Lit(this.#e,"response"),Pit(this.#e,this.#t.headersList);let r=null;if(e!=null){let[i,o]=Bit(e);r={body:i,type:o}}Mit(this,n,r)}get type(){return hs.brandCheck(this,t),this.#t.type}get url(){hs.brandCheck(this,t);let e=this.#t.urlList,n=e[e.length-1]??null;return n===null?"":Oit(n,!0)}get redirected(){return hs.brandCheck(this,t),this.#t.urlList.length>1}get status(){return hs.brandCheck(this,t),this.#t.status}get ok(){return hs.brandCheck(this,t),this.#t.status>=200&&this.#t.status<=299}get statusText(){return hs.brandCheck(this,t),this.#t.statusText}get headers(){return hs.brandCheck(this,t),this.#e}get body(){return hs.brandCheck(this,t),this.#t.body?this.#t.body.stream:null}get bodyUsed(){return hs.brandCheck(this,t),!!this.#t.body&&Qit.isDisturbed(this.#t.body.stream)}clone(){if(hs.brandCheck(this,t),E6n(this.#t))throw hs.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=jDe(this.#t);return VU(e,p6n(this.#e))}[Nit.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={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 ${Nit.formatWithOptions(n,r)}`}static getResponseHeaders(e){return e.#e}static setResponseHeaders(e,n){e.#e=n}static getResponseState(e){return e.#t}static setResponseState(e,n){e.#t=n}},{getResponseHeaders:R6n,setResponseHeaders:B6n,getResponseState:fN,setResponseState:N6n}=I0;Reflect.deleteProperty(I0,"getResponseHeaders");Reflect.deleteProperty(I0,"setResponseHeaders");Reflect.deleteProperty(I0,"getResponseState");Reflect.deleteProperty(I0,"setResponseState");m6n(I0,fN);Object.defineProperties(I0.prototype,{type:_0,url:_0,status:_0,ok:_0,redirected:_0,statusText:_0,headers:_0,clone:_0,body:_0,bodyUsed:_0,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(I0,{json:_0,redirect:_0,error:_0});function jDe(t){if(t.internalResponse)return kit(jDe(t.internalResponse),t.type);let e=b8({...t,body:null});return t.body!=null&&(e.body=h6n(e,t.body)),e}function b8(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new Rit(t?.headersList):new Rit,urlList:t?.urlList?[...t.urlList]:[]}}function qX(t){let e=S6n(t);return b8({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}function O6n(t){return t.type==="error"&&t.status===0}function GX(t,e){return e={internalResponse:t,...e},new Proxy(t,{get(n,r){return r in e?e[r]:n[r]},set(n,r,i){return YDe(!(r in e)),n[r]=i,!0}})}function kit(t,e){if(e==="basic")return GX(t,{type:"basic",headersList:t.headersList});if(e==="cors")return GX(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return GX(t,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(e==="opaqueredirect")return GX(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});YDe(!1)}function M6n(t,e=null){return YDe(C6n(t)),v6n(t)?qX(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):qX(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}function Mit(t,e,n){if(e.status!==null&&(e.status<200||e.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&e.statusText!=null&&!y6n(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(fN(t).status=e.status),"statusText"in e&&e.statusText!=null&&(fN(t).statusText=e.statusText),"headers"in e&&e.headers!=null&&f6n(R6n(t),e.headers),n){if(b6n.includes(t.status))throw hs.errors.exception({header:"Response constructor",message:`Invalid response status code ${t.status}`});fN(t).body=n.body,n.type!=null&&!fN(t).headersList.contains("content-type",!0)&&fN(t).headersList.append("content-type",n.type,!0)}}function VU(t,e){let n=new I0(HX);N6n(n,t);let r=new Fit(HX);return B6n(n,r),Pit(r,t.headersList),Lit(r,e),A6n&&t.body?.stream&&g6n.register(n,new WeakRef(t.body.stream)),n}hs.converters.XMLHttpRequestBodyInit=function(t,e,n){return typeof t=="string"?hs.converters.USVString(t,e,n):hs.is.Blob(t)||ArrayBuffer.isView(t)||x6n.isArrayBuffer(t)||hs.is.FormData(t)||hs.is.URLSearchParams(t)?t:hs.converters.DOMString(t,e,n)};hs.converters.BodyInit=function(t,e,n){return hs.is.ReadableStream(t)||t?.[Symbol.asyncIterator]?t:hs.converters.XMLHttpRequestBodyInit(t,e,n)};hs.converters.ResponseInit=hs.dictionaryConverter([{key:"status",converter:hs.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:hs.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:hs.converters.HeadersInit}]);hs.is.Response=hs.util.MakeTypeAssertion(I0);Uit.exports={isNetworkError:O6n,makeNetworkError:qX,makeResponse:b8,makeAppropriateNetworkError:M6n,filterResponse:kit,Response:I0,cloneResponse:jDe,fromInnerResponse:VU,getResponseState:fN}});var Vit=b((CJr,qit)=>{"use strict";var{kConnected:Git,kSize:Hit}=rl(),WDe=class{constructor(e){this.value=e}deref(){return this.value[Git]===0&&this.value[Hit]===0?void 0:this.value}},zDe=class{constructor(e){this.finalizer=e}register(e,n){e.on&&e.on("disconnect",()=>{e[Git]===0&&e[Hit]===0&&this.finalizer(n)})}unregister(e){}};qit.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:WDe,FinalizationRegistry:zDe}):{WeakRef,FinalizationRegistry}}});var x8=b((vJr,iot)=>{"use strict";var{extractBody:F6n,mixinBody:L6n,cloneBody:P6n,bodyUnusable:$it}=a8(),{Headers:Kit,fill:Q6n,HeadersList:YX,setHeadersGuard:JDe,getHeadersGuard:k6n,setHeadersList:Xit,getHeadersList:Yit}=dN(),{FinalizationRegistry:U6n}=Vit()(),$X=oo(),jit=we("node:util"),{isValidHTTPToken:G6n,sameOrigin:Wit,environmentSettingsObject:VX}=jm(),{forbiddenMethodsSet:H6n,corsSafeListedMethodsSet:q6n,referrerPolicy:V6n,requestRedirect:$6n,requestMode:Y6n,requestCredentials:j6n,requestCache:W6n,requestDuplex:z6n}=pU(),{kEnumerableProperty:xd,normalizedMethodRecordsBase:J6n,normalizedMethodRecords:K6n}=$X,{webidl:fi}=Gp(),{URLSerializer:X6n}=C0(),{kConstruct:jX}=rl(),Z6n=we("node:assert"),{getMaxListeners:Zit,setMaxListeners:e3n,defaultMaxListeners:t3n}=we("node:events"),n3n=Symbol("abortController"),eot=new U6n(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),WX=new WeakMap,KDe;try{KDe=Zit(new AbortController().signal)>0}catch{KDe=!1}function zit(t){return e;function e(){let n=t.deref();if(n!==void 0){eot.unregister(e),this.removeEventListener("abort",e),n.abort(this.reason);let r=WX.get(n.signal);if(r!==void 0){if(r.size!==0){for(let i of r){let o=i.deref();o!==void 0&&o.abort(this.reason)}r.clear()}WX.delete(n.signal)}}}}var Jit=!1,rg=class t{#e;#t;#n;#r;constructor(e,n=void 0){if(fi.util.markAsUncloneable(this),e===jX)return;let r="Request constructor";fi.argumentLengthCheck(arguments,1,r),e=fi.converters.RequestInfo(e,r,"input"),n=fi.converters.RequestInit(n,r,"init");let i=null,o=null,s=VX.settingsObject.baseUrl,a=null;if(typeof e=="string"){this.#t=n.dispatcher;let _;try{_=new URL(e,s)}catch(w){throw new TypeError("Failed to parse URL from "+e,{cause:w})}if(_.username||_.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);i=zX({urlList:[_]}),o="cors"}else Z6n(fi.is.Request(e)),i=e.#r,a=e.#e,this.#t=n.dispatcher||e.#t;let l=VX.settingsObject.origin,u="client";if(i.window?.constructor?.name==="EnvironmentSettingsObject"&&Wit(i.window,l)&&(u=i.window),n.window!=null)throw new TypeError(`'window' option '${u}' must be null`);"window"in n&&(u="no-window"),i=zX({method:i.method,headersList:i.headersList,unsafeRequest:i.unsafeRequest,client:VX.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 c=Object.keys(n).length!==0;if(c&&(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]),n.referrer!==void 0){let _=n.referrer;if(_==="")i.referrer="no-referrer";else{let w;try{w=new URL(_,s)}catch(B){throw new TypeError(`Referrer "${_}" is not a valid URL.`,{cause:B})}w.protocol==="about:"&&w.hostname==="client"||l&&!Wit(w,VX.settingsObject.baseUrl)?i.referrer="client":i.referrer=w}}n.referrerPolicy!==void 0&&(i.referrerPolicy=n.referrerPolicy);let d;if(n.mode!==void 0?d=n.mode:d=o,d==="navigate")throw fi.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(d!=null&&(i.mode=d),n.credentials!==void 0&&(i.credentials=n.credentials),n.cache!==void 0&&(i.cache=n.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(n.redirect!==void 0&&(i.redirect=n.redirect),n.integrity!=null&&(i.integrity=String(n.integrity)),n.keepalive!==void 0&&(i.keepalive=!!n.keepalive),n.method!==void 0){let _=n.method,w=K6n[_];if(w!==void 0)i.method=w;else{if(!G6n(_))throw new TypeError(`'${_}' is not a valid HTTP method.`);let B=_.toUpperCase();if(H6n.has(B))throw new TypeError(`'${_}' HTTP method is unsupported.`);_=J6n[B]??_,i.method=_}!Jit&&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"}),Jit=!0)}n.signal!==void 0&&(a=n.signal),this.#r=i;let h=new AbortController;if(this.#e=h.signal,a!=null)if(a.aborted)h.abort(a.reason);else{this[n3n]=h;let _=new WeakRef(h),w=zit(_);KDe&&Zit(a)===t3n&&e3n(1500,a),$X.addAbortListener(a,w),eot.register(h,{signal:a,abort:w},w)}if(this.#n=new Kit(jX),Xit(this.#n,i.headersList),JDe(this.#n,"request"),d==="no-cors"){if(!q6n.has(i.method))throw new TypeError(`'${i.method} is unsupported in no-cors mode.`);JDe(this.#n,"request-no-cors")}if(c){let _=Yit(this.#n),w=n.headers!==void 0?n.headers:new YX(_);if(_.clear(),w instanceof YX){for(let{name:B,value:R}of w.rawValues())_.append(B,R,!1);_.cookies=w.cookies}else Q6n(this.#n,w)}let m=fi.is.Request(e)?e.#r.body:null;if((n.body!=null||m!=null)&&(i.method==="GET"||i.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let E=null;if(n.body!=null){let[_,w]=F6n(n.body,i.keepalive);E=_,w&&!Yit(this.#n).contains("content-type",!0)&&this.#n.append("content-type",w,!0)}let y=E??m;if(y!=null&&y.source==null){if(E!=null&&n.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 C=y;if(E==null&&m!=null){if($it(e.#r))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let _=new TransformStream;m.stream.pipeThrough(_),C={source:m.source,length:m.length,stream:_.readable}}this.#r.body=C}get method(){return fi.brandCheck(this,t),this.#r.method}get url(){return fi.brandCheck(this,t),X6n(this.#r.url)}get headers(){return fi.brandCheck(this,t),this.#n}get destination(){return fi.brandCheck(this,t),this.#r.destination}get referrer(){return fi.brandCheck(this,t),this.#r.referrer==="no-referrer"?"":this.#r.referrer==="client"?"about:client":this.#r.referrer.toString()}get referrerPolicy(){return fi.brandCheck(this,t),this.#r.referrerPolicy}get mode(){return fi.brandCheck(this,t),this.#r.mode}get credentials(){return fi.brandCheck(this,t),this.#r.credentials}get cache(){return fi.brandCheck(this,t),this.#r.cache}get redirect(){return fi.brandCheck(this,t),this.#r.redirect}get integrity(){return fi.brandCheck(this,t),this.#r.integrity}get keepalive(){return fi.brandCheck(this,t),this.#r.keepalive}get isReloadNavigation(){return fi.brandCheck(this,t),this.#r.reloadNavigation}get isHistoryNavigation(){return fi.brandCheck(this,t),this.#r.historyNavigation}get signal(){return fi.brandCheck(this,t),this.#e}get body(){return fi.brandCheck(this,t),this.#r.body?this.#r.body.stream:null}get bodyUsed(){return fi.brandCheck(this,t),!!this.#r.body&&$X.isDisturbed(this.#r.body.stream)}get duplex(){return fi.brandCheck(this,t),"half"}clone(){if(fi.brandCheck(this,t),$it(this.#r))throw new TypeError("unusable");let e=not(this.#r),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let r=WX.get(this.signal);r===void 0&&(r=new Set,WX.set(this.signal,r));let i=new WeakRef(n);r.add(i),$X.addAbortListener(n.signal,zit(i))}return rot(e,this.#t,n.signal,k6n(this.#n))}[jit.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={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 ${jit.formatWithOptions(n,r)}`}static setRequestSignal(e,n){return e.#e=n,e}static getRequestDispatcher(e){return e.#t}static setRequestDispatcher(e,n){e.#t=n}static setRequestHeaders(e,n){e.#n=n}static getRequestState(e){return e.#r}static setRequestState(e,n){e.#r=n}},{setRequestSignal:r3n,getRequestDispatcher:i3n,setRequestDispatcher:o3n,setRequestHeaders:s3n,getRequestState:tot,setRequestState:a3n}=rg;Reflect.deleteProperty(rg,"setRequestSignal");Reflect.deleteProperty(rg,"getRequestDispatcher");Reflect.deleteProperty(rg,"setRequestDispatcher");Reflect.deleteProperty(rg,"setRequestHeaders");Reflect.deleteProperty(rg,"getRequestState");Reflect.deleteProperty(rg,"setRequestState");L6n(rg,tot);function zX(t){return{method:t.method??"GET",localURLsOnly:t.localURLsOnly??!1,unsafeRequest:t.unsafeRequest??!1,body:t.body??null,client:t.client??null,reservedClient:t.reservedClient??null,replacesClientId:t.replacesClientId??"",window:t.window??"client",keepalive:t.keepalive??!1,serviceWorkers:t.serviceWorkers??"all",initiator:t.initiator??"",destination:t.destination??"",priority:t.priority??null,origin:t.origin??"client",policyContainer:t.policyContainer??"client",referrer:t.referrer??"client",referrerPolicy:t.referrerPolicy??"",mode:t.mode??"no-cors",useCORSPreflightFlag:t.useCORSPreflightFlag??!1,credentials:t.credentials??"same-origin",useCredentials:t.useCredentials??!1,cache:t.cache??"default",redirect:t.redirect??"follow",integrity:t.integrity??"",cryptoGraphicsNonceMetadata:t.cryptoGraphicsNonceMetadata??"",parserMetadata:t.parserMetadata??"",reloadNavigation:t.reloadNavigation??!1,historyNavigation:t.historyNavigation??!1,userActivation:t.userActivation??!1,taintedOrigin:t.taintedOrigin??!1,redirectCount:t.redirectCount??0,responseTainting:t.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:t.preventNoCacheCacheControlHeaderModification??!1,done:t.done??!1,timingAllowFailed:t.timingAllowFailed??!1,urlList:t.urlList,url:t.urlList[0],headersList:t.headersList?new YX(t.headersList):new YX}}function not(t){let e=zX({...t,body:null});return t.body!=null&&(e.body=P6n(e,t.body)),e}function rot(t,e,n,r){let i=new rg(jX);a3n(i,t),o3n(i,e),r3n(i,n);let o=new Kit(jX);return s3n(i,o),Xit(o,t.headersList),JDe(o,r),i}Object.defineProperties(rg.prototype,{method:xd,url:xd,headers:xd,redirect:xd,clone:xd,signal:xd,duplex:xd,destination:xd,body:xd,bodyUsed:xd,isHistoryNavigation:xd,isReloadNavigation:xd,keepalive:xd,integrity:xd,cache:xd,credentials:xd,attribute:xd,referrerPolicy:xd,referrer:xd,mode:xd,[Symbol.toStringTag]:{value:"Request",configurable:!0}});fi.is.Request=fi.util.MakeTypeAssertion(rg);fi.converters.RequestInfo=function(t,e,n){return typeof t=="string"?fi.converters.USVString(t):fi.is.Request(t)?t:fi.converters.USVString(t)};fi.converters.RequestInit=fi.dictionaryConverter([{key:"method",converter:fi.converters.ByteString},{key:"headers",converter:fi.converters.HeadersInit},{key:"body",converter:fi.nullableConverter(fi.converters.BodyInit)},{key:"referrer",converter:fi.converters.USVString},{key:"referrerPolicy",converter:fi.converters.DOMString,allowedValues:V6n},{key:"mode",converter:fi.converters.DOMString,allowedValues:Y6n},{key:"credentials",converter:fi.converters.DOMString,allowedValues:j6n},{key:"cache",converter:fi.converters.DOMString,allowedValues:W6n},{key:"redirect",converter:fi.converters.DOMString,allowedValues:$6n},{key:"integrity",converter:fi.converters.DOMString},{key:"keepalive",converter:fi.converters.boolean},{key:"signal",converter:fi.nullableConverter(t=>fi.converters.AbortSignal(t,"RequestInit","signal"))},{key:"window",converter:fi.converters.any},{key:"duplex",converter:fi.converters.DOMString,allowedValues:z6n},{key:"dispatcher",converter:fi.converters.any}]);iot.exports={Request:rg,makeRequest:zX,fromInnerRequest:rot,cloneRequest:not,getRequestDispatcher:i3n,getRequestState:tot}});var jU=b((DJr,Eot)=>{"use strict";var{makeNetworkError:Ga,makeAppropriateNetworkError:JX,filterResponse:XDe,makeResponse:KX,fromInnerResponse:l3n,getResponseState:u3n}=$U(),{HeadersList:oot}=dN(),{Request:c3n,cloneRequest:d3n,getRequestDispatcher:f3n,getRequestState:p3n}=x8(),rx=we("node:zlib"),{bytesMatch:h3n,makePolicyContainer:m3n,clonePolicyContainer:A3n,requestBadPort:g3n,TAOCheck:E3n,appendRequestOriginHeader:y3n,responseLocationURL:C3n,requestCurrentURL:tS,setRequestReferrerPolicyOnRedirect:v3n,tryUpgradeRequestToAPotentiallyTrustworthyURL:D3n,createOpaqueTimingInfo:rSe,appendFetchMetadata:S3n,corsCheck:_3n,crossOriginResourcePolicyCheck:I3n,determineRequestsReferrer:T3n,coarsenedSharedCurrentTime:YU,createDeferredPromise:b3n,sameOrigin:nSe,isCancelled:pN,isAborted:sot,isErrorLike:x3n,fullyReadBody:w3n,readableStreamClose:R3n,isomorphicEncode:XX,urlIsLocal:B3n,urlIsHttpHttpsScheme:tZ,urlHasHttpsScheme:N3n,clampAndCoarsenConnectionTimingInfo:O3n,simpleRangeHeaderValue:M3n,buildContentRange:F3n,createInflate:L3n,extractMimeType:P3n}=jm(),hN=we("node:assert"),{safelyExtractBody:iSe,extractBody:aot}=a8(),{redirectStatusSet:cot,nullBodyStatus:dot,safeMethodsSet:Q3n,requestBodyHeader:k3n,subresourceSet:U3n}=pU(),G3n=we("node:events"),{Readable:H3n,pipeline:q3n,finished:V3n,isErrored:$3n,isReadable:ZX}=we("node:stream"),{addAbortListener:Y3n,bufferToLowerCasedHeaderName:lot}=oo(),{dataURLProcessor:j3n,serializeAMimeType:W3n,minimizeSupportedMimeType:z3n}=C0(),{getGlobalDispatcher:J3n}=FX(),{webidl:oSe}=Gp(),{STATUS_CODES:K3n}=we("node:http"),X3n=["GET","HEAD"],Z3n=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",ZDe,eZ=class extends G3n{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){this.state==="ongoing"&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}};function eOn(t){fot(t,"fetch")}function tOn(t,e=void 0){oSe.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=b3n(),r;try{r=new c3n(t,e)}catch(c){return n.reject(c),n.promise}let i=p3n(r);if(r.signal.aborted)return eSe(n,i,null,r.signal.reason),n.promise;i.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(i.serviceWorkers="none");let s=null,a=!1,l=null;return Y3n(r.signal,()=>{a=!0,hN(l!=null),l.abort(r.signal.reason);let c=s?.deref();eSe(n,i,c,r.signal.reason)}),l=hot({request:i,processResponseEndOfBody:eOn,processResponse:c=>{if(!a){if(c.aborted){eSe(n,i,s,l.serializedAbortReason);return}if(c.type==="error"){n.reject(new TypeError("fetch failed",{cause:c.error}));return}s=new WeakRef(l3n(c,"immutable")),n.resolve(s.deref()),n=null}},dispatcher:f3n(r)}),n.promise}function fot(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let n=t.urlList[0],r=t.timingInfo,i=t.cacheState;tZ(n)&&r!==null&&(t.timingAllowPassed||(r=rSe({startTime:r.startTime}),i=""),r.endTime=YU(),t.timingInfo=r,pot(r,n.href,e,globalThis,i,"",t.status))}var pot=performance.markResourceTiming;function eSe(t,e,n,r){if(t&&t.reject(r),e.body?.stream!=null&&ZX(e.body.stream)&&e.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),n==null)return;let i=u3n(n);i.body?.stream!=null&&ZX(i.body.stream)&&i.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function hot({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:i,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:a=J3n()}){hN(a);let l=null,u=!1;t.client!=null&&(l=t.client.globalObject,u=t.client.crossOriginIsolatedCapability);let c=YU(u),d=rSe({startTime:c}),h={controller:new eZ(a),request:t,timingInfo:d,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:o,processResponseEndOfBody:i,taskDestination:l,crossOriginIsolatedCapability:u};return hN(!t.body||t.body.stream),t.window==="client"&&(t.window=t.client?.globalObject?.constructor?.name==="Window"?t.client:"no-window"),t.origin==="client"&&(t.origin=t.client.origin),t.policyContainer==="client"&&(t.client!=null?t.policyContainer=A3n(t.client.policyContainer):t.policyContainer=m3n()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,U3n.has(t.destination),mot(h).catch(m=>{h.controller.terminate(m)}),h.controller}async function mot(t,e=!1){let n=t.request,r=null;if(n.localURLsOnly&&!B3n(tS(n))&&(r=Ga("local URLs only")),D3n(n),g3n(n)==="blocked"&&(r=Ga("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=T3n(n)),r===null){let o=tS(n);nSe(o,n.url)&&n.responseTainting==="basic"||o.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",r=await uot(t)):n.mode==="same-origin"?r=Ga('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?r=Ga('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",r=await uot(t)):tZ(tS(n))?(n.responseTainting="cors",r=await Aot(t)):r=Ga("URL scheme must be a HTTP(S) scheme")}if(e)return r;r.status!==0&&!r.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?r=XDe(r,"basic"):n.responseTainting==="cors"?r=XDe(r,"cors"):n.responseTainting==="opaque"?r=XDe(r,"opaque"):hN(!1));let i=r.status===0?r:r.internalResponse;if(i.urlList.length===0&&i.urlList.push(...n.urlList),n.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&i.status===206&&i.rangeRequested&&!n.headers.contains("range",!0)&&(r=i=Ga()),r.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||dot.includes(i.status))&&(i.body=null,t.controller.dump=!0),n.integrity){let o=a=>tSe(t,Ga(a));if(n.responseTainting==="opaque"||r.body==null){o(r.error);return}let s=a=>{if(!h3n(a,n.integrity)){o("integrity mismatch");return}r.body=iSe(a)[0],tSe(t,r)};await w3n(r.body,s,o)}else tSe(t,r)}function uot(t){if(pN(t)&&t.request.redirectCount===0)return Promise.resolve(JX(t));let{request:e}=t,{protocol:n}=tS(e);switch(n){case"about:":return Promise.resolve(Ga("about scheme is not supported"));case"blob:":{ZDe||(ZDe=we("node:buffer").resolveObjectURL);let r=tS(e);if(r.search.length!==0)return Promise.resolve(Ga("NetworkError when attempting to fetch resource."));let i=ZDe(r.toString());if(e.method!=="GET"||!oSe.is.Blob(i))return Promise.resolve(Ga("invalid method"));let o=KX(),s=i.size,a=XX(`${s}`),l=i.type;if(e.headersList.contains("range",!0)){o.rangeRequested=!0;let u=e.headersList.get("range",!0),c=M3n(u,!0);if(c==="failure")return Promise.resolve(Ga("failed to fetch the data URL"));let{rangeStartValue:d,rangeEndValue:h}=c;if(d===null)d=s-h,h=d+h-1;else{if(d>=s)return Promise.resolve(Ga("Range start is greater than the blob's size."));(h===null||h>=s)&&(h=s-1)}let m=i.slice(d,h,l),E=aot(m);o.body=E[0];let y=XX(`${m.size}`),C=F3n(d,h,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",y,!0),o.headersList.set("content-type",l,!0),o.headersList.set("content-range",C,!0)}else{let u=aot(i);o.statusText="OK",o.body=u[0],o.headersList.set("content-length",a,!0),o.headersList.set("content-type",l,!0)}return Promise.resolve(o)}case"data:":{let r=tS(e),i=j3n(r);if(i==="failure")return Promise.resolve(Ga("failed to fetch the data URL"));let o=W3n(i.mimeType);return Promise.resolve(KX({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:iSe(i.body)[0]}))}case"file:":return Promise.resolve(Ga("not implemented... yet..."));case"http:":case"https:":return Aot(t).catch(r=>Ga(r));default:return Promise.resolve(Ga("unknown scheme"))}}function nOn(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}function tSe(t,e){let n=t.timingInfo,r=()=>{let o=Date.now();t.request.destination==="document"&&(t.controller.fullTimingInfo=n),t.controller.reportTimingSteps=()=>{if(!tZ(t.request.url))return;n.endTime=o;let a=e.cacheState,l=e.bodyInfo;e.timingAllowPassed||(n=rSe(n),a="");let u=0;if(t.request.mode!=="navigator"||!e.hasCrossOriginRedirects){u=e.status;let c=P3n(e.headersList);c!=="failure"&&(l.contentType=z3n(c))}t.request.initiatorType!=null&&pot(n,t.request.url.href,t.request.initiatorType,globalThis,a,l,u)};let s=()=>{t.request.done=!0,t.processResponseEndOfBody!=null&&queueMicrotask(()=>t.processResponseEndOfBody(e)),t.request.initiatorType!=null&&t.controller.reportTimingSteps()};queueMicrotask(()=>s())};t.processResponse!=null&&queueMicrotask(()=>{t.processResponse(e),t.processResponse=null});let i=e.type==="error"?e:e.internalResponse??e;i.body==null?r():V3n(i.body.stream,()=>{r()})}async function Aot(t){let e=t.request,n=null,r=null,i=t.timingInfo;if(e.serviceWorkers,n===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),r=n=await got(t),e.responseTainting==="cors"&&_3n(e,n)==="failure")return Ga("cors failure");E3n(e,n)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||n.type==="opaque")&&I3n(e.origin,e.client,e.destination,r)==="blocked"?Ga("blocked"):(cot.has(r.status)&&(e.redirect!=="manual"&&t.controller.connection.destroy(void 0,!1),e.redirect==="error"?n=Ga("unexpected redirect"):e.redirect==="manual"?n=r:e.redirect==="follow"?n=await rOn(t,n):hN(!1)),n.timingInfo=i,n)}function rOn(t,e){let n=t.request,r=e.internalResponse?e.internalResponse:e,i;try{if(i=C3n(r,tS(n).hash),i==null)return e}catch(s){return Promise.resolve(Ga(s))}if(!tZ(i))return Promise.resolve(Ga("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(Ga("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(i.username||i.password)&&!nSe(n,i))return Promise.resolve(Ga('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(i.username||i.password))return Promise.resolve(Ga('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(Ga());if([301,302].includes(r.status)&&n.method==="POST"||r.status===303&&!X3n.includes(n.method)){n.method="GET",n.body=null;for(let s of k3n)n.headersList.delete(s)}nSe(tS(n),i)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(hN(n.body.source!=null),n.body=iSe(n.body.source)[0]);let o=t.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=YU(t.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),n.urlList.push(i),v3n(n,r),mot(t,!0)}async function got(t,e=!1,n=!1){let r=t.request,i=null,o=null,s=null,a=null,l=!1;r.window==="no-window"&&r.redirect==="error"?(i=t,o=r):(o=d3n(r),i={...t},i.request=o);let u=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",c=o.body?o.body.length:null,d=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(d="0"),c!=null&&(d=XX(`${c}`)),d!=null&&o.headersList.append("content-length",d,!0),c!=null&&o.keepalive,oSe.is.URL(o.referrer)&&o.headersList.append("referer",XX(o.referrer.href),!0),y3n(o),S3n(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",Z3n,!0),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)||(N3n(tS(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 Ga("only if cached");let h=await iOn(i,u,n);!Q3n.has(o.method)&&h.status>=200&&h.status<=399,l&&h.status,s==null&&(s=h)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=u,s.status===407)return r.window==="no-window"?Ga():pN(t)?JX(t):Ga("proxy authentication required");if(s.status===421&&!n&&(r.body==null||r.body.source!=null)){if(pN(t))return JX(t);t.controller.connection.destroy(),s=await got(t,e,!0)}return s}async function iOn(t,e=!1,n=!1){hN(!t.controller.connection||t.controller.connection.destroyed),t.controller.connection={abort:null,destroyed:!1,destroy(E,y=!0){this.destroyed||(this.destroyed=!0,y&&this.abort?.(E??new DOMException("The operation was aborted.","AbortError")))}};let r=t.request,i=null,o=t.timingInfo;null==null&&(r.cache="no-store");let a=n?"yes":"no";r.mode;let l=null;if(r.body==null&&t.processRequestEndOfBody)queueMicrotask(()=>t.processRequestEndOfBody());else if(r.body!=null){let E=async function*(_){pN(t)||(yield _,t.processRequestBodyChunkLength?.(_.byteLength))},y=()=>{pN(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},C=_=>{pN(t)||(_.name==="AbortError"?t.controller.abort():t.controller.terminate(_))};l=async function*(){try{for await(let _ of r.body.stream)yield*E(_);y()}catch(_){C(_)}}()}try{let{body:E,status:y,statusText:C,headersList:_,socket:w}=await m({body:l});if(w)i=KX({status:y,statusText:C,headersList:_,socket:w});else{let B=E[Symbol.asyncIterator]();t.controller.next=()=>B.next(),i=KX({status:y,statusText:C,headersList:_})}}catch(E){return E.name==="AbortError"?(t.controller.connection.destroy(),JX(t,E)):Ga(E)}let u=()=>t.controller.resume(),c=E=>{pN(t)||t.controller.abort(E)},d=new ReadableStream({async start(E){t.controller.controller=E},async pull(E){await u(E)},async cancel(E){await c(E)},type:"bytes"});i.body={stream:d,source:null,length:null},t.controller.resume||t.controller.on("terminated",h),t.controller.resume=async()=>{for(;;){let E,y;try{let{done:_,value:w}=await t.controller.next();if(sot(t))break;E=_?void 0:w}catch(_){t.controller.ended&&!o.encodedBodySize?E=void 0:(E=_,y=!0)}if(E===void 0){R3n(t.controller.controller),nOn(t,i);return}if(o.decodedBodySize+=E?.byteLength??0,y){t.controller.terminate(E);return}let C=new Uint8Array(E);if(C.byteLength&&t.controller.controller.enqueue(C),$3n(d)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function h(E){sot(t)?(i.aborted=!0,ZX(d)&&t.controller.controller.error(t.controller.serializedAbortReason)):ZX(d)&&t.controller.controller.error(new TypeError("terminated",{cause:x3n(E)?E:void 0})),t.controller.connection.destroy()}return i;function m({body:E}){let y=tS(r),C=t.controller.dispatcher;return new Promise((_,w)=>C.dispatch({path:y.pathname+y.search,origin:y.origin,method:r.method,body:C.isMockActive?r.body&&(r.body.source||r.body.stream):E,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(B){let{connection:R}=t.controller;o.finalConnectionTimingInfo=O3n(void 0,o.postRedirectStartTime,t.crossOriginIsolatedCapability),R.destroyed?B(new DOMException("The operation was aborted.","AbortError")):(t.controller.on("terminated",B),this.abort=R.abort=B),o.finalNetworkRequestStartTime=YU(t.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=YU(t.crossOriginIsolatedCapability)},onHeaders(B,R,F,q){if(B<200)return;let J=[],j="",L=new oot;for(let O=0;O<R.length;O+=2)L.append(lot(R[O]),R[O+1].toString("latin1"),!0);let K=L.get("content-encoding",!0);K&&(J=K.toLowerCase().split(",").map(O=>O.trim())),j=L.get("location",!0),this.body=new H3n({read:F});let U=[],se=j&&r.redirect==="follow"&&cot.has(B);if(J.length!==0&&r.method!=="HEAD"&&r.method!=="CONNECT"&&!dot.includes(B)&&!se)for(let O=J.length-1;O>=0;--O){let Y=J[O];if(Y==="x-gzip"||Y==="gzip")U.push(rx.createGunzip({flush:rx.constants.Z_SYNC_FLUSH,finishFlush:rx.constants.Z_SYNC_FLUSH}));else if(Y==="deflate")U.push(L3n({flush:rx.constants.Z_SYNC_FLUSH,finishFlush:rx.constants.Z_SYNC_FLUSH}));else if(Y==="br")U.push(rx.createBrotliDecompress({flush:rx.constants.BROTLI_OPERATION_FLUSH,finishFlush:rx.constants.BROTLI_OPERATION_FLUSH}));else{U.length=0;break}}let V=this.onError.bind(this);return _({status:B,statusText:q,headersList:L,body:U.length?q3n(this.body,...U,O=>{O&&this.onError(O)}).on("error",V):this.body.on("error",V)}),!0},onData(B){if(t.controller.dump)return;let R=B;return o.encodedBodySize+=R.byteLength,this.body.push(R)},onComplete(){this.abort&&t.controller.off("terminated",this.abort),t.controller.ended=!0,this.body.push(null)},onError(B){this.abort&&t.controller.off("terminated",this.abort),this.body?.destroy(B),t.controller.terminate(B),w(B)},onUpgrade(B,R,F){if(B!==101)return;let q=new oot;for(let J=0;J<R.length;J+=2)q.append(lot(R[J]),R[J+1].toString("latin1"),!0);return _({status:B,statusText:K3n[B],headersList:q,socket:F}),!0}}))}}Eot.exports={fetch:tOn,Fetch:eZ,fetching:hot,finalizeAndReportTiming:fot}});var vot=b((SJr,Cot)=>{"use strict";var oOn=we("node:assert"),{URLSerializer:yot}=C0(),{isValidHeaderName:sOn}=jm();function aOn(t,e,n=!1){let r=yot(t,n),i=yot(e,n);return r===i}function lOn(t){oOn(t!==null);let e=[];for(let n of t.split(","))n=n.trim(),sOn(n)&&e.push(n);return e}Cot.exports={urlEquals:aOn,getFieldValues:lOn}});var _ot=b((_Jr,Sot)=>{"use strict";var{kConstruct:uOn}=rl(),{urlEquals:cOn,getFieldValues:sSe}=vot(),{kEnumerableProperty:mN,isDisturbed:dOn}=oo(),{webidl:wr}=Gp(),{cloneResponse:fOn,fromInnerResponse:pOn,getResponseState:hOn}=$U(),{Request:WU,fromInnerRequest:mOn,getRequestState:nS}=x8(),{fetching:AOn}=jU(),{urlIsHttpHttpsScheme:nZ,createDeferredPromise:w8,readAllBytes:gOn}=jm(),aSe=we("node:assert"),rZ=class t{#e;constructor(){arguments[0]!==uOn&&wr.illegalConstructor(),wr.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,n={}){wr.brandCheck(this,t);let r="Cache.match";wr.argumentLengthCheck(arguments,1,r),e=wr.converters.RequestInfo(e,r,"request"),n=wr.converters.CacheQueryOptions(n,r,"options");let i=this.#o(e,n,1);if(i.length!==0)return i[0]}async matchAll(e=void 0,n={}){wr.brandCheck(this,t);let r="Cache.matchAll";return e!==void 0&&(e=wr.converters.RequestInfo(e,r,"request")),n=wr.converters.CacheQueryOptions(n,r,"options"),this.#o(e,n)}async add(e){wr.brandCheck(this,t);let n="Cache.add";wr.argumentLengthCheck(arguments,1,n),e=wr.converters.RequestInfo(e,n,"request");let r=[e];return await this.addAll(r)}async addAll(e){wr.brandCheck(this,t);let n="Cache.addAll";wr.argumentLengthCheck(arguments,1,n);let r=[],i=[];for(let h of e){if(h===void 0)throw wr.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(h=wr.converters.RequestInfo(h),typeof h=="string")continue;let m=nS(h);if(!nZ(m.url)||m.method!=="GET")throw wr.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let h of e){let m=nS(new WU(h));if(!nZ(m.url))throw wr.errors.exception({header:n,message:"Expected http/s scheme."});m.initiator="fetch",m.destination="subresource",i.push(m);let E=w8();o.push(AOn({request:m,processResponse(y){if(y.type==="error"||y.status===206||y.status<200||y.status>299)E.reject(wr.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(y.headersList.contains("vary")){let C=sSe(y.headersList.get("vary"));for(let _ of C)if(_==="*"){E.reject(wr.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let w of o)w.abort();return}}},processResponseEndOfBody(y){if(y.aborted){E.reject(new DOMException("aborted","AbortError"));return}E.resolve(y)}})),r.push(E.promise)}let a=await Promise.all(r),l=[],u=0;for(let h of a){let m={type:"put",request:i[u],response:h};l.push(m),u++}let c=w8(),d=null;try{this.#t(l)}catch(h){d=h}return queueMicrotask(()=>{d===null?c.resolve(void 0):c.reject(d)}),c.promise}async put(e,n){wr.brandCheck(this,t);let r="Cache.put";wr.argumentLengthCheck(arguments,2,r),e=wr.converters.RequestInfo(e,r,"request"),n=wr.converters.Response(n,r,"response");let i=null;if(wr.is.Request(e)?i=nS(e):i=nS(new WU(e)),!nZ(i.url)||i.method!=="GET")throw wr.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let o=hOn(n);if(o.status===206)throw wr.errors.exception({header:r,message:"Got 206 status"});if(o.headersList.contains("vary")){let m=sSe(o.headersList.get("vary"));for(let E of m)if(E==="*")throw wr.errors.exception({header:r,message:"Got * vary field value"})}if(o.body&&(dOn(o.body.stream)||o.body.stream.locked))throw wr.errors.exception({header:r,message:"Response body is locked or disturbed"});let s=fOn(o),a=w8();if(o.body!=null){let E=o.body.stream.getReader();gOn(E,a.resolve,a.reject)}else a.resolve(void 0);let l=[],u={type:"put",request:i,response:s};l.push(u);let c=await a.promise;s.body!=null&&(s.body.source=c);let d=w8(),h=null;try{this.#t(l)}catch(m){h=m}return queueMicrotask(()=>{h===null?d.resolve():d.reject(h)}),d.promise}async delete(e,n={}){wr.brandCheck(this,t);let r="Cache.delete";wr.argumentLengthCheck(arguments,1,r),e=wr.converters.RequestInfo(e,r,"request"),n=wr.converters.CacheQueryOptions(n,r,"options");let i=null;if(wr.is.Request(e)){if(i=nS(e),i.method!=="GET"&&!n.ignoreMethod)return!1}else aSe(typeof e=="string"),i=nS(new WU(e));let o=[],s={type:"delete",request:i,options:n};o.push(s);let a=w8(),l=null,u;try{u=this.#t(o)}catch(c){l=c}return queueMicrotask(()=>{l===null?a.resolve(!!u?.length):a.reject(l)}),a.promise}async keys(e=void 0,n={}){wr.brandCheck(this,t);let r="Cache.keys";e!==void 0&&(e=wr.converters.RequestInfo(e,r,"request")),n=wr.converters.CacheQueryOptions(n,r,"options");let i=null;if(e!==void 0)if(wr.is.Request(e)){if(i=nS(e),i.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(i=nS(new WU(e)));let o=w8(),s=[];if(e===void 0)for(let a of this.#e)s.push(a[0]);else{let a=this.#n(i,n);for(let l of a)s.push(l[0])}return queueMicrotask(()=>{let a=[];for(let l of s){let u=mOn(l,void 0,new AbortController().signal,"immutable");a.push(u)}o.resolve(Object.freeze(a))}),o.promise}#t(e){let n=this.#e,r=[...n],i=[],o=[];try{for(let s of e){if(s.type!=="delete"&&s.type!=="put")throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#n(s.request,s.options,i).length)throw new DOMException("???","InvalidStateError");let a;if(s.type==="delete"){if(a=this.#n(s.request,s.options),a.length===0)return[];for(let l of a){let u=n.indexOf(l);aSe(u!==-1),n.splice(u,1)}}else if(s.type==="put"){if(s.response==null)throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let l=s.request;if(!nZ(l.url))throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(l.method!=="GET")throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw wr.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});a=this.#n(s.request);for(let u of a){let c=n.indexOf(u);aSe(c!==-1),n.splice(c,1)}n.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=r,s}}#n(e,n,r){let i=[],o=r??this.#e;for(let s of o){let[a,l]=s;this.#r(e,a,l,n)&&i.push(s)}return i}#r(e,n,r=null,i){let o=new URL(e.url),s=new URL(n.url);if(i?.ignoreSearch&&(s.search="",o.search=""),!cOn(o,s,!0))return!1;if(r==null||i?.ignoreVary||!r.headersList.contains("vary"))return!0;let a=sSe(r.headersList.get("vary"));for(let l of a){if(l==="*")return!1;let u=n.headersList.get(l),c=e.headersList.get(l);if(u!==c)return!1}return!0}#o(e,n,r=1/0){let i=null;if(e!==void 0)if(wr.is.Request(e)){if(i=nS(e),i.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(i=nS(new WU(e)));let o=[];if(e===void 0)for(let a of this.#e)o.push(a[1]);else{let a=this.#n(i,n);for(let l of a)o.push(l[1])}let s=[];for(let a of o){let l=pOn(a,"immutable");if(s.push(l.clone()),s.length>=r)break}return Object.freeze(s)}};Object.defineProperties(rZ.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:mN,matchAll:mN,add:mN,addAll:mN,put:mN,delete:mN,keys:mN});var Dot=[{key:"ignoreSearch",converter:wr.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:wr.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:wr.converters.boolean,defaultValue:()=>!1}];wr.converters.CacheQueryOptions=wr.dictionaryConverter(Dot);wr.converters.MultiCacheQueryOptions=wr.dictionaryConverter([...Dot,{key:"cacheName",converter:wr.converters.DOMString}]);wr.converters.Response=wr.interfaceConverter(wr.is.Response,"Response");wr.converters["sequence<RequestInfo>"]=wr.sequenceConverter(wr.converters.RequestInfo);Sot.exports={Cache:rZ}});var Tot=b((IJr,Iot)=>{"use strict";var{Cache:iZ}=_ot(),{webidl:Nh}=Gp(),{kEnumerableProperty:zU}=oo(),{kConstruct:JU}=rl(),oZ=class t{#e=new Map;constructor(){arguments[0]!==JU&&Nh.illegalConstructor(),Nh.util.markAsUncloneable(this)}async match(e,n={}){if(Nh.brandCheck(this,t),Nh.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=Nh.converters.RequestInfo(e),n=Nh.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let r=this.#e.get(n.cacheName);return await new iZ(JU,r).match(e,n)}}else for(let r of this.#e.values()){let o=await new iZ(JU,r).match(e,n);if(o!==void 0)return o}}async has(e){Nh.brandCheck(this,t);let n="CacheStorage.has";return Nh.argumentLengthCheck(arguments,1,n),e=Nh.converters.DOMString(e,n,"cacheName"),this.#e.has(e)}async open(e){Nh.brandCheck(this,t);let n="CacheStorage.open";if(Nh.argumentLengthCheck(arguments,1,n),e=Nh.converters.DOMString(e,n,"cacheName"),this.#e.has(e)){let i=this.#e.get(e);return new iZ(JU,i)}let r=[];return this.#e.set(e,r),new iZ(JU,r)}async delete(e){Nh.brandCheck(this,t);let n="CacheStorage.delete";return Nh.argumentLengthCheck(arguments,1,n),e=Nh.converters.DOMString(e,n,"cacheName"),this.#e.delete(e)}async keys(){return Nh.brandCheck(this,t),[...this.#e.keys()]}};Object.defineProperties(oZ.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:zU,has:zU,open:zU,delete:zU,keys:zU});Iot.exports={CacheStorage:oZ}});var xot=b((TJr,bot)=>{"use strict";bot.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var lSe=b((bJr,Oot)=>{"use strict";function EOn(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}function wot(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}function Rot(t){let e=t.length,n=0;if(t[0]==='"'){if(e===1||t[e-1]!=='"')throw new Error("Invalid cookie value");--e,++n}for(;n<e;){let r=t.charCodeAt(n++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}function Bot(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<32||n===127||n===59)throw new Error("Invalid cookie path")}}function yOn(t){if(t.startsWith("-")||t.endsWith(".")||t.endsWith("-"))throw new Error("Invalid cookie domain")}var COn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],vOn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sZ=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function Not(t){return typeof t=="number"&&(t=new Date(t)),`${COn[t.getUTCDay()]}, ${sZ[t.getUTCDate()]} ${vOn[t.getUTCMonth()]} ${t.getUTCFullYear()} ${sZ[t.getUTCHours()]}:${sZ[t.getUTCMinutes()]}:${sZ[t.getUTCSeconds()]} GMT`}function DOn(t){if(t<0)throw new Error("Invalid cookie max-age")}function SOn(t){if(t.name.length===0)return null;wot(t.name),Rot(t.value);let e=[`${t.name}=${t.value}`];t.name.startsWith("__Secure-")&&(t.secure=!0),t.name.startsWith("__Host-")&&(t.secure=!0,t.domain=null,t.path="/"),t.secure&&e.push("Secure"),t.httpOnly&&e.push("HttpOnly"),typeof t.maxAge=="number"&&(DOn(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(yOn(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(Bot(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${Not(t.expires)}`),t.sameSite&&e.push(`SameSite=${t.sameSite}`);for(let n of t.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[r,...i]=n.split("=");e.push(`${r.trim()}=${i.join("=")}`)}return e.join("; ")}Oot.exports={isCTLExcludingHtab:EOn,validateCookieName:wot,validateCookiePath:Bot,validateCookieValue:Rot,toIMFDate:Not,stringify:SOn}});var Fot=b((xJr,Mot)=>{"use strict";var{maxNameValuePairSize:_On,maxAttributeValueSize:IOn}=xot(),{isCTLExcludingHtab:TOn}=lSe(),{collectASequenceOfCodePointsFast:aZ}=C0(),bOn=we("node:assert"),{unescape:xOn}=we("node:querystring");function wOn(t){if(TOn(t))return null;let e="",n="",r="",i="";if(t.includes(";")){let o={position:0};e=aZ(";",t,o),n=t.slice(o.position)}else e=t;if(!e.includes("="))i=e;else{let o={position:0};r=aZ("=",e,o),i=e.slice(o.position+1)}return r=r.trim(),i=i.trim(),r.length+i.length>_On?null:{name:r,value:xOn(i),...R8(n)}}function R8(t,e={}){if(t.length===0)return e;bOn(t[0]===";"),t=t.slice(1);let n="";t.includes(";")?(n=aZ(";",t,{position:0}),t=t.slice(n.length)):(n=t,t="");let r="",i="";if(n.includes("=")){let s={position:0};r=aZ("=",n,s),i=n.slice(s.position+1)}else r=n;if(r=r.trim(),i=i.trim(),i.length>IOn)return R8(t,e);let o=r.toLowerCase();if(o==="expires"){let s=new Date(i);e.expires=s}else if(o==="max-age"){let s=i.charCodeAt(0);if((s<48||s>57)&&i[0]!=="-"||!/^\d+$/.test(i))return R8(t,e);let a=Number(i);e.maxAge=a}else if(o==="domain"){let s=i;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),e.domain=s}else if(o==="path"){let s="";i.length===0||i[0]!=="/"?s="/":s=i,e.path=s}else if(o==="secure")e.secure=!0;else if(o==="httponly")e.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"),e.sameSite=s}else e.unparsed??=[],e.unparsed.push(`${r}=${i}`);return R8(t,e)}Mot.exports={parseSetCookie:wOn,parseUnparsedAttributes:R8}});var kot=b((wJr,Qot)=>{"use strict";var{parseSetCookie:Lot}=Fot(),{stringify:ROn}=lSe(),{webidl:Rs}=Gp(),{Headers:BOn}=dN(),lZ=Rs.brandCheckMultiple([BOn,globalThis.Headers].filter(Boolean));function NOn(t){Rs.argumentLengthCheck(arguments,1,"getCookies"),lZ(t);let e=t.get("cookie"),n={};if(!e)return n;for(let r of e.split(";")){let[i,...o]=r.split("=");n[i.trim()]=o.join("=")}return n}function OOn(t,e,n){lZ(t);let r="deleteCookie";Rs.argumentLengthCheck(arguments,2,r),e=Rs.converters.DOMString(e,r,"name"),n=Rs.converters.DeleteCookieAttributes(n),Pot(t,{name:e,value:"",expires:new Date(0),...n})}function MOn(t){Rs.argumentLengthCheck(arguments,1,"getSetCookies"),lZ(t);let e=t.getSetCookie();return e?e.map(n=>Lot(n)):[]}function FOn(t){return t=Rs.converters.DOMString(t),Lot(t)}function Pot(t,e){Rs.argumentLengthCheck(arguments,2,"setCookie"),lZ(t),e=Rs.converters.Cookie(e);let n=ROn(e);n&&t.append("set-cookie",n,!0)}Rs.converters.DeleteCookieAttributes=Rs.dictionaryConverter([{converter:Rs.nullableConverter(Rs.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters.DOMString),key:"domain",defaultValue:()=>null}]);Rs.converters.Cookie=Rs.dictionaryConverter([{converter:Rs.converters.DOMString,key:"name"},{converter:Rs.converters.DOMString,key:"value"},{converter:Rs.nullableConverter(t=>typeof t=="number"?Rs.converters["unsigned long long"](t):new Date(t)),key:"expires",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters.boolean),key:"secure",defaultValue:()=>null},{converter:Rs.nullableConverter(Rs.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:Rs.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:Rs.sequenceConverter(Rs.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);Qot.exports={getCookies:NOn,deleteCookie:OOn,getSetCookies:MOn,setCookie:Pot,parseCookie:FOn}});var dZ=b((RJr,Got)=>{"use strict";var{webidl:$r}=Gp(),{kEnumerableProperty:ig}=oo(),{kConstruct:Uot}=rl(),B8=class t extends Event{#e;constructor(e,n={}){if(e===Uot){super(arguments[1],arguments[2]),$r.util.markAsUncloneable(this);return}let r="MessageEvent constructor";$r.argumentLengthCheck(arguments,1,r),e=$r.converters.DOMString(e,r,"type"),n=$r.converters.MessageEventInit(n,r,"eventInitDict"),super(e,n),this.#e=n,$r.util.markAsUncloneable(this)}get data(){return $r.brandCheck(this,t),this.#e.data}get origin(){return $r.brandCheck(this,t),this.#e.origin}get lastEventId(){return $r.brandCheck(this,t),this.#e.lastEventId}get source(){return $r.brandCheck(this,t),this.#e.source}get ports(){return $r.brandCheck(this,t),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,n=!1,r=!1,i=null,o="",s="",a=null,l=[]){return $r.brandCheck(this,t),$r.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new t(e,{bubbles:n,cancelable:r,data:i,origin:o,lastEventId:s,source:a,ports:l})}static createFastMessageEvent(e,n){let r=new t(Uot,e,n);return r.#e=n,r.#e.data??=null,r.#e.origin??="",r.#e.lastEventId??="",r.#e.source??=null,r.#e.ports??=[],r}},{createFastMessageEvent:LOn}=B8;delete B8.createFastMessageEvent;var uZ=class t extends Event{#e;constructor(e,n={}){let r="CloseEvent constructor";$r.argumentLengthCheck(arguments,1,r),e=$r.converters.DOMString(e,r,"type"),n=$r.converters.CloseEventInit(n),super(e,n),this.#e=n,$r.util.markAsUncloneable(this)}get wasClean(){return $r.brandCheck(this,t),this.#e.wasClean}get code(){return $r.brandCheck(this,t),this.#e.code}get reason(){return $r.brandCheck(this,t),this.#e.reason}},cZ=class t extends Event{#e;constructor(e,n){let r="ErrorEvent constructor";$r.argumentLengthCheck(arguments,1,r),super(e,n),$r.util.markAsUncloneable(this),e=$r.converters.DOMString(e,r,"type"),n=$r.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return $r.brandCheck(this,t),this.#e.message}get filename(){return $r.brandCheck(this,t),this.#e.filename}get lineno(){return $r.brandCheck(this,t),this.#e.lineno}get colno(){return $r.brandCheck(this,t),this.#e.colno}get error(){return $r.brandCheck(this,t),this.#e.error}};Object.defineProperties(B8.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:ig,origin:ig,lastEventId:ig,source:ig,ports:ig,initMessageEvent:ig});Object.defineProperties(uZ.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:ig,code:ig,wasClean:ig});Object.defineProperties(cZ.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:ig,filename:ig,lineno:ig,colno:ig,error:ig});$r.converters.MessagePort=$r.interfaceConverter($r.is.MessagePort,"MessagePort");$r.converters["sequence<MessagePort>"]=$r.sequenceConverter($r.converters.MessagePort);var uSe=[{key:"bubbles",converter:$r.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:$r.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:$r.converters.boolean,defaultValue:()=>!1}];$r.converters.MessageEventInit=$r.dictionaryConverter([...uSe,{key:"data",converter:$r.converters.any,defaultValue:()=>null},{key:"origin",converter:$r.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:$r.converters.DOMString,defaultValue:()=>""},{key:"source",converter:$r.nullableConverter($r.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:$r.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);$r.converters.CloseEventInit=$r.dictionaryConverter([...uSe,{key:"wasClean",converter:$r.converters.boolean,defaultValue:()=>!1},{key:"code",converter:$r.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:$r.converters.USVString,defaultValue:()=>""}]);$r.converters.ErrorEventInit=$r.dictionaryConverter([...uSe,{key:"message",converter:$r.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:$r.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:$r.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:$r.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:$r.converters.any}]);Got.exports={MessageEvent:B8,CloseEvent:uZ,ErrorEvent:cZ,createFastMessageEvent:LOn}});var ix=b((BJr,Hot)=>{"use strict";var POn="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",QOn={enumerable:!0,writable:!1,configurable:!1},kOn={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},UOn={SENT:1,RECEIVED:2},GOn={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},HOn=65535,qOn={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},VOn=Buffer.allocUnsafe(0),$On={text:1,typedArray:2,arrayBuffer:3,blob:4};Hot.exports={uid:POn,sentCloseFrameState:UOn,staticPropertyDescriptors:QOn,states:kOn,opcodes:GOn,maxUnsigned16Bit:HOn,parserStates:qOn,emptyBuffer:VOn,sendHints:$On}});var AN=b((NJr,jot)=>{"use strict";var{states:fZ,opcodes:N8}=ix(),{isUtf8:YOn}=we("node:buffer"),{collectASequenceOfCodePointsFast:jOn,removeHTTPWhitespace:qot}=C0();function WOn(t){return t===fZ.CONNECTING}function zOn(t){return t===fZ.OPEN}function JOn(t){return t===fZ.CLOSING}function KOn(t){return t===fZ.CLOSED}function XOn(t,e,n=(i,o)=>new Event(i,o),r={}){let i=n(t,r);e.dispatchEvent(i)}function ZOn(t,e,n){t.onMessage(e,n)}function eMn(t){return t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function tMn(t){if(t.length===0)return!1;for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}function nMn(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}function Vot(t){return t===N8.CLOSE||t===N8.PING||t===N8.PONG}function $ot(t){return t===N8.CONTINUATION}function Yot(t){return t===N8.TEXT||t===N8.BINARY}function rMn(t){return Yot(t)||$ot(t)||Vot(t)}function iMn(t){let e={position:0},n=new Map;for(;e.position<t.length;){let r=jOn(";",t,e),[i,o=""]=r.split("=",2);n.set(qot(i,!0,!1),qot(o,!1,!0)),e.position++}return n}function oMn(t){for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n<48||n>57)return!1}return!0}function sMn(t,e){let n;try{n=new URL(t,e)}catch(r){throw new DOMException(r,"SyntaxError")}if(n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),n.protocol!=="ws:"&&n.protocol!=="wss:")throw new DOMException("expected a ws: or wss: url","SyntaxError");if(n.hash.length||n.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return n}function aMn(t,e){if(t!==null&&t!==1e3&&(t<3e3||t>4999))throw new DOMException("invalid code","InvalidAccessError");if(e!==null){let n=Buffer.byteLength(e);if(n>123)throw new DOMException(`Reason must be less than 123 bytes; received ${n}`,"SyntaxError")}}var lMn=(()=>{if(typeof process.versions.icu=="string"){let t=new TextDecoder("utf-8",{fatal:!0});return t.decode.bind(t)}return function(t){if(YOn(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();jot.exports={isConnecting:WOn,isEstablished:zOn,isClosing:JOn,isClosed:KOn,fireEvent:XOn,isValidSubprotocol:tMn,isValidStatusCode:nMn,websocketMessageReceived:ZOn,utf8Decode:lMn,isControlFrame:Vot,isContinuationFrame:$ot,isTextBinaryFrame:Yot,isValidOpcode:rMn,parseExtensions:iMn,isValidClientWindowBits:oMn,toArrayBuffer:eMn,getURLRecord:sMn,validateCloseCodeAndReason:aMn}});var XU=b((OJr,Jot)=>{"use strict";var{maxUnsigned16Bit:Wot,opcodes:uMn}=ix(),pZ=8*1024,cSe,KU=null,O8=pZ;try{cSe=we("node:crypto")}catch{cSe={randomFillSync:function(e,n,r){for(let i=0;i<e.length;++i)e[i]=Math.random()*255|0;return e}}}function zot(){return O8===pZ&&(O8=0,cSe.randomFillSync(KU??=Buffer.allocUnsafeSlow(pZ),0,pZ)),[KU[O8++],KU[O8++],KU[O8++],KU[O8++]]}var dSe=class{constructor(e){this.frameData=e}createFrame(e){let n=this.frameData,r=zot(),i=n?.byteLength??0,o=i,s=6;i>Wot?(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)+e;a[s-4]=r[0],a[s-3]=r[1],a[s-2]=r[2],a[s-1]=r[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 l=0;l<i;++l)a[s+l]=n[l]^r[l&3];return a}static createFastTextFrame(e){let n=zot(),r=e.length;for(let a=0;a<r;++a)e[a]^=n[a&3];let i=r,o=6;r>Wot?(o+=8,i=127):r>125&&(o+=2,i=126);let s=Buffer.allocUnsafeSlow(o);return s[0]=128|uMn.TEXT,s[1]=i|128,s[o-4]=n[0],s[o-3]=n[1],s[o-2]=n[2],s[o-1]=n[3],i===126?s.writeUInt16BE(r,2):i===127&&(s[2]=s[3]=0,s.writeUIntBE(r,4,6)),[s,e]}};Jot.exports={WebsocketFrameSend:dSe}});var mZ=b((MJr,tst)=>{"use strict";var{uid:cMn,states:hZ,sentCloseFrameState:fSe,emptyBuffer:Kot,opcodes:dMn}=ix(),{parseExtensions:fMn,isClosed:pMn,isClosing:hMn,isEstablished:Zot,validateCloseCodeAndReason:mMn}=AN(),{channels:Xot}=zI(),{makeRequest:AMn}=x8(),{fetching:gMn}=jU(),{Headers:EMn,getHeadersList:yMn}=dN(),{getDecodeSplit:CMn}=jm(),{WebsocketFrameSend:vMn}=XU(),DMn=we("node:assert"),pSe;try{pSe=we("node:crypto")}catch{}function SMn(t,e,n,r,i){let o=t;o.protocol=t.protocol==="ws:"?"http:":"https:";let s=AMn({urlList:[o],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let c=yMn(new EMn(i.headers));s.headersList=c}let a=pSe.randomBytes(16).toString("base64");s.headersList.append("sec-websocket-key",a,!0),s.headersList.append("sec-websocket-version","13",!0);for(let c of e)s.headersList.append("sec-websocket-protocol",c,!0);return s.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),gMn({request:s,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(c){if(c.type==="error"&&(r.readyState=hZ.CLOSED),c.type==="error"||c.status!==101){s2(r,1002,"Received network error or non-101 status code.");return}if(e.length!==0&&!c.headersList.get("Sec-WebSocket-Protocol")){s2(r,1002,"Server did not respond with sent protocols.");return}if(c.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){s2(r,1002,'Server did not set Upgrade header to "websocket".');return}if(c.headersList.get("Connection")?.toLowerCase()!=="upgrade"){s2(r,1002,'Server did not set Connection header to "upgrade".');return}let d=c.headersList.get("Sec-WebSocket-Accept"),h=pSe.createHash("sha1").update(a+cMn).digest("base64");if(d!==h){s2(r,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let m=c.headersList.get("Sec-WebSocket-Extensions"),E;if(m!==null&&(E=fMn(m),!E.has("permessage-deflate"))){s2(r,1002,"Sec-WebSocket-Extensions header does not match.");return}let y=c.headersList.get("Sec-WebSocket-Protocol");if(y!==null&&!CMn("sec-websocket-protocol",s.headersList).includes(y)){s2(r,1002,"Protocol was not set in the opening handshake.");return}c.socket.on("data",r.onSocketData),c.socket.on("close",r.onSocketClose),c.socket.on("error",r.onSocketError),Xot.open.hasSubscribers&&Xot.open.publish({address:c.socket.address(),protocol:y,extensions:m}),r.wasEverConnected=!0,r.onConnectionEstablished(c,E)}})}function est(t,e,n,r=!1){if(e??=null,n??="",r&&mMn(e,n),!(pMn(t.readyState)||hMn(t.readyState)))if(!Zot(t.readyState))s2(t),t.readyState=hZ.CLOSING;else if(!t.closeState.has(fSe.SENT)&&!t.closeState.has(fSe.RECEIVED)){let i=new vMn;n.length!==0&&e===null&&(e=1e3),DMn(e===null||Number.isInteger(e)),e===null&&n.length===0?i.frameData=Kot:e!==null&&n===null?(i.frameData=Buffer.allocUnsafe(2),i.frameData.writeUInt16BE(e,0)):e!==null&&n!==null?(i.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(n)),i.frameData.writeUInt16BE(e,0),i.frameData.write(n,2,"utf-8")):i.frameData=Kot,t.socket.write(i.createFrame(dMn.CLOSE)),t.closeState.add(fSe.SENT),t.readyState=hZ.CLOSING}else t.readyState=hZ.CLOSING}function s2(t,e,n){Zot(t.readyState)&&est(t,e,n,!1),t.controller.abort(),t.socket?.destroyed===!1&&t.socket.destroy(),t.onFail(e,n)}tst.exports={establishWebSocketConnection:SMn,failWebsocketConnection:s2,closeWebSocketConnection:est}});var rst=b((FJr,nst)=>{"use strict";var{createInflateRaw:_Mn,Z_DEFAULT_WINDOWBITS:IMn}=we("node:zlib"),{isValidClientWindowBits:TMn}=AN(),bMn=Buffer.from([0,0,255,255]),AZ=Symbol("kBuffer"),gZ=Symbol("kLength"),hSe=class{#e;#t={};constructor(e){this.#t.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=e.get("server_max_window_bits")}decompress(e,n,r){if(!this.#e){let i=IMn;if(this.#t.serverMaxWindowBits){if(!TMn(this.#t.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}i=Number.parseInt(this.#t.serverMaxWindowBits)}this.#e=_Mn({windowBits:i}),this.#e[AZ]=[],this.#e[gZ]=0,this.#e.on("data",o=>{this.#e[AZ].push(o),this.#e[gZ]+=o.length}),this.#e.on("error",o=>{this.#e=null,r(o)})}this.#e.write(e),n&&this.#e.write(bMn),this.#e.flush(()=>{let i=Buffer.concat(this.#e[AZ],this.#e[gZ]);this.#e[AZ].length=0,this.#e[gZ]=0,r(null,i)})}};nst.exports={PerMessageDeflate:hSe}});var gSe=b((LJr,lst)=>{"use strict";var{Writable:xMn}=we("node:stream"),wMn=we("node:assert"),{parserStates:og,opcodes:M8,states:RMn,emptyBuffer:ist,sentCloseFrameState:ZU}=ix(),{channels:EZ}=zI(),{isValidStatusCode:BMn,isValidOpcode:NMn,websocketMessageReceived:ost,utf8Decode:OMn,isControlFrame:sst,isTextBinaryFrame:mSe,isContinuationFrame:MMn}=AN(),{failWebsocketConnection:T0}=mZ(),{WebsocketFrameSend:ast}=XU(),{PerMessageDeflate:FMn}=rst(),ASe=class extends xMn{#e=[];#t=0;#n=0;#r=!1;#o=og.INFO;#i={};#u=[];#l;#a;constructor(e,n){super(),this.#a=e,this.#l=n??new Map,this.#l.has("permessage-deflate")&&this.#l.set("permessage-deflate",new FMn(n))}_write(e,n,r){this.#e.push(e),this.#n+=e.length,this.#r=!0,this.run(r)}run(e){for(;this.#r;)if(this.#o===og.INFO){if(this.#n<2)return e();let n=this.consume(2),r=(n[0]&128)!==0,i=n[0]&15,o=(n[1]&128)===128,s=!r&&i!==M8.CONTINUATION,a=n[1]&127,l=n[0]&64,u=n[0]&32,c=n[0]&16;if(!NMn(i))return T0(this.#a,1002,"Invalid opcode received"),e();if(o)return T0(this.#a,1002,"Frame cannot be masked"),e();if(l!==0&&!this.#l.has("permessage-deflate")){T0(this.#a,1002,"Expected RSV1 to be clear.");return}if(u!==0||c!==0){T0(this.#a,1002,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!mSe(i)){T0(this.#a,1002,"Invalid frame type was fragmented.");return}if(mSe(i)&&this.#u.length>0){T0(this.#a,1002,"Expected continuation frame");return}if(this.#i.fragmented&&s){T0(this.#a,1002,"Fragmented frame exceeded 125 bytes.");return}if((a>125||s)&&sst(i)){T0(this.#a,1002,"Control frame either too large or fragmented");return}if(MMn(i)&&this.#u.length===0&&!this.#i.compressed){T0(this.#a,1002,"Unexpected continuation frame");return}a<=125?(this.#i.payloadLength=a,this.#o=og.READ_DATA):a===126?this.#o=og.PAYLOADLENGTH_16:a===127&&(this.#o=og.PAYLOADLENGTH_64),mSe(i)&&(this.#i.binaryType=i,this.#i.compressed=l!==0),this.#i.opcode=i,this.#i.masked=o,this.#i.fin=r,this.#i.fragmented=s}else if(this.#o===og.PAYLOADLENGTH_16){if(this.#n<2)return e();let n=this.consume(2);this.#i.payloadLength=n.readUInt16BE(0),this.#o=og.READ_DATA}else if(this.#o===og.PAYLOADLENGTH_64){if(this.#n<8)return e();let n=this.consume(8),r=n.readUInt32BE(0);if(r>2**31-1){T0(this.#a,1009,"Received payload length > 2^31 bytes.");return}let i=n.readUInt32BE(4);this.#i.payloadLength=(r<<8)+i,this.#o=og.READ_DATA}else if(this.#o===og.READ_DATA){if(this.#n<this.#i.payloadLength)return e();let n=this.consume(this.#i.payloadLength);if(sst(this.#i.opcode))this.#r=this.parseControlFrame(n),this.#o=og.INFO;else if(!this.#i.compressed)this.writeFragments(n),!this.#i.fragmented&&this.#i.fin&&ost(this.#a,this.#i.binaryType,this.consumeFragments()),this.#o=og.INFO;else{this.#l.get("permessage-deflate").decompress(n,this.#i.fin,(r,i)=>{if(r){T0(this.#a,1007,r.message);return}if(this.writeFragments(i),!this.#i.fin){this.#o=og.INFO,this.#r=!0,this.run(e);return}ost(this.#a,this.#i.binaryType,this.consumeFragments()),this.#r=!0,this.#o=og.INFO,this.run(e)}),this.#r=!1;break}}}consume(e){if(e>this.#n)throw new Error("Called consume() before buffers satiated.");if(e===0)return ist;this.#n-=e;let n=this.#e[0];if(n.length>e)return this.#e[0]=n.subarray(e,n.length),n.subarray(0,e);if(n.length===e)return this.#e.shift();{let r=0,i=Buffer.allocUnsafeSlow(e);for(;r!==e;){let o=this.#e[0],s=o.length;if(s+r===e){i.set(this.#e.shift(),r);break}else if(s+r>e){i.set(o.subarray(0,e-r),r),this.#e[0]=o.subarray(e-r);break}else i.set(this.#e.shift(),r),r+=s}return i}}writeFragments(e){this.#t+=e.length,this.#u.push(e)}consumeFragments(){let e=this.#u;if(e.length===1)return this.#t=0,e.shift();let n=0,r=Buffer.allocUnsafeSlow(this.#t);for(let i=0;i<e.length;++i){let o=e[i];r.set(o,n),n+=o.length}return this.#u=[],this.#t=0,r}parseCloseBody(e){wMn(e.length!==1);let n;if(e.length>=2&&(n=e.readUInt16BE(0)),n!==void 0&&!BMn(n))return{code:1002,reason:"Invalid status code",error:!0};let r=e.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=OMn(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:r,error:!1}}parseControlFrame(e){let{opcode:n,payloadLength:r}=this.#i;if(n===M8.CLOSE){if(r===1)return T0(this.#a,1002,"Received close frame with a 1-byte body."),!1;if(this.#i.closeInfo=this.parseCloseBody(e),this.#i.closeInfo.error){let{code:i,reason:o}=this.#i.closeInfo;return T0(this.#a,i,o),!1}if(!this.#a.closeState.has(ZU.SENT)&&!this.#a.closeState.has(ZU.RECEIVED)){let i=ist;this.#i.closeInfo.code&&(i=Buffer.allocUnsafe(2),i.writeUInt16BE(this.#i.closeInfo.code,0));let o=new ast(i);this.#a.socket.write(o.createFrame(M8.CLOSE)),this.#a.closeState.add(ZU.SENT)}return this.#a.readyState=RMn.CLOSING,this.#a.closeState.add(ZU.RECEIVED),!1}else if(n===M8.PING){if(!this.#a.closeState.has(ZU.RECEIVED)){let i=new ast(e);this.#a.socket.write(i.createFrame(M8.PONG)),EZ.ping.hasSubscribers&&EZ.ping.publish({payload:e})}}else n===M8.PONG&&EZ.pong.hasSubscribers&&EZ.pong.publish({payload:e});return!0}get closingInfo(){return this.#i.closeInfo}};lst.exports={ByteParser:ASe}});var fst=b((PJr,dst)=>{"use strict";var{WebsocketFrameSend:cst}=XU(),{opcodes:ust,sendHints:gN}=ix(),LMn=gve(),ySe=class{#e=new LMn;#t=!1;#n;constructor(e){this.#n=e}add(e,n,r){if(r!==gN.blob){if(this.#t){let o={promise:null,callback:n,frame:ESe(e,r)};this.#e.push(o)}else if(r===gN.text){let{0:o,1:s}=cst.createFastTextFrame(e);this.#n.cork(),this.#n.write(o),this.#n.write(s,n),this.#n.uncork()}else this.#n.write(ESe(e,r),n);return}let i={promise:e.arrayBuffer().then(o=>{i.promise=null,i.frame=ESe(o,r)}),callback:n,frame:null};this.#e.push(i),this.#t||this.#r()}async#r(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let n=e.shift();n.promise!==null&&await n.promise,this.#n.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function ESe(t,e){return new cst(PMn(t,e)).createFrame(e===gN.text?ust.TEXT:ust.BINARY)}function PMn(t,e){switch(e){case gN.text:case gN.typedArray:return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);case gN.arrayBuffer:case gN.blob:return new Uint8Array(t)}}dst.exports={SendQueue:ySe}});var yst=b((QJr,Est)=>{"use strict";var{webidl:Ai}=Gp(),{URLSerializer:QMn}=C0(),{environmentSettingsObject:pst}=jm(),{staticPropertyDescriptors:ox,states:rS,sentCloseFrameState:CSe,sendHints:yZ,opcodes:hst}=ix(),{isConnecting:kMn,isEstablished:UMn,isClosing:GMn,isValidSubprotocol:HMn,fireEvent:eG,utf8Decode:qMn,toArrayBuffer:VMn,getURLRecord:$Mn}=AN(),{establishWebSocketConnection:YMn,closeWebSocketConnection:jMn,failWebsocketConnection:mst}=mZ(),{ByteParser:WMn}=gSe(),{kEnumerableProperty:Dy}=oo(),{getGlobalDispatcher:zMn}=FX(),{types:gst}=we("node:util"),{ErrorEvent:JMn,CloseEvent:Ast,createFastMessageEvent:KMn}=dZ(),{SendQueue:XMn}=fst(),{channels:CZ}=zI(),b0=class t extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#n="";#r="";#o;#i={onConnectionEstablished:(e,n)=>this.#c(e,n),onFail:(e,n)=>this.#s(e,n),onMessage:(e,n)=>this.#p(e,n),onParserError:e=>mst(this.#i,null,e.message),onParserDrain:()=>this.#A(),onSocketData:e=>{this.#a.write(e)||this.#i.socket.pause()},onSocketError:e=>{this.#i.readyState=rS.CLOSING,CZ.socketError.hasSubscribers&&CZ.socketError.publish(e),this.#i.socket.destroy()},onSocketClose:()=>this.#h(),readyState:rS.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#u;#l;#a;constructor(e,n=[]){super(),Ai.util.markAsUncloneable(this);let r="WebSocket constructor";Ai.argumentLengthCheck(arguments,1,r);let i=Ai.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,r,"options");e=Ai.converters.USVString(e),n=i.protocols;let o=pst.settingsObject.baseUrl,s=$Mn(e,o);if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(l=>l.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(l=>HMn(l)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#u=new URL(s.href);let a=pst.settingsObject;this.#i.controller=YMn(s,n,a,this.#i,i),this.#i.readyState=t.CONNECTING,this.#l="blob"}close(e=void 0,n=void 0){Ai.brandCheck(this,t),e!==void 0&&(e=Ai.converters["unsigned short"](e,"WebSocket.close","code",{clamp:!0})),n!==void 0&&(n=Ai.converters.USVString(n)),e??=null,n??="",jMn(this.#i,e,n,!0)}send(e){Ai.brandCheck(this,t);let n="WebSocket.send";if(Ai.argumentLengthCheck(arguments,1,n),e=Ai.converters.WebSocketSendData(e,n,"data"),kMn(this.#i.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!UMn(this.#i.readyState)||GMn(this.#i.readyState)))if(typeof e=="string"){let r=Buffer.from(e);this.#t+=r.byteLength,this.#o.add(r,()=>{this.#t-=r.byteLength},yZ.text)}else gst.isArrayBuffer(e)?(this.#t+=e.byteLength,this.#o.add(e,()=>{this.#t-=e.byteLength},yZ.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#o.add(e,()=>{this.#t-=e.byteLength},yZ.typedArray)):Ai.is.Blob(e)&&(this.#t+=e.size,this.#o.add(e,()=>{this.#t-=e.size},yZ.blob))}get readyState(){return Ai.brandCheck(this,t),this.#i.readyState}get bufferedAmount(){return Ai.brandCheck(this,t),this.#t}get url(){return Ai.brandCheck(this,t),QMn(this.#u)}get extensions(){return Ai.brandCheck(this,t),this.#r}get protocol(){return Ai.brandCheck(this,t),this.#n}get onopen(){return Ai.brandCheck(this,t),this.#e.open}set onopen(e){Ai.brandCheck(this,t),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onerror(){return Ai.brandCheck(this,t),this.#e.error}set onerror(e){Ai.brandCheck(this,t),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}get onclose(){return Ai.brandCheck(this,t),this.#e.close}set onclose(e){Ai.brandCheck(this,t),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof e=="function"?(this.#e.close=e,this.addEventListener("close",e)):this.#e.close=null}get onmessage(){return Ai.brandCheck(this,t),this.#e.message}set onmessage(e){Ai.brandCheck(this,t),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get binaryType(){return Ai.brandCheck(this,t),this.#l}set binaryType(e){Ai.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this.#l="blob":this.#l=e}#c(e,n){this.#i.socket=e.socket;let r=new WMn(this.#i,n);r.on("drain",()=>this.#i.onParserDrain()),r.on("error",s=>this.#i.onParserError(s)),this.#a=r,this.#o=new XMn(e.socket),this.#i.readyState=rS.OPEN;let i=e.headersList.get("sec-websocket-extensions");i!==null&&(this.#r=i);let o=e.headersList.get("sec-websocket-protocol");o!==null&&(this.#n=o),eG("open",this)}#s(e,n){n&&eG("error",this,(r,i)=>new JMn(r,i),{error:new Error(n),message:n}),this.#i.wasEverConnected||(this.#i.readyState=rS.CLOSED,eG("close",this,(r,i)=>new Ast(r,i),{wasClean:!1,code:e,reason:n}))}#p(e,n){if(this.#i.readyState!==rS.OPEN)return;let r;if(e===hst.TEXT)try{r=qMn(n)}catch{mst(this.#i,1007,"Received invalid UTF-8 in text frame.");return}else e===hst.BINARY&&(this.#l==="blob"?r=new Blob([n]):r=VMn(n));eG("message",this,KMn,{origin:this.#u.origin,data:r})}#A(){this.#i.socket.resume()}#h(){let e=this.#i.closeState.has(CSe.SENT)&&this.#i.closeState.has(CSe.RECEIVED),n=1005,r="",i=this.#a.closingInfo;i&&!i.error?(n=i.code??1005,r=i.reason):this.#i.closeState.has(CSe.RECEIVED)||(n=1006),this.#i.readyState=rS.CLOSED,eG("close",this,(o,s)=>new Ast(o,s),{wasClean:e,code:n,reason:r}),CZ.close.hasSubscribers&&CZ.close.publish({websocket:this,code:n,reason:r})}};b0.CONNECTING=b0.prototype.CONNECTING=rS.CONNECTING;b0.OPEN=b0.prototype.OPEN=rS.OPEN;b0.CLOSING=b0.prototype.CLOSING=rS.CLOSING;b0.CLOSED=b0.prototype.CLOSED=rS.CLOSED;Object.defineProperties(b0.prototype,{CONNECTING:ox,OPEN:ox,CLOSING:ox,CLOSED:ox,url:Dy,readyState:Dy,bufferedAmount:Dy,onopen:Dy,onerror:Dy,onclose:Dy,close:Dy,onmessage:Dy,binaryType:Dy,send:Dy,extensions:Dy,protocol:Dy,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(b0,{CONNECTING:ox,OPEN:ox,CLOSING:ox,CLOSED:ox});Ai.converters["sequence<DOMString>"]=Ai.sequenceConverter(Ai.converters.DOMString);Ai.converters["DOMString or sequence<DOMString>"]=function(t,e,n){return Ai.util.Type(t)===Ai.util.Types.OBJECT&&Symbol.iterator in t?Ai.converters["sequence<DOMString>"](t):Ai.converters.DOMString(t,e,n)};Ai.converters.WebSocketInit=Ai.dictionaryConverter([{key:"protocols",converter:Ai.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:Ai.converters.any,defaultValue:()=>zMn()},{key:"headers",converter:Ai.nullableConverter(Ai.converters.HeadersInit)}]);Ai.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(t){return Ai.util.Type(t)===Ai.util.Types.OBJECT&&!(Symbol.iterator in t)?Ai.converters.WebSocketInit(t):{protocols:Ai.converters["DOMString or sequence<DOMString>"](t)}};Ai.converters.WebSocketSendData=function(t){return Ai.util.Type(t)===Ai.util.Types.OBJECT&&(Ai.is.Blob(t)||ArrayBuffer.isView(t)||gst.isArrayBuffer(t))?t:Ai.converters.USVString(t)};Est.exports={WebSocket:b0}});var vSe=b((kJr,Dst)=>{"use strict";var{webidl:vZ}=Gp(),{validateCloseCodeAndReason:ZMn}=AN(),{kConstruct:Cst}=rl(),{kEnumerableProperty:vst}=oo(),EN=class t extends DOMException{#e;#t;constructor(e="",n=void 0){if(e=vZ.converters.DOMString(e,"WebSocketError","message"),super(e,"WebSocketError"),n===Cst)return;n!==null&&(n=vZ.converters.WebSocketCloseInfo(n));let r=n.closeCode??null,i=n.reason??"";ZMn(r,i),i.length!==0&&r===null&&(r=1e3),this.#e=r,this.#t=i}get closeCode(){return this.#e}get reason(){return this.#t}static createUnvalidatedWebSocketError(e,n,r){let i=new t(e,Cst);return i.#e=n,i.#t=r,i}},{createUnvalidatedWebSocketError:e4n}=EN;delete EN.createUnvalidatedWebSocketError;Object.defineProperties(EN.prototype,{closeCode:vst,reason:vst,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}});vZ.is.WebSocketError=vZ.util.MakeTypeAssertion(EN);Dst.exports={WebSocketError:EN,createUnvalidatedWebSocketError:e4n}});var bst=b((UJr,Tst)=>{"use strict";var{createDeferredPromise:DSe,environmentSettingsObject:Sst}=jm(),{states:F8,opcodes:DZ,sentCloseFrameState:L8}=ix(),{webidl:Oh}=Gp(),{getURLRecord:t4n,isValidSubprotocol:n4n,isEstablished:r4n,utf8Decode:i4n}=AN(),{establishWebSocketConnection:o4n,failWebsocketConnection:SSe,closeWebSocketConnection:_Se}=mZ(),{types:s4n}=we("node:util"),{channels:_st}=zI(),{WebsocketFrameSend:a4n}=XU(),{ByteParser:l4n}=gSe(),{WebSocketError:u4n,createUnvalidatedWebSocketError:c4n}=vSe(),{utf8DecodeBytes:d4n}=jm(),{kEnumerableProperty:SZ}=oo(),Ist=!1,_Z=class{#e;#t;#n;#r;#o;#i;#u=!1;#l={onConnectionEstablished:(e,n)=>this.#s(e,n),onFail:(e,n)=>{},onMessage:(e,n)=>this.#p(e,n),onParserError:e=>SSe(this.#l,null,e.message),onParserDrain:()=>this.#l.socket.resume(),onSocketData:e=>{this.#a.write(e)||this.#l.socket.pause()},onSocketError:e=>{this.#l.readyState=F8.CLOSING,_st.socketError.hasSubscribers&&_st.socketError.publish(e),this.#l.socket.destroy()},onSocketClose:()=>this.#A(),readyState:F8.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#a;constructor(e,n=void 0){Ist||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),Ist=!0),Oh.argumentLengthCheck(arguments,1,"WebSocket"),e=Oh.converters.USVString(e),n!==null&&(n=Oh.converters.WebSocketStreamOptions(n));let r=Sst.settingsObject.baseUrl,i=t4n(e,r),o=n.protocols;if(o.length!==new Set(o.map(a=>a.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(o.length>0&&!o.every(a=>n4n(a)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#e=i.toString(),this.#t=DSe(),this.#n=DSe(),n.signal!=null){let a=n.signal;if(a.aborted){this.#t.reject(a.reason),this.#n.reject(a.reason);return}a.addEventListener("abort",()=>{r4n(this.#l.readyState)||(SSe(this.#l),this.#l.readyState=F8.CLOSING,this.#t.reject(a.reason),this.#n.reject(a.reason),this.#u=!0)},{once:!0})}let s=Sst.settingsObject;this.#l.controller=o4n(i,o,s,this.#l,n)}get url(){return this.#e.toString()}get opened(){return this.#t.promise}get closed(){return this.#n.promise}close(e=void 0){e!==null&&(e=Oh.converters.WebSocketCloseInfo(e));let n=e.closeCode??null,r=e.reason;_Se(this.#l,n,r,!0)}#c(e){let n=DSe(),r=null,i=null;if(ArrayBuffer.isView(e)||s4n.isArrayBuffer(e))r=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e),i=DZ.BINARY;else{let o;try{o=Oh.converters.DOMString(e)}catch(s){n.reject(s);return}r=new TextEncoder().encode(o),i=DZ.TEXT}if(!this.#l.closeState.has(L8.SENT)&&!this.#l.closeState.has(L8.RECEIVED)){let o=new a4n(r);this.#l.socket.write(o.createFrame(i),()=>{n.resolve(void 0)})}return n}#s(e,n){this.#l.socket=e.socket;let r=new l4n(this.#l,n);r.on("drain",()=>this.#l.onParserDrain()),r.on("error",l=>this.#l.onParserError(l)),this.#a=r,this.#l.readyState=F8.OPEN;let i=n??"",o=e.headersList.get("sec-websocket-protocol")??"",s=new ReadableStream({start:l=>{this.#o=l},pull(l){let u;for(;l.desiredSize>0&&(u=e.socket.read())!==null;)l.enqueue(u)},cancel:l=>this.#m(l)}),a=new WritableStream({write:l=>this.#c(l),close:()=>_Se(this.#l,null,null),abort:l=>this.#h(l)});this.#r=s,this.#i=a,this.#t.resolve({extensions:i,protocol:o,readable:s,writable:a})}#p(e,n){if(this.#l.readyState!==F8.OPEN)return;let r;if(e===DZ.TEXT)try{r=i4n(n)}catch{SSe(this.#l,"Received invalid UTF-8 in text frame.");return}else e===DZ.BINARY&&(r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength));this.#o.enqueue(r)}#A(){let e=this.#l.closeState.has(L8.SENT)&&this.#l.closeState.has(L8.RECEIVED);if(this.#l.readyState=F8.CLOSED,this.#u)return;this.#l.wasEverConnected||this.#t.reject(new u4n("Socket never opened"));let n=this.#a.closingInfo,r=n?.code??1005;!this.#l.closeState.has(L8.SENT)&&!this.#l.closeState.has(L8.RECEIVED)&&(r=1006);let i=n?.reason==null?"":d4n(Buffer.from(n.reason));if(e)this.#r.cancel().catch(()=>{}),this.#i.locked||this.#i.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#n.resolve({closeCode:r,reason:i});else{let o=c4n("unclean close",r,i);this.#o.error(o),this.#i.abort(o),this.#n.reject(o)}}#h(e){let n=null,r="";Oh.is.WebSocketError(e)&&(n=e.closeCode,r=e.reason),_Se(this.#l,n,r)}#m(e){this.#h(e)}};Object.defineProperties(_Z.prototype,{url:SZ,opened:SZ,closed:SZ,close:SZ,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}});Oh.converters.WebSocketStreamOptions=Oh.dictionaryConverter([{key:"protocols",converter:Oh.sequenceConverter(Oh.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:Oh.nullableConverter(Oh.converters.AbortSignal),defaultValue:()=>null}]);Oh.converters.WebSocketCloseInfo=Oh.dictionaryConverter([{key:"closeCode",converter:t=>Oh.converters["unsigned short"](t,{enforceRange:!0})},{key:"reason",converter:Oh.converters.USVString,defaultValue:()=>""}]);Tst.exports={WebSocketStream:_Z}});var ISe=b((GJr,xst)=>{"use strict";function f4n(t){return t.indexOf("\0")===-1}function p4n(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(t.charCodeAt(e)<48||t.charCodeAt(e)>57)return!1;return!0}function h4n(t){return new Promise(e=>{setTimeout(e,t).unref()})}xst.exports={isValidLastEventId:f4n,isASCIINumber:p4n,delay:h4n}});var Nst=b((HJr,Bst)=>{"use strict";var{Transform:m4n}=we("node:stream"),{isASCIINumber:wst,isValidLastEventId:Rst}=ISe(),a2=[239,187,191],TSe=10,IZ=13,A4n=58,g4n=32,bSe=class extends m4n{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,n,r){if(e.length===0){r();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===a2[0]){r();return}this.checkBOM=!1,r();return;case 2:if(this.buffer[0]===a2[0]&&this.buffer[1]===a2[1]){r();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===a2[0]&&this.buffer[1]===a2[1]&&this.buffer[2]===a2[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,r();return}this.checkBOM=!1;break;default:this.buffer[0]===a2[0]&&this.buffer[1]===a2[1]&&this.buffer[2]===a2[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]===TSe){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===TSe||this.buffer[this.pos]===IZ){this.buffer[this.pos]===IZ&&(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]===TSe||this.buffer[this.pos]===IZ){this.buffer[this.pos]===IZ&&(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++}r()}parseLine(e,n){if(e.length===0)return;let r=e.indexOf(A4n);if(r===0)return;let i="",o="";if(r!==-1){i=e.subarray(0,r).toString("utf8");let s=r+1;e[s]===g4n&&++s,o=e.subarray(s).toString("utf8")}else i=e.toString("utf8"),o="";switch(i){case"data":n[i]===void 0?n[i]=o:n[i]+=`
474
- ${o}`;break;case"retry":wst(o)&&(n[i]=o);break;case"id":Rst(o)&&(n[i]=o);break;case"event":o.length>0&&(n[i]=o);break}}processEvent(e){e.retry&&wst(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&Rst(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};Bst.exports={EventSourceStream:bSe}});var Ust=b((qJr,kst)=>{"use strict";var{pipeline:E4n}=we("node:stream"),{fetching:y4n}=jU(),{makeRequest:C4n}=x8(),{webidl:l2}=Gp(),{EventSourceStream:v4n}=Nst(),{parseMIMEType:D4n}=C0(),{createFastMessageEvent:S4n}=dZ(),{isNetworkError:Ost}=$U(),{delay:_4n}=ISe(),{kEnumerableProperty:yN}=oo(),{environmentSettingsObject:Mst}=jm(),Fst=!1,Lst=3e3,tG=0,Pst=1,nG=2,I4n="anonymous",T4n="use-credentials",P8=class t extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#r=tG;#o=null;#i=null;#u;#l;constructor(e,n={}){super(),l2.util.markAsUncloneable(this);let r="EventSource constructor";l2.argumentLengthCheck(arguments,1,r),Fst||(Fst=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=l2.converters.USVString(e),n=l2.converters.EventSourceInitDict(n,r,"eventSourceInitDict"),this.#u=n.dispatcher,this.#l={lastEventId:"",reconnectionTime:Lst};let i=Mst,o;try{o=new URL(e,i.settingsObject.baseUrl),this.#l.origin=o.origin}catch(l){throw new DOMException(l,"SyntaxError")}this.#t=o.href;let s=I4n;n.withCredentials===!0&&(s=T4n,this.#n=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=Mst.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=C4n(a),this.#a()}get readyState(){return this.#r}get url(){return this.#t}get withCredentials(){return this.#n}#a(){if(this.#r===nG)return;this.#r=tG;let e={request:this.#o,dispatcher:this.#u},n=r=>{Ost(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#c()};e.processResponseEndOfBody=n,e.processResponse=r=>{if(Ost(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#c();return}let i=r.headersList.get("content-type",!0),o=i!==null?D4n(i):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(r.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#r=Pst,this.dispatchEvent(new Event("open")),this.#l.origin=r.urlList[r.urlList.length-1].origin;let a=new v4n({eventSourceSettings:this.#l,push:l=>{this.dispatchEvent(S4n(l.type,l.options))}});E4n(r.body.stream,a,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#i=y4n(e)}async#c(){this.#r!==nG&&(this.#r=tG,this.dispatchEvent(new Event("error")),await _4n(this.#l.reconnectionTime),this.#r===tG&&(this.#l.lastEventId.length&&this.#o.headersList.set("last-event-id",this.#l.lastEventId,!0),this.#a()))}close(){l2.brandCheck(this,t),this.#r!==nG&&(this.#r=nG,this.#i.abort(),this.#o=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}},Qst={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:tG,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:Pst,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:nG,writable:!1}};Object.defineProperties(P8,Qst);Object.defineProperties(P8.prototype,Qst);Object.defineProperties(P8.prototype,{close:yN,onerror:yN,onmessage:yN,onopen:yN,readyState:yN,url:yN,withCredentials:yN});l2.converters.EventSourceInitDict=l2.dictionaryConverter([{key:"withCredentials",converter:l2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:l2.converters.any}]);kst.exports={EventSource:P8,defaultReconnectionTime:Lst}});var xZ=b((VJr,ti)=>{"use strict";var b4n=nN(),Gst=cU(),x4n=p8(),w4n=Qtt(),R4n=h8(),B4n=Fve(),N4n=ant(),O4n=pnt(),M4n=Ant(),Hst=is(),bZ=oo(),{InvalidArgumentError:TZ}=Hst,Q8=Knt(),F4n=fU(),L4n=EDe(),{MockCallHistory:P4n,MockCallHistoryLog:Q4n}=vDe(),k4n=Frt(),U4n=_De(),G4n=iDe(),H4n=CX(),{getGlobalDispatcher:qst,setGlobalDispatcher:q4n}=FX(),V4n=UU(),$4n=BDe();Object.assign(Gst.prototype,Q8);ti.exports.Dispatcher=Gst;ti.exports.Client=b4n;ti.exports.Pool=x4n;ti.exports.BalancedPool=w4n;ti.exports.Agent=R4n;ti.exports.ProxyAgent=B4n;ti.exports.EnvHttpProxyAgent=N4n;ti.exports.RetryAgent=O4n;ti.exports.H2CClient=M4n;ti.exports.RetryHandler=H4n;ti.exports.DecoratorHandler=V4n;ti.exports.RedirectHandler=$4n;ti.exports.interceptors={redirect:jrt(),responseError:zrt(),retry:Krt(),dump:Zrt(),dns:tit(),cache:yit()};ti.exports.cacheStores={MemoryCacheStore:UDe()};var Y4n=Dit();ti.exports.cacheStores.SqliteCacheStore=Y4n;ti.exports.buildConnector=F4n;ti.exports.errors=Hst;ti.exports.util={parseHeaders:bZ.parseHeaders,headerNameToString:bZ.headerNameToString};function rG(t){return(e,n,r)=>{if(typeof n=="function"&&(r=n,n=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new TZ("invalid url");if(n!=null&&typeof n!="object")throw new TZ("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new TZ("invalid opts.path");let s=n.path;n.path.startsWith("/")||(s=`/${s}`),e=new URL(bZ.parseOrigin(e).origin+s)}else n||(n=typeof e=="object"?e:{}),e=bZ.parseURL(e);let{agent:i,dispatcher:o=qst()}=n;if(i)throw new TZ("unsupported opts.agent. Did you mean opts.client?");return t.call(o,{...n,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:n.method||(n.body?"PUT":"GET")},r)}}ti.exports.setGlobalDispatcher=q4n;ti.exports.getGlobalDispatcher=qst;var j4n=jU().fetch;ti.exports.fetch=async function(e,n=void 0){try{return await j4n(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}};ti.exports.Headers=dN().Headers;ti.exports.Response=$U().Response;ti.exports.Request=x8().Request;ti.exports.FormData=zK().FormData;var{setGlobalOrigin:W4n,getGlobalOrigin:z4n}=FCe();ti.exports.setGlobalOrigin=W4n;ti.exports.getGlobalOrigin=z4n;var{CacheStorage:J4n}=Tot(),{kConstruct:K4n}=rl();ti.exports.caches=new J4n(K4n);var{deleteCookie:X4n,getCookies:Z4n,getSetCookies:eFn,setCookie:tFn,parseCookie:nFn}=kot();ti.exports.deleteCookie=X4n;ti.exports.getCookies=Z4n;ti.exports.getSetCookies=eFn;ti.exports.setCookie=tFn;ti.exports.parseCookie=nFn;var{parseMIMEType:rFn,serializeAMimeType:iFn}=C0();ti.exports.parseMIMEType=rFn;ti.exports.serializeAMimeType=iFn;var{CloseEvent:oFn,ErrorEvent:sFn,MessageEvent:aFn}=dZ();ti.exports.WebSocket=yst().WebSocket;ti.exports.CloseEvent=oFn;ti.exports.ErrorEvent=sFn;ti.exports.MessageEvent=aFn;ti.exports.WebSocketStream=bst().WebSocketStream;ti.exports.WebSocketError=vSe().WebSocketError;ti.exports.request=rG(Q8.request);ti.exports.stream=rG(Q8.stream);ti.exports.pipeline=rG(Q8.pipeline);ti.exports.connect=rG(Q8.connect);ti.exports.upgrade=rG(Q8.upgrade);ti.exports.MockClient=L4n;ti.exports.MockCallHistory=P4n;ti.exports.MockCallHistoryLog=Q4n;ti.exports.MockPool=U4n;ti.exports.MockAgent=k4n;ti.exports.mockErrors=G4n;var{EventSource:lFn}=Ust();ti.exports.EventSource=lFn});async function Vst(t,e,n){if(e!==wh)return e;let r=wh,i=Eu,o=`https://generativelanguage.googleapis.com/v1beta/models/${r}:generateContent`,s=JSON.stringify({contents:[{parts:[{text:"test"}]}],generationConfig:{maxOutputTokens:1,temperature:0,topK:1,thinkingConfig:{thinkingBudget:128,includeThoughts:!1}}}),a=new AbortController,l=setTimeout(()=>a.abort(),2e3);try{n&&(0,wZ.setGlobalDispatcher)(new wZ.ProxyAgent(n));let u=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":t},body:s,signal:a.signal});return clearTimeout(l),u.status===429?(console.log(`[INFO] Your configured model (${r}) was temporarily unavailable. Switched to ${i} for this session.`),i):e}catch{return clearTimeout(l),e}}var wZ,$st=Le(()=>{"use strict";wZ=Qe(xZ(),1);SC();});function k8(t){if(!t||typeof t!="string")return 1048576;let e=t.toLowerCase();if(Yst[t])return Yst[t];for(let n of cFn)if(n.pattern.test(e)){for(let[r,i]of Object.entries(n.limits))if(r!=="default"&&e.includes(r))return i;return n.limits.default??n.defaultLimit??1048576}return 1048576}function xSe(t,e=0){if(!t||typeof t!="string")return 8e3;let n=t.toLowerCase(),r=8e3;if(jst[t])r=jst[t];else for(let s of dFn)if(s.pattern.test(n)){for(let[a,l]of Object.entries(s.limits))if(a!=="default"&&n.includes(a)){r=l;break}r===8e3&&(r=s.limits.default??s.defaultLimit??8e3);break}let o=k8(t)-e;return Math.min(r,o)}var uFn,cFn,Yst,dFn,jst,RZ=Le(()=>{"use strict";uFn=1048576,cFn=[{pattern:/kimi/i,limits:{k2:128e3}},{pattern:/claude/i,limits:{},defaultLimit:2e5},{pattern:/deepseek/i,limits:{v3:128e3,default:65e3}},{pattern:/qwen3/i,limits:{coder:2e5,thinking:2e5,instruct:2e5,default:128e3}},{pattern:/qwen/i,limits:{max:1228e3,plus:1228e3}},{pattern:/gpt/i,limits:{"32k":32e3,default:128e3}}],Yst={"gemini-1.5-pro":2097152,"gemini-1.5-flash":1048576,"gemini-2.5-pro-preview-05-06":1048576,"gemini-2.5-pro-preview-06-05":1048576,"gemini-2.5-pro":1048576,"gemini-2.5-flash-preview-05-20":1048576,"gemini-2.5-flash":1048576,"gemini-2.0-flash":1048576,"gemini-2.0-flash-preview-image-generation":32e3},dFn=[{pattern:/kimi/i,limits:{k2:16384,default:8e3}},{pattern:/claude/i,limits:{},defaultLimit:64e3},{pattern:/deepseek|seek/i,limits:{v3:12288,r1:32e3,default:8e3}},{pattern:/qwen3/i,limits:{coder:32e3,default:8192}},{pattern:/qwen/i,limits:{max:8192,plus:8192,default:8e3}},{pattern:/gpt/i,limits:{"32k":4096,default:16384}}],jst={"gemini-1.5-pro":8192,"gemini-1.5-flash":65536,"gemini-2.5-pro-preview-05-06":65536,"gemini-2.5-pro-preview-06-05":65536,"gemini-2.5-pro":65536,"gemini-2.5-flash-preview-05-20":65536,"gemini-2.5-flash":65536,"gemini-2.0-flash":65536,"gemini-2.0-flash-preview-image-generation":8192}});var iS,wSe=Le(()=>{"use strict";iS=class{apiKey;baseUrl;modelName;constructor(e,n,r){this.apiKey=e,this.baseUrl=n,this.modelName=r||""}async generateImageDescription(e,n){if(!this.modelName)throw new Error("No multimodal model specified for image description");let r=this.createImageAnalysisPrompt();try{let o={model:this.baseUrl==="https://apis.iflow.cn/v1"?"qwen-vl-max":this.modelName,messages:[{role:"user",content:[{type:"text",text:r},{type:"image_url",image_url:{url:`data:${n};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},s=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(o)});if(!s.ok){let u=await s.text();throw new Error(`API error! status: ${s.status}, body: ${u} TraceID: ${s.headers.get("eagleeye-traceid")}`)}let a;try{a=await s.json()}catch{throw new Error(`Response format error. TraceID: ${s.headers.get("eagleeye-traceid")}`)}if(a.msg&&a.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let l=a.choices?.[0]?.message?.content;if(!l)throw new Error("No description generated by model");return l.trim()}catch(i){throw new Error(`Image description error: ${i instanceof Error?i.message:String(i)}`)}}createImageAnalysisPrompt(){return`\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u591A\u6A21\u6001AI\u5206\u6790\u4E13\u5BB6\uFF0C\u80FD\u591F\u6DF1\u5EA6\u7406\u89E3\u56FE\u7247\u5185\u5BB9\u5E76\u63D0\u4F9B\u53EF\u7528\u4E8E\u56DE\u7B54\u95EE\u9898\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002\u8BF7\u6309\u4EE5\u4E0B\u7B56\u7565\u5206\u6790\u56FE\u7247\uFF1A
474
+ ${o}`;break;case"retry":wst(o)&&(n[i]=o);break;case"id":Rst(o)&&(n[i]=o);break;case"event":o.length>0&&(n[i]=o);break}}processEvent(e){e.retry&&wst(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&Rst(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};Bst.exports={EventSourceStream:bSe}});var Ust=b((qJr,kst)=>{"use strict";var{pipeline:E4n}=we("node:stream"),{fetching:y4n}=jU(),{makeRequest:C4n}=x8(),{webidl:l2}=Gp(),{EventSourceStream:v4n}=Nst(),{parseMIMEType:D4n}=C0(),{createFastMessageEvent:S4n}=dZ(),{isNetworkError:Ost}=$U(),{delay:_4n}=ISe(),{kEnumerableProperty:yN}=oo(),{environmentSettingsObject:Mst}=jm(),Fst=!1,Lst=3e3,tG=0,Pst=1,nG=2,I4n="anonymous",T4n="use-credentials",P8=class t extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#r=tG;#o=null;#i=null;#u;#l;constructor(e,n={}){super(),l2.util.markAsUncloneable(this);let r="EventSource constructor";l2.argumentLengthCheck(arguments,1,r),Fst||(Fst=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=l2.converters.USVString(e),n=l2.converters.EventSourceInitDict(n,r,"eventSourceInitDict"),this.#u=n.dispatcher,this.#l={lastEventId:"",reconnectionTime:Lst};let i=Mst,o;try{o=new URL(e,i.settingsObject.baseUrl),this.#l.origin=o.origin}catch(l){throw new DOMException(l,"SyntaxError")}this.#t=o.href;let s=I4n;n.withCredentials===!0&&(s=T4n,this.#n=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=Mst.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=C4n(a),this.#a()}get readyState(){return this.#r}get url(){return this.#t}get withCredentials(){return this.#n}#a(){if(this.#r===nG)return;this.#r=tG;let e={request:this.#o,dispatcher:this.#u},n=r=>{Ost(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#c()};e.processResponseEndOfBody=n,e.processResponse=r=>{if(Ost(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#c();return}let i=r.headersList.get("content-type",!0),o=i!==null?D4n(i):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(r.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#r=Pst,this.dispatchEvent(new Event("open")),this.#l.origin=r.urlList[r.urlList.length-1].origin;let a=new v4n({eventSourceSettings:this.#l,push:l=>{this.dispatchEvent(S4n(l.type,l.options))}});E4n(r.body.stream,a,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#i=y4n(e)}async#c(){this.#r!==nG&&(this.#r=tG,this.dispatchEvent(new Event("error")),await _4n(this.#l.reconnectionTime),this.#r===tG&&(this.#l.lastEventId.length&&this.#o.headersList.set("last-event-id",this.#l.lastEventId,!0),this.#a()))}close(){l2.brandCheck(this,t),this.#r!==nG&&(this.#r=nG,this.#i.abort(),this.#o=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}},Qst={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:tG,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:Pst,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:nG,writable:!1}};Object.defineProperties(P8,Qst);Object.defineProperties(P8.prototype,Qst);Object.defineProperties(P8.prototype,{close:yN,onerror:yN,onmessage:yN,onopen:yN,readyState:yN,url:yN,withCredentials:yN});l2.converters.EventSourceInitDict=l2.dictionaryConverter([{key:"withCredentials",converter:l2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:l2.converters.any}]);kst.exports={EventSource:P8,defaultReconnectionTime:Lst}});var xZ=b((VJr,ti)=>{"use strict";var b4n=nN(),Gst=cU(),x4n=p8(),w4n=Qtt(),R4n=h8(),B4n=Fve(),N4n=ant(),O4n=pnt(),M4n=Ant(),Hst=is(),bZ=oo(),{InvalidArgumentError:TZ}=Hst,Q8=Knt(),F4n=fU(),L4n=EDe(),{MockCallHistory:P4n,MockCallHistoryLog:Q4n}=vDe(),k4n=Frt(),U4n=_De(),G4n=iDe(),H4n=CX(),{getGlobalDispatcher:qst,setGlobalDispatcher:q4n}=FX(),V4n=UU(),$4n=BDe();Object.assign(Gst.prototype,Q8);ti.exports.Dispatcher=Gst;ti.exports.Client=b4n;ti.exports.Pool=x4n;ti.exports.BalancedPool=w4n;ti.exports.Agent=R4n;ti.exports.ProxyAgent=B4n;ti.exports.EnvHttpProxyAgent=N4n;ti.exports.RetryAgent=O4n;ti.exports.H2CClient=M4n;ti.exports.RetryHandler=H4n;ti.exports.DecoratorHandler=V4n;ti.exports.RedirectHandler=$4n;ti.exports.interceptors={redirect:jrt(),responseError:zrt(),retry:Krt(),dump:Zrt(),dns:tit(),cache:yit()};ti.exports.cacheStores={MemoryCacheStore:UDe()};var Y4n=Dit();ti.exports.cacheStores.SqliteCacheStore=Y4n;ti.exports.buildConnector=F4n;ti.exports.errors=Hst;ti.exports.util={parseHeaders:bZ.parseHeaders,headerNameToString:bZ.headerNameToString};function rG(t){return(e,n,r)=>{if(typeof n=="function"&&(r=n,n=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new TZ("invalid url");if(n!=null&&typeof n!="object")throw new TZ("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new TZ("invalid opts.path");let s=n.path;n.path.startsWith("/")||(s=`/${s}`),e=new URL(bZ.parseOrigin(e).origin+s)}else n||(n=typeof e=="object"?e:{}),e=bZ.parseURL(e);let{agent:i,dispatcher:o=qst()}=n;if(i)throw new TZ("unsupported opts.agent. Did you mean opts.client?");return t.call(o,{...n,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:n.method||(n.body?"PUT":"GET")},r)}}ti.exports.setGlobalDispatcher=q4n;ti.exports.getGlobalDispatcher=qst;var j4n=jU().fetch;ti.exports.fetch=async function(e,n=void 0){try{return await j4n(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}};ti.exports.Headers=dN().Headers;ti.exports.Response=$U().Response;ti.exports.Request=x8().Request;ti.exports.FormData=zK().FormData;var{setGlobalOrigin:W4n,getGlobalOrigin:z4n}=FCe();ti.exports.setGlobalOrigin=W4n;ti.exports.getGlobalOrigin=z4n;var{CacheStorage:J4n}=Tot(),{kConstruct:K4n}=rl();ti.exports.caches=new J4n(K4n);var{deleteCookie:X4n,getCookies:Z4n,getSetCookies:eFn,setCookie:tFn,parseCookie:nFn}=kot();ti.exports.deleteCookie=X4n;ti.exports.getCookies=Z4n;ti.exports.getSetCookies=eFn;ti.exports.setCookie=tFn;ti.exports.parseCookie=nFn;var{parseMIMEType:rFn,serializeAMimeType:iFn}=C0();ti.exports.parseMIMEType=rFn;ti.exports.serializeAMimeType=iFn;var{CloseEvent:oFn,ErrorEvent:sFn,MessageEvent:aFn}=dZ();ti.exports.WebSocket=yst().WebSocket;ti.exports.CloseEvent=oFn;ti.exports.ErrorEvent=sFn;ti.exports.MessageEvent=aFn;ti.exports.WebSocketStream=bst().WebSocketStream;ti.exports.WebSocketError=vSe().WebSocketError;ti.exports.request=rG(Q8.request);ti.exports.stream=rG(Q8.stream);ti.exports.pipeline=rG(Q8.pipeline);ti.exports.connect=rG(Q8.connect);ti.exports.upgrade=rG(Q8.upgrade);ti.exports.MockClient=L4n;ti.exports.MockCallHistory=P4n;ti.exports.MockCallHistoryLog=Q4n;ti.exports.MockPool=U4n;ti.exports.MockAgent=k4n;ti.exports.mockErrors=G4n;var{EventSource:lFn}=Ust();ti.exports.EventSource=lFn});async function Vst(t,e,n){if(e!==wh)return e;let r=wh,i=Eu,o=`https://generativelanguage.googleapis.com/v1beta/models/${r}:generateContent`,s=JSON.stringify({contents:[{parts:[{text:"test"}]}],generationConfig:{maxOutputTokens:1,temperature:0,topK:1,thinkingConfig:{thinkingBudget:128,includeThoughts:!1}}}),a=new AbortController,l=setTimeout(()=>a.abort(),2e3);try{n&&(0,wZ.setGlobalDispatcher)(new wZ.ProxyAgent(n));let u=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":t},body:s,signal:a.signal});return clearTimeout(l),u.status===429?(console.log(`[INFO] Your configured model (${r}) was temporarily unavailable. Switched to ${i} for this session.`),i):e}catch{return clearTimeout(l),e}}var wZ,$st=Le(()=>{"use strict";wZ=Qe(xZ(),1);SC();});function k8(t){if(!t||typeof t!="string")return 1048576;let e=t.toLowerCase();if(Yst[t])return Yst[t];for(let n of cFn)if(n.pattern.test(e)){for(let[r,i]of Object.entries(n.limits))if(r!=="default"&&e.includes(r))return i;return n.limits.default??n.defaultLimit??1048576}return 1048576}function xSe(t,e=0){if(!t||typeof t!="string")return 8e3;let n=t.toLowerCase(),r=8e3;if(jst[t])r=jst[t];else for(let s of dFn)if(s.pattern.test(n)){for(let[a,l]of Object.entries(s.limits))if(a!=="default"&&n.includes(a)){r=l;break}r===8e3&&(r=s.limits.default??s.defaultLimit??8e3);break}let o=k8(t)-e;return Math.min(r,o)}var uFn,cFn,Yst,dFn,jst,RZ=Le(()=>{"use strict";uFn=1048576,cFn=[{pattern:/kimi/i,limits:{k2:128e3}},{pattern:/glm/i,limits:{},defaultLimit:128e3},{pattern:/claude/i,limits:{},defaultLimit:2e5},{pattern:/deepseek/i,limits:{v3:128e3,default:65e3}},{pattern:/qwen3/i,limits:{coder:2e5,thinking:2e5,instruct:2e5,default:128e3}},{pattern:/qwen/i,limits:{max:1228e3,plus:1228e3}},{pattern:/gpt/i,limits:{"32k":32e3,default:128e3}}],Yst={"gemini-1.5-pro":2097152,"gemini-1.5-flash":1048576,"gemini-2.5-pro-preview-05-06":1048576,"gemini-2.5-pro-preview-06-05":1048576,"gemini-2.5-pro":1048576,"gemini-2.5-flash-preview-05-20":1048576,"gemini-2.5-flash":1048576,"gemini-2.0-flash":1048576,"gemini-2.0-flash-preview-image-generation":32e3},dFn=[{pattern:/kimi/i,limits:{k2:16384,default:8e3}},{pattern:/glm/i,limits:{},defaultLimit:64e3},{pattern:/claude/i,limits:{},defaultLimit:64e3},{pattern:/deepseek|seek/i,limits:{v3:12288,r1:32e3,default:8e3}},{pattern:/qwen3/i,limits:{coder:32e3,default:8192}},{pattern:/qwen/i,limits:{max:8192,plus:8192,default:8e3}},{pattern:/gpt/i,limits:{"32k":4096,default:16384}}],jst={"gemini-1.5-pro":8192,"gemini-1.5-flash":65536,"gemini-2.5-pro-preview-05-06":65536,"gemini-2.5-pro-preview-06-05":65536,"gemini-2.5-pro":65536,"gemini-2.5-flash-preview-05-20":65536,"gemini-2.5-flash":65536,"gemini-2.0-flash":65536,"gemini-2.0-flash-preview-image-generation":8192}});var iS,wSe=Le(()=>{"use strict";iS=class{apiKey;baseUrl;modelName;constructor(e,n,r){this.apiKey=e,this.baseUrl=n,this.modelName=r||""}async generateImageDescription(e,n){if(!this.modelName)throw new Error("No multimodal model specified for image description");let r=this.createImageAnalysisPrompt();try{let o={model:this.baseUrl==="https://apis.iflow.cn/v1"?"qwen-vl-max":this.modelName,messages:[{role:"user",content:[{type:"text",text:r},{type:"image_url",image_url:{url:`data:${n};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},s=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(o)});if(!s.ok){let u=await s.text();throw new Error(`API error! status: ${s.status}, body: ${u} TraceID: ${s.headers.get("eagleeye-traceid")}`)}let a;try{a=await s.json()}catch{throw new Error(`Response format error. TraceID: ${s.headers.get("eagleeye-traceid")}`)}if(a.msg&&a.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let l=a.choices?.[0]?.message?.content;if(!l)throw new Error("No description generated by model");return l.trim()}catch(i){throw new Error(`Image description error: ${i instanceof Error?i.message:String(i)}`)}}createImageAnalysisPrompt(){return`\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u591A\u6A21\u6001AI\u5206\u6790\u4E13\u5BB6\uFF0C\u80FD\u591F\u6DF1\u5EA6\u7406\u89E3\u56FE\u7247\u5185\u5BB9\u5E76\u63D0\u4F9B\u53EF\u7528\u4E8E\u56DE\u7B54\u95EE\u9898\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002\u8BF7\u6309\u4EE5\u4E0B\u7B56\u7565\u5206\u6790\u56FE\u7247\uFF1A
475
475
 
476
476
  **\u6838\u5FC3\u5206\u6790\u539F\u5219\uFF1A**
477
477
  1. **\u4FE1\u606F\u63D0\u53D6\u4F18\u5148**\uFF1A\u91CD\u70B9\u63D0\u53D6\u56FE\u50CF\u4E2D\u7684\u5173\u952E\u4FE1\u606F\uFF0C\u5BF9\u6570\u5B66\u3001\u903B\u8F91\u95EE\u9898\u8FDB\u884C\u5B8C\u6574\u8F6C\u5F55
@@ -541,7 +541,7 @@ ${JSON.stringify(a,null,2)}`),a.usage&&(this.lastUsageMetadata={total_tokens:a.u
541
541
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
542
542
  ${e}
543
543
 
544
- \u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let r=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:n}],temperature:.1,max_tokens:1e3})});if(!r.ok)throw new Error(`QWen API error: ${r.status}`);let o=(await r.json()).choices[0].message.content.trim();return o.startsWith("```json")?o=o.replace(/^```json\s*/,"").replace(/\s*```$/,""):o.startsWith("```")&&(o=o.replace(/^```\s*/,"").replace(/\s*```$/,"")),JSON.parse(o)}catch(r){throw BC(r),console.error("QWen JSON fix failed:",r),r}}extractTextFromRequest(e){let n="";if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of r)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)n+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,l]of Object.entries(s.functionResponse.response))l!=null&&(n+=String(l)+" ")}}return n.trim()}extractTextFromEmbedRequest(e){if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let r of n)if(typeof r=="object"&&r!==null&&"parts"in r&&r.parts){let i=Array.isArray(r.parts)?r.parts:[r.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof r=="string")return r;if(typeof r=="object"&&r!==null&&"text"in r&&r.text)return r.text}}return""}extractSystemInstruction(e){let n="";if(typeof e=="string")n=e;else if(Array.isArray(e)){for(let r of e)typeof r=="object"&&r!==null&&"text"in r&&r.text&&(n+=r.text+" ");n=n.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let r=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of r)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(n+=i.text+" ");n=n.trim()}else"text"in e&&e.text&&(n=e.text);return n}convertToOpenAITools(e){if(!e||e.length===0)return[];let n=[];for(let r of e)if(r.functionDeclarations&&Array.isArray(r.functionDeclarations))for(let i of r.functionDeclarations)n.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return n}convertParameters(e){if(!e)return;let n={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(n[e.type]?e.type=n[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=n[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let r=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=r(a)}return i.items&&(o.items=r(i.items)),i.required&&(o.required=i.required),o};return r(e)}mapFinishReason(e){switch(e){case"stop":return qb.STOP;case"length":return qb.MAX_TOKENS;case"content_filter":return qb.SAFETY;case"tool_calls":return qb.MALFORMED_FUNCTION_CALL;default:return qb.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let n={};if(e.type)switch(e.type){case"STRING":n.type="string";break;case"INTEGER":n.type="integer";break;case"NUMBER":n.type="number";break;case"BOOLEAN":n.type="boolean";break;case"OBJECT":n.type="object";break;case"ARRAY":n.type="array";break;default:n.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(n.description=e.description),e.enum&&(n.enum=e.enum),e.properties){n.properties={};for(let[r,i]of Object.entries(e.properties))n.properties[r]=this.convertSchemaToJsonSchema(i)}return e.items&&(n.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(n.required=e.required),n.type==="object"&&!("additionalProperties"in n)&&(n.additionalProperties=!1),n}}});function DFn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function oS(t){let e=DFn(t),n=`IFLOW_${t}`;if(process.env[n])return process.env[n];let r=`IFLOW_${e}`;if(process.env[r])return process.env[r];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function oG(){return oS("apiKey")}function sG(){return oS("baseUrl")||oS("url")}function aG(){return oS("modelName")||oS("model")}function eat(t){let e=oS(t);if(e===void 0)return;let n=e.toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1}function tat(t){let e=oS(t);if(e===void 0)return;let n=Number(e);return isNaN(n)?void 0:n}function nat(t){let e=oS(t);if(e!==void 0)return e.split(",").map(n=>n.trim()).filter(n=>n.length>0)}function OZ(){return!!(oG()||sG()||aG())}function MSe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],n=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate"],r=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=oS(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=eat(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=tat(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=nat(o);s!==void 0&&(t[o]=s)}),t}function SFn(){return{apiKey:oG(),baseUrl:sG(),model:aG()}}var FSe=Le(()=>{"use strict";});function LSe(t,e,n){let r=process.env.GEMINI_API_KEY,i=process.env.GOOGLE_API_KEY,o=process.env.GOOGLE_CLOUD_PROJECT,s=process.env.GOOGLE_CLOUD_LOCATION,a=oG(),l=sG(),u=aG(),c=n?.apiKey||a,d=n?.baseUrl||l||_Fn[e],h=t.getModel()||u||wh,m={model:h,authType:e,proxy:t?.getProxy(),multimodalModelName:n?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Sn.LOGIN_WITH_GOOGLE||e===Sn.CLOUD_SHELL?m:e===Sn.USE_GEMINI&&r?(m.apiKey=r,m.vertexai=!1,Vst(m.apiKey,m.model,m.proxy),m):e===Sn.USE_VERTEX_AI&&(i||o&&s)?(m.apiKey=i,m.vertexai=!0,m):([...Vf,Sn.OPENAI_COMPATIBLE].includes(e)&&c&&(m.apiKey=c,m.baseUrl=d,m.model=h),m)}async function PSe(t,e,n){let i={headers:{"User-Agent":`iFlowCLI/0.2.1 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Vf,Sn.IDEA_LAB].includes(t.authType)||t.authType===Sn.OPENAI_COMPATIBLE)return new NZ(t);if(t.authType===Sn.LOGIN_WITH_GOOGLE||t.authType===Sn.CLOUD_SHELL)return k1e(i,t.authType,e,n);if([...Vf,Sn.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Sn.USE_GEMINI||t.authType===Sn.USE_VERTEX_AI)return new cK({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Sn,Vf,_Fn,$I=Le(()=>{"use strict";nl();U1e();SC();$st();Zst();FSe();(function(t){t.LOGIN_WITH_GOOGLE="oauth-personal",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Sn||(Sn={}));Vf=[Sn.IFLOW,Sn.IDEA_LAB],_Fn={[Sn.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Sn.IFLOW]:HXe}});var MZ,rat=Le(()=>{"use strict";MZ=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let n=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${n}".`),this.prompts.set(n,{...e,name:n})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,n)=>e.name.localeCompare(n.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let n=[];for(let r of this.prompts.values())r.serverName===e&&n.push(r);return n.sort((r,i)=>r.name.localeCompare(i.name))}}});var Io,Rr,To,fc=Le(()=>{"use strict";Io=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,n,r,i,o,s=!0,a=!1,l=[]){this.name=e,this.displayName=n,this.description=r,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=l}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,n){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Rr||(Rr={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(To||(To={}))});var os,QSe,Gn,sS,lG=Le(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(os||(os={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(QSe||(QSe={}));Gn=os.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sS=t=>{switch(typeof t){case"undefined":return Gn.undefined;case"string":return Gn.string;case"number":return Number.isNaN(t)?Gn.nan:Gn.number;case"boolean":return Gn.boolean;case"function":return Gn.function;case"bigint":return Gn.bigint;case"symbol":return Gn.symbol;case"object":return Array.isArray(t)?Gn.array:t===null?Gn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Gn.promise:typeof Map<"u"&&t instanceof Map?Gn.map:typeof Set<"u"&&t instanceof Set?Gn.set:typeof Date<"u"&&t instanceof Date?Gn.date:Gn.object;default:return Gn.unknown}}});var ln,IFn,sg,FZ=Le(()=>{lG();ln=os.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),IFn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),sg=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let u=s.path[l];l===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(s))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,os.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};sg.create=t=>new sg(t)});var TFn,u2,kSe=Le(()=>{FZ();lG();TFn=(t,e)=>{let n;switch(t.code){case ln.invalid_type:t.received===Gn.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ln.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,os.jsonStringifyReplacer)}`;break;case ln.unrecognized_keys:n=`Unrecognized key(s) in object: ${os.joinValues(t.keys,", ")}`;break;case ln.invalid_union:n="Invalid input";break;case ln.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${os.joinValues(t.options)}`;break;case ln.invalid_enum_value:n=`Invalid enum value. Expected ${os.joinValues(t.options)}, received '${t.received}'`;break;case ln.invalid_arguments:n="Invalid function arguments";break;case ln.invalid_return_type:n="Invalid function return type";break;case ln.invalid_date:n="Invalid date";break;case ln.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:os.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ln.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ln.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ln.custom:n="Invalid input";break;case ln.invalid_intersection_types:n="Intersection results could not be merged";break;case ln.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ln.not_finite:n="Number must be finite";break;default:n=e.defaultError,os.assertNever(t)}return{message:n}},u2=TFn});function bFn(t){iat=t}function H8(){return iat}var iat,LZ=Le(()=>{kSe();iat=u2});function Nn(t,e){let n=H8(),r=uG({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===u2?void 0:u2].filter(i=>!!i)});t.common.issues.push(r)}var uG,xFn,Hp,pi,vN,Mh,PZ,QZ,sx,q8,USe=Le(()=>{LZ();kSe();uG=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=r.filter(u=>!!u).slice().reverse();for(let u of l)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},xFn=[];Hp=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return pi;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return pi;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},pi=Object.freeze({status:"aborted"}),vN=t=>({status:"dirty",value:t}),Mh=t=>({status:"valid",value:t}),PZ=t=>t.status==="aborted",QZ=t=>t.status==="dirty",sx=t=>t.status==="valid",q8=t=>typeof Promise<"u"&&t instanceof Promise});var oat=Le(()=>{});var Dr,sat=Le(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Dr||(Dr={}))});function Co(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}function cat(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function $Fn(t){return new RegExp(`^${cat(t)}$`)}function dat(t){let e=`${uat}T${cat(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function YFn(t,e){return!!((e==="v4"||!e)&&QFn.test(t)||(e==="v6"||!e)&&UFn.test(t))}function jFn(t,e){if(!MFn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function WFn(t,e){return!!((e==="v4"||!e)&&kFn.test(t)||(e==="v6"||!e)&&GFn.test(t))}function zFn(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function V8(t){if(t instanceof ag){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Sy.create(V8(r))}return new ag({...t._def,shape:()=>e})}else return t instanceof f2?new f2({...t._def,type:V8(t.element)}):t instanceof Sy?Sy.create(V8(t.unwrap())):t instanceof lS?lS.create(V8(t.unwrap())):t instanceof aS?aS.create(t.items.map(e=>V8(e))):t}function HSe(t,e){let n=sS(t),r=sS(e);if(t===e)return{valid:!0,data:t};if(n===Gn.object&&r===Gn.object){let i=os.objectKeys(e),o=os.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=HSe(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===Gn.array&&r===Gn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=HSe(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===Gn.date&&r===Gn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function fat(t,e){return new NN({values:t,typeName:Si.ZodEnum,...Co(e)})}function lat(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function pat(t,e={},n){return t?lx.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=lat(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=lat(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):lx.create()}var _y,aat,Po,wFn,RFn,BFn,NFn,OFn,MFn,FFn,LFn,PFn,GSe,QFn,kFn,UFn,GFn,HFn,qFn,uat,VFn,ax,DN,SN,_N,IN,$8,TN,bN,lx,d2,NC,Y8,f2,ag,xN,c2,kZ,wN,aS,UZ,j8,W8,GZ,RN,BN,NN,ON,ux,Iy,Sy,lS,MN,FN,z8,JFn,cG,dG,LN,KFn,Si,XFn,hat,mat,ZFn,e8n,Aat,t8n,n8n,r8n,i8n,o8n,s8n,a8n,l8n,u8n,c8n,d8n,f8n,p8n,h8n,m8n,A8n,g8n,E8n,y8n,C8n,v8n,D8n,S8n,_8n,I8n,T8n,b8n,x8n,w8n,R8n,B8n,N8n,O8n,M8n,gat=Le(()=>{FZ();LZ();sat();USe();lG();_y=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},aat=(t,e)=>{if(sx(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new sg(t.common.issues);return this._error=n,this._error}}};Po=class{get description(){return this._def.description}_getType(e){return sS(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hp,ctx:{common:e.parent.common,data:e.data,parsedType:sS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(q8(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)},i=this._parseSync({data:e,path:r.path,parent:r});return aat(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return sx(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>sx(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(q8(i)?i:Promise.resolve(i));return aat(r,o)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:ln.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Iy({schema:this,typeName:Si.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Sy.create(this,this._def)}nullable(){return lS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return f2.create(this)}promise(){return ux.create(this,this._def)}or(e){return xN.create([this,e],this._def)}and(e){return wN.create(this,e,this._def)}transform(e){return new Iy({...Co(this._def),schema:this,typeName:Si.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new MN({...Co(this._def),innerType:this,defaultValue:n,typeName:Si.ZodDefault})}brand(){return new cG({typeName:Si.ZodBranded,type:this,...Co(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new FN({...Co(this._def),innerType:this,catchValue:n,typeName:Si.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return dG.create(this,e)}readonly(){return LN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wFn=/^c[^\s-]{8,}$/i,RFn=/^[0-9a-z]+$/,BFn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NFn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,OFn=/^[a-z0-9_-]{21}$/i,MFn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FFn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,LFn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,PFn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",QFn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kFn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UFn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,GFn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HFn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qFn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uat="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",VFn=new RegExp(`^${uat}$`);ax=class t extends Po{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gn.string){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.string,received:o.parsedType}),pi}let r=new Hp,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Nn(i,{code:ln.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Nn(i,{code:ln.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")LFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"email",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")GSe||(GSe=new RegExp(PFn,"u")),GSe.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"emoji",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")NFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"uuid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")OFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"nanoid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")wFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cuid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")RFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cuid2",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")BFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"ulid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Nn(i,{validation:"url",code:ln.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"regex",code:ln.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?dat(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?VFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?$Fn(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?FFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"duration",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?YFn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"ip",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?jFn(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"jwt",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?WFn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cidr",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?HFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"base64",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?qFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"base64url",code:ln.invalid_string,message:o.message}),r.dirty()):os.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:ln.invalid_string,...Dr.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Dr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Dr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Dr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Dr.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Dr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Dr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Dr.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Dr.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Dr.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Dr.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Dr.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Dr.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Dr.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Dr.errToObj(n)})}nonempty(e){return this.min(1,Dr.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ax.create=t=>new ax({checks:[],typeName:Si.ZodString,coerce:t?.coerce??!1,...Co(t)});DN=class t extends Po{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Gn.number){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.number,received:o.parsedType}),pi}let r,i=new Hp;for(let o of this._def.checks)o.kind==="int"?os.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?zFn(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_finite,message:o.message}),i.dirty()):os.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Dr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dr.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Dr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dr.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Dr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dr.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&os.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};DN.create=t=>new DN({checks:[],typeName:Si.ZodNumber,coerce:t?.coerce||!1,...Co(t)});SN=class t extends Po{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Gn.bigint)return this._getInvalidInput(e);let r,i=new Hp;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):os.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return Nn(n,{code:ln.invalid_type,expected:Gn.bigint,received:n.parsedType}),pi}gte(e,n){return this.setLimit("min",e,!0,Dr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dr.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dr.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};SN.create=t=>new SN({checks:[],typeName:Si.ZodBigInt,coerce:t?.coerce??!1,...Co(t)});_N=class extends Po{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Gn.boolean){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.boolean,received:r.parsedType}),pi}return Mh(e.data)}};_N.create=t=>new _N({typeName:Si.ZodBoolean,coerce:t?.coerce||!1,...Co(t)});IN=class t extends Po{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gn.date){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.date,received:o.parsedType}),pi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_date}),pi}let r=new Hp,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):os.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Dr.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Dr.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};IN.create=t=>new IN({checks:[],coerce:t?.coerce||!1,typeName:Si.ZodDate,...Co(t)});$8=class extends Po{_parse(e){if(this._getType(e)!==Gn.symbol){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.symbol,received:r.parsedType}),pi}return Mh(e.data)}};$8.create=t=>new $8({typeName:Si.ZodSymbol,...Co(t)});TN=class extends Po{_parse(e){if(this._getType(e)!==Gn.undefined){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.undefined,received:r.parsedType}),pi}return Mh(e.data)}};TN.create=t=>new TN({typeName:Si.ZodUndefined,...Co(t)});bN=class extends Po{_parse(e){if(this._getType(e)!==Gn.null){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.null,received:r.parsedType}),pi}return Mh(e.data)}};bN.create=t=>new bN({typeName:Si.ZodNull,...Co(t)});lx=class extends Po{constructor(){super(...arguments),this._any=!0}_parse(e){return Mh(e.data)}};lx.create=t=>new lx({typeName:Si.ZodAny,...Co(t)});d2=class extends Po{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Mh(e.data)}};d2.create=t=>new d2({typeName:Si.ZodUnknown,...Co(t)});NC=class extends Po{_parse(e){let n=this._getOrReturnCtx(e);return Nn(n,{code:ln.invalid_type,expected:Gn.never,received:n.parsedType}),pi}};NC.create=t=>new NC({typeName:Si.ZodNever,...Co(t)});Y8=class extends Po{_parse(e){if(this._getType(e)!==Gn.undefined){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.void,received:r.parsedType}),pi}return Mh(e.data)}};Y8.create=t=>new Y8({typeName:Si.ZodVoid,...Co(t)});f2=class t extends Po{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Gn.array)return Nn(n,{code:ln.invalid_type,expected:Gn.array,received:n.parsedType}),pi;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(Nn(n,{code:s?ln.too_big:ln.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Nn(n,{code:ln.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Nn(n,{code:ln.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new _y(n,s,n.path,a)))).then(s=>Hp.mergeArray(r,s));let o=[...n.data].map((s,a)=>i.type._parseSync(new _y(n,s,n.path,a)));return Hp.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Dr.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Dr.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Dr.toString(n)}})}nonempty(e){return this.min(1,e)}};f2.create=(t,e)=>new f2({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Si.ZodArray,...Co(e)});ag=class t extends Po{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=os.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Gn.object){let u=this._getOrReturnCtx(e);return Nn(u,{code:ln.invalid_type,expected:Gn.object,received:u.parsedType}),pi}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof NC&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let l=[];for(let u of s){let c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new _y(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof NC){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of a)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")a.length>0&&(Nn(i,{code:ln.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of a){let d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new _y(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let d=await c.key,h=await c.value;u.push({key:d,value:h,alwaysSet:c.alwaysSet})}return u}).then(u=>Hp.mergeObjectSync(r,u)):Hp.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Dr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Dr.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Si.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of os.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of os.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return V8(this)}partial(e){let n={};for(let r of os.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of os.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Sy;)o=o._def.innerType;n[r]=o}return new t({...this._def,shape:()=>n})}keyof(){return fat(os.objectKeys(this.shape))}};ag.create=(t,e)=>new ag({shape:()=>t,unknownKeys:"strip",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});ag.strictCreate=(t,e)=>new ag({shape:()=>t,unknownKeys:"strict",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});ag.lazycreate=(t,e)=>new ag({shape:t,unknownKeys:"strip",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});xN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new sg(a.ctx.common.issues));return Nn(n,{code:ln.invalid_union,unionErrors:s}),pi}if(n.common.async)return Promise.all(r.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of r){let u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new sg(l));return Nn(n,{code:ln.invalid_union,unionErrors:a}),pi}}get options(){return this._def.options}};xN.create=(t,e)=>new xN({options:t,typeName:Si.ZodUnion,...Co(e)});c2=t=>t instanceof RN?c2(t.schema):t instanceof Iy?c2(t.innerType()):t instanceof BN?[t.value]:t instanceof NN?t.options:t instanceof ON?os.objectValues(t.enum):t instanceof MN?c2(t._def.innerType):t instanceof TN?[void 0]:t instanceof bN?[null]:t instanceof Sy?[void 0,...c2(t.unwrap())]:t instanceof lS?[null,...c2(t.unwrap())]:t instanceof cG||t instanceof LN?c2(t.unwrap()):t instanceof FN?c2(t._def.innerType):[],kZ=class t extends Po{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.object)return Nn(n,{code:ln.invalid_type,expected:Gn.object,received:n.parsedType}),pi;let r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Nn(n,{code:ln.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let o of n){let s=c2(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:Si.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Co(r)})}};wN=class extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(PZ(o)||PZ(s))return pi;let a=HSe(o.value,s.value);return a.valid?((QZ(o)||QZ(s))&&n.dirty(),{status:n.value,value:a.data}):(Nn(r,{code:ln.invalid_intersection_types}),pi)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};wN.create=(t,e,n)=>new wN({left:t,right:e,typeName:Si.ZodIntersection,...Co(n)});aS=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.array)return Nn(r,{code:ln.invalid_type,expected:Gn.array,received:r.parsedType}),pi;if(r.data.length<this._def.items.length)return Nn(r,{code:ln.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pi;!this._def.rest&&r.data.length>this._def.items.length&&(Nn(r,{code:ln.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new _y(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Hp.mergeArray(n,s)):Hp.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};aS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new aS({items:t,typeName:Si.ZodTuple,rest:null,...Co(e)})};UZ=class t extends Po{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.object)return Nn(r,{code:ln.invalid_type,expected:Gn.object,received:r.parsedType}),pi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new _y(r,a,r.path,a)),value:s._parse(new _y(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hp.mergeObjectAsync(n,i):Hp.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Po?new t({keyType:e,valueType:n,typeName:Si.ZodRecord,...Co(r)}):new t({keyType:ax.create(),valueType:e,typeName:Si.ZodRecord,...Co(n)})}},j8=class extends Po{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.map)return Nn(r,{code:ln.invalid_type,expected:Gn.map,received:r.parsedType}),pi;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new _y(r,a,r.path,[u,"key"])),value:o._parse(new _y(r,l,r.path,[u,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return pi;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return pi;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}}}};j8.create=(t,e,n)=>new j8({valueType:e,keyType:t,typeName:Si.ZodMap,...Co(n)});W8=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.set)return Nn(r,{code:ln.invalid_type,expected:Gn.set,received:r.parsedType}),pi;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Nn(r,{code:ln.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Nn(r,{code:ln.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let o=this._def.valueType;function s(l){let u=new Set;for(let c of l){if(c.status==="aborted")return pi;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}let a=[...r.data.values()].map((l,u)=>o._parse(new _y(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:Dr.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Dr.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};W8.create=(t,e)=>new W8({valueType:t,minSize:null,maxSize:null,typeName:Si.ZodSet,...Co(e)});GZ=class t extends Po{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.function)return Nn(n,{code:ln.invalid_type,expected:Gn.function,received:n.parsedType}),pi;function r(a,l){return uG({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H8(),u2].filter(u=>!!u),issueData:{code:ln.invalid_arguments,argumentsError:l}})}function i(a,l){return uG({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H8(),u2].filter(u=>!!u),issueData:{code:ln.invalid_return_type,returnTypeError:l}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof ux){let a=this;return Mh(async function(...l){let u=new sg([]),c=await a._def.args.parseAsync(l,o).catch(m=>{throw u.addIssue(r(l,m)),u}),d=await Reflect.apply(s,this,c);return await a._def.returns._def.type.parseAsync(d,o).catch(m=>{throw u.addIssue(i(d,m)),u})})}else{let a=this;return Mh(function(...l){let u=a._def.args.safeParse(l,o);if(!u.success)throw new sg([r(l,u.error)]);let c=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(c,o);if(!d.success)throw new sg([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:aS.create(e).rest(d2.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||aS.create([]).rest(d2.create()),returns:n||d2.create(),typeName:Si.ZodFunction,...Co(r)})}},RN=class extends Po{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};RN.create=(t,e)=>new RN({getter:t,typeName:Si.ZodLazy,...Co(e)});BN=class extends Po{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return Nn(n,{received:n.data,code:ln.invalid_literal,expected:this._def.value}),pi}return{status:"valid",value:e.data}}get value(){return this._def.value}};BN.create=(t,e)=>new BN({value:t,typeName:Si.ZodLiteral,...Co(e)});NN=class t extends Po{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return Nn(n,{expected:os.joinValues(r),received:n.parsedType,code:ln.invalid_type}),pi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return Nn(n,{received:n.data,code:ln.invalid_enum_value,options:r}),pi}return Mh(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};NN.create=fat;ON=class extends Po{_parse(e){let n=os.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Gn.string&&r.parsedType!==Gn.number){let i=os.objectValues(n);return Nn(r,{expected:os.joinValues(i),received:r.parsedType,code:ln.invalid_type}),pi}if(this._cache||(this._cache=new Set(os.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=os.objectValues(n);return Nn(r,{received:r.data,code:ln.invalid_enum_value,options:i}),pi}return Mh(e.data)}get enum(){return this._def.values}};ON.create=(t,e)=>new ON({values:t,typeName:Si.ZodNativeEnum,...Co(e)});ux=class extends Po{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.promise&&n.common.async===!1)return Nn(n,{code:ln.invalid_type,expected:Gn.promise,received:n.parsedType}),pi;let r=n.parsedType===Gn.promise?n.data:Promise.resolve(n.data);return Mh(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ux.create=(t,e)=>new ux({type:t,typeName:Si.ZodPromise,...Co(e)});Iy=class extends Po{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Nn(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return pi;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?pi:l.status==="dirty"?vN(l.value):n.value==="dirty"?vN(l.value):l});{if(n.value==="aborted")return pi;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?pi:a.status==="dirty"?vN(a.value):n.value==="dirty"?vN(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pi:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?pi:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sx(s))return pi;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>sx(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):pi);os.assertNever(i)}};Iy.create=(t,e,n)=>new Iy({schema:t,typeName:Si.ZodEffects,effect:e,...Co(n)});Iy.createWithPreprocess=(t,e,n)=>new Iy({schema:e,effect:{type:"preprocess",transform:t},typeName:Si.ZodEffects,...Co(n)});Sy=class extends Po{_parse(e){return this._getType(e)===Gn.undefined?Mh(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sy.create=(t,e)=>new Sy({innerType:t,typeName:Si.ZodOptional,...Co(e)});lS=class extends Po{_parse(e){return this._getType(e)===Gn.null?Mh(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lS.create=(t,e)=>new lS({innerType:t,typeName:Si.ZodNullable,...Co(e)});MN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===Gn.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};MN.create=(t,e)=>new MN({innerType:t,typeName:Si.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Co(e)});FN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return q8(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new sg(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new sg(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};FN.create=(t,e)=>new FN({innerType:t,typeName:Si.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Co(e)});z8=class extends Po{_parse(e){if(this._getType(e)!==Gn.nan){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.nan,received:r.parsedType}),pi}return{status:"valid",value:e.data}}};z8.create=t=>new z8({typeName:Si.ZodNaN,...Co(t)});JFn=Symbol("zod_brand"),cG=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},dG=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pi:o.status==="dirty"?(n.dirty(),vN(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?pi:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Si.ZodPipeline})}},LN=class extends Po{_parse(e){let n=this._def.innerType._parse(e),r=i=>(sx(i)&&(i.value=Object.freeze(i.value)),i);return q8(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};LN.create=(t,e)=>new LN({innerType:t,typeName:Si.ZodReadonly,...Co(e)});KFn={object:ag.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Si||(Si={}));XFn=(t,e={message:`Input not instance of ${t.name}`})=>pat(n=>n instanceof t,e),hat=ax.create,mat=DN.create,ZFn=z8.create,e8n=SN.create,Aat=_N.create,t8n=IN.create,n8n=$8.create,r8n=TN.create,i8n=bN.create,o8n=lx.create,s8n=d2.create,a8n=NC.create,l8n=Y8.create,u8n=f2.create,c8n=ag.create,d8n=ag.strictCreate,f8n=xN.create,p8n=kZ.create,h8n=wN.create,m8n=aS.create,A8n=UZ.create,g8n=j8.create,E8n=W8.create,y8n=GZ.create,C8n=RN.create,v8n=BN.create,D8n=NN.create,S8n=ON.create,_8n=ux.create,I8n=Iy.create,T8n=Sy.create,b8n=lS.create,x8n=Iy.createWithPreprocess,w8n=dG.create,R8n=()=>hat().optional(),B8n=()=>mat().optional(),N8n=()=>Aat().optional(),O8n={string:t=>ax.create({...t,coerce:!0}),number:t=>DN.create({...t,coerce:!0}),boolean:t=>_N.create({...t,coerce:!0}),bigint:t=>SN.create({...t,coerce:!0}),date:t=>IN.create({...t,coerce:!0})},M8n=pi});var ve={};h0(ve,{BRAND:()=>JFn,DIRTY:()=>vN,EMPTY_PATH:()=>xFn,INVALID:()=>pi,NEVER:()=>M8n,OK:()=>Mh,ParseStatus:()=>Hp,Schema:()=>Po,ZodAny:()=>lx,ZodArray:()=>f2,ZodBigInt:()=>SN,ZodBoolean:()=>_N,ZodBranded:()=>cG,ZodCatch:()=>FN,ZodDate:()=>IN,ZodDefault:()=>MN,ZodDiscriminatedUnion:()=>kZ,ZodEffects:()=>Iy,ZodEnum:()=>NN,ZodError:()=>sg,ZodFirstPartyTypeKind:()=>Si,ZodFunction:()=>GZ,ZodIntersection:()=>wN,ZodIssueCode:()=>ln,ZodLazy:()=>RN,ZodLiteral:()=>BN,ZodMap:()=>j8,ZodNaN:()=>z8,ZodNativeEnum:()=>ON,ZodNever:()=>NC,ZodNull:()=>bN,ZodNullable:()=>lS,ZodNumber:()=>DN,ZodObject:()=>ag,ZodOptional:()=>Sy,ZodParsedType:()=>Gn,ZodPipeline:()=>dG,ZodPromise:()=>ux,ZodReadonly:()=>LN,ZodRecord:()=>UZ,ZodSchema:()=>Po,ZodSet:()=>W8,ZodString:()=>ax,ZodSymbol:()=>$8,ZodTransformer:()=>Iy,ZodTuple:()=>aS,ZodType:()=>Po,ZodUndefined:()=>TN,ZodUnion:()=>xN,ZodUnknown:()=>d2,ZodVoid:()=>Y8,addIssueToContext:()=>Nn,any:()=>o8n,array:()=>u8n,bigint:()=>e8n,boolean:()=>Aat,coerce:()=>O8n,custom:()=>pat,date:()=>t8n,datetimeRegex:()=>dat,defaultErrorMap:()=>u2,discriminatedUnion:()=>p8n,effect:()=>I8n,enum:()=>D8n,function:()=>y8n,getErrorMap:()=>H8,getParsedType:()=>sS,instanceof:()=>XFn,intersection:()=>h8n,isAborted:()=>PZ,isAsync:()=>q8,isDirty:()=>QZ,isValid:()=>sx,late:()=>KFn,lazy:()=>C8n,literal:()=>v8n,makeIssue:()=>uG,map:()=>g8n,nan:()=>ZFn,nativeEnum:()=>S8n,never:()=>a8n,null:()=>i8n,nullable:()=>b8n,number:()=>mat,object:()=>c8n,objectUtil:()=>QSe,oboolean:()=>N8n,onumber:()=>B8n,optional:()=>T8n,ostring:()=>R8n,pipeline:()=>w8n,preprocess:()=>x8n,promise:()=>_8n,quotelessJson:()=>IFn,record:()=>A8n,set:()=>E8n,setErrorMap:()=>bFn,strictObject:()=>d8n,string:()=>hat,symbol:()=>n8n,transformer:()=>I8n,tuple:()=>m8n,undefined:()=>r8n,union:()=>f8n,unknown:()=>s8n,util:()=>os,void:()=>l8n});var qSe=Le(()=>{LZ();USe();oat();lG();gat();FZ()});var fG=Le(()=>{qSe();qSe()});var J8,Eat,HZ,yat,Cat,F8n,xy,lg,pG,uS,wy,qZ,vat,VZ,Dat,Sat,_at,hG,Ty,Iat,Tat,cx,PN,$Z,mG,bat,L8n,P8n,Q8n,VSe,xat,wat,YZ,k8n,jZ,WZ,zZ,Rat,Bat,Nat,Oat,U8n,G8n,$Se,H8n,YSe,q8n,jSe,V8n,$8n,Y8n,j8n,W8n,z8n,J8n,AG,K8n,WSe,zSe,JSe,X8n,Z8n,Mat,eLn,gG,tLn,nLn,rLn,iLn,KSe,JZ,jKr,oLn,sLn,Fat,aLn,lLn,uLn,cLn,dLn,fLn,pLn,hLn,mLn,ALn,gLn,ELn,yLn,CLn,vLn,DLn,SLn,XSe,_Ln,ILn,TLn,bLn,WKr,zKr,JKr,KKr,XKr,ZKr,by,dx=Le(()=>{fG();J8="2025-06-18",Eat=[J8,"2025-03-26","2024-11-05","2024-10-07"],HZ="2.0",yat=ve.union([ve.string(),ve.number().int()]),Cat=ve.string(),F8n=ve.object({progressToken:ve.optional(yat)}).passthrough(),xy=ve.object({_meta:ve.optional(F8n)}).passthrough(),lg=ve.object({method:ve.string(),params:ve.optional(xy)}),pG=ve.object({_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),uS=ve.object({method:ve.string(),params:ve.optional(pG)}),wy=ve.object({_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),qZ=ve.union([ve.string(),ve.number().int()]),vat=ve.object({jsonrpc:ve.literal(HZ),id:qZ}).merge(lg).strict(),VZ=t=>vat.safeParse(t).success,Dat=ve.object({jsonrpc:ve.literal(HZ)}).merge(uS).strict(),Sat=t=>Dat.safeParse(t).success,_at=ve.object({jsonrpc:ve.literal(HZ),id:qZ,result:wy}).strict(),hG=t=>_at.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(Ty||(Ty={}));Iat=ve.object({jsonrpc:ve.literal(HZ),id:qZ,error:ve.object({code:ve.number().int(),message:ve.string(),data:ve.optional(ve.unknown())})}).strict(),Tat=t=>Iat.safeParse(t).success,cx=ve.union([vat,Dat,_at,Iat]),PN=wy.strict(),$Z=uS.extend({method:ve.literal("notifications/cancelled"),params:pG.extend({requestId:qZ,reason:ve.string().optional()})}),mG=ve.object({name:ve.string(),title:ve.optional(ve.string())}).passthrough(),bat=mG.extend({version:ve.string()}),L8n=ve.object({experimental:ve.optional(ve.object({}).passthrough()),sampling:ve.optional(ve.object({}).passthrough()),elicitation:ve.optional(ve.object({}).passthrough()),roots:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough())}).passthrough(),P8n=lg.extend({method:ve.literal("initialize"),params:xy.extend({protocolVersion:ve.string(),capabilities:L8n,clientInfo:bat})}),Q8n=ve.object({experimental:ve.optional(ve.object({}).passthrough()),logging:ve.optional(ve.object({}).passthrough()),completions:ve.optional(ve.object({}).passthrough()),prompts:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough()),resources:ve.optional(ve.object({subscribe:ve.optional(ve.boolean()),listChanged:ve.optional(ve.boolean())}).passthrough()),tools:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough())}).passthrough(),VSe=wy.extend({protocolVersion:ve.string(),capabilities:Q8n,serverInfo:bat,instructions:ve.optional(ve.string())}),xat=uS.extend({method:ve.literal("notifications/initialized")}),wat=t=>xat.safeParse(t).success,YZ=lg.extend({method:ve.literal("ping")}),k8n=ve.object({progress:ve.number(),total:ve.optional(ve.number()),message:ve.optional(ve.string())}).passthrough(),jZ=uS.extend({method:ve.literal("notifications/progress"),params:pG.merge(k8n).extend({progressToken:yat})}),WZ=lg.extend({params:xy.extend({cursor:ve.optional(Cat)}).optional()}),zZ=wy.extend({nextCursor:ve.optional(Cat)}),Rat=ve.object({uri:ve.string(),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),Bat=Rat.extend({text:ve.string()}),Nat=Rat.extend({blob:ve.string().base64()}),Oat=mG.extend({uri:ve.string(),description:ve.optional(ve.string()),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}),U8n=mG.extend({uriTemplate:ve.string(),description:ve.optional(ve.string()),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}),G8n=WZ.extend({method:ve.literal("resources/list")}),$Se=zZ.extend({resources:ve.array(Oat)}),H8n=WZ.extend({method:ve.literal("resources/templates/list")}),YSe=zZ.extend({resourceTemplates:ve.array(U8n)}),q8n=lg.extend({method:ve.literal("resources/read"),params:xy.extend({uri:ve.string()})}),jSe=wy.extend({contents:ve.array(ve.union([Bat,Nat]))}),V8n=uS.extend({method:ve.literal("notifications/resources/list_changed")}),$8n=lg.extend({method:ve.literal("resources/subscribe"),params:xy.extend({uri:ve.string()})}),Y8n=lg.extend({method:ve.literal("resources/unsubscribe"),params:xy.extend({uri:ve.string()})}),j8n=uS.extend({method:ve.literal("notifications/resources/updated"),params:pG.extend({uri:ve.string()})}),W8n=ve.object({name:ve.string(),description:ve.optional(ve.string()),required:ve.optional(ve.boolean())}).passthrough(),z8n=mG.extend({description:ve.optional(ve.string()),arguments:ve.optional(ve.array(W8n)),_meta:ve.optional(ve.object({}).passthrough())}),J8n=WZ.extend({method:ve.literal("prompts/list")}),AG=zZ.extend({prompts:ve.array(z8n)}),K8n=lg.extend({method:ve.literal("prompts/get"),params:xy.extend({name:ve.string(),arguments:ve.optional(ve.record(ve.string()))})}),WSe=ve.object({type:ve.literal("text"),text:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),zSe=ve.object({type:ve.literal("image"),data:ve.string().base64(),mimeType:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),JSe=ve.object({type:ve.literal("audio"),data:ve.string().base64(),mimeType:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),X8n=ve.object({type:ve.literal("resource"),resource:ve.union([Bat,Nat]),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),Z8n=Oat.extend({type:ve.literal("resource_link")}),Mat=ve.union([WSe,zSe,JSe,Z8n,X8n]),eLn=ve.object({role:ve.enum(["user","assistant"]),content:Mat}).passthrough(),gG=wy.extend({description:ve.optional(ve.string()),messages:ve.array(eLn)}),tLn=uS.extend({method:ve.literal("notifications/prompts/list_changed")}),nLn=ve.object({title:ve.optional(ve.string()),readOnlyHint:ve.optional(ve.boolean()),destructiveHint:ve.optional(ve.boolean()),idempotentHint:ve.optional(ve.boolean()),openWorldHint:ve.optional(ve.boolean())}).passthrough(),rLn=mG.extend({description:ve.optional(ve.string()),inputSchema:ve.object({type:ve.literal("object"),properties:ve.optional(ve.object({}).passthrough()),required:ve.optional(ve.array(ve.string()))}).passthrough(),outputSchema:ve.optional(ve.object({type:ve.literal("object"),properties:ve.optional(ve.object({}).passthrough()),required:ve.optional(ve.array(ve.string()))}).passthrough()),annotations:ve.optional(nLn),_meta:ve.optional(ve.object({}).passthrough())}),iLn=WZ.extend({method:ve.literal("tools/list")}),KSe=zZ.extend({tools:ve.array(rLn)}),JZ=wy.extend({content:ve.array(Mat).default([]),structuredContent:ve.object({}).passthrough().optional(),isError:ve.optional(ve.boolean())}),jKr=JZ.or(wy.extend({toolResult:ve.unknown()})),oLn=lg.extend({method:ve.literal("tools/call"),params:xy.extend({name:ve.string(),arguments:ve.optional(ve.record(ve.unknown()))})}),sLn=uS.extend({method:ve.literal("notifications/tools/list_changed")}),Fat=ve.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),aLn=lg.extend({method:ve.literal("logging/setLevel"),params:xy.extend({level:Fat})}),lLn=uS.extend({method:ve.literal("notifications/message"),params:pG.extend({level:Fat,logger:ve.optional(ve.string()),data:ve.unknown()})}),uLn=ve.object({name:ve.string().optional()}).passthrough(),cLn=ve.object({hints:ve.optional(ve.array(uLn)),costPriority:ve.optional(ve.number().min(0).max(1)),speedPriority:ve.optional(ve.number().min(0).max(1)),intelligencePriority:ve.optional(ve.number().min(0).max(1))}).passthrough(),dLn=ve.object({role:ve.enum(["user","assistant"]),content:ve.union([WSe,zSe,JSe])}).passthrough(),fLn=lg.extend({method:ve.literal("sampling/createMessage"),params:xy.extend({messages:ve.array(dLn),systemPrompt:ve.optional(ve.string()),includeContext:ve.optional(ve.enum(["none","thisServer","allServers"])),temperature:ve.optional(ve.number()),maxTokens:ve.number().int(),stopSequences:ve.optional(ve.array(ve.string())),metadata:ve.optional(ve.object({}).passthrough()),modelPreferences:ve.optional(cLn)})}),pLn=wy.extend({model:ve.string(),stopReason:ve.optional(ve.enum(["endTurn","stopSequence","maxTokens"]).or(ve.string())),role:ve.enum(["user","assistant"]),content:ve.discriminatedUnion("type",[WSe,zSe,JSe])}),hLn=ve.object({type:ve.literal("boolean"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),default:ve.optional(ve.boolean())}).passthrough(),mLn=ve.object({type:ve.literal("string"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),minLength:ve.optional(ve.number()),maxLength:ve.optional(ve.number()),format:ve.optional(ve.enum(["email","uri","date","date-time"]))}).passthrough(),ALn=ve.object({type:ve.enum(["number","integer"]),title:ve.optional(ve.string()),description:ve.optional(ve.string()),minimum:ve.optional(ve.number()),maximum:ve.optional(ve.number())}).passthrough(),gLn=ve.object({type:ve.literal("string"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),enum:ve.array(ve.string()),enumNames:ve.optional(ve.array(ve.string()))}).passthrough(),ELn=ve.union([hLn,mLn,ALn,gLn]),yLn=lg.extend({method:ve.literal("elicitation/create"),params:xy.extend({message:ve.string(),requestedSchema:ve.object({type:ve.literal("object"),properties:ve.record(ve.string(),ELn),required:ve.optional(ve.array(ve.string()))}).passthrough()})}),CLn=wy.extend({action:ve.enum(["accept","decline","cancel"]),content:ve.optional(ve.record(ve.string(),ve.unknown()))}),vLn=ve.object({type:ve.literal("ref/resource"),uri:ve.string()}).passthrough(),DLn=ve.object({type:ve.literal("ref/prompt"),name:ve.string()}).passthrough(),SLn=lg.extend({method:ve.literal("completion/complete"),params:xy.extend({ref:ve.union([DLn,vLn]),argument:ve.object({name:ve.string(),value:ve.string()}).passthrough(),context:ve.optional(ve.object({arguments:ve.optional(ve.record(ve.string(),ve.string()))}))})}),XSe=wy.extend({completion:ve.object({values:ve.array(ve.string()).max(100),total:ve.optional(ve.number().int()),hasMore:ve.optional(ve.boolean())}).passthrough()}),_Ln=ve.object({uri:ve.string().startsWith("file://"),name:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),ILn=lg.extend({method:ve.literal("roots/list")}),TLn=wy.extend({roots:ve.array(_Ln)}),bLn=uS.extend({method:ve.literal("notifications/roots/list_changed")}),WKr=ve.union([YZ,P8n,SLn,aLn,K8n,J8n,G8n,H8n,q8n,$8n,Y8n,oLn,iLn]),zKr=ve.union([$Z,jZ,xat,bLn]),JKr=ve.union([PN,pLn,CLn,TLn]),KKr=ve.union([YZ,fLn,yLn,ILn]),XKr=ve.union([$Z,jZ,lLn,j8n,V8n,sLn,tLn]),ZKr=ve.union([PN,VSe,XSe,gG,AG,$Se,YSe,jSe,JZ,KSe]),by=class extends Error{constructor(e,n,r){super(`MCP error ${e}: ${n}`),this.code=e,this.data=r,this.name="McpError"}}});function Lat(t,e){return Object.entries(e).reduce((n,[r,i])=>(i&&typeof i=="object"?n[r]=n[r]?{...n[r],...i}:i:n[r]=i,n),{...t})}var xLn,KZ,Pat=Le(()=>{dx();xLn=6e4,KZ=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler($Z,n=>{let r=this._requestHandlerAbortControllers.get(n.params.requestId);r?.abort(n.params.reason)}),this.setNotificationHandler(jZ,n=>{this._onprogress(n)}),this.setRequestHandler(YZ,n=>({}))}_setupTimeout(e,n,r,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),new by(Ty.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var n,r,i;this._transport=e;let o=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(r=this.transport)===null||r===void 0?void 0:r.onerror;this._transport.onerror=l=>{s?.(l),this._onerror(l)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(l,u)=>{a?.(l,u),hG(l)||Tat(l)?this._onresponse(l):VZ(l)?this._onrequest(l,u):Sat(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let r=new by(Ty.ConnectionClosed,"Connection closed");for(let i of n.values())i(r)}_onerror(e){var n;(n=this.onerror)===null||n===void 0||n.call(this,e)}_onnotification(e){var n;let r=(n=this._notificationHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,n){var r,i,o,s;let a=(r=this._requestHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackRequestHandler;if(a===void 0){(i=this._transport)===null||i===void 0||i.send({jsonrpc:"2.0",id:e.id,error:{code:Ty.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let u={signal:l.signal,sessionId:(o=this._transport)===null||o===void 0?void 0:o.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,d,h)=>this.request(c,d,{...h,relatedRequestId:e.id}),authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo};Promise.resolve().then(()=>a(e,u)).then(c=>{var d;if(!l.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var d,h;if(!l.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Ty.InternalError,message:(h=c.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,i=Number(n),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){s(l);return}o(r)}_onresponse(e){let n=Number(e.id),r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),hG(e))r(e);else{let i=new by(e.error.code,e.error.message,e.error.data);r(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,n,r){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=r??{};return new Promise((a,l)=>{var u,c,d,h,m,E;if(!this._transport){l(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(c=r?.signal)===null||c===void 0||c.throwIfAborted();let y=this._requestMessageId++,C={...e,jsonrpc:"2.0",id:y};r?.onprogress&&(this._progressHandlers.set(y,r.onprogress),C.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:y}});let _=R=>{var F;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),(F=this._transport)===null||F===void 0||F.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(R)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(q=>this._onerror(new Error(`Failed to send cancellation: ${q}`))),l(R)};this._responseHandlers.set(y,R=>{var F;if(!(!((F=r?.signal)===null||F===void 0)&&F.aborted)){if(R instanceof Error)return l(R);try{let q=n.parse(R.result);a(q)}catch(q){l(q)}}}),(h=r?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var R;_((R=r?.signal)===null||R===void 0?void 0:R.reason)});let w=(m=r?.timeout)!==null&&m!==void 0?m:xLn,B=()=>_(new by(Ty.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(y,w,r?.maxTotalTimeout,B,(E=r?.resetTimeoutOnProgress)!==null&&E!==void 0?E:!1),this._transport.send(C,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(R=>{this._cleanupTimeout(y),l(R)})})}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r={...e,jsonrpc:"2.0"};await this._transport.send(r,n)}setRequestHandler(e,n){let r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,o)=>Promise.resolve(n(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){this._notificationHandlers.set(e.shape.method.value,r=>Promise.resolve(n(e.parse(r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var kat=b((XZ,Qat)=>{(function(t,e){typeof XZ=="object"&&typeof Qat<"u"?e(XZ):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(XZ,function(t){"use strict";function e(){for(var Je=arguments.length,je=Array(Je),ut=0;ut<Je;ut++)je[ut]=arguments[ut];if(je.length>1){je[0]=je[0].slice(0,-1);for(var St=je.length-1,st=1;st<St;++st)je[st]=je[st].slice(1,-1);return je[St]=je[St].slice(1),je.join("")}else return je[0]}function n(Je){return"(?:"+Je+")"}function r(Je){return Je===void 0?"undefined":Je===null?"null":Object.prototype.toString.call(Je).split(" ").pop().split("]").shift().toLowerCase()}function i(Je){return Je.toUpperCase()}function o(Je){return Je!=null?Je instanceof Array?Je:typeof Je.length!="number"||Je.split||Je.setInterval||Je.call?[Je]:Array.prototype.slice.call(Je):[]}function s(Je,je){var ut=Je;if(je)for(var St in je)ut[St]=je[St];return ut}function a(Je){var je="[A-Za-z]",ut="[\\x0D]",St="[0-9]",st="[\\x22]",vn=e(St,"[A-Fa-f]"),Vn="[\\x0A]",li="[\\x20]",Ir=n(n("%[EFef]"+vn+"%"+vn+vn+"%"+vn+vn)+"|"+n("%[89A-Fa-f]"+vn+"%"+vn+vn)+"|"+n("%"+vn+vn)),As="[\\:\\/\\?\\#\\[\\]\\@]",Pi="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Bo=e(As,Pi),ks=Je?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Cr=Je?"[\\uE000-\\uF8FF]":"[]",ni=e(je,St,"[\\-\\.\\_\\~]",ks),Do=n(je+e(je,St,"[\\+\\-\\.]")+"*"),No=n(n(Ir+"|"+e(ni,Pi,"[\\:]"))+"*"),Nu=n(n("25[0-5]")+"|"+n("2[0-4]"+St)+"|"+n("1"+St+St)+"|"+n("[1-9]"+St)+"|"+St),va=n(n("25[0-5]")+"|"+n("2[0-4]"+St)+"|"+n("1"+St+St)+"|"+n("0?[1-9]"+St)+"|0?0?"+St),Ks=n(va+"\\."+va+"\\."+va+"\\."+va),Ei=n(vn+"{1,4}"),fl=n(n(Ei+"\\:"+Ei)+"|"+Ks),ui=n(n(Ei+"\\:")+"{6}"+fl),ci=n("\\:\\:"+n(Ei+"\\:")+"{5}"+fl),Ou=n(n(Ei)+"?\\:\\:"+n(Ei+"\\:")+"{4}"+fl),Da=n(n(n(Ei+"\\:")+"{0,1}"+Ei)+"?\\:\\:"+n(Ei+"\\:")+"{3}"+fl),ho=n(n(n(Ei+"\\:")+"{0,2}"+Ei)+"?\\:\\:"+n(Ei+"\\:")+"{2}"+fl),Ic=n(n(n(Ei+"\\:")+"{0,3}"+Ei)+"?\\:\\:"+Ei+"\\:"+fl),ua=n(n(n(Ei+"\\:")+"{0,4}"+Ei)+"?\\:\\:"+fl),gs=n(n(n(Ei+"\\:")+"{0,5}"+Ei)+"?\\:\\:"+Ei),ja=n(n(n(Ei+"\\:")+"{0,6}"+Ei)+"?\\:\\:"),Be=n([ui,ci,Ou,Da,ho,Ic,ua,gs,ja].join("|")),Me=n(n(ni+"|"+Ir)+"+"),tt=n(Be+"\\%25"+Me),ct=n(Be+n("\\%25|\\%(?!"+vn+"{2})")+Me),Ct=n("[vV]"+vn+"+\\."+e(ni,Pi,"[\\:]")+"+"),Ft=n("\\["+n(ct+"|"+Be+"|"+Ct)+"\\]"),Jt=n(n(Ir+"|"+e(ni,Pi))+"*"),Vt=n(Ft+"|"+Ks+"(?!"+Jt+")|"+Jt),nn=n(St+"*"),en=n(n(No+"@")+"?"+Vt+n("\\:"+nn)+"?"),hn=n(Ir+"|"+e(ni,Pi,"[\\:\\@]")),sr=n(hn+"*"),Ii=n(hn+"+"),Us=n(n(Ir+"|"+e(ni,Pi,"[\\@]"))+"+"),hi=n(n("\\/"+sr)+"*"),La=n("\\/"+n(Ii+hi)+"?"),eu=n(Us+hi),ad=n(Ii+hi),Ts="(?!"+hn+")",hE=n(hi+"|"+La+"|"+eu+"|"+ad+"|"+Ts),Hd=n(n(hn+"|"+e("[\\/\\?]",Cr))+"*"),ld=n(n(hn+"|[\\/\\?]")+"*"),gm=n(n("\\/\\/"+en+hi)+"|"+La+"|"+ad+"|"+Ts),mE=n(Do+"\\:"+gm+n("\\?"+Hd)+"?"+n("\\#"+ld)+"?"),ph=n(n("\\/\\/"+en+hi)+"|"+La+"|"+eu+"|"+Ts),Wa=n(ph+n("\\?"+Hd)+"?"+n("\\#"+ld)+"?"),wA=n(mE+"|"+Wa),Ef=n(Do+"\\:"+gm+n("\\?"+Hd)+"?"),Em="^("+Do+")\\:"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+ad+"|"+Ts+")")+n("\\?("+Hd+")")+"?"+n("\\#("+ld+")")+"?$",yf="^(){0}"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+eu+"|"+Ts+")")+n("\\?("+Hd+")")+"?"+n("\\#("+ld+")")+"?$",ym="^("+Do+")\\:"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+ad+"|"+Ts+")")+n("\\?("+Hd+")")+"?$",Mu="^"+n("\\#("+ld+")")+"?$",Vg="^"+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",je,St,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ni,Pi),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ni,Pi),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ni,Pi),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ni,Pi),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ni,Pi,"[\\:\\@\\/\\?]",Cr),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ni,Pi,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ni,Pi),"g"),UNRESERVED:new RegExp(ni,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ni,Bo),"g"),PCT_ENCODED:new RegExp(Ir,"g"),IPV4ADDRESS:new RegExp("^("+Ks+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Be+")"+n(n("\\%25|\\%(?!"+vn+"{2})")+"("+Me+")")+"?\\]?$")}}var l=a(!1),u=a(!0),c=function(){function Je(je,ut){var St=[],st=!0,vn=!1,Vn=void 0;try{for(var li=je[Symbol.iterator](),Ir;!(st=(Ir=li.next()).done)&&(St.push(Ir.value),!(ut&&St.length===ut));st=!0);}catch(As){vn=!0,Vn=As}finally{try{!st&&li.return&&li.return()}finally{if(vn)throw Vn}}return St}return function(je,ut){if(Array.isArray(je))return je;if(Symbol.iterator in Object(je))return Je(je,ut);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(Je){if(Array.isArray(Je)){for(var je=0,ut=Array(Je.length);je<Je.length;je++)ut[je]=Je[je];return ut}else return Array.from(Je)},h=2147483647,m=36,E=1,y=26,C=38,_=700,w=72,B=128,R="-",F=/^xn--/,q=/[^\0-\x7E]/,J=/[\x2E\u3002\uFF0E\uFF61]/g,j={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=m-E,K=Math.floor,U=String.fromCharCode;function se(Je){throw new RangeError(j[Je])}function V(Je,je){for(var ut=[],St=Je.length;St--;)ut[St]=je(Je[St]);return ut}function O(Je,je){var ut=Je.split("@"),St="";ut.length>1&&(St=ut[0]+"@",Je=ut[1]),Je=Je.replace(J,".");var st=Je.split("."),vn=V(st,je).join(".");return St+vn}function Y(Je){for(var je=[],ut=0,St=Je.length;ut<St;){var st=Je.charCodeAt(ut++);if(st>=55296&&st<=56319&&ut<St){var vn=Je.charCodeAt(ut++);(vn&64512)==56320?je.push(((st&1023)<<10)+(vn&1023)+65536):(je.push(st),ut--)}else je.push(st)}return je}var ee=function(je){return String.fromCodePoint.apply(String,d(je))},ne=function(je){return je-48<10?je-22:je-65<26?je-65:je-97<26?je-97:m},Ae=function(je,ut){return je+22+75*(je<26)-((ut!=0)<<5)},Ce=function(je,ut,St){var st=0;for(je=St?K(je/_):je>>1,je+=K(je/ut);je>L*y>>1;st+=m)je=K(je/L);return K(st+(L+1)*je/(je+C))},De=function(je){var ut=[],St=je.length,st=0,vn=B,Vn=w,li=je.lastIndexOf(R);li<0&&(li=0);for(var Ir=0;Ir<li;++Ir)je.charCodeAt(Ir)>=128&&se("not-basic"),ut.push(je.charCodeAt(Ir));for(var As=li>0?li+1:0;As<St;){for(var Pi=st,Bo=1,ks=m;;ks+=m){As>=St&&se("invalid-input");var Cr=ne(je.charCodeAt(As++));(Cr>=m||Cr>K((h-st)/Bo))&&se("overflow"),st+=Cr*Bo;var ni=ks<=Vn?E:ks>=Vn+y?y:ks-Vn;if(Cr<ni)break;var Do=m-ni;Bo>K(h/Do)&&se("overflow"),Bo*=Do}var No=ut.length+1;Vn=Ce(st-Pi,No,Pi==0),K(st/No)>h-vn&&se("overflow"),vn+=K(st/No),st%=No,ut.splice(st++,0,vn)}return String.fromCodePoint.apply(String,ut)},Ue=function(je){var ut=[];je=Y(je);var St=je.length,st=B,vn=0,Vn=w,li=!0,Ir=!1,As=void 0;try{for(var Pi=je[Symbol.iterator](),Bo;!(li=(Bo=Pi.next()).done);li=!0){var ks=Bo.value;ks<128&&ut.push(U(ks))}}catch(ct){Ir=!0,As=ct}finally{try{!li&&Pi.return&&Pi.return()}finally{if(Ir)throw As}}var Cr=ut.length,ni=Cr;for(Cr&&ut.push(R);ni<St;){var Do=h,No=!0,Nu=!1,va=void 0;try{for(var Ks=je[Symbol.iterator](),Ei;!(No=(Ei=Ks.next()).done);No=!0){var fl=Ei.value;fl>=st&&fl<Do&&(Do=fl)}}catch(ct){Nu=!0,va=ct}finally{try{!No&&Ks.return&&Ks.return()}finally{if(Nu)throw va}}var ui=ni+1;Do-st>K((h-vn)/ui)&&se("overflow"),vn+=(Do-st)*ui,st=Do;var ci=!0,Ou=!1,Da=void 0;try{for(var ho=je[Symbol.iterator](),Ic;!(ci=(Ic=ho.next()).done);ci=!0){var ua=Ic.value;if(ua<st&&++vn>h&&se("overflow"),ua==st){for(var gs=vn,ja=m;;ja+=m){var Be=ja<=Vn?E:ja>=Vn+y?y:ja-Vn;if(gs<Be)break;var Me=gs-Be,tt=m-Be;ut.push(U(Ae(Be+Me%tt,0))),gs=K(Me/tt)}ut.push(U(Ae(gs,0))),Vn=Ce(vn,ui,ni==Cr),vn=0,++ni}}}catch(ct){Ou=!0,Da=ct}finally{try{!ci&&ho.return&&ho.return()}finally{if(Ou)throw Da}}++vn,++st}return ut.join("")},qe=function(je){return O(je,function(ut){return F.test(ut)?De(ut.slice(4).toLowerCase()):ut})},Ie=function(je){return O(je,function(ut){return q.test(ut)?"xn--"+Ue(ut):ut})},xe={version:"2.1.0",ucs2:{decode:Y,encode:ee},decode:De,encode:Ue,toASCII:Ie,toUnicode:qe},Oe={};function le(Je){var je=Je.charCodeAt(0),ut=void 0;return je<16?ut="%0"+je.toString(16).toUpperCase():je<128?ut="%"+je.toString(16).toUpperCase():je<2048?ut="%"+(je>>6|192).toString(16).toUpperCase()+"%"+(je&63|128).toString(16).toUpperCase():ut="%"+(je>>12|224).toString(16).toUpperCase()+"%"+(je>>6&63|128).toString(16).toUpperCase()+"%"+(je&63|128).toString(16).toUpperCase(),ut}function re(Je){for(var je="",ut=0,St=Je.length;ut<St;){var st=parseInt(Je.substr(ut+1,2),16);if(st<128)je+=String.fromCharCode(st),ut+=3;else if(st>=194&&st<224){if(St-ut>=6){var vn=parseInt(Je.substr(ut+4,2),16);je+=String.fromCharCode((st&31)<<6|vn&63)}else je+=Je.substr(ut,6);ut+=6}else if(st>=224){if(St-ut>=9){var Vn=parseInt(Je.substr(ut+4,2),16),li=parseInt(Je.substr(ut+7,2),16);je+=String.fromCharCode((st&15)<<12|(Vn&63)<<6|li&63)}else je+=Je.substr(ut,9);ut+=9}else je+=Je.substr(ut,3),ut+=3}return je}function ye(Je,je){function ut(St){var st=re(St);return st.match(je.UNRESERVED)?st:St}return Je.scheme&&(Je.scheme=String(Je.scheme).replace(je.PCT_ENCODED,ut).toLowerCase().replace(je.NOT_SCHEME,"")),Je.userinfo!==void 0&&(Je.userinfo=String(Je.userinfo).replace(je.PCT_ENCODED,ut).replace(je.NOT_USERINFO,le).replace(je.PCT_ENCODED,i)),Je.host!==void 0&&(Je.host=String(Je.host).replace(je.PCT_ENCODED,ut).toLowerCase().replace(je.NOT_HOST,le).replace(je.PCT_ENCODED,i)),Je.path!==void 0&&(Je.path=String(Je.path).replace(je.PCT_ENCODED,ut).replace(Je.scheme?je.NOT_PATH:je.NOT_PATH_NOSCHEME,le).replace(je.PCT_ENCODED,i)),Je.query!==void 0&&(Je.query=String(Je.query).replace(je.PCT_ENCODED,ut).replace(je.NOT_QUERY,le).replace(je.PCT_ENCODED,i)),Je.fragment!==void 0&&(Je.fragment=String(Je.fragment).replace(je.PCT_ENCODED,ut).replace(je.NOT_FRAGMENT,le).replace(je.PCT_ENCODED,i)),Je}function X(Je){return Je.replace(/^0*(.*)/,"$1")||"0"}function he(Je,je){var ut=Je.match(je.IPV4ADDRESS)||[],St=c(ut,2),st=St[1];return st?st.split(".").map(X).join("."):Je}function ae(Je,je){var ut=Je.match(je.IPV6ADDRESS)||[],St=c(ut,3),st=St[1],vn=St[2];if(st){for(var Vn=st.toLowerCase().split("::").reverse(),li=c(Vn,2),Ir=li[0],As=li[1],Pi=As?As.split(":").map(X):[],Bo=Ir.split(":").map(X),ks=je.IPV4ADDRESS.test(Bo[Bo.length-1]),Cr=ks?7:8,ni=Bo.length-Cr,Do=Array(Cr),No=0;No<Cr;++No)Do[No]=Pi[No]||Bo[ni+No]||"";ks&&(Do[Cr-1]=he(Do[Cr-1],je));var Nu=Do.reduce(function(ui,ci,Ou){if(!ci||ci==="0"){var Da=ui[ui.length-1];Da&&Da.index+Da.length===Ou?Da.length++:ui.push({index:Ou,length:1})}return ui},[]),va=Nu.sort(function(ui,ci){return ci.length-ui.length})[0],Ks=void 0;if(va&&va.length>1){var Ei=Do.slice(0,va.index),fl=Do.slice(va.index+va.length);Ks=Ei.join(":")+"::"+fl.join(":")}else Ks=Do.join(":");return vn&&(Ks+="%"+vn),Ks}else return Je}var me=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Se="".match(/(){0}/)[1]===void 0;function ie(Je){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ut={},St=je.iri!==!1?u:l;je.reference==="suffix"&&(Je=(je.scheme?je.scheme+":":"")+"//"+Je);var st=Je.match(me);if(st){Se?(ut.scheme=st[1],ut.userinfo=st[3],ut.host=st[4],ut.port=parseInt(st[5],10),ut.path=st[6]||"",ut.query=st[7],ut.fragment=st[8],isNaN(ut.port)&&(ut.port=st[5])):(ut.scheme=st[1]||void 0,ut.userinfo=Je.indexOf("@")!==-1?st[3]:void 0,ut.host=Je.indexOf("//")!==-1?st[4]:void 0,ut.port=parseInt(st[5],10),ut.path=st[6]||"",ut.query=Je.indexOf("?")!==-1?st[7]:void 0,ut.fragment=Je.indexOf("#")!==-1?st[8]:void 0,isNaN(ut.port)&&(ut.port=Je.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?st[4]:void 0)),ut.host&&(ut.host=ae(he(ut.host,St),St)),ut.scheme===void 0&&ut.userinfo===void 0&&ut.host===void 0&&ut.port===void 0&&!ut.path&&ut.query===void 0?ut.reference="same-document":ut.scheme===void 0?ut.reference="relative":ut.fragment===void 0?ut.reference="absolute":ut.reference="uri",je.reference&&je.reference!=="suffix"&&je.reference!==ut.reference&&(ut.error=ut.error||"URI is not a "+je.reference+" reference.");var vn=Oe[(je.scheme||ut.scheme||"").toLowerCase()];if(!je.unicodeSupport&&(!vn||!vn.unicodeSupport)){if(ut.host&&(je.domainHost||vn&&vn.domainHost))try{ut.host=xe.toASCII(ut.host.replace(St.PCT_ENCODED,re).toLowerCase())}catch(Vn){ut.error=ut.error||"Host's domain name can not be converted to ASCII via punycode: "+Vn}ye(ut,l)}else ye(ut,St);vn&&vn.parse&&vn.parse(ut,je)}else ut.error=ut.error||"URI can not be parsed.";return ut}function k(Je,je){var ut=je.iri!==!1?u:l,St=[];return Je.userinfo!==void 0&&(St.push(Je.userinfo),St.push("@")),Je.host!==void 0&&St.push(ae(he(String(Je.host),ut),ut).replace(ut.IPV6ADDRESS,function(st,vn,Vn){return"["+vn+(Vn?"%25"+Vn:"")+"]"})),(typeof Je.port=="number"||typeof Je.port=="string")&&(St.push(":"),St.push(String(Je.port))),St.length?St.join(""):void 0}var W=/^\.\.?\//,pe=/^\/\.(\/|$)/,te=/^\/\.\.(\/|$)/,H=/^\/?(?:.|\n)*?(?=\/|$)/;function ge(Je){for(var je=[];Je.length;)if(Je.match(W))Je=Je.replace(W,"");else if(Je.match(pe))Je=Je.replace(pe,"/");else if(Je.match(te))Je=Je.replace(te,"/"),je.pop();else if(Je==="."||Je==="..")Je="";else{var ut=Je.match(H);if(ut){var St=ut[0];Je=Je.slice(St.length),je.push(St)}else throw new Error("Unexpected dot segment condition")}return je.join("")}function be(Je){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ut=je.iri?u:l,St=[],st=Oe[(je.scheme||Je.scheme||"").toLowerCase()];if(st&&st.serialize&&st.serialize(Je,je),Je.host&&!ut.IPV6ADDRESS.test(Je.host)){if(je.domainHost||st&&st.domainHost)try{Je.host=je.iri?xe.toUnicode(Je.host):xe.toASCII(Je.host.replace(ut.PCT_ENCODED,re).toLowerCase())}catch(li){Je.error=Je.error||"Host's domain name can not be converted to "+(je.iri?"Unicode":"ASCII")+" via punycode: "+li}}ye(Je,ut),je.reference!=="suffix"&&Je.scheme&&(St.push(Je.scheme),St.push(":"));var vn=k(Je,je);if(vn!==void 0&&(je.reference!=="suffix"&&St.push("//"),St.push(vn),Je.path&&Je.path.charAt(0)!=="/"&&St.push("/")),Je.path!==void 0){var Vn=Je.path;!je.absolutePath&&(!st||!st.absolutePath)&&(Vn=ge(Vn)),vn===void 0&&(Vn=Vn.replace(/^\/\//,"/%2F")),St.push(Vn)}return Je.query!==void 0&&(St.push("?"),St.push(Je.query)),Je.fragment!==void 0&&(St.push("#"),St.push(Je.fragment)),St.join("")}function Pe(Je,je){var ut=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},St=arguments[3],st={};return St||(Je=ie(be(Je,ut),ut),je=ie(be(je,ut),ut)),ut=ut||{},!ut.tolerant&&je.scheme?(st.scheme=je.scheme,st.userinfo=je.userinfo,st.host=je.host,st.port=je.port,st.path=ge(je.path||""),st.query=je.query):(je.userinfo!==void 0||je.host!==void 0||je.port!==void 0?(st.userinfo=je.userinfo,st.host=je.host,st.port=je.port,st.path=ge(je.path||""),st.query=je.query):(je.path?(je.path.charAt(0)==="/"?st.path=ge(je.path):((Je.userinfo!==void 0||Je.host!==void 0||Je.port!==void 0)&&!Je.path?st.path="/"+je.path:Je.path?st.path=Je.path.slice(0,Je.path.lastIndexOf("/")+1)+je.path:st.path=je.path,st.path=ge(st.path)),st.query=je.query):(st.path=Je.path,je.query!==void 0?st.query=je.query:st.query=Je.query),st.userinfo=Je.userinfo,st.host=Je.host,st.port=Je.port),st.scheme=Je.scheme),st.fragment=je.fragment,st}function pt(Je,je,ut){var St=s({scheme:"null"},ut);return be(Pe(ie(Je,St),ie(je,St),St,!0),St)}function Dt(Je,je){return typeof Je=="string"?Je=be(ie(Je,je),je):r(Je)==="object"&&(Je=ie(be(Je,je),je)),Je}function Qt(Je,je,ut){return typeof Je=="string"?Je=be(ie(Je,ut),ut):r(Je)==="object"&&(Je=be(Je,ut)),typeof je=="string"?je=be(ie(je,ut),ut):r(je)==="object"&&(je=be(je,ut)),Je===je}function dt(Je,je){return Je&&Je.toString().replace(!je||!je.iri?l.ESCAPE:u.ESCAPE,le)}function mt(Je,je){return Je&&Je.toString().replace(!je||!je.iri?l.PCT_ENCODED:u.PCT_ENCODED,re)}var kt={scheme:"http",domainHost:!0,parse:function(je,ut){return je.host||(je.error=je.error||"HTTP URIs must have a host."),je},serialize:function(je,ut){var St=String(je.scheme).toLowerCase()==="https";return(je.port===(St?443:80)||je.port==="")&&(je.port=void 0),je.path||(je.path="/"),je}},Ln={scheme:"https",domainHost:kt.domainHost,parse:kt.parse,serialize:kt.serialize};function si(Je){return typeof Je.secure=="boolean"?Je.secure:String(Je.scheme).toLowerCase()==="wss"}var Ni={scheme:"ws",domainHost:!0,parse:function(je,ut){var St=je;return St.secure=si(St),St.resourceName=(St.path||"/")+(St.query?"?"+St.query:""),St.path=void 0,St.query=void 0,St},serialize:function(je,ut){if((je.port===(si(je)?443:80)||je.port==="")&&(je.port=void 0),typeof je.secure=="boolean"&&(je.scheme=je.secure?"wss":"ws",je.secure=void 0),je.resourceName){var St=je.resourceName.split("?"),st=c(St,2),vn=st[0],Vn=st[1];je.path=vn&&vn!=="/"?vn:void 0,je.query=Vn,je.resourceName=void 0}return je.fragment=void 0,je}},Yi={scheme:"wss",domainHost:Ni.domainHost,parse:Ni.parse,serialize:Ni.serialize},Go={},to=!0,Re="[A-Za-z0-9\\-\\.\\_\\~"+(to?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ot="[0-9A-Fa-f]",it=n(n("%[EFef]"+ot+"%"+ot+ot+"%"+ot+ot)+"|"+n("%[89A-Fa-f]"+ot+"%"+ot+ot)+"|"+n("%"+ot+ot)),Lt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Cn="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",On=e(Cn,'[\\"\\\\]'),_n="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(Re,"g"),Un=new RegExp(it,"g"),Fa=new RegExp(e("[^]",Lt,"[\\.]",'[\\"]',On),"g"),vl=new RegExp(e("[^]",Re,_n),"g"),Ud=vl;function sd(Je){var je=re(Je);return je.match(ur)?je:Je}var _c={scheme:"mailto",parse:function(je,ut){var St=je,st=St.to=St.path?St.path.split(","):[];if(St.path=void 0,St.query){for(var vn=!1,Vn={},li=St.query.split("&"),Ir=0,As=li.length;Ir<As;++Ir){var Pi=li[Ir].split("=");switch(Pi[0]){case"to":for(var Bo=Pi[1].split(","),ks=0,Cr=Bo.length;ks<Cr;++ks)st.push(Bo[ks]);break;case"subject":St.subject=mt(Pi[1],ut);break;case"body":St.body=mt(Pi[1],ut);break;default:vn=!0,Vn[mt(Pi[0],ut)]=mt(Pi[1],ut);break}}vn&&(St.headers=Vn)}St.query=void 0;for(var ni=0,Do=st.length;ni<Do;++ni){var No=st[ni].split("@");if(No[0]=mt(No[0]),ut.unicodeSupport)No[1]=mt(No[1],ut).toLowerCase();else try{No[1]=xe.toASCII(mt(No[1],ut).toLowerCase())}catch(Nu){St.error=St.error||"Email address's domain name can not be converted to ASCII via punycode: "+Nu}st[ni]=No.join("@")}return St},serialize:function(je,ut){var St=je,st=o(je.to);if(st){for(var vn=0,Vn=st.length;vn<Vn;++vn){var li=String(st[vn]),Ir=li.lastIndexOf("@"),As=li.slice(0,Ir).replace(Un,sd).replace(Un,i).replace(Fa,le),Pi=li.slice(Ir+1);try{Pi=ut.iri?xe.toUnicode(Pi):xe.toASCII(mt(Pi,ut).toLowerCase())}catch(ni){St.error=St.error||"Email address's domain name can not be converted to "+(ut.iri?"Unicode":"ASCII")+" via punycode: "+ni}st[vn]=As+"@"+Pi}St.path=st.join(",")}var Bo=je.headers=je.headers||{};je.subject&&(Bo.subject=je.subject),je.body&&(Bo.body=je.body);var ks=[];for(var Cr in Bo)Bo[Cr]!==Go[Cr]&&ks.push(Cr.replace(Un,sd).replace(Un,i).replace(vl,le)+"="+Bo[Cr].replace(Un,sd).replace(Un,i).replace(Ud,le));return ks.length&&(St.query=ks.join("&")),St}},Bu=/^([^\:]+)\:(.*)/,Ca={scheme:"urn",parse:function(je,ut){var St=je.path&&je.path.match(Bu),st=je;if(St){var vn=ut.scheme||st.scheme||"urn",Vn=St[1].toLowerCase(),li=St[2],Ir=vn+":"+(ut.nid||Vn),As=Oe[Ir];st.nid=Vn,st.nss=li,st.path=void 0,As&&(st=As.parse(st,ut))}else st.error=st.error||"URN can not be parsed.";return st},serialize:function(je,ut){var St=ut.scheme||je.scheme||"urn",st=je.nid,vn=St+":"+(ut.nid||st),Vn=Oe[vn];Vn&&(je=Vn.serialize(je,ut));var li=je,Ir=je.nss;return li.path=(st||ut.nid)+":"+Ir,li}},dl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Gd={scheme:"urn:uuid",parse:function(je,ut){var St=je;return St.uuid=St.nss,St.nss=void 0,!ut.tolerant&&(!St.uuid||!St.uuid.match(dl))&&(St.error=St.error||"UUID is not valid."),St},serialize:function(je,ut){var St=je;return St.nss=(je.uuid||"").toLowerCase(),St}};Oe[kt.scheme]=kt,Oe[Ln.scheme]=Ln,Oe[Ni.scheme]=Ni,Oe[Yi.scheme]=Yi,Oe[_c.scheme]=_c,Oe[Ca.scheme]=Ca,Oe[Gd.scheme]=Gd,t.SCHEMES=Oe,t.pctEncChar=le,t.pctDecChars=re,t.parse=ie,t.removeDotSegments=ge,t.serialize=be,t.resolveComponents=Pe,t.resolve=pt,t.normalize=Dt,t.equal=Qt,t.escapeComponent=dt,t.unescapeComponent=mt,Object.defineProperty(t,"__esModule",{value:!0})})});var K8=b((rXr,Uat)=>{"use strict";Uat.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}});var Hat=b((iXr,Gat)=>{"use strict";Gat.exports=function(e){for(var n=0,r=e.length,i=0,o;i<r;)n++,o=e.charCodeAt(i++),o>=55296&&o<=56319&&i<r&&(o=e.charCodeAt(i),(o&64512)==56320&&i++);return n}});var QN=b((oXr,$at)=>{"use strict";$at.exports={copy:wLn,checkDataType:ZSe,checkDataTypes:RLn,coerceToTypes:BLn,toHash:t_e,getProperty:n_e,escapeQuotes:r_e,equal:K8(),ucs2length:Hat(),varOccurences:MLn,varReplace:FLn,schemaHasRules:LLn,schemaHasRulesExcept:PLn,schemaUnknownRules:QLn,toQuotedString:e_e,getPathExpr:kLn,getPath:ULn,getData:qLn,unescapeFragment:VLn,unescapeJsonPointer:o_e,escapeFragment:$Ln,escapeJsonPointer:i_e};function wLn(t,e){e=e||{};for(var n in t)e[n]=t[n];return e}function ZSe(t,e,n,r){var i=r?" !== ":" === ",o=r?" || ":" && ",s=r?"!":"",a=r?"":"!";switch(t){case"null":return e+i+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+o+"typeof "+e+i+'"object"'+o+a+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+i+'"number"'+o+a+"("+e+" % 1)"+o+e+i+e+(n?o+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+i+'"'+t+'"'+(n?o+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+i+'"'+t+'"'}}function RLn(t,e,n){switch(t.length){case 1:return ZSe(t[0],e,n,!0);default:var r="",i=t_e(t);i.array&&i.object&&(r=i.null?"(":"(!"+e+" || ",r+="typeof "+e+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer;for(var o in i)r+=(r?" && ":"")+ZSe(o,e,n,!0);return r}}var qat=t_e(["string","number","integer","boolean","null"]);function BLn(t,e){if(Array.isArray(e)){for(var n=[],r=0;r<e.length;r++){var i=e[r];(qat[i]||t==="array"&&i==="array")&&(n[n.length]=i)}if(n.length)return n}else{if(qat[e])return[e];if(t==="array"&&e==="array")return["array"]}}function t_e(t){for(var e={},n=0;n<t.length;n++)e[t[n]]=!0;return e}var NLn=/^[a-z$_][a-z$_0-9]*$/i,OLn=/'|\\/g;function n_e(t){return typeof t=="number"?"["+t+"]":NLn.test(t)?"."+t:"['"+r_e(t)+"']"}function r_e(t){return t.replace(OLn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function MLn(t,e){e+="[^0-9]";var n=t.match(new RegExp(e,"g"));return n?n.length:0}function FLn(t,e,n){return e+="([^0-9])",n=n.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),n+"$1")}function LLn(t,e){if(typeof t=="boolean")return!t;for(var n in t)if(e[n])return!0}function PLn(t,e,n){if(typeof t=="boolean")return!t&&n!="not";for(var r in t)if(r!=n&&e[r])return!0}function QLn(t,e){if(typeof t!="boolean"){for(var n in t)if(!e[n])return n}}function e_e(t){return"'"+r_e(t)+"'"}function kLn(t,e,n,r){var i=n?"'/' + "+e+(r?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):r?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Vat(t,i)}function ULn(t,e,n){var r=e_e(n?"/"+i_e(e):n_e(e));return Vat(t,r)}var GLn=/^\/(?:[^~]|~0|~1)*$/,HLn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qLn(t,e,n){var r,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!GLn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(HLn),!s)throw new Error("Invalid JSON-pointer: "+t);if(r=+s[1],i=s[2],i=="#"){if(r>=e)throw new Error("Cannot access property/index "+r+" levels up, current level is "+e);return n[e-r]}if(r>e)throw new Error("Cannot access data "+r+" levels up, current level is "+e);if(o="data"+(e-r||""),!i)return o}for(var a=o,l=i.split("/"),u=0;u<l.length;u++){var c=l[u];c&&(o+=n_e(o_e(c)),a+=" && "+o)}return a}function Vat(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function VLn(t){return o_e(decodeURIComponent(t))}function $Ln(t){return encodeURIComponent(i_e(t))}function i_e(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function o_e(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var s_e=b((sXr,Yat)=>{"use strict";var YLn=QN();Yat.exports=jLn;function jLn(t){YLn.copy(t,this)}});var Wat=b((aXr,jat)=>{"use strict";var fx=jat.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};ZZ(e,r,i,t,"",t)};fx.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};fx.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};fx.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};fx.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 ZZ(t,e,n,r,i,o,s,a,l,u){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,o,s,a,l,u);for(var c in r){var d=r[c];if(Array.isArray(d)){if(c in fx.arrayKeywords)for(var h=0;h<d.length;h++)ZZ(t,e,n,d[h],i+"/"+c+"/"+h,o,i,c,r,h)}else if(c in fx.propsKeywords){if(d&&typeof d=="object")for(var m in d)ZZ(t,e,n,d[m],i+"/"+c+"/"+WLn(m),o,i,c,r,m)}else(c in fx.keywords||t.allKeys&&!(c in fx.skipKeywords))&&ZZ(t,e,n,d,i+"/"+c,o,i,c,r)}n(r,i,o,s,a,l,u)}}function WLn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var oee=b((lXr,Xat)=>{"use strict";var EG=kat(),zat=K8(),ree=QN(),eee=s_e(),zLn=Wat();Xat.exports=hx;hx.normalizeId=px;hx.fullPath=tee;hx.url=nee;hx.ids=ePn;hx.inlineRef=a_e;hx.schema=iee;function hx(t,e,n){var r=this._refs[n];if(typeof r=="string")if(this._refs[r])r=this._refs[r];else return hx.call(this,t,e,r);if(r=r||this._schemas[n],r instanceof eee)return a_e(r.schema,this._opts.inlineRefs)?r.schema:r.validate||this._compile(r);var i=iee.call(this,e,n),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof eee?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=a_e(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function iee(t,e){var n=EG.parse(e),r=Kat(n),i=tee(this._getId(t.schema));if(Object.keys(t.schema).length===0||r!==i){var o=px(r),s=this._refs[o];if(typeof s=="string")return JLn.call(this,t,s,n);if(s instanceof eee)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof eee){if(s.validate||this._compile(s),o==px(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=tee(this._getId(t.schema))}return Jat.call(this,n,i,t.schema,t)}function JLn(t,e,n){var r=iee.call(this,t,e);if(r){var i=r.schema,o=r.baseId;t=r.root;var s=this._getId(i);return s&&(o=nee(o,s)),Jat.call(this,n,o,i,t)}}var KLn=ree.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Jat(t,e,n,r){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var i=t.fragment.split("/"),o=1;o<i.length;o++){var s=i[o];if(s){if(s=ree.unescapeFragment(s),n=n[s],n===void 0)break;var a;if(!KLn[s]&&(a=this._getId(n),a&&(e=nee(e,a)),n.$ref)){var l=nee(e,n.$ref),u=iee.call(this,r,l);u&&(n=u.schema,r=u.root,e=u.baseId)}}}if(n!==void 0&&n!==r.schema)return{schema:n,root:r,baseId:e}}}var XLn=ree.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function a_e(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return l_e(t);if(e)return u_e(t)<=e}function l_e(t){var e;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(e=t[n],typeof e=="object"&&!l_e(e))return!1}else for(var r in t)if(r=="$ref"||(e=t[r],typeof e=="object"&&!l_e(e)))return!1;return!0}function u_e(t){var e=0,n;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(n=t[r],typeof n=="object"&&(e+=u_e(n)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(XLn[i])e++;else if(n=t[i],typeof n=="object"&&(e+=u_e(n)+1),e==1/0)return 1/0}return e}function tee(t,e){e!==!1&&(t=px(t));var n=EG.parse(t);return Kat(n)}function Kat(t){return EG.serialize(t).split("#")[0]+"#"}var ZLn=/#\/?$/;function px(t){return t?t.replace(ZLn,""):""}function nee(t,e){return e=px(e),EG.resolve(t,e)}function ePn(t){var e=px(this._getId(t)),n={"":e},r={"":tee(e,!1)},i={},o=this;return zLn(t,{allKeys:!0},function(s,a,l,u,c,d,h){if(a!==""){var m=o._getId(s),E=n[u],y=r[u]+"/"+c;if(h!==void 0&&(y+="/"+(typeof h=="number"?h:ree.escapeFragment(h))),typeof m=="string"){m=E=px(E?EG.resolve(E,m):m);var C=o._refs[m];if(typeof C=="string"&&(C=o._refs[C]),C&&C.schema){if(!zat(s,C.schema))throw new Error('id "'+m+'" resolves to more than one schema')}else if(m!=px(y))if(m[0]=="#"){if(i[m]&&!zat(s,i[m]))throw new Error('id "'+m+'" resolves to more than one schema');i[m]=s}else o._refs[m]=y}n[a]=E,r[a]=y}}),i}});var see=b((uXr,elt)=>{"use strict";var c_e=oee();elt.exports={Validation:Zat(tPn),MissingRef:Zat(d_e)};function tPn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}d_e.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function d_e(t,e,n){this.message=n||d_e.message(t,e),this.missingRef=c_e.url(t,e),this.missingSchema=c_e.normalizeId(c_e.fullPath(this.missingRef))}function Zat(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var f_e=b((cXr,tlt)=>{"use strict";tlt.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var n=typeof e.cycles=="boolean"?e.cycles:!1,r=e.cmp&&function(o){return function(s){return function(a,l){var u={key:a,value:s[a]},c={key:l,value:s[l]};return o(u,c)}}}(e.cmp),i=[];return function o(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var a,l;if(Array.isArray(s)){for(l="[",a=0;a<s.length;a++)a&&(l+=","),l+=o(s[a])||"null";return l+"]"}if(s===null)return"null";if(i.indexOf(s)!==-1){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=i.push(s)-1,c=Object.keys(s).sort(r&&r(s));for(l="",a=0;a<c.length;a++){var d=c[a],h=o(s[d]);h&&(l&&(l+=","),l+=JSON.stringify(d)+":"+h)}return i.splice(u,1),"{"+l+"}"}}(t)}});var p_e=b((dXr,nlt)=>{"use strict";nlt.exports=function(e,n,r){var i="",o=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),a=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var u="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(i+=" var validate = ",o&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",a&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" "+("/*# sourceURL="+a+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var n="false schema",c=e.level,d=e.dataLevel,h=e.schema[n],m=e.schemaPath+e.util.getProperty(n),E=e.errSchemaPath+"/"+n,F=!e.opts.allErrors,j,y="data"+(d||""),R="valid"+c;if(e.schema===!1){e.isTop?F=!0:i+=" var "+R+" = false; ";var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+R+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var w=e.isTop,c=e.level=0,d=e.dataLevel=0,y="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var B="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var c=e.level,d=e.dataLevel,y="data"+(d||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+c+" = errors;"}var R="valid"+c,F=!e.opts.allErrors,q="",J="",j,L=e.schema.type,K=Array.isArray(L);if(L&&e.opts.nullable&&e.schema.nullable===!0&&(K?L.indexOf("null")==-1&&(L=L.concat("null")):L!="null"&&(L=[L,"null"],K=!0)),K&&L.length==1&&(L=L[0],K=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),L){if(e.opts.coerceTypes)var U=e.util.coerceToTypes(e.opts.coerceTypes,L);var se=e.RULES.types[L];if(U||K||se===!0||se&&!H(se)){var m=e.schemaPath+".type",E=e.errSchemaPath+"/type",m=e.schemaPath+".type",E=e.errSchemaPath+"/type",V=K?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[V](L,y,e.opts.strictNumbers,!0)+") { ",U){var O="dataType"+c,Y="coerced"+c;i+=" var "+O+" = typeof "+y+"; var "+Y+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+O+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+O+" = typeof "+y+"; if ("+e.util.checkDataType(e.schema.type,y,e.opts.strictNumbers)+") "+Y+" = "+y+"; } "),i+=" if ("+Y+" !== undefined) ; ";var ee=U;if(ee)for(var ne,Ae=-1,Ce=ee.length-1;Ae<Ce;)ne=ee[Ae+=1],ne=="string"?i+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+Y+" = '' + "+y+"; else if ("+y+" === null) "+Y+" = ''; ":ne=="number"||ne=="integer"?(i+=" else if ("+O+" == 'boolean' || "+y+" === null || ("+O+" == 'string' && "+y+" && "+y+" == +"+y+" ",ne=="integer"&&(i+=" && !("+y+" % 1)"),i+=")) "+Y+" = +"+y+"; "):ne=="boolean"?i+=" else if ("+y+" === 'false' || "+y+" === 0 || "+y+" === null) "+Y+" = false; else if ("+y+" === 'true' || "+y+" === 1) "+Y+" = true; ":ne=="null"?i+=" else if ("+y+" === '' || "+y+" === 0 || "+y+" === false) "+Y+" = null; ":e.opts.coerceTypes=="array"&&ne=="array"&&(i+=" else if ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+y+" == null) "+Y+" = ["+y+"]; ");i+=" else { ";var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+Y+" !== undefined) { ";var De=d?"data"+(d-1||""):"parentData",Ue=d?e.dataPathArr[d]:"parentDataProperty";i+=" "+y+" = "+Y+"; ",d||(i+="if ("+De+" !== undefined)"),i+=" "+De+"["+Ue+"] = "+Y+"; } "}else{var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",F&&(i+=" } if (errors === ",w?i+="0":i+="errs_"+c,i+=") { ",J+="}");else{var qe=e.RULES;if(qe){for(var se,Ie=-1,xe=qe.length-1;Ie<xe;)if(se=qe[Ie+=1],H(se)){if(se.type&&(i+=" if ("+e.util.checkDataType(se.type,y,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(se.type=="object"&&e.schema.properties){var h=e.schema.properties,Oe=Object.keys(h),le=Oe;if(le)for(var re,ye=-1,X=le.length-1;ye<X;){re=le[ye+=1];var he=h[re];if(he.default!==void 0){var ae=y+e.util.getProperty(re);if(e.compositeRule){if(e.opts.strictDefaults){var B="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(he.default)+" ":i+=" "+JSON.stringify(he.default)+" ",i+="; "}}}else if(se.type=="array"&&Array.isArray(e.schema.items)){var me=e.schema.items;if(me){for(var he,Ae=-1,Se=me.length-1;Ae<Se;)if(he=me[Ae+=1],he.default!==void 0){var ae=y+"["+Ae+"]";if(e.compositeRule){if(e.opts.strictDefaults){var B="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(he.default)+" ":i+=" "+JSON.stringify(he.default)+" ",i+="; "}}}}var ie=se.rules;if(ie){for(var k,W=-1,pe=ie.length-1;W<pe;)if(k=ie[W+=1],ge(k)){var te=k.code(e,k.keyword,se.type);te&&(i+=" "+te+" ",F&&(q+="}"))}}if(F&&(i+=" "+q+" ",q=""),se.type&&(i+=" } ",L&&L===se.type&&!U)){i+=" else { ";var m=e.schemaPath+".type",E=e.errSchemaPath+"/type",C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}F&&(i+=" if (errors === ",w?i+="0":i+="errs_"+c,i+=") { ",J+="}")}}}F&&(i+=" "+J+" "),w?(o?(i+=" if (errors === 0) return data; ",i+=" else throw new ValidationError(vErrors); "):(i+=" validate.errors = vErrors; ",i+=" return errors === 0; "),i+=" }; return validate;"):i+=" var "+R+" = errors === errs_"+c+";";function H(Pe){for(var pt=Pe.rules,Dt=0;Dt<pt.length;Dt++)if(ge(pt[Dt]))return!0}function ge(Pe){return e.schema[Pe.keyword]!==void 0||Pe.implements&&be(Pe)}function be(Pe){for(var pt=Pe.implements,Dt=0;Dt<pt.length;Dt++)if(e.schema[pt[Dt]]!==void 0)return!0}return i}});var alt=b((fXr,slt)=>{"use strict";var aee=oee(),uee=QN(),ilt=see(),nPn=f_e(),rlt=p_e(),rPn=uee.ucs2length,iPn=K8(),oPn=ilt.Validation;slt.exports=h_e;function h_e(t,e,n,r){var i=this,o=this._opts,s=[void 0],a={},l=[],u={},c=[],d={},h=[];e=e||{schema:t,refVal:s,refs:a};var m=sPn.call(this,t,e,r),E=this._compilations[m.index];if(m.compiling)return E.callValidate=B;var y=this._formats,C=this.RULES;try{var _=R(t,e,n,r);E.validate=_;var w=E.callValidate;return w&&(w.schema=_.schema,w.errors=null,w.refs=_.refs,w.refVal=_.refVal,w.root=_.root,w.$async=_.$async,o.sourceCode&&(w.source=_.source)),_}finally{aPn.call(this,t,e,r)}function B(){var V=E.validate,O=V.apply(this,arguments);return B.errors=V.errors,O}function R(V,O,Y,ee){var ne=!O||O&&O.schema==V;if(O.schema!=e.schema)return h_e.call(i,V,O,Y,ee);var Ae=V.$async===!0,Ce=rlt({isTop:!0,schema:V,isRoot:ne,baseId:ee,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:ilt.MissingRef,RULES:C,validate:rlt,util:uee,resolve:aee,resolveRef:F,usePattern:K,useDefault:U,useCustomRule:se,opts:o,formats:y,logger:i.logger,self:i});Ce=lee(s,cPn)+lee(l,lPn)+lee(c,uPn)+lee(h,dPn)+Ce,o.processCode&&(Ce=o.processCode(Ce,V));var De;try{var Ue=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ce);De=Ue(i,C,y,e,s,c,h,iPn,rPn,oPn),s[0]=De}catch(qe){throw i.logger.error("Error compiling schema, function code:",Ce),qe}return De.schema=V,De.errors=null,De.refs=a,De.refVal=s,De.root=ne?De:O,Ae&&(De.$async=!0),o.sourceCode===!0&&(De.source={code:Ce,patterns:l,defaults:c}),De}function F(V,O,Y){O=aee.url(V,O);var ee=a[O],ne,Ae;if(ee!==void 0)return ne=s[ee],Ae="refVal["+ee+"]",L(ne,Ae);if(!Y&&e.refs){var Ce=e.refs[O];if(Ce!==void 0)return ne=e.refVal[Ce],Ae=q(O,ne),L(ne,Ae)}Ae=q(O);var De=aee.call(i,R,e,O);if(De===void 0){var Ue=n&&n[O];Ue&&(De=aee.inlineRef(Ue,o.inlineRefs)?Ue:h_e.call(i,Ue,e,n,V))}if(De===void 0)J(O);else return j(O,De),L(De,Ae)}function q(V,O){var Y=s.length;return s[Y]=O,a[V]=Y,"refVal"+Y}function J(V){delete a[V]}function j(V,O){var Y=a[V];s[Y]=O}function L(V,O){return typeof V=="object"||typeof V=="boolean"?{code:O,schema:V,inline:!0}:{code:O,$async:V&&!!V.$async}}function K(V){var O=u[V];return O===void 0&&(O=u[V]=l.length,l[O]=V),"pattern"+O}function U(V){switch(typeof V){case"boolean":case"number":return""+V;case"string":return uee.toQuotedString(V);case"object":if(V===null)return"null";var O=nPn(V),Y=d[O];return Y===void 0&&(Y=d[O]=c.length,c[Y]=V),"default"+Y}}function se(V,O,Y,ee){if(i._opts.validateSchema!==!1){var ne=V.definition.dependencies;if(ne&&!ne.every(function(le){return Object.prototype.hasOwnProperty.call(Y,le)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ae=V.definition.validateSchema;if(Ae){var Ce=Ae(O);if(!Ce){var De="keyword schema is invalid: "+i.errorsText(Ae.errors);if(i._opts.validateSchema=="log")i.logger.error(De);else throw new Error(De)}}}var Ue=V.definition.compile,qe=V.definition.inline,Ie=V.definition.macro,xe;if(Ue)xe=Ue.call(i,O,Y,ee);else if(Ie)xe=Ie.call(i,O,Y,ee),o.validateSchema!==!1&&i.validateSchema(xe,!0);else if(qe)xe=qe.call(i,ee,V.keyword,O,Y);else if(xe=V.definition.validate,!xe)return;if(xe===void 0)throw new Error('custom keyword "'+V.keyword+'"failed to compile');var Oe=h.length;return h[Oe]=xe,{code:"customRule"+Oe,validate:xe}}}function sPn(t,e,n){var r=olt.call(this,t,e,n);return r>=0?{index:r,compiling:!0}:(r=this._compilations.length,this._compilations[r]={schema:t,root:e,baseId:n},{index:r,compiling:!1})}function aPn(t,e,n){var r=olt.call(this,t,e,n);r>=0&&this._compilations.splice(r,1)}function olt(t,e,n){for(var r=0;r<this._compilations.length;r++){var i=this._compilations[r];if(i.schema==t&&i.root==e&&i.baseId==n)return r}return-1}function lPn(t,e){return"var pattern"+t+" = new RegExp("+uee.toQuotedString(e[t])+");"}function uPn(t){return"var default"+t+" = defaults["+t+"];"}function cPn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function dPn(t){return"var customRule"+t+" = customRules["+t+"];"}function lee(t,e){if(!t.length)return"";for(var n="",r=0;r<t.length;r++)n+=e(r,t);return n}});var ult=b((pXr,llt)=>{"use strict";var cee=llt.exports=function(){this._cache={}};cee.prototype.put=function(e,n){this._cache[e]=n};cee.prototype.get=function(e){return this._cache[e]};cee.prototype.del=function(e){delete this._cache[e]};cee.prototype.clear=function(){this._cache={}}});var vlt=b((hXr,Clt)=>{"use strict";var fPn=QN(),pPn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hPn=[0,31,28,31,30,31,30,31,31,30,31,30,31],mPn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,clt=/^(?=.{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,APn=/^(?:[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,gPn=/^(?:[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,dlt=/^(?:(?:[^\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,flt=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,plt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,hlt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,mlt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Alt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Clt.exports=dee;function dee(t){return t=t=="full"?"full":"fast",fPn.copy(dee[t])}dee.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":dlt,url:flt,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,hostname:clt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ylt,uuid:plt,"json-pointer":hlt,"json-pointer-uri-fragment":mlt,"relative-json-pointer":Alt};dee.full={date:glt,time:Elt,"date-time":CPn,uri:DPn,"uri-reference":gPn,"uri-template":dlt,url:flt,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:clt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ylt,uuid:plt,"json-pointer":hlt,"json-pointer-uri-fragment":mlt,"relative-json-pointer":Alt};function EPn(t){return t%4===0&&(t%100!==0||t%400===0)}function glt(t){var e=t.match(pPn);if(!e)return!1;var n=+e[1],r=+e[2],i=+e[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&EPn(n)?29:hPn[r])}function Elt(t,e){var n=t.match(mPn);if(!n)return!1;var r=n[1],i=n[2],o=n[3],s=n[5];return(r<=23&&i<=59&&o<=59||r==23&&i==59&&o==60)&&(!e||s)}var yPn=/t|\s/i;function CPn(t){var e=t.split(yPn);return e.length==2&&glt(e[0])&&Elt(e[1],!0)}var vPn=/\/|:/;function DPn(t){return vPn.test(t)&&APn.test(t)}var SPn=/[^\\]\\Z/;function ylt(t){if(SPn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Slt=b((mXr,Dlt)=>{"use strict";Dlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.errSchemaPath+"/"+n,u=!e.opts.allErrors,c="data"+(s||""),d="valid"+o,h,m;if(a=="#"||a=="#/")e.isRoot?(h=e.async,m="validate"):(h=e.root.schema.$async===!0,m="root.refVal[0]");else{var E=e.resolveRef(e.baseId,a,e.isRoot);if(E===void 0){var y=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(y);var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(a)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(a)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(a)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(y),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,y)}else if(E.inline){var w=e.util.copy(e);w.level++;var B="valid"+w.level;w.schema=E.schema,w.schemaPath="",w.errSchemaPath=a;var R=e.validate(w).replace(/validate\.schema/g,E.code);i+=" "+R+" ",u&&(i+=" if ("+B+") { ")}else h=E.$async===!0||e.async&&E.$async!==!1,m=E.code}if(m){var C=C||[];C.push(i),i="",e.opts.passContext?i+=" "+m+".call(this, ":i+=" "+m+"( ",i+=" "+c+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var F=s?"data"+(s-1||""):"parentData",q=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+F+" , "+q+", rootData) ";var J=i;if(i=C.pop(),h){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+d+"; "),i+=" try { await "+J+"; ",u&&(i+=" "+d+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+d+" = false; "),i+=" } ",u&&(i+=" if ("+d+") { ")}else i+=" if (!"+J+") { if (vErrors === null) vErrors = "+m+".errors; else vErrors = vErrors.concat("+m+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var Ilt=b((AXr,_lt)=>{"use strict";_lt.exports=function(e,n,r){var i=" ",o=e.schema[n],s=e.schemaPath+e.util.getProperty(n),a=e.errSchemaPath+"/"+n,l=!e.opts.allErrors,u=e.util.copy(e),c="";u.level++;var d="valid"+u.level,h=u.baseId,m=!0,E=o;if(E)for(var y,C=-1,_=E.length-1;C<_;)y=E[C+=1],(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all))&&(m=!1,u.schema=y,u.schemaPath=s+"["+C+"]",u.errSchemaPath=a+"/"+C,i+=" "+e.validate(u)+" ",u.baseId=h,l&&(i+=" if ("+d+") { ",c+="}"));return l&&(m?i+=" if (true) { ":i+=" "+c.slice(0,-1)+" "),i}});var blt=b((gXr,Tlt)=>{"use strict";Tlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_=a.every(function(j){return e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all)});if(_){var w=E.baseId;i+=" var "+m+" = errors; var "+h+" = false; ";var B=e.compositeRule;e.compositeRule=E.compositeRule=!0;var R=a;if(R)for(var F,q=-1,J=R.length-1;q<J;)F=R[q+=1],E.schema=F,E.schemaPath=l+"["+q+"]",E.errSchemaPath=u+"/"+q,i+=" "+e.validate(E)+" ",E.baseId=w,i+=" "+h+" = "+h+" || "+C+"; if (!"+h+") { ",y+="}";e.compositeRule=E.compositeRule=B,i+=" "+y+" if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else c&&(i+=" if (true) { ");return i}});var wlt=b((EXr,xlt)=>{"use strict";xlt.exports=function(e,n,r){var i=" ",o=e.schema[n],s=e.errSchemaPath+"/"+n,a=!e.opts.allErrors,l=e.util.toQuotedString(o);return e.opts.$comment===!0?i+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(i+=" self._opts.$comment("+l+", "+e.util.toQuotedString(s)+", validate.root.schema);"),i}});var Blt=b((yXr,Rlt)=>{"use strict";Rlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a,m||(i+=" var schema"+o+" = validate.schema"+l+";"),i+="var "+h+" = equal("+d+", schema"+o+"); if (!"+h+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to constant' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var C=i;return i=y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+C+"]); ":i+=" validate.errors = ["+C+"]; return false; ":i+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",c&&(i+=" else { "),i}});var Olt=b((CXr,Nlt)=>{"use strict";Nlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_="i"+o,w=E.dataLevel=e.dataLevel+1,B="data"+w,R=e.baseId,F=e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all);if(i+="var "+m+" = errors;var "+h+";",F){var q=e.compositeRule;e.compositeRule=E.compositeRule=!0,E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" var "+C+" = false; for (var "+_+" = 0; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var J=d+"["+_+"]";E.dataPathArr[w]=_;var j=e.validate(E);E.baseId=R,e.util.varOccurences(j,B)<2?i+=" "+e.util.varReplace(j,B,J)+" ":i+=" var "+B+" = "+J+"; "+j+" ",i+=" if ("+C+") break; } ",e.compositeRule=E.compositeRule=q,i+=" "+y+" if (!"+C+") {"}else i+=" if ("+d+".length == 0) {";var L=L||[];L.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should contain a valid item' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var K=i;return i=L.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+K+"]); ":i+=" validate.errors = ["+K+"]; return false; ":i+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",F&&(i+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var Flt=b((vXr,Mlt)=>{"use strict";Mlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level,C={},_={},w=e.opts.ownProperties;for(q in a)if(q!="__proto__"){var B=a[q],R=Array.isArray(B)?_:C;R[q]=B}i+="var "+h+" = errors;";var F=e.errorPath;i+="var missing"+o+";";for(var q in _)if(R=_[q],R.length){if(i+=" if ( "+d+e.util.getProperty(q)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),c){i+=" && ( ";var J=R;if(J)for(var j,L=-1,K=J.length-1;L<K;){j=J[L+=1],L&&(i+=" || ");var U=e.util.getProperty(j),se=d+U;i+=" ( ( "+se+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?j:U)+") ) "}i+=")) { ";var V="missing"+o,O="' + "+V+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(F,V,!0):F+" + "+V);var Y=Y||[];Y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+O+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",R.length==1?i+="property "+e.util.escapeQuotes(R[0]):i+="properties "+e.util.escapeQuotes(R.join(", ")),i+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ee=i;i=Y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ee+"]); ":i+=" validate.errors = ["+ee+"]; return false; ":i+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{i+=" ) { ";var ne=R;if(ne)for(var j,Ae=-1,Ce=ne.length-1;Ae<Ce;){j=ne[Ae+=1];var U=e.util.getProperty(j),O=e.util.escapeQuotes(j),se=d+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(F,j,e.opts.jsonPointers)),i+=" if ( "+se+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+O+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",R.length==1?i+="property "+e.util.escapeQuotes(R[0]):i+="properties "+e.util.escapeQuotes(R.join(", ")),i+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",c&&(E+="}",i+=" else { ")}e.errorPath=F;var De=m.baseId;for(var q in C){var B=C[q];(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))&&(i+=" "+y+" = true; if ( "+d+e.util.getProperty(q)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),i+=") { ",m.schema=B,m.schemaPath=l+e.util.getProperty(q),m.errSchemaPath=u+"/"+e.util.escapeFragment(q),i+=" "+e.validate(m)+" ",m.baseId=De,i+=" } ",c&&(i+=" if ("+y+") { ",E+="}"))}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var Plt=b((DXr,Llt)=>{"use strict";Llt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a;var y="i"+o,C="schema"+o;m||(i+=" var "+C+" = validate.schema"+l+";"),i+="var "+h+";",m&&(i+=" if (schema"+o+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+o+")) "+h+" = false; else {"),i+=""+h+" = false;for (var "+y+"=0; "+y+"<"+C+".length; "+y+"++) if (equal("+d+", "+C+"["+y+"])) { "+h+" = true; break; }",m&&(i+=" } "),i+=" if (!"+h+") { ";var _=_||[];_.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var w=i;return i=_.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",c&&(i+=" else { "),i}});var klt=b((SXr,Qlt)=>{"use strict";Qlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||"");if(e.opts.format===!1)return c&&(i+=" if (true) { "),i;var h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=e.opts.unknownFormats,y=Array.isArray(E);if(h){var C="format"+o,_="isObject"+o,w="formatType"+o;i+=" var "+C+" = formats["+m+"]; var "+_+" = typeof "+C+" == 'object' && !("+C+" instanceof RegExp) && "+C+".validate; var "+w+" = "+_+" && "+C+".type || 'string'; if ("+_+") { ",e.async&&(i+=" var async"+o+" = "+C+".async; "),i+=" "+C+" = "+C+".validate; } if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),i+=" (",E!="ignore"&&(i+=" ("+m+" && !"+C+" ",y&&(i+=" && self._opts.unknownFormats.indexOf("+m+") == -1 "),i+=") || "),i+=" ("+C+" && "+w+" == '"+r+"' && !(typeof "+C+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+C+"("+d+") : "+C+"("+d+")) ":i+=" "+C+"("+d+") ",i+=" : "+C+".test("+d+"))))) {"}else{var C=e.formats[a];if(!C){if(E=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(i+=" if (true) { "),i;if(y&&E.indexOf(a)>=0)return c&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var _=typeof C=="object"&&!(C instanceof RegExp)&&C.validate,w=_&&C.type||"string";if(_){var B=C.async===!0;C=C.validate}if(w!=r)return c&&(i+=" if (true) { "),i;if(B){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+R+"("+d+"))) { "}else{i+=" if (! ";var R="formats"+e.util.getProperty(a);_&&(R+=".validate"),typeof C=="function"?i+=" "+R+"("+d+") ":i+=" "+R+".test("+d+") ",i+=") { "}}var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",h?i+=""+m:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match format "`,h?i+="' + "+m+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var q=i;return i=F.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+q+"]); ":i+=" validate.errors = ["+q+"]; return false; ":i+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}});var Glt=b((_Xr,Ult)=>{"use strict";Ult.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e);E.level++;var y="valid"+E.level,C=e.schema.then,_=e.schema.else,w=C!==void 0&&(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all)),B=_!==void 0&&(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all)),R=E.baseId;if(w||B){var F;E.createErrors=!1,E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" var "+m+" = errors; var "+h+" = true; ";var q=e.compositeRule;e.compositeRule=E.compositeRule=!0,i+=" "+e.validate(E)+" ",E.baseId=R,E.createErrors=!0,i+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.compositeRule=E.compositeRule=q,w?(i+=" if ("+y+") { ",E.schema=e.schema.then,E.schemaPath=e.schemaPath+".then",E.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(E)+" ",E.baseId=R,i+=" "+h+" = "+y+"; ",w&&B?(F="ifClause"+o,i+=" var "+F+" = 'then'; "):F="'then'",i+=" } ",B&&(i+=" else { ")):i+=" if (!"+y+") { ",B&&(E.schema=e.schema.else,E.schemaPath=e.schemaPath+".else",E.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(E)+" ",E.baseId=R,i+=" "+h+" = "+y+"; ",w&&B?(F="ifClause"+o,i+=" var "+F+" = 'else'; "):F="'else'",i+=" } "),i+=" if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+F+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+F+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",c&&(i+=" else { ")}else c&&(i+=" if (true) { ");return i}});var qlt=b((IXr,Hlt)=>{"use strict";Hlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_="i"+o,w=E.dataLevel=e.dataLevel+1,B="data"+w,R=e.baseId;if(i+="var "+m+" = errors;var "+h+";",Array.isArray(a)){var F=e.schema.additionalItems;if(F===!1){i+=" "+h+" = "+d+".length <= "+a.length+"; ";var q=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+h+") { ";var J=J||[];J.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+a.length+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have more than "+a.length+" items' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var j=i;i=J.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+j+"]); ":i+=" validate.errors = ["+j+"]; return false; ":i+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=q,c&&(y+="}",i+=" else { ")}var L=a;if(L){for(var K,U=-1,se=L.length-1;U<se;)if(K=L[U+=1],e.opts.strictKeywords?typeof K=="object"&&Object.keys(K).length>0||K===!1:e.util.schemaHasRules(K,e.RULES.all)){i+=" "+C+" = true; if ("+d+".length > "+U+") { ";var V=d+"["+U+"]";E.schema=K,E.schemaPath=l+"["+U+"]",E.errSchemaPath=u+"/"+U,E.errorPath=e.util.getPathExpr(e.errorPath,U,e.opts.jsonPointers,!0),E.dataPathArr[w]=U;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",i+=" } ",c&&(i+=" if ("+C+") { ",y+="}")}}if(typeof F=="object"&&(e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all))){E.schema=F,E.schemaPath=e.schemaPath+".additionalItems",E.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+C+" = true; if ("+d+".length > "+a.length+") { for (var "+_+" = "+a.length+"; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var V=d+"["+_+"]";E.dataPathArr[w]=_;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",c&&(i+=" if (!"+C+") break; "),i+=" } } ",c&&(i+=" if ("+C+") { ",y+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" for (var "+_+" = 0; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var V=d+"["+_+"]";E.dataPathArr[w]=_;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",c&&(i+=" if (!"+C+") break; "),i+=" }"}return c&&(i+=" "+y+" if ("+m+" == errors) {"),i}});var m_e=b((TXr,Vlt)=>{"use strict";Vlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,R,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=n=="maximum",y=E?"exclusiveMaximum":"exclusiveMinimum",C=e.schema[y],_=e.opts.$data&&C&&C.$data,w=E?"<":">",B=E?">":"<",R=void 0;if(!(h||typeof a=="number"||a===void 0))throw new Error(n+" must be number");if(!(_||C===void 0||typeof C=="number"||typeof C=="boolean"))throw new Error(y+" must be number or boolean");if(_){var F=e.util.getData(C.$data,s,e.dataPathArr),q="exclusive"+o,J="exclType"+o,j="exclIsNumber"+o,L="op"+o,K="' + "+L+" + '";i+=" var schemaExcl"+o+" = "+F+"; ",F="schemaExcl"+o,i+=" var "+q+"; var "+J+" = typeof "+F+"; if ("+J+" != 'boolean' && "+J+" != 'undefined' && "+J+" != 'number') { ";var R=y,U=U||[];U.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+y+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var se=i;i=U.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+se+"]); ":i+=" validate.errors = ["+se+"]; return false; ":i+=" var err = "+se+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+J+" == 'number' ? ( ("+q+" = "+m+" === undefined || "+F+" "+w+"= "+m+") ? "+d+" "+B+"= "+F+" : "+d+" "+B+" "+m+" ) : ( ("+q+" = "+F+" === true) ? "+d+" "+B+"= "+m+" : "+d+" "+B+" "+m+" ) || "+d+" !== "+d+") { var op"+o+" = "+q+" ? '"+w+"' : '"+w+"='; ",a===void 0&&(R=y,u=e.errSchemaPath+"/"+y,m=F,h=_)}else{var j=typeof C=="number",K=w;if(j&&h){var L="'"+K+"'";i+=" if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" ( "+m+" === undefined || "+C+" "+w+"= "+m+" ? "+d+" "+B+"= "+C+" : "+d+" "+B+" "+m+" ) || "+d+" !== "+d+") { "}else{j&&a===void 0?(q=!0,R=y,u=e.errSchemaPath+"/"+y,m=C,B+="="):(j&&(m=Math[E?"min":"max"](C,a)),C===(j?m:!0)?(q=!0,R=y,u=e.errSchemaPath+"/"+y,B+="="):(q=!1,K+="="));var L="'"+K+"'";i+=" if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+d+" "+B+" "+m+" || "+d+" !== "+d+") { "}}R=R||n;var U=U||[];U.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+L+", limit: "+m+", exclusive: "+q+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+K+" ",h?i+="' + "+m:i+=""+m+"'"),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var se=i;return i=U.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+se+"]); ":i+=" validate.errors = ["+se+"]; return false; ":i+=" var err = "+se+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}});var A_e=b((bXr,$lt)=>{"use strict";$lt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxItems"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+d+".length "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",n=="maxItems"?i+="more":i+="fewer",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var g_e=b((xXr,Ylt)=>{"use strict";Ylt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxLength"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),e.opts.unicode===!1?i+=" "+d+".length ":i+=" ucs2length("+d+") ",i+=" "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be ",n=="maxLength"?i+="longer":i+="shorter",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var E_e=b((wXr,jlt)=>{"use strict";jlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxProperties"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" Object.keys("+d+").length "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",n=="maxProperties"?i+="more":i+="fewer",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var zlt=b((RXr,Wlt)=>{"use strict";Wlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");i+="var division"+o+";if (",h&&(i+=" "+m+" !== undefined && ( typeof "+m+" != 'number' || "),i+=" (division"+o+" = "+d+" / "+m+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+o+" !== parseInt(division"+o+") ",i+=" ) ",h&&(i+=" ) "),i+=" ) { ";var E=E||[];E.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be multiple of ",h?i+="' + "+m:i+=""+m+"'"),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=E.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var Klt=b((BXr,Jlt)=>{"use strict";Jlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e);m.level++;var E="valid"+m.level;if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=l,m.errSchemaPath=u,i+=" var "+h+" = errors; ";var y=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.createErrors=!1;var C;m.opts.allErrors&&(C=m.opts.allErrors,m.opts.allErrors=!1),i+=" "+e.validate(m)+" ",m.createErrors=!0,C&&(m.opts.allErrors=C),e.compositeRule=m.compositeRule=y,i+=" if ("+E+") { ";var _=_||[];_.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var w=i;i=_.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(i+=" if (false) { ");return i}});var Zlt=b((NXr,Xlt)=>{"use strict";Xlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_=E.baseId,w="prevValid"+o,B="passingSchemas"+o;i+="var "+m+" = errors , "+w+" = false , "+h+" = false , "+B+" = null; ";var R=e.compositeRule;e.compositeRule=E.compositeRule=!0;var F=a;if(F)for(var q,J=-1,j=F.length-1;J<j;)q=F[J+=1],(e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all))?(E.schema=q,E.schemaPath=l+"["+J+"]",E.errSchemaPath=u+"/"+J,i+=" "+e.validate(E)+" ",E.baseId=_):i+=" var "+C+" = true; ",J&&(i+=" if ("+C+" && "+w+") { "+h+" = false; "+B+" = ["+B+", "+J+"]; } else { ",y+="}"),i+=" if ("+C+") { "+h+" = "+w+" = true; "+B+" = "+J+"; }";return e.compositeRule=E.compositeRule=R,i+=""+y+"if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+B+" } ",e.opts.messages!==!1&&(i+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; }",e.opts.allErrors&&(i+=" } "),i}});var tut=b((OXr,eut)=>{"use strict";eut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=h?"(new RegExp("+m+"))":e.usePattern(a);i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),i+=" !"+E+".test("+d+") ) { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",h?i+=""+m:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match pattern "`,h?i+="' + "+m+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var C=i;return i=y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+C+"]); ":i+=" validate.errors = ["+C+"]; return false; ":i+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var rut=b((MXr,nut)=>{"use strict";nut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level,C="key"+o,_="idx"+o,w=m.dataLevel=e.dataLevel+1,B="data"+w,R="dataProperties"+o,F=Object.keys(a||{}).filter(Ae),q=e.schema.patternProperties||{},J=Object.keys(q).filter(Ae),j=e.schema.additionalProperties,L=F.length||J.length,K=j===!1,U=typeof j=="object"&&Object.keys(j).length,se=e.opts.removeAdditional,V=K||U||se,O=e.opts.ownProperties,Y=e.baseId,ee=e.schema.required;if(ee&&!(e.opts.$data&&ee.$data)&&ee.length<e.opts.loopRequired)var ne=e.util.toHash(ee);function Ae(mt){return mt!=="__proto__"}if(i+="var "+h+" = errors;var "+y+" = true;",O&&(i+=" var "+R+" = undefined;"),V){if(O?i+=" "+R+" = "+R+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+R+".length; "+_+"++) { var "+C+" = "+R+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",L){if(i+=" var isAdditional"+o+" = !(false ",F.length)if(F.length>8)i+=" || validate.schema"+l+".hasOwnProperty("+C+") ";else{var Ce=F;if(Ce)for(var De,Ue=-1,qe=Ce.length-1;Ue<qe;)De=Ce[Ue+=1],i+=" || "+C+" == "+e.util.toQuotedString(De)+" "}if(J.length){var Ie=J;if(Ie)for(var xe,Oe=-1,le=Ie.length-1;Oe<le;)xe=Ie[Oe+=1],i+=" || "+e.usePattern(xe)+".test("+C+") "}i+=" ); if (isAdditional"+o+") { "}if(se=="all")i+=" delete "+d+"["+C+"]; ";else{var re=e.errorPath,ye="' + "+C+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers)),K)if(se)i+=" delete "+d+"["+C+"]; ";else{i+=" "+y+" = false; ";var X=u;u=e.errSchemaPath+"/additionalProperties";var he=he||[];he.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ye+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is an invalid additional property":i+="should NOT have additional properties",i+="' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ae=i;i=he.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=X,c&&(i+=" break; ")}else if(U)if(se=="failing"){i+=" var "+h+" = errors; ";var me=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=j,m.schemaPath=e.schemaPath+".additionalProperties",m.errSchemaPath=e.errSchemaPath+"/additionalProperties",m.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",i+=" if (!"+y+") { errors = "+h+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+C+"]; } ",e.compositeRule=m.compositeRule=me}else{m.schema=j,m.schemaPath=e.schemaPath+".additionalProperties",m.errSchemaPath=e.errSchemaPath+"/additionalProperties",m.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",c&&(i+=" if (!"+y+") break; ")}e.errorPath=re}L&&(i+=" } "),i+=" } ",c&&(i+=" if ("+y+") { ",E+="}")}var k=e.opts.useDefaults&&!e.compositeRule;if(F.length){var W=F;if(W)for(var De,pe=-1,te=W.length-1;pe<te;){De=W[pe+=1];var H=a[De];if(e.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:e.util.schemaHasRules(H,e.RULES.all)){var ge=e.util.getProperty(De),Se=d+ge,be=k&&H.default!==void 0;m.schema=H,m.schemaPath=l+ge,m.errSchemaPath=u+"/"+e.util.escapeFragment(De),m.errorPath=e.util.getPath(e.errorPath,De,e.opts.jsonPointers),m.dataPathArr[w]=e.util.toQuotedString(De);var ie=e.validate(m);if(m.baseId=Y,e.util.varOccurences(ie,B)<2){ie=e.util.varReplace(ie,B,Se);var Pe=Se}else{var Pe=B;i+=" var "+B+" = "+Se+"; "}if(be)i+=" "+ie+" ";else{if(ne&&ne[De]){i+=" if ( "+Pe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=") { "+y+" = false; ";var re=e.errorPath,X=u,pt=e.util.escapeQuotes(De);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(re,De,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var he=he||[];he.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+pt+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+pt+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ae=i;i=he.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=X,e.errorPath=re,i+=" } else { "}else c?(i+=" if ( "+Pe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=") { "+y+" = true; } else { "):(i+=" if ("+Pe+" !== undefined ",O&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=" ) { ");i+=" "+ie+" } "}}c&&(i+=" if ("+y+") { ",E+="}")}}if(J.length){var Dt=J;if(Dt)for(var xe,Qt=-1,dt=Dt.length-1;Qt<dt;){xe=Dt[Qt+=1];var H=q[xe];if(e.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:e.util.schemaHasRules(H,e.RULES.all)){m.schema=H,m.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(xe),m.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(xe),O?i+=" "+R+" = "+R+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+R+".length; "+_+"++) { var "+C+" = "+R+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",i+=" if ("+e.usePattern(xe)+".test("+C+")) { ",m.errorPath=e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",c&&(i+=" if (!"+y+") break; "),i+=" } ",c&&(i+=" else "+y+" = true; "),i+=" } ",c&&(i+=" if ("+y+") { ",E+="}")}}}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var out=b((FXr,iut)=>{"use strict";iut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level;if(i+="var "+h+" = errors;",e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=l,m.errSchemaPath=u;var C="key"+o,_="idx"+o,w="i"+o,B="' + "+C+" + '",R=m.dataLevel=e.dataLevel+1,F="data"+R,q="dataProperties"+o,J=e.opts.ownProperties,j=e.baseId;J&&(i+=" var "+q+" = undefined; "),J?i+=" "+q+" = "+q+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+q+".length; "+_+"++) { var "+C+" = "+q+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",i+=" var startErrs"+o+" = errors; ";var L=C,K=e.compositeRule;e.compositeRule=m.compositeRule=!0;var U=e.validate(m);m.baseId=j,e.util.varOccurences(U,F)<2?i+=" "+e.util.varReplace(U,F,L)+" ":i+=" var "+F+" = "+L+"; "+U+" ",e.compositeRule=m.compositeRule=K,i+=" if (!"+y+") { for (var "+w+"=startErrs"+o+"; "+w+"<errors; "+w+"++) { vErrors["+w+"].propertyName = "+C+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+B+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),c&&(i+=" break; "),i+=" } }"}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var aut=b((LXr,sut)=>{"use strict";sut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a;var y="schema"+o;if(!m)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var C=[],_=a;if(_)for(var w,B=-1,R=_.length-1;B<R;){w=_[B+=1];var F=e.schema.properties[w];F&&(e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all))||(C[C.length]=w)}}else var C=a;if(m||C.length){var q=e.errorPath,J=m||C.length>=e.opts.loopRequired,j=e.opts.ownProperties;if(c)if(i+=" var missing"+o+"; ",J){m||(i+=" var "+y+" = validate.schema"+l+"; ");var L="i"+o,K="schema"+o+"["+L+"]",U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(q,K,e.opts.jsonPointers)),i+=" var "+h+" = true; ",m&&(i+=" if (schema"+o+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+o+")) "+h+" = false; else {"),i+=" for (var "+L+" = 0; "+L+" < "+y+".length; "+L+"++) { "+h+" = "+d+"["+y+"["+L+"]] !== undefined ",j&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+L+"]) "),i+="; if (!"+h+") break; } ",m&&(i+=" } "),i+=" if (!"+h+") { ";var se=se||[];se.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var V=i;i=se.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+V+"]); ":i+=" validate.errors = ["+V+"]; return false; ":i+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var O=C;if(O)for(var Y,L=-1,ee=O.length-1;L<ee;){Y=O[L+=1],L&&(i+=" || ");var ne=e.util.getProperty(Y),Ae=d+ne;i+=" ( ( "+Ae+" === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Y)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?Y:ne)+") ) "}i+=") { ";var K="missing"+o,U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(q,K,!0):q+" + "+K);var se=se||[];se.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var V=i;i=se.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+V+"]); ":i+=" validate.errors = ["+V+"]; return false; ":i+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(J){m||(i+=" var "+y+" = validate.schema"+l+"; ");var L="i"+o,K="schema"+o+"["+L+"]",U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(q,K,e.opts.jsonPointers)),m&&(i+=" if ("+y+" && !Array.isArray("+y+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+y+" !== undefined) { "),i+=" for (var "+L+" = 0; "+L+" < "+y+".length; "+L+"++) { if ("+d+"["+y+"["+L+"]] === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+y+"["+L+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",m&&(i+=" } ")}else{var Ce=C;if(Ce)for(var Y,De=-1,Ue=Ce.length-1;De<Ue;){Y=Ce[De+=1];var ne=e.util.getProperty(Y),U=e.util.escapeQuotes(Y),Ae=d+ne;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(q,Y,e.opts.jsonPointers)),i+=" if ( "+Ae+" === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Y)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=q}else c&&(i+=" if (true) {");return i}});var uut=b((PXr,lut)=>{"use strict";lut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;if(m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a,(a||m)&&e.opts.uniqueItems!==!1){m&&(i+=" var "+h+"; if ("+E+" === false || "+E+" === undefined) "+h+" = true; else if (typeof "+E+" != 'boolean') "+h+" = false; else { "),i+=" var i = "+d+".length , "+h+" = true , j; if (i > 1) { ";var y=e.schema.items&&e.schema.items.type,C=Array.isArray(y);if(!y||y=="object"||y=="array"||C&&(y.indexOf("object")>=0||y.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+h+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var _="checkDataType"+(C?"s":"");i+=" if ("+e.util[_](y,"item",e.opts.strictNumbers,!0)+") continue; ",C&&(i+=` if (typeof item == 'string') item = '"' + item; `),i+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",m&&(i+=" } "),i+=" if (!"+h+") { ";var w=w||[];w.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",m?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var B=i;i=w.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+B+"]); ":i+=" validate.errors = ["+B+"]; return false; ":i+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { ")}else c&&(i+=" if (true) { ");return i}});var dut=b((QXr,cut)=>{"use strict";cut.exports={$ref:Slt(),allOf:Ilt(),anyOf:blt(),$comment:wlt(),const:Blt(),contains:Olt(),dependencies:Flt(),enum:Plt(),format:klt(),if:Glt(),items:qlt(),maximum:m_e(),minimum:m_e(),maxItems:A_e(),minItems:A_e(),maxLength:g_e(),minLength:g_e(),maxProperties:E_e(),minProperties:E_e(),multipleOf:zlt(),not:Klt(),oneOf:Zlt(),pattern:tut(),properties:rut(),propertyNames:out(),required:aut(),uniqueItems:uut(),validate:p_e()}});var hut=b((kXr,put)=>{"use strict";var fut=dut(),y_e=QN().toHash;put.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],n=["type","$comment"],r=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],i=["number","integer","string","array","object","boolean","null"];return e.all=y_e(n),e.types=y_e(i),e.forEach(function(o){o.rules=o.rules.map(function(s){var a;if(typeof s=="object"){var l=Object.keys(s)[0];a=s[l],s=l,a.forEach(function(c){n.push(c),e.all[c]=!0})}n.push(s);var u=e.all[s]={keyword:s,code:fut[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:fut.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=y_e(n.concat(r)),e.custom={},e}});var gut=b((UXr,Aut)=>{"use strict";var mut=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Aut.exports=function(t,e){for(var n=0;n<e.length;n++){t=JSON.parse(JSON.stringify(t));var r=e[n].split("/"),i=t,o;for(o=1;o<r.length;o++)i=i[r[o]];for(o=0;o<mut.length;o++){var s=mut[o],a=i[s];a&&(i[s]={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}});var Cut=b((GXr,yut)=>{"use strict";var _Pn=see().MissingRef;yut.exports=Eut;function Eut(t,e,n){var r=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(n=e,e=void 0);var i=o(t).then(function(){var a=r._addSchema(t,void 0,e);return a.validate||s(a)});return n&&i.then(function(a){n(null,a)},n),i;function o(a){var l=a.$schema;return l&&!r.getSchema(l)?Eut.call(r,{$ref:l},!0):Promise.resolve()}function s(a){try{return r._compile(a)}catch(u){if(u instanceof _Pn)return l(u);throw u}function l(u){var c=u.missingSchema;if(m(c))throw new Error("Schema "+c+" is loaded but "+u.missingRef+" cannot be resolved");var d=r._loadingSchemas[c];return d||(d=r._loadingSchemas[c]=r._opts.loadSchema(c),d.then(h,h)),d.then(function(E){if(!m(c))return o(E).then(function(){m(c)||r.addSchema(E,c,void 0,e)})}).then(function(){return s(a)});function h(){delete r._loadingSchemas[c]}function m(E){return r._refs[E]||r._schemas[E]}}}}});var Dut=b((HXr,vut)=>{"use strict";vut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d,h="data"+(s||""),m="valid"+o,E="errs__"+o,y=e.opts.$data&&a&&a.$data,C;y?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",C="schema"+o):C=a;var _=this,w="definition"+o,B=_.definition,R="",F,q,J,j,L;if(y&&B.$data){L="keywordValidate"+o;var K=B.validateSchema;i+=" var "+w+" = RULES.custom['"+n+"'].definition; var "+L+" = "+w+".validate;"}else{if(j=e.useCustomRule(_,a,e.schema,e),!j)return;C="validate.schema"+l,L=j.code,F=B.compile,q=B.inline,J=B.macro}var U=L+".errors",se="i"+o,V="ruleErr"+o,O=B.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(q||J||(i+=""+U+" = null;"),i+="var "+E+" = errors;var "+m+";",y&&B.$data&&(R+="}",i+=" if ("+C+" === undefined) { "+m+" = true; } else { ",K&&(R+="}",i+=" "+m+" = "+w+".validateSchema("+C+"); if ("+m+") { ")),q)B.statements?i+=" "+j.validate+" ":i+=" "+m+" = "+j.validate+"; ";else if(J){var Y=e.util.copy(e),R="";Y.level++;var ee="valid"+Y.level;Y.schema=j.validate,Y.schemaPath="";var ne=e.compositeRule;e.compositeRule=Y.compositeRule=!0;var Ae=e.validate(Y).replace(/validate\.schema/g,L);e.compositeRule=Y.compositeRule=ne,i+=" "+Ae}else{var Ce=Ce||[];Ce.push(i),i="",i+=" "+L+".call( ",e.opts.passContext?i+="this":i+="self",F||B.schema===!1?i+=" , "+h+" ":i+=" , "+C+" , "+h+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var De=s?"data"+(s-1||""):"parentData",Ue=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+De+" , "+Ue+" , rootData ) ";var qe=i;i=Ce.pop(),B.errors===!1?(i+=" "+m+" = ",O&&(i+="await "),i+=""+qe+"; "):O?(U="customErrors"+o,i+=" var "+U+" = null; try { "+m+" = await "+qe+"; } catch (e) { "+m+" = false; if (e instanceof ValidationError) "+U+" = e.errors; else throw e; } "):i+=" "+U+" = null; "+m+" = "+qe+"; "}if(B.modifying&&(i+=" if ("+De+") "+h+" = "+De+"["+Ue+"];"),i+=""+R,B.valid)c&&(i+=" if (true) { ");else{i+=" if ( ",B.valid===void 0?(i+=" !",J?i+=""+ee:i+=""+m):i+=" "+!B.valid+" ",i+=") { ",d=_.keyword;var Ce=Ce||[];Ce.push(i),i="";var Ce=Ce||[];Ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+_.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+_.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var Ie=i;i=Ce.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+Ie+"]); ":i+=" validate.errors = ["+Ie+"]; return false; ":i+=" var err = "+Ie+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var xe=i;i=Ce.pop(),q?B.errors?B.errors!="full"&&(i+=" for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+V+".schemaPath === undefined) { "+V+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } "):B.errors===!1?i+=" "+xe+" ":(i+=" if ("+E+" == errors) { "+xe+" } else { for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+V+".schemaPath === undefined) { "+V+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } } "):J?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+_.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+_.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):B.errors===!1?i+=" "+xe+" ":(i+=" if (Array.isArray("+U+")) { if (vErrors === null) vErrors = "+U+"; else vErrors = vErrors.concat("+U+"); errors = vErrors.length; for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; "+V+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } } else { "+xe+" } "),i+=" } ",c&&(i+=" else { ")}return i}});var C_e=b((qXr,IPn)=>{IPn.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 Iut=b((VXr,_ut)=>{"use strict";var Sut=C_e();_ut.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Sut.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Sut.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var but=b(($Xr,Tut)=>{"use strict";var TPn=/^[a-z_$][a-z0-9_$-]*$/i,bPn=Dut(),xPn=Iut();Tut.exports={add:wPn,get:RPn,remove:BPn,validate:v_e};function wPn(t,e){var n=this.RULES;if(n.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!TPn.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var r=e.type;if(Array.isArray(r))for(var i=0;i<r.length;i++)s(t,r[i],e);else s(t,r,e);var o=e.metaSchema;o&&(e.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(o,!0))}n.keywords[t]=n.all[t]=!0;function s(a,l,u){for(var c,d=0;d<n.length;d++){var h=n[d];if(h.type==l){c=h;break}}c||(c={type:l,rules:[]},n.push(c));var m={keyword:a,definition:u,custom:!0,code:bPn,implements:u.implements};c.rules.push(m),n.custom[a]=m}return this}function RPn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function BPn(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var n=0;n<e.length;n++)for(var r=e[n].rules,i=0;i<r.length;i++)if(r[i].keyword==t){r.splice(i,1);break}return this}function v_e(t,e){v_e.errors=null;var n=this._validateKeyword=this._validateKeyword||this.compile(xPn,!0);if(n(t))return!0;if(v_e.errors=n.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(n.errors));return!1}});var xut=b((YXr,NPn)=>{NPn.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Qut=b((jXr,Put)=>{"use strict";var Rut=alt(),kN=oee(),OPn=ult(),But=s_e(),MPn=f_e(),FPn=vlt(),LPn=hut(),Nut=gut(),Out=QN();Put.exports=pc;pc.prototype.validate=QPn;pc.prototype.compile=kPn;pc.prototype.addSchema=UPn;pc.prototype.addMetaSchema=GPn;pc.prototype.validateSchema=HPn;pc.prototype.getSchema=VPn;pc.prototype.removeSchema=YPn;pc.prototype.addFormat=e5n;pc.prototype.errorsText=ZPn;pc.prototype._addSchema=jPn;pc.prototype._compile=WPn;pc.prototype.compileAsync=Cut();var hee=but();pc.prototype.addKeyword=hee.add;pc.prototype.getKeyword=hee.get;pc.prototype.removeKeyword=hee.remove;pc.prototype.validateKeyword=hee.validate;var Mut=see();pc.ValidationError=Mut.Validation;pc.MissingRefError=Mut.MissingRef;pc.$dataMetaSchema=Nut;var pee="http://json-schema.org/draft-07/schema",wut=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],PPn=["/properties"];function pc(t){if(!(this instanceof pc))return new pc(t);t=this._opts=Out.copy(t)||{},s5n(this),this._schemas={},this._refs={},this._fragments={},this._formats=FPn(t.format),this._cache=t.cache||new OPn,this._loadingSchemas={},this._compilations=[],this.RULES=LPn(),this._getId=zPn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=MPn),this._metaOpts=o5n(this),t.formats&&r5n(this),t.keywords&&i5n(this),t5n(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),n5n(this)}function QPn(t,e){var n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error('no schema with key or ref "'+t+'"')}else{var r=this._addSchema(t);n=r.validate||this._compile(r)}var i=n(e);return n.$async!==!0&&(this.errors=n.errors),i}function kPn(t,e){var n=this._addSchema(t,void 0,e);return n.validate||this._compile(n)}function UPn(t,e,n,r){if(Array.isArray(t)){for(var i=0;i<t.length;i++)this.addSchema(t[i],void 0,n,r);return this}var o=this._getId(t);if(o!==void 0&&typeof o!="string")throw new Error("schema id must be string");return e=kN.normalizeId(e||o),Lut(this,e),this._schemas[e]=this._addSchema(t,n,r,!0),this}function GPn(t,e,n){return this.addSchema(t,e,n,!0),this}function HPn(t,e){var n=t.$schema;if(n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this._opts.defaultMeta||qPn(this),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var r=this.validate(n,t);if(!r&&e){var i="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(i);else throw new Error(i)}return r}function qPn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(pee)?pee:void 0,t._opts.defaultMeta}function VPn(t){var e=Fut(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return $Pn(this,t)}}function $Pn(t,e){var n=kN.schema.call(t,{schema:{}},e);if(n){var r=n.schema,i=n.root,o=n.baseId,s=Rut.call(t,r,i,void 0,o);return t._fragments[e]=new But({ref:e,fragment:!0,schema:r,root:i,baseId:o,validate:s}),s}}function Fut(t,e){return e=kN.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function YPn(t){if(t instanceof RegExp)return fee(this,this._schemas,t),fee(this,this._refs,t),this;switch(typeof t){case"undefined":return fee(this,this._schemas),fee(this,this._refs),this._cache.clear(),this;case"string":var e=Fut(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var n=this._opts.serialize,r=n?n(t):t;this._cache.del(r);var i=this._getId(t);i&&(i=kN.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function fee(t,e,n){for(var r in e){var i=e[r];!i.meta&&(!n||n.test(r))&&(t._cache.del(i.cacheKey),delete e[r])}}function jPn(t,e,n,r){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var i=this._opts.serialize,o=i?i(t):t,s=this._cache.get(o);if(s)return s;r=r||this._opts.addUsedSchema!==!1;var a=kN.normalizeId(this._getId(t));a&&r&&Lut(this,a);var l=this._opts.validateSchema!==!1&&!e,u;l&&!(u=a&&a==kN.normalizeId(t.$schema))&&this.validateSchema(t,!0);var c=kN.ids.call(this,t),d=new But({id:a,schema:t,localRefs:c,cacheKey:o,meta:n});return a[0]!="#"&&r&&(this._refs[a]=d),this._cache.put(o,d),l&&u&&this.validateSchema(t,!0),d}function WPn(t,e){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=e||i,t.schema.$async===!0&&(i.$async=!0),i;t.compiling=!0;var n;t.meta&&(n=this._opts,this._opts=this._metaOpts);var r;try{r=Rut.call(this,t.schema,e,t.localRefs)}catch(o){throw delete t.validate,o}finally{t.compiling=!1,t.meta&&(this._opts=n)}return t.validate=r,t.refs=r.refs,t.refVal=r.refVal,t.root=r.root,r;function i(){var o=t.validate,s=o.apply(this,arguments);return i.errors=o.errors,s}}function zPn(t){switch(t.schemaId){case"auto":return XPn;case"id":return JPn;default:return KPn}}function JPn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function KPn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function XPn(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function ZPn(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var n=e.separator===void 0?", ":e.separator,r=e.dataVar===void 0?"data":e.dataVar,i="",o=0;o<t.length;o++){var s=t[o];s&&(i+=r+s.dataPath+" "+s.message+n)}return i.slice(0,-n.length)}function e5n(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function t5n(t){var e;if(t._opts.$data&&(e=xut(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var n=C_e();t._opts.$data&&(n=Nut(n,PPn)),t.addMetaSchema(n,pee,!0),t._refs["http://json-schema.org/schema"]=pee}}function n5n(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var n in e)t.addSchema(e[n],n)}function r5n(t){for(var e in t._opts.formats){var n=t._opts.formats[e];t.addFormat(e,n)}}function i5n(t){for(var e in t._opts.keywords){var n=t._opts.keywords[e];t.addKeyword(e,n)}}function Lut(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function o5n(t){for(var e=Out.copy(t._opts),n=0;n<wut.length;n++)delete e[wut[n]];return e}function s5n(t){var e=t._opts.logger;if(e===!1)t.logger={log:D_e,warn:D_e,error:D_e};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function D_e(){}});var kut,mx,mee=Le(()=>{Pat();dx();kut=Qe(Qut(),1),mx=class extends KZ{constructor(e,n){var r;super(n),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(r=n?.capabilities)!==null&&r!==void 0?r:{},this._ajv=new kut.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Lat(this._capabilities,e)}assertCapability(e,n){var r;if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r[e]))throw new Error(`Server does not support ${e} (required for ${n})`)}async connect(e,n){if(await super.connect(e),e.sessionId===void 0)try{let r=await this.request({method:"initialize",params:{protocolVersion:J8,capabilities:this._capabilities,clientInfo:this._clientInfo}},VSe,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Eat.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var n,r,i,o,s;switch(e){case"logging/setLevel":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var n;switch(e){case"notifications/roots/list_changed":if(!(!((n=this._capabilities.roots)===null||n===void 0)&&n.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},PN,e)}async complete(e,n){return this.request({method:"completion/complete",params:e},XSe,n)}async setLoggingLevel(e,n){return this.request({method:"logging/setLevel",params:{level:e}},PN,n)}async getPrompt(e,n){return this.request({method:"prompts/get",params:e},gG,n)}async listPrompts(e,n){return this.request({method:"prompts/list",params:e},AG,n)}async listResources(e,n){return this.request({method:"resources/list",params:e},$Se,n)}async listResourceTemplates(e,n){return this.request({method:"resources/templates/list",params:e},YSe,n)}async readResource(e,n){return this.request({method:"resources/read",params:e},jSe,n)}async subscribeResource(e,n){return this.request({method:"resources/subscribe",params:e},PN,n)}async unsubscribeResource(e,n){return this.request({method:"resources/unsubscribe",params:e},PN,n)}async callTool(e,n=JZ,r){let i=await this.request({method:"tools/call",params:e},n,r),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new by(Ty.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new by(Ty.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof by?s:new by(Ty.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let n of e)if(n.outputSchema)try{let r=this._ajv.compile(n.outputSchema);this._cachedToolOutputValidators.set(n.name,r)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,n){let r=await this.request({method:"tools/list",params:e},KSe,n);return this.cacheToolOutputSchemas(r.tools),r}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var Vut=b((KXr,qut)=>{qut.exports=Hut;Hut.sync=l5n;var Uut=we("fs");function a5n(t,e){var n=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function Gut(t,e,n){return!t.isSymbolicLink()&&!t.isFile()?!1:a5n(e,n)}function Hut(t,e,n){Uut.stat(t,function(r,i){n(r,r?!1:Gut(i,t,e))})}function l5n(t,e){return Gut(Uut.statSync(t),t,e)}});var zut=b((XXr,Wut)=>{Wut.exports=Yut;Yut.sync=u5n;var $ut=we("fs");function Yut(t,e,n){$ut.stat(t,function(r,i){n(r,r?!1:jut(i,e))})}function u5n(t,e){return jut($ut.statSync(t),e)}function jut(t,e){return t.isFile()&&c5n(t,e)}function c5n(t,e){var n=t.mode,r=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),u=parseInt("001",8),c=a|l,d=n&u||n&l&&i===s||n&a&&r===o||n&c&&o===0;return d}});var Kut=b((eZr,Jut)=>{var ZXr=we("fs"),Aee;process.platform==="win32"||global.TESTING_WINDOWS?Aee=Vut():Aee=zut();Jut.exports=S_e;S_e.sync=d5n;function S_e(t,e,n){if(typeof e=="function"&&(n=e,e={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){S_e(t,e||{},function(o,s){o?i(o):r(s)})})}Aee(t,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),n(r,i)})}function d5n(t,e){try{return Aee.sync(t,e||{})}catch(n){if(e&&e.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var ict=b((tZr,rct)=>{var X8=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Xut=we("path"),f5n=X8?";":":",Zut=Kut(),ect=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),tct=(t,e)=>{let n=e.colon||f5n,r=t.match(/\//)||X8&&t.match(/\\/)?[""]:[...X8?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(n)],i=X8?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=X8?i.split(n):[""];return X8&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:i}},nct=(t,e,n)=>{typeof e=="function"&&(n=e,e={}),e||(e={});let{pathEnv:r,pathExt:i,pathExtExe:o}=tct(t,e),s=[],a=u=>new Promise((c,d)=>{if(u===r.length)return e.all&&s.length?c(s):d(ect(t));let h=r[u],m=/^".*"$/.test(h)?h.slice(1,-1):h,E=Xut.join(m,t),y=!m&&/^\.[\\\/]/.test(t)?t.slice(0,2)+E:E;c(l(y,u,0))}),l=(u,c,d)=>new Promise((h,m)=>{if(d===i.length)return h(a(c+1));let E=i[d];Zut(u+E,{pathExt:o},(y,C)=>{if(!y&&C)if(e.all)s.push(u+E);else return h(u+E);return h(l(u,c,d+1))})});return n?a(0).then(u=>n(null,u),n):a(0)},p5n=(t,e)=>{e=e||{};let{pathEnv:n,pathExt:r,pathExtExe:i}=tct(t,e),o=[];for(let s=0;s<n.length;s++){let a=n[s],l=/^".*"$/.test(a)?a.slice(1,-1):a,u=Xut.join(l,t),c=!l&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<r.length;d++){let h=c+r[d];try{if(Zut.sync(h,{pathExt:i}))if(e.all)o.push(h);else return h}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw ect(t)};rct.exports=nct;nct.sync=p5n});var sct=b((nZr,__e)=>{"use strict";var oct=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};__e.exports=oct;__e.exports.default=oct});var cct=b((rZr,uct)=>{"use strict";var act=we("path"),h5n=ict(),m5n=sct();function lct(t,e){let n=t.options.env||process.env,r=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=h5n.sync(t.command,{path:n[m5n({env:n})],pathExt:e?act.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=act.resolve(i?t.options.cwd:"",s)),s}function A5n(t){return lct(t)||lct(t,!0)}uct.exports=A5n});var dct=b((iZr,T_e)=>{"use strict";var I_e=/([()\][%!^"`<>&|;, *?])/g;function g5n(t){return t=t.replace(I_e,"^$1"),t}function E5n(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(I_e,"^$1"),e&&(t=t.replace(I_e,"^$1")),t}T_e.exports.command=g5n;T_e.exports.argument=E5n});var pct=b((oZr,fct)=>{"use strict";fct.exports=/^#!(.*)/});var mct=b((sZr,hct)=>{"use strict";var y5n=pct();hct.exports=(t="")=>{let e=t.match(y5n);if(!e)return null;let[n,r]=e[0].replace(/#! ?/,"").split(" "),i=n.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i}});var gct=b((aZr,Act)=>{"use strict";var b_e=we("fs"),C5n=mct();function v5n(t){let n=Buffer.alloc(150),r;try{r=b_e.openSync(t,"r"),b_e.readSync(r,n,0,150,0),b_e.closeSync(r)}catch{}return C5n(n.toString())}Act.exports=v5n});var vct=b((lZr,Cct)=>{"use strict";var D5n=we("path"),Ect=cct(),yct=dct(),S5n=gct(),_5n=process.platform==="win32",I5n=/\.(?:com|exe)$/i,T5n=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function b5n(t){t.file=Ect(t);let e=t.file&&S5n(t.file);return e?(t.args.unshift(t.file),t.command=e,Ect(t)):t.file}function x5n(t){if(!_5n)return t;let e=b5n(t),n=!I5n.test(e);if(t.options.forceShell||n){let r=T5n.test(e);t.command=D5n.normalize(t.command),t.command=yct.command(t.command),t.args=t.args.map(o=>yct.argument(o,r));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function w5n(t,e,n){e&&!Array.isArray(e)&&(n=e,e=null),e=e?e.slice(0):[],n=Object.assign({},n);let r={command:t,args:e,options:n,file:void 0,original:{command:t,args:e}};return n.shell?r:x5n(r)}Cct.exports=w5n});var _ct=b((uZr,Sct)=>{"use strict";var x_e=process.platform==="win32";function w_e(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function R5n(t,e){if(!x_e)return;let n=t.emit;t.emit=function(r,i){if(r==="exit"){let o=Dct(i,e);if(o)return n.call(t,"error",o)}return n.apply(t,arguments)}}function Dct(t,e){return x_e&&t===1&&!e.file?w_e(e.original,"spawn"):null}function B5n(t,e){return x_e&&t===1&&!e.file?w_e(e.original,"spawnSync"):null}Sct.exports={hookChildProcess:R5n,verifyENOENT:Dct,verifyENOENTSync:B5n,notFoundError:w_e}});var bct=b((cZr,Z8)=>{"use strict";var Ict=we("child_process"),R_e=vct(),B_e=_ct();function Tct(t,e,n){let r=R_e(t,e,n),i=Ict.spawn(r.command,r.args,r.options);return B_e.hookChildProcess(i,r),i}function N5n(t,e,n){let r=R_e(t,e,n),i=Ict.spawnSync(r.command,r.args,r.options);return i.error=i.error||B_e.verifyENOENTSync(i.status,r),i}Z8.exports=Tct;Z8.exports.spawn=Tct;Z8.exports.sync=N5n;Z8.exports._parse=R_e;Z8.exports._enoent=B_e});function O5n(t){return cx.parse(JSON.parse(t))}function xct(t){return JSON.stringify(t)+`
544
+ \u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let r=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:n}],temperature:.1,max_tokens:1e3})});if(!r.ok)throw new Error(`QWen API error: ${r.status}`);let o=(await r.json()).choices[0].message.content.trim();return o.startsWith("```json")?o=o.replace(/^```json\s*/,"").replace(/\s*```$/,""):o.startsWith("```")&&(o=o.replace(/^```\s*/,"").replace(/\s*```$/,"")),JSON.parse(o)}catch(r){throw BC(r),console.error("QWen JSON fix failed:",r),r}}extractTextFromRequest(e){let n="";if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of r)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)n+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,l]of Object.entries(s.functionResponse.response))l!=null&&(n+=String(l)+" ")}}return n.trim()}extractTextFromEmbedRequest(e){if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let r of n)if(typeof r=="object"&&r!==null&&"parts"in r&&r.parts){let i=Array.isArray(r.parts)?r.parts:[r.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof r=="string")return r;if(typeof r=="object"&&r!==null&&"text"in r&&r.text)return r.text}}return""}extractSystemInstruction(e){let n="";if(typeof e=="string")n=e;else if(Array.isArray(e)){for(let r of e)typeof r=="object"&&r!==null&&"text"in r&&r.text&&(n+=r.text+" ");n=n.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let r=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of r)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(n+=i.text+" ");n=n.trim()}else"text"in e&&e.text&&(n=e.text);return n}convertToOpenAITools(e){if(!e||e.length===0)return[];let n=[];for(let r of e)if(r.functionDeclarations&&Array.isArray(r.functionDeclarations))for(let i of r.functionDeclarations)n.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return n}convertParameters(e){if(!e)return;let n={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(n[e.type]?e.type=n[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=n[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let r=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=r(a)}return i.items&&(o.items=r(i.items)),i.required&&(o.required=i.required),o};return r(e)}mapFinishReason(e){switch(e){case"stop":return qb.STOP;case"length":return qb.MAX_TOKENS;case"content_filter":return qb.SAFETY;case"tool_calls":return qb.MALFORMED_FUNCTION_CALL;default:return qb.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let n={};if(e.type)switch(e.type){case"STRING":n.type="string";break;case"INTEGER":n.type="integer";break;case"NUMBER":n.type="number";break;case"BOOLEAN":n.type="boolean";break;case"OBJECT":n.type="object";break;case"ARRAY":n.type="array";break;default:n.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(n.description=e.description),e.enum&&(n.enum=e.enum),e.properties){n.properties={};for(let[r,i]of Object.entries(e.properties))n.properties[r]=this.convertSchemaToJsonSchema(i)}return e.items&&(n.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(n.required=e.required),n.type==="object"&&!("additionalProperties"in n)&&(n.additionalProperties=!1),n}}});function DFn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function oS(t){let e=DFn(t),n=`IFLOW_${t}`;if(process.env[n])return process.env[n];let r=`IFLOW_${e}`;if(process.env[r])return process.env[r];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function oG(){return oS("apiKey")}function sG(){return oS("baseUrl")||oS("url")}function aG(){return oS("modelName")||oS("model")}function eat(t){let e=oS(t);if(e===void 0)return;let n=e.toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1}function tat(t){let e=oS(t);if(e===void 0)return;let n=Number(e);return isNaN(n)?void 0:n}function nat(t){let e=oS(t);if(e!==void 0)return e.split(",").map(n=>n.trim()).filter(n=>n.length>0)}function OZ(){return!!(oG()||sG()||aG())}function MSe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],n=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate"],r=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=oS(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=eat(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=tat(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=nat(o);s!==void 0&&(t[o]=s)}),t}function SFn(){return{apiKey:oG(),baseUrl:sG(),model:aG()}}var FSe=Le(()=>{"use strict";});function LSe(t,e,n){let r=process.env.GEMINI_API_KEY,i=process.env.GOOGLE_API_KEY,o=process.env.GOOGLE_CLOUD_PROJECT,s=process.env.GOOGLE_CLOUD_LOCATION,a=oG(),l=sG(),u=aG(),c=n?.apiKey||a,d=n?.baseUrl||l||_Fn[e],h=t.getModel()||u||wh,m={model:h,authType:e,proxy:t?.getProxy(),multimodalModelName:n?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Sn.LOGIN_WITH_GOOGLE||e===Sn.CLOUD_SHELL?m:e===Sn.USE_GEMINI&&r?(m.apiKey=r,m.vertexai=!1,Vst(m.apiKey,m.model,m.proxy),m):e===Sn.USE_VERTEX_AI&&(i||o&&s)?(m.apiKey=i,m.vertexai=!0,m):([...Vf,Sn.OPENAI_COMPATIBLE].includes(e)&&c&&(m.apiKey=c,m.baseUrl=d,m.model=h),m)}async function PSe(t,e,n){let i={headers:{"User-Agent":`iFlowCLI/0.2.2 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Vf,Sn.IDEA_LAB].includes(t.authType)||t.authType===Sn.OPENAI_COMPATIBLE)return new NZ(t);if(t.authType===Sn.LOGIN_WITH_GOOGLE||t.authType===Sn.CLOUD_SHELL)return k1e(i,t.authType,e,n);if([...Vf,Sn.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Sn.USE_GEMINI||t.authType===Sn.USE_VERTEX_AI)return new cK({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Sn,Vf,_Fn,$I=Le(()=>{"use strict";nl();U1e();SC();$st();Zst();FSe();(function(t){t.LOGIN_WITH_GOOGLE="oauth-personal",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Sn||(Sn={}));Vf=[Sn.IFLOW,Sn.IDEA_LAB],_Fn={[Sn.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Sn.IFLOW]:HXe}});var MZ,rat=Le(()=>{"use strict";MZ=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let n=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${n}".`),this.prompts.set(n,{...e,name:n})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,n)=>e.name.localeCompare(n.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let n=[];for(let r of this.prompts.values())r.serverName===e&&n.push(r);return n.sort((r,i)=>r.name.localeCompare(i.name))}}});var Io,Rr,To,fc=Le(()=>{"use strict";Io=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,n,r,i,o,s=!0,a=!1,l=[]){this.name=e,this.displayName=n,this.description=r,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=l}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,n){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Rr||(Rr={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(To||(To={}))});var os,QSe,Gn,sS,lG=Le(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(os||(os={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(QSe||(QSe={}));Gn=os.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sS=t=>{switch(typeof t){case"undefined":return Gn.undefined;case"string":return Gn.string;case"number":return Number.isNaN(t)?Gn.nan:Gn.number;case"boolean":return Gn.boolean;case"function":return Gn.function;case"bigint":return Gn.bigint;case"symbol":return Gn.symbol;case"object":return Array.isArray(t)?Gn.array:t===null?Gn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Gn.promise:typeof Map<"u"&&t instanceof Map?Gn.map:typeof Set<"u"&&t instanceof Set?Gn.set:typeof Date<"u"&&t instanceof Date?Gn.date:Gn.object;default:return Gn.unknown}}});var ln,IFn,sg,FZ=Le(()=>{lG();ln=os.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),IFn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),sg=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let u=s.path[l];l===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(s))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,os.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};sg.create=t=>new sg(t)});var TFn,u2,kSe=Le(()=>{FZ();lG();TFn=(t,e)=>{let n;switch(t.code){case ln.invalid_type:t.received===Gn.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ln.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,os.jsonStringifyReplacer)}`;break;case ln.unrecognized_keys:n=`Unrecognized key(s) in object: ${os.joinValues(t.keys,", ")}`;break;case ln.invalid_union:n="Invalid input";break;case ln.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${os.joinValues(t.options)}`;break;case ln.invalid_enum_value:n=`Invalid enum value. Expected ${os.joinValues(t.options)}, received '${t.received}'`;break;case ln.invalid_arguments:n="Invalid function arguments";break;case ln.invalid_return_type:n="Invalid function return type";break;case ln.invalid_date:n="Invalid date";break;case ln.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:os.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ln.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ln.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ln.custom:n="Invalid input";break;case ln.invalid_intersection_types:n="Intersection results could not be merged";break;case ln.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ln.not_finite:n="Number must be finite";break;default:n=e.defaultError,os.assertNever(t)}return{message:n}},u2=TFn});function bFn(t){iat=t}function H8(){return iat}var iat,LZ=Le(()=>{kSe();iat=u2});function Nn(t,e){let n=H8(),r=uG({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===u2?void 0:u2].filter(i=>!!i)});t.common.issues.push(r)}var uG,xFn,Hp,pi,vN,Mh,PZ,QZ,sx,q8,USe=Le(()=>{LZ();kSe();uG=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=r.filter(u=>!!u).slice().reverse();for(let u of l)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},xFn=[];Hp=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return pi;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return pi;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},pi=Object.freeze({status:"aborted"}),vN=t=>({status:"dirty",value:t}),Mh=t=>({status:"valid",value:t}),PZ=t=>t.status==="aborted",QZ=t=>t.status==="dirty",sx=t=>t.status==="valid",q8=t=>typeof Promise<"u"&&t instanceof Promise});var oat=Le(()=>{});var Dr,sat=Le(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Dr||(Dr={}))});function Co(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}function cat(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function $Fn(t){return new RegExp(`^${cat(t)}$`)}function dat(t){let e=`${uat}T${cat(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function YFn(t,e){return!!((e==="v4"||!e)&&QFn.test(t)||(e==="v6"||!e)&&UFn.test(t))}function jFn(t,e){if(!MFn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function WFn(t,e){return!!((e==="v4"||!e)&&kFn.test(t)||(e==="v6"||!e)&&GFn.test(t))}function zFn(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function V8(t){if(t instanceof ag){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Sy.create(V8(r))}return new ag({...t._def,shape:()=>e})}else return t instanceof f2?new f2({...t._def,type:V8(t.element)}):t instanceof Sy?Sy.create(V8(t.unwrap())):t instanceof lS?lS.create(V8(t.unwrap())):t instanceof aS?aS.create(t.items.map(e=>V8(e))):t}function HSe(t,e){let n=sS(t),r=sS(e);if(t===e)return{valid:!0,data:t};if(n===Gn.object&&r===Gn.object){let i=os.objectKeys(e),o=os.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=HSe(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===Gn.array&&r===Gn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=HSe(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===Gn.date&&r===Gn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function fat(t,e){return new NN({values:t,typeName:Si.ZodEnum,...Co(e)})}function lat(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function pat(t,e={},n){return t?lx.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=lat(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=lat(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):lx.create()}var _y,aat,Po,wFn,RFn,BFn,NFn,OFn,MFn,FFn,LFn,PFn,GSe,QFn,kFn,UFn,GFn,HFn,qFn,uat,VFn,ax,DN,SN,_N,IN,$8,TN,bN,lx,d2,NC,Y8,f2,ag,xN,c2,kZ,wN,aS,UZ,j8,W8,GZ,RN,BN,NN,ON,ux,Iy,Sy,lS,MN,FN,z8,JFn,cG,dG,LN,KFn,Si,XFn,hat,mat,ZFn,e8n,Aat,t8n,n8n,r8n,i8n,o8n,s8n,a8n,l8n,u8n,c8n,d8n,f8n,p8n,h8n,m8n,A8n,g8n,E8n,y8n,C8n,v8n,D8n,S8n,_8n,I8n,T8n,b8n,x8n,w8n,R8n,B8n,N8n,O8n,M8n,gat=Le(()=>{FZ();LZ();sat();USe();lG();_y=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},aat=(t,e)=>{if(sx(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new sg(t.common.issues);return this._error=n,this._error}}};Po=class{get description(){return this._def.description}_getType(e){return sS(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hp,ctx:{common:e.parent.common,data:e.data,parsedType:sS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(q8(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)},i=this._parseSync({data:e,path:r.path,parent:r});return aat(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return sx(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>sx(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sS(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(q8(i)?i:Promise.resolve(i));return aat(r,o)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:ln.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Iy({schema:this,typeName:Si.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Sy.create(this,this._def)}nullable(){return lS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return f2.create(this)}promise(){return ux.create(this,this._def)}or(e){return xN.create([this,e],this._def)}and(e){return wN.create(this,e,this._def)}transform(e){return new Iy({...Co(this._def),schema:this,typeName:Si.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new MN({...Co(this._def),innerType:this,defaultValue:n,typeName:Si.ZodDefault})}brand(){return new cG({typeName:Si.ZodBranded,type:this,...Co(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new FN({...Co(this._def),innerType:this,catchValue:n,typeName:Si.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return dG.create(this,e)}readonly(){return LN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wFn=/^c[^\s-]{8,}$/i,RFn=/^[0-9a-z]+$/,BFn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NFn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,OFn=/^[a-z0-9_-]{21}$/i,MFn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FFn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,LFn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,PFn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",QFn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kFn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UFn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,GFn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HFn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qFn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uat="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",VFn=new RegExp(`^${uat}$`);ax=class t extends Po{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gn.string){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.string,received:o.parsedType}),pi}let r=new Hp,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Nn(i,{code:ln.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Nn(i,{code:ln.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")LFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"email",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")GSe||(GSe=new RegExp(PFn,"u")),GSe.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"emoji",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")NFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"uuid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")OFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"nanoid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")wFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cuid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")RFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cuid2",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")BFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"ulid",code:ln.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Nn(i,{validation:"url",code:ln.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"regex",code:ln.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?dat(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?VFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?$Fn(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?FFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"duration",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?YFn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"ip",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?jFn(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"jwt",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?WFn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"cidr",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?HFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"base64",code:ln.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?qFn.test(e.data)||(i=this._getOrReturnCtx(e,i),Nn(i,{validation:"base64url",code:ln.invalid_string,message:o.message}),r.dirty()):os.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:ln.invalid_string,...Dr.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Dr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Dr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Dr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Dr.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Dr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Dr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Dr.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Dr.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Dr.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Dr.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Dr.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Dr.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Dr.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Dr.errToObj(n)})}nonempty(e){return this.min(1,Dr.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ax.create=t=>new ax({checks:[],typeName:Si.ZodString,coerce:t?.coerce??!1,...Co(t)});DN=class t extends Po{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Gn.number){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.number,received:o.parsedType}),pi}let r,i=new Hp;for(let o of this._def.checks)o.kind==="int"?os.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?zFn(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_finite,message:o.message}),i.dirty()):os.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Dr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dr.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Dr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dr.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Dr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dr.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&os.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};DN.create=t=>new DN({checks:[],typeName:Si.ZodNumber,coerce:t?.coerce||!1,...Co(t)});SN=class t extends Po{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Gn.bigint)return this._getInvalidInput(e);let r,i=new Hp;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Nn(r,{code:ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):os.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return Nn(n,{code:ln.invalid_type,expected:Gn.bigint,received:n.parsedType}),pi}gte(e,n){return this.setLimit("min",e,!0,Dr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Dr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Dr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Dr.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Dr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Dr.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};SN.create=t=>new SN({checks:[],typeName:Si.ZodBigInt,coerce:t?.coerce??!1,...Co(t)});_N=class extends Po{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Gn.boolean){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.boolean,received:r.parsedType}),pi}return Mh(e.data)}};_N.create=t=>new _N({typeName:Si.ZodBoolean,coerce:t?.coerce||!1,...Co(t)});IN=class t extends Po{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gn.date){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_type,expected:Gn.date,received:o.parsedType}),pi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Nn(o,{code:ln.invalid_date}),pi}let r=new Hp,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Nn(i,{code:ln.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):os.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Dr.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Dr.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};IN.create=t=>new IN({checks:[],coerce:t?.coerce||!1,typeName:Si.ZodDate,...Co(t)});$8=class extends Po{_parse(e){if(this._getType(e)!==Gn.symbol){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.symbol,received:r.parsedType}),pi}return Mh(e.data)}};$8.create=t=>new $8({typeName:Si.ZodSymbol,...Co(t)});TN=class extends Po{_parse(e){if(this._getType(e)!==Gn.undefined){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.undefined,received:r.parsedType}),pi}return Mh(e.data)}};TN.create=t=>new TN({typeName:Si.ZodUndefined,...Co(t)});bN=class extends Po{_parse(e){if(this._getType(e)!==Gn.null){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.null,received:r.parsedType}),pi}return Mh(e.data)}};bN.create=t=>new bN({typeName:Si.ZodNull,...Co(t)});lx=class extends Po{constructor(){super(...arguments),this._any=!0}_parse(e){return Mh(e.data)}};lx.create=t=>new lx({typeName:Si.ZodAny,...Co(t)});d2=class extends Po{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Mh(e.data)}};d2.create=t=>new d2({typeName:Si.ZodUnknown,...Co(t)});NC=class extends Po{_parse(e){let n=this._getOrReturnCtx(e);return Nn(n,{code:ln.invalid_type,expected:Gn.never,received:n.parsedType}),pi}};NC.create=t=>new NC({typeName:Si.ZodNever,...Co(t)});Y8=class extends Po{_parse(e){if(this._getType(e)!==Gn.undefined){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.void,received:r.parsedType}),pi}return Mh(e.data)}};Y8.create=t=>new Y8({typeName:Si.ZodVoid,...Co(t)});f2=class t extends Po{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Gn.array)return Nn(n,{code:ln.invalid_type,expected:Gn.array,received:n.parsedType}),pi;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(Nn(n,{code:s?ln.too_big:ln.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Nn(n,{code:ln.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Nn(n,{code:ln.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new _y(n,s,n.path,a)))).then(s=>Hp.mergeArray(r,s));let o=[...n.data].map((s,a)=>i.type._parseSync(new _y(n,s,n.path,a)));return Hp.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Dr.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Dr.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Dr.toString(n)}})}nonempty(e){return this.min(1,e)}};f2.create=(t,e)=>new f2({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Si.ZodArray,...Co(e)});ag=class t extends Po{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=os.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Gn.object){let u=this._getOrReturnCtx(e);return Nn(u,{code:ln.invalid_type,expected:Gn.object,received:u.parsedType}),pi}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof NC&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let l=[];for(let u of s){let c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new _y(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof NC){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of a)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")a.length>0&&(Nn(i,{code:ln.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of a){let d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new _y(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let d=await c.key,h=await c.value;u.push({key:d,value:h,alwaysSet:c.alwaysSet})}return u}).then(u=>Hp.mergeObjectSync(r,u)):Hp.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Dr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Dr.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Si.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of os.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of os.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return V8(this)}partial(e){let n={};for(let r of os.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of os.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Sy;)o=o._def.innerType;n[r]=o}return new t({...this._def,shape:()=>n})}keyof(){return fat(os.objectKeys(this.shape))}};ag.create=(t,e)=>new ag({shape:()=>t,unknownKeys:"strip",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});ag.strictCreate=(t,e)=>new ag({shape:()=>t,unknownKeys:"strict",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});ag.lazycreate=(t,e)=>new ag({shape:t,unknownKeys:"strip",catchall:NC.create(),typeName:Si.ZodObject,...Co(e)});xN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new sg(a.ctx.common.issues));return Nn(n,{code:ln.invalid_union,unionErrors:s}),pi}if(n.common.async)return Promise.all(r.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of r){let u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new sg(l));return Nn(n,{code:ln.invalid_union,unionErrors:a}),pi}}get options(){return this._def.options}};xN.create=(t,e)=>new xN({options:t,typeName:Si.ZodUnion,...Co(e)});c2=t=>t instanceof RN?c2(t.schema):t instanceof Iy?c2(t.innerType()):t instanceof BN?[t.value]:t instanceof NN?t.options:t instanceof ON?os.objectValues(t.enum):t instanceof MN?c2(t._def.innerType):t instanceof TN?[void 0]:t instanceof bN?[null]:t instanceof Sy?[void 0,...c2(t.unwrap())]:t instanceof lS?[null,...c2(t.unwrap())]:t instanceof cG||t instanceof LN?c2(t.unwrap()):t instanceof FN?c2(t._def.innerType):[],kZ=class t extends Po{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.object)return Nn(n,{code:ln.invalid_type,expected:Gn.object,received:n.parsedType}),pi;let r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Nn(n,{code:ln.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let o of n){let s=c2(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:Si.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Co(r)})}};wN=class extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(PZ(o)||PZ(s))return pi;let a=HSe(o.value,s.value);return a.valid?((QZ(o)||QZ(s))&&n.dirty(),{status:n.value,value:a.data}):(Nn(r,{code:ln.invalid_intersection_types}),pi)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};wN.create=(t,e,n)=>new wN({left:t,right:e,typeName:Si.ZodIntersection,...Co(n)});aS=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.array)return Nn(r,{code:ln.invalid_type,expected:Gn.array,received:r.parsedType}),pi;if(r.data.length<this._def.items.length)return Nn(r,{code:ln.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pi;!this._def.rest&&r.data.length>this._def.items.length&&(Nn(r,{code:ln.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new _y(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Hp.mergeArray(n,s)):Hp.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};aS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new aS({items:t,typeName:Si.ZodTuple,rest:null,...Co(e)})};UZ=class t extends Po{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.object)return Nn(r,{code:ln.invalid_type,expected:Gn.object,received:r.parsedType}),pi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new _y(r,a,r.path,a)),value:s._parse(new _y(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hp.mergeObjectAsync(n,i):Hp.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Po?new t({keyType:e,valueType:n,typeName:Si.ZodRecord,...Co(r)}):new t({keyType:ax.create(),valueType:e,typeName:Si.ZodRecord,...Co(n)})}},j8=class extends Po{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.map)return Nn(r,{code:ln.invalid_type,expected:Gn.map,received:r.parsedType}),pi;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new _y(r,a,r.path,[u,"key"])),value:o._parse(new _y(r,l,r.path,[u,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return pi;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return pi;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}}}};j8.create=(t,e,n)=>new j8({valueType:e,keyType:t,typeName:Si.ZodMap,...Co(n)});W8=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.set)return Nn(r,{code:ln.invalid_type,expected:Gn.set,received:r.parsedType}),pi;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Nn(r,{code:ln.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Nn(r,{code:ln.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let o=this._def.valueType;function s(l){let u=new Set;for(let c of l){if(c.status==="aborted")return pi;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}let a=[...r.data.values()].map((l,u)=>o._parse(new _y(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:Dr.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Dr.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};W8.create=(t,e)=>new W8({valueType:t,minSize:null,maxSize:null,typeName:Si.ZodSet,...Co(e)});GZ=class t extends Po{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.function)return Nn(n,{code:ln.invalid_type,expected:Gn.function,received:n.parsedType}),pi;function r(a,l){return uG({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H8(),u2].filter(u=>!!u),issueData:{code:ln.invalid_arguments,argumentsError:l}})}function i(a,l){return uG({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H8(),u2].filter(u=>!!u),issueData:{code:ln.invalid_return_type,returnTypeError:l}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof ux){let a=this;return Mh(async function(...l){let u=new sg([]),c=await a._def.args.parseAsync(l,o).catch(m=>{throw u.addIssue(r(l,m)),u}),d=await Reflect.apply(s,this,c);return await a._def.returns._def.type.parseAsync(d,o).catch(m=>{throw u.addIssue(i(d,m)),u})})}else{let a=this;return Mh(function(...l){let u=a._def.args.safeParse(l,o);if(!u.success)throw new sg([r(l,u.error)]);let c=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(c,o);if(!d.success)throw new sg([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:aS.create(e).rest(d2.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||aS.create([]).rest(d2.create()),returns:n||d2.create(),typeName:Si.ZodFunction,...Co(r)})}},RN=class extends Po{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};RN.create=(t,e)=>new RN({getter:t,typeName:Si.ZodLazy,...Co(e)});BN=class extends Po{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return Nn(n,{received:n.data,code:ln.invalid_literal,expected:this._def.value}),pi}return{status:"valid",value:e.data}}get value(){return this._def.value}};BN.create=(t,e)=>new BN({value:t,typeName:Si.ZodLiteral,...Co(e)});NN=class t extends Po{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return Nn(n,{expected:os.joinValues(r),received:n.parsedType,code:ln.invalid_type}),pi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return Nn(n,{received:n.data,code:ln.invalid_enum_value,options:r}),pi}return Mh(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};NN.create=fat;ON=class extends Po{_parse(e){let n=os.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Gn.string&&r.parsedType!==Gn.number){let i=os.objectValues(n);return Nn(r,{expected:os.joinValues(i),received:r.parsedType,code:ln.invalid_type}),pi}if(this._cache||(this._cache=new Set(os.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=os.objectValues(n);return Nn(r,{received:r.data,code:ln.invalid_enum_value,options:i}),pi}return Mh(e.data)}get enum(){return this._def.values}};ON.create=(t,e)=>new ON({values:t,typeName:Si.ZodNativeEnum,...Co(e)});ux=class extends Po{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.promise&&n.common.async===!1)return Nn(n,{code:ln.invalid_type,expected:Gn.promise,received:n.parsedType}),pi;let r=n.parsedType===Gn.promise?n.data:Promise.resolve(n.data);return Mh(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ux.create=(t,e)=>new ux({type:t,typeName:Si.ZodPromise,...Co(e)});Iy=class extends Po{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Nn(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return pi;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?pi:l.status==="dirty"?vN(l.value):n.value==="dirty"?vN(l.value):l});{if(n.value==="aborted")return pi;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?pi:a.status==="dirty"?vN(a.value):n.value==="dirty"?vN(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pi:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?pi:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sx(s))return pi;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>sx(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):pi);os.assertNever(i)}};Iy.create=(t,e,n)=>new Iy({schema:t,typeName:Si.ZodEffects,effect:e,...Co(n)});Iy.createWithPreprocess=(t,e,n)=>new Iy({schema:e,effect:{type:"preprocess",transform:t},typeName:Si.ZodEffects,...Co(n)});Sy=class extends Po{_parse(e){return this._getType(e)===Gn.undefined?Mh(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sy.create=(t,e)=>new Sy({innerType:t,typeName:Si.ZodOptional,...Co(e)});lS=class extends Po{_parse(e){return this._getType(e)===Gn.null?Mh(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lS.create=(t,e)=>new lS({innerType:t,typeName:Si.ZodNullable,...Co(e)});MN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===Gn.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};MN.create=(t,e)=>new MN({innerType:t,typeName:Si.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Co(e)});FN=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return q8(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new sg(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new sg(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};FN.create=(t,e)=>new FN({innerType:t,typeName:Si.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Co(e)});z8=class extends Po{_parse(e){if(this._getType(e)!==Gn.nan){let r=this._getOrReturnCtx(e);return Nn(r,{code:ln.invalid_type,expected:Gn.nan,received:r.parsedType}),pi}return{status:"valid",value:e.data}}};z8.create=t=>new z8({typeName:Si.ZodNaN,...Co(t)});JFn=Symbol("zod_brand"),cG=class extends Po{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},dG=class t extends Po{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pi:o.status==="dirty"?(n.dirty(),vN(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?pi:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Si.ZodPipeline})}},LN=class extends Po{_parse(e){let n=this._def.innerType._parse(e),r=i=>(sx(i)&&(i.value=Object.freeze(i.value)),i);return q8(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};LN.create=(t,e)=>new LN({innerType:t,typeName:Si.ZodReadonly,...Co(e)});KFn={object:ag.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Si||(Si={}));XFn=(t,e={message:`Input not instance of ${t.name}`})=>pat(n=>n instanceof t,e),hat=ax.create,mat=DN.create,ZFn=z8.create,e8n=SN.create,Aat=_N.create,t8n=IN.create,n8n=$8.create,r8n=TN.create,i8n=bN.create,o8n=lx.create,s8n=d2.create,a8n=NC.create,l8n=Y8.create,u8n=f2.create,c8n=ag.create,d8n=ag.strictCreate,f8n=xN.create,p8n=kZ.create,h8n=wN.create,m8n=aS.create,A8n=UZ.create,g8n=j8.create,E8n=W8.create,y8n=GZ.create,C8n=RN.create,v8n=BN.create,D8n=NN.create,S8n=ON.create,_8n=ux.create,I8n=Iy.create,T8n=Sy.create,b8n=lS.create,x8n=Iy.createWithPreprocess,w8n=dG.create,R8n=()=>hat().optional(),B8n=()=>mat().optional(),N8n=()=>Aat().optional(),O8n={string:t=>ax.create({...t,coerce:!0}),number:t=>DN.create({...t,coerce:!0}),boolean:t=>_N.create({...t,coerce:!0}),bigint:t=>SN.create({...t,coerce:!0}),date:t=>IN.create({...t,coerce:!0})},M8n=pi});var ve={};h0(ve,{BRAND:()=>JFn,DIRTY:()=>vN,EMPTY_PATH:()=>xFn,INVALID:()=>pi,NEVER:()=>M8n,OK:()=>Mh,ParseStatus:()=>Hp,Schema:()=>Po,ZodAny:()=>lx,ZodArray:()=>f2,ZodBigInt:()=>SN,ZodBoolean:()=>_N,ZodBranded:()=>cG,ZodCatch:()=>FN,ZodDate:()=>IN,ZodDefault:()=>MN,ZodDiscriminatedUnion:()=>kZ,ZodEffects:()=>Iy,ZodEnum:()=>NN,ZodError:()=>sg,ZodFirstPartyTypeKind:()=>Si,ZodFunction:()=>GZ,ZodIntersection:()=>wN,ZodIssueCode:()=>ln,ZodLazy:()=>RN,ZodLiteral:()=>BN,ZodMap:()=>j8,ZodNaN:()=>z8,ZodNativeEnum:()=>ON,ZodNever:()=>NC,ZodNull:()=>bN,ZodNullable:()=>lS,ZodNumber:()=>DN,ZodObject:()=>ag,ZodOptional:()=>Sy,ZodParsedType:()=>Gn,ZodPipeline:()=>dG,ZodPromise:()=>ux,ZodReadonly:()=>LN,ZodRecord:()=>UZ,ZodSchema:()=>Po,ZodSet:()=>W8,ZodString:()=>ax,ZodSymbol:()=>$8,ZodTransformer:()=>Iy,ZodTuple:()=>aS,ZodType:()=>Po,ZodUndefined:()=>TN,ZodUnion:()=>xN,ZodUnknown:()=>d2,ZodVoid:()=>Y8,addIssueToContext:()=>Nn,any:()=>o8n,array:()=>u8n,bigint:()=>e8n,boolean:()=>Aat,coerce:()=>O8n,custom:()=>pat,date:()=>t8n,datetimeRegex:()=>dat,defaultErrorMap:()=>u2,discriminatedUnion:()=>p8n,effect:()=>I8n,enum:()=>D8n,function:()=>y8n,getErrorMap:()=>H8,getParsedType:()=>sS,instanceof:()=>XFn,intersection:()=>h8n,isAborted:()=>PZ,isAsync:()=>q8,isDirty:()=>QZ,isValid:()=>sx,late:()=>KFn,lazy:()=>C8n,literal:()=>v8n,makeIssue:()=>uG,map:()=>g8n,nan:()=>ZFn,nativeEnum:()=>S8n,never:()=>a8n,null:()=>i8n,nullable:()=>b8n,number:()=>mat,object:()=>c8n,objectUtil:()=>QSe,oboolean:()=>N8n,onumber:()=>B8n,optional:()=>T8n,ostring:()=>R8n,pipeline:()=>w8n,preprocess:()=>x8n,promise:()=>_8n,quotelessJson:()=>IFn,record:()=>A8n,set:()=>E8n,setErrorMap:()=>bFn,strictObject:()=>d8n,string:()=>hat,symbol:()=>n8n,transformer:()=>I8n,tuple:()=>m8n,undefined:()=>r8n,union:()=>f8n,unknown:()=>s8n,util:()=>os,void:()=>l8n});var qSe=Le(()=>{LZ();USe();oat();lG();gat();FZ()});var fG=Le(()=>{qSe();qSe()});var J8,Eat,HZ,yat,Cat,F8n,xy,lg,pG,uS,wy,qZ,vat,VZ,Dat,Sat,_at,hG,Ty,Iat,Tat,cx,PN,$Z,mG,bat,L8n,P8n,Q8n,VSe,xat,wat,YZ,k8n,jZ,WZ,zZ,Rat,Bat,Nat,Oat,U8n,G8n,$Se,H8n,YSe,q8n,jSe,V8n,$8n,Y8n,j8n,W8n,z8n,J8n,AG,K8n,WSe,zSe,JSe,X8n,Z8n,Mat,eLn,gG,tLn,nLn,rLn,iLn,KSe,JZ,jKr,oLn,sLn,Fat,aLn,lLn,uLn,cLn,dLn,fLn,pLn,hLn,mLn,ALn,gLn,ELn,yLn,CLn,vLn,DLn,SLn,XSe,_Ln,ILn,TLn,bLn,WKr,zKr,JKr,KKr,XKr,ZKr,by,dx=Le(()=>{fG();J8="2025-06-18",Eat=[J8,"2025-03-26","2024-11-05","2024-10-07"],HZ="2.0",yat=ve.union([ve.string(),ve.number().int()]),Cat=ve.string(),F8n=ve.object({progressToken:ve.optional(yat)}).passthrough(),xy=ve.object({_meta:ve.optional(F8n)}).passthrough(),lg=ve.object({method:ve.string(),params:ve.optional(xy)}),pG=ve.object({_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),uS=ve.object({method:ve.string(),params:ve.optional(pG)}),wy=ve.object({_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),qZ=ve.union([ve.string(),ve.number().int()]),vat=ve.object({jsonrpc:ve.literal(HZ),id:qZ}).merge(lg).strict(),VZ=t=>vat.safeParse(t).success,Dat=ve.object({jsonrpc:ve.literal(HZ)}).merge(uS).strict(),Sat=t=>Dat.safeParse(t).success,_at=ve.object({jsonrpc:ve.literal(HZ),id:qZ,result:wy}).strict(),hG=t=>_at.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(Ty||(Ty={}));Iat=ve.object({jsonrpc:ve.literal(HZ),id:qZ,error:ve.object({code:ve.number().int(),message:ve.string(),data:ve.optional(ve.unknown())})}).strict(),Tat=t=>Iat.safeParse(t).success,cx=ve.union([vat,Dat,_at,Iat]),PN=wy.strict(),$Z=uS.extend({method:ve.literal("notifications/cancelled"),params:pG.extend({requestId:qZ,reason:ve.string().optional()})}),mG=ve.object({name:ve.string(),title:ve.optional(ve.string())}).passthrough(),bat=mG.extend({version:ve.string()}),L8n=ve.object({experimental:ve.optional(ve.object({}).passthrough()),sampling:ve.optional(ve.object({}).passthrough()),elicitation:ve.optional(ve.object({}).passthrough()),roots:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough())}).passthrough(),P8n=lg.extend({method:ve.literal("initialize"),params:xy.extend({protocolVersion:ve.string(),capabilities:L8n,clientInfo:bat})}),Q8n=ve.object({experimental:ve.optional(ve.object({}).passthrough()),logging:ve.optional(ve.object({}).passthrough()),completions:ve.optional(ve.object({}).passthrough()),prompts:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough()),resources:ve.optional(ve.object({subscribe:ve.optional(ve.boolean()),listChanged:ve.optional(ve.boolean())}).passthrough()),tools:ve.optional(ve.object({listChanged:ve.optional(ve.boolean())}).passthrough())}).passthrough(),VSe=wy.extend({protocolVersion:ve.string(),capabilities:Q8n,serverInfo:bat,instructions:ve.optional(ve.string())}),xat=uS.extend({method:ve.literal("notifications/initialized")}),wat=t=>xat.safeParse(t).success,YZ=lg.extend({method:ve.literal("ping")}),k8n=ve.object({progress:ve.number(),total:ve.optional(ve.number()),message:ve.optional(ve.string())}).passthrough(),jZ=uS.extend({method:ve.literal("notifications/progress"),params:pG.merge(k8n).extend({progressToken:yat})}),WZ=lg.extend({params:xy.extend({cursor:ve.optional(Cat)}).optional()}),zZ=wy.extend({nextCursor:ve.optional(Cat)}),Rat=ve.object({uri:ve.string(),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),Bat=Rat.extend({text:ve.string()}),Nat=Rat.extend({blob:ve.string().base64()}),Oat=mG.extend({uri:ve.string(),description:ve.optional(ve.string()),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}),U8n=mG.extend({uriTemplate:ve.string(),description:ve.optional(ve.string()),mimeType:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}),G8n=WZ.extend({method:ve.literal("resources/list")}),$Se=zZ.extend({resources:ve.array(Oat)}),H8n=WZ.extend({method:ve.literal("resources/templates/list")}),YSe=zZ.extend({resourceTemplates:ve.array(U8n)}),q8n=lg.extend({method:ve.literal("resources/read"),params:xy.extend({uri:ve.string()})}),jSe=wy.extend({contents:ve.array(ve.union([Bat,Nat]))}),V8n=uS.extend({method:ve.literal("notifications/resources/list_changed")}),$8n=lg.extend({method:ve.literal("resources/subscribe"),params:xy.extend({uri:ve.string()})}),Y8n=lg.extend({method:ve.literal("resources/unsubscribe"),params:xy.extend({uri:ve.string()})}),j8n=uS.extend({method:ve.literal("notifications/resources/updated"),params:pG.extend({uri:ve.string()})}),W8n=ve.object({name:ve.string(),description:ve.optional(ve.string()),required:ve.optional(ve.boolean())}).passthrough(),z8n=mG.extend({description:ve.optional(ve.string()),arguments:ve.optional(ve.array(W8n)),_meta:ve.optional(ve.object({}).passthrough())}),J8n=WZ.extend({method:ve.literal("prompts/list")}),AG=zZ.extend({prompts:ve.array(z8n)}),K8n=lg.extend({method:ve.literal("prompts/get"),params:xy.extend({name:ve.string(),arguments:ve.optional(ve.record(ve.string()))})}),WSe=ve.object({type:ve.literal("text"),text:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),zSe=ve.object({type:ve.literal("image"),data:ve.string().base64(),mimeType:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),JSe=ve.object({type:ve.literal("audio"),data:ve.string().base64(),mimeType:ve.string(),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),X8n=ve.object({type:ve.literal("resource"),resource:ve.union([Bat,Nat]),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),Z8n=Oat.extend({type:ve.literal("resource_link")}),Mat=ve.union([WSe,zSe,JSe,Z8n,X8n]),eLn=ve.object({role:ve.enum(["user","assistant"]),content:Mat}).passthrough(),gG=wy.extend({description:ve.optional(ve.string()),messages:ve.array(eLn)}),tLn=uS.extend({method:ve.literal("notifications/prompts/list_changed")}),nLn=ve.object({title:ve.optional(ve.string()),readOnlyHint:ve.optional(ve.boolean()),destructiveHint:ve.optional(ve.boolean()),idempotentHint:ve.optional(ve.boolean()),openWorldHint:ve.optional(ve.boolean())}).passthrough(),rLn=mG.extend({description:ve.optional(ve.string()),inputSchema:ve.object({type:ve.literal("object"),properties:ve.optional(ve.object({}).passthrough()),required:ve.optional(ve.array(ve.string()))}).passthrough(),outputSchema:ve.optional(ve.object({type:ve.literal("object"),properties:ve.optional(ve.object({}).passthrough()),required:ve.optional(ve.array(ve.string()))}).passthrough()),annotations:ve.optional(nLn),_meta:ve.optional(ve.object({}).passthrough())}),iLn=WZ.extend({method:ve.literal("tools/list")}),KSe=zZ.extend({tools:ve.array(rLn)}),JZ=wy.extend({content:ve.array(Mat).default([]),structuredContent:ve.object({}).passthrough().optional(),isError:ve.optional(ve.boolean())}),jKr=JZ.or(wy.extend({toolResult:ve.unknown()})),oLn=lg.extend({method:ve.literal("tools/call"),params:xy.extend({name:ve.string(),arguments:ve.optional(ve.record(ve.unknown()))})}),sLn=uS.extend({method:ve.literal("notifications/tools/list_changed")}),Fat=ve.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),aLn=lg.extend({method:ve.literal("logging/setLevel"),params:xy.extend({level:Fat})}),lLn=uS.extend({method:ve.literal("notifications/message"),params:pG.extend({level:Fat,logger:ve.optional(ve.string()),data:ve.unknown()})}),uLn=ve.object({name:ve.string().optional()}).passthrough(),cLn=ve.object({hints:ve.optional(ve.array(uLn)),costPriority:ve.optional(ve.number().min(0).max(1)),speedPriority:ve.optional(ve.number().min(0).max(1)),intelligencePriority:ve.optional(ve.number().min(0).max(1))}).passthrough(),dLn=ve.object({role:ve.enum(["user","assistant"]),content:ve.union([WSe,zSe,JSe])}).passthrough(),fLn=lg.extend({method:ve.literal("sampling/createMessage"),params:xy.extend({messages:ve.array(dLn),systemPrompt:ve.optional(ve.string()),includeContext:ve.optional(ve.enum(["none","thisServer","allServers"])),temperature:ve.optional(ve.number()),maxTokens:ve.number().int(),stopSequences:ve.optional(ve.array(ve.string())),metadata:ve.optional(ve.object({}).passthrough()),modelPreferences:ve.optional(cLn)})}),pLn=wy.extend({model:ve.string(),stopReason:ve.optional(ve.enum(["endTurn","stopSequence","maxTokens"]).or(ve.string())),role:ve.enum(["user","assistant"]),content:ve.discriminatedUnion("type",[WSe,zSe,JSe])}),hLn=ve.object({type:ve.literal("boolean"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),default:ve.optional(ve.boolean())}).passthrough(),mLn=ve.object({type:ve.literal("string"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),minLength:ve.optional(ve.number()),maxLength:ve.optional(ve.number()),format:ve.optional(ve.enum(["email","uri","date","date-time"]))}).passthrough(),ALn=ve.object({type:ve.enum(["number","integer"]),title:ve.optional(ve.string()),description:ve.optional(ve.string()),minimum:ve.optional(ve.number()),maximum:ve.optional(ve.number())}).passthrough(),gLn=ve.object({type:ve.literal("string"),title:ve.optional(ve.string()),description:ve.optional(ve.string()),enum:ve.array(ve.string()),enumNames:ve.optional(ve.array(ve.string()))}).passthrough(),ELn=ve.union([hLn,mLn,ALn,gLn]),yLn=lg.extend({method:ve.literal("elicitation/create"),params:xy.extend({message:ve.string(),requestedSchema:ve.object({type:ve.literal("object"),properties:ve.record(ve.string(),ELn),required:ve.optional(ve.array(ve.string()))}).passthrough()})}),CLn=wy.extend({action:ve.enum(["accept","decline","cancel"]),content:ve.optional(ve.record(ve.string(),ve.unknown()))}),vLn=ve.object({type:ve.literal("ref/resource"),uri:ve.string()}).passthrough(),DLn=ve.object({type:ve.literal("ref/prompt"),name:ve.string()}).passthrough(),SLn=lg.extend({method:ve.literal("completion/complete"),params:xy.extend({ref:ve.union([DLn,vLn]),argument:ve.object({name:ve.string(),value:ve.string()}).passthrough(),context:ve.optional(ve.object({arguments:ve.optional(ve.record(ve.string(),ve.string()))}))})}),XSe=wy.extend({completion:ve.object({values:ve.array(ve.string()).max(100),total:ve.optional(ve.number().int()),hasMore:ve.optional(ve.boolean())}).passthrough()}),_Ln=ve.object({uri:ve.string().startsWith("file://"),name:ve.optional(ve.string()),_meta:ve.optional(ve.object({}).passthrough())}).passthrough(),ILn=lg.extend({method:ve.literal("roots/list")}),TLn=wy.extend({roots:ve.array(_Ln)}),bLn=uS.extend({method:ve.literal("notifications/roots/list_changed")}),WKr=ve.union([YZ,P8n,SLn,aLn,K8n,J8n,G8n,H8n,q8n,$8n,Y8n,oLn,iLn]),zKr=ve.union([$Z,jZ,xat,bLn]),JKr=ve.union([PN,pLn,CLn,TLn]),KKr=ve.union([YZ,fLn,yLn,ILn]),XKr=ve.union([$Z,jZ,lLn,j8n,V8n,sLn,tLn]),ZKr=ve.union([PN,VSe,XSe,gG,AG,$Se,YSe,jSe,JZ,KSe]),by=class extends Error{constructor(e,n,r){super(`MCP error ${e}: ${n}`),this.code=e,this.data=r,this.name="McpError"}}});function Lat(t,e){return Object.entries(e).reduce((n,[r,i])=>(i&&typeof i=="object"?n[r]=n[r]?{...n[r],...i}:i:n[r]=i,n),{...t})}var xLn,KZ,Pat=Le(()=>{dx();xLn=6e4,KZ=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler($Z,n=>{let r=this._requestHandlerAbortControllers.get(n.params.requestId);r?.abort(n.params.reason)}),this.setNotificationHandler(jZ,n=>{this._onprogress(n)}),this.setRequestHandler(YZ,n=>({}))}_setupTimeout(e,n,r,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),new by(Ty.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var n,r,i;this._transport=e;let o=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(r=this.transport)===null||r===void 0?void 0:r.onerror;this._transport.onerror=l=>{s?.(l),this._onerror(l)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(l,u)=>{a?.(l,u),hG(l)||Tat(l)?this._onresponse(l):VZ(l)?this._onrequest(l,u):Sat(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let r=new by(Ty.ConnectionClosed,"Connection closed");for(let i of n.values())i(r)}_onerror(e){var n;(n=this.onerror)===null||n===void 0||n.call(this,e)}_onnotification(e){var n;let r=(n=this._notificationHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,n){var r,i,o,s;let a=(r=this._requestHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackRequestHandler;if(a===void 0){(i=this._transport)===null||i===void 0||i.send({jsonrpc:"2.0",id:e.id,error:{code:Ty.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let u={signal:l.signal,sessionId:(o=this._transport)===null||o===void 0?void 0:o.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,d,h)=>this.request(c,d,{...h,relatedRequestId:e.id}),authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo};Promise.resolve().then(()=>a(e,u)).then(c=>{var d;if(!l.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var d,h;if(!l.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Ty.InternalError,message:(h=c.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,i=Number(n),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){s(l);return}o(r)}_onresponse(e){let n=Number(e.id),r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),hG(e))r(e);else{let i=new by(e.error.code,e.error.message,e.error.data);r(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,n,r){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=r??{};return new Promise((a,l)=>{var u,c,d,h,m,E;if(!this._transport){l(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(c=r?.signal)===null||c===void 0||c.throwIfAborted();let y=this._requestMessageId++,C={...e,jsonrpc:"2.0",id:y};r?.onprogress&&(this._progressHandlers.set(y,r.onprogress),C.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:y}});let _=R=>{var F;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),(F=this._transport)===null||F===void 0||F.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(R)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(q=>this._onerror(new Error(`Failed to send cancellation: ${q}`))),l(R)};this._responseHandlers.set(y,R=>{var F;if(!(!((F=r?.signal)===null||F===void 0)&&F.aborted)){if(R instanceof Error)return l(R);try{let q=n.parse(R.result);a(q)}catch(q){l(q)}}}),(h=r?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var R;_((R=r?.signal)===null||R===void 0?void 0:R.reason)});let w=(m=r?.timeout)!==null&&m!==void 0?m:xLn,B=()=>_(new by(Ty.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(y,w,r?.maxTotalTimeout,B,(E=r?.resetTimeoutOnProgress)!==null&&E!==void 0?E:!1),this._transport.send(C,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(R=>{this._cleanupTimeout(y),l(R)})})}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r={...e,jsonrpc:"2.0"};await this._transport.send(r,n)}setRequestHandler(e,n){let r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,o)=>Promise.resolve(n(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){this._notificationHandlers.set(e.shape.method.value,r=>Promise.resolve(n(e.parse(r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var kat=b((XZ,Qat)=>{(function(t,e){typeof XZ=="object"&&typeof Qat<"u"?e(XZ):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(XZ,function(t){"use strict";function e(){for(var Je=arguments.length,je=Array(Je),ut=0;ut<Je;ut++)je[ut]=arguments[ut];if(je.length>1){je[0]=je[0].slice(0,-1);for(var St=je.length-1,st=1;st<St;++st)je[st]=je[st].slice(1,-1);return je[St]=je[St].slice(1),je.join("")}else return je[0]}function n(Je){return"(?:"+Je+")"}function r(Je){return Je===void 0?"undefined":Je===null?"null":Object.prototype.toString.call(Je).split(" ").pop().split("]").shift().toLowerCase()}function i(Je){return Je.toUpperCase()}function o(Je){return Je!=null?Je instanceof Array?Je:typeof Je.length!="number"||Je.split||Je.setInterval||Je.call?[Je]:Array.prototype.slice.call(Je):[]}function s(Je,je){var ut=Je;if(je)for(var St in je)ut[St]=je[St];return ut}function a(Je){var je="[A-Za-z]",ut="[\\x0D]",St="[0-9]",st="[\\x22]",vn=e(St,"[A-Fa-f]"),Vn="[\\x0A]",li="[\\x20]",Ir=n(n("%[EFef]"+vn+"%"+vn+vn+"%"+vn+vn)+"|"+n("%[89A-Fa-f]"+vn+"%"+vn+vn)+"|"+n("%"+vn+vn)),As="[\\:\\/\\?\\#\\[\\]\\@]",Pi="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Bo=e(As,Pi),ks=Je?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Cr=Je?"[\\uE000-\\uF8FF]":"[]",ni=e(je,St,"[\\-\\.\\_\\~]",ks),Do=n(je+e(je,St,"[\\+\\-\\.]")+"*"),No=n(n(Ir+"|"+e(ni,Pi,"[\\:]"))+"*"),Nu=n(n("25[0-5]")+"|"+n("2[0-4]"+St)+"|"+n("1"+St+St)+"|"+n("[1-9]"+St)+"|"+St),va=n(n("25[0-5]")+"|"+n("2[0-4]"+St)+"|"+n("1"+St+St)+"|"+n("0?[1-9]"+St)+"|0?0?"+St),Ks=n(va+"\\."+va+"\\."+va+"\\."+va),Ei=n(vn+"{1,4}"),fl=n(n(Ei+"\\:"+Ei)+"|"+Ks),ui=n(n(Ei+"\\:")+"{6}"+fl),ci=n("\\:\\:"+n(Ei+"\\:")+"{5}"+fl),Ou=n(n(Ei)+"?\\:\\:"+n(Ei+"\\:")+"{4}"+fl),Da=n(n(n(Ei+"\\:")+"{0,1}"+Ei)+"?\\:\\:"+n(Ei+"\\:")+"{3}"+fl),ho=n(n(n(Ei+"\\:")+"{0,2}"+Ei)+"?\\:\\:"+n(Ei+"\\:")+"{2}"+fl),Ic=n(n(n(Ei+"\\:")+"{0,3}"+Ei)+"?\\:\\:"+Ei+"\\:"+fl),ua=n(n(n(Ei+"\\:")+"{0,4}"+Ei)+"?\\:\\:"+fl),gs=n(n(n(Ei+"\\:")+"{0,5}"+Ei)+"?\\:\\:"+Ei),ja=n(n(n(Ei+"\\:")+"{0,6}"+Ei)+"?\\:\\:"),Be=n([ui,ci,Ou,Da,ho,Ic,ua,gs,ja].join("|")),Me=n(n(ni+"|"+Ir)+"+"),tt=n(Be+"\\%25"+Me),ct=n(Be+n("\\%25|\\%(?!"+vn+"{2})")+Me),Ct=n("[vV]"+vn+"+\\."+e(ni,Pi,"[\\:]")+"+"),Ft=n("\\["+n(ct+"|"+Be+"|"+Ct)+"\\]"),Jt=n(n(Ir+"|"+e(ni,Pi))+"*"),Vt=n(Ft+"|"+Ks+"(?!"+Jt+")|"+Jt),nn=n(St+"*"),en=n(n(No+"@")+"?"+Vt+n("\\:"+nn)+"?"),hn=n(Ir+"|"+e(ni,Pi,"[\\:\\@]")),sr=n(hn+"*"),Ii=n(hn+"+"),Us=n(n(Ir+"|"+e(ni,Pi,"[\\@]"))+"+"),hi=n(n("\\/"+sr)+"*"),La=n("\\/"+n(Ii+hi)+"?"),eu=n(Us+hi),ad=n(Ii+hi),Ts="(?!"+hn+")",hE=n(hi+"|"+La+"|"+eu+"|"+ad+"|"+Ts),Hd=n(n(hn+"|"+e("[\\/\\?]",Cr))+"*"),ld=n(n(hn+"|[\\/\\?]")+"*"),gm=n(n("\\/\\/"+en+hi)+"|"+La+"|"+ad+"|"+Ts),mE=n(Do+"\\:"+gm+n("\\?"+Hd)+"?"+n("\\#"+ld)+"?"),ph=n(n("\\/\\/"+en+hi)+"|"+La+"|"+eu+"|"+Ts),Wa=n(ph+n("\\?"+Hd)+"?"+n("\\#"+ld)+"?"),wA=n(mE+"|"+Wa),Ef=n(Do+"\\:"+gm+n("\\?"+Hd)+"?"),Em="^("+Do+")\\:"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+ad+"|"+Ts+")")+n("\\?("+Hd+")")+"?"+n("\\#("+ld+")")+"?$",yf="^(){0}"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+eu+"|"+Ts+")")+n("\\?("+Hd+")")+"?"+n("\\#("+ld+")")+"?$",ym="^("+Do+")\\:"+n(n("\\/\\/("+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?)")+"?("+hi+"|"+La+"|"+ad+"|"+Ts+")")+n("\\?("+Hd+")")+"?$",Mu="^"+n("\\#("+ld+")")+"?$",Vg="^"+n("("+No+")@")+"?("+Vt+")"+n("\\:("+nn+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",je,St,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ni,Pi),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ni,Pi),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ni,Pi),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ni,Pi),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ni,Pi,"[\\:\\@\\/\\?]",Cr),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ni,Pi,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ni,Pi),"g"),UNRESERVED:new RegExp(ni,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ni,Bo),"g"),PCT_ENCODED:new RegExp(Ir,"g"),IPV4ADDRESS:new RegExp("^("+Ks+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Be+")"+n(n("\\%25|\\%(?!"+vn+"{2})")+"("+Me+")")+"?\\]?$")}}var l=a(!1),u=a(!0),c=function(){function Je(je,ut){var St=[],st=!0,vn=!1,Vn=void 0;try{for(var li=je[Symbol.iterator](),Ir;!(st=(Ir=li.next()).done)&&(St.push(Ir.value),!(ut&&St.length===ut));st=!0);}catch(As){vn=!0,Vn=As}finally{try{!st&&li.return&&li.return()}finally{if(vn)throw Vn}}return St}return function(je,ut){if(Array.isArray(je))return je;if(Symbol.iterator in Object(je))return Je(je,ut);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(Je){if(Array.isArray(Je)){for(var je=0,ut=Array(Je.length);je<Je.length;je++)ut[je]=Je[je];return ut}else return Array.from(Je)},h=2147483647,m=36,E=1,y=26,C=38,_=700,w=72,B=128,R="-",F=/^xn--/,q=/[^\0-\x7E]/,J=/[\x2E\u3002\uFF0E\uFF61]/g,j={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=m-E,K=Math.floor,U=String.fromCharCode;function se(Je){throw new RangeError(j[Je])}function V(Je,je){for(var ut=[],St=Je.length;St--;)ut[St]=je(Je[St]);return ut}function O(Je,je){var ut=Je.split("@"),St="";ut.length>1&&(St=ut[0]+"@",Je=ut[1]),Je=Je.replace(J,".");var st=Je.split("."),vn=V(st,je).join(".");return St+vn}function Y(Je){for(var je=[],ut=0,St=Je.length;ut<St;){var st=Je.charCodeAt(ut++);if(st>=55296&&st<=56319&&ut<St){var vn=Je.charCodeAt(ut++);(vn&64512)==56320?je.push(((st&1023)<<10)+(vn&1023)+65536):(je.push(st),ut--)}else je.push(st)}return je}var ee=function(je){return String.fromCodePoint.apply(String,d(je))},ne=function(je){return je-48<10?je-22:je-65<26?je-65:je-97<26?je-97:m},Ae=function(je,ut){return je+22+75*(je<26)-((ut!=0)<<5)},Ce=function(je,ut,St){var st=0;for(je=St?K(je/_):je>>1,je+=K(je/ut);je>L*y>>1;st+=m)je=K(je/L);return K(st+(L+1)*je/(je+C))},De=function(je){var ut=[],St=je.length,st=0,vn=B,Vn=w,li=je.lastIndexOf(R);li<0&&(li=0);for(var Ir=0;Ir<li;++Ir)je.charCodeAt(Ir)>=128&&se("not-basic"),ut.push(je.charCodeAt(Ir));for(var As=li>0?li+1:0;As<St;){for(var Pi=st,Bo=1,ks=m;;ks+=m){As>=St&&se("invalid-input");var Cr=ne(je.charCodeAt(As++));(Cr>=m||Cr>K((h-st)/Bo))&&se("overflow"),st+=Cr*Bo;var ni=ks<=Vn?E:ks>=Vn+y?y:ks-Vn;if(Cr<ni)break;var Do=m-ni;Bo>K(h/Do)&&se("overflow"),Bo*=Do}var No=ut.length+1;Vn=Ce(st-Pi,No,Pi==0),K(st/No)>h-vn&&se("overflow"),vn+=K(st/No),st%=No,ut.splice(st++,0,vn)}return String.fromCodePoint.apply(String,ut)},Ue=function(je){var ut=[];je=Y(je);var St=je.length,st=B,vn=0,Vn=w,li=!0,Ir=!1,As=void 0;try{for(var Pi=je[Symbol.iterator](),Bo;!(li=(Bo=Pi.next()).done);li=!0){var ks=Bo.value;ks<128&&ut.push(U(ks))}}catch(ct){Ir=!0,As=ct}finally{try{!li&&Pi.return&&Pi.return()}finally{if(Ir)throw As}}var Cr=ut.length,ni=Cr;for(Cr&&ut.push(R);ni<St;){var Do=h,No=!0,Nu=!1,va=void 0;try{for(var Ks=je[Symbol.iterator](),Ei;!(No=(Ei=Ks.next()).done);No=!0){var fl=Ei.value;fl>=st&&fl<Do&&(Do=fl)}}catch(ct){Nu=!0,va=ct}finally{try{!No&&Ks.return&&Ks.return()}finally{if(Nu)throw va}}var ui=ni+1;Do-st>K((h-vn)/ui)&&se("overflow"),vn+=(Do-st)*ui,st=Do;var ci=!0,Ou=!1,Da=void 0;try{for(var ho=je[Symbol.iterator](),Ic;!(ci=(Ic=ho.next()).done);ci=!0){var ua=Ic.value;if(ua<st&&++vn>h&&se("overflow"),ua==st){for(var gs=vn,ja=m;;ja+=m){var Be=ja<=Vn?E:ja>=Vn+y?y:ja-Vn;if(gs<Be)break;var Me=gs-Be,tt=m-Be;ut.push(U(Ae(Be+Me%tt,0))),gs=K(Me/tt)}ut.push(U(Ae(gs,0))),Vn=Ce(vn,ui,ni==Cr),vn=0,++ni}}}catch(ct){Ou=!0,Da=ct}finally{try{!ci&&ho.return&&ho.return()}finally{if(Ou)throw Da}}++vn,++st}return ut.join("")},qe=function(je){return O(je,function(ut){return F.test(ut)?De(ut.slice(4).toLowerCase()):ut})},Ie=function(je){return O(je,function(ut){return q.test(ut)?"xn--"+Ue(ut):ut})},xe={version:"2.1.0",ucs2:{decode:Y,encode:ee},decode:De,encode:Ue,toASCII:Ie,toUnicode:qe},Oe={};function le(Je){var je=Je.charCodeAt(0),ut=void 0;return je<16?ut="%0"+je.toString(16).toUpperCase():je<128?ut="%"+je.toString(16).toUpperCase():je<2048?ut="%"+(je>>6|192).toString(16).toUpperCase()+"%"+(je&63|128).toString(16).toUpperCase():ut="%"+(je>>12|224).toString(16).toUpperCase()+"%"+(je>>6&63|128).toString(16).toUpperCase()+"%"+(je&63|128).toString(16).toUpperCase(),ut}function re(Je){for(var je="",ut=0,St=Je.length;ut<St;){var st=parseInt(Je.substr(ut+1,2),16);if(st<128)je+=String.fromCharCode(st),ut+=3;else if(st>=194&&st<224){if(St-ut>=6){var vn=parseInt(Je.substr(ut+4,2),16);je+=String.fromCharCode((st&31)<<6|vn&63)}else je+=Je.substr(ut,6);ut+=6}else if(st>=224){if(St-ut>=9){var Vn=parseInt(Je.substr(ut+4,2),16),li=parseInt(Je.substr(ut+7,2),16);je+=String.fromCharCode((st&15)<<12|(Vn&63)<<6|li&63)}else je+=Je.substr(ut,9);ut+=9}else je+=Je.substr(ut,3),ut+=3}return je}function ye(Je,je){function ut(St){var st=re(St);return st.match(je.UNRESERVED)?st:St}return Je.scheme&&(Je.scheme=String(Je.scheme).replace(je.PCT_ENCODED,ut).toLowerCase().replace(je.NOT_SCHEME,"")),Je.userinfo!==void 0&&(Je.userinfo=String(Je.userinfo).replace(je.PCT_ENCODED,ut).replace(je.NOT_USERINFO,le).replace(je.PCT_ENCODED,i)),Je.host!==void 0&&(Je.host=String(Je.host).replace(je.PCT_ENCODED,ut).toLowerCase().replace(je.NOT_HOST,le).replace(je.PCT_ENCODED,i)),Je.path!==void 0&&(Je.path=String(Je.path).replace(je.PCT_ENCODED,ut).replace(Je.scheme?je.NOT_PATH:je.NOT_PATH_NOSCHEME,le).replace(je.PCT_ENCODED,i)),Je.query!==void 0&&(Je.query=String(Je.query).replace(je.PCT_ENCODED,ut).replace(je.NOT_QUERY,le).replace(je.PCT_ENCODED,i)),Je.fragment!==void 0&&(Je.fragment=String(Je.fragment).replace(je.PCT_ENCODED,ut).replace(je.NOT_FRAGMENT,le).replace(je.PCT_ENCODED,i)),Je}function X(Je){return Je.replace(/^0*(.*)/,"$1")||"0"}function he(Je,je){var ut=Je.match(je.IPV4ADDRESS)||[],St=c(ut,2),st=St[1];return st?st.split(".").map(X).join("."):Je}function ae(Je,je){var ut=Je.match(je.IPV6ADDRESS)||[],St=c(ut,3),st=St[1],vn=St[2];if(st){for(var Vn=st.toLowerCase().split("::").reverse(),li=c(Vn,2),Ir=li[0],As=li[1],Pi=As?As.split(":").map(X):[],Bo=Ir.split(":").map(X),ks=je.IPV4ADDRESS.test(Bo[Bo.length-1]),Cr=ks?7:8,ni=Bo.length-Cr,Do=Array(Cr),No=0;No<Cr;++No)Do[No]=Pi[No]||Bo[ni+No]||"";ks&&(Do[Cr-1]=he(Do[Cr-1],je));var Nu=Do.reduce(function(ui,ci,Ou){if(!ci||ci==="0"){var Da=ui[ui.length-1];Da&&Da.index+Da.length===Ou?Da.length++:ui.push({index:Ou,length:1})}return ui},[]),va=Nu.sort(function(ui,ci){return ci.length-ui.length})[0],Ks=void 0;if(va&&va.length>1){var Ei=Do.slice(0,va.index),fl=Do.slice(va.index+va.length);Ks=Ei.join(":")+"::"+fl.join(":")}else Ks=Do.join(":");return vn&&(Ks+="%"+vn),Ks}else return Je}var me=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Se="".match(/(){0}/)[1]===void 0;function ie(Je){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ut={},St=je.iri!==!1?u:l;je.reference==="suffix"&&(Je=(je.scheme?je.scheme+":":"")+"//"+Je);var st=Je.match(me);if(st){Se?(ut.scheme=st[1],ut.userinfo=st[3],ut.host=st[4],ut.port=parseInt(st[5],10),ut.path=st[6]||"",ut.query=st[7],ut.fragment=st[8],isNaN(ut.port)&&(ut.port=st[5])):(ut.scheme=st[1]||void 0,ut.userinfo=Je.indexOf("@")!==-1?st[3]:void 0,ut.host=Je.indexOf("//")!==-1?st[4]:void 0,ut.port=parseInt(st[5],10),ut.path=st[6]||"",ut.query=Je.indexOf("?")!==-1?st[7]:void 0,ut.fragment=Je.indexOf("#")!==-1?st[8]:void 0,isNaN(ut.port)&&(ut.port=Je.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?st[4]:void 0)),ut.host&&(ut.host=ae(he(ut.host,St),St)),ut.scheme===void 0&&ut.userinfo===void 0&&ut.host===void 0&&ut.port===void 0&&!ut.path&&ut.query===void 0?ut.reference="same-document":ut.scheme===void 0?ut.reference="relative":ut.fragment===void 0?ut.reference="absolute":ut.reference="uri",je.reference&&je.reference!=="suffix"&&je.reference!==ut.reference&&(ut.error=ut.error||"URI is not a "+je.reference+" reference.");var vn=Oe[(je.scheme||ut.scheme||"").toLowerCase()];if(!je.unicodeSupport&&(!vn||!vn.unicodeSupport)){if(ut.host&&(je.domainHost||vn&&vn.domainHost))try{ut.host=xe.toASCII(ut.host.replace(St.PCT_ENCODED,re).toLowerCase())}catch(Vn){ut.error=ut.error||"Host's domain name can not be converted to ASCII via punycode: "+Vn}ye(ut,l)}else ye(ut,St);vn&&vn.parse&&vn.parse(ut,je)}else ut.error=ut.error||"URI can not be parsed.";return ut}function k(Je,je){var ut=je.iri!==!1?u:l,St=[];return Je.userinfo!==void 0&&(St.push(Je.userinfo),St.push("@")),Je.host!==void 0&&St.push(ae(he(String(Je.host),ut),ut).replace(ut.IPV6ADDRESS,function(st,vn,Vn){return"["+vn+(Vn?"%25"+Vn:"")+"]"})),(typeof Je.port=="number"||typeof Je.port=="string")&&(St.push(":"),St.push(String(Je.port))),St.length?St.join(""):void 0}var W=/^\.\.?\//,pe=/^\/\.(\/|$)/,te=/^\/\.\.(\/|$)/,H=/^\/?(?:.|\n)*?(?=\/|$)/;function ge(Je){for(var je=[];Je.length;)if(Je.match(W))Je=Je.replace(W,"");else if(Je.match(pe))Je=Je.replace(pe,"/");else if(Je.match(te))Je=Je.replace(te,"/"),je.pop();else if(Je==="."||Je==="..")Je="";else{var ut=Je.match(H);if(ut){var St=ut[0];Je=Je.slice(St.length),je.push(St)}else throw new Error("Unexpected dot segment condition")}return je.join("")}function be(Je){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ut=je.iri?u:l,St=[],st=Oe[(je.scheme||Je.scheme||"").toLowerCase()];if(st&&st.serialize&&st.serialize(Je,je),Je.host&&!ut.IPV6ADDRESS.test(Je.host)){if(je.domainHost||st&&st.domainHost)try{Je.host=je.iri?xe.toUnicode(Je.host):xe.toASCII(Je.host.replace(ut.PCT_ENCODED,re).toLowerCase())}catch(li){Je.error=Je.error||"Host's domain name can not be converted to "+(je.iri?"Unicode":"ASCII")+" via punycode: "+li}}ye(Je,ut),je.reference!=="suffix"&&Je.scheme&&(St.push(Je.scheme),St.push(":"));var vn=k(Je,je);if(vn!==void 0&&(je.reference!=="suffix"&&St.push("//"),St.push(vn),Je.path&&Je.path.charAt(0)!=="/"&&St.push("/")),Je.path!==void 0){var Vn=Je.path;!je.absolutePath&&(!st||!st.absolutePath)&&(Vn=ge(Vn)),vn===void 0&&(Vn=Vn.replace(/^\/\//,"/%2F")),St.push(Vn)}return Je.query!==void 0&&(St.push("?"),St.push(Je.query)),Je.fragment!==void 0&&(St.push("#"),St.push(Je.fragment)),St.join("")}function Pe(Je,je){var ut=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},St=arguments[3],st={};return St||(Je=ie(be(Je,ut),ut),je=ie(be(je,ut),ut)),ut=ut||{},!ut.tolerant&&je.scheme?(st.scheme=je.scheme,st.userinfo=je.userinfo,st.host=je.host,st.port=je.port,st.path=ge(je.path||""),st.query=je.query):(je.userinfo!==void 0||je.host!==void 0||je.port!==void 0?(st.userinfo=je.userinfo,st.host=je.host,st.port=je.port,st.path=ge(je.path||""),st.query=je.query):(je.path?(je.path.charAt(0)==="/"?st.path=ge(je.path):((Je.userinfo!==void 0||Je.host!==void 0||Je.port!==void 0)&&!Je.path?st.path="/"+je.path:Je.path?st.path=Je.path.slice(0,Je.path.lastIndexOf("/")+1)+je.path:st.path=je.path,st.path=ge(st.path)),st.query=je.query):(st.path=Je.path,je.query!==void 0?st.query=je.query:st.query=Je.query),st.userinfo=Je.userinfo,st.host=Je.host,st.port=Je.port),st.scheme=Je.scheme),st.fragment=je.fragment,st}function pt(Je,je,ut){var St=s({scheme:"null"},ut);return be(Pe(ie(Je,St),ie(je,St),St,!0),St)}function Dt(Je,je){return typeof Je=="string"?Je=be(ie(Je,je),je):r(Je)==="object"&&(Je=ie(be(Je,je),je)),Je}function Qt(Je,je,ut){return typeof Je=="string"?Je=be(ie(Je,ut),ut):r(Je)==="object"&&(Je=be(Je,ut)),typeof je=="string"?je=be(ie(je,ut),ut):r(je)==="object"&&(je=be(je,ut)),Je===je}function dt(Je,je){return Je&&Je.toString().replace(!je||!je.iri?l.ESCAPE:u.ESCAPE,le)}function mt(Je,je){return Je&&Je.toString().replace(!je||!je.iri?l.PCT_ENCODED:u.PCT_ENCODED,re)}var kt={scheme:"http",domainHost:!0,parse:function(je,ut){return je.host||(je.error=je.error||"HTTP URIs must have a host."),je},serialize:function(je,ut){var St=String(je.scheme).toLowerCase()==="https";return(je.port===(St?443:80)||je.port==="")&&(je.port=void 0),je.path||(je.path="/"),je}},Ln={scheme:"https",domainHost:kt.domainHost,parse:kt.parse,serialize:kt.serialize};function si(Je){return typeof Je.secure=="boolean"?Je.secure:String(Je.scheme).toLowerCase()==="wss"}var Ni={scheme:"ws",domainHost:!0,parse:function(je,ut){var St=je;return St.secure=si(St),St.resourceName=(St.path||"/")+(St.query?"?"+St.query:""),St.path=void 0,St.query=void 0,St},serialize:function(je,ut){if((je.port===(si(je)?443:80)||je.port==="")&&(je.port=void 0),typeof je.secure=="boolean"&&(je.scheme=je.secure?"wss":"ws",je.secure=void 0),je.resourceName){var St=je.resourceName.split("?"),st=c(St,2),vn=st[0],Vn=st[1];je.path=vn&&vn!=="/"?vn:void 0,je.query=Vn,je.resourceName=void 0}return je.fragment=void 0,je}},Yi={scheme:"wss",domainHost:Ni.domainHost,parse:Ni.parse,serialize:Ni.serialize},Go={},to=!0,Re="[A-Za-z0-9\\-\\.\\_\\~"+(to?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ot="[0-9A-Fa-f]",it=n(n("%[EFef]"+ot+"%"+ot+ot+"%"+ot+ot)+"|"+n("%[89A-Fa-f]"+ot+"%"+ot+ot)+"|"+n("%"+ot+ot)),Lt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Cn="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",On=e(Cn,'[\\"\\\\]'),_n="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(Re,"g"),Un=new RegExp(it,"g"),Fa=new RegExp(e("[^]",Lt,"[\\.]",'[\\"]',On),"g"),vl=new RegExp(e("[^]",Re,_n),"g"),Ud=vl;function sd(Je){var je=re(Je);return je.match(ur)?je:Je}var _c={scheme:"mailto",parse:function(je,ut){var St=je,st=St.to=St.path?St.path.split(","):[];if(St.path=void 0,St.query){for(var vn=!1,Vn={},li=St.query.split("&"),Ir=0,As=li.length;Ir<As;++Ir){var Pi=li[Ir].split("=");switch(Pi[0]){case"to":for(var Bo=Pi[1].split(","),ks=0,Cr=Bo.length;ks<Cr;++ks)st.push(Bo[ks]);break;case"subject":St.subject=mt(Pi[1],ut);break;case"body":St.body=mt(Pi[1],ut);break;default:vn=!0,Vn[mt(Pi[0],ut)]=mt(Pi[1],ut);break}}vn&&(St.headers=Vn)}St.query=void 0;for(var ni=0,Do=st.length;ni<Do;++ni){var No=st[ni].split("@");if(No[0]=mt(No[0]),ut.unicodeSupport)No[1]=mt(No[1],ut).toLowerCase();else try{No[1]=xe.toASCII(mt(No[1],ut).toLowerCase())}catch(Nu){St.error=St.error||"Email address's domain name can not be converted to ASCII via punycode: "+Nu}st[ni]=No.join("@")}return St},serialize:function(je,ut){var St=je,st=o(je.to);if(st){for(var vn=0,Vn=st.length;vn<Vn;++vn){var li=String(st[vn]),Ir=li.lastIndexOf("@"),As=li.slice(0,Ir).replace(Un,sd).replace(Un,i).replace(Fa,le),Pi=li.slice(Ir+1);try{Pi=ut.iri?xe.toUnicode(Pi):xe.toASCII(mt(Pi,ut).toLowerCase())}catch(ni){St.error=St.error||"Email address's domain name can not be converted to "+(ut.iri?"Unicode":"ASCII")+" via punycode: "+ni}st[vn]=As+"@"+Pi}St.path=st.join(",")}var Bo=je.headers=je.headers||{};je.subject&&(Bo.subject=je.subject),je.body&&(Bo.body=je.body);var ks=[];for(var Cr in Bo)Bo[Cr]!==Go[Cr]&&ks.push(Cr.replace(Un,sd).replace(Un,i).replace(vl,le)+"="+Bo[Cr].replace(Un,sd).replace(Un,i).replace(Ud,le));return ks.length&&(St.query=ks.join("&")),St}},Bu=/^([^\:]+)\:(.*)/,Ca={scheme:"urn",parse:function(je,ut){var St=je.path&&je.path.match(Bu),st=je;if(St){var vn=ut.scheme||st.scheme||"urn",Vn=St[1].toLowerCase(),li=St[2],Ir=vn+":"+(ut.nid||Vn),As=Oe[Ir];st.nid=Vn,st.nss=li,st.path=void 0,As&&(st=As.parse(st,ut))}else st.error=st.error||"URN can not be parsed.";return st},serialize:function(je,ut){var St=ut.scheme||je.scheme||"urn",st=je.nid,vn=St+":"+(ut.nid||st),Vn=Oe[vn];Vn&&(je=Vn.serialize(je,ut));var li=je,Ir=je.nss;return li.path=(st||ut.nid)+":"+Ir,li}},dl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Gd={scheme:"urn:uuid",parse:function(je,ut){var St=je;return St.uuid=St.nss,St.nss=void 0,!ut.tolerant&&(!St.uuid||!St.uuid.match(dl))&&(St.error=St.error||"UUID is not valid."),St},serialize:function(je,ut){var St=je;return St.nss=(je.uuid||"").toLowerCase(),St}};Oe[kt.scheme]=kt,Oe[Ln.scheme]=Ln,Oe[Ni.scheme]=Ni,Oe[Yi.scheme]=Yi,Oe[_c.scheme]=_c,Oe[Ca.scheme]=Ca,Oe[Gd.scheme]=Gd,t.SCHEMES=Oe,t.pctEncChar=le,t.pctDecChars=re,t.parse=ie,t.removeDotSegments=ge,t.serialize=be,t.resolveComponents=Pe,t.resolve=pt,t.normalize=Dt,t.equal=Qt,t.escapeComponent=dt,t.unescapeComponent=mt,Object.defineProperty(t,"__esModule",{value:!0})})});var K8=b((rXr,Uat)=>{"use strict";Uat.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}});var Hat=b((iXr,Gat)=>{"use strict";Gat.exports=function(e){for(var n=0,r=e.length,i=0,o;i<r;)n++,o=e.charCodeAt(i++),o>=55296&&o<=56319&&i<r&&(o=e.charCodeAt(i),(o&64512)==56320&&i++);return n}});var QN=b((oXr,$at)=>{"use strict";$at.exports={copy:wLn,checkDataType:ZSe,checkDataTypes:RLn,coerceToTypes:BLn,toHash:t_e,getProperty:n_e,escapeQuotes:r_e,equal:K8(),ucs2length:Hat(),varOccurences:MLn,varReplace:FLn,schemaHasRules:LLn,schemaHasRulesExcept:PLn,schemaUnknownRules:QLn,toQuotedString:e_e,getPathExpr:kLn,getPath:ULn,getData:qLn,unescapeFragment:VLn,unescapeJsonPointer:o_e,escapeFragment:$Ln,escapeJsonPointer:i_e};function wLn(t,e){e=e||{};for(var n in t)e[n]=t[n];return e}function ZSe(t,e,n,r){var i=r?" !== ":" === ",o=r?" || ":" && ",s=r?"!":"",a=r?"":"!";switch(t){case"null":return e+i+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+o+"typeof "+e+i+'"object"'+o+a+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+i+'"number"'+o+a+"("+e+" % 1)"+o+e+i+e+(n?o+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+i+'"'+t+'"'+(n?o+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+i+'"'+t+'"'}}function RLn(t,e,n){switch(t.length){case 1:return ZSe(t[0],e,n,!0);default:var r="",i=t_e(t);i.array&&i.object&&(r=i.null?"(":"(!"+e+" || ",r+="typeof "+e+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer;for(var o in i)r+=(r?" && ":"")+ZSe(o,e,n,!0);return r}}var qat=t_e(["string","number","integer","boolean","null"]);function BLn(t,e){if(Array.isArray(e)){for(var n=[],r=0;r<e.length;r++){var i=e[r];(qat[i]||t==="array"&&i==="array")&&(n[n.length]=i)}if(n.length)return n}else{if(qat[e])return[e];if(t==="array"&&e==="array")return["array"]}}function t_e(t){for(var e={},n=0;n<t.length;n++)e[t[n]]=!0;return e}var NLn=/^[a-z$_][a-z$_0-9]*$/i,OLn=/'|\\/g;function n_e(t){return typeof t=="number"?"["+t+"]":NLn.test(t)?"."+t:"['"+r_e(t)+"']"}function r_e(t){return t.replace(OLn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function MLn(t,e){e+="[^0-9]";var n=t.match(new RegExp(e,"g"));return n?n.length:0}function FLn(t,e,n){return e+="([^0-9])",n=n.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),n+"$1")}function LLn(t,e){if(typeof t=="boolean")return!t;for(var n in t)if(e[n])return!0}function PLn(t,e,n){if(typeof t=="boolean")return!t&&n!="not";for(var r in t)if(r!=n&&e[r])return!0}function QLn(t,e){if(typeof t!="boolean"){for(var n in t)if(!e[n])return n}}function e_e(t){return"'"+r_e(t)+"'"}function kLn(t,e,n,r){var i=n?"'/' + "+e+(r?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):r?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Vat(t,i)}function ULn(t,e,n){var r=e_e(n?"/"+i_e(e):n_e(e));return Vat(t,r)}var GLn=/^\/(?:[^~]|~0|~1)*$/,HLn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qLn(t,e,n){var r,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!GLn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(HLn),!s)throw new Error("Invalid JSON-pointer: "+t);if(r=+s[1],i=s[2],i=="#"){if(r>=e)throw new Error("Cannot access property/index "+r+" levels up, current level is "+e);return n[e-r]}if(r>e)throw new Error("Cannot access data "+r+" levels up, current level is "+e);if(o="data"+(e-r||""),!i)return o}for(var a=o,l=i.split("/"),u=0;u<l.length;u++){var c=l[u];c&&(o+=n_e(o_e(c)),a+=" && "+o)}return a}function Vat(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function VLn(t){return o_e(decodeURIComponent(t))}function $Ln(t){return encodeURIComponent(i_e(t))}function i_e(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function o_e(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var s_e=b((sXr,Yat)=>{"use strict";var YLn=QN();Yat.exports=jLn;function jLn(t){YLn.copy(t,this)}});var Wat=b((aXr,jat)=>{"use strict";var fx=jat.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};ZZ(e,r,i,t,"",t)};fx.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};fx.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};fx.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};fx.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 ZZ(t,e,n,r,i,o,s,a,l,u){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,o,s,a,l,u);for(var c in r){var d=r[c];if(Array.isArray(d)){if(c in fx.arrayKeywords)for(var h=0;h<d.length;h++)ZZ(t,e,n,d[h],i+"/"+c+"/"+h,o,i,c,r,h)}else if(c in fx.propsKeywords){if(d&&typeof d=="object")for(var m in d)ZZ(t,e,n,d[m],i+"/"+c+"/"+WLn(m),o,i,c,r,m)}else(c in fx.keywords||t.allKeys&&!(c in fx.skipKeywords))&&ZZ(t,e,n,d,i+"/"+c,o,i,c,r)}n(r,i,o,s,a,l,u)}}function WLn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var oee=b((lXr,Xat)=>{"use strict";var EG=kat(),zat=K8(),ree=QN(),eee=s_e(),zLn=Wat();Xat.exports=hx;hx.normalizeId=px;hx.fullPath=tee;hx.url=nee;hx.ids=ePn;hx.inlineRef=a_e;hx.schema=iee;function hx(t,e,n){var r=this._refs[n];if(typeof r=="string")if(this._refs[r])r=this._refs[r];else return hx.call(this,t,e,r);if(r=r||this._schemas[n],r instanceof eee)return a_e(r.schema,this._opts.inlineRefs)?r.schema:r.validate||this._compile(r);var i=iee.call(this,e,n),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof eee?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=a_e(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function iee(t,e){var n=EG.parse(e),r=Kat(n),i=tee(this._getId(t.schema));if(Object.keys(t.schema).length===0||r!==i){var o=px(r),s=this._refs[o];if(typeof s=="string")return JLn.call(this,t,s,n);if(s instanceof eee)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof eee){if(s.validate||this._compile(s),o==px(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=tee(this._getId(t.schema))}return Jat.call(this,n,i,t.schema,t)}function JLn(t,e,n){var r=iee.call(this,t,e);if(r){var i=r.schema,o=r.baseId;t=r.root;var s=this._getId(i);return s&&(o=nee(o,s)),Jat.call(this,n,o,i,t)}}var KLn=ree.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Jat(t,e,n,r){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var i=t.fragment.split("/"),o=1;o<i.length;o++){var s=i[o];if(s){if(s=ree.unescapeFragment(s),n=n[s],n===void 0)break;var a;if(!KLn[s]&&(a=this._getId(n),a&&(e=nee(e,a)),n.$ref)){var l=nee(e,n.$ref),u=iee.call(this,r,l);u&&(n=u.schema,r=u.root,e=u.baseId)}}}if(n!==void 0&&n!==r.schema)return{schema:n,root:r,baseId:e}}}var XLn=ree.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function a_e(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return l_e(t);if(e)return u_e(t)<=e}function l_e(t){var e;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(e=t[n],typeof e=="object"&&!l_e(e))return!1}else for(var r in t)if(r=="$ref"||(e=t[r],typeof e=="object"&&!l_e(e)))return!1;return!0}function u_e(t){var e=0,n;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(n=t[r],typeof n=="object"&&(e+=u_e(n)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(XLn[i])e++;else if(n=t[i],typeof n=="object"&&(e+=u_e(n)+1),e==1/0)return 1/0}return e}function tee(t,e){e!==!1&&(t=px(t));var n=EG.parse(t);return Kat(n)}function Kat(t){return EG.serialize(t).split("#")[0]+"#"}var ZLn=/#\/?$/;function px(t){return t?t.replace(ZLn,""):""}function nee(t,e){return e=px(e),EG.resolve(t,e)}function ePn(t){var e=px(this._getId(t)),n={"":e},r={"":tee(e,!1)},i={},o=this;return zLn(t,{allKeys:!0},function(s,a,l,u,c,d,h){if(a!==""){var m=o._getId(s),E=n[u],y=r[u]+"/"+c;if(h!==void 0&&(y+="/"+(typeof h=="number"?h:ree.escapeFragment(h))),typeof m=="string"){m=E=px(E?EG.resolve(E,m):m);var C=o._refs[m];if(typeof C=="string"&&(C=o._refs[C]),C&&C.schema){if(!zat(s,C.schema))throw new Error('id "'+m+'" resolves to more than one schema')}else if(m!=px(y))if(m[0]=="#"){if(i[m]&&!zat(s,i[m]))throw new Error('id "'+m+'" resolves to more than one schema');i[m]=s}else o._refs[m]=y}n[a]=E,r[a]=y}}),i}});var see=b((uXr,elt)=>{"use strict";var c_e=oee();elt.exports={Validation:Zat(tPn),MissingRef:Zat(d_e)};function tPn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}d_e.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function d_e(t,e,n){this.message=n||d_e.message(t,e),this.missingRef=c_e.url(t,e),this.missingSchema=c_e.normalizeId(c_e.fullPath(this.missingRef))}function Zat(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var f_e=b((cXr,tlt)=>{"use strict";tlt.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var n=typeof e.cycles=="boolean"?e.cycles:!1,r=e.cmp&&function(o){return function(s){return function(a,l){var u={key:a,value:s[a]},c={key:l,value:s[l]};return o(u,c)}}}(e.cmp),i=[];return function o(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var a,l;if(Array.isArray(s)){for(l="[",a=0;a<s.length;a++)a&&(l+=","),l+=o(s[a])||"null";return l+"]"}if(s===null)return"null";if(i.indexOf(s)!==-1){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=i.push(s)-1,c=Object.keys(s).sort(r&&r(s));for(l="",a=0;a<c.length;a++){var d=c[a],h=o(s[d]);h&&(l&&(l+=","),l+=JSON.stringify(d)+":"+h)}return i.splice(u,1),"{"+l+"}"}}(t)}});var p_e=b((dXr,nlt)=>{"use strict";nlt.exports=function(e,n,r){var i="",o=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),a=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var u="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(i+=" var validate = ",o&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",a&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" "+("/*# sourceURL="+a+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var n="false schema",c=e.level,d=e.dataLevel,h=e.schema[n],m=e.schemaPath+e.util.getProperty(n),E=e.errSchemaPath+"/"+n,F=!e.opts.allErrors,j,y="data"+(d||""),R="valid"+c;if(e.schema===!1){e.isTop?F=!0:i+=" var "+R+" = false; ";var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+R+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var w=e.isTop,c=e.level=0,d=e.dataLevel=0,y="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var B="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var c=e.level,d=e.dataLevel,y="data"+(d||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+c+" = errors;"}var R="valid"+c,F=!e.opts.allErrors,q="",J="",j,L=e.schema.type,K=Array.isArray(L);if(L&&e.opts.nullable&&e.schema.nullable===!0&&(K?L.indexOf("null")==-1&&(L=L.concat("null")):L!="null"&&(L=[L,"null"],K=!0)),K&&L.length==1&&(L=L[0],K=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),L){if(e.opts.coerceTypes)var U=e.util.coerceToTypes(e.opts.coerceTypes,L);var se=e.RULES.types[L];if(U||K||se===!0||se&&!H(se)){var m=e.schemaPath+".type",E=e.errSchemaPath+"/type",m=e.schemaPath+".type",E=e.errSchemaPath+"/type",V=K?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[V](L,y,e.opts.strictNumbers,!0)+") { ",U){var O="dataType"+c,Y="coerced"+c;i+=" var "+O+" = typeof "+y+"; var "+Y+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+O+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+O+" = typeof "+y+"; if ("+e.util.checkDataType(e.schema.type,y,e.opts.strictNumbers)+") "+Y+" = "+y+"; } "),i+=" if ("+Y+" !== undefined) ; ";var ee=U;if(ee)for(var ne,Ae=-1,Ce=ee.length-1;Ae<Ce;)ne=ee[Ae+=1],ne=="string"?i+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+Y+" = '' + "+y+"; else if ("+y+" === null) "+Y+" = ''; ":ne=="number"||ne=="integer"?(i+=" else if ("+O+" == 'boolean' || "+y+" === null || ("+O+" == 'string' && "+y+" && "+y+" == +"+y+" ",ne=="integer"&&(i+=" && !("+y+" % 1)"),i+=")) "+Y+" = +"+y+"; "):ne=="boolean"?i+=" else if ("+y+" === 'false' || "+y+" === 0 || "+y+" === null) "+Y+" = false; else if ("+y+" === 'true' || "+y+" === 1) "+Y+" = true; ":ne=="null"?i+=" else if ("+y+" === '' || "+y+" === 0 || "+y+" === false) "+Y+" = null; ":e.opts.coerceTypes=="array"&&ne=="array"&&(i+=" else if ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+y+" == null) "+Y+" = ["+y+"]; ");i+=" else { ";var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+Y+" !== undefined) { ";var De=d?"data"+(d-1||""):"parentData",Ue=d?e.dataPathArr[d]:"parentDataProperty";i+=" "+y+" = "+Y+"; ",d||(i+="if ("+De+" !== undefined)"),i+=" "+De+"["+Ue+"] = "+Y+"; } "}else{var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",F&&(i+=" } if (errors === ",w?i+="0":i+="errs_"+c,i+=") { ",J+="}");else{var qe=e.RULES;if(qe){for(var se,Ie=-1,xe=qe.length-1;Ie<xe;)if(se=qe[Ie+=1],H(se)){if(se.type&&(i+=" if ("+e.util.checkDataType(se.type,y,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(se.type=="object"&&e.schema.properties){var h=e.schema.properties,Oe=Object.keys(h),le=Oe;if(le)for(var re,ye=-1,X=le.length-1;ye<X;){re=le[ye+=1];var he=h[re];if(he.default!==void 0){var ae=y+e.util.getProperty(re);if(e.compositeRule){if(e.opts.strictDefaults){var B="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(he.default)+" ":i+=" "+JSON.stringify(he.default)+" ",i+="; "}}}else if(se.type=="array"&&Array.isArray(e.schema.items)){var me=e.schema.items;if(me){for(var he,Ae=-1,Se=me.length-1;Ae<Se;)if(he=me[Ae+=1],he.default!==void 0){var ae=y+"["+Ae+"]";if(e.compositeRule){if(e.opts.strictDefaults){var B="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(B);else throw new Error(B)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(he.default)+" ":i+=" "+JSON.stringify(he.default)+" ",i+="; "}}}}var ie=se.rules;if(ie){for(var k,W=-1,pe=ie.length-1;W<pe;)if(k=ie[W+=1],ge(k)){var te=k.code(e,k.keyword,se.type);te&&(i+=" "+te+" ",F&&(q+="}"))}}if(F&&(i+=" "+q+" ",q=""),se.type&&(i+=" } ",L&&L===se.type&&!U)){i+=" else { ";var m=e.schemaPath+".type",E=e.errSchemaPath+"/type",C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(j||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(E)+" , params: { type: '",K?i+=""+L.join(","):i+=""+L,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",K?i+=""+L.join(","):i+=""+L,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&F?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}F&&(i+=" if (errors === ",w?i+="0":i+="errs_"+c,i+=") { ",J+="}")}}}F&&(i+=" "+J+" "),w?(o?(i+=" if (errors === 0) return data; ",i+=" else throw new ValidationError(vErrors); "):(i+=" validate.errors = vErrors; ",i+=" return errors === 0; "),i+=" }; return validate;"):i+=" var "+R+" = errors === errs_"+c+";";function H(Pe){for(var pt=Pe.rules,Dt=0;Dt<pt.length;Dt++)if(ge(pt[Dt]))return!0}function ge(Pe){return e.schema[Pe.keyword]!==void 0||Pe.implements&&be(Pe)}function be(Pe){for(var pt=Pe.implements,Dt=0;Dt<pt.length;Dt++)if(e.schema[pt[Dt]]!==void 0)return!0}return i}});var alt=b((fXr,slt)=>{"use strict";var aee=oee(),uee=QN(),ilt=see(),nPn=f_e(),rlt=p_e(),rPn=uee.ucs2length,iPn=K8(),oPn=ilt.Validation;slt.exports=h_e;function h_e(t,e,n,r){var i=this,o=this._opts,s=[void 0],a={},l=[],u={},c=[],d={},h=[];e=e||{schema:t,refVal:s,refs:a};var m=sPn.call(this,t,e,r),E=this._compilations[m.index];if(m.compiling)return E.callValidate=B;var y=this._formats,C=this.RULES;try{var _=R(t,e,n,r);E.validate=_;var w=E.callValidate;return w&&(w.schema=_.schema,w.errors=null,w.refs=_.refs,w.refVal=_.refVal,w.root=_.root,w.$async=_.$async,o.sourceCode&&(w.source=_.source)),_}finally{aPn.call(this,t,e,r)}function B(){var V=E.validate,O=V.apply(this,arguments);return B.errors=V.errors,O}function R(V,O,Y,ee){var ne=!O||O&&O.schema==V;if(O.schema!=e.schema)return h_e.call(i,V,O,Y,ee);var Ae=V.$async===!0,Ce=rlt({isTop:!0,schema:V,isRoot:ne,baseId:ee,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:ilt.MissingRef,RULES:C,validate:rlt,util:uee,resolve:aee,resolveRef:F,usePattern:K,useDefault:U,useCustomRule:se,opts:o,formats:y,logger:i.logger,self:i});Ce=lee(s,cPn)+lee(l,lPn)+lee(c,uPn)+lee(h,dPn)+Ce,o.processCode&&(Ce=o.processCode(Ce,V));var De;try{var Ue=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ce);De=Ue(i,C,y,e,s,c,h,iPn,rPn,oPn),s[0]=De}catch(qe){throw i.logger.error("Error compiling schema, function code:",Ce),qe}return De.schema=V,De.errors=null,De.refs=a,De.refVal=s,De.root=ne?De:O,Ae&&(De.$async=!0),o.sourceCode===!0&&(De.source={code:Ce,patterns:l,defaults:c}),De}function F(V,O,Y){O=aee.url(V,O);var ee=a[O],ne,Ae;if(ee!==void 0)return ne=s[ee],Ae="refVal["+ee+"]",L(ne,Ae);if(!Y&&e.refs){var Ce=e.refs[O];if(Ce!==void 0)return ne=e.refVal[Ce],Ae=q(O,ne),L(ne,Ae)}Ae=q(O);var De=aee.call(i,R,e,O);if(De===void 0){var Ue=n&&n[O];Ue&&(De=aee.inlineRef(Ue,o.inlineRefs)?Ue:h_e.call(i,Ue,e,n,V))}if(De===void 0)J(O);else return j(O,De),L(De,Ae)}function q(V,O){var Y=s.length;return s[Y]=O,a[V]=Y,"refVal"+Y}function J(V){delete a[V]}function j(V,O){var Y=a[V];s[Y]=O}function L(V,O){return typeof V=="object"||typeof V=="boolean"?{code:O,schema:V,inline:!0}:{code:O,$async:V&&!!V.$async}}function K(V){var O=u[V];return O===void 0&&(O=u[V]=l.length,l[O]=V),"pattern"+O}function U(V){switch(typeof V){case"boolean":case"number":return""+V;case"string":return uee.toQuotedString(V);case"object":if(V===null)return"null";var O=nPn(V),Y=d[O];return Y===void 0&&(Y=d[O]=c.length,c[Y]=V),"default"+Y}}function se(V,O,Y,ee){if(i._opts.validateSchema!==!1){var ne=V.definition.dependencies;if(ne&&!ne.every(function(le){return Object.prototype.hasOwnProperty.call(Y,le)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ae=V.definition.validateSchema;if(Ae){var Ce=Ae(O);if(!Ce){var De="keyword schema is invalid: "+i.errorsText(Ae.errors);if(i._opts.validateSchema=="log")i.logger.error(De);else throw new Error(De)}}}var Ue=V.definition.compile,qe=V.definition.inline,Ie=V.definition.macro,xe;if(Ue)xe=Ue.call(i,O,Y,ee);else if(Ie)xe=Ie.call(i,O,Y,ee),o.validateSchema!==!1&&i.validateSchema(xe,!0);else if(qe)xe=qe.call(i,ee,V.keyword,O,Y);else if(xe=V.definition.validate,!xe)return;if(xe===void 0)throw new Error('custom keyword "'+V.keyword+'"failed to compile');var Oe=h.length;return h[Oe]=xe,{code:"customRule"+Oe,validate:xe}}}function sPn(t,e,n){var r=olt.call(this,t,e,n);return r>=0?{index:r,compiling:!0}:(r=this._compilations.length,this._compilations[r]={schema:t,root:e,baseId:n},{index:r,compiling:!1})}function aPn(t,e,n){var r=olt.call(this,t,e,n);r>=0&&this._compilations.splice(r,1)}function olt(t,e,n){for(var r=0;r<this._compilations.length;r++){var i=this._compilations[r];if(i.schema==t&&i.root==e&&i.baseId==n)return r}return-1}function lPn(t,e){return"var pattern"+t+" = new RegExp("+uee.toQuotedString(e[t])+");"}function uPn(t){return"var default"+t+" = defaults["+t+"];"}function cPn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function dPn(t){return"var customRule"+t+" = customRules["+t+"];"}function lee(t,e){if(!t.length)return"";for(var n="",r=0;r<t.length;r++)n+=e(r,t);return n}});var ult=b((pXr,llt)=>{"use strict";var cee=llt.exports=function(){this._cache={}};cee.prototype.put=function(e,n){this._cache[e]=n};cee.prototype.get=function(e){return this._cache[e]};cee.prototype.del=function(e){delete this._cache[e]};cee.prototype.clear=function(){this._cache={}}});var vlt=b((hXr,Clt)=>{"use strict";var fPn=QN(),pPn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hPn=[0,31,28,31,30,31,30,31,31,30,31,30,31],mPn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,clt=/^(?=.{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,APn=/^(?:[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,gPn=/^(?:[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,dlt=/^(?:(?:[^\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,flt=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,plt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,hlt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,mlt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Alt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Clt.exports=dee;function dee(t){return t=t=="full"?"full":"fast",fPn.copy(dee[t])}dee.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":dlt,url:flt,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,hostname:clt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ylt,uuid:plt,"json-pointer":hlt,"json-pointer-uri-fragment":mlt,"relative-json-pointer":Alt};dee.full={date:glt,time:Elt,"date-time":CPn,uri:DPn,"uri-reference":gPn,"uri-template":dlt,url:flt,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:clt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ylt,uuid:plt,"json-pointer":hlt,"json-pointer-uri-fragment":mlt,"relative-json-pointer":Alt};function EPn(t){return t%4===0&&(t%100!==0||t%400===0)}function glt(t){var e=t.match(pPn);if(!e)return!1;var n=+e[1],r=+e[2],i=+e[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&EPn(n)?29:hPn[r])}function Elt(t,e){var n=t.match(mPn);if(!n)return!1;var r=n[1],i=n[2],o=n[3],s=n[5];return(r<=23&&i<=59&&o<=59||r==23&&i==59&&o==60)&&(!e||s)}var yPn=/t|\s/i;function CPn(t){var e=t.split(yPn);return e.length==2&&glt(e[0])&&Elt(e[1],!0)}var vPn=/\/|:/;function DPn(t){return vPn.test(t)&&APn.test(t)}var SPn=/[^\\]\\Z/;function ylt(t){if(SPn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Slt=b((mXr,Dlt)=>{"use strict";Dlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.errSchemaPath+"/"+n,u=!e.opts.allErrors,c="data"+(s||""),d="valid"+o,h,m;if(a=="#"||a=="#/")e.isRoot?(h=e.async,m="validate"):(h=e.root.schema.$async===!0,m="root.refVal[0]");else{var E=e.resolveRef(e.baseId,a,e.isRoot);if(E===void 0){var y=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(y);var C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(a)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(a)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(a)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var _=i;i=C.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(y),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,y)}else if(E.inline){var w=e.util.copy(e);w.level++;var B="valid"+w.level;w.schema=E.schema,w.schemaPath="",w.errSchemaPath=a;var R=e.validate(w).replace(/validate\.schema/g,E.code);i+=" "+R+" ",u&&(i+=" if ("+B+") { ")}else h=E.$async===!0||e.async&&E.$async!==!1,m=E.code}if(m){var C=C||[];C.push(i),i="",e.opts.passContext?i+=" "+m+".call(this, ":i+=" "+m+"( ",i+=" "+c+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var F=s?"data"+(s-1||""):"parentData",q=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+F+" , "+q+", rootData) ";var J=i;if(i=C.pop(),h){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+d+"; "),i+=" try { await "+J+"; ",u&&(i+=" "+d+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+d+" = false; "),i+=" } ",u&&(i+=" if ("+d+") { ")}else i+=" if (!"+J+") { if (vErrors === null) vErrors = "+m+".errors; else vErrors = vErrors.concat("+m+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var Ilt=b((AXr,_lt)=>{"use strict";_lt.exports=function(e,n,r){var i=" ",o=e.schema[n],s=e.schemaPath+e.util.getProperty(n),a=e.errSchemaPath+"/"+n,l=!e.opts.allErrors,u=e.util.copy(e),c="";u.level++;var d="valid"+u.level,h=u.baseId,m=!0,E=o;if(E)for(var y,C=-1,_=E.length-1;C<_;)y=E[C+=1],(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all))&&(m=!1,u.schema=y,u.schemaPath=s+"["+C+"]",u.errSchemaPath=a+"/"+C,i+=" "+e.validate(u)+" ",u.baseId=h,l&&(i+=" if ("+d+") { ",c+="}"));return l&&(m?i+=" if (true) { ":i+=" "+c.slice(0,-1)+" "),i}});var blt=b((gXr,Tlt)=>{"use strict";Tlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_=a.every(function(j){return e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all)});if(_){var w=E.baseId;i+=" var "+m+" = errors; var "+h+" = false; ";var B=e.compositeRule;e.compositeRule=E.compositeRule=!0;var R=a;if(R)for(var F,q=-1,J=R.length-1;q<J;)F=R[q+=1],E.schema=F,E.schemaPath=l+"["+q+"]",E.errSchemaPath=u+"/"+q,i+=" "+e.validate(E)+" ",E.baseId=w,i+=" "+h+" = "+h+" || "+C+"; if (!"+h+") { ",y+="}";e.compositeRule=E.compositeRule=B,i+=" "+y+" if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else c&&(i+=" if (true) { ");return i}});var wlt=b((EXr,xlt)=>{"use strict";xlt.exports=function(e,n,r){var i=" ",o=e.schema[n],s=e.errSchemaPath+"/"+n,a=!e.opts.allErrors,l=e.util.toQuotedString(o);return e.opts.$comment===!0?i+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(i+=" self._opts.$comment("+l+", "+e.util.toQuotedString(s)+", validate.root.schema);"),i}});var Blt=b((yXr,Rlt)=>{"use strict";Rlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a,m||(i+=" var schema"+o+" = validate.schema"+l+";"),i+="var "+h+" = equal("+d+", schema"+o+"); if (!"+h+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to constant' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var C=i;return i=y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+C+"]); ":i+=" validate.errors = ["+C+"]; return false; ":i+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",c&&(i+=" else { "),i}});var Olt=b((CXr,Nlt)=>{"use strict";Nlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_="i"+o,w=E.dataLevel=e.dataLevel+1,B="data"+w,R=e.baseId,F=e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all);if(i+="var "+m+" = errors;var "+h+";",F){var q=e.compositeRule;e.compositeRule=E.compositeRule=!0,E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" var "+C+" = false; for (var "+_+" = 0; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var J=d+"["+_+"]";E.dataPathArr[w]=_;var j=e.validate(E);E.baseId=R,e.util.varOccurences(j,B)<2?i+=" "+e.util.varReplace(j,B,J)+" ":i+=" var "+B+" = "+J+"; "+j+" ",i+=" if ("+C+") break; } ",e.compositeRule=E.compositeRule=q,i+=" "+y+" if (!"+C+") {"}else i+=" if ("+d+".length == 0) {";var L=L||[];L.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should contain a valid item' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var K=i;return i=L.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+K+"]); ":i+=" validate.errors = ["+K+"]; return false; ":i+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",F&&(i+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var Flt=b((vXr,Mlt)=>{"use strict";Mlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level,C={},_={},w=e.opts.ownProperties;for(q in a)if(q!="__proto__"){var B=a[q],R=Array.isArray(B)?_:C;R[q]=B}i+="var "+h+" = errors;";var F=e.errorPath;i+="var missing"+o+";";for(var q in _)if(R=_[q],R.length){if(i+=" if ( "+d+e.util.getProperty(q)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),c){i+=" && ( ";var J=R;if(J)for(var j,L=-1,K=J.length-1;L<K;){j=J[L+=1],L&&(i+=" || ");var U=e.util.getProperty(j),se=d+U;i+=" ( ( "+se+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?j:U)+") ) "}i+=")) { ";var V="missing"+o,O="' + "+V+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(F,V,!0):F+" + "+V);var Y=Y||[];Y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+O+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",R.length==1?i+="property "+e.util.escapeQuotes(R[0]):i+="properties "+e.util.escapeQuotes(R.join(", ")),i+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ee=i;i=Y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ee+"]); ":i+=" validate.errors = ["+ee+"]; return false; ":i+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{i+=" ) { ";var ne=R;if(ne)for(var j,Ae=-1,Ce=ne.length-1;Ae<Ce;){j=ne[Ae+=1];var U=e.util.getProperty(j),O=e.util.escapeQuotes(j),se=d+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(F,j,e.opts.jsonPointers)),i+=" if ( "+se+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+O+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",R.length==1?i+="property "+e.util.escapeQuotes(R[0]):i+="properties "+e.util.escapeQuotes(R.join(", ")),i+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",c&&(E+="}",i+=" else { ")}e.errorPath=F;var De=m.baseId;for(var q in C){var B=C[q];(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))&&(i+=" "+y+" = true; if ( "+d+e.util.getProperty(q)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),i+=") { ",m.schema=B,m.schemaPath=l+e.util.getProperty(q),m.errSchemaPath=u+"/"+e.util.escapeFragment(q),i+=" "+e.validate(m)+" ",m.baseId=De,i+=" } ",c&&(i+=" if ("+y+") { ",E+="}"))}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var Plt=b((DXr,Llt)=>{"use strict";Llt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a;var y="i"+o,C="schema"+o;m||(i+=" var "+C+" = validate.schema"+l+";"),i+="var "+h+";",m&&(i+=" if (schema"+o+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+o+")) "+h+" = false; else {"),i+=""+h+" = false;for (var "+y+"=0; "+y+"<"+C+".length; "+y+"++) if (equal("+d+", "+C+"["+y+"])) { "+h+" = true; break; }",m&&(i+=" } "),i+=" if (!"+h+") { ";var _=_||[];_.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var w=i;return i=_.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",c&&(i+=" else { "),i}});var klt=b((SXr,Qlt)=>{"use strict";Qlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||"");if(e.opts.format===!1)return c&&(i+=" if (true) { "),i;var h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=e.opts.unknownFormats,y=Array.isArray(E);if(h){var C="format"+o,_="isObject"+o,w="formatType"+o;i+=" var "+C+" = formats["+m+"]; var "+_+" = typeof "+C+" == 'object' && !("+C+" instanceof RegExp) && "+C+".validate; var "+w+" = "+_+" && "+C+".type || 'string'; if ("+_+") { ",e.async&&(i+=" var async"+o+" = "+C+".async; "),i+=" "+C+" = "+C+".validate; } if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),i+=" (",E!="ignore"&&(i+=" ("+m+" && !"+C+" ",y&&(i+=" && self._opts.unknownFormats.indexOf("+m+") == -1 "),i+=") || "),i+=" ("+C+" && "+w+" == '"+r+"' && !(typeof "+C+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+C+"("+d+") : "+C+"("+d+")) ":i+=" "+C+"("+d+") ",i+=" : "+C+".test("+d+"))))) {"}else{var C=e.formats[a];if(!C){if(E=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(i+=" if (true) { "),i;if(y&&E.indexOf(a)>=0)return c&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var _=typeof C=="object"&&!(C instanceof RegExp)&&C.validate,w=_&&C.type||"string";if(_){var B=C.async===!0;C=C.validate}if(w!=r)return c&&(i+=" if (true) { "),i;if(B){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+R+"("+d+"))) { "}else{i+=" if (! ";var R="formats"+e.util.getProperty(a);_&&(R+=".validate"),typeof C=="function"?i+=" "+R+"("+d+") ":i+=" "+R+".test("+d+") ",i+=") { "}}var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",h?i+=""+m:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match format "`,h?i+="' + "+m+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var q=i;return i=F.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+q+"]); ":i+=" validate.errors = ["+q+"]; return false; ":i+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}});var Glt=b((_Xr,Ult)=>{"use strict";Ult.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e);E.level++;var y="valid"+E.level,C=e.schema.then,_=e.schema.else,w=C!==void 0&&(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all)),B=_!==void 0&&(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all)),R=E.baseId;if(w||B){var F;E.createErrors=!1,E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" var "+m+" = errors; var "+h+" = true; ";var q=e.compositeRule;e.compositeRule=E.compositeRule=!0,i+=" "+e.validate(E)+" ",E.baseId=R,E.createErrors=!0,i+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.compositeRule=E.compositeRule=q,w?(i+=" if ("+y+") { ",E.schema=e.schema.then,E.schemaPath=e.schemaPath+".then",E.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(E)+" ",E.baseId=R,i+=" "+h+" = "+y+"; ",w&&B?(F="ifClause"+o,i+=" var "+F+" = 'then'; "):F="'then'",i+=" } ",B&&(i+=" else { ")):i+=" if (!"+y+") { ",B&&(E.schema=e.schema.else,E.schemaPath=e.schemaPath+".else",E.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(E)+" ",E.baseId=R,i+=" "+h+" = "+y+"; ",w&&B?(F="ifClause"+o,i+=" var "+F+" = 'else'; "):F="'else'",i+=" } "),i+=" if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+F+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+F+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",c&&(i+=" else { ")}else c&&(i+=" if (true) { ");return i}});var qlt=b((IXr,Hlt)=>{"use strict";Hlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_="i"+o,w=E.dataLevel=e.dataLevel+1,B="data"+w,R=e.baseId;if(i+="var "+m+" = errors;var "+h+";",Array.isArray(a)){var F=e.schema.additionalItems;if(F===!1){i+=" "+h+" = "+d+".length <= "+a.length+"; ";var q=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+h+") { ";var J=J||[];J.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+a.length+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have more than "+a.length+" items' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var j=i;i=J.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+j+"]); ":i+=" validate.errors = ["+j+"]; return false; ":i+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=q,c&&(y+="}",i+=" else { ")}var L=a;if(L){for(var K,U=-1,se=L.length-1;U<se;)if(K=L[U+=1],e.opts.strictKeywords?typeof K=="object"&&Object.keys(K).length>0||K===!1:e.util.schemaHasRules(K,e.RULES.all)){i+=" "+C+" = true; if ("+d+".length > "+U+") { ";var V=d+"["+U+"]";E.schema=K,E.schemaPath=l+"["+U+"]",E.errSchemaPath=u+"/"+U,E.errorPath=e.util.getPathExpr(e.errorPath,U,e.opts.jsonPointers,!0),E.dataPathArr[w]=U;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",i+=" } ",c&&(i+=" if ("+C+") { ",y+="}")}}if(typeof F=="object"&&(e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all))){E.schema=F,E.schemaPath=e.schemaPath+".additionalItems",E.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+C+" = true; if ("+d+".length > "+a.length+") { for (var "+_+" = "+a.length+"; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var V=d+"["+_+"]";E.dataPathArr[w]=_;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",c&&(i+=" if (!"+C+") break; "),i+=" } } ",c&&(i+=" if ("+C+") { ",y+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){E.schema=a,E.schemaPath=l,E.errSchemaPath=u,i+=" for (var "+_+" = 0; "+_+" < "+d+".length; "+_+"++) { ",E.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0);var V=d+"["+_+"]";E.dataPathArr[w]=_;var O=e.validate(E);E.baseId=R,e.util.varOccurences(O,B)<2?i+=" "+e.util.varReplace(O,B,V)+" ":i+=" var "+B+" = "+V+"; "+O+" ",c&&(i+=" if (!"+C+") break; "),i+=" }"}return c&&(i+=" "+y+" if ("+m+" == errors) {"),i}});var m_e=b((TXr,Vlt)=>{"use strict";Vlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,R,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=n=="maximum",y=E?"exclusiveMaximum":"exclusiveMinimum",C=e.schema[y],_=e.opts.$data&&C&&C.$data,w=E?"<":">",B=E?">":"<",R=void 0;if(!(h||typeof a=="number"||a===void 0))throw new Error(n+" must be number");if(!(_||C===void 0||typeof C=="number"||typeof C=="boolean"))throw new Error(y+" must be number or boolean");if(_){var F=e.util.getData(C.$data,s,e.dataPathArr),q="exclusive"+o,J="exclType"+o,j="exclIsNumber"+o,L="op"+o,K="' + "+L+" + '";i+=" var schemaExcl"+o+" = "+F+"; ",F="schemaExcl"+o,i+=" var "+q+"; var "+J+" = typeof "+F+"; if ("+J+" != 'boolean' && "+J+" != 'undefined' && "+J+" != 'number') { ";var R=y,U=U||[];U.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+y+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var se=i;i=U.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+se+"]); ":i+=" validate.errors = ["+se+"]; return false; ":i+=" var err = "+se+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+J+" == 'number' ? ( ("+q+" = "+m+" === undefined || "+F+" "+w+"= "+m+") ? "+d+" "+B+"= "+F+" : "+d+" "+B+" "+m+" ) : ( ("+q+" = "+F+" === true) ? "+d+" "+B+"= "+m+" : "+d+" "+B+" "+m+" ) || "+d+" !== "+d+") { var op"+o+" = "+q+" ? '"+w+"' : '"+w+"='; ",a===void 0&&(R=y,u=e.errSchemaPath+"/"+y,m=F,h=_)}else{var j=typeof C=="number",K=w;if(j&&h){var L="'"+K+"'";i+=" if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" ( "+m+" === undefined || "+C+" "+w+"= "+m+" ? "+d+" "+B+"= "+C+" : "+d+" "+B+" "+m+" ) || "+d+" !== "+d+") { "}else{j&&a===void 0?(q=!0,R=y,u=e.errSchemaPath+"/"+y,m=C,B+="="):(j&&(m=Math[E?"min":"max"](C,a)),C===(j?m:!0)?(q=!0,R=y,u=e.errSchemaPath+"/"+y,B+="="):(q=!1,K+="="));var L="'"+K+"'";i+=" if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+d+" "+B+" "+m+" || "+d+" !== "+d+") { "}}R=R||n;var U=U||[];U.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+L+", limit: "+m+", exclusive: "+q+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+K+" ",h?i+="' + "+m:i+=""+m+"'"),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var se=i;return i=U.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+se+"]); ":i+=" validate.errors = ["+se+"]; return false; ":i+=" var err = "+se+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}});var A_e=b((bXr,$lt)=>{"use strict";$lt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxItems"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" "+d+".length "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",n=="maxItems"?i+="more":i+="fewer",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var g_e=b((xXr,Ylt)=>{"use strict";Ylt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxLength"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),e.opts.unicode===!1?i+=" "+d+".length ":i+=" ucs2length("+d+") ",i+=" "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be ",n=="maxLength"?i+="longer":i+="shorter",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var E_e=b((wXr,jlt)=>{"use strict";jlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,y,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");var E=n=="maxProperties"?">":"<";i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),i+=" Object.keys("+d+").length "+E+" "+m+") { ";var y=n,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",n=="maxProperties"?i+="more":i+="fewer",i+=" than ",h?i+="' + "+m+" + '":i+=""+a,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var _=i;return i=C.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var zlt=b((RXr,Wlt)=>{"use strict";Wlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,!(h||typeof a=="number"))throw new Error(n+" must be number");i+="var division"+o+";if (",h&&(i+=" "+m+" !== undefined && ( typeof "+m+" != 'number' || "),i+=" (division"+o+" = "+d+" / "+m+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+o+" !== parseInt(division"+o+") ",i+=" ) ",h&&(i+=" ) "),i+=" ) { ";var E=E||[];E.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+m+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be multiple of ",h?i+="' + "+m:i+=""+m+"'"),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=E.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var Klt=b((BXr,Jlt)=>{"use strict";Jlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e);m.level++;var E="valid"+m.level;if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=l,m.errSchemaPath=u,i+=" var "+h+" = errors; ";var y=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.createErrors=!1;var C;m.opts.allErrors&&(C=m.opts.allErrors,m.opts.allErrors=!1),i+=" "+e.validate(m)+" ",m.createErrors=!0,C&&(m.opts.allErrors=C),e.compositeRule=m.compositeRule=y,i+=" if ("+E+") { ";var _=_||[];_.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var w=i;i=_.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(i+=" if (false) { ");return i}});var Zlt=b((NXr,Xlt)=>{"use strict";Xlt.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m="errs__"+o,E=e.util.copy(e),y="";E.level++;var C="valid"+E.level,_=E.baseId,w="prevValid"+o,B="passingSchemas"+o;i+="var "+m+" = errors , "+w+" = false , "+h+" = false , "+B+" = null; ";var R=e.compositeRule;e.compositeRule=E.compositeRule=!0;var F=a;if(F)for(var q,J=-1,j=F.length-1;J<j;)q=F[J+=1],(e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all))?(E.schema=q,E.schemaPath=l+"["+J+"]",E.errSchemaPath=u+"/"+J,i+=" "+e.validate(E)+" ",E.baseId=_):i+=" var "+C+" = true; ",J&&(i+=" if ("+C+" && "+w+") { "+h+" = false; "+B+" = ["+B+", "+J+"]; } else { ",y+="}"),i+=" if ("+C+") { "+h+" = "+w+" = true; "+B+" = "+J+"; }";return e.compositeRule=E.compositeRule=R,i+=""+y+"if (!"+h+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+B+" } ",e.opts.messages!==!1&&(i+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; }",e.opts.allErrors&&(i+=" } "),i}});var tut=b((OXr,eut)=>{"use strict";eut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var E=h?"(new RegExp("+m+"))":e.usePattern(a);i+="if ( ",h&&(i+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),i+=" !"+E+".test("+d+") ) { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",h?i+=""+m:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match pattern "`,h?i+="' + "+m+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+l:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var C=i;return i=y.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+C+"]); ":i+=" validate.errors = ["+C+"]; return false; ":i+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}});var rut=b((MXr,nut)=>{"use strict";nut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level,C="key"+o,_="idx"+o,w=m.dataLevel=e.dataLevel+1,B="data"+w,R="dataProperties"+o,F=Object.keys(a||{}).filter(Ae),q=e.schema.patternProperties||{},J=Object.keys(q).filter(Ae),j=e.schema.additionalProperties,L=F.length||J.length,K=j===!1,U=typeof j=="object"&&Object.keys(j).length,se=e.opts.removeAdditional,V=K||U||se,O=e.opts.ownProperties,Y=e.baseId,ee=e.schema.required;if(ee&&!(e.opts.$data&&ee.$data)&&ee.length<e.opts.loopRequired)var ne=e.util.toHash(ee);function Ae(mt){return mt!=="__proto__"}if(i+="var "+h+" = errors;var "+y+" = true;",O&&(i+=" var "+R+" = undefined;"),V){if(O?i+=" "+R+" = "+R+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+R+".length; "+_+"++) { var "+C+" = "+R+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",L){if(i+=" var isAdditional"+o+" = !(false ",F.length)if(F.length>8)i+=" || validate.schema"+l+".hasOwnProperty("+C+") ";else{var Ce=F;if(Ce)for(var De,Ue=-1,qe=Ce.length-1;Ue<qe;)De=Ce[Ue+=1],i+=" || "+C+" == "+e.util.toQuotedString(De)+" "}if(J.length){var Ie=J;if(Ie)for(var xe,Oe=-1,le=Ie.length-1;Oe<le;)xe=Ie[Oe+=1],i+=" || "+e.usePattern(xe)+".test("+C+") "}i+=" ); if (isAdditional"+o+") { "}if(se=="all")i+=" delete "+d+"["+C+"]; ";else{var re=e.errorPath,ye="' + "+C+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers)),K)if(se)i+=" delete "+d+"["+C+"]; ";else{i+=" "+y+" = false; ";var X=u;u=e.errSchemaPath+"/additionalProperties";var he=he||[];he.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ye+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is an invalid additional property":i+="should NOT have additional properties",i+="' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ae=i;i=he.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=X,c&&(i+=" break; ")}else if(U)if(se=="failing"){i+=" var "+h+" = errors; ";var me=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=j,m.schemaPath=e.schemaPath+".additionalProperties",m.errSchemaPath=e.errSchemaPath+"/additionalProperties",m.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",i+=" if (!"+y+") { errors = "+h+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+C+"]; } ",e.compositeRule=m.compositeRule=me}else{m.schema=j,m.schemaPath=e.schemaPath+".additionalProperties",m.errSchemaPath=e.errSchemaPath+"/additionalProperties",m.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",c&&(i+=" if (!"+y+") break; ")}e.errorPath=re}L&&(i+=" } "),i+=" } ",c&&(i+=" if ("+y+") { ",E+="}")}var k=e.opts.useDefaults&&!e.compositeRule;if(F.length){var W=F;if(W)for(var De,pe=-1,te=W.length-1;pe<te;){De=W[pe+=1];var H=a[De];if(e.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:e.util.schemaHasRules(H,e.RULES.all)){var ge=e.util.getProperty(De),Se=d+ge,be=k&&H.default!==void 0;m.schema=H,m.schemaPath=l+ge,m.errSchemaPath=u+"/"+e.util.escapeFragment(De),m.errorPath=e.util.getPath(e.errorPath,De,e.opts.jsonPointers),m.dataPathArr[w]=e.util.toQuotedString(De);var ie=e.validate(m);if(m.baseId=Y,e.util.varOccurences(ie,B)<2){ie=e.util.varReplace(ie,B,Se);var Pe=Se}else{var Pe=B;i+=" var "+B+" = "+Se+"; "}if(be)i+=" "+ie+" ";else{if(ne&&ne[De]){i+=" if ( "+Pe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=") { "+y+" = false; ";var re=e.errorPath,X=u,pt=e.util.escapeQuotes(De);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(re,De,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var he=he||[];he.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+pt+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+pt+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var ae=i;i=he.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=X,e.errorPath=re,i+=" } else { "}else c?(i+=" if ( "+Pe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=") { "+y+" = true; } else { "):(i+=" if ("+Pe+" !== undefined ",O&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(De)+"') "),i+=" ) { ");i+=" "+ie+" } "}}c&&(i+=" if ("+y+") { ",E+="}")}}if(J.length){var Dt=J;if(Dt)for(var xe,Qt=-1,dt=Dt.length-1;Qt<dt;){xe=Dt[Qt+=1];var H=q[xe];if(e.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:e.util.schemaHasRules(H,e.RULES.all)){m.schema=H,m.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(xe),m.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(xe),O?i+=" "+R+" = "+R+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+R+".length; "+_+"++) { var "+C+" = "+R+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",i+=" if ("+e.usePattern(xe)+".test("+C+")) { ",m.errorPath=e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers);var Se=d+"["+C+"]";m.dataPathArr[w]=C;var ie=e.validate(m);m.baseId=Y,e.util.varOccurences(ie,B)<2?i+=" "+e.util.varReplace(ie,B,Se)+" ":i+=" var "+B+" = "+Se+"; "+ie+" ",c&&(i+=" if (!"+y+") break; "),i+=" } ",c&&(i+=" else "+y+" = true; "),i+=" } ",c&&(i+=" if ("+y+") { ",E+="}")}}}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var out=b((FXr,iut)=>{"use strict";iut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="errs__"+o,m=e.util.copy(e),E="";m.level++;var y="valid"+m.level;if(i+="var "+h+" = errors;",e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=l,m.errSchemaPath=u;var C="key"+o,_="idx"+o,w="i"+o,B="' + "+C+" + '",R=m.dataLevel=e.dataLevel+1,F="data"+R,q="dataProperties"+o,J=e.opts.ownProperties,j=e.baseId;J&&(i+=" var "+q+" = undefined; "),J?i+=" "+q+" = "+q+" || Object.keys("+d+"); for (var "+_+"=0; "+_+"<"+q+".length; "+_+"++) { var "+C+" = "+q+"["+_+"]; ":i+=" for (var "+C+" in "+d+") { ",i+=" var startErrs"+o+" = errors; ";var L=C,K=e.compositeRule;e.compositeRule=m.compositeRule=!0;var U=e.validate(m);m.baseId=j,e.util.varOccurences(U,F)<2?i+=" "+e.util.varReplace(U,F,L)+" ":i+=" var "+F+" = "+L+"; "+U+" ",e.compositeRule=m.compositeRule=K,i+=" if (!"+y+") { for (var "+w+"=startErrs"+o+"; "+w+"<errors; "+w+"++) { vErrors["+w+"].propertyName = "+C+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+B+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),c&&(i+=" break; "),i+=" } }"}return c&&(i+=" "+E+" if ("+h+" == errors) {"),i}});var aut=b((LXr,sut)=>{"use strict";sut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a;var y="schema"+o;if(!m)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var C=[],_=a;if(_)for(var w,B=-1,R=_.length-1;B<R;){w=_[B+=1];var F=e.schema.properties[w];F&&(e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all))||(C[C.length]=w)}}else var C=a;if(m||C.length){var q=e.errorPath,J=m||C.length>=e.opts.loopRequired,j=e.opts.ownProperties;if(c)if(i+=" var missing"+o+"; ",J){m||(i+=" var "+y+" = validate.schema"+l+"; ");var L="i"+o,K="schema"+o+"["+L+"]",U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(q,K,e.opts.jsonPointers)),i+=" var "+h+" = true; ",m&&(i+=" if (schema"+o+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+o+")) "+h+" = false; else {"),i+=" for (var "+L+" = 0; "+L+" < "+y+".length; "+L+"++) { "+h+" = "+d+"["+y+"["+L+"]] !== undefined ",j&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+L+"]) "),i+="; if (!"+h+") break; } ",m&&(i+=" } "),i+=" if (!"+h+") { ";var se=se||[];se.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var V=i;i=se.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+V+"]); ":i+=" validate.errors = ["+V+"]; return false; ":i+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var O=C;if(O)for(var Y,L=-1,ee=O.length-1;L<ee;){Y=O[L+=1],L&&(i+=" || ");var ne=e.util.getProperty(Y),Ae=d+ne;i+=" ( ( "+Ae+" === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Y)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?Y:ne)+") ) "}i+=") { ";var K="missing"+o,U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(q,K,!0):q+" + "+K);var se=se||[];se.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var V=i;i=se.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+V+"]); ":i+=" validate.errors = ["+V+"]; return false; ":i+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(J){m||(i+=" var "+y+" = validate.schema"+l+"; ");var L="i"+o,K="schema"+o+"["+L+"]",U="' + "+K+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(q,K,e.opts.jsonPointers)),m&&(i+=" if ("+y+" && !Array.isArray("+y+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+y+" !== undefined) { "),i+=" for (var "+L+" = 0; "+L+" < "+y+".length; "+L+"++) { if ("+d+"["+y+"["+L+"]] === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+y+"["+L+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",m&&(i+=" } ")}else{var Ce=C;if(Ce)for(var Y,De=-1,Ue=Ce.length-1;De<Ue;){Y=Ce[De+=1];var ne=e.util.getProperty(Y),U=e.util.escapeQuotes(Y),Ae=d+ne;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(q,Y,e.opts.jsonPointers)),i+=" if ( "+Ae+" === undefined ",j&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Y)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+U+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=q}else c&&(i+=" if (true) {");return i}});var uut=b((PXr,lut)=>{"use strict";lut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d="data"+(s||""),h="valid"+o,m=e.opts.$data&&a&&a.$data,E;if(m?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",E="schema"+o):E=a,(a||m)&&e.opts.uniqueItems!==!1){m&&(i+=" var "+h+"; if ("+E+" === false || "+E+" === undefined) "+h+" = true; else if (typeof "+E+" != 'boolean') "+h+" = false; else { "),i+=" var i = "+d+".length , "+h+" = true , j; if (i > 1) { ";var y=e.schema.items&&e.schema.items.type,C=Array.isArray(y);if(!y||y=="object"||y=="array"||C&&(y.indexOf("object")>=0||y.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+h+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var _="checkDataType"+(C?"s":"");i+=" if ("+e.util[_](y,"item",e.opts.strictNumbers,!0)+") continue; ",C&&(i+=` if (typeof item == 'string') item = '"' + item; `),i+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",m&&(i+=" } "),i+=" if (!"+h+") { ";var w=w||[];w.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",m?i+="validate.schema"+l:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var B=i;i=w.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+B+"]); ":i+=" validate.errors = ["+B+"]; return false; ":i+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { ")}else c&&(i+=" if (true) { ");return i}});var dut=b((QXr,cut)=>{"use strict";cut.exports={$ref:Slt(),allOf:Ilt(),anyOf:blt(),$comment:wlt(),const:Blt(),contains:Olt(),dependencies:Flt(),enum:Plt(),format:klt(),if:Glt(),items:qlt(),maximum:m_e(),minimum:m_e(),maxItems:A_e(),minItems:A_e(),maxLength:g_e(),minLength:g_e(),maxProperties:E_e(),minProperties:E_e(),multipleOf:zlt(),not:Klt(),oneOf:Zlt(),pattern:tut(),properties:rut(),propertyNames:out(),required:aut(),uniqueItems:uut(),validate:p_e()}});var hut=b((kXr,put)=>{"use strict";var fut=dut(),y_e=QN().toHash;put.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],n=["type","$comment"],r=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],i=["number","integer","string","array","object","boolean","null"];return e.all=y_e(n),e.types=y_e(i),e.forEach(function(o){o.rules=o.rules.map(function(s){var a;if(typeof s=="object"){var l=Object.keys(s)[0];a=s[l],s=l,a.forEach(function(c){n.push(c),e.all[c]=!0})}n.push(s);var u=e.all[s]={keyword:s,code:fut[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:fut.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=y_e(n.concat(r)),e.custom={},e}});var gut=b((UXr,Aut)=>{"use strict";var mut=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Aut.exports=function(t,e){for(var n=0;n<e.length;n++){t=JSON.parse(JSON.stringify(t));var r=e[n].split("/"),i=t,o;for(o=1;o<r.length;o++)i=i[r[o]];for(o=0;o<mut.length;o++){var s=mut[o],a=i[s];a&&(i[s]={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}});var Cut=b((GXr,yut)=>{"use strict";var _Pn=see().MissingRef;yut.exports=Eut;function Eut(t,e,n){var r=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(n=e,e=void 0);var i=o(t).then(function(){var a=r._addSchema(t,void 0,e);return a.validate||s(a)});return n&&i.then(function(a){n(null,a)},n),i;function o(a){var l=a.$schema;return l&&!r.getSchema(l)?Eut.call(r,{$ref:l},!0):Promise.resolve()}function s(a){try{return r._compile(a)}catch(u){if(u instanceof _Pn)return l(u);throw u}function l(u){var c=u.missingSchema;if(m(c))throw new Error("Schema "+c+" is loaded but "+u.missingRef+" cannot be resolved");var d=r._loadingSchemas[c];return d||(d=r._loadingSchemas[c]=r._opts.loadSchema(c),d.then(h,h)),d.then(function(E){if(!m(c))return o(E).then(function(){m(c)||r.addSchema(E,c,void 0,e)})}).then(function(){return s(a)});function h(){delete r._loadingSchemas[c]}function m(E){return r._refs[E]||r._schemas[E]}}}}});var Dut=b((HXr,vut)=>{"use strict";vut.exports=function(e,n,r){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[n],l=e.schemaPath+e.util.getProperty(n),u=e.errSchemaPath+"/"+n,c=!e.opts.allErrors,d,h="data"+(s||""),m="valid"+o,E="errs__"+o,y=e.opts.$data&&a&&a.$data,C;y?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",C="schema"+o):C=a;var _=this,w="definition"+o,B=_.definition,R="",F,q,J,j,L;if(y&&B.$data){L="keywordValidate"+o;var K=B.validateSchema;i+=" var "+w+" = RULES.custom['"+n+"'].definition; var "+L+" = "+w+".validate;"}else{if(j=e.useCustomRule(_,a,e.schema,e),!j)return;C="validate.schema"+l,L=j.code,F=B.compile,q=B.inline,J=B.macro}var U=L+".errors",se="i"+o,V="ruleErr"+o,O=B.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(q||J||(i+=""+U+" = null;"),i+="var "+E+" = errors;var "+m+";",y&&B.$data&&(R+="}",i+=" if ("+C+" === undefined) { "+m+" = true; } else { ",K&&(R+="}",i+=" "+m+" = "+w+".validateSchema("+C+"); if ("+m+") { ")),q)B.statements?i+=" "+j.validate+" ":i+=" "+m+" = "+j.validate+"; ";else if(J){var Y=e.util.copy(e),R="";Y.level++;var ee="valid"+Y.level;Y.schema=j.validate,Y.schemaPath="";var ne=e.compositeRule;e.compositeRule=Y.compositeRule=!0;var Ae=e.validate(Y).replace(/validate\.schema/g,L);e.compositeRule=Y.compositeRule=ne,i+=" "+Ae}else{var Ce=Ce||[];Ce.push(i),i="",i+=" "+L+".call( ",e.opts.passContext?i+="this":i+="self",F||B.schema===!1?i+=" , "+h+" ":i+=" , "+C+" , "+h+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var De=s?"data"+(s-1||""):"parentData",Ue=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+De+" , "+Ue+" , rootData ) ";var qe=i;i=Ce.pop(),B.errors===!1?(i+=" "+m+" = ",O&&(i+="await "),i+=""+qe+"; "):O?(U="customErrors"+o,i+=" var "+U+" = null; try { "+m+" = await "+qe+"; } catch (e) { "+m+" = false; if (e instanceof ValidationError) "+U+" = e.errors; else throw e; } "):i+=" "+U+" = null; "+m+" = "+qe+"; "}if(B.modifying&&(i+=" if ("+De+") "+h+" = "+De+"["+Ue+"];"),i+=""+R,B.valid)c&&(i+=" if (true) { ");else{i+=" if ( ",B.valid===void 0?(i+=" !",J?i+=""+ee:i+=""+m):i+=" "+!B.valid+" ",i+=") { ",d=_.keyword;var Ce=Ce||[];Ce.push(i),i="";var Ce=Ce||[];Ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+_.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+_.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var Ie=i;i=Ce.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+Ie+"]); ":i+=" validate.errors = ["+Ie+"]; return false; ":i+=" var err = "+Ie+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var xe=i;i=Ce.pop(),q?B.errors?B.errors!="full"&&(i+=" for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+V+".schemaPath === undefined) { "+V+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } "):B.errors===!1?i+=" "+xe+" ":(i+=" if ("+E+" == errors) { "+xe+" } else { for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+V+".schemaPath === undefined) { "+V+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } } "):J?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+_.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+_.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):B.errors===!1?i+=" "+xe+" ":(i+=" if (Array.isArray("+U+")) { if (vErrors === null) vErrors = "+U+"; else vErrors = vErrors.concat("+U+"); errors = vErrors.length; for (var "+se+"="+E+"; "+se+"<errors; "+se+"++) { var "+V+" = vErrors["+se+"]; if ("+V+".dataPath === undefined) "+V+".dataPath = (dataPath || '') + "+e.errorPath+"; "+V+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+V+".schema = "+C+"; "+V+".data = "+h+"; "),i+=" } } else { "+xe+" } "),i+=" } ",c&&(i+=" else { ")}return i}});var C_e=b((qXr,IPn)=>{IPn.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 Iut=b((VXr,_ut)=>{"use strict";var Sut=C_e();_ut.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Sut.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Sut.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var but=b(($Xr,Tut)=>{"use strict";var TPn=/^[a-z_$][a-z0-9_$-]*$/i,bPn=Dut(),xPn=Iut();Tut.exports={add:wPn,get:RPn,remove:BPn,validate:v_e};function wPn(t,e){var n=this.RULES;if(n.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!TPn.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var r=e.type;if(Array.isArray(r))for(var i=0;i<r.length;i++)s(t,r[i],e);else s(t,r,e);var o=e.metaSchema;o&&(e.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(o,!0))}n.keywords[t]=n.all[t]=!0;function s(a,l,u){for(var c,d=0;d<n.length;d++){var h=n[d];if(h.type==l){c=h;break}}c||(c={type:l,rules:[]},n.push(c));var m={keyword:a,definition:u,custom:!0,code:bPn,implements:u.implements};c.rules.push(m),n.custom[a]=m}return this}function RPn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function BPn(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var n=0;n<e.length;n++)for(var r=e[n].rules,i=0;i<r.length;i++)if(r[i].keyword==t){r.splice(i,1);break}return this}function v_e(t,e){v_e.errors=null;var n=this._validateKeyword=this._validateKeyword||this.compile(xPn,!0);if(n(t))return!0;if(v_e.errors=n.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(n.errors));return!1}});var xut=b((YXr,NPn)=>{NPn.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Qut=b((jXr,Put)=>{"use strict";var Rut=alt(),kN=oee(),OPn=ult(),But=s_e(),MPn=f_e(),FPn=vlt(),LPn=hut(),Nut=gut(),Out=QN();Put.exports=pc;pc.prototype.validate=QPn;pc.prototype.compile=kPn;pc.prototype.addSchema=UPn;pc.prototype.addMetaSchema=GPn;pc.prototype.validateSchema=HPn;pc.prototype.getSchema=VPn;pc.prototype.removeSchema=YPn;pc.prototype.addFormat=e5n;pc.prototype.errorsText=ZPn;pc.prototype._addSchema=jPn;pc.prototype._compile=WPn;pc.prototype.compileAsync=Cut();var hee=but();pc.prototype.addKeyword=hee.add;pc.prototype.getKeyword=hee.get;pc.prototype.removeKeyword=hee.remove;pc.prototype.validateKeyword=hee.validate;var Mut=see();pc.ValidationError=Mut.Validation;pc.MissingRefError=Mut.MissingRef;pc.$dataMetaSchema=Nut;var pee="http://json-schema.org/draft-07/schema",wut=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],PPn=["/properties"];function pc(t){if(!(this instanceof pc))return new pc(t);t=this._opts=Out.copy(t)||{},s5n(this),this._schemas={},this._refs={},this._fragments={},this._formats=FPn(t.format),this._cache=t.cache||new OPn,this._loadingSchemas={},this._compilations=[],this.RULES=LPn(),this._getId=zPn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=MPn),this._metaOpts=o5n(this),t.formats&&r5n(this),t.keywords&&i5n(this),t5n(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),n5n(this)}function QPn(t,e){var n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error('no schema with key or ref "'+t+'"')}else{var r=this._addSchema(t);n=r.validate||this._compile(r)}var i=n(e);return n.$async!==!0&&(this.errors=n.errors),i}function kPn(t,e){var n=this._addSchema(t,void 0,e);return n.validate||this._compile(n)}function UPn(t,e,n,r){if(Array.isArray(t)){for(var i=0;i<t.length;i++)this.addSchema(t[i],void 0,n,r);return this}var o=this._getId(t);if(o!==void 0&&typeof o!="string")throw new Error("schema id must be string");return e=kN.normalizeId(e||o),Lut(this,e),this._schemas[e]=this._addSchema(t,n,r,!0),this}function GPn(t,e,n){return this.addSchema(t,e,n,!0),this}function HPn(t,e){var n=t.$schema;if(n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this._opts.defaultMeta||qPn(this),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var r=this.validate(n,t);if(!r&&e){var i="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(i);else throw new Error(i)}return r}function qPn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(pee)?pee:void 0,t._opts.defaultMeta}function VPn(t){var e=Fut(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return $Pn(this,t)}}function $Pn(t,e){var n=kN.schema.call(t,{schema:{}},e);if(n){var r=n.schema,i=n.root,o=n.baseId,s=Rut.call(t,r,i,void 0,o);return t._fragments[e]=new But({ref:e,fragment:!0,schema:r,root:i,baseId:o,validate:s}),s}}function Fut(t,e){return e=kN.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function YPn(t){if(t instanceof RegExp)return fee(this,this._schemas,t),fee(this,this._refs,t),this;switch(typeof t){case"undefined":return fee(this,this._schemas),fee(this,this._refs),this._cache.clear(),this;case"string":var e=Fut(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var n=this._opts.serialize,r=n?n(t):t;this._cache.del(r);var i=this._getId(t);i&&(i=kN.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function fee(t,e,n){for(var r in e){var i=e[r];!i.meta&&(!n||n.test(r))&&(t._cache.del(i.cacheKey),delete e[r])}}function jPn(t,e,n,r){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var i=this._opts.serialize,o=i?i(t):t,s=this._cache.get(o);if(s)return s;r=r||this._opts.addUsedSchema!==!1;var a=kN.normalizeId(this._getId(t));a&&r&&Lut(this,a);var l=this._opts.validateSchema!==!1&&!e,u;l&&!(u=a&&a==kN.normalizeId(t.$schema))&&this.validateSchema(t,!0);var c=kN.ids.call(this,t),d=new But({id:a,schema:t,localRefs:c,cacheKey:o,meta:n});return a[0]!="#"&&r&&(this._refs[a]=d),this._cache.put(o,d),l&&u&&this.validateSchema(t,!0),d}function WPn(t,e){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=e||i,t.schema.$async===!0&&(i.$async=!0),i;t.compiling=!0;var n;t.meta&&(n=this._opts,this._opts=this._metaOpts);var r;try{r=Rut.call(this,t.schema,e,t.localRefs)}catch(o){throw delete t.validate,o}finally{t.compiling=!1,t.meta&&(this._opts=n)}return t.validate=r,t.refs=r.refs,t.refVal=r.refVal,t.root=r.root,r;function i(){var o=t.validate,s=o.apply(this,arguments);return i.errors=o.errors,s}}function zPn(t){switch(t.schemaId){case"auto":return XPn;case"id":return JPn;default:return KPn}}function JPn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function KPn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function XPn(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function ZPn(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var n=e.separator===void 0?", ":e.separator,r=e.dataVar===void 0?"data":e.dataVar,i="",o=0;o<t.length;o++){var s=t[o];s&&(i+=r+s.dataPath+" "+s.message+n)}return i.slice(0,-n.length)}function e5n(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function t5n(t){var e;if(t._opts.$data&&(e=xut(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var n=C_e();t._opts.$data&&(n=Nut(n,PPn)),t.addMetaSchema(n,pee,!0),t._refs["http://json-schema.org/schema"]=pee}}function n5n(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var n in e)t.addSchema(e[n],n)}function r5n(t){for(var e in t._opts.formats){var n=t._opts.formats[e];t.addFormat(e,n)}}function i5n(t){for(var e in t._opts.keywords){var n=t._opts.keywords[e];t.addKeyword(e,n)}}function Lut(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function o5n(t){for(var e=Out.copy(t._opts),n=0;n<wut.length;n++)delete e[wut[n]];return e}function s5n(t){var e=t._opts.logger;if(e===!1)t.logger={log:D_e,warn:D_e,error:D_e};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function D_e(){}});var kut,mx,mee=Le(()=>{Pat();dx();kut=Qe(Qut(),1),mx=class extends KZ{constructor(e,n){var r;super(n),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(r=n?.capabilities)!==null&&r!==void 0?r:{},this._ajv=new kut.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Lat(this._capabilities,e)}assertCapability(e,n){var r;if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r[e]))throw new Error(`Server does not support ${e} (required for ${n})`)}async connect(e,n){if(await super.connect(e),e.sessionId===void 0)try{let r=await this.request({method:"initialize",params:{protocolVersion:J8,capabilities:this._capabilities,clientInfo:this._clientInfo}},VSe,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Eat.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var n,r,i,o,s;switch(e){case"logging/setLevel":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var n;switch(e){case"notifications/roots/list_changed":if(!(!((n=this._capabilities.roots)===null||n===void 0)&&n.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},PN,e)}async complete(e,n){return this.request({method:"completion/complete",params:e},XSe,n)}async setLoggingLevel(e,n){return this.request({method:"logging/setLevel",params:{level:e}},PN,n)}async getPrompt(e,n){return this.request({method:"prompts/get",params:e},gG,n)}async listPrompts(e,n){return this.request({method:"prompts/list",params:e},AG,n)}async listResources(e,n){return this.request({method:"resources/list",params:e},$Se,n)}async listResourceTemplates(e,n){return this.request({method:"resources/templates/list",params:e},YSe,n)}async readResource(e,n){return this.request({method:"resources/read",params:e},jSe,n)}async subscribeResource(e,n){return this.request({method:"resources/subscribe",params:e},PN,n)}async unsubscribeResource(e,n){return this.request({method:"resources/unsubscribe",params:e},PN,n)}async callTool(e,n=JZ,r){let i=await this.request({method:"tools/call",params:e},n,r),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new by(Ty.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new by(Ty.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof by?s:new by(Ty.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let n of e)if(n.outputSchema)try{let r=this._ajv.compile(n.outputSchema);this._cachedToolOutputValidators.set(n.name,r)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,n){let r=await this.request({method:"tools/list",params:e},KSe,n);return this.cacheToolOutputSchemas(r.tools),r}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var Vut=b((KXr,qut)=>{qut.exports=Hut;Hut.sync=l5n;var Uut=we("fs");function a5n(t,e){var n=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function Gut(t,e,n){return!t.isSymbolicLink()&&!t.isFile()?!1:a5n(e,n)}function Hut(t,e,n){Uut.stat(t,function(r,i){n(r,r?!1:Gut(i,t,e))})}function l5n(t,e){return Gut(Uut.statSync(t),t,e)}});var zut=b((XXr,Wut)=>{Wut.exports=Yut;Yut.sync=u5n;var $ut=we("fs");function Yut(t,e,n){$ut.stat(t,function(r,i){n(r,r?!1:jut(i,e))})}function u5n(t,e){return jut($ut.statSync(t),e)}function jut(t,e){return t.isFile()&&c5n(t,e)}function c5n(t,e){var n=t.mode,r=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),u=parseInt("001",8),c=a|l,d=n&u||n&l&&i===s||n&a&&r===o||n&c&&o===0;return d}});var Kut=b((eZr,Jut)=>{var ZXr=we("fs"),Aee;process.platform==="win32"||global.TESTING_WINDOWS?Aee=Vut():Aee=zut();Jut.exports=S_e;S_e.sync=d5n;function S_e(t,e,n){if(typeof e=="function"&&(n=e,e={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){S_e(t,e||{},function(o,s){o?i(o):r(s)})})}Aee(t,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),n(r,i)})}function d5n(t,e){try{return Aee.sync(t,e||{})}catch(n){if(e&&e.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var ict=b((tZr,rct)=>{var X8=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Xut=we("path"),f5n=X8?";":":",Zut=Kut(),ect=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),tct=(t,e)=>{let n=e.colon||f5n,r=t.match(/\//)||X8&&t.match(/\\/)?[""]:[...X8?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(n)],i=X8?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=X8?i.split(n):[""];return X8&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:i}},nct=(t,e,n)=>{typeof e=="function"&&(n=e,e={}),e||(e={});let{pathEnv:r,pathExt:i,pathExtExe:o}=tct(t,e),s=[],a=u=>new Promise((c,d)=>{if(u===r.length)return e.all&&s.length?c(s):d(ect(t));let h=r[u],m=/^".*"$/.test(h)?h.slice(1,-1):h,E=Xut.join(m,t),y=!m&&/^\.[\\\/]/.test(t)?t.slice(0,2)+E:E;c(l(y,u,0))}),l=(u,c,d)=>new Promise((h,m)=>{if(d===i.length)return h(a(c+1));let E=i[d];Zut(u+E,{pathExt:o},(y,C)=>{if(!y&&C)if(e.all)s.push(u+E);else return h(u+E);return h(l(u,c,d+1))})});return n?a(0).then(u=>n(null,u),n):a(0)},p5n=(t,e)=>{e=e||{};let{pathEnv:n,pathExt:r,pathExtExe:i}=tct(t,e),o=[];for(let s=0;s<n.length;s++){let a=n[s],l=/^".*"$/.test(a)?a.slice(1,-1):a,u=Xut.join(l,t),c=!l&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<r.length;d++){let h=c+r[d];try{if(Zut.sync(h,{pathExt:i}))if(e.all)o.push(h);else return h}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw ect(t)};rct.exports=nct;nct.sync=p5n});var sct=b((nZr,__e)=>{"use strict";var oct=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};__e.exports=oct;__e.exports.default=oct});var cct=b((rZr,uct)=>{"use strict";var act=we("path"),h5n=ict(),m5n=sct();function lct(t,e){let n=t.options.env||process.env,r=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=h5n.sync(t.command,{path:n[m5n({env:n})],pathExt:e?act.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=act.resolve(i?t.options.cwd:"",s)),s}function A5n(t){return lct(t)||lct(t,!0)}uct.exports=A5n});var dct=b((iZr,T_e)=>{"use strict";var I_e=/([()\][%!^"`<>&|;, *?])/g;function g5n(t){return t=t.replace(I_e,"^$1"),t}function E5n(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(I_e,"^$1"),e&&(t=t.replace(I_e,"^$1")),t}T_e.exports.command=g5n;T_e.exports.argument=E5n});var pct=b((oZr,fct)=>{"use strict";fct.exports=/^#!(.*)/});var mct=b((sZr,hct)=>{"use strict";var y5n=pct();hct.exports=(t="")=>{let e=t.match(y5n);if(!e)return null;let[n,r]=e[0].replace(/#! ?/,"").split(" "),i=n.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i}});var gct=b((aZr,Act)=>{"use strict";var b_e=we("fs"),C5n=mct();function v5n(t){let n=Buffer.alloc(150),r;try{r=b_e.openSync(t,"r"),b_e.readSync(r,n,0,150,0),b_e.closeSync(r)}catch{}return C5n(n.toString())}Act.exports=v5n});var vct=b((lZr,Cct)=>{"use strict";var D5n=we("path"),Ect=cct(),yct=dct(),S5n=gct(),_5n=process.platform==="win32",I5n=/\.(?:com|exe)$/i,T5n=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function b5n(t){t.file=Ect(t);let e=t.file&&S5n(t.file);return e?(t.args.unshift(t.file),t.command=e,Ect(t)):t.file}function x5n(t){if(!_5n)return t;let e=b5n(t),n=!I5n.test(e);if(t.options.forceShell||n){let r=T5n.test(e);t.command=D5n.normalize(t.command),t.command=yct.command(t.command),t.args=t.args.map(o=>yct.argument(o,r));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function w5n(t,e,n){e&&!Array.isArray(e)&&(n=e,e=null),e=e?e.slice(0):[],n=Object.assign({},n);let r={command:t,args:e,options:n,file:void 0,original:{command:t,args:e}};return n.shell?r:x5n(r)}Cct.exports=w5n});var _ct=b((uZr,Sct)=>{"use strict";var x_e=process.platform==="win32";function w_e(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function R5n(t,e){if(!x_e)return;let n=t.emit;t.emit=function(r,i){if(r==="exit"){let o=Dct(i,e);if(o)return n.call(t,"error",o)}return n.apply(t,arguments)}}function Dct(t,e){return x_e&&t===1&&!e.file?w_e(e.original,"spawn"):null}function B5n(t,e){return x_e&&t===1&&!e.file?w_e(e.original,"spawnSync"):null}Sct.exports={hookChildProcess:R5n,verifyENOENT:Dct,verifyENOENTSync:B5n,notFoundError:w_e}});var bct=b((cZr,Z8)=>{"use strict";var Ict=we("child_process"),R_e=vct(),B_e=_ct();function Tct(t,e,n){let r=R_e(t,e,n),i=Ict.spawn(r.command,r.args,r.options);return B_e.hookChildProcess(i,r),i}function N5n(t,e,n){let r=R_e(t,e,n),i=Ict.spawnSync(r.command,r.args,r.options);return i.error=i.error||B_e.verifyENOENTSync(i.status,r),i}Z8.exports=Tct;Z8.exports.spawn=Tct;Z8.exports.sync=N5n;Z8.exports._parse=R_e;Z8.exports._enoent=B_e});function O5n(t){return cx.parse(JSON.parse(t))}function xct(t){return JSON.stringify(t)+`
545
545
  `}var gee,wct=Le(()=>{dx();gee=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
546
546
  `);if(e===-1)return null;let n=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),O5n(n)}clear(){this._buffer=void 0}}});import yee from"node:process";import{PassThrough as M5n}from"node:stream";function L5n(){let t={};for(let e of F5n){let n=yee.env[e];n!==void 0&&(n.startsWith("()")||(t[e]=n))}return t}function P5n(){return"type"in yee}var Rct,F5n,Eee,Bct=Le(()=>{Rct=Qe(bct(),1);wct();F5n=yee.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];Eee=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new gee,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new M5n)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,n)=>{var r,i,o,s,a;this._process=(0,Rct.default)(this._serverParams.command,(r=this._serverParams.args)!==null&&r!==void 0?r:[],{env:{...L5n(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:yee.platform==="win32"&&P5n(),cwd:this._serverParams.cwd}),this._process.on("error",l=>{var u,c;if(l.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}n(l),(c=this.onerror)===null||c===void 0||c.call(this,l)}),this._process.on("spawn",()=>{e()}),this._process.on("close",l=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(o=this._process.stdin)===null||o===void 0||o.on("error",l=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,l)}),(s=this._process.stdout)===null||s===void 0||s.on("data",l=>{this._readBuffer.append(l),this.processReadBuffer()}),(a=this._process.stdout)===null||a===void 0||a.on("error",l=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,l)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,n;return this._stderrStream?this._stderrStream:(n=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&n!==void 0?n:null}get pid(){var e,n;return(n=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&n!==void 0?n:null}processReadBuffer(){for(var e,n;;)try{let r=this._readBuffer.readMessage();if(r===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,r)}catch(r){(n=this.onerror)===null||n===void 0||n.call(this,r)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(n=>{var r;if(!(!((r=this._process)===null||r===void 0)&&r.stdin))throw new Error("Not connected");let i=xct(e);this._process.stdin.write(i)?n():this._process.stdin.once("drain",n)})}}});function N_e(t){}function vee(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=N_e,onError:n=N_e,onRetry:r=N_e,onComment:i}=t,o="",s=!0,a,l="",u="";function c(y){let C=s?y.replace(/^\xEF\xBB\xBF/,""):y,[_,w]=Q5n(`${o}${C}`);for(let B of _)d(B);o=w,s=!1}function d(y){if(y===""){m();return}if(y.startsWith(":")){i&&i(y.slice(y.startsWith(": ")?2:1));return}let C=y.indexOf(":");if(C!==-1){let _=y.slice(0,C),w=y[C+1]===" "?2:1,B=y.slice(C+w);h(_,B,y);return}h(y,"",y)}function h(y,C,_){switch(y){case"event":u=C;break;case"data":l=`${l}${C}
547
547
  `;break;case"id":a=C.includes("\0")?void 0:C;break;case"retry":/^\d+$/.test(C)?r(parseInt(C,10)):n(new Cee(`Invalid \`retry\` value: "${C}"`,{type:"invalid-retry",value:C,line:_}));break;default:n(new Cee(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:C,line:_}));break}}function m(){l.length>0&&e({id:a,event:u||void 0,data:l.endsWith(`
@@ -1591,7 +1591,7 @@ ${h.llmContent}`}):console.warn("Full context requested, but read_many_files ret
1591
1591
  - ${B.selectedText}`));let R=B?C.slice(1):C;if(R.length>0){let F=R.map(J=>`- ${J.path}`).join(`
1592
1592
  `),q=B?"Here are some other files the user has open, with the most recent at the top:":"Here are some files the user has open, with the most recent at the top:";_.push(`${q}
1593
1593
  ${F}`)}_.length>0&&(e=[{text:_.join(`
1594
- `)},...Array.isArray(e)?e:[e]])}}let h=new w6(this.getChat(),r);if(await this.loopDetector.turnStarted(n))return yield{type:xo.LoopDetected},h;let E=h.run(e,n);for await(let y of E){if(this.loopDetector.addAndCheck(y))return yield{type:xo.LoopDetected},h;yield y}if(!h.pendingToolCalls.length&&n&&!n.aborted){if(this.config.getModel()!==u)return h;let C=await zEt(this.getChat(),this,n);if(h5t(this.config,new ece(r,h.finishReason?.toString()||"",C?.next_speaker||"")),C?.next_speaker==="model"){let _=[{text:"Please continue."}];yield*this.sendMessageStream(_,n,r,l-1,u)}}return h}async generateJson(e,n,r,i,o={}){let s=i||this.config.getModel()||Eu;try{let a=this.config.getUserMemory(),l=await IP(this.config,a),u={abortSignal:r,...this.generateContentConfig,...o},d=await N6(()=>this.getContentGenerator().generateContent({model:s,config:{...u,systemInstruction:l,responseSchema:n,responseMimeType:"application/json"},contents:e},this.lastPromptId),{onPersistent429:async(y,C)=>await this.handleFlashFallback(y,C),authType:this.config.getContentGeneratorConfig()?.authType}),h=w2(d);if(!h){let y=new Error("API returned an empty response for generateJson.");throw await Vx(y,"Error in generateJson: API returned an empty response.",e,"generateJson-empty-response"),y}let m=/```json\s*([\s\S]*?)\s*```/,E=h.match(m);E&&(cf.getInstance(this.config)?.logMalformedJsonResponseEvent(new tce(s)),h=E[1].trim());try{return JSON.parse(h)}catch(y){throw await Vx(y,"Failed to parse JSON response from generateJson.",{responseTextFailedToParse:h,originalRequestContents:e},"generateJson-parse"),new Error(`Failed to parse API response as JSON: ${sn(y)}`)}}catch(a){throw r.aborted||a instanceof Error&&a.message==="API returned an empty response for generateJson."?a:(await Vx(a,"Error generating JSON content via API.",e,"generateJson-api"),new Error(`Failed to generate JSON content: ${sn(a)}`))}}async generateContent(e,n,r,i){let o=i??this.config.getModel(),s={...this.generateContentConfig,...n};try{let a=this.config.getUserMemory(),l=await IP(this.config,a),u={abortSignal:r,...s,systemInstruction:l};return await N6(()=>this.getContentGenerator().generateContent({model:o,config:u,contents:e},this.lastPromptId),{onPersistent429:async(h,m)=>await this.handleFlashFallback(h,m),authType:this.config.getContentGeneratorConfig()?.authType})}catch(a){throw r.aborted?a:(await Vx(a,`Error generating content via API with model ${o}.`,{requestContents:e,requestConfig:s},"generateContent-api"),new Error(`Failed to generate content with model ${o}: ${sn(a)}`))}}async generateEmbedding(e){if(!e||e.length===0)return[];let n={model:this.embeddingModel,contents:e},r=await this.getContentGenerator().embedContent(n);if(!r.embeddings||r.embeddings.length===0)throw new Error("No embeddings found in API response.");if(r.embeddings.length!==e.length)throw new Error(`API returned a mismatched number of embeddings. Expected ${e.length}, got ${r.embeddings.length}.`);return r.embeddings.map((i,o)=>{let s=i.values;if(!s||s.length===0)throw new Error(`API returned an empty embedding for input text at index ${o}: "${e[o]}"`);return s})}async shouldCompressChat(e=!1){let n=this.getChat().getHistory(!0);if(n.length===0)return!1;let r=this.config.getModel(),{totalTokens:i}=await this.getContentGenerator().countTokens({model:r,contents:n});return!(i===void 0||!e&&i<this.COMPRESSION_TOKEN_THRESHOLD*k8(r))}async tryCompressChat(e,n=!1){if(!await this.shouldCompressChat(n))return null;let i=this.getChat().getHistory(!0),o=this.config.getModel(),{totalTokens:s}=await this.getContentGenerator().countTokens({model:o,contents:i});if(s===void 0)return console.warn(`Could not determine token count for model ${o}.`),null;let a=I5t(i,1-this.COMPRESSION_PRESERVE_THRESHOLD);for(;a<i.length&&(i[a]?.role==="model"||YC(i[a]));)a++;let l=i.slice(0,a),u=i.slice(a);this.getChat().setHistory(l);let{text:c}=await this.getChat().sendMessage({message:{text:"First, reason in your scratchpad. Then, generate the <state_snapshot>."},config:{systemInstruction:{text:dwe()}}},e);this.chat=await this.startChat([{role:"user",parts:[{text:c}]},{role:"model",parts:[{text:"Got it. Thanks for the additional context!"}]},...u]);let{totalTokens:d}=await this.getContentGenerator().countTokens({model:this.config.getModel(),contents:this.getChat().getHistory()},!0);return d===void 0?(console.warn("Could not determine compressed history token count."),null):{originalTokenCount:s,newTokenCount:d}}async handleFlashFallback(e,n){if(e!==Sn.LOGIN_WITH_GOOGLE)return null;let r=this.config.getModel(),i=Eu;if(r===i)return null;let o=this.config.flashFallbackHandler;if(typeof o=="function")try{let s=await o(r,i,n);if(s!==!1&&s!==null)return this.config.setModel(i),this.config.setFallbackMode(!0),i;if(this.config.getModel()===i)return null}catch(s){console.warn("Flash fallback handler failed:",s)}return null}emitReminderEvent(e,n,r,i="medium"){this.reminderManager.emitEvent(e,n,r,i)}getReminderManager(){return this.reminderManager}restoreHistory(e){if(!this.chat)throw new Error("Chat not initialized. Call startChat() first.");this.getChat().setHistory(e)}}});var Sce,T5t=Le(()=>{"use strict";Dce();DP();Sce=class{sessions=new Map;async createSession(e,n,r,i,o,s){let a=await r.clone();a.setAgentCoreSystemPrompt(i.systemPrompt),a.setAgentColor(i.color);let l=new K3(a),u=a.getContentGeneratorConfig();if(!u)throw new Error("Content generator config not available for SubAgent");if(await l.initialize(u),s&&s.length>0){let d=await a.getToolRegistry(),h=new Set(s.map(y=>y.name)),m=d.getAllTools(),E=[...s,...m.filter(y=>h.has(y.name)&&!s.some(C=>C.name===y.name))];d.tools=new Map,E.forEach(y=>d.registerTool(y))}await l.setTools(),a.setGeminiClient(l);let c={sessionId:i.sessionId,agentId:e,config:a,geminiClient:l,sessionConfig:i,messageHistory:[],startTime:Date.now(),currentRound:0};return this.sessions.set(i.sessionId,c),o.emit({type:wo.SESSION_CREATED,agentId:e,agentIndex:n,timestamp:Date.now(),sessionConfig:i,data:{messageCount:0}}),c}getSession(e){return this.sessions.get(e)}addMessageToSession(e,n,r,i){let o=this.sessions.get(e);o&&(o.messageHistory.push(n),i.emit({type:wo.SESSION_MESSAGE_ADDED,agentId:o.agentId,agentIndex:r,timestamp:Date.now(),sessionConfig:o.sessionConfig,data:{messageCount:o.messageHistory.length}}))}cleanupSession(e){this.sessions.delete(e)}getAllActiveSessions(){return Array.from(this.sessions.values())}getSessionCount(){return this.sessions.size}}});var X3,b5t=Le(()=>{"use strict";SC();X3=class{static SUPPORTED_MODELS=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"}];static isModelSupported(e){return e?this.SUPPORTED_MODELS.some(n=>n.value===e):!1}static getAvailableModels(){return[...this.SUPPORTED_MODELS]}static getSupportedModelValues(){return this.SUPPORTED_MODELS.map(e=>e.value)}static getDefaultModel(){return wh}static getClosestSupportedModel(e){if(this.isModelSupported(e))return e;let n=e.toLowerCase(),r=this.SUPPORTED_MODELS.find(i=>i.value.toLowerCase().includes(n)||n.includes(i.value.toLowerCase()));return r?r.value:this.getDefaultModel()}static getModelLabel(e){let n=this.SUPPORTED_MODELS.find(r=>r.value===e);return n?n.label:e}static validateModel(e,n){if(!e)return{isValid:!1,model:e,reason:"Model name is empty",suggestedModel:this.getDefaultModel()};if(n&&e===n)return{isValid:!0,model:e};if(this.isModelSupported(e))return{isValid:!0,model:e};let r=this.getClosestSupportedModel(e);return{isValid:!1,model:e,reason:`Model '${e}' is not supported`,suggestedModel:r,availableModels:this.getAvailableModels()}}}});import*as _ce from"fs";import*as f8e from"path";import*as x5t from"os";var L9,p8e=Le(()=>{"use strict";DP();L9=class t{static SESSION_PREFERENCES=new Map;static CONFIG_DIR=f8e.join(x5t.homedir(),".iflow");static PREFERENCES_FILE=f8e.join(t.CONFIG_DIR,"model-preferences.json");static setSessionPreference(e,n){this.SESSION_PREFERENCES.set(e,n)}static getSessionPreference(e){return this.SESSION_PREFERENCES.get(e)||null}static clearSessionPreferences(){this.SESSION_PREFERENCES.clear()}static async setUserPreference(e,n){try{await this.ensureConfigDir();let r=await this.loadUserPreferences();r[e]={originalModel:e,fallbackModel:n,preference:iA.RememberAlways,createdAt:Date.now()},await this.saveUserPreferences(r)}catch(r){console.error("Failed to save user model preference:",r)}}static async getUserPreference(e){try{let r=(await this.loadUserPreferences())[e];return r?r.fallbackModel:null}catch(n){return console.error("Failed to load user model preference:",n),null}}static async getPreferredFallback(e){let n=this.getSessionPreference(e);return n||await this.getUserPreference(e)}static async savePreference(e,n,r){switch(r){case iA.OnceOnly:break;case iA.RememberSession:this.setSessionPreference(e,n);break;case iA.RememberAlways:await this.setUserPreference(e,n);break}}static async removeUserPreference(e){try{let n=await this.loadUserPreferences();delete n[e],await this.saveUserPreferences(n)}catch(n){console.error("Failed to remove user model preference:",n)}}static async getAllUserPreferences(){try{let e=await this.loadUserPreferences();return Object.values(e)}catch(e){return console.error("Failed to load user preferences:",e),[]}}static async clearAllUserPreferences(){try{await this.saveUserPreferences({})}catch(e){console.error("Failed to clear user preferences:",e)}}static async ensureConfigDir(){try{await _ce.promises.mkdir(this.CONFIG_DIR,{recursive:!0})}catch{}}static async loadUserPreferences(){try{let e=await _ce.promises.readFile(this.PREFERENCES_FILE,"utf-8");return JSON.parse(e)}catch{return{}}}static async saveUserPreferences(e){let n=JSON.stringify(e,null,2);await _ce.promises.writeFile(this.PREFERENCES_FILE,n,"utf-8")}}});function w5t(t){let e=/^---\s*\n([\s\S]*?)---\s*\n?/,n=t.match(e);if(!n)return{frontmatter:{},content:t};let r=n[1]||"",i=t.slice(n[0].length),o={},s=r.split(`
1594
+ `)},...Array.isArray(e)?e:[e]])}}let h=new w6(this.getChat(),r);if(await this.loopDetector.turnStarted(n))return yield{type:xo.LoopDetected},h;let E=h.run(e,n);for await(let y of E){if(this.loopDetector.addAndCheck(y))return yield{type:xo.LoopDetected},h;yield y}if(!h.pendingToolCalls.length&&n&&!n.aborted){if(this.config.getModel()!==u)return h;let C=await zEt(this.getChat(),this,n);if(h5t(this.config,new ece(r,h.finishReason?.toString()||"",C?.next_speaker||"")),C?.next_speaker==="model"){let _=[{text:"Please continue."}];yield*this.sendMessageStream(_,n,r,l-1,u)}}return h}async generateJson(e,n,r,i,o={}){let s=i||this.config.getModel()||Eu;try{let a=this.config.getUserMemory(),l=await IP(this.config,a),u={abortSignal:r,...this.generateContentConfig,...o},d=await N6(()=>this.getContentGenerator().generateContent({model:s,config:{...u,systemInstruction:l,responseSchema:n,responseMimeType:"application/json"},contents:e},this.lastPromptId),{onPersistent429:async(y,C)=>await this.handleFlashFallback(y,C),authType:this.config.getContentGeneratorConfig()?.authType}),h=w2(d);if(!h){let y=new Error("API returned an empty response for generateJson.");throw await Vx(y,"Error in generateJson: API returned an empty response.",e,"generateJson-empty-response"),y}let m=/```json\s*([\s\S]*?)\s*```/,E=h.match(m);E&&(cf.getInstance(this.config)?.logMalformedJsonResponseEvent(new tce(s)),h=E[1].trim());try{return JSON.parse(h)}catch(y){throw await Vx(y,"Failed to parse JSON response from generateJson.",{responseTextFailedToParse:h,originalRequestContents:e},"generateJson-parse"),new Error(`Failed to parse API response as JSON: ${sn(y)}`)}}catch(a){throw r.aborted||a instanceof Error&&a.message==="API returned an empty response for generateJson."?a:(await Vx(a,"Error generating JSON content via API.",e,"generateJson-api"),new Error(`Failed to generate JSON content: ${sn(a)}`))}}async generateContent(e,n,r,i){let o=i??this.config.getModel(),s={...this.generateContentConfig,...n};try{let a=this.config.getUserMemory(),l=await IP(this.config,a),u={abortSignal:r,...s,systemInstruction:l};return await N6(()=>this.getContentGenerator().generateContent({model:o,config:u,contents:e},this.lastPromptId),{onPersistent429:async(h,m)=>await this.handleFlashFallback(h,m),authType:this.config.getContentGeneratorConfig()?.authType})}catch(a){throw r.aborted?a:(await Vx(a,`Error generating content via API with model ${o}.`,{requestContents:e,requestConfig:s},"generateContent-api"),new Error(`Failed to generate content with model ${o}: ${sn(a)}`))}}async generateEmbedding(e){if(!e||e.length===0)return[];let n={model:this.embeddingModel,contents:e},r=await this.getContentGenerator().embedContent(n);if(!r.embeddings||r.embeddings.length===0)throw new Error("No embeddings found in API response.");if(r.embeddings.length!==e.length)throw new Error(`API returned a mismatched number of embeddings. Expected ${e.length}, got ${r.embeddings.length}.`);return r.embeddings.map((i,o)=>{let s=i.values;if(!s||s.length===0)throw new Error(`API returned an empty embedding for input text at index ${o}: "${e[o]}"`);return s})}async shouldCompressChat(e=!1){let n=this.getChat().getHistory(!0);if(n.length===0)return!1;let r=this.config.getModel(),{totalTokens:i}=await this.getContentGenerator().countTokens({model:r,contents:n});return!(i===void 0||!e&&i<this.COMPRESSION_TOKEN_THRESHOLD*k8(r))}async tryCompressChat(e,n=!1){if(!await this.shouldCompressChat(n))return null;let i=this.getChat().getHistory(!0),o=this.config.getModel(),{totalTokens:s}=await this.getContentGenerator().countTokens({model:o,contents:i});if(s===void 0)return console.warn(`Could not determine token count for model ${o}.`),null;let a=I5t(i,1-this.COMPRESSION_PRESERVE_THRESHOLD);for(;a<i.length&&(i[a]?.role==="model"||YC(i[a]));)a++;let l=i.slice(0,a),u=i.slice(a);this.getChat().setHistory(l);let{text:c}=await this.getChat().sendMessage({message:{text:"First, reason in your scratchpad. Then, generate the <state_snapshot>."},config:{systemInstruction:{text:dwe()}}},e);this.chat=await this.startChat([{role:"user",parts:[{text:c}]},{role:"model",parts:[{text:"Got it. Thanks for the additional context!"}]},...u]);let{totalTokens:d}=await this.getContentGenerator().countTokens({model:this.config.getModel(),contents:this.getChat().getHistory()},!0);return d===void 0?(console.warn("Could not determine compressed history token count."),null):{originalTokenCount:s,newTokenCount:d}}async handleFlashFallback(e,n){if(e!==Sn.LOGIN_WITH_GOOGLE)return null;let r=this.config.getModel(),i=Eu;if(r===i)return null;let o=this.config.flashFallbackHandler;if(typeof o=="function")try{let s=await o(r,i,n);if(s!==!1&&s!==null)return this.config.setModel(i),this.config.setFallbackMode(!0),i;if(this.config.getModel()===i)return null}catch(s){console.warn("Flash fallback handler failed:",s)}return null}emitReminderEvent(e,n,r,i="medium"){this.reminderManager.emitEvent(e,n,r,i)}getReminderManager(){return this.reminderManager}restoreHistory(e){if(!this.chat)throw new Error("Chat not initialized. Call startChat() first.");this.getChat().setHistory(e)}}});var Sce,T5t=Le(()=>{"use strict";Dce();DP();Sce=class{sessions=new Map;async createSession(e,n,r,i,o,s){let a=await r.clone();a.setAgentCoreSystemPrompt(i.systemPrompt),a.setAgentColor(i.color);let l=new K3(a),u=a.getContentGeneratorConfig();if(!u)throw new Error("Content generator config not available for SubAgent");if(await l.initialize(u),s&&s.length>0){let d=await a.getToolRegistry(),h=new Set(s.map(y=>y.name)),m=d.getAllTools(),E=[...s,...m.filter(y=>h.has(y.name)&&!s.some(C=>C.name===y.name))];d.tools=new Map,E.forEach(y=>d.registerTool(y))}await l.setTools(),a.setGeminiClient(l);let c={sessionId:i.sessionId,agentId:e,config:a,geminiClient:l,sessionConfig:i,messageHistory:[],startTime:Date.now(),currentRound:0};return this.sessions.set(i.sessionId,c),o.emit({type:wo.SESSION_CREATED,agentId:e,agentIndex:n,timestamp:Date.now(),sessionConfig:i,data:{messageCount:0}}),c}getSession(e){return this.sessions.get(e)}addMessageToSession(e,n,r,i){let o=this.sessions.get(e);o&&(o.messageHistory.push(n),i.emit({type:wo.SESSION_MESSAGE_ADDED,agentId:o.agentId,agentIndex:r,timestamp:Date.now(),sessionConfig:o.sessionConfig,data:{messageCount:o.messageHistory.length}}))}cleanupSession(e){this.sessions.delete(e)}getAllActiveSessions(){return Array.from(this.sessions.values())}getSessionCount(){return this.sessions.size}}});var X3,b5t=Le(()=>{"use strict";SC();X3=class{static SUPPORTED_MODELS=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"GLM-4.5",value:"glm-4.5"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"}];static isModelSupported(e){return e?this.SUPPORTED_MODELS.some(n=>n.value===e):!1}static getAvailableModels(){return[...this.SUPPORTED_MODELS]}static getSupportedModelValues(){return this.SUPPORTED_MODELS.map(e=>e.value)}static getDefaultModel(){return wh}static getClosestSupportedModel(e){if(this.isModelSupported(e))return e;let n=e.toLowerCase(),r=this.SUPPORTED_MODELS.find(i=>i.value.toLowerCase().includes(n)||n.includes(i.value.toLowerCase()));return r?r.value:this.getDefaultModel()}static getModelLabel(e){let n=this.SUPPORTED_MODELS.find(r=>r.value===e);return n?n.label:e}static validateModel(e,n){if(!e)return{isValid:!1,model:e,reason:"Model name is empty",suggestedModel:this.getDefaultModel()};if(n&&e===n)return{isValid:!0,model:e};if(this.isModelSupported(e))return{isValid:!0,model:e};let r=this.getClosestSupportedModel(e);return{isValid:!1,model:e,reason:`Model '${e}' is not supported`,suggestedModel:r,availableModels:this.getAvailableModels()}}}});import*as _ce from"fs";import*as f8e from"path";import*as x5t from"os";var L9,p8e=Le(()=>{"use strict";DP();L9=class t{static SESSION_PREFERENCES=new Map;static CONFIG_DIR=f8e.join(x5t.homedir(),".iflow");static PREFERENCES_FILE=f8e.join(t.CONFIG_DIR,"model-preferences.json");static setSessionPreference(e,n){this.SESSION_PREFERENCES.set(e,n)}static getSessionPreference(e){return this.SESSION_PREFERENCES.get(e)||null}static clearSessionPreferences(){this.SESSION_PREFERENCES.clear()}static async setUserPreference(e,n){try{await this.ensureConfigDir();let r=await this.loadUserPreferences();r[e]={originalModel:e,fallbackModel:n,preference:iA.RememberAlways,createdAt:Date.now()},await this.saveUserPreferences(r)}catch(r){console.error("Failed to save user model preference:",r)}}static async getUserPreference(e){try{let r=(await this.loadUserPreferences())[e];return r?r.fallbackModel:null}catch(n){return console.error("Failed to load user model preference:",n),null}}static async getPreferredFallback(e){let n=this.getSessionPreference(e);return n||await this.getUserPreference(e)}static async savePreference(e,n,r){switch(r){case iA.OnceOnly:break;case iA.RememberSession:this.setSessionPreference(e,n);break;case iA.RememberAlways:await this.setUserPreference(e,n);break}}static async removeUserPreference(e){try{let n=await this.loadUserPreferences();delete n[e],await this.saveUserPreferences(n)}catch(n){console.error("Failed to remove user model preference:",n)}}static async getAllUserPreferences(){try{let e=await this.loadUserPreferences();return Object.values(e)}catch(e){return console.error("Failed to load user preferences:",e),[]}}static async clearAllUserPreferences(){try{await this.saveUserPreferences({})}catch(e){console.error("Failed to clear user preferences:",e)}}static async ensureConfigDir(){try{await _ce.promises.mkdir(this.CONFIG_DIR,{recursive:!0})}catch{}}static async loadUserPreferences(){try{let e=await _ce.promises.readFile(this.PREFERENCES_FILE,"utf-8");return JSON.parse(e)}catch{return{}}}static async saveUserPreferences(e){let n=JSON.stringify(e,null,2);await _ce.promises.writeFile(this.PREFERENCES_FILE,n,"utf-8")}}});function w5t(t){let e=/^---\s*\n([\s\S]*?)---\s*\n?/,n=t.match(e);if(!n)return{frontmatter:{},content:t};let r=n[1]||"",i=t.slice(n[0].length),o={},s=r.split(`
1595
1595
  `);for(let a of s){let l=a.trim();if(!l||l.startsWith("#"))continue;let u=l.indexOf(":");if(u>0){let c=l.slice(0,u).trim(),d=l.slice(u+1).trim();if(c&&d){let h=ySr(d);o[c]=h}}}return{frontmatter:o,content:i}}function ySr(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t==="true"||t==="yes"||t==="on"?!0:t==="false"||t==="no"||t==="off"?!1:t==="null"||t==="~"?null:/^-?\d+$/.test(t)?parseInt(t,10):/^-?\d*\.\d+$/.test(t)?parseFloat(t):t.includes(",")?t.split(",").map(e=>e.trim()):t}var R5t=Le(()=>{"use strict";});import{promises as Ice}from"fs";import*as J$ from"path";import{homedir as CSr}from"os";var tT,Tce=Le(()=>{"use strict";R5t();tT=class{globalAgentsDir;projectAgentsDir;constructor(e){this.globalAgentsDir=J$.join(CSr(),".iflow","agents"),this.projectAgentsDir=e?J$.join(e,".iflow","agents"):J$.join(process.cwd(),".iflow","agents")}async scan(){let e=[];try{let n=await this.scanDirectory(this.globalAgentsDir,!0);e.push(...n)}catch(n){n?.code!=="ENOENT"&&console.warn("Error scanning global agents directory:",n)}try{let n=await this.scanDirectory(this.projectAgentsDir,!1);e.push(...n)}catch(n){n?.code!=="ENOENT"&&console.warn("Error scanning project agents directory:",n)}return e}async scanDirectory(e,n){let r=[];try{let i=await Ice.readdir(e,{withFileTypes:!0});for(let o of i)if(o.isFile()&&o.name.endsWith(".md")){let s=J$.join(e,o.name),a=await this.parseAgentFile(s,n);a&&r.push(a)}}catch(i){throw i}return r}async parseAgentFile(e,n){try{let r=await Ice.readFile(e,"utf-8"),{frontmatter:i,content:o}=w5t(r),s=i["agent-type"]||i.name||i.agentType||i.Name;if(!s)return console.warn(`Agent file ${e} missing agent-type or name or agentType or name`),null;let a=i["allowed-tools"]||i.tools||i.allowedTools||i.Tools||"",l=this.parseToolsList(a),u=i["allowed-mcps"]||i.mcps||i.allowedMcps||i.Mcps||i.MCP||i.MCPs||"",c=this.parseMcpsList(u),d=this.parseBoolean(i["is-inherit-tools"]??i["is-inherit-tool"]??i.isInheritTools??i.isInheritTool??i["inherit-tools"]??i["inherit-tool"]??i.inheritTools??i.inheritTool),h=this.parseBoolean(i["is-inherit-mcps"]??i["is-inherit-mcp"]??i.isInheritMcps??i.isInheritMcp??i["inherit-mcps"]??i["inherit-mcp"]??i.inheritMcps??i.inheritMcp);return{agentType:s,name:i.name||s,description:i.description,whenToUse:i["when-to-use"]||i.whenToUse||i.description||"",allowedTools:l,allowedMcps:c,isInheritTools:d,isInheritMcps:h,systemPrompt:o.trim(),isBuiltIn:!1,proactive:i.proactive==="true"||i.proactive===!0,sourcePath:e,color:i.color,model:i.model,location:n?"global":"project",filePath:e}}catch(r){return console.error(`Error parsing agent file ${e}:`,r),null}}parseToolsList(e){if(!e)return[];let n=[];if(typeof e=="string"){if(e.trim()==="*")return["*"];n=e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}else Array.isArray(e)&&(n=e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0));return n}parseMcpsList(e){if(e){if(typeof e=="string"){let n=e.trim();return n===""||n==="*"?void 0:n.split(",").map(r=>r.trim()).filter(r=>r.length>0)}if(Array.isArray(e)){let n=e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?n:void 0}}}parseBoolean(e){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="string"){let n=e.toLowerCase().trim();if(n==="true"||n==="yes"||n==="1")return!0;if(n==="false"||n==="no"||n==="0")return!1}}}async ensureDirectories(){try{await Ice.mkdir(this.globalAgentsDir,{recursive:!0}),await Ice.mkdir(this.projectAgentsDir,{recursive:!0})}catch(e){console.error("Error creating agent directories:",e)}}getDirectoryPaths(){return{global:this.globalAgentsDir,project:this.projectAgentsDir}}}});var h8e,m8e,B5t=Le(()=>{"use strict";IG();h8e=class{filterMcpTools(e,n){if(!n||n.length===0)return e;let r=new Set(n.map(i=>i.toLowerCase()));return e.filter(i=>{if(!this.isMcpTool(i))return!0;let o=this.getMcpServerName(i);return o?r.has(o.toLowerCase()):!1})}isMcpTool(e){return e instanceof qp||e.constructor.name==="DiscoveredMCPTool"||e.serverName!==void 0}getMcpServerName(e){if(e instanceof qp)return e.serverName;let n=e;return n.serverName&&typeof n.serverName=="string"?n.serverName:null}getMcpServerNames(e){let n=new Set;for(let r of e)if(this.isMcpTool(r)){let i=this.getMcpServerName(r);i&&n.add(i)}return Array.from(n).sort()}validateMcpServers(e,n){let r=new Set(Object.keys(e||{}).map(s=>s.toLowerCase())),i=[],o=[];for(let s of n)r.has(s.toLowerCase())?i.push(s):o.push(s);return{valid:i,invalid:o}}},m8e=new h8e});function om(t){return bce||(bce=new xce(t)),bce}function vSr(){bce=null}var xce,bce,wce=Le(()=>{"use strict";Tce();xce=class{cache=new Map;lastScanTime=0;CACHE_TTL=3e5;scanner;constructor(e){this.scanner=new tT(e)}async getAgents(){let e=Date.now();if(this.isCacheValid(e)){let r=this.cache.get("agents");if(r)return r}let n=await this.scanner.scan();return this.cache.set("agents",n),this.lastScanTime=e,n}async refresh(){return this.invalidate(),this.getAgents()}invalidate(){this.cache.clear(),this.lastScanTime=0}isCacheValid(e){return e-this.lastScanTime<this.CACHE_TTL}getStats(){let e=Date.now(),n=Math.max(0,this.CACHE_TTL-(e-this.lastScanTime));return{size:this.cache.size,lastScanTime:this.lastScanTime,isValid:this.isCacheValid(e),ttlRemaining:n}}setTTL(e){Object.defineProperty(this,"CACHE_TTL",{value:e,writable:!1,configurable:!0})}},bce=null});import DSr from"path";import{promises as Rce}from"fs";async function Bce(t,e){return new K$(e).createAgent(t)}function X$(t){return Ev.getAgentColors(t)}var Z3,nT,K$,Ev,Nce=Le(()=>{"use strict";Tce();B5t();wce();Z3=["blue","green","yellow","purple","orange","brown","red","black"],nT=new Map([["blue","\u{1F535}"],["green","\u{1F7E2}"],["yellow","\u{1F7E1}"],["purple","\u{1F7E3}"],["orange","\u{1F7E0}"],["brown","\u{1F7E4}"],["red","\u{1F534}"],["black","\u26AB\uFE0F"]]),K$=class{agents=new Map;builtInAgents=[];scanner;constructor(e){this.initializeBuiltInAgents(),this.scanner=new tT(e)}initializeBuiltInAgents(){this.builtInAgents=[{agentType:"general-purpose",name:"General Purpose Agent",description:"General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.",whenToUse:"For complex research, code searching, and multi-step tasks",allowedTools:["*"],systemPrompt:`You are an agent for iFlow CLI. Given the user's message, you should use the tools available to complete the task. Do what has been asked; nothing more, nothing less. When you complete the task simply respond with a detailed writeup.
1596
1596
 
1597
1597
  Your strengths:
@@ -2084,7 +2084,7 @@ Error: ${i}`}}};AKt={command:"add <name-or-id>",describe:"Add an agent from onli
2084
2084
  `);let r=n.filter(o=>o.location==="project"),i=n.filter(o=>o.location==="global");if(r.length>0){console.log(`${m4r}Project agents:${qpe}`);for(let o of r){if(console.log(`\u2022 ${EKt}${o.name}${qpe} (${o.agentType})`),o.description&&console.log(` Description: ${o.description}`),o.model&&console.log(` Model: ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(` Tools: ${s}${a}`)}else o.isInheritTools===!1&&console.log(" Tools: None (no inherit)");o.allowedMcps&&o.allowedMcps.length>0?console.log(` MCPs: ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1&&console.log(" MCPs: None (no inherit)"),console.log(` Location: ${o.filePath||"unknown"}`),console.log()}}if(i.length>0){console.log(`${h4r}Global agents:${qpe}`);for(let o of i){if(console.log(`\u2022 ${EKt}${o.name}${qpe} (${o.agentType})`),o.description&&console.log(` Description: ${o.description}`),o.model&&console.log(` Model: ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(` Tools: ${s}${a}`)}else o.isInheritTools===!1&&console.log(" Tools: None (no inherit)");o.allowedMcps&&o.allowedMcps.length>0?console.log(` MCPs: ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1&&console.log(" MCPs: None (no inherit)"),console.log(` Location: ${o.filePath||"unknown"}`),console.log()}}console.log(`Total: ${n.length} agent(s) configured`)}catch(n){console.error("Error loading agents:",n),process.exit(1)}}var EKt,h4r,m4r,qpe,yKt,CKt=Le(()=>{"use strict";qn();EKt="\x1B[32m",h4r="\x1B[33m",m4r="\x1B[34m",qpe="\x1B[0m";yKt={command:"list",describe:"List configured agents",builder:t=>t.usage("Usage: iflow agent list"),handler:async()=>{await A4r()}}});import*as Vpe from"fs";async function g4r(t,e){let{scope:n}=e,r=process.cwd(),i=om(r);try{let s=(await i.getAgents()).filter(a=>a.name===t||a.agentType===t);if(n&&n!=="all"&&(s=s.filter(a=>a.location===n)),s.length===0){let a=n&&n!=="all"?` in ${n} scope`:"";console.error(`Error: Agent '${t}' not found${a}`),process.exit(1)}if(s.length>1&&!n){console.error(`Error: Multiple agents found with name '${t}'. Please specify scope:`);for(let a of s)console.error(` - ${a.name} (${a.location}): ${a.filePath}`);console.error("Use --scope to specify which one to remove."),process.exit(1)}for(let a of s)try{a.filePath&&Vpe.existsSync(a.filePath)?(Vpe.unlinkSync(a.filePath),console.log(`Successfully removed agent '${a.name}' from ${a.location} scope`),console.log(`Deleted: ${a.filePath}`)):console.warn(`Warning: Agent file not found: ${a.filePath}`)}catch(l){console.error(`Error removing agent file ${a.filePath}:`,l),process.exit(1)}await i.refresh()}catch(o){console.error("Error removing agent:",o),process.exit(1)}}var vKt,DKt=Le(()=>{"use strict";qn();vKt={command:"remove <name>",describe:"Remove an agent",builder:t=>t.usage("Usage: iflow agent remove <name> [--scope project|global|all]").positional("name",{describe:"Name or type of the agent to remove",type:"string",demandOption:!0}).option("scope",{alias:"s",describe:"Scope to remove from (project, global, or all)",type:"string",choices:["project","global","all"]}),handler:async t=>{await g4r(t.name,{scope:t.scope})}}});import*as $pe from"fs";async function v4r(t){let e=process.cwd(),n=om(e);try{let i=(await n.getAgents()).filter(o=>o.name===t||o.agentType===t);i.length===0&&(console.error(`Error: Agent '${t}' not found`),process.exit(1));for(let o of i){if(console.log(`${E4r}Agent: ${o.name}${pm}`),console.log(`${oE}Type:${pm} ${o.agentType}`),console.log(`${oE}Location:${pm} ${o.location}`),console.log(`${oE}File:${pm} ${o.filePath}`),o.description&&console.log(`${oE}Description:${pm} ${o.description}`),o.whenToUse&&console.log(`${oE}When to use:${pm} ${o.whenToUse}`),o.model&&console.log(`${oE}Model:${pm} ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(`${oE}Allowed Tools:${pm} ${s}${a}`)}else o.isInheritTools===!1?console.log(`${oE}Allowed Tools:${pm} None (no inherit)`):console.log(`${oE}Allowed Tools:${pm} All tools (inherit)`);if(o.allowedMcps&&o.allowedMcps.length>0?console.log(`${oE}Allowed MCP Servers:${pm} ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1?console.log(`${oE}Allowed MCP Servers:${pm} None (no inherit)`):console.log(`${oE}Allowed MCP Servers:${pm} All MCP servers (inherit)`),o.systemPrompt&&(console.log(`${oE}System Prompt:${pm}`),console.log(o.systemPrompt)),o.filePath&&$pe.existsSync(o.filePath))try{let s=$pe.readFileSync(o.filePath,"utf8");console.log(`
2085
2085
  ${C4r}File Content:${pm}`),console.log("\u2500".repeat(50)),console.log(s),console.log("\u2500".repeat(50))}catch(s){console.warn(`Warning: Could not read file content: ${s}`)}else console.warn(`${y4r}Warning:${pm} Agent file not found at ${o.filePath||"unknown path"}`);i.length>1&&console.log(`
2086
2086
  `+"=".repeat(60)+`
2087
- `)}}catch(r){console.error("Error getting agent details:",r),process.exit(1)}}var E4r,y4r,oE,C4r,pm,SKt,_Kt=Le(()=>{"use strict";qn();E4r="\x1B[32m",y4r="\x1B[33m",oE="\x1B[34m",C4r="\x1B[36m",pm="\x1B[0m";SKt={command:"get <name>",describe:"Get details about an agent",builder:t=>t.usage("Usage: iflow agent get <name>").positional("name",{describe:"Name or type of the agent",type:"string",demandOption:!0}),handler:async t=>{await v4r(t.name)}}});async function I4r(t={}){let{page:e=1,size:n=20,search:r}=t,o=qa(process.cwd()).merged.apiKey;o||(console.error("Error: API key not found."),console.error("Please authenticate first by running the auth command."),process.exit(1)),console.log("Loading online agents...");try{let s=await _4r(o,e,n);s.success||(console.error(`Error: ${s.message}`),process.exit(1));let a=s.agents||[];if(r&&(a=a.filter(l=>l.name.toLowerCase().includes(r.toLowerCase())||l.description.toLowerCase().includes(r.toLowerCase())||l.category.toLowerCase().includes(r.toLowerCase()))),a.length===0){let l=r?` matching "${r}"`:"";console.log(`No agents found${l}`);return}console.log(`\\n${S4r}Online Agents${r?` (filtered by "${r}")`:""}:${__}\\n`);for(let l of a)console.log(`${D4r}\u2022 ${l.name}${__} (ID: ${l.id})`),console.log(` ${VQ}Description:${__} ${l.description}`),console.log(` ${VQ}Category:${__} ${l.category}`),console.log(` ${VQ}Model:${__} ${l.modelName}`),l.tags&&console.log(` ${VQ}Tags:${__} ${l.tags}`),console.log(` ${VQ}Author:${__} ${l.authorId}`),console.log(` ${VQ}Version:${__} ${l.version}`),console.log();console.log(`${IKt}Total: ${a.length} agent(s) shown${s.total?` (${s.total} total available)`:""}${__}`),console.log(`${IKt}To install an agent, use: iflow agent add <name-or-id>${__}`)}catch(s){console.error("Error browsing online agents:",s),process.exit(1)}}var D4r,IKt,S4r,VQ,__,_4r,TKt,bKt=Le(()=>{"use strict";Yu();D4r="\x1B[32m",IKt="\x1B[33m",S4r="\x1B[34m",VQ="\x1B[36m",__="\x1B[0m",_4r=async(t,e=1,n=20)=>{try{if(!t)return{success:!1,message:"Please authenticate first by running the auth command"};let i=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${t}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:n})});if(!i.ok){let a="Unable to load agents. Please try again later";return i.status===401?a="Authentication failed. Please check your API key or re-authenticate":i.status===403?a="Access denied. Please check your permissions":i.status===404?a="Agents service not found. Please try again later":i.status>=500&&(a="Server error. Please try again later"),{success:!1,message:a}}let o=await i.json();return o.success?{success:!0,agents:Array.isArray(o.data.data)?o.data.data:[],total:o.data.total||0}:{success:!1,message:o.message||"Failed to load agents from server"}}catch(r){let i="Unable to load agents. Please check your connection and try again";return r instanceof Error&&r.message.includes("Failed to fetch")&&(i="Network error. Please check your internet connection"),{success:!1,message:i}}};TKt={command:"online",describe:"Browse online agent repository",builder:t=>t.usage("Usage: iflow agent online [options]").option("page",{alias:"p",describe:"Page number (default: 1)",type:"number",default:1}).option("size",{alias:"s",describe:"Number of agents per page (default: 20)",type:"number",default:20}).option("search",{describe:"Search term to filter agents",type:"string"}),handler:async t=>{await I4r({page:t.page,size:t.size,search:t.search})}}});var xKt={};h0(xKt,{agentCommand:()=>SQe});var SQe,_Qe=Le(()=>{"use strict";gKt();CKt();DKt();_Kt();bKt();SQe={command:"agent",describe:"Manage agents",builder:t=>t.command(AKt).command(yKt).command(vKt).command(SKt).command(TKt).demandCommand(1,"You need at least one command before continuing.").version(!1),handler:()=>{}}});var lXt=b((TGi,aXt)=>{"use strict";var oFr=we("os"),sXt=we("tty"),y1=L7(),{env:Ap}=process,cR;y1("no-color")||y1("no-colors")||y1("color=false")||y1("color=never")?cR=0:(y1("color")||y1("colors")||y1("color=true")||y1("color=always"))&&(cR=1);"FORCE_COLOR"in Ap&&(Ap.FORCE_COLOR==="true"?cR=1:Ap.FORCE_COLOR==="false"?cR=0:cR=Ap.FORCE_COLOR.length===0?1:Math.min(parseInt(Ap.FORCE_COLOR,10),3));function LQe(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function PQe(t,e){if(cR===0)return 0;if(y1("color=16m")||y1("color=full")||y1("color=truecolor"))return 3;if(y1("color=256"))return 2;if(t&&!e&&cR===void 0)return 0;let n=cR||0;if(Ap.TERM==="dumb")return n;if(process.platform==="win32"){let r=oFr.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ap)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in Ap)||Ap.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in Ap)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ap.TEAMCITY_VERSION)?1:0;if(Ap.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ap){let r=parseInt((Ap.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ap.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ap.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ap.TERM)||"COLORTERM"in Ap?1:n}function sFr(t){let e=PQe(t,t&&t.isTTY);return LQe(e)}aXt.exports={supportsColor:sFr,stdout:LQe(PQe(!0,sXt.isatty(1))),stderr:LQe(PQe(!0,sXt.isatty(2)))}});var dXt=b((bGi,cXt)=>{"use strict";var aFr=lXt(),WQ=L7();function uXt(t){if(/^\d{3,4}$/.test(t)){let n=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(n[1],10),patch:parseInt(n[2],10)}}let e=(t||"").split(".").map(n=>parseInt(n,10));return{major:e[0],minor:e[1],patch:e[2]}}function QQe(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(WQ("no-hyperlink")||WQ("no-hyperlinks")||WQ("hyperlink=false")||WQ("hyperlink=never"))return!1;if(WQ("hyperlink=true")||WQ("hyperlink=always")||"NETLIFY"in e)return!0;if(!aFr.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let n=uXt(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return n.major===3?n.minor>=1:n.major>3;case"WezTerm":return n.major>=20200620;case"vscode":return n.major>1||n.major===1&&n.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let n=uXt(e.VTE_VERSION);return n.major>0||n.minor>=50}return!1}cXt.exports={supportsHyperlink:QQe,stdout:QQe(process.stdout),stderr:QQe(process.stderr)}});var YQe={};h0(YQe,{AuthHandler:()=>$Qe});var $Qe,jQe=Le(()=>{"use strict";$Qe=class{logger;constructor(e={}){this.logger=console}validateToken(e){return e.authToken?e.authToken.length<16?(console.error("Auth token appears to be invalid (too short)"),!1):!0:(console.error("No auth token found in server config"),!1)}buildAuthenticatedUrl(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return`${e.serverUrl.replace(/^http/,"ws")}/ws?token=${encodeURIComponent(e.authToken)}`}buildAuthHeaders(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return{Auttion:`Bearer ${e.authToken}`,"X-Auth-Token":e.authToken}}isTokenExpired(e,n=24*60*60*1e3){let i=Date.now()-e.timestamp;return i>n?(console.warn(`Token is ${Math.floor(i/1e3/60)} minutes old`),!0):!1}}});var zQe={};h0(zQe,{WebSocketClientImpl:()=>WQe});import{EventEmitter as LFr}from"events";var WQe,JQe=Le(()=>{"use strict";V4();Cde();WQe=class extends LFr{ws;config;isConnectedFlag=!1;heartbeatInterval;reconnectTimer;reconnectAttempts=0;pendingResponses=new Map;options;constructor(e={}){super(),this.options={reconnectAttempts:e.reconnectAttempts??3,reconnectDelay:e.reconnectDelay??1e3,heartbeatInterval:e.heartbeatInterval??3e4,connectionTimeout:e.connectionTimeout??5e3,logger:console}}async connect(e){return this.config=e,this.reconnectAttempts=0,new Promise((n,r)=>{let i=setTimeout(()=>{r(new Error("Connection timeout")),this.disconnect()},this.options.connectionTimeout);try{let o=`${e.serverUrl}?token=${e.authToken}`;this.ws=new q4(o),this.ws.on("open",()=>{clearTimeout(i),this.isConnectedFlag=!0,console.debug("WebSocket connected"),this.sendConnectMessage(),this.startHeartbeat(),n()}),this.ws.on("message",s=>{try{let a=JSON.parse(s.toString());this.handleMessage(a)}catch(a){console.log("error","Failed to parse WebSocket message:",a)}}),this.ws.on("error",s=>{clearTimeout(i),console.log("error","WebSocket error:",s),this.emit("error",s),this.isConnectedFlag||r(s)}),this.ws.on("close",()=>{clearTimeout(i),this.isConnectedFlag=!1,this.stopHeartbeat(),this.emit("close"),this.reconnectAttempts<this.options.reconnectAttempts&&this.scheduleReconnect()})}catch(o){clearTimeout(i),r(o)}})}async disconnect(){this.isConnectedFlag=!1,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);for(let[e,n]of this.pendingResponses)clearTimeout(n.timeout),n.reject(new Error("Connection closed"));return this.pendingResponses.clear(),new Promise(e=>{this.ws&&this.ws.readyState===q4.OPEN?(this.ws.once("close",()=>e()),this.ws.close()):e()})}isConnected(){return this.isConnectedFlag&&this.ws?.readyState===q4.OPEN}async send(e){if(!this.isConnected())throw new Error("WebSocket is not connected");return new Promise((n,r)=>{try{let i=JSON.stringify(e);this.ws.send(i,o=>{o?r(o):n()})}catch(i){r(i)}})}async sendRequest(e,n=3e4){return e.id||(e.id=this.generateId()),new Promise((r,i)=>{let o=setTimeout(()=>{this.pendingResponses.delete(e.id),i(new Error(`Timeout for message ${e.id}`))},n);this.pendingResponses.set(e.id,{resolve:r,reject:i,timeout:o}),this.send(e).catch(s=>{this.pendingResponses.delete(e.id),clearTimeout(o),i(s)})})}onMessage(e){this.on("message",e)}onError(e){this.on("error",e)}onClose(e){this.on("close",e)}handleMessage(e){if(e.type==="response"&&e.id){let n=this.pendingResponses.get(e.id);if(n){clearTimeout(n.timeout),this.pendingResponses.delete(e.id);let r=e.payload;r.success?n.resolve(r.data):n.reject(new Error(r.error||"Request failed"));return}}if(e.type!=="pong"){if(e.type==="active_file_changed"){this.emit("activeFileChanged",e.payload);return}if(e.type==="selection_changed"){this.emit("selectionChanged",e.payload);return}this.emit("message",e)}}sendConnectMessage(){let e={clientInfo:{version:"0.2.1",platform:process.platform,workingDirectory:process.cwd()}},n={type:"cli_connect",timestamp:Date.now(),payload:e};this.send(n).catch(r=>{console.log("error","Failed to send connect message:",r)})}startHeartbeat(){this.heartbeatInterval=setInterval(()=>{if(this.isConnected()){let e={type:"ping",timestamp:Date.now()};this.send(e).catch(n=>{console.log("error","Failed to send ping:",n)})}},this.options.heartbeatInterval)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}scheduleReconnect(){this.reconnectAttempts++;let e=this.options.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);console.info(`Scheduling reconnect attempt ${this.reconnectAttempts} in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.config&&this.connect(this.config).catch(n=>{console.log("error","Reconnect failed:",n)})},e)}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}});var CZt=b((lji,yZt)=>{var fR=we("constants"),e8r=process.cwd,yhe=null,t8r=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yhe||(yhe=e8r.call(process)),yhe};try{process.cwd()}catch{}typeof process.chdir=="function"&&(nke=process.chdir,process.chdir=function(t){yhe=null,nke.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,nke));var nke;yZt.exports=n8r;function n8r(t){fR.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=r(t.chmod),t.fchmod=r(t.fchmod),t.lchmod=r(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=l(t.statSync),t.fstatSync=l(t.fstatSync),t.lstatSync=l(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,d,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,d,h,m){m&&process.nextTick(m)},t.lchownSync=function(){}),t8r==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function d(h,m,E){var y=Date.now(),C=0;c(h,m,function _(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(m,function(B,R){B&&B.code==="ENOENT"?c(h,m,_):E(w)})},C),C<100&&(C+=10);return}E&&E(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,c),d}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function d(h,m,E,y,C,_){var w;if(_&&typeof _=="function"){var B=0;w=function(R,F,q){if(R&&R.code==="EAGAIN"&&B<10)return B++,c.call(t,h,m,E,y,C,w);_.apply(this,arguments)}}return c.call(t,h,m,E,y,C,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,c),d}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(d,h,m,E,y){for(var C=0;;)try{return c.call(t,d,h,m,E,y)}catch(_){if(_.code==="EAGAIN"&&C<10){C++;continue}throw _}}}(t.readSync);function e(c){c.lchmod=function(d,h,m){c.open(d,fR.O_WRONLY|fR.O_SYMLINK,h,function(E,y){if(E){m&&m(E);return}c.fchmod(y,h,function(C){c.close(y,function(_){m&&m(C||_)})})})},c.lchmodSync=function(d,h){var m=c.openSync(d,fR.O_WRONLY|fR.O_SYMLINK,h),E=!0,y;try{y=c.fchmodSync(m,h),E=!1}finally{if(E)try{c.closeSync(m)}catch{}else c.closeSync(m)}return y}}function n(c){fR.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(d,h,m,E){c.open(d,fR.O_SYMLINK,function(y,C){if(y){E&&E(y);return}c.futimes(C,h,m,function(_){c.close(C,function(w){E&&E(_||w)})})})},c.lutimesSync=function(d,h,m){var E=c.openSync(d,fR.O_SYMLINK),y,C=!0;try{y=c.futimesSync(E,h,m),C=!1}finally{if(C)try{c.closeSync(E)}catch{}else c.closeSync(E)}return y}):c.futimes&&(c.lutimes=function(d,h,m,E){E&&process.nextTick(E)},c.lutimesSync=function(){})}function r(c){return c&&function(d,h,m){return c.call(t,d,h,function(E){u(E)&&(E=null),m&&m.apply(this,arguments)})}}function i(c){return c&&function(d,h){try{return c.call(t,d,h)}catch(m){if(!u(m))throw m}}}function o(c){return c&&function(d,h,m,E){return c.call(t,d,h,m,function(y){u(y)&&(y=null),E&&E.apply(this,arguments)})}}function s(c){return c&&function(d,h,m){try{return c.call(t,d,h,m)}catch(E){if(!u(E))throw E}}}function a(c){return c&&function(d,h,m){typeof h=="function"&&(m=h,h=null);function E(y,C){C&&(C.uid<0&&(C.uid+=4294967296),C.gid<0&&(C.gid+=4294967296)),m&&m.apply(this,arguments)}return h?c.call(t,d,h,E):c.call(t,d,E)}}function l(c){return c&&function(d,h){var m=h?c.call(t,d,h):c.call(t,d);return m&&(m.uid<0&&(m.uid+=4294967296),m.gid<0&&(m.gid+=4294967296)),m}}function u(c){if(!c||c.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var SZt=b((uji,DZt)=>{var vZt=we("stream").Stream;DZt.exports=r8r;function r8r(t){return{ReadStream:e,WriteStream:n};function e(r,i){if(!(this instanceof e))return new e(r,i);vZt.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,l=s.length;a<l;a++){var u=s[a];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(c,d){if(c){o.emit("error",c),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function n(r,i){if(!(this instanceof n))return new n(r,i);vZt.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var l=o[s];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var IZt=b((cji,_Zt)=>{"use strict";_Zt.exports=o8r;var i8r=Object.getPrototypeOf||function(t){return t.__proto__};function o8r(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:i8r(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var wZt=b((dji,oke)=>{var ju=we("fs"),s8r=CZt(),a8r=SZt(),l8r=IZt(),Che=we("util"),dh,Dhe;typeof Symbol=="function"&&typeof Symbol.for=="function"?(dh=Symbol.for("graceful-fs.queue"),Dhe=Symbol.for("graceful-fs.previous")):(dh="___graceful-fs.queue",Dhe="___graceful-fs.previous");function u8r(){}function xZt(t,e){Object.defineProperty(t,dh,{get:function(){return e}})}var ZO=u8r;Che.debuglog?ZO=Che.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ZO=function(){var t=Che.format.apply(Che,arguments);t="GFS4: "+t.split(/\n/).join(`
2087
+ `)}}catch(r){console.error("Error getting agent details:",r),process.exit(1)}}var E4r,y4r,oE,C4r,pm,SKt,_Kt=Le(()=>{"use strict";qn();E4r="\x1B[32m",y4r="\x1B[33m",oE="\x1B[34m",C4r="\x1B[36m",pm="\x1B[0m";SKt={command:"get <name>",describe:"Get details about an agent",builder:t=>t.usage("Usage: iflow agent get <name>").positional("name",{describe:"Name or type of the agent",type:"string",demandOption:!0}),handler:async t=>{await v4r(t.name)}}});async function I4r(t={}){let{page:e=1,size:n=20,search:r}=t,o=qa(process.cwd()).merged.apiKey;o||(console.error("Error: API key not found."),console.error("Please authenticate first by running the auth command."),process.exit(1)),console.log("Loading online agents...");try{let s=await _4r(o,e,n);s.success||(console.error(`Error: ${s.message}`),process.exit(1));let a=s.agents||[];if(r&&(a=a.filter(l=>l.name.toLowerCase().includes(r.toLowerCase())||l.description.toLowerCase().includes(r.toLowerCase())||l.category.toLowerCase().includes(r.toLowerCase()))),a.length===0){let l=r?` matching "${r}"`:"";console.log(`No agents found${l}`);return}console.log(`\\n${S4r}Online Agents${r?` (filtered by "${r}")`:""}:${__}\\n`);for(let l of a)console.log(`${D4r}\u2022 ${l.name}${__} (ID: ${l.id})`),console.log(` ${VQ}Description:${__} ${l.description}`),console.log(` ${VQ}Category:${__} ${l.category}`),console.log(` ${VQ}Model:${__} ${l.modelName}`),l.tags&&console.log(` ${VQ}Tags:${__} ${l.tags}`),console.log(` ${VQ}Author:${__} ${l.authorId}`),console.log(` ${VQ}Version:${__} ${l.version}`),console.log();console.log(`${IKt}Total: ${a.length} agent(s) shown${s.total?` (${s.total} total available)`:""}${__}`),console.log(`${IKt}To install an agent, use: iflow agent add <name-or-id>${__}`)}catch(s){console.error("Error browsing online agents:",s),process.exit(1)}}var D4r,IKt,S4r,VQ,__,_4r,TKt,bKt=Le(()=>{"use strict";Yu();D4r="\x1B[32m",IKt="\x1B[33m",S4r="\x1B[34m",VQ="\x1B[36m",__="\x1B[0m",_4r=async(t,e=1,n=20)=>{try{if(!t)return{success:!1,message:"Please authenticate first by running the auth command"};let i=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${t}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:n})});if(!i.ok){let a="Unable to load agents. Please try again later";return i.status===401?a="Authentication failed. Please check your API key or re-authenticate":i.status===403?a="Access denied. Please check your permissions":i.status===404?a="Agents service not found. Please try again later":i.status>=500&&(a="Server error. Please try again later"),{success:!1,message:a}}let o=await i.json();return o.success?{success:!0,agents:Array.isArray(o.data.data)?o.data.data:[],total:o.data.total||0}:{success:!1,message:o.message||"Failed to load agents from server"}}catch(r){let i="Unable to load agents. Please check your connection and try again";return r instanceof Error&&r.message.includes("Failed to fetch")&&(i="Network error. Please check your internet connection"),{success:!1,message:i}}};TKt={command:"online",describe:"Browse online agent repository",builder:t=>t.usage("Usage: iflow agent online [options]").option("page",{alias:"p",describe:"Page number (default: 1)",type:"number",default:1}).option("size",{alias:"s",describe:"Number of agents per page (default: 20)",type:"number",default:20}).option("search",{describe:"Search term to filter agents",type:"string"}),handler:async t=>{await I4r({page:t.page,size:t.size,search:t.search})}}});var xKt={};h0(xKt,{agentCommand:()=>SQe});var SQe,_Qe=Le(()=>{"use strict";gKt();CKt();DKt();_Kt();bKt();SQe={command:"agent",describe:"Manage agents",builder:t=>t.command(AKt).command(yKt).command(vKt).command(SKt).command(TKt).demandCommand(1,"You need at least one command before continuing.").version(!1),handler:()=>{}}});var lXt=b((TGi,aXt)=>{"use strict";var oFr=we("os"),sXt=we("tty"),y1=L7(),{env:Ap}=process,cR;y1("no-color")||y1("no-colors")||y1("color=false")||y1("color=never")?cR=0:(y1("color")||y1("colors")||y1("color=true")||y1("color=always"))&&(cR=1);"FORCE_COLOR"in Ap&&(Ap.FORCE_COLOR==="true"?cR=1:Ap.FORCE_COLOR==="false"?cR=0:cR=Ap.FORCE_COLOR.length===0?1:Math.min(parseInt(Ap.FORCE_COLOR,10),3));function LQe(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function PQe(t,e){if(cR===0)return 0;if(y1("color=16m")||y1("color=full")||y1("color=truecolor"))return 3;if(y1("color=256"))return 2;if(t&&!e&&cR===void 0)return 0;let n=cR||0;if(Ap.TERM==="dumb")return n;if(process.platform==="win32"){let r=oFr.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ap)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in Ap)||Ap.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in Ap)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ap.TEAMCITY_VERSION)?1:0;if(Ap.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ap){let r=parseInt((Ap.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ap.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ap.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ap.TERM)||"COLORTERM"in Ap?1:n}function sFr(t){let e=PQe(t,t&&t.isTTY);return LQe(e)}aXt.exports={supportsColor:sFr,stdout:LQe(PQe(!0,sXt.isatty(1))),stderr:LQe(PQe(!0,sXt.isatty(2)))}});var dXt=b((bGi,cXt)=>{"use strict";var aFr=lXt(),WQ=L7();function uXt(t){if(/^\d{3,4}$/.test(t)){let n=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(n[1],10),patch:parseInt(n[2],10)}}let e=(t||"").split(".").map(n=>parseInt(n,10));return{major:e[0],minor:e[1],patch:e[2]}}function QQe(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(WQ("no-hyperlink")||WQ("no-hyperlinks")||WQ("hyperlink=false")||WQ("hyperlink=never"))return!1;if(WQ("hyperlink=true")||WQ("hyperlink=always")||"NETLIFY"in e)return!0;if(!aFr.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let n=uXt(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return n.major===3?n.minor>=1:n.major>3;case"WezTerm":return n.major>=20200620;case"vscode":return n.major>1||n.major===1&&n.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let n=uXt(e.VTE_VERSION);return n.major>0||n.minor>=50}return!1}cXt.exports={supportsHyperlink:QQe,stdout:QQe(process.stdout),stderr:QQe(process.stderr)}});var YQe={};h0(YQe,{AuthHandler:()=>$Qe});var $Qe,jQe=Le(()=>{"use strict";$Qe=class{logger;constructor(e={}){this.logger=console}validateToken(e){return e.authToken?e.authToken.length<16?(console.error("Auth token appears to be invalid (too short)"),!1):!0:(console.error("No auth token found in server config"),!1)}buildAuthenticatedUrl(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return`${e.serverUrl.replace(/^http/,"ws")}/ws?token=${encodeURIComponent(e.authToken)}`}buildAuthHeaders(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return{Auttion:`Bearer ${e.authToken}`,"X-Auth-Token":e.authToken}}isTokenExpired(e,n=24*60*60*1e3){let i=Date.now()-e.timestamp;return i>n?(console.warn(`Token is ${Math.floor(i/1e3/60)} minutes old`),!0):!1}}});var zQe={};h0(zQe,{WebSocketClientImpl:()=>WQe});import{EventEmitter as LFr}from"events";var WQe,JQe=Le(()=>{"use strict";V4();Cde();WQe=class extends LFr{ws;config;isConnectedFlag=!1;heartbeatInterval;reconnectTimer;reconnectAttempts=0;pendingResponses=new Map;options;constructor(e={}){super(),this.options={reconnectAttempts:e.reconnectAttempts??3,reconnectDelay:e.reconnectDelay??1e3,heartbeatInterval:e.heartbeatInterval??3e4,connectionTimeout:e.connectionTimeout??5e3,logger:console}}async connect(e){return this.config=e,this.reconnectAttempts=0,new Promise((n,r)=>{let i=setTimeout(()=>{r(new Error("Connection timeout")),this.disconnect()},this.options.connectionTimeout);try{let o=`${e.serverUrl}?token=${e.authToken}`;this.ws=new q4(o),this.ws.on("open",()=>{clearTimeout(i),this.isConnectedFlag=!0,console.debug("WebSocket connected"),this.sendConnectMessage(),this.startHeartbeat(),n()}),this.ws.on("message",s=>{try{let a=JSON.parse(s.toString());this.handleMessage(a)}catch(a){console.log("error","Failed to parse WebSocket message:",a)}}),this.ws.on("error",s=>{clearTimeout(i),console.log("error","WebSocket error:",s),this.emit("error",s),this.isConnectedFlag||r(s)}),this.ws.on("close",()=>{clearTimeout(i),this.isConnectedFlag=!1,this.stopHeartbeat(),this.emit("close"),this.reconnectAttempts<this.options.reconnectAttempts&&this.scheduleReconnect()})}catch(o){clearTimeout(i),r(o)}})}async disconnect(){this.isConnectedFlag=!1,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);for(let[e,n]of this.pendingResponses)clearTimeout(n.timeout),n.reject(new Error("Connection closed"));return this.pendingResponses.clear(),new Promise(e=>{this.ws&&this.ws.readyState===q4.OPEN?(this.ws.once("close",()=>e()),this.ws.close()):e()})}isConnected(){return this.isConnectedFlag&&this.ws?.readyState===q4.OPEN}async send(e){if(!this.isConnected())throw new Error("WebSocket is not connected");return new Promise((n,r)=>{try{let i=JSON.stringify(e);this.ws.send(i,o=>{o?r(o):n()})}catch(i){r(i)}})}async sendRequest(e,n=3e4){return e.id||(e.id=this.generateId()),new Promise((r,i)=>{let o=setTimeout(()=>{this.pendingResponses.delete(e.id),i(new Error(`Timeout for message ${e.id}`))},n);this.pendingResponses.set(e.id,{resolve:r,reject:i,timeout:o}),this.send(e).catch(s=>{this.pendingResponses.delete(e.id),clearTimeout(o),i(s)})})}onMessage(e){this.on("message",e)}onError(e){this.on("error",e)}onClose(e){this.on("close",e)}handleMessage(e){if(e.type==="response"&&e.id){let n=this.pendingResponses.get(e.id);if(n){clearTimeout(n.timeout),this.pendingResponses.delete(e.id);let r=e.payload;r.success?n.resolve(r.data):n.reject(new Error(r.error||"Request failed"));return}}if(e.type!=="pong"){if(e.type==="active_file_changed"){this.emit("activeFileChanged",e.payload);return}if(e.type==="selection_changed"){this.emit("selectionChanged",e.payload);return}this.emit("message",e)}}sendConnectMessage(){let e={clientInfo:{version:"0.2.2",platform:process.platform,workingDirectory:process.cwd()}},n={type:"cli_connect",timestamp:Date.now(),payload:e};this.send(n).catch(r=>{console.log("error","Failed to send connect message:",r)})}startHeartbeat(){this.heartbeatInterval=setInterval(()=>{if(this.isConnected()){let e={type:"ping",timestamp:Date.now()};this.send(e).catch(n=>{console.log("error","Failed to send ping:",n)})}},this.options.heartbeatInterval)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}scheduleReconnect(){this.reconnectAttempts++;let e=this.options.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);console.info(`Scheduling reconnect attempt ${this.reconnectAttempts} in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.config&&this.connect(this.config).catch(n=>{console.log("error","Reconnect failed:",n)})},e)}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}});var CZt=b((lji,yZt)=>{var fR=we("constants"),e8r=process.cwd,yhe=null,t8r=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yhe||(yhe=e8r.call(process)),yhe};try{process.cwd()}catch{}typeof process.chdir=="function"&&(nke=process.chdir,process.chdir=function(t){yhe=null,nke.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,nke));var nke;yZt.exports=n8r;function n8r(t){fR.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=r(t.chmod),t.fchmod=r(t.fchmod),t.lchmod=r(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=l(t.statSync),t.fstatSync=l(t.fstatSync),t.lstatSync=l(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,d,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,d,h,m){m&&process.nextTick(m)},t.lchownSync=function(){}),t8r==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function d(h,m,E){var y=Date.now(),C=0;c(h,m,function _(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(m,function(B,R){B&&B.code==="ENOENT"?c(h,m,_):E(w)})},C),C<100&&(C+=10);return}E&&E(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,c),d}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function d(h,m,E,y,C,_){var w;if(_&&typeof _=="function"){var B=0;w=function(R,F,q){if(R&&R.code==="EAGAIN"&&B<10)return B++,c.call(t,h,m,E,y,C,w);_.apply(this,arguments)}}return c.call(t,h,m,E,y,C,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,c),d}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(d,h,m,E,y){for(var C=0;;)try{return c.call(t,d,h,m,E,y)}catch(_){if(_.code==="EAGAIN"&&C<10){C++;continue}throw _}}}(t.readSync);function e(c){c.lchmod=function(d,h,m){c.open(d,fR.O_WRONLY|fR.O_SYMLINK,h,function(E,y){if(E){m&&m(E);return}c.fchmod(y,h,function(C){c.close(y,function(_){m&&m(C||_)})})})},c.lchmodSync=function(d,h){var m=c.openSync(d,fR.O_WRONLY|fR.O_SYMLINK,h),E=!0,y;try{y=c.fchmodSync(m,h),E=!1}finally{if(E)try{c.closeSync(m)}catch{}else c.closeSync(m)}return y}}function n(c){fR.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(d,h,m,E){c.open(d,fR.O_SYMLINK,function(y,C){if(y){E&&E(y);return}c.futimes(C,h,m,function(_){c.close(C,function(w){E&&E(_||w)})})})},c.lutimesSync=function(d,h,m){var E=c.openSync(d,fR.O_SYMLINK),y,C=!0;try{y=c.futimesSync(E,h,m),C=!1}finally{if(C)try{c.closeSync(E)}catch{}else c.closeSync(E)}return y}):c.futimes&&(c.lutimes=function(d,h,m,E){E&&process.nextTick(E)},c.lutimesSync=function(){})}function r(c){return c&&function(d,h,m){return c.call(t,d,h,function(E){u(E)&&(E=null),m&&m.apply(this,arguments)})}}function i(c){return c&&function(d,h){try{return c.call(t,d,h)}catch(m){if(!u(m))throw m}}}function o(c){return c&&function(d,h,m,E){return c.call(t,d,h,m,function(y){u(y)&&(y=null),E&&E.apply(this,arguments)})}}function s(c){return c&&function(d,h,m){try{return c.call(t,d,h,m)}catch(E){if(!u(E))throw E}}}function a(c){return c&&function(d,h,m){typeof h=="function"&&(m=h,h=null);function E(y,C){C&&(C.uid<0&&(C.uid+=4294967296),C.gid<0&&(C.gid+=4294967296)),m&&m.apply(this,arguments)}return h?c.call(t,d,h,E):c.call(t,d,E)}}function l(c){return c&&function(d,h){var m=h?c.call(t,d,h):c.call(t,d);return m&&(m.uid<0&&(m.uid+=4294967296),m.gid<0&&(m.gid+=4294967296)),m}}function u(c){if(!c||c.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var SZt=b((uji,DZt)=>{var vZt=we("stream").Stream;DZt.exports=r8r;function r8r(t){return{ReadStream:e,WriteStream:n};function e(r,i){if(!(this instanceof e))return new e(r,i);vZt.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,l=s.length;a<l;a++){var u=s[a];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(c,d){if(c){o.emit("error",c),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function n(r,i){if(!(this instanceof n))return new n(r,i);vZt.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var l=o[s];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var IZt=b((cji,_Zt)=>{"use strict";_Zt.exports=o8r;var i8r=Object.getPrototypeOf||function(t){return t.__proto__};function o8r(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:i8r(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var wZt=b((dji,oke)=>{var ju=we("fs"),s8r=CZt(),a8r=SZt(),l8r=IZt(),Che=we("util"),dh,Dhe;typeof Symbol=="function"&&typeof Symbol.for=="function"?(dh=Symbol.for("graceful-fs.queue"),Dhe=Symbol.for("graceful-fs.previous")):(dh="___graceful-fs.queue",Dhe="___graceful-fs.previous");function u8r(){}function xZt(t,e){Object.defineProperty(t,dh,{get:function(){return e}})}var ZO=u8r;Che.debuglog?ZO=Che.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ZO=function(){var t=Che.format.apply(Che,arguments);t="GFS4: "+t.split(/\n/).join(`
2088
2088
  GFS4: `),console.error(t)});ju[dh]||(TZt=global[dh]||[],xZt(ju,TZt),ju.close=function(t){function e(n,r){return t.call(ju,n,function(i){i||bZt(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(e,Dhe,{value:t}),e}(ju.close),ju.closeSync=function(t){function e(n){t.apply(ju,arguments),bZt()}return Object.defineProperty(e,Dhe,{value:t}),e}(ju.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ZO(ju[dh]),we("assert").equal(ju[dh].length,0)}));var TZt;global[dh]||xZt(global,ju[dh]);oke.exports=rke(l8r(ju));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ju.__patched&&(oke.exports=rke(ju),ju.__patched=!0);function rke(t){s8r(t),t.gracefulify=rke,t.createReadStream=F,t.createWriteStream=q;var e=t.readFile;t.readFile=n;function n(L,K,U){return typeof K=="function"&&(U=K,K=null),se(L,K,U);function se(V,O,Y,ee){return e(V,O,function(ne){ne&&(ne.code==="EMFILE"||ne.code==="ENFILE")?nk([se,[V,O,Y],ne,ee||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var r=t.writeFile;t.writeFile=i;function i(L,K,U,se){return typeof U=="function"&&(se=U,U=null),V(L,K,U,se);function V(O,Y,ee,ne,Ae){return r(O,Y,ee,function(Ce){Ce&&(Ce.code==="EMFILE"||Ce.code==="ENFILE")?nk([V,[O,Y,ee,ne],Ce,Ae||Date.now(),Date.now()]):typeof ne=="function"&&ne.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(L,K,U,se){return typeof U=="function"&&(se=U,U=null),V(L,K,U,se);function V(O,Y,ee,ne,Ae){return o(O,Y,ee,function(Ce){Ce&&(Ce.code==="EMFILE"||Ce.code==="ENFILE")?nk([V,[O,Y,ee,ne],Ce,Ae||Date.now(),Date.now()]):typeof ne=="function"&&ne.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=l);function l(L,K,U,se){return typeof U=="function"&&(se=U,U=0),V(L,K,U,se);function V(O,Y,ee,ne,Ae){return a(O,Y,ee,function(Ce){Ce&&(Ce.code==="EMFILE"||Ce.code==="ENFILE")?nk([V,[O,Y,ee,ne],Ce,Ae||Date.now(),Date.now()]):typeof ne=="function"&&ne.apply(this,arguments)})}}var u=t.readdir;t.readdir=d;var c=/^v[0-5]\./;function d(L,K,U){typeof K=="function"&&(U=K,K=null);var se=c.test(process.version)?function(Y,ee,ne,Ae){return u(Y,V(Y,ee,ne,Ae))}:function(Y,ee,ne,Ae){return u(Y,ee,V(Y,ee,ne,Ae))};return se(L,K,U);function V(O,Y,ee,ne){return function(Ae,Ce){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?nk([se,[O,Y,ee],Ae,ne||Date.now(),Date.now()]):(Ce&&Ce.sort&&Ce.sort(),typeof ee=="function"&&ee.call(this,Ae,Ce))}}}if(process.version.substr(0,4)==="v0.8"){var h=a8r(t);_=h.ReadStream,B=h.WriteStream}var m=t.ReadStream;m&&(_.prototype=Object.create(m.prototype),_.prototype.open=w);var E=t.WriteStream;E&&(B.prototype=Object.create(E.prototype),B.prototype.open=R),Object.defineProperty(t,"ReadStream",{get:function(){return _},set:function(L){_=L},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return B},set:function(L){B=L},enumerable:!0,configurable:!0});var y=_;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(L){y=L},enumerable:!0,configurable:!0});var C=B;Object.defineProperty(t,"FileWriteStream",{get:function(){return C},set:function(L){C=L},enumerable:!0,configurable:!0});function _(L,K){return this instanceof _?(m.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}function w(){var L=this;j(L.path,L.flags,L.mode,function(K,U){K?(L.autoClose&&L.destroy(),L.emit("error",K)):(L.fd=U,L.emit("open",U),L.read())})}function B(L,K){return this instanceof B?(E.apply(this,arguments),this):B.apply(Object.create(B.prototype),arguments)}function R(){var L=this;j(L.path,L.flags,L.mode,function(K,U){K?(L.destroy(),L.emit("error",K)):(L.fd=U,L.emit("open",U))})}function F(L,K){return new t.ReadStream(L,K)}function q(L,K){return new t.WriteStream(L,K)}var J=t.open;t.open=j;function j(L,K,U,se){return typeof U=="function"&&(se=U,U=null),V(L,K,U,se);function V(O,Y,ee,ne,Ae){return J(O,Y,ee,function(Ce,De){Ce&&(Ce.code==="EMFILE"||Ce.code==="ENFILE")?nk([V,[O,Y,ee,ne],Ce,Ae||Date.now(),Date.now()]):typeof ne=="function"&&ne.apply(this,arguments)})}}return t}function nk(t){ZO("ENQUEUE",t[0].name,t[1]),ju[dh].push(t),ike()}var vhe;function bZt(){for(var t=Date.now(),e=0;e<ju[dh].length;++e)ju[dh][e].length>2&&(ju[dh][e][3]=t,ju[dh][e][4]=t);ike()}function ike(){if(clearTimeout(vhe),vhe=void 0,ju[dh].length!==0){var t=ju[dh].shift(),e=t[0],n=t[1],r=t[2],i=t[3],o=t[4];if(i===void 0)ZO("RETRY",e.name,n),e.apply(null,n);else if(Date.now()-i>=6e4){ZO("TIMEOUT",e.name,n);var s=n.pop();typeof s=="function"&&s.call(null,r)}else{var a=Date.now()-o,l=Math.max(o-i,1),u=Math.min(l*1.2,100);a>=u?(ZO("RETRY",e.name,n),e.apply(null,n.concat([i]))):ju[dh].push(t)}vhe===void 0&&(vhe=setTimeout(ike,0))}}});var Cke=b((NWi,fen)=>{"use strict";var L8r=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};fen.exports=L8r});var vke=b((OWi,pen)=>{"use strict";var P8r="2.0.0",Q8r=Number.MAX_SAFE_INTEGER||9007199254740991,k8r=16,U8r=250,G8r=["major","premajor","minor","preminor","patch","prepatch","prerelease"];pen.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:k8r,MAX_SAFE_BUILD_LENGTH:U8r,MAX_SAFE_INTEGER:Q8r,RELEASE_TYPES:G8r,SEMVER_SPEC_VERSION:P8r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var men=b((w_,hen)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Dke,MAX_SAFE_BUILD_LENGTH:H8r,MAX_LENGTH:q8r}=vke(),V8r=Cke();w_=hen.exports={};var $8r=w_.re=[],Y8r=w_.safeRe=[],Zn=w_.src=[],j8r=w_.safeSrc=[],er=w_.t={},W8r=0,Ske="[a-zA-Z0-9-]",z8r=[["\\s",1],["\\d",q8r],[Ske,H8r]],J8r=t=>{for(let[e,n]of z8r)t=t.split(`${e}*`).join(`${e}{0,${n}}`).split(`${e}+`).join(`${e}{1,${n}}`);return t},fo=(t,e,n)=>{let r=J8r(e),i=W8r++;V8r(t,i,e),er[t]=i,Zn[i]=e,j8r[i]=r,$8r[i]=new RegExp(e,n?"g":void 0),Y8r[i]=new RegExp(r,n?"g":void 0)};fo("NUMERICIDENTIFIER","0|[1-9]\\d*");fo("NUMERICIDENTIFIERLOOSE","\\d+");fo("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ske}*`);fo("MAINVERSION",`(${Zn[er.NUMERICIDENTIFIER]})\\.(${Zn[er.NUMERICIDENTIFIER]})\\.(${Zn[er.NUMERICIDENTIFIER]})`);fo("MAINVERSIONLOOSE",`(${Zn[er.NUMERICIDENTIFIERLOOSE]})\\.(${Zn[er.NUMERICIDENTIFIERLOOSE]})\\.(${Zn[er.NUMERICIDENTIFIERLOOSE]})`);fo("PRERELEASEIDENTIFIER",`(?:${Zn[er.NONNUMERICIDENTIFIER]}|${Zn[er.NUMERICIDENTIFIER]})`);fo("PRERELEASEIDENTIFIERLOOSE",`(?:${Zn[er.NONNUMERICIDENTIFIER]}|${Zn[er.NUMERICIDENTIFIERLOOSE]})`);fo("PRERELEASE",`(?:-(${Zn[er.PRERELEASEIDENTIFIER]}(?:\\.${Zn[er.PRERELEASEIDENTIFIER]})*))`);fo("PRERELEASELOOSE",`(?:-?(${Zn[er.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Zn[er.PRERELEASEIDENTIFIERLOOSE]})*))`);fo("BUILDIDENTIFIER",`${Ske}+`);fo("BUILD",`(?:\\+(${Zn[er.BUILDIDENTIFIER]}(?:\\.${Zn[er.BUILDIDENTIFIER]})*))`);fo("FULLPLAIN",`v?${Zn[er.MAINVERSION]}${Zn[er.PRERELEASE]}?${Zn[er.BUILD]}?`);fo("FULL",`^${Zn[er.FULLPLAIN]}$`);fo("LOOSEPLAIN",`[v=\\s]*${Zn[er.MAINVERSIONLOOSE]}${Zn[er.PRERELEASELOOSE]}?${Zn[er.BUILD]}?`);fo("LOOSE",`^${Zn[er.LOOSEPLAIN]}$`);fo("GTLT","((?:<|>)?=?)");fo("XRANGEIDENTIFIERLOOSE",`${Zn[er.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);fo("XRANGEIDENTIFIER",`${Zn[er.NUMERICIDENTIFIER]}|x|X|\\*`);fo("XRANGEPLAIN",`[v=\\s]*(${Zn[er.XRANGEIDENTIFIER]})(?:\\.(${Zn[er.XRANGEIDENTIFIER]})(?:\\.(${Zn[er.XRANGEIDENTIFIER]})(?:${Zn[er.PRERELEASE]})?${Zn[er.BUILD]}?)?)?`);fo("XRANGEPLAINLOOSE",`[v=\\s]*(${Zn[er.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Zn[er.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Zn[er.XRANGEIDENTIFIERLOOSE]})(?:${Zn[er.PRERELEASELOOSE]})?${Zn[er.BUILD]}?)?)?`);fo("XRANGE",`^${Zn[er.GTLT]}\\s*${Zn[er.XRANGEPLAIN]}$`);fo("XRANGELOOSE",`^${Zn[er.GTLT]}\\s*${Zn[er.XRANGEPLAINLOOSE]}$`);fo("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Dke}})(?:\\.(\\d{1,${Dke}}))?(?:\\.(\\d{1,${Dke}}))?`);fo("COERCE",`${Zn[er.COERCEPLAIN]}(?:$|[^\\d])`);fo("COERCEFULL",Zn[er.COERCEPLAIN]+`(?:${Zn[er.PRERELEASE]})?(?:${Zn[er.BUILD]})?(?:$|[^\\d])`);fo("COERCERTL",Zn[er.COERCE],!0);fo("COERCERTLFULL",Zn[er.COERCEFULL],!0);fo("LONETILDE","(?:~>?)");fo("TILDETRIM",`(\\s*)${Zn[er.LONETILDE]}\\s+`,!0);w_.tildeTrimReplace="$1~";fo("TILDE",`^${Zn[er.LONETILDE]}${Zn[er.XRANGEPLAIN]}$`);fo("TILDELOOSE",`^${Zn[er.LONETILDE]}${Zn[er.XRANGEPLAINLOOSE]}$`);fo("LONECARET","(?:\\^)");fo("CARETTRIM",`(\\s*)${Zn[er.LONECARET]}\\s+`,!0);w_.caretTrimReplace="$1^";fo("CARET",`^${Zn[er.LONECARET]}${Zn[er.XRANGEPLAIN]}$`);fo("CARETLOOSE",`^${Zn[er.LONECARET]}${Zn[er.XRANGEPLAINLOOSE]}$`);fo("COMPARATORLOOSE",`^${Zn[er.GTLT]}\\s*(${Zn[er.LOOSEPLAIN]})$|^$`);fo("COMPARATOR",`^${Zn[er.GTLT]}\\s*(${Zn[er.FULLPLAIN]})$|^$`);fo("COMPARATORTRIM",`(\\s*)${Zn[er.GTLT]}\\s*(${Zn[er.LOOSEPLAIN]}|${Zn[er.XRANGEPLAIN]})`,!0);w_.comparatorTrimReplace="$1$2$3";fo("HYPHENRANGE",`^\\s*(${Zn[er.XRANGEPLAIN]})\\s+-\\s+(${Zn[er.XRANGEPLAIN]})\\s*$`);fo("HYPHENRANGELOOSE",`^\\s*(${Zn[er.XRANGEPLAINLOOSE]})\\s+-\\s+(${Zn[er.XRANGEPLAINLOOSE]})\\s*$`);fo("STAR","(<|>)?=?\\s*\\*");fo("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");fo("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var gen=b((MWi,Aen)=>{"use strict";var K8r=Object.freeze({loose:!0}),X8r=Object.freeze({}),Z8r=t=>t?typeof t!="object"?K8r:t:X8r;Aen.exports=Z8r});var ven=b((FWi,Cen)=>{"use strict";var Een=/^[0-9]+$/,yen=(t,e)=>{let n=Een.test(t),r=Een.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},eLr=(t,e)=>yen(e,t);Cen.exports={compareIdentifiers:yen,rcompareIdentifiers:eLr}});var Ike=b((LWi,Sen)=>{"use strict";var Rhe=Cke(),{MAX_LENGTH:Den,MAX_SAFE_INTEGER:Bhe}=vke(),{safeRe:Nhe,t:Ohe}=men(),tLr=gen(),{compareIdentifiers:ak}=ven(),_ke=class t{constructor(e,n){if(n=tLr(n),e instanceof t){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Den)throw new TypeError(`version is longer than ${Den} characters`);Rhe("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?Nhe[Ohe.LOOSE]:Nhe[Ohe.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Bhe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Bhe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Bhe||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<Bhe)return o}return i}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Rhe("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),ak(this.major,e.major)||ak(this.minor,e.minor)||ak(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],i=e.prerelease[n];if(Rhe("prerelease compare",n,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return ak(r,i)}while(++n)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let n=0;do{let r=this.build[n],i=e.build[n];if(Rhe("build compare",n,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return ak(r,i)}while(++n)}inc(e,n,r){if(e.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let i=`-${n}`.match(this.options.loose?Nhe[Ohe.PRERELEASELOOSE]:Nhe[Ohe.PRERELEASE]);if(!i||i[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(n){let o=[n,i];r===!1&&(o=[n]),ak(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Sen.exports=_ke});var Ten=b((PWi,Ien)=>{"use strict";var _en=Ike(),nLr=(t,e,n=!1)=>{if(t instanceof _en)return t;try{return new _en(t,e)}catch(r){if(!n)return null;throw r}};Ien.exports=nLr});var wen=b((QWi,xen)=>{"use strict";var ben=Ten(),rLr=(t,e)=>{let n=ben(t,null,!0),r=ben(e,null,!0),i=n.compare(r);if(i===0)return null;let o=i>0,s=o?n:r,a=o?r:n,l=!!s.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let c=l?"pre":"";return n.major!==r.major?c+"major":n.minor!==r.minor?c+"minor":n.patch!==r.patch?c+"patch":"prerelease"};xen.exports=rLr});var Nen=b((kWi,Ben)=>{"use strict";var Ren=Ike(),iLr=(t,e,n)=>new Ren(t,n).compare(new Ren(e,n));Ben.exports=iLr});var Men=b((UWi,Oen)=>{"use strict";var oLr=Nen(),sLr=(t,e,n)=>oLr(t,e,n)>0;Oen.exports=sLr});var Xen=b(nM=>{nM.parse=nM.decode=pLr;nM.stringify=nM.encode=zen;nM.safe=ck;nM.unsafe=Qhe;var Oke=typeof process<"u"&&process.platform==="win32"?`\r
2089
2089
  `:`
2090
2090
  `;function zen(t,e){var n=[],r="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var i=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(o,s,a){var l=t[o];l&&Array.isArray(l)?l.forEach(function(u){r+=ck(o+"[]")+i+ck(u)+`
@@ -2295,7 +2295,7 @@ Logging in with Google... Please restart iFlow CLI to continue.
2295
2295
  `,e-1);return{line:n===-1?0:t.slice(0,n+1).match(/\n/g).length,column:e-n-1}}function hPe(t,e,{oneBased:n=!1}={}){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");let r=dxr(t,e);return n?{line:r.line+1,column:r.column+1}:r}var fxr=t=>`\\u{${t.codePointAt(0).toString(16)}}`,mPe=class t extends Error{name="JSONError";fileName;#e;#t;#n;#r;#o;constructor(e){if(typeof e=="string")super(),this.#n=e;else{let{jsonParseError:n,fileName:r,input:i}=e;super(void 0,{cause:n}),this.#e=i,this.#t=n,this.fileName=r}Error.captureStackTrace?.(this,t)}get message(){this.#n??=`${hxr(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#n}${this.fileName?` in ${this.fileName}`:""}${e?`
2296
2296
 
2297
2297
  ${e}
2298
- `:""}`}set message(e){this.#n=e}#i(e){if(!this.#t)return;let n=this.#e,r=pxr(n,this.#t.message);if(r)return(0,QGt.codeFrameColumns)(n,{start:r},{highlightCode:e})}get codeFrame(){return this.#r??=this.#i(!0),this.#r}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},pxr=(t,e)=>{let n=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!n)return;let{index:r,line:i,column:o}=n.groups;return i&&o?{line:Number(i),column:Number(o)}:hPe(t,Number(r),{oneBased:!0})},hxr=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,n,r)=>`"${r}"(${fxr(r)})`);function APe(t,e,n){typeof e=="string"&&(n=e,e=void 0);try{return JSON.parse(t,e)}catch(r){throw new mPe({jsonParseError:r,fileName:n,input:t})}}var eqt=Qe(XHt(),1);import{fileURLToPath as Pwr}from"node:url";function ZHt(t){return t instanceof URL?Pwr(t):t}var Uwr=t=>kwr.resolve(ZHt(t)??".","package.json"),Gwr=(t,e)=>{let n=typeof t=="string"?APe(t):t;return e&&(0,eqt.default)(n),n};async function tqt({cwd:t,normalize:e=!0}={}){let n=await Qwr.readFile(Uwr(t),"utf8");return Gwr(n,e)}async function nqt(t){let e=await pGt("package.json",t);if(e)return{packageJson:await tqt({...t,cwd:Hwr.dirname(e)}),path:e}}import{fileURLToPath as qwr}from"url";import Vwr from"path";var $wr=qwr(import.meta.url),Ywr=Vwr.dirname($wr),Wde;async function cQ(){if(Wde)return Wde;let t=await nqt({cwd:Ywr});if(t)return Wde=t.packageJson,Wde}async function jw(){let t=await cQ();return"0.2.1"}js();import gO from"node:process";var rqt={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=gO.platform,n="no sandbox";gO.env.SANDBOX&&gO.env.SANDBOX!=="sandbox-exec"?n=gO.env.SANDBOX:gO.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${gO.env.SEATBELT_PROFILE||"unknown"})`);let r=t.services.config?.getModel()||"Unknown",i=await jw(),o=t.services.settings.merged.selectedAuthType||"",s=gO.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:n,modelVersion:r,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};qn();js();var Jde="\x1B[32m";var oqt="\x1B[31m",vv="\x1B[36m",ih="\x1B[90m";var Ls="\x1B[0m";function zde(t,e,n,r=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
2298
+ `:""}`}set message(e){this.#n=e}#i(e){if(!this.#t)return;let n=this.#e,r=pxr(n,this.#t.message);if(r)return(0,QGt.codeFrameColumns)(n,{start:r},{highlightCode:e})}get codeFrame(){return this.#r??=this.#i(!0),this.#r}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},pxr=(t,e)=>{let n=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!n)return;let{index:r,line:i,column:o}=n.groups;return i&&o?{line:Number(i),column:Number(o)}:hPe(t,Number(r),{oneBased:!0})},hxr=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,n,r)=>`"${r}"(${fxr(r)})`);function APe(t,e,n){typeof e=="string"&&(n=e,e=void 0);try{return JSON.parse(t,e)}catch(r){throw new mPe({jsonParseError:r,fileName:n,input:t})}}var eqt=Qe(XHt(),1);import{fileURLToPath as Pwr}from"node:url";function ZHt(t){return t instanceof URL?Pwr(t):t}var Uwr=t=>kwr.resolve(ZHt(t)??".","package.json"),Gwr=(t,e)=>{let n=typeof t=="string"?APe(t):t;return e&&(0,eqt.default)(n),n};async function tqt({cwd:t,normalize:e=!0}={}){let n=await Qwr.readFile(Uwr(t),"utf8");return Gwr(n,e)}async function nqt(t){let e=await pGt("package.json",t);if(e)return{packageJson:await tqt({...t,cwd:Hwr.dirname(e)}),path:e}}import{fileURLToPath as qwr}from"url";import Vwr from"path";var $wr=qwr(import.meta.url),Ywr=Vwr.dirname($wr),Wde;async function cQ(){if(Wde)return Wde;let t=await nqt({cwd:Ywr});if(t)return Wde=t.packageJson,Wde}async function jw(){let t=await cQ();return"0.2.2"}js();import gO from"node:process";var rqt={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=gO.platform,n="no sandbox";gO.env.SANDBOX&&gO.env.SANDBOX!=="sandbox-exec"?n=gO.env.SANDBOX:gO.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${gO.env.SEATBELT_PROFILE||"unknown"})`);let r=t.services.config?.getModel()||"Unknown",i=await jw(),o=t.services.settings.merged.selectedAuthType||"",s=gO.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:n,modelVersion:r,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};qn();js();var Jde="\x1B[32m";var oqt="\x1B[31m",vv="\x1B[36m",ih="\x1B[90m";var Ls="\x1B[0m";function zde(t,e,n,r=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
2299
2299
  ${oqt}No agents found${Ls}
2300
2300
  `;i="\u{1F7E2} ";let o=`${i}${e}
2301
2301
  `;for(let s of t)r?o+=jwr(s):o+=`${Jde}- ${s.agentType}${Ls}
@@ -2338,7 +2338,7 @@ ${ih}Built-in agents (always available)${Ls}
2338
2338
  ${ih}- general-purpose
2339
2339
  ${Ls}`;let l=r.length+i.length;t.ui.addItem({type:"info",text:`${Jde}Agents refreshed successfully. Found ${l} agents.${Ls}
2340
2340
 
2341
- ${Jde}${a.trim()}${Ls}`},Date.now())}catch(e){let n=sn(e);t.ui.addItem({type:"error",text:`${oqt}Error refreshing agents: ${n}${Ls}`},Date.now())}}},{name:"online",description:"Browse and install agents from online repository",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})}]};js();var aqt={name:"auth",description:"change the auth method",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};zF();js();import hT from"node:process";import Wwr from"node:os";var dQ="10edeca6 (local modifications)";qn();var lqt={name:"bug",description:"submit a bug report",kind:"built-in",action:async(t,e)=>{let n=(e||"").trim(),{config:r}=t.services,i=CN(),o=`${hT.platform} ${hT.version}`,s="no sandbox";hT.env.SANDBOX&&hT.env.SANDBOX!=="sandbox-exec"?s=hT.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):hT.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${hT.env.SEATBELT_PROFILE||"unknown"})`);let a=r?.getModel()||"Unknown",l=await jw(),u=K9(hT.memoryUsage().rss),c=i.getInMemoryErrors(),d="No recent errors";c.length>0&&(d=c.slice(-3).map(F=>`Error (${F.timestamp}):
2341
+ ${Jde}${a.trim()}${Ls}`},Date.now())}catch(e){let n=sn(e);t.ui.addItem({type:"error",text:`${oqt}Error refreshing agents: ${n}${Ls}`},Date.now())}}},{name:"online",description:"Browse and install agents from online repository",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})}]};js();var aqt={name:"auth",description:"change the auth method",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};zF();js();import hT from"node:process";import Wwr from"node:os";var dQ="be44a5f8 (local modifications)";qn();var lqt={name:"bug",description:"submit a bug report",kind:"built-in",action:async(t,e)=>{let n=(e||"").trim(),{config:r}=t.services,i=CN(),o=`${hT.platform} ${hT.version}`,s="no sandbox";hT.env.SANDBOX&&hT.env.SANDBOX!=="sandbox-exec"?s=hT.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):hT.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${hT.env.SEATBELT_PROFILE||"unknown"})`);let a=r?.getModel()||"Unknown",l=await jw(),u=K9(hT.memoryUsage().rss),c=i.getInMemoryErrors(),d="No recent errors";c.length>0&&(d=c.slice(-3).map(F=>`Error (${F.timestamp}):
2342
2342
  ${F.error}`).join(`
2343
2343
 
2344
2344
  `));let h=Wwr.userInfo().username,m=R=>{if(!h)return R;let F=new RegExp(`/${h}/`,"g");return R.replace(F,"/user/")},E=`CLI Version: ${l}
@@ -2652,7 +2652,7 @@ def fibonacci(n):
2652
2652
  `,availableTerminalHeight:he,terminalWidth:ee,theme:ae})]})})()]})]}),(0,dp.jsx)(de,{marginTop:1,children:(0,dp.jsxs)(z,{color:ue.Gray,wrap:"truncate",children:["(Use Enter to select",Ie?", Tab to change focus":"",")"]})})]})}var g_=Qe(on(),1);var NQ=Qe(on(),1);var m3r=/^[a-zA-Z0-9!@#$%^&*()\-_=+\[\]{}|\\:;"'<>,.?/~]+$/;function upe(t){return!t||t.trim().length===0?!1:m3r.test(t)}var X0=Qe(wt(),1);function OQ({onSubmit:t,onCancel:e,placeholder:n="Enter your API key...",label:r="API Key:",isFocused:i=!0,validateApiKey:o=!1,validationError:s="Invalid API key format. Only English letters, digits, and special characters are allowed."}){let[a,l]=(0,NQ.useState)(""),[u,c]=(0,NQ.useState)(!0),[d,h]=(0,NQ.useState)(null);(0,NQ.useEffect)(()=>{if(!i)return;let y=setInterval(()=>{c(C=>!C)},500);return()=>clearInterval(y)},[i]),IQ(y=>{if(y.name==="return"||y.name==="enter"){if(a.trim()){let C=a.trim().replace(/^~+|~+$/g,"");if(o&&!upe(C)){h(s);return}h(null),t(C)}return}if(y.name==="escape"){e?.();return}if(y.name==="backspace"||y.name==="delete"){l(C=>C.slice(0,-1));return}if(y.paste&&y.sequence){let C=y.sequence.split("").filter(_=>{let w=_.charCodeAt(0);return w>=32&&w<=126||o&&upe(_)}).join("");C&&l(_=>_+C);return}if(y.sequence&&!y.ctrl&&!y.meta&&y.sequence.length===1){let C=y.sequence;(C.charCodeAt(0)>=32&&C.charCodeAt(0)<=126||o&&upe(C))&&l(_=>_+C)}},{isActive:i});let m="\u2022".repeat(a.length),E=u&&i?"\u2502":"";return(0,X0.jsxs)(de,{flexDirection:"column",children:[(0,X0.jsx)(de,{children:(0,X0.jsxs)(z,{color:ue.Gray,children:[r," "]})}),(0,X0.jsx)(de,{marginTop:1,children:(0,X0.jsx)(de,{borderStyle:"round",borderColor:d?ue.AccentRed:i?ue.AccentBlue:ue.Gray,paddingX:1,width:"100%",children:(0,X0.jsxs)(z,{children:[m||(0,X0.jsx)(z,{color:ue.Gray,children:n}),E]})})}),d&&(0,X0.jsx)(de,{marginTop:1,children:(0,X0.jsx)(z,{color:ue.AccentRed,children:d})}),(0,X0.jsx)(de,{marginTop:1,children:(0,X0.jsx)(z,{color:ue.Gray,dimColor:!0,children:"Press Enter to confirm, Escape to cancel"})})]})}var ZY=Qe(on(),1);var Dv=Qe(wt(),1);function A_({onSubmit:t,onCancel:e,placeholder:n="Enter value...",label:r="Input:",isFocused:i=!0,defaultValue:o="",allowEmpty:s=!1}){let[a,l]=(0,ZY.useState)(o),[u,c]=(0,ZY.useState)(!0);(0,ZY.useEffect)(()=>{if(!i)return;let h=setInterval(()=>{c(m=>!m)},500);return()=>clearInterval(h)},[i]),IQ(h=>{if(h.name==="return"||h.name==="enter"){if(a.trim()||s){let m=a.trim().replace(/^~+|~+$/g,"");t(s&&!m?a:m)}return}if(h.name==="escape"){e?.();return}if(h.name==="backspace"||h.name==="delete"){l(m=>m.slice(0,-1));return}h.sequence&&!h.ctrl&&!h.meta&&l(m=>m+h.sequence)},{isActive:i});let d=u&&i?"\u2502":"";return(0,Dv.jsxs)(de,{flexDirection:"column",children:[(0,Dv.jsx)(de,{children:(0,Dv.jsxs)(z,{color:ue.Gray,children:[r," "]})}),(0,Dv.jsx)(de,{marginTop:1,children:(0,Dv.jsx)(de,{borderStyle:"round",borderColor:i?ue.AccentBlue:ue.Gray,paddingX:1,width:"100%",children:(0,Dv.jsxs)(z,{children:[a||(0,Dv.jsx)(z,{color:ue.Gray,children:n}),d]})})}),(0,Dv.jsx)(de,{marginTop:1,children:(0,Dv.jsx)(z,{color:ue.Gray,dimColor:!0,children:"Press Enter to confirm, Escape to cancel"})})]})}Yu();qn();qn();Yu();var bO=t=>{if(ife(),t===Sn.LOGIN_WITH_GOOGLE||t===Sn.CLOUD_SHELL)return null;if(t===Sn.USE_GEMINI)return process.env.GEMINI_API_KEY?null:"GEMINI_API_KEY environment variable not found. Add that to your environment and try again (no reload needed if using .env)!";if(t===Sn.USE_VERTEX_AI){let e=!!process.env.GOOGLE_CLOUD_PROJECT&&!!process.env.GOOGLE_CLOUD_LOCATION,n=!!process.env.GOOGLE_API_KEY;return!e&&!n?`When using Vertex AI, you must specify either:
2653
2653
  \u2022 GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.
2654
2654
  \u2022 GOOGLE_API_KEY environment variable (if using express mode).
2655
- Update your environment and try again (no reload needed if using .env)!`:null}return[...Vf,Sn.OPENAI_COMPATIBLE].includes(t)?null:"Invalid auth method selected."};var Lr=Qe(wt(),1);function fWt(t){return t&&Object.values(Sn).includes(t)?t:null}function pWt({onSelect:t,settings:e,initialErrorMessage:n}){let[r,i]=(0,g_.useState)("select"),[o,s]=(0,g_.useState)(null),[a,l]=(0,g_.useState)({baseUrl:"",apiKey:""}),[u,c]=(0,g_.useState)("baseUrl"),[d,h]=(0,g_.useState)(""),[m,E]=(0,g_.useState)(""),[y,C]=(0,g_.useState)(""),[_,w]=(0,g_.useState)(""),[B,R]=(0,g_.useState)(()=>{if(n)return n;let Ce=fWt(process.env.GEMINI_DEFAULT_AUTH_TYPE);return null}),F=[{label:"iFlow: Quick setup and free model to use(recommend)",value:Sn.IFLOW},{label:"OpenAI Compatible API",value:Sn.OPENAI_COMPATIBLE}],q=Math.max(0,F.findIndex(Ce=>{if(e.merged.selectedAuthType)return Ce.value===e.merged.selectedAuthType;let De=fWt(process.env.GEMINI_DEFAULT_AUTH_TYPE);return De?Ce.value===De:process.env.GEMINI_API_KEY?Ce.value===Sn.USE_GEMINI:Ce.value===Sn.LOGIN_WITH_GOOGLE})),J=Ce=>{if(Vf.includes(Ce))s(Ce),i("input-api-key"),R(null);else if(Ce===Sn.OPENAI_COMPATIBLE)s(Ce),i("input-openai-config"),c("baseUrl"),l({baseUrl:"",apiKey:""}),R(null);else{let De=bO(Ce);De?R(De):(R(null),t(Ce,"User"))}},j=Ce=>{o&&Vf.includes(o)&&(C(Ce),i("input-model-name"),h(""))},L=Ce=>{if(u==="baseUrl")l(De=>({...De,baseUrl:Ce})),c("apiKey");else if(u==="apiKey")l(De=>({...De,apiKey:Ce})),c("modelName");else if(u==="modelName"){if(l(Ue=>({...Ue,modelName:Ce})),h(Ce),!iS.isMultimodalModel(Ce)){i("input-multimodal-model"),E("");return}i("input-search-api-key"),w("")}},K=()=>{i("select"),s(null),R(null)},U=()=>{u==="modelName"?c("apiKey"):u==="apiKey"?c("baseUrl"):(i("select"),s(null),l({baseUrl:"",apiKey:""}),c("baseUrl"),R(null))},se=Ce=>{if(o&&Vf.includes(o)){if(h(Ce),!iS.isMultimodalModel(Ce)&&o!==Sn.IFLOW){i("input-multimodal-model"),E("");return}if(o===Sn.IFLOW){let Ue={baseUrl:"https://apis.iflow.cn/v1",apiKey:y,modelName:Ce,searchApiKey:y,multimodalModelName:"qwen-vl-max"};t(o,"User",Ue)}else i("input-search-api-key"),w("")}},V=Ce=>{if(o&&Vf.includes(o)){if(h(Ce),!iS.isMultimodalModel(Ce)&&o!==Sn.IFLOW){i("input-multimodal-model"),E("");return}if(o===Sn.IFLOW){let Ue={baseUrl:"https://apis.iflow.cn/v1",apiKey:y,modelName:Ce,searchApiKey:y,multimodalModelName:"qwen-vl-max"};t(o,"User",Ue)}else i("input-search-api-key"),w("")}},O=()=>{o&&Vf.includes(o)?i("input-api-key"):(i("input-openai-config"),c("apiKey"))},Y=Ce=>{let De=Ce.trim();E(De),(o&&Vf.includes(o)||o===Sn.OPENAI_COMPATIBLE)&&(i("input-search-api-key"),w(""))},ee=()=>{o===Sn.OPENAI_COMPATIBLE?(i("input-openai-config"),c("modelName")):i("input-model-name")},ne=Ce=>{if(o&&Vf.includes(o)){let De={...o===Sn.IFLOW&&{baseUrl:"https://apis.iflow.cn/v1"},apiKey:y,modelName:d,searchApiKey:o===Sn.IFLOW?y:Ce,multimodalModelName:m||"qwen-vl-max"};t(o,"User",De)}else if(o===Sn.OPENAI_COMPATIBLE){let De={...a,searchApiKey:Ce,multimodalModelName:m||""};t(o,"User",De)}},Ae=()=>{o===Sn.OPENAI_COMPATIBLE?m!==""?i("input-multimodal-model"):(i("input-openai-config"),c("modelName")):i(m!==""?"input-multimodal-model":"input-model-name")};if(bi((Ce,De)=>{if(De.escape){if(B)return;if(e.merged.selectedAuthType===void 0){R("You must select an auth method to proceed. Press Ctrl+C twice to exit.");return}t(void 0,"User")}}),r==="input-api-key")return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"iFlow Authentication"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter your iFlow API key. See: https://docs.iflow.cn/docs/"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(OQ,{onSubmit:j,onCancel:K,label:"API Key:",placeholder:"Enter your iFlow API key...",isFocused:!0,validateApiKey:!0})})]});if(r==="input-model-name"){if(o===Sn.IFLOW){let Ce=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"},{label:"Qwen-VL-Max(direct multimodal)",value:"qwen-vl-max"}];return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please select the model you want to use."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentBlue,children:"Enter To Use Default selection: Qwen3 Coder"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(Qd,{items:Ce,initialIndex:0,onSelect:V,isFocused:!0})})]})}return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter the model name you want to use."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(A_,{onSubmit:se,onCancel:O,label:"Model Name:",placeholder:"Enter model name (e.g. Qwen3-Coder)",isFocused:!0})})]})}return r==="input-multimodal-model"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Multimodal Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter a multimodal model name for image description generation."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentYellow,children:"Leave empty to disable multimodal support."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(A_,{onSubmit:Y,onCancel:ee,label:"Multimodal Model:",placeholder:"Enter multimodal model name or leave empty",isFocused:!0,allowEmpty:!0})})]}):r==="input-search-api-key"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Search API Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter your Search API key for web search functionality."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(OQ,{onSubmit:ne,onCancel:Ae,label:"Search API Key:",placeholder:"https://docs.iflow.cn/docs/ Enter your iFlow search API key... ",isFocused:!0,validateApiKey:!0})})]}):r==="input-openai-config"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"OpenAI Compatible API Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:u==="baseUrl"?"Please enter the base URL for your OpenAI compatible API.":u==="apiKey"?"Please enter your API key.":"Please enter the model name."})}),(0,Lr.jsx)(de,{marginTop:1,children:u==="baseUrl"?(0,Lr.jsx)(A_,{onSubmit:L,onCancel:U,label:"Base URL:",placeholder:"https://api.openai.com/v1",isFocused:!0}):u==="apiKey"?(0,Lr.jsx)(OQ,{onSubmit:L,onCancel:U,label:"API Key:",placeholder:"Enter your API key...",isFocused:!0,validateApiKey:!0}):(0,Lr.jsx)(A_,{onSubmit:L,onCancel:U,label:"Model Name:",placeholder:"Enter model name (e.g. gpt-4)",isFocused:!0})}),u==="baseUrl"&&a.baseUrl&&(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsxs)(z,{color:ue.Gray,children:["Current: ",a.baseUrl]})})]}):(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Get started"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"How would you like to authenticate for this project?"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(Qd,{items:F,initialIndex:q,onSelect:J,isFocused:!0})}),B&&(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentRed,children:B})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.Gray,children:"(Use Enter to select)"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Terms of Services and Privacy Notice for iFlow CLI"})})]})}var cpe=Qe(on(),1);var xO=Qe(wt(),1);function hWt({onTimeout:t}){let[e,n]=(0,cpe.useState)(!1);return bi((r,i)=>{i.escape&&t()}),(0,cpe.useEffect)(()=>{let r=setTimeout(()=>{n(!0),t()},18e4);return()=>clearTimeout(r)},[t]),(0,xO.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:e?(0,xO.jsx)(z,{color:ue.AccentRed,children:"Authentication timed out. Please try again."}):(0,xO.jsx)(de,{children:(0,xO.jsxs)(z,{children:[(0,xO.jsx)(CQ,{type:"dots"})," Waiting for auth... (Press ESC to cancel)"]})})})}var yc=Qe(wt(),1);function mWt({onContinue:t}){return bi((e,n)=>{(n.return||e===" ")&&t()}),(0,yc.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,yc.jsx)(z,{bold:!0,color:ue.AccentBlue,children:"\u{1F680} Examples & Getting Started"}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{children:"Welcome to iFlow CLI! Check out these examples to get the most out of your experience:"})}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"\u{1F4DA} Examples Repository:"})}),(0,yc.jsx)(de,{marginTop:1,marginLeft:2,children:(0,yc.jsx)(z,{color:ue.AccentBlue,children:"https://platform.iflow.cn/cli/examples/"})}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"\u{1F4A1} Quick Tips:"})}),(0,yc.jsx)(de,{marginTop:1,marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use @ to include file contents in your prompt"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use ! to execute shell commands directly"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use /init to create IFLOW.md for better context"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use /help to see all available commands"})}),(0,yc.jsx)(de,{marginTop:2,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentGreen,children:"Press Enter or Space to continue to chat \u2192"})})]})}var AWt=Qe(on(),1);Yu();qn();var xu=Qe(wt(),1);function gWt({onSelect:t,onCancel:e,settings:n,initialErrorMessage:r}){let i=n.merged.selectedAuthType===Sn.IFLOW?"model-select":"model-input",[o,s]=(0,AWt.useState)(r||null),a=c=>{t(c,"User")},l=c=>{if(!c.trim()){s("Model name cannot be empty");return}t(c.trim(),"User")},u=()=>{e()};if(bi((c,d)=>{d.escape&&e()}),i==="model-select"){let c=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"}];return(0,xu.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,xu.jsx)(z,{bold:!0,children:"Model Selection"}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{children:"Please select the model you want to use with iFlow."})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentBlue,children:"Enter To Use Default selection: Qwen3 Coder"})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(Qd,{items:c,initialIndex:0,onSelect:a,isFocused:!0})}),o&&(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentRed,children:o})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to cancel)"})})]})}return(0,xu.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,xu.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{children:"Please enter the model name you want to use."})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(A_,{onSubmit:l,onCancel:u,label:"Model Name:",placeholder:"Enter model name (e.g. gpt-4o, claude-3-5-sonnet)",isFocused:!0})}),o&&(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentRed,children:o})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.Gray,children:"(Press Enter to confirm, Esc to cancel)"})})]})}var dpe=Qe(on(),1);var fp=Qe(wt(),1);function fpe({serverName:t,values:e,onComplete:n,onCancel:r}){let i=Object.keys(e),[o,s]=(0,dpe.useState)(0),[a,l]=(0,dpe.useState)({}),[u,c]=(0,dpe.useState)(null),d=i[o],h=e[d],m=o===i.length-1,E=_=>{if(h.type==="int"){let B=Number(_);if(isNaN(B)||!Number.isInteger(B)){c("Please enter a valid integer number");return}}c(null);let w={...a,[d]:_};l(w),m?n(w):s(o+1)},y=()=>{o>0?(s(o-1),c(null)):r()},C=()=>{let _=h.default||`Enter ${d.toLowerCase()}...`,w=`${d}:`;switch(h.type){case"password":return(0,fp.jsx)(OQ,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0,validateApiKey:!0});case"int":return(0,fp.jsx)(A_,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0});case"string":default:return(0,fp.jsx)(A_,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0})}};return(0,fp.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,fp.jsxs)(z,{bold:!0,children:["MCP Server Configuration: ",t]}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsxs)(z,{children:["Step ",o+1," of ",i.length,": Configure ",d]})}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.AccentBlue,children:h.description})}),h.type==="int"&&(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.Gray,children:"Expected type: Integer number"})}),(0,fp.jsx)(de,{marginTop:2,children:C()}),u&&(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.AccentRed,children:u})}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.Gray,children:o>0?"Press Escape to go back":"Press Escape to cancel"})})]})}var ppe=Qe(on(),1);qn();var ya=Qe(wt(),1);function EWt({onSelect:t,onCancel:e,requestedModel:n,reason:r,availableModels:i,suggestedModel:o,taskPrompt:s}){let[a,l]=(0,ppe.useState)(null),[u,c]=(0,ppe.useState)("model_selection"),[d,h]=(0,ppe.useState)(""),m=F=>{h(F),c("preference_selection")},E=F=>{t({selectedModel:d,preference:F})},y=()=>{e()},C=()=>{c("model_selection"),h("")};bi((F,q)=>{q.escape&&(u==="preference_selection"?C():e())});let _=i.findIndex(F=>F.value===o),w=_>=0?_:0;if(u==="model_selection")return(0,ya.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,ya.jsx)(z,{bold:!0,color:ue.AccentRed,children:"Model Validation Required"}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.AccentRed,children:["Model '",n,"' is not supported."]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.Gray,children:["Reason: ",r]})}),s&&(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.Gray,children:["Task: ",s.length>100?`${s.substring(0,100)}...`:s]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{children:"Please select a supported model to continue:"})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.AccentBlue,children:["Suggested: ",i.find(F=>F.value===o)?.label||o]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(Qd,{items:i,initialIndex:w,onSelect:m,isFocused:!0})}),a&&(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.AccentRed,children:a})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to cancel)"})})]});let B=[{label:"No, ask me each time",value:iA.OnceOnly},{label:"Yes, remember for this session",value:iA.RememberSession},{label:"Yes, remember always",value:iA.RememberAlways}],R=i.find(F=>F.value===d)?.label||d;return(0,ya.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,ya.jsx)(z,{bold:!0,color:ue.AccentBlue,children:"Model Preference"}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{children:["You selected: ",(0,ya.jsx)(z,{color:ue.AccentGreen,children:R})]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{children:["In the future, when '",n,"' is not supported, would you like to always use '",R,"'?"]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(Qd,{items:B,initialIndex:0,onSelect:E,isFocused:!0})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to go back)"})})]})}var l9e=Qe(on(),1);qn();var hpe={cursor:"Cursor",emacs:"Emacs",neovim:"Neovim",vim:"Vim",vscode:"VS Code",vscodium:"VSCodium",windsurf:"Windsurf",zed:"Zed"},a9e=class{availableEditors;constructor(){let e=Object.keys(hpe).sort();this.availableEditors=[{name:"None",type:"not_set",disabled:!1},...e.map(n=>{let r=EP(n),i=yP(n),o=i?"":" (Not available in sandbox)";return o=r?o:" (Not installed)",{name:hpe[n]+o,type:n,disabled:!r||!i}})]}getAvailableEditorDisplays(){return this.availableEditors}},yWt=new a9e;Yu();qn();var pp=Qe(wt(),1);function CWt({onSelect:t,settings:e,onExit:n}){let[r,i]=(0,l9e.useState)("User"),[o,s]=(0,l9e.useState)("editor");bi((C,_)=>{_.tab&&s(w=>w==="editor"?"scope":"editor"),_.escape&&n()});let a=yWt.getAvailableEditorDisplays(),l=e.forScope(r).settings.preferredEditor,u=l?a.findIndex(C=>C.type===l):0;u===-1&&(console.error(`Editor is not supported: ${l}`),u=0);let c=[{label:"User Settings",value:"User"},{label:"Workspace Settings",value:"Workspace"}],d=C=>{if(C==="not_set"){t(void 0,r);return}t(C,r)},h=C=>{i(C),s("editor")},m="",E=r==="User"?"Workspace":"User";e.forScope(E).settings.preferredEditor!==void 0&&(m=e.forScope(r).settings.preferredEditor!==void 0?`(Also modified in ${E})`:`(Modified in ${E})`);let y="None";return e.merged.preferredEditor&&_q(e.merged.preferredEditor)&&(y=hpe[e.merged.preferredEditor]),(0,pp.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"row",padding:1,width:"100%",children:[(0,pp.jsxs)(de,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,pp.jsxs)(z,{bold:o==="editor",children:[o==="editor"?"> ":" ","Select Editor"," ",(0,pp.jsx)(z,{color:ue.Gray,children:m})]}),(0,pp.jsx)(Qd,{items:a.map(C=>({label:C.name,value:C.type,disabled:C.disabled})),initialIndex:u,onSelect:d,isFocused:o==="editor"},r),(0,pp.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,pp.jsxs)(z,{bold:o==="scope",children:[o==="scope"?"> ":" ","Apply To"]}),(0,pp.jsx)(Qd,{items:c,initialIndex:0,onSelect:h,isFocused:o==="scope"})]}),(0,pp.jsx)(de,{marginTop:1,children:(0,pp.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Tab to change focus)"})})]}),(0,pp.jsxs)(de,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,pp.jsx)(z,{bold:!0,children:"Editor Preference"}),(0,pp.jsxs)(de,{flexDirection:"column",gap:1,marginTop:1,children:[(0,pp.jsx)(z,{color:ue.Gray,children:"These editors are currently supported. Please note that some editors cannot be used in sandbox mode."}),(0,pp.jsxs)(z,{color:ue.Gray,children:["Your preferred editor is:"," ",(0,pp.jsx)(z,{color:y==="None"?ue.AccentRed:ue.AccentCyan,bold:!0,children:y}),"."]})]})]})]})}qn();var Sv=Qe(wt(),1);var vWt=({request:t})=>{let{commands:e,onConfirm:n}=t;bi((o,s)=>{s.escape&&n(Rr.Cancel)});let r=o=>{o===Rr.Cancel?n(o):n(o,e)},i=[{label:"Yes, allow once",value:Rr.ProceedOnce},{label:"Yes, allow always for this session",value:Rr.ProceedAlways},{label:"No (esc)",value:Rr.Cancel}];return(0,Sv.jsxs)(de,{flexDirection:"column",borderStyle:"round",borderColor:ue.AccentYellow,padding:1,width:"100%",marginLeft:1,children:[(0,Sv.jsxs)(de,{flexDirection:"column",marginBottom:1,children:[(0,Sv.jsx)(z,{bold:!0,children:"Shell Command Execution"}),(0,Sv.jsx)(z,{children:"A custom command wants to run the following shell commands:"}),(0,Sv.jsx)(de,{flexDirection:"column",borderStyle:"round",borderColor:ue.Gray,paddingX:1,marginTop:1,children:e.map(o=>(0,Sv.jsx)(z,{color:ue.AccentCyan,children:o},o))})]}),(0,Sv.jsx)(de,{marginBottom:1,children:(0,Sv.jsx)(z,{children:"Do you want to proceed?"})}),(0,Sv.jsx)(Qd,{items:i,onSelect:r,isFocused:!0})]})};var uh=Qe(wt(),1);var DWt=({servers:t,cwd:e,selectedIndex:n,onSelect:r,onCancel:i})=>{let o=[{id:"connect",label:"Connect to the current IDE",action:()=>r()},{id:"disconnect",label:"Disconnect from IDE",action:()=>i}];return(0,uh.jsxs)(de,{flexDirection:"column",paddingX:1,paddingY:1,borderStyle:"round",borderColor:ue.AccentPurple,children:[(0,uh.jsx)(de,{marginBottom:1,children:(0,uh.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"Connect IDE"})}),(0,uh.jsx)(de,{marginBottom:1,children:(0,uh.jsx)(z,{children:"Connect to an IDE for integrated development features."})}),(0,uh.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,uh.jsx)(z,{color:ue.Gray,children:"Select an option (use arrow keys to navigate):"}),o.map((s,a)=>(0,uh.jsx)(de,{marginTop:1,marginLeft:2,children:(0,uh.jsxs)(z,{color:a===n?ue.AccentBlue:ue.Gray,children:[a===n?"\u2192 ":" ",s.label]})},s.id)),(0,uh.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,uh.jsxs)(z,{color:ue.Gray,children:["Found ",t.length||0," other running IDE(s). However, their workspace/project directories do not match the current cwd."]}),t.map(s=>(0,uh.jsx)(de,{marginTop:1,marginLeft:2,children:(0,uh.jsx)(z,{color:ue.Gray,children:s.workspaceFolders&&s.workspaceFolders[0]?`${s.ideType} : ${s.workspaceFolders[0]}`:`${s.ideType} : \u65E0\u5DE5\u4F5C\u533A\u76EE\u5F55`})},s.pid))]}),(0,uh.jsx)(de,{marginTop:1,children:(0,uh.jsx)(z,{color:ue.Gray,children:"Press Esc to cancel"})})]})]})};var SWt=Qe(on(),1);var Z0=Qe(wt(),1);var _Wt=({plan:t,onApprove:e,onKeepPlanning:n,onExit:r})=>{let[i,o]=(0,SWt.useState)(0),s=[{key:"1",label:"Yes, and use yolo mode edits",action:()=>e("yolo")},{key:"2",label:"Yes, and manually approve edits",action:()=>e("default")},{key:"3",label:"No, keep planning",action:n}];return bi((a,l)=>{if(l.escape&&r){r();return}if(l.upArrow)o(u=>u>0?u-1:s.length-1);else if(l.downArrow)o(u=>u<s.length-1?u+1:0);else if(l.return)s[i].action();else if(a>="1"&&a<="3"){let u=parseInt(a)-1;u>=0&&u<s.length&&s[u].action()}}),(0,Z0.jsxs)(de,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:ue.AccentBlue,children:[(0,Z0.jsx)(de,{marginBottom:1,children:(0,Z0.jsx)(z,{color:ue.AccentBlue,bold:!0,children:"Plan Ready for Review"})}),(0,Z0.jsx)(de,{marginBottom:2,flexDirection:"column",children:(0,Z0.jsx)(z,{color:ue.Foreground,children:t})}),(0,Z0.jsx)(de,{marginBottom:1,children:(0,Z0.jsx)(z,{color:ue.AccentBlue,bold:!0,children:"Would you like to proceed?"})}),s.map((a,l)=>(0,Z0.jsx)(de,{marginBottom:l===s.length-1?1:0,children:(0,Z0.jsxs)(z,{color:i===l?ue.AccentBlue:ue.Foreground,children:[i===l?"\u25B6 ":" ",a.key,". ",a.label]})},a.key)),(0,Z0.jsx)(de,{marginTop:1,children:(0,Z0.jsx)(z,{color:ue.Comment,dimColor:!0,children:"Use \u2191\u2193 arrows to navigate, Enter to select, or press 1-3"})})]})};var p1=Qe(on(),1);var zr=Qe(wt(),1);import{readFileSync as A3r,writeFileSync as g3r,existsSync as E3r,mkdirSync as y3r}from"fs";import{homedir as IWt}from"os";import{join as mpe}from"path";function TWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,p1.useState)("loading"),[s,a]=(0,p1.useState)([]),[l,u]=(0,p1.useState)(0),[c,d]=(0,p1.useState)(0),[h,m]=(0,p1.useState)(null),[E,y]=(0,p1.useState)(null),[C,_]=(0,p1.useState)(null),[w,B]=(0,p1.useState)(null),[R,F]=(0,p1.useState)(null),q=10,J=Math.max(1,Math.ceil(s.length/q));(0,p1.useEffect)(()=>{let ne=async()=>{try{let Ce=t.merged.apiKey;if(!Ce)return{success:!1,message:"Please authenticate first by running the auth command"};let De=await fetch("https://apis.iflow.cn/v1/mcp-servers?pageNumber=1&pageSize=100",{method:"GET",headers:{Authorization:`Bearer ${Ce}`,"User-Agent":"iFlow-Cli"}});if(!De.ok){let qe="Unable to load MCP servers. Please try again later";return De.status===401?qe="Authentication failed. Please check your API key or re-authenticate":De.status===403?qe="Access denied. Please check your permissions":De.status===404?qe="MCP servers service not found. Please try again later":De.status>=500&&(qe="Server error. Please try again later"),{success:!1,message:qe}}return{success:!0,data:(await De.json()).result||[]}}catch(Ce){let De="Unable to load MCP servers. Please check your connection and try again";return Ce instanceof Error&&Ce.message.includes("Failed to fetch")&&(De="Network error. Please check your internet connection"),{success:!1,message:De}}};(async()=>{let Ce=await ne();Ce.success&&Ce.data?(a(Ce.data),o("list"),Ce.data.length===0&&y("No MCP servers found in the online repository.")):(y(Ce.message||"Failed to load servers"),o("list"))})()},[]);let j=ne=>{let Ae=Object.keys(ne);if(Ae.length===0)return null;let Ce=Ae[0],De=ne[Ce];return De.values?De.values:null},L=ne=>ne?Object.values(ne).some(Ae=>typeof Ae=="string"&&Ae.includes("${")&&Ae.includes("}")):!1,K=(ne,Ae)=>{let Ce=JSON.parse(JSON.stringify(ne));if(Ce.env){for(let[De,Ue]of Object.entries(Ce.env))if(typeof Ue=="string"){let qe=Ue;for(let[Ie,xe]of Object.entries(Ae)){let Oe=`\${${Ie}}`;qe=qe.replace(new RegExp(Oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),xe)}Ce.env[De]=qe}}return Ce},U=async(ne,Ae,Ce)=>{try{let De=Ae==="user"?mpe(IWt(),".iflow","settings.json"):mpe(process.cwd(),".iflow","settings.json"),Ue=Ae==="user"?mpe(IWt(),".iflow"):mpe(process.cwd(),".iflow");E3r(Ue)||y3r(Ue,{recursive:!0});let qe={};try{let ye=A3r(De,"utf8");qe=JSON.parse(ye)}catch{}qe.mcpServers||(qe.mcpServers={});let Ie=Object.keys(ne.serverConfig)[0],xe=Object.values(ne.serverConfig)[0];Ce&&(xe=K(xe,Ce));let{values:Oe,...le}=xe;qe.mcpServers[Ie]={description:ne.description,...le},g3r(De,JSON.stringify(qe,null,2));let re="";try{r?.(`Loading MCP server '${ne.name}' and discovering tools...`);let{MCPServerConfig:ye}=await Promise.resolve().then(()=>(qn(),i_)),X=new ye(xe.command,xe.args,xe.env,xe.cwd,xe.url,xe.httpUrl,xe.headers,xe.tcp,xe.timeout,xe.trust,ne.description,xe.includeTools,xe.excludeTools,void 0,xe.oauth,xe.authProviderType);typeof e.addMcpServer=="function"?e.addMcpServer(Ie,X):console.warn("Config.addMcpServer method not available, skipping dynamic loading");let he=await e.getToolRegistry();if(he){await he.discoverToolsForServer(Ie);let ae=e.getGeminiClient();ae&&await ae.setTools();let me=he.getToolsByServer(Ie);re=` - ${me.length} tools loaded and ready to use`,r?.(`\u2705 MCP server '${ne.name}' loaded successfully with ${me.length} tools`)}}catch(ye){console.warn("Failed to auto-discover tools from newly installed server:",ye),r?.(`\u26A0\uFE0F MCP server '${ne.name}' installed but failed to load tools: ${ye}`)}return{success:!0,message:`Successfully installed ${ne.name} for ${Ae} (${De})${re}`}}catch(De){return{success:!1,message:`Failed to install ${ne.name}: ${De}`}}},se=async(ne,Ae)=>{let Ce=j(ne.serverConfig),De=Object.keys(ne.serverConfig),Ue=De.length>0?ne.serverConfig[De[0]]:{};if(Ce&&Object.keys(Ce).length>0&&L(Ue.env))m(ne),B(Ae),F(Ce),o("value-input");else try{r?.(`Installing ${ne.name}...`);let qe=await U(ne,Ae);qe.success?(_(qe.message),y(null),r?.(qe.message)):(y(qe.message),_(null),r?.(`\u274C ${qe.message}`))}catch(qe){let Ie=qe instanceof Error?qe.message:"Installation failed";y(Ie),_(null),r?.(`\u274C ${Ie}`)}},V=async ne=>{if(!(!h||!w))try{r?.(`Installing ${h.name} with configuration...`);let Ae=await U(h,w,ne);Ae.success?(_(Ae.message),y(null),r?.(Ae.message),o("detail"),F(null),B(null)):(y(Ae.message),_(null),r?.(`\u274C ${Ae.message}`),o("detail"),F(null),B(null))}catch(Ae){let Ce=Ae instanceof Error?Ae.message:"Installation failed";y(Ce),_(null),r?.(`\u274C ${Ce}`),o("detail"),F(null),B(null)}},O=()=>{o("detail"),F(null),B(null)};bi((ne,Ae)=>{if(i!=="value-input"){if(Ae.escape){i==="detail"?(o("list"),m(null),y(null),_(null)):n();return}if(i==="list"){if(s.length===0){ne==="q"&&n();return}if(Ae.upArrow||ne==="k"){let Ce=Math.max(c-1,0);d(Ce);let De=Math.floor(Ce/q);u(De)}else if(Ae.downArrow||ne==="j"){let Ce=Math.min(c+1,s.length-1);d(Ce);let De=Math.floor(Ce/q);u(De)}else if(Ae.leftArrow||ne==="h"){if(J>1){let Ce=Math.max(l-1,0);u(Ce),d(Math.min(Ce*q,s.length-1))}}else if(Ae.rightArrow||ne==="l"){if(J>1){let Ce=Math.min(l+1,J-1);u(Ce),d(Math.min(Ce*q,s.length-1))}}else Ae.return||ne===""?c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null),_(null)):ne==="q"&&n()}else i==="detail"&&h&&(ne==="1"?se(h,"project"):ne==="2"?se(h,"user"):ne==="b"?(o("list"),m(null),y(null),_(null)):ne==="q"&&n())}});let Y=()=>{if(s.length===0)return(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsx)(z,{bold:!0,children:"Available MCP Servers"}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentRed,children:E||"No servers available"})})]});let ne=Math.min(l*q,s.length),Ae=Math.min(ne+q,s.length),Ce=s.slice(ne,Ae);return(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsxs)(z,{bold:!0,children:["Available MCP Servers (",s.length," total)"]}),(0,zr.jsx)(de,{marginTop:1,flexDirection:"column",children:Ce.map((De,Ue)=>{let Ie=ne+Ue===c;return(0,zr.jsxs)(de,{marginBottom:1,children:[(0,zr.jsxs)(z,{color:Ie?ue.AccentCyan:void 0,children:[Ie?"\u25B6 ":" ",Ue+1,". ",De.name]}),(0,zr.jsx)(de,{marginLeft:4,children:(0,zr.jsx)(z,{color:ue.Gray,children:De.description})}),(0,zr.jsx)(de,{marginLeft:4,children:(0,zr.jsxs)(z,{color:ue.Gray,children:["Tools: ",De.tools?.length||0," | Visits: ",De.visitCount||0]})})]},De.id)})}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",J]})}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 Enter - View details"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]})},ee=()=>h?(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsx)(z,{bold:!0,children:h.name}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentBlue,children:h.description})}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.AccentCyan,children:"Details:"}),(0,zr.jsxs)(z,{children:[" \u2022 Version: ",h.versionType]}),(0,zr.jsxs)(z,{children:[" \u2022 Protocol: ",h.protocolVersion]}),(0,zr.jsxs)(z,{children:[" \u2022 Transports: ",h.transports?.join(", ")||"N/A"]}),(0,zr.jsxs)(z,{children:[" \u2022 Auth Types: ",h.authTypes?.join(", ")||"N/A"]}),(0,zr.jsxs)(z,{children:[" \u2022 Visits: ",h.visitCount||0]})]}),h.tools&&h.tools.length>0&&(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsxs)(z,{color:ue.AccentCyan,children:["Available Tools (",h.tools.length,"):"]}),h.tools.map((ne,Ae)=>(0,zr.jsxs)(de,{marginLeft:2,children:[(0,zr.jsxs)(z,{children:[Ae+1,". ",ne.name]}),(0,zr.jsx)(de,{marginLeft:2,children:(0,zr.jsx)(z,{color:ue.Gray,children:ne.description})})]},Ae))]}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 1 - Install for project"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 2 - Install for user"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),C&&(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsxs)(z,{color:ue.AccentGreen,children:["\u2705 ",C]})}),E&&(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentRed,children:E})})]}):null;return i==="loading"?(0,zr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,zr.jsx)(z,{bold:!0,children:"Loading MCP Servers..."}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{children:"Please wait while we fetch available servers..."})})]}):i==="value-input"&&h&&R?(0,zr.jsx)(fpe,{serverName:h.name,values:R,onComplete:V,onCancel:O}):(0,zr.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?Y():ee()})}var E_=Qe(on(),1);zF();qn();var yn=Qe(wt(),1);import{readFileSync as bWt,writeFileSync as C3r}from"fs";import{homedir as v3r}from"os";import{join as xWt}from"path";function wWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,E_.useState)("loading"),[s,a]=(0,E_.useState)([]),[l,u]=(0,E_.useState)(0),[c,d]=(0,E_.useState)(0),[h,m]=(0,E_.useState)(null),[E,y]=(0,E_.useState)(null),[C,_]=(0,E_.useState)(null),w=10,B=Math.max(1,Math.ceil(s.length/w));(0,E_.useEffect)(()=>{(async()=>{try{let K=e.getMcpServers()||{},U=Object.keys(K);if(U.length===0){a([]),o("list");return}let se=await e.getToolRegistry(),V=await e.getPromptRegistry(),O=[];for(let Y of U){let ee=K[Y],ne=uL(Y),Ce=(se?.getAllTools()||[]).filter(Ie=>Ie instanceof qp&&Ie.serverName===Y),De=V?.getPromptsByServer(Y)||[],Ue=lL.get(Y)||!1,qe="";if(ee.oauth?.enabled)try{let{MCPOAuthTokenStorage:Ie}=await Promise.resolve().then(()=>(qn(),i_)),xe=await Ie.getToken(Y);xe?qe=Ie.isTokenExpired(xe.token)?"expired":"authenticated":qe="not authenticated"}catch{qe="unknown"}O.push({name:Y,config:ee,status:ne,tools:Ce,prompts:De,needsAuth:Ue,oauthStatus:qe})}a(O),o("list"),d(0),u(0)}catch(K){y(K instanceof Error?K.message:"Failed to load servers"),o("list"),d(0),u(0)}})()},[e]);let R=async L=>{try{let K="project",U=xWt(process.cwd(),".iflow","settings.json"),se=xWt(v3r(),".iflow","settings.json");try{let ee=bWt(se,"utf8"),ne=JSON.parse(ee);ne.mcpServers&&ne.mcpServers[L.name]&&(K="user",U=se)}catch{}let V=bWt(U,"utf8"),O=JSON.parse(V);if(!O.mcpServers||!O.mcpServers[L.name])return{success:!1,message:`Server "${L.name}" not found in ${K} settings.`};delete O.mcpServers[L.name],C3r(U,JSON.stringify(O,null,2)),typeof e.removeMcpServer=="function"&&e.removeMcpServer(L.name);let Y=await e.getToolRegistry();if(Y){await Y.discoverMcpTools();let ee=e.getGeminiClient();ee&&await ee.setTools()}return{success:!0,message:`Successfully removed "${L.name}" from ${K} settings.`}}catch(K){return{success:!1,message:`Failed to remove "${L.name}": ${K}`}}},F=async()=>{if(C)try{r?.(`Removing server "${C.name}"...`);let L=await R(C);if(L.success){r?.(L.message);let K=s.filter(U=>U.name!==C.name);a(K),d(Math.max(0,Math.min(c,K.length-1))),_(null),o("list")}else y(L.message),r?.(`\u274C ${L.message}`),_(null),o("list")}catch(L){let K=L instanceof Error?L.message:"Removal failed";y(K),r?.(`\u274C ${K}`),_(null),o("list")}};bi((L,K)=>{if(K.escape){i==="detail"?(o("list"),m(null),y(null)):i==="confirm-remove"?(o("list"),_(null)):n();return}if(i==="list"){if(s.length===0){if(L==="q")n();else if(L==="o"){let U="https://platform.iflow.cn/mcp";r?.(`Opening MCP platform in your browser: ${U}`),GD(U).catch(se=>{y(`Failed to open MCP platform: ${se.message}`)})}return}if(K.upArrow||L==="k"){let U=Math.max(c-1,0);d(U);let se=Math.floor(U/w);u(se)}else if(K.downArrow||L==="j"){let U=Math.min(c+1,s.length-1);d(U);let se=Math.floor(U/w);u(se)}else if(K.leftArrow||L==="h"){if(B>1){let U=Math.max(l-1,0);u(U),d(Math.min(U*w,s.length-1))}}else if(K.rightArrow||L==="l"){if(B>1){let U=Math.min(l+1,B-1);u(U),d(Math.min(U*w,s.length-1))}}else L===" "||K.return?c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null)):L==="d"||K.delete?c>=0&&c<s.length&&(_(s[c]),o("confirm-remove")):L==="q"&&n()}else i==="detail"&&h?L==="d"||K.delete?(_(h),o("confirm-remove")):L==="b"?(o("list"),m(null),y(null)):L==="q"&&n():i==="confirm-remove"&&(L==="y"||L==="Y"?F():(L==="n"||L==="N")&&(o(h?"detail":"list"),_(null)))});let q=()=>{if(s.length===0)return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,children:"Configured MCP Servers"}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentYellow,children:E||"No MCP servers configured. Use /mcp online to browse and install servers."})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 o - Open MCP platform"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]});let L=Math.min(l*w,s.length),K=Math.min(L+w,s.length),U=s.slice(L,K);return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsxs)(z,{bold:!0,children:["Configured MCP Servers (",s.length," total)"]}),(0,yn.jsx)(de,{marginTop:1,flexDirection:"column",children:U.map((se,V)=>{let Y=L+V===c,ee="",ne="";switch(se.status){case xa.CONNECTED:ee="\u{1F7E2}",ne="Ready";break;case xa.CONNECTING:ee="\u{1F504}",ne="Starting...";break;case xa.DISCONNECTED:default:ee="\u{1F534}",ne="Disconnected";break}return(0,yn.jsxs)(de,{marginBottom:1,children:[(0,yn.jsxs)(z,{color:Y?ue.AccentCyan:void 0,children:[Y?"\u25B6 ":" ",ee," ",se.name," - ",ne]}),(0,yn.jsx)(de,{marginLeft:4,children:(0,yn.jsx)(z,{color:ue.Gray,children:se.config.description||"No description"})}),(0,yn.jsx)(de,{marginLeft:4,children:(0,yn.jsxs)(z,{color:ue.Gray,children:["Tools: ",se.tools.length," | Prompts: ",se.prompts.length,se.config.extensionName&&` | From: ${se.config.extensionName}`]})})]},se.name)})}),B>1&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",B]})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Space/Enter - View server details"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 d/Delete - Remove server"}),B>1&&(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),E&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentRed,children:E})})]})},J=()=>{if(!h)return null;let L=h;return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,children:L.name}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentBlue,children:L.config.description||"No description available"})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentCyan,children:"Server Details:"}),(0,yn.jsxs)(z,{children:[" \u2022 Status: ",L.status===xa.CONNECTED?"\u{1F7E2} Connected":L.status===xa.CONNECTING?"\u{1F504} Connecting":"\u{1F534} Disconnected"]}),L.config.command&&(0,yn.jsxs)(z,{children:[" \u2022 Command: ",L.config.command," ",L.config.args?.join(" ")||""]}),L.config.httpUrl&&(0,yn.jsxs)(z,{children:[" \u2022 HTTP URL: ",L.config.httpUrl]}),L.config.url&&(0,yn.jsxs)(z,{children:[" \u2022 SSE URL: ",L.config.url]}),L.config.extensionName&&(0,yn.jsxs)(z,{children:[" \u2022 Source: ",L.config.extensionName," extension"]}),L.config.oauth?.enabled&&(0,yn.jsxs)(z,{children:[" \u2022 OAuth: ",L.oauthStatus==="authenticated"?"\u{1F7E2} Authenticated":L.oauthStatus==="expired"?"\u{1F7E1} Token Expired":"\u{1F534} Not Authenticated"]})]}),L.tools.length>0&&(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsxs)(z,{color:ue.AccentCyan,children:["Available Tools (",L.tools.length,"):"]}),L.tools.slice(0,10).map((K,U)=>(0,yn.jsxs)(de,{marginLeft:2,children:[(0,yn.jsxs)(z,{children:[U+1,". ",K.name]}),K.description&&(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:K.description})})]},U)),L.tools.length>10&&(0,yn.jsxs)(z,{color:ue.Gray,children:[" ... and ",L.tools.length-10," more tools"]})]}),L.prompts.length>0&&(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsxs)(z,{color:ue.AccentCyan,children:["Available Prompts (",L.prompts.length,"):"]}),L.prompts.slice(0,5).map((K,U)=>(0,yn.jsxs)(de,{marginLeft:2,children:[(0,yn.jsxs)(z,{children:[U+1,". ",K.name]}),K.description&&(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:K.description})})]},U)),L.prompts.length>5&&(0,yn.jsxs)(z,{color:ue.Gray,children:[" ... and ",L.prompts.length-5," more prompts"]})]}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 d/Delete - Remove this server"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Esc - Back to list"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),E&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentRed,children:E})})]})},j=()=>C?(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,color:ue.AccentRed,children:"Confirm Server Removal"}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{children:"Are you sure you want to remove the following MCP server?"})}),(0,yn.jsxs)(de,{marginTop:1,marginLeft:2,children:[(0,yn.jsx)(z,{bold:!0,children:C.name}),(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:C.config.description||"No description"})}),(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsxs)(z,{color:ue.Gray,children:["Tools: ",C.tools.length," | Prompts: ",C.prompts.length]})})]}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentYellow,children:"This will remove the server from your configuration and stop all its tools."})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentCyan,children:"Actions:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 y/Y - Yes, remove server"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 n/N - No, cancel"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Esc - Cancel"})]})]}):null;return i==="loading"?(0,yn.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,yn.jsx)(z,{bold:!0,children:"Loading MCP Servers..."}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{children:"Please wait while we load your configured servers..."})})]}):(0,yn.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?q():i==="detail"?J():j()})}var y_=Qe(on(),1);var Tr=Qe(wt(),1);function RWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,y_.useState)("loading"),[s,a]=(0,y_.useState)([]),[l,u]=(0,y_.useState)(0),[c,d]=(0,y_.useState)(0),[h,m]=(0,y_.useState)(null),[E,y]=(0,y_.useState)(null),[C,_]=(0,y_.useState)(null),w=10,B=Math.ceil(s.length/w);(0,y_.useEffect)(()=>{let j=async()=>{try{let K=t.merged.apiKey;if(!K)return{success:!1,message:"Please authenticate first by running the auth command"};let U=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${K}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:1,size:100,usePage:!0})});if(!U.ok){let V="Unable to load agents. Please try again later";return U.status===401?V="Authentication failed. Please check your API key or re-authenticate":U.status===403?V="Access denied. Please check your permissions":U.status===404?V="Agents service not found. Please try again later":U.status>=500&&(V="Server error. Please try again later"),{success:!1,message:V}}let se=await U.json();return se.success?{success:!0,data:se.data?.data||[]}:{success:!1,message:se.message||"Failed to load agents from server"}}catch(K){let U="Unable to load agents. Please check your connection and try again";return K instanceof Error&&K.message.includes("Failed to fetch")&&(U="Network error. Please check your internet connection"),{success:!1,message:U}}};(async()=>{let K=await j();K.success&&K.data?(a(K.data),o("list"),K.data.length===0&&y("No agents found in the online repository.")):(y(K.message||"Failed to load agents"),o("list"))})()},[]);let R=async(j,L)=>{try{let{AgentRegistry:K}=await Promise.resolve().then(()=>(qn(),i_)),U=new K,se=[];try{let ee=JSON.parse(j.tools||"[]");se=Array.isArray(ee)?ee:["*"]}catch{se=["*"]}let V;if(j.mcps)try{let ee=JSON.parse(j.mcps);Array.isArray(ee)&&ee.length>0&&(V=ee)}catch{let ee=j.mcps.split(",").map(ne=>ne.trim()).filter(ne=>ne.length>0);ee.length>0&&(V=ee)}let O={agentName:j.name,agentType:j.name,description:j.description,whenToUse:j.description,allowedTools:se,allowedMcps:V,systemPrompt:j.detailContext||j.description,location:L==="user"?"global":"project",model:j.modelName,isInheritTools:!0,isInheritMcps:!0};return await U.createAgent(O)?{success:!0,message:`Successfully installed agent '${j.name}' for ${L}`}:{success:!1,message:`Failed to create agent for '${j.name}'`}}catch(K){return{success:!1,message:`Failed to install ${j.name}: ${K}`}}},F=async(j,L)=>{try{r?.(`Installing ${j.name}...`);let K=await R(j,L);K.success?(_(K.message),y(null),r?.(K.message)):(y(K.message),_(null),r?.(`\u274C ${K.message}`))}catch(K){let U=K instanceof Error?K.message:"Installation failed";y(U),_(null),r?.(`\u274C ${U}`)}};bi((j,L)=>{if(L.escape){i==="detail"?(o("list"),m(null),y(null),_(null)):n();return}if(i==="list")if(L.upArrow||j==="k"){let K=Math.max(c-1,0);d(K);let U=Math.floor(K/w);u(U)}else if(L.downArrow||j==="j"){let K=Math.min(c+1,s.length-1);d(K);let U=Math.floor(K/w);u(U)}else if(L.leftArrow||j==="h"){let K=Math.max(l-1,0);u(K),d(K*w)}else if(L.rightArrow||j==="l"){let K=Math.min(l+1,B-1);u(K),d(Math.min(K*w,s.length-1))}else L.return||j===""?s.length>0&&c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null),_(null)):j==="q"&&n();else i==="detail"&&h&&(j==="1"?F(h,"project"):j==="2"?F(h,"user"):j==="b"?(o("list"),m(null),y(null),_(null)):j==="q"&&n())});let q=()=>{if(s.length===0)return(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsx)(z,{bold:!0,children:"Available Agents"}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentRed,children:E||"No agents available"})})]});let j=l*w,L=Math.min(j+w,s.length),K=s.slice(j,L);return(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsxs)(z,{bold:!0,children:["Available Agents (",s.length," total)"]}),(0,Tr.jsx)(de,{marginTop:1,flexDirection:"column",children:K.map((U,se)=>{let O=j+se===c;return(0,Tr.jsxs)(de,{marginBottom:1,flexDirection:"row",children:[(0,Tr.jsxs)(de,{width:30,flexShrink:0,flexDirection:"column",children:[(0,Tr.jsxs)(z,{color:O?ue.AccentCyan:void 0,children:[O?"\u25B6 ":" ",se+1,". ",U.name]}),(0,Tr.jsx)(de,{marginLeft:4,flexDirection:"column",children:(0,Tr.jsxs)(z,{color:ue.Gray,children:["Category:",U.category]})})]}),(0,Tr.jsx)(de,{marginLeft:3,flexGrow:1,children:(0,Tr.jsx)(z,{color:ue.Gray,children:U.description})})]},U.id)})}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",B]})}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 Enter - View details"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]})},J=()=>h?(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsx)(z,{bold:!0,children:h.name}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentBlue,children:h.description})}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"Details:"}),(0,Tr.jsxs)(z,{children:[" \u2022 Model: ",h.modelName]}),(0,Tr.jsxs)(z,{children:[" \u2022 Category: ",h.category]}),(0,Tr.jsxs)(z,{children:[" \u2022 Version: ",h.version]})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"Tools:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:(()=>{if(!h.tools)return"All tools available (inherit)";try{let j=JSON.parse(h.tools);return Array.isArray(j)?j.length>0?j.join(", ")+" (inherit)":"All tools available (inherit)":(h.tools||"All tools available")+" (inherit)"}catch{return(h.tools||"All tools available")+" (inherit)"}})()})})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"MCP Servers:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:(()=>{if(!h.mcps||h.mcps.trim()==="")return"All MCP servers available (inherit)";try{let j=JSON.parse(h.mcps);return Array.isArray(j)?j.length>0?j.join(", ")+" (inherit)":"All MCP servers available (inherit)":(h.mcps||"All MCP servers available")+" (inherit)"}catch{return(h.mcps||"All MCP servers available")+" (inherit)"}})()})})]}),h.detailContext&&(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"System Prompt:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:h.detailContext.length>800?`${h.detailContext.substring(0,800)}...`:h.detailContext})})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 1 - Install for project"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 2 - Install for user"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),C&&(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsxs)(z,{color:ue.AccentGreen,children:["\u2705 ",C]})}),E&&(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentRed,children:E})})]}):null;return i==="loading"?(0,Tr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Tr.jsx)(z,{bold:!0,children:"Loading Agents..."}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{children:"Please wait while we fetch available agents..."})})]}):(0,Tr.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?q():J()})}var _v=Qe(on(),1);var jr=Qe(wt(),1);import u9e from"fs/promises";import c9e from"path";import D3r from"os";function BWt({config:t,onExit:e,onStatusUpdate:n}){let[r,i]=(0,_v.useState)("loading"),[o,s]=(0,_v.useState)([]),[a,l]=(0,_v.useState)(1),[u,c]=(0,_v.useState)(0),[d,h]=(0,_v.useState)(null),[m,E]=(0,_v.useState)(null),[y,C]=(0,_v.useState)(null),[_,w]=(0,_v.useState)(0),B=10,R=Math.ceil(_/B);(0,_v.useEffect)(()=>{let U=async V=>{try{let O=t?.getContentGeneratorConfig()?.apiKey;if(!O)throw new Error("API key not found. Please authenticate first.");let Y=new URL("https://apis.iflow.cn/v1/commands/list"),ee=await fetch(Y.toString(),{method:"POST",headers:{Authorization:`Bearer ${O}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:V,size:B})});if(!ee.ok){let De="Unable to load commands. Please try again later";throw ee.status===401?De="Authentication failed. Please check your API key or re-authenticate":ee.status===403?De="Access denied. Please check your permissions":ee.status===404?De="Commands service not found. Please try again later":ee.status>=500&&(De="Server error. Please try again later"),new Error(De)}let ne=await ee.json();if(!ne.success)throw new Error(ne.message||"Failed to fetch commands");let Ae=Array.isArray(ne.data?.data)?ne.data.data:[],Ce=ne.data?.total||Ae.length;return{commands:Ae,total:Ce}}catch(O){throw new Error(`Failed to fetch commands: ${O}`)}};(async()=>{try{let V=await U(a);s(V.commands),w(V.total),i("list"),c(0),V.commands.length===0&&E("No commands found in the online repository.")}catch(V){E(V instanceof Error?V.message:"Failed to load commands"),i("list"),c(0)}})()},[a,t]);let F=U=>U.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),q=U=>U==="user"?c9e.join(D3r.homedir(),".iflow","commands"):c9e.join(process.cwd(),".iflow","commands"),J=async(U,se)=>{try{let V=q(se);await u9e.mkdir(V,{recursive:!0});let O=`${F(U.name)}.toml`,Y=c9e.join(V,O);try{return await u9e.access(Y),{success:!1,message:`Command '${U.name}' is already installed in your ${se} scope.`}}catch{}let ee=`# Command: ${U.name}
2655
+ Update your environment and try again (no reload needed if using .env)!`:null}return[...Vf,Sn.OPENAI_COMPATIBLE].includes(t)?null:"Invalid auth method selected."};var Lr=Qe(wt(),1);function fWt(t){return t&&Object.values(Sn).includes(t)?t:null}function pWt({onSelect:t,settings:e,initialErrorMessage:n}){let[r,i]=(0,g_.useState)("select"),[o,s]=(0,g_.useState)(null),[a,l]=(0,g_.useState)({baseUrl:"",apiKey:""}),[u,c]=(0,g_.useState)("baseUrl"),[d,h]=(0,g_.useState)(""),[m,E]=(0,g_.useState)(""),[y,C]=(0,g_.useState)(""),[_,w]=(0,g_.useState)(""),[B,R]=(0,g_.useState)(()=>{if(n)return n;let Ce=fWt(process.env.GEMINI_DEFAULT_AUTH_TYPE);return null}),F=[{label:"iFlow: Quick setup and free model to use(recommend)",value:Sn.IFLOW},{label:"OpenAI Compatible API",value:Sn.OPENAI_COMPATIBLE}],q=Math.max(0,F.findIndex(Ce=>{if(e.merged.selectedAuthType)return Ce.value===e.merged.selectedAuthType;let De=fWt(process.env.GEMINI_DEFAULT_AUTH_TYPE);return De?Ce.value===De:process.env.GEMINI_API_KEY?Ce.value===Sn.USE_GEMINI:Ce.value===Sn.LOGIN_WITH_GOOGLE})),J=Ce=>{if(Vf.includes(Ce))s(Ce),i("input-api-key"),R(null);else if(Ce===Sn.OPENAI_COMPATIBLE)s(Ce),i("input-openai-config"),c("baseUrl"),l({baseUrl:"",apiKey:""}),R(null);else{let De=bO(Ce);De?R(De):(R(null),t(Ce,"User"))}},j=Ce=>{o&&Vf.includes(o)&&(C(Ce),i("input-model-name"),h(""))},L=Ce=>{if(u==="baseUrl")l(De=>({...De,baseUrl:Ce})),c("apiKey");else if(u==="apiKey")l(De=>({...De,apiKey:Ce})),c("modelName");else if(u==="modelName"){if(l(Ue=>({...Ue,modelName:Ce})),h(Ce),!iS.isMultimodalModel(Ce)){i("input-multimodal-model"),E("");return}i("input-search-api-key"),w("")}},K=()=>{i("select"),s(null),R(null)},U=()=>{u==="modelName"?c("apiKey"):u==="apiKey"?c("baseUrl"):(i("select"),s(null),l({baseUrl:"",apiKey:""}),c("baseUrl"),R(null))},se=Ce=>{if(o&&Vf.includes(o)){if(h(Ce),!iS.isMultimodalModel(Ce)&&o!==Sn.IFLOW){i("input-multimodal-model"),E("");return}if(o===Sn.IFLOW){let Ue={baseUrl:"https://apis.iflow.cn/v1",apiKey:y,modelName:Ce,searchApiKey:y,multimodalModelName:"qwen-vl-max"};t(o,"User",Ue)}else i("input-search-api-key"),w("")}},V=Ce=>{if(o&&Vf.includes(o)){if(h(Ce),!iS.isMultimodalModel(Ce)&&o!==Sn.IFLOW){i("input-multimodal-model"),E("");return}if(o===Sn.IFLOW){let Ue={baseUrl:"https://apis.iflow.cn/v1",apiKey:y,modelName:Ce,searchApiKey:y,multimodalModelName:"qwen-vl-max"};t(o,"User",Ue)}else i("input-search-api-key"),w("")}},O=()=>{o&&Vf.includes(o)?i("input-api-key"):(i("input-openai-config"),c("apiKey"))},Y=Ce=>{let De=Ce.trim();E(De),(o&&Vf.includes(o)||o===Sn.OPENAI_COMPATIBLE)&&(i("input-search-api-key"),w(""))},ee=()=>{o===Sn.OPENAI_COMPATIBLE?(i("input-openai-config"),c("modelName")):i("input-model-name")},ne=Ce=>{if(o&&Vf.includes(o)){let De={...o===Sn.IFLOW&&{baseUrl:"https://apis.iflow.cn/v1"},apiKey:y,modelName:d,searchApiKey:o===Sn.IFLOW?y:Ce,multimodalModelName:m||"qwen-vl-max"};t(o,"User",De)}else if(o===Sn.OPENAI_COMPATIBLE){let De={...a,searchApiKey:Ce,multimodalModelName:m||""};t(o,"User",De)}},Ae=()=>{o===Sn.OPENAI_COMPATIBLE?m!==""?i("input-multimodal-model"):(i("input-openai-config"),c("modelName")):i(m!==""?"input-multimodal-model":"input-model-name")};if(bi((Ce,De)=>{if(De.escape){if(B)return;if(e.merged.selectedAuthType===void 0){R("You must select an auth method to proceed. Press Ctrl+C twice to exit.");return}t(void 0,"User")}}),r==="input-api-key")return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"iFlow Authentication"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter your iFlow API key. See: https://docs.iflow.cn/docs/"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(OQ,{onSubmit:j,onCancel:K,label:"API Key:",placeholder:"Enter your iFlow API key...",isFocused:!0,validateApiKey:!0})})]});if(r==="input-model-name"){if(o===Sn.IFLOW){let Ce=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"GLM-4.5",value:"glm-4.5"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"},{label:"Qwen-VL-Max(direct multimodal)",value:"qwen-vl-max"}];return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please select the model you want to use."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentBlue,children:"Enter To Use Default selection: Qwen3 Coder"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(Qd,{items:Ce,initialIndex:0,onSelect:V,isFocused:!0})})]})}return(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter the model name you want to use."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(A_,{onSubmit:se,onCancel:O,label:"Model Name:",placeholder:"Enter model name (e.g. Qwen3-Coder)",isFocused:!0})})]})}return r==="input-multimodal-model"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Multimodal Model Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter a multimodal model name for image description generation."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentYellow,children:"Leave empty to disable multimodal support."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(A_,{onSubmit:Y,onCancel:ee,label:"Multimodal Model:",placeholder:"Enter multimodal model name or leave empty",isFocused:!0,allowEmpty:!0})})]}):r==="input-search-api-key"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Search API Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Please enter your Search API key for web search functionality."})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(OQ,{onSubmit:ne,onCancel:Ae,label:"Search API Key:",placeholder:"https://docs.iflow.cn/docs/ Enter your iFlow search API key... ",isFocused:!0,validateApiKey:!0})})]}):r==="input-openai-config"?(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"OpenAI Compatible API Configuration"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:u==="baseUrl"?"Please enter the base URL for your OpenAI compatible API.":u==="apiKey"?"Please enter your API key.":"Please enter the model name."})}),(0,Lr.jsx)(de,{marginTop:1,children:u==="baseUrl"?(0,Lr.jsx)(A_,{onSubmit:L,onCancel:U,label:"Base URL:",placeholder:"https://api.openai.com/v1",isFocused:!0}):u==="apiKey"?(0,Lr.jsx)(OQ,{onSubmit:L,onCancel:U,label:"API Key:",placeholder:"Enter your API key...",isFocused:!0,validateApiKey:!0}):(0,Lr.jsx)(A_,{onSubmit:L,onCancel:U,label:"Model Name:",placeholder:"Enter model name (e.g. gpt-4)",isFocused:!0})}),u==="baseUrl"&&a.baseUrl&&(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsxs)(z,{color:ue.Gray,children:["Current: ",a.baseUrl]})})]}):(0,Lr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Lr.jsx)(z,{bold:!0,children:"Get started"}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"How would you like to authenticate for this project?"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(Qd,{items:F,initialIndex:q,onSelect:J,isFocused:!0})}),B&&(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.AccentRed,children:B})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{color:ue.Gray,children:"(Use Enter to select)"})}),(0,Lr.jsx)(de,{marginTop:1,children:(0,Lr.jsx)(z,{children:"Terms of Services and Privacy Notice for iFlow CLI"})})]})}var cpe=Qe(on(),1);var xO=Qe(wt(),1);function hWt({onTimeout:t}){let[e,n]=(0,cpe.useState)(!1);return bi((r,i)=>{i.escape&&t()}),(0,cpe.useEffect)(()=>{let r=setTimeout(()=>{n(!0),t()},18e4);return()=>clearTimeout(r)},[t]),(0,xO.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:e?(0,xO.jsx)(z,{color:ue.AccentRed,children:"Authentication timed out. Please try again."}):(0,xO.jsx)(de,{children:(0,xO.jsxs)(z,{children:[(0,xO.jsx)(CQ,{type:"dots"})," Waiting for auth... (Press ESC to cancel)"]})})})}var yc=Qe(wt(),1);function mWt({onContinue:t}){return bi((e,n)=>{(n.return||e===" ")&&t()}),(0,yc.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,yc.jsx)(z,{bold:!0,color:ue.AccentBlue,children:"\u{1F680} Examples & Getting Started"}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{children:"Welcome to iFlow CLI! Check out these examples to get the most out of your experience:"})}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"\u{1F4DA} Examples Repository:"})}),(0,yc.jsx)(de,{marginTop:1,marginLeft:2,children:(0,yc.jsx)(z,{color:ue.AccentBlue,children:"https://platform.iflow.cn/cli/examples/"})}),(0,yc.jsx)(de,{marginTop:1,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"\u{1F4A1} Quick Tips:"})}),(0,yc.jsx)(de,{marginTop:1,marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use @ to include file contents in your prompt"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use ! to execute shell commands directly"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use /init to create IFLOW.md for better context"})}),(0,yc.jsx)(de,{marginLeft:2,children:(0,yc.jsx)(z,{children:"\u2022 Use /help to see all available commands"})}),(0,yc.jsx)(de,{marginTop:2,children:(0,yc.jsx)(z,{bold:!0,color:ue.AccentGreen,children:"Press Enter or Space to continue to chat \u2192"})})]})}var AWt=Qe(on(),1);Yu();qn();var xu=Qe(wt(),1);function gWt({onSelect:t,onCancel:e,settings:n,initialErrorMessage:r}){let i=n.merged.selectedAuthType===Sn.IFLOW?"model-select":"model-input",[o,s]=(0,AWt.useState)(r||null),a=c=>{t(c,"User")},l=c=>{if(!c.trim()){s("Model name cannot be empty");return}t(c.trim(),"User")},u=()=>{e()};if(bi((c,d)=>{d.escape&&e()}),i==="model-select"){let c=[{label:"Qwen3-Coder-480B-A35B(recommend)",value:"Qwen3-Coder"},{label:"Qwen3-235B-A22B",value:"Qwen3-235B"},{label:"Kimi K2",value:"KIMI-K2"},{label:"GLM-4.5",value:"glm-4.5"},{label:"Qwen3-235B-A22B-Thinking",value:"Qwen3-235B-A22B-Thinking-2507"},{label:"Qwen3-235B-A22B-Instruct",value:"Qwen3-235B-A22B-Instruct"},{label:"Qwen-VL-Max(direct multimodal)",value:"qwen-vl-max"}];return(0,xu.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,xu.jsx)(z,{bold:!0,children:"Model Selection"}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{children:"Please select the model you want to use with iFlow."})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentBlue,children:"Enter To Use Default selection: Qwen3 Coder"})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(Qd,{items:c,initialIndex:0,onSelect:a,isFocused:!0})}),o&&(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentRed,children:o})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to cancel)"})})]})}return(0,xu.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,xu.jsx)(z,{bold:!0,children:"Model Configuration"}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{children:"Please enter the model name you want to use."})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(A_,{onSubmit:l,onCancel:u,label:"Model Name:",placeholder:"Enter model name (e.g. gpt-4o, claude-3-5-sonnet)",isFocused:!0})}),o&&(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.AccentRed,children:o})}),(0,xu.jsx)(de,{marginTop:1,children:(0,xu.jsx)(z,{color:ue.Gray,children:"(Press Enter to confirm, Esc to cancel)"})})]})}var dpe=Qe(on(),1);var fp=Qe(wt(),1);function fpe({serverName:t,values:e,onComplete:n,onCancel:r}){let i=Object.keys(e),[o,s]=(0,dpe.useState)(0),[a,l]=(0,dpe.useState)({}),[u,c]=(0,dpe.useState)(null),d=i[o],h=e[d],m=o===i.length-1,E=_=>{if(h.type==="int"){let B=Number(_);if(isNaN(B)||!Number.isInteger(B)){c("Please enter a valid integer number");return}}c(null);let w={...a,[d]:_};l(w),m?n(w):s(o+1)},y=()=>{o>0?(s(o-1),c(null)):r()},C=()=>{let _=h.default||`Enter ${d.toLowerCase()}...`,w=`${d}:`;switch(h.type){case"password":return(0,fp.jsx)(OQ,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0,validateApiKey:!0});case"int":return(0,fp.jsx)(A_,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0});case"string":default:return(0,fp.jsx)(A_,{onSubmit:E,onCancel:y,label:w,placeholder:_,isFocused:!0})}};return(0,fp.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,fp.jsxs)(z,{bold:!0,children:["MCP Server Configuration: ",t]}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsxs)(z,{children:["Step ",o+1," of ",i.length,": Configure ",d]})}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.AccentBlue,children:h.description})}),h.type==="int"&&(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.Gray,children:"Expected type: Integer number"})}),(0,fp.jsx)(de,{marginTop:2,children:C()}),u&&(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.AccentRed,children:u})}),(0,fp.jsx)(de,{marginTop:1,children:(0,fp.jsx)(z,{color:ue.Gray,children:o>0?"Press Escape to go back":"Press Escape to cancel"})})]})}var ppe=Qe(on(),1);qn();var ya=Qe(wt(),1);function EWt({onSelect:t,onCancel:e,requestedModel:n,reason:r,availableModels:i,suggestedModel:o,taskPrompt:s}){let[a,l]=(0,ppe.useState)(null),[u,c]=(0,ppe.useState)("model_selection"),[d,h]=(0,ppe.useState)(""),m=F=>{h(F),c("preference_selection")},E=F=>{t({selectedModel:d,preference:F})},y=()=>{e()},C=()=>{c("model_selection"),h("")};bi((F,q)=>{q.escape&&(u==="preference_selection"?C():e())});let _=i.findIndex(F=>F.value===o),w=_>=0?_:0;if(u==="model_selection")return(0,ya.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,ya.jsx)(z,{bold:!0,color:ue.AccentRed,children:"Model Validation Required"}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.AccentRed,children:["Model '",n,"' is not supported."]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.Gray,children:["Reason: ",r]})}),s&&(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.Gray,children:["Task: ",s.length>100?`${s.substring(0,100)}...`:s]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{children:"Please select a supported model to continue:"})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{color:ue.AccentBlue,children:["Suggested: ",i.find(F=>F.value===o)?.label||o]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(Qd,{items:i,initialIndex:w,onSelect:m,isFocused:!0})}),a&&(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.AccentRed,children:a})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to cancel)"})})]});let B=[{label:"No, ask me each time",value:iA.OnceOnly},{label:"Yes, remember for this session",value:iA.RememberSession},{label:"Yes, remember always",value:iA.RememberAlways}],R=i.find(F=>F.value===d)?.label||d;return(0,ya.jsxs)(de,{borderStyle:"round",borderColor:ue.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,ya.jsx)(z,{bold:!0,color:ue.AccentBlue,children:"Model Preference"}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{children:["You selected: ",(0,ya.jsx)(z,{color:ue.AccentGreen,children:R})]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsxs)(z,{children:["In the future, when '",n,"' is not supported, would you like to always use '",R,"'?"]})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(Qd,{items:B,initialIndex:0,onSelect:E,isFocused:!0})}),(0,ya.jsx)(de,{marginTop:1,children:(0,ya.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Esc to go back)"})})]})}var l9e=Qe(on(),1);qn();var hpe={cursor:"Cursor",emacs:"Emacs",neovim:"Neovim",vim:"Vim",vscode:"VS Code",vscodium:"VSCodium",windsurf:"Windsurf",zed:"Zed"},a9e=class{availableEditors;constructor(){let e=Object.keys(hpe).sort();this.availableEditors=[{name:"None",type:"not_set",disabled:!1},...e.map(n=>{let r=EP(n),i=yP(n),o=i?"":" (Not available in sandbox)";return o=r?o:" (Not installed)",{name:hpe[n]+o,type:n,disabled:!r||!i}})]}getAvailableEditorDisplays(){return this.availableEditors}},yWt=new a9e;Yu();qn();var pp=Qe(wt(),1);function CWt({onSelect:t,settings:e,onExit:n}){let[r,i]=(0,l9e.useState)("User"),[o,s]=(0,l9e.useState)("editor");bi((C,_)=>{_.tab&&s(w=>w==="editor"?"scope":"editor"),_.escape&&n()});let a=yWt.getAvailableEditorDisplays(),l=e.forScope(r).settings.preferredEditor,u=l?a.findIndex(C=>C.type===l):0;u===-1&&(console.error(`Editor is not supported: ${l}`),u=0);let c=[{label:"User Settings",value:"User"},{label:"Workspace Settings",value:"Workspace"}],d=C=>{if(C==="not_set"){t(void 0,r);return}t(C,r)},h=C=>{i(C),s("editor")},m="",E=r==="User"?"Workspace":"User";e.forScope(E).settings.preferredEditor!==void 0&&(m=e.forScope(r).settings.preferredEditor!==void 0?`(Also modified in ${E})`:`(Modified in ${E})`);let y="None";return e.merged.preferredEditor&&_q(e.merged.preferredEditor)&&(y=hpe[e.merged.preferredEditor]),(0,pp.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"row",padding:1,width:"100%",children:[(0,pp.jsxs)(de,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,pp.jsxs)(z,{bold:o==="editor",children:[o==="editor"?"> ":" ","Select Editor"," ",(0,pp.jsx)(z,{color:ue.Gray,children:m})]}),(0,pp.jsx)(Qd,{items:a.map(C=>({label:C.name,value:C.type,disabled:C.disabled})),initialIndex:u,onSelect:d,isFocused:o==="editor"},r),(0,pp.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,pp.jsxs)(z,{bold:o==="scope",children:[o==="scope"?"> ":" ","Apply To"]}),(0,pp.jsx)(Qd,{items:c,initialIndex:0,onSelect:h,isFocused:o==="scope"})]}),(0,pp.jsx)(de,{marginTop:1,children:(0,pp.jsx)(z,{color:ue.Gray,children:"(Use Enter to select, Tab to change focus)"})})]}),(0,pp.jsxs)(de,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,pp.jsx)(z,{bold:!0,children:"Editor Preference"}),(0,pp.jsxs)(de,{flexDirection:"column",gap:1,marginTop:1,children:[(0,pp.jsx)(z,{color:ue.Gray,children:"These editors are currently supported. Please note that some editors cannot be used in sandbox mode."}),(0,pp.jsxs)(z,{color:ue.Gray,children:["Your preferred editor is:"," ",(0,pp.jsx)(z,{color:y==="None"?ue.AccentRed:ue.AccentCyan,bold:!0,children:y}),"."]})]})]})]})}qn();var Sv=Qe(wt(),1);var vWt=({request:t})=>{let{commands:e,onConfirm:n}=t;bi((o,s)=>{s.escape&&n(Rr.Cancel)});let r=o=>{o===Rr.Cancel?n(o):n(o,e)},i=[{label:"Yes, allow once",value:Rr.ProceedOnce},{label:"Yes, allow always for this session",value:Rr.ProceedAlways},{label:"No (esc)",value:Rr.Cancel}];return(0,Sv.jsxs)(de,{flexDirection:"column",borderStyle:"round",borderColor:ue.AccentYellow,padding:1,width:"100%",marginLeft:1,children:[(0,Sv.jsxs)(de,{flexDirection:"column",marginBottom:1,children:[(0,Sv.jsx)(z,{bold:!0,children:"Shell Command Execution"}),(0,Sv.jsx)(z,{children:"A custom command wants to run the following shell commands:"}),(0,Sv.jsx)(de,{flexDirection:"column",borderStyle:"round",borderColor:ue.Gray,paddingX:1,marginTop:1,children:e.map(o=>(0,Sv.jsx)(z,{color:ue.AccentCyan,children:o},o))})]}),(0,Sv.jsx)(de,{marginBottom:1,children:(0,Sv.jsx)(z,{children:"Do you want to proceed?"})}),(0,Sv.jsx)(Qd,{items:i,onSelect:r,isFocused:!0})]})};var uh=Qe(wt(),1);var DWt=({servers:t,cwd:e,selectedIndex:n,onSelect:r,onCancel:i})=>{let o=[{id:"connect",label:"Connect to the current IDE",action:()=>r()},{id:"disconnect",label:"Disconnect from IDE",action:()=>i}];return(0,uh.jsxs)(de,{flexDirection:"column",paddingX:1,paddingY:1,borderStyle:"round",borderColor:ue.AccentPurple,children:[(0,uh.jsx)(de,{marginBottom:1,children:(0,uh.jsx)(z,{bold:!0,color:ue.AccentPurple,children:"Connect IDE"})}),(0,uh.jsx)(de,{marginBottom:1,children:(0,uh.jsx)(z,{children:"Connect to an IDE for integrated development features."})}),(0,uh.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,uh.jsx)(z,{color:ue.Gray,children:"Select an option (use arrow keys to navigate):"}),o.map((s,a)=>(0,uh.jsx)(de,{marginTop:1,marginLeft:2,children:(0,uh.jsxs)(z,{color:a===n?ue.AccentBlue:ue.Gray,children:[a===n?"\u2192 ":" ",s.label]})},s.id)),(0,uh.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,uh.jsxs)(z,{color:ue.Gray,children:["Found ",t.length||0," other running IDE(s). However, their workspace/project directories do not match the current cwd."]}),t.map(s=>(0,uh.jsx)(de,{marginTop:1,marginLeft:2,children:(0,uh.jsx)(z,{color:ue.Gray,children:s.workspaceFolders&&s.workspaceFolders[0]?`${s.ideType} : ${s.workspaceFolders[0]}`:`${s.ideType} : \u65E0\u5DE5\u4F5C\u533A\u76EE\u5F55`})},s.pid))]}),(0,uh.jsx)(de,{marginTop:1,children:(0,uh.jsx)(z,{color:ue.Gray,children:"Press Esc to cancel"})})]})]})};var SWt=Qe(on(),1);var Z0=Qe(wt(),1);var _Wt=({plan:t,onApprove:e,onKeepPlanning:n,onExit:r})=>{let[i,o]=(0,SWt.useState)(0),s=[{key:"1",label:"Yes, and use yolo mode edits",action:()=>e("yolo")},{key:"2",label:"Yes, and manually approve edits",action:()=>e("default")},{key:"3",label:"No, keep planning",action:n}];return bi((a,l)=>{if(l.escape&&r){r();return}if(l.upArrow)o(u=>u>0?u-1:s.length-1);else if(l.downArrow)o(u=>u<s.length-1?u+1:0);else if(l.return)s[i].action();else if(a>="1"&&a<="3"){let u=parseInt(a)-1;u>=0&&u<s.length&&s[u].action()}}),(0,Z0.jsxs)(de,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:ue.AccentBlue,children:[(0,Z0.jsx)(de,{marginBottom:1,children:(0,Z0.jsx)(z,{color:ue.AccentBlue,bold:!0,children:"Plan Ready for Review"})}),(0,Z0.jsx)(de,{marginBottom:2,flexDirection:"column",children:(0,Z0.jsx)(z,{color:ue.Foreground,children:t})}),(0,Z0.jsx)(de,{marginBottom:1,children:(0,Z0.jsx)(z,{color:ue.AccentBlue,bold:!0,children:"Would you like to proceed?"})}),s.map((a,l)=>(0,Z0.jsx)(de,{marginBottom:l===s.length-1?1:0,children:(0,Z0.jsxs)(z,{color:i===l?ue.AccentBlue:ue.Foreground,children:[i===l?"\u25B6 ":" ",a.key,". ",a.label]})},a.key)),(0,Z0.jsx)(de,{marginTop:1,children:(0,Z0.jsx)(z,{color:ue.Comment,dimColor:!0,children:"Use \u2191\u2193 arrows to navigate, Enter to select, or press 1-3"})})]})};var p1=Qe(on(),1);var zr=Qe(wt(),1);import{readFileSync as A3r,writeFileSync as g3r,existsSync as E3r,mkdirSync as y3r}from"fs";import{homedir as IWt}from"os";import{join as mpe}from"path";function TWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,p1.useState)("loading"),[s,a]=(0,p1.useState)([]),[l,u]=(0,p1.useState)(0),[c,d]=(0,p1.useState)(0),[h,m]=(0,p1.useState)(null),[E,y]=(0,p1.useState)(null),[C,_]=(0,p1.useState)(null),[w,B]=(0,p1.useState)(null),[R,F]=(0,p1.useState)(null),q=10,J=Math.max(1,Math.ceil(s.length/q));(0,p1.useEffect)(()=>{let ne=async()=>{try{let Ce=t.merged.apiKey;if(!Ce)return{success:!1,message:"Please authenticate first by running the auth command"};let De=await fetch("https://apis.iflow.cn/v1/mcp-servers?pageNumber=1&pageSize=100",{method:"GET",headers:{Authorization:`Bearer ${Ce}`,"User-Agent":"iFlow-Cli"}});if(!De.ok){let qe="Unable to load MCP servers. Please try again later";return De.status===401?qe="Authentication failed. Please check your API key or re-authenticate":De.status===403?qe="Access denied. Please check your permissions":De.status===404?qe="MCP servers service not found. Please try again later":De.status>=500&&(qe="Server error. Please try again later"),{success:!1,message:qe}}return{success:!0,data:(await De.json()).result||[]}}catch(Ce){let De="Unable to load MCP servers. Please check your connection and try again";return Ce instanceof Error&&Ce.message.includes("Failed to fetch")&&(De="Network error. Please check your internet connection"),{success:!1,message:De}}};(async()=>{let Ce=await ne();Ce.success&&Ce.data?(a(Ce.data),o("list"),Ce.data.length===0&&y("No MCP servers found in the online repository.")):(y(Ce.message||"Failed to load servers"),o("list"))})()},[]);let j=ne=>{let Ae=Object.keys(ne);if(Ae.length===0)return null;let Ce=Ae[0],De=ne[Ce];return De.values?De.values:null},L=ne=>ne?Object.values(ne).some(Ae=>typeof Ae=="string"&&Ae.includes("${")&&Ae.includes("}")):!1,K=(ne,Ae)=>{let Ce=JSON.parse(JSON.stringify(ne));if(Ce.env){for(let[De,Ue]of Object.entries(Ce.env))if(typeof Ue=="string"){let qe=Ue;for(let[Ie,xe]of Object.entries(Ae)){let Oe=`\${${Ie}}`;qe=qe.replace(new RegExp(Oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),xe)}Ce.env[De]=qe}}return Ce},U=async(ne,Ae,Ce)=>{try{let De=Ae==="user"?mpe(IWt(),".iflow","settings.json"):mpe(process.cwd(),".iflow","settings.json"),Ue=Ae==="user"?mpe(IWt(),".iflow"):mpe(process.cwd(),".iflow");E3r(Ue)||y3r(Ue,{recursive:!0});let qe={};try{let ye=A3r(De,"utf8");qe=JSON.parse(ye)}catch{}qe.mcpServers||(qe.mcpServers={});let Ie=Object.keys(ne.serverConfig)[0],xe=Object.values(ne.serverConfig)[0];Ce&&(xe=K(xe,Ce));let{values:Oe,...le}=xe;qe.mcpServers[Ie]={description:ne.description,...le},g3r(De,JSON.stringify(qe,null,2));let re="";try{r?.(`Loading MCP server '${ne.name}' and discovering tools...`);let{MCPServerConfig:ye}=await Promise.resolve().then(()=>(qn(),i_)),X=new ye(xe.command,xe.args,xe.env,xe.cwd,xe.url,xe.httpUrl,xe.headers,xe.tcp,xe.timeout,xe.trust,ne.description,xe.includeTools,xe.excludeTools,void 0,xe.oauth,xe.authProviderType);typeof e.addMcpServer=="function"?e.addMcpServer(Ie,X):console.warn("Config.addMcpServer method not available, skipping dynamic loading");let he=await e.getToolRegistry();if(he){await he.discoverToolsForServer(Ie);let ae=e.getGeminiClient();ae&&await ae.setTools();let me=he.getToolsByServer(Ie);re=` - ${me.length} tools loaded and ready to use`,r?.(`\u2705 MCP server '${ne.name}' loaded successfully with ${me.length} tools`)}}catch(ye){console.warn("Failed to auto-discover tools from newly installed server:",ye),r?.(`\u26A0\uFE0F MCP server '${ne.name}' installed but failed to load tools: ${ye}`)}return{success:!0,message:`Successfully installed ${ne.name} for ${Ae} (${De})${re}`}}catch(De){return{success:!1,message:`Failed to install ${ne.name}: ${De}`}}},se=async(ne,Ae)=>{let Ce=j(ne.serverConfig),De=Object.keys(ne.serverConfig),Ue=De.length>0?ne.serverConfig[De[0]]:{};if(Ce&&Object.keys(Ce).length>0&&L(Ue.env))m(ne),B(Ae),F(Ce),o("value-input");else try{r?.(`Installing ${ne.name}...`);let qe=await U(ne,Ae);qe.success?(_(qe.message),y(null),r?.(qe.message)):(y(qe.message),_(null),r?.(`\u274C ${qe.message}`))}catch(qe){let Ie=qe instanceof Error?qe.message:"Installation failed";y(Ie),_(null),r?.(`\u274C ${Ie}`)}},V=async ne=>{if(!(!h||!w))try{r?.(`Installing ${h.name} with configuration...`);let Ae=await U(h,w,ne);Ae.success?(_(Ae.message),y(null),r?.(Ae.message),o("detail"),F(null),B(null)):(y(Ae.message),_(null),r?.(`\u274C ${Ae.message}`),o("detail"),F(null),B(null))}catch(Ae){let Ce=Ae instanceof Error?Ae.message:"Installation failed";y(Ce),_(null),r?.(`\u274C ${Ce}`),o("detail"),F(null),B(null)}},O=()=>{o("detail"),F(null),B(null)};bi((ne,Ae)=>{if(i!=="value-input"){if(Ae.escape){i==="detail"?(o("list"),m(null),y(null),_(null)):n();return}if(i==="list"){if(s.length===0){ne==="q"&&n();return}if(Ae.upArrow||ne==="k"){let Ce=Math.max(c-1,0);d(Ce);let De=Math.floor(Ce/q);u(De)}else if(Ae.downArrow||ne==="j"){let Ce=Math.min(c+1,s.length-1);d(Ce);let De=Math.floor(Ce/q);u(De)}else if(Ae.leftArrow||ne==="h"){if(J>1){let Ce=Math.max(l-1,0);u(Ce),d(Math.min(Ce*q,s.length-1))}}else if(Ae.rightArrow||ne==="l"){if(J>1){let Ce=Math.min(l+1,J-1);u(Ce),d(Math.min(Ce*q,s.length-1))}}else Ae.return||ne===""?c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null),_(null)):ne==="q"&&n()}else i==="detail"&&h&&(ne==="1"?se(h,"project"):ne==="2"?se(h,"user"):ne==="b"?(o("list"),m(null),y(null),_(null)):ne==="q"&&n())}});let Y=()=>{if(s.length===0)return(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsx)(z,{bold:!0,children:"Available MCP Servers"}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentRed,children:E||"No servers available"})})]});let ne=Math.min(l*q,s.length),Ae=Math.min(ne+q,s.length),Ce=s.slice(ne,Ae);return(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsxs)(z,{bold:!0,children:["Available MCP Servers (",s.length," total)"]}),(0,zr.jsx)(de,{marginTop:1,flexDirection:"column",children:Ce.map((De,Ue)=>{let Ie=ne+Ue===c;return(0,zr.jsxs)(de,{marginBottom:1,children:[(0,zr.jsxs)(z,{color:Ie?ue.AccentCyan:void 0,children:[Ie?"\u25B6 ":" ",Ue+1,". ",De.name]}),(0,zr.jsx)(de,{marginLeft:4,children:(0,zr.jsx)(z,{color:ue.Gray,children:De.description})}),(0,zr.jsx)(de,{marginLeft:4,children:(0,zr.jsxs)(z,{color:ue.Gray,children:["Tools: ",De.tools?.length||0," | Visits: ",De.visitCount||0]})})]},De.id)})}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",J]})}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 Enter - View details"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]})},ee=()=>h?(0,zr.jsxs)(de,{flexDirection:"column",children:[(0,zr.jsx)(z,{bold:!0,children:h.name}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentBlue,children:h.description})}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.AccentCyan,children:"Details:"}),(0,zr.jsxs)(z,{children:[" \u2022 Version: ",h.versionType]}),(0,zr.jsxs)(z,{children:[" \u2022 Protocol: ",h.protocolVersion]}),(0,zr.jsxs)(z,{children:[" \u2022 Transports: ",h.transports?.join(", ")||"N/A"]}),(0,zr.jsxs)(z,{children:[" \u2022 Auth Types: ",h.authTypes?.join(", ")||"N/A"]}),(0,zr.jsxs)(z,{children:[" \u2022 Visits: ",h.visitCount||0]})]}),h.tools&&h.tools.length>0&&(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsxs)(z,{color:ue.AccentCyan,children:["Available Tools (",h.tools.length,"):"]}),h.tools.map((ne,Ae)=>(0,zr.jsxs)(de,{marginLeft:2,children:[(0,zr.jsxs)(z,{children:[Ae+1,". ",ne.name]}),(0,zr.jsx)(de,{marginLeft:2,children:(0,zr.jsx)(z,{color:ue.Gray,children:ne.description})})]},Ae))]}),(0,zr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,zr.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 1 - Install for project"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 2 - Install for user"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,zr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),C&&(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsxs)(z,{color:ue.AccentGreen,children:["\u2705 ",C]})}),E&&(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{color:ue.AccentRed,children:E})})]}):null;return i==="loading"?(0,zr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,zr.jsx)(z,{bold:!0,children:"Loading MCP Servers..."}),(0,zr.jsx)(de,{marginTop:1,children:(0,zr.jsx)(z,{children:"Please wait while we fetch available servers..."})})]}):i==="value-input"&&h&&R?(0,zr.jsx)(fpe,{serverName:h.name,values:R,onComplete:V,onCancel:O}):(0,zr.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?Y():ee()})}var E_=Qe(on(),1);zF();qn();var yn=Qe(wt(),1);import{readFileSync as bWt,writeFileSync as C3r}from"fs";import{homedir as v3r}from"os";import{join as xWt}from"path";function wWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,E_.useState)("loading"),[s,a]=(0,E_.useState)([]),[l,u]=(0,E_.useState)(0),[c,d]=(0,E_.useState)(0),[h,m]=(0,E_.useState)(null),[E,y]=(0,E_.useState)(null),[C,_]=(0,E_.useState)(null),w=10,B=Math.max(1,Math.ceil(s.length/w));(0,E_.useEffect)(()=>{(async()=>{try{let K=e.getMcpServers()||{},U=Object.keys(K);if(U.length===0){a([]),o("list");return}let se=await e.getToolRegistry(),V=await e.getPromptRegistry(),O=[];for(let Y of U){let ee=K[Y],ne=uL(Y),Ce=(se?.getAllTools()||[]).filter(Ie=>Ie instanceof qp&&Ie.serverName===Y),De=V?.getPromptsByServer(Y)||[],Ue=lL.get(Y)||!1,qe="";if(ee.oauth?.enabled)try{let{MCPOAuthTokenStorage:Ie}=await Promise.resolve().then(()=>(qn(),i_)),xe=await Ie.getToken(Y);xe?qe=Ie.isTokenExpired(xe.token)?"expired":"authenticated":qe="not authenticated"}catch{qe="unknown"}O.push({name:Y,config:ee,status:ne,tools:Ce,prompts:De,needsAuth:Ue,oauthStatus:qe})}a(O),o("list"),d(0),u(0)}catch(K){y(K instanceof Error?K.message:"Failed to load servers"),o("list"),d(0),u(0)}})()},[e]);let R=async L=>{try{let K="project",U=xWt(process.cwd(),".iflow","settings.json"),se=xWt(v3r(),".iflow","settings.json");try{let ee=bWt(se,"utf8"),ne=JSON.parse(ee);ne.mcpServers&&ne.mcpServers[L.name]&&(K="user",U=se)}catch{}let V=bWt(U,"utf8"),O=JSON.parse(V);if(!O.mcpServers||!O.mcpServers[L.name])return{success:!1,message:`Server "${L.name}" not found in ${K} settings.`};delete O.mcpServers[L.name],C3r(U,JSON.stringify(O,null,2)),typeof e.removeMcpServer=="function"&&e.removeMcpServer(L.name);let Y=await e.getToolRegistry();if(Y){await Y.discoverMcpTools();let ee=e.getGeminiClient();ee&&await ee.setTools()}return{success:!0,message:`Successfully removed "${L.name}" from ${K} settings.`}}catch(K){return{success:!1,message:`Failed to remove "${L.name}": ${K}`}}},F=async()=>{if(C)try{r?.(`Removing server "${C.name}"...`);let L=await R(C);if(L.success){r?.(L.message);let K=s.filter(U=>U.name!==C.name);a(K),d(Math.max(0,Math.min(c,K.length-1))),_(null),o("list")}else y(L.message),r?.(`\u274C ${L.message}`),_(null),o("list")}catch(L){let K=L instanceof Error?L.message:"Removal failed";y(K),r?.(`\u274C ${K}`),_(null),o("list")}};bi((L,K)=>{if(K.escape){i==="detail"?(o("list"),m(null),y(null)):i==="confirm-remove"?(o("list"),_(null)):n();return}if(i==="list"){if(s.length===0){if(L==="q")n();else if(L==="o"){let U="https://platform.iflow.cn/mcp";r?.(`Opening MCP platform in your browser: ${U}`),GD(U).catch(se=>{y(`Failed to open MCP platform: ${se.message}`)})}return}if(K.upArrow||L==="k"){let U=Math.max(c-1,0);d(U);let se=Math.floor(U/w);u(se)}else if(K.downArrow||L==="j"){let U=Math.min(c+1,s.length-1);d(U);let se=Math.floor(U/w);u(se)}else if(K.leftArrow||L==="h"){if(B>1){let U=Math.max(l-1,0);u(U),d(Math.min(U*w,s.length-1))}}else if(K.rightArrow||L==="l"){if(B>1){let U=Math.min(l+1,B-1);u(U),d(Math.min(U*w,s.length-1))}}else L===" "||K.return?c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null)):L==="d"||K.delete?c>=0&&c<s.length&&(_(s[c]),o("confirm-remove")):L==="q"&&n()}else i==="detail"&&h?L==="d"||K.delete?(_(h),o("confirm-remove")):L==="b"?(o("list"),m(null),y(null)):L==="q"&&n():i==="confirm-remove"&&(L==="y"||L==="Y"?F():(L==="n"||L==="N")&&(o(h?"detail":"list"),_(null)))});let q=()=>{if(s.length===0)return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,children:"Configured MCP Servers"}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentYellow,children:E||"No MCP servers configured. Use /mcp online to browse and install servers."})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 o - Open MCP platform"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]});let L=Math.min(l*w,s.length),K=Math.min(L+w,s.length),U=s.slice(L,K);return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsxs)(z,{bold:!0,children:["Configured MCP Servers (",s.length," total)"]}),(0,yn.jsx)(de,{marginTop:1,flexDirection:"column",children:U.map((se,V)=>{let Y=L+V===c,ee="",ne="";switch(se.status){case xa.CONNECTED:ee="\u{1F7E2}",ne="Ready";break;case xa.CONNECTING:ee="\u{1F504}",ne="Starting...";break;case xa.DISCONNECTED:default:ee="\u{1F534}",ne="Disconnected";break}return(0,yn.jsxs)(de,{marginBottom:1,children:[(0,yn.jsxs)(z,{color:Y?ue.AccentCyan:void 0,children:[Y?"\u25B6 ":" ",ee," ",se.name," - ",ne]}),(0,yn.jsx)(de,{marginLeft:4,children:(0,yn.jsx)(z,{color:ue.Gray,children:se.config.description||"No description"})}),(0,yn.jsx)(de,{marginLeft:4,children:(0,yn.jsxs)(z,{color:ue.Gray,children:["Tools: ",se.tools.length," | Prompts: ",se.prompts.length,se.config.extensionName&&` | From: ${se.config.extensionName}`]})})]},se.name)})}),B>1&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",B]})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Space/Enter - View server details"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 d/Delete - Remove server"}),B>1&&(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),E&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentRed,children:E})})]})},J=()=>{if(!h)return null;let L=h;return(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,children:L.name}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentBlue,children:L.config.description||"No description available"})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentCyan,children:"Server Details:"}),(0,yn.jsxs)(z,{children:[" \u2022 Status: ",L.status===xa.CONNECTED?"\u{1F7E2} Connected":L.status===xa.CONNECTING?"\u{1F504} Connecting":"\u{1F534} Disconnected"]}),L.config.command&&(0,yn.jsxs)(z,{children:[" \u2022 Command: ",L.config.command," ",L.config.args?.join(" ")||""]}),L.config.httpUrl&&(0,yn.jsxs)(z,{children:[" \u2022 HTTP URL: ",L.config.httpUrl]}),L.config.url&&(0,yn.jsxs)(z,{children:[" \u2022 SSE URL: ",L.config.url]}),L.config.extensionName&&(0,yn.jsxs)(z,{children:[" \u2022 Source: ",L.config.extensionName," extension"]}),L.config.oauth?.enabled&&(0,yn.jsxs)(z,{children:[" \u2022 OAuth: ",L.oauthStatus==="authenticated"?"\u{1F7E2} Authenticated":L.oauthStatus==="expired"?"\u{1F7E1} Token Expired":"\u{1F534} Not Authenticated"]})]}),L.tools.length>0&&(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsxs)(z,{color:ue.AccentCyan,children:["Available Tools (",L.tools.length,"):"]}),L.tools.slice(0,10).map((K,U)=>(0,yn.jsxs)(de,{marginLeft:2,children:[(0,yn.jsxs)(z,{children:[U+1,". ",K.name]}),K.description&&(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:K.description})})]},U)),L.tools.length>10&&(0,yn.jsxs)(z,{color:ue.Gray,children:[" ... and ",L.tools.length-10," more tools"]})]}),L.prompts.length>0&&(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsxs)(z,{color:ue.AccentCyan,children:["Available Prompts (",L.prompts.length,"):"]}),L.prompts.slice(0,5).map((K,U)=>(0,yn.jsxs)(de,{marginLeft:2,children:[(0,yn.jsxs)(z,{children:[U+1,". ",K.name]}),K.description&&(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:K.description})})]},U)),L.prompts.length>5&&(0,yn.jsxs)(z,{color:ue.Gray,children:[" ... and ",L.prompts.length-5," more prompts"]})]}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 d/Delete - Remove this server"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Esc - Back to list"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),E&&(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentRed,children:E})})]})},j=()=>C?(0,yn.jsxs)(de,{flexDirection:"column",children:[(0,yn.jsx)(z,{bold:!0,color:ue.AccentRed,children:"Confirm Server Removal"}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{children:"Are you sure you want to remove the following MCP server?"})}),(0,yn.jsxs)(de,{marginTop:1,marginLeft:2,children:[(0,yn.jsx)(z,{bold:!0,children:C.name}),(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsx)(z,{color:ue.Gray,children:C.config.description||"No description"})}),(0,yn.jsx)(de,{marginLeft:2,children:(0,yn.jsxs)(z,{color:ue.Gray,children:["Tools: ",C.tools.length," | Prompts: ",C.prompts.length]})})]}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{color:ue.AccentYellow,children:"This will remove the server from your configuration and stop all its tools."})}),(0,yn.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,yn.jsx)(z,{color:ue.AccentCyan,children:"Actions:"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 y/Y - Yes, remove server"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 n/N - No, cancel"}),(0,yn.jsx)(z,{color:ue.Gray,children:" \u2022 Esc - Cancel"})]})]}):null;return i==="loading"?(0,yn.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,yn.jsx)(z,{bold:!0,children:"Loading MCP Servers..."}),(0,yn.jsx)(de,{marginTop:1,children:(0,yn.jsx)(z,{children:"Please wait while we load your configured servers..."})})]}):(0,yn.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?q():i==="detail"?J():j()})}var y_=Qe(on(),1);var Tr=Qe(wt(),1);function RWt({settings:t,config:e,onExit:n,onStatusUpdate:r}){let[i,o]=(0,y_.useState)("loading"),[s,a]=(0,y_.useState)([]),[l,u]=(0,y_.useState)(0),[c,d]=(0,y_.useState)(0),[h,m]=(0,y_.useState)(null),[E,y]=(0,y_.useState)(null),[C,_]=(0,y_.useState)(null),w=10,B=Math.ceil(s.length/w);(0,y_.useEffect)(()=>{let j=async()=>{try{let K=t.merged.apiKey;if(!K)return{success:!1,message:"Please authenticate first by running the auth command"};let U=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${K}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:1,size:100,usePage:!0})});if(!U.ok){let V="Unable to load agents. Please try again later";return U.status===401?V="Authentication failed. Please check your API key or re-authenticate":U.status===403?V="Access denied. Please check your permissions":U.status===404?V="Agents service not found. Please try again later":U.status>=500&&(V="Server error. Please try again later"),{success:!1,message:V}}let se=await U.json();return se.success?{success:!0,data:se.data?.data||[]}:{success:!1,message:se.message||"Failed to load agents from server"}}catch(K){let U="Unable to load agents. Please check your connection and try again";return K instanceof Error&&K.message.includes("Failed to fetch")&&(U="Network error. Please check your internet connection"),{success:!1,message:U}}};(async()=>{let K=await j();K.success&&K.data?(a(K.data),o("list"),K.data.length===0&&y("No agents found in the online repository.")):(y(K.message||"Failed to load agents"),o("list"))})()},[]);let R=async(j,L)=>{try{let{AgentRegistry:K}=await Promise.resolve().then(()=>(qn(),i_)),U=new K,se=[];try{let ee=JSON.parse(j.tools||"[]");se=Array.isArray(ee)?ee:["*"]}catch{se=["*"]}let V;if(j.mcps)try{let ee=JSON.parse(j.mcps);Array.isArray(ee)&&ee.length>0&&(V=ee)}catch{let ee=j.mcps.split(",").map(ne=>ne.trim()).filter(ne=>ne.length>0);ee.length>0&&(V=ee)}let O={agentName:j.name,agentType:j.name,description:j.description,whenToUse:j.description,allowedTools:se,allowedMcps:V,systemPrompt:j.detailContext||j.description,location:L==="user"?"global":"project",model:j.modelName,isInheritTools:!0,isInheritMcps:!0};return await U.createAgent(O)?{success:!0,message:`Successfully installed agent '${j.name}' for ${L}`}:{success:!1,message:`Failed to create agent for '${j.name}'`}}catch(K){return{success:!1,message:`Failed to install ${j.name}: ${K}`}}},F=async(j,L)=>{try{r?.(`Installing ${j.name}...`);let K=await R(j,L);K.success?(_(K.message),y(null),r?.(K.message)):(y(K.message),_(null),r?.(`\u274C ${K.message}`))}catch(K){let U=K instanceof Error?K.message:"Installation failed";y(U),_(null),r?.(`\u274C ${U}`)}};bi((j,L)=>{if(L.escape){i==="detail"?(o("list"),m(null),y(null),_(null)):n();return}if(i==="list")if(L.upArrow||j==="k"){let K=Math.max(c-1,0);d(K);let U=Math.floor(K/w);u(U)}else if(L.downArrow||j==="j"){let K=Math.min(c+1,s.length-1);d(K);let U=Math.floor(K/w);u(U)}else if(L.leftArrow||j==="h"){let K=Math.max(l-1,0);u(K),d(K*w)}else if(L.rightArrow||j==="l"){let K=Math.min(l+1,B-1);u(K),d(Math.min(K*w,s.length-1))}else L.return||j===""?s.length>0&&c>=0&&c<s.length&&(m(s[c]),o("detail"),y(null),_(null)):j==="q"&&n();else i==="detail"&&h&&(j==="1"?F(h,"project"):j==="2"?F(h,"user"):j==="b"?(o("list"),m(null),y(null),_(null)):j==="q"&&n())});let q=()=>{if(s.length===0)return(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsx)(z,{bold:!0,children:"Available Agents"}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentRed,children:E||"No agents available"})})]});let j=l*w,L=Math.min(j+w,s.length),K=s.slice(j,L);return(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsxs)(z,{bold:!0,children:["Available Agents (",s.length," total)"]}),(0,Tr.jsx)(de,{marginTop:1,flexDirection:"column",children:K.map((U,se)=>{let O=j+se===c;return(0,Tr.jsxs)(de,{marginBottom:1,flexDirection:"row",children:[(0,Tr.jsxs)(de,{width:30,flexShrink:0,flexDirection:"column",children:[(0,Tr.jsxs)(z,{color:O?ue.AccentCyan:void 0,children:[O?"\u25B6 ":" ",se+1,". ",U.name]}),(0,Tr.jsx)(de,{marginLeft:4,flexDirection:"column",children:(0,Tr.jsxs)(z,{color:ue.Gray,children:["Category:",U.category]})})]}),(0,Tr.jsx)(de,{marginLeft:3,flexGrow:1,children:(0,Tr.jsx)(z,{color:ue.Gray,children:U.description})})]},U.id)})}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsxs)(z,{color:ue.AccentBlue,children:["Page ",l+1," of ",B]})}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.Gray,children:"Navigation:"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2191/\u2193 or j/k - Navigate up/down"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 \u2190/\u2192 or h/l - Previous/Next page"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 Enter - View details"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]})]})},J=()=>h?(0,Tr.jsxs)(de,{flexDirection:"column",children:[(0,Tr.jsx)(z,{bold:!0,children:h.name}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentBlue,children:h.description})}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"Details:"}),(0,Tr.jsxs)(z,{children:[" \u2022 Model: ",h.modelName]}),(0,Tr.jsxs)(z,{children:[" \u2022 Category: ",h.category]}),(0,Tr.jsxs)(z,{children:[" \u2022 Version: ",h.version]})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"Tools:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:(()=>{if(!h.tools)return"All tools available (inherit)";try{let j=JSON.parse(h.tools);return Array.isArray(j)?j.length>0?j.join(", ")+" (inherit)":"All tools available (inherit)":(h.tools||"All tools available")+" (inherit)"}catch{return(h.tools||"All tools available")+" (inherit)"}})()})})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"MCP Servers:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:(()=>{if(!h.mcps||h.mcps.trim()==="")return"All MCP servers available (inherit)";try{let j=JSON.parse(h.mcps);return Array.isArray(j)?j.length>0?j.join(", ")+" (inherit)":"All MCP servers available (inherit)":(h.mcps||"All MCP servers available")+" (inherit)"}catch{return(h.mcps||"All MCP servers available")+" (inherit)"}})()})})]}),h.detailContext&&(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentCyan,children:"System Prompt:"}),(0,Tr.jsx)(de,{marginLeft:2,children:(0,Tr.jsx)(z,{children:h.detailContext.length>800?`${h.detailContext.substring(0,800)}...`:h.detailContext})})]}),(0,Tr.jsxs)(de,{marginTop:1,flexDirection:"column",children:[(0,Tr.jsx)(z,{color:ue.AccentYellow,children:"Actions:"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 1 - Install for project"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 2 - Install for user"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 b - Back to list"}),(0,Tr.jsx)(z,{color:ue.Gray,children:" \u2022 q - Exit"})]}),C&&(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsxs)(z,{color:ue.AccentGreen,children:["\u2705 ",C]})}),E&&(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{color:ue.AccentRed,children:E})})]}):null;return i==="loading"?(0,Tr.jsxs)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Tr.jsx)(z,{bold:!0,children:"Loading Agents..."}),(0,Tr.jsx)(de,{marginTop:1,children:(0,Tr.jsx)(z,{children:"Please wait while we fetch available agents..."})})]}):(0,Tr.jsx)(de,{borderStyle:"round",borderColor:ue.Gray,flexDirection:"column",padding:1,width:"100%",children:i==="list"?q():J()})}var _v=Qe(on(),1);var jr=Qe(wt(),1);import u9e from"fs/promises";import c9e from"path";import D3r from"os";function BWt({config:t,onExit:e,onStatusUpdate:n}){let[r,i]=(0,_v.useState)("loading"),[o,s]=(0,_v.useState)([]),[a,l]=(0,_v.useState)(1),[u,c]=(0,_v.useState)(0),[d,h]=(0,_v.useState)(null),[m,E]=(0,_v.useState)(null),[y,C]=(0,_v.useState)(null),[_,w]=(0,_v.useState)(0),B=10,R=Math.ceil(_/B);(0,_v.useEffect)(()=>{let U=async V=>{try{let O=t?.getContentGeneratorConfig()?.apiKey;if(!O)throw new Error("API key not found. Please authenticate first.");let Y=new URL("https://apis.iflow.cn/v1/commands/list"),ee=await fetch(Y.toString(),{method:"POST",headers:{Authorization:`Bearer ${O}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:V,size:B})});if(!ee.ok){let De="Unable to load commands. Please try again later";throw ee.status===401?De="Authentication failed. Please check your API key or re-authenticate":ee.status===403?De="Access denied. Please check your permissions":ee.status===404?De="Commands service not found. Please try again later":ee.status>=500&&(De="Server error. Please try again later"),new Error(De)}let ne=await ee.json();if(!ne.success)throw new Error(ne.message||"Failed to fetch commands");let Ae=Array.isArray(ne.data?.data)?ne.data.data:[],Ce=ne.data?.total||Ae.length;return{commands:Ae,total:Ce}}catch(O){throw new Error(`Failed to fetch commands: ${O}`)}};(async()=>{try{let V=await U(a);s(V.commands),w(V.total),i("list"),c(0),V.commands.length===0&&E("No commands found in the online repository.")}catch(V){E(V instanceof Error?V.message:"Failed to load commands"),i("list"),c(0)}})()},[a,t]);let F=U=>U.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),q=U=>U==="user"?c9e.join(D3r.homedir(),".iflow","commands"):c9e.join(process.cwd(),".iflow","commands"),J=async(U,se)=>{try{let V=q(se);await u9e.mkdir(V,{recursive:!0});let O=`${F(U.name)}.toml`,Y=c9e.join(V,O);try{return await u9e.access(Y),{success:!1,message:`Command '${U.name}' is already installed in your ${se} scope.`}}catch{}let ee=`# Command: ${U.name}
2656
2656
  # Description: ${U.description}
2657
2657
  # Category: ${U.category}
2658
2658
  # Version: ${U.version}