@muxcodecli/cli 1.15.18 → 1.15.19

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.
@@ -0,0 +1,672 @@
1
+ // @bun
2
+ import{$l as F3,Vl as NC,Wl as OC,Xl as L1,Yl as g$,Zl as vY,_l as O6,am as $C,bm as ZC,cm as VQ,dm as yY,em as Gz,fm as QC,gm as lL,hm as _C,im as bR,jm as Uz,km as uz,lm as zz,mm as JM}from"./chunk-an9wvc2n.js";import{hn as R5,in as aH}from"./chunk-5jn2z3nf.js";import{Dn as N0,En as _1,Fn as a7,Gn as fM,fo as hM,sn as q1,tn as I1}from"./chunk-8cm9znxk.js";import{$o as G1,Aq as u5,Ar as k8,Bq as O1,Cq as m5,Dp as t$,Dq as L$,Lq as n5,Op as Y1,Pp as g5,Qp as BZ,Rp as p5,Vq as j7,Wr as qM,br as KA,dp as h0,ep as SM,fq as e5,go as LM,gq as x8,ho as RM,hq as xM,ir as NM,jr as kM,kr as S5,lr as OM,mr as jM,or as DM,qr as vM,rr as yM,sr as gM,tr as x5,ur as BA,vq as pM,vr as UA,wp as GA,xp as d5,xr as zA,yp as q7,zq as i5}from"./chunk-a0srn4ak.js";import{as as vA}from"./chunk-jfz77m78.js";import{cs as i8}from"./chunk-my9cfmvt.js";import{ts as JA,vs as _7,xs as WA}from"./chunk-8jy0dvcn.js";import{Xt as wA}from"./chunk-21x3anp4.js";import{Qu as SE}from"./chunk-fkmzj0qt.js";import{iv as $M}from"./chunk-eskw1cj2.js";import{AF as k,Dw as I7,Fx as T7,IF as u8,JE as TM,Yz as J1,eC as i,fz as lM,nC as t5,pE as IM}from"./chunk-1mqsg5s7.js";import{QF as d8,RF as I,SF as K$,UF as u}from"./chunk-8j3aw4qg.js";var XW=I((QW,YZ)=>{(($,Z)=>{if(typeof define==="function"&&define.amd)define([],Z);else if(typeof YZ==="object"&&YZ.exports)YZ.exports=Z();else $.fuzzysort=Z()})(QW,($)=>{var Z=(C,E)=>{if(!C||!E)return X0;var h=V(C);if(!s(E))E=H(E);var L=h.bitflags;if((L&E._bitflags)!==L)return X0;return N(h,E)},Q=(C,E,h)=>{if(!C)return h?.all?z(E,h):r;var L=V(C),P=L.bitflags,_=L.containsSpace,x=U(h?.threshold||0),l=h?.limit||a,m=0,e=0,Z0=E.length;function T0(y1){if(m<l)t.add(y1),++m;else if(++e,y1._score>t.peek()._score)t.replaceTop(y1)}if(h?.key){var q0=h.key;for(var o=0;o<Z0;++o){var k0=E[o],Q0=n(k0,q0);if(!Q0)continue;if(!s(Q0))Q0=H(Q0);if((P&Q0._bitflags)!==P)continue;var J0=N(L,Q0);if(J0===X0)continue;if(J0._score<x)continue;J0.obj=k0,T0(J0)}}else if(h?.keys){var l0=h.keys,A0=l0.length;$:for(var o=0;o<Z0;++o){var k0=E[o];{var f0=0;for(var H0=0;H0<A0;++H0){var q0=l0[H0],Q0=n(k0,q0);if(!Q0){y[H0]=Y0;continue}if(!s(Q0))Q0=H(Q0);y[H0]=Q0,f0|=Q0._bitflags}if((P&f0)!==P)continue}if(_)for(let W0=0;W0<L.spaceSearches.length;W0++)q[W0]=p;for(var H0=0;H0<A0;++H0){if(Q0=y[H0],Q0===Y0){v[H0]=Y0;continue}if(v[H0]=N(L,Q0,!1,_),v[H0]===X0){v[H0]=Y0;continue}if(_)for(let R0=0;R0<L.spaceSearches.length;R0++){if(S[R0]>-1000){if(q[R0]>p){var E0=(q[R0]+S[R0])/4;if(E0>q[R0])q[R0]=E0}}if(S[R0]>q[R0])q[R0]=S[R0]}}if(_){for(let W0=0;W0<L.spaceSearches.length;W0++)if(q[W0]===p)continue $}else{var U0=!1;for(let W0=0;W0<A0;W0++)if(v[W0]._score!==p){U0=!0;break}if(!U0)continue}var V1=new G(A0);for(let W0=0;W0<A0;W0++)V1[W0]=v[W0];if(_){var z0=0;for(let W0=0;W0<L.spaceSearches.length;W0++)z0+=q[W0]}else{var z0=p;for(let R0=0;R0<A0;R0++){var J0=V1[R0];if(J0._score>-1000){if(z0>p){var E0=(z0+J0._score)/4;if(E0>z0)z0=E0}}if(J0._score>z0)z0=J0._score}}if(V1.obj=k0,V1._score=z0,h?.scoreFn){if(z0=h.scoreFn(V1),!z0)continue;z0=U(z0),V1._score=z0}if(z0<x)continue;T0(V1)}}else for(var o=0;o<Z0;++o){var Q0=E[o];if(!Q0)continue;if(!s(Q0))Q0=H(Q0);if((P&Q0._bitflags)!==P)continue;var J0=N(L,Q0);if(J0===X0)continue;if(J0._score<x)continue;T0(J0)}if(m===0)return r;var H1=Array(m);for(var o=m-1;o>=0;--o)H1[o]=t.poll();return H1.total=m+e,H1},X=(C,E="<b>",h="</b>")=>{var L=typeof E==="function"?E:void 0,P=C.target,_=P.length,x=C.indexes,l="",m=0,e=0,Z0=!1,T0=[];for(var q0=0;q0<_;++q0){var o=P[q0];if(x[e]===q0){if(++e,!Z0)if(Z0=!0,L)T0.push(l),l="";else l+=E;if(e===x.length){if(L)l+=o,T0.push(L(l,m++)),l="",T0.push(P.substr(q0+1));else l+=o+h+P.substr(q0+1);break}}else if(Z0)if(Z0=!1,L)T0.push(L(l,m++)),l="";else l+=h;l+=o}return L?T0:l},Y=(C)=>{if(typeof C==="number")C=""+C;else if(typeof C!=="string")C="";var E=j(C);return K(C,{_targetLower:E._lower,_targetLowerCodes:E.lowerCodes,_bitflags:E.bitflags})},J=()=>{D.clear(),f.clear()};class W{get["indexes"](){return this._indexes.slice(0,this._indexes.len).sort((C,E)=>C-E)}set["indexes"](C){return this._indexes=C}["highlight"](C,E){return X(this,C,E)}get["score"](){return B(this._score)}set["score"](C){this._score=U(C)}}class G extends Array{get["score"](){return B(this._score)}set["score"](C){this._score=U(C)}}var K=(C,E)=>{let h=new W;return h.target=C,h.obj=E.obj??X0,h._score=E._score??p,h._indexes=E._indexes??[],h._targetLower=E._targetLower??"",h._targetLowerCodes=E._targetLowerCodes??X0,h._nextBeginningIndexes=E._nextBeginningIndexes??X0,h._bitflags=E._bitflags??0,h},B=(C)=>{if(C===p)return 0;if(C>1)return C;return Math.E**(((-C+1)**0.04307-1)*-2)},U=(C)=>{if(C===0)return p;if(C>1)return C;return 1-Math.pow(Math.log(C)/-2+1,23.218017181332716)},w=(C)=>{if(typeof C==="number")C=""+C;else if(typeof C!=="string")C="";C=C.trim();var E=j(C),h=[];if(E.containsSpace){var L=C.split(/\s+/);L=[...new Set(L)];for(var P=0;P<L.length;P++){if(L[P]==="")continue;var _=j(L[P]);h.push({lowerCodes:_.lowerCodes,_lower:L[P].toLowerCase(),containsSpace:!1})}}return{lowerCodes:E.lowerCodes,_lower:E._lower,containsSpace:E.containsSpace,bitflags:E.bitflags,spaceSearches:h}},H=(C)=>{if(C.length>999)return Y(C);var E=D.get(C);if(E!==void 0)return E;return E=Y(C),D.set(C,E),E},V=(C)=>{if(C.length>999)return w(C);var E=f.get(C);if(E!==void 0)return E;return E=w(C),f.set(C,E),E},z=(C,E)=>{var h=[];h.total=C.length;var L=E?.limit||a;if(E?.key)for(var P=0;P<C.length;P++){var _=C[P],x=n(_,E.key);if(x==X0)continue;if(!s(x))x=H(x);var l=K(x.target,{_score:x._score,obj:_});if(h.push(l),h.length>=L)return h}else if(E?.keys)for(var P=0;P<C.length;P++){var _=C[P],m=new G(E.keys.length);for(var e=E.keys.length-1;e>=0;--e){var x=n(_,E.keys[e]);if(!x){m[e]=Y0;continue}if(!s(x))x=H(x);x._score=p,x._indexes.len=0,m[e]=x}if(m.obj=_,m._score=p,h.push(m),h.length>=L)return h}else for(var P=0;P<C.length;P++){var x=C[P];if(x==X0)continue;if(!s(x))x=H(x);if(x._score=p,x._indexes.len=0,h.push(x),h.length>=L)return h}return h},N=(C,E,h=!1,L=!1)=>{if(h===!1&&C.containsSpace)return F(C,E,L);var{_lower:P,lowerCodes:_}=C,x=_[0],l=E._targetLowerCodes,m=_.length,e=l.length,o=0,Z0=0,T0=0;for(;;){var q0=x===l[Z0];if(q0){if(R[T0++]=Z0,++o,o===m)break;x=_[o]}if(++Z0,Z0>=e)return X0}var o=0,k0=!1,Q0=0,J0=E._nextBeginningIndexes;if(J0===X0)J0=E._nextBeginningIndexes=A(E.target);Z0=R[0]===0?0:J0[R[0]-1];var l0=0;if(Z0!==e)for(;;)if(Z0>=e){if(o<=0)break;if(++l0,l0>200)break;--o;var A0=T[--Q0];Z0=J0[A0]}else{var q0=_[o]===l[Z0];if(q0){if(T[Q0++]=Z0,++o,o===m){k0=!0;break}++Z0}else Z0=J0[Z0]}var f0=m<=1?-1:E._targetLower.indexOf(P,R[0]),H0=!!~f0,E0=!H0?!1:f0===0||E._nextBeginningIndexes[f0-1]===f0;if(H0&&!E0)for(var U0=0;U0<J0.length;U0=J0[U0]){if(U0<=f0)continue;for(var V1=0;V1<m;V1++)if(_[V1]!==E._targetLowerCodes[U0+V1])break;if(V1===m){f0=U0,E0=!0;break}}var z0=(W0)=>{var R0=0,M1=0;for(var s0=1;s0<m;++s0)if(W0[s0]-W0[s0-1]!==1)R0-=W0[s0],++M1;var OA=W0[m-1]-W0[0]-(m-1);if(R0-=(12+OA)*M1,W0[0]!==0)R0-=W0[0]*W0[0]*0.2;if(!k0)R0*=1000;else{var c0=1;for(var s0=J0[0];s0<e;s0=J0[s0])++c0;if(c0>24)R0*=(c0-24)*10}if(R0-=(e-m)/2,H0)R0/=1+m*m*1;if(E0)R0/=1+m*m*1;return R0-=(e-m)/2,R0};if(!k0){if(H0)for(var U0=0;U0<m;++U0)R[U0]=f0+U0;var H1=R,y1=z0(H1)}else if(E0){for(var U0=0;U0<m;++U0)R[U0]=f0+U0;var H1=R,y1=z0(R)}else var H1=T,y1=z0(T);E._score=y1;for(var U0=0;U0<m;++U0)E._indexes[U0]=H1[U0];E._indexes.len=m;let L0=new W;return L0.target=E.target,L0._score=E._score,L0._indexes=E._indexes,L0},F=(C,E,h)=>{var L=new Set,P=0,_=X0,x=0,l=C.spaceSearches,m=l.length,e=0,Z0=()=>{for(let E0=e-1;E0>=0;E0--)E._nextBeginningIndexes[b[E0*2+0]]=b[E0*2+1]},T0=!1;for(var H0=0;H0<m;++H0){S[H0]=p;var q0=l[H0];if(_=N(q0,E),h){if(_===X0)continue;T0=!0}else if(_===X0)return Z0(),X0;var o=H0===m-1;if(!o){var k0=_._indexes,Q0=!0;for(let U0=0;U0<k0.len-1;U0++)if(k0[U0+1]-k0[U0]!==1){Q0=!1;break}if(Q0){var J0=k0[k0.len-1]+1,l0=E._nextBeginningIndexes[J0-1];for(let U0=J0-1;U0>=0;U0--){if(l0!==E._nextBeginningIndexes[U0])break;E._nextBeginningIndexes[U0]=J0,b[e*2+0]=U0,b[e*2+1]=l0,e++}}}if(P+=_._score/m,S[H0]=_._score/m,_._indexes[0]<x)P-=(x-_._indexes[0])*2;x=_._indexes[0];for(var A0=0;A0<_._indexes.len;++A0)L.add(_._indexes[A0])}if(h&&!T0)return X0;Z0();var f0=N(C,E,!0);if(f0!==X0&&f0._score>P){if(h)for(var H0=0;H0<m;++H0)S[H0]=f0._score/m;return f0}if(h)_=E;_._score=P;var H0=0;for(let E0 of L)_._indexes[H0++]=E0;return _._indexes.len=H0,_},O=(C)=>C.replace(/\p{Script=Latin}+/gu,(E)=>E.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),j=(C)=>{C=O(C);var E=C.length,h=C.toLowerCase(),L=[],P=0,_=!1;for(var x=0;x<E;++x){var l=L[x]=h.charCodeAt(x);if(l===32){_=!0;continue}var m=l>=97&&l<=122?l-97:l>=48&&l<=57?26:l<=127?30:31;P|=1<<m}return{lowerCodes:L,bitflags:P,containsSpace:_,_lower:h}},M=(C)=>{var E=C.length,h=[],L=0,P=!1,_=!1;for(var x=0;x<E;++x){var l=C.charCodeAt(x),m=l>=65&&l<=90,e=m||l>=97&&l<=122||l>=48&&l<=57,Z0=m&&!P||!_||!e;if(P=m,_=e,Z0)h[L++]=x}return h},A=(C)=>{C=O(C);var E=C.length,h=M(C),L=[],P=h[0],_=0;for(var x=0;x<E;++x)if(P>x)L[x]=P;else P=h[++_],L[x]=P===void 0?E:P;return L},D=new Map,f=new Map,R=[],T=[],b=[],q=[],S=[],y=[],v=[],n=(C,E)=>{var h=C[E];if(h!==void 0)return h;if(typeof E==="function")return E(C);var L=E;if(!Array.isArray(E))L=E.split(".");var P=L.length,_=-1;while(C&&++_<P)C=C[L[_]];return C},s=(C)=>{return typeof C==="object"&&typeof C._bitflags==="number"},a=1/0,p=-a,r=[];r.total=0;var X0=null,Y0=Y(""),B0=(C)=>{var E=[],h=0,L={},P=(_)=>{for(var x=0,l=E[x],m=1;m<h;){var e=m+1;x=m,e<h&&E[e]._score<E[m]._score&&(x=e),E[x-1>>1]=E[x],m=1+(x<<1)}for(var Z0=x-1>>1;x>0&&l._score<E[Z0]._score;Z0=(x=Z0)-1>>1)E[x]=E[Z0];E[x]=l};return L.add=(_)=>{var x=h;E[h++]=_;for(var l=x-1>>1;x>0&&_._score<E[l]._score;l=(x=l)-1>>1)E[x]=E[l];E[x]=_},L.poll=(_)=>{if(h!==0){var x=E[0];return E[0]=E[--h],P(),x}},L.peek=(_)=>{if(h!==0)return E[0]},L.replaceTop=(_)=>{E[0]=_,P()},L},t=B0();return{single:Z,go:Q,prepare:Y,cleanup:J}})});var oW=I((xy,aW)=>{function MF($){var Z=new $,Q=Z;function X(){var J=Z;if(J.next)Z=J.next;else Z=new $,Q=Z;return J.next=null,J}function Y(J){Q.next=J,Q=J}return{get:X,release:Y}}aW.exports=MF});var tW=I((ky,o7)=>{var AF=oW();function rW($,Z,Q){if(typeof $==="function")Q=Z,Z=$,$=null;if(!(Q>=1))throw Error("fastqueue concurrency must be equal to or greater than 1");var X=AF(FF),Y=null,J=null,W=0,G=null,K={push:N,drain:K1,saturated:K1,pause:U,paused:!1,get concurrency(){return Q},set concurrency(f){if(!(f>=1))throw Error("fastqueue concurrency must be equal to or greater than 1");if(Q=f,K.paused)return;for(;Y&&W<Q;)W++,O()},running:B,resume:V,idle:z,length:w,getQueue:H,unshift:F,empty:K1,kill:j,killAndDrain:M,error:D,abort:A};return K;function B(){return W}function U(){K.paused=!0}function w(){var f=Y,R=0;while(f)f=f.next,R++;return R}function H(){var f=Y,R=[];while(f)R.push(f.value),f=f.next;return R}function V(){if(!K.paused)return;if(K.paused=!1,Y===null){W++,O();return}for(;Y&&W<Q;)W++,O()}function z(){return W===0&&K.length()===0}function N(f,R){var T=X.get();if(T.context=$,T.release=O,T.value=f,T.callback=R||K1,T.errorHandler=G,W>=Q||K.paused)if(J)J.next=T,J=T;else Y=T,J=T,K.saturated();else W++,Z.call($,T.value,T.worked)}function F(f,R){var T=X.get();if(T.context=$,T.release=O,T.value=f,T.callback=R||K1,T.errorHandler=G,W>=Q||K.paused)if(Y)T.next=Y,Y=T;else Y=T,J=T,K.saturated();else W++,Z.call($,T.value,T.worked)}function O(f){if(f)X.release(f);var R=Y;if(R&&W<=Q)if(!K.paused){if(J===Y)J=null;if(Y=R.next,R.next=null,Z.call($,R.value,R.worked),J===null)K.empty()}else W--;else if(--W===0)K.drain()}function j(){Y=null,J=null,K.drain=K1}function M(){Y=null,J=null,K.drain(),K.drain=K1}function A(){var f=Y;Y=null,J=null;while(f){var{next:R,callback:T,errorHandler:b,value:q,context:S}=f;if(f.value=null,f.callback=K1,f.errorHandler=null,b)b(Error("abort"),q);T.call(S,Error("abort")),f.release(f),f=R}K.drain=K1}function D(f){G=f}}function K1(){}function FF(){this.value=null,this.callback=K1,this.next=null,this.release=K1,this.context=null,this.errorHandler=null;var $=this;this.worked=function(Q,X){var{callback:Y,errorHandler:J,value:W}=$;if($.value=null,$.callback=K1,$.errorHandler)J(Q,W);Y.call($.context,Q,X),$.release($)}}function NF($,Z,Q){if(typeof $==="function")Q=Z,Z=$,$=null;function X(U,w){Z.call(this,U).then(function(H){w(null,H)},w)}var Y=rW($,X,Q),J=Y.push,W=Y.unshift;return Y.push=G,Y.unshift=K,Y.drained=B,Y;function G(U){var w=new Promise(function(H,V){J(U,function(z,N){if(z){V(z);return}H(N)})});return w.catch(K1),w}function K(U){var w=new Promise(function(H,V){W(U,function(z,N){if(z){V(z);return}H(N)})});return w.catch(K1),w}function B(){var U=new Promise(function(w){process.nextTick(function(){if(Y.idle())w();else{var H=Y.drain;Y.drain=function(){if(typeof H==="function")H();w(),Y.drain=H}}})});return U}}o7.exports=rW;o7.exports.promise=NF});var r7=I((vy,a8)=>{var{format:OF}=u("util");function jF(){return`${this.name} [${this.code}]: ${this.message}`}var UZ=Symbol.for("fastify-error-generic");function Q8($,Z,Q=500,X=Error,Y=Q8.captureStackTrace){let J=$===UZ;if(J)$="FST_ERR";if(!$)throw Error("Fastify error code must not be empty");if(!Z)throw Error("Fastify error message must not be empty");$=$.toUpperCase(),!Q&&(Q=void 0);let W=Symbol.for(`fastify-error ${$}`);function G(...K){if(!new.target)return new G(...K);this.code=$,this.name="FastifyError",this.statusCode=Q;let B=K.length-1;if(B!==-1&&K[B]&&typeof K[B]==="object"&&"cause"in K[B])this.cause=K.pop().cause;this.message=OF(Z,...K),Error.stackTraceLimit&&Y&&Error.captureStackTrace(this,G)}if(G.prototype=Object.create(X.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0},[UZ]:{value:!0,enumerable:!1,writable:!1,configurable:!1},[W]:{value:!0,enumerable:!1,writable:!1,configurable:!1}}),J)Object.defineProperty(G,Symbol.hasInstance,{value(K){return K&&K[UZ]},configurable:!1,writable:!1,enumerable:!1});else Object.defineProperty(G,Symbol.hasInstance,{value(K){return K&&K[W]},configurable:!1,writable:!1,enumerable:!1});return G.prototype[Symbol.toStringTag]="Error",G.prototype.toString=jF,G}Q8.captureStackTrace=!0;var DF=Q8(UZ,"Fastify Error",500,Error);a8.exports=Q8;a8.exports.FastifyError=DF;a8.exports.default=Q8;a8.exports.createError=Q8});var zZ=I((yy,eW)=>{var{createError:z$}=r7();eW.exports={AVV_ERR_EXPOSE_ALREADY_DEFINED:z$("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' is already defined, specify an expose option for '%s'"),AVV_ERR_ATTRIBUTE_ALREADY_DEFINED:z$("AVV_ERR_ATTRIBUTE_ALREADY_DEFINED","'%s' is already defined"),AVV_ERR_CALLBACK_NOT_FN:z$("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:z$("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:z$("AVV_ERR_ROOT_PLG_BOOTED","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:z$("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:z$("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise"),AVV_ERR_PLUGIN_EXEC_TIMEOUT:z$("AVV_ERR_PLUGIN_EXEC_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")}});var X8=I((gy,$G)=>{var TF=Symbol("avvio.Boot"),qF=Symbol("isOnCloseHandler"),fF=Symbol("avvio.ThenifyDoNotWrap"),LF=Symbol("avvio.TimeTree.untrackNode"),RF=Symbol("avvio.TimeTree.trackNode"),PF=Symbol("avvio.TimeTree.getParent"),CF=Symbol("avvio.TimeTree.getNode"),EF=Symbol("avvio.TimeTree.addNode"),bF=Symbol.for("plugin-meta");$G.exports={kAvvio:TF,kIsOnCloseHandler:qF,kThenifyDoNotWrap:fF,kUntrackNode:LF,kTrackNode:RF,kGetParent:PF,kGetNode:CF,kAddNode:EF,kPluginMeta:bF}});var KG=I((hy,GG)=>{var{kUntrackNode:ZG,kTrackNode:t7,kGetParent:QG,kGetNode:XG,kAddNode:YG}=X8();class JG{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[t7]($){if(this.tableId.set($.id,$),this.tableLabel.has($.label))this.tableLabel.get($.label).push($);else this.tableLabel.set($.label,[$])}[ZG]($){this.tableId.delete($.id);let Z=this.tableLabel.get($.label);if(Z.pop(),Z.length===0)this.tableLabel.delete($.label)}[QG]($){if($===null)return null;else if(this.tableLabel.has($)){let Z=this.tableLabel.get($);return Z[Z.length-1]}else return null}[XG]($){return this.tableId.get($)}[YG]($,Z,Q){let X=this[QG]($);if(X===null)return this.root={parent:null,id:"root",label:Z,nodes:[],start:Q,stop:null,diff:-1},this[t7](this.root),this.root.id;let J=`${Z}-${Math.random()}`,W={parent:$,id:J,label:Z,nodes:[],start:Q,stop:null,diff:-1};return X.nodes.push(W),this[t7](W),J}start($,Z,Q=Date.now()){return this[YG]($,Z,Q)}stop($,Z=Date.now()){let Q=this[XG]($);if(Q)Q.stop=Z,Q.diff=Q.stop-Q.start||0,this[ZG](Q)}toJSON(){return Object.assign({},this.root)}prettyPrint(){return WG(this.toJSON())}}function WG($,Z=""){let Q=Z,X=$.nodes.length,Y=X-1;Q+=`${$.label} ${$.diff} ms
3
+ `;for(let J=0;J<X;++J){let W=$.nodes[J],G=Z+(J===Y?" ":"\u2502 ");Q+=Z,Q+=J===Y?"\u2514\u2500":"\u251C\u2500",Q+=W.nodes.length===0?"\u2500 ":"\u252C ",Q+=WG(W,G).slice(Z.length+2)}return Q}GG.exports={TimeTree:JG}});var wZ=I((uy,BG)=>{var{debuglog:_F}=u("util"),IF=_F("avvio");BG.exports={debug:IF}});var zG=I((my,UG)=>{function SF(){let $={resolve:null,reject:null,promise:null};return $.promise=new Promise((Z,Q)=>{$.resolve=Z,$.reject=Q}),$}UG.exports={createPromise:SF}});var HG=I((ly,VG)=>{var{kPluginMeta:wG}=X8();function xF($,Z){if($[wG]?.name)return $[wG].name;if(Z?.name)return Z.name;if($.name)return $.name;else return $.toString().split(`
4
+ `).slice(0,2).map((Q)=>Q.trim()).join(" -- ")}VG.exports={getPluginName:xF}});var VZ=I((cy,MG)=>{function kF($){return $!==null&&typeof $==="object"&&typeof $.then==="function"}MG.exports={isPromiseLike:kF}});var FG=I((dy,AG)=>{var{EventEmitter:vF}=u("events"),{inherits:yF}=u("util"),{debug:o0}=wZ(),{createPromise:gF}=zG(),{AVV_ERR_PLUGIN_EXEC_TIMEOUT:hF}=zZ(),{getPluginName:uF}=HG(),{isPromiseLike:mF}=VZ();function Y8($,Z,Q,X,Y){this.queue=$,this.func=Z,this.options=Q,this.isAfter=X,this.timeout=Y,this.started=!1,this.name=uF(Z,Q),this.queue.pause(),this._error=null,this.loaded=!1,this._promise=null,this.startTime=null}yF(Y8,vF);Y8.prototype.exec=function($,Z){o0("exec",this.name),this.server=$;let Q=this.func,X=this.name,Y=!1;this.options=typeof this.options==="function"?this.options(this.server):this.options;let J=null,W=(K)=>{if(Y){o0("loading complete",X);return}if(this._error=K,K)o0("exec errored",X);else o0("exec completed",X);if(Y=!0,J)clearTimeout(J);Z(K)};if(this.timeout>0)o0("setting up timeout",X,this.timeout),J=setTimeout(function(){o0("timed out",X),J=null;let K=new hF(X);K.fn=Q,W(K)},this.timeout);this.started=!0,this.startTime=Date.now(),this.emit("start",this.server?this.server.name:null,this.name,Date.now());let G=Q(this.server,this.options,W);if(mF(G))o0("exec: resolving promise",X),G.then(()=>process.nextTick(W),(K)=>process.nextTick(W,K));else if(Q.length<3)W()};Y8.prototype.loadedSoFar=function(){if(o0("loadedSoFar",this.name),this.loaded)return Promise.resolve();let $=()=>{this.server.after((Q,X)=>{if(this._error=Q,this.queue.pause(),this._promise){if(Q)o0("rejecting promise",this.name,Q),this._promise.reject(Q);else o0("resolving promise",this.name),this._promise.resolve();this._promise=null}process.nextTick(X,Q)}),this.queue.resume()},Z;if(!this._promise)if(this._promise=gF(),Z=this._promise.promise,!this.server)this.on("start",$);else $();else Z=Promise.resolve();return Z};Y8.prototype.enqueue=function($,Z){o0("enqueue",this.name,$.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.queue.push($,Z)};Y8.prototype.finish=function($,Z){o0("finish",this.name,$);let Q=()=>{if(this.loaded)return;o0("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,Z($)};if($){if(this._promise)this._promise.reject($),this._promise=null;Q();return}let X=()=>{if(o0("check",this.name,this.queue.length(),this.queue.running(),this._promise),this.queue.length()===0&&this.queue.running()===0)if(this._promise){let Y=()=>{o0("wrap"),queueMicrotask(X)};this._promise.resolve(),this._promise.promise.then(Y,Y),this._promise=null}else Q();else o0("delayed",this.name),this.queue.drain=()=>{o0("drain",this.name),this.queue.drain=lF,queueMicrotask(X)}};queueMicrotask(X),this.queue.resume()};function lF(){}AG.exports={Plugin:Y8}});var OG=I((py,NG)=>{var{AVV_ERR_PLUGIN_NOT_VALID:e7}=zZ();function cF($){if(!($&&(typeof $==="function"||typeof $.then==="function")))if(Array.isArray($))throw new e7("array");else if($===null)throw new e7("null");else throw new e7(typeof $)}NG.exports={validatePlugin:cF}});var DG=I((iy,jG)=>{function dF($){return $!==null&&typeof $==="object"&&typeof $.default==="function"}jG.exports={isBundledOrTypescriptPlugin:dF}});var fG=I((ny,qG)=>{var{debug:TG}=wZ(),{kThenifyDoNotWrap:$X}=X8();function pF(){if(this.booted){TG("thenify returning undefined because we are already booted");return}if(this[$X]){this[$X]=!1;return}return TG("thenify"),($,Z)=>{return this._loadRegistered().then(()=>{return this[$X]=!0,$(this._server)},Z)}}qG.exports={thenify:pF}});var RG=I((sy,LG)=>{var{isPromiseLike:iF}=VZ(),{kAvvio:nF}=X8();function sF($,Z,Q){let X;try{X=$.apply($,Z)}catch(Y){if(Q)process.nextTick(Q,Y);return}if(iF(X)&&!X[nF])X.then(()=>process.nextTick(Q),(Y)=>process.nextTick(Q,Y));else if(Q)process.nextTick(Q)}LG.exports={executeWithThenable:sF}});var kG=I((ay,xG)=>{var HZ=tW(),aF=u("events").EventEmitter,oF=u("util").inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:o8,AVV_ERR_CALLBACK_NOT_FN:J8,AVV_ERR_ROOT_PLG_BOOTED:rF,AVV_ERR_READY_TIMEOUT:tF,AVV_ERR_ATTRIBUTE_ALREADY_DEFINED:eF}=zZ(),{kAvvio:EG,kIsOnCloseHandler:bG}=X8(),{TimeTree:$N}=KG(),{Plugin:_G}=FG(),{debug:W8}=wZ(),{validatePlugin:ZN}=OG(),{isBundledOrTypescriptPlugin:QN}=DG(),{isPromiseLike:XN}=VZ(),{thenify:IG}=fG(),{executeWithThenable:PG}=RG();function v0($,Z,Q){if(typeof $==="function"&&arguments.length===1)Q=$,Z={},$=null;if(typeof Z==="function")Q=Z,Z={};if(Z=Z||{},Z.autostart=Z.autostart!==!1,Z.timeout=Number(Z.timeout)||0,Z.expose=Z.expose||{},!new.target)return new v0($,Z,Q);if(this._server=$||this,this._opts=Z,$)this._expose();if(this._current=[],this._error=null,this._lastUsed=null,this.setMaxListeners(0),Q)this.once("start",Q);this.started=!1,this.booted=!1,this.pluginTree=new $N,this._readyQ=HZ(this,SG,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=CG},this._closeQ=HZ(this,JN,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=CG},this._doStart=null;let X=this;this._root=new _G(HZ(this,this._loadPluginNextTick,1),function(J,W,G){X._doStart=G,W.autostart&&X.start()},Z,!1,0),this._trackPluginLoading(this._root),this._loadPlugin(this._root,(Y)=>{W8("root plugin ready");try{this.emit("preReady"),this._root=null}catch(J){Y=Y||this._error||J}if(Y){if(this._error=Y,this._readyQ.length()===0)throw Y}else this.booted=!0;this._readyQ.resume()})}oF(v0,aF);if("asyncDispose"in Symbol)v0.prototype[Symbol.asyncDispose]=function(){return new Promise(($,Z)=>{this.close((Q)=>{if(Q)return Z(Q);$()})})};v0.prototype.start=function(){return this.started=!0,process.nextTick(this._doStart),this};v0.prototype.override=function($,Z,Q){return $};v0.prototype[EG]=!0;v0.prototype.use=function($,Z){return this._lastUsed=this._addPlugin($,Z,!1),this};v0.prototype._loadRegistered=function(){let $=this._current[0];if(!this.started&&!this.booted)process.nextTick(()=>this._root.queue.resume());if(!$)return Promise.resolve();return $.loadedSoFar()};Object.defineProperty(v0.prototype,"then",{get:IG});v0.prototype._addPlugin=function($,Z,Q){if(QN($))$=$.default;if(ZN($),Z=Z||{},this.booted)throw new rF;let X=this._current[0],Y=this._opts.timeout;if(!X.loaded&&X.timeout>0){let W=Date.now()-X.startTime;Y=X.timeout-(W+3)}let J=new _G(HZ(this,this._loadPluginNextTick,1),$,Z,Q,Y);if(this._trackPluginLoading(J),X.loaded)throw Error(J.name,X.name);return X.enqueue(J,(W)=>{W&&(this._error=W)}),J};v0.prototype._expose=function(){let Z=this,Q=Z._server,{use:X="use",after:Y="after",ready:J="ready",onClose:W="onClose",close:G="close"}=this._opts.expose;if(Q[X])throw new o8(X,"use");if(Q[X]=function(K,B){return Z.use(K,B),this},Q[Y])throw new o8(Y,"after");if(Q[Y]=function(K){if(typeof K!=="function")return Z._loadRegistered();return Z.after(ZX(K,this)),this},Q[J])throw new o8(J,"ready");if(Q[J]=function(K){if(K&&typeof K!=="function")throw new J8(J,typeof K);return Z.ready(K?ZX(K,this):void 0)},Q[W])throw new o8(W,"onClose");if(Q[W]=function(K){if(typeof K!=="function")throw new J8(W,typeof K);return Z.onClose(WN(K,this)),this},Q[G])throw new o8(G,"close");if(Q[G]=function(K){if(K&&typeof K!=="function")throw new J8(G,typeof K);if(K)return Z.close(ZX(K,this)),this;return Z.close()},Q.then)throw new eF("then");Object.defineProperty(Q,"then",{get:IG.bind(Z)}),Q[EG]=!0};v0.prototype.after=function($){if(!$)return this._loadRegistered();this._addPlugin(Z.bind(this),{},!0);function Z(Q,X,Y){SG.call(this,$,Y)}return this};v0.prototype.onClose=function($){if(typeof $!=="function")throw new J8("onClose",typeof $);return $[bG]=!0,this._closeQ.unshift($,(Z)=>{Z&&(this._error=Z)}),this};v0.prototype.close=function($){let Z;if($){if(typeof $!=="function")throw new J8("close",typeof $)}else Z=new Promise(function(Q,X){$=function(Y){if(Y)return X(Y);Q()}});return this.ready(()=>{this._error=null,this._closeQ.push($),process.nextTick(this._closeQ.resume.bind(this._closeQ))}),Z};v0.prototype.ready=function($){if($){if(typeof $!=="function")throw new J8("ready",typeof $);this._readyQ.push($),queueMicrotask(this.start.bind(this));return}return new Promise((Z,Q)=>{this._readyQ.push(Y),this.start();let X=this._current[0].server;function Y(J,W,G){if(J)Q(J);else Z(X);process.nextTick(G)}})};v0.prototype._trackPluginLoading=function($){let Z=this._current[0]?.name||null;$.once("start",(Q,X,Y)=>{let J=this.pluginTree.start(Z||null,X,Y);$.once("loaded",(W,G,K)=>{this.pluginTree.stop(J,K)})})};v0.prototype.prettyPrint=function(){return this.pluginTree.prettyPrint()};v0.prototype.toJSON=function(){return this.pluginTree.toJSON()};v0.prototype._loadPlugin=function($,Z){let Q=this;if(XN($.func)){$.func.then((W)=>{if(typeof W.default==="function")W=W.default;$.func=W,this._loadPlugin($,Z)},Z);return}let X=Q._current[0];if(Q._current.unshift($),Q._error&&!$.isAfter){W8("skipping loading of plugin as instance errored and it is not an after",$.name),process.nextTick(J);return}let Y=X?.server||Q._server;if(!$.isAfter)try{Y=Q.override(Y,$.func,$.options)}catch(W){return W8("override errored",$.name),J(W)}$.exec(Y,J);function J(W){$.finish(W,(G)=>{Q._current.shift(),Z(G)})}};v0.prototype._loadPluginNextTick=function($,Z){process.nextTick(this._loadPlugin.bind(this),$,Z)};function CG(){}function SG($,Z){let Q=this._server,X=this._error;if(this._error=null,$.length===0)this._error=X,PG($,[],Z);else if($.length===1)PG($,[X],Z);else if(this._opts.timeout===0){let Y=(J)=>{this._error=J,Z(this._error)};if($.length===2)$(X,Y);else $(X,Q,Y)}else YN.call(this,$,X,Q,Z)}function YN($,Z,Q,X){let Y=$.unwrappedName??$.name;W8("setting up ready timeout",Y,this._opts.timeout);let J=setTimeout(()=>{W8("timed out",Y),J=null;let G=new tF(Y);G.fn=$,this._error=G,X(G)},this._opts.timeout);if($.length===2)$(Z,W.bind(this));else $(Z,Q,W.bind(this));function W(G){if(J)clearTimeout(J),this._error=G,X(this._error)}}function JN($,Z){let Q=this._server,X=$[bG];if($.length===0||$.length===1){let Y;if(X)Y=$(Q);else Y=$(this._error);if(Y&&typeof Y.then==="function")W8("resolving close/onClose promise"),Y.then(()=>process.nextTick(Z),(J)=>process.nextTick(Z,J));else process.nextTick(Z)}else if($.length===2)if(X)$(Q,Z);else $(this._error,Z);else if(X)$(Q,Z);else $(this._error,Q,Z)}function WN($,Z){return Q.bind(Z);function Q(X,Y){let J;if($.length===0)if(J=$(),J?.then)J.then(function(){process.nextTick(Y)},Y);else process.nextTick(Y);else if($.length===1)if(J=$(this),J?.then)J.then(function(){process.nextTick(Y)},Y);else process.nextTick(Y);else $(this,Y)}}function ZX($,Z){let Q=X.bind(Z);return Q.unwrappedName=$.name,Q;function X(Y,J){let W;if(!$)process.nextTick(J);else if($.length===0)if(W=$(),W?.then)W.then(function(){process.nextTick(J,Y)},J);else process.nextTick(J,Y);else if($.length===1)if(W=$(Y),W?.then)W.then(function(){process.nextTick(J)},J);else process.nextTick(J);else if($.length===2)$(Y,J);else $(Y,this,J)}}xG.exports=v0});var u0=I((oy,vG)=>{var GN={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"),kRequestSignal:Symbol("fastify.request.signal"),kHandlerTimeout:Symbol("fastify.handlerTimeout"),kTimeoutTimer:Symbol("fastify.request.timeoutTimer"),kOnAbort:Symbol("fastify.request.onAbort"),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")};vG.exports=GN});var gG=I((ry,MZ)=>{var{format:QX}=u("util");function KN($){return yG({...$,name:"DeprecationWarning"})}function yG({name:$,code:Z,message:Q,unlimited:X=!1}={}){if(!$)throw Error("Warning name must not be empty");if(!Z)throw Error("Warning code must not be empty");if(!Q)throw Error("Warning message must not be empty");if(typeof X!=="boolean")throw Error("Warning opts.unlimited must be a boolean");Z=Z.toUpperCase();let Y={[$]:function(W,G,K){if(J.emitted===!0&&J.unlimited!==!0)return;J.emitted=!0,process.emitWarning(J.format(W,G,K),J.name,J.code)}};if(X)Y={[$]:function(W,G,K){J.emitted=!0,process.emitWarning(J.format(W,G,K),J.name,J.code)}};let J=Y[$];return J.emitted=!1,J.message=Q,J.unlimited=X,J.code=Z,J.format=function(W,G,K){let B;if(W&&G&&K)B=QX(Q,W,G,K);else if(W&&G)B=QX(Q,W,G);else if(W)B=QX(Q,W);else B=Q;return B},J}var XX={createWarning:yG,createDeprecation:KN};MZ.exports=XX;MZ.exports.default=XX;MZ.exports.processWarning=XX});var G8=I((ty,hG)=>{var{createWarning:r8}=gG(),BN=r8({name:"FastifyWarning",code:"FSTWRN001",message:"The %s schema for %s: %s is missing. This may indicate the schema is not well specified.",unlimited:!0}),UN=r8({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}),zN=r8({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}),wN=r8({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}),VN=r8({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});hG.exports={FSTWRN001:BN,FSTWRN003:UN,FSTWRN004:zN,FSTSEC001:wN,FSTDEP022:VN}});var d0=I((ey,AZ)=>{var c=r7(),E$={FST_ERR_NOT_FOUND:c("FST_ERR_NOT_FOUND","Not Found",404),FST_ERR_OPTIONS_NOT_OBJ:c("FST_ERR_OPTIONS_NOT_OBJ","Options must be an object",500,TypeError),FST_ERR_QSP_NOT_FN:c("FST_ERR_QSP_NOT_FN","querystringParser option should be a function, instead got '%s'",500,TypeError),FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:c("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:c("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:c("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:c("FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR","ajv.plugins option should be an array, instead got '%s'",500,TypeError),FST_ERR_VALIDATION:c("FST_ERR_VALIDATION","%s",400),FST_ERR_LISTEN_OPTIONS_INVALID:c("FST_ERR_LISTEN_OPTIONS_INVALID","Invalid listen options: '%s'",500,TypeError),FST_ERR_ERROR_HANDLER_NOT_FN:c("FST_ERR_ERROR_HANDLER_NOT_FN","Error Handler must be a function",500,TypeError),FST_ERR_ERROR_HANDLER_ALREADY_SET:c("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:c("FST_ERR_CTP_ALREADY_PRESENT","Content type parser '%s' already present."),FST_ERR_CTP_INVALID_TYPE:c("FST_ERR_CTP_INVALID_TYPE","The content type should be a string or a RegExp",500,TypeError),FST_ERR_CTP_EMPTY_TYPE:c("FST_ERR_CTP_EMPTY_TYPE","The content type cannot be an empty string",500,TypeError),FST_ERR_CTP_INVALID_HANDLER:c("FST_ERR_CTP_INVALID_HANDLER","The content type handler should be a function",500,TypeError),FST_ERR_CTP_INVALID_PARSE_TYPE:c("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:c("FST_ERR_CTP_BODY_TOO_LARGE","Request body is too large",413,RangeError),FST_ERR_CTP_INVALID_MEDIA_TYPE:c("FST_ERR_CTP_INVALID_MEDIA_TYPE","Unsupported Media Type",415),FST_ERR_CTP_INVALID_CONTENT_LENGTH:c("FST_ERR_CTP_INVALID_CONTENT_LENGTH","Request body size did not match Content-Length",400,RangeError),FST_ERR_CTP_EMPTY_JSON_BODY:c("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:c("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:c("FST_ERR_CTP_INSTANCE_ALREADY_STARTED",'Cannot call "%s" when fastify instance is already started!',400),FST_ERR_DEC_ALREADY_PRESENT:c("FST_ERR_DEC_ALREADY_PRESENT","The decorator '%s' has already been added!"),FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:c("FST_ERR_DEC_DEPENDENCY_INVALID_TYPE","The dependencies of decorator '%s' must be of type Array.",500,TypeError),FST_ERR_DEC_MISSING_DEPENDENCY:c("FST_ERR_DEC_MISSING_DEPENDENCY","The decorator is missing dependency '%s'."),FST_ERR_DEC_AFTER_START:c("FST_ERR_DEC_AFTER_START","The decorator '%s' has been added after start!"),FST_ERR_DEC_REFERENCE_TYPE:c("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:c("FST_ERR_DEC_UNDECLARED","No decorator '%s' has been declared on %s."),FST_ERR_HOOK_INVALID_TYPE:c("FST_ERR_HOOK_INVALID_TYPE","The hook name must be a string",500,TypeError),FST_ERR_HOOK_INVALID_HANDLER:c("FST_ERR_HOOK_INVALID_HANDLER","%s hook should be a function, instead got %s",500,TypeError),FST_ERR_HOOK_INVALID_ASYNC_HANDLER:c("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:c("FST_ERR_HOOK_NOT_SUPPORTED","%s hook not supported!",500,TypeError),FST_ERR_MISSING_MIDDLEWARE:c("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:c("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:c("FST_ERR_LOG_INVALID_DESTINATION","Cannot specify both logger.stream and logger.file options"),FST_ERR_LOG_INVALID_LOGGER:c("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:c("FST_ERR_LOG_INVALID_LOGGER_INSTANCE","loggerInstance only accepts a logger instance.",500,TypeError),FST_ERR_LOG_INVALID_LOGGER_CONFIG:c("FST_ERR_LOG_INVALID_LOGGER_CONFIG","logger options only accepts a configuration object.",500,TypeError),FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:c("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:c("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:c("FST_ERR_REP_RESPONSE_BODY_CONSUMED","Response.body is already consumed."),FST_ERR_REP_READABLE_STREAM_LOCKED:c("FST_ERR_REP_READABLE_STREAM_LOCKED","ReadableStream was locked. You should call releaseLock() method on reader before sending."),FST_ERR_REP_ALREADY_SENT:c("FST_ERR_REP_ALREADY_SENT",'Reply was already sent, did you forget to "return reply" in "%s" (%s)?'),FST_ERR_REP_SENT_VALUE:c("FST_ERR_REP_SENT_VALUE","The only possible value for reply.sent is true.",500,TypeError),FST_ERR_SEND_INSIDE_ONERR:c("FST_ERR_SEND_INSIDE_ONERR","You cannot use `send` inside the `onError` hook"),FST_ERR_SEND_UNDEFINED_ERR:c("FST_ERR_SEND_UNDEFINED_ERR","Undefined error has occurred"),FST_ERR_BAD_STATUS_CODE:c("FST_ERR_BAD_STATUS_CODE","Called reply with an invalid status code: %s"),FST_ERR_BAD_TRAILER_NAME:c("FST_ERR_BAD_TRAILER_NAME","Called reply.trailer with an invalid header name: %s"),FST_ERR_BAD_TRAILER_VALUE:c("FST_ERR_BAD_TRAILER_VALUE","Called reply.trailer('%s', fn) with an invalid type: %s. Expected a function."),FST_ERR_FAILED_ERROR_SERIALIZATION:c("FST_ERR_FAILED_ERROR_SERIALIZATION","Failed to serialize an error. Error: %s. Original error: %s"),FST_ERR_MISSING_SERIALIZATION_FN:c("FST_ERR_MISSING_SERIALIZATION_FN",'Missing serialization function. Key "%s"'),FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:c("FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN",'Missing serialization function. Key "%s:%s"'),FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:c("FST_ERR_REQ_INVALID_VALIDATION_INVOCATION",'Invalid validation invocation. Missing validation function for HTTP part "%s" nor schema provided.'),FST_ERR_SCH_MISSING_ID:c("FST_ERR_SCH_MISSING_ID","Missing schema $id property"),FST_ERR_SCH_ALREADY_PRESENT:c("FST_ERR_SCH_ALREADY_PRESENT","Schema with id '%s' already declared!"),FST_ERR_SCH_CONTENT_MISSING_SCHEMA:c("FST_ERR_SCH_CONTENT_MISSING_SCHEMA","Schema is missing for the content type '%s'"),FST_ERR_SCH_DUPLICATE:c("FST_ERR_SCH_DUPLICATE","Schema with '%s' already present!"),FST_ERR_SCH_VALIDATION_BUILD:c("FST_ERR_SCH_VALIDATION_BUILD","Failed building the validation schema for %s: %s, due to error %s"),FST_ERR_SCH_SERIALIZATION_BUILD:c("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:c("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:c("FST_ERR_INIT_OPTS_INVALID","Invalid initialization options: '%s'"),FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:c("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:c("FST_ERR_DUPLICATED_ROUTE","Method '%s' already declared for route '%s'"),FST_ERR_BAD_URL:c("FST_ERR_BAD_URL","'%s' is not a valid url component",400,URIError),FST_ERR_ASYNC_CONSTRAINT:c("FST_ERR_ASYNC_CONSTRAINT","Unexpected error from async constraint",500),FST_ERR_INVALID_URL:c("FST_ERR_INVALID_URL","URL must be a string. Received '%s'",400,TypeError),FST_ERR_ROUTE_OPTIONS_NOT_OBJ:c("FST_ERR_ROUTE_OPTIONS_NOT_OBJ",'Options for "%s:%s" route must be an object',500,TypeError),FST_ERR_ROUTE_DUPLICATED_HANDLER:c("FST_ERR_ROUTE_DUPLICATED_HANDLER",'Duplicate handler for "%s:%s" route is not allowed!',500),FST_ERR_ROUTE_HANDLER_NOT_FN:c("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:c("FST_ERR_ROUTE_MISSING_HANDLER",'Missing handler function for "%s:%s" route.',500),FST_ERR_ROUTE_METHOD_INVALID:c("FST_ERR_ROUTE_METHOD_INVALID","Provided method is invalid!",500,TypeError),FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:c("FST_ERR_ROUTE_METHOD_NOT_SUPPORTED","%s method is not supported.",500),FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:c("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:c("FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT","'bodyLimit' option must be an integer > 0. Got '%s'",500,TypeError),FST_ERR_HANDLER_TIMEOUT:c("FST_ERR_HANDLER_TIMEOUT","Request timed out after %s ms on route '%s'",503),FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:c("FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT","'handlerTimeout' option must be an integer > 0. Got '%s'",500,TypeError),FST_ERR_ROUTE_REWRITE_NOT_STR:c("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:c("FST_ERR_REOPENED_CLOSE_SERVER","Fastify has already been closed and cannot be reopened"),FST_ERR_REOPENED_SERVER:c("FST_ERR_REOPENED_SERVER","Fastify is already listening"),FST_ERR_INSTANCE_ALREADY_LISTENING:c("FST_ERR_INSTANCE_ALREADY_LISTENING","Fastify instance is already listening. %s"),FST_ERR_PLUGIN_VERSION_MISMATCH:c("FST_ERR_PLUGIN_VERSION_MISMATCH","fastify-plugin: %s - expected '%s' fastify version, '%s' is installed"),FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE:c("FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE","The decorator '%s'%s is not present in %s"),FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER:c("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:c("FST_ERR_PLUGIN_CALLBACK_NOT_FN","fastify-plugin: %s",500,TypeError),FST_ERR_PLUGIN_NOT_VALID:c("FST_ERR_PLUGIN_NOT_VALID","fastify-plugin: %s"),FST_ERR_ROOT_PLG_BOOTED:c("FST_ERR_ROOT_PLG_BOOTED","fastify-plugin: %s"),FST_ERR_PARENT_PLUGIN_BOOTED:c("FST_ERR_PARENT_PLUGIN_BOOTED","fastify-plugin: %s"),FST_ERR_PLUGIN_TIMEOUT:c("FST_ERR_PLUGIN_TIMEOUT","fastify-plugin: %s")};function HN($,Z){return Z.cause=$,Z}AZ.exports=E$;AZ.exports.appendStackTrace=HN;AZ.exports.AVVIO_ERRORS_MAP={AVV_ERR_CALLBACK_NOT_FN:E$.FST_ERR_PLUGIN_CALLBACK_NOT_FN,AVV_ERR_PLUGIN_NOT_VALID:E$.FST_ERR_PLUGIN_NOT_VALID,AVV_ERR_ROOT_PLG_BOOTED:E$.FST_ERR_ROOT_PLG_BOOTED,AVV_ERR_PARENT_PLG_LOADED:E$.FST_ERR_PARENT_PLUGIN_BOOTED,AVV_ERR_READY_TIMEOUT:E$.FST_ERR_PLUGIN_TIMEOUT,AVV_ERR_PLUGIN_EXEC_TIMEOUT:E$.FST_ERR_PLUGIN_TIMEOUT}});var w$=I(($g,sG)=>{var MN=["onRoute","onRegister","onReady","onListen","preClose","onClose"],cG=["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError","onRequestAbort"],AN=cG.concat(MN),{FST_ERR_HOOK_INVALID_TYPE:FN,FST_ERR_HOOK_INVALID_HANDLER:NN,FST_ERR_SEND_UNDEFINED_ERR:FZ,FST_ERR_HOOK_TIMEOUT:ON,FST_ERR_HOOK_NOT_SUPPORTED:jN,AVVIO_ERRORS_MAP:uG,appendStackTrace:mG}=d0(),{kChildren:t8,kHooks:dG,kRequestPayloadStream:lG}=u0();function e8(){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=[]}e8.prototype=Object.create(null);e8.prototype.validate=function($,Z){if(typeof $!=="string")throw new FN;if(Array.isArray(this[$])===!1)throw new jN($);if(typeof Z!=="function")throw new NN($,Object.prototype.toString.call(Z))};e8.prototype.add=function($,Z){this.validate($,Z),this[$].push(Z)};function DN($){let Z=new e8;return Z.onRequest=$.onRequest.slice(),Z.preParsing=$.preParsing.slice(),Z.preValidation=$.preValidation.slice(),Z.preSerialization=$.preSerialization.slice(),Z.preHandler=$.preHandler.slice(),Z.onSend=$.onSend.slice(),Z.onResponse=$.onResponse.slice(),Z.onError=$.onError.slice(),Z.onRoute=$.onRoute.slice(),Z.onRegister=$.onRegister.slice(),Z.onTimeout=$.onTimeout.slice(),Z.onRequestAbort=$.onRequestAbort.slice(),Z.onReady=[],Z.onListen=[],Z.preClose=[],Z}function pG($,Z,Q,X){let Y=Q[dG][$],J=0,W=0;K();function G(U){let w=Y[J-1]?.name,H=w?` "${w}"`:"";if(U){if(U.code==="AVV_ERR_READY_TIMEOUT")U=mG(U,new ON($,H));else U=uG[U.code]!=null?mG(U,new uG[U.code](U.message)):U;X(U);return}X()}function K(U){if(U){G(U);return}if(J===Y.length&&W===Q[t8].length){if(J===0&&W===0)G();else Z(function(H,V){G(H),V(H)});return}if(J===Y.length&&W<Q[t8].length){let w=Q[t8][W++];pG($,Z,w,K);return}Z(B(Y[J++],Q)),K()}function B(U,w){return function(H,V){if(H){V(H);return}if(U.length===1){try{U.call(w,V)}catch(z){V(z)}return}try{let z=U.call(w);if(z&&typeof z.then==="function"){z.then(V,V);return}}catch(z){H=z}V(H)}}}function iG($){let Z=$[dG].onListen,Q=Z.length,X=0,Y=0;J();function J(G){if(G&&$.log.error(G),X===Q){while(Y<$[t8].length){let K=$[t8][Y++];iG(K)}return}W(Z[X++],$,J)}async function W(G,K,B){if(G.length===1){try{G.call(K,B)}catch(U){B(U)}return}try{let U=G.call(K);if(U&&typeof U.then==="function"){U.then(B,B);return}B()}catch(U){B(U)}}}function K8($){return function(Q,X,Y,J){let W=0;function G(U){if(U||W===Q.length){J(U,X,Y);return}let w;try{w=$(Q[W++],X,Y,G)}catch(H){J(H,X,Y);return}if(w&&typeof w.then==="function")w.then(K,B)}function K(){G()}function B(U){if(!U)U=new FZ;J(U,X,Y)}G()}}function TN($,Z,Q,X){return $(Z,Q,X)}var qN=K8(TN),fN=K8($6),LN=K8($6),RN=K8($6),PN=K8($6);function nG($,Z,Q,X,Y){let J=0;function W(B,U){if(B){Y(B,Z,Q,X);return}if(U!==void 0)X=U;if(J===$.length){Y(null,Z,Q,X);return}let w;try{w=$[J++](Z,Q,X,W)}catch(H){Y(H,Z,Q);return}if(w&&typeof w.then==="function")w.then(G,K)}function G(B){W(null,B)}function K(B){if(!B)B=new FZ;Y(B,Z,Q,X)}W()}var CN=nG;function EN($,Z,Q,X){let Y=0;function J(K,B){if(Q.sent)return;if(B!==void 0)Z[lG]=B;if(K||Y===$.length){X(K,Z,Q);return}let U;try{U=$[Y++](Z,Q,Z[lG],J)}catch(w){X(w,Z,Q);return}if(U&&typeof U.then==="function")U.then(W,G)}function W(K){J(null,K)}function G(K){if(!K)K=new FZ;X(K,Z,Q)}J()}function bN($,Z,Q){let X=0;function Y(G){if(G||X===$.length){Q(G,Z);return}let K;try{K=$[X++](Z,Y)}catch(B){Q(B,Z);return}if(K&&typeof K.then==="function")K.then(J,W)}function J(){Y()}function W(G){if(!G)G=new FZ;Q(G,Z)}Y()}function $6($,Z,Q,X){if(Q.sent===!0)return;return $(Z,Q,X)}sG.exports={Hooks:e8,buildHooks:DN,hookRunnerGenerator:K8,preParsingHookRunner:EN,onResponseHookRunner:qN,onSendHookRunner:nG,preSerializationHookRunner:CN,onRequestAbortHookRunner:bN,hookIterator:$6,hookRunnerApplication:pG,onListenHookRunner:iG,preHandlerHookRunner:LN,preValidationHookRunner:fN,onRequestHookRunner:PN,onTimeoutHookRunner:RN,lifecycleHooks:cG,supportedHooks:AN}});var oG=I((Zg,aG)=>{aG.exports=function(){return{[Symbol.iterator]:function*(){},add(){},delete(){},has(){return!0}}}});var YX=I((Qg,tG)=>{var{kTestInternals:_N}=u0();function rG(){let $,Z;return{promise:new Promise((X,Y)=>{$=X,Z=Y}),resolve:$,reject:Z}}tG.exports={withResolvers:typeof Promise.withResolvers==="function"?Promise.withResolvers.bind(Promise):rG,[_N]:{withResolvers:rG}}});var B9=I((iN,K9)=>{var IN=u("http"),SN=u("https"),eG=u("http2"),xN=u("dns"),kN=u("os"),{kState:y0,kOptions:vN,kServerBindings:yN,kHttp2ServerSessions:b$}=u0(),{FSTWRN003:gN}=G8(),{onListenHookRunner:NZ}=w$(),{FST_ERR_REOPENED_CLOSE_SERVER:Z9,FST_ERR_REOPENED_SERVER:Q9,FST_ERR_LISTEN_OPTIONS_INVALID:hN,FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:uN}=d0(),mN=oG(),X9=YX();iN.createServer=lN;function Y9($){return`Server listening at ${$}`}function lN($,Z){let Q=W9($,Z);function X(B={port:0,host:"localhost"},U=void 0){if(typeof U==="function"){if(U.constructor.name==="AsyncFunction")gN("listen method");B.cb=U}if(B.signal){if(typeof B.signal.on!=="function"&&typeof B.signal.addEventListener!=="function")throw new hN("Invalid options.signal");if(this[y0].aborted=B.signal.aborted,this[y0].aborted)return this.close();else{let H=()=>{this[y0].aborted=!0,this.close()};B.signal.addEventListener("abort",H,{once:!0})}}let w;if(B.path==null)w=B.host??"localhost";else w=B.host;if(!Object.hasOwn(B,"host")||B.host==null)B.host=w;if(w==="localhost")B.cb=(H,V)=>{if(H){U(H,V);return}$9.call(this,Q,Z,$,B,()=>{this[y0].listening=!0,U(null,V),NZ(this)})};else B.cb=(H,V)=>{if(H){U(H,V);return}this[y0].listening=!0,U(null,V),NZ(this)};if(U===void 0)return cN.call(this,Q,B).then((V)=>{let{promise:z,resolve:N}=X9.withResolvers();if(w==="localhost")$9.call(this,Q,Z,$,B,()=>{this[y0].listening=!0,N(V),NZ(this)});else N(V),NZ(this);return z});this.ready(J9.call(this,Q,B))}let Y=typeof Q.closeAllConnections==="function",J=typeof Q.closeIdleConnections==="function",W=typeof Q.closeHttp2Sessions==="function",G=$.forceCloseConnections;if(G==="idle"&&!J)throw new uN;else if(typeof G!=="boolean")G=J?"idle":!1;let K=!Y&&G===!0?new Set:mN();return{server:Q,listen:X,forceCloseConnections:G,serverHasCloseAllConnections:Y,serverHasCloseHttp2Sessions:W,keepAliveConnections:K}}function $9($,Z,Q,X,Y){this[y0].listening=!1,xN.lookup(X.host,{all:!0},(J,W)=>{if(J||this[y0].aborted){Y();return}let G=$.listening&&Q.serverFactory,K=0,B=0;if(!G){let w=$.address();for(let H of W)if(H.address!==w.address){K++;let V=Object.assign({},X,{host:H.address,port:w.port,cb:(F)=>{if(B++,!F)this[yN].push(z);if(B===K)Y()}}),z=W9(Q,Z),N=()=>{if(z.close(()=>{}),typeof z.closeAllConnections==="function"&&Q.forceCloseConnections===!0)z.closeAllConnections();if(typeof z.closeHttp2Sessions==="function")z.closeHttp2Sessions()};z.on("upgrade",$.emit.bind($,"upgrade")),$.on("unref",N),$.on("close",N),$.on("error",N),this[y0].listening=!1,J9.call(this,z,V)()}}if(K===0){Y();return}let U=$.unref;$.unref=function(){U.call($),$.emit("unref")}})}function J9($,Z){let Q=(X)=>{if($.removeListener("error",Q),$.removeListener("listening",Q),!X){let Y=G9.call(this,$,Z.listenTextResolver||Y9);Z.cb(null,Y)}else this[y0].listening=!1,Z.cb(X,null)};return(X)=>{if(X!=null)return Z.cb(X);if(this[y0].listening&&this[y0].closing)return Z.cb(new Z9,null);if(this[y0].listening)return Z.cb(new Q9,null);if($.once("error",Q),!this[y0].closing)$.once("listening",Q),$.listen(Z),this[y0].listening=!0}}function cN($,Z){if(this[y0].listening&&this[y0].closing)return Promise.reject(new Z9);if(this[y0].listening)return Promise.reject(new Q9);return this.ready().then(()=>{if(this[y0].aborted)return;let{promise:Q,resolve:X,reject:Y}=X9.withResolvers(),J=(K)=>{G(),this[y0].listening=!1,Y(K)},W=()=>{G(),this[y0].listening=!0,X(G9.call(this,$,Z.listenTextResolver||Y9))};function G(){$.removeListener("error",J),$.removeListener("listening",W)}return $.once("error",J),$.once("listening",W),$.listen(Z),Q})}function W9($,Z){if($.serverFactory)return $.serverFactory(Z,$);let Q=$.https===!0?{}:$.https;if($.http2){let Y=typeof Q==="object"?eG.createSecureServer(Q,Z):eG.createServer($.http,Z);if(Y.on("session",(J)=>J.setTimeout($.http2SessionTimeout,()=>{J.close()})),$.forceCloseConnections===!0)Y.closeHttp2Sessions=pN(Y);return Y.setTimeout($.connectionTimeout),Y}let X=Q?SN.createServer(Q,Z):IN.createServer($.http,Z);if(X.keepAliveTimeout=$.keepAliveTimeout,X.requestTimeout=$.requestTimeout,X.setTimeout($.connectionTimeout),$.maxRequestsPerSocket>0)X.maxRequestsPerSocket=$.maxRequestsPerSocket;return X}function dN($){if($.address==="0.0.0.0")return Object.values(kN.networkInterfaces()).flatMap((Z)=>{return Z.filter((Q)=>Q.family==="IPv4")}).sort((Z)=>{return Z.internal?-1:1}).map((Z)=>{return Z.address});return[$.address]}function G9($,Z){let Q;if(typeof $.address()!=="string"){if($.address().address.indexOf(":")===-1)Q=dN($.address()).map((Y)=>Y+":"+$.address().port);else Q=["["+$.address().address+"]:"+$.address().port];Q=Q.map((Y)=>"http"+(this[vN].https?"s":"")+"://"+Y)}else Q=[$.address()];for(let Y of Q)this.log.info(Z(Y));return Q[0]}function pN($){return $[b$]=new Set,$.on("session",function(Z){Z.once("connect",function(){$[b$].add(Z)}),Z.once("close",function(){$[b$].delete(Z)}),Z.once("frameError",function(Q,X,Y){if(Y===0)$[b$].delete(Z)}),Z.once("goaway",function(){$[b$].delete(Z)})}),function(){if($[b$].size===0)return;for(let Q of $[b$])Q.close()}}});var WX=I((Xg,V9)=>{var JX=/(?:^|;)\s*([\w!#$%&'*+.^`|~-]+)=([^;]*)/gm,U9=/^[\w!#$%&'*+.^`|~-]+$/,z9=/^[\w!#$%&'*+.^`|~-]+\s*$/;class w9{#$=!1;#Z=!0;#Q="";#X="";#Y=new Map;#J;constructor($){if($==null||$===""||$==="undefined")return;let Z=$.indexOf(";");if(Z===-1){if(Z=$.indexOf("/"),Z===-1)return;let G=$.slice(0,Z).trimStart().toLowerCase(),K=$.slice(Z+1).trimEnd().toLowerCase();if(U9.test(G)===!0&&z9.test(K)===!0)this.#$=!0,this.#Z=!1,this.#Q=G,this.#X=K;return}let Q=$.slice(0,Z).toLowerCase(),X=$.slice(Z+1).trim();if(Z=Q.indexOf("/"),Z===-1)return;let Y=Q.slice(0,Z).trimStart(),J=Q.slice(Z+1).trimEnd();if(U9.test(Y)===!1||z9.test(J)===!1)return;this.#Q=Y,this.#X=J,this.#$=!0,this.#Z=!1;let W=JX.exec(X);while(W){let G=W[1],K=W[2];if(K[0]==='"'){if(K.at(-1)!=='"'){this.#Y.set(G,"invalid quoted string"),W=JX.exec(X);continue}this.#Y.set(G,K.slice(1,K.length-1))}else this.#Y.set(G,K);W=JX.exec(X)}}get[Symbol.toStringTag](){return"ContentType"}get isEmpty(){return this.#Z}get isValid(){return this.#$}get mediaType(){return`${this.#Q}/${this.#X}`}get type(){return this.#Q}get subtype(){return this.#X}get parameters(){return this.#Y}toString(){if(this.#J)return this.#J;let $=[];for(let[Q,X]of this.#Y.entries())$.push(`${Q}="${X}"`);let Z=[this.#Q,"/",this.#X];if($.length>0)Z.push("; "),Z.push($.join("; "));return this.#J=Z.join(""),this.#J}}V9.exports=w9});var OZ=I((Yg,H9)=>{var{kReplyHasStatusCode:sN}=u0();function aN($,Z){if(!$[sN]||$.statusCode===200){let Q=Z&&(Z.statusCode||Z.status);$.code(Q>=400?Q:500)}}H9.exports={setErrorStatusCode:aN}});var GX=I((Jg,A9)=>{var{kReplyIsError:M9,kReplyHijacked:oN}=u0(),{setErrorStatusCode:rN}=OZ(),tN=u("diagnostics_channel"),Z6=tN.tracingChannel("fastify.request.handler");function eN($,Z,Q){if(Q)Q.async=!0;$.then(function(X){if(Z[oN]===!0)return;if(Q)Z6.asyncStart.publish(Q);try{if(X!==void 0||Z.sent===!1&&Z.raw.headersSent===!1&&Z.request.raw.aborted===!1&&Z.request.socket&&!Z.request.socket.destroyed)try{Z.send(X)}catch(Y){Z[M9]=!0,Z.send(Y)}}finally{if(Q)Z6.asyncEnd.publish(Q)}},function(X){if(Q)Q.error=X,rN(Z,X),Z6.error.publish(Q),Z6.asyncStart.publish(Q);try{if(Z.sent===!0){Z.log.error({err:X},"Promise errored, but reply.sent = true was set");return}Z[M9]=!0,Z.send(X)}catch(Y){Z.send(Y)}finally{if(Q)Z6.asyncEnd.publish(Q)}})}A9.exports=eN});var UX=I((Wg,N9)=>{var{kSchemaHeaders:TZ,kSchemaParams:KX,kSchemaQuerystring:BX,kSchemaBody:_$,kSchemaResponse:F9}=u0(),$O=/^[1-5](?:\d{2}|xx)$|^default$/,{FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX:ZO}=d0(),{FSTWRN001:jZ}=G8();function QO($,Z){if(!$.schema||!$.schema.response)return;let{method:Q,url:X}=$.config||{};$[F9]=Object.keys($.schema.response).reduce(function(Y,J){let W=$.schema.response[J];if(J=J.toLowerCase(),!$O.test(J))throw new ZO;if(W.content){let G={};for(let K of Object.keys(W.content)){let B=W.content[K].schema;G[K]=Z({schema:B,url:X,method:Q,httpStatus:J,contentType:K})}Y[J]=G}else Y[J]=Z({schema:W,url:X,method:Q,httpStatus:J});return Y},{})}function XO($,Z,Q){let{schema:X}=$;if(!X)return;let{method:Y,url:J}=$.config||{},W=X.headers;if(W&&(Q||Object.getPrototypeOf(W)!==Object.prototype))$[TZ]=Z({schema:W,method:Y,url:J,httpPart:"headers"});else if(W){let G={};if(Object.keys(W).forEach((K)=>{G[K]=W[K]}),G.required instanceof Array)G.required=G.required.map((K)=>K.toLowerCase());if(W.properties)G.properties={},Object.keys(W.properties).forEach((K)=>{G.properties[K.toLowerCase()]=W.properties[K]});$[TZ]=Z({schema:G,method:Y,url:J,httpPart:"headers"})}else if(Object.hasOwn(X,"headers"))jZ("headers",Y,J);if(X.body){let G=X.body.content;if(G){let K={};for(let B of Object.keys(G)){let U=G[B].schema;K[B]=Z({schema:U,method:Y,url:J,httpPart:"body",contentType:B})}$[_$]=K}else $[_$]=Z({schema:X.body,method:Y,url:J,httpPart:"body"})}else if(Object.hasOwn(X,"body"))jZ("body",Y,J);if(X.querystring)$[BX]=Z({schema:X.querystring,method:Y,url:J,httpPart:"querystring"});else if(Object.hasOwn(X,"querystring"))jZ("querystring",Y,J);if(X.params)$[KX]=Z({schema:X.params,method:Y,url:J,httpPart:"params"});else if(Object.hasOwn(X,"params"))jZ("params",Y,J)}function DZ($,Z,Q){let X=Z[Q]===void 0,Y;try{Y=$?.(X?null:Z[Q])}catch(W){return W.statusCode=500,W}if(Y&&typeof Y.then==="function")return Y.then((W)=>{return J(W)}).catch((W)=>{return W});return J(Y);function J(W){if(W===!1)return $.errors;if(W&&W.error)return W.error;if(W&&W.value)Z[Q]=W.value;return!1}}function qZ($,Z,Q){let X=Q===void 0;if(X||!Q.skipParams){let J=DZ($[KX],Z,"params");if(J)if(typeof J.then!=="function")return V$(J,"params",$.schemaErrorFormatter);else return YO(J,$,Z)}if(X||!Q.skipBody){let J=null;if(typeof $[_$]==="function")J=$[_$];else if($[_$]){let G=KO(Z.headers["content-type"]),K=$[_$][G];if(K)J=K}let W=DZ(J,Z,"body");if(W)if(typeof W.then!=="function")return V$(W,"body",$.schemaErrorFormatter);else return JO(W,$,Z)}if(X||!Q.skipQuery){let J=DZ($[BX],Z,"query");if(J)if(typeof J.then!=="function")return V$(J,"querystring",$.schemaErrorFormatter);else return WO(J,$,Z)}let Y=DZ($[TZ],Z,"headers");if(Y)if(typeof Y.then!=="function")return V$(Y,"headers",$.schemaErrorFormatter);else return GO(Y,$,Z);return!1}function YO($,Z,Q){return $.then((X)=>{if(X)return V$(X,"params",Z.schemaErrorFormatter);return qZ(Z,Q,{skipParams:!0})})}function JO($,Z,Q){return $.then((X)=>{if(X)return V$(X,"body",Z.schemaErrorFormatter);return qZ(Z,Q,{skipParams:!0,skipBody:!0})})}function WO($,Z,Q){return $.then((X)=>{if(X)return V$(X,"querystring",Z.schemaErrorFormatter);return qZ(Z,Q,{skipParams:!0,skipBody:!0,skipQuery:!0})})}function GO($,Z,Q){return $.then((X)=>{if(X)return V$(X,"headers",Z.schemaErrorFormatter);return!1})}function V$($,Z,Q){if($ instanceof Error)return $.statusCode=$.statusCode||400,$.code=$.code||"FST_ERR_VALIDATION",$.validationContext=$.validationContext||Z,$;let X=Q($,Z);return X.statusCode=X.statusCode||400,X.code=X.code||"FST_ERR_VALIDATION",X.validation=$,X.validationContext=Z,X}function KO($){if(!$)return"";return $.trimStart().split(/[ ;]/,1)[0].trim().toLowerCase()}N9.exports={symbols:{bodySchema:_$,querystringSchema:BX,responseSchema:F9,paramsSchema:KX,headersSchema:TZ},compileSchemasForValidation:XO,compileSchemasForSerialization:QO,validate:qZ}});var HX=I((Gg,VX)=>{var BO=u("diagnostics_channel"),UO=WX(),zO=GX(),{validate:wO}=UX(),{preValidationHookRunner:VO,preHandlerHookRunner:HO}=w$(),{FST_ERR_CTP_INVALID_MEDIA_TYPE:MO}=d0(),{setErrorStatusCode:O9}=OZ(),{kReplyIsError:X6,kRouteContext:u1,kFourOhFourContext:AO,kSupportedHTTPMethods:j9}=u0(),Q6=BO.tracingChannel("fastify.request.handler");function FO($,Z,Q){if(Q.sent===!0)return;if($!=null){Q[X6]=!0,Q.send($);return}let X=Z.method;if(this[j9].bodyless.has(X)){B8(Z,Q);return}if(this[j9].bodywith.has(X)){let Y=Z.headers,J=Y["content-type"];if(J===void 0){let G=Y["content-length"];if(Y["transfer-encoding"]===void 0&&(G===void 0||G==="0")){B8(Z,Q);return}Z[u1].contentTypeParser.run("",B8,Z,Q);return}let W=new UO(J);if(W.isValid===!1){Q[X6]=!0,Q.status(415).send(new MO);return}Z[u1].contentTypeParser.run(W.toString(),B8,Z,Q);return}B8(Z,Q)}function B8($,Z){try{if($[u1].preValidation!==null)VO($[u1].preValidation,$,Z,zX);else zX(null,$,Z)}catch(Q){zX(Q,$,Z)}}function zX($,Z,Q){if(Q.sent===!0)return;if($!=null){Q[X6]=!0,Q.send($);return}let X=wO(Q[u1],Z);if(X&&typeof X.then==="function"||!1){let J=D9.bind(null,Z,Q);X.then(J,J)}else D9(Z,Q,X)}function D9($,Z,Q){if(Q){if(Z[u1].attachValidation===!1){Z.send(Q);return}Z.request.validationError=Q}if($[u1].preHandler!==null)HO($[u1].preHandler,$,Z,wX);else wX(null,$,Z)}function wX($,Z,Q){if(Q.sent)return;let X=Z[u1];if(!Q6.hasSubscribers||X[AO]===null)T9($,Z,Q);else{let Y={request:Z,reply:Q,async:!1,route:{url:X.config.url,method:X.config.method}};Q6.start.runStores(Y,T9,void 0,$,Z,Q,Y)}}function T9($,Z,Q,X){let Y=Z[u1];try{if($!=null){if(Q[X6]=!0,X)X.error=$,O9(Q,$),Q6.error.publish(X);Q.send($);return}let J;try{J=Y.handler(Z,Q)}catch(W){if(X)X.error=W,O9(Q,W),Q6.error.publish(X);Q[X6]=!0,Q.send(W);return}if(J!==void 0)if(J!==null&&typeof J.then==="function")zO(J,Q,X);else Q.send(J)}finally{if(X)Q6.end.publish(X)}}VX.exports=FO;VX.exports[Symbol.for("internals")]={handler:B8,preHandlerCallback:wX}});var f9=I((Kg,q9)=>{function U8(){}var NO={fatal:U8,error:U8,warn:U8,info:U8,debug:U8,trace:U8};Object.defineProperty(q9,"exports",{get(){return Object.create(NO)}})});var AX=I((Bg,P9)=>{var Y6=($)=>{return $&&typeof $.message==="string"},MX=($)=>{if(!$)return;let Z=$.cause;if(typeof Z==="function"){let Q=$.cause();return Y6(Q)?Q:void 0}else return Y6(Z)?Z:void 0},L9=($,Z)=>{if(!Y6($))return"";let Q=$.stack||"";if(Z.has($))return Q+`
5
+ causes have become circular...`;let X=MX($);if(X)return Z.add($),Q+`
6
+ caused by: `+L9(X,Z);else return Q},OO=($)=>L9($,new Set),R9=($,Z,Q)=>{if(!Y6($))return"";let X=Q?"":$.message||"";if(Z.has($))return X+": ...";let Y=MX($);if(Y){Z.add($);let J=typeof $.cause==="function";return X+(J?"":": ")+R9(Y,Z,J)}else return X},jO=($)=>R9($,new Set);P9.exports={isErrorLike:Y6,getErrorCause:MX,stackWithCauses:OO,messageWithCauses:jO}});var FX=I((Ug,E9)=>{var DO=Symbol("circular-ref-tag"),fZ=Symbol("pino-raw-err-ref"),C9=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[fZ]},set:function($){this[fZ]=$}}});Object.defineProperty(C9,fZ,{writable:!0,value:{}});E9.exports={pinoErrProto:C9,pinoErrorSymbols:{seen:DO,rawSymbol:fZ}}});var I9=I((zg,_9)=>{_9.exports=OX;var{messageWithCauses:TO,stackWithCauses:qO,isErrorLike:b9}=AX(),{pinoErrProto:fO,pinoErrorSymbols:LO}=FX(),{seen:NX}=LO,{toString:RO}=Object.prototype;function OX($){if(!b9($))return $;$[NX]=void 0;let Z=Object.create(fO);if(Z.type=RO.call($.constructor)==="[object Function]"?$.constructor.name:$.name,Z.message=TO($),Z.stack=qO($),Array.isArray($.errors))Z.aggregateErrors=$.errors.map((Q)=>OX(Q));for(let Q in $)if(Z[Q]===void 0){let X=$[Q];if(b9(X)){if(Q!=="cause"&&!Object.prototype.hasOwnProperty.call(X,NX))Z[Q]=OX(X)}else Z[Q]=X}return delete $[NX],Z.raw=$,Z}});var x9=I((wg,S9)=>{S9.exports=RZ;var{isErrorLike:jX}=AX(),{pinoErrProto:PO,pinoErrorSymbols:CO}=FX(),{seen:LZ}=CO,{toString:EO}=Object.prototype;function RZ($){if(!jX($))return $;$[LZ]=void 0;let Z=Object.create(PO);if(Z.type=EO.call($.constructor)==="[object Function]"?$.constructor.name:$.name,Z.message=$.message,Z.stack=$.stack,Array.isArray($.errors))Z.aggregateErrors=$.errors.map((Q)=>RZ(Q));if(jX($.cause)&&!Object.prototype.hasOwnProperty.call($.cause,LZ))Z.cause=RZ($.cause);for(let Q in $)if(Z[Q]===void 0){let X=$[Q];if(jX(X)){if(!Object.prototype.hasOwnProperty.call(X,LZ))Z[Q]=RZ(X)}else Z[Q]=X}return delete $[LZ],Z.raw=$,Z}});var g9=I((Vg,y9)=>{y9.exports={mapHttpRequest:bO,reqSerializer:v9};var DX=Symbol("pino-raw-req-ref"),k9=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[DX]},set:function($){this[DX]=$}}});Object.defineProperty(k9,DX,{writable:!0,value:{}});function v9($){let Z=$.info||$.socket,Q=Object.create(k9);if(Q.id=typeof $.id==="function"?$.id():$.id||($.info?$.info.id:void 0),Q.method=$.method,$.originalUrl)Q.url=$.originalUrl;else{let X=$.path;Q.url=typeof X==="string"?X:$.url?$.url.path||$.url:void 0}if($.query)Q.query=$.query;if($.params)Q.params=$.params;return Q.headers=$.headers,Q.remoteAddress=Z&&Z.remoteAddress,Q.remotePort=Z&&Z.remotePort,Q.raw=$.raw||$,Q}function bO($){return{req:v9($)}}});var l9=I((Hg,m9)=>{m9.exports={mapHttpResponse:_O,resSerializer:u9};var TX=Symbol("pino-raw-res-ref"),h9=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[TX]},set:function($){this[TX]=$}}});Object.defineProperty(h9,TX,{writable:!0,value:{}});function u9($){let Z=Object.create(h9);return Z.statusCode=$.headersSent?$.statusCode:null,Z.headers=$.getHeaders?$.getHeaders():$._headers,Z.raw=$,Z}function _O($){return{res:u9($)}}});var fX=I((Mg,c9)=>{var qX=I9(),IO=x9(),PZ=g9(),CZ=l9();c9.exports={err:qX,errWithCause:IO,mapHttpRequest:PZ.mapHttpRequest,mapHttpResponse:CZ.mapHttpResponse,req:PZ.reqSerializer,res:CZ.resSerializer,wrapErrorSerializer:function(Z){if(Z===qX)return Z;return function(X){return Z(qX(X))}},wrapRequestSerializer:function(Z){if(Z===PZ.reqSerializer)return Z;return function(X){return Z(PZ.reqSerializer(X))}},wrapResponseSerializer:function(Z){if(Z===CZ.resSerializer)return Z;return function(X){return Z(CZ.resSerializer(X))}}}});var LX=I((Ag,d9)=>{function SO($,Z){return Z}d9.exports=function(){let Z=Error.prepareStackTrace;Error.prepareStackTrace=SO;let Q=Error().stack;if(Error.prepareStackTrace=Z,!Array.isArray(Q))return;let X=Q.slice(2),Y=[];for(let J of X){if(!J)continue;Y.push(J.getFileName())}return Y}});var o9=I((Fg,a9)=>{function RX($){if($===null||typeof $!=="object")return $;if($ instanceof Date)return new Date($.getTime());if($ instanceof Array){let Z=[];for(let Q=0;Q<$.length;Q++)Z[Q]=RX($[Q]);return Z}if(typeof $==="object"){let Z=Object.create(Object.getPrototypeOf($));for(let Q in $)if(Object.prototype.hasOwnProperty.call($,Q))Z[Q]=RX($[Q]);return Z}return $}function p9($){let Z=[],Q="",X=!1,Y=!1,J="";for(let W=0;W<$.length;W++){let G=$[W];if(!X&&G==="."){if(Q)Z.push(Q),Q=""}else if(G==="["){if(Q)Z.push(Q),Q="";X=!0}else if(G==="]"&&X)Z.push(Q),Q="",X=!1,Y=!1;else if((G==='"'||G==="'")&&X)if(!Y)Y=!0,J=G;else if(G===J)Y=!1,J="";else Q+=G;else Q+=G}if(Q)Z.push(Q);return Z}function i9($,Z,Q){let X=$;for(let J=0;J<Z.length-1;J++){let W=Z[J];if(typeof X!=="object"||X===null||!(W in X))return!1;if(typeof X[W]!=="object"||X[W]===null)return!1;X=X[W]}let Y=Z[Z.length-1];if(Y==="*"){if(Array.isArray(X))for(let J=0;J<X.length;J++)X[J]=Q;else if(typeof X==="object"&&X!==null){for(let J in X)if(Object.prototype.hasOwnProperty.call(X,J))X[J]=Q}}else if(typeof X==="object"&&X!==null&&Y in X&&Object.prototype.hasOwnProperty.call(X,Y))X[Y]=Q;return!0}function n9($,Z){let Q=$;for(let Y=0;Y<Z.length-1;Y++){let J=Z[Y];if(typeof Q!=="object"||Q===null||!(J in Q))return!1;if(typeof Q[J]!=="object"||Q[J]===null)return!1;Q=Q[J]}let X=Z[Z.length-1];if(X==="*"){if(Array.isArray(Q))for(let Y=0;Y<Q.length;Y++)Q[Y]=void 0;else if(typeof Q==="object"&&Q!==null){for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))delete Q[Y]}}else if(typeof Q==="object"&&Q!==null&&X in Q&&Object.prototype.hasOwnProperty.call(Q,X))delete Q[X];return!0}var EZ=Symbol("PATH_NOT_FOUND");function xO($,Z){let Q=$;for(let X of Z){if(Q===null||Q===void 0)return EZ;if(typeof Q!=="object"||Q===null)return EZ;if(!(X in Q))return EZ;Q=Q[X]}return Q}function kO($,Z){let Q=$;for(let X of Z){if(Q===null||Q===void 0)return;if(typeof Q!=="object"||Q===null)return;Q=Q[X]}return Q}function vO($,Z,Q,X=!1){for(let Y of Z){let J=p9(Y);if(J.includes("*"))s9($,J,Q,Y,X);else if(X)n9($,J);else{let W=xO($,J);if(W===EZ)continue;let G=typeof Q==="function"?Q(W,J):Q;i9($,J,G)}}}function s9($,Z,Q,X,Y=!1){let J=Z.indexOf("*");if(J===Z.length-1){let W=Z.slice(0,-1),G=$;for(let K of W){if(G===null||G===void 0)return;if(typeof G!=="object"||G===null)return;G=G[K]}if(Array.isArray(G))if(Y)for(let K=0;K<G.length;K++)G[K]=void 0;else for(let K=0;K<G.length;K++){let B=[...W,K.toString()],U=typeof Q==="function"?Q(G[K],B):Q;G[K]=U}else if(typeof G==="object"&&G!==null)if(Y){let K=[];for(let B in G)if(Object.prototype.hasOwnProperty.call(G,B))K.push(B);for(let B of K)delete G[B]}else for(let K in G){let B=[...W,K],U=typeof Q==="function"?Q(G[K],B):Q;G[K]=U}}else yO($,Z,Q,J,X,Y)}function yO($,Z,Q,X,Y,J=!1){let W=Z.slice(0,X),G=Z.slice(X+1),K=[];function B(U,w){if(w===W.length){if(Array.isArray(U))for(let H=0;H<U.length;H++)K[w]=H.toString(),B(U[H],w+1);else if(typeof U==="object"&&U!==null)for(let H in U)K[w]=H,B(U[H],w+1)}else if(w<W.length){let H=W[w];if(U&&typeof U==="object"&&U!==null&&H in U)K[w]=H,B(U[H],w+1)}else if(G.includes("*"))s9(U,G,typeof Q==="function"?(V,z)=>{let N=[...K.slice(0,w),...z];return Q(V,N)}:Q,Y,J);else if(J)n9(U,G);else{let H=typeof Q==="function"?Q(kO(U,G),[...K.slice(0,w),...G]):Q;i9(U,G,H)}}if(W.length===0)B($,0);else{let U=$;for(let w=0;w<W.length;w++){let H=W[w];if(U===null||U===void 0)return;if(typeof U!=="object"||U===null)return;U=U[H],K[w]=H}if(U!==null&&U!==void 0)B(U,W.length)}}function gO($){if($.length===0)return null;let Z=new Map;for(let Q of $){let X=p9(Q),Y=Z;for(let J=0;J<X.length;J++){let W=X[J];if(!Y.has(W))Y.set(W,new Map);Y=Y.get(W)}}return Z}function hO($,Z){if(!Z)return $;function Q(X,Y,J=0){if(!Y||Y.size===0)return X;if(X===null||typeof X!=="object")return X;if(X instanceof Date)return new Date(X.getTime());if(Array.isArray(X)){let G=[];for(let K=0;K<X.length;K++){let B=K.toString();if(Y.has(B)||Y.has("*"))G[K]=Q(X[K],Y.get(B)||Y.get("*"));else G[K]=X[K]}return G}let W=Object.create(Object.getPrototypeOf(X));for(let G in X)if(Object.prototype.hasOwnProperty.call(X,G))if(Y.has(G)||Y.has("*"))W[G]=Q(X[G],Y.get(G)||Y.get("*"));else W[G]=X[G];return W}return Q($,Z)}function uO($){if(typeof $!=="string")throw Error("Paths must be (non-empty) strings");if($==="")throw Error("Invalid redaction path ()");if($.includes(".."))throw Error(`Invalid redaction path (${$})`);if($.includes(","))throw Error(`Invalid redaction path (${$})`);let Z=0,Q=!1,X="";for(let Y=0;Y<$.length;Y++){let J=$[Y];if((J==='"'||J==="'")&&Z>0){if(!Q)Q=!0,X=J;else if(J===X)Q=!1,X=""}else if(J==="["&&!Q)Z++;else if(J==="]"&&!Q){if(Z--,Z<0)throw Error(`Invalid redaction path (${$})`)}}if(Z!==0)throw Error(`Invalid redaction path (${$})`)}function mO($){if(!Array.isArray($))throw TypeError("paths must be an array");for(let Z of $)uO(Z)}function lO($={}){let{paths:Z=[],censor:Q="[REDACTED]",serialize:X=JSON.stringify,strict:Y=!0,remove:J=!1}=$;mO(Z);let W=gO(Z);return function(K){if(Y&&(K===null||typeof K!=="object")){if(K===null||K===void 0)return X?X(K):K;if(typeof K!=="object")return X?X(K):K}let B=hO(K,W),U=K,w=Q;if(typeof Q==="function")w=Q;if(vO(B,Z,w,J),X===!1)return B.restore=function(){return RX(U)},B;if(typeof X==="function")return X(B);return JSON.stringify(B)}}a9.exports=lO});var z8=I((Ng,r9)=>{var cO=Symbol("pino.setLevel"),dO=Symbol("pino.getLevel"),pO=Symbol("pino.levelVal"),iO=Symbol("pino.levelComp"),nO=Symbol("pino.useLevelLabels"),sO=Symbol("pino.useOnlyCustomLevels"),aO=Symbol("pino.mixin"),oO=Symbol("pino.lsCache"),rO=Symbol("pino.chindings"),tO=Symbol("pino.asJson"),eO=Symbol("pino.write"),$j=Symbol("pino.redactFmt"),Zj=Symbol("pino.time"),Qj=Symbol("pino.timeSliceIndex"),Xj=Symbol("pino.stream"),Yj=Symbol("pino.stringify"),Jj=Symbol("pino.stringifySafe"),Wj=Symbol("pino.stringifiers"),Gj=Symbol("pino.end"),Kj=Symbol("pino.formatOpts"),Bj=Symbol("pino.messageKey"),Uj=Symbol("pino.errorKey"),zj=Symbol("pino.nestedKey"),wj=Symbol("pino.nestedKeyStr"),Vj=Symbol("pino.mixinMergeStrategy"),Hj=Symbol("pino.msgPrefix"),Mj=Symbol("pino.wildcardFirst"),Aj=Symbol.for("pino.serializers"),Fj=Symbol.for("pino.formatters"),Nj=Symbol.for("pino.hooks"),Oj=Symbol.for("pino.metadata");r9.exports={setLevelSym:cO,getLevelSym:dO,levelValSym:pO,levelCompSym:iO,useLevelLabelsSym:nO,mixinSym:aO,lsCacheSym:oO,chindingsSym:rO,asJsonSym:tO,writeSym:eO,serializersSym:Aj,redactFmtSym:$j,timeSym:Zj,timeSliceIndexSym:Qj,streamSym:Xj,stringifySym:Yj,stringifySafeSym:Jj,stringifiersSym:Wj,endSym:Gj,formatOptsSym:Kj,messageKeySym:Bj,errorKeySym:Uj,nestedKeySym:zj,wildcardFirstSym:Mj,needsMetadataGsym:Oj,useOnlyCustomLevelsSym:sO,formattersSym:Fj,hooksSym:Nj,nestedKeyStrSym:wj,mixinMergeStrategySym:Vj,msgPrefixSym:Hj}});var CX=I((Og,e9)=>{var t9=o9(),{redactFmtSym:jj,wildcardFirstSym:bZ}=z8(),PX=/[^.[\]]+|\[([^[\]]*?)\]/g;function Dj($,Z){let{paths:Q,censor:X,remove:Y}=Tj($),J=Q.reduce((K,B)=>{PX.lastIndex=0;let U=PX.exec(B),w=PX.exec(B),H=U[1]!==void 0?U[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):U[0];if(H==="*")H=bZ;if(w===null)return K[H]=null,K;if(K[H]===null)return K;let{index:V}=w,z=`${B.substr(V,B.length-1)}`;if(K[H]=K[H]||[],H!==bZ&&K[H].length===0)K[H].push(...K[bZ]||[]);if(H===bZ)Object.keys(K).forEach(function(N){if(K[N])K[N].push(z)});return K[H].push(z),K},{}),W={[jj]:t9({paths:Q,censor:X,serialize:Z,strict:!1,remove:Y})},G=(...K)=>{return typeof X==="function"?Z(X(...K)):Z(X)};return[...Object.keys(J),...Object.getOwnPropertySymbols(J)].reduce((K,B)=>{if(J[B]===null)K[B]=(U)=>G(U,[B]);else{let U=typeof X==="function"?(w,H)=>{return X(w,[B,...H])}:X;K[B]=t9({paths:J[B],censor:U,serialize:Z,strict:!1,remove:Y})}return K},W)}function Tj($){if(Array.isArray($))return $={paths:$,censor:"[Redacted]"},$;let{paths:Z,censor:Q="[Redacted]",remove:X}=$;if(Array.isArray(Z)===!1)throw Error("pino \u2013 redact must contain an array of strings");if(X===!0)Q=void 0;return{paths:Z,censor:Q,remove:X}}e9.exports=Dj});var Q4=I((jg,Z4)=>{var qj=()=>"",fj=()=>`,"time":${Date.now()}`,Lj=()=>`,"time":${Math.round(Date.now()/1000)}`,Rj=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,Pj=1000000n,$4=1000000000n,Cj=BigInt(Date.now())*Pj,Ej=process.hrtime.bigint(),bj=()=>{let $=process.hrtime.bigint()-Ej,Z=Cj+$,Q=Z/$4,X=Z%$4,Y=Number(Q*1000n+X/1000000n),J=new Date(Y),W=J.getUTCFullYear(),G=(J.getUTCMonth()+1).toString().padStart(2,"0"),K=J.getUTCDate().toString().padStart(2,"0"),B=J.getUTCHours().toString().padStart(2,"0"),U=J.getUTCMinutes().toString().padStart(2,"0"),w=J.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${W}-${G}-${K}T${B}:${U}:${w}.${X.toString().padStart(9,"0")}Z"`};Z4.exports={nullTime:qj,epochTime:fj,unixTime:Lj,isoTime:Rj,isoTimeNano:bj}});var Y4=I((Dg,X4)=>{function _j($){try{return JSON.stringify($)}catch(Z){return'"[Circular]"'}}X4.exports=Ij;function Ij($,Z,Q){var X=Q&&Q.stringify||_j,Y=1;if(typeof $==="object"&&$!==null){var J=Z.length+Y;if(J===1)return $;var W=Array(J);W[0]=X($);for(var G=1;G<J;G++)W[G]=X(Z[G]);return W.join(" ")}if(typeof $!=="string")return $;var K=Z.length;if(K===0)return $;var B="",U=1-Y,w=-1,H=$&&$.length||0;for(var V=0;V<H;){if($.charCodeAt(V)===37&&V+1<H){switch(w=w>-1?w:0,$.charCodeAt(V+1)){case 100:case 102:if(U>=K)break;if(Z[U]==null)break;if(w<V)B+=$.slice(w,V);B+=Number(Z[U]),w=V+2,V++;break;case 105:if(U>=K)break;if(Z[U]==null)break;if(w<V)B+=$.slice(w,V);B+=Math.floor(Number(Z[U])),w=V+2,V++;break;case 79:case 111:case 106:if(U>=K)break;if(Z[U]===void 0)break;if(w<V)B+=$.slice(w,V);var z=typeof Z[U];if(z==="string"){B+="'"+Z[U]+"'",w=V+2,V++;break}if(z==="function"){B+=Z[U].name||"<anonymous>",w=V+2,V++;break}B+=X(Z[U]),w=V+2,V++;break;case 115:if(U>=K)break;if(w<V)B+=$.slice(w,V);B+=String(Z[U]),w=V+2,V++;break;case 37:if(w<V)B+=$.slice(w,V);B+="%",w=V+2,V++,U--;break}++U}++V}if(w===-1)return $;else if(w<H)B+=$.slice(w);return B}});var bX=I((Tg,EX)=>{if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let Z=function(Q){if((Q>0&&Q<1/0)===!1){if(typeof Q!=="number"&&typeof Q!=="bigint")throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}Atomics.wait($,0,0,Number(Q))},$=new Int32Array(new SharedArrayBuffer(4));EX.exports=Z}else{let $=function(Z){if((Z>0&&Z<1/0)===!1){if(typeof Z!=="number"&&typeof Z!=="bigint")throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}let X=Date.now()+Number(Z);while(X>Date.now());};EX.exports=$}});var U4=I((qg,B4)=>{var P0=u("fs"),Sj=u("events"),xj=u("util").inherits,J4=u("path"),IX=bX(),kj=u("assert"),_Z=Buffer.allocUnsafe(0),[vj,yj]=(process.versions.node||"0.0").split(".").map(Number),gj=vj>=22&&yj>=7;function W4($,Z){Z._opening=!0,Z._writing=!0,Z._asyncDrainScheduled=!1;function Q(J,W){if(J){if(Z._reopening=!1,Z._writing=!1,Z._opening=!1,Z.sync)process.nextTick(()=>{if(Z.listenerCount("error")>0)Z.emit("error",J)});else Z.emit("error",J);return}let G=Z._reopening;if(Z.fd=W,Z.file=$,Z._reopening=!1,Z._opening=!1,Z._writing=!1,Z.sync)process.nextTick(()=>Z.emit("ready"));else Z.emit("ready");if(Z.destroyed)return;if(!Z._writing&&Z._len>Z.minLength||Z._flushPending)Z._actualWrite();else if(G)process.nextTick(()=>Z.emit("drain"))}let X=Z.append?"a":"w",Y=Z.mode;if(Z.sync)try{if(Z.mkdir)P0.mkdirSync(J4.dirname($),{recursive:!0});let J=P0.openSync($,X,Y);Q(null,J)}catch(J){throw Q(J),J}else if(Z.mkdir)P0.mkdir(J4.dirname($),{recursive:!0},(J)=>{if(J)return Q(J);P0.open($,X,Y,Q)});else P0.open($,X,Y,Q)}function S1($){if(!(this instanceof S1))return new S1($);let{fd:Z,dest:Q,minLength:X,maxLength:Y,maxWrite:J,periodicFlush:W,sync:G,append:K=!0,mkdir:B,retryEAGAIN:U,fsync:w,contentMode:H,mode:V}=$||{};Z=Z||Q,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(X||0,16387),this.file=null,this.destroyed=!1,this.minLength=X||0,this.maxLength=Y||0,this.maxWrite=J||16384,this._periodicFlush=W||0,this._periodicFlushTimer=void 0,this.sync=G||!1,this.writable=!0,this._fsync=w||!1,this.append=K||!1,this.mode=V,this.retryEAGAIN=U||(()=>!0),this.mkdir=B||!1;let z,N;if(H==="buffer")this._writingBuf=_Z,this.write=mj,this.flush=cj,this.flushSync=pj,this._actualWrite=nj,z=()=>P0.writeSync(this.fd,this._writingBuf),N=()=>P0.write(this.fd,this._writingBuf,this.release);else if(H===void 0||H==="utf8")this._writingBuf="",this.write=uj,this.flush=lj,this.flushSync=dj,this._actualWrite=ij,z=()=>{if(Buffer.isBuffer(this._writingBuf))return P0.writeSync(this.fd,this._writingBuf);return P0.writeSync(this.fd,this._writingBuf,"utf8")},N=()=>{if(Buffer.isBuffer(this._writingBuf))return P0.write(this.fd,this._writingBuf,this.release);return P0.write(this.fd,this._writingBuf,"utf8",this.release)};else throw Error(`SonicBoom supports "utf8" and "buffer", but passed ${H}`);if(typeof Z==="number")this.fd=Z,process.nextTick(()=>this.emit("ready"));else if(typeof Z==="string")W4(Z,this);else throw Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);if(this.release=(F,O)=>{if(F){if((F.code==="EAGAIN"||F.code==="EBUSY")&&this.retryEAGAIN(F,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{IX(100),this.release(void 0,0)}catch(A){this.release(A)}else setTimeout(N,100);else this._writing=!1,this.emit("error",F);return}this.emit("write",O);let j=_X(this._writingBuf,this._len,O);if(this._len=j.len,this._writingBuf=j.writingBuf,this._writingBuf.length){if(!this.sync){N();return}try{do{let A=z(),D=_X(this._writingBuf,this._len,A);this._len=D.len,this._writingBuf=D.writingBuf}while(this._writingBuf.length)}catch(A){this.release(A);return}}if(this._fsync)P0.fsyncSync(this.fd);let M=this._len;if(this._reopening)this._writing=!1,this._reopening=!1,this.reopen();else if(M>this.minLength)this._actualWrite();else if(this._ending)if(M>0)this._actualWrite();else this._writing=!1,IZ(this);else if(this._writing=!1,this.sync){if(!this._asyncDrainScheduled)this._asyncDrainScheduled=!0,process.nextTick(hj,this)}else this.emit("drain")},this.on("newListener",function(F){if(F==="drain")this._asyncDrainScheduled=!1}),this._periodicFlush!==0)this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref()}function _X($,Z,Q){if(typeof $==="string")$=Buffer.from($);return Z=Math.max(Z-Q,0),$=$.subarray(Q),{writingBuf:$,len:Z}}function hj($){if(!($.listenerCount("drain")>0))return;$._asyncDrainScheduled=!1,$.emit("drain")}xj(S1,Sj);function G4($,Z){if($.length===0)return _Z;if($.length===1)return $[0];return Buffer.concat($,Z)}function uj($){if(this.destroyed)throw Error("SonicBoom destroyed");$=""+$;let Z=Buffer.byteLength($),Q=this._len+Z,X=this._bufs;if(this.maxLength&&Q>this.maxLength)return this.emit("drop",$),this._len<this._hwm;if(X.length===0||Buffer.byteLength(X[X.length-1])+Z>this.maxWrite)X.push($);else X[X.length-1]+=$;if(this._len=Q,!this._writing&&this._len>=this.minLength)this._actualWrite();return this._len<this._hwm}function mj($){if(this.destroyed)throw Error("SonicBoom destroyed");let Z=this._len+$.length,Q=this._bufs,X=this._lens;if(this.maxLength&&Z>this.maxLength)return this.emit("drop",$),this._len<this._hwm;if(Q.length===0||X[X.length-1]+$.length>this.maxWrite)Q.push([$]),X.push($.length);else Q[Q.length-1].push($),X[X.length-1]+=$.length;if(this._len=Z,!this._writing&&this._len>=this.minLength)this._actualWrite();return this._len<this._hwm}function K4($){this._flushPending=!0;let Z=()=>{if(!this._fsync)try{P0.fsync(this.fd,(X)=>{this._flushPending=!1,$(X)})}catch(X){$(X)}else this._flushPending=!1,$();this.off("error",Q)},Q=(X)=>{this._flushPending=!1,$(X),this.off("drain",Z)};this.once("drain",Z),this.once("error",Q)}function lj($){if($!=null&&typeof $!=="function")throw Error("flush cb must be a function");if(this.destroyed){let Z=Error("SonicBoom destroyed");if($){$(Z);return}throw Z}if(this.minLength<=0){$?.();return}if($)K4.call(this,$);if(this._writing)return;if(this._bufs.length===0)this._bufs.push("");this._actualWrite()}function cj($){if($!=null&&typeof $!=="function")throw Error("flush cb must be a function");if(this.destroyed){let Z=Error("SonicBoom destroyed");if($){$(Z);return}throw Z}if(this.minLength<=0){$?.();return}if($)K4.call(this,$);if(this._writing)return;if(this._bufs.length===0)this._bufs.push([]),this._lens.push(0);this._actualWrite()}S1.prototype.reopen=function($){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen($)});return}if(this._ending)return;if(!this.file)throw Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if($)this.file=$;if(this._reopening=!0,this._writing)return;let Z=this.fd;this.once("ready",()=>{if(Z!==this.fd)P0.close(Z,(Q)=>{if(Q)return this.emit("error",Q)})}),W4(this.file,this)};S1.prototype.end=function(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}if(this._ending)return;if(this._ending=!0,this._writing)return;if(this._len>0&&this.fd>=0)this._actualWrite();else IZ(this)};function dj(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");if(!this._writing&&this._writingBuf.length>0)this._bufs.unshift(this._writingBuf),this._writingBuf="";let $="";while(this._bufs.length||$.length){if($.length<=0)$=this._bufs[0];try{let Z=Buffer.isBuffer($)?P0.writeSync(this.fd,$):P0.writeSync(this.fd,$,"utf8"),Q=_X($,this._len,Z);if($=Q.writingBuf,this._len=Q.len,$.length<=0)this._bufs.shift()}catch(Z){if((Z.code==="EAGAIN"||Z.code==="EBUSY")&&!this.retryEAGAIN(Z,$.length,this._len-$.length))throw Z;IX(100)}}try{P0.fsyncSync(this.fd)}catch{}}function pj(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");if(!this._writing&&this._writingBuf.length>0)this._bufs.unshift([this._writingBuf]),this._writingBuf=_Z;let $=_Z;while(this._bufs.length||$.length){if($.length<=0)$=G4(this._bufs[0],this._lens[0]);try{let Z=P0.writeSync(this.fd,$);if($=$.subarray(Z),this._len=Math.max(this._len-Z,0),$.length<=0)this._bufs.shift(),this._lens.shift()}catch(Z){if((Z.code==="EAGAIN"||Z.code==="EBUSY")&&!this.retryEAGAIN(Z,$.length,this._len-$.length))throw Z;IX(100)}}}S1.prototype.destroy=function(){if(this.destroyed)return;IZ(this)};function ij(){let $=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let Z=Buffer.isBuffer(this._writingBuf)?P0.writeSync(this.fd,this._writingBuf):P0.writeSync(this.fd,this._writingBuf,"utf8");$(null,Z)}catch(Z){$(Z)}else P0.write(this.fd,this._writingBuf,$)}function nj(){let $=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:G4(this._bufs.shift(),this._lens.shift()),this.sync)try{let Z=P0.writeSync(this.fd,this._writingBuf);$(null,Z)}catch(Z){$(Z)}else{if(gj)this._writingBuf=Buffer.from(this._writingBuf);P0.write(this.fd,this._writingBuf,$)}}function IZ($){if($.fd===-1){$.once("ready",IZ.bind(null,$));return}if($._periodicFlushTimer!==void 0)clearInterval($._periodicFlushTimer);$.destroyed=!0,$._bufs=[],$._lens=[],kj(typeof $.fd==="number",`sonic.fd must be a number, got ${typeof $.fd}`);try{P0.fsync($.fd,Z)}catch{}function Z(){if($.fd!==1&&$.fd!==2)P0.close($.fd,Q);else Q()}function Q(X){if(X){$.emit("error",X);return}if($._ending&&!$._writing)$.emit("finish");$.emit("close")}}S1.SonicBoom=S1;S1.default=S1;B4.exports=S1});var SX=I((fg,M4)=>{var x1={exit:[],beforeExit:[]},z4={exit:oj,beforeExit:rj},w8;function sj(){if(w8===void 0)w8=new FinalizationRegistry(tj)}function aj($){if(x1[$].length>0)return;process.on($,z4[$])}function w4($){if(x1[$].length>0)return;if(process.removeListener($,z4[$]),x1.exit.length===0&&x1.beforeExit.length===0)w8=void 0}function oj(){V4("exit")}function rj(){V4("beforeExit")}function V4($){for(let Z of x1[$]){let Q=Z.deref(),X=Z.fn;if(Q!==void 0)X(Q,$)}x1[$]=[]}function tj($){for(let Z of["exit","beforeExit"]){let Q=x1[Z].indexOf($);x1[Z].splice(Q,Q+1),w4(Z)}}function H4($,Z,Q){if(Z===void 0)throw Error("the object can't be undefined");aj($);let X=new WeakRef(Z);X.fn=Q,sj(),w8.register(Z,X),x1[$].push(X)}function ej($,Z){H4("exit",$,Z)}function $D($,Z){H4("beforeExit",$,Z)}function ZD($){if(w8===void 0)return;w8.unregister($);for(let Z of["exit","beforeExit"])x1[Z]=x1[Z].filter((Q)=>{let X=Q.deref();return X&&X!==$}),w4(Z)}M4.exports={register:ej,registerBeforeExit:$D,unregister:ZD}});var A4=I((Lg,QD)=>{QD.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 N4=I((Rg,F4)=>{function XD($,Z,Q,X,Y){let J=X===1/0?1/0:Date.now()+X,W=()=>{let G=Atomics.load($,Z);if(G===Q){Y(null,"ok");return}if(J!==1/0&&Date.now()>J){Y(null,"timed-out");return}let K=J===1/0?1e4:Math.min(1e4,Math.max(1,J-Date.now())),B=Atomics.waitAsync($,Z,G,K);if(B.async)B.value.then(W);else setImmediate(W)};W()}function YD($,Z,Q,X,Y){let J=X===1/0?1/0:Date.now()+X,W=()=>{if(Atomics.load($,Z)!==Q){Y(null,"ok");return}if(J!==1/0&&Date.now()>J){Y(null,"timed-out");return}let K=J===1/0?1e4:Math.min(1e4,Math.max(1,J-Date.now())),B=Atomics.waitAsync($,Z,Q,K);if(B.async)B.value.then(W);else setImmediate(W)};W()}F4.exports={wait:XD,waitDiff:YD}});var j4=I((Pg,O4)=>{O4.exports={WRITE_INDEX:4,READ_INDEX:8}});var R4=I((Cg,L4)=>{var __dirname="/root/muxcode-source/node_modules/.bun/thread-stream@4.0.0/node_modules/thread-stream",{version:JD}=A4(),{EventEmitter:WD}=u("events"),{Worker:GD}=u("worker_threads"),{join:KD}=u("path"),{pathToFileURL:BD}=u("url"),{wait:UD}=N4(),{WRITE_INDEX:U1,READ_INDEX:B1}=j4(),zD=u("buffer"),wD=u("assert"),g=Symbol("kImpl"),VD=zD.constants.MAX_STRING_LENGTH;class xZ{constructor($){this._value=$}deref(){return this._value}}class kX{register(){}unregister(){}}var HD=process.env.NODE_V8_COVERAGE?kX:global.FinalizationRegistry||kX,MD=process.env.NODE_V8_COVERAGE?xZ:global.WeakRef||xZ,D4=new HD(($)=>{if($.exited)return;$.terminate()});function AD($,Z){let{filename:Q,workerData:X}=Z,J=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||KD(__dirname,"lib","worker.js"),W=new GD(J,{...Z.workerOpts,trackUnmanagedFds:!1,workerData:{filename:Q.indexOf("file://")===0?Q:BD(Q).href,dataBuf:$[g].dataBuf,stateBuf:$[g].stateBuf,workerData:{$context:{threadStreamVersion:JD},...X}}});return W.stream=new xZ($),W.on("message",FD),W.on("exit",q4),D4.register($,W),W}function T4($){if(wD(!$[g].sync),$[g].needDrain)$[g].needDrain=!1,$.emit("drain")}function SZ($){let Z=Atomics.load($[g].state,U1),Q=$[g].data.length-Z;if(Q>0){if($[g].buf.length===0){if($[g].flushing=!1,$[g].ending)gX($);else if($[g].needDrain)process.nextTick(T4,$);return}let X=$[g].buf.slice(0,Q),Y=Buffer.byteLength(X);if(Y<=Q)$[g].buf=$[g].buf.slice(Q),kZ($,X,SZ.bind(null,$));else $.flush(()=>{if($.destroyed)return;Atomics.store($[g].state,B1,0),Atomics.store($[g].state,U1,0),Atomics.notify($[g].state,B1);while(Y>$[g].data.length)Q=Q/2,X=$[g].buf.slice(0,Q),Y=Buffer.byteLength(X);$[g].buf=$[g].buf.slice(Q),kZ($,X,SZ.bind(null,$))})}else if(Q===0){if(Z===0&&$[g].buf.length===0)return;$.flush(()=>{Atomics.store($[g].state,B1,0),Atomics.store($[g].state,U1,0),Atomics.notify($[g].state,B1),SZ($)})}else m1($,Error("overwritten"))}function FD($){let Z=this.stream.deref();if(Z===void 0){this.exited=!0,this.terminate();return}switch($.code){case"READY":this.stream=new MD(Z),Z.flush(()=>{Z[g].ready=!0,Z.emit("ready")});break;case"ERROR":m1(Z,$.err);break;case"EVENT":if(Array.isArray($.args))Z.emit($.name,...$.args);else Z.emit($.name,$.args);break;case"WARNING":process.emitWarning($.err);break;default:m1(Z,Error("this should not happen: "+$.code))}}function q4($){let Z=this.stream.deref();if(Z===void 0)return;D4.unregister(Z),Z.worker.exited=!0,Z.worker.off("exit",q4),m1(Z,$!==0?Error("the worker thread exited"):null)}class f4 extends WD{constructor($={}){super();if($.bufferSize<4)throw Error("bufferSize must at least fit a 4-byte utf-8 char");this[g]={},this[g].stateBuf=new SharedArrayBuffer(128),this[g].state=new Int32Array(this[g].stateBuf),this[g].dataBuf=new SharedArrayBuffer($.bufferSize||4194304),this[g].data=Buffer.from(this[g].dataBuf),this[g].sync=$.sync||!1,this[g].ending=!1,this[g].ended=!1,this[g].needDrain=!1,this[g].destroyed=!1,this[g].flushing=!1,this[g].ready=!1,this[g].finished=!1,this[g].errored=null,this[g].closed=!1,this[g].buf="",this.worker=AD(this,$),this.on("message",(Z,Q)=>{this.worker.postMessage(Z,Q)})}write($){if(this[g].destroyed)return vX(this,Error("the worker has exited")),!1;if(this[g].ending)return vX(this,Error("the worker is ending")),!1;if(this[g].flushing&&this[g].buf.length+$.length>=VD)try{xX(this),this[g].flushing=!0}catch(Z){return m1(this,Z),!1}if(this[g].buf+=$,this[g].sync)try{return xX(this),!0}catch(Z){return m1(this,Z),!1}if(!this[g].flushing)this[g].flushing=!0,setImmediate(SZ,this);return this[g].needDrain=this[g].data.length-this[g].buf.length-Atomics.load(this[g].state,U1)<=0,!this[g].needDrain}end(){if(this[g].destroyed)return;this[g].ending=!0,gX(this)}flush($){if(this[g].destroyed){if(typeof $==="function")process.nextTick($,Error("the worker has exited"));return}let Z=Atomics.load(this[g].state,U1);UD(this[g].state,B1,Z,1/0,(Q,X)=>{if(Q){m1(this,Q),process.nextTick($,Q);return}if(X==="not-equal"){this.flush($);return}process.nextTick($)})}flushSync(){if(this[g].destroyed)return;xX(this),yX(this)}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[g].ready}get destroyed(){return this[g].destroyed}get closed(){return this[g].closed}get writable(){return!this[g].destroyed&&!this[g].ending}get writableEnded(){return this[g].ending}get writableFinished(){return this[g].finished}get writableNeedDrain(){return this[g].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[g].errored}}function vX($,Z){setImmediate(()=>{$.emit("error",Z)})}function m1($,Z){if($[g].destroyed)return;if($[g].destroyed=!0,Z)$[g].errored=Z,vX($,Z);if(!$.worker.exited)$.worker.terminate().catch(()=>{}).then(()=>{$[g].closed=!0,$.emit("close")});else setImmediate(()=>{$[g].closed=!0,$.emit("close")})}function kZ($,Z,Q){let X=Atomics.load($[g].state,U1),Y=Buffer.byteLength(Z);return $[g].data.write(Z,X),Atomics.store($[g].state,U1,X+Y),Atomics.notify($[g].state,U1),Q(),!0}function gX($){if($[g].ended||!$[g].ending||$[g].flushing)return;$[g].ended=!0;try{$.flushSync();let Z=Atomics.load($[g].state,B1);Atomics.store($[g].state,U1,-1),Atomics.notify($[g].state,U1);let Q=0;while(Z!==-1){if(Atomics.wait($[g].state,B1,Z,1000),Z=Atomics.load($[g].state,B1),Z===-2){m1($,Error("end() failed"));return}if(++Q===10){m1($,Error("end() took too long (10s)"));return}}process.nextTick(()=>{$[g].finished=!0,$.emit("finish")})}catch(Z){m1($,Z)}}function xX($){let Z=()=>{if($[g].ending)gX($);else if($[g].needDrain)process.nextTick(T4,$)};$[g].flushing=!1;while($[g].buf.length!==0){let Q=Atomics.load($[g].state,U1),X=$[g].data.length-Q;if(X===0){yX($),Atomics.store($[g].state,B1,0),Atomics.store($[g].state,U1,0),Atomics.notify($[g].state,B1);continue}else if(X<0)throw Error("overwritten");let Y=$[g].buf.slice(0,X),J=Buffer.byteLength(Y);if(J<=X)$[g].buf=$[g].buf.slice(X),kZ($,Y,Z);else{yX($),Atomics.store($[g].state,B1,0),Atomics.store($[g].state,U1,0),Atomics.notify($[g].state,B1);while(J>$[g].buf.length)X=X/2,Y=$[g].buf.slice(0,X),J=Buffer.byteLength(Y);$[g].buf=$[g].buf.slice(X),kZ($,Y,Z)}}}function yX($){if($[g].flushing)throw Error("unable to flush while flushing");let Z=Atomics.load($[g].state,U1),Q=0;while(!0){let X=Atomics.load($[g].state,B1);if(X===-2)throw Error("_flushSync failed");if(X!==Z)Atomics.wait($[g].state,B1,X,1000);else break;if(++Q===10)throw Error("_flushSync took too long (10s)")}}L4.exports=f4});var mX=I((Eg,E4)=>{var __dirname="/root/muxcode-source/node_modules/.bun/pino@10.3.1/node_modules/pino/lib",{createRequire:ND}=u("module"),{existsSync:OD}=u("fs"),jD=LX(),{join:hX,isAbsolute:C4,sep:DD}=u("path"),{fileURLToPath:TD}=u("url"),qD=bX(),uX=SX(),fD=R4();function LD($){uX.register($,bD),uX.registerBeforeExit($,_D),$.on("close",function(){uX.unregister($)})}function RD(){let $=process.execArgv;for(let Z=0;Z<$.length;Z++){let Q=$[Z];if(Q==="--import"||Q==="--require"||Q==="-r")return!0;if(Q.startsWith("--import=")||Q.startsWith("--require=")||Q.startsWith("-r="))return!0}return!1}function PD($){let Z=$.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!Z)return $;let Q=[],X=!1;for(let Y=0;Y<Z.length;Y++){let J=Z[Y];if(J==="--require"||J==="-r"||J==="--import"){let W=Z[Y+1];if(W&&P4(W)){X=!0,Y++;continue}if(Q.push(J),W)Q.push(W),Y++;continue}if(J.startsWith("--require=")||J.startsWith("-r=")||J.startsWith("--import=")){let W=J.slice(J.indexOf("=")+1);if(P4(W)){X=!0;continue}}Q.push(J)}return X?Q.join(" "):$}function P4($){let Z=CD($);if(!Z)return!1;let Q=Z;if(Q.startsWith("file://"))try{Q=TD(Q)}catch{return!1}return C4(Q)&&!OD(Q)}function CD($){let Z=$[0],Q=$[$.length-1];if(Z==='"'&&Q==='"'||Z==="'"&&Q==="'")return $.slice(1,-1);return $}function ED($,Z,Q,X,Y){if(!Q.execArgv&&RD()&&u.main===void 0)Q={...Q,execArgv:[]};if(!Q.env&&process.env.NODE_OPTIONS){let K=PD(process.env.NODE_OPTIONS);if(K!==process.env.NODE_OPTIONS)Q={...Q,env:{...process.env,NODE_OPTIONS:K}}}Q={...Q,name:Y};let J=new fD({filename:$,workerData:Z,workerOpts:Q,sync:X});J.on("ready",W),J.on("close",function(){process.removeListener("exit",G)}),process.on("exit",G);function W(){if(process.removeListener("exit",G),J.unref(),Q.autoEnd!==!1)LD(J)}function G(){if(J.closed)return;J.flushSync(),qD(100),J.end()}return J}function bD($){$.ref(),$.flushSync(),$.end(),$.once("close",function(){$.unref()})}function _D($){$.flushSync()}function ID($){let{pipeline:Z,targets:Q,levels:X,dedupe:Y,worker:J={},caller:W=jD(),sync:G=!1}=$,K={...$.options},B=typeof W==="string"?[W]:W,U=typeof globalThis==="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==="object"?globalThis.__bundlerPathsOverrides:Object.create(null),w=$.target;if(w&&Q)throw Error("only one of target or targets can be specified");if(Q)w=U["pino-worker"]||hX(__dirname,"worker.js"),K.targets=Q.filter((z)=>z.target).map((z)=>{return{...z,target:V(z.target)}}),K.pipelines=Q.filter((z)=>z.pipeline).map((z)=>{return z.pipeline.map((N)=>{return{...N,level:z.level,target:V(N.target)}})});else if(Z)w=U["pino-worker"]||hX(__dirname,"worker.js"),K.pipelines=[Z.map((z)=>{return{...z,target:V(z.target)}})];if(X)K.levels=X;if(Y)K.dedupe=Y;K.pinoWillSendConfig=!0;let H=Q||Z?"pino.transport":w;return ED(V(w),K,J,G,H);function V(z){if(z=U[z]||z,C4(z)||z.indexOf("file://")===0)return z;if(z==="pino/file")return hX(__dirname,"..","file.js");let N;for(let F of B)try{let O=F==="node:repl"?process.cwd()+DD:F;N=ND(O).resolve(z);break}catch(O){continue}if(!N)throw Error(`unable to determine transport target for "${z}"`);return N}}E4.exports=ID});var gZ=I((_g,l4)=>{var SD=u("diagnostics_channel"),b4=Y4(),{mapHttpRequest:xD,mapHttpResponse:kD}=fX(),cX=U4(),_4=SX(),{lsCacheSym:vD,chindingsSym:v4,writeSym:I4,serializersSym:y4,formatOptsSym:S4,endSym:yD,stringifiersSym:g4,stringifySym:h4,stringifySafeSym:dX,wildcardFirstSym:u4,nestedKeySym:gD,formattersSym:m4,messageKeySym:hD,errorKeySym:uD,nestedKeyStrSym:mD,msgPrefixSym:vZ}=z8(),{isMainThread:lD}=u("worker_threads"),cD=mX(),[dD]=process.versions.node.split(".").map(($)=>Number($)),x4=SD.tracingChannel("pino_asJson"),lX=dD>=25?($)=>JSON.stringify($):iD;function V8(){}function pD($,Z){if(!Z)return Q;return function(...Y){Z.call(this,Y,Q,$)};function Q(X,...Y){if(typeof X==="object"){let J=X;if(X!==null){if(X.method&&X.headers&&X.socket)X=xD(X);else if(typeof X.setHeader==="function")X=kD(X)}let W;if(J===null&&Y.length===0)W=[null];else J=Y.shift(),W=Y;if(typeof this[vZ]==="string"&&J!==void 0&&J!==null)J=this[vZ]+J;this[I4](X,b4(J,W,this[S4]),$)}else{let J=X===void 0?Y.shift():X;if(typeof this[vZ]==="string"&&J!==void 0&&J!==null)J=this[vZ]+J;this[I4](null,b4(J,Y,this[S4]),$)}}}function iD($){let Z="",Q=0,X=!1,Y=255,J=$.length;if(J>100)return JSON.stringify($);for(var W=0;W<J&&Y>=32;W++)if(Y=$.charCodeAt(W),Y===34||Y===92)Z+=$.slice(Q,W)+"\\",Q=W,X=!0;if(!X)Z=$;else Z+=$.slice(Q);return Y<32?JSON.stringify($):'"'+Z+'"'}function nD($,Z,Q,X){if(x4.hasSubscribers===!1)return k4.call(this,$,Z,Q,X);let Y={instance:this,arguments};return x4.traceSync(k4,Y,this,$,Z,Q,X)}function k4($,Z,Q,X){let Y=this[h4],J=this[dX],W=this[g4],G=this[yD],K=this[v4],B=this[y4],U=this[m4],w=this[hD],H=this[uD],V=this[vD][Q]+X;V=V+K;let z;if(U.log)$=U.log($);let N=W[u4],F="";for(let j in $)if(z=$[j],Object.prototype.hasOwnProperty.call($,j)&&z!==void 0){if(B[j])z=B[j](z);else if(j===H&&B.err)z=B.err(z);let M=W[j]||N;switch(typeof z){case"undefined":case"function":continue;case"number":if(Number.isFinite(z)===!1)z=null;case"boolean":if(M)z=M(z);break;case"string":z=(M||lX)(z);break;default:z=(M||Y)(z,J)}if(z===void 0)continue;let A=lX(j);F+=","+A+":"+z}let O="";if(Z!==void 0){z=B[w]?B[w](Z):Z;let j=W[w]||N;switch(typeof z){case"function":break;case"number":if(Number.isFinite(z)===!1)z=null;case"boolean":if(j)z=j(z);O=',"'+w+'":'+z;break;case"string":z=(j||lX)(z),O=',"'+w+'":'+z;break;default:z=(j||Y)(z,J),O=',"'+w+'":'+z}}if(this[gD]&&F)return V+this[mD]+F.slice(1)+"}"+O+G;else return V+F+O+G}function sD($,Z){let Q,X=$[v4],Y=$[h4],J=$[dX],W=$[g4],G=W[u4],K=$[y4],B=$[m4].bindings;Z=B(Z);for(let U in Z)if(Q=Z[U],((U.length<5||U!=="level"&&U!=="serializers"&&U!=="formatters"&&U!=="customLevels")&&Z.hasOwnProperty(U)&&Q!==void 0)===!0){if(Q=K[U]?K[U](Q):Q,Q=(W[U]||G||Y)(Q,J),Q===void 0)continue;X+=',"'+U+'":'+Q}return X}function aD($){return $.write!==$.constructor.prototype.write}function yZ($){let Z=new cX($);if(Z.on("error",Q),!$.sync&&lD)_4.register(Z,oD),Z.on("close",function(){_4.unregister(Z)});return Z;function Q(X){if(X.code==="EPIPE"){Z.write=V8,Z.end=V8,Z.flushSync=V8,Z.destroy=V8;return}Z.removeListener("error",Q),Z.emit("error",X)}}function oD($,Z){if($.destroyed)return;if(Z==="beforeExit")$.flush(),$.on("drain",function(){$.end()});else $.flushSync()}function rD($){return function(Q,X,Y={},J){if(typeof Y==="string")J=yZ({dest:Y}),Y={};else if(typeof J==="string"){if(Y&&Y.transport)throw Error("only one of option.transport or stream can be specified");J=yZ({dest:J})}else if(Y instanceof cX||Y.writable||Y._writableState)J=Y,Y={};else if(Y.transport){if(Y.transport instanceof cX||Y.transport.writable||Y.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(Y.transport.targets&&Y.transport.targets.length&&Y.formatters&&typeof Y.formatters.level==="function")throw Error("option.transport.targets do not allow custom level formatters");let K;if(Y.customLevels)K=Y.useOnlyCustomLevels?Y.customLevels:Object.assign({},Y.levels,Y.customLevels);J=cD({caller:X,...Y.transport,levels:K})}if(Y=Object.assign({},$,Y),Y.serializers=Object.assign({},$.serializers,Y.serializers),Y.formatters=Object.assign({},$.formatters,Y.formatters),Y.prettyPrint)throw Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:W,onChild:G}=Y;if(W===!1)Y.level="silent";if(!G)Y.onChild=V8;if(!J)if(!aD(process.stdout))J=yZ({fd:process.stdout.fd||1});else J=process.stdout;return{opts:Y,stream:J}}}function tD($,Z){try{return JSON.stringify($)}catch(Q){try{return(Z||this[dX])($)}catch(X){return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function eD($,Z,Q){return{level:$,bindings:Z,log:Q}}function $T($){let Z=Number($);if(typeof $==="string"&&Number.isFinite(Z))return Z;if($===void 0)return 1;return $}l4.exports={noop:V8,buildSafeSonicBoom:yZ,asChindings:sD,asJson:nD,genLog:pD,createArgsNormalizer:rD,stringify:tD,buildFormatters:eD,normalizeDestFileDescriptor:$T}});var hZ=I((Ig,c4)=>{var ZT={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},QT={ASC:"ASC",DESC:"DESC"};c4.exports={DEFAULT_LEVELS:ZT,SORTING_ORDER:QT}});var nX=I((Sg,n4)=>{var{lsCacheSym:XT,levelValSym:pX,useOnlyCustomLevelsSym:YT,streamSym:JT,formattersSym:WT,hooksSym:GT,levelCompSym:d4}=z8(),{noop:KT,genLog:I$}=gZ(),{DEFAULT_LEVELS:l1,SORTING_ORDER:p4}=hZ(),i4={fatal:($)=>{let Z=I$(l1.fatal,$);return function(...Q){let X=this[JT];if(Z.call(this,...Q),typeof X.flushSync==="function")try{X.flushSync()}catch(Y){}}},error:($)=>I$(l1.error,$),warn:($)=>I$(l1.warn,$),info:($)=>I$(l1.info,$),debug:($)=>I$(l1.debug,$),trace:($)=>I$(l1.trace,$)},iX=Object.keys(l1).reduce(($,Z)=>{return $[l1[Z]]=Z,$},{}),BT=Object.keys(iX).reduce(($,Z)=>{return $[Z]='{"level":'+Number(Z),$},{});function UT($){let Z=$[WT].level,{labels:Q}=$.levels,X={};for(let Y in Q){let J=Z(Q[Y],Number(Y));X[Y]=JSON.stringify(J).slice(0,-1)}return $[XT]=X,$}function zT($,Z){if(Z)return!1;switch($){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function wT($){let{labels:Z,values:Q}=this.levels;if(typeof $==="number"){if(Z[$]===void 0)throw Error("unknown level value"+$);$=Z[$]}if(Q[$]===void 0)throw Error("unknown level "+$);let X=this[pX],Y=this[pX]=Q[$],J=this[YT],W=this[d4],G=this[GT].logMethod;for(let K in Q){if(W(Q[K],Y)===!1){this[K]=KT;continue}this[K]=zT(K,J)?i4[K](G):I$(Q[K],G)}this.emit("level-change",$,Y,Z[X],X,this)}function VT($){let{levels:Z,levelVal:Q}=this;return Z&&Z.labels?Z.labels[Q]:""}function HT($){let{values:Z}=this.levels,Q=Z[$];return Q!==void 0&&this[d4](Q,this[pX])}function MT($,Z,Q){if($===p4.DESC)return Z<=Q;return Z>=Q}function AT($){if(typeof $==="string")return MT.bind(null,$);return $}function FT($=null,Z=!1){let Q=$?Object.keys($).reduce((J,W)=>{return J[$[W]]=W,J},{}):null,X=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),Z?null:iX,Q),Y=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),Z?null:l1,$);return{labels:X,values:Y}}function NT($,Z,Q){if(typeof $==="number"){if(![].concat(Object.keys(Z||{}).map((J)=>Z[J]),Q?[]:Object.keys(iX).map((J)=>+J),1/0).includes($))throw Error(`default level:${$} must be included in custom levels`);return}let X=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),Q?null:l1,Z);if(!($ in X))throw Error(`default level:${$} must be included in custom levels`)}function OT($,Z){let{labels:Q,values:X}=$;for(let Y in Z){if(Y in X)throw Error("levels cannot be overridden");if(Z[Y]in Q)throw Error("pre-existing level values cannot be used for new levels")}}function jT($){if(typeof $==="function")return;if(typeof $==="string"&&Object.values(p4).includes($))return;throw Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}n4.exports={initialLsCache:BT,genLsCache:UT,levelMethods:i4,getLevel:VT,setLevel:wT,isLevelEnabled:HT,mappings:FT,assertNoLevelCollisions:OT,assertDefaultLevelFound:NT,genLevelComparison:AT,assertLevelComparison:jT}});var sX=I((xg,s4)=>{s4.exports={version:"10.3.1"}});var QK=I((kg,ZK)=>{var{EventEmitter:DT}=u("events"),{lsCacheSym:TT,levelValSym:qT,setLevelSym:oX,getLevelSym:a4,chindingsSym:mZ,mixinSym:fT,asJsonSym:r4,writeSym:LT,mixinMergeStrategySym:RT,timeSym:PT,timeSliceIndexSym:CT,streamSym:t4,serializersSym:S$,formattersSym:J6,errorKeySym:ET,messageKeySym:bT,useOnlyCustomLevelsSym:_T,needsMetadataGsym:IT,redactFmtSym:ST,stringifySym:xT,formatOptsSym:kT,stringifiersSym:vT,msgPrefixSym:rX,hooksSym:yT}=z8(),{getLevel:gT,setLevel:hT,isLevelEnabled:uT,mappings:mT,initialLsCache:lT,genLsCache:cT,assertNoLevelCollisions:dT}=nX(),{asChindings:tX,asJson:pT,buildFormatters:aX,stringify:o4,noop:e4}=gZ(),{version:iT}=sX(),nT=CX(),sT=class{},$K={constructor:sT,child:aT,bindings:oT,setBindings:rT,flush:$q,isLevelEnabled:uT,version:iT,get level(){return this[a4]()},set level($){this[oX]($)},get levelVal(){return this[qT]},set levelVal($){throw Error("levelVal is read-only")},get msgPrefix(){return this[rX]},get[Symbol.toStringTag](){return"Pino"},[TT]:lT,[LT]:eT,[r4]:pT,[a4]:gT,[oX]:hT};Object.setPrototypeOf($K,DT.prototype);ZK.exports=function(){return Object.create($K)};var uZ=($)=>$;function aT($,Z){if(!$)throw Error("missing bindings for child Pino");let Q=this[S$],X=this[J6],Y=Object.create(this);if(Z==null){if(Y[J6].bindings!==uZ)Y[J6]=aX(X.level,uZ,X.log);if(Y[mZ]=tX(Y,$),this.onChild!==e4)this.onChild(Y);return Y}if(Z.hasOwnProperty("serializers")===!0){Y[S$]=Object.create(null);for(let B in Q)Y[S$][B]=Q[B];let G=Object.getOwnPropertySymbols(Q);for(var J=0;J<G.length;J++){let B=G[J];Y[S$][B]=Q[B]}for(let B in Z.serializers)Y[S$][B]=Z.serializers[B];let K=Object.getOwnPropertySymbols(Z.serializers);for(var W=0;W<K.length;W++){let B=K[W];Y[S$][B]=Z.serializers[B]}}else Y[S$]=Q;if(Z.hasOwnProperty("formatters")){let{level:G,bindings:K,log:B}=Z.formatters;Y[J6]=aX(G||X.level,K||uZ,B||X.log)}else Y[J6]=aX(X.level,uZ,X.log);if(Z.hasOwnProperty("customLevels")===!0)dT(this.levels,Z.customLevels),Y.levels=mT(Z.customLevels,Y[_T]),cT(Y);if(typeof Z.redact==="object"&&Z.redact!==null||Array.isArray(Z.redact)){Y.redact=Z.redact;let G=nT(Y.redact,o4),K={stringify:G[ST]};Y[xT]=o4,Y[vT]=G,Y[kT]=K}if(typeof Z.msgPrefix==="string")Y[rX]=(this[rX]||"")+Z.msgPrefix;if(Y[mZ]=tX(Y,$),Z.level!==void 0&&Z.level!==this.level||Z.hasOwnProperty("customLevels")){let G=Z.level||this.level;Y[oX](G)}return this.onChild(Y),Y}function oT(){let Z=`{${this[mZ].substr(1)}}`,Q=JSON.parse(Z);return delete Q.pid,delete Q.hostname,Q}function rT($){let Z=tX(this,$);this[mZ]=Z}function tT($,Z){return Object.assign(Z,$)}function eT($,Z,Q){let X=this[PT](),Y=this[fT],J=this[ET],W=this[bT],G=this[RT]||tT,K,B=this[yT].streamWrite;if($===void 0||$===null)K={};else if($ instanceof Error){if(K={[J]:$},Z===void 0)Z=$.message}else if(K=$,Z===void 0&&$[W]===void 0&&$[J])Z=$[J].message;if(Y)K=G(K,Y(K,Q,this));let U=this[r4](K,Z,Q,X),w=this[t4];if(w[IT]===!0)w.lastLevel=Q,w.lastObj=K,w.lastMsg=Z,w.lastTime=X.slice(this[CT]),w.lastLogger=this;w.write(B?B(U):U)}function $q($){if($!=null&&typeof $!=="function")throw Error("callback must be a function");let Z=this[t4];if(typeof Z.flush==="function")Z.flush($||e4);else if($)$()}});var WK=I((vg,JK)=>{var{hasOwnProperty:W6}=Object.prototype,k$=ZY();k$.configure=ZY;k$.stringify=k$;k$.default=k$;vg.stringify=k$;vg.configure=ZY;JK.exports=k$;var Zq=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function H$($){if($.length<5000&&!Zq.test($))return`"${$}"`;return JSON.stringify($)}function eX($,Z){if($.length>200||Z)return $.sort(Z);for(let Q=1;Q<$.length;Q++){let X=$[Q],Y=Q;while(Y!==0&&$[Y-1]>X)$[Y]=$[Y-1],Y--;$[Y]=X}return $}var Qq=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function $Y($){return Qq.call($)!==void 0&&$.length!==0}function XK($,Z,Q){if($.length<Q)Q=$.length;let X=Z===","?"":" ",Y=`"0":${X}${$[0]}`;for(let J=1;J<Q;J++)Y+=`${Z}"${J}":${X}${$[J]}`;return Y}function Xq($){if(W6.call($,"circularValue")){let Z=$.circularValue;if(typeof Z==="string")return`"${Z}"`;if(Z==null)return Z;if(Z===Error||Z===TypeError)return{toString(){throw TypeError("Converting circular structure to JSON")}};throw TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function Yq($){let Z;if(W6.call($,"deterministic")){if(Z=$.deterministic,typeof Z!=="boolean"&&typeof Z!=="function")throw TypeError('The "deterministic" argument must be of type boolean or comparator function')}return Z===void 0?!0:Z}function Jq($,Z){let Q;if(W6.call($,Z)){if(Q=$[Z],typeof Q!=="boolean")throw TypeError(`The "${Z}" argument must be of type boolean`)}return Q===void 0?!0:Q}function YK($,Z){let Q;if(W6.call($,Z)){if(Q=$[Z],typeof Q!=="number")throw TypeError(`The "${Z}" argument must be of type number`);if(!Number.isInteger(Q))throw TypeError(`The "${Z}" argument must be an integer`);if(Q<1)throw RangeError(`The "${Z}" argument must be >= 1`)}return Q===void 0?1/0:Q}function x$($){if($===1)return"1 item";return`${$} items`}function Wq($){let Z=new Set;for(let Q of $)if(typeof Q==="string"||typeof Q==="number")Z.add(String(Q));return Z}function Gq($){if(W6.call($,"strict")){let Z=$.strict;if(typeof Z!=="boolean")throw TypeError('The "strict" argument must be of type boolean');if(Z)return(Q)=>{let X=`Object can not safely be stringified. Received type ${typeof Q}`;if(typeof Q!=="function")X+=` (${Q.toString()})`;throw Error(X)}}}function ZY($){$={...$};let Z=Gq($);if(Z){if($.bigint===void 0)$.bigint=!1;if(!("circularValue"in $))$.circularValue=Error}let Q=Xq($),X=Jq($,"bigint"),Y=Yq($),J=typeof Y==="function"?Y:void 0,W=YK($,"maximumDepth"),G=YK($,"maximumBreadth");function K(V,z,N,F,O,j){let M=z[V];if(typeof M==="object"&&M!==null&&typeof M.toJSON==="function")M=M.toJSON(V);switch(M=F.call(z,V,M),typeof M){case"string":return H$(M);case"object":{if(M===null)return"null";if(N.indexOf(M)!==-1)return Q;let A="",D=",",f=j;if(Array.isArray(M)){if(M.length===0)return"[]";if(W<N.length+1)return'"[Array]"';if(N.push(M),O!=="")j+=O,A+=`
7
+ ${j}`,D=`,
8
+ ${j}`;let y=Math.min(M.length,G),v=0;for(;v<y-1;v++){let s=K(String(v),M,N,F,O,j);A+=s!==void 0?s:"null",A+=D}let n=K(String(v),M,N,F,O,j);if(A+=n!==void 0?n:"null",M.length-1>G){let s=M.length-G-1;A+=`${D}"... ${x$(s)} not stringified"`}if(O!=="")A+=`
9
+ ${f}`;return N.pop(),`[${A}]`}let R=Object.keys(M),T=R.length;if(T===0)return"{}";if(W<N.length+1)return'"[Object]"';let b="",q="";if(O!=="")j+=O,D=`,
10
+ ${j}`,b=" ";let S=Math.min(T,G);if(Y&&!$Y(M))R=eX(R,J);N.push(M);for(let y=0;y<S;y++){let v=R[y],n=K(v,M,N,F,O,j);if(n!==void 0)A+=`${q}${H$(v)}:${b}${n}`,q=D}if(T>G){let y=T-G;A+=`${q}"...":${b}"${x$(y)} not stringified"`,q=D}if(O!==""&&q.length>1)A=`
11
+ ${j}${A}
12
+ ${f}`;return N.pop(),`{${A}}`}case"number":return isFinite(M)?String(M):Z?Z(M):"null";case"boolean":return M===!0?"true":"false";case"undefined":return;case"bigint":if(X)return String(M);default:return Z?Z(M):void 0}}function B(V,z,N,F,O,j){if(typeof z==="object"&&z!==null&&typeof z.toJSON==="function")z=z.toJSON(V);switch(typeof z){case"string":return H$(z);case"object":{if(z===null)return"null";if(N.indexOf(z)!==-1)return Q;let M=j,A="",D=",";if(Array.isArray(z)){if(z.length===0)return"[]";if(W<N.length+1)return'"[Array]"';if(N.push(z),O!=="")j+=O,A+=`
13
+ ${j}`,D=`,
14
+ ${j}`;let T=Math.min(z.length,G),b=0;for(;b<T-1;b++){let S=B(String(b),z[b],N,F,O,j);A+=S!==void 0?S:"null",A+=D}let q=B(String(b),z[b],N,F,O,j);if(A+=q!==void 0?q:"null",z.length-1>G){let S=z.length-G-1;A+=`${D}"... ${x$(S)} not stringified"`}if(O!=="")A+=`
15
+ ${M}`;return N.pop(),`[${A}]`}N.push(z);let f="";if(O!=="")j+=O,D=`,
16
+ ${j}`,f=" ";let R="";for(let T of F){let b=B(T,z[T],N,F,O,j);if(b!==void 0)A+=`${R}${H$(T)}:${f}${b}`,R=D}if(O!==""&&R.length>1)A=`
17
+ ${j}${A}
18
+ ${M}`;return N.pop(),`{${A}}`}case"number":return isFinite(z)?String(z):Z?Z(z):"null";case"boolean":return z===!0?"true":"false";case"undefined":return;case"bigint":if(X)return String(z);default:return Z?Z(z):void 0}}function U(V,z,N,F,O){switch(typeof z){case"string":return H$(z);case"object":{if(z===null)return"null";if(typeof z.toJSON==="function"){if(z=z.toJSON(V),typeof z!=="object")return U(V,z,N,F,O);if(z===null)return"null"}if(N.indexOf(z)!==-1)return Q;let j=O;if(Array.isArray(z)){if(z.length===0)return"[]";if(W<N.length+1)return'"[Array]"';N.push(z),O+=F;let b=`
19
+ ${O}`,q=`,
20
+ ${O}`,S=Math.min(z.length,G),y=0;for(;y<S-1;y++){let n=U(String(y),z[y],N,F,O);b+=n!==void 0?n:"null",b+=q}let v=U(String(y),z[y],N,F,O);if(b+=v!==void 0?v:"null",z.length-1>G){let n=z.length-G-1;b+=`${q}"... ${x$(n)} not stringified"`}return b+=`
21
+ ${j}`,N.pop(),`[${b}]`}let M=Object.keys(z),A=M.length;if(A===0)return"{}";if(W<N.length+1)return'"[Object]"';O+=F;let D=`,
22
+ ${O}`,f="",R="",T=Math.min(A,G);if($Y(z))f+=XK(z,D,G),M=M.slice(z.length),T-=z.length,R=D;if(Y)M=eX(M,J);N.push(z);for(let b=0;b<T;b++){let q=M[b],S=U(q,z[q],N,F,O);if(S!==void 0)f+=`${R}${H$(q)}: ${S}`,R=D}if(A>G){let b=A-G;f+=`${R}"...": "${x$(b)} not stringified"`,R=D}if(R!=="")f=`
23
+ ${O}${f}
24
+ ${j}`;return N.pop(),`{${f}}`}case"number":return isFinite(z)?String(z):Z?Z(z):"null";case"boolean":return z===!0?"true":"false";case"undefined":return;case"bigint":if(X)return String(z);default:return Z?Z(z):void 0}}function w(V,z,N){switch(typeof z){case"string":return H$(z);case"object":{if(z===null)return"null";if(typeof z.toJSON==="function"){if(z=z.toJSON(V),typeof z!=="object")return w(V,z,N);if(z===null)return"null"}if(N.indexOf(z)!==-1)return Q;let F="",O=z.length!==void 0;if(O&&Array.isArray(z)){if(z.length===0)return"[]";if(W<N.length+1)return'"[Array]"';N.push(z);let f=Math.min(z.length,G),R=0;for(;R<f-1;R++){let b=w(String(R),z[R],N);F+=b!==void 0?b:"null",F+=","}let T=w(String(R),z[R],N);if(F+=T!==void 0?T:"null",z.length-1>G){let b=z.length-G-1;F+=`,"... ${x$(b)} not stringified"`}return N.pop(),`[${F}]`}let j=Object.keys(z),M=j.length;if(M===0)return"{}";if(W<N.length+1)return'"[Object]"';let A="",D=Math.min(M,G);if(O&&$Y(z))F+=XK(z,",",G),j=j.slice(z.length),D-=z.length,A=",";if(Y)j=eX(j,J);N.push(z);for(let f=0;f<D;f++){let R=j[f],T=w(R,z[R],N);if(T!==void 0)F+=`${A}${H$(R)}:${T}`,A=","}if(M>G){let f=M-G;F+=`${A}"...":"${x$(f)} not stringified"`}return N.pop(),`{${F}}`}case"number":return isFinite(z)?String(z):Z?Z(z):"null";case"boolean":return z===!0?"true":"false";case"undefined":return;case"bigint":if(X)return String(z);default:return Z?Z(z):void 0}}function H(V,z,N){if(arguments.length>1){let F="";if(typeof N==="number")F=" ".repeat(Math.min(N,10));else if(typeof N==="string")F=N.slice(0,10);if(z!=null){if(typeof z==="function")return K("",{"":V},[],z,F,"");if(Array.isArray(z))return B("",V,[],Wq(z),F,"")}if(F.length!==0)return U("",V,[],F,"")}return w("",V,[])}return H}});var UK=I((yg,BK)=>{var QY=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:KK}=hZ(),Uq=KK.info;function zq($,Z){$=$||[],Z=Z||{dedupe:!1};let Q=Object.create(KK);if(Q.silent=1/0,Z.levels&&typeof Z.levels==="object")Object.keys(Z.levels).forEach((w)=>{Q[w]=Z.levels[w]});let X={write:Y,add:G,remove:K,emit:J,flushSync:W,end:B,minLevel:0,lastId:0,streams:[],clone:U,[QY]:!0,streamLevels:Q};if(Array.isArray($))$.forEach(G,X);else G.call(X,$);return $=null,X;function Y(w){let H,V=this.lastLevel,{streams:z}=this,N=0,F;for(let O=wq(z.length,Z.dedupe);Hq(O,z.length,Z.dedupe);O=Vq(O,Z.dedupe))if(H=z[O],H.level<=V){if(N!==0&&N!==H.level)break;if(F=H.stream,F[QY]){let{lastTime:j,lastMsg:M,lastObj:A,lastLogger:D}=this;F.lastLevel=V,F.lastTime=j,F.lastMsg=M,F.lastObj=A,F.lastLogger=D}if(F.write(w),Z.dedupe)N=H.level}else if(!Z.dedupe)break}function J(...w){for(let{stream:H}of this.streams)if(typeof H.emit==="function")H.emit(...w)}function W(){for(let{stream:w}of this.streams)if(typeof w.flushSync==="function")w.flushSync()}function G(w){if(!w)return X;let H=typeof w.write==="function"||w.stream,V=w.write?w:w.stream;if(!H)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:z,streamLevels:N}=this,F;if(typeof w.levelVal==="number")F=w.levelVal;else if(typeof w.level==="string")F=N[w.level];else if(typeof w.level==="number")F=w.level;else F=Uq;let O={stream:V,level:F,levelVal:void 0,id:++X.lastId};return z.unshift(O),z.sort(GK),this.minLevel=z[0].level,X}function K(w){let{streams:H}=this,V=H.findIndex((z)=>z.id===w);if(V>=0)H.splice(V,1),H.sort(GK),this.minLevel=H.length>0?H[0].level:-1;return X}function B(){for(let{stream:w}of this.streams){if(typeof w.flushSync==="function")w.flushSync();w.end()}}function U(w){let H=Array(this.streams.length);for(let V=0;V<H.length;V++)H[V]={level:w,stream:this.streams[V].stream};return{write:Y,add:G,remove:K,minLevel:w,streams:H,clone:U,emit:J,flushSync:W,[QY]:!0}}}function GK($,Z){return $.level-Z.level}function wq($,Z){return Z?$-1:0}function Vq($,Z){return Z?$-1:$+1}function Hq($,Z,Q){return Q?$>=0:$<Z}BK.exports=zq});var fK=I((gg,f1)=>{var Mq=u("os"),NK=fX(),Aq=LX(),Fq=CX(),OK=Q4(),Nq=QK(),jK=z8(),{configure:Oq}=WK(),{assertDefaultLevelFound:jq,mappings:DK,genLsCache:Dq,genLevelComparison:Tq,assertLevelComparison:qq}=nX(),{DEFAULT_LEVELS:TK,SORTING_ORDER:fq}=hZ(),{createArgsNormalizer:Lq,asChindings:Rq,buildSafeSonicBoom:zK,buildFormatters:Pq,stringify:XY,normalizeDestFileDescriptor:wK,noop:Cq}=gZ(),{version:Eq}=sX(),{chindingsSym:VK,redactFmtSym:bq,serializersSym:HK,timeSym:_q,timeSliceIndexSym:Iq,streamSym:Sq,stringifySym:MK,stringifySafeSym:YY,stringifiersSym:AK,setLevelSym:xq,endSym:kq,formatOptsSym:vq,messageKeySym:yq,errorKeySym:gq,nestedKeySym:hq,mixinSym:uq,levelCompSym:mq,useOnlyCustomLevelsSym:lq,formattersSym:FK,hooksSym:cq,nestedKeyStrSym:dq,mixinMergeStrategySym:pq,msgPrefixSym:iq}=jK,{epochTime:qK,nullTime:nq}=OK,{pid:sq}=process,aq=Mq.hostname(),oq=NK.err,rq={level:"info",levelComparison:fq.ASC,levels:TK,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:sq,hostname:aq},serializers:Object.assign(Object.create(null),{err:oq}),formatters:Object.assign(Object.create(null),{bindings($){return $},level($,Z){return{level:Z}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:qK,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},tq=Lq(rq),eq=Object.assign(Object.create(null),NK);function JY(...$){let Z={},{opts:Q,stream:X}=tq(Z,Aq(),...$);if(Q.level&&typeof Q.level==="string"&&TK[Q.level.toLowerCase()]!==void 0)Q.level=Q.level.toLowerCase();let{redact:Y,crlf:J,serializers:W,timestamp:G,messageKey:K,errorKey:B,nestedKey:U,base:w,name:H,level:V,customLevels:z,levelComparison:N,mixin:F,mixinMergeStrategy:O,useOnlyCustomLevels:j,formatters:M,hooks:A,depthLimit:D,edgeLimit:f,onChild:R,msgPrefix:T}=Q,b=Oq({maximumDepth:D,maximumBreadth:f}),q=Pq(M.level,M.bindings,M.log),S=XY.bind({[YY]:b}),y=Y?Fq(Y,S):{},v=Y?{stringify:y[bq]}:{stringify:S},n="}"+(J?`\r
25
+ `:`
26
+ `),s=Rq.bind(null,{[VK]:"",[HK]:W,[AK]:y,[MK]:XY,[YY]:b,[FK]:q}),a="";if(w!==null)if(H===void 0)a=s(w);else a=s(Object.assign({},w,{name:H}));let p=G instanceof Function?G:G?qK:nq,r=p().indexOf(":")+1;if(j&&!z)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(F&&typeof F!=="function")throw Error(`Unknown mixin type "${typeof F}" - expected "function"`);if(T&&typeof T!=="string")throw Error(`Unknown msgPrefix type "${typeof T}" - expected "string"`);jq(V,z,j);let X0=DK(z,j);if(typeof X.emit==="function")X.emit("message",{code:"PINO_CONFIG",config:{levels:X0,messageKey:K,errorKey:B}});qq(N);let Y0=Tq(N);return Object.assign(Z,{levels:X0,[mq]:Y0,[lq]:j,[Sq]:X,[_q]:p,[Iq]:r,[MK]:XY,[YY]:b,[AK]:y,[kq]:n,[vq]:v,[yq]:K,[gq]:B,[hq]:U,[dq]:U?`,${JSON.stringify(U)}:{`:"",[HK]:W,[uq]:F,[pq]:O,[VK]:a,[FK]:q,[cq]:A,silent:Cq,onChild:R,[iq]:T}),Object.setPrototypeOf(Z,Nq()),Dq(Z),Z[xq](V),Z}f1.exports=JY;f1.exports.destination=($=process.stdout.fd)=>{if(typeof $==="object")return $.dest=wK($.dest||process.stdout.fd),zK($);else return zK({dest:wK($),minLength:0})};f1.exports.transport=mX();f1.exports.multistream=UK();f1.exports.levels=DK();f1.exports.stdSerializers=eq;f1.exports.stdTimeFunctions=Object.assign({},OK);f1.exports.symbols=jK;f1.exports.version=Eq;f1.exports.default=JY;f1.exports.pino=JY});var PK=I((hg,RK)=>{var lZ=fK(),{serializersSym:LK}=lZ.symbols,{FST_ERR_LOG_INVALID_DESTINATION:$f}=d0();function Zf($){if($.stream&&$.file)throw new $f;else if($.file)$.stream=lZ.destination($.file),delete $.file;let{logger:Z,genReqId:Q}=$,X=null;if(Z){if($.logger=void 0,$.genReqId=void 0,Z[LK])$.serializers=Object.assign({},$.serializers,Z[LK]);X=Z.child({},$),$.logger=Z,$.genReqId=Q}else X=lZ($,$.stream);return X}var Qf={req:function(Z){return{method:Z.method,url:Z.url,version:Z.headers&&Z.headers["accept-version"],host:Z.host,remoteAddress:Z.ip,remotePort:Z.socket?Z.socket.remotePort:void 0}},err:lZ.stdSerializers.err,res:function(Z){return{statusCode:Z.statusCode}}};RK.exports={serializers:Qf,createPinoLogger:Zf}});var G6=I((ug,EK)=>{var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:Xf,FST_ERR_LOG_INVALID_LOGGER_CONFIG:Yf,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:Jf,FST_ERR_LOG_INVALID_LOGGER:Wf}=d0();function Gf($,Z,Q,X,Y){let J={[$.requestIdLogLabel]:X},W=$.childLoggerFactory.call($.server,Z,J,Y||{},Q);if($.childLoggerFactory!==CK)cZ(W,!0);return W}function CK($,Z,Q){return $.child(Z,Q)}function cZ($,Z){let Q=["info","error","debug","fatal","warn","trace","child"],X=$?Q.filter((Y)=>!$[Y]||typeof $[Y]!=="function"):Q;if(!X.length)return!0;else if(X.length===Q.length&&!Z)return!1;else throw Wf(X.join(","))}function Kf($){if($.logger&&$.loggerInstance)throw new Xf;if(!$.loggerInstance&&!$.logger){let W=f9();return W.child=()=>W,{logger:W,hasLogger:!1}}let{createPinoLogger:Z,serializers:Q}=PK();if(cZ($.loggerInstance))return{logger:Z({logger:$.loggerInstance,serializers:Object.assign({},Q,$.loggerInstance.serializers)}),hasLogger:!0};if(cZ($.logger))throw Yf();if($.loggerInstance)throw Jf();let X={};if(Object.prototype.toString.call($.logger)==="[object Object]")Reflect.ownKeys($.logger).forEach((J)=>{Object.defineProperty(X,J,{value:$.logger[J],writable:!0,enumerable:!0,configurable:!0})});return X.level=X.level||"info",X.serializers=Object.assign({},Q,X.serializers),$.logger=X,{logger:Z($.logger),hasLogger:!0}}function Bf(){let $=process.hrtime();return $[0]*1000+$[1]/1e6}EK.exports={createChildLogger:Gf,defaultChildLoggerFactory:CK,createLogger:Kf,validateLogger:cZ,now:Bf}});var dZ=I((mg,bK)=>{bK.exports=Uf;function H8($){if($ instanceof Buffer)return Buffer.from($);return new $.constructor($.buffer.slice(),$.byteOffset,$.length)}function Uf($){if($=$||{},$.circles)return zf($);let Z=new Map;if(Z.set(Date,(W)=>new Date(W)),Z.set(Map,(W,G)=>new Map(X(Array.from(W),G))),Z.set(Set,(W,G)=>new Set(X(Array.from(W),G))),$.constructorHandlers)for(let W of $.constructorHandlers)Z.set(W[0],W[1]);let Q=null;return $.proto?J:Y;function X(W,G){let K=Object.keys(W),B=Array(K.length);for(let U=0;U<K.length;U++){let w=K[U],H=W[w];if(typeof H!=="object"||H===null)B[w]=H;else if(H.constructor!==Object&&(Q=Z.get(H.constructor)))B[w]=Q(H,G);else if(ArrayBuffer.isView(H))B[w]=H8(H);else B[w]=G(H)}return B}function Y(W){if(typeof W!=="object"||W===null)return W;if(Array.isArray(W))return X(W,Y);if(W.constructor!==Object&&(Q=Z.get(W.constructor)))return Q(W,Y);let G={};for(let K in W){if(Object.hasOwnProperty.call(W,K)===!1)continue;let B=W[K];if(typeof B!=="object"||B===null)G[K]=B;else if(B.constructor!==Object&&(Q=Z.get(B.constructor)))G[K]=Q(B,Y);else if(ArrayBuffer.isView(B))G[K]=H8(B);else G[K]=Y(B)}return G}function J(W){if(typeof W!=="object"||W===null)return W;if(Array.isArray(W))return X(W,J);if(W.constructor!==Object&&(Q=Z.get(W.constructor)))return Q(W,J);let G={};for(let K in W){let B=W[K];if(typeof B!=="object"||B===null)G[K]=B;else if(B.constructor!==Object&&(Q=Z.get(B.constructor)))G[K]=Q(B,J);else if(ArrayBuffer.isView(B))G[K]=H8(B);else G[K]=J(B)}return G}}function zf($){let Z=[],Q=[],X=new Map;if(X.set(Date,(K)=>new Date(K)),X.set(Map,(K,B)=>new Map(J(Array.from(K),B))),X.set(Set,(K,B)=>new Set(J(Array.from(K),B))),$.constructorHandlers)for(let K of $.constructorHandlers)X.set(K[0],K[1]);let Y=null;return $.proto?G:W;function J(K,B){let U=Object.keys(K),w=Array(U.length);for(let H=0;H<U.length;H++){let V=U[H],z=K[V];if(typeof z!=="object"||z===null)w[V]=z;else if(z.constructor!==Object&&(Y=X.get(z.constructor)))w[V]=Y(z,B);else if(ArrayBuffer.isView(z))w[V]=H8(z);else{let N=Z.indexOf(z);if(N!==-1)w[V]=Q[N];else w[V]=B(z)}}return w}function W(K){if(typeof K!=="object"||K===null)return K;if(Array.isArray(K))return J(K,W);if(K.constructor!==Object&&(Y=X.get(K.constructor)))return Y(K,W);let B={};Z.push(K),Q.push(B);for(let U in K){if(Object.hasOwnProperty.call(K,U)===!1)continue;let w=K[U];if(typeof w!=="object"||w===null)B[U]=w;else if(w.constructor!==Object&&(Y=X.get(w.constructor)))B[U]=Y(w,W);else if(ArrayBuffer.isView(w))B[U]=H8(w);else{let H=Z.indexOf(w);if(H!==-1)B[U]=Q[H];else B[U]=W(w)}}return Z.pop(),Q.pop(),B}function G(K){if(typeof K!=="object"||K===null)return K;if(Array.isArray(K))return J(K,G);if(K.constructor!==Object&&(Y=X.get(K.constructor)))return Y(K,G);let B={};Z.push(K),Q.push(B);for(let U in K){let w=K[U];if(typeof w!=="object"||w===null)B[U]=w;else if(w.constructor!==Object&&(Y=X.get(w.constructor)))B[U]=Y(w,G);else if(ArrayBuffer.isView(w))B[U]=H8(w);else{let H=Z.indexOf(w);if(H!==-1)B[U]=Q[H];else B[U]=G(w)}}return Z.pop(),Q.pop(),B}}});var K6=I((lg,kK)=>{var wf=dZ()({circles:!1,proto:!0}),{kSchemaVisited:_K,kSchemaResponse:Vf}=u0(),WY=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:Hf,FST_ERR_SCH_ALREADY_PRESENT:Mf,FST_ERR_SCH_DUPLICATE:Af,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:IK}=d0(),xK=["params","body","querystring","query","headers"];function pZ($){this.store=$||{}}pZ.prototype.add=function($){let Z=wf($.isFluentSchema||$.isFluentJSONSchema||$[WY]?$.valueOf():$),Q=Z.$id;if(!Q)throw new Hf;if(this.store[Q])throw new Mf(Q);this.store[Q]=Z};pZ.prototype.getSchemas=function(){return Object.assign({},this.store)};pZ.prototype.getSchema=function($){return this.store[$]};function SK($){return typeof $==="object"&&Object.getPrototypeOf($)!==Object.prototype}function Ff($,Z){if($[_K])return $;if($.query){if($.querystring)throw new Af("querystring");$.querystring=$.query}Nf($);for(let Q of xK){let X=$[Q];if(X&&!SK(X)){if(Q==="body"&&X.content){let Y=X.content,J=Object.keys(Y);for(let W=0;W<J.length;W++){let G=J[W];if(!Y[G].schema)throw new IK(G)}continue}}}if($.response){let Q=Object.keys($.response);for(let X of Q){if(SK($.response[X]))continue;let Y=$.response[X].content;if(Y){let J=Object.keys(Y);for(let W=0;W<J.length;W++){let G=J[W];if(!Y[G].schema)throw new IK(G)}}}}return $[_K]=!0,$}function Nf($){for(let Z of xK)if($[Z]&&($[Z].isFluentSchema||$[Z][WY]))$[Z]=$[Z].valueOf();if($.response){let Z=Object.keys($.response);for(let Q of Z)if($.response[Q].isFluentSchema||$.response[Q][WY])$.response[Q]=$.response[Q].valueOf()}}function Of($,Z,Q){let X=$[Vf];if(!X)return!1;if(X[Z]){if(X[Z].constructor===Object&&Q){let J=Q.split(";",1)[0];if(X[Z][J])return X[Z][J];if(X[Z]["*/*"])return X[Z]["*/*"];return!1}return X[Z]}let Y=(Z+"")[0]+"xx";if(X[Y]){if(X[Y].constructor===Object&&Q){let J=Q.split(";",1)[0];if(X[Y][J])return X[Y][J];if(X[Y]["*/*"])return X[Y]["*/*"];return!1}return X[Y]}if(X.default){if(X.default.constructor===Object&&Q){let J=Q.split(";",1)[0];if(X.default[J])return X.default[J];if(X.default["*/*"])return X.default["*/*"];return!1}return X.default}return!1}kK.exports={buildSchemas($){return new pZ($)},getSchemaSerializer:Of,normalizeSchema:Ff}});var iZ=I((cg,vK)=>{var jf=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;vK.exports=class ${constructor(Z){switch(Z&&Z.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=Z}asInteger(Z){if(Number.isInteger(Z))return""+Z;else if(typeof Z==="bigint")return Z.toString();let Q=this.parseInteger(Z);if(Q===1/0||Q===-1/0||Q!==Q)throw Error(`The value "${Z}" cannot be converted to an integer.`);return""+Q}asNumber(Z){let Q=Number(Z);if(Q!==Q)throw Error(`The value "${Z}" cannot be converted to a number.`);else if(Q===1/0||Q===-1/0)return"null";else return""+Q}asBoolean(Z){return Z&&"true"||"false"}asDateTime(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+Z.toISOString()+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a date-time.`)}asDate(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+new Date(Z.getTime()-Z.getTimezoneOffset()*60000).toISOString().slice(0,10)+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a date.`)}asTime(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+new Date(Z.getTime()-Z.getTimezoneOffset()*60000).toISOString().slice(11,19)+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a time.`)}asString(Z){let Q=Z.length;if(Q===0)return'""';else if(Q<42){let X="",Y=-1,J=255;for(let W=0;W<Q;W++)if(J=Z.charCodeAt(W),J===34||J===92)Y===-1&&(Y=0),X+=Z.slice(Y,W)+"\\",Y=W;else if(J<32||J>=55296&&J<=57343)return JSON.stringify(Z);return Y===-1&&'"'+Z+'"'||'"'+X+Z.slice(Y)+'"'}else if(Q<5000&&jf.test(Z)===!1)return'"'+Z+'"';else return JSON.stringify(Z)}asUnsafeString(Z){return'"'+Z+'"'}getState(){return this._options}static restoreFromState(Z){return new $(Z)}}});var gK=I((dg,yK)=>{var Df=iZ(),Tf={mode:"standalone"},qf=Df.restoreFromState(Tf);yK.exports=function(Z,Q){let{asString:X,asNumber:Y,asBoolean:J,asDateTime:W,asDate:G,asTime:K,asUnsafeString:B}=Q,U=Q.asInteger.bind(Q),w="{",H="}",V="[",z="]",N=",",F=":",O='"',j="{}",M="[]",A='""',D="null";function f(T){let b=T&&typeof T.toJSON==="function"?T.toJSON():T;if(b===null)return j;let q,S="{",y=!1;if(q=b.statusCode,q!==void 0)!y&&(y=!0)||(S+=","),S+='"statusCode":',S+=Y(q);if(q=b.code,q!==void 0)if(!y&&(y=!0)||(S+=","),S+='"code":',typeof q!=="string")if(q===null)S+=A;else if(q instanceof Date)S+='"'+q.toISOString()+'"';else if(q instanceof RegExp)S+=X(q.source);else S+=X(q.toString());else S+=X(q);if(q=b.error,q!==void 0)if(!y&&(y=!0)||(S+=","),S+='"error":',typeof q!=="string")if(q===null)S+=A;else if(q instanceof Date)S+='"'+q.toISOString()+'"';else if(q instanceof RegExp)S+=X(q.source);else S+=X(q.toString());else S+=X(q);if(q=b.message,q!==void 0)if(!y&&(y=!0)||(S+=","),S+='"message":',typeof q!=="string")if(q===null)S+=A;else if(q instanceof Date)S+='"'+q.toISOString()+'"';else if(q instanceof RegExp)S+=X(q.source);else S+=X(q.toString());else S+=X(q);return S+"}"}return f}(null,qf)});var B6=I((pg,lK)=>{var hK=u("http").STATUS_CODES,ff=GX(),{setErrorStatusCode:Lf}=OZ(),{kReplyHeaders:v$,kReplyNextErrorHandler:nZ,kReplyIsRunningOnErrorHook:Rf,kRouteContext:mK,kDisableRequestLogging:sZ}=u0(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:Pf,FST_ERR_FAILED_ERROR_SERIALIZATION:Cf}=d0(),{getSchemaSerializer:Ef}=K6(),GY=gK(),bf={func:If,toJSON(){return this.func.name.toString()+"()"}};function _f($,Z,Q){$[Rf]=!1;let X=$[mK];if($[nZ]===!1){uK(Z,$,function(W,G){try{W.raw.writeHead(W.raw.statusCode,W[v$])}catch(K){if(!W.log[sZ])W.log.warn({req:W.request,res:W,err:K},K?.message);W.raw.writeHead(W.raw.statusCode)}W.raw.end(G)});return}let Y=$[nZ]||X.errorHandler;$[nZ]=Object.getPrototypeOf(Y),delete $[v$]["content-type"],delete $[v$]["content-length"];let J=Y.func;if(!J){$[nZ]=!1,uK(Z,$,Q);return}try{let W=J(Z,$.request,$);if(W!==void 0)if(W!==null&&typeof W.then==="function")ff(W,$);else $.send(W)}catch(W){$.send(W)}}function If($,Z,Q){if(xf($,Q),Lf(Q,$),Q.statusCode<500){if(!Q.log[sZ])Q.log.info({res:Q,err:$},$?.message)}else if(!Q.log[sZ])Q.log.error({req:Z,res:Q,err:$},$?.message);Q.send($)}function uK($,Z,Q){let{raw:X,statusCode:Y}=Z;Z[v$]["content-type"]=Z[v$]["content-type"]??"application/json; charset=utf-8";let J;try{let W=Ef(Z[mK],Y,Z[v$]["content-type"]);if(W===!1)J=GY({error:hK[Y+""],code:$.code,message:$.message,statusCode:Y});else J=W(Object.create($,{error:{value:hK[Y+""]},message:{value:$.message},statusCode:{value:Y}}))}catch(W){if(!Z.log[sZ])Z.log.error({err:W,statusCode:X.statusCode},"The serializer for the given status code failed");Z.code(500),J=GY(new Cf(W.message,$.message))}if(typeof J!=="string"&&!Buffer.isBuffer(J))J=GY(new Pf(typeof J));Z[v$]["content-length"]=""+Buffer.byteLength(J),Q(Z,J)}function Sf($=bf,Z){if(!Z)return $;let Q=Object.create($);return Q.func=Z,Q}function xf($,Z){let Q=Z.raw,X=Q.statusCode;if(X=X>=400?X:500,$!=null){if($.headers!==void 0)Z.headers($.headers);if($.status>=400)X=$.status;else if($.statusCode>=400)X=$.statusCode}Q.statusCode=X}lK.exports={buildErrorHandler:Sf,handleError:_f}});var w6=I((ig,iK)=>{var{kReply:KY,kRequest:BY,kState:kf,kHasBeenDecorated:vf}=u0(),{FST_ERR_DEC_ALREADY_PRESENT:cK,FST_ERR_DEC_MISSING_DEPENDENCY:yf,FST_ERR_DEC_AFTER_START:gf,FST_ERR_DEC_REFERENCE_TYPE:hf,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:uf,FST_ERR_DEC_UNDECLARED:mf}=d0();function lf($,Z,Q,X){if(Object.hasOwn($,Z))throw new cK(Z);if(UY($,Z,X),Q&&(typeof Q.getter==="function"||typeof Q.setter==="function"))Object.defineProperty($,Z,{get:Q.getter,set:Q.setter});else $[Z]=Q}function cf($){if(!U6(this,$))throw new mf($,"instance");if(typeof this[$]==="function")return this[$].bind(this);return this[$]}function dK($,Z,Q,X){let Y=$.prototype;if(Object.hasOwn(Y,Z)||z6($,Z))throw new cK(Z);if($[vf]=!0,UY($,Z,X),Q&&(typeof Q.getter==="function"||typeof Q.setter==="function"))Object.defineProperty(Y,Z,{get:Q.getter,set:Q.setter});else if(typeof Q==="function")Y[Z]=Q;else $.props.push({key:Z,value:Q})}function pK($,Z){if(typeof Z==="object"&&Z&&!(typeof Z.getter==="function"||typeof Z.setter==="function"))throw new hf($,typeof Z)}function df($,Z,Q){return zY(this,$),lf(this,$,Z,Q),this}function U6($,Z){if(Z)return Z in $||$.prototype&&Z in $.prototype||z6($,Z);return $ in this}function z6($,Z){if($.props)return $.props.find(({key:Q})=>Q===Z);return!1}function pf($){if($&&z6(this[BY],$))return!0;return U6(this[BY].prototype,$)}function nf($){if($&&z6(this[KY],$))return!0;return U6(this[KY].prototype,$)}function UY($,Z,Q){if(Q===void 0||Q===null)return;if(!Array.isArray(Q))throw new uf(Z);for(let X=0;X!==Q.length;++X)if(!U6($,Q[X]))throw new yf(Q[X])}function sf($,Z,Q){return zY(this,$),pK($,Z),dK(this[KY],$,Z,Q),this}function af($,Z,Q){return zY(this,$),pK($,Z),dK(this[BY],$,Z,Q),this}function zY($,Z){if($[kf].started)throw new gf(Z)}iK.exports={add:df,exist:U6,existRequest:pf,existReply:nf,dependencies:UY,decorateReply:sf,decorateRequest:af,getInstanceDecorator:cf,hasKey:z6}});var XQ=I((ng,QQ)=>{var aZ=u("stream").finished,{kFourOhFourContext:nK,kReplyErrorHandlerCalled:$B,kReplyHijacked:AY,kReplyStartTime:H6,kReplyEndTime:FY,kReplySerializer:s1,kReplySerializerDefault:oZ,kReplyIsError:rZ,kReplyHeaders:O0,kReplyTrailers:p0,kReplyHasStatusCode:NY,kReplyIsRunningOnErrorHook:OY,kReplyNextErrorHandler:of,kDisableRequestLogging:ZB,kSchemaResponse:tZ,kReplyCacheSerializeFns:M$,kSchemaController:wY,kOptions:rf,kRouteContext:w0,kTimeoutTimer:eZ,kOnAbort:M8,kRequestSignal:QB}=u0(),{onSendHookRunner:XB,onResponseHookRunner:tf,preHandlerHookRunner:ef,preSerializationHookRunner:$2}=w$(),sK=HX()[Symbol.for("internals")],Z2=G6(),MY=Z2.now,{handleError:aK}=B6(),{getSchemaSerializer:Q2}=K6(),VY={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:X2,FST_ERR_REP_RESPONSE_BODY_CONSUMED:Y2,FST_ERR_REP_READABLE_STREAM_LOCKED:J2,FST_ERR_REP_ALREADY_SENT:W2,FST_ERR_SEND_INSIDE_ONERR:G2,FST_ERR_BAD_STATUS_CODE:K2,FST_ERR_BAD_TRAILER_NAME:B2,FST_ERR_BAD_TRAILER_VALUE:U2,FST_ERR_MISSING_SERIALIZATION_FN:z2,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:w2,FST_ERR_DEC_UNDECLARED:V2}=d0(),oK=w6(),YB=Object.prototype.toString;function j0($,Z,Q){this.raw=$,this[s1]=null,this[$B]=!1,this[rZ]=!1,this[OY]=!1,this.request=Z,this[O0]={},this[p0]=null,this[NY]=!1,this[H6]=void 0,this.log=Q}j0.props=[];Object.defineProperties(j0.prototype,{[w0]:{get(){return this.request[w0]}},elapsedTime:{get(){if(this[H6]===void 0)return 0;return(this[FY]||MY())-this[H6]}},server:{get(){return this.request[w0].server}},sent:{enumerable:!0,get(){return(this[AY]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set($){this.code($)}},routeOptions:{get(){return this.request.routeOptions}}});j0.prototype.writeEarlyHints=function($,Z){return this.raw.writeEarlyHints($,Z),this};j0.prototype.hijack=function(){if(this[AY]=!0,this.request[QB]){if(clearTimeout(this.request[eZ]),this.request[eZ]=null,this.request[M8])this.request.raw.removeListener("close",this.request[M8]),this.request[M8]=null}return this};j0.prototype.send=function($){if(this[OY])throw new G2;if(this.sent===!0)return this.log.warn({err:new W2(this.request.url,this.request.method)}),this;if(this[rZ]||$ instanceof Error)return this[rZ]=!1,A8(this,$,y$),this;if($===void 0)return y$(this,$),this;let Z=this.getHeader("content-type"),Q=Z!==void 0;if($!==null){if(typeof $.pipe==="function"||typeof $.getReader==="function"||YB.call($)==="[object Response]")return y$(this,$),this;if($.buffer instanceof ArrayBuffer){if(!Q)this[O0]["content-type"]=VY.OCTET;let X=Buffer.isBuffer($)?$:Buffer.from($.buffer,$.byteOffset,$.byteLength);return y$(this,X),this}if(!Q&&typeof $==="string")return this[O0]["content-type"]=VY.PLAIN,y$(this,$),this}if(this[s1]!==null){if(typeof $!=="string")return rK(this,$),this;$=this[s1]($)}else if(!Q||Z.indexOf("json")!==-1){if(!Q)this[O0]["content-type"]=VY.JSON;else if(Z.indexOf("charset")===-1){let X=Z.trim();if(X.endsWith(";"))this[O0]["content-type"]=`${X} charset=utf-8`;else this[O0]["content-type"]=`${X}; charset=utf-8`}if(typeof $!=="string")return rK(this,$),this}return y$(this,$),this};j0.prototype.getHeader=function($){$=$.toLowerCase();let Z=this[O0][$];return Z!==void 0?Z:this.raw.getHeader($)};j0.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[O0]}};j0.prototype.hasHeader=function($){return $=$.toLowerCase(),this[O0][$]!==void 0||this.raw.hasHeader($)};j0.prototype.removeHeader=function($){return delete this[O0][$.toLowerCase()],this};j0.prototype.header=function($,Z=""){if($=$.toLowerCase(),this[O0][$]&&$==="set-cookie"){if(typeof this[O0][$]==="string")this[O0][$]=[this[O0][$]];if(Array.isArray(Z))Array.prototype.push.apply(this[O0][$],Z);else this[O0][$].push(Z)}else this[O0][$]=Z;return this};j0.prototype.headers=function($){let Z=Object.keys($);for(let Q=0;Q!==Z.length;++Q){let X=Z[Q];this.header(X,$[X])}return this};var H2=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);j0.prototype.trailer=function($,Z){if($=$.toLowerCase(),H2.has($))throw new B2($);if(typeof Z!=="function")throw new U2($,typeof Z);if(this[p0]===null)this[p0]={};return this[p0][$]=Z,this};j0.prototype.hasTrailer=function($){return this[p0]?.[$.toLowerCase()]!==void 0};j0.prototype.removeTrailer=function($){if(this[p0]===null)return this;return this[p0][$.toLowerCase()]=void 0,this};j0.prototype.code=function($){let Z=+$;if(!(Z>=100&&Z<=599))throw new K2($||String($));return this.raw.statusCode=Z,this[NY]=!0,this};j0.prototype.status=j0.prototype.code;j0.prototype.getSerializationFunction=function($,Z){let Q;if(typeof $==="string"||typeof $==="number")if(typeof Z==="string")Q=this[w0][tZ]?.[$]?.[Z];else Q=this[w0][tZ]?.[$];else if(typeof $==="object")Q=this[w0][M$]?.get($);return Q};j0.prototype.compileSerializationSchema=function($,Z=null,Q=null){let{request:X}=this,{method:Y,url:J}=X;if(this[w0][M$]?.has($))return this[w0][M$].get($);let G=(this[w0].serializerCompiler||this.server[wY].serializerCompiler||(this.server[wY].setupSerializer(this.server[rf])||this.server[wY].serializerCompiler))({schema:$,method:Y,url:J,httpStatus:Z,contentType:Q});if(this[w0][M$]==null)this[w0][M$]=new WeakMap;return this[w0][M$].set($,G),G};j0.prototype.serializeInput=function($,Z,Q,X){let Y=Q,J;if(Q=typeof Z==="string"||typeof Z==="number"?Z:Q,X=Q&&Y!==Q?Y:X,Q!=null){if(X!=null)J=this[w0][tZ]?.[Q]?.[X];else J=this[w0][tZ]?.[Q];if(J==null){if(X)throw new w2(Q,X);throw new z2(Q)}}else if(this[w0][M$]?.has(Z))J=this[w0][M$].get(Z);else J=this.compileSerializationSchema(Z,Q,X);return J($)};j0.prototype.serialize=function($){if(this[s1]!==null)return this[s1]($);else if(this[w0]&&this[w0][oZ])return this[w0][oZ]($,this.raw.statusCode);else return WB(this[w0],$,this.raw.statusCode)};j0.prototype.serializer=function($){return this[s1]=$,this};j0.prototype.type=function($){return this[O0]["content-type"]=$,this};j0.prototype.redirect=function($,Z){if(!Z)Z=this[NY]?this.raw.statusCode:302;return this.header("location",$).code(Z).send()};j0.prototype.callNotFound=function(){return T2(this),this};j0.prototype.then=function($,Z){if(this.sent){$();return}aZ(this.raw,(Q)=>{if(Q&&Q.code!=="ERR_STREAM_PREMATURE_CLOSE")if(Z)Z(Q);else this.log&&this.log.warn("unhandled rejection on reply.then");else $()})};j0.prototype.getDecorator=function($){if(!oK.hasKey(this,$)&&!oK.exist(this,$))throw new V2($,"reply");let Z=this[$];if(typeof Z==="function")return Z.bind(this);return Z};function rK($,Z){if($[w0].preSerialization!==null)$2($[w0].preSerialization,$.request,$,Z,tK);else tK(null,void 0,$,Z)}function tK($,Z,Q,X){if($!=null){A8(Q,$);return}try{if(Q[s1]!==null)X=Q[s1](X);else if(Q[w0]&&Q[w0][oZ])X=Q[w0][oZ](X,Q.raw.statusCode);else X=WB(Q[w0],X,Q.raw.statusCode,Q[O0]["content-type"])}catch(Y){M2(Y,Q),A8(Q,Y);return}y$(Q,X)}function M2($,Z){$.serialization=Z[w0].config}function y$($,Z){if($[w0].onSend!==null)XB($[w0].onSend,$.request,$,Z,A2);else JB($,Z)}function A2($,Z,Q,X){if($!=null)A8(Q,$);else JB(Q,X)}function HY($,Z){let Q=$.raw;try{Q.writeHead(Z,$[O0])}catch(X){if(X.code==="ERR_HTTP_HEADERS_SENT")$.log.warn(`Reply was already sent, did you forget to "return reply" in the "${$.request.raw.url}" (${$.request.raw.method}) route?`);throw X}}function JB($,Z){let{raw:Q,request:X}=$;if($[p0]!==null){let J=Object.keys($[p0]),W="";for(let G of J){if(typeof $[p0][G]!=="function")continue;W+=" ",W+=G}$.header("Transfer-Encoding","chunked"),$.header("Trailer",W.trim())}if(YB.call(Z)==="[object Response]"){if(typeof Z.status==="number")$.code(Z.status);if(typeof Z.headers==="object"&&typeof Z.headers.forEach==="function")for(let[J,W]of Z.headers)$.header(J,W);if(Z.body!==null){if(Z.bodyUsed)throw new Y2}Z=Z.body}let Y=Q.statusCode;if(Z===void 0||Z===null){if(Y>=200&&Y!==204&&Y!==304&&X.method!=="HEAD"&&$[p0]===null)$[O0]["content-length"]="0";HY($,Y),V6(Z,Q,$);return}if(Y>=100&&Y<200||Y===204){if($.removeHeader("content-type"),$.removeHeader("content-length"),HY($,Y),V6(void 0,Q,$),typeof Z.resume==="function")Z.on("error",ZQ),Z.resume();return}if(typeof Z.pipe==="function"){N2(Z,Q,$);return}if(typeof Z.getReader==="function"){F2(Z,Q,$);return}if(typeof Z!=="string"&&!Buffer.isBuffer(Z))throw new X2(typeof Z);if($[p0]===null){let J=$[O0]["content-length"];if(!J||X.raw.method!=="HEAD"&&Number(J)!==Buffer.byteLength(Z))$[O0]["content-length"]=""+Buffer.byteLength(Z)}HY($,Y),Q.write(Z),V6(Z,Q,$)}function $Q($,Z,Q){if(Z.code==="ERR_STREAM_PREMATURE_CLOSE"){if(!$[ZB])$.info({res:Q},"stream closed prematurely")}else $.warn({err:Z},"response terminated with an error with headers already sent")}function F2($,Z,Q){if($.locked)throw new J2;let X=!0,Y=!1,J=!1,W=$.getReader();if(aZ(Z,function(U){if(X){if(U!=null&&Z.headersSent&&!Y)Y=!0,$Q(Q.log,U,Z);W.cancel().catch(ZQ)}}),!Z.headersSent)for(let U in Q[O0])Z.setHeader(U,Q[O0][U]);else Q.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");function G(U){if(U.done){X=!1,V6(null,Z,Q);return}if(Z.destroyed){X=!1,W.cancel().catch(ZQ);return}if(Z.write(U.value)===!1){J=!0,Z.once("drain",K);return}W.read().then(G,B)}function K(){if(!J||!X||Z.destroyed)return;J=!1,W.read().then(G,B)}function B(U){if(X=!1,Z.headersSent||Q.request.raw.aborted===!0){if(!Y)Y=!0,$Q(Q.log,U,Q);Z.destroy()}else A8(Q,U)}W.read().then(G,B)}function N2($,Z,Q){let X=!0,Y=!1;if(O2($,Z,Q),aZ($,{readable:!0,writable:!1},function(J){if(X=!1,J!=null)if(Z.headersSent||Q.request.raw.aborted===!0){if(!Y)Y=!0,$Q(Q.log,J,Q);Z.destroy()}else A8(Q,J)}),aZ(Z,function(J){if(X){if(J!=null&&Z.headersSent&&!Y)Y=!0,$Q(Q.log,J,Z);if(typeof $.destroy==="function")$.destroy();else if(typeof $.close==="function")$.close(ZQ);else if(typeof $.abort==="function")$.abort();else Q.log.warn("stream payload does not end properly")}}),!Z.headersSent)for(let J in Q[O0])Z.setHeader(J,Q[O0][J]);else Q.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");$.pipe(Z)}function V6($,Z,Q){if(Q[p0]===null){Z.end(null,null,null);return}let X=Object.keys(Q[p0]),Y={},J=0,W=!0;function G(){if(J===0)Z.addTrailers(Y),Z.end(null,null,null)}for(let K of X){let B=function(w,H){if(J++,w)Q.log.debug(w);else Y[K]=H;process.nextTick(G)};if(typeof Q[p0][K]!=="function")continue;W=!1,J--;let U=Q[p0][K](Q,$,B);if(typeof U==="object"&&typeof U.then==="function")U.then((w)=>B(null,w),B)}if(W)Z.end(null,null,null)}function O2($,Z,Q){if(Q[p0]===null)return;$.on("end",()=>V6(null,Z,Q))}function A8($,Z,Q){if($[w0].onError!==null&&!$[of])$[OY]=!0,XB($[w0].onError,$.request,$,Z,()=>aK($,Z,Q));else aK($,Z,Q)}function j2($){$[H6]=MY();let Z=(Q)=>{$[FY]=MY(),$.raw.removeListener("finish",Z),$.raw.removeListener("error",Z);let X=$[w0];if($.request[QB]){if(clearTimeout($.request[eZ]),$.request[eZ]=null,$.request[M8])$.request.raw.removeListener("close",$.request[M8]),$.request[M8]=null}if(X&&X.onResponse!==null)tf(X.onResponse,$.request,$,eK);else eK(Q,$.request,$)};$.raw.on("finish",Z),$.raw.on("error",Z)}function eK($,Z,Q){if(Q.log[ZB])return;let X=Q.elapsedTime;if($!=null){Q.log.error({res:Q,err:$,responseTime:X},"request errored");return}Q.log.info({res:Q,responseTime:X},"request completed")}function D2($){let Z=$.props.slice();function Q(X,Y,J){this.raw=X,this[rZ]=!1,this[$B]=!1,this[AY]=!1,this[s1]=null,this.request=Y,this[O0]={},this[p0]=null,this[H6]=void 0,this[FY]=void 0,this.log=J;let W;for(let G=0;G<Z.length;G++)W=Z[G],this[W.key]=W.value}return Object.setPrototypeOf(Q.prototype,$.prototype),Object.setPrototypeOf(Q,$),Q.parent=$,Q.props=Z,Q}function T2($){if($[w0][nK]===null){$.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),$.code(404).send("404 Not Found");return}if($.request[w0]=$[w0][nK],$[w0].preHandler!==null)ef($[w0].preHandler,$.request,$,sK.preHandlerCallback);else sK.preHandlerCallback(null,$.request,$)}function WB($,Z,Q,X){let Y=Q2($,Q,X);if(Y)return Y(Z);return JSON.stringify(Z)}function ZQ(){}QQ.exports=j0;QQ.exports.buildReply=D2;QQ.exports.setupResponseListeners=j2});var GB=I((sg,YQ)=>{function jY($){if(!$)throw TypeError("argument req is required");let Z=$.headers["x-forwarded-for"],Q=$.socket.remoteAddress;if(!Z||typeof Z!=="string")return[Q];else if(Z.indexOf(",")===-1){let X=Z.trim();return X.length?[Q,X]:[Q]}else return q2(Z,Q)}function q2($,Z){let Q=[Z],X=$.length,Y=X,J,W;for(W=X-1;W>=0;--W)if(J=$[W],J===" ")Y===X&&(Y=X=W);else if(J===",")Y!==X&&Q.push($.slice(Y,X)),Y=X=W;else Y=W;return Y!==X&&Q.push($.substring(Y,X)),Q}YQ.exports=jY;YQ.exports.default=jY;YQ.exports.forwarded=jY});var BB=I((KB,JQ)=>{(function($){let Q={fourOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),threeOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),twoOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),longValue:new RegExp("^(0?\\d+|0x[a-f0-9]+)$","i")},X=new RegExp("^0[0-7]+$","i"),Y=new RegExp("^0x[a-f0-9]+$","i"),J="%[0-9a-z]{1,}",W="(?:[0-9a-f]+::?)+",G={zoneIndex:new RegExp("%[0-9a-z]{1,}","i"),native:new RegExp("^(::)?((?:[0-9a-f]+::?)+)?([0-9a-f]+)?(::)?(%[0-9a-z]{1,})?$","i"),deprecatedTransitional:new RegExp("^(?:::)((0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)(%[0-9a-z]{1,})?)$","i"),transitional:new RegExp("^((?:(?:[0-9a-f]+::?)+)|(?:::)(?:(?:[0-9a-f]+::?)+)?)(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)(%[0-9a-z]{1,})?$","i")};function K(V,z){if(V.indexOf("::")!==V.lastIndexOf("::"))return null;let N=0,F=-1,O=(V.match(G.zoneIndex)||[])[0],j,M;if(O)O=O.substring(1),V=V.replace(/%.+$/,"");while((F=V.indexOf(":",F+1))>=0)N++;if(V.substr(0,2)==="::")N--;if(V.substr(-2,2)==="::")N--;if(N>z)return null;M=z-N,j=":";while(M--)j+="0:";if(V=V.replace("::",j),V[0]===":")V=V.slice(1);if(V[V.length-1]===":")V=V.slice(0,-1);return z=function(){let A=V.split(":"),D=[];for(let f=0;f<A.length;f++)D.push(parseInt(A[f],16));return D}(),{parts:z,zoneId:O}}function B(V,z,N,F){if(V.length!==z.length)throw Error("ipaddr: cannot match CIDR for objects with different lengths");let O=0,j;while(F>0){if(j=N-F,j<0)j=0;if(V[O]>>j!==z[O]>>j)return!1;F-=N,O+=1}return!0}function U(V){if(Y.test(V))return parseInt(V,16);if(V[0]==="0"&&!isNaN(parseInt(V[1],10))){if(X.test(V))return parseInt(V,8);throw Error(`ipaddr: cannot parse ${V} as octal`)}return parseInt(V,10)}function w(V,z){while(V.length<z)V=`0${V}`;return V}let H={};if(H.IPv4=function(){function V(z){if(z.length!==4)throw Error("ipaddr: ipv4 octet count should be 4");let N,F;for(N=0;N<z.length;N++)if(F=z[N],!(0<=F&&F<=255))throw Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=z}return V.prototype.SpecialRanges={unspecified:[[new V([0,0,0,0]),8]],broadcast:[[new V([255,255,255,255]),32]],multicast:[[new V([224,0,0,0]),4]],linkLocal:[[new V([169,254,0,0]),16]],loopback:[[new V([127,0,0,0]),8]],carrierGradeNat:[[new V([100,64,0,0]),10]],private:[[new V([10,0,0,0]),8],[new V([172,16,0,0]),12],[new V([192,168,0,0]),16]],reserved:[[new V([192,0,0,0]),24],[new V([192,0,2,0]),24],[new V([192,88,99,0]),24],[new V([198,18,0,0]),15],[new V([198,51,100,0]),24],[new V([203,0,113,0]),24],[new V([240,0,0,0]),4]],as112:[[new V([192,175,48,0]),24],[new V([192,31,196,0]),24]],amt:[[new V([192,52,193,0]),24]]},V.prototype.kind=function(){return"ipv4"},V.prototype.match=function(z,N){let F;if(N===void 0)F=z,z=F[0],N=F[1];if(z.kind()!=="ipv4")throw Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return B(this.octets,z.octets,8,N)},V.prototype.prefixLengthFromSubnetMask=function(){let z=0,N=!1,F={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},O,j,M;for(O=3;O>=0;O-=1)if(j=this.octets[O],j in F){if(M=F[j],N&&M!==0)return null;if(M!==8)N=!0;z+=M}else return null;return 32-z},V.prototype.range=function(){return H.subnetMatch(this,this.SpecialRanges)},V.prototype.toByteArray=function(){return this.octets.slice(0)},V.prototype.toIPv4MappedAddress=function(){return H.IPv6.parse(`::ffff:${this.toString()}`)},V.prototype.toNormalizedString=function(){return this.toString()},V.prototype.toString=function(){return this.octets.join(".")},V}(),H.IPv4.broadcastAddressFromCIDR=function(V){try{let z=this.parseCIDR(V),N=z[0].toByteArray(),F=this.subnetMaskFromPrefixLength(z[1]).toByteArray(),O=[],j=0;while(j<4)O.push(parseInt(N[j],10)|parseInt(F[j],10)^255),j++;return new this(O)}catch(z){throw Error("ipaddr: the address does not have IPv4 CIDR format")}},H.IPv4.isIPv4=function(V){return this.parser(V)!==null},H.IPv4.isValid=function(V){try{return new this(this.parser(V)),!0}catch(z){return!1}},H.IPv4.isValidCIDR=function(V){try{return this.parseCIDR(V),!0}catch(z){return!1}},H.IPv4.isValidFourPartDecimal=function(V){if(H.IPv4.isValid(V)&&V.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))return!0;else return!1},H.IPv4.isValidCIDRFourPartDecimal=function(V){let z=V.match(/^(.+)\/(\d+)$/);if(!H.IPv4.isValidCIDR(V)||!z)return!1;return H.IPv4.isValidFourPartDecimal(z[1])},H.IPv4.networkAddressFromCIDR=function(V){let z,N,F,O,j;try{z=this.parseCIDR(V),F=z[0].toByteArray(),j=this.subnetMaskFromPrefixLength(z[1]).toByteArray(),O=[],N=0;while(N<4)O.push(parseInt(F[N],10)&parseInt(j[N],10)),N++;return new this(O)}catch(M){throw Error("ipaddr: the address does not have IPv4 CIDR format")}},H.IPv4.parse=function(V){let z=this.parser(V);if(z===null)throw Error("ipaddr: string is not formatted like an IPv4 Address");return new this(z)},H.IPv4.parseCIDR=function(V){let z;if(z=V.match(/^(.+)\/(\d+)$/)){let N=parseInt(z[2]);if(N>=0&&N<=32){let F=[this.parse(z[1]),N];return Object.defineProperty(F,"toString",{value:function(){return this.join("/")}}),F}}throw Error("ipaddr: string is not formatted like an IPv4 CIDR range")},H.IPv4.parser=function(V){let z,N,F;if(z=V.match(Q.fourOctet))return function(){let O=z.slice(1,6),j=[];for(let M=0;M<O.length;M++)N=O[M],j.push(U(N));return j}();else if(z=V.match(Q.longValue)){if(F=U(z[1]),F>4294967295||F<0)throw Error("ipaddr: address outside defined range");return function(){let O=[],j;for(j=0;j<=24;j+=8)O.push(F>>j&255);return O}().reverse()}else if(z=V.match(Q.twoOctet))return function(){let O=z.slice(1,4),j=[];if(F=U(O[1]),F>16777215||F<0)throw Error("ipaddr: address outside defined range");return j.push(U(O[0])),j.push(F>>16&255),j.push(F>>8&255),j.push(F&255),j}();else if(z=V.match(Q.threeOctet))return function(){let O=z.slice(1,5),j=[];if(F=U(O[2]),F>65535||F<0)throw Error("ipaddr: address outside defined range");return j.push(U(O[0])),j.push(U(O[1])),j.push(F>>8&255),j.push(F&255),j}();else return null},H.IPv4.subnetMaskFromPrefixLength=function(V){if(V=parseInt(V),V<0||V>32)throw Error("ipaddr: invalid IPv4 prefix length");let z=[0,0,0,0],N=0,F=Math.floor(V/8);while(N<F)z[N]=255,N++;if(F<4)z[F]=Math.pow(2,V%8)-1<<8-V%8;return new this(z)},H.IPv6=function(){function V(z,N){let F,O;if(z.length===16){this.parts=[];for(F=0;F<=14;F+=2)this.parts.push(z[F]<<8|z[F+1])}else if(z.length===8)this.parts=z;else throw Error("ipaddr: ipv6 part count should be 8 or 16");for(F=0;F<this.parts.length;F++)if(O=this.parts[F],!(0<=O&&O<=65535))throw Error("ipaddr: ipv6 part should fit in 16 bits");if(N)this.zoneId=N}return V.prototype.SpecialRanges={unspecified:[new V([0,0,0,0,0,0,0,0]),128],linkLocal:[new V([65152,0,0,0,0,0,0,0]),10],multicast:[new V([65280,0,0,0,0,0,0,0]),8],loopback:[new V([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new V([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new V([0,0,0,0,0,65535,0,0]),96],discard:[new V([256,0,0,0,0,0,0,0]),64],rfc6145:[new V([0,0,0,0,65535,0,0,0]),96],rfc6052:[new V([100,65435,0,0,0,0,0,0]),96],"6to4":[new V([8194,0,0,0,0,0,0,0]),16],teredo:[new V([8193,0,0,0,0,0,0,0]),32],benchmarking:[new V([8193,2,0,0,0,0,0,0]),48],amt:[new V([8193,3,0,0,0,0,0,0]),32],as112v6:[[new V([8193,4,274,0,0,0,0,0]),48],[new V([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new V([8193,16,0,0,0,0,0,0]),28],orchid2:[new V([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new V([8193,48,0,0,0,0,0,0]),28],reserved:[[new V([8193,0,0,0,0,0,0,0]),23],[new V([8193,3512,0,0,0,0,0,0]),32]]},V.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},V.prototype.kind=function(){return"ipv6"},V.prototype.match=function(z,N){let F;if(N===void 0)F=z,z=F[0],N=F[1];if(z.kind()!=="ipv6")throw Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return B(this.parts,z.parts,16,N)},V.prototype.prefixLengthFromSubnetMask=function(){let z=0,N=!1,F={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},O,j;for(let M=7;M>=0;M-=1)if(O=this.parts[M],O in F){if(j=F[O],N&&j!==0)return null;if(j!==16)N=!0;z+=j}else return null;return 128-z},V.prototype.range=function(){return H.subnetMatch(this,this.SpecialRanges)},V.prototype.toByteArray=function(){let z,N=[],F=this.parts;for(let O=0;O<F.length;O++)z=F[O],N.push(z>>8),N.push(z&255);return N},V.prototype.toFixedLengthString=function(){let z=function(){let F=[];for(let O=0;O<this.parts.length;O++)F.push(w(this.parts[O].toString(16),4));return F}.call(this).join(":"),N="";if(this.zoneId)N=`%${this.zoneId}`;return z+N},V.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let z=this.parts.slice(-2),N=z[0],F=z[1];return new H.IPv4([N>>8,N&255,F>>8,F&255])},V.prototype.toNormalizedString=function(){let z=function(){let F=[];for(let O=0;O<this.parts.length;O++)F.push(this.parts[O].toString(16));return F}.call(this).join(":"),N="";if(this.zoneId)N=`%${this.zoneId}`;return z+N},V.prototype.toRFC5952String=function(){let z=/((^|:)(0(:|$)){2,})/g,N=this.toNormalizedString(),F=0,O=-1,j;while(j=z.exec(N))if(j[0].length>O)F=j.index,O=j[0].length;if(O<0)return N;return`${N.substring(0,F)}::${N.substring(F+O)}`},V.prototype.toString=function(){return this.toRFC5952String()},V}(),H.IPv6.broadcastAddressFromCIDR=function(V){try{let z=this.parseCIDR(V),N=z[0].toByteArray(),F=this.subnetMaskFromPrefixLength(z[1]).toByteArray(),O=[],j=0;while(j<16)O.push(parseInt(N[j],10)|parseInt(F[j],10)^255),j++;return new this(O)}catch(z){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${z})`)}},H.IPv6.isIPv6=function(V){return this.parser(V)!==null},H.IPv6.isValid=function(V){if(typeof V==="string"&&V.indexOf(":")===-1)return!1;try{let z=this.parser(V);return new this(z.parts,z.zoneId),!0}catch(z){return!1}},H.IPv6.isValidCIDR=function(V){if(typeof V==="string"&&V.indexOf(":")===-1)return!1;try{return this.parseCIDR(V),!0}catch(z){return!1}},H.IPv6.networkAddressFromCIDR=function(V){let z,N,F,O,j;try{z=this.parseCIDR(V),F=z[0].toByteArray(),j=this.subnetMaskFromPrefixLength(z[1]).toByteArray(),O=[],N=0;while(N<16)O.push(parseInt(F[N],10)&parseInt(j[N],10)),N++;return new this(O)}catch(M){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${M})`)}},H.IPv6.parse=function(V){let z=this.parser(V);if(z.parts===null)throw Error("ipaddr: string is not formatted like an IPv6 Address");return new this(z.parts,z.zoneId)},H.IPv6.parseCIDR=function(V){let z,N,F;if(N=V.match(/^(.+)\/(\d+)$/)){if(z=parseInt(N[2]),z>=0&&z<=128)return F=[this.parse(N[1]),z],Object.defineProperty(F,"toString",{value:function(){return this.join("/")}}),F}throw Error("ipaddr: string is not formatted like an IPv6 CIDR range")},H.IPv6.parser=function(V){let z,N,F,O,j,M;if(F=V.match(G.deprecatedTransitional))return this.parser(`::ffff:${F[1]}`);if(G.native.test(V))return K(V,8);if(F=V.match(G.transitional)){if(M=F[6]||"",z=F[1],!F[1].endsWith("::"))z=z.slice(0,-1);if(z=K(z+M,6),z.parts){j=[parseInt(F[2]),parseInt(F[3]),parseInt(F[4]),parseInt(F[5])];for(N=0;N<j.length;N++)if(O=j[N],!(0<=O&&O<=255))return null;return z.parts.push(j[0]<<8|j[1]),z.parts.push(j[2]<<8|j[3]),{parts:z.parts,zoneId:z.zoneId}}}return null},H.IPv6.subnetMaskFromPrefixLength=function(V){if(V=parseInt(V),V<0||V>128)throw Error("ipaddr: invalid IPv6 prefix length");let z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N=0,F=Math.floor(V/8);while(N<F)z[N]=255,N++;if(F<16)z[F]=Math.pow(2,V%8)-1<<8-V%8;return new this(z)},H.fromByteArray=function(V){let z=V.length;if(z===4)return new H.IPv4(V);else if(z===16)return new H.IPv6(V);else throw Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},H.isValid=function(V){return H.IPv6.isValid(V)||H.IPv4.isValid(V)},H.isValidCIDR=function(V){return H.IPv6.isValidCIDR(V)||H.IPv4.isValidCIDR(V)},H.parse=function(V){if(H.IPv6.isValid(V))return H.IPv6.parse(V);else if(H.IPv4.isValid(V))return H.IPv4.parse(V);else throw Error("ipaddr: the address has neither IPv6 nor IPv4 format")},H.parseCIDR=function(V){try{return H.IPv6.parseCIDR(V)}catch(z){try{return H.IPv4.parseCIDR(V)}catch(N){throw Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},H.process=function(V){let z=this.parse(V);if(z.kind()==="ipv6"&&z.isIPv4MappedAddress())return z.toIPv4Address();else return z},H.subnetMatch=function(V,z,N){let F,O,j,M;if(N===void 0||N===null)N="unicast";for(O in z)if(Object.prototype.hasOwnProperty.call(z,O)){if(j=z[O],j[0]&&!(j[0]instanceof Array))j=[j];for(F=0;F<j.length;F++)if(M=j[F],V.kind()===M[0].kind()&&V.match.apply(V,M))return O}return N},typeof JQ<"u"&&JQ.exports)JQ.exports=H;else $.ipaddr=H})(KB)});var HB=I((ag,F8)=>{/*!
27
+ * proxy-addr
28
+ * Copyright(c) 2021 Fastify collaborators
29
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
30
+ * MIT Licensed
31
+ */F8.exports=DY;F8.exports.default=DY;F8.exports.proxyaddr=DY;F8.exports.all=wB;F8.exports.compile=VB;var f2=GB(),zB=BB(),L2=/^\d+$/u,WQ=zB.isValid,GQ=zB.parse,UB={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 wB($,Z){let Q=f2($);if(!Z)return Q;if(typeof Z!=="function")Z=VB(Z);for(let X=0;X<Q.length-1;X++){if(Z(Q[X],X))continue;Q.length=X+1}return Q}function VB($){if(!$)throw TypeError("argument is required");let Z;if(typeof $==="string")Z=[$];else if(Array.isArray($))Z=$.slice();else throw TypeError("unsupported trust argument");for(let Q=0;Q<Z.length;Q++){if($=Z[Q],!Object.hasOwn(UB,$))continue;$=UB[$],Z.splice.apply(Z,[Q,1].concat($)),Q+=$.length-1}return P2(R2(Z))}function R2($){let Z=Array($.length);for(let Q=0;Q<$.length;Q++)Z[Q]=C2($[Q]);return Z}function P2($){let Z=$.length;return Z===0?b2:Z===1?I2($[0]):_2($)}function C2($){let Z=$.lastIndexOf("/"),Q=Z!==-1?$.substring(0,Z):$;if(!WQ(Q))throw TypeError("invalid IP address: "+Q);let X=GQ(Q);if(Z===-1&&X.kind()==="ipv6"&&X.isIPv4MappedAddress())X=X.toIPv4Address();let Y=X.kind()==="ipv6"?128:32,J=Z!==-1?$.substring(Z+1,$.length):null;if(J===null)J=Y;else if(L2.test(J))J=parseInt(J,10);else if(X.kind()==="ipv4"&&WQ(J))J=E2(J);else J=null;if(J<=0||J>Y)throw TypeError("invalid range on address: "+$);return[X,J]}function E2($){let Z=GQ($);return Z.kind()==="ipv4"?Z.prefixLengthFromSubnetMask():null}function DY($,Z){if(!$)throw TypeError("req argument is required");if(!Z)throw TypeError("trust argument is required");let Q=wB($,Z);return Q[Q.length-1]}function b2(){return!1}function _2($){return function(Q){if(!WQ(Q))return!1;let X=GQ(Q),Y,J=X.kind();for(let W=0;W<$.length;W++){let G=$[W],K=G[0],B=K.kind(),U=G[1],w=X;if(J!==B){let H=B==="ipv4";if(H&&!X.isIPv4MappedAddress())continue;if(!Y)Y=H?X.toIPv4Address():X.toIPv4MappedAddress();w=Y}if(w.match(K,U))return!0}return!1}}function I2($){let Z=$[0],Q=Z.kind(),X=Q==="ipv4",Y=$[1];return function(W){if(!WQ(W))return!1;let G=GQ(W);if(G.kind()!==Q){if(X&&!G.isIPv4MappedAddress())return!1;G=X?G.toIPv4Address():G.toIPv4MappedAddress()}return G.match(Z,Y)}}});var BQ=I((og,LY)=>{var KQ=HB(),{kHasBeenDecorated:S2,kSchemaBody:x2,kSchemaHeaders:k2,kSchemaParams:v2,kSchemaQuerystring:MB,kSchemaController:TY,kOptions:y2,kRequestCacheValidateFns:A$,kRouteContext:t0,kRequestOriginalUrl:qY,kRequestSignal:AB,kOnAbort:g2}=u0(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:h2,FST_ERR_DEC_UNDECLARED:u2}=d0(),FB=w6(),NB={body:x2,headers:k2,params:v2,querystring:MB,query:MB};function fY($,Z,Q,X,Y,J){this.id=$,this[t0]=J,this.params=Z,this.raw=Q,this.query=X,this.log=Y,this.body=void 0}fY.props=[];function m2($){if(typeof $==="function")return $;if($===!0)return function(){return!0};if(typeof $==="number")return function(Z,Q){return Q<$};if(typeof $==="string"){let Z=$.split(",").map((Q)=>Q.trim());return KQ.compile(Z)}return KQ.compile($)}function l2($,Z){if(Z)return c2($,Z);return DB($)}function DB($){let Z=$.props.slice();function Q(X,Y,J,W,G,K){this.id=X,this[t0]=K,this.params=Y,this.raw=J,this.query=W,this.log=G,this.body=void 0;let B;for(let U=0;U<Z.length;U++)B=Z[U],this[B.key]=B.value}return Object.setPrototypeOf(Q.prototype,$.prototype),Object.setPrototypeOf(Q,$),Q.props=Z,Q.parent=$,Q}function OB($){let Z=$.lastIndexOf(",");return Z===-1?$.trim():$.slice(Z+1).trim()}function c2($,Z){let Q=DB($),X=m2(Z);return Q[S2]=!0,Object.defineProperties(Q.prototype,{ip:{get(){let Y=KQ.all(this.raw,X);return Y[Y.length-1]}},ips:{get(){return KQ.all(this.raw,X)}},host:{get(){let Y=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-host"]&&Y!==null&&X(Y,0))return OB(this.headers["x-forwarded-host"]);return this.headers.host??this.headers[":authority"]??""}},protocol:{get(){let Y=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-proto"]&&Y!==null&&X(Y,0))return OB(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),Q}function jB($,Z){if(!FB.hasKey($,Z)&&!FB.exist($,Z))throw new u2(Z,"request")}Object.defineProperties(fY.prototype,{server:{get(){return this[t0].server}},url:{get(){return this.raw.url}},originalUrl:{get(){if(!this[qY])this[qY]=this.raw.originalUrl||this.raw.url;return this[qY]}},method:{get(){return this.raw.method}},routeOptions:{get(){let $=this[t0],Z=$._parserOptions.limit,Q=$.server.initialConfig.bodyLimit,X=$.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:$.config?.method,url:$.config?.url,bodyLimit:Z||Q,handlerTimeout:$.handlerTimeout,attachValidation:$.attachValidation,logLevel:$.logLevel,exposeHeadRoute:$.exposeHeadRoute,prefixTrailingSlash:$.prefixTrailingSlash,handler:$.handler,config:$.config,schema:$.schema,version:X}}},is404:{get(){return this[t0].config?.url===void 0}},socket:{get(){return this.raw.socket}},signal:{get(){let $=this[AB];if($)return $.signal;$=new AbortController,this[AB]=$;let Z=()=>{if(!$.signal.aborted)$.abort()};return this.raw.on("close",Z),this[g2]=Z,$.signal}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){if(this.host[0]==="[")return this.host.slice(0,this.host.indexOf("]")+1);return this.host.split(":",1)[0]}},port:{get(){let $=/(?<port>:\d+)$/,Z=this.headers.host??this.headers[":authority"]??"",Q=$.exec(Z);if(Q===null||Q[1]===void 0)return null;return parseInt(Q.groups.port.slice(1),10)}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){if(this.additionalHeaders)return Object.assign({},this.raw.headers,this.additionalHeaders);return this.raw.headers},set($){this.additionalHeaders=$}},getValidationFunction:{value:function($){if(typeof $==="string"){let Z=NB[$];return this[t0][Z]}else if(typeof $==="object")return this[t0][A$]?.get($)}},compileValidationSchema:{value:function($,Z=null){let{method:Q,url:X}=this;if(this[t0][A$]?.has($))return this[t0][A$].get($);let J=(this[t0].validatorCompiler||this.server[TY].validatorCompiler||(this.server[TY].setupValidator(this.server[y2])||this.server[TY].validatorCompiler))({schema:$,method:Q,url:X,httpPart:Z});if(this[t0][A$]==null)this[t0][A$]=new WeakMap;return this[t0][A$].set($,J),J}},validateInput:{value:function($,Z,Q){Q=typeof Z==="string"?Z:Q;let X=Q!=null&&typeof Q==="string"&&NB[Q],Y;if(X)Y=this[t0][X];if(Y==null&&(Z==null||typeof Z!=="object"||Array.isArray(Z)))throw new h2(Q);if(Y==null)if(this[t0][A$]?.has(Z))Y=this[t0][A$].get(Z);else Y=this.compileValidationSchema(Z,Q);return Y($)}},getDecorator:{value:function($){jB(this,$);let Z=this[$];if(typeof Z==="function")return Z.bind(this);return Z}},setDecorator:{value:function($,Z){jB(this,$),this[$]=Z}}});LY.exports=fY;LY.exports.buildRequest=l2});var UQ=I((rg,TB)=>{var{kFourOhFourContext:d2,kReplySerializerDefault:p2,kSchemaErrorFormatter:i2,kErrorHandler:n2,kChildLoggerFactory:s2,kOptions:a2,kReply:o2,kRequest:r2,kBodyLimit:t2,kLogLevel:e2,kContentTypeParser:$L,kRouteByFastify:ZL,kRequestCacheValidateFns:QL,kReplyCacheSerializeFns:XL,kHandlerTimeout:YL}=u0();function JL({schema:$,handler:Z,config:Q,requestIdLogLabel:X,childLoggerFactory:Y,errorHandler:J,bodyLimit:W,logLevel:G,logSerializers:K,attachValidation:B,validatorCompiler:U,serializerCompiler:w,replySerializer:H,schemaErrorFormatter:V,exposeHeadRoute:z,prefixTrailingSlash:N,server:F,isFastify:O,handlerTimeout:j}){this.schema=$,this.handler=Z,this.Reply=F[o2],this.Request=F[r2],this.contentTypeParser=F[$L],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=Q,this.errorHandler=J||F[n2],this.requestIdLogLabel=X||F[a2].requestIdLogLabel,this.childLoggerFactory=Y||F[s2],this._middie=null,this._parserOptions={limit:W||F[t2]},this.exposeHeadRoute=z,this.prefixTrailingSlash=N,this.logLevel=G||F[e2],this.logSerializers=K,this[d2]=null,this.attachValidation=B,this[p2]=H,this.schemaErrorFormatter=V||F[i2]||WL,this[ZL]=O,this[QL]=null,this[XL]=null,this.validatorCompiler=U||null,this.serializerCompiler=w||null,this.handlerTimeout=j||F[YL]||0,this.server=F}function WL($,Z){let Q="",X=", ";for(let Y=0;Y!==$.length;++Y){let J=$[Y];Q+=Z+(J.instancePath||"")+" "+J.message+X}return Error(Q.slice(0,-X.length))}TB.exports=JL});var EY=I((GL)=>{class fB{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=$,this.ttl=Z}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete($){if(this.items.has($)){let Z=this.items.get($);if(this.items.delete($),Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(this.items.delete($.key),this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(this.items.has($))return this.items.get($).expiry}get($){if(this.items.has($)){let Z=this.items.get($);if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return Z.value}}getMany($){let Z=[];for(var Q=0;Q<$.length;Q++)Z.push(this.get($[Q]));return Z}keys(){return this.items.keys()}set($,Z){if(this.items.has($)){let X=this.items.get($);X.value=Z,X.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max)this.evict();let Q={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items.set($,Q),this.size===1)this.first=Q;else this.last.next=Q;this.last=Q}}class LB{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=$,this.ttl=Z}get size(){return this.items.size}bumpLru($){if(this.last===$)return;let Z=this.last,Q=$.next,X=$.prev;if(this.first===$)this.first=Q;if($.next=null,$.prev=Z,Z.next=$,X!==null)X.next=Q;if(Q!==null)Q.prev=X;this.last=$}clear(){this.items=new Map,this.first=null,this.last=null}delete($){if(this.items.has($)){let Z=this.items.get($);if(this.items.delete($),Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(this.items.delete($.key),this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(this.items.has($))return this.items.get($).expiry}get($){if(this.items.has($)){let Z=this.items.get($);if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return this.bumpLru(Z),Z.value}}getMany($){let Z=[];for(var Q=0;Q<$.length;Q++)Z.push(this.get($[Q]));return Z}keys(){return this.items.keys()}set($,Z){if(this.items.has($)){let X=this.items.get($);if(X.value=Z,X.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==X)this.bumpLru(X);return}if(this.max>0&&this.size===this.max)this.evict();let Q={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items.set($,Q),this.size===1)this.first=Q;else this.last.next=Q;this.last=Q}}class zQ{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=$,this.ttl=Z}bumpLru($){if(this.last===$)return;let Z=this.last,Q=$.next,X=$.prev;if(this.first===$)this.first=Q;if($.next=null,$.prev=Z,Z.next=$,X!==null)X.next=Q;if(Q!==null)Q.prev=X;this.last=$}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(delete this.items[$],this.size--,Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(delete this.items[$.key],--this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(Object.prototype.hasOwnProperty.call(this.items,$))return this.items[$].expiry}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return this.bumpLru(Z),Z.value}}getMany($){let Z=[];for(var Q=0;Q<$.length;Q++)Z.push(this.get($[Q]));return Z}keys(){return Object.keys(this.items)}set($,Z){if(Object.prototype.hasOwnProperty.call(this.items,$)){let X=this.items[$];if(X.value=Z,X.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==X)this.bumpLru(X);return}if(this.max>0&&this.size===this.max)this.evict();let Q={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items[$]=Q,++this.size===1)this.first=Q;else this.last.next=Q;this.last=Q}}class RY{constructor(){this.records={}}initForCache($,Z){this.records[$]={[Z]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache($){for(let Z of Object.keys(this.records[$]))this.records[$][Z]={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 qB($){return`${$.getFullYear()}-${($.getMonth()+1).toString().padStart(2,"0")}-${$.getDate().toString().padStart(2,"0")}`}class RB{constructor($,Z,Q){this.cacheId=$,this.statisticTtlInHours=Z,this.collectionStart=new Date,this.currentTimeStamp=qB(this.collectionStart),this.records=Q||new RY,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){if(!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};return this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1000/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($){this.archiveIfNeeded(),this.currentRecord.cacheSize=$}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(){if(this.hoursPassed()>=this.statisticTtlInHours)this.collectionStart=new Date,this.currentTimeStamp=qB(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp)}}class PY extends zQ{constructor($,Z,Q,X,Y){super($||1000,Z||0);if(!Q)throw Error("Cache id is mandatory");this.hitStatistics=new RB(Q,Y!==void 0?Y:24,X)}getStatistics(){return this.hitStatistics.getStatistics()}set($,Z){super.set($,Z),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete($,Z=!1){if(super.delete($),!Z)this.hitStatistics.addInvalidateOne();this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($,!0),this.hitStatistics.addExpiration();return}if(this.bumpLru(Z),!Z.value)this.hitStatistics.addFalsyHit();if(Z.value===void 0||Z.value===null||Z.value==="")this.hitStatistics.addEmptyHit();return this.hitStatistics.addHit(),Z.value}this.hitStatistics.addMiss()}}class CY{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=$,this.ttl=Z}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(delete this.items[$],this.size--,Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(delete this.items[$.key],--this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(Object.prototype.hasOwnProperty.call(this.items,$))return this.items[$].expiry}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return Z.value}}getMany($){let Z=[];for(var Q=0;Q<$.length;Q++)Z.push(this.get($[Q]));return Z}keys(){return Object.keys(this.items)}set($,Z){if(Object.prototype.hasOwnProperty.call(this.items,$)){let X=this.items[$];X.value=Z,X.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max)this.evict();let Q={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items[$]=Q,++this.size===1)this.first=Q;else this.last.next=Q;this.last=Q}}GL.Fifo=CY;GL.FifoMap=fB;GL.FifoObject=CY;GL.HitStatisticsRecord=RY;GL.Lru=zQ;GL.LruHitStatistics=PY;GL.LruMap=LB;GL.LruObject=zQ;GL.LruObjectHitStatistics=PY});var _B=I((eg,N8)=>{var FL=typeof Buffer<"u",PB=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,CB=/"(?: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 EB($,Z,Q){if(Q==null){if(Z!==null&&typeof Z==="object")Q=Z,Z=void 0}if(FL&&Buffer.isBuffer($))$=$.toString();if($&&$.charCodeAt(0)===65279)$=$.slice(1);let X=JSON.parse($,Z);if(X===null||typeof X!=="object")return X;let Y=Q&&Q.protoAction||"error",J=Q&&Q.constructorAction||"error";if(Y==="ignore"&&J==="ignore")return X;if(Y!=="ignore"&&J!=="ignore"){if(PB.test($)===!1&&CB.test($)===!1)return X}else if(Y!=="ignore"&&J==="ignore"){if(PB.test($)===!1)return X}else if(CB.test($)===!1)return X;return bB(X,{protoAction:Y,constructorAction:J,safe:Q&&Q.safe})}function bB($,{protoAction:Z="error",constructorAction:Q="error",safe:X}={}){let Y=[$];while(Y.length){let J=Y;Y=[];for(let W of J){if(Z!=="ignore"&&Object.prototype.hasOwnProperty.call(W,"__proto__")){if(X===!0)return null;else if(Z==="error")throw SyntaxError("Object contains forbidden prototype property");delete W.__proto__}if(Q!=="ignore"&&Object.prototype.hasOwnProperty.call(W,"constructor")&&W.constructor!==null&&typeof W.constructor==="object"&&Object.prototype.hasOwnProperty.call(W.constructor,"prototype")){if(X===!0)return null;else if(Q==="error")throw SyntaxError("Object contains forbidden prototype property");delete W.constructor}for(let G in W){let K=W[G];if(K&&typeof K==="object")Y.push(K)}}}return $}function bY($,Z,Q){let{stackTraceLimit:X}=Error;Error.stackTraceLimit=0;try{return EB($,Z,Q)}finally{Error.stackTraceLimit=X}}function NL($,Z){let{stackTraceLimit:Q}=Error;Error.stackTraceLimit=0;try{return EB($,Z,{safe:!0})}catch{return}finally{Error.stackTraceLimit=Q}}N8.exports=bY;N8.exports.default=bY;N8.exports.parse=bY;N8.exports.safeParse=NL;N8.exports.scan=bB});var kY=I(($h,F6)=>{var{AsyncResource:OL}=u("async_hooks"),{FifoMap:xB}=EY(),{parse:jL}=_B(),A6=WX(),{kDefaultJsonParse:M6,kContentTypeParser:O8,kBodyLimit:DL,kRequestPayloadStream:kB,kState:IY,kTestInternals:TL,kReplyIsError:IB,kRouteContext:qL}=u0(),{FST_ERR_CTP_INVALID_TYPE:wQ,FST_ERR_CTP_EMPTY_TYPE:fL,FST_ERR_CTP_ALREADY_PRESENT:LL,FST_ERR_CTP_INVALID_HANDLER:RL,FST_ERR_CTP_INVALID_PARSE_TYPE:PL,FST_ERR_CTP_BODY_TOO_LARGE:SB,FST_ERR_CTP_INVALID_MEDIA_TYPE:CL,FST_ERR_CTP_INVALID_CONTENT_LENGTH:EL,FST_ERR_CTP_EMPTY_JSON_BODY:bL,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:SY,FST_ERR_CTP_INVALID_JSON_BODY:_L}=d0(),{FSTSEC001:IL}=G8();function a1($,Z,Q){this[M6]=yB(Z,Q),this.customParsers=new Map,this.customParsers.set("application/json",new _Y(!0,!1,$,this[M6])),this.customParsers.set("text/plain",new _Y(!0,!1,$,xY)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new xB(100)}a1.prototype.add=function($,Z,Q){let X=typeof $==="string";if(X){if($=$.trim().toLowerCase(),$.length===0)throw new fL}else if(!($ instanceof RegExp))throw new wQ;if(typeof Q!=="function")throw new RL;if(this.existingParser($))throw new LL($);if(Z.parseAs!==void 0){if(Z.parseAs!=="string"&&Z.parseAs!=="buffer")throw new PL(Z.parseAs)}let Y=new _Y(Z.parseAs==="string",Z.parseAs==="buffer",Z.bodyLimit,Q);if($==="*")this.customParsers.set("",Y);else if(X){let J=new A6($);if(J.isValid===!1)throw new wQ;let W=J.toString();this.parserList.unshift(W),this.customParsers.set(W,Y)}else gL($),this.parserRegExpList.unshift($),this.customParsers.set($.toString(),Y)};a1.prototype.hasParser=function($){if(typeof $==="string")$=new A6($).toString();else{if(!($ instanceof RegExp))throw new wQ;$=$.toString()}return this.customParsers.has($)};a1.prototype.existingParser=function($){if(typeof $==="string"){let Z=new A6($).toString();if($==="application/json"&&this.customParsers.has($))return this.customParsers.get(Z).fn!==this[M6];if($==="text/plain"&&this.customParsers.has($))return this.customParsers.get(Z).fn!==xY}return this.hasParser($)};a1.prototype.getParser=function($){if(typeof $==="string")$=new A6($);let Z=$.toString(),Q=this.cache.get(Z);if(Q!==void 0)return Q;if(Q=this.customParsers.get(Z),Q!==void 0)return this.cache.set(Z,Q),Q;if(Q=this.customParsers.get($.mediaType),Q!==void 0)return Q;for(let X=0;X!==this.parserRegExpList.length;++X){let Y=this.parserRegExpList[X];if(Y.test(Z))return Q=this.customParsers.get(Y.toString()),this.cache.set(Z,Q),Q}return this.customParsers.get("")};a1.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new xB(100)};a1.prototype.remove=function($){let Z;if(typeof $==="string")$=new A6($).toString(),Z=this.parserList;else{if(!($ instanceof RegExp))throw new wQ;$=$.toString(),Z=this.parserRegExpList}let Q=this.customParsers.delete($),X=Z.findIndex((Y)=>Y.toString()===$);if(X>-1)Z.splice(X,1);return Q||X>-1};a1.prototype.run=function($,Z,Q,X){let Y=this.getParser($);if(Y===void 0){if(Q.is404===!0){Z(Q,X);return}X[IB]=!0,X.send(new CL);return}let J=new OL("content-type-parser:run",Q),W=J.bind(K);if(Y.asString===!0||Y.asBuffer===!0){vB(Q,X,X[qL]._parserOptions,Y,W);return}let G=Y.fn(Q,Q[kB],W);if(G&&typeof G.then==="function")G.then((B)=>{W(null,B)},W);function K(B,U){if(J.emitDestroy(),B!=null){X.header("connection","close"),X[IB]=!0,X.send(B);return}Q.body=U,Z(Q,X)}};function vB($,Z,Q,X,Y){let J=X.asString===!0,W=Q.limit===null?X.bodyLimit:Q.limit,G=Number($.headers["content-length"]);if(G>W){Y(new SB,void 0);return}let K=0,B=J?"":[],U=$[kB]||$.raw;if(J)U.setEncoding("utf8");U.on("data",w),U.on("end",H),U.on("error",H),U.resume();function w(V){K+=J?Buffer.byteLength(V):V.length;let{receivedEncodedLength:z=0}=U;if(K>W||z>W){U.removeListener("data",w),U.removeListener("end",H),U.removeListener("error",H),Y(new SB,void 0);return}if(J)B+=V;else B.push(V)}function H(V){if(U.removeListener("data",w),U.removeListener("end",H),U.removeListener("error",H),V!=null){if(!(typeof V.statusCode==="number"&&V.statusCode>=400))V.statusCode=400;Y(V,void 0);return}if(!Number.isNaN(G)&&(U.receivedEncodedLength||K)!==G){Y(new EL,void 0);return}if(!J)B=Buffer.concat(B);let z=X.fn($,B,Y);if(z&&typeof z.then==="function")z.then((N)=>{Y(null,N)},Y)}}function yB($,Z){let Q={protoAction:$,constructorAction:Z};return X;function X(Y,J,W){if(J.length===0){W(new bL,void 0);return}try{W(null,jL(J,Q))}catch{W(new _L,void 0)}}}function xY($,Z,Q){Q(null,Z)}function _Y($,Z,Q,X){this.asString=$,this.asBuffer=Z,this.bodyLimit=Q,this.fn=X}function SL($){let Z=new a1;return Z[M6]=$[M6],Z.customParsers=new Map($.customParsers.entries()),Z.parserList=$.parserList.slice(),Z.parserRegExpList=$.parserRegExpList.slice(),Z}function xL($,Z,Q){if(this[IY].started)throw new SY("addContentTypeParser");if(typeof Z==="function")Q=Z,Z={};if(!Z)Z={};if(!Z.bodyLimit)Z.bodyLimit=this[DL];if(Array.isArray($))$.forEach((X)=>this[O8].add(X,Z,Q));else this[O8].add($,Z,Q);return this}function kL($){return this[O8].hasParser($)}function vL($){if(this[IY].started)throw new SY("removeContentTypeParser");if(Array.isArray($))for(let Z of $)this[O8].remove(Z);else this[O8].remove($)}function yL(){if(this[IY].started)throw new SY("removeAllContentTypeParsers");this[O8].removeAll()}function gL($){if($.source[0]!=="^"&&$.source.includes(";?")===!1)IL($.source)}F6.exports=a1;F6.exports.helpers={buildContentTypeParser:SL,addContentTypeParser:xL,hasContentTypeParser:kL,removeContentTypeParser:vL,removeAllContentTypeParsers:yL};F6.exports.defaultParsers={getDefaultJsonParser:yB,defaultTextParser:xY};F6.exports[TL]={rawBody:vB}});var o1=I((hB)=>{Object.defineProperty(hB,"__esModule",{value:!0});hB.checkMetadata=void 0;var hL=g$(),uL={keyword:"metadata",schemaType:"object",code($){gB($);let{gen:Z,schema:Q,it:X}=$;if((0,hL.alwaysValidSchema)(X,Q))return;let Y=Z.name("valid");$.subschema({keyword:"metadata",jtdMetadata:!0},Y),$.ok(Y)}};function gB({it:$,keyword:Z},Q){if($.jtdMetadata!==Q)throw Error(`JTD: "${Z}" cannot be used in this schema location`)}hB.checkMetadata=gB;hB.default=uL});var HQ=I((dB)=>{Object.defineProperty(dB,"__esModule",{value:!0});dB.hasRef=void 0;var mB=yY(),N6=L1(),cL=VQ(),lB=vY(),cB=lL(),dL=o1(),pL={keyword:"ref",schemaType:"string",code($){(0,dL.checkMetadata)($);let{gen:Z,data:Q,schema:X,parentSchema:Y,it:J}=$,{schemaEnv:{root:W}}=J,G=Z.name("valid");if(Y.nullable)Z.var(G,N6._`${Q} === null`),Z.if((0,N6.not)(G),K);else Z.var(G,!1),K();$.ok(G);function K(){var w;let H=(w=W.schema.definitions)===null||w===void 0?void 0:w[X];if(!H)throw new cL.default(J.opts.uriResolver,"",X,`No definition ${X}`);if(gY(H)||!J.opts.inlineRefs)B(H);else U(H)}function B(w){let H=mB.compileSchema.call(J.self,new mB.SchemaEnv({schema:w,root:W,schemaPath:`/definitions/${X}`})),V=(0,cB.getValidate)($,H),z=Z.const("_errs",lB.default.errors);(0,cB.callRef)($,V,H,H.$async),Z.assign(G,N6._`${z} === ${lB.default.errors}`)}function U(w){let H=Z.scopeValue("schema",J.opts.code.source===!0?{ref:w,code:(0,N6.stringify)(w)}:{ref:w});$.subschema({schema:w,dataTypes:[],schemaPath:N6.nil,topSchemaRef:H,errSchemaPath:`/definitions/${X}`},G)}}};function gY($){for(let Z in $){let Q;if(Z==="ref"||typeof(Q=$[Z])=="object"&&gY(Q))return!0}return!1}dB.hasRef=gY;dB.default=pL});var hY=I((sB)=>{Object.defineProperty(sB,"__esModule",{value:!0});var nL=/t|\s/i,sL=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,aL=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i,oL=[0,31,28,31,30,31,30,31,31,30,31,30,31];function nB($,Z){let Q=$.split(nL);return Q.length===2&&iB(Q[0])&&rL(Q[1])||Z&&Q.length===1&&iB(Q[0])}sB.default=nB;function iB($){let Z=sL.exec($);if(!Z)return!1;let Q=+Z[1],X=+Z[2],Y=+Z[3];return X>=1&&X<=12&&Y>=1&&(Y<=oL[X]||X===2&&Y===29&&(Q%100===0?Q%400===0:Q%4===0))}function rL($){let Z=aL.exec($);if(!Z)return!1;let Q=+Z[1],X=+Z[2],Y=+Z[3],J=+(Z[4]||0),W=+(Z[5]||0);return Q<=23&&X<=59&&Y<=59||Q-J===23&&X-W===59&&Y===60}nB.code='require("ajv/dist/runtime/timestamp").default'});var j8=I((rB)=>{Object.defineProperty(rB,"__esModule",{value:!0});rB.typeErrorParams=rB.typeErrorMessage=rB.typeError=void 0;var eL=L1();function $R($){return{message:(Z)=>aB(Z,$),params:(Z)=>oB(Z,$)}}rB.typeError=$R;function aB({parentSchema:$},Z){return($===null||$===void 0?void 0:$.nullable)?`must be ${Z} or null`:`must be ${Z}`}rB.typeErrorMessage=aB;function oB({parentSchema:$},Z){return eL._`{type: ${Z}, nullable: ${!!($===null||$===void 0?void 0:$.nullable)}}`}rB.typeErrorParams=oB});var mY=I(($U)=>{Object.defineProperty($U,"__esModule",{value:!0});$U.intRange=void 0;var F1=L1(),XR=hY(),YR=g$(),JR=o1(),eB=j8();$U.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 WR={message:($)=>(0,eB.typeErrorMessage)($,$.schema),params:($)=>(0,eB.typeErrorParams)($,$.schema)};function GR($){let{gen:Z,data:Q,it:X}=$,{timestamp:Y,allowDate:J}=X.opts;if(Y==="date")return F1._`${Q} instanceof Date `;let W=(0,YR.useFunc)(Z,XR.default),G=J?F1._`, true`:F1.nil,K=F1._`typeof ${Q} == "string" && ${W}(${Q}${G})`;return Y==="string"?K:(0,F1.or)(F1._`${Q} instanceof Date`,K)}var KR={keyword:"type",schemaType:"string",error:WR,code($){(0,JR.checkMetadata)($);let{data:Z,schema:Q,parentSchema:X,it:Y}=$,J;switch(Q){case"boolean":case"string":J=F1._`typeof ${Z} == ${Q}`;break;case"timestamp":{J=GR($);break}case"float32":case"float64":J=F1._`typeof ${Z} == "number"`;break;default:{let W=Q;if(J=F1._`typeof ${Z} == "number" && isFinite(${Z}) && !(${Z} % 1)`,!Y.opts.int32range&&(W==="int32"||W==="uint32")){if(W==="uint32")J=F1._`${J} && ${Z} >= 0`}else{let[G,K]=$U.intRange[W];J=F1._`${J} && ${Z} >= ${G} && ${Z} <= ${K}`}}}$.pass(X.nullable?(0,F1.or)(F1._`${Z} === null`,J):J)}};$U.default=KR});var D8=I((QU)=>{Object.defineProperty(QU,"__esModule",{value:!0});QU.checkNullableObject=QU.checkNullable=void 0;var MQ=L1();function ZU({gen:$,data:Z,parentSchema:Q},X=MQ.nil){let Y=$.name("valid");if(Q.nullable)$.let(Y,MQ._`${Z} === null`),X=(0,MQ.not)(Y);else $.let(Y,!1);return[Y,X]}QU.checkNullable=ZU;function UR($,Z){let[Q,X]=ZU($,Z);return[Q,MQ._`${X} && typeof ${$.data} == "object" && !Array.isArray(${$.data})`]}QU.checkNullableObject=UR});var JU=I((YU)=>{Object.defineProperty(YU,"__esModule",{value:!0});var F$=L1(),wR=o1(),VR=D8(),HR={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>F$._`{allowedValues: ${$}}`},MR={keyword:"enum",schemaType:"array",error:HR,code($){(0,wR.checkMetadata)($);let{gen:Z,data:Q,schema:X,schemaValue:Y,parentSchema:J,it:W}=$;if(X.length===0)throw Error("enum must have non-empty array");if(X.length!==new Set(X).size)throw Error("enum items must be unique");let G,K=F$._`typeof ${Q} == "string"`;if(X.length>=W.opts.loopEnum){let U;[G,U]=(0,VR.checkNullable)($,K),Z.if(U,B)}else{if(!Array.isArray(X))throw Error("ajv implementation error");if(G=(0,F$.and)(K,(0,F$.or)(...X.map((U)=>F$._`${Q} === ${U}`))),J.nullable)G=(0,F$.or)(F$._`${Q} === null`,G)}$.pass(G);function B(){Z.forOf("v",Y,(U)=>Z.if(F$._`${G} = ${Q} === ${U}`,()=>Z.break()))}}};YU.default=MR});var KU=I((GU)=>{Object.defineProperty(GU,"__esModule",{value:!0});var FR=g$(),NR=O6(),WU=L1(),OR=o1(),jR=D8(),DR=j8(),TR={keyword:"elements",schemaType:"object",error:(0,DR.typeError)("array"),code($){(0,OR.checkMetadata)($);let{gen:Z,data:Q,schema:X,it:Y}=$;if((0,FR.alwaysValidSchema)(Y,X))return;let[J]=(0,jR.checkNullable)($);Z.if((0,WU.not)(J),()=>Z.if(WU._`Array.isArray(${Q})`,()=>Z.assign(J,(0,NR.validateArray)($)),()=>$.error())),$.ok(J)}};GU.default=TR});var cY=I((wU)=>{Object.defineProperty(wU,"__esModule",{value:!0});wU.validateProperties=wU.error=void 0;var lY=O6(),BU=g$(),r1=L1(),fR=o1(),LR=D8(),UU=j8(),T8;(function($){$.Additional="additional",$.Missing="missing"})(T8||(T8={}));wU.error={message:($)=>{let{params:Z}=$;return Z.propError?Z.propError===T8.Additional?"must NOT have additional properties":`must have property '${Z.missingProperty}'`:(0,UU.typeErrorMessage)($,"object")},params:($)=>{let{params:Z}=$;return Z.propError?Z.propError===T8.Additional?r1._`{error: ${Z.propError}, additionalProperty: ${Z.additionalProperty}}`:r1._`{error: ${Z.propError}, missingProperty: ${Z.missingProperty}}`:(0,UU.typeErrorParams)($,"object")}};var RR={keyword:"properties",schemaType:"object",error:wU.error,code:zU};function zU($){(0,fR.checkMetadata)($);let{gen:Z,data:Q,parentSchema:X,it:Y}=$,{additionalProperties:J,nullable:W}=X;if(Y.jtdDiscriminator&&W)throw Error("JTD: nullable inside discriminator mapping");if(V())throw Error("JTD: properties and optionalProperties have common members");let[G,K]=z("properties"),[B,U]=z("optionalProperties");if(K.length===0&&U.length===0&&J)return;let[w,H]=Y.jtdDiscriminator===void 0?(0,LR.checkNullableObject)($,Q):[Z.let("valid",!1),!0];Z.if(H,()=>Z.assign(w,!0).block(()=>{if(N(K,"properties",!0),N(U,"optionalProperties"),!J)O()})),$.pass(w);function V(){let{properties:M,optionalProperties:A}=X;if(!(M&&A))return!1;for(let D in M)if(Object.prototype.hasOwnProperty.call(A,D))return!0;return!1}function z(M){let A=X[M],D=A?(0,lY.allSchemaProperties)(A):[];if(Y.jtdDiscriminator&&D.some((R)=>R===Y.jtdDiscriminator))throw Error(`JTD: discriminator tag used in ${M}`);let f=D.filter((R)=>!(0,BU.alwaysValidSchema)(Y,A[R]));return[D,f]}function N(M,A,D){let f=Z.var("valid");for(let T of M)Z.if((0,lY.propertyInData)(Z,Q,T,Y.opts.ownProperties),()=>F(T,A,f),()=>R(T)),$.ok(f);function R(T){if(D)Z.assign(f,!1),$.error(!1,{propError:T8.Missing,missingProperty:T},{schemaPath:T});else Z.assign(f,!0)}}function F(M,A,D){$.subschema({keyword:A,schemaProp:M,dataProp:M},D)}function O(){Z.forIn("key",Q,(M)=>{let A=j(M,G,"properties",Y.jtdDiscriminator),D=j(M,B,"optionalProperties"),f=A===!0?D:D===!0?A:(0,r1.and)(A,D);Z.if(f,()=>{if(Y.opts.removeAdditional)Z.code(r1._`delete ${Q}[${M}]`);else if($.error(!1,{propError:T8.Additional,additionalProperty:M},{instancePath:M,parentSchema:!0}),!Y.opts.allErrors)Z.break()})})}function j(M,A,D,f){let R;if(A.length>8){let T=(0,BU.schemaRefOrVal)(Y,X[D],D);if(R=(0,r1.not)((0,lY.isOwnProperty)(Z,T,M)),f!==void 0)R=(0,r1.and)(R,r1._`${M} !== ${f}`)}else if(A.length||f!==void 0){let T=f===void 0?A:[f].concat(A);R=(0,r1.and)(...T.map((b)=>r1._`${M} !== ${b}`))}else R=!0;return R}}wU.validateProperties=zU;wU.default=RR});var FU=I((AU)=>{Object.defineProperty(AU,"__esModule",{value:!0});var MU=cY(),CR={keyword:"optionalProperties",schemaType:"object",error:MU.error,code($){if($.parentSchema.properties)return;(0,MU.validateProperties)($)}};AU.default=CR});var jU=I((OU)=>{Object.defineProperty(OU,"__esModule",{value:!0});var h$=L1(),_R=o1(),IR=D8(),NU=j8(),AQ=bR(),SR={message:($)=>{let{schema:Z,params:Q}=$;return Q.discrError?Q.discrError===AQ.DiscrError.Tag?`tag "${Z}" must be string`:`value of tag "${Z}" must be in mapping`:(0,NU.typeErrorMessage)($,"object")},params:($)=>{let{schema:Z,params:Q}=$;return Q.discrError?h$._`{error: ${Q.discrError}, tag: ${Z}, tagValue: ${Q.tag}}`:(0,NU.typeErrorParams)($,"object")}},xR={keyword:"discriminator",schemaType:"string",implements:["mapping"],error:SR,code($){(0,_R.checkMetadata)($);let{gen:Z,data:Q,schema:X,parentSchema:Y}=$,[J,W]=(0,IR.checkNullableObject)($,Q);Z.if(W),G(),Z.elseIf((0,h$.not)(J)),$.error(),Z.endIf(),$.ok(J);function G(){let U=Z.const("tag",h$._`${Q}${(0,h$.getProperty)(X)}`);Z.if(h$._`${U} === undefined`),$.error(!1,{discrError:AQ.DiscrError.Tag,tag:U}),Z.elseIf(h$._`typeof ${U} == "string"`),K(U),Z.else(),$.error(!1,{discrError:AQ.DiscrError.Tag,tag:U},{instancePath:X}),Z.endIf()}function K(U){Z.if(!1);for(let w in Y.mapping)Z.elseIf(h$._`${U} === ${w}`),Z.assign(J,B(w));Z.else(),$.error(!1,{discrError:AQ.DiscrError.Mapping,tag:U},{instancePath:X,schemaPath:"mapping",parentSchema:!0}),Z.endIf()}function B(U){let w=Z.name("valid");return $.subschema({keyword:"mapping",schemaProp:U,jtdDiscriminator:X},w),w}}};OU.default=xR});var qU=I((TU)=>{Object.defineProperty(TU,"__esModule",{value:!0});var DU=g$(),FQ=L1(),vR=o1(),yR=D8(),gR=j8(),hR={keyword:"values",schemaType:"object",error:(0,gR.typeError)("object"),code($){(0,vR.checkMetadata)($);let{gen:Z,data:Q,schema:X,it:Y}=$,[J,W]=(0,yR.checkNullableObject)($,Q);if((0,DU.alwaysValidSchema)(Y,X))Z.if((0,FQ.not)((0,FQ.or)(W,J)),()=>$.error());else Z.if(W),Z.assign(J,G()),Z.elseIf((0,FQ.not)(J)),$.error(),Z.endIf();$.ok(J);function G(){let K=Z.name("valid");if(Y.allErrors){let U=Z.let("valid",!0);return B(()=>Z.assign(U,!1)),U}return Z.var(K,!0),B(()=>Z.break()),K;function B(U){Z.forIn("key",Q,(w)=>{$.subschema({keyword:"values",dataProp:w,dataPropType:DU.Type.Str},K),Z.if((0,FQ.not)(K),U)})}}}};TU.default=hR});var LU=I((fU)=>{Object.defineProperty(fU,"__esModule",{value:!0});var mR=O6(),lR={keyword:"union",schemaType:"array",trackErrors:!0,code:mR.validateUnion,error:{message:"must match a schema in union"}};fU.default=lR});var PU=I((RU)=>{Object.defineProperty(RU,"__esModule",{value:!0});var dR=HQ(),pR=mY(),iR=JU(),nR=KU(),sR=cY(),aR=FU(),oR=jU(),rR=qU(),tR=LU(),eR=o1(),$P=["definitions",dR.default,pR.default,iR.default,nR.default,sR.default,aR.default,oR.default,rR.default,tR.default,eR.default,{keyword:"additionalProperties",schemaType:"boolean"},{keyword:"nullable",schemaType:"boolean"}];RU.default=$P});var IU=I((_U)=>{Object.defineProperty(_U,"__esModule",{value:!0});var t1=($)=>{let Z={nullable:{type:"boolean"},metadata:{optionalProperties:{union:{elements:{ref:"schema"}}},additionalProperties:!0}};if($)Z.definitions={values:{ref:"schema"}};return Z},QP=($)=>({optionalProperties:t1($)}),XP=($)=>({properties:{ref:{type:"string"}},optionalProperties:t1($)}),YP=($)=>({properties:{type:{enum:["boolean","timestamp","string","float32","float64","int8","uint8","int16","uint16","int32","uint32"]}},optionalProperties:t1($)}),JP=($)=>({properties:{enum:{elements:{type:"string"}}},optionalProperties:t1($)}),WP=($)=>({properties:{elements:{ref:"schema"}},optionalProperties:t1($)}),EU=($)=>({properties:{properties:{values:{ref:"schema"}}},optionalProperties:{optionalProperties:{values:{ref:"schema"}},additionalProperties:{type:"boolean"},...t1($)}}),bU=($)=>({properties:{optionalProperties:{values:{ref:"schema"}}},optionalProperties:{additionalProperties:{type:"boolean"},...t1($)}}),GP=($)=>({properties:{discriminator:{type:"string"},mapping:{values:{metadata:{union:[EU(!1),bU(!1)]}}}},optionalProperties:t1($)}),KP=($)=>({properties:{values:{ref:"schema"}},optionalProperties:t1($)}),CU=($)=>({metadata:{union:[QP,XP,YP,JP,WP,EU,bU,GP,KP].map((Z)=>Z($))}}),BP={definitions:{schema:CU(!1)},...CU(!0)};_U.default=BP});var dY=I((SU)=>{Object.defineProperty(SU,"__esModule",{value:!0});SU.jtdForms=void 0;SU.jtdForms=["elements","values","discriminator","properties","optionalProperties","enum","type","ref"]});var yU=I((vU)=>{Object.defineProperty(vU,"__esModule",{value:!0});var pY=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,zP={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"};function kU($){return pY.lastIndex=0,'"'+(pY.test($)?$.replace(pY,(Z)=>{let Q=zP[Z];return typeof Q==="string"?Q:"\\u"+("0000"+Z.charCodeAt(0).toString(16)).slice(-4)}):$)+'"'}vU.default=kU;kU.code='require("ajv/dist/runtime/quote").default'});var dU=I((cU)=>{Object.defineProperty(cU,"__esModule",{value:!0});var VP=dY(),hU=yY(),K0=L1(),HP=VQ(),D0=vY(),MP=O6(),AP=HQ(),FP=g$(),NP=yU(),OP={elements:DP,values:TP,discriminator:qP,properties:gU,optionalProperties:gU,enum:j6,type:fP,ref:RP};function uU($,Z){let Q=hU.getCompilingSchema.call(this,$);if(Q)return Q;let{es5:X,lines:Y}=this.opts.code,{ownProperties:J}=this.opts,W=new K0.CodeGen(this.scope,{es5:X,lines:Y,ownProperties:J}),G=W.scopeName("serialize"),K={self:this,gen:W,schema:$.schema,schemaEnv:$,definitions:Z,data:D0.default.data},B;try{this._compilations.add($),$.serializeName=G,W.func(G,D0.default.data,!1,()=>{W.let(D0.default.json,K0.str``),D6(K),W.return(D0.default.json)}),W.optimize(this.opts.code.optimize);let U=W.toString();B=`${W.scopeRefs(D0.default.scope)}return ${U}`;let H=Function(`${D0.default.scope}`,B)(this.scope.get());this.scope.value(G,{ref:H}),$.serialize=H}catch(U){if(B)this.logger.error("Error compiling serializer, function code:",B);throw delete $.serialize,delete $.serializeName,U}finally{this._compilations.delete($)}return $}cU.default=uU;function D6($){let Z;for(let Q of VP.jtdForms)if(Q in $.schema){Z=Q;break}jP($,Z?OP[Z]:CP)}function jP($,Z){let{gen:Q,schema:X,data:Y}=$;if(!X.nullable)return Z($);Q.if(K0._`${Y} === undefined || ${Y} === null`,()=>Q.add(D0.default.json,K0._`"null"`),()=>Z($))}function DP($){let{gen:Z,schema:Q,data:X}=$;Z.add(D0.default.json,K0.str`[`);let Y=Z.let("first",!0);Z.forOf("el",X,(J)=>{iY($,Y),D6({...$,schema:Q.elements,data:J})}),Z.add(D0.default.json,K0.str`]`)}function TP($){let{gen:Z,schema:Q,data:X}=$;Z.add(D0.default.json,K0.str`{`);let Y=Z.let("first",!0);Z.forIn("key",X,(J)=>mU($,J,Q.values,Y)),Z.add(D0.default.json,K0.str`}`)}function mU($,Z,Q,X){let{gen:Y,data:J}=$;iY($,X),j6({...$,data:Z}),Y.add(D0.default.json,K0.str`:`);let W=Y.const("value",K0._`${J}${(0,K0.getProperty)(Z)}`);D6({...$,schema:Q,data:W})}function qP($){let{gen:Z,schema:Q,data:X}=$,{discriminator:Y}=Q;Z.add(D0.default.json,K0.str`{${JSON.stringify(Y)}:`);let J=Z.const("tag",K0._`${X}${(0,K0.getProperty)(Y)}`);j6({...$,data:J}),Z.if(!1);for(let W in Q.mapping){Z.elseIf(K0._`${J} === ${W}`);let G=Q.mapping[W];lU({...$,schema:G},Y)}Z.endIf(),Z.add(D0.default.json,K0.str`}`)}function gU($){let{gen:Z}=$;Z.add(D0.default.json,K0.str`{`),lU($),Z.add(D0.default.json,K0.str`}`)}function lU($,Z){let{gen:Q,schema:X,data:Y}=$,{properties:J,optionalProperties:W}=X,G=H(J),K=H(W),B=V(G.concat(K)),U=!Z,w;for(let O of G){if(U)U=!1;else Q.add(D0.default.json,K0.str`,`);N(O,J[O],z(O))}if(U)w=Q.let("first",!0);for(let O of K){let j=z(O);Q.if((0,K0.and)(K0._`${j} !== undefined`,(0,MP.isOwnProperty)(Q,Y,O)),()=>{iY($,w),N(O,W[O],j)})}if(X.additionalProperties)Q.forIn("key",Y,(O)=>Q.if(F(O,B),()=>mU($,O,{},w)));function H(O){return O?Object.keys(O):[]}function V(O){if(Z)O.push(Z);if(new Set(O).size!==O.length)throw Error("JTD: properties/optionalProperties/disciminator overlap");return O}function z(O){return Q.const("value",K0._`${Y}${(0,K0.getProperty)(O)}`)}function N(O,j,M){Q.add(D0.default.json,K0.str`${JSON.stringify(O)}:`),D6({...$,schema:j,data:M})}function F(O,j){return j.length?(0,K0.and)(...j.map((M)=>K0._`${O} !== ${M}`)):!0}}function fP($){let{gen:Z,schema:Q,data:X}=$;switch(Q.type){case"boolean":Z.add(D0.default.json,K0._`${X} ? "true" : "false"`);break;case"string":j6($);break;case"timestamp":Z.if(K0._`${X} instanceof Date`,()=>Z.add(D0.default.json,K0._`'"' + ${X}.toISOString() + '"'`),()=>j6($));break;default:LP($)}}function j6({gen:$,data:Z}){$.add(D0.default.json,K0._`${(0,FP.useFunc)($,NP.default)}(${Z})`)}function LP({gen:$,data:Z,self:Q}){let X=K0._`${Z} === Infinity || ${Z} === -Infinity || ${Z} !== ${Z}`;if(Q.opts.specialNumbers===void 0||Q.opts.specialNumbers==="fast")$.add(D0.default.json,K0._`"" + ${Z}`);else $.if(X,()=>$.add(D0.default.json,K0._`null`),()=>$.add(D0.default.json,K0._`"" + ${Z}`))}function RP($){let{gen:Z,self:Q,data:X,definitions:Y,schema:J,schemaEnv:W}=$,{ref:G}=J,K=Y[G];if(!K)throw new HP.default(Q.opts.uriResolver,"",G,`No definition ${G}`);if(!(0,AP.hasRef)(K))return D6({...$,schema:K});let{root:B}=W,U=uU.call(Q,new hU.SchemaEnv({schema:K,root:B}),Y);Z.add(D0.default.json,K0._`${PP(Z,U)}(${X})`)}function PP($,Z){return Z.serialize?$.scopeValue("serialize",{ref:Z.serialize}):K0._`${$.scopeValue("wrapper",{ref:Z})}.serialize`}function CP({gen:$,data:Z}){$.add(D0.default.json,K0._`JSON.stringify(${Z})`)}function iY({gen:$},Z){if(Z)$.if(Z,()=>$.assign(Z,!1),()=>$.add(D0.default.json,K0.str`,`));else $.add(D0.default.json,K0.str`,`)}});var sU=I((iU)=>{Object.defineProperty(iU,"__esModule",{value:!0});iU.parseJsonString=iU.parseJsonNumber=iU.parseJson=void 0;var bP=/position\s(\d+)(?: \(line \d+ column \d+\))?$/;function e1($,Z){let Q;e1.message=void 0;let X;if(Z)$=$.slice(Z);try{return e1.position=Z+$.length,JSON.parse($)}catch(Y){if(X=bP.exec(Y.message),!X){e1.message="unexpected end";return}Q=+X[1];let J=$[Q];$=$.slice(0,Q),e1.position=Z+Q;try{return JSON.parse($)}catch(W){e1.message=`unexpected token ${J}`;return}}}iU.parseJson=e1;e1.message=void 0;e1.position=0;e1.code='require("ajv/dist/runtime/parseJson").parseJson';function $$($,Z,Q){let X="",Y;if($$.message=void 0,$[Z]==="-")X+="-",Z++;if($[Z]==="0")X+="0",Z++;else if(!J(Q)){W();return}if(Q)return $$.position=Z,+X;if($[Z]==="."){if(X+=".",Z++,!J()){W();return}}if(Y=$[Z],Y==="e"||Y==="E"){if(X+="e",Z++,Y=$[Z],Y==="+"||Y==="-")X+=Y,Z++;if(!J()){W();return}}return $$.position=Z,+X;function J(G){let K=!1;while(Y=$[Z],Y>="0"&&Y<="9"&&(G===void 0||G-- >0))K=!0,X+=Y,Z++;return K}function W(){$$.position=Z,$$.message=Z<$.length?`unexpected token ${$[Z]}`:"unexpected end"}}iU.parseJsonNumber=$$;$$.message=void 0;$$.position=0;$$.code='require("ajv/dist/runtime/parseJson").parseJsonNumber';var pU={b:"\b",f:"\f",n:`
32
+ `,r:"\r",t:"\t",'"':'"',"/":"/","\\":"\\"},_P=97,IP=48;function N$($,Z){let Q="",X;N$.message=void 0;while(!0){if(X=$[Z++],X==='"')break;if(X==="\\")if(X=$[Z],X in pU)Q+=pU[X],Z++;else if(X==="u"){Z++;let J=4,W=0;while(J--){if(W<<=4,X=$[Z],X===void 0){Y("unexpected end");return}if(X=X.toLowerCase(),X>="a"&&X<="f")W+=X.charCodeAt(0)-_P+10;else if(X>="0"&&X<="9")W+=X.charCodeAt(0)-IP;else{Y(`unexpected token ${X}`);return}Z++}Q+=String.fromCharCode(W)}else{Y(`unexpected token ${X}`);return}else if(X===void 0){Y("unexpected end");return}else if(X.charCodeAt(0)>=32)Q+=X;else{Y(`unexpected token ${X}`);return}}return N$.position=Z,Q;function Y(J){N$.position=Z,N$.message=J}}iU.parseJsonString=N$;N$.message=void 0;N$.position=0;N$.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var Wz=I((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});var kP=dY(),tU=yY(),$0=L1(),vP=VQ(),V0=vY(),yP=O6(),gP=HQ(),hP=mY(),aY=sU(),eU=g$(),uP=hY(),mP={elements:pP,values:iP,discriminator:sP,properties:aU,optionalProperties:aU,enum:oP,type:aP,ref:rP};function $z($,Z){let Q=tU.getCompilingSchema.call(this,$);if(Q)return Q;let{es5:X,lines:Y}=this.opts.code,{ownProperties:J}=this.opts,W=new $0.CodeGen(this.scope,{es5:X,lines:Y,ownProperties:J}),G=W.scopeName("parse"),K={self:this,gen:W,schema:$.schema,schemaEnv:$,definitions:Z,data:V0.default.data,parseName:G,char:W.name("c")},B;try{this._compilations.add($),$.parseName=G,lP(K),W.optimize(this.opts.code.optimize);let U=W.toString();B=`${W.scopeRefs(V0.default.scope)}return ${U}`;let H=Function(`${V0.default.scope}`,B)(this.scope.get());this.scope.value(G,{ref:H}),$.parse=H}catch(U){if(B)this.logger.error("Error compiling parser, function code:",B);throw delete $.parse,delete $.parseName,U}finally{this._compilations.delete($)}return $}Jz.default=$z;var sY=$0._`undefined`;function lP($){let{gen:Z,parseName:Q,char:X}=$;Z.func(Q,$0._`${V0.default.json}, ${V0.default.jsonPos}, ${V0.default.jsonPart}`,!1,()=>{Z.let(V0.default.data),Z.let(X),Z.assign($0._`${Q}.message`,sY),Z.assign($0._`${Q}.position`,sY),Z.assign(V0.default.jsonPos,$0._`${V0.default.jsonPos} || 0`),Z.const(V0.default.jsonLen,$0._`${V0.default.json}.length`),NQ($),eY($),Z.if(V0.default.jsonPart,()=>{Z.assign($0._`${Q}.position`,V0.default.jsonPos),Z.return(V0.default.data)}),Z.if($0._`${V0.default.jsonPos} === ${V0.default.jsonLen}`,()=>Z.return(V0.default.data)),q8($)})}function NQ($){let Z;for(let Q of kP.jtdForms)if(Q in $.schema){Z=Q;break}if(Z)dP($,mP[Z]);else rY($)}var cP=rU(!0,rU(!1,q8));function dP($,Z){let{gen:Q,schema:X,data:Y}=$;if(!X.nullable)return Z($);T6($,"null",Z,()=>Q.assign(Y,null))}function pP($){let{gen:Z,schema:Q,data:X}=$;c1($,"[");let Y=Z.let("i",0);Z.assign(X,$0._`[]`),oY($,"]",()=>{let J=Z.let("el");NQ({...$,schema:Q.elements,data:J}),Z.assign($0._`${X}[${Y}++]`,J)})}function iP($){let{gen:Z,schema:Q,data:X}=$;c1($,"{"),Z.assign(X,$0._`{}`),oY($,"}",()=>nP($,Q.values))}function oY($,Z,Q){Zz($,Z,Q),c1($,Z)}function Zz($,Z,Q){let{gen:X}=$;X.for($0._`;${V0.default.jsonPos}<${V0.default.jsonLen} && ${OQ(1)}!==${Z};`,()=>{Q(),T6($,",",()=>X.break(),Y)});function Y(){T6($,Z,()=>{},q8)}}function nP($,Z){let{gen:Q}=$,X=Q.let("key");u$({...$,data:X}),c1($,":"),Xz($,X,Z)}function sP($){let{gen:Z,data:Q,schema:X}=$,{discriminator:Y,mapping:J}=X;c1($,"{"),Z.assign(Q,$0._`{}`);let W=Z.const("pos",V0.default.jsonPos),G=Z.let("value"),K=Z.let("tag");Zz($,"}",()=>{let B=Z.let("key");u$({...$,data:B}),c1($,":"),Z.if($0._`${B} === ${Y}`,()=>{u$({...$,data:K}),Z.assign($0._`${Q}[${B}]`,K),Z.break()},()=>rY({...$,data:G}))}),Z.assign(V0.default.jsonPos,W),Z.if($0._`${K} === undefined`),Z$($,$0.str`discriminator tag not found`);for(let B in J)Z.elseIf($0._`${K} === ${B}`),Qz({...$,schema:J[B]},Y);Z.else(),Z$($,$0.str`discriminator value not in schema`),Z.endIf()}function aU($){let{gen:Z,data:Q}=$;c1($,"{"),Z.assign(Q,$0._`{}`),Qz($)}function Qz($,Z){let{gen:Q,schema:X,data:Y}=$,{properties:J,optionalProperties:W,additionalProperties:G}=X;if(oY($,"}",()=>{let K=Q.let("key");if(u$({...$,data:K}),c1($,":"),Q.if(!1),oU($,K,J),oU($,K,W),Z){Q.elseIf($0._`${K} === ${Z}`);let B=Q.let("tag");u$({...$,data:B})}if(Q.else(),G)rY({...$,data:$0._`${Y}[${K}]`});else Z$($,$0.str`property ${K} not allowed`);Q.endIf()}),J){let K=(0,yP.hasPropFunc)(Q),B=(0,$0.and)(...Object.keys(J).map((U)=>$0._`${K}.call(${Y}, ${U})`));Q.if((0,$0.not)(B),()=>Z$($,$0.str`missing required properties`))}}function oU($,Z,Q={}){let{gen:X}=$;for(let Y in Q)X.elseIf($0._`${Z} === ${Y}`),Xz($,Z,Q[Y])}function Xz($,Z,Q){NQ({...$,schema:Q,data:$0._`${$.data}[${Z}]`})}function aP($){let{gen:Z,schema:Q,data:X,self:Y}=$;switch(Q.type){case"boolean":cP($);break;case"string":u$($);break;case"timestamp":{u$($);let J=(0,eU.useFunc)(Z,uP.default),{allowDate:W,parseDate:G}=Y.opts,K=W?$0._`!${J}(${X}, true)`:$0._`!${J}(${X})`,B=G?(0,$0.or)(K,$0._`(${X} = new Date(${X}), false)`,$0._`isNaN(${X}.valueOf())`):K;Z.if(B,()=>Z$($,$0.str`invalid timestamp`));break}case"float32":case"float64":nY($);break;default:{let J=Q.type;if(!Y.opts.int32range&&(J==="int32"||J==="uint32")){if(nY($,16),J==="uint32")Z.if($0._`${X} < 0`,()=>Z$($,$0.str`integer out of range`))}else{let[W,G,K]=hP.intRange[J];nY($,K),Z.if($0._`${X} < ${W} || ${X} > ${G}`,()=>Z$($,$0.str`integer out of range`))}}}}function u$($){c1($,'"'),tY($,aY.parseJsonString)}function oP($){let{gen:Z,data:Q,schema:X}=$,Y=X.enum;c1($,'"'),Z.if(!1);for(let J of Y){let W=JSON.stringify(J).slice(1);Z.elseIf($0._`${OQ(W.length)} === ${W}`),Z.assign(Q,$0.str`${J}`),Z.add(V0.default.jsonPos,W.length)}Z.else(),q8($),Z.endIf()}function nY($,Z){let{gen:Q}=$;eY($),Q.if($0._`"-0123456789".indexOf(${OQ(1)}) < 0`,()=>q8($),()=>tY($,aY.parseJsonNumber,Z))}function rU($,Z){return(Q)=>{let{gen:X,data:Y}=Q;T6(Q,`${$}`,()=>Z(Q),()=>X.assign(Y,$))}}function rP($){let{gen:Z,self:Q,definitions:X,schema:Y,schemaEnv:J}=$,{ref:W}=Y,G=X[W];if(!G)throw new vP.default(Q.opts.uriResolver,"",W,`No definition ${W}`);if(!(0,gP.hasRef)(G))return NQ({...$,schema:G});let{root:K}=J,B=$z.call(Q,new tU.SchemaEnv({schema:G,root:K}),X);Yz($,tP(Z,B),!0)}function tP($,Z){return Z.parse?$.scopeValue("parse",{ref:Z.parse}):$0._`${$.scopeValue("wrapper",{ref:Z})}.parse`}function rY($){tY($,aY.parseJson)}function tY($,Z,Q){Yz($,(0,eU.useFunc)($.gen,Z),Q)}function Yz($,Z,Q){let{gen:X,data:Y}=$;X.assign(Y,$0._`${Z}(${V0.default.json}, ${V0.default.jsonPos}${Q?$0._`, ${Q}`:$0.nil})`),X.assign(V0.default.jsonPos,$0._`${Z}.position`),X.if($0._`${Y} === undefined`,()=>Z$($,$0._`${Z}.message`))}function c1($,Z){T6($,Z,q8)}function T6($,Z,Q,X){let{gen:Y}=$,J=Z.length;eY($),Y.if($0._`${OQ(J)} === ${Z}`,()=>{Y.add(V0.default.jsonPos,J),X===null||X===void 0||X($)},()=>Q($))}function eY({gen:$,char:Z}){$.code($0._`while((${Z}=${V0.default.json}[${V0.default.jsonPos}],${Z}===" "||${Z}==="\\n"||${Z}==="\\r"||${Z}==="\\t"))${V0.default.jsonPos}++;`)}function OQ($){return $===1?$0._`${V0.default.json}[${V0.default.jsonPos}]`:$0._`${V0.default.json}.slice(${V0.default.jsonPos}, ${V0.default.jsonPos}+${$})`}function q8($){Z$($,$0._`"unexpected token " + ${V0.default.json}[${V0.default.jsonPos}]`)}function Z$({gen:$,parseName:Z},Q){$.assign($0._`${Z}.message`,Q),$.assign($0._`${Z}.position`,V0.default.jsonPos),$.return(sY)}});var QJ=I((z1,ZJ)=>{Object.defineProperty(z1,"__esModule",{value:!0});z1.MissingRefError=z1.ValidationError=z1.CodeGen=z1.Name=z1.nil=z1.stringify=z1.str=z1._=z1.KeywordCxt=z1.Ajv=void 0;var XC=QC(),YC=PU(),JC=IU(),WC=dU(),GC=Wz(),$J="JTD-meta-schema";class q6 extends XC.default{constructor($={}){super({...$,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(YC.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;this.addMetaSchema(JC.default,$J,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($J)?$J:void 0)}compileSerializer($){let Z=this._addSchema($);return Z.serialize||this._compileSerializer(Z)}compileParser($){let Z=this._addSchema($);return Z.parse||this._compileParser(Z)}_compileSerializer($){if(WC.default.call(this,$,$.schema.definitions||{}),!$.serialize)throw Error("ajv implementation error");return $.serialize}_compileParser($){if(GC.default.call(this,$,$.schema.definitions||{}),!$.parse)throw Error("ajv implementation error");return $.parse}}z1.Ajv=q6;ZJ.exports=z1=q6;ZJ.exports.Ajv=q6;Object.defineProperty(z1,"__esModule",{value:!0});z1.default=q6;var KC=$C();Object.defineProperty(z1,"KeywordCxt",{enumerable:!0,get:function(){return KC.KeywordCxt}});var f8=L1();Object.defineProperty(z1,"_",{enumerable:!0,get:function(){return f8._}});Object.defineProperty(z1,"str",{enumerable:!0,get:function(){return f8.str}});Object.defineProperty(z1,"stringify",{enumerable:!0,get:function(){return f8.stringify}});Object.defineProperty(z1,"nil",{enumerable:!0,get:function(){return f8.nil}});Object.defineProperty(z1,"Name",{enumerable:!0,get:function(){return f8.Name}});Object.defineProperty(z1,"CodeGen",{enumerable:!0,get:function(){return f8.CodeGen}});var BC=ZC();Object.defineProperty(z1,"ValidationError",{enumerable:!0,get:function(){return BC.default}});var UC=VQ();Object.defineProperty(z1,"MissingRefError",{enumerable:!0,get:function(){return UC.default}})});var XJ=I((Eh,Kz)=>{var VC=Gz();Kz.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:VC,addUsedSchema:!1,allErrors:!1})});var Hz=I((bh,Vz)=>{var HC=Uz().default,MC=QJ(),Bz=XJ();class wz{constructor($,Z){if(Z.mode==="JTD")this.ajv=new MC(Object.assign({},Bz,Z.customOptions));else this.ajv=new HC(Object.assign({},Bz,Z.customOptions));let Q=!0;if(Z.plugins&&Z.plugins.length>0)for(let Y of Z.plugins)if(Array.isArray(Y))Q=Q&&Y[0].name!=="formatsPlugin",Y[0](this.ajv,Y[1]);else Q=Q&&Y.name!=="formatsPlugin",Y(this.ajv);if(Q)zz()(this.ajv);Z.onCreate?.(this.ajv);let X=Object.values($);for(let Y of X)this.ajv.addSchema(Y)}buildValidatorFunction({schema:$}){if($.$id){let Z=this.ajv.getSchema($.$id);if(Z)return Z}return this.ajv.compile($)}}Vz.exports=wz});var Fz=I((_h,Az)=>{var AC=QJ(),FC=XJ();class Mz{constructor($,Z){this.ajv=new AC(Object.assign({},FC,Z))}buildSerializerFunction({schema:$}){return this.ajv.compileSerializer($)}}Az.exports=Mz});var jz=I((L6,Oz)=>{Object.defineProperty(L6,"__esModule",{value:!0});var f6=OC(),k1=NC();function Nz($,Z){if(!$.opts.code.source)throw Error("moduleCode: ajv instance must have code.source option");let{_n:Q}=$.scope.opts;return typeof Z=="function"?Y(Z.source):Z!==void 0?J(Z,X):J($.schemas,(G)=>G.meta?void 0:$.compile(G.schema));function X(G){let K=$.getSchema(G);if(!K)throw Error(`moduleCode: no schema with id ${G}`);return K}function Y(G){let K={},B=G===null||G===void 0?void 0:G.validateName,U=W(K,G);if($.opts.code.esm)return`"use strict";${Q}export const validate = ${B};${Q}export default ${B};${Q}${U}`;return`"use strict";${Q}module.exports = ${B};${Q}module.exports.default = ${B};${Q}${U}`}function J(G,K){var B;let U={},w=k1._`"use strict";`;for(let H in G){let V=K(G[H]);if(V){let z=W(U,V.source),N=$.opts.code.esm?k1._`export const ${(0,k1.getEsmExportName)(H)}`:k1._`exports${(0,k1.getProperty)(H)}`;w=k1._`${w}${Q}${N} = ${(B=V.source)===null||B===void 0?void 0:B.validateName};${Q}${z}`}}return`${w}`}function W(G,K){if(!K)throw Error('moduleCode: function does not have "source" property');if(H(K.validateName)===f6.UsedValueState.Completed)return k1.nil;V(K.validateName,f6.UsedValueState.Started);let B=$.scope.scopeCode(K.scopeValues,G,w),U=new k1._Code(`${B}${Q}${K.validateCode}`);return K.evaluated?k1._`${U}${K.validateName}.evaluated = ${K.evaluated};${Q}`:U;function w(z){var N;let F=(N=z.value)===null||N===void 0?void 0:N.ref;if(z.prefix==="validate"&&typeof F=="function")return W(G,F.source);else if((z.prefix==="root"||z.prefix==="wrapper")&&typeof F=="object"){let{validate:O,validateName:j}=F;if(!j)throw Error("ajv internal error");let M=$.opts.code.es5?f6.varKinds.var:f6.varKinds.const,A=k1._`${M} ${z} = {validate: ${j}};`;if(H(j)===f6.UsedValueState.Started)return A;let D=W(G,O===null||O===void 0?void 0:O.source);return k1._`${A}${Q}${D}`}return}function H(z){var N;return(N=G[z.prefix])===null||N===void 0?void 0:N.get(z)}function V(z,N){let{prefix:F}=z;(G[F]=G[F]||new Map).set(z,N)}}}Oz.exports=L6=Nz;Object.defineProperty(L6,"__esModule",{value:!0});L6.default=Nz});var qz=I((Ih,Tz)=>{var Dz=YJ(),jC=jz().default;function DC($={readMode:!0}){if($.readMode===!0&&!$.restoreFunction)throw Error("You must provide a restoreFunction options when readMode ON");if($.readMode!==!0&&!$.storeFunction)throw Error("You must provide a storeFunction options when readMode OFF");if($.readMode===!0)return function(){return function(X){return $.restoreFunction(X)}};let Z=Dz();return function(X,Y={}){if(!Y.customOptions||!Y.customOptions.code)Y.customOptions=Object.assign({},Y.customOptions,{code:{source:!0}});let J=Z(X,Y);return function(W){let G=J(W),K=jC(J[Dz.AjvReference].ajv,G);return $.storeFunction(W,K),G}}}Tz.exports=DC});var YJ=I((Sh,L8)=>{var Lz=Symbol.for("fastify.ajv-compiler.reference"),TC=Hz(),qC=Fz();function JJ($){let Z=new Map,Q=new Map;if($&&$.jtdSerializer===!0)return function(Y,J){let W=fz({},J);if(Q.has(W))return Q.get(W);let G=new qC(Y,J),K=G.buildSerializerFunction.bind(G);return Q.set(W,K),K};return function(Y,J){let W=fz(Y,J.customOptions);if(Z.has(W))return Z.get(W);let G=new TC(Y,J),K=G.buildValidatorFunction.bind(G);if(Z.set(W,K),J.customOptions.code!==void 0)K[Lz]=G;return K}}function fz($,Z){let Q=JSON.stringify($),X=JSON.stringify(Z);return`${Q}${X}`}L8.exports=JJ;L8.exports.default=JJ;L8.exports.AjvCompiler=JJ;L8.exports.AjvReference=Lz;L8.exports.StandaloneValidator=qz()});var jQ=I((fC)=>{var Rz=Object.prototype.hasOwnProperty;function Pz($,Z,Q){for(Q of $.keys())if(R6(Q,Z))return Q}function R6($,Z){var Q,X,Y;if($===Z)return!0;if($&&Z&&(Q=$.constructor)===Z.constructor){if(Q===Date)return $.getTime()===Z.getTime();if(Q===RegExp)return $.toString()===Z.toString();if(Q===Array){if((X=$.length)===Z.length)while(X--&&R6($[X],Z[X]));return X===-1}if(Q===Set){if($.size!==Z.size)return!1;for(X of $){if(Y=X,Y&&typeof Y==="object"){if(Y=Pz(Z,Y),!Y)return!1}if(!Z.has(Y))return!1}return!0}if(Q===Map){if($.size!==Z.size)return!1;for(X of $){if(Y=X[0],Y&&typeof Y==="object"){if(Y=Pz(Z,Y),!Y)return!1}if(!R6(X[1],Z.get(Y)))return!1}return!0}if(Q===ArrayBuffer)$=new Uint8Array($),Z=new Uint8Array(Z);else if(Q===DataView){if((X=$.byteLength)===Z.byteLength)while(X--&&$.getInt8(X)===Z.getInt8(X));return X===-1}if(ArrayBuffer.isView($)){if((X=$.byteLength)===Z.byteLength)while(X--&&$[X]===Z[X]);return X===-1}if(!Q||typeof $==="object"){X=0;for(Q in $){if(Rz.call($,Q)&&++X&&!Rz.call(Z,Q))return!1;if(!(Q in Z)||!R6($[Q],Z[Q]))return!1}return Object.keys(Z).length===X}}return $!==$&&Z!==Z}fC.dequal=R6});var Iz=I((kh,_z)=>{var{dequal:Cz}=jQ(),RC=Symbol.for("json-schema-ref");class bz{#$;#Z;#Q;#X;#Y;constructor($={}){this.#$={},this.#Z={},this.#Q=$.insertRefSymbol??!1,this.#X=$.allowEqualDuplicates??!0,this.#Y=$.cloneSchemaWithoutRefs??!1}addSchema($,Z,Q=!0){if(Q)if($.$id!==void 0&&$.$id.charAt(0)!=="#")Z=$.$id;else this.#K($,Z);let X=$.$id;if(X!==void 0&&typeof X==="string")if(X.charAt(0)==="#")this.#U($,Z,X);else this.#K($,X),Z=X;let Y=$.$ref;if(Y!==void 0&&typeof Y==="string"){let{refSchemaId:J,refJsonPointer:W}=this.#J(Y,Z);this.#$[Z].refs.push({schemaId:J,jsonPointer:W})}for(let J in $)if(typeof $[J]==="object"&&$[J]!==null)this.addSchema($[J],Z,!1)}getSchema($,Z="#"){let Q=this.#$[$];if(Q===void 0)throw Error(`Cannot resolve ref "${$}${Z}". Schema with id "${$}" is not found.`);if(Q.anchors[Z]!==void 0)return Q.anchors[Z];return Ez(Q.schema,Z)}hasSchema($){return this.#$[$]!==void 0}getSchemaRefs($){let Z=this.#$[$];if(Z===void 0)throw Error(`Schema with id "${$}" is not found.`);return Z.refs}getSchemaDependencies($,Z={}){let Q=this.#$[$];for(let X of Q.refs){let Y=X.schemaId;if(Y===$||Z[Y]!==void 0)continue;Z[Y]=this.getSchema(Y),this.getSchemaDependencies(Y,Z)}return Z}derefSchema($){if(this.#Z[$]!==void 0)return;let Z=this.#$[$];if(Z===void 0)throw Error(`Schema with id "${$}" is not found.`);if(!this.#Y&&Z.refs.length===0)this.#Z[$]={schema:Z.schema,anchors:Z.anchors};let Q=[];this.#W(Z.schema,$,!0,Q);let X=this.getSchemaDependencies($);for(let Y in X){let J=X[Y];this.#W(J,Y,!0,Q)}for(let Y of Q){let{refSchemaId:J,refJsonPointer:W}=this.#J(Y.ref,Y.sourceSchemaId),G=this.getDerefSchema(J,W);if(G===null)throw Error(`Cannot resolve ref "${Y.ref}". Ref "${W}" is not found in schema "${J}".`);Y.targetSchema=G,Y.targetSchemaId=J}for(let Y of Q)this.#G(Y,Q)}getDerefSchema($,Z="#"){let Q=this.#Z[$];if(Q===void 0)this.derefSchema($),Q=this.#Z[$];if(Q.anchors[Z]!==void 0)return Q.anchors[Z];return Ez(Q.schema,Z)}#J($,Z){let Q=$.indexOf("#");if(Q===-1)return{refSchemaId:$,refJsonPointer:"#"};if(Q===0)return{refSchemaId:Z,refJsonPointer:$};return{refSchemaId:$.slice(0,Q),refJsonPointer:$.slice(Q)}}#W($,Z,Q,X=[]){let Y=Array.isArray($)?[...$]:{...$};if(Q)if($.$id!==void 0&&$.$id.charAt(0)!=="#")Z=$.$id;else this.#B(Y,Z);let J=Y.$id;if(J!==void 0&&typeof J==="string")if(J.charAt(0)==="#")this.#z(Y,Z,J);else this.#B(Y,J),Z=J;if(Y.$ref!==void 0)X.push({ref:Y.$ref,sourceSchemaId:Z,sourceSchema:Y});for(let W in Y){let G=Y[W];if(typeof G==="object"&&G!==null)Y[W]=this.#W(G,Z,!1,X)}return Y}#G($,Z){let{sourceSchema:Q,targetSchema:X}=$;if(!Q.$ref)return;if(this.#Q)Q[RC]=Q.$ref;if(delete Q.$ref,X.$ref){let Y=Z.find((J)=>J.sourceSchema===X);this.#G(Y,Z)}for(let Y in X){if(Y==="$id")continue;if(Q[Y]!==void 0){if(Cz(Q[Y],X[Y]))continue;throw Error(`Cannot resolve ref "${$.ref}". Property "${Y}" already exists in schema "${$.sourceSchemaId}".`)}Q[Y]=X[Y]}$.isResolved=!0}#K($,Z){let Q=this.#$[Z];if(Q!==void 0){if(this.#X&&Cz($,Q.schema))return;throw Error(`There is already another schema with id "${Z}".`)}this.#$[Z]={schema:$,anchors:{},refs:[]}}#U($,Z,Q){let{anchors:X}=this.#$[Z];if(X[Q]!==void 0)throw Error(`There is already another anchor "${Q}" in schema "${Z}".`);X[Q]=$}#B($,Z){if(this.#Z[Z]!==void 0)return;this.#Z[Z]={schema:$,anchors:{}}}#z($,Z,Q){let{anchors:X}=this.#Z[Z];X[Q]=$}}function Ez($,Z){let Q=Z.split("/"),X=$;for(let Y of Q){if(Y===""||Y==="#")continue;if(typeof X!=="object"||X===null)return null;X=X[Y]}return X??null}_z.exports={RefResolver:bz}});var GJ=I((vh,Sz)=>{var PC=Uz(),CC=Gz(),EC=zz(),bC=dZ()({proto:!0});class WJ{constructor($){this.ajv=new PC({...$,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:CC}),EC(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(Z,Q)=>{return Q&&typeof Q.toJSON==="function"}}),this._ajvSchemas={},this._ajvOptions=$||{}}addSchema($,Z){let Q=$.$id||Z;if($.$id!==void 0&&$.$id[0]==="#")Q=Z+$.$id;if(this.ajv.refs[Q]===void 0&&this.ajv.schemas[Q]===void 0){let X=bC($);this.convertSchemaToAjvFormat(X),this.ajv.addSchema(X,Q),this._ajvSchemas[Q]=$}}validate($,Z){return this.ajv.validate($,Z)}convertSchemaToAjvFormat($){if($===null)return;if($.type==="string")$.fjs_type="string",$.type=["string","object"];else if(Array.isArray($.type)&&$.type.includes("string")&&!$.type.includes("object"))$.fjs_type="string",$.type.push("object");for(let Z in $)if(typeof $[Z]==="object")this.convertSchemaToAjvFormat($[Z])}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState($){let Z=new WJ($.ajvOptions);for(let[Q,X]of Object.entries($.ajvSchemas))Z.ajv.addSchema(X,Q);return Z}}Sz.exports=WJ});var kz=I((yh,xz)=>{class KJ{constructor($,Z,Q="#"){this.schema=$,this.schemaId=Z,this.jsonPointer=Q}getPropertyLocation($){return new KJ(this.schema[$],this.schemaId,this.jsonPointer+"/"+$)}getSchemaRef(){return this.schemaId+this.jsonPointer}}xz.exports=KJ});var mz=I((gh,UJ)=>{UJ.exports=d;UJ.exports.default=d;var IC={$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},vz={enum:["array","boolean","integer","null","number","object","string"]},yz=/^(?:[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,SC=uz().fullFormats.uri,gz=uz().fullFormats.regex;function R1($,{instancePath:Z="",parentData:Q,parentDataProperty:X,rootData:Y=$}={}){let J=null,W=0,G=W;if(!(typeof $=="number"&&(!($%1)&&!isNaN($))&&isFinite($)))return R1.errors=[{instancePath:Z,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(W===G){if(typeof $=="number"&&isFinite($)){if($<0||isNaN($))return R1.errors=[{instancePath:Z,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}return R1.errors=J,W===0}var BJ={validate:d};function X1($,{instancePath:Z="",parentData:Q,parentDataProperty:X,rootData:Y=$}={}){let J=null,W=0;if(W===0)if(Array.isArray($))if($.length<1)return X1.errors=[{instancePath:Z,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;else{var G=!0;let K=$.length;for(let B=0;B<K;B++){let U=W;if(!BJ.validate($[B],{instancePath:Z+"/"+B,parentData:$,parentDataProperty:B,rootData:Y}))J=J===null?BJ.validate.errors:J.concat(BJ.validate.errors),W=J.length;var G=U===W;if(!G)break}}else return X1.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return X1.errors=J,W===0}var hz=_C().default;function d($,{instancePath:Z="",parentData:Q,parentDataProperty:X,rootData:Y=$}={}){let J=null,W=0;if(!($&&typeof $=="object"&&!Array.isArray($))&&typeof $!=="boolean")return d.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:IC.type},message:"must be object,boolean"}],!1;if(W===0){if($&&typeof $=="object"&&!Array.isArray($)){if($.$id!==void 0){let M=$.$id,A=W;if(W===A){if(W===A)if(typeof M==="string"){if(!yz.test(M))return d.errors=[{instancePath:Z+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return d.errors=[{instancePath:Z+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var G=A===W}else var G=!0;if(G){if($.$schema!==void 0){let M=$.$schema,A=W;if(W===A){if(W===A)if(typeof M==="string"){if(!SC(M))return d.errors=[{instancePath:Z+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return d.errors=[{instancePath:Z+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var G=A===W}else var G=!0;if(G){if($.$ref!==void 0){let M=$.$ref,A=W;if(W===A){if(W===A)if(typeof M==="string"){if(!yz.test(M))return d.errors=[{instancePath:Z+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return d.errors=[{instancePath:Z+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var G=A===W}else var G=!0;if(G){if($.$comment!==void 0){let M=W;if(typeof $.$comment!=="string")return d.errors=[{instancePath:Z+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.title!==void 0){let M=W;if(typeof $.title!=="string")return d.errors=[{instancePath:Z+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.description!==void 0){let M=W;if(typeof $.description!=="string")return d.errors=[{instancePath:Z+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.readOnly!==void 0){let M=W;if(typeof $.readOnly!=="boolean")return d.errors=[{instancePath:Z+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var G=M===W}else var G=!0;if(G){if($.examples!==void 0){let M=W;if(W===M){if(!Array.isArray($.examples))return d.errors=[{instancePath:Z+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1}var G=M===W}else var G=!0;if(G){if($.multipleOf!==void 0){let M=$.multipleOf,A=W;if(W===A)if(typeof M=="number"&&isFinite(M)){if(M<=0||isNaN(M))return d.errors=[{instancePath:Z+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return d.errors=[{instancePath:Z+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var G=A===W}else var G=!0;if(G){if($.maximum!==void 0){let M=$.maximum,A=W;if(!(typeof M=="number"&&isFinite(M)))return d.errors=[{instancePath:Z+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var G=A===W}else var G=!0;if(G){if($.exclusiveMaximum!==void 0){let M=$.exclusiveMaximum,A=W;if(!(typeof M=="number"&&isFinite(M)))return d.errors=[{instancePath:Z+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var G=A===W}else var G=!0;if(G){if($.minimum!==void 0){let M=$.minimum,A=W;if(!(typeof M=="number"&&isFinite(M)))return d.errors=[{instancePath:Z+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var G=A===W}else var G=!0;if(G){if($.exclusiveMinimum!==void 0){let M=$.exclusiveMinimum,A=W;if(!(typeof M=="number"&&isFinite(M)))return d.errors=[{instancePath:Z+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var G=A===W}else var G=!0;if(G){if($.maxLength!==void 0){let M=$.maxLength,A=W,D=W;if(!(typeof M=="number"&&(!(M%1)&&!isNaN(M))&&isFinite(M)))return d.errors=[{instancePath:Z+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(W===D){if(typeof M=="number"&&isFinite(M)){if(M<0||isNaN(M))return d.errors=[{instancePath:Z+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var G=A===W}else var G=!0;if(G){if($.minLength!==void 0){let M=W;if(!R1($.minLength,{instancePath:Z+"/minLength",parentData:$,parentDataProperty:"minLength",rootData:Y}))J=J===null?R1.errors:J.concat(R1.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.pattern!==void 0){let M=$.pattern,A=W;if(W===A){if(W===A)if(typeof M==="string"){if(!gz(M))return d.errors=[{instancePath:Z+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return d.errors=[{instancePath:Z+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var G=A===W}else var G=!0;if(G){if($.additionalItems!==void 0){let M=W;if(!d($.additionalItems,{instancePath:Z+"/additionalItems",parentData:$,parentDataProperty:"additionalItems",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.items!==void 0){let M=$.items,A=W,D=W,f=!1,R=W;if(!d(M,{instancePath:Z+"/items",parentData:$,parentDataProperty:"items",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var K=R===W;if(f=f||K,!f){let b=W;if(!X1(M,{instancePath:Z+"/items",parentData:$,parentDataProperty:"items",rootData:Y}))J=J===null?X1.errors:J.concat(X1.errors),W=J.length;var K=b===W;f=f||K}if(!f){let b={instancePath:Z+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(J===null)J=[b];else J.push(b);return W++,d.errors=J,!1}else if(W=D,J!==null)if(D)J.length=D;else J=null;var G=A===W}else var G=!0;if(G){if($.maxItems!==void 0){let M=$.maxItems,A=W,D=W;if(!(typeof M=="number"&&(!(M%1)&&!isNaN(M))&&isFinite(M)))return d.errors=[{instancePath:Z+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(W===D){if(typeof M=="number"&&isFinite(M)){if(M<0||isNaN(M))return d.errors=[{instancePath:Z+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var G=A===W}else var G=!0;if(G){if($.minItems!==void 0){let M=W;if(!R1($.minItems,{instancePath:Z+"/minItems",parentData:$,parentDataProperty:"minItems",rootData:Y}))J=J===null?R1.errors:J.concat(R1.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.uniqueItems!==void 0){let M=W;if(typeof $.uniqueItems!=="boolean")return d.errors=[{instancePath:Z+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var G=M===W}else var G=!0;if(G){if($.contains!==void 0){let M=W;if(!d($.contains,{instancePath:Z+"/contains",parentData:$,parentDataProperty:"contains",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.maxProperties!==void 0){let M=$.maxProperties,A=W,D=W;if(!(typeof M=="number"&&(!(M%1)&&!isNaN(M))&&isFinite(M)))return d.errors=[{instancePath:Z+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(W===D){if(typeof M=="number"&&isFinite(M)){if(M<0||isNaN(M))return d.errors=[{instancePath:Z+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var G=A===W}else var G=!0;if(G){if($.minProperties!==void 0){let M=W;if(!R1($.minProperties,{instancePath:Z+"/minProperties",parentData:$,parentDataProperty:"minProperties",rootData:Y}))J=J===null?R1.errors:J.concat(R1.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.required!==void 0){let M=$.required,A=W;if(W===W)if(Array.isArray(M)){var B=!0;let R=M.length;for(let T=0;T<R;T++){let b=W;if(typeof M[T]!=="string")return d.errors=[{instancePath:Z+"/required/"+T,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var B=b===W;if(!B)break}if(B){let T=M.length,b;if(T>1){let q={};for(;T--;){let S=M[T];if(typeof S!=="string")continue;if(typeof q[S]=="number"){return b=q[S],d.errors=[{instancePath:Z+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:T,j:b},message:"must NOT have duplicate items (items ## "+b+" and "+T+" are identical)"}],!1;break}q[S]=T}}}}else return d.errors=[{instancePath:Z+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var G=A===W}else var G=!0;if(G){if($.additionalProperties!==void 0){let M=W;if(!d($.additionalProperties,{instancePath:Z+"/additionalProperties",parentData:$,parentDataProperty:"additionalProperties",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.definitions!==void 0){let M=$.definitions,A=W;if(W===A)if(M&&typeof M=="object"&&!Array.isArray(M))for(let f in M){let R=W;if(!d(M[f],{instancePath:Z+"/definitions/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:M,parentDataProperty:f,rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var U=R===W;if(!U)break}else return d.errors=[{instancePath:Z+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=A===W}else var G=!0;if(G){if($.properties!==void 0){let M=$.properties,A=W;if(W===A)if(M&&typeof M=="object"&&!Array.isArray(M))for(let f in M){let R=W;if(!d(M[f],{instancePath:Z+"/properties/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:M,parentDataProperty:f,rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var w=R===W;if(!w)break}else return d.errors=[{instancePath:Z+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=A===W}else var G=!0;if(G){if($.patternProperties!==void 0){let M=$.patternProperties,A=W;if(W===A)if(M&&typeof M=="object"&&!Array.isArray(M)){for(let f in M){let R=W;if(W===R){if(typeof f==="string"){if(!gz(f)){let T={instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:f};if(J===null)J=[T];else J.push(T);W++}}}var H=R===W;if(!H){let T={instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:f},message:"property name must be valid"};if(J===null)J=[T];else J.push(T);return W++,d.errors=J,!1;break}}if(H)for(let f in M){let R=W;if(!d(M[f],{instancePath:Z+"/patternProperties/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:M,parentDataProperty:f,rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var V=R===W;if(!V)break}}else return d.errors=[{instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=A===W}else var G=!0;if(G){if($.dependencies!==void 0){let M=$.dependencies,A=W;if(W===A)if(M&&typeof M=="object"&&!Array.isArray(M))for(let f in M){let R=M[f],T=W,b=W,q=!1,S=W;if(!d(R,{instancePath:Z+"/dependencies/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:M,parentDataProperty:f,rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var z=S===W;if(q=q||z,!q){let y=W;if(W===W)if(Array.isArray(R)){var N=!0;let s=R.length;for(let a=0;a<s;a++){let p=W;if(typeof R[a]!=="string"){let X0={instancePath:Z+"/dependencies/"+f.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+a,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[X0];else J.push(X0);W++}var N=p===W;if(!N)break}if(N){let a=R.length,p;if(a>1){let r={};for(;a--;){let X0=R[a];if(typeof X0!=="string")continue;if(typeof r[X0]=="number"){p=r[X0];let Y0={instancePath:Z+"/dependencies/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:a,j:p},message:"must NOT have duplicate items (items ## "+p+" and "+a+" are identical)"};if(J===null)J=[Y0];else J.push(Y0);W++;break}r[X0]=a}}}}else{let s={instancePath:Z+"/dependencies/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};if(J===null)J=[s];else J.push(s);W++}var z=y===W;q=q||z}if(!q){let y={instancePath:Z+"/dependencies/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(J===null)J=[y];else J.push(y);return W++,d.errors=J,!1}else if(W=b,J!==null)if(b)J.length=b;else J=null;var F=T===W;if(!F)break}else return d.errors=[{instancePath:Z+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=A===W}else var G=!0;if(G){if($.propertyNames!==void 0){let M=W;if(!d($.propertyNames,{instancePath:Z+"/propertyNames",parentData:$,parentDataProperty:"propertyNames",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.enum!==void 0){let M=$.enum,A=W;if(W===A)if(Array.isArray(M))if(M.length<1)return d.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;else{let f=M.length,R;if(f>1){$:for(;f--;)for(R=f;R--;)if(hz(M[f],M[R])){return d.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:f,j:R},message:"must NOT have duplicate items (items ## "+R+" and "+f+" are identical)"}],!1;break $}}}else return d.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var G=A===W}else var G=!0;if(G){if($.type!==void 0){let M=$.type,A=W,D=W,f=!1,R=W;if(!(M==="array"||M==="boolean"||M==="integer"||M==="null"||M==="number"||M==="object"||M==="string")){let b={instancePath:Z+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:vz.enum},message:"must be equal to one of the allowed values"};if(J===null)J=[b];else J.push(b);W++}var O=R===W;if(f=f||O,!f){let b=W;if(W===b)if(Array.isArray(M))if(M.length<1){let S={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};if(J===null)J=[S];else J.push(S);W++}else{var j=!0;let S=M.length;for(let y=0;y<S;y++){let v=M[y],n=W;if(!(v==="array"||v==="boolean"||v==="integer"||v==="null"||v==="number"||v==="object"||v==="string")){let a={instancePath:Z+"/type/"+y,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:vz.enum},message:"must be equal to one of the allowed values"};if(J===null)J=[a];else J.push(a);W++}var j=n===W;if(!j)break}if(j){let y=M.length,v;if(y>1){$:for(;y--;)for(v=y;v--;)if(hz(M[y],M[v])){let n={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:y,j:v},message:"must NOT have duplicate items (items ## "+v+" and "+y+" are identical)"};if(J===null)J=[n];else J.push(n);W++;break $}}}}else{let S={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};if(J===null)J=[S];else J.push(S);W++}var O=b===W;f=f||O}if(!f){let b={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(J===null)J=[b];else J.push(b);return W++,d.errors=J,!1}else if(W=D,J!==null)if(D)J.length=D;else J=null;var G=A===W}else var G=!0;if(G){if($.format!==void 0){let M=W;if(typeof $.format!=="string")return d.errors=[{instancePath:Z+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.contentMediaType!==void 0){let M=W;if(typeof $.contentMediaType!=="string")return d.errors=[{instancePath:Z+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.contentEncoding!==void 0){let M=W;if(typeof $.contentEncoding!=="string")return d.errors=[{instancePath:Z+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=M===W}else var G=!0;if(G){if($.if!==void 0){let M=W;if(!d($.if,{instancePath:Z+"/if",parentData:$,parentDataProperty:"if",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.then!==void 0){let M=W;if(!d($.then,{instancePath:Z+"/then",parentData:$,parentDataProperty:"then",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.else!==void 0){let M=W;if(!d($.else,{instancePath:Z+"/else",parentData:$,parentDataProperty:"else",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.allOf!==void 0){let M=W;if(!X1($.allOf,{instancePath:Z+"/allOf",parentData:$,parentDataProperty:"allOf",rootData:Y}))J=J===null?X1.errors:J.concat(X1.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.anyOf!==void 0){let M=W;if(!X1($.anyOf,{instancePath:Z+"/anyOf",parentData:$,parentDataProperty:"anyOf",rootData:Y}))J=J===null?X1.errors:J.concat(X1.errors),W=J.length;var G=M===W}else var G=!0;if(G){if($.oneOf!==void 0){let M=W;if(!X1($.oneOf,{instancePath:Z+"/oneOf",parentData:$,parentDataProperty:"oneOf",rootData:Y}))J=J===null?X1.errors:J.concat(X1.errors),W=J.length;var G=M===W}else var G=!0;if(G)if($.not!==void 0){let M=W;if(!d($.not,{instancePath:Z+"/not",parentData:$,parentDataProperty:"not",rootData:Y}))J=J===null?d.errors:J.concat(d.errors),W=J.length;var G=M===W}else var G=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return d.errors=J,W===0}});var zJ=I((hh,pz)=>{class lz extends Error{constructor($,Z){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${$}" keyword schemas.`,this.schemas=Z}}class cz extends Error{constructor($,Z){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${$}" keyword not found.`,this.schemas=Z}}class dz extends Error{constructor($){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${$}".`}}pz.exports={MergeError:lz,ResolverNotFoundError:cz,InvalidOnConflictOptionError:dz}});var sz=I((uh,nz)=>{var{dequal:xC}=jQ(),{MergeError:wJ}=zJ();function iz($){let Z=$[0];for(let Q=1;Q<$.length;Q++)Z=Z.filter((X)=>$[Q].includes(X));return Z}function kC($,Z,Q){let X=iz(Z);if(X.length===0)throw new wJ($,Z);Q[$]=X}function vC($,Z,Q){for(let Y=0;Y<Z.length;Y++)if(!Array.isArray(Z[Y]))Z[Y]=[Z[Y]];let X=iz(Z);if(X.length===0)throw new wJ($,Z);if(X.length===1)Q[$]=X[0];else Q[$]=X}function yC($,Z,Q){let X=[];for(let Y of Z)for(let J of Y)if(!X.includes(J))X.push(J);Q[$]=X}function gC($,Z,Q){Q[$]=Math.min(...Z)}function hC($,Z,Q){Q[$]=Math.max(...Z)}function uC($,Z,Q){let X=(G,K)=>!K?G:X(K,G%K),Y=(G,K)=>G*K/X(G,K),J=1;for(let G of Z)while(G*J%1!==0)J*=10;let W=Z[0]*J;for(let G of Z)W=Y(W,G*J);Q[$]=W/J}function mC($,Z,Q){let X=Z[0];for(let Y=1;Y<Z.length;Y++)if(!xC(Z[Y],X))throw new wJ($,Z);Q[$]=X}function lC(){}function cC($,Z,Q){for(let X of Z)if(X===!1){Q[$]=!1;return}Q[$]=!0}function dC($,Z,Q){for(let X of Z)if(X===!0){Q[$]=!0;return}Q[$]=!1}nz.exports={arraysIntersection:kC,hybridArraysIntersection:vC,arraysUnion:yC,minNumber:gC,maxNumber:hC,commonMultiple:uC,allEqual:mC,booleanAnd:cC,booleanOr:dC,skip:lC}});var $w=I((mh,ez)=>{var{dequal:pC}=jQ(),_0=sz(),qQ=zJ(),rz={$id:_0.skip,type:_0.hybridArraysIntersection,enum:_0.arraysIntersection,minLength:_0.maxNumber,maxLength:_0.minNumber,minimum:_0.maxNumber,maximum:_0.minNumber,multipleOf:_0.commonMultiple,exclusiveMinimum:_0.maxNumber,exclusiveMaximum:_0.minNumber,minItems:_0.maxNumber,maxItems:_0.minNumber,maxProperties:_0.minNumber,minProperties:_0.maxNumber,const:_0.allEqual,default:_0.allEqual,format:_0.allEqual,required:_0.arraysUnion,properties:rC,patternProperties:TQ,additionalProperties:DQ,items:sC,additionalItems:aC,definitions:TQ,$defs:TQ,nullable:_0.booleanAnd,oneOf:az,anyOf:az,allOf:_0.arraysUnion,not:DQ,if:tC,then:_0.skip,else:_0.skip,dependencies:oz,dependentRequired:oz,dependentSchemas:TQ,propertyNames:DQ,uniqueItems:_0.booleanOr,contains:DQ};function DQ($,Z,Q,X,Y){Q[$]=v1(Z,Y)}function iC($){let Z=[[]];for(let Q of $){let X=[];for(let Y of Z)for(let J of Q)X.push([...Y,J]);Z=X}return Z}function az($,Z,Q,X,Y){if(Z.length===1){Q[$]=Z[0];return}let J=iC(Z),W=[];for(let G of J)try{let K=v1(G,Y);if(K!==void 0)W.push(K)}catch(K){if(K instanceof qQ.MergeError)continue;throw K}Q[$]=W}function nC($,Z){let{items:Q,additionalItems:X}=$;if(Array.isArray(Q)){if(Z<Q.length)return Q[Z];return X}if(Q!==void 0)return Q;return X}function sC($,Z,Q,X,Y){let J=0;for(let G of Z)if(Array.isArray(G))J=Math.max(J,G.length);if(J===0){Q[$]=v1(Z,Y);return}let W=[];for(let G=0;G<J;G++){let K=[];for(let B of X){let U=nC(B,G);if(U!==void 0)K.push(U)}W[G]=v1(K,Y)}Q[$]=W}function aC($,Z,Q,X,Y){let J=!1;for(let G of X)if(Array.isArray(G.items)){J=!0;break}if(!J){Q[$]=v1(Z,Y);return}let W=[];for(let G of X){let K=G.additionalItems;if(K===void 0&&!Array.isArray(G.items))K=G.items;if(K!==void 0)W.push(K)}Q[$]=v1(W,Y)}function oC($,Z){let{properties:Q,patternProperties:X,additionalProperties:Y}=$;if(Q?.[Z]!==void 0)return Q[Z];for(let J of Object.keys(X??{}))if(new RegExp(J).test(Z))return X[J];return Y}function rC($,Z,Q,X,Y){let J={};for(let G of X){let K=G.properties??{};for(let B of Object.keys(K)){if(J[B]!==void 0)continue;let U=K[B];J[B]=[U];for(let w of X){if(G===w)continue;let H=oC(w,B);if(H!==void 0)J[B].push(H)}}}let W={};for(let G of Object.keys(J)){let K=J[G];W[G]=v1(K,Y)}Q[$]=W}function TQ($,Z,Q,X,Y){let J={};for(let G of Z)for(let K of Object.keys(G)){if(J[K]===void 0)J[K]=[];J[K].push(G[K])}let W={};for(let G of Object.keys(J)){let K=J[G],B=v1(K,Y);W[G]=B}Q[$]=W}function tC($,Z,Q,X,Y){for(let J=0;J<X.length;J++){let W={if:X[J].if,then:X[J].then,else:X[J].else};if(W.if===void 0)continue;if(Q.if===void 0){if(Q.if=W.if,W.then!==void 0)Q.then=W.then;if(W.else!==void 0)Q.else=W.else;continue}if(Q.then!==void 0)Q.then=v1([Q.then,W],Y);if(Q.else!==void 0)Q.else=v1([Q.else,W],Y)}}function oz($,Z,Q){let X={};for(let Y of Z)for(let J of Object.keys(Y)){if(X[J]===void 0)X[J]=[];let W=X[J];for(let G of Y[J])if(!W.includes(G))W.push(G)}Q[$]=X}function v1($,Z){if($.length===0)return{};if($.length===1)return $[0];let Q={},X={},Y=!0;for(let J of $){if(J===!1)return!1;if(J===!0)continue;Y=!1;for(let W of Object.keys(J)){if(X[W]===void 0)X[W]=[];X[W].push(J[W])}}if(Y)return!0;for(let J of Object.keys(X)){let W=X[J];(Z.resolvers[J]??Z.defaultResolver)(J,W,Q,$,Z)}return Q}function tz($,Z,Q,X,Y){let J=Y.onConflict??"throw";if(Z.length===1||J==="first"){Q[$]=Z[0];return}let W=!0;for(let G=1;G<Z.length;G++)if(!pC(Z[G],Z[0])){W=!1;break}if(W){Q[$]=Z[0];return}if(J==="throw")throw new qQ.ResolverNotFoundError($,Z);if(J==="skip")return;throw new qQ.InvalidOnConflictOptionError(J)}function eC($,Z={}){if(Z.defaultResolver===void 0)Z.defaultResolver=tz;return Z.resolvers={...rz,...Z.resolvers},v1($,Z)}ez.exports={mergeSchemas:eC,keywordsResolvers:rz,defaultResolver:tz,...qQ}});var Qw=I((lh,Zw)=>{var{mergeSchemas:$E}=$w();function ZE($){return $E($,{onConflict:"skip"})}Zw.exports=ZE});var Xw=I((ch,VJ)=>{function QE($,Z,Q,X){let Y="";if(Z.validatorSchemasIds.size>0)Y+=`const Validator = require('fast-json-stringify/lib/validator')
33
+ `,Y+=`const validatorState = ${JSON.stringify(X.getState())}
34
+ `,Y+=`const validator = Validator.restoreFromState(validatorState)
35
+ `;else Y+=`const validator = null
36
+ `;let{schema:J,...W}=Q.getState();return`
37
+ 'use strict'
38
+
39
+ const Serializer = require('fast-json-stringify/lib/serializer')
40
+ const serializerState = ${JSON.stringify(W)}
41
+ const serializer = Serializer.restoreFromState(serializerState)
42
+
43
+ ${Y}
44
+
45
+ module.exports = ${$.toString()}(validator, serializer)`}VJ.exports=QE;VJ.exports.dependencies={Serializer:iZ(),Validator:GJ()}});var ww=I((dh,R8)=>{var{RefResolver:XE}=Iz(),YE=iZ(),JE=GJ(),m$=kz(),Yw=mz(),WE=Qw(),GE=/'/g,P6=20000,fQ="default",KE=`
46
+ const {
47
+ asString,
48
+ asNumber,
49
+ asBoolean,
50
+ asDateTime,
51
+ asDate,
52
+ asTime,
53
+ asUnsafeString
54
+ } = serializer
55
+
56
+ const asInteger = serializer.asInteger.bind(serializer)
57
+
58
+ `,BE=new Set(["floor","ceil","round","trunc"]),Kw=new Set(["default","json-stringify"]),C6=0;function HJ($,Z){if(!Yw($)){if(Z)Z=`"${Z}" `;else Z="";let Q=Yw.errors[0],X=Error(`${Z}schema is invalid: data${Q.instancePath} ${Q.message}`);throw X.errors=HJ.errors,X}}function Q$($,Z){let Q=Z.schema.$ref,X=Q.indexOf("#");if(X===-1)X=Q.length;let Y=Q.slice(0,X)||Z.schemaId,J=Q.slice(X)||"#",W=$.refResolver.getSchema(Y,J);if(W===null)throw Error(`Cannot find reference "${Q}"`);let G=new m$(W,Y,J);if(W.$ref!==void 0)return Q$($,G);return G}function LQ($,Z){let Q=$.refResolver.getSchema(Z,"#");return new m$(Q,Z,"#")}function Jw($,Z){if($.$id&&$.$id.charAt(0)!=="#")return $.$id;return Z}function E6($,Z){let Q=Z.getSchemaRef()||"";if(Q.startsWith($.rootSchemaId))Q=Q.replace($.rootSchemaId,"")||"#";return Q}function AJ($,Z){HJ($),Z=Z||{};let Q={functions:[],functionsCounter:0,functionsNamesBySchema:new Map,options:Z,refResolver:new XE,rootSchemaId:$.$id||`__fjs_root_${C6++}`,validatorSchemasIds:new Set,mergedSchemasIds:new Map,recursiveSchemas:new Set,recursivePaths:new Set,buildingSet:new Set,uid:0},X=Jw($,Q.rootSchemaId);if(!Q.refResolver.hasSchema(X))Q.refResolver.addSchema($,Q.rootSchemaId);if(Z.schema)for(let U in Z.schema){let w=Z.schema[U],H=Jw(w,U);if(!Q.refResolver.hasSchema(H))HJ(w,U),Q.refResolver.addSchema(w,U)}if(Z.rounding){if(!BE.has(Z.rounding))throw Error(`Unsupported integer rounding method ${Z.rounding}`)}if(Z.largeArrayMechanism)if(Kw.has(Z.largeArrayMechanism))fQ=Z.largeArrayMechanism;else throw Error(`Unsupported large array mechanism ${Z.largeArrayMechanism}`);if(Z.largeArraySize){let U=typeof Z.largeArraySize,w;if(U==="string"&&Number.isFinite(w=Number.parseInt(Z.largeArraySize,10)))P6=w;else if(U==="number"&&Number.isInteger(Z.largeArraySize))P6=Z.largeArraySize;else if(U==="bigint")P6=Number(Z.largeArraySize);else throw Error(`Unsupported large array size. Expected integer-like, got ${typeof Z.largeArraySize} with value ${Z.largeArraySize}`)}let Y=new m$($,Q.rootSchemaId);OE(Q,Y);let J=e0(Q,Y,"input"),W=`
59
+ ${KE}
60
+ const JSON_STR_BEGIN_OBJECT = '{'
61
+ const JSON_STR_END_OBJECT = '}'
62
+ const JSON_STR_BEGIN_ARRAY = '['
63
+ const JSON_STR_END_ARRAY = ']'
64
+ const JSON_STR_COMMA = ','
65
+ const JSON_STR_COLONS = ':'
66
+ const JSON_STR_QUOTE = '"'
67
+ const JSON_STR_EMPTY_OBJECT = JSON_STR_BEGIN_OBJECT + JSON_STR_END_OBJECT
68
+ const JSON_STR_EMPTY_ARRAY = JSON_STR_BEGIN_ARRAY + JSON_STR_END_ARRAY
69
+ const JSON_STR_EMPTY_STRING = JSON_STR_QUOTE + JSON_STR_QUOTE
70
+ const JSON_STR_NULL = 'null'
71
+ `;if(J==="json += anonymous0(input)")W+=`
72
+ ${Q.functions.join(`
73
+ `)}
74
+ const main = anonymous0
75
+ return main
76
+ `;else W+=`
77
+ function main (input) {
78
+ let json = ''
79
+ ${J}
80
+ return json
81
+ }
82
+ ${Q.functions.join(`
83
+ `)}
84
+ return main
85
+ `;let G=new YE(Z),K=new JE(Z.ajv);for(let U of Q.validatorSchemasIds){let w=Q.refResolver.getSchema(U);K.addSchema(w,U);let H=Q.refResolver.getSchemaDependencies(U);for(let[V,z]of Object.entries(H))K.addSchema(z,V)}if(Z.debugMode)Z.mode="debug";if(Z.mode==="debug")return{validator:K,serializer:G,code:`validator
86
+ serializer
87
+ ${W}`,ajv:K.ajv};let B=Function("validator","serializer",W);if(Z.mode==="standalone")return Xw()(B,Q,G,K);return B(K,G)}var UE=["properties","required","additionalProperties","patternProperties","maxProperties","minProperties","dependencies"],zE=["items","additionalItems","maxItems","minItems","uniqueItems","contains"],wE=["maxLength","minLength","pattern"],VE=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"];function HE($){for(let Z of UE)if(Z in $)return"object";for(let Z of zE)if(Z in $)return"array";for(let Z of wE)if(Z in $)return"string";for(let Z of VE)if(Z in $)return"number";return $.type}function ME($,Z,Q,X){let Y=Z.schema,J=Object.keys(Y.properties||{}),W=`
88
+ for (const key of Object.keys(${X})) {
89
+ if (
90
+ ${J.length>0?J.map((w)=>`key === ${JSON.stringify(w)}`).join(" || ")+" ||":""}
91
+ ${X}[key] === undefined ||
92
+ typeof ${X}[key] === 'function' ||
93
+ typeof ${X}[key] === 'symbol'
94
+ ) continue
95
+ const value = ${X}[key]
96
+ `,G=Z.getPropertyLocation("patternProperties"),K=G.schema;if(K!==void 0)for(let w in K){let H=G.getPropertyLocation(w);W+=`
97
+ if (/${w.replace(/\\*\//g,"\\/")}/.test(key)) {
98
+ ${Q}
99
+ json += asString(key) + JSON_STR_COLONS
100
+ ${e0($,H,"value")}
101
+ continue
102
+ }
103
+ `}let U=Z.getPropertyLocation("additionalProperties").schema;if(U!==void 0)if(U===!0)W+=`
104
+ ${Q}
105
+ json += asString(key) + JSON_STR_COLONS + JSON.stringify(value)
106
+ `;else{let w=Z.getPropertyLocation("additionalProperties");W+=`
107
+ ${Q}
108
+ json += asString(key) + JSON_STR_COLONS
109
+ ${e0($,w,"value")}
110
+ `}return W+=`
111
+ }
112
+ `,W}function Ww($,Z,Q){let X=Z.schema,Y=Z.getPropertyLocation("properties"),J=X.required||[],W=Object.keys(X.properties||{}).sort((U,w)=>{let H=J.includes(U),V=J.includes(w);return H===V?0:H?-1:1}),G="";for(let U of J)if(!W.includes(U)){let w=JSON.stringify(U);G+=`if (${Q}[${w}] === undefined) throw new Error('${w.replace(/'/g,"\\'")} is required!')
113
+ `}G+=`json += JSON_STR_BEGIN_OBJECT
114
+ `;let K=$.uid++,B="";if(J.length>0){for(let U=0;U<W.length;U++){let w=W[U],H=Y.getPropertyLocation(w),V=H;if(H.schema.$ref)V=Q$($,H);let z=JSON.stringify(w),N=`value_${w.replace(/[^a-zA-Z0-9]/g,"_")}_${$.uid++}`,F=V.schema.default,O=J.includes(w),j=U===0?"":"json += JSON_STR_COMMA";if(G+=`
115
+ const ${N} = ${Q}[${z}]
116
+ if (${N} !== undefined) {
117
+ ${j}
118
+ json += ${JSON.stringify(z+":")}
119
+ ${e0($,V,`${N}`)}
120
+ }`,F!==void 0)G+=` else {
121
+ ${j}
122
+ json += ${JSON.stringify(z+":"+JSON.stringify(F))}
123
+ }
124
+ `;else if(O)G+=` else {
125
+ throw new Error('${z.replace(/'/g,"\\'")} is required!')
126
+ }
127
+ `;else G+=`
128
+ `}B="json += JSON_STR_COMMA"}else{if(W.length>1||X.patternProperties||X.additionalProperties!==void 0&&X.additionalProperties!==!1)G+=`let addComma_${K} = false
129
+ `,B=`!addComma_${K} && (addComma_${K} = true) || (json += JSON_STR_COMMA)`;for(let w of W){let H=Y.getPropertyLocation(w);if(H.schema.$ref)H=Q$($,H);let V=JSON.stringify(w),z=`value_${w.replace(/[^a-zA-Z0-9]/g,"_")}_${$.uid++}`,N=H.schema.default,F=J.includes(w);if(G+=`
130
+ const ${z} = ${Q}[${V}]
131
+ if (${z} !== undefined) {
132
+ ${B}
133
+ json += ${JSON.stringify(V+":")}
134
+ ${e0($,H,`${z}`)}
135
+ }`,N!==void 0)G+=` else {
136
+ ${B}
137
+ json += ${JSON.stringify(V+":"+JSON.stringify(N))}
138
+ }
139
+ `;else if(F)G+=` else {
140
+ throw new Error('${V.replace(/'/g,"\\'")} is required!')
141
+ }
142
+ `;else G+=`
143
+ `}}if(X.patternProperties||X.additionalProperties)G+=ME($,Z,B,Q);return G+=`
144
+ json += JSON_STR_END_OBJECT
145
+ `,G}function RQ($,Z,Q){for(let W=0,G=Q.length;W<G;W++){let K=Q[W];if(K.schema.$ref)Q[W]=Q$($,K)}let X=[];for(let W of Q){let G=Bw($,W.schema,W.schemaId);delete G.$id,X.push(G)}let Y=WE(X),J=new m$(Y,Z);return $.refResolver.addSchema(Y,Z),J}function Bw($,Z,Q){let X=Array.isArray(Z)?[]:{};if(Z.$id!==void 0&&Z.$id.charAt(0)!=="#")Q=Z.$id;let Y=$.mergedSchemasIds.get(Z);if(Y)$.mergedSchemasIds.set(X,Y);for(let J in Z){let W=Z[J];if(J==="$ref"&&typeof W==="string"&&W.charAt(0)==="#")W=Q+W;if(typeof W==="object"&&W!==null)W=Bw($,W,Q);X[J]=W}return X}function Gw($){return`(${$} && typeof ${$}.toJSON === 'function')
146
+ ? ${$}.toJSON()
147
+ : ${$}
148
+ `}function AE($,Z,Q){let X=Z.schema;if($.functionsNamesBySchema.has(X))return`json += ${$.functionsNamesBySchema.get(X)}(${Q})`;let Y=X.nullable===!0,J=Z.schemaId||"",W=Z.jsonPointer||"",G=`${J}#${W}`;if($.recursivePaths.has(G)||$.buildingSet.has(X)){let U=Uw($);$.functionsNamesBySchema.set(X,U);let H=`
149
+ // ${E6($,Z)}
150
+ function ${U} (input) {
151
+ const obj = ${Gw("input")}
152
+ if (obj === null) return ${Y?"JSON_STR_NULL":"JSON_STR_EMPTY_OBJECT"}
153
+ let json = ''
154
+
155
+ ${Ww($,Z,"obj")}
156
+ return json
157
+ }
158
+ `;return $.functions.push(H),`json += ${U}(${Q})`}$.buildingSet.add(X);let K=`obj_${$.uid++}`,B=`
159
+ const ${K} = ${Gw(Q)}
160
+ if (${K} === null) {
161
+ json += ${Y?"JSON_STR_NULL":"JSON_STR_EMPTY_OBJECT"}
162
+ } else {
163
+ ${Ww($,Z,K)}
164
+ }
165
+ `;return $.buildingSet.delete(X),B}function FE($,Z,Q){let X=Z.schema,Y=Z.getPropertyLocation("items");if(Y.schema=Y.schema||{},Y.schema.$ref)Y=Q$($,Y);let J=Y.schema;if($.functionsNamesBySchema.has(X))return`json += ${$.functionsNamesBySchema.get(X)}(${Q})`;let W=X.nullable===!0,G=Z.schemaId||"",K=Z.jsonPointer||"",B=`${G}#${K}`;if($.recursivePaths.has(B)||$.buildingSet.has(X)){let V=Uw($);$.functionsNamesBySchema.set(X,V);let z=E6($,Z),N=`
166
+ function ${V} (obj) {
167
+ // ${z}
168
+ let json = ''
169
+ `;if(N+=`
170
+ if (obj === null) return ${W?"JSON_STR_NULL":"JSON_STR_EMPTY_ARRAY"}
171
+ if (!Array.isArray(obj)) {
172
+ throw new TypeError(\`The value of '${z}' does not match schema definition.\`)
173
+ }
174
+ const arrayLength = obj.length
175
+ `,!X.additionalItems&&Array.isArray(J))N+=`
176
+ if (arrayLength > ${J.length}) {
177
+ throw new Error(\`Item at ${J.length} does not match schema definition.\`)
178
+ }
179
+ `;if(fQ==="json-stringify")N+=`if (arrayLength >= ${P6}) return JSON.stringify(obj)
180
+ `;if(N+=`
181
+ json += JSON_STR_BEGIN_ARRAY
182
+ `,Array.isArray(J)){for(let F=0,O=J.length;F<O;F++){let j=J[F],M=Y.getPropertyLocation(F);if(M.schema.$ref)M=Q$($,M),j=M.schema;let A=`value_${F}`;N+=`const ${A} = obj[${F}]`;let D=e0($,M,A);N+=`
183
+ if (${F} < arrayLength) {
184
+ if (${MJ(j.type,A)}) {
185
+ if (${F}) {
186
+ json += JSON_STR_COMMA
187
+ }
188
+ ${D}
189
+ } else {
190
+ throw new Error(\`Item at ${F} does not match schema definition.\`)
191
+ }
192
+ }
193
+ `}if(X.additionalItems)N+=`
194
+ for (let i = ${J.length}; i < arrayLength; i++) {
195
+ if (i) {
196
+ json += JSON_STR_COMMA
197
+ }
198
+ json += JSON.stringify(obj[i])
199
+ }`}else{let F=e0($,Y,"value");N+=`
200
+ if (arrayLength > 0) {
201
+ const value = obj[0]
202
+ ${F}
203
+ for (let i = 1; i < arrayLength; i++) {
204
+ json += JSON_STR_COMMA
205
+ const value = obj[i]
206
+ ${F}
207
+ }
208
+ }`}return N+=`
209
+ return json + JSON_STR_END_ARRAY
210
+ }`,$.functions.push(N),`json += ${V}(${Q})`}$.buildingSet.add(X);let U=E6($,Z),w=`obj_${$.uid++}`,H=`
211
+ const ${w} = ${Q}
212
+ if (${w} === null) {
213
+ json += ${W?"JSON_STR_NULL":"JSON_STR_EMPTY_ARRAY"}
214
+ } else if (!Array.isArray(${w})) {
215
+ throw new TypeError(\`The value of '${U}' does not match schema definition.\`)
216
+ } else {
217
+ const arrayLength_${w} = ${w}.length
218
+ `;if(!X.additionalItems&&Array.isArray(J))H+=`
219
+ if (arrayLength_${w} > ${J.length}) {
220
+ throw new Error(\`Item at ${J.length} does not match schema definition.\`)
221
+ }
222
+ `;if(fQ==="json-stringify")H+=`if (arrayLength_${w} >= ${P6}) json += JSON.stringify(${w})
223
+ else {`;if(H+=`
224
+ json += JSON_STR_BEGIN_ARRAY
225
+ `,Array.isArray(J)){let V=$.uid++;H+=`let addComma_${V} = false
226
+ `;for(let z=0,N=J.length;z<N;z++){let F=J[z],O=Y.getPropertyLocation(z);if(O.schema.$ref)O=Q$($,O),F=O.schema;let j=`value_${z}_${$.uid++}`;H+=`const ${j} = ${w}[${z}]`;let M=e0($,O,j);H+=`
227
+ if (${z} < arrayLength_${w}) {
228
+ if (${MJ(F.type,j)}) {
229
+ !addComma_${V} && (addComma_${V} = true) || (json += JSON_STR_COMMA)
230
+ ${M}
231
+ } else {
232
+ throw new Error(\`Item at ${z} does not match schema definition.\`)
233
+ }
234
+ }
235
+ `}if(X.additionalItems)H+=`
236
+ for (let i = ${J.length}; i < arrayLength_${w}; i++) {
237
+ !addComma_${V} && (addComma_${V} = true) || (json += JSON_STR_COMMA)
238
+ json += JSON.stringify(${w}[i])
239
+ }`}else{let V=e0($,Y,"value");H+=`
240
+ if (arrayLength_${w} > 0) {
241
+ const value = ${w}[0]
242
+ ${V}
243
+ for (let i = 1; i < arrayLength_${w}; i++) {
244
+ json += JSON_STR_COMMA
245
+ const value = ${w}[i]
246
+ ${V}
247
+ }
248
+ }`}if(H+=`
249
+ json += JSON_STR_END_ARRAY
250
+ `,fQ==="json-stringify")H+="}";return H+="}",$.buildingSet.delete(X),H}function MJ($,Z){let Q;switch($){case"null":Q=`${Z} === null`;break;case"string":Q=`typeof ${Z} === 'string' ||
251
+ ${Z} === null ||
252
+ ${Z} instanceof Date ||
253
+ ${Z} instanceof RegExp ||
254
+ (
255
+ typeof ${Z} === "object" &&
256
+ typeof ${Z}.toString === "function" &&
257
+ ${Z}.toString !== Object.prototype.toString
258
+ )`;break;case"integer":Q=`Number.isInteger(${Z})`;break;case"number":Q=`Number.isFinite(${Z})`;break;case"boolean":Q=`typeof ${Z} === 'boolean'`;break;case"object":Q=`${Z} && typeof ${Z} === 'object' && ${Z}.constructor === Object`;break;case"array":Q=`Array.isArray(${Z})`;break;default:if(Array.isArray($))Q=`(${$.map((Y)=>{return MJ(Y,Z)}).join(" || ")})`}return Q}function Uw($){return"anonymous"+$.functionsCounter++}function NE($,Z,Q){let Y=Z.schema.type.sort((W)=>W==="null"?-1:1),J="";return Y.forEach((W,G)=>{Z.schema={...Z.schema,type:W};let K=zw($,Z,Q),B=G===0?"if":"else if";switch(W){case"null":J+=`
259
+ ${B} (${Q} === null) {
260
+ ${K}
261
+ }
262
+ `;break;case"string":{J+=`
263
+ ${B}(
264
+ typeof ${Q} === "string" ||
265
+ ${Q} === null ||
266
+ ${Q} instanceof Date ||
267
+ ${Q} instanceof RegExp ||
268
+ (
269
+ typeof ${Q} === "object" &&
270
+ typeof ${Q}.toString === "function" &&
271
+ ${Q}.toString !== Object.prototype.toString
272
+ )
273
+ ) {
274
+ ${K}
275
+ }
276
+ `;break}case"array":{J+=`
277
+ ${B}(Array.isArray(${Q})) {
278
+ ${K}
279
+ }
280
+ `;break}case"integer":{J+=`
281
+ ${B}(Number.isInteger(${Q}) || ${Q} === null) {
282
+ ${K}
283
+ }
284
+ `;break}default:{J+=`
285
+ ${B}(typeof ${Q} === "${W}" || ${Q} === null) {
286
+ ${K}
287
+ }
288
+ `;break}}}),J+=`
289
+ else throw new TypeError(\`The value of '${E6($,Z)}' does not match schema definition.\`)
290
+ `,J}function zw($,Z,Q){let X=Z.schema;switch(X.type){case"null":return"json += JSON_STR_NULL";case"string":if(X.format==="date-time")return`json += asDateTime(${Q})`;else if(X.format==="date")return`json += asDate(${Q})`;else if(X.format==="time")return`json += asTime(${Q})`;else if(X.format==="unsafe")return`json += asUnsafeString(${Q})`;else return`
291
+ if (typeof ${Q} !== 'string') {
292
+ if (${Q} === null) {
293
+ json += JSON_STR_EMPTY_STRING
294
+ } else if (${Q} instanceof Date) {
295
+ json += JSON_STR_QUOTE + ${Q}.toISOString() + JSON_STR_QUOTE
296
+ } else if (${Q} instanceof RegExp) {
297
+ json += asString(${Q}.source)
298
+ } else {
299
+ json += asString(${Q}.toString())
300
+ }
301
+ } else {
302
+ json += asString(${Q})
303
+ }
304
+ `;case"integer":return`json += asInteger(${Q})`;case"number":return`json += asNumber(${Q})`;case"boolean":return`json += asBoolean(${Q})`;case"object":return AE($,Z,Q);case"array":return FE($,Z,Q);case void 0:return`json += JSON.stringify(${Q})`;default:throw Error(`${X.type} unsupported`)}}function OE($,Z){let Q=new Set;function X(Y){let J=Y.schema;if(typeof J!=="object"||J===null)return;let W=Y.schemaId||"",G=Y.jsonPointer||"",K=`${W}#${G}`;if(Q.has(K)){let B=!1;for(let U of Q){if(U===K)B=!0;if(B)$.recursivePaths.add(U)}$.recursivePaths.add(K);return}if(Q.add(K),J.$ref)try{let B=Q$($,Y);X(B)}catch(B){}if(J.properties){let B=Y.getPropertyLocation("properties");for(let U in J.properties)X(B.getPropertyLocation(U))}if(J.additionalProperties&&typeof J.additionalProperties==="object")X(Y.getPropertyLocation("additionalProperties"));if(J.patternProperties){let B=Y.getPropertyLocation("patternProperties");for(let U in J.patternProperties)X(B.getPropertyLocation(U))}if(J.items){let B=Y.getPropertyLocation("items");if(Array.isArray(J.items))for(let U=0;U<J.items.length;U++)X(B.getPropertyLocation(U));else X(B)}if(J.additionalItems&&typeof J.additionalItems==="object")X(Y.getPropertyLocation("additionalItems"));if(J.oneOf){let B=Y.getPropertyLocation("oneOf");for(let U=0;U<J.oneOf.length;U++)X(B.getPropertyLocation(U))}if(J.anyOf){let B=Y.getPropertyLocation("anyOf");for(let U=0;U<J.anyOf.length;U++)X(B.getPropertyLocation(U))}if(J.allOf){let B=Y.getPropertyLocation("allOf");for(let U=0;U<J.allOf.length;U++)X(B.getPropertyLocation(U))}if(J.then)X(Y.getPropertyLocation("then"));if(J.else)X(Y.getPropertyLocation("else"));Q.delete(K)}X(Z)}function jE($,Z){let Q=$.schema,X=Q.type,Y=Array.isArray(X)&&X.includes("null"),J="";if(Y)J+=`
305
+ if (${Z} === null) {
306
+ json += JSON_STR_NULL
307
+ } else {
308
+ `;if(J+=`json += '${JSON.stringify(Q.const).replace(GE,"\\'")}'`,Y)J+=`
309
+ }
310
+ `;return J}function DE($,Z,Q){let X=Z.schema,Y=$.mergedSchemasIds.get(X);if(Y){let U=LQ($,Y);return e0($,U,Q)}Y=`__fjs_merged_${C6++}`,$.mergedSchemasIds.set(X,Y);let{allOf:J,...W}=Z.schema,G=[new m$(W,Z.schemaId,Z.jsonPointer)],K=Z.getPropertyLocation("allOf");for(let U=0,w=J.length;U<w;U++)G.push(K.getPropertyLocation(U));let B=RQ($,Y,G);return e0($,B,Q)}function TE($,Z,Q){$.validatorSchemasIds.add(Z.schemaId);let Y=Z.schema.anyOf?"anyOf":"oneOf",{[Y]:J,...W}=Z.schema,G=new m$(W,Z.schemaId,Z.jsonPointer),K=Z.getPropertyLocation(Y),B="";for(let U=0,w=J.length;U<w;U++){let H=K.getPropertyLocation(U),V=H.schema,z=$.mergedSchemasIds.get(V),N=null;if(z)N=LQ($,z);else z=`__fjs_merged_${C6++}`,$.mergedSchemasIds.set(V,z),N=RQ($,z,[G,H]);let F=e0($,N,Q),O=H.getSchemaRef();B+=`
311
+ ${U===0?"if":"else if"}(validator.validate("${O}", ${Q})) {
312
+ ${F}
313
+ }
314
+ `}return B+=`
315
+ else throw new TypeError(\`The value of '${E6($,Z)}' does not match schema definition.\`)
316
+ `,B}function qE($,Z,Q){$.validatorSchemasIds.add(Z.schemaId);let{if:X,then:Y,else:J,...W}=Z.schema,G=new m$(W,Z.schemaId,Z.jsonPointer),B=Z.getPropertyLocation("if").getSchemaRef(),U=Z.getPropertyLocation("then"),w=$.mergedSchemasIds.get(Y),H=null;if(w)H=LQ($,w);else w=`__fjs_merged_${C6++}`,$.mergedSchemasIds.set(Y,w),H=RQ($,w,[G,U]);if(!J)return`
317
+ if (validator.validate("${B}", ${Q})) {
318
+ ${e0($,H,Q)}
319
+ } else {
320
+ ${e0($,G,Q)}
321
+ }
322
+ `;let V=Z.getPropertyLocation("else"),z=$.mergedSchemasIds.get(J),N=null;if(z)N=LQ($,z);else z=`__fjs_merged_${C6++}`,$.mergedSchemasIds.set(J,z),N=RQ($,z,[G,V]);return`
323
+ if (validator.validate("${B}", ${Q})) {
324
+ ${e0($,H,Q)}
325
+ } else {
326
+ ${e0($,N,Q)}
327
+ }
328
+ `}function e0($,Z,Q){let X=Z.schema;if(typeof X==="boolean")return`json += JSON.stringify(${Q})`;if(X.$ref)Z=Q$($,Z),X=Z.schema;if(X.allOf)return DE($,Z,Q);if(X.anyOf||X.oneOf)return TE($,Z,Q);if(X.if&&X.then)return qE($,Z,Q);if(X.type===void 0){let G=HE(X);if(G)X.type=G}let Y="",J=X.type,W=X.nullable===!0;if(W)Y+=`
329
+ if (${Q} === null) {
330
+ json += JSON_STR_NULL
331
+ } else {
332
+ `;if(X.const!==void 0)Y+=jE(Z,Q);else if(Array.isArray(J))Y+=NE($,Z,Q);else Y+=zw($,Z,Q);if(W)Y+=`
333
+ }
334
+ `;return Y}R8.exports=AJ;R8.exports.default=AJ;R8.exports.build=AJ;R8.exports.validLargeArrayMechanisms=Kw;R8.exports.restore=function({code:$,validator:Z,serializer:Q}){return Function.apply(null,["validator","serializer",$]).apply(null,[Z,Q])}});var Mw=I((RE,PQ)=>{var fE=ww();function Vw(){return function(Z,Q){let X=Object.assign({},Q,{schema:Z});return LE.bind(null,X)}}function LE($,{schema:Z}){if($.schema&&Z.$id&&$.schema[Z.$id])$.schema={...$.schema},delete $.schema[Z.$id];return fE(Z,$)}function Hw($={readMode:!0}){if($.readMode===!0&&typeof $.restoreFunction!=="function")throw Error("You must provide a function for the restoreFunction-option when readMode ON");if($.readMode!==!0&&typeof $.storeFunction!=="function")throw Error("You must provide a function for the storeFunction-option when readMode OFF");if($.readMode===!0)return function(){return function(X){return $.restoreFunction(X)}};let Z=Vw();return function(X,Y={}){Y.mode="standalone";let J=Z(X,Y);return function(W){let G=J(W);return $.storeFunction(W,G),Function(G)}}}RE.SerializerSelector=Vw;RE.StandaloneSerializer=Hw;RE.default=Hw});var Aw=I((ph,b6)=>{var{SerializerSelector:FJ,StandaloneSerializer:bE}=Mw();b6.exports=FJ;b6.exports.default=FJ;b6.exports.SerializerSelector=FJ;b6.exports.StandaloneSerializer=bE});var NJ=I((ih,Fw)=>{var{buildSchemas:_E}=K6();function IE($,Z){if($)return new _6($,Z);let Q=Object.assign({buildValidator:null,buildSerializer:null},Z?.compilersFactory);if(!Q.buildValidator){let Y=YJ();Q.buildValidator=Y()}if(!Q.buildSerializer){let Y=Aw();Q.buildSerializer=Y()}let X={bucket:Z&&Z.bucket||_E,compilersFactory:Q,isCustomValidatorCompiler:typeof Z?.compilersFactory?.buildValidator==="function",isCustomSerializerCompiler:typeof Z?.compilersFactory?.buildValidator==="function"};return new _6(void 0,X)}class _6{constructor($,Z){if(this.opts=Z||$?.opts,this.addedSchemas=!1,this.compilersFactory=this.opts.compilersFactory,$)this.schemaBucket=this.opts.bucket($.getSchemas()),this.validatorCompiler=$.getValidatorCompiler(),this.serializerCompiler=$.getSerializerCompiler(),this.isCustomValidatorCompiler=$.isCustomValidatorCompiler,this.isCustomSerializerCompiler=$.isCustomSerializerCompiler,this.parent=$;else this.schemaBucket=this.opts.bucket(),this.isCustomValidatorCompiler=this.opts.isCustomValidatorCompiler||!1,this.isCustomSerializerCompiler=this.opts.isCustomSerializerCompiler||!1}add($){return this.addedSchemas=!0,this.schemaBucket.add($)}getSchema($){return this.schemaBucket.getSchema($)}getSchemas(){return this.schemaBucket.getSchemas()}setValidatorCompiler($){this.compilersFactory=Object.assign({},this.compilersFactory,{buildValidator:()=>$}),this.validatorCompiler=$,this.isCustomValidatorCompiler=!0}setSerializerCompiler($){this.compilersFactory=Object.assign({},this.compilersFactory,{buildSerializer:()=>$}),this.serializerCompiler=$,this.isCustomSerializerCompiler=!0}getValidatorCompiler(){return this.validatorCompiler||this.parent&&this.parent.getValidatorCompiler()}getSerializerCompiler(){return this.serializerCompiler||this.parent&&this.parent.getSerializerCompiler()}getSerializerBuilder(){return this.compilersFactory.buildSerializer||this.parent&&this.parent.getSerializerBuilder()}getValidatorBuilder(){return this.compilersFactory.buildValidator||this.parent&&this.parent.getValidatorBuilder()}setupValidator($){if(this.validatorCompiler!==void 0&&!this.addedSchemas)return;this.validatorCompiler=this.getValidatorBuilder()(this.schemaBucket.getSchemas(),$.ajv)}setupSerializer($){if(this.serializerCompiler!==void 0&&!this.addedSchemas)return;this.serializerCompiler=this.getSerializerBuilder()(this.schemaBucket.getSchemas(),$.serializerOpts)}}_6.buildSchemaController=IE;Fw.exports=_6});var fJ=I((nh,qJ)=>{var OJ=SE(),DJ=u("assert"),TJ=Symbol.for("registered-plugin"),{kTestInternals:xE}=u0(),{exist:kE,existReply:vE,existRequest:yE}=w6(),{FST_ERR_PLUGIN_VERSION_MISMATCH:gE,FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE:hE,FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER:uE}=d0(),mE=/-(?:rc|pre|alpha).+$/u;function I6($){return $[Symbol.for("plugin-meta")]}function Nw($){let Z=Ow($);if(Z)return Z;let Q=u.cache;if(Q){let X=Object.keys(Q);for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Q[J].exports===$)return J}}if($.name)return $.name;return null}function lE($){return $.toString().split(`
335
+ `,2).map((Z)=>Z.trim()).join(" -- ")}function Ow($){return $[Symbol.for("fastify.display-name")]}function jw($){return!!$[Symbol.for("skip-override")]}function Dw($){let Z=I6($);if(!Z)return;let Q=Z.dependencies;if(!Q)return;DJ(Array.isArray(Q),"The dependencies should be an array of strings"),Q.forEach((X)=>{DJ(this[TJ].indexOf(X)>-1,`The dependency '${X}' of plugin '${Z.name}' is not registered`)})}function Tw($){let Z=I6($);if(!Z)return;let{decorators:Q,name:X}=Z;if(!Q)return;if(Q.fastify)jJ(this,"Fastify",Q.fastify,X);if(Q.reply)jJ(this,"Reply",Q.reply,X);if(Q.request)jJ(this,"Request",Q.request,X)}var cE={Fastify:kE,Request:yE,Reply:vE};function jJ($,Z,Q,X){DJ(Array.isArray(Q),"The decorators should be an array of strings"),Q.forEach((Y)=>{let J=typeof X==="string"?` required by '${X}'`:"";if(!cE[Z].call($,Y))throw new hE(Y,J,Z)})}function dE($){let Z=I6($);if(Z?.fastify==null)return;let Q=Z.fastify,X=mE.test(this.version);if(X===!0&&OJ.gt(this.version,OJ.coerce(Q))===!0)return;if(Q&&OJ.satisfies(this.version,Q,{includePrerelease:X})===!1)throw new gE(Z.name,Q,this.version)}function pE($){let Z=I6($);if(!Z)return;let Q=Z.name;if(!Q)return;return this[TJ].push(Q),Q}function iE($,Z){if($.constructor.name==="AsyncFunction"&&$.length===3)throw new uE(Z)}function nE($){let Z=pE.call(this,$)||Nw($);return iE.call(this,$,Z),dE.call(this,$),Tw.call(this,$),Dw.call(this,$),jw($)}qJ.exports={getPluginName:Nw,getFuncPreview:lE,kRegisteredPlugins:TJ,getDisplayName:Ow,registerPlugin:nE};qJ.exports[xE]={shouldSkipOverride:jw,getMeta:I6,checkDecorators:Tw,checkDependencies:Dw}});var CQ=I((ah,qw)=>{function sE($,Z){let Q=Z||oE();if($)return rE($,Q);return Q}function aE($,Z){return $.genReqId(Z)}function oE(){let Z=0;return function(){return Z=Z+1&2147483647,`req-${Z.toString(36)}`}}function rE($,Z){return function(Q){return Q.headers[$]||Z(Q)}}qw.exports={getGenReqId:aE,reqIdGenFactory:sE}});var Pw=I((oh,Rw)=>{var fw=12,tE=0,LJ=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function eE($){var Z=$.indexOf("%");if(Z===-1)return $;var Q=$.length,X="",Y=0,J=0,W=Z,G=fw;while(Z>-1&&Z<Q){var K=Lw($[Z+1],4),B=Lw($[Z+2],0),U=K|B,w=LJ[U];if(G=LJ[256+G+w],J=J<<6|U&LJ[364+w],G===fw)X+=$.slice(Y,W),X+=J<=65535?String.fromCharCode(J):String.fromCharCode(55232+(J>>10),56320+(J&1023)),J=0,Y=Z+3,Z=W=$.indexOf("%",Y);else if(G===tE)return null;else{if(Z+=3,Z<Q&&$.charCodeAt(Z)===37)continue;return null}}return X+$.slice(Y)}var $b={"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};function Lw($,Z){var Q=$b[$];return Q===void 0?255:Q<<Z}Rw.exports=eE});var Iw=I((rh,_w)=>{var Cw=Pw(),Ew=/\+/g,bw=function(){};bw.prototype=Object.create(null);function Zb($){let Z=new bw;if(typeof $!=="string")return Z;let Q=$.length,X="",Y="",J=-1,W=-1,G=!1,K=!1,B=!1,U=!1,w=!1,H=0;for(let V=0;V<Q+1;V++)if(H=V!==Q?$.charCodeAt(V):38,H===38){if(w=W>J,!w)W=V;if(X=$.slice(J+1,W),w||X.length>0){if(B)X=X.replace(Ew," ");if(G)X=Cw(X)||X;if(w){if(Y=$.slice(W+1,V),U)Y=Y.replace(Ew," ");if(K)Y=Cw(Y)||Y}let z=Z[X];if(z===void 0)Z[X]=Y;else if(z.pop)z.push(Y);else Z[X]=[z,Y]}Y="",J=V,W=V,G=!1,K=!1,B=!1,U=!1}else if(H===61)if(W<=J)W=V;else K=!0;else if(H===43)if(W>J)U=!0;else B=!0;else if(H===37)if(W>J)K=!0;else G=!0;return Z}_w.exports=Zb});var xw=I((th,Sw)=>{var d1=Array.from({length:256},($,Z)=>"%"+((Z<16?"0":"")+Z.toString(16)).toUpperCase()),Qb=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);function Xb($){let Z=$.length;if(Z===0)return"";let Q="",X=0,Y=0;$:for(;Y<Z;Y++){let J=$.charCodeAt(Y);while(J<128){if(Qb[J]!==1){if(X<Y)Q+=$.slice(X,Y);X=Y+1,Q+=d1[J]}if(++Y===Z)break $;J=$.charCodeAt(Y)}if(X<Y)Q+=$.slice(X,Y);if(J<2048){X=Y+1,Q+=d1[192|J>>6]+d1[128|J&63];continue}if(J<55296||J>=57344){X=Y+1,Q+=d1[224|J>>12]+d1[128|J>>6&63]+d1[128|J&63];continue}if(++Y,Y>=Z)throw Error("URI malformed");let W=$.charCodeAt(Y)&1023;X=Y+1,J=65536+((J&1023)<<10|W),Q+=d1[240|J>>18]+d1[128|J>>12&63]+d1[128|J>>6&63]+d1[128|J&63]}if(X===0)return $;if(X<Z)return Q+$.slice(X);return Q}Sw.exports={encodeString:Xb}});var yw=I((eh,vw)=>{var{encodeString:RJ}=xw();function kw($){let Z=typeof $;if(Z==="string")return RJ($);else if(Z==="bigint")return $.toString();else if(Z==="boolean")return $?"true":"false";else if(Z==="number"&&Number.isFinite($))return $<1000000000000000000000?""+$:RJ(""+$);return""}function Yb($){let Z="";if($===null||typeof $!=="object")return Z;let Q="&",X=Object.keys($),Y=X.length,J=0;for(let W=0;W<Y;W++){let G=X[W],K=$[G],B=RJ(G)+"=";if(W)Z+=Q;if(Array.isArray(K)){J=K.length;for(let U=0;U<J;U++){if(U)Z+=Q;Z+=B,Z+=kw(K[U])}}else Z+=B,Z+=kw(K)}return Z}vw.exports=Yb});var mw=I(($u,S6)=>{var gw=Iw(),hw=yw(),uw={parse:gw,stringify:hw};S6.exports=uw;S6.exports.default=uw;S6.exports.parse=gw;S6.exports.stringify=hw});var cw=I((lw)=>{Object.defineProperty(lw,"__esModule",{value:!0})});var pw=I((dw)=>{Object.defineProperty(dw,"__esModule",{value:!0});dw.types=void 0;var Jb;(function($){$[$.ROOT=0]="ROOT",$[$.GROUP=1]="GROUP",$[$.POSITION=2]="POSITION",$[$.SET=3]="SET",$[$.RANGE=4]="RANGE",$[$.REPETITION=5]="REPETITION",$[$.REFERENCE=6]="REFERENCE",$[$.CHAR=7]="CHAR"})(Jb=dw.types||(dw.types={}))});var nw=I((iw)=>{Object.defineProperty(iw,"__esModule",{value:!0})});var Y$=I((X$)=>{var Wb=X$&&X$.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),CJ=X$&&X$.__exportStar||function($,Z){for(var Q in $)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call(Z,Q))Wb(Z,$,Q)};Object.defineProperty(X$,"__esModule",{value:!0});CJ(cw(),X$);CJ(pw(),X$);CJ(nw(),X$)});var EQ=I((rw)=>{Object.defineProperty(rw,"__esModule",{value:!0});rw.anyChar=rw.notWhitespace=rw.whitespace=rw.notInts=rw.ints=rw.notWords=rw.words=void 0;var F0=Y$(),sw=()=>[{type:F0.types.RANGE,from:48,to:57}],aw=()=>[{type:F0.types.CHAR,value:95},{type:F0.types.RANGE,from:97,to:122},{type:F0.types.RANGE,from:65,to:90},{type:F0.types.RANGE,from:48,to:57}],ow=()=>[{type:F0.types.CHAR,value:9},{type:F0.types.CHAR,value:10},{type:F0.types.CHAR,value:11},{type:F0.types.CHAR,value:12},{type:F0.types.CHAR,value:13},{type:F0.types.CHAR,value:32},{type:F0.types.CHAR,value:160},{type:F0.types.CHAR,value:5760},{type:F0.types.RANGE,from:8192,to:8202},{type:F0.types.CHAR,value:8232},{type:F0.types.CHAR,value:8233},{type:F0.types.CHAR,value:8239},{type:F0.types.CHAR,value:8287},{type:F0.types.CHAR,value:12288},{type:F0.types.CHAR,value:65279}],Gb=()=>[{type:F0.types.CHAR,value:10},{type:F0.types.CHAR,value:13},{type:F0.types.CHAR,value:8232},{type:F0.types.CHAR,value:8233}];rw.words=()=>({type:F0.types.SET,set:aw(),not:!1});rw.notWords=()=>({type:F0.types.SET,set:aw(),not:!0});rw.ints=()=>({type:F0.types.SET,set:sw(),not:!1});rw.notInts=()=>({type:F0.types.SET,set:sw(),not:!0});rw.whitespace=()=>({type:F0.types.SET,set:ow(),not:!1});rw.notWhitespace=()=>({type:F0.types.SET,set:ow(),not:!0});rw.anyChar=()=>({type:F0.types.SET,set:Gb(),not:!0})});var $3=I((P1)=>{var Hb=P1&&P1.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),Mb=P1&&P1.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),Ab=P1&&P1.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var Q in $)if(Q!=="default"&&Object.prototype.hasOwnProperty.call($,Q))Hb(Z,$,Q)}return Mb(Z,$),Z};Object.defineProperty(P1,"__esModule",{value:!0});P1.tokenizeClass=P1.strToChars=void 0;var ew=Y$(),P8=Ab(EQ()),Fb="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";P1.strToChars=($)=>{let Z=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return $.replace(Z,(Q,X,Y,J,W,G,K)=>{if(Y)return Q;let B=X?8:J?parseInt(J,16):W?parseInt(W,16):G?Fb.indexOf(G):{0:0,t:9,n:10,v:11,f:12,r:13}[K],U=String.fromCharCode(B);return/[[\]{}^$.|?*+()]/.test(U)?`\\${U}`:U})};P1.tokenizeClass=($,Z)=>{var Q,X,Y,J,W,G,K;let B=[],U,w,H=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;while((U=H.exec($))!==null){let V=(K=(G=(W=(J=(Y=(X=(Q=U[1]&&P8.words())!==null&&Q!==void 0?Q:U[2]&&P8.ints())!==null&&X!==void 0?X:U[3]&&P8.whitespace())!==null&&Y!==void 0?Y:U[4]&&P8.notWords())!==null&&J!==void 0?J:U[5]&&P8.notInts())!==null&&W!==void 0?W:U[6]&&P8.notWhitespace())!==null&&G!==void 0?G:U[7]&&{type:ew.types.RANGE,from:(U[8]||U[9]).charCodeAt(0),to:(w=U[10]).charCodeAt(w.length-1)})!==null&&K!==void 0?K:(w=U[16])&&{type:ew.types.CHAR,value:w.charCodeAt(0)};if(V)B.push(V);else return[B,H.lastIndex]}throw SyntaxError(`Invalid regular expression: /${Z}/: Unterminated character class`)}});var EJ=I((p1)=>{var Nb=p1&&p1.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),Ob=p1&&p1.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),X3=p1&&p1.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var Q in $)if(Q!=="default"&&Object.prototype.hasOwnProperty.call($,Q))Nb(Z,$,Q)}return Ob(Z,$),Z};Object.defineProperty(p1,"__esModule",{value:!0});p1.tokenizer=void 0;var Z3=X3($3()),r0=Y$(),l$=X3(EQ()),jb=/^[a-zA-Z_$]$/i,Db=/^[a-zA-Z0-9_$]$/i,Q3=/\d/;p1.tokenizer=($)=>{let Z=0,Q,X={type:r0.types.ROOT,stack:[]},Y=X,J=X.stack,W=[],G=[],K=0,B=(w)=>{throw SyntaxError(`Invalid regular expression: /${$}/: Nothing to repeat at column ${w-1}`)},U=Z3.strToChars($);while(Z<U.length)switch(Q=U[Z++]){case"\\":if(Z===U.length)throw SyntaxError(`Invalid regular expression: /${$}/: \\ at end of pattern`);switch(Q=U[Z++]){case"b":J.push({type:r0.types.POSITION,value:"b"});break;case"B":J.push({type:r0.types.POSITION,value:"B"});break;case"w":J.push(l$.words());break;case"W":J.push(l$.notWords());break;case"d":J.push(l$.ints());break;case"D":J.push(l$.notInts());break;case"s":J.push(l$.whitespace());break;case"S":J.push(l$.notWhitespace());break;default:if(Q3.test(Q)){let w=Q;while(Z<U.length&&Q3.test(U[Z]))w+=U[Z++];let H=parseInt(w,10),V={type:r0.types.REFERENCE,value:H};J.push(V),G.push({reference:V,stack:J,index:J.length-1})}else J.push({type:r0.types.CHAR,value:Q.charCodeAt(0)})}break;case"^":J.push({type:r0.types.POSITION,value:"^"});break;case"$":J.push({type:r0.types.POSITION,value:"$"});break;case"[":{let w;if(U[Z]==="^")w=!0,Z++;else w=!1;let H=Z3.tokenizeClass(U.slice(Z),$);Z+=H[1],J.push({type:r0.types.SET,set:H[0],not:w});break}case".":J.push(l$.anyChar());break;case"(":{let w={type:r0.types.GROUP,stack:[],remember:!0};if(U[Z]==="?")if(Q=U[Z+1],Z+=2,Q==="=")w.followedBy=!0,w.remember=!1;else if(Q==="!")w.notFollowedBy=!0,w.remember=!1;else if(Q==="<"){let H="";if(jb.test(U[Z]))H+=U[Z],Z++;else throw SyntaxError(`Invalid regular expression: /${$}/: Invalid capture group name, character '${U[Z]}' after '<' at column ${Z+1}`);while(Z<U.length&&Db.test(U[Z]))H+=U[Z],Z++;if(!H)throw SyntaxError(`Invalid regular expression: /${$}/: Invalid capture group name, character '${U[Z]}' after '<' at column ${Z+1}`);if(U[Z]!==">")throw SyntaxError(`Invalid regular expression: /${$}/: Unclosed capture group name, expected '>', found '${U[Z]}' at column ${Z+1}`);w.name=H,Z++}else if(Q===":")w.remember=!1;else throw SyntaxError(`Invalid regular expression: /${$}/: Invalid group, character '${Q}' after '?' at column ${Z-1}`);else K+=1;J.push(w),W.push(Y),Y=w,J=w.stack;break}case")":if(W.length===0)throw SyntaxError(`Invalid regular expression: /${$}/: Unmatched ) at column ${Z-1}`);Y=W.pop(),J=Y.options?Y.options[Y.options.length-1]:Y.stack;break;case"|":{if(!Y.options)Y.options=[Y.stack],delete Y.stack;let w=[];Y.options.push(w),J=w;break}case"{":{let w=/^(\d+)(,(\d+)?)?\}/.exec(U.slice(Z)),H,V;if(w!==null){if(J.length===0)B(Z);H=parseInt(w[1],10),V=w[2]?w[3]?parseInt(w[3],10):1/0:H,Z+=w[0].length,J.push({type:r0.types.REPETITION,min:H,max:V,value:J.pop()})}else J.push({type:r0.types.CHAR,value:123});break}case"?":if(J.length===0)B(Z);J.push({type:r0.types.REPETITION,min:0,max:1,value:J.pop()});break;case"+":if(J.length===0)B(Z);J.push({type:r0.types.REPETITION,min:1,max:1/0,value:J.pop()});break;case"*":if(J.length===0)B(Z);J.push({type:r0.types.REPETITION,min:0,max:1/0,value:J.pop()});break;default:J.push({type:r0.types.CHAR,value:Q.charCodeAt(0)})}if(W.length!==0)throw SyntaxError(`Invalid regular expression: /${$}/: Unterminated group`);return Tb(G,K),X};function Tb($,Z){for(let Q of $.reverse())if(Z<Q.reference.value){Q.reference.type=r0.types.CHAR;let X=Q.reference.value.toString();if(Q.reference.value=parseInt(X,8),!/^[0-7]+$/.test(X)){let Y=0;while(X[Y]!=="8"&&X[Y]!=="9")Y+=1;if(Y===0)Q.reference.value=X.charCodeAt(0),Y+=1;else Q.reference.value=parseInt(X.slice(0,Y),8);if(X.length>Y){let J=Q.stack.splice(Q.index+1);for(let W of X.slice(Y))Q.stack.push({type:r0.types.CHAR,value:W.charCodeAt(0)});Q.stack.push(...J)}}}}});var J3=I(($1)=>{var qb=$1&&$1.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),fb=$1&&$1.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),Lb=$1&&$1.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var Q in $)if(Q!=="default"&&Object.prototype.hasOwnProperty.call($,Q))qb(Z,$,Q)}return fb(Z,$),Z};Object.defineProperty($1,"__esModule",{value:!0});$1.NOTANYCHAR=$1.WHITESPACE=$1.WORDS=$1.INTS=void 0;var bQ=Lb(EQ()),Y3=Y$();function _Q($){let Z={},Q=0;for(let X of $){if(X.type===Y3.types.CHAR)Z[X.value]=!0;if(X.type===Y3.types.RANGE)Z[`${X.from}-${X.to}`]=!0;Q+=1}return{lookup:()=>Object.assign({},Z),len:Q}}$1.INTS=_Q(bQ.ints().set);$1.WORDS=_Q(bQ.words().set);$1.WHITESPACE=_Q(bQ.whitespace().set);$1.NOTANYCHAR=_Q(bQ.anyChar().set)});var G3=I((C1)=>{var Rb=C1&&C1.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),Pb=C1&&C1.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),Cb=C1&&C1.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var Q in $)if(Q!=="default"&&Object.prototype.hasOwnProperty.call($,Q))Rb(Z,$,Q)}return Pb(Z,$),Z};Object.defineProperty(C1,"__esModule",{value:!0});C1.writeSetTokens=C1.setChar=void 0;var kQ=Y$(),IQ=Cb(J3());function xQ($){return $===94?"\\^":$===92?"\\\\":$===93?"\\]":$===45?"\\-":String.fromCharCode($)}C1.setChar=xQ;function SQ($,{lookup:Z,len:Q}){if(Q!==$.length)return!1;let X=Z();for(let Y of $){if(Y.type===kQ.types.SET)return!1;let J=Y.type===kQ.types.CHAR?Y.value:`${Y.from}-${Y.to}`;if(X[J])X[J]=!1;else return!1}return!0}function W3($,Z=!1){if(SQ($.set,IQ.INTS))return $.not?"\\D":"\\d";if(SQ($.set,IQ.WORDS))return $.not?"\\W":"\\w";if($.not&&SQ($.set,IQ.NOTANYCHAR))return".";if(SQ($.set,IQ.WHITESPACE))return $.not?"\\S":"\\s";let Q="";for(let Y=0;Y<$.set.length;Y++){let J=$.set[Y];Q+=Eb(J)}let X=`${$.not?"^":""}${Q}`;return Z?X:`[${X}]`}C1.writeSetTokens=W3;function Eb($){if($.type===kQ.types.CHAR)return xQ($.value);else if($.type===kQ.types.RANGE)return`${xQ($.from)}-${xQ($.to)}`;return W3($,!0)}});var _J=I((U3)=>{Object.defineProperty(U3,"__esModule",{value:!0});U3.reconstruct=void 0;var O$=Y$(),bJ=G3(),K3=($)=>$.map(U3.reconstruct).join(""),B3=($)=>{if("options"in $)return $.options.map(K3).join("|");else if("stack"in $)return K3($.stack);else throw Error("options or stack must be Root or Group token")};U3.reconstruct=($)=>{switch($.type){case O$.types.ROOT:return B3($);case O$.types.CHAR:{let Z=String.fromCharCode($.value);return(/[[\\{}$^.|?*+()]/.test(Z)?"\\":"")+Z}case O$.types.POSITION:if($.value==="^"||$.value==="$")return $.value;else return`\\${$.value}`;case O$.types.REFERENCE:return`\\${$.value}`;case O$.types.SET:return bJ.writeSetTokens($);case O$.types.GROUP:return`(${$.name?`?<${$.name}>`:$.remember?"":$.followedBy?"?=":$.notFollowedBy?"?!":"?:"}${B3($)})`;case O$.types.REPETITION:{let{min:Z,max:Q}=$,X;if(Z===0&&Q===1)X="?";else if(Z===1&&Q===1/0)X="+";else if(Z===0&&Q===1/0)X="*";else if(Q===1/0)X=`{${Z},}`;else if(Z===Q)X=`{${Z}}`;else X=`{${Z},${Q}}`;return`${U3.reconstruct($.value)}${X}`}case O$.types.RANGE:return`${bJ.setChar($.from)}-${bJ.setChar($.to)}`;default:throw Error(`Invalid token type ${$}`)}}});var SJ=I((E1,yQ)=>{var bb=E1&&E1.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;Object.defineProperty($,X,{enumerable:!0,get:function(){return Z[Q]}})}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),IJ=E1&&E1.__exportStar||function($,Z){for(var Q in $)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call(Z,Q))bb(Z,$,Q)};Object.defineProperty(E1,"__esModule",{value:!0});E1.types=void 0;var z3=Y$();Object.defineProperty(E1,"types",{enumerable:!0,get:function(){return z3.types}});IJ(EJ(),E1);IJ(_J(),E1);var w3=EJ(),_b=_J();IJ(Y$(),E1);E1.default=w3.tokenizer;yQ.exports=w3.tokenizer;yQ.exports.types=z3.types;yQ.exports.reconstruct=_b.reconstruct});var V3=I((zu,gQ)=>{var Ib=SJ(),{types:Sb}=SJ();function xJ($,Z,Q){let X,Y,J;if($.type===Sb.REPETITION){if(Q++,Z.reps++,Q>1)return!1;if(Z.reps>Z.limit)return!1}if($.options){for(X=0,J=$.options.length;X<J;X++)if(Y=xJ({stack:$.options[X]},Z,Q),!Y)return!1}let W=$.stack||$.value?.stack;if(!W)return!0;for(X=0,J=W.length;X<J;X++)if(Y=xJ(W[X],Z,Q),!Y)return!1;return!0}function kJ($,Z){let Q={reps:0,limit:Z?.limit??25};if(xb($))$=$.source;else if(typeof $!=="string")$=String($);try{return xJ(Ib($),Q,0)}catch{return!1}}function xb($){return Object.prototype.toString.call($)==="[object RegExp]"}gQ.exports=kJ;gQ.exports.default=kJ;gQ.exports.safeRegex=kJ});var hQ=I((wu,H3)=>{H3.exports={name:"__fmw_internal_strategy_merged_tree_http_method__",storage:function(){let $=new Map;return{get:(Z)=>{return $.get(Z)||null},set:(Z,Q)=>{$.set(Z,Q)}}},deriveConstraint:($)=>$.method,mustMatchWhenDerived:!0}});var T3=I((Vu,D3)=>{var M3=F3(),A3=hQ(),N3=Symbol("treeData");function O3($,Z=""){let Q="",X=Object.keys($);for(let Y=0;Y<X.length;Y++){let J=X[Y],W=$[J],G=Y===X.length-1,K=G?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",B=G?" ":"\u2502 ",w=(W[N3]||"").replaceAll(`
336
+ `,`
337
+ `+Z+B);Q+=Z+K+J+w+`
338
+ `,Q+=O3(W,Z+B)}return Q}function kb($){let Z=$.name||"";return Z=Z.replace("bound","").trim(),Z=(Z||"anonymous")+"()",Z}function j3($){if(Array.isArray($))return $.map((Z)=>j3(Z));if(typeof $==="symbol")return $.toString();if(typeof $==="function")return kb($);return $}function vb($,Z){if(!Z.includeMeta)return{};let Q=Z.buildPrettyMeta($),X={},Y=Z.includeMeta;if(!Array.isArray(Y))Y=Reflect.ownKeys(Q);for(let J of Y){if(!Object.prototype.hasOwnProperty.call(Q,J))continue;let W=J.toString(),G=Q[J];if(G!==void 0&&G!==null){let K=JSON.stringify(j3(G));X[W]=K}}return X}function yb($){let Z="";for(let[Q,X]of Object.entries($))Z+=`
339
+ \u2022 (${Q}) ${X}`;return Z}function gb($){let Z={...$.opts.constraints},Q=Z[A3.name];return delete Z[A3.name],{...$,method:Q,opts:{constraints:Z}}}function hb($){let Z=` (${$.method})`,Q=$.opts.constraints||{};if(Object.keys(Q).length!==0)Z+=" "+JSON.stringify(Q);return Z+=yb($.metaData),Z}function ub($){return $.reduce((Z,Q)=>{for(let X of Z)if(M3(Q.opts.constraints,X.opts.constraints)&&M3(Q.metaData,X.metaData))return X.method+=", "+Q.method,Z;return Z.push(Q),Z},[])}function mb($,Z,Q){let X=$.routes;if(Q.method===void 0)X=X.map(gb);if(X=X.map((Y)=>{return Y.metaData=vb(Y,Q),Y}),Q.method===void 0)X=ub(X);return X.map(hb).join(`
340
+ ${Z}`)}function uQ($,Z,Q,X){if($.isLeafNode||X.commonPrefix!==!1){if(Q=Q||"(empty root node)",Z=Z[Q]={},$.isLeafNode)Z[N3]=mb($,Q,X);Q=""}if($.staticChildren)for(let Y of Object.values($.staticChildren))uQ(Y,Z,Q+Y.prefix,X);if($.parametricChildren)for(let Y of Object.values($.parametricChildren)){let J=Array.from(Y.nodePaths).join("|");uQ(Y,Z,Q+J,X)}if($.wildcardChild)uQ($.wildcardChild,Z,"*",X)}function lb($,Z){let Q={};return uQ($,Q,$.prefix,Z),O3(Q)}D3.exports={prettyPrintTree:lb}});var L3=I((Hu,f3)=>{var q3=function(){};q3.prototype=Object.create(null);f3.exports={NullObject:q3}});var C3=I((Mu,P3)=>{var{NullObject:cb}=L3(),db=hQ();class R3{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler($){if($===void 0)return this.unconstrainedHandler;return this._getHandlerMatchingConstraints($)}addHandler($,Z){let Q=Z.params,X=Z.opts.constraints||{},Y={params:Q,constraints:X,handler:Z.handler,store:Z.store||null,_createParamsObject:this._compileCreateParamsObject(Q)},J=Object.keys(X);if(J.length===0)this.unconstrainedHandler=Y;for(let G of J)if(!this.constraints.includes(G))if(G==="version")this.constraints.unshift(G);else this.constraints.push(G);let W=J.includes(db.name);if(!W&&this.handlers.length>=31)throw Error("find-my-way supports a maximum of 31 route handlers per node when there are constraints, limit reached");if(this.handlers.push(Y),this.handlers.sort((G,K)=>Object.keys(G.constraints).length-Object.keys(K.constraints).length),!W)this._compileGetHandlerMatchingConstraints($,X)}_compileCreateParamsObject($){let Z=[];Z.push("const fn = function _createParamsObject (paramsArray) {"),Z.push("const params = new NullObject()");for(let Q=0;Q<$.length;Q++)Z.push(`params['${$[Q]}'] = paramsArray[${Q}]`);return Z.push("return params"),Z.push("}"),Z.push("return fn"),Function("NullObject",Z.join(`
341
+ `))(cb)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore($,Z){for(let Q=0;Q<this.handlers.length;Q++){let Y=this.handlers[Q].constraints[Z];if(Y!==void 0){let J=$.get(Y)||0;J|=1<<Q,$.set(Y,J)}}}_constrainedIndexBitmask($){let Z=0;for(let Q=0;Q<this.handlers.length;Q++)if(this.handlers[Q].constraints[$]!==void 0)Z|=1<<Q;return~Z}_compileGetHandlerMatchingConstraints($){this.constrainedHandlerStores={};for(let Q of this.constraints){let X=$.newStoreForConstraint(Q);this.constrainedHandlerStores[Q]=X,this._buildConstraintStore(X,Q)}let Z=[];Z.push(`
342
+ let candidates = ${(1<<this.handlers.length)-1}
343
+ let mask, matches
344
+ `);for(let Q of this.constraints){Z.push(`
345
+ mask = ${this._constrainedIndexBitmask(Q)}
346
+ value = derivedConstraints.${Q}
347
+ `);let Y=$.strategies[Q].mustMatchWhenDerived?"matches":"(matches | mask)";Z.push(`
348
+ if (value === undefined) {
349
+ candidates &= mask
350
+ } else {
351
+ matches = this.constrainedHandlerStores.${Q}.get(value) || 0
352
+ candidates &= ${Y}
353
+ }
354
+ if (candidates === 0) return null;
355
+ `)}for(let Q in $.strategies){if(!Object.hasOwn($.strategies,Q))continue;if($.strategies[Q].mustMatchWhenDerived&&!this.constraints.includes(Q))Z.push(`if (derivedConstraints.${Q} !== undefined) return null`)}Z.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=Function("derivedConstraints",Z.join(`
356
+ `))}}P3.exports=R3});var b3=I((Au,E3)=>{var pb=C3(),mQ={STATIC:0,PARAMETRIC:1,WILDCARD:2};class vJ{constructor(){this.isLeafNode=!1,this.routes=null,this.handlerStorage=null}addRoute($,Z){if(this.routes===null)this.routes=[];if(this.handlerStorage===null)this.handlerStorage=new pb;this.isLeafNode=!0,this.routes.push($),this.handlerStorage.addHandler(Z,$)}}class yJ extends vJ{constructor(){super();this.staticChildren={}}findStaticMatchingChild($,Z){let Q=this.staticChildren[$.charAt(Z)];if(Q===void 0||!Q.matchPrefix($,Z))return null;return Q}getStaticChild($,Z=0){if($.length===Z)return this;let Q=this.findStaticMatchingChild($,Z);if(Q)return Q.getStaticChild($,Z+Q.prefix.length);return null}createStaticChild($){if($.length===0)return this;let Z=this.staticChildren[$.charAt(0)];if(Z){let X=1;for(;X<Z.prefix.length;X++)if($.charCodeAt(X)!==Z.prefix.charCodeAt(X)){Z=Z.split(this,X);break}return Z.createStaticChild($.slice(X))}let Q=$.charAt(0);return this.staticChildren[Q]=new lQ($),this.staticChildren[Q]}}class lQ extends yJ{constructor($){super();this.prefix=$,this.wildcardChild=null,this.parametricChildren=[],this.kind=mQ.STATIC,this._compilePrefixMatch()}getParametricChild($){let Z=$&&$.source,Q=this.parametricChildren.find((X)=>{return(X.regex&&X.regex.source)===Z});if(Q)return Q;return null}createParametricChild($,Z,Q){let X=this.getParametricChild($);if(X)return X.nodePaths.add(Q),X;return X=new gJ($,Z,Q),this.parametricChildren.push(X),this.parametricChildren.sort((Y,J)=>{if(!Y.isRegex)return 1;if(!J.isRegex)return-1;if(Y.staticSuffix===null)return 1;if(J.staticSuffix===null)return-1;if(J.staticSuffix.endsWith(Y.staticSuffix))return 1;if(Y.staticSuffix.endsWith(J.staticSuffix))return-1;return 0}),X}getWildcardChild(){return this.wildcardChild}createWildcardChild(){return this.wildcardChild=this.getWildcardChild()||new hJ,this.wildcardChild}split($,Z){let Q=this.prefix.slice(0,Z),X=this.prefix.slice(Z);this.prefix=X,this._compilePrefixMatch();let Y=new lQ(Q);return Y.staticChildren[X.charAt(0)]=this,$.staticChildren[Q.charAt(0)]=Y,Y}getNextNode($,Z,Q,X){let Y=this.findStaticMatchingChild($,Z),J=0;if(Y===null){if(this.parametricChildren.length===0)return this.wildcardChild;Y=this.parametricChildren[0],J=1}if(this.wildcardChild!==null)Q.push({paramsCount:X,brotherPathIndex:Z,brotherNode:this.wildcardChild});for(let W=this.parametricChildren.length-1;W>=J;W--)Q.push({paramsCount:X,brotherPathIndex:Z,brotherNode:this.parametricChildren[W]});return Y}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let $=[];for(let Z=1;Z<this.prefix.length;Z++){let Q=this.prefix.charCodeAt(Z);$.push(`path.charCodeAt(i + ${Z}) === ${Q}`)}this.matchPrefix=Function("path","i",`return ${$.join(" && ")}`)}}class gJ extends yJ{constructor($,Z,Q){super();this.isRegex=!!$,this.regex=$||null,this.staticSuffix=Z||null,this.kind=mQ.PARAMETRIC,this.nodePaths=new Set([Q])}getNextNode($,Z){return this.findStaticMatchingChild($,Z)}}class hJ extends vJ{constructor(){super();this.kind=mQ.WILDCARD}getNextNode(){return null}}E3.exports={StaticNode:lQ,ParametricNode:gJ,WildcardNode:hJ,NODE_TYPES:mQ}});var I3=I((Fu,_3)=>{var ib=u("assert");function x6(){if(!(this instanceof x6))return new x6;this.store=new Map,this.maxMajor=0,this.maxMinors={},this.maxPatches={}}x6.prototype.set=function($,Z){if(typeof $!=="string")throw TypeError("Version should be a string");let[Q,X,Y]=$.split(".",3);if(isNaN(Q))throw TypeError("Major version must be a numeric value");if(Q=Number(Q),X=Number(X)||0,Y=Number(Y)||0,Q>=this.maxMajor)this.maxMajor=Q,this.store.set("x",Z),this.store.set("*",Z),this.store.set("x.x",Z),this.store.set("x.x.x",Z);if(X>=(this.maxMinors[Q]||0))this.maxMinors[Q]=X,this.store.set(`${Q}.x`,Z),this.store.set(`${Q}.x.x`,Z);if(Y>=(this.maxPatches[`${Q}.${X}`]||0))this.maxPatches[`${Q}.${X}`]=Y,this.store.set(`${Q}.${X}.x`,Z);return this.store.set(`${Q}.${X}.${Y}`,Z),this};x6.prototype.get=function($){return this.store.get($)};_3.exports={name:"version",mustMatchWhenDerived:!0,storage:x6,validate($){ib(typeof $==="string","Version should be a string")}}});var x3=I((Nu,S3)=>{var nb=u("assert");function sb(){let $=new Map,Z=[];return{get:(Q)=>{let X=$.get(Q);if(X)return X;for(let Y of Z)if(Y.host.test(Q))return Y.value},set:(Q,X)=>{if(Q instanceof RegExp)Z.push({host:Q,value:X});else $.set(Q,X)}}}S3.exports={name:"host",mustMatchWhenDerived:!1,storage:sb,validate($){nb(typeof $==="string"||Object.prototype.toString.call($)==="[object RegExp]","Host should be a string or a RegExp")}}});var y3=I((Ou,v3)=>{var ab=I3(),ob=x3(),uJ=u("assert");class k3{constructor($){if(this.strategies={version:ab,host:ob},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,$)for(let Z of Object.values($))this.addConstraintStrategy(Z)}isStrategyUsed($){return this.strategiesInUse.has($)||this.asyncStrategiesInUse.has($)}hasConstraintStrategy($){let Z=this.strategies[$];if(Z!==void 0)return Z.isCustom||this.isStrategyUsed($);return!1}addConstraintStrategy($){if(uJ(typeof $.name==="string"&&$.name!=="","strategy.name is required."),uJ($.storage&&typeof $.storage==="function","strategy.storage function is required."),uJ($.deriveConstraint&&typeof $.deriveConstraint==="function","strategy.deriveConstraint function is required."),this.strategies[$.name]&&this.strategies[$.name].isCustom)throw Error(`There already exists a custom constraint with the name ${$.name}.`);if(this.isStrategyUsed($.name))throw Error(`There already exists a route with ${$.name} constraint.`);if($.isCustom=!0,$.isAsync=$.deriveConstraint.length===3,this.strategies[$.name]=$,$.mustMatchWhenDerived)this.noteUsage({[$.name]:$})}deriveConstraints($,Z,Q){let X=this.deriveSyncConstraints($,Z);if(Q===void 0)return X;this.deriveAsyncConstraints(X,$,Z,Q)}deriveSyncConstraints($,Z){return}noteUsage($){if($){let Z=this.strategiesInUse.size;for(let Q in $){if(!Object.hasOwn($,Q))continue;if(this.strategies[Q].isAsync)this.asyncStrategiesInUse.add(Q);else this.strategiesInUse.add(Q)}if(Z!==this.strategiesInUse.size)this._buildDeriveConstraints()}}newStoreForConstraint($){if(!this.strategies[$])throw Error(`No strategy registered for constraint key ${$}`);return this.strategies[$].storage()}validateConstraints($){for(let Z in $){if(!Object.hasOwn($,Z))continue;let Q=$[Z];if(typeof Q>"u")throw Error("Can't pass an undefined constraint value, must pass null or no key at all");let X=this.strategies[Z];if(!X)throw Error(`No strategy registered for constraint key ${Z}`);if(X.validate)X.validate(Q)}}deriveAsyncConstraints($,Z,Q,X){let Y=this.asyncStrategiesInUse.size;if(Y===0){X(null,$);return}$=$||{};for(let J of this.asyncStrategiesInUse)this.strategies[J].deriveConstraint(Z,Q,(G,K)=>{if(G!==null){X(G);return}if($[J]=K,--Y===0)X(null,$)})}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let $=["return {"];for(let Z of this.strategiesInUse){let Q=this.strategies[Z];if(!Q.isCustom)if(Z==="version")$.push(" version: req.headers['accept-version'],");else $.push(" host: req.headers.host || req.headers[':authority'],");else $.push(` ${Q.name}: this.strategies.${Z}.deriveConstraint(req, ctx),`)}$.push("}"),this.deriveSyncConstraints=Function("req","ctx",$.join(`
357
+ `)).bind(this)}}v3.exports=k3});var h3=I((ju,g3)=>{var rb=["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"];g3.exports=rb});var l3=I((Du,m3)=>{function u3($,Z){if($===50){if(Z===53)return"%";if(Z===51)return"#";if(Z===52)return"$";if(Z===54)return"&";if(Z===66)return"+";if(Z===98)return"+";if(Z===67)return",";if(Z===99)return",";if(Z===70)return"/";if(Z===102)return"/";return null}if($===51){if(Z===65)return":";if(Z===97)return":";if(Z===66)return";";if(Z===98)return";";if(Z===68)return"=";if(Z===100)return"=";if(Z===70)return"?";if(Z===102)return"?";return null}if($===52&&Z===48)return"@";return null}function tb($,Z){let Q=!1,X=!1,Y="";for(let W=1;W<$.length;W++){let G=$.charCodeAt(W);if(G===37){let K=$.charCodeAt(W+1),B=$.charCodeAt(W+2);if(u3(K,B)===null)Q=!0;else{if(X=!0,K===50&&B===53)Q=!0,$=$.slice(0,W+1)+"25"+$.slice(W+1),W+=2;W+=2}}else if(G===63||G===35||G===59&&Z){Y=$.slice(W+1),$=$.slice(0,W);break}}return{path:Q?decodeURI($):$,querystring:Y,shouldDecodeParam:X}}function eb($){let Z=$.indexOf("%");if(Z===-1)return $;let Q="",X=Z;for(let Y=Z;Y<$.length;Y++)if($.charCodeAt(Y)===37){let J=$.charCodeAt(Y+1),W=$.charCodeAt(Y+2),G=u3(J,W);Q+=$.slice(X,Y)+G,X=Y+3}return $.slice(0,Z)+Q+$.slice(X)}m3.exports={safeDecodeURI:tb,safeDecodeURIComponent:eb}});var dJ=I((Tu,t3)=>{var g0=u("assert"),$_=mw(),E8=V3(),cJ=F3(),{prettyPrintTree:Z_}=T3(),{StaticNode:c3,NODE_TYPES:d3}=b3(),Q_=y3(),C8=h3(),mJ=hQ(),{safeDecodeURI:p3,safeDecodeURIComponent:lJ}=l3(),i3=/^https?:\/\/.*?\//,c$=/(\/:[^/()]*?)\?(\/?)/,n3=/[.*+?^${}()|[\]\\]/g,s3=/\/\/+/g;if(!E8(i3))throw Error("the FULL_PATH_REGEXP is not safe, update this module");if(!E8(c$))throw Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!E8(n3))throw Error("the ESCAPE_REGEXP is not safe, update this module");if(!E8(s3))throw Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function C0($){if(!(this instanceof C0))return new C0($);if($=$||{},this._opts=$,$.defaultRoute)g0(typeof $.defaultRoute==="function","The default route must be a function"),this.defaultRoute=$.defaultRoute;else this.defaultRoute=null;if($.onBadUrl)g0(typeof $.onBadUrl==="function","The bad url handler must be a function"),this.onBadUrl=$.onBadUrl;else this.onBadUrl=null;if($.buildPrettyMeta)g0(typeof $.buildPrettyMeta==="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=$.buildPrettyMeta;else this.buildPrettyMeta=X_;if($.querystringParser)g0(typeof $.querystringParser==="function","querystringParser must be a function"),this.querystringParser=$.querystringParser;else this.querystringParser=(Z)=>Z.length===0?{}:$_.parse(Z);this.caseSensitive=$.caseSensitive===void 0?!0:$.caseSensitive,this.ignoreTrailingSlash=$.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=$.ignoreDuplicateSlashes||!1,this.maxParamLength=$.maxParamLength||100,this.allowUnsafeRegex=$.allowUnsafeRegex||!1,this.constrainer=new Q_($.constraints),this.useSemicolonDelimiter=$.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}C0.prototype.on=function(Z,Q,X,Y,J){if(typeof X==="function"){if(Y!==void 0)J=Y;Y=X,X={}}g0(typeof Q==="string","Path should be a string"),g0(Q.length>0,"The path could not be empty"),g0(Q[0]==="/"||Q[0]==="*","The first character of a path should be `/` or `*`"),g0(typeof Y==="function","Handler should be a function");let W=Q.match(c$);if(W){g0(Q.length===W.index+W[0].length,"Optional Parameter needs to be the last parameter of the path");let B=Q.replace(c$,"$1$2"),U=Q.replace(c$,"$2")||"/";this.on(Z,B,X,Y,J),this.on(Z,U,X,Y,J);return}let G=Q;if(this.ignoreDuplicateSlashes)Q=cQ(Q);if(this.ignoreTrailingSlash)Q=dQ(Q);let K=Array.isArray(Z)?Z:[Z];for(let B of K)g0(typeof B==="string","Method should be a string"),g0(C8.includes(B),`Method '${B}' is not an http method.`),this._on(B,Q,X,Y,J,G)};C0.prototype._on=function(Z,Q,X,Y,J){let W={};if(X.constraints!==void 0){if(g0(typeof X.constraints==="object"&&X.constraints!==null,"Constraints should be an object"),Object.keys(X.constraints).length!==0)W=X.constraints}if(this.constrainer.validateConstraints(W),this.constrainer.noteUsage(W),this.trees[Z]===void 0)this.trees[Z]=new c3("/");let G=Q;if(G==="*"&&this.trees[Z].prefix.length!==0){let H=this.trees[Z];this.trees[Z]=new c3(""),this.trees[Z].staticChildren["/"]=H}let K=this.trees[Z],B=K.prefix.length,U=[];for(let H=0;H<=G.length;H++){if(G.charCodeAt(H)===58&&G.charCodeAt(H+1)===58){H++;continue}let V=G.charCodeAt(H)===58&&G.charCodeAt(H+1)!==58,z=G.charCodeAt(H)===42;if(V||z||H===G.length&&H!==B){let N=G.slice(B,H);if(!this.caseSensitive)N=N.toLowerCase();N=N.replaceAll("::",":"),N=N.replaceAll("%","%25"),K=K.createStaticChild(N)}if(V){let N=!1,F=!0,O="",j=[],M=H+1;for(let A=M;;A++){let D=G.charCodeAt(A),f=D===40,R=D===45||D===46,T=D===47||A===G.length;if(f||R||T){let b=G.slice(M,A);if(U.push(b),N=N||f||R,f){let y=r3(G,A),v=G.slice(A,y+1);if(!this.allowUnsafeRegex)g0(E8(new RegExp(v)),`The regex '${v}' is not safe!`);j.push(o3(v)),A=y+1,F=!0}else j.push(F?"(.*?)":`(${O}|(?:(?!${O}).)*)`),F=!1;let q=A;for(;A<G.length;A++){let y=G.charCodeAt(A);if(y===47)break;if(y===58)if(G.charCodeAt(A+1)===58)A++;else break}let S=G.slice(q,A);if(S)S=S.replaceAll("::",":"),S=S.replaceAll("%","%25"),j.push(O=a3(S));if(M=A+1,T||G.charCodeAt(A)===47||A===G.length){let y=N?"()"+S:S,v=G.slice(H,A);G=G.slice(0,H+1)+y+G.slice(A),H+=y.length;let n=N?new RegExp("^"+j.join("")+"$"):null;K=K.createParametricChild(n,S||null,v),B=H+1;break}}}}else if(z){if(U.push("*"),K=K.createWildcardChild(),B=H+1,H!==G.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)G=G.toLowerCase();if(G==="*")G="/*";for(let H of this.routes){let V=H.opts.constraints||{};if(H.method===Z&&H.pattern===G&&cJ(V,W))throw Error(`Method '${Z}' already declared for route '${G}' with constraints '${JSON.stringify(W)}'`)}let w={method:Z,path:Q,pattern:G,params:U,opts:X,handler:Y,store:J};this.routes.push(w),K.addRoute(w,this.constrainer)};C0.prototype.hasRoute=function(Z,Q,X){return this.findRoute(Z,Q,X)!==null};C0.prototype.findRoute=function(Z,Q,X={}){if(this.trees[Z]===void 0)return null;let Y=Q,J=this.trees[Z],W=J.prefix.length,G=[];for(let K=0;K<=Y.length;K++){if(Y.charCodeAt(K)===58&&Y.charCodeAt(K+1)===58){K++;continue}let B=Y.charCodeAt(K)===58&&Y.charCodeAt(K+1)!==58,U=Y.charCodeAt(K)===42;if(B||U||K===Y.length&&K!==W){let w=Y.slice(W,K);if(!this.caseSensitive)w=w.toLowerCase();if(w=w.replaceAll("::",":"),w=w.replaceAll("%","%25"),J=J.getStaticChild(w),J===null)return null}if(B){let w=!1,H=!0,V="",z=[],N=K+1;for(let F=N;;F++){let O=Y.charCodeAt(F),j=O===40,M=O===45||O===46,A=O===47||F===Y.length;if(j||M||A){let D=Y.slice(N,F);if(G.push(D),w=w||j||M,j){let T=r3(Y,F),b=Y.slice(F,T+1);if(!this.allowUnsafeRegex)g0(E8(new RegExp(b)),`The regex '${b}' is not safe!`);z.push(o3(b)),F=T+1,H=!1}else z.push(H?"(.*?)":`(${V}|(?:(?!${V}).)*)`),H=!1;let f=F;for(;F<Y.length;F++){let T=Y.charCodeAt(F);if(T===47)break;if(T===58)if(Y.charCodeAt(F+1)===58)F++;else break}let R=Y.slice(f,F);if(R)R=R.replaceAll("::",":"),R=R.replaceAll("%","%25"),z.push(V=a3(R));if(N=F+1,A||Y.charCodeAt(F)===47||F===Y.length){let T=w?"()"+R:R,b=Y.slice(K,F);Y=Y.slice(0,K+1)+T+Y.slice(F),K+=T.length;let q=w?new RegExp("^"+z.join("")+"$"):null;if(J=J.getParametricChild(q,R||null,b),J===null)return null;W=K+1;break}}}}else if(U){if(G.push("*"),J=J.getWildcardChild(),W=K+1,K!==Y.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)Y=Y.toLowerCase();for(let K of this.routes){let B=K.opts.constraints||{};if(K.method===Z&&K.pattern===Y&&cJ(B,X))return{handler:K.handler,store:K.store,params:K.params}}return null};C0.prototype.hasConstraintStrategy=function($){return this.constrainer.hasConstraintStrategy($)};C0.prototype.addConstraintStrategy=function($){this.constrainer.addConstraintStrategy($),this._rebuild(this.routes)};C0.prototype.reset=function(){this.trees={},this.routes=[]};C0.prototype.off=function(Z,Q,X){g0(typeof Q==="string","Path should be a string"),g0(Q.length>0,"The path could not be empty"),g0(Q[0]==="/"||Q[0]==="*","The first character of a path should be `/` or `*`"),g0(typeof X>"u"||typeof X==="object"&&!Array.isArray(X)&&X!==null,"Constraints should be an object or undefined.");let Y=Q.match(c$);if(Y){g0(Q.length===Y.index+Y[0].length,"Optional Parameter needs to be the last parameter of the path");let W=Q.replace(c$,"$1$2"),G=Q.replace(c$,"$2");this.off(Z,W,X),this.off(Z,G,X);return}if(this.ignoreDuplicateSlashes)Q=cQ(Q);if(this.ignoreTrailingSlash)Q=dQ(Q);let J=Array.isArray(Z)?Z:[Z];for(let W of J)this._off(W,Q,X)};C0.prototype._off=function(Z,Q,X){g0(typeof Z==="string","Method should be a string"),g0(C8.includes(Z),`Method '${Z}' is not an http method.`);function Y(K){return Z!==K.method||Q!==K.path}function J(K){return Y(K)||!cJ(X,K.opts.constraints||{})}let W=X?J:Y,G=this.routes.filter(W);this._rebuild(G)};C0.prototype.lookup=function(Z,Q,X,Y){if(typeof X==="function")Y=X,X=void 0;if(Y===void 0){let J=this.constrainer.deriveConstraints(Z,X),W=this.find(Z.method,Z.url,J);return this.callHandler(W,Z,Q,X)}this.constrainer.deriveConstraints(Z,X,(J,W)=>{if(J!==null){Y(J);return}try{let G=this.find(Z.method,Z.url,W),K=this.callHandler(G,Z,Q,X);Y(null,K)}catch(G){Y(G)}})};C0.prototype.callHandler=function(Z,Q,X,Y){if(Z===null)return this._defaultRoute(Q,X,Y);return Y===void 0?Z.handler(Q,X,Z.params,Z.store,Z.searchParams):Z.handler.call(Y,Q,X,Z.params,Z.store,Z.searchParams)};C0.prototype.find=function(Z,Q,X){let Y=this.trees[Z];if(Y===void 0)return null;if(Q.charCodeAt(0)!==47)Q=Q.replace(i3,"/");if(this.ignoreDuplicateSlashes)Q=cQ(Q);let J,W,G;try{J=p3(Q,this.useSemicolonDelimiter),Q=J.path,W=J.querystring,G=J.shouldDecodeParam}catch(z){return this._onBadUrl(Q)}if(this.ignoreTrailingSlash)Q=dQ(Q);let K=Q;if(this.caseSensitive===!1)Q=Q.toLowerCase();let B=this.maxParamLength,U=Y.prefix.length,w=[],H=Q.length,V=[];while(!0){if(U===H&&Y.isLeafNode){let O=Y.handlerStorage.getMatchingHandler(X);if(O!==null)return{handler:O.handler,store:O.store,params:O._createParamsObject(w),searchParams:this.querystringParser(W)}}let z=Y.getNextNode(Q,U,V,w.length);if(z===null){if(V.length===0)return null;let O=V.pop();U=O.brotherPathIndex,w.splice(O.paramsCount),z=O.brotherNode}if(Y=z,Y.kind===d3.STATIC){U+=Y.prefix.length;continue}if(Y.kind===d3.WILDCARD){let O=K.slice(U);if(G)O=lJ(O);w.push(O),U=H;continue}let N=K.indexOf("/",U);if(N===-1)N=H;let F=K.slice(U,N);if(G)F=lJ(F);if(Y.isRegex){let O=Y.regex.exec(F);if(O===null)continue;for(let j=1;j<O.length;j++){let M=O[j];if(M.length>B)return null;w.push(M)}}else{if(F.length>B)return null;w.push(F)}U=N}};C0.prototype._rebuild=function($){this.reset();for(let Z of $){let{method:Q,path:X,opts:Y,handler:J,store:W}=Z;this._on(Q,X,Y,J,W)}};C0.prototype._defaultRoute=function($,Z,Q){if(this.defaultRoute!==null)return Q===void 0?this.defaultRoute($,Z):this.defaultRoute.call(Q,$,Z);else Z.statusCode=404,Z.end()};C0.prototype._onBadUrl=function($){if(this.onBadUrl===null)return null;let Z=this.onBadUrl;return{handler:(Q,X,Y)=>Z($,Q,X),params:{},store:null}};C0.prototype.prettyPrint=function($={}){let Z=$.method;$.buildPrettyMeta=this.buildPrettyMeta.bind(this);let Q=null;if(Z===void 0){let{version:X,host:Y,...J}=this.constrainer.strategies;J[mJ.name]=mJ;let W=new C0({...this._opts,constraints:J}),G=this.routes.map((K)=>{let B={...K.opts.constraints,[mJ.name]:K.method};return{...K,method:"MERGED",opts:{constraints:B}}});W._rebuild(G),Q=W.trees.MERGED}else Q=this.trees[Z];if(Q==null)return"(empty tree)";return Z_(Q,$)};for(let $ in C8){if(!C8.hasOwnProperty($))continue;let Z=C8[$],Q=Z.toLowerCase();C0.prototype[Q]=function(X,Y,J){return this.on(Z,X,Y,J)}}C0.prototype.all=function($,Z,Q){this.on(C8,$,Z,Q)};C0.sanitizeUrlPath=function(Z,Q){let X=p3(Z,Q);if(X.shouldDecodeParam)return lJ(X.path);return X.path};C0.removeDuplicateSlashes=cQ;C0.trimLastSlash=dQ;t3.exports=C0;function a3($){return $.replace(n3,"\\$&")}function cQ($){return $.indexOf("//")!==-1?$.replace(s3,"/"):$}function dQ($){if($.length>1&&$.charCodeAt($.length-1)===47)return $.slice(0,-1);return $}function o3($){if($.charCodeAt(1)===94)$=$.slice(0,1)+$.slice(2);if($.charCodeAt($.length-2)===36)$=$.slice(0,$.length-2)+$.slice($.length-1);return $}function r3($,Z){let Q=1;while(Z<$.length){if(Z++,$.charCodeAt(Z)===92){Z++;continue}if($.charCodeAt(Z)===41)Q--;else if($.charCodeAt(Z)===40)Q++;if(!Q)return Z}throw TypeError('Invalid regexp expression in "'+$+'"')}function X_($){if(!$)return{};if(!$.store)return{};return Object.assign({},$.store)}});var $V=I((qu,e3)=>{function pJ($,Z,Q,X){if(Q===void 0){Z.header("content-length","0"),X(null,null);return}if(typeof Q.resume==="function"){Q.on("error",(J)=>{Z.log.error({err:J},"Error on Stream found for HEAD route")}),Q.resume(),X(null,null);return}if(typeof Q.getReader==="function"){Q.cancel("Stream cancelled by HEAD route").catch((J)=>{Z.log.error({err:J},"Error on Stream found for HEAD route")}),X(null,null);return}let Y=""+Buffer.byteLength(Q);Z.header("content-length",Y),X(null,null)}function Y_($){if($==null)return pJ;return Array.isArray($)?[...$,pJ]:[$,pJ]}e3.exports={parseHeadOnSendHandlers:Y_}});var jV=I((fu,OV)=>{var J_=dJ(),W_=UQ(),ZV=HX(),{onRequestAbortHookRunner:G_,lifecycleHooks:QV,preParsingHookRunner:K_,onTimeoutHookRunner:B_,onRequestHookRunner:U_}=w$(),{normalizeSchema:z_}=K6(),{parseHeadOnSendHandlers:w_}=$V(),{compileSchemasForValidation:V_,compileSchemasForSerialization:H_}=UX(),{FST_ERR_SCH_VALIDATION_BUILD:M_,FST_ERR_SCH_SERIALIZATION_BUILD:A_,FST_ERR_DUPLICATED_ROUTE:F_,FST_ERR_INVALID_URL:N_,FST_ERR_HOOK_INVALID_HANDLER:XV,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:O_,FST_ERR_ROUTE_DUPLICATED_HANDLER:j_,FST_ERR_ROUTE_HANDLER_NOT_FN:YV,FST_ERR_ROUTE_MISSING_HANDLER:D_,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:T_,FST_ERR_ROUTE_METHOD_INVALID:q_,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:f_,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:L_,FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:R_,FST_ERR_HANDLER_TIMEOUT:P_,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:iJ}=d0(),{kRoutePrefix:C_,kSupportedHTTPMethods:aJ,kLogLevel:E_,kLogSerializers:JV,kHooks:WV,kSchemaController:b_,kOptions:GV,kReplySerializerDefault:nJ,kReplyIsError:FV,kRequestPayloadStream:__,kDisableRequestLogging:KV,kSchemaErrorFormatter:I_,kErrorHandler:BV,kHasBeenDecorated:UV,kRequestAcceptVersion:sJ,kRouteByFastify:S_,kRouteContext:zV,kRequestSignal:x_,kTimeoutTimer:wV,kOnAbort:k_}=u0(),{buildErrorHandler:v_}=B6(),{createChildLogger:y_}=G6(),{getGenReqId:g_}=CQ(),{FSTDEP022:h_}=G8(),VV=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function u_($){let Z=J_($),Q,X,Y,J,W,G,K,B,U,w,H,V,z,N=!1;return{setup(T,b){if(Q=b.avvio,X=b.fourOhFour,Y=T.logger,J=b.hasLogger,W=b.setupResponseListeners,G=b.throwIfAlreadyStarted,V=T.exposeHeadRoutes,K=T.disableRequestLogging,typeof K==="function")B=T.disableRequestLogging;U=T.routerOptions.ignoreTrailingSlash,w=T.routerOptions.ignoreDuplicateSlashes,H=Object.hasOwn(T,"return503OnClosing")?T.return503OnClosing:!0,z=b.keepAliveConnections},routing:Z.lookup.bind(Z),route:f,hasRoute:A,prepareRoute:M,routeHandler:R,closeRoutes:()=>{N=!0},printRoutes:Z.prettyPrint.bind(Z),addConstraintStrategy:F,hasConstraintStrategy:O,isAsyncConstraint:j,findRoute:D};function F(T){return G("Cannot add constraint strategy!"),Z.addConstraintStrategy(T)}function O(T){return Z.hasConstraintStrategy(T)}function j(){return Z.constrainer.asyncStrategiesInUse.size>0}function M({method:T,url:b,options:q,handler:S,isFastify:y}){if(typeof b!=="string")throw new N_(typeof b);if(!S&&typeof q==="function")S=q,q={};else if(S&&typeof S==="function"){if(Object.prototype.toString.call(q)!=="[object Object]")throw new O_(T,b);else if(q.handler)if(typeof q.handler==="function")throw new j_(T,b);else throw new YV(T,b)}return q=Object.assign({},q,{method:T,url:b,path:b,handler:S||q&&q.handler}),f.call(this,{options:q,isFastify:y})}function A({options:T}){let b=T.method?.toUpperCase()??"";return Z.hasRoute(b,T.url||"",T.constraints)}function D(T){let b=Z.find(T.method,T.url||"",T.constraints);if(b)return{handler:b.handler,params:b.params,searchParams:b.searchParams};else return null}function f({options:T,isFastify:b}){G("Cannot add route!");let q={...T},S=q.url||q.path||"";if(!q.handler)throw new D_(q.method,S);if(q.errorHandler!==void 0&&typeof q.errorHandler!=="function")throw new YV(q.method,S);NV(q.bodyLimit),c_(q.handlerTimeout);let y=q.exposeHeadRoute??V,v=!1,n=!1;if(Array.isArray(q.method))for(let r=0;r<q.method.length;++r)q.method[r]=HV.call(this,q.method[r]),MV.call(this,q.method[r],S,q.schema),v=q.method.includes("GET"),n=q.method.includes("HEAD");else q.method=HV.call(this,q.method),MV.call(this,q.method,S,q.schema),v=q.method==="GET",n=q.method==="HEAD";let s=y&&v?{...T}:null,a=this[C_];if(S==="/"&&a.length>0&&q.method!=="HEAD")switch(q.prefixTrailingSlash){case"slash":p.call(this,{path:S,isFastify:b});break;case"no-slash":p.call(this,{path:"",isFastify:b});break;case"both":default:if(p.call(this,{path:"",isFastify:b}),U!==!0&&(w!==!0||!a.endsWith("/")))p.call(this,{path:S,prefixing:!0,isFastify:b})}else if(S[0]==="/"&&a.endsWith("/"))p.call(this,{path:S.slice(1),isFastify:b});else p.call(this,{path:S,isFastify:b});return this;function p({path:r,prefixing:X0=!1,isFastify:Y0=!1}){let B0=a+r;if(q.url=B0,q.path=B0,q.routePath=r,q.prefix=a,q.logLevel=q.logLevel||this[E_],this[JV]||q.logSerializers)q.logSerializers=Object.assign(Object.create(this[JV]),q.logSerializers);if(q.attachValidation==null)q.attachValidation=!1;if(X0===!1)for(let P of this[WV].onRoute)P.call(this,q);for(let P of QV)if(q&&P in q){if(Array.isArray(q[P]))for(let _ of q[P]){if(typeof _!=="function")throw new XV(P,Object.prototype.toString.call(_));if(P==="onSend"||P==="preSerialization"||P==="onError"||P==="preParsing"){if(_.constructor.name==="AsyncFunction"&&_.length===4)throw new iJ}else if(P==="onRequestAbort"){if(_.constructor.name==="AsyncFunction"&&_.length!==1)throw new iJ}else if(_.constructor.name==="AsyncFunction"&&_.length===3)throw new iJ}else if(q[P]!==void 0&&typeof q[P]!=="function")throw new XV(P,Object.prototype.toString.call(q[P]))}let t=q.constraints||{},C={...q.config,url:B0,method:q.method},E=new W_({schema:q.schema,handler:q.handler.bind(this),config:C,errorHandler:q.errorHandler,childLoggerFactory:q.childLoggerFactory,bodyLimit:q.bodyLimit,logLevel:q.logLevel,logSerializers:q.logSerializers,attachValidation:q.attachValidation,schemaErrorFormatter:q.schemaErrorFormatter,replySerializer:this[nJ],validatorCompiler:q.validatorCompiler,serializerCompiler:q.serializerCompiler,exposeHeadRoute:y,prefixTrailingSlash:q.prefixTrailingSlash||"both",server:this,isFastify:Y0,handlerTimeout:q.handlerTimeout}),L=Z.findRoute("HEAD",q.url,t)!==null;try{Z.on(q.method,q.url,{constraints:t},R,E)}catch(P){if(!E[S_]){if(P.message.includes(`Method '${q.method}' already declared for route`))throw new F_(q.method,q.url);throw P}}if(this.after((P,_)=>{E.errorHandler=q.errorHandler?v_(this[BV],q.errorHandler):this[BV],E._parserOptions.limit=q.bodyLimit||null,E.logLevel=q.logLevel,E.logSerializers=q.logSerializers,E.attachValidation=q.attachValidation,E[nJ]=this[nJ],E.schemaErrorFormatter=q.schemaErrorFormatter||this[I_]||E.schemaErrorFormatter,Q.once("preReady",()=>{for(let x of QV){let l=this[WV][x].concat(q[x]||[]).map((m)=>m.bind(this));E[x]=l.length?l:null}while(!E.Request[UV]&&E.Request.parent)E.Request=E.Request.parent;while(!E.Reply[UV]&&E.Reply.parent)E.Reply=E.Reply.parent;if(X.setContext(this,E),q.schema){E.schema=z_(E.schema,this.initialConfig);let x=this[b_],l=q.schema.body||q.schema.headers||q.schema.querystring||q.schema.params;if(!q.validatorCompiler&&l)x.setupValidator(this[GV]);try{let m=typeof q?.validatorCompiler==="function"||x.isCustomValidatorCompiler;V_(E,q.validatorCompiler||x.validatorCompiler,m)}catch(m){throw new M_(q.method,B0,m.message)}if(q.schema.response&&!q.serializerCompiler)x.setupSerializer(this[GV]);try{H_(E,q.serializerCompiler||x.serializerCompiler)}catch(m){throw new A_(q.method,B0,m.message)}}}),_(P)}),y&&v&&!n&&!L){let P=w_(s.onSend);M.call(this,{method:"HEAD",url:r,options:{...s,onSend:P},isFastify:!0})}}}function R(T,b,q,S,y){let v=g_(S.server,T),n={level:S.logLevel};if(S.logSerializers)n.serializers=S.logSerializers;let s=y_(S,Y,T,v,n);if(s[KV]=B?!1:K,N===!0){if(T.httpVersionMajor!==2)b.setHeader("Connection","close");if(H){let B0={"Content-Type":"application/json","Content-Length":"80"};b.writeHead(503,B0),b.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),s.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}}if(String.prototype.toLowerCase.call(T.headers.connection||"")==="keep-alive"){if(z.has(T.socket)===!1)z.add(T.socket),T.socket.on("close",p_.bind({keepAliveConnections:z,socket:T.socket}))}if(T.headers[sJ]!==void 0)T.headers["accept-version"]=T.headers[sJ],T.headers[sJ]=void 0;let p=new S.Request(v,q,T,y,s,S),r=new S.Reply(b,p,s),X0=B?B(p):K;if(s[KV]=X0,X0===!1)s.info({req:p},"incoming request");let Y0=S.handlerTimeout;if(Y0>0){let B0=new AbortController;p[x_]=B0,p[wV]=setTimeout(()=>{if(!r.sent){let C=new P_(Y0,S.config?.url);B0.abort(C),r[FV]=!0,r.send(C)}},Y0);let t=()=>{if(!B0.signal.aborted)B0.abort();clearTimeout(p[wV])};T.on("close",t),p[k_]=t}if(J===!0||S.onResponse!==null||Y0>0)W(r);if(S.onRequest!==null)U_(S.onRequest,p,r,AV);else AV(null,p,r);if(S.onRequestAbort!==null)T.on("close",()=>{if(T.aborted)G_(S.onRequestAbort,p,m_.bind(null,r))});if(S.onTimeout!==null){if(!p.raw.socket._meta)p.raw.socket.on("timeout",l_);p.raw.socket._meta={context:S,request:p,reply:r}}}}function m_($,Z){if(Z)$.log.error({err:Z},"onRequestAborted hook failed")}function l_(){let{context:$,request:Z,reply:Q}=this._meta;B_($.onTimeout,Z,Q,i_)}function HV($){if(typeof $!=="string")throw new q_;if($=$.toUpperCase(),!this[aJ].bodyless.has($)&&!this[aJ].bodywith.has($))throw new T_($);return $}function MV($,Z,Q){if(this[aJ].bodyless.has($)&&Q?.body)throw new f_($,Z)}function NV($){if($===void 0)return;if(!Number.isInteger($)||$<=0)throw new L_($)}function c_($){if($===void 0)return;if(!Number.isInteger($)||$<=0)throw new R_($)}function AV($,Z,Q){if(Q.sent===!0)return;if($!=null){Q[FV]=!0,Q.send($);return}if(Z[__]=Z.raw,Z[zV].preParsing!==null)K_(Z[zV].preParsing,Z,Q,ZV.bind(Z.server));else ZV.call(Z.server,null,Z,Q)}function d_($,Z){let Q=$.routerOptions==null?Object.create(null):Object.assign(Object.create(null),$.routerOptions),X=VV.filter((Y)=>Object.hasOwn($,Y));if(X.length>0)h_(X.join(", "));for(let Y of VV)if(!Object.hasOwn(Q,Y))Q[Y]=$[Y]??Z[Y];return Q}function p_(){this.keepAliveConnections.delete(this.socket)}function i_(){}OV.exports={buildRouting:u_,validateBodyLimitOption:NV,buildRouterOptions:d_}});var PV=I((Lu,RV)=>{var n_=dJ(),DV=XQ(),TV=BQ(),s_=UQ(),{kRoutePrefix:a_,kCanSetNotFoundHandler:k6,kFourOhFourLevelInstance:v6,kFourOhFourContext:i1,kHooks:o_,kErrorHandler:qV}=u0(),{lifecycleHooks:r_}=w$(),{buildErrorHandler:t_}=B6(),{FST_ERR_NOT_FOUND:e_}=d0(),{createChildLogger:fV}=G6(),{getGenReqId:LV}=CQ();function $I($){let{logger:Z,disableRequestLogging:Q}=$,X=n_({onBadUrl:G(),defaultRoute:w}),Y=null;return{router:X,setNotFoundHandler:B,setContext:K,arrange404:J};function J(H){H[v6]=H,H[k6]=!0,X.onBadUrl=X.onBadUrl.bind(H),X.defaultRoute=X.defaultRoute.bind(H)}function W(H,V){let{url:z,method:N}=H.raw,F=`Route ${N}:${z} not found`;if(!(typeof Q==="function"?Q(H.raw):Q))H.log.info(F);V.code(404).send({message:F,error:"Not Found",statusCode:404})}function G(){return function(V,z,N){let F=this[v6][i1],O=LV(F.server,z),j=fV(F,Z,z,O),M=new TV(O,null,z,null,j,F),A=new DV(N,M,j);Y(M,A)}}function K(H,V){let z=Object.assign({},H[i1]);z.onSend=V.onSend,V[i1]=z}function B(H,V,z,N){if(this[k6]===void 0)this[k6]=!0;if(this[i1]===void 0)this[i1]=null;let F=this,O=this[a_]||"/";if(this[k6]===!1)throw Error(`Not found handler already set for Fastify instance with prefix: '${O}'`);if(typeof H==="object"){if(H.preHandler)if(Array.isArray(H.preHandler))H.preHandler=H.preHandler.map((j)=>j.bind(F));else H.preHandler=H.preHandler.bind(F);if(H.preValidation)if(Array.isArray(H.preValidation))H.preValidation=H.preValidation.map((j)=>j.bind(F));else H.preValidation=H.preValidation.bind(F)}if(typeof H==="function")V=H,H=void 0;if(H=H||{},V)this[v6][k6]=!1,V=V.bind(this),Y=V;else V=W,Y=W;this.after((j,M)=>{U.call(this,O,H,V,z,N),M(j)})}function U(H,V,z,N,F){let O=new s_({schema:V.schema,handler:z,config:V.config||{},server:this});if(N.once("preReady",()=>{let j=this[i1];for(let M of r_){let A=this[o_][M].concat(V[M]||[]).map((D)=>D.bind(this));j[M]=A.length?A:null}j.errorHandler=V.errorHandler?t_(this[qV],V.errorHandler):this[qV]}),this[i1]!==null&&H==="/"){Object.assign(this[i1],O);return}this[v6][i1]=O,X.all(H+(H.endsWith("/")?"*":"/*"),F,O),X.all(H,F,O)}function w(H,V){let z=this[v6][i1],N=LV(z.server,H),F=fV(z,Z,H,N);F.info({req:H},"incoming request");let O=new TV(N,null,H,null,F,z),j=new DV(V,O,F);O.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),O.log.warn(X.prettyPrint()),j.code(404).send(new e_)}}RV.exports=$I});var CV=I((Ru,pQ)=>{pQ.exports=M0;pQ.exports.default=M0;var ZI={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72000},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},handlerTimeout:{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:72000},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:{}}}}}},QI=Object.prototype.hasOwnProperty,XI=new RegExp("idle","u");function M0($,{instancePath:Z="",parentData:Q,parentDataProperty:X,rootData:Y=$}={}){let J=null,W=0;if(W===0)if($&&typeof $=="object"&&!Array.isArray($)){if($.connectionTimeout===void 0)$.connectionTimeout=0;if($.keepAliveTimeout===void 0)$.keepAliveTimeout=72000;if($.maxRequestsPerSocket===void 0)$.maxRequestsPerSocket=0;if($.requestTimeout===void 0)$.requestTimeout=0;if($.handlerTimeout===void 0)$.handlerTimeout=0;if($.bodyLimit===void 0)$.bodyLimit=1048576;if($.caseSensitive===void 0)$.caseSensitive=!0;if($.allowUnsafeRegex===void 0)$.allowUnsafeRegex=!1;if($.ignoreTrailingSlash===void 0)$.ignoreTrailingSlash=!1;if($.ignoreDuplicateSlashes===void 0)$.ignoreDuplicateSlashes=!1;if($.disableRequestLogging===void 0)$.disableRequestLogging=!1;if($.maxParamLength===void 0)$.maxParamLength=100;if($.onProtoPoisoning===void 0)$.onProtoPoisoning="error";if($.onConstructorPoisoning===void 0)$.onConstructorPoisoning="error";if($.pluginTimeout===void 0)$.pluginTimeout=1e4;if($.requestIdHeader===void 0)$.requestIdHeader=!1;if($.requestIdLogLabel===void 0)$.requestIdLogLabel="reqId";if($.http2SessionTimeout===void 0)$.http2SessionTimeout=72000;if($.exposeHeadRoutes===void 0)$.exposeHeadRoutes=!0;if($.useSemicolonDelimiter===void 0)$.useSemicolonDelimiter=!1;let N=W;for(let F in $)if(!QI.call(ZI.properties,F))delete $[F];if(N===W){let F=$.connectionTimeout,O=W;if(!(typeof F=="number"&&(!(F%1)&&!isNaN(F))&&isFinite(F))){let j=typeof F,M=void 0;if(M===void 0)if(j==="boolean"||F===null||j==="string"&&F&&F==+F&&!(F%1))M=+F;else return M0.errors=[{instancePath:Z+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(M!==void 0){if(F=M,$!==void 0)$.connectionTimeout=M}}var G=O===W;if(G){let j=$.keepAliveTimeout,M=W;if(!(typeof j=="number"&&(!(j%1)&&!isNaN(j))&&isFinite(j))){let D=typeof j,f=void 0;if(f===void 0)if(D==="boolean"||j===null||D==="string"&&j&&j==+j&&!(j%1))f=+j;else return M0.errors=[{instancePath:Z+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(f!==void 0){if(j=f,$!==void 0)$.keepAliveTimeout=f}}var G=M===W;if(G){if($.forceCloseConnections!==void 0){let D=$.forceCloseConnections,f=W,R=W,T=!1,b=null,q=W;if(typeof D!=="string"){let v=typeof D,n=void 0;if(n===void 0)if(v=="number"||v=="boolean")n=""+D;else if(D===null)n="";else{let s={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[s];else J.push(s);W++}if(n!==void 0){if(D=n,$!==void 0)$.forceCloseConnections=n}}if(W===q){if(typeof D==="string"){if(!XI.test(D)){let v={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};if(J===null)J=[v];else J.push(v);W++}}}var K=q===W;if(K)T=!0,b=0;let S=W;if(typeof D!=="boolean"){let v=void 0;if(v===void 0)if(D==="false"||D===0||D===null)v=!1;else if(D==="true"||D===1)v=!0;else{let n={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};if(J===null)J=[n];else J.push(n);W++}if(v!==void 0){if(D=v,$!==void 0)$.forceCloseConnections=v}}var K=S===W;if(K&&T)T=!1,b=[b,1];else if(K)T=!0,b=1;if(!T){let v={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:b},message:"must match exactly one schema in oneOf"};if(J===null)J=[v];else J.push(v);return W++,M0.errors=J,!1}else if(W=R,J!==null)if(R)J.length=R;else J=null;var G=f===W}else var G=!0;if(G){let D=$.maxRequestsPerSocket,f=W;if(!(typeof D=="number"&&(!(D%1)&&!isNaN(D))&&isFinite(D))&&D!==null){let T=typeof D,b=void 0;if(b===void 0)if(T==="boolean"||D===null||T==="string"&&D&&D==+D&&!(D%1))b=+D;else if(D===""||D===0||D===!1)b=null;else return M0.errors=[{instancePath:Z+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(b!==void 0){if(D=b,$!==void 0)$.maxRequestsPerSocket=b}}var G=f===W;if(G){let T=$.requestTimeout,b=W;if(!(typeof T=="number"&&(!(T%1)&&!isNaN(T))&&isFinite(T))){let S=typeof T,y=void 0;if(y===void 0)if(S==="boolean"||T===null||S==="string"&&T&&T==+T&&!(T%1))y=+T;else return M0.errors=[{instancePath:Z+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(y!==void 0){if(T=y,$!==void 0)$.requestTimeout=y}}var G=b===W;if(G){let S=$.handlerTimeout,y=W;if(!(typeof S=="number"&&(!(S%1)&&!isNaN(S))&&isFinite(S))){let n=typeof S,s=void 0;if(s===void 0)if(n==="boolean"||S===null||n==="string"&&S&&S==+S&&!(S%1))s=+S;else return M0.errors=[{instancePath:Z+"/handlerTimeout",schemaPath:"#/properties/handlerTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(s!==void 0){if(S=s,$!==void 0)$.handlerTimeout=s}}var G=y===W;if(G){let n=$.bodyLimit,s=W;if(!(typeof n=="number"&&(!(n%1)&&!isNaN(n))&&isFinite(n))){let p=typeof n,r=void 0;if(r===void 0)if(p==="boolean"||n===null||p==="string"&&n&&n==+n&&!(n%1))r=+n;else return M0.errors=[{instancePath:Z+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(r!==void 0){if(n=r,$!==void 0)$.bodyLimit=r}}var G=s===W;if(G){let p=$.caseSensitive,r=W;if(typeof p!=="boolean"){let Y0=void 0;if(Y0===void 0)if(p==="false"||p===0||p===null)Y0=!1;else if(p==="true"||p===1)Y0=!0;else return M0.errors=[{instancePath:Z+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(Y0!==void 0){if(p=Y0,$!==void 0)$.caseSensitive=Y0}}var G=r===W;if(G){let Y0=$.allowUnsafeRegex,B0=W;if(typeof Y0!=="boolean"){let C=void 0;if(C===void 0)if(Y0==="false"||Y0===0||Y0===null)C=!1;else if(Y0==="true"||Y0===1)C=!0;else return M0.errors=[{instancePath:Z+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(C!==void 0){if(Y0=C,$!==void 0)$.allowUnsafeRegex=C}}var G=B0===W;if(G){if($.http2!==void 0){let C=$.http2,E=W;if(typeof C!=="boolean"){let L=void 0;if(L===void 0)if(C==="false"||C===0||C===null)L=!1;else if(C==="true"||C===1)L=!0;else return M0.errors=[{instancePath:Z+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(L!==void 0){if(C=L,$!==void 0)$.http2=L}}var G=E===W}else var G=!0;if(G){if($.https!==void 0){let C=$.https,E=W,h=W,L=!0,P=W,_=W,x=W,l=W,m=!1,e=null,Z0=W;if(typeof C!=="boolean"){let o=void 0;if(o===void 0)if(C==="false"||C===0||C===null)o=!1;else if(C==="true"||C===1)o=!0;else{let k0={};if(J===null)J=[k0];else J.push(k0);W++}if(o!==void 0){if(C=o,$!==void 0)$.https=o}}var B=Z0===W;if(B)m=!0,e=0;let T0=W;if(C!==null){let o=void 0;if(o===void 0)if(C===""||C===0||C===!1)o=null;else{let k0={};if(J===null)J=[k0];else J.push(k0);W++}if(o!==void 0){if(C=o,$!==void 0)$.https=o}}var B=T0===W;if(B&&m)m=!1,e=[e,1];else{if(B)m=!0,e=1;let o=W;if(W===o)if(C&&typeof C=="object"&&!Array.isArray(C)){let Q0;if(C.allowHTTP1===void 0&&(Q0="allowHTTP1")){let J0={};if(J===null)J=[J0];else J.push(J0);W++}else{let J0=W;for(let l0 in C)if(l0!=="allowHTTP1")delete C[l0];if(J0===W){if(C.allowHTTP1!==void 0){let l0=C.allowHTTP1;if(typeof l0!=="boolean"){let A0=void 0;if(A0===void 0)if(l0==="false"||l0===0||l0===null)A0=!1;else if(l0==="true"||l0===1)A0=!0;else{let f0={};if(J===null)J=[f0];else J.push(f0);W++}if(A0!==void 0){if(l0=A0,C!==void 0)C.allowHTTP1=A0}}}}}}else{let Q0={};if(J===null)J=[Q0];else J.push(Q0);W++}var B=o===W;if(B&&m)m=!1,e=[e,2];else if(B)m=!0,e=2}if(!m){let o={};if(J===null)J=[o];else J.push(o);W++}else if(W=l,J!==null)if(l)J.length=l;else J=null;var U=x===W;if(U){let o={};if(J===null)J=[o];else J.push(o);W++}else if(W=_,J!==null)if(_)J.length=_;else J=null;var w=P===W;if(W=h,J!==null)if(h)J.length=h;else J=null;if(w){let o=W;$.https=!0;var w=o===W;L=w}if(!L){let o={instancePath:Z+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};if(J===null)J=[o];else J.push(o);return W++,M0.errors=J,!1}var G=E===W}else var G=!0;if(G){let C=$.ignoreTrailingSlash,E=W;if(typeof C!=="boolean"){let L=void 0;if(L===void 0)if(C==="false"||C===0||C===null)L=!1;else if(C==="true"||C===1)L=!0;else return M0.errors=[{instancePath:Z+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(L!==void 0){if(C=L,$!==void 0)$.ignoreTrailingSlash=L}}var G=E===W;if(G){let L=$.ignoreDuplicateSlashes,P=W;if(typeof L!=="boolean"){let x=void 0;if(x===void 0)if(L==="false"||L===0||L===null)x=!1;else if(L==="true"||L===1)x=!0;else return M0.errors=[{instancePath:Z+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(x!==void 0){if(L=x,$!==void 0)$.ignoreDuplicateSlashes=x}}var G=P===W;if(G){let x=$.maxParamLength,l=W;if(!(typeof x=="number"&&(!(x%1)&&!isNaN(x))&&isFinite(x))){let e=typeof x,Z0=void 0;if(Z0===void 0)if(e==="boolean"||x===null||e==="string"&&x&&x==+x&&!(x%1))Z0=+x;else return M0.errors=[{instancePath:Z+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(Z0!==void 0){if(x=Z0,$!==void 0)$.maxParamLength=Z0}}var G=l===W;if(G){let e=$.onProtoPoisoning,Z0=W;if(typeof e!=="string"){let q0=typeof e,o=void 0;if(o===void 0)if(q0=="number"||q0=="boolean")o=""+e;else if(e===null)o="";else return M0.errors=[{instancePath:Z+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(o!==void 0){if(e=o,$!==void 0)$.onProtoPoisoning=o}}var G=Z0===W;if(G){let q0=$.onConstructorPoisoning,o=W;if(typeof q0!=="string"){let Q0=typeof q0,J0=void 0;if(J0===void 0)if(Q0=="number"||Q0=="boolean")J0=""+q0;else if(q0===null)J0="";else return M0.errors=[{instancePath:Z+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(J0!==void 0){if(q0=J0,$!==void 0)$.onConstructorPoisoning=J0}}var G=o===W;if(G){let Q0=$.pluginTimeout,J0=W;if(!(typeof Q0=="number"&&(!(Q0%1)&&!isNaN(Q0))&&isFinite(Q0))){let A0=typeof Q0,f0=void 0;if(f0===void 0)if(A0==="boolean"||Q0===null||A0==="string"&&Q0&&Q0==+Q0&&!(Q0%1))f0=+Q0;else return M0.errors=[{instancePath:Z+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(f0!==void 0){if(Q0=f0,$!==void 0)$.pluginTimeout=f0}}var G=J0===W;if(G){let A0=$.requestIdHeader,f0=W,H0=W,E0=!1,U0=W;if(typeof A0!=="boolean"){let z0=void 0;if(z0===void 0)if(A0==="false"||A0===0||A0===null)z0=!1;else if(A0==="true"||A0===1)z0=!0;else{let H1={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};if(J===null)J=[H1];else J.push(H1);W++}if(z0!==void 0){if(A0=z0,$!==void 0)$.requestIdHeader=z0}}var H=U0===W;if(E0=E0||H,!E0){let z0=W;if(typeof A0!=="string"){let y1=typeof A0,L0=void 0;if(L0===void 0)if(y1=="number"||y1=="boolean")L0=""+A0;else if(A0===null)L0="";else{let W0={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[W0];else J.push(W0);W++}if(L0!==void 0){if(A0=L0,$!==void 0)$.requestIdHeader=L0}}var H=z0===W;E0=E0||H}if(!E0){let z0={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(J===null)J=[z0];else J.push(z0);return W++,M0.errors=J,!1}else if(W=H0,J!==null)if(H0)J.length=H0;else J=null;var G=f0===W;if(G){let z0=$.requestIdLogLabel,H1=W;if(typeof z0!=="string"){let L0=typeof z0,W0=void 0;if(W0===void 0)if(L0=="number"||L0=="boolean")W0=""+z0;else if(z0===null)W0="";else return M0.errors=[{instancePath:Z+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(W0!==void 0){if(z0=W0,$!==void 0)$.requestIdLogLabel=W0}}var G=H1===W;if(G){let L0=$.http2SessionTimeout,W0=W;if(!(typeof L0=="number"&&(!(L0%1)&&!isNaN(L0))&&isFinite(L0))){let M1=typeof L0,s0=void 0;if(s0===void 0)if(M1==="boolean"||L0===null||M1==="string"&&L0&&L0==+L0&&!(L0%1))s0=+L0;else return M0.errors=[{instancePath:Z+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(s0!==void 0){if(L0=s0,$!==void 0)$.http2SessionTimeout=s0}}var G=W0===W;if(G){let M1=$.exposeHeadRoutes,s0=W;if(typeof M1!=="boolean"){let c0=void 0;if(c0===void 0)if(M1==="false"||M1===0||M1===null)c0=!1;else if(M1==="true"||M1===1)c0=!0;else return M0.errors=[{instancePath:Z+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(c0!==void 0){if(M1=c0,$!==void 0)$.exposeHeadRoutes=c0}}var G=s0===W;if(G){let c0=$.useSemicolonDelimiter,jA=W;if(typeof c0!=="boolean"){let G0=void 0;if(G0===void 0)if(c0==="false"||c0===0||c0===null)G0=!1;else if(c0==="true"||c0===1)G0=!0;else return M0.errors=[{instancePath:Z+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(G0!==void 0){if(c0=G0,$!==void 0)$.useSemicolonDelimiter=G0}}var G=jA===W;if(G){if($.routerOptions!==void 0){let G0=$.routerOptions,g8=W;if(W===g8)if(G0&&typeof G0=="object"&&!Array.isArray(G0)){if(G0.ignoreTrailingSlash===void 0)G0.ignoreTrailingSlash=!1;if(G0.ignoreDuplicateSlashes===void 0)G0.ignoreDuplicateSlashes=!1;if(G0.maxParamLength===void 0)G0.maxParamLength=100;if(G0.allowUnsafeRegex===void 0)G0.allowUnsafeRegex=!1;if(G0.useSemicolonDelimiter===void 0)G0.useSemicolonDelimiter=!1;let D1=G0.ignoreTrailingSlash,A1=W;if(typeof D1!=="boolean"){let a0=void 0;if(a0===void 0)if(D1==="false"||D1===0||D1===null)a0=!1;else if(D1==="true"||D1===1)a0=!0;else return M0.errors=[{instancePath:Z+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(a0!==void 0){if(D1=a0,G0!==void 0)G0.ignoreTrailingSlash=a0}}var V=A1===W;if(V){let a0=G0.ignoreDuplicateSlashes,W$=W;if(typeof a0!=="boolean"){let S0=void 0;if(S0===void 0)if(a0==="false"||a0===0||a0===null)S0=!1;else if(a0==="true"||a0===1)S0=!0;else return M0.errors=[{instancePath:Z+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(S0!==void 0){if(a0=S0,G0!==void 0)G0.ignoreDuplicateSlashes=S0}}var V=W$===W;if(V){let S0=G0.maxParamLength,G$=W;if(!(typeof S0=="number"&&(!(S0%1)&&!isNaN(S0))&&isFinite(S0))){let g1=typeof S0,R$=void 0;if(R$===void 0)if(g1==="boolean"||S0===null||g1==="string"&&S0&&S0==+S0&&!(S0%1))R$=+S0;else return M0.errors=[{instancePath:Z+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(R$!==void 0){if(S0=R$,G0!==void 0)G0.maxParamLength=R$}}var V=G$===W;if(V){let g1=G0.allowUnsafeRegex,R$=W;if(typeof g1!=="boolean"){let W1=void 0;if(W1===void 0)if(g1==="false"||g1===0||g1===null)W1=!1;else if(g1==="true"||g1===1)W1=!0;else return M0.errors=[{instancePath:Z+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(W1!==void 0){if(g1=W1,G0!==void 0)G0.allowUnsafeRegex=W1}}var V=R$===W;if(V){let W1=G0.useSemicolonDelimiter,DA=W;if(typeof W1!=="boolean"){let e$=void 0;if(e$===void 0)if(W1==="false"||W1===0||W1===null)e$=!1;else if(W1==="true"||W1===1)e$=!0;else return M0.errors=[{instancePath:Z+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(e$!==void 0){if(W1=e$,G0!==void 0)G0.useSemicolonDelimiter=e$}}var V=DA===W}}}}}else return M0.errors=[{instancePath:Z+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=g8===W}else var G=!0;if(G)if($.constraints!==void 0){let G0=$.constraints,g8=W;if(W===g8)if(G0&&typeof G0=="object"&&!Array.isArray(G0))for(let D1 in G0){let A1=G0[D1],a0=W;if(W===a0)if(A1&&typeof A1=="object"&&!Array.isArray(A1)){let W$;if(A1.name===void 0&&(W$="name")||A1.storage===void 0&&(W$="storage")||A1.validate===void 0&&(W$="validate")||A1.deriveConstraint===void 0&&(W$="deriveConstraint"))return M0.errors=[{instancePath:Z+"/constraints/"+D1.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:W$},message:"must have required property '"+W$+"'"}],!1;else if(A1.name!==void 0){let h8=A1.name;if(typeof h8!=="string"){let S0=typeof h8,G$=void 0;if(G$===void 0)if(S0=="number"||S0=="boolean")G$=""+h8;else if(h8===null)G$="";else return M0.errors=[{instancePath:Z+"/constraints/"+D1.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(G$!==void 0){if(h8=G$,A1!==void 0)A1.name=G$}}}}else return M0.errors=[{instancePath:Z+"/constraints/"+D1.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var z=a0===W;if(!z)break}else return M0.errors=[{instancePath:Z+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var G=g8===W}else var G=!0}}}}}}}}}}}}}}}}}}}}}}}}else return M0.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return M0.errors=J,W===0}pQ.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72000,maxRequestsPerSocket:0,requestTimeout:0,handlerTimeout: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:72000,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var EV=I((Pu,nQ)=>{var iQ=CV(),YI=dZ()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:JI}=d0();function WI($){let Z=YI($);if(!iQ(Z)){let Q=new JI(JSON.stringify(iQ.errors.map((X)=>X.message)));throw Q.errors=iQ.errors,Q}return oJ(Z)}function oJ($){let Z=Object.getOwnPropertyNames($);for(let Q of Z){let X=$[Q];if(ArrayBuffer.isView(X)&&!(X instanceof DataView))continue;$[Q]=X&&typeof X==="object"?oJ(X):X}return Object.freeze($)}nQ.exports=WI;nQ.exports.defaultInitOptions=iQ.defaultInitOptions;nQ.exports.utils={deepFreezeObject:oJ}});var gV=I((Cu,yV)=>{var{kAvvioBoot:GI,kChildren:bV,kRoutePrefix:_V,kLogLevel:IV,kLogSerializers:rJ,kHooks:tJ,kSchemaController:b8,kContentTypeParser:SV,kReply:xV,kRequest:kV,kFourOhFour:KI,kPluginNameChain:vV,kErrorHandlerAlreadySet:BI}=u0(),UI=XQ(),zI=BQ(),wI=NJ(),VI=kY(),{buildHooks:HI}=w$(),y6=fJ();yV.exports=function(Z,Q,X){let Y=y6.registerPlugin.call(Z,Q),J=y6.getPluginName(Q)||y6.getFuncPreview(Q);if(Y)return Z[vV].push(J),Z;let W=Object.create(Z);if(Z[bV].push(W),W.ready=Z[GI].bind(W),W[bV]=[],W[xV]=UI.buildReply(W[xV]),W[kV]=zI.buildRequest(W[kV]),W[SV]=VI.helpers.buildContentTypeParser(W[SV]),W[tJ]=HI(W[tJ]),W[_V]=MI(W[_V],X.prefix),W[IV]=X.logLevel||W[IV],W[b8]=wI.buildSchemaController(Z[b8]),W.getSchema=W[b8].getSchema.bind(W[b8]),W.getSchemas=W[b8].getSchemas.bind(W[b8]),W[y6.kRegisteredPlugins]=Object.create(W[y6.kRegisteredPlugins]),W[vV]=[J],W[BI]=!1,W[rJ]||X.logSerializers)W[rJ]=Object.assign(Object.create(W[rJ]),X.logSerializers);if(X.prefix)W[KI].arrange404(W);for(let G of W[tJ].onRegister)G.call(Z,W,X);return W};function MI($,Z){if(!Z)return $;if($.endsWith("/")&&Z[0]==="/")Z=Z.slice(1);else if(Z[0]!=="/")Z="/"+Z;return $+Z}});var iV=I((cV)=>{Object.defineProperty(cV,"__esModule",{value:!0});cV.parseCookie=mV;cV.parse=mV;cV.stringifyCookie=DI;cV.stringifySetCookie=sQ;cV.serialize=sQ;cV.parseSetCookie=TI;cV.stringifySetCookie=sQ;cV.serialize=sQ;var hV=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,uV=/^[\u0021-\u003A\u003C-\u007E]*$/,AI=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,FI=/^[\u0020-\u003A\u003D-\u007E]*$/,NI=/^-?\d+$/,OI=Object.prototype.toString,jI=(()=>{let $=function(){};return $.prototype=Object.create(null),$})();function mV($,Z){let Q=new jI,X=$.length;if(X<2)return Q;let Y=Z?.decode||lV,J=0;do{let W=$5($,J,X);if(W===-1)break;let G=eJ($,J,X);if(W>G){J=$.lastIndexOf(";",W-1)+1;continue}let K=j$($,J,W);if(Q[K]===void 0)Q[K]=Y(j$($,W+1,G));J=G+1}while(J<X);return Q}function DI($,Z){let Q=Z?.encode||encodeURIComponent,X=[];for(let Y of Object.keys($)){let J=$[Y];if(J===void 0)continue;if(!hV.test(Y))throw TypeError(`cookie name is invalid: ${Y}`);let W=Q(J);if(!uV.test(W))throw TypeError(`cookie val is invalid: ${J}`);X.push(`${Y}=${W}`)}return X.join("; ")}function sQ($,Z,Q){let X=typeof $==="object"?$:{...Q,name:$,value:String(Z)},J=(typeof Z==="object"?Z:Q)?.encode||encodeURIComponent;if(!hV.test(X.name))throw TypeError(`argument name is invalid: ${X.name}`);let W=X.value?J(X.value):"";if(!uV.test(W))throw TypeError(`argument val is invalid: ${X.value}`);let G=X.name+"="+W;if(X.maxAge!==void 0){if(!Number.isInteger(X.maxAge))throw TypeError(`option maxAge is invalid: ${X.maxAge}`);G+="; Max-Age="+X.maxAge}if(X.domain){if(!AI.test(X.domain))throw TypeError(`option domain is invalid: ${X.domain}`);G+="; Domain="+X.domain}if(X.path){if(!FI.test(X.path))throw TypeError(`option path is invalid: ${X.path}`);G+="; Path="+X.path}if(X.expires){if(!qI(X.expires)||!Number.isFinite(X.expires.valueOf()))throw TypeError(`option expires is invalid: ${X.expires}`);G+="; Expires="+X.expires.toUTCString()}if(X.httpOnly)G+="; HttpOnly";if(X.secure)G+="; Secure";if(X.partitioned)G+="; Partitioned";if(X.priority)switch(typeof X.priority==="string"?X.priority.toLowerCase():void 0){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${X.priority}`)}if(X.sameSite)switch(typeof X.sameSite==="string"?X.sameSite.toLowerCase():X.sameSite){case!0:case"strict":G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"none":G+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${X.sameSite}`)}return G}function TI($,Z){let Q=Z?.decode||lV,X=$.length,Y=eJ($,0,X),J=$5($,0,Y),W=J===-1?{name:"",value:Q(j$($,0,Y))}:{name:j$($,0,J),value:Q(j$($,J+1,Y))},G=Y+1;while(G<X){let K=eJ($,G,X),B=$5($,G,K),U=B===-1?j$($,G,K):j$($,G,B),w=B===-1?void 0:j$($,B+1,K);switch(U.toLowerCase()){case"httponly":W.httpOnly=!0;break;case"secure":W.secure=!0;break;case"partitioned":W.partitioned=!0;break;case"domain":W.domain=w;break;case"path":W.path=w;break;case"max-age":if(w&&NI.test(w))W.maxAge=Number(w);break;case"expires":if(!w)break;let H=new Date(w);if(Number.isFinite(H.valueOf()))W.expires=H;break;case"priority":if(!w)break;let V=w.toLowerCase();if(V==="low"||V==="medium"||V==="high")W.priority=V;break;case"samesite":if(!w)break;let z=w.toLowerCase();if(z==="lax"||z==="strict"||z==="none")W.sameSite=z;break}G=K+1}return W}function eJ($,Z,Q){let X=$.indexOf(";",Z);return X===-1?Q:X}function $5($,Z,Q){let X=$.indexOf("=",Z);return X<Q?X:-1}function j$($,Z,Q){let X=Z,Y=Q;do{let J=$.charCodeAt(X);if(J!==32&&J!==9)break}while(++X<Y);while(Y>X){let J=$.charCodeAt(Y-1);if(J!==32&&J!==9)break;Y--}return $.slice(X,Y)}function lV($){if($.indexOf("%")===-1)return $;try{return decodeURIComponent($)}catch(Z){return $}}function qI($){return OI.call($)==="[object Date]"}});var sV=I((bu,aQ)=>{var{format:Z5}=u("util");function CI($){return nV({...$,name:"DeprecationWarning"})}function nV({name:$,code:Z,message:Q,unlimited:X=!1}={}){if(!$)throw Error("Warning name must not be empty");if(!Z)throw Error("Warning code must not be empty");if(!Q)throw Error("Warning message must not be empty");if(typeof X!=="boolean")throw Error("Warning opts.unlimited must be a boolean");Z=Z.toUpperCase();let Y={[$]:function(W,G,K){if(J.emitted===!0&&J.unlimited!==!0)return;J.emitted=!0,process.emitWarning(J.format(W,G,K),J.name,J.code)}};if(X)Y={[$]:function(W,G,K){J.emitted=!0,process.emitWarning(J.format(W,G,K),J.name,J.code)}};let J=Y[$];return J.emitted=!1,J.message=Q,J.unlimited=X,J.code=Z,J.format=function(W,G,K){let B;if(W&&G&&K)B=Z5(Q,W,G,K);else if(W&&G)B=Z5(Q,W,G);else if(W)B=Z5(Q,W);else B=Q;return B},J}var Q5={createWarning:nV,createDeprecation:CI};aQ.exports=Q5;aQ.exports.default=Q5;aQ.exports.processWarning=Q5});var rV=I((_u,oV)=>{var{URL:aV}=u("url");oV.exports=function(Z,Q){if((typeof Z==="string"||Object.prototype.toString.call(Z)==="[object String]")&&Z.startsWith("//"))Z="http://localhost"+Z;let X=typeof Z==="object"?Object.assign(new aV("http://localhost"),Z):new aV(Z,"http://localhost");if(typeof Q==="string"){Q=new URLSearchParams(Q);for(let Y of Q.keys()){X.searchParams.delete(Y);for(let J of Q.getAll(Y))X.searchParams.append(Y,J)}}else{let Y=Object.assign({},Z.query,Q);for(let J in Y){let W=Y[J];if(Array.isArray(W)){X.searchParams.delete(J);for(let G of W)X.searchParams.append(J,G)}else X.searchParams.set(J,W)}}return X}});var tV=I((SI,X5)=>{var{randomUUID:EI}=u("crypto"),{Readable:bI}=u("stream"),_8;function _I($){return $&&typeof $==="object"&&typeof $.append==="function"&&typeof $.delete==="function"&&typeof $.get==="function"&&typeof $.getAll==="function"&&typeof $.has==="function"&&typeof $.set==="function"&&$[Symbol.toStringTag]==="FormData"}function II($){_8=_8??new TextEncoder;let Z=`----formdata-${EI()}`,Q=`--${Z}\r
358
+ Content-Disposition: form-data`;/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */let X=(K)=>K.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Y=(K)=>K.replace(/\r?\n|\r/g,`\r
359
+ `),J=new Uint8Array([13,10]);async function*W(){for(let[K,B]of $)if(typeof B==="string")yield _8.encode(`${Q}; name="${X(Y(K))}"\r
360
+ \r
361
+ `),yield _8.encode(`${Y(B)}\r
362
+ `);else{let U=`${Q}; name="${X(Y(K))}"`;if(B.name&&(U+=`; filename="${X(B.name)}"`),U+=`\r
363
+ Content-Type: ${B.type||"application/octet-stream"}\r
364
+ \r
365
+ `,yield _8.encode(U),B.stream)yield*B.stream();else yield B;yield J}yield _8.encode(`--${Z}--`)}return{stream:bI.from(W()),contentType:`multipart/form-data; boundary=${Z}`}}SI.isFormDataLike=_I;SI.formDataToStream=II});var QH=I((Iu,oQ)=>{var{Readable:eV,addAbortSignal:vI}=u("stream"),Y5=u("util"),yI=iV(),gI=u("assert"),{createDeprecation:hI}=sV(),uI=rV(),{isFormDataLike:mI,formDataToStream:lI}=tV(),{EventEmitter:cI}=u("events"),dI=hI({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function pI($){return $.port?$.host:$.hostname+($.protocol==="https:"?":443":":80")}class $H extends cI{constructor($){super();this.remoteAddress=$}}function ZH($){return new Z(this);function Z(Q){D$.call(Q,{...$,Request:void 0}),Object.assign(this,Q);for(let X of Object.keys(D$.prototype))this.constructor.prototype[X]=D$.prototype[X];return Y5.inherits(this.constructor,$.Request),this}}function D$($){eV.call(this,{autoDestroy:!1});let Z=uI($.url||$.path,$.query);this.url=Z.pathname+Z.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=$.method?$.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let Q=$.headers||{};for(let W in Q){let G=W.toLowerCase();if((G==="user-agent"||G==="content-type")&&Q[W]===void 0){this.headers[G]=void 0;continue}let K=Q[W];gI(K!==void 0,'invalid value "undefined" for header '+W),this.headers[G]=""+K}if("user-agent"in this.headers===!1)this.headers["user-agent"]="lightMyRequest";if(this.headers.host=this.headers.host||$.authority||pI(Z),$.cookies){let{cookies:W}=$,G=Object.keys(W).map((K)=>yI.serialize(K,W[K]));if(this.headers.cookie)G.unshift(this.headers.cookie);this.headers.cookie=G.join("; ")}this.socket=new $H($.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return dI(),this.socket},configurable:!0});let X=$.payload||$.body||null,Y=X&&typeof X.resume==="function";if(mI(X)){let W=lI(X);X=W.stream,Y=!0,this.headers["content-type"]=W.contentType,this.headers["transfer-encoding"]="chunked"}if(X&&typeof X!=="string"&&!Y&&!Buffer.isBuffer(X)){if(X=JSON.stringify(X),"content-type"in this.headers===!1)this.headers["content-type"]="application/json"}if(X&&!Y&&!Object.hasOwn(this.headers,"content-length"))this.headers["content-length"]=(Buffer.isBuffer(X)?X.length:Buffer.byteLength(X)).toString();for(let W of Object.keys(this.headers))this.rawHeaders.push(W,this.headers[W]);this._lightMyRequest={payload:X,isDone:!1,simulate:$.simulate||{},payloadAsStream:$.payloadAsStream,signal:$.signal};let J=$.signal;if(J)vI(J,this);{let W=this._lightMyRequest.payload;if(W?._readableState)this._read=iI,W.on("error",(G)=>{this.destroy(G)}),W.on("end",()=>{this.push(null)});else this._read=nI}return this}function iI(){let $=this._lightMyRequest.payload,Z=!0,Q=!1,X;while(Z&&(X=$.read()))Q=!0,Z=this.push(X);if(Z&&!Q)this._lightMyRequest.payload.once("readable",this._read.bind(this))}function nI(){setImmediate(()=>{if(this._lightMyRequest.isDone){if(this._lightMyRequest.simulate.end!==!1)this.push(null);return}if(this._lightMyRequest.isDone=!0,this._lightMyRequest.payload)if(this._lightMyRequest.simulate.split)this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1));else this.push(this._lightMyRequest.payload);if(this._lightMyRequest.simulate.error)this.emit("error",Error("Simulated"));if(this._lightMyRequest.simulate.close)this.emit("close");if(this._lightMyRequest.simulate.end!==!1)this.push(null)})}Y5.inherits(D$,eV);Y5.inherits(ZH,D$);D$.prototype.destroy=function($){if(this.destroyed||this._lightMyRequest.isDone)return;if(this.destroyed=!0,$)this._error=!0,process.nextTick(()=>this.emit("error",$));process.nextTick(()=>this.emit("close"))};oQ.exports=D$;oQ.exports.Request=D$;oQ.exports.CustomRequest=ZH});var YH=I((Su,g6)=>{var rQ={decodeValues:!0,map:!1,silent:!1};function J5($){return typeof $!=="string"||$ in{}}function W5(){return Object.create(null)}function G5($){return typeof $==="string"&&!!$.trim()}function K5($,Z){var Q=$.split(";").filter(G5),X=Q.shift(),Y=sI(X),J=Y.name,W=Y.value;if(Z=Z?Object.assign({},rQ,Z):rQ,J5(J))return null;try{W=Z.decodeValues?decodeURIComponent(W):W}catch(K){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",K)}var G=W5();return G.name=J,G.value=W,Q.forEach(function(K){var B=K.split("="),U=B.shift().trimLeft().toLowerCase();if(J5(U))return;var w=B.join("=");if(U==="expires")G.expires=new Date(w);else if(U==="max-age"){var H=parseInt(w,10);if(!Number.isNaN(H))G.maxAge=H}else if(U==="secure")G.secure=!0;else if(U==="httponly")G.httpOnly=!0;else if(U==="samesite")G.sameSite=w;else if(U==="partitioned")G.partitioned=!0;else if(U)G[U]=w}),G}function sI($){var Z="",Q="",X=$.split("=");if(X.length>1)Z=X.shift(),Q=X.join("=");else Q=$;return{name:Z,value:Q}}function XH($,Z){if(Z=Z?Object.assign({},rQ,Z):rQ,!$)if(!Z.map)return[];else return W5();if($.headers)if(typeof $.headers.getSetCookie==="function")$=$.headers.getSetCookie();else if($.headers["set-cookie"])$=$.headers["set-cookie"];else{var Q=$.headers[Object.keys($.headers).find(function(Y){return Y.toLowerCase()==="set-cookie"})];if(!Q&&$.headers.cookie&&!Z.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.");$=Q}if(!Array.isArray($))$=[$];if(!Z.map)return $.filter(G5).map(function(Y){return K5(Y,Z)}).filter(Boolean);else{var X=W5();return $.filter(G5).reduce(function(Y,J){var W=K5(J,Z);if(W&&!J5(W.name))Y[W.name]=W;return Y},X)}}function aI($){if(Array.isArray($))return $;if(typeof $!=="string")return[];var Z=[],Q=0,X,Y,J,W,G;function K(){while(Q<$.length&&/\s/.test($.charAt(Q)))Q+=1;return Q<$.length}function B(){return Y=$.charAt(Q),Y!=="="&&Y!==";"&&Y!==","}while(Q<$.length){X=Q,G=!1;while(K())if(Y=$.charAt(Q),Y===","){J=Q,Q+=1,K(),W=Q;while(Q<$.length&&B())Q+=1;if(Q<$.length&&$.charAt(Q)==="=")G=!0,Q=W,Z.push($.substring(X,J)),X=Q;else Q=J+1}else Q+=1;if(!G||Q>=$.length)Z.push($.substring(X,$.length))}return Z}g6.exports=XH;g6.exports.parse=XH;g6.exports.parseString=K5;g6.exports.splitCookiesString=aI});var BH=I((xu,KH)=>{var h6=u("http"),{Writable:oI,Readable:JH,addAbortSignal:rI}=u("stream"),tI=u("util"),eI=YH();function T$($,Z,Q){if(h6.ServerResponse.call(this,$),$._lightMyRequest?.payloadAsStream){let G=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new JH({read:G})};let K=$._lightMyRequest.signal;if(K)rI(K,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket($S()),this._promiseCallback=typeof Q==="function";let X=!1,Y=(G)=>{if(X)return;if(X=!0,this._promiseCallback)return process.nextTick(()=>Z(G));process.nextTick(()=>Z(null,G))};this._lightMyRequest.onEndSuccess=Y;let J=!1,W=(G)=>{if(X){if(this._lightMyRequest.stream&&!J){if(!G)G=Error("response destroyed before completion"),G.code="LIGHT_ECONNRESET";this._lightMyRequest.stream.destroy(G),this._lightMyRequest.stream.on("error",()=>{})}return}if(X=!0,!G)G=Error("response destroyed before completion"),G.code="LIGHT_ECONNRESET";if(this._promiseCallback)return process.nextTick(()=>Q(G));process.nextTick(()=>Z(G,null))};if(this._lightMyRequest.stream)this.once("finish",()=>{J=!0,this._lightMyRequest.stream.push(null)});else this.once("finish",()=>{let G=WH(this);G.raw.req=$,Y(G)});this.connection.once("error",W),this.once("error",W),this.once("close",W)}tI.inherits(T$,h6.ServerResponse);T$.prototype.setTimeout=function($,Z){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},$),this.on("timeout",Z),this};T$.prototype.writeHead=function(){let $=h6.ServerResponse.prototype.writeHead.apply(this,arguments);if(GH(this),this._lightMyRequest.stream)this._lightMyRequest.onEndSuccess(WH(this));return $};T$.prototype.write=function($,Z,Q){if(this.timeoutHandle)clearTimeout(this.timeoutHandle);if(h6.ServerResponse.prototype.write.call(this,$,Z,Q),this._lightMyRequest.stream)return this._lightMyRequest.stream.push(Buffer.from($,Z));else return this._lightMyRequest.payloadChunks.push(Buffer.from($,Z)),!0};T$.prototype.end=function($,Z,Q){if($)this.write($,Z);h6.ServerResponse.prototype.end.call(this,Q),this.emit("finish"),this.destroy()};T$.prototype.destroy=function($){if(this.destroyed)return;if(this.destroyed=!0,$)process.nextTick(()=>this.emit("error",$));process.nextTick(()=>this.emit("close"))};T$.prototype.addTrailers=function($){for(let Z in $)this._lightMyRequest.trailers[Z.toLowerCase().trim()]=$[Z].toString().trim()};function WH($){if($._lightMyRequest.headers===null)GH($);ZS($);let Z={raw:{res:$},headers:$._lightMyRequest.headers,statusCode:$.statusCode,statusMessage:$.statusMessage,trailers:{},get cookies(){return eI.parse(this)}};if(Z.trailers=$._lightMyRequest.trailers,$._lightMyRequest.payloadChunks){let Q=Buffer.concat($._lightMyRequest.payloadChunks);Z.rawPayload=Q,Z.payload=Q.toString(),Z.body=Z.payload,Z.json=function(){return JSON.parse(Z.payload)}}else Z.json=function(){throw Error("Response payload is not available with payloadAsStream: true")};return Z.stream=function(){if($._lightMyRequest.stream)return $._lightMyRequest.stream;return JH.from($._lightMyRequest.payloadChunks)},Z}function $S(){return new oI({write($,Z,Q){setImmediate(Q)}})}function ZS($){let Z=$._lightMyRequest.headers;for(let Q of Object.keys(Z)){let X=Z[Q];if(Array.isArray(X))Z[Q]=X.map((Y)=>""+Y);else Z[Q]=""+X}}function GH($){$._lightMyRequest.headers=Object.assign({},$.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach((Z)=>{let Q=new RegExp("\\r\\n"+Z+": ([^\\r]*)\\r\\n"),X=$._header?.match(Q);if(X)$._lightMyRequest.headers[Z.toLowerCase()]=X[1]})}KH.exports=T$});var UH=I((ku,B5)=>{B5.exports=m0;B5.exports.default=m0;var QS={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 m0($,{instancePath:Z="",parentData:Q,parentDataProperty:X,rootData:Y=$}={}){let J=null,W=0,G=W,K=!1,B=null,U=W;if($&&typeof $=="object"&&!Array.isArray($)){let A;if($.url===void 0&&(A="url")){let D={instancePath:Z,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"};if(J===null)J=[D];else J.push(D);W++}}var H=U===W;if(H)K=!0,B=0;let w=W;if($&&typeof $=="object"&&!Array.isArray($)){let A;if($.path===void 0&&(A="path")){let D={instancePath:Z,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"};if(J===null)J=[D];else J.push(D);W++}}var H=w===W;if(H&&K)K=!1,B=[B,1];else if(H)K=!0,B=1;if(!K){let A={instancePath:Z,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:B},message:"must match exactly one schema in oneOf"};if(J===null)J=[A];else J.push(A);return W++,m0.errors=J,!1}else if(W=G,J!==null)if(G)J.length=G;else J=null;if(W===0)if($&&typeof $=="object"&&!Array.isArray($)){if($.url!==void 0){let A=$.url,D=W,f=W,R=!1,T=null,b=W;if(typeof A!=="string"){let S=typeof A,y=void 0;if(y===void 0)if(S=="number"||S=="boolean")y=""+A;else if(A===null)y="";else{let v={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[v];else J.push(v);W++}if(y!==void 0){if(A=y,$!==void 0)$.url=y}}var z=b===W;if(z)R=!0,T=0;let q=W;if(W===q)if(A&&typeof A=="object"&&!Array.isArray(A)){let S;if(A.pathname===void 0&&(S="pathname")){let y={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:S},message:"must have required property '"+S+"'"};if(J===null)J=[y];else J.push(y);W++}else{if(A.protocol!==void 0){let y=A.protocol,v=W;if(typeof y!=="string"){let n=typeof y,s=void 0;if(s===void 0)if(n=="number"||n=="boolean")s=""+y;else if(y===null)s="";else{let a={instancePath:Z+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[a];else J.push(a);W++}if(s!==void 0){if(y=s,A!==void 0)A.protocol=s}}var V=v===W}else var V=!0;if(V){if(A.hostname!==void 0){let y=A.hostname,v=W;if(typeof y!=="string"){let s=typeof y,a=void 0;if(a===void 0)if(s=="number"||s=="boolean")a=""+y;else if(y===null)a="";else{let p={instancePath:Z+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[p];else J.push(p);W++}if(a!==void 0){if(y=a,A!==void 0)A.hostname=a}}var V=v===W}else var V=!0;if(V)if(A.pathname!==void 0){let y=A.pathname,v=W;if(typeof y!=="string"){let s=typeof y,a=void 0;if(a===void 0)if(s=="number"||s=="boolean")a=""+y;else if(y===null)a="";else{let p={instancePath:Z+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[p];else J.push(p);W++}if(a!==void 0){if(y=a,A!==void 0)A.pathname=a}}var V=v===W}else var V=!0}}}else{let S={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};if(J===null)J=[S];else J.push(S);W++}var z=q===W;if(z&&R)R=!1,T=[T,1];else if(z)R=!0,T=1;if(!R){let S={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:T},message:"must match exactly one schema in oneOf"};if(J===null)J=[S];else J.push(S);return W++,m0.errors=J,!1}else if(W=f,J!==null)if(f)J.length=f;else J=null;var N=D===W}else var N=!0;if(N){if($.path!==void 0){let A=$.path,D=W,f=W,R=!1,T=null,b=W;if(typeof A!=="string"){let y=typeof A,v=void 0;if(v===void 0)if(y=="number"||y=="boolean")v=""+A;else if(A===null)v="";else{let n={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[n];else J.push(n);W++}if(v!==void 0){if(A=v,$!==void 0)$.path=v}}var O=b===W;if(O)R=!0,T=0;let q=W;if(W===q)if(A&&typeof A=="object"&&!Array.isArray(A)){let y;if(A.pathname===void 0&&(y="pathname")){let v={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:y},message:"must have required property '"+y+"'"};if(J===null)J=[v];else J.push(v);W++}else{if(A.protocol!==void 0){let v=A.protocol,n=W;if(typeof v!=="string"){let s=typeof v,a=void 0;if(a===void 0)if(s=="number"||s=="boolean")a=""+v;else if(v===null)a="";else{let p={instancePath:Z+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[p];else J.push(p);W++}if(a!==void 0){if(v=a,A!==void 0)A.protocol=a}}var F=n===W}else var F=!0;if(F){if(A.hostname!==void 0){let v=A.hostname,n=W;if(typeof v!=="string"){let a=typeof v,p=void 0;if(p===void 0)if(a=="number"||a=="boolean")p=""+v;else if(v===null)p="";else{let r={instancePath:Z+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[r];else J.push(r);W++}if(p!==void 0){if(v=p,A!==void 0)A.hostname=p}}var F=n===W}else var F=!0;if(F)if(A.pathname!==void 0){let v=A.pathname,n=W;if(typeof v!=="string"){let a=typeof v,p=void 0;if(p===void 0)if(a=="number"||a=="boolean")p=""+v;else if(v===null)p="";else{let r={instancePath:Z+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[r];else J.push(r);W++}if(p!==void 0){if(v=p,A!==void 0)A.pathname=p}}var F=n===W}else var F=!0}}}else{let y={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};if(J===null)J=[y];else J.push(y);W++}var O=q===W;if(O&&R)R=!1,T=[T,1];else if(O)R=!0,T=1;if(!R){let y={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:T},message:"must match exactly one schema in oneOf"};if(J===null)J=[y];else J.push(y);return W++,m0.errors=J,!1}else if(W=f,J!==null)if(f)J.length=f;else J=null;var N=D===W}else var N=!0;if(N){if($.cookies!==void 0){let A=$.cookies,D=W;if(W===D){if(!(A&&typeof A=="object"&&!Array.isArray(A)))return m0.errors=[{instancePath:Z+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1}var N=D===W}else var N=!0;if(N){if($.headers!==void 0){let A=$.headers,D=W;if(W===D){if(!(A&&typeof A=="object"&&!Array.isArray(A)))return m0.errors=[{instancePath:Z+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1}var N=D===W}else var N=!0;if(N){if($.query!==void 0){let A=$.query,D=W,f=W,R=!1,T=W;if(W===T){if(!(A&&typeof A=="object"&&!Array.isArray(A))){let q={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};if(J===null)J=[q];else J.push(q);W++}}var j=T===W;if(R=R||j,!R){let q=W;if(typeof A!=="string"){let y=typeof A,v=void 0;if(v===void 0)if(y=="number"||y=="boolean")v=""+A;else if(A===null)v="";else{let n={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};if(J===null)J=[n];else J.push(n);W++}if(v!==void 0){if(A=v,$!==void 0)$.query=v}}var j=q===W;R=R||j}if(!R){let q={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(J===null)J=[q];else J.push(q);return W++,m0.errors=J,!1}else if(W=f,J!==null)if(f)J.length=f;else J=null;var N=D===W}else var N=!0;if(N){if($.simulate!==void 0){let A=$.simulate,D=W;if(W===D)if(A&&typeof A=="object"&&!Array.isArray(A)){if(A.end!==void 0){let R=A.end,T=W;if(typeof R!=="boolean"){let b=void 0;if(b===void 0)if(R==="false"||R===0||R===null)b=!1;else if(R==="true"||R===1)b=!0;else return m0.errors=[{instancePath:Z+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(b!==void 0){if(R=b,A!==void 0)A.end=b}}var M=T===W}else var M=!0;if(M){if(A.split!==void 0){let R=A.split,T=W;if(typeof R!=="boolean"){let q=void 0;if(q===void 0)if(R==="false"||R===0||R===null)q=!1;else if(R==="true"||R===1)q=!0;else return m0.errors=[{instancePath:Z+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(q!==void 0){if(R=q,A!==void 0)A.split=q}}var M=T===W}else var M=!0;if(M){if(A.error!==void 0){let R=A.error,T=W;if(typeof R!=="boolean"){let q=void 0;if(q===void 0)if(R==="false"||R===0||R===null)q=!1;else if(R==="true"||R===1)q=!0;else return m0.errors=[{instancePath:Z+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(q!==void 0){if(R=q,A!==void 0)A.error=q}}var M=T===W}else var M=!0;if(M)if(A.close!==void 0){let R=A.close,T=W;if(typeof R!=="boolean"){let q=void 0;if(q===void 0)if(R==="false"||R===0||R===null)q=!1;else if(R==="true"||R===1)q=!0;else return m0.errors=[{instancePath:Z+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(q!==void 0){if(R=q,A!==void 0)A.close=q}}var M=T===W}else var M=!0}}}else return m0.errors=[{instancePath:Z+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var N=D===W}else var N=!0;if(N){if($.authority!==void 0){let A=$.authority,D=W;if(typeof A!=="string"){let R=typeof A,T=void 0;if(T===void 0)if(R=="number"||R=="boolean")T=""+A;else if(A===null)T="";else return m0.errors=[{instancePath:Z+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!==void 0){if(A=T,$!==void 0)$.authority=T}}var N=D===W}else var N=!0;if(N){if($.remoteAddress!==void 0){let A=$.remoteAddress,D=W;if(typeof A!=="string"){let R=typeof A,T=void 0;if(T===void 0)if(R=="number"||R=="boolean")T=""+A;else if(A===null)T="";else return m0.errors=[{instancePath:Z+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!==void 0){if(A=T,$!==void 0)$.remoteAddress=T}}var N=D===W}else var N=!0;if(N){if($.method!==void 0){let A=$.method,D=W;if(typeof A!=="string"){let R=typeof A,T=void 0;if(T===void 0)if(R=="number"||R=="boolean")T=""+A;else if(A===null)T="";else return m0.errors=[{instancePath:Z+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!==void 0){if(A=T,$!==void 0)$.method=T}}if(!(A==="ACL"||A==="BIND"||A==="CHECKOUT"||A==="CONNECT"||A==="COPY"||A==="DELETE"||A==="GET"||A==="HEAD"||A==="LINK"||A==="LOCK"||A==="M-SEARCH"||A==="MERGE"||A==="MKACTIVITY"||A==="MKCALENDAR"||A==="MKCOL"||A==="MOVE"||A==="NOTIFY"||A==="OPTIONS"||A==="PATCH"||A==="POST"||A==="PROPFIND"||A==="PROPPATCH"||A==="PURGE"||A==="PUT"||A==="QUERY"||A==="REBIND"||A==="REPORT"||A==="SEARCH"||A==="SOURCE"||A==="SUBSCRIBE"||A==="TRACE"||A==="UNBIND"||A==="UNLINK"||A==="UNLOCK"||A==="UNSUBSCRIBE"||A==="acl"||A==="bind"||A==="checkout"||A==="connect"||A==="copy"||A==="delete"||A==="get"||A==="head"||A==="link"||A==="lock"||A==="m-search"||A==="merge"||A==="mkactivity"||A==="mkcalendar"||A==="mkcol"||A==="move"||A==="notify"||A==="options"||A==="patch"||A==="post"||A==="propfind"||A==="proppatch"||A==="purge"||A==="put"||A==="query"||A==="rebind"||A==="report"||A==="search"||A==="source"||A==="subscribe"||A==="trace"||A==="unbind"||A==="unlink"||A==="unlock"||A==="unsubscribe"))return m0.errors=[{instancePath:Z+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:QS.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var N=D===W}else var N=!0;if(N)if($.validate!==void 0){let A=$.validate,D=W;if(typeof A!=="boolean"){let R=void 0;if(R===void 0)if(A==="false"||A===0||A===null)R=!1;else if(A==="true"||A===1)R=!0;else return m0.errors=[{instancePath:Z+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(R!==void 0){if(A=R,$!==void 0)$.validate=R}}var N=D===W}else var N=!0}}}}}}}}}else return m0.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return m0.errors=J,W===0}});var VH=I((vu,m6)=>{var XS=u("assert"),U5=QH(),tQ=BH(),zH=UH();function z5($,Z,Q){if(Q===void 0)return new u6($,Z);else return eQ($,Z,Q)}function YS($,Z){let Q=$._lightMyRequest.payload;if(!Q||Q._readableState||typeof Q.resume!=="function")return Z();let X=[];Q.on("data",(Y)=>X.push(Buffer.from(Y))),Q.on("end",()=>{let Y=Buffer.concat(X);return $.headers["content-length"]=$.headers["content-length"]||""+Y.length,delete $.headers["transfer-encoding"],$._lightMyRequest.payload=Y,Z()}),Q.resume()}function wH($,Z,Q,X){return Q.once("error",function(Y){if(this.destroyed)X.destroy(Y)}),Q.once("close",function(){if(this.destroyed&&!this._error)X.destroy()}),YS(Q,()=>$.call(Z,Q,X))}function eQ($,Z,Q){if(Z=typeof Z==="string"?{url:Z}:Z,Z.validate!==!1){if(XS(typeof $==="function","dispatchFunc should be a function"),!zH(Z))throw Error(zH.errors.map((W)=>W.message))}let X=Z.server||{},Y=Z.Request?U5.CustomRequest:U5;if($.request&&$.request.app===$)Object.setPrototypeOf(Object.getPrototypeOf($.request),Y.prototype),Object.setPrototypeOf(Object.getPrototypeOf($.response),tQ.prototype);if(typeof Q==="function"){let J=new Y(Z),W=new tQ(J,Q);return wH($,X,J,W)}else return new Promise((J,W)=>{let G=new Y(Z),K=new tQ(G,J,W);wH($,X,G,K)})}function u6($,Z){if(typeof Z==="string")this.option={url:Z};else this.option=Object.assign({},Z);if(this.dispatch=$,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1)process.nextTick(()=>{if(!this._hasInvoked)this.end()})}var JS=["delete","get","head","options","patch","post","put","trace"];JS.forEach(($)=>{u6.prototype[$]=function(Z){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");return this.option.url=Z,this.option.method=$.toUpperCase(),this}});var WS=["body","cookies","headers","payload","query"];WS.forEach(($)=>{u6.prototype[$]=function(Z){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");return this.option[$]=Z,this}});u6.prototype.end=function($){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");if(this._hasInvoked=!0,typeof $==="function")eQ(this.dispatch,this.option,$);else return this._promise=eQ(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(($)=>{if($==="constructor")return;u6.prototype[$]=function(...Z){if(!this._promise){if(this._hasInvoked===!0)throw Error("The dispatch function has already been invoked");this._hasInvoked=!0,this._promise=eQ(this.dispatch,this.option)}return this._promise[$](...Z)}});function GS($){return $ instanceof U5||$ instanceof tQ||$?.constructor?.name==="_CustomLMRRequest"}m6.exports=z5;m6.exports.default=z5;m6.exports.inject=z5;m6.exports.isInjection=GS});var EH=I((yu,i6)=>{var KS=kG(),X7=u("http"),BS=u("diagnostics_channel"),l6,{kAvvioBoot:c6,kChildren:w5,kServerBindings:HH,kBodyLimit:US,kSupportedHTTPMethods:d$,kRoutePrefix:MH,kLogLevel:zS,kLogSerializers:wS,kHooks:V5,kSchemaController:q$,kRequestAcceptVersion:VS,kReplySerializerDefault:AH,kContentTypeParser:HS,kReply:MS,kRequest:AS,kFourOhFour:FS,kState:I0,kOptions:H5,kPluginNameChain:d6,kSchemaErrorFormatter:M5,kErrorHandler:$7,kKeepAliveConnections:A5,kChildLoggerFactory:F5,kGenReqId:N5,kErrorHandlerAlreadySet:Z7,kHandlerTimeout:NS}=u0(),{createServer:OS}=B9(),p6=XQ(),Q7=BQ(),jS=UQ(),p$=w6(),i$=kY(),FH=NJ(),{Hooks:DS,hookRunnerApplication:NH,supportedHooks:O5}=w$(),{createChildLogger:OH,defaultChildLoggerFactory:TS,createLogger:qS}=G6(),jH=fJ(),{getGenReqId:DH,reqIdGenFactory:PH}=CQ(),{buildRouting:fS,validateBodyLimitOption:LS,buildRouterOptions:RS}=jV(),PS=PV(),CH=EV(),CS=gV(),{appendStackTrace:ES,AVVIO_ERRORS_MAP:TH,...n$}=d0(),bS=YX(),{defaultInitOptions:w1}=CH,{FST_ERR_ASYNC_CONSTRAINT:_S,FST_ERR_BAD_URL:IS,FST_ERR_OPTIONS_NOT_OBJ:SS,FST_ERR_QSP_NOT_FN:xS,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:kS,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:vS,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:yS,FST_ERR_INSTANCE_ALREADY_LISTENING:gS,FST_ERR_REOPENED_CLOSE_SERVER:hS,FST_ERR_ROUTE_REWRITE_NOT_STR:uS,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:qH,FST_ERR_ERROR_HANDLER_NOT_FN:mS,FST_ERR_ERROR_HANDLER_ALREADY_SET:lS,FST_ERR_ROUTE_METHOD_INVALID:cS}=n$,{buildErrorHandler:fH}=B6(),{FSTWRN004:dS}=G8(),LH=BS.channel("fastify.initialization");function j5($){let{options:Z,genReqId:Q,disableRequestLogging:X,hasLogger:Y,initialConfig:J}=pS($,S,y),W=fS(Z.routerOptions),G=PS(Z),K=C(W,Z),{server:B,listen:U,forceCloseConnections:w,serverHasCloseAllConnections:H,serverHasCloseHttp2Sessions:V,keepAliveConnections:z}=OS(Z,K),N=p6.setupResponseListeners,F=FH.buildSchemaController(null,Z.schemaController),O={[I0]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[A5]:z,[d$]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[H5]:Z,[w5]:[],[HH]:[],[US]:Z.bodyLimit,[NS]:Z.handlerTimeout,[MH]:"",[zS]:"",[wS]:null,[V5]:new DS,[q$]:F,[M5]:null,[$7]:fH(),[Z7]:!1,[F5]:Z.childLoggerFactory||TS,[AH]:null,[HS]:new i$(Z.bodyLimit,Z.onProtoPoisoning||w1.onProtoPoisoning,Z.onConstructorPoisoning||w1.onConstructorPoisoning),[MS]:p6.buildReply(p6),[AS]:Q7.buildRequest(Q7,Z.trustProxy),[FS]:G,[jH.kRegisteredPlugins]:[],[d6]:["fastify"],[c6]:null,[N5]:Q,routing:K,delete:function(P,_,x){return W.prepareRoute.call(this,{method:"DELETE",url:P,options:_,handler:x})},get:function(P,_,x){return W.prepareRoute.call(this,{method:"GET",url:P,options:_,handler:x})},head:function(P,_,x){return W.prepareRoute.call(this,{method:"HEAD",url:P,options:_,handler:x})},trace:function(P,_,x){return W.prepareRoute.call(this,{method:"TRACE",url:P,options:_,handler:x})},patch:function(P,_,x){return W.prepareRoute.call(this,{method:"PATCH",url:P,options:_,handler:x})},post:function(P,_,x){return W.prepareRoute.call(this,{method:"POST",url:P,options:_,handler:x})},put:function(P,_,x){return W.prepareRoute.call(this,{method:"PUT",url:P,options:_,handler:x})},options:function(P,_,x){return W.prepareRoute.call(this,{method:"OPTIONS",url:P,options:_,handler:x})},all:function(P,_,x){return W.prepareRoute.call(this,{method:this.supportedMethods,url:P,options:_,handler:x})},route:function(P){return W.route.call(this,{options:P})},hasRoute:function(P){return W.hasRoute.call(this,{options:P})},findRoute:function(P){return W.findRoute(P)},log:Z.logger,withTypeProvider:T,addHook:b,addSchema:q,getSchema:F.getSchema.bind(F),getSchemas:F.getSchemas.bind(F),setValidatorCompiler:s,setSerializerCompiler:p,setSchemaController:r,setReplySerializer:X0,setSchemaErrorFormatter:a,setGenReqId:E,addContentTypeParser:i$.helpers.addContentTypeParser,hasContentTypeParser:i$.helpers.hasContentTypeParser,getDefaultJsonParser:i$.defaultParsers.getDefaultJsonParser,defaultTextParser:i$.defaultParsers.defaultTextParser,removeContentTypeParser:i$.helpers.removeContentTypeParser,removeAllContentTypeParsers:i$.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(L){return this[jH.kRegisteredPlugins].includes(L)||this[d6].includes(L)},listen:U,server:B,addresses:function(){let L=this[HH].map((P)=>P.address());return L.push(this.server.address()),L.filter((P)=>P)},decorate:p$.add,hasDecorator:p$.exist,decorateReply:p$.decorateReply,decorateRequest:p$.decorateRequest,hasRequestDecorator:p$.existRequest,hasReplyDecorator:p$.existReply,getDecorator:p$.getInstanceDecorator,addHttpMethod:h,inject:f,printRoutes:t,setNotFoundHandler:n,setErrorHandler:Y0,setChildLoggerFactory:B0,initialConfig:J,addConstraintStrategy:W.addConstraintStrategy.bind(W),hasConstraintStrategy:W.hasConstraintStrategy.bind(W)};if(Object.defineProperties(O,{listeningOrigin:{get(){let L=this.addresses().slice(-1).pop();if(typeof L==="string")return L;let P=L.family==="IPv6"?`[${L.address}]`:L.address;return`${this[H5].https?"https":"http"}://${P}:${L.port}`}},pluginName:{configurable:!0,get(){if(this[d6].length>1)return this[d6].join(" -> ");return this[d6][0]}},prefix:{configurable:!0,get(){return this[MH]}},validatorCompiler:{configurable:!0,get(){return this[q$].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[q$].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[F5]}},version:{configurable:!0,get(){return"5.8.5"}},errorHandler:{configurable:!0,get(){return this[$7].func}},genReqId:{configurable:!0,get(){return this[N5]}},supportedMethods:{configurable:!1,get(){return[...this[d$].bodyless,...this[d$].bodywith]}}}),Z.schemaErrorFormatter)RH(Z.schemaErrorFormatter),O[M5]=Z.schemaErrorFormatter.bind(O);let j=Number(Z.pluginTimeout),M=KS(O,{autostart:!1,timeout:isNaN(j)===!1?j:w1.pluginTimeout,expose:{use:"register"}});M.override=CS,M.on("start",()=>O[I0].started=!0),O[c6]=O.ready,O.ready=R,O.printPlugins=M.prettyPrint.bind(M),M.once("preReady",()=>{O.onClose((L,P)=>{O[I0].closing=!0,W.closeRoutes(),NH("preClose",O[c6],O,function(){if(O[I0].listening){if(w==="idle")L.server.closeIdleConnections();else if(H&&w)L.server.closeAllConnections();else if(w===!0)for(let _ of O[A5])_.destroy(),O[A5].delete(_)}if(V)L.server.closeHttp2Sessions();if(!Z.serverFactory||O[I0].listening)L.server.close(function(_){if(_&&_.code!=="ERR_SERVER_NOT_RUNNING")P(null);else P()});else process.nextTick(P,null)})})});let A=new jS({server:O,config:{}});if(O.setNotFoundHandler(),G.arrange404(O),W.setup(Z,{avvio:M,fourOhFour:G,hasLogger:Y,setupResponseListeners:N,throwIfAlreadyStarted:D,keepAliveConnections:z}),B.on("clientError",Z.clientErrorHandler.bind(O)),LH.hasSubscribers)LH.publish({fastify:O});if("asyncDispose"in Symbol)O[Symbol.asyncDispose]=function(){return O.close()};return O;function D(L){if(O[I0].started)throw new gS(L)}function f(L,P){if(l6===void 0)l6=VH();if(O[I0].started){if(O[I0].closing){let _=new hS;if(P){P(_);return}else return Promise.reject(_)}return l6(K,L,P)}if(P)this.ready((_)=>{if(_)P(_,null);else l6(K,L,P)});else return l6((_,x)=>{this.ready(function(l){if(l){x.emit("error",l);return}K(_,x)})},L)}function R(L){if(this[I0].readyResolver!==null){if(L!=null){this[I0].readyResolver.promise.then(()=>L(null,O),L);return}return this[I0].readyResolver.promise}if(process.nextTick(P),this[I0].readyResolver=bS.withResolvers(),!L)return this[I0].readyResolver.promise;else this[I0].readyResolver.promise.then(()=>L(null,O),L);function P(){O[c6]((x,l)=>{if(x||O[I0].started||O[I0].ready||O[I0].booting)_(x);else O[I0].booting=!0,NH("onReady",O[c6],O,_);l()})}function _(x){if(x=x!=null&&TH[x.code]!=null?ES(x,new TH[x.code](x.message)):x,x)return O[I0].readyResolver.reject(x);O[I0].readyResolver.resolve(O),O[I0].booting=!1,O[I0].ready=!0,O[I0].readyResolver=null}}function T(){return this}function b(L,P){if(D('Cannot call "addHook"!'),P==null)throw new n$.FST_ERR_HOOK_INVALID_HANDLER(L,P);if(L==="onSend"||L==="preSerialization"||L==="onError"||L==="preParsing"){if(P.constructor.name==="AsyncFunction"&&P.length===4)throw new n$.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(L==="onReady"||L==="onListen"){if(P.constructor.name==="AsyncFunction"&&P.length!==0)throw new n$.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(L==="onRequestAbort"){if(P.constructor.name==="AsyncFunction"&&P.length!==1)throw new n$.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(P.constructor.name==="AsyncFunction"&&P.length===3)throw new n$.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;if(L==="onClose")this.onClose(P.bind(this));else if(L==="onReady"||L==="onListen"||L==="onRoute")this[V5].add(L,P);else this.after((x,l)=>{try{_.call(this,L,P),l(x)}catch(m){l(m)}});return this;function _(x,l){this[V5].add(x,l),this[w5].forEach((m)=>_.call(m,x,l))}}function q(L){return D('Cannot call "addSchema"!'),this[q$].add(L),this[w5].forEach((P)=>P.addSchema(L)),this}function S(L,P){if(L.headers["accept-version"]!==void 0)L.headers[VS]=L.headers["accept-version"],L.headers["accept-version"]=void 0;G.router.lookup(L,P)}function y(L,P,_){if(Z.frameworkErrors){let l=DH(A.server,P),m=OH(A,Z.logger,P,l),e=new Q7(l,null,P,null,m,A),Z0=new p6(_,e,m);if((typeof X==="function"?X(P):X)===!1)m.info({req:e},"incoming request");return Z.frameworkErrors(new IS(L),e,Z0)}let x=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${L}' is not a valid url component`,statusCode:400});_.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(x)}),_.end(x)}function v(L,P,_){if(L===!1)return;return function(l){if(l){if(Z.frameworkErrors){let e=DH(A.server,P),Z0=OH(A,Z.logger,P,e),T0=new Q7(e,null,P,null,Z0,A),q0=new p6(_,T0,Z0);if((typeof X==="function"?X(P):X)===!1)Z0.info({req:T0},"incoming request");return Z.frameworkErrors(new _S,T0,q0)}let m='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';_.writeHead(500,{"Content-Type":"application/json","Content-Length":m.length}),_.end(m)}}}function n(L,P){return D('Cannot call "setNotFoundHandler"!'),G.setNotFoundHandler.call(this,L,P,M,W.routeHandler),this}function s(L){return D('Cannot call "setValidatorCompiler"!'),this[q$].setValidatorCompiler(L),this}function a(L){return D('Cannot call "setSchemaErrorFormatter"!'),RH(L),this[M5]=L.bind(this),this}function p(L){return D('Cannot call "setSerializerCompiler"!'),this[q$].setSerializerCompiler(L),this}function r(L){D('Cannot call "setSchemaController"!');let P=this[q$],_=FH.buildSchemaController(P,Object.assign({},P.opts,L));return this[q$]=_,this.getSchema=_.getSchema.bind(_),this.getSchemas=_.getSchemas.bind(_),this}function X0(L){return D('Cannot call "setReplySerializer"!'),this[AH]=L,this}function Y0(L){if(D('Cannot call "setErrorHandler"!'),typeof L!=="function")throw new mS;if(!Z.allowErrorHandlerOverride&&this[Z7])throw new lS;else if(this[Z7])dS("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride");return this[Z7]=!0,this[$7]=fH(this[$7],L.bind(this)),this}function B0(L){return D('Cannot call "setChildLoggerFactory"!'),this[F5]=L,this}function t(L={}){return L.includeMeta=L.includeHooks?L.includeMeta?O5.concat(L.includeMeta):O5:L.includeMeta,W.printRoutes(L)}function C(L,{rewriteUrl:P,logger:_}){let x;return function(m,e){if(x===void 0)x=L.isAsyncConstraint();if(P){m.originalUrl=m.url;let Z0=P.call(O,m);if(typeof Z0==="string")m.url=Z0;else{let T0=new uS(m.url,typeof Z0);m.destroy(T0)}}L.routing(m,e,v(x,m,e))}}function E(L){return D('Cannot call "setGenReqId"!'),this[N5]=PH(this[H5].requestIdHeader,L),this}function h(L,{hasBody:P=!1}={}){if(typeof L!=="string"||X7.METHODS.indexOf(L)===-1)throw new cS;if(P===!0)this[d$].bodywith.add(L),this[d$].bodyless.delete(L);else this[d$].bodywith.delete(L),this[d$].bodyless.add(L);let _=L.toLowerCase();if(!this.hasDecorator(_))this.decorate(_,function(x,l,m){return W.prepareRoute.call(this,{method:L,url:x,options:l,handler:m})});return this}}function pS($,Z,Q){if($&&typeof $!=="object")throw new SS;else $=Object.assign({},$);if($.querystringParser&&typeof $.querystringParser!=="function"||$.routerOptions?.querystringParser&&typeof $.routerOptions.querystringParser!=="function")throw new xS(typeof($.querystringParser??$.routerOptions.querystringParser));if($.schemaController&&$.schemaController.bucket&&typeof $.schemaController.bucket!=="function")throw new kS(typeof $.schemaController.bucket);LS($.bodyLimit);let X=typeof $.requestIdHeader==="string"&&$.requestIdHeader.length!==0?$.requestIdHeader.toLowerCase():$.requestIdHeader===!0&&"request-id",Y=PH(X,$.genReqId),J=$.requestIdLogLabel||"reqId";$.bodyLimit=$.bodyLimit||w1.bodyLimit;let W=$.disableRequestLogging||!1,G=Object.assign({customOptions:{},plugins:[]},$.ajv);if(!G.customOptions||Object.prototype.toString.call(G.customOptions)!=="[object Object]")throw new vS(typeof G.customOptions);if(!G.plugins||!Array.isArray(G.plugins))throw new yS(typeof G.plugins);let{logger:K,hasLogger:B}=qS($);$.connectionTimeout=$.connectionTimeout||w1.connectionTimeout,$.keepAliveTimeout=$.keepAliveTimeout||w1.keepAliveTimeout,$.maxRequestsPerSocket=$.maxRequestsPerSocket||w1.maxRequestsPerSocket,$.requestTimeout=$.requestTimeout||w1.requestTimeout,$.logger=K,$.requestIdHeader=X,$.requestIdLogLabel=J,$.disableRequestLogging=W,$.ajv=G,$.clientErrorHandler=$.clientErrorHandler||nS,$.allowErrorHandlerOverride=$.allowErrorHandlerOverride??w1.allowErrorHandlerOverride;let U=CH($);return $.exposeHeadRoutes=U.exposeHeadRoutes,$.http2SessionTimeout=U.http2SessionTimeout,$.routerOptions=RS($,{defaultRoute:Z,onBadUrl:Q,ignoreTrailingSlash:w1.ignoreTrailingSlash,ignoreDuplicateSlashes:w1.ignoreDuplicateSlashes,maxParamLength:w1.maxParamLength,allowUnsafeRegex:w1.allowUnsafeRegex,buildPrettyMeta:iS,useSemicolonDelimiter:w1.useSemicolonDelimiter}),{options:$,genReqId:Y,disableRequestLogging:W,hasLogger:B,initialConfig:U}}function iS($){let Z={};return["errorHandler","logLevel","logSerializers"].concat(O5).forEach((X)=>{Z[X]=$.store[X]}),Object.assign({},Z)}function nS($,Z){if($.code==="ECONNRESET"||Z.destroyed)return;let Q,X,Y,J;if($.code==="ERR_HTTP_REQUEST_TIMEOUT")X="408",Y=X7.STATUS_CODES[X],Q=`{"error":"${Y}","message":"Client Timeout","statusCode":408}`,J="timeout";else if($.code==="HPE_HEADER_OVERFLOW")X="431",Y=X7.STATUS_CODES[X],Q=`{"error":"${Y}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,J="header_overflow";else X="400",Y=X7.STATUS_CODES[X],Q=`{"error":"${Y}","message":"Client Error","statusCode":400}`,J="error";if(this.log.trace({err:$},`client ${J}`),Z.writable)Z.write(`HTTP/1.1 ${X} ${Y}\r
366
+ Content-Length: ${Q.length}\r
367
+ Content-Type: application/json\r
368
+ \r
369
+ ${Q}`);Z.destroy($)}function RH($){if(typeof $!=="function")throw new qH(typeof $);else if($.constructor.name==="AsyncFunction")throw new qH("AsyncFunction")}i6.exports=j5;i6.exports.errorCodes=n$;i6.exports.fastify=j5;i6.exports.default=j5});var _H=I((gu,D5)=>{var sS=/at\s(?:.*\.)?plugin\s.*\n\s*(.*)/,aS=/(\w*(\.\w*)*)\..*/;D5.exports=function(Z){if(Z.name.length>0)return Z.name;let Q=Error.stackTraceLimit;Error.stackTraceLimit=10;try{throw Error("anonymous function")}catch(X){return Error.stackTraceLimit=Q,bH(X.stack)}};function bH($){let Z=$.match(sS);return Z?Z[1].split(/[/\\]/).slice(-1)[0].match(aS)[1]:"anonymous"}D5.exports.extractPluginName=bH});var SH=I((hu,IH)=>{IH.exports=function(Z){if(Z[0]==="@")Z=Z.slice(1).replace("/","-");return Z.replace(/-(.)/g,function(Q,X){return X.toUpperCase()})}});var xH=I((uu,Y7)=>{var oS=_H(),rS=SH(),tS=0;function T5($,Z={}){let Q=!1;if($.default!==void 0)$=$.default;if(typeof $!=="function")throw TypeError(`fastify-plugin expects a function, instead got a '${typeof $}'`);if(typeof Z==="string")Z={fastify:Z};if(typeof Z!=="object"||Array.isArray(Z)||Z===null)throw TypeError("The options object should be an object");if(Z.fastify!==void 0&&typeof Z.fastify!=="string")throw TypeError(`fastify-plugin expects a version string, instead got '${typeof Z.fastify}'`);if(!Z.name)Q=!0,Z.name=oS($)+"-auto-"+tS++;if($[Symbol.for("skip-override")]=Z.encapsulate!==!0,$[Symbol.for("fastify.display-name")]=Z.name,$[Symbol.for("plugin-meta")]=Z,!$.default)$.default=$;let X=rS(Z.name);if(!Q&&!$[X])$[X]=$;return $}Y7.exports=T5;Y7.exports.default=T5;Y7.exports.fastifyPlugin=T5});var kH=I((Qx)=>{var eS=/^(-?(?:\d+)?\.?\d+) *(m(?:illiseconds?|s(?:ecs?)?))?(s(?:ec(?:onds?|s)?)?)?(m(?:in(?:utes?|s)?)?)?(h(?:ours?|rs?)?)?(d(?:ays?)?)?(w(?:eeks?|ks?)?)?(y(?:ears?|rs?)?)?$/,J7=1000,W7=J7*60,G7=W7*60,s6=G7*24,q5=s6*365.25;function $x($){var Z,Q=$.toLowerCase().match(eS);if(Q!=null&&(Z=parseFloat(Q[1]))){if(Q[3]!=null)return Z*J7;if(Q[4]!=null)return Z*W7;if(Q[5]!=null)return Z*G7;if(Q[6]!=null)return Z*s6;if(Q[7]!=null)return Z*s6*7;if(Q[8]!=null)return Z*q5;return Z}}function n6($,Z,Q,X){var Y=($|0)===$?$:~~($+0.5);return Z+Y+(X?" "+Q+(Y!=1?"s":""):Q[0])}function Zx($,Z){var Q=$<0?"-":"",X=$<0?-$:$;if(X<J7)return $+(Z?" ms":"ms");if(X<W7)return n6(X/J7,Q,"second",Z);if(X<G7)return n6(X/W7,Q,"minute",Z);if(X<s6)return n6(X/G7,Q,"hour",Z);if(X<q5)return n6(X/s6,Q,"day",Z);return n6(X/q5,Q,"year",Z)}Qx.format=Zx;Qx.parse=$x});var yH=I((lu,vH)=>{var{LruMap:Jx}=EY();function K7($,Z,Q=5000){this.continueExceeding=$,this.exponentialBackoff=Z,this.lru=new Jx(Q)}K7.prototype.incr=function($,Z,Q,X){let Y=Date.now(),J=this.lru.get($);if(!J)J={current:1,ttl:Q,iterationStartMs:Y};else if(J.iterationStartMs+Q<=Y)J.current=1,J.ttl=Q,J.iterationStartMs=Y;else if(++J.current,this.continueExceeding&&J.current>X)J.ttl=Q,J.iterationStartMs=Y;else if(this.exponentialBackoff&&J.current>X){let W=J.current-X-1,G=Q*2**W;J.ttl=Number.isSafeInteger(G)?G:Number.MAX_SAFE_INTEGER,J.iterationStartMs=Y}else J.ttl=Q-(Y-J.iterationStartMs);this.lru.set($,J),Z(null,J)};K7.prototype.child=function($){return new K7($.continueExceeding,$.exponentialBackoff,$.cache)};vH.exports=K7});var hH=I((cu,gH)=>{function B7($,Z,Q,X="fastify-rate-limit-"){if(this.continueExceeding=$,this.exponentialBackoff=Z,this.redis=Q,this.key=X,!this.redis.rateLimit)this.redis.defineCommand("rateLimit",{numberOfKeys:1,lua:`
370
+ -- Key to operate on
371
+ local key = KEYS[1]
372
+ -- Time window for the TTL
373
+ local timeWindow = tonumber(ARGV[1])
374
+ -- Max requests
375
+ local max = tonumber(ARGV[2])
376
+ -- Flag to determine if TTL should be reset after exceeding
377
+ local continueExceeding = ARGV[3] == 'true'
378
+ --Flag to determine if exponential backoff should be applied
379
+ local exponentialBackoff = ARGV[4] == 'true'
380
+
381
+ --Max safe integer
382
+ local MAX_SAFE_INTEGER = (2^53) - 1
383
+
384
+ -- Increment the key's value
385
+ local current = redis.call('INCR', key)
386
+
387
+ if current == 1 or (continueExceeding and current > max) then
388
+ redis.call('PEXPIRE', key, timeWindow)
389
+ elseif exponentialBackoff and current > max then
390
+ local backoffExponent = current - max - 1
391
+ timeWindow = math.min(timeWindow * (2 ^ backoffExponent), MAX_SAFE_INTEGER)
392
+ redis.call('PEXPIRE', key, timeWindow)
393
+ else
394
+ timeWindow = redis.call('PTTL', key)
395
+ end
396
+
397
+ return {current, timeWindow}
398
+ `})}B7.prototype.incr=function($,Z,Q,X){this.redis.rateLimit(this.key+$,Q,X,this.continueExceeding,this.exponentialBackoff,(Y,J)=>{Y?Z(Y,null):Z(null,{current:J[0],ttl:J[1]})})};B7.prototype.child=function($){return new B7($.continueExceeding,$.exponentialBackoff,this.redis,`${this.key}${$.routeInfo.method}${$.routeInfo.url}-`)};gH.exports=B7});var iH=I((du,U7)=>{var Wx=xH(),{parse:lH,format:Gx}=kH(),Kx=yH(),Bx=hH(),Ux={rateLimit:"x-ratelimit-limit",rateRemaining:"x-ratelimit-remaining",rateReset:"x-ratelimit-reset",retryAfter:"retry-after"},zx={rateLimit:"ratelimit-limit",rateRemaining:"ratelimit-remaining",rateReset:"ratelimit-reset",retryAfter:"retry-after"},f5=()=>{},wx=($)=>$.ip,Vx=($,Z)=>{let Q=Error(`Rate limit exceeded, retry in ${Z.after}`);return Q.statusCode=Z.statusCode,Q};async function L5($,Z){let Q={global:typeof Z.global==="boolean"?Z.global:!0};if(typeof Z.enableDraftSpec==="boolean"&&Z.enableDraftSpec)Q.enableDraftSpec=!0,Q.labels=zx;else Q.enableDraftSpec=!1,Q.labels=Ux;if(Q.addHeaders=Object.assign({[Q.labels.rateLimit]:!0,[Q.labels.rateRemaining]:!0,[Q.labels.rateReset]:!0,[Q.labels.retryAfter]:!0},Z.addHeaders),Q.addHeadersOnExceeding=Object.assign({[Q.labels.rateLimit]:!0,[Q.labels.rateRemaining]:!0,[Q.labels.rateReset]:!0},Z.addHeadersOnExceeding),Number.isFinite(Z.max)&&Z.max>=0)Q.max=Math.trunc(Z.max);else if(typeof Z.max==="function")Q.max=Z.max;else Q.max=1000;if(Number.isFinite(Z.timeWindow)&&Z.timeWindow>=0)Q.timeWindow=Math.trunc(Z.timeWindow);else if(typeof Z.timeWindow==="string")Q.timeWindow=lH(Z.timeWindow);else if(typeof Z.timeWindow==="function")Q.timeWindow=Z.timeWindow;else Q.timeWindow=60000;if(Q.hook=Z.hook||"onRequest",Q.allowList=Z.allowList||Z.whitelist||null,Q.ban=Number.isFinite(Z.ban)&&Z.ban>=0?Math.trunc(Z.ban):-1,Q.onBanReach=typeof Z.onBanReach==="function"?Z.onBanReach:f5,Q.onExceeding=typeof Z.onExceeding==="function"?Z.onExceeding:f5,Q.onExceeded=typeof Z.onExceeded==="function"?Z.onExceeded:f5,Q.continueExceeding=typeof Z.continueExceeding==="boolean"?Z.continueExceeding:!1,Q.exponentialBackoff=typeof Z.exponentialBackoff==="boolean"?Z.exponentialBackoff:!1,Q.keyGenerator=typeof Z.keyGenerator==="function"?Z.keyGenerator:wx,typeof Z.errorResponseBuilder==="function")Q.errorResponseBuilder=Z.errorResponseBuilder,Q.isCustomErrorMessage=!0;else Q.errorResponseBuilder=Vx,Q.isCustomErrorMessage=!1;Q.skipOnError=typeof Z.skipOnError==="boolean"?Z.skipOnError:!1;let X={rateLimitRan:Symbol("fastify.request.rateLimitRan"),store:null};if(Z.store){let Y=Z.store;X.store=new Y(Q)}else if(Z.redis)X.store=new Bx(Q.continueExceeding,Q.exponentialBackoff,Z.redis,Z.nameSpace);else X.store=new Kx(Q.continueExceeding,Q.exponentialBackoff,Z.cache);if($.decorateRequest(X.rateLimitRan,!1),!$.hasDecorator("createRateLimit"))$.decorate("createRateLimit",(Y)=>{let J=uH(X,Q,Y);return(W)=>dH.apply(this,J.concat(W))});if(!$.hasDecorator("rateLimit"))$.decorate("rateLimit",(Y)=>{let J=uH(X,Q,Y);return pH(...J)});$.addHook("onRoute",(Y)=>{if(Y.config?.rateLimit!=null){if(typeof Y.config.rateLimit==="object"){let J=Object.create(X),W=cH(Q,Y.config.rateLimit,{routeInfo:Y});J.store=X.store.child(W),mH(J,W,Y)}else if(Y.config.rateLimit!==!1)throw Error("Unknown value for route rate-limit configuration")}else if(Q.global)mH(X,Q,Y)})}function cH(...$){let Z=Object.assign({},...$);if(Number.isFinite(Z.timeWindow)&&Z.timeWindow>=0)Z.timeWindow=Math.trunc(Z.timeWindow);else if(typeof Z.timeWindow==="string")Z.timeWindow=lH(Z.timeWindow);else if(typeof Z.timeWindow!=="function")Z.timeWindow=60000;if(Number.isFinite(Z.max)&&Z.max>=0)Z.max=Math.trunc(Z.max);else if(typeof Z.max!=="function")Z.max=1000;if(Number.isFinite(Z.ban)&&Z.ban>=0)Z.ban=Math.trunc(Z.ban);else Z.ban=-1;if(Z.groupId!==void 0&&typeof Z.groupId!=="string")throw Error("groupId must be a string");return Z}function uH($,Z,Q){if(typeof Q==="object"){let X=Object.create($),Y=cH(Z,Q,{routeInfo:{}});return X.store=X.store.child(Y),[X,Y]}return[$,Z]}function mH($,Z,Q){let X=Z.hook,Y=pH($,Z);if(Array.isArray(Q[X]))Q[X].push(Y);else if(typeof Q[X]==="function")Q[X]=[Q[X],Y];else Q[X]=[Y]}async function dH($,Z,Q){let{store:X}=$,Y=await Z.keyGenerator(Q),J=Q.routeOptions.config?.rateLimit?.groupId;if(J)Y+=J;if(Z.allowList){if(typeof Z.allowList==="function"){if(await Z.allowList(Q,Y))return{isAllowed:!0,key:Y}}else if(Z.allowList.indexOf(Y)!==-1)return{isAllowed:!0,key:Y}}let W=typeof Z.max==="number"?Z.max:await Z.max(Q,Y),G=typeof Z.timeWindow==="number"?Z.timeWindow:await Z.timeWindow(Q,Y),K=0,B=0,U=0;try{let w=await new Promise((H,V)=>{X.incr(Y,(z,N)=>{z?V(z):H(N)},G,W)});K=w.current,B=w.ttl,U=Math.ceil(w.ttl/1000)}catch(w){if(!Z.skipOnError)throw w}return{isAllowed:!1,key:Y,max:W,timeWindow:G,remaining:Math.max(0,W-K),ttl:B,ttlInSeconds:U,isExceeded:K>W,isBanned:Z.ban!==-1&&K-W>Z.ban}}function pH($,Z){let{rateLimitRan:Q}=$;return async(X,Y)=>{if(X[Q])return;X[Q]=!0;let J=await dH($,Z,X);if(J.isAllowed)return;let{key:W,max:G,remaining:K,ttl:B,ttlInSeconds:U,isExceeded:w,isBanned:H}=J;if(!w){if(Z.addHeadersOnExceeding[Z.labels.rateLimit])Y.header(Z.labels.rateLimit,G);if(Z.addHeadersOnExceeding[Z.labels.rateRemaining])Y.header(Z.labels.rateRemaining,K);if(Z.addHeadersOnExceeding[Z.labels.rateReset])Y.header(Z.labels.rateReset,U);Z.onExceeding(X,W);return}if(Z.onExceeded(X,W),Z.addHeaders[Z.labels.rateLimit])Y.header(Z.labels.rateLimit,G);if(Z.addHeaders[Z.labels.rateRemaining])Y.header(Z.labels.rateRemaining,0);if(Z.addHeaders[Z.labels.rateReset])Y.header(Z.labels.rateReset,U);if(Z.addHeaders[Z.labels.retryAfter])Y.header(Z.labels.retryAfter,U);let V={statusCode:429,ban:!1,max:G,ttl:B,after:Gx(U*1000,!0)};if(H)V.statusCode=403,V.ban=!0,Z.onBanReach(X,W);throw Z.errorResponseBuilder(X,V)}}U7.exports=Wx(L5,{fastify:"5.x",name:"@fastify/rate-limit"});U7.exports.default=L5;U7.exports.fastifyRateLimit=L5});var m8={};K$(m8,{required:()=>TA,headers:()=>fA,header:()=>ZW,authorized:()=>qA,ServerAuth:()=>m8,Config:()=>$W});class $W extends e5.Service()("@muxcode/ServerAuthConfig",{password:u8.string("MUXCODE_SERVER_PASSWORD").pipe(u8.option),username:u8.string("MUXCODE_SERVER_USERNAME").pipe(u8.withDefault("muxcode"))}){}function TA($){return I7.isSome($.password)&&$.password.value!==""}function qA($,Z){return I7.isSome(Z.password)&&$.username===Z.username&&t5.value($.password)===Z.password.value}function ZW($){let Z=$?.password??_7.MUXCODE_SERVER_PASSWORD;if(!Z)return;let Q=$?.username??_7.MUXCODE_SERVER_USERNAME??"muxcode";return`Basic ${Buffer.from(`${Q}:${Z}`).toString("base64")}`}function fA($){let Z=ZW($);if(!Z)return;return{Authorization:Z}}var r5={};K$(r5,{use:()=>Mv,toPublicInfo:()=>P7,sort:()=>o5,parseModel:()=>c5,layer:()=>NA,fromModelsDevProvider:()=>FA,defaultModelIDs:()=>Hv,defaultLayer:()=>Fv,Service:()=>XZ,Provider:()=>r5,NoProvidersError:()=>E7,NoModelsError:()=>b7,ModelNotFoundError:()=>y8,Model:()=>HA,ListResult:()=>wv,InitError:()=>C7,Info:()=>a5,ConfigProvidersResult:()=>Vv});var s5=d8(XW(),1);import J$ from"os";var v8={};K$(v8,{layer:()=>mM,experimentalWebSocketsEnabled:()=>uM,defaultLayer:()=>fk,Service:()=>D7,Plugin:()=>v8});var YW=({onSseError:$,onSseEvent:Z,responseTransformer:Q,responseValidator:X,sseDefaultRetryDelay:Y,sseMaxRetryAttempts:J,sseMaxRetryDelay:W,sseSleepFn:G,url:K,...B})=>{let U,w=G??((z)=>new Promise((N)=>setTimeout(N,z)));return{stream:async function*(){let z=Y??3000,N=0,F=B.signal??new AbortController().signal;while(!0){if(F.aborted)break;N++;let O=B.headers instanceof Headers?B.headers:new Headers(B.headers);if(U!==void 0)O.set("Last-Event-ID",U);try{let j=await fetch(K,{...B,headers:O,signal:F});if(!j.ok)throw Error(`SSE failed: ${j.status} ${j.statusText}`);if(!j.body)throw Error("No body in SSE response");let M=j.body.pipeThrough(new TextDecoderStream).getReader(),A="",D=()=>{try{M.cancel()}catch{}};F.addEventListener("abort",D);try{while(!0){let{done:f,value:R}=await M.read();if(f)break;A+=R;let T=A.split(`
399
+
400
+ `);A=T.pop()??"";for(let b of T){let q=b.split(`
401
+ `),S=[],y;for(let s of q)if(s.startsWith("data:"))S.push(s.replace(/^data:\s*/,""));else if(s.startsWith("event:"))y=s.replace(/^event:\s*/,"");else if(s.startsWith("id:"))U=s.replace(/^id:\s*/,"");else if(s.startsWith("retry:")){let a=Number.parseInt(s.replace(/^retry:\s*/,""),10);if(!Number.isNaN(a))z=a}let v,n=!1;if(S.length){let s=S.join(`
402
+ `);try{v=JSON.parse(s),n=!0}catch{v=s}}if(n){if(X)await X(v);if(Q)v=await Q(v)}if(Z?.({data:v,event:y,id:U,retry:z}),S.length)yield v}}}finally{F.removeEventListener("abort",D),M.releaseLock()}break}catch(j){if($?.(j),J!==void 0&&N>=J)break;let M=Math.min(z*2**(N-1),W??30000);await w(M)}}}()}};var JW=async($,Z)=>{let Q=typeof Z==="function"?await Z($):Z;if(!Q)return;if($.scheme==="bearer")return`Bearer ${Q}`;if($.scheme==="basic")return`Basic ${btoa(Q)}`;return Q};var S7={bodySerializer:($)=>JSON.stringify($,(Z,Q)=>typeof Q==="bigint"?Q.toString():Q)};var LA=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},RA=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},PA=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},JZ=({allowReserved:$,explode:Z,name:Q,style:X,value:Y})=>{if(!Z){let G=($?Y:Y.map((K)=>encodeURIComponent(K))).join(RA(X));switch(X){case"label":return`.${G}`;case"matrix":return`;${Q}=${G}`;case"simple":return G;default:return`${Q}=${G}`}}let J=LA(X),W=Y.map((G)=>{if(X==="label"||X==="simple")return $?G:encodeURIComponent(G);return $8({allowReserved:$,name:Q,value:G})}).join(J);return X==="label"||X==="matrix"?J+W:W},$8=({allowReserved:$,name:Z,value:Q})=>{if(Q===void 0||Q===null)return"";if(typeof Q==="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${Z}=${$?Q:encodeURIComponent(Q)}`},WZ=({allowReserved:$,explode:Z,name:Q,style:X,value:Y,valueOnly:J})=>{if(Y instanceof Date)return J?Y.toISOString():`${Q}=${Y.toISOString()}`;if(X!=="deepObject"&&!Z){let K=[];Object.entries(Y).forEach(([U,w])=>{K=[...K,U,$?w:encodeURIComponent(w)]});let B=K.join(",");switch(X){case"form":return`${Q}=${B}`;case"label":return`.${B}`;case"matrix":return`;${Q}=${B}`;default:return B}}let W=PA(X),G=Object.entries(Y).map(([K,B])=>$8({allowReserved:$,name:X==="deepObject"?`${Q}[${K}]`:K,value:B})).join(W);return X==="label"||X==="matrix"?W+G:G};var CA=/\{[^{}]+\}/g,EA=({path:$,url:Z})=>{let Q=Z,X=Z.match(CA);if(X)for(let Y of X){let J=!1,W=Y.substring(1,Y.length-1),G="simple";if(W.endsWith("*"))J=!0,W=W.substring(0,W.length-1);if(W.startsWith("."))W=W.substring(1),G="label";else if(W.startsWith(";"))W=W.substring(1),G="matrix";let K=$[W];if(K===void 0||K===null)continue;if(Array.isArray(K)){Q=Q.replace(Y,JZ({explode:J,name:W,style:G,value:K}));continue}if(typeof K==="object"){Q=Q.replace(Y,WZ({explode:J,name:W,style:G,value:K,valueOnly:!0}));continue}if(G==="matrix"){Q=Q.replace(Y,`;${$8({name:W,value:K})}`);continue}let B=encodeURIComponent(G==="label"?`.${K}`:K);Q=Q.replace(Y,B)}return Q},WW=({baseUrl:$,path:Z,query:Q,querySerializer:X,url:Y})=>{let J=Y.startsWith("/")?Y:`/${Y}`,W=($??"")+J;if(Z)W=EA({path:Z,url:W});let G=Q?X(Q):"";if(G.startsWith("?"))G=G.substring(1);if(G)W+=`?${G}`;return W};var GW=({allowReserved:$,array:Z,object:Q}={})=>{return(Y)=>{let J=[];if(Y&&typeof Y==="object")for(let W in Y){let G=Y[W];if(G===void 0||G===null)continue;if(Array.isArray(G)){let K=JZ({allowReserved:$,explode:!0,name:W,style:"form",value:G,...Z});if(K)J.push(K)}else if(typeof G==="object"){let K=WZ({allowReserved:$,explode:!0,name:W,style:"deepObject",value:G,...Q});if(K)J.push(K)}else{let K=$8({allowReserved:$,name:W,value:G});if(K)J.push(K)}}return J.join("&")}},KW=($)=>{if(!$)return"stream";let Z=$.split(";")[0]?.trim();if(!Z)return;if(Z.startsWith("application/json")||Z.endsWith("+json"))return"json";if(Z==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((Q)=>Z.startsWith(Q)))return"blob";if(Z.startsWith("text/"))return"text";return},bA=($,Z)=>{if(!Z)return!1;if($.headers.has(Z)||$.query?.[Z]||$.headers.get("Cookie")?.includes(`${Z}=`))return!0;return!1},BW=async({security:$,...Z})=>{for(let Q of $){if(bA(Z,Q.name))continue;let X=await JW(Q,Z.auth);if(!X)continue;let Y=Q.name??"Authorization";switch(Q.in){case"query":if(!Z.query)Z.query={};Z.query[Y]=X;break;case"cookie":Z.headers.append("Cookie",`${Y}=${X}`);break;case"header":default:Z.headers.set(Y,X);break}}},x7=($)=>WW({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:GW($.querySerializer),url:$.url}),k7=($,Z)=>{let Q={...$,...Z};if(Q.baseUrl?.endsWith("/"))Q.baseUrl=Q.baseUrl.substring(0,Q.baseUrl.length-1);return Q.headers=KZ($.headers,Z.headers),Q},KZ=(...$)=>{let Z=new Headers;for(let Q of $){if(!Q||typeof Q!=="object")continue;let X=Q instanceof Headers?Q.entries():Object.entries(Q);for(let[Y,J]of X)if(J===null)Z.delete(Y);else if(Array.isArray(J))for(let W of J)Z.append(Y,W);else if(J!==void 0)Z.set(Y,typeof J==="object"?JSON.stringify(J):J)}return Z};class GZ{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}getInterceptorIndex($){if(typeof $==="number")return this._fns[$]?$:-1;else return this._fns.indexOf($)}exists($){let Z=this.getInterceptorIndex($);return!!this._fns[Z]}eject($){let Z=this.getInterceptorIndex($);if(this._fns[Z])this._fns[Z]=null}update($,Z){let Q=this.getInterceptorIndex($);if(this._fns[Q])return this._fns[Q]=Z,$;else return!1}use($){return this._fns=[...this._fns,$],this._fns.length-1}}var UW=()=>({error:new GZ,request:new GZ,response:new GZ}),_A=GW({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),IA={"Content-Type":"application/json"},l8=($={})=>({...S7,headers:IA,parseAs:"auto",querySerializer:_A,...$});var c8=($={})=>{let Z=k7(l8(),$),Q=()=>({...Z}),X=(K)=>{return Z=k7(Z,K),Q()},Y=UW(),J=async(K)=>{let B={...Z,...K,fetch:K.fetch??Z.fetch??globalThis.fetch,headers:KZ(Z.headers,K.headers),serializedBody:void 0};if(B.security)await BW({...B,security:B.security});if(B.requestValidator)await B.requestValidator(B);if(B.body&&B.bodySerializer)B.serializedBody=B.bodySerializer(B.body);if(B.serializedBody===void 0||B.serializedBody==="")B.headers.delete("Content-Type");let U=x7(B);return{opts:B,url:U}},W=async(K)=>{let{opts:B,url:U}=await J(K),w={redirect:"follow",...B,body:B.serializedBody},H=new Request(U,w);for(let A of Y.request._fns)if(A)H=await A(H,B);let V=B.fetch,z=await V(H);for(let A of Y.response._fns)if(A)z=await A(z,H,B);let N={request:H,response:z};if(z.ok){if(z.status===204||z.headers.get("Content-Length")==="0")return B.responseStyle==="data"?{}:{data:{},...N};let A=(B.parseAs==="auto"?KW(z.headers.get("Content-Type")):B.parseAs)??"json",D;switch(A){case"arrayBuffer":case"blob":case"formData":case"json":case"text":D=await z[A]();break;case"stream":return B.responseStyle==="data"?z.body:{data:z.body,...N}}if(A==="json"){if(B.responseValidator)await B.responseValidator(D);if(B.responseTransformer)D=await B.responseTransformer(D)}return B.responseStyle==="data"?D:{data:D,...N}}let F=await z.text(),O;try{O=JSON.parse(F)}catch{}let j=O??F,M=j;for(let A of Y.error._fns)if(A)M=await A(j,z,H,B);if(M=M||{},B.throwOnError)throw M;return B.responseStyle==="data"?void 0:{error:M,...N}},G=(K)=>{let B=(U)=>W({...U,method:K});return B.sse=async(U)=>{let{opts:w,url:H}=await J(U);return YW({...w,body:w.body,headers:w.headers,method:K,url:H})},B};return{buildUrl:x7,connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),getConfig:Q,head:G("HEAD"),interceptors:Y,options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),request:W,setConfig:X,trace:G("TRACE")}};var SA={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},yv=Object.entries(SA);var zW=c8(l8({baseUrl:"http://localhost:4096"}));class b0{_client=zW;constructor($){if($?.client)this._client=$.client}}class wW extends b0{event($){return($?.client??this._client).get.sse({url:"/global/event",...$})}}class VW extends b0{list($){return($?.client??this._client).get({url:"/project",...$})}current($){return($?.client??this._client).get({url:"/project/current",...$})}}class HW extends b0{list($){return($?.client??this._client).get({url:"/pty",...$})}create($){return($?.client??this._client).post({url:"/pty",...$,headers:{"Content-Type":"application/json",...$?.headers}})}remove($){return($.client??this._client).delete({url:"/pty/{id}",...$})}get($){return($.client??this._client).get({url:"/pty/{id}",...$})}update($){return($.client??this._client).put({url:"/pty/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}connect($){return($.client??this._client).get({url:"/pty/{id}/connect",...$})}}class MW extends b0{get($){return($?.client??this._client).get({url:"/config",...$})}update($){return($?.client??this._client).patch({url:"/config",...$,headers:{"Content-Type":"application/json",...$?.headers}})}providers($){return($?.client??this._client).get({url:"/config/providers",...$})}}class AW extends b0{ids($){return($?.client??this._client).get({url:"/experimental/tool/ids",...$})}list($){return($.client??this._client).get({url:"/experimental/tool",...$})}}class FW extends b0{dispose($){return($?.client??this._client).post({url:"/instance/dispose",...$})}}class NW extends b0{get($){return($?.client??this._client).get({url:"/path",...$})}}class OW extends b0{get($){return($?.client??this._client).get({url:"/vcs",...$})}}class jW extends b0{list($){return($?.client??this._client).get({url:"/session",...$})}create($){return($?.client??this._client).post({url:"/session",...$,headers:{"Content-Type":"application/json",...$?.headers}})}status($){return($?.client??this._client).get({url:"/session/status",...$})}delete($){return($.client??this._client).delete({url:"/session/{id}",...$})}get($){return($.client??this._client).get({url:"/session/{id}",...$})}update($){return($.client??this._client).patch({url:"/session/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}children($){return($.client??this._client).get({url:"/session/{id}/children",...$})}todo($){return($.client??this._client).get({url:"/session/{id}/todo",...$})}init($){return($.client??this._client).post({url:"/session/{id}/init",...$,headers:{"Content-Type":"application/json",...$.headers}})}fork($){return($.client??this._client).post({url:"/session/{id}/fork",...$,headers:{"Content-Type":"application/json",...$.headers}})}abort($){return($.client??this._client).post({url:"/session/{id}/abort",...$})}unshare($){return($.client??this._client).delete({url:"/session/{id}/share",...$})}share($){return($.client??this._client).post({url:"/session/{id}/share",...$})}diff($){return($.client??this._client).get({url:"/session/{id}/diff",...$})}summarize($){return($.client??this._client).post({url:"/session/{id}/summarize",...$,headers:{"Content-Type":"application/json",...$.headers}})}messages($){return($.client??this._client).get({url:"/session/{id}/message",...$})}prompt($){return($.client??this._client).post({url:"/session/{id}/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}message($){return($.client??this._client).get({url:"/session/{id}/message/{messageID}",...$})}promptAsync($){return($.client??this._client).post({url:"/session/{id}/prompt_async",...$,headers:{"Content-Type":"application/json",...$.headers}})}command($){return($.client??this._client).post({url:"/session/{id}/command",...$,headers:{"Content-Type":"application/json",...$.headers}})}shell($){return($.client??this._client).post({url:"/session/{id}/shell",...$,headers:{"Content-Type":"application/json",...$.headers}})}revert($){return($.client??this._client).post({url:"/session/{id}/revert",...$,headers:{"Content-Type":"application/json",...$.headers}})}unrevert($){return($.client??this._client).post({url:"/session/{id}/unrevert",...$})}}class DW extends b0{list($){return($?.client??this._client).get({url:"/command",...$})}}class TW extends b0{authorize($){return($.client??this._client).post({url:"/provider/{id}/oauth/authorize",...$,headers:{"Content-Type":"application/json",...$.headers}})}callback($){return($.client??this._client).post({url:"/provider/{id}/oauth/callback",...$,headers:{"Content-Type":"application/json",...$.headers}})}}class qW extends b0{list($){return($?.client??this._client).get({url:"/provider",...$})}auth($){return($?.client??this._client).get({url:"/provider/auth",...$})}oauth=new TW({client:this._client})}class fW extends b0{text($){return($.client??this._client).get({url:"/find",...$})}files($){return($.client??this._client).get({url:"/find/file",...$})}symbols($){return($.client??this._client).get({url:"/find/symbol",...$})}}class LW extends b0{list($){return($.client??this._client).get({url:"/file",...$})}read($){return($.client??this._client).get({url:"/file/content",...$})}status($){return($?.client??this._client).get({url:"/file/status",...$})}}class RW extends b0{log($){return($?.client??this._client).post({url:"/log",...$,headers:{"Content-Type":"application/json",...$?.headers}})}agents($){return($?.client??this._client).get({url:"/agent",...$})}}class v7 extends b0{remove($){return($.client??this._client).delete({url:"/mcp/{name}/auth",...$})}start($){return($.client??this._client).post({url:"/mcp/{name}/auth",...$})}callback($){return($.client??this._client).post({url:"/mcp/{name}/auth/callback",...$,headers:{"Content-Type":"application/json",...$.headers}})}authenticate($){return($.client??this._client).post({url:"/mcp/{name}/auth/authenticate",...$})}set($){return($.client??this._client).put({url:"/auth/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}}class PW extends b0{status($){return($?.client??this._client).get({url:"/mcp",...$})}add($){return($?.client??this._client).post({url:"/mcp",...$,headers:{"Content-Type":"application/json",...$?.headers}})}connect($){return($.client??this._client).post({url:"/mcp/{name}/connect",...$})}disconnect($){return($.client??this._client).post({url:"/mcp/{name}/disconnect",...$})}auth=new v7({client:this._client})}class CW extends b0{status($){return($?.client??this._client).get({url:"/lsp",...$})}}class EW extends b0{status($){return($?.client??this._client).get({url:"/formatter",...$})}}class bW extends b0{next($){return($?.client??this._client).get({url:"/tui/control/next",...$})}response($){return($?.client??this._client).post({url:"/tui/control/response",...$,headers:{"Content-Type":"application/json",...$?.headers}})}}class _W extends b0{appendPrompt($){return($?.client??this._client).post({url:"/tui/append-prompt",...$,headers:{"Content-Type":"application/json",...$?.headers}})}openHelp($){return($?.client??this._client).post({url:"/tui/open-help",...$})}openSessions($){return($?.client??this._client).post({url:"/tui/open-sessions",...$})}openThemes($){return($?.client??this._client).post({url:"/tui/open-themes",...$})}openModels($){return($?.client??this._client).post({url:"/tui/open-models",...$})}submitPrompt($){return($?.client??this._client).post({url:"/tui/submit-prompt",...$})}clearPrompt($){return($?.client??this._client).post({url:"/tui/clear-prompt",...$})}executeCommand($){return($?.client??this._client).post({url:"/tui/execute-command",...$,headers:{"Content-Type":"application/json",...$?.headers}})}showToast($){return($?.client??this._client).post({url:"/tui/show-toast",...$,headers:{"Content-Type":"application/json",...$?.headers}})}publish($){return($?.client??this._client).post({url:"/tui/publish",...$,headers:{"Content-Type":"application/json",...$?.headers}})}control=new bW({client:this._client})}class IW extends b0{subscribe($){return($?.client??this._client).get.sse({url:"/event",...$})}}class y7 extends b0{postSessionIdPermissionsPermissionId($){return($.client??this._client).post({url:"/session/{id}/permissions/{permissionID}",...$,headers:{"Content-Type":"application/json",...$.headers}})}global=new wW({client:this._client});project=new VW({client:this._client});pty=new HW({client:this._client});config=new MW({client:this._client});tool=new AW({client:this._client});instance=new FW({client:this._client});path=new NW({client:this._client});vcs=new OW({client:this._client});session=new jW({client:this._client});command=new DW({client:this._client});provider=new qW({client:this._client});find=new fW({client:this._client});file=new LW({client:this._client});app=new RW({client:this._client});mcp=new PW({client:this._client});lsp=new CW({client:this._client});formatter=new EW({client:this._client});tui=new _W({client:this._client});auth=new v7({client:this._client});event=new IW({client:this._client})}function xW($,Z,Q,X){if(!X?.throwOnError)return $;if($ instanceof Error)return $;if(typeof $==="object"&&$!==null&&Object.keys($).length>0){let J=$,W=typeof J.data?.message==="string"&&J.data.message||typeof J.message==="string"&&J.message||typeof J.name==="string"&&J.name||SW(Q,Z);return Error(W,{cause:{body:$,status:Z?.status}})}if(typeof $==="string"&&$.length>0)return Error($,{cause:{body:$,status:Z?.status}});let Y=Z?"(empty response body)":"network error (no response)";return Error(`muxcode server ${SW(Q,Z)}: ${Y}`,{cause:{body:$,status:Z?.status}})}function SW($,Z){let Q=$?.method??"?",X=$?.url??"?",Y=Z?.status,J=Z?.statusText;return`${Q} ${X}${Y?" \u2192 "+Y:""}${J?" "+J:""}`}function xA($,Z){if(!$)return;if(!Z)return $;if($===Z)return Z;if($===encodeURIComponent(Z))return Z;return $}function kA($,Z){if($.method!=="GET"&&$.method!=="HEAD")return $;let Q=xA($.headers.get("x-muxcode-directory"),Z);if(!Q)return $;let X=new URL($.url);if(!X.searchParams.has("directory"))X.searchParams.set("directory",Q);let Y=new Request(X,$);return Y.headers.delete("x-muxcode-directory"),Y}function g7($){if(!$?.fetch)$={...$,fetch:(X)=>{return X.timeout=!1,fetch(X)}};if($?.directory)$.headers={...$.headers,"x-muxcode-directory":encodeURIComponent($.directory)};let Z=c8($);return Z.interceptors.request.use((Q)=>kA(Q,$?.directory)),Z.interceptors.error.use(xW),new y7({client:Z})}var yA=d8(vA(),1);import m7 from"os";import{setTimeout as tA}from"timers/promises";import{createServer as eA}from"http";var P$={};K$(P$,{withoutInternalHeaders:()=>gW,createWebSocketFetch:()=>sA,TITLE_HEADER:()=>p8,OpenAIWebSocketPool:()=>P$});import dA from"ws";var h1={};K$(h1,{toWebSocketUrl:()=>hA,streamResponsesWebSocket:()=>lA,normalizeHeaders:()=>uA,isAbortError:()=>u7,connectResponsesWebSocket:()=>mA,PROTOCOL_HEADER:()=>kW,OpenAIWebSocket:()=>h1});import gA from"ws";var kW="responses_websockets=2026-02-06";function hA($){return $.replace(/^http/,"ws")}function uA($){let Z={};if(!$)return Z;if($ instanceof Headers)return $.forEach((Q,X)=>{Z[X.toLowerCase()]=Q}),Z;if(Array.isArray($)){for(let[Q,X]of $)Z[Q.toLowerCase()]=X;return Z}for(let[Q,X]of Object.entries($))if(X!=null)Z[Q.toLowerCase()]=X;return Z}function u7($){return $ instanceof DOMException&&$.name==="AbortError"}function mA($){return new Promise((Z,Q)=>{if($.signal?.aborted){Q(h7($.signal));return}let X={...$.headers,"openai-beta":$.headers["openai-beta"]??kW};delete X["content-length"];let Y=new gA($.url,{headers:X}),J=$.timeout?setTimeout(()=>{W(),Y.on("error",()=>{}),Y.terminate(),Q(Error("WebSocket connect timed out"))},$.timeout):void 0;function W(){if(J)clearTimeout(J);Y.off("open",G),Y.off("error",K),Y.off("close",B),$.signal?.removeEventListener("abort",U)}function G(){W(),Z(Y)}function K(w){Y.on("error",()=>{}),W(),Q(w)}function B(w,H){W(),Q(Error(vW("WebSocket closed before open",w,H)))}function U(){W(),Y.on("error",()=>{}),Y.terminate(),Q(h7($.signal))}Y.once("open",G),Y.once("error",K),Y.once("close",B),$.signal?.addEventListener("abort",U,{once:!0})})}function lA($){let Z=new TextEncoder,Q=$.socket,X,Y=()=>{},J=!1,W=!1,G;function K(){if(G)clearTimeout(G);Y(),$.signal?.removeEventListener("abort",F)}function B(M=Q){M.on("error",()=>{}),M.terminate()}function U(){K(),X?.enqueue(Z.encode(`data: [DONE]
403
+
404
+ `)),X?.close()}function w(M){if(J)return;J=!0,K(),$.onConnectionInvalid?.(M),X?.error(M)}function H(M){if(J)return;if(!$.idleTimeout)return;if(G)clearTimeout(G);G=setTimeout(()=>w(new I1.ResponseStreamError(M)),$.idleTimeout)}async function V(M,A){if(J)return;if(A){w(new I1.ResponseStreamError("Unexpected binary WebSocket frame"));return}let D=M.toString(),f=(()=>{try{let R=JSON.parse(D);return typeof R==="object"&&R!==null?R:void 0}catch{return}})();if(f?.type==="error"&&!W&&$.onRetryableTerminal){if(Y(),G)clearTimeout(G);G=void 0;try{let R=await $.onRetryableTerminal(f);if(J){if(R)B(R);return}if(R){j(R);return}}catch(R){w(new I1.ResponseStreamError(R instanceof Error?R.message:String(R),{cause:R}));return}}if(!W)$.onFirstEvent?.();if(X?.enqueue(Z.encode(`${D.split(/\r?\n/).map((R)=>`data: ${R}`).join(`
405
+ `)}
406
+
407
+ `)),W=!0,H("idle timeout waiting for websocket"),!f)return;if(f.type==="response.completed"||f.type==="response.done"){J=!0,$.onComplete?.(f),$.onTerminal?.(f),U();return}if(f.type==="response.failed"||f.type==="response.incomplete"||f.type==="error")J=!0,$.onTerminal?.(f),U()}function z(M){w(new I1.ResponseStreamError(M.message,{cause:M}))}function N(M,A){if(J)return;w(new I1.ResponseStreamError(vW("WebSocket closed before response.completed",M,A)))}function F(){let M=h7($.signal);if(J)return;J=!0,K(),B(),$.onAbort?.(M),X?.error(M)}function O(M){if(J)return;J=!0,K(),B(),$.onAbort?.(cA(M))}function j(M){Y(),Q=M,Q.on("message",V),Q.once("error",z),Q.once("close",N),Y=()=>{Q.off("message",V),Q.off("error",z),Q.off("close",N)};let{stream:A,background:D,...f}=$.body;H("idle timeout sending websocket request"),Q.send(JSON.stringify({type:"response.create",...f}),(R)=>{if(J)return;if(H("idle timeout waiting for websocket"),R)w(new I1.ResponseStreamError(R.message,{cause:R}))})}return new Response(new ReadableStream({start(M){if(X=M,$.signal?.addEventListener("abort",F,{once:!0}),$.signal?.aborted){F();return}j(Q)},cancel(M){O(M)}}),{status:200,headers:{"content-type":"text/event-stream"}})}function cA($){if(u7($))return $;if($ instanceof Error)return $;return new DOMException(typeof $==="string"?$:"Aborted","AbortError")}function h7($){let Z=$?.reason;if(u7(Z))return Z;return new DOMException(Z instanceof Error?Z.message:"Aborted","AbortError")}function vW($,Z,Q){let X=[`code ${Z}`];if(Z===1009)X.push("message too big");if(Q.length>0)X.push(Q.toString());return`${$} (${X.join(": ")})`}var p8="x-muxcode-title",T1=G1({service:"plugin.openai.ws"}),pA=15000,iA=300000,nA=3300000,yW="websocket_connection_limit_reached";function sA($){let Z=$?.httpFetch??globalThis.fetch,Q=new Map,X=$?.connectTimeout??pA,Y=$?.idleTimeout??iA,J=$?.maxConnectionAge??nA,W=$?.streamRetries??5,G=setInterval(()=>U(),Math.min(Y,60000));if(typeof G==="object"&&"unref"in G&&typeof G.unref==="function")G.unref();async function K(H,V){let z=H instanceof URL?H.toString():typeof H==="string"?H:H.url,N=h1.normalizeHeaders(V?.headers),F=gW(V);if(V?.method!=="POST"||!new URL(z).pathname.endsWith("/responses"))return Z(H,F);let O=(()=>{try{if(typeof V?.body!=="string")return;let D=JSON.parse(V.body);return typeof D==="object"&&D!==null?D:void 0}catch{return}})();if(!O?.stream)return Z(H,F);if(N[p8]==="true")return T1.debug("http fallback",{reason:"title"}),Z(H,F);let j=N["x-session-affinity"]??N["session-id"];if(!j)return T1.debug("http fallback",{reason:"missing_session"}),Z(H,F);let M=`${j}:conversation`,A=Q.get(M)??{lastUsedAt:Date.now(),busy:!1,fallback:!1,streamFailures:0};if(Q.set(M,A),A.fallback)return T1.debug("http fallback",{key:M,reason:"fallback_active"}),Z(H,F);if(A.busy)return T1.debug("http fallback",{key:M,reason:"busy"}),Z(H,F);A.busy=!0,A.lastUsedAt=Date.now();try{A.socket=await rA(A,$?.url??z,h1.normalizeHeaders(F?.headers),X,J,V?.signal);let D=()=>{},f=()=>{},R=new Promise((b,q)=>{D=b,f=q}),T=h1.streamResponsesWebSocket({socket:A.socket,body:O,idleTimeout:Y,signal:V?.signal??void 0,onFirstEvent:()=>D(!0),onTerminal:(b)=>{if(A.busy=!1,A.lastUsedAt=Date.now(),A.streamFailures=0,b.type!=="response.completed"&&b.type!=="response.done")T1.warn("websocket terminal failure",{key:M,type:b.type}),B$(A)},onConnectionInvalid:(b)=>{if(T1.warn("websocket invalidated",{key:M,error:b.message}),A.busy=!1,!A.fallback)B(A);B$(A),D(!1)},onAbort:(b)=>{T1.debug("websocket aborted",{key:M}),A.busy=!1,A.lastUsedAt=Date.now(),A.streamFailures=0,B$(A),f(b)},onRetryableTerminal:async(b)=>{let q=aA(b);if(!q)return;throw T1.warn("websocket connection limit reached",{key:M}),q}});if(await R)return T;if(!A.fallback)return T;return T1.debug("http fallback",{key:M,reason:"websocket_retries_exhausted"}),Z(H,F)}catch(D){if(A.busy=!1,A.lastUsedAt=Date.now(),h1.isAbortError(D))throw A.streamFailures=0,B$(A),D;if(B(A),T1.warn("websocket setup failed",{key:M,error:D instanceof Error?D.message:String(D),fallback:A.fallback?"http":void 0}),B$(A),A.fallback)return Z(H,F);return oA(new I1.ResponseStreamError(D instanceof Error?D.message:String(D),{cause:D}))}}function B(H){if(H.streamFailures++,H.streamFailures>W)H.fallback=!0}function U(){let H=Date.now();for(let[V,z]of Q){if(z.busy)continue;if(H-z.lastUsedAt<Y)continue;T1.debug("websocket idle prune",{key:V}),B$(z),Q.delete(V)}}function w(){T1.debug("websocket pool close",{count:Q.size}),clearInterval(G);for(let H of Q.values())B$(H);Q.clear()}return Object.assign(K,{close:w})}function aA($){if($.type!=="error"||!i8($.error)||$.error.code!==yW)return;return Error(typeof $.error.message==="string"?$.error.message:yW)}function oA($){return new Response(new ReadableStream({start(Z){Z.error($)}}),{status:200,headers:{"content-type":"text/event-stream"}})}async function rA($,Z,Q,X,Y,J){if($.socket?.readyState===dA.OPEN&&$.connectedAt&&Date.now()-$.connectedAt<Y)return $.socket;B$($);let W=await h1.connectResponsesWebSocket({url:h1.toWebSocketUrl(Z),headers:Q,timeout:X,signal:J??void 0});return $.connectedAt=Date.now(),W}function B$($){if($.socket)$.socket.on("error",()=>{}),$.socket.terminate(),$.socket=void 0;$.connectedAt=void 0}function gW($){if(!$?.headers)return $;if($.headers instanceof Headers){let Z=new Headers($.headers);return Z.delete(p8),{...$,headers:Z}}if(Array.isArray($.headers))return{...$,headers:$.headers.filter((Z)=>Z[0].toLowerCase()!==p8)};return{...$,headers:Object.fromEntries(Object.entries($.headers).filter(([Z])=>Z.toLowerCase()!==p8))}}var d7=G1({service:"plugin.codex"}),n8="app_EMoamEEZ73f0CkXaXp7hrann",n1="https://auth.openai.com",$F="https://chatgpt.com/backend-api/codex/responses",U$=1455,ZF=3000,QF=new Set(["gpt-5.5","gpt-5.2","gpt-5.3-codex","gpt-5.3-codex-spark","gpt-5.4","gpt-5.4-mini"]);async function XF(){let Z=Array.from(crypto.getRandomValues(new Uint8Array(43))).map((X)=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"[X%66]).join(""),Q=mW(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(Z)));return{verifier:Z,challenge:Q}}function mW($){let Z=new Uint8Array($),Q=String.fromCharCode(...Z);return btoa(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function hW($){let Z=$.split(".");if(Z.length!==3)return;try{return JSON.parse(Buffer.from(Z[1],"base64url").toString())}catch{return}}function uW($){return $.chatgpt_account_id||$["https://api.openai.com/auth"]?.chatgpt_account_id||$.organizations?.[0]?.id}function l7($){if($.id_token){let Z=hW($.id_token),Q=Z&&uW(Z);if(Q)return Q}if($.access_token){let Z=hW($.access_token);return Z?uW(Z):void 0}return}function YF($,Z,Q){let X=new URLSearchParams({response_type:"code",client_id:n8,redirect_uri:$,scope:"openid profile email offline_access",code_challenge:Z.challenge,code_challenge_method:"S256",id_token_add_organizations:"true",codex_cli_simplified_flow:"true",state:Q,originator:"muxcode"});return`${n1}/oauth/authorize?${X.toString()}`}async function JF($,Z,Q){let X=await fetch(`${n1}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:$,redirect_uri:Z,client_id:n8,code_verifier:Q.verifier}).toString()});if(!X.ok)throw Error(`Token exchange failed: ${X.status}`);return X.json()}async function WF($,Z=n1){let Q=await fetch(`${Z}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:$,client_id:n8}).toString()});if(!Q.ok)throw Error(`Token refresh failed: ${Q.status}`);return Q.json()}var GF=`<!doctype html>
408
+ <html>
409
+ <head>
410
+ <title>MuxCode - Codex Authorization Successful</title>
411
+ <style>
412
+ body {
413
+ font-family:
414
+ system-ui,
415
+ -apple-system,
416
+ sans-serif;
417
+ display: flex;
418
+ justify-content: center;
419
+ align-items: center;
420
+ height: 100vh;
421
+ margin: 0;
422
+ background: #131010;
423
+ color: #f1ecec;
424
+ }
425
+ .container {
426
+ text-align: center;
427
+ padding: 2rem;
428
+ }
429
+ h1 {
430
+ color: #f1ecec;
431
+ margin-bottom: 1rem;
432
+ }
433
+ p {
434
+ color: #b7b1b1;
435
+ }
436
+ </style>
437
+ </head>
438
+ <body>
439
+ <div class="container">
440
+ <h1>Authorization Successful</h1>
441
+ <p>You can close this window and return to MuxCode.</p>
442
+ </div>
443
+ <script>
444
+ setTimeout(() => window.close(), 2000)
445
+ </script>
446
+ </body>
447
+ </html>`,c7=($)=>`<!doctype html>
448
+ <html>
449
+ <head>
450
+ <title>MuxCode - Codex Authorization Failed</title>
451
+ <style>
452
+ body {
453
+ font-family:
454
+ system-ui,
455
+ -apple-system,
456
+ sans-serif;
457
+ display: flex;
458
+ justify-content: center;
459
+ align-items: center;
460
+ height: 100vh;
461
+ margin: 0;
462
+ background: #131010;
463
+ color: #f1ecec;
464
+ }
465
+ .container {
466
+ text-align: center;
467
+ padding: 2rem;
468
+ }
469
+ h1 {
470
+ color: #fc533a;
471
+ margin-bottom: 1rem;
472
+ }
473
+ p {
474
+ color: #b7b1b1;
475
+ }
476
+ .error {
477
+ color: #ff917b;
478
+ font-family: monospace;
479
+ margin-top: 1rem;
480
+ padding: 1rem;
481
+ background: #3c140d;
482
+ border-radius: 0.5rem;
483
+ }
484
+ </style>
485
+ </head>
486
+ <body>
487
+ <div class="container">
488
+ <h1>Authorization Failed</h1>
489
+ <p>An error occurred during authorization.</p>
490
+ <div class="error">${$}</div>
491
+ </div>
492
+ </body>
493
+ </html>`,C$,Q1;async function KF(){if(C$)return{port:U$,redirectUri:`http://localhost:${U$}/auth/callback`};return C$=eA(($,Z)=>{let Q=new URL($.url||"/",`http://localhost:${U$}`);if(Q.pathname==="/auth/callback"){let X=Q.searchParams.get("code"),Y=Q.searchParams.get("state"),J=Q.searchParams.get("error"),W=Q.searchParams.get("error_description");if(J){let K=W||J;Q1?.reject(Error(K)),Q1=void 0,Z.writeHead(200,{"Content-Type":"text/html"}),Z.end(c7(K));return}if(!X){Q1?.reject(Error("Missing authorization code")),Q1=void 0,Z.writeHead(400,{"Content-Type":"text/html"}),Z.end(c7("Missing authorization code"));return}if(!Q1||Y!==Q1.state){Q1?.reject(Error("Invalid state - potential CSRF attack")),Q1=void 0,Z.writeHead(400,{"Content-Type":"text/html"}),Z.end(c7("Invalid state - potential CSRF attack"));return}let G=Q1;Q1=void 0,JF(X,`http://localhost:${U$}/auth/callback`,G.pkce).then((K)=>G.resolve(K)).catch((K)=>G.reject(K)),Z.writeHead(200,{"Content-Type":"text/html"}),Z.end(GF);return}if(Q.pathname==="/cancel"){Q1?.reject(Error("Login cancelled")),Q1=void 0,Z.writeHead(200),Z.end("Login cancelled");return}Z.writeHead(404),Z.end("Not found")}),await new Promise(($,Z)=>{C$.listen(U$,()=>{d7.info("codex oauth server started",{port:U$}),$()}),C$.on("error",Z)}),{port:U$,redirectUri:`http://localhost:${U$}/auth/callback`}}function BF(){if(C$)C$.close(()=>{d7.info("codex oauth server stopped")}),C$=void 0}function UF($,Z){return new Promise((Q,X)=>{let Y=setTimeout(()=>{if(Q1)Q1=void 0,X(Error("OAuth callback timeout - authorization took too long"))},300000);Q1={pkce:$,state:Z,resolve:(J)=>{clearTimeout(Y),Q(J)},reject:(J)=>{clearTimeout(Y),X(J)}}})}async function lW($,Z={}){let Q=Z.issuer??n1,X=Z.codexApiEndpoint??$F,Y=!1,J=[];return{async dispose(){for(let W of J)W.close();J.length=0},provider:{id:"openai",async models(W,G){if(G.auth?.type!=="oauth")return W.models;return Object.fromEntries(Object.entries(W.models).filter(([,K])=>{if(QF.has(K.api.id))return!0;let B=K.api.id.match(/^gpt-(\d+\.\d+)/);return B?parseFloat(B[1])>5.4:!1}).map(([K,B])=>[K,{...B,cost:{input:0,output:0,cache:{read:0,write:0}},limit:B.id.includes("gpt-5.5")?{context:400000,input:272000,output:128000}:B.limit}]))}},auth:{provider:"openai",async loader(W){let G=await W(),K=Z.experimentalWebSockets?P$.createWebSocketFetch({httpFetch:fetch}):void 0;if(K)J.push(K),Y=!0;if(G.type!=="oauth")return K?{fetch:K}:{};let B;return{apiKey:BZ,async fetch(U,w){if(w?.headers)if(w.headers instanceof Headers)w.headers.delete("authorization"),w.headers.delete("Authorization");else if(Array.isArray(w.headers))w.headers=w.headers.filter(([j])=>j.toLowerCase()!=="authorization");else delete w.headers.authorization,delete w.headers.Authorization;let H=await W();if(H.type!=="oauth")return K?K(U,w):fetch(U,w);let V=H;if(!H.access||H.expires<Date.now()){if(!B)d7.info("refreshing codex access token"),B=WF(H.refresh,Q).then(async(M)=>{let A=l7(M)||V.accountId;return await $.client.auth.set({path:{id:"openai"},body:{type:"oauth",refresh:M.refresh_token,access:M.access_token,expires:Date.now()+(M.expires_in??3600)*1000,...A&&{accountId:A}}}),{access:M.access_token,accountId:A}}).finally(()=>{B=void 0});let j=await B;H.access=j.access,V.accountId=j.accountId}let z=new Headers;if(w?.headers){if(w.headers instanceof Headers)w.headers.forEach((j,M)=>z.set(M,j));else if(Array.isArray(w.headers)){for(let[j,M]of w.headers)if(M!==void 0)z.set(j,String(M))}else for(let[j,M]of Object.entries(w.headers))if(M!==void 0)z.set(j,String(M))}if(z.set("authorization",`Bearer ${H.access}`),V.accountId)z.set("ChatGPT-Account-Id",V.accountId);let N=U instanceof URL?U:new URL(typeof U==="string"?U:U.url),F=N.pathname.includes("/v1/responses")||N.pathname.includes("/chat/completions")?new URL(X):N,O={...w,headers:z};if(K&&N.pathname.endsWith("/responses"))return K(F,O);return fetch(F,P$.withoutInternalHeaders(O))}}},methods:[{label:"ChatGPT Pro/Plus (browser)",type:"oauth",authorize:async()=>{let{redirectUri:W}=await KF(),G=await XF(),K=mW(crypto.getRandomValues(new Uint8Array(32)).buffer),B=YF(W,G,K),U=UF(G,K);return{url:B,instructions:"Complete authorization in your browser. This window will close automatically.",method:"auto",callback:async()=>{let w=await U;BF();let H=l7(w);return{type:"success",refresh:w.refresh_token,access:w.access_token,expires:Date.now()+(w.expires_in??3600)*1000,accountId:H}}}}},{label:"ChatGPT Pro/Plus (headless)",type:"oauth",authorize:async()=>{let W=await fetch(`${n1}/api/accounts/deviceauth/usercode`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`muxcode/${h0}`},body:JSON.stringify({client_id:n8})});if(!W.ok)throw Error("Failed to initiate device authorization");let G=await W.json(),K=Math.max(parseInt(G.interval)||5,1)*1000;return{url:`${n1}/codex/device`,instructions:`Enter code: ${G.user_code}`,method:"auto",async callback(){while(!0){let B=await fetch(`${n1}/api/accounts/deviceauth/token`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`muxcode/${h0}`},body:JSON.stringify({device_auth_id:G.device_auth_id,user_code:G.user_code})});if(B.ok){let U=await B.json(),w=await fetch(`${n1}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:U.authorization_code,redirect_uri:`${n1}/deviceauth/callback`,client_id:n8,code_verifier:U.code_verifier}).toString()});if(!w.ok)throw Error(`Token exchange failed: ${w.status}`);let H=await w.json();return{type:"success",refresh:H.refresh_token,access:H.access_token,expires:Date.now()+(H.expires_in??3600)*1000,accountId:l7(H)}}if(B.status!==403&&B.status!==404)return{type:"failed"};await tA(K+ZF)}}}}},{label:"Manually enter API Key",type:"api"}]},"chat.headers":async(W,G)=>{if(W.model.providerID!=="openai")return;if(G.headers.originator="muxcode",G.headers["User-Agent"]=`muxcode/${h0} (${m7.platform()} ${m7.release()}; ${m7.arch()})`,G.headers["session-id"]=W.sessionID,Y&&W.agent==="title")G.headers[P$.TITLE_HEADER]="true"},"chat.params":async(W,G)=>{if(W.model.providerID!=="openai")return;G.maxOutputTokens=void 0}}}import{setTimeout as p7}from"timers/promises";var s8={};K$(s8,{schema:()=>dW,get:()=>wF,CopilotModels:()=>s8});var dW=k.Struct({data:k.Array(k.Struct({model_picker_enabled:k.Boolean,id:k.String,name:k.String,version:k.String,supported_endpoints:k.optional(k.Array(k.String)),policy:k.optional(k.Struct({state:k.optional(k.String)})),capabilities:k.Struct({family:k.String,limits:k.Struct({max_context_window_tokens:k.Number,max_output_tokens:k.Number,max_prompt_tokens:k.Number,vision:k.optional(k.Struct({max_prompt_image_size:k.Number,max_prompt_images:k.Number,supported_media_types:k.Array(k.String)}))}),supports:k.Struct({adaptive_thinking:k.optional(k.Boolean),max_thinking_budget:k.optional(k.Number),min_thinking_budget:k.optional(k.Number),reasoning_effort:k.optional(k.Array(k.String)),streaming:k.Boolean,structured_outputs:k.optional(k.Boolean),tool_calls:k.Boolean,vision:k.optional(k.Boolean)})})}))}),zF=k.decodeUnknownSync(dW);function cW($,Z,Q,X){let Y=!!Z.capabilities.supports.adaptive_thinking||!!Z.capabilities.supports.reasoning_effort?.length||Z.capabilities.supports.max_thinking_budget!==void 0||Z.capabilities.supports.min_thinking_budget!==void 0,J=(Z.capabilities.supports.vision??!1)||(Z.capabilities.limits.vision?.supported_media_types??[]).some((U)=>U.startsWith("image/")),W=Z.supported_endpoints?.includes("/v1/messages"),G={id:$,providerID:"github-copilot",api:{id:Z.id,url:W?`${Q}/v1`:Q,npm:W?"@ai-sdk/anthropic":"@ai-sdk/github-copilot"},status:"active",limit:{context:Z.capabilities.limits.max_context_window_tokens,input:Z.capabilities.limits.max_prompt_tokens,output:Z.capabilities.limits.max_output_tokens},capabilities:{temperature:X?.capabilities.temperature??!0,reasoning:X?.capabilities.reasoning??Y,attachment:X?.capabilities.attachment??!0,toolcall:Z.capabilities.supports.tool_calls,input:{text:!0,audio:!1,image:J,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},family:X?.family??Z.capabilities.family,name:X?.name??Z.name,cost:{input:0,output:0,cache:{read:0,write:0}},options:X?.options??{},headers:X?.headers??{},release_date:X?.release_date??(Z.version.startsWith(`${Z.id}-`)?Z.version.slice(Z.id.length+1):Z.version)},K=Z.capabilities.supports.reasoning_effort,B={};if(!W&&K?.length)K.forEach((U)=>{B[U]={reasoningEffort:U,reasoningSummary:"auto",include:["reasoning.encrypted_content"]}});else if(K?.length&&Z.capabilities.supports.adaptive_thinking)K.forEach((U)=>{B[U]={thinking:{type:"adaptive",...G.api.id.includes("opus-4.7")?{display:"summarized"}:{}},effort:U}});else if(Z.capabilities.supports.max_thinking_budget){let U=Z.capabilities.supports.max_thinking_budget;B.max={thinking:{type:"enabled",budgetTokens:U-1}},B.high={thinking:{type:"enabled",budgetTokens:Math.floor(U/2)}}}if(Object.keys(B).length>0)G.variants=B;return G}async function wF($,Z={},Q={}){let X=await fetch(`${$}/models`,{headers:Z,signal:AbortSignal.timeout(5000)}).then(async(W)=>{if(!W.ok)throw Error(`Failed to fetch models: ${W.status}`);return zF(await W.json())}),Y={...Q},J=new Map(X.data.filter((W)=>W.model_picker_enabled&&W.policy?.state!=="disabled").map((W)=>[W.id,W]));for(let[W,G]of Object.entries(Y)){let K=J.get(G.api.id);if(!K){delete Y[W];continue}Y[W]=cW(W,K,$,G)}for(let[W,G]of J){if(W in Y)continue;Y[W]=cW(W,G,$)}return Y}var VF=G1({service:"plugin.copilot"}),pW="Ov23li8tweQw6odWQebz",i7=3000;function nW($){return $.replace(/^https?:\/\//,"").replace(/\/$/,"")}function HF($){return{DEVICE_CODE_URL:`https://${$}/login/device/code`,ACCESS_TOKEN_URL:`https://${$}/login/oauth/access_token`}}function n7($){return $?`https://copilot-api.${nW($)}`:"https://api.githubcopilot.com"}function s7($){if($?.role!=="user")return!1;let Z=$.content;if(typeof Z==="string")return Z===a7.SYNTHETIC_ATTACHMENT_PROMPT;if(!Array.isArray(Z))return!1;return Z.some((Q)=>(Q?.type==="text"||Q?.type==="input_text")&&Q.text===a7.SYNTHETIC_ATTACHMENT_PROMPT)}function iW($,Z){return{...$,api:{...$.api,url:Z,npm:"@ai-sdk/github-copilot"}}}async function sW($){let Z=$.client;return{provider:{id:"github-copilot",async models(Q,X){if(X.auth?.type!=="oauth")return Object.fromEntries(Object.entries(Q.models).map(([J,W])=>[J,iW(W,n7())]));let Y=X.auth;return s8.get(n7(Y.enterpriseUrl),{Authorization:`Bearer ${Y.refresh}`,"User-Agent":`muxcode/${h0}`},Q.models).catch((J)=>{return VF.error("failed to fetch copilot models",{error:J}),Object.fromEntries(Object.entries(Q.models).map(([W,G])=>[W,iW(G,n7(Y.enterpriseUrl))]))})}},auth:{provider:"github-copilot",async loader(Q){let X=await Q();if(!X||X.type!=="oauth")return{};return{apiKey:"",async fetch(Y,J){let W=await Q();if(W.type!=="oauth")return fetch(Y,J);let G=Y instanceof URL?Y.href:typeof Y==="string"?Y:Y.url,{isVision:K,isAgent:B}=q1(()=>{try{let w=typeof J?.body==="string"?JSON.parse(J.body):J?.body;if(w?.messages&&G.includes("completions")){let H=w.messages[w.messages.length-1];return{isVision:w.messages.some((V)=>Array.isArray(V.content)&&V.content.some((z)=>z.type==="image_url")),isAgent:H?.role!=="user"||s7(H)}}if(w?.input){let H=w.input[w.input.length-1];return{isVision:w.input.some((V)=>Array.isArray(V?.content)&&V.content.some((z)=>z.type==="input_image")),isAgent:H?.role!=="user"||s7(H)}}if(w?.messages){let H=w.messages[w.messages.length-1],V=Array.isArray(H?.content)&&H.content.some((z)=>z?.type!=="tool_result");return{isVision:w.messages.some((z)=>Array.isArray(z?.content)&&z.content.some((N)=>N?.type==="image"||N?.type==="tool_result"&&Array.isArray(N?.content)&&N.content.some((F)=>F?.type==="image"))),isAgent:!(H?.role==="user"&&V)||s7(H)}}}catch{}return{isVision:!1,isAgent:!1}}),U={"x-initiator":B?"agent":"user",...J?.headers,"User-Agent":`muxcode/${h0}`,Authorization:`Bearer ${W.refresh}`,"Openai-Intent":"conversation-edits"};if(K)U["Copilot-Vision-Request"]="true";return delete U["x-api-key"],delete U.authorization,fetch(Y,{...J,headers:U})}}},methods:[{type:"oauth",label:"Login with GitHub Copilot",prompts:[{type:"select",key:"deploymentType",message:"Select GitHub deployment type",options:[{label:"GitHub.com",value:"github.com",hint:"Public"},{label:"GitHub Enterprise",value:"enterprise",hint:"Data residency or self-hosted"}]},{type:"text",key:"enterpriseUrl",message:"Enter your GitHub Enterprise URL or domain",placeholder:"company.ghe.com or https://company.ghe.com",when:{key:"deploymentType",op:"eq",value:"enterprise"},validate:(Q)=>{if(!Q)return"URL or domain is required";try{if(!(Q.includes("://")?new URL(Q):new URL(`https://${Q}`)).hostname)return"Please enter a valid URL or domain";return}catch{return"Please enter a valid URL (e.g., company.ghe.com or https://company.ghe.com)"}}}],async authorize(Q={}){let X=Q.deploymentType||"github.com",Y="github.com";if(X==="enterprise"){let K=Q.enterpriseUrl;Y=nW(K)}let J=HF(Y),W=await fetch(J.DEVICE_CODE_URL,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","User-Agent":`muxcode/${h0}`},body:JSON.stringify({client_id:pW,scope:"read:user"})});if(!W.ok)throw Error("Failed to initiate device authorization");let G=await W.json();return{url:G.verification_uri,instructions:`Enter code: ${G.user_code}`,method:"auto",async callback(){while(!0){let K=await fetch(J.ACCESS_TOKEN_URL,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","User-Agent":`muxcode/${h0}`},body:JSON.stringify({client_id:pW,device_code:G.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!K.ok)return{type:"failed"};let B=await K.json();if(B.access_token){let U={type:"success",refresh:B.access_token,access:B.access_token,expires:0};if(X==="enterprise")U.enterpriseUrl=Y;return U}if(B.error==="authorization_pending"){await p7(G.interval*1000+i7);continue}if(B.error==="slow_down"){let U=(G.interval+5)*1000,w=B.interval;if(w&&typeof w==="number"&&w>0)U=w*1000;await p7(U+i7);continue}if(B.error)return{type:"failed"};await p7(G.interval*1000+i7);continue}}}}}]},"chat.params":async(Q,X)=>{if(!Q.model.providerID.includes("github-copilot"))return;if(Q.model.api.id.includes("gpt"))X.maxOutputTokens=void 0;if(Q.model.api.npm==="@ai-sdk/anthropic")X.options.toolStreaming=!1},"chat.headers":async(Q,X)=>{if(!Q.model.providerID.includes("github-copilot"))return;if(Q.model.api.npm==="@ai-sdk/anthropic")X.headers["anthropic-beta"]="interleaved-thinking-2025-05-14";if((await Z.session.message({path:{id:Q.message.sessionID,messageID:Q.message.id},query:{directory:$.directory},throwOnError:!0}).catch(()=>{return}))?.data.parts?.some((W)=>W.type==="compaction"||W.type==="text"&&W.synthetic&&W.metadata?.compaction_continue===!0)){X.headers["x-initiator"]="agent";return}let J=await Z.session.get({path:{id:Q.sessionID},query:{directory:$.directory},throwOnError:!0}).catch(()=>{return});if(!J||!J.data.parentID)return;X.headers["x-initiator"]="agent"}}}var nH=d8(EH(),1),sH=d8(iH(),1);class a6{options;server;resolveCallback;rejectCallback;timeoutHandle;constructor($={}){this.options=$,this.server=nH.default({logger:!1}),this.server.register(sH.default,{max:30,timeWindow:60000}),this.server.get("/callback",async(Z,Q)=>{let{code:X,state:Y,error:J,error_description:W}=Z.query;if(J){let G=W||J;this.rejectCallback?.(Error(`OAuth error: ${G}`)),await Q.type("text/html").send(`
494
+ <!DOCTYPE html>
495
+ <html>
496
+ <head><title>Authentication Failed</title></head>
497
+ <body>
498
+ <h1>Authentication Failed</h1>
499
+ <p>${G}</p>
500
+ <p>You can close this window.</p>
501
+ </body>
502
+ </html>
503
+ `),this.cleanup();return}if(!X||!Y){this.rejectCallback?.(Error("Missing code or state parameter")),await Q.type("text/html").send(`
504
+ <!DOCTYPE html>
505
+ <html>
506
+ <head><title>Authentication Failed</title></head>
507
+ <body>
508
+ <h1>Authentication Failed</h1>
509
+ <p>Missing required parameters.</p>
510
+ <p>You can close this window.</p>
511
+ </body>
512
+ </html>
513
+ `),this.cleanup();return}this.resolveCallback?.({code:X,state:Y}),await Q.type("text/html").send(`
514
+ <!DOCTYPE html>
515
+ <html>
516
+ <head><title>Authentication Successful</title></head>
517
+ <body>
518
+ <h1>Authentication Successful</h1>
519
+ <p>You can close this window and return to your terminal.</p>
520
+ </body>
521
+ </html>
522
+ `),this.cleanup()})}async start(){let $=this.options.host||"127.0.0.1",Z=this.options.port||0;await this.server.listen({host:$,port:Z})}async waitForCallback(){let $=this.options.timeout||60000;return this.timeoutHandle=setTimeout(()=>{this.rejectCallback?.(Error("OAuth callback timeout")),this.cleanup()},$),new Promise((Z,Q)=>{this.resolveCallback=Z,this.rejectCallback=Q})}getPort(){let $=this.server.server.address();if(!$||typeof $==="string")throw Error("Server not started or using Unix socket");return $.port}getCallbackUrl(){let $=this.options.host||"127.0.0.1",Z=this.getPort();return`http://${$}:${Z}/callback`}cleanup(){if(this.timeoutHandle)clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0;setTimeout(()=>{this.server.close()},100)}async close(){if(this.timeoutHandle)clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0;await this.server.close()}}class z7{options;constructor($){this.options=$}async authorize(){let $=R5(43),Z=aH($),Q=R5(32);if(this.options.method==="auto")return this.authorizeWithCallback(Z,Q,$);else return this.authorizeWithManualCode(Z,Q,$)}async authorizeWithCallback($,Z,Q){let X=new a6({port:0,host:"127.0.0.1",timeout:this.options.timeout||60000});try{let Y=X.waitForCallback(),J=X.getCallbackUrl(),W=this.buildAuthorizationUrl(J,$,Z);await(await import("./chunk-2h2zq5cp.js")).default(W);let K=await Y;if(K.state!==Z)throw Error("State mismatch - possible CSRF attack");return{code:K.code,state:K.state,codeVerifier:Q}}finally{await X.close()}}authorizeWithManualCode($,Z,Q){throw this.buildAuthorizationUrl("http://127.0.0.1/callback",$,Z),Error("Manual code entry not yet implemented - use auto method")}buildAuthorizationUrl($,Z,Q){let X=new URLSearchParams({client_id:this.options.clientId,redirect_uri:$,response_type:"code",state:Q,scope:this.options.scopes.join(" "),code_challenge:Z,code_challenge_method:"S256"});return`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/authorize?${X.toString()}`}async exchangeAuthorizationCode($,Z,Q){let Y=`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/token`,J=new URLSearchParams({client_id:this.options.clientId,code:$,grant_type:"authorization_code",redirect_uri:Q,code_verifier:Z}),W=await fetch(Y,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:J.toString()});if(!W.ok){let K=await W.text();throw Error(`Token exchange failed: ${W.status} ${W.statusText} - ${K}`)}return await W.json()}async exchangeRefreshToken($){let Q=`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/token`,X=new URLSearchParams({client_id:this.options.clientId,refresh_token:$,grant_type:"refresh_token"}),Y=await fetch(Q,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:X.toString()});if(!Y.ok){let W=await Y.text();throw Error(`Token refresh failed: ${Y.status} ${Y.statusText} - ${W}`)}return await Y.json()}}import i0 from"fs";import s$ from"path";import oH from"os";var t6=process.env.GITLAB_OAUTH_CLIENT_ID||"1d89f9fdb23ee96d4e603201f6861dab6e143c5c3c00469a018a2d94bdc03d4e",Hx="https://gitlab.com",P5=["api"];function o6(){return process.env.GITLAB_INSTANCE_URL||Hx}function x0($,Z){try{let Q=oH.homedir(),X=s$.join(Q,".local","share","opencode","log");if(!i0.existsSync(X))i0.mkdirSync(X,{recursive:!0});let Y=s$.join(X,"gitlab-auth.log"),J=new Date().toISOString(),W=Z?`[${J}] ${$}: ${JSON.stringify(Z)}
523
+ `:`[${J}] ${$}
524
+ `;i0.appendFileSync(Y,W)}catch{}}function C5(){let $=oH.homedir(),Z=process.env.XDG_DATA_HOME;if(Z)return s$.join(Z,"opencode","auth.json");if(process.platform!=="win32")return s$.join($,".local","share","opencode","auth.json");return s$.join($,".opencode","auth.json")}async function rH($,Z,Q,X){let Y=C5(),J=s$.dirname(Y);if(!i0.existsSync(J))i0.mkdirSync(J,{recursive:!0});let W={};if(i0.existsSync(Y)){let G=i0.readFileSync(Y,"utf-8");W=JSON.parse(G)}W.gitlab={type:"oauth",access:$,refresh:Z,expires:Q,enterpriseUrl:X},i0.writeFileSync(Y,JSON.stringify(W,null,2)),i0.chmodSync(Y,384)}async function Mx($,Z){let Q=C5(),X=s$.dirname(Q);if(!i0.existsSync(X))i0.mkdirSync(X,{recursive:!0});let Y={};if(i0.existsSync(Q)){let J=i0.readFileSync(Q,"utf-8");Y=JSON.parse(J)}Y.gitlab={type:"api",key:$,enterpriseUrl:Z},i0.writeFileSync(Q,JSON.stringify(Y,null,2)),i0.chmodSync(Q,384)}var r6=null;async function Ax($,Z,Q){let X=Date.now(),Y=300000;if(!($.expires<=X+300000))return x0("Token is still valid",{expiresAt:new Date($.expires).toISOString(),expiresIn:Math.round(($.expires-X)/1000/60)+" minutes"}),{apiKey:$.access,instanceUrl:$.enterpriseUrl||Q};if(r6){x0("Token refresh already in progress, waiting..."),await r6;let G=await Z();if(G&&G.type==="oauth")return{apiKey:G.access,instanceUrl:G.enterpriseUrl||Q};throw Error("Failed to get refreshed auth data")}x0("Token expired or expiring soon, refreshing...",{expiresAt:new Date($.expires).toISOString(),expired:$.expires<=X}),r6=(async()=>{try{let G=$.enterpriseUrl||Q,K=new z7({instanceUrl:G,clientId:t6,scopes:P5,method:"auto"});x0("Calling exchangeRefreshToken...");let B=await K.exchangeRefreshToken($.refresh),U=Date.now()+B.expires_in*1000;x0("Token refresh successful",{newExpiresAt:new Date(U).toISOString(),expiresIn:Math.round(B.expires_in/60)+" minutes"}),await rH(B.access_token,B.refresh_token,U,G),x0("New tokens saved successfully")}catch(G){if(x0("Token refresh failed",{error:G instanceof Error?G.message:String(G),stack:G instanceof Error?G.stack:void 0}),G instanceof Error&&G.message.includes("401")){x0("Refresh token appears to be revoked (401), clearing auth data");let K=C5();if(i0.existsSync(K)){let B=i0.readFileSync(K,"utf-8"),U=JSON.parse(B);delete U.gitlab,i0.writeFileSync(K,JSON.stringify(U,null,2))}}throw G}})();try{await r6}finally{r6=null}let W=await Z();if(W&&W.type==="oauth")return{apiKey:W.access,instanceUrl:W.enterpriseUrl||Q};throw Error("Failed to get refreshed auth data after token refresh")}var tH=async($)=>{return{auth:{provider:"gitlab",async loader(Q){let X=await Q();if(!X)return{};if(X.type==="oauth")try{return{...await Ax(X,Q,o6()),clientId:t6}}catch(Y){return x0("Failed to refresh token in loader",{error:Y instanceof Error?Y.message:String(Y)}),{apiKey:X.access,instanceUrl:X.enterpriseUrl||o6(),clientId:t6}}if(X.type==="api"){let Y=X.enterpriseUrl||o6();return{apiKey:X.key,instanceUrl:Y}}return{}},methods:[{type:"oauth",label:"GitLab OAuth",prompts:[],async authorize(){let Q=o6(),X;try{let O=new URL(Q);X=`${O.protocol}//${O.host}`}catch{throw Error(`Invalid GitLab instance URL: ${Q}`)}let{generateSecret:Y,generateCodeChallengeFromVerifier:J}=await import("./chunk-8refh038.js"),W=Y(43),G=J(W),K=Y(32),B=new a6({port:8080,host:"127.0.0.1",timeout:120000});await B.start();let U=B.getCallbackUrl(),w=B.waitForCallback(),H=new URLSearchParams({client_id:t6,redirect_uri:U,response_type:"code",state:K,scope:P5.join(" "),code_challenge:G,code_challenge_method:"S256"}),V=`${X}/oauth/authorize?${H.toString()}`,{exec:z}=await import("child_process"),N=process.platform;return z(`${N==="darwin"?"open":N==="win32"?"start":"xdg-open"} "${V}"`),{method:"auto",url:V,instructions:"Your browser will open for authentication. The callback will be handled automatically.",async callback(){x0("callback() called");try{x0("Waiting for callback...");let O=await w;if(x0("Received callback",{hasCode:!!O.code,hasState:!!O.state}),O.state!==K)return x0("State mismatch",{expected:K,received:O.state}),await B.close(),{type:"failed"};x0("State verified"),x0("Exchanging code for tokens...");let M=await new z7({instanceUrl:X,clientId:t6,scopes:P5,method:"auto"}).exchangeAuthorizationCode(O.code,W,U);x0("Token exchange successful"),await B.close();let A=Date.now()+M.expires_in*1000;return x0("Tokens received",{expiresAt:new Date(A).toISOString()}),x0("Saving auth data..."),await rH(M.access_token,M.refresh_token,A,X),x0("Auth data saved successfully"),{type:"success",provider:X,access:M.access_token,refresh:M.refresh_token,expires:A}}catch(O){x0("Error in callback",{error:O instanceof Error?O.message:String(O),stack:O instanceof Error?O.stack:void 0});try{await B.close()}catch(j){}return{type:"failed"}}}}}},{type:"api",label:"GitLab Personal Access Token",prompts:[{type:"text",key:"token",message:"Personal Access Token",placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",validate:(Q)=>{if(!Q)return"Token is required";if(!Q.startsWith("glpat-"))return"Token should start with glpat-";return}}],async authorize(Q){let X=o6(),Y=Q?.token;if(!Y)return{type:"failed"};let J;try{let W=new URL(X);J=`${W.protocol}//${W.host}`}catch{return{type:"failed"}}try{if(!(await fetch(`${J}/api/v4/user`,{headers:{Authorization:`Bearer ${Y}`}})).ok)return{type:"failed"};return x0("Saving PAT auth data..."),await Mx(Y,J),x0("PAT auth data saved successfully"),{type:"success",key:Y,provider:J}}catch{return{type:"failed"}}}}]}}};import Fx from"http";import eH from"crypto";var Nx="https://poe.com/oauth/authorize",Ox="https://api.poe.com/token";function b5($){let Z=$.fetch??globalThis.fetch;return{authorize:()=>Tx($,Z)}}function jx(){return eH.randomBytes(32).toString("base64url")}function Dx($){return eH.createHash("sha256").update($).digest("base64url")}async function Tx($,Z){let Q=$.authorizationEndpoint??Nx,X=$.tokenEndpoint??Ox,Y=jx(),J=Dx(Y),W=$.createServer?$.createServer():Fx.createServer(),K=`http://127.0.0.1:${await qx(W)}/callback`,B=fx({endpoint:Q,clientId:$.clientId,redirectUri:K,codeChallenge:J});return{authorizationUrl:B,waitForResult:async()=>{try{let w=await Lx(W,$,B);return await Px({tokenEndpoint:X,code:w,codeVerifier:Y,clientId:$.clientId,redirectUri:K,fetchFn:Z})}finally{W.closeAllConnections?.(),W.close()}}}}function qx($){return new Promise((Z)=>{$.listen(0,"127.0.0.1",()=>{let Q=$.address();Z(Q.port)})})}function fx($){let Z=new URL($.endpoint);return Z.searchParams.set("response_type","code"),Z.searchParams.set("client_id",$.clientId),Z.searchParams.set("scope","apikey:create"),Z.searchParams.set("code_challenge",$.codeChallenge),Z.searchParams.set("code_challenge_method","S256"),Z.searchParams.set("redirect_uri",$.redirectUri),Z.toString()}function Lx($,Z,Q){return new Promise((X,Y)=>{let J=!1,W=(G)=>{if(!J)J=!0,G()};if($.on("request",(G,K)=>{let B=new URL(G.url,"http://127.0.0.1");if(B.pathname!=="/callback"){K.writeHead(404),K.end("Not found");return}let U=B.searchParams.get("error");if(U){let H=B.searchParams.get("error_description")??U;K.writeHead(400),K.end(`Authorization failed: ${H}`),W(()=>Y(Error(`OAuth authorization failed: ${U} \u2014 ${H}`)));return}let w=B.searchParams.get("code");if(!w){K.writeHead(400),K.end("Missing authorization code"),W(()=>Y(Error("OAuth callback missing authorization code")));return}K.writeHead(200,{"Content-Type":"text/html"}),K.end(Ex(Z.landingPage)),W(()=>X(w))}),Z.readLine)Z.readLine().then((G)=>{let K=Rx(G);if(K)W(()=>X(K))}).catch(()=>{});if(Z.openBrowser)Z.openBrowser(Q).catch((G)=>W(()=>Y(G)))})}function Rx($){let Z=$.replace(/[\r\n]/g,"").trim();if(Z.length===0)return null;try{return new URL(Z).searchParams.get("code")}catch{return Z}}async function Px($){let Z=new URLSearchParams({grant_type:"authorization_code",code:$.code,code_verifier:$.codeVerifier,client_id:$.clientId,redirect_uri:$.redirectUri}),Q=await $.fetchFn($.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Z.toString()});if(!Q.ok){let Y=await Q.text(),J=Cx(Y);throw Error(J??`Token exchange failed (${Q.status}): ${Y}`)}let X=await Q.json();if(typeof X.api_key!=="string"||X.api_key.length===0)throw Error("Token response missing api_key field");return{apiKey:X.api_key,expiresIn:typeof X.api_key_expires_in==="number"?X.api_key_expires_in:null}}function Cx($){try{let Z=JSON.parse($);if(typeof Z.error_description==="string")return Z.error_description;if(typeof Z.error==="string")return Z.error}catch{}return null}function E5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ex($){let Z=$?.title??"Connected to Poe",Q=$?.body??"You can close this tab and return to your terminal.";return["<!DOCTYPE html>",`<html><head><meta charset=utf-8><title>${E5(Z)}</title></head>`,'<body style="font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0">','<div style="text-align:center">',`<h1>${E5(Z)}</h1>`,`<p style="color:#666">${E5(Q)}</p>`,"</div></body></html>"].join("")}var bx="client_728290227fc048cc9262091a1ea197ea";function _x($){if($==null)return Number.MAX_SAFE_INTEGER;return Date.now()+$*1000}async function Ix(){let Z=await b5({clientId:bx,landingPage:{title:"Connected to Poe",body:"You can close this tab and return to OpenCode."},openBrowser:async(Q)=>{await $M(Q)}}).authorize();return{url:Z.authorizationUrl,instructions:"Complete authorization in your browser. This window will close automatically.",method:"auto",callback:async()=>{let Q=await Z.waitForResult();return{type:"success",access:Q.apiKey,refresh:Q.apiKey,expires:_x(Q.expiresIn)}}}}async function w7($){return{auth:{provider:"poe",async loader(Z){let Q=await Z();if(Q.type==="api")return{apiKey:Q.key};if(Q.type!=="oauth")return{};if(Q.expires<Date.now())throw Error("Poe API key expired. Run `opencode providers login` again.");return{apiKey:Q.access}},methods:[{label:"Login with Poe (browser)",type:"oauth",authorize:Ix},{label:"Manually enter API Key",type:"api"}]}}}async function ZM($){return{auth:{provider:"cloudflare-workers-ai",methods:[{type:"api",label:"API key",prompts:!process.env.CLOUDFLARE_ACCOUNT_ID?[{type:"text",key:"accountId",message:"Enter your Cloudflare Account ID",placeholder:"e.g. 1234567890abcdef1234567890abcdef"}]:[]}]}}}async function QM($){return{auth:{provider:"cloudflare-ai-gateway",methods:[{type:"api",label:"Gateway API token",prompts:[...!process.env.CLOUDFLARE_ACCOUNT_ID?[{type:"text",key:"accountId",message:"Enter your Cloudflare Account ID",placeholder:"e.g. 1234567890abcdef1234567890abcdef"}]:[],...!process.env.CLOUDFLARE_GATEWAY_ID?[{type:"text",key:"gatewayId",message:"Enter your Cloudflare AI Gateway ID",placeholder:"e.g. my-gateway"}]:[]]}]},"chat.params":async(Q,X)=>{if(Q.model.providerID!=="cloudflare-ai-gateway")return;if(!Q.model.api.id.toLowerCase().startsWith("openai/"))return;if(!Q.model.capabilities.reasoning)return;X.maxOutputTokens=void 0}}}async function XM($){let Z=[];if(!process.env.AZURE_RESOURCE_NAME)Z.push({type:"text",key:"resourceName",message:"Enter Azure Resource Name",placeholder:"e.g. my-models"});return{auth:{provider:"azure",methods:[{type:"api",label:"API key",prompts:Z}]}}}import{createServer as Sx}from"http";var a$=G1({service:"plugin.digitalocean"}),xx="b1a6c5158156caac821fd1b30253ca8acb52454a48fa744420e41889cb589f82",kx="https://cloud.digitalocean.com/v1/oauth/authorize",vx="https://api.digitalocean.com",yx=`${vx}/v2/gen-ai`,gx="https://inference.do-ai.run/v1",V7=1456,WM="/auth/callback",GM="/auth/token",hx=300000,KM="genai:read inference:query",o$,N1;function ux(){let $=crypto.getRandomValues(new Uint8Array(32));return Array.from($).map((Z)=>Z.toString(16).padStart(2,"0")).join("")}function mx(){return`http://localhost:${V7}${WM}`}function lx($){let Z=new URLSearchParams({response_type:"token",client_id:xx,redirect_uri:mx(),scope:KM,state:$});return`${kx}?${Z.toString()}`}var cx=`<!doctype html>
525
+ <html>
526
+ <head>
527
+ <meta charset="utf-8" />
528
+ <title>MuxCode - DigitalOcean Authorization</title>
529
+ <style>
530
+ body { font-family: system-ui, -apple-system, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #0b1220; color: #e8eef9; }
531
+ .container { text-align: center; padding: 2rem; max-width: 32rem; }
532
+ h1 { color: #e8eef9; margin-bottom: 1rem; }
533
+ p { color: #9aa9c0; }
534
+ .error { color: #ff917b; font-family: monospace; margin-top: 1rem; padding: 1rem; background: #3c140d; border-radius: 0.5rem; }
535
+ </style>
536
+ </head>
537
+ <body>
538
+ <div class="container">
539
+ <h1 id="title">Finishing sign-in...</h1>
540
+ <p id="msg">You can close this window once it says you're signed in.</p>
541
+ </div>
542
+ <script>
543
+ (async function() {
544
+ const params = new URLSearchParams((window.location.hash || "").slice(1))
545
+ const search = new URLSearchParams(window.location.search)
546
+ const error = params.get("error") || search.get("error")
547
+ const errorDescription = params.get("error_description") || search.get("error_description")
548
+ const titleEl = document.getElementById("title")
549
+ const msgEl = document.getElementById("msg")
550
+ const tokenUrl = new URL(${JSON.stringify(GM)}, window.location.origin).href
551
+ try {
552
+ const body = error
553
+ ? { error, error_description: errorDescription || "" }
554
+ : { access_token: params.get("access_token") || "", expires_in: params.get("expires_in") || "0", state: params.get("state") || "" }
555
+ const res = await fetch(tokenUrl, {
556
+ method: "POST",
557
+ headers: { "Content-Type": "application/json" },
558
+ body: JSON.stringify(body),
559
+ })
560
+ if (!res.ok) {
561
+ const detail = await res.text().catch(function () { return "" })
562
+ throw new Error(detail || ("callback failed (" + res.status + ")"))
563
+ }
564
+ if (error) {
565
+ titleEl.textContent = "Authorization Failed"
566
+ msgEl.textContent = errorDescription || error
567
+ msgEl.className = "error"
568
+ return
569
+ }
570
+ titleEl.textContent = "Authorization Successful"
571
+ msgEl.textContent = "You can close this window and return to MuxCode."
572
+ setTimeout(function () { window.close() }, 2000)
573
+ } catch (e) {
574
+ titleEl.textContent = "Authorization Failed"
575
+ msgEl.textContent = String(e && e.message ? e.message : e)
576
+ msgEl.className = "error"
577
+ }
578
+ })()
579
+ </script>
580
+ </body>
581
+ </html>`;async function dx(){if(o$)return;o$=Sx(($,Z)=>{let Q=new URL($.url||"/",`http://localhost:${V7}`);if($.method==="GET"&&Q.pathname===WM){Z.writeHead(200,{"Content-Type":"text/html"}),Z.end(cx);return}if($.method==="POST"&&Q.pathname===GM){let X=[];$.on("data",(Y)=>X.push(Y)),$.on("end",()=>{let Y=Buffer.concat(X).toString("utf8"),J={};try{J=Y?JSON.parse(Y):{}}catch{J={}}if(!N1){Z.writeHead(409,{"Content-Type":"application/json"}),Z.end(JSON.stringify({error:"no_pending_oauth"}));return}if(J.error){let G=J.error_description||J.error||"OAuth error";N1.reject(Error(String(G))),N1=void 0,Z.writeHead(200,{"Content-Type":"application/json"}),Z.end(JSON.stringify({ok:!0}));return}if(!J.access_token){N1.reject(Error("Missing access_token in callback")),N1=void 0,Z.writeHead(400,{"Content-Type":"application/json"}),Z.end(JSON.stringify({error:"missing_access_token"}));return}if(J.state!==N1.state){N1.reject(Error("Invalid state - potential CSRF attack")),N1=void 0,Z.writeHead(400,{"Content-Type":"application/json"}),Z.end(JSON.stringify({error:"invalid_state"}));return}let W=parseInt(J.expires_in||"0",10);N1.resolve({access_token:J.access_token,expires_in:Number.isFinite(W)&&W>0?W:2592000,state:J.state}),N1=void 0,Z.writeHead(200,{"Content-Type":"application/json"}),Z.end(JSON.stringify({ok:!0}))});return}Z.writeHead(404),Z.end("Not found")}),await new Promise(($,Z)=>{o$.listen(V7,()=>{a$.info("digitalocean oauth server started",{port:V7}),$()}),o$.on("error",Z)})}function px(){if(!o$)return;o$.close(()=>a$.info("digitalocean oauth server stopped")),o$=void 0}function ix($){return new Promise((Z,Q)=>{let X=setTimeout(()=>{if(N1)N1=void 0,Q(Error("OAuth callback timeout - authorization took too long"))},300000);N1={state:$,resolve:(Y)=>{clearTimeout(X),Z(Y)},reject:(Y)=>{clearTimeout(X),Q(Y)}}})}async function YM($){let Z=await fetch(`${yx}/models/routers`,{headers:{Authorization:`Bearer ${$}`,Accept:"application/json","User-Agent":`muxcode/${h0}`},signal:AbortSignal.timeout(1e4)}).catch(()=>{return});if(!Z)return{ok:!1,status:0};if(!Z.ok)return{ok:!1,status:Z.status};return{ok:!0,routers:(await Z.json().catch(()=>{return}))?.model_routers??[]}}function nx($,Z){let Q=`router:${$.name}`;return{id:Q,providerID:Z,name:$.name,family:"digitalocean-inference-routers",api:{id:Q,url:gx,npm:"@ai-sdk/openai-compatible"},status:"active",headers:{},options:{},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:128000,output:8192},capabilities:{temperature:!0,reasoning:!1,attachment:!1,toolcall:!0,input:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},release_date:"",variants:{}}}function sx($){if(!$)return[];try{let Z=JSON.parse($);if(!Array.isArray(Z))return[];return Z.flatMap((Q)=>Q&&typeof Q.name==="string"?[{name:Q.name,uuid:Q.uuid,description:Q.description}]:[])}catch{return[]}}async function BM($){return{provider:{id:"digitalocean",async models(Z,Q){let X=Z.models;if(Q.auth?.type!=="api")return X;let Y=Q.auth.metadata??{},J=Y.oauth_access,W=parseInt(Y.oauth_expires||"0",10),G=parseInt(Y.routers_fetched_at||"0",10),B=sx(Y.routers),U=Date.now()-G>hx;if(J&&W>Date.now()&&U){let V=await YM(J);if(V.ok){B=V.routers;let z={...Y,routers:JSON.stringify(B.map((N)=>({name:N.name,uuid:N.uuid,description:N.description}))),routers_fetched_at:String(Date.now())};await $.client.auth.set({path:{id:"digitalocean"},body:{type:"api",key:Q.auth.key,metadata:z}}).catch((N)=>a$.warn("failed to persist refreshed routers",{error:N}))}else if(V.status===401||V.status===403)a$.warn("digitalocean oauth bearer rejected; using cached routers",{status:V.status});else if(V.status!==0)a$.warn("digitalocean router refresh failed",{status:V.status})}let H={...X};for(let V of B){let z=`router:${V.name}`;if(H[z])continue;H[z]=nx(V,"digitalocean")}return H}},auth:{provider:"digitalocean",methods:[{type:"oauth",label:"Login with DigitalOcean",async authorize(){await dx();let Z=ux(),Q=ix(Z),X=lx(Z);return await JM(X).catch(()=>{return}),{url:X,instructions:"Sign in to DigitalOcean in your browser. MuxCode will use your DigitalOcean API token directly for inference and load your Inference Routers. Re-run /connect to refresh routers later.",method:"auto",async callback(){try{let Y=await Q,J=await YM(Y.access_token),W=J.ok?J.routers:[];if(!J.ok)a$.warn("digitalocean initial router fetch failed",{status:J.status});return{type:"success",provider:"digitalocean",key:Y.access_token,metadata:{oauth_access:Y.access_token,oauth_expires:String(Date.now()+Y.expires_in*1000),oauth_scopes:KM,routers:JSON.stringify(W.map((G)=>({name:G.name,uuid:G.uuid,description:G.description}))),routers_fetched_at:String(Date.now())}}}catch(Y){return a$.error("digitalocean oauth callback failed",{error:Y}),{type:"failed"}}finally{px()}}}}},{type:"api",label:"Paste Model Access Key"}]}}}import{createServer as ax}from"http";var r$=G1({service:"plugin.xai"}),e6="b1a00492-073a-47ea-816f-4c329264a828",ox="https://auth.x.ai/oauth2/authorize",I5="https://auth.x.ai/oauth2/token",rx="https://auth.x.ai/oauth2/device/code",tx="urn:ietf:params:oauth:grant-type:device_code",VM="openid profile email offline_access grok-cli:access api:access",ex=5000,$k=1000,Zk=5000,Qk=300000,UM=3000,H7="127.0.0.1",I8=56121,HM="/callback",M7=`http://${H7}:${I8}${HM}`,MM=120000;async function Xk(){let $=Yk(64),Z=await crypto.subtle.digest("SHA-256",new TextEncoder().encode($));return{verifier:$,challenge:AM(Z)}}function Yk($){return Array.from(crypto.getRandomValues(new Uint8Array($))).map((Q)=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"[Q%66]).join("")}function AM($){let Z=String.fromCharCode(...new Uint8Array($));return btoa(Z).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function zM(){return AM(crypto.getRandomValues(new Uint8Array(32)).buffer)}function Jk($){return $.replace(/[&<>"']/g,(Z)=>{switch(Z){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#39;";default:return Z}})}function A7(){return{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json","User-Agent":`muxcode/${h0}`}}function Wk($,Z=MM){if(!$||typeof $!=="string")return!1;let Q=$.split(".");if(Q.length<2)return!1;try{let X=Q[1].replace(/-/g,"+").replace(/_/g,"/");while(X.length%4!==0)X+="=";let Y=JSON.parse(Buffer.from(X,"base64").toString("utf8"));if(typeof Y?.exp!=="number")return!1;return Y.exp*1000<=Date.now()+Math.max(0,Z)}catch{return!1}}function Gk($,Z,Q,X={}){let Y=new URLSearchParams({response_type:"code",client_id:e6,redirect_uri:M7,scope:VM,code_challenge:$.challenge,code_challenge_method:"S256",state:Z,nonce:Q,plan:"generic",referrer:"muxcode"});return`${X.authorizeUrl??ox}?${Y.toString()}`}async function Kk($,Z,Q={}){let X=await fetch(Q.tokenUrl??I5,{method:"POST",headers:A7(),body:new URLSearchParams({grant_type:"authorization_code",code:$,redirect_uri:M7,client_id:e6,code_verifier:Z.verifier}).toString()});if(!X.ok){let Y=await X.text().catch(()=>"");throw Error(`xAI token exchange failed (${X.status})${Y?`: ${Y}`:""}`)}return X.json()}async function Bk($,Z={}){let Q=await fetch(Z.tokenUrl??I5,{method:"POST",headers:A7(),body:new URLSearchParams({grant_type:"refresh_token",refresh_token:$,client_id:e6}).toString()});if(!Q.ok){let X=await Q.text().catch(()=>"");throw Error(`xAI token refresh failed (${Q.status})${X?`: ${X}`:""}`)}return Q.json()}async function Uk($={}){let Z=await fetch($.deviceAuthorizationUrl??rx,{method:"POST",headers:A7(),body:new URLSearchParams({client_id:e6,scope:VM}).toString()});if(!Z.ok){let X=await Z.text().catch(()=>"");throw Error(`xAI device code request failed (${Z.status})${X?`: ${X}`:""}`)}let Q=await Z.json();if(!Q.device_code||!Q.user_code||!Q.verification_uri)throw Error("xAI device code response is missing device_code / user_code / verification_uri");return Q}async function zk($){await new Promise((Z)=>setTimeout(Z,$))}function wM($,Z){let Q=Number($);return Number.isFinite(Q)&&Q>0?Q*1000:Z}async function wk($,Z={}){let Q=Z.sleep??zk,X=Z.now??(()=>Date.now()),Y=wM($.expires_in,Qk),J=X()+Y,W=Math.max(wM($.interval,ex),$k);while(X()<J){let G=await fetch(Z.tokenUrl??I5,{method:"POST",headers:A7(),body:new URLSearchParams({grant_type:tx,client_id:e6,device_code:$.device_code}).toString()});if(G.ok)return await G.json();let K=await G.json().catch(()=>({})),B=Math.max(0,J-X());if(K.error==="authorization_pending"){await Q(Math.min(W+UM,B));continue}if(K.error==="slow_down"){W+=Zk,await Q(Math.min(W+UM,B));continue}if(K.error==="access_denied"||K.error==="authorization_denied")throw Error("xAI device authorization was denied");if(K.error==="expired_token")throw Error("xAI device code expired - please re-run login");let U=K.error_description??K.error??"";throw Error(`xAI device token exchange failed (${G.status})${U?`: ${U}`:""}`)}throw Error("xAI device authorization timed out")}var Vk=`<!doctype html>
582
+ <html>
583
+ <head>
584
+ <title>MuxCode - xAI Authorization Successful</title>
585
+ <style>
586
+ body {
587
+ font-family:
588
+ system-ui,
589
+ -apple-system,
590
+ sans-serif;
591
+ display: flex;
592
+ justify-content: center;
593
+ align-items: center;
594
+ height: 100vh;
595
+ margin: 0;
596
+ background: #131010;
597
+ color: #f1ecec;
598
+ }
599
+ .container {
600
+ text-align: center;
601
+ padding: 2rem;
602
+ }
603
+ h1 {
604
+ color: #f1ecec;
605
+ margin-bottom: 1rem;
606
+ }
607
+ p {
608
+ color: #b7b1b1;
609
+ }
610
+ </style>
611
+ </head>
612
+ <body>
613
+ <div class="container">
614
+ <h1>Authorization Successful</h1>
615
+ <p>You can close this window and return to MuxCode.</p>
616
+ </div>
617
+ <script>
618
+ setTimeout(() => window.close(), 2000)
619
+ </script>
620
+ </body>
621
+ </html>`,_5=($)=>`<!doctype html>
622
+ <html>
623
+ <head>
624
+ <title>MuxCode - xAI Authorization Failed</title>
625
+ <style>
626
+ body {
627
+ font-family:
628
+ system-ui,
629
+ -apple-system,
630
+ sans-serif;
631
+ display: flex;
632
+ justify-content: center;
633
+ align-items: center;
634
+ height: 100vh;
635
+ margin: 0;
636
+ background: #131010;
637
+ color: #f1ecec;
638
+ }
639
+ .container {
640
+ text-align: center;
641
+ padding: 2rem;
642
+ }
643
+ h1 {
644
+ color: #fc533a;
645
+ margin-bottom: 1rem;
646
+ }
647
+ p {
648
+ color: #b7b1b1;
649
+ }
650
+ .error {
651
+ color: #ff917b;
652
+ font-family: monospace;
653
+ margin-top: 1rem;
654
+ padding: 1rem;
655
+ background: #3c140d;
656
+ border-radius: 0.5rem;
657
+ }
658
+ </style>
659
+ </head>
660
+ <body>
661
+ <div class="container">
662
+ <h1>Authorization Failed</h1>
663
+ <p>An error occurred during authorization.</p>
664
+ <div class="error">${Jk($)}</div>
665
+ </div>
666
+ </body>
667
+ </html>`,Hk=new Set(["https://accounts.x.ai","https://auth.x.ai"]),S8,n0;async function Mk(){if(S8)return{port:I8,redirectUri:M7};let $=ax((Z,Q)=>{let X=Z.url||"/",Y=new URL(X,`http://${H7}:${I8}`),J=Z.headers.origin,W=typeof J==="string"&&Hk.has(J)?J:"";if(W)Q.setHeader("Access-Control-Allow-Origin",W),Q.setHeader("Access-Control-Allow-Methods","GET, OPTIONS"),Q.setHeader("Access-Control-Allow-Headers","Content-Type"),Q.setHeader("Access-Control-Allow-Private-Network","true"),Q.setHeader("Vary","Origin");if(Z.method==="OPTIONS"){Q.writeHead(204),Q.end();return}if(Y.pathname===HM){let G=Y.searchParams.get("code"),K=Y.searchParams.get("state"),B=Y.searchParams.get("error"),U=Y.searchParams.get("error_description");if(B){let H=U||B;n0?.reject(Error(H)),n0=void 0,Q.writeHead(200,{"Content-Type":"text/html"}),Q.end(_5(H));return}if(!G){n0?.reject(Error("Missing authorization code")),n0=void 0,Q.writeHead(400,{"Content-Type":"text/html"}),Q.end(_5("Missing authorization code"));return}if(!n0||K!==n0.state){n0?.reject(Error("Invalid state - potential CSRF attack")),n0=void 0,Q.writeHead(400,{"Content-Type":"text/html"}),Q.end(_5("Invalid state - potential CSRF attack"));return}let w=n0;n0=void 0,Kk(G,w.pkce).then((H)=>w.resolve(H)).catch((H)=>w.reject(H)),Q.writeHead(200,{"Content-Type":"text/html"}),Q.end(Vk);return}if(Y.pathname==="/cancel"){n0?.reject(Error("Login cancelled")),n0=void 0,Q.writeHead(200),Q.end("Login cancelled");return}Q.writeHead(404),Q.end("Not found")});return await new Promise((Z,Q)=>{let X=(Y)=>{S8=void 0,Q(Y)};$.once("error",X),$.listen(I8,H7,()=>{$.removeListener("error",X),$.on("error",(Y)=>r$.warn("xai oauth server error",{error:Y})),r$.info("xai oauth server started",{host:H7,port:I8}),Z()}),S8=$}),{port:I8,redirectUri:M7}}function Ak(){if(S8)S8.close(()=>r$.info("xai oauth server stopped")),S8=void 0}function Fk($,Z){if(n0)n0.reject(Error("Superseded by a newer xAI authorize request")),n0=void 0;return new Promise((Q,X)=>{let Y=setTimeout(()=>{if(n0)n0=void 0,X(Error("OAuth callback timeout - authorization took too long"))},300000);n0={pkce:$,state:Z,resolve:(J)=>{clearTimeout(Y),Q(J)},reject:(J)=>{clearTimeout(Y),X(J)}}})}async function FM($,Z={}){return{auth:{provider:"xai",async loader(Q){if((await Q()).type!=="oauth")return{};let Y;return{apiKey:BZ,async fetch(J,W){let G=await Q();if(G.type!=="oauth")return fetch(J,W);if(!G.expires||G.expires-Date.now()<=MM||Wk(G.access)){if(!Y){let w=G.refresh;r$.info("refreshing xai access token"),Y=Bk(w,Z).then(async(H)=>{let V=Date.now()+(H.expires_in??3600)*1000,z=H.refresh_token||w;return await $.client.auth.set({path:{id:"xai"},body:{type:"oauth",access:H.access_token,refresh:z,expires:V}}).catch((N)=>r$.warn("failed to persist refreshed xai tokens",{error:N})),{access:H.access_token,refresh:z,expires:V}}).finally(()=>{Y=void 0})}let U=await Y;G={...G,...U}}let B=new Headers(J instanceof Request?J.headers:void 0);if(W?.headers){let U=W.headers instanceof Headers?W.headers.entries():Array.isArray(W.headers)?W.headers:Object.entries(W.headers);for(let[w,H]of U)if(H!==void 0)B.set(w,String(H))}return B.set("authorization",`Bearer ${G.access}`),B.set("User-Agent",`muxcode/${h0}`),fetch(J,{...W,headers:B})}}},methods:[{label:"xAI Grok OAuth (SuperGrok Subscription)",type:"oauth",authorize:async()=>{await Mk();let Q=await Xk(),X=zM(),Y=zM(),J=Gk(Q,X,Y,Z),W=Fk(Q,X);return{url:J,instructions:"Complete authorization in your browser. This window will close automatically.",method:"auto",callback:async()=>{try{let G=await W;return{type:"success",refresh:G.refresh_token,access:G.access_token,expires:Date.now()+(G.expires_in??3600)*1000}}catch(G){return r$.error("xai oauth callback failed",{error:G}),{type:"failed"}}finally{Ak()}}}}},{label:"xAI Grok OAuth (Headless / Remote / VPS)",type:"oauth",authorize:async()=>{let Q=await Uk(Z);return{url:Q.verification_uri_complete??Q.verification_uri,instructions:`Open ${Q.verification_uri} on any device and enter code: ${Q.user_code}`,method:"auto",callback:async()=>{try{let Y=await wk(Q,Z);return{type:"success",refresh:Y.refresh_token,access:Y.access_token,expires:Date.now()+(Y.expires_in??3600)*1000}}catch(Y){return r$.error("xai device code callback failed",{error:Y}),{type:"failed"}}}}}},{label:"Manually enter API Key",type:"api"}]}}}var k5;((Cm)=>{function $(G){if(!G||typeof G!=="object")return"";return"message"in G&&typeof G.message==="string"?G.message:""}function Z(G,K){if(G!=="install")return!1;return $(K).includes("missing package.json or index file")}function Q(G){let K=x5.pluginSpecifier(G);return{spec:K,options:x5.pluginOptions(G),deprecated:NM(K)}}async function X(G,K){let B="";try{B=await jM(G.spec)}catch(w){return{ok:!1,stage:"install",error:w}}if(!B)return{ok:!1,stage:"install",error:Error(`Plugin ${G.spec} target is empty`)};let U;try{U=await DM(G.spec,B,K)}catch(w){return{ok:!1,stage:"entry",error:w}}if(!U.entry)return{ok:!1,stage:"missing",value:{...G,source:U.source,target:U.target,pkg:U.pkg,message:`Plugin ${G.spec} does not expose a ${K} entrypoint`}};if(U.source==="npm")try{await OM(U.target,h0,U.pkg)}catch(w){return{ok:!1,stage:"compatibility",error:w}}return{ok:!0,value:{...G,source:U.source,target:U.target,entry:U.entry,pkg:U.pkg}}}Cm.resolve=X;async function Y(G){let K;try{K=await import(G.entry)}catch(B){return{ok:!1,error:B}}if(!K)return{ok:!1,error:Error(`Plugin ${G.spec} module is empty`)};return{ok:!0,value:{...G,mod:K}}}Cm.load=Y;async function J(G,K,B,U,w,H){let V=G.plan,z=S5(V.spec)==="file";if(V.deprecated)return{retry:!1};H?.start?.(G,B);let N=await X(V,K);if(!N.ok){if(N.stage==="missing"){if(w){let j=await w(N.value,G.origin,B);if(j!==void 0)return{value:j,retry:!1}}return H?.missing?.(G,B,N.value.message,N.value),{retry:!1}}return H?.error?.(G,B,N.stage,N.error),{retry:z&&Z(N.stage,N.error)}}let F=await Y(N.value);if(!F.ok)return H?.error?.(G,B,"load",F.error,N.value),{retry:!1};if(!U)return{value:F.value,retry:!1};return{value:await U(F.value,G.origin,B),retry:!1}}async function W(G){let K=G.items.map((H)=>({origin:H,plan:Q(H.spec)})),B=[];for(let H of K)B.push(J(H,G.kind,!1,G.finish,G.missing,G.report));let U=await Promise.all(B);if(G.wait){let H;for(let V=0;V<K.length;V++){let z=U[V];if(z?.value!==void 0)continue;if(z?.retry!==!0)continue;let N=K[V];if(!N||S5(N.plan.spec)!=="file")continue;H??=G.wait(),await H,U[V]=await J(N,G.kind,!0,G.finish,G.missing,G.report)}}let w=[];for(let H of U)if(H.value!==void 0)w.push(H.value);return w}Cm.loadExternal=W})(k5||={});var v5=k.Struct({id:fM,type:k.String,name:k.String,branch:k.optional(k.NullOr(k.String)),directory:k.optional(k.NullOr(k.String)),extra:k.optional(k.NullOr(k.Unknown)),projectID:qM}).annotate({identifier:"Workspace"}),Sm=k.Struct(TM.omit(v5.fields,["id"])).annotate({identifier:"WorkspaceListedInfo"}),xm=k.Struct({type:k.String,name:k.String,description:k.String});var Nk=k.Struct({name:v5.fields.name,branch:k.optional(k.NullOr(k.String)),directory:k.String}),y5=k.decodeUnknownSync(Nk);async function F7(){let[{AppRuntime:$},{Worktree:Z}]=await Promise.all([import("./chunk-v04cyq7w.js"),import("./chunk-3jgdj6wr.js")]);return{AppRuntime:$,Worktree:Z}}function PM($){if(!$?.instance)throw Error("Worktree adapter requires an instance context");return $.instance}var N7=($,Z)=>$.pipe(i.provideService(LM,PM(Z)),i.provideService(RM,Z?.workspaceID)),CM={name:"Worktree",description:"Create a git worktree",async configure($,Z){let{AppRuntime:Q,Worktree:X}=await F7(),Y=await Q.runPromise(N7(X.Service.use((J)=>J.makeWorktreeInfo({detached:!0})),Z));return{...$,name:Y.name,directory:Y.directory}},async create($,Z,Q,X){let{AppRuntime:Y,Worktree:J}=await F7(),W=y5($);await Y.runPromise(N7(J.Service.use((G)=>G.createFromInfo({name:W.name,directory:W.directory,...W.branch?{branch:W.branch}:{}})),X))},async list($){let{AppRuntime:Z,Worktree:Q}=await F7(),X=PM($);return(await Z.runPromise(N7(Q.Service.use((Y)=>Y.list()),$))).map((Y)=>({type:"worktree",name:Y.name,branch:Y.branch,directory:Y.directory,projectID:X.project.id}))},async remove($,Z){let{AppRuntime:Q,Worktree:X}=await F7(),Y=y5($);await Q.runPromise(N7(X.Service.use((J)=>J.remove({directory:Y.directory})),Z))},target($){return{type:"local",directory:y5($).directory}}};var EM={worktree:CM},O7=new Map;function mm($,Z){let Q=O7.get($)?.get(Z);if(Q)return Q;let X=EM[Z];if(X)return X;throw Error(`Unknown workspace adapter: ${Z}`)}function lm($){return Ok($).map(([Z,Q])=>({type:Z,name:Q.name,description:Q.description}))}function Ok($){let Z=new Map(Object.entries(EM));for(let[Q,X]of O7.get($)?.entries()??[])Z.set(Q,X);return[...Z.entries()]}function bM($,Z,Q){let X=O7.get($)??new Map;X.set(Z,Q),O7.set($,X)}var b1=G1({service:"plugin"});class D7 extends T7.Service()("@muxcode/Plugin"){}function uM($){return $.enabled||["local","dev","beta"].includes($.channel??SM)}function jk($){return[(Z)=>lW(Z,{experimentalWebSockets:uM({enabled:$.experimentalWebSockets})}),sW,tH,w7,ZM,QM,XM,BM,FM]}function _M($){return typeof $==="function"}function Dk($){if(_M($))return $;if(!$||typeof $!=="object"||!("server"in $))return;if(!_M($.server))return;return $.server}function Tk($){let Z=new Set,Q=[];for(let X of Object.values($)){if(Z.has(X))continue;Z.add(X);let Y=Dk(X);if(!Y)throw TypeError("Plugin export is not a function");Q.push(Y)}return Q}async function qk($,Z,Q){let X=yM($.mod,$.spec,"server","detect");if(X){await gM($.source,$.spec,$.target,vM(X.id,$.spec),$.pkg),Q.push(await X.server(Z,$.options));return}for(let Y of Tk($.mod))Q.push(await Y(Z,$.options))}var mM=J1.effect(D7,i.gen(function*(){let $=yield*g5.Service,Z=yield*k8.Service,Q=yield*x8.Service,X=yield*Y1.make(i.fn("Plugin.state")(function*(G){let K=[],B=yield*q7.make();function U(O){B.fork($.publish(hM.Event.Error,{error:new xM.Unknown({message:O}).toObject()}))}let{Server:w}=yield*i.promise(()=>import("./chunk-mdes7zrv.js")),H=g7({baseUrl:"http://localhost:4096",directory:G.directory,headers:m8.headers(),fetch:async(...O)=>w.Default().app.fetch(...O)}),V=yield*Z.get(),z={client:H,project:G.project,worktree:G.worktree,directory:G.directory,experimental_workspace:{register(O,j){bM(G.project.id,O,j)}},get serverUrl(){return w.url??new URL("http://localhost:4096")},$:typeof Bun>"u"?void 0:Bun.$};for(let O of Q.disableDefaultPlugins?[]:jk(Q)){b1.info("loading internal plugin",{name:O.name});let j=yield*i.tryPromise({try:()=>O(z),catch:(M)=>{b1.error("failed to load internal plugin",{name:O.name,error:M})}}).pipe(i.option);if(j._tag==="Some")K.push(j.value)}let N=Q.pure?[]:V.plugin_origins??[];if(Q.pure&&V.plugin_origins?.length)b1.info("skipping external plugins in pure mode",{count:V.plugin_origins.length});if(N.length)yield*Z.waitForDependencies();let F=yield*i.promise(()=>k5.loadExternal({items:N,kind:"server",report:{start(O){b1.info("loading plugin",{path:O.plan.spec})},missing(O,j,M){b1.warn("plugin has no server entrypoint",{path:O.plan.spec,message:M})},error(O,j,M,A,D){let f=O.plan.spec,R=A instanceof Error?A.cause??A:A,T=M==="load"?j7(A):j7(R);if(M==="install"){let b=kM(f);b1.error("failed to install plugin",{pkg:b.pkg,version:b.version,error:T}),U(`Failed to install plugin ${b.pkg}@${b.version}: ${T}`);return}if(M==="compatibility"){b1.warn("plugin incompatible",{path:f,error:T}),U(`Plugin ${f} skipped: ${T}`);return}if(M==="entry"){b1.error("failed to resolve plugin server entry",{path:f,error:T}),U(`Failed to load plugin ${f}: ${T}`);return}b1.error("failed to load plugin",{path:f,target:D?.entry,error:T}),U(`Failed to load plugin ${f}: ${T}`)}}}));for(let O of F){if(!O)continue;yield*i.tryPromise({try:()=>qk(O,z,K),catch:(j)=>{let M=j7(j);return b1.error("failed to load plugin",{path:O.spec,error:M}),M}}).pipe(i.catch(()=>{return i.void}))}for(let O of K)yield*i.tryPromise({try:()=>Promise.resolve(O.config?.(V)),catch:(j)=>{b1.error("plugin config hook failed",{error:j})}}).pipe(i.ignore);return yield*i.addFinalizer(()=>i.forEach(K,(O)=>i.tryPromise({try:()=>Promise.resolve(O.dispose?.()),catch:(j)=>{b1.error("plugin dispose hook failed",{error:j})}}).pipe(i.ignore),{discard:!0})),yield*(yield*$.subscribeAll()).pipe(IM.runForEach((O)=>i.sync(()=>{for(let j of K)j.event?.({event:O})})),i.forkScoped),{hooks:K}})),Y=i.fn("Plugin.trigger")(function*(G,K,B){if(!G)return B;let U=yield*Y1.get(X);for(let w of U.hooks){let H=w[G];if(!H)continue;yield*i.promise(async()=>H(K,B))}return B}),J=i.fn("Plugin.list")(function*(){return(yield*Y1.get(X)).hooks}),W=i.fn("Plugin.init")(function*(){yield*Y1.get(X)});return D7.of({trigger:Y,list:J,init:W})})),fk=mM.pipe(J1.provide(g5.layer),J1.provide(k8.defaultLayer),J1.provide(x8.defaultLayer));import rk from"path";import{pathToFileURL as tk}from"url";var $Z={};K$($Z,{refineRejection:()=>Lk,EffectPromise:()=>$Z});function Lk($,Z){return i.tryPromise($).pipe(i.catch((Q)=>{let X=lM.isUnknownError(Q)?Q.cause:Q,Y=Z(X);if(Y!==void 0)return i.fail(Y);return i.die(X)}))}var R7={};K$(R7,{variants:()=>QZ,topP:()=>Ik,topK:()=>Sk,temperature:()=>_k,smallOptions:()=>ik,schema:()=>ok,sanitizeSurrogates:()=>f$,providerOptions:()=>sk,options:()=>pk,message:()=>bk,maxOutputTokens:()=>ak,ProviderTransform:()=>R7,OUTPUT_TOKEN_MAX:()=>iM});function Rk($){if($.startsWith("image/"))return"image";if($.startsWith("audio/"))return"audio";if($.startsWith("video/"))return"video";if($==="application/pdf")return"pdf";return}var iM=32000,ZZ=["reasoning.encrypted_content"];function f$($){return $.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD")}function nM($){switch($){case"@ai-sdk/github-copilot":return"copilot";case"@ai-sdk/azure":return"azure";case"@ai-sdk/openai":return"openai";case"@ai-sdk/amazon-bedrock":return"bedrock";case"@ai-sdk/anthropic":case"@ai-sdk/google-vertex/anthropic":return"anthropic";case"@ai-sdk/google-vertex":return"vertex";case"@ai-sdk/google":return"google";case"@ai-sdk/gateway":return"gateway";case"@openrouter/ai-sdk-provider":return"openrouter";case"ai-gateway-provider":return"openaiCompatible"}return}function Pk($,Z,Q){let X=(Y)=>{if(Y.output.type==="text"||Y.output.type==="error-text")Y.output.value=f$(Y.output.value);if(Y.output.type==="content")Y.output.value=Y.output.value.map((J)=>{if(J.type==="text")J.text=f$(J.text);return J});return Y};if($=$.map((Y)=>{switch(Y.role){case"tool":if(!Array.isArray(Y.content))return Y;return Y.content=Y.content.map((J)=>{if(J.type==="tool-result")return X(J);return J}),Y;case"system":return Y.content=f$(Y.content),Y;case"user":if(typeof Y.content==="string")Y.content=f$(Y.content);else Y.content=Y.content.map((J)=>{if(J.type==="text")J.text=f$(J.text);return J});return Y;case"assistant":if(typeof Y.content==="string")Y.content=f$(Y.content);else Y.content=Y.content.map((J)=>{if(J.type==="text"||J.type==="reasoning")J.text=f$(J.text);if(J.type==="tool-result")return X(J);return J});return Y}}),Z.api.npm==="@ai-sdk/anthropic")$=$.map((Y)=>{if(typeof Y.content==="string"){if(Y.content==="")return;return Y}if(!Array.isArray(Y.content))return Y;let J=Y.content.filter((W)=>{if(W.type==="text")return W.text!=="";if(W.type==="reasoning")return W.text.trim().length>0||W.providerOptions?.anthropic?.signature!=null||W.providerOptions?.anthropic?.redactedData!=null;return!0});if(J.length===0)return;return{...Y,content:J}}).filter((Y)=>Y!==void 0&&Y.content!=="");if(Z.api.npm==="@ai-sdk/amazon-bedrock")$=$.map((Y)=>{if(typeof Y.content==="string"){if(Y.content==="")return;return Y}if(!Array.isArray(Y.content))return Y;let J=Y.content.filter((W)=>{if(W.type==="text")return W.text!=="";if(W.type==="reasoning")return W.text.trim().length>0||W.providerOptions?.bedrock?.signature!=null||W.providerOptions?.bedrock?.redactedData!=null;return!0});if(J.length===0)return;return{...Y,content:J}}).filter((Y)=>Y!==void 0&&Y.content!=="");if(Z.api.id.includes("claude")){let Y=(J)=>J.replace(/[^a-zA-Z0-9_-]/g,"_");$=$.map((J)=>{if(J.role==="assistant"&&Array.isArray(J.content))return{...J,content:J.content.map((W)=>{if(W.type==="tool-call"||W.type==="tool-result")return{...W,toolCallId:Y(W.toolCallId)};return W})};if(J.role==="tool"&&Array.isArray(J.content))return{...J,content:J.content.map((W)=>{if(W.type==="tool-result")return{...W,toolCallId:Y(W.toolCallId)};return W})};return J})}if(["@ai-sdk/anthropic","@ai-sdk/google-vertex/anthropic"].includes(Z.api.npm))$=$.flatMap((Y)=>{if(Y.role!=="assistant"||!Array.isArray(Y.content))return[Y];let J=Y.content,W=J.findIndex((G)=>G.type==="tool-call");if(W===-1)return[Y];if(!J.slice(W).some((G)=>G.type!=="tool-call"))return[Y];return[{...Y,content:J.filter((G)=>G.type!=="tool-call")},{...Y,content:J.filter((G)=>G.type==="tool-call")}]});if(Z.providerID==="mistral"||Z.api.id.toLowerCase().includes("mistral")||Z.api.id.toLocaleLowerCase().includes("devstral")){let Y=(W)=>{return W.replace(/[^a-zA-Z0-9]/g,"").substring(0,9).padEnd(9,"0")},J=[];for(let W=0;W<$.length;W++){let G=$[W],K=$[W+1];if(G.role==="assistant"&&Array.isArray(G.content))G.content=G.content.map((B)=>{if(B.type==="tool-call"||B.type==="tool-result")return{...B,toolCallId:Y(B.toolCallId)};return B});if(G.role==="tool"&&Array.isArray(G.content))G.content=G.content.map((B)=>{if(B.type==="tool-result")return{...B,toolCallId:Y(B.toolCallId)};return B});if(J.push(G),G.role==="tool"&&K?.role==="user")J.push({role:"assistant",content:[{type:"text",text:"Done."}]})}return J}if(Z.api.id.toLowerCase().includes("deepseek"))$=$.map((Y)=>{if(Y.role!=="assistant")return Y;if(Array.isArray(Y.content)){if(Y.content.some((J)=>J.type==="reasoning"))return Y;return{...Y,content:[...Y.content,{type:"reasoning",text:""}]}}return{...Y,content:[...Y.content?[{type:"text",text:Y.content}]:[],{type:"reasoning",text:""}]}});if(typeof Z.capabilities.interleaved==="object"&&Z.capabilities.interleaved.field&&Z.api.npm!=="@openrouter/ai-sdk-provider"){let Y=Z.capabilities.interleaved.field;return $.map((J)=>{if(J.role==="assistant"&&Array.isArray(J.content)){let G=J.content.filter((B)=>B.type==="reasoning").map((B)=>B.text).join(""),K=J.content.filter((B)=>B.type!=="reasoning");return{...J,content:K,providerOptions:{...J.providerOptions,openaiCompatible:{...J.providerOptions?.openaiCompatible,[Y]:G}}}}return J})}return $}function Ck($,Z){let Q=$.filter((J)=>J.role==="system").slice(0,2),X=$.filter((J)=>J.role!=="system").slice(-2),Y={anthropic:{cacheControl:{type:"ephemeral"}},openrouter:{cacheControl:{type:"ephemeral"}},bedrock:{cachePoint:{type:"default"}},openaiCompatible:{cache_control:{type:"ephemeral"}},copilot:{copilot_cache_control:{type:"ephemeral"}},alibaba:{cacheControl:{type:"ephemeral"}}};for(let J of pM([...Q,...X])){if(!(Z.providerID==="anthropic"||Z.providerID.includes("bedrock")||Z.api.npm==="@ai-sdk/amazon-bedrock")&&Array.isArray(J.content)&&J.content.length>0){let K=J.content[J.content.length-1];if(K&&typeof K==="object"&&K.type!=="tool-approval-request"&&K.type!=="tool-approval-response"){K.providerOptions=O1(K.providerOptions??{},Y);continue}}J.providerOptions=O1(J.providerOptions??{},Y)}return $}function Ek($,Z){return $.map((Q)=>{if(Q.role!=="user"||!Array.isArray(Q.content))return Q;let X=Q.content.map((Y)=>{if(Y.type!=="file"&&Y.type!=="image")return Y;if(Y.type==="image"){let B=String(Y.image);if(B.startsWith("data:")){let U=B.match(/^data:([^;]+);base64,(.*)$/);if(U&&(!U[2]||U[2].length===0))return{type:"text",text:"ERROR: Image file is empty or corrupted. Please provide a valid image."}}}let J=Y.type==="image"?String(Y.image).split(";")[0].replace("data:",""):Y.mediaType,W=Y.type==="file"?Y.filename:void 0,G=Rk(J);if(!G)return Y;if(Z.capabilities.input[G])return Y;return{type:"text",text:`ERROR: Cannot read ${W?`"${W}"`:G} (this model does not support ${G} input). Inform the user.`}});return{...Q,content:X}})}function bk($,Z,Q){if($=Ek($,Z),$=Pk($,Z,Q),(Z.providerID==="anthropic"||Z.providerID==="google-vertex-anthropic"||Z.api.id.includes("anthropic")||Z.api.id.includes("claude")||Z.id.includes("anthropic")||Z.id.includes("claude")||Z.api.npm==="@ai-sdk/anthropic"||Z.api.npm==="@ai-sdk/alibaba")&&Z.api.npm!=="@ai-sdk/gateway")$=Ck($,Z);let X=nM(Z.api.npm);if(X&&X!==Z.providerID){let Y=(J)=>{if(!J)return J;if(!(Z.providerID in J))return J;let W={...J};return W[X]=W[Z.providerID],delete W[Z.providerID],W};$=$.map((J)=>{if(!Array.isArray(J.content))return{...J,providerOptions:Y(J.providerOptions)};return{...J,providerOptions:Y(J.providerOptions),content:J.content.map((W)=>{if(W.type==="tool-approval-request"||W.type==="tool-approval-response")return{...W};return{...W,providerOptions:Y(W.providerOptions)}})}})}return $}function _k($){let Z=$.id.toLowerCase();if(Z.includes("qwen"))return 0.55;if(Z.includes("claude"))return;if(Z.includes("gemini"))return 1;if(Z.includes("glm-4.6"))return 1;if(Z.includes("glm-4.7"))return 1;if(Z.includes("minimax-m2"))return 1;if(Z.includes("kimi-k2")){if(["thinking","k2.","k2p","k2-5"].some((Q)=>Z.includes(Q)))return 1;return 0.6}return}function Ik($){let Z=$.id.toLowerCase();if(Z.includes("qwen"))return 1;if(["minimax-m2","gemini","kimi-k2.5","kimi-k2p5","kimi-k2-5"].some((Q)=>Z.includes(Q)))return 0.95;return}function Sk($){let Z=$.id.toLowerCase();if(Z.includes("minimax-m2")){if(["m2.","m25","m21"].some((Q)=>Z.includes(Q)))return 40;return 20}if(Z.includes("gemini"))return 64;return}var Z1=["low","medium","high"],sM=["none","minimal",...Z1,"xhigh"],aM=["none",...Z1],xk=[...aM,"xhigh"],oM=["high"],kk=["medium","high","xhigh"],vk=["medium"],rM=[...Z1,"xhigh"],yk=["none",...rM],gk="2025-11-13",hk="2025-12-04",f7=/(?:^|\/)gpt-5(?:[.-]|$)/,uk=/(?:^|\/)gpt-5[.-](\d+)(?:[.-]|$)/,tM=/(?:^|\/)gpt-5[.-]?pro(?:[.-]|$)/,mk=/(?:^|\/)gpt-5[.-]\d+[.-]pro(?:[.-]|$)/;function L7($){return Number(uk.exec($)?.[1])||void 0}function eM($){if(mk.test($))return kk;let Z=L7($);if(Z===void 0)return;if(Z===1)return aM;return xk}function $A($){if(!f7.test($)||!$.includes("codex"))return;let Z=L7($);if(Z!==void 0&&Z>=3)return yk;if($.includes("codex-max")||Z!==void 0&&Z>=2)return rM;return Z1}function ZA($){if(!f7.test($)||!$.includes("-chat"))return;return L7($)===void 0?[]:vk}function cM($,Z){let Q=$.toLowerCase();if(Q.includes("deep-research"))return["medium"];let X=ZA(Q);if(X)return X;if(tM.test(Q))return oM;let Y=$A(Q);if(Y)return Y;let J=eM(Q);if(J)return J;let W=[...Z1];if(f7.test(Q))W.unshift("minimal");if(Z>=gk)W.unshift("none");if(Z>=hk)W.push("xhigh");return W}function dM($){let Z=$.toLowerCase(),Q=ZA(Z);if(Q)return Q;if(tM.test(Z))return oM;return $A(Z)??eM(Z)??sM}function lk($){if(["opus-4-7","opus-4.7"].some((Z)=>$.includes(Z)))return["low","medium","high","xhigh","max"];if(["opus-4-6","opus-4.6","sonnet-4-6","sonnet-4.6"].some((Z)=>$.includes(Z)))return["low","medium","high","max"];return null}function ck($){let Z=$.toLowerCase();if(!Z.includes("gemini-3"))return["low","high"];if(Z.includes("flash-image"))return["minimal","high"];if(Z.includes("pro-image"))return["high"];if(Z.includes("flash"))return["minimal","low","medium","high"];return["low","medium","high"]}function dk($){let Z=$.toLowerCase();if(Z.includes("2.5")&&Z.includes("pro")&&!Z.includes("flash"))return 32768;return 24576}function QZ($){if(!$.capabilities.reasoning)return{};let Z=$.id.toLowerCase(),Q=lk($.api.id);if(Z.includes("deepseek-chat")||Z.includes("deepseek-reasoner")||Z.includes("deepseek-r1")||Z.includes("deepseek-v3")||Z.includes("minimax")||Z.includes("glm")||Z.includes("kimi")||Z.includes("k2p")||Z.includes("qwen")||Z.includes("big-pickle"))return{};if(Z.includes("grok")&&Z.includes("grok-3-mini")){if($.api.npm==="@openrouter/ai-sdk-provider")return{low:{reasoning:{effort:"low"}},high:{reasoning:{effort:"high"}}};return{low:{reasoningEffort:"low"},high:{reasoningEffort:"high"}}}if(Z.includes("grok"))return{};switch($.api.npm){case"@openrouter/ai-sdk-provider":if(!Z.includes("gpt")&&!Z.includes("gemini-3")&&!Z.includes("claude"))return{};return Object.fromEntries((Z.includes("gpt")?dM(Z):sM).map((K)=>[K,{reasoning:{effort:K}}]));case"ai-gateway-provider":{if($.api.id.startsWith("openai/")){let K=cM($.api.id,$.release_date);return Object.fromEntries(K.map((B)=>[B,{reasoningEffort:B}]))}return Object.fromEntries(Z1.map((K)=>[K,{reasoningEffort:K}]))}case"@ai-sdk/gateway":if($.id.includes("anthropic")){if(Q)return Object.fromEntries(Q.map((K)=>[K,{thinking:{type:"adaptive"},effort:K}]));return{high:{thinking:{type:"enabled",budgetTokens:16000}},max:{thinking:{type:"enabled",budgetTokens:31999}}}}if($.id.includes("google")){if(Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:24576}}};return Object.fromEntries(["low","high"].map((K)=>[K,{includeThoughts:!0,thinkingLevel:K}]))}return Object.fromEntries(dM($.api.id).map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/github-copilot":if($.id.includes("gemini"))return{};if($.id.includes("claude"))return Object.fromEntries(Z1.map((K)=>[K,{reasoningEffort:K}]));let X=q1(()=>{if(Z.includes("5.1-codex-max")||Z.includes("5.2")||Z.includes("5.3"))return[...Z1,"xhigh"];let K=[...Z1];if(Z.includes("gpt-5")&&$.release_date>="2025-12-04")K.push("xhigh");return K});return Object.fromEntries(X.map((K)=>[K,{reasoningEffort:K,reasoningSummary:"auto",include:ZZ}]));case"@ai-sdk/cerebras":case"@ai-sdk/togetherai":case"@ai-sdk/xai":case"@ai-sdk/deepinfra":case"venice-ai-sdk-provider":case"@ai-sdk/openai-compatible":let Y=[...Z1];if($.api.id.toLowerCase().includes("deepseek-v4"))Y.push("max");return Object.fromEntries(Y.map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/azure":if(Z==="o1-mini")return{};return Object.fromEntries((f7.test(Z)&&L7(Z)===void 0?["minimal",...Z1]:Z1).map((K)=>[K,{reasoningEffort:K,reasoningSummary:"auto",include:ZZ}]));case"@ai-sdk/openai":{let K=cM($.api.id,$.release_date);return Object.fromEntries(K.map((B)=>[B,{reasoningEffort:B,reasoningSummary:"auto",include:ZZ}]))}case"@ai-sdk/anthropic":case"@ai-sdk/google-vertex/anthropic":if(Q){let K=[...Q];if($.providerID==="github-copilot"){if($.api.id.includes("opus-4.7"))K=["medium"];K=K.filter((B)=>B!=="max"&&B!=="xhigh")}return Object.fromEntries(K.map((B)=>[B,{thinking:{type:"adaptive",...$.api.id.includes("opus-4-7")||$.api.id.includes("opus-4.7")?{display:"summarized"}:{}},effort:B}]))}if(["opus-4-5","opus-4.5"].some((K)=>$.api.id.includes(K)))return Object.fromEntries(Z1.map((K)=>[K,{effort:K}]));return{high:{thinking:{type:"enabled",budgetTokens:Math.min(16000,Math.floor($.limit.output/2-1))}},max:{thinking:{type:"enabled",budgetTokens:Math.min(31999,$.limit.output-1)}}};case"@ai-sdk/amazon-bedrock":if(Q)return Object.fromEntries(Q.map((K)=>[K,{reasoningConfig:{type:"adaptive",maxReasoningEffort:K,...$.api.id.includes("opus-4-7")||$.api.id.includes("opus-4.7")?{display:"summarized"}:{}}}]));if($.api.id.includes("anthropic"))return{high:{reasoningConfig:{type:"enabled",budgetTokens:16000}},max:{reasoningConfig:{type:"enabled",budgetTokens:31999}}};return Object.fromEntries(Z1.map((K)=>[K,{reasoningConfig:{type:"enabled",maxReasoningEffort:K}}]));case"@ai-sdk/google-vertex":case"@ai-sdk/google":if(Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:dk(Z)}}};return Object.fromEntries(ck(Z).map((K)=>[K,{thinkingConfig:{includeThoughts:!0,thinkingLevel:K}}]));case"@ai-sdk/mistral":if(!$.capabilities.reasoning)return{};let J=["mistral-small-2603","mistral-small-latest","mistral-medium-3.5","mistral-medium-2604"],W=$.api.id.toLowerCase();if(!J.some((K)=>W.includes(K)))return{};return{high:{reasoningEffort:"high"}};case"@ai-sdk/cohere":return{};case"@ai-sdk/groq":let G=["none",...Z1];return Object.fromEntries(G.map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/perplexity":return{};case"@jerome-benoit/sap-ai-provider-v2":if($.api.id.includes("anthropic")){if(Q)return Object.fromEntries(Q.map((K)=>[K,{thinking:{type:"adaptive"},effort:K}]));return{high:{thinking:{type:"enabled",budgetTokens:16000}},max:{thinking:{type:"enabled",budgetTokens:31999}}}}if($.api.id.includes("gemini")&&Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:24576}}};if($.api.id.includes("gpt")||/\bo[1-9]/.test($.api.id))return Object.fromEntries(Z1.map((K)=>[K,{reasoningEffort:K}]));return{}}return{}}function pk($){let Z={};if($.model.api.npm==="@ai-sdk/google-vertex/anthropic"||!$.model.api.id.includes("claude")&&$.model.api.npm==="@ai-sdk/anthropic")Z.toolStreaming=!1;if($.model.providerID==="openai"||$.model.api.npm==="@ai-sdk/openai"||$.model.api.npm==="@ai-sdk/github-copilot")Z.store=!1;if($.model.api.npm==="@ai-sdk/azure")Z.store=!1,Z.promptCacheKey=$.sessionID;if($.model.api.npm==="@openrouter/ai-sdk-provider"||$.model.api.npm==="@llmgateway/ai-sdk-provider"){if(Z.usage={include:!0},$.model.api.id.includes("gemini-3"))Z.reasoning={effort:"high"}}if($.model.providerID==="baseten"||$.model.providerID==="muxcode"&&["kimi-k2-thinking","glm-4.6"].includes($.model.api.id))Z.chat_template_args={enable_thinking:!0};if(["zai","zhipuai"].some((X)=>$.model.providerID.includes(X))&&$.model.api.npm==="@ai-sdk/openai-compatible")Z.thinking={type:"enabled",clear_thinking:!1};if($.model.providerID==="openai"||$.providerOptions?.setCacheKey)Z.promptCacheKey=$.sessionID;if($.model.api.npm==="@ai-sdk/google"||$.model.api.npm==="@ai-sdk/google-vertex"){if($.model.capabilities.reasoning){if(Z.thinkingConfig={includeThoughts:!0},$.model.api.id.includes("gemini-3"))Z.thinkingConfig.thinkingLevel="high"}}let Q=$.model.api.id.toLowerCase();if(($.model.api.npm==="@ai-sdk/anthropic"||$.model.api.npm==="@ai-sdk/google-vertex/anthropic")&&(Q.includes("k2p")||Q.includes("kimi-k2.")||Q.includes("kimi-k2p")))Z.thinking={type:"enabled",budgetTokens:Math.min(16000,Math.floor($.model.limit.output/2-1))};if($.model.providerID==="alibaba-cn"&&$.model.capabilities.reasoning&&$.model.api.npm==="@ai-sdk/openai-compatible"&&!Q.includes("kimi-k2-thinking"))Z.enable_thinking=!0;if($.model.api.npm==="@ai-sdk/azure"&&$.model.api.id.includes("gpt-5.5"))return Z.reasoningSummary="auto",Z;if($.model.api.id.includes("gpt-5")&&!$.model.api.id.includes("gpt-5-chat")){if(!$.model.api.id.includes("gpt-5-pro")){if(Z.reasoningEffort="medium",Z.reasoningSummary="auto",$.model.api.npm==="@ai-sdk/openai")Z.include=ZZ}if($.model.api.id.includes("gpt-5.")&&!$.model.api.id.includes("codex")&&!$.model.api.id.includes("-chat")&&$.model.providerID!=="azure")Z.textVerbosity="low";if($.model.providerID.startsWith("muxcode"))Z.promptCacheKey=$.sessionID,Z.include=ZZ,Z.reasoningSummary="auto"}if($.model.providerID==="venice")Z.promptCacheKey=$.sessionID;if($.model.providerID==="openrouter")Z.prompt_cache_key=$.sessionID;if($.model.api.npm==="@ai-sdk/gateway")Z.gateway={caching:"auto"};return Z}function ik($){let Z=Object.values($.variants??{})[0]??{};if($.providerID==="openai"||$.api.npm==="@ai-sdk/openai"||$.api.npm==="@ai-sdk/github-copilot")return O1({store:!1},Z);if($.providerID==="openrouter"||$.providerID==="llmgateway"){if(Object.keys(Z).length===0&&$.api.id.includes("google"))return{reasoning:{enabled:!1}}}if($.providerID==="venice"){if(Object.keys(Z).length>0)return Z;return{veniceParameters:{disableThinking:!0}}}return Z}var nk={amazon:"bedrock"};function sk($,Z){if($.api.npm==="@ai-sdk/gateway"){let Y=$.api.id.indexOf("/"),J=Y>0?$.api.id.slice(0,Y):void 0,W=J?nk[J]??J:void 0,G=Z.gateway,K=Object.fromEntries(Object.entries(Z).filter(([w])=>w!=="gateway")),B=Object.keys(K).length>0,U={};if(G!==void 0)U.gateway=G;if(B)if(W)U[W]=K;else if(G&&typeof G==="object"&&!Array.isArray(G))U.gateway={...G,...K};else U.gateway=K;return U}let Q=$.api.npm==="@ai-sdk/openai-compatible"||$.api.npm==="@ai-sdk/openai"||$.api.npm==="@ai-sdk/anthropic",X=nM($.api.npm)??(Q?$.providerID.split(".")[0]:$.providerID);if($.api.npm==="@ai-sdk/azure")return{openai:Z,azure:Z};return{[X]:Z}}function ak($,Z=iM){return Math.min($.limit.output,Z)||Z}function ok($,Z){if($.providerID==="moonshotai"||$.api.id.toLowerCase().includes("kimi")){let Q=(Y)=>{if(Y===null||typeof Y!=="object")return Y;if(Array.isArray(Y))return Y.map(Q);if("$ref"in Y&&typeof Y.$ref==="string")return{$ref:Y.$ref};let J=Object.fromEntries(Object.entries(Y).map(([W,G])=>[W,Q(G)]));if(Array.isArray(J.items))J.items=J.items[0]??{};return J},X=Q(Z);if(typeof X==="object"&&X!==null&&!Array.isArray(X))Z=X}if($.providerID==="google"||$.api.id.includes("gemini")){let Q=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W),X=(W)=>Q(W)&&(Array.isArray(W.anyOf)||Array.isArray(W.oneOf)||Array.isArray(W.allOf)),Y=(W)=>{if(!Q(W))return!1;if(X(W))return!0;return["type","properties","items","prefixItems","enum","const","$ref","additionalProperties","patternProperties","required","not","if","then","else"].some((G)=>(G in W))},J=(W)=>{if(W===null||typeof W!=="object")return W;if(Array.isArray(W))return W.map(J);let G={};for(let[K,B]of Object.entries(W))if(K==="enum"&&Array.isArray(B)){if(G[K]=B.map((U)=>String(U)),G.type==="integer"||G.type==="number")G.type="string"}else if(typeof B==="object"&&B!==null)G[K]=J(B);else G[K]=B;if(G.type==="object"&&G.properties&&Array.isArray(G.required))G.required=G.required.filter((K)=>(K in G.properties));if(G.type==="array"&&!X(G)){if(G.items==null)G.items={};if(Q(G.items)&&!Y(G.items))G.items.type="string"}if(G.type&&G.type!=="object"&&!X(G))delete G.properties,delete G.required;return G};Z=J(Z)}return Z}var j1=G1({service:"provider"}),ek=1e4;function $v($){let Z=/^gpt-(\d+)/.exec($);if(!Z)return!1;return Number(Z[1])>=5&&!$.startsWith("gpt-5-mini")}function Zv($,Z,Q){if(typeof Z!=="number"||Z<=0)return $;if(!$.body)return $;if(!$.headers.get("content-type")?.includes("text/event-stream"))return $;let X=$.body.getReader(),Y=new ReadableStream({async pull(J){let W=await new Promise((G,K)=>{let B=setTimeout(()=>{let U=Error("SSE read timed out");Q.abort(U),X.cancel(U),K(U)},Z);X.read().then((U)=>{clearTimeout(B),G(U)},(U)=>{clearTimeout(B),K(U)})});if(W.done){J.close();return}J.enqueue(W.value)},async cancel(J){Q.abort(J),await X.cancel(J)}});return new Response(Y,{headers:new Headers($.headers),status:$.status,statusText:$.statusText})}function Qv($){let Z=new AbortController,Q=setTimeout(()=>Z.abort(new I1.HeaderTimeoutError($)),$);return{signal:Z.signal,clear:()=>clearTimeout(Q)}}function VA($,Z){if(!$)return;if(Z!=="eu"&&Z!=="us")return;return`https://aiplatform.${Z}.rep.googleapis.com/v1/projects/${$}/locations/${Z}/publishers/anthropic/models`}var Xv={"@ai-sdk/amazon-bedrock":()=>import("./chunk-s4gy87ft.js").then(($)=>$.createAmazonBedrock),"@ai-sdk/anthropic":()=>import("./chunk-0r3h8jgj.js").then(($)=>$.createAnthropic),"@ai-sdk/azure":()=>import("./chunk-s5qq2ch2.js").then(($)=>$.createAzure),"@ai-sdk/google":()=>import("./chunk-5v5015am.js").then(($)=>$.createGoogleGenerativeAI),"@ai-sdk/google-vertex":()=>import("./chunk-5wawdxv2.js").then(($)=>$.createVertex),"@ai-sdk/google-vertex/anthropic":()=>import("./chunk-xvtkw7hj.js").then(($)=>$.createVertexAnthropic),"@ai-sdk/openai":()=>import("./chunk-8atqb297.js").then(($)=>$.createOpenAI),"@ai-sdk/openai-compatible":()=>import("./chunk-7xgr8vx6.js").then(($)=>$.createOpenAICompatible),"@openrouter/ai-sdk-provider":()=>import("./chunk-q1r48y0y.js").then(($)=>$.createOpenRouter),"@ai-sdk/xai":()=>import("./chunk-9j4j9nrm.js").then(($)=>$.createXai),"@ai-sdk/mistral":()=>import("./chunk-ezz15tyg.js").then(($)=>$.createMistral),"@ai-sdk/groq":()=>import("./chunk-nn0t3xmn.js").then(($)=>$.createGroq),"@ai-sdk/deepinfra":()=>import("./chunk-w5jxffnq.js").then(($)=>$.createDeepInfra),"@ai-sdk/cerebras":()=>import("./chunk-jh2epywq.js").then(($)=>$.createCerebras),"@ai-sdk/cohere":()=>import("./chunk-jws11ngd.js").then(($)=>$.createCohere),"@ai-sdk/gateway":()=>import("./chunk-e2wv2sp4.js").then(($)=>$.createGateway),"@ai-sdk/togetherai":()=>import("./chunk-vmr3get8.js").then(($)=>$.createTogetherAI),"@ai-sdk/perplexity":()=>import("./chunk-k6cj14zk.js").then(($)=>$.createPerplexity),"@ai-sdk/vercel":()=>import("./chunk-7zjn6m1m.js").then(($)=>$.createVercel),"@ai-sdk/alibaba":()=>import("./chunk-sp1cvejp.js").then(($)=>$.createAlibaba),"gitlab-ai-provider":()=>import("./chunk-2pc63est.js").then(($)=>$.createGitLab),"@ai-sdk/github-copilot":()=>import("./chunk-v8at4gnt.js").then(($)=>$.createOpenaiCompatible),"venice-ai-sdk-provider":()=>import("./chunk-rs8fsgqt.js").then(($)=>$.createVenice)};function Yv($){return $.responses===void 0&&$.chat===void 0}function QA($,Z,Q){if(Q&&$.chat)return $.chat(Z);if($.responses)return $.responses(Z);if($.messages)return $.messages(Z);if($.chat)return $.chat(Z);return $.languageModel(Z)}function Jv($){return{anthropic:()=>i.succeed({autoload:!1,options:{headers:{"anthropic-beta":"interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"}}}),muxcode:i.fnUntraced(function*(Z){let Q=yield*$.env(),Y=q1(()=>{if(Z.env.some((J)=>Q[J]))return!0;return!1})||Boolean(yield*$.auth(Z.id))||Boolean((yield*$.config()).provider?.muxcode?.options?.apiKey);if(!Y)for(let[J,W]of Object.entries(Z.models)){if(W.cost.input===0)continue;delete Z.models[J]}return{autoload:Object.keys(Z.models).length>0,options:Y?{}:{apiKey:"public"}}}),openai:()=>i.succeed({autoload:!1,async getModel(Z,Q,X){return Z.responses(Q)},options:{headerTimeout:ek}}),xai:()=>i.succeed({autoload:!1,async getModel(Z,Q,X){return Z.responses(Q)},options:{}}),agy:()=>i.succeed({autoload:!0,async getModel(Z,Q,X){let{execSync:Y}=await import("child_process"),J="/home/server/.antigravity-server/bin/1.21.9-cc6cd32816d350ee4a1ea2b4694b43f749418957/bin/remote-cli/agy",G={"gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash"}[Q]||Q;return{doStream:async(K)=>{let B=K.map((w)=>w.content||"").filter(Boolean).join(`
668
+ `),U=await import("child_process");return new ReadableStream({start(w){let H=U.spawn("/home/server/.antigravity-server/bin/1.21.9-cc6cd32816d350ee4a1ea2b4694b43f749418957/bin/remote-cli/agy",["-m",G,B],{stdio:["pipe","pipe","pipe"],env:{...process.env,AGY_NON_INTERACTIVE:"1"}}),V="";H.stdout?.on("data",(z)=>{V+=z.toString();let N=V.split(`
669
+ `);V=N.pop()||"";for(let F of N)if(F.trim())w.enqueue(new TextEncoder().encode(JSON.stringify({choices:[{delta:{content:F}}]})+`
670
+ `))}),H.on("close",()=>{if(V.trim())w.enqueue(new TextEncoder().encode(JSON.stringify({choices:[{delta:{content:V}}]})+`
671
+ `));w.close()}),H.on("error",(z)=>w.error(z))}})}}}}),"github-copilot":()=>i.succeed({autoload:!1,async getModel(Z,Q,X){if(Yv(Z))return Z.languageModel(Q);return $v(Q)?Z.responses(Q):Z.chat(Q)},options:{}}),azure:i.fnUntraced(function*(Z){let Q=yield*$.env(),X=yield*$.auth(Z.id),Y=q1(()=>{return[Z.options?.resourceName,X?.type==="api"?X.metadata?.resourceName:void 0,Q.AZURE_RESOURCE_NAME].find((J)=>typeof J==="string"&&J.trim()!=="")});if(!Y&&!Z.options?.baseURL)return{autoload:!1,async getModel(){throw Error("AZURE_RESOURCE_NAME is missing, set it using env var or reconnecting the azure provider and setting it")}};return{autoload:!1,async getModel(J,W,G){return QA(J,W,Boolean(G?.useCompletionUrls))},options:{resourceName:Y},vars(J){if(Y)return{AZURE_RESOURCE_NAME:Y};return{}}}}),"azure-cognitive-services":i.fnUntraced(function*(){let Z=yield*$.get("AZURE_COGNITIVE_SERVICES_RESOURCE_NAME");return{autoload:!1,async getModel(Q,X,Y){return QA(Q,X,Boolean(Y?.useCompletionUrls))},options:{baseURL:Z?`https://${Z}.cognitiveservices.azure.com/openai`:void 0}}}),"amazon-bedrock":i.fnUntraced(function*(){let Z=(yield*$.config()).provider?.["amazon-bedrock"],Q=yield*$.auth("amazon-bedrock"),X=yield*$.env(),Y=Z?.options?.region,J=X.AWS_REGION,W=Y??J??"us-east-1",G=Z?.options?.profile,K=X.AWS_PROFILE,B=G??K,U=X.AWS_ACCESS_KEY_ID,w=q1(()=>{let O=process.env.AWS_BEARER_TOKEN_BEDROCK;if(O)return O;if(Q?.type==="api")return process.env.AWS_BEARER_TOKEN_BEDROCK=Q.key,Q.key;return}),H=X.AWS_WEB_IDENTITY_TOKEN_FILE,V=Boolean(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI);if(!B&&!U&&!w&&!H&&!V)return{autoload:!1};let{fromNodeProviderChain:z}=yield*i.promise(()=>import("./chunk-5tpqj6ag.js")),N={region:W};if(!w){let O=B?{profile:B}:{};N.credentialProvider=z(O)}let F=Z?.options?.endpoint??Z?.options?.baseURL;if(F)N.baseURL=F;return{autoload:!0,options:N,async getModel(O,j,M){if(["global.","us.","eu.","jp.","apac.","au."].some((R)=>j.startsWith(R)))return O.languageModel(j);let D=M?.region??W,f=D.split("-")[0];switch(f){case"us":{let R=["nova-micro","nova-lite","nova-pro","nova-premier","nova-2","claude","deepseek"].some((b)=>j.includes(b)),T=D.startsWith("us-gov");if(R&&!T)j=`${f}.${j}`;break}case"eu":{let R=["eu-west-1","eu-west-2","eu-west-3","eu-north-1","eu-central-1","eu-south-1","eu-south-2"].some((b)=>D.includes(b)),T=["claude","nova-lite","nova-micro","llama3","pixtral"].some((b)=>j.includes(b));if(R&&T)j=`${f}.${j}`;break}case"ap":{let R=["ap-southeast-2","ap-southeast-4"].includes(D),T=D==="ap-northeast-1";if(R&&["anthropic.claude-sonnet-4-5","anthropic.claude-haiku"].some((b)=>j.includes(b)))f="au",j=`${f}.${j}`;else if(T){if(["claude","nova-lite","nova-micro","nova-pro"].some((q)=>j.includes(q)))f="jp",j=`${f}.${j}`}else if(["claude","nova-lite","nova-micro","nova-pro"].some((q)=>j.includes(q)))f="apac",j=`${f}.${j}`;break}}return O.languageModel(j)}}}),llmgateway:()=>i.succeed({autoload:!1,options:{headers:{"HTTP-Referer":"https://muxcode.ai/","X-Title":"muxcode","X-Source":"muxcode"}}}),openrouter:()=>i.succeed({autoload:!1,options:{headers:{"HTTP-Referer":"https://muxcode.ai/","X-Title":"muxcode"}}}),nvidia:(Z)=>i.succeed({autoload:Z.source==="config",options:{headers:{"HTTP-Referer":"https://muxcode.ai/","X-Title":"muxcode","X-BILLING-INVOKE-ORIGIN":"MuxCode"}}}),vercel:()=>i.succeed({autoload:!1,options:{headers:{"http-referer":"https://muxcode.ai/","x-title":"muxcode"}}}),"google-vertex":i.fnUntraced(function*(Z){let Q=yield*$.env(),X=Z.options?.project??Q.GOOGLE_VERTEX_PROJECT??Q.GOOGLE_CLOUD_PROJECT??Q.GCP_PROJECT??Q.GCLOUD_PROJECT,Y=String(Z.options?.location??Q.GOOGLE_VERTEX_LOCATION??Q.GOOGLE_CLOUD_LOCATION??Q.VERTEX_LOCATION??"us-central1");if(!Boolean(X))return{autoload:!1};return{autoload:!0,vars(W){let G=Y==="global"?"aiplatform.googleapis.com":`${Y}-aiplatform.googleapis.com`;return{...X&&{GOOGLE_VERTEX_PROJECT:X},GOOGLE_VERTEX_LOCATION:Y,GOOGLE_VERTEX_ENDPOINT:G}},options:{project:X,location:Y,fetch:async(W,G)=>{let{GoogleAuth:K}=await import("./chunk-ymb45bt6.js").then((m)=>d8(m.default,1)),w=await(await new K().getApplicationDefault()).credential.getAccessToken(),H=new Headers(G?.headers);return H.set("Authorization",`Bearer ${w.token}`),fetch(W,{...G,headers:H})}},async getModel(W,G){let K=String(G).trim();return W.languageModel(K)}}}),"google-vertex-anthropic":i.fnUntraced(function*(){let Z=yield*$.env(),Q=Z.GOOGLE_CLOUD_PROJECT??Z.GCP_PROJECT??Z.GCLOUD_PROJECT,X=Z.GOOGLE_CLOUD_LOCATION??Z.VERTEX_LOCATION??"global";if(!Boolean(Q))return{autoload:!1};let J=VA(Q,X);return{autoload:!0,options:{project:Q,location:X,...J&&{baseURL:J}},async getModel(W,G){let K=String(G).trim();return W.languageModel(K)}}}),"sap-ai-core":i.fnUntraced(function*(){let Z=yield*$.auth("sap-ai-core"),Q=q1(()=>{let J=process.env.AICORE_SERVICE_KEY;if(J)return J;if(Z?.type==="api")return process.env.AICORE_SERVICE_KEY=Z.key,Z.key;return}),X=process.env.AICORE_DEPLOYMENT_ID,Y=process.env.AICORE_RESOURCE_GROUP;return{autoload:!!Q,options:Q?{deploymentId:X,resourceGroup:Y}:{},async getModel(J,W){return J(W)}}}),zenmux:()=>i.succeed({autoload:!1,options:{headers:{"HTTP-Referer":"https://muxcode.ai/","X-Title":"muxcode"}}}),gitlab:i.fnUntraced(function*(Z){let{VERSION:Q,isWorkflowModel:X,discoverWorkflowModels:Y}=yield*i.promise(()=>import("./chunk-2pc63est.js")),J=(yield*$.get("GITLAB_INSTANCE_URL"))||"https://gitlab.com",W=yield*$.auth(Z.id),G=yield*i.sync(()=>{if(W?.type==="oauth")return W.access;if(W?.type==="api")return W.key;return}),K=G??(yield*$.get("GITLAB_TOKEN")),B=(yield*$.config()).provider?.gitlab,U=yield*Y1.directory,w={"User-Agent":`muxcode/${h0} gitlab-ai-provider/${Q} (${J$.platform()} ${J$.release()}; ${J$.arch()})`,"anthropic-beta":"context-1m-2025-08-07",...B?.options?.aiGatewayHeaders},H={duo_agent_platform_agentic_chat:!0,duo_agent_platform:!0,...B?.options?.featureFlags};return{autoload:!!K,options:{instanceUrl:J,apiKey:K,aiGatewayHeaders:w,featureFlags:H},async getModel(V,z,N){if(z.startsWith("duo-workflow-")){let F=typeof N?.workflowRef==="string"?N.workflowRef:void 0,O=X(z)?z:"duo-workflow",j=typeof N?.workflowDefinition==="string"?N.workflowDefinition:void 0,M=V.workflowChat(O,{featureFlags:H,workflowDefinition:j});if(F)M.selectedModelRef=F;return M}return V.agenticChat(z,{aiGatewayHeaders:w,featureFlags:H})},async discoverModels(){if(!G)return j1.info("gitlab model discovery skipped: no apiKey"),{};try{let V=G,z=()=>W?.type==="api"?{"PRIVATE-TOKEN":V}:{Authorization:`Bearer ${V}`};j1.info("gitlab model discovery starting",{instanceUrl:J});let N=await Y({instanceUrl:J,getHeaders:z},{workingDirectory:U});if(!N.models.length)return j1.info("gitlab model discovery skipped: no models found",{project:N.project?{id:N.project.id,path:N.project.pathWithNamespace}:null}),{};let F={};for(let O of N.models)if(!Z.models[O.id])F[O.id]={id:_1.make(O.id),providerID:N0.make("gitlab"),name:`Agent Platform (${O.name})`,family:"",api:{id:O.id,url:J,npm:"gitlab-ai-provider"},status:"active",headers:{},options:{workflowRef:O.ref},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:O.context,output:O.output},capabilities:{temperature:!1,reasoning:!0,attachment:!0,toolcall:!0,input:{text:!0,audio:!1,image:!0,video:!1,pdf:!0},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},release_date:"",variants:{}};return j1.info("gitlab model discovery complete",{count:Object.keys(F).length,models:Object.keys(F)}),F}catch(V){return j1.warn("gitlab model discovery failed",{error:V}),{}}}}}),"cloudflare-workers-ai":i.fnUntraced(function*(Z){if(Z.options?.baseURL)return{autoload:!1};let Q=yield*$.auth(Z.id),X=yield*$.env(),Y=X.CLOUDFLARE_ACCOUNT_ID||(Q?.type==="api"?Q.metadata?.accountId:void 0);if(!Y)return{autoload:!1,async getModel(){throw Error("CLOUDFLARE_ACCOUNT_ID is missing. Set it with: export CLOUDFLARE_ACCOUNT_ID=<your-account-id>")}};let J=yield*i.gen(function*(){let W=X.CLOUDFLARE_API_KEY;if(W)return W;if(Q?.type==="api")return Q.key;return});return{autoload:!!J,options:{apiKey:J,headers:{"User-Agent":`muxcode/${h0} cloudflare-workers-ai (${J$.platform()} ${J$.release()}; ${J$.arch()})`}},async getModel(W,G){return W.languageModel(G)},vars(W){return{CLOUDFLARE_ACCOUNT_ID:Y}}}}),"cloudflare-ai-gateway":i.fnUntraced(function*(Z){if(Z.options?.baseURL)return{autoload:!1};let Q=yield*$.auth(Z.id),X=yield*$.env(),Y=X.CLOUDFLARE_ACCOUNT_ID||(Q?.type==="api"?Q.metadata?.accountId:void 0),J=X.CLOUDFLARE_GATEWAY_ID||(Q?.type==="api"?Q.metadata?.gatewayId:void 0);if(!Y||!J){let V=[!Y?"CLOUDFLARE_ACCOUNT_ID":void 0,!J?"CLOUDFLARE_GATEWAY_ID":void 0].filter((z)=>Boolean(z));return{autoload:!1,async getModel(){throw Error(`${V.join(" and ")} missing. Set with: ${V.map((z)=>`export ${z}=<value>`).join(" && ")}`)}}}let W=yield*i.gen(function*(){let V=X.CLOUDFLARE_API_TOKEN||X.CF_AIG_TOKEN;if(V)return V;if(Q?.type==="api")return Q.key;return});if(!W)throw Error("CLOUDFLARE_API_TOKEN (or CF_AIG_TOKEN) is required for Cloudflare AI Gateway. Set it via environment variable or run `muxcode auth cloudflare-ai-gateway`.");let{createAiGateway:G}=yield*i.promise(()=>import("./chunk-wn5f1tfj.js")),{createUnified:K}=yield*i.promise(()=>import("./chunk-3jvft1k1.js")),U={metadata:q1(()=>{if(Z.options?.metadata)return Z.options.metadata;try{return JSON.parse(Z.options?.headers?.["cf-aig-metadata"])}catch{return}}),cacheTtl:Z.options?.cacheTtl,cacheKey:Z.options?.cacheKey,skipCache:Z.options?.skipCache,collectLog:Z.options?.collectLog,headers:{"User-Agent":`muxcode/${h0} cloudflare-ai-gateway (${J$.platform()} ${J$.release()}; ${J$.arch()})`}},w=G({accountId:Y,gateway:J,apiKey:W,...Object.values(U).some((V)=>V!==void 0)?{options:U}:{}}),H=K();return{autoload:!0,async getModel(V,z,N){return w(H(z))},options:{}}}),cerebras:()=>i.succeed({autoload:!1,options:{headers:{"X-Cerebras-3rd-Party-Integration":"muxcode"}}}),kilo:()=>i.succeed({autoload:!1,options:{headers:{"HTTP-Referer":"https://muxcode.ai/","X-Title":"muxcode"}}})}}var Wv=k.Struct({id:k.String,url:k.String,npm:k.String}),XA=k.Struct({text:k.Boolean,audio:k.Boolean,image:k.Boolean,video:k.Boolean,pdf:k.Boolean}),Gv=k.Union([k.Boolean,k.Struct({field:k.Literals(["reasoning_content","reasoning_details"])})]),Kv=k.Struct({temperature:k.Boolean,reasoning:k.Boolean,attachment:k.Boolean,toolcall:k.Boolean,input:XA,output:XA,interleaved:Gv}),l5=k.Struct({read:k.Finite,write:k.Finite}),Bv=k.Struct({input:k.Finite,output:k.Finite,cache:l5,tier:k.Struct({type:k.Literal("context"),size:k.Finite})}),Uv=k.Struct({input:k.Finite,output:k.Finite,cache:l5,tiers:t$(k.Array(Bv)),experimentalOver200K:t$(k.Struct({input:k.Finite,output:k.Finite,cache:l5}))}),zv=k.Struct({context:k.Finite,input:t$(k.Finite),output:k.Finite}),HA=k.Struct({id:_1,providerID:N0,api:Wv,name:k.String,family:t$(k.String),capabilities:Kv,cost:Uv,limit:zv,status:zA,options:k.Record(k.String,k.Any),headers:k.Record(k.String,k.String),release_date:k.String,variants:t$(k.Record(k.String,k.Record(k.String,k.Any)))}).annotate({identifier:"Model"}),a5=k.Struct({id:N0,name:k.String,source:k.Literals(["env","config","custom","api"]),env:k.Array(k.String),key:t$(k.String),options:k.Record(k.String,k.Any),models:k.Record(k.String,HA)}).annotate({identifier:"Provider"}),MA=k.Record(k.String,k.String),wv=k.Struct({all:k.Array(a5),default:MA,connected:k.Array(k.String)}),Vv=k.Struct({providers:k.Array(a5),default:MA});function P7($){return JSON.parse(JSON.stringify($,(Z,Q)=>{if(typeof Q==="function"||typeof Q==="symbol"||Q===void 0)return;if(typeof Q==="bigint")return Q.toString();return Q}))}function Hv($){return L$($,(Z)=>o5(Object.values(Z.models))[0].id)}class y8 extends k.TaggedErrorClass()("ProviderModelNotFoundError",{providerID:N0,modelID:_1,suggestions:k.optional(k.Array(k.String)),cause:k.optional(k.Defect)}){static isInstance($){return $ instanceof y8}}class C7 extends k.TaggedErrorClass()("ProviderInitError",{providerID:N0,cause:k.optional(k.Defect)}){static isInstance($){return $ instanceof C7}}class E7 extends k.TaggedErrorClass()("ProviderNoProvidersError",{}){static isInstance($){return $ instanceof E7}}class b7 extends k.TaggedErrorClass()("ProviderNoModelsError",{providerID:N0}){static isInstance($){return $ instanceof b7}}class XZ extends T7.Service()("@muxcode/Provider"){}var Mv=GA(XZ);function AA($){let Z={input:$?.input??0,output:$?.output??0,cache:{read:$?.cache_read??0,write:$?.cache_write??0}};if($?.tiers)Z.tiers=$.tiers.map((Q)=>({input:Q.input,output:Q.output,cache:{read:Q.cache_read??0,write:Q.cache_write??0},tier:Q.tier}));if($?.context_over_200k)Z.experimentalOver200K={cache:{read:$.context_over_200k.cache_read??0,write:$.context_over_200k.cache_write??0},input:$.context_over_200k.input,output:$.context_over_200k.output};return Z}function YA($,Z){let Q={id:_1.make(Z.id),providerID:N0.make($.id),name:Z.name,family:Z.family,api:{id:Z.id,url:Z.provider?.api??$.api??"",npm:Z.provider?.npm??$.npm??"@ai-sdk/openai-compatible"},status:Z.status??"active",headers:{},options:{},cost:AA(Z.cost),limit:{context:Z.limit.context,input:Z.limit.input,output:Z.limit.output},capabilities:{temperature:Z.temperature??!1,reasoning:Z.reasoning??!1,attachment:Z.attachment??!1,toolcall:Z.tool_call??!0,input:{text:Z.modalities?.input?.includes("text")??!1,audio:Z.modalities?.input?.includes("audio")??!1,image:Z.modalities?.input?.includes("image")??!1,video:Z.modalities?.input?.includes("video")??!1,pdf:Z.modalities?.input?.includes("pdf")??!1},output:{text:Z.modalities?.output?.includes("text")??!1,audio:Z.modalities?.output?.includes("audio")??!1,image:Z.modalities?.output?.includes("image")??!1,video:Z.modalities?.output?.includes("video")??!1,pdf:Z.modalities?.output?.includes("pdf")??!1},interleaved:Z.interleaved??!1},release_date:Z.release_date??"",variants:{}};return{...Q,variants:L$(QZ(Q),(X)=>X)}}function FA($){let Z={};for(let[Q,X]of Object.entries($.models)){Z[Q]=YA($,X);for(let[Y,J]of Object.entries(X.experimental?.modes??{})){let W=`${X.id}-${Y}`,G=YA($,X);Z[W]={...G,id:_1.make(W),name:`${X.name} ${Y[0].toUpperCase()}${Y.slice(1)}`,cost:J.cost?O1(G.cost,AA(J.cost)):G.cost,options:J.provider?.body?Object.fromEntries(Object.entries(J.provider.body).map(([K,B])=>[K.replace(/_([a-z])/g,(U,w)=>w.toUpperCase()),B])):G.options,headers:J.provider?.headers??G.headers}}}return{id:N0.make($.id),source:"custom",name:$.name,env:[...$.env??[]],options:{},models:Z}}function Av($,Z){if(!$)return[];return Object.keys($.models).filter((Q)=>{let X=$.models[Q];if(X.status==="deprecated")return!1;if(X.status==="alpha"&&!Z)return!1;return!0})}function h5($,Z,Q){let X=Av($,Q),Y=s5.default.go(Z,X,{limit:3,threshold:-1e4}).map((W)=>W.target);if(Y.length)return Y;let J=Z.toLowerCase().split(/[^a-z0-9]+/).filter((W)=>W.length>1);return i5(X.map((W)=>({id:W,score:J.filter((G)=>W.toLowerCase().includes(G)).length})).filter((W)=>W.score>0),[(W)=>W.score,"desc"],[(W)=>W.id,"asc"]).slice(0,3).map((W)=>W.id)}var NA=J1.effect(XZ,i.gen(function*(){let $=yield*d5.Service,Z=yield*k8.Service,Q=yield*p5.Service,X=yield*n5.Service,Y=yield*v8.Service,J=yield*BA,W=yield*x8.Service,G=yield*Y1.make(()=>i.gen(function*(){using F=j1.time("state");let O=yield*q7.make(),j=yield*Z.get(),M=yield*J.get(),A=L$(M,FA),D=L$(A,P7);if(!D.agy)D.agy={id:N0.make("agy"),name:"AGY (Google AI)",env:["AGY_TOKEN"],options:{},source:"custom",models:{"gemini-2.5-pro":{id:_1.make("gemini-2.5-pro"),api:{id:"gemini-2.5-pro",npm:"@ai-sdk/openai-compatible",url:"https://generativelanguage.googleapis.com/v1beta/openai"},status:"active",name:"Gemini 2.5 Pro",providerID:N0.make("agy"),capabilities:{temperature:!0,reasoning:!0,attachment:!0,toolcall:!0,input:{text:!0,audio:!1,image:!0,video:!0,pdf:!0},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:1048576,output:65536},options:{},headers:{},family:"gemini",release_date:"",variants:{}},"gemini-2.5-flash":{id:_1.make("gemini-2.5-flash"),api:{id:"gemini-2.5-flash",npm:"@ai-sdk/openai-compatible",url:"https://generativelanguage.googleapis.com/v1beta/openai"},status:"active",name:"Gemini 2.5 Flash",providerID:N0.make("agy"),capabilities:{temperature:!0,reasoning:!1,attachment:!0,toolcall:!0,input:{text:!0,audio:!1,image:!0,video:!1,pdf:!0},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:1048576,output:8192},options:{},headers:{},family:"gemini",release_date:"",variants:{}}}};let f={},R=new Map,T={},b={},q=new Map,S={},y={auth:(t)=>Q.get(t).pipe(i.orDie),config:()=>Z.get(),env:()=>X.all(),get:(t)=>X.get(t)};j1.info("init");function v(t,C){let E=f[t];if(E){f[t]=O1(E,C);return}let h=D[t];if(!h)return;f[t]=O1(h,C)}let n=yield*Y.list(),s=Object.entries(j.provider??{}),a=new Set(j.disabled_providers??[]),p=j.enabled_providers?new Set(j.enabled_providers):null;function r(t){if(p&&!p.has(t))return!1;if(a.has(t))return!1;return!0}for(let t of n){let C=t.provider,E=C?.models;if(!C||!E)continue;let h=N0.make(C.id);if(a.has(h))continue;let L=D[h];if(!L)continue;let P=yield*Q.get(h).pipe(i.orDie);L.models=yield*i.promise(async()=>{let _=await E(P7(L),{auth:P});return Object.fromEntries(Object.entries(_).map(([x,l])=>[x,{...l,id:_1.make(x),providerID:h}]))})}for(let[t,C]of s){let E=D[t],h={id:N0.make(t),name:C.name??E?.name??t,env:C.env??E?.env??[],options:O1(E?.options??{},C.options??{}),source:"config",models:E?.models??{}};for(let[L,P]of Object.entries(C.models??{})){let _=h.models[P.id??L],x=P.id??_?.api.id??L,l=P.provider?.npm??C.npm??_?.api.npm??M[t]?.npm??"@ai-sdk/openai-compatible",m=q1(()=>{if(P.name)return P.name;if(P.id&&P.id!==L)return L;return _?.name??L}),e={id:_1.make(L),api:{id:x,npm:l,url:P.provider?.api??C?.api??_?.api.url??M[t]?.api??""},status:P.status??_?.status??"active",name:m,providerID:N0.make(t),capabilities:{temperature:P.temperature??_?.capabilities.temperature??!1,reasoning:P.reasoning??_?.capabilities.reasoning??!1,attachment:P.attachment??_?.capabilities.attachment??!1,toolcall:P.tool_call??_?.capabilities.toolcall??!0,input:{text:P.modalities?.input?.includes("text")??_?.capabilities.input.text??!0,audio:P.modalities?.input?.includes("audio")??_?.capabilities.input.audio??!1,image:P.modalities?.input?.includes("image")??_?.capabilities.input.image??!1,video:P.modalities?.input?.includes("video")??_?.capabilities.input.video??!1,pdf:P.modalities?.input?.includes("pdf")??_?.capabilities.input.pdf??!1},output:{text:P.modalities?.output?.includes("text")??_?.capabilities.output.text??!0,audio:P.modalities?.output?.includes("audio")??_?.capabilities.output.audio??!1,image:P.modalities?.output?.includes("image")??_?.capabilities.output.image??!1,video:P.modalities?.output?.includes("video")??_?.capabilities.output.video??!1,pdf:P.modalities?.output?.includes("pdf")??_?.capabilities.output.pdf??!1},interleaved:P.interleaved??_?.capabilities.interleaved??(!_&&l==="@ai-sdk/openai-compatible"&&x.includes("deepseek")?{field:"reasoning_content"}:!1)},cost:{input:P?.cost?.input??_?.cost?.input??0,output:P?.cost?.output??_?.cost?.output??0,cache:{read:P?.cost?.cache_read??_?.cost?.cache.read??0,write:P?.cost?.cache_write??_?.cost?.cache.write??0}},options:O1(_?.options??{},P.options??{}),limit:{context:P.limit?.context??_?.limit?.context??0,input:P.limit?.input??_?.limit?.input,output:P.limit?.output??_?.limit?.output??0},headers:O1(_?.headers??{},P.headers??{}),family:P.family??_?.family??"",release_date:P.release_date??_?.release_date??"",variants:{}},Z0=O1(QZ(e),P.variants??{});e.variants=L$(u5(Z0,(T0)=>!T0.disabled),(T0)=>m5(T0,["disabled"])),h.models[L]=e}D[t]=h}let X0=yield*X.all();for(let[t,C]of Object.entries(D)){let E=N0.make(t);if(a.has(E))continue;let h=C.env.map((L)=>X0[L]).find(Boolean);if(!h)continue;v(E,{source:"env",key:C.env.length===1?h:void 0})}let Y0=yield*Q.all().pipe(i.orDie);for(let[t,C]of Object.entries(Y0)){let E=N0.make(t);if(a.has(E))continue;if(C.type==="api")v(E,{source:"api",key:C.key})}for(let t of n){if(!t.auth)continue;let C=N0.make(t.auth.provider);if(a.has(C))continue;if(!(yield*Q.get(C).pipe(i.orDie)))continue;if(!t.auth.loader)continue;let L=(yield*i.promise(()=>t.auth.loader(()=>O.promise(Q.get(C).pipe(i.orDie)),P7(D[t.auth.provider]))))??{},P=f[C]?{options:L}:{source:"custom",options:L};v(C,P)}for(let[t,C]of Object.entries(Jv(y))){let E=N0.make(t);if(a.has(E))continue;let h=D[E];if(!h){j1.error("Provider does not exist in model list "+E);continue}let L=yield*C(h);if(L&&(L.autoload||f[E])){if(L.getModel)T[E]=L.getModel;if(L.vars)b[E]=L.vars;if(L.discoverModels)S[E]=L.discoverModels;let P=L.options??{},_=f[E]?{options:P}:{source:"custom",options:P};v(E,_)}}for(let[t,C]of s){let E=N0.make(t),h={source:"config"};if(C.env)h.env=C.env;if(C.name)h.name=C.name;if(C.options)h.options=C.options;v(E,h)}let B0=N0.make("gitlab");if(S[B0]&&f[B0]&&r(B0))yield*i.promise(async()=>{try{let t=await S[B0]();for(let[C,E]of Object.entries(t))if(!f[B0].models[C])f[B0].models[C]=E}catch(t){j1.warn("state discovery error",{id:"gitlab",error:t})}});for(let[t,C]of Object.entries(f)){let E=N0.make(t);if(!r(E)){delete f[E];continue}let h=j.provider?.[E];for(let[L,P]of Object.entries(C.models)){if(P.api.id=P.api.id??P.id??L,L==="gpt-5-chat-latest"&&(E===N0.openai||E===N0.githubCopilot||E===N0.openrouter)||E===N0.openrouter&&L==="openai/gpt-5-chat")delete C.models[L];if(P.status==="alpha"&&!W.enableExperimentalModels)delete C.models[L];if(P.status==="deprecated")delete C.models[L];if(h?.blacklist&&h.blacklist.includes(L)||h?.whitelist&&!h.whitelist.includes(L))delete C.models[L];if(!P.variants||Object.keys(P.variants).length===0)P.variants=L$(QZ(P),(x)=>x);let _=h?.models?.[L]?.variants;if(_&&P.variants){let x=O1(P.variants,_);P.variants=L$(u5(x,(l)=>!l.disabled),(l)=>m5(l,["disabled"]))}}if(Object.keys(C.models).length===0){delete f[E];continue}j1.info("found",{providerID:E})}return{models:R,providers:f,catalog:A,sdk:q,modelLoaders:T,varsLoaders:b}})),K=i.fn("Provider.list")(()=>Y1.use(G,(F)=>F.providers));async function B(F,O,j){try{using M=j1.time("getSDK",{providerID:F.providerID});let A=O.providers[F.providerID],D={...A.options};if(F.providerID==="google-vertex"&&F.api.npm==="@ai-sdk/google-vertex/anthropic"&&!D.baseURL){let r=VA(typeof D.project==="string"?D.project:void 0,typeof D.location==="string"?D.location:void 0);if(r)D.baseURL=r}if(F.providerID==="google-vertex"&&!F.api.npm.includes("@ai-sdk/openai-compatible"))delete D.fetch;if(F.api.npm.includes("@ai-sdk/openai-compatible")&&D.includeUsage!==!1)D.includeUsage=!0;let f=q1(()=>{let r=typeof D.baseURL==="string"&&D.baseURL!==""?D.baseURL:F.api.url;if(!r)return;let X0=O.varsLoaders[F.providerID];if(X0){let Y0=X0(D);for(let[B0,t]of Object.entries(Y0)){let C="${"+B0+"}";r=r.replaceAll(C,t)}}return r=r.replace(/\$\{([^}]+)\}/g,(Y0,B0)=>{return j[String(B0)]??Y0}),r});if(f!==void 0)D.baseURL=f;if(D.apiKey===void 0&&A.key)D.apiKey=A.key;if(F.headers)D.headers={...D.headers,...F.headers};let R=JA.fast(JSON.stringify({providerID:F.providerID,npm:F.api.npm,options:D})),T=O.sdk.get(R);if(T)return T;let{fetch:b,chunkTimeout:q,headerTimeout:S}=D;delete D.chunkTimeout,delete D.headerTimeout,D.fetch=async(r,X0)=>{let Y0=b??fetch,B0=X0??{},t=typeof q==="number"&&q>0?new AbortController:void 0,C=S===!1?void 0:S,E=typeof C==="number"?Qv(C):void 0,h=[];if(B0.signal)h.push(B0.signal);if(t)h.push(t.signal);if(E)h.push(E.signal);if(D.timeout!==void 0&&D.timeout!==null&&D.timeout!==!1)h.push(AbortSignal.timeout(D.timeout));let L=h.length===0?null:h.length===1?h[0]:AbortSignal.any(h);if(L)B0.signal=L;if((F.api.npm==="@ai-sdk/openai"||F.api.npm==="@ai-sdk/azure")&&B0.body&&B0.method==="POST"){let _=JSON.parse(B0.body);if(_.store!==!0&&Array.isArray(_.input)){for(let l of _.input)if("id"in l)delete l.id;B0.body=JSON.stringify(_)}}let P=await Y0(r,{...B0,timeout:!1}).finally(()=>E?.clear());if(!t)return P;return Zv(P,q,t)};let y=Xv[F.api.npm];if(y){j1.info("using bundled provider",{providerID:F.providerID,pkg:F.api.npm});let X0=(await y())({name:F.providerID,...D});return O.sdk.set(R,X0),X0}let v;if(!F.api.npm.startsWith("file://")){let r=await KA.add(F.api.npm);if(!r.entrypoint)throw Error(`Package ${F.api.npm} has no import entrypoint`);v=r.entrypoint}else j1.info("loading local provider",{pkg:F.api.npm}),v=F.api.npm;let s=await import(v.startsWith("file://")?v:tk(v).href),a=s[Object.keys(s).find((r)=>r.startsWith("create"))],p=a({name:F.providerID,...D});return O.sdk.set(R,p),p}catch(M){throw new C7({providerID:F.providerID,cause:M})}}let U=i.fn("Provider.getProvider")((F)=>Y1.use(G,(O)=>O.providers[F])),w=i.fn("Provider.getModel")(function*(F,O){let j=yield*Y1.get(G),M=j.providers[F];if(!M){let D=j.catalog[F],f=D?h5(D,O,W.enableExperimentalModels):s5.default.go(F,Object.keys({...j.catalog,...j.providers}),{limit:3,threshold:-1e4}).map((R)=>R.target);return yield*new y8({providerID:F,modelID:O,suggestions:f})}let A=M.models[O];if(!A){let D=h5(M,O,W.enableExperimentalModels),f=D.length?D:h5(j.catalog[F],O,W.enableExperimentalModels);return yield*new y8({providerID:F,modelID:O,suggestions:f})}return A}),H=i.fn("Provider.getLanguage")(function*(F){let O=yield*Y1.get(G),j=yield*X.all(),M=`${F.providerID}/${F.id}`;if(O.models.has(M))return O.models.get(M);let A=O.providers[F.providerID];return yield*$Z.refineRejection(async()=>{let D=await B(F,O,j),f=O.modelLoaders[F.providerID]?await O.modelLoaders[F.providerID](D,F.api.id,{...A.options,...F.options}):D.languageModel(F.api.id);return O.models.set(M,f),f},(D)=>D instanceof wA?new y8({modelID:F.id,providerID:F.providerID,cause:D}):void 0)}),V=i.fn("Provider.closest")(function*(F,O){let M=(yield*Y1.get(G)).providers[F];if(!M)return;for(let A of O)for(let D of Object.keys(M.models))if(D.includes(A))return{providerID:F,modelID:D};return}),z=i.fn("Provider.getSmallModel")(function*(F){let O=yield*Z.get();if(O.small_model){let D=c5(O.small_model);return yield*w(D.providerID,D.modelID).pipe(i.catchTag("ProviderModelNotFoundError",()=>i.succeed(void 0)))}let M=(yield*Y1.get(G)).providers[F];if(!M)return;let A=["claude-haiku-4-5","claude-haiku-4.5","3-5-haiku","3.5-haiku","gemini-3-flash","gemini-2.5-flash","gpt-5-nano"];if(F.startsWith("muxcode"))A=["gpt-5-nano"];if(F.startsWith("github-copilot"))A=["gpt-5-mini","claude-haiku-4.5",...A];for(let D of A)if(F===N0.amazonBedrock){let f=["global.","us.","eu."],R=Object.keys(M.models).filter((S)=>S.includes(D)),T=R.find((S)=>S.startsWith("global."));if(T)return M.models[T];let b=M.options?.region;if(b){let S=b.split("-")[0];if(S==="us"||S==="eu"){let y=R.find((v)=>v.startsWith(`${S}.`));if(y)return M.models[y]}}let q=R.find((S)=>!f.some((y)=>S.startsWith(y)));if(q)return M.models[q]}else for(let f of Object.keys(M.models))if(f.includes(D))return M.models[f];return}),N=i.fn("Provider.defaultModel")(function*(){let F=yield*Z.get();if(F.model)return c5(F.model);let O=yield*Y1.get(G),j=yield*$.readJson(rk.join(WA.Path.state,"model.json")).pipe(i.map((D)=>{if(!i8(D)||!Array.isArray(D.recent))return[];return D.recent.flatMap((f)=>{if(!i8(f))return[];if(typeof f.providerID!=="string")return[];if(typeof f.modelID!=="string")return[];return[{providerID:N0.make(f.providerID),modelID:_1.make(f.modelID)}]})}),i.catch(()=>i.succeed([])));for(let D of j){let f=O.providers[D.providerID];if(!f)continue;if(!f.models[D.modelID])continue;return{providerID:D.providerID,modelID:D.modelID}}let M=Object.values(O.providers).find((D)=>!F.provider||Object.keys(F.provider).includes(D.id));if(!M)return yield*new E7;let[A]=o5(Object.values(M.models));if(!A)return yield*new b7({providerID:M.id});return{providerID:M.id,modelID:A.id}});return XZ.of({list:K,getProvider:U,getModel:w,getLanguage:H,closest:V,getSmallModel:z,defaultModel:N})})),Fv=J1.suspend(()=>NA.pipe(J1.provide(d5.defaultLayer),J1.provide(n5.defaultLayer),J1.provide(k8.defaultLayer),J1.provide(p5.defaultLayer),J1.provide(v8.defaultLayer),J1.provide(UA),J1.provide(x8.defaultLayer))),Nv=["deepseek-chat","deepseek-v4","deepseek-r1","gpt-5","claude-sonnet-4"];function o5($){return i5($,[(Z)=>Nv.findIndex((Q)=>Z.id.includes(Q)),"desc"],[(Z)=>Z.id.includes("latest")?0:1,"asc"],[(Z)=>Z.id,"desc"])}function c5($){let[Z,...Q]=$.split("/");return{providerID:N0.make(Z),modelID:_1.make(Q.join("/"))}}
672
+ export{XW as cl,xW as dl,m8 as el,k5 as fl,v5 as gl,xm as hl,R7 as il,r5 as jl,mm as kl,lm as ll,Ok as ml,v8 as nl};