@openduo/duoduo 0.2.11 → 0.2.12

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.
@@ -3,7 +3,7 @@ var xde=Object.create;var xT=Object.defineProperty;var $de=Object.getOwnProperty
3
3
  `;for(let s=0;s<n;++s){let o=e.nodes[s],a=t+(s===i?" ":"│ ");r+=t,r+=s===i?"└─":"├─",r+=o.nodes.length===0?"─ ":"┬ ",r+=LF(o,a).slice(t.length+2)}return r}qF.exports={TimeTree:RT}});var V_=T((dtt,UF)=>{"use strict";var{debuglog:Bde}=ie("node:util"),Wde=Bde("avvio");UF.exports={debug:Wde}});var VF=T((ftt,ZF)=>{"use strict";function Jde(){let e={resolve:null,reject:null,promise:null};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}ZF.exports={createPromise:Jde}});var BF=T((ptt,HF)=>{"use strict";var{kPluginMeta:PT}=Fc();function Gde(e,t){return e[PT]&&e[PT].name?e[PT].name:t&&t.name?t.name:e.name?e.name:e.toString().split(`
4
4
  `).slice(0,2).map(r=>r.trim()).join(" -- ")}HF.exports={getPluginName:Gde}});var H_=T((htt,WF)=>{"use strict";function Kde(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}WF.exports={isPromiseLike:Kde}});var GF=T((mtt,JF)=>{"use strict";var{EventEmitter:Yde}=ie("node:events"),{inherits:Xde}=ie("node:util"),{debug:fn}=V_(),{createPromise:Qde}=VF(),{AVV_ERR_PLUGIN_EXEC_TIMEOUT:efe}=Z_(),{getPluginName:tfe}=BF(),{isPromiseLike:rfe}=H_();function Uc(e,t,r,n,i){this.queue=e,this.func=t,this.options=r,this.isAfter=n,this.timeout=i,this.started=!1,this.name=tfe(t,r),this.queue.pause(),this._error=null,this.loaded=!1,this._promise=null,this.startTime=null}Xde(Uc,Yde);Uc.prototype.exec=function(e,t){fn("exec",this.name),this.server=e;let r=this.func,n=this.name,i=!1;this.options=typeof this.options=="function"?this.options(this.server):this.options;let s=null,o=u=>{if(i){fn("loading complete",n);return}this._error=u,fn(u?"exec errored":"exec completed",n),i=!0,s&&clearTimeout(s),t(u)};this.timeout>0&&(fn("setting up timeout",n,this.timeout),s=setTimeout(function(){fn("timed out",n),s=null;let u=new efe(n);u.fn=r,o(u)},this.timeout)),this.started=!0,this.startTime=Date.now(),this.emit("start",this.server?this.server.name:null,this.name,Date.now());let a=r(this.server,this.options,o);rfe(a)?(fn("exec: resolving promise",n),a.then(()=>process.nextTick(o),u=>process.nextTick(o,u))):r.length<3&&o()};Uc.prototype.loadedSoFar=function(){if(fn("loadedSoFar",this.name),this.loaded)return Promise.resolve();let e=()=>{this.server.after((r,n)=>{this._error=r,this.queue.pause(),this._promise&&(r?(fn("rejecting promise",this.name,r),this._promise.reject(r)):(fn("resolving promise",this.name),this._promise.resolve()),this._promise=null),process.nextTick(n,r)}),this.queue.resume()},t;return this._promise?t=Promise.resolve():(this._promise=Qde(),t=this._promise.promise,this.server?e():this.on("start",e)),t};Uc.prototype.enqueue=function(e,t){fn("enqueue",this.name,e.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.queue.push(e,t)};Uc.prototype.finish=function(e,t){fn("finish",this.name,e);let r=()=>{this.loaded||(fn("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,t(e))};if(e){this._promise&&(this._promise.reject(e),this._promise=null),r();return}let n=()=>{if(fn("check",this.name,this.queue.length(),this.queue.running(),this._promise),this.queue.length()===0&&this.queue.running()===0)if(this._promise){let i=()=>{fn("wrap"),queueMicrotask(n)};this._promise.resolve(),this._promise.promise.then(i,i),this._promise=null}else r();else fn("delayed",this.name),this.queue.drain=()=>{fn("drain",this.name),this.queue.drain=nfe,queueMicrotask(n)}};queueMicrotask(n),this.queue.resume()};function nfe(){}JF.exports={Plugin:Uc}});var YF=T((gtt,KF)=>{"use strict";var{AVV_ERR_PLUGIN_NOT_VALID:IT}=Z_();function ife(e){if(!(e&&(typeof e=="function"||typeof e.then=="function")))throw Array.isArray(e)?new IT("array"):e===null?new IT("null"):new IT(typeof e)}KF.exports={validatePlugin:ife}});var QF=T((ytt,XF)=>{"use strict";function sfe(e){return e!==null&&typeof e=="object"&&typeof e.default=="function"}XF.exports={isBundledOrTypescriptPlugin:sfe}});var rU=T((_tt,tU)=>{"use strict";var{debug:eU}=V_(),{kThenifyDoNotWrap:OT}=Fc();function ofe(){if(this.booted){eU("thenify returning undefined because we are already booted");return}if(this[OT]){this[OT]=!1;return}return eU("thenify"),(e,t)=>this._loadRegistered().then(()=>(this[OT]=!0,e(this._server)),t)}tU.exports={thenify:ofe}});var iU=T((vtt,nU)=>{"use strict";var{isPromiseLike:afe}=H_(),{kAvvio:ufe}=Fc();function lfe(e,t,r){let n=e.apply(e,t);afe(n)&&!n[ufe]?n.then(()=>process.nextTick(r),i=>process.nextTick(r,i)):r&&process.nextTick(r)}nU.exports={executeWithThenable:lfe}});var pU=T((btt,fU)=>{"use strict";var B_=CF(),cfe=ie("node:events").EventEmitter,dfe=ie("node:util").inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:ah,AVV_ERR_CALLBACK_NOT_FN:Zc,AVV_ERR_ROOT_PLG_BOOTED:ffe,AVV_ERR_READY_TIMEOUT:pfe,AVV_ERR_ATTRIBUTE_ALREADY_DEFINED:hfe}=Z_(),{kAvvio:aU,kIsOnCloseHandler:uU}=Fc(),{TimeTree:mfe}=FF(),{Plugin:lU}=GF(),{debug:Vc}=V_(),{validatePlugin:gfe}=YF(),{isBundledOrTypescriptPlugin:yfe}=QF(),{isPromiseLike:_fe}=H_(),{thenify:cU}=rU(),{executeWithThenable:sU}=iU();function Vr(e,t,r){if(typeof e=="function"&&arguments.length===1&&(r=e,t={},e=null),typeof t=="function"&&(r=t,t={}),t=t||{},t.autostart=t.autostart!==!1,t.timeout=Number(t.timeout)||0,t.expose=t.expose||{},!new.target)return new Vr(e,t,r);this._server=e||this,this._opts=t,e&&this._expose(),this._current=[],this._error=null,this._lastUsed=null,this.setMaxListeners(0),r&&this.once("start",r),this.started=!1,this.booted=!1,this.pluginTree=new mfe,this._readyQ=B_(this,dU,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=oU},this._closeQ=B_(this,bfe,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=oU},this._doStart=null;let n=this;this._root=new lU(B_(this,this._loadPluginNextTick,1),function(s,o,a){n._doStart=a,o.autostart&&n.start()},t,!1,0),this._trackPluginLoading(this._root),this._loadPlugin(this._root,i=>{Vc("root plugin ready");try{this.emit("preReady"),this._root=null}catch(s){i=i||this._error||s}if(i){if(this._error=i,this._readyQ.length()===0)throw i}else this.booted=!0;this._readyQ.resume()})}dfe(Vr,cfe);Vr.prototype.start=function(){return this.started=!0,process.nextTick(this._doStart),this};Vr.prototype.override=function(e,t,r){return e};Vr.prototype[aU]=!0;Vr.prototype.use=function(e,t){return this._lastUsed=this._addPlugin(e,t,!1),this};Vr.prototype._loadRegistered=function(){let e=this._current[0];return!this.started&&!this.booted&&process.nextTick(()=>this._root.queue.resume()),e?e.loadedSoFar():Promise.resolve()};Object.defineProperty(Vr.prototype,"then",{get:cU});Vr.prototype._addPlugin=function(e,t,r){if(yfe(e)&&(e=e.default),gfe(e),t=t||{},this.booted)throw new ffe;let n=this._current[0],i=this._opts.timeout;if(!n.loaded&&n.timeout>0){let o=Date.now()-n.startTime;i=n.timeout-(o+3)}let s=new lU(B_(this,this._loadPluginNextTick,1),e,t,r,i);if(this._trackPluginLoading(s),n.loaded)throw new Error(s.name,n.name);return n.enqueue(s,o=>{o&&(this._error=o)}),s};Vr.prototype._expose=function(){let t=this,r=t._server,{use:n="use",after:i="after",ready:s="ready",onClose:o="onClose",close:a="close"}=this._opts.expose;if(r[n])throw new ah(n,"use");if(r[n]=function(u,l){return t.use(u,l),this},r[i])throw new ah(i,"after");if(r[i]=function(u){return typeof u!="function"?t._loadRegistered():(t.after(CT(u,this)),this)},r[s])throw new ah(s,"ready");if(r[s]=function(u){if(u&&typeof u!="function")throw new Zc(s,typeof u);return t.ready(u?CT(u,this):void 0)},r[o])throw new ah(o,"onClose");if(r[o]=function(u){if(typeof u!="function")throw new Zc(o,typeof u);return t.onClose(wfe(u,this)),this},r[a])throw new ah(a,"close");if(r[a]=function(u){if(u&&typeof u!="function")throw new Zc(a,typeof u);return u?(t.close(CT(u,this)),this):t.close()},r.then)throw new hfe("then");Object.defineProperty(r,"then",{get:cU.bind(t)}),r[aU]=!0};Vr.prototype.after=function(e){if(!e)return this._loadRegistered();this._addPlugin(t.bind(this),{},!0);function t(r,n,i){dU.call(this,e,i)}return this};Vr.prototype.onClose=function(e){if(typeof e!="function")throw new Zc("onClose",typeof e);return e[uU]=!0,this._closeQ.unshift(e,t=>{t&&(this._error=t)}),this};Vr.prototype.close=function(e){let t;if(e){if(typeof e!="function")throw new Zc("close",typeof e)}else t=new Promise(function(r,n){e=function(i){if(i)return n(i);r()}});return this.ready(()=>{this._error=null,this._closeQ.push(e),process.nextTick(this._closeQ.resume.bind(this._closeQ))}),t};Vr.prototype.ready=function(e){if(e){if(typeof e!="function")throw new Zc("ready",typeof e);this._readyQ.push(e),queueMicrotask(this.start.bind(this));return}return new Promise((t,r)=>{this._readyQ.push(i),this.start();let n=this._current[0].server;function i(s,o,a){s?r(s):t(n),process.nextTick(a)}})};Vr.prototype._trackPluginLoading=function(e){let t=this._current[0]?.name||null;e.once("start",(r,n,i)=>{let s=this.pluginTree.start(t||null,n,i);e.once("loaded",(o,a,u)=>{this.pluginTree.stop(s,u)})})};Vr.prototype.prettyPrint=function(){return this.pluginTree.prettyPrint()};Vr.prototype.toJSON=function(){return this.pluginTree.toJSON()};Vr.prototype._loadPlugin=function(e,t){let r=this;if(_fe(e.func)){e.func.then(o=>{typeof o.default=="function"&&(o=o.default),e.func=o,this._loadPlugin(e,t)},t);return}let n=r._current[0];if(r._current.unshift(e),r._error&&!e.isAfter){Vc("skipping loading of plugin as instance errored and it is not an after",e.name),process.nextTick(s);return}let i=n&&n.server||r._server;if(!e.isAfter)try{i=r.override(i,e.func,e.options)}catch(o){return Vc("override errored",e.name),s(o)}e.exec(i,s);function s(o){e.finish(o,a=>{r._current.shift(),t(a)})}};Vr.prototype._loadPluginNextTick=function(e,t){process.nextTick(this._loadPlugin.bind(this),e,t)};function oU(){}function dU(e,t){let r=this._server,n=this._error;if(this._error=null,e.length===0)this._error=n,sU(e,[],t);else if(e.length===1)sU(e,[n],t);else if(this._opts.timeout===0){let i=s=>{this._error=s,t(this._error)};e.length===2?e(n,i):e(n,r,i)}else vfe.call(this,e,n,r,t)}function vfe(e,t,r,n){let i=e.unwrappedName??e.name;Vc("setting up ready timeout",i,this._opts.timeout);let s=setTimeout(()=>{Vc("timed out",i),s=null;let a=new pfe(i);a.fn=e,this._error=a,n(a)},this._opts.timeout);e.length===2?e(t,o.bind(this)):e(t,r,o.bind(this));function o(a){s&&(clearTimeout(s),this._error=a,n(this._error))}}function bfe(e,t){let r=this._server,n=e[uU];if(e.length===0||e.length===1){let i;n?i=e(r):i=e(this._error),i&&typeof i.then=="function"?(Vc("resolving close/onClose promise"),i.then(()=>process.nextTick(t),s=>process.nextTick(t,s))):process.nextTick(t)}else e.length===2?e(n?r:this._error,t):n?e(r,t):e(this._error,r,t)}function wfe(e,t){return r.bind(t);function r(n,i){let s;e.length===0?(s=e(),s&&s.then?s.then(function(){process.nextTick(i)},i):process.nextTick(i)):e.length===1?(s=e(this),s&&s.then?s.then(function(){process.nextTick(i)},i):process.nextTick(i)):e(this,i)}}function CT(e,t){let r=n.bind(t);return r.unwrappedName=e.name,r;function n(i,s){let o;e?e.length===0?(o=e(),o&&o.then?o.then(function(){process.nextTick(s,i)},s):process.nextTick(s,i)):e.length===1?(o=e(i),o&&o.then?o.then(function(){process.nextTick(s)},s):process.nextTick(s)):e.length===2?e(i,s):e(i,this,s):process.nextTick(s)}}fU.exports=Vr});var Hr=T((wtt,hU)=>{"use strict";var Sfe={kAvvioBoot:Symbol("fastify.avvioBoot"),kChildren:Symbol("fastify.children"),kServerBindings:Symbol("fastify.serverBindings"),kBodyLimit:Symbol("fastify.bodyLimit"),kSupportedHTTPMethods:Symbol("fastify.acceptedHTTPMethods"),kRoutePrefix:Symbol("fastify.routePrefix"),kLogLevel:Symbol("fastify.logLevel"),kLogSerializers:Symbol("fastify.logSerializers"),kHooks:Symbol("fastify.hooks"),kContentTypeParser:Symbol("fastify.contentTypeParser"),kState:Symbol("fastify.state"),kOptions:Symbol("fastify.options"),kDisableRequestLogging:Symbol("fastify.disableRequestLogging"),kPluginNameChain:Symbol("fastify.pluginNameChain"),kRouteContext:Symbol("fastify.context"),kGenReqId:Symbol("fastify.genReqId"),kHttp2ServerSessions:Symbol("fastify.http2ServerSessions"),kSchemaController:Symbol("fastify.schemaController"),kSchemaHeaders:Symbol("headers-schema"),kSchemaParams:Symbol("params-schema"),kSchemaQuerystring:Symbol("querystring-schema"),kSchemaBody:Symbol("body-schema"),kSchemaResponse:Symbol("response-schema"),kSchemaErrorFormatter:Symbol("fastify.schemaErrorFormatter"),kSchemaVisited:Symbol("fastify.schemas.visited"),kRequest:Symbol("fastify.Request"),kRequestPayloadStream:Symbol("fastify.RequestPayloadStream"),kRequestAcceptVersion:Symbol("fastify.RequestAcceptVersion"),kRequestCacheValidateFns:Symbol("fastify.request.cache.validateFns"),kRequestOriginalUrl:Symbol("fastify.request.originalUrl"),kFourOhFour:Symbol("fastify.404"),kCanSetNotFoundHandler:Symbol("fastify.canSetNotFoundHandler"),kFourOhFourLevelInstance:Symbol("fastify.404LogLevelInstance"),kFourOhFourContext:Symbol("fastify.404ContextKey"),kDefaultJsonParse:Symbol("fastify.defaultJSONParse"),kReply:Symbol("fastify.Reply"),kReplySerializer:Symbol("fastify.reply.serializer"),kReplyIsError:Symbol("fastify.reply.isError"),kReplyHeaders:Symbol("fastify.reply.headers"),kReplyTrailers:Symbol("fastify.reply.trailers"),kReplyHasStatusCode:Symbol("fastify.reply.hasStatusCode"),kReplyHijacked:Symbol("fastify.reply.hijacked"),kReplyStartTime:Symbol("fastify.reply.startTime"),kReplyNextErrorHandler:Symbol("fastify.reply.nextErrorHandler"),kReplyEndTime:Symbol("fastify.reply.endTime"),kReplyErrorHandlerCalled:Symbol("fastify.reply.errorHandlerCalled"),kReplyIsRunningOnErrorHook:Symbol("fastify.reply.isRunningOnErrorHook"),kReplySerializerDefault:Symbol("fastify.replySerializerDefault"),kReplyCacheSerializeFns:Symbol("fastify.reply.cache.serializeFns"),kTestInternals:Symbol("fastify.testInternals"),kErrorHandler:Symbol("fastify.errorHandler"),kErrorHandlerAlreadySet:Symbol("fastify.errorHandlerAlreadySet"),kChildLoggerFactory:Symbol("fastify.childLoggerFactory"),kHasBeenDecorated:Symbol("fastify.hasBeenDecorated"),kKeepAliveConnections:Symbol("fastify.keepAliveConnections"),kRouteByFastify:Symbol("fastify.routeByFastify")};hU.exports=Sfe});var gU=T((Stt,W_)=>{"use strict";var{format:NT}=ie("node:util");function kfe(e){return mU({...e,name:"DeprecationWarning"})}function mU({name:e,code:t,message:r,unlimited:n=!1}={}){if(!e)throw new Error("Warning name must not be empty");if(!t)throw new Error("Warning code must not be empty");if(!r)throw new Error("Warning message must not be empty");if(typeof n!="boolean")throw new Error("Warning opts.unlimited must be a boolean");t=t.toUpperCase();let i={[e]:function(o,a,u){s.emitted===!0&&s.unlimited!==!0||(s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code))}};n&&(i={[e]:function(o,a,u){s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code)}});let s=i[e];return s.emitted=!1,s.message=r,s.unlimited=n,s.code=t,s.format=function(o,a,u){let l;return o&&a&&u?l=NT(r,o,a,u):o&&a?l=NT(r,o,a):o?l=NT(r,o):l=r,l},s}var AT={createWarning:mU,createDeprecation:kfe};W_.exports=AT;W_.exports.default=AT;W_.exports.processWarning=AT});var Hc=T((ktt,yU)=>{"use strict";var{createWarning:uh}=gU(),xfe=uh({name:"FastifyWarning",code:"FSTWRN001",message:"The %s schema for %s: %s is missing. This may indicate the schema is not well specified.",unlimited:!0}),$fe=uh({name:"FastifyWarning",code:"FSTWRN003",message:"The %s mixes async and callback styles that may lead to unhandled rejections. Please use only one of them.",unlimited:!0}),Efe=uh({name:"FastifyWarning",code:"FSTWRN004",message:"It seems that you are overriding an errorHandler in the same scope, which can lead to subtle bugs.",unlimited:!0}),Tfe=uh({name:"FastifySecurity",code:"FSTSEC001",message:'You are using /%s/ Content-Type which may be vulnerable to CORS attack. Please make sure your RegExp start with "^" or include ";?" to proper detection of the essence MIME type.',unlimited:!0}),Rfe=uh({name:"FastifyWarning",code:"FSTDEP022",message:'The router options for %s property access is deprecated. Please use "options.routerOptions" instead for accessing router options. The router options will be removed in `fastify@6`.',unlimited:!0});yU.exports={FSTWRN001:xfe,FSTWRN003:$fe,FSTWRN004:Efe,FSTSEC001:Tfe,FSTDEP022:Rfe}});var tn=T((xtt,J_)=>{"use strict";var pe=ET(),il={FST_ERR_NOT_FOUND:pe("FST_ERR_NOT_FOUND","Not Found",404),FST_ERR_OPTIONS_NOT_OBJ:pe("FST_ERR_OPTIONS_NOT_OBJ","Options must be an object",500,TypeError),FST_ERR_QSP_NOT_FN:pe("FST_ERR_QSP_NOT_FN","querystringParser option should be a function, instead got '%s'",500,TypeError),FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:pe("FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN","schemaController.bucket option should be a function, instead got '%s'",500,TypeError),FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:pe("FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN","schemaErrorFormatter option should be a non async function. Instead got '%s'.",500,TypeError),FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:pe("FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ","ajv.customOptions option should be an object, instead got '%s'",500,TypeError),FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:pe("FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR","ajv.plugins option should be an array, instead got '%s'",500,TypeError),FST_ERR_VALIDATION:pe("FST_ERR_VALIDATION","%s",400),FST_ERR_LISTEN_OPTIONS_INVALID:pe("FST_ERR_LISTEN_OPTIONS_INVALID","Invalid listen options: '%s'",500,TypeError),FST_ERR_ERROR_HANDLER_NOT_FN:pe("FST_ERR_ERROR_HANDLER_NOT_FN","Error Handler must be a function",500,TypeError),FST_ERR_ERROR_HANDLER_ALREADY_SET:pe("FST_ERR_ERROR_HANDLER_ALREADY_SET","Error Handler already set in this scope. Set 'allowErrorHandlerOverride: true' to allow overriding.",500,TypeError),FST_ERR_CTP_ALREADY_PRESENT:pe("FST_ERR_CTP_ALREADY_PRESENT","Content type parser '%s' already present."),FST_ERR_CTP_INVALID_TYPE:pe("FST_ERR_CTP_INVALID_TYPE","The content type should be a string or a RegExp",500,TypeError),FST_ERR_CTP_EMPTY_TYPE:pe("FST_ERR_CTP_EMPTY_TYPE","The content type cannot be an empty string",500,TypeError),FST_ERR_CTP_INVALID_HANDLER:pe("FST_ERR_CTP_INVALID_HANDLER","The content type handler should be a function",500,TypeError),FST_ERR_CTP_INVALID_PARSE_TYPE:pe("FST_ERR_CTP_INVALID_PARSE_TYPE","The body parser can only parse your data as 'string' or 'buffer', you asked '%s' which is not supported.",500,TypeError),FST_ERR_CTP_BODY_TOO_LARGE:pe("FST_ERR_CTP_BODY_TOO_LARGE","Request body is too large",413,RangeError),FST_ERR_CTP_INVALID_MEDIA_TYPE:pe("FST_ERR_CTP_INVALID_MEDIA_TYPE","Unsupported Media Type: %s",415),FST_ERR_CTP_INVALID_CONTENT_LENGTH:pe("FST_ERR_CTP_INVALID_CONTENT_LENGTH","Request body size did not match Content-Length",400,RangeError),FST_ERR_CTP_EMPTY_JSON_BODY:pe("FST_ERR_CTP_EMPTY_JSON_BODY","Body cannot be empty when content-type is set to 'application/json'",400),FST_ERR_CTP_INVALID_JSON_BODY:pe("FST_ERR_CTP_INVALID_JSON_BODY","Body is not valid JSON but content-type is set to 'application/json'",400),FST_ERR_CTP_INSTANCE_ALREADY_STARTED:pe("FST_ERR_CTP_INSTANCE_ALREADY_STARTED",'Cannot call "%s" when fastify instance is already started!',400),FST_ERR_DEC_ALREADY_PRESENT:pe("FST_ERR_DEC_ALREADY_PRESENT","The decorator '%s' has already been added!"),FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:pe("FST_ERR_DEC_DEPENDENCY_INVALID_TYPE","The dependencies of decorator '%s' must be of type Array.",500,TypeError),FST_ERR_DEC_MISSING_DEPENDENCY:pe("FST_ERR_DEC_MISSING_DEPENDENCY","The decorator is missing dependency '%s'."),FST_ERR_DEC_AFTER_START:pe("FST_ERR_DEC_AFTER_START","The decorator '%s' has been added after start!"),FST_ERR_DEC_REFERENCE_TYPE:pe("FST_ERR_DEC_REFERENCE_TYPE","The decorator '%s' of type '%s' is a reference type. Use the { getter, setter } interface instead."),FST_ERR_DEC_UNDECLARED:pe("FST_ERR_DEC_UNDECLARED","No decorator '%s' has been declared on %s."),FST_ERR_HOOK_INVALID_TYPE:pe("FST_ERR_HOOK_INVALID_TYPE","The hook name must be a string",500,TypeError),FST_ERR_HOOK_INVALID_HANDLER:pe("FST_ERR_HOOK_INVALID_HANDLER","%s hook should be a function, instead got %s",500,TypeError),FST_ERR_HOOK_INVALID_ASYNC_HANDLER:pe("FST_ERR_HOOK_INVALID_ASYNC_HANDLER","Async function has too many arguments. Async hooks should not use the 'done' argument.",500,TypeError),FST_ERR_HOOK_NOT_SUPPORTED:pe("FST_ERR_HOOK_NOT_SUPPORTED","%s hook not supported!",500,TypeError),FST_ERR_MISSING_MIDDLEWARE:pe("FST_ERR_MISSING_MIDDLEWARE","You must register a plugin for handling middlewares, visit fastify.dev/docs/latest/Reference/Middleware/ for more info.",500),FST_ERR_HOOK_TIMEOUT:pe("FST_ERR_HOOK_TIMEOUT","A callback for '%s' hook%s timed out. You may have forgotten to call 'done' function or to resolve a Promise"),FST_ERR_LOG_INVALID_DESTINATION:pe("FST_ERR_LOG_INVALID_DESTINATION","Cannot specify both logger.stream and logger.file options"),FST_ERR_LOG_INVALID_LOGGER:pe("FST_ERR_LOG_INVALID_LOGGER","Invalid logger object provided. The logger instance should have these functions(s): '%s'.",500,TypeError),FST_ERR_LOG_INVALID_LOGGER_INSTANCE:pe("FST_ERR_LOG_INVALID_LOGGER_INSTANCE","loggerInstance only accepts a logger instance.",500,TypeError),FST_ERR_LOG_INVALID_LOGGER_CONFIG:pe("FST_ERR_LOG_INVALID_LOGGER_CONFIG","logger options only accepts a configuration object.",500,TypeError),FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:pe("FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED","You cannot provide both logger and loggerInstance. Please provide only one.",500,TypeError),FST_ERR_REP_INVALID_PAYLOAD_TYPE:pe("FST_ERR_REP_INVALID_PAYLOAD_TYPE","Attempted to send payload of invalid type '%s'. Expected a string or Buffer.",500,TypeError),FST_ERR_REP_RESPONSE_BODY_CONSUMED:pe("FST_ERR_REP_RESPONSE_BODY_CONSUMED","Response.body is already consumed."),FST_ERR_REP_READABLE_STREAM_LOCKED:pe("FST_ERR_REP_READABLE_STREAM_LOCKED","ReadableStream was locked. You should call releaseLock() method on reader before sending."),FST_ERR_REP_ALREADY_SENT:pe("FST_ERR_REP_ALREADY_SENT",'Reply was already sent, did you forget to "return reply" in "%s" (%s)?'),FST_ERR_REP_SENT_VALUE:pe("FST_ERR_REP_SENT_VALUE","The only possible value for reply.sent is true.",500,TypeError),FST_ERR_SEND_INSIDE_ONERR:pe("FST_ERR_SEND_INSIDE_ONERR","You cannot use `send` inside the `onError` hook"),FST_ERR_SEND_UNDEFINED_ERR:pe("FST_ERR_SEND_UNDEFINED_ERR","Undefined error has occurred"),FST_ERR_BAD_STATUS_CODE:pe("FST_ERR_BAD_STATUS_CODE","Called reply with an invalid status code: %s"),FST_ERR_BAD_TRAILER_NAME:pe("FST_ERR_BAD_TRAILER_NAME","Called reply.trailer with an invalid header name: %s"),FST_ERR_BAD_TRAILER_VALUE:pe("FST_ERR_BAD_TRAILER_VALUE","Called reply.trailer('%s', fn) with an invalid type: %s. Expected a function."),FST_ERR_FAILED_ERROR_SERIALIZATION:pe("FST_ERR_FAILED_ERROR_SERIALIZATION","Failed to serialize an error. Error: %s. Original error: %s"),FST_ERR_MISSING_SERIALIZATION_FN:pe("FST_ERR_MISSING_SERIALIZATION_FN",'Missing serialization function. Key "%s"'),FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:pe("FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN",'Missing serialization function. Key "%s:%s"'),FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:pe("FST_ERR_REQ_INVALID_VALIDATION_INVOCATION",'Invalid validation invocation. Missing validation function for HTTP part "%s" nor schema provided.'),FST_ERR_SCH_MISSING_ID:pe("FST_ERR_SCH_MISSING_ID","Missing schema $id property"),FST_ERR_SCH_ALREADY_PRESENT:pe("FST_ERR_SCH_ALREADY_PRESENT","Schema with id '%s' already declared!"),FST_ERR_SCH_CONTENT_MISSING_SCHEMA:pe("FST_ERR_SCH_CONTENT_MISSING_SCHEMA","Schema is missing for the content type '%s'"),FST_ERR_SCH_DUPLICATE:pe("FST_ERR_SCH_DUPLICATE","Schema with '%s' already present!"),FST_ERR_SCH_VALIDATION_BUILD:pe("FST_ERR_SCH_VALIDATION_BUILD","Failed building the validation schema for %s: %s, due to error %s"),FST_ERR_SCH_SERIALIZATION_BUILD:pe("FST_ERR_SCH_SERIALIZATION_BUILD","Failed building the serialization schema for %s: %s, due to error %s"),FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX:pe("FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX",'response schemas should be nested under a valid status code, e.g { 2xx: { type: "object" } }'),FST_ERR_INIT_OPTS_INVALID:pe("FST_ERR_INIT_OPTS_INVALID","Invalid initialization options: '%s'"),FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:pe("FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE","Cannot set forceCloseConnections to 'idle' as your HTTP server does not support closeIdleConnections method"),FST_ERR_DUPLICATED_ROUTE:pe("FST_ERR_DUPLICATED_ROUTE","Method '%s' already declared for route '%s'"),FST_ERR_BAD_URL:pe("FST_ERR_BAD_URL","'%s' is not a valid url component",400,URIError),FST_ERR_ASYNC_CONSTRAINT:pe("FST_ERR_ASYNC_CONSTRAINT","Unexpected error from async constraint",500),FST_ERR_INVALID_URL:pe("FST_ERR_INVALID_URL","URL must be a string. Received '%s'",400,TypeError),FST_ERR_ROUTE_OPTIONS_NOT_OBJ:pe("FST_ERR_ROUTE_OPTIONS_NOT_OBJ",'Options for "%s:%s" route must be an object',500,TypeError),FST_ERR_ROUTE_DUPLICATED_HANDLER:pe("FST_ERR_ROUTE_DUPLICATED_HANDLER",'Duplicate handler for "%s:%s" route is not allowed!',500),FST_ERR_ROUTE_HANDLER_NOT_FN:pe("FST_ERR_ROUTE_HANDLER_NOT_FN","Error Handler for %s:%s route, if defined, must be a function",500,TypeError),FST_ERR_ROUTE_MISSING_HANDLER:pe("FST_ERR_ROUTE_MISSING_HANDLER",'Missing handler function for "%s:%s" route.',500),FST_ERR_ROUTE_METHOD_INVALID:pe("FST_ERR_ROUTE_METHOD_INVALID","Provided method is invalid!",500,TypeError),FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:pe("FST_ERR_ROUTE_METHOD_NOT_SUPPORTED","%s method is not supported.",500),FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:pe("FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED","Body validation schema for %s:%s route is not supported!",500),FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:pe("FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT","'bodyLimit' option must be an integer > 0. Got '%s'",500,TypeError),FST_ERR_ROUTE_REWRITE_NOT_STR:pe("FST_ERR_ROUTE_REWRITE_NOT_STR",'Rewrite url for "%s" needs to be of type "string" but received "%s"',500,TypeError),FST_ERR_REOPENED_CLOSE_SERVER:pe("FST_ERR_REOPENED_CLOSE_SERVER","Fastify has already been closed and cannot be reopened"),FST_ERR_REOPENED_SERVER:pe("FST_ERR_REOPENED_SERVER","Fastify is already listening"),FST_ERR_INSTANCE_ALREADY_LISTENING:pe("FST_ERR_INSTANCE_ALREADY_LISTENING","Fastify instance is already listening. %s"),FST_ERR_PLUGIN_VERSION_MISMATCH:pe("FST_ERR_PLUGIN_VERSION_MISMATCH","fastify-plugin: %s - expected '%s' fastify version, '%s' is installed"),FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE:pe("FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE","The decorator '%s'%s is not present in %s"),FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER:pe("FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER","The %s plugin being registered mixes async and callback styles. Async plugin should not mix async and callback style.",500,TypeError),FST_ERR_PLUGIN_CALLBACK_NOT_FN:pe("FST_ERR_PLUGIN_CALLBACK_NOT_FN","fastify-plugin: %s",500,TypeError),FST_ERR_PLUGIN_NOT_VALID:pe("FST_ERR_PLUGIN_NOT_VALID","fastify-plugin: %s"),FST_ERR_ROOT_PLG_BOOTED:pe("FST_ERR_ROOT_PLG_BOOTED","fastify-plugin: %s"),FST_ERR_PARENT_PLUGIN_BOOTED:pe("FST_ERR_PARENT_PLUGIN_BOOTED","fastify-plugin: %s"),FST_ERR_PLUGIN_TIMEOUT:pe("FST_ERR_PLUGIN_TIMEOUT","fastify-plugin: %s")};function Pfe(e,t){return t.cause=e,t}J_.exports=il;J_.exports.appendStackTrace=Pfe;J_.exports.AVVIO_ERRORS_MAP={AVV_ERR_CALLBACK_NOT_FN:il.FST_ERR_PLUGIN_CALLBACK_NOT_FN,AVV_ERR_PLUGIN_NOT_VALID:il.FST_ERR_PLUGIN_NOT_VALID,AVV_ERR_ROOT_PLG_BOOTED:il.FST_ERR_ROOT_PLG_BOOTED,AVV_ERR_PARENT_PLG_LOADED:il.FST_ERR_PARENT_PLUGIN_BOOTED,AVV_ERR_READY_TIMEOUT:il.FST_ERR_PLUGIN_TIMEOUT,AVV_ERR_PLUGIN_EXEC_TIMEOUT:il.FST_ERR_PLUGIN_TIMEOUT}});var Da=T(($tt,EU)=>{"use strict";var Ife=["onRoute","onRegister","onReady","onListen","preClose","onClose"],wU=["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError","onRequestAbort"],Ofe=wU.concat(Ife),{FST_ERR_HOOK_INVALID_TYPE:Cfe,FST_ERR_HOOK_INVALID_HANDLER:Nfe,FST_ERR_SEND_UNDEFINED_ERR:G_,FST_ERR_HOOK_TIMEOUT:Afe,FST_ERR_HOOK_NOT_SUPPORTED:Dfe,AVVIO_ERRORS_MAP:_U,appendStackTrace:vU}=tn(),{kChildren:lh,kHooks:SU,kRequestPayloadStream:bU}=Hr();function ch(){this.onRequest=[],this.preParsing=[],this.preValidation=[],this.preSerialization=[],this.preHandler=[],this.onResponse=[],this.onSend=[],this.onError=[],this.onRoute=[],this.onRegister=[],this.onReady=[],this.onListen=[],this.onTimeout=[],this.onRequestAbort=[],this.preClose=[]}ch.prototype=Object.create(null);ch.prototype.validate=function(e,t){if(typeof e!="string")throw new Cfe;if(Array.isArray(this[e])===!1)throw new Dfe(e);if(typeof t!="function")throw new Nfe(e,Object.prototype.toString.call(t))};ch.prototype.add=function(e,t){this.validate(e,t),this[e].push(t)};function jfe(e){let t=new ch;return t.onRequest=e.onRequest.slice(),t.preParsing=e.preParsing.slice(),t.preValidation=e.preValidation.slice(),t.preSerialization=e.preSerialization.slice(),t.preHandler=e.preHandler.slice(),t.onSend=e.onSend.slice(),t.onResponse=e.onResponse.slice(),t.onError=e.onError.slice(),t.onRoute=e.onRoute.slice(),t.onRegister=e.onRegister.slice(),t.onTimeout=e.onTimeout.slice(),t.onRequestAbort=e.onRequestAbort.slice(),t.onReady=[],t.onListen=[],t.preClose=[],t}function kU(e,t,r,n){let i=r[SU][e],s=0,o=0;u();function a(c){let d=i[s-1]?.name,p=d?` "${d}"`:"";if(c){c.code==="AVV_ERR_READY_TIMEOUT"?c=vU(c,new Afe(e,p)):c=_U[c.code]!=null?vU(c,new _U[c.code](c.message)):c,n(c);return}n()}function u(c){if(c){a(c);return}if(s===i.length&&o===r[lh].length){s===0&&o===0?a():t(function(p,f){a(p),f(p)});return}if(s===i.length&&o<r[lh].length){let d=r[lh][o++];kU(e,t,d,u);return}t(l(i[s++],r)),u()}function l(c,d){return function(p,f){if(p){f(p);return}if(c.length===1){try{c.call(d,f)}catch(h){f(h)}return}try{let h=c.call(d);if(h&&typeof h.then=="function"){h.then(f,f);return}}catch(h){p=h}f(p)}}}function xU(e){let t=e[SU].onListen,r=t.length,n=0,i=0;s();function s(a){if(a&&e.log.error(a),n===r){for(;i<e[lh].length;){let u=e[lh][i++];xU(u)}return}o(t[n++],e,s)}async function o(a,u,l){if(a.length===1){try{a.call(u,l)}catch(c){l(c)}return}try{let c=a.call(u);if(c&&typeof c.then=="function"){c.then(l,l);return}l()}catch(c){l(c)}}}function Bc(e){return function(r,n,i,s){let o=0;function a(c){if(c||o===r.length){s(c,n,i);return}let d;try{d=e(r[o++],n,i,a)}catch(p){s(p,n,i);return}d&&typeof d.then=="function"&&d.then(u,l)}function u(){a()}function l(c){c||(c=new G_),s(c,n,i)}a()}}function zfe(e,t,r,n){return e(t,r,n)}var Mfe=Bc(zfe),Lfe=Bc(dh),qfe=Bc(dh),Ffe=Bc(dh),Ufe=Bc(dh);function $U(e,t,r,n,i){let s=0;function o(l,c){if(l){i(l,t,r,n);return}if(c!==void 0&&(n=c),s===e.length){i(null,t,r,n);return}let d;try{d=e[s++](t,r,n,o)}catch(p){i(p,t,r);return}d&&typeof d.then=="function"&&d.then(a,u)}function a(l){o(null,l)}function u(l){l||(l=new G_),i(l,t,r,n)}o()}var Zfe=$U;function Vfe(e,t,r,n){let i=0;function s(u,l){if(r.sent)return;if(l!==void 0&&(t[bU]=l),u||i===e.length){n(u,t,r);return}let c;try{c=e[i++](t,r,t[bU],s)}catch(d){n(d,t,r);return}c&&typeof c.then=="function"&&c.then(o,a)}function o(u){s(null,u)}function a(u){u||(u=new G_),n(u,t,r)}s()}function Hfe(e,t,r){let n=0;function i(a){if(a||n===e.length){r(a,t);return}let u;try{u=e[n++](t,i)}catch(l){r(l,t);return}u&&typeof u.then=="function"&&u.then(s,o)}function s(){i()}function o(a){a||(a=new G_),r(a,t)}i()}function dh(e,t,r,n){if(r.sent!==!0)return e(t,r,n)}EU.exports={Hooks:ch,buildHooks:jfe,hookRunnerGenerator:Bc,preParsingHookRunner:Vfe,onResponseHookRunner:Mfe,onSendHookRunner:$U,preSerializationHookRunner:Zfe,onRequestAbortHookRunner:Hfe,hookIterator:dh,hookRunnerApplication:kU,onListenHookRunner:xU,preHandlerHookRunner:qfe,preValidationHookRunner:Lfe,onRequestHookRunner:Ufe,onTimeoutHookRunner:Ffe,lifecycleHooks:wU,supportedHooks:Ofe}});var RU=T((Ett,TU)=>{"use strict";TU.exports=function(){return{[Symbol.iterator]:function*(){},add(){},delete(){},has(){return!0}}}});var DT=T((Ttt,IU)=>{"use strict";var{kTestInternals:Bfe}=Hr();function PU(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}IU.exports={withResolvers:typeof Promise.withResolvers=="function"?Promise.withResolvers.bind(Promise):PU,[Bfe]:{withResolvers:PU}}});var FU=T((Rtt,qU)=>{"use strict";var Wfe=ie("node:http"),Jfe=ie("node:https"),OU=ie("node:http2"),Gfe=ie("node:dns"),Kfe=ie("node:os"),{kState:Mr,kOptions:Yfe,kServerBindings:Xfe,kHttp2ServerSessions:sl}=Hr(),{FSTWRN003:Qfe}=Hc(),{onListenHookRunner:K_}=Da(),{FST_ERR_REOPENED_CLOSE_SERVER:NU,FST_ERR_REOPENED_SERVER:AU,FST_ERR_LISTEN_OPTIONS_INVALID:epe,FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:tpe}=tn(),rpe=RU(),DU=DT();qU.exports.createServer=npe;function jU(e){return`Server listening at ${e}`}function npe(e,t){let r=MU(e,t);function n(l={port:0,host:"localhost"},c=void 0){if(typeof c=="function"&&(c.constructor.name==="AsyncFunction"&&Qfe("listen method"),l.cb=c),l.signal){if(typeof l.signal.on!="function"&&typeof l.signal.addEventListener!="function")throw new epe("Invalid options.signal");if(this[Mr].aborted=l.signal.aborted,this[Mr].aborted)return this.close();{let p=()=>{this[Mr].aborted=!0,this.close()};l.signal.addEventListener("abort",p,{once:!0})}}let d;if(l.path==null?d=l.host??"localhost":d=l.host,(!Object.hasOwn(l,"host")||l.host==null)&&(l.host=d),d==="localhost"?l.cb=(p,f)=>{if(p){c(p,f);return}CU.call(this,r,t,e,l,()=>{this[Mr].listening=!0,c(null,f),K_(this)})}:l.cb=(p,f)=>{if(p){c(p,f);return}this[Mr].listening=!0,c(null,f),K_(this)},c===void 0)return ipe.call(this,r,l).then(f=>{let{promise:h,resolve:v}=DU.withResolvers();return d==="localhost"?CU.call(this,r,t,e,l,()=>{this[Mr].listening=!0,v(f),K_(this)}):(v(f),K_(this)),h});this.ready(zU.call(this,r,l))}let i=typeof r.closeAllConnections=="function",s=typeof r.closeIdleConnections=="function",o=typeof r.closeHttp2Sessions=="function",a=e.forceCloseConnections;if(a==="idle"&&!s)throw new tpe;typeof a!="boolean"&&(a=s?"idle":!1);let u=!i&&a===!0?new Set:rpe();return{server:r,listen:n,forceCloseConnections:a,serverHasCloseAllConnections:i,serverHasCloseHttp2Sessions:o,keepAliveConnections:u}}function CU(e,t,r,n,i){this[Mr].listening=!1,Gfe.lookup(n.host,{all:!0},(s,o)=>{if(s||this[Mr].aborted){i();return}let a=e.listening&&r.serverFactory,u=0,l=0;if(!a){let d=e.address();for(let p of o)if(p.address!==d.address){u++;let f=Object.assign({},n,{host:p.address,port:d.port,cb:y=>{l++,y||this[Xfe].push(h),l===u&&i()}}),h=MU(r,t),v=()=>{h.close(()=>{}),typeof h.closeAllConnections=="function"&&r.forceCloseConnections===!0&&h.closeAllConnections(),typeof h.closeHttp2Sessions=="function"&&h.closeHttp2Sessions()};h.on("upgrade",e.emit.bind(e,"upgrade")),e.on("unref",v),e.on("close",v),e.on("error",v),this[Mr].listening=!1,zU.call(this,h,f)()}}if(u===0){i();return}let c=e.unref;e.unref=function(){c.call(e),e.emit("unref")}})}function zU(e,t){let r=n=>{if(e.removeListener("error",r),e.removeListener("listening",r),n)this[Mr].listening=!1,t.cb(n,null);else{let i=LU.call(this,e,t.listenTextResolver||jU);t.cb(null,i)}};return n=>{if(n!=null)return t.cb(n);if(this[Mr].listening&&this[Mr].closing)return t.cb(new NU,null);if(this[Mr].listening)return t.cb(new AU,null);e.once("error",r),this[Mr].closing||(e.once("listening",r),e.listen(t),this[Mr].listening=!0)}}function ipe(e,t){return this[Mr].listening&&this[Mr].closing?Promise.reject(new NU):this[Mr].listening?Promise.reject(new AU):this.ready().then(()=>{if(this[Mr].aborted)return;let{promise:r,resolve:n,reject:i}=DU.withResolvers(),s=u=>{a(),this[Mr].listening=!1,i(u)},o=()=>{a(),this[Mr].listening=!0,n(LU.call(this,e,t.listenTextResolver||jU))};function a(){e.removeListener("error",s),e.removeListener("listening",o)}return e.once("error",s),e.once("listening",o),e.listen(t),r})}function MU(e,t){if(e.serverFactory)return e.serverFactory(t,e);let r=e.https===!0?{}:e.https;if(e.http2){let i=typeof r=="object"?OU.createSecureServer(r,t):OU.createServer(e.http,t);return i.on("session",s=>s.setTimeout(e.http2SessionTimeout,()=>{s.close()})),e.forceCloseConnections===!0&&(i.closeHttp2Sessions=ope(i)),i.setTimeout(e.connectionTimeout),i}let n=r?Jfe.createServer(r,t):Wfe.createServer(e.http,t);return n.keepAliveTimeout=e.keepAliveTimeout,n.requestTimeout=e.requestTimeout,n.setTimeout(e.connectionTimeout),e.maxRequestsPerSocket>0&&(n.maxRequestsPerSocket=e.maxRequestsPerSocket),n}function spe(e){return e.address==="0.0.0.0"?Object.values(Kfe.networkInterfaces()).flatMap(t=>t.filter(r=>r.family==="IPv4")).sort(t=>t.internal?-1:1).map(t=>t.address):[e.address]}function LU(e,t){let r;typeof e.address()=="string"?r=[e.address()]:(e.address().address.indexOf(":")===-1?r=spe(e.address()).map(i=>i+":"+e.address().port):r=["["+e.address().address+"]:"+e.address().port],r=r.map(i=>"http"+(this[Yfe].https?"s":"")+"://"+i));for(let i of r)this.log.info(t(i));return r[0]}function ope(e){return e[sl]=new Set,e.on("session",function(t){t.once("connect",function(){e[sl].add(t)}),t.once("close",function(){e[sl].delete(t)}),t.once("frameError",function(r,n,i){i===0&&e[sl].delete(t)}),t.once("goaway",function(){e[sl].delete(t)})}),function(){if(e[sl].size!==0)for(let r of e[sl])r.close()}}});var MT=T((Ptt,VU)=>{"use strict";var jT=/([\w!#$%&'*+.^`|~-]+)=([^;]*)/gm,UU=/^[\w!#$%&'*+.^`|~-]+$/,ZU=/^[\w!#$%&'*+.^`|~-]+\s*/,zT=class{#e=!1;#r=!0;#i="";#n="";#s=new Map;#t;constructor(t){if(t==null||t===""||t==="undefined")return;let r=t.indexOf(";");if(r===-1){if(r=t.indexOf("/"),r===-1)return;let u=t.slice(0,r).trimStart().toLowerCase(),l=t.slice(r+1).trimEnd().toLowerCase();UU.test(u)===!0&&ZU.test(l)===!0&&(this.#e=!0,this.#r=!1,this.#i=u,this.#n=l);return}let n=t.slice(0,r).toLowerCase(),i=t.slice(r+1).trim();if(r=n.indexOf("/"),r===-1)return;let s=n.slice(0,r).trimStart(),o=n.slice(r+1).trimEnd();if(UU.test(s)===!1||ZU.test(o)===!1)return;this.#i=s,this.#n=o,this.#e=!0,this.#r=!1;let a=jT.exec(i);for(;a;){let u=a[1],l=a[2];if(l[0]==='"'){if(l.at(-1)!=='"'){this.#s.set(u,"invalid quoted string"),a=jT.exec(i);continue}this.#s.set(u,l.slice(1,l.length-1))}else this.#s.set(u,l);a=jT.exec(i)}}get[Symbol.toStringTag](){return"ContentType"}get isEmpty(){return this.#r}get isValid(){return this.#e}get mediaType(){return`${this.#i}/${this.#n}`}get type(){return this.#i}get subtype(){return this.#n}get parameters(){return this.#s}toString(){if(this.#t)return this.#t;let t=[];for(let[n,i]of this.#s.entries())t.push(`${n}="${i}"`);let r=[this.#i,"/",this.#n];return t.length>0&&(r.push("; "),r.push(t.join("; "))),this.#t=r.join(""),this.#t}};VU.exports=zT});var Y_=T((Itt,HU)=>{"use strict";var{kReplyHasStatusCode:ape}=Hr();function upe(e,t){if(!e[ape]||e.statusCode===200){let r=t&&(t.statusCode||t.status);e.code(r>=400?r:500)}}HU.exports={setErrorStatusCode:upe}});var LT=T((Ott,WU)=>{"use strict";var{kReplyIsError:BU,kReplyHijacked:lpe}=Hr(),{setErrorStatusCode:cpe}=Y_(),dpe=ie("node:diagnostics_channel"),fh=dpe.tracingChannel("fastify.request.handler");function fpe(e,t,r){r&&(r.async=!0),e.then(function(n){if(t[lpe]!==!0){r&&fh.asyncStart.publish(r);try{if(n!==void 0||t.sent===!1&&t.raw.headersSent===!1&&t.request.raw.aborted===!1&&t.request.socket&&!t.request.socket.destroyed)try{t.send(n)}catch(i){t[BU]=!0,t.send(i)}}finally{r&&fh.asyncEnd.publish(r)}}},function(n){r&&(r.error=n,cpe(t,n),fh.error.publish(r),fh.asyncStart.publish(r));try{if(t.sent===!0){t.log.error({err:n},"Promise errored, but reply.sent = true was set");return}t[BU]=!0,t.send(n)}catch(i){t.send(i)}finally{r&&fh.asyncEnd.publish(r)}})}WU.exports=fpe});var UT=T((Ctt,GU)=>{"use strict";var{kSchemaHeaders:ev,kSchemaParams:qT,kSchemaQuerystring:FT,kSchemaBody:ol,kSchemaResponse:JU}=Hr(),ppe=/^[1-5](?:\d{2}|xx)$|^default$/,{FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX:hpe}=tn(),{FSTWRN001:X_}=Hc();function mpe(e,t){if(!e.schema||!e.schema.response)return;let{method:r,url:n}=e.config||{};e[JU]=Object.keys(e.schema.response).reduce(function(i,s){let o=e.schema.response[s];if(s=s.toLowerCase(),!ppe.test(s))throw new hpe;if(o.content){let a={};for(let u of Object.keys(o.content)){let l=o.content[u].schema;a[u]=t({schema:l,url:n,method:r,httpStatus:s,contentType:u})}i[s]=a}else i[s]=t({schema:o,url:n,method:r,httpStatus:s});return i},{})}function gpe(e,t,r){let{schema:n}=e;if(!n)return;let{method:i,url:s}=e.config||{},o=n.headers;if(o&&(r||Object.getPrototypeOf(o)!==Object.prototype))e[ev]=t({schema:o,method:i,url:s,httpPart:"headers"});else if(o){let a={};Object.keys(o).forEach(u=>{a[u]=o[u]}),a.required instanceof Array&&(a.required=a.required.map(u=>u.toLowerCase())),o.properties&&(a.properties={},Object.keys(o.properties).forEach(u=>{a.properties[u.toLowerCase()]=o.properties[u]})),e[ev]=t({schema:a,method:i,url:s,httpPart:"headers"})}else Object.hasOwn(n,"headers")&&X_("headers",i,s);if(n.body){let a=n.body.content;if(a){let u={};for(let l of Object.keys(a)){let c=a[l].schema;u[l]=t({schema:c,method:i,url:s,httpPart:"body",contentType:l})}e[ol]=u}else e[ol]=t({schema:n.body,method:i,url:s,httpPart:"body"})}else Object.hasOwn(n,"body")&&X_("body",i,s);n.querystring?e[FT]=t({schema:n.querystring,method:i,url:s,httpPart:"querystring"}):Object.hasOwn(n,"querystring")&&X_("querystring",i,s),n.params?e[qT]=t({schema:n.params,method:i,url:s,httpPart:"params"}):Object.hasOwn(n,"params")&&X_("params",i,s)}function Q_(e,t,r){let n=t[r]===void 0,i;try{i=e?.(n?null:t[r])}catch(o){return o.statusCode=500,o}if(i&&typeof i.then=="function")return i.then(o=>s(o)).catch(o=>o);return s(i);function s(o){return o===!1?e.errors:o&&o.error?o.error:(o&&o.value&&(t[r]=o.value),!1)}}function tv(e,t,r){let n=r===void 0;if(n||!r.skipParams){let s=Q_(e[qT],t,"params");if(s)return typeof s.then!="function"?ja(s,"params",e.schemaErrorFormatter):ype(s,e,t)}if(n||!r.skipBody){let s=null;if(typeof e[ol]=="function")s=e[ol];else if(e[ol]){let a=wpe(t.headers["content-type"]),u=e[ol][a];u&&(s=u)}let o=Q_(s,t,"body");if(o)return typeof o.then!="function"?ja(o,"body",e.schemaErrorFormatter):_pe(o,e,t)}if(n||!r.skipQuery){let s=Q_(e[FT],t,"query");if(s)return typeof s.then!="function"?ja(s,"querystring",e.schemaErrorFormatter):vpe(s,e,t)}let i=Q_(e[ev],t,"headers");return i?typeof i.then!="function"?ja(i,"headers",e.schemaErrorFormatter):bpe(i,e,t):!1}function ype(e,t,r){return e.then(n=>n?ja(n,"params",t.schemaErrorFormatter):tv(t,r,{skipParams:!0}))}function _pe(e,t,r){return e.then(n=>n?ja(n,"body",t.schemaErrorFormatter):tv(t,r,{skipParams:!0,skipBody:!0}))}function vpe(e,t,r){return e.then(n=>n?ja(n,"querystring",t.schemaErrorFormatter):tv(t,r,{skipParams:!0,skipBody:!0,skipQuery:!0}))}function bpe(e,t,r){return e.then(n=>n?ja(n,"headers",t.schemaErrorFormatter):!1)}function ja(e,t,r){if(e instanceof Error)return e.statusCode=e.statusCode||400,e.code=e.code||"FST_ERR_VALIDATION",e.validationContext=e.validationContext||t,e;let n=r(e,t);return n.statusCode=n.statusCode||400,n.code=n.code||"FST_ERR_VALIDATION",n.validation=e,n.validationContext=t,n}function wpe(e){return e?e.split(/[ ;]/,1)[0].trim().toLowerCase():""}GU.exports={symbols:{bodySchema:ol,querystringSchema:FT,responseSchema:JU,paramsSchema:qT,headersSchema:ev},compileSchemasForValidation:gpe,compileSchemasForSerialization:mpe,validate:tv}});var BT=T((Ntt,HT)=>{"use strict";var Spe=ie("node:diagnostics_channel"),kpe=MT(),xpe=LT(),{validate:$pe}=UT(),{preValidationHookRunner:Epe,preHandlerHookRunner:Tpe}=Da(),{FST_ERR_CTP_INVALID_MEDIA_TYPE:Rpe}=tn(),{setErrorStatusCode:KU}=Y_(),{kReplyIsError:hh,kRouteContext:no,kFourOhFourContext:Ppe,kSupportedHTTPMethods:YU}=Hr(),ph=Spe.tracingChannel("fastify.request.handler");function Ipe(e,t,r){if(r.sent===!0)return;if(e!=null){r[hh]=!0,r.send(e);return}let n=t.method;if(this[YU].bodyless.has(n)){Wc(t,r);return}if(this[YU].bodywith.has(n)){let i=t.headers,s=i["content-type"];if(s===void 0){let a=i["content-length"];if(i["transfer-encoding"]===void 0&&(a===void 0||a==="0")){Wc(t,r);return}t[no].contentTypeParser.run("",Wc,t,r);return}let o=new kpe(s);if(o.isValid===!1){r[hh]=!0,r.status(415).send(new Rpe);return}t[no].contentTypeParser.run(o.toString(),Wc,t,r);return}Wc(t,r)}function Wc(e,t){try{e[no].preValidation!==null?Epe(e[no].preValidation,e,t,ZT):ZT(null,e,t)}catch(r){ZT(r,e,t)}}function ZT(e,t,r){if(r.sent===!0)return;if(e!=null){r[hh]=!0,r.send(e);return}let n=$pe(r[no],t);if(n&&typeof n.then=="function"||!1){let s=XU.bind(null,t,r);n.then(s,s)}else XU(t,r,n)}function XU(e,t,r){if(r){if(t[no].attachValidation===!1){t.send(r);return}t.request.validationError=r}e[no].preHandler!==null?Tpe(e[no].preHandler,e,t,VT):VT(null,e,t)}function VT(e,t,r){if(r.sent)return;let n=t[no];if(!ph.hasSubscribers||n[Ppe]===null)QU(e,t,r);else{let i={request:t,reply:r,async:!1,route:{url:n.config.url,method:n.config.method}};ph.start.runStores(i,QU,void 0,e,t,r,i)}}function QU(e,t,r,n){let i=t[no];try{if(e!=null){r[hh]=!0,n&&(n.error=e,KU(r,e),ph.error.publish(n)),r.send(e);return}let s;try{s=i.handler(t,r)}catch(o){n&&(n.error=o,KU(r,o),ph.error.publish(n)),r[hh]=!0,r.send(o);return}s!==void 0&&(s!==null&&typeof s.then=="function"?xpe(s,r,n):r.send(s))}finally{n&&ph.end.publish(n)}}HT.exports=Ipe;HT.exports[Symbol.for("internals")]={handler:Wc,preHandlerCallback:VT}});var t4=T((Att,e4)=>{"use strict";function Jc(){}var Ope={fatal:Jc,error:Jc,warn:Jc,info:Jc,debug:Jc,trace:Jc};Object.defineProperty(e4,"exports",{get(){return Object.create(Ope)}})});var JT=T((Dtt,i4)=>{"use strict";var mh=e=>e&&typeof e.message=="string",WT=e=>{if(!e)return;let t=e.cause;if(typeof t=="function"){let r=e.cause();return mh(r)?r:void 0}else return mh(t)?t:void 0},r4=(e,t)=>{if(!mh(e))return"";let r=e.stack||"";if(t.has(e))return r+`
5
5
  causes have become circular...`;let n=WT(e);return n?(t.add(e),r+`
6
- caused by: `+r4(n,t)):r},Cpe=e=>r4(e,new Set),n4=(e,t,r)=>{if(!mh(e))return"";let n=r?"":e.message||"";if(t.has(e))return n+": ...";let i=WT(e);if(i){t.add(e);let s=typeof e.cause=="function";return n+(s?"":": ")+n4(i,t,s)}else return n},Npe=e=>n4(e,new Set);i4.exports={isErrorLike:mh,getErrorCause:WT,stackWithCauses:Cpe,messageWithCauses:Npe}});var GT=T((jtt,o4)=>{"use strict";var Ape=Symbol("circular-ref-tag"),rv=Symbol("pino-raw-err-ref"),s4=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[rv]},set:function(e){this[rv]=e}}});Object.defineProperty(s4,rv,{writable:!0,value:{}});o4.exports={pinoErrProto:s4,pinoErrorSymbols:{seen:Ape,rawSymbol:rv}}});var l4=T((ztt,u4)=>{"use strict";u4.exports=YT;var{messageWithCauses:Dpe,stackWithCauses:jpe,isErrorLike:a4}=JT(),{pinoErrProto:zpe,pinoErrorSymbols:Mpe}=GT(),{seen:KT}=Mpe,{toString:Lpe}=Object.prototype;function YT(e){if(!a4(e))return e;e[KT]=void 0;let t=Object.create(zpe);t.type=Lpe.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=Dpe(e),t.stack=jpe(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>YT(r)));for(let r in e)if(t[r]===void 0){let n=e[r];a4(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,KT)&&(t[r]=YT(n)):t[r]=n}return delete e[KT],t.raw=e,t}});var d4=T((Mtt,c4)=>{"use strict";c4.exports=iv;var{isErrorLike:XT}=JT(),{pinoErrProto:qpe,pinoErrorSymbols:Fpe}=GT(),{seen:nv}=Fpe,{toString:Upe}=Object.prototype;function iv(e){if(!XT(e))return e;e[nv]=void 0;let t=Object.create(qpe);t.type=Upe.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>iv(r))),XT(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,nv)&&(t.cause=iv(e.cause));for(let r in e)if(t[r]===void 0){let n=e[r];XT(n)?Object.prototype.hasOwnProperty.call(n,nv)||(t[r]=iv(n)):t[r]=n}return delete e[nv],t.raw=e,t}});var m4=T((Ltt,h4)=>{"use strict";h4.exports={mapHttpRequest:Zpe,reqSerializer:p4};var QT=Symbol("pino-raw-req-ref"),f4=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[QT]},set:function(e){this[QT]=e}}});Object.defineProperty(f4,QT,{writable:!0,value:{}});function p4(e){let t=e.info||e.socket,r=Object.create(f4);if(r.id=typeof e.id=="function"?e.id():e.id||(e.info?e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let n=e.path;r.url=typeof n=="string"?n:e.url?e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function Zpe(e){return{req:p4(e)}}});var v4=T((qtt,_4)=>{"use strict";_4.exports={mapHttpResponse:Vpe,resSerializer:y4};var eR=Symbol("pino-raw-res-ref"),g4=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[eR]},set:function(e){this[eR]=e}}});Object.defineProperty(g4,eR,{writable:!0,value:{}});function y4(e){let t=Object.create(g4);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function Vpe(e){return{res:y4(e)}}});var rR=T((Ftt,b4)=>{"use strict";var tR=l4(),Hpe=d4(),sv=m4(),ov=v4();b4.exports={err:tR,errWithCause:Hpe,mapHttpRequest:sv.mapHttpRequest,mapHttpResponse:ov.mapHttpResponse,req:sv.reqSerializer,res:ov.resSerializer,wrapErrorSerializer:function(t){return t===tR?t:function(n){return t(tR(n))}},wrapRequestSerializer:function(t){return t===sv.reqSerializer?t:function(n){return t(sv.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===ov.resSerializer?t:function(n){return t(ov.resSerializer(n))}}}});var nR=T((Utt,w4)=>{"use strict";function Bpe(e,t){return t}w4.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=Bpe;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),i=[];for(let s of n)s&&i.push(s.getFileName());return i}});var T4=T((Ztt,E4)=>{"use strict";function iR(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=iR(e[r]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=iR(e[r]));return t}return e}function S4(e){let t=[],r="",n=!1,i=!1,s="";for(let o=0;o<e.length;o++){let a=e[o];!n&&a==="."?r&&(t.push(r),r=""):a==="["?(r&&(t.push(r),r=""),n=!0):a==="]"&&n?(t.push(r),r="",n=!1,i=!1):(a==='"'||a==="'")&&n?i?a===s?(i=!1,s=""):r+=a:(i=!0,s=a):r+=a}return r&&t.push(r),t}function k4(e,t,r){let n=e;for(let s=0;s<t.length-1;s++){let o=t[s];if(typeof n!="object"||n===null||!(o in n)||typeof n[o]!="object"||n[o]===null)return!1;n=n[o]}let i=t[t.length-1];if(i==="*"){if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=r;else if(typeof n=="object"&&n!==null)for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=r)}else typeof n=="object"&&n!==null&&i in n&&Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=r);return!0}function x4(e,t){let r=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof r!="object"||r===null||!(s in r)||typeof r[s]!="object"||r[s]===null)return!1;r=r[s]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let i=0;i<r.length;i++)r[i]=void 0;else if(typeof r=="object"&&r!==null)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&delete r[i]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var av=Symbol("PATH_NOT_FOUND");function Wpe(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return av;r=r[n]}return r}function Jpe(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function Gpe(e,t,r,n=!1){for(let i of t){let s=S4(i);if(s.includes("*"))$4(e,s,r,i,n);else if(n)x4(e,s);else{let o=Wpe(e,s);if(o===av)continue;let a=typeof r=="function"?r(o,s):r;k4(e,s,a)}}}function $4(e,t,r,n,i=!1){let s=t.indexOf("*");if(s===t.length-1){let o=t.slice(0,-1),a=e;for(let u of o){if(a==null||typeof a!="object"||a===null)return;a=a[u]}if(Array.isArray(a))if(i)for(let u=0;u<a.length;u++)a[u]=void 0;else for(let u=0;u<a.length;u++){let l=[...o,u.toString()],c=typeof r=="function"?r(a[u],l):r;a[u]=c}else if(typeof a=="object"&&a!==null)if(i){let u=[];for(let l in a)Object.prototype.hasOwnProperty.call(a,l)&&u.push(l);for(let l of u)delete a[l]}else for(let u in a){let l=[...o,u],c=typeof r=="function"?r(a[u],l):r;a[u]=c}}else Kpe(e,t,r,s,n,i)}function Kpe(e,t,r,n,i,s=!1){let o=t.slice(0,n),a=t.slice(n+1),u=[];function l(c,d){if(d===o.length){if(Array.isArray(c))for(let p=0;p<c.length;p++)u[d]=p.toString(),l(c[p],d+1);else if(typeof c=="object"&&c!==null)for(let p in c)u[d]=p,l(c[p],d+1)}else if(d<o.length){let p=o[d];c&&typeof c=="object"&&c!==null&&p in c&&(u[d]=p,l(c[p],d+1))}else if(a.includes("*"))$4(c,a,typeof r=="function"?(f,h)=>{let v=[...u.slice(0,d),...h];return r(f,v)}:r,i,s);else if(s)x4(c,a);else{let p=typeof r=="function"?r(Jpe(c,a),[...u.slice(0,d),...a]):r;k4(c,a,p)}}if(o.length===0)l(e,0);else{let c=e;for(let d=0;d<o.length;d++){let p=o[d];if(c==null||typeof c!="object"||c===null)return;c=c[p],u[d]=p}c!=null&&l(c,o.length)}}function Ype(e){if(e.length===0)return null;let t=new Map;for(let r of e){let n=S4(r),i=t;for(let s=0;s<n.length;s++){let o=n[s];i.has(o)||i.set(o,new Map),i=i.get(o)}}return t}function Xpe(e,t){if(!t)return e;function r(n,i,s=0){if(!i||i.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let a=[];for(let u=0;u<n.length;u++){let l=u.toString();i.has(l)||i.has("*")?a[u]=r(n[u],i.get(l)||i.get("*")):a[u]=n[u]}return a}let o=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i.has(a)||i.has("*")?o[a]=r(n[a],i.get(a)||i.get("*")):o[a]=n[a]);return o}return r(e,t)}function Qpe(e){if(typeof e!="string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction path (${e})`);let t=0,r=!1,n="";for(let i=0;i<e.length;i++){let s=e[i];if((s==='"'||s==="'")&&t>0)r?s===n&&(r=!1,n=""):(r=!0,n=s);else if(s==="["&&!r)t++;else if(s==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function ehe(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)Qpe(t)}function the(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:i=!0,remove:s=!1}=e;ehe(t);let o=Ype(t);return function(u){if(i&&(u===null||typeof u!="object")&&(u==null||typeof u!="object"))return n?n(u):u;let l=Xpe(u,o),c=u,d=r;return typeof r=="function"&&(d=r),Gpe(l,t,d,s),n===!1?(l.restore=function(){return iR(c)},l):typeof n=="function"?n(l):JSON.stringify(l)}}E4.exports=the});var Gc=T((Vtt,R4)=>{"use strict";var rhe=Symbol("pino.setLevel"),nhe=Symbol("pino.getLevel"),ihe=Symbol("pino.levelVal"),she=Symbol("pino.levelComp"),ohe=Symbol("pino.useLevelLabels"),ahe=Symbol("pino.useOnlyCustomLevels"),uhe=Symbol("pino.mixin"),lhe=Symbol("pino.lsCache"),che=Symbol("pino.chindings"),dhe=Symbol("pino.asJson"),fhe=Symbol("pino.write"),phe=Symbol("pino.redactFmt"),hhe=Symbol("pino.time"),mhe=Symbol("pino.timeSliceIndex"),ghe=Symbol("pino.stream"),yhe=Symbol("pino.stringify"),_he=Symbol("pino.stringifySafe"),vhe=Symbol("pino.stringifiers"),bhe=Symbol("pino.end"),whe=Symbol("pino.formatOpts"),She=Symbol("pino.messageKey"),khe=Symbol("pino.errorKey"),xhe=Symbol("pino.nestedKey"),$he=Symbol("pino.nestedKeyStr"),Ehe=Symbol("pino.mixinMergeStrategy"),The=Symbol("pino.msgPrefix"),Rhe=Symbol("pino.wildcardFirst"),Phe=Symbol.for("pino.serializers"),Ihe=Symbol.for("pino.formatters"),Ohe=Symbol.for("pino.hooks"),Che=Symbol.for("pino.metadata");R4.exports={setLevelSym:rhe,getLevelSym:nhe,levelValSym:ihe,levelCompSym:she,useLevelLabelsSym:ohe,mixinSym:uhe,lsCacheSym:lhe,chindingsSym:che,asJsonSym:dhe,writeSym:fhe,serializersSym:Phe,redactFmtSym:phe,timeSym:hhe,timeSliceIndexSym:mhe,streamSym:ghe,stringifySym:yhe,stringifySafeSym:_he,stringifiersSym:vhe,endSym:bhe,formatOptsSym:whe,messageKeySym:She,errorKeySym:khe,nestedKeySym:xhe,wildcardFirstSym:Rhe,needsMetadataGsym:Che,useOnlyCustomLevelsSym:ahe,formattersSym:Ihe,hooksSym:Ohe,nestedKeyStrSym:$he,mixinMergeStrategySym:Ehe,msgPrefixSym:The}});var oR=T((Htt,C4)=>{"use strict";var P4=T4(),{redactFmtSym:Nhe,wildcardFirstSym:uv}=Gc(),sR=/[^.[\]]+|\[([^[\]]*?)\]/g,I4="[Redacted]",O4=!1;function Ahe(e,t){let{paths:r,censor:n,remove:i}=Dhe(e),s=r.reduce((u,l)=>{sR.lastIndex=0;let c=sR.exec(l),d=sR.exec(l),p=c[1]!==void 0?c[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):c[0];if(p==="*"&&(p=uv),d===null)return u[p]=null,u;if(u[p]===null)return u;let{index:f}=d,h=`${l.substr(f,l.length-1)}`;return u[p]=u[p]||[],p!==uv&&u[p].length===0&&u[p].push(...u[uv]||[]),p===uv&&Object.keys(u).forEach(function(v){u[v]&&u[v].push(h)}),u[p].push(h),u},{}),o={[Nhe]:P4({paths:r,censor:n,serialize:t,strict:O4,remove:i})},a=(...u)=>t(typeof n=="function"?n(...u):n);return[...Object.keys(s),...Object.getOwnPropertySymbols(s)].reduce((u,l)=>{if(s[l]===null)u[l]=c=>a(c,[l]);else{let c=typeof n=="function"?(d,p)=>n(d,[l,...p]):n;u[l]=P4({paths:s[l],censor:c,serialize:t,strict:O4,remove:i})}return u},o)}function Dhe(e){if(Array.isArray(e))return e={paths:e,censor:I4},e;let{paths:t,censor:r=I4,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino – redact must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}C4.exports=Ahe});var D4=T((Btt,A4)=>{"use strict";var jhe=()=>"",zhe=()=>`,"time":${Date.now()}`,Mhe=()=>`,"time":${Math.round(Date.now()/1e3)}`,Lhe=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,qhe=1000000n,N4=1000000000n,Fhe=BigInt(Date.now())*qhe,Uhe=process.hrtime.bigint(),Zhe=()=>{let e=process.hrtime.bigint()-Uhe,t=Fhe+e,r=t/N4,n=t%N4,i=Number(r*1000n+n/1000000n),s=new Date(i),o=s.getUTCFullYear(),a=(s.getUTCMonth()+1).toString().padStart(2,"0"),u=s.getUTCDate().toString().padStart(2,"0"),l=s.getUTCHours().toString().padStart(2,"0"),c=s.getUTCMinutes().toString().padStart(2,"0"),d=s.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${o}-${a}-${u}T${l}:${c}:${d}.${n.toString().padStart(9,"0")}Z"`};A4.exports={nullTime:jhe,epochTime:zhe,unixTime:Mhe,isoTime:Lhe,isoTimeNano:Zhe}});var z4=T((Wtt,j4)=>{"use strict";function Vhe(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}j4.exports=Hhe;function Hhe(e,t,r){var n=r&&r.stringify||Vhe,i=1;if(typeof e=="object"&&e!==null){var s=t.length+i;if(s===1)return e;var o=new Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(t[a]);return o.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var l="",c=1-i,d=-1,p=e&&e.length||0,f=0;f<p;){if(e.charCodeAt(f)===37&&f+1<p){switch(d=d>-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(c>=u||t[c]==null)break;d<f&&(l+=e.slice(d,f)),l+=Number(t[c]),d=f+2,f++;break;case 105:if(c>=u||t[c]==null)break;d<f&&(l+=e.slice(d,f)),l+=Math.floor(Number(t[c])),d=f+2,f++;break;case 79:case 111:case 106:if(c>=u||t[c]===void 0)break;d<f&&(l+=e.slice(d,f));var h=typeof t[c];if(h==="string"){l+="'"+t[c]+"'",d=f+2,f++;break}if(h==="function"){l+=t[c].name||"<anonymous>",d=f+2,f++;break}l+=n(t[c]),d=f+2,f++;break;case 115:if(c>=u)break;d<f&&(l+=e.slice(d,f)),l+=String(t[c]),d=f+2,f++;break;case 37:d<f&&(l+=e.slice(d,f)),l+="%",d=f+2,f++,c--;break}++c}++f}return d===-1?e:(d<p&&(l+=e.slice(d)),l)}});var uR=T((Jtt,aR)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(4));aR.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(t);for(;n>Date.now(););};aR.exports=e}});var H4=T((Gtt,V4)=>{"use strict";var Lr=ie("fs"),Bhe=ie("events"),Whe=ie("util").inherits,M4=ie("path"),cR=uR(),Jhe=ie("assert"),lv=100,cv=Buffer.allocUnsafe(0),Ghe=16*1024,L4="buffer",q4="utf8",[Khe,Yhe]=(process.versions.node||"0.0").split(".").map(Number),Xhe=Khe>=22&&Yhe>=7;function F4(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(s,o){if(s){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",s)}):t.emit("error",s);return}let a=t._reopening;t.fd=o,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():a&&process.nextTick(()=>t.emit("drain")))}let n=t.append?"a":"w",i=t.mode;if(t.sync)try{t.mkdir&&Lr.mkdirSync(M4.dirname(e),{recursive:!0});let s=Lr.openSync(e,n,i);r(null,s)}catch(s){throw r(s),s}else t.mkdir?Lr.mkdir(M4.dirname(e),{recursive:!0},s=>{if(s)return r(s);Lr.open(e,n,i,r)}):Lr.open(e,n,i,r)}function Is(e){if(!(this instanceof Is))return new Is(e);let{fd:t,dest:r,minLength:n,maxLength:i,maxWrite:s,periodicFlush:o,sync:a,append:u=!0,mkdir:l,retryEAGAIN:c,fsync:d,contentMode:p,mode:f}=e||{};t=t||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=i||0,this.maxWrite=s||Ghe,this._periodicFlush=o||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this._fsync=d||!1,this.append=u||!1,this.mode=f,this.retryEAGAIN=c||(()=>!0),this.mkdir=l||!1;let h,v;if(p===L4)this._writingBuf=cv,this.write=tme,this.flush=nme,this.flushSync=sme,this._actualWrite=ame,h=()=>Lr.writeSync(this.fd,this._writingBuf),v=()=>Lr.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===q4)this._writingBuf="",this.write=eme,this.flush=rme,this.flushSync=ime,this._actualWrite=ome,h=()=>Lr.writeSync(this.fd,this._writingBuf,"utf8"),v=()=>Lr.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${q4}" and "${L4}", but passed ${p}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")F4(t,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(y,_)=>{if(y){if((y.code==="EAGAIN"||y.code==="EBUSY")&&this.retryEAGAIN(y,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{cR(lv),this.release(void 0,0)}catch(m){this.release(m)}else setTimeout(v,lv);else this._writing=!1,this.emit("error",y);return}this.emit("write",_);let b=lR(this._writingBuf,this._len,_);if(this._len=b.len,this._writingBuf=b.writingBuf,this._writingBuf.length){if(!this.sync){v();return}try{do{let m=h(),S=lR(this._writingBuf,this._len,m);this._len=S.len,this._writingBuf=S.writingBuf}while(this._writingBuf.length)}catch(m){this.release(m);return}}this._fsync&&Lr.fsyncSync(this.fd);let g=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):g>this.minLength?this._actualWrite():this._ending?g>0?this._actualWrite():(this._writing=!1,dv(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(Qhe,this)):this.emit("drain"))},this.on("newListener",function(y){y==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function lR(e,t,r){return typeof e=="string"&&Buffer.byteLength(e)!==r&&(r=Buffer.from(e).subarray(0,r).toString().length),t=Math.max(t-r,0),e=e.slice(r),{writingBuf:e,len:t}}function Qhe(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}Whe(Is,Bhe);function U4(e,t){return e.length===0?cv:e.length===1?e[0]:Buffer.concat(e,t)}function eme(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||r[r.length-1].length+e.length>this.maxWrite?r.push(""+e):r[r.length-1]+=e,this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function tme(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs,n=this._lens;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||n[n.length-1]+e.length>this.maxWrite?(r.push([e]),n.push(e.length)):(r[r.length-1].push(e),n[n.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function Z4(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{Lr.fsync(this.fd,n=>{this._flushPending=!1,e(n)})}catch(n){e(n)}this.off("error",r)},r=n=>{this._flushPending=!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function rme(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Z4.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function nme(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Z4.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Is.prototype.reopen=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&Lr.close(t,r=>{if(r)return this.emit("error",r)})}),F4(this.file,this)};Is.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():dv(this)))};function ime(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e;){e.length<=0&&(e=this._bufs[0]);try{let t=Lr.writeSync(this.fd,e,"utf8"),r=lR(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;cR(lv)}}try{Lr.fsyncSync(this.fd)}catch{}}function sme(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=cv);let e=cv;for(;this._bufs.length||e.length;){e.length<=0&&(e=U4(this._bufs[0],this._lens[0]));try{let t=Lr.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;cR(lv)}}}Is.prototype.destroy=function(){this.destroyed||dv(this)};function ome(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let t=Lr.writeSync(this.fd,this._writingBuf,"utf8");e(null,t)}catch(t){e(t)}else Lr.write(this.fd,this._writingBuf,"utf8",e)}function ame(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:U4(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=Lr.writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else Xhe&&(this._writingBuf=Buffer.from(this._writingBuf)),Lr.write(this.fd,this._writingBuf,e)}function dv(e){if(e.fd===-1){e.once("ready",dv.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],Jhe(typeof e.fd=="number",`sonic.fd must be a number, got ${typeof e.fd}`);try{Lr.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?Lr.close(e.fd,r):r()}function r(n){if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}Is.SonicBoom=Is;Is.default=Is;V4.exports=Is});var dR=T((Ktt,K4)=>{"use strict";var Os={exit:[],beforeExit:[]},B4={exit:cme,beforeExit:dme},Kc;function ume(){Kc===void 0&&(Kc=new FinalizationRegistry(fme))}function lme(e){Os[e].length>0||process.on(e,B4[e])}function W4(e){Os[e].length>0||(process.removeListener(e,B4[e]),Os.exit.length===0&&Os.beforeExit.length===0&&(Kc=void 0))}function cme(){J4("exit")}function dme(){J4("beforeExit")}function J4(e){for(let t of Os[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}Os[e]=[]}function fme(e){for(let t of["exit","beforeExit"]){let r=Os[t].indexOf(e);Os[t].splice(r,r+1),W4(t)}}function G4(e,t,r){if(t===void 0)throw new Error("the object can't be undefined");lme(e);let n=new WeakRef(t);n.fn=r,ume(),Kc.register(t,n),Os[e].push(n)}function pme(e,t){G4("exit",e,t)}function hme(e,t){G4("beforeExit",e,t)}function mme(e){if(Kc!==void 0){Kc.unregister(e);for(let t of["exit","beforeExit"])Os[t]=Os[t].filter(r=>{let n=r.deref();return n&&n!==e}),W4(t)}}K4.exports={register:pme,registerBeforeExit:hme,unregister:mme}});var Y4=T((Ytt,gme)=>{gme.exports={name:"thread-stream",version:"4.0.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^22.0.0","@yao-pkg/pkg":"^6.0.0",borp:"^0.21.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",husky:"^9.0.6",neostandard:"^0.12.2","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"tsc --noEmit",lint:"eslint",test:"npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:ci":"npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:yarn":"npm run transpile && borp --pattern 'test/*.test.js'",transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var Q4=T((Xtt,X4)=>{"use strict";function yme(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,o=()=>{let a=Atomics.load(e,t);if(a===r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let u=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),l=Atomics.waitAsync(e,t,a,u);l.async?l.value.then(o):setImmediate(o)};o()}function _me(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,o=()=>{if(Atomics.load(e,t)!==r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let u=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),l=Atomics.waitAsync(e,t,r,u);l.async?l.value.then(o):setImmediate(o)};o()}X4.exports={wait:yme,waitDiff:_me}});var t2=T((Qtt,e2)=>{"use strict";e2.exports={WRITE_INDEX:4,READ_INDEX:8}});var o2=T((ert,s2)=>{"use strict";var{version:vme}=Y4(),{EventEmitter:bme}=ie("events"),{Worker:wme}=ie("worker_threads"),{join:Sme}=ie("path"),{pathToFileURL:kme}=ie("url"),{wait:xme}=Q4(),{WRITE_INDEX:li,READ_INDEX:ui}=t2(),$me=ie("buffer"),Eme=ie("assert"),te=Symbol("kImpl"),Tme=$me.constants.MAX_STRING_LENGTH,gh=class{constructor(t){this._value=t}deref(){return this._value}},pv=class{register(){}unregister(){}},Rme=process.env.NODE_V8_COVERAGE?pv:global.FinalizationRegistry||pv,Pme=process.env.NODE_V8_COVERAGE?gh:global.WeakRef||gh,r2=new Rme(e=>{e.exited||e.terminate()});function Ime(e,t){let{filename:r,workerData:n}=t,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||Sme(__dirname,"lib","worker.js"),o=new wme(s,{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:kme(r).href,dataBuf:e[te].dataBuf,stateBuf:e[te].stateBuf,workerData:{$context:{threadStreamVersion:vme},...n}}});return o.stream=new gh(e),o.on("message",Ome),o.on("exit",i2),r2.register(e,o),o}function n2(e){Eme(!e[te].sync),e[te].needDrain&&(e[te].needDrain=!1,e.emit("drain"))}function fv(e){let t=Atomics.load(e[te].state,li),r=e[te].data.length-t;if(r>0){if(e[te].buf.length===0){e[te].flushing=!1,e[te].ending?gR(e):e[te].needDrain&&process.nextTick(n2,e);return}let n=e[te].buf.slice(0,r),i=Buffer.byteLength(n);i<=r?(e[te].buf=e[te].buf.slice(r),hv(e,n,fv.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[te].state,ui,0),Atomics.store(e[te].state,li,0),Atomics.notify(e[te].state,ui);i>e[te].data.length;)r=r/2,n=e[te].buf.slice(0,r),i=Buffer.byteLength(n);e[te].buf=e[te].buf.slice(r),hv(e,n,fv.bind(null,e))}})}else if(r===0){if(t===0&&e[te].buf.length===0)return;e.flush(()=>{Atomics.store(e[te].state,ui,0),Atomics.store(e[te].state,li,0),Atomics.notify(e[te].state,ui),fv(e)})}else io(e,new Error("overwritten"))}function Ome(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case"READY":this.stream=new Pme(t),t.flush(()=>{t[te].ready=!0,t.emit("ready")});break;case"ERROR":io(t,e.err);break;case"EVENT":Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"WARNING":process.emitWarning(e.err);break;default:io(t,new Error("this should not happen: "+e.code))}}function i2(e){let t=this.stream.deref();t!==void 0&&(r2.unregister(t),t.worker.exited=!0,t.worker.off("exit",i2),io(t,e!==0?new Error("the worker thread exited"):null))}var pR=class extends bme{constructor(t={}){if(super(),t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[te]={},this[te].stateBuf=new SharedArrayBuffer(128),this[te].state=new Int32Array(this[te].stateBuf),this[te].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[te].data=Buffer.from(this[te].dataBuf),this[te].sync=t.sync||!1,this[te].ending=!1,this[te].ended=!1,this[te].needDrain=!1,this[te].destroyed=!1,this[te].flushing=!1,this[te].ready=!1,this[te].finished=!1,this[te].errored=null,this[te].closed=!1,this[te].buf="",this.worker=Ime(this,t),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(t){if(this[te].destroyed)return hR(this,new Error("the worker has exited")),!1;if(this[te].ending)return hR(this,new Error("the worker is ending")),!1;if(this[te].flushing&&this[te].buf.length+t.length>=Tme)try{fR(this),this[te].flushing=!0}catch(r){return io(this,r),!1}if(this[te].buf+=t,this[te].sync)try{return fR(this),!0}catch(r){return io(this,r),!1}return this[te].flushing||(this[te].flushing=!0,setImmediate(fv,this)),this[te].needDrain=this[te].data.length-this[te].buf.length-Atomics.load(this[te].state,li)<=0,!this[te].needDrain}end(){this[te].destroyed||(this[te].ending=!0,gR(this))}flush(t){if(this[te].destroyed){typeof t=="function"&&process.nextTick(t,new Error("the worker has exited"));return}let r=Atomics.load(this[te].state,li);xme(this[te].state,ui,r,1/0,(n,i)=>{if(n){io(this,n),process.nextTick(t,n);return}if(i==="not-equal"){this.flush(t);return}process.nextTick(t)})}flushSync(){this[te].destroyed||(fR(this),mR(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[te].ready}get destroyed(){return this[te].destroyed}get closed(){return this[te].closed}get writable(){return!this[te].destroyed&&!this[te].ending}get writableEnded(){return this[te].ending}get writableFinished(){return this[te].finished}get writableNeedDrain(){return this[te].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[te].errored}};function hR(e,t){setImmediate(()=>{e.emit("error",t)})}function io(e,t){e[te].destroyed||(e[te].destroyed=!0,t&&(e[te].errored=t,hR(e,t)),e.worker.exited?setImmediate(()=>{e[te].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[te].closed=!0,e.emit("close")}))}function hv(e,t,r){let n=Atomics.load(e[te].state,li),i=Buffer.byteLength(t);return e[te].data.write(t,n),Atomics.store(e[te].state,li,n+i),Atomics.notify(e[te].state,li),r(),!0}function gR(e){if(!(e[te].ended||!e[te].ending||e[te].flushing)){e[te].ended=!0;try{e.flushSync();let t=Atomics.load(e[te].state,ui);Atomics.store(e[te].state,li,-1),Atomics.notify(e[te].state,li);let r=0;for(;t!==-1;){if(Atomics.wait(e[te].state,ui,t,1e3),t=Atomics.load(e[te].state,ui),t===-2){io(e,new Error("end() failed"));return}if(++r===10){io(e,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{e[te].finished=!0,e.emit("finish")})}catch(t){io(e,t)}}}function fR(e){let t=()=>{e[te].ending?gR(e):e[te].needDrain&&process.nextTick(n2,e)};for(e[te].flushing=!1;e[te].buf.length!==0;){let r=Atomics.load(e[te].state,li),n=e[te].data.length-r;if(n===0){mR(e),Atomics.store(e[te].state,ui,0),Atomics.store(e[te].state,li,0),Atomics.notify(e[te].state,ui);continue}else if(n<0)throw new Error("overwritten");let i=e[te].buf.slice(0,n),s=Buffer.byteLength(i);if(s<=n)e[te].buf=e[te].buf.slice(n),hv(e,i,t);else{for(mR(e),Atomics.store(e[te].state,ui,0),Atomics.store(e[te].state,li,0),Atomics.notify(e[te].state,ui);s>e[te].buf.length;)n=n/2,i=e[te].buf.slice(0,n),s=Buffer.byteLength(i);e[te].buf=e[te].buf.slice(n),hv(e,i,t)}}}function mR(e){if(e[te].flushing)throw new Error("unable to flush while flushing");let t=Atomics.load(e[te].state,li),r=0;for(;;){let n=Atomics.load(e[te].state,ui);if(n===-2)throw Error("_flushSync failed");if(n!==t)Atomics.wait(e[te].state,ui,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}s2.exports=pR});var vR=T((trt,a2)=>{"use strict";var{createRequire:Cme}=ie("module"),Nme=nR(),{join:yR,isAbsolute:Ame,sep:Dme}=ie("node:path"),jme=uR(),_R=dR(),zme=o2();function Mme(e){_R.register(e,Fme),_R.registerBeforeExit(e,Ume),e.on("close",function(){_R.unregister(e)})}function Lme(){let e=process.execArgv;for(let t=0;t<e.length;t++){let r=e[t];if(r==="--import"||r==="--require"||r==="-r"||r.startsWith("--import=")||r.startsWith("--require=")||r.startsWith("-r="))return!0}return!1}function qme(e,t,r,n,i){!r.execArgv&&Lme()&&ie.main===void 0&&(r={...r,execArgv:[]}),r={...r,name:i};let s=new zme({filename:e,workerData:t,workerOpts:r,sync:n});s.on("ready",o),s.on("close",function(){process.removeListener("exit",a)}),process.on("exit",a);function o(){process.removeListener("exit",a),s.unref(),r.autoEnd!==!1&&Mme(s)}function a(){s.closed||(s.flushSync(),jme(100),s.end())}return s}function Fme(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function Ume(e){e.flushSync()}function Zme(e){let{pipeline:t,targets:r,levels:n,dedupe:i,worker:s={},caller:o=Nme(),sync:a=!1}=e,u={...e.options},l=typeof o=="string"?[o]:o,c=typeof globalThis=="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),d=e.target;if(d&&r)throw new Error("only one of target or targets can be specified");r?(d=c["pino-worker"]||yR(__dirname,"worker.js"),u.targets=r.filter(h=>h.target).map(h=>({...h,target:f(h.target)})),u.pipelines=r.filter(h=>h.pipeline).map(h=>h.pipeline.map(v=>({...v,level:h.level,target:f(v.target)})))):t&&(d=c["pino-worker"]||yR(__dirname,"worker.js"),u.pipelines=[t.map(h=>({...h,target:f(h.target)}))]),n&&(u.levels=n),i&&(u.dedupe=i),u.pinoWillSendConfig=!0;let p=r||t?"pino.transport":d;return qme(f(d),u,s,a,p);function f(h){if(h=c[h]||h,Ame(h)||h.indexOf("file://")===0)return h;if(h==="pino/file")return yR(__dirname,"..","file.js");let v;for(let y of l)try{let _=y==="node:repl"?process.cwd()+Dme:y;v=Cme(_).resolve(h);break}catch{continue}if(!v)throw new Error(`unable to determine transport target for "${h}"`);return v}}a2.exports=Zme});var yv=T((nrt,b2)=>{"use strict";var Vme=ie("node:diagnostics_channel"),u2=z4(),{mapHttpRequest:Hme,mapHttpResponse:Bme}=rR(),wR=H4(),l2=dR(),{lsCacheSym:Wme,chindingsSym:h2,writeSym:c2,serializersSym:m2,formatOptsSym:d2,endSym:Jme,stringifiersSym:g2,stringifySym:y2,stringifySafeSym:SR,wildcardFirstSym:_2,nestedKeySym:Gme,formattersSym:v2,messageKeySym:Kme,errorKeySym:Yme,nestedKeyStrSym:Xme,msgPrefixSym:mv}=Gc(),{isMainThread:Qme}=ie("worker_threads"),ege=vR(),[tge]=process.versions.node.split(".").map(e=>Number(e)),f2=Vme.tracingChannel("pino_asJson"),bR=tge>=25?e=>JSON.stringify(e):nge;function Yc(){}function rge(e,t){if(!t)return r;return function(...i){t.call(this,i,r,e)};function r(n,...i){if(typeof n=="object"){let s=n;n!==null&&(n.method&&n.headers&&n.socket?n=Hme(n):typeof n.setHeader=="function"&&(n=Bme(n)));let o;s===null&&i.length===0?o=[null]:(s=i.shift(),o=i),typeof this[mv]=="string"&&s!==void 0&&s!==null&&(s=this[mv]+s),this[c2](n,u2(s,o,this[d2]),e)}else{let s=n===void 0?i.shift():n;typeof this[mv]=="string"&&s!==void 0&&s!==null&&(s=this[mv]+s),this[c2](null,u2(s,i,this[d2]),e)}}}function nge(e){let t="",r=0,n=!1,i=255,s=e.length;if(s>100)return JSON.stringify(e);for(var o=0;o<s&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(r,o)+"\\",r=o,n=!0);return n?t+=e.slice(r):t=e,i<32?JSON.stringify(e):'"'+t+'"'}function ige(e,t,r,n){if(f2.hasSubscribers===!1)return p2.call(this,e,t,r,n);let i={instance:this,arguments};return f2.traceSync(p2,i,this,e,t,r,n)}function p2(e,t,r,n){let i=this[y2],s=this[SR],o=this[g2],a=this[Jme],u=this[h2],l=this[m2],c=this[v2],d=this[Kme],p=this[Yme],f=this[Wme][r]+n;f=f+u;let h;c.log&&(e=c.log(e));let v=o[_2],y="";for(let b in e)if(h=e[b],Object.prototype.hasOwnProperty.call(e,b)&&h!==void 0){l[b]?h=l[b](h):b===p&&l.err&&(h=l.err(h));let g=o[b]||v;switch(typeof h){case"undefined":case"function":continue;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":g&&(h=g(h));break;case"string":h=(g||bR)(h);break;default:h=(g||i)(h,s)}if(h===void 0)continue;let m=bR(b);y+=","+m+":"+h}let _="";if(t!==void 0){h=l[d]?l[d](t):t;let b=o[d]||v;switch(typeof h){case"function":break;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":b&&(h=b(h)),_=',"'+d+'":'+h;break;case"string":h=(b||bR)(h),_=',"'+d+'":'+h;break;default:h=(b||i)(h,s),_=',"'+d+'":'+h}}return this[Gme]&&y?f+this[Xme]+y.slice(1)+"}"+_+a:f+y+_+a}function sge(e,t){let r,n=e[h2],i=e[y2],s=e[SR],o=e[g2],a=o[_2],u=e[m2],l=e[v2].bindings;t=l(t);for(let c in t)if(r=t[c],((c.length<5||c!=="level"&&c!=="serializers"&&c!=="formatters"&&c!=="customLevels")&&t.hasOwnProperty(c)&&r!==void 0)===!0){if(r=u[c]?u[c](r):r,r=(o[c]||a||i)(r,s),r===void 0)continue;n+=',"'+c+'":'+r}return n}function oge(e){return e.write!==e.constructor.prototype.write}function gv(e){let t=new wR(e);return t.on("error",r),!e.sync&&Qme&&(l2.register(t,age),t.on("close",function(){l2.unregister(t)})),t;function r(n){if(n.code==="EPIPE"){t.write=Yc,t.end=Yc,t.flushSync=Yc,t.destroy=Yc;return}t.removeListener("error",r),t.emit("error",n)}}function age(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}function uge(e){return function(r,n,i={},s){if(typeof i=="string")s=gv({dest:i}),i={};else if(typeof s=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");s=gv({dest:s})}else if(i instanceof wR||i.writable||i._writableState)s=i,i={};else if(i.transport){if(i.transport instanceof wR||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let u;i.customLevels&&(u=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),s=ege({caller:n,...i.transport,levels:u})}if(i=Object.assign({},e,i),i.serializers=Object.assign({},e.serializers,i.serializers),i.formatters=Object.assign({},e.formatters,i.formatters),i.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:o,onChild:a}=i;return o===!1&&(i.level="silent"),a||(i.onChild=Yc),s||(oge(process.stdout)?s=process.stdout:s=gv({fd:process.stdout.fd||1})),{opts:i,stream:s}}}function lge(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[SR])(e)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function cge(e,t,r){return{level:e,bindings:t,log:r}}function dge(e){let t=Number(e);return typeof e=="string"&&Number.isFinite(t)?t:e===void 0?1:e}b2.exports={noop:Yc,buildSafeSonicBoom:gv,asChindings:sge,asJson:ige,genLog:rge,createArgsNormalizer:uge,stringify:lge,buildFormatters:cge,normalizeDestFileDescriptor:dge}});var _v=T((irt,w2)=>{var fge={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},pge={ASC:"ASC",DESC:"DESC"};w2.exports={DEFAULT_LEVELS:fge,SORTING_ORDER:pge}});var $R=T((srt,$2)=>{"use strict";var{lsCacheSym:hge,levelValSym:kR,useOnlyCustomLevelsSym:mge,streamSym:gge,formattersSym:yge,hooksSym:_ge,levelCompSym:S2}=Gc(),{noop:vge,genLog:al}=yv(),{DEFAULT_LEVELS:so,SORTING_ORDER:k2}=_v(),x2={fatal:e=>{let t=al(so.fatal,e);return function(...r){let n=this[gge];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:e=>al(so.error,e),warn:e=>al(so.warn,e),info:e=>al(so.info,e),debug:e=>al(so.debug,e),trace:e=>al(so.trace,e)},xR=Object.keys(so).reduce((e,t)=>(e[so[t]]=t,e),{}),bge=Object.keys(xR).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function wge(e){let t=e[yge].level,{labels:r}=e.levels,n={};for(let i in r){let s=t(r[i],Number(i));n[i]=JSON.stringify(s).slice(0,-1)}return e[hge]=n,e}function Sge(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function kge(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[kR],i=this[kR]=r[e],s=this[mge],o=this[S2],a=this[_ge].logMethod;for(let u in r){if(o(r[u],i)===!1){this[u]=vge;continue}this[u]=Sge(u,s)?x2[u](a):al(r[u],a)}this.emit("level-change",e,i,t[n],n,this)}function xge(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function $ge(e){let{values:t}=this.levels,r=t[e];return r!==void 0&&this[S2](r,this[kR])}function Ege(e,t,r){return e===k2.DESC?t<=r:t>=r}function Tge(e){return typeof e=="string"?Ege.bind(null,e):e}function Rge(e=null,t=!1){let r=e?Object.keys(e).reduce((s,o)=>(s[e[o]]=o,s),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:xR,r),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:so,e);return{labels:n,values:i}}function Pge(e,t,r){if(typeof e=="number"){if(![].concat(Object.keys(t||{}).map(s=>t[s]),r?[]:Object.keys(xR).map(s=>+s),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:so,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function Ige(e,t){let{labels:r,values:n}=e;for(let i in t){if(i in n)throw Error("levels cannot be overridden");if(t[i]in r)throw Error("pre-existing level values cannot be used for new levels")}}function Oge(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(k2).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}$2.exports={initialLsCache:bge,genLsCache:wge,levelMethods:x2,getLevel:xge,setLevel:kge,isLevelEnabled:$ge,mappings:Rge,assertNoLevelCollisions:Ige,assertDefaultLevelFound:Pge,genLevelComparison:Tge,assertLevelComparison:Oge}});var ER=T((ort,E2)=>{"use strict";E2.exports={version:"10.3.0"}});var A2=T((urt,N2)=>{"use strict";var{EventEmitter:Cge}=ie("node:events"),{lsCacheSym:Nge,levelValSym:Age,setLevelSym:RR,getLevelSym:T2,chindingsSym:bv,mixinSym:Dge,asJsonSym:P2,writeSym:jge,mixinMergeStrategySym:zge,timeSym:Mge,timeSliceIndexSym:Lge,streamSym:I2,serializersSym:ul,formattersSym:yh,errorKeySym:qge,messageKeySym:Fge,useOnlyCustomLevelsSym:Uge,needsMetadataGsym:Zge,redactFmtSym:Vge,stringifySym:Hge,formatOptsSym:Bge,stringifiersSym:Wge,msgPrefixSym:PR,hooksSym:Jge}=Gc(),{getLevel:Gge,setLevel:Kge,isLevelEnabled:Yge,mappings:Xge,initialLsCache:Qge,genLsCache:eye,assertNoLevelCollisions:tye}=$R(),{asChindings:IR,asJson:rye,buildFormatters:TR,stringify:R2,noop:O2}=yv(),{version:nye}=ER(),iye=oR(),sye=class{},C2={constructor:sye,child:oye,bindings:aye,setBindings:uye,flush:dye,isLevelEnabled:Yge,version:nye,get level(){return this[T2]()},set level(e){this[RR](e)},get levelVal(){return this[Age]},set levelVal(e){throw Error("levelVal is read-only")},get msgPrefix(){return this[PR]},get[Symbol.toStringTag](){return"Pino"},[Nge]:Qge,[jge]:cye,[P2]:rye,[T2]:Gge,[RR]:Kge};Object.setPrototypeOf(C2,Cge.prototype);N2.exports=function(){return Object.create(C2)};var vv=e=>e;function oye(e,t){if(!e)throw Error("missing bindings for child Pino");let r=this[ul],n=this[yh],i=Object.create(this);if(t==null)return i[yh].bindings!==vv&&(i[yh]=TR(n.level,vv,n.log)),i[bv]=IR(i,e),this.onChild!==O2&&this.onChild(i),i;if(t.hasOwnProperty("serializers")===!0){i[ul]=Object.create(null);for(let l in r)i[ul][l]=r[l];let a=Object.getOwnPropertySymbols(r);for(var s=0;s<a.length;s++){let l=a[s];i[ul][l]=r[l]}for(let l in t.serializers)i[ul][l]=t.serializers[l];let u=Object.getOwnPropertySymbols(t.serializers);for(var o=0;o<u.length;o++){let l=u[o];i[ul][l]=t.serializers[l]}}else i[ul]=r;if(t.hasOwnProperty("formatters")){let{level:a,bindings:u,log:l}=t.formatters;i[yh]=TR(a||n.level,u||vv,l||n.log)}else i[yh]=TR(n.level,vv,n.log);if(t.hasOwnProperty("customLevels")===!0&&(tye(this.levels,t.customLevels),i.levels=Xge(t.customLevels,i[Uge]),eye(i)),typeof t.redact=="object"&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let a=iye(i.redact,R2),u={stringify:a[Vge]};i[Hge]=R2,i[Wge]=a,i[Bge]=u}if(typeof t.msgPrefix=="string"&&(i[PR]=(this[PR]||"")+t.msgPrefix),i[bv]=IR(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;i[RR](a)}return this.onChild(i),i}function aye(){let t=`{${this[bv].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function uye(e){let t=IR(this,e);this[bv]=t}function lye(e,t){return Object.assign(t,e)}function cye(e,t,r){let n=this[Mge](),i=this[Dge],s=this[qge],o=this[Fge],a=this[zge]||lye,u,l=this[Jge].streamWrite;e==null?u={}:e instanceof Error?(u={[s]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[s]&&(t=e[s].message)),i&&(u=a(u,i(u,r,this)));let c=this[P2](u,t,r,n),d=this[I2];d[Zge]===!0&&(d.lastLevel=r,d.lastObj=u,d.lastMsg=t,d.lastTime=n.slice(this[Lge]),d.lastLogger=this),d.write(l?l(c):c)}function dye(e){if(e!=null&&typeof e!="function")throw Error("callback must be a function");let t=this[I2];typeof t.flush=="function"?t.flush(e||O2):e&&e()}});var M2=T((AR,z2)=>{"use strict";var{hasOwnProperty:_h}=Object.prototype,cl=NR();cl.configure=NR;cl.stringify=cl;cl.default=cl;AR.stringify=cl;AR.configure=NR;z2.exports=cl;var fye=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function za(e){return e.length<5e3&&!fye.test(e)?`"${e}"`:JSON.stringify(e)}function OR(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var pye=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function CR(e){return pye.call(e)!==void 0&&e.length!==0}function D2(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let s=1;s<r;s++)i+=`${t}"${s}":${n}${e[s]}`;return i}function hye(e){if(_h.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function mye(e){let t;if(_h.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function gye(e,t){let r;if(_h.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function j2(e,t){let r;if(_h.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function ll(e){return e===1?"1 item":`${e} items`}function yye(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function _ye(e){if(_h.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function NR(e){e={...e};let t=_ye(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=hye(e),n=gye(e,"bigint"),i=mye(e),s=typeof i=="function"?i:void 0,o=j2(e,"maximumDepth"),a=j2(e,"maximumBreadth");function u(f,h,v,y,_,b){let g=h[f];switch(typeof g=="object"&&g!==null&&typeof g.toJSON=="function"&&(g=g.toJSON(f)),g=y.call(h,f,g),typeof g){case"string":return za(g);case"object":{if(g===null)return"null";if(v.indexOf(g)!==-1)return r;let m="",S=",",w=b;if(Array.isArray(g)){if(g.length===0)return"[]";if(o<v.length+1)return'"[Array]"';v.push(g),_!==""&&(b+=_,m+=`
6
+ caused by: `+r4(n,t)):r},Cpe=e=>r4(e,new Set),n4=(e,t,r)=>{if(!mh(e))return"";let n=r?"":e.message||"";if(t.has(e))return n+": ...";let i=WT(e);if(i){t.add(e);let s=typeof e.cause=="function";return n+(s?"":": ")+n4(i,t,s)}else return n},Npe=e=>n4(e,new Set);i4.exports={isErrorLike:mh,getErrorCause:WT,stackWithCauses:Cpe,messageWithCauses:Npe}});var GT=T((jtt,o4)=>{"use strict";var Ape=Symbol("circular-ref-tag"),rv=Symbol("pino-raw-err-ref"),s4=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[rv]},set:function(e){this[rv]=e}}});Object.defineProperty(s4,rv,{writable:!0,value:{}});o4.exports={pinoErrProto:s4,pinoErrorSymbols:{seen:Ape,rawSymbol:rv}}});var l4=T((ztt,u4)=>{"use strict";u4.exports=YT;var{messageWithCauses:Dpe,stackWithCauses:jpe,isErrorLike:a4}=JT(),{pinoErrProto:zpe,pinoErrorSymbols:Mpe}=GT(),{seen:KT}=Mpe,{toString:Lpe}=Object.prototype;function YT(e){if(!a4(e))return e;e[KT]=void 0;let t=Object.create(zpe);t.type=Lpe.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=Dpe(e),t.stack=jpe(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>YT(r)));for(let r in e)if(t[r]===void 0){let n=e[r];a4(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,KT)&&(t[r]=YT(n)):t[r]=n}return delete e[KT],t.raw=e,t}});var d4=T((Mtt,c4)=>{"use strict";c4.exports=iv;var{isErrorLike:XT}=JT(),{pinoErrProto:qpe,pinoErrorSymbols:Fpe}=GT(),{seen:nv}=Fpe,{toString:Upe}=Object.prototype;function iv(e){if(!XT(e))return e;e[nv]=void 0;let t=Object.create(qpe);t.type=Upe.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>iv(r))),XT(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,nv)&&(t.cause=iv(e.cause));for(let r in e)if(t[r]===void 0){let n=e[r];XT(n)?Object.prototype.hasOwnProperty.call(n,nv)||(t[r]=iv(n)):t[r]=n}return delete e[nv],t.raw=e,t}});var m4=T((Ltt,h4)=>{"use strict";h4.exports={mapHttpRequest:Zpe,reqSerializer:p4};var QT=Symbol("pino-raw-req-ref"),f4=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[QT]},set:function(e){this[QT]=e}}});Object.defineProperty(f4,QT,{writable:!0,value:{}});function p4(e){let t=e.info||e.socket,r=Object.create(f4);if(r.id=typeof e.id=="function"?e.id():e.id||(e.info?e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let n=e.path;r.url=typeof n=="string"?n:e.url?e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function Zpe(e){return{req:p4(e)}}});var v4=T((qtt,_4)=>{"use strict";_4.exports={mapHttpResponse:Vpe,resSerializer:y4};var eR=Symbol("pino-raw-res-ref"),g4=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[eR]},set:function(e){this[eR]=e}}});Object.defineProperty(g4,eR,{writable:!0,value:{}});function y4(e){let t=Object.create(g4);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function Vpe(e){return{res:y4(e)}}});var rR=T((Ftt,b4)=>{"use strict";var tR=l4(),Hpe=d4(),sv=m4(),ov=v4();b4.exports={err:tR,errWithCause:Hpe,mapHttpRequest:sv.mapHttpRequest,mapHttpResponse:ov.mapHttpResponse,req:sv.reqSerializer,res:ov.resSerializer,wrapErrorSerializer:function(t){return t===tR?t:function(n){return t(tR(n))}},wrapRequestSerializer:function(t){return t===sv.reqSerializer?t:function(n){return t(sv.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===ov.resSerializer?t:function(n){return t(ov.resSerializer(n))}}}});var nR=T((Utt,w4)=>{"use strict";function Bpe(e,t){return t}w4.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=Bpe;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),i=[];for(let s of n)s&&i.push(s.getFileName());return i}});var T4=T((Ztt,E4)=>{"use strict";function iR(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=iR(e[r]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=iR(e[r]));return t}return e}function S4(e){let t=[],r="",n=!1,i=!1,s="";for(let o=0;o<e.length;o++){let a=e[o];!n&&a==="."?r&&(t.push(r),r=""):a==="["?(r&&(t.push(r),r=""),n=!0):a==="]"&&n?(t.push(r),r="",n=!1,i=!1):(a==='"'||a==="'")&&n?i?a===s?(i=!1,s=""):r+=a:(i=!0,s=a):r+=a}return r&&t.push(r),t}function k4(e,t,r){let n=e;for(let s=0;s<t.length-1;s++){let o=t[s];if(typeof n!="object"||n===null||!(o in n)||typeof n[o]!="object"||n[o]===null)return!1;n=n[o]}let i=t[t.length-1];if(i==="*"){if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=r;else if(typeof n=="object"&&n!==null)for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=r)}else typeof n=="object"&&n!==null&&i in n&&Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=r);return!0}function x4(e,t){let r=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof r!="object"||r===null||!(s in r)||typeof r[s]!="object"||r[s]===null)return!1;r=r[s]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let i=0;i<r.length;i++)r[i]=void 0;else if(typeof r=="object"&&r!==null)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&delete r[i]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var av=Symbol("PATH_NOT_FOUND");function Wpe(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return av;r=r[n]}return r}function Jpe(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function Gpe(e,t,r,n=!1){for(let i of t){let s=S4(i);if(s.includes("*"))$4(e,s,r,i,n);else if(n)x4(e,s);else{let o=Wpe(e,s);if(o===av)continue;let a=typeof r=="function"?r(o,s):r;k4(e,s,a)}}}function $4(e,t,r,n,i=!1){let s=t.indexOf("*");if(s===t.length-1){let o=t.slice(0,-1),a=e;for(let u of o){if(a==null||typeof a!="object"||a===null)return;a=a[u]}if(Array.isArray(a))if(i)for(let u=0;u<a.length;u++)a[u]=void 0;else for(let u=0;u<a.length;u++){let l=[...o,u.toString()],c=typeof r=="function"?r(a[u],l):r;a[u]=c}else if(typeof a=="object"&&a!==null)if(i){let u=[];for(let l in a)Object.prototype.hasOwnProperty.call(a,l)&&u.push(l);for(let l of u)delete a[l]}else for(let u in a){let l=[...o,u],c=typeof r=="function"?r(a[u],l):r;a[u]=c}}else Kpe(e,t,r,s,n,i)}function Kpe(e,t,r,n,i,s=!1){let o=t.slice(0,n),a=t.slice(n+1),u=[];function l(c,d){if(d===o.length){if(Array.isArray(c))for(let p=0;p<c.length;p++)u[d]=p.toString(),l(c[p],d+1);else if(typeof c=="object"&&c!==null)for(let p in c)u[d]=p,l(c[p],d+1)}else if(d<o.length){let p=o[d];c&&typeof c=="object"&&c!==null&&p in c&&(u[d]=p,l(c[p],d+1))}else if(a.includes("*"))$4(c,a,typeof r=="function"?(f,h)=>{let v=[...u.slice(0,d),...h];return r(f,v)}:r,i,s);else if(s)x4(c,a);else{let p=typeof r=="function"?r(Jpe(c,a),[...u.slice(0,d),...a]):r;k4(c,a,p)}}if(o.length===0)l(e,0);else{let c=e;for(let d=0;d<o.length;d++){let p=o[d];if(c==null||typeof c!="object"||c===null)return;c=c[p],u[d]=p}c!=null&&l(c,o.length)}}function Ype(e){if(e.length===0)return null;let t=new Map;for(let r of e){let n=S4(r),i=t;for(let s=0;s<n.length;s++){let o=n[s];i.has(o)||i.set(o,new Map),i=i.get(o)}}return t}function Xpe(e,t){if(!t)return e;function r(n,i,s=0){if(!i||i.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let a=[];for(let u=0;u<n.length;u++){let l=u.toString();i.has(l)||i.has("*")?a[u]=r(n[u],i.get(l)||i.get("*")):a[u]=n[u]}return a}let o=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i.has(a)||i.has("*")?o[a]=r(n[a],i.get(a)||i.get("*")):o[a]=n[a]);return o}return r(e,t)}function Qpe(e){if(typeof e!="string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction path (${e})`);let t=0,r=!1,n="";for(let i=0;i<e.length;i++){let s=e[i];if((s==='"'||s==="'")&&t>0)r?s===n&&(r=!1,n=""):(r=!0,n=s);else if(s==="["&&!r)t++;else if(s==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function ehe(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)Qpe(t)}function the(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:i=!0,remove:s=!1}=e;ehe(t);let o=Ype(t);return function(u){if(i&&(u===null||typeof u!="object")&&(u==null||typeof u!="object"))return n?n(u):u;let l=Xpe(u,o),c=u,d=r;return typeof r=="function"&&(d=r),Gpe(l,t,d,s),n===!1?(l.restore=function(){return iR(c)},l):typeof n=="function"?n(l):JSON.stringify(l)}}E4.exports=the});var Gc=T((Vtt,R4)=>{"use strict";var rhe=Symbol("pino.setLevel"),nhe=Symbol("pino.getLevel"),ihe=Symbol("pino.levelVal"),she=Symbol("pino.levelComp"),ohe=Symbol("pino.useLevelLabels"),ahe=Symbol("pino.useOnlyCustomLevels"),uhe=Symbol("pino.mixin"),lhe=Symbol("pino.lsCache"),che=Symbol("pino.chindings"),dhe=Symbol("pino.asJson"),fhe=Symbol("pino.write"),phe=Symbol("pino.redactFmt"),hhe=Symbol("pino.time"),mhe=Symbol("pino.timeSliceIndex"),ghe=Symbol("pino.stream"),yhe=Symbol("pino.stringify"),_he=Symbol("pino.stringifySafe"),vhe=Symbol("pino.stringifiers"),bhe=Symbol("pino.end"),whe=Symbol("pino.formatOpts"),She=Symbol("pino.messageKey"),khe=Symbol("pino.errorKey"),xhe=Symbol("pino.nestedKey"),$he=Symbol("pino.nestedKeyStr"),Ehe=Symbol("pino.mixinMergeStrategy"),The=Symbol("pino.msgPrefix"),Rhe=Symbol("pino.wildcardFirst"),Phe=Symbol.for("pino.serializers"),Ihe=Symbol.for("pino.formatters"),Ohe=Symbol.for("pino.hooks"),Che=Symbol.for("pino.metadata");R4.exports={setLevelSym:rhe,getLevelSym:nhe,levelValSym:ihe,levelCompSym:she,useLevelLabelsSym:ohe,mixinSym:uhe,lsCacheSym:lhe,chindingsSym:che,asJsonSym:dhe,writeSym:fhe,serializersSym:Phe,redactFmtSym:phe,timeSym:hhe,timeSliceIndexSym:mhe,streamSym:ghe,stringifySym:yhe,stringifySafeSym:_he,stringifiersSym:vhe,endSym:bhe,formatOptsSym:whe,messageKeySym:She,errorKeySym:khe,nestedKeySym:xhe,wildcardFirstSym:Rhe,needsMetadataGsym:Che,useOnlyCustomLevelsSym:ahe,formattersSym:Ihe,hooksSym:Ohe,nestedKeyStrSym:$he,mixinMergeStrategySym:Ehe,msgPrefixSym:The}});var oR=T((Htt,C4)=>{"use strict";var P4=T4(),{redactFmtSym:Nhe,wildcardFirstSym:uv}=Gc(),sR=/[^.[\]]+|\[([^[\]]*?)\]/g,I4="[Redacted]",O4=!1;function Ahe(e,t){let{paths:r,censor:n,remove:i}=Dhe(e),s=r.reduce((u,l)=>{sR.lastIndex=0;let c=sR.exec(l),d=sR.exec(l),p=c[1]!==void 0?c[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):c[0];if(p==="*"&&(p=uv),d===null)return u[p]=null,u;if(u[p]===null)return u;let{index:f}=d,h=`${l.substr(f,l.length-1)}`;return u[p]=u[p]||[],p!==uv&&u[p].length===0&&u[p].push(...u[uv]||[]),p===uv&&Object.keys(u).forEach(function(v){u[v]&&u[v].push(h)}),u[p].push(h),u},{}),o={[Nhe]:P4({paths:r,censor:n,serialize:t,strict:O4,remove:i})},a=(...u)=>t(typeof n=="function"?n(...u):n);return[...Object.keys(s),...Object.getOwnPropertySymbols(s)].reduce((u,l)=>{if(s[l]===null)u[l]=c=>a(c,[l]);else{let c=typeof n=="function"?(d,p)=>n(d,[l,...p]):n;u[l]=P4({paths:s[l],censor:c,serialize:t,strict:O4,remove:i})}return u},o)}function Dhe(e){if(Array.isArray(e))return e={paths:e,censor:I4},e;let{paths:t,censor:r=I4,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino – redact must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}C4.exports=Ahe});var D4=T((Btt,A4)=>{"use strict";var jhe=()=>"",zhe=()=>`,"time":${Date.now()}`,Mhe=()=>`,"time":${Math.round(Date.now()/1e3)}`,Lhe=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,qhe=1000000n,N4=1000000000n,Fhe=BigInt(Date.now())*qhe,Uhe=process.hrtime.bigint(),Zhe=()=>{let e=process.hrtime.bigint()-Uhe,t=Fhe+e,r=t/N4,n=t%N4,i=Number(r*1000n+n/1000000n),s=new Date(i),o=s.getUTCFullYear(),a=(s.getUTCMonth()+1).toString().padStart(2,"0"),u=s.getUTCDate().toString().padStart(2,"0"),l=s.getUTCHours().toString().padStart(2,"0"),c=s.getUTCMinutes().toString().padStart(2,"0"),d=s.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${o}-${a}-${u}T${l}:${c}:${d}.${n.toString().padStart(9,"0")}Z"`};A4.exports={nullTime:jhe,epochTime:zhe,unixTime:Mhe,isoTime:Lhe,isoTimeNano:Zhe}});var z4=T((Wtt,j4)=>{"use strict";function Vhe(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}j4.exports=Hhe;function Hhe(e,t,r){var n=r&&r.stringify||Vhe,i=1;if(typeof e=="object"&&e!==null){var s=t.length+i;if(s===1)return e;var o=new Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(t[a]);return o.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var l="",c=1-i,d=-1,p=e&&e.length||0,f=0;f<p;){if(e.charCodeAt(f)===37&&f+1<p){switch(d=d>-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(c>=u||t[c]==null)break;d<f&&(l+=e.slice(d,f)),l+=Number(t[c]),d=f+2,f++;break;case 105:if(c>=u||t[c]==null)break;d<f&&(l+=e.slice(d,f)),l+=Math.floor(Number(t[c])),d=f+2,f++;break;case 79:case 111:case 106:if(c>=u||t[c]===void 0)break;d<f&&(l+=e.slice(d,f));var h=typeof t[c];if(h==="string"){l+="'"+t[c]+"'",d=f+2,f++;break}if(h==="function"){l+=t[c].name||"<anonymous>",d=f+2,f++;break}l+=n(t[c]),d=f+2,f++;break;case 115:if(c>=u)break;d<f&&(l+=e.slice(d,f)),l+=String(t[c]),d=f+2,f++;break;case 37:d<f&&(l+=e.slice(d,f)),l+="%",d=f+2,f++,c--;break}++c}++f}return d===-1?e:(d<p&&(l+=e.slice(d)),l)}});var uR=T((Jtt,aR)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(4));aR.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(t);for(;n>Date.now(););};aR.exports=e}});var H4=T((Gtt,V4)=>{"use strict";var Lr=ie("fs"),Bhe=ie("events"),Whe=ie("util").inherits,M4=ie("path"),cR=uR(),Jhe=ie("assert"),lv=100,cv=Buffer.allocUnsafe(0),Ghe=16*1024,L4="buffer",q4="utf8",[Khe,Yhe]=(process.versions.node||"0.0").split(".").map(Number),Xhe=Khe>=22&&Yhe>=7;function F4(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(s,o){if(s){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",s)}):t.emit("error",s);return}let a=t._reopening;t.fd=o,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():a&&process.nextTick(()=>t.emit("drain")))}let n=t.append?"a":"w",i=t.mode;if(t.sync)try{t.mkdir&&Lr.mkdirSync(M4.dirname(e),{recursive:!0});let s=Lr.openSync(e,n,i);r(null,s)}catch(s){throw r(s),s}else t.mkdir?Lr.mkdir(M4.dirname(e),{recursive:!0},s=>{if(s)return r(s);Lr.open(e,n,i,r)}):Lr.open(e,n,i,r)}function Is(e){if(!(this instanceof Is))return new Is(e);let{fd:t,dest:r,minLength:n,maxLength:i,maxWrite:s,periodicFlush:o,sync:a,append:u=!0,mkdir:l,retryEAGAIN:c,fsync:d,contentMode:p,mode:f}=e||{};t=t||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=i||0,this.maxWrite=s||Ghe,this._periodicFlush=o||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this._fsync=d||!1,this.append=u||!1,this.mode=f,this.retryEAGAIN=c||(()=>!0),this.mkdir=l||!1;let h,v;if(p===L4)this._writingBuf=cv,this.write=tme,this.flush=nme,this.flushSync=sme,this._actualWrite=ame,h=()=>Lr.writeSync(this.fd,this._writingBuf),v=()=>Lr.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===q4)this._writingBuf="",this.write=eme,this.flush=rme,this.flushSync=ime,this._actualWrite=ome,h=()=>Lr.writeSync(this.fd,this._writingBuf,"utf8"),v=()=>Lr.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${q4}" and "${L4}", but passed ${p}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")F4(t,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(y,_)=>{if(y){if((y.code==="EAGAIN"||y.code==="EBUSY")&&this.retryEAGAIN(y,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{cR(lv),this.release(void 0,0)}catch(m){this.release(m)}else setTimeout(v,lv);else this._writing=!1,this.emit("error",y);return}this.emit("write",_);let b=lR(this._writingBuf,this._len,_);if(this._len=b.len,this._writingBuf=b.writingBuf,this._writingBuf.length){if(!this.sync){v();return}try{do{let m=h(),S=lR(this._writingBuf,this._len,m);this._len=S.len,this._writingBuf=S.writingBuf}while(this._writingBuf.length)}catch(m){this.release(m);return}}this._fsync&&Lr.fsyncSync(this.fd);let g=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):g>this.minLength?this._actualWrite():this._ending?g>0?this._actualWrite():(this._writing=!1,dv(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(Qhe,this)):this.emit("drain"))},this.on("newListener",function(y){y==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function lR(e,t,r){return typeof e=="string"&&Buffer.byteLength(e)!==r&&(r=Buffer.from(e).subarray(0,r).toString().length),t=Math.max(t-r,0),e=e.slice(r),{writingBuf:e,len:t}}function Qhe(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}Whe(Is,Bhe);function U4(e,t){return e.length===0?cv:e.length===1?e[0]:Buffer.concat(e,t)}function eme(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||r[r.length-1].length+e.length>this.maxWrite?r.push(""+e):r[r.length-1]+=e,this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function tme(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs,n=this._lens;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||n[n.length-1]+e.length>this.maxWrite?(r.push([e]),n.push(e.length)):(r[r.length-1].push(e),n[n.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function Z4(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{Lr.fsync(this.fd,n=>{this._flushPending=!1,e(n)})}catch(n){e(n)}this.off("error",r)},r=n=>{this._flushPending=!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function rme(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Z4.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function nme(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Z4.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Is.prototype.reopen=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&Lr.close(t,r=>{if(r)return this.emit("error",r)})}),F4(this.file,this)};Is.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():dv(this)))};function ime(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e;){e.length<=0&&(e=this._bufs[0]);try{let t=Lr.writeSync(this.fd,e,"utf8"),r=lR(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;cR(lv)}}try{Lr.fsyncSync(this.fd)}catch{}}function sme(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=cv);let e=cv;for(;this._bufs.length||e.length;){e.length<=0&&(e=U4(this._bufs[0],this._lens[0]));try{let t=Lr.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;cR(lv)}}}Is.prototype.destroy=function(){this.destroyed||dv(this)};function ome(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let t=Lr.writeSync(this.fd,this._writingBuf,"utf8");e(null,t)}catch(t){e(t)}else Lr.write(this.fd,this._writingBuf,"utf8",e)}function ame(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:U4(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=Lr.writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else Xhe&&(this._writingBuf=Buffer.from(this._writingBuf)),Lr.write(this.fd,this._writingBuf,e)}function dv(e){if(e.fd===-1){e.once("ready",dv.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],Jhe(typeof e.fd=="number",`sonic.fd must be a number, got ${typeof e.fd}`);try{Lr.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?Lr.close(e.fd,r):r()}function r(n){if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}Is.SonicBoom=Is;Is.default=Is;V4.exports=Is});var dR=T((Ktt,K4)=>{"use strict";var Os={exit:[],beforeExit:[]},B4={exit:cme,beforeExit:dme},Kc;function ume(){Kc===void 0&&(Kc=new FinalizationRegistry(fme))}function lme(e){Os[e].length>0||process.on(e,B4[e])}function W4(e){Os[e].length>0||(process.removeListener(e,B4[e]),Os.exit.length===0&&Os.beforeExit.length===0&&(Kc=void 0))}function cme(){J4("exit")}function dme(){J4("beforeExit")}function J4(e){for(let t of Os[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}Os[e]=[]}function fme(e){for(let t of["exit","beforeExit"]){let r=Os[t].indexOf(e);Os[t].splice(r,r+1),W4(t)}}function G4(e,t,r){if(t===void 0)throw new Error("the object can't be undefined");lme(e);let n=new WeakRef(t);n.fn=r,ume(),Kc.register(t,n),Os[e].push(n)}function pme(e,t){G4("exit",e,t)}function hme(e,t){G4("beforeExit",e,t)}function mme(e){if(Kc!==void 0){Kc.unregister(e);for(let t of["exit","beforeExit"])Os[t]=Os[t].filter(r=>{let n=r.deref();return n&&n!==e}),W4(t)}}K4.exports={register:pme,registerBeforeExit:hme,unregister:mme}});var Y4=T((Ytt,gme)=>{gme.exports={name:"thread-stream",version:"4.0.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^22.0.0","@yao-pkg/pkg":"^6.0.0",borp:"^0.21.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",husky:"^9.0.6",neostandard:"^0.12.2","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"tsc --noEmit",lint:"eslint",test:"npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:ci":"npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:yarn":"npm run transpile && borp --pattern 'test/*.test.js'",transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var Q4=T((Xtt,X4)=>{"use strict";function yme(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,o=()=>{let a=Atomics.load(e,t);if(a===r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let u=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),l=Atomics.waitAsync(e,t,a,u);l.async?l.value.then(o):setImmediate(o)};o()}function _me(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,o=()=>{if(Atomics.load(e,t)!==r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let u=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),l=Atomics.waitAsync(e,t,r,u);l.async?l.value.then(o):setImmediate(o)};o()}X4.exports={wait:yme,waitDiff:_me}});var t2=T((Qtt,e2)=>{"use strict";e2.exports={WRITE_INDEX:4,READ_INDEX:8}});var o2=T((ert,s2)=>{"use strict";var{version:vme}=Y4(),{EventEmitter:bme}=ie("events"),{Worker:wme}=ie("worker_threads"),{join:Sme}=ie("path"),{pathToFileURL:kme}=ie("url"),{wait:xme}=Q4(),{WRITE_INDEX:li,READ_INDEX:ui}=t2(),$me=ie("buffer"),Eme=ie("assert"),re=Symbol("kImpl"),Tme=$me.constants.MAX_STRING_LENGTH,gh=class{constructor(t){this._value=t}deref(){return this._value}},pv=class{register(){}unregister(){}},Rme=process.env.NODE_V8_COVERAGE?pv:global.FinalizationRegistry||pv,Pme=process.env.NODE_V8_COVERAGE?gh:global.WeakRef||gh,r2=new Rme(e=>{e.exited||e.terminate()});function Ime(e,t){let{filename:r,workerData:n}=t,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||Sme(__dirname,"lib","worker.js"),o=new wme(s,{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:kme(r).href,dataBuf:e[re].dataBuf,stateBuf:e[re].stateBuf,workerData:{$context:{threadStreamVersion:vme},...n}}});return o.stream=new gh(e),o.on("message",Ome),o.on("exit",i2),r2.register(e,o),o}function n2(e){Eme(!e[re].sync),e[re].needDrain&&(e[re].needDrain=!1,e.emit("drain"))}function fv(e){let t=Atomics.load(e[re].state,li),r=e[re].data.length-t;if(r>0){if(e[re].buf.length===0){e[re].flushing=!1,e[re].ending?gR(e):e[re].needDrain&&process.nextTick(n2,e);return}let n=e[re].buf.slice(0,r),i=Buffer.byteLength(n);i<=r?(e[re].buf=e[re].buf.slice(r),hv(e,n,fv.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[re].state,ui,0),Atomics.store(e[re].state,li,0),Atomics.notify(e[re].state,ui);i>e[re].data.length;)r=r/2,n=e[re].buf.slice(0,r),i=Buffer.byteLength(n);e[re].buf=e[re].buf.slice(r),hv(e,n,fv.bind(null,e))}})}else if(r===0){if(t===0&&e[re].buf.length===0)return;e.flush(()=>{Atomics.store(e[re].state,ui,0),Atomics.store(e[re].state,li,0),Atomics.notify(e[re].state,ui),fv(e)})}else io(e,new Error("overwritten"))}function Ome(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case"READY":this.stream=new Pme(t),t.flush(()=>{t[re].ready=!0,t.emit("ready")});break;case"ERROR":io(t,e.err);break;case"EVENT":Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"WARNING":process.emitWarning(e.err);break;default:io(t,new Error("this should not happen: "+e.code))}}function i2(e){let t=this.stream.deref();t!==void 0&&(r2.unregister(t),t.worker.exited=!0,t.worker.off("exit",i2),io(t,e!==0?new Error("the worker thread exited"):null))}var pR=class extends bme{constructor(t={}){if(super(),t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[re]={},this[re].stateBuf=new SharedArrayBuffer(128),this[re].state=new Int32Array(this[re].stateBuf),this[re].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[re].data=Buffer.from(this[re].dataBuf),this[re].sync=t.sync||!1,this[re].ending=!1,this[re].ended=!1,this[re].needDrain=!1,this[re].destroyed=!1,this[re].flushing=!1,this[re].ready=!1,this[re].finished=!1,this[re].errored=null,this[re].closed=!1,this[re].buf="",this.worker=Ime(this,t),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(t){if(this[re].destroyed)return hR(this,new Error("the worker has exited")),!1;if(this[re].ending)return hR(this,new Error("the worker is ending")),!1;if(this[re].flushing&&this[re].buf.length+t.length>=Tme)try{fR(this),this[re].flushing=!0}catch(r){return io(this,r),!1}if(this[re].buf+=t,this[re].sync)try{return fR(this),!0}catch(r){return io(this,r),!1}return this[re].flushing||(this[re].flushing=!0,setImmediate(fv,this)),this[re].needDrain=this[re].data.length-this[re].buf.length-Atomics.load(this[re].state,li)<=0,!this[re].needDrain}end(){this[re].destroyed||(this[re].ending=!0,gR(this))}flush(t){if(this[re].destroyed){typeof t=="function"&&process.nextTick(t,new Error("the worker has exited"));return}let r=Atomics.load(this[re].state,li);xme(this[re].state,ui,r,1/0,(n,i)=>{if(n){io(this,n),process.nextTick(t,n);return}if(i==="not-equal"){this.flush(t);return}process.nextTick(t)})}flushSync(){this[re].destroyed||(fR(this),mR(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[re].ready}get destroyed(){return this[re].destroyed}get closed(){return this[re].closed}get writable(){return!this[re].destroyed&&!this[re].ending}get writableEnded(){return this[re].ending}get writableFinished(){return this[re].finished}get writableNeedDrain(){return this[re].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[re].errored}};function hR(e,t){setImmediate(()=>{e.emit("error",t)})}function io(e,t){e[re].destroyed||(e[re].destroyed=!0,t&&(e[re].errored=t,hR(e,t)),e.worker.exited?setImmediate(()=>{e[re].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[re].closed=!0,e.emit("close")}))}function hv(e,t,r){let n=Atomics.load(e[re].state,li),i=Buffer.byteLength(t);return e[re].data.write(t,n),Atomics.store(e[re].state,li,n+i),Atomics.notify(e[re].state,li),r(),!0}function gR(e){if(!(e[re].ended||!e[re].ending||e[re].flushing)){e[re].ended=!0;try{e.flushSync();let t=Atomics.load(e[re].state,ui);Atomics.store(e[re].state,li,-1),Atomics.notify(e[re].state,li);let r=0;for(;t!==-1;){if(Atomics.wait(e[re].state,ui,t,1e3),t=Atomics.load(e[re].state,ui),t===-2){io(e,new Error("end() failed"));return}if(++r===10){io(e,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{e[re].finished=!0,e.emit("finish")})}catch(t){io(e,t)}}}function fR(e){let t=()=>{e[re].ending?gR(e):e[re].needDrain&&process.nextTick(n2,e)};for(e[re].flushing=!1;e[re].buf.length!==0;){let r=Atomics.load(e[re].state,li),n=e[re].data.length-r;if(n===0){mR(e),Atomics.store(e[re].state,ui,0),Atomics.store(e[re].state,li,0),Atomics.notify(e[re].state,ui);continue}else if(n<0)throw new Error("overwritten");let i=e[re].buf.slice(0,n),s=Buffer.byteLength(i);if(s<=n)e[re].buf=e[re].buf.slice(n),hv(e,i,t);else{for(mR(e),Atomics.store(e[re].state,ui,0),Atomics.store(e[re].state,li,0),Atomics.notify(e[re].state,ui);s>e[re].buf.length;)n=n/2,i=e[re].buf.slice(0,n),s=Buffer.byteLength(i);e[re].buf=e[re].buf.slice(n),hv(e,i,t)}}}function mR(e){if(e[re].flushing)throw new Error("unable to flush while flushing");let t=Atomics.load(e[re].state,li),r=0;for(;;){let n=Atomics.load(e[re].state,ui);if(n===-2)throw Error("_flushSync failed");if(n!==t)Atomics.wait(e[re].state,ui,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}s2.exports=pR});var vR=T((trt,a2)=>{"use strict";var{createRequire:Cme}=ie("module"),Nme=nR(),{join:yR,isAbsolute:Ame,sep:Dme}=ie("node:path"),jme=uR(),_R=dR(),zme=o2();function Mme(e){_R.register(e,Fme),_R.registerBeforeExit(e,Ume),e.on("close",function(){_R.unregister(e)})}function Lme(){let e=process.execArgv;for(let t=0;t<e.length;t++){let r=e[t];if(r==="--import"||r==="--require"||r==="-r"||r.startsWith("--import=")||r.startsWith("--require=")||r.startsWith("-r="))return!0}return!1}function qme(e,t,r,n,i){!r.execArgv&&Lme()&&ie.main===void 0&&(r={...r,execArgv:[]}),r={...r,name:i};let s=new zme({filename:e,workerData:t,workerOpts:r,sync:n});s.on("ready",o),s.on("close",function(){process.removeListener("exit",a)}),process.on("exit",a);function o(){process.removeListener("exit",a),s.unref(),r.autoEnd!==!1&&Mme(s)}function a(){s.closed||(s.flushSync(),jme(100),s.end())}return s}function Fme(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function Ume(e){e.flushSync()}function Zme(e){let{pipeline:t,targets:r,levels:n,dedupe:i,worker:s={},caller:o=Nme(),sync:a=!1}=e,u={...e.options},l=typeof o=="string"?[o]:o,c=typeof globalThis=="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),d=e.target;if(d&&r)throw new Error("only one of target or targets can be specified");r?(d=c["pino-worker"]||yR(__dirname,"worker.js"),u.targets=r.filter(h=>h.target).map(h=>({...h,target:f(h.target)})),u.pipelines=r.filter(h=>h.pipeline).map(h=>h.pipeline.map(v=>({...v,level:h.level,target:f(v.target)})))):t&&(d=c["pino-worker"]||yR(__dirname,"worker.js"),u.pipelines=[t.map(h=>({...h,target:f(h.target)}))]),n&&(u.levels=n),i&&(u.dedupe=i),u.pinoWillSendConfig=!0;let p=r||t?"pino.transport":d;return qme(f(d),u,s,a,p);function f(h){if(h=c[h]||h,Ame(h)||h.indexOf("file://")===0)return h;if(h==="pino/file")return yR(__dirname,"..","file.js");let v;for(let y of l)try{let _=y==="node:repl"?process.cwd()+Dme:y;v=Cme(_).resolve(h);break}catch{continue}if(!v)throw new Error(`unable to determine transport target for "${h}"`);return v}}a2.exports=Zme});var yv=T((nrt,b2)=>{"use strict";var Vme=ie("node:diagnostics_channel"),u2=z4(),{mapHttpRequest:Hme,mapHttpResponse:Bme}=rR(),wR=H4(),l2=dR(),{lsCacheSym:Wme,chindingsSym:h2,writeSym:c2,serializersSym:m2,formatOptsSym:d2,endSym:Jme,stringifiersSym:g2,stringifySym:y2,stringifySafeSym:SR,wildcardFirstSym:_2,nestedKeySym:Gme,formattersSym:v2,messageKeySym:Kme,errorKeySym:Yme,nestedKeyStrSym:Xme,msgPrefixSym:mv}=Gc(),{isMainThread:Qme}=ie("worker_threads"),ege=vR(),[tge]=process.versions.node.split(".").map(e=>Number(e)),f2=Vme.tracingChannel("pino_asJson"),bR=tge>=25?e=>JSON.stringify(e):nge;function Yc(){}function rge(e,t){if(!t)return r;return function(...i){t.call(this,i,r,e)};function r(n,...i){if(typeof n=="object"){let s=n;n!==null&&(n.method&&n.headers&&n.socket?n=Hme(n):typeof n.setHeader=="function"&&(n=Bme(n)));let o;s===null&&i.length===0?o=[null]:(s=i.shift(),o=i),typeof this[mv]=="string"&&s!==void 0&&s!==null&&(s=this[mv]+s),this[c2](n,u2(s,o,this[d2]),e)}else{let s=n===void 0?i.shift():n;typeof this[mv]=="string"&&s!==void 0&&s!==null&&(s=this[mv]+s),this[c2](null,u2(s,i,this[d2]),e)}}}function nge(e){let t="",r=0,n=!1,i=255,s=e.length;if(s>100)return JSON.stringify(e);for(var o=0;o<s&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(r,o)+"\\",r=o,n=!0);return n?t+=e.slice(r):t=e,i<32?JSON.stringify(e):'"'+t+'"'}function ige(e,t,r,n){if(f2.hasSubscribers===!1)return p2.call(this,e,t,r,n);let i={instance:this,arguments};return f2.traceSync(p2,i,this,e,t,r,n)}function p2(e,t,r,n){let i=this[y2],s=this[SR],o=this[g2],a=this[Jme],u=this[h2],l=this[m2],c=this[v2],d=this[Kme],p=this[Yme],f=this[Wme][r]+n;f=f+u;let h;c.log&&(e=c.log(e));let v=o[_2],y="";for(let b in e)if(h=e[b],Object.prototype.hasOwnProperty.call(e,b)&&h!==void 0){l[b]?h=l[b](h):b===p&&l.err&&(h=l.err(h));let g=o[b]||v;switch(typeof h){case"undefined":case"function":continue;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":g&&(h=g(h));break;case"string":h=(g||bR)(h);break;default:h=(g||i)(h,s)}if(h===void 0)continue;let m=bR(b);y+=","+m+":"+h}let _="";if(t!==void 0){h=l[d]?l[d](t):t;let b=o[d]||v;switch(typeof h){case"function":break;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":b&&(h=b(h)),_=',"'+d+'":'+h;break;case"string":h=(b||bR)(h),_=',"'+d+'":'+h;break;default:h=(b||i)(h,s),_=',"'+d+'":'+h}}return this[Gme]&&y?f+this[Xme]+y.slice(1)+"}"+_+a:f+y+_+a}function sge(e,t){let r,n=e[h2],i=e[y2],s=e[SR],o=e[g2],a=o[_2],u=e[m2],l=e[v2].bindings;t=l(t);for(let c in t)if(r=t[c],((c.length<5||c!=="level"&&c!=="serializers"&&c!=="formatters"&&c!=="customLevels")&&t.hasOwnProperty(c)&&r!==void 0)===!0){if(r=u[c]?u[c](r):r,r=(o[c]||a||i)(r,s),r===void 0)continue;n+=',"'+c+'":'+r}return n}function oge(e){return e.write!==e.constructor.prototype.write}function gv(e){let t=new wR(e);return t.on("error",r),!e.sync&&Qme&&(l2.register(t,age),t.on("close",function(){l2.unregister(t)})),t;function r(n){if(n.code==="EPIPE"){t.write=Yc,t.end=Yc,t.flushSync=Yc,t.destroy=Yc;return}t.removeListener("error",r),t.emit("error",n)}}function age(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}function uge(e){return function(r,n,i={},s){if(typeof i=="string")s=gv({dest:i}),i={};else if(typeof s=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");s=gv({dest:s})}else if(i instanceof wR||i.writable||i._writableState)s=i,i={};else if(i.transport){if(i.transport instanceof wR||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let u;i.customLevels&&(u=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),s=ege({caller:n,...i.transport,levels:u})}if(i=Object.assign({},e,i),i.serializers=Object.assign({},e.serializers,i.serializers),i.formatters=Object.assign({},e.formatters,i.formatters),i.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:o,onChild:a}=i;return o===!1&&(i.level="silent"),a||(i.onChild=Yc),s||(oge(process.stdout)?s=process.stdout:s=gv({fd:process.stdout.fd||1})),{opts:i,stream:s}}}function lge(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[SR])(e)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function cge(e,t,r){return{level:e,bindings:t,log:r}}function dge(e){let t=Number(e);return typeof e=="string"&&Number.isFinite(t)?t:e===void 0?1:e}b2.exports={noop:Yc,buildSafeSonicBoom:gv,asChindings:sge,asJson:ige,genLog:rge,createArgsNormalizer:uge,stringify:lge,buildFormatters:cge,normalizeDestFileDescriptor:dge}});var _v=T((irt,w2)=>{var fge={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},pge={ASC:"ASC",DESC:"DESC"};w2.exports={DEFAULT_LEVELS:fge,SORTING_ORDER:pge}});var $R=T((srt,$2)=>{"use strict";var{lsCacheSym:hge,levelValSym:kR,useOnlyCustomLevelsSym:mge,streamSym:gge,formattersSym:yge,hooksSym:_ge,levelCompSym:S2}=Gc(),{noop:vge,genLog:al}=yv(),{DEFAULT_LEVELS:so,SORTING_ORDER:k2}=_v(),x2={fatal:e=>{let t=al(so.fatal,e);return function(...r){let n=this[gge];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:e=>al(so.error,e),warn:e=>al(so.warn,e),info:e=>al(so.info,e),debug:e=>al(so.debug,e),trace:e=>al(so.trace,e)},xR=Object.keys(so).reduce((e,t)=>(e[so[t]]=t,e),{}),bge=Object.keys(xR).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function wge(e){let t=e[yge].level,{labels:r}=e.levels,n={};for(let i in r){let s=t(r[i],Number(i));n[i]=JSON.stringify(s).slice(0,-1)}return e[hge]=n,e}function Sge(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function kge(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[kR],i=this[kR]=r[e],s=this[mge],o=this[S2],a=this[_ge].logMethod;for(let u in r){if(o(r[u],i)===!1){this[u]=vge;continue}this[u]=Sge(u,s)?x2[u](a):al(r[u],a)}this.emit("level-change",e,i,t[n],n,this)}function xge(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function $ge(e){let{values:t}=this.levels,r=t[e];return r!==void 0&&this[S2](r,this[kR])}function Ege(e,t,r){return e===k2.DESC?t<=r:t>=r}function Tge(e){return typeof e=="string"?Ege.bind(null,e):e}function Rge(e=null,t=!1){let r=e?Object.keys(e).reduce((s,o)=>(s[e[o]]=o,s),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:xR,r),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:so,e);return{labels:n,values:i}}function Pge(e,t,r){if(typeof e=="number"){if(![].concat(Object.keys(t||{}).map(s=>t[s]),r?[]:Object.keys(xR).map(s=>+s),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:so,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function Ige(e,t){let{labels:r,values:n}=e;for(let i in t){if(i in n)throw Error("levels cannot be overridden");if(t[i]in r)throw Error("pre-existing level values cannot be used for new levels")}}function Oge(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(k2).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}$2.exports={initialLsCache:bge,genLsCache:wge,levelMethods:x2,getLevel:xge,setLevel:kge,isLevelEnabled:$ge,mappings:Rge,assertNoLevelCollisions:Ige,assertDefaultLevelFound:Pge,genLevelComparison:Tge,assertLevelComparison:Oge}});var ER=T((ort,E2)=>{"use strict";E2.exports={version:"10.3.0"}});var A2=T((urt,N2)=>{"use strict";var{EventEmitter:Cge}=ie("node:events"),{lsCacheSym:Nge,levelValSym:Age,setLevelSym:RR,getLevelSym:T2,chindingsSym:bv,mixinSym:Dge,asJsonSym:P2,writeSym:jge,mixinMergeStrategySym:zge,timeSym:Mge,timeSliceIndexSym:Lge,streamSym:I2,serializersSym:ul,formattersSym:yh,errorKeySym:qge,messageKeySym:Fge,useOnlyCustomLevelsSym:Uge,needsMetadataGsym:Zge,redactFmtSym:Vge,stringifySym:Hge,formatOptsSym:Bge,stringifiersSym:Wge,msgPrefixSym:PR,hooksSym:Jge}=Gc(),{getLevel:Gge,setLevel:Kge,isLevelEnabled:Yge,mappings:Xge,initialLsCache:Qge,genLsCache:eye,assertNoLevelCollisions:tye}=$R(),{asChindings:IR,asJson:rye,buildFormatters:TR,stringify:R2,noop:O2}=yv(),{version:nye}=ER(),iye=oR(),sye=class{},C2={constructor:sye,child:oye,bindings:aye,setBindings:uye,flush:dye,isLevelEnabled:Yge,version:nye,get level(){return this[T2]()},set level(e){this[RR](e)},get levelVal(){return this[Age]},set levelVal(e){throw Error("levelVal is read-only")},get msgPrefix(){return this[PR]},get[Symbol.toStringTag](){return"Pino"},[Nge]:Qge,[jge]:cye,[P2]:rye,[T2]:Gge,[RR]:Kge};Object.setPrototypeOf(C2,Cge.prototype);N2.exports=function(){return Object.create(C2)};var vv=e=>e;function oye(e,t){if(!e)throw Error("missing bindings for child Pino");let r=this[ul],n=this[yh],i=Object.create(this);if(t==null)return i[yh].bindings!==vv&&(i[yh]=TR(n.level,vv,n.log)),i[bv]=IR(i,e),this.onChild!==O2&&this.onChild(i),i;if(t.hasOwnProperty("serializers")===!0){i[ul]=Object.create(null);for(let l in r)i[ul][l]=r[l];let a=Object.getOwnPropertySymbols(r);for(var s=0;s<a.length;s++){let l=a[s];i[ul][l]=r[l]}for(let l in t.serializers)i[ul][l]=t.serializers[l];let u=Object.getOwnPropertySymbols(t.serializers);for(var o=0;o<u.length;o++){let l=u[o];i[ul][l]=t.serializers[l]}}else i[ul]=r;if(t.hasOwnProperty("formatters")){let{level:a,bindings:u,log:l}=t.formatters;i[yh]=TR(a||n.level,u||vv,l||n.log)}else i[yh]=TR(n.level,vv,n.log);if(t.hasOwnProperty("customLevels")===!0&&(tye(this.levels,t.customLevels),i.levels=Xge(t.customLevels,i[Uge]),eye(i)),typeof t.redact=="object"&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let a=iye(i.redact,R2),u={stringify:a[Vge]};i[Hge]=R2,i[Wge]=a,i[Bge]=u}if(typeof t.msgPrefix=="string"&&(i[PR]=(this[PR]||"")+t.msgPrefix),i[bv]=IR(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;i[RR](a)}return this.onChild(i),i}function aye(){let t=`{${this[bv].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function uye(e){let t=IR(this,e);this[bv]=t}function lye(e,t){return Object.assign(t,e)}function cye(e,t,r){let n=this[Mge](),i=this[Dge],s=this[qge],o=this[Fge],a=this[zge]||lye,u,l=this[Jge].streamWrite;e==null?u={}:e instanceof Error?(u={[s]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[s]&&(t=e[s].message)),i&&(u=a(u,i(u,r,this)));let c=this[P2](u,t,r,n),d=this[I2];d[Zge]===!0&&(d.lastLevel=r,d.lastObj=u,d.lastMsg=t,d.lastTime=n.slice(this[Lge]),d.lastLogger=this),d.write(l?l(c):c)}function dye(e){if(e!=null&&typeof e!="function")throw Error("callback must be a function");let t=this[I2];typeof t.flush=="function"?t.flush(e||O2):e&&e()}});var M2=T((AR,z2)=>{"use strict";var{hasOwnProperty:_h}=Object.prototype,cl=NR();cl.configure=NR;cl.stringify=cl;cl.default=cl;AR.stringify=cl;AR.configure=NR;z2.exports=cl;var fye=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function za(e){return e.length<5e3&&!fye.test(e)?`"${e}"`:JSON.stringify(e)}function OR(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var pye=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function CR(e){return pye.call(e)!==void 0&&e.length!==0}function D2(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let s=1;s<r;s++)i+=`${t}"${s}":${n}${e[s]}`;return i}function hye(e){if(_h.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function mye(e){let t;if(_h.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function gye(e,t){let r;if(_h.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function j2(e,t){let r;if(_h.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function ll(e){return e===1?"1 item":`${e} items`}function yye(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function _ye(e){if(_h.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function NR(e){e={...e};let t=_ye(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=hye(e),n=gye(e,"bigint"),i=mye(e),s=typeof i=="function"?i:void 0,o=j2(e,"maximumDepth"),a=j2(e,"maximumBreadth");function u(f,h,v,y,_,b){let g=h[f];switch(typeof g=="object"&&g!==null&&typeof g.toJSON=="function"&&(g=g.toJSON(f)),g=y.call(h,f,g),typeof g){case"string":return za(g);case"object":{if(g===null)return"null";if(v.indexOf(g)!==-1)return r;let m="",S=",",w=b;if(Array.isArray(g)){if(g.length===0)return"[]";if(o<v.length+1)return'"[Array]"';v.push(g),_!==""&&(b+=_,m+=`
7
7
  ${b}`,S=`,
8
8
  ${b}`);let C=Math.min(g.length,a),$=0;for(;$<C-1;$++){let A=u(String($),g,v,y,_,b);m+=A!==void 0?A:"null",m+=S}let N=u(String($),g,v,y,_,b);if(m+=N!==void 0?N:"null",g.length-1>a){let A=g.length-a-1;m+=`${S}"... ${ll(A)} not stringified"`}return _!==""&&(m+=`
9
9
  ${w}`),v.pop(),`[${m}]`}let k=Object.keys(g),x=k.length;if(x===0)return"{}";if(o<v.length+1)return'"[Object]"';let R="",E="";_!==""&&(b+=_,S=`,
@@ -23,7 +23,7 @@ ${_}`,w="",k="",x=Math.min(m,a);CR(h)&&(w+=D2(h,S,a),g=g.slice(h.length),x-=h.le
23
23
  ${_}${w}
24
24
  ${b}`),v.pop(),`{${w}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return t?t(h):void 0}}function d(f,h,v){switch(typeof h){case"string":return za(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(f),typeof h!="object")return d(f,h,v);if(h===null)return"null"}if(v.indexOf(h)!==-1)return r;let y="",_=h.length!==void 0;if(_&&Array.isArray(h)){if(h.length===0)return"[]";if(o<v.length+1)return'"[Array]"';v.push(h);let w=Math.min(h.length,a),k=0;for(;k<w-1;k++){let R=d(String(k),h[k],v);y+=R!==void 0?R:"null",y+=","}let x=d(String(k),h[k],v);if(y+=x!==void 0?x:"null",h.length-1>a){let R=h.length-a-1;y+=`,"... ${ll(R)} not stringified"`}return v.pop(),`[${y}]`}let b=Object.keys(h),g=b.length;if(g===0)return"{}";if(o<v.length+1)return'"[Object]"';let m="",S=Math.min(g,a);_&&CR(h)&&(y+=D2(h,",",a),b=b.slice(h.length),S-=h.length,m=","),i&&(b=OR(b,s)),v.push(h);for(let w=0;w<S;w++){let k=b[w],x=d(k,h[k],v);x!==void 0&&(y+=`${m}${za(k)}:${x}`,m=",")}if(g>a){let w=g-a;y+=`${m}"...":"${ll(w)} not stringified"`}return v.pop(),`{${y}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return t?t(h):void 0}}function p(f,h,v){if(arguments.length>1){let y="";if(typeof v=="number"?y=" ".repeat(Math.min(v,10)):typeof v=="string"&&(y=v.slice(0,10)),h!=null){if(typeof h=="function")return u("",{"":f},[],h,y,"");if(Array.isArray(h))return l("",f,[],yye(h),y,"")}if(y.length!==0)return c("",f,[],y,"")}return d("",f,[])}return p}});var U2=T((lrt,F2)=>{"use strict";var DR=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:q2}=_v(),vye=q2.info;function bye(e,t){e=e||[],t=t||{dedupe:!1};let r=Object.create(q2);r.silent=1/0,t.levels&&typeof t.levels=="object"&&Object.keys(t.levels).forEach(d=>{r[d]=t.levels[d]});let n={write:i,add:a,remove:u,emit:s,flushSync:o,end:l,minLevel:0,lastId:0,streams:[],clone:c,[DR]:!0,streamLevels:r};return Array.isArray(e)?e.forEach(a,n):a.call(n,e),e=null,n;function i(d){let p,f=this.lastLevel,{streams:h}=this,v=0,y;for(let _=wye(h.length,t.dedupe);kye(_,h.length,t.dedupe);_=Sye(_,t.dedupe))if(p=h[_],p.level<=f){if(v!==0&&v!==p.level)break;if(y=p.stream,y[DR]){let{lastTime:b,lastMsg:g,lastObj:m,lastLogger:S}=this;y.lastLevel=f,y.lastTime=b,y.lastMsg=g,y.lastObj=m,y.lastLogger=S}y.write(d),t.dedupe&&(v=p.level)}else if(!t.dedupe)break}function s(...d){for(let{stream:p}of this.streams)typeof p.emit=="function"&&p.emit(...d)}function o(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync()}function a(d){if(!d)return n;let p=typeof d.write=="function"||d.stream,f=d.write?d:d.stream;if(!p)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:h,streamLevels:v}=this,y;typeof d.levelVal=="number"?y=d.levelVal:typeof d.level=="string"?y=v[d.level]:typeof d.level=="number"?y=d.level:y=vye;let _={stream:f,level:y,levelVal:void 0,id:++n.lastId};return h.unshift(_),h.sort(L2),this.minLevel=h[0].level,n}function u(d){let{streams:p}=this,f=p.findIndex(h=>h.id===d);return f>=0&&(p.splice(f,1),p.sort(L2),this.minLevel=p.length>0?p[0].level:-1),n}function l(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync(),d.end()}function c(d){let p=new Array(this.streams.length);for(let f=0;f<p.length;f++)p[f]={level:d,stream:this.streams[f].stream};return{write:i,add:a,remove:u,minLevel:d,streams:p,clone:c,emit:s,flushSync:o,[DR]:!0}}}function L2(e,t){return e.level-t.level}function wye(e,t){return t?e-1:0}function Sye(e,t){return t?e-1:e+1}function kye(e,t,r){return r?e>=0:e<t}F2.exports=bye});var r6=T((crt,Ji)=>{"use strict";var xye=ie("node:os"),K2=rR(),$ye=nR(),Eye=oR(),Y2=D4(),Tye=A2(),X2=Gc(),{configure:Rye}=M2(),{assertDefaultLevelFound:Pye,mappings:Q2,genLsCache:Iye,genLevelComparison:Oye,assertLevelComparison:Cye}=$R(),{DEFAULT_LEVELS:e6,SORTING_ORDER:Nye}=_v(),{createArgsNormalizer:Aye,asChindings:Dye,buildSafeSonicBoom:Z2,buildFormatters:jye,stringify:jR,normalizeDestFileDescriptor:V2,noop:zye}=yv(),{version:Mye}=ER(),{chindingsSym:H2,redactFmtSym:Lye,serializersSym:B2,timeSym:qye,timeSliceIndexSym:Fye,streamSym:Uye,stringifySym:W2,stringifySafeSym:zR,stringifiersSym:J2,setLevelSym:Zye,endSym:Vye,formatOptsSym:Hye,messageKeySym:Bye,errorKeySym:Wye,nestedKeySym:Jye,mixinSym:Gye,levelCompSym:Kye,useOnlyCustomLevelsSym:Yye,formattersSym:G2,hooksSym:Xye,nestedKeyStrSym:Qye,mixinMergeStrategySym:e_e,msgPrefixSym:t_e}=X2,{epochTime:t6,nullTime:r_e}=Y2,{pid:n_e}=process,i_e=xye.hostname(),s_e=K2.err,o_e={level:"info",levelComparison:Nye.ASC,levels:e6,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:n_e,hostname:i_e},serializers:Object.assign(Object.create(null),{err:s_e}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:t6,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},a_e=Aye(o_e),u_e=Object.assign(Object.create(null),K2);function MR(...e){let t={},{opts:r,stream:n}=a_e(t,$ye(),...e);r.level&&typeof r.level=="string"&&e6[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:i,crlf:s,serializers:o,timestamp:a,messageKey:u,errorKey:l,nestedKey:c,base:d,name:p,level:f,customLevels:h,levelComparison:v,mixin:y,mixinMergeStrategy:_,useOnlyCustomLevels:b,formatters:g,hooks:m,depthLimit:S,edgeLimit:w,onChild:k,msgPrefix:x}=r,R=Rye({maximumDepth:S,maximumBreadth:w}),E=jye(g.level,g.bindings,g.log),P=jR.bind({[zR]:R}),C=i?Eye(i,P):{},$=i?{stringify:C[Lye]}:{stringify:P},N="}"+(s?`\r
25
25
  `:`
26
- `),A=Dye.bind(null,{[H2]:"",[B2]:o,[J2]:C,[W2]:jR,[zR]:R,[G2]:E}),W="";d!==null&&(p===void 0?W=A(d):W=A(Object.assign({},d,{name:p})));let H=a instanceof Function?a:a?t6:r_e,re=H().indexOf(":")+1;if(b&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(y&&typeof y!="function")throw Error(`Unknown mixin type "${typeof y}" - expected "function"`);if(x&&typeof x!="string")throw Error(`Unknown msgPrefix type "${typeof x}" - expected "string"`);Pye(f,h,b);let ne=Q2(h,b);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:ne,messageKey:u,errorKey:l}}),Cye(v);let Z=Oye(v);return Object.assign(t,{levels:ne,[Kye]:Z,[Yye]:b,[Uye]:n,[qye]:H,[Fye]:re,[W2]:jR,[zR]:R,[J2]:C,[Vye]:N,[Hye]:$,[Bye]:u,[Wye]:l,[Jye]:c,[Qye]:c?`,${JSON.stringify(c)}:{`:"",[B2]:o,[Gye]:y,[e_e]:_,[H2]:W,[G2]:E,[Xye]:m,silent:zye,onChild:k,[t_e]:x}),Object.setPrototypeOf(t,Tye()),Iye(t),t[Zye](f),t}Ji.exports=MR;Ji.exports.destination=(e=process.stdout.fd)=>typeof e=="object"?(e.dest=V2(e.dest||process.stdout.fd),Z2(e)):Z2({dest:V2(e),minLength:0});Ji.exports.transport=vR();Ji.exports.multistream=U2();Ji.exports.levels=Q2();Ji.exports.stdSerializers=u_e;Ji.exports.stdTimeFunctions=Object.assign({},Y2);Ji.exports.symbols=X2;Ji.exports.version=Mye;Ji.exports.default=MR;Ji.exports.pino=MR});var s6=T((drt,i6)=>{"use strict";var wv=r6(),{serializersSym:n6}=wv.symbols,{FST_ERR_LOG_INVALID_DESTINATION:l_e}=tn();function c_e(e){if(e.stream&&e.file)throw new l_e;e.file&&(e.stream=wv.destination(e.file),delete e.file);let t=e.logger,r=e.genReqId,n=null;return t?(e.logger=void 0,e.genReqId=void 0,t[n6]&&(e.serializers=Object.assign({},e.serializers,t[n6])),n=t.child({},e),e.logger=t,e.genReqId=r):n=wv(e,e.stream),n}var d_e={req:function(t){return{method:t.method,url:t.url,version:t.headers&&t.headers["accept-version"],host:t.host,remoteAddress:t.ip,remotePort:t.socket?t.socket.remotePort:void 0}},err:wv.stdSerializers.err,res:function(t){return{statusCode:t.statusCode}}};i6.exports={serializers:d_e,createPinoLogger:c_e}});var vh=T((frt,a6)=>{"use strict";var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:f_e,FST_ERR_LOG_INVALID_LOGGER_CONFIG:p_e,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:h_e,FST_ERR_LOG_INVALID_LOGGER:m_e}=tn();function g_e(e,t,r,n,i){let s={[e.requestIdLogLabel]:n},o=e.childLoggerFactory.call(e.server,t,s,i||{},r);return e.childLoggerFactory!==o6&&Sv(o,!0),o}function o6(e,t,r){return e.child(t,r)}function Sv(e,t){let r=["info","error","debug","fatal","warn","trace","child"],n=e?r.filter(i=>!e[i]||typeof e[i]!="function"):r;if(n.length){if(n.length===r.length&&!t)return!1;throw m_e(n.join(","))}else return!0}function y_e(e){if(e.logger&&e.loggerInstance)throw new f_e;if(!e.loggerInstance&&!e.logger){let o=t4();return o.child=()=>o,{logger:o,hasLogger:!1}}let{createPinoLogger:t,serializers:r}=s6();if(Sv(e.loggerInstance))return{logger:t({logger:e.loggerInstance,serializers:Object.assign({},r,e.loggerInstance.serializers)}),hasLogger:!0};if(Sv(e.logger))throw p_e();if(e.loggerInstance)throw h_e();let n={};return Object.prototype.toString.call(e.logger)==="[object Object]"&&Reflect.ownKeys(e.logger).forEach(s=>{Object.defineProperty(n,s,{value:e.logger[s],writable:!0,enumerable:!0,configurable:!0})}),n.level=n.level||"info",n.serializers=Object.assign({},r,n.serializers),e.logger=n,{logger:t(e.logger),hasLogger:!0}}function __e(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}a6.exports={createChildLogger:g_e,defaultChildLoggerFactory:o6,createLogger:y_e,validateLogger:Sv,now:__e}});var kv=T((prt,u6)=>{"use strict";u6.exports=v_e;function Xc(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function v_e(e){if(e=e||{},e.circles)return b_e(e);let t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,a)=>new Map(n(Array.from(o),a))),t.set(Set,(o,a)=>new Set(n(Array.from(o),a))),e.constructorHandlers)for(let o of e.constructorHandlers)t.set(o[0],o[1]);let r=null;return e.proto?s:i;function n(o,a){let u=Object.keys(o),l=new Array(u.length);for(let c=0;c<u.length;c++){let d=u[c],p=o[d];typeof p!="object"||p===null?l[d]=p:p.constructor!==Object&&(r=t.get(p.constructor))?l[d]=r(p,a):ArrayBuffer.isView(p)?l[d]=Xc(p):l[d]=a(p)}return l}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,i);if(o.constructor!==Object&&(r=t.get(o.constructor)))return r(o,i);let a={};for(let u in o){if(Object.hasOwnProperty.call(o,u)===!1)continue;let l=o[u];typeof l!="object"||l===null?a[u]=l:l.constructor!==Object&&(r=t.get(l.constructor))?a[u]=r(l,i):ArrayBuffer.isView(l)?a[u]=Xc(l):a[u]=i(l)}return a}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,s);if(o.constructor!==Object&&(r=t.get(o.constructor)))return r(o,s);let a={};for(let u in o){let l=o[u];typeof l!="object"||l===null?a[u]=l:l.constructor!==Object&&(r=t.get(l.constructor))?a[u]=r(l,s):ArrayBuffer.isView(l)?a[u]=Xc(l):a[u]=s(l)}return a}}function b_e(e){let t=[],r=[],n=new Map;if(n.set(Date,u=>new Date(u)),n.set(Map,(u,l)=>new Map(s(Array.from(u),l))),n.set(Set,(u,l)=>new Set(s(Array.from(u),l))),e.constructorHandlers)for(let u of e.constructorHandlers)n.set(u[0],u[1]);let i=null;return e.proto?a:o;function s(u,l){let c=Object.keys(u),d=new Array(c.length);for(let p=0;p<c.length;p++){let f=c[p],h=u[f];if(typeof h!="object"||h===null)d[f]=h;else if(h.constructor!==Object&&(i=n.get(h.constructor)))d[f]=i(h,l);else if(ArrayBuffer.isView(h))d[f]=Xc(h);else{let v=t.indexOf(h);v!==-1?d[f]=r[v]:d[f]=l(h)}}return d}function o(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return s(u,o);if(u.constructor!==Object&&(i=n.get(u.constructor)))return i(u,o);let l={};t.push(u),r.push(l);for(let c in u){if(Object.hasOwnProperty.call(u,c)===!1)continue;let d=u[c];if(typeof d!="object"||d===null)l[c]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[c]=i(d,o);else if(ArrayBuffer.isView(d))l[c]=Xc(d);else{let p=t.indexOf(d);p!==-1?l[c]=r[p]:l[c]=o(d)}}return t.pop(),r.pop(),l}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return s(u,a);if(u.constructor!==Object&&(i=n.get(u.constructor)))return i(u,a);let l={};t.push(u),r.push(l);for(let c in u){let d=u[c];if(typeof d!="object"||d===null)l[c]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[c]=i(d,a);else if(ArrayBuffer.isView(d))l[c]=Xc(d);else{let p=t.indexOf(d);p!==-1?l[c]=r[p]:l[c]=a(d)}}return t.pop(),r.pop(),l}}});var bh=T((hrt,p6)=>{"use strict";var w_e=kv()({circles:!1,proto:!0}),{kSchemaVisited:l6,kSchemaResponse:S_e}=Hr(),LR=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:k_e,FST_ERR_SCH_ALREADY_PRESENT:x_e,FST_ERR_SCH_DUPLICATE:$_e,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:c6}=tn(),f6=["params","body","querystring","query","headers"];function xv(e){this.store=e||{}}xv.prototype.add=function(e){let t=w_e(e.isFluentSchema||e.isFluentJSONSchema||e[LR]?e.valueOf():e),r=t.$id;if(!r)throw new k_e;if(this.store[r])throw new x_e(r);this.store[r]=t};xv.prototype.getSchemas=function(){return Object.assign({},this.store)};xv.prototype.getSchema=function(e){return this.store[e]};function d6(e){return typeof e=="object"&&Object.getPrototypeOf(e)!==Object.prototype}function E_e(e,t){if(e[l6])return e;if(e.query){if(e.querystring)throw new $_e("querystring");e.querystring=e.query}T_e(e);for(let r of f6){let n=e[r];if(n&&!d6(n)&&r==="body"&&n.content){let i=n.content,s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new c6(a)}continue}}if(e.response){let r=Object.keys(e.response);for(let n of r){if(d6(e.response[n]))continue;let i=e.response[n].content;if(i){let s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new c6(a)}}}}return e[l6]=!0,e}function T_e(e){for(let t of f6)e[t]&&(e[t].isFluentSchema||e[t][LR])&&(e[t]=e[t].valueOf());if(e.response){let t=Object.keys(e.response);for(let r of t)(e.response[r].isFluentSchema||e.response[r][LR])&&(e.response[r]=e.response[r].valueOf())}}function R_e(e,t,r){let n=e[S_e];if(!n)return!1;if(n[t]){if(n[t].constructor===Object&&r){let s=r.split(";",1)[0];return n[t][s]?n[t][s]:n[t]["*/*"]?n[t]["*/*"]:!1}return n[t]}let i=(t+"")[0]+"xx";if(n[i]){if(n[i].constructor===Object&&r){let s=r.split(";",1)[0];return n[i][s]?n[i][s]:n[i]["*/*"]?n[i]["*/*"]:!1}return n[i]}if(n.default){if(n.default.constructor===Object&&r){let s=r.split(";",1)[0];return n.default[s]?n.default[s]:n.default["*/*"]?n.default["*/*"]:!1}return n.default}return!1}p6.exports={buildSchemas(e){return new xv(e)},getSchemaSerializer:R_e,normalizeSchema:E_e}});var $v=T((mrt,m6)=>{"use strict";var P_e=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;m6.exports=class h6{constructor(t){switch(t&&t.rounding){case"floor":this.parseInteger=Math.floor;break;case"ceil":this.parseInteger=Math.ceil;break;case"round":this.parseInteger=Math.round;break;case"trunc":default:this.parseInteger=Math.trunc;break}this._options=t}asInteger(t){if(Number.isInteger(t))return""+t;if(typeof t=="bigint")return t.toString();let r=this.parseInteger(t);if(r===1/0||r===-1/0||r!==r)throw new Error(`The value "${t}" cannot be converted to an integer.`);return""+r}asNumber(t){let r=Number(t);if(r!==r)throw new Error(`The value "${t}" cannot be converted to a number.`);return r===1/0||r===-1/0?"null":""+r}asBoolean(t){return t&&"true"||"false"}asDateTime(t){if(t===null)return'""';if(t instanceof Date)return'"'+t.toISOString()+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a date-time.`)}asDate(t){if(t===null)return'""';if(t instanceof Date)return'"'+new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a date.`)}asTime(t){if(t===null)return'""';if(t instanceof Date)return'"'+new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(11,19)+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a time.`)}asString(t){let r=t.length;if(r===0)return'""';if(r<42){let n="",i=-1,s=255;for(let o=0;o<r;o++)if(s=t.charCodeAt(o),s===34||s===92)i===-1&&(i=0),n+=t.slice(i,o)+"\\",i=o;else if(s<32||s>=55296&&s<=57343)return JSON.stringify(t);return i===-1&&'"'+t+'"'||'"'+n+t.slice(i)+'"'}else return r<5e3&&P_e.test(t)===!1?'"'+t+'"':JSON.stringify(t)}asUnsafeString(t){return'"'+t+'"'}getState(){return this._options}static restoreFromState(t){return new h6(t)}}});var y6=T((grt,g6)=>{"use strict";var I_e=$v(),O_e={mode:"standalone"},C_e=I_e.restoreFromState(O_e),N_e=null;g6.exports=(function(t,r){let{asString:n,asNumber:i,asBoolean:s,asDateTime:o,asDate:a,asTime:u,asUnsafeString:l}=r,c=r.asInteger.bind(r),d="{",p="}",f="[",h="]",v=",",y=":",_='"',b=d+p,g=f+h,m=_+_,S="null";function w(x){let R=x&&typeof x.toJSON=="function"?x.toJSON():x;if(R===null)return b;let E,P=d,C=!1;return E=R.statusCode,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"statusCode":',P+=i(E)),E=R.code,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"code":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),E=R.error,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"error":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),E=R.message,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"message":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),P+p}return w})(N_e,C_e)});var wh=T((yrt,w6)=>{"use strict";var _6=ie("node:http").STATUS_CODES,A_e=LT(),{setErrorStatusCode:D_e}=Y_(),{kReplyHeaders:dl,kReplyNextErrorHandler:Ev,kReplyIsRunningOnErrorHook:j_e,kRouteContext:b6,kDisableRequestLogging:Tv}=Hr(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:z_e,FST_ERR_FAILED_ERROR_SERIALIZATION:M_e}=tn(),{getSchemaSerializer:L_e}=bh(),qR=y6(),q_e={func:U_e,toJSON(){return this.func.name.toString()+"()"}};function F_e(e,t,r){e[j_e]=!1;let n=e[b6];if(e[Ev]===!1){v6(t,e,function(o,a){try{o.raw.writeHead(o.raw.statusCode,o[dl])}catch(u){o.log[Tv]||o.log.warn({req:o.request,res:o,err:u},u?.message),o.raw.writeHead(o.raw.statusCode)}o.raw.end(a)});return}let i=e[Ev]||n.errorHandler;e[Ev]=Object.getPrototypeOf(i),delete e[dl]["content-type"],delete e[dl]["content-length"];let s=i.func;if(!s){e[Ev]=!1,v6(t,e,r);return}try{let o=s(t,e.request,e);o!==void 0&&(o!==null&&typeof o.then=="function"?A_e(o,e):e.send(o))}catch(o){e.send(o)}}function U_e(e,t,r){V_e(e,r),D_e(r,e),r.statusCode<500?r.log[Tv]||r.log.info({res:r,err:e},e?.message):r.log[Tv]||r.log.error({req:t,res:r,err:e},e?.message),r.send(e)}function v6(e,t,r){let n=t.raw,i=t.statusCode;t[dl]["content-type"]=t[dl]["content-type"]??"application/json; charset=utf-8";let s;try{let o=L_e(t[b6],i,t[dl]["content-type"]);o===!1?s=qR({error:_6[i+""],code:e.code,message:e.message,statusCode:i}):s=o(Object.create(e,{error:{value:_6[i+""]},message:{value:e.message},statusCode:{value:i}}))}catch(o){t.log[Tv]||t.log.error({err:o,statusCode:n.statusCode},"The serializer for the given status code failed"),t.code(500),s=qR(new M_e(o.message,e.message))}typeof s!="string"&&!Buffer.isBuffer(s)&&(s=qR(new z_e(typeof s))),t[dl]["content-length"]=""+Buffer.byteLength(s),r(t,s)}function Z_e(e=q_e,t){if(!t)return e;let r=Object.create(e);return r.func=t,r}function V_e(e,t){let r=t.raw,n=r.statusCode;n=n>=400?n:500,e!=null&&(e.headers!==void 0&&t.headers(e.headers),e.status>=400?n=e.status:e.statusCode>=400&&(n=e.statusCode)),r.statusCode=n}w6.exports={buildErrorHandler:Z_e,handleError:F_e}});var xh=T((_rt,$6)=>{"use strict";var{kReply:FR,kRequest:UR,kState:H_e,kHasBeenDecorated:B_e}=Hr(),{FST_ERR_DEC_ALREADY_PRESENT:S6,FST_ERR_DEC_MISSING_DEPENDENCY:W_e,FST_ERR_DEC_AFTER_START:J_e,FST_ERR_DEC_REFERENCE_TYPE:G_e,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:K_e,FST_ERR_DEC_UNDECLARED:Y_e}=tn();function X_e(e,t,r,n){if(Object.hasOwn(e,t))throw new S6(t);ZR(e,t,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(e,t,{get:r.getter,set:r.setter}):e[t]=r}function Q_e(e){if(!Sh(this,e))throw new Y_e(e,"instance");return typeof this[e]=="function"?this[e].bind(this):this[e]}function k6(e,t,r,n){let i=e.prototype;if(Object.hasOwn(i,t)||kh(e,t))throw new S6(t);e[B_e]=!0,ZR(e,t,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(i,t,{get:r.getter,set:r.setter}):typeof r=="function"?i[t]=r:e.props.push({key:t,value:r})}function x6(e,t){if(typeof t=="object"&&t&&!(typeof t.getter=="function"||typeof t.setter=="function"))throw new G_e(e,typeof t)}function eve(e,t,r){return VR(this,e),X_e(this,e,t,r),this}function Sh(e,t){return t?t in e||e.prototype&&t in e.prototype||kh(e,t):e in this}function kh(e,t){return e.props?e.props.find(({key:r})=>r===t):!1}function tve(e){return e&&kh(this[UR],e)?!0:Sh(this[UR].prototype,e)}function rve(e){return e&&kh(this[FR],e)?!0:Sh(this[FR].prototype,e)}function ZR(e,t,r){if(r!=null){if(!Array.isArray(r))throw new K_e(t);for(let n=0;n!==r.length;++n)if(!Sh(e,r[n]))throw new W_e(r[n])}}function nve(e,t,r){return VR(this,e),x6(e,t),k6(this[FR],e,t,r),this}function ive(e,t,r){return VR(this,e),x6(e,t),k6(this[UR],e,t,r),this}function VR(e,t){if(e[H_e].started)throw new J_e(t)}$6.exports={add:eve,exist:Sh,existRequest:tve,existReply:rve,dependencies:ZR,decorateReply:nve,decorateRequest:ive,getInstanceDecorator:Q_e,hasKey:kh}});var Dv=T((vrt,Av)=>{"use strict";var Rv=ie("node:stream").finished,{kFourOhFourContext:E6,kReplyErrorHandlerCalled:N6,kReplyHijacked:GR,kReplyStartTime:Eh,kReplyEndTime:KR,kReplySerializer:jo,kReplySerializerDefault:Pv,kReplyIsError:Iv,kReplyHeaders:Zt,kReplyTrailers:rn,kReplyHasStatusCode:YR,kReplyIsRunningOnErrorHook:XR,kReplyNextErrorHandler:sve,kDisableRequestLogging:A6,kSchemaResponse:Ov,kReplyCacheSerializeFns:Ma,kSchemaController:HR,kOptions:ove,kRouteContext:mt}=Hr(),{onSendHookRunner:D6,onResponseHookRunner:ave,preHandlerHookRunner:uve,preSerializationHookRunner:lve}=Da(),T6=BT()[Symbol.for("internals")],cve=vh(),JR=cve.now,{handleError:R6}=wh(),{getSchemaSerializer:dve}=bh(),BR={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:fve,FST_ERR_REP_RESPONSE_BODY_CONSUMED:pve,FST_ERR_REP_READABLE_STREAM_LOCKED:hve,FST_ERR_REP_ALREADY_SENT:mve,FST_ERR_SEND_INSIDE_ONERR:gve,FST_ERR_BAD_STATUS_CODE:yve,FST_ERR_BAD_TRAILER_NAME:_ve,FST_ERR_BAD_TRAILER_VALUE:vve,FST_ERR_MISSING_SERIALIZATION_FN:bve,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:wve,FST_ERR_DEC_UNDECLARED:Sve}=tn(),P6=xh(),j6=Object.prototype.toString;function Vt(e,t,r){this.raw=e,this[jo]=null,this[N6]=!1,this[Iv]=!1,this[XR]=!1,this.request=t,this[Zt]={},this[rn]=null,this[YR]=!1,this[Eh]=void 0,this.log=r}Vt.props=[];Object.defineProperties(Vt.prototype,{[mt]:{get(){return this.request[mt]}},elapsedTime:{get(){return this[Eh]===void 0?0:(this[KR]||JR())-this[Eh]}},server:{get(){return this.request[mt].server}},sent:{enumerable:!0,get(){return(this[GR]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set(e){this.code(e)}},routeOptions:{get(){return this.request.routeOptions}}});Vt.prototype.writeEarlyHints=function(e,t){return this.raw.writeEarlyHints(e,t),this};Vt.prototype.hijack=function(){return this[GR]=!0,this};Vt.prototype.send=function(e){if(this[XR])throw new gve;if(this.sent===!0)return this.log.warn({err:new mve(this.request.url,this.request.method)}),this;if(this[Iv]||e instanceof Error)return this[Iv]=!1,Qc(this,e,fl),this;if(e===void 0)return fl(this,e),this;let t=this.getHeader("content-type"),r=t!==void 0;if(e!==null){if(typeof e.pipe=="function"||typeof e.getReader=="function"||j6.call(e)==="[object Response]")return fl(this,e),this;if(e.buffer instanceof ArrayBuffer){r||(this[Zt]["content-type"]=BR.OCTET);let n=Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength);return fl(this,n),this}if(!r&&typeof e=="string")return this[Zt]["content-type"]=BR.PLAIN,fl(this,e),this}if(this[jo]!==null){if(typeof e!="string")return I6(this,e),this;e=this[jo](e)}else if(!r||t.indexOf("json")!==-1){if(!r)this[Zt]["content-type"]=BR.JSON;else if(t.indexOf("charset")===-1){let n=t.trim();n.endsWith(";")?this[Zt]["content-type"]=`${n} charset=utf-8`:this[Zt]["content-type"]=`${n}; charset=utf-8`}if(typeof e!="string")return I6(this,e),this}return fl(this,e),this};Vt.prototype.getHeader=function(e){e=e.toLowerCase();let t=this[Zt][e];return t!==void 0?t:this.raw.getHeader(e)};Vt.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[Zt]}};Vt.prototype.hasHeader=function(e){return e=e.toLowerCase(),this[Zt][e]!==void 0||this.raw.hasHeader(e)};Vt.prototype.removeHeader=function(e){return delete this[Zt][e.toLowerCase()],this};Vt.prototype.header=function(e,t=""){return e=e.toLowerCase(),this[Zt][e]&&e==="set-cookie"?(typeof this[Zt][e]=="string"&&(this[Zt][e]=[this[Zt][e]]),Array.isArray(t)?Array.prototype.push.apply(this[Zt][e],t):this[Zt][e].push(t)):this[Zt][e]=t,this};Vt.prototype.headers=function(e){let t=Object.keys(e);for(let r=0;r!==t.length;++r){let n=t[r];this.header(n,e[n])}return this};var kve=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);Vt.prototype.trailer=function(e,t){if(e=e.toLowerCase(),kve.has(e))throw new _ve(e);if(typeof t!="function")throw new vve(e,typeof t);return this[rn]===null&&(this[rn]={}),this[rn][e]=t,this};Vt.prototype.hasTrailer=function(e){return this[rn]?.[e.toLowerCase()]!==void 0};Vt.prototype.removeTrailer=function(e){return this[rn]===null?this:(this[rn][e.toLowerCase()]=void 0,this)};Vt.prototype.code=function(e){let t=+e;if(!(t>=100&&t<=599))throw new yve(e||String(e));return this.raw.statusCode=t,this[YR]=!0,this};Vt.prototype.status=Vt.prototype.code;Vt.prototype.getSerializationFunction=function(e,t){let r;return typeof e=="string"||typeof e=="number"?typeof t=="string"?r=this[mt][Ov]?.[e]?.[t]:r=this[mt][Ov]?.[e]:typeof e=="object"&&(r=this[mt][Ma]?.get(e)),r};Vt.prototype.compileSerializationSchema=function(e,t=null,r=null){let{request:n}=this,{method:i,url:s}=n;if(this[mt][Ma]?.has(e))return this[mt][Ma].get(e);let a=(this[mt].serializerCompiler||this.server[HR].serializerCompiler||this.server[HR].setupSerializer(this.server[ove])||this.server[HR].serializerCompiler)({schema:e,method:i,url:s,httpStatus:t,contentType:r});return this[mt][Ma]==null&&(this[mt][Ma]=new WeakMap),this[mt][Ma].set(e,a),a};Vt.prototype.serializeInput=function(e,t,r,n){let i=r,s;if(r=typeof t=="string"||typeof t=="number"?t:r,n=r&&i!==r?i:n,r!=null){if(n!=null?s=this[mt][Ov]?.[r]?.[n]:s=this[mt][Ov]?.[r],s==null)throw n?new wve(r,n):new bve(r)}else this[mt][Ma]?.has(t)?s=this[mt][Ma].get(t):s=this.compileSerializationSchema(t,r,n);return s(e)};Vt.prototype.serialize=function(e){return this[jo]!==null?this[jo](e):this[mt]&&this[mt][Pv]?this[mt][Pv](e,this.raw.statusCode):M6(this[mt],e,this.raw.statusCode)};Vt.prototype.serializer=function(e){return this[jo]=e,this};Vt.prototype.type=function(e){return this[Zt]["content-type"]=e,this};Vt.prototype.redirect=function(e,t){return t||(t=this[YR]?this.raw.statusCode:302),this.header("location",e).code(t).send()};Vt.prototype.callNotFound=function(){return Ove(this),this};Vt.prototype.then=function(e,t){if(this.sent){e();return}Rv(this.raw,r=>{r&&r.code!=="ERR_STREAM_PREMATURE_CLOSE"?t?t(r):this.log&&this.log.warn("unhandled rejection on reply.then"):e()})};Vt.prototype.getDecorator=function(e){if(!P6.hasKey(this,e)&&!P6.exist(this,e))throw new Sve(e,"reply");let t=this[e];return typeof t=="function"?t.bind(this):t};function I6(e,t){e[mt].preSerialization!==null?lve(e[mt].preSerialization,e.request,e,t,O6):O6(null,void 0,e,t)}function O6(e,t,r,n){if(e!=null){Qc(r,e);return}try{r[jo]!==null?n=r[jo](n):r[mt]&&r[mt][Pv]?n=r[mt][Pv](n,r.raw.statusCode):n=M6(r[mt],n,r.raw.statusCode,r[Zt]["content-type"])}catch(i){xve(i,r),Qc(r,i);return}fl(r,n)}function xve(e,t){e.serialization=t[mt].config}function fl(e,t){e[mt].onSend!==null?D6(e[mt].onSend,e.request,e,t,$ve):z6(e,t)}function $ve(e,t,r,n){e!=null?Qc(r,e):z6(r,n)}function WR(e,t){let r=e.raw;try{r.writeHead(t,e[Zt])}catch(n){throw n.code==="ERR_HTTP_HEADERS_SENT"&&e.log.warn(`Reply was already sent, did you forget to "return reply" in the "${e.request.raw.url}" (${e.request.raw.method}) route?`),n}}function z6(e,t){let r=e.raw,n=e.request;if(e[rn]!==null){let s=Object.keys(e[rn]),o="";for(let a of s)typeof e[rn][a]=="function"&&(o+=" ",o+=a);e.header("Transfer-Encoding","chunked"),e.header("Trailer",o.trim())}if(j6.call(t)==="[object Response]"){if(typeof t.status=="number"&&e.code(t.status),typeof t.headers=="object"&&typeof t.headers.forEach=="function")for(let[s,o]of t.headers)e.header(s,o);if(t.body!==null&&t.bodyUsed)throw new pve;t=t.body}let i=r.statusCode;if(t==null){i>=200&&i!==204&&i!==304&&n.method!=="HEAD"&&e[rn]===null&&(e[Zt]["content-length"]="0"),WR(e,i),$h(t,r,e);return}if(i>=100&&i<200||i===204){e.removeHeader("content-type"),e.removeHeader("content-length"),WR(e,i),$h(void 0,r,e),typeof t.resume=="function"&&(t.on("error",Nv),t.resume());return}if(typeof t.pipe=="function"){Tve(t,r,e);return}if(typeof t.getReader=="function"){Eve(t,r,e);return}if(typeof t!="string"&&!Buffer.isBuffer(t))throw new fve(typeof t);if(e[rn]===null){let s=e[Zt]["content-length"];(!s||n.raw.method!=="HEAD"&&Number(s)!==Buffer.byteLength(t))&&(e[Zt]["content-length"]=""+Buffer.byteLength(t))}WR(e,i),r.write(t),$h(t,r,e)}function Cv(e,t,r){t.code==="ERR_STREAM_PREMATURE_CLOSE"?e[A6]||e.info({res:r},"stream closed prematurely"):e.warn({err:t},"response terminated with an error with headers already sent")}function Eve(e,t,r){if(e.locked)throw new hve;let n=!0,i=!1,s=!1,o=e.getReader();if(Rv(t,function(c){n&&(c!=null&&t.headersSent&&!i&&(i=!0,Cv(r.log,c,t)),o.cancel().catch(Nv))}),t.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let c in r[Zt])t.setHeader(c,r[Zt][c]);function a(c){if(c.done){n=!1,$h(null,t,r);return}if(t.destroyed){n=!1,o.cancel().catch(Nv);return}if(t.write(c.value)===!1){s=!0,t.once("drain",u);return}o.read().then(a,l)}function u(){!s||!n||t.destroyed||(s=!1,o.read().then(a,l))}function l(c){n=!1,t.headersSent||r.request.raw.aborted===!0?(i||(i=!0,Cv(r.log,c,r)),t.destroy()):Qc(r,c)}o.read().then(a,l)}function Tve(e,t,r){let n=!0,i=!1;if(Rve(e,t,r),Rv(e,{readable:!0,writable:!1},function(s){n=!1,s!=null&&(t.headersSent||r.request.raw.aborted===!0?(i||(i=!0,Cv(r.log,s,r)),t.destroy()):Qc(r,s))}),Rv(t,function(s){n&&(s!=null&&t.headersSent&&!i&&(i=!0,Cv(r.log,s,t)),typeof e.destroy=="function"?e.destroy():typeof e.close=="function"?e.close(Nv):typeof e.abort=="function"?e.abort():r.log.warn("stream payload does not end properly"))}),t.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let s in r[Zt])t.setHeader(s,r[Zt][s]);e.pipe(t)}function $h(e,t,r){if(r[rn]===null){t.end(null,null,null);return}let n=Object.keys(r[rn]),i={},s=0,o=!0;function a(){s===0&&(t.addTrailers(i),t.end(null,null,null))}for(let u of n){let l=function(d,p){s++,d?r.log.debug(d):i[u]=p,process.nextTick(a)};if(typeof r[rn][u]!="function")continue;o=!1,s--;let c=r[rn][u](r,e,l);typeof c=="object"&&typeof c.then=="function"&&c.then(d=>l(null,d),l)}o&&t.end(null,null,null)}function Rve(e,t,r){r[rn]!==null&&e.on("end",()=>$h(null,t,r))}function Qc(e,t,r){e[mt].onError!==null&&!e[sve]?(e[XR]=!0,D6(e[mt].onError,e.request,e,t,()=>R6(e,t,r))):R6(e,t,r)}function Pve(e){e[Eh]=JR();let t=r=>{e[KR]=JR(),e.raw.removeListener("finish",t),e.raw.removeListener("error",t);let n=e[mt];n&&n.onResponse!==null?ave(n.onResponse,e.request,e,C6):C6(r,e.request,e)};e.raw.on("finish",t),e.raw.on("error",t)}function C6(e,t,r){if(r.log[A6])return;let n=r.elapsedTime;if(e!=null){r.log.error({res:r,err:e,responseTime:n},"request errored");return}r.log.info({res:r,responseTime:n},"request completed")}function Ive(e){let t=e.props.slice();function r(n,i,s){this.raw=n,this[Iv]=!1,this[N6]=!1,this[GR]=!1,this[jo]=null,this.request=i,this[Zt]={},this[rn]=null,this[Eh]=void 0,this[KR]=void 0,this.log=s;let o;for(let a=0;a<t.length;a++)o=t[a],this[o.key]=o.value}return Object.setPrototypeOf(r.prototype,e.prototype),Object.setPrototypeOf(r,e),r.parent=e,r.props=t,r}function Ove(e){if(e[mt][E6]===null){e.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),e.code(404).send("404 Not Found");return}e.request[mt]=e[mt][E6],e[mt].preHandler!==null?uve(e[mt].preHandler,e.request,e,T6.preHandlerCallback):T6.preHandlerCallback(null,e.request,e)}function M6(e,t,r,n){let i=dve(e,r,n);return i?i(t):JSON.stringify(t)}function Nv(){}Av.exports=Vt;Av.exports.buildReply=Ive;Av.exports.setupResponseListeners=Pve});var L6=T((brt,jv)=>{"use strict";function QR(e){if(!e)throw new TypeError("argument req is required");let t=e.headers["x-forwarded-for"],r=e.socket.remoteAddress;if(!t||typeof t!="string")return[r];if(t.indexOf(",")===-1){let n=t.trim();return n.length?[r,n]:[r]}else return Cve(t,r)}function Cve(e,t){let r=[t],n=e.length,i=n,s,o;for(o=n-1;o>=0;--o)s=e[o],s===" "?i===n&&(i=n=o):s===","?(i!==n&&r.push(e.slice(i,n)),i=n=o):i=o;return i!==n&&r.push(e.substring(i,n)),r}jv.exports=QR;jv.exports.default=QR;jv.exports.forwarded=QR});var F6=T((q6,zv)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function u(f,h){if(f.indexOf("::")!==f.lastIndexOf("::"))return null;let v=0,y=-1,_=(f.match(a.zoneIndex)||[])[0],b,g;for(_&&(_=_.substring(1),f=f.replace(/%.+$/,""));(y=f.indexOf(":",y+1))>=0;)v++;if(f.substr(0,2)==="::"&&v--,f.substr(-2,2)==="::"&&v--,v>h)return null;for(g=h-v,b=":";g--;)b+="0:";return f=f.replace("::",b),f[0]===":"&&(f=f.slice(1)),f[f.length-1]===":"&&(f=f.slice(0,-1)),h=(function(){let m=f.split(":"),S=[];for(let w=0;w<m.length;w++)S.push(parseInt(m[w],16));return S})(),{parts:h,zoneId:_}}function l(f,h,v,y){if(f.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let _=0,b;for(;y>0;){if(b=v-y,b<0&&(b=0),f[_]>>b!==h[_]>>b)return!1;y-=v,_+=1}return!0}function c(f){if(i.test(f))return parseInt(f,16);if(f[0]==="0"&&!isNaN(parseInt(f[1],10))){if(n.test(f))return parseInt(f,8);throw new Error(`ipaddr: cannot parse ${f} as octal`)}return parseInt(f,10)}function d(f,h){for(;f.length<h;)f=`0${f}`;return f}let p={};p.IPv4=(function(){function f(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let v,y;for(v=0;v<h.length;v++)if(y=h[v],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return f.prototype.SpecialRanges={unspecified:[[new f([0,0,0,0]),8]],broadcast:[[new f([255,255,255,255]),32]],multicast:[[new f([224,0,0,0]),4]],linkLocal:[[new f([169,254,0,0]),16]],loopback:[[new f([127,0,0,0]),8]],carrierGradeNat:[[new f([100,64,0,0]),10]],private:[[new f([10,0,0,0]),8],[new f([172,16,0,0]),12],[new f([192,168,0,0]),16]],reserved:[[new f([192,0,0,0]),24],[new f([192,0,2,0]),24],[new f([192,88,99,0]),24],[new f([198,18,0,0]),15],[new f([198,51,100,0]),24],[new f([203,0,113,0]),24],[new f([240,0,0,0]),4]],as112:[[new f([192,175,48,0]),24],[new f([192,31,196,0]),24]],amt:[[new f([192,52,193,0]),24]]},f.prototype.kind=function(){return"ipv4"},f.prototype.match=function(h,v){let y;if(v===void 0&&(y=h,h=y[0],v=y[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,h.octets,8,v)},f.prototype.prefixLengthFromSubnetMask=function(){let h=0,v=!1,y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},_,b,g;for(_=3;_>=0;_-=1)if(b=this.octets[_],b in y){if(g=y[b],v&&g!==0)return null;g!==8&&(v=!0),h+=g}else return null;return 32-h},f.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){return this.octets.slice(0)},f.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},f.prototype.toNormalizedString=function(){return this.toString()},f.prototype.toString=function(){return this.octets.join(".")},f})(),p.IPv4.broadcastAddressFromCIDR=function(f){try{let h=this.parseCIDR(f),v=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],b=0;for(;b<4;)_.push(parseInt(v[b],10)|parseInt(y[b],10)^255),b++;return new this(_)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(f){return this.parser(f)!==null},p.IPv4.isValid=function(f){try{return new this(this.parser(f)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(f){try{return this.parseCIDR(f),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(f){return!!(p.IPv4.isValid(f)&&f.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(f){let h=f.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(f)||!h?!1:p.IPv4.isValidFourPartDecimal(h[1])},p.IPv4.networkAddressFromCIDR=function(f){let h,v,y,_,b;try{for(h=this.parseCIDR(f),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],v=0;v<4;)_.push(parseInt(y[v],10)&parseInt(b[v],10)),v++;return new this(_)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(f){let h=this.parser(f);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},p.IPv4.parseCIDR=function(f){let h;if(h=f.match(/^(.+)\/(\d+)$/)){let v=parseInt(h[2]);if(v>=0&&v<=32){let y=[this.parse(h[1]),v];return Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(f){let h,v,y;if(h=f.match(r.fourOctet))return(function(){let _=h.slice(1,6),b=[];for(let g=0;g<_.length;g++)v=_[g],b.push(c(v));return b})();if(h=f.match(r.longValue)){if(y=c(h[1]),y>4294967295||y<0)throw new Error("ipaddr: address outside defined range");return(function(){let _=[],b;for(b=0;b<=24;b+=8)_.push(y>>b&255);return _})().reverse()}else return(h=f.match(r.twoOctet))?(function(){let _=h.slice(1,4),b=[];if(y=c(_[1]),y>16777215||y<0)throw new Error("ipaddr: address outside defined range");return b.push(c(_[0])),b.push(y>>16&255),b.push(y>>8&255),b.push(y&255),b})():(h=f.match(r.threeOctet))?(function(){let _=h.slice(1,5),b=[];if(y=c(_[2]),y>65535||y<0)throw new Error("ipaddr: address outside defined range");return b.push(c(_[0])),b.push(c(_[1])),b.push(y>>8&255),b.push(y&255),b})():null},p.IPv4.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],v=0,y=Math.floor(f/8);for(;v<y;)h[v]=255,v++;return y<4&&(h[y]=Math.pow(2,f%8)-1<<8-f%8),new this(h)},p.IPv6=(function(){function f(h,v){let y,_;if(h.length===16)for(this.parts=[],y=0;y<=14;y+=2)this.parts.push(h[y]<<8|h[y+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=0;y<this.parts.length;y++)if(_=this.parts[y],!(0<=_&&_<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");v&&(this.zoneId=v)}return f.prototype.SpecialRanges={unspecified:[new f([0,0,0,0,0,0,0,0]),128],linkLocal:[new f([65152,0,0,0,0,0,0,0]),10],multicast:[new f([65280,0,0,0,0,0,0,0]),8],loopback:[new f([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new f([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new f([0,0,0,0,0,65535,0,0]),96],discard:[new f([256,0,0,0,0,0,0,0]),64],rfc6145:[new f([0,0,0,0,65535,0,0,0]),96],rfc6052:[new f([100,65435,0,0,0,0,0,0]),96],"6to4":[new f([8194,0,0,0,0,0,0,0]),16],teredo:[new f([8193,0,0,0,0,0,0,0]),32],benchmarking:[new f([8193,2,0,0,0,0,0,0]),48],amt:[new f([8193,3,0,0,0,0,0,0]),32],as112v6:[[new f([8193,4,274,0,0,0,0,0]),48],[new f([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new f([8193,16,0,0,0,0,0,0]),28],orchid2:[new f([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new f([8193,48,0,0,0,0,0,0]),28],reserved:[[new f([8193,0,0,0,0,0,0,0]),23],[new f([8193,3512,0,0,0,0,0,0]),32]]},f.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},f.prototype.kind=function(){return"ipv6"},f.prototype.match=function(h,v){let y;if(v===void 0&&(y=h,h=y[0],v=y[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,h.parts,16,v)},f.prototype.prefixLengthFromSubnetMask=function(){let h=0,v=!1,y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},_,b;for(let g=7;g>=0;g-=1)if(_=this.parts[g],_ in y){if(b=y[_],v&&b!==0)return null;b!==16&&(v=!0),h+=b}else return null;return 128-h},f.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){let h,v=[],y=this.parts;for(let _=0;_<y.length;_++)h=y[_],v.push(h>>8),v.push(h&255);return v},f.prototype.toFixedLengthString=function(){let h=(function(){let y=[];for(let _=0;_<this.parts.length;_++)y.push(d(this.parts[_].toString(16),4));return y}).call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),h+v},f.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),v=h[0],y=h[1];return new p.IPv4([v>>8,v&255,y>>8,y&255])},f.prototype.toNormalizedString=function(){let h=(function(){let y=[];for(let _=0;_<this.parts.length;_++)y.push(this.parts[_].toString(16));return y}).call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),h+v},f.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),y=0,_=-1,b;for(;b=h.exec(v);)b[0].length>_&&(y=b.index,_=b[0].length);return _<0?v:`${v.substring(0,y)}::${v.substring(y+_)}`},f.prototype.toString=function(){return this.toRFC5952String()},f})(),p.IPv6.broadcastAddressFromCIDR=function(f){try{let h=this.parseCIDR(f),v=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],b=0;for(;b<16;)_.push(parseInt(v[b],10)|parseInt(y[b],10)^255),b++;return new this(_)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},p.IPv6.isIPv6=function(f){return this.parser(f)!==null},p.IPv6.isValid=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{let h=this.parser(f);return new this(h.parts,h.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{return this.parseCIDR(f),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(f){let h,v,y,_,b;try{for(h=this.parseCIDR(f),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],v=0;v<16;)_.push(parseInt(y[v],10)&parseInt(b[v],10)),v++;return new this(_)}catch(g){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${g})`)}},p.IPv6.parse=function(f){let h=this.parser(f);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},p.IPv6.parseCIDR=function(f){let h,v,y;if((v=f.match(/^(.+)\/(\d+)$/))&&(h=parseInt(v[2]),h>=0&&h<=128))return y=[this.parse(v[1]),h],Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(f){let h,v,y,_,b,g;if(y=f.match(a.deprecatedTransitional))return this.parser(`::ffff:${y[1]}`);if(a.native.test(f))return u(f,8);if((y=f.match(a.transitional))&&(g=y[6]||"",h=y[1],y[1].endsWith("::")||(h=h.slice(0,-1)),h=u(h+g,6),h.parts)){for(b=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],v=0;v<b.length;v++)if(_=b[v],!(0<=_&&_<=255))return null;return h.parts.push(b[0]<<8|b[1]),h.parts.push(b[2]<<8|b[3]),{parts:h.parts,zoneId:h.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v=0,y=Math.floor(f/8);for(;v<y;)h[v]=255,v++;return y<16&&(h[y]=Math.pow(2,f%8)-1<<8-f%8),new this(h)},p.fromByteArray=function(f){let h=f.length;if(h===4)return new p.IPv4(f);if(h===16)return new p.IPv6(f);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(f){return p.IPv6.isValid(f)||p.IPv4.isValid(f)},p.isValidCIDR=function(f){return p.IPv6.isValidCIDR(f)||p.IPv4.isValidCIDR(f)},p.parse=function(f){if(p.IPv6.isValid(f))return p.IPv6.parse(f);if(p.IPv4.isValid(f))return p.IPv4.parse(f);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(f){try{return p.IPv6.parseCIDR(f)}catch{try{return p.IPv4.parseCIDR(f)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(f){let h=this.parse(f);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},p.subnetMatch=function(f,h,v){let y,_,b,g;v==null&&(v="unicast");for(_ in h)if(Object.prototype.hasOwnProperty.call(h,_)){for(b=h[_],b[0]&&!(b[0]instanceof Array)&&(b=[b]),y=0;y<b.length;y++)if(g=b[y],f.kind()===g[0].kind()&&f.match.apply(f,g))return _}return v},typeof zv<"u"&&zv.exports?zv.exports=p:e.ipaddr=p})(q6)});var B6=T((wrt,ed)=>{"use strict";ed.exports=eP;ed.exports.default=eP;ed.exports.proxyaddr=eP;ed.exports.all=V6;ed.exports.compile=H6;var Nve=L6(),Z6=F6(),Ave=/^\d+$/u,Mv=Z6.isValid,Lv=Z6.parse,U6={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function V6(e,t){let r=Nve(e);if(!t)return r;typeof t!="function"&&(t=H6(t));for(let n=0;n<r.length-1;n++)t(r[n],n)||(r.length=n+1);return r}function H6(e){if(!e)throw new TypeError("argument is required");let t;if(typeof e=="string")t=[e];else if(Array.isArray(e))t=e.slice();else throw new TypeError("unsupported trust argument");for(let r=0;r<t.length;r++)e=t[r],Object.hasOwn(U6,e)&&(e=U6[e],t.splice.apply(t,[r,1].concat(e)),r+=e.length-1);return jve(Dve(t))}function Dve(e){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=zve(e[r]);return t}function jve(e){let t=e.length;return t===0?Lve:t===1?Fve(e[0]):qve(e)}function zve(e){let t=e.lastIndexOf("/"),r=t!==-1?e.substring(0,t):e;if(!Mv(r))throw new TypeError("invalid IP address: "+r);let n=Lv(r);t===-1&&n.kind()==="ipv6"&&n.isIPv4MappedAddress()&&(n=n.toIPv4Address());let i=n.kind()==="ipv6"?128:32,s=t!==-1?e.substring(t+1,e.length):null;if(s===null?s=i:Ave.test(s)?s=parseInt(s,10):n.kind()==="ipv4"&&Mv(s)?s=Mve(s):s=null,s<=0||s>i)throw new TypeError("invalid range on address: "+e);return[n,s]}function Mve(e){let t=Lv(e);return t.kind()==="ipv4"?t.prefixLengthFromSubnetMask():null}function eP(e,t){if(!e)throw new TypeError("req argument is required");if(!t)throw new TypeError("trust argument is required");let r=V6(e,t);return r[r.length-1]}function Lve(){return!1}function qve(e){return function(r){if(!Mv(r))return!1;let n=Lv(r),i,s=n.kind();for(let o=0;o<e.length;o++){let a=e[o],u=a[0],l=u.kind(),c=a[1],d=n;if(s!==l){let p=l==="ipv4";if(p&&!n.isIPv4MappedAddress())continue;i||(i=p?n.toIPv4Address():n.toIPv4MappedAddress()),d=i}if(d.match(u,c))return!0}return!1}}function Fve(e){let t=e[0],r=t.kind(),n=r==="ipv4",i=e[1];return function(o){if(!Mv(o))return!1;let a=Lv(o);if(a.kind()!==r){if(n&&!a.isIPv4MappedAddress())return!1;a=n?a.toIPv4Address():a.toIPv4MappedAddress()}return a.match(t,i)}}});var Fv=T((Srt,iP)=>{"use strict";var qv=B6(),{kHasBeenDecorated:Uve,kSchemaBody:Zve,kSchemaHeaders:Vve,kSchemaParams:Hve,kSchemaQuerystring:W6,kSchemaController:tP,kOptions:Bve,kRequestCacheValidateFns:La,kRouteContext:On,kRequestOriginalUrl:rP}=Hr(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:Wve,FST_ERR_DEC_UNDECLARED:Jve}=tn(),J6=xh(),G6={body:Zve,headers:Vve,params:Hve,querystring:W6,query:W6};function nP(e,t,r,n,i,s){this.id=e,this[On]=s,this.params=t,this.raw=r,this.query=n,this.log=i,this.body=void 0}nP.props=[];function Gve(e){if(typeof e=="function")return e;if(e===!0)return null;if(typeof e=="number")return function(t,r){return r<e};if(typeof e=="string"){let t=e.split(",").map(r=>r.trim());return qv.compile(t)}return qv.compile(e)}function Kve(e,t){return t?Yve(e,t):X6(e)}function X6(e){let t=e.props.slice();function r(n,i,s,o,a,u){this.id=n,this[On]=u,this.params=i,this.raw=s,this.query=o,this.log=a,this.body=void 0;let l;for(let c=0;c<t.length;c++)l=t[c],this[l.key]=l.value}return Object.setPrototypeOf(r.prototype,e.prototype),Object.setPrototypeOf(r,e),r.props=t,r.parent=e,r}function K6(e){let t=e.lastIndexOf(",");return t===-1?e.trim():e.slice(t+1).trim()}function Yve(e,t){let r=X6(e),n=Gve(t);return r[Uve]=!0,Object.defineProperties(r.prototype,{ip:{get(){let i=qv.all(this.raw,n);return i[i.length-1]}},ips:{get(){return qv.all(this.raw,n)}},host:{get(){return this.ip!==void 0&&this.headers["x-forwarded-host"]?K6(this.headers["x-forwarded-host"]):this.headers.host??this.headers[":authority"]??""}},protocol:{get(){if(this.headers["x-forwarded-proto"])return K6(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),r}function Y6(e,t){if(!J6.hasKey(e,t)&&!J6.exist(e,t))throw new Jve(t,"request")}Object.defineProperties(nP.prototype,{server:{get(){return this[On].server}},url:{get(){return this.raw.url}},originalUrl:{get(){return this[rP]||(this[rP]=this.raw.originalUrl||this.raw.url),this[rP]}},method:{get(){return this.raw.method}},routeOptions:{get(){let e=this[On],t=e._parserOptions.limit,r=e.server.initialConfig.bodyLimit,n=e.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:e.config?.method,url:e.config?.url,bodyLimit:t||r,attachValidation:e.attachValidation,logLevel:e.logLevel,exposeHeadRoute:e.exposeHeadRoute,prefixTrailingSlash:e.prefixTrailingSlash,handler:e.handler,config:e.config,schema:e.schema,version:n}}},is404:{get(){return this[On].config?.url===void 0}},socket:{get(){return this.raw.socket}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){return this.host[0]==="["?this.host.slice(0,this.host.indexOf("]")+1):this.host.split(":",1)[0]}},port:{get(){let e=parseInt(this.host.split(":").slice(-1)[0]);if(!isNaN(e))return e;let t=this.headers.host??this.headers[":authority"]??"",r=parseInt(t.split(":").slice(-1)[0]);return isNaN(r)?null:r}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){return this.additionalHeaders?Object.assign({},this.raw.headers,this.additionalHeaders):this.raw.headers},set(e){this.additionalHeaders=e}},getValidationFunction:{value:function(e){if(typeof e=="string"){let t=G6[e];return this[On][t]}else if(typeof e=="object")return this[On][La]?.get(e)}},compileValidationSchema:{value:function(e,t=null){let{method:r,url:n}=this;if(this[On][La]?.has(e))return this[On][La].get(e);let s=(this[On].validatorCompiler||this.server[tP].validatorCompiler||this.server[tP].setupValidator(this.server[Bve])||this.server[tP].validatorCompiler)({schema:e,method:r,url:n,httpPart:t});return this[On][La]==null&&(this[On][La]=new WeakMap),this[On][La].set(e,s),s}},validateInput:{value:function(e,t,r){r=typeof t=="string"?t:r;let n=r!=null&&typeof r=="string"&&G6[r],i;if(n&&(i=this[On][n]),i==null&&(t==null||typeof t!="object"||Array.isArray(t)))throw new Wve(r);return i==null&&(this[On][La]?.has(t)?i=this[On][La].get(t):i=this.compileValidationSchema(t,r)),i(e)}},getDecorator:{value:function(e){Y6(this,e);let t=this[e];return typeof t=="function"?t.bind(this):t}},setDecorator:{value:function(e,t){Y6(this,e),this[e]=t}}});iP.exports=nP;iP.exports.buildRequest=Kve});var Uv=T((krt,Q6)=>{"use strict";var{kFourOhFourContext:Xve,kReplySerializerDefault:Qve,kSchemaErrorFormatter:ebe,kErrorHandler:tbe,kChildLoggerFactory:rbe,kOptions:nbe,kReply:ibe,kRequest:sbe,kBodyLimit:obe,kLogLevel:abe,kContentTypeParser:ube,kRouteByFastify:lbe,kRequestCacheValidateFns:cbe,kReplyCacheSerializeFns:dbe}=Hr();function fbe({schema:e,handler:t,config:r,requestIdLogLabel:n,childLoggerFactory:i,errorHandler:s,bodyLimit:o,logLevel:a,logSerializers:u,attachValidation:l,validatorCompiler:c,serializerCompiler:d,replySerializer:p,schemaErrorFormatter:f,exposeHeadRoute:h,prefixTrailingSlash:v,server:y,isFastify:_}){this.schema=e,this.handler=t,this.Reply=y[ibe],this.Request=y[sbe],this.contentTypeParser=y[ube],this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.preSerialization=null,this.onRequestAbort=null,this.config=r,this.errorHandler=s||y[tbe],this.requestIdLogLabel=n||y[nbe].requestIdLogLabel,this.childLoggerFactory=i||y[rbe],this._middie=null,this._parserOptions={limit:o||y[obe]},this.exposeHeadRoute=h,this.prefixTrailingSlash=v,this.logLevel=a||y[abe],this.logSerializers=u,this[Xve]=null,this.attachValidation=l,this[Qve]=p,this.schemaErrorFormatter=f||y[ebe]||pbe,this[lbe]=_,this[cbe]=null,this[dbe]=null,this.validatorCompiler=c||null,this.serializerCompiler=d||null,this.server=y}function pbe(e,t){let r="";for(let i=0;i!==e.length;++i){let s=e[i];r+=t+(s.instancePath||"")+" "+s.message+", "}return new Error(r.slice(0,-2))}Q6.exports=fbe});var tZ=T(oo=>{"use strict";var sP=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=t,this.ttl=r}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete(t){if(this.items.has(t)){let r=this.items.get(t);this.items.delete(t),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;this.items.delete(t.key),this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(this.items.has(t))return this.items.get(t).expiry}get(t){if(this.items.has(t)){let r=this.items.get(t);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return this.items.keys()}set(t,r){if(this.items.has(t)){let i=this.items.get(t);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items.set(t,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},oP=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=t,this.ttl=r}get size(){return this.items.size}bumpLru(t){if(this.last===t)return;let r=this.last,n=t.next,i=t.prev;this.first===t&&(this.first=n),t.next=null,t.prev=r,r.next=t,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=t}clear(){this.items=new Map,this.first=null,this.last=null}delete(t){if(this.items.has(t)){let r=this.items.get(t);this.items.delete(t),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;this.items.delete(t.key),this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(this.items.has(t))return this.items.get(t).expiry}get(t){if(this.items.has(t)){let r=this.items.get(t);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return this.bumpLru(r),r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return this.items.keys()}set(t,r){if(this.items.has(t)){let i=this.items.get(t);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items.set(t,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},Th=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=t,this.ttl=r}bumpLru(t){if(this.last===t)return;let r=this.last,n=t.next,i=t.prev;this.first===t&&(this.first=n),t.next=null,t.prev=r,r.next=t,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=t}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];delete this.items[t],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;delete this.items[t.key],--this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(Object.prototype.hasOwnProperty.call(this.items,t))return this.items[t].expiry}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return this.bumpLru(r),r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return Object.keys(this.items)}set(t,r){if(Object.prototype.hasOwnProperty.call(this.items,t)){let i=this.items[t];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items[t]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}},Zv=class{constructor(){this.records={}}initForCache(t,r){this.records[t]={[r]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(t){for(let r of Object.keys(this.records[t]))this.records[t][r]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}getStatistics(){return this.records}};function eZ(e){return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`}var aP=class{constructor(t,r,n){this.cacheId=t,this.statisticTtlInHours=r,this.collectionStart=new Date,this.currentTimeStamp=eZ(this.collectionStart),this.records=n||new Zv,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){return this.records.records[this.cacheId][this.currentTimeStamp]||(this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}),this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded(),this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded(),this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded(),this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded(),this.currentRecord.misses++}addEviction(){this.archiveIfNeeded(),this.currentRecord.evictions++}setCacheSize(t){this.archiveIfNeeded(),this.currentRecord.cacheSize=t}addExpiration(){this.archiveIfNeeded(),this.currentRecord.expirations++}addSet(){this.archiveIfNeeded(),this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded(),this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded(),this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){this.hoursPassed()>=this.statisticTtlInHours&&(this.collectionStart=new Date,this.currentTimeStamp=eZ(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp))}},Vv=class extends Th{constructor(t,r,n,i,s){if(super(t||1e3,r||0),!n)throw new Error("Cache id is mandatory");this.hitStatistics=new aP(n,s!==void 0?s:24,i)}getStatistics(){return this.hitStatistics.getStatistics()}set(t,r){super.set(t,r),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete(t,r=!1){super.delete(t),r||this.hitStatistics.addInvalidateOne(),this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t,!0),this.hitStatistics.addExpiration();return}return this.bumpLru(r),r.value||this.hitStatistics.addFalsyHit(),(r.value===void 0||r.value===null||r.value==="")&&this.hitStatistics.addEmptyHit(),this.hitStatistics.addHit(),r.value}this.hitStatistics.addMiss()}},Hv=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=t,this.ttl=r}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];delete this.items[t],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;delete this.items[t.key],--this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(Object.prototype.hasOwnProperty.call(this.items,t))return this.items[t].expiry}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return Object.keys(this.items)}set(t,r){if(Object.prototype.hasOwnProperty.call(this.items,t)){let i=this.items[t];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items[t]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}};oo.Fifo=Hv;oo.FifoMap=sP;oo.FifoObject=Hv;oo.HitStatisticsRecord=Zv;oo.Lru=Th;oo.LruHitStatistics=Vv;oo.LruMap=oP;oo.LruObject=Th;oo.LruObjectHitStatistics=Vv});var oZ=T(($rt,td)=>{"use strict";var hbe=typeof Buffer<"u",rZ=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,nZ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function iZ(e,t,r){r==null&&t!==null&&typeof t=="object"&&(r=t,t=void 0),hbe&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let n=JSON.parse(e,t);if(n===null||typeof n!="object")return n;let i=r&&r.protoAction||"error",s=r&&r.constructorAction||"error";if(i==="ignore"&&s==="ignore")return n;if(i!=="ignore"&&s!=="ignore"){if(rZ.test(e)===!1&&nZ.test(e)===!1)return n}else if(i!=="ignore"&&s==="ignore"){if(rZ.test(e)===!1)return n}else if(nZ.test(e)===!1)return n;return sZ(n,{protoAction:i,constructorAction:s,safe:r&&r.safe})}function sZ(e,{protoAction:t="error",constructorAction:r="error",safe:n}={}){let i=[e];for(;i.length;){let s=i;i=[];for(let o of s){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(n===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(r!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(n===!0)return null;if(r==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(let a in o){let u=o[a];u&&typeof u=="object"&&i.push(u)}}}return e}function uP(e,t,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return iZ(e,t,r)}finally{Error.stackTraceLimit=n}}function mbe(e,t){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return iZ(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}}td.exports=uP;td.exports.default=uP;td.exports.parse=uP;td.exports.safeParse=mbe;td.exports.scan=sZ});var pP=T((Ert,Ih)=>{"use strict";var{AsyncResource:gbe}=ie("node:async_hooks"),{FifoMap:lZ}=tZ(),{parse:ybe}=oZ(),Ph=MT(),{kDefaultJsonParse:Rh,kContentTypeParser:rd,kBodyLimit:_be,kRequestPayloadStream:cZ,kState:cP,kTestInternals:vbe,kReplyIsError:aZ,kRouteContext:bbe}=Hr(),{FST_ERR_CTP_INVALID_TYPE:Bv,FST_ERR_CTP_EMPTY_TYPE:wbe,FST_ERR_CTP_ALREADY_PRESENT:Sbe,FST_ERR_CTP_INVALID_HANDLER:kbe,FST_ERR_CTP_INVALID_PARSE_TYPE:xbe,FST_ERR_CTP_BODY_TOO_LARGE:uZ,FST_ERR_CTP_INVALID_MEDIA_TYPE:$be,FST_ERR_CTP_INVALID_CONTENT_LENGTH:Ebe,FST_ERR_CTP_EMPTY_JSON_BODY:Tbe,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:dP,FST_ERR_CTP_INVALID_JSON_BODY:Rbe}=tn(),{FSTSEC001:Pbe}=Hc();function zo(e,t,r){this[Rh]=fZ(t,r),this.customParsers=new Map,this.customParsers.set("application/json",new lP(!0,!1,e,this[Rh])),this.customParsers.set("text/plain",new lP(!0,!1,e,fP)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new lZ(100)}zo.prototype.add=function(e,t,r){let n=typeof e=="string";if(n){if(e=e.trim().toLowerCase(),e.length===0)throw new wbe}else if(!(e instanceof RegExp))throw new Bv;if(typeof r!="function")throw new kbe;if(this.existingParser(e))throw new Sbe(e);if(t.parseAs!==void 0&&t.parseAs!=="string"&&t.parseAs!=="buffer")throw new xbe(t.parseAs);let i=new lP(t.parseAs==="string",t.parseAs==="buffer",t.bodyLimit,r);if(e==="*")this.customParsers.set("",i);else if(n){let s=new Ph(e);if(s.isValid===!1)throw new Bv;let o=s.toString();this.parserList.unshift(o),this.customParsers.set(o,i)}else Dbe(e),this.parserRegExpList.unshift(e),this.customParsers.set(e.toString(),i)};zo.prototype.hasParser=function(e){if(typeof e=="string")e=new Ph(e).toString();else{if(!(e instanceof RegExp))throw new Bv;e=e.toString()}return this.customParsers.has(e)};zo.prototype.existingParser=function(e){if(typeof e=="string"){let t=new Ph(e).toString();if(e==="application/json"&&this.customParsers.has(e))return this.customParsers.get(t).fn!==this[Rh];if(e==="text/plain"&&this.customParsers.has(e))return this.customParsers.get(t).fn!==fP}return this.hasParser(e)};zo.prototype.getParser=function(e){typeof e=="string"&&(e=new Ph(e));let t=e.toString(),r=this.cache.get(t);if(r!==void 0)return r;if(r=this.customParsers.get(t),r!==void 0)return this.cache.set(t,r),r;if(r=this.customParsers.get(e.mediaType),r!==void 0)return r;for(let n=0;n!==this.parserRegExpList.length;++n){let i=this.parserRegExpList[n];if(i.test(t))return r=this.customParsers.get(i.toString()),this.cache.set(t,r),r}return this.customParsers.get("")};zo.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new lZ(100)};zo.prototype.remove=function(e){let t;if(typeof e=="string")e=new Ph(e).toString(),t=this.parserList;else{if(!(e instanceof RegExp))throw new Bv;e=e.toString(),t=this.parserRegExpList}let r=this.customParsers.delete(e),n=t.findIndex(i=>i.toString()===e);return n>-1&&t.splice(n,1),r||n>-1};zo.prototype.run=function(e,t,r,n){let i=this.getParser(e);if(i===void 0){if(r.is404===!0){t(r,n);return}n[aZ]=!0,n.send(new $be(e||void 0));return}let s=new gbe("content-type-parser:run",r),o=s.bind(u);if(i.asString===!0||i.asBuffer===!0){dZ(r,n,n[bbe]._parserOptions,i,o);return}let a=i.fn(r,r[cZ],o);a&&typeof a.then=="function"&&a.then(l=>{o(null,l)},o);function u(l,c){if(s.emitDestroy(),l!=null){n.header("connection","close"),n[aZ]=!0,n.send(l);return}r.body=c,t(r,n)}};function dZ(e,t,r,n,i){let s=n.asString===!0,o=r.limit===null?n.bodyLimit:r.limit,a=Number(e.headers["content-length"]);if(a>o){i(new uZ,void 0);return}let u=0,l=s?"":[],c=e[cZ]||e.raw;s&&c.setEncoding("utf8"),c.on("data",d),c.on("end",p),c.on("error",p),c.resume();function d(f){u+=s?Buffer.byteLength(f):f.length;let{receivedEncodedLength:h=0}=c;if(u>o||h>o){c.removeListener("data",d),c.removeListener("end",p),c.removeListener("error",p),i(new uZ,void 0);return}s?l+=f:l.push(f)}function p(f){if(c.removeListener("data",d),c.removeListener("end",p),c.removeListener("error",p),f!=null){typeof f.statusCode=="number"&&f.statusCode>=400||(f.statusCode=400),i(f,void 0);return}if(!Number.isNaN(a)&&(c.receivedEncodedLength||u)!==a){i(new Ebe,void 0);return}s||(l=Buffer.concat(l));let h=n.fn(e,l,i);h&&typeof h.then=="function"&&h.then(v=>{i(null,v)},i)}}function fZ(e,t){let r={protoAction:e,constructorAction:t};return n;function n(i,s,o){if(s.length===0){o(new Tbe,void 0);return}try{o(null,ybe(s,r))}catch{o(new Rbe,void 0)}}}function fP(e,t,r){r(null,t)}function lP(e,t,r,n){this.asString=e,this.asBuffer=t,this.bodyLimit=r,this.fn=n}function Ibe(e){let t=new zo;return t[Rh]=e[Rh],t.customParsers=new Map(e.customParsers.entries()),t.parserList=e.parserList.slice(),t.parserRegExpList=e.parserRegExpList.slice(),t}function Obe(e,t,r){if(this[cP].started)throw new dP("addContentTypeParser");return typeof t=="function"&&(r=t,t={}),t||(t={}),t.bodyLimit||(t.bodyLimit=this[_be]),Array.isArray(e)?e.forEach(n=>this[rd].add(n,t,r)):this[rd].add(e,t,r),this}function Cbe(e){return this[rd].hasParser(e)}function Nbe(e){if(this[cP].started)throw new dP("removeContentTypeParser");if(Array.isArray(e))for(let t of e)this[rd].remove(t);else this[rd].remove(e)}function Abe(){if(this[cP].started)throw new dP("removeAllContentTypeParsers");this[rd].removeAll()}function Dbe(e){e.source[0]!=="^"&&e.source.includes(";?")===!1&&Pbe(e.source)}Ih.exports=zo;Ih.exports.helpers={buildContentTypeParser:Ibe,addContentTypeParser:Obe,hasContentTypeParser:Cbe,removeContentTypeParser:Nbe,removeAllContentTypeParsers:Abe};Ih.exports.defaultParsers={getDefaultJsonParser:fZ,defaultTextParser:fP};Ih.exports[vbe]={rawBody:dZ}});var nd=T(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.regexpCode=Rt.getEsmExportName=Rt.getProperty=Rt.safeStringify=Rt.stringify=Rt.strConcat=Rt.addCodeArg=Rt.str=Rt._=Rt.nil=Rt._Code=Rt.Name=Rt.IDENTIFIER=Rt._CodeOrName=void 0;var Oh=class{};Rt._CodeOrName=Oh;Rt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pl=class extends Oh{constructor(t){if(super(),!Rt.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Rt.Name=pl;var Gi=class extends Oh{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof pl&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Rt._Code=Gi;Rt.nil=new Gi("");function pZ(e,...t){let r=[e[0]],n=0;for(;n<t.length;)mP(r,t[n]),r.push(e[++n]);return new Gi(r)}Rt._=pZ;var hP=new Gi("+");function hZ(e,...t){let r=[Ch(e[0])],n=0;for(;n<t.length;)r.push(hP),mP(r,t[n]),r.push(hP,Ch(e[++n]));return jbe(r),new Gi(r)}Rt.str=hZ;function mP(e,t){t instanceof Gi?e.push(...t._items):t instanceof pl?e.push(t):e.push(Lbe(t))}Rt.addCodeArg=mP;function jbe(e){let t=1;for(;t<e.length-1;){if(e[t]===hP){let r=zbe(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function zbe(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof pl||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof pl))return`"${e}${t.slice(1)}`}function Mbe(e,t){return t.emptyStr()?e:e.emptyStr()?t:hZ`${e}${t}`}Rt.strConcat=Mbe;function Lbe(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ch(Array.isArray(e)?e.join(","):e)}function qbe(e){return new Gi(Ch(e))}Rt.stringify=qbe;function Ch(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Rt.safeStringify=Ch;function Fbe(e){return typeof e=="string"&&Rt.IDENTIFIER.test(e)?new Gi(`.${e}`):pZ`[${e}]`}Rt.getProperty=Fbe;function Ube(e){if(typeof e=="string"&&Rt.IDENTIFIER.test(e))return new Gi(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Rt.getEsmExportName=Ube;function Zbe(e){return new Gi(e.toString())}Rt.regexpCode=Zbe});var Kv=T(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ValueScope=di.ValueScopeName=di.Scope=di.varKinds=di.UsedValueState=void 0;var ci=nd(),gP=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Wv;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Wv||(di.UsedValueState=Wv={}));di.varKinds={const:new ci.Name("const"),let:new ci.Name("let"),var:new ci.Name("var")};var Jv=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ci.Name?t:this.name(t)}name(t){return new ci.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};di.Scope=Jv;var Gv=class extends ci.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ci._)`.${new ci.Name(r)}[${n}]`}};di.ValueScopeName=Gv;var Vbe=(0,ci._)`\n`,yP=class extends Jv{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Vbe:ci.nil}}get(){return this._scope}name(t){return new Gv(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let c=a.get(o);if(c)return c}else a=this._values[s]=new Map;a.set(o,i);let u=this._scope[s]||(this._scope[s]=[]),l=u.length;return u[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ci._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let s=ci.nil;for(let o in t){let a=t[o];if(!a)continue;let u=n[o]=n[o]||new Map;a.forEach(l=>{if(u.has(l))return;u.set(l,Wv.Started);let c=r(l);if(c){let d=this.opts.es5?di.varKinds.var:di.varKinds.const;s=(0,ci._)`${s}${d} ${l} = ${c};${this.opts._n}`}else if(c=i?.(l))s=(0,ci._)`${s}${c}${this.opts._n}`;else throw new gP(l);u.set(l,Wv.Completed)})}return s}};di.ValueScope=yP});var qe=T(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.or=at.and=at.not=at.CodeGen=at.operators=at.varKinds=at.ValueScopeName=at.ValueScope=at.Scope=at.Name=at.regexpCode=at.stringify=at.getProperty=at.nil=at.strConcat=at.str=at._=void 0;var wt=nd(),Cs=Kv(),qa=nd();Object.defineProperty(at,"_",{enumerable:!0,get:function(){return qa._}});Object.defineProperty(at,"str",{enumerable:!0,get:function(){return qa.str}});Object.defineProperty(at,"strConcat",{enumerable:!0,get:function(){return qa.strConcat}});Object.defineProperty(at,"nil",{enumerable:!0,get:function(){return qa.nil}});Object.defineProperty(at,"getProperty",{enumerable:!0,get:function(){return qa.getProperty}});Object.defineProperty(at,"stringify",{enumerable:!0,get:function(){return qa.stringify}});Object.defineProperty(at,"regexpCode",{enumerable:!0,get:function(){return qa.regexpCode}});Object.defineProperty(at,"Name",{enumerable:!0,get:function(){return qa.Name}});var eb=Kv();Object.defineProperty(at,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(at,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(at,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(at,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});at.operators={GT:new wt._Code(">"),GTE:new wt._Code(">="),LT:new wt._Code("<"),LTE:new wt._Code("<="),EQ:new wt._Code("==="),NEQ:new wt._Code("!=="),NOT:new wt._Code("!"),OR:new wt._Code("||"),AND:new wt._Code("&&"),ADD:new wt._Code("+")};var Mo=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},_P=class extends Mo{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Cs.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=sd(this.rhs,t,r)),this}get names(){return this.rhs instanceof wt._CodeOrName?this.rhs.names:{}}},Yv=class extends Mo{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof wt.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sd(this.rhs,t,r),this}get names(){let t=this.lhs instanceof wt.Name?{}:{...this.lhs.names};return Qv(t,this.rhs)}},vP=class extends Yv{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bP=class extends Mo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},wP=class extends Mo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},SP=class extends Mo{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},kP=class extends Mo{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=sd(this.code,t,r),this}get names(){return this.code instanceof wt._CodeOrName?this.code.names:{}}},Nh=class extends Mo{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(t,r)||(Hbe(t,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>gl(t,r.names),{})}},Lo=class extends Nh{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},xP=class extends Nh{},id=class extends Lo{};id.kind="else";var hl=class e extends Lo{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new id(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(mZ(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=sd(this.condition,t,r),this}get names(){let t=super.names;return Qv(t,this.condition),this.else&&gl(t,this.else.names),t}};hl.kind="if";var ml=class extends Lo{};ml.kind="for";var $P=class extends ml{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=sd(this.iteration,t,r),this}get names(){return gl(super.names,this.iteration.names)}},EP=class extends ml{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?Cs.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=Qv(super.names,this.from);return Qv(t,this.to)}},Xv=class extends ml{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=sd(this.iterable,t,r),this}get names(){return gl(super.names,this.iterable.names)}},Ah=class extends Lo{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Ah.kind="func";var Dh=class extends Nh{render(t){return"return "+super.render(t)}};Dh.kind="return";var TP=class extends Lo{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&gl(t,this.catch.names),this.finally&&gl(t,this.finally.names),t}},jh=class extends Lo{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};jh.kind="catch";var zh=class extends Lo{render(t){return"finally"+super.render(t)}};zh.kind="finally";var RP=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
26
+ `),A=Dye.bind(null,{[H2]:"",[B2]:o,[J2]:C,[W2]:jR,[zR]:R,[G2]:E}),W="";d!==null&&(p===void 0?W=A(d):W=A(Object.assign({},d,{name:p})));let H=a instanceof Function?a:a?t6:r_e,te=H().indexOf(":")+1;if(b&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(y&&typeof y!="function")throw Error(`Unknown mixin type "${typeof y}" - expected "function"`);if(x&&typeof x!="string")throw Error(`Unknown msgPrefix type "${typeof x}" - expected "string"`);Pye(f,h,b);let ne=Q2(h,b);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:ne,messageKey:u,errorKey:l}}),Cye(v);let Z=Oye(v);return Object.assign(t,{levels:ne,[Kye]:Z,[Yye]:b,[Uye]:n,[qye]:H,[Fye]:te,[W2]:jR,[zR]:R,[J2]:C,[Vye]:N,[Hye]:$,[Bye]:u,[Wye]:l,[Jye]:c,[Qye]:c?`,${JSON.stringify(c)}:{`:"",[B2]:o,[Gye]:y,[e_e]:_,[H2]:W,[G2]:E,[Xye]:m,silent:zye,onChild:k,[t_e]:x}),Object.setPrototypeOf(t,Tye()),Iye(t),t[Zye](f),t}Ji.exports=MR;Ji.exports.destination=(e=process.stdout.fd)=>typeof e=="object"?(e.dest=V2(e.dest||process.stdout.fd),Z2(e)):Z2({dest:V2(e),minLength:0});Ji.exports.transport=vR();Ji.exports.multistream=U2();Ji.exports.levels=Q2();Ji.exports.stdSerializers=u_e;Ji.exports.stdTimeFunctions=Object.assign({},Y2);Ji.exports.symbols=X2;Ji.exports.version=Mye;Ji.exports.default=MR;Ji.exports.pino=MR});var s6=T((drt,i6)=>{"use strict";var wv=r6(),{serializersSym:n6}=wv.symbols,{FST_ERR_LOG_INVALID_DESTINATION:l_e}=tn();function c_e(e){if(e.stream&&e.file)throw new l_e;e.file&&(e.stream=wv.destination(e.file),delete e.file);let t=e.logger,r=e.genReqId,n=null;return t?(e.logger=void 0,e.genReqId=void 0,t[n6]&&(e.serializers=Object.assign({},e.serializers,t[n6])),n=t.child({},e),e.logger=t,e.genReqId=r):n=wv(e,e.stream),n}var d_e={req:function(t){return{method:t.method,url:t.url,version:t.headers&&t.headers["accept-version"],host:t.host,remoteAddress:t.ip,remotePort:t.socket?t.socket.remotePort:void 0}},err:wv.stdSerializers.err,res:function(t){return{statusCode:t.statusCode}}};i6.exports={serializers:d_e,createPinoLogger:c_e}});var vh=T((frt,a6)=>{"use strict";var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:f_e,FST_ERR_LOG_INVALID_LOGGER_CONFIG:p_e,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:h_e,FST_ERR_LOG_INVALID_LOGGER:m_e}=tn();function g_e(e,t,r,n,i){let s={[e.requestIdLogLabel]:n},o=e.childLoggerFactory.call(e.server,t,s,i||{},r);return e.childLoggerFactory!==o6&&Sv(o,!0),o}function o6(e,t,r){return e.child(t,r)}function Sv(e,t){let r=["info","error","debug","fatal","warn","trace","child"],n=e?r.filter(i=>!e[i]||typeof e[i]!="function"):r;if(n.length){if(n.length===r.length&&!t)return!1;throw m_e(n.join(","))}else return!0}function y_e(e){if(e.logger&&e.loggerInstance)throw new f_e;if(!e.loggerInstance&&!e.logger){let o=t4();return o.child=()=>o,{logger:o,hasLogger:!1}}let{createPinoLogger:t,serializers:r}=s6();if(Sv(e.loggerInstance))return{logger:t({logger:e.loggerInstance,serializers:Object.assign({},r,e.loggerInstance.serializers)}),hasLogger:!0};if(Sv(e.logger))throw p_e();if(e.loggerInstance)throw h_e();let n={};return Object.prototype.toString.call(e.logger)==="[object Object]"&&Reflect.ownKeys(e.logger).forEach(s=>{Object.defineProperty(n,s,{value:e.logger[s],writable:!0,enumerable:!0,configurable:!0})}),n.level=n.level||"info",n.serializers=Object.assign({},r,n.serializers),e.logger=n,{logger:t(e.logger),hasLogger:!0}}function __e(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}a6.exports={createChildLogger:g_e,defaultChildLoggerFactory:o6,createLogger:y_e,validateLogger:Sv,now:__e}});var kv=T((prt,u6)=>{"use strict";u6.exports=v_e;function Xc(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function v_e(e){if(e=e||{},e.circles)return b_e(e);let t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,a)=>new Map(n(Array.from(o),a))),t.set(Set,(o,a)=>new Set(n(Array.from(o),a))),e.constructorHandlers)for(let o of e.constructorHandlers)t.set(o[0],o[1]);let r=null;return e.proto?s:i;function n(o,a){let u=Object.keys(o),l=new Array(u.length);for(let c=0;c<u.length;c++){let d=u[c],p=o[d];typeof p!="object"||p===null?l[d]=p:p.constructor!==Object&&(r=t.get(p.constructor))?l[d]=r(p,a):ArrayBuffer.isView(p)?l[d]=Xc(p):l[d]=a(p)}return l}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,i);if(o.constructor!==Object&&(r=t.get(o.constructor)))return r(o,i);let a={};for(let u in o){if(Object.hasOwnProperty.call(o,u)===!1)continue;let l=o[u];typeof l!="object"||l===null?a[u]=l:l.constructor!==Object&&(r=t.get(l.constructor))?a[u]=r(l,i):ArrayBuffer.isView(l)?a[u]=Xc(l):a[u]=i(l)}return a}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,s);if(o.constructor!==Object&&(r=t.get(o.constructor)))return r(o,s);let a={};for(let u in o){let l=o[u];typeof l!="object"||l===null?a[u]=l:l.constructor!==Object&&(r=t.get(l.constructor))?a[u]=r(l,s):ArrayBuffer.isView(l)?a[u]=Xc(l):a[u]=s(l)}return a}}function b_e(e){let t=[],r=[],n=new Map;if(n.set(Date,u=>new Date(u)),n.set(Map,(u,l)=>new Map(s(Array.from(u),l))),n.set(Set,(u,l)=>new Set(s(Array.from(u),l))),e.constructorHandlers)for(let u of e.constructorHandlers)n.set(u[0],u[1]);let i=null;return e.proto?a:o;function s(u,l){let c=Object.keys(u),d=new Array(c.length);for(let p=0;p<c.length;p++){let f=c[p],h=u[f];if(typeof h!="object"||h===null)d[f]=h;else if(h.constructor!==Object&&(i=n.get(h.constructor)))d[f]=i(h,l);else if(ArrayBuffer.isView(h))d[f]=Xc(h);else{let v=t.indexOf(h);v!==-1?d[f]=r[v]:d[f]=l(h)}}return d}function o(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return s(u,o);if(u.constructor!==Object&&(i=n.get(u.constructor)))return i(u,o);let l={};t.push(u),r.push(l);for(let c in u){if(Object.hasOwnProperty.call(u,c)===!1)continue;let d=u[c];if(typeof d!="object"||d===null)l[c]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[c]=i(d,o);else if(ArrayBuffer.isView(d))l[c]=Xc(d);else{let p=t.indexOf(d);p!==-1?l[c]=r[p]:l[c]=o(d)}}return t.pop(),r.pop(),l}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return s(u,a);if(u.constructor!==Object&&(i=n.get(u.constructor)))return i(u,a);let l={};t.push(u),r.push(l);for(let c in u){let d=u[c];if(typeof d!="object"||d===null)l[c]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[c]=i(d,a);else if(ArrayBuffer.isView(d))l[c]=Xc(d);else{let p=t.indexOf(d);p!==-1?l[c]=r[p]:l[c]=a(d)}}return t.pop(),r.pop(),l}}});var bh=T((hrt,p6)=>{"use strict";var w_e=kv()({circles:!1,proto:!0}),{kSchemaVisited:l6,kSchemaResponse:S_e}=Hr(),LR=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:k_e,FST_ERR_SCH_ALREADY_PRESENT:x_e,FST_ERR_SCH_DUPLICATE:$_e,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:c6}=tn(),f6=["params","body","querystring","query","headers"];function xv(e){this.store=e||{}}xv.prototype.add=function(e){let t=w_e(e.isFluentSchema||e.isFluentJSONSchema||e[LR]?e.valueOf():e),r=t.$id;if(!r)throw new k_e;if(this.store[r])throw new x_e(r);this.store[r]=t};xv.prototype.getSchemas=function(){return Object.assign({},this.store)};xv.prototype.getSchema=function(e){return this.store[e]};function d6(e){return typeof e=="object"&&Object.getPrototypeOf(e)!==Object.prototype}function E_e(e,t){if(e[l6])return e;if(e.query){if(e.querystring)throw new $_e("querystring");e.querystring=e.query}T_e(e);for(let r of f6){let n=e[r];if(n&&!d6(n)&&r==="body"&&n.content){let i=n.content,s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new c6(a)}continue}}if(e.response){let r=Object.keys(e.response);for(let n of r){if(d6(e.response[n]))continue;let i=e.response[n].content;if(i){let s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new c6(a)}}}}return e[l6]=!0,e}function T_e(e){for(let t of f6)e[t]&&(e[t].isFluentSchema||e[t][LR])&&(e[t]=e[t].valueOf());if(e.response){let t=Object.keys(e.response);for(let r of t)(e.response[r].isFluentSchema||e.response[r][LR])&&(e.response[r]=e.response[r].valueOf())}}function R_e(e,t,r){let n=e[S_e];if(!n)return!1;if(n[t]){if(n[t].constructor===Object&&r){let s=r.split(";",1)[0];return n[t][s]?n[t][s]:n[t]["*/*"]?n[t]["*/*"]:!1}return n[t]}let i=(t+"")[0]+"xx";if(n[i]){if(n[i].constructor===Object&&r){let s=r.split(";",1)[0];return n[i][s]?n[i][s]:n[i]["*/*"]?n[i]["*/*"]:!1}return n[i]}if(n.default){if(n.default.constructor===Object&&r){let s=r.split(";",1)[0];return n.default[s]?n.default[s]:n.default["*/*"]?n.default["*/*"]:!1}return n.default}return!1}p6.exports={buildSchemas(e){return new xv(e)},getSchemaSerializer:R_e,normalizeSchema:E_e}});var $v=T((mrt,m6)=>{"use strict";var P_e=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;m6.exports=class h6{constructor(t){switch(t&&t.rounding){case"floor":this.parseInteger=Math.floor;break;case"ceil":this.parseInteger=Math.ceil;break;case"round":this.parseInteger=Math.round;break;case"trunc":default:this.parseInteger=Math.trunc;break}this._options=t}asInteger(t){if(Number.isInteger(t))return""+t;if(typeof t=="bigint")return t.toString();let r=this.parseInteger(t);if(r===1/0||r===-1/0||r!==r)throw new Error(`The value "${t}" cannot be converted to an integer.`);return""+r}asNumber(t){let r=Number(t);if(r!==r)throw new Error(`The value "${t}" cannot be converted to a number.`);return r===1/0||r===-1/0?"null":""+r}asBoolean(t){return t&&"true"||"false"}asDateTime(t){if(t===null)return'""';if(t instanceof Date)return'"'+t.toISOString()+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a date-time.`)}asDate(t){if(t===null)return'""';if(t instanceof Date)return'"'+new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a date.`)}asTime(t){if(t===null)return'""';if(t instanceof Date)return'"'+new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(11,19)+'"';if(typeof t=="string")return'"'+t+'"';throw new Error(`The value "${t}" cannot be converted to a time.`)}asString(t){let r=t.length;if(r===0)return'""';if(r<42){let n="",i=-1,s=255;for(let o=0;o<r;o++)if(s=t.charCodeAt(o),s===34||s===92)i===-1&&(i=0),n+=t.slice(i,o)+"\\",i=o;else if(s<32||s>=55296&&s<=57343)return JSON.stringify(t);return i===-1&&'"'+t+'"'||'"'+n+t.slice(i)+'"'}else return r<5e3&&P_e.test(t)===!1?'"'+t+'"':JSON.stringify(t)}asUnsafeString(t){return'"'+t+'"'}getState(){return this._options}static restoreFromState(t){return new h6(t)}}});var y6=T((grt,g6)=>{"use strict";var I_e=$v(),O_e={mode:"standalone"},C_e=I_e.restoreFromState(O_e),N_e=null;g6.exports=(function(t,r){let{asString:n,asNumber:i,asBoolean:s,asDateTime:o,asDate:a,asTime:u,asUnsafeString:l}=r,c=r.asInteger.bind(r),d="{",p="}",f="[",h="]",v=",",y=":",_='"',b=d+p,g=f+h,m=_+_,S="null";function w(x){let R=x&&typeof x.toJSON=="function"?x.toJSON():x;if(R===null)return b;let E,P=d,C=!1;return E=R.statusCode,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"statusCode":',P+=i(E)),E=R.code,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"code":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),E=R.error,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"error":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),E=R.message,E!==void 0&&(!C&&(C=!0)||(P+=v),P+='"message":',typeof E!="string"?E===null?P+=m:E instanceof Date?P+=_+E.toISOString()+_:E instanceof RegExp?P+=n(E.source):P+=n(E.toString()):P+=n(E)),P+p}return w})(N_e,C_e)});var wh=T((yrt,w6)=>{"use strict";var _6=ie("node:http").STATUS_CODES,A_e=LT(),{setErrorStatusCode:D_e}=Y_(),{kReplyHeaders:dl,kReplyNextErrorHandler:Ev,kReplyIsRunningOnErrorHook:j_e,kRouteContext:b6,kDisableRequestLogging:Tv}=Hr(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:z_e,FST_ERR_FAILED_ERROR_SERIALIZATION:M_e}=tn(),{getSchemaSerializer:L_e}=bh(),qR=y6(),q_e={func:U_e,toJSON(){return this.func.name.toString()+"()"}};function F_e(e,t,r){e[j_e]=!1;let n=e[b6];if(e[Ev]===!1){v6(t,e,function(o,a){try{o.raw.writeHead(o.raw.statusCode,o[dl])}catch(u){o.log[Tv]||o.log.warn({req:o.request,res:o,err:u},u?.message),o.raw.writeHead(o.raw.statusCode)}o.raw.end(a)});return}let i=e[Ev]||n.errorHandler;e[Ev]=Object.getPrototypeOf(i),delete e[dl]["content-type"],delete e[dl]["content-length"];let s=i.func;if(!s){e[Ev]=!1,v6(t,e,r);return}try{let o=s(t,e.request,e);o!==void 0&&(o!==null&&typeof o.then=="function"?A_e(o,e):e.send(o))}catch(o){e.send(o)}}function U_e(e,t,r){V_e(e,r),D_e(r,e),r.statusCode<500?r.log[Tv]||r.log.info({res:r,err:e},e?.message):r.log[Tv]||r.log.error({req:t,res:r,err:e},e?.message),r.send(e)}function v6(e,t,r){let n=t.raw,i=t.statusCode;t[dl]["content-type"]=t[dl]["content-type"]??"application/json; charset=utf-8";let s;try{let o=L_e(t[b6],i,t[dl]["content-type"]);o===!1?s=qR({error:_6[i+""],code:e.code,message:e.message,statusCode:i}):s=o(Object.create(e,{error:{value:_6[i+""]},message:{value:e.message},statusCode:{value:i}}))}catch(o){t.log[Tv]||t.log.error({err:o,statusCode:n.statusCode},"The serializer for the given status code failed"),t.code(500),s=qR(new M_e(o.message,e.message))}typeof s!="string"&&!Buffer.isBuffer(s)&&(s=qR(new z_e(typeof s))),t[dl]["content-length"]=""+Buffer.byteLength(s),r(t,s)}function Z_e(e=q_e,t){if(!t)return e;let r=Object.create(e);return r.func=t,r}function V_e(e,t){let r=t.raw,n=r.statusCode;n=n>=400?n:500,e!=null&&(e.headers!==void 0&&t.headers(e.headers),e.status>=400?n=e.status:e.statusCode>=400&&(n=e.statusCode)),r.statusCode=n}w6.exports={buildErrorHandler:Z_e,handleError:F_e}});var xh=T((_rt,$6)=>{"use strict";var{kReply:FR,kRequest:UR,kState:H_e,kHasBeenDecorated:B_e}=Hr(),{FST_ERR_DEC_ALREADY_PRESENT:S6,FST_ERR_DEC_MISSING_DEPENDENCY:W_e,FST_ERR_DEC_AFTER_START:J_e,FST_ERR_DEC_REFERENCE_TYPE:G_e,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:K_e,FST_ERR_DEC_UNDECLARED:Y_e}=tn();function X_e(e,t,r,n){if(Object.hasOwn(e,t))throw new S6(t);ZR(e,t,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(e,t,{get:r.getter,set:r.setter}):e[t]=r}function Q_e(e){if(!Sh(this,e))throw new Y_e(e,"instance");return typeof this[e]=="function"?this[e].bind(this):this[e]}function k6(e,t,r,n){let i=e.prototype;if(Object.hasOwn(i,t)||kh(e,t))throw new S6(t);e[B_e]=!0,ZR(e,t,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(i,t,{get:r.getter,set:r.setter}):typeof r=="function"?i[t]=r:e.props.push({key:t,value:r})}function x6(e,t){if(typeof t=="object"&&t&&!(typeof t.getter=="function"||typeof t.setter=="function"))throw new G_e(e,typeof t)}function eve(e,t,r){return VR(this,e),X_e(this,e,t,r),this}function Sh(e,t){return t?t in e||e.prototype&&t in e.prototype||kh(e,t):e in this}function kh(e,t){return e.props?e.props.find(({key:r})=>r===t):!1}function tve(e){return e&&kh(this[UR],e)?!0:Sh(this[UR].prototype,e)}function rve(e){return e&&kh(this[FR],e)?!0:Sh(this[FR].prototype,e)}function ZR(e,t,r){if(r!=null){if(!Array.isArray(r))throw new K_e(t);for(let n=0;n!==r.length;++n)if(!Sh(e,r[n]))throw new W_e(r[n])}}function nve(e,t,r){return VR(this,e),x6(e,t),k6(this[FR],e,t,r),this}function ive(e,t,r){return VR(this,e),x6(e,t),k6(this[UR],e,t,r),this}function VR(e,t){if(e[H_e].started)throw new J_e(t)}$6.exports={add:eve,exist:Sh,existRequest:tve,existReply:rve,dependencies:ZR,decorateReply:nve,decorateRequest:ive,getInstanceDecorator:Q_e,hasKey:kh}});var Dv=T((vrt,Av)=>{"use strict";var Rv=ie("node:stream").finished,{kFourOhFourContext:E6,kReplyErrorHandlerCalled:N6,kReplyHijacked:GR,kReplyStartTime:Eh,kReplyEndTime:KR,kReplySerializer:jo,kReplySerializerDefault:Pv,kReplyIsError:Iv,kReplyHeaders:Zt,kReplyTrailers:rn,kReplyHasStatusCode:YR,kReplyIsRunningOnErrorHook:XR,kReplyNextErrorHandler:sve,kDisableRequestLogging:A6,kSchemaResponse:Ov,kReplyCacheSerializeFns:Ma,kSchemaController:HR,kOptions:ove,kRouteContext:mt}=Hr(),{onSendHookRunner:D6,onResponseHookRunner:ave,preHandlerHookRunner:uve,preSerializationHookRunner:lve}=Da(),T6=BT()[Symbol.for("internals")],cve=vh(),JR=cve.now,{handleError:R6}=wh(),{getSchemaSerializer:dve}=bh(),BR={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:fve,FST_ERR_REP_RESPONSE_BODY_CONSUMED:pve,FST_ERR_REP_READABLE_STREAM_LOCKED:hve,FST_ERR_REP_ALREADY_SENT:mve,FST_ERR_SEND_INSIDE_ONERR:gve,FST_ERR_BAD_STATUS_CODE:yve,FST_ERR_BAD_TRAILER_NAME:_ve,FST_ERR_BAD_TRAILER_VALUE:vve,FST_ERR_MISSING_SERIALIZATION_FN:bve,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:wve,FST_ERR_DEC_UNDECLARED:Sve}=tn(),P6=xh(),j6=Object.prototype.toString;function Vt(e,t,r){this.raw=e,this[jo]=null,this[N6]=!1,this[Iv]=!1,this[XR]=!1,this.request=t,this[Zt]={},this[rn]=null,this[YR]=!1,this[Eh]=void 0,this.log=r}Vt.props=[];Object.defineProperties(Vt.prototype,{[mt]:{get(){return this.request[mt]}},elapsedTime:{get(){return this[Eh]===void 0?0:(this[KR]||JR())-this[Eh]}},server:{get(){return this.request[mt].server}},sent:{enumerable:!0,get(){return(this[GR]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set(e){this.code(e)}},routeOptions:{get(){return this.request.routeOptions}}});Vt.prototype.writeEarlyHints=function(e,t){return this.raw.writeEarlyHints(e,t),this};Vt.prototype.hijack=function(){return this[GR]=!0,this};Vt.prototype.send=function(e){if(this[XR])throw new gve;if(this.sent===!0)return this.log.warn({err:new mve(this.request.url,this.request.method)}),this;if(this[Iv]||e instanceof Error)return this[Iv]=!1,Qc(this,e,fl),this;if(e===void 0)return fl(this,e),this;let t=this.getHeader("content-type"),r=t!==void 0;if(e!==null){if(typeof e.pipe=="function"||typeof e.getReader=="function"||j6.call(e)==="[object Response]")return fl(this,e),this;if(e.buffer instanceof ArrayBuffer){r||(this[Zt]["content-type"]=BR.OCTET);let n=Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength);return fl(this,n),this}if(!r&&typeof e=="string")return this[Zt]["content-type"]=BR.PLAIN,fl(this,e),this}if(this[jo]!==null){if(typeof e!="string")return I6(this,e),this;e=this[jo](e)}else if(!r||t.indexOf("json")!==-1){if(!r)this[Zt]["content-type"]=BR.JSON;else if(t.indexOf("charset")===-1){let n=t.trim();n.endsWith(";")?this[Zt]["content-type"]=`${n} charset=utf-8`:this[Zt]["content-type"]=`${n}; charset=utf-8`}if(typeof e!="string")return I6(this,e),this}return fl(this,e),this};Vt.prototype.getHeader=function(e){e=e.toLowerCase();let t=this[Zt][e];return t!==void 0?t:this.raw.getHeader(e)};Vt.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[Zt]}};Vt.prototype.hasHeader=function(e){return e=e.toLowerCase(),this[Zt][e]!==void 0||this.raw.hasHeader(e)};Vt.prototype.removeHeader=function(e){return delete this[Zt][e.toLowerCase()],this};Vt.prototype.header=function(e,t=""){return e=e.toLowerCase(),this[Zt][e]&&e==="set-cookie"?(typeof this[Zt][e]=="string"&&(this[Zt][e]=[this[Zt][e]]),Array.isArray(t)?Array.prototype.push.apply(this[Zt][e],t):this[Zt][e].push(t)):this[Zt][e]=t,this};Vt.prototype.headers=function(e){let t=Object.keys(e);for(let r=0;r!==t.length;++r){let n=t[r];this.header(n,e[n])}return this};var kve=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);Vt.prototype.trailer=function(e,t){if(e=e.toLowerCase(),kve.has(e))throw new _ve(e);if(typeof t!="function")throw new vve(e,typeof t);return this[rn]===null&&(this[rn]={}),this[rn][e]=t,this};Vt.prototype.hasTrailer=function(e){return this[rn]?.[e.toLowerCase()]!==void 0};Vt.prototype.removeTrailer=function(e){return this[rn]===null?this:(this[rn][e.toLowerCase()]=void 0,this)};Vt.prototype.code=function(e){let t=+e;if(!(t>=100&&t<=599))throw new yve(e||String(e));return this.raw.statusCode=t,this[YR]=!0,this};Vt.prototype.status=Vt.prototype.code;Vt.prototype.getSerializationFunction=function(e,t){let r;return typeof e=="string"||typeof e=="number"?typeof t=="string"?r=this[mt][Ov]?.[e]?.[t]:r=this[mt][Ov]?.[e]:typeof e=="object"&&(r=this[mt][Ma]?.get(e)),r};Vt.prototype.compileSerializationSchema=function(e,t=null,r=null){let{request:n}=this,{method:i,url:s}=n;if(this[mt][Ma]?.has(e))return this[mt][Ma].get(e);let a=(this[mt].serializerCompiler||this.server[HR].serializerCompiler||this.server[HR].setupSerializer(this.server[ove])||this.server[HR].serializerCompiler)({schema:e,method:i,url:s,httpStatus:t,contentType:r});return this[mt][Ma]==null&&(this[mt][Ma]=new WeakMap),this[mt][Ma].set(e,a),a};Vt.prototype.serializeInput=function(e,t,r,n){let i=r,s;if(r=typeof t=="string"||typeof t=="number"?t:r,n=r&&i!==r?i:n,r!=null){if(n!=null?s=this[mt][Ov]?.[r]?.[n]:s=this[mt][Ov]?.[r],s==null)throw n?new wve(r,n):new bve(r)}else this[mt][Ma]?.has(t)?s=this[mt][Ma].get(t):s=this.compileSerializationSchema(t,r,n);return s(e)};Vt.prototype.serialize=function(e){return this[jo]!==null?this[jo](e):this[mt]&&this[mt][Pv]?this[mt][Pv](e,this.raw.statusCode):M6(this[mt],e,this.raw.statusCode)};Vt.prototype.serializer=function(e){return this[jo]=e,this};Vt.prototype.type=function(e){return this[Zt]["content-type"]=e,this};Vt.prototype.redirect=function(e,t){return t||(t=this[YR]?this.raw.statusCode:302),this.header("location",e).code(t).send()};Vt.prototype.callNotFound=function(){return Ove(this),this};Vt.prototype.then=function(e,t){if(this.sent){e();return}Rv(this.raw,r=>{r&&r.code!=="ERR_STREAM_PREMATURE_CLOSE"?t?t(r):this.log&&this.log.warn("unhandled rejection on reply.then"):e()})};Vt.prototype.getDecorator=function(e){if(!P6.hasKey(this,e)&&!P6.exist(this,e))throw new Sve(e,"reply");let t=this[e];return typeof t=="function"?t.bind(this):t};function I6(e,t){e[mt].preSerialization!==null?lve(e[mt].preSerialization,e.request,e,t,O6):O6(null,void 0,e,t)}function O6(e,t,r,n){if(e!=null){Qc(r,e);return}try{r[jo]!==null?n=r[jo](n):r[mt]&&r[mt][Pv]?n=r[mt][Pv](n,r.raw.statusCode):n=M6(r[mt],n,r.raw.statusCode,r[Zt]["content-type"])}catch(i){xve(i,r),Qc(r,i);return}fl(r,n)}function xve(e,t){e.serialization=t[mt].config}function fl(e,t){e[mt].onSend!==null?D6(e[mt].onSend,e.request,e,t,$ve):z6(e,t)}function $ve(e,t,r,n){e!=null?Qc(r,e):z6(r,n)}function WR(e,t){let r=e.raw;try{r.writeHead(t,e[Zt])}catch(n){throw n.code==="ERR_HTTP_HEADERS_SENT"&&e.log.warn(`Reply was already sent, did you forget to "return reply" in the "${e.request.raw.url}" (${e.request.raw.method}) route?`),n}}function z6(e,t){let r=e.raw,n=e.request;if(e[rn]!==null){let s=Object.keys(e[rn]),o="";for(let a of s)typeof e[rn][a]=="function"&&(o+=" ",o+=a);e.header("Transfer-Encoding","chunked"),e.header("Trailer",o.trim())}if(j6.call(t)==="[object Response]"){if(typeof t.status=="number"&&e.code(t.status),typeof t.headers=="object"&&typeof t.headers.forEach=="function")for(let[s,o]of t.headers)e.header(s,o);if(t.body!==null&&t.bodyUsed)throw new pve;t=t.body}let i=r.statusCode;if(t==null){i>=200&&i!==204&&i!==304&&n.method!=="HEAD"&&e[rn]===null&&(e[Zt]["content-length"]="0"),WR(e,i),$h(t,r,e);return}if(i>=100&&i<200||i===204){e.removeHeader("content-type"),e.removeHeader("content-length"),WR(e,i),$h(void 0,r,e),typeof t.resume=="function"&&(t.on("error",Nv),t.resume());return}if(typeof t.pipe=="function"){Tve(t,r,e);return}if(typeof t.getReader=="function"){Eve(t,r,e);return}if(typeof t!="string"&&!Buffer.isBuffer(t))throw new fve(typeof t);if(e[rn]===null){let s=e[Zt]["content-length"];(!s||n.raw.method!=="HEAD"&&Number(s)!==Buffer.byteLength(t))&&(e[Zt]["content-length"]=""+Buffer.byteLength(t))}WR(e,i),r.write(t),$h(t,r,e)}function Cv(e,t,r){t.code==="ERR_STREAM_PREMATURE_CLOSE"?e[A6]||e.info({res:r},"stream closed prematurely"):e.warn({err:t},"response terminated with an error with headers already sent")}function Eve(e,t,r){if(e.locked)throw new hve;let n=!0,i=!1,s=!1,o=e.getReader();if(Rv(t,function(c){n&&(c!=null&&t.headersSent&&!i&&(i=!0,Cv(r.log,c,t)),o.cancel().catch(Nv))}),t.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let c in r[Zt])t.setHeader(c,r[Zt][c]);function a(c){if(c.done){n=!1,$h(null,t,r);return}if(t.destroyed){n=!1,o.cancel().catch(Nv);return}if(t.write(c.value)===!1){s=!0,t.once("drain",u);return}o.read().then(a,l)}function u(){!s||!n||t.destroyed||(s=!1,o.read().then(a,l))}function l(c){n=!1,t.headersSent||r.request.raw.aborted===!0?(i||(i=!0,Cv(r.log,c,r)),t.destroy()):Qc(r,c)}o.read().then(a,l)}function Tve(e,t,r){let n=!0,i=!1;if(Rve(e,t,r),Rv(e,{readable:!0,writable:!1},function(s){n=!1,s!=null&&(t.headersSent||r.request.raw.aborted===!0?(i||(i=!0,Cv(r.log,s,r)),t.destroy()):Qc(r,s))}),Rv(t,function(s){n&&(s!=null&&t.headersSent&&!i&&(i=!0,Cv(r.log,s,t)),typeof e.destroy=="function"?e.destroy():typeof e.close=="function"?e.close(Nv):typeof e.abort=="function"?e.abort():r.log.warn("stream payload does not end properly"))}),t.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let s in r[Zt])t.setHeader(s,r[Zt][s]);e.pipe(t)}function $h(e,t,r){if(r[rn]===null){t.end(null,null,null);return}let n=Object.keys(r[rn]),i={},s=0,o=!0;function a(){s===0&&(t.addTrailers(i),t.end(null,null,null))}for(let u of n){let l=function(d,p){s++,d?r.log.debug(d):i[u]=p,process.nextTick(a)};if(typeof r[rn][u]!="function")continue;o=!1,s--;let c=r[rn][u](r,e,l);typeof c=="object"&&typeof c.then=="function"&&c.then(d=>l(null,d),l)}o&&t.end(null,null,null)}function Rve(e,t,r){r[rn]!==null&&e.on("end",()=>$h(null,t,r))}function Qc(e,t,r){e[mt].onError!==null&&!e[sve]?(e[XR]=!0,D6(e[mt].onError,e.request,e,t,()=>R6(e,t,r))):R6(e,t,r)}function Pve(e){e[Eh]=JR();let t=r=>{e[KR]=JR(),e.raw.removeListener("finish",t),e.raw.removeListener("error",t);let n=e[mt];n&&n.onResponse!==null?ave(n.onResponse,e.request,e,C6):C6(r,e.request,e)};e.raw.on("finish",t),e.raw.on("error",t)}function C6(e,t,r){if(r.log[A6])return;let n=r.elapsedTime;if(e!=null){r.log.error({res:r,err:e,responseTime:n},"request errored");return}r.log.info({res:r,responseTime:n},"request completed")}function Ive(e){let t=e.props.slice();function r(n,i,s){this.raw=n,this[Iv]=!1,this[N6]=!1,this[GR]=!1,this[jo]=null,this.request=i,this[Zt]={},this[rn]=null,this[Eh]=void 0,this[KR]=void 0,this.log=s;let o;for(let a=0;a<t.length;a++)o=t[a],this[o.key]=o.value}return Object.setPrototypeOf(r.prototype,e.prototype),Object.setPrototypeOf(r,e),r.parent=e,r.props=t,r}function Ove(e){if(e[mt][E6]===null){e.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),e.code(404).send("404 Not Found");return}e.request[mt]=e[mt][E6],e[mt].preHandler!==null?uve(e[mt].preHandler,e.request,e,T6.preHandlerCallback):T6.preHandlerCallback(null,e.request,e)}function M6(e,t,r,n){let i=dve(e,r,n);return i?i(t):JSON.stringify(t)}function Nv(){}Av.exports=Vt;Av.exports.buildReply=Ive;Av.exports.setupResponseListeners=Pve});var L6=T((brt,jv)=>{"use strict";function QR(e){if(!e)throw new TypeError("argument req is required");let t=e.headers["x-forwarded-for"],r=e.socket.remoteAddress;if(!t||typeof t!="string")return[r];if(t.indexOf(",")===-1){let n=t.trim();return n.length?[r,n]:[r]}else return Cve(t,r)}function Cve(e,t){let r=[t],n=e.length,i=n,s,o;for(o=n-1;o>=0;--o)s=e[o],s===" "?i===n&&(i=n=o):s===","?(i!==n&&r.push(e.slice(i,n)),i=n=o):i=o;return i!==n&&r.push(e.substring(i,n)),r}jv.exports=QR;jv.exports.default=QR;jv.exports.forwarded=QR});var F6=T((q6,zv)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function u(f,h){if(f.indexOf("::")!==f.lastIndexOf("::"))return null;let v=0,y=-1,_=(f.match(a.zoneIndex)||[])[0],b,g;for(_&&(_=_.substring(1),f=f.replace(/%.+$/,""));(y=f.indexOf(":",y+1))>=0;)v++;if(f.substr(0,2)==="::"&&v--,f.substr(-2,2)==="::"&&v--,v>h)return null;for(g=h-v,b=":";g--;)b+="0:";return f=f.replace("::",b),f[0]===":"&&(f=f.slice(1)),f[f.length-1]===":"&&(f=f.slice(0,-1)),h=(function(){let m=f.split(":"),S=[];for(let w=0;w<m.length;w++)S.push(parseInt(m[w],16));return S})(),{parts:h,zoneId:_}}function l(f,h,v,y){if(f.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let _=0,b;for(;y>0;){if(b=v-y,b<0&&(b=0),f[_]>>b!==h[_]>>b)return!1;y-=v,_+=1}return!0}function c(f){if(i.test(f))return parseInt(f,16);if(f[0]==="0"&&!isNaN(parseInt(f[1],10))){if(n.test(f))return parseInt(f,8);throw new Error(`ipaddr: cannot parse ${f} as octal`)}return parseInt(f,10)}function d(f,h){for(;f.length<h;)f=`0${f}`;return f}let p={};p.IPv4=(function(){function f(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let v,y;for(v=0;v<h.length;v++)if(y=h[v],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return f.prototype.SpecialRanges={unspecified:[[new f([0,0,0,0]),8]],broadcast:[[new f([255,255,255,255]),32]],multicast:[[new f([224,0,0,0]),4]],linkLocal:[[new f([169,254,0,0]),16]],loopback:[[new f([127,0,0,0]),8]],carrierGradeNat:[[new f([100,64,0,0]),10]],private:[[new f([10,0,0,0]),8],[new f([172,16,0,0]),12],[new f([192,168,0,0]),16]],reserved:[[new f([192,0,0,0]),24],[new f([192,0,2,0]),24],[new f([192,88,99,0]),24],[new f([198,18,0,0]),15],[new f([198,51,100,0]),24],[new f([203,0,113,0]),24],[new f([240,0,0,0]),4]],as112:[[new f([192,175,48,0]),24],[new f([192,31,196,0]),24]],amt:[[new f([192,52,193,0]),24]]},f.prototype.kind=function(){return"ipv4"},f.prototype.match=function(h,v){let y;if(v===void 0&&(y=h,h=y[0],v=y[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,h.octets,8,v)},f.prototype.prefixLengthFromSubnetMask=function(){let h=0,v=!1,y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},_,b,g;for(_=3;_>=0;_-=1)if(b=this.octets[_],b in y){if(g=y[b],v&&g!==0)return null;g!==8&&(v=!0),h+=g}else return null;return 32-h},f.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){return this.octets.slice(0)},f.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},f.prototype.toNormalizedString=function(){return this.toString()},f.prototype.toString=function(){return this.octets.join(".")},f})(),p.IPv4.broadcastAddressFromCIDR=function(f){try{let h=this.parseCIDR(f),v=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],b=0;for(;b<4;)_.push(parseInt(v[b],10)|parseInt(y[b],10)^255),b++;return new this(_)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(f){return this.parser(f)!==null},p.IPv4.isValid=function(f){try{return new this(this.parser(f)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(f){try{return this.parseCIDR(f),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(f){return!!(p.IPv4.isValid(f)&&f.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(f){let h=f.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(f)||!h?!1:p.IPv4.isValidFourPartDecimal(h[1])},p.IPv4.networkAddressFromCIDR=function(f){let h,v,y,_,b;try{for(h=this.parseCIDR(f),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],v=0;v<4;)_.push(parseInt(y[v],10)&parseInt(b[v],10)),v++;return new this(_)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(f){let h=this.parser(f);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},p.IPv4.parseCIDR=function(f){let h;if(h=f.match(/^(.+)\/(\d+)$/)){let v=parseInt(h[2]);if(v>=0&&v<=32){let y=[this.parse(h[1]),v];return Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(f){let h,v,y;if(h=f.match(r.fourOctet))return(function(){let _=h.slice(1,6),b=[];for(let g=0;g<_.length;g++)v=_[g],b.push(c(v));return b})();if(h=f.match(r.longValue)){if(y=c(h[1]),y>4294967295||y<0)throw new Error("ipaddr: address outside defined range");return(function(){let _=[],b;for(b=0;b<=24;b+=8)_.push(y>>b&255);return _})().reverse()}else return(h=f.match(r.twoOctet))?(function(){let _=h.slice(1,4),b=[];if(y=c(_[1]),y>16777215||y<0)throw new Error("ipaddr: address outside defined range");return b.push(c(_[0])),b.push(y>>16&255),b.push(y>>8&255),b.push(y&255),b})():(h=f.match(r.threeOctet))?(function(){let _=h.slice(1,5),b=[];if(y=c(_[2]),y>65535||y<0)throw new Error("ipaddr: address outside defined range");return b.push(c(_[0])),b.push(c(_[1])),b.push(y>>8&255),b.push(y&255),b})():null},p.IPv4.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],v=0,y=Math.floor(f/8);for(;v<y;)h[v]=255,v++;return y<4&&(h[y]=Math.pow(2,f%8)-1<<8-f%8),new this(h)},p.IPv6=(function(){function f(h,v){let y,_;if(h.length===16)for(this.parts=[],y=0;y<=14;y+=2)this.parts.push(h[y]<<8|h[y+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=0;y<this.parts.length;y++)if(_=this.parts[y],!(0<=_&&_<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");v&&(this.zoneId=v)}return f.prototype.SpecialRanges={unspecified:[new f([0,0,0,0,0,0,0,0]),128],linkLocal:[new f([65152,0,0,0,0,0,0,0]),10],multicast:[new f([65280,0,0,0,0,0,0,0]),8],loopback:[new f([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new f([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new f([0,0,0,0,0,65535,0,0]),96],discard:[new f([256,0,0,0,0,0,0,0]),64],rfc6145:[new f([0,0,0,0,65535,0,0,0]),96],rfc6052:[new f([100,65435,0,0,0,0,0,0]),96],"6to4":[new f([8194,0,0,0,0,0,0,0]),16],teredo:[new f([8193,0,0,0,0,0,0,0]),32],benchmarking:[new f([8193,2,0,0,0,0,0,0]),48],amt:[new f([8193,3,0,0,0,0,0,0]),32],as112v6:[[new f([8193,4,274,0,0,0,0,0]),48],[new f([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new f([8193,16,0,0,0,0,0,0]),28],orchid2:[new f([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new f([8193,48,0,0,0,0,0,0]),28],reserved:[[new f([8193,0,0,0,0,0,0,0]),23],[new f([8193,3512,0,0,0,0,0,0]),32]]},f.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},f.prototype.kind=function(){return"ipv6"},f.prototype.match=function(h,v){let y;if(v===void 0&&(y=h,h=y[0],v=y[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,h.parts,16,v)},f.prototype.prefixLengthFromSubnetMask=function(){let h=0,v=!1,y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},_,b;for(let g=7;g>=0;g-=1)if(_=this.parts[g],_ in y){if(b=y[_],v&&b!==0)return null;b!==16&&(v=!0),h+=b}else return null;return 128-h},f.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){let h,v=[],y=this.parts;for(let _=0;_<y.length;_++)h=y[_],v.push(h>>8),v.push(h&255);return v},f.prototype.toFixedLengthString=function(){let h=(function(){let y=[];for(let _=0;_<this.parts.length;_++)y.push(d(this.parts[_].toString(16),4));return y}).call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),h+v},f.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),v=h[0],y=h[1];return new p.IPv4([v>>8,v&255,y>>8,y&255])},f.prototype.toNormalizedString=function(){let h=(function(){let y=[];for(let _=0;_<this.parts.length;_++)y.push(this.parts[_].toString(16));return y}).call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),h+v},f.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),y=0,_=-1,b;for(;b=h.exec(v);)b[0].length>_&&(y=b.index,_=b[0].length);return _<0?v:`${v.substring(0,y)}::${v.substring(y+_)}`},f.prototype.toString=function(){return this.toRFC5952String()},f})(),p.IPv6.broadcastAddressFromCIDR=function(f){try{let h=this.parseCIDR(f),v=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],b=0;for(;b<16;)_.push(parseInt(v[b],10)|parseInt(y[b],10)^255),b++;return new this(_)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},p.IPv6.isIPv6=function(f){return this.parser(f)!==null},p.IPv6.isValid=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{let h=this.parser(f);return new this(h.parts,h.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{return this.parseCIDR(f),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(f){let h,v,y,_,b;try{for(h=this.parseCIDR(f),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),_=[],v=0;v<16;)_.push(parseInt(y[v],10)&parseInt(b[v],10)),v++;return new this(_)}catch(g){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${g})`)}},p.IPv6.parse=function(f){let h=this.parser(f);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},p.IPv6.parseCIDR=function(f){let h,v,y;if((v=f.match(/^(.+)\/(\d+)$/))&&(h=parseInt(v[2]),h>=0&&h<=128))return y=[this.parse(v[1]),h],Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(f){let h,v,y,_,b,g;if(y=f.match(a.deprecatedTransitional))return this.parser(`::ffff:${y[1]}`);if(a.native.test(f))return u(f,8);if((y=f.match(a.transitional))&&(g=y[6]||"",h=y[1],y[1].endsWith("::")||(h=h.slice(0,-1)),h=u(h+g,6),h.parts)){for(b=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],v=0;v<b.length;v++)if(_=b[v],!(0<=_&&_<=255))return null;return h.parts.push(b[0]<<8|b[1]),h.parts.push(b[2]<<8|b[3]),{parts:h.parts,zoneId:h.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v=0,y=Math.floor(f/8);for(;v<y;)h[v]=255,v++;return y<16&&(h[y]=Math.pow(2,f%8)-1<<8-f%8),new this(h)},p.fromByteArray=function(f){let h=f.length;if(h===4)return new p.IPv4(f);if(h===16)return new p.IPv6(f);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(f){return p.IPv6.isValid(f)||p.IPv4.isValid(f)},p.isValidCIDR=function(f){return p.IPv6.isValidCIDR(f)||p.IPv4.isValidCIDR(f)},p.parse=function(f){if(p.IPv6.isValid(f))return p.IPv6.parse(f);if(p.IPv4.isValid(f))return p.IPv4.parse(f);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(f){try{return p.IPv6.parseCIDR(f)}catch{try{return p.IPv4.parseCIDR(f)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(f){let h=this.parse(f);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},p.subnetMatch=function(f,h,v){let y,_,b,g;v==null&&(v="unicast");for(_ in h)if(Object.prototype.hasOwnProperty.call(h,_)){for(b=h[_],b[0]&&!(b[0]instanceof Array)&&(b=[b]),y=0;y<b.length;y++)if(g=b[y],f.kind()===g[0].kind()&&f.match.apply(f,g))return _}return v},typeof zv<"u"&&zv.exports?zv.exports=p:e.ipaddr=p})(q6)});var B6=T((wrt,ed)=>{"use strict";ed.exports=eP;ed.exports.default=eP;ed.exports.proxyaddr=eP;ed.exports.all=V6;ed.exports.compile=H6;var Nve=L6(),Z6=F6(),Ave=/^\d+$/u,Mv=Z6.isValid,Lv=Z6.parse,U6={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function V6(e,t){let r=Nve(e);if(!t)return r;typeof t!="function"&&(t=H6(t));for(let n=0;n<r.length-1;n++)t(r[n],n)||(r.length=n+1);return r}function H6(e){if(!e)throw new TypeError("argument is required");let t;if(typeof e=="string")t=[e];else if(Array.isArray(e))t=e.slice();else throw new TypeError("unsupported trust argument");for(let r=0;r<t.length;r++)e=t[r],Object.hasOwn(U6,e)&&(e=U6[e],t.splice.apply(t,[r,1].concat(e)),r+=e.length-1);return jve(Dve(t))}function Dve(e){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=zve(e[r]);return t}function jve(e){let t=e.length;return t===0?Lve:t===1?Fve(e[0]):qve(e)}function zve(e){let t=e.lastIndexOf("/"),r=t!==-1?e.substring(0,t):e;if(!Mv(r))throw new TypeError("invalid IP address: "+r);let n=Lv(r);t===-1&&n.kind()==="ipv6"&&n.isIPv4MappedAddress()&&(n=n.toIPv4Address());let i=n.kind()==="ipv6"?128:32,s=t!==-1?e.substring(t+1,e.length):null;if(s===null?s=i:Ave.test(s)?s=parseInt(s,10):n.kind()==="ipv4"&&Mv(s)?s=Mve(s):s=null,s<=0||s>i)throw new TypeError("invalid range on address: "+e);return[n,s]}function Mve(e){let t=Lv(e);return t.kind()==="ipv4"?t.prefixLengthFromSubnetMask():null}function eP(e,t){if(!e)throw new TypeError("req argument is required");if(!t)throw new TypeError("trust argument is required");let r=V6(e,t);return r[r.length-1]}function Lve(){return!1}function qve(e){return function(r){if(!Mv(r))return!1;let n=Lv(r),i,s=n.kind();for(let o=0;o<e.length;o++){let a=e[o],u=a[0],l=u.kind(),c=a[1],d=n;if(s!==l){let p=l==="ipv4";if(p&&!n.isIPv4MappedAddress())continue;i||(i=p?n.toIPv4Address():n.toIPv4MappedAddress()),d=i}if(d.match(u,c))return!0}return!1}}function Fve(e){let t=e[0],r=t.kind(),n=r==="ipv4",i=e[1];return function(o){if(!Mv(o))return!1;let a=Lv(o);if(a.kind()!==r){if(n&&!a.isIPv4MappedAddress())return!1;a=n?a.toIPv4Address():a.toIPv4MappedAddress()}return a.match(t,i)}}});var Fv=T((Srt,iP)=>{"use strict";var qv=B6(),{kHasBeenDecorated:Uve,kSchemaBody:Zve,kSchemaHeaders:Vve,kSchemaParams:Hve,kSchemaQuerystring:W6,kSchemaController:tP,kOptions:Bve,kRequestCacheValidateFns:La,kRouteContext:On,kRequestOriginalUrl:rP}=Hr(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:Wve,FST_ERR_DEC_UNDECLARED:Jve}=tn(),J6=xh(),G6={body:Zve,headers:Vve,params:Hve,querystring:W6,query:W6};function nP(e,t,r,n,i,s){this.id=e,this[On]=s,this.params=t,this.raw=r,this.query=n,this.log=i,this.body=void 0}nP.props=[];function Gve(e){if(typeof e=="function")return e;if(e===!0)return null;if(typeof e=="number")return function(t,r){return r<e};if(typeof e=="string"){let t=e.split(",").map(r=>r.trim());return qv.compile(t)}return qv.compile(e)}function Kve(e,t){return t?Yve(e,t):X6(e)}function X6(e){let t=e.props.slice();function r(n,i,s,o,a,u){this.id=n,this[On]=u,this.params=i,this.raw=s,this.query=o,this.log=a,this.body=void 0;let l;for(let c=0;c<t.length;c++)l=t[c],this[l.key]=l.value}return Object.setPrototypeOf(r.prototype,e.prototype),Object.setPrototypeOf(r,e),r.props=t,r.parent=e,r}function K6(e){let t=e.lastIndexOf(",");return t===-1?e.trim():e.slice(t+1).trim()}function Yve(e,t){let r=X6(e),n=Gve(t);return r[Uve]=!0,Object.defineProperties(r.prototype,{ip:{get(){let i=qv.all(this.raw,n);return i[i.length-1]}},ips:{get(){return qv.all(this.raw,n)}},host:{get(){return this.ip!==void 0&&this.headers["x-forwarded-host"]?K6(this.headers["x-forwarded-host"]):this.headers.host??this.headers[":authority"]??""}},protocol:{get(){if(this.headers["x-forwarded-proto"])return K6(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),r}function Y6(e,t){if(!J6.hasKey(e,t)&&!J6.exist(e,t))throw new Jve(t,"request")}Object.defineProperties(nP.prototype,{server:{get(){return this[On].server}},url:{get(){return this.raw.url}},originalUrl:{get(){return this[rP]||(this[rP]=this.raw.originalUrl||this.raw.url),this[rP]}},method:{get(){return this.raw.method}},routeOptions:{get(){let e=this[On],t=e._parserOptions.limit,r=e.server.initialConfig.bodyLimit,n=e.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:e.config?.method,url:e.config?.url,bodyLimit:t||r,attachValidation:e.attachValidation,logLevel:e.logLevel,exposeHeadRoute:e.exposeHeadRoute,prefixTrailingSlash:e.prefixTrailingSlash,handler:e.handler,config:e.config,schema:e.schema,version:n}}},is404:{get(){return this[On].config?.url===void 0}},socket:{get(){return this.raw.socket}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){return this.host[0]==="["?this.host.slice(0,this.host.indexOf("]")+1):this.host.split(":",1)[0]}},port:{get(){let e=parseInt(this.host.split(":").slice(-1)[0]);if(!isNaN(e))return e;let t=this.headers.host??this.headers[":authority"]??"",r=parseInt(t.split(":").slice(-1)[0]);return isNaN(r)?null:r}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){return this.additionalHeaders?Object.assign({},this.raw.headers,this.additionalHeaders):this.raw.headers},set(e){this.additionalHeaders=e}},getValidationFunction:{value:function(e){if(typeof e=="string"){let t=G6[e];return this[On][t]}else if(typeof e=="object")return this[On][La]?.get(e)}},compileValidationSchema:{value:function(e,t=null){let{method:r,url:n}=this;if(this[On][La]?.has(e))return this[On][La].get(e);let s=(this[On].validatorCompiler||this.server[tP].validatorCompiler||this.server[tP].setupValidator(this.server[Bve])||this.server[tP].validatorCompiler)({schema:e,method:r,url:n,httpPart:t});return this[On][La]==null&&(this[On][La]=new WeakMap),this[On][La].set(e,s),s}},validateInput:{value:function(e,t,r){r=typeof t=="string"?t:r;let n=r!=null&&typeof r=="string"&&G6[r],i;if(n&&(i=this[On][n]),i==null&&(t==null||typeof t!="object"||Array.isArray(t)))throw new Wve(r);return i==null&&(this[On][La]?.has(t)?i=this[On][La].get(t):i=this.compileValidationSchema(t,r)),i(e)}},getDecorator:{value:function(e){Y6(this,e);let t=this[e];return typeof t=="function"?t.bind(this):t}},setDecorator:{value:function(e,t){Y6(this,e),this[e]=t}}});iP.exports=nP;iP.exports.buildRequest=Kve});var Uv=T((krt,Q6)=>{"use strict";var{kFourOhFourContext:Xve,kReplySerializerDefault:Qve,kSchemaErrorFormatter:ebe,kErrorHandler:tbe,kChildLoggerFactory:rbe,kOptions:nbe,kReply:ibe,kRequest:sbe,kBodyLimit:obe,kLogLevel:abe,kContentTypeParser:ube,kRouteByFastify:lbe,kRequestCacheValidateFns:cbe,kReplyCacheSerializeFns:dbe}=Hr();function fbe({schema:e,handler:t,config:r,requestIdLogLabel:n,childLoggerFactory:i,errorHandler:s,bodyLimit:o,logLevel:a,logSerializers:u,attachValidation:l,validatorCompiler:c,serializerCompiler:d,replySerializer:p,schemaErrorFormatter:f,exposeHeadRoute:h,prefixTrailingSlash:v,server:y,isFastify:_}){this.schema=e,this.handler=t,this.Reply=y[ibe],this.Request=y[sbe],this.contentTypeParser=y[ube],this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.preSerialization=null,this.onRequestAbort=null,this.config=r,this.errorHandler=s||y[tbe],this.requestIdLogLabel=n||y[nbe].requestIdLogLabel,this.childLoggerFactory=i||y[rbe],this._middie=null,this._parserOptions={limit:o||y[obe]},this.exposeHeadRoute=h,this.prefixTrailingSlash=v,this.logLevel=a||y[abe],this.logSerializers=u,this[Xve]=null,this.attachValidation=l,this[Qve]=p,this.schemaErrorFormatter=f||y[ebe]||pbe,this[lbe]=_,this[cbe]=null,this[dbe]=null,this.validatorCompiler=c||null,this.serializerCompiler=d||null,this.server=y}function pbe(e,t){let r="";for(let i=0;i!==e.length;++i){let s=e[i];r+=t+(s.instancePath||"")+" "+s.message+", "}return new Error(r.slice(0,-2))}Q6.exports=fbe});var tZ=T(oo=>{"use strict";var sP=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=t,this.ttl=r}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete(t){if(this.items.has(t)){let r=this.items.get(t);this.items.delete(t),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;this.items.delete(t.key),this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(this.items.has(t))return this.items.get(t).expiry}get(t){if(this.items.has(t)){let r=this.items.get(t);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return this.items.keys()}set(t,r){if(this.items.has(t)){let i=this.items.get(t);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items.set(t,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},oP=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=t,this.ttl=r}get size(){return this.items.size}bumpLru(t){if(this.last===t)return;let r=this.last,n=t.next,i=t.prev;this.first===t&&(this.first=n),t.next=null,t.prev=r,r.next=t,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=t}clear(){this.items=new Map,this.first=null,this.last=null}delete(t){if(this.items.has(t)){let r=this.items.get(t);this.items.delete(t),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;this.items.delete(t.key),this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(this.items.has(t))return this.items.get(t).expiry}get(t){if(this.items.has(t)){let r=this.items.get(t);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return this.bumpLru(r),r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return this.items.keys()}set(t,r){if(this.items.has(t)){let i=this.items.get(t);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items.set(t,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},Th=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=t,this.ttl=r}bumpLru(t){if(this.last===t)return;let r=this.last,n=t.next,i=t.prev;this.first===t&&(this.first=n),t.next=null,t.prev=r,r.next=t,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=t}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];delete this.items[t],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;delete this.items[t.key],--this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(Object.prototype.hasOwnProperty.call(this.items,t))return this.items[t].expiry}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return this.bumpLru(r),r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return Object.keys(this.items)}set(t,r){if(Object.prototype.hasOwnProperty.call(this.items,t)){let i=this.items[t];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items[t]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}},Zv=class{constructor(){this.records={}}initForCache(t,r){this.records[t]={[r]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(t){for(let r of Object.keys(this.records[t]))this.records[t][r]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}getStatistics(){return this.records}};function eZ(e){return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`}var aP=class{constructor(t,r,n){this.cacheId=t,this.statisticTtlInHours=r,this.collectionStart=new Date,this.currentTimeStamp=eZ(this.collectionStart),this.records=n||new Zv,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){return this.records.records[this.cacheId][this.currentTimeStamp]||(this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}),this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded(),this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded(),this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded(),this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded(),this.currentRecord.misses++}addEviction(){this.archiveIfNeeded(),this.currentRecord.evictions++}setCacheSize(t){this.archiveIfNeeded(),this.currentRecord.cacheSize=t}addExpiration(){this.archiveIfNeeded(),this.currentRecord.expirations++}addSet(){this.archiveIfNeeded(),this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded(),this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded(),this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){this.hoursPassed()>=this.statisticTtlInHours&&(this.collectionStart=new Date,this.currentTimeStamp=eZ(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp))}},Vv=class extends Th{constructor(t,r,n,i,s){if(super(t||1e3,r||0),!n)throw new Error("Cache id is mandatory");this.hitStatistics=new aP(n,s!==void 0?s:24,i)}getStatistics(){return this.hitStatistics.getStatistics()}set(t,r){super.set(t,r),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete(t,r=!1){super.delete(t),r||this.hitStatistics.addInvalidateOne(),this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t,!0),this.hitStatistics.addExpiration();return}return this.bumpLru(r),r.value||this.hitStatistics.addFalsyHit(),(r.value===void 0||r.value===null||r.value==="")&&this.hitStatistics.addEmptyHit(),this.hitStatistics.addHit(),r.value}this.hitStatistics.addMiss()}},Hv=class{constructor(t=1e3,r=0){if(isNaN(t)||t<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=t,this.ttl=r}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];delete this.items[t],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(t){for(var r=0;r<t.length;r++)this.delete(t[r])}evict(){if(this.size>0){let t=this.first;delete this.items[t.key],--this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}}expiresAt(t){if(Object.prototype.hasOwnProperty.call(this.items,t))return this.items[t].expiry}get(t){if(Object.prototype.hasOwnProperty.call(this.items,t)){let r=this.items[t];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(t);return}return r.value}}getMany(t){let r=[];for(var n=0;n<t.length;n++)r.push(this.get(t[n]));return r}keys(){return Object.keys(this.items)}set(t,r){if(Object.prototype.hasOwnProperty.call(this.items,t)){let i=this.items[t];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:r};this.items[t]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}};oo.Fifo=Hv;oo.FifoMap=sP;oo.FifoObject=Hv;oo.HitStatisticsRecord=Zv;oo.Lru=Th;oo.LruHitStatistics=Vv;oo.LruMap=oP;oo.LruObject=Th;oo.LruObjectHitStatistics=Vv});var oZ=T(($rt,td)=>{"use strict";var hbe=typeof Buffer<"u",rZ=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,nZ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function iZ(e,t,r){r==null&&t!==null&&typeof t=="object"&&(r=t,t=void 0),hbe&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let n=JSON.parse(e,t);if(n===null||typeof n!="object")return n;let i=r&&r.protoAction||"error",s=r&&r.constructorAction||"error";if(i==="ignore"&&s==="ignore")return n;if(i!=="ignore"&&s!=="ignore"){if(rZ.test(e)===!1&&nZ.test(e)===!1)return n}else if(i!=="ignore"&&s==="ignore"){if(rZ.test(e)===!1)return n}else if(nZ.test(e)===!1)return n;return sZ(n,{protoAction:i,constructorAction:s,safe:r&&r.safe})}function sZ(e,{protoAction:t="error",constructorAction:r="error",safe:n}={}){let i=[e];for(;i.length;){let s=i;i=[];for(let o of s){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(n===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(r!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(n===!0)return null;if(r==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(let a in o){let u=o[a];u&&typeof u=="object"&&i.push(u)}}}return e}function uP(e,t,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return iZ(e,t,r)}finally{Error.stackTraceLimit=n}}function mbe(e,t){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return iZ(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}}td.exports=uP;td.exports.default=uP;td.exports.parse=uP;td.exports.safeParse=mbe;td.exports.scan=sZ});var pP=T((Ert,Ih)=>{"use strict";var{AsyncResource:gbe}=ie("node:async_hooks"),{FifoMap:lZ}=tZ(),{parse:ybe}=oZ(),Ph=MT(),{kDefaultJsonParse:Rh,kContentTypeParser:rd,kBodyLimit:_be,kRequestPayloadStream:cZ,kState:cP,kTestInternals:vbe,kReplyIsError:aZ,kRouteContext:bbe}=Hr(),{FST_ERR_CTP_INVALID_TYPE:Bv,FST_ERR_CTP_EMPTY_TYPE:wbe,FST_ERR_CTP_ALREADY_PRESENT:Sbe,FST_ERR_CTP_INVALID_HANDLER:kbe,FST_ERR_CTP_INVALID_PARSE_TYPE:xbe,FST_ERR_CTP_BODY_TOO_LARGE:uZ,FST_ERR_CTP_INVALID_MEDIA_TYPE:$be,FST_ERR_CTP_INVALID_CONTENT_LENGTH:Ebe,FST_ERR_CTP_EMPTY_JSON_BODY:Tbe,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:dP,FST_ERR_CTP_INVALID_JSON_BODY:Rbe}=tn(),{FSTSEC001:Pbe}=Hc();function zo(e,t,r){this[Rh]=fZ(t,r),this.customParsers=new Map,this.customParsers.set("application/json",new lP(!0,!1,e,this[Rh])),this.customParsers.set("text/plain",new lP(!0,!1,e,fP)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new lZ(100)}zo.prototype.add=function(e,t,r){let n=typeof e=="string";if(n){if(e=e.trim().toLowerCase(),e.length===0)throw new wbe}else if(!(e instanceof RegExp))throw new Bv;if(typeof r!="function")throw new kbe;if(this.existingParser(e))throw new Sbe(e);if(t.parseAs!==void 0&&t.parseAs!=="string"&&t.parseAs!=="buffer")throw new xbe(t.parseAs);let i=new lP(t.parseAs==="string",t.parseAs==="buffer",t.bodyLimit,r);if(e==="*")this.customParsers.set("",i);else if(n){let s=new Ph(e);if(s.isValid===!1)throw new Bv;let o=s.toString();this.parserList.unshift(o),this.customParsers.set(o,i)}else Dbe(e),this.parserRegExpList.unshift(e),this.customParsers.set(e.toString(),i)};zo.prototype.hasParser=function(e){if(typeof e=="string")e=new Ph(e).toString();else{if(!(e instanceof RegExp))throw new Bv;e=e.toString()}return this.customParsers.has(e)};zo.prototype.existingParser=function(e){if(typeof e=="string"){let t=new Ph(e).toString();if(e==="application/json"&&this.customParsers.has(e))return this.customParsers.get(t).fn!==this[Rh];if(e==="text/plain"&&this.customParsers.has(e))return this.customParsers.get(t).fn!==fP}return this.hasParser(e)};zo.prototype.getParser=function(e){typeof e=="string"&&(e=new Ph(e));let t=e.toString(),r=this.cache.get(t);if(r!==void 0)return r;if(r=this.customParsers.get(t),r!==void 0)return this.cache.set(t,r),r;if(r=this.customParsers.get(e.mediaType),r!==void 0)return r;for(let n=0;n!==this.parserRegExpList.length;++n){let i=this.parserRegExpList[n];if(i.test(t))return r=this.customParsers.get(i.toString()),this.cache.set(t,r),r}return this.customParsers.get("")};zo.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new lZ(100)};zo.prototype.remove=function(e){let t;if(typeof e=="string")e=new Ph(e).toString(),t=this.parserList;else{if(!(e instanceof RegExp))throw new Bv;e=e.toString(),t=this.parserRegExpList}let r=this.customParsers.delete(e),n=t.findIndex(i=>i.toString()===e);return n>-1&&t.splice(n,1),r||n>-1};zo.prototype.run=function(e,t,r,n){let i=this.getParser(e);if(i===void 0){if(r.is404===!0){t(r,n);return}n[aZ]=!0,n.send(new $be(e||void 0));return}let s=new gbe("content-type-parser:run",r),o=s.bind(u);if(i.asString===!0||i.asBuffer===!0){dZ(r,n,n[bbe]._parserOptions,i,o);return}let a=i.fn(r,r[cZ],o);a&&typeof a.then=="function"&&a.then(l=>{o(null,l)},o);function u(l,c){if(s.emitDestroy(),l!=null){n.header("connection","close"),n[aZ]=!0,n.send(l);return}r.body=c,t(r,n)}};function dZ(e,t,r,n,i){let s=n.asString===!0,o=r.limit===null?n.bodyLimit:r.limit,a=Number(e.headers["content-length"]);if(a>o){i(new uZ,void 0);return}let u=0,l=s?"":[],c=e[cZ]||e.raw;s&&c.setEncoding("utf8"),c.on("data",d),c.on("end",p),c.on("error",p),c.resume();function d(f){u+=s?Buffer.byteLength(f):f.length;let{receivedEncodedLength:h=0}=c;if(u>o||h>o){c.removeListener("data",d),c.removeListener("end",p),c.removeListener("error",p),i(new uZ,void 0);return}s?l+=f:l.push(f)}function p(f){if(c.removeListener("data",d),c.removeListener("end",p),c.removeListener("error",p),f!=null){typeof f.statusCode=="number"&&f.statusCode>=400||(f.statusCode=400),i(f,void 0);return}if(!Number.isNaN(a)&&(c.receivedEncodedLength||u)!==a){i(new Ebe,void 0);return}s||(l=Buffer.concat(l));let h=n.fn(e,l,i);h&&typeof h.then=="function"&&h.then(v=>{i(null,v)},i)}}function fZ(e,t){let r={protoAction:e,constructorAction:t};return n;function n(i,s,o){if(s.length===0){o(new Tbe,void 0);return}try{o(null,ybe(s,r))}catch{o(new Rbe,void 0)}}}function fP(e,t,r){r(null,t)}function lP(e,t,r,n){this.asString=e,this.asBuffer=t,this.bodyLimit=r,this.fn=n}function Ibe(e){let t=new zo;return t[Rh]=e[Rh],t.customParsers=new Map(e.customParsers.entries()),t.parserList=e.parserList.slice(),t.parserRegExpList=e.parserRegExpList.slice(),t}function Obe(e,t,r){if(this[cP].started)throw new dP("addContentTypeParser");return typeof t=="function"&&(r=t,t={}),t||(t={}),t.bodyLimit||(t.bodyLimit=this[_be]),Array.isArray(e)?e.forEach(n=>this[rd].add(n,t,r)):this[rd].add(e,t,r),this}function Cbe(e){return this[rd].hasParser(e)}function Nbe(e){if(this[cP].started)throw new dP("removeContentTypeParser");if(Array.isArray(e))for(let t of e)this[rd].remove(t);else this[rd].remove(e)}function Abe(){if(this[cP].started)throw new dP("removeAllContentTypeParsers");this[rd].removeAll()}function Dbe(e){e.source[0]!=="^"&&e.source.includes(";?")===!1&&Pbe(e.source)}Ih.exports=zo;Ih.exports.helpers={buildContentTypeParser:Ibe,addContentTypeParser:Obe,hasContentTypeParser:Cbe,removeContentTypeParser:Nbe,removeAllContentTypeParsers:Abe};Ih.exports.defaultParsers={getDefaultJsonParser:fZ,defaultTextParser:fP};Ih.exports[vbe]={rawBody:dZ}});var nd=T(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.regexpCode=Rt.getEsmExportName=Rt.getProperty=Rt.safeStringify=Rt.stringify=Rt.strConcat=Rt.addCodeArg=Rt.str=Rt._=Rt.nil=Rt._Code=Rt.Name=Rt.IDENTIFIER=Rt._CodeOrName=void 0;var Oh=class{};Rt._CodeOrName=Oh;Rt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pl=class extends Oh{constructor(t){if(super(),!Rt.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Rt.Name=pl;var Gi=class extends Oh{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof pl&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Rt._Code=Gi;Rt.nil=new Gi("");function pZ(e,...t){let r=[e[0]],n=0;for(;n<t.length;)mP(r,t[n]),r.push(e[++n]);return new Gi(r)}Rt._=pZ;var hP=new Gi("+");function hZ(e,...t){let r=[Ch(e[0])],n=0;for(;n<t.length;)r.push(hP),mP(r,t[n]),r.push(hP,Ch(e[++n]));return jbe(r),new Gi(r)}Rt.str=hZ;function mP(e,t){t instanceof Gi?e.push(...t._items):t instanceof pl?e.push(t):e.push(Lbe(t))}Rt.addCodeArg=mP;function jbe(e){let t=1;for(;t<e.length-1;){if(e[t]===hP){let r=zbe(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function zbe(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof pl||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof pl))return`"${e}${t.slice(1)}`}function Mbe(e,t){return t.emptyStr()?e:e.emptyStr()?t:hZ`${e}${t}`}Rt.strConcat=Mbe;function Lbe(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ch(Array.isArray(e)?e.join(","):e)}function qbe(e){return new Gi(Ch(e))}Rt.stringify=qbe;function Ch(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Rt.safeStringify=Ch;function Fbe(e){return typeof e=="string"&&Rt.IDENTIFIER.test(e)?new Gi(`.${e}`):pZ`[${e}]`}Rt.getProperty=Fbe;function Ube(e){if(typeof e=="string"&&Rt.IDENTIFIER.test(e))return new Gi(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Rt.getEsmExportName=Ube;function Zbe(e){return new Gi(e.toString())}Rt.regexpCode=Zbe});var Kv=T(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ValueScope=di.ValueScopeName=di.Scope=di.varKinds=di.UsedValueState=void 0;var ci=nd(),gP=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Wv;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Wv||(di.UsedValueState=Wv={}));di.varKinds={const:new ci.Name("const"),let:new ci.Name("let"),var:new ci.Name("var")};var Jv=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ci.Name?t:this.name(t)}name(t){return new ci.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};di.Scope=Jv;var Gv=class extends ci.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ci._)`.${new ci.Name(r)}[${n}]`}};di.ValueScopeName=Gv;var Vbe=(0,ci._)`\n`,yP=class extends Jv{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Vbe:ci.nil}}get(){return this._scope}name(t){return new Gv(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let c=a.get(o);if(c)return c}else a=this._values[s]=new Map;a.set(o,i);let u=this._scope[s]||(this._scope[s]=[]),l=u.length;return u[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ci._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let s=ci.nil;for(let o in t){let a=t[o];if(!a)continue;let u=n[o]=n[o]||new Map;a.forEach(l=>{if(u.has(l))return;u.set(l,Wv.Started);let c=r(l);if(c){let d=this.opts.es5?di.varKinds.var:di.varKinds.const;s=(0,ci._)`${s}${d} ${l} = ${c};${this.opts._n}`}else if(c=i?.(l))s=(0,ci._)`${s}${c}${this.opts._n}`;else throw new gP(l);u.set(l,Wv.Completed)})}return s}};di.ValueScope=yP});var qe=T(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.or=at.and=at.not=at.CodeGen=at.operators=at.varKinds=at.ValueScopeName=at.ValueScope=at.Scope=at.Name=at.regexpCode=at.stringify=at.getProperty=at.nil=at.strConcat=at.str=at._=void 0;var wt=nd(),Cs=Kv(),qa=nd();Object.defineProperty(at,"_",{enumerable:!0,get:function(){return qa._}});Object.defineProperty(at,"str",{enumerable:!0,get:function(){return qa.str}});Object.defineProperty(at,"strConcat",{enumerable:!0,get:function(){return qa.strConcat}});Object.defineProperty(at,"nil",{enumerable:!0,get:function(){return qa.nil}});Object.defineProperty(at,"getProperty",{enumerable:!0,get:function(){return qa.getProperty}});Object.defineProperty(at,"stringify",{enumerable:!0,get:function(){return qa.stringify}});Object.defineProperty(at,"regexpCode",{enumerable:!0,get:function(){return qa.regexpCode}});Object.defineProperty(at,"Name",{enumerable:!0,get:function(){return qa.Name}});var eb=Kv();Object.defineProperty(at,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(at,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(at,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(at,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});at.operators={GT:new wt._Code(">"),GTE:new wt._Code(">="),LT:new wt._Code("<"),LTE:new wt._Code("<="),EQ:new wt._Code("==="),NEQ:new wt._Code("!=="),NOT:new wt._Code("!"),OR:new wt._Code("||"),AND:new wt._Code("&&"),ADD:new wt._Code("+")};var Mo=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},_P=class extends Mo{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Cs.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=sd(this.rhs,t,r)),this}get names(){return this.rhs instanceof wt._CodeOrName?this.rhs.names:{}}},Yv=class extends Mo{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof wt.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sd(this.rhs,t,r),this}get names(){let t=this.lhs instanceof wt.Name?{}:{...this.lhs.names};return Qv(t,this.rhs)}},vP=class extends Yv{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bP=class extends Mo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},wP=class extends Mo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},SP=class extends Mo{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},kP=class extends Mo{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=sd(this.code,t,r),this}get names(){return this.code instanceof wt._CodeOrName?this.code.names:{}}},Nh=class extends Mo{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(t,r)||(Hbe(t,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>gl(t,r.names),{})}},Lo=class extends Nh{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},xP=class extends Nh{},id=class extends Lo{};id.kind="else";var hl=class e extends Lo{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new id(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(mZ(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=sd(this.condition,t,r),this}get names(){let t=super.names;return Qv(t,this.condition),this.else&&gl(t,this.else.names),t}};hl.kind="if";var ml=class extends Lo{};ml.kind="for";var $P=class extends ml{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=sd(this.iteration,t,r),this}get names(){return gl(super.names,this.iteration.names)}},EP=class extends ml{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?Cs.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=Qv(super.names,this.from);return Qv(t,this.to)}},Xv=class extends ml{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=sd(this.iterable,t,r),this}get names(){return gl(super.names,this.iterable.names)}},Ah=class extends Lo{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Ah.kind="func";var Dh=class extends Nh{render(t){return"return "+super.render(t)}};Dh.kind="return";var TP=class extends Lo{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&gl(t,this.catch.names),this.finally&&gl(t,this.finally.names),t}},jh=class extends Lo{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};jh.kind="catch";var zh=class extends Lo{render(t){return"finally"+super.render(t)}};zh.kind="finally";var RP=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
27
27
  `:""},this._extScope=t,this._scope=new Cs.Scope({parent:t}),this._nodes=[new xP]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new _P(t,s,n)),s}const(t,r,n){return this._def(Cs.varKinds.const,t,r,n)}let(t,r,n){return this._def(Cs.varKinds.let,t,r,n)}var(t,r,n){return this._def(Cs.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Yv(t,r,n))}add(t,r){return this._leafNode(new vP(t,at.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==wt.nil&&this._leafNode(new kP(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,wt.addCodeArg)(r,i));return r.push("}"),new wt._Code(r)}if(t,r,n){if(this._blockNode(new hl(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new hl(t))}else(){return this._elseNode(new id)}endIf(){return this._endBlockNode(hl,id)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new $P(t),r)}forRange(t,r,n,i,s=this.opts.es5?Cs.varKinds.var:Cs.varKinds.let){let o=this._scope.toName(t);return this._for(new EP(s,o,r,n),()=>i(o))}forOf(t,r,n,i=Cs.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let o=r instanceof wt.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,wt._)`${o}.length`,a=>{this.var(s,(0,wt._)`${o}[${a}]`),n(s)})}return this._for(new Xv("of",i,s,r),()=>n(s))}forIn(t,r,n,i=this.opts.es5?Cs.varKinds.var:Cs.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,wt._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new Xv("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(ml)}label(t){return this._leafNode(new bP(t))}break(t){return this._leafNode(new wP(t))}return(t){let r=new Dh;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Dh)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new TP;if(this._blockNode(i),this.code(t),r){let s=this.name("e");this._currNode=i.catch=new jh(s),r(s)}return n&&(this._currNode=i.finally=new zh,this.code(n)),this._endBlockNode(jh,zh)}throw(t){return this._leafNode(new SP(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=wt.nil,n,i){return this._blockNode(new Ah(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Ah)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof hl))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};at.CodeGen=RP;function gl(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Qv(e,t){return t instanceof wt._CodeOrName?gl(e,t.names):e}function sd(e,t,r){if(e instanceof wt.Name)return n(e);if(!i(e))return e;return new wt._Code(e._items.reduce((s,o)=>(o instanceof wt.Name&&(o=n(o)),o instanceof wt._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||t[s.str]!==1?s:(delete t[s.str],o)}function i(s){return s instanceof wt._Code&&s._items.some(o=>o instanceof wt.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function Hbe(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function mZ(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,wt._)`!${PP(e)}`}at.not=mZ;var Bbe=gZ(at.operators.AND);function Wbe(...e){return e.reduce(Bbe)}at.and=Wbe;var Jbe=gZ(at.operators.OR);function Gbe(...e){return e.reduce(Jbe)}at.or=Gbe;function gZ(e){return(t,r)=>t===wt.nil?r:r===wt.nil?t:(0,wt._)`${PP(t)} ${e} ${PP(r)}`}function PP(e){return e instanceof wt.Name?e:(0,wt._)`(${e})`}});var st=T(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.checkStrictMode=pt.getErrorPath=pt.Type=pt.useFunc=pt.setEvaluated=pt.evaluatedPropsToName=pt.mergeEvaluated=pt.eachItem=pt.unescapeJsonPointer=pt.escapeJsonPointer=pt.escapeFragment=pt.unescapeFragment=pt.schemaRefOrVal=pt.schemaHasRulesButRef=pt.schemaHasRules=pt.checkUnknownRules=pt.alwaysValidSchema=pt.toHash=void 0;var Yt=qe(),Kbe=nd();function Ybe(e){let t={};for(let r of e)t[r]=!0;return t}pt.toHash=Ybe;function Xbe(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(vZ(e,t),!bZ(t,e.self.RULES.all))}pt.alwaysValidSchema=Xbe;function vZ(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let s in t)i[s]||kZ(e,`unknown keyword: "${s}"`)}pt.checkUnknownRules=vZ;function bZ(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}pt.schemaHasRules=bZ;function Qbe(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}pt.schemaHasRulesButRef=Qbe;function ewe({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Yt._)`${r}`}return(0,Yt._)`${e}${t}${(0,Yt.getProperty)(n)}`}pt.schemaRefOrVal=ewe;function twe(e){return wZ(decodeURIComponent(e))}pt.unescapeFragment=twe;function rwe(e){return encodeURIComponent(OP(e))}pt.escapeFragment=rwe;function OP(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}pt.escapeJsonPointer=OP;function wZ(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}pt.unescapeJsonPointer=wZ;function nwe(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}pt.eachItem=nwe;function yZ({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let u=o===void 0?s:o instanceof Yt.Name?(s instanceof Yt.Name?e(i,s,o):t(i,s,o),o):s instanceof Yt.Name?(t(i,o,s),s):r(s,o);return a===Yt.Name&&!(u instanceof Yt.Name)?n(i,u):u}}pt.mergeEvaluated={props:yZ({mergeNames:(e,t,r)=>e.if((0,Yt._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Yt._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Yt._)`${r} || {}`).code((0,Yt._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Yt._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Yt._)`${r} || {}`),CP(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:SZ}),items:yZ({mergeNames:(e,t,r)=>e.if((0,Yt._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Yt._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Yt._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Yt._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function SZ(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Yt._)`{}`);return t!==void 0&&CP(e,r,t),r}pt.evaluatedPropsToName=SZ;function CP(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Yt._)`${t}${(0,Yt.getProperty)(n)}`,!0))}pt.setEvaluated=CP;var _Z={};function iwe(e,t){return e.scopeValue("func",{ref:t,code:_Z[t.code]||(_Z[t.code]=new Kbe._Code(t.code))})}pt.useFunc=iwe;var IP;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(IP||(pt.Type=IP={}));function swe(e,t,r){if(e instanceof Yt.Name){let n=t===IP.Num;return r?n?(0,Yt._)`"[" + ${e} + "]"`:(0,Yt._)`"['" + ${e} + "']"`:n?(0,Yt._)`"/" + ${e}`:(0,Yt._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Yt.getProperty)(e).toString():"/"+OP(e)}pt.getErrorPath=swe;function kZ(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}pt.checkStrictMode=kZ});var Ki=T(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});var Cn=qe(),owe={data:new Cn.Name("data"),valCxt:new Cn.Name("valCxt"),instancePath:new Cn.Name("instancePath"),parentData:new Cn.Name("parentData"),parentDataProperty:new Cn.Name("parentDataProperty"),rootData:new Cn.Name("rootData"),dynamicAnchors:new Cn.Name("dynamicAnchors"),vErrors:new Cn.Name("vErrors"),errors:new Cn.Name("errors"),this:new Cn.Name("this"),self:new Cn.Name("self"),scope:new Cn.Name("scope"),json:new Cn.Name("json"),jsonPos:new Cn.Name("jsonPos"),jsonLen:new Cn.Name("jsonLen"),jsonPart:new Cn.Name("jsonPart")};NP.default=owe});var Mh=T(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.extendErrors=Nn.resetErrorsCount=Nn.reportExtraError=Nn.reportError=Nn.keyword$DataError=Nn.keywordError=void 0;var $t=qe(),tb=st(),Zn=Ki();Nn.keywordError={message:({keyword:e})=>(0,$t.str)`must pass "${e}" keyword validation`};Nn.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,$t.str)`"${e}" keyword must be ${t} ($data)`:(0,$t.str)`"${e}" keyword is invalid ($data)`};function awe(e,t=Nn.keywordError,r,n){let{it:i}=e,{gen:s,compositeRule:o,allErrors:a}=i,u=EZ(e,t,r);n??(o||a)?xZ(s,u):$Z(i,(0,$t._)`[${u}]`)}Nn.reportError=awe;function uwe(e,t=Nn.keywordError,r){let{it:n}=e,{gen:i,compositeRule:s,allErrors:o}=n,a=EZ(e,t,r);xZ(i,a),s||o||$Z(n,Zn.default.vErrors)}Nn.reportExtraError=uwe;function lwe(e,t){e.assign(Zn.default.errors,t),e.if((0,$t._)`${Zn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,$t._)`${Zn.default.vErrors}.length`,t),()=>e.assign(Zn.default.vErrors,null)))}Nn.resetErrorsCount=lwe;function cwe({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",i,Zn.default.errors,a=>{e.const(o,(0,$t._)`${Zn.default.vErrors}[${a}]`),e.if((0,$t._)`${o}.instancePath === undefined`,()=>e.assign((0,$t._)`${o}.instancePath`,(0,$t.strConcat)(Zn.default.instancePath,s.errorPath))),e.assign((0,$t._)`${o}.schemaPath`,(0,$t.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,$t._)`${o}.schema`,r),e.assign((0,$t._)`${o}.data`,n))})}Nn.extendErrors=cwe;function xZ(e,t){let r=e.const("err",t);e.if((0,$t._)`${Zn.default.vErrors} === null`,()=>e.assign(Zn.default.vErrors,(0,$t._)`[${r}]`),(0,$t._)`${Zn.default.vErrors}.push(${r})`),e.code((0,$t._)`${Zn.default.errors}++`)}function $Z(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,$t._)`new ${e.ValidationError}(${t})`):(r.assign((0,$t._)`${n}.errors`,t),r.return(!1))}var yl={keyword:new $t.Name("keyword"),schemaPath:new $t.Name("schemaPath"),params:new $t.Name("params"),propertyName:new $t.Name("propertyName"),message:new $t.Name("message"),schema:new $t.Name("schema"),parentSchema:new $t.Name("parentSchema")};function EZ(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,$t._)`{}`:dwe(e,t,r)}function dwe(e,t,r={}){let{gen:n,it:i}=e,s=[fwe(i,r),pwe(e,r)];return hwe(e,t,s),n.object(...s)}function fwe({errorPath:e},{instancePath:t}){let r=t?(0,$t.str)`${e}${(0,tb.getErrorPath)(t,tb.Type.Str)}`:e;return[Zn.default.instancePath,(0,$t.strConcat)(Zn.default.instancePath,r)]}function pwe({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,$t.str)`${t}/${e}`;return r&&(i=(0,$t.str)`${i}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[yl.schemaPath,i]}function hwe(e,{params:t,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=e,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:d}=a;n.push([yl.keyword,i],[yl.params,typeof t=="function"?t(e):t||(0,$t._)`{}`]),u.messages&&n.push([yl.message,typeof r=="function"?r(e):r]),u.verbose&&n.push([yl.schema,o],[yl.parentSchema,(0,$t._)`${c}${d}`],[Zn.default.data,s]),l&&n.push([yl.propertyName,l])}});var RZ=T(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.boolOrEmptySchema=od.topBoolOrEmptySchema=void 0;var mwe=Mh(),gwe=qe(),ywe=Ki(),_we={message:"boolean schema is false"};function vwe(e){let{gen:t,schema:r,validateName:n}=e;r===!1?TZ(e,!1):typeof r=="object"&&r.$async===!0?t.return(ywe.default.data):(t.assign((0,gwe._)`${n}.errors`,null),t.return(!0))}od.topBoolOrEmptySchema=vwe;function bwe(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),TZ(e)):r.var(t,!0)}od.boolOrEmptySchema=bwe;function TZ(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,mwe.reportError)(i,_we,void 0,t)}});var AP=T(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.getRules=ad.isJSONType=void 0;var wwe=["string","number","integer","boolean","null","object","array"],Swe=new Set(wwe);function kwe(e){return typeof e=="string"&&Swe.has(e)}ad.isJSONType=kwe;function xwe(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ad.getRules=xwe});var DP=T(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.shouldUseRule=Fa.shouldUseGroup=Fa.schemaHasRulesForType=void 0;function $we({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&PZ(e,n)}Fa.schemaHasRulesForType=$we;function PZ(e,t){return t.rules.some(r=>IZ(e,r))}Fa.shouldUseGroup=PZ;function IZ(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Fa.shouldUseRule=IZ});var Lh=T(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.reportTypeError=An.checkDataTypes=An.checkDataType=An.coerceAndCheckDataType=An.getJSONTypes=An.getSchemaTypes=An.DataType=void 0;var Ewe=AP(),Twe=DP(),Rwe=Mh(),nt=qe(),OZ=st(),ud;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ud||(An.DataType=ud={}));function Pwe(e){let t=CZ(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}An.getSchemaTypes=Pwe;function CZ(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Ewe.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}An.getJSONTypes=CZ;function Iwe(e,t){let{gen:r,data:n,opts:i}=e,s=Owe(t,i.coerceTypes),o=t.length>0&&!(s.length===0&&t.length===1&&(0,Twe.schemaHasRulesForType)(e,t[0]));if(o){let a=zP(t,n,i.strictNumbers,ud.Wrong);r.if(a,()=>{s.length?Cwe(e,t,s):MP(e)})}return o}An.coerceAndCheckDataType=Iwe;var NZ=new Set(["string","number","integer","boolean","null"]);function Owe(e,t){return t?e.filter(r=>NZ.has(r)||t==="array"&&r==="array"):[]}function Cwe(e,t,r){let{gen:n,data:i,opts:s}=e,o=n.let("dataType",(0,nt._)`typeof ${i}`),a=n.let("coerced",(0,nt._)`undefined`);s.coerceTypes==="array"&&n.if((0,nt._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,nt._)`${i}[0]`).assign(o,(0,nt._)`typeof ${i}`).if(zP(t,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,nt._)`${a} !== undefined`);for(let l of r)(NZ.has(l)||l==="array"&&s.coerceTypes==="array")&&u(l);n.else(),MP(e),n.endIf(),n.if((0,nt._)`${a} !== undefined`,()=>{n.assign(i,a),Nwe(e,a)});function u(l){switch(l){case"string":n.elseIf((0,nt._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,nt._)`"" + ${i}`).elseIf((0,nt._)`${i} === null`).assign(a,(0,nt._)`""`);return;case"number":n.elseIf((0,nt._)`${o} == "boolean" || ${i} === null
28
28
  || (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,nt._)`+${i}`);return;case"integer":n.elseIf((0,nt._)`${o} === "boolean" || ${i} === null
29
29
  || (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,nt._)`+${i}`);return;case"boolean":n.elseIf((0,nt._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,nt._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,nt._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,nt._)`${o} === "string" || ${o} === "number"
@@ -31,7 +31,7 @@ ${b}`),v.pop(),`{${w}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";
31
31
  missingProperty: ${n},
32
32
  depsCount: ${t},
33
33
  deps: ${r}}`};var Qke={keyword:"dependencies",type:"object",schemaType:"object",error:co.error,code(e){let[t,r]=exe(e);iH(e,t),sH(e,r)}};function exe({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function iH(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let u=(0,im.propertyInData)(r,n,o,i.opts.ownProperties);e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(u,()=>{for(let l of a)(0,im.checkReportMissingProp)(e,l)}):(r.if((0,CI._)`${u} && (${(0,im.checkMissingProp)(e,a,s)})`),(0,im.reportMissingProp)(e,s),r.else())}}co.validatePropertyDeps=iH;function sH(e,t=e.schema){let{gen:r,data:n,keyword:i,it:s}=e,o=r.name("valid");for(let a in t)(0,Xke.alwaysValidSchema)(s,t[a])||(r.if((0,im.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:i,schemaProp:a},o);e.mergeValidEvaluated(u,o)},()=>r.var(o,!0)),e.ok(o))}co.validateSchemaDeps=sH;co.default=Qke});var uH=T(NI=>{"use strict";Object.defineProperty(NI,"__esModule",{value:!0});var aH=qe(),txe=st(),rxe={message:"property name must be valid",params:({params:e})=>(0,aH._)`{propertyName: ${e.propertyName}}`},nxe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rxe,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,txe.alwaysValidSchema)(i,r))return;let s=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),t.if((0,aH.not)(s),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(s)}};NI.default=nxe});var DI=T(AI=>{"use strict";Object.defineProperty(AI,"__esModule",{value:!0});var bb=pn(),Ds=qe(),ixe=Ki(),wb=st(),sxe={message:"must NOT have additional properties",params:({params:e})=>(0,Ds._)`{additionalProperty: ${e.additionalProperty}}`},oxe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sxe,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:u}=o;if(o.props=!0,u.removeAdditional!=="all"&&(0,wb.alwaysValidSchema)(o,r))return;let l=(0,bb.allSchemaProperties)(n.properties),c=(0,bb.allSchemaProperties)(n.patternProperties);d(),e.ok((0,Ds._)`${s} === ${ixe.default.errors}`);function d(){t.forIn("key",i,y=>{!l.length&&!c.length?h(y):t.if(p(y),()=>h(y))})}function p(y){let _;if(l.length>8){let b=(0,wb.schemaRefOrVal)(o,n.properties,"properties");_=(0,bb.isOwnProperty)(t,b,y)}else l.length?_=(0,Ds.or)(...l.map(b=>(0,Ds._)`${y} === ${b}`)):_=Ds.nil;return c.length&&(_=(0,Ds.or)(_,...c.map(b=>(0,Ds._)`${(0,bb.usePattern)(e,b)}.test(${y})`))),(0,Ds.not)(_)}function f(y){t.code((0,Ds._)`delete ${i}[${y}]`)}function h(y){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,wb.alwaysValidSchema)(o,r)){let _=t.name("valid");u.removeAdditional==="failing"?(v(y,_,!1),t.if((0,Ds.not)(_),()=>{e.reset(),f(y)})):(v(y,_),a||t.if((0,Ds.not)(_),()=>t.break()))}}function v(y,_,b){let g={keyword:"additionalProperties",dataProp:y,dataPropType:wb.Type.Str};b===!1&&Object.assign(g,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(g,_)}}};AI.default=oxe});var dH=T(zI=>{"use strict";Object.defineProperty(zI,"__esModule",{value:!0});var axe=dd(),lH=pn(),jI=st(),cH=DI(),uxe={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&cH.default.code(new axe.KeywordCxt(s,cH.default,"additionalProperties"));let o=(0,lH.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=jI.mergeEvaluated.props(t,(0,jI.toHash)(o),s.props));let a=o.filter(d=>!(0,jI.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a)l(d)?c(d):(t.if((0,lH.propertyInData)(t,i,d,s.opts.ownProperties)),c(d),s.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(u);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function c(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};zI.default=uxe});var mH=T(MI=>{"use strict";Object.defineProperty(MI,"__esModule",{value:!0});var fH=pn(),Sb=qe(),pH=st(),hH=st(),lxe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:s}=e,{opts:o}=s,a=(0,fH.allSchemaProperties)(r),u=a.filter(v=>(0,pH.alwaysValidSchema)(s,r[v]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,c=t.name("valid");s.props!==!0&&!(s.props instanceof Sb.Name)&&(s.props=(0,hH.evaluatedPropsToName)(t,s.props));let{props:d}=s;p();function p(){for(let v of a)l&&f(v),s.allErrors?h(v):(t.var(c,!0),h(v),t.if(c))}function f(v){for(let y in l)new RegExp(v).test(y)&&(0,pH.checkStrictMode)(s,`property ${y} matches pattern ${v} (use allowMatchingProperties)`)}function h(v){t.forIn("key",n,y=>{t.if((0,Sb._)`${(0,fH.usePattern)(e,v)}.test(${y})`,()=>{let _=u.includes(v);_||e.subschema({keyword:"patternProperties",schemaProp:v,dataProp:y,dataPropType:hH.Type.Str},c),s.opts.unevaluated&&d!==!0?t.assign((0,Sb._)`${d}[${y}]`,!0):!_&&!s.allErrors&&t.if((0,Sb.not)(c),()=>t.break())})})}}};MI.default=lxe});var gH=T(LI=>{"use strict";Object.defineProperty(LI,"__esModule",{value:!0});var cxe=st(),dxe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,cxe.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};LI.default=dxe});var yH=T(qI=>{"use strict";Object.defineProperty(qI,"__esModule",{value:!0});var fxe=pn(),pxe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:fxe.validateUnion,error:{message:"must match a schema in anyOf"}};qI.default=pxe});var _H=T(FI=>{"use strict";Object.defineProperty(FI,"__esModule",{value:!0});var kb=qe(),hxe=st(),mxe={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,kb._)`{passingSchemas: ${e.passing}}`},gxe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:mxe,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(o,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((c,d)=>{let p;(0,hxe.alwaysValidSchema)(i,c)?t.var(u,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u),d>0&&t.if((0,kb._)`${u} && ${o}`).assign(o,!1).assign(a,(0,kb._)`[${a}, ${d}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(a,d),p&&e.mergeEvaluated(p,kb.Name)})})}}};FI.default=gxe});var vH=T(UI=>{"use strict";Object.defineProperty(UI,"__esModule",{value:!0});var yxe=st(),_xe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((s,o)=>{if((0,yxe.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(a)})}};UI.default=_xe});var SH=T(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});var xb=qe(),wH=st(),vxe={message:({params:e})=>(0,xb.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,xb._)`{failingKeyword: ${e.ifClause}}`},bxe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:vxe,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,wH.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=bH(n,"then"),s=bH(n,"else");if(!i&&!s)return;let o=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),i&&s){let c=t.let("ifClause");e.setParams({ifClause:c}),t.if(a,l("then",c),l("else",c))}else i?t.if(a,l("then")):t.if((0,xb.not)(a),l("else"));e.pass(o,()=>e.error(!0));function u(){let c=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(c)}function l(c,d){return()=>{let p=e.subschema({keyword:c},a);t.assign(o,a),e.mergeValidEvaluated(p,o),d?t.assign(d,(0,xb._)`${c}`):e.setParams({ifClause:c})}}}};function bH(e,t){let r=e.schema[t];return r!==void 0&&!(0,wH.alwaysValidSchema)(e,r)}ZI.default=bxe});var kH=T(VI=>{"use strict";Object.defineProperty(VI,"__esModule",{value:!0});var wxe=st(),Sxe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,wxe.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};VI.default=Sxe});var xH=T(HI=>{"use strict";Object.defineProperty(HI,"__esModule",{value:!0});var kxe=TI(),xxe=eH(),$xe=RI(),Exe=rH(),Txe=nH(),Rxe=oH(),Pxe=uH(),Ixe=DI(),Oxe=dH(),Cxe=mH(),Nxe=gH(),Axe=yH(),Dxe=_H(),jxe=vH(),zxe=SH(),Mxe=kH();function Lxe(e=!1){let t=[Nxe.default,Axe.default,Dxe.default,jxe.default,zxe.default,Mxe.default,Pxe.default,Ixe.default,Rxe.default,Oxe.default,Cxe.default];return e?t.push(xxe.default,Exe.default):t.push(kxe.default,$xe.default),t.push(Txe.default),t}HI.default=Lxe});var $H=T(BI=>{"use strict";Object.defineProperty(BI,"__esModule",{value:!0});var qr=qe(),qxe={message:({schemaCode:e})=>(0,qr.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,qr._)`{format: ${e}}`},Fxe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qxe,code(e,t){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=e,{opts:u,errSchemaPath:l,schemaEnv:c,self:d}=a;if(!u.validateFormats)return;i?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),v=r.const("fDef",(0,qr._)`${h}[${o}]`),y=r.let("fType"),_=r.let("format");r.if((0,qr._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(y,(0,qr._)`${v}.type || "string"`).assign(_,(0,qr._)`${v}.validate`),()=>r.assign(y,(0,qr._)`"string"`).assign(_,v)),e.fail$data((0,qr.or)(b(),g()));function b(){return u.strictSchema===!1?qr.nil:(0,qr._)`${o} && !${_}`}function g(){let m=c.$async?(0,qr._)`(${v}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,qr._)`${_}(${n})`,S=(0,qr._)`(typeof ${_} == "function" ? ${m} : ${_}.test(${n}))`;return(0,qr._)`${_} && ${_} !== true && ${y} === ${t} && !${S}`}}function f(){let h=d.formats[s];if(!h){b();return}if(h===!0)return;let[v,y,_]=g(h);v===t&&e.pass(m());function b(){if(u.strictSchema===!1){d.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function g(S){let w=S instanceof RegExp?(0,qr.regexpCode)(S):u.code.formats?(0,qr._)`${u.code.formats}${(0,qr.getProperty)(s)}`:void 0,k=r.scopeValue("formats",{key:s,ref:S,code:w});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,qr._)`${k}.validate`]:["string",S,k]}function m(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!c.$async)throw new Error("async format in sync schema");return(0,qr._)`await ${_}(${n})`}return typeof y=="function"?(0,qr._)`${_}(${n})`:(0,qr._)`${_}.test(${n})`}}}};BI.default=Fxe});var EH=T(WI=>{"use strict";Object.defineProperty(WI,"__esModule",{value:!0});var Uxe=$H(),Zxe=[Uxe.default];WI.default=Zxe});var TH=T(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.contentVocabulary=md.metadataVocabulary=void 0;md.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];md.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var PH=T(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});var Vxe=jV(),Hxe=KV(),Bxe=xH(),Wxe=EH(),RH=TH(),Jxe=[Vxe.default,Hxe.default,(0,Bxe.default)(),Wxe.default,RH.metadataVocabulary,RH.contentVocabulary];JI.default=Jxe});var GI=T($b=>{"use strict";Object.defineProperty($b,"__esModule",{value:!0});$b.DiscrError=void 0;var IH;(function(e){e.Tag="tag",e.Mapping="mapping"})(IH||($b.DiscrError=IH={}))});var CH=T(YI=>{"use strict";Object.defineProperty(YI,"__esModule",{value:!0});var gd=qe(),KI=GI(),OH=bl(),Gxe=Fo(),Kxe=st(),Yxe={message:({params:{discrError:e,tagName:t}})=>e===KI.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,gd._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Xxe={keyword:"discriminator",type:"object",schemaType:"object",error:Yxe,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:s}=e,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),l=t.const("tag",(0,gd._)`${r}${(0,gd.getProperty)(a)}`);t.if((0,gd._)`typeof ${l} == "string"`,()=>c(),()=>e.error(!1,{discrError:KI.DiscrError.Tag,tag:l,tagName:a})),e.ok(u);function c(){let f=p();t.if(!1);for(let h in f)t.elseIf((0,gd._)`${l} === ${h}`),t.assign(u,d(f[h]));t.else(),e.error(!1,{discrError:KI.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),v=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(v,gd.Name),h}function p(){var f;let h={},v=_(i),y=!0;for(let m=0;m<o.length;m++){let S=o[m];if(S?.$ref&&!(0,Kxe.schemaHasRulesButRef)(S,s.self.RULES)){let k=S.$ref;if(S=OH.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,k),S instanceof OH.SchemaEnv&&(S=S.schema),S===void 0)throw new Gxe.default(s.opts.uriResolver,s.baseId,k)}let w=(f=S?.properties)===null||f===void 0?void 0:f[a];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(v||_(S)),b(w,m)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:m}){return Array.isArray(m)&&m.includes(a)}function b(m,S){if(m.const)g(m.const,S);else if(m.enum)for(let w of m.enum)g(w,S);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function g(m,S){if(typeof m!="string"||m in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[m]=S}}}};YI.default=Xxe});var NH=T((Lnt,Qxe)=>{Qxe.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 sm=T((lr,XI)=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.MissingRefError=lr.ValidationError=lr.CodeGen=lr.Name=lr.nil=lr.stringify=lr.str=lr._=lr.KeywordCxt=lr.Ajv=void 0;var e$e=aI(),t$e=PH(),r$e=CH(),AH=NH(),n$e=["/properties"],Eb="http://json-schema.org/draft-07/schema",yd=class extends e$e.default{_addVocabularies(){super._addVocabularies(),t$e.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(r$e.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(AH,n$e):AH;this.addMetaSchema(t,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lr.Ajv=yd;XI.exports=lr=yd;XI.exports.Ajv=yd;Object.defineProperty(lr,"__esModule",{value:!0});lr.default=yd;var i$e=dd();Object.defineProperty(lr,"KeywordCxt",{enumerable:!0,get:function(){return i$e.KeywordCxt}});var _d=qe();Object.defineProperty(lr,"_",{enumerable:!0,get:function(){return _d._}});Object.defineProperty(lr,"str",{enumerable:!0,get:function(){return _d.str}});Object.defineProperty(lr,"stringify",{enumerable:!0,get:function(){return _d.stringify}});Object.defineProperty(lr,"nil",{enumerable:!0,get:function(){return _d.nil}});Object.defineProperty(lr,"Name",{enumerable:!0,get:function(){return _d.Name}});Object.defineProperty(lr,"CodeGen",{enumerable:!0,get:function(){return _d.CodeGen}});var s$e=Vh();Object.defineProperty(lr,"ValidationError",{enumerable:!0,get:function(){return s$e.default}});var o$e=Fo();Object.defineProperty(lr,"MissingRefError",{enumerable:!0,get:function(){return o$e.default}})});var Zo=T(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});om.checkMetadata=void 0;var a$e=st(),u$e={keyword:"metadata",schemaType:"object",code(e){DH(e);let{gen:t,schema:r,it:n}=e;if((0,a$e.alwaysValidSchema)(n,r))return;let i=t.name("valid");e.subschema({keyword:"metadata",jtdMetadata:!0},i),e.ok(i)}};function DH({it:e,keyword:t},r){if(e.jtdMetadata!==r)throw new Error(`JTD: "${t}" cannot be used in this schema location`)}om.checkMetadata=DH;om.default=u$e});var Tb=T(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:!0});um.hasRef=void 0;var jH=bl(),am=qe(),l$e=Fo(),zH=Ki(),MH=lI(),c$e=Zo(),d$e={keyword:"ref",schemaType:"string",code(e){(0,c$e.checkMetadata)(e);let{gen:t,data:r,schema:n,parentSchema:i,it:s}=e,{schemaEnv:{root:o}}=s,a=t.name("valid");i.nullable?(t.var(a,(0,am._)`${r} === null`),t.if((0,am.not)(a),u)):(t.var(a,!1),u()),e.ok(a);function u(){var d;let p=(d=o.schema.definitions)===null||d===void 0?void 0:d[n];if(!p)throw new l$e.default(s.opts.uriResolver,"",n,`No definition ${n}`);QI(p)||!s.opts.inlineRefs?l(p):c(p)}function l(d){let p=jH.compileSchema.call(s.self,new jH.SchemaEnv({schema:d,root:o,schemaPath:`/definitions/${n}`})),f=(0,MH.getValidate)(e,p),h=t.const("_errs",zH.default.errors);(0,MH.callRef)(e,f,p,p.$async),t.assign(a,(0,am._)`${h} === ${zH.default.errors}`)}function c(d){let p=t.scopeValue("schema",s.opts.code.source===!0?{ref:d,code:(0,am.stringify)(d)}:{ref:d});e.subschema({schema:d,dataTypes:[],schemaPath:am.nil,topSchemaRef:p,errSchemaPath:`/definitions/${n}`},a)}}};function QI(e){for(let t in e){let r;if(t==="ref"||typeof(r=e[t])=="object"&&QI(r))return!0}return!1}um.hasRef=QI;um.default=d$e});var tO=T(eO=>{"use strict";Object.defineProperty(eO,"__esModule",{value:!0});var f$e=/t|\s/i,p$e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,h$e=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i,m$e=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qH(e,t){let r=e.split(f$e);return r.length===2&&LH(r[0])&&g$e(r[1])||t&&r.length===1&&LH(r[0])}eO.default=qH;function LH(e){let t=p$e.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&(i<=m$e[n]||n===2&&i===29&&(r%100===0?r%400===0:r%4===0))}function g$e(e){let t=h$e.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3],s=+(t[4]||0),o=+(t[5]||0);return r<=23&&n<=59&&i<=59||r-s===23&&n-o===59&&i===60}qH.code='require("ajv/dist/runtime/timestamp").default'});var vd=T(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.typeErrorParams=Wa.typeErrorMessage=Wa.typeError=void 0;var y$e=qe();function _$e(e){return{message:t=>FH(t,e),params:t=>UH(t,e)}}Wa.typeError=_$e;function FH({parentSchema:e},t){return e?.nullable?`must be ${t} or null`:`must be ${t}`}Wa.typeErrorMessage=FH;function UH({parentSchema:e},t){return(0,y$e._)`{type: ${t}, nullable: ${!!e?.nullable}}`}Wa.typeErrorParams=UH});var rO=T(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.intRange=void 0;var Ri=qe(),v$e=tO(),b$e=st(),w$e=Zo(),ZH=vd();bd.intRange={int8:[-128,127,3],uint8:[0,255,3],int16:[-32768,32767,5],uint16:[0,65535,5],int32:[-2147483648,2147483647,10],uint32:[0,4294967295,10]};var S$e={message:e=>(0,ZH.typeErrorMessage)(e,e.schema),params:e=>(0,ZH.typeErrorParams)(e,e.schema)};function k$e(e){let{gen:t,data:r,it:n}=e,{timestamp:i,allowDate:s}=n.opts;if(i==="date")return(0,Ri._)`${r} instanceof Date `;let o=(0,b$e.useFunc)(t,v$e.default),a=s?(0,Ri._)`, true`:Ri.nil,u=(0,Ri._)`typeof ${r} == "string" && ${o}(${r}${a})`;return i==="string"?u:(0,Ri.or)((0,Ri._)`${r} instanceof Date`,u)}var x$e={keyword:"type",schemaType:"string",error:S$e,code(e){(0,w$e.checkMetadata)(e);let{data:t,schema:r,parentSchema:n,it:i}=e,s;switch(r){case"boolean":case"string":s=(0,Ri._)`typeof ${t} == ${r}`;break;case"timestamp":{s=k$e(e);break}case"float32":case"float64":s=(0,Ri._)`typeof ${t} == "number"`;break;default:{let o=r;if(s=(0,Ri._)`typeof ${t} == "number" && isFinite(${t}) && !(${t} % 1)`,!i.opts.int32range&&(o==="int32"||o==="uint32"))o==="uint32"&&(s=(0,Ri._)`${s} && ${t} >= 0`);else{let[a,u]=bd.intRange[o];s=(0,Ri._)`${s} && ${t} >= ${a} && ${t} <= ${u}`}}}e.pass(n.nullable?(0,Ri.or)((0,Ri._)`${t} === null`,s):s)}};bd.default=x$e});var Sd=T(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});wd.checkNullableObject=wd.checkNullable=void 0;var Rb=qe();function VH({gen:e,data:t,parentSchema:r},n=Rb.nil){let i=e.name("valid");return r.nullable?(e.let(i,(0,Rb._)`${t} === null`),n=(0,Rb.not)(i)):e.let(i,!1),[i,n]}wd.checkNullable=VH;function $$e(e,t){let[r,n]=VH(e,t);return[r,(0,Rb._)`${n} && typeof ${e.data} == "object" && !Array.isArray(${e.data})`]}wd.checkNullableObject=$$e});var HH=T(nO=>{"use strict";Object.defineProperty(nO,"__esModule",{value:!0});var Ja=qe(),E$e=Zo(),T$e=Sd(),R$e={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ja._)`{allowedValues: ${e}}`},P$e={keyword:"enum",schemaType:"array",error:R$e,code(e){(0,E$e.checkMetadata)(e);let{gen:t,data:r,schema:n,schemaValue:i,parentSchema:s,it:o}=e;if(n.length===0)throw new Error("enum must have non-empty array");if(n.length!==new Set(n).size)throw new Error("enum items must be unique");let a,u=(0,Ja._)`typeof ${r} == "string"`;if(n.length>=o.opts.loopEnum){let c;[a,c]=(0,T$e.checkNullable)(e,u),t.if(c,l)}else{if(!Array.isArray(n))throw new Error("ajv implementation error");a=(0,Ja.and)(u,(0,Ja.or)(...n.map(c=>(0,Ja._)`${r} === ${c}`))),s.nullable&&(a=(0,Ja.or)((0,Ja._)`${r} === null`,a))}e.pass(a);function l(){t.forOf("v",i,c=>t.if((0,Ja._)`${a} = ${r} === ${c}`,()=>t.break()))}}};nO.default=P$e});var WH=T(iO=>{"use strict";Object.defineProperty(iO,"__esModule",{value:!0});var I$e=st(),O$e=pn(),BH=qe(),C$e=Zo(),N$e=Sd(),A$e=vd(),D$e={keyword:"elements",schemaType:"object",error:(0,A$e.typeError)("array"),code(e){(0,C$e.checkMetadata)(e);let{gen:t,data:r,schema:n,it:i}=e;if((0,I$e.alwaysValidSchema)(i,n))return;let[s]=(0,N$e.checkNullable)(e);t.if((0,BH.not)(s),()=>t.if((0,BH._)`Array.isArray(${r})`,()=>t.assign(s,(0,O$e.validateArray)(e)),()=>e.error())),e.ok(s)}};iO.default=D$e});var oO=T(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.validateProperties=Ga.error=void 0;var sO=pn(),JH=st(),Vo=qe(),j$e=Zo(),z$e=Sd(),GH=vd(),kd;(function(e){e.Additional="additional",e.Missing="missing"})(kd||(kd={}));Ga.error={message:e=>{let{params:t}=e;return t.propError?t.propError===kd.Additional?"must NOT have additional properties":`must have property '${t.missingProperty}'`:(0,GH.typeErrorMessage)(e,"object")},params:e=>{let{params:t}=e;return t.propError?t.propError===kd.Additional?(0,Vo._)`{error: ${t.propError}, additionalProperty: ${t.additionalProperty}}`:(0,Vo._)`{error: ${t.propError}, missingProperty: ${t.missingProperty}}`:(0,GH.typeErrorParams)(e,"object")}};var M$e={keyword:"properties",schemaType:"object",error:Ga.error,code:KH};function KH(e){(0,j$e.checkMetadata)(e);let{gen:t,data:r,parentSchema:n,it:i}=e,{additionalProperties:s,nullable:o}=n;if(i.jtdDiscriminator&&o)throw new Error("JTD: nullable inside discriminator mapping");if(f())throw new Error("JTD: properties and optionalProperties have common members");let[a,u]=h("properties"),[l,c]=h("optionalProperties");if(u.length===0&&c.length===0&&s)return;let[d,p]=i.jtdDiscriminator===void 0?(0,z$e.checkNullableObject)(e,r):[t.let("valid",!1),!0];t.if(p,()=>t.assign(d,!0).block(()=>{v(u,"properties",!0),v(c,"optionalProperties"),s||_()})),e.pass(d);function f(){let g=n.properties,m=n.optionalProperties;if(!(g&&m))return!1;for(let S in g)if(Object.prototype.hasOwnProperty.call(m,S))return!0;return!1}function h(g){let m=n[g],S=m?(0,sO.allSchemaProperties)(m):[];if(i.jtdDiscriminator&&S.some(k=>k===i.jtdDiscriminator))throw new Error(`JTD: discriminator tag used in ${g}`);let w=S.filter(k=>!(0,JH.alwaysValidSchema)(i,m[k]));return[S,w]}function v(g,m,S){let w=t.var("valid");for(let x of g)t.if((0,sO.propertyInData)(t,r,x,i.opts.ownProperties),()=>y(x,m,w),()=>k(x)),e.ok(w);function k(x){S?(t.assign(w,!1),e.error(!1,{propError:kd.Missing,missingProperty:x},{schemaPath:x})):t.assign(w,!0)}}function y(g,m,S){e.subschema({keyword:m,schemaProp:g,dataProp:g},S)}function _(){t.forIn("key",r,g=>{let m=b(g,a,"properties",i.jtdDiscriminator),S=b(g,l,"optionalProperties"),w=m===!0?S:S===!0?m:(0,Vo.and)(m,S);t.if(w,()=>{i.opts.removeAdditional?t.code((0,Vo._)`delete ${r}[${g}]`):(e.error(!1,{propError:kd.Additional,additionalProperty:g},{instancePath:g,parentSchema:!0}),i.opts.allErrors||t.break())})})}function b(g,m,S,w){let k;if(m.length>8){let x=(0,JH.schemaRefOrVal)(i,n[S],S);k=(0,Vo.not)((0,sO.isOwnProperty)(t,x,g)),w!==void 0&&(k=(0,Vo.and)(k,(0,Vo._)`${g} !== ${w}`))}else if(m.length||w!==void 0){let x=w===void 0?m:[w].concat(m);k=(0,Vo.and)(...x.map(R=>(0,Vo._)`${g} !== ${R}`))}else k=!0;return k}}Ga.validateProperties=KH;Ga.default=M$e});var XH=T(aO=>{"use strict";Object.defineProperty(aO,"__esModule",{value:!0});var YH=oO(),L$e={keyword:"optionalProperties",schemaType:"object",error:YH.error,code(e){e.parentSchema.properties||(0,YH.validateProperties)(e)}};aO.default=L$e});var e9=T(uO=>{"use strict";Object.defineProperty(uO,"__esModule",{value:!0});var xl=qe(),q$e=Zo(),F$e=Sd(),QH=vd(),Pb=GI(),U$e={message:e=>{let{schema:t,params:r}=e;return r.discrError?r.discrError===Pb.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in mapping`:(0,QH.typeErrorMessage)(e,"object")},params:e=>{let{schema:t,params:r}=e;return r.discrError?(0,xl._)`{error: ${r.discrError}, tag: ${t}, tagValue: ${r.tag}}`:(0,QH.typeErrorParams)(e,"object")}},Z$e={keyword:"discriminator",schemaType:"string",implements:["mapping"],error:U$e,code(e){(0,q$e.checkMetadata)(e);let{gen:t,data:r,schema:n,parentSchema:i}=e,[s,o]=(0,F$e.checkNullableObject)(e,r);t.if(o),a(),t.elseIf((0,xl.not)(s)),e.error(),t.endIf(),e.ok(s);function a(){let c=t.const("tag",(0,xl._)`${r}${(0,xl.getProperty)(n)}`);t.if((0,xl._)`${c} === undefined`),e.error(!1,{discrError:Pb.DiscrError.Tag,tag:c}),t.elseIf((0,xl._)`typeof ${c} == "string"`),u(c),t.else(),e.error(!1,{discrError:Pb.DiscrError.Tag,tag:c},{instancePath:n}),t.endIf()}function u(c){t.if(!1);for(let d in i.mapping)t.elseIf((0,xl._)`${c} === ${d}`),t.assign(s,l(d));t.else(),e.error(!1,{discrError:Pb.DiscrError.Mapping,tag:c},{instancePath:n,schemaPath:"mapping",parentSchema:!0}),t.endIf()}function l(c){let d=t.name("valid");return e.subschema({keyword:"mapping",schemaProp:c,jtdDiscriminator:n},d),d}}};uO.default=Z$e});var r9=T(lO=>{"use strict";Object.defineProperty(lO,"__esModule",{value:!0});var t9=st(),Ib=qe(),V$e=Zo(),H$e=Sd(),B$e=vd(),W$e={keyword:"values",schemaType:"object",error:(0,B$e.typeError)("object"),code(e){(0,V$e.checkMetadata)(e);let{gen:t,data:r,schema:n,it:i}=e,[s,o]=(0,H$e.checkNullableObject)(e,r);(0,t9.alwaysValidSchema)(i,n)?t.if((0,Ib.not)((0,Ib.or)(o,s)),()=>e.error()):(t.if(o),t.assign(s,a()),t.elseIf((0,Ib.not)(s)),e.error(),t.endIf()),e.ok(s);function a(){let u=t.name("valid");if(i.allErrors){let c=t.let("valid",!0);return l(()=>t.assign(c,!1)),c}return t.var(u,!0),l(()=>t.break()),u;function l(c){t.forIn("key",r,d=>{e.subschema({keyword:"values",dataProp:d,dataPropType:t9.Type.Str},u),t.if((0,Ib.not)(u),c)})}}}};lO.default=W$e});var n9=T(cO=>{"use strict";Object.defineProperty(cO,"__esModule",{value:!0});var J$e=pn(),G$e={keyword:"union",schemaType:"array",trackErrors:!0,code:J$e.validateUnion,error:{message:"must match a schema in union"}};cO.default=G$e});var i9=T(dO=>{"use strict";Object.defineProperty(dO,"__esModule",{value:!0});var K$e=Tb(),Y$e=rO(),X$e=HH(),Q$e=WH(),eEe=oO(),tEe=XH(),rEe=e9(),nEe=r9(),iEe=n9(),sEe=Zo(),oEe=["definitions",K$e.default,Y$e.default,X$e.default,Q$e.default,eEe.default,tEe.default,rEe.default,nEe.default,iEe.default,sEe.default,{keyword:"additionalProperties",schemaType:"boolean"},{keyword:"nullable",schemaType:"boolean"}];dO.default=oEe});var u9=T(fO=>{"use strict";Object.defineProperty(fO,"__esModule",{value:!0});var Ho=e=>{let t={nullable:{type:"boolean"},metadata:{optionalProperties:{union:{elements:{ref:"schema"}}},additionalProperties:!0}};return e&&(t.definitions={values:{ref:"schema"}}),t},aEe=e=>({optionalProperties:Ho(e)}),uEe=e=>({properties:{ref:{type:"string"}},optionalProperties:Ho(e)}),lEe=e=>({properties:{type:{enum:["boolean","timestamp","string","float32","float64","int8","uint8","int16","uint16","int32","uint32"]}},optionalProperties:Ho(e)}),cEe=e=>({properties:{enum:{elements:{type:"string"}}},optionalProperties:Ho(e)}),dEe=e=>({properties:{elements:{ref:"schema"}},optionalProperties:Ho(e)}),o9=e=>({properties:{properties:{values:{ref:"schema"}}},optionalProperties:{optionalProperties:{values:{ref:"schema"}},additionalProperties:{type:"boolean"},...Ho(e)}}),a9=e=>({properties:{optionalProperties:{values:{ref:"schema"}}},optionalProperties:{additionalProperties:{type:"boolean"},...Ho(e)}}),fEe=e=>({properties:{discriminator:{type:"string"},mapping:{values:{metadata:{union:[o9(!1),a9(!1)]}}}},optionalProperties:Ho(e)}),pEe=e=>({properties:{values:{ref:"schema"}},optionalProperties:Ho(e)}),s9=e=>({metadata:{union:[aEe,uEe,lEe,cEe,dEe,o9,a9,fEe,pEe].map(t=>t(e))}}),hEe={definitions:{schema:s9(!1)},...s9(!0)};fO.default=hEe});var pO=T(Ob=>{"use strict";Object.defineProperty(Ob,"__esModule",{value:!0});Ob.jtdForms=void 0;Ob.jtdForms=["elements","values","discriminator","properties","optionalProperties","enum","type","ref"]});var c9=T(mO=>{"use strict";Object.defineProperty(mO,"__esModule",{value:!0});var hO=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,mEe={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function l9(e){return hO.lastIndex=0,'"'+(hO.test(e)?e.replace(hO,t=>{let r=mEe[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}):e)+'"'}mO.default=l9;l9.code='require("ajv/dist/runtime/quote").default'});var g9=T(yO=>{"use strict";Object.defineProperty(yO,"__esModule",{value:!0});var gEe=pO(),f9=bl(),vt=qe(),yEe=Fo(),ir=Ki(),_Ee=pn(),vEe=Tb(),bEe=st(),wEe=c9(),SEe={elements:xEe,values:$Ee,discriminator:EEe,properties:d9,optionalProperties:d9,enum:lm,type:TEe,ref:PEe};function p9(e,t){let r=f9.getCompilingSchema.call(this,e);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new vt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("serialize"),u={self:this,gen:o,schema:e.schema,schemaEnv:e,definitions:t,data:ir.default.data},l;try{this._compilations.add(e),e.serializeName=a,o.func(a,ir.default.data,!1,()=>{o.let(ir.default.json,(0,vt.str)``),cm(u),o.return(ir.default.json)}),o.optimize(this.opts.code.optimize);let c=o.toString();l=`${o.scopeRefs(ir.default.scope)}return ${c}`;let p=new Function(`${ir.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:p}),e.serialize=p}catch(c){throw l&&this.logger.error("Error compiling serializer, function code:",l),delete e.serialize,delete e.serializeName,c}finally{this._compilations.delete(e)}return e}yO.default=p9;function cm(e){let t;for(let r of gEe.jtdForms)if(r in e.schema){t=r;break}kEe(e,t?SEe[t]:OEe)}function kEe(e,t){let{gen:r,schema:n,data:i}=e;if(!n.nullable)return t(e);r.if((0,vt._)`${i} === undefined || ${i} === null`,()=>r.add(ir.default.json,(0,vt._)`"null"`),()=>t(e))}function xEe(e){let{gen:t,schema:r,data:n}=e;t.add(ir.default.json,(0,vt.str)`[`);let i=t.let("first",!0);t.forOf("el",n,s=>{gO(e,i),cm({...e,schema:r.elements,data:s})}),t.add(ir.default.json,(0,vt.str)`]`)}function $Ee(e){let{gen:t,schema:r,data:n}=e;t.add(ir.default.json,(0,vt.str)`{`);let i=t.let("first",!0);t.forIn("key",n,s=>h9(e,s,r.values,i)),t.add(ir.default.json,(0,vt.str)`}`)}function h9(e,t,r,n){let{gen:i,data:s}=e;gO(e,n),lm({...e,data:t}),i.add(ir.default.json,(0,vt.str)`:`);let o=i.const("value",(0,vt._)`${s}${(0,vt.getProperty)(t)}`);cm({...e,schema:r,data:o})}function EEe(e){let{gen:t,schema:r,data:n}=e,{discriminator:i}=r;t.add(ir.default.json,(0,vt.str)`{${JSON.stringify(i)}:`);let s=t.const("tag",(0,vt._)`${n}${(0,vt.getProperty)(i)}`);lm({...e,data:s}),t.if(!1);for(let o in r.mapping){t.elseIf((0,vt._)`${s} === ${o}`);let a=r.mapping[o];m9({...e,schema:a},i)}t.endIf(),t.add(ir.default.json,(0,vt.str)`}`)}function d9(e){let{gen:t}=e;t.add(ir.default.json,(0,vt.str)`{`),m9(e),t.add(ir.default.json,(0,vt.str)`}`)}function m9(e,t){let{gen:r,schema:n,data:i}=e,{properties:s,optionalProperties:o}=n,a=p(s),u=p(o),l=f(a.concat(u)),c=!t,d;for(let _ of a)c?c=!1:r.add(ir.default.json,(0,vt.str)`,`),v(_,s[_],h(_));c&&(d=r.let("first",!0));for(let _ of u){let b=h(_);r.if((0,vt.and)((0,vt._)`${b} !== undefined`,(0,_Ee.isOwnProperty)(r,i,_)),()=>{gO(e,d),v(_,o[_],b)})}n.additionalProperties&&r.forIn("key",i,_=>r.if(y(_,l),()=>h9(e,_,{},d)));function p(_){return _?Object.keys(_):[]}function f(_){if(t&&_.push(t),new Set(_).size!==_.length)throw new Error("JTD: properties/optionalProperties/disciminator overlap");return _}function h(_){return r.const("value",(0,vt._)`${i}${(0,vt.getProperty)(_)}`)}function v(_,b,g){r.add(ir.default.json,(0,vt.str)`${JSON.stringify(_)}:`),cm({...e,schema:b,data:g})}function y(_,b){return b.length?(0,vt.and)(...b.map(g=>(0,vt._)`${_} !== ${g}`)):!0}}function TEe(e){let{gen:t,schema:r,data:n}=e;switch(r.type){case"boolean":t.add(ir.default.json,(0,vt._)`${n} ? "true" : "false"`);break;case"string":lm(e);break;case"timestamp":t.if((0,vt._)`${n} instanceof Date`,()=>t.add(ir.default.json,(0,vt._)`'"' + ${n}.toISOString() + '"'`),()=>lm(e));break;default:REe(e)}}function lm({gen:e,data:t}){e.add(ir.default.json,(0,vt._)`${(0,bEe.useFunc)(e,wEe.default)}(${t})`)}function REe({gen:e,data:t}){e.add(ir.default.json,(0,vt._)`"" + ${t}`)}function PEe(e){let{gen:t,self:r,data:n,definitions:i,schema:s,schemaEnv:o}=e,{ref:a}=s,u=i[a];if(!u)throw new yEe.default(r.opts.uriResolver,"",a,`No definition ${a}`);if(!(0,vEe.hasRef)(u))return cm({...e,schema:u});let{root:l}=o,c=p9.call(r,new f9.SchemaEnv({schema:u,root:l}),i);t.add(ir.default.json,(0,vt._)`${IEe(t,c)}(${n})`)}function IEe(e,t){return t.serialize?e.scopeValue("serialize",{ref:t.serialize}):(0,vt._)`${e.scopeValue("wrapper",{ref:t})}.serialize`}function OEe({gen:e,data:t}){e.add(ir.default.json,(0,vt._)`JSON.stringify(${t})`)}function gO({gen:e},t){t?e.if(t,()=>e.assign(t,!1),()=>e.add(ir.default.json,(0,vt.str)`,`)):e.add(ir.default.json,(0,vt.str)`,`)}});var _9=T(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.parseJsonString=Ya.parseJsonNumber=Ya.parseJson=void 0;var CEe=/position\s(\d+)(?: \(line \d+ column \d+\))?$/;function Bo(e,t){let r;Bo.message=void 0;let n;t&&(e=e.slice(t));try{return Bo.position=t+e.length,JSON.parse(e)}catch(i){if(n=CEe.exec(i.message),!n){Bo.message="unexpected end";return}r=+n[1];let s=e[r];e=e.slice(0,r),Bo.position=t+r;try{return JSON.parse(e)}catch{Bo.message=`unexpected token ${s}`;return}}}Ya.parseJson=Bo;Bo.message=void 0;Bo.position=0;Bo.code='require("ajv/dist/runtime/parseJson").parseJson';function Wo(e,t,r){let n="",i;if(Wo.message=void 0,e[t]==="-"&&(n+="-",t++),e[t]==="0")n+="0",t++;else if(!s(r)){o();return}if(r)return Wo.position=t,+n;if(e[t]==="."&&(n+=".",t++,!s())){o();return}if(i=e[t],(i==="e"||i==="E")&&(n+="e",t++,i=e[t],(i==="+"||i==="-")&&(n+=i,t++),!s())){o();return}return Wo.position=t,+n;function s(a){let u=!1;for(;i=e[t],i>="0"&&i<="9"&&(a===void 0||a-- >0);)u=!0,n+=i,t++;return u}function o(){Wo.position=t,Wo.message=t<e.length?`unexpected token ${e[t]}`:"unexpected end"}}Ya.parseJsonNumber=Wo;Wo.message=void 0;Wo.position=0;Wo.code='require("ajv/dist/runtime/parseJson").parseJsonNumber';var y9={b:"\b",f:"\f",n:`
34
- `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},NEe=97,AEe=48;function Ka(e,t){let r="",n;for(Ka.message=void 0;n=e[t++],n!=='"';)if(n==="\\")if(n=e[t],n in y9)r+=y9[n],t++;else if(n==="u"){t++;let s=4,o=0;for(;s--;){if(o<<=4,n=e[t],n===void 0){i("unexpected end");return}if(n=n.toLowerCase(),n>="a"&&n<="f")o+=n.charCodeAt(0)-NEe+10;else if(n>="0"&&n<="9")o+=n.charCodeAt(0)-AEe;else{i(`unexpected token ${n}`);return}t++}r+=String.fromCharCode(o)}else{i(`unexpected token ${n}`);return}else if(n===void 0){i("unexpected end");return}else if(n.charCodeAt(0)>=32)r+=n;else{i(`unexpected token ${n}`);return}return Ka.position=t,r;function i(s){Ka.position=t,Ka.message=s}}Ya.parseJsonString=Ka;Ka.message=void 0;Ka.position=0;Ka.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var P9=T($O=>{"use strict";Object.defineProperty($O,"__esModule",{value:!0});var DEe=pO(),S9=bl(),De=qe(),jEe=Fo(),gt=Ki(),zEe=pn(),MEe=Tb(),LEe=rO(),bO=_9(),k9=st(),qEe=tO(),FEe={elements:HEe,values:BEe,discriminator:JEe,properties:v9,optionalProperties:v9,enum:KEe,type:GEe,ref:YEe};function x9(e,t){let r=S9.getCompilingSchema.call(this,e);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new De.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("parse"),u={self:this,gen:o,schema:e.schema,schemaEnv:e,definitions:t,data:gt.default.data,parseName:a,char:o.name("c")},l;try{this._compilations.add(e),e.parseName=a,UEe(u),o.optimize(this.opts.code.optimize);let c=o.toString();l=`${o.scopeRefs(gt.default.scope)}return ${c}`;let p=new Function(`${gt.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:p}),e.parse=p}catch(c){throw l&&this.logger.error("Error compiling parser, function code:",l),delete e.parse,delete e.parseName,c}finally{this._compilations.delete(e)}return e}$O.default=x9;var vO=(0,De._)`undefined`;function UEe(e){let{gen:t,parseName:r,char:n}=e;t.func(r,(0,De._)`${gt.default.json}, ${gt.default.jsonPos}, ${gt.default.jsonPart}`,!1,()=>{t.let(gt.default.data),t.let(n),t.assign((0,De._)`${r}.message`,vO),t.assign((0,De._)`${r}.position`,vO),t.assign(gt.default.jsonPos,(0,De._)`${gt.default.jsonPos} || 0`),t.const(gt.default.jsonLen,(0,De._)`${gt.default.json}.length`),Cb(e),xO(e),t.if(gt.default.jsonPart,()=>{t.assign((0,De._)`${r}.position`,gt.default.jsonPos),t.return(gt.default.data)}),t.if((0,De._)`${gt.default.jsonPos} === ${gt.default.jsonLen}`,()=>t.return(gt.default.data)),xd(e)})}function Cb(e){let t;for(let r of DEe.jtdForms)if(r in e.schema){t=r;break}t?VEe(e,FEe[t]):SO(e)}var ZEe=w9(!0,w9(!1,xd));function VEe(e,t){let{gen:r,schema:n,data:i}=e;if(!n.nullable)return t(e);dm(e,"null",t,()=>r.assign(i,null))}function HEe(e){let{gen:t,schema:r,data:n}=e;fo(e,"[");let i=t.let("i",0);t.assign(n,(0,De._)`[]`),wO(e,"]",()=>{let s=t.let("el");Cb({...e,schema:r.elements,data:s}),t.assign((0,De._)`${n}[${i}++]`,s)})}function BEe(e){let{gen:t,schema:r,data:n}=e;fo(e,"{"),t.assign(n,(0,De._)`{}`),wO(e,"}",()=>WEe(e,r.values))}function wO(e,t,r){$9(e,t,r),fo(e,t)}function $9(e,t,r){let{gen:n}=e;n.for((0,De._)`;${gt.default.jsonPos}<${gt.default.jsonLen} && ${Nb(1)}!==${t};`,()=>{r(),dm(e,",",()=>n.break(),i)});function i(){dm(e,t,()=>{},xd)}}function WEe(e,t){let{gen:r}=e,n=r.let("key");$l({...e,data:n}),fo(e,":"),T9(e,n,t)}function JEe(e){let{gen:t,data:r,schema:n}=e,{discriminator:i,mapping:s}=n;fo(e,"{"),t.assign(r,(0,De._)`{}`);let o=t.const("pos",gt.default.jsonPos),a=t.let("value"),u=t.let("tag");$9(e,"}",()=>{let l=t.let("key");$l({...e,data:l}),fo(e,":"),t.if((0,De._)`${l} === ${i}`,()=>{$l({...e,data:u}),t.assign((0,De._)`${r}[${l}]`,u),t.break()},()=>SO({...e,data:a}))}),t.assign(gt.default.jsonPos,o),t.if((0,De._)`${u} === undefined`),Jo(e,(0,De.str)`discriminator tag not found`);for(let l in s)t.elseIf((0,De._)`${u} === ${l}`),E9({...e,schema:s[l]},i);t.else(),Jo(e,(0,De.str)`discriminator value not in schema`),t.endIf()}function v9(e){let{gen:t,data:r}=e;fo(e,"{"),t.assign(r,(0,De._)`{}`),E9(e)}function E9(e,t){let{gen:r,schema:n,data:i}=e,{properties:s,optionalProperties:o,additionalProperties:a}=n;if(wO(e,"}",()=>{let u=r.let("key");if($l({...e,data:u}),fo(e,":"),r.if(!1),b9(e,u,s),b9(e,u,o),t){r.elseIf((0,De._)`${u} === ${t}`);let l=r.let("tag");$l({...e,data:l})}r.else(),a?SO({...e,data:(0,De._)`${i}[${u}]`}):Jo(e,(0,De.str)`property ${u} not allowed`),r.endIf()}),s){let u=(0,zEe.hasPropFunc)(r),l=(0,De.and)(...Object.keys(s).map(c=>(0,De._)`${u}.call(${i}, ${c})`));r.if((0,De.not)(l),()=>Jo(e,(0,De.str)`missing required properties`))}}function b9(e,t,r={}){let{gen:n}=e;for(let i in r)n.elseIf((0,De._)`${t} === ${i}`),T9(e,t,r[i])}function T9(e,t,r){Cb({...e,schema:r,data:(0,De._)`${e.data}[${t}]`})}function GEe(e){let{gen:t,schema:r,data:n,self:i}=e;switch(r.type){case"boolean":ZEe(e);break;case"string":$l(e);break;case"timestamp":{$l(e);let s=(0,k9.useFunc)(t,qEe.default),{allowDate:o,parseDate:a}=i.opts,u=o?(0,De._)`!${s}(${n}, true)`:(0,De._)`!${s}(${n})`,l=a?(0,De.or)(u,(0,De._)`(${n} = new Date(${n}), false)`,(0,De._)`isNaN(${n}.valueOf())`):u;t.if(l,()=>Jo(e,(0,De.str)`invalid timestamp`));break}case"float32":case"float64":_O(e);break;default:{let s=r.type;if(!i.opts.int32range&&(s==="int32"||s==="uint32"))_O(e,16),s==="uint32"&&t.if((0,De._)`${n} < 0`,()=>Jo(e,(0,De.str)`integer out of range`));else{let[o,a,u]=LEe.intRange[s];_O(e,u),t.if((0,De._)`${n} < ${o} || ${n} > ${a}`,()=>Jo(e,(0,De.str)`integer out of range`))}}}}function $l(e){fo(e,'"'),kO(e,bO.parseJsonString)}function KEe(e){let{gen:t,data:r,schema:n}=e,i=n.enum;fo(e,'"'),t.if(!1);for(let s of i){let o=JSON.stringify(s).slice(1);t.elseIf((0,De._)`${Nb(o.length)} === ${o}`),t.assign(r,(0,De.str)`${s}`),t.add(gt.default.jsonPos,o.length)}t.else(),xd(e),t.endIf()}function _O(e,t){let{gen:r}=e;xO(e),r.if((0,De._)`"-0123456789".indexOf(${Nb(1)}) < 0`,()=>xd(e),()=>kO(e,bO.parseJsonNumber,t))}function w9(e,t){return r=>{let{gen:n,data:i}=r;dm(r,`${e}`,()=>t(r),()=>n.assign(i,e))}}function YEe(e){let{gen:t,self:r,definitions:n,schema:i,schemaEnv:s}=e,{ref:o}=i,a=n[o];if(!a)throw new jEe.default(r.opts.uriResolver,"",o,`No definition ${o}`);if(!(0,MEe.hasRef)(a))return Cb({...e,schema:a});let{root:u}=s,l=x9.call(r,new S9.SchemaEnv({schema:a,root:u}),n);R9(e,XEe(t,l),!0)}function XEe(e,t){return t.parse?e.scopeValue("parse",{ref:t.parse}):(0,De._)`${e.scopeValue("wrapper",{ref:t})}.parse`}function SO(e){kO(e,bO.parseJson)}function kO(e,t,r){R9(e,(0,k9.useFunc)(e.gen,t),r)}function R9(e,t,r){let{gen:n,data:i}=e;n.assign(i,(0,De._)`${t}(${gt.default.json}, ${gt.default.jsonPos}${r?(0,De._)`, ${r}`:De.nil})`),n.assign(gt.default.jsonPos,(0,De._)`${t}.position`),n.if((0,De._)`${i} === undefined`,()=>Jo(e,(0,De._)`${t}.message`))}function fo(e,t){dm(e,t,xd)}function dm(e,t,r,n){let{gen:i}=e,s=t.length;xO(e),i.if((0,De._)`${Nb(s)} === ${t}`,()=>{i.add(gt.default.jsonPos,s),n?.(e)},()=>r(e))}function xO({gen:e,char:t}){e.code((0,De._)`while((${t}=${gt.default.json}[${gt.default.jsonPos}],${t}===" "||${t}==="\\n"||${t}==="\\r"||${t}==="\\t"))${gt.default.jsonPos}++;`)}function Nb(e){return e===1?(0,De._)`${gt.default.json}[${gt.default.jsonPos}]`:(0,De._)`${gt.default.json}.slice(${gt.default.jsonPos}, ${gt.default.jsonPos}+${e})`}function xd(e){Jo(e,(0,De._)`"unexpected token " + ${gt.default.json}[${gt.default.jsonPos}]`)}function Jo({gen:e,parseName:t},r){e.assign((0,De._)`${t}.message`,r),e.assign((0,De._)`${t}.position`,gt.default.jsonPos),e.return(vO)}});var RO=T((cr,TO)=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.MissingRefError=cr.ValidationError=cr.CodeGen=cr.Name=cr.nil=cr.stringify=cr.str=cr._=cr.KeywordCxt=cr.Ajv=void 0;var QEe=aI(),eTe=i9(),tTe=u9(),rTe=g9(),nTe=P9(),EO="JTD-meta-schema",$d=class extends QEe.default{constructor(t={}){super({...t,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(eTe.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema(),this.opts.meta&&this.addMetaSchema(tTe.default,EO,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(EO)?EO:void 0)}compileSerializer(t){let r=this._addSchema(t);return r.serialize||this._compileSerializer(r)}compileParser(t){let r=this._addSchema(t);return r.parse||this._compileParser(r)}_compileSerializer(t){if(rTe.default.call(this,t,t.schema.definitions||{}),!t.serialize)throw new Error("ajv implementation error");return t.serialize}_compileParser(t){if(nTe.default.call(this,t,t.schema.definitions||{}),!t.parse)throw new Error("ajv implementation error");return t.parse}};cr.Ajv=$d;TO.exports=cr=$d;TO.exports.Ajv=$d;Object.defineProperty(cr,"__esModule",{value:!0});cr.default=$d;var iTe=dd();Object.defineProperty(cr,"KeywordCxt",{enumerable:!0,get:function(){return iTe.KeywordCxt}});var Ed=qe();Object.defineProperty(cr,"_",{enumerable:!0,get:function(){return Ed._}});Object.defineProperty(cr,"str",{enumerable:!0,get:function(){return Ed.str}});Object.defineProperty(cr,"stringify",{enumerable:!0,get:function(){return Ed.stringify}});Object.defineProperty(cr,"nil",{enumerable:!0,get:function(){return Ed.nil}});Object.defineProperty(cr,"Name",{enumerable:!0,get:function(){return Ed.Name}});Object.defineProperty(cr,"CodeGen",{enumerable:!0,get:function(){return Ed.CodeGen}});var sTe=Vh();Object.defineProperty(cr,"ValidationError",{enumerable:!0,get:function(){return sTe.default}});var oTe=Fo();Object.defineProperty(cr,"MissingRefError",{enumerable:!0,get:function(){return oTe.default}})});var PO=T((oit,I9)=>{"use strict";var aTe=db();I9.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:aTe,addUsedSchema:!1,allErrors:!1})});var Ab=T(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.formatNames=ho.fastFormats=ho.fullFormats=void 0;function po(e,t){return{validate:e,compare:t}}ho.fullFormats={date:po(A9,NO),time:po(OO(!0),AO),"date-time":po(O9(!0),j9),"iso-time":po(OO(),D9),"iso-date-time":po(O9(),z9),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:pTe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:bTe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:hTe,int32:{type:"number",validate:yTe},int64:{type:"number",validate:_Te},float:{type:"number",validate:N9},double:{type:"number",validate:N9},password:!0,binary:!0};ho.fastFormats={...ho.fullFormats,date:po(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,NO),time:po(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,AO),"date-time":po(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,j9),"iso-time":po(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,D9),"iso-date-time":po(/^\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,z9),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};ho.formatNames=Object.keys(ho.fullFormats);function uTe(e){return e%4===0&&(e%100!==0||e%400===0)}var lTe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cTe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function A9(e){let t=lTe.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&uTe(r)?29:cTe[n])}function NO(e,t){if(e&&t)return e>t?1:e<t?-1:0}var IO=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function OO(e){return function(r){let n=IO.exec(r);if(!n)return!1;let i=+n[1],s=+n[2],o=+n[3],a=n[4],u=n[5]==="-"?-1:1,l=+(n[6]||0),c=+(n[7]||0);if(l>23||c>59||e&&!a)return!1;if(i<=23&&s<=59&&o<60)return!0;let d=s-c*u,p=i-l*u-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&o<61}}function AO(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function D9(e,t){if(!(e&&t))return;let r=IO.exec(e),n=IO.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var CO=/t|\s/i;function O9(e){let t=OO(e);return function(n){let i=n.split(CO);return i.length===2&&A9(i[0])&&t(i[1])}}function j9(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function z9(e,t){if(!(e&&t))return;let[r,n]=e.split(CO),[i,s]=t.split(CO),o=NO(r,i);if(o!==void 0)return o||AO(n,s)}var dTe=/\/|:/,fTe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function pTe(e){return dTe.test(e)&&fTe.test(e)}var C9=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function hTe(e){return C9.lastIndex=0,C9.test(e)}var mTe=-(2**31),gTe=2**31-1;function yTe(e){return Number.isInteger(e)&&e<=gTe&&e>=mTe}function _Te(e){return Number.isInteger(e)}function N9(){return!0}var vTe=/[^\\]\\Z/;function bTe(e){if(vTe.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var M9=T(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.formatLimitDefinition=void 0;var wTe=sm(),js=qe(),Xa=js.operators,Db={formatMaximum:{okStr:"<=",ok:Xa.LTE,fail:Xa.GT},formatMinimum:{okStr:">=",ok:Xa.GTE,fail:Xa.LT},formatExclusiveMaximum:{okStr:"<",ok:Xa.LT,fail:Xa.GTE},formatExclusiveMinimum:{okStr:">",ok:Xa.GT,fail:Xa.LTE}},STe={message:({keyword:e,schemaCode:t})=>(0,js.str)`should be ${Db[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,js._)`{comparison: ${Db[e].okStr}, limit: ${t}}`};Td.formatLimitDefinition={keyword:Object.keys(Db),type:"string",schemaType:"string",$data:!0,error:STe,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:s}=e,{opts:o,self:a}=s;if(!o.validateFormats)return;let u=new wTe.KeywordCxt(s,a.RULES.all.format.definition,"format");u.$data?l():c();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),f=t.const("fmt",(0,js._)`${p}[${u.schemaCode}]`);e.fail$data((0,js.or)((0,js._)`typeof ${f} != "object"`,(0,js._)`${f} instanceof RegExp`,(0,js._)`typeof ${f}.compare != "function"`,d(f)))}function c(){let p=u.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:o.code.formats?(0,js._)`${o.code.formats}${(0,js.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,js._)`${p}.compare(${r}, ${n}) ${Db[i].fail} 0`}},dependencies:["format"]};var kTe=e=>(e.addKeyword(Td.formatLimitDefinition),e);Td.default=kTe});var jb=T((fm,F9)=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});var Rd=Ab(),xTe=M9(),DO=qe(),L9=new DO.Name("fullFormats"),$Te=new DO.Name("fastFormats"),jO=(e,t={keywords:!0})=>{if(Array.isArray(t))return q9(e,t,Rd.fullFormats,L9),e;let[r,n]=t.mode==="fast"?[Rd.fastFormats,$Te]:[Rd.fullFormats,L9],i=t.formats||Rd.formatNames;return q9(e,i,r,n),t.keywords&&(0,xTe.default)(e),e};jO.get=(e,t="full")=>{let n=(t==="fast"?Rd.fastFormats:Rd.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function q9(e,t,r,n){var i,s;(i=(s=e.opts.code).formats)!==null&&i!==void 0||(s.formats=(0,DO._)`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}F9.exports=fm=jO;Object.defineProperty(fm,"__esModule",{value:!0});fm.default=jO});var V9=T((lit,Z9)=>{"use strict";var ETe=sm().default,TTe=RO(),U9=PO(),zO=class{constructor(t,r){r.mode==="JTD"?this.ajv=new TTe(Object.assign({},U9,r.customOptions)):this.ajv=new ETe(Object.assign({},U9,r.customOptions));let n=!0;if(r.plugins&&r.plugins.length>0)for(let s of r.plugins)Array.isArray(s)?(n=n&&s[0].name!=="formatsPlugin",s[0](this.ajv,s[1])):(n=n&&s.name!=="formatsPlugin",s(this.ajv));n&&jb()(this.ajv),r.onCreate?.(this.ajv);let i=Object.values(t);for(let s of i)this.ajv.addSchema(s)}buildValidatorFunction({schema:t}){if(t.$id){let r=this.ajv.getSchema(t.$id);if(r)return r}return this.ajv.compile(t)}};Z9.exports=zO});var B9=T((cit,H9)=>{"use strict";var RTe=RO(),PTe=PO(),MO=class{constructor(t,r){this.ajv=new RTe(Object.assign({},PTe,r))}buildSerializerFunction({schema:t}){return this.ajv.compileSerializer(t)}};H9.exports=MO});var G9=T((hm,J9)=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});var pm=Kv(),zs=nd();function W9(e,t){if(!e.opts.code.source)throw new Error("moduleCode: ajv instance must have code.source option");let{_n:r}=e.scope.opts;return typeof t=="function"?i(t.source):t!==void 0?s(t,n):s(e.schemas,a=>a.meta?void 0:e.compile(a.schema));function n(a){let u=e.getSchema(a);if(!u)throw new Error(`moduleCode: no schema with id ${a}`);return u}function i(a){let u={},l=a?.validateName,c=o(u,a);return e.opts.code.esm?`"use strict";${r}export const validate = ${l};${r}export default ${l};${r}${c}`:`"use strict";${r}module.exports = ${l};${r}module.exports.default = ${l};${r}${c}`}function s(a,u){var l;let c={},d=(0,zs._)`"use strict";`;for(let p in a){let f=u(a[p]);if(f){let h=o(c,f.source),v=e.opts.code.esm?(0,zs._)`export const ${(0,zs.getEsmExportName)(p)}`:(0,zs._)`exports${(0,zs.getProperty)(p)}`;d=(0,zs._)`${d}${r}${v} = ${(l=f.source)===null||l===void 0?void 0:l.validateName};${r}${h}`}}return`${d}`}function o(a,u){if(!u)throw new Error('moduleCode: function does not have "source" property');if(p(u.validateName)===pm.UsedValueState.Completed)return zs.nil;f(u.validateName,pm.UsedValueState.Started);let l=e.scope.scopeCode(u.scopeValues,a,d),c=new zs._Code(`${l}${r}${u.validateCode}`);return u.evaluated?(0,zs._)`${c}${u.validateName}.evaluated = ${u.evaluated};${r}`:c;function d(h){var v;let y=(v=h.value)===null||v===void 0?void 0:v.ref;if(h.prefix==="validate"&&typeof y=="function")return o(a,y.source);if((h.prefix==="root"||h.prefix==="wrapper")&&typeof y=="object"){let{validate:_,validateName:b}=y;if(!b)throw new Error("ajv internal error");let g=e.opts.code.es5?pm.varKinds.var:pm.varKinds.const,m=(0,zs._)`${g} ${h} = {validate: ${b}};`;if(p(b)===pm.UsedValueState.Started)return m;let S=o(a,_?.source);return(0,zs._)`${m}${r}${S}`}}function p(h){var v;return(v=a[h.prefix])===null||v===void 0?void 0:v.get(h)}function f(h,v){let{prefix:y}=h;(a[y]=a[y]||new Map).set(h,v)}}}J9.exports=hm=W9;Object.defineProperty(hm,"__esModule",{value:!0});hm.default=W9});var X9=T((dit,Y9)=>{"use strict";var K9=LO(),ITe=G9().default;function OTe(e={readMode:!0}){if(e.readMode===!0&&!e.restoreFunction)throw new Error("You must provide a restoreFunction options when readMode ON");if(e.readMode!==!0&&!e.storeFunction)throw new Error("You must provide a storeFunction options when readMode OFF");if(e.readMode===!0)return function(){return function(n){return e.restoreFunction(n)}};let t=K9();return function(n,i={}){(!i.customOptions||!i.customOptions.code)&&(i.customOptions=Object.assign({},i.customOptions,{code:{source:!0}}));let s=t(n,i);return function(o){let a=s(o),u=ITe(s[K9.AjvReference].ajv,a);return e.storeFunction(o,u),a}}}Y9.exports=OTe});var LO=T((fit,Pd)=>{"use strict";var eB=Symbol.for("fastify.ajv-compiler.reference"),CTe=V9(),NTe=B9();function qO(e){let t=new Map,r=new Map;return e&&e.jtdSerializer===!0?function(i,s){let o=Q9({},s);if(r.has(o))return r.get(o);let a=new NTe(i,s),u=a.buildSerializerFunction.bind(a);return r.set(o,u),u}:function(i,s){let o=Q9(i,s.customOptions);if(t.has(o))return t.get(o);let a=new CTe(i,s),u=a.buildValidatorFunction.bind(a);return t.set(o,u),s.customOptions.code!==void 0&&(u[eB]=a),u}}function Q9(e,t){let r=JSON.stringify(e),n=JSON.stringify(t);return`${r}${n}`}Pd.exports=qO;Pd.exports.default=qO;Pd.exports.AjvCompiler=qO;Pd.exports.AjvReference=eB;Pd.exports.StandaloneValidator=X9()});var zb=T(nB=>{var tB=Object.prototype.hasOwnProperty;function rB(e,t,r){for(r of e.keys())if(mm(r,t))return r}function mm(e,t){var r,n,i;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&mm(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(i=n,i&&typeof i=="object"&&(i=rB(t,i),!i)||!t.has(i))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(i=n[0],i&&typeof i=="object"&&(i=rB(t,i),!i)||!mm(n[1],t.get(i)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!r||typeof e=="object"){n=0;for(r in e)if(tB.call(e,r)&&++n&&!tB.call(t,r)||!(r in t)||!mm(e[r],t[r]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}nB.dequal=mm});var aB=T((hit,oB)=>{"use strict";var{dequal:iB}=zb(),ATe=Symbol.for("json-schema-ref"),FO=class{#e;#r;#i;#n;#s;constructor(t={}){this.#e={},this.#r={},this.#i=t.insertRefSymbol??!1,this.#n=t.allowEqualDuplicates??!0,this.#s=t.cloneSchemaWithoutRefs??!1}addSchema(t,r,n=!0){n&&(t.$id!==void 0&&t.$id.charAt(0)!=="#"?r=t.$id:this.#o(t,r));let i=t.$id;i!==void 0&&typeof i=="string"&&(i.charAt(0)==="#"?this.#a(t,r,i):(this.#o(t,i),r=i));let s=t.$ref;if(s!==void 0&&typeof s=="string"){let{refSchemaId:o,refJsonPointer:a}=this.#t(s,r);this.#e[r].refs.push({schemaId:o,jsonPointer:a})}for(let o in t)typeof t[o]=="object"&&t[o]!==null&&this.addSchema(t[o],r,!1)}getSchema(t,r="#"){let n=this.#e[t];if(n===void 0)throw new Error(`Cannot resolve ref "${t}${r}". Schema with id "${t}" is not found.`);return n.anchors[r]!==void 0?n.anchors[r]:sB(n.schema,r)}hasSchema(t){return this.#e[t]!==void 0}getSchemaRefs(t){let r=this.#e[t];if(r===void 0)throw new Error(`Schema with id "${t}" is not found.`);return r.refs}getSchemaDependencies(t,r={}){let n=this.#e[t];for(let i of n.refs){let s=i.schemaId;s===t||r[s]!==void 0||(r[s]=this.getSchema(s),this.getSchemaDependencies(s,r))}return r}derefSchema(t){if(this.#r[t]!==void 0)return;let r=this.#e[t];if(r===void 0)throw new Error(`Schema with id "${t}" is not found.`);!this.#s&&r.refs.length===0&&(this.#r[t]={schema:r.schema,anchors:r.anchors});let n=[];this.#u(r.schema,t,!0,n);let i=this.getSchemaDependencies(t);for(let s in i){let o=i[s];this.#u(o,s,!0,n)}for(let s of n){let{refSchemaId:o,refJsonPointer:a}=this.#t(s.ref,s.sourceSchemaId),u=this.getDerefSchema(o,a);if(u===null)throw new Error(`Cannot resolve ref "${s.ref}". Ref "${a}" is not found in schema "${o}".`);s.targetSchema=u,s.targetSchemaId=o}for(let s of n)this.#l(s,n)}getDerefSchema(t,r="#"){let n=this.#r[t];return n===void 0&&(this.derefSchema(t),n=this.#r[t]),n.anchors[r]!==void 0?n.anchors[r]:sB(n.schema,r)}#t(t,r){let n=t.indexOf("#");return n===-1?{refSchemaId:t,refJsonPointer:"#"}:n===0?{refSchemaId:r,refJsonPointer:t}:{refSchemaId:t.slice(0,n),refJsonPointer:t.slice(n)}}#u(t,r,n,i=[]){let s=Array.isArray(t)?[...t]:{...t};n&&(t.$id!==void 0&&t.$id.charAt(0)!=="#"?r=t.$id:this.#c(s,r));let o=s.$id;o!==void 0&&typeof o=="string"&&(o.charAt(0)==="#"?this.#d(s,r,o):(this.#c(s,o),r=o)),s.$ref!==void 0&&i.push({ref:s.$ref,sourceSchemaId:r,sourceSchema:s});for(let a in s){let u=s[a];typeof u=="object"&&u!==null&&(s[a]=this.#u(u,r,!1,i))}return s}#l(t,r){let{sourceSchema:n,targetSchema:i}=t;if(n.$ref){if(this.#i&&(n[ATe]=n.$ref),delete n.$ref,i.$ref){let s=r.find(o=>o.sourceSchema===i);this.#l(s,r)}for(let s in i)if(s!=="$id"){if(n[s]!==void 0){if(iB(n[s],i[s]))continue;throw new Error(`Cannot resolve ref "${t.ref}". Property "${s}" already exists in schema "${t.sourceSchemaId}".`)}n[s]=i[s]}t.isResolved=!0}}#o(t,r){let n=this.#e[r];if(n!==void 0){if(this.#n&&iB(t,n.schema))return;throw new Error(`There is already another schema with id "${r}".`)}this.#e[r]={schema:t,anchors:{},refs:[]}}#a(t,r,n){let{anchors:i}=this.#e[r];if(i[n]!==void 0)throw new Error(`There is already another anchor "${n}" in schema "${r}".`);i[n]=t}#c(t,r){this.#r[r]===void 0&&(this.#r[r]={schema:t,anchors:{}})}#d(t,r,n){let{anchors:i}=this.#r[r];i[n]=t}};function sB(e,t){let r=t.split("/"),n=e;for(let i of r)if(!(i===""||i==="#")){if(typeof n!="object"||n===null)return null;n=n[i]}return n??null}oB.exports={RefResolver:FO}});var ZO=T((mit,uB)=>{"use strict";var DTe=sm(),jTe=db(),zTe=jb(),MTe=kv()({proto:!0}),UO=class e{constructor(t){this.ajv=new DTe({...t,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:jTe}),zTe(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(r,n)=>n&&typeof n.toJSON=="function"}),this._ajvSchemas={},this._ajvOptions=t||{}}addSchema(t,r){let n=t.$id||r;if(t.$id!==void 0&&t.$id[0]==="#"&&(n=r+t.$id),this.ajv.refs[n]===void 0&&this.ajv.schemas[n]===void 0){let i=MTe(t);this.convertSchemaToAjvFormat(i),this.ajv.addSchema(i,n),this._ajvSchemas[n]=t}}validate(t,r){return this.ajv.validate(t,r)}convertSchemaToAjvFormat(t){if(t!==null){t.type==="string"?(t.fjs_type="string",t.type=["string","object"]):Array.isArray(t.type)&&t.type.includes("string")&&!t.type.includes("object")&&(t.fjs_type="string",t.type.push("object"));for(let r in t)typeof t[r]=="object"&&this.convertSchemaToAjvFormat(t[r])}}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState(t){let r=new e(t.ajvOptions);for(let[n,i]of Object.entries(t.ajvSchemas))r.ajv.addSchema(i,n);return r}};uB.exports=UO});var cB=T((git,lB)=>{"use strict";var VO=class e{constructor(t,r,n="#"){this.schema=t,this.schemaId=r,this.jsonPointer=n}getPropertyLocation(t){return new e(this.schema[t],this.schemaId,this.jsonPointer+"/"+t)}getSchemaRef(){return this.schemaId+this.jsonPointer}};lB.exports=VO});var mB=T((yit,BO)=>{"use strict";BO.exports=fe;BO.exports.default=fe;var LTe={$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},dB={enum:["array","boolean","integer","null","number","object","string"]},fB=/^(?:[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,qTe=Ab().fullFormats.uri,pB=Ab().fullFormats.regex;function Qi(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0,a=o;return typeof e=="number"&&!(e%1)&&!isNaN(e)&&isFinite(e)?o===a&&typeof e=="number"&&isFinite(e)&&(e<0||isNaN(e))?(Qi.errors=[{instancePath:t,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1):(Qi.errors=s,o===0):(Qi.errors=[{instancePath:t,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1)}var HO={validate:fe};function Hn(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(o===0)if(Array.isArray(e)){if(e.length<1)return Hn.errors=[{instancePath:t,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var a=!0;let u=e.length;for(let l=0;l<u;l++){let c=o;HO.validate(e[l],{instancePath:t+"/"+l,parentData:e,parentDataProperty:l,rootData:i})||(s=s===null?HO.validate.errors:s.concat(HO.validate.errors),o=s.length);var a=c===o;if(!a)break}}}else return Hn.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return Hn.errors=s,o===0}var hB=em().default;function fe(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(!(e&&typeof e=="object"&&!Array.isArray(e))&&typeof e!="boolean")return fe.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:LTe.type},message:"must be object,boolean"}],!1;if(o===0&&e&&typeof e=="object"&&!Array.isArray(e)){if(e.$id!==void 0){let g=e.$id,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!fB.test(g))return fe.errors=[{instancePath:t+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return fe.errors=[{instancePath:t+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$schema!==void 0){let g=e.$schema,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!qTe(g))return fe.errors=[{instancePath:t+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return fe.errors=[{instancePath:t+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$ref!==void 0){let g=e.$ref,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!fB.test(g))return fe.errors=[{instancePath:t+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return fe.errors=[{instancePath:t+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$comment!==void 0){let g=o;if(typeof e.$comment!="string")return fe.errors=[{instancePath:t+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.title!==void 0){let g=o;if(typeof e.title!="string")return fe.errors=[{instancePath:t+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.description!==void 0){let g=o;if(typeof e.description!="string")return fe.errors=[{instancePath:t+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.readOnly!==void 0){let g=o;if(typeof e.readOnly!="boolean")return fe.errors=[{instancePath:t+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=g===o}else var a=!0;if(a){if(e.examples!==void 0){let g=o;if(o===g&&!Array.isArray(e.examples))return fe.errors=[{instancePath:t+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(e.multipleOf!==void 0){let g=e.multipleOf,m=o;if(o===m)if(typeof g=="number"&&isFinite(g)){if(g<=0||isNaN(g))return fe.errors=[{instancePath:t+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return fe.errors=[{instancePath:t+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.maximum!==void 0){let g=e.maximum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.exclusiveMaximum!==void 0){let g=e.exclusiveMaximum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.minimum!==void 0){let g=e.minimum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.exclusiveMinimum!==void 0){let g=e.exclusiveMinimum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.maxLength!==void 0){let g=e.maxLength,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minLength!==void 0){let g=o;Qi(e.minLength,{instancePath:t+"/minLength",parentData:e,parentDataProperty:"minLength",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.pattern!==void 0){let g=e.pattern,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!pB(g))return fe.errors=[{instancePath:t+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return fe.errors=[{instancePath:t+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.additionalItems!==void 0){let g=o;fe(e.additionalItems,{instancePath:t+"/additionalItems",parentData:e,parentDataProperty:"additionalItems",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.items!==void 0){let g=e.items,m=o,S=o,w=!1,k=o;fe(g,{instancePath:t+"/items",parentData:e,parentDataProperty:"items",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var u=k===o;if(w=w||u,!w){let R=o;Hn(g,{instancePath:t+"/items",parentData:e,parentDataProperty:"items",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var u=R===o;w=w||u}if(w)o=S,s!==null&&(S?s.length=S:s=null);else{let R={instancePath:t+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[R]:s.push(R),o++,fe.errors=s,!1}var a=m===o}else var a=!0;if(a){if(e.maxItems!==void 0){let g=e.maxItems,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minItems!==void 0){let g=o;Qi(e.minItems,{instancePath:t+"/minItems",parentData:e,parentDataProperty:"minItems",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.uniqueItems!==void 0){let g=o;if(typeof e.uniqueItems!="boolean")return fe.errors=[{instancePath:t+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=g===o}else var a=!0;if(a){if(e.contains!==void 0){let g=o;fe(e.contains,{instancePath:t+"/contains",parentData:e,parentDataProperty:"contains",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.maxProperties!==void 0){let g=e.maxProperties,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minProperties!==void 0){let g=o;Qi(e.minProperties,{instancePath:t+"/minProperties",parentData:e,parentDataProperty:"minProperties",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.required!==void 0){let g=e.required,m=o;if(o===o)if(Array.isArray(g)){var l=!0;let k=g.length;for(let x=0;x<k;x++){let R=o;if(typeof g[x]!="string")return fe.errors=[{instancePath:t+"/required/"+x,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var l=R===o;if(!l)break}if(l){let x=g.length,R;if(x>1){let E={};for(;x--;){let P=g[x];if(typeof P=="string"){if(typeof E[P]=="number"){return R=E[P],fe.errors=[{instancePath:t+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:x,j:R},message:"must NOT have duplicate items (items ## "+R+" and "+x+" are identical)"}],!1;break}E[P]=x}}}}}else return fe.errors=[{instancePath:t+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=m===o}else var a=!0;if(a){if(e.additionalProperties!==void 0){let g=o;fe(e.additionalProperties,{instancePath:t+"/additionalProperties",parentData:e,parentDataProperty:"additionalProperties",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.definitions!==void 0){let g=e.definitions,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=o;fe(g[w],{instancePath:t+"/definitions/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var c=k===o;if(!c)break}else return fe.errors=[{instancePath:t+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.properties!==void 0){let g=e.properties,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=o;fe(g[w],{instancePath:t+"/properties/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var d=k===o;if(!d)break}else return fe.errors=[{instancePath:t+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.patternProperties!==void 0){let g=e.patternProperties,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g)){for(let w in g){let k=o;if(o===k&&typeof w=="string"&&!pB(w)){let x={instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:w};s===null?s=[x]:s.push(x),o++}var p=k===o;if(!p){let x={instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:w},message:"property name must be valid"};return s===null?s=[x]:s.push(x),o++,fe.errors=s,!1;break}}if(p)for(let w in g){let k=o;fe(g[w],{instancePath:t+"/patternProperties/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var f=k===o;if(!f)break}}else return fe.errors=[{instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.dependencies!==void 0){let g=e.dependencies,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=g[w],x=o,R=o,E=!1,P=o;fe(k,{instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var h=P===o;if(E=E||h,!E){let C=o;if(o===o)if(Array.isArray(k)){var v=!0;let A=k.length;for(let W=0;W<A;W++){let H=o;if(typeof k[W]!="string"){let ne={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+W,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ne]:s.push(ne),o++}var v=H===o;if(!v)break}if(v){let W=k.length,H;if(W>1){let re={};for(;W--;){let ne=k[W];if(typeof ne=="string"){if(typeof re[ne]=="number"){H=re[ne];let Z={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:W,j:H},message:"must NOT have duplicate items (items ## "+H+" and "+W+" are identical)"};s===null?s=[Z]:s.push(Z),o++;break}re[ne]=W}}}}}else{let A={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[A]:s.push(A),o++}var h=C===o;E=E||h}if(E)o=R,s!==null&&(R?s.length=R:s=null);else{let C={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[C]:s.push(C),o++,fe.errors=s,!1}var y=x===o;if(!y)break}else return fe.errors=[{instancePath:t+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.propertyNames!==void 0){let g=o;fe(e.propertyNames,{instancePath:t+"/propertyNames",parentData:e,parentDataProperty:"propertyNames",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.enum!==void 0){let g=e.enum,m=o;if(o===m)if(Array.isArray(g)){if(g.length<1)return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{let w=g.length,k;if(w>1){e:for(;w--;)for(k=w;k--;)if(hB(g[w],g[k])){return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:w,j:k},message:"must NOT have duplicate items (items ## "+k+" and "+w+" are identical)"}],!1;break e}}}}else return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=m===o}else var a=!0;if(a){if(e.type!==void 0){let g=e.type,m=o,S=o,w=!1,k=o;if(!(g==="array"||g==="boolean"||g==="integer"||g==="null"||g==="number"||g==="object"||g==="string")){let R={instancePath:t+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:dB.enum},message:"must be equal to one of the allowed values"};s===null?s=[R]:s.push(R),o++}var _=k===o;if(w=w||_,!w){let R=o;if(o===R)if(Array.isArray(g))if(g.length<1){let P={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[P]:s.push(P),o++}else{var b=!0;let P=g.length;for(let C=0;C<P;C++){let $=g[C],N=o;if(!($==="array"||$==="boolean"||$==="integer"||$==="null"||$==="number"||$==="object"||$==="string")){let W={instancePath:t+"/type/"+C,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:dB.enum},message:"must be equal to one of the allowed values"};s===null?s=[W]:s.push(W),o++}var b=N===o;if(!b)break}if(b){let C=g.length,$;if(C>1){e:for(;C--;)for($=C;$--;)if(hB(g[C],g[$])){let N={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:C,j:$},message:"must NOT have duplicate items (items ## "+$+" and "+C+" are identical)"};s===null?s=[N]:s.push(N),o++;break e}}}}else{let P={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[P]:s.push(P),o++}var _=R===o;w=w||_}if(w)o=S,s!==null&&(S?s.length=S:s=null);else{let R={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[R]:s.push(R),o++,fe.errors=s,!1}var a=m===o}else var a=!0;if(a){if(e.format!==void 0){let g=o;if(typeof e.format!="string")return fe.errors=[{instancePath:t+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.contentMediaType!==void 0){let g=o;if(typeof e.contentMediaType!="string")return fe.errors=[{instancePath:t+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.contentEncoding!==void 0){let g=o;if(typeof e.contentEncoding!="string")return fe.errors=[{instancePath:t+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.if!==void 0){let g=o;fe(e.if,{instancePath:t+"/if",parentData:e,parentDataProperty:"if",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.then!==void 0){let g=o;fe(e.then,{instancePath:t+"/then",parentData:e,parentDataProperty:"then",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.else!==void 0){let g=o;fe(e.else,{instancePath:t+"/else",parentData:e,parentDataProperty:"else",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.allOf!==void 0){let g=o;Hn(e.allOf,{instancePath:t+"/allOf",parentData:e,parentDataProperty:"allOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.anyOf!==void 0){let g=o;Hn(e.anyOf,{instancePath:t+"/anyOf",parentData:e,parentDataProperty:"anyOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.oneOf!==void 0){let g=o;Hn(e.oneOf,{instancePath:t+"/oneOf",parentData:e,parentDataProperty:"oneOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a)if(e.not!==void 0){let g=o;fe(e.not,{instancePath:t+"/not",parentData:e,parentDataProperty:"not",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return fe.errors=s,o===0}});var KO=T((_it,gB)=>{"use strict";var WO=class extends Error{constructor(t,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${t}" keyword schemas.`,this.schemas=r}},JO=class extends Error{constructor(t,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${t}" keyword not found.`,this.schemas=r}},GO=class extends Error{constructor(t){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${t}".`}};gB.exports={MergeError:WO,ResolverNotFoundError:JO,InvalidOnConflictOptionError:GO}});var vB=T((vit,_B)=>{"use strict";var{dequal:FTe}=zb(),{MergeError:YO}=KO();function yB(e){let t=e[0];for(let r=1;r<e.length;r++)t=t.filter(n=>e[r].includes(n));return t}function UTe(e,t,r){let n=yB(t);if(n.length===0)throw new YO(e,t);r[e]=n}function ZTe(e,t,r){for(let i=0;i<t.length;i++)Array.isArray(t[i])||(t[i]=[t[i]]);let n=yB(t);if(n.length===0)throw new YO(e,t);n.length===1?r[e]=n[0]:r[e]=n}function VTe(e,t,r){let n=[];for(let i of t)for(let s of i)n.includes(s)||n.push(s);r[e]=n}function HTe(e,t,r){r[e]=Math.min(...t)}function BTe(e,t,r){r[e]=Math.max(...t)}function WTe(e,t,r){let n=(a,u)=>u?n(u,a%u):a,i=(a,u)=>a*u/n(a,u),s=1;for(let a of t)for(;a*s%1!==0;)s*=10;let o=t[0]*s;for(let a of t)o=i(o,a*s);r[e]=o/s}function JTe(e,t,r){let n=t[0];for(let i=1;i<t.length;i++)if(!FTe(t[i],n))throw new YO(e,t);r[e]=n}function GTe(){}function KTe(e,t,r){for(let n of t)if(n===!1){r[e]=!1;return}r[e]=!0}function YTe(e,t,r){for(let n of t)if(n===!0){r[e]=!0;return}r[e]=!1}_B.exports={arraysIntersection:UTe,hybridArraysIntersection:ZTe,arraysUnion:VTe,minNumber:HTe,maxNumber:BTe,commonMultiple:WTe,allEqual:JTe,booleanAnd:KTe,booleanOr:YTe,skip:GTe}});var $B=T((bit,xB)=>{"use strict";var{dequal:XTe}=zb(),br=vB(),qb=KO(),SB={$id:br.skip,type:br.hybridArraysIntersection,enum:br.arraysIntersection,minLength:br.maxNumber,maxLength:br.minNumber,minimum:br.maxNumber,maximum:br.minNumber,multipleOf:br.commonMultiple,exclusiveMinimum:br.maxNumber,exclusiveMaximum:br.minNumber,minItems:br.maxNumber,maxItems:br.minNumber,maxProperties:br.minNumber,minProperties:br.maxNumber,const:br.allEqual,default:br.allEqual,format:br.allEqual,required:br.arraysUnion,properties:iRe,patternProperties:Lb,additionalProperties:Mb,items:tRe,additionalItems:rRe,definitions:Lb,$defs:Lb,nullable:br.booleanAnd,oneOf:bB,anyOf:bB,allOf:br.arraysUnion,not:Mb,if:sRe,then:br.skip,else:br.skip,dependencies:wB,dependentRequired:wB,dependentSchemas:Lb,propertyNames:Mb,uniqueItems:br.booleanOr,contains:Mb};function Mb(e,t,r,n,i){r[e]=Ms(t,i)}function QTe(e){let t=[[]];for(let r of e){let n=[];for(let i of t)for(let s of r)n.push([...i,s]);t=n}return t}function bB(e,t,r,n,i){if(t.length===1){r[e]=t[0];return}let s=QTe(t),o=[];for(let a of s)try{let u=Ms(a,i);u!==void 0&&o.push(u)}catch(u){if(u instanceof qb.MergeError)continue;throw u}r[e]=o}function eRe(e,t){let{items:r,additionalItems:n}=e;return Array.isArray(r)?t<r.length?r[t]:n:r!==void 0?r:n}function tRe(e,t,r,n,i){let s=0;for(let a of t)Array.isArray(a)&&(s=Math.max(s,a.length));if(s===0){r[e]=Ms(t,i);return}let o=[];for(let a=0;a<s;a++){let u=[];for(let l of n){let c=eRe(l,a);c!==void 0&&u.push(c)}o[a]=Ms(u,i)}r[e]=o}function rRe(e,t,r,n,i){let s=!1;for(let a of n)if(Array.isArray(a.items)){s=!0;break}if(!s){r[e]=Ms(t,i);return}let o=[];for(let a of n){let u=a.additionalItems;u===void 0&&!Array.isArray(a.items)&&(u=a.items),u!==void 0&&o.push(u)}r[e]=Ms(o,i)}function nRe(e,t){let{properties:r,patternProperties:n,additionalProperties:i}=e;if(r?.[t]!==void 0)return r[t];for(let s of Object.keys(n??{}))if(new RegExp(s).test(t))return n[s];return i}function iRe(e,t,r,n,i){let s={};for(let a of n){let u=a.properties??{};for(let l of Object.keys(u)){if(s[l]!==void 0)continue;let c=u[l];s[l]=[c];for(let d of n){if(a===d)continue;let p=nRe(d,l);p!==void 0&&s[l].push(p)}}}let o={};for(let a of Object.keys(s)){let u=s[a];o[a]=Ms(u,i)}r[e]=o}function Lb(e,t,r,n,i){let s={};for(let a of t)for(let u of Object.keys(a))s[u]===void 0&&(s[u]=[]),s[u].push(a[u]);let o={};for(let a of Object.keys(s)){let u=s[a],l=Ms(u,i);o[a]=l}r[e]=o}function sRe(e,t,r,n,i){for(let s=0;s<n.length;s++){let o={if:n[s].if,then:n[s].then,else:n[s].else};if(o.if!==void 0){if(r.if===void 0){r.if=o.if,o.then!==void 0&&(r.then=o.then),o.else!==void 0&&(r.else=o.else);continue}r.then!==void 0&&(r.then=Ms([r.then,o],i)),r.else!==void 0&&(r.else=Ms([r.else,o],i))}}}function wB(e,t,r){let n={};for(let i of t)for(let s of Object.keys(i)){n[s]===void 0&&(n[s]=[]);let o=n[s];for(let a of i[s])o.includes(a)||o.push(a)}r[e]=n}function Ms(e,t){if(e.length===0)return{};if(e.length===1)return e[0];let r={},n={},i=!0;for(let s of e){if(s===!1)return!1;if(s!==!0){i=!1;for(let o of Object.keys(s))n[o]===void 0&&(n[o]=[]),n[o].push(s[o])}}if(i)return!0;for(let s of Object.keys(n)){let o=n[s];(t.resolvers[s]??t.defaultResolver)(s,o,r,e,t)}return r}function kB(e,t,r,n,i){let s=i.onConflict??"throw";if(t.length===1||s==="first"){r[e]=t[0];return}let o=!0;for(let a=1;a<t.length;a++)if(!XTe(t[a],t[0])){o=!1;break}if(o){r[e]=t[0];return}if(s==="throw")throw new qb.ResolverNotFoundError(e,t);if(s!=="skip")throw new qb.InvalidOnConflictOptionError(s)}function oRe(e,t={}){return t.defaultResolver===void 0&&(t.defaultResolver=kB),t.resolvers={...SB,...t.resolvers},Ms(e,t)}xB.exports={mergeSchemas:oRe,keywordsResolvers:SB,defaultResolver:kB,...qb}});var TB=T((wit,EB)=>{"use strict";var{mergeSchemas:aRe}=$B();function uRe(e){return aRe(e,{onConflict:"skip"})}EB.exports=uRe});var RB=T((Sit,XO)=>{"use strict";function lRe(e,t,r,n){let i="";t.validatorSchemasIds.size>0?(i+=`const Validator = require('fast-json-stringify/lib/validator')
34
+ `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},NEe=97,AEe=48;function Ka(e,t){let r="",n;for(Ka.message=void 0;n=e[t++],n!=='"';)if(n==="\\")if(n=e[t],n in y9)r+=y9[n],t++;else if(n==="u"){t++;let s=4,o=0;for(;s--;){if(o<<=4,n=e[t],n===void 0){i("unexpected end");return}if(n=n.toLowerCase(),n>="a"&&n<="f")o+=n.charCodeAt(0)-NEe+10;else if(n>="0"&&n<="9")o+=n.charCodeAt(0)-AEe;else{i(`unexpected token ${n}`);return}t++}r+=String.fromCharCode(o)}else{i(`unexpected token ${n}`);return}else if(n===void 0){i("unexpected end");return}else if(n.charCodeAt(0)>=32)r+=n;else{i(`unexpected token ${n}`);return}return Ka.position=t,r;function i(s){Ka.position=t,Ka.message=s}}Ya.parseJsonString=Ka;Ka.message=void 0;Ka.position=0;Ka.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var P9=T($O=>{"use strict";Object.defineProperty($O,"__esModule",{value:!0});var DEe=pO(),S9=bl(),De=qe(),jEe=Fo(),gt=Ki(),zEe=pn(),MEe=Tb(),LEe=rO(),bO=_9(),k9=st(),qEe=tO(),FEe={elements:HEe,values:BEe,discriminator:JEe,properties:v9,optionalProperties:v9,enum:KEe,type:GEe,ref:YEe};function x9(e,t){let r=S9.getCompilingSchema.call(this,e);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new De.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("parse"),u={self:this,gen:o,schema:e.schema,schemaEnv:e,definitions:t,data:gt.default.data,parseName:a,char:o.name("c")},l;try{this._compilations.add(e),e.parseName=a,UEe(u),o.optimize(this.opts.code.optimize);let c=o.toString();l=`${o.scopeRefs(gt.default.scope)}return ${c}`;let p=new Function(`${gt.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:p}),e.parse=p}catch(c){throw l&&this.logger.error("Error compiling parser, function code:",l),delete e.parse,delete e.parseName,c}finally{this._compilations.delete(e)}return e}$O.default=x9;var vO=(0,De._)`undefined`;function UEe(e){let{gen:t,parseName:r,char:n}=e;t.func(r,(0,De._)`${gt.default.json}, ${gt.default.jsonPos}, ${gt.default.jsonPart}`,!1,()=>{t.let(gt.default.data),t.let(n),t.assign((0,De._)`${r}.message`,vO),t.assign((0,De._)`${r}.position`,vO),t.assign(gt.default.jsonPos,(0,De._)`${gt.default.jsonPos} || 0`),t.const(gt.default.jsonLen,(0,De._)`${gt.default.json}.length`),Cb(e),xO(e),t.if(gt.default.jsonPart,()=>{t.assign((0,De._)`${r}.position`,gt.default.jsonPos),t.return(gt.default.data)}),t.if((0,De._)`${gt.default.jsonPos} === ${gt.default.jsonLen}`,()=>t.return(gt.default.data)),xd(e)})}function Cb(e){let t;for(let r of DEe.jtdForms)if(r in e.schema){t=r;break}t?VEe(e,FEe[t]):SO(e)}var ZEe=w9(!0,w9(!1,xd));function VEe(e,t){let{gen:r,schema:n,data:i}=e;if(!n.nullable)return t(e);dm(e,"null",t,()=>r.assign(i,null))}function HEe(e){let{gen:t,schema:r,data:n}=e;fo(e,"[");let i=t.let("i",0);t.assign(n,(0,De._)`[]`),wO(e,"]",()=>{let s=t.let("el");Cb({...e,schema:r.elements,data:s}),t.assign((0,De._)`${n}[${i}++]`,s)})}function BEe(e){let{gen:t,schema:r,data:n}=e;fo(e,"{"),t.assign(n,(0,De._)`{}`),wO(e,"}",()=>WEe(e,r.values))}function wO(e,t,r){$9(e,t,r),fo(e,t)}function $9(e,t,r){let{gen:n}=e;n.for((0,De._)`;${gt.default.jsonPos}<${gt.default.jsonLen} && ${Nb(1)}!==${t};`,()=>{r(),dm(e,",",()=>n.break(),i)});function i(){dm(e,t,()=>{},xd)}}function WEe(e,t){let{gen:r}=e,n=r.let("key");$l({...e,data:n}),fo(e,":"),T9(e,n,t)}function JEe(e){let{gen:t,data:r,schema:n}=e,{discriminator:i,mapping:s}=n;fo(e,"{"),t.assign(r,(0,De._)`{}`);let o=t.const("pos",gt.default.jsonPos),a=t.let("value"),u=t.let("tag");$9(e,"}",()=>{let l=t.let("key");$l({...e,data:l}),fo(e,":"),t.if((0,De._)`${l} === ${i}`,()=>{$l({...e,data:u}),t.assign((0,De._)`${r}[${l}]`,u),t.break()},()=>SO({...e,data:a}))}),t.assign(gt.default.jsonPos,o),t.if((0,De._)`${u} === undefined`),Jo(e,(0,De.str)`discriminator tag not found`);for(let l in s)t.elseIf((0,De._)`${u} === ${l}`),E9({...e,schema:s[l]},i);t.else(),Jo(e,(0,De.str)`discriminator value not in schema`),t.endIf()}function v9(e){let{gen:t,data:r}=e;fo(e,"{"),t.assign(r,(0,De._)`{}`),E9(e)}function E9(e,t){let{gen:r,schema:n,data:i}=e,{properties:s,optionalProperties:o,additionalProperties:a}=n;if(wO(e,"}",()=>{let u=r.let("key");if($l({...e,data:u}),fo(e,":"),r.if(!1),b9(e,u,s),b9(e,u,o),t){r.elseIf((0,De._)`${u} === ${t}`);let l=r.let("tag");$l({...e,data:l})}r.else(),a?SO({...e,data:(0,De._)`${i}[${u}]`}):Jo(e,(0,De.str)`property ${u} not allowed`),r.endIf()}),s){let u=(0,zEe.hasPropFunc)(r),l=(0,De.and)(...Object.keys(s).map(c=>(0,De._)`${u}.call(${i}, ${c})`));r.if((0,De.not)(l),()=>Jo(e,(0,De.str)`missing required properties`))}}function b9(e,t,r={}){let{gen:n}=e;for(let i in r)n.elseIf((0,De._)`${t} === ${i}`),T9(e,t,r[i])}function T9(e,t,r){Cb({...e,schema:r,data:(0,De._)`${e.data}[${t}]`})}function GEe(e){let{gen:t,schema:r,data:n,self:i}=e;switch(r.type){case"boolean":ZEe(e);break;case"string":$l(e);break;case"timestamp":{$l(e);let s=(0,k9.useFunc)(t,qEe.default),{allowDate:o,parseDate:a}=i.opts,u=o?(0,De._)`!${s}(${n}, true)`:(0,De._)`!${s}(${n})`,l=a?(0,De.or)(u,(0,De._)`(${n} = new Date(${n}), false)`,(0,De._)`isNaN(${n}.valueOf())`):u;t.if(l,()=>Jo(e,(0,De.str)`invalid timestamp`));break}case"float32":case"float64":_O(e);break;default:{let s=r.type;if(!i.opts.int32range&&(s==="int32"||s==="uint32"))_O(e,16),s==="uint32"&&t.if((0,De._)`${n} < 0`,()=>Jo(e,(0,De.str)`integer out of range`));else{let[o,a,u]=LEe.intRange[s];_O(e,u),t.if((0,De._)`${n} < ${o} || ${n} > ${a}`,()=>Jo(e,(0,De.str)`integer out of range`))}}}}function $l(e){fo(e,'"'),kO(e,bO.parseJsonString)}function KEe(e){let{gen:t,data:r,schema:n}=e,i=n.enum;fo(e,'"'),t.if(!1);for(let s of i){let o=JSON.stringify(s).slice(1);t.elseIf((0,De._)`${Nb(o.length)} === ${o}`),t.assign(r,(0,De.str)`${s}`),t.add(gt.default.jsonPos,o.length)}t.else(),xd(e),t.endIf()}function _O(e,t){let{gen:r}=e;xO(e),r.if((0,De._)`"-0123456789".indexOf(${Nb(1)}) < 0`,()=>xd(e),()=>kO(e,bO.parseJsonNumber,t))}function w9(e,t){return r=>{let{gen:n,data:i}=r;dm(r,`${e}`,()=>t(r),()=>n.assign(i,e))}}function YEe(e){let{gen:t,self:r,definitions:n,schema:i,schemaEnv:s}=e,{ref:o}=i,a=n[o];if(!a)throw new jEe.default(r.opts.uriResolver,"",o,`No definition ${o}`);if(!(0,MEe.hasRef)(a))return Cb({...e,schema:a});let{root:u}=s,l=x9.call(r,new S9.SchemaEnv({schema:a,root:u}),n);R9(e,XEe(t,l),!0)}function XEe(e,t){return t.parse?e.scopeValue("parse",{ref:t.parse}):(0,De._)`${e.scopeValue("wrapper",{ref:t})}.parse`}function SO(e){kO(e,bO.parseJson)}function kO(e,t,r){R9(e,(0,k9.useFunc)(e.gen,t),r)}function R9(e,t,r){let{gen:n,data:i}=e;n.assign(i,(0,De._)`${t}(${gt.default.json}, ${gt.default.jsonPos}${r?(0,De._)`, ${r}`:De.nil})`),n.assign(gt.default.jsonPos,(0,De._)`${t}.position`),n.if((0,De._)`${i} === undefined`,()=>Jo(e,(0,De._)`${t}.message`))}function fo(e,t){dm(e,t,xd)}function dm(e,t,r,n){let{gen:i}=e,s=t.length;xO(e),i.if((0,De._)`${Nb(s)} === ${t}`,()=>{i.add(gt.default.jsonPos,s),n?.(e)},()=>r(e))}function xO({gen:e,char:t}){e.code((0,De._)`while((${t}=${gt.default.json}[${gt.default.jsonPos}],${t}===" "||${t}==="\\n"||${t}==="\\r"||${t}==="\\t"))${gt.default.jsonPos}++;`)}function Nb(e){return e===1?(0,De._)`${gt.default.json}[${gt.default.jsonPos}]`:(0,De._)`${gt.default.json}.slice(${gt.default.jsonPos}, ${gt.default.jsonPos}+${e})`}function xd(e){Jo(e,(0,De._)`"unexpected token " + ${gt.default.json}[${gt.default.jsonPos}]`)}function Jo({gen:e,parseName:t},r){e.assign((0,De._)`${t}.message`,r),e.assign((0,De._)`${t}.position`,gt.default.jsonPos),e.return(vO)}});var RO=T((cr,TO)=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.MissingRefError=cr.ValidationError=cr.CodeGen=cr.Name=cr.nil=cr.stringify=cr.str=cr._=cr.KeywordCxt=cr.Ajv=void 0;var QEe=aI(),eTe=i9(),tTe=u9(),rTe=g9(),nTe=P9(),EO="JTD-meta-schema",$d=class extends QEe.default{constructor(t={}){super({...t,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(eTe.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema(),this.opts.meta&&this.addMetaSchema(tTe.default,EO,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(EO)?EO:void 0)}compileSerializer(t){let r=this._addSchema(t);return r.serialize||this._compileSerializer(r)}compileParser(t){let r=this._addSchema(t);return r.parse||this._compileParser(r)}_compileSerializer(t){if(rTe.default.call(this,t,t.schema.definitions||{}),!t.serialize)throw new Error("ajv implementation error");return t.serialize}_compileParser(t){if(nTe.default.call(this,t,t.schema.definitions||{}),!t.parse)throw new Error("ajv implementation error");return t.parse}};cr.Ajv=$d;TO.exports=cr=$d;TO.exports.Ajv=$d;Object.defineProperty(cr,"__esModule",{value:!0});cr.default=$d;var iTe=dd();Object.defineProperty(cr,"KeywordCxt",{enumerable:!0,get:function(){return iTe.KeywordCxt}});var Ed=qe();Object.defineProperty(cr,"_",{enumerable:!0,get:function(){return Ed._}});Object.defineProperty(cr,"str",{enumerable:!0,get:function(){return Ed.str}});Object.defineProperty(cr,"stringify",{enumerable:!0,get:function(){return Ed.stringify}});Object.defineProperty(cr,"nil",{enumerable:!0,get:function(){return Ed.nil}});Object.defineProperty(cr,"Name",{enumerable:!0,get:function(){return Ed.Name}});Object.defineProperty(cr,"CodeGen",{enumerable:!0,get:function(){return Ed.CodeGen}});var sTe=Vh();Object.defineProperty(cr,"ValidationError",{enumerable:!0,get:function(){return sTe.default}});var oTe=Fo();Object.defineProperty(cr,"MissingRefError",{enumerable:!0,get:function(){return oTe.default}})});var PO=T((oit,I9)=>{"use strict";var aTe=db();I9.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:aTe,addUsedSchema:!1,allErrors:!1})});var Ab=T(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.formatNames=ho.fastFormats=ho.fullFormats=void 0;function po(e,t){return{validate:e,compare:t}}ho.fullFormats={date:po(A9,NO),time:po(OO(!0),AO),"date-time":po(O9(!0),j9),"iso-time":po(OO(),D9),"iso-date-time":po(O9(),z9),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:pTe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:bTe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:hTe,int32:{type:"number",validate:yTe},int64:{type:"number",validate:_Te},float:{type:"number",validate:N9},double:{type:"number",validate:N9},password:!0,binary:!0};ho.fastFormats={...ho.fullFormats,date:po(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,NO),time:po(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,AO),"date-time":po(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,j9),"iso-time":po(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,D9),"iso-date-time":po(/^\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,z9),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};ho.formatNames=Object.keys(ho.fullFormats);function uTe(e){return e%4===0&&(e%100!==0||e%400===0)}var lTe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cTe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function A9(e){let t=lTe.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&uTe(r)?29:cTe[n])}function NO(e,t){if(e&&t)return e>t?1:e<t?-1:0}var IO=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function OO(e){return function(r){let n=IO.exec(r);if(!n)return!1;let i=+n[1],s=+n[2],o=+n[3],a=n[4],u=n[5]==="-"?-1:1,l=+(n[6]||0),c=+(n[7]||0);if(l>23||c>59||e&&!a)return!1;if(i<=23&&s<=59&&o<60)return!0;let d=s-c*u,p=i-l*u-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&o<61}}function AO(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function D9(e,t){if(!(e&&t))return;let r=IO.exec(e),n=IO.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var CO=/t|\s/i;function O9(e){let t=OO(e);return function(n){let i=n.split(CO);return i.length===2&&A9(i[0])&&t(i[1])}}function j9(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function z9(e,t){if(!(e&&t))return;let[r,n]=e.split(CO),[i,s]=t.split(CO),o=NO(r,i);if(o!==void 0)return o||AO(n,s)}var dTe=/\/|:/,fTe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function pTe(e){return dTe.test(e)&&fTe.test(e)}var C9=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function hTe(e){return C9.lastIndex=0,C9.test(e)}var mTe=-(2**31),gTe=2**31-1;function yTe(e){return Number.isInteger(e)&&e<=gTe&&e>=mTe}function _Te(e){return Number.isInteger(e)}function N9(){return!0}var vTe=/[^\\]\\Z/;function bTe(e){if(vTe.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var M9=T(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.formatLimitDefinition=void 0;var wTe=sm(),js=qe(),Xa=js.operators,Db={formatMaximum:{okStr:"<=",ok:Xa.LTE,fail:Xa.GT},formatMinimum:{okStr:">=",ok:Xa.GTE,fail:Xa.LT},formatExclusiveMaximum:{okStr:"<",ok:Xa.LT,fail:Xa.GTE},formatExclusiveMinimum:{okStr:">",ok:Xa.GT,fail:Xa.LTE}},STe={message:({keyword:e,schemaCode:t})=>(0,js.str)`should be ${Db[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,js._)`{comparison: ${Db[e].okStr}, limit: ${t}}`};Td.formatLimitDefinition={keyword:Object.keys(Db),type:"string",schemaType:"string",$data:!0,error:STe,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:s}=e,{opts:o,self:a}=s;if(!o.validateFormats)return;let u=new wTe.KeywordCxt(s,a.RULES.all.format.definition,"format");u.$data?l():c();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),f=t.const("fmt",(0,js._)`${p}[${u.schemaCode}]`);e.fail$data((0,js.or)((0,js._)`typeof ${f} != "object"`,(0,js._)`${f} instanceof RegExp`,(0,js._)`typeof ${f}.compare != "function"`,d(f)))}function c(){let p=u.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:o.code.formats?(0,js._)`${o.code.formats}${(0,js.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,js._)`${p}.compare(${r}, ${n}) ${Db[i].fail} 0`}},dependencies:["format"]};var kTe=e=>(e.addKeyword(Td.formatLimitDefinition),e);Td.default=kTe});var jb=T((fm,F9)=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});var Rd=Ab(),xTe=M9(),DO=qe(),L9=new DO.Name("fullFormats"),$Te=new DO.Name("fastFormats"),jO=(e,t={keywords:!0})=>{if(Array.isArray(t))return q9(e,t,Rd.fullFormats,L9),e;let[r,n]=t.mode==="fast"?[Rd.fastFormats,$Te]:[Rd.fullFormats,L9],i=t.formats||Rd.formatNames;return q9(e,i,r,n),t.keywords&&(0,xTe.default)(e),e};jO.get=(e,t="full")=>{let n=(t==="fast"?Rd.fastFormats:Rd.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function q9(e,t,r,n){var i,s;(i=(s=e.opts.code).formats)!==null&&i!==void 0||(s.formats=(0,DO._)`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}F9.exports=fm=jO;Object.defineProperty(fm,"__esModule",{value:!0});fm.default=jO});var V9=T((lit,Z9)=>{"use strict";var ETe=sm().default,TTe=RO(),U9=PO(),zO=class{constructor(t,r){r.mode==="JTD"?this.ajv=new TTe(Object.assign({},U9,r.customOptions)):this.ajv=new ETe(Object.assign({},U9,r.customOptions));let n=!0;if(r.plugins&&r.plugins.length>0)for(let s of r.plugins)Array.isArray(s)?(n=n&&s[0].name!=="formatsPlugin",s[0](this.ajv,s[1])):(n=n&&s.name!=="formatsPlugin",s(this.ajv));n&&jb()(this.ajv),r.onCreate?.(this.ajv);let i=Object.values(t);for(let s of i)this.ajv.addSchema(s)}buildValidatorFunction({schema:t}){if(t.$id){let r=this.ajv.getSchema(t.$id);if(r)return r}return this.ajv.compile(t)}};Z9.exports=zO});var B9=T((cit,H9)=>{"use strict";var RTe=RO(),PTe=PO(),MO=class{constructor(t,r){this.ajv=new RTe(Object.assign({},PTe,r))}buildSerializerFunction({schema:t}){return this.ajv.compileSerializer(t)}};H9.exports=MO});var G9=T((hm,J9)=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});var pm=Kv(),zs=nd();function W9(e,t){if(!e.opts.code.source)throw new Error("moduleCode: ajv instance must have code.source option");let{_n:r}=e.scope.opts;return typeof t=="function"?i(t.source):t!==void 0?s(t,n):s(e.schemas,a=>a.meta?void 0:e.compile(a.schema));function n(a){let u=e.getSchema(a);if(!u)throw new Error(`moduleCode: no schema with id ${a}`);return u}function i(a){let u={},l=a?.validateName,c=o(u,a);return e.opts.code.esm?`"use strict";${r}export const validate = ${l};${r}export default ${l};${r}${c}`:`"use strict";${r}module.exports = ${l};${r}module.exports.default = ${l};${r}${c}`}function s(a,u){var l;let c={},d=(0,zs._)`"use strict";`;for(let p in a){let f=u(a[p]);if(f){let h=o(c,f.source),v=e.opts.code.esm?(0,zs._)`export const ${(0,zs.getEsmExportName)(p)}`:(0,zs._)`exports${(0,zs.getProperty)(p)}`;d=(0,zs._)`${d}${r}${v} = ${(l=f.source)===null||l===void 0?void 0:l.validateName};${r}${h}`}}return`${d}`}function o(a,u){if(!u)throw new Error('moduleCode: function does not have "source" property');if(p(u.validateName)===pm.UsedValueState.Completed)return zs.nil;f(u.validateName,pm.UsedValueState.Started);let l=e.scope.scopeCode(u.scopeValues,a,d),c=new zs._Code(`${l}${r}${u.validateCode}`);return u.evaluated?(0,zs._)`${c}${u.validateName}.evaluated = ${u.evaluated};${r}`:c;function d(h){var v;let y=(v=h.value)===null||v===void 0?void 0:v.ref;if(h.prefix==="validate"&&typeof y=="function")return o(a,y.source);if((h.prefix==="root"||h.prefix==="wrapper")&&typeof y=="object"){let{validate:_,validateName:b}=y;if(!b)throw new Error("ajv internal error");let g=e.opts.code.es5?pm.varKinds.var:pm.varKinds.const,m=(0,zs._)`${g} ${h} = {validate: ${b}};`;if(p(b)===pm.UsedValueState.Started)return m;let S=o(a,_?.source);return(0,zs._)`${m}${r}${S}`}}function p(h){var v;return(v=a[h.prefix])===null||v===void 0?void 0:v.get(h)}function f(h,v){let{prefix:y}=h;(a[y]=a[y]||new Map).set(h,v)}}}J9.exports=hm=W9;Object.defineProperty(hm,"__esModule",{value:!0});hm.default=W9});var X9=T((dit,Y9)=>{"use strict";var K9=LO(),ITe=G9().default;function OTe(e={readMode:!0}){if(e.readMode===!0&&!e.restoreFunction)throw new Error("You must provide a restoreFunction options when readMode ON");if(e.readMode!==!0&&!e.storeFunction)throw new Error("You must provide a storeFunction options when readMode OFF");if(e.readMode===!0)return function(){return function(n){return e.restoreFunction(n)}};let t=K9();return function(n,i={}){(!i.customOptions||!i.customOptions.code)&&(i.customOptions=Object.assign({},i.customOptions,{code:{source:!0}}));let s=t(n,i);return function(o){let a=s(o),u=ITe(s[K9.AjvReference].ajv,a);return e.storeFunction(o,u),a}}}Y9.exports=OTe});var LO=T((fit,Pd)=>{"use strict";var eB=Symbol.for("fastify.ajv-compiler.reference"),CTe=V9(),NTe=B9();function qO(e){let t=new Map,r=new Map;return e&&e.jtdSerializer===!0?function(i,s){let o=Q9({},s);if(r.has(o))return r.get(o);let a=new NTe(i,s),u=a.buildSerializerFunction.bind(a);return r.set(o,u),u}:function(i,s){let o=Q9(i,s.customOptions);if(t.has(o))return t.get(o);let a=new CTe(i,s),u=a.buildValidatorFunction.bind(a);return t.set(o,u),s.customOptions.code!==void 0&&(u[eB]=a),u}}function Q9(e,t){let r=JSON.stringify(e),n=JSON.stringify(t);return`${r}${n}`}Pd.exports=qO;Pd.exports.default=qO;Pd.exports.AjvCompiler=qO;Pd.exports.AjvReference=eB;Pd.exports.StandaloneValidator=X9()});var zb=T(nB=>{var tB=Object.prototype.hasOwnProperty;function rB(e,t,r){for(r of e.keys())if(mm(r,t))return r}function mm(e,t){var r,n,i;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&mm(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(i=n,i&&typeof i=="object"&&(i=rB(t,i),!i)||!t.has(i))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(i=n[0],i&&typeof i=="object"&&(i=rB(t,i),!i)||!mm(n[1],t.get(i)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!r||typeof e=="object"){n=0;for(r in e)if(tB.call(e,r)&&++n&&!tB.call(t,r)||!(r in t)||!mm(e[r],t[r]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}nB.dequal=mm});var aB=T((hit,oB)=>{"use strict";var{dequal:iB}=zb(),ATe=Symbol.for("json-schema-ref"),FO=class{#e;#r;#i;#n;#s;constructor(t={}){this.#e={},this.#r={},this.#i=t.insertRefSymbol??!1,this.#n=t.allowEqualDuplicates??!0,this.#s=t.cloneSchemaWithoutRefs??!1}addSchema(t,r,n=!0){n&&(t.$id!==void 0&&t.$id.charAt(0)!=="#"?r=t.$id:this.#o(t,r));let i=t.$id;i!==void 0&&typeof i=="string"&&(i.charAt(0)==="#"?this.#a(t,r,i):(this.#o(t,i),r=i));let s=t.$ref;if(s!==void 0&&typeof s=="string"){let{refSchemaId:o,refJsonPointer:a}=this.#t(s,r);this.#e[r].refs.push({schemaId:o,jsonPointer:a})}for(let o in t)typeof t[o]=="object"&&t[o]!==null&&this.addSchema(t[o],r,!1)}getSchema(t,r="#"){let n=this.#e[t];if(n===void 0)throw new Error(`Cannot resolve ref "${t}${r}". Schema with id "${t}" is not found.`);return n.anchors[r]!==void 0?n.anchors[r]:sB(n.schema,r)}hasSchema(t){return this.#e[t]!==void 0}getSchemaRefs(t){let r=this.#e[t];if(r===void 0)throw new Error(`Schema with id "${t}" is not found.`);return r.refs}getSchemaDependencies(t,r={}){let n=this.#e[t];for(let i of n.refs){let s=i.schemaId;s===t||r[s]!==void 0||(r[s]=this.getSchema(s),this.getSchemaDependencies(s,r))}return r}derefSchema(t){if(this.#r[t]!==void 0)return;let r=this.#e[t];if(r===void 0)throw new Error(`Schema with id "${t}" is not found.`);!this.#s&&r.refs.length===0&&(this.#r[t]={schema:r.schema,anchors:r.anchors});let n=[];this.#u(r.schema,t,!0,n);let i=this.getSchemaDependencies(t);for(let s in i){let o=i[s];this.#u(o,s,!0,n)}for(let s of n){let{refSchemaId:o,refJsonPointer:a}=this.#t(s.ref,s.sourceSchemaId),u=this.getDerefSchema(o,a);if(u===null)throw new Error(`Cannot resolve ref "${s.ref}". Ref "${a}" is not found in schema "${o}".`);s.targetSchema=u,s.targetSchemaId=o}for(let s of n)this.#l(s,n)}getDerefSchema(t,r="#"){let n=this.#r[t];return n===void 0&&(this.derefSchema(t),n=this.#r[t]),n.anchors[r]!==void 0?n.anchors[r]:sB(n.schema,r)}#t(t,r){let n=t.indexOf("#");return n===-1?{refSchemaId:t,refJsonPointer:"#"}:n===0?{refSchemaId:r,refJsonPointer:t}:{refSchemaId:t.slice(0,n),refJsonPointer:t.slice(n)}}#u(t,r,n,i=[]){let s=Array.isArray(t)?[...t]:{...t};n&&(t.$id!==void 0&&t.$id.charAt(0)!=="#"?r=t.$id:this.#c(s,r));let o=s.$id;o!==void 0&&typeof o=="string"&&(o.charAt(0)==="#"?this.#d(s,r,o):(this.#c(s,o),r=o)),s.$ref!==void 0&&i.push({ref:s.$ref,sourceSchemaId:r,sourceSchema:s});for(let a in s){let u=s[a];typeof u=="object"&&u!==null&&(s[a]=this.#u(u,r,!1,i))}return s}#l(t,r){let{sourceSchema:n,targetSchema:i}=t;if(n.$ref){if(this.#i&&(n[ATe]=n.$ref),delete n.$ref,i.$ref){let s=r.find(o=>o.sourceSchema===i);this.#l(s,r)}for(let s in i)if(s!=="$id"){if(n[s]!==void 0){if(iB(n[s],i[s]))continue;throw new Error(`Cannot resolve ref "${t.ref}". Property "${s}" already exists in schema "${t.sourceSchemaId}".`)}n[s]=i[s]}t.isResolved=!0}}#o(t,r){let n=this.#e[r];if(n!==void 0){if(this.#n&&iB(t,n.schema))return;throw new Error(`There is already another schema with id "${r}".`)}this.#e[r]={schema:t,anchors:{},refs:[]}}#a(t,r,n){let{anchors:i}=this.#e[r];if(i[n]!==void 0)throw new Error(`There is already another anchor "${n}" in schema "${r}".`);i[n]=t}#c(t,r){this.#r[r]===void 0&&(this.#r[r]={schema:t,anchors:{}})}#d(t,r,n){let{anchors:i}=this.#r[r];i[n]=t}};function sB(e,t){let r=t.split("/"),n=e;for(let i of r)if(!(i===""||i==="#")){if(typeof n!="object"||n===null)return null;n=n[i]}return n??null}oB.exports={RefResolver:FO}});var ZO=T((mit,uB)=>{"use strict";var DTe=sm(),jTe=db(),zTe=jb(),MTe=kv()({proto:!0}),UO=class e{constructor(t){this.ajv=new DTe({...t,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:jTe}),zTe(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(r,n)=>n&&typeof n.toJSON=="function"}),this._ajvSchemas={},this._ajvOptions=t||{}}addSchema(t,r){let n=t.$id||r;if(t.$id!==void 0&&t.$id[0]==="#"&&(n=r+t.$id),this.ajv.refs[n]===void 0&&this.ajv.schemas[n]===void 0){let i=MTe(t);this.convertSchemaToAjvFormat(i),this.ajv.addSchema(i,n),this._ajvSchemas[n]=t}}validate(t,r){return this.ajv.validate(t,r)}convertSchemaToAjvFormat(t){if(t!==null){t.type==="string"?(t.fjs_type="string",t.type=["string","object"]):Array.isArray(t.type)&&t.type.includes("string")&&!t.type.includes("object")&&(t.fjs_type="string",t.type.push("object"));for(let r in t)typeof t[r]=="object"&&this.convertSchemaToAjvFormat(t[r])}}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState(t){let r=new e(t.ajvOptions);for(let[n,i]of Object.entries(t.ajvSchemas))r.ajv.addSchema(i,n);return r}};uB.exports=UO});var cB=T((git,lB)=>{"use strict";var VO=class e{constructor(t,r,n="#"){this.schema=t,this.schemaId=r,this.jsonPointer=n}getPropertyLocation(t){return new e(this.schema[t],this.schemaId,this.jsonPointer+"/"+t)}getSchemaRef(){return this.schemaId+this.jsonPointer}};lB.exports=VO});var mB=T((yit,BO)=>{"use strict";BO.exports=fe;BO.exports.default=fe;var LTe={$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},dB={enum:["array","boolean","integer","null","number","object","string"]},fB=/^(?:[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,qTe=Ab().fullFormats.uri,pB=Ab().fullFormats.regex;function Qi(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0,a=o;return typeof e=="number"&&!(e%1)&&!isNaN(e)&&isFinite(e)?o===a&&typeof e=="number"&&isFinite(e)&&(e<0||isNaN(e))?(Qi.errors=[{instancePath:t,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1):(Qi.errors=s,o===0):(Qi.errors=[{instancePath:t,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1)}var HO={validate:fe};function Hn(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(o===0)if(Array.isArray(e)){if(e.length<1)return Hn.errors=[{instancePath:t,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var a=!0;let u=e.length;for(let l=0;l<u;l++){let c=o;HO.validate(e[l],{instancePath:t+"/"+l,parentData:e,parentDataProperty:l,rootData:i})||(s=s===null?HO.validate.errors:s.concat(HO.validate.errors),o=s.length);var a=c===o;if(!a)break}}}else return Hn.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return Hn.errors=s,o===0}var hB=em().default;function fe(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(!(e&&typeof e=="object"&&!Array.isArray(e))&&typeof e!="boolean")return fe.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:LTe.type},message:"must be object,boolean"}],!1;if(o===0&&e&&typeof e=="object"&&!Array.isArray(e)){if(e.$id!==void 0){let g=e.$id,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!fB.test(g))return fe.errors=[{instancePath:t+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return fe.errors=[{instancePath:t+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$schema!==void 0){let g=e.$schema,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!qTe(g))return fe.errors=[{instancePath:t+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return fe.errors=[{instancePath:t+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$ref!==void 0){let g=e.$ref,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!fB.test(g))return fe.errors=[{instancePath:t+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return fe.errors=[{instancePath:t+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.$comment!==void 0){let g=o;if(typeof e.$comment!="string")return fe.errors=[{instancePath:t+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.title!==void 0){let g=o;if(typeof e.title!="string")return fe.errors=[{instancePath:t+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.description!==void 0){let g=o;if(typeof e.description!="string")return fe.errors=[{instancePath:t+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.readOnly!==void 0){let g=o;if(typeof e.readOnly!="boolean")return fe.errors=[{instancePath:t+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=g===o}else var a=!0;if(a){if(e.examples!==void 0){let g=o;if(o===g&&!Array.isArray(e.examples))return fe.errors=[{instancePath:t+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(e.multipleOf!==void 0){let g=e.multipleOf,m=o;if(o===m)if(typeof g=="number"&&isFinite(g)){if(g<=0||isNaN(g))return fe.errors=[{instancePath:t+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return fe.errors=[{instancePath:t+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.maximum!==void 0){let g=e.maximum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.exclusiveMaximum!==void 0){let g=e.exclusiveMaximum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.minimum!==void 0){let g=e.minimum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.exclusiveMinimum!==void 0){let g=e.exclusiveMinimum,m=o;if(!(typeof g=="number"&&isFinite(g)))return fe.errors=[{instancePath:t+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=m===o}else var a=!0;if(a){if(e.maxLength!==void 0){let g=e.maxLength,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minLength!==void 0){let g=o;Qi(e.minLength,{instancePath:t+"/minLength",parentData:e,parentDataProperty:"minLength",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.pattern!==void 0){let g=e.pattern,m=o;if(o===m&&o===m)if(typeof g=="string"){if(!pB(g))return fe.errors=[{instancePath:t+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return fe.errors=[{instancePath:t+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===o}else var a=!0;if(a){if(e.additionalItems!==void 0){let g=o;fe(e.additionalItems,{instancePath:t+"/additionalItems",parentData:e,parentDataProperty:"additionalItems",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.items!==void 0){let g=e.items,m=o,S=o,w=!1,k=o;fe(g,{instancePath:t+"/items",parentData:e,parentDataProperty:"items",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var u=k===o;if(w=w||u,!w){let R=o;Hn(g,{instancePath:t+"/items",parentData:e,parentDataProperty:"items",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var u=R===o;w=w||u}if(w)o=S,s!==null&&(S?s.length=S:s=null);else{let R={instancePath:t+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[R]:s.push(R),o++,fe.errors=s,!1}var a=m===o}else var a=!0;if(a){if(e.maxItems!==void 0){let g=e.maxItems,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minItems!==void 0){let g=o;Qi(e.minItems,{instancePath:t+"/minItems",parentData:e,parentDataProperty:"minItems",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.uniqueItems!==void 0){let g=o;if(typeof e.uniqueItems!="boolean")return fe.errors=[{instancePath:t+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=g===o}else var a=!0;if(a){if(e.contains!==void 0){let g=o;fe(e.contains,{instancePath:t+"/contains",parentData:e,parentDataProperty:"contains",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.maxProperties!==void 0){let g=e.maxProperties,m=o,S=o;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return fe.errors=[{instancePath:t+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===S&&typeof g=="number"&&isFinite(g)&&(g<0||isNaN(g)))return fe.errors=[{instancePath:t+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=m===o}else var a=!0;if(a){if(e.minProperties!==void 0){let g=o;Qi(e.minProperties,{instancePath:t+"/minProperties",parentData:e,parentDataProperty:"minProperties",rootData:i})||(s=s===null?Qi.errors:s.concat(Qi.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.required!==void 0){let g=e.required,m=o;if(o===o)if(Array.isArray(g)){var l=!0;let k=g.length;for(let x=0;x<k;x++){let R=o;if(typeof g[x]!="string")return fe.errors=[{instancePath:t+"/required/"+x,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var l=R===o;if(!l)break}if(l){let x=g.length,R;if(x>1){let E={};for(;x--;){let P=g[x];if(typeof P=="string"){if(typeof E[P]=="number"){return R=E[P],fe.errors=[{instancePath:t+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:x,j:R},message:"must NOT have duplicate items (items ## "+R+" and "+x+" are identical)"}],!1;break}E[P]=x}}}}}else return fe.errors=[{instancePath:t+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=m===o}else var a=!0;if(a){if(e.additionalProperties!==void 0){let g=o;fe(e.additionalProperties,{instancePath:t+"/additionalProperties",parentData:e,parentDataProperty:"additionalProperties",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.definitions!==void 0){let g=e.definitions,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=o;fe(g[w],{instancePath:t+"/definitions/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var c=k===o;if(!c)break}else return fe.errors=[{instancePath:t+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.properties!==void 0){let g=e.properties,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=o;fe(g[w],{instancePath:t+"/properties/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var d=k===o;if(!d)break}else return fe.errors=[{instancePath:t+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.patternProperties!==void 0){let g=e.patternProperties,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g)){for(let w in g){let k=o;if(o===k&&typeof w=="string"&&!pB(w)){let x={instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:w};s===null?s=[x]:s.push(x),o++}var p=k===o;if(!p){let x={instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:w},message:"property name must be valid"};return s===null?s=[x]:s.push(x),o++,fe.errors=s,!1;break}}if(p)for(let w in g){let k=o;fe(g[w],{instancePath:t+"/patternProperties/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var f=k===o;if(!f)break}}else return fe.errors=[{instancePath:t+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.dependencies!==void 0){let g=e.dependencies,m=o;if(o===m)if(g&&typeof g=="object"&&!Array.isArray(g))for(let w in g){let k=g[w],x=o,R=o,E=!1,P=o;fe(k,{instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:g,parentDataProperty:w,rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var h=P===o;if(E=E||h,!E){let C=o;if(o===o)if(Array.isArray(k)){var v=!0;let A=k.length;for(let W=0;W<A;W++){let H=o;if(typeof k[W]!="string"){let ne={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+W,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ne]:s.push(ne),o++}var v=H===o;if(!v)break}if(v){let W=k.length,H;if(W>1){let te={};for(;W--;){let ne=k[W];if(typeof ne=="string"){if(typeof te[ne]=="number"){H=te[ne];let Z={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:W,j:H},message:"must NOT have duplicate items (items ## "+H+" and "+W+" are identical)"};s===null?s=[Z]:s.push(Z),o++;break}te[ne]=W}}}}}else{let A={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[A]:s.push(A),o++}var h=C===o;E=E||h}if(E)o=R,s!==null&&(R?s.length=R:s=null);else{let C={instancePath:t+"/dependencies/"+w.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[C]:s.push(C),o++,fe.errors=s,!1}var y=x===o;if(!y)break}else return fe.errors=[{instancePath:t+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===o}else var a=!0;if(a){if(e.propertyNames!==void 0){let g=o;fe(e.propertyNames,{instancePath:t+"/propertyNames",parentData:e,parentDataProperty:"propertyNames",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.enum!==void 0){let g=e.enum,m=o;if(o===m)if(Array.isArray(g)){if(g.length<1)return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{let w=g.length,k;if(w>1){e:for(;w--;)for(k=w;k--;)if(hB(g[w],g[k])){return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:w,j:k},message:"must NOT have duplicate items (items ## "+k+" and "+w+" are identical)"}],!1;break e}}}}else return fe.errors=[{instancePath:t+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=m===o}else var a=!0;if(a){if(e.type!==void 0){let g=e.type,m=o,S=o,w=!1,k=o;if(!(g==="array"||g==="boolean"||g==="integer"||g==="null"||g==="number"||g==="object"||g==="string")){let R={instancePath:t+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:dB.enum},message:"must be equal to one of the allowed values"};s===null?s=[R]:s.push(R),o++}var _=k===o;if(w=w||_,!w){let R=o;if(o===R)if(Array.isArray(g))if(g.length<1){let P={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[P]:s.push(P),o++}else{var b=!0;let P=g.length;for(let C=0;C<P;C++){let $=g[C],N=o;if(!($==="array"||$==="boolean"||$==="integer"||$==="null"||$==="number"||$==="object"||$==="string")){let W={instancePath:t+"/type/"+C,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:dB.enum},message:"must be equal to one of the allowed values"};s===null?s=[W]:s.push(W),o++}var b=N===o;if(!b)break}if(b){let C=g.length,$;if(C>1){e:for(;C--;)for($=C;$--;)if(hB(g[C],g[$])){let N={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:C,j:$},message:"must NOT have duplicate items (items ## "+$+" and "+C+" are identical)"};s===null?s=[N]:s.push(N),o++;break e}}}}else{let P={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[P]:s.push(P),o++}var _=R===o;w=w||_}if(w)o=S,s!==null&&(S?s.length=S:s=null);else{let R={instancePath:t+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[R]:s.push(R),o++,fe.errors=s,!1}var a=m===o}else var a=!0;if(a){if(e.format!==void 0){let g=o;if(typeof e.format!="string")return fe.errors=[{instancePath:t+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.contentMediaType!==void 0){let g=o;if(typeof e.contentMediaType!="string")return fe.errors=[{instancePath:t+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.contentEncoding!==void 0){let g=o;if(typeof e.contentEncoding!="string")return fe.errors=[{instancePath:t+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(e.if!==void 0){let g=o;fe(e.if,{instancePath:t+"/if",parentData:e,parentDataProperty:"if",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.then!==void 0){let g=o;fe(e.then,{instancePath:t+"/then",parentData:e,parentDataProperty:"then",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.else!==void 0){let g=o;fe(e.else,{instancePath:t+"/else",parentData:e,parentDataProperty:"else",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.allOf!==void 0){let g=o;Hn(e.allOf,{instancePath:t+"/allOf",parentData:e,parentDataProperty:"allOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.anyOf!==void 0){let g=o;Hn(e.anyOf,{instancePath:t+"/anyOf",parentData:e,parentDataProperty:"anyOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a){if(e.oneOf!==void 0){let g=o;Hn(e.oneOf,{instancePath:t+"/oneOf",parentData:e,parentDataProperty:"oneOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=g===o}else var a=!0;if(a)if(e.not!==void 0){let g=o;fe(e.not,{instancePath:t+"/not",parentData:e,parentDataProperty:"not",rootData:i})||(s=s===null?fe.errors:s.concat(fe.errors),o=s.length);var a=g===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return fe.errors=s,o===0}});var KO=T((_it,gB)=>{"use strict";var WO=class extends Error{constructor(t,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${t}" keyword schemas.`,this.schemas=r}},JO=class extends Error{constructor(t,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${t}" keyword not found.`,this.schemas=r}},GO=class extends Error{constructor(t){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${t}".`}};gB.exports={MergeError:WO,ResolverNotFoundError:JO,InvalidOnConflictOptionError:GO}});var vB=T((vit,_B)=>{"use strict";var{dequal:FTe}=zb(),{MergeError:YO}=KO();function yB(e){let t=e[0];for(let r=1;r<e.length;r++)t=t.filter(n=>e[r].includes(n));return t}function UTe(e,t,r){let n=yB(t);if(n.length===0)throw new YO(e,t);r[e]=n}function ZTe(e,t,r){for(let i=0;i<t.length;i++)Array.isArray(t[i])||(t[i]=[t[i]]);let n=yB(t);if(n.length===0)throw new YO(e,t);n.length===1?r[e]=n[0]:r[e]=n}function VTe(e,t,r){let n=[];for(let i of t)for(let s of i)n.includes(s)||n.push(s);r[e]=n}function HTe(e,t,r){r[e]=Math.min(...t)}function BTe(e,t,r){r[e]=Math.max(...t)}function WTe(e,t,r){let n=(a,u)=>u?n(u,a%u):a,i=(a,u)=>a*u/n(a,u),s=1;for(let a of t)for(;a*s%1!==0;)s*=10;let o=t[0]*s;for(let a of t)o=i(o,a*s);r[e]=o/s}function JTe(e,t,r){let n=t[0];for(let i=1;i<t.length;i++)if(!FTe(t[i],n))throw new YO(e,t);r[e]=n}function GTe(){}function KTe(e,t,r){for(let n of t)if(n===!1){r[e]=!1;return}r[e]=!0}function YTe(e,t,r){for(let n of t)if(n===!0){r[e]=!0;return}r[e]=!1}_B.exports={arraysIntersection:UTe,hybridArraysIntersection:ZTe,arraysUnion:VTe,minNumber:HTe,maxNumber:BTe,commonMultiple:WTe,allEqual:JTe,booleanAnd:KTe,booleanOr:YTe,skip:GTe}});var $B=T((bit,xB)=>{"use strict";var{dequal:XTe}=zb(),br=vB(),qb=KO(),SB={$id:br.skip,type:br.hybridArraysIntersection,enum:br.arraysIntersection,minLength:br.maxNumber,maxLength:br.minNumber,minimum:br.maxNumber,maximum:br.minNumber,multipleOf:br.commonMultiple,exclusiveMinimum:br.maxNumber,exclusiveMaximum:br.minNumber,minItems:br.maxNumber,maxItems:br.minNumber,maxProperties:br.minNumber,minProperties:br.maxNumber,const:br.allEqual,default:br.allEqual,format:br.allEqual,required:br.arraysUnion,properties:iRe,patternProperties:Lb,additionalProperties:Mb,items:tRe,additionalItems:rRe,definitions:Lb,$defs:Lb,nullable:br.booleanAnd,oneOf:bB,anyOf:bB,allOf:br.arraysUnion,not:Mb,if:sRe,then:br.skip,else:br.skip,dependencies:wB,dependentRequired:wB,dependentSchemas:Lb,propertyNames:Mb,uniqueItems:br.booleanOr,contains:Mb};function Mb(e,t,r,n,i){r[e]=Ms(t,i)}function QTe(e){let t=[[]];for(let r of e){let n=[];for(let i of t)for(let s of r)n.push([...i,s]);t=n}return t}function bB(e,t,r,n,i){if(t.length===1){r[e]=t[0];return}let s=QTe(t),o=[];for(let a of s)try{let u=Ms(a,i);u!==void 0&&o.push(u)}catch(u){if(u instanceof qb.MergeError)continue;throw u}r[e]=o}function eRe(e,t){let{items:r,additionalItems:n}=e;return Array.isArray(r)?t<r.length?r[t]:n:r!==void 0?r:n}function tRe(e,t,r,n,i){let s=0;for(let a of t)Array.isArray(a)&&(s=Math.max(s,a.length));if(s===0){r[e]=Ms(t,i);return}let o=[];for(let a=0;a<s;a++){let u=[];for(let l of n){let c=eRe(l,a);c!==void 0&&u.push(c)}o[a]=Ms(u,i)}r[e]=o}function rRe(e,t,r,n,i){let s=!1;for(let a of n)if(Array.isArray(a.items)){s=!0;break}if(!s){r[e]=Ms(t,i);return}let o=[];for(let a of n){let u=a.additionalItems;u===void 0&&!Array.isArray(a.items)&&(u=a.items),u!==void 0&&o.push(u)}r[e]=Ms(o,i)}function nRe(e,t){let{properties:r,patternProperties:n,additionalProperties:i}=e;if(r?.[t]!==void 0)return r[t];for(let s of Object.keys(n??{}))if(new RegExp(s).test(t))return n[s];return i}function iRe(e,t,r,n,i){let s={};for(let a of n){let u=a.properties??{};for(let l of Object.keys(u)){if(s[l]!==void 0)continue;let c=u[l];s[l]=[c];for(let d of n){if(a===d)continue;let p=nRe(d,l);p!==void 0&&s[l].push(p)}}}let o={};for(let a of Object.keys(s)){let u=s[a];o[a]=Ms(u,i)}r[e]=o}function Lb(e,t,r,n,i){let s={};for(let a of t)for(let u of Object.keys(a))s[u]===void 0&&(s[u]=[]),s[u].push(a[u]);let o={};for(let a of Object.keys(s)){let u=s[a],l=Ms(u,i);o[a]=l}r[e]=o}function sRe(e,t,r,n,i){for(let s=0;s<n.length;s++){let o={if:n[s].if,then:n[s].then,else:n[s].else};if(o.if!==void 0){if(r.if===void 0){r.if=o.if,o.then!==void 0&&(r.then=o.then),o.else!==void 0&&(r.else=o.else);continue}r.then!==void 0&&(r.then=Ms([r.then,o],i)),r.else!==void 0&&(r.else=Ms([r.else,o],i))}}}function wB(e,t,r){let n={};for(let i of t)for(let s of Object.keys(i)){n[s]===void 0&&(n[s]=[]);let o=n[s];for(let a of i[s])o.includes(a)||o.push(a)}r[e]=n}function Ms(e,t){if(e.length===0)return{};if(e.length===1)return e[0];let r={},n={},i=!0;for(let s of e){if(s===!1)return!1;if(s!==!0){i=!1;for(let o of Object.keys(s))n[o]===void 0&&(n[o]=[]),n[o].push(s[o])}}if(i)return!0;for(let s of Object.keys(n)){let o=n[s];(t.resolvers[s]??t.defaultResolver)(s,o,r,e,t)}return r}function kB(e,t,r,n,i){let s=i.onConflict??"throw";if(t.length===1||s==="first"){r[e]=t[0];return}let o=!0;for(let a=1;a<t.length;a++)if(!XTe(t[a],t[0])){o=!1;break}if(o){r[e]=t[0];return}if(s==="throw")throw new qb.ResolverNotFoundError(e,t);if(s!=="skip")throw new qb.InvalidOnConflictOptionError(s)}function oRe(e,t={}){return t.defaultResolver===void 0&&(t.defaultResolver=kB),t.resolvers={...SB,...t.resolvers},Ms(e,t)}xB.exports={mergeSchemas:oRe,keywordsResolvers:SB,defaultResolver:kB,...qb}});var TB=T((wit,EB)=>{"use strict";var{mergeSchemas:aRe}=$B();function uRe(e){return aRe(e,{onConflict:"skip"})}EB.exports=uRe});var RB=T((Sit,XO)=>{"use strict";function lRe(e,t,r,n){let i="";t.validatorSchemasIds.size>0?(i+=`const Validator = require('fast-json-stringify/lib/validator')
35
35
  `,i+=`const validatorState = ${JSON.stringify(n.getState())}
36
36
  `,i+=`const validator = Validator.restoreFromState(validatorState)
37
37
  `):i+=`const validator = null
@@ -338,7 +338,7 @@ ${t}`)}function hw(e,t,r,n){if((e.isLeafNode||n.commonPrefix!==!1)&&(r=r||"(empt
338
338
  if (candidates === 0) return null;
339
339
  `)}for(let n in t.strategies)t.strategies[n].mustMatchWhenDerived&&!this.constraints.includes(n)&&r.push(`if (derivedConstraints.${n} !== undefined) return null`);r.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",r.join(`
340
340
  `))}};zG.exports=zC});var qG=T((qst,LG)=>{"use strict";var DCe=MG(),bw={STATIC:0,PARAMETRIC:1,WILDCARD:2},mw=class{constructor(){this.isLeafNode=!1,this.routes=null,this.handlerStorage=null}addRoute(t,r){this.routes===null&&(this.routes=[]),this.handlerStorage===null&&(this.handlerStorage=new DCe),this.isLeafNode=!0,this.routes.push(t),this.handlerStorage.addHandler(r,t)}},gw=class extends mw{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(t,r){let n=this.staticChildren[t.charAt(r)];return n===void 0||!n.matchPrefix(t,r)?null:n}getStaticChild(t,r=0){if(t.length===r)return this;let n=this.findStaticMatchingChild(t,r);return n?n.getStaticChild(t,r+n.prefix.length):null}createStaticChild(t){if(t.length===0)return this;let r=this.staticChildren[t.charAt(0)];if(r){let i=1;for(;i<r.prefix.length;i++)if(t.charCodeAt(i)!==r.prefix.charCodeAt(i)){r=r.split(this,i);break}return r.createStaticChild(t.slice(i))}let n=t.charAt(0);return this.staticChildren[n]=new yw(t),this.staticChildren[n]}},yw=class e extends gw{constructor(t){super(),this.prefix=t,this.wildcardChild=null,this.parametricChildren=[],this.kind=bw.STATIC,this._compilePrefixMatch()}getParametricChild(t){let r=t&&t.source,n=this.parametricChildren.find(i=>(i.regex&&i.regex.source)===r);return n||null}createParametricChild(t,r,n){let i=this.getParametricChild(t);return i?(i.nodePaths.add(n),i):(i=new _w(t,r,n),this.parametricChildren.push(i),this.parametricChildren.sort((s,o)=>s.isRegex?o.isRegex?s.staticSuffix===null?1:o.staticSuffix===null?-1:o.staticSuffix.endsWith(s.staticSuffix)?1:s.staticSuffix.endsWith(o.staticSuffix)?-1:0:-1:1),i)}getWildcardChild(){return this.wildcardChild}createWildcardChild(){return this.wildcardChild=this.getWildcardChild()||new vw,this.wildcardChild}split(t,r){let n=this.prefix.slice(0,r),i=this.prefix.slice(r);this.prefix=i,this._compilePrefixMatch();let s=new e(n);return s.staticChildren[i.charAt(0)]=this,t.staticChildren[n.charAt(0)]=s,s}getNextNode(t,r,n,i){let s=this.findStaticMatchingChild(t,r),o=0;if(s===null){if(this.parametricChildren.length===0)return this.wildcardChild;s=this.parametricChildren[0],o=1}this.wildcardChild!==null&&n.push({paramsCount:i,brotherPathIndex:r,brotherNode:this.wildcardChild});for(let a=this.parametricChildren.length-1;a>=o;a--)n.push({paramsCount:i,brotherPathIndex:r,brotherNode:this.parametricChildren[a]});return s}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let t=[];for(let r=1;r<this.prefix.length;r++){let n=this.prefix.charCodeAt(r);t.push(`path.charCodeAt(i + ${r}) === ${n}`)}this.matchPrefix=new Function("path","i",`return ${t.join(" && ")}`)}},_w=class extends gw{constructor(t,r,n){super(),this.isRegex=!!t,this.regex=t||null,this.staticSuffix=r||null,this.kind=bw.PARAMETRIC,this.nodePaths=new Set([n])}getNextNode(t,r){return this.findStaticMatchingChild(t,r)}},vw=class extends mw{constructor(){super(),this.kind=bw.WILDCARD}getNextNode(){return null}};LG.exports={StaticNode:yw,ParametricNode:_w,WildcardNode:vw,NODE_TYPES:bw}});var UG=T((Fst,FG)=>{"use strict";var jCe=ie("node:assert");function Im(){if(!(this instanceof Im))return new Im;this.store=new Map,this.maxMajor=0,this.maxMinors={},this.maxPatches={}}Im.prototype.set=function(e,t){if(typeof e!="string")throw new TypeError("Version should be a string");let[r,n,i]=e.split(".",3);if(isNaN(r))throw new TypeError("Major version must be a numeric value");return r=Number(r),n=Number(n)||0,i=Number(i)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.set("x",t),this.store.set("*",t),this.store.set("x.x",t),this.store.set("x.x.x",t)),n>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=n,this.store.set(`${r}.x`,t),this.store.set(`${r}.x.x`,t)),i>=(this.maxPatches[`${r}.${n}`]||0)&&(this.maxPatches[`${r}.${n}`]=i,this.store.set(`${r}.${n}.x`,t)),this.store.set(`${r}.${n}.${i}`,t),this};Im.prototype.get=function(e){return this.store.get(e)};FG.exports={name:"version",mustMatchWhenDerived:!0,storage:Im,validate(e){jCe(typeof e=="string","Version should be a string")}}});var VG=T((Ust,ZG)=>{"use strict";var zCe=ie("node:assert");function MCe(){let e=new Map,t=[];return{get:r=>{let n=e.get(r);if(n)return n;for(let i of t)if(i.host.test(r))return i.value},set:(r,n)=>{r instanceof RegExp?t.push({host:r,value:n}):e.set(r,n)}}}ZG.exports={name:"host",mustMatchWhenDerived:!1,storage:MCe,validate(e){zCe(typeof e=="string"||Object.prototype.toString.call(e)==="[object RegExp]","Host should be a string or a RegExp")}}});var BG=T((Zst,HG)=>{"use strict";var LCe=UG(),qCe=VG(),MC=ie("node:assert"),LC=class{constructor(t){if(this.strategies={version:LCe,host:qCe},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,t)for(let r of Object.values(t))this.addConstraintStrategy(r)}isStrategyUsed(t){return this.strategiesInUse.has(t)||this.asyncStrategiesInUse.has(t)}hasConstraintStrategy(t){let r=this.strategies[t];return r!==void 0?r.isCustom||this.isStrategyUsed(t):!1}addConstraintStrategy(t){if(MC(typeof t.name=="string"&&t.name!=="","strategy.name is required."),MC(t.storage&&typeof t.storage=="function","strategy.storage function is required."),MC(t.deriveConstraint&&typeof t.deriveConstraint=="function","strategy.deriveConstraint function is required."),this.strategies[t.name]&&this.strategies[t.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${t.name}.`);if(this.isStrategyUsed(t.name))throw new Error(`There already exists a route with ${t.name} constraint.`);t.isCustom=!0,t.isAsync=t.deriveConstraint.length===3,this.strategies[t.name]=t,t.mustMatchWhenDerived&&this.noteUsage({[t.name]:t})}deriveConstraints(t,r,n){let i=this.deriveSyncConstraints(t,r);if(n===void 0)return i;this.deriveAsyncConstraints(i,t,r,n)}deriveSyncConstraints(t,r){}noteUsage(t){if(t){let r=this.strategiesInUse.size;for(let n in t)this.strategies[n].isAsync?this.asyncStrategiesInUse.add(n):this.strategiesInUse.add(n);r!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(t){if(!this.strategies[t])throw new Error(`No strategy registered for constraint key ${t}`);return this.strategies[t].storage()}validateConstraints(t){for(let r in t){let n=t[r];if(typeof n>"u")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let i=this.strategies[r];if(!i)throw new Error(`No strategy registered for constraint key ${r}`);i.validate&&i.validate(n)}}deriveAsyncConstraints(t,r,n,i){let s=this.asyncStrategiesInUse.size;if(s===0){i(null,t);return}t=t||{};for(let o of this.asyncStrategiesInUse)this.strategies[o].deriveConstraint(r,n,(u,l)=>{if(u!==null){i(u);return}t[o]=l,--s===0&&i(null,t)})}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let t=["return {"];for(let r of this.strategiesInUse){let n=this.strategies[r];n.isCustom?t.push(` ${n.name}: this.strategies.${r}.deriveConstraint(req, ctx),`):r==="version"?t.push(" version: req.headers['accept-version'],"):t.push(" host: req.headers.host || req.headers[':authority'],")}t.push("}"),this.deriveSyncConstraints=new Function("req","ctx",t.join(`
341
- `)).bind(this)}};HG.exports=LC});var JG=T((Vst,WG)=>{"use strict";var FCe=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];WG.exports=FCe});var YG=T((Hst,KG)=>{"use strict";function GG(e,t){return e===50?t===53?"%":t===51?"#":t===52?"$":t===54?"&":t===66||t===98?"+":t===67||t===99?",":t===70||t===102?"/":null:e===51?t===65||t===97?":":t===66||t===98?";":t===68||t===100?"=":t===70||t===102?"?":null:e===52&&t===48?"@":null}function UCe(e,t){let r=!1,n=!1,i="";for(let o=1;o<e.length;o++){let a=e.charCodeAt(o);if(a===37){let u=e.charCodeAt(o+1),l=e.charCodeAt(o+2);GG(u,l)===null?r=!0:(n=!0,u===50&&l===53&&(r=!0,e=e.slice(0,o+1)+"25"+e.slice(o+1),o+=2),o+=2)}else if(a===63||a===35||a===59&&t){i=e.slice(o+1),e=e.slice(0,o);break}}return{path:r?decodeURI(e):e,querystring:i,shouldDecodeParam:n}}function ZCe(e){let t=e.indexOf("%");if(t===-1)return e;let r="",n=t;for(let i=t;i<e.length;i++)if(e.charCodeAt(i)===37){let s=e.charCodeAt(i+1),o=e.charCodeAt(i+2),a=GG(s,o);r+=e.slice(n,i)+a,n=i+3}return e.slice(0,t)+r+e.slice(n)}KG.exports={safeDecodeURI:UCe,safeDecodeURIComponent:ZCe}});var HC=T((Bst,a5)=>{"use strict";var Fr=ie("node:assert"),VCe=tG(),zd=$G(),UC=qh(),{prettyPrintTree:HCe}=NG(),{StaticNode:XG,NODE_TYPES:QG}=qG(),BCe=BG(),jd=JG(),qC=pw(),{safeDecodeURI:e5,safeDecodeURIComponent:FC}=YG(),t5=/^https?:\/\/.*?\//,Pl=/(\/:[^/()]*?)\?(\/?)/,r5=/[.*+?^${}()|[\]\\]/g,n5=/\/\/+/g;if(!zd(t5))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!zd(Pl))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!zd(r5))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!zd(n5))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function wr(e){if(!(this instanceof wr))return new wr(e);e=e||{},this._opts=e,e.defaultRoute?(Fr(typeof e.defaultRoute=="function","The default route must be a function"),this.defaultRoute=e.defaultRoute):this.defaultRoute=null,e.onBadUrl?(Fr(typeof e.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=e.onBadUrl):this.onBadUrl=null,e.buildPrettyMeta?(Fr(typeof e.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=e.buildPrettyMeta):this.buildPrettyMeta=WCe,e.querystringParser?(Fr(typeof e.querystringParser=="function","querystringParser must be a function"),this.querystringParser=e.querystringParser):this.querystringParser=t=>t.length===0?{}:VCe.parse(t),this.caseSensitive=e.caseSensitive===void 0?!0:e.caseSensitive,this.ignoreTrailingSlash=e.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=e.ignoreDuplicateSlashes||!1,this.maxParamLength=e.maxParamLength||100,this.allowUnsafeRegex=e.allowUnsafeRegex||!1,this.constrainer=new BCe(e.constraints),this.useSemicolonDelimiter=e.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}wr.prototype.on=function(t,r,n,i,s){typeof n=="function"&&(i!==void 0&&(s=i),i=n,n={}),Fr(typeof r=="string","Path should be a string"),Fr(r.length>0,"The path could not be empty"),Fr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),Fr(typeof i=="function","Handler should be a function");let o=r.match(Pl);if(o){Fr(r.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");let l=r.replace(Pl,"$1$2"),c=r.replace(Pl,"$2")||"/";this.on(t,l,n,i,s),this.on(t,c,n,i,s);return}let a=r;this.ignoreDuplicateSlashes&&(r=ZC(r)),this.ignoreTrailingSlash&&(r=VC(r));let u=Array.isArray(t)?t:[t];for(let l of u)Fr(typeof l=="string","Method should be a string"),Fr(jd.includes(l),`Method '${l}' is not an http method.`),this._on(l,r,n,i,s,a)};wr.prototype._on=function(t,r,n,i,s){let o={};n.constraints!==void 0&&(Fr(typeof n.constraints=="object"&&n.constraints!==null,"Constraints should be an object"),Object.keys(n.constraints).length!==0&&(o=n.constraints)),this.constrainer.validateConstraints(o),this.constrainer.noteUsage(o),this.trees[t]===void 0&&(this.trees[t]=new XG("/"));let a=r;if(a==="*"&&this.trees[t].prefix.length!==0){let p=this.trees[t];this.trees[t]=new XG(""),this.trees[t].staticChildren["/"]=p}let u=this.trees[t],l=u.prefix.length,c=[];for(let p=0;p<=a.length;p++){if(a.charCodeAt(p)===58&&a.charCodeAt(p+1)===58){p++;continue}let f=a.charCodeAt(p)===58&&a.charCodeAt(p+1)!==58,h=a.charCodeAt(p)===42;if(f||h||p===a.length&&p!==l){let v=a.slice(l,p);this.caseSensitive||(v=v.toLowerCase()),v=v.replaceAll("::",":"),v=v.replaceAll("%","%25"),u=u.createStaticChild(v)}if(f){let v=!1,y=!0,_="",b=[],g=p+1;for(let m=g;;m++){let S=a.charCodeAt(m),w=S===40,k=S===45||S===46,x=S===47||m===a.length;if(w||k||x){let R=a.slice(g,m);if(c.push(R),v=v||w||k,w){let C=o5(a,m),$=a.slice(m,C+1);this.allowUnsafeRegex||Fr(zd(new RegExp($)),`The regex '${$}' is not safe!`),b.push(s5($)),m=C+1,y=!0}else b.push(y?"(.*?)":`(${_}|(?:(?!${_}).)*)`),y=!1;let E=m;for(;m<a.length;m++){let C=a.charCodeAt(m);if(C===47)break;if(C===58)if(a.charCodeAt(m+1)===58)m++;else break}let P=a.slice(E,m);if(P&&(P=P.replaceAll("::",":"),P=P.replaceAll("%","%25"),b.push(_=i5(P))),g=m+1,x||a.charCodeAt(m)===47||m===a.length){let C=v?"()"+P:P,$=a.slice(p,m);a=a.slice(0,p+1)+C+a.slice(m),p+=C.length;let N=v?new RegExp("^"+b.join("")+"$"):null;u=u.createParametricChild(N,P||null,$),l=p+1;break}}}}else if(h&&(c.push("*"),u=u.createWildcardChild(),l=p+1,p!==a.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(a=a.toLowerCase()),a==="*"&&(a="/*");for(let p of this.routes){let f=p.opts.constraints||{};if(p.method===t&&p.pattern===a&&UC(f,o))throw new Error(`Method '${t}' already declared for route '${a}' with constraints '${JSON.stringify(o)}'`)}let d={method:t,path:r,pattern:a,params:c,opts:n,handler:i,store:s};this.routes.push(d),u.addRoute(d,this.constrainer)};wr.prototype.hasRoute=function(t,r,n){return this.findRoute(t,r,n)!==null};wr.prototype.findRoute=function(t,r,n={}){if(this.trees[t]===void 0)return null;let i=r,s=this.trees[t],o=s.prefix.length,a=[];for(let u=0;u<=i.length;u++){if(i.charCodeAt(u)===58&&i.charCodeAt(u+1)===58){u++;continue}let l=i.charCodeAt(u)===58&&i.charCodeAt(u+1)!==58,c=i.charCodeAt(u)===42;if(l||c||u===i.length&&u!==o){let d=i.slice(o,u);if(this.caseSensitive||(d=d.toLowerCase()),d=d.replaceAll("::",":"),d=d.replaceAll("%","%25"),s=s.getStaticChild(d),s===null)return null}if(l){let d=!1,p=!0,f="",h=[],v=u+1;for(let y=v;;y++){let _=i.charCodeAt(y),b=_===40,g=_===45||_===46,m=_===47||y===i.length;if(b||g||m){let S=i.slice(v,y);if(a.push(S),d=d||b||g,b){let x=o5(i,y),R=i.slice(y,x+1);this.allowUnsafeRegex||Fr(zd(new RegExp(R)),`The regex '${R}' is not safe!`),h.push(s5(R)),y=x+1,p=!1}else h.push(p?"(.*?)":`(${f}|(?:(?!${f}).)*)`),p=!1;let w=y;for(;y<i.length;y++){let x=i.charCodeAt(y);if(x===47)break;if(x===58)if(i.charCodeAt(y+1)===58)y++;else break}let k=i.slice(w,y);if(k&&(k=k.replaceAll("::",":"),k=k.replaceAll("%","%25"),h.push(f=i5(k))),v=y+1,m||i.charCodeAt(y)===47||y===i.length){let x=d?"()"+k:k,R=i.slice(u,y);i=i.slice(0,u+1)+x+i.slice(y),u+=x.length;let E=d?new RegExp("^"+h.join("")+"$"):null;if(s=s.getParametricChild(E,k||null,R),s===null)return null;o=u+1;break}}}}else if(c&&(a.push("*"),s=s.getWildcardChild(),o=u+1,u!==i.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(i=i.toLowerCase());for(let u of this.routes){let l=u.opts.constraints||{};if(u.method===t&&u.pattern===i&&UC(l,n))return{handler:u.handler,store:u.store,params:u.params}}return null};wr.prototype.hasConstraintStrategy=function(e){return this.constrainer.hasConstraintStrategy(e)};wr.prototype.addConstraintStrategy=function(e){this.constrainer.addConstraintStrategy(e),this._rebuild(this.routes)};wr.prototype.reset=function(){this.trees={},this.routes=[]};wr.prototype.off=function(t,r,n){Fr(typeof r=="string","Path should be a string"),Fr(r.length>0,"The path could not be empty"),Fr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),Fr(typeof n>"u"||typeof n=="object"&&!Array.isArray(n)&&n!==null,"Constraints should be an object or undefined.");let i=r.match(Pl);if(i){Fr(r.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");let o=r.replace(Pl,"$1$2"),a=r.replace(Pl,"$2");this.off(t,o,n),this.off(t,a,n);return}this.ignoreDuplicateSlashes&&(r=ZC(r)),this.ignoreTrailingSlash&&(r=VC(r));let s=Array.isArray(t)?t:[t];for(let o of s)this._off(o,r,n)};wr.prototype._off=function(t,r,n){Fr(typeof t=="string","Method should be a string"),Fr(jd.includes(t),`Method '${t}' is not an http method.`);function i(u){return t!==u.method||r!==u.path}function s(u){return i(u)||!UC(n,u.opts.constraints||{})}let o=n?s:i,a=this.routes.filter(o);this._rebuild(a)};wr.prototype.lookup=function(t,r,n,i){if(typeof n=="function"&&(i=n,n=void 0),i===void 0){let s=this.constrainer.deriveConstraints(t,n),o=this.find(t.method,t.url,s);return this.callHandler(o,t,r,n)}this.constrainer.deriveConstraints(t,n,(s,o)=>{if(s!==null){i(s);return}try{let a=this.find(t.method,t.url,o),u=this.callHandler(a,t,r,n);i(null,u)}catch(a){i(a)}})};wr.prototype.callHandler=function(t,r,n,i){return t===null?this._defaultRoute(r,n,i):i===void 0?t.handler(r,n,t.params,t.store,t.searchParams):t.handler.call(i,r,n,t.params,t.store,t.searchParams)};wr.prototype.find=function(t,r,n){let i=this.trees[t];if(i===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(t5,"/")),this.ignoreDuplicateSlashes&&(r=ZC(r));let s,o,a;try{s=e5(r,this.useSemicolonDelimiter),r=s.path,o=s.querystring,a=s.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=VC(r));let u=r;this.caseSensitive===!1&&(r=r.toLowerCase());let l=this.maxParamLength,c=i.prefix.length,d=[],p=r.length,f=[];for(;;){if(c===p&&i.isLeafNode){let _=i.handlerStorage.getMatchingHandler(n);if(_!==null)return{handler:_.handler,store:_.store,params:_._createParamsObject(d),searchParams:this.querystringParser(o)}}let h=i.getNextNode(r,c,f,d.length);if(h===null){if(f.length===0)return null;let _=f.pop();c=_.brotherPathIndex,d.splice(_.paramsCount),h=_.brotherNode}if(i=h,i.kind===QG.STATIC){c+=i.prefix.length;continue}if(i.kind===QG.WILDCARD){let _=u.slice(c);a&&(_=FC(_)),d.push(_),c=p;continue}let v=u.indexOf("/",c);v===-1&&(v=p);let y=u.slice(c,v);if(a&&(y=FC(y)),i.isRegex){let _=i.regex.exec(y);if(_===null)continue;for(let b=1;b<_.length;b++){let g=_[b];if(g.length>l)return null;d.push(g)}}else{if(y.length>l)return null;d.push(y)}c=v}};wr.prototype._rebuild=function(e){this.reset();for(let t of e){let{method:r,path:n,opts:i,handler:s,store:o}=t;this._on(r,n,i,s,o)}};wr.prototype._defaultRoute=function(e,t,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(e,t):this.defaultRoute.call(r,e,t);t.statusCode=404,t.end()};wr.prototype._onBadUrl=function(e){if(this.onBadUrl===null)return null;let t=this.onBadUrl;return{handler:(r,n,i)=>t(e,r,n),params:{},store:null}};wr.prototype.prettyPrint=function(e={}){let t=e.method;e.buildPrettyMeta=this.buildPrettyMeta.bind(this);let r=null;if(t===void 0){let{version:n,host:i,...s}=this.constrainer.strategies;s[qC.name]=qC;let o=new wr({...this._opts,constraints:s}),a=this.routes.map(u=>{let l={...u.opts.constraints,[qC.name]:u.method};return{...u,method:"MERGED",opts:{constraints:l}}});o._rebuild(a),r=o.trees.MERGED}else r=this.trees[t];return r==null?"(empty tree)":HCe(r,e)};for(let e in jd){if(!jd.hasOwnProperty(e))continue;let t=jd[e],r=t.toLowerCase();wr.prototype[r]=function(n,i,s){return this.on(t,n,i,s)}}wr.prototype.all=function(e,t,r){this.on(jd,e,t,r)};wr.sanitizeUrlPath=function(t,r){let n=e5(t,r);return n.shouldDecodeParam?FC(n.path):n.path};a5.exports=wr;function i5(e){return e.replace(r5,"\\$&")}function ZC(e){return e.indexOf("//")!==-1?e.replace(n5,"/"):e}function VC(e){return e.length>1&&e.charCodeAt(e.length-1)===47?e.slice(0,-1):e}function s5(e){return e.charCodeAt(1)===94&&(e=e.slice(0,1)+e.slice(2)),e.charCodeAt(e.length-2)===36&&(e=e.slice(0,e.length-2)+e.slice(e.length-1)),e}function o5(e,t){let r=1;for(;t<e.length;){if(t++,e.charCodeAt(t)===92){t++;continue}if(e.charCodeAt(t)===41?r--:e.charCodeAt(t)===40&&r++,!r)return t}throw new TypeError('Invalid regexp expression in "'+e+'"')}function WCe(e){return e?e.store?Object.assign({},e.store):{}:{}}});var l5=T((Wst,u5)=>{"use strict";function BC(e,t,r,n){if(r===void 0){t.header("content-length","0"),n(null,null);return}if(typeof r.resume=="function"){r.on("error",s=>{t.log.error({err:s},"Error on Stream found for HEAD route")}),r.resume(),n(null,null);return}if(typeof r.getReader=="function"){r.cancel("Stream cancelled by HEAD route").catch(s=>{t.log.error({err:s},"Error on Stream found for HEAD route")}),n(null,null);return}let i=""+Buffer.byteLength(r);t.header("content-length",i),n(null,null)}function JCe(e){return e==null?BC:Array.isArray(e)?[...e,BC]:[e,BC]}u5.exports={parseHeadOnSendHandlers:JCe}});var T5=T((Jst,E5)=>{"use strict";var GCe=HC(),KCe=Uv(),c5=BT(),{onRequestAbortHookRunner:YCe,lifecycleHooks:d5,preParsingHookRunner:XCe,onTimeoutHookRunner:QCe,onRequestHookRunner:e1e}=Da(),{normalizeSchema:t1e}=bh(),{parseHeadOnSendHandlers:r1e}=l5(),{compileSchemasForValidation:n1e,compileSchemasForSerialization:i1e}=UT(),{FST_ERR_SCH_VALIDATION_BUILD:s1e,FST_ERR_SCH_SERIALIZATION_BUILD:o1e,FST_ERR_DUPLICATED_ROUTE:a1e,FST_ERR_INVALID_URL:u1e,FST_ERR_HOOK_INVALID_HANDLER:f5,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:l1e,FST_ERR_ROUTE_DUPLICATED_HANDLER:c1e,FST_ERR_ROUTE_HANDLER_NOT_FN:p5,FST_ERR_ROUTE_MISSING_HANDLER:d1e,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:f1e,FST_ERR_ROUTE_METHOD_INVALID:p1e,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:h1e,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:m1e,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:WC}=tn(),{kRoutePrefix:g1e,kSupportedHTTPMethods:KC,kLogLevel:y1e,kLogSerializers:h5,kHooks:m5,kSchemaController:_1e,kOptions:g5,kReplySerializerDefault:JC,kReplyIsError:v1e,kRequestPayloadStream:b1e,kDisableRequestLogging:y5,kSchemaErrorFormatter:w1e,kErrorHandler:_5,kHasBeenDecorated:v5,kRequestAcceptVersion:GC,kRouteByFastify:S1e,kRouteContext:b5}=Hr(),{buildErrorHandler:k1e}=wh(),{createChildLogger:x1e}=vh(),{getGenReqId:$1e}=nw(),{FSTDEP022:E1e}=Hc(),w5=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function T1e(e){let t=GCe(e),r,n,i,s,o,a,u,l,c,d,p,f,h,v=!1;return{setup(x,R){r=R.avvio,n=R.fourOhFour,i=x.logger,s=R.hasLogger,o=R.setupResponseListeners,a=R.throwIfAlreadyStarted,f=x.exposeHeadRoutes,u=x.disableRequestLogging,typeof u=="function"&&(l=x.disableRequestLogging),c=x.routerOptions.ignoreTrailingSlash,d=x.routerOptions.ignoreDuplicateSlashes,p=Object.hasOwn(x,"return503OnClosing")?x.return503OnClosing:!0,h=R.keepAliveConnections},routing:t.lookup.bind(t),route:w,hasRoute:m,prepareRoute:g,routeHandler:k,closeRoutes:()=>{v=!0},printRoutes:t.prettyPrint.bind(t),addConstraintStrategy:y,hasConstraintStrategy:_,isAsyncConstraint:b,findRoute:S};function y(x){return a("Cannot add constraint strategy!"),t.addConstraintStrategy(x)}function _(x){return t.hasConstraintStrategy(x)}function b(){return t.constrainer.asyncStrategiesInUse.size>0}function g({method:x,url:R,options:E,handler:P,isFastify:C}){if(typeof R!="string")throw new u1e(typeof R);if(!P&&typeof E=="function")P=E,E={};else if(P&&typeof P=="function"){if(Object.prototype.toString.call(E)!=="[object Object]")throw new l1e(x,R);if(E.handler)throw typeof E.handler=="function"?new c1e(x,R):new p5(x,R)}return E=Object.assign({},E,{method:x,url:R,path:R,handler:P||E&&E.handler}),w.call(this,{options:E,isFastify:C})}function m({options:x}){let R=x.method?.toUpperCase()??"";return t.hasRoute(R,x.url||"",x.constraints)}function S(x){let R=t.find(x.method,x.url||"",x.constraints);return R?{handler:R.handler,params:R.params,searchParams:R.searchParams}:null}function w({options:x,isFastify:R}){a("Cannot add route!");let E={...x},P=E.url||E.path||"";if(!E.handler)throw new d1e(E.method,P);if(E.errorHandler!==void 0&&typeof E.errorHandler!="function")throw new p5(E.method,P);$5(E.bodyLimit);let C=E.exposeHeadRoute??f,$=!1,N=!1;if(Array.isArray(E.method))for(let re=0;re<E.method.length;++re)E.method[re]=S5.call(this,E.method[re]),k5.call(this,E.method[re],P,E.schema),$=E.method.includes("GET"),N=E.method.includes("HEAD");else E.method=S5.call(this,E.method),k5.call(this,E.method,P,E.schema),$=E.method==="GET",N=E.method==="HEAD";let A=C&&$?{...x}:null,W=this[g1e];if(P==="/"&&W.length>0&&E.method!=="HEAD")switch(E.prefixTrailingSlash){case"slash":H.call(this,{path:P,isFastify:R});break;case"no-slash":H.call(this,{path:"",isFastify:R});break;case"both":default:H.call(this,{path:"",isFastify:R}),c!==!0&&(d!==!0||!W.endsWith("/"))&&H.call(this,{path:P,prefixing:!0,isFastify:R})}else P[0]==="/"&&W.endsWith("/")?H.call(this,{path:P.slice(1),isFastify:R}):H.call(this,{path:P,isFastify:R});return this;function H({path:re,prefixing:ne=!1,isFastify:Z=!1}){let z=W+re;if(E.url=z,E.path=z,E.routePath=re,E.prefix=W,E.logLevel=E.logLevel||this[y1e],(this[h5]||E.logSerializers)&&(E.logSerializers=Object.assign(Object.create(this[h5]),E.logSerializers)),E.attachValidation==null&&(E.attachValidation=!1),ne===!1)for(let j of this[m5].onRoute)j.call(this,E);for(let j of d5)if(E&&j in E){if(Array.isArray(E[j]))for(let V of E[j]){if(typeof V!="function")throw new f5(j,Object.prototype.toString.call(V));if(j==="onSend"||j==="preSerialization"||j==="onError"||j==="preParsing"){if(V.constructor.name==="AsyncFunction"&&V.length===4)throw new WC}else if(j==="onRequestAbort"){if(V.constructor.name==="AsyncFunction"&&V.length!==1)throw new WC}else if(V.constructor.name==="AsyncFunction"&&V.length===3)throw new WC}else if(E[j]!==void 0&&typeof E[j]!="function")throw new f5(j,Object.prototype.toString.call(E[j]))}let B=E.constraints||{},q={...E.config,url:z,method:E.method},I=new KCe({schema:E.schema,handler:E.handler.bind(this),config:q,errorHandler:E.errorHandler,childLoggerFactory:E.childLoggerFactory,bodyLimit:E.bodyLimit,logLevel:E.logLevel,logSerializers:E.logSerializers,attachValidation:E.attachValidation,schemaErrorFormatter:E.schemaErrorFormatter,replySerializer:this[JC],validatorCompiler:E.validatorCompiler,serializerCompiler:E.serializerCompiler,exposeHeadRoute:C,prefixTrailingSlash:E.prefixTrailingSlash||"both",server:this,isFastify:Z}),O=t.findRoute("HEAD",E.url,B)!==null;try{t.on(E.method,E.url,{constraints:B},k,I)}catch(j){if(!I[S1e])throw j.message.includes(`Method '${E.method}' already declared for route`)?new a1e(E.method,E.url):j}if(this.after((j,V)=>{I.errorHandler=E.errorHandler?k1e(this[_5],E.errorHandler):this[_5],I._parserOptions.limit=E.bodyLimit||null,I.logLevel=E.logLevel,I.logSerializers=E.logSerializers,I.attachValidation=E.attachValidation,I[JC]=this[JC],I.schemaErrorFormatter=E.schemaErrorFormatter||this[w1e]||I.schemaErrorFormatter,r.once("preReady",()=>{for(let Y of d5){let me=this[m5][Y].concat(E[Y]||[]).map(Ce=>Ce.bind(this));I[Y]=me.length?me:null}for(;!I.Request[v5]&&I.Request.parent;)I.Request=I.Request.parent;for(;!I.Reply[v5]&&I.Reply.parent;)I.Reply=I.Reply.parent;if(n.setContext(this,I),E.schema){I.schema=t1e(I.schema,this.initialConfig);let Y=this[_1e],me=E.schema.body||E.schema.headers||E.schema.querystring||E.schema.params;!E.validatorCompiler&&me&&Y.setupValidator(this[g5]);try{let Ce=typeof E?.validatorCompiler=="function"||Y.isCustomValidatorCompiler;n1e(I,E.validatorCompiler||Y.validatorCompiler,Ce)}catch(Ce){throw new s1e(E.method,z,Ce.message)}E.schema.response&&!E.serializerCompiler&&Y.setupSerializer(this[g5]);try{i1e(I,E.serializerCompiler||Y.serializerCompiler)}catch(Ce){throw new o1e(E.method,z,Ce.message)}}}),V(j)}),C&&$&&!N&&!O){let j=r1e(A.onSend);g.call(this,{method:"HEAD",url:re,options:{...A,onSend:j},isFastify:!0})}}}function k(x,R,E,P,C){let $=$1e(P.server,x),N={level:P.logLevel};P.logSerializers&&(N.serializers=P.logSerializers);let A=x1e(P,i,x,$,N);if(A[y5]=l?!1:u,v===!0&&(x.httpVersionMajor!==2&&R.setHeader("Connection","close"),p)){let Z={"Content-Type":"application/json","Content-Length":"80"};R.writeHead(503,Z),R.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),A.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}String.prototype.toLowerCase.call(x.headers.connection||"")==="keep-alive"&&h.has(x.socket)===!1&&(h.add(x.socket),x.socket.on("close",O1e.bind({keepAliveConnections:h,socket:x.socket}))),x.headers[GC]!==void 0&&(x.headers["accept-version"]=x.headers[GC],x.headers[GC]=void 0);let H=new P.Request($,E,x,C,A,P),re=new P.Reply(R,H,A),ne=l?l(H):u;A[y5]=ne,ne===!1&&A.info({req:H},"incoming request"),(s===!0||P.onResponse!==null)&&o(re),P.onRequest!==null?e1e(P.onRequest,H,re,x5):x5(null,H,re),P.onRequestAbort!==null&&x.on("close",()=>{x.aborted&&YCe(P.onRequestAbort,H,R1e.bind(null,re))}),P.onTimeout!==null&&(H.raw.socket._meta||H.raw.socket.on("timeout",P1e),H.raw.socket._meta={context:P,request:H,reply:re})}}function R1e(e,t){t&&e.log.error({err:t},"onRequestAborted hook failed")}function P1e(){let{context:e,request:t,reply:r}=this._meta;QCe(e.onTimeout,t,r,C1e)}function S5(e){if(typeof e!="string")throw new p1e;if(e=e.toUpperCase(),!this[KC].bodyless.has(e)&&!this[KC].bodywith.has(e))throw new f1e(e);return e}function k5(e,t,r){if(this[KC].bodyless.has(e)&&r?.body)throw new h1e(e,t)}function $5(e){if(e!==void 0&&(!Number.isInteger(e)||e<=0))throw new m1e(e)}function x5(e,t,r){if(r.sent!==!0){if(e!=null){r[v1e]=!0,r.send(e);return}t[b1e]=t.raw,t[b5].preParsing!==null?XCe(t[b5].preParsing,t,r,c5.bind(t.server)):c5.call(t.server,null,t,r)}}function I1e(e,t){let r=e.routerOptions||Object.create(null),n=w5.filter(i=>Object.hasOwn(e,i));n.length>0&&E1e(n.join(", "));for(let i of w5)Object.hasOwn(r,i)||(r[i]=e[i]??t[i]);return r}function O1e(){this.keepAliveConnections.delete(this.socket)}function C1e(){}E5.exports={buildRouting:T1e,validateBodyLimitOption:$5,buildRouterOptions:I1e}});var A5=T((Gst,N5)=>{"use strict";var N1e=HC(),R5=Dv(),P5=Fv(),A1e=Uv(),{kRoutePrefix:D1e,kCanSetNotFoundHandler:Om,kFourOhFourLevelInstance:Cm,kFourOhFourContext:_o,kHooks:j1e,kErrorHandler:I5}=Hr(),{lifecycleHooks:z1e}=Da(),{buildErrorHandler:M1e}=wh(),{FST_ERR_NOT_FOUND:L1e}=tn(),{createChildLogger:O5}=vh(),{getGenReqId:C5}=nw();function q1e(e){let{logger:t,disableRequestLogging:r}=e,n=N1e({onBadUrl:a(),defaultRoute:d}),i=null;return{router:n,setNotFoundHandler:l,setContext:u,arrange404:s};function s(p){p[Cm]=p,p[Om]=!0,n.onBadUrl=n.onBadUrl.bind(p),n.defaultRoute=n.defaultRoute.bind(p)}function o(p,f){let{url:h,method:v}=p.raw,y=`Route ${v}:${h} not found`;(typeof r=="function"?r(p.raw):r)||p.log.info(y),f.code(404).send({message:y,error:"Not Found",statusCode:404})}function a(){return function(f,h,v){let y=this[Cm][_o],_=C5(y.server,h),b=O5(y,t,h,_),g=new P5(_,null,h,null,b,y),m=new R5(v,g,b);i(g,m)}}function u(p,f){let h=Object.assign({},p[_o]);h.onSend=f.onSend,f[_o]=h}function l(p,f,h,v){this[Om]===void 0&&(this[Om]=!0),this[_o]===void 0&&(this[_o]=null);let y=this,_=this[D1e]||"/";if(this[Om]===!1)throw new Error(`Not found handler already set for Fastify instance with prefix: '${_}'`);typeof p=="object"&&(p.preHandler&&(Array.isArray(p.preHandler)?p.preHandler=p.preHandler.map(b=>b.bind(y)):p.preHandler=p.preHandler.bind(y)),p.preValidation&&(Array.isArray(p.preValidation)?p.preValidation=p.preValidation.map(b=>b.bind(y)):p.preValidation=p.preValidation.bind(y))),typeof p=="function"&&(f=p,p=void 0),p=p||{},f?(this[Cm][Om]=!1,f=f.bind(this),i=f):(f=o,i=o),this.after((b,g)=>{c.call(this,_,p,f,h,v),g(b)})}function c(p,f,h,v,y){let _=new A1e({schema:f.schema,handler:h,config:f.config||{},server:this});if(v.once("preReady",()=>{let b=this[_o];for(let g of z1e){let m=this[j1e][g].concat(f[g]||[]).map(S=>S.bind(this));b[g]=m.length?m:null}b.errorHandler=f.errorHandler?M1e(this[I5],f.errorHandler):this[I5]}),this[_o]!==null&&p==="/"){Object.assign(this[_o],_);return}this[Cm][_o]=_,n.all(p+(p.endsWith("/")?"*":"/*"),y,_),n.all(p,y,_)}function d(p,f){let h=this[Cm][_o],v=C5(h.server,p),y=O5(h,t,p,v);y.info({req:p},"incoming request");let _=new P5(v,null,p,null,y,h),b=new R5(f,_,y);_.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),_.log.warn(n.prettyPrint()),b.code(404).send(new L1e)}}N5.exports=q1e});var D5=T((Kst,ww)=>{"use strict";ww.exports=St;ww.exports.default=St;var F1e={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72e3},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},bodyLimit:{type:"integer",default:1048576},caseSensitive:{type:"boolean",default:!0},allowUnsafeRegex:{type:"boolean",default:!1},http2:{type:"boolean"},https:{if:{not:{oneOf:[{type:"boolean"},{type:"null"},{type:"object",additionalProperties:!1,required:["allowHTTP1"],properties:{allowHTTP1:{type:"boolean"}}}]}},then:{setDefaultValue:!0}},ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},disableRequestLogging:{default:!1},maxParamLength:{type:"integer",default:100},onProtoPoisoning:{type:"string",default:"error"},onConstructorPoisoning:{type:"string",default:"error"},pluginTimeout:{type:"integer",default:1e4},requestIdHeader:{anyOf:[{type:"boolean"},{type:"string"}],default:!1},requestIdLogLabel:{type:"string",default:"reqId"},http2SessionTimeout:{type:"integer",default:72e3},exposeHeadRoutes:{type:"boolean",default:!0},useSemicolonDelimiter:{type:"boolean",default:!1},routerOptions:{type:"object",additionalProperties:!0,properties:{ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},maxParamLength:{type:"integer",default:100},allowUnsafeRegex:{type:"boolean",default:!1},useSemicolonDelimiter:{type:"boolean",default:!1}}},constraints:{type:"object",additionalProperties:{type:"object",required:["name","storage","validate","deriveConstraint"],additionalProperties:!0,properties:{name:{type:"string"},storage:{},validate:{},deriveConstraint:{}}}}}},U1e=Object.prototype.hasOwnProperty,Z1e=new RegExp("idle","u");function St(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(o===0)if(e&&typeof e=="object"&&!Array.isArray(e)){e.connectionTimeout===void 0&&(e.connectionTimeout=0),e.keepAliveTimeout===void 0&&(e.keepAliveTimeout=72e3),e.maxRequestsPerSocket===void 0&&(e.maxRequestsPerSocket=0),e.requestTimeout===void 0&&(e.requestTimeout=0),e.bodyLimit===void 0&&(e.bodyLimit=1048576),e.caseSensitive===void 0&&(e.caseSensitive=!0),e.allowUnsafeRegex===void 0&&(e.allowUnsafeRegex=!1),e.ignoreTrailingSlash===void 0&&(e.ignoreTrailingSlash=!1),e.ignoreDuplicateSlashes===void 0&&(e.ignoreDuplicateSlashes=!1),e.disableRequestLogging===void 0&&(e.disableRequestLogging=!1),e.maxParamLength===void 0&&(e.maxParamLength=100),e.onProtoPoisoning===void 0&&(e.onProtoPoisoning="error"),e.onConstructorPoisoning===void 0&&(e.onConstructorPoisoning="error"),e.pluginTimeout===void 0&&(e.pluginTimeout=1e4),e.requestIdHeader===void 0&&(e.requestIdHeader=!1),e.requestIdLogLabel===void 0&&(e.requestIdLogLabel="reqId"),e.http2SessionTimeout===void 0&&(e.http2SessionTimeout=72e3),e.exposeHeadRoutes===void 0&&(e.exposeHeadRoutes=!0),e.useSemicolonDelimiter===void 0&&(e.useSemicolonDelimiter=!1);let v=o;for(let y in e)U1e.call(F1e.properties,y)||delete e[y];if(v===o){let y=e.connectionTimeout,_=o;if(!(typeof y=="number"&&!(y%1)&&!isNaN(y)&&isFinite(y))){let b=typeof y,g;if(g===void 0)if(b==="boolean"||y===null||b==="string"&&y&&y==+y&&!(y%1))g=+y;else return St.errors=[{instancePath:t+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;g!==void 0&&(y=g,e!==void 0&&(e.connectionTimeout=g))}var a=_===o;if(a){let b=e.keepAliveTimeout,g=o;if(!(typeof b=="number"&&!(b%1)&&!isNaN(b)&&isFinite(b))){let S=typeof b,w;if(w===void 0)if(S==="boolean"||b===null||S==="string"&&b&&b==+b&&!(b%1))w=+b;else return St.errors=[{instancePath:t+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;w!==void 0&&(b=w,e!==void 0&&(e.keepAliveTimeout=w))}var a=g===o;if(a){if(e.forceCloseConnections!==void 0){let S=e.forceCloseConnections,w=o,k=o,x=!1,R=null,E=o;if(typeof S!="string"){let $=typeof S,N;if(N===void 0)if($=="number"||$=="boolean")N=""+S;else if(S===null)N="";else{let A={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[A]:s.push(A),o++}N!==void 0&&(S=N,e!==void 0&&(e.forceCloseConnections=N))}if(o===E&&typeof S=="string"&&!Z1e.test(S)){let $={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};s===null?s=[$]:s.push($),o++}var u=E===o;u&&(x=!0,R=0);let P=o;if(typeof S!="boolean"){let $;if($===void 0)if(S==="false"||S===0||S===null)$=!1;else if(S==="true"||S===1)$=!0;else{let N={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(S=$,e!==void 0&&(e.forceCloseConnections=$))}var u=P===o;if(u&&x?(x=!1,R=[R,1]):u&&(x=!0,R=1),x)o=k,s!==null&&(k?s.length=k:s=null);else{let $={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[$]:s.push($),o++,St.errors=s,!1}var a=w===o}else var a=!0;if(a){let S=e.maxRequestsPerSocket,w=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S))&&S!==null){let x=typeof S,R;if(R===void 0)if(x==="boolean"||S===null||x==="string"&&S&&S==+S&&!(S%1))R=+S;else if(S===""||S===0||S===!1)R=null;else return St.errors=[{instancePath:t+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;R!==void 0&&(S=R,e!==void 0&&(e.maxRequestsPerSocket=R))}var a=w===o;if(a){let x=e.requestTimeout,R=o;if(!(typeof x=="number"&&!(x%1)&&!isNaN(x)&&isFinite(x))){let P=typeof x,C;if(C===void 0)if(P==="boolean"||x===null||P==="string"&&x&&x==+x&&!(x%1))C=+x;else return St.errors=[{instancePath:t+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;C!==void 0&&(x=C,e!==void 0&&(e.requestTimeout=C))}var a=R===o;if(a){let P=e.bodyLimit,C=o;if(!(typeof P=="number"&&!(P%1)&&!isNaN(P)&&isFinite(P))){let N=typeof P,A;if(A===void 0)if(N==="boolean"||P===null||N==="string"&&P&&P==+P&&!(P%1))A=+P;else return St.errors=[{instancePath:t+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;A!==void 0&&(P=A,e!==void 0&&(e.bodyLimit=A))}var a=C===o;if(a){let N=e.caseSensitive,A=o;if(typeof N!="boolean"){let H;if(H===void 0)if(N==="false"||N===0||N===null)H=!1;else if(N==="true"||N===1)H=!0;else return St.errors=[{instancePath:t+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;H!==void 0&&(N=H,e!==void 0&&(e.caseSensitive=H))}var a=A===o;if(a){let H=e.allowUnsafeRegex,re=o;if(typeof H!="boolean"){let Z;if(Z===void 0)if(H==="false"||H===0||H===null)Z=!1;else if(H==="true"||H===1)Z=!0;else return St.errors=[{instancePath:t+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Z!==void 0&&(H=Z,e!==void 0&&(e.allowUnsafeRegex=Z))}var a=re===o;if(a){if(e.http2!==void 0){let Z=e.http2,z=o;if(typeof Z!="boolean"){let q;if(q===void 0)if(Z==="false"||Z===0||Z===null)q=!1;else if(Z==="true"||Z===1)q=!0;else return St.errors=[{instancePath:t+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;q!==void 0&&(Z=q,e!==void 0&&(e.http2=q))}var a=z===o}else var a=!0;if(a){if(e.https!==void 0){let Z=e.https,z=o,B=o,q=!0,I=o,D=o,O=o,j=o,V=!1,Y=null,me=o;if(typeof Z!="boolean"){let M;if(M===void 0)if(Z==="false"||Z===0||Z===null)M=!1;else if(Z==="true"||Z===1)M=!0;else{let X={};s===null?s=[X]:s.push(X),o++}M!==void 0&&(Z=M,e!==void 0&&(e.https=M))}var l=me===o;l&&(V=!0,Y=0);let Ce=o;if(Z!==null){let M;if(M===void 0)if(Z===""||Z===0||Z===!1)M=null;else{let X={};s===null?s=[X]:s.push(X),o++}M!==void 0&&(Z=M,e!==void 0&&(e.https=M))}var l=Ce===o;if(l&&V)V=!1,Y=[Y,1];else{l&&(V=!0,Y=1);let M=o;if(o===M)if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let ee;if(Z.allowHTTP1===void 0&&(ee="allowHTTP1")){let he={};s===null?s=[he]:s.push(he),o++}else{let he=o;for(let Te in Z)Te!=="allowHTTP1"&&delete Z[Te];if(he===o&&Z.allowHTTP1!==void 0){let Te=Z.allowHTTP1;if(typeof Te!="boolean"){let ze;if(ze===void 0)if(Te==="false"||Te===0||Te===null)ze=!1;else if(Te==="true"||Te===1)ze=!0;else{let _t={};s===null?s=[_t]:s.push(_t),o++}ze!==void 0&&(Te=ze,Z!==void 0&&(Z.allowHTTP1=ze))}}}}else{let ee={};s===null?s=[ee]:s.push(ee),o++}var l=M===o;l&&V?(V=!1,Y=[Y,2]):l&&(V=!0,Y=2)}if(V)o=j,s!==null&&(j?s.length=j:s=null);else{let M={};s===null?s=[M]:s.push(M),o++}var c=O===o;if(c){let M={};s===null?s=[M]:s.push(M),o++}else o=D,s!==null&&(D?s.length=D:s=null);var d=I===o;if(o=B,s!==null&&(B?s.length=B:s=null),d){let M=o;e.https=!0;var d=M===o;q=d}if(!q){let M={instancePath:t+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};return s===null?s=[M]:s.push(M),o++,St.errors=s,!1}var a=z===o}else var a=!0;if(a){let Z=e.ignoreTrailingSlash,z=o;if(typeof Z!="boolean"){let q;if(q===void 0)if(Z==="false"||Z===0||Z===null)q=!1;else if(Z==="true"||Z===1)q=!0;else return St.errors=[{instancePath:t+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;q!==void 0&&(Z=q,e!==void 0&&(e.ignoreTrailingSlash=q))}var a=z===o;if(a){let q=e.ignoreDuplicateSlashes,I=o;if(typeof q!="boolean"){let O;if(O===void 0)if(q==="false"||q===0||q===null)O=!1;else if(q==="true"||q===1)O=!0;else return St.errors=[{instancePath:t+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;O!==void 0&&(q=O,e!==void 0&&(e.ignoreDuplicateSlashes=O))}var a=I===o;if(a){let O=e.maxParamLength,j=o;if(!(typeof O=="number"&&!(O%1)&&!isNaN(O)&&isFinite(O))){let Y=typeof O,me;if(me===void 0)if(Y==="boolean"||O===null||Y==="string"&&O&&O==+O&&!(O%1))me=+O;else return St.errors=[{instancePath:t+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;me!==void 0&&(O=me,e!==void 0&&(e.maxParamLength=me))}var a=j===o;if(a){let Y=e.onProtoPoisoning,me=o;if(typeof Y!="string"){let F=typeof Y,M;if(M===void 0)if(F=="number"||F=="boolean")M=""+Y;else if(Y===null)M="";else return St.errors=[{instancePath:t+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;M!==void 0&&(Y=M,e!==void 0&&(e.onProtoPoisoning=M))}var a=me===o;if(a){let F=e.onConstructorPoisoning,M=o;if(typeof F!="string"){let ee=typeof F,he;if(he===void 0)if(ee=="number"||ee=="boolean")he=""+F;else if(F===null)he="";else return St.errors=[{instancePath:t+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;he!==void 0&&(F=he,e!==void 0&&(e.onConstructorPoisoning=he))}var a=M===o;if(a){let ee=e.pluginTimeout,he=o;if(!(typeof ee=="number"&&!(ee%1)&&!isNaN(ee)&&isFinite(ee))){let ze=typeof ee,_t;if(_t===void 0)if(ze==="boolean"||ee===null||ze==="string"&&ee&&ee==+ee&&!(ee%1))_t=+ee;else return St.errors=[{instancePath:t+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;_t!==void 0&&(ee=_t,e!==void 0&&(e.pluginTimeout=_t))}var a=he===o;if(a){let ze=e.requestIdHeader,_t=o,Ot=o,jt=!1,ft=o;if(typeof ze!="boolean"){let it;if(it===void 0)if(ze==="false"||ze===0||ze===null)it=!1;else if(ze==="true"||ze===1)it=!0;else{let Ia={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[Ia]:s.push(Ia),o++}it!==void 0&&(ze=it,e!==void 0&&(e.requestIdHeader=it))}var p=ft===o;if(jt=jt||p,!jt){let it=o;if(typeof ze!="string"){let Oa=typeof ze,nr;if(nr===void 0)if(Oa=="number"||Oa=="boolean")nr=""+ze;else if(ze===null)nr="";else{let ii={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ii]:s.push(ii),o++}nr!==void 0&&(ze=nr,e!==void 0&&(e.requestIdHeader=nr))}var p=it===o;jt=jt||p}if(jt)o=Ot,s!==null&&(Ot?s.length=Ot:s=null);else{let it={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[it]:s.push(it),o++,St.errors=s,!1}var a=_t===o;if(a){let it=e.requestIdLogLabel,Ia=o;if(typeof it!="string"){let nr=typeof it,ii;if(ii===void 0)if(nr=="number"||nr=="boolean")ii=""+it;else if(it===null)ii="";else return St.errors=[{instancePath:t+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;ii!==void 0&&(it=ii,e!==void 0&&(e.requestIdLogLabel=ii))}var a=Ia===o;if(a){let nr=e.http2SessionTimeout,ii=o;if(!(typeof nr=="number"&&!(nr%1)&&!isNaN(nr)&&isFinite(nr))){let Bi=typeof nr,rl;if(rl===void 0)if(Bi==="boolean"||nr===null||Bi==="string"&&nr&&nr==+nr&&!(nr%1))rl=+nr;else return St.errors=[{instancePath:t+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;rl!==void 0&&(nr=rl,e!==void 0&&(e.http2SessionTimeout=rl))}var a=ii===o;if(a){let Bi=e.exposeHeadRoutes,rl=o;if(typeof Bi!="boolean"){let si;if(si===void 0)if(Bi==="false"||Bi===0||Bi===null)si=!1;else if(Bi==="true"||Bi===1)si=!0;else return St.errors=[{instancePath:t+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;si!==void 0&&(Bi=si,e!==void 0&&(e.exposeHeadRoutes=si))}var a=rl===o;if(a){let si=e.useSemicolonDelimiter,Sde=o;if(typeof si!="boolean"){let rt;if(rt===void 0)if(si==="false"||si===0||si===null)rt=!1;else if(si==="true"||si===1)rt=!0;else return St.errors=[{instancePath:t+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;rt!==void 0&&(si=rt,e!==void 0&&(e.useSemicolonDelimiter=rt))}var a=Sde===o;if(a){if(e.routerOptions!==void 0){let rt=e.routerOptions,ih=o;if(o===ih)if(rt&&typeof rt=="object"&&!Array.isArray(rt)){rt.ignoreTrailingSlash===void 0&&(rt.ignoreTrailingSlash=!1),rt.ignoreDuplicateSlashes===void 0&&(rt.ignoreDuplicateSlashes=!1),rt.maxParamLength===void 0&&(rt.maxParamLength=100),rt.allowUnsafeRegex===void 0&&(rt.allowUnsafeRegex=!1),rt.useSemicolonDelimiter===void 0&&(rt.useSemicolonDelimiter=!1);let Wi=rt.ignoreTrailingSlash,Ti=o;if(typeof Wi!="boolean"){let dn;if(dn===void 0)if(Wi==="false"||Wi===0||Wi===null)dn=!1;else if(Wi==="true"||Wi===1)dn=!0;else return St.errors=[{instancePath:t+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;dn!==void 0&&(Wi=dn,rt!==void 0&&(rt.ignoreTrailingSlash=dn))}var f=Ti===o;if(f){let dn=rt.ignoreDuplicateSlashes,Ca=o;if(typeof dn!="boolean"){let Rr;if(Rr===void 0)if(dn==="false"||dn===0||dn===null)Rr=!1;else if(dn==="true"||dn===1)Rr=!0;else return St.errors=[{instancePath:t+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Rr!==void 0&&(dn=Rr,rt!==void 0&&(rt.ignoreDuplicateSlashes=Rr))}var f=Ca===o;if(f){let Rr=rt.maxParamLength,Na=o;if(!(typeof Rr=="number"&&!(Rr%1)&&!isNaN(Rr)&&isFinite(Rr))){let to=typeof Rr,nl;if(nl===void 0)if(to==="boolean"||Rr===null||to==="string"&&Rr&&Rr==+Rr&&!(Rr%1))nl=+Rr;else return St.errors=[{instancePath:t+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;nl!==void 0&&(Rr=nl,rt!==void 0&&(rt.maxParamLength=nl))}var f=Na===o;if(f){let to=rt.allowUnsafeRegex,nl=o;if(typeof to!="boolean"){let oi;if(oi===void 0)if(to==="false"||to===0||to===null)oi=!1;else if(to==="true"||to===1)oi=!0;else return St.errors=[{instancePath:t+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;oi!==void 0&&(to=oi,rt!==void 0&&(rt.allowUnsafeRegex=oi))}var f=nl===o;if(f){let oi=rt.useSemicolonDelimiter,kde=o;if(typeof oi!="boolean"){let Lc;if(Lc===void 0)if(oi==="false"||oi===0||oi===null)Lc=!1;else if(oi==="true"||oi===1)Lc=!0;else return St.errors=[{instancePath:t+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Lc!==void 0&&(oi=Lc,rt!==void 0&&(rt.useSemicolonDelimiter=Lc))}var f=kde===o}}}}}else return St.errors=[{instancePath:t+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=ih===o}else var a=!0;if(a)if(e.constraints!==void 0){let rt=e.constraints,ih=o;if(o===ih)if(rt&&typeof rt=="object"&&!Array.isArray(rt))for(let Wi in rt){let Ti=rt[Wi],dn=o;if(o===dn)if(Ti&&typeof Ti=="object"&&!Array.isArray(Ti)){let Ca;if(Ti.name===void 0&&(Ca="name")||Ti.storage===void 0&&(Ca="storage")||Ti.validate===void 0&&(Ca="validate")||Ti.deriveConstraint===void 0&&(Ca="deriveConstraint"))return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:Ca},message:"must have required property '"+Ca+"'"}],!1;if(Ti.name!==void 0){let sh=Ti.name;if(typeof sh!="string"){let Rr=typeof sh,Na;if(Na===void 0)if(Rr=="number"||Rr=="boolean")Na=""+sh;else if(sh===null)Na="";else return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;Na!==void 0&&(sh=Na,Ti!==void 0&&(Ti.name=Na))}}}else return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var h=dn===o;if(!h)break}else return St.errors=[{instancePath:t+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=ih===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}else return St.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return St.errors=s,o===0}ww.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72e3,maxRequestsPerSocket:0,requestTimeout:0,bodyLimit:1048576,caseSensitive:!0,allowUnsafeRegex:!1,disableRequestLogging:!1,ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,onProtoPoisoning:"error",onConstructorPoisoning:"error",pluginTimeout:1e4,requestIdHeader:!1,requestIdLogLabel:"reqId",http2SessionTimeout:72e3,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var j5=T((Yst,kw)=>{"use strict";var Sw=D5(),V1e=kv()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:H1e}=tn();function B1e(e){let t=V1e(e);if(!Sw(t)){let r=new H1e(JSON.stringify(Sw.errors.map(n=>n.message)));throw r.errors=Sw.errors,r}return YC(t)}function YC(e){let t=Object.getOwnPropertyNames(e);for(let r of t){let n=e[r];ArrayBuffer.isView(n)&&!(n instanceof DataView)||(e[r]=n&&typeof n=="object"?YC(n):n)}return Object.freeze(e)}kw.exports=B1e;kw.exports.defaultInitOptions=Sw.defaultInitOptions;kw.exports.utils={deepFreezeObject:YC}});var H5=T((Xst,V5)=>{"use strict";var{kAvvioBoot:W1e,kChildren:z5,kRoutePrefix:M5,kLogLevel:L5,kLogSerializers:XC,kHooks:QC,kSchemaController:Md,kContentTypeParser:q5,kReply:F5,kRequest:U5,kFourOhFour:J1e,kPluginNameChain:Z5,kErrorHandlerAlreadySet:G1e}=Hr(),K1e=Dv(),Y1e=Fv(),X1e=nC(),Q1e=pP(),{buildHooks:eNe}=Da(),Nm=RC();V5.exports=function(t,r,n){let i=Nm.registerPlugin.call(t,r),s=Nm.getPluginName(r)||Nm.getFuncPreview(r);if(i)return t[Z5].push(s),t;let o=Object.create(t);t[z5].push(o),o.ready=t[W1e].bind(o),o[z5]=[],o[F5]=K1e.buildReply(o[F5]),o[U5]=Y1e.buildRequest(o[U5]),o[q5]=Q1e.helpers.buildContentTypeParser(o[q5]),o[QC]=eNe(o[QC]),o[M5]=tNe(o[M5],n.prefix),o[L5]=n.logLevel||o[L5],o[Md]=X1e.buildSchemaController(t[Md]),o.getSchema=o[Md].getSchema.bind(o[Md]),o.getSchemas=o[Md].getSchemas.bind(o[Md]),o[Nm.kRegisteredPlugins]=Object.create(o[Nm.kRegisteredPlugins]),o[Z5]=[s],o[G1e]=!1,(o[XC]||n.logSerializers)&&(o[XC]=Object.assign(Object.create(o[XC]),n.logSerializers)),n.prefix&&o[J1e].arrange404(o);for(let a of o[QC].onRegister)a.call(t,o,n);return o};function tNe(e,t){return t?(e.endsWith("/")&&t[0]==="/"?t=t.slice(1):t[0]!=="/"&&(t="/"+t),e+t):e}});var K5=T(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.parseCookie=J5;vo.parse=J5;vo.stringifyCookie=aNe;vo.stringifySetCookie=xw;vo.serialize=xw;vo.parseSetCookie=uNe;vo.stringifySetCookie=xw;vo.serialize=xw;var B5=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,W5=/^[\u0021-\u003A\u003C-\u007E]*$/,rNe=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,nNe=/^[\u0020-\u003A\u003D-\u007E]*$/,iNe=/^-?\d+$/,sNe=Object.prototype.toString,oNe=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function J5(e,t){let r=new oNe,n=e.length;if(n<2)return r;let i=t?.decode||G5,s=0;do{let o=t1(e,s,n);if(o===-1)break;let a=e1(e,s,n);if(o>a){s=e.lastIndexOf(";",o-1)+1;continue}let u=eu(e,s,o);r[u]===void 0&&(r[u]=i(eu(e,o+1,a))),s=a+1}while(s<n);return r}function aNe(e,t){let r=t?.encode||encodeURIComponent,n=[];for(let i of Object.keys(e)){let s=e[i];if(s===void 0)continue;if(!B5.test(i))throw new TypeError(`cookie name is invalid: ${i}`);let o=r(s);if(!W5.test(o))throw new TypeError(`cookie val is invalid: ${s}`);n.push(`${i}=${o}`)}return n.join("; ")}function xw(e,t,r){let n=typeof e=="object"?e:{...r,name:e,value:String(t)},s=(typeof t=="object"?t:r)?.encode||encodeURIComponent;if(!B5.test(n.name))throw new TypeError(`argument name is invalid: ${n.name}`);let o=n.value?s(n.value):"";if(!W5.test(o))throw new TypeError(`argument val is invalid: ${n.value}`);let a=n.name+"="+o;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!rNe.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!nNe.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!lNe(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function uNe(e,t){let r=t?.decode||G5,n=e.length,i=e1(e,0,n),s=t1(e,0,i),o=s===-1?{name:"",value:r(eu(e,0,i))}:{name:eu(e,0,s),value:r(eu(e,s+1,i))},a=i+1;for(;a<n;){let u=e1(e,a,n),l=t1(e,a,u),c=l===-1?eu(e,a,u):eu(e,a,l),d=l===-1?void 0:eu(e,l+1,u);switch(c.toLowerCase()){case"httponly":o.httpOnly=!0;break;case"secure":o.secure=!0;break;case"partitioned":o.partitioned=!0;break;case"domain":o.domain=d;break;case"path":o.path=d;break;case"max-age":d&&iNe.test(d)&&(o.maxAge=Number(d));break;case"expires":if(!d)break;let p=new Date(d);Number.isFinite(p.valueOf())&&(o.expires=p);break;case"priority":if(!d)break;let f=d.toLowerCase();(f==="low"||f==="medium"||f==="high")&&(o.priority=f);break;case"samesite":if(!d)break;let h=d.toLowerCase();(h==="lax"||h==="strict"||h==="none")&&(o.sameSite=h);break}a=u+1}return o}function e1(e,t,r){let n=e.indexOf(";",t);return n===-1?r:n}function t1(e,t,r){let n=e.indexOf("=",t);return n<r?n:-1}function eu(e,t,r){let n=t,i=r;do{let s=e.charCodeAt(n);if(s!==32&&s!==9)break}while(++n<i);for(;i>n;){let s=e.charCodeAt(i-1);if(s!==32&&s!==9)break;i--}return e.slice(n,i)}function G5(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function lNe(e){return sNe.call(e)==="[object Date]"}});var X5=T((eot,$w)=>{"use strict";var{format:r1}=ie("node:util");function cNe(e){return Y5({...e,name:"DeprecationWarning"})}function Y5({name:e,code:t,message:r,unlimited:n=!1}={}){if(!e)throw new Error("Warning name must not be empty");if(!t)throw new Error("Warning code must not be empty");if(!r)throw new Error("Warning message must not be empty");if(typeof n!="boolean")throw new Error("Warning opts.unlimited must be a boolean");t=t.toUpperCase();let i={[e]:function(o,a,u){s.emitted===!0&&s.unlimited!==!0||(s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code))}};n&&(i={[e]:function(o,a,u){s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code)}});let s=i[e];return s.emitted=!1,s.message=r,s.unlimited=n,s.code=t,s.format=function(o,a,u){let l;return o&&a&&u?l=r1(r,o,a,u):o&&a?l=r1(r,o,a):o?l=r1(r,o):l=r,l},s}var n1={createWarning:Y5,createDeprecation:cNe};$w.exports=n1;$w.exports.default=n1;$w.exports.processWarning=n1});var t3=T((tot,e3)=>{"use strict";var{URL:Q5}=ie("node:url"),i1="http://localhost";e3.exports=function(t,r){(typeof t=="string"||Object.prototype.toString.call(t)==="[object String]")&&t.startsWith("//")&&(t=i1+t);let n=typeof t=="object"?Object.assign(new Q5(i1),t):new Q5(t,i1);if(typeof r=="string"){r=new URLSearchParams(r);for(let i of r.keys()){n.searchParams.delete(i);for(let s of r.getAll(i))n.searchParams.append(i,s)}}else{let i=Object.assign({},t.query,r);for(let s in i){let o=i[s];if(Array.isArray(o)){n.searchParams.delete(s);for(let a of o)n.searchParams.append(s,a)}else n.searchParams.set(s,o)}}return n}});var r3=T((rot,s1)=>{"use strict";var{randomUUID:dNe}=ie("node:crypto"),{Readable:fNe}=ie("node:stream"),Ld;function pNe(e){return e&&typeof e=="object"&&typeof e.append=="function"&&typeof e.delete=="function"&&typeof e.get=="function"&&typeof e.getAll=="function"&&typeof e.has=="function"&&typeof e.set=="function"&&e[Symbol.toStringTag]==="FormData"}function hNe(e){Ld=Ld??new TextEncoder;let t=`----formdata-${dNe()}`,r=`--${t}\r
341
+ `)).bind(this)}};HG.exports=LC});var JG=T((Vst,WG)=>{"use strict";var FCe=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];WG.exports=FCe});var YG=T((Hst,KG)=>{"use strict";function GG(e,t){return e===50?t===53?"%":t===51?"#":t===52?"$":t===54?"&":t===66||t===98?"+":t===67||t===99?",":t===70||t===102?"/":null:e===51?t===65||t===97?":":t===66||t===98?";":t===68||t===100?"=":t===70||t===102?"?":null:e===52&&t===48?"@":null}function UCe(e,t){let r=!1,n=!1,i="";for(let o=1;o<e.length;o++){let a=e.charCodeAt(o);if(a===37){let u=e.charCodeAt(o+1),l=e.charCodeAt(o+2);GG(u,l)===null?r=!0:(n=!0,u===50&&l===53&&(r=!0,e=e.slice(0,o+1)+"25"+e.slice(o+1),o+=2),o+=2)}else if(a===63||a===35||a===59&&t){i=e.slice(o+1),e=e.slice(0,o);break}}return{path:r?decodeURI(e):e,querystring:i,shouldDecodeParam:n}}function ZCe(e){let t=e.indexOf("%");if(t===-1)return e;let r="",n=t;for(let i=t;i<e.length;i++)if(e.charCodeAt(i)===37){let s=e.charCodeAt(i+1),o=e.charCodeAt(i+2),a=GG(s,o);r+=e.slice(n,i)+a,n=i+3}return e.slice(0,t)+r+e.slice(n)}KG.exports={safeDecodeURI:UCe,safeDecodeURIComponent:ZCe}});var HC=T((Bst,a5)=>{"use strict";var Fr=ie("node:assert"),VCe=tG(),zd=$G(),UC=qh(),{prettyPrintTree:HCe}=NG(),{StaticNode:XG,NODE_TYPES:QG}=qG(),BCe=BG(),jd=JG(),qC=pw(),{safeDecodeURI:e5,safeDecodeURIComponent:FC}=YG(),t5=/^https?:\/\/.*?\//,Pl=/(\/:[^/()]*?)\?(\/?)/,r5=/[.*+?^${}()|[\]\\]/g,n5=/\/\/+/g;if(!zd(t5))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!zd(Pl))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!zd(r5))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!zd(n5))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function wr(e){if(!(this instanceof wr))return new wr(e);e=e||{},this._opts=e,e.defaultRoute?(Fr(typeof e.defaultRoute=="function","The default route must be a function"),this.defaultRoute=e.defaultRoute):this.defaultRoute=null,e.onBadUrl?(Fr(typeof e.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=e.onBadUrl):this.onBadUrl=null,e.buildPrettyMeta?(Fr(typeof e.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=e.buildPrettyMeta):this.buildPrettyMeta=WCe,e.querystringParser?(Fr(typeof e.querystringParser=="function","querystringParser must be a function"),this.querystringParser=e.querystringParser):this.querystringParser=t=>t.length===0?{}:VCe.parse(t),this.caseSensitive=e.caseSensitive===void 0?!0:e.caseSensitive,this.ignoreTrailingSlash=e.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=e.ignoreDuplicateSlashes||!1,this.maxParamLength=e.maxParamLength||100,this.allowUnsafeRegex=e.allowUnsafeRegex||!1,this.constrainer=new BCe(e.constraints),this.useSemicolonDelimiter=e.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}wr.prototype.on=function(t,r,n,i,s){typeof n=="function"&&(i!==void 0&&(s=i),i=n,n={}),Fr(typeof r=="string","Path should be a string"),Fr(r.length>0,"The path could not be empty"),Fr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),Fr(typeof i=="function","Handler should be a function");let o=r.match(Pl);if(o){Fr(r.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");let l=r.replace(Pl,"$1$2"),c=r.replace(Pl,"$2")||"/";this.on(t,l,n,i,s),this.on(t,c,n,i,s);return}let a=r;this.ignoreDuplicateSlashes&&(r=ZC(r)),this.ignoreTrailingSlash&&(r=VC(r));let u=Array.isArray(t)?t:[t];for(let l of u)Fr(typeof l=="string","Method should be a string"),Fr(jd.includes(l),`Method '${l}' is not an http method.`),this._on(l,r,n,i,s,a)};wr.prototype._on=function(t,r,n,i,s){let o={};n.constraints!==void 0&&(Fr(typeof n.constraints=="object"&&n.constraints!==null,"Constraints should be an object"),Object.keys(n.constraints).length!==0&&(o=n.constraints)),this.constrainer.validateConstraints(o),this.constrainer.noteUsage(o),this.trees[t]===void 0&&(this.trees[t]=new XG("/"));let a=r;if(a==="*"&&this.trees[t].prefix.length!==0){let p=this.trees[t];this.trees[t]=new XG(""),this.trees[t].staticChildren["/"]=p}let u=this.trees[t],l=u.prefix.length,c=[];for(let p=0;p<=a.length;p++){if(a.charCodeAt(p)===58&&a.charCodeAt(p+1)===58){p++;continue}let f=a.charCodeAt(p)===58&&a.charCodeAt(p+1)!==58,h=a.charCodeAt(p)===42;if(f||h||p===a.length&&p!==l){let v=a.slice(l,p);this.caseSensitive||(v=v.toLowerCase()),v=v.replaceAll("::",":"),v=v.replaceAll("%","%25"),u=u.createStaticChild(v)}if(f){let v=!1,y=!0,_="",b=[],g=p+1;for(let m=g;;m++){let S=a.charCodeAt(m),w=S===40,k=S===45||S===46,x=S===47||m===a.length;if(w||k||x){let R=a.slice(g,m);if(c.push(R),v=v||w||k,w){let C=o5(a,m),$=a.slice(m,C+1);this.allowUnsafeRegex||Fr(zd(new RegExp($)),`The regex '${$}' is not safe!`),b.push(s5($)),m=C+1,y=!0}else b.push(y?"(.*?)":`(${_}|(?:(?!${_}).)*)`),y=!1;let E=m;for(;m<a.length;m++){let C=a.charCodeAt(m);if(C===47)break;if(C===58)if(a.charCodeAt(m+1)===58)m++;else break}let P=a.slice(E,m);if(P&&(P=P.replaceAll("::",":"),P=P.replaceAll("%","%25"),b.push(_=i5(P))),g=m+1,x||a.charCodeAt(m)===47||m===a.length){let C=v?"()"+P:P,$=a.slice(p,m);a=a.slice(0,p+1)+C+a.slice(m),p+=C.length;let N=v?new RegExp("^"+b.join("")+"$"):null;u=u.createParametricChild(N,P||null,$),l=p+1;break}}}}else if(h&&(c.push("*"),u=u.createWildcardChild(),l=p+1,p!==a.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(a=a.toLowerCase()),a==="*"&&(a="/*");for(let p of this.routes){let f=p.opts.constraints||{};if(p.method===t&&p.pattern===a&&UC(f,o))throw new Error(`Method '${t}' already declared for route '${a}' with constraints '${JSON.stringify(o)}'`)}let d={method:t,path:r,pattern:a,params:c,opts:n,handler:i,store:s};this.routes.push(d),u.addRoute(d,this.constrainer)};wr.prototype.hasRoute=function(t,r,n){return this.findRoute(t,r,n)!==null};wr.prototype.findRoute=function(t,r,n={}){if(this.trees[t]===void 0)return null;let i=r,s=this.trees[t],o=s.prefix.length,a=[];for(let u=0;u<=i.length;u++){if(i.charCodeAt(u)===58&&i.charCodeAt(u+1)===58){u++;continue}let l=i.charCodeAt(u)===58&&i.charCodeAt(u+1)!==58,c=i.charCodeAt(u)===42;if(l||c||u===i.length&&u!==o){let d=i.slice(o,u);if(this.caseSensitive||(d=d.toLowerCase()),d=d.replaceAll("::",":"),d=d.replaceAll("%","%25"),s=s.getStaticChild(d),s===null)return null}if(l){let d=!1,p=!0,f="",h=[],v=u+1;for(let y=v;;y++){let _=i.charCodeAt(y),b=_===40,g=_===45||_===46,m=_===47||y===i.length;if(b||g||m){let S=i.slice(v,y);if(a.push(S),d=d||b||g,b){let x=o5(i,y),R=i.slice(y,x+1);this.allowUnsafeRegex||Fr(zd(new RegExp(R)),`The regex '${R}' is not safe!`),h.push(s5(R)),y=x+1,p=!1}else h.push(p?"(.*?)":`(${f}|(?:(?!${f}).)*)`),p=!1;let w=y;for(;y<i.length;y++){let x=i.charCodeAt(y);if(x===47)break;if(x===58)if(i.charCodeAt(y+1)===58)y++;else break}let k=i.slice(w,y);if(k&&(k=k.replaceAll("::",":"),k=k.replaceAll("%","%25"),h.push(f=i5(k))),v=y+1,m||i.charCodeAt(y)===47||y===i.length){let x=d?"()"+k:k,R=i.slice(u,y);i=i.slice(0,u+1)+x+i.slice(y),u+=x.length;let E=d?new RegExp("^"+h.join("")+"$"):null;if(s=s.getParametricChild(E,k||null,R),s===null)return null;o=u+1;break}}}}else if(c&&(a.push("*"),s=s.getWildcardChild(),o=u+1,u!==i.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(i=i.toLowerCase());for(let u of this.routes){let l=u.opts.constraints||{};if(u.method===t&&u.pattern===i&&UC(l,n))return{handler:u.handler,store:u.store,params:u.params}}return null};wr.prototype.hasConstraintStrategy=function(e){return this.constrainer.hasConstraintStrategy(e)};wr.prototype.addConstraintStrategy=function(e){this.constrainer.addConstraintStrategy(e),this._rebuild(this.routes)};wr.prototype.reset=function(){this.trees={},this.routes=[]};wr.prototype.off=function(t,r,n){Fr(typeof r=="string","Path should be a string"),Fr(r.length>0,"The path could not be empty"),Fr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),Fr(typeof n>"u"||typeof n=="object"&&!Array.isArray(n)&&n!==null,"Constraints should be an object or undefined.");let i=r.match(Pl);if(i){Fr(r.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");let o=r.replace(Pl,"$1$2"),a=r.replace(Pl,"$2");this.off(t,o,n),this.off(t,a,n);return}this.ignoreDuplicateSlashes&&(r=ZC(r)),this.ignoreTrailingSlash&&(r=VC(r));let s=Array.isArray(t)?t:[t];for(let o of s)this._off(o,r,n)};wr.prototype._off=function(t,r,n){Fr(typeof t=="string","Method should be a string"),Fr(jd.includes(t),`Method '${t}' is not an http method.`);function i(u){return t!==u.method||r!==u.path}function s(u){return i(u)||!UC(n,u.opts.constraints||{})}let o=n?s:i,a=this.routes.filter(o);this._rebuild(a)};wr.prototype.lookup=function(t,r,n,i){if(typeof n=="function"&&(i=n,n=void 0),i===void 0){let s=this.constrainer.deriveConstraints(t,n),o=this.find(t.method,t.url,s);return this.callHandler(o,t,r,n)}this.constrainer.deriveConstraints(t,n,(s,o)=>{if(s!==null){i(s);return}try{let a=this.find(t.method,t.url,o),u=this.callHandler(a,t,r,n);i(null,u)}catch(a){i(a)}})};wr.prototype.callHandler=function(t,r,n,i){return t===null?this._defaultRoute(r,n,i):i===void 0?t.handler(r,n,t.params,t.store,t.searchParams):t.handler.call(i,r,n,t.params,t.store,t.searchParams)};wr.prototype.find=function(t,r,n){let i=this.trees[t];if(i===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(t5,"/")),this.ignoreDuplicateSlashes&&(r=ZC(r));let s,o,a;try{s=e5(r,this.useSemicolonDelimiter),r=s.path,o=s.querystring,a=s.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=VC(r));let u=r;this.caseSensitive===!1&&(r=r.toLowerCase());let l=this.maxParamLength,c=i.prefix.length,d=[],p=r.length,f=[];for(;;){if(c===p&&i.isLeafNode){let _=i.handlerStorage.getMatchingHandler(n);if(_!==null)return{handler:_.handler,store:_.store,params:_._createParamsObject(d),searchParams:this.querystringParser(o)}}let h=i.getNextNode(r,c,f,d.length);if(h===null){if(f.length===0)return null;let _=f.pop();c=_.brotherPathIndex,d.splice(_.paramsCount),h=_.brotherNode}if(i=h,i.kind===QG.STATIC){c+=i.prefix.length;continue}if(i.kind===QG.WILDCARD){let _=u.slice(c);a&&(_=FC(_)),d.push(_),c=p;continue}let v=u.indexOf("/",c);v===-1&&(v=p);let y=u.slice(c,v);if(a&&(y=FC(y)),i.isRegex){let _=i.regex.exec(y);if(_===null)continue;for(let b=1;b<_.length;b++){let g=_[b];if(g.length>l)return null;d.push(g)}}else{if(y.length>l)return null;d.push(y)}c=v}};wr.prototype._rebuild=function(e){this.reset();for(let t of e){let{method:r,path:n,opts:i,handler:s,store:o}=t;this._on(r,n,i,s,o)}};wr.prototype._defaultRoute=function(e,t,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(e,t):this.defaultRoute.call(r,e,t);t.statusCode=404,t.end()};wr.prototype._onBadUrl=function(e){if(this.onBadUrl===null)return null;let t=this.onBadUrl;return{handler:(r,n,i)=>t(e,r,n),params:{},store:null}};wr.prototype.prettyPrint=function(e={}){let t=e.method;e.buildPrettyMeta=this.buildPrettyMeta.bind(this);let r=null;if(t===void 0){let{version:n,host:i,...s}=this.constrainer.strategies;s[qC.name]=qC;let o=new wr({...this._opts,constraints:s}),a=this.routes.map(u=>{let l={...u.opts.constraints,[qC.name]:u.method};return{...u,method:"MERGED",opts:{constraints:l}}});o._rebuild(a),r=o.trees.MERGED}else r=this.trees[t];return r==null?"(empty tree)":HCe(r,e)};for(let e in jd){if(!jd.hasOwnProperty(e))continue;let t=jd[e],r=t.toLowerCase();wr.prototype[r]=function(n,i,s){return this.on(t,n,i,s)}}wr.prototype.all=function(e,t,r){this.on(jd,e,t,r)};wr.sanitizeUrlPath=function(t,r){let n=e5(t,r);return n.shouldDecodeParam?FC(n.path):n.path};a5.exports=wr;function i5(e){return e.replace(r5,"\\$&")}function ZC(e){return e.indexOf("//")!==-1?e.replace(n5,"/"):e}function VC(e){return e.length>1&&e.charCodeAt(e.length-1)===47?e.slice(0,-1):e}function s5(e){return e.charCodeAt(1)===94&&(e=e.slice(0,1)+e.slice(2)),e.charCodeAt(e.length-2)===36&&(e=e.slice(0,e.length-2)+e.slice(e.length-1)),e}function o5(e,t){let r=1;for(;t<e.length;){if(t++,e.charCodeAt(t)===92){t++;continue}if(e.charCodeAt(t)===41?r--:e.charCodeAt(t)===40&&r++,!r)return t}throw new TypeError('Invalid regexp expression in "'+e+'"')}function WCe(e){return e?e.store?Object.assign({},e.store):{}:{}}});var l5=T((Wst,u5)=>{"use strict";function BC(e,t,r,n){if(r===void 0){t.header("content-length","0"),n(null,null);return}if(typeof r.resume=="function"){r.on("error",s=>{t.log.error({err:s},"Error on Stream found for HEAD route")}),r.resume(),n(null,null);return}if(typeof r.getReader=="function"){r.cancel("Stream cancelled by HEAD route").catch(s=>{t.log.error({err:s},"Error on Stream found for HEAD route")}),n(null,null);return}let i=""+Buffer.byteLength(r);t.header("content-length",i),n(null,null)}function JCe(e){return e==null?BC:Array.isArray(e)?[...e,BC]:[e,BC]}u5.exports={parseHeadOnSendHandlers:JCe}});var T5=T((Jst,E5)=>{"use strict";var GCe=HC(),KCe=Uv(),c5=BT(),{onRequestAbortHookRunner:YCe,lifecycleHooks:d5,preParsingHookRunner:XCe,onTimeoutHookRunner:QCe,onRequestHookRunner:e1e}=Da(),{normalizeSchema:t1e}=bh(),{parseHeadOnSendHandlers:r1e}=l5(),{compileSchemasForValidation:n1e,compileSchemasForSerialization:i1e}=UT(),{FST_ERR_SCH_VALIDATION_BUILD:s1e,FST_ERR_SCH_SERIALIZATION_BUILD:o1e,FST_ERR_DUPLICATED_ROUTE:a1e,FST_ERR_INVALID_URL:u1e,FST_ERR_HOOK_INVALID_HANDLER:f5,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:l1e,FST_ERR_ROUTE_DUPLICATED_HANDLER:c1e,FST_ERR_ROUTE_HANDLER_NOT_FN:p5,FST_ERR_ROUTE_MISSING_HANDLER:d1e,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:f1e,FST_ERR_ROUTE_METHOD_INVALID:p1e,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:h1e,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:m1e,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:WC}=tn(),{kRoutePrefix:g1e,kSupportedHTTPMethods:KC,kLogLevel:y1e,kLogSerializers:h5,kHooks:m5,kSchemaController:_1e,kOptions:g5,kReplySerializerDefault:JC,kReplyIsError:v1e,kRequestPayloadStream:b1e,kDisableRequestLogging:y5,kSchemaErrorFormatter:w1e,kErrorHandler:_5,kHasBeenDecorated:v5,kRequestAcceptVersion:GC,kRouteByFastify:S1e,kRouteContext:b5}=Hr(),{buildErrorHandler:k1e}=wh(),{createChildLogger:x1e}=vh(),{getGenReqId:$1e}=nw(),{FSTDEP022:E1e}=Hc(),w5=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function T1e(e){let t=GCe(e),r,n,i,s,o,a,u,l,c,d,p,f,h,v=!1;return{setup(x,R){r=R.avvio,n=R.fourOhFour,i=x.logger,s=R.hasLogger,o=R.setupResponseListeners,a=R.throwIfAlreadyStarted,f=x.exposeHeadRoutes,u=x.disableRequestLogging,typeof u=="function"&&(l=x.disableRequestLogging),c=x.routerOptions.ignoreTrailingSlash,d=x.routerOptions.ignoreDuplicateSlashes,p=Object.hasOwn(x,"return503OnClosing")?x.return503OnClosing:!0,h=R.keepAliveConnections},routing:t.lookup.bind(t),route:w,hasRoute:m,prepareRoute:g,routeHandler:k,closeRoutes:()=>{v=!0},printRoutes:t.prettyPrint.bind(t),addConstraintStrategy:y,hasConstraintStrategy:_,isAsyncConstraint:b,findRoute:S};function y(x){return a("Cannot add constraint strategy!"),t.addConstraintStrategy(x)}function _(x){return t.hasConstraintStrategy(x)}function b(){return t.constrainer.asyncStrategiesInUse.size>0}function g({method:x,url:R,options:E,handler:P,isFastify:C}){if(typeof R!="string")throw new u1e(typeof R);if(!P&&typeof E=="function")P=E,E={};else if(P&&typeof P=="function"){if(Object.prototype.toString.call(E)!=="[object Object]")throw new l1e(x,R);if(E.handler)throw typeof E.handler=="function"?new c1e(x,R):new p5(x,R)}return E=Object.assign({},E,{method:x,url:R,path:R,handler:P||E&&E.handler}),w.call(this,{options:E,isFastify:C})}function m({options:x}){let R=x.method?.toUpperCase()??"";return t.hasRoute(R,x.url||"",x.constraints)}function S(x){let R=t.find(x.method,x.url||"",x.constraints);return R?{handler:R.handler,params:R.params,searchParams:R.searchParams}:null}function w({options:x,isFastify:R}){a("Cannot add route!");let E={...x},P=E.url||E.path||"";if(!E.handler)throw new d1e(E.method,P);if(E.errorHandler!==void 0&&typeof E.errorHandler!="function")throw new p5(E.method,P);$5(E.bodyLimit);let C=E.exposeHeadRoute??f,$=!1,N=!1;if(Array.isArray(E.method))for(let te=0;te<E.method.length;++te)E.method[te]=S5.call(this,E.method[te]),k5.call(this,E.method[te],P,E.schema),$=E.method.includes("GET"),N=E.method.includes("HEAD");else E.method=S5.call(this,E.method),k5.call(this,E.method,P,E.schema),$=E.method==="GET",N=E.method==="HEAD";let A=C&&$?{...x}:null,W=this[g1e];if(P==="/"&&W.length>0&&E.method!=="HEAD")switch(E.prefixTrailingSlash){case"slash":H.call(this,{path:P,isFastify:R});break;case"no-slash":H.call(this,{path:"",isFastify:R});break;case"both":default:H.call(this,{path:"",isFastify:R}),c!==!0&&(d!==!0||!W.endsWith("/"))&&H.call(this,{path:P,prefixing:!0,isFastify:R})}else P[0]==="/"&&W.endsWith("/")?H.call(this,{path:P.slice(1),isFastify:R}):H.call(this,{path:P,isFastify:R});return this;function H({path:te,prefixing:ne=!1,isFastify:Z=!1}){let z=W+te;if(E.url=z,E.path=z,E.routePath=te,E.prefix=W,E.logLevel=E.logLevel||this[y1e],(this[h5]||E.logSerializers)&&(E.logSerializers=Object.assign(Object.create(this[h5]),E.logSerializers)),E.attachValidation==null&&(E.attachValidation=!1),ne===!1)for(let j of this[m5].onRoute)j.call(this,E);for(let j of d5)if(E&&j in E){if(Array.isArray(E[j]))for(let V of E[j]){if(typeof V!="function")throw new f5(j,Object.prototype.toString.call(V));if(j==="onSend"||j==="preSerialization"||j==="onError"||j==="preParsing"){if(V.constructor.name==="AsyncFunction"&&V.length===4)throw new WC}else if(j==="onRequestAbort"){if(V.constructor.name==="AsyncFunction"&&V.length!==1)throw new WC}else if(V.constructor.name==="AsyncFunction"&&V.length===3)throw new WC}else if(E[j]!==void 0&&typeof E[j]!="function")throw new f5(j,Object.prototype.toString.call(E[j]))}let B=E.constraints||{},q={...E.config,url:z,method:E.method},I=new KCe({schema:E.schema,handler:E.handler.bind(this),config:q,errorHandler:E.errorHandler,childLoggerFactory:E.childLoggerFactory,bodyLimit:E.bodyLimit,logLevel:E.logLevel,logSerializers:E.logSerializers,attachValidation:E.attachValidation,schemaErrorFormatter:E.schemaErrorFormatter,replySerializer:this[JC],validatorCompiler:E.validatorCompiler,serializerCompiler:E.serializerCompiler,exposeHeadRoute:C,prefixTrailingSlash:E.prefixTrailingSlash||"both",server:this,isFastify:Z}),O=t.findRoute("HEAD",E.url,B)!==null;try{t.on(E.method,E.url,{constraints:B},k,I)}catch(j){if(!I[S1e])throw j.message.includes(`Method '${E.method}' already declared for route`)?new a1e(E.method,E.url):j}if(this.after((j,V)=>{I.errorHandler=E.errorHandler?k1e(this[_5],E.errorHandler):this[_5],I._parserOptions.limit=E.bodyLimit||null,I.logLevel=E.logLevel,I.logSerializers=E.logSerializers,I.attachValidation=E.attachValidation,I[JC]=this[JC],I.schemaErrorFormatter=E.schemaErrorFormatter||this[w1e]||I.schemaErrorFormatter,r.once("preReady",()=>{for(let Y of d5){let me=this[m5][Y].concat(E[Y]||[]).map(Ce=>Ce.bind(this));I[Y]=me.length?me:null}for(;!I.Request[v5]&&I.Request.parent;)I.Request=I.Request.parent;for(;!I.Reply[v5]&&I.Reply.parent;)I.Reply=I.Reply.parent;if(n.setContext(this,I),E.schema){I.schema=t1e(I.schema,this.initialConfig);let Y=this[_1e],me=E.schema.body||E.schema.headers||E.schema.querystring||E.schema.params;!E.validatorCompiler&&me&&Y.setupValidator(this[g5]);try{let Ce=typeof E?.validatorCompiler=="function"||Y.isCustomValidatorCompiler;n1e(I,E.validatorCompiler||Y.validatorCompiler,Ce)}catch(Ce){throw new s1e(E.method,z,Ce.message)}E.schema.response&&!E.serializerCompiler&&Y.setupSerializer(this[g5]);try{i1e(I,E.serializerCompiler||Y.serializerCompiler)}catch(Ce){throw new o1e(E.method,z,Ce.message)}}}),V(j)}),C&&$&&!N&&!O){let j=r1e(A.onSend);g.call(this,{method:"HEAD",url:te,options:{...A,onSend:j},isFastify:!0})}}}function k(x,R,E,P,C){let $=$1e(P.server,x),N={level:P.logLevel};P.logSerializers&&(N.serializers=P.logSerializers);let A=x1e(P,i,x,$,N);if(A[y5]=l?!1:u,v===!0&&(x.httpVersionMajor!==2&&R.setHeader("Connection","close"),p)){let Z={"Content-Type":"application/json","Content-Length":"80"};R.writeHead(503,Z),R.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),A.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}String.prototype.toLowerCase.call(x.headers.connection||"")==="keep-alive"&&h.has(x.socket)===!1&&(h.add(x.socket),x.socket.on("close",O1e.bind({keepAliveConnections:h,socket:x.socket}))),x.headers[GC]!==void 0&&(x.headers["accept-version"]=x.headers[GC],x.headers[GC]=void 0);let H=new P.Request($,E,x,C,A,P),te=new P.Reply(R,H,A),ne=l?l(H):u;A[y5]=ne,ne===!1&&A.info({req:H},"incoming request"),(s===!0||P.onResponse!==null)&&o(te),P.onRequest!==null?e1e(P.onRequest,H,te,x5):x5(null,H,te),P.onRequestAbort!==null&&x.on("close",()=>{x.aborted&&YCe(P.onRequestAbort,H,R1e.bind(null,te))}),P.onTimeout!==null&&(H.raw.socket._meta||H.raw.socket.on("timeout",P1e),H.raw.socket._meta={context:P,request:H,reply:te})}}function R1e(e,t){t&&e.log.error({err:t},"onRequestAborted hook failed")}function P1e(){let{context:e,request:t,reply:r}=this._meta;QCe(e.onTimeout,t,r,C1e)}function S5(e){if(typeof e!="string")throw new p1e;if(e=e.toUpperCase(),!this[KC].bodyless.has(e)&&!this[KC].bodywith.has(e))throw new f1e(e);return e}function k5(e,t,r){if(this[KC].bodyless.has(e)&&r?.body)throw new h1e(e,t)}function $5(e){if(e!==void 0&&(!Number.isInteger(e)||e<=0))throw new m1e(e)}function x5(e,t,r){if(r.sent!==!0){if(e!=null){r[v1e]=!0,r.send(e);return}t[b1e]=t.raw,t[b5].preParsing!==null?XCe(t[b5].preParsing,t,r,c5.bind(t.server)):c5.call(t.server,null,t,r)}}function I1e(e,t){let r=e.routerOptions||Object.create(null),n=w5.filter(i=>Object.hasOwn(e,i));n.length>0&&E1e(n.join(", "));for(let i of w5)Object.hasOwn(r,i)||(r[i]=e[i]??t[i]);return r}function O1e(){this.keepAliveConnections.delete(this.socket)}function C1e(){}E5.exports={buildRouting:T1e,validateBodyLimitOption:$5,buildRouterOptions:I1e}});var A5=T((Gst,N5)=>{"use strict";var N1e=HC(),R5=Dv(),P5=Fv(),A1e=Uv(),{kRoutePrefix:D1e,kCanSetNotFoundHandler:Om,kFourOhFourLevelInstance:Cm,kFourOhFourContext:_o,kHooks:j1e,kErrorHandler:I5}=Hr(),{lifecycleHooks:z1e}=Da(),{buildErrorHandler:M1e}=wh(),{FST_ERR_NOT_FOUND:L1e}=tn(),{createChildLogger:O5}=vh(),{getGenReqId:C5}=nw();function q1e(e){let{logger:t,disableRequestLogging:r}=e,n=N1e({onBadUrl:a(),defaultRoute:d}),i=null;return{router:n,setNotFoundHandler:l,setContext:u,arrange404:s};function s(p){p[Cm]=p,p[Om]=!0,n.onBadUrl=n.onBadUrl.bind(p),n.defaultRoute=n.defaultRoute.bind(p)}function o(p,f){let{url:h,method:v}=p.raw,y=`Route ${v}:${h} not found`;(typeof r=="function"?r(p.raw):r)||p.log.info(y),f.code(404).send({message:y,error:"Not Found",statusCode:404})}function a(){return function(f,h,v){let y=this[Cm][_o],_=C5(y.server,h),b=O5(y,t,h,_),g=new P5(_,null,h,null,b,y),m=new R5(v,g,b);i(g,m)}}function u(p,f){let h=Object.assign({},p[_o]);h.onSend=f.onSend,f[_o]=h}function l(p,f,h,v){this[Om]===void 0&&(this[Om]=!0),this[_o]===void 0&&(this[_o]=null);let y=this,_=this[D1e]||"/";if(this[Om]===!1)throw new Error(`Not found handler already set for Fastify instance with prefix: '${_}'`);typeof p=="object"&&(p.preHandler&&(Array.isArray(p.preHandler)?p.preHandler=p.preHandler.map(b=>b.bind(y)):p.preHandler=p.preHandler.bind(y)),p.preValidation&&(Array.isArray(p.preValidation)?p.preValidation=p.preValidation.map(b=>b.bind(y)):p.preValidation=p.preValidation.bind(y))),typeof p=="function"&&(f=p,p=void 0),p=p||{},f?(this[Cm][Om]=!1,f=f.bind(this),i=f):(f=o,i=o),this.after((b,g)=>{c.call(this,_,p,f,h,v),g(b)})}function c(p,f,h,v,y){let _=new A1e({schema:f.schema,handler:h,config:f.config||{},server:this});if(v.once("preReady",()=>{let b=this[_o];for(let g of z1e){let m=this[j1e][g].concat(f[g]||[]).map(S=>S.bind(this));b[g]=m.length?m:null}b.errorHandler=f.errorHandler?M1e(this[I5],f.errorHandler):this[I5]}),this[_o]!==null&&p==="/"){Object.assign(this[_o],_);return}this[Cm][_o]=_,n.all(p+(p.endsWith("/")?"*":"/*"),y,_),n.all(p,y,_)}function d(p,f){let h=this[Cm][_o],v=C5(h.server,p),y=O5(h,t,p,v);y.info({req:p},"incoming request");let _=new P5(v,null,p,null,y,h),b=new R5(f,_,y);_.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),_.log.warn(n.prettyPrint()),b.code(404).send(new L1e)}}N5.exports=q1e});var D5=T((Kst,ww)=>{"use strict";ww.exports=St;ww.exports.default=St;var F1e={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72e3},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},bodyLimit:{type:"integer",default:1048576},caseSensitive:{type:"boolean",default:!0},allowUnsafeRegex:{type:"boolean",default:!1},http2:{type:"boolean"},https:{if:{not:{oneOf:[{type:"boolean"},{type:"null"},{type:"object",additionalProperties:!1,required:["allowHTTP1"],properties:{allowHTTP1:{type:"boolean"}}}]}},then:{setDefaultValue:!0}},ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},disableRequestLogging:{default:!1},maxParamLength:{type:"integer",default:100},onProtoPoisoning:{type:"string",default:"error"},onConstructorPoisoning:{type:"string",default:"error"},pluginTimeout:{type:"integer",default:1e4},requestIdHeader:{anyOf:[{type:"boolean"},{type:"string"}],default:!1},requestIdLogLabel:{type:"string",default:"reqId"},http2SessionTimeout:{type:"integer",default:72e3},exposeHeadRoutes:{type:"boolean",default:!0},useSemicolonDelimiter:{type:"boolean",default:!1},routerOptions:{type:"object",additionalProperties:!0,properties:{ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},maxParamLength:{type:"integer",default:100},allowUnsafeRegex:{type:"boolean",default:!1},useSemicolonDelimiter:{type:"boolean",default:!1}}},constraints:{type:"object",additionalProperties:{type:"object",required:["name","storage","validate","deriveConstraint"],additionalProperties:!0,properties:{name:{type:"string"},storage:{},validate:{},deriveConstraint:{}}}}}},U1e=Object.prototype.hasOwnProperty,Z1e=new RegExp("idle","u");function St(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0;if(o===0)if(e&&typeof e=="object"&&!Array.isArray(e)){e.connectionTimeout===void 0&&(e.connectionTimeout=0),e.keepAliveTimeout===void 0&&(e.keepAliveTimeout=72e3),e.maxRequestsPerSocket===void 0&&(e.maxRequestsPerSocket=0),e.requestTimeout===void 0&&(e.requestTimeout=0),e.bodyLimit===void 0&&(e.bodyLimit=1048576),e.caseSensitive===void 0&&(e.caseSensitive=!0),e.allowUnsafeRegex===void 0&&(e.allowUnsafeRegex=!1),e.ignoreTrailingSlash===void 0&&(e.ignoreTrailingSlash=!1),e.ignoreDuplicateSlashes===void 0&&(e.ignoreDuplicateSlashes=!1),e.disableRequestLogging===void 0&&(e.disableRequestLogging=!1),e.maxParamLength===void 0&&(e.maxParamLength=100),e.onProtoPoisoning===void 0&&(e.onProtoPoisoning="error"),e.onConstructorPoisoning===void 0&&(e.onConstructorPoisoning="error"),e.pluginTimeout===void 0&&(e.pluginTimeout=1e4),e.requestIdHeader===void 0&&(e.requestIdHeader=!1),e.requestIdLogLabel===void 0&&(e.requestIdLogLabel="reqId"),e.http2SessionTimeout===void 0&&(e.http2SessionTimeout=72e3),e.exposeHeadRoutes===void 0&&(e.exposeHeadRoutes=!0),e.useSemicolonDelimiter===void 0&&(e.useSemicolonDelimiter=!1);let v=o;for(let y in e)U1e.call(F1e.properties,y)||delete e[y];if(v===o){let y=e.connectionTimeout,_=o;if(!(typeof y=="number"&&!(y%1)&&!isNaN(y)&&isFinite(y))){let b=typeof y,g;if(g===void 0)if(b==="boolean"||y===null||b==="string"&&y&&y==+y&&!(y%1))g=+y;else return St.errors=[{instancePath:t+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;g!==void 0&&(y=g,e!==void 0&&(e.connectionTimeout=g))}var a=_===o;if(a){let b=e.keepAliveTimeout,g=o;if(!(typeof b=="number"&&!(b%1)&&!isNaN(b)&&isFinite(b))){let S=typeof b,w;if(w===void 0)if(S==="boolean"||b===null||S==="string"&&b&&b==+b&&!(b%1))w=+b;else return St.errors=[{instancePath:t+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;w!==void 0&&(b=w,e!==void 0&&(e.keepAliveTimeout=w))}var a=g===o;if(a){if(e.forceCloseConnections!==void 0){let S=e.forceCloseConnections,w=o,k=o,x=!1,R=null,E=o;if(typeof S!="string"){let $=typeof S,N;if(N===void 0)if($=="number"||$=="boolean")N=""+S;else if(S===null)N="";else{let A={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[A]:s.push(A),o++}N!==void 0&&(S=N,e!==void 0&&(e.forceCloseConnections=N))}if(o===E&&typeof S=="string"&&!Z1e.test(S)){let $={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};s===null?s=[$]:s.push($),o++}var u=E===o;u&&(x=!0,R=0);let P=o;if(typeof S!="boolean"){let $;if($===void 0)if(S==="false"||S===0||S===null)$=!1;else if(S==="true"||S===1)$=!0;else{let N={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(S=$,e!==void 0&&(e.forceCloseConnections=$))}var u=P===o;if(u&&x?(x=!1,R=[R,1]):u&&(x=!0,R=1),x)o=k,s!==null&&(k?s.length=k:s=null);else{let $={instancePath:t+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[$]:s.push($),o++,St.errors=s,!1}var a=w===o}else var a=!0;if(a){let S=e.maxRequestsPerSocket,w=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S))&&S!==null){let x=typeof S,R;if(R===void 0)if(x==="boolean"||S===null||x==="string"&&S&&S==+S&&!(S%1))R=+S;else if(S===""||S===0||S===!1)R=null;else return St.errors=[{instancePath:t+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;R!==void 0&&(S=R,e!==void 0&&(e.maxRequestsPerSocket=R))}var a=w===o;if(a){let x=e.requestTimeout,R=o;if(!(typeof x=="number"&&!(x%1)&&!isNaN(x)&&isFinite(x))){let P=typeof x,C;if(C===void 0)if(P==="boolean"||x===null||P==="string"&&x&&x==+x&&!(x%1))C=+x;else return St.errors=[{instancePath:t+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;C!==void 0&&(x=C,e!==void 0&&(e.requestTimeout=C))}var a=R===o;if(a){let P=e.bodyLimit,C=o;if(!(typeof P=="number"&&!(P%1)&&!isNaN(P)&&isFinite(P))){let N=typeof P,A;if(A===void 0)if(N==="boolean"||P===null||N==="string"&&P&&P==+P&&!(P%1))A=+P;else return St.errors=[{instancePath:t+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;A!==void 0&&(P=A,e!==void 0&&(e.bodyLimit=A))}var a=C===o;if(a){let N=e.caseSensitive,A=o;if(typeof N!="boolean"){let H;if(H===void 0)if(N==="false"||N===0||N===null)H=!1;else if(N==="true"||N===1)H=!0;else return St.errors=[{instancePath:t+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;H!==void 0&&(N=H,e!==void 0&&(e.caseSensitive=H))}var a=A===o;if(a){let H=e.allowUnsafeRegex,te=o;if(typeof H!="boolean"){let Z;if(Z===void 0)if(H==="false"||H===0||H===null)Z=!1;else if(H==="true"||H===1)Z=!0;else return St.errors=[{instancePath:t+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Z!==void 0&&(H=Z,e!==void 0&&(e.allowUnsafeRegex=Z))}var a=te===o;if(a){if(e.http2!==void 0){let Z=e.http2,z=o;if(typeof Z!="boolean"){let q;if(q===void 0)if(Z==="false"||Z===0||Z===null)q=!1;else if(Z==="true"||Z===1)q=!0;else return St.errors=[{instancePath:t+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;q!==void 0&&(Z=q,e!==void 0&&(e.http2=q))}var a=z===o}else var a=!0;if(a){if(e.https!==void 0){let Z=e.https,z=o,B=o,q=!0,I=o,D=o,O=o,j=o,V=!1,Y=null,me=o;if(typeof Z!="boolean"){let M;if(M===void 0)if(Z==="false"||Z===0||Z===null)M=!1;else if(Z==="true"||Z===1)M=!0;else{let X={};s===null?s=[X]:s.push(X),o++}M!==void 0&&(Z=M,e!==void 0&&(e.https=M))}var l=me===o;l&&(V=!0,Y=0);let Ce=o;if(Z!==null){let M;if(M===void 0)if(Z===""||Z===0||Z===!1)M=null;else{let X={};s===null?s=[X]:s.push(X),o++}M!==void 0&&(Z=M,e!==void 0&&(e.https=M))}var l=Ce===o;if(l&&V)V=!1,Y=[Y,1];else{l&&(V=!0,Y=1);let M=o;if(o===M)if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let ee;if(Z.allowHTTP1===void 0&&(ee="allowHTTP1")){let he={};s===null?s=[he]:s.push(he),o++}else{let he=o;for(let Te in Z)Te!=="allowHTTP1"&&delete Z[Te];if(he===o&&Z.allowHTTP1!==void 0){let Te=Z.allowHTTP1;if(typeof Te!="boolean"){let ze;if(ze===void 0)if(Te==="false"||Te===0||Te===null)ze=!1;else if(Te==="true"||Te===1)ze=!0;else{let _t={};s===null?s=[_t]:s.push(_t),o++}ze!==void 0&&(Te=ze,Z!==void 0&&(Z.allowHTTP1=ze))}}}}else{let ee={};s===null?s=[ee]:s.push(ee),o++}var l=M===o;l&&V?(V=!1,Y=[Y,2]):l&&(V=!0,Y=2)}if(V)o=j,s!==null&&(j?s.length=j:s=null);else{let M={};s===null?s=[M]:s.push(M),o++}var c=O===o;if(c){let M={};s===null?s=[M]:s.push(M),o++}else o=D,s!==null&&(D?s.length=D:s=null);var d=I===o;if(o=B,s!==null&&(B?s.length=B:s=null),d){let M=o;e.https=!0;var d=M===o;q=d}if(!q){let M={instancePath:t+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};return s===null?s=[M]:s.push(M),o++,St.errors=s,!1}var a=z===o}else var a=!0;if(a){let Z=e.ignoreTrailingSlash,z=o;if(typeof Z!="boolean"){let q;if(q===void 0)if(Z==="false"||Z===0||Z===null)q=!1;else if(Z==="true"||Z===1)q=!0;else return St.errors=[{instancePath:t+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;q!==void 0&&(Z=q,e!==void 0&&(e.ignoreTrailingSlash=q))}var a=z===o;if(a){let q=e.ignoreDuplicateSlashes,I=o;if(typeof q!="boolean"){let O;if(O===void 0)if(q==="false"||q===0||q===null)O=!1;else if(q==="true"||q===1)O=!0;else return St.errors=[{instancePath:t+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;O!==void 0&&(q=O,e!==void 0&&(e.ignoreDuplicateSlashes=O))}var a=I===o;if(a){let O=e.maxParamLength,j=o;if(!(typeof O=="number"&&!(O%1)&&!isNaN(O)&&isFinite(O))){let Y=typeof O,me;if(me===void 0)if(Y==="boolean"||O===null||Y==="string"&&O&&O==+O&&!(O%1))me=+O;else return St.errors=[{instancePath:t+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;me!==void 0&&(O=me,e!==void 0&&(e.maxParamLength=me))}var a=j===o;if(a){let Y=e.onProtoPoisoning,me=o;if(typeof Y!="string"){let F=typeof Y,M;if(M===void 0)if(F=="number"||F=="boolean")M=""+Y;else if(Y===null)M="";else return St.errors=[{instancePath:t+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;M!==void 0&&(Y=M,e!==void 0&&(e.onProtoPoisoning=M))}var a=me===o;if(a){let F=e.onConstructorPoisoning,M=o;if(typeof F!="string"){let ee=typeof F,he;if(he===void 0)if(ee=="number"||ee=="boolean")he=""+F;else if(F===null)he="";else return St.errors=[{instancePath:t+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;he!==void 0&&(F=he,e!==void 0&&(e.onConstructorPoisoning=he))}var a=M===o;if(a){let ee=e.pluginTimeout,he=o;if(!(typeof ee=="number"&&!(ee%1)&&!isNaN(ee)&&isFinite(ee))){let ze=typeof ee,_t;if(_t===void 0)if(ze==="boolean"||ee===null||ze==="string"&&ee&&ee==+ee&&!(ee%1))_t=+ee;else return St.errors=[{instancePath:t+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;_t!==void 0&&(ee=_t,e!==void 0&&(e.pluginTimeout=_t))}var a=he===o;if(a){let ze=e.requestIdHeader,_t=o,Ot=o,jt=!1,ft=o;if(typeof ze!="boolean"){let it;if(it===void 0)if(ze==="false"||ze===0||ze===null)it=!1;else if(ze==="true"||ze===1)it=!0;else{let Ia={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[Ia]:s.push(Ia),o++}it!==void 0&&(ze=it,e!==void 0&&(e.requestIdHeader=it))}var p=ft===o;if(jt=jt||p,!jt){let it=o;if(typeof ze!="string"){let Oa=typeof ze,nr;if(nr===void 0)if(Oa=="number"||Oa=="boolean")nr=""+ze;else if(ze===null)nr="";else{let ii={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ii]:s.push(ii),o++}nr!==void 0&&(ze=nr,e!==void 0&&(e.requestIdHeader=nr))}var p=it===o;jt=jt||p}if(jt)o=Ot,s!==null&&(Ot?s.length=Ot:s=null);else{let it={instancePath:t+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[it]:s.push(it),o++,St.errors=s,!1}var a=_t===o;if(a){let it=e.requestIdLogLabel,Ia=o;if(typeof it!="string"){let nr=typeof it,ii;if(ii===void 0)if(nr=="number"||nr=="boolean")ii=""+it;else if(it===null)ii="";else return St.errors=[{instancePath:t+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;ii!==void 0&&(it=ii,e!==void 0&&(e.requestIdLogLabel=ii))}var a=Ia===o;if(a){let nr=e.http2SessionTimeout,ii=o;if(!(typeof nr=="number"&&!(nr%1)&&!isNaN(nr)&&isFinite(nr))){let Bi=typeof nr,rl;if(rl===void 0)if(Bi==="boolean"||nr===null||Bi==="string"&&nr&&nr==+nr&&!(nr%1))rl=+nr;else return St.errors=[{instancePath:t+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;rl!==void 0&&(nr=rl,e!==void 0&&(e.http2SessionTimeout=rl))}var a=ii===o;if(a){let Bi=e.exposeHeadRoutes,rl=o;if(typeof Bi!="boolean"){let si;if(si===void 0)if(Bi==="false"||Bi===0||Bi===null)si=!1;else if(Bi==="true"||Bi===1)si=!0;else return St.errors=[{instancePath:t+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;si!==void 0&&(Bi=si,e!==void 0&&(e.exposeHeadRoutes=si))}var a=rl===o;if(a){let si=e.useSemicolonDelimiter,Sde=o;if(typeof si!="boolean"){let rt;if(rt===void 0)if(si==="false"||si===0||si===null)rt=!1;else if(si==="true"||si===1)rt=!0;else return St.errors=[{instancePath:t+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;rt!==void 0&&(si=rt,e!==void 0&&(e.useSemicolonDelimiter=rt))}var a=Sde===o;if(a){if(e.routerOptions!==void 0){let rt=e.routerOptions,ih=o;if(o===ih)if(rt&&typeof rt=="object"&&!Array.isArray(rt)){rt.ignoreTrailingSlash===void 0&&(rt.ignoreTrailingSlash=!1),rt.ignoreDuplicateSlashes===void 0&&(rt.ignoreDuplicateSlashes=!1),rt.maxParamLength===void 0&&(rt.maxParamLength=100),rt.allowUnsafeRegex===void 0&&(rt.allowUnsafeRegex=!1),rt.useSemicolonDelimiter===void 0&&(rt.useSemicolonDelimiter=!1);let Wi=rt.ignoreTrailingSlash,Ti=o;if(typeof Wi!="boolean"){let dn;if(dn===void 0)if(Wi==="false"||Wi===0||Wi===null)dn=!1;else if(Wi==="true"||Wi===1)dn=!0;else return St.errors=[{instancePath:t+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;dn!==void 0&&(Wi=dn,rt!==void 0&&(rt.ignoreTrailingSlash=dn))}var f=Ti===o;if(f){let dn=rt.ignoreDuplicateSlashes,Ca=o;if(typeof dn!="boolean"){let Rr;if(Rr===void 0)if(dn==="false"||dn===0||dn===null)Rr=!1;else if(dn==="true"||dn===1)Rr=!0;else return St.errors=[{instancePath:t+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Rr!==void 0&&(dn=Rr,rt!==void 0&&(rt.ignoreDuplicateSlashes=Rr))}var f=Ca===o;if(f){let Rr=rt.maxParamLength,Na=o;if(!(typeof Rr=="number"&&!(Rr%1)&&!isNaN(Rr)&&isFinite(Rr))){let to=typeof Rr,nl;if(nl===void 0)if(to==="boolean"||Rr===null||to==="string"&&Rr&&Rr==+Rr&&!(Rr%1))nl=+Rr;else return St.errors=[{instancePath:t+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;nl!==void 0&&(Rr=nl,rt!==void 0&&(rt.maxParamLength=nl))}var f=Na===o;if(f){let to=rt.allowUnsafeRegex,nl=o;if(typeof to!="boolean"){let oi;if(oi===void 0)if(to==="false"||to===0||to===null)oi=!1;else if(to==="true"||to===1)oi=!0;else return St.errors=[{instancePath:t+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;oi!==void 0&&(to=oi,rt!==void 0&&(rt.allowUnsafeRegex=oi))}var f=nl===o;if(f){let oi=rt.useSemicolonDelimiter,kde=o;if(typeof oi!="boolean"){let Lc;if(Lc===void 0)if(oi==="false"||oi===0||oi===null)Lc=!1;else if(oi==="true"||oi===1)Lc=!0;else return St.errors=[{instancePath:t+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Lc!==void 0&&(oi=Lc,rt!==void 0&&(rt.useSemicolonDelimiter=Lc))}var f=kde===o}}}}}else return St.errors=[{instancePath:t+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=ih===o}else var a=!0;if(a)if(e.constraints!==void 0){let rt=e.constraints,ih=o;if(o===ih)if(rt&&typeof rt=="object"&&!Array.isArray(rt))for(let Wi in rt){let Ti=rt[Wi],dn=o;if(o===dn)if(Ti&&typeof Ti=="object"&&!Array.isArray(Ti)){let Ca;if(Ti.name===void 0&&(Ca="name")||Ti.storage===void 0&&(Ca="storage")||Ti.validate===void 0&&(Ca="validate")||Ti.deriveConstraint===void 0&&(Ca="deriveConstraint"))return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:Ca},message:"must have required property '"+Ca+"'"}],!1;if(Ti.name!==void 0){let sh=Ti.name;if(typeof sh!="string"){let Rr=typeof sh,Na;if(Na===void 0)if(Rr=="number"||Rr=="boolean")Na=""+sh;else if(sh===null)Na="";else return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;Na!==void 0&&(sh=Na,Ti!==void 0&&(Ti.name=Na))}}}else return St.errors=[{instancePath:t+"/constraints/"+Wi.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var h=dn===o;if(!h)break}else return St.errors=[{instancePath:t+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=ih===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}else return St.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return St.errors=s,o===0}ww.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72e3,maxRequestsPerSocket:0,requestTimeout:0,bodyLimit:1048576,caseSensitive:!0,allowUnsafeRegex:!1,disableRequestLogging:!1,ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,onProtoPoisoning:"error",onConstructorPoisoning:"error",pluginTimeout:1e4,requestIdHeader:!1,requestIdLogLabel:"reqId",http2SessionTimeout:72e3,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var j5=T((Yst,kw)=>{"use strict";var Sw=D5(),V1e=kv()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:H1e}=tn();function B1e(e){let t=V1e(e);if(!Sw(t)){let r=new H1e(JSON.stringify(Sw.errors.map(n=>n.message)));throw r.errors=Sw.errors,r}return YC(t)}function YC(e){let t=Object.getOwnPropertyNames(e);for(let r of t){let n=e[r];ArrayBuffer.isView(n)&&!(n instanceof DataView)||(e[r]=n&&typeof n=="object"?YC(n):n)}return Object.freeze(e)}kw.exports=B1e;kw.exports.defaultInitOptions=Sw.defaultInitOptions;kw.exports.utils={deepFreezeObject:YC}});var H5=T((Xst,V5)=>{"use strict";var{kAvvioBoot:W1e,kChildren:z5,kRoutePrefix:M5,kLogLevel:L5,kLogSerializers:XC,kHooks:QC,kSchemaController:Md,kContentTypeParser:q5,kReply:F5,kRequest:U5,kFourOhFour:J1e,kPluginNameChain:Z5,kErrorHandlerAlreadySet:G1e}=Hr(),K1e=Dv(),Y1e=Fv(),X1e=nC(),Q1e=pP(),{buildHooks:eNe}=Da(),Nm=RC();V5.exports=function(t,r,n){let i=Nm.registerPlugin.call(t,r),s=Nm.getPluginName(r)||Nm.getFuncPreview(r);if(i)return t[Z5].push(s),t;let o=Object.create(t);t[z5].push(o),o.ready=t[W1e].bind(o),o[z5]=[],o[F5]=K1e.buildReply(o[F5]),o[U5]=Y1e.buildRequest(o[U5]),o[q5]=Q1e.helpers.buildContentTypeParser(o[q5]),o[QC]=eNe(o[QC]),o[M5]=tNe(o[M5],n.prefix),o[L5]=n.logLevel||o[L5],o[Md]=X1e.buildSchemaController(t[Md]),o.getSchema=o[Md].getSchema.bind(o[Md]),o.getSchemas=o[Md].getSchemas.bind(o[Md]),o[Nm.kRegisteredPlugins]=Object.create(o[Nm.kRegisteredPlugins]),o[Z5]=[s],o[G1e]=!1,(o[XC]||n.logSerializers)&&(o[XC]=Object.assign(Object.create(o[XC]),n.logSerializers)),n.prefix&&o[J1e].arrange404(o);for(let a of o[QC].onRegister)a.call(t,o,n);return o};function tNe(e,t){return t?(e.endsWith("/")&&t[0]==="/"?t=t.slice(1):t[0]!=="/"&&(t="/"+t),e+t):e}});var K5=T(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.parseCookie=J5;vo.parse=J5;vo.stringifyCookie=aNe;vo.stringifySetCookie=xw;vo.serialize=xw;vo.parseSetCookie=uNe;vo.stringifySetCookie=xw;vo.serialize=xw;var B5=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,W5=/^[\u0021-\u003A\u003C-\u007E]*$/,rNe=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,nNe=/^[\u0020-\u003A\u003D-\u007E]*$/,iNe=/^-?\d+$/,sNe=Object.prototype.toString,oNe=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function J5(e,t){let r=new oNe,n=e.length;if(n<2)return r;let i=t?.decode||G5,s=0;do{let o=t1(e,s,n);if(o===-1)break;let a=e1(e,s,n);if(o>a){s=e.lastIndexOf(";",o-1)+1;continue}let u=eu(e,s,o);r[u]===void 0&&(r[u]=i(eu(e,o+1,a))),s=a+1}while(s<n);return r}function aNe(e,t){let r=t?.encode||encodeURIComponent,n=[];for(let i of Object.keys(e)){let s=e[i];if(s===void 0)continue;if(!B5.test(i))throw new TypeError(`cookie name is invalid: ${i}`);let o=r(s);if(!W5.test(o))throw new TypeError(`cookie val is invalid: ${s}`);n.push(`${i}=${o}`)}return n.join("; ")}function xw(e,t,r){let n=typeof e=="object"?e:{...r,name:e,value:String(t)},s=(typeof t=="object"?t:r)?.encode||encodeURIComponent;if(!B5.test(n.name))throw new TypeError(`argument name is invalid: ${n.name}`);let o=n.value?s(n.value):"";if(!W5.test(o))throw new TypeError(`argument val is invalid: ${n.value}`);let a=n.name+"="+o;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!rNe.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!nNe.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!lNe(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function uNe(e,t){let r=t?.decode||G5,n=e.length,i=e1(e,0,n),s=t1(e,0,i),o=s===-1?{name:"",value:r(eu(e,0,i))}:{name:eu(e,0,s),value:r(eu(e,s+1,i))},a=i+1;for(;a<n;){let u=e1(e,a,n),l=t1(e,a,u),c=l===-1?eu(e,a,u):eu(e,a,l),d=l===-1?void 0:eu(e,l+1,u);switch(c.toLowerCase()){case"httponly":o.httpOnly=!0;break;case"secure":o.secure=!0;break;case"partitioned":o.partitioned=!0;break;case"domain":o.domain=d;break;case"path":o.path=d;break;case"max-age":d&&iNe.test(d)&&(o.maxAge=Number(d));break;case"expires":if(!d)break;let p=new Date(d);Number.isFinite(p.valueOf())&&(o.expires=p);break;case"priority":if(!d)break;let f=d.toLowerCase();(f==="low"||f==="medium"||f==="high")&&(o.priority=f);break;case"samesite":if(!d)break;let h=d.toLowerCase();(h==="lax"||h==="strict"||h==="none")&&(o.sameSite=h);break}a=u+1}return o}function e1(e,t,r){let n=e.indexOf(";",t);return n===-1?r:n}function t1(e,t,r){let n=e.indexOf("=",t);return n<r?n:-1}function eu(e,t,r){let n=t,i=r;do{let s=e.charCodeAt(n);if(s!==32&&s!==9)break}while(++n<i);for(;i>n;){let s=e.charCodeAt(i-1);if(s!==32&&s!==9)break;i--}return e.slice(n,i)}function G5(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function lNe(e){return sNe.call(e)==="[object Date]"}});var X5=T((eot,$w)=>{"use strict";var{format:r1}=ie("node:util");function cNe(e){return Y5({...e,name:"DeprecationWarning"})}function Y5({name:e,code:t,message:r,unlimited:n=!1}={}){if(!e)throw new Error("Warning name must not be empty");if(!t)throw new Error("Warning code must not be empty");if(!r)throw new Error("Warning message must not be empty");if(typeof n!="boolean")throw new Error("Warning opts.unlimited must be a boolean");t=t.toUpperCase();let i={[e]:function(o,a,u){s.emitted===!0&&s.unlimited!==!0||(s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code))}};n&&(i={[e]:function(o,a,u){s.emitted=!0,process.emitWarning(s.format(o,a,u),s.name,s.code)}});let s=i[e];return s.emitted=!1,s.message=r,s.unlimited=n,s.code=t,s.format=function(o,a,u){let l;return o&&a&&u?l=r1(r,o,a,u):o&&a?l=r1(r,o,a):o?l=r1(r,o):l=r,l},s}var n1={createWarning:Y5,createDeprecation:cNe};$w.exports=n1;$w.exports.default=n1;$w.exports.processWarning=n1});var t3=T((tot,e3)=>{"use strict";var{URL:Q5}=ie("node:url"),i1="http://localhost";e3.exports=function(t,r){(typeof t=="string"||Object.prototype.toString.call(t)==="[object String]")&&t.startsWith("//")&&(t=i1+t);let n=typeof t=="object"?Object.assign(new Q5(i1),t):new Q5(t,i1);if(typeof r=="string"){r=new URLSearchParams(r);for(let i of r.keys()){n.searchParams.delete(i);for(let s of r.getAll(i))n.searchParams.append(i,s)}}else{let i=Object.assign({},t.query,r);for(let s in i){let o=i[s];if(Array.isArray(o)){n.searchParams.delete(s);for(let a of o)n.searchParams.append(s,a)}else n.searchParams.set(s,o)}}return n}});var r3=T((rot,s1)=>{"use strict";var{randomUUID:dNe}=ie("node:crypto"),{Readable:fNe}=ie("node:stream"),Ld;function pNe(e){return e&&typeof e=="object"&&typeof e.append=="function"&&typeof e.delete=="function"&&typeof e.get=="function"&&typeof e.getAll=="function"&&typeof e.has=="function"&&typeof e.set=="function"&&e[Symbol.toStringTag]==="FormData"}function hNe(e){Ld=Ld??new TextEncoder;let t=`----formdata-${dNe()}`,r=`--${t}\r
342
342
  Content-Disposition: form-data`;let n=u=>u.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),i=u=>u.replace(/\r?\n|\r/g,`\r
343
343
  `),s=new Uint8Array([13,10]);async function*o(){for(let[u,l]of e)if(typeof l=="string")yield Ld.encode(`${r}; name="${n(i(u))}"\r
344
344
  \r
@@ -346,7 +346,7 @@ Content-Disposition: form-data`;let n=u=>u.replace(/\n/g,"%0A").replace(/\r/g,"%
346
346
  `);else{let c=`${r}; name="${n(i(u))}"`;l.name&&(c+=`; filename="${n(l.name)}"`),c+=`\r
347
347
  Content-Type: ${l.type||"application/octet-stream"}\r
348
348
  \r
349
- `,yield Ld.encode(c),l.stream?yield*l.stream():yield l,yield s}yield Ld.encode(`--${t}--`)}return{stream:fNe.from(o()),contentType:`multipart/form-data; boundary=${t}`}}s1.exports.isFormDataLike=pNe;s1.exports.formDataToStream=hNe});var s3=T((not,Ew)=>{"use strict";var{Readable:n3,addAbortSignal:mNe}=ie("node:stream"),a1=ie("node:util"),gNe=K5(),yNe=ie("node:assert"),{createDeprecation:_Ne}=X5(),vNe=t3(),{isFormDataLike:bNe,formDataToStream:wNe}=r3(),{EventEmitter:SNe}=ie("node:events"),kNe=_Ne({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function xNe(e){return e.port?e.host:e.hostname+(e.protocol==="https:"?":443":":80")}var o1=class extends SNe{constructor(t){super(),this.remoteAddress=t}};function i3(e){return new t(this);function t(r){tu.call(r,{...e,Request:void 0}),Object.assign(this,r);for(let n of Object.keys(tu.prototype))this.constructor.prototype[n]=tu.prototype[n];return a1.inherits(this.constructor,e.Request),this}}function tu(e){n3.call(this,{autoDestroy:!1});let t=vNe(e.url||e.path,e.query);this.url=t.pathname+t.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=e.method?e.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let r=e.headers||{};for(let o in r){let a=o.toLowerCase();if((a==="user-agent"||a==="content-type")&&r[o]===void 0){this.headers[a]=void 0;continue}let u=r[o];yNe(u!==void 0,'invalid value "undefined" for header '+o),this.headers[a]=""+u}if("user-agent"in this.headers||(this.headers["user-agent"]="lightMyRequest"),this.headers.host=this.headers.host||e.authority||xNe(t),e.cookies){let{cookies:o}=e,a=Object.keys(o).map(u=>gNe.serialize(u,o[u]));this.headers.cookie&&a.unshift(this.headers.cookie),this.headers.cookie=a.join("; ")}this.socket=new o1(e.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return kNe(),this.socket},configurable:!0});let n=e.payload||e.body||null,i=n&&typeof n.resume=="function";if(bNe(n)){let o=wNe(n);n=o.stream,i=!0,this.headers["content-type"]=o.contentType,this.headers["transfer-encoding"]="chunked"}n&&typeof n!="string"&&!i&&!Buffer.isBuffer(n)&&(n=JSON.stringify(n),"content-type"in this.headers||(this.headers["content-type"]="application/json")),n&&!i&&!Object.hasOwn(this.headers,"content-length")&&(this.headers["content-length"]=(Buffer.isBuffer(n)?n.length:Buffer.byteLength(n)).toString());for(let o of Object.keys(this.headers))this.rawHeaders.push(o,this.headers[o]);this._lightMyRequest={payload:n,isDone:!1,simulate:e.simulate||{},payloadAsStream:e.payloadAsStream,signal:e.signal};let s=e.signal;s&&mNe(s,this);{let o=this._lightMyRequest.payload;o?._readableState?(this._read=$Ne,o.on("error",a=>{this.destroy(a)}),o.on("end",()=>{this.push(null)})):this._read=ENe}return this}function $Ne(){let e=this._lightMyRequest.payload,t=!0,r=!1,n;for(;t&&(n=e.read());)r=!0,t=this.push(n);t&&!r&&this._lightMyRequest.payload.once("readable",this._read.bind(this))}function ENe(){setImmediate(()=>{if(this._lightMyRequest.isDone){this._lightMyRequest.simulate.end!==!1&&this.push(null);return}this._lightMyRequest.isDone=!0,this._lightMyRequest.payload&&(this._lightMyRequest.simulate.split?(this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1))):this.push(this._lightMyRequest.payload)),this._lightMyRequest.simulate.error&&this.emit("error",new Error("Simulated")),this._lightMyRequest.simulate.close&&this.emit("close"),this._lightMyRequest.simulate.end!==!1&&this.push(null)})}a1.inherits(tu,n3);a1.inherits(i3,tu);tu.prototype.destroy=function(e){this.destroyed||this._lightMyRequest.isDone||(this.destroyed=!0,e&&(this._error=!0,process.nextTick(()=>this.emit("error",e))),process.nextTick(()=>this.emit("close")))};Ew.exports=tu;Ew.exports.Request=tu;Ew.exports.CustomRequest=i3});var a3=T((iot,Am)=>{"use strict";var Tw={decodeValues:!0,map:!1,silent:!1};function u1(e){return typeof e!="string"||e in{}}function l1(){return Object.create(null)}function c1(e){return typeof e=="string"&&!!e.trim()}function d1(e,t){var r=e.split(";").filter(c1),n=r.shift(),i=TNe(n),s=i.name,o=i.value;if(t=t?Object.assign({},Tw,t):Tw,u1(s))return null;try{o=t.decodeValues?decodeURIComponent(o):o}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=l1();return a.name=s,a.value=o,r.forEach(function(u){var l=u.split("="),c=l.shift().trimLeft().toLowerCase();if(!u1(c)){var d=l.join("=");if(c==="expires")a.expires=new Date(d);else if(c==="max-age"){var p=parseInt(d,10);Number.isNaN(p)||(a.maxAge=p)}else c==="secure"?a.secure=!0:c==="httponly"?a.httpOnly=!0:c==="samesite"?a.sameSite=d:c==="partitioned"?a.partitioned=!0:c&&(a[c]=d)}}),a}function TNe(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function o3(e,t){if(t=t?Object.assign({},Tw,t):Tw,!e)return t.map?l1():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}if(Array.isArray(e)||(e=[e]),t.map){var n=l1();return e.filter(c1).reduce(function(i,s){var o=d1(s,t);return o&&!u1(o.name)&&(i[o.name]=o),i},n)}else return e.filter(c1).map(function(i){return d1(i,t)}).filter(Boolean)}function RNe(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,i,s,o,a;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function l(){return i=e.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<e.length;){for(n=r,a=!1;u();)if(i=e.charAt(r),i===","){for(s=r,r+=1,u(),o=r;r<e.length&&l();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=o,t.push(e.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}Am.exports=o3;Am.exports.parse=o3;Am.exports.parseString=d1;Am.exports.splitCookiesString=RNe});var f3=T((sot,d3)=>{"use strict";var Dm=ie("node:http"),{Writable:PNe,Readable:u3,addAbortSignal:INe}=ie("node:stream"),ONe=ie("node:util"),CNe=a3();function ru(e,t,r){if(Dm.ServerResponse.call(this,e),e._lightMyRequest?.payloadAsStream){let a=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new u3({read:a})};let u=e._lightMyRequest.signal;u&&INe(u,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket(NNe()),this._promiseCallback=typeof r=="function";let n=!1,i=a=>{if(!n){if(n=!0,this._promiseCallback)return process.nextTick(()=>t(a));process.nextTick(()=>t(null,a))}};this._lightMyRequest.onEndSuccess=i;let s=!1,o=a=>{if(n){this._lightMyRequest.stream&&!s&&(a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._lightMyRequest.stream.destroy(a),this._lightMyRequest.stream.on("error",()=>{}));return}if(n=!0,a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._promiseCallback)return process.nextTick(()=>r(a));process.nextTick(()=>t(a,null))};this._lightMyRequest.stream?this.once("finish",()=>{s=!0,this._lightMyRequest.stream.push(null)}):this.once("finish",()=>{let a=l3(this);a.raw.req=e,i(a)}),this.connection.once("error",o),this.once("error",o),this.once("close",o)}ONe.inherits(ru,Dm.ServerResponse);ru.prototype.setTimeout=function(e,t){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},e),this.on("timeout",t),this};ru.prototype.writeHead=function(){let e=Dm.ServerResponse.prototype.writeHead.apply(this,arguments);return c3(this),this._lightMyRequest.stream&&this._lightMyRequest.onEndSuccess(l3(this)),e};ru.prototype.write=function(e,t,r){return this.timeoutHandle&&clearTimeout(this.timeoutHandle),Dm.ServerResponse.prototype.write.call(this,e,t,r),this._lightMyRequest.stream?this._lightMyRequest.stream.push(Buffer.from(e,t)):(this._lightMyRequest.payloadChunks.push(Buffer.from(e,t)),!0)};ru.prototype.end=function(e,t,r){e&&this.write(e,t),Dm.ServerResponse.prototype.end.call(this,r),this.emit("finish"),this.destroy()};ru.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&process.nextTick(()=>this.emit("error",e)),process.nextTick(()=>this.emit("close")))};ru.prototype.addTrailers=function(e){for(let t in e)this._lightMyRequest.trailers[t.toLowerCase().trim()]=e[t].toString().trim()};function l3(e){e._lightMyRequest.headers===null&&c3(e),ANe(e);let t={raw:{res:e},headers:e._lightMyRequest.headers,statusCode:e.statusCode,statusMessage:e.statusMessage,trailers:{},get cookies(){return CNe.parse(this)}};if(t.trailers=e._lightMyRequest.trailers,e._lightMyRequest.payloadChunks){let r=Buffer.concat(e._lightMyRequest.payloadChunks);t.rawPayload=r,t.payload=r.toString(),t.body=t.payload,t.json=function(){return JSON.parse(t.payload)}}else t.json=function(){throw new Error("Response payload is not available with payloadAsStream: true")};return t.stream=function(){return e._lightMyRequest.stream?e._lightMyRequest.stream:u3.from(e._lightMyRequest.payloadChunks)},t}function NNe(){return new PNe({write(e,t,r){setImmediate(r)}})}function ANe(e){let t=e._lightMyRequest.headers;for(let r of Object.keys(t)){let n=t[r];Array.isArray(n)?t[r]=n.map(i=>""+i):t[r]=""+n}}function c3(e){e._lightMyRequest.headers=Object.assign({},e.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach(t=>{let r=new RegExp("\\r\\n"+t+": ([^\\r]*)\\r\\n"),n=e._header?.match(r);n&&(e._lightMyRequest.headers[t.toLowerCase()]=n[1])})}d3.exports=ru});var p3=T((oot,f1)=>{"use strict";f1.exports=Br;f1.exports.default=Br;var DNe={type:"object",properties:{url:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},path:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},cookies:{type:"object",additionalProperties:!0},headers:{type:"object",additionalProperties:!0},query:{anyOf:[{type:"object",additionalProperties:!0},{type:"string"}]},simulate:{type:"object",properties:{end:{type:"boolean"},split:{type:"boolean"},error:{type:"boolean"},close:{type:"boolean"}}},authority:{type:"string"},remoteAddress:{type:"string"},method:{type:"string",enum:["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE","acl","bind","checkout","connect","copy","delete","get","head","link","lock","m-search","merge","mkactivity","mkcalendar","mkcol","move","notify","options","patch","post","propfind","proppatch","purge","put","query","rebind","report","search","source","subscribe","trace","unbind","unlink","unlock","unsubscribe"]},validate:{type:"boolean"}},additionalProperties:!0,oneOf:[{required:["url"]},{required:["path"]}]};function Br(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0,a=o,u=!1,l=null,c=o;if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.url===void 0&&(m="url")){let S={instancePath:t,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"};s===null?s=[S]:s.push(S),o++}}var p=c===o;p&&(u=!0,l=0);let d=o;if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.path===void 0&&(m="path")){let S={instancePath:t,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"};s===null?s=[S]:s.push(S),o++}}var p=d===o;if(p&&u?(u=!1,l=[l,1]):p&&(u=!0,l=1),u)o=a,s!==null&&(a?s.length=a:s=null);else{let m={instancePath:t,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:l},message:"must match exactly one schema in oneOf"};return s===null?s=[m]:s.push(m),o++,Br.errors=s,!1}if(o===0)if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.url!==void 0){let m=e.url,S=o,w=o,k=!1,x=null,R=o;if(typeof m!="string"){let P=typeof m,C;if(C===void 0)if(P=="number"||P=="boolean")C=""+m;else if(m===null)C="";else{let $={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[$]:s.push($),o++}C!==void 0&&(m=C,e!==void 0&&(e.url=C))}var h=R===o;h&&(k=!0,x=0);let E=o;if(o===E)if(m&&typeof m=="object"&&!Array.isArray(m)){let P;if(m.pathname===void 0&&(P="pathname")){let C={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};s===null?s=[C]:s.push(C),o++}else{if(m.protocol!==void 0){let C=m.protocol,$=o;if(typeof C!="string"){let N=typeof C,A;if(A===void 0)if(N=="number"||N=="boolean")A=""+C;else if(C===null)A="";else{let W={instancePath:t+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[W]:s.push(W),o++}A!==void 0&&(C=A,m!==void 0&&(m.protocol=A))}var f=$===o}else var f=!0;if(f){if(m.hostname!==void 0){let C=m.hostname,$=o;if(typeof C!="string"){let A=typeof C,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+C;else if(C===null)W="";else{let H={instancePath:t+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&(C=W,m!==void 0&&(m.hostname=W))}var f=$===o}else var f=!0;if(f)if(m.pathname!==void 0){let C=m.pathname,$=o;if(typeof C!="string"){let A=typeof C,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+C;else if(C===null)W="";else{let H={instancePath:t+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&(C=W,m!==void 0&&(m.pathname=W))}var f=$===o}else var f=!0}}}else{let P={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[P]:s.push(P),o++}var h=E===o;if(h&&k?(k=!1,x=[x,1]):h&&(k=!0,x=1),k)o=w,s!==null&&(w?s.length=w:s=null);else{let P={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:x},message:"must match exactly one schema in oneOf"};return s===null?s=[P]:s.push(P),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.path!==void 0){let m=e.path,S=o,w=o,k=!1,x=null,R=o;if(typeof m!="string"){let C=typeof m,$;if($===void 0)if(C=="number"||C=="boolean")$=""+m;else if(m===null)$="";else{let N={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(m=$,e!==void 0&&(e.path=$))}var _=R===o;_&&(k=!0,x=0);let E=o;if(o===E)if(m&&typeof m=="object"&&!Array.isArray(m)){let C;if(m.pathname===void 0&&(C="pathname")){let $={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:C},message:"must have required property '"+C+"'"};s===null?s=[$]:s.push($),o++}else{if(m.protocol!==void 0){let $=m.protocol,N=o;if(typeof $!="string"){let A=typeof $,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+$;else if($===null)W="";else{let H={instancePath:t+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&($=W,m!==void 0&&(m.protocol=W))}var y=N===o}else var y=!0;if(y){if(m.hostname!==void 0){let $=m.hostname,N=o;if(typeof $!="string"){let W=typeof $,H;if(H===void 0)if(W=="number"||W=="boolean")H=""+$;else if($===null)H="";else{let re={instancePath:t+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[re]:s.push(re),o++}H!==void 0&&($=H,m!==void 0&&(m.hostname=H))}var y=N===o}else var y=!0;if(y)if(m.pathname!==void 0){let $=m.pathname,N=o;if(typeof $!="string"){let W=typeof $,H;if(H===void 0)if(W=="number"||W=="boolean")H=""+$;else if($===null)H="";else{let re={instancePath:t+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[re]:s.push(re),o++}H!==void 0&&($=H,m!==void 0&&(m.pathname=H))}var y=N===o}else var y=!0}}}else{let C={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[C]:s.push(C),o++}var _=E===o;if(_&&k?(k=!1,x=[x,1]):_&&(k=!0,x=1),k)o=w,s!==null&&(w?s.length=w:s=null);else{let C={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:x},message:"must match exactly one schema in oneOf"};return s===null?s=[C]:s.push(C),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.cookies!==void 0){let m=e.cookies,S=o;if(o===S&&!(m&&typeof m=="object"&&!Array.isArray(m)))return Br.errors=[{instancePath:t+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.headers!==void 0){let m=e.headers,S=o;if(o===S&&!(m&&typeof m=="object"&&!Array.isArray(m)))return Br.errors=[{instancePath:t+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.query!==void 0){let m=e.query,S=o,w=o,k=!1,x=o;if(o===x&&!(m&&typeof m=="object"&&!Array.isArray(m))){let E={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[E]:s.push(E),o++}var b=x===o;if(k=k||b,!k){let E=o;if(typeof m!="string"){let C=typeof m,$;if($===void 0)if(C=="number"||C=="boolean")$=""+m;else if(m===null)$="";else{let N={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(m=$,e!==void 0&&(e.query=$))}var b=E===o;k=k||b}if(k)o=w,s!==null&&(w?s.length=w:s=null);else{let E={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[E]:s.push(E),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.simulate!==void 0){let m=e.simulate,S=o;if(o===S)if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.end!==void 0){let k=m.end,x=o;if(typeof k!="boolean"){let R;if(R===void 0)if(k==="false"||k===0||k===null)R=!1;else if(k==="true"||k===1)R=!0;else return Br.errors=[{instancePath:t+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;R!==void 0&&(k=R,m!==void 0&&(m.end=R))}var g=x===o}else var g=!0;if(g){if(m.split!==void 0){let k=m.split,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.split=E))}var g=x===o}else var g=!0;if(g){if(m.error!==void 0){let k=m.error,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.error=E))}var g=x===o}else var g=!0;if(g)if(m.close!==void 0){let k=m.close,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.close=E))}var g=x===o}else var g=!0}}}else return Br.errors=[{instancePath:t+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.authority!==void 0){let m=e.authority,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.authority=x))}var v=S===o}else var v=!0;if(v){if(e.remoteAddress!==void 0){let m=e.remoteAddress,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.remoteAddress=x))}var v=S===o}else var v=!0;if(v){if(e.method!==void 0){let m=e.method,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.method=x))}if(!(m==="ACL"||m==="BIND"||m==="CHECKOUT"||m==="CONNECT"||m==="COPY"||m==="DELETE"||m==="GET"||m==="HEAD"||m==="LINK"||m==="LOCK"||m==="M-SEARCH"||m==="MERGE"||m==="MKACTIVITY"||m==="MKCALENDAR"||m==="MKCOL"||m==="MOVE"||m==="NOTIFY"||m==="OPTIONS"||m==="PATCH"||m==="POST"||m==="PROPFIND"||m==="PROPPATCH"||m==="PURGE"||m==="PUT"||m==="QUERY"||m==="REBIND"||m==="REPORT"||m==="SEARCH"||m==="SOURCE"||m==="SUBSCRIBE"||m==="TRACE"||m==="UNBIND"||m==="UNLINK"||m==="UNLOCK"||m==="UNSUBSCRIBE"||m==="acl"||m==="bind"||m==="checkout"||m==="connect"||m==="copy"||m==="delete"||m==="get"||m==="head"||m==="link"||m==="lock"||m==="m-search"||m==="merge"||m==="mkactivity"||m==="mkcalendar"||m==="mkcol"||m==="move"||m==="notify"||m==="options"||m==="patch"||m==="post"||m==="propfind"||m==="proppatch"||m==="purge"||m==="put"||m==="query"||m==="rebind"||m==="report"||m==="search"||m==="source"||m==="subscribe"||m==="trace"||m==="unbind"||m==="unlink"||m==="unlock"||m==="unsubscribe"))return Br.errors=[{instancePath:t+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:DNe.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var v=S===o}else var v=!0;if(v)if(e.validate!==void 0){let m=e.validate,S=o;if(typeof m!="boolean"){let k;if(k===void 0)if(m==="false"||m===0||m===null)k=!1;else if(m==="true"||m===1)k=!0;else return Br.errors=[{instancePath:t+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(m=k,e!==void 0&&(e.validate=k))}var v=S===o}else var v=!0}}}}}}}}}else return Br.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Br.errors=s,o===0}});var g3=T((aot,zm)=>{"use strict";var jNe=ie("node:assert"),p1=s3(),Rw=f3(),Iw="The dispatch function has already been invoked",h3=p3();function h1(e,t,r){return r===void 0?new jm(e,t):Pw(e,t,r)}function zNe(e,t){let r=e._lightMyRequest.payload;if(!r||r._readableState||typeof r.resume!="function")return t();let n=[];r.on("data",i=>n.push(Buffer.from(i))),r.on("end",()=>{let i=Buffer.concat(n);return e.headers["content-length"]=e.headers["content-length"]||""+i.length,delete e.headers["transfer-encoding"],e._lightMyRequest.payload=i,t()}),r.resume()}function m3(e,t,r,n){return r.once("error",function(i){this.destroyed&&n.destroy(i)}),r.once("close",function(){this.destroyed&&!this._error&&n.destroy()}),zNe(r,()=>e.call(t,r,n))}function Pw(e,t,r){if(t=typeof t=="string"?{url:t}:t,t.validate!==!1&&(jNe(typeof e=="function","dispatchFunc should be a function"),!h3(t)))throw new Error(h3.errors.map(o=>o.message));let n=t.server||{},i=t.Request?p1.CustomRequest:p1;if(e.request&&e.request.app===e&&(Object.setPrototypeOf(Object.getPrototypeOf(e.request),i.prototype),Object.setPrototypeOf(Object.getPrototypeOf(e.response),Rw.prototype)),typeof r=="function"){let s=new i(t),o=new Rw(s,r);return m3(e,n,s,o)}else return new Promise((s,o)=>{let a=new i(t),u=new Rw(a,s,o);m3(e,n,a,u)})}function jm(e,t){typeof t=="string"?this.option={url:t}:this.option=Object.assign({},t),this.dispatch=e,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1&&process.nextTick(()=>{this._hasInvoked||this.end()})}var MNe=["delete","get","head","options","patch","post","put","trace"];MNe.forEach(e=>{jm.prototype[e]=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);return this.option.url=t,this.option.method=e.toUpperCase(),this}});var LNe=["body","cookies","headers","payload","query"];LNe.forEach(e=>{jm.prototype[e]=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);return this.option[e]=t,this}});jm.prototype.end=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);if(this._hasInvoked=!0,typeof e=="function")Pw(this.dispatch,this.option,e);else return this._promise=Pw(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(e=>{e!=="constructor"&&(jm.prototype[e]=function(...t){if(!this._promise){if(this._hasInvoked===!0)throw new Error(Iw);this._hasInvoked=!0,this._promise=Pw(this.dispatch,this.option)}return this._promise[e](...t)})});function qNe(e){return e instanceof p1||e instanceof Rw||e?.constructor?.name==="_CustomLMRRequest"}zm.exports=h1;zm.exports.default=h1;zm.exports.inject=h1;zm.exports.isInjection=qNe});var C3=T((uot,Um)=>{"use strict";var FNe="5.7.4",UNe=pU(),Aw=ie("node:http"),ZNe=ie("node:diagnostics_channel"),Mm,{kAvvioBoot:Lm,kChildren:m1,kServerBindings:y3,kBodyLimit:VNe,kSupportedHTTPMethods:Il,kRoutePrefix:_3,kLogLevel:HNe,kLogSerializers:BNe,kHooks:g1,kSchemaController:nu,kRequestAcceptVersion:WNe,kReplySerializerDefault:v3,kContentTypeParser:JNe,kReply:GNe,kRequest:KNe,kFourOhFour:YNe,kState:Sr,kOptions:y1,kPluginNameChain:qm,kSchemaErrorFormatter:_1,kErrorHandler:Ow,kKeepAliveConnections:v1,kChildLoggerFactory:b1,kGenReqId:w1,kErrorHandlerAlreadySet:Cw}=Hr(),{createServer:XNe}=FU(),Fm=Dv(),Nw=Fv(),QNe=Uv(),Ol=xh(),Cl=pP(),b3=nC(),{Hooks:eAe,hookRunnerApplication:w3,supportedHooks:S1}=Da(),{createChildLogger:S3,defaultChildLoggerFactory:tAe,createLogger:rAe}=vh(),k3=RC(),{getGenReqId:x3,reqIdGenFactory:I3}=nw(),{buildRouting:nAe,validateBodyLimitOption:iAe,buildRouterOptions:sAe}=T5(),oAe=A5(),O3=j5(),aAe=H5(),{appendStackTrace:uAe,AVVIO_ERRORS_MAP:$3,...Nl}=tn(),lAe=DT(),{defaultInitOptions:hi}=O3,{FST_ERR_ASYNC_CONSTRAINT:cAe,FST_ERR_BAD_URL:dAe,FST_ERR_OPTIONS_NOT_OBJ:fAe,FST_ERR_QSP_NOT_FN:pAe,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:hAe,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:mAe,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:gAe,FST_ERR_INSTANCE_ALREADY_LISTENING:yAe,FST_ERR_REOPENED_CLOSE_SERVER:_Ae,FST_ERR_ROUTE_REWRITE_NOT_STR:vAe,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:E3,FST_ERR_ERROR_HANDLER_NOT_FN:bAe,FST_ERR_ERROR_HANDLER_ALREADY_SET:wAe,FST_ERR_ROUTE_METHOD_INVALID:SAe}=Nl,{buildErrorHandler:T3}=wh(),{FSTWRN004:kAe}=Hc(),R3=ZNe.channel("fastify.initialization");function k1(e){let{options:t,genReqId:r,disableRequestLogging:n,hasLogger:i,initialConfig:s}=xAe(e,P,C),o=nAe(t.routerOptions),a=oAe(t),u=q(o,t),{server:l,listen:c,forceCloseConnections:d,serverHasCloseAllConnections:p,serverHasCloseHttp2Sessions:f,keepAliveConnections:h}=XNe(t,u),v=Fm.setupResponseListeners,y=b3.buildSchemaController(null,t.schemaController),_={[Sr]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[v1]:h,[Il]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[y1]:t,[m1]:[],[y3]:[],[VNe]:t.bodyLimit,[_3]:"",[HNe]:"",[BNe]:null,[g1]:new eAe,[nu]:y,[_1]:null,[Ow]:T3(),[Cw]:!1,[b1]:t.childLoggerFactory||tAe,[v3]:null,[JNe]:new Cl(t.bodyLimit,t.onProtoPoisoning||hi.onProtoPoisoning,t.onConstructorPoisoning||hi.onConstructorPoisoning),[GNe]:Fm.buildReply(Fm),[KNe]:Nw.buildRequest(Nw,t.trustProxy),[YNe]:a,[k3.kRegisteredPlugins]:[],[qm]:["fastify"],[Lm]:null,[w1]:r,routing:u,delete:function(j,V,Y){return o.prepareRoute.call(this,{method:"DELETE",url:j,options:V,handler:Y})},get:function(j,V,Y){return o.prepareRoute.call(this,{method:"GET",url:j,options:V,handler:Y})},head:function(j,V,Y){return o.prepareRoute.call(this,{method:"HEAD",url:j,options:V,handler:Y})},trace:function(j,V,Y){return o.prepareRoute.call(this,{method:"TRACE",url:j,options:V,handler:Y})},patch:function(j,V,Y){return o.prepareRoute.call(this,{method:"PATCH",url:j,options:V,handler:Y})},post:function(j,V,Y){return o.prepareRoute.call(this,{method:"POST",url:j,options:V,handler:Y})},put:function(j,V,Y){return o.prepareRoute.call(this,{method:"PUT",url:j,options:V,handler:Y})},options:function(j,V,Y){return o.prepareRoute.call(this,{method:"OPTIONS",url:j,options:V,handler:Y})},all:function(j,V,Y){return o.prepareRoute.call(this,{method:this.supportedMethods,url:j,options:V,handler:Y})},route:function(j){return o.route.call(this,{options:j})},hasRoute:function(j){return o.hasRoute.call(this,{options:j})},findRoute:function(j){return o.findRoute(j)},log:t.logger,withTypeProvider:x,addHook:R,addSchema:E,getSchema:y.getSchema.bind(y),getSchemas:y.getSchemas.bind(y),setValidatorCompiler:A,setSerializerCompiler:H,setSchemaController:re,setReplySerializer:ne,setSchemaErrorFormatter:W,setGenReqId:I,addContentTypeParser:Cl.helpers.addContentTypeParser,hasContentTypeParser:Cl.helpers.hasContentTypeParser,getDefaultJsonParser:Cl.defaultParsers.getDefaultJsonParser,defaultTextParser:Cl.defaultParsers.defaultTextParser,removeContentTypeParser:Cl.helpers.removeContentTypeParser,removeAllContentTypeParsers:Cl.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(O){return this[k3.kRegisteredPlugins].includes(O)||this[qm].includes(O)},listen:c,server:l,addresses:function(){let O=this[y3].map(j=>j.address());return O.push(this.server.address()),O.filter(j=>j)},decorate:Ol.add,hasDecorator:Ol.exist,decorateReply:Ol.decorateReply,decorateRequest:Ol.decorateRequest,hasRequestDecorator:Ol.existRequest,hasReplyDecorator:Ol.existReply,getDecorator:Ol.getInstanceDecorator,addHttpMethod:D,inject:w,printRoutes:B,setNotFoundHandler:N,setErrorHandler:Z,setChildLoggerFactory:z,initialConfig:s,addConstraintStrategy:o.addConstraintStrategy.bind(o),hasConstraintStrategy:o.hasConstraintStrategy.bind(o)};Object.defineProperties(_,{listeningOrigin:{get(){let O=this.addresses().slice(-1).pop();if(typeof O=="string")return O;let j=O.family==="IPv6"?`[${O.address}]`:O.address;return`${this[y1].https?"https":"http"}://${j}:${O.port}`}},pluginName:{configurable:!0,get(){return this[qm].length>1?this[qm].join(" -> "):this[qm][0]}},prefix:{configurable:!0,get(){return this[_3]}},validatorCompiler:{configurable:!0,get(){return this[nu].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[nu].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[b1]}},version:{configurable:!0,get(){return FNe}},errorHandler:{configurable:!0,get(){return this[Ow].func}},genReqId:{configurable:!0,get(){return this[w1]}},supportedMethods:{configurable:!1,get(){return[...this[Il].bodyless,...this[Il].bodywith]}}}),t.schemaErrorFormatter&&(P3(t.schemaErrorFormatter),_[_1]=t.schemaErrorFormatter.bind(_));let b=Number(t.pluginTimeout),g=UNe(_,{autostart:!1,timeout:isNaN(b)===!1?b:hi.pluginTimeout,expose:{use:"register"}});g.override=aAe,g.on("start",()=>_[Sr].started=!0),_[Lm]=_.ready,_.ready=k,_.printPlugins=g.prettyPrint.bind(g),g.once("preReady",()=>{_.onClose((O,j)=>{_[Sr].closing=!0,o.closeRoutes(),w3("preClose",_[Lm],_,function(){if(_[Sr].listening){if(d==="idle")O.server.closeIdleConnections();else if(p&&d)O.server.closeAllConnections();else if(d===!0)for(let V of _[v1])V.destroy(),_[v1].delete(V)}f&&O.server.closeHttp2Sessions(),!t.serverFactory||_[Sr].listening?O.server.close(function(V){V&&V.code!=="ERR_SERVER_NOT_RUNNING"?j(null):j()}):process.nextTick(j,null)})})});let m=new QNe({server:_,config:{}});return _.setNotFoundHandler(),a.arrange404(_),o.setup(t,{avvio:g,fourOhFour:a,hasLogger:i,setupResponseListeners:v,throwIfAlreadyStarted:S,keepAliveConnections:h}),l.on("clientError",t.clientErrorHandler.bind(_)),R3.hasSubscribers&&R3.publish({fastify:_}),"asyncDispose"in Symbol&&(_[Symbol.asyncDispose]=function(){return _.close()}),_;function S(O){if(_[Sr].started)throw new yAe(O)}function w(O,j){if(Mm===void 0&&(Mm=g3()),_[Sr].started){if(_[Sr].closing){let V=new _Ae;if(j){j(V);return}else return Promise.reject(V)}return Mm(u,O,j)}if(j)this.ready(V=>{V?j(V,null):Mm(u,O,j)});else return Mm((V,Y)=>{this.ready(function(me){if(me){Y.emit("error",me);return}u(V,Y)})},O)}function k(O){if(this[Sr].readyResolver!==null){if(O!=null){this[Sr].readyResolver.promise.then(()=>O(null,_),O);return}return this[Sr].readyResolver.promise}if(process.nextTick(j),this[Sr].readyResolver=lAe.withResolvers(),O)this[Sr].readyResolver.promise.then(()=>O(null,_),O);else return this[Sr].readyResolver.promise;function j(){_[Lm]((Y,me)=>{Y||_[Sr].started||_[Sr].ready||_[Sr].booting?V(Y):(_[Sr].booting=!0,w3("onReady",_[Lm],_,V)),me()})}function V(Y){if(Y=Y!=null&&$3[Y.code]!=null?uAe(Y,new $3[Y.code](Y.message)):Y,Y)return _[Sr].readyResolver.reject(Y);_[Sr].readyResolver.resolve(_),_[Sr].booting=!1,_[Sr].ready=!0,_[Sr].readyResolver=null}}function x(){return this}function R(O,j){if(S('Cannot call "addHook"!'),j==null)throw new Nl.FST_ERR_HOOK_INVALID_HANDLER(O,j);if(O==="onSend"||O==="preSerialization"||O==="onError"||O==="preParsing"){if(j.constructor.name==="AsyncFunction"&&j.length===4)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(O==="onReady"||O==="onListen"){if(j.constructor.name==="AsyncFunction"&&j.length!==0)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(O==="onRequestAbort"){if(j.constructor.name==="AsyncFunction"&&j.length!==1)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(j.constructor.name==="AsyncFunction"&&j.length===3)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;return O==="onClose"?this.onClose(j.bind(this)):O==="onReady"||O==="onListen"||O==="onRoute"?this[g1].add(O,j):this.after((Y,me)=>{try{V.call(this,O,j),me(Y)}catch(Ce){me(Ce)}}),this;function V(Y,me){this[g1].add(Y,me),this[m1].forEach(Ce=>V.call(Ce,Y,me))}}function E(O){return S('Cannot call "addSchema"!'),this[nu].add(O),this[m1].forEach(j=>j.addSchema(O)),this}function P(O,j){O.headers["accept-version"]!==void 0&&(O.headers[WNe]=O.headers["accept-version"],O.headers["accept-version"]=void 0),a.router.lookup(O,j)}function C(O,j,V){if(t.frameworkErrors){let me=x3(m.server,j),Ce=S3(m,t.logger,j,me),F=new Nw(me,null,j,null,Ce,m),M=new Fm(V,F,Ce);return(typeof n=="function"?n(j):n)===!1&&Ce.info({req:F},"incoming request"),t.frameworkErrors(new dAe(O),F,M)}let Y=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${O}' is not a valid url component`,statusCode:400});V.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(Y)}),V.end(Y)}function $(O,j,V){if(O!==!1)return function(me){if(me){if(t.frameworkErrors){let F=x3(m.server,j),M=S3(m,t.logger,j,F),X=new Nw(F,null,j,null,M,m),ee=new Fm(V,X,M);return(typeof n=="function"?n(j):n)===!1&&M.info({req:X},"incoming request"),t.frameworkErrors(new cAe,X,ee)}let Ce='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';V.writeHead(500,{"Content-Type":"application/json","Content-Length":Ce.length}),V.end(Ce)}}}function N(O,j){return S('Cannot call "setNotFoundHandler"!'),a.setNotFoundHandler.call(this,O,j,g,o.routeHandler),this}function A(O){return S('Cannot call "setValidatorCompiler"!'),this[nu].setValidatorCompiler(O),this}function W(O){return S('Cannot call "setSchemaErrorFormatter"!'),P3(O),this[_1]=O.bind(this),this}function H(O){return S('Cannot call "setSerializerCompiler"!'),this[nu].setSerializerCompiler(O),this}function re(O){S('Cannot call "setSchemaController"!');let j=this[nu],V=b3.buildSchemaController(j,Object.assign({},j.opts,O));return this[nu]=V,this.getSchema=V.getSchema.bind(V),this.getSchemas=V.getSchemas.bind(V),this}function ne(O){return S('Cannot call "setReplySerializer"!'),this[v3]=O,this}function Z(O){if(S('Cannot call "setErrorHandler"!'),typeof O!="function")throw new bAe;if(!t.allowErrorHandlerOverride&&this[Cw])throw new wAe;return this[Cw]&&kAe("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride"),this[Cw]=!0,this[Ow]=T3(this[Ow],O.bind(this)),this}function z(O){return S('Cannot call "setChildLoggerFactory"!'),this[b1]=O,this}function B(O={}){return O.includeMeta=O.includeHooks?O.includeMeta?S1.concat(O.includeMeta):S1:O.includeMeta,o.printRoutes(O)}function q(O,{rewriteUrl:j,logger:V}){let Y;return function(Ce,F){if(Y===void 0&&(Y=O.isAsyncConstraint()),j){Ce.originalUrl=Ce.url;let M=j.call(_,Ce);if(typeof M=="string")Ce.url=M;else{let X=new vAe(Ce.url,typeof M);Ce.destroy(X)}}O.routing(Ce,F,$(Y,Ce,F))}}function I(O){return S('Cannot call "setGenReqId"!'),this[w1]=I3(this[y1].requestIdHeader,O),this}function D(O,{hasBody:j=!1}={}){if(typeof O!="string"||Aw.METHODS.indexOf(O)===-1)throw new SAe;j===!0?(this[Il].bodywith.add(O),this[Il].bodyless.delete(O)):(this[Il].bodywith.delete(O),this[Il].bodyless.add(O));let V=O.toLowerCase();return this.hasDecorator(V)||this.decorate(V,function(Y,me,Ce){return o.prepareRoute.call(this,{method:O,url:Y,options:me,handler:Ce})}),this}}function xAe(e,t,r){if(e&&typeof e!="object")throw new fAe;if(e=Object.assign({},e),e.querystringParser&&typeof e.querystringParser!="function"||e.routerOptions?.querystringParser&&typeof e.routerOptions.querystringParser!="function")throw new pAe(typeof(e.querystringParser??e.routerOptions.querystringParser));if(e.schemaController&&e.schemaController.bucket&&typeof e.schemaController.bucket!="function")throw new hAe(typeof e.schemaController.bucket);iAe(e.bodyLimit);let n=typeof e.requestIdHeader=="string"&&e.requestIdHeader.length!==0?e.requestIdHeader.toLowerCase():e.requestIdHeader===!0&&"request-id",i=I3(n,e.genReqId),s=e.requestIdLogLabel||"reqId";e.bodyLimit=e.bodyLimit||hi.bodyLimit;let o=e.disableRequestLogging||!1,a=Object.assign({customOptions:{},plugins:[]},e.ajv);if(!a.customOptions||Object.prototype.toString.call(a.customOptions)!=="[object Object]")throw new mAe(typeof a.customOptions);if(!a.plugins||!Array.isArray(a.plugins))throw new gAe(typeof a.plugins);let{logger:u,hasLogger:l}=rAe(e);e.connectionTimeout=e.connectionTimeout||hi.connectionTimeout,e.keepAliveTimeout=e.keepAliveTimeout||hi.keepAliveTimeout,e.maxRequestsPerSocket=e.maxRequestsPerSocket||hi.maxRequestsPerSocket,e.requestTimeout=e.requestTimeout||hi.requestTimeout,e.logger=u,e.requestIdHeader=n,e.requestIdLogLabel=s,e.disableRequestLogging=o,e.ajv=a,e.clientErrorHandler=e.clientErrorHandler||EAe,e.allowErrorHandlerOverride=e.allowErrorHandlerOverride??hi.allowErrorHandlerOverride;let c=O3(e);return e.exposeHeadRoutes=c.exposeHeadRoutes,e.http2SessionTimeout=c.http2SessionTimeout,e.routerOptions=sAe(e,{defaultRoute:t,onBadUrl:r,ignoreTrailingSlash:hi.ignoreTrailingSlash,ignoreDuplicateSlashes:hi.ignoreDuplicateSlashes,maxParamLength:hi.maxParamLength,allowUnsafeRegex:hi.allowUnsafeRegex,buildPrettyMeta:$Ae,useSemicolonDelimiter:hi.useSemicolonDelimiter}),{options:e,genReqId:i,disableRequestLogging:o,hasLogger:l,initialConfig:c}}function $Ae(e){let t={};return["errorHandler","logLevel","logSerializers"].concat(S1).forEach(n=>{t[n]=e.store[n]}),Object.assign({},t)}function EAe(e,t){if(e.code==="ECONNRESET"||t.destroyed)return;let r,n,i,s;e.code==="ERR_HTTP_REQUEST_TIMEOUT"?(n="408",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Timeout","statusCode":408}`,s="timeout"):e.code==="HPE_HEADER_OVERFLOW"?(n="431",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,s="header_overflow"):(n="400",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Error","statusCode":400}`,s="error"),this.log.trace({err:e},`client ${s}`),t.writable&&t.write(`HTTP/1.1 ${n} ${i}\r
349
+ `,yield Ld.encode(c),l.stream?yield*l.stream():yield l,yield s}yield Ld.encode(`--${t}--`)}return{stream:fNe.from(o()),contentType:`multipart/form-data; boundary=${t}`}}s1.exports.isFormDataLike=pNe;s1.exports.formDataToStream=hNe});var s3=T((not,Ew)=>{"use strict";var{Readable:n3,addAbortSignal:mNe}=ie("node:stream"),a1=ie("node:util"),gNe=K5(),yNe=ie("node:assert"),{createDeprecation:_Ne}=X5(),vNe=t3(),{isFormDataLike:bNe,formDataToStream:wNe}=r3(),{EventEmitter:SNe}=ie("node:events"),kNe=_Ne({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function xNe(e){return e.port?e.host:e.hostname+(e.protocol==="https:"?":443":":80")}var o1=class extends SNe{constructor(t){super(),this.remoteAddress=t}};function i3(e){return new t(this);function t(r){tu.call(r,{...e,Request:void 0}),Object.assign(this,r);for(let n of Object.keys(tu.prototype))this.constructor.prototype[n]=tu.prototype[n];return a1.inherits(this.constructor,e.Request),this}}function tu(e){n3.call(this,{autoDestroy:!1});let t=vNe(e.url||e.path,e.query);this.url=t.pathname+t.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=e.method?e.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let r=e.headers||{};for(let o in r){let a=o.toLowerCase();if((a==="user-agent"||a==="content-type")&&r[o]===void 0){this.headers[a]=void 0;continue}let u=r[o];yNe(u!==void 0,'invalid value "undefined" for header '+o),this.headers[a]=""+u}if("user-agent"in this.headers||(this.headers["user-agent"]="lightMyRequest"),this.headers.host=this.headers.host||e.authority||xNe(t),e.cookies){let{cookies:o}=e,a=Object.keys(o).map(u=>gNe.serialize(u,o[u]));this.headers.cookie&&a.unshift(this.headers.cookie),this.headers.cookie=a.join("; ")}this.socket=new o1(e.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return kNe(),this.socket},configurable:!0});let n=e.payload||e.body||null,i=n&&typeof n.resume=="function";if(bNe(n)){let o=wNe(n);n=o.stream,i=!0,this.headers["content-type"]=o.contentType,this.headers["transfer-encoding"]="chunked"}n&&typeof n!="string"&&!i&&!Buffer.isBuffer(n)&&(n=JSON.stringify(n),"content-type"in this.headers||(this.headers["content-type"]="application/json")),n&&!i&&!Object.hasOwn(this.headers,"content-length")&&(this.headers["content-length"]=(Buffer.isBuffer(n)?n.length:Buffer.byteLength(n)).toString());for(let o of Object.keys(this.headers))this.rawHeaders.push(o,this.headers[o]);this._lightMyRequest={payload:n,isDone:!1,simulate:e.simulate||{},payloadAsStream:e.payloadAsStream,signal:e.signal};let s=e.signal;s&&mNe(s,this);{let o=this._lightMyRequest.payload;o?._readableState?(this._read=$Ne,o.on("error",a=>{this.destroy(a)}),o.on("end",()=>{this.push(null)})):this._read=ENe}return this}function $Ne(){let e=this._lightMyRequest.payload,t=!0,r=!1,n;for(;t&&(n=e.read());)r=!0,t=this.push(n);t&&!r&&this._lightMyRequest.payload.once("readable",this._read.bind(this))}function ENe(){setImmediate(()=>{if(this._lightMyRequest.isDone){this._lightMyRequest.simulate.end!==!1&&this.push(null);return}this._lightMyRequest.isDone=!0,this._lightMyRequest.payload&&(this._lightMyRequest.simulate.split?(this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1))):this.push(this._lightMyRequest.payload)),this._lightMyRequest.simulate.error&&this.emit("error",new Error("Simulated")),this._lightMyRequest.simulate.close&&this.emit("close"),this._lightMyRequest.simulate.end!==!1&&this.push(null)})}a1.inherits(tu,n3);a1.inherits(i3,tu);tu.prototype.destroy=function(e){this.destroyed||this._lightMyRequest.isDone||(this.destroyed=!0,e&&(this._error=!0,process.nextTick(()=>this.emit("error",e))),process.nextTick(()=>this.emit("close")))};Ew.exports=tu;Ew.exports.Request=tu;Ew.exports.CustomRequest=i3});var a3=T((iot,Am)=>{"use strict";var Tw={decodeValues:!0,map:!1,silent:!1};function u1(e){return typeof e!="string"||e in{}}function l1(){return Object.create(null)}function c1(e){return typeof e=="string"&&!!e.trim()}function d1(e,t){var r=e.split(";").filter(c1),n=r.shift(),i=TNe(n),s=i.name,o=i.value;if(t=t?Object.assign({},Tw,t):Tw,u1(s))return null;try{o=t.decodeValues?decodeURIComponent(o):o}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=l1();return a.name=s,a.value=o,r.forEach(function(u){var l=u.split("="),c=l.shift().trimLeft().toLowerCase();if(!u1(c)){var d=l.join("=");if(c==="expires")a.expires=new Date(d);else if(c==="max-age"){var p=parseInt(d,10);Number.isNaN(p)||(a.maxAge=p)}else c==="secure"?a.secure=!0:c==="httponly"?a.httpOnly=!0:c==="samesite"?a.sameSite=d:c==="partitioned"?a.partitioned=!0:c&&(a[c]=d)}}),a}function TNe(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function o3(e,t){if(t=t?Object.assign({},Tw,t):Tw,!e)return t.map?l1():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}if(Array.isArray(e)||(e=[e]),t.map){var n=l1();return e.filter(c1).reduce(function(i,s){var o=d1(s,t);return o&&!u1(o.name)&&(i[o.name]=o),i},n)}else return e.filter(c1).map(function(i){return d1(i,t)}).filter(Boolean)}function RNe(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,i,s,o,a;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function l(){return i=e.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<e.length;){for(n=r,a=!1;u();)if(i=e.charAt(r),i===","){for(s=r,r+=1,u(),o=r;r<e.length&&l();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=o,t.push(e.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}Am.exports=o3;Am.exports.parse=o3;Am.exports.parseString=d1;Am.exports.splitCookiesString=RNe});var f3=T((sot,d3)=>{"use strict";var Dm=ie("node:http"),{Writable:PNe,Readable:u3,addAbortSignal:INe}=ie("node:stream"),ONe=ie("node:util"),CNe=a3();function ru(e,t,r){if(Dm.ServerResponse.call(this,e),e._lightMyRequest?.payloadAsStream){let a=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new u3({read:a})};let u=e._lightMyRequest.signal;u&&INe(u,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket(NNe()),this._promiseCallback=typeof r=="function";let n=!1,i=a=>{if(!n){if(n=!0,this._promiseCallback)return process.nextTick(()=>t(a));process.nextTick(()=>t(null,a))}};this._lightMyRequest.onEndSuccess=i;let s=!1,o=a=>{if(n){this._lightMyRequest.stream&&!s&&(a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._lightMyRequest.stream.destroy(a),this._lightMyRequest.stream.on("error",()=>{}));return}if(n=!0,a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._promiseCallback)return process.nextTick(()=>r(a));process.nextTick(()=>t(a,null))};this._lightMyRequest.stream?this.once("finish",()=>{s=!0,this._lightMyRequest.stream.push(null)}):this.once("finish",()=>{let a=l3(this);a.raw.req=e,i(a)}),this.connection.once("error",o),this.once("error",o),this.once("close",o)}ONe.inherits(ru,Dm.ServerResponse);ru.prototype.setTimeout=function(e,t){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},e),this.on("timeout",t),this};ru.prototype.writeHead=function(){let e=Dm.ServerResponse.prototype.writeHead.apply(this,arguments);return c3(this),this._lightMyRequest.stream&&this._lightMyRequest.onEndSuccess(l3(this)),e};ru.prototype.write=function(e,t,r){return this.timeoutHandle&&clearTimeout(this.timeoutHandle),Dm.ServerResponse.prototype.write.call(this,e,t,r),this._lightMyRequest.stream?this._lightMyRequest.stream.push(Buffer.from(e,t)):(this._lightMyRequest.payloadChunks.push(Buffer.from(e,t)),!0)};ru.prototype.end=function(e,t,r){e&&this.write(e,t),Dm.ServerResponse.prototype.end.call(this,r),this.emit("finish"),this.destroy()};ru.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&process.nextTick(()=>this.emit("error",e)),process.nextTick(()=>this.emit("close")))};ru.prototype.addTrailers=function(e){for(let t in e)this._lightMyRequest.trailers[t.toLowerCase().trim()]=e[t].toString().trim()};function l3(e){e._lightMyRequest.headers===null&&c3(e),ANe(e);let t={raw:{res:e},headers:e._lightMyRequest.headers,statusCode:e.statusCode,statusMessage:e.statusMessage,trailers:{},get cookies(){return CNe.parse(this)}};if(t.trailers=e._lightMyRequest.trailers,e._lightMyRequest.payloadChunks){let r=Buffer.concat(e._lightMyRequest.payloadChunks);t.rawPayload=r,t.payload=r.toString(),t.body=t.payload,t.json=function(){return JSON.parse(t.payload)}}else t.json=function(){throw new Error("Response payload is not available with payloadAsStream: true")};return t.stream=function(){return e._lightMyRequest.stream?e._lightMyRequest.stream:u3.from(e._lightMyRequest.payloadChunks)},t}function NNe(){return new PNe({write(e,t,r){setImmediate(r)}})}function ANe(e){let t=e._lightMyRequest.headers;for(let r of Object.keys(t)){let n=t[r];Array.isArray(n)?t[r]=n.map(i=>""+i):t[r]=""+n}}function c3(e){e._lightMyRequest.headers=Object.assign({},e.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach(t=>{let r=new RegExp("\\r\\n"+t+": ([^\\r]*)\\r\\n"),n=e._header?.match(r);n&&(e._lightMyRequest.headers[t.toLowerCase()]=n[1])})}d3.exports=ru});var p3=T((oot,f1)=>{"use strict";f1.exports=Br;f1.exports.default=Br;var DNe={type:"object",properties:{url:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},path:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},cookies:{type:"object",additionalProperties:!0},headers:{type:"object",additionalProperties:!0},query:{anyOf:[{type:"object",additionalProperties:!0},{type:"string"}]},simulate:{type:"object",properties:{end:{type:"boolean"},split:{type:"boolean"},error:{type:"boolean"},close:{type:"boolean"}}},authority:{type:"string"},remoteAddress:{type:"string"},method:{type:"string",enum:["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE","acl","bind","checkout","connect","copy","delete","get","head","link","lock","m-search","merge","mkactivity","mkcalendar","mkcol","move","notify","options","patch","post","propfind","proppatch","purge","put","query","rebind","report","search","source","subscribe","trace","unbind","unlink","unlock","unsubscribe"]},validate:{type:"boolean"}},additionalProperties:!0,oneOf:[{required:["url"]},{required:["path"]}]};function Br(e,{instancePath:t="",parentData:r,parentDataProperty:n,rootData:i=e}={}){let s=null,o=0,a=o,u=!1,l=null,c=o;if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.url===void 0&&(m="url")){let S={instancePath:t,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"};s===null?s=[S]:s.push(S),o++}}var p=c===o;p&&(u=!0,l=0);let d=o;if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.path===void 0&&(m="path")){let S={instancePath:t,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"};s===null?s=[S]:s.push(S),o++}}var p=d===o;if(p&&u?(u=!1,l=[l,1]):p&&(u=!0,l=1),u)o=a,s!==null&&(a?s.length=a:s=null);else{let m={instancePath:t,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:l},message:"must match exactly one schema in oneOf"};return s===null?s=[m]:s.push(m),o++,Br.errors=s,!1}if(o===0)if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.url!==void 0){let m=e.url,S=o,w=o,k=!1,x=null,R=o;if(typeof m!="string"){let P=typeof m,C;if(C===void 0)if(P=="number"||P=="boolean")C=""+m;else if(m===null)C="";else{let $={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[$]:s.push($),o++}C!==void 0&&(m=C,e!==void 0&&(e.url=C))}var h=R===o;h&&(k=!0,x=0);let E=o;if(o===E)if(m&&typeof m=="object"&&!Array.isArray(m)){let P;if(m.pathname===void 0&&(P="pathname")){let C={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};s===null?s=[C]:s.push(C),o++}else{if(m.protocol!==void 0){let C=m.protocol,$=o;if(typeof C!="string"){let N=typeof C,A;if(A===void 0)if(N=="number"||N=="boolean")A=""+C;else if(C===null)A="";else{let W={instancePath:t+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[W]:s.push(W),o++}A!==void 0&&(C=A,m!==void 0&&(m.protocol=A))}var f=$===o}else var f=!0;if(f){if(m.hostname!==void 0){let C=m.hostname,$=o;if(typeof C!="string"){let A=typeof C,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+C;else if(C===null)W="";else{let H={instancePath:t+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&(C=W,m!==void 0&&(m.hostname=W))}var f=$===o}else var f=!0;if(f)if(m.pathname!==void 0){let C=m.pathname,$=o;if(typeof C!="string"){let A=typeof C,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+C;else if(C===null)W="";else{let H={instancePath:t+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&(C=W,m!==void 0&&(m.pathname=W))}var f=$===o}else var f=!0}}}else{let P={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[P]:s.push(P),o++}var h=E===o;if(h&&k?(k=!1,x=[x,1]):h&&(k=!0,x=1),k)o=w,s!==null&&(w?s.length=w:s=null);else{let P={instancePath:t+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:x},message:"must match exactly one schema in oneOf"};return s===null?s=[P]:s.push(P),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.path!==void 0){let m=e.path,S=o,w=o,k=!1,x=null,R=o;if(typeof m!="string"){let C=typeof m,$;if($===void 0)if(C=="number"||C=="boolean")$=""+m;else if(m===null)$="";else{let N={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(m=$,e!==void 0&&(e.path=$))}var _=R===o;_&&(k=!0,x=0);let E=o;if(o===E)if(m&&typeof m=="object"&&!Array.isArray(m)){let C;if(m.pathname===void 0&&(C="pathname")){let $={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:C},message:"must have required property '"+C+"'"};s===null?s=[$]:s.push($),o++}else{if(m.protocol!==void 0){let $=m.protocol,N=o;if(typeof $!="string"){let A=typeof $,W;if(W===void 0)if(A=="number"||A=="boolean")W=""+$;else if($===null)W="";else{let H={instancePath:t+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[H]:s.push(H),o++}W!==void 0&&($=W,m!==void 0&&(m.protocol=W))}var y=N===o}else var y=!0;if(y){if(m.hostname!==void 0){let $=m.hostname,N=o;if(typeof $!="string"){let W=typeof $,H;if(H===void 0)if(W=="number"||W=="boolean")H=""+$;else if($===null)H="";else{let te={instancePath:t+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[te]:s.push(te),o++}H!==void 0&&($=H,m!==void 0&&(m.hostname=H))}var y=N===o}else var y=!0;if(y)if(m.pathname!==void 0){let $=m.pathname,N=o;if(typeof $!="string"){let W=typeof $,H;if(H===void 0)if(W=="number"||W=="boolean")H=""+$;else if($===null)H="";else{let te={instancePath:t+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[te]:s.push(te),o++}H!==void 0&&($=H,m!==void 0&&(m.pathname=H))}var y=N===o}else var y=!0}}}else{let C={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[C]:s.push(C),o++}var _=E===o;if(_&&k?(k=!1,x=[x,1]):_&&(k=!0,x=1),k)o=w,s!==null&&(w?s.length=w:s=null);else{let C={instancePath:t+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:x},message:"must match exactly one schema in oneOf"};return s===null?s=[C]:s.push(C),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.cookies!==void 0){let m=e.cookies,S=o;if(o===S&&!(m&&typeof m=="object"&&!Array.isArray(m)))return Br.errors=[{instancePath:t+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.headers!==void 0){let m=e.headers,S=o;if(o===S&&!(m&&typeof m=="object"&&!Array.isArray(m)))return Br.errors=[{instancePath:t+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.query!==void 0){let m=e.query,S=o,w=o,k=!1,x=o;if(o===x&&!(m&&typeof m=="object"&&!Array.isArray(m))){let E={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[E]:s.push(E),o++}var b=x===o;if(k=k||b,!k){let E=o;if(typeof m!="string"){let C=typeof m,$;if($===void 0)if(C=="number"||C=="boolean")$=""+m;else if(m===null)$="";else{let N={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}$!==void 0&&(m=$,e!==void 0&&(e.query=$))}var b=E===o;k=k||b}if(k)o=w,s!==null&&(w?s.length=w:s=null);else{let E={instancePath:t+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[E]:s.push(E),o++,Br.errors=s,!1}var v=S===o}else var v=!0;if(v){if(e.simulate!==void 0){let m=e.simulate,S=o;if(o===S)if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.end!==void 0){let k=m.end,x=o;if(typeof k!="boolean"){let R;if(R===void 0)if(k==="false"||k===0||k===null)R=!1;else if(k==="true"||k===1)R=!0;else return Br.errors=[{instancePath:t+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;R!==void 0&&(k=R,m!==void 0&&(m.end=R))}var g=x===o}else var g=!0;if(g){if(m.split!==void 0){let k=m.split,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.split=E))}var g=x===o}else var g=!0;if(g){if(m.error!==void 0){let k=m.error,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.error=E))}var g=x===o}else var g=!0;if(g)if(m.close!==void 0){let k=m.close,x=o;if(typeof k!="boolean"){let E;if(E===void 0)if(k==="false"||k===0||k===null)E=!1;else if(k==="true"||k===1)E=!0;else return Br.errors=[{instancePath:t+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;E!==void 0&&(k=E,m!==void 0&&(m.close=E))}var g=x===o}else var g=!0}}}else return Br.errors=[{instancePath:t+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var v=S===o}else var v=!0;if(v){if(e.authority!==void 0){let m=e.authority,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.authority=x))}var v=S===o}else var v=!0;if(v){if(e.remoteAddress!==void 0){let m=e.remoteAddress,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.remoteAddress=x))}var v=S===o}else var v=!0;if(v){if(e.method!==void 0){let m=e.method,S=o;if(typeof m!="string"){let k=typeof m,x;if(x===void 0)if(k=="number"||k=="boolean")x=""+m;else if(m===null)x="";else return Br.errors=[{instancePath:t+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;x!==void 0&&(m=x,e!==void 0&&(e.method=x))}if(!(m==="ACL"||m==="BIND"||m==="CHECKOUT"||m==="CONNECT"||m==="COPY"||m==="DELETE"||m==="GET"||m==="HEAD"||m==="LINK"||m==="LOCK"||m==="M-SEARCH"||m==="MERGE"||m==="MKACTIVITY"||m==="MKCALENDAR"||m==="MKCOL"||m==="MOVE"||m==="NOTIFY"||m==="OPTIONS"||m==="PATCH"||m==="POST"||m==="PROPFIND"||m==="PROPPATCH"||m==="PURGE"||m==="PUT"||m==="QUERY"||m==="REBIND"||m==="REPORT"||m==="SEARCH"||m==="SOURCE"||m==="SUBSCRIBE"||m==="TRACE"||m==="UNBIND"||m==="UNLINK"||m==="UNLOCK"||m==="UNSUBSCRIBE"||m==="acl"||m==="bind"||m==="checkout"||m==="connect"||m==="copy"||m==="delete"||m==="get"||m==="head"||m==="link"||m==="lock"||m==="m-search"||m==="merge"||m==="mkactivity"||m==="mkcalendar"||m==="mkcol"||m==="move"||m==="notify"||m==="options"||m==="patch"||m==="post"||m==="propfind"||m==="proppatch"||m==="purge"||m==="put"||m==="query"||m==="rebind"||m==="report"||m==="search"||m==="source"||m==="subscribe"||m==="trace"||m==="unbind"||m==="unlink"||m==="unlock"||m==="unsubscribe"))return Br.errors=[{instancePath:t+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:DNe.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var v=S===o}else var v=!0;if(v)if(e.validate!==void 0){let m=e.validate,S=o;if(typeof m!="boolean"){let k;if(k===void 0)if(m==="false"||m===0||m===null)k=!1;else if(m==="true"||m===1)k=!0;else return Br.errors=[{instancePath:t+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(m=k,e!==void 0&&(e.validate=k))}var v=S===o}else var v=!0}}}}}}}}}else return Br.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Br.errors=s,o===0}});var g3=T((aot,zm)=>{"use strict";var jNe=ie("node:assert"),p1=s3(),Rw=f3(),Iw="The dispatch function has already been invoked",h3=p3();function h1(e,t,r){return r===void 0?new jm(e,t):Pw(e,t,r)}function zNe(e,t){let r=e._lightMyRequest.payload;if(!r||r._readableState||typeof r.resume!="function")return t();let n=[];r.on("data",i=>n.push(Buffer.from(i))),r.on("end",()=>{let i=Buffer.concat(n);return e.headers["content-length"]=e.headers["content-length"]||""+i.length,delete e.headers["transfer-encoding"],e._lightMyRequest.payload=i,t()}),r.resume()}function m3(e,t,r,n){return r.once("error",function(i){this.destroyed&&n.destroy(i)}),r.once("close",function(){this.destroyed&&!this._error&&n.destroy()}),zNe(r,()=>e.call(t,r,n))}function Pw(e,t,r){if(t=typeof t=="string"?{url:t}:t,t.validate!==!1&&(jNe(typeof e=="function","dispatchFunc should be a function"),!h3(t)))throw new Error(h3.errors.map(o=>o.message));let n=t.server||{},i=t.Request?p1.CustomRequest:p1;if(e.request&&e.request.app===e&&(Object.setPrototypeOf(Object.getPrototypeOf(e.request),i.prototype),Object.setPrototypeOf(Object.getPrototypeOf(e.response),Rw.prototype)),typeof r=="function"){let s=new i(t),o=new Rw(s,r);return m3(e,n,s,o)}else return new Promise((s,o)=>{let a=new i(t),u=new Rw(a,s,o);m3(e,n,a,u)})}function jm(e,t){typeof t=="string"?this.option={url:t}:this.option=Object.assign({},t),this.dispatch=e,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1&&process.nextTick(()=>{this._hasInvoked||this.end()})}var MNe=["delete","get","head","options","patch","post","put","trace"];MNe.forEach(e=>{jm.prototype[e]=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);return this.option.url=t,this.option.method=e.toUpperCase(),this}});var LNe=["body","cookies","headers","payload","query"];LNe.forEach(e=>{jm.prototype[e]=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);return this.option[e]=t,this}});jm.prototype.end=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(Iw);if(this._hasInvoked=!0,typeof e=="function")Pw(this.dispatch,this.option,e);else return this._promise=Pw(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(e=>{e!=="constructor"&&(jm.prototype[e]=function(...t){if(!this._promise){if(this._hasInvoked===!0)throw new Error(Iw);this._hasInvoked=!0,this._promise=Pw(this.dispatch,this.option)}return this._promise[e](...t)})});function qNe(e){return e instanceof p1||e instanceof Rw||e?.constructor?.name==="_CustomLMRRequest"}zm.exports=h1;zm.exports.default=h1;zm.exports.inject=h1;zm.exports.isInjection=qNe});var C3=T((uot,Um)=>{"use strict";var FNe="5.7.4",UNe=pU(),Aw=ie("node:http"),ZNe=ie("node:diagnostics_channel"),Mm,{kAvvioBoot:Lm,kChildren:m1,kServerBindings:y3,kBodyLimit:VNe,kSupportedHTTPMethods:Il,kRoutePrefix:_3,kLogLevel:HNe,kLogSerializers:BNe,kHooks:g1,kSchemaController:nu,kRequestAcceptVersion:WNe,kReplySerializerDefault:v3,kContentTypeParser:JNe,kReply:GNe,kRequest:KNe,kFourOhFour:YNe,kState:Sr,kOptions:y1,kPluginNameChain:qm,kSchemaErrorFormatter:_1,kErrorHandler:Ow,kKeepAliveConnections:v1,kChildLoggerFactory:b1,kGenReqId:w1,kErrorHandlerAlreadySet:Cw}=Hr(),{createServer:XNe}=FU(),Fm=Dv(),Nw=Fv(),QNe=Uv(),Ol=xh(),Cl=pP(),b3=nC(),{Hooks:eAe,hookRunnerApplication:w3,supportedHooks:S1}=Da(),{createChildLogger:S3,defaultChildLoggerFactory:tAe,createLogger:rAe}=vh(),k3=RC(),{getGenReqId:x3,reqIdGenFactory:I3}=nw(),{buildRouting:nAe,validateBodyLimitOption:iAe,buildRouterOptions:sAe}=T5(),oAe=A5(),O3=j5(),aAe=H5(),{appendStackTrace:uAe,AVVIO_ERRORS_MAP:$3,...Nl}=tn(),lAe=DT(),{defaultInitOptions:hi}=O3,{FST_ERR_ASYNC_CONSTRAINT:cAe,FST_ERR_BAD_URL:dAe,FST_ERR_OPTIONS_NOT_OBJ:fAe,FST_ERR_QSP_NOT_FN:pAe,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:hAe,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:mAe,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:gAe,FST_ERR_INSTANCE_ALREADY_LISTENING:yAe,FST_ERR_REOPENED_CLOSE_SERVER:_Ae,FST_ERR_ROUTE_REWRITE_NOT_STR:vAe,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:E3,FST_ERR_ERROR_HANDLER_NOT_FN:bAe,FST_ERR_ERROR_HANDLER_ALREADY_SET:wAe,FST_ERR_ROUTE_METHOD_INVALID:SAe}=Nl,{buildErrorHandler:T3}=wh(),{FSTWRN004:kAe}=Hc(),R3=ZNe.channel("fastify.initialization");function k1(e){let{options:t,genReqId:r,disableRequestLogging:n,hasLogger:i,initialConfig:s}=xAe(e,P,C),o=nAe(t.routerOptions),a=oAe(t),u=q(o,t),{server:l,listen:c,forceCloseConnections:d,serverHasCloseAllConnections:p,serverHasCloseHttp2Sessions:f,keepAliveConnections:h}=XNe(t,u),v=Fm.setupResponseListeners,y=b3.buildSchemaController(null,t.schemaController),_={[Sr]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[v1]:h,[Il]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[y1]:t,[m1]:[],[y3]:[],[VNe]:t.bodyLimit,[_3]:"",[HNe]:"",[BNe]:null,[g1]:new eAe,[nu]:y,[_1]:null,[Ow]:T3(),[Cw]:!1,[b1]:t.childLoggerFactory||tAe,[v3]:null,[JNe]:new Cl(t.bodyLimit,t.onProtoPoisoning||hi.onProtoPoisoning,t.onConstructorPoisoning||hi.onConstructorPoisoning),[GNe]:Fm.buildReply(Fm),[KNe]:Nw.buildRequest(Nw,t.trustProxy),[YNe]:a,[k3.kRegisteredPlugins]:[],[qm]:["fastify"],[Lm]:null,[w1]:r,routing:u,delete:function(j,V,Y){return o.prepareRoute.call(this,{method:"DELETE",url:j,options:V,handler:Y})},get:function(j,V,Y){return o.prepareRoute.call(this,{method:"GET",url:j,options:V,handler:Y})},head:function(j,V,Y){return o.prepareRoute.call(this,{method:"HEAD",url:j,options:V,handler:Y})},trace:function(j,V,Y){return o.prepareRoute.call(this,{method:"TRACE",url:j,options:V,handler:Y})},patch:function(j,V,Y){return o.prepareRoute.call(this,{method:"PATCH",url:j,options:V,handler:Y})},post:function(j,V,Y){return o.prepareRoute.call(this,{method:"POST",url:j,options:V,handler:Y})},put:function(j,V,Y){return o.prepareRoute.call(this,{method:"PUT",url:j,options:V,handler:Y})},options:function(j,V,Y){return o.prepareRoute.call(this,{method:"OPTIONS",url:j,options:V,handler:Y})},all:function(j,V,Y){return o.prepareRoute.call(this,{method:this.supportedMethods,url:j,options:V,handler:Y})},route:function(j){return o.route.call(this,{options:j})},hasRoute:function(j){return o.hasRoute.call(this,{options:j})},findRoute:function(j){return o.findRoute(j)},log:t.logger,withTypeProvider:x,addHook:R,addSchema:E,getSchema:y.getSchema.bind(y),getSchemas:y.getSchemas.bind(y),setValidatorCompiler:A,setSerializerCompiler:H,setSchemaController:te,setReplySerializer:ne,setSchemaErrorFormatter:W,setGenReqId:I,addContentTypeParser:Cl.helpers.addContentTypeParser,hasContentTypeParser:Cl.helpers.hasContentTypeParser,getDefaultJsonParser:Cl.defaultParsers.getDefaultJsonParser,defaultTextParser:Cl.defaultParsers.defaultTextParser,removeContentTypeParser:Cl.helpers.removeContentTypeParser,removeAllContentTypeParsers:Cl.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(O){return this[k3.kRegisteredPlugins].includes(O)||this[qm].includes(O)},listen:c,server:l,addresses:function(){let O=this[y3].map(j=>j.address());return O.push(this.server.address()),O.filter(j=>j)},decorate:Ol.add,hasDecorator:Ol.exist,decorateReply:Ol.decorateReply,decorateRequest:Ol.decorateRequest,hasRequestDecorator:Ol.existRequest,hasReplyDecorator:Ol.existReply,getDecorator:Ol.getInstanceDecorator,addHttpMethod:D,inject:w,printRoutes:B,setNotFoundHandler:N,setErrorHandler:Z,setChildLoggerFactory:z,initialConfig:s,addConstraintStrategy:o.addConstraintStrategy.bind(o),hasConstraintStrategy:o.hasConstraintStrategy.bind(o)};Object.defineProperties(_,{listeningOrigin:{get(){let O=this.addresses().slice(-1).pop();if(typeof O=="string")return O;let j=O.family==="IPv6"?`[${O.address}]`:O.address;return`${this[y1].https?"https":"http"}://${j}:${O.port}`}},pluginName:{configurable:!0,get(){return this[qm].length>1?this[qm].join(" -> "):this[qm][0]}},prefix:{configurable:!0,get(){return this[_3]}},validatorCompiler:{configurable:!0,get(){return this[nu].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[nu].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[b1]}},version:{configurable:!0,get(){return FNe}},errorHandler:{configurable:!0,get(){return this[Ow].func}},genReqId:{configurable:!0,get(){return this[w1]}},supportedMethods:{configurable:!1,get(){return[...this[Il].bodyless,...this[Il].bodywith]}}}),t.schemaErrorFormatter&&(P3(t.schemaErrorFormatter),_[_1]=t.schemaErrorFormatter.bind(_));let b=Number(t.pluginTimeout),g=UNe(_,{autostart:!1,timeout:isNaN(b)===!1?b:hi.pluginTimeout,expose:{use:"register"}});g.override=aAe,g.on("start",()=>_[Sr].started=!0),_[Lm]=_.ready,_.ready=k,_.printPlugins=g.prettyPrint.bind(g),g.once("preReady",()=>{_.onClose((O,j)=>{_[Sr].closing=!0,o.closeRoutes(),w3("preClose",_[Lm],_,function(){if(_[Sr].listening){if(d==="idle")O.server.closeIdleConnections();else if(p&&d)O.server.closeAllConnections();else if(d===!0)for(let V of _[v1])V.destroy(),_[v1].delete(V)}f&&O.server.closeHttp2Sessions(),!t.serverFactory||_[Sr].listening?O.server.close(function(V){V&&V.code!=="ERR_SERVER_NOT_RUNNING"?j(null):j()}):process.nextTick(j,null)})})});let m=new QNe({server:_,config:{}});return _.setNotFoundHandler(),a.arrange404(_),o.setup(t,{avvio:g,fourOhFour:a,hasLogger:i,setupResponseListeners:v,throwIfAlreadyStarted:S,keepAliveConnections:h}),l.on("clientError",t.clientErrorHandler.bind(_)),R3.hasSubscribers&&R3.publish({fastify:_}),"asyncDispose"in Symbol&&(_[Symbol.asyncDispose]=function(){return _.close()}),_;function S(O){if(_[Sr].started)throw new yAe(O)}function w(O,j){if(Mm===void 0&&(Mm=g3()),_[Sr].started){if(_[Sr].closing){let V=new _Ae;if(j){j(V);return}else return Promise.reject(V)}return Mm(u,O,j)}if(j)this.ready(V=>{V?j(V,null):Mm(u,O,j)});else return Mm((V,Y)=>{this.ready(function(me){if(me){Y.emit("error",me);return}u(V,Y)})},O)}function k(O){if(this[Sr].readyResolver!==null){if(O!=null){this[Sr].readyResolver.promise.then(()=>O(null,_),O);return}return this[Sr].readyResolver.promise}if(process.nextTick(j),this[Sr].readyResolver=lAe.withResolvers(),O)this[Sr].readyResolver.promise.then(()=>O(null,_),O);else return this[Sr].readyResolver.promise;function j(){_[Lm]((Y,me)=>{Y||_[Sr].started||_[Sr].ready||_[Sr].booting?V(Y):(_[Sr].booting=!0,w3("onReady",_[Lm],_,V)),me()})}function V(Y){if(Y=Y!=null&&$3[Y.code]!=null?uAe(Y,new $3[Y.code](Y.message)):Y,Y)return _[Sr].readyResolver.reject(Y);_[Sr].readyResolver.resolve(_),_[Sr].booting=!1,_[Sr].ready=!0,_[Sr].readyResolver=null}}function x(){return this}function R(O,j){if(S('Cannot call "addHook"!'),j==null)throw new Nl.FST_ERR_HOOK_INVALID_HANDLER(O,j);if(O==="onSend"||O==="preSerialization"||O==="onError"||O==="preParsing"){if(j.constructor.name==="AsyncFunction"&&j.length===4)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(O==="onReady"||O==="onListen"){if(j.constructor.name==="AsyncFunction"&&j.length!==0)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(O==="onRequestAbort"){if(j.constructor.name==="AsyncFunction"&&j.length!==1)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(j.constructor.name==="AsyncFunction"&&j.length===3)throw new Nl.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;return O==="onClose"?this.onClose(j.bind(this)):O==="onReady"||O==="onListen"||O==="onRoute"?this[g1].add(O,j):this.after((Y,me)=>{try{V.call(this,O,j),me(Y)}catch(Ce){me(Ce)}}),this;function V(Y,me){this[g1].add(Y,me),this[m1].forEach(Ce=>V.call(Ce,Y,me))}}function E(O){return S('Cannot call "addSchema"!'),this[nu].add(O),this[m1].forEach(j=>j.addSchema(O)),this}function P(O,j){O.headers["accept-version"]!==void 0&&(O.headers[WNe]=O.headers["accept-version"],O.headers["accept-version"]=void 0),a.router.lookup(O,j)}function C(O,j,V){if(t.frameworkErrors){let me=x3(m.server,j),Ce=S3(m,t.logger,j,me),F=new Nw(me,null,j,null,Ce,m),M=new Fm(V,F,Ce);return(typeof n=="function"?n(j):n)===!1&&Ce.info({req:F},"incoming request"),t.frameworkErrors(new dAe(O),F,M)}let Y=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${O}' is not a valid url component`,statusCode:400});V.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(Y)}),V.end(Y)}function $(O,j,V){if(O!==!1)return function(me){if(me){if(t.frameworkErrors){let F=x3(m.server,j),M=S3(m,t.logger,j,F),X=new Nw(F,null,j,null,M,m),ee=new Fm(V,X,M);return(typeof n=="function"?n(j):n)===!1&&M.info({req:X},"incoming request"),t.frameworkErrors(new cAe,X,ee)}let Ce='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';V.writeHead(500,{"Content-Type":"application/json","Content-Length":Ce.length}),V.end(Ce)}}}function N(O,j){return S('Cannot call "setNotFoundHandler"!'),a.setNotFoundHandler.call(this,O,j,g,o.routeHandler),this}function A(O){return S('Cannot call "setValidatorCompiler"!'),this[nu].setValidatorCompiler(O),this}function W(O){return S('Cannot call "setSchemaErrorFormatter"!'),P3(O),this[_1]=O.bind(this),this}function H(O){return S('Cannot call "setSerializerCompiler"!'),this[nu].setSerializerCompiler(O),this}function te(O){S('Cannot call "setSchemaController"!');let j=this[nu],V=b3.buildSchemaController(j,Object.assign({},j.opts,O));return this[nu]=V,this.getSchema=V.getSchema.bind(V),this.getSchemas=V.getSchemas.bind(V),this}function ne(O){return S('Cannot call "setReplySerializer"!'),this[v3]=O,this}function Z(O){if(S('Cannot call "setErrorHandler"!'),typeof O!="function")throw new bAe;if(!t.allowErrorHandlerOverride&&this[Cw])throw new wAe;return this[Cw]&&kAe("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride"),this[Cw]=!0,this[Ow]=T3(this[Ow],O.bind(this)),this}function z(O){return S('Cannot call "setChildLoggerFactory"!'),this[b1]=O,this}function B(O={}){return O.includeMeta=O.includeHooks?O.includeMeta?S1.concat(O.includeMeta):S1:O.includeMeta,o.printRoutes(O)}function q(O,{rewriteUrl:j,logger:V}){let Y;return function(Ce,F){if(Y===void 0&&(Y=O.isAsyncConstraint()),j){Ce.originalUrl=Ce.url;let M=j.call(_,Ce);if(typeof M=="string")Ce.url=M;else{let X=new vAe(Ce.url,typeof M);Ce.destroy(X)}}O.routing(Ce,F,$(Y,Ce,F))}}function I(O){return S('Cannot call "setGenReqId"!'),this[w1]=I3(this[y1].requestIdHeader,O),this}function D(O,{hasBody:j=!1}={}){if(typeof O!="string"||Aw.METHODS.indexOf(O)===-1)throw new SAe;j===!0?(this[Il].bodywith.add(O),this[Il].bodyless.delete(O)):(this[Il].bodywith.delete(O),this[Il].bodyless.add(O));let V=O.toLowerCase();return this.hasDecorator(V)||this.decorate(V,function(Y,me,Ce){return o.prepareRoute.call(this,{method:O,url:Y,options:me,handler:Ce})}),this}}function xAe(e,t,r){if(e&&typeof e!="object")throw new fAe;if(e=Object.assign({},e),e.querystringParser&&typeof e.querystringParser!="function"||e.routerOptions?.querystringParser&&typeof e.routerOptions.querystringParser!="function")throw new pAe(typeof(e.querystringParser??e.routerOptions.querystringParser));if(e.schemaController&&e.schemaController.bucket&&typeof e.schemaController.bucket!="function")throw new hAe(typeof e.schemaController.bucket);iAe(e.bodyLimit);let n=typeof e.requestIdHeader=="string"&&e.requestIdHeader.length!==0?e.requestIdHeader.toLowerCase():e.requestIdHeader===!0&&"request-id",i=I3(n,e.genReqId),s=e.requestIdLogLabel||"reqId";e.bodyLimit=e.bodyLimit||hi.bodyLimit;let o=e.disableRequestLogging||!1,a=Object.assign({customOptions:{},plugins:[]},e.ajv);if(!a.customOptions||Object.prototype.toString.call(a.customOptions)!=="[object Object]")throw new mAe(typeof a.customOptions);if(!a.plugins||!Array.isArray(a.plugins))throw new gAe(typeof a.plugins);let{logger:u,hasLogger:l}=rAe(e);e.connectionTimeout=e.connectionTimeout||hi.connectionTimeout,e.keepAliveTimeout=e.keepAliveTimeout||hi.keepAliveTimeout,e.maxRequestsPerSocket=e.maxRequestsPerSocket||hi.maxRequestsPerSocket,e.requestTimeout=e.requestTimeout||hi.requestTimeout,e.logger=u,e.requestIdHeader=n,e.requestIdLogLabel=s,e.disableRequestLogging=o,e.ajv=a,e.clientErrorHandler=e.clientErrorHandler||EAe,e.allowErrorHandlerOverride=e.allowErrorHandlerOverride??hi.allowErrorHandlerOverride;let c=O3(e);return e.exposeHeadRoutes=c.exposeHeadRoutes,e.http2SessionTimeout=c.http2SessionTimeout,e.routerOptions=sAe(e,{defaultRoute:t,onBadUrl:r,ignoreTrailingSlash:hi.ignoreTrailingSlash,ignoreDuplicateSlashes:hi.ignoreDuplicateSlashes,maxParamLength:hi.maxParamLength,allowUnsafeRegex:hi.allowUnsafeRegex,buildPrettyMeta:$Ae,useSemicolonDelimiter:hi.useSemicolonDelimiter}),{options:e,genReqId:i,disableRequestLogging:o,hasLogger:l,initialConfig:c}}function $Ae(e){let t={};return["errorHandler","logLevel","logSerializers"].concat(S1).forEach(n=>{t[n]=e.store[n]}),Object.assign({},t)}function EAe(e,t){if(e.code==="ECONNRESET"||t.destroyed)return;let r,n,i,s;e.code==="ERR_HTTP_REQUEST_TIMEOUT"?(n="408",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Timeout","statusCode":408}`,s="timeout"):e.code==="HPE_HEADER_OVERFLOW"?(n="431",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,s="header_overflow"):(n="400",i=Aw.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Error","statusCode":400}`,s="error"),this.log.trace({err:e},`client ${s}`),t.writable&&t.write(`HTTP/1.1 ${n} ${i}\r
350
350
  Content-Length: ${r.length}\r
351
351
  Content-Type: application/json\r
352
352
  \r
@@ -424,7 +424,7 @@ return `+str.trim()+`;
424
424
  `;await yA.appendFile(r,n,"utf8")}async function wg(e,t,r){let n=_A(e,t),i=[];try{let s=NUe(n,{encoding:"utf8"}),o=CUe.createInterface({input:s,crlfDelay:1/0});for await(let a of o)if(a.trim())try{let u=JSON.parse(a);u?.id&&u?.session_key&&(!r||new Date(u.drain_started_at)>=r)&&i.push(u)}catch{}}catch(s){if(s.code!=="ENOENT")throw s}return i}function Z0(e){let t={total_drains:0,total_tool_calls:0,total_tool_errors:0,total_output_chars:0,total_drain_duration_ms:0,total_sdk_duration_ms:0,total_cost_usd:0,total_input_tokens:0,total_output_tokens:0,total_cache_creation_tokens:0,total_cache_read_tokens:0,last_drain_at:void 0};for(let r of e)t.total_drains+=1,t.total_tool_calls+=r.tool_calls,t.total_tool_errors+=r.tool_errors,t.total_output_chars+=r.output_chars,t.total_drain_duration_ms+=r.drain_duration_ms,t.total_sdk_duration_ms+=r.sdk_duration_ms,r.usage&&(t.total_cost_usd+=r.usage.total_cost_usd??0,t.total_input_tokens+=r.usage.input_tokens??0,t.total_output_tokens+=r.usage.output_tokens??0,t.total_cache_creation_tokens+=r.usage.cache_creation_input_tokens??0,t.total_cache_read_tokens+=r.usage.cache_read_input_tokens??0),(!t.last_drain_at||r.drain_started_at>t.last_drain_at)&&(t.last_drain_at=r.drain_started_at);return t}async function vA(e,t){await Me(e.usageDir);let r;try{r=await yA.readdir(e.usageDir)}catch{return{}}let n={};for(let i of r){if(!i.endsWith(".jsonl"))continue;let s=i.slice(0,-6),o=await wg(e,s,t).catch(()=>[]);o.length>0&&(n[s]=Z0(o))}return n}async function DUe(e,t){await Me(e.usageDir);let r;try{r=await yA.readdir(e.usageDir)}catch{return[]}let n=[];for(let i of r){if(!i.endsWith(".jsonl"))continue;let s=i.slice(0,-6),o=await wg(e,s).catch(()=>[]);n.push(...o)}return n.sort((i,s)=>new Date(s.drain_started_at).getTime()-new Date(i.drain_started_at).getTime()),n.slice(0,t)}var gf=L(()=>{"use strict";_n()});import t4e from"node:path";import{promises as r4e}from"node:fs";function n4e(e){return/^[A-Za-z0-9_-]{1,128}$/.test(e)}function i4e(e){return e.replace(/<!--[\s\S]*?-->/g,"").trim()||void 0}async function kA(e,t){if(!n4e(t))return kt(`[channel-config] invalid channel kind "${t}"`),null;let r=t4e.join(e,`${t}.md`),n;try{n=await r4e.readFile(r,"utf8")}catch(u){return u.code==="ENOENT"||kt(`[channel-config] failed to read ${r}: ${String(u)}`),null}let i,s;try{let u=(0,OQ.default)(n);i=u.data??{},s=u.content}catch(u){return kt(`[channel-config] failed to parse ${r}: ${String(u)}`),null}let o=M0(i),a=i4e(s);return{channel_kind:t,...o,channel_prompt:a}}var OQ,CQ=L(()=>{"use strict";OQ=ro(cf(),1);fr();aA()});function s4e(e){return e.filter(Boolean).join(`
425
425
 
426
426
  `).trim()||void 0}function NQ(e){let{channelKind:t,channelId:r,kindDescriptor:n,instanceDescriptor:i}=e,s=n?.channel_prompt?.trim()||void 0,o=i?.channel_prompt?.trim()||void 0;return{channel_kind:i?.channel_kind??n?.channel_kind??t,channel_id:i?.channel_id??r,display_name:i?.display_name,new_session_workspace:i?.new_session_workspace??n?.new_session_workspace,prompt_mode:i?.prompt_mode??n?.prompt_mode??"append",allowedTools:i?.allowedTools??n?.allowedTools,disallowedTools:i?.disallowedTools??n?.disallowedTools,additionalDirectories:i?.additionalDirectories??n?.additionalDirectories,kind_prompt:s,instance_prompt:o,merged_prompt:s4e([s,o])}}async function xA(e,t){if(!t.channel_kind)return null;let r=t.channel_id&&t.channel_id.trim().length>0?await cA(e,t.channel_id):null;r&&r.channel_kind!==t.channel_kind&&(kt(`[channel-config] ignoring descriptor for ingress channel_id="${t.channel_id}" because descriptor kind "${r.channel_kind}" != ingress kind "${t.channel_kind}"`),r=null);let n=await kA(e.channelConfigDir,t.channel_kind);return NQ({channelKind:t.channel_kind,channelId:t.channel_id,kindDescriptor:n,instanceDescriptor:r})}function o4e(e,t){if(t?.channel_kind)return t.channel_kind;let r=e.source.kind;return!r||r==="rpc"||r==="ws"?null:r}function a4e(e,t){return t?.channel_id??e.source.channel_id}async function $A(e,t){let r=await rQ(e,t),n=o4e(t,r);if(!n)return null;let i=await kA(e.channelConfigDir,n);return NQ({channelKind:n,channelId:a4e(t,r),kindDescriptor:i,instanceDescriptor:r})}var EA=L(()=>{"use strict";fr();CQ();bg()});function tS(e){return typeof e!="string"?!1:MQ(e)!==null}function MQ(e){let t=m4e(e);return t?{kind:"session",sessionKey:t,raw:e}:null}function To(e){return e?(Array.isArray(e)?e:[e]).filter(r=>typeof r=="string"&&r.trim().length>0):[]}function _f(e){let t=MQ(e);return t?t.sessionKey:null}function p4e(e){let t=e.indexOf(":");if(t<=0||t===e.length-1)return e;let r=e.slice(0,t),n=e.slice(t+1);return`${h4e(r)}:${n}`}function h4e(e){return f4e[e]??e}function m4e(e){let t=e.trim();if(!t||/\s/.test(t)||t.startsWith("session:")||t.startsWith("channel:"))return null;let r=t.indexOf(":");return r<=0||r===t.length-1?null:p4e(t)}var f4e,xg=L(()=>{"use strict";f4e={feishu:"lark"}});import g4e from"node:crypto";function LQ(e){return e.toLowerCase().trim().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+/,"").replace(/-+$/,"")||"session"}function y4e(e){return g4e.createHash("sha256").update(e).digest("hex").slice(0,7)}function _4e(e){let t=LQ(e.scope),r=LQ(e.readableName),n=y4e(e.identityTuple);return`${t}:${r}.${n}`}function vf(e){let t=["job",e.jobId.trim(),e.ownerSession?.trim()??"",e.cron?.trim()??"",e.cwdRel?.trim()??""].join("|");return _4e({scope:"job",readableName:e.jobId,identityTuple:t})}var rS=L(()=>{"use strict"});import{promises as vu}from"node:fs";import bf from"node:path";function v4e(e){let t=(0,qQ.default)(e);return{data:t.data??{},content:t.content}}function b4e(e,t){let r=["---"];if(r.push(`type: "${e.type}"`),r.push(`cron: "${e.cron}"`),e.notify){let n=To(e.notify);if(n.length===1)r.push(`notify: "${n[0]}"`);else if(n.length>1){r.push("notify:");for(let i of n)r.push(` - "${i}"`)}}return r.push(`created_at: "${e.created_at}"`),e.owner_session&&r.push(`owner_session: "${e.owner_session}"`),e.cwd_rel&&r.push(`cwd_rel: "${e.cwd_rel}"`),r.push("---"),r.push(""),r.push(t),r.join(`
427
- `)}var qQ,cs,wf=L(()=>{"use strict";qQ=ro(cf(),1);_n();Yr();fr();xg();UN();rS();$o();cs=class{constructor(t){this.paths=t}get activeDir(){return bf.join(this.paths.varDir,"jobs","active")}get archiveDir(){return bf.join(this.paths.varDir,"jobs","archive")}getJobPath(t){return bf.join(this.activeDir,`${t}.md`)}getStatePath(t){return bf.join(this.activeDir,`${t}.state.json`)}getArchiveJobPath(t){return bf.join(this.archiveDir,`${t}.md`)}getArchiveStatePath(t){return bf.join(this.archiveDir,`${t}.state.json`)}async init(){await Me(this.activeDir),await Me(this.archiveDir)}async createJob(t,r,n){if(await this.init(),await this.exists(t))throw new Error(`Job ${t} already exists`);if(!r.cron||!r.cron.trim())throw new Error(`Job ${t} has invalid cron schedule`);let i=this.resolveNotifyTargets(r.notify,r.owner_session),s=await PY(this.paths,t,r.cwd_rel),o={type:"job",created_at:new Date().toISOString(),...r,notify:i.length===0?void 0:i.length===1?i[0]:i,cwd_rel:s.cwdRel??void 0},a=this.buildSessionKey(t,o),u=b4e(o,n);await Bt(this.getJobPath(t),u);let l={last_run_at:null,last_result:"unknown",run_count:0};await Xt(this.getStatePath(t),l),await df(this.paths,{session_key:a,display_name:t,kind:"job",owner_session:o.owner_session}),ot(`[JobManager] Created job ${t}`,{cron:r.cron})}async archiveJob(t){if(!await this.exists(t))throw new Error(`Job ${t} not found`);let r=this.getJobPath(t),n=this.getStatePath(t),i=this.getArchiveJobPath(t),s=this.getArchiveStatePath(t);await vu.rename(r,i);try{await vu.rename(n,s)}catch{}ot(`[JobManager] Archived job ${t}`)}async getJob(t){return this.readJobByPath(t,this.getJobPath(t),this.getStatePath(t))}async getArchivedJob(t){return this.readJobByPath(t,this.getArchiveJobPath(t),this.getArchiveStatePath(t))}async readJobByPath(t,r,n){try{let i=await vu.readFile(r,"utf8"),{data:s,content:o}=v4e(i);if(!s.type||s.type!=="job")return qt(`[JobManager] Invalid job file ${t}: missing type=job`),null;let a=this.resolveNotifyTargets(s.notify,s.owner_session),u;try{let d=await vu.readFile(n,"utf8");u=JSON.parse(d)}catch{u={last_run_at:null,last_result:"unknown",run_count:0}}let l=RY(this.paths,t,s.cwd_rel),c={...s,notify:a.length===0?void 0:a.length===1?a[0]:a};return{id:t,path:r,frontmatter:c,content:o,state:u,session_key:this.buildSessionKey(t,c),execution_context:l.context,execution_cwd:l.cwd,runtime_workspace_dir:l.runtimeWorkspaceDir}}catch(i){if(i.code==="ENOENT")return null;throw i}}async listJobs(){await this.init();try{let r=(await vu.readdir(this.activeDir)).filter(i=>i.endsWith(".md")).map(i=>i.slice(0,-3)),n=[];for(let i of r){let s=await this.getJob(i);s&&n.push(s)}return n}catch(t){return qt("[JobManager] Failed to list jobs",t),[]}}async updateState(t,r){let n=await this.resolveStatePath(t),i={last_run_at:null,last_result:"unknown",run_count:0};try{let o=await vu.readFile(n,"utf8");i=JSON.parse(o)}catch{}let s={...i,...r};await Xt(n,s)}async resolveStatePath(t){let r=this.getStatePath(t),n=this.getArchiveStatePath(t),i=this.getJobPath(t),s=this.getArchiveJobPath(t);if(await this.pathExists(r))return r;if(await this.pathExists(n))return n;if(await this.pathExists(i))return r;if(await this.pathExists(s))return n;throw new Error(`Job ${t} not found`)}async pathExists(t){try{return await vu.access(t),!0}catch{return!1}}async exists(t){try{return await vu.access(this.getJobPath(t)),!0}catch{return!1}}buildSessionKey(t,r){return vf({jobId:t,ownerSession:r.owner_session,cron:r.cron,cwdRel:r.cwd_rel})}resolveNotifyTargets(t,r){let n=To(t);if(n.length>0){let i=[];for(let s of n){if(!tS(s))throw new Error(`Invalid notify target: ${s}`);let o=_f(s);if(!o)throw new Error(`Invalid notify target: ${s}`);i.push(o)}return i}return!r||!r.trim()?[]:[r.trim()]}}});function FQ(e){if(!e)return;let t=e.trim();return t.length>0?t:void 0}function Sf(e=process.env){let t=FQ(e.ALADUO_RUNTIME_MODE)?.toLowerCase();if(t==="container")return"container";if(t==="host")return"host";let r=FQ(e.ALADUO_CONTAINER)?.toLowerCase();return r==="1"||r==="true"||r==="yes"?"container":"host"}var nS=L(()=>{"use strict"});var HQ={};Kr(HQ,{resolveRuntimePaths:()=>$4e});import x4e from"node:os";import Et from"node:path";function $4e(e={},t=process.env){let r=e.homeDir??t.ALADUO_HOME??x4e.homedir(),n=e.runtimeDir??t.ALADUO_RUNTIME_DIR??Et.join(r,".aladuo"),i=e.kernelDir??t.ALADUO_KERNEL_DIR??Et.join(r,"aladuo"),s=e.workDir??t.ALADUO_WORK_DIR??process.cwd(),o=e.bootstrapDir??t.ALADUO_BOOTSTRAP_DIR??Et.join(process.cwd(),"bootstrap"),a=e.managedSettingsPath??"/etc/claude-code/settings.json",u=Et.join(i,"config"),l=Et.join(n,"var"),c=Et.join(n,"run"),d=Et.join(l,"events"),p=Et.join(d,"index"),f=Et.join(l,"registry"),h=Et.join(l,"outbox"),v=Et.join(l,"sessions"),y=Et.join(l,"jobs"),_=Et.join(l,"channels"),b=Et.join(l,"ingress"),g=Et.join(l,"usage"),m=Et.join(i,"memory"),S=Et.join(m,"entities"),w=Et.join(m,"topics"),k=Et.join(m,"fragments"),x=Et.join(m,"state"),R=Et.join(m,"index.md"),E=Et.join(m,"CLAUDE.md"),P=Et.join(x,"meta-memory-state.json"),C=Et.join(l,"cadence"),$=Et.join(C,"inbox"),N=Et.join(C,"queue.md"),A=Et.join(i,"subconscious"),W=Et.join(A,"inbox"),H=Et.join(A,"playlist.md"),re=Et.join(c,"locks"),ne=Et.join(c,"queue_offsets"),Z=Et.join(c,"spine.sock"),z=Et.join(o,"meta-prompt.md"),B=Et.join(r,".claude","CLAUDE.md");return{homeDir:r,runtimeDir:n,kernelDir:i,workDir:s,bootstrapDir:o,channelConfigDir:u,varDir:l,runDir:c,eventsDir:d,eventsIndexDir:p,registryDir:f,outboxDir:h,sessionsDir:v,jobsDir:y,channelsDir:_,varIngressDir:b,usageDir:g,memoryDir:m,memoryEntitiesDir:S,memoryTopicsDir:w,memoryFragmentsDir:k,memoryStateDir:x,memoryIndexPath:R,memoryBroadcastPath:E,memoryMetaStatePath:P,cadenceDir:C,cadenceInboxDir:$,cadenceQueuePath:N,subconsciousDir:A,subconsciousInboxDir:W,subconsciousPlaylistPath:H,runLocksDir:re,runQueueOffsetsDir:ne,spineSocketPath:Z,metaPromptSrcPath:z,metaPromptDstPath:B,managedSettingsPath:a}}var BQ=L(()=>{"use strict"});import{promises as E4e}from"node:fs";async function Ro(e){try{return await E4e.access(e),!0}catch{return!1}}var WQ=L(()=>{"use strict"});import{execFile as T4e}from"node:child_process";import{promises as $g}from"node:fs";import JQ from"node:path";import{promisify as R4e}from"node:util";async function DA(e,t,r){try{return await jA("git",t,{cwd:e,env:I4e()})}catch(n){if(r?.ignoreError){let i=n;return{stdout:i.stdout??"",stderr:i.stderr??""}}throw n}}function I4e(){return{...process.env,GIT_AUTHOR_NAME:"aladuo",GIT_AUTHOR_EMAIL:"aladuo@local",GIT_COMMITTER_NAME:"aladuo",GIT_COMMITTER_EMAIL:"aladuo@local"}}async function O4e(e){try{let{stdout:t}=await jA("git",["rev-parse","--show-toplevel"],{cwd:e}),r=await $g.realpath(t.trim()),n=await $g.realpath(e);return r===n}catch{return!1}}async function KQ(e){if(await jA("git",["config","--global","--add","safe.directory",e]).catch(()=>{}),!await O4e(e)){ot("[memory-git] initializing git repo",{kernelDir:e}),await DA(e,["init"]),await $g.writeFile(JQ.join(e,".gitignore"),GQ,"utf8"),await DA(e,["add","."]),await DA(e,["commit","-m","memory: genesis"]),ot("[memory-git] genesis commit created");return}await C4e(e),yt("[memory-git] existing repo detected, .gitignore synced")}async function C4e(e){let t=JQ.join(e,".gitignore"),r="";try{r=await $g.readFile(t,"utf8")}catch{}let n=new Set(r.split(`
427
+ `)}var qQ,cs,wf=L(()=>{"use strict";qQ=ro(cf(),1);_n();Yr();fr();xg();UN();rS();$o();cs=class{constructor(t){this.paths=t}get activeDir(){return bf.join(this.paths.varDir,"jobs","active")}get archiveDir(){return bf.join(this.paths.varDir,"jobs","archive")}getJobPath(t){return bf.join(this.activeDir,`${t}.md`)}getStatePath(t){return bf.join(this.activeDir,`${t}.state.json`)}getArchiveJobPath(t){return bf.join(this.archiveDir,`${t}.md`)}getArchiveStatePath(t){return bf.join(this.archiveDir,`${t}.state.json`)}async init(){await Me(this.activeDir),await Me(this.archiveDir)}async createJob(t,r,n){if(await this.init(),await this.exists(t))throw new Error(`Job ${t} already exists`);if(!r.cron||!r.cron.trim())throw new Error(`Job ${t} has invalid cron schedule`);let i=this.resolveNotifyTargets(r.notify,r.owner_session),s=await PY(this.paths,t,r.cwd_rel),o={type:"job",created_at:new Date().toISOString(),...r,notify:i.length===0?void 0:i.length===1?i[0]:i,cwd_rel:s.cwdRel??void 0},a=this.buildSessionKey(t,o),u=b4e(o,n);await Bt(this.getJobPath(t),u);let l={last_run_at:null,last_result:"unknown",run_count:0};await Xt(this.getStatePath(t),l),await df(this.paths,{session_key:a,display_name:t,kind:"job",owner_session:o.owner_session}),ot(`[JobManager] Created job ${t}`,{cron:r.cron})}async archiveJob(t){if(!await this.exists(t))throw new Error(`Job ${t} not found`);let r=this.getJobPath(t),n=this.getStatePath(t),i=this.getArchiveJobPath(t),s=this.getArchiveStatePath(t);await vu.rename(r,i);try{await vu.rename(n,s)}catch{}ot(`[JobManager] Archived job ${t}`)}async getJob(t){return this.readJobByPath(t,this.getJobPath(t),this.getStatePath(t))}async getArchivedJob(t){return this.readJobByPath(t,this.getArchiveJobPath(t),this.getArchiveStatePath(t))}async readJobByPath(t,r,n){try{let i=await vu.readFile(r,"utf8"),{data:s,content:o}=v4e(i);if(!s.type||s.type!=="job")return qt(`[JobManager] Invalid job file ${t}: missing type=job`),null;let a=this.resolveNotifyTargets(s.notify,s.owner_session),u;try{let d=await vu.readFile(n,"utf8");u=JSON.parse(d)}catch{u={last_run_at:null,last_result:"unknown",run_count:0}}let l=RY(this.paths,t,s.cwd_rel),c={...s,notify:a.length===0?void 0:a.length===1?a[0]:a};return{id:t,path:r,frontmatter:c,content:o,state:u,session_key:this.buildSessionKey(t,c),execution_context:l.context,execution_cwd:l.cwd,runtime_workspace_dir:l.runtimeWorkspaceDir}}catch(i){if(i.code==="ENOENT")return null;throw i}}async listJobs(){await this.init();try{let r=(await vu.readdir(this.activeDir)).filter(i=>i.endsWith(".md")).map(i=>i.slice(0,-3)),n=[];for(let i of r){let s=await this.getJob(i);s&&n.push(s)}return n}catch(t){return qt("[JobManager] Failed to list jobs",t),[]}}async updateState(t,r){let n=await this.resolveStatePath(t),i={last_run_at:null,last_result:"unknown",run_count:0};try{let o=await vu.readFile(n,"utf8");i=JSON.parse(o)}catch{}let s={...i,...r};await Xt(n,s)}async resolveStatePath(t){let r=this.getStatePath(t),n=this.getArchiveStatePath(t),i=this.getJobPath(t),s=this.getArchiveJobPath(t);if(await this.pathExists(r))return r;if(await this.pathExists(n))return n;if(await this.pathExists(i))return r;if(await this.pathExists(s))return n;throw new Error(`Job ${t} not found`)}async pathExists(t){try{return await vu.access(t),!0}catch{return!1}}async exists(t){try{return await vu.access(this.getJobPath(t)),!0}catch{return!1}}buildSessionKey(t,r){return vf({jobId:t,ownerSession:r.owner_session,cron:r.cron,cwdRel:r.cwd_rel})}resolveNotifyTargets(t,r){let n=To(t);if(n.length>0){let i=[];for(let s of n){if(!tS(s))throw new Error(`Invalid notify target: ${s}`);let o=_f(s);if(!o)throw new Error(`Invalid notify target: ${s}`);i.push(o)}return i}return!r||!r.trim()?[]:[r.trim()]}}});function FQ(e){if(!e)return;let t=e.trim();return t.length>0?t:void 0}function Sf(e=process.env){let t=FQ(e.ALADUO_RUNTIME_MODE)?.toLowerCase();if(t==="container")return"container";if(t==="host")return"host";let r=FQ(e.ALADUO_CONTAINER)?.toLowerCase();return r==="1"||r==="true"||r==="yes"?"container":"host"}var nS=L(()=>{"use strict"});var HQ={};Kr(HQ,{resolveRuntimePaths:()=>$4e});import x4e from"node:os";import Et from"node:path";function $4e(e={},t=process.env){let r=e.homeDir??t.ALADUO_HOME??x4e.homedir(),n=e.runtimeDir??t.ALADUO_RUNTIME_DIR??Et.join(r,".aladuo"),i=e.kernelDir??t.ALADUO_KERNEL_DIR??Et.join(r,"aladuo"),s=e.workDir??t.ALADUO_WORK_DIR??process.cwd(),o=e.bootstrapDir??t.ALADUO_BOOTSTRAP_DIR??Et.join(process.cwd(),"bootstrap"),a=e.managedSettingsPath??"/etc/claude-code/settings.json",u=Et.join(i,"config"),l=Et.join(n,"var"),c=Et.join(n,"run"),d=Et.join(l,"events"),p=Et.join(d,"index"),f=Et.join(l,"registry"),h=Et.join(l,"outbox"),v=Et.join(l,"sessions"),y=Et.join(l,"jobs"),_=Et.join(l,"channels"),b=Et.join(l,"ingress"),g=Et.join(l,"usage"),m=Et.join(i,"memory"),S=Et.join(m,"entities"),w=Et.join(m,"topics"),k=Et.join(m,"fragments"),x=Et.join(m,"state"),R=Et.join(m,"index.md"),E=Et.join(m,"CLAUDE.md"),P=Et.join(x,"meta-memory-state.json"),C=Et.join(l,"cadence"),$=Et.join(C,"inbox"),N=Et.join(C,"queue.md"),A=Et.join(i,"subconscious"),W=Et.join(A,"inbox"),H=Et.join(A,"playlist.md"),te=Et.join(c,"locks"),ne=Et.join(c,"queue_offsets"),Z=Et.join(c,"spine.sock"),z=Et.join(o,"meta-prompt.md"),B=Et.join(r,".claude","CLAUDE.md");return{homeDir:r,runtimeDir:n,kernelDir:i,workDir:s,bootstrapDir:o,channelConfigDir:u,varDir:l,runDir:c,eventsDir:d,eventsIndexDir:p,registryDir:f,outboxDir:h,sessionsDir:v,jobsDir:y,channelsDir:_,varIngressDir:b,usageDir:g,memoryDir:m,memoryEntitiesDir:S,memoryTopicsDir:w,memoryFragmentsDir:k,memoryStateDir:x,memoryIndexPath:R,memoryBroadcastPath:E,memoryMetaStatePath:P,cadenceDir:C,cadenceInboxDir:$,cadenceQueuePath:N,subconsciousDir:A,subconsciousInboxDir:W,subconsciousPlaylistPath:H,runLocksDir:te,runQueueOffsetsDir:ne,spineSocketPath:Z,metaPromptSrcPath:z,metaPromptDstPath:B,managedSettingsPath:a}}var BQ=L(()=>{"use strict"});import{promises as E4e}from"node:fs";async function Ro(e){try{return await E4e.access(e),!0}catch{return!1}}var WQ=L(()=>{"use strict"});import{execFile as T4e}from"node:child_process";import{promises as $g}from"node:fs";import JQ from"node:path";import{promisify as R4e}from"node:util";async function DA(e,t,r){try{return await jA("git",t,{cwd:e,env:I4e()})}catch(n){if(r?.ignoreError){let i=n;return{stdout:i.stdout??"",stderr:i.stderr??""}}throw n}}function I4e(){return{...process.env,GIT_AUTHOR_NAME:"aladuo",GIT_AUTHOR_EMAIL:"aladuo@local",GIT_COMMITTER_NAME:"aladuo",GIT_COMMITTER_EMAIL:"aladuo@local"}}async function O4e(e){try{let{stdout:t}=await jA("git",["rev-parse","--show-toplevel"],{cwd:e}),r=await $g.realpath(t.trim()),n=await $g.realpath(e);return r===n}catch{return!1}}async function KQ(e){if(await jA("git",["config","--global","--add","safe.directory",e]).catch(()=>{}),!await O4e(e)){ot("[memory-git] initializing git repo",{kernelDir:e}),await DA(e,["init"]),await $g.writeFile(JQ.join(e,".gitignore"),GQ,"utf8"),await DA(e,["add","."]),await DA(e,["commit","-m","memory: genesis"]),ot("[memory-git] genesis commit created");return}await C4e(e),yt("[memory-git] existing repo detected, .gitignore synced")}async function C4e(e){let t=JQ.join(e,".gitignore"),r="";try{r=await $g.readFile(t,"utf8")}catch{}let n=new Set(r.split(`
428
428
  `).map(o=>o.trim()).filter(o=>o.length>0)),i=P4e.filter(o=>!n.has(o));if(i.length===0)return;let s=(r.endsWith(`
429
429
  `)||r.length===0?"":`
430
430
  `)+i.join(`
@@ -458,15 +458,15 @@ CLAUDE.local.md
458
458
  `),kf=u6e(e,{recursive:!0}).then(()=>{}).catch(()=>{}),kf}function fa(e){if(Ef===null)return;let t=`${new Date().toISOString()} ${e}
459
459
  `;d6e().then(()=>{Ef&&a6e(Ef,t).catch(()=>{})})}function v6e(e){var t=y6e.call(e,Eg),r=e[Eg];try{e[Eg]=void 0;var n=!0}catch{}var i=_6e.call(e);return n&&(t?e[Eg]=r:delete e[Eg]),i}function k6e(e){return S6e.call(e)}function T6e(e){return e==null?e===void 0?E6e:$6e:oee&&oee in Object(e)?b6e(e):x6e(e)}function P6e(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function A6e(e){if(!Jee(e))return!1;var t=R6e(e);return t==O6e||t==C6e||t==I6e||t==N6e}function z6e(e){return!!aee&&aee in e}function F6e(e){if(e!=null){try{return q6e.call(e)}catch{}try{return e+""}catch{}}return""}function K6e(e){if(!Jee(e)||M6e(e))return!1;var t=D6e(e)?G6e:V6e;return t.test(U6e(e))}function X6e(e,t){return e?.[t]}function eZe(e,t){var r=Q6e(e,t);return Y6e(r)?r:void 0}function rZe(){this.__data__=Ig?Ig(null):{},this.size=0}function iZe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function lZe(e){var t=this.__data__;if(Ig){var r=t[e];return r===oZe?void 0:r}return uZe.call(t,e)?t[e]:void 0}function pZe(e){var t=this.__data__;return Ig?t[e]!==void 0:fZe.call(t,e)}function gZe(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ig&&t===void 0?mZe:t,this}function Uf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function _Ze(){this.__data__=[],this.size=0}function bZe(e,t){return e===t||e!==e&&t!==t}function SZe(e,t){for(var r=e.length;r--;)if(wZe(e[r][0],t))return r;return-1}function $Ze(e){var t=this.__data__,r=bS(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():xZe.call(t,r,1),--this.size,!0}function TZe(e){var t=this.__data__,r=bS(t,e);return r<0?void 0:t[r][1]}function PZe(e){return bS(this.__data__,e)>-1}function OZe(e,t){var r=this.__data__,n=bS(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Zf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function jZe(){this.size=0,this.__data__={hash:new uee,map:new(DZe||NZe),string:new uee}}function MZe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function qZe(e,t){var r=e.__data__;return LZe(t)?r[typeof t=="string"?"string":"hash"]:r.map}function FZe(e){var t=wS(this,e).delete(e);return this.size-=t?1:0,t}function ZZe(e){return wS(this,e).get(e)}function HZe(e){return wS(this,e).has(e)}function WZe(e,t){var r=wS(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Vf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hD(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(GZe);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(hD.Cache||Kee),r}function KZe(e,t){e.destroyed||e.write(t)}function YZe(e){KZe(process.stderr,e)}function QZe(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let s=e.match(/^([^:[]+):/);s&&s[1]&&t.push(s[1].trim().toLowerCase())}let n=e.match(/^\[([^\]]+)]/);n&&n[1]&&t.push(n[1].trim().toLowerCase()),e.toLowerCase().includes("1p event:")&&t.push("1p");let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let s=i[1].trim().toLowerCase();s.length<30&&!s.includes(" ")&&t.push(s)}return Array.from(new Set(t))}function eVe(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(r=>t.exclude.includes(r)):e.some(r=>t.include.includes(r)):!0}function tVe(e,t){if(!t)return!0;let r=QZe(e);return eVe(r,t)}function Pg(){return dVe}function hVe(){let e="";return typeof process<"u"&&typeof process.cwd=="function"&&typeof cee=="function"&&(e=cee(fVe()).normalize("NFC")),{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,turnHookDurationMs:0,turnToolDurationMs:0,turnClassifierDurationMs:0,turnToolCount:0,turnHookCount:0,turnClassifierCount:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,clientType:"cli",sessionSource:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,flagSettingsInline:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:pVe(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[],chromeFlagOverride:void 0,useCoworkPlugins:!1,sessionBypassPermissionsMode:!1,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,activatedSkillTriggers:new Set,slowOperations:[],promptCacheBreaks:[],sdkBetas:void 0,mainThreadAgentType:void 0,isRemoteMode:!1,isInWorktree:!1,directConnectServerUrl:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],resumedTranscriptPath:null,promptCache1hAllowlist:null,promptId:null}}function gVe(){return mVe.sessionId}function yVe({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:r=100,maxBufferBytes:n=1/0,immediateMode:i=!1}){let s=[],o=0,a=null;function u(){a&&(clearTimeout(a),a=null)}function l(){s.length!==0&&(e(s.join("")),s=[],o=0,u())}function c(){a||(a=setTimeout(l,t))}return{write(d){if(i){e(d);return}s.push(d),o+=d.length,c(),(s.length>=r||o>=n)&&l()},flush:l,dispose(){l()}}}function _Ve(e){return dee.add(e),()=>dee.delete(e)}function wVe(e){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=bVe();return tVe(e,t)}function kVe(){if(!iS){let e=null;iS=yVe({writeFn:t=>{let r=tte(),n=Yee(r);if(e!==n){try{Pg().mkdirSync(n)}catch{}e=n}Pg().appendFileSync(r,t),xVe()},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:vVe()}),_Ve(async()=>iS?.dispose())}return iS}function oc(e,{level:t}={level:"debug"}){if(!wVe(e))return;SVe&&e.includes(`
460
460
  `)&&(e=Po(e));let r=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}
461
- `;if(Qee()){YZe(r);return}kVe().write(r)}function tte(){return ete()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Xee(Bee(),"debug",`${gVe()}.txt`)}function EVe(){return $Ve}function Po(e,t,r){let n=[];try{let o=Nr(n,Dr`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}}function TVe(e,t){let r={...e};if(t){let n={sandbox:t};if(r.settings)try{n={...rte(r.settings),sandbox:t}}catch{}r.settings=Po(n)}return r}function RVe(e){return![".js",".mjs",".tsx",".ts",".jsx"].some(t=>e.endsWith(t))}function KA(){return NVe}function ve(e,t){let r=KA(),n=YA({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Og?void 0:Og].filter(i=>!!i)});e.common.issues.push(n)}function Xe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,o)=>{let{message:a}=e;return s.code==="invalid_enum_value"?{message:a??o.defaultError}:typeof o.data>"u"?{message:a??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:a??r??o.defaultError}},description:i}}function ite(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KVe(e){return new RegExp(`^${ite(e)}$`)}function YVe(e){let t=`${nte}T${ite(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function XVe(e,t){return!!((t==="v4"||!t)&&ZVe.test(e)||(t==="v6"||!t)&&HVe.test(e))}function QVe(e,t){if(!LVe.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function eHe(e,t){return!!((t==="v4"||!t)&&VVe.test(e)||(t==="v6"||!t)&&BVe.test(e))}function tHe(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}function xf(e){if(e instanceof Oi){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Fs.create(xf(n))}return new Oi({...e._def,shape:()=>t})}else return e instanceof ku?new ku({...e._def,type:xf(e.element)}):e instanceof Fs?Fs.create(xf(e.unwrap())):e instanceof ma?ma.create(xf(e.unwrap())):e instanceof ha?ha.create(e.items.map(t=>xf(t))):e}function QA(e,t){let r=bu(e),n=bu(t);if(e===t)return{valid:!0,data:e};if(r===$e.object&&n===$e.object){let i=It.objectKeys(t),s=It.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(let a of s){let u=QA(e[a],t[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(r===$e.array&&n===$e.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],u=QA(o,a);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===$e.date&&n===$e.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function ste(e,t){return new jf({values:e,typeName:Be.ZodEnum,...Xe(t)})}function Q(e,t,r){function n(a,u){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,u);for(let c in o.prototype)c in a||Object.defineProperty(a,c,{value:o.prototype[c].bind(a)});a._zod.constr=o,a._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function o(a){var u;let l=r?.Parent?new s:this;n(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function ga(e){return e&&Object.assign(rD,e),rD}function rHe(e){return e}function nHe(e){return e}function iHe(e){}function sHe(e){throw Error()}function oHe(e){}function ote(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function nD(e,t="|"){return e.map(r=>yD(r)).join(t)}function ate(e,t){return typeof t=="bigint"?t.toString():t}function SS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error("cached value already set")}}}function kS(e){return e==null}function xS(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ute(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}function pr(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mD(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function aHe(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function uHe(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=n[s];return i})}function lHe(e=10){let t="";for(let r=0;r<e;r++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return t}function $f(e){return JSON.stringify(e)}function Ug(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Zg(e){if(Ug(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(Ug(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cHe(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Bf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _a(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Ue(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function pHe(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,s){return t??(t=e()),Reflect.set(t,n,i,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function yD(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dte(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function mHe(e,t){let r={},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return _a(e,{...e._zod.def,shape:r,checks:[]})}function gHe(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return _a(e,{...e._zod.def,shape:r,checks:[]})}function yHe(e,t){if(!Zg(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return mD(this,"shape",n),n},checks:[]};return _a(e,r)}function _He(e,t){return _a(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return mD(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function vHe(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)i[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return _a(t,{...t._zod.def,shape:i,checks:[]})}function bHe(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return _a(t,{...t._zod.def,shape:i,checks:[]})}function Tf(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function wu(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Rg(e){return typeof e=="string"?e:e?.message}function ya(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Rg(e.inst?._zod.def?.error?.(e))??Rg(t?.error?.(e))??Rg(r.customError?.(e))??Rg(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,!t?.reportInput&&delete n.input,n}function wHe(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function $S(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pte(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function SHe(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function kHe(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function xHe(e,t){let r=t||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let a=n,u=0;for(;u<o.path.length;){let l=o.path[u];u!==o.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))),a=a[l],u++}}};return i(e),n}function jHe(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}function xte(e){return typeof e.precision=="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function HHe(e){return new RegExp(`^${xte(e)}$`)}function BHe(e){let t=xte({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${kte}T(?:${n})$`)}function Rte(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function N9e(e){if(!Ste.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rte(r)}function j9e(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}function yee(e,t,r){e.issues.length&&t.issues.push(...wu(r,e.issues)),t.value[r]=e.value}function sS(e,t,r){e.issues.length&&t.issues.push(...wu(r,e.issues)),t.value[r]=e.value}function _ee(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...wu(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function vee(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>ya(s,n,ga())))}),t}function oD(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Zg(e)&&Zg(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),i={...e,...t};for(let s of n){let o=oD(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],s=t[n],o=oD(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bee(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Tf(e))return e;let n=oD(t.value,r.value);if(!n.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}function wee(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function See(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function kee(e,t,r){return Tf(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}function xee(e){return e.value=Object.freeze(e.value),e}function $ee(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(pte(i))}}function aBe(){return{localeError:oBe()}}function uBe(){return new aD}function lBe(e,t){return new e({type:"string",...Ue(t)})}function cBe(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function Eee(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function dBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function fBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function pBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function hBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function mBe(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function gBe(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function yBe(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function _Be(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function vBe(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function bBe(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function wBe(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function SBe(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function kBe(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function xBe(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function $Be(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function EBe(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function TBe(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function RBe(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function PBe(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function IBe(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function OBe(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function CBe(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function NBe(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function ABe(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function DBe(e,t){return new e({type:"number",checks:[],...Ue(t)})}function jBe(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function zBe(e,t){return new e({type:"boolean",...Ue(t)})}function MBe(e,t){return new e({type:"null",...Ue(t)})}function LBe(e){return new e({type:"unknown"})}function qBe(e,t){return new e({type:"never",...Ue(t)})}function Tee(e,t){return new Ete({check:"less_than",...Ue(t),value:e,inclusive:!1})}function ZA(e,t){return new Ete({check:"less_than",...Ue(t),value:e,inclusive:!0})}function Ree(e,t){return new Tte({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function VA(e,t){return new Tte({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function Pee(e,t){return new e9e({check:"multiple_of",...Ue(t),value:e})}function Cte(e,t){return new r9e({check:"max_length",...Ue(t),maximum:e})}function hS(e,t){return new n9e({check:"min_length",...Ue(t),minimum:e})}function Nte(e,t){return new i9e({check:"length_equals",...Ue(t),length:e})}function FBe(e,t){return new s9e({check:"string_format",format:"regex",...Ue(t),pattern:e})}function UBe(e){return new o9e({check:"string_format",format:"lowercase",...Ue(e)})}function ZBe(e){return new a9e({check:"string_format",format:"uppercase",...Ue(e)})}function VBe(e,t){return new u9e({check:"string_format",format:"includes",...Ue(t),includes:e})}function HBe(e,t){return new l9e({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function BBe(e,t){return new c9e({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function Vg(e){return new d9e({check:"overwrite",tx:e})}function WBe(e){return Vg(t=>t.normalize(e))}function JBe(){return Vg(e=>e.trim())}function GBe(){return Vg(e=>e.toLowerCase())}function KBe(){return Vg(e=>e.toUpperCase())}function YBe(e,t,r){return new e({type:"array",element:t,...Ue(r)})}function XBe(e,t,r){let n=Ue(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function QBe(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ue(r)})}function jte(e){return OBe(Dte,e)}function Mte(e){return CBe(zte,e)}function qte(e){return NBe(Lte,e)}function Ute(e){return ABe(Fte,e)}function K(e){return lBe(sWe,e)}function Wt(e){return DBe(Hte,e)}function Oee(e){return jBe(kWe,e)}function bn(e){return zBe(xWe,e)}function Bte(e){return MBe($We,e)}function kr(){return LBe(EWe)}function RWe(e){return qBe(TWe,e)}function Tt(e,t){return YBe(PWe,e,t)}function Ee(e,t){let r={type:"object",get shape(){return sr.assignProp(this,"shape",{...e}),this.shape},...sr.normalizeParams(t)};return new Wte(r)}function vi(e,t){return new Wte({type:"object",get shape(){return sr.assignProp(this,"shape",{...e}),this.shape},catchall:kr(),...sr.normalizeParams(t)})}function hr(e,t){return new Jte({type:"union",options:e,...sr.normalizeParams(t)})}function Gte(e,t,r){return new IWe({type:"union",options:t,discriminator:e,...sr.normalizeParams(r)})}function vD(e,t){return new OWe({type:"intersection",left:e,right:t})}function xr(e,t,r){return new CWe({type:"record",keyType:e,valueType:t,...sr.normalizeParams(r)})}function Ci(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new uD({type:"enum",entries:r,...sr.normalizeParams(t)})}function je(e,t){return new NWe({type:"literal",values:Array.isArray(e)?e:[e],...sr.normalizeParams(t)})}function Kte(e){return new AWe({type:"transform",transform:e})}function jr(e){return new Yte({type:"optional",innerType:e})}function Cee(e){return new DWe({type:"nullable",innerType:e})}function zWe(e,t){return new jWe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function LWe(e,t){return new MWe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function qWe(e,t){return new Xte({type:"nonoptional",innerType:e,...sr.normalizeParams(t)})}function UWe(e,t){return new FWe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function lD(e,t){return new ZWe({type:"pipe",in:e,out:t})}function HWe(e){return new VWe({type:"readonly",innerType:e})}function BWe(e,t){let r=new wi({check:"custom",...sr.normalizeParams(t)});return r._zod.check=e,r}function WWe(e,t){return XBe(Qte,e??(()=>!0),t)}function JWe(e,t={}){return QBe(Qte,e,t)}function GWe(e,t){let r=BWe(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(sr.issue(i,n.value,r._zod.def));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(sr.issue(s))}},e(n.value,n)),t);return r}function ere(e,t){return lD(Kte(e),t)}function $re({prompt:e,options:t}){let{systemPrompt:r,settingSources:n,sandbox:i,...s}=t??{},o,a;r===void 0?o="":typeof r=="string"?o=r:r.type==="preset"&&(a=r.append);let u=s.pathToClaudeCodeExecutable;if(!u){let ni=t6e(import.meta.url),it=nee(ni,"..");u=nee(it,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.63";let{abortController:l=Vee(),additionalDirectories:c=[],agent:d,agents:p,allowedTools:f=[],betas:h,canUseTool:v,continue:y,cwd:_,debug:b,debugFile:g,disallowedTools:m=[],tools:S,env:w,executable:k=Hee()?"bun":"node",executableArgs:x=[],extraArgs:R={},fallbackModel:E,enableFileCheckpointing:P,forkSession:C,hooks:$,includePartialMessages:N,onElicitation:A,persistSession:W,thinking:H,effort:re,maxThinkingTokens:ne,maxTurns:Z,maxBudgetUsd:z,mcpServers:B,model:q,outputFormat:I,permissionMode:D="default",allowDangerouslySkipPermissions:O=!1,permissionPromptToolName:j,plugins:V,resume:Y,resumeSessionAt:me,sessionId:Ce,stderr:F,strictMcpConfig:M}=s,X=I?.type==="json_schema"?I.schema:void 0,ee=w;if(ee||(ee={...process.env}),ee.CLAUDE_CODE_ENTRYPOINT||(ee.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),P&&(ee.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),!u)throw Error("pathToClaudeCodeExecutable is required");let he={},Te=new Map;if(B)for(let[ni,it]of Object.entries(B))it.type==="sdk"&&"instance"in it?(Te.set(ni,it.instance),he[ni]={type:"sdk",name:ni}):he[ni]=it;let ze=typeof e=="string",_t;if(H)switch(H.type){case"adaptive":_t={type:"adaptive"};break;case"enabled":_t={type:"enabled",budgetTokens:H.budgetTokens};break;case"disabled":_t={type:"disabled"};break}else ne!==void 0&&(_t=ne===0?{type:"disabled"}:{type:"enabled",budgetTokens:ne});let Ot=new BA({abortController:l,additionalDirectories:c,agent:d,betas:h,cwd:_,debug:b,debugFile:g,executable:k,executableArgs:x,extraArgs:R,pathToClaudeCodeExecutable:u,env:ee,forkSession:C,stderr:F,thinkingConfig:_t,effort:re,maxTurns:Z,maxBudgetUsd:z,model:q,fallbackModel:E,jsonSchema:X,permissionMode:D,allowDangerouslySkipPermissions:O,permissionPromptToolName:j,continueConversation:y,resume:Y,resumeSessionAt:me,sessionId:Ce,settingSources:n??[],allowedTools:f,disallowedTools:m,tools:S,mcpServers:he,strictMcpConfig:M,canUseTool:!!v,hooks:!!$,includePartialMessages:N,persistSession:W,plugins:V,sandbox:i,spawnClaudeCodeProcess:s.spawnClaudeCodeProcess}),jt={systemPrompt:o,appendSystemPrompt:a,agents:p,promptSuggestions:s.promptSuggestions},ft=new GA(Ot,ze,v,$,l,Te,X,jt,A);return typeof e=="string"?Ot.write(Po({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:e}]},parent_tool_use_id:null})+`
461
+ `;if(Qee()){YZe(r);return}kVe().write(r)}function tte(){return ete()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Xee(Bee(),"debug",`${gVe()}.txt`)}function EVe(){return $Ve}function Po(e,t,r){let n=[];try{let o=Nr(n,Dr`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}}function TVe(e,t){let r={...e};if(t){let n={sandbox:t};if(r.settings)try{n={...rte(r.settings),sandbox:t}}catch{}r.settings=Po(n)}return r}function RVe(e){return![".js",".mjs",".tsx",".ts",".jsx"].some(t=>e.endsWith(t))}function KA(){return NVe}function ve(e,t){let r=KA(),n=YA({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Og?void 0:Og].filter(i=>!!i)});e.common.issues.push(n)}function Xe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,o)=>{let{message:a}=e;return s.code==="invalid_enum_value"?{message:a??o.defaultError}:typeof o.data>"u"?{message:a??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:a??r??o.defaultError}},description:i}}function ite(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KVe(e){return new RegExp(`^${ite(e)}$`)}function YVe(e){let t=`${nte}T${ite(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function XVe(e,t){return!!((t==="v4"||!t)&&ZVe.test(e)||(t==="v6"||!t)&&HVe.test(e))}function QVe(e,t){if(!LVe.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function eHe(e,t){return!!((t==="v4"||!t)&&VVe.test(e)||(t==="v6"||!t)&&BVe.test(e))}function tHe(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}function xf(e){if(e instanceof Oi){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Fs.create(xf(n))}return new Oi({...e._def,shape:()=>t})}else return e instanceof ku?new ku({...e._def,type:xf(e.element)}):e instanceof Fs?Fs.create(xf(e.unwrap())):e instanceof ma?ma.create(xf(e.unwrap())):e instanceof ha?ha.create(e.items.map(t=>xf(t))):e}function QA(e,t){let r=bu(e),n=bu(t);if(e===t)return{valid:!0,data:e};if(r===$e.object&&n===$e.object){let i=It.objectKeys(t),s=It.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(let a of s){let u=QA(e[a],t[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(r===$e.array&&n===$e.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],u=QA(o,a);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===$e.date&&n===$e.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function ste(e,t){return new jf({values:e,typeName:Be.ZodEnum,...Xe(t)})}function Q(e,t,r){function n(a,u){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,u);for(let c in o.prototype)c in a||Object.defineProperty(a,c,{value:o.prototype[c].bind(a)});a._zod.constr=o,a._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function o(a){var u;let l=r?.Parent?new s:this;n(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function ga(e){return e&&Object.assign(rD,e),rD}function rHe(e){return e}function nHe(e){return e}function iHe(e){}function sHe(e){throw Error()}function oHe(e){}function ote(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function nD(e,t="|"){return e.map(r=>yD(r)).join(t)}function ate(e,t){return typeof t=="bigint"?t.toString():t}function SS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error("cached value already set")}}}function kS(e){return e==null}function xS(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ute(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}function pr(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mD(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function aHe(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function uHe(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=n[s];return i})}function lHe(e=10){let t="";for(let r=0;r<e;r++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return t}function $f(e){return JSON.stringify(e)}function Ug(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Zg(e){if(Ug(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(Ug(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cHe(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Bf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _a(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Ue(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function pHe(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,s){return t??(t=e()),Reflect.set(t,n,i,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function yD(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dte(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function mHe(e,t){let r={},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return _a(e,{...e._zod.def,shape:r,checks:[]})}function gHe(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return _a(e,{...e._zod.def,shape:r,checks:[]})}function yHe(e,t){if(!Zg(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return mD(this,"shape",n),n},checks:[]};return _a(e,r)}function _He(e,t){return _a(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return mD(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function vHe(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)i[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return _a(t,{...t._zod.def,shape:i,checks:[]})}function bHe(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return _a(t,{...t._zod.def,shape:i,checks:[]})}function Tf(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function wu(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Rg(e){return typeof e=="string"?e:e?.message}function ya(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Rg(e.inst?._zod.def?.error?.(e))??Rg(t?.error?.(e))??Rg(r.customError?.(e))??Rg(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,!t?.reportInput&&delete n.input,n}function wHe(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function $S(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pte(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function SHe(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function kHe(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function xHe(e,t){let r=t||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let a=n,u=0;for(;u<o.path.length;){let l=o.path[u];u!==o.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))),a=a[l],u++}}};return i(e),n}function jHe(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}function xte(e){return typeof e.precision=="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function HHe(e){return new RegExp(`^${xte(e)}$`)}function BHe(e){let t=xte({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${kte}T(?:${n})$`)}function Rte(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function N9e(e){if(!Ste.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rte(r)}function j9e(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}function yee(e,t,r){e.issues.length&&t.issues.push(...wu(r,e.issues)),t.value[r]=e.value}function sS(e,t,r){e.issues.length&&t.issues.push(...wu(r,e.issues)),t.value[r]=e.value}function _ee(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...wu(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function vee(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>ya(s,n,ga())))}),t}function oD(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Zg(e)&&Zg(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),i={...e,...t};for(let s of n){let o=oD(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],s=t[n],o=oD(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bee(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Tf(e))return e;let n=oD(t.value,r.value);if(!n.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}function wee(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function See(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function kee(e,t,r){return Tf(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}function xee(e){return e.value=Object.freeze(e.value),e}function $ee(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(pte(i))}}function aBe(){return{localeError:oBe()}}function uBe(){return new aD}function lBe(e,t){return new e({type:"string",...Ue(t)})}function cBe(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function Eee(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function dBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function fBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function pBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function hBe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function mBe(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function gBe(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function yBe(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function _Be(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function vBe(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function bBe(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function wBe(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function SBe(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function kBe(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function xBe(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function $Be(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function EBe(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function TBe(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function RBe(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function PBe(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function IBe(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function OBe(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function CBe(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function NBe(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function ABe(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function DBe(e,t){return new e({type:"number",checks:[],...Ue(t)})}function jBe(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function zBe(e,t){return new e({type:"boolean",...Ue(t)})}function MBe(e,t){return new e({type:"null",...Ue(t)})}function LBe(e){return new e({type:"unknown"})}function qBe(e,t){return new e({type:"never",...Ue(t)})}function Tee(e,t){return new Ete({check:"less_than",...Ue(t),value:e,inclusive:!1})}function ZA(e,t){return new Ete({check:"less_than",...Ue(t),value:e,inclusive:!0})}function Ree(e,t){return new Tte({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function VA(e,t){return new Tte({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function Pee(e,t){return new e9e({check:"multiple_of",...Ue(t),value:e})}function Cte(e,t){return new r9e({check:"max_length",...Ue(t),maximum:e})}function hS(e,t){return new n9e({check:"min_length",...Ue(t),minimum:e})}function Nte(e,t){return new i9e({check:"length_equals",...Ue(t),length:e})}function FBe(e,t){return new s9e({check:"string_format",format:"regex",...Ue(t),pattern:e})}function UBe(e){return new o9e({check:"string_format",format:"lowercase",...Ue(e)})}function ZBe(e){return new a9e({check:"string_format",format:"uppercase",...Ue(e)})}function VBe(e,t){return new u9e({check:"string_format",format:"includes",...Ue(t),includes:e})}function HBe(e,t){return new l9e({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function BBe(e,t){return new c9e({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function Vg(e){return new d9e({check:"overwrite",tx:e})}function WBe(e){return Vg(t=>t.normalize(e))}function JBe(){return Vg(e=>e.trim())}function GBe(){return Vg(e=>e.toLowerCase())}function KBe(){return Vg(e=>e.toUpperCase())}function YBe(e,t,r){return new e({type:"array",element:t,...Ue(r)})}function XBe(e,t,r){let n=Ue(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function QBe(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ue(r)})}function jte(e){return OBe(Dte,e)}function Mte(e){return CBe(zte,e)}function qte(e){return NBe(Lte,e)}function Ute(e){return ABe(Fte,e)}function K(e){return lBe(sWe,e)}function Wt(e){return DBe(Hte,e)}function Oee(e){return jBe(kWe,e)}function bn(e){return zBe(xWe,e)}function Bte(e){return MBe($We,e)}function kr(){return LBe(EWe)}function RWe(e){return qBe(TWe,e)}function Tt(e,t){return YBe(PWe,e,t)}function Ee(e,t){let r={type:"object",get shape(){return sr.assignProp(this,"shape",{...e}),this.shape},...sr.normalizeParams(t)};return new Wte(r)}function vi(e,t){return new Wte({type:"object",get shape(){return sr.assignProp(this,"shape",{...e}),this.shape},catchall:kr(),...sr.normalizeParams(t)})}function hr(e,t){return new Jte({type:"union",options:e,...sr.normalizeParams(t)})}function Gte(e,t,r){return new IWe({type:"union",options:t,discriminator:e,...sr.normalizeParams(r)})}function vD(e,t){return new OWe({type:"intersection",left:e,right:t})}function xr(e,t,r){return new CWe({type:"record",keyType:e,valueType:t,...sr.normalizeParams(r)})}function Ci(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new uD({type:"enum",entries:r,...sr.normalizeParams(t)})}function je(e,t){return new NWe({type:"literal",values:Array.isArray(e)?e:[e],...sr.normalizeParams(t)})}function Kte(e){return new AWe({type:"transform",transform:e})}function jr(e){return new Yte({type:"optional",innerType:e})}function Cee(e){return new DWe({type:"nullable",innerType:e})}function zWe(e,t){return new jWe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function LWe(e,t){return new MWe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function qWe(e,t){return new Xte({type:"nonoptional",innerType:e,...sr.normalizeParams(t)})}function UWe(e,t){return new FWe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function lD(e,t){return new ZWe({type:"pipe",in:e,out:t})}function HWe(e){return new VWe({type:"readonly",innerType:e})}function BWe(e,t){let r=new wi({check:"custom",...sr.normalizeParams(t)});return r._zod.check=e,r}function WWe(e,t){return XBe(Qte,e??(()=>!0),t)}function JWe(e,t={}){return QBe(Qte,e,t)}function GWe(e,t){let r=BWe(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(sr.issue(i,n.value,r._zod.def));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(sr.issue(s))}},e(n.value,n)),t);return r}function ere(e,t){return lD(Kte(e),t)}function $re({prompt:e,options:t}){let{systemPrompt:r,settingSources:n,sandbox:i,...s}=t??{},o,a;r===void 0?o="":typeof r=="string"?o=r:r.type==="preset"&&(a=r.append);let u=s.pathToClaudeCodeExecutable;if(!u){let ni=t6e(import.meta.url),it=nee(ni,"..");u=nee(it,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.63";let{abortController:l=Vee(),additionalDirectories:c=[],agent:d,agents:p,allowedTools:f=[],betas:h,canUseTool:v,continue:y,cwd:_,debug:b,debugFile:g,disallowedTools:m=[],tools:S,env:w,executable:k=Hee()?"bun":"node",executableArgs:x=[],extraArgs:R={},fallbackModel:E,enableFileCheckpointing:P,forkSession:C,hooks:$,includePartialMessages:N,onElicitation:A,persistSession:W,thinking:H,effort:te,maxThinkingTokens:ne,maxTurns:Z,maxBudgetUsd:z,mcpServers:B,model:q,outputFormat:I,permissionMode:D="default",allowDangerouslySkipPermissions:O=!1,permissionPromptToolName:j,plugins:V,resume:Y,resumeSessionAt:me,sessionId:Ce,stderr:F,strictMcpConfig:M}=s,X=I?.type==="json_schema"?I.schema:void 0,ee=w;if(ee||(ee={...process.env}),ee.CLAUDE_CODE_ENTRYPOINT||(ee.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),P&&(ee.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),!u)throw Error("pathToClaudeCodeExecutable is required");let he={},Te=new Map;if(B)for(let[ni,it]of Object.entries(B))it.type==="sdk"&&"instance"in it?(Te.set(ni,it.instance),he[ni]={type:"sdk",name:ni}):he[ni]=it;let ze=typeof e=="string",_t;if(H)switch(H.type){case"adaptive":_t={type:"adaptive"};break;case"enabled":_t={type:"enabled",budgetTokens:H.budgetTokens};break;case"disabled":_t={type:"disabled"};break}else ne!==void 0&&(_t=ne===0?{type:"disabled"}:{type:"enabled",budgetTokens:ne});let Ot=new BA({abortController:l,additionalDirectories:c,agent:d,betas:h,cwd:_,debug:b,debugFile:g,executable:k,executableArgs:x,extraArgs:R,pathToClaudeCodeExecutable:u,env:ee,forkSession:C,stderr:F,thinkingConfig:_t,effort:te,maxTurns:Z,maxBudgetUsd:z,model:q,fallbackModel:E,jsonSchema:X,permissionMode:D,allowDangerouslySkipPermissions:O,permissionPromptToolName:j,continueConversation:y,resume:Y,resumeSessionAt:me,sessionId:Ce,settingSources:n??[],allowedTools:f,disallowedTools:m,tools:S,mcpServers:he,strictMcpConfig:M,canUseTool:!!v,hooks:!!$,includePartialMessages:N,persistSession:W,plugins:V,sandbox:i,spawnClaudeCodeProcess:s.spawnClaudeCodeProcess}),jt={systemPrompt:o,appendSystemPrompt:a,agents:p,promptSuggestions:s.promptSuggestions},ft=new GA(Ot,ze,v,$,l,Te,X,jt,A);return typeof e=="string"?Ot.write(Po({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:e}]},parent_tool_use_id:null})+`
462
462
  `):ft.streamInput(e),ft}var W4e,J4e,HA,G4e,K4e,X4e,Q4e,Dee,be,e2e,jee,r2e,n2e,Nr,Ar,uS,ree,ut,Nt,xu,gS,i2e,zee,Mee,lS,s2e,Zs,o2e,a2e,Lee,u2e,yS,_S,cD,vS,dD,l2e,c2e,d2e,f2e,p2e,h2e,m2e,g2e,y2e,_2e,v2e,b2e,w2e,S2e,k2e,x2e,$2e,E2e,fD,T2e,R2e,P2e,I2e,qee,Fee,O2e,C2e,N2e,A2e,D2e,Uee,j2e,z2e,M2e,L2e,q2e,F2e,U2e,Z2e,V2e,H2e,B2e,W2e,J2e,G2e,K2e,Y2e,Zee,X2e,Q2e,e6e,n6e,ac,Ef,kf,f6e,p6e,h6e,m6e,pD,g6e,cS,Wee,y6e,_6e,Eg,b6e,w6e,S6e,x6e,$6e,E6e,oee,R6e,Jee,I6e,O6e,C6e,N6e,D6e,j6e,FA,aee,M6e,L6e,q6e,U6e,Z6e,V6e,H6e,B6e,W6e,J6e,G6e,Y6e,Q6e,Gee,tZe,Ig,nZe,sZe,oZe,aZe,uZe,cZe,dZe,fZe,hZe,mZe,yZe,uee,vZe,wZe,bS,kZe,xZe,EZe,RZe,IZe,CZe,NZe,AZe,DZe,zZe,LZe,wS,UZe,VZe,BZe,JZe,Kee,GZe,Hf,XZe,cVe,dVe,mVe,dee,vVe,bVe,Qee,ete,SVe,iS,xVe,Edt,$Ve,Dr,rte,BA,WA,JA,GA,Idt,It,fee,$e,bu,le,ds,CVe,Og,NVe,YA,Yn,He,Tg,bi,pee,hee,Rf,dS,Pe,fs,mee,lt,AVe,DVe,jVe,zVe,MVe,LVe,qVe,FVe,UVe,UA,ZVe,VVe,HVe,BVe,WVe,JVe,nte,GVe,Pf,Cg,Ng,Ag,Dg,jg,If,Of,zg,Su,Io,Mg,ku,Oi,Cf,pa,XA,Nf,ha,eD,Lg,qg,tD,Af,Df,jf,zf,uc,Us,Fs,ma,Mf,Lf,Fg,Odt,fS,pS,qf,Cdt,Be,Ndt,Adt,Ddt,jdt,zdt,Mdt,Ldt,qdt,Fdt,Udt,Zdt,Vdt,Hdt,Bdt,Wdt,Jdt,Gdt,Kdt,Ydt,Xdt,Qdt,eft,tft,rft,nft,ift,sft,oft,aft,uft,lft,cft,dft,fft,pft,hft,lc,rD,sr,gD,lte,dHe,cte,fHe,fte,hHe,iD,hte,mte,ES,gte,$He,yte,EHe,_te,vte,bte,wte,THe,RHe,PHe,IHe,OHe,CHe,NHe,AHe,gee,DHe,zHe,MHe,LHe,qHe,FHe,Ste,UHe,ZHe,kte,VHe,WHe,JHe,GHe,KHe,YHe,XHe,QHe,wi,$te,Ete,Tte,e9e,t9e,r9e,n9e,i9e,TS,s9e,o9e,a9e,u9e,l9e,c9e,d9e,sD,f9e,or,_D,yr,p9e,h9e,m9e,g9e,y9e,_9e,v9e,b9e,w9e,S9e,k9e,x9e,$9e,E9e,T9e,R9e,P9e,I9e,O9e,C9e,A9e,D9e,z9e,Pte,M9e,L9e,q9e,F9e,U9e,Z9e,Ite,Ote,V9e,H9e,B9e,W9e,J9e,G9e,K9e,Y9e,X9e,Q9e,eBe,tBe,rBe,nBe,iBe,sBe,oBe,mft,gft,aD,oS,eWe,yft,Ate,Dte,zte,Lte,Fte,Zte,_ft,RS,tWe,rWe,nWe,iWe,$r,Vte,sWe,Er,oWe,Iee,aS,aWe,uWe,lWe,cWe,dWe,fWe,pWe,hWe,mWe,gWe,yWe,_We,vWe,bWe,wWe,SWe,Hte,kWe,xWe,$We,EWe,TWe,PWe,Wte,Jte,IWe,OWe,CWe,uD,NWe,AWe,Yte,DWe,jWe,MWe,Xte,FWe,ZWe,VWe,Qte,KWe,PS,wn,tre,rre,vft,YWe,XWe,bD,Ni,IS,Sn,ps,hs,kn,OS,QWe,eJe,nre,Nee,ire,bft,wft,sre,tJe,ore,rJe,Hg,Ff,are,nJe,iJe,sJe,oJe,aJe,uJe,lJe,cJe,dJe,fJe,ure,pJe,hJe,lre,mJe,Bg,Wg,gJe,Jg,cre,yJe,dre,fre,pre,hre,Sft,mre,gre,yre,kft,_re,vre,wD,bre,Gg,Wf,wre,_Je,vJe,bJe,wJe,SJe,SD,kJe,xJe,$Je,EJe,TJe,RJe,PJe,IJe,OJe,CJe,NJe,AJe,DJe,jJe,zJe,MJe,kD,xD,$D,LJe,qJe,FJe,ED,UJe,ZJe,VJe,HJe,BJe,Sre,WJe,JJe,kre,xft,GJe,KJe,YJe,$ft,xre,XJe,QJe,eGe,tGe,rGe,nGe,iGe,sGe,oGe,mS,aGe,uGe,lGe,cGe,dGe,fGe,pGe,hGe,mGe,gGe,yGe,_Ge,vGe,bGe,wGe,SGe,kGe,xGe,$Ge,EGe,TGe,RGe,PGe,IGe,OGe,CGe,NGe,AGe,DGe,jGe,zGe,MGe,LGe,Eft,Tft,Rft,Pft,Ift,Oft,Cft,Nft,Aft,Dft,jft,Aee,Ere=L(()=>{W4e=Object.create,{getPrototypeOf:J4e,defineProperty:HA,getOwnPropertyNames:G4e}=Object,K4e=Object.prototype.hasOwnProperty;Dee=(e,t,r)=>{var n=e!=null&&typeof e=="object";if(n){var i=t?X4e??=new WeakMap:Q4e??=new WeakMap,s=i.get(e);if(s)return s}r=e!=null?W4e(J4e(e)):{};let o=t||!e||!e.__esModule?HA(r,"default",{value:e,enumerable:!0}):r;for(let a of G4e(e))K4e.call(o,a)||HA(o,a,{get:Y4e.bind(e,a),enumerable:!0});return n&&i.set(e,o),o},be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),e2e=e=>e;jee=(e,t)=>{for(var r in t)HA(e,r,{get:t[r],enumerable:!0,configurable:!0,set:t2e.bind(t,r)})},r2e=Symbol.dispose||Symbol.for("Symbol.dispose"),n2e=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Nr=(e,t,r)=>{if(t!=null){if(typeof t!="object"&&typeof t!="function")throw TypeError('Object expected to be assigned to "using" declaration');var n;if(r&&(n=t[n2e]),n===void 0&&(n=t[r2e]),typeof n!="function")throw TypeError("Object not disposable");e.push([r,n,t])}else r&&e.push([r]);return t},Ar=(e,t,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(o,a,u,l){return l=Error(u),l.name="SuppressedError",l.error=o,l.suppressed=a,l},i=o=>t=r?new n(o,t,"An error was suppressed during disposal"):(r=!0,o),s=o=>{for(;o=e.pop();)try{var a=o[1]&&o[1].call(o[2]);if(o[0])return Promise.resolve(a).then(s,u=>(i(u),s()))}catch(u){i(u)}if(r)throw t};return s()},uS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(b){if(super(),!e.IDENTIFIER.test(b))throw Error("CodeGen: name must be a valid identifier");this.str=b}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(b){super(),this._items=typeof b=="string"?[b]:b}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let b=this._items[0];return b===""||b==='""'}get str(){var b;return(b=this._str)!==null&&b!==void 0?b:this._str=this._items.reduce((g,m)=>`${g}${m}`,"")}get names(){var b;return(b=this._names)!==null&&b!==void 0?b:this._names=this._items.reduce((g,m)=>(m instanceof r&&(g[m.str]=(g[m.str]||0)+1),g),{})}}e._Code=n,e.nil=new n("");function i(_,...b){let g=[_[0]],m=0;for(;m<b.length;)a(g,b[m]),g.push(_[++m]);return new n(g)}e._=i;var s=new n("+");function o(_,...b){let g=[f(_[0])],m=0;for(;m<b.length;)g.push(s),a(g,b[m]),g.push(s,f(_[++m]));return u(g),new n(g)}e.str=o;function a(_,b){b instanceof n?_.push(...b._items):b instanceof r?_.push(b):_.push(d(b))}e.addCodeArg=a;function u(_){let b=1;for(;b<_.length-1;){if(_[b]===s){let g=l(_[b-1],_[b+1]);if(g!==void 0){_.splice(b-1,3,g);continue}_[b++]="+"}b++}}function l(_,b){if(b==='""')return _;if(_==='""')return b;if(typeof _=="string")return b instanceof r||_[_.length-1]!=='"'?void 0:typeof b!="string"?`${_.slice(0,-1)}${b}"`:b[0]==='"'?_.slice(0,-1)+b.slice(1):void 0;if(typeof b=="string"&&b[0]==='"'&&!(_ instanceof r))return`"${_}${b.slice(1)}`}function c(_,b){return b.emptyStr()?_:_.emptyStr()?b:o`${_}${b}`}e.strConcat=c;function d(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:f(Array.isArray(_)?_.join(","):_)}function p(_){return new n(f(_))}e.stringify=p;function f(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=f;function h(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):i`[${_}]`}e.getProperty=h;function v(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=v;function y(_){return new n(_.toString())}e.regexpCode=y}),ree=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=uS();class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class i{constructor({prefixes:l,parent:c}={}){this._names={},this._prefixes=l,this._parent=c}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){let c=this._names[l]||this._nameGroup(l);return`${l}${c.index++}`}_nameGroup(l){var c,d;if(!((d=(c=this._parent)===null||c===void 0?void 0:c._prefixes)===null||d===void 0)&&d.has(l)||this._prefixes&&!this._prefixes.has(l))throw Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=i;class s extends t.Name{constructor(l,c){super(c),this.prefix=l}setValue(l,{property:c,itemIndex:d}){this.value=l,this.scopePath=t._`.${new t.Name(c)}[${d}]`}}e.ValueScopeName=s;var o=t._`\n`;class a extends i{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?o:t.nil}}get(){return this._scope}name(l){return new s(l,this._newName(l))}value(l,c){var d;if(c.ref===void 0)throw Error("CodeGen: ref must be passed in value");let p=this.toName(l),{prefix:f}=p,h=(d=c.key)!==null&&d!==void 0?d:c.ref,v=this._values[f];if(v){let b=v.get(h);if(b)return b}else v=this._values[f]=new Map;v.set(h,p);let y=this._scope[f]||(this._scope[f]=[]),_=y.length;return y[_]=c.ref,p.setValue(c,{property:f,itemIndex:_}),p}getValue(l,c){let d=this._values[l];if(d)return d.get(c)}scopeRefs(l,c=this._values){return this._reduceValues(c,d=>{if(d.scopePath===void 0)throw Error(`CodeGen: name "${d}" has no value`);return t._`${l}${d.scopePath}`})}scopeCode(l=this._values,c,d){return this._reduceValues(l,p=>{if(p.value===void 0)throw Error(`CodeGen: name "${p}" has no value`);return p.value.code},c,d)}_reduceValues(l,c,d={},p){let f=t.nil;for(let h in l){let v=l[h];if(!v)continue;let y=d[h]=d[h]||new Map;v.forEach(_=>{if(y.has(_))return;y.set(_,n.Started);let b=c(_);if(b){let g=this.opts.es5?e.varKinds.var:e.varKinds.const;f=t._`${f}${g} ${_} = ${b};${this.opts._n}`}else if(b=p?.(_))f=t._`${f}${b}${this.opts._n}`;else throw new r(_);y.set(_,n.Completed)})}return f}}e.ValueScope=a}),ut=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=uS(),r=ree(),n=uS();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var i=ree();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(I,D){return this}}class o extends s{constructor(I,D,O){super(),this.varKind=I,this.name=D,this.rhs=O}render({es5:I,_n:D}){let O=I?r.varKinds.var:this.varKind,j=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${j};`+D}optimizeNames(I,D){if(I[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,I,D)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(I,D,O){super(),this.lhs=I,this.rhs=D,this.sideEffects=O}render({_n:I}){return`${this.lhs} = ${this.rhs};`+I}optimizeNames(I,D){if(!(this.lhs instanceof t.Name&&!I[this.lhs.str]&&!this.sideEffects))return this.rhs=N(this.rhs,I,D),this}get names(){let I=this.lhs instanceof t.Name?{}:{...this.lhs.names};return $(I,this.rhs)}}class u extends a{constructor(I,D,O,j){super(I,O,j),this.op=D}render({_n:I}){return`${this.lhs} ${this.op}= ${this.rhs};`+I}}class l extends s{constructor(I){super(),this.label=I,this.names={}}render({_n:I}){return`${this.label}:`+I}}class c extends s{constructor(I){super(),this.label=I,this.names={}}render({_n:I}){return`break${this.label?` ${this.label}`:""};`+I}}class d extends s{constructor(I){super(),this.error=I}render({_n:I}){return`throw ${this.error};`+I}get names(){return this.error.names}}class p extends s{constructor(I){super(),this.code=I}render({_n:I}){return`${this.code};`+I}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(I,D){return this.code=N(this.code,I,D),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends s{constructor(I=[]){super(),this.nodes=I}render(I){return this.nodes.reduce((D,O)=>D+O.render(I),"")}optimizeNodes(){let{nodes:I}=this,D=I.length;for(;D--;){let O=I[D].optimizeNodes();Array.isArray(O)?I.splice(D,1,...O):O?I[D]=O:I.splice(D,1)}return I.length>0?this:void 0}optimizeNames(I,D){let{nodes:O}=this,j=O.length;for(;j--;){let V=O[j];V.optimizeNames(I,D)||(A(I,V.names),O.splice(j,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((I,D)=>C(I,D.names),{})}}class h extends f{render(I){return"{"+I._n+super.render(I)+"}"+I._n}}class v extends f{}class y extends h{}y.kind="else";class _ extends h{constructor(I,D){super(D),this.condition=I}render(I){let D=`if(${this.condition})`+super.render(I);return this.else&&(D+="else "+this.else.render(I)),D}optimizeNodes(){super.optimizeNodes();let I=this.condition;if(I===!0)return this.nodes;let D=this.else;if(D){let O=D.optimizeNodes();D=this.else=Array.isArray(O)?new y(O):O}if(D)return I===!1?D instanceof _?D:D.nodes:this.nodes.length?this:new _(W(I),D instanceof _?[D]:D.nodes);if(!(I===!1||!this.nodes.length))return this}optimizeNames(I,D){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(I,D),!!(super.optimizeNames(I,D)||this.else))return this.condition=N(this.condition,I,D),this}get names(){let I=super.names;return $(I,this.condition),this.else&&C(I,this.else.names),I}}_.kind="if";class b extends h{}b.kind="for";class g extends b{constructor(I){super(),this.iteration=I}render(I){return`for(${this.iteration})`+super.render(I)}optimizeNames(I,D){if(super.optimizeNames(I,D))return this.iteration=N(this.iteration,I,D),this}get names(){return C(super.names,this.iteration.names)}}class m extends b{constructor(I,D,O,j){super(),this.varKind=I,this.name=D,this.from=O,this.to=j}render(I){let D=I.es5?r.varKinds.var:this.varKind,{name:O,from:j,to:V}=this;return`for(${D} ${O}=${j}; ${O}<${V}; ${O}++)`+super.render(I)}get names(){let I=$(super.names,this.from);return $(I,this.to)}}class S extends b{constructor(I,D,O,j){super(),this.loop=I,this.varKind=D,this.name=O,this.iterable=j}render(I){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(I)}optimizeNames(I,D){if(super.optimizeNames(I,D))return this.iterable=N(this.iterable,I,D),this}get names(){return C(super.names,this.iterable.names)}}class w extends h{constructor(I,D,O){super(),this.name=I,this.args=D,this.async=O}render(I){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(I)}}w.kind="func";class k extends f{render(I){return"return "+super.render(I)}}k.kind="return";class x extends h{render(I){let D="try"+super.render(I);return this.catch&&(D+=this.catch.render(I)),this.finally&&(D+=this.finally.render(I)),D}optimizeNodes(){var I,D;return super.optimizeNodes(),(I=this.catch)===null||I===void 0||I.optimizeNodes(),(D=this.finally)===null||D===void 0||D.optimizeNodes(),this}optimizeNames(I,D){var O,j;return super.optimizeNames(I,D),(O=this.catch)===null||O===void 0||O.optimizeNames(I,D),(j=this.finally)===null||j===void 0||j.optimizeNames(I,D),this}get names(){let I=super.names;return this.catch&&C(I,this.catch.names),this.finally&&C(I,this.finally.names),I}}class R extends h{constructor(I){super(),this.error=I}render(I){return`catch(${this.error})`+super.render(I)}}R.kind="catch";class E extends h{render(I){return"finally"+super.render(I)}}E.kind="finally";class P{constructor(I,D={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...D,_n:D.lines?`
463
- `:""},this._extScope=I,this._scope=new r.Scope({parent:I}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(I){return this._scope.name(I)}scopeName(I){return this._extScope.name(I)}scopeValue(I,D){let O=this._extScope.value(I,D);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}getScopeValue(I,D){return this._extScope.getValue(I,D)}scopeRefs(I){return this._extScope.scopeRefs(I,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(I,D,O,j){let V=this._scope.toName(D);return O!==void 0&&j&&(this._constants[V.str]=O),this._leafNode(new o(I,V,O)),V}const(I,D,O){return this._def(r.varKinds.const,I,D,O)}let(I,D,O){return this._def(r.varKinds.let,I,D,O)}var(I,D,O){return this._def(r.varKinds.var,I,D,O)}assign(I,D,O){return this._leafNode(new a(I,D,O))}add(I,D){return this._leafNode(new u(I,e.operators.ADD,D))}code(I){return typeof I=="function"?I():I!==t.nil&&this._leafNode(new p(I)),this}object(...I){let D=["{"];for(let[O,j]of I)D.length>1&&D.push(","),D.push(O),(O!==j||this.opts.es5)&&(D.push(":"),(0,t.addCodeArg)(D,j));return D.push("}"),new t._Code(D)}if(I,D,O){if(this._blockNode(new _(I)),D&&O)this.code(D).else().code(O).endIf();else if(D)this.code(D).endIf();else if(O)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(I){return this._elseNode(new _(I))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(_,y)}_for(I,D){return this._blockNode(I),D&&this.code(D).endFor(),this}for(I,D){return this._for(new g(I),D)}forRange(I,D,O,j,V=this.opts.es5?r.varKinds.var:r.varKinds.let){let Y=this._scope.toName(I);return this._for(new m(V,Y,D,O),()=>j(Y))}forOf(I,D,O,j=r.varKinds.const){let V=this._scope.toName(I);if(this.opts.es5){let Y=D instanceof t.Name?D:this.var("_arr",D);return this.forRange("_i",0,t._`${Y}.length`,me=>{this.var(V,t._`${Y}[${me}]`),O(V)})}return this._for(new S("of",j,V,D),()=>O(V))}forIn(I,D,O,j=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(I,t._`Object.keys(${D})`,O);let V=this._scope.toName(I);return this._for(new S("in",j,V,D),()=>O(V))}endFor(){return this._endBlockNode(b)}label(I){return this._leafNode(new l(I))}break(I){return this._leafNode(new c(I))}return(I){let D=new k;if(this._blockNode(D),this.code(I),D.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(I,D,O){if(!D&&!O)throw Error('CodeGen: "try" without "catch" and "finally"');let j=new x;if(this._blockNode(j),this.code(I),D){let V=this.name("e");this._currNode=j.catch=new R(V),D(V)}return O&&(this._currNode=j.finally=new E,this.code(O)),this._endBlockNode(R,E)}throw(I){return this._leafNode(new d(I))}block(I,D){return this._blockStarts.push(this._nodes.length),I&&this.code(I).endBlock(D),this}endBlock(I){let D=this._blockStarts.pop();if(D===void 0)throw Error("CodeGen: not in self-balancing block");let O=this._nodes.length-D;if(O<0||I!==void 0&&O!==I)throw Error(`CodeGen: wrong number of nodes: ${O} vs ${I} expected`);return this._nodes.length=D,this}func(I,D=t.nil,O,j){return this._blockNode(new w(I,D,O)),j&&this.code(j).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(I=1){for(;I-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(I){return this._currNode.nodes.push(I),this}_blockNode(I){this._currNode.nodes.push(I),this._nodes.push(I)}_endBlockNode(I,D){let O=this._currNode;if(O instanceof I||D&&O instanceof D)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${D?`${I.kind}/${D.kind}`:I.kind}"`)}_elseNode(I){let D=this._currNode;if(!(D instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=D.else=I,this}get _root(){return this._nodes[0]}get _currNode(){let I=this._nodes;return I[I.length-1]}set _currNode(I){let D=this._nodes;D[D.length-1]=I}}e.CodeGen=P;function C(q,I){for(let D in I)q[D]=(q[D]||0)+(I[D]||0);return q}function $(q,I){return I instanceof t._CodeOrName?C(q,I.names):q}function N(q,I,D){if(q instanceof t.Name)return O(q);if(!j(q))return q;return new t._Code(q._items.reduce((V,Y)=>(Y instanceof t.Name&&(Y=O(Y)),Y instanceof t._Code?V.push(...Y._items):V.push(Y),V),[]));function O(V){let Y=D[V.str];return Y===void 0||I[V.str]!==1?V:(delete I[V.str],Y)}function j(V){return V instanceof t._Code&&V._items.some(Y=>Y instanceof t.Name&&I[Y.str]===1&&D[Y.str]!==void 0)}}function A(q,I){for(let D in I)q[D]=(q[D]||0)-(I[D]||0)}function W(q){return typeof q=="boolean"||typeof q=="number"||q===null?!q:t._`!${B(q)}`}e.not=W;var H=z(e.operators.AND);function re(...q){return q.reduce(H)}e.and=re;var ne=z(e.operators.OR);function Z(...q){return q.reduce(ne)}e.or=Z;function z(q){return(I,D)=>I===t.nil?D:D===t.nil?I:t._`${B(I)} ${q} ${B(D)}`}function B(q){return q instanceof t.Name?q:t._`(${q})`}}),Nt=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=ut(),r=uS();function n(w){let k={};for(let x of w)k[x]=!0;return k}e.toHash=n;function i(w,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(s(w,k),!o(k,w.self.RULES.all))}e.alwaysValidSchema=i;function s(w,k=w.schema){let{opts:x,self:R}=w;if(!x.strictSchema||typeof k=="boolean")return;let E=R.RULES.keywords;for(let P in k)E[P]||S(w,`unknown keyword: "${P}"`)}e.checkUnknownRules=s;function o(w,k){if(typeof w=="boolean")return!w;for(let x in w)if(k[x])return!0;return!1}e.schemaHasRules=o;function a(w,k){if(typeof w=="boolean")return!w;for(let x in w)if(x!=="$ref"&&k.all[x])return!0;return!1}e.schemaHasRulesButRef=a;function u({topSchemaRef:w,schemaPath:k},x,R,E){if(!E){if(typeof x=="number"||typeof x=="boolean")return x;if(typeof x=="string")return t._`${x}`}return t._`${w}${k}${(0,t.getProperty)(R)}`}e.schemaRefOrVal=u;function l(w){return p(decodeURIComponent(w))}e.unescapeFragment=l;function c(w){return encodeURIComponent(d(w))}e.escapeFragment=c;function d(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function p(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function f(w,k){if(Array.isArray(w))for(let x of w)k(x);else k(w)}e.eachItem=f;function h({mergeNames:w,mergeToName:k,mergeValues:x,resultToName:R}){return(E,P,C,$)=>{let N=C===void 0?P:C instanceof t.Name?(P instanceof t.Name?w(E,P,C):k(E,P,C),C):P instanceof t.Name?(k(E,C,P),P):x(P,C);return $===t.Name&&!(N instanceof t.Name)?R(E,N):N}}e.mergeEvaluated={props:h({mergeNames:(w,k,x)=>w.if(t._`${x} !== true && ${k} !== undefined`,()=>{w.if(t._`${k} === true`,()=>w.assign(x,!0),()=>w.assign(x,t._`${x} || {}`).code(t._`Object.assign(${x}, ${k})`))}),mergeToName:(w,k,x)=>w.if(t._`${x} !== true`,()=>{k===!0?w.assign(x,!0):(w.assign(x,t._`${x} || {}`),y(w,x,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:v}),items:h({mergeNames:(w,k,x)=>w.if(t._`${x} !== true && ${k} !== undefined`,()=>w.assign(x,t._`${k} === true ? true : ${x} > ${k} ? ${x} : ${k}`)),mergeToName:(w,k,x)=>w.if(t._`${x} !== true`,()=>w.assign(x,k===!0?!0:t._`${x} > ${k} ? ${x} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function v(w,k){if(k===!0)return w.var("props",!0);let x=w.var("props",t._`{}`);return k!==void 0&&y(w,x,k),x}e.evaluatedPropsToName=v;function y(w,k,x){Object.keys(x).forEach(R=>w.assign(t._`${k}${(0,t.getProperty)(R)}`,!0))}e.setEvaluated=y;var _={};function b(w,k){return w.scopeValue("func",{ref:k,code:_[k.code]||(_[k.code]=new r._Code(k.code))})}e.useFunc=b;var g;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(g||(e.Type=g={}));function m(w,k,x){if(w instanceof t.Name){let R=k===g.Num;return x?R?t._`"[" + ${w} + "]"`:t._`"['" + ${w} + "']"`:R?t._`"/" + ${w}`:t._`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return x?(0,t.getProperty)(w).toString():"/"+d(w)}e.getErrorPath=m;function S(w,k,x=w.opts.strictSchema){if(x){if(k=`strict mode: ${k}`,x===!0)throw Error(k);w.self.logger.warn(k)}}e.checkStrictMode=S}),xu=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),gS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=ut(),r=Nt(),n=xu();e.keywordError={message:({keyword:y})=>t.str`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:_})=>_?t.str`"${y}" keyword must be ${_} ($data)`:t.str`"${y}" keyword is invalid ($data)`};function i(y,_=e.keywordError,b,g){let{it:m}=y,{gen:S,compositeRule:w,allErrors:k}=m,x=d(y,_,b);g??(w||k)?u(S,x):l(m,t._`[${x}]`)}e.reportError=i;function s(y,_=e.keywordError,b){let{it:g}=y,{gen:m,compositeRule:S,allErrors:w}=g,k=d(y,_,b);u(m,k),!(S||w)&&l(g,n.default.vErrors)}e.reportExtraError=s;function o(y,_){y.assign(n.default.errors,_),y.if(t._`${n.default.vErrors} !== null`,()=>y.if(_,()=>y.assign(t._`${n.default.vErrors}.length`,_),()=>y.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function a({gen:y,keyword:_,schemaValue:b,data:g,errsCount:m,it:S}){if(m===void 0)throw Error("ajv implementation error");let w=y.name("err");y.forRange("i",m,n.default.errors,k=>{y.const(w,t._`${n.default.vErrors}[${k}]`),y.if(t._`${w}.instancePath === undefined`,()=>y.assign(t._`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,S.errorPath))),y.assign(t._`${w}.schemaPath`,t.str`${S.errSchemaPath}/${_}`),S.opts.verbose&&(y.assign(t._`${w}.schema`,b),y.assign(t._`${w}.data`,g))})}e.extendErrors=a;function u(y,_){let b=y.const("err",_);y.if(t._`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,t._`[${b}]`),t._`${n.default.vErrors}.push(${b})`),y.code(t._`${n.default.errors}++`)}function l(y,_){let{gen:b,validateName:g,schemaEnv:m}=y;m.$async?b.throw(t._`new ${y.ValidationError}(${_})`):(b.assign(t._`${g}.errors`,_),b.return(!1))}var c={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(y,_,b){let{createErrors:g}=y.it;return g===!1?t._`{}`:p(y,_,b)}function p(y,_,b={}){let{gen:g,it:m}=y,S=[f(m,b),h(y,b)];return v(y,_,S),g.object(...S)}function f({errorPath:y},{instancePath:_}){let b=_?t.str`${y}${(0,r.getErrorPath)(_,r.Type.Str)}`:y;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,b)]}function h({keyword:y,it:{errSchemaPath:_}},{schemaPath:b,parentSchema:g}){let m=g?_:t.str`${_}/${y}`;return b&&(m=t.str`${m}${(0,r.getErrorPath)(b,r.Type.Str)}`),[c.schemaPath,m]}function v(y,{params:_,message:b},g){let{keyword:m,data:S,schemaValue:w,it:k}=y,{opts:x,propertyName:R,topSchemaRef:E,schemaPath:P}=k;g.push([c.keyword,m],[c.params,typeof _=="function"?_(y):_||t._`{}`]),x.messages&&g.push([c.message,typeof b=="function"?b(y):b]),x.verbose&&g.push([c.schema,w],[c.parentSchema,t._`${E}${P}`],[n.default.data,S]),R&&g.push([c.propertyName,R])}}),i2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=gS(),r=ut(),n=xu(),i={message:"boolean schema is false"};function s(u){let{gen:l,schema:c,validateName:d}=u;c===!1?a(u,!1):typeof c=="object"&&c.$async===!0?l.return(n.default.data):(l.assign(r._`${d}.errors`,null),l.return(!0))}e.topBoolOrEmptySchema=s;function o(u,l){let{gen:c,schema:d}=u;d===!1?(c.var(l,!1),a(u)):c.var(l,!0)}e.boolOrEmptySchema=o;function a(u,l){let{gen:c,data:d}=u,p={gen:c,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:u};(0,t.reportError)(p,i,void 0,l)}}),zee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],r=new Set(t);function n(s){return typeof s=="string"&&r.has(s)}e.isJSONType=n;function i(){let s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=i}),Mee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:i,self:s},o){let a=s.RULES.types[o];return a&&a!==!0&&r(i,a)}e.schemaHasRulesForType=t;function r(i,s){return s.rules.some(o=>n(i,o))}e.shouldUseGroup=r;function n(i,s){var o;return i[s.keyword]!==void 0||((o=s.definition.implements)===null||o===void 0?void 0:o.some(a=>i[a]!==void 0))}e.shouldUseRule=n}),lS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=zee(),r=Mee(),n=gS(),i=ut(),s=Nt(),o;(function(g){g[g.Correct=0]="Correct",g[g.Wrong=1]="Wrong"})(o||(e.DataType=o={}));function a(g){let m=u(g.type);if(m.includes("null")){if(g.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!m.length&&g.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');g.nullable===!0&&m.push("null")}return m}e.getSchemaTypes=a;function u(g){let m=Array.isArray(g)?g:g?[g]:[];if(m.every(t.isJSONType))return m;throw Error("type must be JSONType or JSONType[]: "+m.join(","))}e.getJSONTypes=u;function l(g,m){let{gen:S,data:w,opts:k}=g,x=d(m,k.coerceTypes),R=m.length>0&&!(x.length===0&&m.length===1&&(0,r.schemaHasRulesForType)(g,m[0]));if(R){let E=v(m,w,k.strictNumbers,o.Wrong);S.if(E,()=>{x.length?p(g,m,x):_(g)})}return R}e.coerceAndCheckDataType=l;var c=new Set(["string","number","integer","boolean","null"]);function d(g,m){return m?g.filter(S=>c.has(S)||m==="array"&&S==="array"):[]}function p(g,m,S){let{gen:w,data:k,opts:x}=g,R=w.let("dataType",i._`typeof ${k}`),E=w.let("coerced",i._`undefined`);x.coerceTypes==="array"&&w.if(i._`${R} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>w.assign(k,i._`${k}[0]`).assign(R,i._`typeof ${k}`).if(v(m,k,x.strictNumbers),()=>w.assign(E,k))),w.if(i._`${E} !== undefined`);for(let C of S)(c.has(C)||C==="array"&&x.coerceTypes==="array")&&P(C);w.else(),_(g),w.endIf(),w.if(i._`${E} !== undefined`,()=>{w.assign(k,E),f(g,E)});function P(C){switch(C){case"string":w.elseIf(i._`${R} == "number" || ${R} == "boolean"`).assign(E,i._`"" + ${k}`).elseIf(i._`${k} === null`).assign(E,i._`""`);return;case"number":w.elseIf(i._`${R} == "boolean" || ${k} === null
463
+ `:""},this._extScope=I,this._scope=new r.Scope({parent:I}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(I){return this._scope.name(I)}scopeName(I){return this._extScope.name(I)}scopeValue(I,D){let O=this._extScope.value(I,D);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}getScopeValue(I,D){return this._extScope.getValue(I,D)}scopeRefs(I){return this._extScope.scopeRefs(I,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(I,D,O,j){let V=this._scope.toName(D);return O!==void 0&&j&&(this._constants[V.str]=O),this._leafNode(new o(I,V,O)),V}const(I,D,O){return this._def(r.varKinds.const,I,D,O)}let(I,D,O){return this._def(r.varKinds.let,I,D,O)}var(I,D,O){return this._def(r.varKinds.var,I,D,O)}assign(I,D,O){return this._leafNode(new a(I,D,O))}add(I,D){return this._leafNode(new u(I,e.operators.ADD,D))}code(I){return typeof I=="function"?I():I!==t.nil&&this._leafNode(new p(I)),this}object(...I){let D=["{"];for(let[O,j]of I)D.length>1&&D.push(","),D.push(O),(O!==j||this.opts.es5)&&(D.push(":"),(0,t.addCodeArg)(D,j));return D.push("}"),new t._Code(D)}if(I,D,O){if(this._blockNode(new _(I)),D&&O)this.code(D).else().code(O).endIf();else if(D)this.code(D).endIf();else if(O)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(I){return this._elseNode(new _(I))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(_,y)}_for(I,D){return this._blockNode(I),D&&this.code(D).endFor(),this}for(I,D){return this._for(new g(I),D)}forRange(I,D,O,j,V=this.opts.es5?r.varKinds.var:r.varKinds.let){let Y=this._scope.toName(I);return this._for(new m(V,Y,D,O),()=>j(Y))}forOf(I,D,O,j=r.varKinds.const){let V=this._scope.toName(I);if(this.opts.es5){let Y=D instanceof t.Name?D:this.var("_arr",D);return this.forRange("_i",0,t._`${Y}.length`,me=>{this.var(V,t._`${Y}[${me}]`),O(V)})}return this._for(new S("of",j,V,D),()=>O(V))}forIn(I,D,O,j=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(I,t._`Object.keys(${D})`,O);let V=this._scope.toName(I);return this._for(new S("in",j,V,D),()=>O(V))}endFor(){return this._endBlockNode(b)}label(I){return this._leafNode(new l(I))}break(I){return this._leafNode(new c(I))}return(I){let D=new k;if(this._blockNode(D),this.code(I),D.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(I,D,O){if(!D&&!O)throw Error('CodeGen: "try" without "catch" and "finally"');let j=new x;if(this._blockNode(j),this.code(I),D){let V=this.name("e");this._currNode=j.catch=new R(V),D(V)}return O&&(this._currNode=j.finally=new E,this.code(O)),this._endBlockNode(R,E)}throw(I){return this._leafNode(new d(I))}block(I,D){return this._blockStarts.push(this._nodes.length),I&&this.code(I).endBlock(D),this}endBlock(I){let D=this._blockStarts.pop();if(D===void 0)throw Error("CodeGen: not in self-balancing block");let O=this._nodes.length-D;if(O<0||I!==void 0&&O!==I)throw Error(`CodeGen: wrong number of nodes: ${O} vs ${I} expected`);return this._nodes.length=D,this}func(I,D=t.nil,O,j){return this._blockNode(new w(I,D,O)),j&&this.code(j).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(I=1){for(;I-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(I){return this._currNode.nodes.push(I),this}_blockNode(I){this._currNode.nodes.push(I),this._nodes.push(I)}_endBlockNode(I,D){let O=this._currNode;if(O instanceof I||D&&O instanceof D)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${D?`${I.kind}/${D.kind}`:I.kind}"`)}_elseNode(I){let D=this._currNode;if(!(D instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=D.else=I,this}get _root(){return this._nodes[0]}get _currNode(){let I=this._nodes;return I[I.length-1]}set _currNode(I){let D=this._nodes;D[D.length-1]=I}}e.CodeGen=P;function C(q,I){for(let D in I)q[D]=(q[D]||0)+(I[D]||0);return q}function $(q,I){return I instanceof t._CodeOrName?C(q,I.names):q}function N(q,I,D){if(q instanceof t.Name)return O(q);if(!j(q))return q;return new t._Code(q._items.reduce((V,Y)=>(Y instanceof t.Name&&(Y=O(Y)),Y instanceof t._Code?V.push(...Y._items):V.push(Y),V),[]));function O(V){let Y=D[V.str];return Y===void 0||I[V.str]!==1?V:(delete I[V.str],Y)}function j(V){return V instanceof t._Code&&V._items.some(Y=>Y instanceof t.Name&&I[Y.str]===1&&D[Y.str]!==void 0)}}function A(q,I){for(let D in I)q[D]=(q[D]||0)-(I[D]||0)}function W(q){return typeof q=="boolean"||typeof q=="number"||q===null?!q:t._`!${B(q)}`}e.not=W;var H=z(e.operators.AND);function te(...q){return q.reduce(H)}e.and=te;var ne=z(e.operators.OR);function Z(...q){return q.reduce(ne)}e.or=Z;function z(q){return(I,D)=>I===t.nil?D:D===t.nil?I:t._`${B(I)} ${q} ${B(D)}`}function B(q){return q instanceof t.Name?q:t._`(${q})`}}),Nt=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=ut(),r=uS();function n(w){let k={};for(let x of w)k[x]=!0;return k}e.toHash=n;function i(w,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(s(w,k),!o(k,w.self.RULES.all))}e.alwaysValidSchema=i;function s(w,k=w.schema){let{opts:x,self:R}=w;if(!x.strictSchema||typeof k=="boolean")return;let E=R.RULES.keywords;for(let P in k)E[P]||S(w,`unknown keyword: "${P}"`)}e.checkUnknownRules=s;function o(w,k){if(typeof w=="boolean")return!w;for(let x in w)if(k[x])return!0;return!1}e.schemaHasRules=o;function a(w,k){if(typeof w=="boolean")return!w;for(let x in w)if(x!=="$ref"&&k.all[x])return!0;return!1}e.schemaHasRulesButRef=a;function u({topSchemaRef:w,schemaPath:k},x,R,E){if(!E){if(typeof x=="number"||typeof x=="boolean")return x;if(typeof x=="string")return t._`${x}`}return t._`${w}${k}${(0,t.getProperty)(R)}`}e.schemaRefOrVal=u;function l(w){return p(decodeURIComponent(w))}e.unescapeFragment=l;function c(w){return encodeURIComponent(d(w))}e.escapeFragment=c;function d(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function p(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function f(w,k){if(Array.isArray(w))for(let x of w)k(x);else k(w)}e.eachItem=f;function h({mergeNames:w,mergeToName:k,mergeValues:x,resultToName:R}){return(E,P,C,$)=>{let N=C===void 0?P:C instanceof t.Name?(P instanceof t.Name?w(E,P,C):k(E,P,C),C):P instanceof t.Name?(k(E,C,P),P):x(P,C);return $===t.Name&&!(N instanceof t.Name)?R(E,N):N}}e.mergeEvaluated={props:h({mergeNames:(w,k,x)=>w.if(t._`${x} !== true && ${k} !== undefined`,()=>{w.if(t._`${k} === true`,()=>w.assign(x,!0),()=>w.assign(x,t._`${x} || {}`).code(t._`Object.assign(${x}, ${k})`))}),mergeToName:(w,k,x)=>w.if(t._`${x} !== true`,()=>{k===!0?w.assign(x,!0):(w.assign(x,t._`${x} || {}`),y(w,x,k))}),mergeValues:(w,k)=>w===!0?!0:{...w,...k},resultToName:v}),items:h({mergeNames:(w,k,x)=>w.if(t._`${x} !== true && ${k} !== undefined`,()=>w.assign(x,t._`${k} === true ? true : ${x} > ${k} ? ${x} : ${k}`)),mergeToName:(w,k,x)=>w.if(t._`${x} !== true`,()=>w.assign(x,k===!0?!0:t._`${x} > ${k} ? ${x} : ${k}`)),mergeValues:(w,k)=>w===!0?!0:Math.max(w,k),resultToName:(w,k)=>w.var("items",k)})};function v(w,k){if(k===!0)return w.var("props",!0);let x=w.var("props",t._`{}`);return k!==void 0&&y(w,x,k),x}e.evaluatedPropsToName=v;function y(w,k,x){Object.keys(x).forEach(R=>w.assign(t._`${k}${(0,t.getProperty)(R)}`,!0))}e.setEvaluated=y;var _={};function b(w,k){return w.scopeValue("func",{ref:k,code:_[k.code]||(_[k.code]=new r._Code(k.code))})}e.useFunc=b;var g;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(g||(e.Type=g={}));function m(w,k,x){if(w instanceof t.Name){let R=k===g.Num;return x?R?t._`"[" + ${w} + "]"`:t._`"['" + ${w} + "']"`:R?t._`"/" + ${w}`:t._`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return x?(0,t.getProperty)(w).toString():"/"+d(w)}e.getErrorPath=m;function S(w,k,x=w.opts.strictSchema){if(x){if(k=`strict mode: ${k}`,x===!0)throw Error(k);w.self.logger.warn(k)}}e.checkStrictMode=S}),xu=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),gS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=ut(),r=Nt(),n=xu();e.keywordError={message:({keyword:y})=>t.str`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:_})=>_?t.str`"${y}" keyword must be ${_} ($data)`:t.str`"${y}" keyword is invalid ($data)`};function i(y,_=e.keywordError,b,g){let{it:m}=y,{gen:S,compositeRule:w,allErrors:k}=m,x=d(y,_,b);g??(w||k)?u(S,x):l(m,t._`[${x}]`)}e.reportError=i;function s(y,_=e.keywordError,b){let{it:g}=y,{gen:m,compositeRule:S,allErrors:w}=g,k=d(y,_,b);u(m,k),!(S||w)&&l(g,n.default.vErrors)}e.reportExtraError=s;function o(y,_){y.assign(n.default.errors,_),y.if(t._`${n.default.vErrors} !== null`,()=>y.if(_,()=>y.assign(t._`${n.default.vErrors}.length`,_),()=>y.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function a({gen:y,keyword:_,schemaValue:b,data:g,errsCount:m,it:S}){if(m===void 0)throw Error("ajv implementation error");let w=y.name("err");y.forRange("i",m,n.default.errors,k=>{y.const(w,t._`${n.default.vErrors}[${k}]`),y.if(t._`${w}.instancePath === undefined`,()=>y.assign(t._`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,S.errorPath))),y.assign(t._`${w}.schemaPath`,t.str`${S.errSchemaPath}/${_}`),S.opts.verbose&&(y.assign(t._`${w}.schema`,b),y.assign(t._`${w}.data`,g))})}e.extendErrors=a;function u(y,_){let b=y.const("err",_);y.if(t._`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,t._`[${b}]`),t._`${n.default.vErrors}.push(${b})`),y.code(t._`${n.default.errors}++`)}function l(y,_){let{gen:b,validateName:g,schemaEnv:m}=y;m.$async?b.throw(t._`new ${y.ValidationError}(${_})`):(b.assign(t._`${g}.errors`,_),b.return(!1))}var c={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(y,_,b){let{createErrors:g}=y.it;return g===!1?t._`{}`:p(y,_,b)}function p(y,_,b={}){let{gen:g,it:m}=y,S=[f(m,b),h(y,b)];return v(y,_,S),g.object(...S)}function f({errorPath:y},{instancePath:_}){let b=_?t.str`${y}${(0,r.getErrorPath)(_,r.Type.Str)}`:y;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,b)]}function h({keyword:y,it:{errSchemaPath:_}},{schemaPath:b,parentSchema:g}){let m=g?_:t.str`${_}/${y}`;return b&&(m=t.str`${m}${(0,r.getErrorPath)(b,r.Type.Str)}`),[c.schemaPath,m]}function v(y,{params:_,message:b},g){let{keyword:m,data:S,schemaValue:w,it:k}=y,{opts:x,propertyName:R,topSchemaRef:E,schemaPath:P}=k;g.push([c.keyword,m],[c.params,typeof _=="function"?_(y):_||t._`{}`]),x.messages&&g.push([c.message,typeof b=="function"?b(y):b]),x.verbose&&g.push([c.schema,w],[c.parentSchema,t._`${E}${P}`],[n.default.data,S]),R&&g.push([c.propertyName,R])}}),i2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=gS(),r=ut(),n=xu(),i={message:"boolean schema is false"};function s(u){let{gen:l,schema:c,validateName:d}=u;c===!1?a(u,!1):typeof c=="object"&&c.$async===!0?l.return(n.default.data):(l.assign(r._`${d}.errors`,null),l.return(!0))}e.topBoolOrEmptySchema=s;function o(u,l){let{gen:c,schema:d}=u;d===!1?(c.var(l,!1),a(u)):c.var(l,!0)}e.boolOrEmptySchema=o;function a(u,l){let{gen:c,data:d}=u,p={gen:c,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:u};(0,t.reportError)(p,i,void 0,l)}}),zee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],r=new Set(t);function n(s){return typeof s=="string"&&r.has(s)}e.isJSONType=n;function i(){let s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=i}),Mee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:i,self:s},o){let a=s.RULES.types[o];return a&&a!==!0&&r(i,a)}e.schemaHasRulesForType=t;function r(i,s){return s.rules.some(o=>n(i,o))}e.shouldUseGroup=r;function n(i,s){var o;return i[s.keyword]!==void 0||((o=s.definition.implements)===null||o===void 0?void 0:o.some(a=>i[a]!==void 0))}e.shouldUseRule=n}),lS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=zee(),r=Mee(),n=gS(),i=ut(),s=Nt(),o;(function(g){g[g.Correct=0]="Correct",g[g.Wrong=1]="Wrong"})(o||(e.DataType=o={}));function a(g){let m=u(g.type);if(m.includes("null")){if(g.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!m.length&&g.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');g.nullable===!0&&m.push("null")}return m}e.getSchemaTypes=a;function u(g){let m=Array.isArray(g)?g:g?[g]:[];if(m.every(t.isJSONType))return m;throw Error("type must be JSONType or JSONType[]: "+m.join(","))}e.getJSONTypes=u;function l(g,m){let{gen:S,data:w,opts:k}=g,x=d(m,k.coerceTypes),R=m.length>0&&!(x.length===0&&m.length===1&&(0,r.schemaHasRulesForType)(g,m[0]));if(R){let E=v(m,w,k.strictNumbers,o.Wrong);S.if(E,()=>{x.length?p(g,m,x):_(g)})}return R}e.coerceAndCheckDataType=l;var c=new Set(["string","number","integer","boolean","null"]);function d(g,m){return m?g.filter(S=>c.has(S)||m==="array"&&S==="array"):[]}function p(g,m,S){let{gen:w,data:k,opts:x}=g,R=w.let("dataType",i._`typeof ${k}`),E=w.let("coerced",i._`undefined`);x.coerceTypes==="array"&&w.if(i._`${R} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>w.assign(k,i._`${k}[0]`).assign(R,i._`typeof ${k}`).if(v(m,k,x.strictNumbers),()=>w.assign(E,k))),w.if(i._`${E} !== undefined`);for(let C of S)(c.has(C)||C==="array"&&x.coerceTypes==="array")&&P(C);w.else(),_(g),w.endIf(),w.if(i._`${E} !== undefined`,()=>{w.assign(k,E),f(g,E)});function P(C){switch(C){case"string":w.elseIf(i._`${R} == "number" || ${R} == "boolean"`).assign(E,i._`"" + ${k}`).elseIf(i._`${k} === null`).assign(E,i._`""`);return;case"number":w.elseIf(i._`${R} == "boolean" || ${k} === null
464
464
  || (${R} == "string" && ${k} && ${k} == +${k})`).assign(E,i._`+${k}`);return;case"integer":w.elseIf(i._`${R} === "boolean" || ${k} === null
465
465
  || (${R} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(E,i._`+${k}`);return;case"boolean":w.elseIf(i._`${k} === "false" || ${k} === 0 || ${k} === null`).assign(E,!1).elseIf(i._`${k} === "true" || ${k} === 1`).assign(E,!0);return;case"null":w.elseIf(i._`${k} === "" || ${k} === 0 || ${k} === false`),w.assign(E,null);return;case"array":w.elseIf(i._`${R} === "string" || ${R} === "number"
466
- || ${R} === "boolean" || ${k} === null`).assign(E,i._`[${k}]`)}}}function f({gen:g,parentData:m,parentDataProperty:S},w){g.if(i._`${m} !== undefined`,()=>g.assign(i._`${m}[${S}]`,w))}function h(g,m,S,w=o.Correct){let k=w===o.Correct?i.operators.EQ:i.operators.NEQ,x;switch(g){case"null":return i._`${m} ${k} null`;case"array":x=i._`Array.isArray(${m})`;break;case"object":x=i._`${m} && typeof ${m} == "object" && !Array.isArray(${m})`;break;case"integer":x=R(i._`!(${m} % 1) && !isNaN(${m})`);break;case"number":x=R();break;default:return i._`typeof ${m} ${k} ${g}`}return w===o.Correct?x:(0,i.not)(x);function R(E=i.nil){return(0,i.and)(i._`typeof ${m} == "number"`,E,S?i._`isFinite(${m})`:i.nil)}}e.checkDataType=h;function v(g,m,S,w){if(g.length===1)return h(g[0],m,S,w);let k,x=(0,s.toHash)(g);if(x.array&&x.object){let R=i._`typeof ${m} != "object"`;k=x.null?R:i._`!${m} || ${R}`,delete x.null,delete x.array,delete x.object}else k=i.nil;x.number&&delete x.integer;for(let R in x)k=(0,i.and)(k,h(R,m,S,w));return k}e.checkDataTypes=v;var y={message:({schema:g})=>`must be ${g}`,params:({schema:g,schemaValue:m})=>typeof g=="string"?i._`{type: ${g}}`:i._`{type: ${m}}`};function _(g){let m=b(g);(0,n.reportError)(m,y)}e.reportTypeError=_;function b(g){let{gen:m,data:S,schema:w}=g,k=(0,s.schemaRefOrVal)(g,w,"type");return{gen:m,keyword:"type",data:S,schema:w.type,schemaCode:k,schemaValue:k,parentSchema:w,params:{},it:g}}}),s2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=ut(),r=Nt();function n(s,o){let{properties:a,items:u}=s.schema;if(o==="object"&&a)for(let l in a)i(s,l,a[l].default);else o==="array"&&Array.isArray(u)&&u.forEach((l,c)=>i(s,c,l.default))}e.assignDefaults=n;function i(s,o,a){let{gen:u,compositeRule:l,data:c,opts:d}=s;if(a===void 0)return;let p=t._`${c}${(0,t.getProperty)(o)}`;if(l){(0,r.checkStrictMode)(s,`default is ignored for: ${p}`);return}let f=t._`${p} === undefined`;d.useDefaults==="empty"&&(f=t._`${f} || ${p} === null || ${p} === ""`),u.if(f,t._`${p} = ${(0,t.stringify)(a)}`)}}),Zs=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=ut(),r=Nt(),n=xu(),i=Nt();function s(g,m){let{gen:S,data:w,it:k}=g;S.if(d(S,w,m,k.opts.ownProperties),()=>{g.setParams({missingProperty:t._`${m}`},!0),g.error()})}e.checkReportMissingProp=s;function o({gen:g,data:m,it:{opts:S}},w,k){return(0,t.or)(...w.map(x=>(0,t.and)(d(g,m,x,S.ownProperties),t._`${k} = ${x}`)))}e.checkMissingProp=o;function a(g,m){g.setParams({missingProperty:m},!0),g.error()}e.reportMissingProp=a;function u(g){return g.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=u;function l(g,m,S){return t._`${u(g)}.call(${m}, ${S})`}e.isOwnProperty=l;function c(g,m,S,w){let k=t._`${m}${(0,t.getProperty)(S)} !== undefined`;return w?t._`${k} && ${l(g,m,S)}`:k}e.propertyInData=c;function d(g,m,S,w){let k=t._`${m}${(0,t.getProperty)(S)} === undefined`;return w?(0,t.or)(k,(0,t.not)(l(g,m,S))):k}e.noPropertyInData=d;function p(g){return g?Object.keys(g).filter(m=>m!=="__proto__"):[]}e.allSchemaProperties=p;function f(g,m){return p(m).filter(S=>!(0,r.alwaysValidSchema)(g,m[S]))}e.schemaProperties=f;function h({schemaCode:g,data:m,it:{gen:S,topSchemaRef:w,schemaPath:k,errorPath:x},it:R},E,P,C){let $=C?t._`${g}, ${m}, ${w}${k}`:m,N=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,x)],[n.default.parentData,R.parentData],[n.default.parentDataProperty,R.parentDataProperty],[n.default.rootData,n.default.rootData]];R.opts.dynamicRef&&N.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let A=t._`${$}, ${S.object(...N)}`;return P!==t.nil?t._`${E}.call(${P}, ${A})`:t._`${E}(${A})`}e.callValidateCode=h;var v=t._`new RegExp`;function y({gen:g,it:{opts:m}},S){let w=m.unicodeRegExp?"u":"",{regExp:k}=m.code,x=k(S,w);return g.scopeValue("pattern",{key:x.toString(),ref:x,code:t._`${k.code==="new RegExp"?v:(0,i.useFunc)(g,k)}(${S}, ${w})`})}e.usePattern=y;function _(g){let{gen:m,data:S,keyword:w,it:k}=g,x=m.name("valid");if(k.allErrors){let E=m.let("valid",!0);return R(()=>m.assign(E,!1)),E}return m.var(x,!0),R(()=>m.break()),x;function R(E){let P=m.const("len",t._`${S}.length`);m.forRange("i",0,P,C=>{g.subschema({keyword:w,dataProp:C,dataPropType:r.Type.Num},x),m.if((0,t.not)(x),E)})}}e.validateArray=_;function b(g){let{gen:m,schema:S,keyword:w,it:k}=g;if(!Array.isArray(S))throw Error("ajv implementation error");if(S.some(E=>(0,r.alwaysValidSchema)(k,E))&&!k.opts.unevaluated)return;let x=m.let("valid",!1),R=m.name("_valid");m.block(()=>S.forEach((E,P)=>{let C=g.subschema({keyword:w,schemaProp:P,compositeRule:!0},R);m.assign(x,t._`${x} || ${R}`),!g.mergeValidEvaluated(C,R)&&m.if((0,t.not)(x))})),g.result(x,()=>g.reset(),()=>g.error(!0))}e.validateUnion=b}),o2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=ut(),r=xu(),n=Zs(),i=gS();function s(f,h){let{gen:v,keyword:y,schema:_,parentSchema:b,it:g}=f,m=h.macro.call(g.self,_,b,g),S=c(v,y,m);g.opts.validateSchema!==!1&&g.self.validateSchema(m,!0);let w=v.name("valid");f.subschema({schema:m,schemaPath:t.nil,errSchemaPath:`${g.errSchemaPath}/${y}`,topSchemaRef:S,compositeRule:!0},w),f.pass(w,()=>f.error(!0))}e.macroKeywordCode=s;function o(f,h){var v;let{gen:y,keyword:_,schema:b,parentSchema:g,$data:m,it:S}=f;l(S,h);let w=!m&&h.compile?h.compile.call(S.self,b,g,S):h.validate,k=c(y,_,w),x=y.let("valid");f.block$data(x,R),f.ok((v=h.valid)!==null&&v!==void 0?v:x);function R(){if(h.errors===!1)C(),h.modifying&&a(f),$(()=>f.error());else{let N=h.async?E():P();h.modifying&&a(f),$(()=>u(f,N))}}function E(){let N=y.let("ruleErrs",null);return y.try(()=>C(t._`await `),A=>y.assign(x,!1).if(t._`${A} instanceof ${S.ValidationError}`,()=>y.assign(N,t._`${A}.errors`),()=>y.throw(A))),N}function P(){let N=t._`${k}.errors`;return y.assign(N,null),C(t.nil),N}function C(N=h.async?t._`await `:t.nil){let A=S.opts.passContext?r.default.this:r.default.self,W=!("compile"in h&&!m||h.schema===!1);y.assign(x,t._`${N}${(0,n.callValidateCode)(f,k,A,W)}`,h.modifying)}function $(N){var A;y.if((0,t.not)((A=h.valid)!==null&&A!==void 0?A:x),N)}}e.funcKeywordCode=o;function a(f){let{gen:h,data:v,it:y}=f;h.if(y.parentData,()=>h.assign(v,t._`${y.parentData}[${y.parentDataProperty}]`))}function u(f,h){let{gen:v}=f;v.if(t._`Array.isArray(${h})`,()=>{v.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${h} : ${r.default.vErrors}.concat(${h})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,i.extendErrors)(f)},()=>f.error())}function l({schemaEnv:f},h){if(h.async&&!f.$async)throw Error("async keyword in sync schema")}function c(f,h,v){if(v===void 0)throw Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,t.stringify)(v)})}function d(f,h,v=!1){return!h.length||h.some(y=>y==="array"?Array.isArray(f):y==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==y||v&&typeof f>"u")}e.validSchemaType=d;function p({schema:f,opts:h,self:v,errSchemaPath:y},_,b){if(Array.isArray(_.keyword)?!_.keyword.includes(b):_.keyword!==b)throw Error("ajv implementation error");let g=_.dependencies;if(g?.some(m=>!Object.prototype.hasOwnProperty.call(f,m)))throw Error(`parent schema must have dependencies of ${b}: ${g.join(",")}`);if(_.validateSchema&&!_.validateSchema(f[b])){let m=`keyword "${b}" value is invalid at path "${y}": `+v.errorsText(_.validateSchema.errors);if(h.validateSchema==="log")v.logger.error(m);else throw Error(m)}}e.validateKeywordUsage=p}),a2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=ut(),r=Nt();function n(o,{keyword:a,schemaProp:u,schema:l,schemaPath:c,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&l!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let f=o.schema[a];return u===void 0?{schema:f,schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${a}`}:{schema:f[u],schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(u)}`,errSchemaPath:`${o.errSchemaPath}/${a}/${(0,r.escapeFragment)(u)}`}}if(l!==void 0){if(c===void 0||d===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:p,errSchemaPath:d}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function i(o,a,{dataProp:u,dataPropType:l,data:c,dataTypes:d,propertyName:p}){if(c!==void 0&&u!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=a;if(u!==void 0){let{errorPath:v,dataPathArr:y,opts:_}=a,b=f.let("data",t._`${a.data}${(0,t.getProperty)(u)}`,!0);h(b),o.errorPath=t.str`${v}${(0,r.getErrorPath)(u,l,_.jsPropertySyntax)}`,o.parentDataProperty=t._`${u}`,o.dataPathArr=[...y,o.parentDataProperty]}if(c!==void 0){let v=c instanceof t.Name?c:f.let("data",c,!0);h(v),p!==void 0&&(o.propertyName=p)}d&&(o.dataTypes=d);function h(v){o.data=v,o.dataLevel=a.dataLevel+1,o.dataTypes=[],a.definedProperties=new Set,o.parentData=a.data,o.dataNames=[...a.dataNames,v]}}e.extendSubschemaData=i;function s(o,{jtdDiscriminator:a,jtdMetadata:u,compositeRule:l,createErrors:c,allErrors:d}){l!==void 0&&(o.compositeRule=l),c!==void 0&&(o.createErrors=c),d!==void 0&&(o.allErrors=d),o.jtdDiscriminator=a,o.jtdMetadata=u}e.extendSubschemaMode=s}),Lee=be((e,t)=>{t.exports=function r(n,i){if(n===i)return!0;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(n.constructor!==i.constructor)return!1;var s,o,a;if(Array.isArray(n)){if(s=n.length,s!=i.length)return!1;for(o=s;o--!==0;)if(!r(n[o],i[o]))return!1;return!0}if(n.constructor===RegExp)return n.source===i.source&&n.flags===i.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===i.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===i.toString();if(a=Object.keys(n),s=a.length,s!==Object.keys(i).length)return!1;for(o=s;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,a[o]))return!1;for(o=s;o--!==0;){var u=a[o];if(!r(n[u],i[u]))return!1}return!0}return n!==n&&i!==i}}),u2e=be((e,t)=>{var r=t.exports=function(s,o,a){typeof o=="function"&&(a=o,o={}),a=o.cb||a;var u=typeof a=="function"?a:a.pre||function(){},l=a.post||function(){};n(o,u,l,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 n(s,o,a,u,l,c,d,p,f,h){if(u&&typeof u=="object"&&!Array.isArray(u)){o(u,l,c,d,p,f,h);for(var v in u){var y=u[v];if(Array.isArray(y)){if(v in r.arrayKeywords)for(var _=0;_<y.length;_++)n(s,o,a,y[_],l+"/"+v+"/"+_,c,l,v,u,_)}else if(v in r.propsKeywords){if(y&&typeof y=="object")for(var b in y)n(s,o,a,y[b],l+"/"+v+"/"+i(b),c,l,v,u,b)}else(v in r.keywords||s.allKeys&&!(v in r.skipKeywords))&&n(s,o,a,y,l+"/"+v,c,l,v,u)}a(u,l,c,d,p,f,h)}}function i(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),yS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Nt(),r=Lee(),n=u2e(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(y,_=!0){return typeof y=="boolean"?!0:_===!0?!a(y):_?u(y)<=_:!1}e.inlineRef=s;var o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(y){for(let _ in y){if(o.has(_))return!0;let b=y[_];if(Array.isArray(b)&&b.some(a)||typeof b=="object"&&a(b))return!0}return!1}function u(y){let _=0;for(let b in y){if(b==="$ref")return 1/0;if(_++,!i.has(b)&&(typeof y[b]=="object"&&(0,t.eachItem)(y[b],g=>_+=u(g)),_===1/0))return 1/0}return _}function l(y,_="",b){b!==!1&&(_=p(_));let g=y.parse(_);return c(y,g)}e.getFullPath=l;function c(y,_){return y.serialize(_).split("#")[0]+"#"}e._getFullPath=c;var d=/#\/?$/;function p(y){return y?y.replace(d,""):""}e.normalizeId=p;function f(y,_,b){return b=p(b),y.resolve(_,b)}e.resolveUrl=f;var h=/^[a-z_][-a-z0-9._]*$/i;function v(y,_){if(typeof y=="boolean")return{};let{schemaId:b,uriResolver:g}=this.opts,m=p(y[b]||_),S={"":m},w=l(g,m,!1),k={},x=new Set;return n(y,{allKeys:!0},(P,C,$,N)=>{if(N===void 0)return;let A=w+C,W=S[N];typeof P[b]=="string"&&(W=H.call(this,P[b])),re.call(this,P.$anchor),re.call(this,P.$dynamicAnchor),S[C]=W;function H(ne){let Z=this.opts.uriResolver.resolve;if(ne=p(W?Z(W,ne):ne),x.has(ne))throw E(ne);x.add(ne);let z=this.refs[ne];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?R(P,z.schema,ne):ne!==p(A)&&(ne[0]==="#"?(R(P,k[ne],ne),k[ne]=P):this.refs[ne]=A),ne}function re(ne){if(typeof ne=="string"){if(!h.test(ne))throw Error(`invalid anchor "${ne}"`);H.call(this,`#${ne}`)}}}),k;function R(P,C,$){if(C!==void 0&&!r(P,C))throw E($)}function E(P){return Error(`reference "${P}" resolves to more than one schema`)}}e.getSchemaRefs=v}),_S=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=i2e(),r=lS(),n=Mee(),i=lS(),s=s2e(),o=o2e(),a=a2e(),u=ut(),l=xu(),c=yS(),d=Nt(),p=gS();function f(F){if(w(F)&&(x(F),S(F))){_(F);return}h(F,()=>(0,t.topBoolOrEmptySchema)(F))}e.validateFunctionCode=f;function h({gen:F,validateName:M,schema:X,schemaEnv:ee,opts:he},Te){he.code.es5?F.func(M,u._`${l.default.data}, ${l.default.valCxt}`,ee.$async,()=>{F.code(u._`"use strict"; ${g(X,he)}`),y(F,he),F.code(Te)}):F.func(M,u._`${l.default.data}, ${v(he)}`,ee.$async,()=>F.code(g(X,he)).code(Te))}function v(F){return u._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${F.dynamicRef?u._`, ${l.default.dynamicAnchors}={}`:u.nil}}={}`}function y(F,M){F.if(l.default.valCxt,()=>{F.var(l.default.instancePath,u._`${l.default.valCxt}.${l.default.instancePath}`),F.var(l.default.parentData,u._`${l.default.valCxt}.${l.default.parentData}`),F.var(l.default.parentDataProperty,u._`${l.default.valCxt}.${l.default.parentDataProperty}`),F.var(l.default.rootData,u._`${l.default.valCxt}.${l.default.rootData}`),M.dynamicRef&&F.var(l.default.dynamicAnchors,u._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{F.var(l.default.instancePath,u._`""`),F.var(l.default.parentData,u._`undefined`),F.var(l.default.parentDataProperty,u._`undefined`),F.var(l.default.rootData,l.default.data),M.dynamicRef&&F.var(l.default.dynamicAnchors,u._`{}`)})}function _(F){let{schema:M,opts:X,gen:ee}=F;h(F,()=>{X.$comment&&M.$comment&&N(F),P(F),ee.let(l.default.vErrors,null),ee.let(l.default.errors,0),X.unevaluated&&b(F),R(F),A(F)})}function b(F){let{gen:M,validateName:X}=F;F.evaluated=M.const("evaluated",u._`${X}.evaluated`),M.if(u._`${F.evaluated}.dynamicProps`,()=>M.assign(u._`${F.evaluated}.props`,u._`undefined`)),M.if(u._`${F.evaluated}.dynamicItems`,()=>M.assign(u._`${F.evaluated}.items`,u._`undefined`))}function g(F,M){let X=typeof F=="object"&&F[M.schemaId];return X&&(M.code.source||M.code.process)?u._`/*# sourceURL=${X} */`:u.nil}function m(F,M){if(w(F)&&(x(F),S(F))){k(F,M);return}(0,t.boolOrEmptySchema)(F,M)}function S({schema:F,self:M}){if(typeof F=="boolean")return!F;for(let X in F)if(M.RULES.all[X])return!0;return!1}function w(F){return typeof F.schema!="boolean"}function k(F,M){let{schema:X,gen:ee,opts:he}=F;he.$comment&&X.$comment&&N(F),C(F),$(F);let Te=ee.const("_errs",l.default.errors);R(F,Te),ee.var(M,u._`${Te} === ${l.default.errors}`)}function x(F){(0,d.checkUnknownRules)(F),E(F)}function R(F,M){if(F.opts.jtd)return H(F,[],!1,M);let X=(0,r.getSchemaTypes)(F.schema),ee=(0,r.coerceAndCheckDataType)(F,X);H(F,X,!ee,M)}function E(F){let{schema:M,errSchemaPath:X,opts:ee,self:he}=F;M.$ref&&ee.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(M,he.RULES)&&he.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function P(F){let{schema:M,opts:X}=F;M.default!==void 0&&X.useDefaults&&X.strictSchema&&(0,d.checkStrictMode)(F,"default is ignored in the schema root")}function C(F){let M=F.schema[F.opts.schemaId];M&&(F.baseId=(0,c.resolveUrl)(F.opts.uriResolver,F.baseId,M))}function $(F){if(F.schema.$async&&!F.schemaEnv.$async)throw Error("async schema in sync schema")}function N({gen:F,schemaEnv:M,schema:X,errSchemaPath:ee,opts:he}){let Te=X.$comment;if(he.$comment===!0)F.code(u._`${l.default.self}.logger.log(${Te})`);else if(typeof he.$comment=="function"){let ze=u.str`${ee}/$comment`,_t=F.scopeValue("root",{ref:M.root});F.code(u._`${l.default.self}.opts.$comment(${Te}, ${ze}, ${_t}.schema)`)}}function A(F){let{gen:M,schemaEnv:X,validateName:ee,ValidationError:he,opts:Te}=F;X.$async?M.if(u._`${l.default.errors} === 0`,()=>M.return(l.default.data),()=>M.throw(u._`new ${he}(${l.default.vErrors})`)):(M.assign(u._`${ee}.errors`,l.default.vErrors),Te.unevaluated&&W(F),M.return(u._`${l.default.errors} === 0`))}function W({gen:F,evaluated:M,props:X,items:ee}){X instanceof u.Name&&F.assign(u._`${M}.props`,X),ee instanceof u.Name&&F.assign(u._`${M}.items`,ee)}function H(F,M,X,ee){let{gen:he,schema:Te,data:ze,allErrors:_t,opts:Ot,self:jt}=F,{RULES:ft}=jt;if(Te.$ref&&(Ot.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(Te,ft))){he.block(()=>V(F,"$ref",ft.all.$ref.definition));return}Ot.jtd||ne(F,M),he.block(()=>{for(let it of ft.rules)ni(it);ni(ft.post)});function ni(it){(0,n.shouldUseGroup)(Te,it)&&(it.type?(he.if((0,i.checkDataType)(it.type,ze,Ot.strictNumbers)),re(F,it),M.length===1&&M[0]===it.type&&X&&(he.else(),(0,i.reportTypeError)(F)),he.endIf()):re(F,it),_t||he.if(u._`${l.default.errors} === ${ee||0}`))}}function re(F,M){let{gen:X,schema:ee,opts:{useDefaults:he}}=F;he&&(0,s.assignDefaults)(F,M.type),X.block(()=>{for(let Te of M.rules)(0,n.shouldUseRule)(ee,Te)&&V(F,Te.keyword,Te.definition,M.type)})}function ne(F,M){F.schemaEnv.meta||!F.opts.strictTypes||(Z(F,M),!F.opts.allowUnionTypes&&z(F,M),B(F,F.dataTypes))}function Z(F,M){if(M.length){if(!F.dataTypes.length){F.dataTypes=M;return}M.forEach(X=>{I(F.dataTypes,X)||O(F,`type "${X}" not allowed by context "${F.dataTypes.join(",")}"`)}),D(F,M)}}function z(F,M){M.length>1&&!(M.length===2&&M.includes("null"))&&O(F,"use allowUnionTypes to allow union type keyword")}function B(F,M){let X=F.self.RULES.all;for(let ee in X){let he=X[ee];if(typeof he=="object"&&(0,n.shouldUseRule)(F.schema,he)){let{type:Te}=he.definition;Te.length&&!Te.some(ze=>q(M,ze))&&O(F,`missing type "${Te.join(",")}" for keyword "${ee}"`)}}}function q(F,M){return F.includes(M)||M==="number"&&F.includes("integer")}function I(F,M){return F.includes(M)||M==="integer"&&F.includes("number")}function D(F,M){let X=[];for(let ee of F.dataTypes)I(M,ee)?X.push(ee):M.includes("integer")&&ee==="number"&&X.push("integer");F.dataTypes=X}function O(F,M){let X=F.schemaEnv.baseId+F.errSchemaPath;M+=` at "${X}" (strictTypes)`,(0,d.checkStrictMode)(F,M,F.opts.strictTypes)}class j{constructor(M,X,ee){if((0,o.validateKeywordUsage)(M,X,ee),this.gen=M.gen,this.allErrors=M.allErrors,this.keyword=ee,this.data=M.data,this.schema=M.schema[ee],this.$data=X.$data&&M.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(M,this.schema,ee,this.$data),this.schemaType=X.schemaType,this.parentSchema=M.schema,this.params={},this.it=M,this.def=X,this.$data)this.schemaCode=M.gen.const("vSchema",Ce(this.$data,M));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${ee} value must be ${JSON.stringify(X.schemaType)}`);("code"in X?X.trackErrors:X.errors!==!1)&&(this.errsCount=M.gen.const("_errs",l.default.errors))}result(M,X,ee){this.failResult((0,u.not)(M),X,ee)}failResult(M,X,ee){this.gen.if(M),ee?ee():this.error(),X?(this.gen.else(),X(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(M,X){this.failResult((0,u.not)(M),void 0,X)}fail(M){if(M===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(M),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(M){if(!this.$data)return this.fail(M);let{schemaCode:X}=this;this.fail(u._`${X} !== undefined && (${(0,u.or)(this.invalid$data(),M)})`)}error(M,X,ee){if(X){this.setParams(X),this._error(M,ee),this.setParams({});return}this._error(M,ee)}_error(M,X){(M?p.reportExtraError:p.reportError)(this,this.def.error,X)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(M){this.allErrors||this.gen.if(M)}setParams(M,X){X?Object.assign(this.params,M):this.params=M}block$data(M,X,ee=u.nil){this.gen.block(()=>{this.check$data(M,ee),X()})}check$data(M=u.nil,X=u.nil){if(!this.$data)return;let{gen:ee,schemaCode:he,schemaType:Te,def:ze}=this;ee.if((0,u.or)(u._`${he} === undefined`,X)),M!==u.nil&&ee.assign(M,!0),(Te.length||ze.validateSchema)&&(ee.elseIf(this.invalid$data()),this.$dataError(),M!==u.nil&&ee.assign(M,!1)),ee.else()}invalid$data(){let{gen:M,schemaCode:X,schemaType:ee,def:he,it:Te}=this;return(0,u.or)(ze(),_t());function ze(){if(ee.length){if(!(X instanceof u.Name))throw Error("ajv implementation error");let Ot=Array.isArray(ee)?ee:[ee];return u._`${(0,i.checkDataTypes)(Ot,X,Te.opts.strictNumbers,i.DataType.Wrong)}`}return u.nil}function _t(){if(he.validateSchema){let Ot=M.scopeValue("validate$data",{ref:he.validateSchema});return u._`!${Ot}(${X})`}return u.nil}}subschema(M,X){let ee=(0,a.getSubschema)(this.it,M);(0,a.extendSubschemaData)(ee,this.it,M),(0,a.extendSubschemaMode)(ee,M);let he={...this.it,...ee,items:void 0,props:void 0};return m(he,X),he}mergeEvaluated(M,X){let{it:ee,gen:he}=this;ee.opts.unevaluated&&(ee.props!==!0&&M.props!==void 0&&(ee.props=d.mergeEvaluated.props(he,M.props,ee.props,X)),ee.items!==!0&&M.items!==void 0&&(ee.items=d.mergeEvaluated.items(he,M.items,ee.items,X)))}mergeValidEvaluated(M,X){let{it:ee,gen:he}=this;if(ee.opts.unevaluated&&(ee.props!==!0||ee.items!==!0))return he.if(X,()=>this.mergeEvaluated(M,u.Name)),!0}}e.KeywordCxt=j;function V(F,M,X,ee){let he=new j(F,X,M);"code"in X?X.code(he,ee):he.$data&&X.validate?(0,o.funcKeywordCode)(he,X):"macro"in X?(0,o.macroKeywordCode)(he,X):(X.compile||X.validate)&&(0,o.funcKeywordCode)(he,X)}var Y=/^\/(?:[^~]|~0|~1)*$/,me=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ce(F,{dataLevel:M,dataNames:X,dataPathArr:ee}){let he,Te;if(F==="")return l.default.rootData;if(F[0]==="/"){if(!Y.test(F))throw Error(`Invalid JSON-pointer: ${F}`);he=F,Te=l.default.rootData}else{let jt=me.exec(F);if(!jt)throw Error(`Invalid JSON-pointer: ${F}`);let ft=+jt[1];if(he=jt[2],he==="#"){if(ft>=M)throw Error(Ot("property/index",ft));return ee[M-ft]}if(ft>M)throw Error(Ot("data",ft));if(Te=X[M-ft],!he)return Te}let ze=Te,_t=he.split("/");for(let jt of _t)jt&&(Te=u._`${Te}${(0,u.getProperty)((0,d.unescapeJsonPointer)(jt))}`,ze=u._`${ze} && ${Te}`);return ze;function Ot(jt,ft){return`Cannot access ${jt} ${ft} levels up, current level is ${M}`}}e.getData=Ce}),cD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}e.default=t}),vS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yS();class r extends Error{constructor(i,s,o,a){super(a||`can't resolve reference ${o} from id ${s}`),this.missingRef=(0,t.resolveUrl)(i,s,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(i,this.missingRef))}}e.default=r}),dD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=ut(),r=cD(),n=xu(),i=yS(),s=Nt(),o=_S();class a{constructor(b){var g;this.refs={},this.dynamicAnchors={};let m;typeof b.schema=="object"&&(m=b.schema),this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(g=b.baseId)!==null&&g!==void 0?g:(0,i.normalizeId)(m?.[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=m?.$async,this.refs={}}}e.SchemaEnv=a;function u(_){let b=d.call(this,_);if(b)return b;let g=(0,i.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:m,lines:S}=this.opts.code,{ownProperties:w}=this.opts,k=new t.CodeGen(this.scope,{es5:m,lines:S,ownProperties:w}),x;_.$async&&(x=k.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));let R=k.scopeName("validate");_.validateName=R;let E={gen:k,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:k.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,t.stringify)(_.schema)}:{ref:_.schema}),validateName:R,ValidationError:x,schema:_.schema,schemaEnv:_,rootId:g,baseId:_.baseId||g,schemaPath:t.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},P;try{this._compilations.add(_),(0,o.validateFunctionCode)(E),k.optimize(this.opts.code.optimize);let C=k.toString();P=`${k.scopeRefs(n.default.scope)}return ${C}`,this.opts.code.process&&(P=this.opts.code.process(P,_));let $=Function(`${n.default.self}`,`${n.default.scope}`,P)(this,this.scope.get());if(this.scope.value(R,{ref:$}),$.errors=null,$.schema=_.schema,$.schemaEnv=_,_.$async&&($.$async=!0),this.opts.code.source===!0&&($.source={validateName:R,validateCode:C,scopeValues:k._values}),this.opts.unevaluated){let{props:N,items:A}=E;$.evaluated={props:N instanceof t.Name?void 0:N,items:A instanceof t.Name?void 0:A,dynamicProps:N instanceof t.Name,dynamicItems:A instanceof t.Name},$.source&&($.source.evaluated=(0,t.stringify)($.evaluated))}return _.validate=$,_}catch(C){throw delete _.validate,delete _.validateName,P&&this.logger.error("Error compiling schema, function code:",P),C}finally{this._compilations.delete(_)}}e.compileSchema=u;function l(_,b,g){var m;g=(0,i.resolveUrl)(this.opts.uriResolver,b,g);let S=_.refs[g];if(S)return S;let w=f.call(this,_,g);if(w===void 0){let k=(m=_.localRefs)===null||m===void 0?void 0:m[g],{schemaId:x}=this.opts;k&&(w=new a({schema:k,schemaId:x,root:_,baseId:b}))}if(w!==void 0)return _.refs[g]=c.call(this,w)}e.resolveRef=l;function c(_){return(0,i.inlineRef)(_.schema,this.opts.inlineRefs)?_.schema:_.validate?_:u.call(this,_)}function d(_){for(let b of this._compilations)if(p(b,_))return b}e.getCompilingSchema=d;function p(_,b){return _.schema===b.schema&&_.root===b.root&&_.baseId===b.baseId}function f(_,b){let g;for(;typeof(g=this.refs[b])=="string";)b=g;return g||this.schemas[b]||h.call(this,_,b)}function h(_,b){let g=this.opts.uriResolver.parse(b),m=(0,i._getFullPath)(this.opts.uriResolver,g),S=(0,i.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&m===S)return y.call(this,g,_);let w=(0,i.normalizeId)(m),k=this.refs[w]||this.schemas[w];if(typeof k=="string"){let x=h.call(this,_,k);return typeof x?.schema!="object"?void 0:y.call(this,g,x)}if(typeof k?.schema=="object"){if(k.validate||u.call(this,k),w===(0,i.normalizeId)(b)){let{schema:x}=k,{schemaId:R}=this.opts,E=x[R];return E&&(S=(0,i.resolveUrl)(this.opts.uriResolver,S,E)),new a({schema:x,schemaId:R,root:_,baseId:S})}return y.call(this,g,k)}}e.resolveSchema=h;var v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(_,{baseId:b,schema:g,root:m}){var S;if(((S=_.fragment)===null||S===void 0?void 0:S[0])!=="/")return;for(let x of _.fragment.slice(1).split("/")){if(typeof g=="boolean")return;let R=g[(0,s.unescapeFragment)(x)];if(R===void 0)return;g=R;let E=typeof g=="object"&&g[this.opts.schemaId];!v.has(x)&&E&&(b=(0,i.resolveUrl)(this.opts.uriResolver,b,E))}let w;if(typeof g!="boolean"&&g.$ref&&!(0,s.schemaHasRulesButRef)(g,this.RULES)){let x=(0,i.resolveUrl)(this.opts.uriResolver,b,g.$ref);w=h.call(this,m,x)}let{schemaId:k}=this.opts;if(w=w||new a({schema:g,schemaId:k,root:m,baseId:b}),w.schema!==w.root.schema)return w}}),l2e=be((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),c2e=be((e,t)=>{var r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t.exports={HEX:r}}),d2e=be((e,t)=>{var{HEX:r}=c2e(),n=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function i(_){if(l(_,".")<3)return{host:_,isIPV4:!1};let b=_.match(n)||[],[g]=b;return g?{host:u(g,"."),isIPV4:!0}:{host:_,isIPV4:!1}}function s(_,b=!1){let g="",m=!0;for(let S of _){if(r[S]===void 0)return;S!=="0"&&m===!0&&(m=!1),m||(g+=S)}return b&&g.length===0&&(g="0"),g}function o(_){let b=0,g={error:!1,address:"",zone:""},m=[],S=[],w=!1,k=!1,x=!1;function R(){if(S.length){if(w===!1){let E=s(S);if(E!==void 0)m.push(E);else return g.error=!0,!1}S.length=0}return!0}for(let E=0;E<_.length;E++){let P=_[E];if(!(P==="["||P==="]"))if(P===":"){if(k===!0&&(x=!0),!R())break;if(b++,m.push(":"),b>7){g.error=!0;break}E-1>=0&&_[E-1]===":"&&(k=!0);continue}else if(P==="%"){if(!R())break;w=!0}else{S.push(P);continue}}return S.length&&(w?g.zone=S.join(""):x?m.push(S.join("")):m.push(s(S))),g.address=m.join(""),g}function a(_){if(l(_,":")<2)return{host:_,isIPV6:!1};let b=o(_);if(b.error)return{host:_,isIPV6:!1};{let{address:g,address:m}=b;return b.zone&&(g+="%"+b.zone,m+="%25"+b.zone),{host:g,escapedHost:m,isIPV6:!0}}}function u(_,b){let g="",m=!0,S=_.length;for(let w=0;w<S;w++){let k=_[w];k==="0"&&m?(w+1<=S&&_[w+1]===b||w+1===S)&&(g+=k,m=!1):(k===b?m=!0:m=!1,g+=k)}return g}function l(_,b){let g=0;for(let m=0;m<_.length;m++)_[m]===b&&g++;return g}var c=/^\.\.?\//u,d=/^\/\.(?:\/|$)/u,p=/^\/\.\.(?:\/|$)/u,f=/^\/?(?:.|\n)*?(?=\/|$)/u;function h(_){let b=[];for(;_.length;)if(_.match(c))_=_.replace(c,"");else if(_.match(d))_=_.replace(d,"/");else if(_.match(p))_=_.replace(p,"/"),b.pop();else if(_==="."||_==="..")_="";else{let g=_.match(f);if(g){let m=g[0];_=_.slice(m.length),b.push(m)}else throw Error("Unexpected dot segment condition")}return b.join("")}function v(_,b){let g=b!==!0?escape:unescape;return _.scheme!==void 0&&(_.scheme=g(_.scheme)),_.userinfo!==void 0&&(_.userinfo=g(_.userinfo)),_.host!==void 0&&(_.host=g(_.host)),_.path!==void 0&&(_.path=g(_.path)),_.query!==void 0&&(_.query=g(_.query)),_.fragment!==void 0&&(_.fragment=g(_.fragment)),_}function y(_){let b=[];if(_.userinfo!==void 0&&(b.push(_.userinfo),b.push("@")),_.host!==void 0){let g=unescape(_.host),m=i(g);if(m.isIPV4)g=m.host;else{let S=a(m.host);S.isIPV6===!0?g=`[${S.escapedHost}]`:g=_.host}b.push(g)}return(typeof _.port=="number"||typeof _.port=="string")&&(b.push(":"),b.push(String(_.port))),b.length?b.join(""):void 0}t.exports={recomposeAuthority:y,normalizeComponentEncoding:v,removeDotSegments:h,normalizeIPv4:i,normalizeIPv6:a,stringArrayToHexStripped:s}}),f2e=be((e,t)=>{var r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function i(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}function s(m){return m.host||(m.error=m.error||"HTTP URIs must have a host."),m}function o(m){let S=String(m.scheme).toLowerCase()==="https";return(m.port===(S?443:80)||m.port==="")&&(m.port=void 0),m.path||(m.path="/"),m}function a(m){return m.secure=i(m),m.resourceName=(m.path||"/")+(m.query?"?"+m.query:""),m.path=void 0,m.query=void 0,m}function u(m){if((m.port===(i(m)?443:80)||m.port==="")&&(m.port=void 0),typeof m.secure=="boolean"&&(m.scheme=m.secure?"wss":"ws",m.secure=void 0),m.resourceName){let[S,w]=m.resourceName.split("?");m.path=S&&S!=="/"?S:void 0,m.query=w,m.resourceName=void 0}return m.fragment=void 0,m}function l(m,S){if(!m.path)return m.error="URN can not be parsed",m;let w=m.path.match(n);if(w){let k=S.scheme||m.scheme||"urn";m.nid=w[1].toLowerCase(),m.nss=w[2];let x=`${k}:${S.nid||m.nid}`,R=g[x];m.path=void 0,R&&(m=R.parse(m,S))}else m.error=m.error||"URN can not be parsed.";return m}function c(m,S){let w=S.scheme||m.scheme||"urn",k=m.nid.toLowerCase(),x=`${w}:${S.nid||k}`,R=g[x];R&&(m=R.serialize(m,S));let E=m,P=m.nss;return E.path=`${k||S.nid}:${P}`,S.skipEscape=!0,E}function d(m,S){let w=m;return w.uuid=w.nss,w.nss=void 0,!S.tolerant&&(!w.uuid||!r.test(w.uuid))&&(w.error=w.error||"UUID is not valid."),w}function p(m){let S=m;return S.nss=(m.uuid||"").toLowerCase(),S}var f={scheme:"http",domainHost:!0,parse:s,serialize:o},h={scheme:"https",domainHost:f.domainHost,parse:s,serialize:o},v={scheme:"ws",domainHost:!0,parse:a,serialize:u},y={scheme:"wss",domainHost:v.domainHost,parse:v.parse,serialize:v.serialize},_={scheme:"urn",parse:l,serialize:c,skipNormalize:!0},b={scheme:"urn:uuid",parse:d,serialize:p,skipNormalize:!0},g={http:f,https:h,ws:v,wss:y,urn:_,"urn:uuid":b};t.exports=g}),p2e=be((e,t)=>{var{normalizeIPv6:r,normalizeIPv4:n,removeDotSegments:i,recomposeAuthority:s,normalizeComponentEncoding:o}=d2e(),a=f2e();function u(b,g){return typeof b=="string"?b=p(y(b,g),g):typeof b=="object"&&(b=y(p(b,g),g)),b}function l(b,g,m){let S=Object.assign({scheme:"null"},m),w=c(y(b,S),y(g,S),S,!0);return p(w,{...S,skipEscape:!0})}function c(b,g,m,S){let w={};return S||(b=y(p(b,m),m),g=y(p(g,m),m)),m=m||{},!m.tolerant&&g.scheme?(w.scheme=g.scheme,w.userinfo=g.userinfo,w.host=g.host,w.port=g.port,w.path=i(g.path||""),w.query=g.query):(g.userinfo!==void 0||g.host!==void 0||g.port!==void 0?(w.userinfo=g.userinfo,w.host=g.host,w.port=g.port,w.path=i(g.path||""),w.query=g.query):(g.path?(g.path.charAt(0)==="/"?w.path=i(g.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?w.path="/"+g.path:b.path?w.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+g.path:w.path=g.path,w.path=i(w.path)),w.query=g.query):(w.path=b.path,g.query!==void 0?w.query=g.query:w.query=b.query),w.userinfo=b.userinfo,w.host=b.host,w.port=b.port),w.scheme=b.scheme),w.fragment=g.fragment,w}function d(b,g,m){return typeof b=="string"?(b=unescape(b),b=p(o(y(b,m),!0),{...m,skipEscape:!0})):typeof b=="object"&&(b=p(o(b,!0),{...m,skipEscape:!0})),typeof g=="string"?(g=unescape(g),g=p(o(y(g,m),!0),{...m,skipEscape:!0})):typeof g=="object"&&(g=p(o(g,!0),{...m,skipEscape:!0})),b.toLowerCase()===g.toLowerCase()}function p(b,g){let m={host:b.host,scheme:b.scheme,userinfo:b.userinfo,port:b.port,path:b.path,query:b.query,nid:b.nid,nss:b.nss,uuid:b.uuid,fragment:b.fragment,reference:b.reference,resourceName:b.resourceName,secure:b.secure,error:""},S=Object.assign({},g),w=[],k=a[(S.scheme||m.scheme||"").toLowerCase()];k&&k.serialize&&k.serialize(m,S),m.path!==void 0&&(S.skipEscape?m.path=unescape(m.path):(m.path=escape(m.path),m.scheme!==void 0&&(m.path=m.path.split("%3A").join(":")))),S.reference!=="suffix"&&m.scheme&&w.push(m.scheme,":");let x=s(m);if(x!==void 0&&(S.reference!=="suffix"&&w.push("//"),w.push(x),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){let R=m.path;!S.absolutePath&&(!k||!k.absolutePath)&&(R=i(R)),x===void 0&&(R=R.replace(/^\/\//u,"/%2F")),w.push(R)}return m.query!==void 0&&w.push("?",m.query),m.fragment!==void 0&&w.push("#",m.fragment),w.join("")}var f=Array.from({length:127},(b,g)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(g)));function h(b){let g=0;for(let m=0,S=b.length;m<S;++m)if(g=b.charCodeAt(m),g>126||f[g])return!0;return!1}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(b,g){let m=Object.assign({},g),S={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},w=b.indexOf("%")!==-1,k=!1;m.reference==="suffix"&&(b=(m.scheme?m.scheme+":":"")+"//"+b);let x=b.match(v);if(x){if(S.scheme=x[1],S.userinfo=x[3],S.host=x[4],S.port=parseInt(x[5],10),S.path=x[6]||"",S.query=x[7],S.fragment=x[8],isNaN(S.port)&&(S.port=x[5]),S.host){let E=n(S.host);if(E.isIPV4===!1){let P=r(E.host);S.host=P.host.toLowerCase(),k=P.isIPV6}else S.host=E.host,k=!0}S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&S.query===void 0&&!S.path?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",m.reference&&m.reference!=="suffix"&&m.reference!==S.reference&&(S.error=S.error||"URI is not a "+m.reference+" reference.");let R=a[(m.scheme||S.scheme||"").toLowerCase()];if(!m.unicodeSupport&&(!R||!R.unicodeSupport)&&S.host&&(m.domainHost||R&&R.domainHost)&&k===!1&&h(S.host))try{S.host=URL.domainToASCII(S.host.toLowerCase())}catch(E){S.error=S.error||"Host's domain name can not be converted to ASCII: "+E}(!R||R&&!R.skipNormalize)&&(w&&S.scheme!==void 0&&(S.scheme=unescape(S.scheme)),w&&S.host!==void 0&&(S.host=unescape(S.host)),S.path&&(S.path=escape(unescape(S.path))),S.fragment&&(S.fragment=encodeURI(decodeURIComponent(S.fragment)))),R&&R.parse&&R.parse(S,m)}else S.error=S.error||"URI can not be parsed.";return S}var _={SCHEMES:a,normalize:u,resolve:l,resolveComponents:c,equal:d,serialize:p,parse:y};t.exports=_,t.exports.default=_,t.exports.fastUri=_}),h2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=p2e();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),m2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=_S();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ut();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var n=cD(),i=vS(),s=zee(),o=dD(),a=ut(),u=yS(),l=lS(),c=Nt(),d=l2e(),p=h2e(),f=(Z,z)=>new RegExp(Z,z);f.code="new RegExp";var h=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},b=200;function g(Z){var z,B,q,I,D,O,j,V,Y,me,Ce,F,M,X,ee,he,Te,ze,_t,Ot,jt,ft,ni,it,Ia;let Oa=Z.strict,nr=(z=Z.code)===null||z===void 0?void 0:z.optimize,ii=nr===!0||nr===void 0?1:nr||0,RF=(q=(B=Z.code)===null||B===void 0?void 0:B.regExp)!==null&&q!==void 0?q:f,Bi=(I=Z.uriResolver)!==null&&I!==void 0?I:p.default;return{strictSchema:(O=(D=Z.strictSchema)!==null&&D!==void 0?D:Oa)!==null&&O!==void 0?O:!0,strictNumbers:(V=(j=Z.strictNumbers)!==null&&j!==void 0?j:Oa)!==null&&V!==void 0?V:!0,strictTypes:(me=(Y=Z.strictTypes)!==null&&Y!==void 0?Y:Oa)!==null&&me!==void 0?me:"log",strictTuples:(F=(Ce=Z.strictTuples)!==null&&Ce!==void 0?Ce:Oa)!==null&&F!==void 0?F:"log",strictRequired:(X=(M=Z.strictRequired)!==null&&M!==void 0?M:Oa)!==null&&X!==void 0?X:!1,code:Z.code?{...Z.code,optimize:ii,regExp:RF}:{optimize:ii,regExp:RF},loopRequired:(ee=Z.loopRequired)!==null&&ee!==void 0?ee:b,loopEnum:(he=Z.loopEnum)!==null&&he!==void 0?he:b,meta:(Te=Z.meta)!==null&&Te!==void 0?Te:!0,messages:(ze=Z.messages)!==null&&ze!==void 0?ze:!0,inlineRefs:(_t=Z.inlineRefs)!==null&&_t!==void 0?_t:!0,schemaId:(Ot=Z.schemaId)!==null&&Ot!==void 0?Ot:"$id",addUsedSchema:(jt=Z.addUsedSchema)!==null&&jt!==void 0?jt:!0,validateSchema:(ft=Z.validateSchema)!==null&&ft!==void 0?ft:!0,validateFormats:(ni=Z.validateFormats)!==null&&ni!==void 0?ni:!0,unicodeRegExp:(it=Z.unicodeRegExp)!==null&&it!==void 0?it:!0,int32range:(Ia=Z.int32range)!==null&&Ia!==void 0?Ia:!0,uriResolver:Bi}}class m{constructor(z={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,z=this.opts={...z,...g(z)};let{es5:B,lines:q}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:v,es5:B,lines:q}),this.logger=C(z.logger);let I=z.validateFormats;z.validateFormats=!1,this.RULES=(0,s.getRules)(),S.call(this,y,z,"NOT SUPPORTED"),S.call(this,_,z,"DEPRECATED","warn"),this._metaOpts=E.call(this),z.formats&&x.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),z.keywords&&R.call(this,z.keywords),typeof z.meta=="object"&&this.addMetaSchema(z.meta),k.call(this),z.validateFormats=I}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:z,meta:B,schemaId:q}=this.opts,I=d;q==="id"&&(I={...d},I.id=I.$id,delete I.$id),B&&z&&this.addMetaSchema(I,I[q],!1)}defaultMeta(){let{meta:z,schemaId:B}=this.opts;return this.opts.defaultMeta=typeof z=="object"?z[B]||z:void 0}validate(z,B){let q;if(typeof z=="string"){if(q=this.getSchema(z),!q)throw Error(`no schema with key or ref "${z}"`)}else q=this.compile(z);let I=q(B);return"$async"in q||(this.errors=q.errors),I}compile(z,B){let q=this._addSchema(z,B);return q.validate||this._compileSchemaEnv(q)}compileAsync(z,B){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:q}=this.opts;return I.call(this,z,B);async function I(me,Ce){await D.call(this,me.$schema);let F=this._addSchema(me,Ce);return F.validate||O.call(this,F)}async function D(me){me&&!this.getSchema(me)&&await I.call(this,{$ref:me},!0)}async function O(me){try{return this._compileSchemaEnv(me)}catch(Ce){if(!(Ce instanceof i.default))throw Ce;return j.call(this,Ce),await V.call(this,Ce.missingSchema),O.call(this,me)}}function j({missingSchema:me,missingRef:Ce}){if(this.refs[me])throw Error(`AnySchema ${me} is loaded but ${Ce} cannot be resolved`)}async function V(me){let Ce=await Y.call(this,me);this.refs[me]||await D.call(this,Ce.$schema),this.refs[me]||this.addSchema(Ce,me,B)}async function Y(me){let Ce=this._loading[me];if(Ce)return Ce;try{return await(this._loading[me]=q(me))}finally{delete this._loading[me]}}}addSchema(z,B,q,I=this.opts.validateSchema){if(Array.isArray(z)){for(let O of z)this.addSchema(O,void 0,q,I);return this}let D;if(typeof z=="object"){let{schemaId:O}=this.opts;if(D=z[O],D!==void 0&&typeof D!="string")throw Error(`schema ${O} must be string`)}return B=(0,u.normalizeId)(B||D),this._checkUnique(B),this.schemas[B]=this._addSchema(z,q,B,I,!0),this}addMetaSchema(z,B,q=this.opts.validateSchema){return this.addSchema(z,B,!0,q),this}validateSchema(z,B){if(typeof z=="boolean")return!0;let q;if(q=z.$schema,q!==void 0&&typeof q!="string")throw Error("$schema must be a string");if(q=q||this.opts.defaultMeta||this.defaultMeta(),!q)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let I=this.validate(q,z);if(!I&&B){let D="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(D);else throw Error(D)}return I}getSchema(z){let B;for(;typeof(B=w.call(this,z))=="string";)z=B;if(B===void 0){let{schemaId:q}=this.opts,I=new o.SchemaEnv({schema:{},schemaId:q});if(B=o.resolveSchema.call(this,I,z),!B)return;this.refs[z]=B}return B.validate||this._compileSchemaEnv(B)}removeSchema(z){if(z instanceof RegExp)return this._removeAllSchemas(this.schemas,z),this._removeAllSchemas(this.refs,z),this;switch(typeof z){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let B=w.call(this,z);return typeof B=="object"&&this._cache.delete(B.schema),delete this.schemas[z],delete this.refs[z],this}case"object":{let B=z;this._cache.delete(B);let q=z[this.opts.schemaId];return q&&(q=(0,u.normalizeId)(q),delete this.schemas[q],delete this.refs[q]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(z){for(let B of z)this.addKeyword(B);return this}addKeyword(z,B){let q;if(typeof z=="string")q=z,typeof B=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),B.keyword=q);else if(typeof z=="object"&&B===void 0){if(B=z,q=B.keyword,Array.isArray(q)&&!q.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(N.call(this,q,B),!B)return(0,c.eachItem)(q,D=>A.call(this,D)),this;H.call(this,B);let I={...B,type:(0,l.getJSONTypes)(B.type),schemaType:(0,l.getJSONTypes)(B.schemaType)};return(0,c.eachItem)(q,I.type.length===0?D=>A.call(this,D,I):D=>I.type.forEach(O=>A.call(this,D,I,O))),this}getKeyword(z){let B=this.RULES.all[z];return typeof B=="object"?B.definition:!!B}removeKeyword(z){let{RULES:B}=this;delete B.keywords[z],delete B.all[z];for(let q of B.rules){let I=q.rules.findIndex(D=>D.keyword===z);I>=0&&q.rules.splice(I,1)}return this}addFormat(z,B){return typeof B=="string"&&(B=new RegExp(B)),this.formats[z]=B,this}errorsText(z=this.errors,{separator:B=", ",dataVar:q="data"}={}){return!z||z.length===0?"No errors":z.map(I=>`${q}${I.instancePath} ${I.message}`).reduce((I,D)=>I+B+D)}$dataMetaSchema(z,B){let q=this.RULES.all;z=JSON.parse(JSON.stringify(z));for(let I of B){let D=I.split("/").slice(1),O=z;for(let j of D)O=O[j];for(let j in q){let V=q[j];if(typeof V!="object")continue;let{$data:Y}=V.definition,me=O[j];Y&&me&&(O[j]=ne(me))}}return z}_removeAllSchemas(z,B){for(let q in z){let I=z[q];(!B||B.test(q))&&(typeof I=="string"?delete z[q]:I&&!I.meta&&(this._cache.delete(I.schema),delete z[q]))}}_addSchema(z,B,q,I=this.opts.validateSchema,D=this.opts.addUsedSchema){let O,{schemaId:j}=this.opts;if(typeof z=="object")O=z[j];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof z!="boolean")throw Error("schema must be object or boolean")}let V=this._cache.get(z);if(V!==void 0)return V;q=(0,u.normalizeId)(O||q);let Y=u.getSchemaRefs.call(this,z,q);return V=new o.SchemaEnv({schema:z,schemaId:j,meta:B,baseId:q,localRefs:Y}),this._cache.set(V.schema,V),D&&!q.startsWith("#")&&(q&&this._checkUnique(q),this.refs[q]=V),I&&this.validateSchema(z,!0),V}_checkUnique(z){if(this.schemas[z]||this.refs[z])throw Error(`schema with key or id "${z}" already exists`)}_compileSchemaEnv(z){if(z.meta?this._compileMetaSchema(z):o.compileSchema.call(this,z),!z.validate)throw Error("ajv implementation error");return z.validate}_compileMetaSchema(z){let B=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,z)}finally{this.opts=B}}}m.ValidationError=n.default,m.MissingRefError=i.default,e.default=m;function S(Z,z,B,q="error"){for(let I in Z){let D=I;D in z&&this.logger[q](`${B}: option ${I}. ${Z[D]}`)}}function w(Z){return Z=(0,u.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function k(){let Z=this.opts.schemas;if(Z)if(Array.isArray(Z))this.addSchema(Z);else for(let z in Z)this.addSchema(Z[z],z)}function x(){for(let Z in this.opts.formats){let z=this.opts.formats[Z];z&&this.addFormat(Z,z)}}function R(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in Z){let B=Z[z];B.keyword||(B.keyword=z),this.addKeyword(B)}}function E(){let Z={...this.opts};for(let z of h)delete Z[z];return Z}var P={log(){},warn(){},error(){}};function C(Z){if(Z===!1)return P;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw Error("logger must implement log, warn and error methods")}var $=/^[a-z_$][a-z0-9_$:-]*$/i;function N(Z,z){let{RULES:B}=this;if((0,c.eachItem)(Z,q=>{if(B.keywords[q])throw Error(`Keyword ${q} is already defined`);if(!$.test(q))throw Error(`Keyword ${q} has invalid name`)}),!!z&&z.$data&&!("code"in z||"validate"in z))throw Error('$data keyword must have "code" or "validate" function')}function A(Z,z,B){var q;let I=z?.post;if(B&&I)throw Error('keyword with "post" flag cannot have "type"');let{RULES:D}=this,O=I?D.post:D.rules.find(({type:V})=>V===B);if(O||(O={type:B,rules:[]},D.rules.push(O)),D.keywords[Z]=!0,!z)return;let j={keyword:Z,definition:{...z,type:(0,l.getJSONTypes)(z.type),schemaType:(0,l.getJSONTypes)(z.schemaType)}};z.before?W.call(this,O,j,z.before):O.rules.push(j),D.all[Z]=j,(q=z.implements)===null||q===void 0||q.forEach(V=>this.addKeyword(V))}function W(Z,z,B){let q=Z.rules.findIndex(I=>I.keyword===B);q>=0?Z.rules.splice(q,0,z):(Z.rules.push(z),this.logger.warn(`rule ${B} is not defined`))}function H(Z){let{metaSchema:z}=Z;z!==void 0&&(Z.$data&&this.opts.$data&&(z=ne(z)),Z.validateSchema=this.compile(z,!0))}var re={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ne(Z){return{anyOf:[Z,re]}}}),g2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),y2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=vS(),r=Zs(),n=ut(),i=xu(),s=dD(),o=Nt(),a={keyword:"$ref",schemaType:"string",code(c){let{gen:d,schema:p,it:f}=c,{baseId:h,schemaEnv:v,validateName:y,opts:_,self:b}=f,{root:g}=v;if((p==="#"||p==="#/")&&h===g.baseId)return S();let m=s.resolveRef.call(b,g,h,p);if(m===void 0)throw new t.default(f.opts.uriResolver,h,p);if(m instanceof s.SchemaEnv)return w(m);return k(m);function S(){if(v===g)return l(c,y,v,v.$async);let x=d.scopeValue("root",{ref:g});return l(c,n._`${x}.validate`,g,g.$async)}function w(x){let R=u(c,x);l(c,R,x,x.$async)}function k(x){let R=d.scopeValue("schema",_.code.source===!0?{ref:x,code:(0,n.stringify)(x)}:{ref:x}),E=d.name("valid"),P=c.subschema({schema:x,dataTypes:[],schemaPath:n.nil,topSchemaRef:R,errSchemaPath:p},E);c.mergeEvaluated(P),c.ok(E)}}};function u(c,d){let{gen:p}=c;return d.validate?p.scopeValue("validate",{ref:d.validate}):n._`${p.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=u;function l(c,d,p,f){let{gen:h,it:v}=c,{allErrors:y,schemaEnv:_,opts:b}=v,g=b.passContext?i.default.this:n.nil;f?m():S();function m(){if(!_.$async)throw Error("async schema referenced by sync schema");let x=h.let("valid");h.try(()=>{h.code(n._`await ${(0,r.callValidateCode)(c,d,g)}`),k(d),!y&&h.assign(x,!0)},R=>{h.if(n._`!(${R} instanceof ${v.ValidationError})`,()=>h.throw(R)),w(R),!y&&h.assign(x,!1)}),c.ok(x)}function S(){c.result((0,r.callValidateCode)(c,d,g),()=>k(d),()=>w(d))}function w(x){let R=n._`${x}.errors`;h.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${R} : ${i.default.vErrors}.concat(${R})`),h.assign(i.default.errors,n._`${i.default.vErrors}.length`)}function k(x){var R;if(!v.opts.unevaluated)return;let E=(R=p?.validate)===null||R===void 0?void 0:R.evaluated;if(v.props!==!0)if(E&&!E.dynamicProps)E.props!==void 0&&(v.props=o.mergeEvaluated.props(h,E.props,v.props));else{let P=h.var("props",n._`${x}.evaluated.props`);v.props=o.mergeEvaluated.props(h,P,v.props,n.Name)}if(v.items!==!0)if(E&&!E.dynamicItems)E.items!==void 0&&(v.items=o.mergeEvaluated.items(h,E.items,v.items));else{let P=h.var("items",n._`${x}.evaluated.items`);v.items=o.mergeEvaluated.items(h,P,v.items,n.Name)}}}e.callRef=l,e.default=a}),_2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=g2e(),r=y2e(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),v2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},i={message:({keyword:o,schemaCode:a})=>t.str`must be ${n[o].okStr} ${a}`,params:({keyword:o,schemaCode:a})=>t._`{comparison: ${n[o].okStr}, limit: ${a}}`},s={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l}=o;o.fail$data(t._`${u} ${n[a].fail} ${l} || isNaN(${u})`)}};e.default=s}),b2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message:({schemaCode:i})=>t.str`must be multiple of ${i}`,params:({schemaCode:i})=>t._`{multipleOf: ${i}}`},n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r,code(i){let{gen:s,data:o,schemaCode:a,it:u}=i,l=u.opts.multipleOfPrecision,c=s.let("res"),d=l?t._`Math.abs(Math.round(${c}) - ${c}) > 1e-${l}`:t._`${c} !== parseInt(${c})`;i.fail$data(t._`(${a} === 0 || (${c} = ${o}/${a}, ${d}))`)}};e.default=n}),w2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,i=0,s=0,o;for(;s<n;)i++,o=r.charCodeAt(s++),o>=55296&&o<=56319&&s<n&&(o=r.charCodeAt(s),(o&64512)===56320&&s++);return i}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),S2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=w2e(),i={message({keyword:o,schemaCode:a}){let u=o==="maxLength"?"more":"fewer";return t.str`must NOT have ${u} than ${a} characters`},params:({schemaCode:o})=>t._`{limit: ${o}}`},s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l,it:c}=o,d=a==="maxLength"?t.operators.GT:t.operators.LT,p=c.opts.unicode===!1?t._`${u}.length`:t._`${(0,r.useFunc)(o.gen,n.default)}(${u})`;o.fail$data(t._`${p} ${d} ${l}`)}};e.default=s}),k2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n={message:({schemaCode:s})=>r.str`must match pattern "${s}"`,params:({schemaCode:s})=>r._`{pattern: ${s}}`},i={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:n,code(s){let{data:o,$data:a,schema:u,schemaCode:l,it:c}=s,d=c.opts.unicodeRegExp?"u":"",p=a?r._`(new RegExp(${l}, ${d}))`:(0,t.usePattern)(s,u);s.fail$data(r._`!${p}.test(${o})`)}};e.default=i}),x2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message({keyword:i,schemaCode:s}){let o=i==="maxProperties"?"more":"fewer";return t.str`must NOT have ${o} than ${s} properties`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxProperties"?t.operators.GT:t.operators.LT;i.fail$data(t._`Object.keys(${o}).length ${u} ${a}`)}};e.default=n}),$2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=Nt(),i={message:({params:{missingProperty:o}})=>r.str`must have required property '${o}'`,params:({params:{missingProperty:o}})=>r._`{missingProperty: ${o}}`},s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,schema:u,schemaCode:l,data:c,$data:d,it:p}=o,{opts:f}=p;if(!d&&u.length===0)return;let h=u.length>=f.loopRequired;if(p.allErrors?v():y(),f.strictRequired){let g=o.parentSchema.properties,{definedProperties:m}=o.it;for(let S of u)if(g?.[S]===void 0&&!m.has(S)){let w=p.schemaEnv.baseId+p.errSchemaPath,k=`required property "${S}" is not defined at "${w}" (strictRequired)`;(0,n.checkStrictMode)(p,k,p.opts.strictRequired)}}function v(){if(h||d)o.block$data(r.nil,_);else for(let g of u)(0,t.checkReportMissingProp)(o,g)}function y(){let g=a.let("missing");if(h||d){let m=a.let("valid",!0);o.block$data(m,()=>b(g,m)),o.ok(m)}else a.if((0,t.checkMissingProp)(o,u,g)),(0,t.reportMissingProp)(o,g),a.else()}function _(){a.forOf("prop",l,g=>{o.setParams({missingProperty:g}),a.if((0,t.noPropertyInData)(a,c,g,f.ownProperties),()=>o.error())})}function b(g,m){o.setParams({missingProperty:g}),a.forOf(g,l,()=>{a.assign(m,(0,t.propertyInData)(a,c,g,f.ownProperties)),a.if((0,r.not)(m),()=>{o.error(),a.break()})},r.nil)}}};e.default=s}),E2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message({keyword:i,schemaCode:s}){let o=i==="maxItems"?"more":"fewer";return t.str`must NOT have ${o} than ${s} items`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxItems"?t.operators.GT:t.operators.LT;i.fail$data(t._`${o}.length ${u} ${a}`)}};e.default=n}),fD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Lee();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),T2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=lS(),r=ut(),n=Nt(),i=fD(),s={message:({params:{i:a,j:u}})=>r.str`must NOT have duplicate items (items ## ${u} and ${a} are identical)`,params:({params:{i:a,j:u}})=>r._`{i: ${a}, j: ${u}}`},o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:s,code(a){let{gen:u,data:l,$data:c,schema:d,parentSchema:p,schemaCode:f,it:h}=a;if(!c&&!d)return;let v=u.let("valid"),y=p.items?(0,t.getSchemaTypes)(p.items):[];a.block$data(v,_,r._`${f} === false`),a.ok(v);function _(){let S=u.let("i",r._`${l}.length`),w=u.let("j");a.setParams({i:S,j:w}),u.assign(v,!0),u.if(r._`${S} > 1`,()=>(b()?g:m)(S,w))}function b(){return y.length>0&&!y.some(S=>S==="object"||S==="array")}function g(S,w){let k=u.name("item"),x=(0,t.checkDataTypes)(y,k,h.opts.strictNumbers,t.DataType.Wrong),R=u.const("indices",r._`{}`);u.for(r._`;${S}--;`,()=>{u.let(k,r._`${l}[${S}]`),u.if(x,r._`continue`),y.length>1&&u.if(r._`typeof ${k} == "string"`,r._`${k} += "_"`),u.if(r._`typeof ${R}[${k}] == "number"`,()=>{u.assign(w,r._`${R}[${k}]`),a.error(),u.assign(v,!1).break()}).code(r._`${R}[${k}] = ${S}`)})}function m(S,w){let k=(0,n.useFunc)(u,i.default),x=u.name("outer");u.label(x).for(r._`;${S}--;`,()=>u.for(r._`${w} = ${S}; ${w}--;`,()=>u.if(r._`${k}(${l}[${S}], ${l}[${w}])`,()=>{a.error(),u.assign(v,!1).break(x)})))}}};e.default=o}),R2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=fD(),i={message:"must be equal to constant",params:({schemaCode:o})=>t._`{allowedValue: ${o}}`},s={keyword:"const",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schemaCode:c,schema:d}=o;l||d&&typeof d=="object"?o.fail$data(t._`!${(0,r.useFunc)(a,n.default)}(${u}, ${c})`):o.fail(t._`${d} !== ${u}`)}};e.default=s}),P2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=fD(),i={message:"must be equal to one of the allowed values",params:({schemaCode:o})=>t._`{allowedValues: ${o}}`},s={keyword:"enum",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schema:c,schemaCode:d,it:p}=o;if(!l&&c.length===0)throw Error("enum must have non-empty array");let f=c.length>=p.opts.loopEnum,h,v=()=>h??(h=(0,r.useFunc)(a,n.default)),y;if(f||l)y=a.let("valid"),o.block$data(y,_);else{if(!Array.isArray(c))throw Error("ajv implementation error");let g=a.const("vSchema",d);y=(0,t.or)(...c.map((m,S)=>b(g,S)))}o.pass(y);function _(){a.assign(y,!1),a.forOf("v",d,g=>a.if(t._`${v()}(${u}, ${g})`,()=>a.assign(y,!0).break()))}function b(g,m){let S=c[m];return typeof S=="object"&&S!==null?t._`${v()}(${u}, ${g}[${m}])`:t._`${u} === ${S}`}}};e.default=s}),I2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=v2e(),r=b2e(),n=S2e(),i=k2e(),s=x2e(),o=$2e(),a=E2e(),u=T2e(),l=R2e(),c=P2e(),d=[t.default,r.default,n.default,i.default,s.default,o.default,a.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,c.default];e.default=d}),qee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=ut(),r=Nt(),n={message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n,code(o){let{parentSchema:a,it:u}=o,{items:l}=a;if(!Array.isArray(l)){(0,r.checkStrictMode)(u,'"additionalItems" is ignored when "items" is not an array of schemas');return}s(o,l)}};function s(o,a){let{gen:u,schema:l,data:c,keyword:d,it:p}=o;p.items=!0;let f=u.const("len",t._`${c}.length`);if(l===!1)o.setParams({len:a.length}),o.pass(t._`${f} <= ${a.length}`);else if(typeof l=="object"&&!(0,r.alwaysValidSchema)(p,l)){let v=u.var("valid",t._`${f} <= ${a.length}`);u.if((0,t.not)(v),()=>h(v)),o.ok(v)}function h(v){u.forRange("i",a.length,f,y=>{o.subschema({keyword:d,dataProp:y,dataPropType:r.Type.Num},v),!p.allErrors&&u.if((0,t.not)(v),()=>u.break())})}}e.validateAdditionalItems=s,e.default=i}),Fee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=ut(),r=Nt(),n=Zs(),i={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(o){let{schema:a,it:u}=o;if(Array.isArray(a))return s(o,"additionalItems",a);u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&o.ok((0,n.validateArray)(o))}};function s(o,a,u=o.schema){let{gen:l,parentSchema:c,data:d,keyword:p,it:f}=o;y(c),f.opts.unevaluated&&u.length&&f.items!==!0&&(f.items=r.mergeEvaluated.items(l,u.length,f.items));let h=l.name("valid"),v=l.const("len",t._`${d}.length`);u.forEach((_,b)=>{(0,r.alwaysValidSchema)(f,_)||(l.if(t._`${v} > ${b}`,()=>o.subschema({keyword:p,schemaProp:b,dataProp:b},h)),o.ok(h))});function y(_){let{opts:b,errSchemaPath:g}=f,m=u.length,S=m===_.minItems&&(m===_.maxItems||_[a]===!1);if(b.strictTuples&&!S){let w=`"${p}" is ${m}-tuple, but minItems or maxItems/${a} are not specified or different at path "${g}"`;(0,r.checkStrictMode)(f,w,b.strictTuples)}}}e.validateTuple=s,e.default=i}),O2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fee(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};e.default=r}),C2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=Zs(),i=qee(),s={message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:s,code(a){let{schema:u,parentSchema:l,it:c}=a,{prefixItems:d}=l;c.items=!0,!(0,r.alwaysValidSchema)(c,u)&&(d?(0,i.validateAdditionalItems)(a,d):a.ok((0,n.validateArray)(a)))}};e.default=o}),N2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:({params:{min:s,max:o}})=>o===void 0?t.str`must contain at least ${s} valid item(s)`:t.str`must contain at least ${s} and no more than ${o} valid item(s)`,params:({params:{min:s,max:o}})=>o===void 0?t._`{minContains: ${s}}`:t._`{minContains: ${s}, maxContains: ${o}}`},i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,data:l,it:c}=s,d,p,{minContains:f,maxContains:h}=u;c.opts.next?(d=f===void 0?1:f,p=h):d=1;let v=o.const("len",t._`${l}.length`);if(s.setParams({min:d,max:p}),p===void 0&&d===0){(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&d>p){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),s.fail();return}if((0,r.alwaysValidSchema)(c,a)){let m=t._`${v} >= ${d}`;p!==void 0&&(m=t._`${m} && ${v} <= ${p}`),s.pass(m);return}c.items=!0;let y=o.name("valid");p===void 0&&d===1?b(y,()=>o.if(y,()=>o.break())):d===0?(o.let(y,!0),p!==void 0&&o.if(t._`${l}.length > 0`,_)):(o.let(y,!1),_()),s.result(y,()=>s.reset());function _(){let m=o.name("_valid"),S=o.let("count",0);b(m,()=>o.if(m,()=>g(S)))}function b(m,S){o.forRange("i",0,v,w=>{s.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},m),S()})}function g(m){o.code(t._`${m}++`),p===void 0?o.if(t._`${m} >= ${d}`,()=>o.assign(y,!0).break()):(o.if(t._`${m} > ${p}`,()=>o.assign(y,!1).break()),d===1?o.assign(y,!0):o.if(t._`${m} >= ${d}`,()=>o.assign(y,!0)))}}};e.default=i}),A2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=ut(),r=Nt(),n=Zs();e.error={message:({params:{property:u,depsCount:l,deps:c}})=>{let d=l===1?"property":"properties";return t.str`must have ${d} ${c} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:c,missingProperty:d}})=>t._`{property: ${u},
466
+ || ${R} === "boolean" || ${k} === null`).assign(E,i._`[${k}]`)}}}function f({gen:g,parentData:m,parentDataProperty:S},w){g.if(i._`${m} !== undefined`,()=>g.assign(i._`${m}[${S}]`,w))}function h(g,m,S,w=o.Correct){let k=w===o.Correct?i.operators.EQ:i.operators.NEQ,x;switch(g){case"null":return i._`${m} ${k} null`;case"array":x=i._`Array.isArray(${m})`;break;case"object":x=i._`${m} && typeof ${m} == "object" && !Array.isArray(${m})`;break;case"integer":x=R(i._`!(${m} % 1) && !isNaN(${m})`);break;case"number":x=R();break;default:return i._`typeof ${m} ${k} ${g}`}return w===o.Correct?x:(0,i.not)(x);function R(E=i.nil){return(0,i.and)(i._`typeof ${m} == "number"`,E,S?i._`isFinite(${m})`:i.nil)}}e.checkDataType=h;function v(g,m,S,w){if(g.length===1)return h(g[0],m,S,w);let k,x=(0,s.toHash)(g);if(x.array&&x.object){let R=i._`typeof ${m} != "object"`;k=x.null?R:i._`!${m} || ${R}`,delete x.null,delete x.array,delete x.object}else k=i.nil;x.number&&delete x.integer;for(let R in x)k=(0,i.and)(k,h(R,m,S,w));return k}e.checkDataTypes=v;var y={message:({schema:g})=>`must be ${g}`,params:({schema:g,schemaValue:m})=>typeof g=="string"?i._`{type: ${g}}`:i._`{type: ${m}}`};function _(g){let m=b(g);(0,n.reportError)(m,y)}e.reportTypeError=_;function b(g){let{gen:m,data:S,schema:w}=g,k=(0,s.schemaRefOrVal)(g,w,"type");return{gen:m,keyword:"type",data:S,schema:w.type,schemaCode:k,schemaValue:k,parentSchema:w,params:{},it:g}}}),s2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=ut(),r=Nt();function n(s,o){let{properties:a,items:u}=s.schema;if(o==="object"&&a)for(let l in a)i(s,l,a[l].default);else o==="array"&&Array.isArray(u)&&u.forEach((l,c)=>i(s,c,l.default))}e.assignDefaults=n;function i(s,o,a){let{gen:u,compositeRule:l,data:c,opts:d}=s;if(a===void 0)return;let p=t._`${c}${(0,t.getProperty)(o)}`;if(l){(0,r.checkStrictMode)(s,`default is ignored for: ${p}`);return}let f=t._`${p} === undefined`;d.useDefaults==="empty"&&(f=t._`${f} || ${p} === null || ${p} === ""`),u.if(f,t._`${p} = ${(0,t.stringify)(a)}`)}}),Zs=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=ut(),r=Nt(),n=xu(),i=Nt();function s(g,m){let{gen:S,data:w,it:k}=g;S.if(d(S,w,m,k.opts.ownProperties),()=>{g.setParams({missingProperty:t._`${m}`},!0),g.error()})}e.checkReportMissingProp=s;function o({gen:g,data:m,it:{opts:S}},w,k){return(0,t.or)(...w.map(x=>(0,t.and)(d(g,m,x,S.ownProperties),t._`${k} = ${x}`)))}e.checkMissingProp=o;function a(g,m){g.setParams({missingProperty:m},!0),g.error()}e.reportMissingProp=a;function u(g){return g.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=u;function l(g,m,S){return t._`${u(g)}.call(${m}, ${S})`}e.isOwnProperty=l;function c(g,m,S,w){let k=t._`${m}${(0,t.getProperty)(S)} !== undefined`;return w?t._`${k} && ${l(g,m,S)}`:k}e.propertyInData=c;function d(g,m,S,w){let k=t._`${m}${(0,t.getProperty)(S)} === undefined`;return w?(0,t.or)(k,(0,t.not)(l(g,m,S))):k}e.noPropertyInData=d;function p(g){return g?Object.keys(g).filter(m=>m!=="__proto__"):[]}e.allSchemaProperties=p;function f(g,m){return p(m).filter(S=>!(0,r.alwaysValidSchema)(g,m[S]))}e.schemaProperties=f;function h({schemaCode:g,data:m,it:{gen:S,topSchemaRef:w,schemaPath:k,errorPath:x},it:R},E,P,C){let $=C?t._`${g}, ${m}, ${w}${k}`:m,N=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,x)],[n.default.parentData,R.parentData],[n.default.parentDataProperty,R.parentDataProperty],[n.default.rootData,n.default.rootData]];R.opts.dynamicRef&&N.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let A=t._`${$}, ${S.object(...N)}`;return P!==t.nil?t._`${E}.call(${P}, ${A})`:t._`${E}(${A})`}e.callValidateCode=h;var v=t._`new RegExp`;function y({gen:g,it:{opts:m}},S){let w=m.unicodeRegExp?"u":"",{regExp:k}=m.code,x=k(S,w);return g.scopeValue("pattern",{key:x.toString(),ref:x,code:t._`${k.code==="new RegExp"?v:(0,i.useFunc)(g,k)}(${S}, ${w})`})}e.usePattern=y;function _(g){let{gen:m,data:S,keyword:w,it:k}=g,x=m.name("valid");if(k.allErrors){let E=m.let("valid",!0);return R(()=>m.assign(E,!1)),E}return m.var(x,!0),R(()=>m.break()),x;function R(E){let P=m.const("len",t._`${S}.length`);m.forRange("i",0,P,C=>{g.subschema({keyword:w,dataProp:C,dataPropType:r.Type.Num},x),m.if((0,t.not)(x),E)})}}e.validateArray=_;function b(g){let{gen:m,schema:S,keyword:w,it:k}=g;if(!Array.isArray(S))throw Error("ajv implementation error");if(S.some(E=>(0,r.alwaysValidSchema)(k,E))&&!k.opts.unevaluated)return;let x=m.let("valid",!1),R=m.name("_valid");m.block(()=>S.forEach((E,P)=>{let C=g.subschema({keyword:w,schemaProp:P,compositeRule:!0},R);m.assign(x,t._`${x} || ${R}`),!g.mergeValidEvaluated(C,R)&&m.if((0,t.not)(x))})),g.result(x,()=>g.reset(),()=>g.error(!0))}e.validateUnion=b}),o2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=ut(),r=xu(),n=Zs(),i=gS();function s(f,h){let{gen:v,keyword:y,schema:_,parentSchema:b,it:g}=f,m=h.macro.call(g.self,_,b,g),S=c(v,y,m);g.opts.validateSchema!==!1&&g.self.validateSchema(m,!0);let w=v.name("valid");f.subschema({schema:m,schemaPath:t.nil,errSchemaPath:`${g.errSchemaPath}/${y}`,topSchemaRef:S,compositeRule:!0},w),f.pass(w,()=>f.error(!0))}e.macroKeywordCode=s;function o(f,h){var v;let{gen:y,keyword:_,schema:b,parentSchema:g,$data:m,it:S}=f;l(S,h);let w=!m&&h.compile?h.compile.call(S.self,b,g,S):h.validate,k=c(y,_,w),x=y.let("valid");f.block$data(x,R),f.ok((v=h.valid)!==null&&v!==void 0?v:x);function R(){if(h.errors===!1)C(),h.modifying&&a(f),$(()=>f.error());else{let N=h.async?E():P();h.modifying&&a(f),$(()=>u(f,N))}}function E(){let N=y.let("ruleErrs",null);return y.try(()=>C(t._`await `),A=>y.assign(x,!1).if(t._`${A} instanceof ${S.ValidationError}`,()=>y.assign(N,t._`${A}.errors`),()=>y.throw(A))),N}function P(){let N=t._`${k}.errors`;return y.assign(N,null),C(t.nil),N}function C(N=h.async?t._`await `:t.nil){let A=S.opts.passContext?r.default.this:r.default.self,W=!("compile"in h&&!m||h.schema===!1);y.assign(x,t._`${N}${(0,n.callValidateCode)(f,k,A,W)}`,h.modifying)}function $(N){var A;y.if((0,t.not)((A=h.valid)!==null&&A!==void 0?A:x),N)}}e.funcKeywordCode=o;function a(f){let{gen:h,data:v,it:y}=f;h.if(y.parentData,()=>h.assign(v,t._`${y.parentData}[${y.parentDataProperty}]`))}function u(f,h){let{gen:v}=f;v.if(t._`Array.isArray(${h})`,()=>{v.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${h} : ${r.default.vErrors}.concat(${h})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,i.extendErrors)(f)},()=>f.error())}function l({schemaEnv:f},h){if(h.async&&!f.$async)throw Error("async keyword in sync schema")}function c(f,h,v){if(v===void 0)throw Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,t.stringify)(v)})}function d(f,h,v=!1){return!h.length||h.some(y=>y==="array"?Array.isArray(f):y==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==y||v&&typeof f>"u")}e.validSchemaType=d;function p({schema:f,opts:h,self:v,errSchemaPath:y},_,b){if(Array.isArray(_.keyword)?!_.keyword.includes(b):_.keyword!==b)throw Error("ajv implementation error");let g=_.dependencies;if(g?.some(m=>!Object.prototype.hasOwnProperty.call(f,m)))throw Error(`parent schema must have dependencies of ${b}: ${g.join(",")}`);if(_.validateSchema&&!_.validateSchema(f[b])){let m=`keyword "${b}" value is invalid at path "${y}": `+v.errorsText(_.validateSchema.errors);if(h.validateSchema==="log")v.logger.error(m);else throw Error(m)}}e.validateKeywordUsage=p}),a2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=ut(),r=Nt();function n(o,{keyword:a,schemaProp:u,schema:l,schemaPath:c,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&l!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let f=o.schema[a];return u===void 0?{schema:f,schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${a}`}:{schema:f[u],schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(u)}`,errSchemaPath:`${o.errSchemaPath}/${a}/${(0,r.escapeFragment)(u)}`}}if(l!==void 0){if(c===void 0||d===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:p,errSchemaPath:d}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function i(o,a,{dataProp:u,dataPropType:l,data:c,dataTypes:d,propertyName:p}){if(c!==void 0&&u!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=a;if(u!==void 0){let{errorPath:v,dataPathArr:y,opts:_}=a,b=f.let("data",t._`${a.data}${(0,t.getProperty)(u)}`,!0);h(b),o.errorPath=t.str`${v}${(0,r.getErrorPath)(u,l,_.jsPropertySyntax)}`,o.parentDataProperty=t._`${u}`,o.dataPathArr=[...y,o.parentDataProperty]}if(c!==void 0){let v=c instanceof t.Name?c:f.let("data",c,!0);h(v),p!==void 0&&(o.propertyName=p)}d&&(o.dataTypes=d);function h(v){o.data=v,o.dataLevel=a.dataLevel+1,o.dataTypes=[],a.definedProperties=new Set,o.parentData=a.data,o.dataNames=[...a.dataNames,v]}}e.extendSubschemaData=i;function s(o,{jtdDiscriminator:a,jtdMetadata:u,compositeRule:l,createErrors:c,allErrors:d}){l!==void 0&&(o.compositeRule=l),c!==void 0&&(o.createErrors=c),d!==void 0&&(o.allErrors=d),o.jtdDiscriminator=a,o.jtdMetadata=u}e.extendSubschemaMode=s}),Lee=be((e,t)=>{t.exports=function r(n,i){if(n===i)return!0;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(n.constructor!==i.constructor)return!1;var s,o,a;if(Array.isArray(n)){if(s=n.length,s!=i.length)return!1;for(o=s;o--!==0;)if(!r(n[o],i[o]))return!1;return!0}if(n.constructor===RegExp)return n.source===i.source&&n.flags===i.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===i.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===i.toString();if(a=Object.keys(n),s=a.length,s!==Object.keys(i).length)return!1;for(o=s;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,a[o]))return!1;for(o=s;o--!==0;){var u=a[o];if(!r(n[u],i[u]))return!1}return!0}return n!==n&&i!==i}}),u2e=be((e,t)=>{var r=t.exports=function(s,o,a){typeof o=="function"&&(a=o,o={}),a=o.cb||a;var u=typeof a=="function"?a:a.pre||function(){},l=a.post||function(){};n(o,u,l,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 n(s,o,a,u,l,c,d,p,f,h){if(u&&typeof u=="object"&&!Array.isArray(u)){o(u,l,c,d,p,f,h);for(var v in u){var y=u[v];if(Array.isArray(y)){if(v in r.arrayKeywords)for(var _=0;_<y.length;_++)n(s,o,a,y[_],l+"/"+v+"/"+_,c,l,v,u,_)}else if(v in r.propsKeywords){if(y&&typeof y=="object")for(var b in y)n(s,o,a,y[b],l+"/"+v+"/"+i(b),c,l,v,u,b)}else(v in r.keywords||s.allKeys&&!(v in r.skipKeywords))&&n(s,o,a,y,l+"/"+v,c,l,v,u)}a(u,l,c,d,p,f,h)}}function i(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),yS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Nt(),r=Lee(),n=u2e(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(y,_=!0){return typeof y=="boolean"?!0:_===!0?!a(y):_?u(y)<=_:!1}e.inlineRef=s;var o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(y){for(let _ in y){if(o.has(_))return!0;let b=y[_];if(Array.isArray(b)&&b.some(a)||typeof b=="object"&&a(b))return!0}return!1}function u(y){let _=0;for(let b in y){if(b==="$ref")return 1/0;if(_++,!i.has(b)&&(typeof y[b]=="object"&&(0,t.eachItem)(y[b],g=>_+=u(g)),_===1/0))return 1/0}return _}function l(y,_="",b){b!==!1&&(_=p(_));let g=y.parse(_);return c(y,g)}e.getFullPath=l;function c(y,_){return y.serialize(_).split("#")[0]+"#"}e._getFullPath=c;var d=/#\/?$/;function p(y){return y?y.replace(d,""):""}e.normalizeId=p;function f(y,_,b){return b=p(b),y.resolve(_,b)}e.resolveUrl=f;var h=/^[a-z_][-a-z0-9._]*$/i;function v(y,_){if(typeof y=="boolean")return{};let{schemaId:b,uriResolver:g}=this.opts,m=p(y[b]||_),S={"":m},w=l(g,m,!1),k={},x=new Set;return n(y,{allKeys:!0},(P,C,$,N)=>{if(N===void 0)return;let A=w+C,W=S[N];typeof P[b]=="string"&&(W=H.call(this,P[b])),te.call(this,P.$anchor),te.call(this,P.$dynamicAnchor),S[C]=W;function H(ne){let Z=this.opts.uriResolver.resolve;if(ne=p(W?Z(W,ne):ne),x.has(ne))throw E(ne);x.add(ne);let z=this.refs[ne];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?R(P,z.schema,ne):ne!==p(A)&&(ne[0]==="#"?(R(P,k[ne],ne),k[ne]=P):this.refs[ne]=A),ne}function te(ne){if(typeof ne=="string"){if(!h.test(ne))throw Error(`invalid anchor "${ne}"`);H.call(this,`#${ne}`)}}}),k;function R(P,C,$){if(C!==void 0&&!r(P,C))throw E($)}function E(P){return Error(`reference "${P}" resolves to more than one schema`)}}e.getSchemaRefs=v}),_S=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=i2e(),r=lS(),n=Mee(),i=lS(),s=s2e(),o=o2e(),a=a2e(),u=ut(),l=xu(),c=yS(),d=Nt(),p=gS();function f(F){if(w(F)&&(x(F),S(F))){_(F);return}h(F,()=>(0,t.topBoolOrEmptySchema)(F))}e.validateFunctionCode=f;function h({gen:F,validateName:M,schema:X,schemaEnv:ee,opts:he},Te){he.code.es5?F.func(M,u._`${l.default.data}, ${l.default.valCxt}`,ee.$async,()=>{F.code(u._`"use strict"; ${g(X,he)}`),y(F,he),F.code(Te)}):F.func(M,u._`${l.default.data}, ${v(he)}`,ee.$async,()=>F.code(g(X,he)).code(Te))}function v(F){return u._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${F.dynamicRef?u._`, ${l.default.dynamicAnchors}={}`:u.nil}}={}`}function y(F,M){F.if(l.default.valCxt,()=>{F.var(l.default.instancePath,u._`${l.default.valCxt}.${l.default.instancePath}`),F.var(l.default.parentData,u._`${l.default.valCxt}.${l.default.parentData}`),F.var(l.default.parentDataProperty,u._`${l.default.valCxt}.${l.default.parentDataProperty}`),F.var(l.default.rootData,u._`${l.default.valCxt}.${l.default.rootData}`),M.dynamicRef&&F.var(l.default.dynamicAnchors,u._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{F.var(l.default.instancePath,u._`""`),F.var(l.default.parentData,u._`undefined`),F.var(l.default.parentDataProperty,u._`undefined`),F.var(l.default.rootData,l.default.data),M.dynamicRef&&F.var(l.default.dynamicAnchors,u._`{}`)})}function _(F){let{schema:M,opts:X,gen:ee}=F;h(F,()=>{X.$comment&&M.$comment&&N(F),P(F),ee.let(l.default.vErrors,null),ee.let(l.default.errors,0),X.unevaluated&&b(F),R(F),A(F)})}function b(F){let{gen:M,validateName:X}=F;F.evaluated=M.const("evaluated",u._`${X}.evaluated`),M.if(u._`${F.evaluated}.dynamicProps`,()=>M.assign(u._`${F.evaluated}.props`,u._`undefined`)),M.if(u._`${F.evaluated}.dynamicItems`,()=>M.assign(u._`${F.evaluated}.items`,u._`undefined`))}function g(F,M){let X=typeof F=="object"&&F[M.schemaId];return X&&(M.code.source||M.code.process)?u._`/*# sourceURL=${X} */`:u.nil}function m(F,M){if(w(F)&&(x(F),S(F))){k(F,M);return}(0,t.boolOrEmptySchema)(F,M)}function S({schema:F,self:M}){if(typeof F=="boolean")return!F;for(let X in F)if(M.RULES.all[X])return!0;return!1}function w(F){return typeof F.schema!="boolean"}function k(F,M){let{schema:X,gen:ee,opts:he}=F;he.$comment&&X.$comment&&N(F),C(F),$(F);let Te=ee.const("_errs",l.default.errors);R(F,Te),ee.var(M,u._`${Te} === ${l.default.errors}`)}function x(F){(0,d.checkUnknownRules)(F),E(F)}function R(F,M){if(F.opts.jtd)return H(F,[],!1,M);let X=(0,r.getSchemaTypes)(F.schema),ee=(0,r.coerceAndCheckDataType)(F,X);H(F,X,!ee,M)}function E(F){let{schema:M,errSchemaPath:X,opts:ee,self:he}=F;M.$ref&&ee.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(M,he.RULES)&&he.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function P(F){let{schema:M,opts:X}=F;M.default!==void 0&&X.useDefaults&&X.strictSchema&&(0,d.checkStrictMode)(F,"default is ignored in the schema root")}function C(F){let M=F.schema[F.opts.schemaId];M&&(F.baseId=(0,c.resolveUrl)(F.opts.uriResolver,F.baseId,M))}function $(F){if(F.schema.$async&&!F.schemaEnv.$async)throw Error("async schema in sync schema")}function N({gen:F,schemaEnv:M,schema:X,errSchemaPath:ee,opts:he}){let Te=X.$comment;if(he.$comment===!0)F.code(u._`${l.default.self}.logger.log(${Te})`);else if(typeof he.$comment=="function"){let ze=u.str`${ee}/$comment`,_t=F.scopeValue("root",{ref:M.root});F.code(u._`${l.default.self}.opts.$comment(${Te}, ${ze}, ${_t}.schema)`)}}function A(F){let{gen:M,schemaEnv:X,validateName:ee,ValidationError:he,opts:Te}=F;X.$async?M.if(u._`${l.default.errors} === 0`,()=>M.return(l.default.data),()=>M.throw(u._`new ${he}(${l.default.vErrors})`)):(M.assign(u._`${ee}.errors`,l.default.vErrors),Te.unevaluated&&W(F),M.return(u._`${l.default.errors} === 0`))}function W({gen:F,evaluated:M,props:X,items:ee}){X instanceof u.Name&&F.assign(u._`${M}.props`,X),ee instanceof u.Name&&F.assign(u._`${M}.items`,ee)}function H(F,M,X,ee){let{gen:he,schema:Te,data:ze,allErrors:_t,opts:Ot,self:jt}=F,{RULES:ft}=jt;if(Te.$ref&&(Ot.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(Te,ft))){he.block(()=>V(F,"$ref",ft.all.$ref.definition));return}Ot.jtd||ne(F,M),he.block(()=>{for(let it of ft.rules)ni(it);ni(ft.post)});function ni(it){(0,n.shouldUseGroup)(Te,it)&&(it.type?(he.if((0,i.checkDataType)(it.type,ze,Ot.strictNumbers)),te(F,it),M.length===1&&M[0]===it.type&&X&&(he.else(),(0,i.reportTypeError)(F)),he.endIf()):te(F,it),_t||he.if(u._`${l.default.errors} === ${ee||0}`))}}function te(F,M){let{gen:X,schema:ee,opts:{useDefaults:he}}=F;he&&(0,s.assignDefaults)(F,M.type),X.block(()=>{for(let Te of M.rules)(0,n.shouldUseRule)(ee,Te)&&V(F,Te.keyword,Te.definition,M.type)})}function ne(F,M){F.schemaEnv.meta||!F.opts.strictTypes||(Z(F,M),!F.opts.allowUnionTypes&&z(F,M),B(F,F.dataTypes))}function Z(F,M){if(M.length){if(!F.dataTypes.length){F.dataTypes=M;return}M.forEach(X=>{I(F.dataTypes,X)||O(F,`type "${X}" not allowed by context "${F.dataTypes.join(",")}"`)}),D(F,M)}}function z(F,M){M.length>1&&!(M.length===2&&M.includes("null"))&&O(F,"use allowUnionTypes to allow union type keyword")}function B(F,M){let X=F.self.RULES.all;for(let ee in X){let he=X[ee];if(typeof he=="object"&&(0,n.shouldUseRule)(F.schema,he)){let{type:Te}=he.definition;Te.length&&!Te.some(ze=>q(M,ze))&&O(F,`missing type "${Te.join(",")}" for keyword "${ee}"`)}}}function q(F,M){return F.includes(M)||M==="number"&&F.includes("integer")}function I(F,M){return F.includes(M)||M==="integer"&&F.includes("number")}function D(F,M){let X=[];for(let ee of F.dataTypes)I(M,ee)?X.push(ee):M.includes("integer")&&ee==="number"&&X.push("integer");F.dataTypes=X}function O(F,M){let X=F.schemaEnv.baseId+F.errSchemaPath;M+=` at "${X}" (strictTypes)`,(0,d.checkStrictMode)(F,M,F.opts.strictTypes)}class j{constructor(M,X,ee){if((0,o.validateKeywordUsage)(M,X,ee),this.gen=M.gen,this.allErrors=M.allErrors,this.keyword=ee,this.data=M.data,this.schema=M.schema[ee],this.$data=X.$data&&M.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(M,this.schema,ee,this.$data),this.schemaType=X.schemaType,this.parentSchema=M.schema,this.params={},this.it=M,this.def=X,this.$data)this.schemaCode=M.gen.const("vSchema",Ce(this.$data,M));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${ee} value must be ${JSON.stringify(X.schemaType)}`);("code"in X?X.trackErrors:X.errors!==!1)&&(this.errsCount=M.gen.const("_errs",l.default.errors))}result(M,X,ee){this.failResult((0,u.not)(M),X,ee)}failResult(M,X,ee){this.gen.if(M),ee?ee():this.error(),X?(this.gen.else(),X(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(M,X){this.failResult((0,u.not)(M),void 0,X)}fail(M){if(M===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(M),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(M){if(!this.$data)return this.fail(M);let{schemaCode:X}=this;this.fail(u._`${X} !== undefined && (${(0,u.or)(this.invalid$data(),M)})`)}error(M,X,ee){if(X){this.setParams(X),this._error(M,ee),this.setParams({});return}this._error(M,ee)}_error(M,X){(M?p.reportExtraError:p.reportError)(this,this.def.error,X)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(M){this.allErrors||this.gen.if(M)}setParams(M,X){X?Object.assign(this.params,M):this.params=M}block$data(M,X,ee=u.nil){this.gen.block(()=>{this.check$data(M,ee),X()})}check$data(M=u.nil,X=u.nil){if(!this.$data)return;let{gen:ee,schemaCode:he,schemaType:Te,def:ze}=this;ee.if((0,u.or)(u._`${he} === undefined`,X)),M!==u.nil&&ee.assign(M,!0),(Te.length||ze.validateSchema)&&(ee.elseIf(this.invalid$data()),this.$dataError(),M!==u.nil&&ee.assign(M,!1)),ee.else()}invalid$data(){let{gen:M,schemaCode:X,schemaType:ee,def:he,it:Te}=this;return(0,u.or)(ze(),_t());function ze(){if(ee.length){if(!(X instanceof u.Name))throw Error("ajv implementation error");let Ot=Array.isArray(ee)?ee:[ee];return u._`${(0,i.checkDataTypes)(Ot,X,Te.opts.strictNumbers,i.DataType.Wrong)}`}return u.nil}function _t(){if(he.validateSchema){let Ot=M.scopeValue("validate$data",{ref:he.validateSchema});return u._`!${Ot}(${X})`}return u.nil}}subschema(M,X){let ee=(0,a.getSubschema)(this.it,M);(0,a.extendSubschemaData)(ee,this.it,M),(0,a.extendSubschemaMode)(ee,M);let he={...this.it,...ee,items:void 0,props:void 0};return m(he,X),he}mergeEvaluated(M,X){let{it:ee,gen:he}=this;ee.opts.unevaluated&&(ee.props!==!0&&M.props!==void 0&&(ee.props=d.mergeEvaluated.props(he,M.props,ee.props,X)),ee.items!==!0&&M.items!==void 0&&(ee.items=d.mergeEvaluated.items(he,M.items,ee.items,X)))}mergeValidEvaluated(M,X){let{it:ee,gen:he}=this;if(ee.opts.unevaluated&&(ee.props!==!0||ee.items!==!0))return he.if(X,()=>this.mergeEvaluated(M,u.Name)),!0}}e.KeywordCxt=j;function V(F,M,X,ee){let he=new j(F,X,M);"code"in X?X.code(he,ee):he.$data&&X.validate?(0,o.funcKeywordCode)(he,X):"macro"in X?(0,o.macroKeywordCode)(he,X):(X.compile||X.validate)&&(0,o.funcKeywordCode)(he,X)}var Y=/^\/(?:[^~]|~0|~1)*$/,me=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ce(F,{dataLevel:M,dataNames:X,dataPathArr:ee}){let he,Te;if(F==="")return l.default.rootData;if(F[0]==="/"){if(!Y.test(F))throw Error(`Invalid JSON-pointer: ${F}`);he=F,Te=l.default.rootData}else{let jt=me.exec(F);if(!jt)throw Error(`Invalid JSON-pointer: ${F}`);let ft=+jt[1];if(he=jt[2],he==="#"){if(ft>=M)throw Error(Ot("property/index",ft));return ee[M-ft]}if(ft>M)throw Error(Ot("data",ft));if(Te=X[M-ft],!he)return Te}let ze=Te,_t=he.split("/");for(let jt of _t)jt&&(Te=u._`${Te}${(0,u.getProperty)((0,d.unescapeJsonPointer)(jt))}`,ze=u._`${ze} && ${Te}`);return ze;function Ot(jt,ft){return`Cannot access ${jt} ${ft} levels up, current level is ${M}`}}e.getData=Ce}),cD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}e.default=t}),vS=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yS();class r extends Error{constructor(i,s,o,a){super(a||`can't resolve reference ${o} from id ${s}`),this.missingRef=(0,t.resolveUrl)(i,s,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(i,this.missingRef))}}e.default=r}),dD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=ut(),r=cD(),n=xu(),i=yS(),s=Nt(),o=_S();class a{constructor(b){var g;this.refs={},this.dynamicAnchors={};let m;typeof b.schema=="object"&&(m=b.schema),this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(g=b.baseId)!==null&&g!==void 0?g:(0,i.normalizeId)(m?.[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=m?.$async,this.refs={}}}e.SchemaEnv=a;function u(_){let b=d.call(this,_);if(b)return b;let g=(0,i.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:m,lines:S}=this.opts.code,{ownProperties:w}=this.opts,k=new t.CodeGen(this.scope,{es5:m,lines:S,ownProperties:w}),x;_.$async&&(x=k.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));let R=k.scopeName("validate");_.validateName=R;let E={gen:k,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:k.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,t.stringify)(_.schema)}:{ref:_.schema}),validateName:R,ValidationError:x,schema:_.schema,schemaEnv:_,rootId:g,baseId:_.baseId||g,schemaPath:t.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},P;try{this._compilations.add(_),(0,o.validateFunctionCode)(E),k.optimize(this.opts.code.optimize);let C=k.toString();P=`${k.scopeRefs(n.default.scope)}return ${C}`,this.opts.code.process&&(P=this.opts.code.process(P,_));let $=Function(`${n.default.self}`,`${n.default.scope}`,P)(this,this.scope.get());if(this.scope.value(R,{ref:$}),$.errors=null,$.schema=_.schema,$.schemaEnv=_,_.$async&&($.$async=!0),this.opts.code.source===!0&&($.source={validateName:R,validateCode:C,scopeValues:k._values}),this.opts.unevaluated){let{props:N,items:A}=E;$.evaluated={props:N instanceof t.Name?void 0:N,items:A instanceof t.Name?void 0:A,dynamicProps:N instanceof t.Name,dynamicItems:A instanceof t.Name},$.source&&($.source.evaluated=(0,t.stringify)($.evaluated))}return _.validate=$,_}catch(C){throw delete _.validate,delete _.validateName,P&&this.logger.error("Error compiling schema, function code:",P),C}finally{this._compilations.delete(_)}}e.compileSchema=u;function l(_,b,g){var m;g=(0,i.resolveUrl)(this.opts.uriResolver,b,g);let S=_.refs[g];if(S)return S;let w=f.call(this,_,g);if(w===void 0){let k=(m=_.localRefs)===null||m===void 0?void 0:m[g],{schemaId:x}=this.opts;k&&(w=new a({schema:k,schemaId:x,root:_,baseId:b}))}if(w!==void 0)return _.refs[g]=c.call(this,w)}e.resolveRef=l;function c(_){return(0,i.inlineRef)(_.schema,this.opts.inlineRefs)?_.schema:_.validate?_:u.call(this,_)}function d(_){for(let b of this._compilations)if(p(b,_))return b}e.getCompilingSchema=d;function p(_,b){return _.schema===b.schema&&_.root===b.root&&_.baseId===b.baseId}function f(_,b){let g;for(;typeof(g=this.refs[b])=="string";)b=g;return g||this.schemas[b]||h.call(this,_,b)}function h(_,b){let g=this.opts.uriResolver.parse(b),m=(0,i._getFullPath)(this.opts.uriResolver,g),S=(0,i.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&m===S)return y.call(this,g,_);let w=(0,i.normalizeId)(m),k=this.refs[w]||this.schemas[w];if(typeof k=="string"){let x=h.call(this,_,k);return typeof x?.schema!="object"?void 0:y.call(this,g,x)}if(typeof k?.schema=="object"){if(k.validate||u.call(this,k),w===(0,i.normalizeId)(b)){let{schema:x}=k,{schemaId:R}=this.opts,E=x[R];return E&&(S=(0,i.resolveUrl)(this.opts.uriResolver,S,E)),new a({schema:x,schemaId:R,root:_,baseId:S})}return y.call(this,g,k)}}e.resolveSchema=h;var v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(_,{baseId:b,schema:g,root:m}){var S;if(((S=_.fragment)===null||S===void 0?void 0:S[0])!=="/")return;for(let x of _.fragment.slice(1).split("/")){if(typeof g=="boolean")return;let R=g[(0,s.unescapeFragment)(x)];if(R===void 0)return;g=R;let E=typeof g=="object"&&g[this.opts.schemaId];!v.has(x)&&E&&(b=(0,i.resolveUrl)(this.opts.uriResolver,b,E))}let w;if(typeof g!="boolean"&&g.$ref&&!(0,s.schemaHasRulesButRef)(g,this.RULES)){let x=(0,i.resolveUrl)(this.opts.uriResolver,b,g.$ref);w=h.call(this,m,x)}let{schemaId:k}=this.opts;if(w=w||new a({schema:g,schemaId:k,root:m,baseId:b}),w.schema!==w.root.schema)return w}}),l2e=be((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),c2e=be((e,t)=>{var r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t.exports={HEX:r}}),d2e=be((e,t)=>{var{HEX:r}=c2e(),n=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function i(_){if(l(_,".")<3)return{host:_,isIPV4:!1};let b=_.match(n)||[],[g]=b;return g?{host:u(g,"."),isIPV4:!0}:{host:_,isIPV4:!1}}function s(_,b=!1){let g="",m=!0;for(let S of _){if(r[S]===void 0)return;S!=="0"&&m===!0&&(m=!1),m||(g+=S)}return b&&g.length===0&&(g="0"),g}function o(_){let b=0,g={error:!1,address:"",zone:""},m=[],S=[],w=!1,k=!1,x=!1;function R(){if(S.length){if(w===!1){let E=s(S);if(E!==void 0)m.push(E);else return g.error=!0,!1}S.length=0}return!0}for(let E=0;E<_.length;E++){let P=_[E];if(!(P==="["||P==="]"))if(P===":"){if(k===!0&&(x=!0),!R())break;if(b++,m.push(":"),b>7){g.error=!0;break}E-1>=0&&_[E-1]===":"&&(k=!0);continue}else if(P==="%"){if(!R())break;w=!0}else{S.push(P);continue}}return S.length&&(w?g.zone=S.join(""):x?m.push(S.join("")):m.push(s(S))),g.address=m.join(""),g}function a(_){if(l(_,":")<2)return{host:_,isIPV6:!1};let b=o(_);if(b.error)return{host:_,isIPV6:!1};{let{address:g,address:m}=b;return b.zone&&(g+="%"+b.zone,m+="%25"+b.zone),{host:g,escapedHost:m,isIPV6:!0}}}function u(_,b){let g="",m=!0,S=_.length;for(let w=0;w<S;w++){let k=_[w];k==="0"&&m?(w+1<=S&&_[w+1]===b||w+1===S)&&(g+=k,m=!1):(k===b?m=!0:m=!1,g+=k)}return g}function l(_,b){let g=0;for(let m=0;m<_.length;m++)_[m]===b&&g++;return g}var c=/^\.\.?\//u,d=/^\/\.(?:\/|$)/u,p=/^\/\.\.(?:\/|$)/u,f=/^\/?(?:.|\n)*?(?=\/|$)/u;function h(_){let b=[];for(;_.length;)if(_.match(c))_=_.replace(c,"");else if(_.match(d))_=_.replace(d,"/");else if(_.match(p))_=_.replace(p,"/"),b.pop();else if(_==="."||_==="..")_="";else{let g=_.match(f);if(g){let m=g[0];_=_.slice(m.length),b.push(m)}else throw Error("Unexpected dot segment condition")}return b.join("")}function v(_,b){let g=b!==!0?escape:unescape;return _.scheme!==void 0&&(_.scheme=g(_.scheme)),_.userinfo!==void 0&&(_.userinfo=g(_.userinfo)),_.host!==void 0&&(_.host=g(_.host)),_.path!==void 0&&(_.path=g(_.path)),_.query!==void 0&&(_.query=g(_.query)),_.fragment!==void 0&&(_.fragment=g(_.fragment)),_}function y(_){let b=[];if(_.userinfo!==void 0&&(b.push(_.userinfo),b.push("@")),_.host!==void 0){let g=unescape(_.host),m=i(g);if(m.isIPV4)g=m.host;else{let S=a(m.host);S.isIPV6===!0?g=`[${S.escapedHost}]`:g=_.host}b.push(g)}return(typeof _.port=="number"||typeof _.port=="string")&&(b.push(":"),b.push(String(_.port))),b.length?b.join(""):void 0}t.exports={recomposeAuthority:y,normalizeComponentEncoding:v,removeDotSegments:h,normalizeIPv4:i,normalizeIPv6:a,stringArrayToHexStripped:s}}),f2e=be((e,t)=>{var r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function i(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}function s(m){return m.host||(m.error=m.error||"HTTP URIs must have a host."),m}function o(m){let S=String(m.scheme).toLowerCase()==="https";return(m.port===(S?443:80)||m.port==="")&&(m.port=void 0),m.path||(m.path="/"),m}function a(m){return m.secure=i(m),m.resourceName=(m.path||"/")+(m.query?"?"+m.query:""),m.path=void 0,m.query=void 0,m}function u(m){if((m.port===(i(m)?443:80)||m.port==="")&&(m.port=void 0),typeof m.secure=="boolean"&&(m.scheme=m.secure?"wss":"ws",m.secure=void 0),m.resourceName){let[S,w]=m.resourceName.split("?");m.path=S&&S!=="/"?S:void 0,m.query=w,m.resourceName=void 0}return m.fragment=void 0,m}function l(m,S){if(!m.path)return m.error="URN can not be parsed",m;let w=m.path.match(n);if(w){let k=S.scheme||m.scheme||"urn";m.nid=w[1].toLowerCase(),m.nss=w[2];let x=`${k}:${S.nid||m.nid}`,R=g[x];m.path=void 0,R&&(m=R.parse(m,S))}else m.error=m.error||"URN can not be parsed.";return m}function c(m,S){let w=S.scheme||m.scheme||"urn",k=m.nid.toLowerCase(),x=`${w}:${S.nid||k}`,R=g[x];R&&(m=R.serialize(m,S));let E=m,P=m.nss;return E.path=`${k||S.nid}:${P}`,S.skipEscape=!0,E}function d(m,S){let w=m;return w.uuid=w.nss,w.nss=void 0,!S.tolerant&&(!w.uuid||!r.test(w.uuid))&&(w.error=w.error||"UUID is not valid."),w}function p(m){let S=m;return S.nss=(m.uuid||"").toLowerCase(),S}var f={scheme:"http",domainHost:!0,parse:s,serialize:o},h={scheme:"https",domainHost:f.domainHost,parse:s,serialize:o},v={scheme:"ws",domainHost:!0,parse:a,serialize:u},y={scheme:"wss",domainHost:v.domainHost,parse:v.parse,serialize:v.serialize},_={scheme:"urn",parse:l,serialize:c,skipNormalize:!0},b={scheme:"urn:uuid",parse:d,serialize:p,skipNormalize:!0},g={http:f,https:h,ws:v,wss:y,urn:_,"urn:uuid":b};t.exports=g}),p2e=be((e,t)=>{var{normalizeIPv6:r,normalizeIPv4:n,removeDotSegments:i,recomposeAuthority:s,normalizeComponentEncoding:o}=d2e(),a=f2e();function u(b,g){return typeof b=="string"?b=p(y(b,g),g):typeof b=="object"&&(b=y(p(b,g),g)),b}function l(b,g,m){let S=Object.assign({scheme:"null"},m),w=c(y(b,S),y(g,S),S,!0);return p(w,{...S,skipEscape:!0})}function c(b,g,m,S){let w={};return S||(b=y(p(b,m),m),g=y(p(g,m),m)),m=m||{},!m.tolerant&&g.scheme?(w.scheme=g.scheme,w.userinfo=g.userinfo,w.host=g.host,w.port=g.port,w.path=i(g.path||""),w.query=g.query):(g.userinfo!==void 0||g.host!==void 0||g.port!==void 0?(w.userinfo=g.userinfo,w.host=g.host,w.port=g.port,w.path=i(g.path||""),w.query=g.query):(g.path?(g.path.charAt(0)==="/"?w.path=i(g.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?w.path="/"+g.path:b.path?w.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+g.path:w.path=g.path,w.path=i(w.path)),w.query=g.query):(w.path=b.path,g.query!==void 0?w.query=g.query:w.query=b.query),w.userinfo=b.userinfo,w.host=b.host,w.port=b.port),w.scheme=b.scheme),w.fragment=g.fragment,w}function d(b,g,m){return typeof b=="string"?(b=unescape(b),b=p(o(y(b,m),!0),{...m,skipEscape:!0})):typeof b=="object"&&(b=p(o(b,!0),{...m,skipEscape:!0})),typeof g=="string"?(g=unescape(g),g=p(o(y(g,m),!0),{...m,skipEscape:!0})):typeof g=="object"&&(g=p(o(g,!0),{...m,skipEscape:!0})),b.toLowerCase()===g.toLowerCase()}function p(b,g){let m={host:b.host,scheme:b.scheme,userinfo:b.userinfo,port:b.port,path:b.path,query:b.query,nid:b.nid,nss:b.nss,uuid:b.uuid,fragment:b.fragment,reference:b.reference,resourceName:b.resourceName,secure:b.secure,error:""},S=Object.assign({},g),w=[],k=a[(S.scheme||m.scheme||"").toLowerCase()];k&&k.serialize&&k.serialize(m,S),m.path!==void 0&&(S.skipEscape?m.path=unescape(m.path):(m.path=escape(m.path),m.scheme!==void 0&&(m.path=m.path.split("%3A").join(":")))),S.reference!=="suffix"&&m.scheme&&w.push(m.scheme,":");let x=s(m);if(x!==void 0&&(S.reference!=="suffix"&&w.push("//"),w.push(x),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){let R=m.path;!S.absolutePath&&(!k||!k.absolutePath)&&(R=i(R)),x===void 0&&(R=R.replace(/^\/\//u,"/%2F")),w.push(R)}return m.query!==void 0&&w.push("?",m.query),m.fragment!==void 0&&w.push("#",m.fragment),w.join("")}var f=Array.from({length:127},(b,g)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(g)));function h(b){let g=0;for(let m=0,S=b.length;m<S;++m)if(g=b.charCodeAt(m),g>126||f[g])return!0;return!1}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(b,g){let m=Object.assign({},g),S={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},w=b.indexOf("%")!==-1,k=!1;m.reference==="suffix"&&(b=(m.scheme?m.scheme+":":"")+"//"+b);let x=b.match(v);if(x){if(S.scheme=x[1],S.userinfo=x[3],S.host=x[4],S.port=parseInt(x[5],10),S.path=x[6]||"",S.query=x[7],S.fragment=x[8],isNaN(S.port)&&(S.port=x[5]),S.host){let E=n(S.host);if(E.isIPV4===!1){let P=r(E.host);S.host=P.host.toLowerCase(),k=P.isIPV6}else S.host=E.host,k=!0}S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&S.query===void 0&&!S.path?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",m.reference&&m.reference!=="suffix"&&m.reference!==S.reference&&(S.error=S.error||"URI is not a "+m.reference+" reference.");let R=a[(m.scheme||S.scheme||"").toLowerCase()];if(!m.unicodeSupport&&(!R||!R.unicodeSupport)&&S.host&&(m.domainHost||R&&R.domainHost)&&k===!1&&h(S.host))try{S.host=URL.domainToASCII(S.host.toLowerCase())}catch(E){S.error=S.error||"Host's domain name can not be converted to ASCII: "+E}(!R||R&&!R.skipNormalize)&&(w&&S.scheme!==void 0&&(S.scheme=unescape(S.scheme)),w&&S.host!==void 0&&(S.host=unescape(S.host)),S.path&&(S.path=escape(unescape(S.path))),S.fragment&&(S.fragment=encodeURI(decodeURIComponent(S.fragment)))),R&&R.parse&&R.parse(S,m)}else S.error=S.error||"URI can not be parsed.";return S}var _={SCHEMES:a,normalize:u,resolve:l,resolveComponents:c,equal:d,serialize:p,parse:y};t.exports=_,t.exports.default=_,t.exports.fastUri=_}),h2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=p2e();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),m2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=_S();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ut();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var n=cD(),i=vS(),s=zee(),o=dD(),a=ut(),u=yS(),l=lS(),c=Nt(),d=l2e(),p=h2e(),f=(Z,z)=>new RegExp(Z,z);f.code="new RegExp";var h=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},b=200;function g(Z){var z,B,q,I,D,O,j,V,Y,me,Ce,F,M,X,ee,he,Te,ze,_t,Ot,jt,ft,ni,it,Ia;let Oa=Z.strict,nr=(z=Z.code)===null||z===void 0?void 0:z.optimize,ii=nr===!0||nr===void 0?1:nr||0,RF=(q=(B=Z.code)===null||B===void 0?void 0:B.regExp)!==null&&q!==void 0?q:f,Bi=(I=Z.uriResolver)!==null&&I!==void 0?I:p.default;return{strictSchema:(O=(D=Z.strictSchema)!==null&&D!==void 0?D:Oa)!==null&&O!==void 0?O:!0,strictNumbers:(V=(j=Z.strictNumbers)!==null&&j!==void 0?j:Oa)!==null&&V!==void 0?V:!0,strictTypes:(me=(Y=Z.strictTypes)!==null&&Y!==void 0?Y:Oa)!==null&&me!==void 0?me:"log",strictTuples:(F=(Ce=Z.strictTuples)!==null&&Ce!==void 0?Ce:Oa)!==null&&F!==void 0?F:"log",strictRequired:(X=(M=Z.strictRequired)!==null&&M!==void 0?M:Oa)!==null&&X!==void 0?X:!1,code:Z.code?{...Z.code,optimize:ii,regExp:RF}:{optimize:ii,regExp:RF},loopRequired:(ee=Z.loopRequired)!==null&&ee!==void 0?ee:b,loopEnum:(he=Z.loopEnum)!==null&&he!==void 0?he:b,meta:(Te=Z.meta)!==null&&Te!==void 0?Te:!0,messages:(ze=Z.messages)!==null&&ze!==void 0?ze:!0,inlineRefs:(_t=Z.inlineRefs)!==null&&_t!==void 0?_t:!0,schemaId:(Ot=Z.schemaId)!==null&&Ot!==void 0?Ot:"$id",addUsedSchema:(jt=Z.addUsedSchema)!==null&&jt!==void 0?jt:!0,validateSchema:(ft=Z.validateSchema)!==null&&ft!==void 0?ft:!0,validateFormats:(ni=Z.validateFormats)!==null&&ni!==void 0?ni:!0,unicodeRegExp:(it=Z.unicodeRegExp)!==null&&it!==void 0?it:!0,int32range:(Ia=Z.int32range)!==null&&Ia!==void 0?Ia:!0,uriResolver:Bi}}class m{constructor(z={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,z=this.opts={...z,...g(z)};let{es5:B,lines:q}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:v,es5:B,lines:q}),this.logger=C(z.logger);let I=z.validateFormats;z.validateFormats=!1,this.RULES=(0,s.getRules)(),S.call(this,y,z,"NOT SUPPORTED"),S.call(this,_,z,"DEPRECATED","warn"),this._metaOpts=E.call(this),z.formats&&x.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),z.keywords&&R.call(this,z.keywords),typeof z.meta=="object"&&this.addMetaSchema(z.meta),k.call(this),z.validateFormats=I}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:z,meta:B,schemaId:q}=this.opts,I=d;q==="id"&&(I={...d},I.id=I.$id,delete I.$id),B&&z&&this.addMetaSchema(I,I[q],!1)}defaultMeta(){let{meta:z,schemaId:B}=this.opts;return this.opts.defaultMeta=typeof z=="object"?z[B]||z:void 0}validate(z,B){let q;if(typeof z=="string"){if(q=this.getSchema(z),!q)throw Error(`no schema with key or ref "${z}"`)}else q=this.compile(z);let I=q(B);return"$async"in q||(this.errors=q.errors),I}compile(z,B){let q=this._addSchema(z,B);return q.validate||this._compileSchemaEnv(q)}compileAsync(z,B){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:q}=this.opts;return I.call(this,z,B);async function I(me,Ce){await D.call(this,me.$schema);let F=this._addSchema(me,Ce);return F.validate||O.call(this,F)}async function D(me){me&&!this.getSchema(me)&&await I.call(this,{$ref:me},!0)}async function O(me){try{return this._compileSchemaEnv(me)}catch(Ce){if(!(Ce instanceof i.default))throw Ce;return j.call(this,Ce),await V.call(this,Ce.missingSchema),O.call(this,me)}}function j({missingSchema:me,missingRef:Ce}){if(this.refs[me])throw Error(`AnySchema ${me} is loaded but ${Ce} cannot be resolved`)}async function V(me){let Ce=await Y.call(this,me);this.refs[me]||await D.call(this,Ce.$schema),this.refs[me]||this.addSchema(Ce,me,B)}async function Y(me){let Ce=this._loading[me];if(Ce)return Ce;try{return await(this._loading[me]=q(me))}finally{delete this._loading[me]}}}addSchema(z,B,q,I=this.opts.validateSchema){if(Array.isArray(z)){for(let O of z)this.addSchema(O,void 0,q,I);return this}let D;if(typeof z=="object"){let{schemaId:O}=this.opts;if(D=z[O],D!==void 0&&typeof D!="string")throw Error(`schema ${O} must be string`)}return B=(0,u.normalizeId)(B||D),this._checkUnique(B),this.schemas[B]=this._addSchema(z,q,B,I,!0),this}addMetaSchema(z,B,q=this.opts.validateSchema){return this.addSchema(z,B,!0,q),this}validateSchema(z,B){if(typeof z=="boolean")return!0;let q;if(q=z.$schema,q!==void 0&&typeof q!="string")throw Error("$schema must be a string");if(q=q||this.opts.defaultMeta||this.defaultMeta(),!q)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let I=this.validate(q,z);if(!I&&B){let D="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(D);else throw Error(D)}return I}getSchema(z){let B;for(;typeof(B=w.call(this,z))=="string";)z=B;if(B===void 0){let{schemaId:q}=this.opts,I=new o.SchemaEnv({schema:{},schemaId:q});if(B=o.resolveSchema.call(this,I,z),!B)return;this.refs[z]=B}return B.validate||this._compileSchemaEnv(B)}removeSchema(z){if(z instanceof RegExp)return this._removeAllSchemas(this.schemas,z),this._removeAllSchemas(this.refs,z),this;switch(typeof z){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let B=w.call(this,z);return typeof B=="object"&&this._cache.delete(B.schema),delete this.schemas[z],delete this.refs[z],this}case"object":{let B=z;this._cache.delete(B);let q=z[this.opts.schemaId];return q&&(q=(0,u.normalizeId)(q),delete this.schemas[q],delete this.refs[q]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(z){for(let B of z)this.addKeyword(B);return this}addKeyword(z,B){let q;if(typeof z=="string")q=z,typeof B=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),B.keyword=q);else if(typeof z=="object"&&B===void 0){if(B=z,q=B.keyword,Array.isArray(q)&&!q.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(N.call(this,q,B),!B)return(0,c.eachItem)(q,D=>A.call(this,D)),this;H.call(this,B);let I={...B,type:(0,l.getJSONTypes)(B.type),schemaType:(0,l.getJSONTypes)(B.schemaType)};return(0,c.eachItem)(q,I.type.length===0?D=>A.call(this,D,I):D=>I.type.forEach(O=>A.call(this,D,I,O))),this}getKeyword(z){let B=this.RULES.all[z];return typeof B=="object"?B.definition:!!B}removeKeyword(z){let{RULES:B}=this;delete B.keywords[z],delete B.all[z];for(let q of B.rules){let I=q.rules.findIndex(D=>D.keyword===z);I>=0&&q.rules.splice(I,1)}return this}addFormat(z,B){return typeof B=="string"&&(B=new RegExp(B)),this.formats[z]=B,this}errorsText(z=this.errors,{separator:B=", ",dataVar:q="data"}={}){return!z||z.length===0?"No errors":z.map(I=>`${q}${I.instancePath} ${I.message}`).reduce((I,D)=>I+B+D)}$dataMetaSchema(z,B){let q=this.RULES.all;z=JSON.parse(JSON.stringify(z));for(let I of B){let D=I.split("/").slice(1),O=z;for(let j of D)O=O[j];for(let j in q){let V=q[j];if(typeof V!="object")continue;let{$data:Y}=V.definition,me=O[j];Y&&me&&(O[j]=ne(me))}}return z}_removeAllSchemas(z,B){for(let q in z){let I=z[q];(!B||B.test(q))&&(typeof I=="string"?delete z[q]:I&&!I.meta&&(this._cache.delete(I.schema),delete z[q]))}}_addSchema(z,B,q,I=this.opts.validateSchema,D=this.opts.addUsedSchema){let O,{schemaId:j}=this.opts;if(typeof z=="object")O=z[j];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof z!="boolean")throw Error("schema must be object or boolean")}let V=this._cache.get(z);if(V!==void 0)return V;q=(0,u.normalizeId)(O||q);let Y=u.getSchemaRefs.call(this,z,q);return V=new o.SchemaEnv({schema:z,schemaId:j,meta:B,baseId:q,localRefs:Y}),this._cache.set(V.schema,V),D&&!q.startsWith("#")&&(q&&this._checkUnique(q),this.refs[q]=V),I&&this.validateSchema(z,!0),V}_checkUnique(z){if(this.schemas[z]||this.refs[z])throw Error(`schema with key or id "${z}" already exists`)}_compileSchemaEnv(z){if(z.meta?this._compileMetaSchema(z):o.compileSchema.call(this,z),!z.validate)throw Error("ajv implementation error");return z.validate}_compileMetaSchema(z){let B=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,z)}finally{this.opts=B}}}m.ValidationError=n.default,m.MissingRefError=i.default,e.default=m;function S(Z,z,B,q="error"){for(let I in Z){let D=I;D in z&&this.logger[q](`${B}: option ${I}. ${Z[D]}`)}}function w(Z){return Z=(0,u.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function k(){let Z=this.opts.schemas;if(Z)if(Array.isArray(Z))this.addSchema(Z);else for(let z in Z)this.addSchema(Z[z],z)}function x(){for(let Z in this.opts.formats){let z=this.opts.formats[Z];z&&this.addFormat(Z,z)}}function R(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in Z){let B=Z[z];B.keyword||(B.keyword=z),this.addKeyword(B)}}function E(){let Z={...this.opts};for(let z of h)delete Z[z];return Z}var P={log(){},warn(){},error(){}};function C(Z){if(Z===!1)return P;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw Error("logger must implement log, warn and error methods")}var $=/^[a-z_$][a-z0-9_$:-]*$/i;function N(Z,z){let{RULES:B}=this;if((0,c.eachItem)(Z,q=>{if(B.keywords[q])throw Error(`Keyword ${q} is already defined`);if(!$.test(q))throw Error(`Keyword ${q} has invalid name`)}),!!z&&z.$data&&!("code"in z||"validate"in z))throw Error('$data keyword must have "code" or "validate" function')}function A(Z,z,B){var q;let I=z?.post;if(B&&I)throw Error('keyword with "post" flag cannot have "type"');let{RULES:D}=this,O=I?D.post:D.rules.find(({type:V})=>V===B);if(O||(O={type:B,rules:[]},D.rules.push(O)),D.keywords[Z]=!0,!z)return;let j={keyword:Z,definition:{...z,type:(0,l.getJSONTypes)(z.type),schemaType:(0,l.getJSONTypes)(z.schemaType)}};z.before?W.call(this,O,j,z.before):O.rules.push(j),D.all[Z]=j,(q=z.implements)===null||q===void 0||q.forEach(V=>this.addKeyword(V))}function W(Z,z,B){let q=Z.rules.findIndex(I=>I.keyword===B);q>=0?Z.rules.splice(q,0,z):(Z.rules.push(z),this.logger.warn(`rule ${B} is not defined`))}function H(Z){let{metaSchema:z}=Z;z!==void 0&&(Z.$data&&this.opts.$data&&(z=ne(z)),Z.validateSchema=this.compile(z,!0))}var te={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ne(Z){return{anyOf:[Z,te]}}}),g2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),y2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=vS(),r=Zs(),n=ut(),i=xu(),s=dD(),o=Nt(),a={keyword:"$ref",schemaType:"string",code(c){let{gen:d,schema:p,it:f}=c,{baseId:h,schemaEnv:v,validateName:y,opts:_,self:b}=f,{root:g}=v;if((p==="#"||p==="#/")&&h===g.baseId)return S();let m=s.resolveRef.call(b,g,h,p);if(m===void 0)throw new t.default(f.opts.uriResolver,h,p);if(m instanceof s.SchemaEnv)return w(m);return k(m);function S(){if(v===g)return l(c,y,v,v.$async);let x=d.scopeValue("root",{ref:g});return l(c,n._`${x}.validate`,g,g.$async)}function w(x){let R=u(c,x);l(c,R,x,x.$async)}function k(x){let R=d.scopeValue("schema",_.code.source===!0?{ref:x,code:(0,n.stringify)(x)}:{ref:x}),E=d.name("valid"),P=c.subschema({schema:x,dataTypes:[],schemaPath:n.nil,topSchemaRef:R,errSchemaPath:p},E);c.mergeEvaluated(P),c.ok(E)}}};function u(c,d){let{gen:p}=c;return d.validate?p.scopeValue("validate",{ref:d.validate}):n._`${p.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=u;function l(c,d,p,f){let{gen:h,it:v}=c,{allErrors:y,schemaEnv:_,opts:b}=v,g=b.passContext?i.default.this:n.nil;f?m():S();function m(){if(!_.$async)throw Error("async schema referenced by sync schema");let x=h.let("valid");h.try(()=>{h.code(n._`await ${(0,r.callValidateCode)(c,d,g)}`),k(d),!y&&h.assign(x,!0)},R=>{h.if(n._`!(${R} instanceof ${v.ValidationError})`,()=>h.throw(R)),w(R),!y&&h.assign(x,!1)}),c.ok(x)}function S(){c.result((0,r.callValidateCode)(c,d,g),()=>k(d),()=>w(d))}function w(x){let R=n._`${x}.errors`;h.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${R} : ${i.default.vErrors}.concat(${R})`),h.assign(i.default.errors,n._`${i.default.vErrors}.length`)}function k(x){var R;if(!v.opts.unevaluated)return;let E=(R=p?.validate)===null||R===void 0?void 0:R.evaluated;if(v.props!==!0)if(E&&!E.dynamicProps)E.props!==void 0&&(v.props=o.mergeEvaluated.props(h,E.props,v.props));else{let P=h.var("props",n._`${x}.evaluated.props`);v.props=o.mergeEvaluated.props(h,P,v.props,n.Name)}if(v.items!==!0)if(E&&!E.dynamicItems)E.items!==void 0&&(v.items=o.mergeEvaluated.items(h,E.items,v.items));else{let P=h.var("items",n._`${x}.evaluated.items`);v.items=o.mergeEvaluated.items(h,P,v.items,n.Name)}}}e.callRef=l,e.default=a}),_2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=g2e(),r=y2e(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),v2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},i={message:({keyword:o,schemaCode:a})=>t.str`must be ${n[o].okStr} ${a}`,params:({keyword:o,schemaCode:a})=>t._`{comparison: ${n[o].okStr}, limit: ${a}}`},s={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l}=o;o.fail$data(t._`${u} ${n[a].fail} ${l} || isNaN(${u})`)}};e.default=s}),b2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message:({schemaCode:i})=>t.str`must be multiple of ${i}`,params:({schemaCode:i})=>t._`{multipleOf: ${i}}`},n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r,code(i){let{gen:s,data:o,schemaCode:a,it:u}=i,l=u.opts.multipleOfPrecision,c=s.let("res"),d=l?t._`Math.abs(Math.round(${c}) - ${c}) > 1e-${l}`:t._`${c} !== parseInt(${c})`;i.fail$data(t._`(${a} === 0 || (${c} = ${o}/${a}, ${d}))`)}};e.default=n}),w2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,i=0,s=0,o;for(;s<n;)i++,o=r.charCodeAt(s++),o>=55296&&o<=56319&&s<n&&(o=r.charCodeAt(s),(o&64512)===56320&&s++);return i}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),S2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=w2e(),i={message({keyword:o,schemaCode:a}){let u=o==="maxLength"?"more":"fewer";return t.str`must NOT have ${u} than ${a} characters`},params:({schemaCode:o})=>t._`{limit: ${o}}`},s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l,it:c}=o,d=a==="maxLength"?t.operators.GT:t.operators.LT,p=c.opts.unicode===!1?t._`${u}.length`:t._`${(0,r.useFunc)(o.gen,n.default)}(${u})`;o.fail$data(t._`${p} ${d} ${l}`)}};e.default=s}),k2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n={message:({schemaCode:s})=>r.str`must match pattern "${s}"`,params:({schemaCode:s})=>r._`{pattern: ${s}}`},i={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:n,code(s){let{data:o,$data:a,schema:u,schemaCode:l,it:c}=s,d=c.opts.unicodeRegExp?"u":"",p=a?r._`(new RegExp(${l}, ${d}))`:(0,t.usePattern)(s,u);s.fail$data(r._`!${p}.test(${o})`)}};e.default=i}),x2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message({keyword:i,schemaCode:s}){let o=i==="maxProperties"?"more":"fewer";return t.str`must NOT have ${o} than ${s} properties`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxProperties"?t.operators.GT:t.operators.LT;i.fail$data(t._`Object.keys(${o}).length ${u} ${a}`)}};e.default=n}),$2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=Nt(),i={message:({params:{missingProperty:o}})=>r.str`must have required property '${o}'`,params:({params:{missingProperty:o}})=>r._`{missingProperty: ${o}}`},s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,schema:u,schemaCode:l,data:c,$data:d,it:p}=o,{opts:f}=p;if(!d&&u.length===0)return;let h=u.length>=f.loopRequired;if(p.allErrors?v():y(),f.strictRequired){let g=o.parentSchema.properties,{definedProperties:m}=o.it;for(let S of u)if(g?.[S]===void 0&&!m.has(S)){let w=p.schemaEnv.baseId+p.errSchemaPath,k=`required property "${S}" is not defined at "${w}" (strictRequired)`;(0,n.checkStrictMode)(p,k,p.opts.strictRequired)}}function v(){if(h||d)o.block$data(r.nil,_);else for(let g of u)(0,t.checkReportMissingProp)(o,g)}function y(){let g=a.let("missing");if(h||d){let m=a.let("valid",!0);o.block$data(m,()=>b(g,m)),o.ok(m)}else a.if((0,t.checkMissingProp)(o,u,g)),(0,t.reportMissingProp)(o,g),a.else()}function _(){a.forOf("prop",l,g=>{o.setParams({missingProperty:g}),a.if((0,t.noPropertyInData)(a,c,g,f.ownProperties),()=>o.error())})}function b(g,m){o.setParams({missingProperty:g}),a.forOf(g,l,()=>{a.assign(m,(0,t.propertyInData)(a,c,g,f.ownProperties)),a.if((0,r.not)(m),()=>{o.error(),a.break()})},r.nil)}}};e.default=s}),E2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message({keyword:i,schemaCode:s}){let o=i==="maxItems"?"more":"fewer";return t.str`must NOT have ${o} than ${s} items`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxItems"?t.operators.GT:t.operators.LT;i.fail$data(t._`${o}.length ${u} ${a}`)}};e.default=n}),fD=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Lee();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),T2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=lS(),r=ut(),n=Nt(),i=fD(),s={message:({params:{i:a,j:u}})=>r.str`must NOT have duplicate items (items ## ${u} and ${a} are identical)`,params:({params:{i:a,j:u}})=>r._`{i: ${a}, j: ${u}}`},o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:s,code(a){let{gen:u,data:l,$data:c,schema:d,parentSchema:p,schemaCode:f,it:h}=a;if(!c&&!d)return;let v=u.let("valid"),y=p.items?(0,t.getSchemaTypes)(p.items):[];a.block$data(v,_,r._`${f} === false`),a.ok(v);function _(){let S=u.let("i",r._`${l}.length`),w=u.let("j");a.setParams({i:S,j:w}),u.assign(v,!0),u.if(r._`${S} > 1`,()=>(b()?g:m)(S,w))}function b(){return y.length>0&&!y.some(S=>S==="object"||S==="array")}function g(S,w){let k=u.name("item"),x=(0,t.checkDataTypes)(y,k,h.opts.strictNumbers,t.DataType.Wrong),R=u.const("indices",r._`{}`);u.for(r._`;${S}--;`,()=>{u.let(k,r._`${l}[${S}]`),u.if(x,r._`continue`),y.length>1&&u.if(r._`typeof ${k} == "string"`,r._`${k} += "_"`),u.if(r._`typeof ${R}[${k}] == "number"`,()=>{u.assign(w,r._`${R}[${k}]`),a.error(),u.assign(v,!1).break()}).code(r._`${R}[${k}] = ${S}`)})}function m(S,w){let k=(0,n.useFunc)(u,i.default),x=u.name("outer");u.label(x).for(r._`;${S}--;`,()=>u.for(r._`${w} = ${S}; ${w}--;`,()=>u.if(r._`${k}(${l}[${S}], ${l}[${w}])`,()=>{a.error(),u.assign(v,!1).break(x)})))}}};e.default=o}),R2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=fD(),i={message:"must be equal to constant",params:({schemaCode:o})=>t._`{allowedValue: ${o}}`},s={keyword:"const",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schemaCode:c,schema:d}=o;l||d&&typeof d=="object"?o.fail$data(t._`!${(0,r.useFunc)(a,n.default)}(${u}, ${c})`):o.fail(t._`${d} !== ${u}`)}};e.default=s}),P2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=fD(),i={message:"must be equal to one of the allowed values",params:({schemaCode:o})=>t._`{allowedValues: ${o}}`},s={keyword:"enum",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schema:c,schemaCode:d,it:p}=o;if(!l&&c.length===0)throw Error("enum must have non-empty array");let f=c.length>=p.opts.loopEnum,h,v=()=>h??(h=(0,r.useFunc)(a,n.default)),y;if(f||l)y=a.let("valid"),o.block$data(y,_);else{if(!Array.isArray(c))throw Error("ajv implementation error");let g=a.const("vSchema",d);y=(0,t.or)(...c.map((m,S)=>b(g,S)))}o.pass(y);function _(){a.assign(y,!1),a.forOf("v",d,g=>a.if(t._`${v()}(${u}, ${g})`,()=>a.assign(y,!0).break()))}function b(g,m){let S=c[m];return typeof S=="object"&&S!==null?t._`${v()}(${u}, ${g}[${m}])`:t._`${u} === ${S}`}}};e.default=s}),I2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=v2e(),r=b2e(),n=S2e(),i=k2e(),s=x2e(),o=$2e(),a=E2e(),u=T2e(),l=R2e(),c=P2e(),d=[t.default,r.default,n.default,i.default,s.default,o.default,a.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,c.default];e.default=d}),qee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=ut(),r=Nt(),n={message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n,code(o){let{parentSchema:a,it:u}=o,{items:l}=a;if(!Array.isArray(l)){(0,r.checkStrictMode)(u,'"additionalItems" is ignored when "items" is not an array of schemas');return}s(o,l)}};function s(o,a){let{gen:u,schema:l,data:c,keyword:d,it:p}=o;p.items=!0;let f=u.const("len",t._`${c}.length`);if(l===!1)o.setParams({len:a.length}),o.pass(t._`${f} <= ${a.length}`);else if(typeof l=="object"&&!(0,r.alwaysValidSchema)(p,l)){let v=u.var("valid",t._`${f} <= ${a.length}`);u.if((0,t.not)(v),()=>h(v)),o.ok(v)}function h(v){u.forRange("i",a.length,f,y=>{o.subschema({keyword:d,dataProp:y,dataPropType:r.Type.Num},v),!p.allErrors&&u.if((0,t.not)(v),()=>u.break())})}}e.validateAdditionalItems=s,e.default=i}),Fee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=ut(),r=Nt(),n=Zs(),i={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(o){let{schema:a,it:u}=o;if(Array.isArray(a))return s(o,"additionalItems",a);u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&o.ok((0,n.validateArray)(o))}};function s(o,a,u=o.schema){let{gen:l,parentSchema:c,data:d,keyword:p,it:f}=o;y(c),f.opts.unevaluated&&u.length&&f.items!==!0&&(f.items=r.mergeEvaluated.items(l,u.length,f.items));let h=l.name("valid"),v=l.const("len",t._`${d}.length`);u.forEach((_,b)=>{(0,r.alwaysValidSchema)(f,_)||(l.if(t._`${v} > ${b}`,()=>o.subschema({keyword:p,schemaProp:b,dataProp:b},h)),o.ok(h))});function y(_){let{opts:b,errSchemaPath:g}=f,m=u.length,S=m===_.minItems&&(m===_.maxItems||_[a]===!1);if(b.strictTuples&&!S){let w=`"${p}" is ${m}-tuple, but minItems or maxItems/${a} are not specified or different at path "${g}"`;(0,r.checkStrictMode)(f,w,b.strictTuples)}}}e.validateTuple=s,e.default=i}),O2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fee(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};e.default=r}),C2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n=Zs(),i=qee(),s={message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:s,code(a){let{schema:u,parentSchema:l,it:c}=a,{prefixItems:d}=l;c.items=!0,!(0,r.alwaysValidSchema)(c,u)&&(d?(0,i.validateAdditionalItems)(a,d):a.ok((0,n.validateArray)(a)))}};e.default=o}),N2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:({params:{min:s,max:o}})=>o===void 0?t.str`must contain at least ${s} valid item(s)`:t.str`must contain at least ${s} and no more than ${o} valid item(s)`,params:({params:{min:s,max:o}})=>o===void 0?t._`{minContains: ${s}}`:t._`{minContains: ${s}, maxContains: ${o}}`},i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,data:l,it:c}=s,d,p,{minContains:f,maxContains:h}=u;c.opts.next?(d=f===void 0?1:f,p=h):d=1;let v=o.const("len",t._`${l}.length`);if(s.setParams({min:d,max:p}),p===void 0&&d===0){(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&d>p){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),s.fail();return}if((0,r.alwaysValidSchema)(c,a)){let m=t._`${v} >= ${d}`;p!==void 0&&(m=t._`${m} && ${v} <= ${p}`),s.pass(m);return}c.items=!0;let y=o.name("valid");p===void 0&&d===1?b(y,()=>o.if(y,()=>o.break())):d===0?(o.let(y,!0),p!==void 0&&o.if(t._`${l}.length > 0`,_)):(o.let(y,!1),_()),s.result(y,()=>s.reset());function _(){let m=o.name("_valid"),S=o.let("count",0);b(m,()=>o.if(m,()=>g(S)))}function b(m,S){o.forRange("i",0,v,w=>{s.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},m),S()})}function g(m){o.code(t._`${m}++`),p===void 0?o.if(t._`${m} >= ${d}`,()=>o.assign(y,!0).break()):(o.if(t._`${m} > ${p}`,()=>o.assign(y,!1).break()),d===1?o.assign(y,!0):o.if(t._`${m} >= ${d}`,()=>o.assign(y,!0)))}}};e.default=i}),A2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=ut(),r=Nt(),n=Zs();e.error={message:({params:{property:u,depsCount:l,deps:c}})=>{let d=l===1?"property":"properties";return t.str`must have ${d} ${c} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:c,missingProperty:d}})=>t._`{property: ${u},
467
467
  missingProperty: ${d},
468
468
  depsCount: ${l},
469
- deps: ${c}}`};var i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){let[l,c]=s(u);o(u,l),a(u,c)}};function s({schema:u}){let l={},c={};for(let d in u){if(d==="__proto__")continue;let p=Array.isArray(u[d])?l:c;p[d]=u[d]}return[l,c]}function o(u,l=u.schema){let{gen:c,data:d,it:p}=u;if(Object.keys(l).length===0)return;let f=c.let("missing");for(let h in l){let v=l[h];if(v.length===0)continue;let y=(0,n.propertyInData)(c,d,h,p.opts.ownProperties);u.setParams({property:h,depsCount:v.length,deps:v.join(", ")}),p.allErrors?c.if(y,()=>{for(let _ of v)(0,n.checkReportMissingProp)(u,_)}):(c.if(t._`${y} && (${(0,n.checkMissingProp)(u,v,f)})`),(0,n.reportMissingProp)(u,f),c.else())}}e.validatePropertyDeps=o;function a(u,l=u.schema){let{gen:c,data:d,keyword:p,it:f}=u,h=c.name("valid");for(let v in l)(0,r.alwaysValidSchema)(f,l[v])||(c.if((0,n.propertyInData)(c,d,v,f.opts.ownProperties),()=>{let y=u.subschema({keyword:p,schemaProp:v},h);u.mergeValidEvaluated(y,h)},()=>c.var(h,!0)),u.ok(h))}e.validateSchemaDeps=a,e.default=i}),D2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:"property name must be valid",params:({params:s})=>t._`{propertyName: ${s.propertyName}}`},i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:n,code(s){let{gen:o,schema:a,data:u,it:l}=s;if((0,r.alwaysValidSchema)(l,a))return;let c=o.name("valid");o.forIn("key",u,d=>{s.setParams({propertyName:d}),s.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},c),o.if((0,t.not)(c),()=>{s.error(!0),!l.allErrors&&o.break()})}),s.ok(c)}};e.default=i}),Uee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=xu(),i=Nt(),s={message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},o={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:s,code(a){let{gen:u,schema:l,parentSchema:c,data:d,errsCount:p,it:f}=a;if(!p)throw Error("ajv implementation error");let{allErrors:h,opts:v}=f;if(f.props=!0,v.removeAdditional!=="all"&&(0,i.alwaysValidSchema)(f,l))return;let y=(0,t.allSchemaProperties)(c.properties),_=(0,t.allSchemaProperties)(c.patternProperties);b(),a.ok(r._`${p} === ${n.default.errors}`);function b(){u.forIn("key",d,k=>{!y.length&&!_.length?S(k):u.if(g(k),()=>S(k))})}function g(k){let x;if(y.length>8){let R=(0,i.schemaRefOrVal)(f,c.properties,"properties");x=(0,t.isOwnProperty)(u,R,k)}else y.length?x=(0,r.or)(...y.map(R=>r._`${k} === ${R}`)):x=r.nil;return _.length&&(x=(0,r.or)(x,..._.map(R=>r._`${(0,t.usePattern)(a,R)}.test(${k})`))),(0,r.not)(x)}function m(k){u.code(r._`delete ${d}[${k}]`)}function S(k){if(v.removeAdditional==="all"||v.removeAdditional&&l===!1){m(k);return}if(l===!1){a.setParams({additionalProperty:k}),a.error(),!h&&u.break();return}if(typeof l=="object"&&!(0,i.alwaysValidSchema)(f,l)){let x=u.name("valid");v.removeAdditional==="failing"?(w(k,x,!1),u.if((0,r.not)(x),()=>{a.reset(),m(k)})):(w(k,x),!h&&u.if((0,r.not)(x),()=>u.break()))}}function w(k,x,R){let E={keyword:"additionalProperties",dataProp:k,dataPropType:i.Type.Str};R===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(E,x)}}};e.default=o}),j2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_S(),r=Zs(),n=Nt(),i=Uee(),s={keyword:"properties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,parentSchema:l,data:c,it:d}=o;d.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(d,i.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(u);for(let _ of p)d.definedProperties.add(_);d.opts.unevaluated&&p.length&&d.props!==!0&&(d.props=n.mergeEvaluated.props(a,(0,n.toHash)(p),d.props));let f=p.filter(_=>!(0,n.alwaysValidSchema)(d,u[_]));if(f.length===0)return;let h=a.name("valid");for(let _ of f)v(_)?y(_):(a.if((0,r.propertyInData)(a,c,_,d.opts.ownProperties)),y(_),!d.allErrors&&a.else().var(h,!0),a.endIf()),o.it.definedProperties.add(_),o.ok(h);function v(_){return d.opts.useDefaults&&!d.compositeRule&&u[_].default!==void 0}function y(_){o.subschema({keyword:"properties",schemaProp:_,dataProp:_},h)}}};e.default=s}),z2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=Nt(),i=Nt(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,data:l,parentSchema:c,it:d}=o,{opts:p}=d,f=(0,t.allSchemaProperties)(u),h=f.filter(S=>(0,n.alwaysValidSchema)(d,u[S]));if(f.length===0||h.length===f.length&&(!d.opts.unevaluated||d.props===!0))return;let v=p.strictSchema&&!p.allowMatchingProperties&&c.properties,y=a.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,i.evaluatedPropsToName)(a,d.props));let{props:_}=d;b();function b(){for(let S of f)v&&g(S),d.allErrors?m(S):(a.var(y,!0),m(S),a.if(y))}function g(S){for(let w in v)new RegExp(S).test(w)&&(0,n.checkStrictMode)(d,`property ${w} matches pattern ${S} (use allowMatchingProperties)`)}function m(S){a.forIn("key",l,w=>{a.if(r._`${(0,t.usePattern)(o,S)}.test(${w})`,()=>{let k=h.includes(S);k||o.subschema({keyword:"patternProperties",schemaProp:S,dataProp:w,dataPropType:i.Type.Str},y),d.opts.unevaluated&&_!==!0?a.assign(r._`${_}[${w}]`,!0):!k&&!d.allErrors&&a.if((0,r.not)(y),()=>a.break())})})}}};e.default=s}),M2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:i,schema:s,it:o}=n;if((0,t.alwaysValidSchema)(o,s)){n.fail();return}let a=i.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),n.failResult(a,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),L2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=r}),q2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:"must match exactly one schema in oneOf",params:({params:s})=>t._`{passingSchemas: ${s.passing}}`},i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,it:l}=s;if(!Array.isArray(a))throw Error("ajv implementation error");if(l.opts.discriminator&&u.discriminator)return;let c=a,d=o.let("valid",!1),p=o.let("passing",null),f=o.name("_valid");s.setParams({passing:p}),o.block(h),s.result(d,()=>s.reset(),()=>s.error(!0));function h(){c.forEach((v,y)=>{let _;(0,r.alwaysValidSchema)(l,v)?o.var(f,!0):_=s.subschema({keyword:"oneOf",schemaProp:y,compositeRule:!0},f),y>0&&o.if(t._`${f} && ${d}`).assign(d,!1).assign(p,t._`[${p}, ${y}]`).else(),o.if(f,()=>{o.assign(d,!0),o.assign(p,y),_&&s.mergeEvaluated(_,t.Name)})})}}};e.default=i}),F2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:i,schema:s,it:o}=n;if(!Array.isArray(s))throw Error("ajv implementation error");let a=i.name("valid");s.forEach((u,l)=>{if((0,t.alwaysValidSchema)(o,u))return;let c=n.subschema({keyword:"allOf",schemaProp:l},a);n.ok(a),n.mergeEvaluated(c)})}};e.default=r}),U2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:({params:o})=>t.str`must match "${o.ifClause}" schema`,params:({params:o})=>t._`{failingKeyword: ${o.ifClause}}`},i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:n,code(o){let{gen:a,parentSchema:u,it:l}=o;u.then===void 0&&u.else===void 0&&(0,r.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=s(l,"then"),d=s(l,"else");if(!c&&!d)return;let p=a.let("valid",!0),f=a.name("_valid");if(h(),o.reset(),c&&d){let y=a.let("ifClause");o.setParams({ifClause:y}),a.if(f,v("then",y),v("else",y))}else c?a.if(f,v("then")):a.if((0,t.not)(f),v("else"));o.pass(p,()=>o.error(!0));function h(){let y=o.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);o.mergeEvaluated(y)}function v(y,_){return()=>{let b=o.subschema({keyword:y},f);a.assign(p,f),o.mergeValidEvaluated(b,p),_?a.assign(_,t._`${y}`):o.setParams({ifClause:y})}}}};function s(o,a){let u=o.schema[a];return u!==void 0&&!(0,r.alwaysValidSchema)(o,u)}e.default=i}),Z2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:i,it:s}){i.if===void 0&&(0,t.checkStrictMode)(s,`"${n}" without "if" is ignored`)}};e.default=r}),V2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qee(),r=O2e(),n=Fee(),i=C2e(),s=N2e(),o=A2e(),a=D2e(),u=Uee(),l=j2e(),c=z2e(),d=M2e(),p=L2e(),f=q2e(),h=F2e(),v=U2e(),y=Z2e();function _(b=!1){let g=[d.default,p.default,f.default,h.default,v.default,y.default,a.default,u.default,o.default,l.default,c.default];return b?g.push(r.default,i.default):g.push(t.default,n.default),g.push(s.default),g}e.default=_}),H2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message:({schemaCode:i})=>t.str`must match format "${i}"`,params:({schemaCode:i})=>t._`{format: ${i}}`},n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:r,code(i,s){let{gen:o,data:a,$data:u,schema:l,schemaCode:c,it:d}=i,{opts:p,errSchemaPath:f,schemaEnv:h,self:v}=d;if(!p.validateFormats)return;u?y():_();function y(){let b=o.scopeValue("formats",{ref:v.formats,code:p.code.formats}),g=o.const("fDef",t._`${b}[${c}]`),m=o.let("fType"),S=o.let("format");o.if(t._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>o.assign(m,t._`${g}.type || "string"`).assign(S,t._`${g}.validate`),()=>o.assign(m,t._`"string"`).assign(S,g)),i.fail$data((0,t.or)(w(),k()));function w(){return p.strictSchema===!1?t.nil:t._`${c} && !${S}`}function k(){let x=h.$async?t._`(${g}.async ? await ${S}(${a}) : ${S}(${a}))`:t._`${S}(${a})`,R=t._`(typeof ${S} == "function" ? ${x} : ${S}.test(${a}))`;return t._`${S} && ${S} !== true && ${m} === ${s} && !${R}`}}function _(){let b=v.formats[l];if(!b){w();return}if(b===!0)return;let[g,m,S]=k(b);g===s&&i.pass(x());function w(){if(p.strictSchema===!1){v.logger.warn(R());return}throw Error(R());function R(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function k(R){let E=R instanceof RegExp?(0,t.regexpCode)(R):p.code.formats?t._`${p.code.formats}${(0,t.getProperty)(l)}`:void 0,P=o.scopeValue("formats",{key:l,ref:R,code:E});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,t._`${P}.validate`]:["string",R,P]}function x(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!h.$async)throw Error("async format in sync schema");return t._`await ${S}(${a})`}return typeof m=="function"?t._`${S}(${a})`:t._`${S}.test(${a})`}}}};e.default=n}),B2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=H2e(),r=[t.default];e.default=r}),W2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),J2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_2e(),r=I2e(),n=V2e(),i=B2e(),s=W2e(),o=[t.default,r.default,(0,n.default)(),i.default,s.metadataVocabulary,s.contentVocabulary];e.default=o}),G2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),K2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=G2e(),n=dD(),i=vS(),s=Nt(),o={message:({params:{discrError:u,tagName:l}})=>u===r.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:u,tag:l,tagName:c}})=>t._`{error: ${u}, tag: ${c}, tagValue: ${l}}`},a={keyword:"discriminator",type:"object",schemaType:"object",error:o,code(u){let{gen:l,data:c,schema:d,parentSchema:p,it:f}=u,{oneOf:h}=p;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let v=d.propertyName;if(typeof v!="string")throw Error("discriminator: requires propertyName");if(d.mapping)throw Error("discriminator: mapping is not supported");if(!h)throw Error("discriminator: requires oneOf keyword");let y=l.let("valid",!1),_=l.const("tag",t._`${c}${(0,t.getProperty)(v)}`);l.if(t._`typeof ${_} == "string"`,()=>b(),()=>u.error(!1,{discrError:r.DiscrError.Tag,tag:_,tagName:v})),u.ok(y);function b(){let S=m();l.if(!1);for(let w in S)l.elseIf(t._`${_} === ${w}`),l.assign(y,g(S[w]));l.else(),u.error(!1,{discrError:r.DiscrError.Mapping,tag:_,tagName:v}),l.endIf()}function g(S){let w=l.name("valid"),k=u.subschema({keyword:"oneOf",schemaProp:S},w);return u.mergeEvaluated(k,t.Name),w}function m(){var S;let w={},k=R(p),x=!0;for(let C=0;C<h.length;C++){let $=h[C];if($?.$ref&&!(0,s.schemaHasRulesButRef)($,f.self.RULES)){let A=$.$ref;if($=n.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,A),$ instanceof n.SchemaEnv&&($=$.schema),$===void 0)throw new i.default(f.opts.uriResolver,f.baseId,A)}let N=(S=$?.properties)===null||S===void 0?void 0:S[v];if(typeof N!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);x=x&&(k||R($)),E(N,C)}if(!x)throw Error(`discriminator: "${v}" must be required`);return w;function R({required:C}){return Array.isArray(C)&&C.includes(v)}function E(C,$){if(C.const)P(C.const,$);else if(C.enum)for(let N of C.enum)P(N,$);else throw Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function P(C,$){if(typeof C!="string"||C in w)throw Error(`discriminator: "${v}" values must be unique strings`);w[C]=$}}}};e.default=a}),Y2e=be((e,t)=>{t.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}}),Zee=be((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=m2e(),n=J2e(),i=K2e(),s=Y2e(),o=["/properties"],a="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let h=this.opts.$data?this.$dataMetaSchema(s,o):s;this.addMetaSchema(h,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var l=_S();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=ut();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var d=cD();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=vS();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),X2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(P,C){return{validate:P,compare:C}}e.fullFormats={date:t(s,o),time:t(u(!0),l),"date-time":t(p(!0),f),"iso-time":t(u(),c),"iso-date-time":t(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:g,int32:{type:"number",validate:w},int64:{type:"number",validate:k},float:{type:"number",validate:x},double:{type:"number",validate:x},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(P){return P%4===0&&(P%100!==0||P%400===0)}var n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(P){let C=n.exec(P);if(!C)return!1;let $=+C[1],N=+C[2],A=+C[3];return N>=1&&N<=12&&A>=1&&A<=(N===2&&r($)?29:i[N])}function o(P,C){if(P&&C)return P>C?1:P<C?-1:0}var a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(P){return function(C){let $=a.exec(C);if(!$)return!1;let N=+$[1],A=+$[2],W=+$[3],H=$[4],re=$[5]==="-"?-1:1,ne=+($[6]||0),Z=+($[7]||0);if(ne>23||Z>59||P&&!H)return!1;if(N<=23&&A<=59&&W<60)return!0;let z=A-Z*re,B=N-ne*re-(z<0?1:0);return(B===23||B===-1)&&(z===59||z===-1)&&W<61}}function l(P,C){if(!(P&&C))return;let $=new Date("2020-01-01T"+P).valueOf(),N=new Date("2020-01-01T"+C).valueOf();if($&&N)return $-N}function c(P,C){if(!(P&&C))return;let $=a.exec(P),N=a.exec(C);if($&&N)return P=$[1]+$[2]+$[3],C=N[1]+N[2]+N[3],P>C?1:P<C?-1:0}var d=/t|\s/i;function p(P){let C=u(P);return function($){let N=$.split(d);return N.length===2&&s(N[0])&&C(N[1])}}function f(P,C){if(!(P&&C))return;let $=new Date(P).valueOf(),N=new Date(C).valueOf();if($&&N)return $-N}function h(P,C){if(!(P&&C))return;let[$,N]=P.split(d),[A,W]=C.split(d),H=o($,A);if(H!==void 0)return H||l(N,W)}var v=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(P){return v.test(P)&&y.test(P)}var b=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function g(P){return b.lastIndex=0,b.test(P)}var m=-2147483648,S=2147483647;function w(P){return Number.isInteger(P)&&P<=S&&P>=m}function k(P){return Number.isInteger(P)}function x(){return!0}var R=/[^\\]\\Z/;function E(P){if(R.test(P))return!1;try{return new RegExp(P),!0}catch{return!1}}}),Q2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=Zee(),r=ut(),n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:a,schemaCode:u})=>r.str`should be ${i[a].okStr} ${u}`,params:({keyword:a,schemaCode:u})=>r._`{comparison: ${i[a].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:u,data:l,schemaCode:c,keyword:d,it:p}=a,{opts:f,self:h}=p;if(!f.validateFormats)return;let v=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");v.$data?y():_();function y(){let g=u.scopeValue("formats",{ref:h.formats,code:f.code.formats}),m=u.const("fmt",r._`${g}[${v.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${m} != "object"`,r._`${m} instanceof RegExp`,r._`typeof ${m}.compare != "function"`,b(m)))}function _(){let g=v.schema,m=h.formats[g];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${d}": format "${g}" does not define "compare" function`);let S=u.scopeValue("formats",{key:g,ref:m,code:f.code.formats?r._`${f.code.formats}${(0,r.getProperty)(g)}`:void 0});a.fail$data(b(S))}function b(g){return r._`${g}.compare(${l}, ${c}) ${i[d].fail} 0`}},dependencies:["format"]};var o=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=o}),e6e=be((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=X2e(),n=Q2e(),i=ut(),s=new i.Name("fullFormats"),o=new i.Name("fastFormats"),a=(l,c={keywords:!0})=>{if(Array.isArray(c))return u(l,c,r.fullFormats,s),l;let[d,p]=c.mode==="fast"?[r.fastFormats,o]:[r.fullFormats,s],f=c.formats||r.formatNames;return u(l,f,d,p),c.keywords&&(0,n.default)(l),l};a.get=(l,c="full")=>{let d=(c==="fast"?r.fastFormats:r.fullFormats)[l];if(!d)throw Error(`Unknown format "${l}"`);return d};function u(l,c,d,p){var f,h;(f=(h=l.opts.code).formats)!==null&&f!==void 0||(h.formats=i._`require("ajv-formats/dist/formats").${p}`);for(let v of c)l.addFormat(v,d[v])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),n6e=50;ac=class extends Error{};kf=null;f6e=typeof global=="object"&&global&&global.Object===Object&&global,p6e=f6e,h6e=typeof self=="object"&&self&&self.Object===Object&&self,m6e=p6e||h6e||Function("return this")(),pD=m6e,g6e=pD.Symbol,cS=g6e,Wee=Object.prototype,y6e=Wee.hasOwnProperty,_6e=Wee.toString,Eg=cS?cS.toStringTag:void 0;b6e=v6e,w6e=Object.prototype,S6e=w6e.toString;x6e=k6e,$6e="[object Null]",E6e="[object Undefined]",oee=cS?cS.toStringTag:void 0;R6e=T6e;Jee=P6e,I6e="[object AsyncFunction]",O6e="[object Function]",C6e="[object GeneratorFunction]",N6e="[object Proxy]";D6e=A6e,j6e=pD["__core-js_shared__"],FA=j6e,aee=(function(){var e=/[^.]+$/.exec(FA&&FA.keys&&FA.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();M6e=z6e,L6e=Function.prototype,q6e=L6e.toString;U6e=F6e,Z6e=/[\\^$.*+?()[\]{}|]/g,V6e=/^\[object .+?Constructor\]$/,H6e=Function.prototype,B6e=Object.prototype,W6e=H6e.toString,J6e=B6e.hasOwnProperty,G6e=RegExp("^"+W6e.call(J6e).replace(Z6e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");Y6e=K6e;Q6e=X6e;Gee=eZe,tZe=Gee(Object,"create"),Ig=tZe;nZe=rZe;sZe=iZe,oZe="__lodash_hash_undefined__",aZe=Object.prototype,uZe=aZe.hasOwnProperty;cZe=lZe,dZe=Object.prototype,fZe=dZe.hasOwnProperty;hZe=pZe,mZe="__lodash_hash_undefined__";yZe=gZe;Uf.prototype.clear=nZe;Uf.prototype.delete=sZe;Uf.prototype.get=cZe;Uf.prototype.has=hZe;Uf.prototype.set=yZe;uee=Uf;vZe=_Ze;wZe=bZe;bS=SZe,kZe=Array.prototype,xZe=kZe.splice;EZe=$Ze;RZe=TZe;IZe=PZe;CZe=OZe;Zf.prototype.clear=vZe;Zf.prototype.delete=EZe;Zf.prototype.get=RZe;Zf.prototype.has=IZe;Zf.prototype.set=CZe;NZe=Zf,AZe=Gee(pD,"Map"),DZe=AZe;zZe=jZe;LZe=MZe;wS=qZe;UZe=FZe;VZe=ZZe;BZe=HZe;JZe=WZe;Vf.prototype.clear=zZe;Vf.prototype.delete=UZe;Vf.prototype.get=VZe;Vf.prototype.has=BZe;Vf.prototype.set=JZe;Kee=Vf,GZe="Expected a function";hD.Cache=Kee;Hf=hD;XZe=Hf(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some(s=>s.startsWith("!")),n=t.some(s=>!s.startsWith("!"));if(r&&n)return null;let i=t.map(s=>s.replace(/^!/,"").toLowerCase());return{include:r?[]:i,exclude:r?i:[],isExclusive:r}});cVe={cwd(){return process.cwd()},existsSync(e){let t=[];try{let i=Nr(t,Dr`fs.existsSync(${e})`,0);return Je.existsSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},async stat(e){return rVe(e)},async readdir(e){return nVe(e,{withFileTypes:!0})},async unlink(e){return iVe(e)},async rmdir(e){return sVe(e)},async rm(e,t){return oVe(e,t)},async mkdir(e,t){await aVe(e,{recursive:!0,...t})},async readFile(e,t){return lee(e,{encoding:t.encoding})},async rename(e,t){return uVe(e,t)},statSync(e){let t=[];try{let i=Nr(t,Dr`fs.statSync(${e})`,0);return Je.statSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},lstatSync(e){let t=[];try{let i=Nr(t,Dr`fs.lstatSync(${e})`,0);return Je.lstatSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readFileSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.readFileSync(${e})`,0);return Je.readFileSync(e,{encoding:t.encoding})}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},readFileBytesSync(e){let t=[];try{let i=Nr(t,Dr`fs.readFileBytesSync(${e})`,0);return Je.readFileSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.readSync(${e}, ${t.length} bytes)`,0),o;try{o=Je.openSync(e,"r");let a=Buffer.alloc(t.length),u=Je.readSync(o,a,0,t.length,0);return{buffer:a,bytesRead:u}}finally{o&&Je.closeSync(o)}}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},appendFileSync(e,t,r){let n=[];try{let o=Nr(n,Dr`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(!Je.existsSync(e)&&r?.mode!==void 0){let a=Je.openSync(e,"a",r.mode);try{Je.appendFileSync(a,t)}finally{Je.closeSync(a)}}else Je.appendFileSync(e,t)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}},copyFileSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.copyFileSync(${e} → ${t})`,0);Je.copyFileSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},unlinkSync(e){let t=[];try{let i=Nr(t,Dr`fs.unlinkSync(${e})`,0);Je.unlinkSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},renameSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.renameSync(${e} → ${t})`,0);Je.renameSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},linkSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.linkSync(${e} → ${t})`,0);Je.linkSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},symlinkSync(e,t,r){let n=[];try{let o=Nr(n,Dr`fs.symlinkSync(${e} → ${t})`,0);Je.symlinkSync(e,t,r)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}},readlinkSync(e){let t=[];try{let i=Nr(t,Dr`fs.readlinkSync(${e})`,0);return Je.readlinkSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},realpathSync(e){let t=[];try{let i=Nr(t,Dr`fs.realpathSync(${e})`,0);return Je.realpathSync(e).normalize("NFC")}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},mkdirSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.mkdirSync(${e})`,0);if(!Je.existsSync(e)){let o={recursive:!0};t?.mode!==void 0&&(o.mode=t.mode),Je.mkdirSync(e,o)}}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},readdirSync(e){let t=[];try{let i=Nr(t,Dr`fs.readdirSync(${e})`,0);return Je.readdirSync(e,{withFileTypes:!0})}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readdirStringSync(e){let t=[];try{let i=Nr(t,Dr`fs.readdirStringSync(${e})`,0);return Je.readdirSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},isDirEmptySync(e){let t=[];try{let i=Nr(t,Dr`fs.isDirEmptySync(${e})`,0);return this.readdirSync(e).length===0}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},rmdirSync(e){let t=[];try{let i=Nr(t,Dr`fs.rmdirSync(${e})`,0);Je.rmdirSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},rmSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.rmSync(${e})`,0);Je.rmSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},createWriteStream(e){return Je.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return lee(e);let r=await lVe(e,"r");try{let{size:n}=await r.stat(),i=Math.min(n,t),s=Buffer.allocUnsafe(i),o=0;for(;o<i;){let{bytesRead:a}=await r.read(s,o,i-o,o);if(a===0)break;o+=a}return o<i?s.subarray(0,o):s}finally{await r.close()}}},dVe=cVe;mVe=hVe();dee=new Set;vVe=Hf(()=>see(process.env.DEBUG)||see(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||Qee()||process.argv.some(e=>e.startsWith("--debug="))||ete()!==null),bVe=Hf(()=>{let e=process.argv.find(r=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return XZe(t)}),Qee=Hf(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")),ete=Hf(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith("--debug-file="))return t.substring(13);if(t==="--debug-file"&&e+1<process.argv.length)return process.argv[e+1]}return null});SVe=!1,iS=null;xVe=Hf(()=>{if(process.argv[2]!=="--ripgrep")try{let e=tte(),t=Yee(e),r=Xee(t,"latest");try{Pg().mkdirSync(t)}catch{}try{Pg().unlinkSync(r)}catch{}Pg().symlinkSync(e,r)}catch{}}),Edt=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),$Ve={[Symbol.dispose](){}};Dr=EVe;rte=(e,t)=>{let r=[];try{let s=Nr(r,Dr`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}};BA=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(t){this.options=t,this.abortController=t.abortController||Vee(),this.initialize()}getDefaultExecutable(){return Hee()?"bun":"node"}spawnLocalProcess(t){let{command:r,args:n,cwd:i,env:s,signal:o}=t,a=s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",u=i6e(r,n,{cwd:i,stdio:["pipe","pipe",a],signal:o,env:s,windowsHide:!0});return(s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)&&u.stderr.on("data",l=>{let c=l.toString();fa(c),this.options.stderr&&this.options.stderr(c)}),{stdin:u.stdin,stdout:u.stdout,get killed(){return u.killed},get exitCode(){return u.exitCode},kill:u.kill.bind(u),on:u.on.bind(u),once:u.once.bind(u),off:u.off.bind(u)}}initialize(){try{let{additionalDirectories:t=[],agent:r,betas:n,cwd:i,executable:s=this.getDefaultExecutable(),executableArgs:o=[],extraArgs:a={},pathToClaudeCodeExecutable:u,env:l={...process.env},thinkingConfig:c,maxTurns:d,maxBudgetUsd:p,model:f,fallbackModel:h,jsonSchema:v,permissionMode:y,allowDangerouslySkipPermissions:_,permissionPromptToolName:b,continueConversation:g,resume:m,settingSources:S,allowedTools:w=[],disallowedTools:k=[],tools:x,mcpServers:R,strictMcpConfig:E,canUseTool:P,includePartialMessages:C,plugins:$,sandbox:N}=this.options,A=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(c)switch(c.type){case"enabled":c.budgetTokens===void 0?A.push("--thinking","adaptive"):A.push("--max-thinking-tokens",c.budgetTokens.toString());break;case"disabled":A.push("--thinking","disabled");break;case"adaptive":A.push("--thinking","adaptive");break}if(this.options.effort&&A.push("--effort",this.options.effort),d&&A.push("--max-turns",d.toString()),p!==void 0&&A.push("--max-budget-usd",p.toString()),f&&A.push("--model",f),r&&A.push("--agent",r),n&&n.length>0&&A.push("--betas",n.join(",")),v&&A.push("--json-schema",Po(v)),this.options.debugFile?A.push("--debug-file",this.options.debugFile):this.options.debug&&A.push("--debug"),l.DEBUG_CLAUDE_AGENT_SDK&&A.push("--debug-to-stderr"),P){if(b)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");A.push("--permission-prompt-tool","stdio")}else b&&A.push("--permission-prompt-tool",b);if(g&&A.push("--continue"),m&&A.push("--resume",m),w.length>0&&A.push("--allowedTools",w.join(",")),k.length>0&&A.push("--disallowedTools",k.join(",")),x!==void 0&&(Array.isArray(x)?x.length===0?A.push("--tools",""):A.push("--tools",x.join(",")):A.push("--tools","default")),R&&Object.keys(R).length>0&&A.push("--mcp-config",Po({mcpServers:R})),S&&A.push("--setting-sources",S.join(",")),E&&A.push("--strict-mcp-config"),y&&A.push("--permission-mode",y),_&&A.push("--allow-dangerously-skip-permissions"),h){if(f&&h===f)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");A.push("--fallback-model",h)}C&&A.push("--include-partial-messages");for(let B of t)A.push("--add-dir",B);if($&&$.length>0)for(let B of $)if(B.type==="local")A.push("--plugin-dir",B.path);else throw Error(`Unsupported plugin type: ${B.type}`);this.options.forkSession&&A.push("--fork-session"),this.options.resumeSessionAt&&A.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&A.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&A.push("--no-session-persistence");let W=TVe(a??{},N);for(let[B,q]of Object.entries(W))q===null?A.push(`--${B}`):A.push(`--${B}`,q);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,l.DEBUG_CLAUDE_AGENT_SDK?l.DEBUG="1":delete l.DEBUG;let H=RVe(u),re=H?u:s,ne=H?[...o,...A]:[...o,u,...A],Z={command:re,args:ne,cwd:i,env:l,signal:this.abortController.signal};this.options.spawnClaudeCodeProcess?(fa(`Spawning Claude Code (custom): ${re} ${ne.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(Z)):(fa(`Spawning Claude Code: ${re} ${ne.join(" ")}`),this.process=this.spawnLocalProcess(Z)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let z=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")};this.processExitHandler=z,this.abortHandler=z,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",B=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new ac("Claude Code process aborted by user");else if(B.code==="ENOENT"){let q=H?`Claude Code native binary not found at ${u}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${u}. Is options.pathToClaudeCodeExecutable set?`;this.exitError=ReferenceError(q),fa(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${B.message}`),fa(this.exitError.message)}),this.process.on("exit",(B,q)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new ac("Claude Code process aborted by user");else{let I=this.getProcessExitError(B,q);I&&(this.exitError=I,fa(I.message))}}),this.ready=!0}catch(t){throw this.ready=!1,t}}getProcessExitError(t,r){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(r)return Error(`Claude Code process terminated by signal ${r}`)}write(t){if(this.abortController.signal.aborted)throw new ac("Operation aborted");if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);fa(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||fa("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:t}of this.exitListeners)this.process?.off("exit",t);this.exitListeners=[],this.process&&!this.process.killed&&this.process.exitCode===null&&(this.process.kill("SIGTERM"),setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGKILL")},5e3).unref()),this.ready=!1,this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0)}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw Error("ProcessTransport output stream not available");let t=s6e({input:this.processStdout});try{for await(let r of t)if(r.trim())try{yield rte(r)}catch{throw fa(`Non-JSON stdout: ${r}`),Error(`CLI output was not valid JSON. This may indicate an error during startup. Output: ${r.slice(0,200)}${r.length>200?"...":""}`)}await this.waitForExit()}catch(r){throw r}finally{t.close()}}endInput(){this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let r=(n,i)=>{let s=this.getProcessExitError(n,i);t(s)};return this.process.on("exit",r),this.exitListeners.push({callback:t,handler:r}),()=>{this.process&&this.process.off("exit",r);let n=this.exitListeners.findIndex(i=>i.handler===r);n!==-1&&this.exitListeners.splice(n,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((t,r)=>{let n=(s,o)=>{if(this.abortController.signal.aborted){r(new ac("Operation aborted"));return}let a=this.getProcessExitError(s,o);a?r(a):t()};this.process.once("exit",n);let i=s=>{this.process.off("exit",n),r(s)};this.process.once("error",i),this.process.once("exit",()=>{this.process.off("error",i)})})}};WA=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,r)=>{this.readResolve=t,this.readReject=r})}enqueue(t){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},JA=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},GA=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new WA;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0}constructor(t,r,n,i,s,o=new Map,a,u,l){this.transport=t,this.isSingleUserTurn=r,this.canUseTool=n,this.hooks=i,this.abortController=s,this.jsonSchema=a,this.initConfig=u,this.onElicitation=l;for(let[c,d]of o)this.connectSdkMcpServer(c,d);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}close(){this.cleanup()}cleanup(t){if(!this.cleanupPerformed){this.cleanupPerformed=!0;try{this.transport.close();let r=Error("Query closed before response received");for(let{reject:n}of this.pendingControlResponses.values())n(r);this.pendingControlResponses.clear();for(let{reject:n}of this.pendingMcpResponses.values())n(r);this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let n of this.sdkMcpTransports.values())try{n.close()}catch{}this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}}}next(...[t]){return this.sdkMessages.next(t)}return(t){return this.sdkMessages.return(t)}throw(t){return this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let r=this.pendingControlResponses.get(t.response.request_id);r&&r.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else if(t.type==="keep_alive")continue;t.type==="streamlined_text"||t.type==="streamlined_tool_use_summary"||(t.type==="result"&&(this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(oc("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())),this.inputStream.enqueue(t))}this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){let r=new AbortController;this.cancelControllers.set(t.request_id,r);try{let n=await this.processControlRequest(t,r.signal),i={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:n}};await Promise.resolve(this.transport.write(Po(i)+`
469
+ deps: ${c}}`};var i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){let[l,c]=s(u);o(u,l),a(u,c)}};function s({schema:u}){let l={},c={};for(let d in u){if(d==="__proto__")continue;let p=Array.isArray(u[d])?l:c;p[d]=u[d]}return[l,c]}function o(u,l=u.schema){let{gen:c,data:d,it:p}=u;if(Object.keys(l).length===0)return;let f=c.let("missing");for(let h in l){let v=l[h];if(v.length===0)continue;let y=(0,n.propertyInData)(c,d,h,p.opts.ownProperties);u.setParams({property:h,depsCount:v.length,deps:v.join(", ")}),p.allErrors?c.if(y,()=>{for(let _ of v)(0,n.checkReportMissingProp)(u,_)}):(c.if(t._`${y} && (${(0,n.checkMissingProp)(u,v,f)})`),(0,n.reportMissingProp)(u,f),c.else())}}e.validatePropertyDeps=o;function a(u,l=u.schema){let{gen:c,data:d,keyword:p,it:f}=u,h=c.name("valid");for(let v in l)(0,r.alwaysValidSchema)(f,l[v])||(c.if((0,n.propertyInData)(c,d,v,f.opts.ownProperties),()=>{let y=u.subschema({keyword:p,schemaProp:v},h);u.mergeValidEvaluated(y,h)},()=>c.var(h,!0)),u.ok(h))}e.validateSchemaDeps=a,e.default=i}),D2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:"property name must be valid",params:({params:s})=>t._`{propertyName: ${s.propertyName}}`},i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:n,code(s){let{gen:o,schema:a,data:u,it:l}=s;if((0,r.alwaysValidSchema)(l,a))return;let c=o.name("valid");o.forIn("key",u,d=>{s.setParams({propertyName:d}),s.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},c),o.if((0,t.not)(c),()=>{s.error(!0),!l.allErrors&&o.break()})}),s.ok(c)}};e.default=i}),Uee=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=xu(),i=Nt(),s={message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},o={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:s,code(a){let{gen:u,schema:l,parentSchema:c,data:d,errsCount:p,it:f}=a;if(!p)throw Error("ajv implementation error");let{allErrors:h,opts:v}=f;if(f.props=!0,v.removeAdditional!=="all"&&(0,i.alwaysValidSchema)(f,l))return;let y=(0,t.allSchemaProperties)(c.properties),_=(0,t.allSchemaProperties)(c.patternProperties);b(),a.ok(r._`${p} === ${n.default.errors}`);function b(){u.forIn("key",d,k=>{!y.length&&!_.length?S(k):u.if(g(k),()=>S(k))})}function g(k){let x;if(y.length>8){let R=(0,i.schemaRefOrVal)(f,c.properties,"properties");x=(0,t.isOwnProperty)(u,R,k)}else y.length?x=(0,r.or)(...y.map(R=>r._`${k} === ${R}`)):x=r.nil;return _.length&&(x=(0,r.or)(x,..._.map(R=>r._`${(0,t.usePattern)(a,R)}.test(${k})`))),(0,r.not)(x)}function m(k){u.code(r._`delete ${d}[${k}]`)}function S(k){if(v.removeAdditional==="all"||v.removeAdditional&&l===!1){m(k);return}if(l===!1){a.setParams({additionalProperty:k}),a.error(),!h&&u.break();return}if(typeof l=="object"&&!(0,i.alwaysValidSchema)(f,l)){let x=u.name("valid");v.removeAdditional==="failing"?(w(k,x,!1),u.if((0,r.not)(x),()=>{a.reset(),m(k)})):(w(k,x),!h&&u.if((0,r.not)(x),()=>u.break()))}}function w(k,x,R){let E={keyword:"additionalProperties",dataProp:k,dataPropType:i.Type.Str};R===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(E,x)}}};e.default=o}),j2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_S(),r=Zs(),n=Nt(),i=Uee(),s={keyword:"properties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,parentSchema:l,data:c,it:d}=o;d.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(d,i.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(u);for(let _ of p)d.definedProperties.add(_);d.opts.unevaluated&&p.length&&d.props!==!0&&(d.props=n.mergeEvaluated.props(a,(0,n.toHash)(p),d.props));let f=p.filter(_=>!(0,n.alwaysValidSchema)(d,u[_]));if(f.length===0)return;let h=a.name("valid");for(let _ of f)v(_)?y(_):(a.if((0,r.propertyInData)(a,c,_,d.opts.ownProperties)),y(_),!d.allErrors&&a.else().var(h,!0),a.endIf()),o.it.definedProperties.add(_),o.ok(h);function v(_){return d.opts.useDefaults&&!d.compositeRule&&u[_].default!==void 0}function y(_){o.subschema({keyword:"properties",schemaProp:_,dataProp:_},h)}}};e.default=s}),z2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r=ut(),n=Nt(),i=Nt(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,data:l,parentSchema:c,it:d}=o,{opts:p}=d,f=(0,t.allSchemaProperties)(u),h=f.filter(S=>(0,n.alwaysValidSchema)(d,u[S]));if(f.length===0||h.length===f.length&&(!d.opts.unevaluated||d.props===!0))return;let v=p.strictSchema&&!p.allowMatchingProperties&&c.properties,y=a.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,i.evaluatedPropsToName)(a,d.props));let{props:_}=d;b();function b(){for(let S of f)v&&g(S),d.allErrors?m(S):(a.var(y,!0),m(S),a.if(y))}function g(S){for(let w in v)new RegExp(S).test(w)&&(0,n.checkStrictMode)(d,`property ${w} matches pattern ${S} (use allowMatchingProperties)`)}function m(S){a.forIn("key",l,w=>{a.if(r._`${(0,t.usePattern)(o,S)}.test(${w})`,()=>{let k=h.includes(S);k||o.subschema({keyword:"patternProperties",schemaProp:S,dataProp:w,dataPropType:i.Type.Str},y),d.opts.unevaluated&&_!==!0?a.assign(r._`${_}[${w}]`,!0):!k&&!d.allErrors&&a.if((0,r.not)(y),()=>a.break())})})}}};e.default=s}),M2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:i,schema:s,it:o}=n;if((0,t.alwaysValidSchema)(o,s)){n.fail();return}let a=i.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),n.failResult(a,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),L2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zs(),r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=r}),q2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:"must match exactly one schema in oneOf",params:({params:s})=>t._`{passingSchemas: ${s.passing}}`},i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,it:l}=s;if(!Array.isArray(a))throw Error("ajv implementation error");if(l.opts.discriminator&&u.discriminator)return;let c=a,d=o.let("valid",!1),p=o.let("passing",null),f=o.name("_valid");s.setParams({passing:p}),o.block(h),s.result(d,()=>s.reset(),()=>s.error(!0));function h(){c.forEach((v,y)=>{let _;(0,r.alwaysValidSchema)(l,v)?o.var(f,!0):_=s.subschema({keyword:"oneOf",schemaProp:y,compositeRule:!0},f),y>0&&o.if(t._`${f} && ${d}`).assign(d,!1).assign(p,t._`[${p}, ${y}]`).else(),o.if(f,()=>{o.assign(d,!0),o.assign(p,y),_&&s.mergeEvaluated(_,t.Name)})})}}};e.default=i}),F2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:i,schema:s,it:o}=n;if(!Array.isArray(s))throw Error("ajv implementation error");let a=i.name("valid");s.forEach((u,l)=>{if((0,t.alwaysValidSchema)(o,u))return;let c=n.subschema({keyword:"allOf",schemaProp:l},a);n.ok(a),n.mergeEvaluated(c)})}};e.default=r}),U2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=Nt(),n={message:({params:o})=>t.str`must match "${o.ifClause}" schema`,params:({params:o})=>t._`{failingKeyword: ${o.ifClause}}`},i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:n,code(o){let{gen:a,parentSchema:u,it:l}=o;u.then===void 0&&u.else===void 0&&(0,r.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=s(l,"then"),d=s(l,"else");if(!c&&!d)return;let p=a.let("valid",!0),f=a.name("_valid");if(h(),o.reset(),c&&d){let y=a.let("ifClause");o.setParams({ifClause:y}),a.if(f,v("then",y),v("else",y))}else c?a.if(f,v("then")):a.if((0,t.not)(f),v("else"));o.pass(p,()=>o.error(!0));function h(){let y=o.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);o.mergeEvaluated(y)}function v(y,_){return()=>{let b=o.subschema({keyword:y},f);a.assign(p,f),o.mergeValidEvaluated(b,p),_?a.assign(_,t._`${y}`):o.setParams({ifClause:y})}}}};function s(o,a){let u=o.schema[a];return u!==void 0&&!(0,r.alwaysValidSchema)(o,u)}e.default=i}),Z2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nt(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:i,it:s}){i.if===void 0&&(0,t.checkStrictMode)(s,`"${n}" without "if" is ignored`)}};e.default=r}),V2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qee(),r=O2e(),n=Fee(),i=C2e(),s=N2e(),o=A2e(),a=D2e(),u=Uee(),l=j2e(),c=z2e(),d=M2e(),p=L2e(),f=q2e(),h=F2e(),v=U2e(),y=Z2e();function _(b=!1){let g=[d.default,p.default,f.default,h.default,v.default,y.default,a.default,u.default,o.default,l.default,c.default];return b?g.push(r.default,i.default):g.push(t.default,n.default),g.push(s.default),g}e.default=_}),H2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r={message:({schemaCode:i})=>t.str`must match format "${i}"`,params:({schemaCode:i})=>t._`{format: ${i}}`},n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:r,code(i,s){let{gen:o,data:a,$data:u,schema:l,schemaCode:c,it:d}=i,{opts:p,errSchemaPath:f,schemaEnv:h,self:v}=d;if(!p.validateFormats)return;u?y():_();function y(){let b=o.scopeValue("formats",{ref:v.formats,code:p.code.formats}),g=o.const("fDef",t._`${b}[${c}]`),m=o.let("fType"),S=o.let("format");o.if(t._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>o.assign(m,t._`${g}.type || "string"`).assign(S,t._`${g}.validate`),()=>o.assign(m,t._`"string"`).assign(S,g)),i.fail$data((0,t.or)(w(),k()));function w(){return p.strictSchema===!1?t.nil:t._`${c} && !${S}`}function k(){let x=h.$async?t._`(${g}.async ? await ${S}(${a}) : ${S}(${a}))`:t._`${S}(${a})`,R=t._`(typeof ${S} == "function" ? ${x} : ${S}.test(${a}))`;return t._`${S} && ${S} !== true && ${m} === ${s} && !${R}`}}function _(){let b=v.formats[l];if(!b){w();return}if(b===!0)return;let[g,m,S]=k(b);g===s&&i.pass(x());function w(){if(p.strictSchema===!1){v.logger.warn(R());return}throw Error(R());function R(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function k(R){let E=R instanceof RegExp?(0,t.regexpCode)(R):p.code.formats?t._`${p.code.formats}${(0,t.getProperty)(l)}`:void 0,P=o.scopeValue("formats",{key:l,ref:R,code:E});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,t._`${P}.validate`]:["string",R,P]}function x(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!h.$async)throw Error("async format in sync schema");return t._`await ${S}(${a})`}return typeof m=="function"?t._`${S}(${a})`:t._`${S}.test(${a})`}}}};e.default=n}),B2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=H2e(),r=[t.default];e.default=r}),W2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),J2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_2e(),r=I2e(),n=V2e(),i=B2e(),s=W2e(),o=[t.default,r.default,(0,n.default)(),i.default,s.metadataVocabulary,s.contentVocabulary];e.default=o}),G2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),K2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut(),r=G2e(),n=dD(),i=vS(),s=Nt(),o={message:({params:{discrError:u,tagName:l}})=>u===r.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:u,tag:l,tagName:c}})=>t._`{error: ${u}, tag: ${c}, tagValue: ${l}}`},a={keyword:"discriminator",type:"object",schemaType:"object",error:o,code(u){let{gen:l,data:c,schema:d,parentSchema:p,it:f}=u,{oneOf:h}=p;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let v=d.propertyName;if(typeof v!="string")throw Error("discriminator: requires propertyName");if(d.mapping)throw Error("discriminator: mapping is not supported");if(!h)throw Error("discriminator: requires oneOf keyword");let y=l.let("valid",!1),_=l.const("tag",t._`${c}${(0,t.getProperty)(v)}`);l.if(t._`typeof ${_} == "string"`,()=>b(),()=>u.error(!1,{discrError:r.DiscrError.Tag,tag:_,tagName:v})),u.ok(y);function b(){let S=m();l.if(!1);for(let w in S)l.elseIf(t._`${_} === ${w}`),l.assign(y,g(S[w]));l.else(),u.error(!1,{discrError:r.DiscrError.Mapping,tag:_,tagName:v}),l.endIf()}function g(S){let w=l.name("valid"),k=u.subschema({keyword:"oneOf",schemaProp:S},w);return u.mergeEvaluated(k,t.Name),w}function m(){var S;let w={},k=R(p),x=!0;for(let C=0;C<h.length;C++){let $=h[C];if($?.$ref&&!(0,s.schemaHasRulesButRef)($,f.self.RULES)){let A=$.$ref;if($=n.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,A),$ instanceof n.SchemaEnv&&($=$.schema),$===void 0)throw new i.default(f.opts.uriResolver,f.baseId,A)}let N=(S=$?.properties)===null||S===void 0?void 0:S[v];if(typeof N!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);x=x&&(k||R($)),E(N,C)}if(!x)throw Error(`discriminator: "${v}" must be required`);return w;function R({required:C}){return Array.isArray(C)&&C.includes(v)}function E(C,$){if(C.const)P(C.const,$);else if(C.enum)for(let N of C.enum)P(N,$);else throw Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function P(C,$){if(typeof C!="string"||C in w)throw Error(`discriminator: "${v}" values must be unique strings`);w[C]=$}}}};e.default=a}),Y2e=be((e,t)=>{t.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}}),Zee=be((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=m2e(),n=J2e(),i=K2e(),s=Y2e(),o=["/properties"],a="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let h=this.opts.$data?this.$dataMetaSchema(s,o):s;this.addMetaSchema(h,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var l=_S();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=ut();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var d=cD();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=vS();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),X2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(P,C){return{validate:P,compare:C}}e.fullFormats={date:t(s,o),time:t(u(!0),l),"date-time":t(p(!0),f),"iso-time":t(u(),c),"iso-date-time":t(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:g,int32:{type:"number",validate:w},int64:{type:"number",validate:k},float:{type:"number",validate:x},double:{type:"number",validate:x},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(P){return P%4===0&&(P%100!==0||P%400===0)}var n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(P){let C=n.exec(P);if(!C)return!1;let $=+C[1],N=+C[2],A=+C[3];return N>=1&&N<=12&&A>=1&&A<=(N===2&&r($)?29:i[N])}function o(P,C){if(P&&C)return P>C?1:P<C?-1:0}var a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(P){return function(C){let $=a.exec(C);if(!$)return!1;let N=+$[1],A=+$[2],W=+$[3],H=$[4],te=$[5]==="-"?-1:1,ne=+($[6]||0),Z=+($[7]||0);if(ne>23||Z>59||P&&!H)return!1;if(N<=23&&A<=59&&W<60)return!0;let z=A-Z*te,B=N-ne*te-(z<0?1:0);return(B===23||B===-1)&&(z===59||z===-1)&&W<61}}function l(P,C){if(!(P&&C))return;let $=new Date("2020-01-01T"+P).valueOf(),N=new Date("2020-01-01T"+C).valueOf();if($&&N)return $-N}function c(P,C){if(!(P&&C))return;let $=a.exec(P),N=a.exec(C);if($&&N)return P=$[1]+$[2]+$[3],C=N[1]+N[2]+N[3],P>C?1:P<C?-1:0}var d=/t|\s/i;function p(P){let C=u(P);return function($){let N=$.split(d);return N.length===2&&s(N[0])&&C(N[1])}}function f(P,C){if(!(P&&C))return;let $=new Date(P).valueOf(),N=new Date(C).valueOf();if($&&N)return $-N}function h(P,C){if(!(P&&C))return;let[$,N]=P.split(d),[A,W]=C.split(d),H=o($,A);if(H!==void 0)return H||l(N,W)}var v=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(P){return v.test(P)&&y.test(P)}var b=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function g(P){return b.lastIndex=0,b.test(P)}var m=-2147483648,S=2147483647;function w(P){return Number.isInteger(P)&&P<=S&&P>=m}function k(P){return Number.isInteger(P)}function x(){return!0}var R=/[^\\]\\Z/;function E(P){if(R.test(P))return!1;try{return new RegExp(P),!0}catch{return!1}}}),Q2e=be(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=Zee(),r=ut(),n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:a,schemaCode:u})=>r.str`should be ${i[a].okStr} ${u}`,params:({keyword:a,schemaCode:u})=>r._`{comparison: ${i[a].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:u,data:l,schemaCode:c,keyword:d,it:p}=a,{opts:f,self:h}=p;if(!f.validateFormats)return;let v=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");v.$data?y():_();function y(){let g=u.scopeValue("formats",{ref:h.formats,code:f.code.formats}),m=u.const("fmt",r._`${g}[${v.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${m} != "object"`,r._`${m} instanceof RegExp`,r._`typeof ${m}.compare != "function"`,b(m)))}function _(){let g=v.schema,m=h.formats[g];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${d}": format "${g}" does not define "compare" function`);let S=u.scopeValue("formats",{key:g,ref:m,code:f.code.formats?r._`${f.code.formats}${(0,r.getProperty)(g)}`:void 0});a.fail$data(b(S))}function b(g){return r._`${g}.compare(${l}, ${c}) ${i[d].fail} 0`}},dependencies:["format"]};var o=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=o}),e6e=be((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=X2e(),n=Q2e(),i=ut(),s=new i.Name("fullFormats"),o=new i.Name("fastFormats"),a=(l,c={keywords:!0})=>{if(Array.isArray(c))return u(l,c,r.fullFormats,s),l;let[d,p]=c.mode==="fast"?[r.fastFormats,o]:[r.fullFormats,s],f=c.formats||r.formatNames;return u(l,f,d,p),c.keywords&&(0,n.default)(l),l};a.get=(l,c="full")=>{let d=(c==="fast"?r.fastFormats:r.fullFormats)[l];if(!d)throw Error(`Unknown format "${l}"`);return d};function u(l,c,d,p){var f,h;(f=(h=l.opts.code).formats)!==null&&f!==void 0||(h.formats=i._`require("ajv-formats/dist/formats").${p}`);for(let v of c)l.addFormat(v,d[v])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),n6e=50;ac=class extends Error{};kf=null;f6e=typeof global=="object"&&global&&global.Object===Object&&global,p6e=f6e,h6e=typeof self=="object"&&self&&self.Object===Object&&self,m6e=p6e||h6e||Function("return this")(),pD=m6e,g6e=pD.Symbol,cS=g6e,Wee=Object.prototype,y6e=Wee.hasOwnProperty,_6e=Wee.toString,Eg=cS?cS.toStringTag:void 0;b6e=v6e,w6e=Object.prototype,S6e=w6e.toString;x6e=k6e,$6e="[object Null]",E6e="[object Undefined]",oee=cS?cS.toStringTag:void 0;R6e=T6e;Jee=P6e,I6e="[object AsyncFunction]",O6e="[object Function]",C6e="[object GeneratorFunction]",N6e="[object Proxy]";D6e=A6e,j6e=pD["__core-js_shared__"],FA=j6e,aee=(function(){var e=/[^.]+$/.exec(FA&&FA.keys&&FA.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();M6e=z6e,L6e=Function.prototype,q6e=L6e.toString;U6e=F6e,Z6e=/[\\^$.*+?()[\]{}|]/g,V6e=/^\[object .+?Constructor\]$/,H6e=Function.prototype,B6e=Object.prototype,W6e=H6e.toString,J6e=B6e.hasOwnProperty,G6e=RegExp("^"+W6e.call(J6e).replace(Z6e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");Y6e=K6e;Q6e=X6e;Gee=eZe,tZe=Gee(Object,"create"),Ig=tZe;nZe=rZe;sZe=iZe,oZe="__lodash_hash_undefined__",aZe=Object.prototype,uZe=aZe.hasOwnProperty;cZe=lZe,dZe=Object.prototype,fZe=dZe.hasOwnProperty;hZe=pZe,mZe="__lodash_hash_undefined__";yZe=gZe;Uf.prototype.clear=nZe;Uf.prototype.delete=sZe;Uf.prototype.get=cZe;Uf.prototype.has=hZe;Uf.prototype.set=yZe;uee=Uf;vZe=_Ze;wZe=bZe;bS=SZe,kZe=Array.prototype,xZe=kZe.splice;EZe=$Ze;RZe=TZe;IZe=PZe;CZe=OZe;Zf.prototype.clear=vZe;Zf.prototype.delete=EZe;Zf.prototype.get=RZe;Zf.prototype.has=IZe;Zf.prototype.set=CZe;NZe=Zf,AZe=Gee(pD,"Map"),DZe=AZe;zZe=jZe;LZe=MZe;wS=qZe;UZe=FZe;VZe=ZZe;BZe=HZe;JZe=WZe;Vf.prototype.clear=zZe;Vf.prototype.delete=UZe;Vf.prototype.get=VZe;Vf.prototype.has=BZe;Vf.prototype.set=JZe;Kee=Vf,GZe="Expected a function";hD.Cache=Kee;Hf=hD;XZe=Hf(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some(s=>s.startsWith("!")),n=t.some(s=>!s.startsWith("!"));if(r&&n)return null;let i=t.map(s=>s.replace(/^!/,"").toLowerCase());return{include:r?[]:i,exclude:r?i:[],isExclusive:r}});cVe={cwd(){return process.cwd()},existsSync(e){let t=[];try{let i=Nr(t,Dr`fs.existsSync(${e})`,0);return Je.existsSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},async stat(e){return rVe(e)},async readdir(e){return nVe(e,{withFileTypes:!0})},async unlink(e){return iVe(e)},async rmdir(e){return sVe(e)},async rm(e,t){return oVe(e,t)},async mkdir(e,t){await aVe(e,{recursive:!0,...t})},async readFile(e,t){return lee(e,{encoding:t.encoding})},async rename(e,t){return uVe(e,t)},statSync(e){let t=[];try{let i=Nr(t,Dr`fs.statSync(${e})`,0);return Je.statSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},lstatSync(e){let t=[];try{let i=Nr(t,Dr`fs.lstatSync(${e})`,0);return Je.lstatSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readFileSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.readFileSync(${e})`,0);return Je.readFileSync(e,{encoding:t.encoding})}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},readFileBytesSync(e){let t=[];try{let i=Nr(t,Dr`fs.readFileBytesSync(${e})`,0);return Je.readFileSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.readSync(${e}, ${t.length} bytes)`,0),o;try{o=Je.openSync(e,"r");let a=Buffer.alloc(t.length),u=Je.readSync(o,a,0,t.length,0);return{buffer:a,bytesRead:u}}finally{o&&Je.closeSync(o)}}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},appendFileSync(e,t,r){let n=[];try{let o=Nr(n,Dr`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(!Je.existsSync(e)&&r?.mode!==void 0){let a=Je.openSync(e,"a",r.mode);try{Je.appendFileSync(a,t)}finally{Je.closeSync(a)}}else Je.appendFileSync(e,t)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}},copyFileSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.copyFileSync(${e} → ${t})`,0);Je.copyFileSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},unlinkSync(e){let t=[];try{let i=Nr(t,Dr`fs.unlinkSync(${e})`,0);Je.unlinkSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},renameSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.renameSync(${e} → ${t})`,0);Je.renameSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},linkSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.linkSync(${e} → ${t})`,0);Je.linkSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},symlinkSync(e,t,r){let n=[];try{let o=Nr(n,Dr`fs.symlinkSync(${e} → ${t})`,0);Je.symlinkSync(e,t,r)}catch(o){var i=o,s=1}finally{Ar(n,i,s)}},readlinkSync(e){let t=[];try{let i=Nr(t,Dr`fs.readlinkSync(${e})`,0);return Je.readlinkSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},realpathSync(e){let t=[];try{let i=Nr(t,Dr`fs.realpathSync(${e})`,0);return Je.realpathSync(e).normalize("NFC")}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},mkdirSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.mkdirSync(${e})`,0);if(!Je.existsSync(e)){let o={recursive:!0};t?.mode!==void 0&&(o.mode=t.mode),Je.mkdirSync(e,o)}}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},readdirSync(e){let t=[];try{let i=Nr(t,Dr`fs.readdirSync(${e})`,0);return Je.readdirSync(e,{withFileTypes:!0})}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},readdirStringSync(e){let t=[];try{let i=Nr(t,Dr`fs.readdirStringSync(${e})`,0);return Je.readdirSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},isDirEmptySync(e){let t=[];try{let i=Nr(t,Dr`fs.isDirEmptySync(${e})`,0);return this.readdirSync(e).length===0}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},rmdirSync(e){let t=[];try{let i=Nr(t,Dr`fs.rmdirSync(${e})`,0);Je.rmdirSync(e)}catch(i){var r=i,n=1}finally{Ar(t,r,n)}},rmSync(e,t){let r=[];try{let s=Nr(r,Dr`fs.rmSync(${e})`,0);Je.rmSync(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}},createWriteStream(e){return Je.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return lee(e);let r=await lVe(e,"r");try{let{size:n}=await r.stat(),i=Math.min(n,t),s=Buffer.allocUnsafe(i),o=0;for(;o<i;){let{bytesRead:a}=await r.read(s,o,i-o,o);if(a===0)break;o+=a}return o<i?s.subarray(0,o):s}finally{await r.close()}}},dVe=cVe;mVe=hVe();dee=new Set;vVe=Hf(()=>see(process.env.DEBUG)||see(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||Qee()||process.argv.some(e=>e.startsWith("--debug="))||ete()!==null),bVe=Hf(()=>{let e=process.argv.find(r=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return XZe(t)}),Qee=Hf(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")),ete=Hf(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith("--debug-file="))return t.substring(13);if(t==="--debug-file"&&e+1<process.argv.length)return process.argv[e+1]}return null});SVe=!1,iS=null;xVe=Hf(()=>{if(process.argv[2]!=="--ripgrep")try{let e=tte(),t=Yee(e),r=Xee(t,"latest");try{Pg().mkdirSync(t)}catch{}try{Pg().unlinkSync(r)}catch{}Pg().symlinkSync(e,r)}catch{}}),Edt=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),$Ve={[Symbol.dispose](){}};Dr=EVe;rte=(e,t)=>{let r=[];try{let s=Nr(r,Dr`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(s){var n=s,i=1}finally{Ar(r,n,i)}};BA=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(t){this.options=t,this.abortController=t.abortController||Vee(),this.initialize()}getDefaultExecutable(){return Hee()?"bun":"node"}spawnLocalProcess(t){let{command:r,args:n,cwd:i,env:s,signal:o}=t,a=s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",u=i6e(r,n,{cwd:i,stdio:["pipe","pipe",a],signal:o,env:s,windowsHide:!0});return(s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)&&u.stderr.on("data",l=>{let c=l.toString();fa(c),this.options.stderr&&this.options.stderr(c)}),{stdin:u.stdin,stdout:u.stdout,get killed(){return u.killed},get exitCode(){return u.exitCode},kill:u.kill.bind(u),on:u.on.bind(u),once:u.once.bind(u),off:u.off.bind(u)}}initialize(){try{let{additionalDirectories:t=[],agent:r,betas:n,cwd:i,executable:s=this.getDefaultExecutable(),executableArgs:o=[],extraArgs:a={},pathToClaudeCodeExecutable:u,env:l={...process.env},thinkingConfig:c,maxTurns:d,maxBudgetUsd:p,model:f,fallbackModel:h,jsonSchema:v,permissionMode:y,allowDangerouslySkipPermissions:_,permissionPromptToolName:b,continueConversation:g,resume:m,settingSources:S,allowedTools:w=[],disallowedTools:k=[],tools:x,mcpServers:R,strictMcpConfig:E,canUseTool:P,includePartialMessages:C,plugins:$,sandbox:N}=this.options,A=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(c)switch(c.type){case"enabled":c.budgetTokens===void 0?A.push("--thinking","adaptive"):A.push("--max-thinking-tokens",c.budgetTokens.toString());break;case"disabled":A.push("--thinking","disabled");break;case"adaptive":A.push("--thinking","adaptive");break}if(this.options.effort&&A.push("--effort",this.options.effort),d&&A.push("--max-turns",d.toString()),p!==void 0&&A.push("--max-budget-usd",p.toString()),f&&A.push("--model",f),r&&A.push("--agent",r),n&&n.length>0&&A.push("--betas",n.join(",")),v&&A.push("--json-schema",Po(v)),this.options.debugFile?A.push("--debug-file",this.options.debugFile):this.options.debug&&A.push("--debug"),l.DEBUG_CLAUDE_AGENT_SDK&&A.push("--debug-to-stderr"),P){if(b)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");A.push("--permission-prompt-tool","stdio")}else b&&A.push("--permission-prompt-tool",b);if(g&&A.push("--continue"),m&&A.push("--resume",m),w.length>0&&A.push("--allowedTools",w.join(",")),k.length>0&&A.push("--disallowedTools",k.join(",")),x!==void 0&&(Array.isArray(x)?x.length===0?A.push("--tools",""):A.push("--tools",x.join(",")):A.push("--tools","default")),R&&Object.keys(R).length>0&&A.push("--mcp-config",Po({mcpServers:R})),S&&A.push("--setting-sources",S.join(",")),E&&A.push("--strict-mcp-config"),y&&A.push("--permission-mode",y),_&&A.push("--allow-dangerously-skip-permissions"),h){if(f&&h===f)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");A.push("--fallback-model",h)}C&&A.push("--include-partial-messages");for(let B of t)A.push("--add-dir",B);if($&&$.length>0)for(let B of $)if(B.type==="local")A.push("--plugin-dir",B.path);else throw Error(`Unsupported plugin type: ${B.type}`);this.options.forkSession&&A.push("--fork-session"),this.options.resumeSessionAt&&A.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&A.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&A.push("--no-session-persistence");let W=TVe(a??{},N);for(let[B,q]of Object.entries(W))q===null?A.push(`--${B}`):A.push(`--${B}`,q);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,l.DEBUG_CLAUDE_AGENT_SDK?l.DEBUG="1":delete l.DEBUG;let H=RVe(u),te=H?u:s,ne=H?[...o,...A]:[...o,u,...A],Z={command:te,args:ne,cwd:i,env:l,signal:this.abortController.signal};this.options.spawnClaudeCodeProcess?(fa(`Spawning Claude Code (custom): ${te} ${ne.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(Z)):(fa(`Spawning Claude Code: ${te} ${ne.join(" ")}`),this.process=this.spawnLocalProcess(Z)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let z=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")};this.processExitHandler=z,this.abortHandler=z,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",B=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new ac("Claude Code process aborted by user");else if(B.code==="ENOENT"){let q=H?`Claude Code native binary not found at ${u}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${u}. Is options.pathToClaudeCodeExecutable set?`;this.exitError=ReferenceError(q),fa(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${B.message}`),fa(this.exitError.message)}),this.process.on("exit",(B,q)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new ac("Claude Code process aborted by user");else{let I=this.getProcessExitError(B,q);I&&(this.exitError=I,fa(I.message))}}),this.ready=!0}catch(t){throw this.ready=!1,t}}getProcessExitError(t,r){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(r)return Error(`Claude Code process terminated by signal ${r}`)}write(t){if(this.abortController.signal.aborted)throw new ac("Operation aborted");if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);fa(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||fa("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:t}of this.exitListeners)this.process?.off("exit",t);this.exitListeners=[],this.process&&!this.process.killed&&this.process.exitCode===null&&(this.process.kill("SIGTERM"),setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGKILL")},5e3).unref()),this.ready=!1,this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0)}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw Error("ProcessTransport output stream not available");let t=s6e({input:this.processStdout});try{for await(let r of t)if(r.trim())try{yield rte(r)}catch{throw fa(`Non-JSON stdout: ${r}`),Error(`CLI output was not valid JSON. This may indicate an error during startup. Output: ${r.slice(0,200)}${r.length>200?"...":""}`)}await this.waitForExit()}catch(r){throw r}finally{t.close()}}endInput(){this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let r=(n,i)=>{let s=this.getProcessExitError(n,i);t(s)};return this.process.on("exit",r),this.exitListeners.push({callback:t,handler:r}),()=>{this.process&&this.process.off("exit",r);let n=this.exitListeners.findIndex(i=>i.handler===r);n!==-1&&this.exitListeners.splice(n,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((t,r)=>{let n=(s,o)=>{if(this.abortController.signal.aborted){r(new ac("Operation aborted"));return}let a=this.getProcessExitError(s,o);a?r(a):t()};this.process.once("exit",n);let i=s=>{this.process.off("exit",n),r(s)};this.process.once("error",i),this.process.once("exit",()=>{this.process.off("error",i)})})}};WA=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,r)=>{this.readResolve=t,this.readReject=r})}enqueue(t){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},JA=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},GA=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new WA;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0}constructor(t,r,n,i,s,o=new Map,a,u,l){this.transport=t,this.isSingleUserTurn=r,this.canUseTool=n,this.hooks=i,this.abortController=s,this.jsonSchema=a,this.initConfig=u,this.onElicitation=l;for(let[c,d]of o)this.connectSdkMcpServer(c,d);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}close(){this.cleanup()}cleanup(t){if(!this.cleanupPerformed){this.cleanupPerformed=!0;try{this.transport.close();let r=Error("Query closed before response received");for(let{reject:n}of this.pendingControlResponses.values())n(r);this.pendingControlResponses.clear();for(let{reject:n}of this.pendingMcpResponses.values())n(r);this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let n of this.sdkMcpTransports.values())try{n.close()}catch{}this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}}}next(...[t]){return this.sdkMessages.next(t)}return(t){return this.sdkMessages.return(t)}throw(t){return this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let r=this.pendingControlResponses.get(t.response.request_id);r&&r.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else if(t.type==="keep_alive")continue;t.type==="streamlined_text"||t.type==="streamlined_tool_use_summary"||(t.type==="result"&&(this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(oc("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())),this.inputStream.enqueue(t))}this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){let r=new AbortController;this.cancelControllers.set(t.request_id,r);try{let n=await this.processControlRequest(t,r.signal),i={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:n}};await Promise.resolve(this.transport.write(Po(i)+`
470
470
  `))}catch(n){let i={type:"control_response",response:{subtype:"error",request_id:t.request_id,error:n.message||String(n)}};await Promise.resolve(this.transport.write(Po(i)+`
471
471
  `))}finally{this.cancelControllers.delete(t.request_id)}}handleControlCancelRequest(t){let r=this.cancelControllers.get(t.request_id);r&&(r.abort(),this.cancelControllers.delete(t.request_id))}async processControlRequest(t,r){if(t.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(t.request.tool_name,t.request.input,{signal:r,suggestions:t.request.permission_suggestions,blockedPath:t.request.blocked_path,decisionReason:t.request.decision_reason,toolUseID:t.request.tool_use_id,agentID:t.request.agent_id}),toolUseID:t.request.tool_use_id}}else{if(t.request.subtype==="hook_callback")return await this.handleHookCallbacks(t.request.callback_id,t.request.input,t.request.tool_use_id,r);if(t.request.subtype==="mcp_message"){let n=t.request,i=this.sdkMcpTransports.get(n.server_name);if(!i)throw Error(`SDK MCP server not found: ${n.server_name}`);return"method"in n.message&&"id"in n.message&&n.message.id!==null?{mcp_response:await this.handleMcpControlRequest(n.server_name,n,i)}:(i.onmessage&&i.onmessage(n.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}else if(t.request.subtype==="elicitation"){let n=t.request;return this.onElicitation?await this.onElicitation({serverName:n.mcp_server_name,message:n.message,mode:n.mode,url:n.url,elicitationId:n.elicitation_id,requestedSchema:n.requested_schema},{signal:r}):{action:"decline"}}}throw Error("Unsupported control request subtype: "+t.request.subtype)}async*readSdkMessages(){for await(let t of this.inputStream)yield t}async initialize(){let t;if(this.hooks){t={};for(let[i,s]of Object.entries(this.hooks))s.length>0&&(t[i]=s.map(o=>{let a=[];for(let u of o.hooks){let l=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(l,u),a.push(l)}return{matcher:o.matcher,hookCallbackIds:a,timeout:o.timeout}}))}let r=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,n={subtype:"initialize",hooks:t,sdkMcpServers:r,jsonSchema:this.jsonSchema,systemPrompt:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,agents:this.initConfig?.agents,promptSuggestions:this.initConfig?.promptSuggestions};return(await this.request(n)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(t){await this.request({subtype:"set_permission_mode",mode:t})}async setModel(t){await this.request({subtype:"set_model",model:t})}async setMaxThinkingTokens(t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:t})}async applyFlagSettings(t){await this.request({subtype:"apply_flag_settings",settings:t})}async rewindFiles(t,r){return(await this.request({subtype:"rewind_files",user_message_id:t,dry_run:r?.dryRun})).response}async enableRemoteControl(t){return(await this.request({subtype:"remote_control",enabled:t})).response}async processPendingPermissionRequests(t){for(let r of t)r.request.subtype==="can_use_tool"&&this.handleControlRequest(r).catch(()=>{})}request(t){let r=Math.random().toString(36).substring(2,15),n={request_id:r,type:"control_request",request:t};return new Promise((i,s)=>{this.pendingControlResponses.set(r,{handler:o=>{this.pendingControlResponses.delete(r),o.subtype==="success"?i(o):(s(Error(o.error)),o.pending_permission_requests&&this.processPendingPermissionRequests(o.pending_permission_requests))},reject:s}),Promise.resolve(this.transport.write(Po(n)+`
472
472
  `))})}async initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(t){await this.request({subtype:"mcp_reconnect",serverName:t})}async toggleMcpServer(t,r){await this.request({subtype:"mcp_toggle",serverName:t,enabled:r})}async mcpAuthenticate(t){return(await this.request({subtype:"mcp_authenticate",serverName:t})).response}async mcpClearAuth(t){return(await this.request({subtype:"mcp_clear_auth",serverName:t})).response}async mcpSubmitOAuthCallbackUrl(t,r){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:t,callbackUrl:r})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async setMcpServers(t){let r={},n={};for(let[a,u]of Object.entries(t))u.type==="sdk"&&"instance"in u?r[a]=u.instance:n[a]=u;let i=new Set(this.sdkMcpServerInstances.keys()),s=new Set(Object.keys(r));for(let a of i)s.has(a)||await this.disconnectSdkMcpServer(a);for(let[a,u]of Object.entries(r))i.has(a)||this.connectSdkMcpServer(a,u);let o={};for(let a of Object.keys(r))o[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...n,...o}})).response}async accountInfo(){return(await this.initialization).account}async streamInput(t){oc("[Query.streamInput] Starting to process input stream");try{let r=0;for await(let n of t){if(r++,oc(`[Query.streamInput] Processing message ${r}: ${n.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(Po(n)+`
@@ -513,7 +513,7 @@ ${P}`:k?l.systemPrompt=k:P&&(l.systemPrompt={type:"preset",preset:"claude_code",
513
513
  `;)this.buffer=this.buffer.slice(1),this.consumedNewlines++;return this.consumedNewlines>=2||this.buffer.length>0&&this.buffer[0]!==`
514
514
  `?(this.state="text",!0):!1}emitText(t){t&&this.onText(t)}emitThought(t){if(t)if(this.thoughtEmitted)this.onThought(t);else{let r=t.replace(/^\s+/,"");r&&(this.thoughtEmitted=!0,this.onThought(r))}}}});import{promises as LS}from"node:fs";import Dre from"node:path";function YGe(e){return XGe(e).length}function XGe(e){let t=e.split(`
515
515
  `);for(;t.length>0&&t[t.length-1]==="";)t.pop();return t}async function QGe(e){try{if((await LS.readFile(e.cadenceQueuePath,"utf8")).includes(ND))return!0}catch{}try{let t=await LS.readdir(e.cadenceInboxDir,{withFileTypes:!0});for(let r of t){if(!r.isFile()||!r.name.endsWith(".pending"))continue;if((await LS.readFile(Dre.join(e.cadenceInboxDir,r.name),"utf8")).includes(ND))return!0}}catch{}return!1}async function e5e(e,t){if(await QGe(e))return!1;await Me(e.cadenceInboxDir);let n=`${new Date().toISOString().replace(/[:.]/g,"-")}_${Math.random().toString(36).slice(2)}.pending`,i=["- [ ]",ND,`Compress ${e.memoryBroadcastPath} into high-signal heuristics,`,`move details into dossiers/topics, and keep CLAUDE.md <= ${t} lines.`].join(" ");return await Bt(Dre.join(e.cadenceInboxDir,n),`${i}
516
- `),!0}async function Jf(e,t={}){let r=t.maxLines??KGe,n="";try{n=await LS.readFile(e.memoryBroadcastPath,"utf8")}catch{return{overLimit:!1,originalLines:0,enqueuedCompressionTask:!1}}let i=YGe(n);if(i<=r)return{overLimit:!1,originalLines:i,enqueuedCompressionTask:!1};let s=await e5e(e,r);return ot("[memory] CLAUDE.md over line budget; queued compression task",{path:e.memoryBroadcastPath,originalLines:i,maxLines:r,enqueuedCompressionTask:s}),{overLimit:!0,originalLines:i,enqueuedCompressionTask:s}}var KGe,ND,qS=L(()=>{"use strict";_n();Yr();fr();KGe=50,ND="[memory:claude-compress]"});import{existsSync as t5e}from"node:fs";import jD from"node:path";function FS(e){if(e===void 0)return;let t=new Set,r=[];for(let n of e){let i=n.trim();!i||t.has(i)||(t.add(i),r.push(i))}return r}function AD(e,t){return FS([...e??[],...t??[]])??[]}function jre(e,t){let r=t?.allowedTools!==void 0?AD(e.allowedTools,t.allowedTools):FS(e.allowedTools),n=t?.disallowedTools!==void 0?AD(e.disallowedTools,t.disallowedTools):FS(e.disallowedTools),i=new Set(r??[]),s=n?.filter(a=>!i.has(a)),o=t?.additionalDirectories!==void 0?AD(e.additionalDirectories,t.additionalDirectories):FS(e.additionalDirectories);return{allowedTools:r,disallowedTools:s,additionalDirectories:o,permissionMode:e.permissionMode}}async function Kre(e,t,r={}){let n=qs(t);if(!(await Ire(e,n)).acquired)return{processed:0,skipped:0,lockAcquired:!1};gi("drain_started",t,{sessionKey:t});let s=Date.now(),o=0,a=0,u=0,l,c;function d(f){f&&(c?(c.total_cost_usd=(c.total_cost_usd??0)+(f.total_cost_usd??0),c.input_tokens=(c.input_tokens??0)+(f.input_tokens??0),c.output_tokens=(c.output_tokens??0)+(f.output_tokens??0),c.cache_creation_input_tokens=(c.cache_creation_input_tokens??0)+(f.cache_creation_input_tokens??0),c.cache_read_input_tokens=(c.cache_read_input_tokens??0)+(f.cache_read_input_tokens??0)):c={...f})}async function p(f){try{await mf(e,{id:crypto.randomUUID(),session_key:t,sdk_session_id:l,drain_started_at:new Date(s).toISOString(),drain_duration_ms:Date.now()-s,sdk_duration_ms:o,events_processed:f.processedCount,events_skipped:f.skippedCount,tool_calls:a,tool_errors:u,output_chars:f.replyText?.length??0,cancelled:f.cancelled,usage:c})}catch{}}try{await _Y(e,t);let f=await vY(e,t);if(f.length===0)return{processed:0,skipped:0,lockAcquired:!0};let h=r.batchSize??r5e,v=r.mergeWindowMs??n5e,y=r.sdk??Yg();await Jf(e);let _=await c5e(e,f,{fallbackBatchSize:h,mergeWindowMs:v}),b=_.items,g=[],m=0,S,w,k,x=[],E=(await Ir(e))?.sessions[t],P=g5e(e,t,E),C=await Kn(e,t),$=C?.pending_gateway_notice,N=C?.pending_interrupted_context,A=C?.pending_skip_rewind,W=!1,H=!1,re=!1,ne=!1,Z=[],z,B=E?.last_event_at?Date.parse(E.last_event_at):null;for(let O of b){if(!O.eventId){m+=1;continue}if(B!==null&&Number.isFinite(B)){let Y=_.events.get(O.eventId)??await Yd(e,O.eventId);if(Y){_.events.has(O.eventId)||_.events.set(O.eventId,Y);let me=Xre(Y.ts);if(me!==null&&me<B){g.push(O.eventId),m+=1;continue}}}let j=await U0(e,O.eventId);if(j){g.push(O.eventId),S=j.payload.text,w=j.id;continue}let V=_.events.get(O.eventId)??await Yd(e,O.eventId);if(!V){m+=1;continue}Z.push({item:O,event:V,prompt:a5e(V)})}let q=y5e(P.cwd);if(Z.length>0&&q){let O=_5e(t,P.cwd,q);for(let j of Z){let V=await DD(e,t,{item:j.item,event:j.event,outputText:O,sdkSessionId:P.sessionId});x.push(...V.records),V.primaryRecord&&(S=V.primaryRecord.payload.text,w=V.primaryRecord.id,k=V.primaryRecord),j.item.eventId&&g.push(j.item.eventId)}return await _0(e,t,g),await v0(e,t,`processed=${g.length} skipped=${m} workspace_unavailable=true`),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}let I=O=>async j=>(j.type==="system"&&j.subtype==="init"&&j.data&&typeof j.data.session_id=="string"&&(z=j.data.session_id),j.type==="tool_use"?a+=1:j.type==="tool_result"&&j.isError&&(u+=1),O(j)),D=async()=>{let O=z??P.sessionId;!O||r.skipSessionIdUpdate||await sn(e,t,{session_id:O,cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile})};if(d5e(Z,t)){let O=Z[Z.length-1],j=r.resume===!1?void 0:P.sessionId,V=I(Wre(e,t,O.event.session_key??t,r.onExecutionEvent)),Y=Mre(Bre(Z),{gatewayNotice:$,interruptedContext:N,skipRewind:A},P),me=Gf(O.event.payload)?O.event.payload:void 0,Ce=me?zD(me):void 0,F=Z.map(ft=>ft.event.id),M=await $A(e,O.event),X=NS(M,t),ee=jre(r,M);gi("sdk_start",O.event.id,{eventIds:F,coalesced:Z.length>1});let he=Date.now(),Te;try{Te=await Gre(e,t,y,{prompt:Y.prompt,abortController:r.abortController,onStream:r.onStream,onExecutionEvent:V,sessionId:j,cwd:P.cwd,settingSources:P.settingSources,persistSession:r.persistSession,permissionMode:ee.permissionMode,allowedTools:ee.allowedTools,disallowedTools:ee.disallowedTools,mcpServers:r.mcpServers,mcpServersFactory:r.mcpServersFactory,additionalDirectories:ee.additionalDirectories,attachments:Ce,systemPrompt:X})}catch(ft){if(LD(ft)){for(let it of Z)it.item.eventId&&g.push(it.item.eventId);return await D(),(await Kn(e,t))?.pending_skip_rewind||await Fre(e,t,Lre(Bre(Z),Y.interruptedContextInjected?N:void 0)),await _0(e,t,g),await v0(e,t,`processed=${g.length} skipped=${m} cancelled=true`),await p({cancelled:!0,processedCount:g.length,skippedCount:m,replyText:S}),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}throw ft}let ze=Te.sdkResult;o+=Date.now()-he,ze.sessionId&&(l=ze.sessionId),d(ze.usage),gi("sdk_end",O.event.id,{eventIds:F,sdkDurationMs:Date.now()-he,usedFallback:ze.usedFallback}),Y.gatewayNoticeInjected&&!W&&(await qre(e,t),W=!0),Y.interruptedContextInjected&&!H&&(await Ure(e,t),H=!0),Y.skipRewindInjected&&!re&&(await Zre(e,t),re=!0);let _t=Jre(O.event,ze),Ot=await DD(e,t,{item:O.item,event:O.event,outputText:_t,sdkSessionId:ze.sessionId,batchedEventIds:Z.map(ft=>ft.event.id),attachments:Te.outboundAttachments});if(x.push(...Ot.records),Ot.primaryRecord){gi("outbox_written",O.event.id,{outboxId:Ot.primaryRecord.id,eventIds:F}),S=Ot.primaryRecord.payload.text,w=Ot.primaryRecord.id,k=Ot.primaryRecord;for(let ft of Z.slice(0,-1))ft.item.eventId&&await pA(e,ft.item.eventId,Ot.primaryRecord)}for(let ft of Z)ft.item.eventId&&g.push(ft.item.eventId);if(ze.usedFallback&&ze.resumeError){let ft=Qt({type:"agent.error",source:{kind:"runner",name:"runner"},session_key:O.event.session_key??t,payload:{stage:"resume",session_id:P.sessionId,error:ze.resumeError}});await er(e,ft)}let jt={cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile,last_event_id:O.event.id,last_event_at:O.event.ts,health:"ok"};r.skipSessionIdUpdate||(jt.session_id=ze.sessionId??P.sessionId??"unknown"),await sn(e,t,jt)}else for(let O of Z){let j=r.resume===!1?void 0:P.sessionId,V=I(Wre(e,t,O.event.session_key??t,r.onExecutionEvent)),Y=!W||!H||!re?Mre(O.prompt,{gatewayNotice:W?void 0:$,interruptedContext:H?void 0:N,skipRewind:re?void 0:A},P):{prompt:O.prompt,gatewayNoticeInjected:!1,interruptedContextInjected:!1,skipRewindInjected:!1},me=Gf(O.event.payload)?O.event.payload:void 0,Ce=me?zD(me):void 0,F=await $A(e,O.event),M=NS(F,t),X=jre(r,F),ee,he=Date.now();try{ee=await Gre(e,t,y,{prompt:Y.prompt,abortController:r.abortController,onStream:r.onStream,onExecutionEvent:V,sessionId:j,cwd:P.cwd,settingSources:P.settingSources,persistSession:r.persistSession,permissionMode:X.permissionMode,allowedTools:X.allowedTools,disallowedTools:X.disallowedTools,mcpServers:r.mcpServers,mcpServersFactory:r.mcpServersFactory,additionalDirectories:X.additionalDirectories,attachments:Ce,systemPrompt:M})}catch(jt){if(LD(jt)){O.item.eventId&&g.push(O.item.eventId),await D(),(await Kn(e,t))?.pending_skip_rewind||await Fre(e,t,Lre(O.prompt,Y.interruptedContextInjected?N:void 0)),ne=!0;break}throw jt}let Te=ee.sdkResult;o+=Date.now()-he,Te.sessionId&&(l=Te.sessionId),d(Te.usage),Y.gatewayNoticeInjected&&!W&&(await qre(e,t),W=!0),Y.interruptedContextInjected&&!H&&(await Ure(e,t),H=!0),Y.skipRewindInjected&&!re&&(await Zre(e,t),re=!0);let ze=Jre(O.event,Te),_t=await DD(e,t,{item:O.item,event:O.event,outputText:ze,sdkSessionId:Te.sessionId,attachments:ee.outboundAttachments});if(x.push(..._t.records),_t.primaryRecord&&(S=_t.primaryRecord.payload.text,w=_t.primaryRecord.id,k=_t.primaryRecord),O.item.eventId&&g.push(O.item.eventId),Te.usedFallback&&Te.resumeError){let jt=Qt({type:"agent.error",source:{kind:"runner",name:"runner"},session_key:O.event.session_key??t,payload:{stage:"resume",session_id:P.sessionId,error:Te.resumeError}});await er(e,jt)}let Ot={cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile,last_event_id:O.event.id,last_event_at:O.event.ts,health:"ok"};r.skipSessionIdUpdate||(Ot.session_id=Te.sessionId??P.sessionId??"unknown"),await sn(e,t,Ot)}if(await _0(e,t,g),g.length>0||m>0){let O=`processed=${g.length} skipped=${m}${w?` outbox=${w}`:""}`;await v0(e,t,O)}return await p({cancelled:ne,processedCount:g.length,skippedCount:m,replyText:S}),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}finally{await jS(e,n)}}function Gf(e){return typeof e=="object"&&e!==null}function on(e,t){let r=e[t];return typeof r=="string"?r:void 0}function zD(e){let t=e.media;if(!Array.isArray(t))return;let r=[];for(let n of t){if(!Gf(n))continue;let i=on(n,"path");i&&r.push({path:i,mime:on(n,"mime")})}return r.length>0?r:void 0}function i5e(e){let t=e.replace(/\\/g,"/"),r="/inbox/",n=t.lastIndexOf(r);if(n>=0){let i=`inbox/${t.slice(n+r.length)}`,s=i.split("/").filter(o=>o.length>0);return s.length>=3?{fileName:s[1],linkPath:encodeURI(i)}:{fileName:jD.basename(e),linkPath:encodeURI(i)}}return{fileName:jD.basename(e),linkPath:encodeURI(e)}}function s5e(e){let t=zD(e);if(!t)return[];let r=[];for(let n of t){let{fileName:i,linkPath:s}=i5e(n.path),o=n.mime?` mime="${Ai(n.mime)}"`:"";r.push(`<file name="${Ai(i)}" path="${Ai(n.path)}"${o} link="${Ai(s)}" />`)}return[`<user-upload count="${r.length}">`,...r,"</user-upload>"]}function Ai(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function zre(e){return e.replace(/\s+/g," ").trim()}function Yre(e){return e?(e.includes(MD)?e.split(MD):[e]).map(r=>r.trim()).filter(r=>r.length>0):[]}function o5e(e){let t=Yre(e);if(t.length!==0)return t.join(`
516
+ `),!0}async function Jf(e,t={}){let r=t.maxLines??KGe,n="";try{n=await LS.readFile(e.memoryBroadcastPath,"utf8")}catch{return{overLimit:!1,originalLines:0,enqueuedCompressionTask:!1}}let i=YGe(n);if(i<=r)return{overLimit:!1,originalLines:i,enqueuedCompressionTask:!1};let s=await e5e(e,r);return ot("[memory] CLAUDE.md over line budget; queued compression task",{path:e.memoryBroadcastPath,originalLines:i,maxLines:r,enqueuedCompressionTask:s}),{overLimit:!0,originalLines:i,enqueuedCompressionTask:s}}var KGe,ND,qS=L(()=>{"use strict";_n();Yr();fr();KGe=50,ND="[memory:claude-compress]"});import{existsSync as t5e}from"node:fs";import jD from"node:path";function FS(e){if(e===void 0)return;let t=new Set,r=[];for(let n of e){let i=n.trim();!i||t.has(i)||(t.add(i),r.push(i))}return r}function AD(e,t){return FS([...e??[],...t??[]])??[]}function jre(e,t){let r=t?.allowedTools!==void 0?AD(e.allowedTools,t.allowedTools):FS(e.allowedTools),n=t?.disallowedTools!==void 0?AD(e.disallowedTools,t.disallowedTools):FS(e.disallowedTools),i=new Set(r??[]),s=n?.filter(a=>!i.has(a)),o=t?.additionalDirectories!==void 0?AD(e.additionalDirectories,t.additionalDirectories):FS(e.additionalDirectories);return{allowedTools:r,disallowedTools:s,additionalDirectories:o,permissionMode:e.permissionMode}}async function Kre(e,t,r={}){let n=qs(t);if(!(await Ire(e,n)).acquired)return{processed:0,skipped:0,lockAcquired:!1};gi("drain_started",t,{sessionKey:t});let s=Date.now(),o=0,a=0,u=0,l,c;function d(f){f&&(c?(c.total_cost_usd=(c.total_cost_usd??0)+(f.total_cost_usd??0),c.input_tokens=(c.input_tokens??0)+(f.input_tokens??0),c.output_tokens=(c.output_tokens??0)+(f.output_tokens??0),c.cache_creation_input_tokens=(c.cache_creation_input_tokens??0)+(f.cache_creation_input_tokens??0),c.cache_read_input_tokens=(c.cache_read_input_tokens??0)+(f.cache_read_input_tokens??0)):c={...f})}async function p(f){try{await mf(e,{id:crypto.randomUUID(),session_key:t,sdk_session_id:l,drain_started_at:new Date(s).toISOString(),drain_duration_ms:Date.now()-s,sdk_duration_ms:o,events_processed:f.processedCount,events_skipped:f.skippedCount,tool_calls:a,tool_errors:u,output_chars:f.replyText?.length??0,cancelled:f.cancelled,usage:c})}catch{}}try{await _Y(e,t);let f=await vY(e,t);if(f.length===0)return{processed:0,skipped:0,lockAcquired:!0};let h=r.batchSize??r5e,v=r.mergeWindowMs??n5e,y=r.sdk??Yg();await Jf(e);let _=await c5e(e,f,{fallbackBatchSize:h,mergeWindowMs:v}),b=_.items,g=[],m=0,S,w,k,x=[],E=(await Ir(e))?.sessions[t],P=g5e(e,t,E),C=await Kn(e,t),$=C?.pending_gateway_notice,N=C?.pending_interrupted_context,A=C?.pending_skip_rewind,W=!1,H=!1,te=!1,ne=!1,Z=[],z,B=E?.last_event_at?Date.parse(E.last_event_at):null;for(let O of b){if(!O.eventId){m+=1;continue}if(B!==null&&Number.isFinite(B)){let Y=_.events.get(O.eventId)??await Yd(e,O.eventId);if(Y){_.events.has(O.eventId)||_.events.set(O.eventId,Y);let me=Xre(Y.ts);if(me!==null&&me<B){g.push(O.eventId),m+=1;continue}}}let j=await U0(e,O.eventId);if(j){g.push(O.eventId),S=j.payload.text,w=j.id;continue}let V=_.events.get(O.eventId)??await Yd(e,O.eventId);if(!V){m+=1;continue}Z.push({item:O,event:V,prompt:a5e(V)})}let q=y5e(P.cwd);if(Z.length>0&&q){let O=_5e(t,P.cwd,q);for(let j of Z){let V=await DD(e,t,{item:j.item,event:j.event,outputText:O,sdkSessionId:P.sessionId});x.push(...V.records),V.primaryRecord&&(S=V.primaryRecord.payload.text,w=V.primaryRecord.id,k=V.primaryRecord),j.item.eventId&&g.push(j.item.eventId)}return await _0(e,t,g),await v0(e,t,`processed=${g.length} skipped=${m} workspace_unavailable=true`),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}let I=O=>async j=>(j.type==="system"&&j.subtype==="init"&&j.data&&typeof j.data.session_id=="string"&&(z=j.data.session_id),j.type==="tool_use"?a+=1:j.type==="tool_result"&&j.isError&&(u+=1),O(j)),D=async()=>{let O=z??P.sessionId;!O||r.skipSessionIdUpdate||await sn(e,t,{session_id:O,cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile})};if(d5e(Z,t)){let O=Z[Z.length-1],j=r.resume===!1?void 0:P.sessionId,V=I(Wre(e,t,O.event.session_key??t,r.onExecutionEvent)),Y=Mre(Bre(Z),{gatewayNotice:$,interruptedContext:N,skipRewind:A},P),me=Gf(O.event.payload)?O.event.payload:void 0,Ce=me?zD(me):void 0,F=Z.map(ft=>ft.event.id),M=await $A(e,O.event),X=NS(M,t),ee=jre(r,M);gi("sdk_start",O.event.id,{eventIds:F,coalesced:Z.length>1});let he=Date.now(),Te;try{Te=await Gre(e,t,y,{prompt:Y.prompt,abortController:r.abortController,onStream:r.onStream,onExecutionEvent:V,sessionId:j,cwd:P.cwd,settingSources:P.settingSources,persistSession:r.persistSession,permissionMode:ee.permissionMode,allowedTools:ee.allowedTools,disallowedTools:ee.disallowedTools,mcpServers:r.mcpServers,mcpServersFactory:r.mcpServersFactory,additionalDirectories:ee.additionalDirectories,attachments:Ce,systemPrompt:X})}catch(ft){if(LD(ft)){for(let it of Z)it.item.eventId&&g.push(it.item.eventId);return await D(),(await Kn(e,t))?.pending_skip_rewind||await Fre(e,t,Lre(Bre(Z),Y.interruptedContextInjected?N:void 0)),await _0(e,t,g),await v0(e,t,`processed=${g.length} skipped=${m} cancelled=true`),await p({cancelled:!0,processedCount:g.length,skippedCount:m,replyText:S}),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}throw ft}let ze=Te.sdkResult;o+=Date.now()-he,ze.sessionId&&(l=ze.sessionId),d(ze.usage),gi("sdk_end",O.event.id,{eventIds:F,sdkDurationMs:Date.now()-he,usedFallback:ze.usedFallback}),Y.gatewayNoticeInjected&&!W&&(await qre(e,t),W=!0),Y.interruptedContextInjected&&!H&&(await Ure(e,t),H=!0),Y.skipRewindInjected&&!te&&(await Zre(e,t),te=!0);let _t=Jre(O.event,ze),Ot=await DD(e,t,{item:O.item,event:O.event,outputText:_t,sdkSessionId:ze.sessionId,batchedEventIds:Z.map(ft=>ft.event.id),attachments:Te.outboundAttachments});if(x.push(...Ot.records),Ot.primaryRecord){gi("outbox_written",O.event.id,{outboxId:Ot.primaryRecord.id,eventIds:F}),S=Ot.primaryRecord.payload.text,w=Ot.primaryRecord.id,k=Ot.primaryRecord;for(let ft of Z.slice(0,-1))ft.item.eventId&&await pA(e,ft.item.eventId,Ot.primaryRecord)}for(let ft of Z)ft.item.eventId&&g.push(ft.item.eventId);if(ze.usedFallback&&ze.resumeError){let ft=Qt({type:"agent.error",source:{kind:"runner",name:"runner"},session_key:O.event.session_key??t,payload:{stage:"resume",session_id:P.sessionId,error:ze.resumeError}});await er(e,ft)}let jt={cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile,last_event_id:O.event.id,last_event_at:O.event.ts,health:"ok"};r.skipSessionIdUpdate||(jt.session_id=ze.sessionId??P.sessionId??"unknown"),await sn(e,t,jt)}else for(let O of Z){let j=r.resume===!1?void 0:P.sessionId,V=I(Wre(e,t,O.event.session_key??t,r.onExecutionEvent)),Y=!W||!H||!te?Mre(O.prompt,{gatewayNotice:W?void 0:$,interruptedContext:H?void 0:N,skipRewind:te?void 0:A},P):{prompt:O.prompt,gatewayNoticeInjected:!1,interruptedContextInjected:!1,skipRewindInjected:!1},me=Gf(O.event.payload)?O.event.payload:void 0,Ce=me?zD(me):void 0,F=await $A(e,O.event),M=NS(F,t),X=jre(r,F),ee,he=Date.now();try{ee=await Gre(e,t,y,{prompt:Y.prompt,abortController:r.abortController,onStream:r.onStream,onExecutionEvent:V,sessionId:j,cwd:P.cwd,settingSources:P.settingSources,persistSession:r.persistSession,permissionMode:X.permissionMode,allowedTools:X.allowedTools,disallowedTools:X.disallowedTools,mcpServers:r.mcpServers,mcpServersFactory:r.mcpServersFactory,additionalDirectories:X.additionalDirectories,attachments:Ce,systemPrompt:M})}catch(jt){if(LD(jt)){O.item.eventId&&g.push(O.item.eventId),await D(),(await Kn(e,t))?.pending_skip_rewind||await Fre(e,t,Lre(O.prompt,Y.interruptedContextInjected?N:void 0)),ne=!0;break}throw jt}let Te=ee.sdkResult;o+=Date.now()-he,Te.sessionId&&(l=Te.sessionId),d(Te.usage),Y.gatewayNoticeInjected&&!W&&(await qre(e,t),W=!0),Y.interruptedContextInjected&&!H&&(await Ure(e,t),H=!0),Y.skipRewindInjected&&!te&&(await Zre(e,t),te=!0);let ze=Jre(O.event,Te),_t=await DD(e,t,{item:O.item,event:O.event,outputText:ze,sdkSessionId:Te.sessionId,attachments:ee.outboundAttachments});if(x.push(..._t.records),_t.primaryRecord&&(S=_t.primaryRecord.payload.text,w=_t.primaryRecord.id,k=_t.primaryRecord),O.item.eventId&&g.push(O.item.eventId),Te.usedFallback&&Te.resumeError){let jt=Qt({type:"agent.error",source:{kind:"runner",name:"runner"},session_key:O.event.session_key??t,payload:{stage:"resume",session_id:P.sessionId,error:Te.resumeError}});await er(e,jt)}let Ot={cwd:P.cwd,plane:P.plane,permission_profile:P.permissionProfile,last_event_id:O.event.id,last_event_at:O.event.ts,health:"ok"};r.skipSessionIdUpdate||(Ot.session_id=Te.sessionId??P.sessionId??"unknown"),await sn(e,t,Ot)}if(await _0(e,t,g),g.length>0||m>0){let O=`processed=${g.length} skipped=${m}${w?` outbox=${w}`:""}`;await v0(e,t,O)}return await p({cancelled:ne,processedCount:g.length,skippedCount:m,replyText:S}),{processed:g.length,skipped:m,lockAcquired:!0,lastReplyText:S,lastOutboxId:w,lastOutboxRecord:k,outboxRecords:x}}finally{await jS(e,n)}}function Gf(e){return typeof e=="object"&&e!==null}function on(e,t){let r=e[t];return typeof r=="string"?r:void 0}function zD(e){let t=e.media;if(!Array.isArray(t))return;let r=[];for(let n of t){if(!Gf(n))continue;let i=on(n,"path");i&&r.push({path:i,mime:on(n,"mime")})}return r.length>0?r:void 0}function i5e(e){let t=e.replace(/\\/g,"/"),r="/inbox/",n=t.lastIndexOf(r);if(n>=0){let i=`inbox/${t.slice(n+r.length)}`,s=i.split("/").filter(o=>o.length>0);return s.length>=3?{fileName:s[1],linkPath:encodeURI(i)}:{fileName:jD.basename(e),linkPath:encodeURI(i)}}return{fileName:jD.basename(e),linkPath:encodeURI(e)}}function s5e(e){let t=zD(e);if(!t)return[];let r=[];for(let n of t){let{fileName:i,linkPath:s}=i5e(n.path),o=n.mime?` mime="${Ai(n.mime)}"`:"";r.push(`<file name="${Ai(i)}" path="${Ai(n.path)}"${o} link="${Ai(s)}" />`)}return[`<user-upload count="${r.length}">`,...r,"</user-upload>"]}function Ai(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function zre(e){return e.replace(/\s+/g," ").trim()}function Yre(e){return e?(e.includes(MD)?e.split(MD):[e]).map(r=>r.trim()).filter(r=>r.length>0):[]}function o5e(e){let t=Yre(e);if(t.length!==0)return t.join(`
517
517
 
518
518
  `)}function a5e(e){let t=Gf(e.payload)?e.payload:void 0;if(e.type==="route.deliver"&&t){let r=on(t,"source_event_type"),n=t.payload,i=Gf(n)?n:void 0;if(r==="job.complete"&&i){let s=on(i,"job_id");if(s){let o=on(i,"result_text")??on(i,"result_summary")??"",a=on(t,"source_session_key")??"";return[`<job-status event="job.complete" ${[`job_id="${Ai(s)}"`,a?`source_session="${Ai(a)}"`:""].filter(Boolean).join(" ")}>`,"This is a system notification. A background job has completed.","Do NOT treat this as a user instruction. Based on the original user request and context,","decide whether to: (1) summarize and reply to the user, (2) silently record, or (3) wait for more results.",o?`
519
519
  <job-result>
@@ -596,7 +596,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
596
596
  ]))`;continue}else if(n[u]==="$"){i+=`($|(?=[\r
597
597
  ]))`;continue}}if(r.s&&n[u]==="."){i+=o?`${n[u]}\r
598
598
  `:`[${n[u]}\r
599
- ]`;continue}i+=n[u],n[u]==="\\"?s=!0:o&&n[u]==="]"?o=!1:!o&&n[u]==="["&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}var jL,Ks,t7e,PE=L(()=>{Wu();Ks={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(jL===void 0&&(jL=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jL),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};t7e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function IE(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===ce.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,i)=>({...n,[i]:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",i]})??_r(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===ce.ZodString&&e.keyType._def.checks?.length){let{type:n,...i}=RE(e.keyType._def,t);return{...r,propertyNames:i}}else{if(e.keyType?._def.typeName===ce.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===ce.ZodBranded&&e.keyType._def.type._def.typeName===ce.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...i}=EE(e.keyType._def,t);return{...r,propertyNames:i}}}return r}var OE=L(()=>{dy();Jr();PE();TE();ws()});function Zae(e,t){if(t.mapStrategy==="record")return IE(e,t);let r=Ve(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||_r(t),n=Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||_r(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var ML=L(()=>{Jr();OE();ws()});function Vae(e){let t=e.values,n=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),i=Array.from(new Set(n.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}var LL=L(()=>{});function Hae(e){return e.target==="openAi"?void 0:{not:_r({...e,currentPath:[...e.currentPath,"not"]})}}var qL=L(()=>{ws()});function Bae(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var FL=L(()=>{});function Jae(e,t){if(t.target==="openApi3")return Wae(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in I_&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((i,s)=>{let o=I_[s._def.typeName];return o&&!i.includes(o)?[...i,o]:i},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((i,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...i,o];case"bigint":return[...i,"integer"];case"object":if(s._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(n.length===r.length){let i=n.filter((s,o,a)=>a.indexOf(s)===o);return{type:i.length>1?i:i[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(s=>!n.includes(s))],[])};return Wae(e,t)}var I_,Wae,CE=L(()=>{Jr();I_={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Wae=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,i)=>Ve(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function Gae(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:I_[e.innerType._def.typeName],nullable:!0}:{type:[I_[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var UL=L(()=>{Jr();CE()});function Kae(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",xL(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?xt(r,"minimum",n.value,n.message,t):xt(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),xt(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?xt(r,"maximum",n.value,n.message,t):xt(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),xt(r,"maximum",n.value,n.message,t));break;case"multipleOf":xt(r,"multipleOf",n.value,n.message,t);break}return r}var ZL=L(()=>{Wu()});function Yae(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},i=[],s=e.shape();for(let a in s){let u=s[a];if(u===void 0||u._def===void 0)continue;let l=i7e(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=Ve(u._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});c!==void 0&&(n.properties[a]=c,l||i.push(a))}i.length&&(n.required=i);let o=n7e(e,t);return o!==void 0&&(n.additionalProperties=o),n}function n7e(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ve(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function i7e(e){try{return e.isOptional()}catch{return!0}}var VL=L(()=>{Jr()});var Xae,HL=L(()=>{Jr();ws();Xae=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Ve(e.innerType._def,t);let r=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:_r(t)},r]}:_r(t)}});var Qae,BL=L(()=>{Jr();Qae=(e,t)=>{if(t.pipeStrategy==="input")return Ve(e.in._def,t);if(t.pipeStrategy==="output")return Ve(e.out._def,t);let r=Ve(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Ve(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(i=>i!==void 0)}}});function eue(e,t){return Ve(e.type._def,t)}var WL=L(()=>{Jr()});function tue(e,t){let n={type:"array",uniqueItems:!0,items:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&xt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&xt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}var JL=L(()=>{Wu();Jr()});function rue(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Ve(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Ve(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Ve(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var GL=L(()=>{Jr()});function nue(e){return{not:_r(e)}}var KL=L(()=>{ws()});function iue(e){return _r(e)}var YL=L(()=>{ws()});var sue,XL=L(()=>{Jr();sue=(e,t)=>Ve(e.innerType._def,t)});var oue,QL=L(()=>{dy();ws();$L();EL();TL();TE();RL();IL();OL();CL();NL();AL();DL();ML();LL();qL();FL();UL();ZL();VL();HL();BL();WL();OE();JL();PE();GL();KL();CE();YL();XL();oue=(e,t,r)=>{switch(t){case ce.ZodString:return RE(e,r);case ce.ZodNumber:return Kae(e,r);case ce.ZodObject:return Yae(e,r);case ce.ZodBigInt:return Aae(e,r);case ce.ZodBoolean:return Dae();case ce.ZodDate:return PL(e,r);case ce.ZodUndefined:return nue(r);case ce.ZodNull:return Bae(r);case ce.ZodArray:return Nae(e,r);case ce.ZodUnion:case ce.ZodDiscriminatedUnion:return Jae(e,r);case ce.ZodIntersection:return qae(e,r);case ce.ZodTuple:return rue(e,r);case ce.ZodRecord:return IE(e,r);case ce.ZodLiteral:return Fae(e,r);case ce.ZodEnum:return Lae(e);case ce.ZodNativeEnum:return Vae(e);case ce.ZodNullable:return Gae(e,r);case ce.ZodOptional:return Xae(e,r);case ce.ZodMap:return Zae(e,r);case ce.ZodSet:return tue(e,r);case ce.ZodLazy:return()=>e.getter()._def;case ce.ZodPromise:return eue(e,r);case ce.ZodNaN:case ce.ZodNever:return Hae(r);case ce.ZodEffects:return Mae(e,r);case ce.ZodAny:return _r(r);case ce.ZodUnknown:return iue(r);case ce.ZodDefault:return zae(e,r);case ce.ZodBranded:return EE(e,r);case ce.ZodReadonly:return sue(e,r);case ce.ZodCatch:return jae(e,r);case ce.ZodPipeline:return Qae(e,r);case ce.ZodFunction:case ce.ZodVoid:case ce.ZodSymbol:return;default:return(n=>{})(t)}}});function Ve(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==Iae)return a}if(n&&!r){let a=s7e(n,t);if(a!==void 0)return a}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let s=oue(e,e.typeName,t),o=typeof s=="function"?Ve(s(),t):s;if(o&&o7e(e,t,o),t.postProcess){let a=t.postProcess(o,e,t);return i.jsonSchema=o,a}return i.jsonSchema=o,o}var s7e,o7e,Jr=L(()=>{kE();QL();$E();ws();s7e=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:xE(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),_r(t)):t.$refStrategy==="seen"?_r(t):void 0}},o7e=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r)});var aue=L(()=>{});var eq,tq=L(()=>{Jr();kL();ws();eq=(e,t)=>{let r=Cae(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[l,c])=>({...u,[l]:Ve(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??_r(r)}),{}):void 0,i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=Ve(e._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1)??_r(r),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=i===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a}});var uue=L(()=>{kE();kL();Wu();$E();Jr();aue();ws();$L();EL();TL();TE();RL();IL();OL();CL();NL();AL();DL();ML();LL();qL();FL();UL();ZL();VL();HL();BL();WL();XL();OE();JL();PE();GL();KL();CE();YL();QL();tq();tq()});function a7e(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function rq(e,t){return _s(e)?Rc(e,{target:a7e(t?.target),io:t?.pipeStrategy??"input"}):eq(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function nq(e){let r=Zu(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=x$(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function iq(e,t){let r=Uu(e,t);if(!r.success)throw r.error;return r.data}var sq=L(()=>{Xz();n_();uue()});function lue(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function cue(e,t){let r={...e};for(let n in t){let i=n,s=t[i];if(s===void 0)continue;let o=r[i];lue(o)&&lue(s)?r[i]={...o,...s}:r[i]=s}return r}var u7e,NE,due=L(()=>{n_();P_();Rae();sq();u7e=6e4,NE=class{constructor(t){this._options=t,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._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(oE,r=>{this._oncancel(r)}),this.setNotificationHandler(uE,r=>{this._onprogress(r)}),this.setRequestHandler(aE,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(lE,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Oe(Le.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(dE,async(r,n)=>{let i=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let u=a.message,l=u.id,c=this._requestResolvers.get(l);if(c)if(this._requestResolvers.delete(l),a.type==="response")c(u);else{let d=u,p=new Oe(d.error.code,d.error.message,d.error.data);c(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(s,n.sessionId);if(!o)throw new Oe(Le.InvalidParams,`Task not found: ${s}`);if(!Bu(o.status))return await this._waitForTaskUpdate(s,n.signal),await i();if(Bu(o.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Hu]:{taskId:s}}}}return await i()};return await i()}),this.setRequestHandler(fE,async(r,n)=>{try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new Oe(Le.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(hE,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Oe(Le.InvalidParams,`Task not found: ${r.params.taskId}`);if(Bu(i.status))throw new Oe(Le.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new Oe(Le.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(i){throw i instanceof Oe?i:new Oe(Le.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Oe.fromError(Le.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let i=this._transport?.onmessage;this._transport.onmessage=(s,o)=>{i?.(s,o),b_(s)||_ae(s)?this._onresponse(s):lL(s)?this._onrequest(s,o):yae(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Oe.fromError(Le.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,s=t.params?._meta?.[Hu]?.taskId;if(n===void 0){let c={jsonrpc:"2.0",id:t.id,error:{code:Le.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:c,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(c).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(t.id,o);let a=hae(t.params)?t.params.task:void 0,u=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async c=>{if(o.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(c,d)},sendRequest:async(c,d,p)=>{if(o.signal.aborted)throw new Oe(Le.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&u&&await u.updateTaskStatus(h,"input_required"),await this.request(c,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:u,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,l)).then(async c=>{if(o.signal.aborted)return;let d={result:c,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async c=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(c.code)?c.code:Le.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let o=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(u){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(u);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),b_(t))n(t);else{let o=new Oe(t.error.code,t.error.message,t.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(b_(t)&&t.result&&typeof t.result=="object"){let o=t.result;if(o.task&&typeof o.task=="object"){let a=o.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),b_(t))i(t);else{let o=Oe.fromError(t.error.code,t.error.message,t.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(o){yield{type:"error",error:o instanceof Oe?o:new Oe(Le.InternalError,String(o))}}return}let s;try{let o=await this.request(t,Up,n);if(o.task)s=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new Oe(Le.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Bu(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new Oe(Le.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new Oe(Le.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let u=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,u)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof Oe?o:new Oe(Le.InternalError,String(o))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o,task:a,relatedTask:u}=n??{};return new Promise((l,c)=>{let d=b=>{c(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),u&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Hu]:u}});let h=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(m=>this._onerror(new Error(`Failed to send cancellation: ${m}`)));let g=b instanceof Oe?b:new Oe(Le.RequestTimeout,String(b));c(g)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return c(b);try{let g=Uu(r,b.result);g.success?l(g.data):c(g.error)}catch(g){c(g)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let v=n?.timeout??u7e,y=()=>h(Oe.fromError(Le.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(p,v,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let _=u?.taskId;if(_){let b=g=>{let m=this._responseHandlers.get(p);m?m(g):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(p),c(g)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),c(b)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},cE,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},pE,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},bae,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Hu]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Hu]:r.relatedTask}}}),this._transport?.send(a,r).catch(u=>this._onerror(u))});return}let o={...t,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Hu]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(t,r){let n=nq(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>{let o=iq(t,i);return Promise.resolve(r(o,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=nq(t);this._notificationHandlers.set(n,i=>{let s=iq(t,i);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&lL(i.message)){let s=i.message.id,o=this._requestResolvers.get(s);o?(o(new Oe(Le.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,s)=>{if(r.aborted){s(new Oe(Le.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),s(new Oe(Le.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let s=await n.getTask(i,r);if(!s)throw new Oe(Le.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(i,s,o)=>{await n.storeTaskResult(i,s,o,r);let a=await n.getTask(i,r);if(a){let u=$_.parse({method:"notifications/tasks/status",params:a});await this.notification(u),Bu(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,s,o)=>{let a=await n.getTask(i,r);if(!a)throw new Oe(Le.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Bu(a.status))throw new Oe(Le.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,s,o,r);let u=await n.getTask(i,r);if(u){let l=$_.parse({method:"notifications/tasks/status",params:u});await this.notification(l),Bu(u.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}}});function l7e(){let e=new fue.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,pue.default)(e),e}var fue,pue,AE,hue=L(()=>{fue=ro(sm(),1),pue=ro(jb(),1);AE=class{constructor(t){this._ajv=t??l7e()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var DE,mue=L(()=>{P_();DE=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],s=Array.isArray(i.content)?i.content:[i.content],o=s.some(c=>c.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,u=a?Array.isArray(a.content)?a.content:[a.content]:[],l=u.some(c=>c.type==="tool_use");if(o){if(s.some(c=>c.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let c=new Set(u.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(c.size!==d.size||![...c].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},R_,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),i=t.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=i==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Hp,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}}});function gue(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function yue(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var _ue=L(()=>{});var jE,vue=L(()=>{due();P_();hue();n_();mue();_ue();jE=class extends NE{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(T_.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let s=this._loggingLevels.get(i);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new AE,this.setRequestHandler(fL,n=>this._oninitialize(n)),this.setNotificationHandler(pL,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(bL,async(n,i)=>{let s=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,a=T_.safeParse(o);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new DE(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cue(this._capabilities,t)}setRequestHandler(t,r){let i=Zu(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let s;if(_s(i)){let a=i;s=a._zod?.def?.value??a.value}else{let a=i;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(u,l)=>{let c=Uu(Vp,u);if(!c.success){let h=c.error instanceof Error?c.error.message:String(c.error);throw new Oe(Le.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=c.data,p=await Promise.resolve(r(u,l));if(d.task){let h=Uu(Up,p);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new Oe(Le.InvalidParams,`Invalid task creation result: ${v}`)}return h.data}let f=Uu(wE,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new Oe(Le.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){yue(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&gue(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:dae.includes(r)?r:aL,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},sE)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],s=i.some(l=>l.type==="tool_result"),o=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=o?Array.isArray(o.content)?o.content:[o.content]:[],u=a.some(l=>l.type==="tool_use");if(s){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),c=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==c.size||![...l].every(d=>c.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},wL,r):this.request({method:"sampling/createMessage",params:t},R_,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Hp,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:i},Hp,r);if(s.action==="accept"&&s.content&&i.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(i.requestedSchema)(s.content);if(!a.valid)throw new Oe(Le.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(o){throw o instanceof Oe?o:new Oe(Le.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},SL,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function oq(e){return!!e&&typeof e=="object"&&wue in e}function Sue(e){return e[wue]?.complete}var wue,bue,kue=L(()=>{wue=Symbol.for("mcp.completable");(function(e){e.Completable="McpCompletable"})(bue||(bue={}))});var xue=L(()=>{});function d7e(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!c7e.test(e)){let r=e.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,s)=>s.indexOf(n)===i);return t.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function f7e(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function aq(e){let t=d7e(e);return f7e(e,t.warnings),t.isValid}var c7e,$ue=L(()=>{c7e=/^[A-Za-z0-9._-]{1,128}$/});var zE,Eue=L(()=>{zE=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,n){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,n)}}});var Oc=L(()=>{__();__()});function Pue(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function h7e(e){return"_def"in e||"_zod"in e||Pue(e)}function uq(e){return typeof e!="object"||e===null||h7e(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(Pue)}function Tue(e){if(e)return uq(e)?Pc(e):e}function m7e(e){let t=Zu(e);return t?Object.entries(t).map(([r,n])=>{let i=Jse(n),s=Gse(n);return{name:r,description:i,required:!s}}):[]}function Ju(e){let r=Zu(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=x$(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function Rue(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var ME,p7e,O_,Iue=L(()=>{vue();n_();sq();P_();kue();xue();$ue();Eue();Oc();ME=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new jE(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new zE(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(bE)),this.server.assertCanSetRequestHandler(Ju(Vp)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(bE,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let n={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=Op(r.inputSchema);return i?rq(i,{strictUnions:!0,pipeStrategy:"input"}):p7e})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=Op(r.outputSchema);i&&(n.outputSchema=rq(i,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Vp,async(t,r)=>{try{let n=this._registeredTools[t.params.name];if(!n)throw new Oe(Le.InvalidParams,`Tool ${t.params.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,s=n.execution?.taskSupport,o="createTask"in n.handler;if((s==="required"||s==="optional")&&!o)throw new Oe(Le.InternalError,`Tool ${t.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!i)throw new Oe(Le.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(n,t,r);let a=await this.validateToolInput(n,t.params.arguments,t.params.name),u=await this.executeToolHandler(n,a,r);return i||await this.validateToolOutput(n,u,t.params.name),u}catch(n){if(n instanceof Oe&&n.code===Le.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,n){if(!t.inputSchema)return;let s=Op(t.inputSchema)??t.inputSchema,o=await S$(s,r);if(!o.success){let a="error"in o?o.error:"Unknown error",u=k$(a);throw new Oe(Le.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${u}`)}return o.data}async validateToolOutput(t,r,n){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new Oe(Le.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let i=Op(t.outputSchema),s=await S$(i,r.structuredContent);if(!s.success){let o="error"in s?s.error:"Unknown error",a=k$(o);throw new Oe(Le.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(t,r,n){let i=t.handler;if("createTask"in i){if(!n.taskStore)throw new Error("No task store provided.");let o={...n,taskStore:n.taskStore};if(t.inputSchema){let a=i;return await Promise.resolve(a.createTask(r,o))}else{let a=i;return await Promise.resolve(a.createTask(o))}}if(t.inputSchema){let o=i;return await Promise.resolve(o(r,n))}else{let o=i;return await Promise.resolve(o(n))}}async handleAutomaticTaskPolling(t,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),s=t.handler,o={...n,taskStore:n.taskStore},a=i?await Promise.resolve(s.createTask(i,o)):await Promise.resolve(s.createTask(o)),u=a.task.taskId,l=a.task,c=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(p=>setTimeout(p,c));let d=await n.taskStore.getTask(u);if(!d)throw new Oe(Le.InternalError,`Task ${u} not found during polling`);l=d}return await n.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Ju(SE)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(SE,async t=>{switch(t.params.ref.type){case"ref/prompt":return Eae(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Tae(t),this.handleResourceCompletion(t,t.params.ref);default:throw new Oe(Le.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let n=this._registeredPrompts[r.name];if(!n)throw new Oe(Le.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return O_;let s=Zu(n.argsSchema)?.[t.params.argument.name];if(!oq(s))return O_;let o=Sue(s);if(!o)return O_;let a=await o(t.params.argument.value,t.params.context);return Rue(a)}async handleResourceCompletion(t,r){let n=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return O_;throw new Oe(Le.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=n.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return O_;let s=await i(t.params.argument.value,t.params.context);return Rue(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(mE)),this.server.assertCanSetRequestHandler(Ju(gE)),this.server.assertCanSetRequestHandler(Ju(yE)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(mE,async(t,r)=>{let n=Object.entries(this._registeredResources).filter(([s,o])=>o.enabled).map(([s,o])=>({uri:s,name:o.name,...o.metadata})),i=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let o=await s.resourceTemplate.listCallback(r);for(let a of o.resources)i.push({...s.metadata,...a})}return{resources:[...n,...i]}}),this.server.setRequestHandler(gE,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(yE,async(t,r)=>{let n=new URL(t.params.uri),i=this._registeredResources[n.toString()];if(i){if(!i.enabled)throw new Oe(Le.InvalidParams,`Resource ${n} disabled`);return i.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let o=s.resourceTemplate.uriTemplate.match(n.toString());if(o)return s.readCallback(n,o,r)}throw new Oe(Le.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(_E)),this.server.assertCanSetRequestHandler(Ju(vE)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(_E,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?m7e(r.argsSchema):void 0}))})),this.server.setRequestHandler(vE,async(t,r)=>{let n=this._registeredPrompts[t.params.name];if(!n)throw new Oe(Le.InvalidParams,`Prompt ${t.params.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Prompt ${t.params.name} disabled`);if(n.argsSchema){let i=Op(n.argsSchema),s=await S$(i,t.params.arguments);if(!s.success){let u="error"in s?s.error:"Unknown error",l=k$(u);throw new Oe(Le.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${l}`)}let o=s.data,a=n.callback;return await Promise.resolve(a(o,r))}else{let i=n.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...n){let i;typeof n[0]=="object"&&(i=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(t,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(t,r,n,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,n,i,s){let o={name:t,title:r,metadata:i,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=o)),typeof a.name<"u"&&(o.name=a.name),typeof a.title<"u"&&(o.title=a.title),typeof a.metadata<"u"&&(o.metadata=a.metadata),typeof a.callback<"u"&&(o.readCallback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=o,o}_createRegisteredResourceTemplate(t,r,n,i,s){let o={resourceTemplate:n,title:r,metadata:i,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredResourceTemplates[t],l.name&&(this._registeredResourceTemplates[l.name]=o)),typeof l.title<"u"&&(o.title=l.title),typeof l.template<"u"&&(o.resourceTemplate=l.template),typeof l.metadata<"u"&&(o.metadata=l.metadata),typeof l.callback<"u"&&(o.readCallback=l.callback),typeof l.enabled<"u"&&(o.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=o;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!n.completeCallback(l))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(t,r,n,i,s){let o={title:r,description:n,argsSchema:i===void 0?void 0:Pc(i),callback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=o)),typeof a.title<"u"&&(o.title=a.title),typeof a.description<"u"&&(o.description=a.description),typeof a.argsSchema<"u"&&(o.argsSchema=Pc(a.argsSchema)),typeof a.callback<"u"&&(o.callback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=o,i&&Object.values(i).some(u=>{let l=u instanceof qp?u._def?.innerType:u;return oq(l)})&&this.setCompletionRequestHandler(),o}_createRegisteredTool(t,r,n,i,s,o,a,u,l){aq(t);let c={title:r,description:n,inputSchema:Tue(i),outputSchema:Tue(s),annotations:o,execution:a,_meta:u,handler:l,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&&aq(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=c)),typeof d.title<"u"&&(c.title=d.title),typeof d.description<"u"&&(c.description=d.description),typeof d.paramsSchema<"u"&&(c.inputSchema=Pc(d.paramsSchema)),typeof d.outputSchema<"u"&&(c.outputSchema=Pc(d.outputSchema)),typeof d.callback<"u"&&(c.handler=d.callback),typeof d.annotations<"u"&&(c.annotations=d.annotations),typeof d._meta<"u"&&(c._meta=d._meta),typeof d.enabled<"u"&&(c.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let n,i,s,o;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let u=r[0];uq(u)?(i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!uq(r[0])&&(o=r.shift())):typeof u=="object"&&u!==null&&(o=r.shift())}let a=r[0];return this._createRegisteredTool(t,void 0,n,i,s,o,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:s,inputSchema:o,outputSchema:a,annotations:u,_meta:l}=r;return this._createRegisteredTool(t,i,s,o,a,u,{taskSupport:"forbidden"},l,n)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let i;r.length>1&&(i=r.shift());let s=r[0],o=this._createRegisteredPrompt(t,void 0,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(t,r,n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:s,argsSchema:o}=r,a=this._createRegisteredPrompt(t,i,s,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},p7e={type:"object",properties:{}};O_={completion:{values:[],hasMore:!1}}});async function Due(e,t){let r=new cs(t.paths);await r.init();try{switch(e.action){case"create":{if(!e.id||!e.cron||!e.instruction)throw new Error("Missing required arguments for 'create' action (id, cron, instruction)");let n;if(t.ownerSessionKey){if(e.notify===!0){let a=await g7e(r,t.ownerSessionKey);if(!a)throw new Error(`notify: true requested but could not find parent job for session "${t.ownerSessionKey}". Ensure the owner job file exists in var/jobs/active/.`);let u=To(a.frontmatter.notify);if(u.length===0)throw new Error(`notify: true requested but parent job '${a.id}' has no notify targets configured. The parent job is a silent job; child jobs cannot inherit its notify.`);n=u.length===1?u[0]:u}}else{let o=e;if(o.notify){let u=To(o.notify).filter(l=>!tS(l));if(u.length>0)throw new Error(`Invalid notify target: ${u.join(", ")}. Expected format: <session-key> only (no spaces), for example 'stdio:default' or 'lark:oc_abc123:ou_xyz'.`);n=o.notify}}await r.createJob(e.id,{cron:e.cron,notify:n,owner_session:t.ownerSessionKey?n!==void 0?t.ownerSessionKey:void 0:e.owner_session,cwd_rel:e.cwd_rel},e.instruction);let i=await r.getJob(e.id),s=i?.frontmatter.notify?Array.isArray(i.frontmatter.notify)?i.frontmatter.notify.join(", "):i.frontmatter.notify:"(silent)";return`Job '${e.id}' created successfully. Scheduled: ${e.cron}, Target: ${s}, Session: ${i?.session_key??"unknown"}, CWD: ${i?.execution_cwd??"unknown"}`}case"archive":{if(!e.id)throw new Error("Missing required argument 'id' for 'archive' action");let n=await r.getJob(e.id);await r.archiveJob(e.id);let i=n?.session_key??vf({jobId:e.id,ownerSession:n?.frontmatter.owner_session,cron:n?.frontmatter.cron,cwdRel:n?.frontmatter.cwd_rel});return await lg(t.paths,i),`Job '${e.id}' archived (cancelled).`}case"read":{if(!e.id)throw new Error("Missing required argument 'id' for 'read' action");let n=await r.getJob(e.id);if(!n)return`Job '${e.id}' not found.`;let{content:i,...s}=n;return JSON.stringify({...s,instruction:i},null,2)}case"list":{let n=await r.listJobs();if(n.length===0)return"No active jobs found.";let i=n.map(s=>({id:s.id,cron:s.frontmatter.cron,notify:s.frontmatter.notify,job_file_path:s.path,state_file_path:s.path.replace(/\.md$/,".state.json"),execution_cwd:s.execution_cwd,runtime_workspace_dir:s.runtime_workspace_dir,last_run:s.state.last_run_at,last_result:s.state.last_result}));return JSON.stringify(i,null,2)}default:throw new Error(`Unknown action: ${e.action??"unknown"}`)}}catch(n){return qt("[ManageJob] Tool execution failed",n),`Error: ${n instanceof Error?n.message:String(n)}`}}async function g7e(e,t){return(await e.listJobs()).find(n=>n.session_key===t)??null}var lq,Oue,Cue,Nue,Aue,cq=L(()=>{"use strict";wf();xg();Ii();fr();rS();Oc();lq="ManageJob",Oue="mcp__aladuo__ManageJob",Cue=`Create, inspect, or cancel background jobs that run on a schedule.
599
+ ]`;continue}i+=n[u],n[u]==="\\"?s=!0:o&&n[u]==="]"?o=!1:!o&&n[u]==="["&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}var jL,Ks,t7e,PE=L(()=>{Wu();Ks={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(jL===void 0&&(jL=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jL),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};t7e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function IE(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===ce.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,i)=>({...n,[i]:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",i]})??_r(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===ce.ZodString&&e.keyType._def.checks?.length){let{type:n,...i}=RE(e.keyType._def,t);return{...r,propertyNames:i}}else{if(e.keyType?._def.typeName===ce.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===ce.ZodBranded&&e.keyType._def.type._def.typeName===ce.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...i}=EE(e.keyType._def,t);return{...r,propertyNames:i}}}return r}var OE=L(()=>{dy();Jr();PE();TE();ws()});function Zae(e,t){if(t.mapStrategy==="record")return IE(e,t);let r=Ve(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||_r(t),n=Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||_r(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var ML=L(()=>{Jr();OE();ws()});function Vae(e){let t=e.values,n=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),i=Array.from(new Set(n.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}var LL=L(()=>{});function Hae(e){return e.target==="openAi"?void 0:{not:_r({...e,currentPath:[...e.currentPath,"not"]})}}var qL=L(()=>{ws()});function Bae(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var FL=L(()=>{});function Jae(e,t){if(t.target==="openApi3")return Wae(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in I_&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((i,s)=>{let o=I_[s._def.typeName];return o&&!i.includes(o)?[...i,o]:i},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((i,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...i,o];case"bigint":return[...i,"integer"];case"object":if(s._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(n.length===r.length){let i=n.filter((s,o,a)=>a.indexOf(s)===o);return{type:i.length>1?i:i[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(s=>!n.includes(s))],[])};return Wae(e,t)}var I_,Wae,CE=L(()=>{Jr();I_={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Wae=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,i)=>Ve(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function Gae(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:I_[e.innerType._def.typeName],nullable:!0}:{type:[I_[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var UL=L(()=>{Jr();CE()});function Kae(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",xL(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?xt(r,"minimum",n.value,n.message,t):xt(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),xt(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?xt(r,"maximum",n.value,n.message,t):xt(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),xt(r,"maximum",n.value,n.message,t));break;case"multipleOf":xt(r,"multipleOf",n.value,n.message,t);break}return r}var ZL=L(()=>{Wu()});function Yae(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},i=[],s=e.shape();for(let a in s){let u=s[a];if(u===void 0||u._def===void 0)continue;let l=i7e(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=Ve(u._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});c!==void 0&&(n.properties[a]=c,l||i.push(a))}i.length&&(n.required=i);let o=n7e(e,t);return o!==void 0&&(n.additionalProperties=o),n}function n7e(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ve(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function i7e(e){try{return e.isOptional()}catch{return!0}}var VL=L(()=>{Jr()});var Xae,HL=L(()=>{Jr();ws();Xae=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Ve(e.innerType._def,t);let r=Ve(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:_r(t)},r]}:_r(t)}});var Qae,BL=L(()=>{Jr();Qae=(e,t)=>{if(t.pipeStrategy==="input")return Ve(e.in._def,t);if(t.pipeStrategy==="output")return Ve(e.out._def,t);let r=Ve(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Ve(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(i=>i!==void 0)}}});function eue(e,t){return Ve(e.type._def,t)}var WL=L(()=>{Jr()});function tue(e,t){let n={type:"array",uniqueItems:!0,items:Ve(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&xt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&xt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}var JL=L(()=>{Wu();Jr()});function rue(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Ve(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Ve(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Ve(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var GL=L(()=>{Jr()});function nue(e){return{not:_r(e)}}var KL=L(()=>{ws()});function iue(e){return _r(e)}var YL=L(()=>{ws()});var sue,XL=L(()=>{Jr();sue=(e,t)=>Ve(e.innerType._def,t)});var oue,QL=L(()=>{dy();ws();$L();EL();TL();TE();RL();IL();OL();CL();NL();AL();DL();ML();LL();qL();FL();UL();ZL();VL();HL();BL();WL();OE();JL();PE();GL();KL();CE();YL();XL();oue=(e,t,r)=>{switch(t){case ce.ZodString:return RE(e,r);case ce.ZodNumber:return Kae(e,r);case ce.ZodObject:return Yae(e,r);case ce.ZodBigInt:return Aae(e,r);case ce.ZodBoolean:return Dae();case ce.ZodDate:return PL(e,r);case ce.ZodUndefined:return nue(r);case ce.ZodNull:return Bae(r);case ce.ZodArray:return Nae(e,r);case ce.ZodUnion:case ce.ZodDiscriminatedUnion:return Jae(e,r);case ce.ZodIntersection:return qae(e,r);case ce.ZodTuple:return rue(e,r);case ce.ZodRecord:return IE(e,r);case ce.ZodLiteral:return Fae(e,r);case ce.ZodEnum:return Lae(e);case ce.ZodNativeEnum:return Vae(e);case ce.ZodNullable:return Gae(e,r);case ce.ZodOptional:return Xae(e,r);case ce.ZodMap:return Zae(e,r);case ce.ZodSet:return tue(e,r);case ce.ZodLazy:return()=>e.getter()._def;case ce.ZodPromise:return eue(e,r);case ce.ZodNaN:case ce.ZodNever:return Hae(r);case ce.ZodEffects:return Mae(e,r);case ce.ZodAny:return _r(r);case ce.ZodUnknown:return iue(r);case ce.ZodDefault:return zae(e,r);case ce.ZodBranded:return EE(e,r);case ce.ZodReadonly:return sue(e,r);case ce.ZodCatch:return jae(e,r);case ce.ZodPipeline:return Qae(e,r);case ce.ZodFunction:case ce.ZodVoid:case ce.ZodSymbol:return;default:return(n=>{})(t)}}});function Ve(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==Iae)return a}if(n&&!r){let a=s7e(n,t);if(a!==void 0)return a}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let s=oue(e,e.typeName,t),o=typeof s=="function"?Ve(s(),t):s;if(o&&o7e(e,t,o),t.postProcess){let a=t.postProcess(o,e,t);return i.jsonSchema=o,a}return i.jsonSchema=o,o}var s7e,o7e,Jr=L(()=>{kE();QL();$E();ws();s7e=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:xE(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),_r(t)):t.$refStrategy==="seen"?_r(t):void 0}},o7e=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r)});var aue=L(()=>{});var eq,tq=L(()=>{Jr();kL();ws();eq=(e,t)=>{let r=Cae(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[l,c])=>({...u,[l]:Ve(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??_r(r)}),{}):void 0,i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=Ve(e._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1)??_r(r),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=i===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a}});var uue=L(()=>{kE();kL();Wu();$E();Jr();aue();ws();$L();EL();TL();TE();RL();IL();OL();CL();NL();AL();DL();ML();LL();qL();FL();UL();ZL();VL();HL();BL();WL();XL();OE();JL();PE();GL();KL();CE();YL();QL();tq();tq()});function a7e(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function rq(e,t){return _s(e)?Rc(e,{target:a7e(t?.target),io:t?.pipeStrategy??"input"}):eq(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function nq(e){let r=Zu(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=x$(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function iq(e,t){let r=Uu(e,t);if(!r.success)throw r.error;return r.data}var sq=L(()=>{Xz();n_();uue()});function lue(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function cue(e,t){let r={...e};for(let n in t){let i=n,s=t[i];if(s===void 0)continue;let o=r[i];lue(o)&&lue(s)?r[i]={...o,...s}:r[i]=s}return r}var u7e,NE,due=L(()=>{n_();P_();Rae();sq();u7e=6e4,NE=class{constructor(t){this._options=t,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._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(oE,r=>{this._oncancel(r)}),this.setNotificationHandler(uE,r=>{this._onprogress(r)}),this.setRequestHandler(aE,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(lE,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Oe(Le.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(dE,async(r,n)=>{let i=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let u=a.message,l=u.id,c=this._requestResolvers.get(l);if(c)if(this._requestResolvers.delete(l),a.type==="response")c(u);else{let d=u,p=new Oe(d.error.code,d.error.message,d.error.data);c(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(s,n.sessionId);if(!o)throw new Oe(Le.InvalidParams,`Task not found: ${s}`);if(!Bu(o.status))return await this._waitForTaskUpdate(s,n.signal),await i();if(Bu(o.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Hu]:{taskId:s}}}}return await i()};return await i()}),this.setRequestHandler(fE,async(r,n)=>{try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new Oe(Le.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(hE,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Oe(Le.InvalidParams,`Task not found: ${r.params.taskId}`);if(Bu(i.status))throw new Oe(Le.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new Oe(Le.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(i){throw i instanceof Oe?i:new Oe(Le.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Oe.fromError(Le.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let i=this._transport?.onmessage;this._transport.onmessage=(s,o)=>{i?.(s,o),b_(s)||_ae(s)?this._onresponse(s):lL(s)?this._onrequest(s,o):yae(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Oe.fromError(Le.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,s=t.params?._meta?.[Hu]?.taskId;if(n===void 0){let c={jsonrpc:"2.0",id:t.id,error:{code:Le.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:c,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(c).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(t.id,o);let a=hae(t.params)?t.params.task:void 0,u=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async c=>{if(o.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(c,d)},sendRequest:async(c,d,p)=>{if(o.signal.aborted)throw new Oe(Le.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&u&&await u.updateTaskStatus(h,"input_required"),await this.request(c,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:u,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,l)).then(async c=>{if(o.signal.aborted)return;let d={result:c,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async c=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(c.code)?c.code:Le.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let o=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(u){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(u);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),b_(t))n(t);else{let o=new Oe(t.error.code,t.error.message,t.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(b_(t)&&t.result&&typeof t.result=="object"){let o=t.result;if(o.task&&typeof o.task=="object"){let a=o.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),b_(t))i(t);else{let o=Oe.fromError(t.error.code,t.error.message,t.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(o){yield{type:"error",error:o instanceof Oe?o:new Oe(Le.InternalError,String(o))}}return}let s;try{let o=await this.request(t,Up,n);if(o.task)s=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new Oe(Le.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Bu(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new Oe(Le.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new Oe(Le.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let u=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,u)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof Oe?o:new Oe(Le.InternalError,String(o))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o,task:a,relatedTask:u}=n??{};return new Promise((l,c)=>{let d=b=>{c(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),u&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Hu]:u}});let h=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(m=>this._onerror(new Error(`Failed to send cancellation: ${m}`)));let g=b instanceof Oe?b:new Oe(Le.RequestTimeout,String(b));c(g)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return c(b);try{let g=Uu(r,b.result);g.success?l(g.data):c(g.error)}catch(g){c(g)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let v=n?.timeout??u7e,y=()=>h(Oe.fromError(Le.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(p,v,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let _=u?.taskId;if(_){let b=g=>{let m=this._responseHandlers.get(p);m?m(g):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(p),c(g)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),c(b)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},cE,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},pE,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},bae,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Hu]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Hu]:r.relatedTask}}}),this._transport?.send(a,r).catch(u=>this._onerror(u))});return}let o={...t,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Hu]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(t,r){let n=nq(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>{let o=iq(t,i);return Promise.resolve(r(o,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=nq(t);this._notificationHandlers.set(n,i=>{let s=iq(t,i);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&lL(i.message)){let s=i.message.id,o=this._requestResolvers.get(s);o?(o(new Oe(Le.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,s)=>{if(r.aborted){s(new Oe(Le.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),s(new Oe(Le.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let s=await n.getTask(i,r);if(!s)throw new Oe(Le.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(i,s,o)=>{await n.storeTaskResult(i,s,o,r);let a=await n.getTask(i,r);if(a){let u=$_.parse({method:"notifications/tasks/status",params:a});await this.notification(u),Bu(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,s,o)=>{let a=await n.getTask(i,r);if(!a)throw new Oe(Le.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Bu(a.status))throw new Oe(Le.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,s,o,r);let u=await n.getTask(i,r);if(u){let l=$_.parse({method:"notifications/tasks/status",params:u});await this.notification(l),Bu(u.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}}});function l7e(){let e=new fue.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,pue.default)(e),e}var fue,pue,AE,hue=L(()=>{fue=ro(sm(),1),pue=ro(jb(),1);AE=class{constructor(t){this._ajv=t??l7e()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var DE,mue=L(()=>{P_();DE=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],s=Array.isArray(i.content)?i.content:[i.content],o=s.some(c=>c.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,u=a?Array.isArray(a.content)?a.content:[a.content]:[],l=u.some(c=>c.type==="tool_use");if(o){if(s.some(c=>c.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let c=new Set(u.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(c.size!==d.size||![...c].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},R_,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),i=t.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=i==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Hp,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}}});function gue(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function yue(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var _ue=L(()=>{});var jE,vue=L(()=>{due();P_();hue();n_();mue();_ue();jE=class extends NE{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(T_.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let s=this._loggingLevels.get(i);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new AE,this.setRequestHandler(fL,n=>this._oninitialize(n)),this.setNotificationHandler(pL,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(bL,async(n,i)=>{let s=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,a=T_.safeParse(o);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new DE(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cue(this._capabilities,t)}setRequestHandler(t,r){let i=Zu(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let s;if(_s(i)){let a=i;s=a._zod?.def?.value??a.value}else{let a=i;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(u,l)=>{let c=Uu(Vp,u);if(!c.success){let h=c.error instanceof Error?c.error.message:String(c.error);throw new Oe(Le.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=c.data,p=await Promise.resolve(r(u,l));if(d.task){let h=Uu(Up,p);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new Oe(Le.InvalidParams,`Invalid task creation result: ${v}`)}return h.data}let f=Uu(wE,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new Oe(Le.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){yue(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&gue(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:dae.includes(r)?r:aL,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},sE)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],s=i.some(l=>l.type==="tool_result"),o=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=o?Array.isArray(o.content)?o.content:[o.content]:[],u=a.some(l=>l.type==="tool_use");if(s){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),c=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==c.size||![...l].every(d=>c.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},wL,r):this.request({method:"sampling/createMessage",params:t},R_,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Hp,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:i},Hp,r);if(s.action==="accept"&&s.content&&i.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(i.requestedSchema)(s.content);if(!a.valid)throw new Oe(Le.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(o){throw o instanceof Oe?o:new Oe(Le.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},SL,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function oq(e){return!!e&&typeof e=="object"&&wue in e}function Sue(e){return e[wue]?.complete}var wue,bue,kue=L(()=>{wue=Symbol.for("mcp.completable");(function(e){e.Completable="McpCompletable"})(bue||(bue={}))});var xue=L(()=>{});function d7e(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!c7e.test(e)){let r=e.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,s)=>s.indexOf(n)===i);return t.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function f7e(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function aq(e){let t=d7e(e);return f7e(e,t.warnings),t.isValid}var c7e,$ue=L(()=>{c7e=/^[A-Za-z0-9._-]{1,128}$/});var zE,Eue=L(()=>{zE=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,n){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,n)}}});var Oc=L(()=>{__();__()});function Pue(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function h7e(e){return"_def"in e||"_zod"in e||Pue(e)}function uq(e){return typeof e!="object"||e===null||h7e(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(Pue)}function Tue(e){if(e)return uq(e)?Pc(e):e}function m7e(e){let t=Zu(e);return t?Object.entries(t).map(([r,n])=>{let i=Jse(n),s=Gse(n);return{name:r,description:i,required:!s}}):[]}function Ju(e){let r=Zu(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=x$(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function Rue(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var ME,p7e,O_,Iue=L(()=>{vue();n_();sq();P_();kue();xue();$ue();Eue();Oc();ME=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new jE(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new zE(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(bE)),this.server.assertCanSetRequestHandler(Ju(Vp)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(bE,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let n={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=Op(r.inputSchema);return i?rq(i,{strictUnions:!0,pipeStrategy:"input"}):p7e})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=Op(r.outputSchema);i&&(n.outputSchema=rq(i,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Vp,async(t,r)=>{try{let n=this._registeredTools[t.params.name];if(!n)throw new Oe(Le.InvalidParams,`Tool ${t.params.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,s=n.execution?.taskSupport,o="createTask"in n.handler;if((s==="required"||s==="optional")&&!o)throw new Oe(Le.InternalError,`Tool ${t.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!i)throw new Oe(Le.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(n,t,r);let a=await this.validateToolInput(n,t.params.arguments,t.params.name),u=await this.executeToolHandler(n,a,r);return i||await this.validateToolOutput(n,u,t.params.name),u}catch(n){if(n instanceof Oe&&n.code===Le.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,n){if(!t.inputSchema)return;let s=Op(t.inputSchema)??t.inputSchema,o=await S$(s,r);if(!o.success){let a="error"in o?o.error:"Unknown error",u=k$(a);throw new Oe(Le.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${u}`)}return o.data}async validateToolOutput(t,r,n){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new Oe(Le.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let i=Op(t.outputSchema),s=await S$(i,r.structuredContent);if(!s.success){let o="error"in s?s.error:"Unknown error",a=k$(o);throw new Oe(Le.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(t,r,n){let i=t.handler;if("createTask"in i){if(!n.taskStore)throw new Error("No task store provided.");let o={...n,taskStore:n.taskStore};if(t.inputSchema){let a=i;return await Promise.resolve(a.createTask(r,o))}else{let a=i;return await Promise.resolve(a.createTask(o))}}if(t.inputSchema){let o=i;return await Promise.resolve(o(r,n))}else{let o=i;return await Promise.resolve(o(n))}}async handleAutomaticTaskPolling(t,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),s=t.handler,o={...n,taskStore:n.taskStore},a=i?await Promise.resolve(s.createTask(i,o)):await Promise.resolve(s.createTask(o)),u=a.task.taskId,l=a.task,c=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(p=>setTimeout(p,c));let d=await n.taskStore.getTask(u);if(!d)throw new Oe(Le.InternalError,`Task ${u} not found during polling`);l=d}return await n.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Ju(SE)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(SE,async t=>{switch(t.params.ref.type){case"ref/prompt":return Eae(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Tae(t),this.handleResourceCompletion(t,t.params.ref);default:throw new Oe(Le.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let n=this._registeredPrompts[r.name];if(!n)throw new Oe(Le.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return O_;let s=Zu(n.argsSchema)?.[t.params.argument.name];if(!oq(s))return O_;let o=Sue(s);if(!o)return O_;let a=await o(t.params.argument.value,t.params.context);return Rue(a)}async handleResourceCompletion(t,r){let n=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return O_;throw new Oe(Le.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=n.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return O_;let s=await i(t.params.argument.value,t.params.context);return Rue(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(mE)),this.server.assertCanSetRequestHandler(Ju(gE)),this.server.assertCanSetRequestHandler(Ju(yE)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(mE,async(t,r)=>{let n=Object.entries(this._registeredResources).filter(([s,o])=>o.enabled).map(([s,o])=>({uri:s,name:o.name,...o.metadata})),i=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let o=await s.resourceTemplate.listCallback(r);for(let a of o.resources)i.push({...s.metadata,...a})}return{resources:[...n,...i]}}),this.server.setRequestHandler(gE,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(yE,async(t,r)=>{let n=new URL(t.params.uri),i=this._registeredResources[n.toString()];if(i){if(!i.enabled)throw new Oe(Le.InvalidParams,`Resource ${n} disabled`);return i.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let o=s.resourceTemplate.uriTemplate.match(n.toString());if(o)return s.readCallback(n,o,r)}throw new Oe(Le.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ju(_E)),this.server.assertCanSetRequestHandler(Ju(vE)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(_E,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?m7e(r.argsSchema):void 0}))})),this.server.setRequestHandler(vE,async(t,r)=>{let n=this._registeredPrompts[t.params.name];if(!n)throw new Oe(Le.InvalidParams,`Prompt ${t.params.name} not found`);if(!n.enabled)throw new Oe(Le.InvalidParams,`Prompt ${t.params.name} disabled`);if(n.argsSchema){let i=Op(n.argsSchema),s=await S$(i,t.params.arguments);if(!s.success){let u="error"in s?s.error:"Unknown error",l=k$(u);throw new Oe(Le.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${l}`)}let o=s.data,a=n.callback;return await Promise.resolve(a(o,r))}else{let i=n.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...n){let i;typeof n[0]=="object"&&(i=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(t,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(t,r,n,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,n,i,s){let o={name:t,title:r,metadata:i,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=o)),typeof a.name<"u"&&(o.name=a.name),typeof a.title<"u"&&(o.title=a.title),typeof a.metadata<"u"&&(o.metadata=a.metadata),typeof a.callback<"u"&&(o.readCallback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=o,o}_createRegisteredResourceTemplate(t,r,n,i,s){let o={resourceTemplate:n,title:r,metadata:i,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredResourceTemplates[t],l.name&&(this._registeredResourceTemplates[l.name]=o)),typeof l.title<"u"&&(o.title=l.title),typeof l.template<"u"&&(o.resourceTemplate=l.template),typeof l.metadata<"u"&&(o.metadata=l.metadata),typeof l.callback<"u"&&(o.readCallback=l.callback),typeof l.enabled<"u"&&(o.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=o;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!n.completeCallback(l))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(t,r,n,i,s){let o={title:r,description:n,argsSchema:i===void 0?void 0:Pc(i),callback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=o)),typeof a.title<"u"&&(o.title=a.title),typeof a.description<"u"&&(o.description=a.description),typeof a.argsSchema<"u"&&(o.argsSchema=Pc(a.argsSchema)),typeof a.callback<"u"&&(o.callback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=o,i&&Object.values(i).some(u=>{let l=u instanceof qp?u._def?.innerType:u;return oq(l)})&&this.setCompletionRequestHandler(),o}_createRegisteredTool(t,r,n,i,s,o,a,u,l){aq(t);let c={title:r,description:n,inputSchema:Tue(i),outputSchema:Tue(s),annotations:o,execution:a,_meta:u,handler:l,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&&aq(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=c)),typeof d.title<"u"&&(c.title=d.title),typeof d.description<"u"&&(c.description=d.description),typeof d.paramsSchema<"u"&&(c.inputSchema=Pc(d.paramsSchema)),typeof d.outputSchema<"u"&&(c.outputSchema=Pc(d.outputSchema)),typeof d.callback<"u"&&(c.handler=d.callback),typeof d.annotations<"u"&&(c.annotations=d.annotations),typeof d._meta<"u"&&(c._meta=d._meta),typeof d.enabled<"u"&&(c.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let n,i,s,o;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let u=r[0];uq(u)?(i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!uq(r[0])&&(o=r.shift())):typeof u=="object"&&u!==null&&(o=r.shift())}let a=r[0];return this._createRegisteredTool(t,void 0,n,i,s,o,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:s,inputSchema:o,outputSchema:a,annotations:u,_meta:l}=r;return this._createRegisteredTool(t,i,s,o,a,u,{taskSupport:"forbidden"},l,n)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let i;r.length>1&&(i=r.shift());let s=r[0],o=this._createRegisteredPrompt(t,void 0,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(t,r,n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:s,argsSchema:o}=r,a=this._createRegisteredPrompt(t,i,s,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},p7e={type:"object",properties:{}};O_={completion:{values:[],hasMore:!1}}});async function Due(e,t){let r=new cs(t.paths);await r.init();try{switch(e.action){case"create":{if(!e.id||!e.cron||!e.instruction)throw new Error("Missing required arguments for 'create' action (id, cron, instruction)");let n;if(t.ownerSessionKey){if(e.notify===!0){let a=await g7e(r,t.ownerSessionKey);if(!a)throw new Error(`notify: true requested but could not find parent job for session "${t.ownerSessionKey}". Ensure the owner job file exists in var/jobs/active/.`);let u=To(a.frontmatter.notify);if(u.length===0)throw new Error(`notify: true requested but parent job '${a.id}' has no notify targets configured. The parent job is a silent job; child jobs cannot inherit its notify.`);n=u.length===1?u[0]:u}}else{let o=e;if(o.notify){let u=To(o.notify).filter(l=>!tS(l));if(u.length>0)throw new Error(`Invalid notify target: ${u.join(", ")}. Expected format: <session-key> only (no spaces), for example 'stdio:default' or 'lark:oc_abc123:ou_xyz'.`);n=o.notify}}await r.createJob(e.id,{cron:e.cron,notify:n,owner_session:t.ownerSessionKey?n!==void 0?t.ownerSessionKey:void 0:e.owner_session,cwd_rel:e.cwd_rel},e.instruction);let i=await r.getJob(e.id),s=i?.frontmatter.notify?Array.isArray(i.frontmatter.notify)?i.frontmatter.notify.join(", "):i.frontmatter.notify:"(silent)";return`Job '${e.id}' created successfully. Scheduled: ${e.cron}, Target: ${s}, Session: ${i?.session_key??"unknown"}, CWD: ${i?.execution_cwd??"unknown"}`}case"archive":{if(!e.id)throw new Error("Missing required argument 'id' for 'archive' action");let n=await r.getJob(e.id);await r.archiveJob(e.id);let i=n?.session_key??vf({jobId:e.id,ownerSession:n?.frontmatter.owner_session,cron:n?.frontmatter.cron,cwdRel:n?.frontmatter.cwd_rel});return await lg(t.paths,i),`Job '${e.id}' archived (cancelled).`}case"read":{if(!e.id)throw new Error("Missing required argument 'id' for 'read' action");let n=await r.getJob(e.id);if(!n)return`Job '${e.id}' not found.`;let{content:i,...s}=n;return JSON.stringify({...s,instruction:i},null,2)}case"list":{let n=await r.listJobs();if(n.length===0)return"No active jobs found.";let i=n.map(s=>({id:s.id,cron:s.frontmatter.cron,notify:s.frontmatter.notify,job_file_path:s.path,state_file_path:s.path.replace(/\.md$/,".state.json"),execution_cwd:s.execution_cwd,runtime_workspace_dir:s.runtime_workspace_dir,last_scheduled_at:s.state.last_scheduled_at??null,last_run:s.state.last_run_at,last_result:s.state.last_result}));return JSON.stringify(i,null,2)}default:throw new Error(`Unknown action: ${e.action??"unknown"}`)}}catch(n){return qt("[ManageJob] Tool execution failed",n),`Error: ${n instanceof Error?n.message:String(n)}`}}async function g7e(e,t){return(await e.listJobs()).find(n=>n.session_key===t)??null}var lq,Oue,Cue,Nue,Aue,cq=L(()=>{"use strict";wf();xg();Ii();fr();rS();Oc();lq="ManageJob",Oue="mcp__aladuo__ManageJob",Cue=`Create, inspect, or cancel background jobs that run on a schedule.
600
600
 
601
601
  Use this when:
602
602
  - A user asks to set up a recurring or one-time automated task (create)
@@ -606,7 +606,7 @@ Use this when:
606
606
 
607
607
  Do NOT create jobs on your own initiative — only when the user explicitly requests automation.
608
608
  Jobs are not run immediately. They are triggered by the scheduler on the next cycle.
609
- To force an existing job to run immediately, set last_run_at to null in its .state.json sidecar file directly.`,Nue={action:Dt.enum(["create","archive","list","read"]).optional().default("list").describe(`Action to perform. Defaults to 'list'.
609
+ To force an existing job to run immediately, set last_scheduled_at to null in its .state.json sidecar file directly.`,Nue={action:Dt.enum(["create","archive","list","read"]).optional().default("list").describe(`Action to perform. Defaults to 'list'.
610
610
  - create: register a new scheduled job
611
611
  - list: show all active jobs with status
612
612
  - read: show full details and instructions for one job
@@ -653,7 +653,7 @@ and offer a fallback (e.g. paste content as text, or ask the user to switch to a
653
653
  `))}let n=await Ir(e);if(!n?.sessions[r]){let s=Gue(n);throw new Error([`Target session not found in registry: ${r}`,"The target must be a registry session (prefer active foreground sessions).",...s.length>0?["Candidates:",...s]:[]].join(`
654
654
  `))}if(!yq(r))throw new Error(`Target must be a foreground working session (not meta/job/system/cadence): ${r}`);return r}function Kue(e,t,r,n){let i=["Notify delivered.",`- source_session_key: ${e}`,`- source_kind: ${t}`,`- mode: ${r}`,`- delivered_count: ${n.filter(s=>s.success).length}`,`- attempted_count: ${n.length}`];if(n.length>0){i.push("","Targets");for(let s of n)s.success?i.push(`- ${s.targetSessionKey} ok event_id=${s.eventId??"unknown"} mailbox=${s.mailboxPath??"unknown"}`):i.push(`- ${s.targetSessionKey} error: ${s.error??"unknown"}`)}return i.join(`
655
655
  `)}async function nle(e,t){try{let{paths:r,bus:n,sessionKey:i,sessionContextKind:s}=t;if(!n)throw new Error("Notify is unavailable: runtime bus is not available in this context.");if(!i||i.trim().length===0)throw new Error("Notify requires a current session context (session_key).");if(s&&!E7e(s))throw new Error(`Notify is not available in this session context (${s}). It is only available to job and meta sessions.`);let o=e.notify_content?.trim();if(!o)throw new Error("notify_content is required and must not be empty.");let a=s?s==="foreground"?"channel":s:Xue(i),u=(s??(a==="job"?"job":"meta"))==="job"?"job-default-target":"explicit-target",l=u==="job-default-target"?await O7e(r,i):[await C7e(r,e.target_session_key)],c=[];for(let[p,f]of l.entries())try{let h=l.length>1?`notify-${p}`:"notify",v=await Wue(r,n,{traceId:`notify_${Date.now().toString(36)}_${p}`,routeId:h,sourceName:"notify-tool",sourceKind:"route",sourceSessionKey:i,targetSessionKey:f,eventType:"notify",payload:{notify_content:o,text:o,notify_source_kind:a,notify_source_session_key:i}});c.push({targetSessionKey:f,success:v.success,eventId:v.eventId,mailboxPath:v.mailboxPath,error:v.error})}catch(h){c.push({targetSessionKey:f,success:!1,error:h instanceof Error?h.message:String(h)})}if(c.filter(p=>!p.success).length>0)throw new Error(Kue(i,a,u,c));return Kue(i,a,u,c)}catch(r){return qt("[Notify] Tool execution failed",r),`Error: ${r instanceof Error?r.message:String(r)}`}}var gq,Yue,_q=L(()=>{"use strict";Oc();fr();Ii();wf();xg();Jue();gq="Notify",Yue="mcp__aladuo__Notify"});async function ale(e,t){try{let{paths:r,bus:n,sessionKey:i}=t;if(!n)throw new Error("Skip is unavailable: runtime bus is not available in this context.");if(!i||i.trim().length===0)throw new Error("Skip requires a current session context (session_key).");let s=e.reason?.trim();if(!s)throw new Error("reason is required and must not be empty.");return await _i(r,i,{pending_skip_rewind:{reason:s,skipped_at:new Date().toISOString()}}),ot("[Skip] skip rewind saved, triggering self-preempt",{sessionKey:i,reason:s}),n.emit("session.wake",{sessionKey:i,preempt:"force",preemptBoundary:"tool_result"}),"Skip acknowledged. This turn will produce no output."}catch(r){return qt("[Skip] Tool execution failed",r),`Error: ${r instanceof Error?r.message:String(r)}`}}var vq,ile,sle,ole,bq=L(()=>{"use strict";Oc();fr();$o();vq="Skip",ile="mcp__aladuo__Skip",sle=["Gracefully skip this turn without sending any output to the user/channel.","","If you decide the user should receive nothing, you MUST call Skip.","Skip is the only valid way to produce silence.","Any normal text you emit instead may be delivered to the user/channel.","","Use this when you receive a notification, job result, or event that does NOT","require a user-facing response. Calling Skip immediately ends this turn.","Do NOT output acknowledgements, summaries, or self-notes such as",'"received", "continue observing", "no need to reply", or','"not replying to the user". Those are still user-visible output.',"","On your next turn, you will receive a <skip-rewind> block that tells you:","- That you chose to skip","- The reason you provided","- The timestamp of the skip","- How much time has elapsed since the skip","","This gives you continuity across turns even though you produced no output.","","When to use Skip:","- Intermediate job progress that isn't actionable yet","- Routine system notifications that need no user attention","- Duplicate or redundant notifications you've already addressed","","When NOT to use Skip:","- When the user sent a direct message (never skip user messages)","- When a job completed with results the user is waiting for","- When an error or anomaly requires user attention"].join(`
656
- `),ole={reason:Dt.string().describe("Why you are skipping this turn. Be specific — this reason will be shown to you on your next turn via <skip-rewind> so you can maintain continuity.")}});function LE(e,t={}){let r=new ME({name:"aladuo",version:"1.0.0"},{capabilities:{tools:{}}}),n=t.sessionContextKind==="job";return r.registerTool(lq,{title:lq,description:Cue,inputSchema:n?Aue:Nue},async i=>({content:[{type:"text",text:await Due(i,{paths:e,ownerSessionKey:n?t.sessionKey:void 0})}]})),r.registerTool(fq,{title:fq,description:Mue,inputSchema:Lue},async i=>({content:[{type:"text",text:await que(i,{paths:e,sessionKey:t.sessionKey})}]})),t.sessionContextKind==="foreground"&&(r.registerTool(hq,{title:hq,description:Zue,inputSchema:Vue},async i=>({content:[{type:"text",text:await Bue(i,{paths:e,sessionKey:t.sessionKey})}]})),r.registerTool(vq,{title:vq,description:sle,inputSchema:ole},async i=>({content:[{type:"text",text:await ale(i,{paths:e,bus:t.bus,sessionKey:t.sessionKey})}]}))),(t.sessionContextKind==="job"||t.sessionContextKind==="meta")&&r.registerTool(gq,{title:gq,description:tle({sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind}),inputSchema:rle({sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind})},async i=>({content:[{type:"text",text:await nle(i,{paths:e,bus:t.bus,sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind})}]})),{type:"sdk",name:"aladuo",instance:r}}var wq=L(()=>{"use strict";Iue();cq();pq();mq();_q();bq()});var lle={};Kr(lle,{createSessionManager:()=>U7e});import{existsSync as N7e}from"node:fs";import A7e from"node:path";function ule(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??"[object]"}catch{return"[object]"}}function j7e(e){return e.type==="system"?e.subtype==="init"?`system:${e.subtype}`:null:e.type==="thought_chunk"?null:e.type==="tool_use"?`tool_use:${e.toolUseId}:${ule(e.input)}`:e.type==="tool_result"?`tool_result:${e.toolUseId}:${e.isError?"1":"0"}`:null}function z7e(e){return e.type==="thought_chunk"?{type:"thought_chunk",text:e.text}:e.type==="tool_use"?{type:"tool_use",tool_use_id:e.toolUseId,tool_name:e.toolName,input_summary:ule(e.input)}:e.type==="tool_result"?{type:"tool_result",tool_use_id:e.toolUseId,tool_name:e.toolName,is_error:e.isError,summary:e.summary}:null}function M7e(e){let t=e.indexOf(":");return t<=0?"unknown":e.slice(0,t)}function L7e(){return[...D7e]}function q7e(e,t){return t==="job"||e.startsWith("job:")?"job":"channel"}function F7e(e){return!e||!A7e.isAbsolute(e)?!1:N7e(e)}function U7e(e){let{paths:t,bus:r,sdk:n,idleTimeoutMs:i=3e5,heartbeatIntervalMs:s=3e4}=e,o=e.maxConcurrentChannel??e.maxConcurrent??10,a=e.maxConcurrentJob??6,u={name:"channel",activeCount:0,maxConcurrent:o,wakeQueue:[]},l={name:"job",activeCount:0,maxConcurrent:a,wakeQueue:[]};function c($,N){return q7e($,N)==="job"?l:u}let d=new Map,p=new Map,f=!1,h=0,v=({sessionKey:$,preempt:N,preemptBoundary:A})=>{Ct("[session-manager] wake",{sessionKey:$,preempt:N??"allow",preemptBoundary:A??"default"}),b($,{preempt:N,preemptBoundary:A})},y=()=>{P()};function _($,N,A){return!$.currentAbortController||$.currentAbortController.signal.aborted?"noop":A==="tool_result"?$.activeToolUseIds.size>0?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_result","defer_tool_result"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate"):A==="tool_use"?$.isStreaming?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_use","defer_tool_use"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate"):N==="soft"&&$.isStreaming?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_use","defer_tool_use"):N==="soft"&&$.activeToolUseIds.size>0?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_result","defer_tool_result"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate")}function b($,N){if(!f){Ct("[session-manager] wake ignored, manager not running",{sessionKey:$});return}let A=N?.preempt??"allow",W=N?.preemptBoundary,H=d.get($);if(H&&H.wakeResolver){Ct("[session-manager] wake delivered to idle actor",{sessionKey:$,actorRunId:H.actorRunId,status:H.status,preemptBoundary:W??"default"}),H.wakeResolver(),H.wakeResolver=null;return}if(H&&H.drainPromise&&(H.status==="active"||H.status==="idle")){if(H.status==="active"&&H.currentAbortController)if(A==="force"){let ne=_(H,"immediate",W);ne==="immediate"?Ct("[session-manager] wake: forced preempt",{sessionKey:$,actorRunId:H.actorRunId,preemptBoundary:W??"default"}):ne==="defer_tool_result"?Ct("[session-manager] wake: forced preempt deferred until tool_result",{sessionKey:$,actorRunId:H.actorRunId}):ne==="defer_tool_use"&&Ct("[session-manager] wake: forced preempt deferred until tool_use",{sessionKey:$,actorRunId:H.actorRunId})}else if(A==="allow"){let ne=_(H,"soft",W);ne==="defer_tool_use"?Ct("[session-manager] wake: soft preempt pending (streaming)",{sessionKey:$,actorRunId:H.actorRunId}):ne==="defer_tool_result"?Ct("[session-manager] wake: soft preempt deferred until tool_result",{sessionKey:$,actorRunId:H.actorRunId}):ne==="immediate"&&Ct("[session-manager] wake: hard preempt (not streaming)",{sessionKey:$,actorRunId:H.actorRunId})}else Ct("[session-manager] wake: preempt disabled, queueing only",{sessionKey:$,actorRunId:H.actorRunId});H.pendingWake=!0,Ct("[session-manager] wake marked pending",{sessionKey:$,actorRunId:H.actorRunId,status:H.status});return}let re=c($,H?.origin);if(re.activeCount>=re.maxConcurrent){let ne=re.wakeQueue.includes($);ne||re.wakeQueue.push($),Ct("[session-manager] wake queued",{sessionKey:$,pool:re.name,activeCount:re.activeCount,maxConcurrent:re.maxConcurrent,alreadyQueued:ne,queuedSessions:re.wakeQueue.length});return}Ct("[session-manager] wake starting actor",{sessionKey:$}),g($)}function g($,N){let A=d.get($),W=A?.attachedChannels??new Set,H=++h,re={sessionKey:$,actorRunId:H,sdkSessionId:A?.sdkSessionId,status:"active",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:W,origin:N?.origin??A?.origin??"channel",jobId:N?.jobId??A?.jobId};d.set($,re);let ne=c($,re.origin);ne.activeCount++,df(t,{session_key:$,display_name:$,kind:re.origin==="job"?"job":re.origin==="system"?"system":$.startsWith("meta:")?"meta":"channel"}).catch(()=>{}),ot("[session-manager] actor start",{sessionKey:$,actorRunId:H,sdkSessionId:re.sdkSessionId,origin:re.origin,jobId:re.jobId,pool:ne.name,activeCount:ne.activeCount,attachedChannels:re.attachedChannels.size,queuedSessions:ne.wakeQueue.length});let Z=qs($);if(re.heartbeatInterval=setInterval(async()=>{if(!(re.status!=="active"||!re.currentAbortController))try{await Ore(t,Z)}catch{}},s),N?.preStart){let z=N.preStart;re.drainPromise=z().catch(B=>qt("[session-manager] preStart failed",B)).then(()=>m(re))}else re.drainPromise=m(re)}async function m($){let{sessionKey:N}=$,A,W;Ct("[session-manager] drain loop begin",{sessionKey:N,actorRunId:$.actorRunId,origin:$.origin,jobId:$.jobId});try{let re=(await Ir(t))?.sessions[N];if(re?.session_id&&re.session_id!=="unknown"&&($.sdkSessionId=re.session_id),!$.sdkSessionId){let ne=await Kn(t,N);ne?.sdk_session_id&&($.sdkSessionId=ne.sdk_session_id,ot("[session-manager] recovered sdk_session_id from state.json",{sessionKey:N,sdkSessionId:ne.sdk_session_id}),await sn(t,N,{session_id:ne.sdk_session_id}))}if($.origin==="job"&&$.jobId){let ne=await w.getJob($.jobId);ne?.execution_cwd&&(await Me(ne.execution_cwd),await sn(t,N,{cwd:ne.execution_cwd,plane:"work",permission_profile:"work_default"}))}for(;$.status!=="ended"&&f;){$.status="active",await sn(t,N,{status:"active"}),await _i(t,N,{status:"active",sdk_session_id:$.sdkSessionId});let ne=new Set,Z=Date.now(),z=new AbortController;$.currentAbortController=z;let B;try{let D=[Oue,zue];$.origin==="channel"&&(D.push(Uue),D.push(ile)),$.origin==="job"&&D.push(Yue);let O=L7e();B=await Kre(t,N,{sdk:n,abortController:z,mcpServersFactory:()=>({aladuo:LE(t,{sessionKey:N,bus:r,sessionContextKind:$.origin==="job"?"job":$.origin==="system"?"system":"foreground"})}),allowedTools:D,disallowedTools:O,additionalDirectories:[t.memoryDir],onStream:j=>{$.isStreaming=!0,r.emit("session.stream",{sessionKey:N,chunk:j})},onExecutionEvent:j=>{j.type==="tool_use"&&($.isStreaming=!1,$.activeToolUseIds.add(j.toolUseId),$.pendingPreempt&&$.pendingPreemptBoundary==="tool_use"&&($.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.currentAbortController?.abort())),j.type==="tool_result"&&($.activeToolUseIds.delete(j.toolUseId),$.pendingPreempt&&$.pendingPreemptBoundary==="tool_result"&&$.activeToolUseIds.size===0&&($.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.currentAbortController?.abort()));let V=j7e(j);if(V&&ne.has(V))return;V&&ne.add(V);let Y=z7e(j);Y&&r.emit("session.execution",{sessionKey:N,event:Y})}})}finally{$.currentAbortController===z&&($.currentAbortController=null),$.isStreaming=!1,$.activeToolUseIds.clear(),$.pendingPreempt=!1,$.pendingPreemptBoundary=null}Ct("[session-manager] drain result",{sessionKey:N,actorRunId:$.actorRunId,processed:B.processed,skipped:B.skipped,lockAcquired:B.lockAcquired,outboxRecords:B.outboxRecords?.length??(B.lastOutboxRecord?1:0),durationMs:Date.now()-Z});let I=(await Ir(t))?.sessions[N];if(I?.session_id&&I.session_id!=="unknown"){let D=!$.sdkSessionId,O=$.sdkSessionId!==I.session_id;$.sdkSessionId=I.session_id,(D||O)&&ot("[session-manager] sdk session bound",{sessionKey:N,actorRunId:$.actorRunId,sdkSessionId:$.sdkSessionId,isNewSession:D})}if(B.lastReplyText&&(W=B.lastReplyText),B.outboxRecords&&B.outboxRecords.length>0){Ct("[session-manager] emitting outbox records",{sessionKey:N,actorRunId:$.actorRunId,count:B.outboxRecords.length});for(let D of B.outboxRecords)r.emit("session.output",{sessionKey:D.session_key,record:D})}else B.lastOutboxRecord&&(Ct("[session-manager] emitting single outbox record",{sessionKey:N,actorRunId:$.actorRunId,recordId:B.lastOutboxRecord.id}),r.emit("session.output",{sessionKey:N,record:B.lastOutboxRecord}));if(B.processed===0&&B.skipped===0){if($.origin==="job"||$.origin==="system"){Ct("[session-manager] job/system session drain complete, exiting",{sessionKey:N,actorRunId:$.actorRunId,origin:$.origin,jobId:$.jobId});break}if($.pendingWake){$.pendingWake=!1,Ct("[session-manager] pending wake after empty drain, re-draining",{sessionKey:N,actorRunId:$.actorRunId});continue}if($.status="idle",await sn(t,N,{status:"idle",idle_since:new Date().toISOString()}),await _i(t,N,{status:"idle",sdk_session_id:$.sdkSessionId}),$.pendingWake){$.pendingWake=!1,Ct("[session-manager] pending wake during idle transition, re-draining",{sessionKey:N,actorRunId:$.actorRunId});continue}Ct("[session-manager] idle",{sessionKey:N,actorRunId:$.actorRunId,attachedChannels:$.attachedChannels.size});let D=!1;for(;$.status==="idle";){if($.pendingWake){$.pendingWake=!1,D=!0;break}if(await S($,i)||$.status!=="idle"){D=!0;break}if($.attachedChannels.size>0){Ct("[session-manager] idle timeout but has attachments, continuing wait",{sessionKey:N,actorRunId:$.actorRunId,attachedChannels:$.attachedChannels.size});continue}break}if(!D&&$.status==="idle"){Ct("[session-manager] idle timeout, no attachments, exiting",{sessionKey:N,actorRunId:$.actorRunId});break}}}}catch(H){qt(`[session-manager] error in drain loop for ${N}:`,H),await sn(t,N,{status:"error"}),A=H}finally{$.currentAbortController=null,$.isStreaming=!1,$.activeToolUseIds.clear(),$.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.heartbeatInterval&&(clearInterval($.heartbeatInterval),$.heartbeatInterval=null),$.status="ended";let H=c(N,$.origin);H.activeCount--,await _i(t,N,{status:"ended",sdk_session_id:$.sdkSessionId}),$.origin==="job"&&$.jobId&&await x($,A,W),ot("[session-manager] actor end",{sessionKey:N,actorRunId:$.actorRunId,sdkSessionId:$.sdkSessionId,pool:H.name,activeCount:H.activeCount,origin:$.origin,jobId:$.jobId,attachedChannels:$.attachedChannels.size,queuedSessions:H.wakeQueue.length});try{await jS(t,qs(N))}catch{}if(H.wakeQueue.length>0&&f){let re=H.wakeQueue.shift();Ct("[session-manager] dequeue queued wake",{sessionKey:re,pool:H.name,queuedSessions:H.wakeQueue.length}),g(re)}}}function S($,N){return new Promise(A=>{let W=null,H=()=>{W&&(clearTimeout(W),W=null),$.wakeResolver=null};$.wakeResolver=()=>{H(),A(!0)},W=setTimeout(()=>{H(),A(!1)},N)})}let w=new cs(t);async function k($,N){try{await w.init();let A=await w.getJob($);if(!A){kt("[session-manager] cannot project routes: job not found",{jobId:$,sessionKey:N});return}let W=To(A.frontmatter.notify),H=[];for(let re=0;re<W.length;re++){let ne=_f(W[re]);ne?H.push({id:`notify-${re}`,target:ne,mode:"enqueue_inbox",when:["job.complete","job.fail"]}):kt("[session-manager] invalid notify target in job, skipping",{jobId:$,notify:W[re]})}await JX(t,{session_key:N,display_name:$,kind:"job",owner_session:A.frontmatter.owner_session,routes:H})}catch(A){qt("[session-manager] failed to project job routes",{jobId:$,sessionKey:N,err:A})}}async function x($,N,A){let W=$.jobId,{sessionKey:H}=$;try{if(await w.init(),N){let re=N instanceof Error?N.message:String(N);await w.updateState(W,{last_result:"failure",last_error:re});let ne=Qt({type:"job.fail",source:{kind:"job",name:W},session_key:H,payload:{job_id:W,error:re}});await er(t,ne),r.emit("job.failed",{jobId:W,sessionKey:H,error:re}),ot("[session-manager] job failed",{jobId:W,sessionKey:H,error:re})}else{let re=await w.getJob(W),ne=(re?.state.run_count??0)+1;await w.updateState(W,{last_result:"success",last_run_at:new Date().toISOString(),run_count:ne,last_error:void 0});let Z=Qt({type:"job.complete",source:{kind:"job",name:W},session_key:H,payload:{job_id:W,result_summary:A?.slice(0,200)}});await er(t,Z);let z=A?.slice(0,200);r.emit("job.completed",{jobId:W,sessionKey:H,resultSummary:z});let B=re?.frontmatter.cron??"";if(B==="once"||B.startsWith("@in "))try{await w.archiveJob(W),await lg(t,H),ot("[session-manager] auto-archived one-shot job",{jobId:W,cron:B})}catch(q){qt("[session-manager] failed to auto-archive one-shot job",q)}ot("[session-manager] job completed",{jobId:W,sessionKey:H})}}catch(re){qt("[session-manager] error finalizing job session",re)}}function R($,N){if(!f)return;let A=d.get(N);if(A&&A.status!=="ended"){Ct("[session-manager] skip duplicate job spawn",{jobId:$,sessionKey:N,actorStatus:A.status});return}if(l.activeCount>=l.maxConcurrent){l.wakeQueue.includes(N)||l.wakeQueue.push(N),A?(A.origin="job",A.jobId=$):d.set(N,{sessionKey:N,actorRunId:0,sdkSessionId:void 0,status:"idle",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:new Set,origin:"job",jobId:$});return}g(N,{origin:"job",jobId:$,preStart:()=>k($,N)}),(async()=>{try{let W=Qt({type:"job.spawn",source:{kind:"job",name:$},session_key:N,payload:{job_id:$}});await er(t,W),r.emit("job.spawned",{jobId:$,sessionKey:N})}catch(W){qt("[session-manager] error recording job spawn",W)}})()}async function E($,N){let W=(p.get($)??Promise.resolve()).catch(()=>{}).then(async()=>{if($.startsWith("job:")||$.startsWith("meta:")||$.startsWith("system:")||$.startsWith("cadence:"))return;let H=M7e($),re=new Date().toISOString(),ne=Qt({type:"channel.attached",source:{kind:H,name:"session-manager"},session_key:$,payload:{session_key:$,channel_kind:H,channel_id:N,attached_at:re}});await er(t,ne)}).finally(()=>{p.get($)===W&&p.delete($)});p.set($,W),await W}function P(){for(let $ of d.values())$.status="ended",$.currentAbortController&&!$.currentAbortController.signal.aborted&&$.currentAbortController.abort(),$.currentAbortController=null,$.wakeResolver&&($.wakeResolver(),$.wakeResolver=null)}async function C(){if(p.size===0)return;let $=Array.from(p.values()),N=new Promise(A=>setTimeout(A,3e4));await Promise.race([Promise.allSettled($).then(()=>{}),N])}return{async start(){if(!f){f=!0,r.on("session.wake",v),r.on("shutdown",y);try{let $=await qN(t);for(let N of $){if(!F7e(N.cwd)){kt("[session-manager] skip hydrating session with unavailable workspace",{sessionKey:N.session_key,cwd:N.cwd});continue}let A=c(N.session_key);A.activeCount<A.maxConcurrent?g(N.session_key):A.wakeQueue.push(N.session_key)}}catch($){qt("[session-manager] error hydrating sessions:",$)}ot("[session-manager] started",{channelActive:u.activeCount,channelQueued:u.wakeQueue.length,jobActive:l.activeCount,jobQueued:l.wakeQueue.length})}},async stop(){if(!f)return;f=!1,r.off("session.wake",v),r.off("shutdown",y),P();let $=Array.from(d.values()).map(N=>N.drainPromise).filter(N=>N!==null);if($.length>0){let N=new Promise(A=>setTimeout(A,3e4));await Promise.race([Promise.all($),N])}await C(),d.clear(),u.wakeQueue.length=0,u.activeCount=0,l.wakeQueue.length=0,l.activeCount=0,ot("[session-manager] stopped")},wakeSession:b,getActor($){return d.get($)},activeCount(){return u.activeCount+l.activeCount},activeChannelCount(){return u.activeCount},activeJobCount(){return l.activeCount},isRunning(){return f},attachChannel($,N){let A=d.get($);A||(A={sessionKey:$,actorRunId:0,sdkSessionId:void 0,status:"idle",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:new Set,origin:"channel"},d.set($,A)),A.attachedChannels.add(N),Ct("[session-manager] channel attached",{sessionKey:$,channelId:N,totalAttachments:A.attachedChannels.size}),E($,N).catch(W=>{kt("[session-manager] failed to emit channel.attached event",{sessionKey:$,channelId:N,error:String(W)})})},detachChannel($,N){let A=d.get($);A&&(A.attachedChannels.delete(N),Ct("[session-manager] channel detached",{sessionKey:$,channelId:N,remainingAttachments:A.attachedChannels.size}),A.attachedChannels.size===0&&A.status==="idle"&&A.wakeResolver&&(A.wakeResolver(),A.wakeResolver=null))},hasAttachedChannels($){let N=d.get($);return N?N.attachedChannels.size>0:!1},spawnJobSession($,N){R($,N)},async interruptSession($){if(!f)return{interrupted:!1,reason:"not_running"};let N=d.get($);return N?!N.currentAbortController||N.currentAbortController.signal.aborted?{interrupted:!1,reason:"idle"}:(_(N,"immediate")==="immediate"&&ot("[session-manager] interrupt requested",{sessionKey:$,actorRunId:N.actorRunId}),{interrupted:!0,reason:"interrupted"}):{interrupted:!1,reason:"not_found"}},async clearSdkSession($){if(!f)return{cleared:!1,reason:"not_running"};let N=d.get($),A=N?.sdkSessionId;return N?.currentAbortController&&!N.currentAbortController.signal.aborted&&_(N,"immediate"),N&&(N.sdkSessionId=void 0),await sn(t,$,{session_id:"unknown"}),await rc(t,$,"sdk_session_id"),ot("[session-manager] SDK session cleared",{sessionKey:$,actorRunId:N?.actorRunId,previousSessionId:A}),{cleared:!0,previousSessionId:A}}}}var D7e,cle=L(()=>{"use strict";ene();Ii();wf();OD();fu();na();wq();cq();pq();_q();mq();bq();fr();_n();$o();xg();D7e=["EnterPlanMode","ExitPlanMode","AskUserQuestion"]});import{promises as Ea}from"node:fs";import qE from"node:path";async function kq(e){let t;try{t=await Ea.readdir(e.subconsciousDir,{withFileTypes:!0})}catch{return[]}let r=[];for(let n of t){if(!n.isDirectory()||Z7e.has(n.name))continue;let i=qE.join(e.subconsciousDir,n.name),s=qE.join(i,"CLAUDE.md");try{await Ea.access(s)}catch{continue}let o=await V7e(n.name,i,s);o&&r.push(o)}return r.sort((n,i)=>n.name.localeCompare(i.name))}async function V7e(e,t,r){try{let n=await Ea.readFile(r,"utf8"),i=(0,dle.default)(n),s=i.data?.schedule??{},o={enabled:s.enabled??Sq.enabled,cooldown_ticks:s.cooldown_ticks??Sq.cooldown_ticks,max_duration_ms:s.max_duration_ms??Sq.max_duration_ms};return{name:e,dir:t,claudeMdPath:r,schedule:o,promptContent:i.content.trim()}}catch{return null}}async function xq(e){let t;try{t=await Ea.readFile(e.subconsciousPlaylistPath,"utf8")}catch{return{items:[],allDone:!0}}let r=H7e(t),n=r.length===0||r.every(i=>i.done);return{items:r,allDone:n}}function H7e(e){let t=e.split(`
656
+ `),ole={reason:Dt.string().describe("Why you are skipping this turn. Be specific — this reason will be shown to you on your next turn via <skip-rewind> so you can maintain continuity.")}});function LE(e,t={}){let r=new ME({name:"aladuo",version:"1.0.0"},{capabilities:{tools:{}}}),n=t.sessionContextKind==="job";return r.registerTool(lq,{title:lq,description:Cue,inputSchema:n?Aue:Nue},async i=>({content:[{type:"text",text:await Due(i,{paths:e,ownerSessionKey:n?t.sessionKey:void 0})}]})),r.registerTool(fq,{title:fq,description:Mue,inputSchema:Lue},async i=>({content:[{type:"text",text:await que(i,{paths:e,sessionKey:t.sessionKey})}]})),t.sessionContextKind==="foreground"&&(r.registerTool(hq,{title:hq,description:Zue,inputSchema:Vue},async i=>({content:[{type:"text",text:await Bue(i,{paths:e,sessionKey:t.sessionKey})}]})),r.registerTool(vq,{title:vq,description:sle,inputSchema:ole},async i=>({content:[{type:"text",text:await ale(i,{paths:e,bus:t.bus,sessionKey:t.sessionKey})}]}))),(t.sessionContextKind==="job"||t.sessionContextKind==="meta")&&r.registerTool(gq,{title:gq,description:tle({sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind}),inputSchema:rle({sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind})},async i=>({content:[{type:"text",text:await nle(i,{paths:e,bus:t.bus,sessionKey:t.sessionKey,sessionContextKind:t.sessionContextKind})}]})),{type:"sdk",name:"aladuo",instance:r}}var wq=L(()=>{"use strict";Iue();cq();pq();mq();_q();bq()});var lle={};Kr(lle,{createSessionManager:()=>U7e});import{existsSync as N7e}from"node:fs";import A7e from"node:path";function ule(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??"[object]"}catch{return"[object]"}}function j7e(e){return e.type==="system"?e.subtype==="init"?`system:${e.subtype}`:null:e.type==="thought_chunk"?null:e.type==="tool_use"?`tool_use:${e.toolUseId}:${ule(e.input)}`:e.type==="tool_result"?`tool_result:${e.toolUseId}:${e.isError?"1":"0"}`:null}function z7e(e){return e.type==="thought_chunk"?{type:"thought_chunk",text:e.text}:e.type==="tool_use"?{type:"tool_use",tool_use_id:e.toolUseId,tool_name:e.toolName,input_summary:ule(e.input)}:e.type==="tool_result"?{type:"tool_result",tool_use_id:e.toolUseId,tool_name:e.toolName,is_error:e.isError,summary:e.summary}:null}function M7e(e){let t=e.indexOf(":");return t<=0?"unknown":e.slice(0,t)}function L7e(){return[...D7e]}function q7e(e,t){return t==="job"||e.startsWith("job:")?"job":"channel"}function F7e(e){return!e||!A7e.isAbsolute(e)?!1:N7e(e)}function U7e(e){let{paths:t,bus:r,sdk:n,idleTimeoutMs:i=3e5,heartbeatIntervalMs:s=3e4}=e,o=e.maxConcurrentChannel??e.maxConcurrent??10,a=e.maxConcurrentJob??6,u={name:"channel",activeCount:0,maxConcurrent:o,wakeQueue:[]},l={name:"job",activeCount:0,maxConcurrent:a,wakeQueue:[]};function c($,N){return q7e($,N)==="job"?l:u}let d=new Map,p=new Map,f=!1,h=0,v=({sessionKey:$,preempt:N,preemptBoundary:A})=>{Ct("[session-manager] wake",{sessionKey:$,preempt:N??"allow",preemptBoundary:A??"default"}),b($,{preempt:N,preemptBoundary:A})},y=()=>{P()};function _($,N,A){return!$.currentAbortController||$.currentAbortController.signal.aborted?"noop":A==="tool_result"?$.activeToolUseIds.size>0?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_result","defer_tool_result"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate"):A==="tool_use"?$.isStreaming?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_use","defer_tool_use"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate"):N==="soft"&&$.isStreaming?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_use","defer_tool_use"):N==="soft"&&$.activeToolUseIds.size>0?($.pendingPreempt=!0,$.pendingPreemptBoundary="tool_result","defer_tool_result"):($.currentAbortController.abort(),$.currentAbortController=null,$.pendingPreempt=!1,$.pendingPreemptBoundary=null,"immediate")}function b($,N){if(!f){Ct("[session-manager] wake ignored, manager not running",{sessionKey:$});return}let A=N?.preempt??"allow",W=N?.preemptBoundary,H=d.get($);if(H&&H.wakeResolver){Ct("[session-manager] wake delivered to idle actor",{sessionKey:$,actorRunId:H.actorRunId,status:H.status,preemptBoundary:W??"default"}),H.wakeResolver(),H.wakeResolver=null;return}if(H&&H.drainPromise&&(H.status==="active"||H.status==="idle")){if(H.status==="active"&&H.currentAbortController)if(A==="force"){let ne=_(H,"immediate",W);ne==="immediate"?Ct("[session-manager] wake: forced preempt",{sessionKey:$,actorRunId:H.actorRunId,preemptBoundary:W??"default"}):ne==="defer_tool_result"?Ct("[session-manager] wake: forced preempt deferred until tool_result",{sessionKey:$,actorRunId:H.actorRunId}):ne==="defer_tool_use"&&Ct("[session-manager] wake: forced preempt deferred until tool_use",{sessionKey:$,actorRunId:H.actorRunId})}else if(A==="allow"){let ne=_(H,"soft",W);ne==="defer_tool_use"?Ct("[session-manager] wake: soft preempt pending (streaming)",{sessionKey:$,actorRunId:H.actorRunId}):ne==="defer_tool_result"?Ct("[session-manager] wake: soft preempt deferred until tool_result",{sessionKey:$,actorRunId:H.actorRunId}):ne==="immediate"&&Ct("[session-manager] wake: hard preempt (not streaming)",{sessionKey:$,actorRunId:H.actorRunId})}else Ct("[session-manager] wake: preempt disabled, queueing only",{sessionKey:$,actorRunId:H.actorRunId});H.pendingWake=!0,Ct("[session-manager] wake marked pending",{sessionKey:$,actorRunId:H.actorRunId,status:H.status});return}let te=c($,H?.origin);if(te.activeCount>=te.maxConcurrent){let ne=te.wakeQueue.includes($);ne||te.wakeQueue.push($),Ct("[session-manager] wake queued",{sessionKey:$,pool:te.name,activeCount:te.activeCount,maxConcurrent:te.maxConcurrent,alreadyQueued:ne,queuedSessions:te.wakeQueue.length});return}Ct("[session-manager] wake starting actor",{sessionKey:$}),g($)}function g($,N){let A=d.get($),W=A?.attachedChannels??new Set,H=++h,te={sessionKey:$,actorRunId:H,sdkSessionId:A?.sdkSessionId,status:"active",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:W,origin:N?.origin??A?.origin??"channel",jobId:N?.jobId??A?.jobId};d.set($,te);let ne=c($,te.origin);ne.activeCount++,df(t,{session_key:$,display_name:$,kind:te.origin==="job"?"job":te.origin==="system"?"system":$.startsWith("meta:")?"meta":"channel"}).catch(()=>{}),ot("[session-manager] actor start",{sessionKey:$,actorRunId:H,sdkSessionId:te.sdkSessionId,origin:te.origin,jobId:te.jobId,pool:ne.name,activeCount:ne.activeCount,attachedChannels:te.attachedChannels.size,queuedSessions:ne.wakeQueue.length});let Z=qs($);if(te.heartbeatInterval=setInterval(async()=>{if(!(te.status!=="active"||!te.currentAbortController))try{await Ore(t,Z)}catch{}},s),N?.preStart){let z=N.preStart;te.drainPromise=z().catch(B=>qt("[session-manager] preStart failed",B)).then(()=>m(te))}else te.drainPromise=m(te)}async function m($){let{sessionKey:N}=$,A,W;Ct("[session-manager] drain loop begin",{sessionKey:N,actorRunId:$.actorRunId,origin:$.origin,jobId:$.jobId});try{let te=(await Ir(t))?.sessions[N];if(te?.session_id&&te.session_id!=="unknown"&&($.sdkSessionId=te.session_id),!$.sdkSessionId){let ne=await Kn(t,N);ne?.sdk_session_id&&($.sdkSessionId=ne.sdk_session_id,ot("[session-manager] recovered sdk_session_id from state.json",{sessionKey:N,sdkSessionId:ne.sdk_session_id}),await sn(t,N,{session_id:ne.sdk_session_id}))}if($.origin==="job"&&$.jobId){let ne=await w.getJob($.jobId);ne?.execution_cwd&&(await Me(ne.execution_cwd),await sn(t,N,{cwd:ne.execution_cwd,plane:"work",permission_profile:"work_default"}))}for(;$.status!=="ended"&&f;){$.status="active",await sn(t,N,{status:"active"}),await _i(t,N,{status:"active",sdk_session_id:$.sdkSessionId});let ne=new Set,Z=Date.now(),z=new AbortController;$.currentAbortController=z;let B;try{let D=[Oue,zue];$.origin==="channel"&&(D.push(Uue),D.push(ile)),$.origin==="job"&&D.push(Yue);let O=L7e();B=await Kre(t,N,{sdk:n,abortController:z,mcpServersFactory:()=>({aladuo:LE(t,{sessionKey:N,bus:r,sessionContextKind:$.origin==="job"?"job":$.origin==="system"?"system":"foreground"})}),allowedTools:D,disallowedTools:O,additionalDirectories:[t.memoryDir],onStream:j=>{$.isStreaming=!0,r.emit("session.stream",{sessionKey:N,chunk:j})},onExecutionEvent:j=>{j.type==="tool_use"&&($.isStreaming=!1,$.activeToolUseIds.add(j.toolUseId),$.pendingPreempt&&$.pendingPreemptBoundary==="tool_use"&&($.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.currentAbortController?.abort())),j.type==="tool_result"&&($.activeToolUseIds.delete(j.toolUseId),$.pendingPreempt&&$.pendingPreemptBoundary==="tool_result"&&$.activeToolUseIds.size===0&&($.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.currentAbortController?.abort()));let V=j7e(j);if(V&&ne.has(V))return;V&&ne.add(V);let Y=z7e(j);Y&&r.emit("session.execution",{sessionKey:N,event:Y})}})}finally{$.currentAbortController===z&&($.currentAbortController=null),$.isStreaming=!1,$.activeToolUseIds.clear(),$.pendingPreempt=!1,$.pendingPreemptBoundary=null}Ct("[session-manager] drain result",{sessionKey:N,actorRunId:$.actorRunId,processed:B.processed,skipped:B.skipped,lockAcquired:B.lockAcquired,outboxRecords:B.outboxRecords?.length??(B.lastOutboxRecord?1:0),durationMs:Date.now()-Z});let I=(await Ir(t))?.sessions[N];if(I?.session_id&&I.session_id!=="unknown"){let D=!$.sdkSessionId,O=$.sdkSessionId!==I.session_id;$.sdkSessionId=I.session_id,(D||O)&&ot("[session-manager] sdk session bound",{sessionKey:N,actorRunId:$.actorRunId,sdkSessionId:$.sdkSessionId,isNewSession:D})}if(B.lastReplyText&&(W=B.lastReplyText),B.outboxRecords&&B.outboxRecords.length>0){Ct("[session-manager] emitting outbox records",{sessionKey:N,actorRunId:$.actorRunId,count:B.outboxRecords.length});for(let D of B.outboxRecords)r.emit("session.output",{sessionKey:D.session_key,record:D})}else B.lastOutboxRecord&&(Ct("[session-manager] emitting single outbox record",{sessionKey:N,actorRunId:$.actorRunId,recordId:B.lastOutboxRecord.id}),r.emit("session.output",{sessionKey:N,record:B.lastOutboxRecord}));if(B.processed===0&&B.skipped===0){if($.origin==="job"||$.origin==="system"){Ct("[session-manager] job/system session drain complete, exiting",{sessionKey:N,actorRunId:$.actorRunId,origin:$.origin,jobId:$.jobId});break}if($.pendingWake){$.pendingWake=!1,Ct("[session-manager] pending wake after empty drain, re-draining",{sessionKey:N,actorRunId:$.actorRunId});continue}if($.status="idle",await sn(t,N,{status:"idle",idle_since:new Date().toISOString()}),await _i(t,N,{status:"idle",sdk_session_id:$.sdkSessionId}),$.pendingWake){$.pendingWake=!1,Ct("[session-manager] pending wake during idle transition, re-draining",{sessionKey:N,actorRunId:$.actorRunId});continue}Ct("[session-manager] idle",{sessionKey:N,actorRunId:$.actorRunId,attachedChannels:$.attachedChannels.size});let D=!1;for(;$.status==="idle";){if($.pendingWake){$.pendingWake=!1,D=!0;break}if(await S($,i)||$.status!=="idle"){D=!0;break}if($.attachedChannels.size>0){Ct("[session-manager] idle timeout but has attachments, continuing wait",{sessionKey:N,actorRunId:$.actorRunId,attachedChannels:$.attachedChannels.size});continue}break}if(!D&&$.status==="idle"){Ct("[session-manager] idle timeout, no attachments, exiting",{sessionKey:N,actorRunId:$.actorRunId});break}}}}catch(H){qt(`[session-manager] error in drain loop for ${N}:`,H),await sn(t,N,{status:"error"}),A=H}finally{$.currentAbortController=null,$.isStreaming=!1,$.activeToolUseIds.clear(),$.pendingPreempt=!1,$.pendingPreemptBoundary=null,$.heartbeatInterval&&(clearInterval($.heartbeatInterval),$.heartbeatInterval=null),$.status="ended";let H=c(N,$.origin);H.activeCount--,await _i(t,N,{status:"ended",sdk_session_id:$.sdkSessionId}),$.origin==="job"&&$.jobId&&await x($,A,W),ot("[session-manager] actor end",{sessionKey:N,actorRunId:$.actorRunId,sdkSessionId:$.sdkSessionId,pool:H.name,activeCount:H.activeCount,origin:$.origin,jobId:$.jobId,attachedChannels:$.attachedChannels.size,queuedSessions:H.wakeQueue.length});try{await jS(t,qs(N))}catch{}if(H.wakeQueue.length>0&&f){let te=H.wakeQueue.shift();Ct("[session-manager] dequeue queued wake",{sessionKey:te,pool:H.name,queuedSessions:H.wakeQueue.length});let ne=d.get(te);if(ne?.origin==="job"&&ne.jobId){let Z=ne.jobId;g(te,{origin:"job",jobId:Z,preStart:()=>k(Z,te)})}else g(te)}}}function S($,N){return new Promise(A=>{let W=null,H=()=>{W&&(clearTimeout(W),W=null),$.wakeResolver=null};$.wakeResolver=()=>{H(),A(!0)},W=setTimeout(()=>{H(),A(!1)},N)})}let w=new cs(t);async function k($,N){try{await w.init();let A=await w.getJob($);if(!A){kt("[session-manager] cannot project routes: job not found",{jobId:$,sessionKey:N});return}let W=To(A.frontmatter.notify),H=[];for(let te=0;te<W.length;te++){let ne=_f(W[te]);ne?H.push({id:`notify-${te}`,target:ne,mode:"enqueue_inbox",when:["job.complete","job.fail"]}):kt("[session-manager] invalid notify target in job, skipping",{jobId:$,notify:W[te]})}await JX(t,{session_key:N,display_name:$,kind:"job",owner_session:A.frontmatter.owner_session,routes:H})}catch(A){qt("[session-manager] failed to project job routes",{jobId:$,sessionKey:N,err:A})}}async function x($,N,A){let W=$.jobId,{sessionKey:H}=$;try{if(await w.init(),N){let te=N instanceof Error?N.message:String(N);await w.updateState(W,{last_result:"failure",last_error:te});let ne=Qt({type:"job.fail",source:{kind:"job",name:W},session_key:H,payload:{job_id:W,error:te}});await er(t,ne),r.emit("job.failed",{jobId:W,sessionKey:H,error:te}),ot("[session-manager] job failed",{jobId:W,sessionKey:H,error:te})}else{let te=await w.getJob(W),ne=(te?.state.run_count??0)+1;await w.updateState(W,{last_result:"success",last_run_at:new Date().toISOString(),run_count:ne,last_error:void 0});let Z=Qt({type:"job.complete",source:{kind:"job",name:W},session_key:H,payload:{job_id:W,result_summary:A?.slice(0,200)}});await er(t,Z);let z=A?.slice(0,200);r.emit("job.completed",{jobId:W,sessionKey:H,resultSummary:z});let B=te?.frontmatter.cron??"";if(B==="once"||B.startsWith("@in "))try{await w.archiveJob(W),await lg(t,H),ot("[session-manager] auto-archived one-shot job",{jobId:W,cron:B})}catch(q){qt("[session-manager] failed to auto-archive one-shot job",q)}ot("[session-manager] job completed",{jobId:W,sessionKey:H})}}catch(te){qt("[session-manager] error finalizing job session",te)}}function R($,N){if(!f)return;let A=d.get(N);if(A&&A.status!=="ended"){Ct("[session-manager] skip duplicate job spawn",{jobId:$,sessionKey:N,actorStatus:A.status});return}if(l.activeCount>=l.maxConcurrent){l.wakeQueue.includes(N)||l.wakeQueue.push(N),A?(A.origin="job",A.jobId=$):d.set(N,{sessionKey:N,actorRunId:0,sdkSessionId:void 0,status:"idle",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:new Set,origin:"job",jobId:$});return}g(N,{origin:"job",jobId:$,preStart:()=>k($,N)}),(async()=>{try{let W=Qt({type:"job.spawn",source:{kind:"job",name:$},session_key:N,payload:{job_id:$}});await er(t,W),r.emit("job.spawned",{jobId:$,sessionKey:N})}catch(W){qt("[session-manager] error recording job spawn",W)}})()}async function E($,N){let W=(p.get($)??Promise.resolve()).catch(()=>{}).then(async()=>{if($.startsWith("job:")||$.startsWith("meta:")||$.startsWith("system:")||$.startsWith("cadence:"))return;let H=M7e($),te=new Date().toISOString(),ne=Qt({type:"channel.attached",source:{kind:H,name:"session-manager"},session_key:$,payload:{session_key:$,channel_kind:H,channel_id:N,attached_at:te}});await er(t,ne)}).finally(()=>{p.get($)===W&&p.delete($)});p.set($,W),await W}function P(){for(let $ of d.values())$.status="ended",$.currentAbortController&&!$.currentAbortController.signal.aborted&&$.currentAbortController.abort(),$.currentAbortController=null,$.wakeResolver&&($.wakeResolver(),$.wakeResolver=null)}async function C(){if(p.size===0)return;let $=Array.from(p.values()),N=new Promise(A=>setTimeout(A,3e4));await Promise.race([Promise.allSettled($).then(()=>{}),N])}return{async start(){if(!f){f=!0,r.on("session.wake",v),r.on("shutdown",y);try{let $=await qN(t);for(let N of $){if(!F7e(N.cwd)){kt("[session-manager] skip hydrating session with unavailable workspace",{sessionKey:N.session_key,cwd:N.cwd});continue}let A=c(N.session_key);A.activeCount<A.maxConcurrent?g(N.session_key):A.wakeQueue.push(N.session_key)}}catch($){qt("[session-manager] error hydrating sessions:",$)}ot("[session-manager] started",{channelActive:u.activeCount,channelQueued:u.wakeQueue.length,jobActive:l.activeCount,jobQueued:l.wakeQueue.length})}},async stop(){if(!f)return;f=!1,r.off("session.wake",v),r.off("shutdown",y),P();let $=Array.from(d.values()).map(N=>N.drainPromise).filter(N=>N!==null);if($.length>0){let N=new Promise(A=>setTimeout(A,3e4));await Promise.race([Promise.all($),N])}await C(),d.clear(),u.wakeQueue.length=0,u.activeCount=0,l.wakeQueue.length=0,l.activeCount=0,ot("[session-manager] stopped")},wakeSession:b,getActor($){return d.get($)},activeCount(){return u.activeCount+l.activeCount},activeChannelCount(){return u.activeCount},activeJobCount(){return l.activeCount},isRunning(){return f},attachChannel($,N){let A=d.get($);A||(A={sessionKey:$,actorRunId:0,sdkSessionId:void 0,status:"idle",currentAbortController:null,drainPromise:null,heartbeatInterval:null,wakeResolver:null,pendingWake:!1,isStreaming:!1,activeToolUseIds:new Set,pendingPreempt:!1,pendingPreemptBoundary:null,attachedChannels:new Set,origin:"channel"},d.set($,A)),A.attachedChannels.add(N),Ct("[session-manager] channel attached",{sessionKey:$,channelId:N,totalAttachments:A.attachedChannels.size}),E($,N).catch(W=>{kt("[session-manager] failed to emit channel.attached event",{sessionKey:$,channelId:N,error:String(W)})})},detachChannel($,N){let A=d.get($);A&&(A.attachedChannels.delete(N),Ct("[session-manager] channel detached",{sessionKey:$,channelId:N,remainingAttachments:A.attachedChannels.size}),A.attachedChannels.size===0&&A.status==="idle"&&A.wakeResolver&&(A.wakeResolver(),A.wakeResolver=null))},hasAttachedChannels($){let N=d.get($);return N?N.attachedChannels.size>0:!1},spawnJobSession($,N){R($,N)},async interruptSession($){if(!f)return{interrupted:!1,reason:"not_running"};let N=d.get($);return N?!N.currentAbortController||N.currentAbortController.signal.aborted?{interrupted:!1,reason:"idle"}:(_(N,"immediate")==="immediate"&&ot("[session-manager] interrupt requested",{sessionKey:$,actorRunId:N.actorRunId}),{interrupted:!0,reason:"interrupted"}):{interrupted:!1,reason:"not_found"}},async clearSdkSession($){if(!f)return{cleared:!1,reason:"not_running"};let N=d.get($),A=N?.sdkSessionId;return N?.currentAbortController&&!N.currentAbortController.signal.aborted&&_(N,"immediate"),N&&(N.sdkSessionId=void 0),await sn(t,$,{session_id:"unknown"}),await rc(t,$,"sdk_session_id"),ot("[session-manager] SDK session cleared",{sessionKey:$,actorRunId:N?.actorRunId,previousSessionId:A}),{cleared:!0,previousSessionId:A}}}}var D7e,cle=L(()=>{"use strict";ene();Ii();wf();OD();fu();na();wq();cq();pq();_q();mq();bq();fr();_n();$o();xg();D7e=["EnterPlanMode","ExitPlanMode","AskUserQuestion"]});import{promises as Ea}from"node:fs";import qE from"node:path";async function kq(e){let t;try{t=await Ea.readdir(e.subconsciousDir,{withFileTypes:!0})}catch{return[]}let r=[];for(let n of t){if(!n.isDirectory()||Z7e.has(n.name))continue;let i=qE.join(e.subconsciousDir,n.name),s=qE.join(i,"CLAUDE.md");try{await Ea.access(s)}catch{continue}let o=await V7e(n.name,i,s);o&&r.push(o)}return r.sort((n,i)=>n.name.localeCompare(i.name))}async function V7e(e,t,r){try{let n=await Ea.readFile(r,"utf8"),i=(0,dle.default)(n),s=i.data?.schedule??{},o={enabled:s.enabled??Sq.enabled,cooldown_ticks:s.cooldown_ticks??Sq.cooldown_ticks,max_duration_ms:s.max_duration_ms??Sq.max_duration_ms};return{name:e,dir:t,claudeMdPath:r,schedule:o,promptContent:i.content.trim()}}catch{return null}}async function xq(e){let t;try{t=await Ea.readFile(e.subconsciousPlaylistPath,"utf8")}catch{return{items:[],allDone:!0}}let r=H7e(t),n=r.length===0||r.every(i=>i.done);return{items:r,allDone:n}}function H7e(e){let t=e.split(`
657
657
  `),r=t.findIndex(i=>i.trim()==="## Current Round");if(r===-1)return[];let n=[];for(let i=r+1;i<t.length;i++){let s=t[i].trim();if(s.startsWith("## "))break;s.startsWith("- [x] ")?n.push({name:s.slice(6).trim(),done:!0}):s.startsWith("- [ ] ")&&n.push({name:s.slice(6).trim(),done:!1})}return n}async function FE(e,t,r=new Date){let n;try{n=await Ea.readFile(e.subconsciousPlaylistPath,"utf8")}catch{return}let i=n.split(`
658
658
  `),s=!1;for(let u=0;u<i.length;u++)i[u].trim()===`- [ ] ${t}`&&!s&&(i[u]=i[u].replace("- [ ]","- [x]"),s=!0);if(!s)return;let o=`- ${r.toISOString()} executed=${t}`,a=i.findIndex(u=>u.trim()==="## History");a!==-1?i.splice(a+1,0,o):i.push("","## History",o),await Bt(e.subconsciousPlaylistPath,`${i.join(`
659
659
  `).replace(/\s+$/,"")}
@@ -669,12 +669,12 @@ and offer a fallback (e.g. paste content as text, or ask the user to switch to a
669
669
  `];if(n.push(`Timestamp: ${new Date().toISOString()}`),t&&n.push(`Sessions: ${t.activeCount()} active (channel: ${t.activeChannelCount()}, job: ${t.activeJobCount()})`),r&&r.length>0){n.push(""),n.push("### Inbox Messages");for(let i of r)n.push(`- ${i}`)}return n.push(""),n.push("### Key Paths"),n.push(`- Kernel root: ${e.kernelDir}/`),n.push(`- Shared memory: ${e.memoryDir}/`),n.push(`- Broadcast board: ${e.memoryBroadcastPath}`),n.push(`- Memory index: ${e.memoryIndexPath}`),n.push(`- Memory entities: ${e.memoryEntitiesDir}/`),n.push(`- Memory topics: ${e.memoryTopicsDir}/`),n.push(`- Memory fragments: ${e.memoryFragmentsDir}/`),n.push(`- Registry: ${e.registryDir}/`),n.push(`- Events (Spine): ${e.eventsDir}/`),n.push(`- Jobs: ${e.jobsDir}/`),n.push(`- Cadence inbox: ${e.cadenceInboxDir}/`),n.push(`- Cadence queue: ${e.cadenceQueuePath}`),n.push(`- Subconscious inbox: ${e.subconsciousInboxDir}/`),n.join(`
670
670
  `)}async function eXe(e){let t=W7e.join(e.eventsIndexDir,"by_id.jsonl");try{let r=await $q.stat(t);return`${r.size}:${Math.trunc(r.mtimeMs)}`}catch{return"missing"}}function tXe(e){let{paths:t,bus:r,sessionManager:n}=e,i=e.sdk??Yg(),s=e.sessionKey??"meta:subconscious",o=e.maxQuietTicks??5,a=e.maxPartitionsPerIdleTick??2,u=!1,l=!1,c=null,d=null,p=0,f=0,h=!1,v=new Map,y=async w=>{await sn(t,s,{plane:"system",permission_profile:"system_default",cwd:t.kernelDir,health:w})};async function _(w,k,x){for(let E=0;E<10;E++){let P=await xq(t);if(P.allDone){if(await fle(t)===0)return null;P=await xq(t)}let C=g(P.items,w,x);if(!C)return null;let $=w.find(N=>N.name===C.name);if(!$){await FE(t,C.name),yt("[meta-session] skipping removed partition, will retry next",{name:C.name});continue}return await b($,k,x)}return kt("[meta-session] exceeded max skip attempts, giving up",{MAX_SKIP_ATTEMPTS:10}),null}async function b(w,k,x){let R=`${w.promptContent}
671
671
 
672
- ${k}`,E=LE(t,{sessionKey:s,bus:r,sessionContextKind:"meta"});ot("[meta-session] executing partition",{partition:w.name});let P=[],C=["EnterPlanMode","ExitPlanMode","AskUserQuestion"],$=0,N=0,A=Date.now(),W=i.run({prompt:PD(R),cwd:w.dir,settingSources:["user","project","local"],persistSession:!1,mcpServers:{aladuo:E},additionalDirectories:[t.memoryDir],disallowedTools:C,onStream:j=>{r.emit("session.stream",{sessionKey:s,chunk:j})},onExecutionEvent:j=>{j.type==="tool_use"?$+=1:j.type==="tool_result"&&j.isError&&(N+=1),P.push(Y7e(t,s,w.name,j).catch(V=>{kt("[meta-session] failed to persist execution event",{partition:w.name,eventType:j.type,error:V instanceof Error?V.message:String(V)})}))}}),H=Math.max(1,w.schedule.max_duration_ms),re,ne=new Error(`partition timeout: ${w.name} exceeded ${H}ms`),Z=new Promise((j,V)=>{re=setTimeout(()=>V(ne),H)}),z,B=!1;try{z=await Promise.race([W,Z])}catch(j){throw B=!0,j===ne&&W.catch(V=>{kt("[meta-session] late sdk completion after timeout",{partition:w.name,error:V instanceof Error?V.message:String(V)})}),mf(t,{id:crypto.randomUUID(),session_key:`${s}:${w.name}`,drain_started_at:new Date(A).toISOString(),drain_duration_ms:Date.now()-A,sdk_duration_ms:Date.now()-A,events_processed:1,events_skipped:0,tool_calls:$,tool_errors:N,output_chars:0,cancelled:!0,usage:void 0}).catch(()=>{}),j}finally{re&&clearTimeout(re)}let q=Date.now()-A;if(!B){let j=z.usage;mf(t,{id:crypto.randomUUID(),session_key:`${s}:${w.name}`,sdk_session_id:z.sessionId,drain_started_at:new Date(A).toISOString(),drain_duration_ms:q,sdk_duration_ms:q,events_processed:1,events_skipped:0,tool_calls:$,tool_errors:N,output_chars:z.text?.length??0,cancelled:!1,usage:j}).catch(()=>{})}P.length>0&&await Promise.all(P);let I=J7e(z.text),D=K7e(w.name,I);if(D){let j=Qt({type:"agent.error",source:{kind:"meta",name:`subconscious:${w.name}`},session_key:s,payload:{stage:"partition_output",partition:w.name,error:D,output_preview:I.slice(0,400)}});return await er(t,j),await hu(t,"meta_session",j.id,new Date),await FE(t,w.name),v.set(w.name,x),kt("[meta-session] partition produced invalid output",{partition:w.name,outputPreview:I.slice(0,120)}),w.name}await FE(t,w.name),v.set(w.name,x);let O=Qt({type:"agent.result",source:{kind:"meta",name:`subconscious:${w.name}`},session_key:s,payload:{text:I,tick_type:"subconscious",partition:w.name}});return await er(t,O),await hu(t,"meta_session",O.id,new Date(O.ts)),ot("[meta-session] partition completed",{partition:w.name,eventId:O.id}),w.name}function g(w,k,x){for(let R of w){if(R.done)continue;let E=k.find($=>$.name===R.name);if(!E)return R;let P=Math.max(0,E.schedule.cooldown_ticks),C=v.get(R.name);if(C===void 0||x-C>=P)return R}return null}let m=async()=>{if(u||l){yt("[meta-session] skipping tick",{processing:u,stopRequested:l});return}u=!0,ot("[meta-session] starting tick");try{f+=1;let w="";try{w=await $q.readFile(t.subconsciousPlaylistPath,"utf8")}catch{}let k=[];try{k=(await $q.readdir(t.subconsciousInboxDir)).filter(A=>A.endsWith(".pending")||A.endsWith(".json")).sort()}catch{}let x=await eXe(t),R=`${w}:${k.join(",")}:${x}`,E=X7e(R);if(o>0&&!h){if(d!==null&&E===d&&p<o){p+=1,yt("[meta-session] activity gate: skipping tick (no state change)",{quietStreak:p,maxQuietTicks:o}),u=!1;return}E!==d||ot("[meta-session] activity gate: heartbeat tick",{quietStreak:p}),p=0}let P=await ple(t);await y("ok"),await ko(t,A=>({...A,health:{...A.health,meta_session:"starting"}})),await Jf(t);let C=await kq(t),$=await Q7e(t,n,P.messages),N=await _(C,$,f);if(N&&P.files.length>0&&await hle(t,P.files),o>0&&N&&(d=E),N&&a>1&&(!n||n.activeCount()<=1))for(let W=1;W<a&&await _(C,$,f);W++);await ko(t,A=>({...A,health:{...A.health,meta_session:"ok"}})),ot("[meta-session] tick completed"),h=!1}catch(w){qt("[meta-session] tick error:",w),h=!0,await y("error"),await ko(t,x=>({...x,health:{...x.health,meta_session:"down"}}));let k=Qt({type:"agent.error",source:{kind:"meta",name:"meta-session"},session_key:s,payload:{stage:"tick",error:w instanceof Error?w.message:String(w)}});await er(t,k),await hu(t,"meta_session",k.id,new Date(k.ts))}finally{u=!1}},S=()=>{c=m()};return{start(){l||(r.on("cadence.tick",S),ko(t,w=>({...w,health:{...w.health,meta_session:"starting"}})),mi("info","[meta-session] started, listening for cadence ticks"))},async stop(){if(l=!0,r.off("cadence.tick",S),c)try{await c}catch{}mi("info","[meta-session] stopped")},isProcessing(){return u}}}var yle=L(()=>{"use strict";DS();Ii();na();wq();fr();w0();qS();gf();mle()});var vle=T(_le=>{"use strict";Object.defineProperty(_le,"__esModule",{value:!0})});var Gu=T(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.CronField=void 0;var Eq=class e{#e=!1;#r=!1;#i=!1;#n=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(t,r={rawValue:""}){if(!Array.isArray(t))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(t.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#n=t.sort(e.sorter),this.#i=this.options.wildcard!==void 0?this.options.wildcard:this.#s(),this.#e=this.options.rawValue.includes("L")||t.includes("L"),this.#r=this.options.rawValue.includes("?")||t.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#r}get isWildcard(){return this.#i}get values(){return this.#n}static sorter(t,r){let n=typeof t=="number",i=typeof r=="number";return n&&i?t-r:!n&&!i?t.localeCompare(r):n?-1:1}static findNearestValueInList(t,r,n=!1){if(n){for(let i=t.length-1;i>=0;i--)if(t[i]<r)return t[i];return null}for(let i=0;i<t.length;i++)if(t[i]>r)return t[i];return null}findNearestValue(t,r=!1){return this.constructor.findNearestValueInList(this.values,t,r)}serialize(){return{wildcard:this.#i,values:this.#n}}validate(){let t,r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",n=a=>u=>new RegExp(`^\\d{0,2}${u}$`).test(a),i=a=>(t=a,typeof a=="number"?a>=this.min&&a<=this.max:this.chars.some(n(a)));if(!this.#n.every(i))throw new Error(`${this.constructor.name} Validation error, got value ${t} expected range ${this.min}-${this.max}${r}`);let o=this.#n.find((a,u)=>this.#n.indexOf(a)!==u);if(o)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${o}`)}#s(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(t,r)=>r+this.min).every(t=>this.#n.includes(t))}};UE.CronField=Eq});var ble=T(ZE=>{"use strict";Object.defineProperty(ZE,"__esModule",{value:!0});ZE.CronDayOfMonth=void 0;var rXe=Gu(),nXe=1,iXe=31,sXe=Object.freeze(["L"]),Tq=class extends rXe.CronField{static get min(){return nXe}static get max(){return iXe}static get chars(){return sXe}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};ZE.CronDayOfMonth=Tq});var wle=T(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.CronDayOfWeek=void 0;var oXe=Gu(),aXe=0,uXe=7,lXe=Object.freeze(["L"]),Rq=class extends oXe.CronField{static get min(){return aXe}static get max(){return uXe}static get chars(){return lXe}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};VE.CronDayOfWeek=Rq});var Sle=T(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.CronHour=void 0;var cXe=Gu(),dXe=0,fXe=23,pXe=Object.freeze([]),Pq=class extends cXe.CronField{static get min(){return dXe}static get max(){return fXe}static get chars(){return pXe}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};HE.CronHour=Pq});var kle=T(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.CronMinute=void 0;var hXe=Gu(),mXe=0,gXe=59,yXe=Object.freeze([]),Iq=class extends hXe.CronField{static get min(){return mXe}static get max(){return gXe}static get chars(){return yXe}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};BE.CronMinute=Iq});var Qce=T(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var Ra=class extends Error{},qq=class extends Ra{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}},Fq=class extends Ra{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}},Uq=class extends Ra{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}},Xu=class extends Ra{},eT=class extends Ra{constructor(t){super(`Invalid unit ${t}`)}},ln=class extends Ra{},Ao=class extends Ra{constructor(){super("Zone is an abstract class")}},_e="numeric",eo="short",Ui="long",tT={year:_e,month:_e,day:_e},ece={year:_e,month:eo,day:_e},_Xe={year:_e,month:eo,day:_e,weekday:eo},tce={year:_e,month:Ui,day:_e},rce={year:_e,month:Ui,day:_e,weekday:Ui},nce={hour:_e,minute:_e},ice={hour:_e,minute:_e,second:_e},sce={hour:_e,minute:_e,second:_e,timeZoneName:eo},oce={hour:_e,minute:_e,second:_e,timeZoneName:Ui},ace={hour:_e,minute:_e,hourCycle:"h23"},uce={hour:_e,minute:_e,second:_e,hourCycle:"h23"},lce={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:eo},cce={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:Ui},dce={year:_e,month:_e,day:_e,hour:_e,minute:_e},fce={year:_e,month:_e,day:_e,hour:_e,minute:_e,second:_e},pce={year:_e,month:eo,day:_e,hour:_e,minute:_e},hce={year:_e,month:eo,day:_e,hour:_e,minute:_e,second:_e},vXe={year:_e,month:eo,day:_e,weekday:eo,hour:_e,minute:_e},mce={year:_e,month:Ui,day:_e,hour:_e,minute:_e,timeZoneName:eo},gce={year:_e,month:Ui,day:_e,hour:_e,minute:_e,second:_e,timeZoneName:eo},yce={year:_e,month:Ui,day:_e,weekday:Ui,hour:_e,minute:_e,timeZoneName:Ui},_ce={year:_e,month:Ui,day:_e,weekday:Ui,hour:_e,minute:_e,second:_e,timeZoneName:Ui},el=class{get type(){throw new Ao}get name(){throw new Ao}get ianaName(){return this.name}get isUniversal(){throw new Ao}offsetName(t,r){throw new Ao}formatOffset(t,r){throw new Ao}offset(t){throw new Ao}equals(t){throw new Ao}get isValid(){throw new Ao}},Oq=null,z_=class e extends el{static get instance(){return Oq===null&&(Oq=new e),Oq}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Pce(t,r,n)}formatOffset(t,r){return j_(this.offset(t),r)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}},Zq=new Map;function bXe(e){let t=Zq.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Zq.set(e,t)),t}var wXe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function SXe(e,t){let r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,s,o,a,u,l,c]=n;return[o,i,s,a,u,l,c]}function kXe(e,t){let r=e.formatToParts(t),n=[];for(let i=0;i<r.length;i++){let{type:s,value:o}=r[i],a=wXe[s];s==="era"?n[a]=o:Ge(a)||(n[a]=parseInt(o,10))}return n}var Cq=new Map,Pa=class e extends el{static create(t){let r=Cq.get(t);return r===void 0&&Cq.set(t,r=new e(t)),r}static resetCache(){Cq.clear(),Zq.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Pce(t,r,n,this.name)}formatOffset(t,r){return j_(this.offset(t),r)}offset(t){if(!this.valid)return NaN;let r=new Date(t);if(isNaN(r))return NaN;let n=bXe(this.name),[i,s,o,a,u,l,c]=n.formatToParts?kXe(n,r):SXe(n,r);a==="BC"&&(i=-Math.abs(i)+1);let p=uT({year:i,month:s,day:o,hour:u===24?0:u,minute:l,second:c,millisecond:0}),f=+r,h=f%1e3;return f-=h>=0?h:1e3+h,(p-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},xle={};function xXe(e,t={}){let r=JSON.stringify([e,t]),n=xle[r];return n||(n=new Intl.ListFormat(e,t),xle[r]=n),n}var Vq=new Map;function Hq(e,t={}){let r=JSON.stringify([e,t]),n=Vq.get(r);return n===void 0&&(n=new Intl.DateTimeFormat(e,t),Vq.set(r,n)),n}var Bq=new Map;function $Xe(e,t={}){let r=JSON.stringify([e,t]),n=Bq.get(r);return n===void 0&&(n=new Intl.NumberFormat(e,t),Bq.set(r,n)),n}var Wq=new Map;function EXe(e,t={}){let{base:r,...n}=t,i=JSON.stringify([e,n]),s=Wq.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(e,t),Wq.set(i,s)),s}var N_=null;function TXe(){return N_||(N_=new Intl.DateTimeFormat().resolvedOptions().locale,N_)}var Jq=new Map;function vce(e){let t=Jq.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Jq.set(e,t)),t}var Gq=new Map;function RXe(e){let t=Gq.get(e);if(!t){let r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...bce,...t}),Gq.set(e,t)}return t}function PXe(e){let t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));let r=e.indexOf("-u-");if(r===-1)return[e];{let n,i;try{n=Hq(e).resolvedOptions(),i=e}catch{let u=e.substring(0,r);n=Hq(u).resolvedOptions(),i=u}let{numberingSystem:s,calendar:o}=n;return[i,s,o]}}function IXe(e,t,r){return(r||t)&&(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`)),e}function OXe(e){let t=[];for(let r=1;r<=12;r++){let n=vr.utc(2009,r,1);t.push(e(n))}return t}function CXe(e){let t=[];for(let r=1;r<=7;r++){let n=vr.utc(2016,11,13+r);t.push(e(n))}return t}function WE(e,t,r,n){let i=e.listingMode();return i==="error"?null:i==="en"?r(t):n(t)}function NXe(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||vce(e.locale).numberingSystem==="latn"}var Kq=class{constructor(t,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:s,...o}=n;if(!r||Object.keys(o).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=$Xe(t,a)}}format(t){if(this.inf){let r=this.floor?Math.floor(t):t;return this.inf.format(r)}else{let r=this.floor?Math.floor(t):aF(t,3);return Gr(r,this.padTo)}}},Yq=class{constructor(t,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=t;else if(t.zone.type==="fixed"){let o=-1*(t.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;t.offset!==0&&Pa.create(a).valid?(i=a,this.dt=t):(i="UTC",this.dt=t.offset===0?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else t.zone.type==="system"?this.dt=t:t.zone.type==="iana"?(this.dt=t,i=t.zone.name):(i="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=Hq(r,s)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):t}resolvedOptions(){return this.dtf.resolvedOptions()}},Xq=class{constructor(t,r,n){this.opts={style:"long",...n},!r&&Tce()&&(this.rtf=EXe(t,n))}format(t,r){return this.rtf?this.rtf.format(t,r):eQe(r,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,r){return this.rtf?this.rtf.formatToParts(t,r):[]}},bce={firstDay:1,minimalDays:4,weekend:[6,7]},rr=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,r,n,i,s=!1){let o=t||mr.defaultLocale,a=o||(s?"en-US":TXe()),u=r||mr.defaultNumberingSystem,l=n||mr.defaultOutputCalendar,c=eF(i)||mr.defaultWeekSettings;return new e(a,u,l,c,o)}static resetCache(){N_=null,Vq.clear(),Bq.clear(),Wq.clear(),Jq.clear(),Gq.clear()}static fromObject({locale:t,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return e.create(t,r,n,i)}constructor(t,r,n,i,s){let[o,a,u]=PXe(t);this.locale=o,this.numberingSystem=r||a||null,this.outputCalendar=n||u||null,this.weekSettings=i,this.intl=IXe(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=NXe(this)),this.fastNumbersCached}listingMode(){let t=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&r?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,eF(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,r=!1){return WE(this,t,Cce,()=>{let n=this.intl==="ja"||this.intl.startsWith("ja-");r&=!n;let i=r?{month:t,day:"numeric"}:{month:t},s=r?"format":"standalone";if(!this.monthsCache[s][t]){let o=n?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][t]=OXe(o)}return this.monthsCache[s][t]})}weekdays(t,r=!1){return WE(this,t,Dce,()=>{let n=r?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},i=r?"format":"standalone";return this.weekdaysCache[i][t]||(this.weekdaysCache[i][t]=CXe(s=>this.extract(s,n,"weekday"))),this.weekdaysCache[i][t]})}meridiems(){return WE(this,void 0,()=>jce,()=>{if(!this.meridiemCache){let t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[vr.utc(2016,11,13,9),vr.utc(2016,11,13,19)].map(r=>this.extract(r,t,"dayperiod"))}return this.meridiemCache})}eras(t){return WE(this,t,zce,()=>{let r={era:t};return this.eraCache[t]||(this.eraCache[t]=[vr.utc(-40,1,1),vr.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[t]})}extract(t,r,n){let i=this.dtFormatter(t,r),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===n);return o?o.value:null}numberFormatter(t={}){return new Kq(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,r={}){return new Yq(t,this.intl,r)}relFormatter(t={}){return new Xq(this.intl,this.isEnglish(),t)}listFormatter(t={}){return xXe(this.intl,t)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||vce(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Rce()?RXe(this.locale):bce}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Nq=null,Zi=class e extends el{static get utcInstance(){return Nq===null&&(Nq=new e(0)),Nq}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let r=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new e(lT(r[1],r[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${j_(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${j_(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,r){return j_(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}},rT=class extends el{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Yu(e,t){if(Ge(e)||e===null)return t;if(e instanceof el)return e;if(LXe(e)){let r=e.toLowerCase();return r==="default"?t:r==="local"||r==="system"?z_.instance:r==="utc"||r==="gmt"?Zi.utcInstance:Zi.parseSpecifier(r)||Pa.create(e)}else return Qu(e)?Zi.instance(e):typeof e=="object"&&"offset"in e&&typeof e.offset=="function"?e:new rT(e)}var nF={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},$le={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},AXe=nF.hanidec.replace(/[\[|\]]/g,"").split("");function DXe(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(e[r].search(nF.hanidec)!==-1)t+=AXe.indexOf(e[r]);else for(let i in $le){let[s,o]=$le[i];n>=s&&n<=o&&(t+=n-s)}}return parseInt(t,10)}else return t}var Qq=new Map;function jXe(){Qq.clear()}function Xs({numberingSystem:e},t=""){let r=e||"latn",n=Qq.get(r);n===void 0&&(n=new Map,Qq.set(r,n));let i=n.get(t);return i===void 0&&(i=new RegExp(`${nF[r]}${t}`),n.set(t,i)),i}var Ele=()=>Date.now(),Tle="system",Rle=null,Ple=null,Ile=null,Ole=60,Cle,Nle=null,mr=class{static get now(){return Ele}static set now(t){Ele=t}static set defaultZone(t){Tle=t}static get defaultZone(){return Yu(Tle,z_.instance)}static get defaultLocale(){return Rle}static set defaultLocale(t){Rle=t}static get defaultNumberingSystem(){return Ple}static set defaultNumberingSystem(t){Ple=t}static get defaultOutputCalendar(){return Ile}static set defaultOutputCalendar(t){Ile=t}static get defaultWeekSettings(){return Nle}static set defaultWeekSettings(t){Nle=eF(t)}static get twoDigitCutoffYear(){return Ole}static set twoDigitCutoffYear(t){Ole=t%100}static get throwOnInvalid(){return Cle}static set throwOnInvalid(t){Cle=t}static resetCaches(){rr.resetCache(),Pa.resetCache(),vr.resetCache(),jXe()}},Fi=class{constructor(t,r){this.reason=t,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},wce=[0,31,59,90,120,151,181,212,243,273,304,334],Sce=[0,31,60,91,121,152,182,213,244,274,305,335];function ks(e,t){return new Fi("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function iF(e,t,r){let n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function kce(e,t,r){return r+(L_(e)?Sce:wce)[t-1]}function xce(e,t){let r=L_(e)?Sce:wce,n=r.findIndex(s=>s<t),i=t-r[n];return{month:n+1,day:i}}function sF(e,t){return(e-t+7)%7+1}function nT(e,t=4,r=1){let{year:n,month:i,day:s}=e,o=kce(n,i,s),a=sF(iF(n,i,s),r),u=Math.floor((o-a+14-t)/7),l;return u<1?(l=n-1,u=M_(l,t,r)):u>M_(n,t,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:a,...cT(e)}}function Ale(e,t=4,r=1){let{weekYear:n,weekNumber:i,weekday:s}=e,o=sF(iF(n,1,t),r),a=Kp(n),u=i*7+s-o-7+t,l;u<1?(l=n-1,u+=Kp(l)):u>a?(l=n+1,u-=Kp(n)):l=n;let{month:c,day:d}=xce(l,u);return{year:l,month:c,day:d,...cT(e)}}function Aq(e){let{year:t,month:r,day:n}=e,i=kce(t,r,n);return{year:t,ordinal:i,...cT(e)}}function Dle(e){let{year:t,ordinal:r}=e,{month:n,day:i}=xce(t,r);return{year:t,month:n,day:i,...cT(e)}}function jle(e,t){if(!Ge(e.localWeekday)||!Ge(e.localWeekNumber)||!Ge(e.localWeekYear)){if(!Ge(e.weekday)||!Ge(e.weekNumber)||!Ge(e.weekYear))throw new Xu("Cannot mix locale-based week fields with ISO-based week fields");return Ge(e.localWeekday)||(e.weekday=e.localWeekday),Ge(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),Ge(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function zXe(e,t=4,r=1){let n=aT(e.weekYear),i=xs(e.weekNumber,1,M_(e.weekYear,t,r)),s=xs(e.weekday,1,7);return n?i?s?!1:ks("weekday",e.weekday):ks("week",e.weekNumber):ks("weekYear",e.weekYear)}function MXe(e){let t=aT(e.year),r=xs(e.ordinal,1,Kp(e.year));return t?r?!1:ks("ordinal",e.ordinal):ks("year",e.year)}function $ce(e){let t=aT(e.year),r=xs(e.month,1,12),n=xs(e.day,1,iT(e.year,e.month));return t?r?n?!1:ks("day",e.day):ks("month",e.month):ks("year",e.year)}function Ece(e){let{hour:t,minute:r,second:n,millisecond:i}=e,s=xs(t,0,23)||t===24&&r===0&&n===0&&i===0,o=xs(r,0,59),a=xs(n,0,59),u=xs(i,0,999);return s?o?a?u?!1:ks("millisecond",i):ks("second",n):ks("minute",r):ks("hour",t)}function Ge(e){return typeof e>"u"}function Qu(e){return typeof e=="number"}function aT(e){return typeof e=="number"&&e%1===0}function LXe(e){return typeof e=="string"}function qXe(e){return Object.prototype.toString.call(e)==="[object Date]"}function Tce(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Rce(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function FXe(e){return Array.isArray(e)?e:[e]}function zle(e,t,r){if(e.length!==0)return e.reduce((n,i)=>{let s=[t(i),i];return n&&r(n[0],s[0])===n[0]?n:s},null)[1]}function UXe(e,t){return t.reduce((r,n)=>(r[n]=e[n],r),{})}function Xp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function eF(e){if(e==null)return null;if(typeof e!="object")throw new ln("Week settings must be an object");if(!xs(e.firstDay,1,7)||!xs(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(t=>!xs(t,1,7)))throw new ln("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function xs(e,t,r){return aT(e)&&e>=t&&e<=r}function ZXe(e,t){return e-t*Math.floor(e/t)}function Gr(e,t=2){let r=e<0,n;return r?n="-"+(""+-e).padStart(t,"0"):n=(""+e).padStart(t,"0"),n}function Ku(e){if(!(Ge(e)||e===null||e===""))return parseInt(e,10)}function Cc(e){if(!(Ge(e)||e===null||e===""))return parseFloat(e)}function oF(e){if(!(Ge(e)||e===null||e==="")){let t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function aF(e,t,r="round"){let n=10**t;switch(r){case"expand":return e>0?Math.ceil(e*n)/n:Math.floor(e*n)/n;case"trunc":return Math.trunc(e*n)/n;case"round":return Math.round(e*n)/n;case"floor":return Math.floor(e*n)/n;case"ceil":return Math.ceil(e*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function L_(e){return e%4===0&&(e%100!==0||e%400===0)}function Kp(e){return L_(e)?366:365}function iT(e,t){let r=ZXe(t-1,12)+1,n=e+(t-r)/12;return r===2?L_(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function uT(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Mle(e,t,r){return-sF(iF(e,1,t),r)+t-1}function M_(e,t=4,r=1){let n=Mle(e,t,r),i=Mle(e+1,t,r);return(Kp(e)-n+i)/7}function tF(e){return e>99?e:e>mr.twoDigitCutoffYear?1900+e:2e3+e}function Pce(e,t,r,n=null){let i=new Date(e),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);let o={timeZoneName:t,...s},a=new Intl.DateTimeFormat(r,o).formatToParts(i).find(u=>u.type.toLowerCase()==="timezonename");return a?a.value:null}function lT(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);let n=parseInt(t,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function Ice(e){let t=Number(e);if(typeof e=="boolean"||e===""||!Number.isFinite(t))throw new ln(`Invalid unit value ${e}`);return t}function sT(e,t){let r={};for(let n in e)if(Xp(e,n)){let i=e[n];if(i==null)continue;r[t(n)]=Ice(i)}return r}function j_(e,t){let r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${Gr(r,2)}:${Gr(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${Gr(r,2)}${Gr(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function cT(e){return UXe(e,["hour","minute","second","millisecond"])}var VXe=["January","February","March","April","May","June","July","August","September","October","November","December"],Oce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],HXe=["J","F","M","A","M","J","J","A","S","O","N","D"];function Cce(e){switch(e){case"narrow":return[...HXe];case"short":return[...Oce];case"long":return[...VXe];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var Nce=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ace=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],BXe=["M","T","W","T","F","S","S"];function Dce(e){switch(e){case"narrow":return[...BXe];case"short":return[...Ace];case"long":return[...Nce];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var jce=["AM","PM"],WXe=["Before Christ","Anno Domini"],JXe=["BC","AD"],GXe=["B","A"];function zce(e){switch(e){case"narrow":return[...GXe];case"short":return[...JXe];case"long":return[...WXe];default:return null}}function KXe(e){return jce[e.hour<12?0:1]}function YXe(e,t){return Dce(t)[e.weekday-1]}function XXe(e,t){return Cce(t)[e.month-1]}function QXe(e,t){return zce(t)[e.year<0?0:1]}function eQe(e,t,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(e)===-1;if(r==="auto"&&s){let d=e==="days";switch(t){case 1:return d?"tomorrow":`next ${i[e][0]}`;case-1:return d?"yesterday":`last ${i[e][0]}`;case 0:return d?"today":`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,a=Math.abs(t),u=a===1,l=i[e],c=n?u?l[1]:l[2]||l[1]:u?i[e][0]:e;return o?`${a} ${c} ago`:`in ${a} ${c}`}function Lle(e,t){let r="";for(let n of e)n.literal?r+=n.val:r+=t(n.val);return r}var tQe={D:tT,DD:ece,DDD:tce,DDDD:rce,t:nce,tt:ice,ttt:sce,tttt:oce,T:ace,TT:uce,TTT:lce,TTTT:cce,f:dce,ff:pce,fff:mce,ffff:yce,F:fce,FF:hce,FFF:gce,FFFF:_ce},qi=class e{static create(t,r={}){return new e(t,r)}static parseFormat(t){let r=null,n="",i=!1,s=[];for(let o=0;o<t.length;o++){let a=t.charAt(o);a==="'"?((n.length>0||i)&&s.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(t){return tQe[t]}constructor(t,r){this.opts=r,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...r}).format()}dtFormatter(t,r={}){return this.loc.dtFormatter(t,{...this.opts,...r})}formatDateTime(t,r){return this.dtFormatter(t,r).format()}formatDateTimeParts(t,r){return this.dtFormatter(t,r).formatToParts()}formatInterval(t,r){return this.dtFormatter(t.start,r).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,r){return this.dtFormatter(t,r).resolvedOptions()}num(t,r=0,n=void 0){if(this.opts.forceSimple)return Gr(t,r);let i={...this.opts};return r>0&&(i.padTo=r),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(t)}formatDateTimeFromString(t,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(f,h)=>this.loc.extract(t,f,h),o=f=>t.isOffsetFixed&&t.offset===0&&f.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,f.format):"",a=()=>n?KXe(t):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(f,h)=>n?XXe(t,f):s(h?{month:f}:{month:f,day:"numeric"},"month"),l=(f,h)=>n?YXe(t,f):s(h?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),c=f=>{let h=e.macroTokenToFormatOpts(f);return h?this.formatWithSystemDefault(t,h):f},d=f=>n?QXe(t,f):s({era:f},"era"),p=f=>{switch(f){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(t.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(t.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(t.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(t.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(t.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(f)}};return Lle(e.parseFormat(r),p)}formatDurationFromString(t,r){let n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(c,d)=>p=>{let f=i(p);if(f){let h=d.isNegativeDuration&&f!==d.largestUnit?n:1,v;return this.opts.signMode==="negativeLargestOnly"&&f!==d.largestUnit?v="never":this.opts.signMode==="all"?v="always":v="auto",this.num(c.get(f)*h,p.length,v)}else return p},o=e.parseFormat(r),a=o.reduce((c,{literal:d,val:p})=>d?c:c.concat(p),[]),u=t.shiftTo(...a.map(i).filter(c=>c)),l={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Lle(o,s(u,l))}},Mce=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Qp(...e){let t=e.reduce((r,n)=>r+n.source,"");return RegExp(`^${t}$`)}function eh(...e){return t=>e.reduce(([r,n,i],s)=>{let[o,a,u]=s(t,i);return[{...r,...o},a||n,u]},[{},null,1]).slice(0,2)}function th(e,...t){if(e==null)return[null,null];for(let[r,n]of t){let i=r.exec(e);if(i)return n(i)}return[null,null]}function Lce(...e){return(t,r)=>{let n={},i;for(i=0;i<e.length;i++)n[e[i]]=Ku(t[r+i]);return[n,null,r+i]}}var qce=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,rQe=`(?:${qce.source}?(?:\\[(${Mce.source})\\])?)?`,uF=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Fce=RegExp(`${uF.source}${rQe}`),lF=RegExp(`(?:[Tt]${Fce.source})?`),nQe=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,iQe=/(\d{4})-?W(\d\d)(?:-?(\d))?/,sQe=/(\d{4})-?(\d{3})/,oQe=Lce("weekYear","weekNumber","weekDay"),aQe=Lce("year","ordinal"),uQe=/(\d{4})-(\d\d)-(\d\d)/,Uce=RegExp(`${uF.source} ?(?:${qce.source}|(${Mce.source}))?`),lQe=RegExp(`(?: ${Uce.source})?`);function Yp(e,t,r){let n=e[t];return Ge(n)?r:Ku(n)}function cQe(e,t){return[{year:Yp(e,t),month:Yp(e,t+1,1),day:Yp(e,t+2,1)},null,t+3]}function rh(e,t){return[{hours:Yp(e,t,0),minutes:Yp(e,t+1,0),seconds:Yp(e,t+2,0),milliseconds:oF(e[t+3])},null,t+4]}function q_(e,t){let r=!e[t]&&!e[t+1],n=lT(e[t+1],e[t+2]),i=r?null:Zi.instance(n);return[{},i,t+3]}function F_(e,t){let r=e[t]?Pa.create(e[t]):null;return[{},r,t+1]}var dQe=RegExp(`^T?${uF.source}$`),fQe=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function pQe(e){let[t,r,n,i,s,o,a,u,l]=e,c=t[0]==="-",d=u&&u[0]==="-",p=(f,h=!1)=>f!==void 0&&(h||f&&c)?-f:f;return[{years:p(Cc(r)),months:p(Cc(n)),weeks:p(Cc(i)),days:p(Cc(s)),hours:p(Cc(o)),minutes:p(Cc(a)),seconds:p(Cc(u),u==="-0"),milliseconds:p(oF(l),d)}]}var hQe={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function cF(e,t,r,n,i,s,o){let a={year:t.length===2?tF(Ku(t)):Ku(t),month:Oce.indexOf(r)+1,day:Ku(n),hour:Ku(i),minute:Ku(s)};return o&&(a.second=Ku(o)),e&&(a.weekday=e.length>3?Nce.indexOf(e)+1:Ace.indexOf(e)+1),a}var mQe=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function gQe(e){let[,t,r,n,i,s,o,a,u,l,c,d]=e,p=cF(t,i,n,r,s,o,a),f;return u?f=hQe[u]:l?f=0:f=lT(c,d),[p,new Zi(f)]}function yQe(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var _Qe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,vQe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,bQe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function qle(e){let[,t,r,n,i,s,o,a]=e;return[cF(t,i,n,r,s,o,a),Zi.utcInstance]}function wQe(e){let[,t,r,n,i,s,o,a]=e;return[cF(t,a,r,n,i,s,o),Zi.utcInstance]}var SQe=Qp(nQe,lF),kQe=Qp(iQe,lF),xQe=Qp(sQe,lF),$Qe=Qp(Fce),Zce=eh(cQe,rh,q_,F_),EQe=eh(oQe,rh,q_,F_),TQe=eh(aQe,rh,q_,F_),RQe=eh(rh,q_,F_);function PQe(e){return th(e,[SQe,Zce],[kQe,EQe],[xQe,TQe],[$Qe,RQe])}function IQe(e){return th(yQe(e),[mQe,gQe])}function OQe(e){return th(e,[_Qe,qle],[vQe,qle],[bQe,wQe])}function CQe(e){return th(e,[fQe,pQe])}var NQe=eh(rh);function AQe(e){return th(e,[dQe,NQe])}var DQe=Qp(uQe,lQe),jQe=Qp(Uce),zQe=eh(rh,q_,F_);function MQe(e){return th(e,[DQe,Zce],[jQe,zQe])}var Fle="Invalid Duration",Vce={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},LQe={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Vce},Ss=146097/400,Wp=146097/4800,qQe={years:{quarters:4,months:12,weeks:Ss/7,days:Ss,hours:Ss*24,minutes:Ss*24*60,seconds:Ss*24*60*60,milliseconds:Ss*24*60*60*1e3},quarters:{months:3,weeks:Ss/28,days:Ss/4,hours:Ss*24/4,minutes:Ss*24*60/4,seconds:Ss*24*60*60/4,milliseconds:Ss*24*60*60*1e3/4},months:{weeks:Wp/7,days:Wp,hours:Wp*24,minutes:Wp*24*60,seconds:Wp*24*60*60,milliseconds:Wp*24*60*60*1e3},...Vce},Ac=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],FQe=Ac.slice(0).reverse();function Ta(e,t,r=!1){let n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new en(n)}function Hce(e,t){var r;let n=(r=t.milliseconds)!=null?r:0;for(let i of FQe.slice(1))t[i]&&(n+=t[i]*e[i].milliseconds);return n}function Ule(e,t){let r=Hce(e,t)<0?-1:1;Ac.reduceRight((n,i)=>{if(Ge(t[i]))return n;if(n){let s=t[n]*r,o=e[i][n],a=Math.floor(s/o);t[i]+=a*r,t[n]-=a*o*r}return i},null),Ac.reduce((n,i)=>{if(Ge(t[i]))return n;if(n){let s=t[n]%1;t[n]-=s,t[i]+=s*e[n][i]}return i},null)}function Zle(e){let t={};for(let[r,n]of Object.entries(e))n!==0&&(t[r]=n);return t}var en=class e{constructor(t){let r=t.conversionAccuracy==="longterm"||!1,n=r?qQe:LQe;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||rr.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,r){return e.fromObject({milliseconds:t},r)}static fromObject(t,r={}){if(t==null||typeof t!="object")throw new ln(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new e({values:sT(t,e.normalizeUnit),loc:rr.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(t){if(Qu(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t=="object")return e.fromObject(t);throw new ln(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,r){let[n]=CQe(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,r){let[n]=AQe(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the Duration is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new Uq(n);return new e({invalid:n})}static normalizeUnit(t){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t&&t.toLowerCase()];if(!r)throw new eT(t);return r}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?qi.create(this.loc,n).formatDurationFromString(this,t):Fle}toHuman(t={}){if(!this.isValid)return Fle;let r=t.showZeros!==!1,n=Ac.map(i=>{let s=this.values[i];return Ge(s)||s===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=aF(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},vr.fromMillis(r,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Hce(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t),n={};for(let i of Ac)(Xp(r.values,i)||Xp(this.values,i))&&(n[i]=r.get(i)+this.get(i));return Ta(this,{values:n},!0)}minus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t);return this.plus(r.negate())}mapUnits(t){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=Ice(t(this.values[n],n));return Ta(this,{values:r},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let r={...this.values,...sT(t,e.normalizeUnit)};return Ta(this,{values:r})}reconfigure({locale:t,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let o={loc:this.loc.clone({locale:t,numberingSystem:r}),matrix:i,conversionAccuracy:n};return Ta(this,o)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;let t=this.toObject();return Ule(this.matrix,t),Ta(this,{values:t},!0)}rescale(){if(!this.isValid)return this;let t=Zle(this.normalize().shiftToAll().toObject());return Ta(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(o=>e.normalizeUnit(o));let r={},n={},i=this.toObject(),s;for(let o of Ac)if(t.indexOf(o)>=0){s=o;let a=0;for(let l in n)a+=this.matrix[l][o]*n[l],n[l]=0;Qu(i[o])&&(a+=i[o]);let u=Math.trunc(a);r[o]=u,n[o]=(a*1e3-u*1e3)/1e3}else Qu(i[o])&&(n[o]=i[o]);for(let o in n)n[o]!==0&&(r[s]+=o===s?n[o]:n[o]/this.matrix[s][o]);return Ule(this.matrix,r),Ta(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=this.values[r]===0?0:-this.values[r];return Ta(this,{values:t},!0)}removeZeros(){if(!this.isValid)return this;let t=Zle(this.values);return Ta(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of Ac)if(!r(this.values[n],t.values[n]))return!1;return!0}},Jp="Invalid Interval";function UQe(e,t){return!e||!e.isValid?jc.invalid("missing or invalid start"):!t||!t.isValid?jc.invalid("missing or invalid end"):t<e?jc.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var jc=class e{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the Interval is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new Fq(n);return new e({invalid:n})}static fromDateTimes(t,r){let n=C_(t),i=C_(r),s=UQe(n,i);return s??new e({start:n,end:i})}static after(t,r){let n=en.fromDurationLike(r),i=C_(t);return e.fromDateTimes(i,i.plus(n))}static before(t,r){let n=en.fromDurationLike(r),i=C_(t);return e.fromDateTimes(i.minus(n),i)}static fromISO(t,r){let[n,i]=(t||"").split("/",2);if(n&&i){let s,o;try{s=vr.fromISO(n,r),o=s.isValid}catch{o=!1}let a,u;try{a=vr.fromISO(i,r),u=a.isValid}catch{u=!1}if(o&&u)return e.fromDateTimes(s,a);if(o){let l=en.fromISO(i,r);if(l.isValid)return e.after(s,l)}else if(u){let l=en.fromISO(n,r);if(l.isValid)return e.before(a,l)}}return e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(t,r),i;return r!=null&&r.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(t,r),Math.floor(i.diff(n,t).get(t))+(i.valueOf()!==this.end.valueOf())}hasSame(t){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,t):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return this.isValid?this.s>t:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:r}={}){return this.isValid?e.fromDateTimes(t||this.s,r||this.e):this}splitAt(...t){if(!this.isValid)return[];let r=t.map(C_).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),n=[],{s:i}=this,s=0;for(;i<this.e;){let o=r[s]||this.e,a=+o>+this.e?this.e:o;n.push(e.fromDateTimes(i,a)),i=a,s+=1}return n}splitBy(t){let r=en.fromDurationLike(t);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,s,o=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(u=>u*i));s=+a>+this.e?this.e:a,o.push(e.fromDateTimes(n,s)),n=s,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return this.isValid?+this.e==+t.s:!1}abutsEnd(t){return this.isValid?+t.e==+this.s:!1}engulfs(t){return this.isValid?this.s<=t.s&&this.e>=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;let r=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return r>=n?null:e.fromDateTimes(r,n)}union(t){if(!this.isValid)return this;let r=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return e.fromDateTimes(r,n)}static merge(t){let[r,n]=t.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return n&&r.push(n),r}static xor(t){let r=null,n=0,i=[],s=t.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((u,l)=>u.time-l.time);for(let u of a)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&i.push(e.fromDateTimes(r,u.time)),r=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Jp}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=tT,r={}){return this.isValid?qi.create(this.s.loc.clone(r),t).formatInterval(this):Jp}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:Jp}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Jp}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:Jp}toFormat(t,{separator:r=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${r}${this.e.toFormat(t)}`:Jp}toDuration(t,r){return this.isValid?this.e.diff(this.s,t,r):en.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},Dc=class{static hasDST(t=mr.defaultZone){let r=vr.now().setZone(t).set({month:12});return!t.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(t){return Pa.isValidZone(t)}static normalizeZone(t){return Yu(t,mr.defaultZone)}static getStartOfWeek({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getWeekendDays().slice()}static months(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||rr.create(r,n,s)).months(t)}static monthsFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||rr.create(r,n,s)).months(t,!0)}static weekdays(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||rr.create(r,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||rr.create(r,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return rr.create(t).meridiems()}static eras(t="short",{locale:r=null}={}){return rr.create(r,null,"gregory").eras(t)}static features(){return{relative:Tce(),localeWeek:Rce()}}};function Vle(e,t){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(en.fromMillis(n).as("days"))}function ZQe(e,t,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=Vle(u,l);return(c-c%7)/7}],["days",Vle]],i={},s=e,o,a;for(let[u,l]of n)r.indexOf(u)>=0&&(o=u,i[u]=l(e,t),a=s.plus(i),a>t?(i[u]--,e=s.plus(i),e>t&&(a=e,i[u]--,e=s.plus(i))):e=a);return[e,i,a,o]}function VQe(e,t,r,n){let[i,s,o,a]=ZQe(e,t,r),u=t-i,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(o<t&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+u/(o-i)));let c=en.fromObject(s,n);return l.length>0?en.fromMillis(u,n).shiftTo(...l).plus(c):c}var HQe="missing Intl.DateTimeFormat.formatToParts support";function Mt(e,t=r=>r){return{regex:e,deser:([r])=>t(DXe(r))}}var BQe=" ",Bce=`[ ${BQe}]`,Wce=new RegExp(Bce,"g");function WQe(e){return e.replace(/\./g,"\\.?").replace(Wce,Bce)}function Hle(e){return e.replace(/\./g,"").replace(Wce," ").toLowerCase()}function Qs(e,t){return e===null?null:{regex:RegExp(e.map(WQe).join("|")),deser:([r])=>e.findIndex(n=>Hle(r)===Hle(n))+t}}function Ble(e,t){return{regex:e,deser:([,r,n])=>lT(r,n),groups:t}}function JE(e){return{regex:e,deser:([t])=>t}}function JQe(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function GQe(e,t){let r=Xs(t),n=Xs(t,"{2}"),i=Xs(t,"{3}"),s=Xs(t,"{4}"),o=Xs(t,"{6}"),a=Xs(t,"{1,2}"),u=Xs(t,"{1,3}"),l=Xs(t,"{1,6}"),c=Xs(t,"{1,9}"),d=Xs(t,"{2,4}"),p=Xs(t,"{4,6}"),f=y=>({regex:RegExp(JQe(y.val)),deser:([_])=>_,literal:!0}),v=(y=>{if(e.literal)return f(y);switch(y.val){case"G":return Qs(t.eras("short"),0);case"GG":return Qs(t.eras("long"),0);case"y":return Mt(l);case"yy":return Mt(d,tF);case"yyyy":return Mt(s);case"yyyyy":return Mt(p);case"yyyyyy":return Mt(o);case"M":return Mt(a);case"MM":return Mt(n);case"MMM":return Qs(t.months("short",!0),1);case"MMMM":return Qs(t.months("long",!0),1);case"L":return Mt(a);case"LL":return Mt(n);case"LLL":return Qs(t.months("short",!1),1);case"LLLL":return Qs(t.months("long",!1),1);case"d":return Mt(a);case"dd":return Mt(n);case"o":return Mt(u);case"ooo":return Mt(i);case"HH":return Mt(n);case"H":return Mt(a);case"hh":return Mt(n);case"h":return Mt(a);case"mm":return Mt(n);case"m":return Mt(a);case"q":return Mt(a);case"qq":return Mt(n);case"s":return Mt(a);case"ss":return Mt(n);case"S":return Mt(u);case"SSS":return Mt(i);case"u":return JE(c);case"uu":return JE(a);case"uuu":return Mt(r);case"a":return Qs(t.meridiems(),0);case"kkkk":return Mt(s);case"kk":return Mt(d,tF);case"W":return Mt(a);case"WW":return Mt(n);case"E":case"c":return Mt(r);case"EEE":return Qs(t.weekdays("short",!1),1);case"EEEE":return Qs(t.weekdays("long",!1),1);case"ccc":return Qs(t.weekdays("short",!0),1);case"cccc":return Qs(t.weekdays("long",!0),1);case"Z":case"ZZ":return Ble(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Ble(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return JE(/[a-z_+-/]{1,256}?/i);case" ":return JE(/[^\S\n\r]/);default:return f(y)}})(e)||{invalidReason:HQe};return v.token=e,v}var KQe={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function YQe(e,t,r){let{type:n,value:i}=e;if(n==="literal"){let u=/^\s+$/.test(i);return{literal:!u,val:u?" ":i}}let s=t[n],o=n;n==="hour"&&(t.hour12!=null?o=t.hour12?"hour12":"hour24":t.hourCycle!=null?t.hourCycle==="h11"||t.hourCycle==="h12"?o="hour12":o="hour24":o=r.hour12?"hour12":"hour24");let a=KQe[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function XQe(e){return[`^${e.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,e]}function QQe(e,t,r){let n=e.match(t);if(n){let i={},s=1;for(let o in r)if(Xp(r,o)){let a=r[o],u=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(s,s+u))),s+=u}return[n,i]}else return[n,{}]}function eet(e){let t=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return Ge(e.z)||(r=Pa.create(e.z)),Ge(e.Z)||(r||(r=new Zi(e.Z)),n=e.Z),Ge(e.q)||(e.M=(e.q-1)*3+1),Ge(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),Ge(e.u)||(e.S=oF(e.u)),[Object.keys(e).reduce((s,o)=>{let a=t(o);return a&&(s[a]=e[o]),s},{}),r,n]}var Dq=null;function tet(){return Dq||(Dq=vr.fromMillis(1555555555555)),Dq}function ret(e,t){if(e.literal)return e;let r=qi.macroTokenToFormatOpts(e.val),n=Kce(r,t);return n==null||n.includes(void 0)?e:n}function Jce(e,t){return Array.prototype.concat(...e.map(r=>ret(r,t)))}var oT=class{constructor(t,r){if(this.locale=t,this.format=r,this.tokens=Jce(qi.parseFormat(r),t),this.units=this.tokens.map(n=>GQe(n,t)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,i]=XQe(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(t){if(this.isValid){let[r,n]=QQe(t,this.regex,this.handlers),[i,s,o]=n?eet(n):[null,null,void 0];if(Xp(n,"a")&&Xp(n,"H"))throw new Xu("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:i,zone:s,specificOffset:o}}else return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Gce(e,t,r){return new oT(e,r).explainFromTokens(t)}function net(e,t,r){let{result:n,zone:i,specificOffset:s,invalidReason:o}=Gce(e,t,r);return[n,i,s,o]}function Kce(e,t){if(!e)return null;let n=qi.create(t,e).dtFormatter(tet()),i=n.formatToParts(),s=n.resolvedOptions();return i.map(o=>YQe(o,e,s))}var jq="Invalid DateTime",Wle=864e13;function A_(e){return new Fi("unsupported zone",`the zone "${e.name}" is not supported`)}function zq(e){return e.weekData===null&&(e.weekData=nT(e.c)),e.weekData}function Mq(e){return e.localWeekData===null&&(e.localWeekData=nT(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Nc(e,t){let r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new vr({...r,...t,old:r})}function Yce(e,t,r){let n=e-t*60*1e3,i=r.offset(n);if(t===i)return[n,t];n-=(i-t)*60*1e3;let s=r.offset(n);return i===s?[n,i]:[e-Math.min(i,s)*60*1e3,Math.max(i,s)]}function GE(e,t){e+=t*60*1e3;let r=new Date(e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function YE(e,t,r){return Yce(uT(e),t,r)}function Jle(e,t){let r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,s={...e.c,year:n,month:i,day:Math.min(e.c.day,iT(n,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=en.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),a=uT(s),[u,l]=Yce(a,r,e.zone);return o!==0&&(u+=o,l=e.zone.offset(u)),{ts:u,o:l}}function Gp(e,t,r,n,i,s){let{setZone:o,zone:a}=r;if(e&&Object.keys(e).length!==0||t){let u=t||a,l=vr.fromObject(e,{...r,zone:u,specificOffset:s});return o?l:l.setZone(a)}else return vr.invalid(new Fi("unparsable",`the input "${i}" can't be parsed as ${n}`))}function KE(e,t,r=!0){return e.isValid?qi.create(rr.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Lq(e,t,r){let n=e.c.year>9999||e.c.year<0,i="";if(n&&e.c.year>=0&&(i+="+"),i+=Gr(e.c.year,n?6:4),r==="year")return i;if(t){if(i+="-",i+=Gr(e.c.month),r==="month")return i;i+="-"}else if(i+=Gr(e.c.month),r==="month")return i;return i+=Gr(e.c.day),i}function Gle(e,t,r,n,i,s,o){let a=!r||e.c.millisecond!==0||e.c.second!==0,u="";switch(o){case"day":case"month":case"year":break;default:if(u+=Gr(e.c.hour),o==="hour")break;if(t){if(u+=":",u+=Gr(e.c.minute),o==="minute")break;a&&(u+=":",u+=Gr(e.c.second))}else{if(u+=Gr(e.c.minute),o==="minute")break;a&&(u+=Gr(e.c.second))}if(o==="second")break;a&&(!n||e.c.millisecond!==0)&&(u+=".",u+=Gr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!s?u+="Z":e.o<0?(u+="-",u+=Gr(Math.trunc(-e.o/60)),u+=":",u+=Gr(Math.trunc(-e.o%60))):(u+="+",u+=Gr(Math.trunc(e.o/60)),u+=":",u+=Gr(Math.trunc(e.o%60)))),s&&(u+="["+e.zone.ianaName+"]"),u}var Xce={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},iet={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},set={ordinal:1,hour:0,minute:0,second:0,millisecond:0},XE=["year","month","day","hour","minute","second","millisecond"],oet=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],aet=["year","ordinal","hour","minute","second","millisecond"];function QE(e){let t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new eT(e);return t}function Kle(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return QE(e)}}function uet(e){if(D_===void 0&&(D_=mr.now()),e.type!=="iana")return e.offset(D_);let t=e.name,r=rF.get(t);return r===void 0&&(r=e.offset(D_),rF.set(t,r)),r}function Yle(e,t){let r=Yu(t.zone,mr.defaultZone);if(!r.isValid)return vr.invalid(A_(r));let n=rr.fromObject(t),i,s;if(Ge(e.year))i=mr.now();else{for(let u of XE)Ge(e[u])&&(e[u]=Xce[u]);let o=$ce(e)||Ece(e);if(o)return vr.invalid(o);let a=uet(r);[i,s]=YE(e,a,r)}return new vr({ts:i,zone:r,loc:n,o:s})}function Xle(e,t,r){let n=Ge(r.round)?!0:r.round,i=Ge(r.rounding)?"trunc":r.rounding,s=(a,u)=>(a=aF(a,n||r.calendary?0:2,r.calendary?"round":i),t.loc.clone(r).relFormatter(r).format(a,u)),o=a=>r.calendary?t.hasSame(e,a)?0:t.startOf(a).diff(e.startOf(a),a).get(a):t.diff(e,a).get(a);if(r.unit)return s(o(r.unit),r.unit);for(let a of r.units){let u=o(a);if(Math.abs(u)>=1)return s(u,a)}return s(e>t?-0:0,r.units[r.units.length-1])}function Qle(e){let t={},r;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],r=Array.from(e).slice(0,e.length-1)):r=Array.from(e),[t,r]}var D_,rF=new Map,vr=class e{constructor(t){let r=t.zone||mr.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new Fi("invalid input"):null)||(r.isValid?null:A_(r));this.ts=Ge(t.ts)?mr.now():t.ts;let i=null,s=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(r))[i,s]=[t.old.c,t.old.o];else{let a=Qu(t.o)&&!t.old?t.o:r.offset(this.ts);i=GE(this.ts,a),n=Number.isNaN(i.year)?new Fi("invalid input"):null,i=n?null:i,s=n?null:a}this._zone=r,this.loc=t.loc||rr.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[t,r]=Qle(arguments),[n,i,s,o,a,u,l]=r;return Yle({year:n,month:i,day:s,hour:o,minute:a,second:u,millisecond:l},t)}static utc(){let[t,r]=Qle(arguments),[n,i,s,o,a,u,l]=r;return t.zone=Zi.utcInstance,Yle({year:n,month:i,day:s,hour:o,minute:a,second:u,millisecond:l},t)}static fromJSDate(t,r={}){let n=qXe(t)?t.valueOf():NaN;if(Number.isNaN(n))return e.invalid("invalid input");let i=Yu(r.zone,mr.defaultZone);return i.isValid?new e({ts:n,zone:i,loc:rr.fromObject(r)}):e.invalid(A_(i))}static fromMillis(t,r={}){if(Qu(t))return t<-Wle||t>Wle?e.invalid("Timestamp out of range"):new e({ts:t,zone:Yu(r.zone,mr.defaultZone),loc:rr.fromObject(r)});throw new ln(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,r={}){if(Qu(t))return new e({ts:t*1e3,zone:Yu(r.zone,mr.defaultZone),loc:rr.fromObject(r)});throw new ln("fromSeconds requires a numerical input")}static fromObject(t,r={}){t=t||{};let n=Yu(r.zone,mr.defaultZone);if(!n.isValid)return e.invalid(A_(n));let i=rr.fromObject(r),s=sT(t,Kle),{minDaysInFirstWeek:o,startOfWeek:a}=jle(s,i),u=mr.now(),l=Ge(r.specificOffset)?n.offset(u):r.specificOffset,c=!Ge(s.ordinal),d=!Ge(s.year),p=!Ge(s.month)||!Ge(s.day),f=d||p,h=s.weekYear||s.weekNumber;if((f||c)&&h)throw new Xu("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&c)throw new Xu("Can't mix ordinal dates with month/day");let v=h||s.weekday&&!f,y,_,b=GE(u,l);v?(y=oet,_=iet,b=nT(b,o,a)):c?(y=aet,_=set,b=Aq(b)):(y=XE,_=Xce);let g=!1;for(let E of y){let P=s[E];Ge(P)?g?s[E]=_[E]:s[E]=b[E]:g=!0}let m=v?zXe(s,o,a):c?MXe(s):$ce(s),S=m||Ece(s);if(S)return e.invalid(S);let w=v?Ale(s,o,a):c?Dle(s):s,[k,x]=YE(w,l,n),R=new e({ts:k,zone:n,o:x,loc:i});return s.weekday&&f&&t.weekday!==R.weekday?e.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${R.toISO()}`):R.isValid?R:e.invalid(R.invalid)}static fromISO(t,r={}){let[n,i]=PQe(t);return Gp(n,i,r,"ISO 8601",t)}static fromRFC2822(t,r={}){let[n,i]=IQe(t);return Gp(n,i,r,"RFC 2822",t)}static fromHTTP(t,r={}){let[n,i]=OQe(t);return Gp(n,i,r,"HTTP",r)}static fromFormat(t,r,n={}){if(Ge(t)||Ge(r))throw new ln("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,u,l,c]=net(o,t,r);return c?e.invalid(c):Gp(a,u,n,`format ${r}`,t,l)}static fromString(t,r,n={}){return e.fromFormat(t,r,n)}static fromSQL(t,r={}){let[n,i]=MQe(t);return Gp(n,i,r,"SQL",t)}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the DateTime is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new qq(n);return new e({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,r={}){let n=Kce(t,rr.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(t,r={}){return Jce(qi.parseFormat(t),rr.fromObject(r)).map(i=>i.val).join("")}static resetCache(){D_=void 0,rF.clear()}get(t){return this[t]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?zq(this).weekYear:NaN}get weekNumber(){return this.isValid?zq(this).weekNumber:NaN}get weekday(){return this.isValid?zq(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Mq(this).weekday:NaN}get localWeekNumber(){return this.isValid?Mq(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Mq(this).weekYear:NaN}get ordinal(){return this.isValid?Aq(this.c).ordinal:NaN}get monthShort(){return this.isValid?Dc.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Dc.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Dc.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Dc.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let t=864e5,r=6e4,n=uT(this.c),i=this.zone.offset(n-t),s=this.zone.offset(n+t),o=this.zone.offset(n-i*r),a=this.zone.offset(n-s*r);if(o===a)return[this];let u=n-o*r,l=n-a*r,c=GE(u,o),d=GE(l,a);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Nc(this,{ts:u}),Nc(this,{ts:l})]:[this]}get isInLeapYear(){return L_(this.year)}get daysInMonth(){return iT(this.year,this.month)}get daysInYear(){return this.isValid?Kp(this.year):NaN}get weeksInWeekYear(){return this.isValid?M_(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?M_(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){let{locale:r,numberingSystem:n,calendar:i}=qi.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(t=0,r={}){return this.setZone(Zi.instance(t),r)}toLocal(){return this.setZone(mr.defaultZone)}setZone(t,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(t=Yu(t,mr.defaultZone),t.equals(this.zone))return this;if(t.isValid){let i=this.ts;if(r||n){let s=t.offset(this.ts),o=this.toObject();[i]=YE(o,s,t)}return Nc(this,{ts:i,zone:t})}else return e.invalid(A_(t))}reconfigure({locale:t,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:t,numberingSystem:r,outputCalendar:n});return Nc(this,{loc:i})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;let r=sT(t,Kle),{minDaysInFirstWeek:n,startOfWeek:i}=jle(r,this.loc),s=!Ge(r.weekYear)||!Ge(r.weekNumber)||!Ge(r.weekday),o=!Ge(r.ordinal),a=!Ge(r.year),u=!Ge(r.month)||!Ge(r.day),l=a||u,c=r.weekYear||r.weekNumber;if((l||o)&&c)throw new Xu("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&o)throw new Xu("Can't mix ordinal dates with month/day");let d;s?d=Ale({...nT(this.c,n,i),...r},n,i):Ge(r.ordinal)?(d={...this.toObject(),...r},Ge(r.day)&&(d.day=Math.min(iT(d.year,d.month),d.day))):d=Dle({...Aq(this.c),...r});let[p,f]=YE(d,this.o,this.zone);return Nc(this,{ts:p,o:f})}plus(t){if(!this.isValid)return this;let r=en.fromDurationLike(t);return Nc(this,Jle(this,r))}minus(t){if(!this.isValid)return this;let r=en.fromDurationLike(t).negate();return Nc(this,Jle(this,r))}startOf(t,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=en.normalizeUnit(t);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(r){let s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(n.weekNumber=this.weekNumber-1),n.weekday=s}else n.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);n.month=(s-1)*3+1}return this.set(n)}endOf(t,r){return this.isValid?this.plus({[t]:1}).startOf(t,r).minus(1):this}toFormat(t,r={}){return this.isValid?qi.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,t):jq}toLocaleString(t=tT,r={}){return this.isValid?qi.create(this.loc.clone(r),t).formatDateTime(this):jq}toLocaleParts(t={}){return this.isValid?qi.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=QE(o);let a=t==="extended",u=Lq(this,a,o);return XE.indexOf(o)>=3&&(u+="T"),u+=Gle(this,a,r,n,i,s,o),u}toISODate({format:t="extended",precision:r="day"}={}){return this.isValid?Lq(this,t==="extended",QE(r)):null}toISOWeekDate(){return KE(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=QE(a),(i&&XE.indexOf(a)>=3?"T":"")+Gle(this,o==="extended",r,t,n,s,a)):null}toRFC2822(){return KE(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return KE(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Lq(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||t)&&(n&&(i+=" "),r?i+="z":t&&(i+="ZZ")),KE(this,i,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():jq}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};let r={...this.c};return t.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,r="milliseconds",n={}){if(!this.isValid||!t.isValid)return en.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=FXe(r).map(en.normalizeUnit),o=t.valueOf()>this.valueOf(),a=o?this:t,u=o?t:this,l=VQe(a,u,s,i);return o?l.negate():l}diffNow(t="milliseconds",r={}){return this.diff(e.now(),t,r)}until(t){return this.isValid?jc.fromDateTimes(this,t):this}hasSame(t,r,n){if(!this.isValid)return!1;let i=t.valueOf(),s=this.setZone(t.zone,{keepLocalTime:!0});return s.startOf(r,n)<=i&&i<=s.endOf(r,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;let r=t.base||e.fromObject({},{zone:this.zone}),n=t.padding?this<r?-t.padding:t.padding:0,i=["years","months","days","hours","minutes","seconds"],s=t.unit;return Array.isArray(t.unit)&&(i=t.unit,s=void 0),Xle(r,this.plus(n),{...t,numeric:"always",units:i,unit:s})}toRelativeCalendar(t={}){return this.isValid?Xle(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new ln("min requires all arguments be DateTimes");return zle(t,r=>r.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new ln("max requires all arguments be DateTimes");return zle(t,r=>r.valueOf(),Math.max)}static fromFormatExplain(t,r,n={}){let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Gce(o,t,r)}static fromStringExplain(t,r,n={}){return e.fromFormatExplain(t,r,n)}static buildFormatParser(t,r={}){let{locale:n=null,numberingSystem:i=null}=r,s=rr.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new oT(s,t)}static fromFormatParser(t,r,n={}){if(Ge(t)||Ge(r))throw new ln("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(r.locale))throw new ln(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${r.locale}`);let{result:a,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(t);return c?e.invalid(c):Gp(a,u,n,`format ${r.format}`,t,l)}static get DATE_SHORT(){return tT}static get DATE_MED(){return ece}static get DATE_MED_WITH_WEEKDAY(){return _Xe}static get DATE_FULL(){return tce}static get DATE_HUGE(){return rce}static get TIME_SIMPLE(){return nce}static get TIME_WITH_SECONDS(){return ice}static get TIME_WITH_SHORT_OFFSET(){return sce}static get TIME_WITH_LONG_OFFSET(){return oce}static get TIME_24_SIMPLE(){return ace}static get TIME_24_WITH_SECONDS(){return uce}static get TIME_24_WITH_SHORT_OFFSET(){return lce}static get TIME_24_WITH_LONG_OFFSET(){return cce}static get DATETIME_SHORT(){return dce}static get DATETIME_SHORT_WITH_SECONDS(){return fce}static get DATETIME_MED(){return pce}static get DATETIME_MED_WITH_SECONDS(){return hce}static get DATETIME_MED_WITH_WEEKDAY(){return vXe}static get DATETIME_FULL(){return mce}static get DATETIME_FULL_WITH_SECONDS(){return gce}static get DATETIME_HUGE(){return yce}static get DATETIME_HUGE_WITH_SECONDS(){return _ce}};function C_(e){if(vr.isDateTime(e))return e;if(e&&e.valueOf&&Qu(e.valueOf()))return vr.fromJSDate(e);if(e&&typeof e=="object")return vr.fromObject(e);throw new ln(`Unknown datetime argument: ${e}, of type ${typeof e}`)}var cet="3.7.2";Vi.DateTime=vr;Vi.Duration=en;Vi.FixedOffsetZone=Zi;Vi.IANAZone=Pa;Vi.Info=Dc;Vi.Interval=jc;Vi.InvalidZone=rT;Vi.Settings=mr;Vi.SystemZone=z_;Vi.VERSION=cet;Vi.Zone=el});var pT=T(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.CronDate=ri.DAYS_IN_MONTH=ri.DateMathOp=ri.TimeUnit=void 0;var zc=Qce(),Un;(function(e){e.Second="Second",e.Minute="Minute",e.Hour="Hour",e.Day="Day",e.Month="Month",e.Year="Year"})(Un||(ri.TimeUnit=Un={}));var dT;(function(e){e.Add="Add",e.Subtract="Subtract"})(dT||(ri.DateMathOp=dT={}));ri.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var fT=class e{#e;#r=null;#i=null;#n={add:{[Un.Year]:this.addYear.bind(this),[Un.Month]:this.addMonth.bind(this),[Un.Day]:this.addDay.bind(this),[Un.Hour]:this.addHour.bind(this),[Un.Minute]:this.addMinute.bind(this),[Un.Second]:this.addSecond.bind(this)},subtract:{[Un.Year]:this.subtractYear.bind(this),[Un.Month]:this.subtractMonth.bind(this),[Un.Day]:this.subtractDay.bind(this),[Un.Hour]:this.subtractHour.bind(this),[Un.Minute]:this.subtractMinute.bind(this),[Un.Second]:this.subtractSecond.bind(this)}};constructor(t,r){let n={zone:r};if(t?t instanceof e?(this.#e=t.#e,this.#r=t.#r,this.#i=t.#i):t instanceof Date?this.#e=zc.DateTime.fromJSDate(t,n):typeof t=="number"?this.#e=zc.DateTime.fromMillis(t,n):(this.#e=zc.DateTime.fromISO(t,n),this.#e.isValid||(this.#e=zc.DateTime.fromRFC2822(t,n)),this.#e.isValid||(this.#e=zc.DateTime.fromSQL(t,n)),this.#e.isValid||(this.#e=zc.DateTime.fromFormat(t,"EEE, d MMM yyyy HH:mm:ss",n))):this.#e=zc.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${t}`);r&&r!==this.#e.zoneName&&(this.#e=this.#e.setZone(r))}static#s(t){return t%4===0&&t%100!==0||t%400===0}get dstStart(){return this.#r}set dstStart(t){this.#r=t}get dstEnd(){return this.#i}set dstEnd(t){this.#i=t}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(t){this.#n.add[t]()}subtractUnit(t){this.#n.subtract[t]()}invokeDateOperation(t,r){if(t===dT.Add){this.addUnit(r);return}if(t===dT.Subtract){this.subtractUnit(r);return}throw new Error(`Invalid verb: ${t}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let t=this.#e.weekday;return t===7?0:t}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#t().day}getUTCFullYear(){return this.#t().year}getUTCDay(){let t=this.#t().weekday;return t===7?0:t}getUTCMonth(){return this.#t().month-1}getUTCHours(){return this.#t().hour}getUTCMinutes(){return this.#t().minute}getUTCSeconds(){return this.#t().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(t){this.#e=this.#e.set({day:t})}setFullYear(t){this.#e=this.#e.set({year:t})}setDay(t){this.#e=this.#e.set({weekday:t})}setMonth(t){this.#e=this.#e.set({month:t+1})}setHours(t){this.#e=this.#e.set({hour:t})}setMinutes(t){this.#e=this.#e.set({minute:t})}setSeconds(t){this.#e=this.#e.set({second:t})}setMilliseconds(t){this.#e=this.#e.set({millisecond:t})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:t,month:r}=this.#e;if(r===2){let n=e.#s(this.#e.year);return t===ri.DAYS_IN_MONTH[r-1]-(n?0:1)}return t===ri.DAYS_IN_MONTH[r-1]}isLastWeekdayOfMonth(){let{day:t,month:r}=this.#e,n;return r===2?n=ri.DAYS_IN_MONTH[r-1]-(e.#s(this.#e.year)?0:1):n=ri.DAYS_IN_MONTH[r-1],t>n-7}applyDateOperation(t,r,n){if(r===Un.Month||r===Un.Day){this.invokeDateOperation(t,r);return}let i=this.getHours();this.invokeDateOperation(t,r);let s=this.getHours(),o=s-i;o===2?n!==24&&(this.dstStart=s):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&n!==24&&(this.dstEnd=s)}#t(){return this.#e.toUTC()}};ri.CronDate=fT;ri.default=fT});var ede=T(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.CronMonth=void 0;var det=pT(),fet=Gu(),pet=1,het=12,met=Object.freeze([]),dF=class extends fet.CronField{static get min(){return pet}static get max(){return het}static get chars(){return met}static get daysInMonth(){return det.DAYS_IN_MONTH}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};hT.CronMonth=dF});var tde=T(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.CronSecond=void 0;var get=Gu(),yet=0,_et=59,vet=Object.freeze([]),fF=class extends get.CronField{static get min(){return yet}static get max(){return _et}static get chars(){return vet}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};mT.CronSecond=fF});var gT=T(Ei=>{"use strict";var bet=Ei&&Ei.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),tl=Ei&&Ei.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&bet(t,e,r)};Object.defineProperty(Ei,"__esModule",{value:!0});tl(vle(),Ei);tl(ble(),Ei);tl(wle(),Ei);tl(Gu(),Ei);tl(Sle(),Ei);tl(kle(),Ei);tl(ede(),Ei);tl(tde(),Ei)});var hF=T(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.CronFieldCollection=void 0;var $s=gT(),pF=class e{#e;#r;#i;#n;#s;#t;static from(t,r){return new e({second:this.resolveField($s.CronSecond,t.second,r.second),minute:this.resolveField($s.CronMinute,t.minute,r.minute),hour:this.resolveField($s.CronHour,t.hour,r.hour),dayOfMonth:this.resolveField($s.CronDayOfMonth,t.dayOfMonth,r.dayOfMonth),month:this.resolveField($s.CronMonth,t.month,r.month),dayOfWeek:this.resolveField($s.CronDayOfWeek,t.dayOfWeek,r.dayOfWeek)})}static resolveField(t,r,n){return n?n instanceof $s.CronField?n:new t(n):r}constructor({second:t,minute:r,hour:n,dayOfMonth:i,month:s,dayOfWeek:o}){if(!t)throw new Error("Validation error, Field second is missing");if(!r)throw new Error("Validation error, Field minute is missing");if(!n)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!o)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=$s.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=t,this.#r=r,this.#i=n,this.#s=s,this.#t=o,this.#n=i}get second(){return this.#e}get minute(){return this.#r}get hour(){return this.#i}get dayOfMonth(){return this.#n}get month(){return this.#s}get dayOfWeek(){return this.#t}static compactField(t){if(t.length===0)return[];let r=[],n;return t.forEach((i,s,o)=>{if(n===void 0){n={start:i,count:1};return}let a=o[s-1]||n.start,u=o[s+1];if(i==="L"||i==="W"){r.push(n),r.push({start:i,count:1}),n=void 0;return}if(n.step===void 0&&u!==void 0){let l=i-a,c=u-i;if(l<=c){n={...n,count:2,end:i,step:l};return}n.step=1}i-(n.end??0)===n.step?(n.count++,n.end=i):(n.count===1?r.push({start:n.start,count:1}):n.count===2?(r.push({start:n.start,count:1}),r.push({start:n.end??a,count:1})):r.push(n),n={start:i,count:1})}),n&&r.push(n),r}static#u(t,r,n){let i=r.step;return i?i===1&&r.start===t.min&&r.end&&r.end>=n?t.hasQuestionMarkChar?"?":"*":i!==1&&r.start===t.min&&r.end&&r.end>=n-i+1?`*/${i}`:null:null}static#l(t,r){let n=t.step;if(n===1)return`${t.start}-${t.end}`;let i=t.start===0?t.count-1:t.count;if(!n)throw new Error("Unexpected range step");if(!t.end)throw new Error("Unexpected range end");if(n*i>t.end){let s=(a,u)=>{if(typeof t.start!="number")throw new Error("Unexpected range start");return u%n===0?t.start+u:null};if(typeof t.start!="number")throw new Error("Unexpected range start");let o={length:t.end-t.start+1};return Array.from(o,s).filter(a=>a!==null).join(",")}return t.end===r-n+1?`${t.start}/${n}`:`${t.start}-${t.end}/${n}`}stringifyField(t){let r=t.max,n=t.values;if(t instanceof $s.CronDayOfWeek){r=6;let s=this.#t.values;n=s[s.length-1]===7?s.slice(0,-1):s}t instanceof $s.CronDayOfMonth&&(r=this.#s.values.length===1?$s.CronMonth.daysInMonth[this.#s.values[0]-1]:t.max);let i=e.compactField(n);if(i.length===1){let s=e.#u(t,i[0],r);if(s)return s}return i.map(s=>{let o=s.count===1?s.start.toString():e.#l(s,r);return t instanceof $s.CronDayOfWeek&&t.nthDay>0?`${o}#${t.nthDay}`:o}).join(",")}stringify(t=!1){let r=[];return t&&r.push(this.stringifyField(this.#e)),r.push(this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#n),this.stringifyField(this.#s),this.stringifyField(this.#t)),r.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#r.serialize(),hour:this.#i.serialize(),dayOfMonth:this.#n.serialize(),month:this.#s.serialize(),dayOfWeek:this.#t.serialize()}}};yT.CronFieldCollection=pF});var mF=T(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.CronExpression=Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var zr=pT();Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range";Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";var rde=1e4,_T=class e{#e;#r;#i;#n;#s;#t;#u=null;#l=!1;constructor(t,r){this.#e=r,this.#r=r.tz,this.#n=r.startDate?new zr.CronDate(r.startDate,this.#r):null,this.#s=r.endDate?new zr.CronDate(r.endDate,this.#r):null;let n=r.currentDate??r.startDate;if(n){let i=new zr.CronDate(n,this.#r);this.#n&&i.getTime()<this.#n.getTime()?n=this.#n:this.#s&&i.getTime()>this.#s.getTime()&&(n=this.#s)}this.#i=new zr.CronDate(n,this.#r),this.#t=t}get fields(){return this.#t}static fieldsToExpression(t,r){return new e(t,r||{})}static#o(t,r){return r.some(n=>n===t)}#a(t,r){return t[r?t.length-1:0]}#c(t){let r=`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`;if(this.#u===r)return this.#l;let n=new zr.CronDate(t);n.setStartOfDay();let i=new zr.CronDate(t);return i.setEndOfDay(),this.#u=r,this.#l=n.getUTCOffset()!==i.getUTCOffset(),this.#l}#d(t,r,n){let i=this.#t.second.values,s=t.getSeconds(),o=this.#t.second.findNearestValue(s,n);if(o!==null){t.setSeconds(o);return}t.applyDateOperation(r,zr.TimeUnit.Minute,this.#t.hour.values.length),t.setSeconds(this.#a(i,n))}#h(t,r,n){let i=this.#t.minute.values,s=this.#t.second.values,o=t.getMinutes(),a=this.#t.minute.findNearestValue(o,n);if(a!==null){t.setMinutes(a),t.setSeconds(this.#a(s,n));return}t.applyDateOperation(r,zr.TimeUnit.Hour,this.#t.hour.values.length),t.setMinutes(this.#a(i,n)),t.setSeconds(this.#a(s,n))}static#m(t,r){let n=r.isLastWeekdayOfMonth();return t.some(i=>{let s=parseInt(i.toString().charAt(0),10)%7;if(Number.isNaN(s))throw new Error(`Invalid last weekday of the month expression: ${i}`);return r.getDay()===s&&n})}next(){return this.#f()}prev(){return this.#f(!0)}hasNext(){let t=this.#i;try{return this.#f(),!0}catch{return!1}finally{this.#i=t}}hasPrev(){let t=this.#i;try{return this.#f(!0),!0}catch{return!1}finally{this.#i=t}}take(t){let r=[];if(t>=0)for(let n=0;n<t;n++)try{r.push(this.next())}catch{return r}else for(let n=0;n>t;n--)try{r.push(this.prev())}catch{return r}return r}reset(t){this.#i=new zr.CronDate(t||this.#e.currentDate)}stringify(t=!1){return this.#t.stringify(t)}includesDate(t){let{second:r,minute:n,hour:i,month:s}=this.#t,o=new zr.CronDate(t,this.#r);return!(!r.values.includes(o.getSeconds())||!n.values.includes(o.getMinutes())||!i.values.includes(o.getHours())||!s.values.includes(o.getMonth()+1)||!this.#p(o)||this.#t.dayOfWeek.nthDay>0&&Math.ceil(o.getDate()/7)!==this.#t.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#p(t){let r=this.#t.dayOfMonth.isWildcard,n=!r,i=this.#t.dayOfWeek.isWildcard,s=!i,o=e.#o(t.getDate(),this.#t.dayOfMonth.values)||this.#t.dayOfMonth.hasLastChar&&t.isLastDayOfMonth(),a=e.#o(t.getDay(),this.#t.dayOfWeek.values)||this.#t.dayOfWeek.hasLastChar&&e.#m(this.#t.dayOfWeek.values,t);return!!(n&&s&&(o||a)||o&&!s||r&&!i&&a)}#g(t,r,n){let i=this.#t.hour.values,s=i,o=t.getHours(),a=e.#o(o,i),u=t.dstStart===o,l=t.dstEnd===o;if(u)return e.#o(o-1,i)?!0:(t.invokeDateOperation(r,zr.TimeUnit.Hour),!1);if(l&&!n)return t.dstEnd=null,t.applyDateOperation(zr.DateMathOp.Add,zr.TimeUnit.Hour,s.length),!1;if(a)return!0;t.dstStart=null;let c=this.#t.hour.findNearestValue(o,n);if(c===null)return t.applyDateOperation(r,zr.TimeUnit.Day,s.length),!1;if(this.#c(t)){let d=n?o-c:c-o;for(let p=0;p<d;p++)t.applyDateOperation(r,zr.TimeUnit.Hour,s.length)}else t.setHours(c);return t.setMinutes(this.#a(this.#t.minute.values,n)),t.setSeconds(this.#a(this.#t.second.values,n)),!1}#y(t){if(!this.#n&&!this.#s)return;let r=t.getTime();if(this.#n&&r<this.#n.getTime())throw new Error(Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#s&&r>this.#s.getTime())throw new Error(Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#f(t=!1){let r=t?zr.DateMathOp.Subtract:zr.DateMathOp.Add,n=new zr.CronDate(this.#i),i=n.getTime(),s=0;for(;++s<rde;){if(this.#y(n),!this.#p(n)){n.applyDateOperation(r,zr.TimeUnit.Day,this.#t.hour.values.length);continue}if(!(this.#t.dayOfWeek.nthDay<=0||Math.ceil(n.getDate()/7)===this.#t.dayOfWeek.nthDay)){n.applyDateOperation(r,zr.TimeUnit.Day,this.#t.hour.values.length);continue}if(!e.#o(n.getMonth()+1,this.#t.month.values)){n.applyDateOperation(r,zr.TimeUnit.Month,this.#t.hour.values.length);continue}if(this.#g(n,r,t)){if(!e.#o(n.getMinutes(),this.#t.minute.values)){this.#h(n,r,t);continue}if(!e.#o(n.getSeconds(),this.#t.second.values)){this.#d(n,r,t);continue}if(i===n.getTime()){(r==="Add"||n.getMilliseconds()===0)&&n.applyDateOperation(r,zr.TimeUnit.Second,this.#t.hour.values.length);continue}break}}if(s>rde)throw new Error(Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return n.getMilliseconds()!==0&&n.setMilliseconds(0),this.#i=n,n}[Symbol.iterator](){return{next:()=>({value:this.#f(),done:!this.hasNext()})}}};Es.CronExpression=_T;Es.default=_T});var nde=T(gF=>{"use strict";Object.defineProperty(gF,"__esModule",{value:!0});gF.seededRandom=xet;function wet(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return()=>t>>>0}function ket(e){return()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function xet(e){let t=e?wet(e)():Math.floor(Math.random()*1e10);return ket(t)}});var vT=T(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.CronExpressionParser=Ps.DayOfWeek=Ps.Months=Ps.CronUnit=Ps.PredefinedExpressions=void 0;var $et=hF(),Eet=mF(),Tet=nde(),Ts=gT(),yF;(function(e){e["@yearly"]="0 0 0 1 1 *",e["@annually"]="0 0 0 1 1 *",e["@monthly"]="0 0 0 1 * *",e["@weekly"]="0 0 0 * * 0",e["@daily"]="0 0 0 * * *",e["@hourly"]="0 0 * * * *",e["@minutely"]="0 * * * * *",e["@secondly"]="* * * * * *",e["@weekdays"]="0 0 0 * * 1-5",e["@weekends"]="0 0 0 * * 0,6"})(yF||(Ps.PredefinedExpressions=yF={}));var Rs;(function(e){e.Second="Second",e.Minute="Minute",e.Hour="Hour",e.DayOfMonth="DayOfMonth",e.Month="Month",e.DayOfWeek="DayOfWeek"})(Rs||(Ps.CronUnit=Rs={}));var _F;(function(e){e[e.jan=1]="jan",e[e.feb=2]="feb",e[e.mar=3]="mar",e[e.apr=4]="apr",e[e.may=5]="may",e[e.jun=6]="jun",e[e.jul=7]="jul",e[e.aug=8]="aug",e[e.sep=9]="sep",e[e.oct=10]="oct",e[e.nov=11]="nov",e[e.dec=12]="dec"})(_F||(Ps.Months=_F={}));var vF;(function(e){e[e.sun=0]="sun",e[e.mon=1]="mon",e[e.tue=2]="tue",e[e.wed=3]="wed",e[e.thu=4]="thu",e[e.fri=5]="fri",e[e.sat=6]="sat"})(vF||(Ps.DayOfWeek=vF={}));var bF=class e{static parse(t,r={}){let{strict:n=!1,hashSeed:i}=r,s=(0,Tet.seededRandom)(i);t=yF[t]||t;let o=e.#e(t,n);if(!(o.dayOfMonth==="*"||o.dayOfWeek==="*"||!n))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");let a=e.#r(Rs.Second,o.second,Ts.CronSecond.constraints,s),u=e.#r(Rs.Minute,o.minute,Ts.CronMinute.constraints,s),l=e.#r(Rs.Hour,o.hour,Ts.CronHour.constraints,s),c=e.#r(Rs.Month,o.month,Ts.CronMonth.constraints,s),d=e.#r(Rs.DayOfMonth,o.dayOfMonth,Ts.CronDayOfMonth.constraints,s),{dayOfWeek:p,nthDayOfWeek:f}=e.#c(o.dayOfWeek),h=e.#r(Rs.DayOfWeek,p,Ts.CronDayOfWeek.constraints,s),v=new $et.CronFieldCollection({second:new Ts.CronSecond(a,{rawValue:o.second}),minute:new Ts.CronMinute(u,{rawValue:o.minute}),hour:new Ts.CronHour(l,{rawValue:o.hour}),dayOfMonth:new Ts.CronDayOfMonth(d,{rawValue:o.dayOfMonth}),month:new Ts.CronMonth(c,{rawValue:o.month}),dayOfWeek:new Ts.CronDayOfWeek(h,{rawValue:o.dayOfWeek,nthDayOfWeek:f})});return new Eet.CronExpression(v,{...r,expression:t})}static#e(t,r){if(r&&!t.length)throw new Error("Invalid cron expression");t=t||"0 * * * * *";let n=t.trim().split(/\s+/);if(r&&n.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(n.length>6)throw new Error("Invalid cron expression, too many fields");let i=["*","*","*","*","*","0"];n.length<i.length&&n.unshift(...i.slice(n.length));let[s,o,a,u,l,c]=n;return{second:s,minute:o,hour:a,dayOfMonth:u,month:l,dayOfWeek:c}}static#r(t,r,n,i){if((t===Rs.Month||t===Rs.DayOfWeek)&&(r=r.replace(/[a-z]{3}/gi,s=>{s=s.toLowerCase();let o=_F[s]||vF[s];if(o===void 0)throw new Error(`Validation error, cannot resolve alias "${s}"`);return o.toString()})),!n.validChars.test(r))throw new Error(`Invalid characters, got value: ${r}`);return r=this.#i(r,n),r=this.#n(r,n,i),this.#s(t,r,n)}static#i(t,r){return t.replace(/[*?]/g,r.min+"-"+r.max)}static#n(t,r,n){let i=n();return t.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(s,o,a,u)=>{if(o&&a&&u){let l=parseInt(o,10),c=parseInt(a,10),d=parseInt(u,10);if(l>c)throw new Error(`Invalid range: ${l}-${c}, min > max`);if(d<=0)throw new Error(`Invalid step: ${d}, must be positive`);let p=Math.max(l,r.min),f=Math.floor(i*d),h=[];for(let v=Math.floor(p/d)*d+f;v<=c;v+=d)v>=p&&h.push(v);return h.join(",")}else if(o&&a){let l=parseInt(o,10),c=parseInt(a,10);if(l>c)throw new Error(`Invalid range: ${l}-${c}, min > max`);return String(Math.floor(i*(c-l+1))+l)}else if(u){let l=parseInt(u,10);if(l<=0)throw new Error(`Invalid step: ${l}, must be positive`);let c=Math.floor(i*l),d=[];for(let p=Math.floor(r.min/l)*l+c;p<=r.max;p+=l)p>=r.min&&d.push(p);return d.join(",")}else return String(Math.floor(i*(r.max-r.min+1)+r.min))})}static#s(t,r,n){let i=[];function s(a,u){if(Array.isArray(a))i.push(...a);else if(e.#d(u,a))i.push(a);else{let l=parseInt(a.toString(),10);if(!(l>=u.min&&l<=u.max))throw new Error(`Constraint error, got value ${a} expected range ${u.min}-${u.max}`);i.push(t===Rs.DayOfWeek?l%7:a)}}return r.split(",").forEach(a=>{if(!(a.length>0))throw new Error("Invalid list value format");s(e.#t(t,a,n),n)}),i}static#t(t,r,n){let i=r.split("/");if(i.length>2)throw new Error(`Invalid repeat: ${r}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${n.max}`),e.#a(t,i[0],parseInt(i[1],10),n)):e.#a(t,r,1,n)}static#u(t,r,n){if(!(!isNaN(t)&&!isNaN(r)&&t>=n.min&&r<=n.max))throw new Error(`Constraint error, got range ${t}-${r} expected range ${n.min}-${n.max}`);if(t>r)throw new Error(`Invalid range: ${t}-${r}, min(${t}) > max(${r})`)}static#l(t){if(!(!isNaN(t)&&t>0))throw new Error(`Constraint error, cannot repeat at every ${t} time.`)}static#o(t,r,n,i){let s=[];t===Rs.DayOfWeek&&n%7===0&&s.push(0);for(let o=r;o<=n;o+=i)s.indexOf(o)===-1&&s.push(o);return s}static#a(t,r,n,i){let s=r.split("-");if(s.length<=1)return isNaN(+r)?r:+r;let[o,a]=s.map(u=>parseInt(u,10));return this.#u(o,a,i),this.#l(n),this.#o(t,o,a,n)}static#c(t){let r=t.split("#");if(r.length<=1)return{dayOfWeek:r[0]};let n=+r[r.length-1],i=t.match(/([,-/])/);if(i!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${i?.[0]}\` special characters are incompatible`);if(!(r.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:r[0],nthDayOfWeek:n}}static#d(t,r){return t.chars.some(n=>r.toString().includes(n))}};Ps.CronExpressionParser=bF});var ide=T(Do=>{"use strict";var Ret=Do&&Do.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Pet=Do&&Do.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Iet=Do&&Do.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),i=0;i<n.length;i++)n[i]!=="default"&&Ret(r,t,n[i]);return Pet(r,t),r}})();Object.defineProperty(Do,"__esModule",{value:!0});Do.CronFileParser=void 0;var Oet=vT(),wF=class e{static async parseFile(t){let{readFile:r}=await Promise.resolve().then(()=>Iet(ie("fs/promises"))),n=await r(t,"utf8");return e.#e(n)}static parseFileSync(t){let{readFileSync:r}=ie("fs"),n=r(t,"utf8");return e.#e(n)}static#e(t){let r=t.split(`
673
- `),n={variables:{},expressions:[],errors:{}};for(let i of r){let s=i.trim();if(s.length===0||s.startsWith("#"))continue;let o=s.match(/^(.*)=(.*)$/);if(o){let[,a,u]=o;n.variables[a]=u.replace(/["']/g,"");continue}try{let a=e.#r(s);n.expressions.push(a.interval)}catch(a){n.errors[s]=a}}return n}static#r(t){let r=t.split(" ");return{interval:Oet.CronExpressionParser.parse(r.slice(0,5).join(" ")),command:r.slice(5,r.length)}}};Do.CronFileParser=wF});var sde=T(cn=>{"use strict";var Cet=cn&&cn.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Net=cn&&cn.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Cet(t,e,r)};Object.defineProperty(cn,"__esModule",{value:!0});cn.CronFileParser=cn.CronExpressionParser=cn.CronExpression=cn.CronFieldCollection=cn.CronDate=void 0;var Aet=vT(),Det=pT();Object.defineProperty(cn,"CronDate",{enumerable:!0,get:function(){return Det.CronDate}});var jet=hF();Object.defineProperty(cn,"CronFieldCollection",{enumerable:!0,get:function(){return jet.CronFieldCollection}});var zet=mF();Object.defineProperty(cn,"CronExpression",{enumerable:!0,get:function(){return zet.CronExpression}});var Met=vT();Object.defineProperty(cn,"CronExpressionParser",{enumerable:!0,get:function(){return Met.CronExpressionParser}});var Let=ide();Object.defineProperty(cn,"CronFileParser",{enumerable:!0,get:function(){return Let.CronFileParser}});Net(gT(),cn);cn.default=Aet.CronExpressionParser});function ode(e){let t=e.match(/^(\d+)([smhdw])$/);if(!t)throw new Error(`Invalid duration format: ${e}`);let r=parseInt(t[1],10),n=t[2];switch(n){case"s":return r*1e3;case"m":return r*60*1e3;case"h":return r*60*60*1e3;case"d":return r*24*60*60*1e3;case"w":return r*7*24*60*60*1e3;default:throw new Error(`Unknown unit: ${n}`)}}function ade(e,t,r=new Date,n){let i=typeof n=="string"&&n.length>0?new Date(n).getTime():Number.NaN,s=Number.isFinite(i);if(e==="once")return t!==null?!1:s?r.getTime()>=i:!0;if(e.startsWith("@in ")){let o=e.substring(4).trim();try{let a=ode(o);return t!==null?!1:s?r.getTime()-i>=a:!0}catch{return!1}}if(e.startsWith("@every ")){let o=e.substring(7).trim();try{let a=ode(o);if(!t)return s?r.getTime()-i>=a:!0;let u=new Date(t).getTime();return r.getTime()-u>=a}catch{return!1}}try{if(!t)return s?bT.CronExpressionParser.parse(e,{currentDate:new Date(i),tz:"UTC"}).next().toDate().getTime()<=r.getTime():(bT.CronExpressionParser.parse(e,{currentDate:r,tz:"UTC"}),!0);let a=bT.CronExpressionParser.parse(e,{currentDate:new Date(t),tz:"UTC"}).next().toDate(),u=new Date(t).getTime();return Number.isNaN(u)?!0:a.getTime()<=r.getTime()}catch{return!1}}var bT,ude=L(()=>{"use strict";bT=ro(sde(),1)});var dde={};Kr(dde,{enqueueCadenceItem:()=>qet,markCadenceItemsDone:()=>Fet,mergeCadenceInbox:()=>lde,parseCadenceQueue:()=>cde,runCadenceTick:()=>Uet,scanAndSpawnDueJobs:()=>SF});import{promises as Mc}from"node:fs";import wT from"node:path";async function qet(e,t,r=new Date){await Me(e.cadenceInboxDir);let i=`${r.toISOString().replace(/[:.]/g,"-")}_${Math.random().toString(36).slice(2)}.pending`,s=wT.join(e.cadenceInboxDir,i);return await Bt(s,`${t.trim()}
672
+ ${k}`,E=LE(t,{sessionKey:s,bus:r,sessionContextKind:"meta"});ot("[meta-session] executing partition",{partition:w.name});let P=[],C=["EnterPlanMode","ExitPlanMode","AskUserQuestion"],$=0,N=0,A=Date.now(),W=i.run({prompt:PD(R),cwd:w.dir,settingSources:["user","project","local"],persistSession:!1,mcpServers:{aladuo:E},additionalDirectories:[t.memoryDir],disallowedTools:C,onStream:j=>{r.emit("session.stream",{sessionKey:s,chunk:j})},onExecutionEvent:j=>{j.type==="tool_use"?$+=1:j.type==="tool_result"&&j.isError&&(N+=1),P.push(Y7e(t,s,w.name,j).catch(V=>{kt("[meta-session] failed to persist execution event",{partition:w.name,eventType:j.type,error:V instanceof Error?V.message:String(V)})}))}}),H=Math.max(1,w.schedule.max_duration_ms),te,ne=new Error(`partition timeout: ${w.name} exceeded ${H}ms`),Z=new Promise((j,V)=>{te=setTimeout(()=>V(ne),H)}),z,B=!1;try{z=await Promise.race([W,Z])}catch(j){throw B=!0,j===ne&&W.catch(V=>{kt("[meta-session] late sdk completion after timeout",{partition:w.name,error:V instanceof Error?V.message:String(V)})}),mf(t,{id:crypto.randomUUID(),session_key:`${s}:${w.name}`,drain_started_at:new Date(A).toISOString(),drain_duration_ms:Date.now()-A,sdk_duration_ms:Date.now()-A,events_processed:1,events_skipped:0,tool_calls:$,tool_errors:N,output_chars:0,cancelled:!0,usage:void 0}).catch(()=>{}),j}finally{te&&clearTimeout(te)}let q=Date.now()-A;if(!B){let j=z.usage;mf(t,{id:crypto.randomUUID(),session_key:`${s}:${w.name}`,sdk_session_id:z.sessionId,drain_started_at:new Date(A).toISOString(),drain_duration_ms:q,sdk_duration_ms:q,events_processed:1,events_skipped:0,tool_calls:$,tool_errors:N,output_chars:z.text?.length??0,cancelled:!1,usage:j}).catch(()=>{})}P.length>0&&await Promise.all(P);let I=J7e(z.text),D=K7e(w.name,I);if(D){let j=Qt({type:"agent.error",source:{kind:"meta",name:`subconscious:${w.name}`},session_key:s,payload:{stage:"partition_output",partition:w.name,error:D,output_preview:I.slice(0,400)}});return await er(t,j),await hu(t,"meta_session",j.id,new Date),await FE(t,w.name),v.set(w.name,x),kt("[meta-session] partition produced invalid output",{partition:w.name,outputPreview:I.slice(0,120)}),w.name}await FE(t,w.name),v.set(w.name,x);let O=Qt({type:"agent.result",source:{kind:"meta",name:`subconscious:${w.name}`},session_key:s,payload:{text:I,tick_type:"subconscious",partition:w.name}});return await er(t,O),await hu(t,"meta_session",O.id,new Date(O.ts)),ot("[meta-session] partition completed",{partition:w.name,eventId:O.id}),w.name}function g(w,k,x){for(let R of w){if(R.done)continue;let E=k.find($=>$.name===R.name);if(!E)return R;let P=Math.max(0,E.schedule.cooldown_ticks),C=v.get(R.name);if(C===void 0||x-C>=P)return R}return null}let m=async()=>{if(u||l){yt("[meta-session] skipping tick",{processing:u,stopRequested:l});return}u=!0,ot("[meta-session] starting tick");try{f+=1;let w="";try{w=await $q.readFile(t.subconsciousPlaylistPath,"utf8")}catch{}let k=[];try{k=(await $q.readdir(t.subconsciousInboxDir)).filter(A=>A.endsWith(".pending")||A.endsWith(".json")).sort()}catch{}let x=await eXe(t),R=`${w}:${k.join(",")}:${x}`,E=X7e(R);if(o>0&&!h){if(d!==null&&E===d&&p<o){p+=1,yt("[meta-session] activity gate: skipping tick (no state change)",{quietStreak:p,maxQuietTicks:o}),u=!1;return}E!==d||ot("[meta-session] activity gate: heartbeat tick",{quietStreak:p}),p=0}let P=await ple(t);await y("ok"),await ko(t,A=>({...A,health:{...A.health,meta_session:"starting"}})),await Jf(t);let C=await kq(t),$=await Q7e(t,n,P.messages),N=await _(C,$,f);if(N&&P.files.length>0&&await hle(t,P.files),o>0&&N&&(d=E),N&&a>1&&(!n||n.activeCount()<=1))for(let W=1;W<a&&await _(C,$,f);W++);await ko(t,A=>({...A,health:{...A.health,meta_session:"ok"}})),ot("[meta-session] tick completed"),h=!1}catch(w){qt("[meta-session] tick error:",w),h=!0,await y("error"),await ko(t,x=>({...x,health:{...x.health,meta_session:"down"}}));let k=Qt({type:"agent.error",source:{kind:"meta",name:"meta-session"},session_key:s,payload:{stage:"tick",error:w instanceof Error?w.message:String(w)}});await er(t,k),await hu(t,"meta_session",k.id,new Date(k.ts))}finally{u=!1}},S=()=>{c=m()};return{start(){l||(r.on("cadence.tick",S),ko(t,w=>({...w,health:{...w.health,meta_session:"starting"}})),mi("info","[meta-session] started, listening for cadence ticks"))},async stop(){if(l=!0,r.off("cadence.tick",S),c)try{await c}catch{}mi("info","[meta-session] stopped")},isProcessing(){return u}}}var yle=L(()=>{"use strict";DS();Ii();na();wq();fr();w0();qS();gf();mle()});var vle=T(_le=>{"use strict";Object.defineProperty(_le,"__esModule",{value:!0})});var Gu=T(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.CronField=void 0;var Eq=class e{#e=!1;#r=!1;#i=!1;#n=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(t,r={rawValue:""}){if(!Array.isArray(t))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(t.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#n=t.sort(e.sorter),this.#i=this.options.wildcard!==void 0?this.options.wildcard:this.#s(),this.#e=this.options.rawValue.includes("L")||t.includes("L"),this.#r=this.options.rawValue.includes("?")||t.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#r}get isWildcard(){return this.#i}get values(){return this.#n}static sorter(t,r){let n=typeof t=="number",i=typeof r=="number";return n&&i?t-r:!n&&!i?t.localeCompare(r):n?-1:1}static findNearestValueInList(t,r,n=!1){if(n){for(let i=t.length-1;i>=0;i--)if(t[i]<r)return t[i];return null}for(let i=0;i<t.length;i++)if(t[i]>r)return t[i];return null}findNearestValue(t,r=!1){return this.constructor.findNearestValueInList(this.values,t,r)}serialize(){return{wildcard:this.#i,values:this.#n}}validate(){let t,r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",n=a=>u=>new RegExp(`^\\d{0,2}${u}$`).test(a),i=a=>(t=a,typeof a=="number"?a>=this.min&&a<=this.max:this.chars.some(n(a)));if(!this.#n.every(i))throw new Error(`${this.constructor.name} Validation error, got value ${t} expected range ${this.min}-${this.max}${r}`);let o=this.#n.find((a,u)=>this.#n.indexOf(a)!==u);if(o)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${o}`)}#s(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(t,r)=>r+this.min).every(t=>this.#n.includes(t))}};UE.CronField=Eq});var ble=T(ZE=>{"use strict";Object.defineProperty(ZE,"__esModule",{value:!0});ZE.CronDayOfMonth=void 0;var rXe=Gu(),nXe=1,iXe=31,sXe=Object.freeze(["L"]),Tq=class extends rXe.CronField{static get min(){return nXe}static get max(){return iXe}static get chars(){return sXe}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};ZE.CronDayOfMonth=Tq});var wle=T(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.CronDayOfWeek=void 0;var oXe=Gu(),aXe=0,uXe=7,lXe=Object.freeze(["L"]),Rq=class extends oXe.CronField{static get min(){return aXe}static get max(){return uXe}static get chars(){return lXe}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};VE.CronDayOfWeek=Rq});var Sle=T(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.CronHour=void 0;var cXe=Gu(),dXe=0,fXe=23,pXe=Object.freeze([]),Pq=class extends cXe.CronField{static get min(){return dXe}static get max(){return fXe}static get chars(){return pXe}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};HE.CronHour=Pq});var kle=T(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.CronMinute=void 0;var hXe=Gu(),mXe=0,gXe=59,yXe=Object.freeze([]),Iq=class extends hXe.CronField{static get min(){return mXe}static get max(){return gXe}static get chars(){return yXe}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};BE.CronMinute=Iq});var Qce=T(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var Ra=class extends Error{},qq=class extends Ra{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}},Fq=class extends Ra{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}},Uq=class extends Ra{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}},Xu=class extends Ra{},eT=class extends Ra{constructor(t){super(`Invalid unit ${t}`)}},ln=class extends Ra{},Ao=class extends Ra{constructor(){super("Zone is an abstract class")}},_e="numeric",eo="short",Ui="long",tT={year:_e,month:_e,day:_e},ece={year:_e,month:eo,day:_e},_Xe={year:_e,month:eo,day:_e,weekday:eo},tce={year:_e,month:Ui,day:_e},rce={year:_e,month:Ui,day:_e,weekday:Ui},nce={hour:_e,minute:_e},ice={hour:_e,minute:_e,second:_e},sce={hour:_e,minute:_e,second:_e,timeZoneName:eo},oce={hour:_e,minute:_e,second:_e,timeZoneName:Ui},ace={hour:_e,minute:_e,hourCycle:"h23"},uce={hour:_e,minute:_e,second:_e,hourCycle:"h23"},lce={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:eo},cce={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:Ui},dce={year:_e,month:_e,day:_e,hour:_e,minute:_e},fce={year:_e,month:_e,day:_e,hour:_e,minute:_e,second:_e},pce={year:_e,month:eo,day:_e,hour:_e,minute:_e},hce={year:_e,month:eo,day:_e,hour:_e,minute:_e,second:_e},vXe={year:_e,month:eo,day:_e,weekday:eo,hour:_e,minute:_e},mce={year:_e,month:Ui,day:_e,hour:_e,minute:_e,timeZoneName:eo},gce={year:_e,month:Ui,day:_e,hour:_e,minute:_e,second:_e,timeZoneName:eo},yce={year:_e,month:Ui,day:_e,weekday:Ui,hour:_e,minute:_e,timeZoneName:Ui},_ce={year:_e,month:Ui,day:_e,weekday:Ui,hour:_e,minute:_e,second:_e,timeZoneName:Ui},el=class{get type(){throw new Ao}get name(){throw new Ao}get ianaName(){return this.name}get isUniversal(){throw new Ao}offsetName(t,r){throw new Ao}formatOffset(t,r){throw new Ao}offset(t){throw new Ao}equals(t){throw new Ao}get isValid(){throw new Ao}},Oq=null,z_=class e extends el{static get instance(){return Oq===null&&(Oq=new e),Oq}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Pce(t,r,n)}formatOffset(t,r){return j_(this.offset(t),r)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}},Zq=new Map;function bXe(e){let t=Zq.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Zq.set(e,t)),t}var wXe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function SXe(e,t){let r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,s,o,a,u,l,c]=n;return[o,i,s,a,u,l,c]}function kXe(e,t){let r=e.formatToParts(t),n=[];for(let i=0;i<r.length;i++){let{type:s,value:o}=r[i],a=wXe[s];s==="era"?n[a]=o:Ge(a)||(n[a]=parseInt(o,10))}return n}var Cq=new Map,Pa=class e extends el{static create(t){let r=Cq.get(t);return r===void 0&&Cq.set(t,r=new e(t)),r}static resetCache(){Cq.clear(),Zq.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return Pce(t,r,n,this.name)}formatOffset(t,r){return j_(this.offset(t),r)}offset(t){if(!this.valid)return NaN;let r=new Date(t);if(isNaN(r))return NaN;let n=bXe(this.name),[i,s,o,a,u,l,c]=n.formatToParts?kXe(n,r):SXe(n,r);a==="BC"&&(i=-Math.abs(i)+1);let p=uT({year:i,month:s,day:o,hour:u===24?0:u,minute:l,second:c,millisecond:0}),f=+r,h=f%1e3;return f-=h>=0?h:1e3+h,(p-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},xle={};function xXe(e,t={}){let r=JSON.stringify([e,t]),n=xle[r];return n||(n=new Intl.ListFormat(e,t),xle[r]=n),n}var Vq=new Map;function Hq(e,t={}){let r=JSON.stringify([e,t]),n=Vq.get(r);return n===void 0&&(n=new Intl.DateTimeFormat(e,t),Vq.set(r,n)),n}var Bq=new Map;function $Xe(e,t={}){let r=JSON.stringify([e,t]),n=Bq.get(r);return n===void 0&&(n=new Intl.NumberFormat(e,t),Bq.set(r,n)),n}var Wq=new Map;function EXe(e,t={}){let{base:r,...n}=t,i=JSON.stringify([e,n]),s=Wq.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(e,t),Wq.set(i,s)),s}var N_=null;function TXe(){return N_||(N_=new Intl.DateTimeFormat().resolvedOptions().locale,N_)}var Jq=new Map;function vce(e){let t=Jq.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Jq.set(e,t)),t}var Gq=new Map;function RXe(e){let t=Gq.get(e);if(!t){let r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...bce,...t}),Gq.set(e,t)}return t}function PXe(e){let t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));let r=e.indexOf("-u-");if(r===-1)return[e];{let n,i;try{n=Hq(e).resolvedOptions(),i=e}catch{let u=e.substring(0,r);n=Hq(u).resolvedOptions(),i=u}let{numberingSystem:s,calendar:o}=n;return[i,s,o]}}function IXe(e,t,r){return(r||t)&&(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`)),e}function OXe(e){let t=[];for(let r=1;r<=12;r++){let n=vr.utc(2009,r,1);t.push(e(n))}return t}function CXe(e){let t=[];for(let r=1;r<=7;r++){let n=vr.utc(2016,11,13+r);t.push(e(n))}return t}function WE(e,t,r,n){let i=e.listingMode();return i==="error"?null:i==="en"?r(t):n(t)}function NXe(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||vce(e.locale).numberingSystem==="latn"}var Kq=class{constructor(t,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:s,...o}=n;if(!r||Object.keys(o).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=$Xe(t,a)}}format(t){if(this.inf){let r=this.floor?Math.floor(t):t;return this.inf.format(r)}else{let r=this.floor?Math.floor(t):aF(t,3);return Gr(r,this.padTo)}}},Yq=class{constructor(t,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=t;else if(t.zone.type==="fixed"){let o=-1*(t.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;t.offset!==0&&Pa.create(a).valid?(i=a,this.dt=t):(i="UTC",this.dt=t.offset===0?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else t.zone.type==="system"?this.dt=t:t.zone.type==="iana"?(this.dt=t,i=t.zone.name):(i="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=Hq(r,s)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):t}resolvedOptions(){return this.dtf.resolvedOptions()}},Xq=class{constructor(t,r,n){this.opts={style:"long",...n},!r&&Tce()&&(this.rtf=EXe(t,n))}format(t,r){return this.rtf?this.rtf.format(t,r):eQe(r,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,r){return this.rtf?this.rtf.formatToParts(t,r):[]}},bce={firstDay:1,minimalDays:4,weekend:[6,7]},rr=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,r,n,i,s=!1){let o=t||mr.defaultLocale,a=o||(s?"en-US":TXe()),u=r||mr.defaultNumberingSystem,l=n||mr.defaultOutputCalendar,c=eF(i)||mr.defaultWeekSettings;return new e(a,u,l,c,o)}static resetCache(){N_=null,Vq.clear(),Bq.clear(),Wq.clear(),Jq.clear(),Gq.clear()}static fromObject({locale:t,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return e.create(t,r,n,i)}constructor(t,r,n,i,s){let[o,a,u]=PXe(t);this.locale=o,this.numberingSystem=r||a||null,this.outputCalendar=n||u||null,this.weekSettings=i,this.intl=IXe(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=NXe(this)),this.fastNumbersCached}listingMode(){let t=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&r?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,eF(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,r=!1){return WE(this,t,Cce,()=>{let n=this.intl==="ja"||this.intl.startsWith("ja-");r&=!n;let i=r?{month:t,day:"numeric"}:{month:t},s=r?"format":"standalone";if(!this.monthsCache[s][t]){let o=n?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][t]=OXe(o)}return this.monthsCache[s][t]})}weekdays(t,r=!1){return WE(this,t,Dce,()=>{let n=r?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},i=r?"format":"standalone";return this.weekdaysCache[i][t]||(this.weekdaysCache[i][t]=CXe(s=>this.extract(s,n,"weekday"))),this.weekdaysCache[i][t]})}meridiems(){return WE(this,void 0,()=>jce,()=>{if(!this.meridiemCache){let t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[vr.utc(2016,11,13,9),vr.utc(2016,11,13,19)].map(r=>this.extract(r,t,"dayperiod"))}return this.meridiemCache})}eras(t){return WE(this,t,zce,()=>{let r={era:t};return this.eraCache[t]||(this.eraCache[t]=[vr.utc(-40,1,1),vr.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[t]})}extract(t,r,n){let i=this.dtFormatter(t,r),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===n);return o?o.value:null}numberFormatter(t={}){return new Kq(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,r={}){return new Yq(t,this.intl,r)}relFormatter(t={}){return new Xq(this.intl,this.isEnglish(),t)}listFormatter(t={}){return xXe(this.intl,t)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||vce(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Rce()?RXe(this.locale):bce}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Nq=null,Zi=class e extends el{static get utcInstance(){return Nq===null&&(Nq=new e(0)),Nq}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let r=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new e(lT(r[1],r[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${j_(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${j_(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,r){return j_(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}},rT=class extends el{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Yu(e,t){if(Ge(e)||e===null)return t;if(e instanceof el)return e;if(LXe(e)){let r=e.toLowerCase();return r==="default"?t:r==="local"||r==="system"?z_.instance:r==="utc"||r==="gmt"?Zi.utcInstance:Zi.parseSpecifier(r)||Pa.create(e)}else return Qu(e)?Zi.instance(e):typeof e=="object"&&"offset"in e&&typeof e.offset=="function"?e:new rT(e)}var nF={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},$le={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},AXe=nF.hanidec.replace(/[\[|\]]/g,"").split("");function DXe(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(e[r].search(nF.hanidec)!==-1)t+=AXe.indexOf(e[r]);else for(let i in $le){let[s,o]=$le[i];n>=s&&n<=o&&(t+=n-s)}}return parseInt(t,10)}else return t}var Qq=new Map;function jXe(){Qq.clear()}function Xs({numberingSystem:e},t=""){let r=e||"latn",n=Qq.get(r);n===void 0&&(n=new Map,Qq.set(r,n));let i=n.get(t);return i===void 0&&(i=new RegExp(`${nF[r]}${t}`),n.set(t,i)),i}var Ele=()=>Date.now(),Tle="system",Rle=null,Ple=null,Ile=null,Ole=60,Cle,Nle=null,mr=class{static get now(){return Ele}static set now(t){Ele=t}static set defaultZone(t){Tle=t}static get defaultZone(){return Yu(Tle,z_.instance)}static get defaultLocale(){return Rle}static set defaultLocale(t){Rle=t}static get defaultNumberingSystem(){return Ple}static set defaultNumberingSystem(t){Ple=t}static get defaultOutputCalendar(){return Ile}static set defaultOutputCalendar(t){Ile=t}static get defaultWeekSettings(){return Nle}static set defaultWeekSettings(t){Nle=eF(t)}static get twoDigitCutoffYear(){return Ole}static set twoDigitCutoffYear(t){Ole=t%100}static get throwOnInvalid(){return Cle}static set throwOnInvalid(t){Cle=t}static resetCaches(){rr.resetCache(),Pa.resetCache(),vr.resetCache(),jXe()}},Fi=class{constructor(t,r){this.reason=t,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},wce=[0,31,59,90,120,151,181,212,243,273,304,334],Sce=[0,31,60,91,121,152,182,213,244,274,305,335];function ks(e,t){return new Fi("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function iF(e,t,r){let n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function kce(e,t,r){return r+(L_(e)?Sce:wce)[t-1]}function xce(e,t){let r=L_(e)?Sce:wce,n=r.findIndex(s=>s<t),i=t-r[n];return{month:n+1,day:i}}function sF(e,t){return(e-t+7)%7+1}function nT(e,t=4,r=1){let{year:n,month:i,day:s}=e,o=kce(n,i,s),a=sF(iF(n,i,s),r),u=Math.floor((o-a+14-t)/7),l;return u<1?(l=n-1,u=M_(l,t,r)):u>M_(n,t,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:a,...cT(e)}}function Ale(e,t=4,r=1){let{weekYear:n,weekNumber:i,weekday:s}=e,o=sF(iF(n,1,t),r),a=Kp(n),u=i*7+s-o-7+t,l;u<1?(l=n-1,u+=Kp(l)):u>a?(l=n+1,u-=Kp(n)):l=n;let{month:c,day:d}=xce(l,u);return{year:l,month:c,day:d,...cT(e)}}function Aq(e){let{year:t,month:r,day:n}=e,i=kce(t,r,n);return{year:t,ordinal:i,...cT(e)}}function Dle(e){let{year:t,ordinal:r}=e,{month:n,day:i}=xce(t,r);return{year:t,month:n,day:i,...cT(e)}}function jle(e,t){if(!Ge(e.localWeekday)||!Ge(e.localWeekNumber)||!Ge(e.localWeekYear)){if(!Ge(e.weekday)||!Ge(e.weekNumber)||!Ge(e.weekYear))throw new Xu("Cannot mix locale-based week fields with ISO-based week fields");return Ge(e.localWeekday)||(e.weekday=e.localWeekday),Ge(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),Ge(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function zXe(e,t=4,r=1){let n=aT(e.weekYear),i=xs(e.weekNumber,1,M_(e.weekYear,t,r)),s=xs(e.weekday,1,7);return n?i?s?!1:ks("weekday",e.weekday):ks("week",e.weekNumber):ks("weekYear",e.weekYear)}function MXe(e){let t=aT(e.year),r=xs(e.ordinal,1,Kp(e.year));return t?r?!1:ks("ordinal",e.ordinal):ks("year",e.year)}function $ce(e){let t=aT(e.year),r=xs(e.month,1,12),n=xs(e.day,1,iT(e.year,e.month));return t?r?n?!1:ks("day",e.day):ks("month",e.month):ks("year",e.year)}function Ece(e){let{hour:t,minute:r,second:n,millisecond:i}=e,s=xs(t,0,23)||t===24&&r===0&&n===0&&i===0,o=xs(r,0,59),a=xs(n,0,59),u=xs(i,0,999);return s?o?a?u?!1:ks("millisecond",i):ks("second",n):ks("minute",r):ks("hour",t)}function Ge(e){return typeof e>"u"}function Qu(e){return typeof e=="number"}function aT(e){return typeof e=="number"&&e%1===0}function LXe(e){return typeof e=="string"}function qXe(e){return Object.prototype.toString.call(e)==="[object Date]"}function Tce(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Rce(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function FXe(e){return Array.isArray(e)?e:[e]}function zle(e,t,r){if(e.length!==0)return e.reduce((n,i)=>{let s=[t(i),i];return n&&r(n[0],s[0])===n[0]?n:s},null)[1]}function UXe(e,t){return t.reduce((r,n)=>(r[n]=e[n],r),{})}function Xp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function eF(e){if(e==null)return null;if(typeof e!="object")throw new ln("Week settings must be an object");if(!xs(e.firstDay,1,7)||!xs(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(t=>!xs(t,1,7)))throw new ln("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function xs(e,t,r){return aT(e)&&e>=t&&e<=r}function ZXe(e,t){return e-t*Math.floor(e/t)}function Gr(e,t=2){let r=e<0,n;return r?n="-"+(""+-e).padStart(t,"0"):n=(""+e).padStart(t,"0"),n}function Ku(e){if(!(Ge(e)||e===null||e===""))return parseInt(e,10)}function Cc(e){if(!(Ge(e)||e===null||e===""))return parseFloat(e)}function oF(e){if(!(Ge(e)||e===null||e==="")){let t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function aF(e,t,r="round"){let n=10**t;switch(r){case"expand":return e>0?Math.ceil(e*n)/n:Math.floor(e*n)/n;case"trunc":return Math.trunc(e*n)/n;case"round":return Math.round(e*n)/n;case"floor":return Math.floor(e*n)/n;case"ceil":return Math.ceil(e*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function L_(e){return e%4===0&&(e%100!==0||e%400===0)}function Kp(e){return L_(e)?366:365}function iT(e,t){let r=ZXe(t-1,12)+1,n=e+(t-r)/12;return r===2?L_(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function uT(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Mle(e,t,r){return-sF(iF(e,1,t),r)+t-1}function M_(e,t=4,r=1){let n=Mle(e,t,r),i=Mle(e+1,t,r);return(Kp(e)-n+i)/7}function tF(e){return e>99?e:e>mr.twoDigitCutoffYear?1900+e:2e3+e}function Pce(e,t,r,n=null){let i=new Date(e),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);let o={timeZoneName:t,...s},a=new Intl.DateTimeFormat(r,o).formatToParts(i).find(u=>u.type.toLowerCase()==="timezonename");return a?a.value:null}function lT(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);let n=parseInt(t,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function Ice(e){let t=Number(e);if(typeof e=="boolean"||e===""||!Number.isFinite(t))throw new ln(`Invalid unit value ${e}`);return t}function sT(e,t){let r={};for(let n in e)if(Xp(e,n)){let i=e[n];if(i==null)continue;r[t(n)]=Ice(i)}return r}function j_(e,t){let r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${Gr(r,2)}:${Gr(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${Gr(r,2)}${Gr(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function cT(e){return UXe(e,["hour","minute","second","millisecond"])}var VXe=["January","February","March","April","May","June","July","August","September","October","November","December"],Oce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],HXe=["J","F","M","A","M","J","J","A","S","O","N","D"];function Cce(e){switch(e){case"narrow":return[...HXe];case"short":return[...Oce];case"long":return[...VXe];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var Nce=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ace=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],BXe=["M","T","W","T","F","S","S"];function Dce(e){switch(e){case"narrow":return[...BXe];case"short":return[...Ace];case"long":return[...Nce];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var jce=["AM","PM"],WXe=["Before Christ","Anno Domini"],JXe=["BC","AD"],GXe=["B","A"];function zce(e){switch(e){case"narrow":return[...GXe];case"short":return[...JXe];case"long":return[...WXe];default:return null}}function KXe(e){return jce[e.hour<12?0:1]}function YXe(e,t){return Dce(t)[e.weekday-1]}function XXe(e,t){return Cce(t)[e.month-1]}function QXe(e,t){return zce(t)[e.year<0?0:1]}function eQe(e,t,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(e)===-1;if(r==="auto"&&s){let d=e==="days";switch(t){case 1:return d?"tomorrow":`next ${i[e][0]}`;case-1:return d?"yesterday":`last ${i[e][0]}`;case 0:return d?"today":`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,a=Math.abs(t),u=a===1,l=i[e],c=n?u?l[1]:l[2]||l[1]:u?i[e][0]:e;return o?`${a} ${c} ago`:`in ${a} ${c}`}function Lle(e,t){let r="";for(let n of e)n.literal?r+=n.val:r+=t(n.val);return r}var tQe={D:tT,DD:ece,DDD:tce,DDDD:rce,t:nce,tt:ice,ttt:sce,tttt:oce,T:ace,TT:uce,TTT:lce,TTTT:cce,f:dce,ff:pce,fff:mce,ffff:yce,F:fce,FF:hce,FFF:gce,FFFF:_ce},qi=class e{static create(t,r={}){return new e(t,r)}static parseFormat(t){let r=null,n="",i=!1,s=[];for(let o=0;o<t.length;o++){let a=t.charAt(o);a==="'"?((n.length>0||i)&&s.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(t){return tQe[t]}constructor(t,r){this.opts=r,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...r}).format()}dtFormatter(t,r={}){return this.loc.dtFormatter(t,{...this.opts,...r})}formatDateTime(t,r){return this.dtFormatter(t,r).format()}formatDateTimeParts(t,r){return this.dtFormatter(t,r).formatToParts()}formatInterval(t,r){return this.dtFormatter(t.start,r).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,r){return this.dtFormatter(t,r).resolvedOptions()}num(t,r=0,n=void 0){if(this.opts.forceSimple)return Gr(t,r);let i={...this.opts};return r>0&&(i.padTo=r),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(t)}formatDateTimeFromString(t,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(f,h)=>this.loc.extract(t,f,h),o=f=>t.isOffsetFixed&&t.offset===0&&f.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,f.format):"",a=()=>n?KXe(t):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(f,h)=>n?XXe(t,f):s(h?{month:f}:{month:f,day:"numeric"},"month"),l=(f,h)=>n?YXe(t,f):s(h?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),c=f=>{let h=e.macroTokenToFormatOpts(f);return h?this.formatWithSystemDefault(t,h):f},d=f=>n?QXe(t,f):s({era:f},"era"),p=f=>{switch(f){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(t.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(t.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(t.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(t.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(t.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(f)}};return Lle(e.parseFormat(r),p)}formatDurationFromString(t,r){let n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(c,d)=>p=>{let f=i(p);if(f){let h=d.isNegativeDuration&&f!==d.largestUnit?n:1,v;return this.opts.signMode==="negativeLargestOnly"&&f!==d.largestUnit?v="never":this.opts.signMode==="all"?v="always":v="auto",this.num(c.get(f)*h,p.length,v)}else return p},o=e.parseFormat(r),a=o.reduce((c,{literal:d,val:p})=>d?c:c.concat(p),[]),u=t.shiftTo(...a.map(i).filter(c=>c)),l={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Lle(o,s(u,l))}},Mce=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Qp(...e){let t=e.reduce((r,n)=>r+n.source,"");return RegExp(`^${t}$`)}function eh(...e){return t=>e.reduce(([r,n,i],s)=>{let[o,a,u]=s(t,i);return[{...r,...o},a||n,u]},[{},null,1]).slice(0,2)}function th(e,...t){if(e==null)return[null,null];for(let[r,n]of t){let i=r.exec(e);if(i)return n(i)}return[null,null]}function Lce(...e){return(t,r)=>{let n={},i;for(i=0;i<e.length;i++)n[e[i]]=Ku(t[r+i]);return[n,null,r+i]}}var qce=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,rQe=`(?:${qce.source}?(?:\\[(${Mce.source})\\])?)?`,uF=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Fce=RegExp(`${uF.source}${rQe}`),lF=RegExp(`(?:[Tt]${Fce.source})?`),nQe=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,iQe=/(\d{4})-?W(\d\d)(?:-?(\d))?/,sQe=/(\d{4})-?(\d{3})/,oQe=Lce("weekYear","weekNumber","weekDay"),aQe=Lce("year","ordinal"),uQe=/(\d{4})-(\d\d)-(\d\d)/,Uce=RegExp(`${uF.source} ?(?:${qce.source}|(${Mce.source}))?`),lQe=RegExp(`(?: ${Uce.source})?`);function Yp(e,t,r){let n=e[t];return Ge(n)?r:Ku(n)}function cQe(e,t){return[{year:Yp(e,t),month:Yp(e,t+1,1),day:Yp(e,t+2,1)},null,t+3]}function rh(e,t){return[{hours:Yp(e,t,0),minutes:Yp(e,t+1,0),seconds:Yp(e,t+2,0),milliseconds:oF(e[t+3])},null,t+4]}function q_(e,t){let r=!e[t]&&!e[t+1],n=lT(e[t+1],e[t+2]),i=r?null:Zi.instance(n);return[{},i,t+3]}function F_(e,t){let r=e[t]?Pa.create(e[t]):null;return[{},r,t+1]}var dQe=RegExp(`^T?${uF.source}$`),fQe=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function pQe(e){let[t,r,n,i,s,o,a,u,l]=e,c=t[0]==="-",d=u&&u[0]==="-",p=(f,h=!1)=>f!==void 0&&(h||f&&c)?-f:f;return[{years:p(Cc(r)),months:p(Cc(n)),weeks:p(Cc(i)),days:p(Cc(s)),hours:p(Cc(o)),minutes:p(Cc(a)),seconds:p(Cc(u),u==="-0"),milliseconds:p(oF(l),d)}]}var hQe={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function cF(e,t,r,n,i,s,o){let a={year:t.length===2?tF(Ku(t)):Ku(t),month:Oce.indexOf(r)+1,day:Ku(n),hour:Ku(i),minute:Ku(s)};return o&&(a.second=Ku(o)),e&&(a.weekday=e.length>3?Nce.indexOf(e)+1:Ace.indexOf(e)+1),a}var mQe=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function gQe(e){let[,t,r,n,i,s,o,a,u,l,c,d]=e,p=cF(t,i,n,r,s,o,a),f;return u?f=hQe[u]:l?f=0:f=lT(c,d),[p,new Zi(f)]}function yQe(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var _Qe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,vQe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,bQe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function qle(e){let[,t,r,n,i,s,o,a]=e;return[cF(t,i,n,r,s,o,a),Zi.utcInstance]}function wQe(e){let[,t,r,n,i,s,o,a]=e;return[cF(t,a,r,n,i,s,o),Zi.utcInstance]}var SQe=Qp(nQe,lF),kQe=Qp(iQe,lF),xQe=Qp(sQe,lF),$Qe=Qp(Fce),Zce=eh(cQe,rh,q_,F_),EQe=eh(oQe,rh,q_,F_),TQe=eh(aQe,rh,q_,F_),RQe=eh(rh,q_,F_);function PQe(e){return th(e,[SQe,Zce],[kQe,EQe],[xQe,TQe],[$Qe,RQe])}function IQe(e){return th(yQe(e),[mQe,gQe])}function OQe(e){return th(e,[_Qe,qle],[vQe,qle],[bQe,wQe])}function CQe(e){return th(e,[fQe,pQe])}var NQe=eh(rh);function AQe(e){return th(e,[dQe,NQe])}var DQe=Qp(uQe,lQe),jQe=Qp(Uce),zQe=eh(rh,q_,F_);function MQe(e){return th(e,[DQe,Zce],[jQe,zQe])}var Fle="Invalid Duration",Vce={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},LQe={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Vce},Ss=146097/400,Wp=146097/4800,qQe={years:{quarters:4,months:12,weeks:Ss/7,days:Ss,hours:Ss*24,minutes:Ss*24*60,seconds:Ss*24*60*60,milliseconds:Ss*24*60*60*1e3},quarters:{months:3,weeks:Ss/28,days:Ss/4,hours:Ss*24/4,minutes:Ss*24*60/4,seconds:Ss*24*60*60/4,milliseconds:Ss*24*60*60*1e3/4},months:{weeks:Wp/7,days:Wp,hours:Wp*24,minutes:Wp*24*60,seconds:Wp*24*60*60,milliseconds:Wp*24*60*60*1e3},...Vce},Ac=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],FQe=Ac.slice(0).reverse();function Ta(e,t,r=!1){let n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new en(n)}function Hce(e,t){var r;let n=(r=t.milliseconds)!=null?r:0;for(let i of FQe.slice(1))t[i]&&(n+=t[i]*e[i].milliseconds);return n}function Ule(e,t){let r=Hce(e,t)<0?-1:1;Ac.reduceRight((n,i)=>{if(Ge(t[i]))return n;if(n){let s=t[n]*r,o=e[i][n],a=Math.floor(s/o);t[i]+=a*r,t[n]-=a*o*r}return i},null),Ac.reduce((n,i)=>{if(Ge(t[i]))return n;if(n){let s=t[n]%1;t[n]-=s,t[i]+=s*e[n][i]}return i},null)}function Zle(e){let t={};for(let[r,n]of Object.entries(e))n!==0&&(t[r]=n);return t}var en=class e{constructor(t){let r=t.conversionAccuracy==="longterm"||!1,n=r?qQe:LQe;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||rr.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,r){return e.fromObject({milliseconds:t},r)}static fromObject(t,r={}){if(t==null||typeof t!="object")throw new ln(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new e({values:sT(t,e.normalizeUnit),loc:rr.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(t){if(Qu(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t=="object")return e.fromObject(t);throw new ln(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,r){let[n]=CQe(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,r){let[n]=AQe(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the Duration is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new Uq(n);return new e({invalid:n})}static normalizeUnit(t){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t&&t.toLowerCase()];if(!r)throw new eT(t);return r}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?qi.create(this.loc,n).formatDurationFromString(this,t):Fle}toHuman(t={}){if(!this.isValid)return Fle;let r=t.showZeros!==!1,n=Ac.map(i=>{let s=this.values[i];return Ge(s)||s===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=aF(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},vr.fromMillis(r,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Hce(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t),n={};for(let i of Ac)(Xp(r.values,i)||Xp(this.values,i))&&(n[i]=r.get(i)+this.get(i));return Ta(this,{values:n},!0)}minus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t);return this.plus(r.negate())}mapUnits(t){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=Ice(t(this.values[n],n));return Ta(this,{values:r},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let r={...this.values,...sT(t,e.normalizeUnit)};return Ta(this,{values:r})}reconfigure({locale:t,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let o={loc:this.loc.clone({locale:t,numberingSystem:r}),matrix:i,conversionAccuracy:n};return Ta(this,o)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;let t=this.toObject();return Ule(this.matrix,t),Ta(this,{values:t},!0)}rescale(){if(!this.isValid)return this;let t=Zle(this.normalize().shiftToAll().toObject());return Ta(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(o=>e.normalizeUnit(o));let r={},n={},i=this.toObject(),s;for(let o of Ac)if(t.indexOf(o)>=0){s=o;let a=0;for(let l in n)a+=this.matrix[l][o]*n[l],n[l]=0;Qu(i[o])&&(a+=i[o]);let u=Math.trunc(a);r[o]=u,n[o]=(a*1e3-u*1e3)/1e3}else Qu(i[o])&&(n[o]=i[o]);for(let o in n)n[o]!==0&&(r[s]+=o===s?n[o]:n[o]/this.matrix[s][o]);return Ule(this.matrix,r),Ta(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=this.values[r]===0?0:-this.values[r];return Ta(this,{values:t},!0)}removeZeros(){if(!this.isValid)return this;let t=Zle(this.values);return Ta(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of Ac)if(!r(this.values[n],t.values[n]))return!1;return!0}},Jp="Invalid Interval";function UQe(e,t){return!e||!e.isValid?jc.invalid("missing or invalid start"):!t||!t.isValid?jc.invalid("missing or invalid end"):t<e?jc.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var jc=class e{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the Interval is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new Fq(n);return new e({invalid:n})}static fromDateTimes(t,r){let n=C_(t),i=C_(r),s=UQe(n,i);return s??new e({start:n,end:i})}static after(t,r){let n=en.fromDurationLike(r),i=C_(t);return e.fromDateTimes(i,i.plus(n))}static before(t,r){let n=en.fromDurationLike(r),i=C_(t);return e.fromDateTimes(i.minus(n),i)}static fromISO(t,r){let[n,i]=(t||"").split("/",2);if(n&&i){let s,o;try{s=vr.fromISO(n,r),o=s.isValid}catch{o=!1}let a,u;try{a=vr.fromISO(i,r),u=a.isValid}catch{u=!1}if(o&&u)return e.fromDateTimes(s,a);if(o){let l=en.fromISO(i,r);if(l.isValid)return e.after(s,l)}else if(u){let l=en.fromISO(n,r);if(l.isValid)return e.before(a,l)}}return e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(t,r),i;return r!=null&&r.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(t,r),Math.floor(i.diff(n,t).get(t))+(i.valueOf()!==this.end.valueOf())}hasSame(t){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,t):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return this.isValid?this.s>t:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:r}={}){return this.isValid?e.fromDateTimes(t||this.s,r||this.e):this}splitAt(...t){if(!this.isValid)return[];let r=t.map(C_).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),n=[],{s:i}=this,s=0;for(;i<this.e;){let o=r[s]||this.e,a=+o>+this.e?this.e:o;n.push(e.fromDateTimes(i,a)),i=a,s+=1}return n}splitBy(t){let r=en.fromDurationLike(t);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,s,o=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(u=>u*i));s=+a>+this.e?this.e:a,o.push(e.fromDateTimes(n,s)),n=s,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return this.isValid?+this.e==+t.s:!1}abutsEnd(t){return this.isValid?+t.e==+this.s:!1}engulfs(t){return this.isValid?this.s<=t.s&&this.e>=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;let r=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return r>=n?null:e.fromDateTimes(r,n)}union(t){if(!this.isValid)return this;let r=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return e.fromDateTimes(r,n)}static merge(t){let[r,n]=t.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return n&&r.push(n),r}static xor(t){let r=null,n=0,i=[],s=t.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((u,l)=>u.time-l.time);for(let u of a)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&i.push(e.fromDateTimes(r,u.time)),r=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Jp}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=tT,r={}){return this.isValid?qi.create(this.s.loc.clone(r),t).formatInterval(this):Jp}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:Jp}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Jp}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:Jp}toFormat(t,{separator:r=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${r}${this.e.toFormat(t)}`:Jp}toDuration(t,r){return this.isValid?this.e.diff(this.s,t,r):en.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},Dc=class{static hasDST(t=mr.defaultZone){let r=vr.now().setZone(t).set({month:12});return!t.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(t){return Pa.isValidZone(t)}static normalizeZone(t){return Yu(t,mr.defaultZone)}static getStartOfWeek({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:r=null}={}){return(r||rr.create(t)).getWeekendDays().slice()}static months(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||rr.create(r,n,s)).months(t)}static monthsFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||rr.create(r,n,s)).months(t,!0)}static weekdays(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||rr.create(r,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||rr.create(r,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return rr.create(t).meridiems()}static eras(t="short",{locale:r=null}={}){return rr.create(r,null,"gregory").eras(t)}static features(){return{relative:Tce(),localeWeek:Rce()}}};function Vle(e,t){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(en.fromMillis(n).as("days"))}function ZQe(e,t,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=Vle(u,l);return(c-c%7)/7}],["days",Vle]],i={},s=e,o,a;for(let[u,l]of n)r.indexOf(u)>=0&&(o=u,i[u]=l(e,t),a=s.plus(i),a>t?(i[u]--,e=s.plus(i),e>t&&(a=e,i[u]--,e=s.plus(i))):e=a);return[e,i,a,o]}function VQe(e,t,r,n){let[i,s,o,a]=ZQe(e,t,r),u=t-i,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(o<t&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+u/(o-i)));let c=en.fromObject(s,n);return l.length>0?en.fromMillis(u,n).shiftTo(...l).plus(c):c}var HQe="missing Intl.DateTimeFormat.formatToParts support";function Mt(e,t=r=>r){return{regex:e,deser:([r])=>t(DXe(r))}}var BQe=" ",Bce=`[ ${BQe}]`,Wce=new RegExp(Bce,"g");function WQe(e){return e.replace(/\./g,"\\.?").replace(Wce,Bce)}function Hle(e){return e.replace(/\./g,"").replace(Wce," ").toLowerCase()}function Qs(e,t){return e===null?null:{regex:RegExp(e.map(WQe).join("|")),deser:([r])=>e.findIndex(n=>Hle(r)===Hle(n))+t}}function Ble(e,t){return{regex:e,deser:([,r,n])=>lT(r,n),groups:t}}function JE(e){return{regex:e,deser:([t])=>t}}function JQe(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function GQe(e,t){let r=Xs(t),n=Xs(t,"{2}"),i=Xs(t,"{3}"),s=Xs(t,"{4}"),o=Xs(t,"{6}"),a=Xs(t,"{1,2}"),u=Xs(t,"{1,3}"),l=Xs(t,"{1,6}"),c=Xs(t,"{1,9}"),d=Xs(t,"{2,4}"),p=Xs(t,"{4,6}"),f=y=>({regex:RegExp(JQe(y.val)),deser:([_])=>_,literal:!0}),v=(y=>{if(e.literal)return f(y);switch(y.val){case"G":return Qs(t.eras("short"),0);case"GG":return Qs(t.eras("long"),0);case"y":return Mt(l);case"yy":return Mt(d,tF);case"yyyy":return Mt(s);case"yyyyy":return Mt(p);case"yyyyyy":return Mt(o);case"M":return Mt(a);case"MM":return Mt(n);case"MMM":return Qs(t.months("short",!0),1);case"MMMM":return Qs(t.months("long",!0),1);case"L":return Mt(a);case"LL":return Mt(n);case"LLL":return Qs(t.months("short",!1),1);case"LLLL":return Qs(t.months("long",!1),1);case"d":return Mt(a);case"dd":return Mt(n);case"o":return Mt(u);case"ooo":return Mt(i);case"HH":return Mt(n);case"H":return Mt(a);case"hh":return Mt(n);case"h":return Mt(a);case"mm":return Mt(n);case"m":return Mt(a);case"q":return Mt(a);case"qq":return Mt(n);case"s":return Mt(a);case"ss":return Mt(n);case"S":return Mt(u);case"SSS":return Mt(i);case"u":return JE(c);case"uu":return JE(a);case"uuu":return Mt(r);case"a":return Qs(t.meridiems(),0);case"kkkk":return Mt(s);case"kk":return Mt(d,tF);case"W":return Mt(a);case"WW":return Mt(n);case"E":case"c":return Mt(r);case"EEE":return Qs(t.weekdays("short",!1),1);case"EEEE":return Qs(t.weekdays("long",!1),1);case"ccc":return Qs(t.weekdays("short",!0),1);case"cccc":return Qs(t.weekdays("long",!0),1);case"Z":case"ZZ":return Ble(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Ble(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return JE(/[a-z_+-/]{1,256}?/i);case" ":return JE(/[^\S\n\r]/);default:return f(y)}})(e)||{invalidReason:HQe};return v.token=e,v}var KQe={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function YQe(e,t,r){let{type:n,value:i}=e;if(n==="literal"){let u=/^\s+$/.test(i);return{literal:!u,val:u?" ":i}}let s=t[n],o=n;n==="hour"&&(t.hour12!=null?o=t.hour12?"hour12":"hour24":t.hourCycle!=null?t.hourCycle==="h11"||t.hourCycle==="h12"?o="hour12":o="hour24":o=r.hour12?"hour12":"hour24");let a=KQe[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function XQe(e){return[`^${e.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,e]}function QQe(e,t,r){let n=e.match(t);if(n){let i={},s=1;for(let o in r)if(Xp(r,o)){let a=r[o],u=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(s,s+u))),s+=u}return[n,i]}else return[n,{}]}function eet(e){let t=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return Ge(e.z)||(r=Pa.create(e.z)),Ge(e.Z)||(r||(r=new Zi(e.Z)),n=e.Z),Ge(e.q)||(e.M=(e.q-1)*3+1),Ge(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),Ge(e.u)||(e.S=oF(e.u)),[Object.keys(e).reduce((s,o)=>{let a=t(o);return a&&(s[a]=e[o]),s},{}),r,n]}var Dq=null;function tet(){return Dq||(Dq=vr.fromMillis(1555555555555)),Dq}function ret(e,t){if(e.literal)return e;let r=qi.macroTokenToFormatOpts(e.val),n=Kce(r,t);return n==null||n.includes(void 0)?e:n}function Jce(e,t){return Array.prototype.concat(...e.map(r=>ret(r,t)))}var oT=class{constructor(t,r){if(this.locale=t,this.format=r,this.tokens=Jce(qi.parseFormat(r),t),this.units=this.tokens.map(n=>GQe(n,t)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,i]=XQe(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(t){if(this.isValid){let[r,n]=QQe(t,this.regex,this.handlers),[i,s,o]=n?eet(n):[null,null,void 0];if(Xp(n,"a")&&Xp(n,"H"))throw new Xu("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:i,zone:s,specificOffset:o}}else return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Gce(e,t,r){return new oT(e,r).explainFromTokens(t)}function net(e,t,r){let{result:n,zone:i,specificOffset:s,invalidReason:o}=Gce(e,t,r);return[n,i,s,o]}function Kce(e,t){if(!e)return null;let n=qi.create(t,e).dtFormatter(tet()),i=n.formatToParts(),s=n.resolvedOptions();return i.map(o=>YQe(o,e,s))}var jq="Invalid DateTime",Wle=864e13;function A_(e){return new Fi("unsupported zone",`the zone "${e.name}" is not supported`)}function zq(e){return e.weekData===null&&(e.weekData=nT(e.c)),e.weekData}function Mq(e){return e.localWeekData===null&&(e.localWeekData=nT(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Nc(e,t){let r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new vr({...r,...t,old:r})}function Yce(e,t,r){let n=e-t*60*1e3,i=r.offset(n);if(t===i)return[n,t];n-=(i-t)*60*1e3;let s=r.offset(n);return i===s?[n,i]:[e-Math.min(i,s)*60*1e3,Math.max(i,s)]}function GE(e,t){e+=t*60*1e3;let r=new Date(e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function YE(e,t,r){return Yce(uT(e),t,r)}function Jle(e,t){let r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,s={...e.c,year:n,month:i,day:Math.min(e.c.day,iT(n,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=en.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),a=uT(s),[u,l]=Yce(a,r,e.zone);return o!==0&&(u+=o,l=e.zone.offset(u)),{ts:u,o:l}}function Gp(e,t,r,n,i,s){let{setZone:o,zone:a}=r;if(e&&Object.keys(e).length!==0||t){let u=t||a,l=vr.fromObject(e,{...r,zone:u,specificOffset:s});return o?l:l.setZone(a)}else return vr.invalid(new Fi("unparsable",`the input "${i}" can't be parsed as ${n}`))}function KE(e,t,r=!0){return e.isValid?qi.create(rr.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Lq(e,t,r){let n=e.c.year>9999||e.c.year<0,i="";if(n&&e.c.year>=0&&(i+="+"),i+=Gr(e.c.year,n?6:4),r==="year")return i;if(t){if(i+="-",i+=Gr(e.c.month),r==="month")return i;i+="-"}else if(i+=Gr(e.c.month),r==="month")return i;return i+=Gr(e.c.day),i}function Gle(e,t,r,n,i,s,o){let a=!r||e.c.millisecond!==0||e.c.second!==0,u="";switch(o){case"day":case"month":case"year":break;default:if(u+=Gr(e.c.hour),o==="hour")break;if(t){if(u+=":",u+=Gr(e.c.minute),o==="minute")break;a&&(u+=":",u+=Gr(e.c.second))}else{if(u+=Gr(e.c.minute),o==="minute")break;a&&(u+=Gr(e.c.second))}if(o==="second")break;a&&(!n||e.c.millisecond!==0)&&(u+=".",u+=Gr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!s?u+="Z":e.o<0?(u+="-",u+=Gr(Math.trunc(-e.o/60)),u+=":",u+=Gr(Math.trunc(-e.o%60))):(u+="+",u+=Gr(Math.trunc(e.o/60)),u+=":",u+=Gr(Math.trunc(e.o%60)))),s&&(u+="["+e.zone.ianaName+"]"),u}var Xce={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},iet={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},set={ordinal:1,hour:0,minute:0,second:0,millisecond:0},XE=["year","month","day","hour","minute","second","millisecond"],oet=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],aet=["year","ordinal","hour","minute","second","millisecond"];function QE(e){let t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new eT(e);return t}function Kle(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return QE(e)}}function uet(e){if(D_===void 0&&(D_=mr.now()),e.type!=="iana")return e.offset(D_);let t=e.name,r=rF.get(t);return r===void 0&&(r=e.offset(D_),rF.set(t,r)),r}function Yle(e,t){let r=Yu(t.zone,mr.defaultZone);if(!r.isValid)return vr.invalid(A_(r));let n=rr.fromObject(t),i,s;if(Ge(e.year))i=mr.now();else{for(let u of XE)Ge(e[u])&&(e[u]=Xce[u]);let o=$ce(e)||Ece(e);if(o)return vr.invalid(o);let a=uet(r);[i,s]=YE(e,a,r)}return new vr({ts:i,zone:r,loc:n,o:s})}function Xle(e,t,r){let n=Ge(r.round)?!0:r.round,i=Ge(r.rounding)?"trunc":r.rounding,s=(a,u)=>(a=aF(a,n||r.calendary?0:2,r.calendary?"round":i),t.loc.clone(r).relFormatter(r).format(a,u)),o=a=>r.calendary?t.hasSame(e,a)?0:t.startOf(a).diff(e.startOf(a),a).get(a):t.diff(e,a).get(a);if(r.unit)return s(o(r.unit),r.unit);for(let a of r.units){let u=o(a);if(Math.abs(u)>=1)return s(u,a)}return s(e>t?-0:0,r.units[r.units.length-1])}function Qle(e){let t={},r;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],r=Array.from(e).slice(0,e.length-1)):r=Array.from(e),[t,r]}var D_,rF=new Map,vr=class e{constructor(t){let r=t.zone||mr.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new Fi("invalid input"):null)||(r.isValid?null:A_(r));this.ts=Ge(t.ts)?mr.now():t.ts;let i=null,s=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(r))[i,s]=[t.old.c,t.old.o];else{let a=Qu(t.o)&&!t.old?t.o:r.offset(this.ts);i=GE(this.ts,a),n=Number.isNaN(i.year)?new Fi("invalid input"):null,i=n?null:i,s=n?null:a}this._zone=r,this.loc=t.loc||rr.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[t,r]=Qle(arguments),[n,i,s,o,a,u,l]=r;return Yle({year:n,month:i,day:s,hour:o,minute:a,second:u,millisecond:l},t)}static utc(){let[t,r]=Qle(arguments),[n,i,s,o,a,u,l]=r;return t.zone=Zi.utcInstance,Yle({year:n,month:i,day:s,hour:o,minute:a,second:u,millisecond:l},t)}static fromJSDate(t,r={}){let n=qXe(t)?t.valueOf():NaN;if(Number.isNaN(n))return e.invalid("invalid input");let i=Yu(r.zone,mr.defaultZone);return i.isValid?new e({ts:n,zone:i,loc:rr.fromObject(r)}):e.invalid(A_(i))}static fromMillis(t,r={}){if(Qu(t))return t<-Wle||t>Wle?e.invalid("Timestamp out of range"):new e({ts:t,zone:Yu(r.zone,mr.defaultZone),loc:rr.fromObject(r)});throw new ln(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,r={}){if(Qu(t))return new e({ts:t*1e3,zone:Yu(r.zone,mr.defaultZone),loc:rr.fromObject(r)});throw new ln("fromSeconds requires a numerical input")}static fromObject(t,r={}){t=t||{};let n=Yu(r.zone,mr.defaultZone);if(!n.isValid)return e.invalid(A_(n));let i=rr.fromObject(r),s=sT(t,Kle),{minDaysInFirstWeek:o,startOfWeek:a}=jle(s,i),u=mr.now(),l=Ge(r.specificOffset)?n.offset(u):r.specificOffset,c=!Ge(s.ordinal),d=!Ge(s.year),p=!Ge(s.month)||!Ge(s.day),f=d||p,h=s.weekYear||s.weekNumber;if((f||c)&&h)throw new Xu("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&c)throw new Xu("Can't mix ordinal dates with month/day");let v=h||s.weekday&&!f,y,_,b=GE(u,l);v?(y=oet,_=iet,b=nT(b,o,a)):c?(y=aet,_=set,b=Aq(b)):(y=XE,_=Xce);let g=!1;for(let E of y){let P=s[E];Ge(P)?g?s[E]=_[E]:s[E]=b[E]:g=!0}let m=v?zXe(s,o,a):c?MXe(s):$ce(s),S=m||Ece(s);if(S)return e.invalid(S);let w=v?Ale(s,o,a):c?Dle(s):s,[k,x]=YE(w,l,n),R=new e({ts:k,zone:n,o:x,loc:i});return s.weekday&&f&&t.weekday!==R.weekday?e.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${R.toISO()}`):R.isValid?R:e.invalid(R.invalid)}static fromISO(t,r={}){let[n,i]=PQe(t);return Gp(n,i,r,"ISO 8601",t)}static fromRFC2822(t,r={}){let[n,i]=IQe(t);return Gp(n,i,r,"RFC 2822",t)}static fromHTTP(t,r={}){let[n,i]=OQe(t);return Gp(n,i,r,"HTTP",r)}static fromFormat(t,r,n={}){if(Ge(t)||Ge(r))throw new ln("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,u,l,c]=net(o,t,r);return c?e.invalid(c):Gp(a,u,n,`format ${r}`,t,l)}static fromString(t,r,n={}){return e.fromFormat(t,r,n)}static fromSQL(t,r={}){let[n,i]=MQe(t);return Gp(n,i,r,"SQL",t)}static invalid(t,r=null){if(!t)throw new ln("need to specify a reason the DateTime is invalid");let n=t instanceof Fi?t:new Fi(t,r);if(mr.throwOnInvalid)throw new qq(n);return new e({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,r={}){let n=Kce(t,rr.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(t,r={}){return Jce(qi.parseFormat(t),rr.fromObject(r)).map(i=>i.val).join("")}static resetCache(){D_=void 0,rF.clear()}get(t){return this[t]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?zq(this).weekYear:NaN}get weekNumber(){return this.isValid?zq(this).weekNumber:NaN}get weekday(){return this.isValid?zq(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Mq(this).weekday:NaN}get localWeekNumber(){return this.isValid?Mq(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Mq(this).weekYear:NaN}get ordinal(){return this.isValid?Aq(this.c).ordinal:NaN}get monthShort(){return this.isValid?Dc.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Dc.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Dc.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Dc.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let t=864e5,r=6e4,n=uT(this.c),i=this.zone.offset(n-t),s=this.zone.offset(n+t),o=this.zone.offset(n-i*r),a=this.zone.offset(n-s*r);if(o===a)return[this];let u=n-o*r,l=n-a*r,c=GE(u,o),d=GE(l,a);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Nc(this,{ts:u}),Nc(this,{ts:l})]:[this]}get isInLeapYear(){return L_(this.year)}get daysInMonth(){return iT(this.year,this.month)}get daysInYear(){return this.isValid?Kp(this.year):NaN}get weeksInWeekYear(){return this.isValid?M_(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?M_(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){let{locale:r,numberingSystem:n,calendar:i}=qi.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(t=0,r={}){return this.setZone(Zi.instance(t),r)}toLocal(){return this.setZone(mr.defaultZone)}setZone(t,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(t=Yu(t,mr.defaultZone),t.equals(this.zone))return this;if(t.isValid){let i=this.ts;if(r||n){let s=t.offset(this.ts),o=this.toObject();[i]=YE(o,s,t)}return Nc(this,{ts:i,zone:t})}else return e.invalid(A_(t))}reconfigure({locale:t,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:t,numberingSystem:r,outputCalendar:n});return Nc(this,{loc:i})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;let r=sT(t,Kle),{minDaysInFirstWeek:n,startOfWeek:i}=jle(r,this.loc),s=!Ge(r.weekYear)||!Ge(r.weekNumber)||!Ge(r.weekday),o=!Ge(r.ordinal),a=!Ge(r.year),u=!Ge(r.month)||!Ge(r.day),l=a||u,c=r.weekYear||r.weekNumber;if((l||o)&&c)throw new Xu("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&o)throw new Xu("Can't mix ordinal dates with month/day");let d;s?d=Ale({...nT(this.c,n,i),...r},n,i):Ge(r.ordinal)?(d={...this.toObject(),...r},Ge(r.day)&&(d.day=Math.min(iT(d.year,d.month),d.day))):d=Dle({...Aq(this.c),...r});let[p,f]=YE(d,this.o,this.zone);return Nc(this,{ts:p,o:f})}plus(t){if(!this.isValid)return this;let r=en.fromDurationLike(t);return Nc(this,Jle(this,r))}minus(t){if(!this.isValid)return this;let r=en.fromDurationLike(t).negate();return Nc(this,Jle(this,r))}startOf(t,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=en.normalizeUnit(t);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(r){let s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(n.weekNumber=this.weekNumber-1),n.weekday=s}else n.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);n.month=(s-1)*3+1}return this.set(n)}endOf(t,r){return this.isValid?this.plus({[t]:1}).startOf(t,r).minus(1):this}toFormat(t,r={}){return this.isValid?qi.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,t):jq}toLocaleString(t=tT,r={}){return this.isValid?qi.create(this.loc.clone(r),t).formatDateTime(this):jq}toLocaleParts(t={}){return this.isValid?qi.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=QE(o);let a=t==="extended",u=Lq(this,a,o);return XE.indexOf(o)>=3&&(u+="T"),u+=Gle(this,a,r,n,i,s,o),u}toISODate({format:t="extended",precision:r="day"}={}){return this.isValid?Lq(this,t==="extended",QE(r)):null}toISOWeekDate(){return KE(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=QE(a),(i&&XE.indexOf(a)>=3?"T":"")+Gle(this,o==="extended",r,t,n,s,a)):null}toRFC2822(){return KE(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return KE(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Lq(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||t)&&(n&&(i+=" "),r?i+="z":t&&(i+="ZZ")),KE(this,i,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():jq}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};let r={...this.c};return t.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,r="milliseconds",n={}){if(!this.isValid||!t.isValid)return en.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=FXe(r).map(en.normalizeUnit),o=t.valueOf()>this.valueOf(),a=o?this:t,u=o?t:this,l=VQe(a,u,s,i);return o?l.negate():l}diffNow(t="milliseconds",r={}){return this.diff(e.now(),t,r)}until(t){return this.isValid?jc.fromDateTimes(this,t):this}hasSame(t,r,n){if(!this.isValid)return!1;let i=t.valueOf(),s=this.setZone(t.zone,{keepLocalTime:!0});return s.startOf(r,n)<=i&&i<=s.endOf(r,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;let r=t.base||e.fromObject({},{zone:this.zone}),n=t.padding?this<r?-t.padding:t.padding:0,i=["years","months","days","hours","minutes","seconds"],s=t.unit;return Array.isArray(t.unit)&&(i=t.unit,s=void 0),Xle(r,this.plus(n),{...t,numeric:"always",units:i,unit:s})}toRelativeCalendar(t={}){return this.isValid?Xle(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new ln("min requires all arguments be DateTimes");return zle(t,r=>r.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new ln("max requires all arguments be DateTimes");return zle(t,r=>r.valueOf(),Math.max)}static fromFormatExplain(t,r,n={}){let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Gce(o,t,r)}static fromStringExplain(t,r,n={}){return e.fromFormatExplain(t,r,n)}static buildFormatParser(t,r={}){let{locale:n=null,numberingSystem:i=null}=r,s=rr.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new oT(s,t)}static fromFormatParser(t,r,n={}){if(Ge(t)||Ge(r))throw new ln("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=n,o=rr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(r.locale))throw new ln(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${r.locale}`);let{result:a,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(t);return c?e.invalid(c):Gp(a,u,n,`format ${r.format}`,t,l)}static get DATE_SHORT(){return tT}static get DATE_MED(){return ece}static get DATE_MED_WITH_WEEKDAY(){return _Xe}static get DATE_FULL(){return tce}static get DATE_HUGE(){return rce}static get TIME_SIMPLE(){return nce}static get TIME_WITH_SECONDS(){return ice}static get TIME_WITH_SHORT_OFFSET(){return sce}static get TIME_WITH_LONG_OFFSET(){return oce}static get TIME_24_SIMPLE(){return ace}static get TIME_24_WITH_SECONDS(){return uce}static get TIME_24_WITH_SHORT_OFFSET(){return lce}static get TIME_24_WITH_LONG_OFFSET(){return cce}static get DATETIME_SHORT(){return dce}static get DATETIME_SHORT_WITH_SECONDS(){return fce}static get DATETIME_MED(){return pce}static get DATETIME_MED_WITH_SECONDS(){return hce}static get DATETIME_MED_WITH_WEEKDAY(){return vXe}static get DATETIME_FULL(){return mce}static get DATETIME_FULL_WITH_SECONDS(){return gce}static get DATETIME_HUGE(){return yce}static get DATETIME_HUGE_WITH_SECONDS(){return _ce}};function C_(e){if(vr.isDateTime(e))return e;if(e&&e.valueOf&&Qu(e.valueOf()))return vr.fromJSDate(e);if(e&&typeof e=="object")return vr.fromObject(e);throw new ln(`Unknown datetime argument: ${e}, of type ${typeof e}`)}var cet="3.7.2";Vi.DateTime=vr;Vi.Duration=en;Vi.FixedOffsetZone=Zi;Vi.IANAZone=Pa;Vi.Info=Dc;Vi.Interval=jc;Vi.InvalidZone=rT;Vi.Settings=mr;Vi.SystemZone=z_;Vi.VERSION=cet;Vi.Zone=el});var pT=T(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.CronDate=ri.DAYS_IN_MONTH=ri.DateMathOp=ri.TimeUnit=void 0;var zc=Qce(),Un;(function(e){e.Second="Second",e.Minute="Minute",e.Hour="Hour",e.Day="Day",e.Month="Month",e.Year="Year"})(Un||(ri.TimeUnit=Un={}));var dT;(function(e){e.Add="Add",e.Subtract="Subtract"})(dT||(ri.DateMathOp=dT={}));ri.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var fT=class e{#e;#r=null;#i=null;#n={add:{[Un.Year]:this.addYear.bind(this),[Un.Month]:this.addMonth.bind(this),[Un.Day]:this.addDay.bind(this),[Un.Hour]:this.addHour.bind(this),[Un.Minute]:this.addMinute.bind(this),[Un.Second]:this.addSecond.bind(this)},subtract:{[Un.Year]:this.subtractYear.bind(this),[Un.Month]:this.subtractMonth.bind(this),[Un.Day]:this.subtractDay.bind(this),[Un.Hour]:this.subtractHour.bind(this),[Un.Minute]:this.subtractMinute.bind(this),[Un.Second]:this.subtractSecond.bind(this)}};constructor(t,r){let n={zone:r};if(t?t instanceof e?(this.#e=t.#e,this.#r=t.#r,this.#i=t.#i):t instanceof Date?this.#e=zc.DateTime.fromJSDate(t,n):typeof t=="number"?this.#e=zc.DateTime.fromMillis(t,n):(this.#e=zc.DateTime.fromISO(t,n),this.#e.isValid||(this.#e=zc.DateTime.fromRFC2822(t,n)),this.#e.isValid||(this.#e=zc.DateTime.fromSQL(t,n)),this.#e.isValid||(this.#e=zc.DateTime.fromFormat(t,"EEE, d MMM yyyy HH:mm:ss",n))):this.#e=zc.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${t}`);r&&r!==this.#e.zoneName&&(this.#e=this.#e.setZone(r))}static#s(t){return t%4===0&&t%100!==0||t%400===0}get dstStart(){return this.#r}set dstStart(t){this.#r=t}get dstEnd(){return this.#i}set dstEnd(t){this.#i=t}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(t){this.#n.add[t]()}subtractUnit(t){this.#n.subtract[t]()}invokeDateOperation(t,r){if(t===dT.Add){this.addUnit(r);return}if(t===dT.Subtract){this.subtractUnit(r);return}throw new Error(`Invalid verb: ${t}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let t=this.#e.weekday;return t===7?0:t}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#t().day}getUTCFullYear(){return this.#t().year}getUTCDay(){let t=this.#t().weekday;return t===7?0:t}getUTCMonth(){return this.#t().month-1}getUTCHours(){return this.#t().hour}getUTCMinutes(){return this.#t().minute}getUTCSeconds(){return this.#t().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(t){this.#e=this.#e.set({day:t})}setFullYear(t){this.#e=this.#e.set({year:t})}setDay(t){this.#e=this.#e.set({weekday:t})}setMonth(t){this.#e=this.#e.set({month:t+1})}setHours(t){this.#e=this.#e.set({hour:t})}setMinutes(t){this.#e=this.#e.set({minute:t})}setSeconds(t){this.#e=this.#e.set({second:t})}setMilliseconds(t){this.#e=this.#e.set({millisecond:t})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:t,month:r}=this.#e;if(r===2){let n=e.#s(this.#e.year);return t===ri.DAYS_IN_MONTH[r-1]-(n?0:1)}return t===ri.DAYS_IN_MONTH[r-1]}isLastWeekdayOfMonth(){let{day:t,month:r}=this.#e,n;return r===2?n=ri.DAYS_IN_MONTH[r-1]-(e.#s(this.#e.year)?0:1):n=ri.DAYS_IN_MONTH[r-1],t>n-7}applyDateOperation(t,r,n){if(r===Un.Month||r===Un.Day){this.invokeDateOperation(t,r);return}let i=this.getHours();this.invokeDateOperation(t,r);let s=this.getHours(),o=s-i;o===2?n!==24&&(this.dstStart=s):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&n!==24&&(this.dstEnd=s)}#t(){return this.#e.toUTC()}};ri.CronDate=fT;ri.default=fT});var ede=T(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.CronMonth=void 0;var det=pT(),fet=Gu(),pet=1,het=12,met=Object.freeze([]),dF=class extends fet.CronField{static get min(){return pet}static get max(){return het}static get chars(){return met}static get daysInMonth(){return det.DAYS_IN_MONTH}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};hT.CronMonth=dF});var tde=T(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.CronSecond=void 0;var get=Gu(),yet=0,_et=59,vet=Object.freeze([]),fF=class extends get.CronField{static get min(){return yet}static get max(){return _et}static get chars(){return vet}constructor(t,r){super(t,r),this.validate()}get values(){return super.values}};mT.CronSecond=fF});var gT=T(Ei=>{"use strict";var bet=Ei&&Ei.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),tl=Ei&&Ei.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&bet(t,e,r)};Object.defineProperty(Ei,"__esModule",{value:!0});tl(vle(),Ei);tl(ble(),Ei);tl(wle(),Ei);tl(Gu(),Ei);tl(Sle(),Ei);tl(kle(),Ei);tl(ede(),Ei);tl(tde(),Ei)});var hF=T(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.CronFieldCollection=void 0;var $s=gT(),pF=class e{#e;#r;#i;#n;#s;#t;static from(t,r){return new e({second:this.resolveField($s.CronSecond,t.second,r.second),minute:this.resolveField($s.CronMinute,t.minute,r.minute),hour:this.resolveField($s.CronHour,t.hour,r.hour),dayOfMonth:this.resolveField($s.CronDayOfMonth,t.dayOfMonth,r.dayOfMonth),month:this.resolveField($s.CronMonth,t.month,r.month),dayOfWeek:this.resolveField($s.CronDayOfWeek,t.dayOfWeek,r.dayOfWeek)})}static resolveField(t,r,n){return n?n instanceof $s.CronField?n:new t(n):r}constructor({second:t,minute:r,hour:n,dayOfMonth:i,month:s,dayOfWeek:o}){if(!t)throw new Error("Validation error, Field second is missing");if(!r)throw new Error("Validation error, Field minute is missing");if(!n)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!o)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=$s.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=t,this.#r=r,this.#i=n,this.#s=s,this.#t=o,this.#n=i}get second(){return this.#e}get minute(){return this.#r}get hour(){return this.#i}get dayOfMonth(){return this.#n}get month(){return this.#s}get dayOfWeek(){return this.#t}static compactField(t){if(t.length===0)return[];let r=[],n;return t.forEach((i,s,o)=>{if(n===void 0){n={start:i,count:1};return}let a=o[s-1]||n.start,u=o[s+1];if(i==="L"||i==="W"){r.push(n),r.push({start:i,count:1}),n=void 0;return}if(n.step===void 0&&u!==void 0){let l=i-a,c=u-i;if(l<=c){n={...n,count:2,end:i,step:l};return}n.step=1}i-(n.end??0)===n.step?(n.count++,n.end=i):(n.count===1?r.push({start:n.start,count:1}):n.count===2?(r.push({start:n.start,count:1}),r.push({start:n.end??a,count:1})):r.push(n),n={start:i,count:1})}),n&&r.push(n),r}static#u(t,r,n){let i=r.step;return i?i===1&&r.start===t.min&&r.end&&r.end>=n?t.hasQuestionMarkChar?"?":"*":i!==1&&r.start===t.min&&r.end&&r.end>=n-i+1?`*/${i}`:null:null}static#l(t,r){let n=t.step;if(n===1)return`${t.start}-${t.end}`;let i=t.start===0?t.count-1:t.count;if(!n)throw new Error("Unexpected range step");if(!t.end)throw new Error("Unexpected range end");if(n*i>t.end){let s=(a,u)=>{if(typeof t.start!="number")throw new Error("Unexpected range start");return u%n===0?t.start+u:null};if(typeof t.start!="number")throw new Error("Unexpected range start");let o={length:t.end-t.start+1};return Array.from(o,s).filter(a=>a!==null).join(",")}return t.end===r-n+1?`${t.start}/${n}`:`${t.start}-${t.end}/${n}`}stringifyField(t){let r=t.max,n=t.values;if(t instanceof $s.CronDayOfWeek){r=6;let s=this.#t.values;n=s[s.length-1]===7?s.slice(0,-1):s}t instanceof $s.CronDayOfMonth&&(r=this.#s.values.length===1?$s.CronMonth.daysInMonth[this.#s.values[0]-1]:t.max);let i=e.compactField(n);if(i.length===1){let s=e.#u(t,i[0],r);if(s)return s}return i.map(s=>{let o=s.count===1?s.start.toString():e.#l(s,r);return t instanceof $s.CronDayOfWeek&&t.nthDay>0?`${o}#${t.nthDay}`:o}).join(",")}stringify(t=!1){let r=[];return t&&r.push(this.stringifyField(this.#e)),r.push(this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#n),this.stringifyField(this.#s),this.stringifyField(this.#t)),r.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#r.serialize(),hour:this.#i.serialize(),dayOfMonth:this.#n.serialize(),month:this.#s.serialize(),dayOfWeek:this.#t.serialize()}}};yT.CronFieldCollection=pF});var mF=T(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.CronExpression=Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var zr=pT();Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range";Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";var rde=1e4,_T=class e{#e;#r;#i;#n;#s;#t;#u=null;#l=!1;constructor(t,r){this.#e=r,this.#r=r.tz,this.#n=r.startDate?new zr.CronDate(r.startDate,this.#r):null,this.#s=r.endDate?new zr.CronDate(r.endDate,this.#r):null;let n=r.currentDate??r.startDate;if(n){let i=new zr.CronDate(n,this.#r);this.#n&&i.getTime()<this.#n.getTime()?n=this.#n:this.#s&&i.getTime()>this.#s.getTime()&&(n=this.#s)}this.#i=new zr.CronDate(n,this.#r),this.#t=t}get fields(){return this.#t}static fieldsToExpression(t,r){return new e(t,r||{})}static#o(t,r){return r.some(n=>n===t)}#a(t,r){return t[r?t.length-1:0]}#c(t){let r=`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`;if(this.#u===r)return this.#l;let n=new zr.CronDate(t);n.setStartOfDay();let i=new zr.CronDate(t);return i.setEndOfDay(),this.#u=r,this.#l=n.getUTCOffset()!==i.getUTCOffset(),this.#l}#d(t,r,n){let i=this.#t.second.values,s=t.getSeconds(),o=this.#t.second.findNearestValue(s,n);if(o!==null){t.setSeconds(o);return}t.applyDateOperation(r,zr.TimeUnit.Minute,this.#t.hour.values.length),t.setSeconds(this.#a(i,n))}#h(t,r,n){let i=this.#t.minute.values,s=this.#t.second.values,o=t.getMinutes(),a=this.#t.minute.findNearestValue(o,n);if(a!==null){t.setMinutes(a),t.setSeconds(this.#a(s,n));return}t.applyDateOperation(r,zr.TimeUnit.Hour,this.#t.hour.values.length),t.setMinutes(this.#a(i,n)),t.setSeconds(this.#a(s,n))}static#m(t,r){let n=r.isLastWeekdayOfMonth();return t.some(i=>{let s=parseInt(i.toString().charAt(0),10)%7;if(Number.isNaN(s))throw new Error(`Invalid last weekday of the month expression: ${i}`);return r.getDay()===s&&n})}next(){return this.#f()}prev(){return this.#f(!0)}hasNext(){let t=this.#i;try{return this.#f(),!0}catch{return!1}finally{this.#i=t}}hasPrev(){let t=this.#i;try{return this.#f(!0),!0}catch{return!1}finally{this.#i=t}}take(t){let r=[];if(t>=0)for(let n=0;n<t;n++)try{r.push(this.next())}catch{return r}else for(let n=0;n>t;n--)try{r.push(this.prev())}catch{return r}return r}reset(t){this.#i=new zr.CronDate(t||this.#e.currentDate)}stringify(t=!1){return this.#t.stringify(t)}includesDate(t){let{second:r,minute:n,hour:i,month:s}=this.#t,o=new zr.CronDate(t,this.#r);return!(!r.values.includes(o.getSeconds())||!n.values.includes(o.getMinutes())||!i.values.includes(o.getHours())||!s.values.includes(o.getMonth()+1)||!this.#p(o)||this.#t.dayOfWeek.nthDay>0&&Math.ceil(o.getDate()/7)!==this.#t.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#p(t){let r=this.#t.dayOfMonth.isWildcard,n=!r,i=this.#t.dayOfWeek.isWildcard,s=!i,o=e.#o(t.getDate(),this.#t.dayOfMonth.values)||this.#t.dayOfMonth.hasLastChar&&t.isLastDayOfMonth(),a=e.#o(t.getDay(),this.#t.dayOfWeek.values)||this.#t.dayOfWeek.hasLastChar&&e.#m(this.#t.dayOfWeek.values,t);return!!(n&&s&&(o||a)||o&&!s||r&&!i&&a)}#g(t,r,n){let i=this.#t.hour.values,s=i,o=t.getHours(),a=e.#o(o,i),u=t.dstStart===o,l=t.dstEnd===o;if(u)return e.#o(o-1,i)?!0:(t.invokeDateOperation(r,zr.TimeUnit.Hour),!1);if(l&&!n)return t.dstEnd=null,t.applyDateOperation(zr.DateMathOp.Add,zr.TimeUnit.Hour,s.length),!1;if(a)return!0;t.dstStart=null;let c=this.#t.hour.findNearestValue(o,n);if(c===null)return t.applyDateOperation(r,zr.TimeUnit.Day,s.length),!1;if(this.#c(t)){let d=n?o-c:c-o;for(let p=0;p<d;p++)t.applyDateOperation(r,zr.TimeUnit.Hour,s.length)}else t.setHours(c);return t.setMinutes(this.#a(this.#t.minute.values,n)),t.setSeconds(this.#a(this.#t.second.values,n)),!1}#y(t){if(!this.#n&&!this.#s)return;let r=t.getTime();if(this.#n&&r<this.#n.getTime())throw new Error(Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#s&&r>this.#s.getTime())throw new Error(Es.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#f(t=!1){let r=t?zr.DateMathOp.Subtract:zr.DateMathOp.Add,n=new zr.CronDate(this.#i),i=n.getTime(),s=0;for(;++s<rde;){if(this.#y(n),!this.#p(n)){n.applyDateOperation(r,zr.TimeUnit.Day,this.#t.hour.values.length);continue}if(!(this.#t.dayOfWeek.nthDay<=0||Math.ceil(n.getDate()/7)===this.#t.dayOfWeek.nthDay)){n.applyDateOperation(r,zr.TimeUnit.Day,this.#t.hour.values.length);continue}if(!e.#o(n.getMonth()+1,this.#t.month.values)){n.applyDateOperation(r,zr.TimeUnit.Month,this.#t.hour.values.length);continue}if(this.#g(n,r,t)){if(!e.#o(n.getMinutes(),this.#t.minute.values)){this.#h(n,r,t);continue}if(!e.#o(n.getSeconds(),this.#t.second.values)){this.#d(n,r,t);continue}if(i===n.getTime()){(r==="Add"||n.getMilliseconds()===0)&&n.applyDateOperation(r,zr.TimeUnit.Second,this.#t.hour.values.length);continue}break}}if(s>rde)throw new Error(Es.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return n.getMilliseconds()!==0&&n.setMilliseconds(0),this.#i=n,n}[Symbol.iterator](){return{next:()=>({value:this.#f(),done:!this.hasNext()})}}};Es.CronExpression=_T;Es.default=_T});var nde=T(gF=>{"use strict";Object.defineProperty(gF,"__esModule",{value:!0});gF.seededRandom=xet;function wet(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return()=>t>>>0}function ket(e){return()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function xet(e){let t=e?wet(e)():Math.floor(Math.random()*1e10);return ket(t)}});var vT=T(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.CronExpressionParser=Ps.DayOfWeek=Ps.Months=Ps.CronUnit=Ps.PredefinedExpressions=void 0;var $et=hF(),Eet=mF(),Tet=nde(),Ts=gT(),yF;(function(e){e["@yearly"]="0 0 0 1 1 *",e["@annually"]="0 0 0 1 1 *",e["@monthly"]="0 0 0 1 * *",e["@weekly"]="0 0 0 * * 0",e["@daily"]="0 0 0 * * *",e["@hourly"]="0 0 * * * *",e["@minutely"]="0 * * * * *",e["@secondly"]="* * * * * *",e["@weekdays"]="0 0 0 * * 1-5",e["@weekends"]="0 0 0 * * 0,6"})(yF||(Ps.PredefinedExpressions=yF={}));var Rs;(function(e){e.Second="Second",e.Minute="Minute",e.Hour="Hour",e.DayOfMonth="DayOfMonth",e.Month="Month",e.DayOfWeek="DayOfWeek"})(Rs||(Ps.CronUnit=Rs={}));var _F;(function(e){e[e.jan=1]="jan",e[e.feb=2]="feb",e[e.mar=3]="mar",e[e.apr=4]="apr",e[e.may=5]="may",e[e.jun=6]="jun",e[e.jul=7]="jul",e[e.aug=8]="aug",e[e.sep=9]="sep",e[e.oct=10]="oct",e[e.nov=11]="nov",e[e.dec=12]="dec"})(_F||(Ps.Months=_F={}));var vF;(function(e){e[e.sun=0]="sun",e[e.mon=1]="mon",e[e.tue=2]="tue",e[e.wed=3]="wed",e[e.thu=4]="thu",e[e.fri=5]="fri",e[e.sat=6]="sat"})(vF||(Ps.DayOfWeek=vF={}));var bF=class e{static parse(t,r={}){let{strict:n=!1,hashSeed:i}=r,s=(0,Tet.seededRandom)(i);t=yF[t]||t;let o=e.#e(t,n);if(!(o.dayOfMonth==="*"||o.dayOfWeek==="*"||!n))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");let a=e.#r(Rs.Second,o.second,Ts.CronSecond.constraints,s),u=e.#r(Rs.Minute,o.minute,Ts.CronMinute.constraints,s),l=e.#r(Rs.Hour,o.hour,Ts.CronHour.constraints,s),c=e.#r(Rs.Month,o.month,Ts.CronMonth.constraints,s),d=e.#r(Rs.DayOfMonth,o.dayOfMonth,Ts.CronDayOfMonth.constraints,s),{dayOfWeek:p,nthDayOfWeek:f}=e.#c(o.dayOfWeek),h=e.#r(Rs.DayOfWeek,p,Ts.CronDayOfWeek.constraints,s),v=new $et.CronFieldCollection({second:new Ts.CronSecond(a,{rawValue:o.second}),minute:new Ts.CronMinute(u,{rawValue:o.minute}),hour:new Ts.CronHour(l,{rawValue:o.hour}),dayOfMonth:new Ts.CronDayOfMonth(d,{rawValue:o.dayOfMonth}),month:new Ts.CronMonth(c,{rawValue:o.month}),dayOfWeek:new Ts.CronDayOfWeek(h,{rawValue:o.dayOfWeek,nthDayOfWeek:f})});return new Eet.CronExpression(v,{...r,expression:t})}static#e(t,r){if(r&&!t.length)throw new Error("Invalid cron expression");t=t||"0 * * * * *";let n=t.trim().split(/\s+/);if(r&&n.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(n.length>6)throw new Error("Invalid cron expression, too many fields");let i=["*","*","*","*","*","0"];n.length<i.length&&n.unshift(...i.slice(n.length));let[s,o,a,u,l,c]=n;return{second:s,minute:o,hour:a,dayOfMonth:u,month:l,dayOfWeek:c}}static#r(t,r,n,i){if((t===Rs.Month||t===Rs.DayOfWeek)&&(r=r.replace(/[a-z]{3}/gi,s=>{s=s.toLowerCase();let o=_F[s]||vF[s];if(o===void 0)throw new Error(`Validation error, cannot resolve alias "${s}"`);return o.toString()})),!n.validChars.test(r))throw new Error(`Invalid characters, got value: ${r}`);return r=this.#i(r,n),r=this.#n(r,n,i),this.#s(t,r,n)}static#i(t,r){return t.replace(/[*?]/g,r.min+"-"+r.max)}static#n(t,r,n){let i=n();return t.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(s,o,a,u)=>{if(o&&a&&u){let l=parseInt(o,10),c=parseInt(a,10),d=parseInt(u,10);if(l>c)throw new Error(`Invalid range: ${l}-${c}, min > max`);if(d<=0)throw new Error(`Invalid step: ${d}, must be positive`);let p=Math.max(l,r.min),f=Math.floor(i*d),h=[];for(let v=Math.floor(p/d)*d+f;v<=c;v+=d)v>=p&&h.push(v);return h.join(",")}else if(o&&a){let l=parseInt(o,10),c=parseInt(a,10);if(l>c)throw new Error(`Invalid range: ${l}-${c}, min > max`);return String(Math.floor(i*(c-l+1))+l)}else if(u){let l=parseInt(u,10);if(l<=0)throw new Error(`Invalid step: ${l}, must be positive`);let c=Math.floor(i*l),d=[];for(let p=Math.floor(r.min/l)*l+c;p<=r.max;p+=l)p>=r.min&&d.push(p);return d.join(",")}else return String(Math.floor(i*(r.max-r.min+1)+r.min))})}static#s(t,r,n){let i=[];function s(a,u){if(Array.isArray(a))i.push(...a);else if(e.#d(u,a))i.push(a);else{let l=parseInt(a.toString(),10);if(!(l>=u.min&&l<=u.max))throw new Error(`Constraint error, got value ${a} expected range ${u.min}-${u.max}`);i.push(t===Rs.DayOfWeek?l%7:a)}}return r.split(",").forEach(a=>{if(!(a.length>0))throw new Error("Invalid list value format");s(e.#t(t,a,n),n)}),i}static#t(t,r,n){let i=r.split("/");if(i.length>2)throw new Error(`Invalid repeat: ${r}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${n.max}`),e.#a(t,i[0],parseInt(i[1],10),n)):e.#a(t,r,1,n)}static#u(t,r,n){if(!(!isNaN(t)&&!isNaN(r)&&t>=n.min&&r<=n.max))throw new Error(`Constraint error, got range ${t}-${r} expected range ${n.min}-${n.max}`);if(t>r)throw new Error(`Invalid range: ${t}-${r}, min(${t}) > max(${r})`)}static#l(t){if(!(!isNaN(t)&&t>0))throw new Error(`Constraint error, cannot repeat at every ${t} time.`)}static#o(t,r,n,i){let s=[];t===Rs.DayOfWeek&&n%7===0&&s.push(0);for(let o=r;o<=n;o+=i)s.indexOf(o)===-1&&s.push(o);return s}static#a(t,r,n,i){let s=r.split("-");if(s.length<=1)return isNaN(+r)?r:+r;let[o,a]=s.map(u=>parseInt(u,10));return this.#u(o,a,i),this.#l(n),this.#o(t,o,a,n)}static#c(t){let r=t.split("#");if(r.length<=1)return{dayOfWeek:r[0]};let n=+r[r.length-1],i=t.match(/([,-/])/);if(i!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${i?.[0]}\` special characters are incompatible`);if(!(r.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:r[0],nthDayOfWeek:n}}static#d(t,r){return t.chars.some(n=>r.toString().includes(n))}};Ps.CronExpressionParser=bF});var ide=T(Do=>{"use strict";var Ret=Do&&Do.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Pet=Do&&Do.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Iet=Do&&Do.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),i=0;i<n.length;i++)n[i]!=="default"&&Ret(r,t,n[i]);return Pet(r,t),r}})();Object.defineProperty(Do,"__esModule",{value:!0});Do.CronFileParser=void 0;var Oet=vT(),wF=class e{static async parseFile(t){let{readFile:r}=await Promise.resolve().then(()=>Iet(ie("fs/promises"))),n=await r(t,"utf8");return e.#e(n)}static parseFileSync(t){let{readFileSync:r}=ie("fs"),n=r(t,"utf8");return e.#e(n)}static#e(t){let r=t.split(`
673
+ `),n={variables:{},expressions:[],errors:{}};for(let i of r){let s=i.trim();if(s.length===0||s.startsWith("#"))continue;let o=s.match(/^(.*)=(.*)$/);if(o){let[,a,u]=o;n.variables[a]=u.replace(/["']/g,"");continue}try{let a=e.#r(s);n.expressions.push(a.interval)}catch(a){n.errors[s]=a}}return n}static#r(t){let r=t.split(" ");return{interval:Oet.CronExpressionParser.parse(r.slice(0,5).join(" ")),command:r.slice(5,r.length)}}};Do.CronFileParser=wF});var sde=T(cn=>{"use strict";var Cet=cn&&cn.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Net=cn&&cn.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Cet(t,e,r)};Object.defineProperty(cn,"__esModule",{value:!0});cn.CronFileParser=cn.CronExpressionParser=cn.CronExpression=cn.CronFieldCollection=cn.CronDate=void 0;var Aet=vT(),Det=pT();Object.defineProperty(cn,"CronDate",{enumerable:!0,get:function(){return Det.CronDate}});var jet=hF();Object.defineProperty(cn,"CronFieldCollection",{enumerable:!0,get:function(){return jet.CronFieldCollection}});var zet=mF();Object.defineProperty(cn,"CronExpression",{enumerable:!0,get:function(){return zet.CronExpression}});var Met=vT();Object.defineProperty(cn,"CronExpressionParser",{enumerable:!0,get:function(){return Met.CronExpressionParser}});var Let=ide();Object.defineProperty(cn,"CronFileParser",{enumerable:!0,get:function(){return Let.CronFileParser}});Net(gT(),cn);cn.default=Aet.CronExpressionParser});function ode(e){let t=e.match(/^(\d+)([smhdw])$/);if(!t)throw new Error(`Invalid duration format: ${e}`);let r=parseInt(t[1],10),n=t[2];switch(n){case"s":return r*1e3;case"m":return r*60*1e3;case"h":return r*60*60*1e3;case"d":return r*24*60*60*1e3;case"w":return r*7*24*60*60*1e3;default:throw new Error(`Unknown unit: ${n}`)}}function ade(e,t,r=new Date,n){let i=typeof n=="string"&&n.length>0?new Date(n).getTime():Number.NaN,s=Number.isFinite(i);if(e==="once")return t!==null?!1:s?r.getTime()>=i:!0;if(e.startsWith("@in ")){let o=e.substring(4).trim();try{let a=ode(o);return t!==null?!1:s?r.getTime()-i>=a:!0}catch{return!1}}if(e.startsWith("@every ")){let o=e.substring(7).trim();try{let a=ode(o);if(!t)return s?r.getTime()>=i:!0;let u=new Date(t).getTime();return r.getTime()-u>=a}catch{return!1}}try{if(!t)return s?bT.CronExpressionParser.parse(e,{currentDate:new Date(i),tz:"UTC"}).next().toDate().getTime()<=r.getTime():(bT.CronExpressionParser.parse(e,{currentDate:r,tz:"UTC"}),!0);let a=bT.CronExpressionParser.parse(e,{currentDate:new Date(t),tz:"UTC"}).next().toDate(),u=new Date(t).getTime();return Number.isNaN(u)?!0:a.getTime()<=r.getTime()}catch{return!1}}var bT,ude=L(()=>{"use strict";bT=ro(sde(),1)});var dde={};Kr(dde,{enqueueCadenceItem:()=>qet,markCadenceItemsDone:()=>Fet,mergeCadenceInbox:()=>lde,parseCadenceQueue:()=>cde,runCadenceTick:()=>Uet,scanAndSpawnDueJobs:()=>SF});import{promises as Mc}from"node:fs";import wT from"node:path";async function qet(e,t,r=new Date){await Me(e.cadenceInboxDir);let i=`${r.toISOString().replace(/[:.]/g,"-")}_${Math.random().toString(36).slice(2)}.pending`,s=wT.join(e.cadenceInboxDir,i);return await Bt(s,`${t.trim()}
674
674
  `),s}async function lde(e){let t=[],r=[];try{let o=await Mc.readdir(e.cadenceInboxDir,{withFileTypes:!0});t=o.filter(a=>a.isFile()&&a.name.endsWith(".pending")).map(a=>a.name).sort(),r=o.filter(a=>a.isFile()&&!a.name.endsWith(".pending")).map(a=>a.name).sort()}catch{return 0}if(r.length>0){for(let o of r)await Mc.unlink(wT.join(e.cadenceInboxDir,o));ot("[cadence] removed incompatible inbox files",{removed:r.length})}let n=await Mc.readFile(e.cadenceQueuePath,"utf8"),i=[],s=[];for(let o of t){let u=(await Mc.readFile(wT.join(e.cadenceInboxDir,o),"utf8")).trim();u&&i.push(u.startsWith("- [ ]")?u:`- [ ] ${u}`),s.push(o)}if(i.length>0){let o=Zet(n,i);await Bt(e.cadenceQueuePath,o)}if(s.length===0)return 0;for(let o of s)await Mc.unlink(wT.join(e.cadenceInboxDir,o));return i.length}async function cde(e){let t;try{t=await Mc.readFile(e.cadenceQueuePath,"utf8")}catch{return[]}return Vet(t).filter(n=>n.trim().startsWith("- [ ]"))}async function Fet(e,t){if(t.length===0)return;let n=(await Mc.readFile(e.cadenceQueuePath,"utf8")).split(`
675
675
  `).map(i=>i.trim().startsWith("- [ ]")&&t.includes(i.trim())?i.replace("- [ ]","- [x]"):i).join(`
676
676
  `);await Bt(e.cadenceQueuePath,`${n.replace(/\s+$/,"")}
677
- `)}async function Uet(e){await Jf(e),await lde(e);let t=await cde(e),r=Qt({type:"system.cadence_tick",source:{kind:"system",name:"cadence"},payload:{count:t.length}});return await er(e,r),await hu(e,"jobs",r.id,new Date(r.ts)),await ko(e,n=>({...n,cadence:{...n.cadence,last_tick:r.ts}}),new Date(r.ts)),{queueLength:t.length}}async function SF(e,t,r){let n=new cs(e);await n.init();let i=await n.listJobs(),s=r?.now??new Date,o=[];for(let a of i){if(!ade(a.frontmatter.cron,a.state.last_run_at,s,a.frontmatter.created_at))continue;let u=vf({jobId:a.id,ownerSession:a.frontmatter.owner_session,cron:a.frontmatter.cron,cwdRel:a.frontmatter.cwd_rel}),l=t.getActor(u);if(l&&l.status!=="ended"){yt("[cadence] skip due job: already running",{jobId:a.id,sessionKey:u,actorStatus:l.status});continue}let c=Qt({type:"job.spawn",source:{kind:"cadence",name:"job-scanner"},session_key:u,payload:{job_id:a.id,cron:a.frontmatter.cron,text:a.content.trim()}});await er(e,c);let d=`- [ ] @evt(${c.id}) job:${a.id}`;await Bl(e,u,d),t.spawnJobSession(a.id,u),o.push(a.id),ot("[cadence] spawned due job",{jobId:a.id,sessionKey:u,cron:a.frontmatter.cron})}return yt("[cadence] job scan complete",{scanned:i.length,spawned:o.length}),{scanned:i.length,spawned:o}}function Zet(e,t){let r=e.split(`
677
+ `)}async function Uet(e){await Jf(e),await lde(e);let t=await cde(e),r=Qt({type:"system.cadence_tick",source:{kind:"system",name:"cadence"},payload:{count:t.length}});return await er(e,r),await hu(e,"jobs",r.id,new Date(r.ts)),await ko(e,n=>({...n,cadence:{...n.cadence,last_tick:r.ts}}),new Date(r.ts)),{queueLength:t.length}}async function SF(e,t,r){let n=new cs(e);await n.init();let i=await n.listJobs(),s=r?.now??new Date,o=[];for(let a of i){let u=a.state.last_scheduled_at??a.state.last_run_at,l=a.frontmatter.cron;if((l==="once"||l.startsWith("@in "))&&a.state.last_scheduled_at&&!a.state.last_run_at&&a.state.run_count===0&&a.state.last_result==="unknown"&&(u=null),!ade(a.frontmatter.cron,u,s,a.frontmatter.created_at))continue;let d=vf({jobId:a.id,ownerSession:a.frontmatter.owner_session,cron:a.frontmatter.cron,cwdRel:a.frontmatter.cwd_rel}),p=t.getActor(d);if(p&&p.status!=="ended"){yt("[cadence] skip due job: already running",{jobId:a.id,sessionKey:d,actorStatus:p.status});continue}await n.updateState(a.id,{last_scheduled_at:s.toISOString()});let f=Qt({type:"job.spawn",source:{kind:"cadence",name:"job-scanner"},session_key:d,payload:{job_id:a.id,cron:a.frontmatter.cron,text:a.content.trim()}});await er(e,f);let h=`- [ ] @evt(${f.id}) job:${a.id}`;await Bl(e,d,h),t.spawnJobSession(a.id,d),o.push(a.id),ot("[cadence] spawned due job",{jobId:a.id,sessionKey:d,cron:a.frontmatter.cron})}return yt("[cadence] job scan complete",{scanned:i.length,spawned:o.length}),{scanned:i.length,spawned:o}}function Zet(e,t){let r=e.split(`
678
678
  `),n=r.findIndex(s=>s.trim()==="## Queue");n===-1&&(r.unshift("## Queue",""),n=0);let i=r.length;for(let s=n+1;s<r.length;s+=1){let o=r[s].trim();if(o.startsWith("## ")&&o!=="## Queue"){i=s;break}}return r.splice(i,0,...t.map(s=>s.trim())),`${r.join(`
679
679
  `).replace(/\s+$/,"")}
680
680
  `}function Vet(e){let t=e.split(`