@netlify/agent-runner-cli 1.163.0-PAW-328.0 → 1.163.0-PAW-328.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin-local.js CHANGED
@@ -4,7 +4,7 @@ var Oye=Object.create;var iE=Object.defineProperty;var Nye=Object.getOwnProperty
4
4
  for call at
5
5
  ${e}`;return Object.assign(new Error(r),t,{stack:i})}var qO=class extends Sbe.EventEmitter{constructor(){super()}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(hg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}};fi.ClientUnaryCallImpl=qO;var VO=class extends YO.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(hg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}};fi.ClientReadableStreamImpl=VO;var HO=class extends YO.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(hg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_write(e,r,n){var i;let o={callback:n},s=Number(r);Number.isNaN(s)||(o.flags=s),(i=this.call)===null||i===void 0||i.sendMessageWithContext(o,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};fi.ClientWritableStreamImpl=HO;var WO=class extends YO.Duplex{constructor(e,r){super({objectMode:!0}),this.serialize=e,this.deserialize=r}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(hg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}_write(e,r,n){var i;let o={callback:n},s=Number(r);Number.isNaN(s)||(o.flags=s),(i=this.call)===null||i===void 0||i.sendMessageWithContext(o,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};fi.ClientDuplexStreamImpl=WO});var ll=T(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.InterceptingListenerImpl=void 0;cl.statusOrFromValue=Tbe;cl.statusOrFromError=bbe;cl.isInterceptingListener=Abe;var vbe=Kt();function Tbe(t){return{ok:!0,value:t}}function bbe(t){var e;return{ok:!1,error:Object.assign(Object.assign({},t),{metadata:(e=t.metadata)!==null&&e!==void 0?e:new vbe.Metadata})}}function Abe(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var KO=class{constructor(e,r){this.listener=e,this.nextListener=r,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextListener.onReceiveStatus(r)})}};cl.InterceptingListenerImpl=KO});var rN=T(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.InterceptingCall=pi.RequesterBuilder=pi.ListenerBuilder=pi.InterceptorConfigurationError=void 0;pi.getInterceptingCall=Ibe;var wbe=Kt(),UK=ll(),FK=Ge(),BK=iT(),gg=class t extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,t)}};pi.InterceptorConfigurationError=gg;var JO=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};pi.ListenerBuilder=JO;var XO=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};pi.RequesterBuilder=XO;var ZO={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveStatus:(t,e)=>{e(t)}},mg={start:(t,e,r)=>{r(t,e)},sendMessage:(t,e)=>{e(t)},halfClose:t=>{t()},cancel:t=>{t()}},QO=class{constructor(e,r){var n,i,o,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,r?this.requester={start:(n=r.start)!==null&&n!==void 0?n:mg.start,sendMessage:(i=r.sendMessage)!==null&&i!==void 0?i:mg.sendMessage,halfClose:(o=r.halfClose)!==null&&o!==void 0?o:mg.halfClose,cancel:(s=r.cancel)!==null&&s!==void 0?s:mg.cancel}:this.requester=mg}cancelWithStatus(e,r){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,r)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,r){var n,i,o,s,a,c;let l={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(u=>{}),onReceiveMessage:(s=(o=r?.onReceiveMessage)===null||o===void 0?void 0:o.bind(r))!==null&&s!==void 0?s:(u=>{}),onReceiveStatus:(c=(a=r?.onReceiveStatus)===null||a===void 0?void 0:a.bind(r))!==null&&c!==void 0?c:(u=>{})};this.processingMetadata=!0,this.requester.start(e,l,(u,d)=>{var f,p,h;this.processingMetadata=!1;let m;if((0,UK.isInterceptingListener)(d))m=d;else{let S={onReceiveMetadata:(f=d.onReceiveMetadata)!==null&&f!==void 0?f:ZO.onReceiveMetadata,onReceiveMessage:(p=d.onReceiveMessage)!==null&&p!==void 0?p:ZO.onReceiveMessage,onReceiveStatus:(h=d.onReceiveStatus)!==null&&h!==void 0?h:ZO.onReceiveStatus};m=new UK.InterceptingListenerImpl(S,l)}this.nextCall.start(u,m),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,r){this.processingMessage=!0,this.requester.sendMessage(r,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=r):(this.nextCall.sendMessageWithContext(e,n),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};pi.InterceptingCall=QO;function xbe(t,e,r){var n,i;let o=(n=r.deadline)!==null&&n!==void 0?n:1/0,s=r.host,a=(i=r.parent)!==null&&i!==void 0?i:null,c=r.propagate_flags,l=r.credentials,u=t.createCall(e,o,s,a,c);return l&&u.setCredentials(l),u}var AT=class{constructor(e,r){this.call=e,this.methodDefinition=r}cancelWithStatus(e,r){this.call.cancelWithStatus(e,r)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,r){let n;try{n=this.methodDefinition.requestSerialize(r)}catch(i){this.call.cancelWithStatus(FK.Status.INTERNAL,`Request message serialization failure: ${(0,BK.getErrorMessage)(i)}`);return}this.call.sendMessageWithContext(e,n)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,r){let n=null;this.call.start(e,{onReceiveMetadata:i=>{var o;(o=r?.onReceiveMetadata)===null||o===void 0||o.call(r,i)},onReceiveMessage:i=>{var o;let s;try{s=this.methodDefinition.responseDeserialize(i)}catch(a){n={code:FK.Status.INTERNAL,details:`Response message parsing error: ${(0,BK.getErrorMessage)(a)}`,metadata:new wbe.Metadata},this.call.cancelWithStatus(n.code,n.details);return}(o=r?.onReceiveMessage)===null||o===void 0||o.call(r,s)},onReceiveStatus:i=>{var o,s;n?(o=r?.onReceiveStatus)===null||o===void 0||o.call(r,n):(s=r?.onReceiveStatus)===null||s===void 0||s.call(r,i)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}},eN=class extends AT{constructor(e,r){super(e,r)}start(e,r){var n,i;let o=!1,s={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(a=>{}),onReceiveMessage:a=>{var c;o=!0,(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,a)},onReceiveStatus:a=>{var c,l;o||(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,null),(l=r?.onReceiveStatus)===null||l===void 0||l.call(r,a)}};super.start(e,s),this.call.startRead()}},tN=class extends AT{};function Rbe(t,e,r){let n=xbe(t,r.path,e);return r.responseStream?new tN(n,r):new eN(n,r)}function Ibe(t,e,r,n){if(t.clientInterceptors.length>0&&t.clientInterceptorProviders.length>0)throw new gg("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(t.callInterceptors.length>0&&t.callInterceptorProviders.length>0)throw new gg("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let i=[];t.callInterceptors.length>0||t.callInterceptorProviders.length>0?i=[].concat(t.callInterceptors,t.callInterceptorProviders.map(a=>a(e))).filter(a=>a):i=[].concat(t.clientInterceptors,t.clientInterceptorProviders.map(a=>a(e))).filter(a=>a);let o=Object.assign({},r,{method_definition:e});return i.reduceRight((a,c)=>l=>c(l,a),a=>Rbe(n,a,e))(o)}});var oN=T(xT=>{"use strict";Object.defineProperty(xT,"__esModule",{value:!0});xT.Client=void 0;var Qi=$K(),Cbe=sN(),Pbe=Mr(),pa=Ge(),Cd=Kt(),wT=rN(),hi=Symbol(),Pd=Symbol(),Od=Symbol(),Jo=Symbol();function nN(t){return typeof t=="function"}function Nd(t){var e;return((e=t.stack)===null||e===void 0?void 0:e.split(`
6
6
  `).slice(1).join(`
7
- `))||"no stack trace available"}var iN=class{constructor(e,r,n={}){var i,o;if(n=Object.assign({},n),this[Pd]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[Od]=(o=n.interceptor_providers)!==null&&o!==void 0?o:[],delete n.interceptor_providers,this[Pd].length>0&&this[Od].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Jo]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[hi]=n.channelOverride;else if(n.channelFactoryOverride){let s=n.channelFactoryOverride;delete n.channelFactoryOverride,this[hi]=s(e,r,n)}else this[hi]=new Cbe.ChannelImplementation(e,r,n)}close(){this[hi].close()}getChannel(){return this[hi]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let o;try{o=this[hi].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(o===Pbe.ConnectivityState.READY)r();else try{this[hi].watchConnectivityState(o,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(nN(e))return{metadata:new Cd.Metadata,options:{},callback:e};if(nN(r))return e instanceof Cd.Metadata?{metadata:e,options:{},callback:r}:{metadata:new Cd.Metadata,options:e,callback:r};if(!(e instanceof Cd.Metadata&&r instanceof Object&&nN(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,o,s,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(o,s,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new Qi.ClientUnaryCallImpl,channel:this[hi],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Jo]&&(f=this[Jo](f));let p=f.call,h={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,wT.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let S=null,E=!1,b=new Error;return m.start(f.metadata,{onReceiveMetadata:A=>{p.emit("metadata",A)},onReceiveMessage(A){S!==null&&m.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),S=A},onReceiveStatus(A){if(!E){if(E=!0,A.code===pa.Status.OK)if(S===null){let y=Nd(b);f.callback((0,Qi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:A.metadata},y))}else f.callback(null,S);else{let y=Nd(b);f.callback((0,Qi.callErrorFromStatus)(A,y))}b=null,p.emit("status",A)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,o,s),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new Qi.ClientWritableStreamImpl(r),channel:this[hi],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Jo]&&(d=this[Jo](d));let f=d.call,p={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,S=!1,E=new Error;return h.start(d.metadata,{onReceiveMetadata:b=>{f.emit("metadata",b)},onReceiveMessage(b){m!==null&&h.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),m=b,h.startRead()},onReceiveStatus(b){if(!S){if(S=!0,b.code===pa.Status.OK)if(m===null){let A=Nd(E);d.callback((0,Qi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:b.metadata},A))}else d.callback(null,m);else{let A=Nd(E);d.callback((0,Qi.callErrorFromStatus)(b,A))}E=null,f.emit("status",b)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof Cd.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new Cd.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkMetadataAndOptions(o,s),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new Qi.ClientReadableStreamImpl(n),channel:this[hi],methodDefinition:u,callOptions:l.options};this[Jo]&&(d=this[Jo](d));let f=d.call,p={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,S=new Error;return h.start(d.metadata,{onReceiveMetadata(E){f.emit("metadata",E)},onReceiveMessage(E){f.push(E)},onReceiveStatus(E){if(!m){if(m=!0,f.push(null),E.code!==pa.Status.OK){let b=Nd(S);f.emit("error",(0,Qi.callErrorFromStatus)(E,b))}S=null,f.emit("status",E)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,o){var s,a;let c=this.checkMetadataAndOptions(i,o),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new Qi.ClientDuplexStreamImpl(r,n),channel:this[hi],methodDefinition:l,callOptions:c.options};this[Jo]&&(u=this[Jo](u));let d=u.call,f={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(s=u.callOptions.interceptors)!==null&&s!==void 0?s:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,wT.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(S){d.emit("metadata",S)},onReceiveMessage(S){d.push(S)},onReceiveStatus(S){if(!h){if(h=!0,d.push(null),S.code!==pa.Status.OK){let E=Nd(m);d.emit("error",(0,Qi.callErrorFromStatus)(S,E))}m=null,d.emit("status",S)}}}),d}};xT.Client=iN});var IT=T(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.makeClientConstructor=jK;RT.loadPackageDefinition=Mbe;var _g=oN(),Obe={unary:_g.Client.prototype.makeUnaryRequest,server_stream:_g.Client.prototype.makeServerStreamRequest,client_stream:_g.Client.prototype.makeClientStreamRequest,bidi:_g.Client.prototype.makeBidiStreamRequest};function aN(t){return["__proto__","prototype","constructor"].includes(t)}function jK(t,e,r){r||(r={});class n extends _g.Client{}return Object.keys(t).forEach(i=>{if(aN(i))return;let o=t[i],s;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");o.requestStream?o.responseStream?s="bidi":s="client_stream":o.responseStream?s="server_stream":s="unary";let a=o.requestSerialize,c=o.responseDeserialize,l=Nbe(Obe[s],o.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],o),o.originalName&&!aN(o.originalName)&&(n.prototype[o.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function Nbe(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function kbe(t){return"format"in t}function Mbe(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>aN(a)))continue;let o=i[i.length-1],s=e;for(let a of i.slice(0,-1))s[a]||(s[a]={}),s=s[a];kbe(n)?s[o]=n:s[o]=jK(n,o,{})}return e}});var f8=T((Bat,d8)=>{"use strict";var Dbe=1/0,Lbe="[object Symbol]",$be=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ube=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,PT="\\ud800-\\udfff",KK="\\u0300-\\u036f\\ufe20-\\ufe23",ZK="\\u20d0-\\u20f0",JK="\\u2700-\\u27bf",XK="a-z\\xdf-\\xf6\\xf8-\\xff",Fbe="\\xac\\xb1\\xd7\\xf7",Bbe="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jbe="\\u2000-\\u206f",zbe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",QK="A-Z\\xc0-\\xd6\\xd8-\\xde",e8="\\ufe0e\\ufe0f",t8=Fbe+Bbe+jbe+zbe,lN="['\u2019]",Gbe="["+PT+"]",zK="["+t8+"]",CT="["+KK+ZK+"]",r8="\\d+",qbe="["+JK+"]",n8="["+XK+"]",i8="[^"+PT+t8+r8+JK+XK+QK+"]",cN="\\ud83c[\\udffb-\\udfff]",Vbe="(?:"+CT+"|"+cN+")",o8="[^"+PT+"]",uN="(?:\\ud83c[\\udde6-\\uddff]){2}",dN="[\\ud800-\\udbff][\\udc00-\\udfff]",kd="["+QK+"]",s8="\\u200d",GK="(?:"+n8+"|"+i8+")",Hbe="(?:"+kd+"|"+i8+")",qK="(?:"+lN+"(?:d|ll|m|re|s|t|ve))?",VK="(?:"+lN+"(?:D|LL|M|RE|S|T|VE))?",a8=Vbe+"?",c8="["+e8+"]?",Wbe="(?:"+s8+"(?:"+[o8,uN,dN].join("|")+")"+c8+a8+")*",l8=c8+a8+Wbe,Ybe="(?:"+[qbe,uN,dN].join("|")+")"+l8,Kbe="(?:"+[o8+CT+"?",CT,uN,dN,Gbe].join("|")+")",Zbe=RegExp(lN,"g"),Jbe=RegExp(CT,"g"),Xbe=RegExp(cN+"(?="+cN+")|"+Kbe+l8,"g"),Qbe=RegExp([kd+"?"+n8+"+"+qK+"(?="+[zK,kd,"$"].join("|")+")",Hbe+"+"+VK+"(?="+[zK,kd+GK,"$"].join("|")+")",kd+"?"+GK+"+"+qK,kd+"+"+VK,r8,Ybe].join("|"),"g"),eAe=RegExp("["+s8+PT+KK+ZK+e8+"]"),tAe=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rAe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},nAe=typeof global=="object"&&global&&global.Object===Object&&global,iAe=typeof self=="object"&&self&&self.Object===Object&&self,oAe=nAe||iAe||Function("return this")();function sAe(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function aAe(t){return t.split("")}function cAe(t){return t.match($be)||[]}function lAe(t){return function(e){return t?.[e]}}var uAe=lAe(rAe);function u8(t){return eAe.test(t)}function dAe(t){return tAe.test(t)}function fAe(t){return u8(t)?pAe(t):aAe(t)}function pAe(t){return t.match(Xbe)||[]}function hAe(t){return t.match(Qbe)||[]}var mAe=Object.prototype,gAe=mAe.toString,HK=oAe.Symbol,WK=HK?HK.prototype:void 0,YK=WK?WK.toString:void 0;function _Ae(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function yAe(t){if(typeof t=="string")return t;if(bAe(t))return YK?YK.call(t):"";var e=t+"";return e=="0"&&1/t==-Dbe?"-0":e}function SAe(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:_Ae(t,e,r)}function EAe(t){return function(e){e=OT(e);var r=u8(e)?fAe(e):void 0,n=r?r[0]:e.charAt(0),i=r?SAe(r,1).join(""):e.slice(1);return n[t]()+i}}function vAe(t){return function(e){return sAe(IAe(xAe(e).replace(Zbe,"")),t,"")}}function TAe(t){return!!t&&typeof t=="object"}function bAe(t){return typeof t=="symbol"||TAe(t)&&gAe.call(t)==Lbe}function OT(t){return t==null?"":yAe(t)}var AAe=vAe(function(t,e,r){return e=e.toLowerCase(),t+(r?wAe(e):e)});function wAe(t){return RAe(OT(t).toLowerCase())}function xAe(t){return t=OT(t),t&&t.replace(Ube,uAe).replace(Jbe,"")}var RAe=EAe("toUpperCase");function IAe(t,e,r){return t=OT(t),e=r?void 0:e,e===void 0?dAe(t)?hAe(t):cAe(t):t.match(e)||[]}d8.exports=AAe});var fN=T((jat,p8)=>{"use strict";p8.exports=CAe;function CAe(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(o)if(o=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){o&&(o=!1,c(l))}})}});var _8=T(g8=>{"use strict";var NT=g8;NT.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Md=new Array(64),m8=new Array(123);for(mi=0;mi<64;)m8[Md[mi]=mi<26?mi+65:mi<52?mi+71:mi<62?mi-4:mi-59|43]=mi++;var mi;NT.encode=function(e,r,n){for(var i=null,o=[],s=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:o[s++]=Md[l>>2],c=(l&3)<<4,a=1;break;case 1:o[s++]=Md[c|l>>4],c=(l&15)<<2,a=2;break;case 2:o[s++]=Md[c|l>>6],o[s++]=Md[l&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Md[c],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var h8="invalid encoding";NT.decode=function(e,r,n){for(var i=n,o=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&o>1)break;if((c=m8[c])===void 0)throw Error(h8);switch(o){case 0:s=c,o=1;break;case 1:r[n++]=s<<2|(c&48)>>4,s=c,o=2;break;case 2:r[n++]=(s&15)<<4|(c&60)>>2,s=c,o=3;break;case 3:r[n++]=(s&3)<<6|c,o=0;break}}if(o===1)throw Error(h8);return n-i};NT.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var S8=T((Gat,y8)=>{"use strict";y8.exports=kT;function kT(){this._listeners=Object.create(null)}kT.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};kT.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};kT.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var x8=T((qat,w8)=>{"use strict";w8.exports=E8(E8);function E8(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function o(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?s:a,t.readFloatBE=n?a:s})():(function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,o,s)}}t.writeFloatLE=e.bind(null,v8),t.writeFloatBE=e.bind(null,T8);function r(n,i,o){var s=n(i,o),a=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,b8),t.readFloatBE=r.bind(null,A8)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function o(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?s:a,t.readDoubleBE=n?a:s})():(function(){function e(n,i,o,s,a,c){var l=s<0?1:0;if(l&&(s=-s),s===0)n(0,a,c+i),n(1/s>0?0:2147483648,a,c+o);else if(isNaN(s))n(0,a,c+i),n(2146959360,a,c+o);else if(s>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+o);else{var u;if(s<22250738585072014e-324)u=s/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+o);else{var d=Math.floor(Math.log(s)/Math.LN2);d===1024&&(d=1023),u=s*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+o)}}}t.writeDoubleLE=e.bind(null,v8,0,4),t.writeDoubleBE=e.bind(null,T8,4,0);function r(n,i,o,s,a){var c=n(s,a+i),l=n(s,a+o),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,b8,0,4),t.readDoubleBE=r.bind(null,A8,4,0)})(),t}function v8(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function T8(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function b8(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function A8(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var I8=T((Vat,R8)=>{"use strict";R8.exports=PAe;function PAe(t){try{if(typeof Q!="function")return null;var e=Q(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var P8=T(C8=>{"use strict";var hN=C8,pN="\uFFFD";hN.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};hN.read=function(e,r,n){if(n-r<1)return"";for(var i="",o=r;o<n;){var s=e[o++];if(s<=127)i+=String.fromCharCode(s);else if(s>=192&&s<224){var a=(s&31)<<6|e[o++]&63;i+=a>=128?String.fromCharCode(a):pN}else if(s>=224&&s<240){var c=(s&15)<<12|(e[o++]&63)<<6|e[o++]&63;i+=c>=2048?String.fromCharCode(c):pN}else if(s>=240){var l=(s&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;l<65536||l>1114111?i+=pN:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};hN.write=function(e,r,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128);return n-i}});var N8=T((Yat,O8)=>{"use strict";O8.exports=OAe;function OAe(t,e,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(c){if(c<1||c>i)return t(c);s+c>n&&(o=t(n),s=0);var l=e.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}});var M8=T((Kat,k8)=>{"use strict";k8.exports=Zt;var yg=gi();function Zt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ul=Zt.zero=new Zt(0,0);ul.toNumber=function(){return 0};ul.zzEncode=ul.zzDecode=function(){return this};ul.length=function(){return 1};var NAe=Zt.zeroHash="\0\0\0\0\0\0\0\0";Zt.fromNumber=function(e){if(e===0)return ul;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Zt(n,i)};Zt.from=function(e){if(typeof e=="number")return Zt.fromNumber(e);if(yg.isString(e))if(yg.Long)e=yg.Long.fromString(e);else return Zt.fromNumber(parseInt(e,10));return e.low||e.high?new Zt(e.low>>>0,e.high>>>0):ul};Zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Zt.prototype.toLong=function(e){return yg.Long?new yg.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ha=String.prototype.charCodeAt;Zt.fromHash=function(e){return e===NAe?ul:new Zt((ha.call(e,0)|ha.call(e,1)<<8|ha.call(e,2)<<16|ha.call(e,3)<<24)>>>0,(ha.call(e,4)|ha.call(e,5)<<8|ha.call(e,6)<<16|ha.call(e,7)<<24)>>>0)};Zt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Zt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Zt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Zt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var gN=T((Sg,mN)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof Sg=="object"?(e(Sg),typeof mN=="object"&&(mN.exports=r(Sg))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Sg,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(k,g,v){this.low=k|0,this.high=g|0,this.unsigned=!!v}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(k){return(k&&k.__isLong__)===!0}function i(k){var g=Math.clz32(k&-k);return k?31-g:g}r.isLong=n;var o={},s={};function a(k,g){var v,I,J;return g?(k>>>=0,(J=0<=k&&k<256)&&(I=s[k],I)?I:(v=l(k,0,!0),J&&(s[k]=v),v)):(k|=0,(J=-128<=k&&k<128)&&(I=o[k],I)?I:(v=l(k,k<0?-1:0,!1),J&&(o[k]=v),v))}r.fromInt=a;function c(k,g){if(isNaN(k))return g?y:A;if(g){if(k<0)return y;if(k>=S)return R}else{if(k<=-E)return $;if(k+1>=E)return N}return k<0?c(-k,g).neg():l(k%m|0,k/m|0,g)}r.fromNumber=c;function l(k,g,v){return new r(k,g,v)}r.fromBits=l;var u=Math.pow;function d(k,g,v){if(k.length===0)throw Error("empty string");if(typeof g=="number"?(v=g,g=!1):g=!!g,k==="NaN"||k==="Infinity"||k==="+Infinity"||k==="-Infinity")return g?y:A;if(v=v||10,v<2||36<v)throw RangeError("radix");var I;if((I=k.indexOf("-"))>0)throw Error("interior hyphen");if(I===0)return d(k.substring(1),g,v).neg();for(var J=c(u(v,8)),G=A,le=0;le<k.length;le+=8){var Oe=Math.min(8,k.length-le),Ie=parseInt(k.substring(le,le+Oe),v);if(Oe<8){var Ne=c(u(v,Oe));G=G.mul(Ne).add(c(Ie))}else G=G.mul(J),G=G.add(c(Ie))}return G.unsigned=g,G}r.fromString=d;function f(k,g){return typeof k=="number"?c(k,g):typeof k=="string"?d(k,g):l(k.low,k.high,typeof g=="boolean"?g:k.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,S=m*m,E=S/2,b=a(h),A=a(0);r.ZERO=A;var y=a(0,!0);r.UZERO=y;var x=a(1);r.ONE=x;var C=a(1,!0);r.UONE=C;var O=a(-1);r.NEG_ONE=O;var N=l(-1,2147483647,!1);r.MAX_VALUE=N;var R=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=R;var $=l(0,-2147483648,!1);r.MIN_VALUE=$;var _=r.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},_.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq($)){var v=c(g),I=this.div(v),J=I.mul(v).sub(this);return I.toString(g)+J.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var G=c(u(g,6),this.unsigned),le=this,Oe="";;){var Ie=le.div(G),Ne=le.sub(Ie.mul(G)).toInt()>>>0,Re=Ne.toString(g);if(le=Ie,le.isZero())return Re+Oe;for(;Re.length<6;)Re="0"+Re;Oe=""+Re+Oe}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq($)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,v=31;v>0&&(g&1<<v)==0;v--);return this.high!=0?v+33:v+1},_.isSafeInteger=function(){var g=this.high>>21;return g?this.unsigned?!1:g===-1&&!(this.low===0&&this.high===-2097152):!0},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(g){return n(g)||(g=f(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},_.eq=_.equals,_.notEquals=function(g){return!this.eq(g)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(g){return this.comp(g)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(g){return this.comp(g)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(g){return this.comp(g)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(g){return this.comp(g)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(g){if(n(g)||(g=f(g)),this.eq(g))return 0;var v=this.isNegative(),I=g.isNegative();return v&&!I?-1:!v&&I?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq($)?$:this.not().add(x)},_.neg=_.negate,_.add=function(g){n(g)||(g=f(g));var v=this.high>>>16,I=this.high&65535,J=this.low>>>16,G=this.low&65535,le=g.high>>>16,Oe=g.high&65535,Ie=g.low>>>16,Ne=g.low&65535,Re=0,ke=0,we=0,fe=0;return fe+=G+Ne,we+=fe>>>16,fe&=65535,we+=J+Ie,ke+=we>>>16,we&=65535,ke+=I+Oe,Re+=ke>>>16,ke&=65535,Re+=v+le,Re&=65535,l(we<<16|fe,Re<<16|ke,this.unsigned)},_.subtract=function(g){return n(g)||(g=f(g)),this.add(g.neg())},_.sub=_.subtract,_.multiply=function(g){if(this.isZero())return this;if(n(g)||(g=f(g)),e){var v=e.mul(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}if(g.isZero())return this.unsigned?y:A;if(this.eq($))return g.isOdd()?$:A;if(g.eq($))return this.isOdd()?$:A;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(b)&&g.lt(b))return c(this.toNumber()*g.toNumber(),this.unsigned);var I=this.high>>>16,J=this.high&65535,G=this.low>>>16,le=this.low&65535,Oe=g.high>>>16,Ie=g.high&65535,Ne=g.low>>>16,Re=g.low&65535,ke=0,we=0,fe=0,ye=0;return ye+=le*Re,fe+=ye>>>16,ye&=65535,fe+=G*Re,we+=fe>>>16,fe&=65535,fe+=le*Ne,we+=fe>>>16,fe&=65535,we+=J*Re,ke+=we>>>16,we&=65535,we+=G*Ne,ke+=we>>>16,we&=65535,we+=le*Ie,ke+=we>>>16,we&=65535,ke+=I*Re+J*Ne+G*Ie+le*Oe,ke&=65535,l(fe<<16|ye,ke<<16|we,this.unsigned)},_.mul=_.multiply,_.divide=function(g){if(n(g)||(g=f(g)),g.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&g.low===-1&&g.high===-1)return this;var v=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?y:A;var I,J,G;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return C;G=y}else{if(this.eq($)){if(g.eq(x)||g.eq(O))return $;if(g.eq($))return x;var le=this.shr(1);return I=le.div(g).shl(1),I.eq(A)?g.isNegative()?x:O:(J=this.sub(g.mul(I)),G=I.add(J.div(g)),G)}else if(g.eq($))return this.unsigned?y:A;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();G=A}for(J=this;J.gte(g);){I=Math.max(1,Math.floor(J.toNumber()/g.toNumber()));for(var Oe=Math.ceil(Math.log(I)/Math.LN2),Ie=Oe<=48?1:u(2,Oe-48),Ne=c(I),Re=Ne.mul(g);Re.isNegative()||Re.gt(J);)I-=Ie,Ne=c(I,this.unsigned),Re=Ne.mul(g);Ne.isZero()&&(Ne=x),G=G.add(Ne),J=J.sub(Re)}return G},_.div=_.divide,_.modulo=function(g){if(n(g)||(g=f(g)),e){var v=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}return this.sub(this.div(g).mul(g))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return l(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(g){return n(g)||(g=f(g)),l(this.low&g.low,this.high&g.high,this.unsigned)},_.or=function(g){return n(g)||(g=f(g)),l(this.low|g.low,this.high|g.high,this.unsigned)},_.xor=function(g){return n(g)||(g=f(g)),l(this.low^g.low,this.high^g.high,this.unsigned)},_.shiftLeft=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):l(0,this.low<<g-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):l(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>>g,this.unsigned):g===32?l(this.high,0,this.unsigned):l(this.high>>>g-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(g){var v;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(v=32-g,l(this.low<<g|this.high>>>v,this.high<<g|this.low>>>v,this.unsigned)):(g-=32,v=32-g,l(this.high<<g|this.low>>>v,this.low<<g|this.high>>>v,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(g){var v;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(v=32-g,l(this.high<<v|this.low>>>g,this.low<<v|this.high>>>g,this.unsigned)):(g-=32,v=32-g,l(this.low<<v|this.high>>>g,this.high<<v|this.low>>>g,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},_.toBytes=function(g){return g?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var g=this.high,v=this.low;return[v&255,v>>>8&255,v>>>16&255,v>>>24,g&255,g>>>8&255,g>>>16&255,g>>>24]},_.toBytesBE=function(){var g=this.high,v=this.low;return[g>>>24,g>>>16&255,g>>>8&255,g&255,v>>>24,v>>>16&255,v>>>8&255,v&255]},r.fromBytes=function(g,v,I){return I?r.fromBytesLE(g,v):r.fromBytesBE(g,v)},r.fromBytesLE=function(g,v){return new r(g[0]|g[1]<<8|g[2]<<16|g[3]<<24,g[4]|g[5]<<8|g[6]<<16|g[7]<<24,v)},r.fromBytesBE=function(g,v){return new r(g[4]<<24|g[5]<<16|g[6]<<8|g[7],g[0]<<24|g[1]<<16|g[2]<<8|g[3],v)},typeof BigInt=="function"&&(r.fromBigInt=function(g,v){var I=Number(BigInt.asIntN(32,g)),J=Number(BigInt.asIntN(32,g>>BigInt(32)));return l(I,J,v)},r.fromValue=function(g,v){return typeof g=="bigint"?r.fromBigInt(g,v):f(g,v)},_.toBigInt=function(){var g=BigInt(this.low>>>0),v=BigInt(this.unsigned?this.high>>>0:this.high);return v<<BigInt(32)|g});var ee=t.default=r})});var gi=T(_N=>{"use strict";var be=_N;be.asPromise=fN();be.base64=_8();be.EventEmitter=S8();be.float=x8();be.inquire=I8();be.utf8=P8();be.pool=N8();be.LongBits=M8();function D8(t){return t==="__proto__"||t==="prototype"||t==="constructor"}be.isUnsafeProperty=D8;be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_N;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};be.Buffer=(function(){try{var t=be.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||(function(){try{var t=gN();return t&&t.isLong?t:null}catch{return null}})();be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function L8(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var o=Object.keys(i),s=0;s<o.length;++s)!D8(o[s])&&(t[o[s]]===void 0||!e)&&(t[o[s]]=i[o[s]])}return t}be.merge=L8;be.nestingLimit=32;be.recursionLimit=100;be.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};be.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function $8(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&L8(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}be.newError=$8;be.ProtocolError=$8("ProtocolError");be.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(r[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};be.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};be._configure=function(){var t=be.Buffer;if(!t){be._Buffer_from=be._Buffer_allocUnsafe=null;return}be._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},be._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var DT=T((Jat,j8)=>{"use strict";j8.exports=Ze;var Gn=gi(),yN,MT=Gn.LongBits,U8=Gn.base64,F8=Gn.utf8;function Eg(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function EN(){}function kAe(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ze(){this.len=0,this.head=new Eg(EN,0,0),this.tail=this.head,this.states=null}var B8=function(){return Gn.Buffer?function(){return(Ze.create=function(){return new yN})()}:function(){return new Ze}};Ze.create=B8();Ze.alloc=function(e){return new Gn.Array(e)};Gn.Array!==Array&&(Ze.alloc=Gn.pool(Ze.alloc,Gn.Array.prototype.subarray));Ze.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Eg(e,r,n),this.len+=r,this};function vN(t,e,r){e[r]=t&255}function MAe(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function TN(t,e){this.len=t,this.next=void 0,this.val=e}TN.prototype=Object.create(Eg.prototype);TN.prototype.fn=MAe;Ze.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new TN((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ze.prototype.int32=function(e){return(e|=0)<0?this._push(bN,10,MT.fromNumber(e)):this.uint32(e)};Ze.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function bN(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}Ze.prototype.uint64=function(e){var r=MT.from(e);return this._push(bN,r.length(),r)};Ze.prototype.int64=Ze.prototype.uint64;Ze.prototype.sint64=function(e){var r=MT.from(e).zzEncode();return this._push(bN,r.length(),r)};Ze.prototype.bool=function(e){return this._push(vN,1,e?1:0)};function SN(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ze.prototype.fixed32=function(e){return this._push(SN,4,e>>>0)};Ze.prototype.sfixed32=Ze.prototype.fixed32;Ze.prototype.fixed64=function(e){var r=MT.from(e);return this._push(SN,4,r.lo)._push(SN,4,r.hi)};Ze.prototype.sfixed64=Ze.prototype.fixed64;Ze.prototype.float=function(e){return this._push(Gn.float.writeFloatLE,4,e)};Ze.prototype.double=function(e){return this._push(Gn.float.writeDoubleLE,8,e)};var DAe=Gn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};Ze.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(vN,1,0);if(Gn.isString(e)){var n=Ze.alloc(r=U8.length(e));U8.decode(e,n,0),e=n}return this.uint32(r)._push(DAe,r,e)};Ze.prototype.string=function(e){var r=F8.length(e);return r?this.uint32(r)._push(F8.write,r,e):this._push(vN,1,0)};Ze.prototype.fork=function(){return this.states=new kAe(this),this.head=this.tail=new Eg(EN,0,0),this.len=0,this};Ze.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Eg(EN,0,0),this.len=0),this};Ze.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Ze.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Ze._configure=function(t){yN=t,Ze.create=B8(),yN._configure()}});var q8=T((Xat,G8)=>{"use strict";G8.exports=eo;var z8=DT();(eo.prototype=Object.create(z8.prototype)).constructor=eo;var ma=gi();function eo(){z8.call(this)}eo._configure=function(){eo.alloc=ma._Buffer_allocUnsafe,eo.writeBytesBuffer=ma.Buffer&&ma.Buffer.prototype instanceof Uint8Array&&ma.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};eo.prototype.bytes=function(e){ma.isString(e)&&(e=ma._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(eo.writeBytesBuffer,r,e),this};function LAe(t,e,r){t.length<40?ma.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}eo.prototype.string=function(e){var r=ma.Buffer.byteLength(e);return this.uint32(r),r&&this._push(LAe,r,e),this};eo._configure()});var $T=T((Qat,K8)=>{"use strict";K8.exports=yt;var qn=gi(),wN,W8=qn.LongBits,$Ae=qn.utf8;function _i(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function yt(t){this.buf=t,this.pos=0,this.len=t.length}var V8=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new yt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new yt(e);throw Error("illegal buffer")},Y8=function(){return qn.Buffer?function(r){return(yt.create=function(i){return qn.Buffer.isBuffer(i)?new wN(i):V8(i)})(r)}:V8};yt.create=Y8();yt.prototype._slice=qn.Array.prototype.subarray||qn.Array.prototype.slice;yt.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,_i(this,10);return e}})();yt.prototype.int32=function(){return this.uint32()|0};yt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function AN(){var t=new W8(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw _i(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw _i(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}yt.prototype.bool=function(){return this.uint32()!==0};function LT(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}yt.prototype.fixed32=function(){if(this.pos+4>this.len)throw _i(this,4);return LT(this.buf,this.pos+=4)};yt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _i(this,4);return LT(this.buf,this.pos+=4)|0};function H8(){if(this.pos+8>this.len)throw _i(this,8);return new W8(LT(this.buf,this.pos+=4),LT(this.buf,this.pos+=4))}yt.prototype.float=function(){if(this.pos+4>this.len)throw _i(this,4);var e=qn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};yt.prototype.double=function(){if(this.pos+8>this.len)throw _i(this,4);var e=qn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};yt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw _i(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=qn.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};yt.prototype.string=function(){var e=this.bytes();return $Ae.read(e,0,e.length)};yt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw _i(this,e);this.pos+=e}else do if(this.pos>=this.len)throw _i(this);while(this.buf[this.pos++]&128);return this};yt.recursionLimit=qn.recursionLimit;yt.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>yt.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};yt._configure=function(t){wN=t,yt.create=Y8(),wN._configure();var e=qn.Long?"toLong":"toNumber";qn.merge(yt.prototype,{int64:function(){return AN.call(this)[e](!1)},uint64:function(){return AN.call(this)[e](!0)},sint64:function(){return AN.call(this).zzDecode()[e](!1)},fixed64:function(){return H8.call(this)[e](!0)},sfixed64:function(){return H8.call(this)[e](!1)}})}});var Q8=T((ect,X8)=>{"use strict";X8.exports=dl;var J8=$T();(dl.prototype=Object.create(J8.prototype)).constructor=dl;var Z8=gi();function dl(t){J8.call(this,t)}dl._configure=function(){Z8.Buffer&&(dl.prototype._slice=Z8.Buffer.prototype.slice)};dl.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};dl._configure()});var tZ=T((tct,eZ)=>{"use strict";eZ.exports=vg;var xN=gi();(vg.prototype=Object.create(xN.EventEmitter.prototype)).constructor=vg;function vg(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");xN.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}vg.prototype.rpcCall=function t(e,r,n,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return xN.asPromise(t,s,e,r,n,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,e),o(c);if(l===null){s.end(!0);return}if(!(l instanceof n))try{l=n[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return s.emit("error",u,e),o(u)}return s.emit("data",l,e),o(null,l)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};vg.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var RN=T(rZ=>{"use strict";var UAe=rZ;UAe.Service=tZ()});var IN=T((nct,nZ)=>{"use strict";nZ.exports={}});var sZ=T(oZ=>{"use strict";var Qr=oZ;Qr.build="minimal";Qr.Writer=DT();Qr.BufferWriter=q8();Qr.Reader=$T();Qr.BufferReader=Q8();Qr.util=gi();Qr.rpc=RN();Qr.roots=IN();Qr.configure=iZ;function iZ(){Qr.util._configure(),Qr.Writer._configure(Qr.BufferWriter),Qr.Reader._configure(Qr.BufferReader)}iZ()});var cZ=T((oct,aZ)=>{"use strict";aZ.exports=CN;var FAe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function CN(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(o){if(typeof o!="string"){var s=i();if(CN.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=o[a[u++]];return c[u]=s,Function.apply(null,c).apply(null,l)}return Function(s)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,o=o.replace(/%([%dfijs])/g,function(h,m){var S=d[f++];switch(m){case"d":case"f":return String(Number(S));case"i":return String(Math.floor(S));case"j":return JSON.stringify(S);case"s":return String(S)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(o),n}function i(o){return"function "+BAe(o||e)+"("+(t&&t.join(",")||"")+`){
7
+ `))||"no stack trace available"}var iN=class{constructor(e,r,n={}){var i,o;if(n=Object.assign({},n),this[Pd]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[Od]=(o=n.interceptor_providers)!==null&&o!==void 0?o:[],delete n.interceptor_providers,this[Pd].length>0&&this[Od].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Jo]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[hi]=n.channelOverride;else if(n.channelFactoryOverride){let s=n.channelFactoryOverride;delete n.channelFactoryOverride,this[hi]=s(e,r,n)}else this[hi]=new Cbe.ChannelImplementation(e,r,n)}close(){this[hi].close()}getChannel(){return this[hi]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let o;try{o=this[hi].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(o===Pbe.ConnectivityState.READY)r();else try{this[hi].watchConnectivityState(o,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(nN(e))return{metadata:new Cd.Metadata,options:{},callback:e};if(nN(r))return e instanceof Cd.Metadata?{metadata:e,options:{},callback:r}:{metadata:new Cd.Metadata,options:e,callback:r};if(!(e instanceof Cd.Metadata&&r instanceof Object&&nN(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,o,s,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(o,s,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new Qi.ClientUnaryCallImpl,channel:this[hi],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Jo]&&(f=this[Jo](f));let p=f.call,h={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,wT.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let S=null,E=!1,b=new Error;return m.start(f.metadata,{onReceiveMetadata:A=>{p.emit("metadata",A)},onReceiveMessage(A){S!==null&&m.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),S=A},onReceiveStatus(A){if(!E){if(E=!0,A.code===pa.Status.OK)if(S===null){let y=Nd(b);f.callback((0,Qi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:A.metadata},y))}else f.callback(null,S);else{let y=Nd(b);f.callback((0,Qi.callErrorFromStatus)(A,y))}b=null,p.emit("status",A)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,o,s),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new Qi.ClientWritableStreamImpl(r),channel:this[hi],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Jo]&&(d=this[Jo](d));let f=d.call,p={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,S=!1,E=new Error;return h.start(d.metadata,{onReceiveMetadata:b=>{f.emit("metadata",b)},onReceiveMessage(b){m!==null&&h.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),m=b,h.startRead()},onReceiveStatus(b){if(!S){if(S=!0,b.code===pa.Status.OK)if(m===null){let A=Nd(E);d.callback((0,Qi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:b.metadata},A))}else d.callback(null,m);else{let A=Nd(E);d.callback((0,Qi.callErrorFromStatus)(b,A))}E=null,f.emit("status",b)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof Cd.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new Cd.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkMetadataAndOptions(o,s),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new Qi.ClientReadableStreamImpl(n),channel:this[hi],methodDefinition:u,callOptions:l.options};this[Jo]&&(d=this[Jo](d));let f=d.call,p={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,S=new Error;return h.start(d.metadata,{onReceiveMetadata(E){f.emit("metadata",E)},onReceiveMessage(E){f.push(E)},onReceiveStatus(E){if(!m){if(m=!0,f.push(null),E.code!==pa.Status.OK){let b=Nd(S);f.emit("error",(0,Qi.callErrorFromStatus)(E,b))}S=null,f.emit("status",E)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,o){var s,a;let c=this.checkMetadataAndOptions(i,o),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new Qi.ClientDuplexStreamImpl(r,n),channel:this[hi],methodDefinition:l,callOptions:c.options};this[Jo]&&(u=this[Jo](u));let d=u.call,f={clientInterceptors:this[Pd],clientInterceptorProviders:this[Od],callInterceptors:(s=u.callOptions.interceptors)!==null&&s!==void 0?s:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,wT.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(S){d.emit("metadata",S)},onReceiveMessage(S){d.push(S)},onReceiveStatus(S){if(!h){if(h=!0,d.push(null),S.code!==pa.Status.OK){let E=Nd(m);d.emit("error",(0,Qi.callErrorFromStatus)(S,E))}m=null,d.emit("status",S)}}}),d}};xT.Client=iN});var IT=T(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.makeClientConstructor=jK;RT.loadPackageDefinition=Mbe;var _g=oN(),Obe={unary:_g.Client.prototype.makeUnaryRequest,server_stream:_g.Client.prototype.makeServerStreamRequest,client_stream:_g.Client.prototype.makeClientStreamRequest,bidi:_g.Client.prototype.makeBidiStreamRequest};function aN(t){return["__proto__","prototype","constructor"].includes(t)}function jK(t,e,r){r||(r={});class n extends _g.Client{}return Object.keys(t).forEach(i=>{if(aN(i))return;let o=t[i],s;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");o.requestStream?o.responseStream?s="bidi":s="client_stream":o.responseStream?s="server_stream":s="unary";let a=o.requestSerialize,c=o.responseDeserialize,l=Nbe(Obe[s],o.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],o),o.originalName&&!aN(o.originalName)&&(n.prototype[o.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function Nbe(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function kbe(t){return"format"in t}function Mbe(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>aN(a)))continue;let o=i[i.length-1],s=e;for(let a of i.slice(0,-1))s[a]||(s[a]={}),s=s[a];kbe(n)?s[o]=n:s[o]=jK(n,o,{})}return e}});var f8=T((Bat,d8)=>{"use strict";var Dbe=1/0,Lbe="[object Symbol]",$be=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ube=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,PT="\\ud800-\\udfff",KK="\\u0300-\\u036f\\ufe20-\\ufe23",ZK="\\u20d0-\\u20f0",JK="\\u2700-\\u27bf",XK="a-z\\xdf-\\xf6\\xf8-\\xff",Fbe="\\xac\\xb1\\xd7\\xf7",Bbe="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jbe="\\u2000-\\u206f",zbe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",QK="A-Z\\xc0-\\xd6\\xd8-\\xde",e8="\\ufe0e\\ufe0f",t8=Fbe+Bbe+jbe+zbe,lN="['\u2019]",Gbe="["+PT+"]",zK="["+t8+"]",CT="["+KK+ZK+"]",r8="\\d+",qbe="["+JK+"]",n8="["+XK+"]",i8="[^"+PT+t8+r8+JK+XK+QK+"]",cN="\\ud83c[\\udffb-\\udfff]",Vbe="(?:"+CT+"|"+cN+")",o8="[^"+PT+"]",uN="(?:\\ud83c[\\udde6-\\uddff]){2}",dN="[\\ud800-\\udbff][\\udc00-\\udfff]",kd="["+QK+"]",s8="\\u200d",GK="(?:"+n8+"|"+i8+")",Hbe="(?:"+kd+"|"+i8+")",qK="(?:"+lN+"(?:d|ll|m|re|s|t|ve))?",VK="(?:"+lN+"(?:D|LL|M|RE|S|T|VE))?",a8=Vbe+"?",c8="["+e8+"]?",Wbe="(?:"+s8+"(?:"+[o8,uN,dN].join("|")+")"+c8+a8+")*",l8=c8+a8+Wbe,Ybe="(?:"+[qbe,uN,dN].join("|")+")"+l8,Kbe="(?:"+[o8+CT+"?",CT,uN,dN,Gbe].join("|")+")",Zbe=RegExp(lN,"g"),Jbe=RegExp(CT,"g"),Xbe=RegExp(cN+"(?="+cN+")|"+Kbe+l8,"g"),Qbe=RegExp([kd+"?"+n8+"+"+qK+"(?="+[zK,kd,"$"].join("|")+")",Hbe+"+"+VK+"(?="+[zK,kd+GK,"$"].join("|")+")",kd+"?"+GK+"+"+qK,kd+"+"+VK,r8,Ybe].join("|"),"g"),eAe=RegExp("["+s8+PT+KK+ZK+e8+"]"),tAe=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rAe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},nAe=typeof global=="object"&&global&&global.Object===Object&&global,iAe=typeof self=="object"&&self&&self.Object===Object&&self,oAe=nAe||iAe||Function("return this")();function sAe(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function aAe(t){return t.split("")}function cAe(t){return t.match($be)||[]}function lAe(t){return function(e){return t?.[e]}}var uAe=lAe(rAe);function u8(t){return eAe.test(t)}function dAe(t){return tAe.test(t)}function fAe(t){return u8(t)?pAe(t):aAe(t)}function pAe(t){return t.match(Xbe)||[]}function hAe(t){return t.match(Qbe)||[]}var mAe=Object.prototype,gAe=mAe.toString,HK=oAe.Symbol,WK=HK?HK.prototype:void 0,YK=WK?WK.toString:void 0;function _Ae(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function yAe(t){if(typeof t=="string")return t;if(bAe(t))return YK?YK.call(t):"";var e=t+"";return e=="0"&&1/t==-Dbe?"-0":e}function SAe(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:_Ae(t,e,r)}function EAe(t){return function(e){e=OT(e);var r=u8(e)?fAe(e):void 0,n=r?r[0]:e.charAt(0),i=r?SAe(r,1).join(""):e.slice(1);return n[t]()+i}}function vAe(t){return function(e){return sAe(IAe(xAe(e).replace(Zbe,"")),t,"")}}function TAe(t){return!!t&&typeof t=="object"}function bAe(t){return typeof t=="symbol"||TAe(t)&&gAe.call(t)==Lbe}function OT(t){return t==null?"":yAe(t)}var AAe=vAe(function(t,e,r){return e=e.toLowerCase(),t+(r?wAe(e):e)});function wAe(t){return RAe(OT(t).toLowerCase())}function xAe(t){return t=OT(t),t&&t.replace(Ube,uAe).replace(Jbe,"")}var RAe=EAe("toUpperCase");function IAe(t,e,r){return t=OT(t),e=r?void 0:e,e===void 0?dAe(t)?hAe(t):cAe(t):t.match(e)||[]}d8.exports=AAe});var fN=T((jat,p8)=>{"use strict";p8.exports=CAe;function CAe(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(o)if(o=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){o&&(o=!1,c(l))}})}});var _8=T(g8=>{"use strict";var NT=g8;NT.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Md=new Array(64),m8=new Array(123);for(mi=0;mi<64;)m8[Md[mi]=mi<26?mi+65:mi<52?mi+71:mi<62?mi-4:mi-59|43]=mi++;var mi;NT.encode=function(e,r,n){for(var i=null,o=[],s=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:o[s++]=Md[l>>2],c=(l&3)<<4,a=1;break;case 1:o[s++]=Md[c|l>>4],c=(l&15)<<2,a=2;break;case 2:o[s++]=Md[c|l>>6],o[s++]=Md[l&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Md[c],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var h8="invalid encoding";NT.decode=function(e,r,n){for(var i=n,o=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&o>1)break;if((c=m8[c])===void 0)throw Error(h8);switch(o){case 0:s=c,o=1;break;case 1:r[n++]=s<<2|(c&48)>>4,s=c,o=2;break;case 2:r[n++]=(s&15)<<4|(c&60)>>2,s=c,o=3;break;case 3:r[n++]=(s&3)<<6|c,o=0;break}}if(o===1)throw Error(h8);return n-i};NT.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var S8=T((Gat,y8)=>{"use strict";y8.exports=kT;function kT(){this._listeners=Object.create(null)}kT.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};kT.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};kT.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var x8=T((qat,w8)=>{"use strict";w8.exports=E8(E8);function E8(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function o(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?s:a,t.readFloatBE=n?a:s})():(function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,o,s)}}t.writeFloatLE=e.bind(null,v8),t.writeFloatBE=e.bind(null,T8);function r(n,i,o){var s=n(i,o),a=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,b8),t.readFloatBE=r.bind(null,A8)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function o(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?s:a,t.readDoubleBE=n?a:s})():(function(){function e(n,i,o,s,a,c){var l=s<0?1:0;if(l&&(s=-s),s===0)n(0,a,c+i),n(1/s>0?0:2147483648,a,c+o);else if(isNaN(s))n(0,a,c+i),n(2146959360,a,c+o);else if(s>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+o);else{var u;if(s<22250738585072014e-324)u=s/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+o);else{var d=Math.floor(Math.log(s)/Math.LN2);d===1024&&(d=1023),u=s*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+o)}}}t.writeDoubleLE=e.bind(null,v8,0,4),t.writeDoubleBE=e.bind(null,T8,4,0);function r(n,i,o,s,a){var c=n(s,a+i),l=n(s,a+o),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,b8,0,4),t.readDoubleBE=r.bind(null,A8,4,0)})(),t}function v8(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function T8(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function b8(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function A8(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var I8=T((Vat,R8)=>{"use strict";R8.exports=PAe;function PAe(t){try{if(typeof Q!="function")return null;var e=Q(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var P8=T(C8=>{"use strict";var hN=C8,pN="\uFFFD";hN.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};hN.read=function(e,r,n){if(n-r<1)return"";for(var i="",o=r;o<n;){var s=e[o++];if(s<=127)i+=String.fromCharCode(s);else if(s>=192&&s<224){var a=(s&31)<<6|e[o++]&63;i+=a>=128?String.fromCharCode(a):pN}else if(s>=224&&s<240){var c=(s&15)<<12|(e[o++]&63)<<6|e[o++]&63;i+=c>=2048?String.fromCharCode(c):pN}else if(s>=240){var l=(s&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;l<65536||l>1114111?i+=pN:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};hN.write=function(e,r,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128);return n-i}});var N8=T((Yat,O8)=>{"use strict";O8.exports=OAe;function OAe(t,e,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(c){if(c<1||c>i)return t(c);s+c>n&&(o=t(n),s=0);var l=e.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}});var M8=T((Kat,k8)=>{"use strict";k8.exports=Zt;var yg=gi();function Zt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ul=Zt.zero=new Zt(0,0);ul.toNumber=function(){return 0};ul.zzEncode=ul.zzDecode=function(){return this};ul.length=function(){return 1};var NAe=Zt.zeroHash="\0\0\0\0\0\0\0\0";Zt.fromNumber=function(e){if(e===0)return ul;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Zt(n,i)};Zt.from=function(e){if(typeof e=="number")return Zt.fromNumber(e);if(yg.isString(e))if(yg.Long)e=yg.Long.fromString(e);else return Zt.fromNumber(parseInt(e,10));return e.low||e.high?new Zt(e.low>>>0,e.high>>>0):ul};Zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Zt.prototype.toLong=function(e){return yg.Long?new yg.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ha=String.prototype.charCodeAt;Zt.fromHash=function(e){return e===NAe?ul:new Zt((ha.call(e,0)|ha.call(e,1)<<8|ha.call(e,2)<<16|ha.call(e,3)<<24)>>>0,(ha.call(e,4)|ha.call(e,5)<<8|ha.call(e,6)<<16|ha.call(e,7)<<24)>>>0)};Zt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Zt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Zt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Zt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var gN=T((Sg,mN)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof Sg=="object"?(e(Sg),typeof mN=="object"&&(mN.exports=r(Sg))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Sg,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(k,g,v){this.low=k|0,this.high=g|0,this.unsigned=!!v}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(k){return(k&&k.__isLong__)===!0}function i(k){var g=Math.clz32(k&-k);return k?31-g:g}r.isLong=n;var o={},s={};function a(k,g){var v,I,J;return g?(k>>>=0,(J=0<=k&&k<256)&&(I=s[k],I)?I:(v=l(k,0,!0),J&&(s[k]=v),v)):(k|=0,(J=-128<=k&&k<128)&&(I=o[k],I)?I:(v=l(k,k<0?-1:0,!1),J&&(o[k]=v),v))}r.fromInt=a;function c(k,g){if(isNaN(k))return g?y:A;if(g){if(k<0)return y;if(k>=S)return R}else{if(k<=-E)return $;if(k+1>=E)return N}return k<0?c(-k,g).neg():l(k%m|0,k/m|0,g)}r.fromNumber=c;function l(k,g,v){return new r(k,g,v)}r.fromBits=l;var u=Math.pow;function d(k,g,v){if(k.length===0)throw Error("empty string");if(typeof g=="number"?(v=g,g=!1):g=!!g,k==="NaN"||k==="Infinity"||k==="+Infinity"||k==="-Infinity")return g?y:A;if(v=v||10,v<2||36<v)throw RangeError("radix");var I;if((I=k.indexOf("-"))>0)throw Error("interior hyphen");if(I===0)return d(k.substring(1),g,v).neg();for(var J=c(u(v,8)),q=A,le=0;le<k.length;le+=8){var Oe=Math.min(8,k.length-le),Ie=parseInt(k.substring(le,le+Oe),v);if(Oe<8){var Ne=c(u(v,Oe));q=q.mul(Ne).add(c(Ie))}else q=q.mul(J),q=q.add(c(Ie))}return q.unsigned=g,q}r.fromString=d;function f(k,g){return typeof k=="number"?c(k,g):typeof k=="string"?d(k,g):l(k.low,k.high,typeof g=="boolean"?g:k.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,S=m*m,E=S/2,b=a(h),A=a(0);r.ZERO=A;var y=a(0,!0);r.UZERO=y;var x=a(1);r.ONE=x;var C=a(1,!0);r.UONE=C;var O=a(-1);r.NEG_ONE=O;var N=l(-1,2147483647,!1);r.MAX_VALUE=N;var R=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=R;var $=l(0,-2147483648,!1);r.MIN_VALUE=$;var _=r.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},_.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq($)){var v=c(g),I=this.div(v),J=I.mul(v).sub(this);return I.toString(g)+J.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var q=c(u(g,6),this.unsigned),le=this,Oe="";;){var Ie=le.div(q),Ne=le.sub(Ie.mul(q)).toInt()>>>0,Re=Ne.toString(g);if(le=Ie,le.isZero())return Re+Oe;for(;Re.length<6;)Re="0"+Re;Oe=""+Re+Oe}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq($)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,v=31;v>0&&(g&1<<v)==0;v--);return this.high!=0?v+33:v+1},_.isSafeInteger=function(){var g=this.high>>21;return g?this.unsigned?!1:g===-1&&!(this.low===0&&this.high===-2097152):!0},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(g){return n(g)||(g=f(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},_.eq=_.equals,_.notEquals=function(g){return!this.eq(g)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(g){return this.comp(g)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(g){return this.comp(g)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(g){return this.comp(g)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(g){return this.comp(g)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(g){if(n(g)||(g=f(g)),this.eq(g))return 0;var v=this.isNegative(),I=g.isNegative();return v&&!I?-1:!v&&I?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq($)?$:this.not().add(x)},_.neg=_.negate,_.add=function(g){n(g)||(g=f(g));var v=this.high>>>16,I=this.high&65535,J=this.low>>>16,q=this.low&65535,le=g.high>>>16,Oe=g.high&65535,Ie=g.low>>>16,Ne=g.low&65535,Re=0,ke=0,we=0,fe=0;return fe+=q+Ne,we+=fe>>>16,fe&=65535,we+=J+Ie,ke+=we>>>16,we&=65535,ke+=I+Oe,Re+=ke>>>16,ke&=65535,Re+=v+le,Re&=65535,l(we<<16|fe,Re<<16|ke,this.unsigned)},_.subtract=function(g){return n(g)||(g=f(g)),this.add(g.neg())},_.sub=_.subtract,_.multiply=function(g){if(this.isZero())return this;if(n(g)||(g=f(g)),e){var v=e.mul(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}if(g.isZero())return this.unsigned?y:A;if(this.eq($))return g.isOdd()?$:A;if(g.eq($))return this.isOdd()?$:A;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(b)&&g.lt(b))return c(this.toNumber()*g.toNumber(),this.unsigned);var I=this.high>>>16,J=this.high&65535,q=this.low>>>16,le=this.low&65535,Oe=g.high>>>16,Ie=g.high&65535,Ne=g.low>>>16,Re=g.low&65535,ke=0,we=0,fe=0,ye=0;return ye+=le*Re,fe+=ye>>>16,ye&=65535,fe+=q*Re,we+=fe>>>16,fe&=65535,fe+=le*Ne,we+=fe>>>16,fe&=65535,we+=J*Re,ke+=we>>>16,we&=65535,we+=q*Ne,ke+=we>>>16,we&=65535,we+=le*Ie,ke+=we>>>16,we&=65535,ke+=I*Re+J*Ne+q*Ie+le*Oe,ke&=65535,l(fe<<16|ye,ke<<16|we,this.unsigned)},_.mul=_.multiply,_.divide=function(g){if(n(g)||(g=f(g)),g.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&g.low===-1&&g.high===-1)return this;var v=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?y:A;var I,J,q;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return C;q=y}else{if(this.eq($)){if(g.eq(x)||g.eq(O))return $;if(g.eq($))return x;var le=this.shr(1);return I=le.div(g).shl(1),I.eq(A)?g.isNegative()?x:O:(J=this.sub(g.mul(I)),q=I.add(J.div(g)),q)}else if(g.eq($))return this.unsigned?y:A;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();q=A}for(J=this;J.gte(g);){I=Math.max(1,Math.floor(J.toNumber()/g.toNumber()));for(var Oe=Math.ceil(Math.log(I)/Math.LN2),Ie=Oe<=48?1:u(2,Oe-48),Ne=c(I),Re=Ne.mul(g);Re.isNegative()||Re.gt(J);)I-=Ie,Ne=c(I,this.unsigned),Re=Ne.mul(g);Ne.isZero()&&(Ne=x),q=q.add(Ne),J=J.sub(Re)}return q},_.div=_.divide,_.modulo=function(g){if(n(g)||(g=f(g)),e){var v=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,g.low,g.high);return l(v,e.get_high(),this.unsigned)}return this.sub(this.div(g).mul(g))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return l(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(g){return n(g)||(g=f(g)),l(this.low&g.low,this.high&g.high,this.unsigned)},_.or=function(g){return n(g)||(g=f(g)),l(this.low|g.low,this.high|g.high,this.unsigned)},_.xor=function(g){return n(g)||(g=f(g)),l(this.low^g.low,this.high^g.high,this.unsigned)},_.shiftLeft=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):l(0,this.low<<g-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):l(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>>g,this.unsigned):g===32?l(this.high,0,this.unsigned):l(this.high>>>g-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(g){var v;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(v=32-g,l(this.low<<g|this.high>>>v,this.high<<g|this.low>>>v,this.unsigned)):(g-=32,v=32-g,l(this.high<<g|this.low>>>v,this.low<<g|this.high>>>v,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(g){var v;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(v=32-g,l(this.high<<v|this.low>>>g,this.low<<v|this.high>>>g,this.unsigned)):(g-=32,v=32-g,l(this.low<<v|this.high>>>g,this.high<<v|this.low>>>g,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},_.toBytes=function(g){return g?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var g=this.high,v=this.low;return[v&255,v>>>8&255,v>>>16&255,v>>>24,g&255,g>>>8&255,g>>>16&255,g>>>24]},_.toBytesBE=function(){var g=this.high,v=this.low;return[g>>>24,g>>>16&255,g>>>8&255,g&255,v>>>24,v>>>16&255,v>>>8&255,v&255]},r.fromBytes=function(g,v,I){return I?r.fromBytesLE(g,v):r.fromBytesBE(g,v)},r.fromBytesLE=function(g,v){return new r(g[0]|g[1]<<8|g[2]<<16|g[3]<<24,g[4]|g[5]<<8|g[6]<<16|g[7]<<24,v)},r.fromBytesBE=function(g,v){return new r(g[4]<<24|g[5]<<16|g[6]<<8|g[7],g[0]<<24|g[1]<<16|g[2]<<8|g[3],v)},typeof BigInt=="function"&&(r.fromBigInt=function(g,v){var I=Number(BigInt.asIntN(32,g)),J=Number(BigInt.asIntN(32,g>>BigInt(32)));return l(I,J,v)},r.fromValue=function(g,v){return typeof g=="bigint"?r.fromBigInt(g,v):f(g,v)},_.toBigInt=function(){var g=BigInt(this.low>>>0),v=BigInt(this.unsigned?this.high>>>0:this.high);return v<<BigInt(32)|g});var ee=t.default=r})});var gi=T(_N=>{"use strict";var be=_N;be.asPromise=fN();be.base64=_8();be.EventEmitter=S8();be.float=x8();be.inquire=I8();be.utf8=P8();be.pool=N8();be.LongBits=M8();function D8(t){return t==="__proto__"||t==="prototype"||t==="constructor"}be.isUnsafeProperty=D8;be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_N;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};be.Buffer=(function(){try{var t=be.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||(function(){try{var t=gN();return t&&t.isLong?t:null}catch{return null}})();be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function L8(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var o=Object.keys(i),s=0;s<o.length;++s)!D8(o[s])&&(t[o[s]]===void 0||!e)&&(t[o[s]]=i[o[s]])}return t}be.merge=L8;be.nestingLimit=32;be.recursionLimit=100;be.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};be.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function $8(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&L8(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}be.newError=$8;be.ProtocolError=$8("ProtocolError");be.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(r[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};be.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};be._configure=function(){var t=be.Buffer;if(!t){be._Buffer_from=be._Buffer_allocUnsafe=null;return}be._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},be._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var DT=T((Jat,j8)=>{"use strict";j8.exports=Ze;var Gn=gi(),yN,MT=Gn.LongBits,U8=Gn.base64,F8=Gn.utf8;function Eg(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function EN(){}function kAe(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ze(){this.len=0,this.head=new Eg(EN,0,0),this.tail=this.head,this.states=null}var B8=function(){return Gn.Buffer?function(){return(Ze.create=function(){return new yN})()}:function(){return new Ze}};Ze.create=B8();Ze.alloc=function(e){return new Gn.Array(e)};Gn.Array!==Array&&(Ze.alloc=Gn.pool(Ze.alloc,Gn.Array.prototype.subarray));Ze.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Eg(e,r,n),this.len+=r,this};function vN(t,e,r){e[r]=t&255}function MAe(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function TN(t,e){this.len=t,this.next=void 0,this.val=e}TN.prototype=Object.create(Eg.prototype);TN.prototype.fn=MAe;Ze.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new TN((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ze.prototype.int32=function(e){return(e|=0)<0?this._push(bN,10,MT.fromNumber(e)):this.uint32(e)};Ze.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function bN(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}Ze.prototype.uint64=function(e){var r=MT.from(e);return this._push(bN,r.length(),r)};Ze.prototype.int64=Ze.prototype.uint64;Ze.prototype.sint64=function(e){var r=MT.from(e).zzEncode();return this._push(bN,r.length(),r)};Ze.prototype.bool=function(e){return this._push(vN,1,e?1:0)};function SN(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ze.prototype.fixed32=function(e){return this._push(SN,4,e>>>0)};Ze.prototype.sfixed32=Ze.prototype.fixed32;Ze.prototype.fixed64=function(e){var r=MT.from(e);return this._push(SN,4,r.lo)._push(SN,4,r.hi)};Ze.prototype.sfixed64=Ze.prototype.fixed64;Ze.prototype.float=function(e){return this._push(Gn.float.writeFloatLE,4,e)};Ze.prototype.double=function(e){return this._push(Gn.float.writeDoubleLE,8,e)};var DAe=Gn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};Ze.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(vN,1,0);if(Gn.isString(e)){var n=Ze.alloc(r=U8.length(e));U8.decode(e,n,0),e=n}return this.uint32(r)._push(DAe,r,e)};Ze.prototype.string=function(e){var r=F8.length(e);return r?this.uint32(r)._push(F8.write,r,e):this._push(vN,1,0)};Ze.prototype.fork=function(){return this.states=new kAe(this),this.head=this.tail=new Eg(EN,0,0),this.len=0,this};Ze.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Eg(EN,0,0),this.len=0),this};Ze.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Ze.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Ze._configure=function(t){yN=t,Ze.create=B8(),yN._configure()}});var q8=T((Xat,G8)=>{"use strict";G8.exports=eo;var z8=DT();(eo.prototype=Object.create(z8.prototype)).constructor=eo;var ma=gi();function eo(){z8.call(this)}eo._configure=function(){eo.alloc=ma._Buffer_allocUnsafe,eo.writeBytesBuffer=ma.Buffer&&ma.Buffer.prototype instanceof Uint8Array&&ma.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};eo.prototype.bytes=function(e){ma.isString(e)&&(e=ma._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(eo.writeBytesBuffer,r,e),this};function LAe(t,e,r){t.length<40?ma.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}eo.prototype.string=function(e){var r=ma.Buffer.byteLength(e);return this.uint32(r),r&&this._push(LAe,r,e),this};eo._configure()});var $T=T((Qat,K8)=>{"use strict";K8.exports=yt;var qn=gi(),wN,W8=qn.LongBits,$Ae=qn.utf8;function _i(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function yt(t){this.buf=t,this.pos=0,this.len=t.length}var V8=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new yt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new yt(e);throw Error("illegal buffer")},Y8=function(){return qn.Buffer?function(r){return(yt.create=function(i){return qn.Buffer.isBuffer(i)?new wN(i):V8(i)})(r)}:V8};yt.create=Y8();yt.prototype._slice=qn.Array.prototype.subarray||qn.Array.prototype.slice;yt.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,_i(this,10);return e}})();yt.prototype.int32=function(){return this.uint32()|0};yt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function AN(){var t=new W8(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw _i(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw _i(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}yt.prototype.bool=function(){return this.uint32()!==0};function LT(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}yt.prototype.fixed32=function(){if(this.pos+4>this.len)throw _i(this,4);return LT(this.buf,this.pos+=4)};yt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _i(this,4);return LT(this.buf,this.pos+=4)|0};function H8(){if(this.pos+8>this.len)throw _i(this,8);return new W8(LT(this.buf,this.pos+=4),LT(this.buf,this.pos+=4))}yt.prototype.float=function(){if(this.pos+4>this.len)throw _i(this,4);var e=qn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};yt.prototype.double=function(){if(this.pos+8>this.len)throw _i(this,4);var e=qn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};yt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw _i(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=qn.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};yt.prototype.string=function(){var e=this.bytes();return $Ae.read(e,0,e.length)};yt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw _i(this,e);this.pos+=e}else do if(this.pos>=this.len)throw _i(this);while(this.buf[this.pos++]&128);return this};yt.recursionLimit=qn.recursionLimit;yt.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>yt.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};yt._configure=function(t){wN=t,yt.create=Y8(),wN._configure();var e=qn.Long?"toLong":"toNumber";qn.merge(yt.prototype,{int64:function(){return AN.call(this)[e](!1)},uint64:function(){return AN.call(this)[e](!0)},sint64:function(){return AN.call(this).zzDecode()[e](!1)},fixed64:function(){return H8.call(this)[e](!0)},sfixed64:function(){return H8.call(this)[e](!1)}})}});var Q8=T((ect,X8)=>{"use strict";X8.exports=dl;var J8=$T();(dl.prototype=Object.create(J8.prototype)).constructor=dl;var Z8=gi();function dl(t){J8.call(this,t)}dl._configure=function(){Z8.Buffer&&(dl.prototype._slice=Z8.Buffer.prototype.slice)};dl.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};dl._configure()});var tZ=T((tct,eZ)=>{"use strict";eZ.exports=vg;var xN=gi();(vg.prototype=Object.create(xN.EventEmitter.prototype)).constructor=vg;function vg(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");xN.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}vg.prototype.rpcCall=function t(e,r,n,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return xN.asPromise(t,s,e,r,n,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,e),o(c);if(l===null){s.end(!0);return}if(!(l instanceof n))try{l=n[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return s.emit("error",u,e),o(u)}return s.emit("data",l,e),o(null,l)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};vg.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var RN=T(rZ=>{"use strict";var UAe=rZ;UAe.Service=tZ()});var IN=T((nct,nZ)=>{"use strict";nZ.exports={}});var sZ=T(oZ=>{"use strict";var Qr=oZ;Qr.build="minimal";Qr.Writer=DT();Qr.BufferWriter=q8();Qr.Reader=$T();Qr.BufferReader=Q8();Qr.util=gi();Qr.rpc=RN();Qr.roots=IN();Qr.configure=iZ;function iZ(){Qr.util._configure(),Qr.Writer._configure(Qr.BufferWriter),Qr.Reader._configure(Qr.BufferReader)}iZ()});var cZ=T((oct,aZ)=>{"use strict";aZ.exports=CN;var FAe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function CN(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(o){if(typeof o!="string"){var s=i();if(CN.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=o[a[u++]];return c[u]=s,Function.apply(null,c).apply(null,l)}return Function(s)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,o=o.replace(/%([%dfijs])/g,function(h,m){var S=d[f++];switch(m){case"d":case"f":return String(Number(S));case"i":return String(Math.floor(S));case"j":return JSON.stringify(S);case"s":return String(S)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(o),n}function i(o){return"function "+BAe(o||e)+"("+(t&&t.join(",")||"")+`){
8
8
  `+r.join(`
9
9
  `)+`
10
10
  }`}return n.toString=i,n}CN.verbose=!1;function BAe(t){return!t||(t=String(t).replace(/[^\w$]/g,""),!t)?"":(/^\d/.test(t)&&(t="_"+t),FAe.test(t)?t+"_":t)}});var uZ=T((sct,lZ)=>{"use strict";var Dd=null;try{Dd=Q("fs"),(!Dd||!Dd.readFile||!Dd.readFileSync)&&(Dd=null)}catch{}lZ.exports=Dd});var fZ=T((act,dZ)=>{"use strict";dZ.exports=Tg;var jAe=fN(),PN=uZ();function Tg(t,e,r){return typeof e=="function"?(r=e,e={}):e||(e={}),r?!e.xhr&&PN&&PN.readFile?PN.readFile(t,function(i,o){return i&&typeof XMLHttpRequest<"u"?Tg.xhr(t,e,r):i?r(i):r(null,e.binary?o:o.toString("utf8"))}):Tg.xhr(t,e,r):jAe(Tg,this,t,e)}Tg.xhr=function(e,r,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===4){if(i.status!==0&&i.status!==200)return n(Error("status "+i.status));if(r.binary){var s=i.response;if(!s){s=[];for(var a=0;a<i.responseText.length;++a)s.push(i.responseText.charCodeAt(a)&255)}return n(null,typeof Uint8Array<"u"?new Uint8Array(s):s)}return n(null,i.responseText)}},r.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}});var mZ=T(hZ=>{"use strict";var NN=hZ,pZ=NN.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},ON=NN.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var r=e.split("/"),n=pZ(e),i="";n&&(i=r.shift()+"/");for(var o=0;o<r.length;)r[o]===".."?o>0&&r[o-1]!==".."?r.splice(--o,2):n?r.splice(o,1):++o:r[o]==="."?r.splice(o,1):++o;return i+r.join("/")};NN.resolve=function(e,r,n){return n||(r=ON(r)),pZ(r)?r:(n||(e=ON(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?ON(e+"/"+r):r)}});var _Z=T(gZ=>{"use strict";var kN=gZ;kN.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;kN.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;kN.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/});var SZ=T((uct,yZ)=>{"use strict";var Ld=null;try{Ld=Q("fs"),(!Ld||!Ld.readFile||!Ld.readFileSync)&&(Ld=null)}catch{}yZ.exports=Ld});var Ud=T((dct,TZ)=>{"use strict";TZ.exports=He;var UT=_a();((He.prototype=Object.create(UT.prototype)).constructor=He).className="Namespace";var MN=ga(),pl=Jt(),zAe=ml(),fl,$d,hl;He.fromJSON=function(e,r,n){return n=pl.checkDepth(n),new He(e,r.options).addJSON(r.nested,n)};function EZ(t,e){if(t&&t.length){for(var r={},n=0;n<t.length;++n)r[t[n].name]=t[n].toJSON(e);return r}}He.arrayToJSON=EZ;He.isReservedId=function(e,r){if(e){for(var n=0;n<e.length;++n)if(typeof e[n]!="string"&&e[n][0]<=r&&e[n][1]>r)return!0}return!1};He.isReservedName=function(e,r){if(e){for(var n=0;n<e.length;++n)if(e[n]===r)return!0}return!1};function He(t,e){UT.call(this,t,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function vZ(t){t._nestedArray=null,t._lookupCache=Object.create(null);for(var e=t;e=e.parent;)e._lookupCache=Object.create(null);return t}Object.defineProperty(He.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=pl.toArray(this.nested))}});He.prototype.toJSON=function(e){return pl.toObject(["options",this.options,"nested",EZ(this.nestedArray,e)])};He.prototype.addJSON=function(e,r){r=pl.checkDepth(r);var n=this;if(e)for(var i=Object.keys(e),o=0,s;o<i.length;++o)s=e[i[o]],n.add((s.fields!==void 0?fl.fromJSON:s.values!==void 0?hl.fromJSON:s.methods!==void 0?$d.fromJSON:s.id!==void 0?MN.fromJSON:He.fromJSON)(i[o],s,r+1));return this};He.prototype.get=function(e){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};He.prototype.getEnum=function(e){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)&&this.nested[e]instanceof hl)return this.nested[e].values;throw Error("no such enum: "+e)};He.prototype.add=function(e){if(!(e instanceof MN&&e.extend!==void 0||e instanceof fl||e instanceof zAe||e instanceof hl||e instanceof $d||e instanceof He))throw TypeError("object must be a valid nested object");if(e.name==="__proto__")return this;if(!this.nested)this.nested={};else{var r=this.get(e.name);if(r)if(r instanceof He&&e instanceof He&&!(r instanceof fl||r instanceof $d)){for(var n=r.nestedArray,i=0;i<n.length;++i)e.add(n[i]);this.remove(r),this.nested||(this.nested={}),e.setOptions(r.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}this.nested[e.name]=e,this instanceof fl||this instanceof $d||this instanceof hl||this instanceof MN||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var o=this;o=o.parent;)o._needsRecursiveFeatureResolution=!0,o._needsRecursiveResolve=!0;return e.onAdd(this),vZ(this)};He.prototype.remove=function(e){if(!(e instanceof UT))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),vZ(this)};He.prototype.define=function(e,r){if(pl.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&e[0]==="")throw Error("path must be relative");if(e.length>pl.recursionLimit)throw Error("max depth exceeded");for(var n=this;e.length>0;){var i=e.shift();if(n.nested&&n.nested[i]){if(n=n.nested[i],!(n instanceof He))throw Error("path conflicts with non-namespace objects")}else n.add(n=new He(i))}return r&&n.addJSON(r),n};He.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,r=0;for(this.resolve();r<e.length;)e[r]instanceof He?e[r++].resolveAll():e[r++].resolve();return this._needsRecursiveResolve=!1,this};He.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,UT.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};He.prototype.lookup=function(e,r,n){if(typeof r=="boolean"?(n=r,r=void 0):r&&!Array.isArray(r)&&(r=[r]),pl.isString(e)&&e.length){if(e===".")return this.root;e=e.split(".")}else if(!e.length)return this;var i=e.join(".");if(e[0]==="")return this.root.lookup(e.slice(1),r);var o=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+i];if(o&&(!r||r.indexOf(o.constructor)>-1)||(o=this._lookupImpl(e,i),o&&(!r||r.indexOf(o.constructor)>-1)))return o;if(n)return null;for(var s=this;s.parent;){if(o=s.parent._lookupImpl(e,i),o&&(!r||r.indexOf(o.constructor)>-1))return o;s=s.parent}return null};He.prototype._lookupImpl=function(e,r){if(Object.prototype.hasOwnProperty.call(this._lookupCache,r))return this._lookupCache[r];var n=this.get(e[0]),i=null;if(n)e.length===1?i=n:n instanceof He&&(e=e.slice(1),i=n._lookupImpl(e,e.join(".")));else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof He&&(n=this._nestedArray[o]._lookupImpl(e,r))){i=n;break}return this._lookupCache[r]=i,i};He.prototype.lookupType=function(e){var r=this.lookup(e,[fl]);if(!r)throw Error("no such type: "+e);return r};He.prototype.lookupEnum=function(e){var r=this.lookup(e,[hl]);if(!r)throw Error("no such Enum '"+e+"' in "+this);return r};He.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[fl,hl]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r};He.prototype.lookupService=function(e){var r=this.lookup(e,[$d]);if(!r)throw Error("no such Service '"+e+"' in "+this);return r};He._configure=function(t,e,r){fl=t,$d=e,hl=r}});var FT=T((fct,bZ)=>{"use strict";bZ.exports=Xo;var DN=ga();((Xo.prototype=Object.create(DN.prototype)).constructor=Xo).className="MapField";var GAe=gl(),bg=Jt();function Xo(t,e,r,n,i,o){if(DN.call(this,t,e,n,void 0,void 0,i,o),!bg.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}Xo.fromJSON=function(e,r){return new Xo(e,r.id,r.keyType,r.type,r.options,r.comment)};Xo.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return bg.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};Xo.prototype.resolve=function(){if(this.resolved)return this;if(GAe.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return DN.prototype.resolve.call(this)};Xo.d=function(e,r,n){return typeof n=="function"?n=bg.decorateType(n).name:n&&typeof n=="object"&&(n=bg.decorateEnum(n).name),function(o,s){bg.decorateType(o.constructor).add(new Xo(s,e,r,n))}}});var BT=T((pct,AZ)=>{"use strict";AZ.exports=_l;var LN=_a();((_l.prototype=Object.create(LN.prototype)).constructor=_l).className="Method";var Fd=Jt();function _l(t,e,r,n,i,o,s,a,c){if(Fd.isObject(i)?(s=i,i=o=void 0):Fd.isObject(o)&&(s=o,o=void 0),!(e===void 0||Fd.isString(e)))throw TypeError("type must be a string");if(!Fd.isString(r))throw TypeError("requestType must be a string");if(!Fd.isString(n))throw TypeError("responseType must be a string");LN.call(this,t,s),this.type=e||"rpc",this.requestType=r,this.requestStream=i?!0:void 0,this.responseType=n,this.responseStream=o?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=c}_l.fromJSON=function(e,r){return new _l(e,r.type,r.requestType,r.responseType,r.requestStream,r.responseStream,r.options,r.comment,r.parsedOptions)};_l.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return Fd.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])};_l.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),LN.prototype.resolve.call(this))}});var jT=T((hct,xZ)=>{"use strict";xZ.exports=gn;var Qo=Ud();((gn.prototype=Object.create(Qo.prototype)).constructor=gn).className="Service";var $N=BT(),Bd=Jt(),qAe=RN(),VAe=Bd.patterns.reservedRe;function gn(t,e){Qo.call(this,t,e),this.methods={},this._methodsArray=null}gn.fromJSON=function(e,r,n){n=Bd.checkDepth(n);var i=new gn(e,r.options);if(r.methods)for(var o=Object.keys(r.methods),s=0;s<o.length;++s)i.add($N.fromJSON(o[s],r.methods[o[s]]));return r.nested&&i.addJSON(r.nested,n),r.edition&&(i._edition=r.edition),i.comment=r.comment,i._defaultEdition="proto3",i};gn.prototype.toJSON=function(e){var r=Qo.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return Bd.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"methods",Qo.arrayToJSON(this.methodsArray,e)||{},"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};Object.defineProperty(gn.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Bd.toArray(this.methods))}});function wZ(t){return t._methodsArray=null,t}gn.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.methods,e)?this.methods[e]:Qo.prototype.get.call(this,e)};gn.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Qo.prototype.resolve.call(this);for(var e=this.methodsArray,r=0;r<e.length;++r)e[r].resolve();return this};gn.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Qo.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};gn.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof $N?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,wZ(this)):Qo.prototype.add.call(this,e)};gn.prototype.remove=function(e){if(e instanceof $N){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,wZ(this)}return Qo.prototype.remove.call(this,e)};gn.prototype.create=function(e,r,n){for(var i=new qAe.Service(e,r,n),o=0,s;o<this.methodsArray.length;++o){var a=Bd.lcFirst((s=this._methodsArray[o]).resolve().name).replace(/[^$\w_]/g,"");i[a]=Bd.codegen(["r","c"],VAe.test(a)?a+"_":a)("return this.rpcCall(m,q,s,r,c)")({m:s,q:s.resolvedRequestType.ctor,s:s.resolvedResponseType.ctor})}return i}});var zT=T((mct,RZ)=>{"use strict";RZ.exports=to;var HAe=gi();function to(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r){var n=e[r];n!=="__proto__"&&(this[n]=t[n])}}to.create=function(e){return this.$type.create(e)};to.encode=function(e,r){return this.$type.encode(e,r)};to.encodeDelimited=function(e,r){return this.$type.encodeDelimited(e,r)};to.decode=function(e){return this.$type.decode(e)};to.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};to.verify=function(e){return this.$type.verify(e)};to.fromObject=function(e){return this.$type.fromObject(e)};to.toObject=function(e,r){return this.$type.toObject(e,r)};to.prototype.toJSON=function(){return this.$type.toObject(this,HAe.toJSONOptions)}});var UN=T((gct,CZ)=>{"use strict";CZ.exports=KAe;var WAe=yi(),es=gl(),IZ=Jt();function YAe(t){return"missing required '"+t.name+"'"}function KAe(t){for(var e=IZ.codegen(["r","l","e","n"],t.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(t.fieldsArray.filter(function(a){return a.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),r=0;r<t.fieldsArray.length;++r){var n=t._fieldsArray[r].resolve(),i=n.resolvedType instanceof WAe?"int32":n.type,o="m"+IZ.safeProp(n.name);e("case %i: {",n.id),n.map?(e("if(%s===util.emptyObject)",o)("%s={}",o)("var c2 = r.uint32()+r.pos"),es.defaults[n.keyType]!==void 0?e("k=%j",es.defaults[n.keyType]):e("k=null"),es.defaults[i]!==void 0?e("value=%j",es.defaults[i]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",n.keyType)("case 2:"),es.basic[i]===void 0?e("value=types[%i].decode(r,r.uint32(),undefined,n+1)",r):e("value=r.%s()",i),e("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),es.long[n.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',o):(n.keyType==="string"&&e('if(k==="__proto__")')("util.makeProp(%s,k)",o),e("%s[k]=value",o))):n.repeated?(e("if(!(%s&&%s.length))",o,o)("%s=[]",o),es.packed[i]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",o,i)("}else"),es.basic[i]===void 0?e(n.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",o,r):e("%s.push(r.%s())",o,i)):es.basic[i]===void 0?e(n.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",o,r):e("%s=r.%s()",o,i),e("break")("}")}for(e("default:")("r.skipType(t&7,n)")("break")("}")("}"),r=0;r<t._fieldsArray.length;++r){var s=t._fieldsArray[r];s.required&&e("if(!m.hasOwnProperty(%j))",s.name)("throw util.ProtocolError(%j,{instance:m})",YAe(s))}return e("return m")}});var jN=T((_ct,PZ)=>{"use strict";PZ.exports=XAe;var ZAe=yi(),FN=Jt();function Vn(t,e){return t.name+": "+e+(t.repeated&&e!=="array"?"[]":t.map&&e!=="object"?"{k:"+t.keyType+"}":"")+" expected"}function BN(t,e,r,n){if(e.resolvedType)if(e.resolvedType instanceof ZAe){t("switch(%s){",n)("default:")("return%j",Vn(e,"enum value"));for(var i=Object.keys(e.resolvedType.values),o=0;o<i.length;++o)t("case %i:",e.resolvedType.values[i[o]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s,n+1);",r,n)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",n)("return%j",Vn(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",Vn(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',n)("return%j",Vn(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',n)("return%j",Vn(e,"boolean"));break;case"string":t("if(!util.isString(%s))",n)("return%j",Vn(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",Vn(e,"buffer"));break}return t}function JAe(t,e,r){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",r)("return%j",Vn(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",r)("return%j",Vn(e,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",r)("return%j",Vn(e,"boolean key"));break}return t}function XAe(t){var e=FN.codegen(["m","n"],t.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),r=t.oneofsArray,n={};r.length&&e("var p={}");for(var i=0;i<t.fieldsArray.length;++i){var o=t._fieldsArray[i].resolve(),s="m"+FN.safeProp(o.name);if(o.optional&&e("if(%s!=null&&m.hasOwnProperty(%j)){",s,o.name),o.map)e("if(!util.isObject(%s))",s)("return%j",Vn(o,"object"))("var k=Object.keys(%s)",s)("for(var i=0;i<k.length;++i){"),JAe(e,o,"k[i]"),BN(e,o,i,s+"[k[i]]")("}");else if(o.repeated)e("if(!Array.isArray(%s))",s)("return%j",Vn(o,"array"))("for(var i=0;i<%s.length;++i){",s),BN(e,o,i,s+"[i]")("}");else{if(o.partOf){var a=FN.safeProp(o.partOf.name);n[o.partOf.name]===1&&e("if(p%s===1)",a)("return%j",o.partOf.name+": multiple values"),n[o.partOf.name]=1,e("p%s=1",a)}BN(e,o,i,s)}o.optional&&e("}")}return e("return null")}});var qN=T(NZ=>{"use strict";var OZ=NZ,Ag=yi(),ro=Jt();function zN(t,e,r,n){var i=!1;if(e.resolvedType)if(e.resolvedType instanceof Ag){t("switch(d%s){",n);for(var o=e.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)o[s[a]]===e.typeDefault&&!i&&(t("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),e.repeated||t("break"),i=!0),t("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",n,o[s[a]])("break");t("}")}else t('if(typeof d%s!=="object")',n)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",n,r,n);else{var c=!1;switch(e.type){case"double":case"float":t("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":t("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",n,n);break;case"uint64":case"fixed64":c=!0;case"int64":case"sint64":case"sfixed64":t("if(util.Long)")("m%s=util.Long.fromValue(d%s,%j)",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":t('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":t("m%s=String(d%s)",n,n);break;case"bool":t("m%s=Boolean(d%s)",n,n);break}}return t}OZ.fromObject=function(e){var r=e.fieldsArray,n=ro.codegen(["d","n"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!r.length)return n("return new this.ctor");n("var m=new this.ctor");for(var i=0;i<r.length;++i){var o=r[i].resolve(),s=ro.safeProp(o.name);o.map?(n("if(d%s){",s)('if(typeof d%s!=="object")',s)("throw TypeError(%j)",o.fullName+": object expected")("m%s={}",s)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",s),n('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",s),zN(n,o,i,s+"[ks[i]]")("}")("}")):o.repeated?(n("if(d%s){",s)("if(!Array.isArray(d%s))",s)("throw TypeError(%j)",o.fullName+": array expected")("m%s=[]",s)("for(var i=0;i<d%s.length;++i){",s),zN(n,o,i,s+"[i]")("}")("}")):(o.resolvedType instanceof Ag||n("if(d%s!=null){",s),zN(n,o,i,s),o.resolvedType instanceof Ag||n("}"))}return n("return m")};function GN(t,e,r,n){if(e.resolvedType)e.resolvedType instanceof Ag?t("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):t("d%s=types[%i].toObject(m%s,o,q+1)",n,r,n);else{var i=!1;switch(e.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":case"fixed64":i=!0;case"int64":case"sint64":case"sfixed64":t('if(typeof BigInt!=="undefined"&&o.longs===BigInt)')('d%s=typeof m%s==="number"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()',n,n,n,n,n,i)('else if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:t("d%s=m%s",n,n);break}}return t}OZ.toObject=function(e){var r=e.fieldsArray.slice().sort(ro.compareFieldsById);if(!r.length)return ro.codegen()("return {}");for(var n=ro.codegen(["m","o","q"],e.name+"$toObject")("if(!o)")("o={}")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")')("var d={}"),i=[],o=[],s=[],a=0;a<r.length;++a)r[a].partOf||(r[a].resolve().repeated?i:r[a].map?o:s).push(r[a]);if(i.length){for(n("if(o.arrays||o.defaults){"),a=0;a<i.length;++a)n("d%s=[]",ro.safeProp(i[a].name));n("}")}if(o.length){for(n("if(o.objects||o.defaults){"),a=0;a<o.length;++a)n("d%s={}",ro.safeProp(o[a].name));n("}")}if(s.length){for(n("if(o.defaults){"),a=0;a<s.length;++a){var c=s[a],l=ro.safeProp(c.name);if(c.resolvedType instanceof Ag)n("d%s=o.enums===String?%j:%j",l,c.resolvedType.valuesById[c.typeDefault],c.typeDefault);else if(c.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",c.typeDefault.low,c.typeDefault.high,c.typeDefault.unsigned)('d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!=="undefined"&&o.longs===BigInt?n.toBigInt():n',l)("}else")('d%s=o.longs===String?%j:typeof BigInt!=="undefined"&&o.longs===BigInt?BigInt(%j):%i',l,c.typeDefault.toString(),c.typeDefault.toString(),c.typeDefault.toNumber());else if(c.bytes){var u=Array.prototype.slice.call(c.typeDefault);n("if(o.bytes===String)d%s=%j",l,String.fromCharCode.apply(String,c.typeDefault))("else{")("d%s=%j",l,u)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",l,l)("}")}else n("d%s=%j",l,c.typeDefault)}n("}")}var d=!1;for(a=0;a<r.length;++a){var c=r[a],f=e._fieldsArray.indexOf(c),l=ro.safeProp(c.name);c.map?(d||(d=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",l,l)("d%s={}",l)("for(var j=0;j<ks2.length;++j){"),n('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",l),GN(n,c,f,l+"[ks2[j]]")("}")):c.repeated?(n("if(m%s&&m%s.length){",l,l)("d%s=[]",l)("for(var j=0;j<m%s.length;++j){",l),GN(n,c,f,l+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",l,c.name),GN(n,c,f,l),c.partOf&&n("if(o.oneofs)")("d%s=%j",ro.safeProp(c.partOf.name),c.name)),n("}")}return n("return d")}});var VN=T(kZ=>{"use strict";var QAe=kZ,ewe=zT(),twe=gi();QAe[".google.protobuf.Any"]={fromObject:function(t,e){if(t&&t["@type"]){var r=t["@type"].substring(t["@type"].lastIndexOf("/")+1),n=this.lookup(r);if(n){var i=t["@type"].charAt(0)==="."?t["@type"].slice(1):t["@type"];return i.indexOf("/")===-1&&(i="/"+i),this.create({type_url:i,value:n.encode(n.fromObject(t,e===void 0?1:e+1)).finish()})}}return this.fromObject(t,e)},toObject:function(t,e,r){if(r===void 0&&(r=0),r>twe.recursionLimit)throw Error("max depth exceeded");var n="type.googleapis.com/",i="",o="";if(e&&e.json&&t.type_url&&t.value){o=t.type_url.substring(t.type_url.lastIndexOf("/")+1),i=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1);var s=this.lookup(o);s&&(t=s.decode(t.value,void 0,void 0,r+1))}if(!(t instanceof this.ctor)&&t instanceof ewe){var a=t.$type.toObject(t,e,r+1),c=t.$type.fullName[0]==="."?t.$type.fullName.slice(1):t.$type.fullName;return i===""&&(i=n),o=i+c,a["@type"]=o,a}return this.toObject(t,e,r)}}});var VT=T((Ect,DZ)=>{"use strict";DZ.exports=ut;var Hn=Ud();((ut.prototype=Object.create(Hn.prototype)).constructor=ut).className="Type";var rwe=yi(),YN=ml(),GT=ga(),nwe=FT(),iwe=jT(),HN=zT(),WN=$T(),owe=DT(),lr=Jt(),swe=KN(),awe=UN(),cwe=jN(),MZ=qN(),lwe=VN();function ut(t,e){t=t.replace(/\W/g,""),Hn.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(ut.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var r=this.fields[t[e]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=lr.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=lr.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=ut.generateConstructor(this)())},set:function(t){var e=t.prototype;e instanceof HN||((t.prototype=new HN).constructor=t,lr.merge(t.prototype,e)),t.$type=t.prototype.$type=this,lr.merge(t,HN,!0),this._ctor=t;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:lr.oneOfGetter(this._oneofsArray[r].oneof),set:lr.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(t.prototype,n)}}});ut.generateConstructor=function(e){for(var r=lr.codegen(["p"],e.name),n=0,i;n<e.fieldsArray.length;++n)(i=e._fieldsArray[n]).map?r("this%s={}",lr.safeProp(i.name)):i.repeated&&r("this%s=[]",lr.safeProp(i.name));return r('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")};function qT(t){return t._fieldsById=t._fieldsArray=t._oneofsArray=null,delete t.encode,delete t.decode,delete t.verify,t}ut.fromJSON=function(e,r,n){if(n===void 0&&(n=0),n>lr.nestingLimit)throw Error("max depth exceeded");var i=new ut(e,r.options);i.extensions=r.extensions,i.reserved=r.reserved;for(var o=Object.keys(r.fields),s=0;s<o.length;++s)i.add((typeof r.fields[o[s]].keyType<"u"?nwe.fromJSON:GT.fromJSON)(o[s],r.fields[o[s]]));if(r.oneofs)for(o=Object.keys(r.oneofs),s=0;s<o.length;++s)i.add(YN.fromJSON(o[s],r.oneofs[o[s]]));if(r.nested)for(o=Object.keys(r.nested),s=0;s<o.length;++s){var a=r.nested[o[s]];i.add((a.id!==void 0?GT.fromJSON:a.fields!==void 0?ut.fromJSON:a.values!==void 0?rwe.fromJSON:a.methods!==void 0?iwe.fromJSON:Hn.fromJSON)(o[s],a,n+1))}return r.extensions&&r.extensions.length&&(i.extensions=r.extensions),r.reserved&&r.reserved.length&&(i.reserved=r.reserved),r.group&&(i.group=!0),r.comment&&(i.comment=r.comment),r.edition&&(i._edition=r.edition),i._defaultEdition="proto3",i};ut.prototype.toJSON=function(e){var r=Hn.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return lr.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"oneofs",Hn.arrayToJSON(this.oneofsArray,e),"fields",Hn.arrayToJSON(this.fieldsArray.filter(function(i){return!i.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};ut.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Hn.prototype.resolveAll.call(this);var e=this.oneofsArray;for(n=0;n<e.length;)e[n++].resolve();for(var r=this.fieldsArray,n=0;n<r.length;)r[n++].resolve();return this};ut.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Hn.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(r=>{r._resolveFeatures(e)}),this.fieldsArray.forEach(r=>{r._resolveFeatures(e)}),this):this};ut.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.fields,e)?this.fields[e]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,e)?this.oneofs[e]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};ut.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof GT&&e.extend===void 0){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),qT(this))}return e instanceof YN?e.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),qT(this)):Hn.prototype.add.call(this,e)};ut.prototype.remove=function(e){if(e instanceof GT&&e.extend===void 0){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),qT(this)}if(e instanceof YN){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),qT(this)}return Hn.prototype.remove.call(this,e)};ut.prototype.isReservedId=function(e){return Hn.isReservedId(this.reserved,e)};ut.prototype.isReservedName=function(e){return Hn.isReservedName(this.reserved,e)};ut.prototype.create=function(e){return new this.ctor(e)};ut.prototype.setup=function(){for(var e=this.fullName,r=[],n=0;n<this.fieldsArray.length;++n)r.push(this._fieldsArray[n].resolve().resolvedType);this.encode=swe(this)({Writer:owe,types:r,util:lr}),this.decode=awe(this)({Reader:WN,types:r,util:lr}),this.verify=cwe(this)({types:r,util:lr}),this.fromObject=MZ.fromObject(this)({types:r,util:lr}),this.toObject=MZ.toObject(this)({types:r,util:lr});var i=lwe[e];if(i){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(o),o.toObject=this.toObject,this.toObject=i.toObject.bind(o)}return this};ut.prototype.encode=function(e,r){return this.setup().encode.apply(this,arguments)};ut.prototype.encodeDelimited=function(e,r){return this.encode(e,r&&r.len?r.fork():r).ldelim()};ut.prototype.decode=function(e,r,n,i){return this.setup().decode(e,r,n,i)};ut.prototype.decodeDelimited=function(e){return e instanceof WN||(e=WN.create(e)),this.decode(e,e.uint32())};ut.prototype.verify=function(e,r){return this.setup().verify(e,r)};ut.prototype.fromObject=function(e,r){return this.setup().fromObject(e,r)};ut.prototype.toObject=function(e,r){return this.setup().toObject.apply(this,arguments)};ut.d=function(e){return function(n){lr.decorateType(n,e)}}});var KT=T((vct,UZ)=>{"use strict";UZ.exports=_n;var YT=Ud();((_n.prototype=Object.create(YT.prototype)).constructor=_n).className="Root";var HT=ga(),ZN=yi(),uwe=ml(),no=Jt(),JN,XN,wg;function _n(t){YT.call(this,"",t),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}_n.fromJSON=function(e,r,n){return n=no.checkDepth(n),r||(r=new _n),e.options&&r.setOptions(e.options),r.addJSON(e.nested,n).resolveAll()};_n.prototype.resolvePath=no.path.resolve;_n.prototype.fetch=no.fetch;function $Z(){}_n.prototype.load=function t(e,r,n){typeof r=="function"&&(n=r,r=void 0);var i=this;if(!n)return no.asPromise(t,i,e,r);var o=n===$Z;function s(p,h){if(n){if(o)throw p;h&&h.resolveAll();var m=n;n=null,m(p,h)}}function a(p){var h=p.lastIndexOf("google/protobuf/");if(h>-1){var m=p.substring(h);if(m in wg)return m}return null}function c(p,h,m){m===void 0&&(m=0);try{if(m>no.recursionLimit)throw Error("max depth exceeded");if(no.isString(h)&&h.charAt(0)==="{"&&(h=JSON.parse(h)),!no.isString(h))i.setOptions(h.options).addJSON(h.nested);else{XN.filename=p;var S=XN(h,i,r),E,b=0;if(S.imports)for(;b<S.imports.length;++b)(E=a(S.imports[b])||i.resolvePath(p,S.imports[b]))&&l(E,!1,m+1);if(S.weakImports)for(b=0;b<S.weakImports.length;++b)(E=a(S.weakImports[b])||i.resolvePath(p,S.weakImports[b]))&&l(E,!0,m+1)}}catch(A){s(A)}!o&&!u&&s(null,i)}function l(p,h,m){if(m===void 0&&(m=0),p=a(p)||p,!(i.files.indexOf(p)>-1)){if(i.files.push(p),p in wg){o?c(p,wg[p],m):(++u,setTimeout(function(){--u,c(p,wg[p],m)}));return}if(o){var S;try{S=no.fs.readFileSync(p).toString("utf8")}catch(E){h||s(E);return}c(p,S,m)}else++u,i.fetch(p,function(E,b){if(--u,!!n){if(E){h?u||s(null,i):s(E);return}c(p,b,m)}})}}var u=0;no.isString(e)&&(e=[e]);for(var d=0,f;d<e.length;++d)(f=i.resolvePath("",e[d]))&&l(f);return o?(i.resolveAll(),i):(u||s(null,i),i)};_n.prototype.loadSync=function(e,r){if(!no.isNode)throw Error("not supported");return this.load(e,r,$Z)};_n.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return YT.prototype.resolveAll.call(this)};var WT=/^[A-Z]/;function LZ(t,e){var r=e.parent.lookup(e.extend);if(r){var n=new HT(e.fullName,e.id,e.type,e.rule,void 0,e.options);return r.get(n.name)||(n.declaringField=e,e.extensionField=n,r.add(n)),!0}return!1}_n.prototype._handleAdd=function(e){if(e instanceof HT)e.extend!==void 0&&!e.extensionField&&(LZ(this,e)||this.deferred.push(e));else if(e instanceof ZN)WT.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof uwe)){if(e instanceof JN)for(var r=0;r<this.deferred.length;)LZ(this,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);WT.test(e.name)&&(e.parent[e.name]=e)}(e instanceof JN||e instanceof ZN||e instanceof HT)&&(this._fullyQualifiedObjects[e.fullName]=e)};_n.prototype._handleRemove=function(e){if(e instanceof HT){if(e.extend!==void 0)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var r=this.deferred.indexOf(e);r>-1&&this.deferred.splice(r,1)}}else if(e instanceof ZN)WT.test(e.name)&&delete e.parent[e.name];else if(e instanceof YT){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);WT.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};_n._configure=function(t,e,r){JN=t,XN=e,wg=r}});var Jt=T((Tct,jZ)=>{"use strict";var ht=jZ.exports=gi(),FZ=IN(),QN,ek;ht.codegen=cZ();ht.fetch=fZ();ht.path=mZ();ht.patterns=_Z();var BZ=ht.patterns.reservedRe;ht.fs=SZ();ht.checkDepth=function(e){if(e===void 0&&(e=0),e>ht.recursionLimit)throw Error("max depth exceeded");return e};ht.toArray=function(e){if(e){for(var r=Object.keys(e),n=new Array(r.length),i=0;i<r.length;)n[i]=e[r[i++]];return n}return[]};ht.toObject=function(e){for(var r={},n=0;n<e.length;){var i=e[n++],o=e[n++];o!==void 0&&(r[i]=o)}return r};ht.isReserved=function(e){return BZ.test(e)};ht.safeProp=function(e){return!/^[$\w_]+$/.test(e)||BZ.test(e)?"["+JSON.stringify(e)+"]":"."+e};ht.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var dwe=/_([a-z])/g;ht.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(dwe,function(r,n){return n.toUpperCase()})};ht.compareFieldsById=function(e,r){return e.id-r.id};ht.decorateType=function(e,r){if(e.$type)return r&&e.$type.name!==r&&(ht.decorateRoot.remove(e.$type),e.$type.name=r,ht.decorateRoot.add(e.$type)),e.$type;QN||(QN=VT());var n=new QN(r||e.name);return ht.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var fwe=0;ht.decorateEnum=function(e){if(e.$type)return e.$type;ek||(ek=yi());var r=new ek("Enum"+fwe++,e);return ht.decorateRoot.add(r),Object.defineProperty(e,"$type",{value:r,enumerable:!1}),r};ht.setProperty=function(e,r,n,i){function o(s,a,c){var l=a.shift();if(ht.isUnsafeProperty(l))return s;if(a.length>0)s[l]=o(s[l]||{},a,c);else{var u=s[l];if(u&&i)return s;u&&(c=[].concat(u).concat(c)),s[l]=c}return s}if(typeof e!="object")throw TypeError("dst must be an object");if(!r)throw TypeError("path must be specified");if(r=r.split("."),r.length>ht.recursionLimit)throw Error("max depth exceeded");return o(e,r,n)};Object.defineProperty(ht,"decorateRoot",{get:function(){return FZ.decorated||(FZ.decorated=new(KT()))}})});var gl=T(zZ=>{"use strict";var xg=zZ,pwe=Jt(),hwe=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Rg(t,e){var r=0,n=Object.create(null);for(e|=0;r<t.length;)n[hwe[r+e]]=t[r++];return n}xg.basic=Rg([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);xg.defaults=Rg([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",pwe.emptyArray,null]);xg.long=Rg([0,0,0,1,1],7);xg.mapKey=Rg([0,0,0,5,5,0,0,0,1,1,0,2],2);xg.packed=Rg([1,5,0,0,0,5,5,0,0,0,1,1,0])});var ga=T((Act,qZ)=>{"use strict";qZ.exports=Xt;var Cg=_a();((Xt.prototype=Object.create(Cg.prototype)).constructor=Xt).className="Field";var GZ=yi(),tk=gl(),Mt=Jt(),Ig,mwe=/^required|optional|repeated$/;Xt.fromJSON=function(e,r){var n=new Xt(e,r.id,r.type,r.rule,r.extend,r.options,r.comment);return r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};function Xt(t,e,r,n,i,o,s){if(Mt.isObject(n)?(s=i,o=n,n=i=void 0):Mt.isObject(i)&&(s=o,o=i,i=void 0),Cg.call(this,t,o),!Mt.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!Mt.isString(r))throw TypeError("type must be a string");if(n!==void 0&&!mwe.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(i!==void 0&&!Mt.isString(i))throw TypeError("extend must be a string");n==="proto3_optional"&&(n="optional"),this.rule=n&&n!=="optional"?n:void 0,this.type=r,this.id=e,this.extend=i||void 0,this.repeated=n==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=Mt.Long?tk.long[r]!==void 0:!1,this.bytes=r==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=s}Object.defineProperty(Xt.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(Xt.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(Xt.prototype,"delimited",{get:function(){return this.resolvedType instanceof Ig&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(Xt.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(Xt.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});Xt.prototype.setOption=function(e,r,n){return Cg.prototype.setOption.call(this,e,r,n)};Xt.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return Mt.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};Xt.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=tk.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Ig?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof GZ&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof GZ)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=Mt.Long.fromNumber(this.typeDefault,this.type==="uint64"||this.type==="fixed64"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var e;Mt.base64.test(this.typeDefault)?Mt.base64.decode(this.typeDefault,e=Mt.newBuffer(Mt.base64.length(this.typeDefault)),0):Mt.utf8.write(this.typeDefault,e=Mt.newBuffer(Mt.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=Mt.emptyObject:this.repeated?this.defaultValue=Mt.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Ig&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Cg.prototype.resolve.call(this)};Xt.prototype._inferLegacyProtoFeatures=function(e){if(e!=="proto2"&&e!=="proto3")return{};var r={};if(this.rule==="required"&&(r.field_presence="LEGACY_REQUIRED"),this.parent&&tk.defaults[this.type]===void 0){var n=this.parent.get(this.type.split(".").pop());n&&n instanceof Ig&&n.group&&(r.message_encoding="DELIMITED")}return this.getOption("packed")===!0?r.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(r.repeated_field_encoding="EXPANDED"),r};Xt.prototype._resolveFeatures=function(e){return Cg.prototype._resolveFeatures.call(this,this._edition||e)};Xt.d=function(e,r,n,i){return typeof r=="function"?r=Mt.decorateType(r).name:r&&typeof r=="object"&&(r=Mt.decorateEnum(r).name),function(s,a){Mt.decorateType(s.constructor).add(new Xt(a,e,r,n,{default:i}))}};Xt._configure=function(e){Ig=e}});var ml=T((wct,WZ)=>{"use strict";WZ.exports=yn;var JT=_a();((yn.prototype=Object.create(JT.prototype)).constructor=yn).className="OneOf";var VZ=ga(),ZT=Jt();function yn(t,e,r,n){if(Array.isArray(e)||(r=e,e=void 0),JT.call(this,t,r),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=n}yn.fromJSON=function(e,r){return new yn(e,r.oneof,r.options,r.comment)};yn.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return ZT.toObject(["options",this.options,"oneof",this.oneof,"comment",r?this.comment:void 0])};function HZ(t){if(t.parent)for(var e=0;e<t.fieldsArray.length;++e)t.fieldsArray[e].parent||t.parent.add(t.fieldsArray[e])}yn.prototype.add=function(e){if(!(e instanceof VZ))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,HZ(this),this};yn.prototype.remove=function(e){if(!(e instanceof VZ))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),r=this.oneof.indexOf(e.name),r>-1&&this.oneof.splice(r,1),e.partOf=null,this};yn.prototype.onAdd=function(e){JT.prototype.onAdd.call(this,e);for(var r=this,n=0;n<this.oneof.length;++n){var i=e.get(this.oneof[n]);i&&!i.partOf&&(i.partOf=r,r.fieldsArray.push(i))}HZ(this)};yn.prototype.onRemove=function(e){for(var r=0,n;r<this.fieldsArray.length;++r)(n=this.fieldsArray[r]).parent&&n.parent.remove(n);JT.prototype.onRemove.call(this,e)};Object.defineProperty(yn.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var t=this.fieldsArray[0];return t.options!=null&&t.options.proto3_optional===!0}});yn.d=function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;)e[r]=arguments[r++];return function(i,o){ZT.decorateType(i.constructor).add(new yn(o,e)),Object.defineProperty(i,o,{get:ZT.oneOfGetter(e),set:ZT.oneOfSetter(e)})}}});var _a=T((xct,YZ)=>{"use strict";YZ.exports=ur;ur.className="ReflectionObject";var gwe=ml(),Si=Jt(),XT,_we={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},ywe={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},Swe={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function ur(t,e){if(!Si.isString(t))throw TypeError("name must be a string");if(e&&!Si.isObject(e))throw TypeError("options must be an object");this.options=e,this.parsedOptions=null,this.name=t,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(ur.prototype,{root:{get:function(){for(var t=this;t.parent!==null;)t=t.parent;return t}},fullName:{get:function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}});ur.prototype.toJSON=function(){throw Error()};ur.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var r=e.root;r instanceof XT&&r._handleAdd(this)};ur.prototype.onRemove=function(e){var r=e.root;r instanceof XT&&r._handleRemove(this),this.parent=null,this.resolved=!1};ur.prototype.resolve=function(){return this.resolved?this:(this.root instanceof XT&&(this.resolved=!0),this)};ur.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)};ur.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var r={};if(!e)throw new Error("Unknown edition for "+this.fullName);var n=Si.merge({},this.options&&this.options.features,this._inferLegacyProtoFeatures(e));if(this._edition){if(e==="proto2")r=Object.assign({},ywe);else if(e==="proto3")r=Object.assign({},Swe);else if(e==="2023")r=Object.assign({},_we);else throw new Error("Unknown edition: "+e);this._features=Si.merge(r,n),this._featuresResolved=!0;return}if(this.partOf instanceof gwe){var i=Si.merge({},this.partOf._features);this._features=Si.merge(i,n)}else if(!this.declaringField)if(this.parent){var o=Si.merge({},this.parent._features);this._features=Si.merge(o,n)}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}};ur.prototype._inferLegacyProtoFeatures=function(){return{}};ur.prototype.getOption=function(e){if(this.options)return this.options[e]};ur.prototype.setOption=function(e,r,n){return e==="__proto__"?this:(this.options||(this.options={}),/^features\./.test(e)?Si.setProperty(this.options,e,r,n):(!n||this.options[e]===void 0)&&(this.getOption(e)!==r&&(this.resolved=!1),this.options[e]=r),this)};ur.prototype.setParsedOption=function(e,r,n){if(e==="__proto__")return this;this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(n){var o=i.find(function(c){return Object.prototype.hasOwnProperty.call(c,e)});if(o){var s=o[e];Si.setProperty(s,n,r)}else o={},o[e]=Si.setProperty({},n,r),i.push(o)}else{var a={};a[e]=r,i.push(a)}return this};ur.prototype.setOptions=function(e,r){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)this.setOption(n[i],e[n[i]],r);return this};ur.prototype.toString=function(){var e=this.constructor.className,r=this.fullName;return r.length?e+" "+r:e};ur.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition};ur._configure=function(t){XT=t}});var yi=T((Rct,ZZ)=>{"use strict";ZZ.exports=Ei;var rk=_a();((Ei.prototype=Object.create(rk.prototype)).constructor=Ei).className="Enum";var KZ=Ud(),jd=Jt();function Ei(t,e,r,n,i,o){if(rk.call(this,t,r),e&&typeof e!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=i||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,e)for(var s=Object.keys(e),a=0;a<s.length;++a)s[a]!=="__proto__"&&typeof e[s[a]]=="number"&&(this.valuesById[this.values[s[a]]=e[s[a]]]=s[a])}Ei.prototype._resolveFeatures=function(e){return e=this._edition||e,rk.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(r=>{var n=jd.merge({},this._features);this._valuesFeatures[r]=jd.merge(n,this.valuesOptions&&this.valuesOptions[r]&&this.valuesOptions[r].features||{})}),this};Ei.fromJSON=function(e,r){var n=new Ei(e,r.values,r.options,r.comment,r.comments);return n.reserved=r.reserved,r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};Ei.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return jd.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",r?this.comment:void 0,"comments",r?this.comments:void 0])};Ei.prototype.add=function(e,r,n,i){if(!jd.isString(e))throw TypeError("name must be a string");if(!jd.isInteger(r))throw TypeError("id must be an integer");if(e==="__proto__")return this;if(this.values[e]!==void 0)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(r))throw Error("id "+r+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[r]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+r+" in "+this);this.values[e]=r}else this.valuesById[this.values[e]=r]=e;return i&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[e]=i||null),this.comments[e]=n||null,this};Ei.prototype.remove=function(e){if(!jd.isString(e))throw TypeError("name must be a string");var r=this.values[e];if(r==null)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[r],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this};Ei.prototype.isReservedId=function(e){return KZ.isReservedId(this.reserved,e)};Ei.prototype.isReservedName=function(e){return KZ.isReservedName(this.reserved,e)}});var KN=T((Ict,XZ)=>{"use strict";XZ.exports=vwe;var Ewe=yi(),nk=gl(),ik=Jt();function JZ(t,e,r,n){return e.delimited?t("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)",r,n,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()",r,n,(e.id<<3|2)>>>0)}function vwe(t){for(var e=ik.codegen(["m","w","q"],t.name+"$encode")("if(!w)")("w=Writer.create()")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")'),r,n,i=t.fieldsArray.slice().sort(ik.compareFieldsById),r=0;r<i.length;++r){var o=i[r].resolve(),s=t._fieldsArray.indexOf(o),a=o.resolvedType instanceof Ewe?"int32":o.type,c=nk.basic[a];n="m"+ik.safeProp(o.name),o.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",n,o.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",n)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(o.id<<3|2)>>>0,8|nk.mapKey[o.keyType],o.keyType),c===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()",s,n):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|c,a,n),e("}")("}")):o.repeated?(e("if(%s!=null&&%s.length){",n,n),o.packed&&nk.packed[a]!==void 0?e("w.uint32(%i).fork()",(o.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",n)("w.%s(%s[i])",a,n)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",n),c===void 0?JZ(e,o,s,n+"[i]"):e("w.uint32(%i).%s(%s[i])",(o.id<<3|c)>>>0,a,n)),e("}")):(o.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",n,o.name),c===void 0?JZ(e,o,s,n):e("w.uint32(%i).%s(%s)",(o.id<<3|c)>>>0,a,n))}return e("return w")}});var e5=T((Cct,QZ)=>{"use strict";var We=QZ.exports=sZ();We.build="light";function Twe(t,e,r){return typeof e=="function"?(r=e,e=new We.Root):e||(e=new We.Root),e.load(t,r)}We.load=Twe;function bwe(t,e){return e||(e=new We.Root),e.loadSync(t)}We.loadSync=bwe;We.encoder=KN();We.decoder=UN();We.verifier=jN();We.converter=qN();We.ReflectionObject=_a();We.Namespace=Ud();We.Root=KT();We.Enum=yi();We.Type=VT();We.Field=ga();We.OneOf=ml();We.MapField=FT();We.Service=jT();We.Method=BT();We.Message=zT();We.wrappers=VN();We.types=gl();We.util=Jt();We.ReflectionObject._configure(We.Root);We.Namespace._configure(We.Type,We.Service,We.Enum);We.Root._configure(We.Type);We.Field._configure(We.Type)});var sk=T((Pct,n5)=>{"use strict";n5.exports=r5;var ok=/[\s{}=;:[\],'"()<>]/g,Awe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,wwe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,xwe=/^ *[*/]+ */,Rwe=/^\s*\*?\/*/,Iwe=/\n/g,Cwe=/\s/,Pwe=/\\(.?)/g,Owe={0:"\0",r:"\r",n:`
@@ -14,15 +14,15 @@ ${e}`;return Object.assign(new Error(r),t,{stack:i})}var qO=class extends Sbe.Ev
14
14
  `;)x++;return x}function m(){if(a.length>0)return a.shift();if(c)return u();var y,x,C,O,N,R=r===0;do{if(r===n)return null;for(y=!1;Cwe.test(C=d(r));)if(C===`
15
15
  `&&(R=!0,++i),++r===n)return null;if(d(r)==="/"){if(++r===n)throw l("comment");if(d(r)==="/")if(e){if(O=r,N=!1,p(r-1)){N=!0;do if(r=h(r),r===n||(r++,!R))break;while(p(r))}else r=Math.min(n,h(r)+1);N&&(f(O,r,R),R=!0),i++,y=!0}else{for(N=d(O=r+1)==="/";d(++r)!==`
16
16
  `;)if(r===n)return null;++r,N&&(f(O,r-1,R),R=!0),++i,y=!0}else if((C=d(r))==="*"){O=r+1,N=e||d(O)==="*";do{if(C===`
17
- `&&++i,++r===n)throw l("comment");x=C,C=d(r)}while(x!=="*"||C!=="/");++r,N&&(f(O,r-2,R),R=!0),y=!0}else return"/"}}while(y);var $=r;ok.lastIndex=0;var _=ok.test(d($++));if(!_)for(;$<n&&!ok.test(d($));)++$;var ee=t.substring(r,r=$);return(ee==='"'||ee==="'")&&(c=ee),ee}function S(y){a.push(y)}function E(){if(!a.length){var y=m();if(y===null)return null;S(y)}return a[0]}function b(y,x){var C=E(),O=C===y;if(O)return m(),!0;if(!x)throw l("token '"+C+"', '"+y+"' expected");return!1}function A(y){var x=null,C;return y===void 0?(C=s[i-1],delete s[i-1],C&&(e||C.type==="*"||C.lineEmpty)&&(x=C.leading?C.text:null)):(o<y&&E(),C=s[y],delete s[y],C&&!C.lineEmpty&&(e||C.type==="/")&&(x=C.leading?null:C.text)),x}return Object.defineProperty({next:m,peek:E,push:S,skip:b,cmnt:A},"line",{get:function(){return i}})}});var l5=T((Oct,c5)=>{"use strict";c5.exports=rs;rs.filename=null;rs.defaults={keepCase:!1};var Nwe=sk(),i5=KT(),o5=VT(),s5=ga(),kwe=FT(),a5=ml(),Mwe=yi(),Dwe=jT(),Lwe=BT(),$we=_a(),Uwe=gl(),ts=Jt(),Fwe=/^[1-9][0-9]*$/,Bwe=/^-?[1-9][0-9]*$/,jwe=/^0[x][0-9a-fA-F]+$/,zwe=/^-?0[x][0-9a-fA-F]+$/,Gwe=/^0[0-7]+$/,qwe=/^-?0[0-7]+$/,Vwe=ts.patterns.numberRe,io=/^[a-zA-Z_][a-zA-Z_0-9]*$/,oo=ts.patterns.typeRefRe;function rs(t,e,r){e instanceof i5||(r=e,e=new i5),r||(r=rs.defaults);var n=r.preferTrailingComment||!1,i=Nwe(t,r.alternateCommentMode||!1),o=i.next,s=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,S=[],E={},b=r.keepCase?function(P){return P}:ts.camelCase;function A(){S.forEach(P=>{P._edition=h,Object.keys(E).forEach(D=>{P.getOption(D)===void 0&&P.setOption(D,E[D],!0)})})}function y(P,D,B){var V=rs.filename;return B||(rs.filename=null),Error("illegal "+(D||"token")+" '"+P+"' ("+(V?V+", ":"")+"line "+i.line+")")}function x(){var P=[],D;do{if((D=o())!=='"'&&D!=="'")throw y(D);P.push(o()),c(D),D=a()}while(D==='"'||D==="'");return P.join("")}function C(P){var D=o();switch(D){case"'":case'"':return s(D),x();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return N(D,!0)}catch{if(P&&oo.test(D))return D;throw y(D,"value")}}function O(P,D){var B,V;do if(D&&((B=a())==='"'||B==="'")){var X=x();if(P.push(X),h>=2023)throw y(X,"id")}else try{P.push([V=R(o()),c("to",!0)?R(o()):V])}catch(q){if(D&&oo.test(B)&&h>=2023)P.push(B);else throw q}while(c(",",!0));var K={options:void 0};K.setOption=function(q,Se){this.options===void 0&&(this.options={}),this.options[q]=Se},v(K,function(Se){if(Se==="option")Re(K,Se),c(";");else throw y(Se)},function(){ye(K)})}function N(P,D){var B=1;switch(P.charAt(0)==="-"&&(B=-1,P=P.substring(1)),P){case"inf":case"INF":case"Inf":return B*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(Fwe.test(P))return B*parseInt(P,10);if(jwe.test(P))return B*parseInt(P,16);if(Gwe.test(P))return B*parseInt(P,8);if(Vwe.test(P))return B*parseFloat(P);throw y(P,"number",D)}function R(P,D){switch(P){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!D&&P.charAt(0)==="-")throw y(P,"id");if(Bwe.test(P))return parseInt(P,10);if(zwe.test(P))return parseInt(P,16);if(qwe.test(P))return parseInt(P,8);throw y(P,"id")}function $(){if(d!==void 0)throw y("package");if(d=o(),!oo.test(d))throw y(d,"name");m=m.define(d),c(";")}function _(){var P=a(),D;switch(P){case"weak":D=p||(p=[]),o();break;case"public":o();default:D=f||(f=[]);break}P=x(),c(";"),D.push(P)}function ee(){if(c("="),h=x(),h<2023)throw y(h,"syntax");c(";")}function k(){if(c("="),h=x(),!["2023"].includes(h))throw y(h,"edition");c(";")}function g(P,D,B){switch(B===void 0&&(B=0),D){case"option":return Re(P,D),c(";"),!0;case"message":return I(P,D,B+1),!0;case"enum":return Ie(P,D),!0;case"service":return Be(P,D,B+1),!0;case"extend":return oe(P,D,B),!0}return!1}function v(P,D,B){var V=i.line;if(P&&(typeof P.comment!="string"&&(P.comment=l()),P.filename=rs.filename),c("{",!0)){for(var X;(X=o())!=="}";)D(X);c(";",!0)}else B&&B(),c(";"),P&&(typeof P.comment!="string"||n)&&(P.comment=l(V)||P.comment)}function I(P,D,B){if(B===void 0&&(B=0),B>ts.nestingLimit)throw Error("max depth exceeded");if(!io.test(D=o()))throw y(D,"type name");var V=new o5(D);v(V,function(K){if(!g(V,K,B))switch(K){case"map":le(V,K);break;case"required":if(h!=="proto2")throw y(K);case"repeated":J(V,K,void 0,B+1);break;case"optional":if(h==="proto3")J(V,"proto3_optional",void 0,B+1);else{if(h!=="proto2")throw y(K);J(V,"optional",void 0,B+1)}break;case"oneof":Oe(V,K,B+1);break;case"extensions":O(V.extensions||(V.extensions=[]));break;case"reserved":O(V.reserved||(V.reserved=[]),!0);break;default:if(h==="proto2"||!oo.test(K))throw y(K);s(K),J(V,"optional",void 0,B+1);break}}),P.add(V),P===m&&S.push(V)}function J(P,D,B,V){var X=o();if(X==="group"){G(P,D,V);return}for(;X.endsWith(".")||a().startsWith(".");)X+=o();if(!oo.test(X))throw y(X,"type");var K=o();if(!io.test(K))throw y(K,"name");K=b(K),c("=");var q=new s5(K,R(o()),X,D,B);if(v(q,function(Ye){if(Ye==="option")Re(q,Ye),c(";");else throw y(Ye)},function(){ye(q)}),D==="proto3_optional"){var Se=new a5("_"+K);q.setOption("proto3_optional",!0),Se.add(q),P.add(Se)}else P.add(q);P===m&&S.push(q)}function G(P,D,B){if(B===void 0&&(B=0),B>ts.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw y("group");var V=o();if(!io.test(V))throw y(V,"name");var X=ts.lcFirst(V);V===X&&(V=ts.ucFirst(V)),c("=");var K=R(o()),q=new o5(V);q.group=!0;var Se=new s5(X,K,V,D);Se.filename=rs.filename,v(q,function(Ye){switch(Ye){case"option":Re(q,Ye),c(";");break;case"required":case"repeated":J(q,Ye,void 0,B+1);break;case"optional":h==="proto3"?J(q,"proto3_optional",void 0,B+1):J(q,"optional",void 0,B+1);break;case"message":I(q,Ye,B+1);break;case"enum":Ie(q,Ye);break;case"reserved":O(q.reserved||(q.reserved=[]),!0);break;default:throw y(Ye)}}),P.add(q).add(Se)}function le(P){c("<");var D=o();if(Uwe.mapKey[D]===void 0)throw y(D,"type");c(",");var B=o();if(!oo.test(B))throw y(B,"type");c(">");var V=o();if(!io.test(V))throw y(V,"name");c("=");var X=new kwe(b(V),R(o()),D,B);v(X,function(q){if(q==="option")Re(X,q),c(";");else throw y(q)},function(){ye(X)}),P.add(X)}function Oe(P,D,B){if(!io.test(D=o()))throw y(D,"name");var V=new a5(b(D));v(V,function(K){K==="option"?(Re(V,K),c(";")):(s(K),J(V,"optional",void 0,B))}),P.add(V)}function Ie(P,D){if(!io.test(D=o()))throw y(D,"name");var B=new Mwe(D);v(B,function(X){switch(X){case"option":Re(B,X),c(";");break;case"reserved":O(B.reserved||(B.reserved=[]),!0),B.reserved===void 0&&(B.reserved=[]);break;default:Ne(B,X)}}),P.add(B),P===m&&S.push(B)}function Ne(P,D){if(!io.test(D))throw y(D,"name");c("=");var B=R(o(),!0),V={options:void 0};V.getOption=function(X){return this.options[X]},V.setOption=function(X,K){$we.prototype.setOption.call(V,X,K)},V.setParsedOption=function(){},v(V,function(K){if(K==="option")Re(V,K),c(";");else throw y(K)},function(){ye(V)}),P.add(D,B,V.comment,V.parsedOptions||V.options)}function Re(P,D){var B,V,X=!0;for(D==="option"&&(D=o());D!=="=";){if(D==="("){var K=o();c(")"),D="("+K+")"}if(X){if(X=!1,D.includes(".")&&!D.includes("(")){var q=D.split(".");B=q[0]+".",D=q[1];continue}B=D}else V=V?V+=D:D;D=o()}var Se=V?B.concat(V):B,xe=ke(P,Se);V=V&&V[0]==="."?V.slice(1):V,B=B&&B[B.length-1]==="."?B.slice(0,-1):B,fe(P,B,xe,V)}function ke(P,D,B){if(B===void 0&&(B=0),B>ts.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var V={};!c("}",!0);){if(!io.test(M=o()))throw y(M,"name");if(M===null)throw y(M,"end of input");var X,K=M;if(c(":",!0),a()==="{")X=ke(P,D+"."+M,B+1);else if(a()==="["){X=[];var q;if(c("[",!0)){do q=C(!0),X.push(q);while(c(",",!0));c("]"),typeof q<"u"&&we(P,D+"."+M,q)}}else X=C(!0),we(P,D+"."+M,X);var Se=V[K];Se&&(X=[].concat(Se).concat(X)),K!=="__proto__"&&(V[K]=X),c(",",!0),c(";",!0)}return V}var xe=C(!0);return we(P,D,xe),xe}function we(P,D,B){if(m===P&&/^features\./.test(D)){E[D]=B;return}P.setOption&&P.setOption(D,B)}function fe(P,D,B,V){P.setParsedOption&&P.setParsedOption(D,B,V)}function ye(P){if(c("[",!0)){do Re(P,"option");while(c(",",!0));c("]")}return P}function Be(P,D,B){if(B===void 0&&(B=0),B>ts.recursionLimit)throw Error("max depth exceeded");if(!io.test(D=o()))throw y(D,"service name");var V=new Dwe(D);v(V,function(K){if(!g(V,K,B))if(K==="rpc")H(V,K);else throw y(K)}),P.add(V),P===m&&S.push(V)}function H(P,D){var B=l(),V=D;if(!io.test(D=o()))throw y(D,"name");var X=D,K,q,Se,xe;if(c("("),c("stream",!0)&&(q=!0),!oo.test(D=o())||(K=D,c(")"),c("returns"),c("("),c("stream",!0)&&(xe=!0),!oo.test(D=o())))throw y(D);Se=D,c(")");var Ye=new Lwe(X,V,K,Se,q,xe);Ye.comment=B,v(Ye,function(Hr){if(Hr==="option")Re(Ye,Hr),c(";");else throw y(Hr)}),P.add(Ye)}function oe(P,D,B){if(!oo.test(D=o()))throw y(D,"reference");var V=D;v(null,function(K){switch(K){case"required":case"repeated":J(P,K,V,B+1);break;case"optional":h==="proto3"?J(P,"proto3_optional",V,B+1):J(P,"optional",V,B+1);break;default:if(h==="proto2"||!oo.test(K))throw y(K);s(K),J(P,"optional",V,B+1);break}})}for(var M;(M=o())!==null;)switch(M){case"package":if(!u)throw y(M);$();break;case"import":if(!u)throw y(M);_();break;case"syntax":if(!u)throw y(M);ee();break;case"edition":if(!u)throw y(M);k();break;case"option":Re(m,M),c(";",!0);break;default:if(g(m,M,0)){u=!1;continue}throw y(M)}return A(),rs.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var f5=T((Nct,d5)=>{"use strict";d5.exports=vi;var Hwe=/\/|\./;function vi(t,e){Hwe.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),vi[t]=e}vi("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var u5;vi("duration",{Duration:u5={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});vi("timestamp",{Timestamp:u5});vi("empty",{Empty:{fields:{}}});vi("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});vi("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});vi("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});vi.get=function(e){return vi[e]||null}});var h5=T((kct,p5)=>{"use strict";var ya=p5.exports=e5();ya.build="full";ya.tokenize=sk();ya.parse=l5();ya.common=f5();ya.Root._configure(ya.Type,ya.parse,ya.common)});var QT=T((Mct,m5)=>{"use strict";m5.exports=h5()});var ak=T((Dct,Wwe)=>{Wwe.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var b5=T((ze,T5)=>{"use strict";var Dr=QT();T5.exports=ze=Dr.descriptor=Dr.Root.fromJSON(ak()).lookup(".google.protobuf");var g5=Dr.Namespace,Pg=Dr.Root,ns=Dr.Enum,Ti=Dr.Type,Sa=Dr.Field,Ywe=Dr.MapField,eb=Dr.OneOf,Og=Dr.Service,tb=Dr.Method,_5=Dr.util.patterns,Kwe=_5.numberRe,rb=_5.typeRefRe;Pg.fromDescriptor=function(e){typeof e.length=="number"&&(e=ze.FileDescriptorSet.decode(e));var r=new Pg;if(e.file)for(var n,i,o=0,s;o<e.file.length;++o){i=r,(n=e.file[o]).package&&n.package.length&&(i=r.define(n.package));var a=ixe(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(s=0;s<n.messageType.length;++s)i.add(Ti.fromDescriptor(n.messageType[s],a));if(n.enumType)for(s=0;s<n.enumType.length;++s)i.add(ns.fromDescriptor(n.enumType[s],a));if(n.extension)for(s=0;s<n.extension.length;++s)i.add(Sa.fromDescriptor(n.extension[s],a));if(n.service)for(s=0;s<n.service.length;++s)i.add(Og.fromDescriptor(n.service[s],a));var c=zd(n.options,ze.FileOptions);if(c){var l=Object.keys(c);for(s=0;s<l.length;++s)i.setOption(l[s],c[l[s]])}}return r.resolveAll()};Pg.prototype.toDescriptor=function(e){var r=ze.FileDescriptorSet.create();return y5(this,r.file,e),r};function y5(t,e,r){var n=ze.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});oxe(r,n),t instanceof Pg||(n.package=t.fullName.substring(1));for(var i=0,o;i<t.nestedArray.length;++i)(o=t._nestedArray[i])instanceof Ti?n.messageType.push(o.toDescriptor(r)):o instanceof ns?n.enumType.push(o.toDescriptor()):o instanceof Sa?n.extension.push(o.toDescriptor(r)):o instanceof Og?n.service.push(o.toDescriptor()):o instanceof g5&&y5(o,e,r);n.options=Gd(t.options,ze.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var Zwe=0;Ti.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>Dr.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=ze.DescriptorProto.decode(e));var o=new Ti(e.name.length?e.name:"Type"+Zwe++,zd(e.options,ze.MessageOptions)),s;if(n||(o._edition=r),e.oneofDecl)for(s=0;s<e.oneofDecl.length;++s)o.add(eb.fromDescriptor(e.oneofDecl[s]));if(e.field)for(s=0;s<e.field.length;++s){var a=Sa.fromDescriptor(e.field[s],r,!0);o.add(a),e.field[s].hasOwnProperty("oneofIndex")&&o.oneofsArray[e.field[s].oneofIndex].add(a)}if(e.extension)for(s=0;s<e.extension.length;++s)o.add(Sa.fromDescriptor(e.extension[s],r,!0));if(e.nestedType)for(s=0;s<e.nestedType.length;++s)o.add(Ti.fromDescriptor(e.nestedType[s],r,!0,i+1)),e.nestedType[s].options&&e.nestedType[s].options.mapEntry&&o.setOption("map_entry",!0);if(e.enumType)for(s=0;s<e.enumType.length;++s)o.add(ns.fromDescriptor(e.enumType[s],r,!0));if(e.extensionRange&&e.extensionRange.length)for(o.extensions=[],s=0;s<e.extensionRange.length;++s)o.extensions.push([e.extensionRange[s].start,e.extensionRange[s].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(o.reserved=[],e.reservedRange)for(s=0;s<e.reservedRange.length;++s)o.reserved.push([e.reservedRange[s].start,e.reservedRange[s].end]);if(e.reservedName)for(s=0;s<e.reservedName.length;++s)o.reserved.push(e.reservedName[s])}return o};Ti.prototype.toDescriptor=function(e){var r=ze.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof Ywe){var o=ck(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),s=ck(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=s===11||s===14?this._fieldsArray[n].resolvedType&&v5(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(ze.DescriptorProto.create({name:i.typeName,field:[ze.FieldDescriptorProto.create({name:"key",number:1,label:1,type:o}),ze.FieldDescriptorProto.create({name:"value",number:2,label:1,type:s,typeName:a})],options:ze.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Sa?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Ti?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof ns&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(ze.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(ze.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=Gd(this.options,ze.MessageOptions),r};Sa.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=ze.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,o;if(i!=null&&i!==""){if(typeof i!="string"||!rb.test(i))throw Error("illegal type name: "+i);o=i}else o=txe(e.type);var s;switch(e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!rb.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Sa(e.name.length?e.name:"field"+e.number,e.number,o,s,a);if(n||(c._edition=r),c.options=zd(e.options,ze.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=Kwe.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return rxe(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Sa.prototype.toDescriptor=function(e){var r=ze.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=Dr.util.ucFirst(this.name),r.label=3;else{switch(r.type=ck(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?v5(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof Ti&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=Gd(this.options,ze.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=ze.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=ze.FieldOptions.create())).packed=!0),r};var Jwe=0;ns.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=ze.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var o=0;o<e.value.length;++o){var s=e.value[o].name,a=e.value[o].number||0;i[s&&s.length?s:"NAME"+a]=a}var c=new ns(e.name&&e.name.length?e.name:"Enum"+Jwe++,i,zd(e.options,ze.EnumOptions));return n||(c._edition=r),c};ns.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(ze.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return ze.EnumDescriptorProto.create({name:this.name,value:e,options:Gd(this.options,ze.EnumOptions)})};var Xwe=0;eb.fromDescriptor=function(e){return typeof e.length=="number"&&(e=ze.OneofDescriptorProto.decode(e)),new eb(e.name&&e.name.length?e.name:"oneof"+Xwe++)};eb.prototype.toDescriptor=function(){return ze.OneofDescriptorProto.create({name:this.name})};var Qwe=0;Og.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=ze.ServiceDescriptorProto.decode(e));var i=new Og(e.name&&e.name.length?e.name:"Service"+Qwe++,zd(e.options,ze.ServiceOptions));if(n||(i._edition=r),e.method)for(var o=0;o<e.method.length;++o)i.add(tb.fromDescriptor(e.method[o]));return i};Og.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return ze.ServiceDescriptorProto.create({name:this.name,method:e,options:Gd(this.options,ze.ServiceOptions)})};var exe=0;tb.fromDescriptor=function(e){typeof e.length=="number"&&(e=ze.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!rb.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!rb.test(n)))throw Error("illegal type name: "+n);return new tb(e.name&&e.name.length?e.name:"Method"+exe++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,zd(e.options,ze.MethodOptions))};tb.prototype.toDescriptor=function(){return ze.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:Gd(this.options,ze.MethodOptions)})};function txe(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function rxe(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function ck(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof ns)return 14;if(e instanceof Ti)return r?10:11;throw Error("illegal type: "+t)}function S5(t,e){for(var r={},n=0,i,o;n<e.fieldsArray.length;++n)if((o=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,o)){var s=nxe(o);i.resolvedType instanceof Ti?r[s]=S5(t[o],i.resolvedType):i.resolvedType instanceof ns?r[s]=i.resolvedType.valuesById[t[o]]:r[s]=t[o]}return r}function zd(t,e){if(t)return S5(e.toObject(t),e)}function E5(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var o=n[i],s=Dr.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(e.fields,s)){var a=e.fields[s];a.resolvedType instanceof Ti?r[s]=E5(t[o],a.resolvedType):r[s]=t[o],a.repeated&&!Array.isArray(r[s])&&(r[s]=[r[s]])}}return r}function Gd(t,e){if(t)return e.fromObject(E5(t,e))}function v5(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,o=0,s=n.length-1;if(!(t instanceof Pg)&&e instanceof g5)for(;i<r.length&&o<s&&r[i]===n[o];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++o}else for(;i<r.length&&o<s&&r[i]===n[o];++i,++o);return n.slice(o).join(".")}function nxe(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function ixe(t){if(t.syntax==="editions"){if(t.edition===ze.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function oxe(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=ze.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var A5=T((Lct,sxe)=>{sxe.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var w5=T(($ct,axe)=>{axe.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var x5=T((Uct,cxe)=>{cxe.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var P5=T(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.addCommonProtos=Ea.loadProtosWithOptionsSync=Ea.loadProtosWithOptions=void 0;var R5=Q("fs"),I5=Q("path"),qd=QT();function C5(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(I5.isAbsolute(i))return i;for(let o of e){let s=I5.join(o,i);try{return R5.accessSync(s,R5.constants.R_OK),s}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function lxe(t,e){let r=new qd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));C5(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptions=lxe;function uxe(t,e){let r=new qd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");C5(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptionsSync=uxe;function dxe(){let t=A5(),e=ak(),r=w5(),n=x5();qd.common("api",t.nested.google.nested.protobuf.nested),qd.common("descriptor",e.nested.google.nested.protobuf.nested),qd.common("source_context",r.nested.google.nested.protobuf.nested),qd.common("type",n.nested.google.nested.protobuf.nested)}Ea.addCommonProtos=dxe});var hk=T(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.loadFileDescriptorSetFromObject=Ft.loadFileDescriptorSetFromBuffer=Ft.fromJSON=Ft.loadSync=Ft.load=Ft.IdempotencyLevel=Ft.isAnyExtension=Ft.Long=void 0;var fxe=f8(),so=QT(),fk=b5(),pk=P5(),pxe=gN();Ft.Long=pxe;function hxe(t){return"@type"in t&&typeof t["@type"]=="string"}Ft.isAnyExtension=hxe;var O5;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(O5=Ft.IdempotencyLevel||(Ft.IdempotencyLevel={}));var N5={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function mxe(t,e){return t===""?e:t+"."+e}function gxe(t){return t instanceof so.Service||t instanceof so.Type||t instanceof so.Enum}function _xe(t){return t instanceof so.Namespace||t instanceof so.Root}function k5(t,e){let r=mxe(e,t.name);return gxe(t)?[[r,t]]:_xe(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>k5(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function lk(t,e){return function(n){return t.toObject(t.decode(n),e)}}function uk(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function yxe(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:O5.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function Sxe(t,e,r,n){let i=t.resolvedRequestType,o=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:uk(i),requestDeserialize:lk(i,r),responseSerialize:uk(o),responseDeserialize:lk(o,r),originalName:fxe(t.name),requestType:dk(i,r,n),responseType:dk(o,r,n),options:yxe(t.parsedOptions)}}function Exe(t,e,r,n){let i={};for(let o of t.methodsArray)i[o.name]=Sxe(o,e,r,n);return i}function dk(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,N5),fileDescriptorProtos:r,serialize:uk(t),deserialize:lk(t,e)}}function vxe(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,N5),fileDescriptorProtos:e}}function Txe(t,e,r,n){if(t instanceof so.Service)return Exe(t,e,r,n);if(t instanceof so.Type)return dk(t,r,n);if(t instanceof so.Enum)return vxe(t,n);throw new Error("Type mismatch in reflection object handling")}function nb(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(o=>Buffer.from(fk.FileDescriptorProto.encode(o).finish()));for(let[o,s]of k5(t,""))r[o]=Txe(s,o,e,i);return r}function M5(t,e){e=e||{};let r=so.Root.fromDescriptor(t);return r.resolveAll(),nb(r,e)}function bxe(t,e){return(0,pk.loadProtosWithOptions)(t,e).then(r=>nb(r,e))}Ft.load=bxe;function Axe(t,e){let r=(0,pk.loadProtosWithOptionsSync)(t,e);return nb(r,e)}Ft.loadSync=Axe;function wxe(t,e){e=e||{};let r=so.Root.fromJSON(t);return r.resolveAll(),nb(r,e)}Ft.fromJSON=wxe;function xxe(t,e){let r=fk.FileDescriptorSet.decode(t);return M5(r,e)}Ft.loadFileDescriptorSetFromBuffer=xxe;function Rxe(t,e){let r=fk.FileDescriptorSet.fromObject(t);return M5(r,e)}Ft.loadFileDescriptorSetFromObject=Rxe;(0,pk.addCommonProtos)()});var va=T(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.registerChannelzSocket=pt.registerChannelzServer=pt.registerChannelzSubchannel=pt.registerChannelzChannel=pt.ChannelzCallTrackerStub=pt.ChannelzCallTracker=pt.ChannelzChildrenTrackerStub=pt.ChannelzChildrenTracker=pt.ChannelzTrace=pt.ChannelzTraceStub=void 0;pt.unregisterChannelzRef=Nxe;pt.getChannelzHandlers=z5;pt.getChannelzServiceDefinition=G5;pt.setup=Gxe;var ob=Q("net"),yl=(DK(),Pr(MK)),Ng=Mr(),kg=Ge(),Ixe=Xr(),Cxe=bT(),Pxe=IT();function mk(t){return{channel_id:t.id,name:t.name}}function Ek(t){return{subchannel_id:t.id,name:t.name}}function Oxe(t){return{server_id:t.id}}function cb(t){return{socket_id:t.id,name:t.name}}var D5=32,vk=100,gk=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:ao(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};pt.ChannelzTraceStub=gk;var _k=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=D5*2&&(this.events=this.events.slice(D5)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:ao(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:ao(e.timestamp),channel_ref:e.childChannel?mk(e.childChannel):null,subchannel_ref:e.childSubchannel?Ek(e.childSubchannel):null}))}}};pt.ChannelzTrace=_k;var sb=class{constructor(){this.channelChildren=new yl.OrderedMap,this.subchannelChildren=new yl.OrderedMap,this.socketChildren=new yl.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};pt.ChannelzChildrenTracker=sb;var yk=class extends sb{refChild(){}unrefChild(){}};pt.ChannelzChildrenTrackerStub=yk;var ab=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};pt.ChannelzCallTracker=ab;var Sk=class extends ab{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};pt.ChannelzCallTrackerStub=Sk;var is={channel:new yl.OrderedMap,subchannel:new yl.OrderedMap,server:new yl.OrderedMap,socket:new yl.OrderedMap},lb=t=>{let e=1;function r(){return e++}let n=is[t];return(i,o,s)=>{let a=r(),c={id:a,name:i,kind:t};return s&&n.setElement(a,{ref:c,getInfo:o}),c}};pt.registerChannelzChannel=lb("channel");pt.registerChannelzSubchannel=lb("subchannel");pt.registerChannelzServer=lb("server");pt.registerChannelzSocket=lb("socket");function Nxe(t){is[t.kind].eraseElementByKey(t.id)}function kxe(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function L5(t){if(t==="")return[];let e=t.split(":").map(n=>kxe(n));return[].concat(...e)}function Mxe(t){return(0,ob.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,ob.isIPv4)(t.substring(7))}function $5(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function Dxe(t){if((0,ob.isIPv4)(t))return $5(t);if(Mxe(t))return $5(t.substring(7));if((0,ob.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(L5(e)),o=Buffer.from(L5(r)),s=Buffer.alloc(16-i.length-o.length,0);return Buffer.concat([i,s,o])}else return null}function F5(t){switch(t){case Ng.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Ng.ConnectivityState.IDLE:return{state:"IDLE"};case Ng.ConnectivityState.READY:return{state:"READY"};case Ng.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Ng.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function ao(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function B5(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(mk(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(Ek(i[1].ref))}),{ref:mk(t.ref),data:{target:e.target,state:F5(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ao(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function Lxe(t,e){let r=parseInt(t.request.channel_id,10),n=is.channel.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:B5(n)})}function $xe(t,e){let r=parseInt(t.request.max_results,10)||vk,n=[],i=parseInt(t.request.start_channel_id,10),o=is.channel,s;for(s=o.lowerBound(i);!s.equals(o.end())&&n.length<r;s=s.next())n.push(B5(s.pointer[1]));e(null,{channel:n,end:s.equals(o.end())})}function j5(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(cb(n[1].ref))}),{ref:Oxe(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ao(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function Uxe(t,e){let r=parseInt(t.request.server_id,10),i=is.server.getElementByKey(r);if(i===void 0){e({code:kg.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:j5(i)})}function Fxe(t,e){let r=parseInt(t.request.max_results,10)||vk,n=parseInt(t.request.start_server_id,10),i=is.server,o=[],s;for(s=i.lowerBound(n);!s.equals(i.end())&&o.length<r;s=s.next())o.push(j5(s.pointer[1]));e(null,{server:o,end:s.equals(i.end())})}function Bxe(t,e){let r=parseInt(t.request.subchannel_id,10),n=is.subchannel.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),o=[];i.children.sockets.forEach(a=>{o.push(cb(a[1].ref))});let s={ref:Ek(n.ref),data:{target:i.target,state:F5(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:ao(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:o};e(null,{subchannel:s})}function U5(t){var e;return(0,Ixe.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=Dxe(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function jxe(t,e){var r,n,i,o,s;let a=parseInt(t.request.socket_id,10),c=is.socket.getElementByKey(a);if(c===void 0){e({code:kg.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(o=l.security.remoteCertificate)!==null&&o!==void 0?o:void 0}}:null,d={ref:cb(c.ref),local:l.localAddress?U5(l.localAddress):null,remote:l.remoteAddress?U5(l.remoteAddress):null,remote_name:(s=l.remoteName)!==null&&s!==void 0?s:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:ao(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:ao(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:ao(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:ao(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function zxe(t,e){let r=parseInt(t.request.server_id,10),n=is.server.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),o=parseInt(t.request.max_results,10)||vk,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<o;l=l.next())c.push(cb(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function z5(){return{GetChannel:Lxe,GetTopChannels:$xe,GetServer:Uxe,GetServers:Fxe,GetSubchannel:Bxe,GetSocket:jxe,GetServerSockets:zxe}}var ib=null;function G5(){if(ib)return ib;let t=hk().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return ib=(0,Pxe.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,ib}function Gxe(){(0,Cxe.registerAdminService)(G5,z5)}});var ub=T(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});Tk.getNextCallNumber=Vxe;var qxe=0;function Vxe(){return qxe++}});var bk=T(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.CompressionAlgorithms=void 0;var q5;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(q5||(db.CompressionAlgorithms=q5={}))});var wk=T(fb=>{"use strict";Object.defineProperty(fb,"__esModule",{value:!0});fb.BaseFilter=void 0;var Ak=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};fb.BaseFilter=Ak});var Pk=T(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.CompressionFilterFactory=Hd.CompressionFilter=void 0;var pb=Q("zlib"),H5=bk(),Ta=Ge(),Hxe=wk(),Wxe=lt(),Yxe=t=>typeof t=="number"&&typeof H5.CompressionAlgorithms[t]=="string",Vd=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},Sl=class extends Vd{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},xk=class extends Vd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.deflate(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createInflate();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},Rk=class extends Vd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.gzip(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createGunzip();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},Ik=class extends Vd{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function V5(t,e){switch(t){case"identity":return new Sl;case"deflate":return new xk(e);case"gzip":return new Rk(e);default:return new Ik(t)}}var hb=class extends Hxe.BaseFilter{constructor(e,r){var n,i,o;super(),this.sharedFilterConfig=r,this.sendCompression=new Sl,this.receiveCompression=new Sl,this.currentCompressionAlgorithm="identity";let s=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ta.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ta.DEFAULT_MAX_SEND_MESSAGE_LENGTH,s!==void 0)if(Yxe(s)){let a=H5.CompressionAlgorithms[s],c=(o=r.serverSupportedEncodingHeader)===null||o===void 0?void 0:o.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=V5(this.currentCompressionAlgorithm,-1))}else Wxe.log(Ta.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${s}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=V5(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new Sl,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ta.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof Sl?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};Hd.CompressionFilter=hb;var Ck=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new hb(this.options,this.sharedFilterConfig)}};Hd.CompressionFilterFactory=Ck});var Mg=T(Ok=>{"use strict";Object.defineProperty(Ok,"__esModule",{value:!0});Ok.restrictControlPlaneStatusCode=Zxe;var co=Ge(),Kxe=[co.Status.OK,co.Status.INVALID_ARGUMENT,co.Status.NOT_FOUND,co.Status.ALREADY_EXISTS,co.Status.FAILED_PRECONDITION,co.Status.ABORTED,co.Status.OUT_OF_RANGE,co.Status.DATA_LOSS];function Zxe(t,e){return Kxe.includes(t)?{code:co.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${co.Status[t]} ${e}`}:{code:t,details:e}}});var Wd=T(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.minDeadline=Jxe;El.getDeadlineTimeoutString=Qxe;El.getRelativeTimeout=tRe;El.deadlineToString=rRe;El.formatDateDifference=nRe;function Jxe(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var Xxe=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function Qxe(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of Xxe){let o=r/i;if(o<1e8)return String(Math.ceil(o))+n}throw new Error("Deadline is too far in the future")}var eRe=2147483647;function tRe(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>eRe?1/0:n}function rRe(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function nRe(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var gb=T(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.FilterStackFactory=Yd.FilterStack=void 0;var mb=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};Yd.FilterStack=mb;var Nk=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new mb(this.factories.map(e=>e.createFilter()))}};Yd.FilterStackFactory=Nk});var W5=T(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});yb.SingleSubchannelChannel=void 0;var iRe=ub(),Dg=va(),oRe=Pk(),sRe=Mr(),Lg=Ge(),aRe=Mg(),cRe=Wd(),lRe=gb(),kk=Kt(),uRe=ui(),_b=kr(),Mk=class{constructor(e,r,n,i,o){var s,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=o,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(s=(0,_b.splitHostPort)(this.options.host))===null||s===void 0?void 0:s.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,cRe.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Lg.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Lg.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new kk.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==sRe.ConnectivityState.READY){r.onReceiveStatus({code:Lg.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new kk.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(s){let a=s,{code:c,details:l}=(0,aRe.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Lg.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new kk.Metadata});return}i.merge(n);let o={onReceiveMetadata:async s=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(s))},onReceiveMessage:async s=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(s);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async s=>{let a=await this.filterStack.receiveTrailers(s);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},Dk=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new Dg.ChannelzTrace,this.callTracker=new Dg.ChannelzCallTracker,this.childrenTracker=new Dg.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,Dg.registerChannelzChannel)((0,_b.uriToString)(r),()=>({target:`${(0,_b.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new lRe.FilterStackFactory([new oRe.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,Dg.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,_b.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,uRe.getDefaultAuthority)(this.target),flags:Lg.Propagate.DEFAULTS,parentCall:null};return new Mk(this.subchannel,e,this.filterStackFactory,n,(0,iRe.getNextCallNumber)())}};yb.SingleSubchannelChannel=Dk});var Y5=T(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});Eb.Subchannel=void 0;var it=Mr(),dRe=Rd(),Lk=lt(),Sb=Ge(),fRe=kr(),pRe=Xr(),lo=va(),hRe=W5(),mRe="subchannel",gRe=~(1<<31),$k=class{constructor(e,r,n,i,o){var s;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=o,this.connectivityState=it.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new dRe.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,pRe.subchannelAddressToString)(r),this.keepaliveTime=(s=n["grpc.keepalive_time_ms"])!==null&&s!==void 0?s:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new lo.ChannelzTraceStub,this.callTracker=new lo.ChannelzCallTrackerStub,this.childrenTracker=new lo.ChannelzChildrenTrackerStub,this.streamTracker=new lo.ChannelzCallTrackerStub):(this.channelzTrace=new lo.ChannelzTrace,this.callTracker=new lo.ChannelzCallTracker,this.childrenTracker=new lo.ChannelzChildrenTracker,this.streamTracker=new lo.ChannelzCallTracker),this.channelzRef=(0,lo.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){Lk.trace(Sb.LogVerbosity.DEBUG,mRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){Lk.trace(Sb.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.CONNECTING):this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,gRe);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([it.ConnectivityState.CONNECTING],it.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([it.ConnectivityState.READY],it.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,Lk.log(Sb.LogVerbosity.ERROR,`Connection to ${(0,fRe.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([it.ConnectivityState.CONNECTING],it.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,o;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(it.ConnectivityState[this.connectivityState]+" -> "+it.ConnectivityState[r]+' with error "'+n+'"'):this.trace(it.ConnectivityState[this.connectivityState]+" -> "+it.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+it.ConnectivityState[r]);let s=this.connectivityState;switch(this.connectivityState=r,r){case it.ConnectivityState.READY:this.stopBackoff();break;case it.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case it.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case it.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(o=this.transport)===null||o===void 0||o.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,s,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,lo.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([it.ConnectivityState.CONNECTING,it.ConnectivityState.READY],it.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let o;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),o={onCallEnd:s=>{s.code===Sb.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):o={},this.transport.createCall(e,r,n,i,o)}startConnecting(){process.nextTick(()=>{this.transitionToState([it.ConnectivityState.IDLE],it.ConnectivityState.CONNECTING)||this.connectivityState===it.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new hRe.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};Eb.Subchannel=$k});var K5=T(vb=>{"use strict";var Uk;Object.defineProperty(vb,"__esModule",{value:!0});vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((Uk=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&Uk!==void 0?Uk:"false")==="true"});var zk=T(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.DEFAULT_PORT=void 0;vl.setup=ARe;var Z5=ui(),Fk=Q("dns"),_Re=LO(),Bk=Ge(),Kd=ll(),yRe=Kt(),SRe=lt(),ERe=Ge(),ba=kr(),J5=Q("net"),vRe=Rd(),X5=K5(),TRe="dns_resolver";function uo(t){SRe.trace(ERe.LogVerbosity.DEBUG,TRe,t)}vl.DEFAULT_PORT=443;var bRe=3e4,jk=class{constructor(e,r,n){var i,o,s;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new Fk.promises.Resolver,uo("Resolver constructed for target "+(0,ba.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,ba.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,J5.isIPv4)(a.host)||(0,J5.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:vl.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(o=a.port)!==null&&o!==void 0?o:vl.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:Bk.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,ba.uriToString)(this.target)}`,metadata:new yRe.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new vRe.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(s=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&s!==void 0?s:bRe,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(uo("Returning IP address for target "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Kd.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)uo("Failed to parse DNS address "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Kd.statusOrFromError)({code:Bk.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,ba.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;uo("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Kd.statusOrFromValue)(r.map(o=>({addresses:[o]})));let n="["+r.map(o=>o.host+":"+o.port).join(",")+"]";uo("Resolved addresses for target "+(0,ba.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(uo("Resolution error for target "+(0,ba.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Kd.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,_Re.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Kd.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Kd.statusOrFromError)({code:Bk.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){uo("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,o)=>o.status==="fulfilled"?[...i,...o.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await Fk.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(uo("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):Fk.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?uo('resolution update delayed by "min time between resolutions" rate limit'):uo("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function ARe(){(0,Z5.registerResolver)("dns",jk),(0,Z5.registerDefaultScheme)("dns")}});var Gk=T(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});Fg.parseCIDR=t9;Fg.mapProxyName=MRe;Fg.getProxiedConnection=DRe;var $g=lt(),Zd=Ge(),e9=Q("net"),wRe=Q("http"),xRe=lt(),Q5=Xr(),Ug=kr(),RRe=Q("url"),IRe=zk(),CRe="proxy";function Jd(t){xRe.trace(Zd.LogVerbosity.DEBUG,CRe,t)}function PRe(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new RRe.URL(t)}catch{return(0,$g.log)(Zd.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,$g.log)(Zd.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,$g.log)(Zd.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,o=r.port;o===""&&(o="80");let s={address:`${i}:${o}`};return n&&(s.creds=n),Jd("Proxy server "+s.address+" set by environment variable "+e),s}function ORe(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Jd("No proxy server list set by environment variable "+e),t.split(",")):[]}function t9(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,e9.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:r9(e[0]),prefixLength:r}}function r9(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function NRe(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(r9(e)&n)===(r&n)}function kRe(t){for(let e of ORe()){let r=t9(e);if((0,e9.isIPv4)(t)&&r&&NRe(r,t))return!0;if(t.endsWith(e))return!0}return!1}function MRe(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=PRe();if(!i.address)return n;let o=(0,Ug.splitHostPort)(t.path);if(!o)return n;let s=o.host;if(kRe(s))return Jd("Not using proxy for target in no_proxy list: "+(0,Ug.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,Ug.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function DRe(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,Ug.parseUri)(n);if(i===null)return Promise.resolve(null);let o=(0,Ug.splitHostPort)(i.path);if(o===null)return Promise.resolve(null);let s=`${o.host}:${(r=o.port)!==null&&r!==void 0?r:IRe.DEFAULT_PORT}`,a={method:"CONNECT",path:s},c={Host:s};(0,Q5.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Q5.subchannelAddressToString)(t);return Jd("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=wRe.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Jd("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Jd("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,$g.log)(Zd.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,$g.log)(Zd.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var Vk=T(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.StreamDecoder=void 0;var fo;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(fo||(fo={}));var qk=class{constructor(e){this.maxReadMessageLength=e,this.readState=fo.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case fo.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=fo.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case fo.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=fo.READING_MESSAGE;else{let o=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=fo.NO_DATA,i.push(o)}}break;case fo.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let o=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),s=Buffer.concat(o,this.readMessageSize+5);this.readState=fo.NO_DATA,i.push(s)}break;default:throw new Error("Unexpected read state")}return i}};Tb.StreamDecoder=qk});var n9=T(bb=>{"use strict";Object.defineProperty(bb,"__esModule",{value:!0});bb.Http2SubchannelCall=void 0;var os=Q("http2"),LRe=Q("os"),ot=Ge(),ss=Kt(),$Re=Vk(),URe=lt(),FRe=Ge(),BRe="subchannel_call";function jRe(t){for(let[e,r]of Object.entries(LRe.constants.errno))if(r===t)return e;return"Unknown system error "+t}function Hk(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=ot.Status.INTERNAL;break;case 401:r=ot.Status.UNAUTHENTICATED;break;case 403:r=ot.Status.PERMISSION_DENIED;break;case 404:r=ot.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=ot.Status.UNAVAILABLE;break;default:r=ot.Status.UNKNOWN}return{code:r,details:e,metadata:new ss.Metadata}}var Wk=class{constructor(e,r,n,i,o){var s;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=o,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(s=i.getOptions()["grpc.max_receive_message_length"])!==null&&s!==void 0?s:ot.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new $Re.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
17
+ `&&++i,++r===n)throw l("comment");x=C,C=d(r)}while(x!=="*"||C!=="/");++r,N&&(f(O,r-2,R),R=!0),y=!0}else return"/"}}while(y);var $=r;ok.lastIndex=0;var _=ok.test(d($++));if(!_)for(;$<n&&!ok.test(d($));)++$;var ee=t.substring(r,r=$);return(ee==='"'||ee==="'")&&(c=ee),ee}function S(y){a.push(y)}function E(){if(!a.length){var y=m();if(y===null)return null;S(y)}return a[0]}function b(y,x){var C=E(),O=C===y;if(O)return m(),!0;if(!x)throw l("token '"+C+"', '"+y+"' expected");return!1}function A(y){var x=null,C;return y===void 0?(C=s[i-1],delete s[i-1],C&&(e||C.type==="*"||C.lineEmpty)&&(x=C.leading?C.text:null)):(o<y&&E(),C=s[y],delete s[y],C&&!C.lineEmpty&&(e||C.type==="/")&&(x=C.leading?null:C.text)),x}return Object.defineProperty({next:m,peek:E,push:S,skip:b,cmnt:A},"line",{get:function(){return i}})}});var l5=T((Oct,c5)=>{"use strict";c5.exports=rs;rs.filename=null;rs.defaults={keepCase:!1};var Nwe=sk(),i5=KT(),o5=VT(),s5=ga(),kwe=FT(),a5=ml(),Mwe=yi(),Dwe=jT(),Lwe=BT(),$we=_a(),Uwe=gl(),ts=Jt(),Fwe=/^[1-9][0-9]*$/,Bwe=/^-?[1-9][0-9]*$/,jwe=/^0[x][0-9a-fA-F]+$/,zwe=/^-?0[x][0-9a-fA-F]+$/,Gwe=/^0[0-7]+$/,qwe=/^-?0[0-7]+$/,Vwe=ts.patterns.numberRe,io=/^[a-zA-Z_][a-zA-Z_0-9]*$/,oo=ts.patterns.typeRefRe;function rs(t,e,r){e instanceof i5||(r=e,e=new i5),r||(r=rs.defaults);var n=r.preferTrailingComment||!1,i=Nwe(t,r.alternateCommentMode||!1),o=i.next,s=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,S=[],E={},b=r.keepCase?function(P){return P}:ts.camelCase;function A(){S.forEach(P=>{P._edition=h,Object.keys(E).forEach(D=>{P.getOption(D)===void 0&&P.setOption(D,E[D],!0)})})}function y(P,D,B){var V=rs.filename;return B||(rs.filename=null),Error("illegal "+(D||"token")+" '"+P+"' ("+(V?V+", ":"")+"line "+i.line+")")}function x(){var P=[],D;do{if((D=o())!=='"'&&D!=="'")throw y(D);P.push(o()),c(D),D=a()}while(D==='"'||D==="'");return P.join("")}function C(P){var D=o();switch(D){case"'":case'"':return s(D),x();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return N(D,!0)}catch{if(P&&oo.test(D))return D;throw y(D,"value")}}function O(P,D){var B,V;do if(D&&((B=a())==='"'||B==="'")){var X=x();if(P.push(X),h>=2023)throw y(X,"id")}else try{P.push([V=R(o()),c("to",!0)?R(o()):V])}catch(G){if(D&&oo.test(B)&&h>=2023)P.push(B);else throw G}while(c(",",!0));var K={options:void 0};K.setOption=function(G,Se){this.options===void 0&&(this.options={}),this.options[G]=Se},v(K,function(Se){if(Se==="option")Re(K,Se),c(";");else throw y(Se)},function(){ye(K)})}function N(P,D){var B=1;switch(P.charAt(0)==="-"&&(B=-1,P=P.substring(1)),P){case"inf":case"INF":case"Inf":return B*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(Fwe.test(P))return B*parseInt(P,10);if(jwe.test(P))return B*parseInt(P,16);if(Gwe.test(P))return B*parseInt(P,8);if(Vwe.test(P))return B*parseFloat(P);throw y(P,"number",D)}function R(P,D){switch(P){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!D&&P.charAt(0)==="-")throw y(P,"id");if(Bwe.test(P))return parseInt(P,10);if(zwe.test(P))return parseInt(P,16);if(qwe.test(P))return parseInt(P,8);throw y(P,"id")}function $(){if(d!==void 0)throw y("package");if(d=o(),!oo.test(d))throw y(d,"name");m=m.define(d),c(";")}function _(){var P=a(),D;switch(P){case"weak":D=p||(p=[]),o();break;case"public":o();default:D=f||(f=[]);break}P=x(),c(";"),D.push(P)}function ee(){if(c("="),h=x(),h<2023)throw y(h,"syntax");c(";")}function k(){if(c("="),h=x(),!["2023"].includes(h))throw y(h,"edition");c(";")}function g(P,D,B){switch(B===void 0&&(B=0),D){case"option":return Re(P,D),c(";"),!0;case"message":return I(P,D,B+1),!0;case"enum":return Ie(P,D),!0;case"service":return Be(P,D,B+1),!0;case"extend":return oe(P,D,B),!0}return!1}function v(P,D,B){var V=i.line;if(P&&(typeof P.comment!="string"&&(P.comment=l()),P.filename=rs.filename),c("{",!0)){for(var X;(X=o())!=="}";)D(X);c(";",!0)}else B&&B(),c(";"),P&&(typeof P.comment!="string"||n)&&(P.comment=l(V)||P.comment)}function I(P,D,B){if(B===void 0&&(B=0),B>ts.nestingLimit)throw Error("max depth exceeded");if(!io.test(D=o()))throw y(D,"type name");var V=new o5(D);v(V,function(K){if(!g(V,K,B))switch(K){case"map":le(V,K);break;case"required":if(h!=="proto2")throw y(K);case"repeated":J(V,K,void 0,B+1);break;case"optional":if(h==="proto3")J(V,"proto3_optional",void 0,B+1);else{if(h!=="proto2")throw y(K);J(V,"optional",void 0,B+1)}break;case"oneof":Oe(V,K,B+1);break;case"extensions":O(V.extensions||(V.extensions=[]));break;case"reserved":O(V.reserved||(V.reserved=[]),!0);break;default:if(h==="proto2"||!oo.test(K))throw y(K);s(K),J(V,"optional",void 0,B+1);break}}),P.add(V),P===m&&S.push(V)}function J(P,D,B,V){var X=o();if(X==="group"){q(P,D,V);return}for(;X.endsWith(".")||a().startsWith(".");)X+=o();if(!oo.test(X))throw y(X,"type");var K=o();if(!io.test(K))throw y(K,"name");K=b(K),c("=");var G=new s5(K,R(o()),X,D,B);if(v(G,function(Ye){if(Ye==="option")Re(G,Ye),c(";");else throw y(Ye)},function(){ye(G)}),D==="proto3_optional"){var Se=new a5("_"+K);G.setOption("proto3_optional",!0),Se.add(G),P.add(Se)}else P.add(G);P===m&&S.push(G)}function q(P,D,B){if(B===void 0&&(B=0),B>ts.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw y("group");var V=o();if(!io.test(V))throw y(V,"name");var X=ts.lcFirst(V);V===X&&(V=ts.ucFirst(V)),c("=");var K=R(o()),G=new o5(V);G.group=!0;var Se=new s5(X,K,V,D);Se.filename=rs.filename,v(G,function(Ye){switch(Ye){case"option":Re(G,Ye),c(";");break;case"required":case"repeated":J(G,Ye,void 0,B+1);break;case"optional":h==="proto3"?J(G,"proto3_optional",void 0,B+1):J(G,"optional",void 0,B+1);break;case"message":I(G,Ye,B+1);break;case"enum":Ie(G,Ye);break;case"reserved":O(G.reserved||(G.reserved=[]),!0);break;default:throw y(Ye)}}),P.add(G).add(Se)}function le(P){c("<");var D=o();if(Uwe.mapKey[D]===void 0)throw y(D,"type");c(",");var B=o();if(!oo.test(B))throw y(B,"type");c(">");var V=o();if(!io.test(V))throw y(V,"name");c("=");var X=new kwe(b(V),R(o()),D,B);v(X,function(G){if(G==="option")Re(X,G),c(";");else throw y(G)},function(){ye(X)}),P.add(X)}function Oe(P,D,B){if(!io.test(D=o()))throw y(D,"name");var V=new a5(b(D));v(V,function(K){K==="option"?(Re(V,K),c(";")):(s(K),J(V,"optional",void 0,B))}),P.add(V)}function Ie(P,D){if(!io.test(D=o()))throw y(D,"name");var B=new Mwe(D);v(B,function(X){switch(X){case"option":Re(B,X),c(";");break;case"reserved":O(B.reserved||(B.reserved=[]),!0),B.reserved===void 0&&(B.reserved=[]);break;default:Ne(B,X)}}),P.add(B),P===m&&S.push(B)}function Ne(P,D){if(!io.test(D))throw y(D,"name");c("=");var B=R(o(),!0),V={options:void 0};V.getOption=function(X){return this.options[X]},V.setOption=function(X,K){$we.prototype.setOption.call(V,X,K)},V.setParsedOption=function(){},v(V,function(K){if(K==="option")Re(V,K),c(";");else throw y(K)},function(){ye(V)}),P.add(D,B,V.comment,V.parsedOptions||V.options)}function Re(P,D){var B,V,X=!0;for(D==="option"&&(D=o());D!=="=";){if(D==="("){var K=o();c(")"),D="("+K+")"}if(X){if(X=!1,D.includes(".")&&!D.includes("(")){var G=D.split(".");B=G[0]+".",D=G[1];continue}B=D}else V=V?V+=D:D;D=o()}var Se=V?B.concat(V):B,xe=ke(P,Se);V=V&&V[0]==="."?V.slice(1):V,B=B&&B[B.length-1]==="."?B.slice(0,-1):B,fe(P,B,xe,V)}function ke(P,D,B){if(B===void 0&&(B=0),B>ts.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var V={};!c("}",!0);){if(!io.test(M=o()))throw y(M,"name");if(M===null)throw y(M,"end of input");var X,K=M;if(c(":",!0),a()==="{")X=ke(P,D+"."+M,B+1);else if(a()==="["){X=[];var G;if(c("[",!0)){do G=C(!0),X.push(G);while(c(",",!0));c("]"),typeof G<"u"&&we(P,D+"."+M,G)}}else X=C(!0),we(P,D+"."+M,X);var Se=V[K];Se&&(X=[].concat(Se).concat(X)),K!=="__proto__"&&(V[K]=X),c(",",!0),c(";",!0)}return V}var xe=C(!0);return we(P,D,xe),xe}function we(P,D,B){if(m===P&&/^features\./.test(D)){E[D]=B;return}P.setOption&&P.setOption(D,B)}function fe(P,D,B,V){P.setParsedOption&&P.setParsedOption(D,B,V)}function ye(P){if(c("[",!0)){do Re(P,"option");while(c(",",!0));c("]")}return P}function Be(P,D,B){if(B===void 0&&(B=0),B>ts.recursionLimit)throw Error("max depth exceeded");if(!io.test(D=o()))throw y(D,"service name");var V=new Dwe(D);v(V,function(K){if(!g(V,K,B))if(K==="rpc")H(V,K);else throw y(K)}),P.add(V),P===m&&S.push(V)}function H(P,D){var B=l(),V=D;if(!io.test(D=o()))throw y(D,"name");var X=D,K,G,Se,xe;if(c("("),c("stream",!0)&&(G=!0),!oo.test(D=o())||(K=D,c(")"),c("returns"),c("("),c("stream",!0)&&(xe=!0),!oo.test(D=o())))throw y(D);Se=D,c(")");var Ye=new Lwe(X,V,K,Se,G,xe);Ye.comment=B,v(Ye,function(Hr){if(Hr==="option")Re(Ye,Hr),c(";");else throw y(Hr)}),P.add(Ye)}function oe(P,D,B){if(!oo.test(D=o()))throw y(D,"reference");var V=D;v(null,function(K){switch(K){case"required":case"repeated":J(P,K,V,B+1);break;case"optional":h==="proto3"?J(P,"proto3_optional",V,B+1):J(P,"optional",V,B+1);break;default:if(h==="proto2"||!oo.test(K))throw y(K);s(K),J(P,"optional",V,B+1);break}})}for(var M;(M=o())!==null;)switch(M){case"package":if(!u)throw y(M);$();break;case"import":if(!u)throw y(M);_();break;case"syntax":if(!u)throw y(M);ee();break;case"edition":if(!u)throw y(M);k();break;case"option":Re(m,M),c(";",!0);break;default:if(g(m,M,0)){u=!1;continue}throw y(M)}return A(),rs.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var f5=T((Nct,d5)=>{"use strict";d5.exports=vi;var Hwe=/\/|\./;function vi(t,e){Hwe.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),vi[t]=e}vi("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var u5;vi("duration",{Duration:u5={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});vi("timestamp",{Timestamp:u5});vi("empty",{Empty:{fields:{}}});vi("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});vi("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});vi("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});vi.get=function(e){return vi[e]||null}});var h5=T((kct,p5)=>{"use strict";var ya=p5.exports=e5();ya.build="full";ya.tokenize=sk();ya.parse=l5();ya.common=f5();ya.Root._configure(ya.Type,ya.parse,ya.common)});var QT=T((Mct,m5)=>{"use strict";m5.exports=h5()});var ak=T((Dct,Wwe)=>{Wwe.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var b5=T((ze,T5)=>{"use strict";var Dr=QT();T5.exports=ze=Dr.descriptor=Dr.Root.fromJSON(ak()).lookup(".google.protobuf");var g5=Dr.Namespace,Pg=Dr.Root,ns=Dr.Enum,Ti=Dr.Type,Sa=Dr.Field,Ywe=Dr.MapField,eb=Dr.OneOf,Og=Dr.Service,tb=Dr.Method,_5=Dr.util.patterns,Kwe=_5.numberRe,rb=_5.typeRefRe;Pg.fromDescriptor=function(e){typeof e.length=="number"&&(e=ze.FileDescriptorSet.decode(e));var r=new Pg;if(e.file)for(var n,i,o=0,s;o<e.file.length;++o){i=r,(n=e.file[o]).package&&n.package.length&&(i=r.define(n.package));var a=ixe(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(s=0;s<n.messageType.length;++s)i.add(Ti.fromDescriptor(n.messageType[s],a));if(n.enumType)for(s=0;s<n.enumType.length;++s)i.add(ns.fromDescriptor(n.enumType[s],a));if(n.extension)for(s=0;s<n.extension.length;++s)i.add(Sa.fromDescriptor(n.extension[s],a));if(n.service)for(s=0;s<n.service.length;++s)i.add(Og.fromDescriptor(n.service[s],a));var c=zd(n.options,ze.FileOptions);if(c){var l=Object.keys(c);for(s=0;s<l.length;++s)i.setOption(l[s],c[l[s]])}}return r.resolveAll()};Pg.prototype.toDescriptor=function(e){var r=ze.FileDescriptorSet.create();return y5(this,r.file,e),r};function y5(t,e,r){var n=ze.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});oxe(r,n),t instanceof Pg||(n.package=t.fullName.substring(1));for(var i=0,o;i<t.nestedArray.length;++i)(o=t._nestedArray[i])instanceof Ti?n.messageType.push(o.toDescriptor(r)):o instanceof ns?n.enumType.push(o.toDescriptor()):o instanceof Sa?n.extension.push(o.toDescriptor(r)):o instanceof Og?n.service.push(o.toDescriptor()):o instanceof g5&&y5(o,e,r);n.options=Gd(t.options,ze.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var Zwe=0;Ti.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>Dr.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=ze.DescriptorProto.decode(e));var o=new Ti(e.name.length?e.name:"Type"+Zwe++,zd(e.options,ze.MessageOptions)),s;if(n||(o._edition=r),e.oneofDecl)for(s=0;s<e.oneofDecl.length;++s)o.add(eb.fromDescriptor(e.oneofDecl[s]));if(e.field)for(s=0;s<e.field.length;++s){var a=Sa.fromDescriptor(e.field[s],r,!0);o.add(a),e.field[s].hasOwnProperty("oneofIndex")&&o.oneofsArray[e.field[s].oneofIndex].add(a)}if(e.extension)for(s=0;s<e.extension.length;++s)o.add(Sa.fromDescriptor(e.extension[s],r,!0));if(e.nestedType)for(s=0;s<e.nestedType.length;++s)o.add(Ti.fromDescriptor(e.nestedType[s],r,!0,i+1)),e.nestedType[s].options&&e.nestedType[s].options.mapEntry&&o.setOption("map_entry",!0);if(e.enumType)for(s=0;s<e.enumType.length;++s)o.add(ns.fromDescriptor(e.enumType[s],r,!0));if(e.extensionRange&&e.extensionRange.length)for(o.extensions=[],s=0;s<e.extensionRange.length;++s)o.extensions.push([e.extensionRange[s].start,e.extensionRange[s].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(o.reserved=[],e.reservedRange)for(s=0;s<e.reservedRange.length;++s)o.reserved.push([e.reservedRange[s].start,e.reservedRange[s].end]);if(e.reservedName)for(s=0;s<e.reservedName.length;++s)o.reserved.push(e.reservedName[s])}return o};Ti.prototype.toDescriptor=function(e){var r=ze.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof Ywe){var o=ck(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),s=ck(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=s===11||s===14?this._fieldsArray[n].resolvedType&&v5(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(ze.DescriptorProto.create({name:i.typeName,field:[ze.FieldDescriptorProto.create({name:"key",number:1,label:1,type:o}),ze.FieldDescriptorProto.create({name:"value",number:2,label:1,type:s,typeName:a})],options:ze.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Sa?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Ti?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof ns&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(ze.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(ze.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=Gd(this.options,ze.MessageOptions),r};Sa.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=ze.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,o;if(i!=null&&i!==""){if(typeof i!="string"||!rb.test(i))throw Error("illegal type name: "+i);o=i}else o=txe(e.type);var s;switch(e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!rb.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Sa(e.name.length?e.name:"field"+e.number,e.number,o,s,a);if(n||(c._edition=r),c.options=zd(e.options,ze.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=Kwe.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return rxe(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Sa.prototype.toDescriptor=function(e){var r=ze.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=Dr.util.ucFirst(this.name),r.label=3;else{switch(r.type=ck(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?v5(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof Ti&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=Gd(this.options,ze.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=ze.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=ze.FieldOptions.create())).packed=!0),r};var Jwe=0;ns.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=ze.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var o=0;o<e.value.length;++o){var s=e.value[o].name,a=e.value[o].number||0;i[s&&s.length?s:"NAME"+a]=a}var c=new ns(e.name&&e.name.length?e.name:"Enum"+Jwe++,i,zd(e.options,ze.EnumOptions));return n||(c._edition=r),c};ns.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(ze.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return ze.EnumDescriptorProto.create({name:this.name,value:e,options:Gd(this.options,ze.EnumOptions)})};var Xwe=0;eb.fromDescriptor=function(e){return typeof e.length=="number"&&(e=ze.OneofDescriptorProto.decode(e)),new eb(e.name&&e.name.length?e.name:"oneof"+Xwe++)};eb.prototype.toDescriptor=function(){return ze.OneofDescriptorProto.create({name:this.name})};var Qwe=0;Og.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=ze.ServiceDescriptorProto.decode(e));var i=new Og(e.name&&e.name.length?e.name:"Service"+Qwe++,zd(e.options,ze.ServiceOptions));if(n||(i._edition=r),e.method)for(var o=0;o<e.method.length;++o)i.add(tb.fromDescriptor(e.method[o]));return i};Og.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return ze.ServiceDescriptorProto.create({name:this.name,method:e,options:Gd(this.options,ze.ServiceOptions)})};var exe=0;tb.fromDescriptor=function(e){typeof e.length=="number"&&(e=ze.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!rb.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!rb.test(n)))throw Error("illegal type name: "+n);return new tb(e.name&&e.name.length?e.name:"Method"+exe++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,zd(e.options,ze.MethodOptions))};tb.prototype.toDescriptor=function(){return ze.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:Gd(this.options,ze.MethodOptions)})};function txe(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function rxe(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function ck(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof ns)return 14;if(e instanceof Ti)return r?10:11;throw Error("illegal type: "+t)}function S5(t,e){for(var r={},n=0,i,o;n<e.fieldsArray.length;++n)if((o=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,o)){var s=nxe(o);i.resolvedType instanceof Ti?r[s]=S5(t[o],i.resolvedType):i.resolvedType instanceof ns?r[s]=i.resolvedType.valuesById[t[o]]:r[s]=t[o]}return r}function zd(t,e){if(t)return S5(e.toObject(t),e)}function E5(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var o=n[i],s=Dr.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(e.fields,s)){var a=e.fields[s];a.resolvedType instanceof Ti?r[s]=E5(t[o],a.resolvedType):r[s]=t[o],a.repeated&&!Array.isArray(r[s])&&(r[s]=[r[s]])}}return r}function Gd(t,e){if(t)return e.fromObject(E5(t,e))}function v5(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,o=0,s=n.length-1;if(!(t instanceof Pg)&&e instanceof g5)for(;i<r.length&&o<s&&r[i]===n[o];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++o}else for(;i<r.length&&o<s&&r[i]===n[o];++i,++o);return n.slice(o).join(".")}function nxe(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function ixe(t){if(t.syntax==="editions"){if(t.edition===ze.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function oxe(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=ze.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var A5=T((Lct,sxe)=>{sxe.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var w5=T(($ct,axe)=>{axe.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var x5=T((Uct,cxe)=>{cxe.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var P5=T(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.addCommonProtos=Ea.loadProtosWithOptionsSync=Ea.loadProtosWithOptions=void 0;var R5=Q("fs"),I5=Q("path"),qd=QT();function C5(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(I5.isAbsolute(i))return i;for(let o of e){let s=I5.join(o,i);try{return R5.accessSync(s,R5.constants.R_OK),s}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function lxe(t,e){let r=new qd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));C5(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptions=lxe;function uxe(t,e){let r=new qd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");C5(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptionsSync=uxe;function dxe(){let t=A5(),e=ak(),r=w5(),n=x5();qd.common("api",t.nested.google.nested.protobuf.nested),qd.common("descriptor",e.nested.google.nested.protobuf.nested),qd.common("source_context",r.nested.google.nested.protobuf.nested),qd.common("type",n.nested.google.nested.protobuf.nested)}Ea.addCommonProtos=dxe});var hk=T(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.loadFileDescriptorSetFromObject=Ft.loadFileDescriptorSetFromBuffer=Ft.fromJSON=Ft.loadSync=Ft.load=Ft.IdempotencyLevel=Ft.isAnyExtension=Ft.Long=void 0;var fxe=f8(),so=QT(),fk=b5(),pk=P5(),pxe=gN();Ft.Long=pxe;function hxe(t){return"@type"in t&&typeof t["@type"]=="string"}Ft.isAnyExtension=hxe;var O5;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(O5=Ft.IdempotencyLevel||(Ft.IdempotencyLevel={}));var N5={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function mxe(t,e){return t===""?e:t+"."+e}function gxe(t){return t instanceof so.Service||t instanceof so.Type||t instanceof so.Enum}function _xe(t){return t instanceof so.Namespace||t instanceof so.Root}function k5(t,e){let r=mxe(e,t.name);return gxe(t)?[[r,t]]:_xe(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>k5(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function lk(t,e){return function(n){return t.toObject(t.decode(n),e)}}function uk(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function yxe(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:O5.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function Sxe(t,e,r,n){let i=t.resolvedRequestType,o=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:uk(i),requestDeserialize:lk(i,r),responseSerialize:uk(o),responseDeserialize:lk(o,r),originalName:fxe(t.name),requestType:dk(i,r,n),responseType:dk(o,r,n),options:yxe(t.parsedOptions)}}function Exe(t,e,r,n){let i={};for(let o of t.methodsArray)i[o.name]=Sxe(o,e,r,n);return i}function dk(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,N5),fileDescriptorProtos:r,serialize:uk(t),deserialize:lk(t,e)}}function vxe(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,N5),fileDescriptorProtos:e}}function Txe(t,e,r,n){if(t instanceof so.Service)return Exe(t,e,r,n);if(t instanceof so.Type)return dk(t,r,n);if(t instanceof so.Enum)return vxe(t,n);throw new Error("Type mismatch in reflection object handling")}function nb(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(o=>Buffer.from(fk.FileDescriptorProto.encode(o).finish()));for(let[o,s]of k5(t,""))r[o]=Txe(s,o,e,i);return r}function M5(t,e){e=e||{};let r=so.Root.fromDescriptor(t);return r.resolveAll(),nb(r,e)}function bxe(t,e){return(0,pk.loadProtosWithOptions)(t,e).then(r=>nb(r,e))}Ft.load=bxe;function Axe(t,e){let r=(0,pk.loadProtosWithOptionsSync)(t,e);return nb(r,e)}Ft.loadSync=Axe;function wxe(t,e){e=e||{};let r=so.Root.fromJSON(t);return r.resolveAll(),nb(r,e)}Ft.fromJSON=wxe;function xxe(t,e){let r=fk.FileDescriptorSet.decode(t);return M5(r,e)}Ft.loadFileDescriptorSetFromBuffer=xxe;function Rxe(t,e){let r=fk.FileDescriptorSet.fromObject(t);return M5(r,e)}Ft.loadFileDescriptorSetFromObject=Rxe;(0,pk.addCommonProtos)()});var va=T(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.registerChannelzSocket=pt.registerChannelzServer=pt.registerChannelzSubchannel=pt.registerChannelzChannel=pt.ChannelzCallTrackerStub=pt.ChannelzCallTracker=pt.ChannelzChildrenTrackerStub=pt.ChannelzChildrenTracker=pt.ChannelzTrace=pt.ChannelzTraceStub=void 0;pt.unregisterChannelzRef=Nxe;pt.getChannelzHandlers=z5;pt.getChannelzServiceDefinition=G5;pt.setup=Gxe;var ob=Q("net"),yl=(DK(),Pr(MK)),Ng=Mr(),kg=Ge(),Ixe=Xr(),Cxe=bT(),Pxe=IT();function mk(t){return{channel_id:t.id,name:t.name}}function Ek(t){return{subchannel_id:t.id,name:t.name}}function Oxe(t){return{server_id:t.id}}function cb(t){return{socket_id:t.id,name:t.name}}var D5=32,vk=100,gk=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:ao(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};pt.ChannelzTraceStub=gk;var _k=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=D5*2&&(this.events=this.events.slice(D5)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:ao(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:ao(e.timestamp),channel_ref:e.childChannel?mk(e.childChannel):null,subchannel_ref:e.childSubchannel?Ek(e.childSubchannel):null}))}}};pt.ChannelzTrace=_k;var sb=class{constructor(){this.channelChildren=new yl.OrderedMap,this.subchannelChildren=new yl.OrderedMap,this.socketChildren=new yl.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};pt.ChannelzChildrenTracker=sb;var yk=class extends sb{refChild(){}unrefChild(){}};pt.ChannelzChildrenTrackerStub=yk;var ab=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};pt.ChannelzCallTracker=ab;var Sk=class extends ab{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};pt.ChannelzCallTrackerStub=Sk;var is={channel:new yl.OrderedMap,subchannel:new yl.OrderedMap,server:new yl.OrderedMap,socket:new yl.OrderedMap},lb=t=>{let e=1;function r(){return e++}let n=is[t];return(i,o,s)=>{let a=r(),c={id:a,name:i,kind:t};return s&&n.setElement(a,{ref:c,getInfo:o}),c}};pt.registerChannelzChannel=lb("channel");pt.registerChannelzSubchannel=lb("subchannel");pt.registerChannelzServer=lb("server");pt.registerChannelzSocket=lb("socket");function Nxe(t){is[t.kind].eraseElementByKey(t.id)}function kxe(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function L5(t){if(t==="")return[];let e=t.split(":").map(n=>kxe(n));return[].concat(...e)}function Mxe(t){return(0,ob.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,ob.isIPv4)(t.substring(7))}function $5(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function Dxe(t){if((0,ob.isIPv4)(t))return $5(t);if(Mxe(t))return $5(t.substring(7));if((0,ob.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(L5(e)),o=Buffer.from(L5(r)),s=Buffer.alloc(16-i.length-o.length,0);return Buffer.concat([i,s,o])}else return null}function F5(t){switch(t){case Ng.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Ng.ConnectivityState.IDLE:return{state:"IDLE"};case Ng.ConnectivityState.READY:return{state:"READY"};case Ng.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Ng.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function ao(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function B5(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(mk(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(Ek(i[1].ref))}),{ref:mk(t.ref),data:{target:e.target,state:F5(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ao(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function Lxe(t,e){let r=parseInt(t.request.channel_id,10),n=is.channel.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:B5(n)})}function $xe(t,e){let r=parseInt(t.request.max_results,10)||vk,n=[],i=parseInt(t.request.start_channel_id,10),o=is.channel,s;for(s=o.lowerBound(i);!s.equals(o.end())&&n.length<r;s=s.next())n.push(B5(s.pointer[1]));e(null,{channel:n,end:s.equals(o.end())})}function j5(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(cb(n[1].ref))}),{ref:Oxe(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ao(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function Uxe(t,e){let r=parseInt(t.request.server_id,10),i=is.server.getElementByKey(r);if(i===void 0){e({code:kg.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:j5(i)})}function Fxe(t,e){let r=parseInt(t.request.max_results,10)||vk,n=parseInt(t.request.start_server_id,10),i=is.server,o=[],s;for(s=i.lowerBound(n);!s.equals(i.end())&&o.length<r;s=s.next())o.push(j5(s.pointer[1]));e(null,{server:o,end:s.equals(i.end())})}function Bxe(t,e){let r=parseInt(t.request.subchannel_id,10),n=is.subchannel.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),o=[];i.children.sockets.forEach(a=>{o.push(cb(a[1].ref))});let s={ref:Ek(n.ref),data:{target:i.target,state:F5(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:ao(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:o};e(null,{subchannel:s})}function U5(t){var e;return(0,Ixe.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=Dxe(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function jxe(t,e){var r,n,i,o,s;let a=parseInt(t.request.socket_id,10),c=is.socket.getElementByKey(a);if(c===void 0){e({code:kg.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(o=l.security.remoteCertificate)!==null&&o!==void 0?o:void 0}}:null,d={ref:cb(c.ref),local:l.localAddress?U5(l.localAddress):null,remote:l.remoteAddress?U5(l.remoteAddress):null,remote_name:(s=l.remoteName)!==null&&s!==void 0?s:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:ao(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:ao(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:ao(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:ao(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function zxe(t,e){let r=parseInt(t.request.server_id,10),n=is.server.getElementByKey(r);if(n===void 0){e({code:kg.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),o=parseInt(t.request.max_results,10)||vk,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<o;l=l.next())c.push(cb(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function z5(){return{GetChannel:Lxe,GetTopChannels:$xe,GetServer:Uxe,GetServers:Fxe,GetSubchannel:Bxe,GetSocket:jxe,GetServerSockets:zxe}}var ib=null;function G5(){if(ib)return ib;let t=hk().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return ib=(0,Pxe.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,ib}function Gxe(){(0,Cxe.registerAdminService)(G5,z5)}});var ub=T(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});Tk.getNextCallNumber=Vxe;var qxe=0;function Vxe(){return qxe++}});var bk=T(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.CompressionAlgorithms=void 0;var q5;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(q5||(db.CompressionAlgorithms=q5={}))});var wk=T(fb=>{"use strict";Object.defineProperty(fb,"__esModule",{value:!0});fb.BaseFilter=void 0;var Ak=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};fb.BaseFilter=Ak});var Pk=T(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.CompressionFilterFactory=Hd.CompressionFilter=void 0;var pb=Q("zlib"),H5=bk(),Ta=Ge(),Hxe=wk(),Wxe=lt(),Yxe=t=>typeof t=="number"&&typeof H5.CompressionAlgorithms[t]=="string",Vd=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},Sl=class extends Vd{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},xk=class extends Vd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.deflate(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createInflate();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},Rk=class extends Vd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.gzip(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createGunzip();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},Ik=class extends Vd{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function V5(t,e){switch(t){case"identity":return new Sl;case"deflate":return new xk(e);case"gzip":return new Rk(e);default:return new Ik(t)}}var hb=class extends Hxe.BaseFilter{constructor(e,r){var n,i,o;super(),this.sharedFilterConfig=r,this.sendCompression=new Sl,this.receiveCompression=new Sl,this.currentCompressionAlgorithm="identity";let s=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ta.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ta.DEFAULT_MAX_SEND_MESSAGE_LENGTH,s!==void 0)if(Yxe(s)){let a=H5.CompressionAlgorithms[s],c=(o=r.serverSupportedEncodingHeader)===null||o===void 0?void 0:o.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=V5(this.currentCompressionAlgorithm,-1))}else Wxe.log(Ta.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${s}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=V5(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new Sl,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ta.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof Sl?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};Hd.CompressionFilter=hb;var Ck=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new hb(this.options,this.sharedFilterConfig)}};Hd.CompressionFilterFactory=Ck});var Mg=T(Ok=>{"use strict";Object.defineProperty(Ok,"__esModule",{value:!0});Ok.restrictControlPlaneStatusCode=Zxe;var co=Ge(),Kxe=[co.Status.OK,co.Status.INVALID_ARGUMENT,co.Status.NOT_FOUND,co.Status.ALREADY_EXISTS,co.Status.FAILED_PRECONDITION,co.Status.ABORTED,co.Status.OUT_OF_RANGE,co.Status.DATA_LOSS];function Zxe(t,e){return Kxe.includes(t)?{code:co.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${co.Status[t]} ${e}`}:{code:t,details:e}}});var Wd=T(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.minDeadline=Jxe;El.getDeadlineTimeoutString=Qxe;El.getRelativeTimeout=tRe;El.deadlineToString=rRe;El.formatDateDifference=nRe;function Jxe(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var Xxe=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function Qxe(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of Xxe){let o=r/i;if(o<1e8)return String(Math.ceil(o))+n}throw new Error("Deadline is too far in the future")}var eRe=2147483647;function tRe(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>eRe?1/0:n}function rRe(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function nRe(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var gb=T(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.FilterStackFactory=Yd.FilterStack=void 0;var mb=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};Yd.FilterStack=mb;var Nk=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new mb(this.factories.map(e=>e.createFilter()))}};Yd.FilterStackFactory=Nk});var W5=T(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});yb.SingleSubchannelChannel=void 0;var iRe=ub(),Dg=va(),oRe=Pk(),sRe=Mr(),Lg=Ge(),aRe=Mg(),cRe=Wd(),lRe=gb(),kk=Kt(),uRe=ui(),_b=kr(),Mk=class{constructor(e,r,n,i,o){var s,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=o,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(s=(0,_b.splitHostPort)(this.options.host))===null||s===void 0?void 0:s.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,cRe.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Lg.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Lg.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new kk.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==sRe.ConnectivityState.READY){r.onReceiveStatus({code:Lg.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new kk.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(s){let a=s,{code:c,details:l}=(0,aRe.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Lg.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new kk.Metadata});return}i.merge(n);let o={onReceiveMetadata:async s=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(s))},onReceiveMessage:async s=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(s);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async s=>{let a=await this.filterStack.receiveTrailers(s);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},Dk=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new Dg.ChannelzTrace,this.callTracker=new Dg.ChannelzCallTracker,this.childrenTracker=new Dg.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,Dg.registerChannelzChannel)((0,_b.uriToString)(r),()=>({target:`${(0,_b.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new lRe.FilterStackFactory([new oRe.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,Dg.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,_b.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,uRe.getDefaultAuthority)(this.target),flags:Lg.Propagate.DEFAULTS,parentCall:null};return new Mk(this.subchannel,e,this.filterStackFactory,n,(0,iRe.getNextCallNumber)())}};yb.SingleSubchannelChannel=Dk});var Y5=T(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});Eb.Subchannel=void 0;var it=Mr(),dRe=Rd(),Lk=lt(),Sb=Ge(),fRe=kr(),pRe=Xr(),lo=va(),hRe=W5(),mRe="subchannel",gRe=~(1<<31),$k=class{constructor(e,r,n,i,o){var s;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=o,this.connectivityState=it.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new dRe.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,pRe.subchannelAddressToString)(r),this.keepaliveTime=(s=n["grpc.keepalive_time_ms"])!==null&&s!==void 0?s:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new lo.ChannelzTraceStub,this.callTracker=new lo.ChannelzCallTrackerStub,this.childrenTracker=new lo.ChannelzChildrenTrackerStub,this.streamTracker=new lo.ChannelzCallTrackerStub):(this.channelzTrace=new lo.ChannelzTrace,this.callTracker=new lo.ChannelzCallTracker,this.childrenTracker=new lo.ChannelzChildrenTracker,this.streamTracker=new lo.ChannelzCallTracker),this.channelzRef=(0,lo.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){Lk.trace(Sb.LogVerbosity.DEBUG,mRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){Lk.trace(Sb.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.CONNECTING):this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,gRe);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([it.ConnectivityState.CONNECTING],it.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([it.ConnectivityState.READY],it.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,Lk.log(Sb.LogVerbosity.ERROR,`Connection to ${(0,fRe.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([it.ConnectivityState.CONNECTING],it.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,o;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(it.ConnectivityState[this.connectivityState]+" -> "+it.ConnectivityState[r]+' with error "'+n+'"'):this.trace(it.ConnectivityState[this.connectivityState]+" -> "+it.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+it.ConnectivityState[r]);let s=this.connectivityState;switch(this.connectivityState=r,r){case it.ConnectivityState.READY:this.stopBackoff();break;case it.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case it.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case it.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(o=this.transport)===null||o===void 0||o.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,s,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,lo.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([it.ConnectivityState.CONNECTING,it.ConnectivityState.READY],it.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let o;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),o={onCallEnd:s=>{s.code===Sb.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):o={},this.transport.createCall(e,r,n,i,o)}startConnecting(){process.nextTick(()=>{this.transitionToState([it.ConnectivityState.IDLE],it.ConnectivityState.CONNECTING)||this.connectivityState===it.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([it.ConnectivityState.TRANSIENT_FAILURE],it.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new hRe.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};Eb.Subchannel=$k});var K5=T(vb=>{"use strict";var Uk;Object.defineProperty(vb,"__esModule",{value:!0});vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((Uk=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&Uk!==void 0?Uk:"false")==="true"});var zk=T(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.DEFAULT_PORT=void 0;vl.setup=ARe;var Z5=ui(),Fk=Q("dns"),_Re=LO(),Bk=Ge(),Kd=ll(),yRe=Kt(),SRe=lt(),ERe=Ge(),ba=kr(),J5=Q("net"),vRe=Rd(),X5=K5(),TRe="dns_resolver";function uo(t){SRe.trace(ERe.LogVerbosity.DEBUG,TRe,t)}vl.DEFAULT_PORT=443;var bRe=3e4,jk=class{constructor(e,r,n){var i,o,s;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new Fk.promises.Resolver,uo("Resolver constructed for target "+(0,ba.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,ba.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,J5.isIPv4)(a.host)||(0,J5.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:vl.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(o=a.port)!==null&&o!==void 0?o:vl.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:Bk.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,ba.uriToString)(this.target)}`,metadata:new yRe.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new vRe.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(s=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&s!==void 0?s:bRe,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(uo("Returning IP address for target "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Kd.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)uo("Failed to parse DNS address "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Kd.statusOrFromError)({code:Bk.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,ba.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;uo("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Kd.statusOrFromValue)(r.map(o=>({addresses:[o]})));let n="["+r.map(o=>o.host+":"+o.port).join(",")+"]";uo("Resolved addresses for target "+(0,ba.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(uo("Resolution error for target "+(0,ba.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Kd.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,_Re.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Kd.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Kd.statusOrFromError)({code:Bk.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){uo("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,o)=>o.status==="fulfilled"?[...i,...o.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await Fk.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(uo("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):Fk.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?uo('resolution update delayed by "min time between resolutions" rate limit'):uo("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function ARe(){(0,Z5.registerResolver)("dns",jk),(0,Z5.registerDefaultScheme)("dns")}});var Gk=T(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});Fg.parseCIDR=t9;Fg.mapProxyName=MRe;Fg.getProxiedConnection=DRe;var $g=lt(),Zd=Ge(),e9=Q("net"),wRe=Q("http"),xRe=lt(),Q5=Xr(),Ug=kr(),RRe=Q("url"),IRe=zk(),CRe="proxy";function Jd(t){xRe.trace(Zd.LogVerbosity.DEBUG,CRe,t)}function PRe(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new RRe.URL(t)}catch{return(0,$g.log)(Zd.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,$g.log)(Zd.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,$g.log)(Zd.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,o=r.port;o===""&&(o="80");let s={address:`${i}:${o}`};return n&&(s.creds=n),Jd("Proxy server "+s.address+" set by environment variable "+e),s}function ORe(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Jd("No proxy server list set by environment variable "+e),t.split(",")):[]}function t9(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,e9.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:r9(e[0]),prefixLength:r}}function r9(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function NRe(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(r9(e)&n)===(r&n)}function kRe(t){for(let e of ORe()){let r=t9(e);if((0,e9.isIPv4)(t)&&r&&NRe(r,t))return!0;if(t.endsWith(e))return!0}return!1}function MRe(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=PRe();if(!i.address)return n;let o=(0,Ug.splitHostPort)(t.path);if(!o)return n;let s=o.host;if(kRe(s))return Jd("Not using proxy for target in no_proxy list: "+(0,Ug.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,Ug.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function DRe(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,Ug.parseUri)(n);if(i===null)return Promise.resolve(null);let o=(0,Ug.splitHostPort)(i.path);if(o===null)return Promise.resolve(null);let s=`${o.host}:${(r=o.port)!==null&&r!==void 0?r:IRe.DEFAULT_PORT}`,a={method:"CONNECT",path:s},c={Host:s};(0,Q5.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Q5.subchannelAddressToString)(t);return Jd("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=wRe.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Jd("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Jd("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,$g.log)(Zd.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,$g.log)(Zd.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var Vk=T(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.StreamDecoder=void 0;var fo;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(fo||(fo={}));var qk=class{constructor(e){this.maxReadMessageLength=e,this.readState=fo.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case fo.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=fo.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case fo.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=fo.READING_MESSAGE;else{let o=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=fo.NO_DATA,i.push(o)}}break;case fo.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let o=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),s=Buffer.concat(o,this.readMessageSize+5);this.readState=fo.NO_DATA,i.push(s)}break;default:throw new Error("Unexpected read state")}return i}};Tb.StreamDecoder=qk});var n9=T(bb=>{"use strict";Object.defineProperty(bb,"__esModule",{value:!0});bb.Http2SubchannelCall=void 0;var os=Q("http2"),LRe=Q("os"),ot=Ge(),ss=Kt(),$Re=Vk(),URe=lt(),FRe=Ge(),BRe="subchannel_call";function jRe(t){for(let[e,r]of Object.entries(LRe.constants.errno))if(r===t)return e;return"Unknown system error "+t}function Hk(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=ot.Status.INTERNAL;break;case 401:r=ot.Status.UNAUTHENTICATED;break;case 403:r=ot.Status.PERMISSION_DENIED;break;case 404:r=ot.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=ot.Status.UNAVAILABLE;break;default:r=ot.Status.UNKNOWN}return{code:r,details:e,metadata:new ss.Metadata}}var Wk=class{constructor(e,r,n,i,o){var s;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=o,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(s=i.getOptions()["grpc.max_receive_message_length"])!==null&&s!==void 0?s:ot.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new $Re.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
18
18
  `;if(this.trace(`Received server headers:
19
19
  `+u),this.httpStatusCode=c[":status"],l&os.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(c);else{let d;try{d=ss.Metadata.fromHttp2Headers(c)}catch(f){this.endCall({code:ot.Status.UNKNOWN,details:f.message,metadata:new ss.Metadata});return}this.listener.onReceiveMetadata(d)}}),e.on("trailers",c=>{this.handleTrailers(c)}),e.on("data",c=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+c.length);let l;try{l=this.decoder.write(c)}catch(u){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let d=Hk(this.httpStatusCode);this.cancelWithStatus(d.code,d.details)}else this.cancelWithStatus(ot.Status.RESOURCE_EXHAUSTED,u.message);return}for(let u of l)this.trace("parsed message of length "+u.length),this.callEventTracker.addMessageReceived(),this.tryPush(u)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var c;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),((c=this.finalStatus)===null||c===void 0?void 0:c.code)===ot.Status.OK)return;let l,u="";switch(e.rstCode){case os.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let d=Hk(this.httpStatusCode);l=d.code,u=d.details}else l=ot.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case os.constants.NGHTTP2_REFUSED_STREAM:l=ot.Status.UNAVAILABLE,u="Stream refused by server";break;case os.constants.NGHTTP2_CANCEL:this.connectionDropped?(l=ot.Status.UNAVAILABLE,u="Connection dropped"):(l=ot.Status.CANCELLED,u="Call cancelled");break;case os.constants.NGHTTP2_ENHANCE_YOUR_CALM:l=ot.Status.RESOURCE_EXHAUSTED,u="Bandwidth exhausted or memory limit exceeded";break;case os.constants.NGHTTP2_INADEQUATE_SECURITY:l=ot.Status.PERMISSION_DENIED,u="Protocol not secure enough";break;case os.constants.NGHTTP2_INTERNAL_ERROR:l=ot.Status.INTERNAL,this.internalError===null?u=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(l=ot.Status.UNAVAILABLE,u=this.internalError.message):u=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:l=ot.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:l,details:u,metadata:new ss.Metadata,rstCode:e.rstCode})})}),e.on("error",c=>{c.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.trace("Node error event: message="+c.message+" code="+c.code+" errno="+jRe(c.errno)+" syscall="+c.syscall),this.internalError=c),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:ot.Status.UNAVAILABLE,details:"Connection dropped",metadata:new ss.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){URe.trace(FRe.LogVerbosity.DEBUG,BRe,"["+this.callId+"] "+e)}endCall(e){(this.finalStatus===null||this.finalStatus.code===ot.Status.OK)&&(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==ot.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,!this.statusOutput&&(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let r="";for(let s of Object.keys(e))r+=" "+s+": "+e[s]+`
20
20
  `;this.trace(`Received server trailers:
21
21
  `+r);let n;try{n=ss.Metadata.fromHttp2Headers(e)}catch{n=new ss.Metadata}let i=n.getMap(),o;if(typeof i["grpc-status"]=="string"){let s=Number(i["grpc-status"]);this.trace("received status code "+s+" from server"),n.remove("grpc-status");let a="";if(typeof i["grpc-message"]=="string"){try{a=decodeURI(i["grpc-message"])}catch{a=i["grpc-message"]}n.remove("grpc-message"),this.trace('received status details string "'+a+'" from server')}o={code:s,details:a,metadata:n}}else this.httpStatusCode?(o=Hk(this.httpStatusCode),o.metadata=n):o={code:ot.Status.UNKNOWN,details:"No status information received",metadata:n};this.endCall(o)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let r;((e=this.finalStatus)===null||e===void 0?void 0:e.code)===ot.Status.OK?r=os.constants.NGHTTP2_NO_ERROR:r=os.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+r),this.http2Stream.close(r)}}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.endCall({code:e,details:r,metadata:new ss.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==ot.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let e=this.unpushedReadMessages.shift();this.push(e);return}this.http2Stream.resume()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n=i=>{process.nextTick(()=>{var o;let s=ot.Status.UNAVAILABLE;i?.code==="ERR_STREAM_WRITE_AFTER_END"&&(s=ot.Status.INTERNAL),i&&this.cancelWithStatus(s,`Write error: ${i.message}`),(o=e.callback)===null||o===void 0||o.call(e)})};this.trace("sending data chunk of length "+r.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(r,n)}catch(i){this.endCall({code:ot.Status.UNAVAILABLE,details:`Write failed with error ${i.message}`,metadata:new ss.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}};bb.Http2SubchannelCall=Wk});var i9=T(xb=>{"use strict";Object.defineProperty(xb,"__esModule",{value:!0});xb.Http2SubchannelConnector=void 0;var Tl=Q("http2"),zRe=Q("tls"),Ab=va(),Bg=Ge(),GRe=Gk(),Xd=lt(),qRe=ui(),wb=Xr(),Yk=kr(),VRe=Q("net"),HRe=n9(),WRe=ub(),Kk="transport",YRe="transport_flowctrl",KRe=gO().version,{HTTP2_HEADER_AUTHORITY:ZRe,HTTP2_HEADER_CONTENT_TYPE:JRe,HTTP2_HEADER_METHOD:XRe,HTTP2_HEADER_PATH:QRe,HTTP2_HEADER_TE:eIe,HTTP2_HEADER_USER_AGENT:tIe}=Tl.constants,rIe=2e4,nIe=Buffer.from("too_many_pings","ascii"),Zk=class{constructor(e,r,n,i){this.session=e,this.options=n,this.remoteName=i,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,wb.subchannelAddressToString)(r),n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new Ab.ChannelzCallTrackerStub):this.streamTracker=new Ab.ChannelzCallTracker,this.channelzRef=(0,Ab.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[n["grpc.primary_user_agent"],`grpc-node-js/${KRe}`,n["grpc.secondary_user_agent"]].filter(o=>o).join(" "),"grpc.keepalive_time_ms"in n?this.keepaliveTimeMs=n["grpc.keepalive_time_ms"]:this.keepaliveTimeMs=-1,"grpc.keepalive_timeout_ms"in n?this.keepaliveTimeoutMs=n["grpc.keepalive_timeout_ms"]:this.keepaliveTimeoutMs=rIe,"grpc.keepalive_permit_without_calls"in n?this.keepaliveWithoutCalls=n["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(o,s,a)=>{let c=!1;o===Tl.constants.NGHTTP2_ENHANCE_YOUR_CALM&&a&&a.equals(nIe)&&(c=!0),this.trace("connection closed by GOAWAY with code "+o+" and data "+a?.toString()),this.reportDisconnectToOwner(c)}),e.once("error",o=>{this.trace("connection closed with error "+o.message),this.handleDisconnect()}),e.socket.once("close",o=>{this.trace("connection closed. hadError="+o),this.handleDisconnect()}),Xd.isTracerEnabled(Kk)&&(e.on("remoteSettings",o=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(o))}),e.on("localSettings",o=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(o))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof zRe.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,r,n;let i=this.session.socket,o=i.remoteAddress?(0,wb.stringToSubchannelAddress)(i.remoteAddress,i.remotePort):null,s=i.localAddress?(0,wb.stringToSubchannelAddress)(i.localAddress,i.localPort):null,a;if(this.session.encrypted){let l=i,u=l.getCipher(),d=l.getCertificate(),f=l.getPeerCertificate();a={cipherSuiteStandardName:(e=u.standardName)!==null&&e!==void 0?e:null,cipherSuiteOtherName:u.standardName?null:u.name,localCertificate:d&&"raw"in d?d.raw:null,remoteCertificate:f&&"raw"in f?f.raw:null}}else a=null;return{remoteAddress:o,localAddress:s,security:a,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:(r=this.session.state.localWindowSize)!==null&&r!==void 0?r:null,remoteFlowControlWindow:(n=this.session.state.remoteWindowSize)!==null&&n!==void 0?n:null}}trace(e){Xd.trace(Bg.LogVerbosity.DEBUG,Kk,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){Xd.trace(Bg.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){Xd.trace(Bg.LogVerbosity.DEBUG,YRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){Xd.trace(Bg.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(r=>r(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,r;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e);let n="";try{this.session.ping((o,s,a)=>{this.clearKeepaliveTimeout(),o?(this.keepaliveTrace("Ping failed with error "+o.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(n="Ping returned false")}catch(i){n=(i instanceof Error?i.message:"")||"Unknown error"}n&&(this.keepaliveTrace("Ping send failed: "+n),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,r;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),this.activeCalls.size===0&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),this.activeCalls.size===1&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,r,n,i,o){let s=e.toHttp2Headers();s[ZRe]=r,s[tIe]=this.userAgent,s[JRe]="application/grpc",s[XRe]="POST",s[QRe]=n,s[eIe]="trailers";let a;try{a=this.session.request(s)}catch(u){throw this.handleDisconnect(),u}this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let c,l;return this.channelzEnabled?(this.streamTracker.addCallStarted(),c={addMessageSent:()=>{var u;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(u=o.addMessageSent)===null||u===void 0||u.call(o)},addMessageReceived:()=>{var u;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(u=o.addMessageReceived)===null||u===void 0||u.call(o)},onCallEnd:u=>{var d;(d=o.onCallEnd)===null||d===void 0||d.call(o,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;u?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),(d=o.onStreamEnd)===null||d===void 0||d.call(o,u)}}):c={addMessageSent:()=>{var u;(u=o.addMessageSent)===null||u===void 0||u.call(o)},addMessageReceived:()=>{var u;(u=o.addMessageReceived)===null||u===void 0||u.call(o)},onCallEnd:u=>{var d;(d=o.onCallEnd)===null||d===void 0||d.call(o,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;(d=o.onStreamEnd)===null||d===void 0||d.call(o,u)}},l=new HRe.Http2SubchannelCall(a,c,i,this,(0,WRe.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,Ab.unregisterChannelzRef)(this.channelzRef)}},Jk=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){Xd.trace(Bg.LogVerbosity.DEBUG,Kk,(0,Yk.uriToString)(this.channelTarget)+" "+e)}createSession(e,r,n){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,o)=>{var s,a,c,l,u,d,f,p;let h=null,m=this.channelTarget;if("grpc.http_connect_target"in n){let $=(0,Yk.parseUri)(n["grpc.http_connect_target"]);$&&(m=$,h=(0,Yk.uriToString)($))}let S=e.secure?"https":"http",E=(0,qRe.getDefaultAuthority)(m),b=()=>{var $;($=this.session)===null||$===void 0||$.destroy(),this.session=null,setImmediate(()=>{R||(R=!0,o(`${N.trim()} (${new Date().toISOString()})`))})},A=$=>{var _;(_=this.session)===null||_===void 0||_.destroy(),N=$.message,this.trace("connection failed with error "+N),R||(R=!0,o(`${N} (${new Date().toISOString()})`))},y={createConnection:($,_)=>e.socket,settings:{initialWindowSize:(l=(s=n["grpc-node.flow_control_window"])!==null&&s!==void 0?s:(c=(a=Tl.getDefaultSettings)===null||a===void 0?void 0:a.call(Tl))===null||c===void 0?void 0:c.initialWindowSize)!==null&&l!==void 0?l:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:(u=n["grpc-node.max_session_memory"])!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER},x=Tl.connect(`${S}://${E}`,y),C=(p=(f=(d=Tl.getDefaultSettings)===null||d===void 0?void 0:d.call(Tl))===null||f===void 0?void 0:f.initialWindowSize)!==null&&p!==void 0?p:65535,O=n["grpc-node.flow_control_window"];this.session=x;let N="Failed to connect",R=!1;x.unref(),x.once("remoteSettings",()=>{var $;if(O&&O>C)try{x.setLocalWindowSize(O)}catch{let ee=O-(($=x.state.localWindowSize)!==null&&$!==void 0?$:C);ee>0&&x.incrementWindowSize(ee)}x.removeAllListeners(),e.socket.removeListener("close",b),e.socket.removeListener("error",A),i(new Zk(x,r,n,h)),this.session=null}),x.once("close",b),x.once("error",A),e.socket.once("close",b),e.socket.once("error",A)})}tcpConnect(e,r){return(0,GRe.getProxiedConnection)(e,r).then(n=>n||new Promise((i,o)=>{let s=()=>{o(new Error("Socket closed"))},a=l=>{o(l)},c=VRe.connect(e,()=>{c.removeListener("close",s),c.removeListener("error",a),i(c)});c.once("close",s),c.once("error",a)}))}async connect(e,r,n){if(this.isShutdown)return Promise.reject();let i=null,o=null,s=(0,wb.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await r.waitForReady(),this.trace(s+" secureConnector is ready"),i=await this.tcpConnect(e,n),i.setNoDelay(),this.trace(s+" Established TCP connection"),o=await r.connect(i),this.trace(s+" Established secure connection"),this.createSession(o,e,n)}catch(a){throw i?.destroy(),o?.socket.destroy(),a}}shutdown(){var e;this.isShutdown=!0,(e=this.session)===null||e===void 0||e.close(),this.session=null}};xb.Http2SubchannelConnector=Jk});var o9=T(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});zg.SubchannelPool=void 0;zg.getSubchannelPool=dIe;var iIe=CK(),oIe=Y5(),sIe=Xr(),aIe=kr(),cIe=i9(),lIe=1e4,jg=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(let r in this.pool){let i=this.pool[r].filter(o=>!o.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[r]=i}e&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,r;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},lIe),(r=(e=this.cleanupTimer).unref)===null||r===void 0||r.call(e))}getOrCreateSubchannel(e,r,n,i){this.ensureCleanupTask();let o=(0,aIe.uriToString)(e);if(o in this.pool){let a=this.pool[o];for(let c of a)if((0,sIe.subchannelAddressEqual)(r,c.subchannelAddress)&&(0,iIe.channelOptionsEqual)(n,c.channelArguments)&&i._equals(c.channelCredentials))return c.subchannel}let s=new oIe.Subchannel(e,r,n,i,new cIe.Http2SubchannelConnector(e));return o in this.pool||(this.pool[o]=[]),this.pool[o].push({subchannelAddress:r,channelArguments:n,channelCredentials:i,subchannel:s}),s.ref(),s}};zg.SubchannelPool=jg;var uIe=new jg;function dIe(t){return t?uIe:new jg}});var c9=T(Cb=>{"use strict";Object.defineProperty(Cb,"__esModule",{value:!0});Cb.LoadBalancingCall=void 0;var s9=Mr(),Rb=Ge(),a9=Wd(),Ib=Kt(),Gg=Ko(),fIe=kr(),pIe=lt(),Xk=Mg(),hIe=Q("http2"),mIe="load_balancing_call",Qk=class{constructor(e,r,n,i,o,s,a){var c,l;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=o,this.deadline=s,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;let u=this.methodName.split("/"),d="";u.length>=2&&(d=u[1]);let f=(l=(c=(0,fIe.splitHostPort)(this.host))===null||c===void 0?void 0:c.host)!==null&&l!==void 0?l:"localhost";this.serviceUrl=`https://${f}/${d}`,this.startTime=new Date}getDeadlineInfo(){var e,r;let n=[];return this.childStartTime?(this.childStartTime>this.startTime&&(!((e=this.metadata)===null||e===void 0)&&e.getOptions().waitForReady&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,a9.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):(!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){pIe.trace(Rb.LogVerbosity.DEBUG,mIe,"["+this.callNumber+"] "+e)}outputStatus(e,r){var n,i;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());let o=Object.assign(Object.assign({},e),{progress:r});(n=this.listener)===null||n===void 0||n.onReceiveStatus(o),(i=this.onCallEnded)===null||i===void 0||i.call(this,o.code,o.details,o.metadata)}}doPick(){var e,r;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");let n=this.metadata.clone(),i=this.channel.doPick(n,this.callConfig.pickInformation),o=i.subchannel?"("+i.subchannel.getChannelzRef().id+") "+i.subchannel.getAddress():""+i.subchannel;switch(this.trace("Pick result: "+Gg.PickResultType[i.pickResultType]+" subchannel: "+o+" status: "+((e=i.status)===null||e===void 0?void 0:e.code)+" "+((r=i.status)===null||r===void 0?void 0:r.details)),i.pickResultType){case Gg.PickResultType.COMPLETE:this.credentials.compose(i.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(l=>{var u;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(n.merge(l),n.get("authorization").length>1&&this.outputStatus({code:Rb.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new Ib.Metadata},"PROCESSED"),i.subchannel.getConnectivityState()!==s9.ConnectivityState.READY){this.trace("Picked subchannel "+o+" has state "+s9.ConnectivityState[i.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&n.set("grpc-timeout",(0,a9.getDeadlineTimeoutString)(this.deadline));try{this.child=i.subchannel.getRealSubchannel().createCall(n,this.host,this.methodName,{onReceiveMetadata:d=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(d)},onReceiveMessage:d=>{this.trace("Received message"),this.listener.onReceiveMessage(d)},onReceiveStatus:d=>{this.trace("Received status"),d.rstCode===hIe.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(d,"REFUSED"):this.outputStatus(d,"PROCESSED")}}),this.childStartTime=new Date}catch(d){this.trace("Failed to start call on picked subchannel "+o+" with error "+d.message),this.outputStatus({code:Rb.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+d.message,metadata:new Ib.Metadata},"NOT_STARTED");return}(u=i.onCallStarted)===null||u===void 0||u.call(i),this.onCallEnded=i.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()},l=>{let{code:u,details:d}=(0,Xk.restrictControlPlaneStatusCode)(typeof l.code=="number"?l.code:Rb.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${l.message}`);this.outputStatus({code:u,details:d,metadata:new Ib.Metadata},"PROCESSED")});break;case Gg.PickResultType.DROP:let{code:a,details:c}=(0,Xk.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:a,details:c,metadata:i.status.metadata},"DROP")});break;case Gg.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:l,details:u}=(0,Xk.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:l,details:u,metadata:i.status.metadata},"PROCESSED")})}break;case Gg.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new Ib.Metadata},"PROCESSED")}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.listener=r,this.metadata=e,this.doPick()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.child.sendMessageWithContext(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};Cb.LoadBalancingCall=Qk});var u9=T(Pb=>{"use strict";Object.defineProperty(Pb,"__esModule",{value:!0});Pb.ResolvingCall=void 0;var gIe=cT(),bl=Ge(),Al=Wd(),l9=Kt(),_Ie=lt(),yIe=Mg(),SIe="resolving_call",eM=class{constructor(e,r,n,i,o){this.channel=e,this.method=r,this.filterStackFactory=i,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=gIe.CallCredentials.createEmpty(),this.deadline=n.deadline,this.host=n.host,n.parentCall&&(n.flags&bl.Propagate.CANCELLATION&&n.parentCall.on("cancelled",()=>{this.cancelWithStatus(bl.Status.CANCELLED,"Cancelled by parent call")}),n.flags&bl.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+n.parentCall.getDeadline()),this.deadline=(0,Al.minDeadline)(this.deadline,n.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){_Ie.trace(bl.LogVerbosity.DEBUG,SIe,"["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,Al.deadlineToString)(this.deadline));let e=(0,Al.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");let r=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(bl.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let n=[],i=new Date;n.push(`Deadline exceeded after ${(0,Al.formatDateDifference)(this.deadlineStartTime,i)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&n.push(`name resolution: ${(0,Al.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&n.push(`metadata filters: ${(0,Al.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):n.push("waiting for metadata filters")):n.push("waiting for name resolution"),this.child&&n.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(bl.Status.DEADLINE_EXCEEDED,n.join(","))};e<=0?process.nextTick(r):this.deadlineTimer=setTimeout(r,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);let r=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+r.code+' details="'+r.details+'"'),this.statusWatchers.forEach(n=>n(r)),process.nextTick(()=>{var n;(n=this.listener)===null||n===void 0||n.onReceiveStatus(r)})}}sendMessageOnChild(e,r){if(!this.child)throw new Error("sendMessageonChild called with child not populated");let n=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags})).then(i=>{this.writeFilterPending=!1,n.sendMessageWithContext(e,i.message),this.pendingHalfClose&&n.halfClose()},i=>{this.cancelWithStatus(i.code,i.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");let e=this.channel.getConfig(this.method,this.metadata);if(e.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(e.type==="ERROR"){this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error);return}this.configReceivedTime=new Date;let r=e.config;if(r.status!==bl.Status.OK){let{code:n,details:i}=(0,yIe.restrictControlPlaneStatusCode)(r.status,"Failed to route call to method "+this.method);this.outputStatus({code:n,details:i,metadata:new l9.Metadata});return}if(r.methodConfig.timeout){let n=new Date;n.setSeconds(n.getSeconds()+r.methodConfig.timeout.seconds),n.setMilliseconds(n.getMilliseconds()+r.methodConfig.timeout.nanos/1e6),this.deadline=(0,Al.minDeadline)(this.deadline,n),this.runDeadlineTimer()}this.filterStackFactory.push(r.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(n=>{this.child=this.channel.createRetryingCall(r,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(n,{onReceiveMetadata:i=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(i))},onReceiveMessage:i=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(i).then(o=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(o),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},o=>{this.cancelWithStatus(o.code,o.details)})},onReceiveStatus:i=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=i:this.outputStatus(i)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},n=>{this.outputStatus(n)})}reportResolverError(e){var r;!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new l9.Metadata})}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.metadata=e.clone(),this.listener=r,this.getConfig()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.sendMessageOnChild(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};Pb.ResolvingCall=eM});var d9=T(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.RetryingCall=Aa.MessageBufferTracker=Aa.RetryThrottler=void 0;var Ob=Ge(),EIe=Wd(),vIe=Kt(),TIe=lt(),bIe="retrying_call",rM=class{constructor(e,r,n){this.maxTokens=e,this.tokenRatio=r,n?this.tokens=n.tokens*(e/n.maxTokens):this.tokens=e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};Aa.RetryThrottler=rM;var nM=class{constructor(e,r){this.totalLimit=e,this.limitPerCall=r,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,r){var n;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;return this.limitPerCall-i<e||this.totalLimit-this.totalAllocated<e?!1:(this.allocatedPerCall.set(r,i+e),this.totalAllocated+=e,!0)}free(e,r){var n;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;if(i<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > allocated for call ${i}`);this.allocatedPerCall.set(r,i-e)}freeAll(e){var r;let n=(r=this.allocatedPerCall.get(e))!==null&&r!==void 0?r:0;if(this.totalAllocated<n)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${n} > total allocated ${this.totalAllocated}`);this.totalAllocated-=n,this.allocatedPerCall.delete(e)}};Aa.MessageBufferTracker=nM;var tM="grpc-previous-rpc-attempts",AIe=5,iM=class{constructor(e,r,n,i,o,s,a,c,l){var u;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=o,this.deadline=s,this.callNumber=a,this.bufferTracker=c,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;let d=(u=e.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&u!==void 0?u:AIe;if(e.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(r.methodConfig.retryPolicy){this.state="RETRY";let f=r.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(f.initialBackoff.substring(0,f.initialBackoff.length-1)),this.maxAttempts=Math.min(f.maxAttempts,d)}else r.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(r.methodConfig.hedgingPolicy.maxAttempts,d)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let e=[],r=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push(`previous attempts: ${this.underlyingCalls.length-1}`),r.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,EIe.formatDateDifference)(this.startTime,r.startTime)}`),e.push(...r.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){TIe.trace(Ob.LogVerbosity.DEBUG,bIe,"["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var r;(r=this.listener)===null||r===void 0||r.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.reportStatus({code:e,details:r,metadata:new vIe.Metadata});for(let{call:n}of this.underlyingCalls)n.cancelWithStatus(e,r)}getPeer(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var r;return(r=this.writeBuffer[e-this.writeBufferOffset])!==null&&r!==void 0?r:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let e;this.underlyingCalls[this.committedCallIndex].state==="COMPLETED"?e=this.getNextBufferIndex():e=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let r=this.writeBufferOffset;r<e;r++){let n=this.getBufferEntry(r);n.allocated&&this.bufferTracker.free(n.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var r,n;if(this.state!=="COMMITTED"){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",(n=(r=this.callConfig).onCommitted)===null||n===void 0||n.call(r),this.committedCallIndex=e;for(let i=0;i<this.underlyingCalls.length;i++)i!==e&&this.underlyingCalls[i].state!=="COMPLETED"&&(this.underlyingCalls[i].state="COMPLETED",this.underlyingCalls[i].call.cancelWithStatus(Ob.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if(this.state==="COMMITTED")return;let e=-1,r=-1;for(let[n,i]of this.underlyingCalls.entries())i.state==="ACTIVE"&&i.nextMessageToSend>e&&(e=i.nextMessageToSend,r=n);r===-1?this.state="TRANSPARENT_ONLY":this.commitCall(r)}isStatusCodeInList(e,r){return e.some(n=>{var i;return n===r||n.toString().toLowerCase()===((i=Ob.Status[r])===null||i===void 0?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;let r=(e=this.callConfig)===null||e===void 0?void 0:e.methodConfig.retryPolicy;if(!r)return 0;let i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,o=Number(r.maxBackoff.substring(0,r.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*r.backoffMultiplier,o),i}maybeRetryCall(e,r){if(this.state!=="RETRY"){r(!1);return}if(this.attempts>=this.maxAttempts){r(!1);return}let n;if(e===null)n=this.getNextRetryBackoffMs();else if(e<0){this.state="TRANSPARENT_ONLY",r(!1);return}else n=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var i,o;if(this.state!=="RETRY"){r(!1);return}!((o=(i=this.retryThrottler)===null||i===void 0?void 0:i.canRetryCall())!==null&&o!==void 0)||o?(r(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),r(!1))},n)}countActiveCalls(){let e=0;for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(e+=1);return e}handleProcessedStatus(e,r,n){var i,o,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(r),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList((i=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&i!==void 0?i:[],e.code)){(o=this.retryThrottler)===null||o===void 0||o.addCallFailed();let a;if(n===null)a=0;else if(n<0){this.state="TRANSPARENT_ONLY",this.commitCall(r),this.reportStatus(e);return}else a=n;setTimeout(()=>{this.maybeStartHedgingAttempt(),this.countActiveCalls()===0&&(this.commitCall(r),this.reportStatus(e))},a)}else this.commitCall(r),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?((s=this.retryThrottler)===null||s===void 0||s.addCallFailed(),this.maybeRetryCall(n,a=>{a||(this.commitCall(r),this.reportStatus(e))})):(this.commitCall(r),this.reportStatus(e));break}}getPushback(e){let r=e.get("grpc-retry-pushback-ms");if(r.length===0)return null;try{return parseInt(r[0])}catch{return-1}}handleChildStatus(e,r){var n;if(this.underlyingCalls[r].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[r].call.getCallNumber()+"] in state "+this.underlyingCalls[r].state),this.underlyingCalls[r].state="COMPLETED",e.code===Ob.Status.OK){(n=this.retryThrottler)===null||n===void 0||n.addCallSucceeded(),this.commitCall(r),this.reportStatus(e);return}if(this.state==="NO_RETRY"){this.commitCall(r),this.reportStatus(e);return}if(this.state==="COMMITTED"){this.reportStatus(e);return}let i=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,r,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(r),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,r,i);break}}maybeStartHedgingAttempt(){this.state==="HEDGING"&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,r,n;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let i=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let o=(e=i.hedgingDelay)!==null&&e!==void 0?e:"0s",s=Number(o.substring(0,o.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},s*1e3),(n=(r=this.hedgingTimer).unref)===null||n===void 0||n.call(r)}startNewAttempt(){let e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);let r=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});let n=this.attempts-1,i=this.initialMetadata.clone();n>0&&i.set(tM,`${n}`);let o=!1;e.start(i,{onReceiveMetadata:s=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(r),o=!0,n>0&&s.set(tM,`${n}`),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMetadata(s)},onReceiveMessage:s=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(r),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMessage(s)},onReceiveStatus:s=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!o&&n>0&&s.metadata.set(tM,`${n}`),this.handleChildStatus(s,r)}}),this.sendNextChildMessage(r),this.readStarted&&e.startRead()}start(e,r){this.trace("start called"),this.listener=r,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,r){var n,i;(i=(n=this.getBufferEntry(r)).callback)===null||i===void 0||i.call(n),this.clearSentMessages();let o=this.underlyingCalls[e];o.nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){let r=this.underlyingCalls[e];if(r.state==="COMPLETED")return;let n=r.nextMessageToSend;if(this.getBufferEntry(n)){let i=this.getBufferEntry(n);switch(i.entryType){case"MESSAGE":r.call.sendMessageWithContext({callback:s=>{this.handleChildWriteCompleted(e,n)}},i.message.message),this.getBufferEntry(n+1).entryType==="HALF_CLOSE"&&(this.trace("Sending halfClose immediately after message to child ["+r.call.getCallNumber()+"] - optimizing for unary/final message"),r.nextMessageToSend+=1,r.call.halfClose());break;case"HALF_CLOSE":r.nextMessageToSend+=1,r.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n={message:r,flags:e.flags},i=this.getNextBufferIndex(),o={entryType:"MESSAGE",message:n,allocated:this.bufferTracker.allocate(r.length,this.callNumber)};if(this.writeBuffer.push(o),o.allocated){process.nextTick(()=>{var s;(s=e.callback)===null||s===void 0||s.call(e)});for(let[s,a]of this.underlyingCalls.entries())a.state==="ACTIVE"&&a.nextMessageToSend===i&&a.call.sendMessageWithContext({callback:c=>{this.handleChildWriteCompleted(s,i)}},r)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let s=this.underlyingCalls[this.committedCallIndex];o.callback=e.callback,s.state==="ACTIVE"&&s.nextMessageToSend===i&&s.call.sendMessageWithContext({callback:a=>{this.handleChildWriteCompleted(this.committedCallIndex,i)}},r)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let e of this.underlyingCalls)e?.state==="ACTIVE"&&e.call.startRead()}halfClose(){this.trace("halfClose called");let e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(r.nextMessageToSend===e||r.nextMessageToSend===e-1)&&(this.trace("Sending halfClose immediately to child ["+r.call.getCallNumber()+"] - all messages already sent"),r.nextMessageToSend+=1,r.call.halfClose())}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}};Aa.RetryingCall=iM});var qg=T(Nb=>{"use strict";Object.defineProperty(Nb,"__esModule",{value:!0});Nb.BaseSubchannelWrapper=void 0;var oM=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(r=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(let e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,this.refcount===0&&this.destroy()}destroy(){for(let e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}};Nb.BaseSubchannelWrapper=oM});var pM=T(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.InternalChannel=wl.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var wIe=xd(),xIe=IK(),RIe=o9(),cM=Ko(),IIe=Kt(),wa=Ge(),CIe=gb(),PIe=Pk(),f9=ui(),kb=lt(),OIe=Gk(),Mb=kr(),Wn=Mr(),Vg=va(),NIe=c9(),kIe=Wd(),MIe=u9(),sM=ub(),DIe=Mg(),aM=d9(),LIe=qg(),$Ie=2147483647,UIe=1e3,FIe=1800*1e3,Db=new Map,BIe=1<<24,jIe=1<<20,lM=class extends LIe.BaseSubchannelWrapper{constructor(e,r){super(e),this.channel=r,this.refCount=0,this.subchannelStateListener=(n,i,o,s)=>{r.throttleKeepalive(s)}}ref(){this.refCount===0&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}},uM=class{pick(e){return{pickResultType:cM.PickResultType.DROP,status:{code:wa.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new IIe.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}};wl.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";var dM=class{constructor(e){this.target=e,this.trace=new Vg.ChannelzTrace,this.callTracker=new Vg.ChannelzCallTracker,this.childrenTracker=new Vg.ChannelzChildrenTracker,this.state=Wn.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}},fM=class{constructor(e,r,n){var i,o,s,a,c,l;if(this.credentials=r,this.options=n,this.connectivityState=Wn.ConnectivityState.IDLE,this.currentPicker=new cM.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof wIe.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new dM(e);let u=(0,Mb.parseUri)(e);if(u===null)throw new Error(`Could not parse target name "${e}"`);let d=(0,f9.mapUriDefaultScheme)(u);if(d===null)throw new Error(`Could not find a default scheme for target name "${e}"`);this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=(0,Vg.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,f9.getDefaultAuthority)(d);let f=(0,OIe.mapProxyName)(d,n);this.target=f.target,this.options=Object.assign({},this.options,f.extraOptions),this.subchannelPool=(0,RIe.getSubchannelPool)(((i=this.options["grpc.use_local_subchannel_pool"])!==null&&i!==void 0?i:0)===0),this.retryBufferTracker=new aM.MessageBufferTracker((o=this.options["grpc.retry_buffer_size"])!==null&&o!==void 0?o:BIe,(s=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&s!==void 0?s:jIe),this.keepaliveTime=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:-1,this.idleTimeoutMs=Math.max((c=this.options["grpc.client_idle_timeout_ms"])!==null&&c!==void 0?c:FIe,UIe);let p={createSubchannel:(m,S)=>{let E={};for(let[y,x]of Object.entries(S))y.startsWith(wl.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(E[y]=x);let b=this.subchannelPool.getOrCreateSubchannel(this.target,m,E,this.credentials);return b.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",b.getChannelzRef()),new lM(b,this)},updateState:(m,S)=>{this.currentPicker=S;let E=this.pickQueue.slice();this.pickQueue=[],E.length>0&&this.callRefTimerUnref();for(let b of E)b.doPick();this.updateState(m)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(m)},removeChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(m)}};this.resolvingLoadBalancer=new xIe.ResolvingLoadBalancer(this.target,p,this.options,(m,S)=>{var E;m.retryThrottling?Db.set(this.getTarget(),new aM.RetryThrottler(m.retryThrottling.maxTokens,m.retryThrottling.tokenRatio,Db.get(this.getTarget()))):Db.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),(E=this.configSelector)===null||E===void 0||E.unref(),this.configSelector=S,this.currentResolutionError=null,process.nextTick(()=>{let b=this.configSelectionQueue;this.configSelectionQueue=[],b.length>0&&this.callRefTimerUnref();for(let A of b)A.getConfig()})},m=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+m.code+' and details "'+m.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),this.configSelector===null&&(this.currentResolutionError=Object.assign(Object.assign({},(0,DIe.restrictControlPlaneStatusCode)(m.code,m.details)),{metadata:m.metadata}));let S=this.configSelectionQueue;this.configSelectionQueue=[],S.length>0&&this.callRefTimerUnref();for(let E of S)E.reportResolverError(m)}),this.filterStackFactory=new CIe.FilterStackFactory([new PIe.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(n,void 0,2));let h=new Error;(0,kb.isTracerEnabled)("channel_stacktrace")&&(0,kb.trace)(wa.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed
22
22
  `+((l=h.stack)===null||l===void 0?void 0:l.substring(h.stack.indexOf(`
23
23
  `)+1))),this.lastActivityTimestamp=new Date}trace(e,r){(0,kb.trace)(r??wa.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,r,n,i;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},$Ie)),!((r=(e=this.callRefTimer).hasRef)===null||r===void 0)&&r.call(e)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(i=(n=this.callRefTimer).ref)===null||i===void 0||i.call(n))}callRefTimerUnref(){var e,r,n;(!(!((e=this.callRefTimer)===null||e===void 0)&&e.hasRef)||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(n=(r=this.callRefTimer)===null||r===void 0?void 0:r.unref)===null||n===void 0||n.call(r))}removeConnectivityStateWatcher(e){let r=this.connectivityStateWatchers.findIndex(n=>n===e);r>=0&&this.connectivityStateWatchers.splice(r,1)}updateState(e){(0,kb.trace)(wa.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+Wn.ConnectivityState[this.connectivityState]+" -> "+Wn.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+Wn.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;let r=this.connectivityStateWatchers.slice();for(let n of r)e!==n.currentState&&(n.timer&&clearTimeout(n.timer),this.removeConnectivityStateWatcher(n),n.callback());e!==Wn.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(let r of this.wrappedSubchannels)r.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,r){return this.currentPicker.pick({metadata:e,extraPickInfo:r})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,r){return this.connectivityState!==Wn.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,r,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(Wn.ConnectivityState.IDLE),this.currentPicker=new cM.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var r,n;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let o=new Date().valueOf()-this.lastActivityTimestamp.valueOf();o>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-o)},e),(n=(r=this.idleTimer).unref)===null||n===void 0||n.call(r)}maybeStartIdleTimer(){this.connectivityState!==Wn.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===wa.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,r,n,i,o){let s=(0,sM.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+r+'"'),new NIe.LoadBalancingCall(this,e,r,n,i,o,s)}createRetryingCall(e,r,n,i,o){let s=(0,sM.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+r+'"'),new aM.RetryingCall(this,e,r,n,i,o,s,this.retryBufferTracker,Db.get(this.getTarget()))}createResolvingCall(e,r,n,i,o){let s=(0,sM.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,kIe.deadlineToString)(r));let a={deadline:r,flags:o??wa.Propagate.DEFAULTS,host:n??this.defaultAuthority,parentCall:i},c=new MIe.ResolvingCall(this,e,a,this.filterStackFactory.clone(),s);return this.onCallStart(),c.addStatusWatcher(l=>{this.onCallEnd(l)}),c}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(Wn.ConnectivityState.SHUTDOWN),this.currentPicker=new uM;for(let r of this.configSelectionQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let r of this.pickQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,Vg.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null}getTarget(){return(0,Mb.uriToString)(this.target)}getConnectivityState(e){let r=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),r}watchConnectivityState(e,r,n){if(this.connectivityState===Wn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let i=null;if(r!==1/0){let s=r instanceof Date?r:new Date(r),a=new Date;if(r===-1/0||s<=a){process.nextTick(n,new Error("Deadline passed without connectivity state change"));return}i=setTimeout(()=>{this.removeConnectivityStateWatcher(o),n(new Error("Deadline passed without connectivity state change"))},s.getTime()-a.getTime())}let o={currentState:e,callback:n,timer:i};this.connectivityStateWatchers.push(o)}getChannelzRef(){return this.channelzRef}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===Wn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,r,n,i,o)}getOptions(){return this.options}};wl.InternalChannel=fM});var sN=T(Lb=>{"use strict";Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ChannelImplementation=void 0;var zIe=xd(),GIe=pM(),hM=class{constructor(e,r,n){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof zIe.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new GIe.InternalChannel(e,r,n)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,r,n){this.internalChannel.watchConnectivityState(e,r,n)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,r,n,i,o)}};Lb.ChannelImplementation=hM});var h9=T(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.ServerDuplexStreamImpl=bi.ServerWritableStreamImpl=bi.ServerReadableStreamImpl=bi.ServerUnaryCallImpl=void 0;bi.serverErrorToStatus=vM;var qIe=Q("events"),SM=Q("stream"),EM=Ge(),p9=Kt();function vM(t,e){var r;let n={code:EM.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:(r=e??t.metadata)!==null&&r!==void 0?r:null};return"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(n.code=t.code,"details"in t&&typeof t.details=="string"&&(n.details=t.details)),n}var mM=class extends qIe.EventEmitter{constructor(e,r,n,i){super(),this.path=e,this.call=r,this.metadata=n,this.request=i,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};bi.ServerUnaryCallImpl=mM;var gM=class extends SM.Readable{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};bi.ServerReadableStreamImpl=gM;var _M=class extends SM.Writable{constructor(e,r,n,i){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.request=i,this.pendingStatus={code:EM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",o=>{this.pendingStatus=vM(o),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};bi.ServerWritableStreamImpl=_M;var yM=class extends SM.Duplex{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.pendingStatus={code:EM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",i=>{this.pendingStatus=vM(i),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};bi.ServerDuplexStreamImpl=yM});var $b=T(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ServerCredentials=void 0;Qd.createCertificateProviderServerCredentials=VIe;Qd.createServerCredentialsWithInterceptors=HIe;var TM=IO(),xl=class{constructor(e,r){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=r??null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(let r of this.watchers)r(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new bM}static createSsl(e,r,n=!1){var i;if(e!==null&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if(typeof n!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let o=[],s=[];for(let a=0;a<r.length;a++){let c=r[a];if(c===null||typeof c!="object")throw new TypeError(`keyCertPair[${a}] must be an object`);if(!Buffer.isBuffer(c.private_key))throw new TypeError(`keyCertPair[${a}].private_key must be a Buffer`);if(!Buffer.isBuffer(c.cert_chain))throw new TypeError(`keyCertPair[${a}].cert_chain must be a Buffer`);o.push(c.cert_chain),s.push(c.private_key)}return new AM({requestCert:n,ciphers:TM.CIPHER_SUITES},{ca:(i=e??(0,TM.getDefaultRootsData)())!==null&&i!==void 0?i:void 0,cert:o,key:s})}};Qd.ServerCredentials=xl;var bM=class t extends xl{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof t}},AM=class t extends xl{constructor(e,r){super(e,r),this.options=Object.assign(Object.assign({},e),r)}_equals(e){if(this===e)return!0;if(!(e instanceof t))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let r=0;r<this.options.cert.length;r++){let n=this.options.cert[r],i=e.options.cert[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let r=0;r<this.options.key.length;r++){let n=this.options.key[r],i=e.options.key[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}},wM=class t extends xl{constructor(e,r,n){super({requestCert:r!==null,rejectUnauthorized:n,ciphers:TM.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var r;this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var r;super._removeWatcher(e),this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate:!1}calculateSecureContextOptions(){var e;return this.latestIdentityUpdate===null||this.caCertificateProvider!==null&&this.latestCaUpdate===null?null:{ca:(e=this.latestCaUpdate)===null||e===void 0?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}};function VIe(t,e,r){return new wM(t,e,r)}var xM=class t extends xl{constructor(e,r){super({}),this.childCredentials=e,this.interceptors=r}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof t)||!this.childCredentials._equals(e.childCredentials)||this.interceptors.length!==e.interceptors.length)return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r]!==e.interceptors[r])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}};function HIe(t,e){return new xM(t,e)}});var Hg=T(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.durationMessageToDuration=WIe;as.msToDuration=YIe;as.durationToMs=KIe;as.isDuration=ZIe;as.isDurationMessage=JIe;as.parseDuration=QIe;as.durationToString=eCe;function WIe(t){return{seconds:Number.parseInt(t.seconds),nanos:t.nanos}}function YIe(t){return{seconds:t/1e3|0,nanos:t%1e3*1e6|0}}function KIe(t){return t.seconds*1e3+t.nanos/1e6|0}function ZIe(t){return typeof t.seconds=="number"&&typeof t.nanos=="number"}function JIe(t){return typeof t.seconds=="string"&&typeof t.nanos=="number"}var XIe=/^(\d+)(?:\.(\d+))?s$/;function QIe(t){let e=t.match(XIe);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function eCe(t){if(t.nanos===0)return`${t.seconds}s`;let e;return t.nanos%1e6===0?e=1e6:t.nanos%1e3===0?e=1e3:e=1,`${t.seconds}.${t.nanos/e}s`}});var Fb=T(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.OrcaOobMetricsSubchannelWrapper=Sn.GRPC_METRICS_HEADER=Sn.ServerMetricRecorder=Sn.PerRequestMetricRecorder=void 0;Sn.createOrcaClient=y9;Sn.createMetricsReader=aCe;var tCe=IT(),RM=Hg(),rCe=xd(),nCe=qg(),m9=Ge(),iCe=Rd(),oCe=Mr(),g9=null;function Ub(){if(g9)return g9;let t=hk().loadSync,e=t("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,tCe.loadPackageDefinition)(e)}var IM=class{constructor(){this.message={}}recordRequestCostMetric(e,r){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=r}recordUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}recordNamedMetric(e,r){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=r}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return Ub().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};Sn.PerRequestMetricRecorder=IM;var sCe=3e4,CM=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let r=e.request.report_interval?(0,RM.durationToMs)((0,RM.durationMessageToDuration)(e.request.report_interval)):sCe,n=setInterval(()=>{e.write(this.message)},r);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var r;(r=this.message.utilization)===null||r===void 0||delete r[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){let r=Ub().xds.service.orca.v3.OpenRcaService.service;e.addService(r,this.serviceImplementation)}};Sn.ServerMetricRecorder=CM;function y9(t){let e=Ub().xds.service.orca.v3.OpenRcaService;return new e("unused",rCe.ChannelCredentials.createInsecure(),{channelOverride:t})}Sn.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var _9="grpc_orca_load_report";function aCe(t,e){return(r,n,i)=>{let o=i.getOpaque(_9);if(o)t(o);else{let s=i.get(Sn.GRPC_METRICS_HEADER);s.length>0&&(o=Ub().xds.data.orca.v3.OrcaLoadReport.deserialize(s[0]),t(o),i.setOpaque(_9,o))}e&&e(r,n,i)}}var S9="orca_oob_metrics",PM=class{constructor(e,r){this.metricsListener=e,this.intervalMs=r,this.dataProducer=null}setSubchannel(e){let r=e.getOrCreateDataProducer(S9,cCe);this.dataProducer=r,r.addDataWatcher(this)}destroy(){var e;(e=this.dataProducer)===null||e===void 0||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}},OM=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new iCe.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let r=e.getChannel();this.client=y9(r),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var r;this.dataWatchers.delete(e),this.dataWatchers.size===0?(this.subchannel.removeDataProducer(S9),(r=this.metricsCall)===null||r===void 0||r.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==oCe.ConnectivityState.READY)return;let r=Math.min(...Array.from(this.dataWatchers).map(n=>n.getInterval()));if(!this.metricsCall||r!==this.currentInterval){(e=this.metricsCall)===null||e===void 0||e.cancel(),this.currentInterval=r;let n=this.client.streamCoreMetrics({report_interval:(0,RM.msToDuration)(r)});this.metricsCall=n,n.on("data",i=>{this.dataWatchers.forEach(o=>{o.onMetricsUpdate(i)})}),n.on("error",i=>{if(this.metricsCall=null,i.code===m9.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}i.code!==m9.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},NM=class extends nCe.BaseSubchannelWrapper{constructor(e,r,n){super(e),this.addDataWatcher(new PM(r,n))}getWrappedSubchannel(){return this.child}};Sn.OrcaOobMetricsSubchannelWrapper=NM;function cCe(t){return new OM(t)}});var FM=T(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.BaseServerInterceptingCall=Yn.ServerInterceptingCall=Yn.ResponderBuilder=Yn.ServerListenerBuilder=void 0;Yn.isInterceptingServerListener=dCe;Yn.getServerInterceptingCall=gCe;var zb=Kt(),Lr=Ge(),ef=Q("http2"),E9=iT(),v9=Q("zlib"),lCe=Vk(),x9=lt(),uCe=Q("tls"),T9=Fb(),R9="server_call";function Rl(t){x9.trace(Lr.LogVerbosity.DEBUG,R9,t)}var MM=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};Yn.ServerListenerBuilder=MM;function dCe(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var DM=class{constructor(e,r){this.listener=e,this.nextListener=r,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}},LM=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};Yn.ResponderBuilder=LM;var Bb={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveHalfClose:t=>{t()},onCancel:()=>{}},jb={start:t=>{t()},sendMetadata:(t,e)=>{e(t)},sendMessage:(t,e)=>{e(t)},sendStatus:(t,e)=>{e(t)}},$M=class{constructor(e,r){var n,i,o,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(n=r?.start)!==null&&n!==void 0?n:jb.start,sendMetadata:(i=r?.sendMetadata)!==null&&i!==void 0?i:jb.sendMetadata,sendMessage:(o=r?.sendMessage)!==null&&o!==void 0?o:jb.sendMessage,sendStatus:(s=r?.sendStatus)!==null&&s!==void 0?s:jb.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(r=>{var n,i,o,s;let a={onReceiveMetadata:(n=r?.onReceiveMetadata)!==null&&n!==void 0?n:Bb.onReceiveMetadata,onReceiveMessage:(i=r?.onReceiveMessage)!==null&&i!==void 0?i:Bb.onReceiveMessage,onReceiveHalfClose:(o=r?.onReceiveHalfClose)!==null&&o!==void 0?o:Bb.onReceiveHalfClose,onCancel:(s=r?.onCancel)!==null&&s!==void 0?s:Bb.onCancel},c=new DM(a,e);this.nextCall.start(c)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,r=>{this.processingMetadata=!1,this.nextCall.sendMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new zb.Metadata),this.responder.sendMessage(e,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=n,this.pendingMessageCallback=r):this.nextCall.sendMessage(n,r)})}sendStatus(e){this.responder.sendStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextCall.sendStatus(r)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};Yn.ServerInterceptingCall=$M;var I9="grpc-accept-encoding",UM="grpc-encoding",b9="grpc-message",A9="grpc-status",kM="grpc-timeout",fCe=/(\d{1,8})\s*([HMSmun])/,pCe={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},hCe={[I9]:"identity,deflate,gzip",[UM]:"identity"},w9={[ef.constants.HTTP2_HEADER_STATUS]:ef.constants.HTTP_STATUS_OK,[ef.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},mCe={waitForTrailers:!0},Gb=class{constructor(e,r,n,i,o){var s,a;this.stream=e,this.callEventTracker=n,this.handler=i,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=Lr.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Lr.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new T9.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;Rl("Request to method "+((f=this.handler)===null||f===void 0?void 0:f.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:Lr.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",f=>{this.handleDataFrame(f)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in o&&(this.maxSendMessageSize=o["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in o&&(this.maxReceiveMessageSize=o["grpc.max_receive_message_length"]),this.host=(s=r[":authority"])!==null&&s!==void 0?s:r.host,this.decoder=new lCe.StreamDecoder(this.maxReceiveMessageSize);let c=zb.Metadata.fromHttp2Headers(r);x9.isTracerEnabled(R9)&&Rl("Request to "+this.handler.path+" received headers "+JSON.stringify(c.toJSON()));let l=c.get(kM);l.length>0&&this.handleTimeoutHeader(l[0]);let u=c.get(UM);u.length>0&&(this.incomingEncoding=u[0]),c.remove(kM),c.remove(UM),c.remove(I9),c.remove(ef.constants.HTTP2_HEADER_ACCEPT_ENCODING),c.remove(ef.constants.HTTP2_HEADER_TE),c.remove(ef.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=c;let d=(a=e.session)===null||a===void 0?void 0:a.socket;this.connectionInfo={localAddress:d?.localAddress,localPort:d?.localPort,remoteAddress:d?.remoteAddress,remotePort:d?.remotePort},this.shouldSendMetrics=!!o["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){let r=e.toString().match(fCe);if(r===null){let o={code:Lr.Status.INTERNAL,details:`Invalid ${kM} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(o)});return}let n=+r[1]*pCe[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{let o={code:Lr.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(o)},n)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;(e=this.listener)===null||e===void 0||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new zb.Metadata)}serializeMessage(e){let r=this.handler.serialize(e),n=r.byteLength,i=Buffer.allocUnsafe(n+5);return i.writeUInt8(0,0),i.writeUInt32BE(n,1),r.copy(i,5),i}decompressMessage(e,r){let n=e.subarray(5);if(r==="identity")return n;if(r==="deflate"||r==="gzip"){let i;return r==="deflate"?i=v9.createInflate():i=v9.createGunzip(),new Promise((o,s)=>{let a=0,c=[];i.on("error",l=>{s({code:Lr.Status.INTERNAL,details:"Failed to decompress message"})}),i.on("data",l=>{c.push(l),a+=l.byteLength,this.maxReceiveMessageSize!==-1&&a>this.maxReceiveMessageSize&&(i.destroy(),s({code:Lr.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),i.on("end",()=>{o(Buffer.concat(c))}),i.write(n),i.end()})}else return Promise.reject({code:Lr.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if(e.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${e.type}`);let n=e.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",i;try{i=await this.decompressMessage(e.compressedMessage,n)}catch(o){this.sendStatus(o);return}try{e.parsedMessage=this.handler.deserialize(i)}catch(o){this.sendStatus({code:Lr.Status.INTERNAL,details:`Error deserializing request: ${o.message}`});return}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let e=this.readQueue.shift();e.type==="READABLE"?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;Rl("Request to "+this.handler.path+" received data frame of size "+e.length);let n;try{n=this.decoder.write(e)}catch(i){this.sendStatus({code:Lr.Status.RESOURCE_EXHAUSTED,details:i.message});return}for(let i of n){this.stream.pause();let o={type:"COMPRESSED",compressedMessage:i,parsedMessage:null};this.readQueue.push(o),this.decompressAndMaybePush(o),(r=this.callEventTracker)===null||r===void 0||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){Rl("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let r=e?e.toHttp2Headers():null,n=Object.assign(Object.assign(Object.assign({},w9),hCe),r);this.stream.respond(n,mCe)}sendMessage(e,r){if(this.checkCancelled())return;let n;try{n=this.serializeMessage(e)}catch(i){this.sendStatus({code:Lr.Status.INTERNAL,details:`Error serializing response: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&n.length-5>this.maxSendMessageSize){this.sendStatus({code:Lr.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${n.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),Rl("Request to "+this.handler.path+" sent data frame of size "+n.length),this.stream.write(n,i=>{var o;if(i){this.sendStatus({code:Lr.Status.INTERNAL,details:`Error writing message: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}(o=this.callEventTracker)===null||o===void 0||o.addMessageSent(),r()})}sendStatus(e){var r,n,i;if(this.checkCancelled())return;Rl("Request to method "+((r=this.handler)===null||r===void 0?void 0:r.path)+" ended with status code: "+Lr.Status[e.code]+" details: "+e.details);let o=(i=(n=e.metadata)===null||n===void 0?void 0:n.clone())!==null&&i!==void 0?i:new zb.Metadata;if(this.shouldSendMetrics&&o.set(T9.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(s),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign(Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},w9),o.toHttp2Headers());this.stream.respond(s,{endStream:!0}),this.notifyOnCancel()}}startRead(){Rl("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;let r=(e=this.stream.session)===null||e===void 0?void 0:e.socket;return r?.remoteAddress?r.remotePort?`${r.remoteAddress}:${r.remotePort}`:r.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if(((e=this.stream.session)===null||e===void 0?void 0:e.socket)instanceof uCe.TLSSocket){let r=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:r.raw?r:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}};Yn.BaseServerInterceptingCall=Gb;function gCe(t,e,r,n,i,o){let s={path:i.path,requestStream:i.type==="clientStream"||i.type==="bidi",responseStream:i.type==="serverStream"||i.type==="bidi",requestDeserialize:i.deserialize,responseSerialize:i.serialize},a=new Gb(e,r,n,i,o);return t.reduce((c,l)=>l(s,c),a)}});var D9=T(Ra=>{"use strict";var _Ce=Ra&&Ra.__runInitializers||function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},yCe=Ra&&Ra.__esDecorate||function(t,e,r,n,i,o){function s(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(E){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(E||null))};var S=(0,r[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],h);if(a==="accessor"){if(S===void 0)continue;if(S===null||typeof S!="object")throw new TypeError("Object expected");(d=s(S.get))&&(u.get=d),(d=s(S.set))&&(u.set=d),(d=s(S.init))&&i.unshift(d)}else(d=s(S))&&(a==="field"?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,n.name,u),f=!0};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Server=void 0;var en=Q("http2"),SCe=Q("util"),Ct=Ge(),nf=h9(),BM=$b(),C9=ui(),rf=lt(),xa=Xr(),Ai=kr(),Bt=va(),P9=FM(),tf=~(1<<31),jM=~(1<<31),ECe=2e4,O9=~(1<<31),{HTTP2_HEADER_PATH:N9}=en.constants,vCe="server",k9=Buffer.from("max_age");function M9(t){rf.trace(Ct.LogVerbosity.DEBUG,"server_call",t)}function TCe(){}function bCe(t){return function(e,r){return SCe.deprecate(e,t)}}function zM(t){return{code:Ct.Status.UNIMPLEMENTED,details:`The server does not implement the method ${t}`}}function ACe(t,e){let r=zM(e);switch(t){case"unary":return(n,i)=>{i(r,null)};case"clientStream":return(n,i)=>{i(r,null)};case"serverStream":return n=>{n.emit("error",r)};case"bidi":return n=>{n.emit("error",r)};default:throw new Error(`Invalid handlerType ${t}`)}}var wCe=(()=>{var t;let e=[],r;return t=class{constructor(i){var o,s,a,c,l,u;this.boundPorts=(_Ce(this,e),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=i??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new Bt.ChannelzTraceStub,this.callTracker=new Bt.ChannelzCallTrackerStub,this.listenerChildrenTracker=new Bt.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new Bt.ChannelzChildrenTrackerStub):(this.channelzTrace=new Bt.ChannelzTrace,this.callTracker=new Bt.ChannelzCallTracker,this.listenerChildrenTracker=new Bt.ChannelzChildrenTracker,this.sessionChildrenTracker=new Bt.ChannelzChildrenTracker),this.channelzRef=(0,Bt.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(o=this.options["grpc.max_connection_age_ms"])!==null&&o!==void 0?o:tf,this.maxConnectionAgeGraceMs=(s=this.options["grpc.max_connection_age_grace_ms"])!==null&&s!==void 0?s:tf,this.keepaliveTimeMs=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:jM,this.keepaliveTimeoutMs=(c=this.options["grpc.keepalive_timeout_ms"])!==null&&c!==void 0?c:ECe,this.sessionIdleTimeout=(l=this.options["grpc.max_connection_idle_ms"])!==null&&l!==void 0?l:O9,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(u=this.options.interceptors)!==null&&u!==void 0?u:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(i){var o,s,a;let c=this.sessions.get(i),l=i.socket,u=l.remoteAddress?(0,xa.stringToSubchannelAddress)(l.remoteAddress,l.remotePort):null,d=l.localAddress?(0,xa.stringToSubchannelAddress)(l.localAddress,l.localPort):null,f;if(i.encrypted){let h=l,m=h.getCipher(),S=h.getCertificate(),E=h.getPeerCertificate();f={cipherSuiteStandardName:(o=m.standardName)!==null&&o!==void 0?o:null,cipherSuiteOtherName:m.standardName?null:m.name,localCertificate:S&&"raw"in S?S.raw:null,remoteCertificate:E&&"raw"in E?E.raw:null}}else f=null;return{remoteAddress:u,localAddress:d,security:f,remoteName:null,streamsStarted:c.streamTracker.callsStarted,streamsSucceeded:c.streamTracker.callsSucceeded,streamsFailed:c.streamTracker.callsFailed,messagesSent:c.messagesSent,messagesReceived:c.messagesReceived,keepAlivesSent:c.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:c.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:c.lastMessageSentTimestamp,lastMessageReceivedTimestamp:c.lastMessageReceivedTimestamp,localFlowControlWindow:(s=i.state.localWindowSize)!==null&&s!==void 0?s:null,remoteFlowControlWindow:(a=i.state.remoteWindowSize)!==null&&a!==void 0?a:null}}trace(i){rf.trace(Ct.LogVerbosity.DEBUG,vCe,"("+this.channelzRef.id+") "+i)}keepaliveTrace(i){rf.trace(Ct.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+i)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(i,o){if(i===null||typeof i!="object"||o===null||typeof o!="object")throw new Error("addService() requires two objects as arguments");let s=Object.keys(i);if(s.length===0)throw new Error("Cannot add an empty service to a server");s.forEach(a=>{let c=i[a],l;c.requestStream?c.responseStream?l="bidi":l="clientStream":c.responseStream?l="serverStream":l="unary";let u=o[a],d;if(u===void 0&&typeof c.originalName=="string"&&(u=o[c.originalName]),u!==void 0?d=u.bind(o):d=ACe(l,a),this.register(c.path,d,c.responseSerialize,c.requestDeserialize,l)===!1)throw new Error(`Method handler for ${c.path} already provided.`)})}removeService(i){if(i===null||typeof i!="object")throw new Error("removeService() requires object as argument");Object.keys(i).forEach(s=>{let a=i[s];this.unregister(a.path)})}bind(i,o){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(i){return(0,Bt.registerChannelzSocket)((0,xa.subchannelAddressToString)(i),()=>({localAddress:i,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(i){(0,Bt.unregisterChannelzRef)(i)}createHttp2Server(i){let o;if(i._isSecure()){let s=i._getConstructorOptions(),a=i._getSecureContextOptions(),c=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),s),a),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),l=a!==null;this.trace("Initial credentials valid: "+l),o=en.createSecureServer(c),o.prependListener("connection",d=>{l||(this.trace("Dropped connection from "+JSON.stringify(d.address())+" due to unloaded credentials"),d.destroy())}),o.on("secureConnection",d=>{d.on("error",f=>{this.trace("An incoming TLS connection closed with error: "+f.message)})});let u=d=>{if(d){let f=o;try{f.setSecureContext(d)}catch(p){rf.log(Ct.LogVerbosity.ERROR,"Failed to set secure context with error "+p.message),d=null}}l=d!==null,this.trace("Post-update credentials valid: "+l)};i._addWatcher(u),o.on("close",()=>{i._removeWatcher(u)})}else o=en.createServer(this.commonServerOptions);return o.setTimeout(0,TCe),this._setupHandlers(o,i._getInterceptors()),o}bindOneAddress(i,o){this.trace("Attempting to bind "+(0,xa.subchannelAddressToString)(i));let s=this.createHttp2Server(o.credentials);return new Promise((a,c)=>{let l=u=>{this.trace("Failed to bind "+(0,xa.subchannelAddressToString)(i)+" with error "+u.message),a({port:"port"in i?i.port:1,error:u.message})};s.once("error",l),s.listen(i,()=>{let u=s.address(),d;typeof u=="string"?d={path:u}:d={host:u.address,port:u.port};let f=this.experimentalRegisterListenerToChannelz(d);this.listenerChildrenTracker.refChild(f),this.http2Servers.set(s,{channelzRef:f,sessions:new Set,ownsChannelzRef:!0}),o.listeningServers.add(s),this.trace("Successfully bound "+(0,xa.subchannelAddressToString)(d)),a({port:"port"in d?d.port:1}),s.removeListener("error",l)})})}async bindManyPorts(i,o){if(i.length===0)return{count:0,port:0,errors:[]};if((0,xa.isTcpSubchannelAddress)(i[0])&&i[0].port===0){let s=await this.bindOneAddress(i[0],o);if(s.error){let a=await this.bindManyPorts(i.slice(1),o);return Object.assign(Object.assign({},a),{errors:[s.error,...a.errors]})}else{let a=i.slice(1).map(u=>(0,xa.isTcpSubchannelAddress)(u)?{host:u.host,port:s.port}:u),c=await Promise.all(a.map(u=>this.bindOneAddress(u,o))),l=[s,...c];return{count:l.filter(u=>u.error===void 0).length,port:s.port,errors:l.filter(u=>u.error).map(u=>u.error)}}}else{let s=await Promise.all(i.map(a=>this.bindOneAddress(a,o)));return{count:s.filter(a=>a.error===void 0).length,port:s[0].port,errors:s.filter(a=>a.error).map(a=>a.error)}}}async bindAddressList(i,o){let s=await this.bindManyPorts(i,o);if(s.count>0)return s.count<i.length&&rf.log(Ct.LogVerbosity.INFO,`WARNING Only ${s.count} addresses added out of total ${i.length} resolved`),s.port;{let a=`No address added out of total ${i.length} resolved`;throw rf.log(Ct.LogVerbosity.ERROR,a),new Error(`${a} errors: [${s.errors.join(",")}]`)}}resolvePort(i){return new Promise((o,s)=>{let a=!1,c=(u,d,f,p)=>{if(a)return!0;if(a=!0,!u.ok)return s(new Error(u.error.details)),!0;let h=[].concat(...u.value.map(m=>m.addresses));return h.length===0?(s(new Error(`No addresses resolved for port ${i}`)),!0):(o(h),!0)};(0,C9.createResolver)(i,c,this.options).updateResolution()})}async bindPort(i,o){let s=await this.resolvePort(i);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");let a=await this.bindAddressList(s,o);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");return a}normalizePort(i){let o=(0,Ai.parseUri)(i);if(o===null)throw new Error(`Could not parse port "${i}"`);let s=(0,C9.mapUriDefaultScheme)(o);if(s===null)throw new Error(`Could not get a default scheme for port "${i}"`);return s}bindAsync(i,o,s){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof i!="string")throw new TypeError("port must be a string");if(o===null||!(o instanceof BM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof s!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+i);let a=this.normalizePort(i),c=(f,p)=>{process.nextTick(()=>s(f,p))},l=this.boundPorts.get((0,Ai.uriToString)(a));if(l){if(!o._equals(l.credentials)){c(new Error(`${i} already bound with incompatible credentials`),0);return}l.cancelled=!1,l.completionPromise?l.completionPromise.then(f=>s(null,f),f=>s(f,0)):c(null,l.portNumber);return}l={mapKey:(0,Ai.uriToString)(a),originalUri:a,completionPromise:null,cancelled:!1,portNumber:0,credentials:o,listeningServers:new Set};let u=(0,Ai.splitHostPort)(a.path),d=this.bindPort(a,l);l.completionPromise=d,u?.port===0?d.then(f=>{let p={scheme:a.scheme,authority:a.authority,path:(0,Ai.combineHostPort)({host:u.host,port:f})};l.mapKey=(0,Ai.uriToString)(p),l.completionPromise=null,l.portNumber=f,this.boundPorts.set(l.mapKey,l),s(null,f)},f=>{s(f,0)}):(this.boundPorts.set(l.mapKey,l),d.then(f=>{l.completionPromise=null,l.portNumber=f,s(null,f)},f=>{s(f,0)}))}registerInjectorToChannelz(){return(0,Bt.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(i,o,s=!1){if(i===null||!(i instanceof BM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(o);let a=this.createHttp2Server(i),c=new Set;return this.http2Servers.set(a,{channelzRef:o,sessions:c,ownsChannelzRef:s}),{injectConnection:l=>{a.emit("connection",l)},drain:l=>{var u,d;for(let f of c)this.closeSession(f);(d=(u=setTimeout(()=>{for(let f of c)f.destroy(en.constants.NGHTTP2_CANCEL)},l)).unref)===null||d===void 0||d.call(u)},destroy:()=>{this.closeServer(a);for(let l of c)this.closeSession(l)}}}createConnectionInjector(i){if(i===null||!(i instanceof BM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");let o=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(i,o,!0)}closeServer(i,o){this.trace("Closing server with address "+JSON.stringify(i.address()));let s=this.http2Servers.get(i);i.close(()=>{s&&s.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(s.channelzRef),(0,Bt.unregisterChannelzRef)(s.channelzRef)),this.http2Servers.delete(i),o?.()})}closeSession(i,o){var s;this.trace("Closing session initiated by "+((s=i.socket)===null||s===void 0?void 0:s.remoteAddress));let a=this.sessions.get(i),c=()=>{a&&(this.sessionChildrenTracker.unrefChild(a.ref),(0,Bt.unregisterChannelzRef)(a.ref)),o?.()};i.closed?queueMicrotask(c):i.close(c)}completeUnbind(i){for(let o of i.listeningServers){let s=this.http2Servers.get(o);if(this.closeServer(o,()=>{i.listeningServers.delete(o)}),s)for(let a of s.sessions)this.closeSession(a)}this.boundPorts.delete(i.mapKey)}unbind(i){this.trace("unbind port="+i);let o=this.normalizePort(i),s=(0,Ai.splitHostPort)(o.path);if(s?.port===0)throw new Error("Cannot unbind port 0");let a=this.boundPorts.get((0,Ai.uriToString)(o));a&&(this.trace("unbinding "+a.mapKey+" originally bound as "+(0,Ai.uriToString)(a.originalUri)),a.completionPromise?a.cancelled=!0:this.completeUnbind(a))}drain(i,o){var s,a;this.trace("drain port="+i+" graceTimeMs="+o);let c=this.normalizePort(i),l=(0,Ai.splitHostPort)(c.path);if(l?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,Ai.uriToString)(c));if(!u)return;let d=new Set;for(let f of u.listeningServers){let p=this.http2Servers.get(f);if(p)for(let h of p.sessions)d.add(h),this.closeSession(h,()=>{d.delete(h)})}(a=(s=setTimeout(()=>{for(let f of d)f.destroy(en.constants.NGHTTP2_CANCEL)},o)).unref)===null||a===void 0||a.call(s)}forceShutdown(){for(let i of this.boundPorts.values())i.cancelled=!0;this.boundPorts.clear();for(let i of this.http2Servers.keys())this.closeServer(i);this.sessions.forEach((i,o)=>{this.closeSession(o),o.destroy(en.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,Bt.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(i,o,s,a,c){return this.handlers.has(i)?!1:(this.handlers.set(i,{func:o,serialize:s,deserialize:a,type:c,path:i}),!0)}unregister(i){return this.handlers.delete(i)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(i=>!i.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(i){var o;let s=l=>{(0,Bt.unregisterChannelzRef)(this.channelzRef),i(l)},a=0;function c(){a--,a===0&&s()}this.shutdown=!0;for(let[l,u]of this.http2Servers.entries()){a++;let d=u.channelzRef.name;this.trace("Waiting for server "+d+" to close"),this.closeServer(l,()=>{this.trace("Server "+d+" finished closing"),c()});for(let f of u.sessions.keys()){a++;let p=(o=f.socket)===null||o===void 0?void 0:o.remoteAddress;this.trace("Waiting for session "+p+" to close"),this.closeSession(f,()=>{this.trace("Session "+p+" finished closing"),c()})}}a===0&&s()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(i,o){let s=o[en.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof s!="string"||!s.startsWith("application/grpc")?(i.respond({[en.constants.HTTP2_HEADER_STATUS]:en.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(i){M9("Received call to method "+i+" at address "+this.serverAddressString);let o=this.handlers.get(i);return o===void 0?(M9("No handler registered for method "+i+". Sending UNIMPLEMENTED status."),null):o}_respondWithError(i,o,s=null){var a,c;let l=Object.assign({"grpc-status":(a=i.code)!==null&&a!==void 0?a:Ct.Status.INTERNAL,"grpc-message":i.details,[en.constants.HTTP2_HEADER_STATUS]:en.constants.HTTP_STATUS_OK,[en.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(c=i.metadata)===null||c===void 0?void 0:c.toHttp2Headers());o.respond(l,{endStream:!0}),this.callTracker.addCallFailed(),s?.streamTracker.addCallFailed()}_channelzHandler(i,o,s){o.once("error",f=>{}),this.onStreamOpened(o);let a=this.sessions.get(o.session);if(this.callTracker.addCallStarted(),a?.streamTracker.addCallStarted(),!this._verifyContentType(o,s)){this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed();return}let c=s[N9],l=this._retrieveHandler(c);if(!l){this._respondWithError(zM(c),o,a);return}let u={addMessageSent:()=>{a&&(a.messagesSent+=1,a.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{a&&(a.messagesReceived+=1,a.lastMessageReceivedTimestamp=new Date)},onCallEnd:f=>{f.code===Ct.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:f=>{a&&(f?a.streamTracker.addCallSucceeded():a.streamTracker.addCallFailed())}},d=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,u,l,this.options);this._runHandlerForCall(d,l)||(this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed(),d.sendStatus({code:Ct.Status.INTERNAL,details:`Unknown handler type: ${l.type}`}))}_streamHandler(i,o,s){if(o.once("error",u=>{}),this.onStreamOpened(o),this._verifyContentType(o,s)!==!0)return;let a=s[N9],c=this._retrieveHandler(a);if(!c){this._respondWithError(zM(a),o,null);return}let l=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,null,c,this.options);this._runHandlerForCall(l,c)||l.sendStatus({code:Ct.Status.INTERNAL,details:`Unknown handler type: ${c.type}`})}_runHandlerForCall(i,o){let{type:s}=o;if(s==="unary")xCe(i,o);else if(s==="clientStream")RCe(i,o);else if(s==="serverStream")ICe(i,o);else if(s==="bidi")CCe(i,o);else return!1;return!0}_setupHandlers(i,o){if(i===null)return;let s=i.address(),a="null";s&&(typeof s=="string"?a=s:a=s.address+":"+s.port),this.serverAddressString=a;let c=this.channelzEnabled?this._channelzHandler:this._streamHandler,l=this.channelzEnabled?this._channelzSessionHandler(i):this._sessionHandler(i);i.on("stream",c.bind(this,o)),i.on("session",l)}_sessionHandler(i){return o=>{var s,a;(s=this.http2Servers.get(i))===null||s===void 0||s.sessions.add(o);let c=null,l=null,u=null,d=!1,f=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==tf){let E=this.maxConnectionAgeMs/10,b=Math.random()*E*2-E;c=setTimeout(()=>{var A,y;d=!0,this.trace("Connection dropped by max connection age: "+((A=o.socket)===null||A===void 0?void 0:A.remoteAddress));try{o.goaway(en.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==tf&&(l=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(y=l.unref)===null||y===void 0||y.call(l))},this.maxConnectionAgeMs+b),(a=c.unref)===null||a===void 0||a.call(c)}let p=()=>{u&&(clearTimeout(u),u=null)},h=()=>!o.destroyed&&this.keepaliveTimeMs<jM&&this.keepaliveTimeMs>0,m,S=()=>{var E;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),u=setTimeout(()=>{p(),m()},this.keepaliveTimeMs),(E=u.unref)===null||E===void 0||E.call(u))};m=()=>{var E;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let b="";try{o.ping((y,x,C)=>{p(),y?(this.keepaliveTrace("Ping failed with error: "+y.message),d=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),S())})||(b="Ping returned false")}catch(A){b=(A instanceof Error?A.message:"")||"Unknown error"}if(b){this.keepaliveTrace("Ping send failed: "+b),this.trace("Connection dropped due to ping send error: "+b),d=!0,o.destroy();return}u=setTimeout(()=>{p(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),d=!0,o.destroy()},this.keepaliveTimeoutMs),(E=u.unref)===null||E===void 0||E.call(u)},S(),o.on("close",()=>{var E,b;d||this.trace(`Connection dropped by client ${(E=o.socket)===null||E===void 0?void 0:E.remoteAddress}`),c&&clearTimeout(c),l&&clearTimeout(l),p(),f!==null&&(clearTimeout(f.timeout),this.sessionIdleTimeouts.delete(o)),(b=this.http2Servers.get(i))===null||b===void 0||b.sessions.delete(o)})}}_channelzSessionHandler(i){return o=>{var s,a,c,l;let u=(0,Bt.registerChannelzSocket)((a=(s=o.socket)===null||s===void 0?void 0:s.remoteAddress)!==null&&a!==void 0?a:"unknown",this.getChannelzSessionInfo.bind(this,o),this.channelzEnabled),d={ref:u,streamTracker:new Bt.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(c=this.http2Servers.get(i))===null||c===void 0||c.sessions.add(o),this.sessions.set(o,d);let f=`${o.socket.remoteAddress}:${o.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.trace("Connection established by client "+f),this.sessionChildrenTracker.refChild(u);let p=null,h=null,m=null,S=!1,E=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==tf){let C=this.maxConnectionAgeMs/10,O=Math.random()*C*2-C;p=setTimeout(()=>{var N;S=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{o.goaway(en.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==tf&&(h=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(N=h.unref)===null||N===void 0||N.call(h))},this.maxConnectionAgeMs+O),(l=p.unref)===null||l===void 0||l.call(p)}let b=()=>{m&&(clearTimeout(m),m=null)},A=()=>!o.destroyed&&this.keepaliveTimeMs<jM&&this.keepaliveTimeMs>0,y,x=()=>{var C;A()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),m=setTimeout(()=>{b(),y()},this.keepaliveTimeMs),(C=m.unref)===null||C===void 0||C.call(m))};y=()=>{var C;if(!A())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let O="";try{o.ping((R,$,_)=>{b(),R?(this.keepaliveTrace("Ping failed with error: "+R.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+R.message+" return in "+$),S=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),x())})||(O="Ping returned false")}catch(N){O=(N instanceof Error?N.message:"")||"Unknown error"}if(O){this.keepaliveTrace("Ping send failed: "+O),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+O),S=!0,o.destroy();return}d.keepAlivesSent+=1,m=setTimeout(()=>{b(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),S=!0,o.destroy()},this.keepaliveTimeoutMs),(C=m.unref)===null||C===void 0||C.call(m)},x(),o.on("close",()=>{var C;S||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(u),(0,Bt.unregisterChannelzRef)(u),p&&clearTimeout(p),h&&clearTimeout(h),b(),E!==null&&(clearTimeout(E.timeout),this.sessionIdleTimeouts.delete(o)),(C=this.http2Servers.get(i))===null||C===void 0||C.sessions.delete(o),this.sessions.delete(o)})}}enableIdleTimeout(i){var o,s;if(this.sessionIdleTimeout>=O9)return null;let a={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,i),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,i)};(s=(o=a.timeout).unref)===null||s===void 0||s.call(o),this.sessionIdleTimeouts.set(i,a);let{socket:c}=i;return this.trace("Enable idle timeout for "+c.remoteAddress+":"+c.remotePort),a}onIdleTimeout(i,o){let{socket:s}=o,a=i.sessionIdleTimeouts.get(o);a!==void 0&&a.activeStreams===0&&(Date.now()-a.lastIdle>=i.sessionIdleTimeout?(i.trace("Session idle timeout triggered for "+s?.remoteAddress+":"+s?.remotePort+" last idle at "+a.lastIdle),i.closeSession(o)):a.timeout.refresh())}onStreamOpened(i){let o=i.session,s=this.sessionIdleTimeouts.get(o);s&&(s.activeStreams+=1,i.once("close",s.onClose))}onStreamClose(i){var o,s;let a=this.sessionIdleTimeouts.get(i);a&&(a.activeStreams-=1,a.activeStreams===0&&(a.lastIdle=Date.now(),a.timeout.refresh(),this.trace("Session onStreamClose"+((o=i.socket)===null||o===void 0?void 0:o.remoteAddress)+":"+((s=i.socket)===null||s===void 0?void 0:s.remotePort)+" at "+a.lastIdle)))}},(()=>{let n=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;r=[bCe("Calling start() is no longer necessary. It can be safely omitted.")],yCe(t,null,r,{kind:"method",name:"start",static:!1,private:!1,access:{has:i=>"start"in i,get:i=>i.start},metadata:n},null,e),n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),t})();Ra.Server=wCe;async function xCe(t,e){let r;function n(s,a,c,l){if(s){t.sendStatus((0,nf.serverErrorToStatus)(s,c));return}t.sendMessage(a,()=>{t.sendStatus({code:Ct.Status.OK,details:"OK",metadata:c??null})})}let i,o=null;t.start({onReceiveMetadata(s){i=s,t.startRead()},onReceiveMessage(s){if(o){t.sendStatus({code:Ct.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}o=s,t.startRead()},onReceiveHalfClose(){if(!o){t.sendStatus({code:Ct.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new nf.ServerWritableStreamImpl(e.path,t,i,o);try{e.func(r,n)}catch(s){t.sendStatus({code:Ct.Status.UNKNOWN,details:`Server method handler threw error ${s.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}function RCe(t,e){let r;function n(i,o,s,a){if(i){t.sendStatus((0,nf.serverErrorToStatus)(i,s));return}t.sendMessage(o,()=>{t.sendStatus({code:Ct.Status.OK,details:"OK",metadata:s??null})})}t.start({onReceiveMetadata(i){r=new nf.ServerDuplexStreamImpl(e.path,t,i);try{e.func(r,n)}catch(o){t.sendStatus({code:Ct.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onReceiveMessage(i){r.push(i)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function ICe(t,e){let r,n,i=null;t.start({onReceiveMetadata(o){n=o,t.startRead()},onReceiveMessage(o){if(i){t.sendStatus({code:Ct.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}i=o,t.startRead()},onReceiveHalfClose(){if(!i){t.sendStatus({code:Ct.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new nf.ServerWritableStreamImpl(e.path,t,n,i);try{e.func(r)}catch(o){t.sendStatus({code:Ct.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function CCe(t,e){let r;t.start({onReceiveMetadata(n){r=new nf.ServerDuplexStreamImpl(e.path,t,n);try{e.func(r)}catch(i){t.sendStatus({code:Ct.Status.UNKNOWN,details:`Server method handler threw error ${i.message}`,metadata:null})}},onReceiveMessage(n){r.push(n)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}});var L9=T(qb=>{"use strict";Object.defineProperty(qb,"__esModule",{value:!0});qb.StatusBuilder=void 0;var GM=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){let e={};return this.code!==null&&(e.code=this.code),this.details!==null&&(e.details=this.details),this.metadata!==null&&(e.metadata=this.metadata),e}};qb.StatusBuilder=GM});var Zg=T(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.LeafLoadBalancer=po.PickFirstLoadBalancer=po.PickFirstLoadBalancingConfig=void 0;po.shuffled=B9;po.setup=$Ce;var qM=da(),Pt=Mr(),Ia=Ko(),$9=Xr(),PCe=lt(),OCe=Ge(),U9=Xr(),F9=Q("net"),NCe=ll(),kCe="pick_first";function Wg(t){PCe.trace(OCe.LogVerbosity.DEBUG,kCe,t)}var Yg="pick_first",MCe=250,of=class t{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return Yg}toJsonObject(){return{[Yg]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&typeof e.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new t(e.shuffleAddressList===!0)}};po.PickFirstLoadBalancingConfig=of;var VM=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:Ia.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function B9(t){let e=t.slice();for(let r=e.length-1;r>1;r--){let n=Math.floor(Math.random()*(r+1)),i=e[r];e[r]=e[n],e[n]=i}return e}function DCe(t){if(t.length===0)return[];let e=[],r=[],n=[],i=(0,U9.isTcpSubchannelAddress)(t[0])&&(0,F9.isIPv6)(t[0].host);for(let a of t)(0,U9.isTcpSubchannelAddress)(a)&&(0,F9.isIPv6)(a.host)?r.push(a):n.push(a);let o=i?r:n,s=i?n:r;for(let a=0;a<Math.max(o.length,s.length);a++)a<o.length&&e.push(o[a]),a<s.length&&e.push(s[a]);return e}var j9="grpc-node.internal.pick-first.report_health_status",Kg=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=Pt.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(r,n,i,o,s)=>{this.onSubchannelStateUpdate(r,n,i,s)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let r=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(Pt.ConnectivityState.TRANSIENT_FAILURE,new Ia.UnavailablePicker({details:r}),r)}else this.updateState(Pt.ConnectivityState.READY,new VM(this.currentPick),null);else if(((e=this.latestAddressList)===null||e===void 0?void 0:e.length)===0){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(Pt.ConnectivityState.TRANSIENT_FAILURE,new Ia.UnavailablePicker({details:r}),r)}else if(this.children.length===0)this.updateState(Pt.ConnectivityState.IDLE,new Ia.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(Pt.ConnectivityState.TRANSIENT_FAILURE,new Ia.UnavailablePicker({details:r}),r)}else this.updateState(Pt.ConnectivityState.CONNECTING,new Ia.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()){if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){this.currentPick!==null&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var o;if(!((o=this.currentPick)===null||o===void 0)&&o.realSubchannelEquals(e)){n!==Pt.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());return}for(let[s,a]of this.children.entries())if(e.realSubchannelEquals(a.subchannel)){n===Pt.ConnectivityState.READY&&this.pickSubchannel(a.subchannel),n===Pt.ConnectivityState.TRANSIENT_FAILURE&&(a.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),s===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(s+1)),a.subchannel.startConnecting();return}}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(let[r,n]of this.children.entries())if(r>=e){let i=n.subchannel.getConnectivityState();if(i===Pt.ConnectivityState.IDLE||i===Pt.ConnectivityState.CONNECTING){this.startConnecting(r);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===Pt.ConnectivityState.IDLE&&(Wg("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var i;(i=this.children[e])===null||i===void 0||i.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},MCe),(n=(r=this.connectionDelayTimeout).unref)===null||n===void 0||n.call(r)}pickSubchannel(e){Wg("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){Wg(Pt.ConnectivityState[this.currentState]+" -> "+Pt.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){Wg("connectToAddressList(["+e.map(i=>(0,$9.subchannelAddressToString)(i))+"])");let n=e.map(i=>({subchannel:this.channelControlHelper.createSubchannel(i,r),hasReportedTransientFailure:!1}));for(let{subchannel:i}of n)if(i.getConnectivityState()===Pt.ConnectivityState.READY){this.pickSubchannel(i);return}for(let{subchannel:i}of n)i.ref(),this.channelControlHelper.addChannelzChild(i.getChannelzRef());this.resetSubchannelList(),this.children=n;for(let{subchannel:i}of this.children)i.addConnectivityStateListener(this.subchannelStateListener);for(let i of this.children)i.subchannel.getConnectivityState()===Pt.ConnectivityState.TRANSIENT_FAILURE&&(i.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,r,n,i){if(!(r instanceof of))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(Pt.ConnectivityState.TRANSIENT_FAILURE,new Ia.UnavailablePicker(e.error),e.error.details),!0;let o=e.value;this.reportHealthStatus=n[j9],r.getShuffleAddressList()&&(o=B9(o));let s=[].concat(...o.map(c=>c.addresses));Wg("updateAddressList(["+s.map(c=>(0,$9.subchannelAddressToString)(c))+"])");let a=DCe(s);return this.latestAddressList=a,this.latestOptions=n,this.connectToAddressList(a,n),this.latestResolutionNote=i,s.length>0?!0:(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===Pt.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return Yg}};po.PickFirstLoadBalancer=Kg;var LCe=new of(!1),HM=class{constructor(e,r,n,i){this.endpoint=e,this.options=n,this.resolutionNote=i,this.latestState=Pt.ConnectivityState.IDLE;let o=(0,qM.createChildChannelControlHelper)(r,{updateState:(s,a,c)=>{this.latestState=s,this.latestPicker=a,r.updateState(s,a,c)}});this.pickFirstBalancer=new Kg(o),this.latestPicker=new Ia.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,NCe.statusOrFromValue)([this.endpoint]),LCe,Object.assign(Object.assign({},this.options),{[j9]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==Pt.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};po.LeafLoadBalancer=HM;function $Ce(){(0,qM.registerLoadBalancerType)(Yg,Kg,of),(0,qM.registerDefaultLoadBalancerType)(Yg)}});var z9=T(Hb=>{"use strict";Object.defineProperty(Hb,"__esModule",{value:!0});Hb.FileWatcherCertificateProvider=void 0;var UCe=Q("fs"),FCe=lt(),BCe=Ge(),jCe=Q("util"),zCe="certificate_provider";function Vb(t){FCe.trace(BCe.LogVerbosity.DEBUG,zCe,t)}var WM=(0,jCe.promisify)(UCe.readFile),YM=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,e.certificateFile===void 0!=(e.privateKeyFile===void 0))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(e.certificateFile===void 0&&e.caCertificateFile===void 0)throw new Error("At least one of certificateFile and caCertificateFile must be set");Vb("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?WM(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?WM(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?WM(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,r,n])=>{if(this.refreshTimer){Vb("File watcher read certificates certificate "+e.status+", privateKey "+r.status+", CA certificate "+n.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,e.status==="fulfilled"&&r.status==="fulfilled"?this.latestIdentityUpdate={certificate:e.value,privateKey:r.value}:this.latestIdentityUpdate=null,n.status==="fulfilled"?this.latestCaUpdate={caCertificate:n.value}:this.latestCaUpdate=null;for(let i of this.identityListeners)i(this.latestIdentityUpdate);for(let i of this.caListeners)i(this.latestCaUpdate)}}),Vb("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){let e=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>this.config.refreshIntervalMs*2&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),Vb("File watcher started watching")}}maybeStopWatchingFiles(){this.caListeners.size===0&&this.identityListeners.size===0&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}};Hb.FileWatcherCertificateProvider=YM});var JM=T(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=_e.createCertificateProviderChannelCredentials=_e.FileWatcherCertificateProvider=_e.createCertificateProviderServerCredentials=_e.createServerCredentialsWithInterceptors=_e.BaseSubchannelWrapper=_e.registerAdminService=_e.FilterStackFactory=_e.BaseFilter=_e.statusOrFromError=_e.statusOrFromValue=_e.PickResultType=_e.QueuePicker=_e.UnavailablePicker=_e.ChildLoadBalancerHandler=_e.EndpointMap=_e.endpointHasAddress=_e.endpointToString=_e.subchannelAddressToString=_e.LeafLoadBalancer=_e.isLoadBalancerNameRegistered=_e.parseLoadBalancingConfig=_e.selectLbConfigFromList=_e.registerLoadBalancerType=_e.createChildChannelControlHelper=_e.BackoffTimeout=_e.parseDuration=_e.durationToMs=_e.splitHostPort=_e.uriToString=_e.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=_e.createResolver=_e.registerResolver=_e.log=_e.trace=void 0;var G9=lt();Object.defineProperty(_e,"trace",{enumerable:!0,get:function(){return G9.trace}});Object.defineProperty(_e,"log",{enumerable:!0,get:function(){return G9.log}});var KM=ui();Object.defineProperty(_e,"registerResolver",{enumerable:!0,get:function(){return KM.registerResolver}});Object.defineProperty(_e,"createResolver",{enumerable:!0,get:function(){return KM.createResolver}});Object.defineProperty(_e,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return KM.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var q9=kr();Object.defineProperty(_e,"uriToString",{enumerable:!0,get:function(){return q9.uriToString}});Object.defineProperty(_e,"splitHostPort",{enumerable:!0,get:function(){return q9.splitHostPort}});var V9=Hg();Object.defineProperty(_e,"durationToMs",{enumerable:!0,get:function(){return V9.durationToMs}});Object.defineProperty(_e,"parseDuration",{enumerable:!0,get:function(){return V9.parseDuration}});var GCe=Rd();Object.defineProperty(_e,"BackoffTimeout",{enumerable:!0,get:function(){return GCe.BackoffTimeout}});var Jg=da();Object.defineProperty(_e,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Jg.createChildChannelControlHelper}});Object.defineProperty(_e,"registerLoadBalancerType",{enumerable:!0,get:function(){return Jg.registerLoadBalancerType}});Object.defineProperty(_e,"selectLbConfigFromList",{enumerable:!0,get:function(){return Jg.selectLbConfigFromList}});Object.defineProperty(_e,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Jg.parseLoadBalancingConfig}});Object.defineProperty(_e,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Jg.isLoadBalancerNameRegistered}});var qCe=Zg();Object.defineProperty(_e,"LeafLoadBalancer",{enumerable:!0,get:function(){return qCe.LeafLoadBalancer}});var Wb=Xr();Object.defineProperty(_e,"subchannelAddressToString",{enumerable:!0,get:function(){return Wb.subchannelAddressToString}});Object.defineProperty(_e,"endpointToString",{enumerable:!0,get:function(){return Wb.endpointToString}});Object.defineProperty(_e,"endpointHasAddress",{enumerable:!0,get:function(){return Wb.endpointHasAddress}});Object.defineProperty(_e,"EndpointMap",{enumerable:!0,get:function(){return Wb.EndpointMap}});var VCe=ST();Object.defineProperty(_e,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return VCe.ChildLoadBalancerHandler}});var ZM=Ko();Object.defineProperty(_e,"UnavailablePicker",{enumerable:!0,get:function(){return ZM.UnavailablePicker}});Object.defineProperty(_e,"QueuePicker",{enumerable:!0,get:function(){return ZM.QueuePicker}});Object.defineProperty(_e,"PickResultType",{enumerable:!0,get:function(){return ZM.PickResultType}});var H9=ll();Object.defineProperty(_e,"statusOrFromValue",{enumerable:!0,get:function(){return H9.statusOrFromValue}});Object.defineProperty(_e,"statusOrFromError",{enumerable:!0,get:function(){return H9.statusOrFromError}});var HCe=wk();Object.defineProperty(_e,"BaseFilter",{enumerable:!0,get:function(){return HCe.BaseFilter}});var WCe=gb();Object.defineProperty(_e,"FilterStackFactory",{enumerable:!0,get:function(){return WCe.FilterStackFactory}});var YCe=bT();Object.defineProperty(_e,"registerAdminService",{enumerable:!0,get:function(){return YCe.registerAdminService}});var KCe=qg();Object.defineProperty(_e,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return KCe.BaseSubchannelWrapper}});var W9=$b();Object.defineProperty(_e,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return W9.createServerCredentialsWithInterceptors}});Object.defineProperty(_e,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return W9.createCertificateProviderServerCredentials}});var ZCe=z9();Object.defineProperty(_e,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return ZCe.FileWatcherCertificateProvider}});var JCe=xd();Object.defineProperty(_e,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return JCe.createCertificateProviderChannelCredentials}});var XCe=pM();Object.defineProperty(_e,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return XCe.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var Y9=T(QM=>{"use strict";Object.defineProperty(QM,"__esModule",{value:!0});QM.setup=tPe;var QCe=ui(),ePe=ll(),XM=class{constructor(e,r,n){this.listener=r,this.hasReturnedResult=!1,this.endpoints=[];let i;e.authority===""?i="/"+e.path:i=e.path,this.endpoints=[{addresses:[{path:i}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,ePe.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function tPe(){(0,QCe.registerResolver)("unix",XM)}});var eJ=T(nD=>{"use strict";Object.defineProperty(nD,"__esModule",{value:!0});nD.setup=sPe;var K9=Q("net"),Z9=ll(),Yb=Ge(),eD=Kt(),J9=ui(),rPe=Xr(),X9=kr(),nPe=lt(),iPe="ip_resolver";function Q9(t){nPe.trace(Yb.LogVerbosity.DEBUG,iPe,t)}var tD="ipv4",rD="ipv6",oPe=443,Kb=class{constructor(e,r,n){var i;this.listener=r,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,Q9("Resolver constructed for target "+(0,X9.uriToString)(e));let o=[];if(!(e.scheme===tD||e.scheme===rD)){this.error={code:Yb.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new eD.Metadata};return}let s=e.path.split(",");for(let a of s){let c=(0,X9.splitHostPort)(a);if(c===null){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new eD.Metadata};return}if(e.scheme===tD&&!(0,K9.isIPv4)(c.host)||e.scheme===rD&&!(0,K9.isIPv6)(c.host)){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new eD.Metadata};return}o.push({host:c.host,port:(i=c.port)!==null&&i!==void 0?i:oPe})}this.endpoints=o.map(a=>({addresses:[a]})),Q9("Parsed "+e.scheme+" address list "+o.map(rPe.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,Z9.statusOrFromError)(this.error),{},null,""):this.listener((0,Z9.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function sPe(){(0,J9.registerResolver)(tD,Kb),(0,J9.registerResolver)(rD,Kb)}});var iJ=T(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});Qg.RoundRobinLoadBalancer=void 0;Qg.setup=fPe;var nJ=da(),dr=Mr(),Xg=Ko(),aPe=lt(),cPe=Ge(),tJ=Xr(),lPe=Zg(),uPe="round_robin";function rJ(t){aPe.trace(cPe.LogVerbosity.DEBUG,uPe,t)}var Zb="round_robin",Jb=class t{getLoadBalancerName(){return Zb}constructor(){}toJsonObject(){return{[Zb]:{}}}static createFromJson(e){return new t}},iD=class{constructor(e,r=0){this.children=e,this.nextIndex=r}pick(e){let r=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,r.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};function dPe(t,e){return[...t.slice(e),...t.slice(0,e)]}var Xb=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=dr.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,nJ.createChildChannelControlHelper)(e,{updateState:(r,n,i)=>{this.currentState===dr.ConnectivityState.READY&&r!==dr.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(r=>r.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(dr.ConnectivityState.READY)>0){let e=this.children.filter(n=>n.getConnectivityState()===dr.ConnectivityState.READY),r=0;if(this.currentReadyPicker!==null){let n=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(i=>(0,tJ.endpointEqual)(i.getEndpoint(),n)),r<0&&(r=0)}this.updateState(dr.ConnectivityState.READY,new iD(e.map(n=>({endpoint:n.getEndpoint(),picker:n.getPicker()})),r),null)}else if(this.countChildrenWithState(dr.ConnectivityState.CONNECTING)>0)this.updateState(dr.ConnectivityState.CONNECTING,new Xg.QueuePicker(this),null);else if(this.countChildrenWithState(dr.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Xg.UnavailablePicker({details:e}),e)}else this.updateState(dr.ConnectivityState.IDLE,new Xg.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===dr.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){rJ(dr.ConnectivityState[this.currentState]+" -> "+dr.ConnectivityState[e]),e===dr.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.destroy();this.children=[]}updateAddressList(e,r,n,i){if(!(r instanceof Jb))return!1;if(!e.ok)return this.children.length===0&&this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Xg.UnavailablePicker(e.error),e.error.details),!0;let o=Math.random()*e.value.length|0,s=dPe(e.value,o);if(this.resetSubchannelList(),s.length===0){let a=`No addresses resolved. Resolution note: ${i}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Xg.UnavailablePicker({details:a}),a)}rJ("Connect to endpoint list "+s.map(tJ.endpointToString)),this.updatesPaused=!0,this.children=s.map(a=>new lPe.LeafLoadBalancer(a,this.childChannelControlHelper,n,i));for(let a of this.children)a.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Zb}};Qg.RoundRobinLoadBalancer=Xb;function fPe(){(0,nJ.registerLoadBalancerType)(Zb,Xb,Jb)}});var aJ=T(Cl=>{"use strict";var oD;Object.defineProperty(Cl,"__esModule",{value:!0});Cl.OutlierDetectionLoadBalancer=Cl.OutlierDetectionLoadBalancingConfig=void 0;Cl.setup=bPe;var pPe=Mr(),oJ=Ge(),Il=Hg(),sJ=JM(),hPe=da(),mPe=ST(),gPe=Ko(),sD=Xr(),_Pe=qg(),yPe=lt(),SPe="outlier_detection";function Qt(t){yPe.trace(oJ.LogVerbosity.DEBUG,SPe,t)}var fD="outlier_detection",EPe=((oD=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&oD!==void 0?oD:"true")==="true",vPe={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},TPe={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function sf(t,e,r,n){if(e in t&&t[e]!==void 0&&typeof t[e]!==r){let i=n?`${n}.${e}`:e;throw new Error(`outlier detection config ${i} parse error: expected ${r}, got ${typeof t[e]}`)}}function aD(t,e,r){let n=r?`${r}.${e}`:e;if(e in t&&t[e]!==void 0){if(!(0,Il.isDuration)(t[e]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof t[e]}`);if(!(t[e].seconds>=0&&t[e].seconds<=315576e6&&t[e].nanos>=0&&t[e].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function Qb(t,e,r){let n=r?`${r}.${e}`:e;if(sf(t,e,"number",r),e in t&&t[e]!==void 0&&!(t[e]>=0&&t[e]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}var e_=class t{constructor(e,r,n,i,o,s,a){if(this.childPolicy=a,a.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=e??1e4,this.baseEjectionTimeMs=r??3e4,this.maxEjectionTimeMs=n??3e5,this.maxEjectionPercent=i??10,this.successRateEjection=o?Object.assign(Object.assign({},vPe),o):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},TPe),s):null}getLoadBalancerName(){return fD}toJsonObject(){var e,r;return{outlier_detection:{interval:(0,Il.msToDuration)(this.intervalMs),base_ejection_time:(0,Il.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,Il.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(e=this.successRateEjection)!==null&&e!==void 0?e:void 0,failure_percentage_ejection:(r=this.failurePercentageEjection)!==null&&r!==void 0?r:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var r;if(aD(e,"interval"),aD(e,"base_ejection_time"),aD(e,"max_ejection_time"),Qb(e,"max_ejection_percent"),"success_rate_ejection"in e&&e.success_rate_ejection!==void 0){if(typeof e.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");sf(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),Qb(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),sf(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),sf(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&e.failure_percentage_ejection!==void 0){if(typeof e.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");Qb(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),Qb(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),sf(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),sf(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");let n=(0,hPe.selectLbConfigFromList)(e.child_policy);if(!n)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new t(e.interval?(0,Il.durationToMs)(e.interval):null,e.base_ejection_time?(0,Il.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,Il.durationToMs)(e.max_ejection_time):null,(r=e.max_ejection_percent)!==null&&r!==void 0?r:null,e.success_rate_ejection,e.failure_percentage_ejection,n)}};Cl.OutlierDetectionLoadBalancingConfig=e_;var lD=class extends _Pe.BaseSubchannelWrapper{constructor(e,r){super(e),this.mapEntry=r,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function cD(){return{success:0,failure:0}}var uD=class{constructor(){this.activeBucket=cD(),this.inactiveBucket=cD()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=cD()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},dD=class{constructor(e,r){this.wrappedPicker=e,this.countCalls=r}pick(e){let r=this.wrappedPicker.pick(e);if(r.pickResultType===gPe.PickResultType.COMPLETE){let n=r.subchannel,i=n.getMapEntry();if(i){let o=r.onCallEnded;return this.countCalls&&(o=(s,a,c)=>{var l;s===oJ.Status.OK?i.counter.addSuccess():i.counter.addFailure(),(l=r.onCallEnded)===null||l===void 0||l.call(r,s,a,c)}),Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel(),onCallEnded:o})}else return Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel()})}else return r}},eA=class{constructor(e){this.entryMap=new sD.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new mPe.ChildLoadBalancerHandler((0,sJ.createChildChannelControlHelper)(e,{createSubchannel:(r,n)=>{let i=e.createSubchannel(r,n),o=this.entryMap.getForSubchannelAddress(r),s=new lD(i,o);return o?.currentEjectionTimestamp!==null&&s.eject(),o?.subchannelWrappers.push(s),s},updateState:(r,n,i)=>{r===pPe.ConnectivityState.READY?e.updateState(r,new dD(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let e=0;for(let r of this.entryMap.values())r.currentEjectionTimestamp!==null&&(e+=1);return e*100/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getSuccessRateEjectionConfig();if(!r)return;Qt("Running success rate check");let n=r.request_volume,i=0,o=[];for(let[d,f]of this.entryMap.entries()){let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();Qt("Stats for "+(0,sD.endpointToString)(d)+": successes="+p+" failures="+h+" targetRequestVolume="+n),p+h>=n&&(i+=1,o.push(p/(p+h)))}if(Qt("Found "+i+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+o+"]"),i<r.minimum_hosts)return;let s=o.reduce((d,f)=>d+f)/o.length,a=0;for(let d of o){let f=d-s;a+=f*f}let c=a/o.length,l=Math.sqrt(c),u=s-l*(r.stdev_factor/1e3);Qt("stdev="+l+" ejectionThreshold="+u);for(let[d,f]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();if(p+h<n)continue;let m=p/(p+h);if(Qt("Checking candidate "+d+" successRate="+m),m<u){let S=Math.random()*100;Qt("Candidate "+d+" randomNumber="+S+" enforcement_percentage="+r.enforcement_percentage),S<r.enforcement_percentage&&(Qt("Ejecting candidate "+d),this.eject(f,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getFailurePercentageEjectionConfig();if(!r)return;Qt("Running failure percentage check. threshold="+r.threshold+" request volume threshold="+r.request_volume);let n=0;for(let i of this.entryMap.values()){let o=i.counter.getLastSuccesses(),s=i.counter.getLastFailures();o+s>=r.request_volume&&(n+=1)}if(!(n<r.minimum_hosts))for(let[i,o]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let s=o.counter.getLastSuccesses(),a=o.counter.getLastFailures();if(Qt("Candidate successes="+s+" failures="+a),s+a<r.request_volume)continue;if(a*100/(a+s)>r.threshold){let l=Math.random()*100;Qt("Candidate "+i+" randomNumber="+l+" enforcement_percentage="+r.enforcement_percentage),l<r.enforcement_percentage&&(Qt("Ejecting candidate "+i),this.eject(o,e))}}}eject(e,r){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(let n of e.subchannelWrappers)n.eject()}uneject(e){e.currentEjectionTimestamp=null;for(let r of e.subchannelWrappers)r.uneject()}switchAllBuckets(){for(let e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var r,n;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),(n=(r=this.ejectionTimer).unref)===null||n===void 0||n.call(r)}runChecks(){let e=new Date;if(Qt("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(let[r,n]of this.entryMap.entries())if(n.currentEjectionTimestamp===null)n.ejectionTimeMultiplier>0&&(n.ejectionTimeMultiplier-=1);else{let i=this.latestConfig.getBaseEjectionTimeMs(),o=this.latestConfig.getMaxEjectionTimeMs(),s=new Date(n.currentEjectionTimestamp.getTime());s.setMilliseconds(s.getMilliseconds()+Math.min(i*n.ejectionTimeMultiplier,Math.max(i,o))),s<new Date&&(Qt("Unejecting "+r),this.uneject(n))}}}updateAddressList(e,r,n,i){if(!(r instanceof e_))return!1;if(Qt("Received update with config: "+JSON.stringify(r.toJsonObject(),void 0,2)),e.ok){for(let s of e.value)this.entryMap.has(s)||(Qt("Adding map entry for "+(0,sD.endpointToString)(s)),this.entryMap.set(s,{counter:new uD,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}let o=r.getChildPolicy();if(this.childBalancer.updateAddressList(e,o,n,i),r.getSuccessRateEjectionConfig()||r.getFailurePercentageEjectionConfig())if(this.timerStartTime){Qt("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let s=r.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(s)}else Qt("Starting new timer"),this.timerStartTime=new Date,this.startTimer(r.getIntervalMs()),this.switchAllBuckets();else{Qt("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let s of this.entryMap.values())this.uneject(s),s.ejectionTimeMultiplier=0}return this.latestConfig=r,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return fD}};Cl.OutlierDetectionLoadBalancer=eA;function bPe(){EPe&&(0,sJ.registerLoadBalancerType)(fD,eA,e_)}});var cJ=T(rA=>{"use strict";Object.defineProperty(rA,"__esModule",{value:!0});rA.PriorityQueue=void 0;var af=0,pD=t=>Math.floor(t/2),tA=t=>t*2+1,t_=t=>t*2+2,hD=class{constructor(e=(r,n)=>r>n){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[af]}push(...e){return e.forEach(r=>{this.heap.push(r),this.siftUp()}),this.size()}pop(){let e=this.peek(),r=this.size()-1;return r>af&&this.swap(af,r),this.heap.pop(),this.siftDown(),e}replace(e){let r=this.peek();return this.heap[af]=e,this.siftDown(),r}greater(e,r){return this.comparator(this.heap[e],this.heap[r])}swap(e,r){[this.heap[e],this.heap[r]]=[this.heap[r],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>af&&this.greater(e,pD(e));)this.swap(e,pD(e)),e=pD(e)}siftDown(){let e=af;for(;tA(e)<this.size()&&this.greater(tA(e),e)||t_(e)<this.size()&&this.greater(t_(e),e);){let r=t_(e)<this.size()&&this.greater(t_(e),tA(e))?t_(e):tA(e);this.swap(e,r),e=r}}};rA.PriorityQueue=hD});var pJ=T(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});n_.WeightedRoundRobinLoadBalancingConfig=void 0;n_.setup=MPe;var er=Mr(),APe=Ge(),En=Hg(),dJ=da(),wPe=Zg(),xPe=lt(),fJ=Fb(),cf=Ko(),RPe=cJ(),lJ=Xr(),IPe="weighted_round_robin";function mD(t){xPe.trace(APe.LogVerbosity.DEBUG,IPe,t)}var yD="weighted_round_robin",CPe=1e4,PPe=1e4,OPe=3*6e4,NPe=1e3,kPe=1;function uJ(t,e,r){if(e in t&&t[e]!==void 0&&typeof t[e]!==r)throw new Error(`weighted round robin config ${e} parse error: expected ${r}, got ${typeof t[e]}`)}function nA(t,e){if(e in t&&t[e]!==void 0&&t[e]!==null){let r;if((0,En.isDuration)(t[e]))r=t[e];else if((0,En.isDurationMessage)(t[e]))r=(0,En.durationMessageToDuration)(t[e]);else if(typeof t[e]=="string"){let n=(0,En.parseDuration)(t[e]);if(!n)throw new Error(`weighted round robin config ${e}: failed to parse duration string ${t[e]}`);r=n}else throw new Error(`weighted round robin config ${e}: expected duration, got ${typeof t[e]}`);return(0,En.durationToMs)(r)}return null}var r_=class t{constructor(e,r,n,i,o,s){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=r??CPe,this.blackoutPeriodMs=n??PPe,this.weightExpirationPeriodMs=i??OPe,this.weightUpdatePeriodMs=Math.max(o??NPe,100),this.errorUtilizationPenalty=s??kPe}getLoadBalancerName(){return yD}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,En.durationToString)((0,En.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,En.durationToString)((0,En.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,En.durationToString)((0,En.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,En.durationToString)((0,En.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(uJ(e,"enable_oob_load_report","boolean"),uJ(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new t(e.enable_oob_load_report,nA(e,"oob_load_reporting_period"),nA(e,"blackout_period"),nA(e,"weight_expiration_period"),nA(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}};n_.WeightedRoundRobinLoadBalancingConfig=r_;var gD=class{constructor(e,r){this.metricsHandler=r,this.queue=new RPe.PriorityQueue((o,s)=>o.deadline<s.deadline);let n=e.filter(o=>o.weight>0),i;if(n.length<2)i=1;else{let o=0;for(let{weight:s}of n)o+=s;i=o/n.length}for(let o of e){let s=o.weight>0?1/o.weight:i;this.queue.push({endpointName:o.endpointName,picker:o.picker,period:s,deadline:Math.random()*s})}}pick(e){let r=this.queue.pop();this.queue.push(Object.assign(Object.assign({},r),{deadline:r.deadline+r.period}));let n=r.picker.pick(e);if(n.pickResultType===cf.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},n),{onCallEnded:(0,fJ.createMetricsReader)(i=>this.metricsHandler(i,r.endpointName),n.onCallEnded)});{let i=n.subchannel;return Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel()})}}else return n}},_D=class{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=er.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let r=0;for(let n of this.children.values())n.child.getConnectivityState()===e&&(r+=1);return r}updateWeight(e,r){var n,i;let o=r.rps_fractional,s=r.application_utilization;s>0&&o>0&&(s+=r.eps/o*((i=(n=this.latestConfig)===null||n===void 0?void 0:n.getErrorUtilizationPenalty())!==null&&i!==void 0?i:0));let a=s===0?0:o/s;if(a===0)return;let c=new Date;e.nonEmptySince===null&&(e.nonEmptySince=c),e.lastUpdated=c,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;let r=new Date().getTime();if(r-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;let n=this.latestConfig.getBlackoutPeriodMs();return n>0&&(e.nonEmptySince===null||r-e.nonEmptySince.getTime()<n)?0:e.weight}calculateAndUpdateState(){if(!(this.updatesPaused||!this.latestConfig)){if(this.countChildrenWithState(er.ConnectivityState.READY)>0){let e=[];for(let[n,i]of this.children)i.child.getConnectivityState()===er.ConnectivityState.READY&&e.push({endpointName:n,picker:i.child.getPicker(),weight:this.getWeight(i)});mD("Created picker with weights: "+e.map(n=>n.endpointName+":"+n.weight).join(","));let r;this.latestConfig.getEnableOobLoadReport()?r=null:r=(n,i)=>{let o=this.children.get(i);o&&this.updateWeight(o,n)},this.updateState(er.ConnectivityState.READY,new gD(e,r),null)}else if(this.countChildrenWithState(er.ConnectivityState.CONNECTING)>0)this.updateState(er.ConnectivityState.CONNECTING,new cf.QueuePicker(this),null);else if(this.countChildrenWithState(er.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new cf.UnavailablePicker({details:e}),e)}else this.updateState(er.ConnectivityState.IDLE,new cf.QueuePicker(this),null);for(let{child:e}of this.children.values())e.getConnectivityState()===er.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){mD(er.ConnectivityState[this.currentState]+" -> "+er.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}updateAddressList(e,r,n,i){var o,s;if(!(r instanceof r_))return!1;if(!e.ok)return this.children.size===0&&this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new cf.UnavailablePicker(e.error),e.error.details),!0;if(e.value.length===0){let l=`No addresses resolved. Resolution note: ${i}`;return this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new cf.UnavailablePicker({details:l}),l),!1}mD("Connect to endpoint list "+e.value.map(lJ.endpointToString));let a=new Date,c=new Set;this.updatesPaused=!0,this.latestConfig=r;for(let l of e.value){let u=(0,lJ.endpointToString)(l);c.add(u);let d=this.children.get(u);d||(d={child:new wPe.LeafLoadBalancer(l,(0,dJ.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(f,p,h)=>{this.currentState===er.ConnectivityState.READY&&f!==er.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),f===er.ConnectivityState.READY&&(d.nonEmptySince=null),h&&(this.lastError=h),this.calculateAndUpdateState()},createSubchannel:(f,p)=>{let h=this.channelControlHelper.createSubchannel(f,p);return d?.oobMetricsListener?new fJ.OrcaOobMetricsSubchannelWrapper(h,d.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):h}}),n,i),lastUpdated:a,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(u,d)),r.getEnableOobLoadReport()?d.oobMetricsListener=f=>{this.updateWeight(d,f)}:d.oobMetricsListener=null}for(let[l,u]of this.children)c.has(l)?u.child.startConnecting():(u.child.destroy(),this.children.delete(l));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=(s=(o=setInterval(()=>{this.currentState===er.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)===null||s===void 0?void 0:s.call(o),!0}exitIdle(){}resetBackoff(){}destroy(){for(let e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return yD}};function MPe(){(0,dJ.registerLoadBalancerType)(yD,_D,r_)}});var i_=T(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.experimental=me.ServerMetricRecorder=me.ServerInterceptingCall=me.ResponderBuilder=me.ServerListenerBuilder=me.addAdminServicesToServer=me.getChannelzHandlers=me.getChannelzServiceDefinition=me.InterceptorConfigurationError=me.InterceptingCall=me.RequesterBuilder=me.ListenerBuilder=me.StatusBuilder=me.getClientChannel=me.ServerCredentials=me.Server=me.setLogVerbosity=me.setLogger=me.load=me.loadObject=me.CallCredentials=me.ChannelCredentials=me.waitForClientReady=me.closeClient=me.Channel=me.makeGenericClientConstructor=me.makeClientConstructor=me.loadPackageDefinition=me.Client=me.compressionAlgorithms=me.propagate=me.connectivityState=me.status=me.logVerbosity=me.Metadata=me.credentials=void 0;var iA=cT();Object.defineProperty(me,"CallCredentials",{enumerable:!0,get:function(){return iA.CallCredentials}});var DPe=sN();Object.defineProperty(me,"Channel",{enumerable:!0,get:function(){return DPe.ChannelImplementation}});var LPe=bk();Object.defineProperty(me,"compressionAlgorithms",{enumerable:!0,get:function(){return LPe.CompressionAlgorithms}});var $Pe=Mr();Object.defineProperty(me,"connectivityState",{enumerable:!0,get:function(){return $Pe.ConnectivityState}});var oA=xd();Object.defineProperty(me,"ChannelCredentials",{enumerable:!0,get:function(){return oA.ChannelCredentials}});var hJ=oN();Object.defineProperty(me,"Client",{enumerable:!0,get:function(){return hJ.Client}});var SD=Ge();Object.defineProperty(me,"logVerbosity",{enumerable:!0,get:function(){return SD.LogVerbosity}});Object.defineProperty(me,"status",{enumerable:!0,get:function(){return SD.Status}});Object.defineProperty(me,"propagate",{enumerable:!0,get:function(){return SD.Propagate}});var mJ=lt(),ED=IT();Object.defineProperty(me,"loadPackageDefinition",{enumerable:!0,get:function(){return ED.loadPackageDefinition}});Object.defineProperty(me,"makeClientConstructor",{enumerable:!0,get:function(){return ED.makeClientConstructor}});Object.defineProperty(me,"makeGenericClientConstructor",{enumerable:!0,get:function(){return ED.makeClientConstructor}});var UPe=Kt();Object.defineProperty(me,"Metadata",{enumerable:!0,get:function(){return UPe.Metadata}});var FPe=D9();Object.defineProperty(me,"Server",{enumerable:!0,get:function(){return FPe.Server}});var BPe=$b();Object.defineProperty(me,"ServerCredentials",{enumerable:!0,get:function(){return BPe.ServerCredentials}});var jPe=L9();Object.defineProperty(me,"StatusBuilder",{enumerable:!0,get:function(){return jPe.StatusBuilder}});me.credentials={combineChannelCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),combineCallCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),createInsecure:oA.ChannelCredentials.createInsecure,createSsl:oA.ChannelCredentials.createSsl,createFromSecureContext:oA.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:iA.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:iA.CallCredentials.createFromGoogleCredential,createEmpty:iA.CallCredentials.createEmpty};var zPe=t=>t.close();me.closeClient=zPe;var GPe=(t,e,r)=>t.waitForReady(e,r);me.waitForClientReady=GPe;var qPe=(t,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};me.loadObject=qPe;var VPe=(t,e,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};me.load=VPe;var HPe=t=>{mJ.setLogger(t)};me.setLogger=HPe;var WPe=t=>{mJ.setLoggerVerbosity(t)};me.setLogVerbosity=WPe;var YPe=t=>hJ.Client.prototype.getChannel.call(t);me.getClientChannel=YPe;var sA=rN();Object.defineProperty(me,"ListenerBuilder",{enumerable:!0,get:function(){return sA.ListenerBuilder}});Object.defineProperty(me,"RequesterBuilder",{enumerable:!0,get:function(){return sA.RequesterBuilder}});Object.defineProperty(me,"InterceptingCall",{enumerable:!0,get:function(){return sA.InterceptingCall}});Object.defineProperty(me,"InterceptorConfigurationError",{enumerable:!0,get:function(){return sA.InterceptorConfigurationError}});var gJ=va();Object.defineProperty(me,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return gJ.getChannelzServiceDefinition}});Object.defineProperty(me,"getChannelzHandlers",{enumerable:!0,get:function(){return gJ.getChannelzHandlers}});var KPe=bT();Object.defineProperty(me,"addAdminServicesToServer",{enumerable:!0,get:function(){return KPe.addAdminServicesToServer}});var vD=FM();Object.defineProperty(me,"ServerListenerBuilder",{enumerable:!0,get:function(){return vD.ServerListenerBuilder}});Object.defineProperty(me,"ResponderBuilder",{enumerable:!0,get:function(){return vD.ResponderBuilder}});Object.defineProperty(me,"ServerInterceptingCall",{enumerable:!0,get:function(){return vD.ServerInterceptingCall}});var ZPe=Fb();Object.defineProperty(me,"ServerMetricRecorder",{enumerable:!0,get:function(){return ZPe.ServerMetricRecorder}});var JPe=JM();me.experimental=JPe;var XPe=zk(),QPe=Y9(),e0e=eJ(),t0e=Zg(),r0e=iJ(),n0e=aJ(),i0e=pJ(),o0e=va();XPe.setup(),QPe.setup(),e0e.setup(),t0e.setup(),r0e.setup(),n0e.setup(),i0e.setup(),o0e.setup()});var _J=T(aA=>{"use strict";Object.defineProperty(aA,"__esModule",{value:!0});aA.createServiceClientConstructor=void 0;var s0e=i_();function a0e(t,e){let r={export:{path:t,requestStream:!1,responseStream:!1,requestSerialize:n=>n,requestDeserialize:n=>n,responseSerialize:n=>n,responseDeserialize:n=>n}};return s0e.makeGenericClientConstructor(r,e)}aA.createServiceClientConstructor=a0e});var o_=T(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.createOtlpGrpcExporterTransport=Kn.GrpcExporterTransport=Kn.createEmptyMetadata=Kn.createSslCredentials=Kn.createInsecureCredentials=void 0;var c0e=uK(),yJ=`OTel-OTLP-Exporter-JavaScript/${c0e.VERSION}`;function l0e(t){return t?`${t} ${yJ}`:yJ}var u0e=0,d0e=2;function f0e(t){return t==="gzip"?d0e:u0e}function p0e(){let{credentials:t}=i_();return t.createInsecure()}Kn.createInsecureCredentials=p0e;function h0e(t,e,r){let{credentials:n}=i_();return n.createSsl(t,e,r)}Kn.createSslCredentials=h0e;function m0e(){let{Metadata:t}=i_();return new t}Kn.createEmptyMetadata=m0e;var cA=class{_client;_metadata;_parameters;constructor(e){this._parameters=e}shutdown(){this._client?.close()}send(e,r){let n=Buffer.from(e);if(this._client==null){let{createServiceClientConstructor:i}=_J();try{this._metadata=this._parameters.metadata()}catch(s){return Promise.resolve({status:"failure",error:s})}let o=i(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new o(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":f0e(this._parameters.compression),"grpc.primary_user_agent":l0e(this._parameters.userAgent)})}catch(s){return Promise.resolve({status:"failure",error:s})}}return new Promise(i=>{let o=Date.now()+r;if(this._metadata==null)return i({error:new Error("metadata was null"),status:"failure"});this._client.export(n,this._metadata,{deadline:o},(s,a)=>{i(s?{status:"failure",error:s}:{data:a,status:"success"})})})}};Kn.GrpcExporterTransport=cA;function g0e(t){return new cA(t)}Kn.createOtlpGrpcExporterTransport=g0e});var bJ=T(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.getOtlpGrpcDefaultConfiguration=Ca.mergeOtlpGrpcConfigurationWithDefaults=Ca.validateAndNormalizeUrl=void 0;var vJ=(tT(),Pr(eT)),s_=o_(),_0e=Q("url"),SJ=(ve(),Pr(ra));function TJ(t){t=t.trim(),t.match(/^([\w]{1,8}):\/\//)||(t=`https://${t}`);let r=new _0e.URL(t);return r.protocol==="unix:"?t:(r.pathname&&r.pathname!=="/"&&SJ.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored."),r.protocol!==""&&!r.protocol?.match(/^(http)s?:$/)&&SJ.diag.warn("URL protocol should be http(s)://. Using http://."),r.host)}Ca.validateAndNormalizeUrl=TJ;function EJ(t,e){for(let[r,n]of Object.entries(e.getMap()))t.get(r).length<1&&t.set(r,n)}function y0e(t,e,r){let n=t.url??e.url??r.url;return{...(0,vJ.mergeOtlpSharedConfigurationWithDefaults)(t,e,r),metadata:()=>{let i=r.metadata();return EJ(i,t.metadata?.().clone()??(0,s_.createEmptyMetadata)()),EJ(i,e.metadata?.()??(0,s_.createEmptyMetadata)()),i},url:TJ(n),credentials:t.credentials??e.credentials?.(n)??r.credentials(n),userAgent:t.userAgent}}Ca.mergeOtlpGrpcConfigurationWithDefaults=y0e;function S0e(){return{...(0,vJ.getSharedConfigurationDefaults)(),metadata:()=>(0,s_.createEmptyMetadata)(),url:"http://localhost:4317",credentials:t=>t.startsWith("http://")?()=>(0,s_.createInsecureCredentials)():()=>(0,s_.createSslCredentials)()}}Ca.getOtlpGrpcDefaultConfiguration=S0e});function AJ(t){let e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):te.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}var wJ=w(()=>{"use strict";ve()});function E0e(t,e,r){return async()=>{let n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,AJ(await t())),Object.assign(i,n)}}function v0e(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function xJ(t,e,r){return{...Cv(t,e,r),headers:E0e(t.headers,e.headers,r.headers),url:v0e(t.url)??e.url??r.url}}function RJ(t,e){return{...Pv(),headers:async()=>t,url:"http://localhost:4318/"+e}}var IJ=w(()=>{"use strict";Qm();wJ()});function Pl(t){return async e=>{let r=e==="http:",n=r?import("http"):import("https"),{Agent:i}=await n;if(r){let{ca:o,cert:s,key:a,...c}=t;return new i(c)}return new i(t)}}function CJ(t,e,r){return{...xJ(t,e,r),agentFactory:t.agentFactory??e.agentFactory??r.agentFactory,userAgent:t.userAgent}}function PJ(t,e){return{...RJ(t,e),agentFactory:Pl({keepAlive:!0})}}var lA=w(()=>{"use strict";IJ()});function TD(t){return t===429||t===502||t===503||t===504}function bD(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let r=new Date(t).getTime()-Date.now();return r>=0?r:0}var OJ=w(()=>{"use strict"});var NJ,kJ=w(()=>{"use strict";NJ="0.218.0"});import*as LJ from"zlib";import{Readable as T0e}from"stream";function $J(t,e,r,n,i,o,s,a){return new Promise(c=>{let l=new URL(e);i?r["User-Agent"]=`${i} ${MJ}`:r["User-Agent"]=MJ;let d=t(l,{method:"POST",headers:r,agent:o},f=>{let p=[],h=0;f.on("data",m=>{if(h+=m.length,h>DJ){let S=new Error(`OTLP export response body exceeded size limit of ${DJ} bytes`);c({status:"failure",error:S}),f.destroy();return}p.push(m)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(p)});else if(f.statusCode&&TD(f.statusCode))c({status:"retryable",retryInMillis:bD(f.headers["retry-after"])});else{let m=new Wo(f.statusMessage,f.statusCode,Buffer.concat(p).toString());c({status:"failure",error:m})}}),f.on("error",m=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&TD(f.statusCode)?c({status:"retryable",error:m,retryInMillis:bD(f.headers["retry-after"])}):c({status:"failure",error:m})})});d.setTimeout(a,()=>{d.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),d.on("error",f=>{w0e(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),b0e(d,n,s,f=>{c({status:"failure",error:f})})})}function b0e(t,e,r,n){let i=A0e(r);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(LJ.createGzip()).on("error",n)),i.pipe(t).on("error",n)}function A0e(t){let e=new T0e;return e.push(t),e.push(null),e}function w0e(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var MJ,DJ,UJ=w(()=>{"use strict";OJ();Rv();kJ();MJ=`OTel-OTLP-Exporter-JavaScript/${NJ}`,DJ=4*1024*1024});async function x0e(t){let e=t==="http:"?import("http"):import("https"),{request:r}=await e;return r}function FJ(t){return new AD(t)}var AD,BJ=w(()=>{"use strict";UJ();AD=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,r){let{agent:n,request:i}=await this._loadUtils(),o=await this._parameters.headers();return $J(i,this._parameters.url,o,this._parameters.compression,this._parameters.userAgent,n,e,r)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let r=new URL(this._parameters.url).protocol,[n,i]=await Promise.all([this._parameters.agentFactory(r),x0e(r)]);e=this._utils={agent:n,request:i}}return e}}});function P0e(){return Math.random()*(2*jJ)-jJ}function zJ(t){return new xD(t.transport)}var wD,R0e,I0e,C0e,jJ,xD,GJ=w(()=>{"use strict";ve();wD=5,R0e=1e3,I0e=5e3,C0e=1.5,jJ=.2;xD=class{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,r).then(i,o)},n)})}async send(e,r){let n=wD,i=R0e,o=Date.now()+r,s=await this._transport.send(e,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(i*(1+P0e()),I0e),0);i=i*C0e;let c=s.retryInMillis??a,l=o-Date.now();if(c>l)return te.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),s;te.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(e,l,c)}return s.status==="success"?te.verbose(`Export succeeded after ${wD-n} retry attempts.`):s.status==="retryable"?te.info(`Export failed after maximum retry attempts (${wD}).`):te.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}});function qJ(t,e){return Qv({transport:zJ({transport:FJ(t)}),serializer:e,promiseHandler:Nv(t)},{timeout:t.timeoutMillis})}var VJ=w(()=>{"use strict";mO();BJ();Z0();GJ()});function HJ(t){let e=yd(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;te.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function O0e(t){let e=HJ(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),r=HJ("OTEL_EXPORTER_OTLP_TIMEOUT");return e??r}function WJ(t){let e=Zr(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;te.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function N0e(t){let e=WJ(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),r=WJ("OTEL_EXPORTER_OTLP_COMPRESSION");return e??r}function uA(t){return{timeoutMillis:O0e(t),compression:N0e(t)}}var RD=w(()=>{"use strict";vd();ve()});import*as YJ from"fs";import*as KJ from"path";function k0e(t){let e=Zr(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),r=Zr("OTEL_EXPORTER_OTLP_HEADERS"),n=nl(e),i=nl(r);if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return Object.assign({},nl(r),nl(e))}function M0e(t){try{return new URL(t).toString()}catch{te.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function D0e(t,e){try{new URL(t)}catch{te.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{te.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function L0e(t){let e=Zr("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return D0e(e,t)}function $0e(t){let e=Zr(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return M0e(e)}function ID(t,e,r){let n=Zr(t),i=Zr(e),o=n??i;if(o!=null)try{return YJ.readFileSync(KJ.resolve(process.cwd(),o))}catch{te.warn(r);return}else return}function U0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function F0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function B0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function ZJ(t,e){return{...uA(t),url:$0e(t)??L0e(e),headers:Iv(k0e(t)),agentFactory:Pl({keepAlive:!0,ca:B0e(t),cert:U0e(t),key:F0e(t)})}}var JJ=w(()=>{"use strict";vd();ve();RD();Qm();lA()});function XJ(t){return typeof t.headers=="function"?t.headers:Iv(t.headers)}var QJ=w(()=>{"use strict";Qm()});function j0e(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return Pl(e)}function eX(t,e,r,n){return t.metadata&&te.warn("Metadata cannot be set when using http"),CJ({url:t.url,headers:XJ(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:j0e(t),userAgent:t.userAgent},ZJ(e,r),PJ(n,r))}var tX=w(()=>{"use strict";ve();lA();CD();JJ();QJ()});var rX={};ar(rX,{convertLegacyHttpOptions:()=>eX,createOtlpHttpExportDelegate:()=>qJ,getSharedConfigurationFromEnvironment:()=>uA,httpAgentFactoryFromOptions:()=>Pl});var CD=w(()=>{"use strict";lA();VJ();RD();tX()});var aX=T(dA=>{"use strict";Object.defineProperty(dA,"__esModule",{value:!0});dA.getOtlpGrpcConfigurationFromEnv=void 0;var nX=(vd(),Pr(oK)),a_=o_(),z0e=(CD(),Pr(rX)),G0e=Q("fs"),q0e=Q("path"),oX=(ve(),Pr(ra));function PD(t,e){if(t!=null&&t!=="")return t;if(e!=null&&e!=="")return e}function V0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_HEADERS`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),n=(0,nX.parseKeyPairsIntoRecord)(e),i=(0,nX.parseKeyPairsIntoRecord)(r);if(Object.keys(n).length===0&&Object.keys(i).length===0)return;let o=Object.assign({},i,n),s=(0,a_.createEmptyMetadata)();for(let[a,c]of Object.entries(o))s.set(a,c);return s}function H0e(t){let e=V0e(t);if(e!=null)return()=>e}function W0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return PD(e,r)}function Y0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_INSECURE`]?.toLowerCase().trim(),r=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return PD(e,r)==="true"}function OD(t,e,r){let n=process.env[t]?.trim(),i=process.env[e]?.trim(),o=PD(n,i);if(o!=null)try{return G0e.readFileSync(q0e.resolve(process.cwd(),o))}catch{oX.diag.warn(r);return}else return}function K0e(t){return OD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function Z0e(t){return OD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function iX(t){return OD(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function sX(t){let e=Z0e(t),r=K0e(t),n=iX(t),i=e!=null&&r!=null;return n!=null&&!i?(oX.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,a_.createSslCredentials)(iX(t))):(0,a_.createSslCredentials)(n,e,r)}function J0e(t){return Y0e(t)?(0,a_.createInsecureCredentials)():sX(t)}function X0e(t){return{...(0,z0e.getSharedConfigurationFromEnvironment)(t),metadata:H0e(t),url:W0e(t),credentials:e=>e.startsWith("http://")?()=>(0,a_.createInsecureCredentials)():e.startsWith("https://")?()=>sX(t):()=>J0e(t)}}dA.getOtlpGrpcConfigurationFromEnv=X0e});var lX=T(fA=>{"use strict";Object.defineProperty(fA,"__esModule",{value:!0});fA.convertLegacyOtlpGrpcOptions=void 0;var cX=bJ(),Q0e=o_(),eOe=aX();function tOe(t,e){let r=t.credentials;return(0,cX.mergeOtlpGrpcConfigurationWithDefaults)({url:t.url,metadata:()=>t.metadata??(0,Q0e.createEmptyMetadata)(),compression:t.compression,timeoutMillis:t.timeoutMillis,concurrencyLimit:t.concurrencyLimit,credentials:r!=null?()=>r:void 0,userAgent:t.userAgent},(0,eOe.getOtlpGrpcConfigurationFromEnv)(e),(0,cX.getOtlpGrpcDefaultConfiguration)())}fA.convertLegacyOtlpGrpcOptions=tOe});var uX=T(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.createOtlpGrpcExportDelegate=void 0;var rOe=(tT(),Pr(eT)),nOe=o_();function iOe(t,e,r,n){return(0,rOe.createOtlpNetworkExportDelegate)(t,e,(0,nOe.createOtlpGrpcExporterTransport)({address:t.url,compression:t.compression,credentials:t.credentials,metadata:t.metadata,userAgent:t.userAgent,grpcName:r,grpcPath:n}))}pA.createOtlpGrpcExportDelegate=iOe});var dX=T(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.createOtlpGrpcExportDelegate=lf.convertLegacyOtlpGrpcOptions=void 0;var oOe=lX();Object.defineProperty(lf,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return oOe.convertLegacyOtlpGrpcOptions}});var sOe=uX();Object.defineProperty(lf,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return sOe.createOtlpGrpcExportDelegate}})});function cs(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var ND=w(()=>{"use strict"});var aOe,c_,Pa,hA=w(()=>{"use strict";ve();ND();aOe="ProtobufWriter: estimated size was too small, growing buffer.",c_=1,Pa=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let r=this.pos+e;if(r<=this._buffer.length)return;te.debug(aOe);let n=this._buffer.length*2;for(;n<r;)n*=2;let i=new Uint8Array(n);i.set(this._buffer),this._buffer=i,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(c_),this.pos+=c_,e}finishLengthDelimited(e,r){let n=r>>>0,i=cs(n);if(i>c_){let s=i-c_;this._ensureCapacity(s),this._buffer.copyWithin(e+i,e+c_,this.pos),this.pos+=s}let o=e;n<128?this._buffer[o]=n:n<16384?(this._buffer[o++]=n&127|128,this._buffer[o]=n>>>7):n<2097152?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o]=n>>>14):n<268435456?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o]=n>>>21):(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o++]=n>>>21&127|128,this._buffer[o]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}this.writeFixed64(r,n)}writeVarint(e){if(this._ensureCapacity(cs(e)),e>=0&&e<=4294967295){let r=e>>>0;for(;r>127;)this._buffer[this.pos++]=r&127|128,r>>>=7;this._buffer[this.pos++]=r}else{let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}for(;n>0||r>127;)this._buffer[this.pos++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=r&127}}writeFixed32(e){this._ensureCapacity(4);let r=e>>>0;this._buffer[this.pos++]=r&255,this._buffer[this.pos++]=r>>>8&255,this._buffer[this.pos++]=r>>>16&255,this._buffer[this.pos++]=r>>>24&255}writeFixed64(e,r){this._ensureCapacity(8);let n=e>>>0,i=r>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=i&255,this._buffer[this.pos++]=i>>>8&255,this._buffer[this.pos++]=i>>>16&255,this._buffer[this.pos++]=i>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let r=!0,n=e.length;for(let i=0;i<n;i++)if(e.charCodeAt(i)>127){r=!1;break}if(r){this.writeVarint(n),this._ensureCapacity(n);for(let i=0;i<n;i++)this._buffer[this.pos++]=e.charCodeAt(i)}else{let i=this._textEncoder.encode(e);this.writeBytes(i)}}}});function fX(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function ls(t){let e=new Uint8Array(t.length/2),r=0;for(let n=0;n<t.length;n+=2){let i=fX(t.charCodeAt(n)),o=fX(t.charCodeAt(n+1));e[r++]=i<<4|o}return e}var kD=w(()=>{"use strict"});var l_,pX=w(()=>{"use strict";(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(l_||(l_={}))});var u_,hX,MD=w(()=>{"use strict";u_=class{emit(e){}enabled(){return!1}},hX=new u_});function mX(t,e,r){return n=>n===t?e:r}var d_,uf,DD,gX=w(()=>{"use strict";d_=Symbol.for("io.opentelemetry.js.api.logs"),uf=globalThis;DD=1});var LD,mA,$D=w(()=>{"use strict";MD();LD=class{getLogger(e,r,n){return new u_}},mA=new LD});var gA,_X=w(()=>{"use strict";MD();gA=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):hX}}});var f_,yX=w(()=>{"use strict";$D();_X();f_=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new gA(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:mA}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}});var _A,SX=w(()=>{"use strict";gX();$D();yX();_A=class t{constructor(){this._proxyLoggerProvider=new f_}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return uf[d_]?this.getLoggerProvider():(uf[d_]=mX(DD,e,mA),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=uf[d_])===null||e===void 0?void 0:e.call(uf,DD))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete uf[d_],this._proxyLoggerProvider=new f_}}});var Vut,EX=w(()=>{"use strict";pX();SX();Vut=_A.getInstance()});function tn(t,e){let r=e[0],n=e[1],i=1e9,o=r&65535,s=r/65536>>>0,a=o*i,c=s*i,l=a>>>0,u=Math.floor(a/4294967296),d=(c&65535)*65536>>>0,f=c/65536>>>0,p=l+d+n,h=p>>>0,m=Math.floor(p/4294967296),S=u+f+m>>>0;t.writeFixed64(h,S)}function wi(t,e,r){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=e[n];t.writeTag(r,2);let o=t.startLengthDelimited(),s=t.pos;cOe(t,n,i),t.finishLengthDelimited(o,t.pos-s)}}function cOe(t,e,r){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),i=t.pos;p_(t,r),t.finishLengthDelimited(n,t.pos-i)}function p_(t,e){let r=typeof e;if(r==="string")t.writeTag(1,2),t.writeString(e);else if(r==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(r==="number"){let n=e;Number.isInteger(n)&&n>=lOe&&n<uOe?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),i=t.pos;for(let o of e){t.writeTag(1,2);let s=t.startLengthDelimited(),a=t.pos;p_(t,o),t.finishLengthDelimited(s,t.pos-a)}t.finishLengthDelimited(n,t.pos-i)}else if(r==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),i=t.pos,o=e;for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;let a=o[s];t.writeTag(1,2);let c=t.startLengthDelimited(),l=t.pos;t.writeTag(1,2),t.writeString(s),t.writeTag(2,2);let u=t.startLengthDelimited(),d=t.pos;p_(t,a),t.finishLengthDelimited(u,t.pos-d),t.finishLengthDelimited(c,t.pos-l)}t.finishLengthDelimited(n,t.pos-i)}}function df(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),t.finishLengthDelimited(n,t.pos-i)}function ff(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;e.attributes&&wi(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-i)}var lOe,uOe,yA=w(()=>{"use strict";lOe=-(2**63),uOe=2**63});function dOe(t){let e=t.length,r=0;for(let n=0;n<e;n++){let i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4)}return r}var Oa,SA=w(()=>{"use strict";ND();Oa=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,r){this.pos+=cs(r)}writeVarint(e){this.pos+=cs(e)}writeSint32(e){this.pos+=cs((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,r){this.pos+=8}writeBytes(e){this.pos+=cs(e.length),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this.pos+=8}writeString(e){let r=dOe(e);this.pos+=cs(r),this.pos+=r}}});function fOe(t,e){let r=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),tn(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==l_.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let i=t.startLengthDelimited(),o=t.pos;p_(t,e.body),t.finishLengthDelimited(i,t.pos-o)}e.attributes&&wi(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(ls(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(ls(e.spanContext.spanId))),t.writeTag(11,1),tn(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(r,t.pos-n)}function pOe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;df(t,e,1);for(let o of r)t.writeTag(2,2),fOe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function vX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;ff(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;pOe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function hOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function TX(t){let e=hOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),vX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),vX(n,i,o);return n.finish()}var bX=w(()=>{"use strict";hA();kD();EX();yA();SA()});var xi,EA=w(()=>{"use strict";xi=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,r=0,n=!1;for(;this.pos<this._buf.length;){let i=this._buf[this.pos++];if(e+=(i&127)*Math.pow(2,r),r+=7,(i&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let r=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,r}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 3:for(;!this.isAtEnd();){let{wireType:r}=this.readTag();if(r===4)break;this.skip(r)}break;case 4:break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function mOe(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedLogRecords=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function AX(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=mOe(e.readBytes()):e.skip(i)}return r}var wX=w(()=>{"use strict";EA()});var UD,xX=w(()=>{"use strict";bX();wX();UD={serializeRequest:t=>TX(t),deserializeResponse:t=>AX(t)}});var RX=w(()=>{"use strict";xX()});var us,IX=w(()=>{"use strict";(function(t){t[t.DELTA=0]="DELTA",t[t.CUMULATIVE=1]="CUMULATIVE"})(us||(us={}))});var FD,vn,CX=w(()=>{"use strict";(function(t){t.COUNTER="COUNTER",t.GAUGE="GAUGE",t.HISTOGRAM="HISTOGRAM",t.UP_DOWN_COUNTER="UP_DOWN_COUNTER",t.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",t.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",t.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(FD||(FD={}));(function(t){t[t.HISTOGRAM=0]="HISTOGRAM",t[t.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",t[t.GAUGE=2]="GAUGE",t[t.SUM=3]="SUM"})(vn||(vn={}))});var BD=w(()=>{"use strict";IX();CX()});function NX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;t.writeTag(2,1),tn(t,e.startTime),t.writeTag(3,1),tn(t,e.endTime),r===jo.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&wi(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-i)}function gOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;if(t.writeTag(2,1),tn(t,e.startTime),t.writeTag(3,1),tn(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.buckets.counts.length>0){t.writeTag(6,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.counts)t.writeFixed64(a>>>0,a/4294967296>>>0);t.finishLengthDelimited(o,t.pos-s)}if(i.buckets.boundaries.length>0){t.writeTag(7,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.boundaries)t.writeDouble(a);t.finishLengthDelimited(o,t.pos-s)}e.attributes&&wi(t,e.attributes,9),i.min!==void 0&&(t.writeTag(11,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(12,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function PX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),r.length>0){t.writeTag(2,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of r)t.writeVarint(a);t.finishLengthDelimited(o,t.pos-s)}t.finishLengthDelimited(n,t.pos-i)}function _Oe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;e.attributes&&wi(t,e.attributes,1),t.writeTag(2,1),tn(t,e.startTime),t.writeTag(3,1),tn(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.scale!==0&&(t.writeTag(6,0),t.writeSint32(i.scale)),t.writeTag(7,1),t.writeFixed64(i.zeroCount>>>0,i.zeroCount/4294967296>>>0),t.writeTag(8,2),PX(t,i.positive.offset,i.positive.bucketCounts),t.writeTag(9,2),PX(t,i.negative.offset,i.negative.bucketCounts),i.min!==void 0&&(t.writeTag(12,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(13,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function yOe(t,e){let r=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case vn.GAUGE:t.writeTag(5,2),SOe(t,e);break;case vn.SUM:t.writeTag(7,2),EOe(t,e);break;case vn.HISTOGRAM:t.writeTag(9,2),vOe(t,e);break;case vn.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),TOe(t,e);break;default:{let i=e}}t.finishLengthDelimited(r,t.pos-n)}function SOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let i of e.dataPoints)t.writeTag(1,2),NX(t,i,e.descriptor.valueType);t.finishLengthDelimited(r,t.pos-n)}function EOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),NX(t,o,e.descriptor.valueType);let i=jD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(r,t.pos-n)}function vOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),gOe(t,o);let i=jD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function TOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),_Oe(t,o);let i=jD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function bOe(t,e){let r=t.startLengthDelimited(),n=t.pos;df(t,e.scope,1);for(let i of e.metrics)t.writeTag(2,2),yOe(t,i);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function OX(t,e){let r=t.startLengthDelimited(),n=t.pos;ff(t,e.resource,1);for(let i of e.scopeMetrics)t.writeTag(2,2),bOe(t,i);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function jD(t){switch(t){case us.DELTA:return 1;case us.CUMULATIVE:return 2;default:return 0}}function kX(t){let e=new Oa;e.writeTag(1,2),OX(e,t);let r=new Pa(e.pos);return r.writeTag(1,2),OX(r,t),r.finish()}var MX=w(()=>{"use strict";ve();BD();yA();SA();hA()});function AOe(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedDataPoints=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function DX(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=AOe(e.readBytes()):e.skip(i)}return r}var LX=w(()=>{"use strict";EA()});var zD,$X=w(()=>{"use strict";MX();LX();zD={serializeRequest:t=>kX(t),deserializeResponse:t=>DX(t)}});var UX=w(()=>{"use strict";$X()});function BX(t,e){let r=t&255|wOe;return e&&(r|=xOe),r}function ROe(t,e){let r=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(r,t.pos-n)}function IOe(t,e){let r=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),tn(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&wi(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(r,t.pos-n)}function COe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.context;t.writeTag(1,2),t.writeBytes(ls(i.traceId)),t.writeTag(2,2),t.writeBytes(ls(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.attributes&&wi(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let s=BX(i.traceFlags,i.isRemote);s&&(t.writeTag(6,5),t.writeFixed32(s)),t.finishLengthDelimited(r,t.pos-n)}function POe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.spanContext();t.writeTag(1,2),t.writeBytes(ls(i.traceId)),t.writeTag(2,2),t.writeBytes(ls(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(ls(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let s=e.kind==null?0:e.kind+1;s!==0&&(t.writeTag(6,0),t.writeVarint(s)),t.writeTag(7,1),tn(t,e.startTime),t.writeTag(8,1),tn(t,e.endTime),e.attributes&&wi(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),IOe(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),COe(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),ROe(t,e.status);let a=BX(i.traceFlags,e.parentSpanContext?.isRemote);a&&(t.writeTag(16,5),t.writeFixed32(a)),t.finishLengthDelimited(r,t.pos-n)}function OOe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;df(t,e,1);for(let o of r)t.writeTag(2,2),POe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function FX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;ff(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;OOe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function NOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function jX(t){let e=NOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),FX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),FX(n,i,o);return n.finish()}var wOe,xOe,zX=w(()=>{"use strict";hA();kD();yA();SA();wOe=256,xOe=512});function kOe(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedSpans=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function GX(t){let e=new xi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=kOe(e.readBytes()):e.skip(i)}return r}var qX=w(()=>{"use strict";EA()});var GD,VX=w(()=>{"use strict";zX();qX();GD={serializeRequest:t=>jX(t),deserializeResponse:t=>GX(t)}});var HX=w(()=>{"use strict";VX()});function pf(t,e){let r={attributes:ds(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function hf(t){return{name:t.name,version:t.version}}function ds(t,e){return Object.keys(t).map(r=>qD(r,t[r],e))}function qD(t,e,r){return{key:t,value:h_(e,r)}}function h_(t,e){let r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=h_(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){let n=Object.keys(t),i=new Array(n.length);for(let o=0;o<n.length;o++)i[o]={key:n[o],value:h_(t[n[o]],e)};return{kvlistValue:{values:i}}}return{}}var vA=w(()=>{"use strict"});function WX(t,e){return{resourceLogs:DOe(t,e)}}function MOe(t){let e=new Map;for(let r of t){let{resource:n,instrumentationScope:{name:i,version:o="",schemaUrl:s=""}}=r,a=e.get(n);a||(a=new Map,e.set(n,a));let c=`${i}@${o}:${s}`,l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return e}function DOe(t,e){let r=MOe(t);return Array.from(r,([n,i])=>{let o=pf(n,e);return{resource:o,scopeLogs:Array.from(i,([,s])=>({scope:hf(s[0].instrumentationScope),logRecords:s.map(a=>LOe(a,e)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:o.schemaUrl}})}function LOe(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:h_(t.body,e),eventName:t.eventName,attributes:$Oe(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}function $Oe(t,e){return Object.keys(t).map(r=>qD(r,t[r],e))}var YX=w(()=>{"use strict";vA()});function UOe(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function FOe(t){return UOe(t).toString()}function KX(t){return t}var BOe,mf,TA=w(()=>{"use strict";vd();BOe=typeof BigInt<"u"?FOe:qv;mf={encodeHrTime:BOe,encodeSpanContext:KX,encodeOptionalSpanContext:KX,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}}});var VD,ZX=w(()=>{"use strict";YX();TA();ve();VD={serializeRequest:t=>{let e=WX(t,mf);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return te.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}});var JX=w(()=>{"use strict";ZX()});var m_,XX=w(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(m_||(m_={}))});function jOe(t,e){let r=pf(t.resource,e);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:zOe(t.scopeMetrics,e)}}function zOe(t,e){return Array.from(t.map(r=>({scope:hf(r.scope),metrics:r.metrics.map(n=>GOe(n,e)),schemaUrl:r.scope.schemaUrl})))}function GOe(t,e){let r={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=WOe(t.aggregationTemporality);switch(t.dataPointType){case vn.SUM:r.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:QX(t,e)};break;case vn.GAUGE:r.gauge={dataPoints:QX(t,e)};break;case vn.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:VOe(t,e)};break;case vn.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:HOe(t,e)};break}return r}function qOe(t,e,r){let n={attributes:ds(t.attributes,r),startTimeUnixNano:r.encodeHrTime(t.startTime),timeUnixNano:r.encodeHrTime(t.endTime)};switch(e){case jo.INT:n.asInt=t.value;break;case jo.DOUBLE:n.asDouble=t.value;break}return n}function QX(t,e){return t.dataPoints.map(r=>qOe(r,t.descriptor.valueType,e))}function VOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ds(r.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function HOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ds(r.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function WOe(t){switch(t){case us.DELTA:return m_.AGGREGATION_TEMPORALITY_DELTA;case us.CUMULATIVE:return m_.AGGREGATION_TEMPORALITY_CUMULATIVE}}function eQ(t,e){return{resourceMetrics:t.map(r=>jOe(r,e))}}var tQ=w(()=>{"use strict";ve();BD();XX();vA()});var HD,rQ=w(()=>{"use strict";tQ();TA();ve();HD={serializeRequest:t=>{let e=eQ([t],mf);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return te.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}}});var nQ=w(()=>{"use strict";rQ()});function iQ(t,e){let r=t&255|YOe;return e&&(r|=KOe),r}function ZOe(t,e){let r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:ds(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>XOe(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(o=>JOe(o,e)),droppedLinksCount:t.droppedLinksCount,flags:iQ(r.traceFlags,t.parentSpanContext?.isRemote)}}function JOe(t,e){return{attributes:t.attributes?ds(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:iQ(t.context.traceFlags,t.context.isRemote)}}function XOe(t,e){return{attributes:t.attributes?ds(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function oQ(t,e){return{resourceSpans:eNe(t,e)}}function QOe(t){let e=new Map;for(let r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));let i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return e}function eNe(t,e){let r=QOe(t),n=[],i=r.entries(),o=i.next();for(;!o.done;){let[s,a]=o.value,c=[],l=a.values(),u=l.next();for(;!u.done;){let p=u.value;if(p.length>0){let h=p.map(m=>ZOe(m,e));c.push({scope:hf(p[0].instrumentationScope),spans:h,schemaUrl:p[0].instrumentationScope.schemaUrl})}u=l.next()}let d=pf(s,e),f={resource:d,scopeSpans:c,schemaUrl:d.schemaUrl};n.push(f),o=i.next()}return n}var YOe,KOe,sQ=w(()=>{"use strict";vA();YOe=256,KOe=512});var WD,aQ=w(()=>{"use strict";sQ();TA();ve();WD={serializeRequest:t=>{let e=oQ(t,mf);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return te.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}});var cQ=w(()=>{"use strict";aQ()});var lQ={};ar(lQ,{JsonLogsSerializer:()=>VD,JsonMetricsSerializer:()=>HD,JsonTraceSerializer:()=>WD,ProtobufLogsSerializer:()=>UD,ProtobufMetricsSerializer:()=>zD,ProtobufTraceSerializer:()=>GD});var uQ=w(()=>{"use strict";RX();UX();HX();JX();nQ();cQ()});var fQ=T(bA=>{"use strict";Object.defineProperty(bA,"__esModule",{value:!0});bA.OTLPTraceExporter=void 0;var dQ=dX(),tNe=(uQ(),Pr(lQ)),rNe=(tT(),Pr(eT)),YD=class extends rNe.OTLPExporterBase{constructor(e={}){super((0,dQ.createOtlpGrpcExportDelegate)((0,dQ.convertLegacyOtlpGrpcOptions)(e,"TRACES"),tNe.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};bA.OTLPTraceExporter=YD});var pQ=T(AA=>{"use strict";Object.defineProperty(AA,"__esModule",{value:!0});AA.OTLPTraceExporter=void 0;var nNe=fQ();Object.defineProperty(AA,"OTLPTraceExporter",{enumerable:!0,get:function(){return nNe.OTLPTraceExporter}})});var N7=T((gmt,O7)=>{"use strict";O7.exports=P7;P7.sync=fMe;var I7=Q("fs");function dMe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function C7(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:dMe(e,r)}function P7(t,e,r){I7.stat(t,function(n,i){r(n,n?!1:C7(i,t,e))})}function fMe(t,e){return C7(I7.statSync(t),t,e)}});var $7=T((_mt,L7)=>{"use strict";L7.exports=M7;M7.sync=pMe;var k7=Q("fs");function M7(t,e,r){k7.stat(t,function(n,i){r(n,n?!1:D7(i,e))})}function pMe(t,e){return D7(k7.statSync(t),e)}function D7(t,e){return t.isFile()&&hMe(t,e)}function hMe(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var F7=T((Smt,U7)=>{"use strict";var ymt=Q("fs"),ZA;process.platform==="win32"||global.TESTING_WINDOWS?ZA=N7():ZA=$7();U7.exports=SL;SL.sync=mMe;function SL(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){SL(t,e||{},function(o,s){o?i(o):n(s)})})}ZA(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function mMe(t,e){try{return ZA.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var H7=T((Emt,V7)=>{"use strict";var Ef=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",B7=Q("path"),gMe=Ef?";":":",j7=F7(),z7=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),G7=(t,e)=>{let r=e.colon||gMe,n=t.match(/\//)||Ef&&t.match(/\\/)?[""]:[...Ef?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ef?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ef?i.split(r):[""];return Ef&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},q7=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=G7(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(z7(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,h=B7.join(p,t),m=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;u(c(m,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let h=i[d];j7(l+h,{pathExt:o},(m,S)=>{if(!m&&S)if(e.all)s.push(l+h);else return f(l+h);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},_Me=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=G7(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=B7.join(c,t),u=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let f=u+n[d];try{if(j7.sync(f,{pathExt:i}))if(e.all)o.push(f);else return f}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw z7(t)};V7.exports=q7;q7.sync=_Me});var Y7=T((vmt,EL)=>{"use strict";var W7=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};EL.exports=W7;EL.exports.default=W7});var X7=T((Tmt,J7)=>{"use strict";var K7=Q("path"),yMe=H7(),SMe=Y7();function Z7(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=yMe.sync(t.command,{path:r[SMe({env:r})],pathExt:e?K7.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=K7.resolve(i?t.options.cwd:"",s)),s}function EMe(t){return Z7(t)||Z7(t,!0)}J7.exports=EMe});var Q7=T((bmt,TL)=>{"use strict";var vL=/([()\][%!^"`<>&|;, *?])/g;function vMe(t){return t=t.replace(vL,"^$1"),t}function TMe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vL,"^$1"),e&&(t=t.replace(vL,"^$1")),t}TL.exports.command=vMe;TL.exports.argument=TMe});var tee=T((Amt,eee)=>{"use strict";eee.exports=/^#!(.*)/});var nee=T((wmt,ree)=>{"use strict";var bMe=tee();ree.exports=(t="")=>{let e=t.match(bMe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var oee=T((xmt,iee)=>{"use strict";var bL=Q("fs"),AMe=nee();function wMe(t){let r=Buffer.alloc(150),n;try{n=bL.openSync(t,"r"),bL.readSync(n,r,0,150,0),bL.closeSync(n)}catch{}return AMe(r.toString())}iee.exports=wMe});var lee=T((Rmt,cee)=>{"use strict";var xMe=Q("path"),see=X7(),aee=Q7(),RMe=oee(),IMe=process.platform==="win32",CMe=/\.(?:com|exe)$/i,PMe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function OMe(t){t.file=see(t);let e=t.file&&RMe(t.file);return e?(t.args.unshift(t.file),t.command=e,see(t)):t.file}function NMe(t){if(!IMe)return t;let e=OMe(t),r=!CMe.test(e);if(t.options.forceShell||r){let n=PMe.test(e);t.command=xMe.normalize(t.command),t.command=aee.command(t.command),t.args=t.args.map(o=>aee.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function kMe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:NMe(n)}cee.exports=kMe});var fee=T((Imt,dee)=>{"use strict";var AL=process.platform==="win32";function wL(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function MMe(t,e){if(!AL)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=uee(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function uee(t,e){return AL&&t===1&&!e.file?wL(e.original,"spawn"):null}function DMe(t,e){return AL&&t===1&&!e.file?wL(e.original,"spawnSync"):null}dee.exports={hookChildProcess:MMe,verifyENOENT:uee,verifyENOENTSync:DMe,notFoundError:wL}});var mee=T((Cmt,vf)=>{"use strict";var pee=Q("child_process"),xL=lee(),RL=fee();function hee(t,e,r){let n=xL(t,e,r),i=pee.spawn(n.command,n.args,n.options);return RL.hookChildProcess(i,n),i}function LMe(t,e,r){let n=xL(t,e,r),i=pee.spawnSync(n.command,n.args,n.options);return i.error=i.error||RL.verifyENOENTSync(i.status,n),i}vf.exports=hee;vf.exports.spawn=hee;vf.exports.sync=LMe;vf.exports._parse=xL;vf.exports._enoent=RL});var Yue=T((V2t,Wue)=>{"use strict";var Oc=Q("constants"),xVe=process.cwd,tC=null,RVe=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return tC||(tC=xVe.call(process)),tC};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Hz=process.chdir,process.chdir=function(t){tC=null,Hz.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Hz));var Hz;Wue.exports=IVe;function IVe(t){Oc.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(u,d,f){f&&process.nextTick(f)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(u,d,f,p){p&&process.nextTick(p)},t.lchownSync=function(){}),RVe==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(u){function d(f,p,h){var m=Date.now(),S=0;u(f,p,function E(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(p,function(A,y){A&&A.code==="ENOENT"?u(f,p,E):h(b)})},S),S<100&&(S+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(u){function d(f,p,h,m,S,E){var b;if(E&&typeof E=="function"){var A=0;b=function(y,x,C){if(y&&y.code==="EAGAIN"&&A<10)return A++,u.call(t,f,p,h,m,S,b);E.apply(this,arguments)}}return u.call(t,f,p,h,m,S,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(u){return function(d,f,p,h,m){for(var S=0;;)try{return u.call(t,d,f,p,h,m)}catch(E){if(E.code==="EAGAIN"&&S<10){S++;continue}throw E}}})(t.readSync);function e(u){u.lchmod=function(d,f,p){u.open(d,Oc.O_WRONLY|Oc.O_SYMLINK,f,function(h,m){if(h){p&&p(h);return}u.fchmod(m,f,function(S){u.close(m,function(E){p&&p(S||E)})})})},u.lchmodSync=function(d,f){var p=u.openSync(d,Oc.O_WRONLY|Oc.O_SYMLINK,f),h=!0,m;try{m=u.fchmodSync(p,f),h=!1}finally{if(h)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function r(u){Oc.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(d,f,p,h){u.open(d,Oc.O_SYMLINK,function(m,S){if(m){h&&h(m);return}u.futimes(S,f,p,function(E){u.close(S,function(b){h&&h(E||b)})})})},u.lutimesSync=function(d,f,p){var h=u.openSync(d,Oc.O_SYMLINK),m,S=!0;try{m=u.futimesSync(h,f,p),S=!1}finally{if(S)try{u.closeSync(h)}catch{}else u.closeSync(h)}return m}):u.futimes&&(u.lutimes=function(d,f,p,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function n(u){return u&&function(d,f,p){return u.call(t,d,f,function(h){l(h)&&(h=null),p&&p.apply(this,arguments)})}}function i(u){return u&&function(d,f){try{return u.call(t,d,f)}catch(p){if(!l(p))throw p}}}function o(u){return u&&function(d,f,p,h){return u.call(t,d,f,p,function(m){l(m)&&(m=null),h&&h.apply(this,arguments)})}}function s(u){return u&&function(d,f,p){try{return u.call(t,d,f,p)}catch(h){if(!l(h))throw h}}}function a(u){return u&&function(d,f,p){typeof f=="function"&&(p=f,f=null);function h(m,S){S&&(S.uid<0&&(S.uid+=4294967296),S.gid<0&&(S.gid+=4294967296)),p&&p.apply(this,arguments)}return f?u.call(t,d,f,h):u.call(t,d,h)}}function c(u){return u&&function(d,f){var p=f?u.call(t,d,f):u.call(t,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function l(u){if(!u||u.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var Jue=T((H2t,Zue)=>{"use strict";var Kue=Q("stream").Stream;Zue.exports=CVe;function CVe(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Kue.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(u,d){if(u){o.emit("error",u),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Kue.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Que=T((W2t,Xue)=>{"use strict";Xue.exports=OVe;var PVe=Object.getPrototypeOf||function(t){return t.__proto__};function OVe(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:PVe(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var nde=T((Y2t,Kz)=>{"use strict";var vt=Q("fs"),NVe=Yue(),kVe=Jue(),MVe=Que(),rC=Q("util"),yr,iC;typeof Symbol=="function"&&typeof Symbol.for=="function"?(yr=Symbol.for("graceful-fs.queue"),iC=Symbol.for("graceful-fs.previous")):(yr="___graceful-fs.queue",iC="___graceful-fs.previous");function DVe(){}function rde(t,e){Object.defineProperty(t,yr,{get:function(){return e}})}var Lu=DVe;rC.debuglog?Lu=rC.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Lu=function(){var t=rC.format.apply(rC,arguments);t="GFS4: "+t.split(/\n/).join(`
24
- GFS4: `),console.error(t)});vt[yr]||(ede=global[yr]||[],rde(vt,ede),vt.close=(function(t){function e(r,n){return t.call(vt,r,function(i){i||tde(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,iC,{value:t}),e})(vt.close),vt.closeSync=(function(t){function e(r){t.apply(vt,arguments),tde()}return Object.defineProperty(e,iC,{value:t}),e})(vt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Lu(vt[yr]),Q("assert").equal(vt[yr].length,0)}));var ede;global[yr]||rde(global,vt[yr]);Kz.exports=Wz(MVe(vt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!vt.__patched&&(Kz.exports=Wz(vt),vt.__patched=!0);function Wz(t){NVe(t),t.gracefulify=Wz,t.createReadStream=x,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(R,$,_){return typeof $=="function"&&(_=$,$=null),ee(R,$,_);function ee(k,g,v,I){return e(k,g,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Gh([ee,[k,g,v],J,I||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,G){return n(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,G||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,G){return o(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,G||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(R,$,_,ee){return typeof _=="function"&&(ee=_,_=0),k(R,$,_,ee);function k(g,v,I,J,G){return a(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,G||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(R,$,_){typeof $=="function"&&(_=$,$=null);var ee=u.test(process.version)?function(v,I,J,G){return l(v,k(v,I,J,G))}:function(v,I,J,G){return l(v,I,k(v,I,J,G))};return ee(R,$,_);function k(g,v,I,J){return function(G,le){G&&(G.code==="EMFILE"||G.code==="ENFILE")?Gh([ee,[g,v,I],G,J||Date.now(),Date.now()]):(le&&le.sort&&le.sort(),typeof I=="function"&&I.call(this,G,le))}}}if(process.version.substr(0,4)==="v0.8"){var f=kVe(t);E=f.ReadStream,A=f.WriteStream}var p=t.ReadStream;p&&(E.prototype=Object.create(p.prototype),E.prototype.open=b);var h=t.WriteStream;h&&(A.prototype=Object.create(h.prototype),A.prototype.open=y),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(R){E=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return A},set:function(R){A=R},enumerable:!0,configurable:!0});var m=E;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(R){m=R},enumerable:!0,configurable:!0});var S=A;Object.defineProperty(t,"FileWriteStream",{get:function(){return S},set:function(R){S=R},enumerable:!0,configurable:!0});function E(R,$){return this instanceof E?(p.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function b(){var R=this;N(R.path,R.flags,R.mode,function($,_){$?(R.autoClose&&R.destroy(),R.emit("error",$)):(R.fd=_,R.emit("open",_),R.read())})}function A(R,$){return this instanceof A?(h.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function y(){var R=this;N(R.path,R.flags,R.mode,function($,_){$?(R.destroy(),R.emit("error",$)):(R.fd=_,R.emit("open",_))})}function x(R,$){return new t.ReadStream(R,$)}function C(R,$){return new t.WriteStream(R,$)}var O=t.open;t.open=N;function N(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,G){return O(g,v,I,function(le,Oe){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,G||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}return t}function Gh(t){Lu("ENQUEUE",t[0].name,t[1]),vt[yr].push(t),Yz()}var nC;function tde(){for(var t=Date.now(),e=0;e<vt[yr].length;++e)vt[yr][e].length>2&&(vt[yr][e][3]=t,vt[yr][e][4]=t);Yz()}function Yz(){if(clearTimeout(nC),nC=void 0,vt[yr].length!==0){var t=vt[yr].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Lu("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Lu("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-i,1),l=Math.min(c*1.2,100);a>=l?(Lu("RETRY",e.name,r),e.apply(null,r.concat([i]))):vt[yr].push(t)}nC===void 0&&(nC=setTimeout(Yz,0))}}});var _de=T(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.splitWhen=qh.flatten=void 0;function tHe(t){return t.reduce((e,r)=>[].concat(e,r),[])}qh.flatten=tHe;function rHe(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}qh.splitWhen=rHe});var yde=T(sC=>{"use strict";Object.defineProperty(sC,"__esModule",{value:!0});sC.isEnoentCodeError=void 0;function nHe(t){return t.code==="ENOENT"}sC.isEnoentCodeError=nHe});var Sde=T(aC=>{"use strict";Object.defineProperty(aC,"__esModule",{value:!0});aC.createDirentFromStats=void 0;var iG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function iHe(t,e){return new iG(t,e)}aC.createDirentFromStats=iHe});var bde=T($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.convertPosixPathToPattern=$t.convertWindowsPathToPattern=$t.convertPathToPattern=$t.escapePosixPath=$t.escapeWindowsPath=$t.escape=$t.removeLeadingDotSegment=$t.makeAbsolute=$t.unixify=void 0;var oHe=Q("os"),sHe=Q("path"),Ede=oHe.platform()==="win32",aHe=2,cHe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,lHe=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,uHe=/^\\\\([.?])/,dHe=/\\(?![!()+@[\]{}])/g;function fHe(t){return t.replace(/\\/g,"/")}$t.unixify=fHe;function pHe(t,e){return sHe.resolve(t,e)}$t.makeAbsolute=pHe;function hHe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(aHe)}return t}$t.removeLeadingDotSegment=hHe;$t.escape=Ede?oG:sG;function oG(t){return t.replace(lHe,"\\$2")}$t.escapeWindowsPath=oG;function sG(t){return t.replace(cHe,"\\$2")}$t.escapePosixPath=sG;$t.convertPathToPattern=Ede?vde:Tde;function vde(t){return oG(t).replace(uHe,"//$1").replace(dHe,"/")}$t.convertWindowsPathToPattern=vde;function Tde(t){return sG(t)}$t.convertPosixPathToPattern=Tde});var wde=T((vzt,Ade)=>{"use strict";Ade.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Ide=T((Tzt,Rde)=>{"use strict";var mHe=wde(),xde={"{":"}","(":")","[":"]"},gHe=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=xde[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},_He=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=xde[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Rde.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(mHe(e))return!0;var n=gHe;return r&&r.strict===!1&&(n=_He),n(e)}});var Pde=T((bzt,Cde)=>{"use strict";var yHe=Ide(),SHe=Q("path").posix.dirname,EHe=Q("os").platform()==="win32",aG="/",vHe=/\\/g,THe=/[\{\[].*[\}\]]$/,bHe=/(^|[^\\])([\{\[]|\([^\)]+$)/,AHe=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Cde.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&EHe&&e.indexOf(aG)<0&&(e=e.replace(vHe,aG)),THe.test(e)&&(e+=aG),e+="a";do e=SHe(e);while(yHe(e)||bHe.test(e));return e.replace(AHe,"$1")}});var cC=T(ii=>{"use strict";ii.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ii.find=(t,e)=>t.nodes.find(r=>r.type===e);ii.exceedsLimit=(t,e,r=1,n)=>n===!1||!ii.isInteger(t)||!ii.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ii.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ii.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ii.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ii.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ii.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ii.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var lC=T((wzt,Nde)=>{"use strict";var Ode=cC();Nde.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&Ode.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&Ode.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var Mde=T((xzt,kde)=>{"use strict";kde.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Gde=T((Rzt,zde)=>{"use strict";var Dde=Mde(),Uu=(t,e,r)=>{if(Dde(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Dde(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+o+s+a;if(Uu.cache.hasOwnProperty(c))return Uu.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=jde(t)||jde(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=Lde(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=Lde(l,u,f,n)),f.negatives=h,f.positives=p,f.result=wHe(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),Uu.cache[c]=f,f.result};function wHe(t,e,r){let n=cG(t,e,"-",!1,r)||[],i=cG(e,t,"",!1,r)||[],o=cG(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function xHe(t,e){let r=1,n=1,i=Ude(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Ude(t,r);for(i=Fde(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Fde(e+1,n)-1;return o=[...o],o.sort(CHe),o}function RHe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=IHe(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?o+=c:c!=="0"||l!=="9"?o+=PHe(c,l,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Lde(t,e,r,n){let i=xHe(t,e),o=[],s=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=RHe(String(s),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Bde(a.count),s=l+1;continue}r.isPadded&&(d=OHe(l,r,n)),u.string=d+u.pattern+Bde(u.count),o.push(u),s=l+1,a=u}return o}function cG(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!$de(e,"string",a)&&o.push(r+a),n&&$de(e,"string",a)&&o.push(r+a)}return o}function IHe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function CHe(t,e){return t>e?1:e>t?-1:0}function $de(t,e,r){return t.some(n=>n[e]===r)}function Ude(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Fde(t,e){return t-t%Math.pow(10,e)}function Bde(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function PHe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function jde(t){return/^-?(0+)\d/.test(t)}function OHe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}Uu.cache={};Uu.clearCache=()=>Uu.cache={};zde.exports=Uu});var dG=T((Izt,Zde)=>{"use strict";var NHe=Q("util"),Vde=Gde(),qde=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),kHe=t=>e=>t===!0?Number(e):String(e),lG=t=>typeof t=="number"||typeof t=="string"&&t!=="",NS=t=>Number.isInteger(+t),uG=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},MHe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,DHe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},dC=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},LHe=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>dC(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>dC(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Hde=(t,e,r,n)=>{if(r)return Vde(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Wde=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Vde(t,e,r)},Yde=(...t)=>new RangeError("Invalid range arguments: "+NHe.inspect(...t)),Kde=(t,e,r)=>{if(r.strictRanges===!0)throw Yde([t,e]);return[]},$He=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},UHe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Yde([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=uG(a)||uG(c)||uG(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&MHe(t,e,n)===!1,p=n.transform||kHe(f);if(n.toRegex&&r===1)return Hde(dC(t,d),dC(e,d),!0,n);let h={negatives:[],positives:[]},m=b=>h[b<0?"negatives":"positives"].push(Math.abs(b)),S=[],E=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?m(i):S.push(DHe(p(i,E),d,f)),i=s?i-r:i+r,E++;return n.toRegex===!0?r>1?LHe(h,n,d):Wde(S,null,{wrap:!1,...n}):S},FHe=(t,e,r=1,n={})=>{if(!NS(t)&&t.length>1||!NS(e)&&e.length>1)return Kde(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,c=Math.min(o,s),l=Math.max(o,s);if(n.toRegex&&r===1)return Hde(c,l,!1,n);let u=[],d=0;for(;a?o>=s:o<=s;)u.push(i(o,d)),o=a?o-r:o+r,d++;return n.toRegex===!0?Wde(u,null,{wrap:!1,options:n}):u},uC=(t,e,r,n={})=>{if(e==null&&lG(t))return[t];if(!lG(t)||!lG(e))return Kde(t,e,n);if(typeof r=="function")return uC(t,e,1,{transform:r});if(qde(r))return uC(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,NS(r)?NS(t)&&NS(e)?UHe(t,e,r,i):FHe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!qde(r)?$He(r,i):uC(t,e,1,r)};Zde.exports=uC});var Qde=T((Czt,Xde)=>{"use strict";var BHe=dG(),Jde=cC(),jHe=(t,e={})=>{let r=(n,i={})=>{let o=Jde.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Jde.reduce(n.nodes),d=BHe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};Xde.exports=jHe});var rfe=T((Pzt,tfe)=>{"use strict";var zHe=dG(),efe=lC(),Vh=cC(),Fu=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Vh.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(Fu(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?Fu(i,o,r):i+o);return Vh.flatten(n)},GHe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(Fu(a.pop(),efe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Fu(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=Vh.reduce(i.nodes);if(Vh.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=zHe(...d,e);f.length===0&&(f=efe(i,e)),a.push(Fu(a.pop(),f)),i.nodes=[];return}let c=Vh.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(Fu(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(Fu(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return Vh.flatten(n(t))};tfe.exports=GHe});var ife=T((Ozt,nfe)=>{"use strict";nfe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
25
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var lfe=T((Nzt,cfe)=>{"use strict";var qHe=lC(),{MAX_LENGTH:ofe,CHAR_BACKSLASH:fG,CHAR_BACKTICK:VHe,CHAR_COMMA:HHe,CHAR_DOT:WHe,CHAR_LEFT_PARENTHESES:YHe,CHAR_RIGHT_PARENTHESES:KHe,CHAR_LEFT_CURLY_BRACE:ZHe,CHAR_RIGHT_CURLY_BRACE:JHe,CHAR_LEFT_SQUARE_BRACKET:sfe,CHAR_RIGHT_SQUARE_BRACKET:afe,CHAR_DOUBLE_QUOTE:XHe,CHAR_SINGLE_QUOTE:QHe,CHAR_NO_BREAK_SPACE:e6e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:t6e}=ife(),r6e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(ofe,r.maxLength):ofe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(s=o[o.length-1],f=p(),!(f===t6e||f===e6e)){if(f===fG){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===afe){h({type:"text",value:"\\"+f});continue}if(f===sfe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===sfe){c++;continue}if(m===fG){f+=p();continue}if(m===afe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===YHe){s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:f});continue}if(f===KHe){if(s.type!=="paren"){h({type:"text",value:f});continue}s=o.pop(),h({type:"text",value:f}),s=o[o.length-1];continue}if(f===XHe||f===QHe||f===VHe){let m=f,S;for(e.keepQuotes!==!0&&(f="");u<l&&(S=p());){if(S===fG){f+=S+p();continue}if(S===m){e.keepQuotes===!0&&(f+=S);break}f+=S}h({type:"text",value:f});continue}if(f===ZHe){d++;let S={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};s=h(S),o.push(s),h({type:"open",value:f});continue}if(f===JHe){if(s.type!=="brace"){h({type:"text",value:f});continue}let m="close";s=o.pop(),s.close=!0,h({type:m,value:f}),d--,s=o[o.length-1];continue}if(f===HHe&&d>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:qHe(s)}]}h({type:"comma",value:f}),s.commas++;continue}if(f===WHe&&d>0&&s.commas===0){let m=s.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(s.range=[],a.value+=f,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let S=m[m.length-1];S.value+=a.value+f,a=S,s.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let m=o[o.length-1],S=m.nodes.indexOf(s);m.nodes.splice(S,1,...s.nodes)}while(o.length>0);return h({type:"eos"}),i};cfe.exports=r6e});var ffe=T((kzt,dfe)=>{"use strict";var ufe=lC(),n6e=Qde(),i6e=rfe(),o6e=lfe(),Nn=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Nn.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Nn.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Nn.parse=(t,e={})=>o6e(t,e);Nn.stringify=(t,e={})=>ufe(typeof t=="string"?Nn.parse(t,e):t,e);Nn.compile=(t,e={})=>(typeof t=="string"&&(t=Nn.parse(t,e)),n6e(t,e));Nn.expand=(t,e={})=>{typeof t=="string"&&(t=Nn.parse(t,e));let r=i6e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Nn.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Nn.compile(t,e):Nn.expand(t,e);dfe.exports=Nn});var kS=T((Mzt,_fe)=>{"use strict";var s6e=Q("path"),Lo="\\\\/",pfe=`[^${Lo}]`,a6e=0,Ks="\\.",c6e="\\+",l6e="\\?",fC="\\/",u6e="(?=.)",hfe="[^/]",pG=`(?:${fC}|$)`,mfe=`(?:^|${fC})`,hG=`${Ks}{1,2}${pG}`,d6e=`(?!${Ks})`,f6e=`(?!${mfe}${hG})`,p6e=`(?!${Ks}{0,1}${pG})`,h6e=`(?!${hG})`,m6e=`[^.${fC}]`,g6e=`${hfe}*?`,gfe={DOT_LITERAL:Ks,PLUS_LITERAL:c6e,QMARK_LITERAL:l6e,SLASH_LITERAL:fC,ONE_CHAR:u6e,QMARK:hfe,END_ANCHOR:pG,DOTS_SLASH:hG,NO_DOT:d6e,NO_DOTS:f6e,NO_DOT_SLASH:p6e,NO_DOTS_SLASH:h6e,QMARK_NO_DOT:m6e,STAR:g6e,START_ANCHOR:mfe},_6e={...gfe,SLASH_LITERAL:`[${Lo}]`,QMARK:pfe,STAR:`${pfe}*?`,DOTS_SLASH:`${Ks}{1,2}(?:[${Lo}]|$)`,NO_DOT:`(?!${Ks})`,NO_DOTS:`(?!(?:^|[${Lo}])${Ks}{1,2}(?:[${Lo}]|$))`,NO_DOT_SLASH:`(?!${Ks}{0,1}(?:[${Lo}]|$))`,NO_DOTS_SLASH:`(?!${Ks}{1,2}(?:[${Lo}]|$))`,QMARK_NO_DOT:`[^.${Lo}]`,START_ANCHOR:`(?:^|[${Lo}])`,END_ANCHOR:`(?:[${Lo}]|$)`},y6e={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_fe.exports={DEFAULT_MAX_EXTGLOB_RECURSION:a6e,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y6e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:s6e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?_6e:gfe}}});var MS=T(dn=>{"use strict";var S6e=Q("path"),E6e=process.platform==="win32",{REGEX_BACKSLASH:v6e,REGEX_REMOVE_BACKSLASH:T6e,REGEX_SPECIAL_CHARS:b6e,REGEX_SPECIAL_CHARS_GLOBAL:A6e}=kS();dn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);dn.hasRegexChars=t=>b6e.test(t);dn.isRegexChar=t=>t.length===1&&dn.hasRegexChars(t);dn.escapeRegex=t=>t.replace(A6e,"\\$1");dn.toPosixSlashes=t=>t.replace(v6e,"/");dn.removeBackslashes=t=>t.replace(T6e,e=>e==="\\"?"":e);dn.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};dn.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:E6e===!0||S6e.sep==="\\";dn.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?dn.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};dn.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};dn.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var wfe=T((Lzt,Afe)=>{"use strict";var yfe=MS(),{CHAR_ASTERISK:mG,CHAR_AT:w6e,CHAR_BACKWARD_SLASH:DS,CHAR_COMMA:x6e,CHAR_DOT:gG,CHAR_EXCLAMATION_MARK:_G,CHAR_FORWARD_SLASH:bfe,CHAR_LEFT_CURLY_BRACE:yG,CHAR_LEFT_PARENTHESES:SG,CHAR_LEFT_SQUARE_BRACKET:R6e,CHAR_PLUS:I6e,CHAR_QUESTION_MARK:Sfe,CHAR_RIGHT_CURLY_BRACE:C6e,CHAR_RIGHT_PARENTHESES:Efe,CHAR_RIGHT_SQUARE_BRACKET:P6e}=kS(),vfe=t=>t===bfe||t===DS,Tfe=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},O6e=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,S=!1,E=!1,b=!1,A=!1,y=!1,x=!1,C=0,O,N,R={value:"",depth:0,isGlob:!1},$=()=>l>=n,_=()=>c.charCodeAt(l+1),ee=()=>(O=N,c.charCodeAt(++l));for(;l<n;){N=ee();let J;if(N===DS){b=R.backslashes=!0,N=ee(),N===yG&&(E=!0);continue}if(E===!0||N===yG){for(C++;$()!==!0&&(N=ee());){if(N===DS){b=R.backslashes=!0,ee();continue}if(N===yG){C++;continue}if(E!==!0&&N===gG&&(N=ee())===gG){if(f=R.isBrace=!0,h=R.isGlob=!0,x=!0,i===!0)continue;break}if(E!==!0&&N===x6e){if(f=R.isBrace=!0,h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===C6e&&(C--,C===0)){E=!1,f=R.isBrace=!0,x=!0;break}}if(i===!0)continue;break}if(N===bfe){if(o.push(l),s.push(R),R={value:"",depth:0,isGlob:!1},x===!0)continue;if(O===gG&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(N===I6e||N===w6e||N===mG||N===Sfe||N===_G)===!0&&_()===SG){if(h=R.isGlob=!0,m=R.isExtglob=!0,x=!0,N===_G&&l===u&&(y=!0),i===!0){for(;$()!==!0&&(N=ee());){if(N===DS){b=R.backslashes=!0,N=ee();continue}if(N===Efe){h=R.isGlob=!0,x=!0;break}}continue}break}if(N===mG){if(O===mG&&(S=R.isGlobstar=!0),h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===Sfe){if(h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===R6e){for(;$()!==!0&&(J=ee());){if(J===DS){b=R.backslashes=!0,ee();continue}if(J===P6e){p=R.isBracket=!0,h=R.isGlob=!0,x=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&N===_G&&l===u){A=R.negated=!0,u++;continue}if(r.noparen!==!0&&N===SG){if(h=R.isGlob=!0,i===!0){for(;$()!==!0&&(N=ee());){if(N===SG){b=R.backslashes=!0,N=ee();continue}if(N===Efe){x=!0;break}}continue}break}if(h===!0){if(x=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let k=c,g="",v="";u>0&&(g=c.slice(0,u),c=c.slice(u),d-=u),k&&h===!0&&d>0?(k=c.slice(0,d),v=c.slice(d)):h===!0?(k="",v=c):k=c,k&&k!==""&&k!=="/"&&k!==c&&vfe(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),r.unescape===!0&&(v&&(v=yfe.removeBackslashes(v)),k&&b===!0&&(k=yfe.removeBackslashes(k)));let I={prefix:g,input:t,start:u,base:k,glob:v,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:S,negated:A,negatedExtglob:y};if(r.tokens===!0&&(I.maxDepth=0,vfe(N)||s.push(R),I.tokens=s),r.parts===!0||r.tokens===!0){let J;for(let G=0;G<o.length;G++){let le=J?J+1:u,Oe=o[G],Ie=t.slice(le,Oe);r.tokens&&(G===0&&u!==0?(s[G].isPrefix=!0,s[G].value=g):s[G].value=Ie,Tfe(s[G]),I.maxDepth+=s[G].depth),(G!==0||Ie!=="")&&a.push(Ie),J=Oe}if(J&&J+1<t.length){let G=t.slice(J+1);a.push(G),r.tokens&&(s[s.length-1].value=G,Tfe(s[s.length-1]),I.maxDepth+=s[s.length-1].depth)}I.slashes=o,I.parts=a}return I};Afe.exports=O6e});var Pfe=T(($zt,Cfe)=>{"use strict";var LS=kS(),wr=MS(),{MAX_LENGTH:pC,POSIX_REGEX_SOURCE:N6e,REGEX_NON_SPECIAL_CHARS:k6e,REGEX_SPECIAL_CHARS_BACKREF:M6e,REPLACEMENTS:xfe}=LS,D6e=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>wr.escapeRegex(i)).join("..")}return r},Hh=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Rfe=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},L6e=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Ife=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(L6e(e))return e.replace(/\\(.)/g,"$1")},$6e=t=>{let e=t.map(Ife).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},EG=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},U6e=t=>{let e=0,r=[];for(;e<t.length;){let i=EG(t.slice(e),!1);if(!i||i.type!=="*")return;let o=Rfe(i.body).map(a=>a.trim());if(o.length!==1)return;let s=Ife(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?wr.escapeRegex(r[0]):`[${r.map(i=>wr.escapeRegex(i)).join("")}]`}*`},F6e=t=>{let e=0,r=t.trim(),n=EG(r);for(;n;)e++,r=n.body.trim(),n=EG(r);return e},B6e=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:LS.DEFAULT_MAX_EXTGLOB_RECURSION,n=Rfe(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||$6e(n)))return{risky:!0};for(let i of n){let o=U6e(i);if(o)return{risky:!0,safeOutput:o};if(F6e(i)>r)return{risky:!0}}return{risky:!1}},vG=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=xfe[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(pC,r.maxLength):pC,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wr.isWindows(e),l=LS.globChars(c),u=LS.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:S,NO_DOT_SLASH:E,NO_DOTS_SLASH:b,QMARK:A,QMARK_NO_DOT:y,STAR:x,START_ANCHOR:C}=l,O=H=>`(${a}(?:(?!${C}${H.dot?m:d}).)*?)`,N=r.dot?"":S,R=r.dot?A:y,$=r.bash===!0?O(r):x;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=wr.removePrefix(t,_),i=t.length;let ee=[],k=[],g=[],v=o,I,J=()=>_.index===i-1,G=_.peek=(H=1)=>t[_.index+H],le=_.advance=()=>t[++_.index]||"",Oe=()=>t.slice(_.index+1),Ie=(H="",oe=0)=>{_.consumed+=H,_.index+=oe},Ne=H=>{_.output+=H.output!=null?H.output:H.value,Ie(H.value)},Re=()=>{let H=1;for(;G()==="!"&&(G(2)!=="("||G(3)==="?");)le(),_.start++,H++;return H%2===0?!1:(_.negated=!0,_.start++,!0)},ke=H=>{_[H]++,g.push(H)},we=H=>{_[H]--,g.pop()},fe=H=>{if(v.type==="globstar"){let oe=_.braces>0&&(H.type==="comma"||H.type==="brace"),M=H.extglob===!0||ee.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!oe&&!M&&(_.output=_.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=$,_.output+=v.output)}if(ee.length&&H.type!=="paren"&&(ee[ee.length-1].inner+=H.value),(H.value||H.output)&&Ne(H),v&&v.type==="text"&&H.type==="text"){v.value+=H.value,v.output=(v.output||"")+H.value;return}H.prev=v,s.push(H),v=H},ye=(H,oe)=>{let M={...u[oe],conditions:1,inner:""};M.prev=v,M.parens=_.parens,M.output=_.output,M.startIndex=_.index,M.tokensIndex=s.length;let P=(r.capture?"(":"")+M.open;ke("parens"),fe({type:H,value:oe,output:_.output?"":h}),fe({type:"paren",extglob:!0,value:le(),output:P}),ee.push(M)},Be=H=>{let oe=t.slice(H.startIndex,_.index+1),M=t.slice(H.startIndex+2,_.index),P=B6e(M,r);if((H.type==="plus"||H.type==="star")&&P.risky){let V=P.safeOutput?(H.output?"":h)+(r.capture?`(${P.safeOutput})`:P.safeOutput):void 0,X=s[H.tokensIndex];X.type="text",X.value=oe,X.output=V||wr.escapeRegex(oe);for(let K=H.tokensIndex+1;K<s.length;K++)s[K].value="",s[K].output="",delete s[K].suffix;_.output=H.output+X.output,_.backtrack=!0,fe({type:"paren",extglob:!0,value:I,output:""}),we("parens");return}let D=H.close+(r.capture?")":""),B;if(H.type==="negate"){let V=$;if(H.inner&&H.inner.length>1&&H.inner.includes("/")&&(V=O(r)),(V!==$||J()||/^\)+$/.test(Oe()))&&(D=H.close=`)$))${V}`),H.inner.includes("*")&&(B=Oe())&&/^\.[^\\/.]+$/.test(B)){let X=vG(B,{...e,fastpaths:!1}).output;D=H.close=`)${X})${V})`}H.prev.type==="bos"&&(_.negatedExtglob=!0)}fe({type:"paren",extglob:!0,value:I,output:D}),we("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,oe=t.replace(M6e,(M,P,D,B,V,X)=>B==="\\"?(H=!0,M):B==="?"?P?P+B+(V?A.repeat(V.length):""):X===0?R+(V?A.repeat(V.length):""):A.repeat(D.length):B==="."?d.repeat(D.length):B==="*"?P?P+B+(V?$:""):$:P?M:`\\${M}`);return H===!0&&(r.unescape===!0?oe=oe.replace(/\\/g,""):oe=oe.replace(/\\+/g,M=>M.length%2===0?"\\\\":M?"\\":"")),oe===t&&r.contains===!0?(_.output=t,_):(_.output=wr.wrapOutput(oe,_,e),_)}for(;!J();){if(I=le(),I==="\0")continue;if(I==="\\"){let M=G();if(M==="/"&&r.bash!==!0||M==="."||M===";")continue;if(!M){I+="\\",fe({type:"text",value:I});continue}let P=/^\\+/.exec(Oe()),D=0;if(P&&P[0].length>2&&(D=P[0].length,_.index+=D,D%2!==0&&(I+="\\")),r.unescape===!0?I=le():I+=le(),_.brackets===0){fe({type:"text",value:I});continue}}if(_.brackets>0&&(I!=="]"||v.value==="["||v.value==="[^")){if(r.posix!==!1&&I===":"){let M=v.value.slice(1);if(M.includes("[")&&(v.posix=!0,M.includes(":"))){let P=v.value.lastIndexOf("["),D=v.value.slice(0,P),B=v.value.slice(P+2),V=N6e[B];if(V){v.value=D+V,_.backtrack=!0,le(),!o.output&&s.indexOf(v)===1&&(o.output=h);continue}}}(I==="["&&G()!==":"||I==="-"&&G()==="]")&&(I=`\\${I}`),I==="]"&&(v.value==="["||v.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&v.value==="["&&(I="^"),v.value+=I,Ne({value:I});continue}if(_.quotes===1&&I!=='"'){I=wr.escapeRegex(I),v.value+=I,Ne({value:I});continue}if(I==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&fe({type:"text",value:I});continue}if(I==="("){ke("parens"),fe({type:"paren",value:I});continue}if(I===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Hh("opening","("));let M=ee[ee.length-1];if(M&&_.parens===M.parens+1){Be(ee.pop());continue}fe({type:"paren",value:I,output:_.parens?")":"\\)"}),we("parens");continue}if(I==="["){if(r.nobracket===!0||!Oe().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Hh("closing","]"));I=`\\${I}`}else ke("brackets");fe({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){fe({type:"text",value:I,output:`\\${I}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Hh("opening","["));fe({type:"text",value:I,output:`\\${I}`});continue}we("brackets");let M=v.value.slice(1);if(v.posix!==!0&&M[0]==="^"&&!M.includes("/")&&(I=`/${I}`),v.value+=I,Ne({value:I}),r.literalBrackets===!1||wr.hasRegexChars(M))continue;let P=wr.escapeRegex(v.value);if(_.output=_.output.slice(0,-v.value.length),r.literalBrackets===!0){_.output+=P,v.value=P;continue}v.value=`(${a}${P}|${v.value})`,_.output+=v.value;continue}if(I==="{"&&r.nobrace!==!0){ke("braces");let M={type:"brace",value:I,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};k.push(M),fe(M);continue}if(I==="}"){let M=k[k.length-1];if(r.nobrace===!0||!M){fe({type:"text",value:I,output:I});continue}let P=")";if(M.dots===!0){let D=s.slice(),B=[];for(let V=D.length-1;V>=0&&(s.pop(),D[V].type!=="brace");V--)D[V].type!=="dots"&&B.unshift(D[V].value);P=D6e(B,r),_.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let D=_.output.slice(0,M.outputIndex),B=_.tokens.slice(M.tokensIndex);M.value=M.output="\\{",I=P="\\}",_.output=D;for(let V of B)_.output+=V.output||V.value}fe({type:"brace",value:I,output:P}),we("braces"),k.pop();continue}if(I==="|"){ee.length>0&&ee[ee.length-1].conditions++,fe({type:"text",value:I});continue}if(I===","){let M=I,P=k[k.length-1];P&&g[g.length-1]==="braces"&&(P.comma=!0,M="|"),fe({type:"comma",value:I,output:M});continue}if(I==="/"){if(v.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),v=o;continue}fe({type:"slash",value:I,output:p});continue}if(I==="."){if(_.braces>0&&v.type==="dot"){v.value==="."&&(v.output=d);let M=k[k.length-1];v.type="dots",v.output+=I,v.value+=I,M.dots=!0;continue}if(_.braces+_.parens===0&&v.type!=="bos"&&v.type!=="slash"){fe({type:"text",value:I,output:d});continue}fe({type:"dot",value:I,output:d});continue}if(I==="?"){if(!(v&&v.value==="(")&&r.noextglob!==!0&&G()==="("&&G(2)!=="?"){ye("qmark",I);continue}if(v&&v.type==="paren"){let P=G(),D=I;if(P==="<"&&!wr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(v.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(Oe()))&&(D=`\\${I}`),fe({type:"text",value:I,output:D});continue}if(r.dot!==!0&&(v.type==="slash"||v.type==="bos")){fe({type:"qmark",value:I,output:y});continue}fe({type:"qmark",value:I,output:A});continue}if(I==="!"){if(r.noextglob!==!0&&G()==="("&&(G(2)!=="?"||!/[!=<:]/.test(G(3)))){ye("negate",I);continue}if(r.nonegate!==!0&&_.index===0){Re();continue}}if(I==="+"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){ye("plus",I);continue}if(v&&v.value==="("||r.regex===!1){fe({type:"plus",value:I,output:f});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||_.parens>0){fe({type:"plus",value:I});continue}fe({type:"plus",value:f});continue}if(I==="@"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){fe({type:"at",extglob:!0,value:I,output:""});continue}fe({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let M=k6e.exec(Oe());M&&(I+=M[0],_.index+=M[0].length),fe({type:"text",value:I});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=I,v.output=$,_.backtrack=!0,_.globstar=!0,Ie(I);continue}let H=Oe();if(r.noextglob!==!0&&/^\([^?]/.test(H)){ye("star",I);continue}if(v.type==="star"){if(r.noglobstar===!0){Ie(I);continue}let M=v.prev,P=M.prev,D=M.type==="slash"||M.type==="bos",B=P&&(P.type==="star"||P.type==="globstar");if(r.bash===!0&&(!D||H[0]&&H[0]!=="/")){fe({type:"star",value:I,output:""});continue}let V=_.braces>0&&(M.type==="comma"||M.type==="brace"),X=ee.length&&(M.type==="pipe"||M.type==="paren");if(!D&&M.type!=="paren"&&!V&&!X){fe({type:"star",value:I,output:""});continue}for(;H.slice(0,3)==="/**";){let K=t[_.index+4];if(K&&K!=="/")break;H=H.slice(3),Ie("/**",3)}if(M.type==="bos"&&J()){v.type="globstar",v.value+=I,v.output=O(r),_.output=v.output,_.globstar=!0,Ie(I);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!B&&J()){_.output=_.output.slice(0,-(M.output+v.output).length),M.output=`(?:${M.output}`,v.type="globstar",v.output=O(r)+(r.strictSlashes?")":"|$)"),v.value+=I,_.globstar=!0,_.output+=M.output+v.output,Ie(I);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&H[0]==="/"){let K=H[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(M.output+v.output).length),M.output=`(?:${M.output}`,v.type="globstar",v.output=`${O(r)}${p}|${p}${K})`,v.value+=I,_.output+=M.output+v.output,_.globstar=!0,Ie(I+le()),fe({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&H[0]==="/"){v.type="globstar",v.value+=I,v.output=`(?:^|${p}|${O(r)}${p})`,_.output=v.output,_.globstar=!0,Ie(I+le()),fe({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-v.output.length),v.type="globstar",v.output=O(r),v.value+=I,_.output+=v.output,_.globstar=!0,Ie(I);continue}let oe={type:"star",value:I,output:$};if(r.bash===!0){oe.output=".*?",(v.type==="bos"||v.type==="slash")&&(oe.output=N+oe.output),fe(oe);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&r.regex===!0){oe.output=I,fe(oe);continue}(_.index===_.start||v.type==="slash"||v.type==="dot")&&(v.type==="dot"?(_.output+=E,v.output+=E):r.dot===!0?(_.output+=b,v.output+=b):(_.output+=N,v.output+=N),G()!=="*"&&(_.output+=h,v.output+=h)),fe(oe)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing","]"));_.output=wr.escapeLast(_.output,"["),we("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing",")"));_.output=wr.escapeLast(_.output,"("),we("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing","}"));_.output=wr.escapeLast(_.output,"{"),we("braces")}if(r.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket")&&fe({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let H of _.tokens)_.output+=H.output!=null?H.output:H.value,H.suffix&&(_.output+=H.suffix)}return _};vG.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(pC,r.maxLength):pC,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=xfe[t]||t;let o=wr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=LS.globChars(o),m=r.dot?d:u,S=r.dot?f:u,E=r.capture?"":"?:",b={negated:!1,prefix:""},A=r.bash===!0?".*?":p;r.capture&&(A=`(${A})`);let y=N=>N.noglobstar===!0?A:`(${E}(?:(?!${h}${N.dot?l:s}).)*?)`,x=N=>{switch(N){case"*":return`${m}${c}${A}`;case".*":return`${s}${c}${A}`;case"*.*":return`${m}${A}${s}${c}${A}`;case"*/*":return`${m}${A}${a}${c}${S}${A}`;case"**":return m+y(r);case"**/*":return`(?:${m}${y(r)}${a})?${S}${c}${A}`;case"**/*.*":return`(?:${m}${y(r)}${a})?${S}${A}${s}${c}${A}`;case"**/.*":return`(?:${m}${y(r)}${a})?${s}${c}${A}`;default:{let R=/^(.*?)\.(\w+)$/.exec(N);if(!R)return;let $=x(R[1]);return $?$+s+R[2]:void 0}}},C=wr.removePrefix(t,b),O=x(C);return O&&r.strictSlashes!==!0&&(O+=`${a}?`),O};Cfe.exports=vG});var Nfe=T((Uzt,Ofe)=>{"use strict";var j6e=Q("path"),z6e=wfe(),TG=Pfe(),bG=MS(),G6e=kS(),q6e=t=>t&&typeof t=="object"&&!Array.isArray(t),kt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>kt(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=q6e(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=bG.isWindows(e),s=n?kt.compileRe(t,e):kt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=kt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=kt.test(u,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};kt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?bG.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=kt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};kt.matchBase=(t,e,r,n=bG.isWindows(r))=>(e instanceof RegExp?e:kt.makeRe(e,r)).test(j6e.basename(t));kt.isMatch=(t,e,r)=>kt(e,r)(t);kt.parse=(t,e)=>Array.isArray(t)?t.map(r=>kt.parse(r,e)):TG(t,{...e,fastpaths:!1});kt.scan=(t,e)=>z6e(t,e);kt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=kt.toRegex(a,e);return n===!0&&(c.state=t),c};kt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=TG.fastpaths(t,e)),i.output||(i=TG(t,e)),kt.compileRe(i,e,r,n)};kt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};kt.constants=G6e;Ofe.exports=kt});var Mfe=T((Fzt,kfe)=>{"use strict";kfe.exports=Nfe()});var wG=T((Bzt,Ffe)=>{"use strict";var Lfe=Q("util"),$fe=ffe(),$o=Mfe(),AG=MS(),Dfe=t=>t===""||t==="./",Ufe=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},mt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=u=>{o.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=$o(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&s++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(s===e.length?[...o]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};mt.match=mt;mt.matcher=(t,e)=>$o(t,e);mt.isMatch=(t,e,r)=>$o(e,r)(t);mt.any=mt.isMatch;mt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(mt(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};mt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>mt.contains(t,n,r));if(typeof e=="string"){if(Dfe(t)||Dfe(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return mt.isMatch(t,e,{...r,contains:!0})};mt.matchKeys=(t,e,r)=>{if(!AG.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=mt(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};mt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(n.some(s=>o(s)))return!0}return!1};mt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};mt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);return[].concat(e).every(n=>$o(n,r)(t))};mt.capture=(t,e,r)=>{let n=AG.isWindows(r),o=$o.makeRe(String(t),{...r,capture:!0}).exec(n?AG.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};mt.makeRe=(...t)=>$o.makeRe(...t);mt.scan=(...t)=>$o.scan(...t);mt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of $fe(String(n),e))r.push($o.parse(i,e));return r};mt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!Ufe(t)?[t]:$fe(t,e)};mt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return mt.braces(t,{...e,expand:!0})};mt.hasBraces=Ufe;Ffe.exports=mt});var Kfe=T(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.isAbsolute=Ce.partitionAbsoluteAndRelative=Ce.removeDuplicateSlashes=Ce.matchAny=Ce.convertPatternsToRe=Ce.makeRe=Ce.getPatternParts=Ce.expandBraceExpansion=Ce.expandPatternsWithBraceExpansion=Ce.isAffectDepthOfReadingPattern=Ce.endsWithSlashGlobStar=Ce.hasGlobStar=Ce.getBaseDirectory=Ce.isPatternRelatedToParentDirectory=Ce.getPatternsOutsideCurrentDirectory=Ce.getPatternsInsideCurrentDirectory=Ce.getPositivePatterns=Ce.getNegativePatterns=Ce.isPositivePattern=Ce.isNegativePattern=Ce.convertToNegativePattern=Ce.convertToPositivePattern=Ce.isDynamicPattern=Ce.isStaticPattern=void 0;var Bfe=Q("path"),V6e=Pde(),xG=wG(),jfe="**",H6e="\\",W6e=/[*?]|^!/,Y6e=/\[[^[]*]/,K6e=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Z6e=/[!*+?@]\([^(]*\)/,J6e=/,|\.\./,X6e=/(?!^)\/{2,}/g;function zfe(t,e={}){return!Gfe(t,e)}Ce.isStaticPattern=zfe;function Gfe(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(H6e)||W6e.test(t)||Y6e.test(t)||K6e.test(t)||e.extglob!==!1&&Z6e.test(t)||e.braceExpansion!==!1&&Q6e(t))}Ce.isDynamicPattern=Gfe;function Q6e(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return J6e.test(n)}function eWe(t){return hC(t)?t.slice(1):t}Ce.convertToPositivePattern=eWe;function tWe(t){return"!"+t}Ce.convertToNegativePattern=tWe;function hC(t){return t.startsWith("!")&&t[1]!=="("}Ce.isNegativePattern=hC;function qfe(t){return!hC(t)}Ce.isPositivePattern=qfe;function rWe(t){return t.filter(hC)}Ce.getNegativePatterns=rWe;function nWe(t){return t.filter(qfe)}Ce.getPositivePatterns=nWe;function iWe(t){return t.filter(e=>!RG(e))}Ce.getPatternsInsideCurrentDirectory=iWe;function oWe(t){return t.filter(RG)}Ce.getPatternsOutsideCurrentDirectory=oWe;function RG(t){return t.startsWith("..")||t.startsWith("./..")}Ce.isPatternRelatedToParentDirectory=RG;function sWe(t){return V6e(t,{flipBackslashes:!1})}Ce.getBaseDirectory=sWe;function aWe(t){return t.includes(jfe)}Ce.hasGlobStar=aWe;function Vfe(t){return t.endsWith("/"+jfe)}Ce.endsWithSlashGlobStar=Vfe;function cWe(t){let e=Bfe.basename(t);return Vfe(t)||zfe(e)}Ce.isAffectDepthOfReadingPattern=cWe;function lWe(t){return t.reduce((e,r)=>e.concat(Hfe(r)),[])}Ce.expandPatternsWithBraceExpansion=lWe;function Hfe(t){let e=xG.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}Ce.expandBraceExpansion=Hfe;function uWe(t,e){let{parts:r}=xG.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Ce.getPatternParts=uWe;function Wfe(t,e){return xG.makeRe(t,e)}Ce.makeRe=Wfe;function dWe(t,e){return t.map(r=>Wfe(r,e))}Ce.convertPatternsToRe=dWe;function fWe(t,e){return e.some(r=>r.test(t))}Ce.matchAny=fWe;function pWe(t){return t.replace(X6e,"/")}Ce.removeDuplicateSlashes=pWe;function hWe(t){let e=[],r=[];for(let n of t)Yfe(n)?e.push(n):r.push(n);return[e,r]}Ce.partitionAbsoluteAndRelative=hWe;function Yfe(t){return Bfe.isAbsolute(t)}Ce.isAbsolute=Yfe});var Qfe=T((zzt,Xfe)=>{"use strict";var mWe=Q("stream"),Zfe=mWe.PassThrough,gWe=Array.prototype.slice;Xfe.exports=_We;function _We(){let t=[],e=gWe.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,o=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=Zfe(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(Jfe(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),o&&h.removeListener("error",S),f()}function S(E){s.emit("error",E)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),o&&h.on("error",S),h.pipe(s,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,s.emit("queueDrain"),i&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),s}function Jfe(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Jfe(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Zfe(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var tpe=T(mC=>{"use strict";Object.defineProperty(mC,"__esModule",{value:!0});mC.merge=void 0;var yWe=Qfe();function SWe(t){let e=yWe(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>epe(t)),e.once("end",()=>epe(t)),e}mC.merge=SWe;function epe(t){t.forEach(e=>e.emit("close"))}});var rpe=T(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.isEmpty=Wh.isString=void 0;function EWe(t){return typeof t=="string"}Wh.isString=EWe;function vWe(t){return t===""}Wh.isEmpty=vWe});var Zs=T(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.string=xr.stream=xr.pattern=xr.path=xr.fs=xr.errno=xr.array=void 0;var TWe=_de();xr.array=TWe;var bWe=yde();xr.errno=bWe;var AWe=Sde();xr.fs=AWe;var wWe=bde();xr.path=wWe;var xWe=Kfe();xr.pattern=xWe;var RWe=tpe();xr.stream=RWe;var IWe=rpe();xr.string=IWe});var spe=T(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.convertPatternGroupToTask=Rr.convertPatternGroupsToTasks=Rr.groupPatternsByBaseDirectory=Rr.getNegativePatternsAsPositive=Rr.getPositivePatterns=Rr.convertPatternsToTasks=Rr.generate=void 0;var ji=Zs();function CWe(t,e){let r=npe(t,e),n=npe(e.ignore,e),i=ipe(r),o=ope(r,n),s=i.filter(u=>ji.pattern.isStaticPattern(u,e)),a=i.filter(u=>ji.pattern.isDynamicPattern(u,e)),c=IG(s,o,!1),l=IG(a,o,!0);return c.concat(l)}Rr.generate=CWe;function npe(t,e){let r=t;return e.braceExpansion&&(r=ji.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>ji.pattern.removeDuplicateSlashes(n))}function IG(t,e,r){let n=[],i=ji.pattern.getPatternsOutsideCurrentDirectory(t),o=ji.pattern.getPatternsInsideCurrentDirectory(t),s=CG(i),a=CG(o);return n.push(...PG(s,e,r)),"."in a?n.push(OG(".",o,e,r)):n.push(...PG(a,e,r)),n}Rr.convertPatternsToTasks=IG;function ipe(t){return ji.pattern.getPositivePatterns(t)}Rr.getPositivePatterns=ipe;function ope(t,e){return ji.pattern.getNegativePatterns(t).concat(e).map(ji.pattern.convertToPositivePattern)}Rr.getNegativePatternsAsPositive=ope;function CG(t){let e={};return t.reduce((r,n)=>{let i=ji.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Rr.groupPatternsByBaseDirectory=CG;function PG(t,e,r){return Object.keys(t).map(n=>OG(n,t[n],e,r))}Rr.convertPatternGroupsToTasks=PG;function OG(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(ji.pattern.convertToNegativePattern))}}Rr.convertPatternGroupToTask=OG});var cpe=T(gC=>{"use strict";Object.defineProperty(gC,"__esModule",{value:!0});gC.read=void 0;function PWe(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){ape(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){NG(r,i);return}e.fs.stat(t,(o,s)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){ape(r,o);return}NG(r,i);return}e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),NG(r,s)})})}gC.read=PWe;function ape(t,e){t(e)}function NG(t,e){t(null,e)}});var lpe=T(_C=>{"use strict";Object.defineProperty(_C,"__esModule",{value:!0});_C.read=void 0;function OWe(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}_C.read=OWe});var upe=T(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.createFileSystemAdapter=Nc.FILE_SYSTEM_ADAPTER=void 0;var yC=Q("fs");Nc.FILE_SYSTEM_ADAPTER={lstat:yC.lstat,stat:yC.stat,lstatSync:yC.lstatSync,statSync:yC.statSync};function NWe(t){return t===void 0?Nc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Nc.FILE_SYSTEM_ADAPTER),t)}Nc.createFileSystemAdapter=NWe});var dpe=T(MG=>{"use strict";Object.defineProperty(MG,"__esModule",{value:!0});var kWe=upe(),kG=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=kWe.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};MG.default=kG});var Bu=T(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.statSync=kc.stat=kc.Settings=void 0;var fpe=cpe(),MWe=lpe(),DG=dpe();kc.Settings=DG.default;function DWe(t,e,r){if(typeof e=="function"){fpe.read(t,LG(),e);return}fpe.read(t,LG(e),r)}kc.stat=DWe;function LWe(t,e){let r=LG(e);return MWe.read(t,r)}kc.statSync=LWe;function LG(t={}){return t instanceof DG.default?t:new DG.default(t)}});var mpe=T((Xzt,hpe)=>{"use strict";var ppe;hpe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(ppe||(ppe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var _pe=T((Qzt,gpe)=>{"use strict";gpe.exports=UWe;var $We=mpe();function UWe(t,e){let r,n,i,o=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function s(c){function l(){e&&e(c,r),e=null}o?$We(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&s(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):s(null),o=!1}});var $G=T(EC=>{"use strict";Object.defineProperty(EC,"__esModule",{value:!0});EC.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var SC=process.versions.node.split(".");if(SC[0]===void 0||SC[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var ype=Number.parseInt(SC[0],10),FWe=Number.parseInt(SC[1],10),Spe=10,BWe=10,jWe=ype>Spe,zWe=ype===Spe&&FWe>=BWe;EC.IS_SUPPORT_READDIR_WITH_FILE_TYPES=jWe||zWe});var Epe=T(vC=>{"use strict";Object.defineProperty(vC,"__esModule",{value:!0});vC.createDirentFromStats=void 0;var UG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function GWe(t,e){return new UG(t,e)}vC.createDirentFromStats=GWe});var FG=T(TC=>{"use strict";Object.defineProperty(TC,"__esModule",{value:!0});TC.fs=void 0;var qWe=Epe();TC.fs=qWe});var BG=T(bC=>{"use strict";Object.defineProperty(bC,"__esModule",{value:!0});bC.joinPathSegments=void 0;function VWe(t,e,r){return t.endsWith(r)?t+e:t+r+e}bC.joinPathSegments=VWe});var xpe=T(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.readdir=Mc.readdirWithFileTypes=Mc.read=void 0;var HWe=Bu(),vpe=_pe(),WWe=$G(),Tpe=FG(),bpe=BG();function YWe(t,e,r){if(!e.stats&&WWe.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Ape(t,e,r);return}wpe(t,e,r)}Mc.read=YWe;function Ape(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){AC(r,n);return}let o=i.map(a=>({dirent:a,name:a.name,path:bpe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){jG(r,o);return}let s=o.map(a=>KWe(a,e));vpe(s,(a,c)=>{if(a!==null){AC(r,a);return}jG(r,c)})})}Mc.readdirWithFileTypes=Ape;function KWe(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Tpe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function wpe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){AC(r,n);return}let o=i.map(s=>{let a=bpe.joinPathSegments(t,s,e.pathSegmentSeparator);return c=>{HWe.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:s,path:a,dirent:Tpe.fs.createDirentFromStats(s,u)};e.stats&&(d.stats=u),c(null,d)})}});vpe(o,(s,a)=>{if(s!==null){AC(r,s);return}jG(r,a)})})}Mc.readdir=wpe;function AC(t,e){t(e)}function jG(t,e){t(null,e)}});var Ope=T(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.readdir=Dc.readdirWithFileTypes=Dc.read=void 0;var ZWe=Bu(),JWe=$G(),Rpe=FG(),Ipe=BG();function XWe(t,e){return!e.stats&&JWe.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Cpe(t,e):Ppe(t,e)}Dc.read=XWe;function Cpe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:Ipe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let o=e.fs.statSync(i.path);i.dirent=Rpe.fs.createDirentFromStats(i.name,o)}catch(o){if(e.throwErrorOnBrokenSymbolicLink)throw o}return i})}Dc.readdirWithFileTypes=Cpe;function Ppe(t,e){return e.fs.readdirSync(t).map(n=>{let i=Ipe.joinPathSegments(t,n,e.pathSegmentSeparator),o=ZWe.statSync(i,e.fsStatSettings),s={name:n,path:i,dirent:Rpe.fs.createDirentFromStats(n,o)};return e.stats&&(s.stats=o),s})}Dc.readdir=Ppe});var Npe=T(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.createFileSystemAdapter=Lc.FILE_SYSTEM_ADAPTER=void 0;var Yh=Q("fs");Lc.FILE_SYSTEM_ADAPTER={lstat:Yh.lstat,stat:Yh.stat,lstatSync:Yh.lstatSync,statSync:Yh.statSync,readdir:Yh.readdir,readdirSync:Yh.readdirSync};function QWe(t){return t===void 0?Lc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Lc.FILE_SYSTEM_ADAPTER),t)}Lc.createFileSystemAdapter=QWe});var kpe=T(GG=>{"use strict";Object.defineProperty(GG,"__esModule",{value:!0});var e3e=Q("path"),t3e=Bu(),r3e=Npe(),zG=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=r3e.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,e3e.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new t3e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};GG.default=zG});var wC=T($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Settings=$c.scandirSync=$c.scandir=void 0;var Mpe=xpe(),n3e=Ope(),qG=kpe();$c.Settings=qG.default;function i3e(t,e,r){if(typeof e=="function"){Mpe.read(t,VG(),e);return}Mpe.read(t,VG(e),r)}$c.scandir=i3e;function o3e(t,e){let r=VG(e);return n3e.read(t,r)}$c.scandirSync=o3e;function VG(t={}){return t instanceof qG.default?t:new qG.default(t)}});var Lpe=T((lGt,Dpe)=>{"use strict";function s3e(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}Dpe.exports=s3e});var Upe=T((uGt,HG)=>{"use strict";var a3e=Lpe();function $pe(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=a3e(c3e),i=null,o=null,s=0,a=null,c={push:m,drain:fn,saturated:fn,pause:u,paused:!1,get concurrency(){return r},set concurrency(C){if(!(C>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=C,!c.paused)for(;i&&s<r;)s++,E()},running:l,resume:p,idle:h,length:d,getQueue:f,unshift:S,empty:fn,kill:b,killAndDrain:A,error:x,abort:y};return c;function l(){return s}function u(){c.paused=!0}function d(){for(var C=i,O=0;C;)C=C.next,O++;return O}function f(){for(var C=i,O=[];C;)O.push(C.value),C=C.next;return O}function p(){if(c.paused){if(c.paused=!1,i===null){s++,E();return}for(;i&&s<r;)s++,E()}}function h(){return s===0&&c.length()===0}function m(C,O){var N=n.get();N.context=t,N.release=E,N.value=C,N.callback=O||fn,N.errorHandler=a,s>=r||c.paused?o?(o.next=N,o=N):(i=N,o=N,c.saturated()):(s++,e.call(t,N.value,N.worked))}function S(C,O){var N=n.get();N.context=t,N.release=E,N.value=C,N.callback=O||fn,N.errorHandler=a,s>=r||c.paused?i?(N.next=i,i=N):(i=N,o=N,c.saturated()):(s++,e.call(t,N.value,N.worked))}function E(C){C&&n.release(C);var O=i;O&&s<=r?c.paused?s--:(o===i&&(o=null),i=O.next,O.next=null,e.call(t,O.value,O.worked),o===null&&c.empty()):--s===0&&c.drain()}function b(){i=null,o=null,c.drain=fn}function A(){i=null,o=null,c.drain(),c.drain=fn}function y(){var C=i;for(i=null,o=null;C;){var O=C.next,N=C.callback,R=C.errorHandler,$=C.value,_=C.context;C.value=null,C.callback=fn,C.errorHandler=null,R&&R(new Error("abort"),$),N.call(_,new Error("abort")),C.release(C),C=O}c.drain=fn}function x(C){a=C}}function fn(){}function c3e(){this.value=null,this.callback=fn,this.next=null,this.release=fn,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=fn,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function l3e(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,d){e.call(this,u).then(function(f){d(null,f)},d)}var i=$pe(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=c,i.drained=l,i;function a(u){var d=new Promise(function(f,p){o(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(fn),d}function c(u){var d=new Promise(function(f,p){s(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(fn),d}function l(){var u=new Promise(function(d){process.nextTick(function(){if(i.idle())d();else{var f=i.drain;i.drain=function(){typeof f=="function"&&f(),d(),i.drain=f}}})});return u}}HG.exports=$pe;HG.exports.promise=l3e});var xC=T(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.joinPathSegments=Uo.replacePathSegmentSeparator=Uo.isAppliedFilter=Uo.isFatalError=void 0;function u3e(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Uo.isFatalError=u3e;function d3e(t,e){return t===null||t(e)}Uo.isAppliedFilter=d3e;function f3e(t,e){return t.split(/[/\\]/).join(e)}Uo.replacePathSegmentSeparator=f3e;function p3e(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Uo.joinPathSegments=p3e});var KG=T(YG=>{"use strict";Object.defineProperty(YG,"__esModule",{value:!0});var h3e=xC(),WG=class{constructor(e,r){this._root=e,this._settings=r,this._root=h3e.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};YG.default=WG});var XG=T(JG=>{"use strict";Object.defineProperty(JG,"__esModule",{value:!0});var m3e=Q("events"),g3e=wC(),_3e=Upe(),RC=xC(),y3e=KG(),ZG=class extends y3e.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=g3e.scandir,this._emitter=new m3e.EventEmitter,this._queue=_3e(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let o of i)this._handleEntry(o,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!RC.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=RC.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),RC.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&RC.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};JG.default=ZG});var Fpe=T(e4=>{"use strict";Object.defineProperty(e4,"__esModule",{value:!0});var S3e=XG(),QG=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new S3e.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{E3e(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{v3e(e,this._storage)}),this._reader.read()}};e4.default=QG;function E3e(t,e){t(e)}function v3e(t,e){t(null,e)}});var Bpe=T(r4=>{"use strict";Object.defineProperty(r4,"__esModule",{value:!0});var T3e=Q("stream"),b3e=XG(),t4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new b3e.default(this._root,this._settings),this._stream=new T3e.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};r4.default=t4});var jpe=T(i4=>{"use strict";Object.defineProperty(i4,"__esModule",{value:!0});var A3e=wC(),IC=xC(),w3e=KG(),n4=class extends w3e.default{constructor(){super(...arguments),this._scandir=A3e.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(IC.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=IC.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),IC.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&IC.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};i4.default=n4});var zpe=T(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});var x3e=jpe(),o4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new x3e.default(this._root,this._settings)}read(){return this._reader.read()}};s4.default=o4});var Gpe=T(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});var R3e=Q("path"),I3e=wC(),a4=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,R3e.sep),this.fsScandirSettings=new I3e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};c4.default=a4});var PC=T(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Settings=Fo.walkStream=Fo.walkSync=Fo.walk=void 0;var qpe=Fpe(),C3e=Bpe(),P3e=zpe(),l4=Gpe();Fo.Settings=l4.default;function O3e(t,e,r){if(typeof e=="function"){new qpe.default(t,CC()).read(e);return}new qpe.default(t,CC(e)).read(r)}Fo.walk=O3e;function N3e(t,e){let r=CC(e);return new P3e.default(t,r).read()}Fo.walkSync=N3e;function k3e(t,e){let r=CC(e);return new C3e.default(t,r).read()}Fo.walkStream=k3e;function CC(t={}){return t instanceof l4.default?t:new l4.default(t)}});var OC=T(d4=>{"use strict";Object.defineProperty(d4,"__esModule",{value:!0});var M3e=Q("path"),D3e=Bu(),Vpe=Zs(),u4=class{constructor(e){this._settings=e,this._fsStatSettings=new D3e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return M3e.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Vpe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Vpe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};d4.default=u4});var h4=T(p4=>{"use strict";Object.defineProperty(p4,"__esModule",{value:!0});var L3e=Q("stream"),$3e=Bu(),U3e=PC(),F3e=OC(),f4=class extends F3e.default{constructor(){super(...arguments),this._walkStream=U3e.walkStream,this._stat=$3e.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new L3e.PassThrough({objectMode:!0});i._write=(o,s,a)=>this._getEntry(n[o],e[o],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),o===n.length-1&&i.end(),a()}).catch(a);for(let o=0;o<n.length;o++)i.write(o);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,o)=>i===null?r(o):n(i))})}};p4.default=f4});var Hpe=T(g4=>{"use strict";Object.defineProperty(g4,"__esModule",{value:!0});var B3e=PC(),j3e=OC(),z3e=h4(),m4=class extends j3e.default{constructor(){super(...arguments),this._walkAsync=B3e.walk,this._readerStream=new z3e.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(o,s)=>{o===null?n(s):i(o)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((o,s)=>{i.once("error",s),i.on("data",a=>n.push(a)),i.once("end",()=>o(n))})}};g4.default=m4});var Wpe=T(y4=>{"use strict";Object.defineProperty(y4,"__esModule",{value:!0});var $S=Zs(),_4=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return $S.pattern.getPatternParts(e,this._micromatchOptions).map(n=>$S.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:$S.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return $S.array.splitWhen(e,r=>r.dynamic&&$S.pattern.hasGlobStar(r.pattern))}};y4.default=_4});var Ype=T(E4=>{"use strict";Object.defineProperty(E4,"__esModule",{value:!0});var G3e=Wpe(),S4=class extends G3e.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(o=>!o.complete||o.segments.length>n);for(let o of i){let s=o.sections[0];if(!o.complete&&n>s.length||r.every((c,l)=>{let u=o.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};E4.default=S4});var Kpe=T(T4=>{"use strict";Object.defineProperty(T4,"__esModule",{value:!0});var NC=Zs(),q3e=Ype(),v4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),o=this._getNegativePatternsRe(n);return s=>this._filter(e,s,i,o)}_getMatcher(e){return new q3e.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(NC.pattern.isAffectDepthOfReadingPattern);return NC.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let o=NC.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(o,n)?!1:this._isSkippedByNegativePatterns(o,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!NC.pattern.matchAny(e,r)}};T4.default=v4});var Zpe=T(A4=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});var Uc=Zs(),b4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Uc.pattern.partitionAbsoluteAndRelative(r),o={positive:{all:Uc.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Uc.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Uc.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,o)}_filter(e,r){let n=Uc.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Uc.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Uc.pattern.matchAny(e,r);return!i&&n?Uc.pattern.matchAny(e+"/",r):i}};A4.default=b4});var Jpe=T(x4=>{"use strict";Object.defineProperty(x4,"__esModule",{value:!0});var V3e=Zs(),w4=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return V3e.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};x4.default=w4});var Qpe=T(I4=>{"use strict";Object.defineProperty(I4,"__esModule",{value:!0});var Xpe=Zs(),R4=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Xpe.path.makeAbsolute(this._settings.cwd,r),r=Xpe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};I4.default=R4});var kC=T(P4=>{"use strict";Object.defineProperty(P4,"__esModule",{value:!0});var H3e=Q("path"),W3e=Kpe(),Y3e=Zpe(),K3e=Jpe(),Z3e=Qpe(),C4=class{constructor(e){this._settings=e,this.errorFilter=new K3e.default(this._settings),this.entryFilter=new Y3e.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new W3e.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Z3e.default(this._settings)}_getRootDirectory(e){return H3e.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};P4.default=C4});var ehe=T(N4=>{"use strict";Object.defineProperty(N4,"__esModule",{value:!0});var J3e=Hpe(),X3e=kC(),O4=class extends X3e.default{constructor(){super(...arguments),this._reader=new J3e.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(o=>n.transform(o))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};N4.default=O4});var the=T(M4=>{"use strict";Object.defineProperty(M4,"__esModule",{value:!0});var Q3e=Q("stream"),eYe=h4(),tYe=kC(),k4=class extends tYe.default{constructor(){super(...arguments),this._reader=new eYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),o=new Q3e.Readable({objectMode:!0,read:()=>{}});return i.once("error",s=>o.emit("error",s)).on("data",s=>o.emit("data",n.transform(s))).once("end",()=>o.emit("end")),o.once("close",()=>i.destroy()),o}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};M4.default=k4});var rhe=T(L4=>{"use strict";Object.defineProperty(L4,"__esModule",{value:!0});var rYe=Bu(),nYe=PC(),iYe=OC(),D4=class extends iYe.default{constructor(){super(...arguments),this._walkSync=nYe.walkSync,this._statSync=rYe.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let o=this._getFullEntryPath(i),s=this._getEntry(o,i,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};L4.default=D4});var nhe=T(U4=>{"use strict";Object.defineProperty(U4,"__esModule",{value:!0});var oYe=rhe(),sYe=kC(),$4=class extends sYe.default{constructor(){super(...arguments),this._reader=new oYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};U4.default=$4});var ihe=T(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var Kh=Q("fs"),aYe=Q("os"),cYe=Math.max(aYe.cpus().length,1);Zh.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:Kh.lstat,lstatSync:Kh.lstatSync,stat:Kh.stat,statSync:Kh.statSync,readdir:Kh.readdir,readdirSync:Kh.readdirSync};var F4=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,cYe),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},Zh.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};Zh.default=F4});var US=T((DGt,she)=>{"use strict";var ohe=spe(),lYe=ehe(),uYe=the(),dYe=nhe(),B4=ihe(),oi=Zs();async function j4(t,e){zi(t);let r=z4(t,lYe.default,e),n=await Promise.all(r);return oi.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){zi(l);let d=z4(l,dYe.default,u);return oi.array.flatten(d)}t.sync=e;function r(l,u){zi(l);let d=z4(l,uYe.default,u);return oi.stream.merge(d)}t.stream=r;function n(l,u){zi(l);let d=[].concat(l),f=new B4.default(u);return ohe.generate(d,f)}t.generateTasks=n;function i(l,u){zi(l);let d=new B4.default(u);return oi.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function o(l){return zi(l),oi.path.escape(l)}t.escapePath=o;function s(l){return zi(l),oi.path.convertPathToPattern(l)}t.convertPathToPattern=s;let a;(function(l){function u(f){return zi(f),oi.path.escapePosixPath(f)}l.escapePath=u;function d(f){return zi(f),oi.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return zi(f),oi.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return zi(f),oi.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(j4||(j4={}));function z4(t,e,r){let n=[].concat(t),i=new B4.default(r),o=ohe.generate(n,i),s=new e(i);return o.map(s.read,s)}function zi(t){if(![].concat(t).every(n=>oi.string.isString(n)&&!oi.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}she.exports=j4});var J4=T((GGt,LC)=>{"use strict";function dhe(t){return Array.isArray(t)?t:[t]}var hYe=void 0,H4="",lhe=" ",V4="\\",mYe=/^\s+$/,gYe=/(?:[^\\]|^)\\$/,_Ye=/^\\!/,yYe=/^\\#/,SYe=/\r?\n/g,EYe=/^\.{0,2}\/|^\.{1,2}$/,vYe=/\/$/,Jh="/",fhe="node-ignore";typeof Symbol<"u"&&(fhe=Symbol.for("node-ignore"));var phe=fhe,Xh=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),TYe=/([0-z])-([0-z])/g,hhe=()=>!1,bYe=t=>t.replace(TYe,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:H4),AYe=t=>{let{length:e}=t;return t.slice(0,e-e%2)},wYe=[[/^\uFEFF/,()=>H4],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?lhe:H4)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+lhe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>V4],[/\\\\/g,()=>V4],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===V4?`\\[${r}${AYe(n)}${i}`:i==="]"&&n.length%2===0?`[${bYe(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],xYe=/(^|\\\/)?\\\*$/,FS="regex",MC="checkRegex",uhe="_",RYe={[FS](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[MC](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},IYe=t=>wYe.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),DC=t=>typeof t=="string",CYe=t=>t&&DC(t)&&!mYe.test(t)&&!gYe.test(t)&&t.indexOf("#")!==0,PYe=t=>t.split(SYe).filter(Boolean),W4=class{constructor(e,r,n,i,o,s){this.pattern=e,this.mark=r,this.negative=o,Xh(this,"body",n),Xh(this,"ignoreCase",i),Xh(this,"regexPrefix",s)}get regex(){let e=uhe+FS;return this[e]?this[e]:this._make(FS,e)}get checkRegex(){let e=uhe+MC;return this[e]?this[e]:this._make(MC,e)}_make(e,r){let n=this.regexPrefix.replace(xYe,RYe[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return Xh(this,r,i)}},OYe=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(_Ye,"!").replace(yYe,"#");let o=IYe(i);return new W4(t,e,i,r,n,o)},Y4=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[phe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(DC(e)&&(e={pattern:e}),CYe(e.pattern)){let r=OYe(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,dhe(DC(e)?PYe(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,o=!1,s;this._rules.forEach(c=>{let{negative:l}=c;o===l&&i!==o||l&&!i&&!o&&!r||!c[n].test(e)||(i=!l,o=l,s=l?hYe:c)});let a={ignored:i,unignored:o};return s&&(a.rule=s),a}},NYe=(t,e)=>{throw new e(t)},Js=(t,e,r)=>DC(t)?t?Js.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),mhe=t=>EYe.test(t);Js.isNotRelative=mhe;Js.convert=t=>t;var K4=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){Xh(this,phe,!0),this._rules=new Y4(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let o=e&&Js.convert(e);return Js(o,e,this._strictPathCheck?NYe:hhe),this._t(o,r,n,i)}checkIgnore(e){if(!vYe.test(e))return this.test(e);let r=e.split(Jh).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(Jh)+Jh,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,MC)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(Jh).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,FS);let o=this._t(i.join(Jh)+Jh,r,n,i);return r[e]=o.ignored?o:this._rules.test(e,n,FS)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return dhe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Z4=t=>new K4(t),kYe=t=>Js(t&&Js.convert(t),t,hhe),ghe=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Js.convert=t;let e=/^[a-z]:\//i;Js.isNotRelative=r=>e.test(r)||mhe(r)};typeof process<"u"&&process.platform==="win32"&&ghe();LC.exports=Z4;Z4.default=Z4;LC.exports.isPathValid=kYe;Xh(LC.exports,Symbol.for("setupWindows"),ghe)});var Oq=T(hge=>{"use strict";hge.parse=function(t,e){return new Pq(t,e).parse()};var Pq=class t{constructor(e,r){this.source=e,this.transform=r||iZe,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function iZe(t){return t}});var Nq=T((ZHt,mge)=>{"use strict";var oZe=Oq();mge.exports={create:function(t,e){return{parse:function(){return oZe.parse(t,e)}}}}});var yge=T((JHt,_ge)=>{"use strict";var sZe=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,aZe=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,cZe=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,lZe=/^-?infinity$/;_ge.exports=function(e){if(lZe.test(e))return Number(e.replace("i","I"));var r=sZe.exec(e);if(!r)return uZe(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=gge(i));var o=parseInt(r[2],10)-1,s=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=dZe(e);return f!=null?(d=new Date(Date.UTC(i,o,s,a,c,l,u)),kq(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,o,s,a,c,l,u),kq(i)&&d.setFullYear(i)),d};function uZe(t){var e=aZe.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=gge(r));var i=parseInt(e[2],10)-1,o=e[3],s=new Date(r,i,o);return kq(r)&&s.setFullYear(r),s}}function dZe(t){if(t.endsWith("+00"))return 0;var e=cZe.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function gge(t){return-(t-1)}function kq(t){return t>=0&&t<100}});var Ege=T((XHt,Sge)=>{"use strict";Sge.exports=pZe;var fZe=Object.prototype.hasOwnProperty;function pZe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)fZe.call(r,n)&&(t[n]=r[n])}return t}});var bge=T((QHt,Tge)=>{"use strict";var hZe=Ege();Tge.exports=um;function um(t){if(!(this instanceof um))return new um(t);hZe(this,xZe(t))}var mZe=["seconds","minutes","hours","days","months","years"];um.prototype.toPostgres=function(){var t=mZe.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var gZe={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},_Ze=["years","months","days"],yZe=["hours","minutes","seconds"];um.prototype.toISOString=um.prototype.toISO=function(){var t=_Ze.map(r,this).join(""),e=yZe.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+gZe[n]}};var Mq="([+-]?\\d+)",SZe=Mq+"\\s+years?",EZe=Mq+"\\s+mons?",vZe=Mq+"\\s+days?",TZe="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",bZe=new RegExp([SZe,EZe,vZe,TZe].map(function(t){return"("+t+")?"}).join("\\s*")),vge={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},AZe=["hours","minutes","seconds","milliseconds"];function wZe(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function xZe(t){if(!t)return{};var e=bZe.exec(t),r=e[8]==="-";return Object.keys(vge).reduce(function(n,i){var o=vge[i],s=e[o];return!s||(s=i==="milliseconds"?wZe(s):parseInt(s,10),!s)||(r&&~AZe.indexOf(i)&&(s*=-1),n[i]=s),n},{})}});var xge=T((e6t,wge)=>{"use strict";var Age=Buffer.from||Buffer;wge.exports=function(e){if(/^\\x/.test(e))return Age(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var o=0;o<Math.floor(i/2);++o)r+="\\";n+=Math.floor(i/2)*2}return Age(r,"binary")}});var kge=T((t6t,Nge)=>{"use strict";var WS=Oq(),YS=Nq(),JC=yge(),Ige=bge(),Cge=xge();function XC(t){return function(r){return r===null?r:t(r)}}function Pge(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function RZe(t){return t?WS.parse(t,Pge):null}function IZe(t){return parseInt(t,10)}function Dq(t){return t?WS.parse(t,XC(IZe)):null}function CZe(t){return t?WS.parse(t,XC(function(e){return Oge(e).trim()})):null}var PZe=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=Fq(r)),r});return e.parse()},Lq=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},si=function(t){if(!t)return null;var e=YS.create(t);return e.parse()},$q=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=JC(r)),r});return e.parse()},OZe=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=Ige(r)),r});return e.parse()},NZe=function(t){return t?WS.parse(t,XC(Cge)):null},Uq=function(t){return parseInt(t,10)},Oge=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},Rge=function(t){return t?WS.parse(t,XC(JSON.parse)):null},Fq=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},kZe=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var o=Fq(e);return o.radius=parseFloat(r),o},MZe=function(t){t(20,Oge),t(21,Uq),t(23,Uq),t(26,Uq),t(700,parseFloat),t(701,parseFloat),t(16,Pge),t(1082,JC),t(1114,JC),t(1184,JC),t(600,Fq),t(651,si),t(718,kZe),t(1e3,RZe),t(1001,NZe),t(1005,Dq),t(1007,Dq),t(1028,Dq),t(1016,CZe),t(1017,PZe),t(1021,Lq),t(1022,Lq),t(1231,Lq),t(1014,si),t(1015,si),t(1008,si),t(1009,si),t(1040,si),t(1041,si),t(1115,$q),t(1182,$q),t(1185,$q),t(1186,Ige),t(1187,OZe),t(17,Cge),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,Rge),t(3807,Rge),t(3907,si),t(2951,si),t(791,si),t(1183,si),t(1270,si)};Nge.exports={init:MZe}});var Dge=T((r6t,Mge)=>{"use strict";var pn=1e6;function DZe(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",o,s,a,c,l,u;{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return o=e%pn,s=4294967296*o+r,a=""+s%pn,n+a+i}Mge.exports=DZe});var Bge=T((n6t,Fge)=>{"use strict";var LZe=Dge(),Tt=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var o=r>>3,s=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,s(t[o])&a,c));for(var u=e+r>>3,d=o+1;d<u;d++)l=i(l,s(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,s(t[u])>>8-f,f)),l},Uge=function(t,e,r){var n=Math.pow(2,r-1)-1,i=Tt(t,1),o=Tt(t,r,1);if(o===0)return 0;var s=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)s/=2,(u&1<<d-f)>0&&(l+=s);return l},c=Tt(t,e,r+1,!1,a);return o==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,o-n)*c},$Ze=function(t){return Tt(t,1)==1?-1*(Tt(t,15,1,!0)+1):Tt(t,15,1)},Lge=function(t){return Tt(t,1)==1?-1*(Tt(t,31,1,!0)+1):Tt(t,31,1)},UZe=function(t){return Uge(t,23,8)},FZe=function(t){return Uge(t,52,11)},BZe=function(t){var e=Tt(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,Tt(t,16,16)),n=0,i=[],o=Tt(t,16),s=0;s<o;s++)n+=Tt(t,16,64+16*s)*r,r/=1e4;var a=Math.pow(10,Tt(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},$ge=function(t,e){var r=Tt(e,1),n=Tt(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(o){this.usec=o},i.getUTCMicroSeconds=function(){return this.usec},i},KS=function(t){for(var e=Tt(t,32),r=Tt(t,32,32),n=Tt(t,32,64),i=96,o=[],s=0;s<e;s++)o[s]=Tt(t,32,i),i+=32,i+=32;var a=function(l){var u=Tt(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=Tt(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(o,n)},jZe=function(t){return t.toString("utf8")},zZe=function(t){return t===null?null:Tt(t,8)>0},GZe=function(t){t(20,LZe),t(21,$Ze),t(23,Lge),t(26,Lge),t(1700,BZe),t(700,UZe),t(701,FZe),t(16,zZe),t(1114,$ge.bind(null,!1)),t(1184,$ge.bind(null,!0)),t(1e3,KS),t(1007,KS),t(1016,KS),t(1008,KS),t(1009,KS),t(25,jZe)};Fge.exports={init:GZe}});var zge=T((i6t,jge)=>{"use strict";jge.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var XS=T(JS=>{"use strict";var qZe=kge(),VZe=Bge(),HZe=Nq(),WZe=zge();JS.getTypeParser=YZe;JS.setTypeParser=KZe;JS.arrayParser=HZe;JS.builtins=WZe;var ZS={text:{},binary:{}};function Gge(t){return String(t)}function YZe(t,e){return e=e||"text",ZS[e]&&ZS[e][t]||Gge}function KZe(t,e,r){typeof e=="function"&&(r=e,e="text"),ZS[e][t]=r}qZe.init(function(t,e){ZS.text[t]=e});VZe.init(function(t,e){ZS.binary[t]=e})});var QS=T((s6t,Bq)=>{"use strict";var qge;try{qge=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}Bq.exports={host:"localhost",user:qge,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var dm=XS(),ZZe=dm.getTypeParser(20,"text"),JZe=dm.getTypeParser(1016,"text");Bq.exports.__defineSetter__("parseInt8",function(t){dm.setTypeParser(20,"text",t?dm.getTypeParser(23,"text"):ZZe),dm.setTypeParser(1016,"text",t?dm.getTypeParser(1007,"text"):JZe)})});var fm=T((a6t,Hge)=>{"use strict";var XZe=QS(),{isDate:QZe}=Q("util/types");function e5e(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Vge(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Vge(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=e5e(QC(n))}return e+="}",e}var QC=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):QZe(t)?XZe.parseInputDatesAsUTC?n5e(t):r5e(t):Array.isArray(t)?Vge(t):t5e(t,e):t.toString()};function t5e(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),QC(t.toPostgres(QC),e)}return JSON.stringify(t)}function r5e(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function n5e(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function i5e(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var o5e=function(t){return'"'+t.replace(/"/g,'""')+'"'},s5e=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Hge.exports={prepareValue:function(e){return QC(e)},normalizeQueryConfig:i5e,escapeIdentifier:o5e,escapeLiteral:s5e}});var Gq=T((c6t,Kge)=>{"use strict";var Wge=Q("crypto");Kge.exports={postgresMd5PasswordHash:c5e,randomBytes:a5e,deriveKey:f5e,sha256:l5e,hashByName:u5e,hmacSha256:d5e,md5:jq};var Yge=Wge.webcrypto||globalThis.crypto,Gu=Yge.subtle,zq=new TextEncoder;function a5e(t){return Yge.getRandomValues(Buffer.alloc(t))}async function jq(t){try{return Wge.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?zq.encode(t):t,n=await Gu.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function c5e(t,e,r){let n=await jq(e+t);return"md5"+await jq(Buffer.concat([Buffer.from(n),r]))}async function l5e(t){return await Gu.digest("SHA-256",t)}async function u5e(t,e){return await Gu.digest(t,e)}async function d5e(t,e){let r=await Gu.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await Gu.sign("HMAC",r,zq.encode(e))}async function f5e(t,e,r){let n=await Gu.importKey("raw",zq.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await Gu.deriveBits(i,n,256,["deriveBits"])}});var Xge=T((l6t,Jge)=>{"use strict";function qu(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function qq(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw qu("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Zge(t,e){if(t[e++]!==6)throw qu("non-OID data",t);let{length:r,index:n}=qq(t,e);e=n;let i=e+r,o=t[e++],s=(o/40>>0)+"."+o%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}s+="."+a}return{oid:s,index:e}}function eE(t,e){if(t[e++]!==48)throw qu("non-sequence data",t);return qq(t,e)}function p5e(t,e){e===void 0&&(e=0),e=eE(t,e).index;let{length:r,index:n}=eE(t,e);e=n+r,e=eE(t,e).index;let{oid:i,index:o}=Zge(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=o,e=eE(t,e).index,t[e++]!==160)throw qu("non-tag data",t);e=qq(t,e).index,e=eE(t,e).index;let{oid:s}=Zge(t,e);switch(s){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw qu("unknown hash OID "+s,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw qu("Ed448 certificate channel binding is not currently supported by Postgres")}throw qu("unknown OID "+i,t)}Jge.exports={signatureAlgorithmHashFromCertificate:p5e}});var r_e=T((u6t,t_e)=>{"use strict";var jc=Gq(),{signatureAlgorithmHashFromCertificate:h5e}=Xge();function m5e(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var Vq=1e5;function g5e(t,e,r=Vq){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let o=jc.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:o,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+o,message:"SASLInitialResponse",scramMaxIterations:r}}async function _5e(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=E5e(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let o=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:Vq;if(o!==0&&i.iteration>o)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+o);let s="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let A=n.getPeerCertificate().raw,y=h5e(A);(y==="MD5"||y==="SHA-1")&&(y="SHA-256");let x=await jc.hashByName(y,A);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(x)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=s+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await jc.deriveKey(m5e(e),d,i.iteration),p=await jc.hmacSha256(f,"Client Key"),h=await jc.sha256(p),m=await jc.hmacSha256(h,u),S=T5e(Buffer.from(p),Buffer.from(m)).toString("base64"),E=await jc.hmacSha256(f,"Server Key"),b=await jc.hmacSha256(E,u);t.message="SASLResponse",t.serverSignature=Buffer.from(b).toString("base64"),t.response=l+",p="+S}function y5e(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=v5e(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function S5e(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function Qge(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function e_e(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function E5e(t){let e=e_e(t),r=e.get("r");if(r){if(!S5e(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Qge(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let o=parseInt(i,10);return{nonce:r,salt:n,iteration:o}}function v5e(t){let e=e_e(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!Qge(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function T5e(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}t_e.exports={startSession:g5e,continueSession:_5e,finalizeSession:y5e,DEFAULT_MAX_SCRAM_ITERATIONS:Vq}});var tP=T((d6t,n_e)=>{"use strict";var b5e=XS();function eP(t){this._types=t||b5e,this.text={},this.binary={}}eP.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};eP.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};eP.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};n_e.exports=eP});var s_e=T((f6t,o_e)=>{"use strict";function pm(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let o=i?"":n.hostname;r.host?o&&/^%2f/i.test(o)&&(n.pathname=o+n.pathname):r.host=decodeURIComponent(o),r.port||(r.port=n.port);let s=n.pathname.slice(1)||null;r.database=s?decodeURI(s):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?Q("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&Hq(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function A5e(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function i_e(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let o=i;typeof o=="boolean"&&(r[n]=o),typeof o=="object"&&(r[n]=A5e(o))}else if(i!=null)if(n==="port"){if(i!==""){let o=parseInt(i,10);if(isNaN(o))throw new Error(`Invalid ${n}: ${i}`);r[n]=o}}else r[n]=i;return r},Object.create(null))}function w5e(t){return i_e(pm(t))}function Hq(t){!Hq.warned&&typeof process<"u"&&process.emitWarning&&(Hq.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
24
+ GFS4: `),console.error(t)});vt[yr]||(ede=global[yr]||[],rde(vt,ede),vt.close=(function(t){function e(r,n){return t.call(vt,r,function(i){i||tde(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,iC,{value:t}),e})(vt.close),vt.closeSync=(function(t){function e(r){t.apply(vt,arguments),tde()}return Object.defineProperty(e,iC,{value:t}),e})(vt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Lu(vt[yr]),Q("assert").equal(vt[yr].length,0)}));var ede;global[yr]||rde(global,vt[yr]);Kz.exports=Wz(MVe(vt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!vt.__patched&&(Kz.exports=Wz(vt),vt.__patched=!0);function Wz(t){NVe(t),t.gracefulify=Wz,t.createReadStream=x,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(R,$,_){return typeof $=="function"&&(_=$,$=null),ee(R,$,_);function ee(k,g,v,I){return e(k,g,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Gh([ee,[k,g,v],J,I||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,q){return n(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,q||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,q){return o(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,q||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(R,$,_,ee){return typeof _=="function"&&(ee=_,_=0),k(R,$,_,ee);function k(g,v,I,J,q){return a(g,v,I,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,q||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(R,$,_){typeof $=="function"&&(_=$,$=null);var ee=u.test(process.version)?function(v,I,J,q){return l(v,k(v,I,J,q))}:function(v,I,J,q){return l(v,I,k(v,I,J,q))};return ee(R,$,_);function k(g,v,I,J){return function(q,le){q&&(q.code==="EMFILE"||q.code==="ENFILE")?Gh([ee,[g,v,I],q,J||Date.now(),Date.now()]):(le&&le.sort&&le.sort(),typeof I=="function"&&I.call(this,q,le))}}}if(process.version.substr(0,4)==="v0.8"){var f=kVe(t);E=f.ReadStream,A=f.WriteStream}var p=t.ReadStream;p&&(E.prototype=Object.create(p.prototype),E.prototype.open=b);var h=t.WriteStream;h&&(A.prototype=Object.create(h.prototype),A.prototype.open=y),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(R){E=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return A},set:function(R){A=R},enumerable:!0,configurable:!0});var m=E;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(R){m=R},enumerable:!0,configurable:!0});var S=A;Object.defineProperty(t,"FileWriteStream",{get:function(){return S},set:function(R){S=R},enumerable:!0,configurable:!0});function E(R,$){return this instanceof E?(p.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function b(){var R=this;N(R.path,R.flags,R.mode,function($,_){$?(R.autoClose&&R.destroy(),R.emit("error",$)):(R.fd=_,R.emit("open",_),R.read())})}function A(R,$){return this instanceof A?(h.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function y(){var R=this;N(R.path,R.flags,R.mode,function($,_){$?(R.destroy(),R.emit("error",$)):(R.fd=_,R.emit("open",_))})}function x(R,$){return new t.ReadStream(R,$)}function C(R,$){return new t.WriteStream(R,$)}var O=t.open;t.open=N;function N(R,$,_,ee){return typeof _=="function"&&(ee=_,_=null),k(R,$,_,ee);function k(g,v,I,J,q){return O(g,v,I,function(le,Oe){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Gh([k,[g,v,I,J],le,q||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}return t}function Gh(t){Lu("ENQUEUE",t[0].name,t[1]),vt[yr].push(t),Yz()}var nC;function tde(){for(var t=Date.now(),e=0;e<vt[yr].length;++e)vt[yr][e].length>2&&(vt[yr][e][3]=t,vt[yr][e][4]=t);Yz()}function Yz(){if(clearTimeout(nC),nC=void 0,vt[yr].length!==0){var t=vt[yr].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Lu("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Lu("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-i,1),l=Math.min(c*1.2,100);a>=l?(Lu("RETRY",e.name,r),e.apply(null,r.concat([i]))):vt[yr].push(t)}nC===void 0&&(nC=setTimeout(Yz,0))}}});var _de=T(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.splitWhen=qh.flatten=void 0;function tHe(t){return t.reduce((e,r)=>[].concat(e,r),[])}qh.flatten=tHe;function rHe(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}qh.splitWhen=rHe});var yde=T(sC=>{"use strict";Object.defineProperty(sC,"__esModule",{value:!0});sC.isEnoentCodeError=void 0;function nHe(t){return t.code==="ENOENT"}sC.isEnoentCodeError=nHe});var Sde=T(aC=>{"use strict";Object.defineProperty(aC,"__esModule",{value:!0});aC.createDirentFromStats=void 0;var iG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function iHe(t,e){return new iG(t,e)}aC.createDirentFromStats=iHe});var bde=T($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.convertPosixPathToPattern=$t.convertWindowsPathToPattern=$t.convertPathToPattern=$t.escapePosixPath=$t.escapeWindowsPath=$t.escape=$t.removeLeadingDotSegment=$t.makeAbsolute=$t.unixify=void 0;var oHe=Q("os"),sHe=Q("path"),Ede=oHe.platform()==="win32",aHe=2,cHe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,lHe=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,uHe=/^\\\\([.?])/,dHe=/\\(?![!()+@[\]{}])/g;function fHe(t){return t.replace(/\\/g,"/")}$t.unixify=fHe;function pHe(t,e){return sHe.resolve(t,e)}$t.makeAbsolute=pHe;function hHe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(aHe)}return t}$t.removeLeadingDotSegment=hHe;$t.escape=Ede?oG:sG;function oG(t){return t.replace(lHe,"\\$2")}$t.escapeWindowsPath=oG;function sG(t){return t.replace(cHe,"\\$2")}$t.escapePosixPath=sG;$t.convertPathToPattern=Ede?vde:Tde;function vde(t){return oG(t).replace(uHe,"//$1").replace(dHe,"/")}$t.convertWindowsPathToPattern=vde;function Tde(t){return sG(t)}$t.convertPosixPathToPattern=Tde});var wde=T((vzt,Ade)=>{"use strict";Ade.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Ide=T((Tzt,Rde)=>{"use strict";var mHe=wde(),xde={"{":"}","(":")","[":"]"},gHe=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=xde[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},_He=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=xde[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Rde.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(mHe(e))return!0;var n=gHe;return r&&r.strict===!1&&(n=_He),n(e)}});var Pde=T((bzt,Cde)=>{"use strict";var yHe=Ide(),SHe=Q("path").posix.dirname,EHe=Q("os").platform()==="win32",aG="/",vHe=/\\/g,THe=/[\{\[].*[\}\]]$/,bHe=/(^|[^\\])([\{\[]|\([^\)]+$)/,AHe=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Cde.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&EHe&&e.indexOf(aG)<0&&(e=e.replace(vHe,aG)),THe.test(e)&&(e+=aG),e+="a";do e=SHe(e);while(yHe(e)||bHe.test(e));return e.replace(AHe,"$1")}});var cC=T(ii=>{"use strict";ii.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ii.find=(t,e)=>t.nodes.find(r=>r.type===e);ii.exceedsLimit=(t,e,r=1,n)=>n===!1||!ii.isInteger(t)||!ii.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ii.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ii.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ii.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ii.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ii.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ii.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var lC=T((wzt,Nde)=>{"use strict";var Ode=cC();Nde.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&Ode.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&Ode.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var Mde=T((xzt,kde)=>{"use strict";kde.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Gde=T((Rzt,zde)=>{"use strict";var Dde=Mde(),Uu=(t,e,r)=>{if(Dde(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Dde(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+o+s+a;if(Uu.cache.hasOwnProperty(c))return Uu.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=jde(t)||jde(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=Lde(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=Lde(l,u,f,n)),f.negatives=h,f.positives=p,f.result=wHe(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),Uu.cache[c]=f,f.result};function wHe(t,e,r){let n=cG(t,e,"-",!1,r)||[],i=cG(e,t,"",!1,r)||[],o=cG(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function xHe(t,e){let r=1,n=1,i=Ude(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Ude(t,r);for(i=Fde(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Fde(e+1,n)-1;return o=[...o],o.sort(CHe),o}function RHe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=IHe(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?o+=c:c!=="0"||l!=="9"?o+=PHe(c,l,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Lde(t,e,r,n){let i=xHe(t,e),o=[],s=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=RHe(String(s),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Bde(a.count),s=l+1;continue}r.isPadded&&(d=OHe(l,r,n)),u.string=d+u.pattern+Bde(u.count),o.push(u),s=l+1,a=u}return o}function cG(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!$de(e,"string",a)&&o.push(r+a),n&&$de(e,"string",a)&&o.push(r+a)}return o}function IHe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function CHe(t,e){return t>e?1:e>t?-1:0}function $de(t,e,r){return t.some(n=>n[e]===r)}function Ude(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Fde(t,e){return t-t%Math.pow(10,e)}function Bde(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function PHe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function jde(t){return/^-?(0+)\d/.test(t)}function OHe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}Uu.cache={};Uu.clearCache=()=>Uu.cache={};zde.exports=Uu});var dG=T((Izt,Zde)=>{"use strict";var NHe=Q("util"),Vde=Gde(),qde=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),kHe=t=>e=>t===!0?Number(e):String(e),lG=t=>typeof t=="number"||typeof t=="string"&&t!=="",NS=t=>Number.isInteger(+t),uG=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},MHe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,DHe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},dC=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},LHe=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>dC(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>dC(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Hde=(t,e,r,n)=>{if(r)return Vde(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Wde=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Vde(t,e,r)},Yde=(...t)=>new RangeError("Invalid range arguments: "+NHe.inspect(...t)),Kde=(t,e,r)=>{if(r.strictRanges===!0)throw Yde([t,e]);return[]},$He=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},UHe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Yde([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=uG(a)||uG(c)||uG(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&MHe(t,e,n)===!1,p=n.transform||kHe(f);if(n.toRegex&&r===1)return Hde(dC(t,d),dC(e,d),!0,n);let h={negatives:[],positives:[]},m=b=>h[b<0?"negatives":"positives"].push(Math.abs(b)),S=[],E=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?m(i):S.push(DHe(p(i,E),d,f)),i=s?i-r:i+r,E++;return n.toRegex===!0?r>1?LHe(h,n,d):Wde(S,null,{wrap:!1,...n}):S},FHe=(t,e,r=1,n={})=>{if(!NS(t)&&t.length>1||!NS(e)&&e.length>1)return Kde(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,c=Math.min(o,s),l=Math.max(o,s);if(n.toRegex&&r===1)return Hde(c,l,!1,n);let u=[],d=0;for(;a?o>=s:o<=s;)u.push(i(o,d)),o=a?o-r:o+r,d++;return n.toRegex===!0?Wde(u,null,{wrap:!1,options:n}):u},uC=(t,e,r,n={})=>{if(e==null&&lG(t))return[t];if(!lG(t)||!lG(e))return Kde(t,e,n);if(typeof r=="function")return uC(t,e,1,{transform:r});if(qde(r))return uC(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,NS(r)?NS(t)&&NS(e)?UHe(t,e,r,i):FHe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!qde(r)?$He(r,i):uC(t,e,1,r)};Zde.exports=uC});var Qde=T((Czt,Xde)=>{"use strict";var BHe=dG(),Jde=cC(),jHe=(t,e={})=>{let r=(n,i={})=>{let o=Jde.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Jde.reduce(n.nodes),d=BHe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};Xde.exports=jHe});var rfe=T((Pzt,tfe)=>{"use strict";var zHe=dG(),efe=lC(),Vh=cC(),Fu=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Vh.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(Fu(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?Fu(i,o,r):i+o);return Vh.flatten(n)},GHe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(Fu(a.pop(),efe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Fu(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=Vh.reduce(i.nodes);if(Vh.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=zHe(...d,e);f.length===0&&(f=efe(i,e)),a.push(Fu(a.pop(),f)),i.nodes=[];return}let c=Vh.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(Fu(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(Fu(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return Vh.flatten(n(t))};tfe.exports=GHe});var ife=T((Ozt,nfe)=>{"use strict";nfe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
25
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var lfe=T((Nzt,cfe)=>{"use strict";var qHe=lC(),{MAX_LENGTH:ofe,CHAR_BACKSLASH:fG,CHAR_BACKTICK:VHe,CHAR_COMMA:HHe,CHAR_DOT:WHe,CHAR_LEFT_PARENTHESES:YHe,CHAR_RIGHT_PARENTHESES:KHe,CHAR_LEFT_CURLY_BRACE:ZHe,CHAR_RIGHT_CURLY_BRACE:JHe,CHAR_LEFT_SQUARE_BRACKET:sfe,CHAR_RIGHT_SQUARE_BRACKET:afe,CHAR_DOUBLE_QUOTE:XHe,CHAR_SINGLE_QUOTE:QHe,CHAR_NO_BREAK_SPACE:e6e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:t6e}=ife(),r6e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(ofe,r.maxLength):ofe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(s=o[o.length-1],f=p(),!(f===t6e||f===e6e)){if(f===fG){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===afe){h({type:"text",value:"\\"+f});continue}if(f===sfe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===sfe){c++;continue}if(m===fG){f+=p();continue}if(m===afe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===YHe){s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:f});continue}if(f===KHe){if(s.type!=="paren"){h({type:"text",value:f});continue}s=o.pop(),h({type:"text",value:f}),s=o[o.length-1];continue}if(f===XHe||f===QHe||f===VHe){let m=f,S;for(e.keepQuotes!==!0&&(f="");u<l&&(S=p());){if(S===fG){f+=S+p();continue}if(S===m){e.keepQuotes===!0&&(f+=S);break}f+=S}h({type:"text",value:f});continue}if(f===ZHe){d++;let S={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};s=h(S),o.push(s),h({type:"open",value:f});continue}if(f===JHe){if(s.type!=="brace"){h({type:"text",value:f});continue}let m="close";s=o.pop(),s.close=!0,h({type:m,value:f}),d--,s=o[o.length-1];continue}if(f===HHe&&d>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:qHe(s)}]}h({type:"comma",value:f}),s.commas++;continue}if(f===WHe&&d>0&&s.commas===0){let m=s.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(s.range=[],a.value+=f,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let S=m[m.length-1];S.value+=a.value+f,a=S,s.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let m=o[o.length-1],S=m.nodes.indexOf(s);m.nodes.splice(S,1,...s.nodes)}while(o.length>0);return h({type:"eos"}),i};cfe.exports=r6e});var ffe=T((kzt,dfe)=>{"use strict";var ufe=lC(),n6e=Qde(),i6e=rfe(),o6e=lfe(),Nn=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Nn.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Nn.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Nn.parse=(t,e={})=>o6e(t,e);Nn.stringify=(t,e={})=>ufe(typeof t=="string"?Nn.parse(t,e):t,e);Nn.compile=(t,e={})=>(typeof t=="string"&&(t=Nn.parse(t,e)),n6e(t,e));Nn.expand=(t,e={})=>{typeof t=="string"&&(t=Nn.parse(t,e));let r=i6e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Nn.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Nn.compile(t,e):Nn.expand(t,e);dfe.exports=Nn});var kS=T((Mzt,_fe)=>{"use strict";var s6e=Q("path"),Lo="\\\\/",pfe=`[^${Lo}]`,a6e=0,Ks="\\.",c6e="\\+",l6e="\\?",fC="\\/",u6e="(?=.)",hfe="[^/]",pG=`(?:${fC}|$)`,mfe=`(?:^|${fC})`,hG=`${Ks}{1,2}${pG}`,d6e=`(?!${Ks})`,f6e=`(?!${mfe}${hG})`,p6e=`(?!${Ks}{0,1}${pG})`,h6e=`(?!${hG})`,m6e=`[^.${fC}]`,g6e=`${hfe}*?`,gfe={DOT_LITERAL:Ks,PLUS_LITERAL:c6e,QMARK_LITERAL:l6e,SLASH_LITERAL:fC,ONE_CHAR:u6e,QMARK:hfe,END_ANCHOR:pG,DOTS_SLASH:hG,NO_DOT:d6e,NO_DOTS:f6e,NO_DOT_SLASH:p6e,NO_DOTS_SLASH:h6e,QMARK_NO_DOT:m6e,STAR:g6e,START_ANCHOR:mfe},_6e={...gfe,SLASH_LITERAL:`[${Lo}]`,QMARK:pfe,STAR:`${pfe}*?`,DOTS_SLASH:`${Ks}{1,2}(?:[${Lo}]|$)`,NO_DOT:`(?!${Ks})`,NO_DOTS:`(?!(?:^|[${Lo}])${Ks}{1,2}(?:[${Lo}]|$))`,NO_DOT_SLASH:`(?!${Ks}{0,1}(?:[${Lo}]|$))`,NO_DOTS_SLASH:`(?!${Ks}{1,2}(?:[${Lo}]|$))`,QMARK_NO_DOT:`[^.${Lo}]`,START_ANCHOR:`(?:^|[${Lo}])`,END_ANCHOR:`(?:[${Lo}]|$)`},y6e={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_fe.exports={DEFAULT_MAX_EXTGLOB_RECURSION:a6e,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y6e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:s6e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?_6e:gfe}}});var MS=T(dn=>{"use strict";var S6e=Q("path"),E6e=process.platform==="win32",{REGEX_BACKSLASH:v6e,REGEX_REMOVE_BACKSLASH:T6e,REGEX_SPECIAL_CHARS:b6e,REGEX_SPECIAL_CHARS_GLOBAL:A6e}=kS();dn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);dn.hasRegexChars=t=>b6e.test(t);dn.isRegexChar=t=>t.length===1&&dn.hasRegexChars(t);dn.escapeRegex=t=>t.replace(A6e,"\\$1");dn.toPosixSlashes=t=>t.replace(v6e,"/");dn.removeBackslashes=t=>t.replace(T6e,e=>e==="\\"?"":e);dn.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};dn.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:E6e===!0||S6e.sep==="\\";dn.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?dn.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};dn.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};dn.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var wfe=T((Lzt,Afe)=>{"use strict";var yfe=MS(),{CHAR_ASTERISK:mG,CHAR_AT:w6e,CHAR_BACKWARD_SLASH:DS,CHAR_COMMA:x6e,CHAR_DOT:gG,CHAR_EXCLAMATION_MARK:_G,CHAR_FORWARD_SLASH:bfe,CHAR_LEFT_CURLY_BRACE:yG,CHAR_LEFT_PARENTHESES:SG,CHAR_LEFT_SQUARE_BRACKET:R6e,CHAR_PLUS:I6e,CHAR_QUESTION_MARK:Sfe,CHAR_RIGHT_CURLY_BRACE:C6e,CHAR_RIGHT_PARENTHESES:Efe,CHAR_RIGHT_SQUARE_BRACKET:P6e}=kS(),vfe=t=>t===bfe||t===DS,Tfe=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},O6e=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,S=!1,E=!1,b=!1,A=!1,y=!1,x=!1,C=0,O,N,R={value:"",depth:0,isGlob:!1},$=()=>l>=n,_=()=>c.charCodeAt(l+1),ee=()=>(O=N,c.charCodeAt(++l));for(;l<n;){N=ee();let J;if(N===DS){b=R.backslashes=!0,N=ee(),N===yG&&(E=!0);continue}if(E===!0||N===yG){for(C++;$()!==!0&&(N=ee());){if(N===DS){b=R.backslashes=!0,ee();continue}if(N===yG){C++;continue}if(E!==!0&&N===gG&&(N=ee())===gG){if(f=R.isBrace=!0,h=R.isGlob=!0,x=!0,i===!0)continue;break}if(E!==!0&&N===x6e){if(f=R.isBrace=!0,h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===C6e&&(C--,C===0)){E=!1,f=R.isBrace=!0,x=!0;break}}if(i===!0)continue;break}if(N===bfe){if(o.push(l),s.push(R),R={value:"",depth:0,isGlob:!1},x===!0)continue;if(O===gG&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(N===I6e||N===w6e||N===mG||N===Sfe||N===_G)===!0&&_()===SG){if(h=R.isGlob=!0,m=R.isExtglob=!0,x=!0,N===_G&&l===u&&(y=!0),i===!0){for(;$()!==!0&&(N=ee());){if(N===DS){b=R.backslashes=!0,N=ee();continue}if(N===Efe){h=R.isGlob=!0,x=!0;break}}continue}break}if(N===mG){if(O===mG&&(S=R.isGlobstar=!0),h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===Sfe){if(h=R.isGlob=!0,x=!0,i===!0)continue;break}if(N===R6e){for(;$()!==!0&&(J=ee());){if(J===DS){b=R.backslashes=!0,ee();continue}if(J===P6e){p=R.isBracket=!0,h=R.isGlob=!0,x=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&N===_G&&l===u){A=R.negated=!0,u++;continue}if(r.noparen!==!0&&N===SG){if(h=R.isGlob=!0,i===!0){for(;$()!==!0&&(N=ee());){if(N===SG){b=R.backslashes=!0,N=ee();continue}if(N===Efe){x=!0;break}}continue}break}if(h===!0){if(x=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let k=c,g="",v="";u>0&&(g=c.slice(0,u),c=c.slice(u),d-=u),k&&h===!0&&d>0?(k=c.slice(0,d),v=c.slice(d)):h===!0?(k="",v=c):k=c,k&&k!==""&&k!=="/"&&k!==c&&vfe(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),r.unescape===!0&&(v&&(v=yfe.removeBackslashes(v)),k&&b===!0&&(k=yfe.removeBackslashes(k)));let I={prefix:g,input:t,start:u,base:k,glob:v,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:S,negated:A,negatedExtglob:y};if(r.tokens===!0&&(I.maxDepth=0,vfe(N)||s.push(R),I.tokens=s),r.parts===!0||r.tokens===!0){let J;for(let q=0;q<o.length;q++){let le=J?J+1:u,Oe=o[q],Ie=t.slice(le,Oe);r.tokens&&(q===0&&u!==0?(s[q].isPrefix=!0,s[q].value=g):s[q].value=Ie,Tfe(s[q]),I.maxDepth+=s[q].depth),(q!==0||Ie!=="")&&a.push(Ie),J=Oe}if(J&&J+1<t.length){let q=t.slice(J+1);a.push(q),r.tokens&&(s[s.length-1].value=q,Tfe(s[s.length-1]),I.maxDepth+=s[s.length-1].depth)}I.slashes=o,I.parts=a}return I};Afe.exports=O6e});var Pfe=T(($zt,Cfe)=>{"use strict";var LS=kS(),wr=MS(),{MAX_LENGTH:pC,POSIX_REGEX_SOURCE:N6e,REGEX_NON_SPECIAL_CHARS:k6e,REGEX_SPECIAL_CHARS_BACKREF:M6e,REPLACEMENTS:xfe}=LS,D6e=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>wr.escapeRegex(i)).join("..")}return r},Hh=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Rfe=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},L6e=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Ife=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(L6e(e))return e.replace(/\\(.)/g,"$1")},$6e=t=>{let e=t.map(Ife).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},EG=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},U6e=t=>{let e=0,r=[];for(;e<t.length;){let i=EG(t.slice(e),!1);if(!i||i.type!=="*")return;let o=Rfe(i.body).map(a=>a.trim());if(o.length!==1)return;let s=Ife(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?wr.escapeRegex(r[0]):`[${r.map(i=>wr.escapeRegex(i)).join("")}]`}*`},F6e=t=>{let e=0,r=t.trim(),n=EG(r);for(;n;)e++,r=n.body.trim(),n=EG(r);return e},B6e=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:LS.DEFAULT_MAX_EXTGLOB_RECURSION,n=Rfe(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||$6e(n)))return{risky:!0};for(let i of n){let o=U6e(i);if(o)return{risky:!0,safeOutput:o};if(F6e(i)>r)return{risky:!0}}return{risky:!1}},vG=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=xfe[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(pC,r.maxLength):pC,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wr.isWindows(e),l=LS.globChars(c),u=LS.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:S,NO_DOT_SLASH:E,NO_DOTS_SLASH:b,QMARK:A,QMARK_NO_DOT:y,STAR:x,START_ANCHOR:C}=l,O=H=>`(${a}(?:(?!${C}${H.dot?m:d}).)*?)`,N=r.dot?"":S,R=r.dot?A:y,$=r.bash===!0?O(r):x;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=wr.removePrefix(t,_),i=t.length;let ee=[],k=[],g=[],v=o,I,J=()=>_.index===i-1,q=_.peek=(H=1)=>t[_.index+H],le=_.advance=()=>t[++_.index]||"",Oe=()=>t.slice(_.index+1),Ie=(H="",oe=0)=>{_.consumed+=H,_.index+=oe},Ne=H=>{_.output+=H.output!=null?H.output:H.value,Ie(H.value)},Re=()=>{let H=1;for(;q()==="!"&&(q(2)!=="("||q(3)==="?");)le(),_.start++,H++;return H%2===0?!1:(_.negated=!0,_.start++,!0)},ke=H=>{_[H]++,g.push(H)},we=H=>{_[H]--,g.pop()},fe=H=>{if(v.type==="globstar"){let oe=_.braces>0&&(H.type==="comma"||H.type==="brace"),M=H.extglob===!0||ee.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!oe&&!M&&(_.output=_.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=$,_.output+=v.output)}if(ee.length&&H.type!=="paren"&&(ee[ee.length-1].inner+=H.value),(H.value||H.output)&&Ne(H),v&&v.type==="text"&&H.type==="text"){v.value+=H.value,v.output=(v.output||"")+H.value;return}H.prev=v,s.push(H),v=H},ye=(H,oe)=>{let M={...u[oe],conditions:1,inner:""};M.prev=v,M.parens=_.parens,M.output=_.output,M.startIndex=_.index,M.tokensIndex=s.length;let P=(r.capture?"(":"")+M.open;ke("parens"),fe({type:H,value:oe,output:_.output?"":h}),fe({type:"paren",extglob:!0,value:le(),output:P}),ee.push(M)},Be=H=>{let oe=t.slice(H.startIndex,_.index+1),M=t.slice(H.startIndex+2,_.index),P=B6e(M,r);if((H.type==="plus"||H.type==="star")&&P.risky){let V=P.safeOutput?(H.output?"":h)+(r.capture?`(${P.safeOutput})`:P.safeOutput):void 0,X=s[H.tokensIndex];X.type="text",X.value=oe,X.output=V||wr.escapeRegex(oe);for(let K=H.tokensIndex+1;K<s.length;K++)s[K].value="",s[K].output="",delete s[K].suffix;_.output=H.output+X.output,_.backtrack=!0,fe({type:"paren",extglob:!0,value:I,output:""}),we("parens");return}let D=H.close+(r.capture?")":""),B;if(H.type==="negate"){let V=$;if(H.inner&&H.inner.length>1&&H.inner.includes("/")&&(V=O(r)),(V!==$||J()||/^\)+$/.test(Oe()))&&(D=H.close=`)$))${V}`),H.inner.includes("*")&&(B=Oe())&&/^\.[^\\/.]+$/.test(B)){let X=vG(B,{...e,fastpaths:!1}).output;D=H.close=`)${X})${V})`}H.prev.type==="bos"&&(_.negatedExtglob=!0)}fe({type:"paren",extglob:!0,value:I,output:D}),we("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,oe=t.replace(M6e,(M,P,D,B,V,X)=>B==="\\"?(H=!0,M):B==="?"?P?P+B+(V?A.repeat(V.length):""):X===0?R+(V?A.repeat(V.length):""):A.repeat(D.length):B==="."?d.repeat(D.length):B==="*"?P?P+B+(V?$:""):$:P?M:`\\${M}`);return H===!0&&(r.unescape===!0?oe=oe.replace(/\\/g,""):oe=oe.replace(/\\+/g,M=>M.length%2===0?"\\\\":M?"\\":"")),oe===t&&r.contains===!0?(_.output=t,_):(_.output=wr.wrapOutput(oe,_,e),_)}for(;!J();){if(I=le(),I==="\0")continue;if(I==="\\"){let M=q();if(M==="/"&&r.bash!==!0||M==="."||M===";")continue;if(!M){I+="\\",fe({type:"text",value:I});continue}let P=/^\\+/.exec(Oe()),D=0;if(P&&P[0].length>2&&(D=P[0].length,_.index+=D,D%2!==0&&(I+="\\")),r.unescape===!0?I=le():I+=le(),_.brackets===0){fe({type:"text",value:I});continue}}if(_.brackets>0&&(I!=="]"||v.value==="["||v.value==="[^")){if(r.posix!==!1&&I===":"){let M=v.value.slice(1);if(M.includes("[")&&(v.posix=!0,M.includes(":"))){let P=v.value.lastIndexOf("["),D=v.value.slice(0,P),B=v.value.slice(P+2),V=N6e[B];if(V){v.value=D+V,_.backtrack=!0,le(),!o.output&&s.indexOf(v)===1&&(o.output=h);continue}}}(I==="["&&q()!==":"||I==="-"&&q()==="]")&&(I=`\\${I}`),I==="]"&&(v.value==="["||v.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&v.value==="["&&(I="^"),v.value+=I,Ne({value:I});continue}if(_.quotes===1&&I!=='"'){I=wr.escapeRegex(I),v.value+=I,Ne({value:I});continue}if(I==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&fe({type:"text",value:I});continue}if(I==="("){ke("parens"),fe({type:"paren",value:I});continue}if(I===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Hh("opening","("));let M=ee[ee.length-1];if(M&&_.parens===M.parens+1){Be(ee.pop());continue}fe({type:"paren",value:I,output:_.parens?")":"\\)"}),we("parens");continue}if(I==="["){if(r.nobracket===!0||!Oe().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Hh("closing","]"));I=`\\${I}`}else ke("brackets");fe({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){fe({type:"text",value:I,output:`\\${I}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Hh("opening","["));fe({type:"text",value:I,output:`\\${I}`});continue}we("brackets");let M=v.value.slice(1);if(v.posix!==!0&&M[0]==="^"&&!M.includes("/")&&(I=`/${I}`),v.value+=I,Ne({value:I}),r.literalBrackets===!1||wr.hasRegexChars(M))continue;let P=wr.escapeRegex(v.value);if(_.output=_.output.slice(0,-v.value.length),r.literalBrackets===!0){_.output+=P,v.value=P;continue}v.value=`(${a}${P}|${v.value})`,_.output+=v.value;continue}if(I==="{"&&r.nobrace!==!0){ke("braces");let M={type:"brace",value:I,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};k.push(M),fe(M);continue}if(I==="}"){let M=k[k.length-1];if(r.nobrace===!0||!M){fe({type:"text",value:I,output:I});continue}let P=")";if(M.dots===!0){let D=s.slice(),B=[];for(let V=D.length-1;V>=0&&(s.pop(),D[V].type!=="brace");V--)D[V].type!=="dots"&&B.unshift(D[V].value);P=D6e(B,r),_.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let D=_.output.slice(0,M.outputIndex),B=_.tokens.slice(M.tokensIndex);M.value=M.output="\\{",I=P="\\}",_.output=D;for(let V of B)_.output+=V.output||V.value}fe({type:"brace",value:I,output:P}),we("braces"),k.pop();continue}if(I==="|"){ee.length>0&&ee[ee.length-1].conditions++,fe({type:"text",value:I});continue}if(I===","){let M=I,P=k[k.length-1];P&&g[g.length-1]==="braces"&&(P.comma=!0,M="|"),fe({type:"comma",value:I,output:M});continue}if(I==="/"){if(v.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),v=o;continue}fe({type:"slash",value:I,output:p});continue}if(I==="."){if(_.braces>0&&v.type==="dot"){v.value==="."&&(v.output=d);let M=k[k.length-1];v.type="dots",v.output+=I,v.value+=I,M.dots=!0;continue}if(_.braces+_.parens===0&&v.type!=="bos"&&v.type!=="slash"){fe({type:"text",value:I,output:d});continue}fe({type:"dot",value:I,output:d});continue}if(I==="?"){if(!(v&&v.value==="(")&&r.noextglob!==!0&&q()==="("&&q(2)!=="?"){ye("qmark",I);continue}if(v&&v.type==="paren"){let P=q(),D=I;if(P==="<"&&!wr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(v.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(Oe()))&&(D=`\\${I}`),fe({type:"text",value:I,output:D});continue}if(r.dot!==!0&&(v.type==="slash"||v.type==="bos")){fe({type:"qmark",value:I,output:y});continue}fe({type:"qmark",value:I,output:A});continue}if(I==="!"){if(r.noextglob!==!0&&q()==="("&&(q(2)!=="?"||!/[!=<:]/.test(q(3)))){ye("negate",I);continue}if(r.nonegate!==!0&&_.index===0){Re();continue}}if(I==="+"){if(r.noextglob!==!0&&q()==="("&&q(2)!=="?"){ye("plus",I);continue}if(v&&v.value==="("||r.regex===!1){fe({type:"plus",value:I,output:f});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||_.parens>0){fe({type:"plus",value:I});continue}fe({type:"plus",value:f});continue}if(I==="@"){if(r.noextglob!==!0&&q()==="("&&q(2)!=="?"){fe({type:"at",extglob:!0,value:I,output:""});continue}fe({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let M=k6e.exec(Oe());M&&(I+=M[0],_.index+=M[0].length),fe({type:"text",value:I});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=I,v.output=$,_.backtrack=!0,_.globstar=!0,Ie(I);continue}let H=Oe();if(r.noextglob!==!0&&/^\([^?]/.test(H)){ye("star",I);continue}if(v.type==="star"){if(r.noglobstar===!0){Ie(I);continue}let M=v.prev,P=M.prev,D=M.type==="slash"||M.type==="bos",B=P&&(P.type==="star"||P.type==="globstar");if(r.bash===!0&&(!D||H[0]&&H[0]!=="/")){fe({type:"star",value:I,output:""});continue}let V=_.braces>0&&(M.type==="comma"||M.type==="brace"),X=ee.length&&(M.type==="pipe"||M.type==="paren");if(!D&&M.type!=="paren"&&!V&&!X){fe({type:"star",value:I,output:""});continue}for(;H.slice(0,3)==="/**";){let K=t[_.index+4];if(K&&K!=="/")break;H=H.slice(3),Ie("/**",3)}if(M.type==="bos"&&J()){v.type="globstar",v.value+=I,v.output=O(r),_.output=v.output,_.globstar=!0,Ie(I);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!B&&J()){_.output=_.output.slice(0,-(M.output+v.output).length),M.output=`(?:${M.output}`,v.type="globstar",v.output=O(r)+(r.strictSlashes?")":"|$)"),v.value+=I,_.globstar=!0,_.output+=M.output+v.output,Ie(I);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&H[0]==="/"){let K=H[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(M.output+v.output).length),M.output=`(?:${M.output}`,v.type="globstar",v.output=`${O(r)}${p}|${p}${K})`,v.value+=I,_.output+=M.output+v.output,_.globstar=!0,Ie(I+le()),fe({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&H[0]==="/"){v.type="globstar",v.value+=I,v.output=`(?:^|${p}|${O(r)}${p})`,_.output=v.output,_.globstar=!0,Ie(I+le()),fe({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-v.output.length),v.type="globstar",v.output=O(r),v.value+=I,_.output+=v.output,_.globstar=!0,Ie(I);continue}let oe={type:"star",value:I,output:$};if(r.bash===!0){oe.output=".*?",(v.type==="bos"||v.type==="slash")&&(oe.output=N+oe.output),fe(oe);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&r.regex===!0){oe.output=I,fe(oe);continue}(_.index===_.start||v.type==="slash"||v.type==="dot")&&(v.type==="dot"?(_.output+=E,v.output+=E):r.dot===!0?(_.output+=b,v.output+=b):(_.output+=N,v.output+=N),q()!=="*"&&(_.output+=h,v.output+=h)),fe(oe)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing","]"));_.output=wr.escapeLast(_.output,"["),we("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing",")"));_.output=wr.escapeLast(_.output,"("),we("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hh("closing","}"));_.output=wr.escapeLast(_.output,"{"),we("braces")}if(r.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket")&&fe({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let H of _.tokens)_.output+=H.output!=null?H.output:H.value,H.suffix&&(_.output+=H.suffix)}return _};vG.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(pC,r.maxLength):pC,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=xfe[t]||t;let o=wr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=LS.globChars(o),m=r.dot?d:u,S=r.dot?f:u,E=r.capture?"":"?:",b={negated:!1,prefix:""},A=r.bash===!0?".*?":p;r.capture&&(A=`(${A})`);let y=N=>N.noglobstar===!0?A:`(${E}(?:(?!${h}${N.dot?l:s}).)*?)`,x=N=>{switch(N){case"*":return`${m}${c}${A}`;case".*":return`${s}${c}${A}`;case"*.*":return`${m}${A}${s}${c}${A}`;case"*/*":return`${m}${A}${a}${c}${S}${A}`;case"**":return m+y(r);case"**/*":return`(?:${m}${y(r)}${a})?${S}${c}${A}`;case"**/*.*":return`(?:${m}${y(r)}${a})?${S}${A}${s}${c}${A}`;case"**/.*":return`(?:${m}${y(r)}${a})?${s}${c}${A}`;default:{let R=/^(.*?)\.(\w+)$/.exec(N);if(!R)return;let $=x(R[1]);return $?$+s+R[2]:void 0}}},C=wr.removePrefix(t,b),O=x(C);return O&&r.strictSlashes!==!0&&(O+=`${a}?`),O};Cfe.exports=vG});var Nfe=T((Uzt,Ofe)=>{"use strict";var j6e=Q("path"),z6e=wfe(),TG=Pfe(),bG=MS(),G6e=kS(),q6e=t=>t&&typeof t=="object"&&!Array.isArray(t),kt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>kt(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=q6e(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=bG.isWindows(e),s=n?kt.compileRe(t,e):kt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=kt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=kt.test(u,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};kt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?bG.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=kt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};kt.matchBase=(t,e,r,n=bG.isWindows(r))=>(e instanceof RegExp?e:kt.makeRe(e,r)).test(j6e.basename(t));kt.isMatch=(t,e,r)=>kt(e,r)(t);kt.parse=(t,e)=>Array.isArray(t)?t.map(r=>kt.parse(r,e)):TG(t,{...e,fastpaths:!1});kt.scan=(t,e)=>z6e(t,e);kt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=kt.toRegex(a,e);return n===!0&&(c.state=t),c};kt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=TG.fastpaths(t,e)),i.output||(i=TG(t,e)),kt.compileRe(i,e,r,n)};kt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};kt.constants=G6e;Ofe.exports=kt});var Mfe=T((Fzt,kfe)=>{"use strict";kfe.exports=Nfe()});var wG=T((Bzt,Ffe)=>{"use strict";var Lfe=Q("util"),$fe=ffe(),$o=Mfe(),AG=MS(),Dfe=t=>t===""||t==="./",Ufe=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},mt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=u=>{o.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=$o(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&s++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(s===e.length?[...o]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};mt.match=mt;mt.matcher=(t,e)=>$o(t,e);mt.isMatch=(t,e,r)=>$o(e,r)(t);mt.any=mt.isMatch;mt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(mt(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};mt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>mt.contains(t,n,r));if(typeof e=="string"){if(Dfe(t)||Dfe(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return mt.isMatch(t,e,{...r,contains:!0})};mt.matchKeys=(t,e,r)=>{if(!AG.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=mt(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};mt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(n.some(s=>o(s)))return!0}return!1};mt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};mt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);return[].concat(e).every(n=>$o(n,r)(t))};mt.capture=(t,e,r)=>{let n=AG.isWindows(r),o=$o.makeRe(String(t),{...r,capture:!0}).exec(n?AG.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};mt.makeRe=(...t)=>$o.makeRe(...t);mt.scan=(...t)=>$o.scan(...t);mt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of $fe(String(n),e))r.push($o.parse(i,e));return r};mt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!Ufe(t)?[t]:$fe(t,e)};mt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return mt.braces(t,{...e,expand:!0})};mt.hasBraces=Ufe;Ffe.exports=mt});var Kfe=T(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.isAbsolute=Ce.partitionAbsoluteAndRelative=Ce.removeDuplicateSlashes=Ce.matchAny=Ce.convertPatternsToRe=Ce.makeRe=Ce.getPatternParts=Ce.expandBraceExpansion=Ce.expandPatternsWithBraceExpansion=Ce.isAffectDepthOfReadingPattern=Ce.endsWithSlashGlobStar=Ce.hasGlobStar=Ce.getBaseDirectory=Ce.isPatternRelatedToParentDirectory=Ce.getPatternsOutsideCurrentDirectory=Ce.getPatternsInsideCurrentDirectory=Ce.getPositivePatterns=Ce.getNegativePatterns=Ce.isPositivePattern=Ce.isNegativePattern=Ce.convertToNegativePattern=Ce.convertToPositivePattern=Ce.isDynamicPattern=Ce.isStaticPattern=void 0;var Bfe=Q("path"),V6e=Pde(),xG=wG(),jfe="**",H6e="\\",W6e=/[*?]|^!/,Y6e=/\[[^[]*]/,K6e=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Z6e=/[!*+?@]\([^(]*\)/,J6e=/,|\.\./,X6e=/(?!^)\/{2,}/g;function zfe(t,e={}){return!Gfe(t,e)}Ce.isStaticPattern=zfe;function Gfe(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(H6e)||W6e.test(t)||Y6e.test(t)||K6e.test(t)||e.extglob!==!1&&Z6e.test(t)||e.braceExpansion!==!1&&Q6e(t))}Ce.isDynamicPattern=Gfe;function Q6e(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return J6e.test(n)}function eWe(t){return hC(t)?t.slice(1):t}Ce.convertToPositivePattern=eWe;function tWe(t){return"!"+t}Ce.convertToNegativePattern=tWe;function hC(t){return t.startsWith("!")&&t[1]!=="("}Ce.isNegativePattern=hC;function qfe(t){return!hC(t)}Ce.isPositivePattern=qfe;function rWe(t){return t.filter(hC)}Ce.getNegativePatterns=rWe;function nWe(t){return t.filter(qfe)}Ce.getPositivePatterns=nWe;function iWe(t){return t.filter(e=>!RG(e))}Ce.getPatternsInsideCurrentDirectory=iWe;function oWe(t){return t.filter(RG)}Ce.getPatternsOutsideCurrentDirectory=oWe;function RG(t){return t.startsWith("..")||t.startsWith("./..")}Ce.isPatternRelatedToParentDirectory=RG;function sWe(t){return V6e(t,{flipBackslashes:!1})}Ce.getBaseDirectory=sWe;function aWe(t){return t.includes(jfe)}Ce.hasGlobStar=aWe;function Vfe(t){return t.endsWith("/"+jfe)}Ce.endsWithSlashGlobStar=Vfe;function cWe(t){let e=Bfe.basename(t);return Vfe(t)||zfe(e)}Ce.isAffectDepthOfReadingPattern=cWe;function lWe(t){return t.reduce((e,r)=>e.concat(Hfe(r)),[])}Ce.expandPatternsWithBraceExpansion=lWe;function Hfe(t){let e=xG.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}Ce.expandBraceExpansion=Hfe;function uWe(t,e){let{parts:r}=xG.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Ce.getPatternParts=uWe;function Wfe(t,e){return xG.makeRe(t,e)}Ce.makeRe=Wfe;function dWe(t,e){return t.map(r=>Wfe(r,e))}Ce.convertPatternsToRe=dWe;function fWe(t,e){return e.some(r=>r.test(t))}Ce.matchAny=fWe;function pWe(t){return t.replace(X6e,"/")}Ce.removeDuplicateSlashes=pWe;function hWe(t){let e=[],r=[];for(let n of t)Yfe(n)?e.push(n):r.push(n);return[e,r]}Ce.partitionAbsoluteAndRelative=hWe;function Yfe(t){return Bfe.isAbsolute(t)}Ce.isAbsolute=Yfe});var Qfe=T((zzt,Xfe)=>{"use strict";var mWe=Q("stream"),Zfe=mWe.PassThrough,gWe=Array.prototype.slice;Xfe.exports=_We;function _We(){let t=[],e=gWe.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,o=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=Zfe(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(Jfe(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),o&&h.removeListener("error",S),f()}function S(E){s.emit("error",E)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),o&&h.on("error",S),h.pipe(s,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,s.emit("queueDrain"),i&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),s}function Jfe(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Jfe(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Zfe(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var tpe=T(mC=>{"use strict";Object.defineProperty(mC,"__esModule",{value:!0});mC.merge=void 0;var yWe=Qfe();function SWe(t){let e=yWe(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>epe(t)),e.once("end",()=>epe(t)),e}mC.merge=SWe;function epe(t){t.forEach(e=>e.emit("close"))}});var rpe=T(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.isEmpty=Wh.isString=void 0;function EWe(t){return typeof t=="string"}Wh.isString=EWe;function vWe(t){return t===""}Wh.isEmpty=vWe});var Zs=T(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.string=xr.stream=xr.pattern=xr.path=xr.fs=xr.errno=xr.array=void 0;var TWe=_de();xr.array=TWe;var bWe=yde();xr.errno=bWe;var AWe=Sde();xr.fs=AWe;var wWe=bde();xr.path=wWe;var xWe=Kfe();xr.pattern=xWe;var RWe=tpe();xr.stream=RWe;var IWe=rpe();xr.string=IWe});var spe=T(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.convertPatternGroupToTask=Rr.convertPatternGroupsToTasks=Rr.groupPatternsByBaseDirectory=Rr.getNegativePatternsAsPositive=Rr.getPositivePatterns=Rr.convertPatternsToTasks=Rr.generate=void 0;var ji=Zs();function CWe(t,e){let r=npe(t,e),n=npe(e.ignore,e),i=ipe(r),o=ope(r,n),s=i.filter(u=>ji.pattern.isStaticPattern(u,e)),a=i.filter(u=>ji.pattern.isDynamicPattern(u,e)),c=IG(s,o,!1),l=IG(a,o,!0);return c.concat(l)}Rr.generate=CWe;function npe(t,e){let r=t;return e.braceExpansion&&(r=ji.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>ji.pattern.removeDuplicateSlashes(n))}function IG(t,e,r){let n=[],i=ji.pattern.getPatternsOutsideCurrentDirectory(t),o=ji.pattern.getPatternsInsideCurrentDirectory(t),s=CG(i),a=CG(o);return n.push(...PG(s,e,r)),"."in a?n.push(OG(".",o,e,r)):n.push(...PG(a,e,r)),n}Rr.convertPatternsToTasks=IG;function ipe(t){return ji.pattern.getPositivePatterns(t)}Rr.getPositivePatterns=ipe;function ope(t,e){return ji.pattern.getNegativePatterns(t).concat(e).map(ji.pattern.convertToPositivePattern)}Rr.getNegativePatternsAsPositive=ope;function CG(t){let e={};return t.reduce((r,n)=>{let i=ji.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Rr.groupPatternsByBaseDirectory=CG;function PG(t,e,r){return Object.keys(t).map(n=>OG(n,t[n],e,r))}Rr.convertPatternGroupsToTasks=PG;function OG(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(ji.pattern.convertToNegativePattern))}}Rr.convertPatternGroupToTask=OG});var cpe=T(gC=>{"use strict";Object.defineProperty(gC,"__esModule",{value:!0});gC.read=void 0;function PWe(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){ape(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){NG(r,i);return}e.fs.stat(t,(o,s)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){ape(r,o);return}NG(r,i);return}e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),NG(r,s)})})}gC.read=PWe;function ape(t,e){t(e)}function NG(t,e){t(null,e)}});var lpe=T(_C=>{"use strict";Object.defineProperty(_C,"__esModule",{value:!0});_C.read=void 0;function OWe(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}_C.read=OWe});var upe=T(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.createFileSystemAdapter=Nc.FILE_SYSTEM_ADAPTER=void 0;var yC=Q("fs");Nc.FILE_SYSTEM_ADAPTER={lstat:yC.lstat,stat:yC.stat,lstatSync:yC.lstatSync,statSync:yC.statSync};function NWe(t){return t===void 0?Nc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Nc.FILE_SYSTEM_ADAPTER),t)}Nc.createFileSystemAdapter=NWe});var dpe=T(MG=>{"use strict";Object.defineProperty(MG,"__esModule",{value:!0});var kWe=upe(),kG=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=kWe.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};MG.default=kG});var Bu=T(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.statSync=kc.stat=kc.Settings=void 0;var fpe=cpe(),MWe=lpe(),DG=dpe();kc.Settings=DG.default;function DWe(t,e,r){if(typeof e=="function"){fpe.read(t,LG(),e);return}fpe.read(t,LG(e),r)}kc.stat=DWe;function LWe(t,e){let r=LG(e);return MWe.read(t,r)}kc.statSync=LWe;function LG(t={}){return t instanceof DG.default?t:new DG.default(t)}});var mpe=T((Xzt,hpe)=>{"use strict";var ppe;hpe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(ppe||(ppe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var _pe=T((Qzt,gpe)=>{"use strict";gpe.exports=UWe;var $We=mpe();function UWe(t,e){let r,n,i,o=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function s(c){function l(){e&&e(c,r),e=null}o?$We(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&s(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):s(null),o=!1}});var $G=T(EC=>{"use strict";Object.defineProperty(EC,"__esModule",{value:!0});EC.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var SC=process.versions.node.split(".");if(SC[0]===void 0||SC[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var ype=Number.parseInt(SC[0],10),FWe=Number.parseInt(SC[1],10),Spe=10,BWe=10,jWe=ype>Spe,zWe=ype===Spe&&FWe>=BWe;EC.IS_SUPPORT_READDIR_WITH_FILE_TYPES=jWe||zWe});var Epe=T(vC=>{"use strict";Object.defineProperty(vC,"__esModule",{value:!0});vC.createDirentFromStats=void 0;var UG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function GWe(t,e){return new UG(t,e)}vC.createDirentFromStats=GWe});var FG=T(TC=>{"use strict";Object.defineProperty(TC,"__esModule",{value:!0});TC.fs=void 0;var qWe=Epe();TC.fs=qWe});var BG=T(bC=>{"use strict";Object.defineProperty(bC,"__esModule",{value:!0});bC.joinPathSegments=void 0;function VWe(t,e,r){return t.endsWith(r)?t+e:t+r+e}bC.joinPathSegments=VWe});var xpe=T(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.readdir=Mc.readdirWithFileTypes=Mc.read=void 0;var HWe=Bu(),vpe=_pe(),WWe=$G(),Tpe=FG(),bpe=BG();function YWe(t,e,r){if(!e.stats&&WWe.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Ape(t,e,r);return}wpe(t,e,r)}Mc.read=YWe;function Ape(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){AC(r,n);return}let o=i.map(a=>({dirent:a,name:a.name,path:bpe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){jG(r,o);return}let s=o.map(a=>KWe(a,e));vpe(s,(a,c)=>{if(a!==null){AC(r,a);return}jG(r,c)})})}Mc.readdirWithFileTypes=Ape;function KWe(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Tpe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function wpe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){AC(r,n);return}let o=i.map(s=>{let a=bpe.joinPathSegments(t,s,e.pathSegmentSeparator);return c=>{HWe.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:s,path:a,dirent:Tpe.fs.createDirentFromStats(s,u)};e.stats&&(d.stats=u),c(null,d)})}});vpe(o,(s,a)=>{if(s!==null){AC(r,s);return}jG(r,a)})})}Mc.readdir=wpe;function AC(t,e){t(e)}function jG(t,e){t(null,e)}});var Ope=T(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.readdir=Dc.readdirWithFileTypes=Dc.read=void 0;var ZWe=Bu(),JWe=$G(),Rpe=FG(),Ipe=BG();function XWe(t,e){return!e.stats&&JWe.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Cpe(t,e):Ppe(t,e)}Dc.read=XWe;function Cpe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:Ipe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let o=e.fs.statSync(i.path);i.dirent=Rpe.fs.createDirentFromStats(i.name,o)}catch(o){if(e.throwErrorOnBrokenSymbolicLink)throw o}return i})}Dc.readdirWithFileTypes=Cpe;function Ppe(t,e){return e.fs.readdirSync(t).map(n=>{let i=Ipe.joinPathSegments(t,n,e.pathSegmentSeparator),o=ZWe.statSync(i,e.fsStatSettings),s={name:n,path:i,dirent:Rpe.fs.createDirentFromStats(n,o)};return e.stats&&(s.stats=o),s})}Dc.readdir=Ppe});var Npe=T(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.createFileSystemAdapter=Lc.FILE_SYSTEM_ADAPTER=void 0;var Yh=Q("fs");Lc.FILE_SYSTEM_ADAPTER={lstat:Yh.lstat,stat:Yh.stat,lstatSync:Yh.lstatSync,statSync:Yh.statSync,readdir:Yh.readdir,readdirSync:Yh.readdirSync};function QWe(t){return t===void 0?Lc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Lc.FILE_SYSTEM_ADAPTER),t)}Lc.createFileSystemAdapter=QWe});var kpe=T(GG=>{"use strict";Object.defineProperty(GG,"__esModule",{value:!0});var e3e=Q("path"),t3e=Bu(),r3e=Npe(),zG=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=r3e.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,e3e.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new t3e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};GG.default=zG});var wC=T($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Settings=$c.scandirSync=$c.scandir=void 0;var Mpe=xpe(),n3e=Ope(),qG=kpe();$c.Settings=qG.default;function i3e(t,e,r){if(typeof e=="function"){Mpe.read(t,VG(),e);return}Mpe.read(t,VG(e),r)}$c.scandir=i3e;function o3e(t,e){let r=VG(e);return n3e.read(t,r)}$c.scandirSync=o3e;function VG(t={}){return t instanceof qG.default?t:new qG.default(t)}});var Lpe=T((lGt,Dpe)=>{"use strict";function s3e(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}Dpe.exports=s3e});var Upe=T((uGt,HG)=>{"use strict";var a3e=Lpe();function $pe(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=a3e(c3e),i=null,o=null,s=0,a=null,c={push:m,drain:fn,saturated:fn,pause:u,paused:!1,get concurrency(){return r},set concurrency(C){if(!(C>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=C,!c.paused)for(;i&&s<r;)s++,E()},running:l,resume:p,idle:h,length:d,getQueue:f,unshift:S,empty:fn,kill:b,killAndDrain:A,error:x,abort:y};return c;function l(){return s}function u(){c.paused=!0}function d(){for(var C=i,O=0;C;)C=C.next,O++;return O}function f(){for(var C=i,O=[];C;)O.push(C.value),C=C.next;return O}function p(){if(c.paused){if(c.paused=!1,i===null){s++,E();return}for(;i&&s<r;)s++,E()}}function h(){return s===0&&c.length()===0}function m(C,O){var N=n.get();N.context=t,N.release=E,N.value=C,N.callback=O||fn,N.errorHandler=a,s>=r||c.paused?o?(o.next=N,o=N):(i=N,o=N,c.saturated()):(s++,e.call(t,N.value,N.worked))}function S(C,O){var N=n.get();N.context=t,N.release=E,N.value=C,N.callback=O||fn,N.errorHandler=a,s>=r||c.paused?i?(N.next=i,i=N):(i=N,o=N,c.saturated()):(s++,e.call(t,N.value,N.worked))}function E(C){C&&n.release(C);var O=i;O&&s<=r?c.paused?s--:(o===i&&(o=null),i=O.next,O.next=null,e.call(t,O.value,O.worked),o===null&&c.empty()):--s===0&&c.drain()}function b(){i=null,o=null,c.drain=fn}function A(){i=null,o=null,c.drain(),c.drain=fn}function y(){var C=i;for(i=null,o=null;C;){var O=C.next,N=C.callback,R=C.errorHandler,$=C.value,_=C.context;C.value=null,C.callback=fn,C.errorHandler=null,R&&R(new Error("abort"),$),N.call(_,new Error("abort")),C.release(C),C=O}c.drain=fn}function x(C){a=C}}function fn(){}function c3e(){this.value=null,this.callback=fn,this.next=null,this.release=fn,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=fn,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function l3e(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,d){e.call(this,u).then(function(f){d(null,f)},d)}var i=$pe(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=c,i.drained=l,i;function a(u){var d=new Promise(function(f,p){o(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(fn),d}function c(u){var d=new Promise(function(f,p){s(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(fn),d}function l(){var u=new Promise(function(d){process.nextTick(function(){if(i.idle())d();else{var f=i.drain;i.drain=function(){typeof f=="function"&&f(),d(),i.drain=f}}})});return u}}HG.exports=$pe;HG.exports.promise=l3e});var xC=T(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.joinPathSegments=Uo.replacePathSegmentSeparator=Uo.isAppliedFilter=Uo.isFatalError=void 0;function u3e(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Uo.isFatalError=u3e;function d3e(t,e){return t===null||t(e)}Uo.isAppliedFilter=d3e;function f3e(t,e){return t.split(/[/\\]/).join(e)}Uo.replacePathSegmentSeparator=f3e;function p3e(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Uo.joinPathSegments=p3e});var KG=T(YG=>{"use strict";Object.defineProperty(YG,"__esModule",{value:!0});var h3e=xC(),WG=class{constructor(e,r){this._root=e,this._settings=r,this._root=h3e.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};YG.default=WG});var XG=T(JG=>{"use strict";Object.defineProperty(JG,"__esModule",{value:!0});var m3e=Q("events"),g3e=wC(),_3e=Upe(),RC=xC(),y3e=KG(),ZG=class extends y3e.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=g3e.scandir,this._emitter=new m3e.EventEmitter,this._queue=_3e(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let o of i)this._handleEntry(o,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!RC.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=RC.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),RC.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&RC.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};JG.default=ZG});var Fpe=T(e4=>{"use strict";Object.defineProperty(e4,"__esModule",{value:!0});var S3e=XG(),QG=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new S3e.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{E3e(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{v3e(e,this._storage)}),this._reader.read()}};e4.default=QG;function E3e(t,e){t(e)}function v3e(t,e){t(null,e)}});var Bpe=T(r4=>{"use strict";Object.defineProperty(r4,"__esModule",{value:!0});var T3e=Q("stream"),b3e=XG(),t4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new b3e.default(this._root,this._settings),this._stream=new T3e.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};r4.default=t4});var jpe=T(i4=>{"use strict";Object.defineProperty(i4,"__esModule",{value:!0});var A3e=wC(),IC=xC(),w3e=KG(),n4=class extends w3e.default{constructor(){super(...arguments),this._scandir=A3e.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(IC.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=IC.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),IC.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&IC.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};i4.default=n4});var zpe=T(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});var x3e=jpe(),o4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new x3e.default(this._root,this._settings)}read(){return this._reader.read()}};s4.default=o4});var Gpe=T(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});var R3e=Q("path"),I3e=wC(),a4=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,R3e.sep),this.fsScandirSettings=new I3e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};c4.default=a4});var PC=T(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Settings=Fo.walkStream=Fo.walkSync=Fo.walk=void 0;var qpe=Fpe(),C3e=Bpe(),P3e=zpe(),l4=Gpe();Fo.Settings=l4.default;function O3e(t,e,r){if(typeof e=="function"){new qpe.default(t,CC()).read(e);return}new qpe.default(t,CC(e)).read(r)}Fo.walk=O3e;function N3e(t,e){let r=CC(e);return new P3e.default(t,r).read()}Fo.walkSync=N3e;function k3e(t,e){let r=CC(e);return new C3e.default(t,r).read()}Fo.walkStream=k3e;function CC(t={}){return t instanceof l4.default?t:new l4.default(t)}});var OC=T(d4=>{"use strict";Object.defineProperty(d4,"__esModule",{value:!0});var M3e=Q("path"),D3e=Bu(),Vpe=Zs(),u4=class{constructor(e){this._settings=e,this._fsStatSettings=new D3e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return M3e.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Vpe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Vpe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};d4.default=u4});var h4=T(p4=>{"use strict";Object.defineProperty(p4,"__esModule",{value:!0});var L3e=Q("stream"),$3e=Bu(),U3e=PC(),F3e=OC(),f4=class extends F3e.default{constructor(){super(...arguments),this._walkStream=U3e.walkStream,this._stat=$3e.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new L3e.PassThrough({objectMode:!0});i._write=(o,s,a)=>this._getEntry(n[o],e[o],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),o===n.length-1&&i.end(),a()}).catch(a);for(let o=0;o<n.length;o++)i.write(o);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,o)=>i===null?r(o):n(i))})}};p4.default=f4});var Hpe=T(g4=>{"use strict";Object.defineProperty(g4,"__esModule",{value:!0});var B3e=PC(),j3e=OC(),z3e=h4(),m4=class extends j3e.default{constructor(){super(...arguments),this._walkAsync=B3e.walk,this._readerStream=new z3e.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(o,s)=>{o===null?n(s):i(o)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((o,s)=>{i.once("error",s),i.on("data",a=>n.push(a)),i.once("end",()=>o(n))})}};g4.default=m4});var Wpe=T(y4=>{"use strict";Object.defineProperty(y4,"__esModule",{value:!0});var $S=Zs(),_4=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return $S.pattern.getPatternParts(e,this._micromatchOptions).map(n=>$S.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:$S.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return $S.array.splitWhen(e,r=>r.dynamic&&$S.pattern.hasGlobStar(r.pattern))}};y4.default=_4});var Ype=T(E4=>{"use strict";Object.defineProperty(E4,"__esModule",{value:!0});var G3e=Wpe(),S4=class extends G3e.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(o=>!o.complete||o.segments.length>n);for(let o of i){let s=o.sections[0];if(!o.complete&&n>s.length||r.every((c,l)=>{let u=o.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};E4.default=S4});var Kpe=T(T4=>{"use strict";Object.defineProperty(T4,"__esModule",{value:!0});var NC=Zs(),q3e=Ype(),v4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),o=this._getNegativePatternsRe(n);return s=>this._filter(e,s,i,o)}_getMatcher(e){return new q3e.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(NC.pattern.isAffectDepthOfReadingPattern);return NC.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let o=NC.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(o,n)?!1:this._isSkippedByNegativePatterns(o,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!NC.pattern.matchAny(e,r)}};T4.default=v4});var Zpe=T(A4=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});var Uc=Zs(),b4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Uc.pattern.partitionAbsoluteAndRelative(r),o={positive:{all:Uc.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Uc.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Uc.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,o)}_filter(e,r){let n=Uc.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Uc.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Uc.pattern.matchAny(e,r);return!i&&n?Uc.pattern.matchAny(e+"/",r):i}};A4.default=b4});var Jpe=T(x4=>{"use strict";Object.defineProperty(x4,"__esModule",{value:!0});var V3e=Zs(),w4=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return V3e.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};x4.default=w4});var Qpe=T(I4=>{"use strict";Object.defineProperty(I4,"__esModule",{value:!0});var Xpe=Zs(),R4=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Xpe.path.makeAbsolute(this._settings.cwd,r),r=Xpe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};I4.default=R4});var kC=T(P4=>{"use strict";Object.defineProperty(P4,"__esModule",{value:!0});var H3e=Q("path"),W3e=Kpe(),Y3e=Zpe(),K3e=Jpe(),Z3e=Qpe(),C4=class{constructor(e){this._settings=e,this.errorFilter=new K3e.default(this._settings),this.entryFilter=new Y3e.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new W3e.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Z3e.default(this._settings)}_getRootDirectory(e){return H3e.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};P4.default=C4});var ehe=T(N4=>{"use strict";Object.defineProperty(N4,"__esModule",{value:!0});var J3e=Hpe(),X3e=kC(),O4=class extends X3e.default{constructor(){super(...arguments),this._reader=new J3e.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(o=>n.transform(o))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};N4.default=O4});var the=T(M4=>{"use strict";Object.defineProperty(M4,"__esModule",{value:!0});var Q3e=Q("stream"),eYe=h4(),tYe=kC(),k4=class extends tYe.default{constructor(){super(...arguments),this._reader=new eYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),o=new Q3e.Readable({objectMode:!0,read:()=>{}});return i.once("error",s=>o.emit("error",s)).on("data",s=>o.emit("data",n.transform(s))).once("end",()=>o.emit("end")),o.once("close",()=>i.destroy()),o}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};M4.default=k4});var rhe=T(L4=>{"use strict";Object.defineProperty(L4,"__esModule",{value:!0});var rYe=Bu(),nYe=PC(),iYe=OC(),D4=class extends iYe.default{constructor(){super(...arguments),this._walkSync=nYe.walkSync,this._statSync=rYe.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let o=this._getFullEntryPath(i),s=this._getEntry(o,i,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};L4.default=D4});var nhe=T(U4=>{"use strict";Object.defineProperty(U4,"__esModule",{value:!0});var oYe=rhe(),sYe=kC(),$4=class extends sYe.default{constructor(){super(...arguments),this._reader=new oYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};U4.default=$4});var ihe=T(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var Kh=Q("fs"),aYe=Q("os"),cYe=Math.max(aYe.cpus().length,1);Zh.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:Kh.lstat,lstatSync:Kh.lstatSync,stat:Kh.stat,statSync:Kh.statSync,readdir:Kh.readdir,readdirSync:Kh.readdirSync};var F4=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,cYe),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},Zh.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};Zh.default=F4});var US=T((DGt,she)=>{"use strict";var ohe=spe(),lYe=ehe(),uYe=the(),dYe=nhe(),B4=ihe(),oi=Zs();async function j4(t,e){zi(t);let r=z4(t,lYe.default,e),n=await Promise.all(r);return oi.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){zi(l);let d=z4(l,dYe.default,u);return oi.array.flatten(d)}t.sync=e;function r(l,u){zi(l);let d=z4(l,uYe.default,u);return oi.stream.merge(d)}t.stream=r;function n(l,u){zi(l);let d=[].concat(l),f=new B4.default(u);return ohe.generate(d,f)}t.generateTasks=n;function i(l,u){zi(l);let d=new B4.default(u);return oi.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function o(l){return zi(l),oi.path.escape(l)}t.escapePath=o;function s(l){return zi(l),oi.path.convertPathToPattern(l)}t.convertPathToPattern=s;let a;(function(l){function u(f){return zi(f),oi.path.escapePosixPath(f)}l.escapePath=u;function d(f){return zi(f),oi.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return zi(f),oi.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return zi(f),oi.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(j4||(j4={}));function z4(t,e,r){let n=[].concat(t),i=new B4.default(r),o=ohe.generate(n,i),s=new e(i);return o.map(s.read,s)}function zi(t){if(![].concat(t).every(n=>oi.string.isString(n)&&!oi.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}she.exports=j4});var J4=T((GGt,LC)=>{"use strict";function dhe(t){return Array.isArray(t)?t:[t]}var hYe=void 0,H4="",lhe=" ",V4="\\",mYe=/^\s+$/,gYe=/(?:[^\\]|^)\\$/,_Ye=/^\\!/,yYe=/^\\#/,SYe=/\r?\n/g,EYe=/^\.{0,2}\/|^\.{1,2}$/,vYe=/\/$/,Jh="/",fhe="node-ignore";typeof Symbol<"u"&&(fhe=Symbol.for("node-ignore"));var phe=fhe,Xh=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),TYe=/([0-z])-([0-z])/g,hhe=()=>!1,bYe=t=>t.replace(TYe,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:H4),AYe=t=>{let{length:e}=t;return t.slice(0,e-e%2)},wYe=[[/^\uFEFF/,()=>H4],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?lhe:H4)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+lhe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>V4],[/\\\\/g,()=>V4],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===V4?`\\[${r}${AYe(n)}${i}`:i==="]"&&n.length%2===0?`[${bYe(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],xYe=/(^|\\\/)?\\\*$/,FS="regex",MC="checkRegex",uhe="_",RYe={[FS](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[MC](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},IYe=t=>wYe.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),DC=t=>typeof t=="string",CYe=t=>t&&DC(t)&&!mYe.test(t)&&!gYe.test(t)&&t.indexOf("#")!==0,PYe=t=>t.split(SYe).filter(Boolean),W4=class{constructor(e,r,n,i,o,s){this.pattern=e,this.mark=r,this.negative=o,Xh(this,"body",n),Xh(this,"ignoreCase",i),Xh(this,"regexPrefix",s)}get regex(){let e=uhe+FS;return this[e]?this[e]:this._make(FS,e)}get checkRegex(){let e=uhe+MC;return this[e]?this[e]:this._make(MC,e)}_make(e,r){let n=this.regexPrefix.replace(xYe,RYe[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return Xh(this,r,i)}},OYe=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(_Ye,"!").replace(yYe,"#");let o=IYe(i);return new W4(t,e,i,r,n,o)},Y4=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[phe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(DC(e)&&(e={pattern:e}),CYe(e.pattern)){let r=OYe(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,dhe(DC(e)?PYe(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,o=!1,s;this._rules.forEach(c=>{let{negative:l}=c;o===l&&i!==o||l&&!i&&!o&&!r||!c[n].test(e)||(i=!l,o=l,s=l?hYe:c)});let a={ignored:i,unignored:o};return s&&(a.rule=s),a}},NYe=(t,e)=>{throw new e(t)},Js=(t,e,r)=>DC(t)?t?Js.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),mhe=t=>EYe.test(t);Js.isNotRelative=mhe;Js.convert=t=>t;var K4=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){Xh(this,phe,!0),this._rules=new Y4(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let o=e&&Js.convert(e);return Js(o,e,this._strictPathCheck?NYe:hhe),this._t(o,r,n,i)}checkIgnore(e){if(!vYe.test(e))return this.test(e);let r=e.split(Jh).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(Jh)+Jh,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,MC)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(Jh).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,FS);let o=this._t(i.join(Jh)+Jh,r,n,i);return r[e]=o.ignored?o:this._rules.test(e,n,FS)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return dhe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Z4=t=>new K4(t),kYe=t=>Js(t&&Js.convert(t),t,hhe),ghe=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Js.convert=t;let e=/^[a-z]:\//i;Js.isNotRelative=r=>e.test(r)||mhe(r)};typeof process<"u"&&process.platform==="win32"&&ghe();LC.exports=Z4;Z4.default=Z4;LC.exports.isPathValid=kYe;Xh(LC.exports,Symbol.for("setupWindows"),ghe)});var Oq=T(hge=>{"use strict";hge.parse=function(t,e){return new Pq(t,e).parse()};var Pq=class t{constructor(e,r){this.source=e,this.transform=r||iZe,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function iZe(t){return t}});var Nq=T((ZHt,mge)=>{"use strict";var oZe=Oq();mge.exports={create:function(t,e){return{parse:function(){return oZe.parse(t,e)}}}}});var yge=T((JHt,_ge)=>{"use strict";var sZe=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,aZe=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,cZe=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,lZe=/^-?infinity$/;_ge.exports=function(e){if(lZe.test(e))return Number(e.replace("i","I"));var r=sZe.exec(e);if(!r)return uZe(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=gge(i));var o=parseInt(r[2],10)-1,s=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=dZe(e);return f!=null?(d=new Date(Date.UTC(i,o,s,a,c,l,u)),kq(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,o,s,a,c,l,u),kq(i)&&d.setFullYear(i)),d};function uZe(t){var e=aZe.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=gge(r));var i=parseInt(e[2],10)-1,o=e[3],s=new Date(r,i,o);return kq(r)&&s.setFullYear(r),s}}function dZe(t){if(t.endsWith("+00"))return 0;var e=cZe.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function gge(t){return-(t-1)}function kq(t){return t>=0&&t<100}});var Ege=T((XHt,Sge)=>{"use strict";Sge.exports=pZe;var fZe=Object.prototype.hasOwnProperty;function pZe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)fZe.call(r,n)&&(t[n]=r[n])}return t}});var bge=T((QHt,Tge)=>{"use strict";var hZe=Ege();Tge.exports=um;function um(t){if(!(this instanceof um))return new um(t);hZe(this,xZe(t))}var mZe=["seconds","minutes","hours","days","months","years"];um.prototype.toPostgres=function(){var t=mZe.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var gZe={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},_Ze=["years","months","days"],yZe=["hours","minutes","seconds"];um.prototype.toISOString=um.prototype.toISO=function(){var t=_Ze.map(r,this).join(""),e=yZe.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+gZe[n]}};var Mq="([+-]?\\d+)",SZe=Mq+"\\s+years?",EZe=Mq+"\\s+mons?",vZe=Mq+"\\s+days?",TZe="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",bZe=new RegExp([SZe,EZe,vZe,TZe].map(function(t){return"("+t+")?"}).join("\\s*")),vge={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},AZe=["hours","minutes","seconds","milliseconds"];function wZe(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function xZe(t){if(!t)return{};var e=bZe.exec(t),r=e[8]==="-";return Object.keys(vge).reduce(function(n,i){var o=vge[i],s=e[o];return!s||(s=i==="milliseconds"?wZe(s):parseInt(s,10),!s)||(r&&~AZe.indexOf(i)&&(s*=-1),n[i]=s),n},{})}});var xge=T((e6t,wge)=>{"use strict";var Age=Buffer.from||Buffer;wge.exports=function(e){if(/^\\x/.test(e))return Age(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var o=0;o<Math.floor(i/2);++o)r+="\\";n+=Math.floor(i/2)*2}return Age(r,"binary")}});var kge=T((t6t,Nge)=>{"use strict";var WS=Oq(),YS=Nq(),JC=yge(),Ige=bge(),Cge=xge();function XC(t){return function(r){return r===null?r:t(r)}}function Pge(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function RZe(t){return t?WS.parse(t,Pge):null}function IZe(t){return parseInt(t,10)}function Dq(t){return t?WS.parse(t,XC(IZe)):null}function CZe(t){return t?WS.parse(t,XC(function(e){return Oge(e).trim()})):null}var PZe=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=Fq(r)),r});return e.parse()},Lq=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},si=function(t){if(!t)return null;var e=YS.create(t);return e.parse()},$q=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=JC(r)),r});return e.parse()},OZe=function(t){if(!t)return null;var e=YS.create(t,function(r){return r!==null&&(r=Ige(r)),r});return e.parse()},NZe=function(t){return t?WS.parse(t,XC(Cge)):null},Uq=function(t){return parseInt(t,10)},Oge=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},Rge=function(t){return t?WS.parse(t,XC(JSON.parse)):null},Fq=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},kZe=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var o=Fq(e);return o.radius=parseFloat(r),o},MZe=function(t){t(20,Oge),t(21,Uq),t(23,Uq),t(26,Uq),t(700,parseFloat),t(701,parseFloat),t(16,Pge),t(1082,JC),t(1114,JC),t(1184,JC),t(600,Fq),t(651,si),t(718,kZe),t(1e3,RZe),t(1001,NZe),t(1005,Dq),t(1007,Dq),t(1028,Dq),t(1016,CZe),t(1017,PZe),t(1021,Lq),t(1022,Lq),t(1231,Lq),t(1014,si),t(1015,si),t(1008,si),t(1009,si),t(1040,si),t(1041,si),t(1115,$q),t(1182,$q),t(1185,$q),t(1186,Ige),t(1187,OZe),t(17,Cge),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,Rge),t(3807,Rge),t(3907,si),t(2951,si),t(791,si),t(1183,si),t(1270,si)};Nge.exports={init:MZe}});var Dge=T((r6t,Mge)=>{"use strict";var pn=1e6;function DZe(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",o,s,a,c,l,u;{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%pn,e=e/pn>>>0,s=4294967296*o+r,r=s/pn>>>0,a=""+(s-pn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return o=e%pn,s=4294967296*o+r,a=""+s%pn,n+a+i}Mge.exports=DZe});var Bge=T((n6t,Fge)=>{"use strict";var LZe=Dge(),Tt=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var o=r>>3,s=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,s(t[o])&a,c));for(var u=e+r>>3,d=o+1;d<u;d++)l=i(l,s(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,s(t[u])>>8-f,f)),l},Uge=function(t,e,r){var n=Math.pow(2,r-1)-1,i=Tt(t,1),o=Tt(t,r,1);if(o===0)return 0;var s=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)s/=2,(u&1<<d-f)>0&&(l+=s);return l},c=Tt(t,e,r+1,!1,a);return o==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,o-n)*c},$Ze=function(t){return Tt(t,1)==1?-1*(Tt(t,15,1,!0)+1):Tt(t,15,1)},Lge=function(t){return Tt(t,1)==1?-1*(Tt(t,31,1,!0)+1):Tt(t,31,1)},UZe=function(t){return Uge(t,23,8)},FZe=function(t){return Uge(t,52,11)},BZe=function(t){var e=Tt(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,Tt(t,16,16)),n=0,i=[],o=Tt(t,16),s=0;s<o;s++)n+=Tt(t,16,64+16*s)*r,r/=1e4;var a=Math.pow(10,Tt(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},$ge=function(t,e){var r=Tt(e,1),n=Tt(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(o){this.usec=o},i.getUTCMicroSeconds=function(){return this.usec},i},KS=function(t){for(var e=Tt(t,32),r=Tt(t,32,32),n=Tt(t,32,64),i=96,o=[],s=0;s<e;s++)o[s]=Tt(t,32,i),i+=32,i+=32;var a=function(l){var u=Tt(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=Tt(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(o,n)},jZe=function(t){return t.toString("utf8")},zZe=function(t){return t===null?null:Tt(t,8)>0},GZe=function(t){t(20,LZe),t(21,$Ze),t(23,Lge),t(26,Lge),t(1700,BZe),t(700,UZe),t(701,FZe),t(16,zZe),t(1114,$ge.bind(null,!1)),t(1184,$ge.bind(null,!0)),t(1e3,KS),t(1007,KS),t(1016,KS),t(1008,KS),t(1009,KS),t(25,jZe)};Fge.exports={init:GZe}});var zge=T((i6t,jge)=>{"use strict";jge.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var XS=T(JS=>{"use strict";var qZe=kge(),VZe=Bge(),HZe=Nq(),WZe=zge();JS.getTypeParser=YZe;JS.setTypeParser=KZe;JS.arrayParser=HZe;JS.builtins=WZe;var ZS={text:{},binary:{}};function Gge(t){return String(t)}function YZe(t,e){return e=e||"text",ZS[e]&&ZS[e][t]||Gge}function KZe(t,e,r){typeof e=="function"&&(r=e,e="text"),ZS[e][t]=r}qZe.init(function(t,e){ZS.text[t]=e});VZe.init(function(t,e){ZS.binary[t]=e})});var QS=T((s6t,Bq)=>{"use strict";var qge;try{qge=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}Bq.exports={host:"localhost",user:qge,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var dm=XS(),ZZe=dm.getTypeParser(20,"text"),JZe=dm.getTypeParser(1016,"text");Bq.exports.__defineSetter__("parseInt8",function(t){dm.setTypeParser(20,"text",t?dm.getTypeParser(23,"text"):ZZe),dm.setTypeParser(1016,"text",t?dm.getTypeParser(1007,"text"):JZe)})});var fm=T((a6t,Hge)=>{"use strict";var XZe=QS(),{isDate:QZe}=Q("util/types");function e5e(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Vge(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Vge(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=e5e(QC(n))}return e+="}",e}var QC=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):QZe(t)?XZe.parseInputDatesAsUTC?n5e(t):r5e(t):Array.isArray(t)?Vge(t):t5e(t,e):t.toString()};function t5e(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),QC(t.toPostgres(QC),e)}return JSON.stringify(t)}function r5e(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function n5e(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function i5e(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var o5e=function(t){return'"'+t.replace(/"/g,'""')+'"'},s5e=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Hge.exports={prepareValue:function(e){return QC(e)},normalizeQueryConfig:i5e,escapeIdentifier:o5e,escapeLiteral:s5e}});var Gq=T((c6t,Kge)=>{"use strict";var Wge=Q("crypto");Kge.exports={postgresMd5PasswordHash:c5e,randomBytes:a5e,deriveKey:f5e,sha256:l5e,hashByName:u5e,hmacSha256:d5e,md5:jq};var Yge=Wge.webcrypto||globalThis.crypto,Gu=Yge.subtle,zq=new TextEncoder;function a5e(t){return Yge.getRandomValues(Buffer.alloc(t))}async function jq(t){try{return Wge.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?zq.encode(t):t,n=await Gu.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function c5e(t,e,r){let n=await jq(e+t);return"md5"+await jq(Buffer.concat([Buffer.from(n),r]))}async function l5e(t){return await Gu.digest("SHA-256",t)}async function u5e(t,e){return await Gu.digest(t,e)}async function d5e(t,e){let r=await Gu.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await Gu.sign("HMAC",r,zq.encode(e))}async function f5e(t,e,r){let n=await Gu.importKey("raw",zq.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await Gu.deriveBits(i,n,256,["deriveBits"])}});var Xge=T((l6t,Jge)=>{"use strict";function qu(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function qq(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw qu("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Zge(t,e){if(t[e++]!==6)throw qu("non-OID data",t);let{length:r,index:n}=qq(t,e);e=n;let i=e+r,o=t[e++],s=(o/40>>0)+"."+o%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}s+="."+a}return{oid:s,index:e}}function eE(t,e){if(t[e++]!==48)throw qu("non-sequence data",t);return qq(t,e)}function p5e(t,e){e===void 0&&(e=0),e=eE(t,e).index;let{length:r,index:n}=eE(t,e);e=n+r,e=eE(t,e).index;let{oid:i,index:o}=Zge(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=o,e=eE(t,e).index,t[e++]!==160)throw qu("non-tag data",t);e=qq(t,e).index,e=eE(t,e).index;let{oid:s}=Zge(t,e);switch(s){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw qu("unknown hash OID "+s,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw qu("Ed448 certificate channel binding is not currently supported by Postgres")}throw qu("unknown OID "+i,t)}Jge.exports={signatureAlgorithmHashFromCertificate:p5e}});var r_e=T((u6t,t_e)=>{"use strict";var jc=Gq(),{signatureAlgorithmHashFromCertificate:h5e}=Xge();function m5e(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var Vq=1e5;function g5e(t,e,r=Vq){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let o=jc.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:o,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+o,message:"SASLInitialResponse",scramMaxIterations:r}}async function _5e(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=E5e(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let o=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:Vq;if(o!==0&&i.iteration>o)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+o);let s="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let A=n.getPeerCertificate().raw,y=h5e(A);(y==="MD5"||y==="SHA-1")&&(y="SHA-256");let x=await jc.hashByName(y,A);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(x)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=s+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await jc.deriveKey(m5e(e),d,i.iteration),p=await jc.hmacSha256(f,"Client Key"),h=await jc.sha256(p),m=await jc.hmacSha256(h,u),S=T5e(Buffer.from(p),Buffer.from(m)).toString("base64"),E=await jc.hmacSha256(f,"Server Key"),b=await jc.hmacSha256(E,u);t.message="SASLResponse",t.serverSignature=Buffer.from(b).toString("base64"),t.response=l+",p="+S}function y5e(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=v5e(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function S5e(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function Qge(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function e_e(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function E5e(t){let e=e_e(t),r=e.get("r");if(r){if(!S5e(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Qge(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let o=parseInt(i,10);return{nonce:r,salt:n,iteration:o}}function v5e(t){let e=e_e(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!Qge(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function T5e(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}t_e.exports={startSession:g5e,continueSession:_5e,finalizeSession:y5e,DEFAULT_MAX_SCRAM_ITERATIONS:Vq}});var tP=T((d6t,n_e)=>{"use strict";var b5e=XS();function eP(t){this._types=t||b5e,this.text={},this.binary={}}eP.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};eP.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};eP.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};n_e.exports=eP});var s_e=T((f6t,o_e)=>{"use strict";function pm(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let o=i?"":n.hostname;r.host?o&&/^%2f/i.test(o)&&(n.pathname=o+n.pathname):r.host=decodeURIComponent(o),r.port||(r.port=n.port);let s=n.pathname.slice(1)||null;r.database=s?decodeURI(s):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?Q("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&Hq(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function A5e(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function i_e(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let o=i;typeof o=="boolean"&&(r[n]=o),typeof o=="object"&&(r[n]=A5e(o))}else if(i!=null)if(n==="port"){if(i!==""){let o=parseInt(i,10);if(isNaN(o))throw new Error(`Invalid ${n}: ${i}`);r[n]=o}}else r[n]=i;return r},Object.create(null))}function w5e(t){return i_e(pm(t))}function Hq(t){!Hq.warned&&typeof process<"u"&&process.emitWarning&&(Hq.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
26
26
  In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
27
27
 
28
28
  To prepare for this change:
@@ -111,7 +111,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
111
111
  `,LF:`
112
112
  `,concatBytes:t$},K$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Z$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:K$e};import{Buffer as J$e}from"buffer";var Pre=(t,e)=>t?void 0:X$e.bind(void 0,e),X$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!J$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Ore=(t,e)=>t?Q$e.bind(void 0,e):e1e.bind(void 0,e),Q$e=function*(t,e){Nre(t,e),yield e},e1e=function*(t,e){if(Nre(t,e),typeof e!="string"&&!jt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Nre=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
113
113
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
114
- if (condition) { yield value; }`)};import{Buffer as t1e}from"buffer";import{StringDecoder as r1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:n1e.bind(void 0,new TextEncoder)};let n=new r1e(e);return{transform:i1e.bind(void 0,n),final:o1e.bind(void 0,n)}},n1e=function*(t,e){t1e.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},i1e=function*(t,e){yield jt(e)?t.write(e):e},o1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kre}from"util";var n$=kre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=a1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Mre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*s1e(r,Number(e),t)},s1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Dre=kre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),a1e=function*(t){yield t};var i$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...$_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c1e(r,Number(e),t)},c1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},l1e=function*(t){yield t};var o$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Ure(t,s,o),l=$l(e),u=$l(r),d=l?n$.bind(void 0,Ow,a):i$.bind(void 0,Ul),f=l||u?n$.bind(void 0,Mre,a):i$.bind(void 0,$_),p=l||u?Dre.bind(void 0,a):void 0;return{stream:new u1e({writableObjectMode:n,writableHighWaterMark:$re(n),readableObjectMode:i,readableHighWaterMark:$re(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},Nw=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Ure(s,r,a);t=Lre(c,t)}return t},Ure=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Pre(n,a)},Pw(r,s,n),Cw(r,o,n,c),{transform:t,final:e},{transform:Ore(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Fre=(t,e)=>{for(let r of d1e(t))f1e(t,r,e)},d1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),f1e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>p1e(a,n));r.input=R_(s)},p1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return h1e(r),R_(r)},h1e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as y1e,appendFileSync as S1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sf(r,n)&&!Tn.has(e)&&m1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&g1e.has(o))||t.every(({type:i})=>Xn.has(i))),m1e=t=>t===1||t===2,g1e=new Set(["pipe","overlapped"]),Bre=async(t,e,r,n)=>{for await(let i of t)_1e(e)||zre(i,r,n)},jre=(t,e,r)=>{for(let n of t)zre(n,e,r)},_1e=t=>t._readableState.pipes.length>0,zre=(t,e,r)=>{let n=WA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>E1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},E1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],S=v1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=T1e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});b1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&A1e(E,h,i),A}catch(y){return n.error=y,A}},v1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},T1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=i7(t,r);return n[o]?{serializedResult:s,finalResult:r$(s,!i[o],e)}:{serializedResult:s}},b1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=r$(t,!1,s);try{jre(a,e,n)}catch(c){r.error??=c}},A1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?S1e(n,t):(r.add(o),y1e(n,t))}};var qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:jt(t)&&jt(e)?dL([t,e]):`${t}${e}`};import{once as s$}from"events";var Vre=async(t,e)=>{let[r,n]=await w1e(t);return e.isForcefullyTerminated??=!1,[r,n]},w1e=async t=>{let[e,r]=await Promise.allSettled([s$(t,"spawn"),s$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hre(t):r.value},Hre=async t=>{try{return await s$(t,"exit")}catch{return Hre(t)}},Wre=async t=>{let[e,r]=await t;if(!x1e(e,r)&&a$(e,r))throw new Pi;return[e,r]},x1e=(t,e)=>t===void 0&&e===void 0,a$=(t,e)=>t!==0||e!==null;var Yre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R1e=(t,e,r)=>t!==void 0?t:a$(e,r)?new Pi:void 0;var Kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=C1e(t,e,r),d=N1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},C1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=P1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);O1e(u);let d=wre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,O1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=k1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Yre(c,r),{output:h,error:m=l}=Gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ys(b,r,A)),E=ys(qre(h,r),r,"all");return D1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},k1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Fre(o,r);let a=M1e(r);return I1e(...gw(t,e,a))}catch(a){return If({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),D1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):L_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as TFe}from"events";import{spawn as bFe}from"child_process";import ene from"process";import{once as c$,on as L1e}from"events";var Zre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),$1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),$1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([U1e(o,n,s),F1e(o,r,s),B1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),sw(e,i)}},U1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await c$(t,"message",{signal:r});return n}for await(let[n]of L1e(t,"message",{signal:r}))if(e(n))return n},F1e=async(t,e,{signal:r})=>{await c$(t,"disconnect",{signal:r}),Lee(e)},B1e=async(t,e,{signal:r})=>{let[n]=await c$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Xre,on as j1e}from"events";var Qre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>l$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),l$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return z1e(t,s,a),G1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),q1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},z1e=async(t,e,r)=>{try{await Xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},q1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of j1e(r,"message",{signal:o.signal}))Jre(s),yield c}catch{Jre(s)}finally{o.abort(),sw(e,a),n||bf(t),i&&await t}},Jre=({error:t})=>{if(t)throw t};var tne=(t,{ipc:e})=>{Object.assign(t,nne(t,!1,e))},rne=()=>{let t=ene,e=!0,r=ene.channel!==void 0;return{...nne(t,e,r),getCancelSignal:lte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as V1e}from"child_process";import{PassThrough as H1e,Readable as W1e,Writable as Y1e,Duplex as K1e}from"stream";var ine=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QL(n);let a=new V1e;Z1e(a,n),Object.assign(a,{readable:J1e,writable:X1e,duplex:Q1e});let c=If({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=eUe(c,s,i);return{subprocess:a,promise:l}},Z1e=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new H1e;return t.end(),t},J1e=()=>new W1e({read(){}}),X1e=()=>new Y1e({write(){}}),Q1e=()=>new K1e({read(){},write(){}}),eUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as one,createWriteStream as sne}from"fs";import{Buffer as tUe}from"buffer";import{Readable as F_,Writable as rUe,Duplex as nUe}from"stream";var cne=(t,e)=>Iw(iUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},ane={fileNumber:B_,generator:o$,asyncGenerator:o$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:nUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},iUe={input:{...ane,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t}})=>({stream:one(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(tUe.from(t))})},output:{...ane,fileUrl:({value:t})=>({stream:sne(t)}),filePath:({value:{file:t,append:e}})=>({stream:sne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:rUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as oUe,once as lne}from"events";import{PassThrough as sUe,getDefaultHighWaterMark as aUe}from"stream";import{finished as fne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)d$(i);let e=t.some(({readableObjectMode:i})=>i),r=cUe(t,e),n=new u$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var cUe=(t,e)=>{if(t.length===0)return aUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},u$=class extends sUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(d$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=lUe(this,this.#e,this.#o);let r=fUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(d$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},lUe=async(t,e,r)=>{Dw(t,une);let n=new AbortController;try{await Promise.race([uUe(t,n),dUe(t,e,r,n)])}finally{n.abort(),Dw(t,-une)}},uUe=async(t,{signal:e})=>{try{await fne(t,{signal:e,cleanup:!0})}catch(r){throw pne(t,r),r}},dUe=async(t,e,r,{signal:n})=>{for await(let[i]of oUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},d$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},fUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,dne);let a=new AbortController;try{await Promise.race([pUe(o,e,a),hUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),mUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-dne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?f$(t):gUe(t))},pUe=async(t,e,{signal:r})=>{try{await t,r.aborted||f$(e)}catch(n){r.aborted||pne(e,n)}},hUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;hne(s)?i.add(e):mne(t,s)}},mUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await lne(t,i,{signal:o}),!t.readable)return lne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gUe=t=>{t.writable&&t.end()},pne=(t,e)=>{hne(e)?f$(t):mne(t,e)},hne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",f$=t=>{(t.readable||t.writable)&&t.destroy()},mne=(t,e)=>{t.destroyed||(t.once("error",_Ue),t.destroy(e))},_Ue=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},une=2,dne=1;import{finished as gne}from"stream/promises";var Of=(t,e)=>{t.pipe(e),yUe(t,e),SUe(t,e)},yUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}p$(e)}},p$=t=>{t.writable&&t.end()},SUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}h$(t)}},h$=t=>{t.readable&&t.destroy()};var _ne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Xn.has(c)))EUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))TUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fl(o);Of(s,i)}},EUe=(t,e,r,n)=>{r==="output"?Of(t.stdio[n],e):Of(e,t.stdio[n]);let i=vUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},vUe=["stdin","stdout","stderr"],TUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;bUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},bUe=(t,{signal:e})=>{Ci(t)&&Dl(t,AUe,e)},AUe=2;import{addAbortListener as RUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",m$=Symbol.for("signal-exit emitter"),g$=globalThis,wUe=Object.defineProperty.bind(Object),_$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g$[m$])return g$[m$];wUe(g$,m$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$w=class{},xUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),y$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},S$=class extends $w{#e=E$.platform==="win32"?"SIGINT":"SIGHUP";#r=new _$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Lw(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Lw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Lw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},E$=globalThis.process,{onExit:yne,load:$vt,unload:Uvt}=xUe(Lw(E$)?new S$(E$):new y$);var Sne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yne(()=>{t.kill()});RUe(n,()=>{i()})};var vne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=IUe(r,n,i),{sourceStream:d,sourceError:f}=PUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},IUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=CUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},CUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ene,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lL(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=UA(r,...n);return{destination:e(Ene)(i,o,s),pipeOptions:s}}if(yo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ene=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),PUe=(t,e)=>{try{return{sourceStream:Af(t,e)}}catch(r){return{sourceError:r}}};var bne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=OUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw v$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},OUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return h$(t),n;if(e!==void 0)return p$(r),e},v$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>If({error:t,command:Tne,escapedCommand:Tne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Tne="source.pipe(destination)";var Ane=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as NUe}from"stream/promises";var wne=(t,e,r)=>{let n=Uw.has(e)?MUe(t,e):kUe(t,e);return Dl(t,LUe,r.signal),Dl(e,$Ue,r.signal),DUe(e),n},kUe=(t,e)=>{let r=Fl([t]);return Of(r,e),Uw.set(e,r),r},MUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},DUe=async t=>{try{await NUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,LUe=2,$Ue=1;import{aborted as UUe}from"util";var xne=(t,e)=>t===void 0?[]:[FUe(t,e)],FUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await UUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw v$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Ot(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vne(t,...e),i=BUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},BUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=jUe(t,i);bne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=wne(e,o,d);return await Promise.race([Ane(u),...xne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},jUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as YUe}from"timers/promises";import{on as zUe}from"events";import{getDefaultHighWaterMark as GUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return qUe(e,s),Ine({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},qUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},T$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;VUe(e,s,t);let a=t.readableObjectMode&&!o;return Ine({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},VUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ine=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=zUe(t,"data",{signal:e.signal,highWaterMark:Rne,highWatermark:Rne});return HUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},b$=GUe(!0),Rne=b$,HUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=WUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},WUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Cw(t,i,!n,{})].filter(Boolean);var Cne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=KUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ZUe(t),d]);return}let f=e$(c,r),p=T$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([JUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},KUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=T$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bre(a,t,r,o)},ZUe=async t=>{await YUe(),t.readableFlowing===null&&t.resume()},JUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await Rf(r,{maxBuffer:o})}catch(a){return Pne(Bte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},A$=async t=>{try{return await t}catch(e){return Pne(e)}},Pne=({bufferedData:t})=>r7(t)?new Uint8Array(t):t;import{finished as XUe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=QUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],XUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||rFe(a,e,r,n)}finally{s.abort()}},QUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&eFe(t,r,n),n},eFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{tFe(e,r),n.call(t,...i)}},tFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},rFe=(t,e,r,n)=>{if(!nFe(t,e,r,n))throw t},nFe=(t,e,r,n=!0)=>r.propagating?One(t)||jw(t):(r.propagating=!0,w$(r,e)===n?One(t):jw(t)),w$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",One=t=>t?.code==="EPIPE";var Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>x$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),x$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=j_(t,e,l);if(w$(l,e)){await u;return}let[d]=await Promise.all([Cne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Mne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>x$({...iFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:oFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),iFe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},oFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as sFe}from"events";var Dne=t=>Sf(t,"ipc"),Lne=(t,e)=>{let r=WA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $ne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Dne(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of l$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jte(t,i,c),i.push(l)),s&&Lne(l,o);return i},Une=async(t,e)=>(await Promise.allSettled([t]),e);var Fne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:S,controller:E})=>{let b=Vre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Mne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=$ne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),N=aFe(m,t,A),R=cFe(h,A);try{return await Promise.race([Promise.all([{},Wre(b),Promise.all(y),x,O,Ste(t,d),...N,...R]),S,lFe(t,E),...hte(t,o,f,E),...Dee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...fte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(y.map(_=>A$(_))),A$(x),Une(O,C),Promise.allSettled(N),Promise.allSettled(R)])}},aFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),cFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),lFe=async(t,{signal:e})=>{let[r]=await sFe(t,"error",{signal:e});throw r};var Bne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Nf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as uFe}from"stream";import{callbackify as dFe}from"util";import{finished as jne}from"stream/promises";var R$=async t=>{if(t!==void 0)try{await I$(t)}catch{}},zne=async t=>{if(t!==void 0)try{await C$(t)}catch{}},I$=async t=>{await jne(t,{cleanup:!0,readable:!1,writable:!0})},C$=async t=>{await jne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var Gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=P$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=O$(a,s),{read:f,onStdoutDataDone:p}=N$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new uFe({read:f,destroy:dFe(M$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return k$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},P$=(t,e,r)=>{let n=Af(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},O$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:b$},N$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){fFe(this,s,o)},onStdoutDataDone:o}},fFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},k$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await C$(t),await n,await R$(i),await e,r.readable&&r.push(null)}catch(o){await R$(i),qne(r,o)}},M$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Nf(r,e)&&(qne(t,n),await zw(e,n))},qne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as pFe}from"stream";import{callbackify as Vne}from"util";var Hne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=D$(t,r,e),s=new pFe({...L$(n,t,i),destroy:Vne(U$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $$(n,s),s},D$=(t,e,r)=>{let n=iw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},L$=(t,e,r)=>({write:hFe.bind(void 0,t),final:Vne(mFe.bind(void 0,t,e,r))}),hFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},mFe=async(t,e,r)=>{await Nf(r,e)&&(t.writable&&t.end(),await e)},$$=async(t,e,r)=>{try{await I$(t),e.writable&&e.end()}catch(n){await zne(r),Wne(e,n)}},U$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Nf(r,e),await Nf(n,e)&&(Wne(t,i),await zw(e,i))},Wne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as gFe}from"stream";import{callbackify as _Fe}from"util";var Yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=P$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=D$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=O$(c,a),{read:S,onStdoutDataDone:E}=N$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new gFe({read:S,...L$(u,t,d),destroy:_Fe(yFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return k$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),$$(u,b,c),b},yFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([M$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),U$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var F$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Tn.has(e),s=Af(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return SFe(a,s,t)},SFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kne=(t,{encoding:e})=>{let r=Bne();t.readable=Gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=F$.bind(void 0,t,e),t[Symbol.asyncIterator]=F$.bind(void 0,t,e,{})};var Zne=(t,e)=>{for(let[r,n]of vFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},EFe=(async()=>{})().constructor.prototype,vFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(EFe,t)]);var Jne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=AFe(t,e,r),{subprocess:f,promise:p}=xFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Zne(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},AFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=wFe(l),d=cne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},wFe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},xFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bFe(...gw(t,e,r))}catch(h){return ine({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;TFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_ne(c,a,l),Sne(c,r,l);let d={},f=_o();c.kill=kee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kne(c,r),Kne(c,r),tne(c,r);let p=RFe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},RFe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,S]=await Fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ys(y,e,x)),b=ys(m,e,"all"),A=IFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},IFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?L_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,CFe(n,t[n],i)]));return{...t,...r}},CFe=(t,e,r)=>PFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,PFe=new Set(["env",...mL]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>OFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},OFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=NFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Kre(a,c,l):Jne(a,c,l,i)},NFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=c7(e)?l7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xne=({file:t,commandArguments:e})=>eie(t,e),Qne=({file:t,commandArguments:e})=>({...eie(t,e),isSync:!0}),eie=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=kFe(t);return{file:r,commandArguments:n}},kFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(MFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},MFe=/ +/g;var tie=(t,e,r)=>{t.sync=e(DFe,r),t.s=t.sync},rie=({options:t})=>nie(t),DFe=({options:t})=>({...nie(t),isSync:!0}),nie=t=>({options:{...LFe(t),...t}}),LFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},iie={preferLocal:!0};var oie=$a(()=>({})),RAt=$a(()=>({isSync:!0})),sie=$a(Xne),IAt=$a(Qne),CAt=$a(gte),PAt=$a(rie,{},iie,tie),{sendMessage:OAt,getOneMessage:NAt,getEachMessage:kAt,getCancelSignal:MAt}=rne();var aie=!1,cie=()=>{aie=!0},vo=()=>aie;var G_=null,lie=t=>(G_&&G_.destroy(),G_=new Ss({totalAllowedTime:t}),G_),uie=()=>G_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await PA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ce.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var die={name:"@netlify/agent-runner-cli",type:"module",version:"1.163.0-PAW-328.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var BFe=UFe(import.meta.url),jFe=Es.dirname(BFe),zFe=FFe(import.meta.url),kf=ue("shell"),B$=new Set,fie={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=GFe(e,r),o={...fie,...i},s=oie(t,n,o);hie(s,o),_ie(s);let a=r?.idleTimeout;return a&&a>0&&gie(s,a),s},pie=(t,e)=>{let r={...fie,...e},n=sie(t,r);return hie(n,r),_ie(n),e?.idleTimeout&&e.idleTimeout>0&&gie(n,e.idleTimeout),n},GFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(vs.stdout),t.stderr?.pipe(new __).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},j$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),kf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return kf.error("Error killing process:",r),!1}},mie=t=>j$(t,"SIGKILL"),gie=(t,e)=>{let r=null,n=()=>{kf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing idle process ${t.pid}`),mie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},_ie=t=>{B$.add(t);let e=uie();if(e){let r=e.onTimesUp(()=>{kf.log(`Global timer expired, killing process ${t.pid}`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing process ${t.pid} after timeout`),mie(t))},5e3)});t.on("exit",()=>{B$.delete(t),r()}),t.on("error",()=>{B$.delete(t),r()})}};function Hw(t,e){return!!ki(t,e)}function ki(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=zFe.resolve(die.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=Es.join(jFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var qFe=ue("utils"),VFe=t=>new Promise(e=>{setTimeout(e,t)});var z$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ww=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await VFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Ua=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},yie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):qFe.error("Could not parse JSON",n))}},HFe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():HFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Yw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var G$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},WFe=1e4,q$=(t,e=WFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as YFe}from"crypto";import{createReadStream as KFe}from"fs";import Kw from"fs/promises";import Aie from"os";import Zw from"path";var Eie=ue("repo"),wie="runner-diffs-",xie=t=>`${wie}${t}-`,Rie=async t=>{let e=Aie.tmpdir(),r;try{r=await Kw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(wie)&&!n.startsWith(xie(t))).map(n=>Kw.rm(Zw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},nn=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Jw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Eie.info("Getting runner diffs");let n=await JFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=QFe(o);await eBe(h,r)}Eie.info("Changes after processing"),await H$(r);let s=await W$(o,r);if(await V$(s,r),i=await XFe(r),!i)return{hasChanges:!1,ignored:s};await nn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Kw.mkdtemp(Zw.join(Aie.tmpdir(),xie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=Zw.join(a,S);await nn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Kw.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await bie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Tie(d,h)||(f=h)}await bie(r),ce.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Tie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vie=async t=>{let e=YFe("sha256");for await(let r of KFe(t))e.update(r);return e.digest("hex")},Tie=async(t,e)=>t.size===e.size&&await vie(t.path)===await vie(e.path),bie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await nn(["reset","--soft","HEAD~1"],{cwd:t})},V$=async(t=[],e=process.cwd())=>{await nn(["add",".",...t],{cwd:e})},H$=async(t=process.cwd())=>{let e=await nn(["status","-s"],{cwd:t});return String(e.stdout??"")},Iie=/.. (.+)?\.log$/,ZFe=[Iie],JFe=async(t=process.cwd())=>{let e=await H$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
114
+ if (condition) { yield value; }`)};import{Buffer as t1e}from"buffer";import{StringDecoder as r1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:n1e.bind(void 0,new TextEncoder)};let n=new r1e(e);return{transform:i1e.bind(void 0,n),final:o1e.bind(void 0,n)}},n1e=function*(t,e){t1e.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},i1e=function*(t,e){yield jt(e)?t.write(e):e},o1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kre}from"util";var n$=kre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=a1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Mre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*s1e(r,Number(e),t)},s1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Dre=kre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),a1e=function*(t){yield t};var i$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...$_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c1e(r,Number(e),t)},c1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},l1e=function*(t){yield t};var o$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Ure(t,s,o),l=$l(e),u=$l(r),d=l?n$.bind(void 0,Ow,a):i$.bind(void 0,Ul),f=l||u?n$.bind(void 0,Mre,a):i$.bind(void 0,$_),p=l||u?Dre.bind(void 0,a):void 0;return{stream:new u1e({writableObjectMode:n,writableHighWaterMark:$re(n),readableObjectMode:i,readableHighWaterMark:$re(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},Nw=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Ure(s,r,a);t=Lre(c,t)}return t},Ure=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Pre(n,a)},Pw(r,s,n),Cw(r,o,n,c),{transform:t,final:e},{transform:Ore(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Fre=(t,e)=>{for(let r of d1e(t))f1e(t,r,e)},d1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),f1e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>p1e(a,n));r.input=R_(s)},p1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return h1e(r),R_(r)},h1e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as y1e,appendFileSync as S1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sf(r,n)&&!Tn.has(e)&&m1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&g1e.has(o))||t.every(({type:i})=>Xn.has(i))),m1e=t=>t===1||t===2,g1e=new Set(["pipe","overlapped"]),Bre=async(t,e,r,n)=>{for await(let i of t)_1e(e)||zre(i,r,n)},jre=(t,e,r)=>{for(let n of t)zre(n,e,r)},_1e=t=>t._readableState.pipes.length>0,zre=(t,e,r)=>{let n=WA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>E1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},E1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],S=v1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=T1e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});b1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&A1e(E,h,i),A}catch(y){return n.error=y,A}},v1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},T1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=i7(t,r);return n[o]?{serializedResult:s,finalResult:r$(s,!i[o],e)}:{serializedResult:s}},b1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=r$(t,!1,s);try{jre(a,e,n)}catch(c){r.error??=c}},A1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?S1e(n,t):(r.add(o),y1e(n,t))}};var qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:jt(t)&&jt(e)?dL([t,e]):`${t}${e}`};import{once as s$}from"events";var Vre=async(t,e)=>{let[r,n]=await w1e(t);return e.isForcefullyTerminated??=!1,[r,n]},w1e=async t=>{let[e,r]=await Promise.allSettled([s$(t,"spawn"),s$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hre(t):r.value},Hre=async t=>{try{return await s$(t,"exit")}catch{return Hre(t)}},Wre=async t=>{let[e,r]=await t;if(!x1e(e,r)&&a$(e,r))throw new Pi;return[e,r]},x1e=(t,e)=>t===void 0&&e===void 0,a$=(t,e)=>t!==0||e!==null;var Yre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R1e=(t,e,r)=>t!==void 0?t:a$(e,r)?new Pi:void 0;var Kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=C1e(t,e,r),d=N1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},C1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=P1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);O1e(u);let d=wre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,O1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=k1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Yre(c,r),{output:h,error:m=l}=Gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ys(b,r,A)),E=ys(qre(h,r),r,"all");return D1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},k1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Fre(o,r);let a=M1e(r);return I1e(...gw(t,e,a))}catch(a){return If({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),D1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):L_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as TFe}from"events";import{spawn as bFe}from"child_process";import ene from"process";import{once as c$,on as L1e}from"events";var Zre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),$1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),$1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([U1e(o,n,s),F1e(o,r,s),B1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),sw(e,i)}},U1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await c$(t,"message",{signal:r});return n}for await(let[n]of L1e(t,"message",{signal:r}))if(e(n))return n},F1e=async(t,e,{signal:r})=>{await c$(t,"disconnect",{signal:r}),Lee(e)},B1e=async(t,e,{signal:r})=>{let[n]=await c$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Xre,on as j1e}from"events";var Qre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>l$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),l$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return z1e(t,s,a),G1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),q1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},z1e=async(t,e,r)=>{try{await Xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},q1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of j1e(r,"message",{signal:o.signal}))Jre(s),yield c}catch{Jre(s)}finally{o.abort(),sw(e,a),n||bf(t),i&&await t}},Jre=({error:t})=>{if(t)throw t};var tne=(t,{ipc:e})=>{Object.assign(t,nne(t,!1,e))},rne=()=>{let t=ene,e=!0,r=ene.channel!==void 0;return{...nne(t,e,r),getCancelSignal:lte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as V1e}from"child_process";import{PassThrough as H1e,Readable as W1e,Writable as Y1e,Duplex as K1e}from"stream";var ine=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QL(n);let a=new V1e;Z1e(a,n),Object.assign(a,{readable:J1e,writable:X1e,duplex:Q1e});let c=If({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=eUe(c,s,i);return{subprocess:a,promise:l}},Z1e=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new H1e;return t.end(),t},J1e=()=>new W1e({read(){}}),X1e=()=>new Y1e({write(){}}),Q1e=()=>new K1e({read(){},write(){}}),eUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as one,createWriteStream as sne}from"fs";import{Buffer as tUe}from"buffer";import{Readable as F_,Writable as rUe,Duplex as nUe}from"stream";var cne=(t,e)=>Iw(iUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},ane={fileNumber:B_,generator:o$,asyncGenerator:o$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:nUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},iUe={input:{...ane,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t}})=>({stream:one(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(tUe.from(t))})},output:{...ane,fileUrl:({value:t})=>({stream:sne(t)}),filePath:({value:{file:t,append:e}})=>({stream:sne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:rUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as oUe,once as lne}from"events";import{PassThrough as sUe,getDefaultHighWaterMark as aUe}from"stream";import{finished as fne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)d$(i);let e=t.some(({readableObjectMode:i})=>i),r=cUe(t,e),n=new u$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var cUe=(t,e)=>{if(t.length===0)return aUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},u$=class extends sUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(d$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=lUe(this,this.#e,this.#o);let r=fUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(d$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},lUe=async(t,e,r)=>{Dw(t,une);let n=new AbortController;try{await Promise.race([uUe(t,n),dUe(t,e,r,n)])}finally{n.abort(),Dw(t,-une)}},uUe=async(t,{signal:e})=>{try{await fne(t,{signal:e,cleanup:!0})}catch(r){throw pne(t,r),r}},dUe=async(t,e,r,{signal:n})=>{for await(let[i]of oUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},d$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},fUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,dne);let a=new AbortController;try{await Promise.race([pUe(o,e,a),hUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),mUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-dne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?f$(t):gUe(t))},pUe=async(t,e,{signal:r})=>{try{await t,r.aborted||f$(e)}catch(n){r.aborted||pne(e,n)}},hUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;hne(s)?i.add(e):mne(t,s)}},mUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await lne(t,i,{signal:o}),!t.readable)return lne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gUe=t=>{t.writable&&t.end()},pne=(t,e)=>{hne(e)?f$(t):mne(t,e)},hne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",f$=t=>{(t.readable||t.writable)&&t.destroy()},mne=(t,e)=>{t.destroyed||(t.once("error",_Ue),t.destroy(e))},_Ue=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},une=2,dne=1;import{finished as gne}from"stream/promises";var Of=(t,e)=>{t.pipe(e),yUe(t,e),SUe(t,e)},yUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}p$(e)}},p$=t=>{t.writable&&t.end()},SUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}h$(t)}},h$=t=>{t.readable&&t.destroy()};var _ne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Xn.has(c)))EUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))TUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fl(o);Of(s,i)}},EUe=(t,e,r,n)=>{r==="output"?Of(t.stdio[n],e):Of(e,t.stdio[n]);let i=vUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},vUe=["stdin","stdout","stderr"],TUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;bUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},bUe=(t,{signal:e})=>{Ci(t)&&Dl(t,AUe,e)},AUe=2;import{addAbortListener as RUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",m$=Symbol.for("signal-exit emitter"),g$=globalThis,wUe=Object.defineProperty.bind(Object),_$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g$[m$])return g$[m$];wUe(g$,m$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$w=class{},xUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),y$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},S$=class extends $w{#e=E$.platform==="win32"?"SIGINT":"SIGHUP";#r=new _$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Lw(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Lw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Lw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},E$=globalThis.process,{onExit:yne,load:$vt,unload:Uvt}=xUe(Lw(E$)?new S$(E$):new y$);var Sne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yne(()=>{t.kill()});RUe(n,()=>{i()})};var vne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=IUe(r,n,i),{sourceStream:d,sourceError:f}=PUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},IUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=CUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},CUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ene,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lL(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=UA(r,...n);return{destination:e(Ene)(i,o,s),pipeOptions:s}}if(yo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ene=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),PUe=(t,e)=>{try{return{sourceStream:Af(t,e)}}catch(r){return{sourceError:r}}};var bne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=OUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw v$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},OUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return h$(t),n;if(e!==void 0)return p$(r),e},v$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>If({error:t,command:Tne,escapedCommand:Tne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Tne="source.pipe(destination)";var Ane=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as NUe}from"stream/promises";var wne=(t,e,r)=>{let n=Uw.has(e)?MUe(t,e):kUe(t,e);return Dl(t,LUe,r.signal),Dl(e,$Ue,r.signal),DUe(e),n},kUe=(t,e)=>{let r=Fl([t]);return Of(r,e),Uw.set(e,r),r},MUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},DUe=async t=>{try{await NUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,LUe=2,$Ue=1;import{aborted as UUe}from"util";var xne=(t,e)=>t===void 0?[]:[FUe(t,e)],FUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await UUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw v$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Ot(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vne(t,...e),i=BUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},BUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=jUe(t,i);bne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=wne(e,o,d);return await Promise.race([Ane(u),...xne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},jUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as YUe}from"timers/promises";import{on as zUe}from"events";import{getDefaultHighWaterMark as GUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return qUe(e,s),Ine({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},qUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},T$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;VUe(e,s,t);let a=t.readableObjectMode&&!o;return Ine({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},VUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ine=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=zUe(t,"data",{signal:e.signal,highWaterMark:Rne,highWatermark:Rne});return HUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},b$=GUe(!0),Rne=b$,HUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=WUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},WUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Cw(t,i,!n,{})].filter(Boolean);var Cne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=KUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ZUe(t),d]);return}let f=e$(c,r),p=T$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([JUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},KUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=T$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bre(a,t,r,o)},ZUe=async t=>{await YUe(),t.readableFlowing===null&&t.resume()},JUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await Rf(r,{maxBuffer:o})}catch(a){return Pne(Bte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},A$=async t=>{try{return await t}catch(e){return Pne(e)}},Pne=({bufferedData:t})=>r7(t)?new Uint8Array(t):t;import{finished as XUe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=QUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],XUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||rFe(a,e,r,n)}finally{s.abort()}},QUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&eFe(t,r,n),n},eFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{tFe(e,r),n.call(t,...i)}},tFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},rFe=(t,e,r,n)=>{if(!nFe(t,e,r,n))throw t},nFe=(t,e,r,n=!0)=>r.propagating?One(t)||jw(t):(r.propagating=!0,w$(r,e)===n?One(t):jw(t)),w$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",One=t=>t?.code==="EPIPE";var Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>x$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),x$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=j_(t,e,l);if(w$(l,e)){await u;return}let[d]=await Promise.all([Cne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Mne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>x$({...iFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:oFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),iFe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},oFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as sFe}from"events";var Dne=t=>Sf(t,"ipc"),Lne=(t,e)=>{let r=WA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $ne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Dne(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of l$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jte(t,i,c),i.push(l)),s&&Lne(l,o);return i},Une=async(t,e)=>(await Promise.allSettled([t]),e);var Fne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:S,controller:E})=>{let b=Vre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Mne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=$ne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),N=aFe(m,t,A),R=cFe(h,A);try{return await Promise.race([Promise.all([{},Wre(b),Promise.all(y),x,O,Ste(t,d),...N,...R]),S,lFe(t,E),...hte(t,o,f,E),...Dee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...fte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(y.map(_=>A$(_))),A$(x),Une(O,C),Promise.allSettled(N),Promise.allSettled(R)])}},aFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),cFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),lFe=async(t,{signal:e})=>{let[r]=await sFe(t,"error",{signal:e});throw r};var Bne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Nf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as uFe}from"stream";import{callbackify as dFe}from"util";import{finished as jne}from"stream/promises";var R$=async t=>{if(t!==void 0)try{await I$(t)}catch{}},zne=async t=>{if(t!==void 0)try{await C$(t)}catch{}},I$=async t=>{await jne(t,{cleanup:!0,readable:!1,writable:!0})},C$=async t=>{await jne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var Gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=P$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=O$(a,s),{read:f,onStdoutDataDone:p}=N$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new uFe({read:f,destroy:dFe(M$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return k$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},P$=(t,e,r)=>{let n=Af(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},O$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:b$},N$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){fFe(this,s,o)},onStdoutDataDone:o}},fFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},k$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await C$(t),await n,await R$(i),await e,r.readable&&r.push(null)}catch(o){await R$(i),qne(r,o)}},M$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Nf(r,e)&&(qne(t,n),await zw(e,n))},qne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as pFe}from"stream";import{callbackify as Vne}from"util";var Hne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=D$(t,r,e),s=new pFe({...L$(n,t,i),destroy:Vne(U$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $$(n,s),s},D$=(t,e,r)=>{let n=iw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},L$=(t,e,r)=>({write:hFe.bind(void 0,t),final:Vne(mFe.bind(void 0,t,e,r))}),hFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},mFe=async(t,e,r)=>{await Nf(r,e)&&(t.writable&&t.end(),await e)},$$=async(t,e,r)=>{try{await I$(t),e.writable&&e.end()}catch(n){await zne(r),Wne(e,n)}},U$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Nf(r,e),await Nf(n,e)&&(Wne(t,i),await zw(e,i))},Wne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as gFe}from"stream";import{callbackify as _Fe}from"util";var Yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=P$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=D$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=O$(c,a),{read:S,onStdoutDataDone:E}=N$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new gFe({read:S,...L$(u,t,d),destroy:_Fe(yFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return k$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),$$(u,b,c),b},yFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([M$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),U$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var F$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Tn.has(e),s=Af(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return SFe(a,s,t)},SFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kne=(t,{encoding:e})=>{let r=Bne();t.readable=Gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=F$.bind(void 0,t,e),t[Symbol.asyncIterator]=F$.bind(void 0,t,e,{})};var Zne=(t,e)=>{for(let[r,n]of vFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},EFe=(async()=>{})().constructor.prototype,vFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(EFe,t)]);var Jne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=AFe(t,e,r),{subprocess:f,promise:p}=xFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Zne(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},AFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=wFe(l),d=cne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},wFe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},xFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bFe(...gw(t,e,r))}catch(h){return ine({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;TFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_ne(c,a,l),Sne(c,r,l);let d={},f=_o();c.kill=kee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kne(c,r),Kne(c,r),tne(c,r);let p=RFe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},RFe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,S]=await Fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ys(y,e,x)),b=ys(m,e,"all"),A=IFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},IFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?L_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,CFe(n,t[n],i)]));return{...t,...r}},CFe=(t,e,r)=>PFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,PFe=new Set(["env",...mL]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>OFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},OFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=NFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Kre(a,c,l):Jne(a,c,l,i)},NFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=c7(e)?l7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xne=({file:t,commandArguments:e})=>eie(t,e),Qne=({file:t,commandArguments:e})=>({...eie(t,e),isSync:!0}),eie=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=kFe(t);return{file:r,commandArguments:n}},kFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(MFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},MFe=/ +/g;var tie=(t,e,r)=>{t.sync=e(DFe,r),t.s=t.sync},rie=({options:t})=>nie(t),DFe=({options:t})=>({...nie(t),isSync:!0}),nie=t=>({options:{...LFe(t),...t}}),LFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},iie={preferLocal:!0};var oie=$a(()=>({})),RAt=$a(()=>({isSync:!0})),sie=$a(Xne),IAt=$a(Qne),CAt=$a(gte),PAt=$a(rie,{},iie,tie),{sendMessage:OAt,getOneMessage:NAt,getEachMessage:kAt,getCancelSignal:MAt}=rne();var aie=!1,cie=()=>{aie=!0},vo=()=>aie;var G_=null,lie=t=>(G_&&G_.destroy(),G_=new Ss({totalAllowedTime:t}),G_),uie=()=>G_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await PA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ce.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var die={name:"@netlify/agent-runner-cli",type:"module",version:"1.163.0-PAW-328.2",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var BFe=UFe(import.meta.url),jFe=Es.dirname(BFe),zFe=FFe(import.meta.url),kf=ue("shell"),B$=new Set,fie={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=GFe(e,r),o={...fie,...i},s=oie(t,n,o);hie(s,o),_ie(s);let a=r?.idleTimeout;return a&&a>0&&gie(s,a),s},pie=(t,e)=>{let r={...fie,...e},n=sie(t,r);return hie(n,r),_ie(n),e?.idleTimeout&&e.idleTimeout>0&&gie(n,e.idleTimeout),n},GFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(vs.stdout),t.stderr?.pipe(new __).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},j$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),kf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return kf.error("Error killing process:",r),!1}},mie=t=>j$(t,"SIGKILL"),gie=(t,e)=>{let r=null,n=()=>{kf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing idle process ${t.pid}`),mie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},_ie=t=>{B$.add(t);let e=uie();if(e){let r=e.onTimesUp(()=>{kf.log(`Global timer expired, killing process ${t.pid}`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing process ${t.pid} after timeout`),mie(t))},5e3)});t.on("exit",()=>{B$.delete(t),r()}),t.on("error",()=>{B$.delete(t),r()})}};function Hw(t,e){return!!ki(t,e)}function ki(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=zFe.resolve(die.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=Es.join(jFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var qFe=ue("utils"),VFe=t=>new Promise(e=>{setTimeout(e,t)});var z$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ww=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await VFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Ua=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},yie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):qFe.error("Could not parse JSON",n))}},HFe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():HFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Yw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var G$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},WFe=1e4,q$=(t,e=WFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as YFe}from"crypto";import{createReadStream as KFe}from"fs";import Kw from"fs/promises";import Aie from"os";import Zw from"path";var Eie=ue("repo"),wie="runner-diffs-",xie=t=>`${wie}${t}-`,Rie=async t=>{let e=Aie.tmpdir(),r;try{r=await Kw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(wie)&&!n.startsWith(xie(t))).map(n=>Kw.rm(Zw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},nn=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Jw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Eie.info("Getting runner diffs");let n=await JFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=QFe(o);await eBe(h,r)}Eie.info("Changes after processing"),await H$(r);let s=await W$(o,r);if(await V$(s,r),i=await XFe(r),!i)return{hasChanges:!1,ignored:s};await nn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Kw.mkdtemp(Zw.join(Aie.tmpdir(),xie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=Zw.join(a,S);await nn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Kw.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await bie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Tie(d,h)||(f=h)}await bie(r),ce.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Tie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vie=async t=>{let e=YFe("sha256");for await(let r of KFe(t))e.update(r);return e.digest("hex")},Tie=async(t,e)=>t.size===e.size&&await vie(t.path)===await vie(e.path),bie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await nn(["reset","--soft","HEAD~1"],{cwd:t})},V$=async(t=[],e=process.cwd())=>{await nn(["add",".",...t],{cwd:e})},H$=async(t=process.cwd())=>{let e=await nn(["status","-s"],{cwd:t});return String(e.stdout??"")},Iie=/.. (.+)?\.log$/,ZFe=[Iie],JFe=async(t=process.cwd())=>{let e=await H$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
115
115
  `).filter(i=>ZFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},XFe=async(t=process.cwd())=>{try{return await nn(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},q_=async(t=process.cwd())=>{let{stdout:e}=await nn(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Cie=async(t=process.cwd())=>{let{stdout:e}=await nn(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},W$=async(t,e=process.cwd())=>{t||=await H$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
116
116
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${Zw.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(Iie)?.[1];o&&n.push(`:!${o}.log`)}),n},Pie=async(t=process.cwd())=>{await nn(["reset","--hard","HEAD"],{cwd:t})},Oie=async(t=process.cwd())=>{let e=await nn(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
117
117
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},QFe=t=>{let e=t.split(`
@@ -244,7 +244,7 @@ Wrong idea: "This exceeds a single-session budget, so I'm only building the UI."
244
244
  Judge the user's request BEFORE scaffolding a template or writing any file. Pick one of three cases:
245
245
 
246
246
  1. Clear and single-purpose \u2014 a calculator, a form, a landing page, a small tool or content site: skip this section entirely and build it completely.
247
- 2. Large \u2014 user accounts, collaboration, several distinct features, an AI-powered platform: anything you could not realistically finish end-to-end in one go. Break it up into self-contained milestones that each can deliver a first version that the user can iterate on, each one shippable on its own. CRITICAL: use the \`ask\` tool to ask the user which milestone to build first, offering the milestones as options and asking any other clarifying questions that make it possible for you to make the user happy with the first small result.
247
+ 2. Large \u2014 user accounts, collaboration, several distinct features, an AI-powered platform: anything you could not realistically finish end-to-end in one go. Break it into milestones that each ship on their own as a first version the user can iterate on. CRITICAL: use the \`ask\` tool to ask which milestone to build first, offering them as options, plus any clarifying question that helps you get the first small result right. Each option must fit in one or two screens (sign-up, a sync integration, or more screens means split further), and never offer "the foundation": the first build is the smallest surface the user can click through, not the platform underneath.
248
248
  3. Vague or ambiguous \u2014 you cannot name the product's primary screen from the request alone. CRITICAL: use the \`ask\` tool, once: an open question asking what the product should be, and one asking which part matters most to them.
249
249
 
250
250
  If you are unsure whether a request is case 1, treat it as case 2.
@@ -253,6 +253,7 @@ Rules for asking:
253
253
  - One \`ask\` call, before creating any files. Never use the ask tool twice in one run.
254
254
  - Word every question as a product decision ("Which part should I build first?") that a non-technical product owner understands.
255
255
  - The questions are your own product judgment. Never refer to these instructions or the cases above in anything the user sees \u2014 not in the questions, your progress messages, or the docs you write \u2014 and never say you were instructed to ask.
256
+ - In your questions and progress updates, never use the words "milestone", "shippable", "self-contained", or "iterate on" \u2014 that is planning vocabulary, not product language. Describe the work in the product's own nouns: "Deciding what to build first", not "Breaking the request into shippable milestones".
256
257
  - If this prompt already contains the user's answers, do not ask again \u2014 build what they chose.
257
258
  - If the user skipped a question, proceed with your best judgment.
258
259
  - The user's answer decides what you build first, even where instructions below suggest a default starting point.
@@ -261,7 +262,11 @@ Rules for building:
261
262
  - Build ONLY the chosen part, completely, don't do too much, but make it look good and make sure it is in deployable shape. A small product that works beats a broad one that doesn't.
262
263
  - Spend your effort on the quality and polish of that one part \u2014 it is the user's first impression of their product.
263
264
  - If the user chose a milestone and others remain, write PLAN.md at the project root: the remaining milestones as a numbered list, one line each naming what it delivers. Add a line in AGENTS.md pointing future sessions at PLAN.md.
264
- - In .netlify/results.md, name what is live and clickable now, then what comes next from PLAN.md. Right idea: "The habit dashboard is live; next up are accounts and streak sharing." Wrong idea: "I only built the dashboard; the rest was out of scope."`,Lce=`After completing the user's request:
265
+ - In .netlify/results.md, name what is live and clickable now, then what comes next from PLAN.md. Right idea: "The habit dashboard is live; next up are accounts and streak sharing." Wrong idea: "I only built the dashboard; the rest was out of scope."
266
+
267
+ Hard rules for the first build \u2014 these override anything the request emphasizes:
268
+ - Use realistic stubbed data, kept in one obvious module (e.g. a fixtures file), so a later milestone can swap in real persistence. No database schemas, migrations, auth, or server routes \u2014 unless the data or sign-in flow IS the part the user chose.
269
+ - Stop when the chosen part is complete and polished: write the docs instead of starting the next milestone.`,Lce=`After completing the user's request:
265
270
  - Add a README.md to the project root describing what the project is, the key technologies used, and how to run it locally.
266
271
  - Add an AGENTS.md to the project root describing the project architecture, key directories, coding conventions, and any non-obvious decisions. This file is read by AI agents in future sessions to understand the project.
267
272
 
@@ -316,16 +321,16 @@ NETLIFY_BUILD_BASE="\${NETLIFY_BUILD_BASE:-${EGe}}" ${e} ${r} <template-id> [--p
316
321
 
317
322
  Replace \`<template-id>\` with the matching template \`id\`. Include \`--package-manager\` only if the user specified one. The templates can include relevant agent skills. The \`NETLIFY_BUILD_BASE=\u2026\` prefix lets the scaffold use a local template mirror if the platform set one \u2014 leave it as-is. Follow the instructions printed by the scaffold command.`:"",a="You are creating a new Netlify project to fulfill the user's request. The project directory is currently empty.",c=[a,s,Lce];return n?c=[a,SGe,s]:i&&(c=[a,yGe,s,Lce]),c.filter(Boolean).join(`
318
323
 
319
- `)},AGe=t=>{try{return JSON.parse(cGe(Ky.join(t,".netlify","scaffold-result.json"),"utf8"))}catch{return}},Uce=async t=>{let e=AGe(t);await dt(Ke(),"create-scaffold-telemetry",r=>{r?.setAttributes({"create.template":e?.template??"none","create.packageManager":e?.packageManager??"none"})})},Fce=async({config:t,cwd:e=mI.cwd()})=>await dt(Ke(),"create-stage",async r=>{let n=performance.now();r?.setAttributes({"create.runner":t.runner,"create.id":t.id,"create.sessionId":t.sessionId}),await Mce(e,[".netlify",".git","node_modules"]),cu.info("Cleaned cwd folder");let{nodeCmd:i,tsCliPath:o}=vGe({cwd:e}),s=[];if(o){let p=[o,"--list-addons-json"];cu.log(`Running ${i} ${p.join(" ")}`);let{stdout:h}=await zt(i,p);s=TGe(h),cu.info("Retrieved add-ons")}else cu.warn("ts-cli binary not resolved; create-mode prompt will omit template section"),ce.inc("context.degraded",1,{component:"templates"});let a=$e(),c=dc(t),l=a.creditWrapUpEnabled&&c,u=c&&a.createAskFirstEnabled&&a.questionsEnabled;u&&(cu.log("Low budget create run - Instructing the agent to ask for clarity if necessary",{accountType:t.accountType,sessionCreditLimit:t.sessionCreditLimit}),ce.inc("create.low_budget_limit_ask",1,{low_budget:c})),l&&cu.log("Budget-constrained create run \u2014 using plan + first-milestone instructions",{accountType:t.accountType,sessionCreditLimit:t.sessionCreditLimit}),ce.inc("create.budget_constrained",1,{constrained:l});let d=bGe({templates:s,nodeCmd:i,scaffoldScriptPath:uGe,budgetConstrained:l,askUserClarity:u}),f=performance.now()-n;return r?.setAttributes({"create.duration.ms":f,"create.status":"success","create.budget_constrained":l,"create.ask_user_clarity":u}),{additionalContext:d}});var Ls={Task:{name:"Task",category:W.Task},Agent:{name:"Task",category:W.Task},SendMessage:{name:"Message agent",category:W.Task},TaskOutput:{name:"Get task output",category:W.Task},TaskStop:{name:"Stop task",category:W.Task},TaskCreate:{name:"Update task list",category:W.Todo},TaskUpdate:{name:"Update task list",category:W.Todo},TaskList:{name:"Read task list",category:W.Todo},TaskGet:{name:"Read task list",category:W.Todo},ToolSearch:{name:"Load tools",category:W.Explore},Skill:{name:"Use skill",category:W.Skill},EnterPlanMode:{name:"Start planning",category:W.Plan},ListMcpResources:{name:"List resources",category:W.Explore},ReadMcpResource:{name:"Read resource",category:W.Explore},Bash:{name:"Run command",category:W.RunCommand},Glob:{name:"Find files",category:W.Explore},Grep:{name:"Search files",category:W.Explore},LS:{name:"List directory",category:W.Explore},ExitPlanMode:{name:"Exit planning",category:W.Plan},Read:{name:"Read file",category:W.FileRead},Edit:{name:"Edit file",category:W.FileWrite},MultiEdit:{name:"Edit multiple files",category:W.FileWrite},Write:{name:"Edit file",category:W.FileWrite},NotebookEdit:{name:"Edit notebook",category:W.Notebook},WebFetch:{name:"Fetch web",category:W.Web},TodoWrite:{name:"Update task list",category:W.Todo},WebSearch:{name:"Search web",category:W.Web},BashOutput:{name:"Get command output",category:W.RunCommand},KillBash:{name:"Stop command",category:W.RunCommand}},Zy=t=>{if(Ls[t])return Ls[t].name;let e=t.match(/^mcp__(.+?)__(.+)$/);return e?`${e[2].replace(/_/g," ")} (${e[1]})`:t},L2=t=>t==="Task"||t==="Agent",Bce=t=>{let[e=""]=t.split(`
324
+ `)},AGe=t=>{try{return JSON.parse(cGe(Ky.join(t,".netlify","scaffold-result.json"),"utf8"))}catch{return}},Uce=async t=>{let e=AGe(t);await dt(Ke(),"create-scaffold-telemetry",r=>{r?.setAttributes({"create.template":e?.template??"none","create.packageManager":e?.packageManager??"none"})})},Fce=async({config:t,cwd:e=mI.cwd()})=>await dt(Ke(),"create-stage",async r=>{let n=performance.now();r?.setAttributes({"create.runner":t.runner,"create.id":t.id,"create.sessionId":t.sessionId}),await Mce(e,[".netlify",".git","node_modules"]),cu.info("Cleaned cwd folder");let i=$e(),{nodeCmd:o,tsCliPath:s}=vGe({cwd:e}),a=[];if(s){let p=[s,"--list-addons-json"];cu.log(`Running ${o} ${p.join(" ")}`);let{stdout:h}=await zt(o,p);a=TGe(h),cu.info("Retrieved add-ons")}else cu.warn("ts-cli binary not resolved; create-mode prompt will omit template section"),ce.inc("context.degraded",1,{component:"templates"});let c=dc(t),l=i.creditWrapUpEnabled&&c,u=c&&i.createAskFirstEnabled&&i.questionsEnabled;u&&(cu.log("Low budget create run - Instructing the agent to ask for clarity if necessary",{accountType:t.accountType,sessionCreditLimit:t.sessionCreditLimit}),ce.inc("create.low_budget_limit_ask",1,{low_budget:c})),l&&cu.log("Budget-constrained create run \u2014 using plan + first-milestone instructions",{accountType:t.accountType,sessionCreditLimit:t.sessionCreditLimit}),ce.inc("create.budget_constrained",1,{constrained:l});let d=bGe({templates:a,nodeCmd:o,scaffoldScriptPath:uGe,budgetConstrained:l,askUserClarity:u}),f=performance.now()-n;return r?.setAttributes({"create.duration.ms":f,"create.status":"success","create.budget_constrained":l,"create.ask_user_clarity":u}),{additionalContext:d}});var Ls={Task:{name:"Task",category:W.Task},Agent:{name:"Task",category:W.Task},SendMessage:{name:"Message agent",category:W.Task},TaskOutput:{name:"Get task output",category:W.Task},TaskStop:{name:"Stop task",category:W.Task},TaskCreate:{name:"Update task list",category:W.Todo},TaskUpdate:{name:"Update task list",category:W.Todo},TaskList:{name:"Read task list",category:W.Todo},TaskGet:{name:"Read task list",category:W.Todo},ToolSearch:{name:"Load tools",category:W.Explore},Skill:{name:"Use skill",category:W.Skill},EnterPlanMode:{name:"Start planning",category:W.Plan},ListMcpResources:{name:"List resources",category:W.Explore},ReadMcpResource:{name:"Read resource",category:W.Explore},Bash:{name:"Run command",category:W.RunCommand},Glob:{name:"Find files",category:W.Explore},Grep:{name:"Search files",category:W.Explore},LS:{name:"List directory",category:W.Explore},ExitPlanMode:{name:"Exit planning",category:W.Plan},Read:{name:"Read file",category:W.FileRead},Edit:{name:"Edit file",category:W.FileWrite},MultiEdit:{name:"Edit multiple files",category:W.FileWrite},Write:{name:"Edit file",category:W.FileWrite},NotebookEdit:{name:"Edit notebook",category:W.Notebook},WebFetch:{name:"Fetch web",category:W.Web},TodoWrite:{name:"Update task list",category:W.Todo},WebSearch:{name:"Search web",category:W.Web},BashOutput:{name:"Get command output",category:W.RunCommand},KillBash:{name:"Stop command",category:W.RunCommand}},Zy=t=>{if(Ls[t])return Ls[t].name;let e=t.match(/^mcp__(.+?)__(.+)$/);return e?`${e[2].replace(/_/g," ")} (${e[1]})`:t},L2=t=>t==="Task"||t==="Agent",Bce=t=>{let[e=""]=t.split(`
320
325
  `,1);return/^(Async agent launched successfully|Agent launched in background)/.test(e)||/\(internal ID:?\s*[\w./-]+\)/i.test(e)},jce=new Set(["SendMessage","ToolSearch","TaskList","TaskGet","EnterPlanMode","TaskStop"]);var ln=ue("runner_claude"),Jy="Claude Code",Gce="claude-opus-5",xGe={[XD]:"claude-sonnet-5"};async function RGe({aiGateway:t,config:e,model:r}){let n=r;if(t)if(e.modelVersionOverrides?.claude){let i=e.modelVersionOverrides?.claude?.[e.accountType];if(i){if(!await t.isModelAvailableForProvider("anthropic",i))throw new Error(`Model override '${i}' is not available for anthropic provider`);n=i}}else if(r){if(!await t.isModelAvailableForProvider("anthropic",r))throw new Error(`Model '${r}' is not available for anthropic provider`)}else{let i=xGe[e.accountType],o=i||Gce;!!o&&await t.isModelAvailableForProvider("anthropic",o)?(ln.log(`Using ${i?"account override":"default"} model: ${o}`),n=o):o&&ln.log(`Model ${o} is not available, proceeding without model specification`)}return n}function IGe({aiGateway:t}){if(t){let{token:e,url:r}=t;if(!e||!r)throw new Error("No token or url provided from AI Gateway");return{...qp.env,ANTHROPIC_API_KEY:e,ANTHROPIC_BASE_URL:r}}if(!qp.env.ANTHROPIC_API_KEY)throw new Error("ANTHROPIC_API_KEY is not provided");return{...qp.env}}async function CGe(){let t=Xy.join(qp.cwd(),"AGENTS.md");try{await Gp.access(t)}catch{return}let e=Xy.join(qp.cwd(),"CLAUDE.local.md"),r="@AGENTS.md";try{if((await Gp.readFile(e,"utf-8")).includes(r))return;await Gp.appendFile(e,`
321
326
  ${r}
322
327
  `)}catch{await Gp.writeFile(e,`${r}
323
- `)}ln.log("Added @AGENTS.md import to CLAUDE.local.md")}async function $2({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=qp.cwd(),cliPath:a="netlify",abortSignal:c,onSessionId:l,forceLowEffortForCreditWrapUp:u}){let d=t,{prompt:f}=d,{model:p}=t,h="";await CGe();let m=IGe({aiGateway:n}),S=await RGe({config:t,aiGateway:n,model:p}),E=[],b=[],A={},y=new Set,x=[],C=X=>X?.match(/task\s+#([\w-]+)\s+created/i)?.[1],O=X=>{if(typeof X=="string")return X;if(Array.isArray(X))return X.filter(q=>q?.type==="text"&&typeof q.text=="string").map(q=>q.text).join(`
324
- `)||void 0},N=(X,K)=>{let q=X.input||{};if(X.name==="TaskCreate"){x.push({id:C(K),subject:typeof q.subject=="string"?q.subject:"",activeForm:typeof q.activeForm=="string"?q.activeForm:void 0,status:"pending"});return}let Se=typeof q.taskId=="string"?q.taskId:void 0,xe=Se===void 0?void 0:x.find(Ye=>Ye.id===Se);if(!xe&&typeof q.subject=="string"){let Ye=x.filter(Ht=>Ht.subject===q.subject);Ye.length===1&&(xe=Ye[0])}if(q.status==="deleted"){xe&&x.splice(x.indexOf(xe),1);return}if(!xe){if(Se===void 0||typeof q.subject!="string"&&typeof q.activeForm!="string")return;xe={id:Se,subject:"",status:"pending"},x.push(xe)}typeof q.status=="string"&&(xe.status=q.status),typeof q.subject=="string"&&(xe.subject=q.subject),typeof q.activeForm=="string"&&(xe.activeForm=q.activeForm)},R=()=>x.map(X=>({name:X.status==="in_progress"&&X.activeForm||X.subject,value:X.status})),$=0,_=0,ee,k,g,v,I="",J="mode"in t&&t.mode==="create"&&t.accountType===XD,G="mode"in t&&t.mode==="ask",le=$e().questionsEnabled,Oe=$e().creditWrapUpEnabled&&dc(t),Ie=J&&!Oe,Ne=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Ie&&Ne.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),G&&(Ne.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),dp(t)||Ne.push(...Cx(a).map(X=>`Bash(${X}:*)`)));let Re=lp("claude",t.effort);t.effort&&!Re&&ln.log(`Effort '${t.effort}' is not available on ${Jy}; using its default`);let ke=u||Ie?"low":Re??"high",we=ki(s,"claude");if(!we)throw new Error("Claude CLI binary not found");let fe=le?await Poe():void 0,ye=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",Ne.join(","),...fe?.args??[],"--effort",ke,...S?["--model",S]:[],...i?o?["--resume",o]:["--continue"]:[],"-p"];ln.log(`Running ${we} ${ye.join(" ")}`);let Be=e.utils.run(we,ye,{all:!0,env:m,cwd:s,idleTimeout:ps,cancelSignal:c});Be.stdin?.end(f);let H=Ua(()=>{r?.({steps:E,duration:_})},250),oe=(X,K)=>{let{wrapMessage:q,...Se}=X,xe=Yw({...Se,id:$});xe.message&&(xe.message=xe.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),q&&xe.message&&(xe.message=`\`\`\`
328
+ `)}ln.log("Added @AGENTS.md import to CLAUDE.local.md")}async function $2({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=qp.cwd(),cliPath:a="netlify",abortSignal:c,onSessionId:l,forceLowEffortForCreditWrapUp:u}){let d=t,{prompt:f}=d,{model:p}=t,h="";await CGe();let m=IGe({aiGateway:n}),S=await RGe({config:t,aiGateway:n,model:p}),E=[],b=[],A={},y=new Set,x=[],C=X=>X?.match(/task\s+#([\w-]+)\s+created/i)?.[1],O=X=>{if(typeof X=="string")return X;if(Array.isArray(X))return X.filter(G=>G?.type==="text"&&typeof G.text=="string").map(G=>G.text).join(`
329
+ `)||void 0},N=(X,K)=>{let G=X.input||{};if(X.name==="TaskCreate"){x.push({id:C(K),subject:typeof G.subject=="string"?G.subject:"",activeForm:typeof G.activeForm=="string"?G.activeForm:void 0,status:"pending"});return}let Se=typeof G.taskId=="string"?G.taskId:void 0,xe=Se===void 0?void 0:x.find(Ye=>Ye.id===Se);if(!xe&&typeof G.subject=="string"){let Ye=x.filter(Ht=>Ht.subject===G.subject);Ye.length===1&&(xe=Ye[0])}if(G.status==="deleted"){xe&&x.splice(x.indexOf(xe),1);return}if(!xe){if(Se===void 0||typeof G.subject!="string"&&typeof G.activeForm!="string")return;xe={id:Se,subject:"",status:"pending"},x.push(xe)}typeof G.status=="string"&&(xe.status=G.status),typeof G.subject=="string"&&(xe.subject=G.subject),typeof G.activeForm=="string"&&(xe.activeForm=G.activeForm)},R=()=>x.map(X=>({name:X.status==="in_progress"&&X.activeForm||X.subject,value:X.status})),$=0,_=0,ee,k,g,v,I="",J="mode"in t&&t.mode==="create"&&t.accountType===XD,q="mode"in t&&t.mode==="ask",le=$e().questionsEnabled,Oe=$e().creditWrapUpEnabled&&dc(t),Ie=J&&!Oe,Ne=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Ie&&Ne.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),q&&(Ne.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),dp(t)||Ne.push(...Cx(a).map(X=>`Bash(${X}:*)`)));let Re=lp("claude",t.effort);t.effort&&!Re&&ln.log(`Effort '${t.effort}' is not available on ${Jy}; using its default`);let ke=u||Ie?"low":Re??"high",we=ki(s,"claude");if(!we)throw new Error("Claude CLI binary not found");let fe=le?await Poe():void 0,ye=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",Ne.join(","),...fe?.args??[],"--effort",ke,...S?["--model",S]:[],...i?o?["--resume",o]:["--continue"]:[],"-p"];ln.log(`Running ${we} ${ye.join(" ")}`);let Be=e.utils.run(we,ye,{all:!0,env:m,cwd:s,idleTimeout:ps,cancelSignal:c});Be.stdin?.end(f);let H=Ua(()=>{r?.({steps:E,duration:_})},250),oe=(X,K)=>{let{wrapMessage:G,...Se}=X,xe=Yw({...Se,id:$});xe.message&&(xe.message=xe.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),G&&xe.message&&(xe.message=`\`\`\`
325
330
  ${xe.message}
326
- \`\`\``)),$+=1,b.push(xe),E.push(xe),K||H.flush(),H(),K&&H.flush()},M=S||Gce,P=Ie?`Using ${Jy} with ${M} and low effort because you are reaching your user limit`:`Using ${Jy} with ${M}`;t.answeredInteraction||oe({title:P,category:W.Environment},!0);let D=wGe.createInterface({input:Be.all});D.on("error",X=>{ln.error("Readline interface error",{error:X.message,stack:X.stack})}),D.on("line",X=>{let K=null;try{K=JSON.parse(X)}catch{ln.log("Could not parse line",X)}K?.session_id&&K.session_id!==h&&(h=K.session_id,l?.(h)),Array.isArray(K?.message?.content)?K.message.content.forEach(q=>{switch(q.type){case"text":{if(q.text){if(q.text.startsWith("Base directory for this skill:"))break;K.message?.role!=="user"&&(I=q.text),oe({message:q.text,category:K.message?.role==="user"?W.SubagentPrompt:W.AgentMessage,parentGroupId:K.parent_tool_use_id||void 0})}break}case"image":{typeof q.source=="object"&&q.source&&q.source.type==="base64"&&q.source.media_type?oe({message:`![](data:${q.source.media_type};base64,${q.source.data})`,category:W.AgentMessage,parentGroupId:K.parent_tool_use_id||void 0}):ln.log(`Unsupported image type ${q.source?.type}`,q.source);break}case"tool_use":{if(q.name&&!Ls[q.name]&&!y.has(q.name)&&(y.add(q.name),ln.log(`Unmapped tool in stream: ${q.name}`)),L2(q.name)){let Se=q.input?.description&&`\`${q.input.description}\``;oe({title:[Zy(q.name),Se].filter(Boolean).join(" "),category:Ls[q.name]?.category,groupId:q.id,parentGroupId:K.parent_tool_use_id||void 0})}else q.name==="Bash"&&Ds(q.input?.command)&&oe({title:"Generating the site",category:W.SiteGeneration,groupId:q.id,parentGroupId:K.parent_tool_use_id||void 0});if(q.name===I1&&q.id&&!v){let Se=oc.safeParse(q.input);Se.success?(v={questions:Se.data.questions},Be.kill()):(ln.warn("Ignoring malformed ask tool input",{toolUseId:q.id,issues:sc(Se.error.issues)}),ce.inc("inference.malformed_ask",1))}q.id&&(A[q.id]=q),H.flush();break}case"tool_result":{let Se=q.tool_use_id?A[q.tool_use_id]:void 0;if(Se?.name===I1)break;let xe=L2(Se?.name),Ye=Se?.name==="Bash"&&Ds(Se?.input?.command);if(Se?.name==="Skill"&&Se?.input?.skill){let Ut=To(Se.input.skill?.toString());Ts(ln,Ut),oe({title:`Use ${Ut}`,category:W.Skill,type:Se.input.skill?.toString(),parentGroupId:K.parent_tool_use_id||void 0},!0);break}if(Se?.name==="TodoWrite"){let{name:Ut,category:At}=Ls.TodoWrite;oe({title:Ut,category:At,parentGroupId:K.parent_tool_use_id||void 0,tasks:K.tool_use_result?.newTodos?.map(Yu=>({name:Yu.status==="in_progress"?Yu.activeForm:Yu.content,value:Yu.status}))},!0);break}if(Se?.name==="TaskCreate"||Se?.name==="TaskUpdate"){q.is_error||N(Se,O(q.content)),oe({title:Zy(Se.name),category:W.Todo,parentGroupId:K.parent_tool_use_id||void 0,tasks:R()},!0);break}if(Se?.name&&jce.has(Se.name)){let Ut=Ls[Se.name]?.category||W.Tool,At=Ut===W.Todo&&x.length>0;oe({title:Zy(Se.name),category:Ut===W.Todo&&!At?W.Tool:Ut,parentGroupId:K.parent_tool_use_id||void 0,...At?{tasks:R()}:{}},!0);break}let Ht=!!(Se?.name&&Ls[Se.name]),Hr;if(!xe&&!Ye&&Se){let Ut=Se.input?.file_path&&Xy.relative(s,Se.input.file_path);Ut||(Ut=Se.input?.pattern||Se.input?.command);let At=Ut&&`\`${Ut}\``;Hr=[Zy(Se.name||""),At].filter(Boolean).join(" ")}else!xe&&!Ye&&!Se&&(Hr="Tool result");let gP=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(Se?.name||"")||!xe&&!Ye&&!Ht,Hu=K.parent_tool_use_id||void 0;!Hu&&(xe||Ye)&&(Hu=q.tool_use_id);let Vc,Wu=xe&&K.tool_use_result?.content||q.content;if(typeof Wu=="string")Vc=Wu;else if(Array.isArray(Wu)){let Ut=[];Wu.forEach(At=>{At?.type==="text"&&typeof At.text=="string"?Ut.push(At.text):At?.type==="image"&&typeof At.source=="object"&&At.source?At.source.type==="base64"&&At.source.media_type?Ut.push(`![](data:${At.source.media_type};base64,${At.source.data})`):ln.log(`Unsupported image type ${At.source.type}`,At.source):ln.log(`Unsupported block type ${At?.type}`)}),Vc=Ut.join(`
331
+ \`\`\``)),$+=1,b.push(xe),E.push(xe),K||H.flush(),H(),K&&H.flush()},M=S||Gce,P=Ie?`Using ${Jy} with ${M} and low effort because you are reaching your user limit`:`Using ${Jy} with ${M}`;t.answeredInteraction||oe({title:P,category:W.Environment},!0);let D=wGe.createInterface({input:Be.all});D.on("error",X=>{ln.error("Readline interface error",{error:X.message,stack:X.stack})}),D.on("line",X=>{let K=null;try{K=JSON.parse(X)}catch{ln.log("Could not parse line",X)}K?.session_id&&K.session_id!==h&&(h=K.session_id,l?.(h)),Array.isArray(K?.message?.content)?K.message.content.forEach(G=>{switch(G.type){case"text":{if(G.text){if(G.text.startsWith("Base directory for this skill:")||G.text.startsWith("This session is being continued from a previous conversation"))break;K.message?.role!=="user"&&(I=G.text),oe({message:G.text,category:K.message?.role==="user"?W.SubagentPrompt:W.AgentMessage,parentGroupId:K.parent_tool_use_id||void 0})}break}case"image":{typeof G.source=="object"&&G.source&&G.source.type==="base64"&&G.source.media_type?oe({message:`![](data:${G.source.media_type};base64,${G.source.data})`,category:W.AgentMessage,parentGroupId:K.parent_tool_use_id||void 0}):ln.log(`Unsupported image type ${G.source?.type}`,G.source);break}case"tool_use":{if(G.name&&!Ls[G.name]&&!y.has(G.name)&&(y.add(G.name),ln.log(`Unmapped tool in stream: ${G.name}`)),L2(G.name)){let Se=G.input?.description&&`\`${G.input.description}\``;oe({title:[Zy(G.name),Se].filter(Boolean).join(" "),category:Ls[G.name]?.category,groupId:G.id,parentGroupId:K.parent_tool_use_id||void 0})}else G.name==="Bash"&&Ds(G.input?.command)&&oe({title:"Generating the site",category:W.SiteGeneration,groupId:G.id,parentGroupId:K.parent_tool_use_id||void 0});if(G.name===I1&&G.id&&!v){let Se=oc.safeParse(G.input);Se.success?(v={questions:Se.data.questions},Be.kill()):(ln.warn("Ignoring malformed ask tool input",{toolUseId:G.id,issues:sc(Se.error.issues)}),ce.inc("inference.malformed_ask",1))}G.id&&(A[G.id]=G),H.flush();break}case"tool_result":{let Se=G.tool_use_id?A[G.tool_use_id]:void 0;if(Se?.name===I1)break;let xe=L2(Se?.name),Ye=Se?.name==="Bash"&&Ds(Se?.input?.command);if(Se?.name==="Skill"&&Se?.input?.skill){let Ut=To(Se.input.skill?.toString());Ts(ln,Ut),oe({title:`Use ${Ut}`,category:W.Skill,type:Se.input.skill?.toString(),parentGroupId:K.parent_tool_use_id||void 0},!0);break}if(Se?.name==="TodoWrite"){let{name:Ut,category:At}=Ls.TodoWrite;oe({title:Ut,category:At,parentGroupId:K.parent_tool_use_id||void 0,tasks:K.tool_use_result?.newTodos?.map(Yu=>({name:Yu.status==="in_progress"?Yu.activeForm:Yu.content,value:Yu.status}))},!0);break}if(Se?.name==="TaskCreate"||Se?.name==="TaskUpdate"){G.is_error||N(Se,O(G.content)),oe({title:Zy(Se.name),category:W.Todo,parentGroupId:K.parent_tool_use_id||void 0,tasks:R()},!0);break}if(Se?.name&&jce.has(Se.name)){let Ut=Ls[Se.name]?.category||W.Tool,At=Ut===W.Todo&&x.length>0;oe({title:Zy(Se.name),category:Ut===W.Todo&&!At?W.Tool:Ut,parentGroupId:K.parent_tool_use_id||void 0,...At?{tasks:R()}:{}},!0);break}let Ht=!!(Se?.name&&Ls[Se.name]),Hr;if(!xe&&!Ye&&Se){let Ut=Se.input?.file_path&&Xy.relative(s,Se.input.file_path);Ut||(Ut=Se.input?.pattern||Se.input?.command);let At=Ut&&`\`${Ut}\``;Hr=[Zy(Se.name||""),At].filter(Boolean).join(" ")}else!xe&&!Ye&&!Se&&(Hr="Tool result");let gP=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(Se?.name||"")||!xe&&!Ye&&!Ht,Hu=K.parent_tool_use_id||void 0;!Hu&&(xe||Ye)&&(Hu=G.tool_use_id);let Vc,Wu=xe&&K.tool_use_result?.content||G.content;if(typeof Wu=="string")Vc=Wu;else if(Array.isArray(Wu)){let Ut=[];Wu.forEach(At=>{At?.type==="text"&&typeof At.text=="string"?Ut.push(At.text):At?.type==="image"&&typeof At.source=="object"&&At.source?At.source.type==="base64"&&At.source.media_type?Ut.push(`![](data:${At.source.media_type};base64,${At.source.data})`):ln.log(`Unsupported image type ${At.source.type}`,At.source):ln.log(`Unsupported block type ${At?.type}`)}),Vc=Ut.join(`
327
332
 
328
- `)}if(xe&&Vc&&Bce(Vc)){oe({title:"Running in background",category:W.Task,parentGroupId:Hu},!0);break}oe({title:Hr,message:Vc,wrapMessage:gP,category:xe?W.AgentMessage:Ye?W.SiteGeneration:Ls[Se?.name??""]?.category||W.Tool,parentGroupId:Hu},!0);break}case"thinking":{q.thinking&&oe({title:"Reasoning",message:q.thinking,category:W.Reasoning,parentGroupId:K.parent_tool_use_id||void 0},!0);break}default:ln.log(`Message content type is not supported ${q.type}`,q)}}):K?.type==="result"&&(_=K.duration_ms||0,K.is_error?v||(k=K.result):ee=K.result,K.usage&&(Na(K.usage,S?{model:S}:{}),g=K.usage),[b,E].forEach(q=>{q[q.length-1]?.message===ee&&q.pop()}))});let B=!1;if(await Be.catch(X=>{B=Wa(X,c),{error:k,result:ee}=up({catchError:X,runCmd:Be,error:k,result:ee,runnerName:"Claude"})}),fe&&await Gp.rm(fe.mcpConfigPath,{force:!0}).catch(()=>{}),D.close(),H.flush(),v)return{steps:b,duration:_,agentSessionId:h,resolvedModel:S,effort:ke,usage:g,pendingInteraction:v};let V=B;return V&&(!ee&&I.trim()&&(ee=I.trim()),k=void 0),{steps:b,duration:_,result:await ac({initialResult:ee,agentName:Jy,hasError:!!k}),error:cc({error:k,agentName:Jy}),isRetryableError:lc(k),isProviderUnavailableError:uc(k),agentSessionId:h,resolvedModel:S,effort:ke,usage:g,...V?{aborted:!0}:{}}}var qce=async()=>{let t=Xy.join(zce.homedir(),".claude");await Gp.rm(t,{recursive:!0,force:!0})},Vce={baseDir:Xy.join(zce.homedir(),".claude"),include:["projects"]};import vS from"fs/promises";import TS from"os";import Cc from"path";import Hs from"process";import eqe from"readline";function Ae(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function F(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var U2=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return U2=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Qy(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var eS=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var ge=class extends Error{},Rt=class t extends ge{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new fc({message:n,cause:eS(r)});let o=r?.error;return e===400?new Vp(e,o,n,i):e===401?new Hp(e,o,n,i):e===403?new Wp(e,o,n,i):e===404?new Yp(e,o,n,i):e===409?new Kp(e,o,n,i):e===422?new Zp(e,o,n,i):e===429?new Jp(e,o,n,i):e>=500?new Xp(e,o,n,i):new t(e,o,n,i)}},Dt=class extends Rt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},fc=class extends Rt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pc=class extends fc{constructor({message:e}={}){super({message:e??"Request timed out."})}},Vp=class extends Rt{},Hp=class extends Rt{},Wp=class extends Rt{},Yp=class extends Rt{},Kp=class extends Rt{},Zp=class extends Rt{},Jp=class extends Rt{},Xp=class extends Rt{},Qp=class extends ge{constructor(){super("Could not parse response content as the length limit was reached")}},eh=class extends ge{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Io=class extends Error{constructor(e){super(e)}},lu=class extends Rt{constructor(e,r,n){let i="OAuth2 authentication error",o;if(r&&typeof r=="object"){let s=r;o=s.error;let a=s.error_description;a&&typeof a=="string"?i=a:o&&(i=o)}super(e,r,i,n),this.error_code=o}},tS=class extends ge{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var OGe=/^[a-z][a-z0-9+.-]*:/i,Hce=t=>OGe.test(t),br=t=>(br=Array.isArray,br(t)),F2=br;function B2(t){return typeof t!="object"?{}:t??{}}function j2(t){if(!t)return!0;for(let e in t)return!1;return!0}function Wce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function rS(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Yce=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ge(`${t} must be an integer`);if(e<0)throw new ge(`${t} must be a positive integer`);return e};var Kce=t=>{try{return JSON.parse(t)}catch{return}};var Co=t=>new Promise(e=>setTimeout(e,t));var hc="6.34.0";var Qce=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function NGe(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var kGe=()=>{let t=NGe();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(Deno.build.os),"X-Stainless-Arch":Zce(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zce(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=MGe();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function MGe(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var Zce=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Jce=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Xce,ele=()=>Xce??(Xce=kGe());function gI(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function z2(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function _I(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return z2({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function G2(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function q2(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var rle=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var V2="RFC3986",H2=t=>String(t),W2={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:H2},nle="RFC1738";var yI=(t,e)=>(yI=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),yI(t,e)),Po=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var Y2=1024,ile=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=Y2){let c=o.length>=Y2?o.slice(a,a+Y2):o,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===nle&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=Po[d];continue}if(d<2048){l[l.length]=Po[192|d>>6]+Po[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Po[224|d>>12]+Po[128|d>>6&63]+Po[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Po[240|d>>18]+Po[128|d>>12&63]+Po[128|d>>6&63]+Po[128|d&63]}s+=l.join("")}return s};function ole(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function K2(t,e){if(br(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var ale={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},cle=function(t,e){Array.prototype.push.apply(t,br(e)?e:[e])},sle,qt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ile,encodeValuesOnly:!1,format:V2,formatter:H2,indices:!1,serializeDate(t){return(sle??(sle=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function LGe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var Z2={};function lle(t,e,r,n,i,o,s,a,c,l,u,d,f,p,h,m,S,E){let b=t,A=E,y=0,x=!1;for(;(A=A.get(Z2))!==void 0&&!x;){let $=A.get(t);if(y+=1,typeof $<"u"){if($===y)throw new RangeError("Cyclic object value");x=!0}typeof A.get(Z2)>"u"&&(y=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&br(b)&&(b=K2(b,function($){return $ instanceof Date?f?.($):$})),b===null){if(o)return c&&!m?c(e,qt.encoder,S,"key",p):e;b=""}if(LGe(b)||ole(b)){if(c){let $=m?e:c(e,qt.encoder,S,"key",p);return[h?.($)+"="+h?.(c(b,qt.encoder,S,"value",p))]}return[h?.(e)+"="+h?.(String(b))]}let C=[];if(typeof b>"u")return C;let O;if(r==="comma"&&br(b))m&&c&&(b=K2(b,c)),O=[{value:b.length>0?b.join(",")||null:void 0}];else if(br(l))O=l;else{let $=Object.keys(b);O=u?$.sort(u):$}let N=a?String(e).replace(/\./g,"%2E"):String(e),R=n&&br(b)&&b.length===1?N+"[]":N;if(i&&br(b)&&b.length===0)return R+"[]";for(let $=0;$<O.length;++$){let _=O[$],ee=typeof _=="object"&&typeof _.value<"u"?_.value:b[_];if(s&&ee===null)continue;let k=d&&a?_.replace(/\./g,"%2E"):_,g=br(b)?typeof r=="function"?r(R,k):R:R+(d?"."+k:"["+k+"]");E.set(t,y);let v=new WeakMap;v.set(Z2,E),cle(C,lle(ee,g,r,n,i,o,s,a,r==="comma"&&m&&br(b)?null:c,l,u,d,f,p,h,m,S,v))}return C}function $Ge(t=qt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||qt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=V2;if(typeof t.format<"u"){if(!yI(W2,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=W2[r],i=qt.filter;(typeof t.filter=="function"||br(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ale?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=qt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:qt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:qt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?qt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:qt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:qt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:qt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:qt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:qt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:qt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling}}function ule(t,e={}){let r=t,n=$Ge(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):br(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=ale[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||cle(s,lle(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function dle(t){return ule(t,{arrayFormat:"brackets"})}function hle(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var fle;function th(t){let e;return(fle??(e=new globalThis.TextEncoder,fle=e.encode.bind(e)))(t)}var ple;function J2(t){let e;return(ple??(e=new globalThis.TextDecoder,ple=e.decode.bind(e)))(t)}var In,Cn,uu=class{constructor(){In.set(this,void 0),Cn.set(this,void 0),Ae(this,In,new Uint8Array,"f"),Ae(this,Cn,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?th(e):e;Ae(this,In,hle([F(this,In,"f"),r]),"f");let n=[],i;for(;(i=FGe(F(this,In,"f"),F(this,Cn,"f")))!=null;){if(i.carriage&&F(this,Cn,"f")==null){Ae(this,Cn,i.index,"f");continue}if(F(this,Cn,"f")!=null&&(i.index!==F(this,Cn,"f")+1||i.carriage)){n.push(J2(F(this,In,"f").subarray(0,F(this,Cn,"f")-1))),Ae(this,In,F(this,In,"f").subarray(F(this,Cn,"f")),"f"),Ae(this,Cn,null,"f");continue}let o=F(this,Cn,"f")!==null?i.preceding-1:i.preceding,s=J2(F(this,In,"f").subarray(0,o));n.push(s),Ae(this,In,F(this,In,"f").subarray(i.index),"f"),Ae(this,Cn,null,"f")}return n}flush(){return F(this,In,"f").length?this.decode(`
333
+ `)}if(xe&&Vc&&Bce(Vc)){oe({title:"Running in background",category:W.Task,parentGroupId:Hu},!0);break}oe({title:Hr,message:Vc,wrapMessage:gP,category:xe?W.AgentMessage:Ye?W.SiteGeneration:Ls[Se?.name??""]?.category||W.Tool,parentGroupId:Hu},!0);break}case"thinking":{G.thinking&&oe({title:"Reasoning",message:G.thinking,category:W.Reasoning,parentGroupId:K.parent_tool_use_id||void 0},!0);break}default:ln.log(`Message content type is not supported ${G.type}`,G)}}):K?.type==="result"&&(_=K.duration_ms||0,K.is_error?v||(k=K.result):ee=K.result,K.usage&&(Na(K.usage,S?{model:S}:{}),g=K.usage),[b,E].forEach(G=>{G[G.length-1]?.message===ee&&G.pop()}))});let B=!1;if(await Be.catch(X=>{B=Wa(X,c),{error:k,result:ee}=up({catchError:X,runCmd:Be,error:k,result:ee,runnerName:"Claude"})}),fe&&await Gp.rm(fe.mcpConfigPath,{force:!0}).catch(()=>{}),D.close(),H.flush(),v)return{steps:b,duration:_,agentSessionId:h,resolvedModel:S,effort:ke,usage:g,pendingInteraction:v};let V=B;return V&&(!ee&&I.trim()&&(ee=I.trim()),k=void 0),{steps:b,duration:_,result:await ac({initialResult:ee,agentName:Jy,hasError:!!k}),error:cc({error:k,agentName:Jy}),isRetryableError:lc(k),isProviderUnavailableError:uc(k),agentSessionId:h,resolvedModel:S,effort:ke,usage:g,...V?{aborted:!0}:{}}}var qce=async()=>{let t=Xy.join(zce.homedir(),".claude");await Gp.rm(t,{recursive:!0,force:!0})},Vce={baseDir:Xy.join(zce.homedir(),".claude"),include:["projects"]};import vS from"fs/promises";import TS from"os";import Cc from"path";import Hs from"process";import eqe from"readline";function Ae(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function F(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var U2=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return U2=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Qy(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var eS=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var ge=class extends Error{},Rt=class t extends ge{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new fc({message:n,cause:eS(r)});let o=r?.error;return e===400?new Vp(e,o,n,i):e===401?new Hp(e,o,n,i):e===403?new Wp(e,o,n,i):e===404?new Yp(e,o,n,i):e===409?new Kp(e,o,n,i):e===422?new Zp(e,o,n,i):e===429?new Jp(e,o,n,i):e>=500?new Xp(e,o,n,i):new t(e,o,n,i)}},Dt=class extends Rt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},fc=class extends Rt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pc=class extends fc{constructor({message:e}={}){super({message:e??"Request timed out."})}},Vp=class extends Rt{},Hp=class extends Rt{},Wp=class extends Rt{},Yp=class extends Rt{},Kp=class extends Rt{},Zp=class extends Rt{},Jp=class extends Rt{},Xp=class extends Rt{},Qp=class extends ge{constructor(){super("Could not parse response content as the length limit was reached")}},eh=class extends ge{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Io=class extends Error{constructor(e){super(e)}},lu=class extends Rt{constructor(e,r,n){let i="OAuth2 authentication error",o;if(r&&typeof r=="object"){let s=r;o=s.error;let a=s.error_description;a&&typeof a=="string"?i=a:o&&(i=o)}super(e,r,i,n),this.error_code=o}},tS=class extends ge{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var OGe=/^[a-z][a-z0-9+.-]*:/i,Hce=t=>OGe.test(t),br=t=>(br=Array.isArray,br(t)),F2=br;function B2(t){return typeof t!="object"?{}:t??{}}function j2(t){if(!t)return!0;for(let e in t)return!1;return!0}function Wce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function rS(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Yce=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ge(`${t} must be an integer`);if(e<0)throw new ge(`${t} must be a positive integer`);return e};var Kce=t=>{try{return JSON.parse(t)}catch{return}};var Co=t=>new Promise(e=>setTimeout(e,t));var hc="6.34.0";var Qce=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function NGe(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var kGe=()=>{let t=NGe();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(Deno.build.os),"X-Stainless-Arch":Zce(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zce(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=MGe();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function MGe(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var Zce=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Jce=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Xce,ele=()=>Xce??(Xce=kGe());function gI(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function z2(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function _I(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return z2({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function G2(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function q2(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var rle=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var V2="RFC3986",H2=t=>String(t),W2={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:H2},nle="RFC1738";var yI=(t,e)=>(yI=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),yI(t,e)),Po=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var Y2=1024,ile=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=Y2){let c=o.length>=Y2?o.slice(a,a+Y2):o,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===nle&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=Po[d];continue}if(d<2048){l[l.length]=Po[192|d>>6]+Po[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Po[224|d>>12]+Po[128|d>>6&63]+Po[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Po[240|d>>18]+Po[128|d>>12&63]+Po[128|d>>6&63]+Po[128|d&63]}s+=l.join("")}return s};function ole(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function K2(t,e){if(br(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var ale={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},cle=function(t,e){Array.prototype.push.apply(t,br(e)?e:[e])},sle,qt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ile,encodeValuesOnly:!1,format:V2,formatter:H2,indices:!1,serializeDate(t){return(sle??(sle=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function LGe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var Z2={};function lle(t,e,r,n,i,o,s,a,c,l,u,d,f,p,h,m,S,E){let b=t,A=E,y=0,x=!1;for(;(A=A.get(Z2))!==void 0&&!x;){let $=A.get(t);if(y+=1,typeof $<"u"){if($===y)throw new RangeError("Cyclic object value");x=!0}typeof A.get(Z2)>"u"&&(y=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&br(b)&&(b=K2(b,function($){return $ instanceof Date?f?.($):$})),b===null){if(o)return c&&!m?c(e,qt.encoder,S,"key",p):e;b=""}if(LGe(b)||ole(b)){if(c){let $=m?e:c(e,qt.encoder,S,"key",p);return[h?.($)+"="+h?.(c(b,qt.encoder,S,"value",p))]}return[h?.(e)+"="+h?.(String(b))]}let C=[];if(typeof b>"u")return C;let O;if(r==="comma"&&br(b))m&&c&&(b=K2(b,c)),O=[{value:b.length>0?b.join(",")||null:void 0}];else if(br(l))O=l;else{let $=Object.keys(b);O=u?$.sort(u):$}let N=a?String(e).replace(/\./g,"%2E"):String(e),R=n&&br(b)&&b.length===1?N+"[]":N;if(i&&br(b)&&b.length===0)return R+"[]";for(let $=0;$<O.length;++$){let _=O[$],ee=typeof _=="object"&&typeof _.value<"u"?_.value:b[_];if(s&&ee===null)continue;let k=d&&a?_.replace(/\./g,"%2E"):_,g=br(b)?typeof r=="function"?r(R,k):R:R+(d?"."+k:"["+k+"]");E.set(t,y);let v=new WeakMap;v.set(Z2,E),cle(C,lle(ee,g,r,n,i,o,s,a,r==="comma"&&m&&br(b)?null:c,l,u,d,f,p,h,m,S,v))}return C}function $Ge(t=qt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||qt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=V2;if(typeof t.format<"u"){if(!yI(W2,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=W2[r],i=qt.filter;(typeof t.filter=="function"||br(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ale?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=qt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:qt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:qt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?qt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:qt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:qt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:qt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:qt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:qt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:qt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling}}function ule(t,e={}){let r=t,n=$Ge(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):br(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=ale[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||cle(s,lle(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function dle(t){return ule(t,{arrayFormat:"brackets"})}function hle(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var fle;function th(t){let e;return(fle??(e=new globalThis.TextEncoder,fle=e.encode.bind(e)))(t)}var ple;function J2(t){let e;return(ple??(e=new globalThis.TextDecoder,ple=e.decode.bind(e)))(t)}var In,Cn,uu=class{constructor(){In.set(this,void 0),Cn.set(this,void 0),Ae(this,In,new Uint8Array,"f"),Ae(this,Cn,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?th(e):e;Ae(this,In,hle([F(this,In,"f"),r]),"f");let n=[],i;for(;(i=FGe(F(this,In,"f"),F(this,Cn,"f")))!=null;){if(i.carriage&&F(this,Cn,"f")==null){Ae(this,Cn,i.index,"f");continue}if(F(this,Cn,"f")!=null&&(i.index!==F(this,Cn,"f")+1||i.carriage)){n.push(J2(F(this,In,"f").subarray(0,F(this,Cn,"f")-1))),Ae(this,In,F(this,In,"f").subarray(F(this,Cn,"f")),"f"),Ae(this,Cn,null,"f");continue}let o=F(this,Cn,"f")!==null?i.preceding-1:i.preceding,s=J2(F(this,In,"f").subarray(0,o));n.push(s),Ae(this,In,F(this,In,"f").subarray(i.index),"f"),Ae(this,Cn,null,"f")}return n}flush(){return F(this,In,"f").length?this.decode(`
329
334
  `):[]}};In=new WeakMap,Cn=new WeakMap;uu.NEWLINE_CHARS=new Set([`
330
335
  `,"\r"]);uu.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function FGe(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function mle(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var EI={off:0,error:200,warn:300,info:400,debug:500},X2=(t,e,r)=>{if(t){if(Wce(EI,t))return t;Nt(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(EI))}`)}};function nS(){}function SI(t,e,r){return!e||EI[t]>EI[r]?nS:e[t].bind(e)}var BGe={error:nS,warn:nS,info:nS,debug:nS},gle=new WeakMap;function Nt(t){let e=t.logger,r=t.logLevel??"off";if(!e)return BGe;let n=gle.get(e);if(n&&n[0]===r)return n[1];let i={error:SI("error",e,r),warn:SI("warn",e,r),info:SI("info",e,r),debug:SI("debug",e,r)};return gle.set(e,[r,i]),i}var $s=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var iS,Oo=class t{constructor(e,r,n){this.iterator=e,iS.set(this,void 0),this.controller=r,Ae(this,iS,n,"f")}static fromSSEResponse(e,r,n,i){let o=!1,s=n?Nt(n):console;async function*a(){if(o)throw new ge("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let c=!1;try{for await(let l of jGe(e,r))if(!c){if(l.data.startsWith("[DONE]")){c=!0;continue}if(l.event===null||!l.event.startsWith("thread.")){let u;try{u=JSON.parse(l.data)}catch(d){throw s.error("Could not parse message into JSON:",l.data),s.error("From chunk:",l.raw),d}if(u&&u.error)throw new Rt(void 0,u.error,void 0,e.headers);yield i?{event:l.event,data:u}:u}else{let u;try{u=JSON.parse(l.data)}catch(d){throw console.error("Could not parse message into JSON:",l.data),console.error("From chunk:",l.raw),d}if(l.event=="error")throw new Rt(void 0,u.error,u.message,void 0);yield{event:l.event,data:u}}}c=!0}catch(l){if(Qy(l))return;throw l}finally{c||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*o(){let a=new uu,c=G2(e);for await(let l of c)for(let u of a.decode(l))yield u;for(let l of a.flush())yield l}async function*s(){if(i)throw new ge("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let c of o())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(Qy(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(iS=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),r.push(s)}return o.shift()}});return[new t(()=>i(e),this.controller,F(this,iS,"f")),new t(()=>i(r),this.controller,F(this,iS,"f"))]}toReadableStream(){let e=this,r;return z2({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let s=th(JSON.stringify(i)+`
331
336
  `);n.enqueue(s)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*jGe(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ge("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ge("Attempted to iterate over a response with no body");let r=new Q2,n=new uu,i=G2(t.body);for await(let o of zGe(i))for(let s of n.decode(o)){let a=r.decode(s);a&&(yield a)}for(let o of n.flush()){let s=r.decode(o);s&&(yield s)}}async function*zGe(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?th(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let o;for(;(o=mle(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var Q2=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
@@ -350,9 +355,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
350
355
  `);this.baseURL=c.baseURL,this.timeout=c.timeout??Az.DEFAULT_TIMEOUT,this.logger=c.logger??console;let l="warn";this.logLevel=l,this.logLevel=X2(c.logLevel,"ClientOptions.logLevel",this)??X2(vc("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??l,this.fetchOptions=c.fetchOptions,this.maxRetries=c.maxRetries??2,this.fetch=c.fetch??gI(),Ae(this,qI,rle,"f"),this._options=c,s&&(this._workloadIdentityAuth=new bI(s,this.fetch)),this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=i,this.webhookSecret=o}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return se([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return dle(e)}getUserAgent(){return`${this.constructor.name}/JS ${hc}`}defaultIdempotencyKey(){return`stainless-node-retry-${U2()}`}makeStatusError(e,r,n,i){return Rt.generate(e,r,n,i)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof ge?n:new ge(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new ge(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let i=!F(this,bz,"m",Yle).call(this)&&n||this.baseURL,o=Hce(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),a=Object.fromEntries(o.searchParams);return(!j2(s)||!j2(a))&&(r={...a,...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>({method:e,path:r,...i})))}request(e,r=null){return new du(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let i=await e,o=i.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(i);let{req:s,url:a,timeout:c}=await this.buildRequest(i,{retryCount:o-r});await this.prepareRequest(s,{url:a,options:i});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Nt(this).debug(`[${l}] sending request`,$s({retryOfRequestLogID:n,method:i.method,url:a,options:i,headers:s.headers})),i.signal?.aborted)throw new Dt;let f=new AbortController,p=await this.fetchWithAuth(a,s,c,f).catch(eS),h=Date.now();if(p instanceof globalThis.Error){let E=`retrying, ${r} attempts remaining`;if(i.signal?.aborted)throw new Dt;let b=Qy(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Nt(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${E}`),Nt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${E})`,$s({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),this.retryRequest(i,r,n??l);throw Nt(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Nt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,$s({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),p instanceof lu||p instanceof tS?p:b?new pc:new fc({cause:p})}let m=[...p.headers.entries()].filter(([E])=>E==="x-request-id").map(([E,b])=>", "+E+": "+JSON.stringify(b)).join(""),S=`[${l}${u}${m}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){if(p.status===401&&this._workloadIdentityAuth&&!i.__metadata?.hasStreamingBody&&!i.__metadata?.workloadIdentityTokenRefreshed)return await q2(p.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...i,__metadata:{...i.__metadata,workloadIdentityTokenRefreshed:!0}},r,n??l);let E=await this.shouldRetry(p);if(r&&E){let O=`retrying, ${r} attempts remaining`;return await q2(p.body),Nt(this).info(`${S} - ${O}`),Nt(this).debug(`[${l}] response error (${O})`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(i,r,n??l,p.headers)}let b=E?"error; no more retries left":"error; not retryable";Nt(this).info(`${S} - ${b}`);let A=await p.text().catch(O=>eS(O).message),y=Kce(A),x=y?void 0:A;throw Nt(this).debug(`[${l}] response error (${b})`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:x,durationMs:Date.now()-d})),this.makeStatusError(p.status,y,x,p.headers)}return Nt(this).info(S),Nt(this).debug(`[${l}] response start`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:i,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,n&&"then"in n?n.then(i=>({method:"get",path:e,...i})):{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new aS(this,n,e)}async fetchWithAuth(e,r,n,i){if(this._workloadIdentityAuth){let s=r.headers,a=s.get("Authorization");if(!a||a===`Bearer ${Tz}`){let c=await this._workloadIdentityAuth.getToken();s.set("Authorization",`Bearer ${c}`)}}return await this.fetchWithTimeout(e,r,n,i)}async fetchWithTimeout(e,r,n,i){let{signal:o,method:s,...a}=r||{},c=this._makeAbort(i);o&&o.addEventListener("abort",c,{once:!0});let l=setTimeout(c,n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,d={signal:i.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(d.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){let o,s=i?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(o=c)}let a=i?.get("retry-after");if(a&&!o){let c=parseFloat(a);Number.isNaN(c)?o=Date.parse(a)-Date.now():o=c*1e3}if(o===void 0){let c=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,c)}return await Co(o),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,s=Math.min(.5*Math.pow(2,o),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:i,path:o,query:s,defaultBaseURL:a}=n,c=this.buildURL(o,s,a);"timeout"in n&&Yce("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:u,isStreamingBody:d}=this.buildBody({options:n});d&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:i,bodyHeaders:l,retryCount:r});return{req:{method:i,headers:f,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let s=se([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ele(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let n=se([r]),i=typeof globalThis.ReadableStream<"u"&&e instanceof globalThis.ReadableStream,o=!i&&(typeof e=="string"||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof globalThis.Blob<"u"&&e instanceof globalThis.Blob||e instanceof URLSearchParams||e instanceof FormData);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||i?{bodyHeaders:void 0,body:e,isStreamingBody:!o}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:_I(e),isStreamingBody:!0}:typeof e=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e),isStreamingBody:!1}:{...F(this,qI,"f").call(this,{body:e,headers:n}),isStreamingBody:!1}}};Az=De,qI=new WeakMap,bz=new WeakSet,Yle=function(){return this.baseURL!=="https://api.openai.com/v1"};De.OpenAI=Az;De.DEFAULT_TIMEOUT=6e5;De.OpenAIError=ge;De.APIError=Rt;De.APIConnectionError=fc;De.APIConnectionTimeoutError=pc;De.APIUserAbortError=Dt;De.NotFoundError=Yp;De.ConflictError=Kp;De.RateLimitError=Jp;De.BadRequestError=Vp;De.AuthenticationError=Hp;De.InternalServerError=Xp;De.PermissionDeniedError=Wp;De.UnprocessableEntityError=Zp;De.InvalidWebhookSignatureError=Io;De.toFile=wI;De.Completions=Eu;De.Chat=yc;De.Embeddings=Tu;De.Files=Au;De.Images=Iu;De.Audio=ko;De.Moderations=Pu;De.Models=Cu;De.FineTuning=Fi;De.Graders=xc;De.VectorStores=Vs;De.Webhooks=ku;De.Beta=Ui;De.Batches=mu;De.Uploads=Ic;De.Responses=Gs;De.Realtime=zs;De.Conversations=Ac;De.Evals=wc;De.Containers=bc;De.Skills=qs;De.Videos=Nu;var On=ue("runner_codex"),VI="Codex CLI",$h="gpt-5.6-sol";async function tqe({aiGateway:t,config:e,model:r}){let n=r;if(t)if(e.modelVersionOverrides?.codex){let i=e.modelVersionOverrides?.codex?.[e.accountType];if(i){if(!await t.isModelAvailableForProvider("openai",i))throw new Error(`Model override '${i}' is not available for openai provider`);n=i}}else if(r){if(!await t.isModelAvailableForProvider("openai",r))throw new Error(`Model '${r}' is not available for openai provider`)}else!!$h&&await t.isModelAvailableForProvider("openai",$h)?(n=$h,On.log(`Using default model: ${$h}`)):$h&&On.log(`Default model ${$h} is not available, proceeding without model specification`);return n}var HI="netlify-ask-db",rqe=`default_permissions = "${HI}"`,nqe=()=>Cc.join(Hs.env.XDG_CONFIG_HOME??Cc.join(TS.homedir(),".config"),"netlify"),iqe=t=>["",`[permissions.${HI}]`,'description = "Ask mode: read-only filesystem, network access for database reads"','extends = ":read-only"',"",`[permissions.${HI}.filesystem]`,'":minimal" = "read"','"/" = "read"',`"${t}" = "write"`,"",`[permissions.${HI}.network]`,"enabled = true"];function oqe({aiGateway:t}){if(t){let{token:e,url:r}=t;if(!e||!r)throw new Error("No token or url provided from AI Gateway");Hs.env.OPENAI_API_KEY=e,Hs.env.OPENAI_BASE_URL=r}else if(!Hs.env.OPENAI_API_KEY)throw new Error("OPENAI_API_KEY is not provided")}async function wz({config:t,netlify:e,persistSteps:r,sendSteps:n,aiGateway:i,continueSession:o,priorAgentSessionId:s,cwd:a=Hs.cwd(),abortSignal:c,onSessionId:l,forceLowEffortForCreditWrapUp:u}){let{prompt:d}=t,{model:f}=t;oqe({aiGateway:i});let p=await tqe({config:t,aiGateway:i,model:f}),h=[],m=[],S=[],E={},b=new Set,A=0,y=0,x,C,O,N,R,$=dp(t),_=`${Hs.env.NVM_BIN}/node`,ee=Cc.join(TS.homedir(),".codex"),k=Cc.join(ee,"config.toml"),g=Cc.join(ee,"auth.json");try{await vS.mkdir(ee,{recursive:!0});let oe={OPENAI_API_KEY:Hs.env.OPENAI_API_KEY};await vS.writeFile(g,JSON.stringify(oe,null,2),"utf-8"),On.log("Created Codex auth.json file");let M=Hs.env.OPENAI_BASE_URL,P=['forced_login_method = "api"'],D=$e().questionsEnabled;$&&P.push(rqe),M&&P.push('model_provider = "openai_proxy"',"","[model_providers.openai_proxy]",'name = "OpenAI Proxy"',`base_url = "${M}"`,'env_key = "OPENAI_API_KEY"','wire_api = "responses"',"supports_websockets = false","requires_openai_auth = true"),D&&P.push(...Coe());let B=[];$&&(B=iqe(nqe()),P.push(...B)),await vS.writeFile(k,`${P.join(`
351
356
  `)}
352
357
  `,"utf-8"),On.log("Wrote Codex config.toml",...B.length?[B.join(`
353
- `)]:[])}catch(oe){let M=oe instanceof Error?oe.message:String(oe);throw On.warn("Failed to setup Codex config and credentials",{error:M}),new Error(`Codex setup failed: ${M}`)}let v=p==="gpt-5.6-sol",I=lp("codex",t.effort);t.effort&&!I&&On.log(`Effort '${t.effort}' is not available on ${VI}; using its default`);let J=u?"low":I??(v?"low":void 0),G=J??"high",le=!!(o&&s),Oe="mode"in t&&t.mode==="ask",Ie=!!$,Ne=[ki(a,"codex"),"exec",...Oe&&!Ie?["--sandbox","read-only"]:[],...le?["resume",s]:[],...Oe?[]:["--yolo"],"--json",...J?["-c",`model_reasoning_effort="${J}"`]:[],...p?["--model",p]:[]].filter(Boolean);On.log(`Running ${_} ${Ne.join(" ")}`);let Re=e.utils.run(_,Ne,{all:!0,cwd:a,env:{...Hs.env},stdin:"pipe",idleTimeout:ps,cancelSignal:c});Re.stdin?.end(d);let ke=Ua(()=>{r?.({steps:h,duration:y}),n?.({steps:m,duration:y}),m=[]},250),we=(oe,M)=>{let P={...oe,id:A};A+=1,S.push(P),h.push(P),m.push(P),M||ke.flush(),ke(),M&&ke.flush()},fe=p||"default";t.answeredInteraction||we({title:`Using ${VI} with ${fe}`,category:W.Environment},!0);let ye=eqe.createInterface({input:Re.all});ye.on("error",oe=>{On.error("Readline interface error",{error:oe.message,stack:oe.stack})}),ye.on("line",oe=>{let M;try{M=JSON.parse(oe)}catch{On.log("Could not parse line",oe);return}if(M?.duration_ms&&(y=M.duration_ms),M?.type==="thread.started"&&typeof M?.thread_id=="string"&&(O=M.thread_id,l?.(O)),M?.type==="item.started"&&M?.item?.type==="command_execution")E[M.item.id]=M.item;else if(M?.type==="item.completed"&&M?.item?.type==="command_execution"){let P=M.item,D=cqe(P);D&&we(D,!0);let B=P.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(B&&!b.has(B)){b.add(B);let V=To(B);Ts(On,V),we({title:`Use ${V}`,category:W.Skill,type:B},!0)}}else if(M?.type==="item.completed"&&M?.item?.type==="reasoning"){let P={title:"Reasoning",message:M.item.text,category:W.Reasoning};we(P,!0)}else if(M?.type==="item.completed"&&M?.item?.type==="agent_message")x=M.item.text;else if(M?.type==="item.started"&&M?.item?.type==="mcp_tool_call"){let P=M.item;if(P.server===Ya&&P.tool==="ask"&&!R){let D=oc.safeParse(P.arguments);D.success?(R={questions:D.data.questions},Re.kill()):(On.warn("Ignoring malformed ask tool input",{toolUseId:P.id,issues:sc(D.error.issues)}),ce.inc("inference.malformed_ask",1))}}else if(M?.type==="turn.completed"&&M.usage)N={input_tokens:M.usage.input_tokens,output_tokens:M.usage.output_tokens},Na(N,p?{model:p}:{});else if(M?.type==="turn.failed"&&M?.error?.message)C=M.error.message;else if(M?.type==="local_shell_call"){let P=M;E[P.call_id]=P}else if(M?.type==="local_shell_call_output"){let P=M,D=E[P.call_id],B=lqe(D,P);B&&we(B,!0);let X=(D?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(X&&!b.has(X)){b.add(X);let K=To(X);Ts(On,K),we({title:`Use ${K}`,category:W.Skill,type:X},!0)}}else M?.type==="message"&&M.role==="assistant"?x=M.content?.map(P=>P.text).join(`
358
+ `)]:[])}catch(oe){let M=oe instanceof Error?oe.message:String(oe);throw On.warn("Failed to setup Codex config and credentials",{error:M}),new Error(`Codex setup failed: ${M}`)}let v=p==="gpt-5.6-sol",I=lp("codex",t.effort);t.effort&&!I&&On.log(`Effort '${t.effort}' is not available on ${VI}; using its default`);let J=u?"low":I??(v?"low":void 0),q=J??"high",le=!!(o&&s),Oe="mode"in t&&t.mode==="ask",Ie=!!$,Ne=[ki(a,"codex"),"exec",...Oe&&!Ie?["--sandbox","read-only"]:[],...le?["resume",s]:[],...Oe?[]:["--yolo"],"--json",...J?["-c",`model_reasoning_effort="${J}"`]:[],...p?["--model",p]:[]].filter(Boolean);On.log(`Running ${_} ${Ne.join(" ")}`);let Re=e.utils.run(_,Ne,{all:!0,cwd:a,env:{...Hs.env},stdin:"pipe",idleTimeout:ps,cancelSignal:c});Re.stdin?.end(d);let ke=Ua(()=>{r?.({steps:h,duration:y}),n?.({steps:m,duration:y}),m=[]},250),we=(oe,M)=>{let P={...oe,id:A};A+=1,S.push(P),h.push(P),m.push(P),M||ke.flush(),ke(),M&&ke.flush()},fe=p||"default";t.answeredInteraction||we({title:`Using ${VI} with ${fe}`,category:W.Environment},!0);let ye=eqe.createInterface({input:Re.all});ye.on("error",oe=>{On.error("Readline interface error",{error:oe.message,stack:oe.stack})}),ye.on("line",oe=>{let M;try{M=JSON.parse(oe)}catch{On.log("Could not parse line",oe);return}if(M?.duration_ms&&(y=M.duration_ms),M?.type==="thread.started"&&typeof M?.thread_id=="string"&&(O=M.thread_id,l?.(O)),M?.type==="item.started"&&M?.item?.type==="command_execution")E[M.item.id]=M.item;else if(M?.type==="item.completed"&&M?.item?.type==="command_execution"){let P=M.item,D=cqe(P);D&&we(D,!0);let B=P.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(B&&!b.has(B)){b.add(B);let V=To(B);Ts(On,V),we({title:`Use ${V}`,category:W.Skill,type:B},!0)}}else if(M?.type==="item.completed"&&M?.item?.type==="reasoning"){let P={title:"Reasoning",message:M.item.text,category:W.Reasoning};we(P,!0)}else if(M?.type==="item.completed"&&M?.item?.type==="agent_message")x=M.item.text;else if(M?.type==="item.started"&&M?.item?.type==="mcp_tool_call"){let P=M.item;if(P.server===Ya&&P.tool==="ask"&&!R){let D=oc.safeParse(P.arguments);D.success?(R={questions:D.data.questions},Re.kill()):(On.warn("Ignoring malformed ask tool input",{toolUseId:P.id,issues:sc(D.error.issues)}),ce.inc("inference.malformed_ask",1))}}else if(M?.type==="turn.completed"&&M.usage)N={input_tokens:M.usage.input_tokens,output_tokens:M.usage.output_tokens},Na(N,p?{model:p}:{});else if(M?.type==="turn.failed"&&M?.error?.message)C=M.error.message;else if(M?.type==="local_shell_call"){let P=M;E[P.call_id]=P}else if(M?.type==="local_shell_call_output"){let P=M,D=E[P.call_id],B=lqe(D,P);B&&we(B,!0);let X=(D?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(X&&!b.has(X)){b.add(X);let K=To(X);Ts(On,K),we({title:`Use ${K}`,category:W.Skill,type:X},!0)}}else M?.type==="message"&&M.role==="assistant"?x=M.content?.map(P=>P.text).join(`
354
359
  `):M?.type==="message"&&M.role==="system"&&(C=M.content?.map(P=>P.text).join(`
355
- `))});let Be=!1;if(await Re.catch(oe=>{Be=Wa(oe,c);let M=up({catchError:oe,runCmd:Re,error:C,result:x,runnerName:"Codex"});C=M.error,x=M.result}),ye.close(),ke.flush(),R)return{steps:S,duration:y,agentSessionId:O,resolvedModel:p,effort:G,usage:N,pendingInteraction:R};let H=Be;return H&&(C=void 0),{steps:S,duration:y,result:await ac({initialResult:x,agentName:VI,hasError:!!C}),error:cc({error:C,agentName:VI}),isRetryableError:lc(C),isProviderUnavailableError:uc(C),resolvedModel:p,effort:G,agentSessionId:O,usage:N,...H?{aborted:!0}:{}}}var Kle=async()=>{let t=Cc.join(TS.homedir(),".codex");await vS.rm(t,{recursive:!0,force:!0});let e=Cc.join(TS.homedir(),".agents","skills");await vS.rm(e,{recursive:!0,force:!0})},Zle={baseDir:Cc.join(TS.homedir(),".codex"),include:["sessions"]},sqe=new Set(["bash","-lc"]),aqe=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,Jle=t=>{if(Ds(t))return{title:"Generating the site",category:W.SiteGeneration};let e=t.match(aqe);return e?{title:`Reading \`${e[1]}\``,category:W.FileRead}:{title:`Running \`${t}\``,category:W.RunCommand}},cqe=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=G$(e),{title:i,category:o}=Jle(r),s=t.aggregated_output?.trim();return n?s=`\`\`\`
360
+ `))});let Be=!1;if(await Re.catch(oe=>{Be=Wa(oe,c);let M=up({catchError:oe,runCmd:Re,error:C,result:x,runnerName:"Codex"});C=M.error,x=M.result}),ye.close(),ke.flush(),R)return{steps:S,duration:y,agentSessionId:O,resolvedModel:p,effort:q,usage:N,pendingInteraction:R};let H=Be;return H&&(C=void 0),{steps:S,duration:y,result:await ac({initialResult:x,agentName:VI,hasError:!!C}),error:cc({error:C,agentName:VI}),isRetryableError:lc(C),isProviderUnavailableError:uc(C),resolvedModel:p,effort:q,agentSessionId:O,usage:N,...H?{aborted:!0}:{}}}var Kle=async()=>{let t=Cc.join(TS.homedir(),".codex");await vS.rm(t,{recursive:!0,force:!0});let e=Cc.join(TS.homedir(),".agents","skills");await vS.rm(e,{recursive:!0,force:!0})},Zle={baseDir:Cc.join(TS.homedir(),".codex"),include:["sessions"]},sqe=new Set(["bash","-lc"]),aqe=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,Jle=t=>{if(Ds(t))return{title:"Generating the site",category:W.SiteGeneration};let e=t.match(aqe);return e?{title:`Reading \`${e[1]}\``,category:W.FileRead}:{title:`Running \`${t}\``,category:W.RunCommand}},cqe=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=G$(e),{title:i,category:o}=Jle(r),s=t.aggregated_output?.trim();return n?s=`\`\`\`
356
361
  ${n}
357
362
  \`\`\`${s?`
358
363
 
@@ -383,17 +388,17 @@ commandPrefix = [${i}]
383
388
  decision = "allow"
384
389
  priority = 20
385
390
  `),_r.log("Ask policy allows the read-only database query command",{allowedPrefixes:i})}let n=Pc.join(wS.homedir(),".gemini","ask-policy.toml");return await Mu.mkdir(Pc.dirname(n),{recursive:!0}),await Mu.writeFile(n,r.join(`
386
- `),"utf-8"),n};async function Iz({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:o=!1,priorAgentSessionId:s=void 0,cwd:a=Fh.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,forceLowEffortForCreditWrapUp:d=void 0}){let{prompt:f}=t,p=lp("gemini",t.effort);t.effort&&!p&&_r.log(`Effort '${t.effort}' is not available on ${YI}; using its default`);let h=d?"low":p;Eqe({aiGateway:i});let m=await vqe({aiGateway:i,config:t,model:t.model});await yqe({model:m,effort:h});let S=[],E=[],b=[],A={},y=0,x=0,C,O,N,R,$,_=!!(o&&s),ee=!1;_&&(ee=await AS(s)),_&&!ee&&(_r.log(`Gemini resume requested for session ${s} but it was not resumable; starting a fresh session`),ce.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let k=t.mode==="ask",g=k?await Tqe({config:t,cliPath:c}):void 0,v=[ki(a,"gemini"),...m?["--model",m]:[],...k?["--approval-mode","default","--policy",g]:["--yolo"],"--skip-trust","--output-format","stream-json",...ee?["-r",s]:[],"-p",""],I=`${Fh.env.NVM_BIN}/node`;_r.log(`Running ${I} ${v.join(" ")}`);let J=e.utils.run(I,v,{all:!0,env:{...Fh.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:ps,cancelSignal:l});J.stdin?.end(f);let G=Ua(()=>{r?.({steps:S,duration:x}),n?.({steps:E,duration:x}),E=[]},250),le=(fe,ye)=>{fe.id=y,y+=1,b.push(fe),S.push(fe),E.push(fe),ye||G.flush(),G(),ye&&G.flush()},Oe=m||"default";t.answeredInteraction||le({title:`Using ${YI} with ${Oe}`,category:W.Environment},!0);let Ie=hqe.createInterface({input:J.all});Ie.on("error",fe=>{_r.error("Readline interface error",{error:fe.message,stack:fe.stack})});let Ne="",Re=()=>{Ne&&le({message:Ne.trim(),category:W.AgentMessage}),Ne=""};Ie.on("line",fe=>{let ye;try{if(fe.startsWith("[API Error")){let Be=fe.match(/\[api error: (.+?)]$/i)?.[1];ye={type:"error",value:yie(Be,!1)?.error?.message||Be||"Gemini encountered error"}}else ye=JSON.parse(fe)}catch{return}if(ye)switch(ye.type==="init"&&typeof ye.session_id=="string"&&(R=ye.session_id,u?.(R)),["message","result"].includes(ye.type)||Re(),ye.type){case"message":{ye.role!=="user"&&ye.content&&(Ne+=ye.content);break}case"tool_use":{if(ye.tool_name===woe){if(ye.tool_id&&!$){let X=oc.safeParse(ye.parameters);X.success?($={questions:X.data.questions},J.kill()):(_r.warn("Ignoring malformed ask tool input",{toolUseId:ye.tool_id,issues:sc(X.error.issues)}),ce.inc("inference.malformed_ask",1))}break}let Be=Rz[ye.tool_name]?.name??ye.tool_name,H=ye.parameters?.file_path,oe=H&&Pc.relative(a,H),M=ye.parameters?.command,P=ye.tool_name==="activate_skill"&&ye.parameters?.name,D=ye.tool_name==="run_shell_command"&&Ds(M),B=[Be,oe&&`\`${oe}\``,M&&`\`${M}\``].filter(Boolean).join(" ");if(P)B=`Use ${To(P)}`;else if(D)B="Generating the site";else if(ye.tool_name==="grep_search"){let{dir_path:X,pattern:K}=ye.parameters||{};X&&K?B=`Search in \`${X}\` for \`${K}\``:X?B=`Search in \`${X}\``:K&&(B=`Search for \`${K}\``)}else if(ye.tool_name==="update_topic"){let X=ye.parameters?.title;X&&(B=`${Be} \`${X}\``)}let V={title:B,category:D?W.SiteGeneration:Rz[ye.tool_name]?.category,...P&&{type:P}};A[ye.tool_id]=V,G.flush();break}case"tool_result":{let Be=A[ye.tool_id];Be&&(ye.output&&(Be.message=`\`\`\`
391
+ `),"utf-8"),n};async function Iz({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:o=!1,priorAgentSessionId:s=void 0,cwd:a=Fh.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,forceLowEffortForCreditWrapUp:d=void 0}){let{prompt:f}=t,p=lp("gemini",t.effort);t.effort&&!p&&_r.log(`Effort '${t.effort}' is not available on ${YI}; using its default`);let h=d?"low":p;Eqe({aiGateway:i});let m=await vqe({aiGateway:i,config:t,model:t.model});await yqe({model:m,effort:h});let S=[],E=[],b=[],A={},y=0,x=0,C,O,N,R,$,_=!!(o&&s),ee=!1;_&&(ee=await AS(s)),_&&!ee&&(_r.log(`Gemini resume requested for session ${s} but it was not resumable; starting a fresh session`),ce.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let k=t.mode==="ask",g=k?await Tqe({config:t,cliPath:c}):void 0,v=[ki(a,"gemini"),...m?["--model",m]:[],...k?["--approval-mode","default","--policy",g]:["--yolo"],"--skip-trust","--output-format","stream-json",...ee?["-r",s]:[],"-p",""],I=`${Fh.env.NVM_BIN}/node`;_r.log(`Running ${I} ${v.join(" ")}`);let J=e.utils.run(I,v,{all:!0,env:{...Fh.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:ps,cancelSignal:l});J.stdin?.end(f);let q=Ua(()=>{r?.({steps:S,duration:x}),n?.({steps:E,duration:x}),E=[]},250),le=(fe,ye)=>{fe.id=y,y+=1,b.push(fe),S.push(fe),E.push(fe),ye||q.flush(),q(),ye&&q.flush()},Oe=m||"default";t.answeredInteraction||le({title:`Using ${YI} with ${Oe}`,category:W.Environment},!0);let Ie=hqe.createInterface({input:J.all});Ie.on("error",fe=>{_r.error("Readline interface error",{error:fe.message,stack:fe.stack})});let Ne="",Re=()=>{Ne&&le({message:Ne.trim(),category:W.AgentMessage}),Ne=""};Ie.on("line",fe=>{let ye;try{if(fe.startsWith("[API Error")){let Be=fe.match(/\[api error: (.+?)]$/i)?.[1];ye={type:"error",value:yie(Be,!1)?.error?.message||Be||"Gemini encountered error"}}else ye=JSON.parse(fe)}catch{return}if(ye)switch(ye.type==="init"&&typeof ye.session_id=="string"&&(R=ye.session_id,u?.(R)),["message","result"].includes(ye.type)||Re(),ye.type){case"message":{ye.role!=="user"&&ye.content&&(Ne+=ye.content);break}case"tool_use":{if(ye.tool_name===woe){if(ye.tool_id&&!$){let X=oc.safeParse(ye.parameters);X.success?($={questions:X.data.questions},J.kill()):(_r.warn("Ignoring malformed ask tool input",{toolUseId:ye.tool_id,issues:sc(X.error.issues)}),ce.inc("inference.malformed_ask",1))}break}let Be=Rz[ye.tool_name]?.name??ye.tool_name,H=ye.parameters?.file_path,oe=H&&Pc.relative(a,H),M=ye.parameters?.command,P=ye.tool_name==="activate_skill"&&ye.parameters?.name,D=ye.tool_name==="run_shell_command"&&Ds(M),B=[Be,oe&&`\`${oe}\``,M&&`\`${M}\``].filter(Boolean).join(" ");if(P)B=`Use ${To(P)}`;else if(D)B="Generating the site";else if(ye.tool_name==="grep_search"){let{dir_path:X,pattern:K}=ye.parameters||{};X&&K?B=`Search in \`${X}\` for \`${K}\``:X?B=`Search in \`${X}\``:K&&(B=`Search for \`${K}\``)}else if(ye.tool_name==="update_topic"){let X=ye.parameters?.title;X&&(B=`${Be} \`${X}\``)}let V={title:B,category:D?W.SiteGeneration:Rz[ye.tool_name]?.category,...P&&{type:P}};A[ye.tool_id]=V,q.flush();break}case"tool_result":{let Be=A[ye.tool_id];Be&&(ye.output&&(Be.message=`\`\`\`
387
392
  ${ye.output.trim()}
388
- \`\`\``),le(Be,!0),Sqe(Be));break}case"result":{x=ye.stats?.duration_ms,ye.stats&&(Na(ye.stats,m?{model:m}:{}),N=ye.stats),ye.status==="error"?O=ye.error?.message:C=Ne.trim();break}case"error":{O=ye.error;break}case"finished":break;case"init":break;default:{_r.warn("Unhandled message type:",ye.type);break}}});let ke=!1;if(await J.catch(fe=>{ke=Wa(fe,l),{error:O,result:C}=mqe({catchError:fe,runCmd:J,error:O,result:C,runnerName:"Gemini"})}),Ie.close(),$)return G.flush(),{steps:b,duration:x,agentSessionId:R,resolvedModel:m,usage:N,pendingInteraction:$};let we=ke;return we&&(!C&&Ne.trim()&&(C=Ne.trim()),O=void 0),G.flush(),{steps:b,duration:x,result:await ac({initialResult:C,agentName:YI,hasError:!!O}),error:cc({error:O,agentName:YI}),isRetryableError:lc(O),isProviderUnavailableError:uc(O),resolvedModel:m,usage:N,agentSessionId:R,...h&&Qle(m)?{effort:h}:{},...we?{aborted:!0}:{}}}var eue=async()=>{let t=Pc.join(wS.homedir(),".gemini");await Mu.rm(t,{recursive:!0,force:!0});let e=Pc.join(wS.homedir(),".agents","skills");await Mu.rm(e,{recursive:!0,force:!0})},tue={baseDir:Pc.join(wS.homedir(),".gemini"),include:["tmp"]};import Pz from"fs/promises";import sue from"os";import xS from"path";import Nz from"process";import wqe from"readline";import bqe from"os";import iue from"path";import Cz from"fs";var rue=ue("opencode_install"),nue="1.17.19",Aqe=()=>iue.join(bqe.homedir(),".netlify-agent-runner","opencode"),KI=async t=>{let e=ki(t,"opencode");if(e)return e;let r=Aqe(),n=iue.join(r,"node_modules",".bin","opencode");if(Cz.existsSync(n))return n;Cz.mkdirSync(r,{recursive:!0}),rue.log(`Installing opencode-ai@${nue} on demand`);let i=Date.now();await zt("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${nue}`],{cwd:r});let o=Date.now()-i;if(ce.timing("opencode.install_duration",o),rue.log(`Installed opencode-ai in ${o}ms`),!Cz.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var Ws=ue("runner_opencode"),ZI="OpenCode",aue="gateway",xqe="z-ai/glm-5.2",Rqe=new Set(["z-ai/glm-5.2","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),Iqe=(t,e)=>!t||!xA.includes(t)?t:e&&Rqe.has(e)?"xhigh":"max",Oz={bash:{name:"Run command",category:W.RunCommand},read:{name:"Read file",category:W.FileRead},write:{name:"Edit file",category:W.FileWrite},edit:{name:"Edit file",category:W.FileWrite},glob:{name:"Find files",category:W.Explore},grep:{name:"Search files",category:W.Explore},list:{name:"List directory",category:W.Explore},task:{name:"Task",category:W.Task},todowrite:{name:"Update task list",category:W.Todo},webfetch:{name:"Fetch web",category:W.Web},websearch:{name:"Search web",category:W.Web},skill:{name:"Use Skill",category:W.Skill}},oue=t=>Oz[t]?.name||t,Cqe=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],Pqe=250,Oqe=t=>{let e;try{e=JSON.parse(t)}catch{return{issues:"invalid_json"}}let r=oc.safeParse(e);return r.success?{questions:r.data.questions}:{issues:sc(r.error.issues)}},Nqe=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await Pz.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await Pz.rm(t,{force:!0}).catch(()=>{});let{questions:o,issues:s}=Oqe(i);if(!o){Ws.warn("Ignoring malformed ask tool questions file",{filePath:t,issues:s}),ce.inc("inference.malformed_ask",1);return}r&&e(o)},Pqe);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function kqe({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let o=e.modelVersionOverrides?.opencode?.[e.accountType];o?n=o:r||(n=$e().opencodeDefaultModel||xqe),n&&(await i(n)||Ws.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function Mqe({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:o}=t;if(!i||!o)throw new Error("No token or url provided from AI Gateway");let s=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[aue]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:o},...Object.keys(s).length>0?{models:s}:{}}},...n?{mcp:Roe(n)}:{}};return{...Nz.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function kz({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=Nz.cwd(),abortSignal:a,onSessionId:c,forceLowEffortForCreditWrapUp:l}){let{prompt:u}=t,{model:d}=t,f=l?"low":t.effort,p="",h,m,S,E,b=0,A=0,y,x=await kqe({config:t,aiGateway:n,model:d}),C=Iqe(f,x);Ws.log(f?`Requesting reasoning effort '${f}' for model '${x}'${C===f?"":` (sent as '${C}')`}; ignored if unsupported`:`No reasoning effort requested for model '${x}'; running at its own default`);let O=$e().questionsEnabled?await Ioe():void 0,N=Mqe({aiGateway:n,model:x,effort:C,questionsFilePath:O?.filePath}),R=[],$=[],_=0,ee=Date.now(),k=await KI(s),g=["run","--format","json","--dangerously-skip-permissions","--agent","build",...x?["--model",`${aue}/${x}`]:[],...i?o?["--session",o]:["--continue"]:[]];Ws.log(`Running ${k} ${g.join(" ")}`);let v=e.utils.run(k,g,{all:!0,env:N,cwd:s,idleTimeout:ps,cancelSignal:a});v.stdin?.end(u);let I=O?Nqe(O.filePath,Be=>{y||(y={questions:Be},v.kill())}):void 0,J=Ua(()=>{r?.({steps:$,duration:Date.now()-ee})},250),G=(Be,H)=>{let{wrapMessage:oe,...M}=Be,P=Yw({...M,id:_});P.message&&oe&&(P.message=`\`\`\`
393
+ \`\`\``),le(Be,!0),Sqe(Be));break}case"result":{x=ye.stats?.duration_ms,ye.stats&&(Na(ye.stats,m?{model:m}:{}),N=ye.stats),ye.status==="error"?O=ye.error?.message:C=Ne.trim();break}case"error":{O=ye.error;break}case"finished":break;case"init":break;default:{_r.warn("Unhandled message type:",ye.type);break}}});let ke=!1;if(await J.catch(fe=>{ke=Wa(fe,l),{error:O,result:C}=mqe({catchError:fe,runCmd:J,error:O,result:C,runnerName:"Gemini"})}),Ie.close(),$)return q.flush(),{steps:b,duration:x,agentSessionId:R,resolvedModel:m,usage:N,pendingInteraction:$};let we=ke;return we&&(!C&&Ne.trim()&&(C=Ne.trim()),O=void 0),q.flush(),{steps:b,duration:x,result:await ac({initialResult:C,agentName:YI,hasError:!!O}),error:cc({error:O,agentName:YI}),isRetryableError:lc(O),isProviderUnavailableError:uc(O),resolvedModel:m,usage:N,agentSessionId:R,...h&&Qle(m)?{effort:h}:{},...we?{aborted:!0}:{}}}var eue=async()=>{let t=Pc.join(wS.homedir(),".gemini");await Mu.rm(t,{recursive:!0,force:!0});let e=Pc.join(wS.homedir(),".agents","skills");await Mu.rm(e,{recursive:!0,force:!0})},tue={baseDir:Pc.join(wS.homedir(),".gemini"),include:["tmp"]};import Pz from"fs/promises";import sue from"os";import xS from"path";import Nz from"process";import wqe from"readline";import bqe from"os";import iue from"path";import Cz from"fs";var rue=ue("opencode_install"),nue="1.17.19",Aqe=()=>iue.join(bqe.homedir(),".netlify-agent-runner","opencode"),KI=async t=>{let e=ki(t,"opencode");if(e)return e;let r=Aqe(),n=iue.join(r,"node_modules",".bin","opencode");if(Cz.existsSync(n))return n;Cz.mkdirSync(r,{recursive:!0}),rue.log(`Installing opencode-ai@${nue} on demand`);let i=Date.now();await zt("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${nue}`],{cwd:r});let o=Date.now()-i;if(ce.timing("opencode.install_duration",o),rue.log(`Installed opencode-ai in ${o}ms`),!Cz.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var Ws=ue("runner_opencode"),ZI="OpenCode",aue="gateway",xqe="z-ai/glm-5.2",Rqe=new Set(["z-ai/glm-5.2","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),Iqe=(t,e)=>!t||!xA.includes(t)?t:e&&Rqe.has(e)?"xhigh":"max",Oz={bash:{name:"Run command",category:W.RunCommand},read:{name:"Read file",category:W.FileRead},write:{name:"Edit file",category:W.FileWrite},edit:{name:"Edit file",category:W.FileWrite},glob:{name:"Find files",category:W.Explore},grep:{name:"Search files",category:W.Explore},list:{name:"List directory",category:W.Explore},task:{name:"Task",category:W.Task},todowrite:{name:"Update task list",category:W.Todo},webfetch:{name:"Fetch web",category:W.Web},websearch:{name:"Search web",category:W.Web},skill:{name:"Use Skill",category:W.Skill}},oue=t=>Oz[t]?.name||t,Cqe=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],Pqe=250,Oqe=t=>{let e;try{e=JSON.parse(t)}catch{return{issues:"invalid_json"}}let r=oc.safeParse(e);return r.success?{questions:r.data.questions}:{issues:sc(r.error.issues)}},Nqe=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await Pz.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await Pz.rm(t,{force:!0}).catch(()=>{});let{questions:o,issues:s}=Oqe(i);if(!o){Ws.warn("Ignoring malformed ask tool questions file",{filePath:t,issues:s}),ce.inc("inference.malformed_ask",1);return}r&&e(o)},Pqe);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function kqe({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let o=e.modelVersionOverrides?.opencode?.[e.accountType];o?n=o:r||(n=$e().opencodeDefaultModel||xqe),n&&(await i(n)||Ws.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function Mqe({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:o}=t;if(!i||!o)throw new Error("No token or url provided from AI Gateway");let s=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[aue]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:o},...Object.keys(s).length>0?{models:s}:{}}},...n?{mcp:Roe(n)}:{}};return{...Nz.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function kz({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=Nz.cwd(),abortSignal:a,onSessionId:c,forceLowEffortForCreditWrapUp:l}){let{prompt:u}=t,{model:d}=t,f=l?"low":t.effort,p="",h,m,S,E,b=0,A=0,y,x=await kqe({config:t,aiGateway:n,model:d}),C=Iqe(f,x);Ws.log(f?`Requesting reasoning effort '${f}' for model '${x}'${C===f?"":` (sent as '${C}')`}; ignored if unsupported`:`No reasoning effort requested for model '${x}'; running at its own default`);let O=$e().questionsEnabled?await Ioe():void 0,N=Mqe({aiGateway:n,model:x,effort:C,questionsFilePath:O?.filePath}),R=[],$=[],_=0,ee=Date.now(),k=await KI(s),g=["run","--format","json","--dangerously-skip-permissions","--agent","build",...x?["--model",`${aue}/${x}`]:[],...i?o?["--session",o]:["--continue"]:[]];Ws.log(`Running ${k} ${g.join(" ")}`);let v=e.utils.run(k,g,{all:!0,env:N,cwd:s,idleTimeout:ps,cancelSignal:a});v.stdin?.end(u);let I=O?Nqe(O.filePath,Be=>{y||(y={questions:Be},v.kill())}):void 0,J=Ua(()=>{r?.({steps:$,duration:Date.now()-ee})},250),q=(Be,H)=>{let{wrapMessage:oe,...M}=Be,P=Yw({...M,id:_});P.message&&oe&&(P.message=`\`\`\`
389
394
  ${P.message}
390
- \`\`\``),_+=1,R.push(P),$.push(P),H||J.flush(),J(),H&&J.flush()},le=x||"default";t.answeredInteraction||G({title:`Using ${ZI} with ${le}`,category:W.Environment},!0);let Oe=wqe.createInterface({input:v.all});Oe.on("error",Be=>{Ws.error("Readline interface error",{error:Be.message,stack:Be.stack})});let Ie="",Ne,Re=new Set,ke=()=>{Ie&&(G({message:Ie,category:W.AgentMessage}),Ne=Ie,Ie="")};Oe.on("line",Be=>{let H;try{H=JSON.parse(Be)}catch{Ws.log("Could not parse line",Be);return}switch(H.sessionID&&H.sessionID!==p&&(p=H.sessionID,c?.(p)),H.type){case"step_start":{ke();break}case"text":{let oe=H.part?.text;oe&&(Ie+=oe);break}case"reasoning":{ke();let oe=H.part?.text;oe&&G({title:"Reasoning",message:oe,category:W.Reasoning},!0);break}case"tool_use":{ke();let oe=H.part?.tool;if(!oe)break;let M=H.part?.state?.input??{},P=H.part?.state?.status,D=H.part?.state?.output,B=H.part?.state?.error;if(oe===xoe){P==="error"&&Ws.warn("Ask tool call rejected before it could pause the run",{error:B});break}if(P==="error"&&(b+=1),(P==="completed"||P==="error")&&(A+=1),oe==="skill"){let Ht=typeof M.name=="string"?M.name:void 0;if(Ht){let Hr=To(Ht);Ts(Ws,Hr),G({title:`Use ${Hr}`,category:W.Skill,type:Ht},!0);break}}if(oe==="todowrite"){let Ht=Cqe(M.todos);G({title:oue(oe),category:Ht.length>0?Oz.todowrite.category:W.Tool,...Ht.length>0?{tasks:Ht}:{}},!0);break}let V=typeof M.command=="string"?M.command:void 0,X=V?Ds(V):!1,K=typeof M.path=="string"&&M.path||typeof M.file_path=="string"&&M.file_path||typeof M.pattern=="string"&&M.pattern||void 0,q,Se;if(X)q="Generating the site",Se=W.SiteGeneration;else if(V&&oe==="bash")q=`Running \`${V}\``,Se=W.RunCommand;else{let Ht=K&&`\`${xS.relative(s,K)}\``;q=[oue(oe),Ht].filter(Boolean).join(" "),Se=Oz[oe]?.category||W.AgentMessage}let xe,Ye=["bash","read","glob","grep","list","webfetch","websearch"].includes(oe);B?xe=`\`\`\`
395
+ \`\`\``),_+=1,R.push(P),$.push(P),H||J.flush(),J(),H&&J.flush()},le=x||"default";t.answeredInteraction||q({title:`Using ${ZI} with ${le}`,category:W.Environment},!0);let Oe=wqe.createInterface({input:v.all});Oe.on("error",Be=>{Ws.error("Readline interface error",{error:Be.message,stack:Be.stack})});let Ie="",Ne,Re=new Set,ke=()=>{Ie&&(q({message:Ie,category:W.AgentMessage}),Ne=Ie,Ie="")};Oe.on("line",Be=>{let H;try{H=JSON.parse(Be)}catch{Ws.log("Could not parse line",Be);return}switch(H.sessionID&&H.sessionID!==p&&(p=H.sessionID,c?.(p)),H.type){case"step_start":{ke();break}case"text":{let oe=H.part?.text;oe&&(Ie+=oe);break}case"reasoning":{ke();let oe=H.part?.text;oe&&q({title:"Reasoning",message:oe,category:W.Reasoning},!0);break}case"tool_use":{ke();let oe=H.part?.tool;if(!oe)break;let M=H.part?.state?.input??{},P=H.part?.state?.status,D=H.part?.state?.output,B=H.part?.state?.error;if(oe===xoe){P==="error"&&Ws.warn("Ask tool call rejected before it could pause the run",{error:B});break}if(P==="error"&&(b+=1),(P==="completed"||P==="error")&&(A+=1),oe==="skill"){let Ht=typeof M.name=="string"?M.name:void 0;if(Ht){let Hr=To(Ht);Ts(Ws,Hr),q({title:`Use ${Hr}`,category:W.Skill,type:Ht},!0);break}}if(oe==="todowrite"){let Ht=Cqe(M.todos);q({title:oue(oe),category:Ht.length>0?Oz.todowrite.category:W.Tool,...Ht.length>0?{tasks:Ht}:{}},!0);break}let V=typeof M.command=="string"?M.command:void 0,X=V?Ds(V):!1,K=typeof M.path=="string"&&M.path||typeof M.file_path=="string"&&M.file_path||typeof M.pattern=="string"&&M.pattern||void 0,G,Se;if(X)G="Generating the site",Se=W.SiteGeneration;else if(V&&oe==="bash")G=`Running \`${V}\``,Se=W.RunCommand;else{let Ht=K&&`\`${xS.relative(s,K)}\``;G=[oue(oe),Ht].filter(Boolean).join(" "),Se=Oz[oe]?.category||W.AgentMessage}let xe,Ye=["bash","read","glob","grep","list","webfetch","websearch"].includes(oe);B?xe=`\`\`\`
391
396
  ${B.trim()}
392
397
  \`\`\``:D&&(xe=Ye?`\`\`\`
393
398
  ${D.trim()}
394
399
  \`\`\``:D.trim()),P==="error"&&B&&(xe=xe?`${xe}
395
400
 
396
- *Command failed*`:`*Command failed: ${B.trim()}*`),G({title:q,message:xe,category:Se},!0);break}case"step_finish":{ke();let oe=H.part?.tokens;oe&&(S={input_tokens:(S?.input_tokens??0)+(oe.input??0),output_tokens:(S?.output_tokens??0)+(oe.output??0),reasoning_output_tokens:(S?.reasoning_output_tokens??0)+(oe.reasoning??0),cache_creation_input_tokens:(S?.cache_creation_input_tokens??0)+(oe.cache?.write??0),cache_read_input_tokens:(S?.cache_read_input_tokens??0)+(oe.cache?.read??0)}),H.part?.cost!=null&&(E=(E??0)+H.part.cost);break}case"error":{ke();let M=H.error?.data?.message??H.error?.message??H.part?.state?.error??(H.error?JSON.stringify(H.error).slice(0,500):"unknown error");m=m?`${m}
401
+ *Command failed*`:`*Command failed: ${B.trim()}*`),q({title:G,message:xe,category:Se},!0);break}case"step_finish":{ke();let oe=H.part?.tokens;oe&&(S={input_tokens:(S?.input_tokens??0)+(oe.input??0),output_tokens:(S?.output_tokens??0)+(oe.output??0),reasoning_output_tokens:(S?.reasoning_output_tokens??0)+(oe.reasoning??0),cache_creation_input_tokens:(S?.cache_creation_input_tokens??0)+(oe.cache?.write??0),cache_read_input_tokens:(S?.cache_read_input_tokens??0)+(oe.cache?.read??0)}),H.part?.cost!=null&&(E=(E??0)+H.part.cost);break}case"error":{ke();let M=H.error?.data?.message??H.error?.message??H.part?.state?.error??(H.error?JSON.stringify(H.error).slice(0,500):"unknown error");m=m?`${m}
397
402
  ${M}`:M;break}default:H.type&&!Re.has(H.type)&&(Re.add(H.type),Ws.log(`Unhandled opencode event type: ${H.type}`))}});let we=!1;await v.catch(Be=>{we=Wa(Be,a),ke();let H=up({catchError:Be,runCmd:v,error:m,result:h??Ne,runnerName:ZI});m=H.error,h=H.result}),I?.stop(),await O?.remove();let fe=Date.now()-ee;ke(),Oe.close(),J.flush();let ye=we;return ye&&(m=void 0),!m&&!h&&Ne&&(h=Ne),S&&Na(S,x?{model:x}:{}),y?{steps:R,duration:fe,agentSessionId:p,resolvedModel:x,effort:f,resolvedProviderEffort:C,usage:S,costUsd:E,toolErrorCount:b,toolCallCount:A,pendingInteraction:y}:{steps:R,duration:fe,result:await ac({initialResult:h,agentName:ZI,hasError:!!m}),error:cc({error:m,agentName:ZI}),isRetryableError:lc(m),isProviderUnavailableError:uc(m),agentSessionId:p,resolvedModel:x,effort:f,resolvedProviderEffort:C,usage:S,costUsd:E,toolErrorCount:b,toolCallCount:A,...ye?{aborted:!0}:{}}}var Dqe=()=>xS.join(sue.homedir(),".config","opencode"),cue=()=>{let t=Nz.env.XDG_DATA_HOME,e=t&&xS.isAbsolute(t)?t:xS.join(sue.homedir(),".local","share");return xS.join(e,"opencode")},lue=async()=>{let t=[Dqe(),cue()];await Promise.all(t.map(e=>Pz.rm(e,{recursive:!0,force:!0})))},uue={baseDir:cue(),include:["opencode.db","opencode.db-shm","opencode.db-wal"]};var Mz={codex:{runner:wz,clean:Kle,nativeSessionArchive:Zle},claude:{runner:$2,clean:qce,nativeSessionArchive:Vce},gemini:{runner:Iz,clean:eue,nativeSessionArchive:tue},opencode:{runner:kz,clean:lue,nativeSessionArchive:uue}},Ijt=Object.keys(Mz),Ys=t=>Mz[t]?.nativeSessionArchive,Bh=Mz;import{execSync as Lqe}from"child_process";import due from"fs/promises";import $qe from"path";import jh from"process";var fue=ue("git-wrapper"),Uqe=["status","diff","log","show","rev-parse","rev-list","ls-files","show-ref","cat-file","merge-base","blame","grep","describe"],Fqe=t=>`#!/bin/bash
398
403
  # Git wrapper that only allows read-only commands.
399
404
  # The deployment system handles staging, moves, and commits automatically.
@@ -529,10 +534,10 @@ ${r.siteContext.filter(C=>C.site_context).map(C=>typeof C.site_context=="string"
529
534
 
530
535
  `)}
531
536
  </project_rules>
532
- `);let m="";if(r.sessionHistoryContext?.length){let x=Qe.join(Do.cwd(),fr,JD);await Lt.mkdir(x,{recursive:!0});let C=await Promise.all(r.sessionHistoryContext.map(async(O,N)=>{let R=N+1,$=`attempt-${R}.md`,_=Qe.join(x,$),ee=Qe.join(fr,JD,$),k=QI(O.id),g=k?` ID ${k}`:"",v="";if(k){let J=Qe.resolve(c,Ri),G=Qe.resolve(J,k);G.startsWith(J+Qe.sep)&&await XI(G)&&(v=`
537
+ `);let m="";if(r.sessionHistoryContext?.length){let x=Qe.join(Do.cwd(),fr,JD);await Lt.mkdir(x,{recursive:!0});let C=await Promise.all(r.sessionHistoryContext.map(async(O,N)=>{let R=N+1,$=`attempt-${R}.md`,_=Qe.join(x,$),ee=Qe.join(fr,JD,$),k=QI(O.id),g=k?` ID ${k}`:"",v="";if(k){let J=Qe.resolve(c,Ri),q=Qe.resolve(J,k);q.startsWith(J+Qe.sep)&&await XI(q)&&(v=`
533
538
  ---
534
539
 
535
- ## Assets: ${G}/
540
+ ## Assets: ${q}/
536
541
  `)}let I=`# Task History - Attempt ${R}${g}
537
542
 
538
543
  ## Request - what the user asked for
@@ -568,10 +573,10 @@ Use the following file for the complete context of the ask, the environment, and
568
573
  `);return[t,Cce(n,{skipNote:r&&!i?'A "(skipped)" answer means the user chose not to answer; proceed with your best judgment there.':"",overrideInstruction:i||void 0})].filter(Boolean).join(`
569
574
 
570
575
  `)};import Xs from"fs/promises";import Kme from"os";import Qs from"path";import{rm as Tq}from"fs/promises";import{resolve as TVe}from"path";var bVe=".netlify/cache/",Du=function({cacheDir:t=bVe,cwd:e="."}={}){return TVe(e,t)};import{promises as NKe}from"fs";import{basename as Eme,dirname as vme,join as kKe}from"path";import YYe from"process";import KYe from"events";import rt from"path";import ZYe from"os";async function PS(t,e,{concurrency:r=Number.POSITIVE_INFINITY,stopOnError:n=!0,signal:i}={}){return new Promise((o,s)=>{if(t[Symbol.iterator]===void 0&&t[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof t})`);if(typeof e!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(r)&&r>=1||r===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);let a=[],c=[],l=new Map,u=!1,d=!1,f=!1,p=0,h=0,m=t[Symbol.iterator]===void 0?t[Symbol.asyncIterator]():t[Symbol.iterator](),S=()=>{A(i.reason)},E=()=>{i?.removeEventListener("abort",S)},b=x=>{o(x),E()},A=x=>{u=!0,d=!0,s(x),E()};i&&(i.aborted&&A(i.reason),i.addEventListener("abort",S,{once:!0}));let y=async()=>{if(d)return;let x=await m.next(),C=h;if(h++,x.done){if(f=!0,p===0&&!d){if(!n&&c.length>0){A(new AggregateError(c));return}if(d=!0,l.size===0){b(a);return}let O=[];for(let[N,R]of a.entries())l.get(N)!==que&&O.push(R);b(O)}return}p++,(async()=>{try{let O=await x.value;if(d)return;let N=await e(O,C);N===que&&l.set(C,N),a[C]=N,p--,await y()}catch(O){if(n)A(O);else{c.push(O),p--;try{await y()}catch(N){A(N)}}}})()};(async()=>{for(let x=0;x<r;x++){try{await y()}catch(C){A(C);break}if(f||u)break}})()})}var que=Symbol("skip");import $u from"path";import ozt,{constants as Jz}from"fs";import Xz from"fs/promises";var Gz=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},qz=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Vue=t=>globalThis.DOMException===void 0?new qz(t):new DOMException(t),Hue=t=>{let e=t.reason===void 0?Vue("This operation was aborted."):t.reason;return e instanceof Error?e:Vue(e)};function Vz(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:o={setTimeout,clearTimeout}}=e,s,a,l=new Promise((u,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:p}=e;p.aborted&&d(Hue(p)),a=()=>{d(Hue(p))},p.addEventListener("abort",a,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(u,d);return}let f=new Gz;s=o.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(p){d(p)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?u():i instanceof Error?d(i):(f.message=i??`Promise timed out after ${r} milliseconds`,d(f))},r),(async()=>{try{u(await t)}catch(p){d(p)}})()}).finally(()=>{l.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return l.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},l}var AVe=t=>{let e=t.addEventListener||t.on||t.addListener,r=t.removeEventListener||t.off||t.removeListener;if(!e||!r)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(t),removeListener:r.bind(t)}};function wVe(t,e,r){let n,i=new Promise((o,s)=>{if(r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r},!(r.count>=0&&(r.count===Number.POSITIVE_INFINITY||Number.isInteger(r.count))))throw new TypeError("The `count` option should be at least 0 or more");r.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:u}=AVe(t),d=(...p)=>{let h=r.multiArgs?p:p[0];r.filter&&!r.filter(h)||(c.push(h),r.count===c.length&&(n(),o(c)))},f=p=>{n(),s(p)};n=()=>{for(let p of a)u(p,d);for(let p of r.rejectionEvents)u(p,f)};for(let p of a)l(p,d);for(let p of r.rejectionEvents)l(p,f);r.signal&&r.signal.addEventListener("abort",()=>{f(r.signal.reason)},{once:!0}),r.resolveImmediately&&o(c)});if(i.cancel=n,typeof r.timeout=="number"){let o=Vz(i,{milliseconds:r.timeout});return o.cancel=n,o}return i}function eC(t,e,r){typeof r=="function"&&(r={filter:r}),r={...r,count:1,resolveImmediately:!1};let n=wVe(t,e,r),i=n.then(o=>o[0]);return i.cancel=n.cancel,i}var Gr=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CopyFileError"}};var Bi=Yr(nde(),1);import{promisify as OS}from"util";var X2t=OS(Bi.default.stat),LVe=OS(Bi.default.lstat),$Ve=OS(Bi.default.utimes),UVe=OS(Bi.default.chmod),FVe=OS(Bi.default.mkdir),Q2t=Bi.default.closeSync.bind(Bi.default),ide=Bi.default.createWriteStream.bind(Bi.default);async function ode(t,e){let r=Bi.default.createReadStream(t,e);try{await eC(r,["readable","end"])}catch(n){throw new Gr(`Cannot read from \`${t}\`: ${n.message}`,{cause:n})}return r}var Zz=t=>LVe(t).catch(e=>{throw new Gr(`lstat \`${t}\` failed: ${e.message}`,{cause:e})}),sde=(t,e,r)=>$Ve(t,e,r).catch(n=>{throw new Gr(`utimes \`${t}\` failed: ${n.message}`,{cause:n})}),ade=(t,e)=>UVe(t,e).catch(r=>{throw new Gr(`chmod \`${t}\` failed: ${r.message}`,{cause:r})});var cde=(t,e)=>FVe(t,{...e,recursive:!0}).catch(r=>{throw new Gr(`Cannot create directory \`${t}\`: ${r.message}`,{cause:r})});var jVe=(t,e,r)=>({sourcePath:$u.resolve(t,e),destinationPath:$u.resolve(t,r)}),zVe=(t,e)=>{if(!t.isFile())throw Object.assign(new Gr(`EISDIR: illegal operation on a directory '${e}'`),{errno:-21,code:"EISDIR",source:e})};async function lde(t,e,r={}){if(!t||!e)throw new Gr("`source` and `destination` required");r.cwd&&({sourcePath:t,destinationPath:e}=jVe(r.cwd,t,e)),r={overwrite:!0,...r};let n=await Zz(t),{size:i}=n;zVe(n,t);let o=$u.dirname(e);if($u.parse(o).root===o||await cde($u.dirname(e),{mode:r.directoryMode}),typeof r.onProgress=="function"){let a=await ode(t),c=ide(e,{flags:r.overwrite?"w":"wx"}),l=p=>{r.onProgress({sourcePath:$u.resolve(t),destinationPath:$u.resolve(e),size:i,writtenBytes:p,percent:p===i?1:p/i})},u=-1;a.on("data",()=>{let p=c.bytesWritten,h=p===i?1:p/i;(h===1||h-u>=.01)&&(u=h,l(p))});let d;a.once("error",p=>{d=new Gr(`Cannot read from \`${t}\`: ${p.message}`,{cause:p})});let f=!1;try{let p=eC(c,"close");a.pipe(c),await p,l(i),f=!0}catch(p){throw new Gr(`Cannot write to \`${e}\`: ${p.message}`,{cause:p})}if(d)throw d;if(f){let p=await Zz(t);return Promise.all([sde(e,p.atime,p.mtime).catch(h=>{if(h.code!=="EPERM")throw h}),ade(e,p.mode)])}}else{let a=r.overwrite?Jz.COPYFILE_FICLONE:Jz.COPYFILE_FICLONE|Jz.COPYFILE_EXCL;try{await Xz.copyFile(t,e,a),await Promise.all([Xz.utimes(e,n.atime,n.mtime).catch(c=>{if(c.code!=="EPERM")throw c}),Xz.chmod(e,n.mode)])}catch(c){throw new Gr(c.message,{cause:c})}}}async function Qz(t,e,r){return(await PS(t,(i,o)=>Promise.all([e(i,o),i]),r)).filter(i=>!!i[0]).map(i=>i[1])}import xhe from"process";import jYe from"fs";import tm from"path";import{on as GVe,once as qVe}from"events";import{PassThrough as VVe}from"stream";import{finished as fde}from"stream/promises";function nG(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)tG(i);let e=t.some(({readableObjectMode:i})=>i),r=HVe(t,e),n=new eG({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&mde(n),n}var HVe=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},eG=class extends VVe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){tG(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=WVe(this,this.#e),ZVe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return tG(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},WVe=async(t,e)=>{oC(t,ude);let r=new AbortController;try{await Promise.race([YVe(t,r),KVe(t,e,r)])}finally{r.abort(),oC(t,-ude)}},YVe=async(t,{signal:e})=>{await fde(t,{signal:e,cleanup:!0})},KVe=async(t,e,{signal:r})=>{for await(let[n]of GVe(t,"unpipe",{signal:r}))e.has(n)&&n.emit(hde)},tG=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},ZVe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{oC(t,dde);let s=new AbortController;try{await Promise.race([JVe(o,e),XVe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),QVe({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),oC(t,-dde)}r.size===n.size+i.size&&(n.size===0&&i.size>0?rG(t):mde(t))},pde=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",JVe=async(t,e)=>{try{await t,rG(e)}catch(r){pde(r)?rG(e):gde(e,r)}},XVe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fde(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;pde(s)?i.add(e):gde(t,s)}},QVe=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await qVe(t,hde,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},hde=Symbol("unpipe"),mde=t=>{t.writable&&t.end()},rG=t=>{(t.readable||t.writable)&&t.destroy()},gde=(t,e)=>{t.destroyed||(t.once("error",eHe),t.destroy(e))},eHe=()=>{},oC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},ude=2,dde=1;var rm=Yr(US(),1);import fYe from"fs";import pYe from"fs/promises";async function G4(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await pYe[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function q4(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return fYe[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var UGt=G4.bind(void 0,"stat","isFile"),ahe=G4.bind(void 0,"stat","isDirectory"),FGt=G4.bind(void 0,"lstat","isSymbolicLink"),BGt=q4.bind(void 0,"statSync","isFile"),che=q4.bind(void 0,"statSync","isDirectory"),jGt=q4.bind(void 0,"lstatSync","isSymbolicLink");var X4=Yr(US(),1),_he=Yr(J4(),1);import MYe from"process";import DYe from"fs";import LYe from"fs/promises";import em from"path";function Qh(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var BS=t=>t[0]==="!";var $Ye=["**/node_modules","**/flow-typed","**/coverage","**/.git"],yhe={absolute:!0,dot:!0},She="**/.gitignore",UYe=(t,e)=>BS(t)?"!"+em.posix.join(e,t.slice(1)):em.posix.join(e,t),FYe=(t,e)=>{let r=Qh(em.relative(e,em.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>UYe(n,r))},BYe=(t,e)=>{if(e=Qh(e),em.isAbsolute(t)){if(Qh(t).startsWith(e))return em.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},Ehe=(t,e)=>{let r=t.flatMap(i=>FYe(i,e)),n=(0,_he.default)().add(r);return i=>(i=rn(i),i=BYe(i,e),i?n.ignores(Qh(i)):!1)},vhe=(t={})=>({cwd:rn(t.cwd)??MYe.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...$Ye]}),The=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=vhe(e),s=await(0,X4.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...yhe}),a=await Promise.all(s.map(async c=>({filePath:c,content:await LYe.readFile(c,"utf8")})));return Ehe(a,r)},bhe=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=vhe(e),a=X4.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...yhe}).map(c=>({filePath:c,content:DYe.readFileSync(c,"utf8")}));return Ehe(a,r)};var zYe=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},Rhe=(t,e)=>{let r=BS(t)?t.slice(1):t;return tm.isAbsolute(r)?r:tm.join(e,r)},Ihe=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>tm.posix.join(t,`**/${tm.extname(i)?i:`${i}${n}`}`)):[tm.posix.join(t,`**${n?`/*${n}`:""}`)]},Ahe=async(t,{cwd:e=xhe.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async o=>await ahe(Rhe(o,e))?Ihe({directoryPath:o,files:r,extensions:n}):o))).flat(),whe=(t,{cwd:e=xhe.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>che(Rhe(i,e))?Ihe({directoryPath:i,files:r,extensions:n}):i),Q4=t=>(t=[...new Set([t].flat())],zYe(t),t),GYe=t=>{if(!t)return;let e;try{e=jYe.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},Che=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:rn(t.cwd)},GYe(t.cwd),t),Phe=t=>async(e,r)=>t(Q4(e),Che(r)),$C=t=>(e,r)=>t(Q4(e),Che(r)),Ohe=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?Q4(e):[];return r&&n.push(She),n},qYe=async t=>{let e=Ohe(t);return khe(e.length>0&&await The(e,t))},Nhe=t=>{let e=Ohe(t);return khe(e.length>0&&bhe(e,t))},khe=t=>{let e=new Set;return r=>{let n=tm.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},Mhe=(t,e)=>t.flat().filter(r=>e(r)),Dhe=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(o=>BS(o));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let o of r)o.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},Lhe=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),$he=async(t,e)=>{let r=Dhe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=Lhe(i,n);return Promise.all(r.map(async s=>{let{patterns:a,options:c}=s;return[a,c.ignore]=await Promise.all([Ahe(a,o),Ahe(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},eq=(t,e)=>{let r=Dhe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=Lhe(i,n);return r.map(s=>{let{patterns:a,options:c}=s;return a=whe(a,o),c.ignore=whe(c.ignore,{cwd:n}),{patterns:a,options:c}})},c4t=Phe(async(t,e)=>{let[r,n]=await Promise.all([$he(t,e),qYe(e)]),i=await Promise.all(r.map(o=>(0,rm.default)(o.patterns,o.options)));return Mhe(i,n)}),Uhe=$C((t,e)=>{let r=eq(t,e),n=Nhe(e),i=r.map(o=>rm.default.sync(o.patterns,o.options));return Mhe(i,n)}),l4t=$C((t,e)=>{let r=eq(t,e),n=Nhe(e),i=r.map(s=>rm.default.stream(s.patterns,s.options));return nG(i).filter(s=>n(s))}),ju=$C((t,e)=>t.some(r=>rm.default.isDynamicPattern(r,e))),u4t=Phe($he),d4t=$C(eq),{convertPathToPattern:f4t}=rm.default;var Bhe=Yr(wG(),1);var Fc=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CpyError"}};import FC from"path";import Fhe from"fs";var VYe=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],HYe=new RegExp(VYe.join("|"));function WYe(t){return HYe.test(t)}function UC(t){return!WYe(t)}var jS=class{constructor(e,r,n){this.path=e,this.originalPath=e,this.destination=r,this.options=n,this.isDirectory=!1,!ju(e)&&Fhe.existsSync(e)&&Fhe.lstatSync(e).isDirectory()&&(this.path=[e,"**"].join("/"),this.isDirectory=!0)}get name(){return FC.basename(this.originalPath)}get normalizedPath(){let e=this.originalPath.split("/"),r=e.findIndex(i=>i?ju(i):!1),n=e.slice(0,r).join("/");return n?FC.isAbsolute(n)?n:FC.join(this.options.cwd,n):this.destination}hasMagic(){return ju(this.options.flat?this.path:this.originalPath)}getMatches(){let e=Uhe(this.path,{...this.options,dot:!0,absolute:!0,onlyFiles:!0});return this.options.ignoreJunk&&(e=e.filter(r=>UC(FC.basename(r)))),e}};var JYe={ignoreJunk:!0,flat:!1,cwd:YYe.cwd()},tq=class{constructor(e,r,n){this.path=e.split("/").join(rt.sep),this.relativePath=r.split("/").join(rt.sep),this.pattern=n,Object.freeze(this)}get name(){return rt.basename(this.path)}get nameWithoutExtension(){return rt.basename(this.path,rt.extname(this.path))}get extension(){return rt.extname(this.path).slice(1)}},XYe=t=>t.flatMap(e=>Bhe.default.braces(e,{expand:!0,nodupes:!0})),QYe=({entry:t,destination:e,options:r})=>t.pattern.hasMagic()?r.flat?rt.isAbsolute(e)?rt.join(e,t.name):rt.join(r.cwd,e,t.name):rt.join(e,rt.relative(t.pattern.normalizedPath,t.path)):rt.isAbsolute(e)?rt.join(e,t.name):t.pattern.isDirectory&&rt.relative(r.cwd,t.path).startsWith("..")?rt.join(r.cwd,e,rt.basename(t.pattern.originalPath),rt.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&t.path===t.relativePath?rt.join(r.cwd,e,rt.basename(t.pattern.originalPath),rt.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&r.flat?rt.join(r.cwd,e,rt.basename(t.pattern.originalPath)):rt.join(r.cwd,e,rt.relative(r.cwd,t.path)),eKe=(t,e)=>{let r=rt.dirname(t);if(typeof e=="string")return rt.join(r,e);if(typeof e=="function"){let n=rt.basename(t);return rt.join(r,e(n))}return t};function rq(t,e,{concurrency:r=ZYe.availableParallelism(),...n}={}){let i=new Map,o=new KYe;n={...JYe,...n};let s=(async()=>{let a=[],c=0,l=0,u=XYe([t??[]].flat()).map(h=>h.replaceAll("\\","/")),d=u.filter(h=>!h.startsWith("!")),f=u.filter(h=>h.startsWith("!"));if(d.length===0||!e)throw new Fc("`source` and `destination` required");u=u.map(h=>new jS(h,e,{...n,ignore:f}));for(let h of u){let m=[];try{m=h.getMatches()}catch(S){throw new Fc(`Cannot glob \`${h.originalPath}\`: ${S.message}`,{cause:S})}if(m.length===0&&!ju(h.originalPath)&&!ju(f))throw new Fc(`Cannot copy \`${h.originalPath}\`: the file doesn't exist`);a=[...a,...m.map(S=>new tq(S,rt.relative(n.cwd,S),h))]}n.filter!==void 0&&(a=await Qz(a,n.filter,{concurrency:1024})),a.length===0&&o.emit("progress",{totalFiles:0,percent:1,completedFiles:0,completedSize:0});let p=h=>{let m=i.get(h.sourcePath)||{writtenBytes:0,percent:0};(m.writtenBytes!==h.writtenBytes||m.percent!==h.percent)&&(l-=m.writtenBytes,l+=h.writtenBytes,h.percent===1&&m.percent!==1&&c++,i.set(h.sourcePath,{writtenBytes:h.writtenBytes,percent:h.percent}),o.emit("progress",{totalFiles:a.length,percent:c/a.length,completedFiles:c,completedSize:l,sourcePath:h.sourcePath,destinationPath:h.destinationPath}))};return PS(a,async h=>{let m=eKe(QYe({entry:h,destination:e,options:n}),n.rename);try{await lde(h.path,m,{...n,onProgress:p})}catch(S){throw new Fc(`Cannot copy from \`${h.relativePath}\` to \`${m}\`: ${S.message}`,{cause:S})}return m},{concurrency:r})})();return s.on=(...a)=>(o.on(...a),s),s}import ome from"process";import TKe from"fs";import om from"path";import{on as tKe,once as rKe}from"events";import{PassThrough as nKe}from"stream";import{finished as Ghe}from"stream/promises";function sq(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)iq(i);let e=t.some(({readableObjectMode:i})=>i),r=iKe(t,e),n=new nq({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&Hhe(n),n}var iKe=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},nq=class extends nKe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){iq(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=oKe(this,this.#e),cKe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return iq(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},oKe=async(t,e)=>{BC(t,jhe);let r=new AbortController;try{await Promise.race([sKe(t,r),aKe(t,e,r)])}finally{r.abort(),BC(t,-jhe)}},sKe=async(t,{signal:e})=>{await Ghe(t,{signal:e,cleanup:!0})},aKe=async(t,e,{signal:r})=>{for await(let[n]of tKe(t,"unpipe",{signal:r}))e.has(n)&&n.emit(Vhe)},iq=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},cKe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{BC(t,zhe);let s=new AbortController;try{await Promise.race([lKe(o,e),uKe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),dKe({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),BC(t,-zhe)}r.size===n.size+i.size&&(n.size===0&&i.size>0?oq(t):Hhe(t))},qhe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",lKe=async(t,e)=>{try{await t,oq(e)}catch(r){qhe(r)?oq(e):Whe(e,r)}},uKe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Ghe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;qhe(s)?i.add(e):Whe(t,s)}},dKe=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await rKe(t,Vhe,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},Vhe=Symbol("unpipe"),Hhe=t=>{t.writable&&t.end()},oq=t=>{(t.readable||t.writable)&&t.destroy()},Whe=(t,e)=>{t.destroyed||(t.once("error",fKe),t.destroy(e))},fKe=()=>{},BC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},jhe=2,zhe=1;var sm=Yr(US(),1);import pKe from"fs";import hKe from"fs/promises";async function aq(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await hKe[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function cq(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return pKe[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var U4t=aq.bind(void 0,"stat","isFile"),Yhe=aq.bind(void 0,"stat","isDirectory"),F4t=aq.bind(void 0,"lstat","isSymbolicLink"),B4t=cq.bind(void 0,"statSync","isFile"),Khe=cq.bind(void 0,"statSync","isDirectory"),j4t=cq.bind(void 0,"lstatSync","isSymbolicLink");var lq=Yr(US(),1),Zhe=Yr(J4(),1);import mKe from"process";import gKe from"fs";import _Ke from"fs/promises";import im from"path";function nm(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var zS=t=>t[0]==="!";var yKe=["**/node_modules","**/flow-typed","**/coverage","**/.git"],Jhe={absolute:!0,dot:!0},Xhe="**/.gitignore",SKe=(t,e)=>zS(t)?"!"+im.posix.join(e,t.slice(1)):im.posix.join(e,t),EKe=(t,e)=>{let r=nm(im.relative(e,im.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>SKe(n,r))},vKe=(t,e)=>{if(e=nm(e),im.isAbsolute(t)){if(nm(t).startsWith(e))return im.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},Qhe=(t,e)=>{let r=t.flatMap(i=>EKe(i,e)),n=(0,Zhe.default)().add(r);return i=>(i=rn(i),i=vKe(i,e),i?n.ignores(nm(i)):!1)},eme=(t={})=>({cwd:rn(t.cwd)??mKe.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...yKe]}),tme=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=eme(e),s=await(0,lq.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...Jhe}),a=await Promise.all(s.map(async c=>({filePath:c,content:await _Ke.readFile(c,"utf8")})));return Qhe(a,r)},rme=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=eme(e),a=lq.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...Jhe}).map(c=>({filePath:c,content:gKe.readFileSync(c,"utf8")}));return Qhe(a,r)};var bKe=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},sme=(t,e)=>{let r=zS(t)?t.slice(1):t;return om.isAbsolute(r)?r:om.join(e,r)},ame=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>om.posix.join(t,`**/${om.extname(i)?i:`${i}${n}`}`)):[om.posix.join(t,`**${n?`/*${n}`:""}`)]},nme=async(t,{cwd:e=ome.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async o=>await Yhe(sme(o,e))?ame({directoryPath:o,files:r,extensions:n}):o))).flat(),ime=(t,{cwd:e=ome.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>Khe(sme(i,e))?ame({directoryPath:i,files:r,extensions:n}):i),uq=t=>(t=[...new Set([t].flat())],bKe(t),t),AKe=t=>{if(!t)return;let e;try{e=TKe.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},cme=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:rn(t.cwd)},AKe(t.cwd),t),lme=t=>async(e,r)=>t(uq(e),cme(r)),jC=t=>(e,r)=>t(uq(e),cme(r)),ume=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?uq(e):[];return r&&n.push(Xhe),n},wKe=async t=>{let e=ume(t);return fme(e.length>0&&await tme(e,t))},dme=t=>{let e=ume(t);return fme(e.length>0&&rme(e,t))},fme=t=>{let e=new Set;return r=>{let n=om.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},pme=(t,e)=>t.flat().filter(r=>e(r)),hme=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(o=>zS(o));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let o of r)o.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},mme=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),gme=async(t,e)=>{let r=hme(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=mme(i,n);return Promise.all(r.map(async s=>{let{patterns:a,options:c}=s;return[a,c.ignore]=await Promise.all([nme(a,o),nme(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},dq=(t,e)=>{let r=hme(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=mme(i,n);return r.map(s=>{let{patterns:a,options:c}=s;return a=ime(a,o),c.ignore=ime(c.ignore,{cwd:n}),{patterns:a,options:c}})},_me=lme(async(t,e)=>{let[r,n]=await Promise.all([gme(t,e),wKe(e)]),i=await Promise.all(r.map(o=>(0,sm.default)(o.patterns,o.options)));return pme(i,n)}),aqt=jC((t,e)=>{let r=dq(t,e),n=dme(e),i=r.map(o=>sm.default.sync(o.patterns,o.options));return pme(i,n)}),cqt=jC((t,e)=>{let r=dq(t,e),n=dme(e),i=r.map(s=>sm.default.stream(s.patterns,s.options));return sq(i).filter(s=>n(s))}),lqt=jC((t,e)=>t.some(r=>sm.default.isDynamicPattern(r,e))),uqt=lme(gme),dqt=jC(dq),{convertPathToPattern:fqt}=sm.default;import RKe from"process";import GS from"path";import Eqt,{promises as zC}from"fs";import mqt,{promises as xKe}from"fs";async function yme(t){try{return await xKe.access(t),!0}catch{return!1}}var IKe=(t,e,r)=>(e=GS.resolve(t,e),r=GS.resolve(t,r),{sourcePath:e,destinationPath:r}),CKe=(t,e,r="Path")=>{if(!t||!e)throw new TypeError(`\`source${r}\` and \`destination${r}\` required`)},PKe=(t,e)=>{if(GS.dirname(t)!==GS.dirname(e))throw new Error("`source` and `destination` must be in the same directory")},OKe=async(t,e,{overwrite:r=!0,cwd:n=RKe.cwd(),directoryMode:i,validateDirectory:o=!1}={})=>{if(n&&({sourcePath:t,destinationPath:e}=IKe(n,t,e)),o&&PKe(t,e),!r&&await yme(e))throw new Error(`The destination file exists: ${e}`);await zC.mkdir(GS.dirname(e),{recursive:!0,mode:i});try{await zC.rename(t,e)}catch(s){if(s.code==="EXDEV")await zC.copyFile(t,e),await zC.unlink(t);else throw s}};async function Sme(t,e,r){return CKe(t,e),OKe(t,e,r)}var fq=async function(t,e,r=!1){if(r)return Sme(t,e,{overwrite:!1});let{srcGlob:n,dest:i,...o}=await Tme(t,vme(e));if(n&&i)return rq(n,i,{...o,overwrite:!1})},qS=async function(t){let{srcGlob:e,isDir:r,dest:n,...i}=await Tme(t,"");return e!==void 0&&!await MKe(e,r,i)},MKe=async function(t,e,r){return e?(await _me(t,r)).filter(o=>UC(Eme(o))).length===0:!1},Tme=async function(t,e){let r=await DKe(t);if(r===void 0)return{srcGlob:void 0,isDir:!1,cwd:""};let n=r.isDirectory(),i=Eme(t),o=vme(t),s={srcGlob:i,dest:e,isDir:n,cwd:o,dot:!0};return n?{...s,srcGlob:`${i}/**`,dest:kKe(e,i)}:s},DKe=async t=>{try{return await NKe.stat(t)}catch{return}};import{join as P8e}from"path";import{stat as LKe,lstat as bme,readdir as $Ke,realpath as UKe}from"fs/promises";import{Readable as FKe}from"stream";import{resolve as Ame,relative as BKe,join as jKe,sep as zKe}from"path";var kn={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},pq={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:kn.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(pq);var Ime="READDIRP_RECURSIVE_ERROR",GKe=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ime]),wme=[kn.DIR_TYPE,kn.EVERYTHING_TYPE,kn.FILE_DIR_TYPE,kn.FILE_TYPE],qKe=new Set([kn.DIR_TYPE,kn.EVERYTHING_TYPE,kn.FILE_DIR_TYPE]),VKe=new Set([kn.EVERYTHING_TYPE,kn.FILE_DIR_TYPE,kn.FILE_TYPE]),HKe=t=>GKe.has(t.code),WKe=process.platform==="win32",xme=t=>!0,Rme=t=>{if(t===void 0)return xme;if(typeof t=="function")return t;if(typeof t=="string"){let e=t.trim();return r=>r.basename===e}if(Array.isArray(t)){let e=t.map(r=>r.trim());return r=>e.some(n=>r.basename===n)}return xme},hq=class extends FKe{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let r={...pq,...e},{root:n,type:i}=r;this._fileFilter=Rme(r.fileFilter),this._directoryFilter=Rme(r.directoryFilter);let o=r.lstat?bme:LKe;WKe?this._stat=s=>o(s,{bigint:!0}):this._stat=o,this._maxDepth=r.depth??pq.depth,this._wantsDir=i?qKe.has(i):!1,this._wantsFile=i?VKe.has(i):!1,this._wantsEverything=i===kn.EVERYTHING_TYPE,this._root=Ame(n),this._isDirent=!r.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let r=this.parent,n=r&&r.files;if(n&&n.length>0){let{path:i,depth:o}=r,s=n.splice(0,e).map(c=>this._formatEntry(c,i)),a=await Promise.all(s);for(let c of a){if(!c)continue;if(this.destroyed)return;let l=await this._getEntryType(c);l==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),e--)):(l==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),e--)}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(r){this.destroy(r)}finally{this.reading=!1}}}async _exploreDir(e,r){let n;try{n=await $Ke(e,this._rdOptions)}catch(i){this._onError(i)}return{files:n,depth:r,path:e}}async _formatEntry(e,r){let n,i=this._isDirent?e.name:e;try{let o=Ame(jKe(r,i));n={path:BKe(this._root,o),fullPath:o,basename:i},n[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(e){HKe(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let r=e[this._statsProp];if(r.isFile())return"file";if(r.isDirectory())return"directory";if(r&&r.isSymbolicLink()){let n=e.fullPath;try{let i=await UKe(n),o=await bme(i);if(o.isFile())return"file";if(o.isDirectory()){let s=i.length;if(n.startsWith(i)&&n.substr(s,1)===zKe){let a=new Error(`Circular symlink detected: "${n}" points to "${i}"`);return a.code=Ime,this._onError(a)}return"directory"}}catch(i){return this._onError(i),""}}}_includeAsFile(e){let r=e&&e[this._statsProp];return r&&this._wantsEverything&&!r.isDirectory()}};function YKe(t,e={}){let r=e.entryType||e.type;if(r==="both"&&(r=kn.FILE_DIR_TYPE),r&&(e.type=r),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(r&&!wme.includes(r))throw new Error(`readdirp: Invalid type passed. Use one of ${wme.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new hq(e)}function Cme(t,e={}){return new Promise((r,n)=>{let i=[];YKe(t,e).on("data",o=>i.push(o)).on("end",()=>r(i)).on("error",o=>n(o))})}import{mkdir as a8e,readFile as Lme,rm as c8e,writeFile as l8e}from"fs/promises";import{existsSync as $me}from"fs";import{dirname as u8e}from"path";var Pme=t=>{if(!(!Number.isInteger(t)||t<1))return Date.now()+t*1e3},Ome=t=>t!==void 0&&Date.now()>t;import{createHash as n8e}from"crypto";import{createReadStream as i8e}from"fs";import JKe from"process";import XKe from"path";import Gqt,{promises as Nme}from"fs";import{fileURLToPath as QKe}from"url";var mq=class{value;next;constructor(e){this.value=e}},VS=class{#e;#r;#t;constructor(){this.clear()}enqueue(e){let r=new mq(e);this.#e?(this.#r.next=r,this.#r=r):(this.#e=r,this.#r=r),this.#t++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#t--,this.#e||(this.#r=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#r=void 0,this.#t=0}get size(){return this.#t}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}};function GC(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new VS,r=0,n=()=>{r--,e.size>0&&e.dequeue()()},i=async(a,c,l)=>{r++;let u=(async()=>a(...l))();c(u);try{await u}catch{}n()},o=(a,c,l)=>{e.enqueue(i.bind(void 0,a,c,l)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},s=(a,...c)=>new Promise(l=>{o(a,l,c)});return Object.defineProperties(s,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),s}var qC=class extends Error{constructor(e){super(),this.value=e}},KKe=async(t,e)=>e(await t),ZKe=async t=>{let e=await Promise.all(t);if(e[1]===!0)throw new qC(e[0]);return!1};async function gq(t,e,{concurrency:r=Number.POSITIVE_INFINITY,preserveOrder:n=!0}={}){let i=GC(r),o=[...t].map(a=>[a,i(KKe,a,e)]),s=GC(n?1:Number.POSITIVE_INFINITY);try{await Promise.all(o.map(a=>s(ZKe,a)))}catch(a){if(a instanceof qC)return a.value;throw a}}var kme={directory:"isDirectory",file:"isFile"};function e8e(t){if(!Object.hasOwnProperty.call(kme,t))throw new Error(`Invalid type specified: ${t}`)}var t8e=(t,e)=>e[kme[t]](),r8e=t=>t instanceof URL?QKe(t):t;async function Mme(t,{cwd:e=JKe.cwd(),type:r="file",allowSymlinks:n=!0,concurrency:i,preserveOrder:o}={}){e8e(r),e=r8e(e);let s=n?Nme.stat:Nme.lstat;return gq(t,async a=>{try{let c=await s(XKe.resolve(e,a));return t8e(r,c)}catch{return!1}},{concurrency:i,preserveOrder:o})}var o8e="sha1",Dme=async function(t,e){if(e||t.length===0)return;let r=await Mme(t);return r===void 0?void 0:await s8e(r)},s8e=async function(t){let e=i8e(t,"utf8"),r=n8e(o8e,{encoding:"hex"});return e.pipe(r),await Rf(r)};var Ume=async function({cachePath:t,move:e,ttl:r,digests:n}){let i=VC(t),o=Pme(r),s=await Dme(n,e),c=`${JSON.stringify({expires:o,hash:s},null,2)}
571
- `,l=await d8e({hash:s,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},d8e=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!$me(e)?!1:await Lme(e,"utf8")===r},Fme=async function({manifestPath:t,manifestString:e}){await a8e(u8e(t),{recursive:!0}),await l8e(t,e)},Bme=async function(t){let e=VC(t);await c8e(e,{force:!0,recursive:!0,maxRetries:3})},VC=function(t){return`${t}${zme}`},jme=function(t){return t.endsWith(zme)},zme=".netlify.cache.json",_q=async function(t){let e=VC(t);if(!$me(e))return!1;let{expires:r}=await f8e(t);return Ome(r)},f8e=async function(t){let e=VC(t),r=await Lme(e,"utf-8");return JSON.parse(r)};import{homedir as _8e}from"os";import{resolve as Gme,isAbsolute as y8e,join as S8e,sep as Sq}from"path";import{normalize as p8e}from"path";import{existsSync as h8e}from"fs";import m8e from"process";var yq=function(t){try{let e=g8e(t);return h8e(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},g8e=function(t=m8e.cwd()){return p8e(t)};var HS=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await E8e(t,r),i=await A8e({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},E8e=async function(t,e){let r=await yq(e),n=v8e(t,r);return T8e(n,r),n},v8e=function(t,e){if(y8e(t))return Gme(t);if(e!=="")return Gme(e,t);throw new Error(`Current directory does not exist: ${e}`)},T8e=function(t,e){if(e!==""&&b8e(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},b8e=function(t,e){return`${e}${Sq}`.startsWith(`${t}${Sq}`)},A8e=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=Du({cacheDir:e,cwd:r}),{name:i,relPath:o}=await w8e(t,r);return S8e(n,i,o)},w8e=async function(t,e){let r=await Eq(e),n=x8e(t);return r.map(({name:i,base:o})=>I8e(i,o,n)).find(Boolean)},x8e=function(t){return t.replace(R8e,"\\")},R8e=/^[a-zA-Z]:\\/,I8e=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},Eq=async function(t){return[...await C8e(t),{name:"home",base:_8e()},{name:"root",base:Sq}]},C8e=async function(t){let e=await yq(t);return e===""?[]:[{name:"cwd",base:e}]};var O8e=1,vq=async function({cacheDir:t,cwd:e,depth:r=O8e}={}){let n=await Eq(e),i=Du({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>N8e({name:a,base:c,cacheDir:i,depth:r})))).flat()},N8e=async function({name:t,base:e,cacheDir:r,depth:n}){return(await Cme(`${r}/${t}`,{fileFilter:k8e,depth:n,type:"files_directories"})).map(({path:s})=>P8e(e,s))},k8e=function({basename:t}){return!jme(t)};var M8e=async function(t,{move:e=qme,ttl:r=U8e,digests:n=[],cacheDir:i,cwd:o}={}){let{srcPath:s,cachePath:a}=await HS({path:t,cacheDir:i,cwdOpt:o});if(!await qS(s))return!1;let{manifestInfo:c,identical:l}=await Ume({cachePath:a,move:e,ttl:r,digests:n});return l||(await Tq(a,{force:!0,recursive:!0,maxRetries:3}),await fq(s,a,e),await Fme(c)),!0},D8e=async function(t,{move:e=qme,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:o}=await HS({path:t,cacheDir:r,cwdOpt:n});return!await qS(o)||await _q(o)?!1:(await Tq(i,{force:!0,recursive:!0,maxRetries:3}),await fq(o,i,e),!0)},L8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await HS({path:t,cacheDir:e,cwdOpt:r});return await qS(n)?(await Tq(n,{force:!0,recursive:!0,maxRetries:3}),await Bme(n),!0):!1},$8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await HS({path:t,cacheDir:e,cwdOpt:r});return await qS(n)&&!await _q(n)},qme=!1,U8e=void 0,HC=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},F8e=HC.bind(null,M8e),B8e=HC.bind(null,D8e),j8e=HC.bind(null,L8e),z8e=HC.bind(null,$8e),Vme=function(t){return{save:(e,r)=>F8e(e,{...t,...r}),restore:(e,r)=>B8e(e,{...t,...r}),remove:(e,r)=>j8e(e,{...t,...r}),has:(e,r)=>z8e(e,{...t,...r}),list:e=>vq({...t,...e}),getCacheDir:e=>Du({...t,...e})}};var G8e=ue("opencode_session"),q8e=async t=>{try{let e=await KI(t),{stdout:r}=await zt(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return G8e.warn("Could not list opencode sessions",{error:e?.message}),[]}},bq=new Map,Hme=t=>{let e=bq.get(t);if(e)return e;let r=q8e(t).finally(()=>bq.delete(t));return bq.set(t,r),r},Wme=async t=>(await Hme(t)).length>0,Yme=async(t,e)=>e?(await Hme(t)).some(r=>r.id===e):!1;var ir=ue("native_session"),Aq=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await Xs.stat(Qs.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),zu=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:o}=r,s=!1;try{s=(await Xs.stat(i)).isDirectory()}catch{}if(!s)return ir.log(`Native session base dir ${i} not found, skipping`),null;let a=await Aq(i,o);if(a.length===0)return ir.log(`No native session history found under ${i}, skipping`),null;let c=Qs.join(Kme.tmpdir(),`native-session-${e}.zip`);try{await zt("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await Xs.readFile(c);ir.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await jQ(t,e);return await KQ(u,l,{contentType:"application/zip"}),ir.log("Successfully uploaded native session to S3"),d}catch(l){return ir.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await Xs.rm(c,{force:!0}).catch(()=>{})}},Zme=async(t,e,r=process.cwd())=>{if(e==="opencode")return Wme(r);if(!t)return!1;let{baseDir:n,include:i}=t,o=await Aq(n,i);for(let s of o)if((await Xs.readdir(Qs.join(n,s)).catch(()=>[])).length>0)return!0;return!1},V8e=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Jme=async(t,e)=>{let r=await Xs.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await Jme(Qs.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},Xme=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return Yme(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${V8e(e)}([^a-zA-Z0-9]|$)`),{baseDir:o,include:s}=t,a=await Aq(o,s);for(let c of a)if(await Jme(Qs.join(o,c),i))return!0;return!1},Qme=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=Qs.join(Kme.tmpdir(),`native-session-restore-${e}.zip`);try{let o=await zQ(t,e);if(!o?.download_url)return ir.log("No native session available to restore, skipping"),!1;let s=await YQ(o.download_url);return await Xs.writeFile(i,s),ir.log(`Downloaded native session (${s.length} bytes) to ${i}`),await Xs.mkdir(n,{recursive:!0}),await zt("unzip",["-o","-q",i,"-d",n]),ir.log(`Restored native session into ${n}`),!0}catch(o){return ir.error("Failed to fetch/restore native session, continuing without it:",o),!1}finally{await Xs.rm(i,{force:!0}).catch(()=>{})}},H8e="native-sessions",ege=(t,e)=>Vme({cacheDir:Qs.join(e.dir,H8e),cwd:t}),tge=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await ege(r,e).restore(n.map(o=>Qs.join(r,o)),{})?(ir.log(`Restored native session from buildbot cache into ${r}`),!0):(ir.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return ir.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},am=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return ir.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await ege(n,e).save(i.map(s=>Qs.join(n,s)),{})?(ir.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(ir.log("No native session history to save to buildbot cache, skipping"),!1)}catch(o){return ir.error("Failed to save native session to buildbot cache, continuing:",o),!1}};var cm=ue("inference_stage"),rge=5,Bc=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:o,runner:s,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeForCreditWrapUp:m,forceLowEffortForCreditWrapUp:S,answerFold:E}=t;if(vo())throw new Error("Shutdown in progress, aborting inference stage");cm.log(`Running inference stage, attempt ${l} of ${rge}`);let b=!1,A=await dt(Ke(),"inference-stage",async y=>{y?.setAttributes({"inference.attempt":l||1}),SQ();let x=!!(l&&l>1),C=await W8e(n,x,f),O=!!m&&!!d;O&&n.runner==="gemini"&&!await AS(d)&&(O=!1);let N=C.viable||O;b=N,C.outcome!=="not_eligible"&&ce.inc("inference.native_resume",1,{outcome:C.outcome,...C.source?{source:C.source}:{}});let R=n;if("prompt"in n&&n.answeredInteraction&&$e().questionsEnabled){let v=n.answeredInteraction,I=N||x&&!!d,J=[v];if(!I){E.allAnswered??=Bue(n);let G=await E.allAnswered;G===null&&(E.allAnswered=void 0),G&&G.length>0&&(J=G.some(le=>le.refId===v.refId)?G:[...G,v])}R={...n,prompt:Gue(n.prompt,J)},!x&&!E.counted&&(E.counted=!0,cm.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:J.length}),ce.inc("inference.answer_resume",1,{fold:I?"latest":"all"}),zue(v))}let{prompt:$}=await dt(Ke(),"compose-prompt",async()=>await Pue({cliPath:r,config:R,buildErrorContext:Y8e(o),netlify:i,additionalContext:e,resumePrompt:N})),_=`
576
+ `,l=await d8e({hash:s,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},d8e=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!$me(e)?!1:await Lme(e,"utf8")===r},Fme=async function({manifestPath:t,manifestString:e}){await a8e(u8e(t),{recursive:!0}),await l8e(t,e)},Bme=async function(t){let e=VC(t);await c8e(e,{force:!0,recursive:!0,maxRetries:3})},VC=function(t){return`${t}${zme}`},jme=function(t){return t.endsWith(zme)},zme=".netlify.cache.json",_q=async function(t){let e=VC(t);if(!$me(e))return!1;let{expires:r}=await f8e(t);return Ome(r)},f8e=async function(t){let e=VC(t),r=await Lme(e,"utf-8");return JSON.parse(r)};import{homedir as _8e}from"os";import{resolve as Gme,isAbsolute as y8e,join as S8e,sep as Sq}from"path";import{normalize as p8e}from"path";import{existsSync as h8e}from"fs";import m8e from"process";var yq=function(t){try{let e=g8e(t);return h8e(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},g8e=function(t=m8e.cwd()){return p8e(t)};var HS=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await E8e(t,r),i=await A8e({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},E8e=async function(t,e){let r=await yq(e),n=v8e(t,r);return T8e(n,r),n},v8e=function(t,e){if(y8e(t))return Gme(t);if(e!=="")return Gme(e,t);throw new Error(`Current directory does not exist: ${e}`)},T8e=function(t,e){if(e!==""&&b8e(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},b8e=function(t,e){return`${e}${Sq}`.startsWith(`${t}${Sq}`)},A8e=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=Du({cacheDir:e,cwd:r}),{name:i,relPath:o}=await w8e(t,r);return S8e(n,i,o)},w8e=async function(t,e){let r=await Eq(e),n=x8e(t);return r.map(({name:i,base:o})=>I8e(i,o,n)).find(Boolean)},x8e=function(t){return t.replace(R8e,"\\")},R8e=/^[a-zA-Z]:\\/,I8e=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},Eq=async function(t){return[...await C8e(t),{name:"home",base:_8e()},{name:"root",base:Sq}]},C8e=async function(t){let e=await yq(t);return e===""?[]:[{name:"cwd",base:e}]};var O8e=1,vq=async function({cacheDir:t,cwd:e,depth:r=O8e}={}){let n=await Eq(e),i=Du({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>N8e({name:a,base:c,cacheDir:i,depth:r})))).flat()},N8e=async function({name:t,base:e,cacheDir:r,depth:n}){return(await Cme(`${r}/${t}`,{fileFilter:k8e,depth:n,type:"files_directories"})).map(({path:s})=>P8e(e,s))},k8e=function({basename:t}){return!jme(t)};var M8e=async function(t,{move:e=qme,ttl:r=U8e,digests:n=[],cacheDir:i,cwd:o}={}){let{srcPath:s,cachePath:a}=await HS({path:t,cacheDir:i,cwdOpt:o});if(!await qS(s))return!1;let{manifestInfo:c,identical:l}=await Ume({cachePath:a,move:e,ttl:r,digests:n});return l||(await Tq(a,{force:!0,recursive:!0,maxRetries:3}),await fq(s,a,e),await Fme(c)),!0},D8e=async function(t,{move:e=qme,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:o}=await HS({path:t,cacheDir:r,cwdOpt:n});return!await qS(o)||await _q(o)?!1:(await Tq(i,{force:!0,recursive:!0,maxRetries:3}),await fq(o,i,e),!0)},L8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await HS({path:t,cacheDir:e,cwdOpt:r});return await qS(n)?(await Tq(n,{force:!0,recursive:!0,maxRetries:3}),await Bme(n),!0):!1},$8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await HS({path:t,cacheDir:e,cwdOpt:r});return await qS(n)&&!await _q(n)},qme=!1,U8e=void 0,HC=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},F8e=HC.bind(null,M8e),B8e=HC.bind(null,D8e),j8e=HC.bind(null,L8e),z8e=HC.bind(null,$8e),Vme=function(t){return{save:(e,r)=>F8e(e,{...t,...r}),restore:(e,r)=>B8e(e,{...t,...r}),remove:(e,r)=>j8e(e,{...t,...r}),has:(e,r)=>z8e(e,{...t,...r}),list:e=>vq({...t,...e}),getCacheDir:e=>Du({...t,...e})}};var G8e=ue("opencode_session"),q8e=async t=>{try{let e=await KI(t),{stdout:r}=await zt(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return G8e.warn("Could not list opencode sessions",{error:e?.message}),[]}},bq=new Map,Hme=t=>{let e=bq.get(t);if(e)return e;let r=q8e(t).finally(()=>bq.delete(t));return bq.set(t,r),r},Wme=async t=>(await Hme(t)).length>0,Yme=async(t,e)=>e?(await Hme(t)).some(r=>r.id===e):!1;var ir=ue("native_session"),Aq=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await Xs.stat(Qs.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),zu=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:o}=r,s=!1;try{s=(await Xs.stat(i)).isDirectory()}catch{}if(!s)return ir.log(`Native session base dir ${i} not found, skipping`),null;let a=await Aq(i,o);if(a.length===0)return ir.log(`No native session history found under ${i}, skipping`),null;let c=Qs.join(Kme.tmpdir(),`native-session-${e}.zip`);try{await zt("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await Xs.readFile(c);ir.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await jQ(t,e);return await KQ(u,l,{contentType:"application/zip"}),ir.log("Successfully uploaded native session to S3"),d}catch(l){return ir.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await Xs.rm(c,{force:!0}).catch(()=>{})}},Zme=async(t,e,r=process.cwd())=>{if(e==="opencode")return Wme(r);if(!t)return!1;let{baseDir:n,include:i}=t,o=await Aq(n,i);for(let s of o)if((await Xs.readdir(Qs.join(n,s)).catch(()=>[])).length>0)return!0;return!1},V8e=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Jme=async(t,e)=>{let r=await Xs.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await Jme(Qs.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},Xme=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return Yme(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${V8e(e)}([^a-zA-Z0-9]|$)`),{baseDir:o,include:s}=t,a=await Aq(o,s);for(let c of a)if(await Jme(Qs.join(o,c),i))return!0;return!1},Qme=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=Qs.join(Kme.tmpdir(),`native-session-restore-${e}.zip`);try{let o=await zQ(t,e);if(!o?.download_url)return ir.log("No native session available to restore, skipping"),!1;let s=await YQ(o.download_url);return await Xs.writeFile(i,s),ir.log(`Downloaded native session (${s.length} bytes) to ${i}`),await Xs.mkdir(n,{recursive:!0}),await zt("unzip",["-o","-q",i,"-d",n]),ir.log(`Restored native session into ${n}`),!0}catch(o){return ir.error("Failed to fetch/restore native session, continuing without it:",o),!1}finally{await Xs.rm(i,{force:!0}).catch(()=>{})}},H8e="native-sessions",ege=(t,e)=>Vme({cacheDir:Qs.join(e.dir,H8e),cwd:t}),tge=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await ege(r,e).restore(n.map(o=>Qs.join(r,o)),{})?(ir.log(`Restored native session from buildbot cache into ${r}`),!0):(ir.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return ir.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},am=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return ir.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await ege(n,e).save(i.map(s=>Qs.join(n,s)),{})?(ir.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(ir.log("No native session history to save to buildbot cache, skipping"),!1)}catch(o){return ir.error("Failed to save native session to buildbot cache, continuing:",o),!1}};var cm=ue("inference_stage"),rge=5,Bc=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:o,runner:s,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeForCreditWrapUp:m,forceLowEffortForCreditWrapUp:S,answerFold:E}=t;if(vo())throw new Error("Shutdown in progress, aborting inference stage");cm.log(`Running inference stage, attempt ${l} of ${rge}`);let b=!1,A=await dt(Ke(),"inference-stage",async y=>{y?.setAttributes({"inference.attempt":l||1}),SQ();let x=!!(l&&l>1),C=await W8e(n,x,f),O=!!m&&!!d;O&&n.runner==="gemini"&&!await AS(d)&&(O=!1);let N=C.viable||O;b=N,C.outcome!=="not_eligible"&&ce.inc("inference.native_resume",1,{outcome:C.outcome,...C.source?{source:C.source}:{}});let R=n;if("prompt"in n&&n.answeredInteraction&&$e().questionsEnabled){let v=n.answeredInteraction,I=N||x&&!!d,J=[v];if(!I){E.allAnswered??=Bue(n);let q=await E.allAnswered;q===null&&(E.allAnswered=void 0),q&&q.length>0&&(J=q.some(le=>le.refId===v.refId)?q:[...q,v])}R={...n,prompt:Gue(n.prompt,J)},!x&&!E.counted&&(E.counted=!0,cm.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:J.length}),ce.inc("inference.answer_resume",1,{fold:I?"latest":"all"}),zue(v))}let{prompt:$}=await dt(Ke(),"compose-prompt",async()=>await Pue({cliPath:r,config:R,buildErrorContext:Y8e(o),netlify:i,additionalContext:e,resumePrompt:N})),_=`
572
577
  ${u||""}
573
578
  ${$}
574
- `.trim(),ee={...n,prompt:_},k=d??(N?C.sessionId:void 0),g=await dt(Ke(),`run-${n.runner}`,async v=>{let I=eL();v?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":xQ(n.runner),"gen_ai.system":n.runner,...I?{"gen_ai.input.messages":CA("user",_)}:{}});let J=Date.now(),G=await s({aiGateway:c,config:ee,netlify:i,persistSteps:a,continueSession:x||N,priorAgentSessionId:k,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,...S?{forceLowEffortForCreditWrapUp:S}:{}}),le=Date.now(),Oe=G.resolvedModel||n.model||"unknown",Ie=G.error?"error":"stop";return v?.setAttributes({...I?{"gen_ai.output.messages":CA("assistant",G.result??G.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":Oe,"gen_ai.response.model":Oe,"gen_ai.request.effort":G.effort??"auto",...G.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":G.usage.input_tokens}:{},...G.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":G.usage.output_tokens}:{},...G.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":G.usage.cache_creation_input_tokens}:{},...G.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":G.usage.cache_read_input_tokens}:{},...G.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":G.usage.reasoning_output_tokens}:{}}),RQ(G.steps??[],n.mode,J,le),G});return g.result&&(g.result=Zn(g.result)),g.error&&(g.error=Zn(g.error)),await a.flush(),g});if(A.aborted)return cm.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:A.agentSessionId}),{runnerResult:A,nativeResume:b};if(A.error){if(vo()){let y=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(y,{agentSessionId:A.agentSessionId}),y}if(cm.error("Runner failed",{stepsCount:A.steps.length,duration:A.duration,error:A.error,isRetryableError:A.isRetryableError,attempt:l||1,agentSessionId:A.agentSessionId}),ce.inc("inference.failed",1,{attempt:l||1,is_retryable:!!A.isRetryableError,is_provider_unavailable:!!A.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction}),A.isRetryableError&&(!l||l<rge))return cm.log("Retrying inference stage"),await new Promise(x=>setTimeout(x,5e3)),{runnerResult:(await Bc({...t,attempt:(l||1)+1,priorAgentSessionId:A.agentSessionId,contextPrefix:A.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:b};{if(cm.log("Do not retry inference stage"),A.error.toLowerCase().includes("usage exceeded")){let x=new Ii(A.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(x,{agentSessionId:A.agentSessionId}),x}let y=A.isRetryableError||A.isProviderUnavailableError?new gf(A.error):new Error(A.error);throw Object.assign(y,{agentSessionId:A.agentSessionId}),y}}return{runnerResult:A,nativeResume:b}},W8e=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:o}=Uue(t);if(!i)return{viable:i,outcome:o};let s=n?.nativeSessionId,a=Ys(t.runner),c=async()=>s?t.runner==="gemini"?!!await xz(s):Xme(a,s,t.runner,r):!1,l;if(Lue(t)&&await Zme(a,t.runner,r))l="local";else if(t.fastInit&&$e().warmNativeResumeEnabled&&await tge({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!$e().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await Qme({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&s&&!await AS(s)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:s,outcome:"resumed",source:l}},Y8e=t=>!t||t.length===0?"":`
579
+ `.trim(),ee={...n,prompt:_},k=d??(N?C.sessionId:void 0),g=await dt(Ke(),`run-${n.runner}`,async v=>{let I=eL();v?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":xQ(n.runner),"gen_ai.system":n.runner,...I?{"gen_ai.input.messages":CA("user",_)}:{}});let J=Date.now(),q=await s({aiGateway:c,config:ee,netlify:i,persistSteps:a,continueSession:x||N,priorAgentSessionId:k,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,...S?{forceLowEffortForCreditWrapUp:S}:{}}),le=Date.now(),Oe=q.resolvedModel||n.model||"unknown",Ie=q.error?"error":"stop";return v?.setAttributes({...I?{"gen_ai.output.messages":CA("assistant",q.result??q.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":Oe,"gen_ai.response.model":Oe,"gen_ai.request.effort":q.effort??"auto",...q.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":q.usage.input_tokens}:{},...q.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":q.usage.output_tokens}:{},...q.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":q.usage.cache_creation_input_tokens}:{},...q.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":q.usage.cache_read_input_tokens}:{},...q.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":q.usage.reasoning_output_tokens}:{}}),RQ(q.steps??[],n.mode,J,le),q});return g.result&&(g.result=Zn(g.result)),g.error&&(g.error=Zn(g.error)),await a.flush(),g});if(A.aborted)return cm.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:A.agentSessionId}),{runnerResult:A,nativeResume:b};if(A.error){if(vo()){let y=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(y,{agentSessionId:A.agentSessionId}),y}if(cm.error("Runner failed",{stepsCount:A.steps.length,duration:A.duration,error:A.error,isRetryableError:A.isRetryableError,attempt:l||1,agentSessionId:A.agentSessionId}),ce.inc("inference.failed",1,{attempt:l||1,is_retryable:!!A.isRetryableError,is_provider_unavailable:!!A.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction}),A.isRetryableError&&(!l||l<rge))return cm.log("Retrying inference stage"),await new Promise(x=>setTimeout(x,5e3)),{runnerResult:(await Bc({...t,attempt:(l||1)+1,priorAgentSessionId:A.agentSessionId,contextPrefix:A.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:b};{if(cm.log("Do not retry inference stage"),A.error.toLowerCase().includes("usage exceeded")){let x=new Ii(A.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(x,{agentSessionId:A.agentSessionId}),x}let y=A.isRetryableError||A.isProviderUnavailableError?new gf(A.error):new Error(A.error);throw Object.assign(y,{agentSessionId:A.agentSessionId}),y}}return{runnerResult:A,nativeResume:b}},W8e=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:o}=Uue(t);if(!i)return{viable:i,outcome:o};let s=n?.nativeSessionId,a=Ys(t.runner),c=async()=>s?t.runner==="gemini"?!!await xz(s):Xme(a,s,t.runner,r):!1,l;if(Lue(t)&&await Zme(a,t.runner,r))l="local";else if(t.fastInit&&$e().warmNativeResumeEnabled&&await tge({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!$e().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await Qme({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&s&&!await AS(s)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:s,outcome:"resumed",source:l}},Y8e=t=>!t||t.length===0?"":`
575
580
  Deploy failed. Here are the errors to review on the latest build:
576
581
 
577
582
  Below are all of the logs with potential issues that we extracted. Some of them may be false positives, discern them carefully and ensure fixes are relevant.
@@ -584,17 +589,17 @@ Preview deploy created successfully:`,{deployId:m.deploy_id,deployUrl:m.deploy_u
584
589
  `)},uge=t=>{let e=[];return t.missingOnDisk.length>0&&e.push("You deleted the following migration file(s) that are already applied to the preview database branch:",...t.missingOnDisk.map(r=>`- ${r.name}`),"","Applied migrations cannot be removed \u2014 the deploy will fail because the platform requires every applied","migration to exist on disk with its original content. Please revise your work:","","1. Restore the deleted file(s) by running `netlify db migrations pull --force`, which overwrites the"," local migrations directory with the authoritative state of the branch. Note this also wipes any"," unapplied migration files you generated this session \u2014 regenerate them via `npx drizzle-kit generate`"," afterwards if you still need them (your `db/schema.ts` edits aren't affected by the pull).","2. If the underlying problem is that an applied migration is wrong, add a NEW migration on top that"," corrects whatever it did (drop a column, rename a table, etc.). Do not touch the original."),t.outOfOrder.length>0&&(e.length>0&&e.push(""),e.push("The following pending migration file(s) have a version prefix that sorts BEFORE migrations already","applied to the branch, so the platform will reject them on deploy:",...t.outOfOrder.map(r=>`- ${r.name} (version ${r.version} \u2264 applied max ${r.maxApplied})`),"","Delete these out-of-order files (use `netlify db migrations reset` \u2014 it only removes unapplied files),","then run `npx drizzle-kit generate` to produce a replacement whose version sorts after the applied","migrations.")),e.length===0?null:e.join(`
585
590
  `)},dge=t=>t.missingOnDisk.length>0||t.outOfOrder.length>0;var fge=ue("db_migrations_verify"),pge=async t=>await dt(Ke(),"db-migrations-verify-stage",async e=>{let r;try{r=await ZC({cliPath:t.cliPath,cwd:t.cwd})}catch(i){return fge.warn("Skipping migration verification \u2014 failed to read status",{error:i}),e?.setAttributes({"verify.skipped":!0,"verify.skip_reason":"status_error"}),{}}if(!dge(r))return e?.setAttributes({"verify.drift":!1}),{};let n=uge(r);return e?.setAttributes({"verify.drift":!0,"verify.missing_on_disk_count":r.missingOnDisk.length,"verify.out_of_order_count":r.outOfOrder.length}),fge.log("Detected post-inference migration drift",{missingOnDisk:r.missingOnDisk.map(i=>i.name),outOfOrder:r.outOfOrder.map(i=>i.name)}),{error:n??void 0}});import kV from"process";import xJe from"net";var Ln=Yr(PV(),1),L6t=Ln.default.Client,$6t=Ln.default.Pool,U6t=Ln.default.Connection,F6t=Ln.default.types,B6t=Ln.default.Query,j6t=Ln.default.DatabaseError,z6t=Ln.default.escapeIdentifier,G6t=Ln.default.escapeLiteral,q6t=Ln.default.Result,V6t=Ln.default.TypeOverrides,H6t=Ln.default.defaults,nye=Ln.default;var RJe=80877103,IJe=196608,CJe=Buffer.from([78]);function PJe(){let t=Buffer.alloc(9);t.writeUInt8(82,0),t.writeInt32BE(8,1),t.writeInt32BE(0,5);let e=Buffer.alloc(6);return e.writeUInt8(90,0),e.writeInt32BE(5,1),e.writeUInt8(73,5),Buffer.concat([t,e])}function hP(t){let e=Buffer.from("SERROR\0","utf8"),r=Buffer.concat([Buffer.from("M","utf8"),Buffer.from(t+"\0","utf8")]),n=Buffer.from("CXX000\0","utf8"),i=Buffer.from([0]),o=e.length+r.length+n.length+i.length,s=Buffer.alloc(5);return s.writeUInt8(69,0),s.writeInt32BE(o+4,1),Buffer.concat([s,e,n,r,i])}async function OJe(t){let{clientSocket:e,provision:r,logger:n,cleanup:i}=t,o;try{o=await r()}catch(f){let p=f instanceof Error?f.message:"Provisioning failed";throw n("Provisioning error:",p),e.end(hP(p)),i(),f}let s=kJe(o),a=new nye.Client({host:s.host,port:s.port,user:s.user,password:s.password,database:s.database,ssl:s.ssl,options:s.options});a.on("error",()=>{});try{await a.connect()}catch(f){let p=f instanceof Error?f.message:"Remote connection failed";throw n("Remote connection error:",p),e.end(hP(p)),i(),f}let c=a.connection,l=c.stream;c.removeAllListeners(),l.removeAllListeners();let u=l,d=f=>p=>{p.code!=="ECONNRESET"&&n(`${f} socket error:`,p.message),i()};return u.on("error",d("Remote")),u.on("close",i),e.on("error",d("Client")),e.on("close",i),e.write(PJe()),e.on("data",f=>{u.destroyed||u.write(f)}),u.on("data",f=>{e.destroyed||e.write(f)}),e.resume(),u}function NJe(t,e){let{provision:r,logger:n,onCleanup:i}=e,o,s="ssl",a=!1;function c(){a||(a=!0,t.destroy(),o?.destroy(),i())}t.on("error",l=>{l.code!=="ECONNRESET"&&n("Client socket error:",l.message),c()}),t.on("data",l=>{if(s==="ssl"){if(l.length>=8&&l.readInt32BE(4)===RJe){t.write(CJe),s="startup";return}s="startup"}if(s==="startup"){if(l.length<8){t.end(hP("Invalid startup message")),c();return}if(l.readInt32BE(4)!==IJe){t.end(hP("Unsupported protocol version")),c();return}t.pause(),t.removeAllListeners("data"),OJe({clientSocket:t,provision:r,logger:n,cleanup:c}).then(d=>{o=d},d=>{n("Startup error:",d),c()})}})}function kJe(t){let e=new URL(t);return{host:e.hostname,port:Number(e.port)||5432,user:decodeURIComponent(e.username),password:decodeURIComponent(e.password),database:e.pathname.slice(1)||"postgres",ssl:e.searchParams.get("sslmode")==="require"?!0:void 0,options:e.searchParams.get("options")??void 0}}var iye=class{server;sockets=new Set;host;port;logger;provision;constructor(t){this.host=t.host??"127.0.0.1",this.port=t.port??0,this.logger=t.logger??(()=>{}),this.provision=t.provision}async start(){return new Promise((t,e)=>{let r=xJe.createServer(n=>{this.sockets.add(n),n.on("close",()=>{this.sockets.delete(n)}),NJe(n,{provision:this.provision,logger:this.logger,onCleanup:()=>{this.sockets.delete(n)}})});r.on("error",n=>{e(n)}),r.listen(this.port,this.host,()=>{this.server=r;let n=r.address(),i=`postgres://${this.host}:${String(n.port)}`;this.logger("Proxy listening on",i),t(i)})})}async stop(){for(let t of this.sockets)t.destroy();return this.sockets.clear(),new Promise(t=>{if(!this.server){t();return}this.server.close(()=>{this.server=void 0,t()})})}};var mP=ue("db_setup"),oye=async({siteId:t,isProd:e,alias:r,connectionString:n})=>await dt(Ke(),"db-setup-stage",async i=>{i?.setAttributes({"db_setup.site_id":t,"db_setup.is_prod":e,...r&&{"db_setup.alias":r}});let o;if(e?o="production":r&&(o=r),kV.env.NETLIFY_DB_BRANCH=o,n)return i?.setAttributes({"db_setup.source":"config","db_setup.has_proxy":!1}),mP.log("Using database connection string provided by the API"),kV.env.NETLIFY_DB_URL=n,{connectionString:n,wasProvisioned:()=>!1};let s=!1,a=new iye({logger:(...l)=>mP.log("db-proxy:",...l),provision:async()=>(s=!0,mP.log("Provisioning database for site via API"),await HQ(t),await MJe(t,e,r))}),c=await a.start();return i?.setAttributes({"db_setup.source":"proxy","db_setup.has_proxy":!0}),mP.log("Local DB proxy started",{connectionString:c}),kV.env.NETLIFY_DB_URL=c,{connectionString:c,proxy:a,wasProvisioned:()=>s}}),MJe=async(t,e,r)=>e||!r?(await GQ(t)).connection_string:(await WQ(t,r),(await VQ(t,r)).connection_string);var DJe=({isHotFollowUp:t,enqueuedAt:e})=>t?e===void 0?[]:[["request",e]]:[["spawn",Number(process.env.NETLIFY_AGENT_RUNNER_SPAWN_AT_MS)],["enqueue",Number(process.env.NETLIFY_AGENT_RUNNER_ENQUEUED_AT_MS)]],MV=(t,e,r,n)=>{for(let[i,o]of DJe(r))Number.isFinite(o)&&o>0&&o<=n&&t.timing(e,n-o,{from:i})},sye=(t,e=Date.now(),r=ce)=>MV(r,"startup.duration",t,e),aye=(t,e=Date.now(),r=ce)=>MV(r,"startup.time_to_prompt",t,e),cye=(t,e=Date.now(),r=ce)=>MV(r,"startup.time_to_first_output",t,e);var lye=(t,e=Date.now(),r=ce)=>{let n={outcome:t.outcome,native_resume:t.nativeResume,is_answer_resume:t.isAnswerResume};r.timing("session.duration",e-t.startedAt,{hot_follow_up:t.isHotFollowUp,...n}),t.creditsCost!=null&&r.distribution("session.credits_cost",t.creditsCost,{...n,...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{}})};function uye(t){return["One or more AI functions use the legacy **v1** syntax (`exports.handler` / `module.exports.handler`):","",t.map(r=>`- ${r}`).join(`
586
591
  `),"",'Netlify AI Gateway credentials (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` and the matching `*_BASE_URL` variables) are injected ONLY into the modern v2/v3 function runtime. A v1 function builds and deploys successfully but throws "missing API key" at runtime \u2014 this will NOT appear as a build error.',"","Rewrite each listed function using **v2** syntax \u2014 `export default async (req: Request) => Response` \u2014 or **v3** object export (`satisfies NetlifyFunction`), preserving its existing behavior and route. Do not set your own API keys; rely on the injected gateway credentials. See the `netlify-ai-gateway` skill for examples."].join(`
587
- `)}var Vu=ue("usage_tracker"),LJe=4e3,$Je=5e3,UJe=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,FJe=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&e-t<=r,dye=(t,e,r,{creditReserve:n,onCreditReserveReached:i,followPolledLimit:o=!1,shouldPollOnTimer:s=!1}={})=>{let a=!1,c=!1,l=!1,u=!1,d,f,p,h=r,m,S=i!=null&&n!=null,E=()=>{m&&(clearInterval(m),m=void 0)},b=async()=>{try{let N=await DA(t,e);Vu.log("Usage update response",{usage:N?.usage});let R=N?.usage?.total_credits_cost;R!=null&&(d=R);let $=N?.enforced_credits_cap;if(o&&$!=null&&$!==h){let ee=h==null;h=$,Vu.log("Took the session credit limit from a usage poll",{sessionCreditLimit:h,totalCreditsCost:R,isFirstLimit:ee}),ee&&ce.inc("session.credit_cap_late_arrival",1)}let _=UJe(N?.credit_limit_exceeded,R,h);if(_&&(Vu.log("Credit limit exceeded",{totalCreditsCost:R,sessionCreditLimit:h}),l||(f=Date.now(),p=R??d??0),l=!0,E(),A.cancel()),S&&!u&&!_&&FJe(R,h,n)){u=!0,Vu.log("Credit reserve reached",{totalCreditsCost:R,sessionCreditLimit:h,creditReserve:n});try{i()}catch(ee){Vu.warn("onCreditReserveReached callback threw",{error:ee?.message||ee})}}}catch(N){Vu.warn("Failed to update usage",{error:N?.message||N})}},A=Ww(b,LJe);return{onAgentOutput:()=>{if(l)throw new Ii("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0);if(!c){if(a=!0,!s){A();return}m||(m=setInterval(()=>{A()},$Je),m.unref?.())}},stop:async()=>{c||(c=!0,E(),a&&(A.cancel(),Vu.log("Sending final usage update"),await b(),f!==void 0&&(ce.timing("credit_limit.overage_duration",Date.now()-f),ce.distribution("credit_limit.overage_credits",Math.max(0,(d??p??0)-(p??0))))))},getCreditsCost:()=>d,getSessionCreditLimit:()=>h}};var fye=ue("session_credit_limit"),BJe=async t=>{if(t.sessionCreditLimit!=null)return{limit:t.sessionCreditLimit,source:"env"};if(!$e().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await DA(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return fye.log("Resolved the session credit limit from the usage endpoint",{limit:e}),{limit:e,source:"usage"}}catch(e){fye.warn("Usage call for the session credit limit failed",{error:e?.message||e})}return{source:"none"}},pye=async(t,e=!1)=>{let{limit:r,source:n}=await BJe(t);t.sessionCreditLimit=r,ce.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var qc=ue("credit_wrapup"),hye="low",jJe=t=>dc(t)?KD:ZD,mye=(t,e)=>e?t.mode==="create":!1,DV=(t,e)=>{if(t==="fix"){qc.log("Credit reserve reached outside of the main inference turn \u2014 letting the fix finish without a wrap-up"),ce.inc("session.credit_wrapup_skipped_fix_turn",1,{credit_reserve:e});return}if(t==="no_session"){qc.warn("Credit reserve reached but no session id yet \u2014 skipping wrap-up interrupt"),ce.inc("session.credit_wrapup_skipped_no_session",1,{credit_reserve:e});return}qc.log("Credit reserve reached with no turn to interrupt \u2014 the agent had already finished")},gye=(t,e,r)=>{if(e==null)return;let n=Math.max(0,e-t.creditsSpentBeforeWrapUp);qc.log("Credit wrap-up cost",{credits:n,creditsCostAtSessionEnd:e,effort:hye,inferenceAfterWrapUp:r,...t}),ce.distribution("session.credit_wrapup_cost",n,{outcome:t.outcome,effort:hye,credit_reserve:t.creditReserve,inference_after_wrap_up:r,...t.model?{model:t.model}:{}})},_ye=async({runnerResult:t,interruptedSessionId:e,creditsSpentBeforeWrapUp:r,cliPath:n,config:i,context:o,runner:s,aiGateway:a,cwd:c,persistSteps:l,usageTracker:u,withStageTimer:d,answerFold:f})=>{let p=$e().creditWrapUpReserve,h=new AbortController,m=!1,S=!1,E,b=Object.assign(async x=>{try{u.onAgentOutput()}catch(C){hs(C)&&!m&&(m=!0,qc.log("Wrap-up turn spent the credit reserve \u2014 stopping wrap-up",{creditsSpentBeforeWrapUp:r}),ce.inc("session.credit_wrapup_aborted",1,{credit_reserve:p}),h.abort())}return l(x)},{flush:l.flush.bind(l)});qc.log("Running credit wrap-up inference turn",{creditsSpentBeforeWrapUp:r,creditReserve:p});try{await l({steps:[{category:W.WrapUp,message:"You are reaching your usage limit. Wrapping up and leaving your work in a usable state."}],duration:0})}catch{}let A;try{let{runnerResult:x}=await d("inference-credit-wrapup",()=>Bc({cliPath:n,config:i,context:o,runner:s,persistSteps:b,aiGateway:a,cwd:c,contextPrefix:jJe(i),priorAgentSessionId:e,resumeForCreditWrapUp:!0,answerFold:f,forceLowEffortForCreditWrapUp:!0,abortSignal:h.signal}));E=x.resolvedModel,m&&qc.log("Wrap-up turn was aborted due to budget limit"),A={...my(t,x),resolvedModel:t.resolvedModel,effort:t.effort,resolvedProviderEffort:t.resolvedProviderEffort}}catch(x){qc.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:x?.message||x}),ce.inc("session.credit_wrapup_failed",1,{credit_reserve:p}),S=!0,A=t}let y=E??t.resolvedModel;return{runnerResult:A,costReport:{creditsSpentBeforeWrapUp:r,creditReserve:p,outcome:S?"failed":m?"aborted":"completed",...y?{model:y}:{}}}};var yye=t=>{let e,r=!1;return{getActiveTurn:()=>e?"main":r?"fix":"none",getMainTurnAbortSignal:()=>t?e?.signal:void 0,startMainTurn:()=>{e=new AbortController},finishMainTurn:()=>{e=void 0},runFixTurn:async n=>{r=!0;try{return await n()}finally{r=!1}},abortMainTurn:()=>e?.abort()}};import zJe from"process";var LV=ue("shutdown"),Sye=!1,GJe,qJe=async t=>{if(Sye)return;if(Sye=!0,LV.info("Shutting down...",{signal:t}),cie(),ce.distribution("session.hot_followups",kue()),!Nue()){let r=Date.now(),n=Mue(),i=Due();n!==void 0&&ce.timing("session.last_linger",r-n),i!==void 0&&ce.timing("session.total_linger",r-i)}let e=GJe?.close().catch(r=>{LV.error("Error closing server during graceful shutdown",r)});await $ue(),await e,await IA(),LV.info("Shutdown complete"),zJe.exit(0)};var Eye=t=>{qJe(t)};var Tye=4e3,VJe=3e4,vye=ue("credit_limit_preservation"),bye=async(t,e)=>{let r=null,n={},i=[];if(e){zh(e);let o=Ys(t.runner);i.push(Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:o,nativeSessionId:e}).then(s=>{r=s}),am({archive:o,cache:t.cache,nativeSessionId:e})]).catch(s=>{vye.warn("Failed to preserve native session on credit-limit shutdown",{error:s?.message||s})}))}if(t.mode!=="ask"&&i.push(Jw({config:t}).then(o=>o.hasChanges?Rq({config:t,diff:o.diff,diffBinary:o.diffBinary,resultDiff:o.resultDiff,resultDiffBinary:o.resultDiffBinary}):{}).then(o=>{n=o}).catch(o=>{vye.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:o?.message||o})})),i.length>0){let o=!1;await Promise.race([Promise.all(i).then(()=>{o=!0}),new Promise(s=>{setTimeout(s,VJe).unref()})]),o||ce.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var WJe=HJe(import.meta.url),nE=WJe("../package.json"),_t=ue("pipeline_index"),Sm=3,YJe=["codex","gemini"],zz=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:o=!1,enqueuedAt:s,tracing:a={}})=>{let c,l,u,d=null,f=Date.now(),p="success",h=!1,m,S,E=!1,b,A=!1,{withStageTimer:y}=lie(Ss.timeUnits.hours(4)),x=await wQ(nE.version,t.id,a),C=async R=>{let $=async(ee,k)=>{try{await k()}catch(g){_t.warn(`Teardown step failed: ${ee}`,{state:R,error:g?.message||g}),ce.inc("teardown.step_failed",1,{step:ee,state:R})}},_=R==="completed"&&!process.env.NETLIFY_LOCAL_MODE;await $("usage-tracker",()=>l?.stop()),(R==="errored"||_)&&await $("runner-cleanup",()=>c?.()),await $("db-proxy",()=>u?.stop()),_&&await $("reset-repo",()=>Pie(n))};_t.log(`Agent runner orchestrator v${nE.version}`,{featureFlags:$e().raw,metrics:kQ()});let O={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:nE.version,fast_init:t.fastInit,credit_wrapup:!1,budget_eligible:!1,budget_constrained:!1};E_({...O});let N=!!t.answeredInteraction;sye({isHotFollowUp:o,enqueuedAt:s}),Rie(t.sessionId);try{await Xm(Ke(),"run-pipeline",{},x,async R=>{await jz(Bz(),t.runner),R?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:$,context:_,persistSteps:ee,runner:k,sha:g}=await y("init",()=>hue({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:nE.version}),Ss.timeUnits.minutes(10)),v=k.runner;$e().idleTimeoutEnabled||(c=k.clean),await pye(t,o);let I=dc(t);O.budget_eligible=I,O.budget_constrained=I&&$e().creditWrapUpEnabled,E_({...O});let J=mye(t,$e().creditWrapUpEnabled),G=yye(J),le,Oe=!1,Ie=0,Ne,Re=$e().creditWrapUpReserve;l=dye(t.id,t.sessionId,t.sessionCreditLimit,{followPolledLimit:$e().creditCapFromPollEnabled,shouldPollOnTimer:$e().timedUsagePollEnabled,...J?{creditReserve:Re,onCreditReserveReached:()=>{if(!Oe){if(G.getActiveTurn()!=="main"){Oe=!0,DV(G.getActiveTurn(),Re);return}if(!Ne){DV("no_session",Re);return}Oe=!0,Ie=l?.getCreditsCost()??0,_t.log("Credit reserve reached \u2014 interrupting agent to wrap up",{creditsSpentBeforeWrapUp:Ie,creditReserve:Re}),O.credit_wrapup=!0,E_({...O}),ce.inc("session.credit_wrapup_triggered",1,{credit_reserve:Re}),G.abortMainTurn()}}}:{}});let ke=Rx(t.mode),we;t.deployAlias&&t.deployAlias.length>0?we=t.deployAlias:(t.deployAlias!==void 0&&!ke&&_t.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),we=Sie(t.id,process.env.SITE_NAME,ke));let fe=!1,ye=!1,Be=Object.assign(async Ee=>{fe||(fe=!0,aye({isHotFollowUp:o,enqueuedAt:s}));try{l?.onAgentOutput()}catch(et){return hs(et)?le??=et:_t.warn("Unexpected error in onAgentOutput",{error:et?.message||et}),ee(Ee)}return!ye&&Ee.steps?.some(et=>et.category!==W.Environment&&et.category!==W.SubagentPrompt)&&(ye=!0,cye({isHotFollowUp:o,enqueuedAt:s})),ee(Ee)},{flush:ee.flush.bind(ee)});if(t.sha=g,t.mode==="redeploy"){let Ee=await y("deploy",()=>WC({cliPath:r,config:t,context:_,result:"Redeploy completed",filter:i,isRetry:!1,deploySubdomain:we}));Ee.deployError&&(_t.warn(`Redeploy deploy failed: ${Ee.deployError}`),ce.inc("deploy.failed",1,{attempt:1})),iL({previewDeployed:!!Ee.previewInfo,hadFailedAttempts:!!Ee.deployError});let{diff:et,resultDiff:sr,previewInfo:Wr,diffBinary:Ku,resultDiffBinary:Iye,hasNetlifyForm:Cye,hasNetlifyIdentity:Pye}=Ee;await l?.stop(),await y("cleanup",()=>xq({config:t,diff:et,result:"Redeploy completed",duration:0,resultDiff:sr,diffBinary:Ku,resultDiffBinary:Iye,previewInfo:Wr,isProdDeploy:ke,hasNetlifyForm:Cye,hasNetlifyIdentity:Pye,nativeSessionArchive:Ys(t.runner)}),Ss.timeUnits.minutes(10),{interruptible:!1}),await C("completed");return}let H=jue(),oe=t.mode==="ask",M;if(t.mode==="create"&&(M=(await y("create",()=>Fce({config:t,cwd:n}))).additionalContext),oe?(d=Toe(t,we),d&&(M=[Eue({cliPath:r,branch:d.branch}),M].filter(Boolean).join(`
592
+ `)}var Vu=ue("usage_tracker"),LJe=4e3,$Je=5e3,UJe=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,FJe=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&e-t<=r,dye=(t,e,r,{creditReserve:n,onCreditReserveReached:i,followPolledLimit:o=!1,shouldPollOnTimer:s=!1}={})=>{let a=!1,c=!1,l=!1,u=!1,d,f,p,h=r,m,S=i!=null&&n!=null,E=()=>{m&&(clearInterval(m),m=void 0)},b=async()=>{try{let N=await DA(t,e);Vu.log("Usage update response",{usage:N?.usage});let R=N?.usage?.total_credits_cost;R!=null&&(d=R);let $=N?.enforced_credits_cap;if(o&&$!=null&&$!==h){let ee=h==null;h=$,Vu.log("Took the session credit limit from a usage poll",{sessionCreditLimit:h,totalCreditsCost:R,isFirstLimit:ee}),ee&&ce.inc("session.credit_cap_late_arrival",1)}let _=UJe(N?.credit_limit_exceeded,R,h);if(_&&(Vu.log("Credit limit exceeded",{totalCreditsCost:R,sessionCreditLimit:h}),l||(f=Date.now(),p=R??d??0),l=!0,E(),A.cancel()),S&&!u&&!_&&FJe(R,h,n)){u=!0,Vu.log("Credit reserve reached",{totalCreditsCost:R,sessionCreditLimit:h,creditReserve:n});try{i()}catch(ee){Vu.warn("onCreditReserveReached callback threw",{error:ee?.message||ee})}}}catch(N){Vu.warn("Failed to update usage",{error:N?.message||N})}},A=Ww(b,LJe);return{onAgentOutput:()=>{if(l)throw new Ii("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0);if(!c){if(a=!0,!s){A();return}m||(m=setInterval(()=>{A()},$Je),m.unref?.())}},stop:async()=>{c||(c=!0,E(),a&&(A.cancel(),Vu.log("Sending final usage update"),await b(),f!==void 0&&(ce.timing("credit_limit.overage_duration",Date.now()-f),ce.distribution("credit_limit.overage_credits",Math.max(0,(d??p??0)-(p??0))))))},getCreditsCost:()=>d,getSessionCreditLimit:()=>h}};var fye=ue("session_credit_limit"),BJe=async t=>{if(t.sessionCreditLimit!=null)return{limit:t.sessionCreditLimit,source:"env"};if(!$e().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await DA(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return fye.log("Resolved the session credit limit from the usage endpoint",{limit:e}),{limit:e,source:"usage"}}catch(e){fye.warn("Usage call for the session credit limit failed",{error:e?.message||e})}return{source:"none"}},pye=async(t,e=!1)=>{let{limit:r,source:n}=await BJe(t);t.sessionCreditLimit=r,ce.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var qc=ue("credit_wrapup"),hye="low",jJe=t=>dc(t)?KD:ZD,mye=(t,e)=>e?t.mode==="create":!1,DV=(t,e)=>{if(t==="fix"){qc.log("Credit reserve reached outside of the main inference turn \u2014 letting the fix finish without a wrap-up"),ce.inc("session.credit_wrapup_skipped_fix_turn",1,{credit_reserve:e});return}if(t==="no_session"){qc.warn("Credit reserve reached but no session id yet \u2014 skipping wrap-up interrupt"),ce.inc("session.credit_wrapup_skipped_no_session",1,{credit_reserve:e});return}qc.log("Credit reserve reached with no turn to interrupt \u2014 the agent had already finished")},gye=(t,e,r)=>{if(e==null)return;let n=Math.max(0,e-t.creditsSpentBeforeWrapUp);qc.log("Credit wrap-up cost",{credits:n,creditsCostAtSessionEnd:e,effort:hye,inferenceAfterWrapUp:r,...t}),ce.distribution("session.credit_wrapup_cost",n,{outcome:t.outcome,effort:hye,credit_reserve:t.creditReserve,inference_after_wrap_up:r,...t.model?{model:t.model}:{}})},_ye=async({runnerResult:t,interruptedSessionId:e,creditsSpentBeforeWrapUp:r,cliPath:n,config:i,context:o,runner:s,aiGateway:a,cwd:c,persistSteps:l,usageTracker:u,withStageTimer:d,answerFold:f})=>{let p=$e().creditWrapUpReserve,h=new AbortController,m=!1,S=!1,E,b=Object.assign(async x=>{try{u.onAgentOutput()}catch(C){hs(C)&&!m&&(m=!0,qc.log("Wrap-up turn spent the credit reserve \u2014 stopping wrap-up",{creditsSpentBeforeWrapUp:r}),ce.inc("session.credit_wrapup_aborted",1,{credit_reserve:p}),h.abort())}return l(x)},{flush:l.flush.bind(l)});qc.log("Running credit wrap-up inference turn",{creditsSpentBeforeWrapUp:r,creditReserve:p});try{await l({steps:[{category:W.WrapUp,message:"You are reaching your usage limit. Wrapping up and leaving your work in a usable state."}],duration:0})}catch{}let A;try{let{runnerResult:x}=await d("inference-credit-wrapup",()=>Bc({cliPath:n,config:i,context:o,runner:s,persistSteps:b,aiGateway:a,cwd:c,contextPrefix:jJe(i),priorAgentSessionId:e,resumeForCreditWrapUp:!0,answerFold:f,forceLowEffortForCreditWrapUp:!0,abortSignal:h.signal}));E=x.resolvedModel,m&&qc.log("Wrap-up turn was aborted due to budget limit"),A={...my(t,x),resolvedModel:t.resolvedModel,effort:t.effort,resolvedProviderEffort:t.resolvedProviderEffort}}catch(x){qc.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:x?.message||x}),ce.inc("session.credit_wrapup_failed",1,{credit_reserve:p}),S=!0,A=t}let y=E??t.resolvedModel;return{runnerResult:A,costReport:{creditsSpentBeforeWrapUp:r,creditReserve:p,outcome:S?"failed":m?"aborted":"completed",...y?{model:y}:{}}}};var yye=t=>{let e,r=!1;return{getActiveTurn:()=>e?"main":r?"fix":"none",getMainTurnAbortSignal:()=>t?e?.signal:void 0,startMainTurn:()=>{e=new AbortController},finishMainTurn:()=>{e=void 0},runFixTurn:async n=>{r=!0;try{return await n()}finally{r=!1}},abortMainTurn:()=>e?.abort()}};import zJe from"process";var LV=ue("shutdown"),Sye=!1,GJe,qJe=async t=>{if(Sye)return;if(Sye=!0,LV.info("Shutting down...",{signal:t}),cie(),ce.distribution("session.hot_followups",kue()),!Nue()){let r=Date.now(),n=Mue(),i=Due();n!==void 0&&ce.timing("session.last_linger",r-n),i!==void 0&&ce.timing("session.total_linger",r-i)}let e=GJe?.close().catch(r=>{LV.error("Error closing server during graceful shutdown",r)});await $ue(),await e,await IA(),LV.info("Shutdown complete"),zJe.exit(0)};var Eye=t=>{qJe(t)};var Tye=4e3,VJe=3e4,vye=ue("credit_limit_preservation"),bye=async(t,e)=>{let r=null,n={},i=[];if(e){zh(e);let o=Ys(t.runner);i.push(Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:o,nativeSessionId:e}).then(s=>{r=s}),am({archive:o,cache:t.cache,nativeSessionId:e})]).catch(s=>{vye.warn("Failed to preserve native session on credit-limit shutdown",{error:s?.message||s})}))}if(t.mode!=="ask"&&i.push(Jw({config:t}).then(o=>o.hasChanges?Rq({config:t,diff:o.diff,diffBinary:o.diffBinary,resultDiff:o.resultDiff,resultDiffBinary:o.resultDiffBinary}):{}).then(o=>{n=o}).catch(o=>{vye.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:o?.message||o})})),i.length>0){let o=!1;await Promise.race([Promise.all(i).then(()=>{o=!0}),new Promise(s=>{setTimeout(s,VJe).unref()})]),o||ce.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var WJe=HJe(import.meta.url),nE=WJe("../package.json"),_t=ue("pipeline_index"),Sm=3,YJe=["codex","gemini"],zz=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:o=!1,enqueuedAt:s,tracing:a={}})=>{let c,l,u,d=null,f=Date.now(),p="success",h=!1,m,S,E=!1,b,A=!1,{withStageTimer:y}=lie(Ss.timeUnits.hours(4)),x=await wQ(nE.version,t.id,a),C=async R=>{let $=async(ee,k)=>{try{await k()}catch(g){_t.warn(`Teardown step failed: ${ee}`,{state:R,error:g?.message||g}),ce.inc("teardown.step_failed",1,{step:ee,state:R})}},_=R==="completed"&&!process.env.NETLIFY_LOCAL_MODE;await $("usage-tracker",()=>l?.stop()),(R==="errored"||_)&&await $("runner-cleanup",()=>c?.()),await $("db-proxy",()=>u?.stop()),_&&await $("reset-repo",()=>Pie(n))};_t.log(`Agent runner orchestrator v${nE.version}`,{featureFlags:$e().raw,metrics:kQ()});let O={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:nE.version,fast_init:t.fastInit,credit_wrapup:!1,budget_eligible:!1,budget_constrained:!1};E_({...O});let N=!!t.answeredInteraction;sye({isHotFollowUp:o,enqueuedAt:s}),Rie(t.sessionId);try{await Xm(Ke(),"run-pipeline",{},x,async R=>{await jz(Bz(),t.runner),R?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:$,context:_,persistSteps:ee,runner:k,sha:g}=await y("init",()=>hue({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:nE.version}),Ss.timeUnits.minutes(10)),v=k.runner;$e().idleTimeoutEnabled||(c=k.clean),await pye(t,o);let I=dc(t);O.budget_eligible=I,O.budget_constrained=I&&$e().creditWrapUpEnabled,E_({...O});let J=mye(t,$e().creditWrapUpEnabled),q=yye(J),le,Oe=!1,Ie=0,Ne,Re=$e().creditWrapUpReserve;l=dye(t.id,t.sessionId,t.sessionCreditLimit,{followPolledLimit:$e().creditCapFromPollEnabled,shouldPollOnTimer:$e().timedUsagePollEnabled,...J?{creditReserve:Re,onCreditReserveReached:()=>{if(!Oe){if(q.getActiveTurn()!=="main"){Oe=!0,DV(q.getActiveTurn(),Re);return}if(!Ne){DV("no_session",Re);return}Oe=!0,Ie=l?.getCreditsCost()??0,_t.log("Credit reserve reached \u2014 interrupting agent to wrap up",{creditsSpentBeforeWrapUp:Ie,creditReserve:Re}),O.credit_wrapup=!0,E_({...O}),ce.inc("session.credit_wrapup_triggered",1,{credit_reserve:Re}),q.abortMainTurn()}}}:{}});let ke=Rx(t.mode),we;t.deployAlias&&t.deployAlias.length>0?we=t.deployAlias:(t.deployAlias!==void 0&&!ke&&_t.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),we=Sie(t.id,process.env.SITE_NAME,ke));let fe=!1,ye=!1,Be=Object.assign(async Ee=>{fe||(fe=!0,aye({isHotFollowUp:o,enqueuedAt:s}));try{l?.onAgentOutput()}catch(et){return hs(et)?le??=et:_t.warn("Unexpected error in onAgentOutput",{error:et?.message||et}),ee(Ee)}return!ye&&Ee.steps?.some(et=>et.category!==W.Environment&&et.category!==W.SubagentPrompt)&&(ye=!0,cye({isHotFollowUp:o,enqueuedAt:s})),ee(Ee)},{flush:ee.flush.bind(ee)});if(t.sha=g,t.mode==="redeploy"){let Ee=await y("deploy",()=>WC({cliPath:r,config:t,context:_,result:"Redeploy completed",filter:i,isRetry:!1,deploySubdomain:we}));Ee.deployError&&(_t.warn(`Redeploy deploy failed: ${Ee.deployError}`),ce.inc("deploy.failed",1,{attempt:1})),iL({previewDeployed:!!Ee.previewInfo,hadFailedAttempts:!!Ee.deployError});let{diff:et,resultDiff:sr,previewInfo:Wr,diffBinary:Ku,resultDiffBinary:Iye,hasNetlifyForm:Cye,hasNetlifyIdentity:Pye}=Ee;await l?.stop(),await y("cleanup",()=>xq({config:t,diff:et,result:"Redeploy completed",duration:0,resultDiff:sr,diffBinary:Ku,resultDiffBinary:Iye,previewInfo:Wr,isProdDeploy:ke,hasNetlifyForm:Cye,hasNetlifyIdentity:Pye,nativeSessionArchive:Ys(t.runner)}),Ss.timeUnits.minutes(10),{interruptible:!1}),await C("completed");return}let H=jue(),oe=t.mode==="ask",M;if(t.mode==="create"&&(M=(await y("create",()=>Fce({config:t,cwd:n}))).additionalContext),oe?(d=Toe(t,we),d&&(M=[Eue({cliPath:r,branch:d.branch}),M].filter(Boolean).join(`
588
593
 
589
594
  `),ce.inc("ask_mode.db_read_granted",1))):process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED="1",!oe&&!process.env.NETLIFY_LOCAL_MODE&&t.siteId){let Ee=await y("db-setup",()=>oye({siteId:t.siteId,isProd:ke,alias:we,connectionString:t.dbConnectionString}),Ss.timeUnits.minutes(10));if(u=Ee.proxy,n)if(Ee.proxy)M=[cge(),M].filter(Boolean).join(`
590
595
 
591
596
  `);else try{let et=await ZC({cliPath:r,cwd:n}),sr=lge(et);sr&&(M=[sr,M].filter(Boolean).join(`
592
597
 
593
- `))}catch(et){_t.warn("Skipping migration context injection \u2014 failed to build state block",{error:et})}}G.startMainTurn();let P=await y("inference",async()=>{try{return await Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,additionalContext:M,cwd:n,answerFold:H,abortSignal:G.getMainTurnAbortSignal(),onSessionId:J?Ee=>{Ne=Ee}:void 0})}catch(Ee){if(!(Ee instanceof gf)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw Ee;for(let et of YJe){if(le&&hs(le))throw le;if(et===t.runner)continue;let sr=Bh[et];if(sr){_t.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${et}`),E_({...O,agent:et}),await jz(Bz(),et);try{let Wr=await Bc({cliPath:r,config:{...t,runner:et},context:_,runner:sr.runner,persistSteps:Be,aiGateway:$,additionalContext:M,cwd:n,answerFold:H,abortSignal:G.getMainTurnAbortSignal()});return t.runner=et,v=sr.runner,$e().idleTimeoutEnabled||(c=sr.clean),Wr}catch(Wr){if(hs(Wr))throw Wr;_t.error(`Fallback runner ${et} also failed`,{error:String(Wr)})}}}throw Ee}}).finally(G.finishMainTurn),D=P.runnerResult;h=P.nativeResume??!1,m=D.resolvedModel,S=D.effort;let B=async(Ee,et)=>{let{runnerResult:sr}=await G.runFixTurn(()=>y(Ee,()=>Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,buildErrors:et,priorAgentSessionId:D.agentSessionId,answerFold:H})));if(le)throw Object.assign(le,{agentSessionId:sr.agentSessionId??D.agentSessionId}),le;D=my(D,sr)},V=D.agentSessionId;if(J&&Oe&&D.aborted&&!le&&V&&l){E=!0;let Ee=await _ye({runnerResult:D,interruptedSessionId:V,creditsSpentBeforeWrapUp:Ie,cliPath:r,config:t,context:_,runner:v,aiGateway:$,cwd:n,persistSteps:ee,usageTracker:l,withStageTimer:y,answerFold:H});D=Ee.runnerResult,b=Ee.costReport}if(t.mode==="create"&&await Uce(n??process.cwd()),le)throw Object.assign(le,{agentSessionId:D.agentSessionId}),le;if(D.pendingInteraction){let Ee=D.agentSessionId;Ee&&zh(Ee);let et=await zu({runnerId:t.id,sessionId:t.sessionId,archive:Ys(t.runner)}),sr;try{sr=await Fue(t,D.pendingInteraction,{nativeSessionId:Ee,nativeSessionS3Key:et??void 0})}catch(Wr){throw ce.inc("inference.pause_persist_failed",1),Wr}_t.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:sr,questionCount:D.pendingInteraction.questions.length}),ce.inc("inference.pending_question",1),ce.distribution("inference.questions_per_ask",D.pendingInteraction.questions.length),p="awaiting_input",await C("awaiting-input");return}let K=oe?{skipped:!0}:await KC({cwd:n});if(K.error&&(_t.log("Migration generation failed, running inference to fix the issue"),await B("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
598
+ `))}catch(et){_t.warn("Skipping migration context injection \u2014 failed to build state block",{error:et})}}q.startMainTurn();let P=await y("inference",async()=>{try{return await Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,additionalContext:M,cwd:n,answerFold:H,abortSignal:q.getMainTurnAbortSignal(),onSessionId:J?Ee=>{Ne=Ee}:void 0})}catch(Ee){if(!(Ee instanceof gf)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw Ee;for(let et of YJe){if(le&&hs(le))throw le;if(et===t.runner)continue;let sr=Bh[et];if(sr){_t.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${et}`),E_({...O,agent:et}),await jz(Bz(),et);try{let Wr=await Bc({cliPath:r,config:{...t,runner:et},context:_,runner:sr.runner,persistSteps:Be,aiGateway:$,additionalContext:M,cwd:n,answerFold:H,abortSignal:q.getMainTurnAbortSignal()});return t.runner=et,v=sr.runner,$e().idleTimeoutEnabled||(c=sr.clean),Wr}catch(Wr){if(hs(Wr))throw Wr;_t.error(`Fallback runner ${et} also failed`,{error:String(Wr)})}}}throw Ee}}).finally(q.finishMainTurn),D=P.runnerResult;h=P.nativeResume??!1,m=D.resolvedModel,S=D.effort;let B=async(Ee,et)=>{let{runnerResult:sr}=await q.runFixTurn(()=>y(Ee,()=>Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,buildErrors:et,priorAgentSessionId:D.agentSessionId,answerFold:H})));if(le)throw Object.assign(le,{agentSessionId:sr.agentSessionId??D.agentSessionId}),le;D=my(D,sr)},V=D.agentSessionId;if(J&&Oe&&D.aborted&&!le&&V&&l){E=!0;let Ee=await _ye({runnerResult:D,interruptedSessionId:V,creditsSpentBeforeWrapUp:Ie,cliPath:r,config:t,context:_,runner:v,aiGateway:$,cwd:n,persistSteps:ee,usageTracker:l,withStageTimer:y,answerFold:H});D=Ee.runnerResult,b=Ee.costReport}if(t.mode==="create"&&await Uce(n??process.cwd()),le)throw Object.assign(le,{agentSessionId:D.agentSessionId}),le;if(D.pendingInteraction){let Ee=D.agentSessionId;Ee&&zh(Ee);let et=await zu({runnerId:t.id,sessionId:t.sessionId,archive:Ys(t.runner)}),sr;try{sr=await Fue(t,D.pendingInteraction,{nativeSessionId:Ee,nativeSessionS3Key:et??void 0})}catch(Wr){throw ce.inc("inference.pause_persist_failed",1),Wr}_t.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:sr,questionCount:D.pendingInteraction.questions.length}),ce.inc("inference.pending_question",1),ce.distribution("inference.questions_per_ask",D.pendingInteraction.questions.length),p="awaiting_input",await C("awaiting-input");return}let K=oe?{skipped:!0}:await KC({cwd:n});if(K.error&&(_t.log("Migration generation failed, running inference to fix the issue"),await B("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
594
599
 
595
600
  ${K.error}
596
601
 
597
- Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await KC({cwd:n})),n&&!K.skipped){let Ee=await y("db-migrations-verify",()=>pge({cliPath:r,cwd:n}));Ee.error&&(_t.log("Migration drift detected, running inference to fix"),await B("inference-migration-drift-fix",[Ee.error]))}if($e().aiFnV1GuardrailEnabled&&n&&!oe)try{let Ee=await tL(n);Ee.v1>0&&(_t.log(`Detected ${Ee.v1} v1 AI function(s), running inference to fix`),await B("inference-ai-fn-v1-fix",[uye(Ee.v1Files)]))}catch(Ee){if(hs(Ee))throw Ee;_t.warn("ai_fn_v1_guardrail failed",{err:Ee})}let q=await y("deploy",()=>WC({cliPath:r,config:t,context:_,result:D.result,filter:i,isRetry:!1,deploySubdomain:we})),Se=q.hasChanges?q:void 0,xe=D;q.deployError&&ce.inc("deploy.failed",1,{attempt:1});let Ye=[],Ht;if(q.hasChanges&&q.deployError){Ye.push(IQ(q.deployError));let Ee=1,et=!1;for(;Ee<=Sm&&!q.previewInfo&&!et;)_t.log(`Deploy attempt had errors. Retrying. ${Ee}/${Sm}`),await Xm(Ke(),"deploy-stage",async sr=>{sr?.setAttributes({"stage.attempt":Ee});let Wr;try{A=E,Wr=(await G.runFixTurn(()=>y(`inference-retry-${Ee}`,()=>Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,buildErrors:Ye,priorAgentSessionId:D.agentSessionId,answerFold:H})))).runnerResult}catch(Ku){if(hs(Ku))throw Ku;_t.warn(`Inference retry ${Ee} failed, stopping deploy retries:`,Ku),et=!0;return}if(le)throw Object.assign(le,{agentSessionId:Wr.agentSessionId??D.agentSessionId}),le;xe=my(xe,Wr),oe||await KC({cwd:n}),q=await y(`deploy-retry-${Ee}`,()=>WC({cliPath:r,config:t,context:_,result:Wr.result,filter:i,isRetry:!0,deploySubdomain:we})),q.hasChanges&&(Se=q),q.deployError&&(ce.inc("deploy.failed",1,{attempt:Ee+1}),Ye.push(q.deployError)),Ee++});Ee>Sm&&!q.previewInfo&&(ce.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${Sm} retries, failing the create run`),Ht=new Error(`Deploy failed after ${Sm} retries`)):console.warn(`Deploy still failing after ${Sm} retries, completing run without a preview`))}let Hr=q.previewInfo||q.hasChanges?q:Se??q,{diff:gP,resultDiff:Hu,previewInfo:Vc,diffBinary:Wu,resultDiffBinary:Ut,hasNetlifyForm:At,hasNetlifyIdentity:Yu}=Hr;Hr.hasChanges&&iL({previewDeployed:!!Hr.previewInfo,hadFailedAttempts:Ye.length>0}),await l?.stop(),R?.setAttributes(PQ(xe,l?.getCreditsCost())),m=xe.resolvedModel,S=xe.effort??S;let _P=xe.agentSessionId??D.agentSessionId;if(_P&&zh(_P),await y("cleanup",()=>xq({config:t,diff:gP,result:xe.result,duration:xe.duration,resultDiff:Hu,diffBinary:Wu,resultDiffBinary:Ut,previewInfo:Vc,isProdDeploy:ke,hasNetlifyForm:At,hasNetlifyIdentity:Yu,nativeSessionArchive:Ys(t.runner),nativeSessionId:_P,finalAgentConfig:{agent:t.runner,model:m,effort:S},creditWrapUp:E}),Ss.timeUnits.minutes(10),{interruptible:!1}),Ht)throw Ht;try{let Ee=await tL(n??process.cwd());Ee.aiTotal>0&&R?.setAttributes({"agent.fn_ai_total":Ee.aiTotal,"agent.fn_ai_v1":Ee.v1,"agent.fn_ai_v2":Ee.v2,"agent.fn_ai_v3":Ee.v3,"agent.fn_ai_unknown":Ee.unknown})}catch{}if(await C("completed"),oe&&!process.env.NETLIFY_LOCAL_MODE)try{let Ee=await Oie(n);Ee.length>0&&(_t.warn(`Removed ${Ee.length} leftover untracked change(s) after ask run`,{removed:Ee}),ce.inc("ask_mode.leaked_untracked_files",Ee.length))}catch(Ee){_t.warn("Failed to remove untracked files after successful ask run",{error:Ee?.message||Ee})}let yP=t.siteId?await qQ(t.siteId):!1;typeof yP=="boolean"&&R?.setAttributes({"actual.has_db":yP}),await ZQ({config:t,hasDb:yP,pipelineSpan:R,resolvedModel:xe.resolvedModel??D.resolvedModel,cliVersion:nE.version})})}catch(R){if(hs(R)){p="gracefulError",_t.info("Agent run terminated gracefully",{statusCode:R.statusCode,reason:R.message}),await l?.stop();let v=R?.agentSessionId,I=R.isCreditLimitExceeded&&!!v,{nativeSessionS3Key:J,diffFields:G}=R.isCreditLimitExceeded?await bye(t,v):{nativeSessionS3Key:null,diffFields:{}};await C("errored");try{await vr(t.id,t.sessionId,{result:R.userMessage,state:R.isCreditLimitExceeded?"cancelled":"error",...R.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...I?{native_session_id:v}:{},...J?{native_session_s3_key:J}:{},...G,metadata:{final_agent_config:{agent:t.runner,model:m,effort:S},...E?{credit_wrap_up:!0}:{}}})}catch{_t.info("Could not update session (site may have been deleted)")}R.isCreditLimitExceeded&&Eye("credit_limit_cancelled");return}p=vo()?"interrupted":"error",_t.error("Got error while running pipeline",R),await l?.stop();let $=R?.agentSessionId,_=vo()&&!!$,ee=null;if(_){zh($);let v=Ys(t.runner);try{await Promise.race([Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:v,nativeSessionId:$}).then(I=>{ee=I}),am({archive:v,cache:t.cache,nativeSessionId:$})]),new Promise(I=>{setTimeout(I,Tye).unref()})])}catch(I){_t.warn("Failed to preserve native session before teardown",{error:I?.message||I})}}await C("errored");let k=R instanceof Error?R.shortMessage||R.message:"",g=k?Nce(hI(k)):"Encountered error when running agent";try{await vr(t.id,t.sessionId,{result:g,state:"error",..._?{native_session_id:$}:{},...ee?{native_session_s3_key:ee}:{}})}catch(v){_t.error("Failed to update session with error state, retrying with minimal payload:",v);try{await vr(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(I){_t.error("Failed to mark session as errored:",I)}}throw R}finally{d&&w1(),b&&gye(b,l?.getCreditsCost(),A),lye({isHotFollowUp:o,startedAt:f,outcome:p,nativeResume:h,isAnswerResume:N,creditsCost:l?.getCreditsCost(),model:m,effort:S})}};import Aye from"crypto";var Vr=ue("bin_local"),$n=(0,Rye.default)(Cr.argv.slice(2),{string:["cwd","cli-path","filter","prompt","runner","model","netlify-api-token","trace-exporter-url"],boolean:["verbose","help"],alias:{h:"help",v:"verbose"}}),UV=()=>{console.log(`
602
+ Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await KC({cwd:n})),n&&!K.skipped){let Ee=await y("db-migrations-verify",()=>pge({cliPath:r,cwd:n}));Ee.error&&(_t.log("Migration drift detected, running inference to fix"),await B("inference-migration-drift-fix",[Ee.error]))}if($e().aiFnV1GuardrailEnabled&&n&&!oe)try{let Ee=await tL(n);Ee.v1>0&&(_t.log(`Detected ${Ee.v1} v1 AI function(s), running inference to fix`),await B("inference-ai-fn-v1-fix",[uye(Ee.v1Files)]))}catch(Ee){if(hs(Ee))throw Ee;_t.warn("ai_fn_v1_guardrail failed",{err:Ee})}let G=await y("deploy",()=>WC({cliPath:r,config:t,context:_,result:D.result,filter:i,isRetry:!1,deploySubdomain:we})),Se=G.hasChanges?G:void 0,xe=D;G.deployError&&ce.inc("deploy.failed",1,{attempt:1});let Ye=[],Ht;if(G.hasChanges&&G.deployError){Ye.push(IQ(G.deployError));let Ee=1,et=!1;for(;Ee<=Sm&&!G.previewInfo&&!et;)_t.log(`Deploy attempt had errors. Retrying. ${Ee}/${Sm}`),await Xm(Ke(),"deploy-stage",async sr=>{sr?.setAttributes({"stage.attempt":Ee});let Wr;try{A=E,Wr=(await q.runFixTurn(()=>y(`inference-retry-${Ee}`,()=>Bc({cliPath:r,config:t,context:_,runner:v,persistSteps:Be,aiGateway:$,buildErrors:Ye,priorAgentSessionId:D.agentSessionId,answerFold:H})))).runnerResult}catch(Ku){if(hs(Ku))throw Ku;_t.warn(`Inference retry ${Ee} failed, stopping deploy retries:`,Ku),et=!0;return}if(le)throw Object.assign(le,{agentSessionId:Wr.agentSessionId??D.agentSessionId}),le;xe=my(xe,Wr),oe||await KC({cwd:n}),G=await y(`deploy-retry-${Ee}`,()=>WC({cliPath:r,config:t,context:_,result:Wr.result,filter:i,isRetry:!0,deploySubdomain:we})),G.hasChanges&&(Se=G),G.deployError&&(ce.inc("deploy.failed",1,{attempt:Ee+1}),Ye.push(G.deployError)),Ee++});Ee>Sm&&!G.previewInfo&&(ce.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${Sm} retries, failing the create run`),Ht=new Error(`Deploy failed after ${Sm} retries`)):console.warn(`Deploy still failing after ${Sm} retries, completing run without a preview`))}let Hr=G.previewInfo||G.hasChanges?G:Se??G,{diff:gP,resultDiff:Hu,previewInfo:Vc,diffBinary:Wu,resultDiffBinary:Ut,hasNetlifyForm:At,hasNetlifyIdentity:Yu}=Hr;Hr.hasChanges&&iL({previewDeployed:!!Hr.previewInfo,hadFailedAttempts:Ye.length>0}),await l?.stop(),R?.setAttributes(PQ(xe,l?.getCreditsCost())),m=xe.resolvedModel,S=xe.effort??S;let _P=xe.agentSessionId??D.agentSessionId;if(_P&&zh(_P),await y("cleanup",()=>xq({config:t,diff:gP,result:xe.result,duration:xe.duration,resultDiff:Hu,diffBinary:Wu,resultDiffBinary:Ut,previewInfo:Vc,isProdDeploy:ke,hasNetlifyForm:At,hasNetlifyIdentity:Yu,nativeSessionArchive:Ys(t.runner),nativeSessionId:_P,finalAgentConfig:{agent:t.runner,model:m,effort:S},creditWrapUp:E}),Ss.timeUnits.minutes(10),{interruptible:!1}),Ht)throw Ht;try{let Ee=await tL(n??process.cwd());Ee.aiTotal>0&&R?.setAttributes({"agent.fn_ai_total":Ee.aiTotal,"agent.fn_ai_v1":Ee.v1,"agent.fn_ai_v2":Ee.v2,"agent.fn_ai_v3":Ee.v3,"agent.fn_ai_unknown":Ee.unknown})}catch{}if(await C("completed"),oe&&!process.env.NETLIFY_LOCAL_MODE)try{let Ee=await Oie(n);Ee.length>0&&(_t.warn(`Removed ${Ee.length} leftover untracked change(s) after ask run`,{removed:Ee}),ce.inc("ask_mode.leaked_untracked_files",Ee.length))}catch(Ee){_t.warn("Failed to remove untracked files after successful ask run",{error:Ee?.message||Ee})}let yP=t.siteId?await qQ(t.siteId):!1;typeof yP=="boolean"&&R?.setAttributes({"actual.has_db":yP}),await ZQ({config:t,hasDb:yP,pipelineSpan:R,resolvedModel:xe.resolvedModel??D.resolvedModel,cliVersion:nE.version})})}catch(R){if(hs(R)){p="gracefulError",_t.info("Agent run terminated gracefully",{statusCode:R.statusCode,reason:R.message}),await l?.stop();let v=R?.agentSessionId,I=R.isCreditLimitExceeded&&!!v,{nativeSessionS3Key:J,diffFields:q}=R.isCreditLimitExceeded?await bye(t,v):{nativeSessionS3Key:null,diffFields:{}};await C("errored");try{await vr(t.id,t.sessionId,{result:R.userMessage,state:R.isCreditLimitExceeded?"cancelled":"error",...R.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...I?{native_session_id:v}:{},...J?{native_session_s3_key:J}:{},...q,metadata:{final_agent_config:{agent:t.runner,model:m,effort:S},...E?{credit_wrap_up:!0}:{}}})}catch{_t.info("Could not update session (site may have been deleted)")}R.isCreditLimitExceeded&&Eye("credit_limit_cancelled");return}p=vo()?"interrupted":"error",_t.error("Got error while running pipeline",R),await l?.stop();let $=R?.agentSessionId,_=vo()&&!!$,ee=null;if(_){zh($);let v=Ys(t.runner);try{await Promise.race([Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:v,nativeSessionId:$}).then(I=>{ee=I}),am({archive:v,cache:t.cache,nativeSessionId:$})]),new Promise(I=>{setTimeout(I,Tye).unref()})])}catch(I){_t.warn("Failed to preserve native session before teardown",{error:I?.message||I})}}await C("errored");let k=R instanceof Error?R.shortMessage||R.message:"",g=k?Nce(hI(k)):"Encountered error when running agent";try{await vr(t.id,t.sessionId,{result:g,state:"error",..._?{native_session_id:$}:{},...ee?{native_session_s3_key:ee}:{}})}catch(v){_t.error("Failed to update session with error state, retrying with minimal payload:",v);try{await vr(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(I){_t.error("Failed to mark session as errored:",I)}}throw R}finally{d&&w1(),b&&gye(b,l?.getCreditsCost(),A),lye({isHotFollowUp:o,startedAt:f,outcome:p,nativeResume:h,isAnswerResume:N,creditsCost:l?.getCreditsCost(),model:m,effort:S})}};import Aye from"crypto";var Vr=ue("bin_local"),$n=(0,Rye.default)(Cr.argv.slice(2),{string:["cwd","cli-path","filter","prompt","runner","model","netlify-api-token","trace-exporter-url"],boolean:["verbose","help"],alias:{h:"help",v:"verbose"}}),UV=()=>{console.log(`
598
603
  agent-runner-cli-local - Run Netlify agent runner locally without API connections
599
604
 
600
605
  USAGE: